File: commandlinehandler.adb

package info (click to toggle)
spark 2012.0.deb-9
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 29,260 kB
  • ctags: 3,098
  • sloc: ada: 186,243; cpp: 13,497; makefile: 685; yacc: 440; lex: 176; ansic: 119; sh: 16
file content (3638 lines) | stat: -rw-r--r-- 182,301 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
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
-------------------------------------------------------------------------------
-- (C) Altran Praxis Limited
-------------------------------------------------------------------------------
--
-- The SPARK toolset is free software; you can redistribute it and/or modify it
-- under terms of the GNU General Public License as published by the Free
-- Software Foundation; either version 3, or (at your option) any later
-- version. The SPARK toolset is distributed in the hope that it will be
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-- Public License for more details. You should have received a copy of the GNU
-- General Public License distributed with the SPARK toolset; see file
-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy of
-- the license.
--
--=============================================================================

with Ada.Characters.Handling;
with Ada.Characters.Latin_1;
with Ada.Command_Line;
with CommandLineData;
with FileSystem;
with ScreenEcho;
with SPARK_IO;
with ExaminerConstants;

use type CommandLineData.Concurrency_Profiles;
use type CommandLineData.Flow_Analysis_Options;
use type CommandLineData.Info_Flow_Policies;
use type CommandLineData.Language_Profiles;
use type SPARK_IO.File_Status;

package body CommandLineHandler is

   type Command_Line_Errors is (ES_Index,
                                ES_IndexName,
                                ES_NoIndex,
                                ES_SourceExt,
                                ES_ListingExt,
                                ES_NoReport,
                                ES_Report,
                                ES_ReportName,
                                ES_Rules,
                                ES_RuleUnknown,
                                ES_NoEcho,
                                ES_NoDict,
                                ES_NoDuration,
                                ES_Dict,
                                ES_InvalidOption,
                                ES_ListingFile,
                                ES_NoComma,
                                ES_Source,
                                EW_Overlap,
                                EW_Listing,
                                EW_Index,
                                EW_Report,
                                EW_Source,
                                ES_VCGandFDL,
                                ES_DPCandFDL,
                                ES_VCGRepeated,
                                ES_DPCRepeated,
                                ES_NoMorePFS,
                                ES_NoMoreRTC,
                                ES_NoMoreEXP,
                                ES_NoMoreReal,
                                ES_ErrorExplanations,
                                EW_Too_Many,
                                ES_Warning,
                                ES_WarningName,
                                ES_NoWarning,
                                EW_Warning,
                                ES_OutputDir,
                                ES_OutputDirRepeated,
                                ES_OutputDirNotFound,
                                SOFstyle,
                                ES_Syntax,
                                ES_Statistics,
                                ES_NoStatistics,
                                ES_FDLoption,
                                ES_InformationFlow,
                                ES_TargetData,
                                ES_TargetDataName,
                                ES_NoTargetData,
                                EW_Target,
                                ES_ConfigFile,
                                ES_ConfigFileName,
                                ES_NoConfigFile,
                                EW_Config,
                                ES_LanguageRepeated,
                                ES_LanguageProfile,
                                ES_NoRavenscarInSPARK83,
                                ES_NoSPARKLibInSPARK83,
                                ES_NoAutoFlowInSPARK83,
                                ES_Debug,
                                ES_Casing,
                                ES_Anno,
                                ES_Html,
                                ES_PlainOutput,
                                ES_Brief,
                                ES_BriefOption,
                                ES_XML,
                                ES_XMLandHTML,
                                ES_XMLnorep,
                                ES_HTMLnorep,
                                ES_DataFlowAndInfoFlowPolicy,
                                ES_OriginalFlowErrors,
                                ES_ErrorExplanationOption,
                                ES_JustificationRepeated,
                                ES_JustificationOption,
                                ES_Profile,
                                ES_ProfileOption,
                                ES_NoListings,
                                ES_DataAndConfig,
                                ES_Makefile,
                                ES_Makefile_Repeated);

   function Is_White_Space (Space_Char : Character) return Boolean is
   begin
      return (Space_Char = ' ') or else (Space_Char = Ada.Characters.Latin_1.HT) or else (Space_Char = Ada.Characters.Latin_1.CR);
   end Is_White_Space;

   procedure Output_Error (E : in Command_Line_Errors)
   --# global in     CommandLineData.Content;
   --#        in out SPARK_IO.File_Sys;
   --# derives SPARK_IO.File_Sys from *,
   --#                                CommandLineData.Content,
   --#                                E;
   is
      Check_Msg : constant String := " (check default switch file)";
   begin
      case E is
         when ES_Index =>
            ScreenEcho.Put_String ("Index option already specified or NoIndex option already specified" & Check_Msg);

         when ES_IndexName =>
            ScreenEcho.Put_String ("Index option incorrectly specified");

         when ES_Source =>
            ScreenEcho.Put_String ("Source file incorrectly specified");

         when ES_NoIndex =>
            ScreenEcho.Put_String ("NoIndex option already specified or Index option already specified" & Check_Msg);

         when ES_SourceExt =>
            ScreenEcho.Put_String ("Source extension option already specified or incorrectly specified");

         when ES_ListingExt =>
            ScreenEcho.Put_String ("Listing extension option already specified or incorrectly specified");

         when ES_NoReport =>
            ScreenEcho.Put_String ("NoReport option already specified, or contradictory report option found" & Check_Msg);

         when ES_Report =>
            ScreenEcho.Put_String ("Report option already specified or NoReport option already specified" & Check_Msg);

         when ES_ReportName =>
            ScreenEcho.Put_String ("Report option incorrectly specified");

         when ES_Rules =>
            ScreenEcho.Put_String ("Rules option may not appear more than once" & Check_Msg);

         when ES_RuleUnknown =>
            ScreenEcho.Put_String
              ("Rules option not recognised: legal values are: " &
                 CommandLineData.Option_Rules_None &
                 ", " &
                 CommandLineData.Option_Rules_Lazy &
                 ", " &
                 CommandLineData.Option_Rules_Keen &
                 ", " &
                 CommandLineData.Option_Rules_All);

         when ES_NoEcho =>
            ScreenEcho.Put_String ("NoEcho option may not appear more than once" & Check_Msg);

         when ES_NoDict =>
            ScreenEcho.Put_String
              ("NoDictionary option already specified or Dictionary option already specified (check default switch file)");

         when ES_NoDuration =>
            ScreenEcho.Put_String ("NoDuration option may not appear more than once" & Check_Msg);

         when ES_Dict =>
            ScreenEcho.Put_String
              ("Dictionary option already specified or NoDictionary option already specified (check default switch file)");

         when ES_InvalidOption =>
            ScreenEcho.Put_String ("Invalid command line option:");

         when ES_ListingFile =>
            ScreenEcho.Put_String ("Listing file option incorrect");

         when ES_NoComma =>
            ScreenEcho.Put_String ("Comma missing in line");

         when ES_VCGandFDL =>
            ScreenEcho.Put_String
              ("-" &
                 CommandLineData.Option_Vcg &
                 " and -" &
                 CommandLineData.Option_Fdl_Identifiers &
                 "=" &
                 CommandLineData.Option_Fdl_Identifiers_Accept &
                 " cannot be used together" &
                 Check_Msg);

         when ES_DPCandFDL =>
            ScreenEcho.Put_String
              ("-" &
                 CommandLineData.Option_Dpc &
                 " and -" &
                 CommandLineData.Option_Fdl_Identifiers &
                 "=" &
                 CommandLineData.Option_Fdl_Identifiers_Accept &
                 " cannot be used together" &
                 Check_Msg);

         when ES_VCGRepeated =>
            ScreenEcho.Put_String ("-" & CommandLineData.Option_Vcg & " already specified" & Check_Msg);

         when ES_DPCRepeated =>
            ScreenEcho.Put_String ("-" & CommandLineData.Option_Dpc & " already specified" & Check_Msg);

         when ES_NoMorePFS =>
            ScreenEcho.Put_String ("PFS option is no longer supported" & Check_Msg);

         when ES_NoMoreRTC =>
            ScreenEcho.Put_String
              ("RTC option is no longer supported. Please use -" & CommandLineData.Option_Vcg & " instead " & Check_Msg);

         when ES_NoMoreEXP =>
            ScreenEcho.Put_String
              ("EXP option is no longer supported. Please use -" & CommandLineData.Option_Vcg & " instead " & Check_Msg);

         when ES_NoMoreReal =>
            ScreenEcho.Put_String
              ("Real_RTCs option is no longer supported. Please use -" & CommandLineData.Option_Vcg & " instead " & Check_Msg);

         when ES_ErrorExplanations =>
            ScreenEcho.Put_String ("Error_Explanations option may not appear more than once" & Check_Msg);

         when EW_Overlap =>
            ScreenEcho.Put_String ("File argument is repeated:");

         when EW_Listing =>
            ScreenEcho.Put_String ("Cannot create file");

         when EW_Index =>
            ScreenEcho.Put_String ("Cannot open index file");

         when EW_Report =>
            ScreenEcho.Put_String ("Cannot create file");

         when EW_Source =>
            ScreenEcho.Put_String ("Cannot open source file");

         when EW_Too_Many =>
            ScreenEcho.Put_String ("Too many source files on command line");

         when ES_WarningName =>
            ScreenEcho.Put_String ("Warning option incorrectly specified");

         when ES_Warning =>
            ScreenEcho.Put_String ("Warning option already specified" & Check_Msg);

         when ES_NoWarning =>
            ScreenEcho.Put_String ("NoWarning option already specifies" & Check_Msg);

         when EW_Warning =>
            ScreenEcho.Put_String ("Cannot open warning control file");

         when ES_OutputDir =>
            ScreenEcho.Put_String ("Output directory option must have exactly one argument");

         when ES_OutputDirRepeated =>
            ScreenEcho.Put_String ("Output directory option already specified" & Check_Msg);

         when ES_OutputDirNotFound =>
            ScreenEcho.Put_String ("Cannot find or write to output directory");

         when SOFstyle =>
            ScreenEcho.Put_String ("-concat is no longer supported. -tree is now the default and only option" & Check_Msg);

         when ES_Syntax =>
            ScreenEcho.Put_String ("Syntax check option may not appear more than once" & Check_Msg);

         when ES_Statistics =>
            ScreenEcho.Put_String ("Statistics option already specified, or NoStatistics option already specified" & Check_Msg);

         when ES_NoStatistics =>
            ScreenEcho.Put_String ("NoStatistics option already specified, or Statistics option already specified" & Check_Msg);

         when ES_FDLoption =>
            ScreenEcho.Put_String ("FDL identifier option already specified, or contradictory option found" & Check_Msg);

         when ES_InformationFlow =>
            ScreenEcho.Put_String ("Flow analysis option already specified or incorrectly specified:");

         when ES_TargetDataName =>
            ScreenEcho.Put_String ("Target compiler data option incorrectly specified");

         when ES_TargetData =>
            ScreenEcho.Put_String
              ("Target compiler data option already specified or NoTarget compiler data option already specified" & Check_Msg);

         when ES_NoTargetData =>
            ScreenEcho.Put_String
              ("NoTarget compiler data option already specified or Target compiler data option already specified" & Check_Msg);

         when EW_Target =>
            ScreenEcho.Put_String ("Cannot open target data file");

         when ES_ConfigFileName =>
            ScreenEcho.Put_String ("Configuration file incorrectly specified");

         when ES_ConfigFile =>
            ScreenEcho.Put_String ("Configuration file already specified or NoConfiguration file already specified" & Check_Msg);

         when ES_NoConfigFile =>
            ScreenEcho.Put_String ("NoConfiguration file already specified or Configuration file already specified" & Check_Msg);

         when EW_Config =>
            ScreenEcho.Put_String ("Cannot open configuration file");

         when ES_LanguageRepeated =>
            ScreenEcho.Put_String ("Language profile already specified" & Check_Msg);

         when ES_LanguageProfile =>
            ScreenEcho.Put_String
              ("Language profile incorrect. Value must be one of " &
                 CommandLineData.Option_Language_83 &
                 ", " &
                 CommandLineData.Option_Language_95 &
                 ", ");
            if CommandLineData.Content.Distribution_Is_Pro then
               ScreenEcho.Put_String (CommandLineData.Option_Language_2005 & ", or " & CommandLineData.Option_Language_KCG);
            else
               ScreenEcho.Put_String ("or " & CommandLineData.Option_Language_2005);
            end if;

         when ES_NoRavenscarInSPARK83 =>
            ScreenEcho.Put_String ("Ravenscar concurrency profile is not permitted in SPARK83");

         when ES_NoSPARKLibInSPARK83 =>
            ScreenEcho.Put_String ("-sparklib is not permitted in SPARK83");

         when ES_NoAutoFlowInSPARK83 =>
            ScreenEcho.Put_String ("-flow=auto is not permitted in SPARK83");

         when ES_Debug =>
            ScreenEcho.Put_String ("Debugging option already specified, or incorrectly specified" & Check_Msg);

         when ES_Casing =>
            ScreenEcho.Put_String ("Casing option already specified, or incorrectly specified" & Check_Msg);

         when ES_Anno =>
            ScreenEcho.Put_String ("Annotation character option may not appear more than once" & Check_Msg);

         when ES_Html =>
            ScreenEcho.Put_String ("HTML option may not appear more than once" & Check_Msg);

         when ES_PlainOutput =>
            ScreenEcho.Put_String ("Plain output option may not appear more than once" & Check_Msg);

         when ES_Brief =>
            ScreenEcho.Put_String ("Brief output option may not appear more than once" & Check_Msg);

         when ES_BriefOption =>
            ScreenEcho.Put_String
              ("Brief option value must be one of: " &
                 CommandLineData.Option_Brief_No_Path &
                 " or " &
                 CommandLineData.Option_Brief_Full_Path);

         when ES_OriginalFlowErrors =>
            ScreenEcho.Put_String ("OriginalFlowErrors output option may not appear more than once" & Check_Msg);

         when ES_Profile =>
            ScreenEcho.Put_String ("Analysis profile option may not appear more than once" & Check_Msg);

         when ES_ProfileOption =>
            ScreenEcho.Put_String ("Analysis profile option incorrect:");

         when ES_ErrorExplanationOption =>
            ScreenEcho.Put_String ("Error_Explanation option incorrect:");

         when ES_DataAndConfig =>
            ScreenEcho.Put_String ("Target data and config file cannot be specified together" & Check_Msg);

         when ES_XML =>
            ScreenEcho.Put_String ("XML option may not appear more than once" & Check_Msg);

         when ES_XMLandHTML =>
            ScreenEcho.Put_String ("XML and HTML cannot be specified together" & Check_Msg);

         when ES_HTMLnorep =>
            ScreenEcho.Put_String ("HTML and noreport cannot be specified together" & Check_Msg);

         when ES_XMLnorep =>
            ScreenEcho.Put_String ("XML and noreport cannot be specified together" & Check_Msg);

         when ES_NoListings =>
            ScreenEcho.Put_String ("No listings option may not be specified more than once" & Check_Msg);

         when ES_DataFlowAndInfoFlowPolicy =>
            ScreenEcho.Put_String
              ("Information flow policy requires " &
                 CommandLineData.Option_Flow_Analysis &
                 "=" &
                 CommandLineData.Option_Flow_Analysis_Information);

         when ES_JustificationRepeated =>
            ScreenEcho.Put_String ("Justification_Option may not appear more than once" & Check_Msg);

         when ES_JustificationOption =>
            ScreenEcho.Put_String
              ("Justification_Option value must be one of: " &
                 CommandLineData.Option_Justification_Option_Ignore &
                 ", " &
                 CommandLineData.Option_Justification_Option_Full &
                 ", or " &
                 CommandLineData.Option_Justification_Option_Brief);

         when ES_Makefile =>
            ScreenEcho.Put_String
              ("The -" &
                 CommandLineData.Option_Makefile_Mode &
                 " option requires -" &
                 CommandLineData.Option_Brief &
                 " and is incompatible with -" &
                 CommandLineData.Option_No_Echo &
                 ".");

         when ES_Makefile_Repeated =>
            ScreenEcho.Put_String
              ("The -" & CommandLineData.Option_Makefile_Mode & " option may not be specified more than once" & Check_Msg);

      end case;
   end Output_Error;

   procedure Possible_Error (E : in Command_Line_Errors)
   --# global in     CommandLineData.Content;
   --#        in out SPARK_IO.File_Sys;
   --# derives SPARK_IO.File_Sys from *,
   --#                                CommandLineData.Content,
   --#                                E;
   is
   begin
      if not CommandLineData.Content.Valid then
         Output_Error (E => E);
         ScreenEcho.New_Line (1);
      end if;
   end Possible_Error;

   procedure Possible_Error2 (E : in Command_Line_Errors;
                              F : in E_Strings.T)
   --# global in     CommandLineData.Content;
   --#        in out SPARK_IO.File_Sys;
   --# derives SPARK_IO.File_Sys from *,
   --#                                CommandLineData.Content,
   --#                                E,
   --#                                F;
   is
   begin
      if not CommandLineData.Content.Valid then
         Output_Error (E => E);
         ScreenEcho.Put_Char (' ');
         if CommandLineData.Content.Plain_Output then
            ScreenEcho.Put_ExaminerLine (E_Strings.Lower_Case (E_Str => F));
         else
            ScreenEcho.Put_ExaminerLine (F);
         end if;
      end if;
   end Possible_Error2;

   procedure Read_Default_Switches (Default_Switches_Found : out Boolean;
                                    Cmd_Line               : out E_Strings.T)
   --# global in out SPARK_IO.File_Sys;
   --# derives Cmd_Line,
   --#         Default_Switches_Found,
   --#         SPARK_IO.File_Sys      from SPARK_IO.File_Sys;
   -- post (not Default_Switches_Found and Cmd_Line_Ptr = 1) or
   --      (Default_Switches_Found and Cmd_Line_Ptr = Cmd_Line'Last + 2);
   is

      Switch_File_Found : Boolean;
      Switch_File       : SPARK_IO.File_Type;
      Cmd_Line_Local    : E_Strings.T;
      Unused            : SPARK_IO.File_Status;

      procedure Open_File (Switch_File_Found : out Boolean;
                           Switch_File       : out SPARK_IO.File_Type)
      --# global in out SPARK_IO.File_Sys;
      --# derives SPARK_IO.File_Sys,
      --#         Switch_File,
      --#         Switch_File_Found from SPARK_IO.File_Sys;
      is
         Switch_File_Local : SPARK_IO.File_Type := SPARK_IO.Null_File;
         File_Status       : SPARK_IO.File_Status;
      begin
         SPARK_IO.Open (Switch_File_Local, SPARK_IO.In_File, 8, "spark.sw", "", File_Status);
         if File_Status = SPARK_IO.Ok then
            Switch_File_Found := True;
            Switch_File       := Switch_File_Local;
         else
            Switch_File_Found := False;
            Switch_File       := SPARK_IO.Null_File;
         end if;
      end Open_File;

      procedure Process_Switch_File (Switch_File : in     SPARK_IO.File_Type;
                                     Cmd_Line    : in out E_Strings.T)
      --# global in out SPARK_IO.File_Sys;
      --# derives Cmd_Line,
      --#         SPARK_IO.File_Sys from *,
      --#                                SPARK_IO.File_Sys,
      --#                                Switch_File;
      is
         Current_Line     : E_Strings.T;
         In_Quoted_String : Boolean;

         function Strip_Leading_Spaces (S : E_Strings.T) return E_Strings.T is
            Ptr : E_Strings.Positions := 1;
         begin
            loop
               exit when Ptr > E_Strings.Get_Length (E_Str => S);
               exit when not Is_White_Space (Space_Char => E_Strings.Get_Element (E_Str => S,
                                                                                  Pos   => Ptr));
               Ptr := Ptr + 1;
            end loop;
            return E_Strings.Section (E_Str     => S,
                                      Start_Pos => Ptr,
                                      Length    => (E_Strings.Get_Length (E_Str => S) - Ptr) + 1);
         end Strip_Leading_Spaces;

         function Strip_Comments (S : E_Strings.T) return E_Strings.T is
            Res : E_Strings.T;
         begin
            if E_Strings.Get_Element (E_Str => S,
                                      Pos   => 1) = '-'
              and then E_Strings.Get_Element (E_Str => S,
                                              Pos   => 2) = '-' then
               Res := E_Strings.Empty_String;
            else
               Res := S;
            end if;
            return Res;
         end Strip_Comments;

         function Line_Is_Empty (S : E_Strings.T) return Boolean is
         begin
            return E_Strings.Get_Length (E_Str => S) = 0;
         end Line_Is_Empty;

      begin -- Process_Switch_File
         In_Quoted_String := False;

         loop -- look for non-empty lines in switch file and process them
            exit when SPARK_IO.End_Of_File (Switch_File);

            E_Strings.Get_Line (File  => Switch_File,
                                E_Str => Current_Line);
            Current_Line := Strip_Comments (S => Strip_Leading_Spaces (S => Current_Line));
            if not Line_Is_Empty (S => Current_Line) then
               for I in E_Strings.Lengths range 1 .. E_Strings.Get_Length (E_Str => Current_Line) loop
                  -- premature exit if comment found in line
                  exit when E_Strings.Get_Element (E_Str => Current_Line,
                                                   Pos   => I) = '-'
                    and then I < E_Strings.Get_Length (E_Str => Current_Line)
                    and then E_Strings.Get_Element (E_Str => Current_Line,
                                                    Pos   => I + 1) = '-';

                  if E_Strings.Get_Element (E_Str => Current_Line,
                                            Pos   => I) = Ada.Characters.Latin_1.Quotation then
                     In_Quoted_String := not In_Quoted_String;
                  end if;

                  if In_Quoted_String then
                     --  In a quoted string, we leave the character
                     --  alone.
                     E_Strings.Append_Char (E_Str => Cmd_Line,
                                            Ch    => E_Strings.Get_Element (E_Str => Current_Line,
                                                                            Pos   => I));
                  elsif Is_White_Space (Space_Char => E_Strings.Get_Element (E_Str => Current_Line,
                                                                             Pos   => I)) then
                     --  Not in a quoted string, so whitespace gets
                     --  replaced by the host's preferred argument
                     --  separator character
                     E_Strings.Append_Char (E_Str => Cmd_Line,
                                            Ch    => FileSystem.Argument_Separator);
                  else
                     --  We just append the character as is in any
                     --  other case.
                     E_Strings.Append_Char (E_Str => Cmd_Line,
                                            Ch    => E_Strings.Get_Element (E_Str => Current_Line,
                                                                            Pos   => I));
                  end if;
               end loop;
               E_Strings.Append_Char (E_Str => Cmd_Line,
                                      Ch    => FileSystem.Argument_Separator);
            end if;
         end loop;
      end Process_Switch_File;

   begin -- Read_Default_Switches
      Cmd_Line_Local := E_Strings.Empty_String;

      Open_File (Switch_File_Found => Switch_File_Found,
                 Switch_File       => Switch_File);
      if Switch_File_Found then
         Process_Switch_File (Switch_File => Switch_File,
                              Cmd_Line    => Cmd_Line_Local);
         --# accept F, 10, Unused, "Returned status not used here" &
         --#        F, 10, Switch_File, "Returned handle not used here";
         SPARK_IO.Close (Switch_File, Unused); --expect flow error
      end if;

      Default_Switches_Found := Switch_File_Found;
      Cmd_Line               := Cmd_Line_Local;
      --# accept F, 33, Unused, "Unused not referenced here";
   end Read_Default_Switches;

   procedure Skip_Spaces (Command_String : in out Command_Strings) is
   begin
      loop
         exit when Command_String.Current_Position > E_Strings.Get_Length (E_Str => Command_String.Contents);

         exit when not ((E_Strings.Get_Element (E_Str => Command_String.Contents,
                                                Pos   => Command_String.Current_Position) = ' ')
                        or else (E_Strings.Get_Element (E_Str => Command_String.Contents,
                                                        Pos   => Command_String.Current_Position) =
                                   FileSystem.Argument_Separator));

         Command_String.Current_Position := Command_String.Current_Position + 1;
      end loop;
   end Skip_Spaces;

   procedure Read_The_String (Command_String : in out Command_Strings;
                              Next_Symbol    : in out Symbols) is
      Current_Ch : Character;
   begin
      Next_Symbol.The_String := E_Strings.Empty_String;
      Current_Ch             := E_Strings.Get_Element (E_Str => Command_String.Contents,
                                                       Pos   => Command_String.Current_Position);

      loop
         -- Skip over quotes, but allow spaces in the string
         if Current_Ch /= Ada.Characters.Latin_1.Quotation then
            E_Strings.Append_Char (E_Str => Next_Symbol.The_String,
                                   Ch    => Current_Ch);
         end if;

         Command_String.Current_Position := Command_String.Current_Position + 1;
         Current_Ch                      :=
           E_Strings.Get_Element (E_Str => Command_String.Contents,
                                  Pos   => Command_String.Current_Position);

         exit when Command_String.Current_Position > E_Strings.Get_Length (E_Str => Command_String.Contents)
           or else FileSystem.Is_An_Argument_Terminator (Ch => Current_Ch);
      end loop;
   end Read_The_String;

   procedure Get_Next_Symbol (Command_String : in out Command_Strings;
                              Next_Symbol    :    out Symbols)
   --# derives Command_String,
   --#         Next_Symbol    from Command_String;
   is
      Local_Next_Symbol : Symbols;
   begin
      -- This procedure is intended to return Next_Symbol; however, if the
      -- symbol is not a string then the string field is not set.  Although
      -- it is not used in these circumstances its lack of definition
      -- causes so many flow errors its is better to use an aggregate to
      -- initialize Next_Symbol here, and then assign the final value
      -- to Next_Symbol (for compatibility with the Ada83 "out parameter" rule
      Local_Next_Symbol := Symbols'(Typ        => S_Empty,
                                    The_String => E_Strings.Empty_String);

      Skip_Spaces (Command_String => Command_String);

      if Command_String.Current_Position <= E_Strings.Get_Length (E_Str => Command_String.Contents) then
         case E_Strings.Get_Element (E_Str => Command_String.Contents,
                                     Pos   => Command_String.Current_Position) is
            when '=' =>
               Local_Next_Symbol.Typ           := S_Equal;
               Command_String.Current_Position := Command_String.Current_Position + 1;
            when ',' =>
               --this condition is invariant for any particular system, we are actually
               --simulating conditional compilation for different target platforms.
               --Intended behaviour is correct despite flow error that will result.
               --# accept F, 22, "Stable expression here OK";
               if FileSystem.Use_Unix_Command_Line then
                  Local_Next_Symbol.Typ := S_String;
                  Read_The_String (Command_String => Command_String,
                                   Next_Symbol    => Local_Next_Symbol);
               else -- Windows
                  Local_Next_Symbol.Typ           := S_Comma;
                  Command_String.Current_Position := Command_String.Current_Position + 1;
               end if;
               --# end accept;
            when '-' =>
               --  On all platforms '-' is the switch character.
               Local_Next_Symbol.Typ           := S_Switch_Character;
               Command_String.Current_Position := Command_String.Current_Position + 1;
            when others =>
               Local_Next_Symbol.Typ := S_String;
               Read_The_String (Command_String => Command_String,
                                Next_Symbol    => Local_Next_Symbol);
         end case;
      else
         -- Exceeded maximum command line length
         Local_Next_Symbol.Typ := S_Empty;
      end if;

      Next_Symbol := Local_Next_Symbol;
   end Get_Next_Symbol;

   procedure Read_Option
     (Opt_Name       :    out E_Strings.T;
      Opt_Name_OK    :    out Boolean;
      Opt_Val        :    out E_Strings.T;
      Opt_Val_OK     :    out Boolean;
      Command_String : in out Command_Strings;
      Next_Symbol    :    out Symbols)
   --# derives Command_String,
   --#         Next_Symbol,
   --#         Opt_Name,
   --#         Opt_Name_OK,
   --#         Opt_Val,
   --#         Opt_Val_OK     from Command_String;
   --  pre  Next_Symbol.Typ = SSlash;
   is
      Opt_Name_OK_Local : Boolean;
      Local_Next_Symbol : Symbols;
   begin
      Opt_Val := E_Strings.Empty_String;
      Get_Next_Symbol (Command_String => Command_String,
                       Next_Symbol    => Local_Next_Symbol);
      Opt_Name_OK_Local := Local_Next_Symbol.Typ = S_String;
      Opt_Name          := Local_Next_Symbol.The_String;
      Get_Next_Symbol (Command_String => Command_String,
                       Next_Symbol    => Local_Next_Symbol);
      if Opt_Name_OK_Local and Local_Next_Symbol.Typ = S_Equal then
         Get_Next_Symbol (Command_String => Command_String,
                          Next_Symbol    => Local_Next_Symbol);
         Opt_Val_OK := Local_Next_Symbol.Typ = S_String;
         Opt_Val    := Local_Next_Symbol.The_String;
         Get_Next_Symbol (Command_String => Command_String,
                          Next_Symbol    => Local_Next_Symbol);
      else
         Opt_Val_OK := False;
      end if;
      Opt_Name_OK := Opt_Name_OK_Local;
      Next_Symbol := Local_Next_Symbol;
   end Read_Option;

   function Check_Option_Name (Opt_Name : E_Strings.T;
                               Str      : String) return Boolean is
      OK : Boolean := False;
   begin
      if E_Strings.Get_Length (E_Str => Opt_Name) <= Str'Length then
         for I in E_Strings.Lengths range 1 .. E_Strings.Get_Length (E_Str => Opt_Name) loop
            OK := Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                           Pos   => I)) =
              Ada.Characters.Handling.To_Lower (Str (I));
            exit when not OK;
         end loop;
      end if;
      return OK;
   end Check_Option_Name;

   procedure Parse_Command_Options (Command_String : in out Command_Strings;
                                    Next_Symbol    : in out Symbols)
   --# global in out CommandLineData.Content;
   --#        in out SPARK_IO.File_Sys;
   --# derives CommandLineData.Content,
   --#         Command_String,
   --#         Next_Symbol,
   --#         SPARK_IO.File_Sys       from *,
   --#                                      CommandLineData.Content,
   --#                                      Command_String,
   --#                                      Next_Symbol;
   is
      IndexFound               : Boolean := False;
      OutputDirectoryFound     : Boolean := False;
      WarningFound             : Boolean := False;
      NoWarningFound           : Boolean := False;
      SourceFound              : Boolean := False;
      ListingFound             : Boolean := False;
      OutputFound              : Boolean := False;
      ReportFound              : Boolean := False;
      ErrorExplanationsFound   : Boolean := False;
      JustificationOptionFound : Boolean := False;
      RulesFound               : Boolean := False;
      VCGFound                 : Boolean := False;
      DPCFound                 : Boolean := False;
      NoReportOptionFound      : Boolean := False;
      SyntaxCheckFound         : Boolean := False;
      StatisticsFound          : Boolean := False;
      FDLreserveOptionFound    : Boolean := False;
      FDLignoreOptionFound     : Boolean := False;
      FlowOptionFound          : Boolean := False;
      TargetDataFound          : Boolean := False;
      ConfigFileFound          : Boolean := False;
      LanguageProfileFound     : Boolean := False;
      DebugEnabledFound        : Boolean := False;
      CasingEnabledFound       : Boolean := False;
      AnnotationCharacterFound : Boolean := False;
      HTMLFound                : Boolean := False;
      PlainOutputFound         : Boolean := False;
      NoDurationFound          : Boolean := False;
      BriefFound               : Boolean := False;
      XMLFound                 : Boolean := False;
      OriginalFlowErrorsFound  : Boolean := False;
      NoListingsFound          : Boolean := False;
      DictFound                : Boolean := False;
      ConcurrencyProfileFound  : Boolean := False;
      Makefile_Found           : Boolean := False;

      Opt_Name, Opt_Val       : E_Strings.T;
      Opt_Name_OK, Opt_Val_OK : Boolean;

      procedure Process_A
      --# global in     FlowOptionFound;
      --#        in     Opt_Name;
      --#        in     Opt_Val;
      --#        in out AnnotationCharacterFound;
      --#        in out CommandLineData.Content;
      --#        in out LanguageProfileFound;
      --#        in out SPARK_IO.File_Sys;
      --# derives AnnotationCharacterFound,
      --#         LanguageProfileFound     from *,
      --#                                       Opt_Name &
      --#         CommandLineData.Content  from *,
      --#                                       AnnotationCharacterFound,
      --#                                       FlowOptionFound,
      --#                                       LanguageProfileFound,
      --#                                       Opt_Name,
      --#                                       Opt_Val &
      --#         SPARK_IO.File_Sys        from *,
      --#                                       AnnotationCharacterFound,
      --#                                       CommandLineData.Content,
      --#                                       LanguageProfileFound,
      --#                                       Opt_Name;
      is
      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Flow_Option, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Language_Profile, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Anno_Char, "Direct updates OK here";
         case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                       Pos   => 2)) is
            when 'd' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => "ada83") then
                  CommandLineData.Content.Valid := not LanguageProfileFound;
                  Possible_Error (E => ES_LanguageRepeated);
                  LanguageProfileFound                     := True;
                  CommandLineData.Content.Language_Profile := CommandLineData.SPARK83;
                  if not FlowOptionFound then
                     CommandLineData.Content.Flow_Option := CommandLineData.Info_Flow;
                  end if;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when 'n' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Annotation_Character) then
                  CommandLineData.Content.Valid := not AnnotationCharacterFound;
                  Possible_Error (E => ES_Anno);
                  AnnotationCharacterFound          := True;
                  CommandLineData.Content.Anno_Char := E_Strings.Get_Element (E_Str => Opt_Val,
                                                                              Pos   => 1);
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when others =>
               CommandLineData.Content.Valid := False;
               Possible_Error2 (E => ES_InvalidOption,
                                F => Opt_Name);
         end case;
         --# end accept;
      end Process_A;

      procedure Process_B
      --# global in     Opt_Name;
      --#        in     Opt_Val;
      --#        in     Opt_Val_OK;
      --#        in out BriefFound;
      --#        in out CommandLineData.Content;
      --#        in out SPARK_IO.File_Sys;
      --# derives BriefFound              from *,
      --#                                      Opt_Name &
      --#         CommandLineData.Content,
      --#         SPARK_IO.File_Sys       from *,
      --#                                      BriefFound,
      --#                                      CommandLineData.Content,
      --#                                      Opt_Name,
      --#                                      Opt_Val,
      --#                                      Opt_Val_OK;
      is
      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Brief_Option, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Brief, "Direct updates OK here";
         if Check_Option_Name (Opt_Name => Opt_Name,
                               Str      => CommandLineData.Option_Brief) then
            CommandLineData.Content.Valid := not BriefFound;
            Possible_Error (E => ES_Brief);
            BriefFound                    := True;
            CommandLineData.Content.Brief := True;

            if Opt_Val_OK then
               -- Overriding the default the default brief option: "-brief=something"
               case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Val,
                                                                             Pos   => 1)) is
                  when 'n' => -- 1st letter of option
                     if Check_Option_Name (Opt_Name => Opt_Val,
                                           Str      => CommandLineData.Option_Brief_No_Path) then
                        CommandLineData.Content.Brief_Option := CommandLineData.No_Path;
                     else -- error involving 'nopath'
                        CommandLineData.Content.Valid := False;
                        Possible_Error (E => ES_BriefOption);
                     end if;
                  when 'f' => -- 1st letter of option
                     if Check_Option_Name (Opt_Name => Opt_Val,
                                           Str      => CommandLineData.Option_Brief_Full_Path) then
                        CommandLineData.Content.Brief_Option := CommandLineData.Full_Path;
                     else               -- error involving 'fullpath'
                        CommandLineData.Content.Valid := False;
                        Possible_Error (E => ES_BriefOption);
                     end if;
                  when others =>
                     CommandLineData.Content.Valid := False;
                     Possible_Error (E => ES_BriefOption);
               end case;
            end if;
         else
            CommandLineData.Content.Valid := False;
            Possible_Error2 (E => ES_InvalidOption,
                             F => Opt_Name);
         end if;
         --# end accept;
      end Process_B;

      procedure Process_C
      --# global in     Opt_Name;
      --#        in     Opt_Val;
      --#        in     Opt_Val_OK;
      --#        in     TargetDataFound;
      --#        in out CasingEnabledFound;
      --#        in out CommandLineData.Content;
      --#        in out ConfigFileFound;
      --#        in out SPARK_IO.File_Sys;
      --# derives CasingEnabledFound      from *,
      --#                                      Opt_Name &
      --#         CommandLineData.Content,
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CasingEnabledFound,
      --#                                      CommandLineData.Content,
      --#                                      ConfigFileFound,
      --#                                      Opt_Name,
      --#                                      Opt_Val,
      --#                                      Opt_Val_OK,
      --#                                      TargetDataFound &
      --#         ConfigFileFound         from *,
      --#                                      Opt_Name,
      --#                                      Opt_Val_OK,
      --#                                      TargetDataFound;
      is
         File_Name : E_Strings.T;
      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Casing_Standard, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Casing_Identifier, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Target_Config, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Target_Config_File, "Direct updates OK here";

         case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                       Pos   => 2)) is
            when 'a' =>
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Casing) then
                  CommandLineData.Content.Valid := not CasingEnabledFound;
                  Possible_Error (E => ES_Casing);
                  CasingEnabledFound := True;
                  if Opt_Val_OK then
                     for I in Integer range 1 .. E_Strings.Get_Length (E_Str => Opt_Val) loop
                        case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Val,
                                                                                      Pos   => I)) is
                           when CommandLineData.Option_Casing_Standard =>
                              if CommandLineData.Content.Casing_Standard then
                                 CommandLineData.Content.Valid := False;
                                 Possible_Error (E => ES_Casing);
                              else
                                 CommandLineData.Content.Casing_Standard := True;
                              end if;
                           when CommandLineData.Option_Casing_Identifier =>
                              if CommandLineData.Content.Casing_Identifier then
                                 CommandLineData.Content.Valid := False;
                                 Possible_Error (E => ES_Casing);
                              else
                                 CommandLineData.Content.Casing_Identifier := True;
                              end if;
                           when others =>
                              CommandLineData.Content.Valid := False;
                              Possible_Error (E => ES_Casing);
                        end case;
                     end loop;
                  else
                     CommandLineData.Content.Casing_Standard   := True;
                     CommandLineData.Content.Casing_Identifier := True;
                  end if;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;
            when 'o' => -- 2nd letter
               case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                             Pos   => 3)) is -- 3rd letter
                  when 'n' =>
                     case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                                   Pos   => 4)) is -- 4th letter
                        when 'f' =>
                           if Check_Option_Name (Opt_Name => Opt_Name,
                                                 Str      => CommandLineData.Option_Config_File) then
                              if TargetDataFound then
                                 CommandLineData.Content.Valid := False;
                                 Possible_Error (E => ES_DataAndConfig);
                              else
                                 CommandLineData.Content.Valid := Opt_Val_OK;
                                 Possible_Error (E => ES_ConfigFileName);
                                 if Opt_Val_OK then
                                    CommandLineData.Content.Valid := not ConfigFileFound;
                                    Possible_Error (E => ES_ConfigFile);
                                 end if;
                                 if CommandLineData.Content.Valid then
                                    ConfigFileFound                       := True;
                                    CommandLineData.Content.Target_Config := True;
                                    File_Name                             := Opt_Val;
                                    FileSystem.Check_Extension
                                      (Fn  => File_Name,
                                       Ext => E_Strings.Copy_String (Str => CommandLineData.Default_Config_Extension));
                                    CommandLineData.Content.Target_Config_File := File_Name;
                                 end if;
                              end if;
                           else
                              CommandLineData.Content.Valid := False;
                              Possible_Error2 (E => ES_InvalidOption,
                                               F => Opt_Name);
                           end if;
                        when 'c' => -- 4th letter

                           -- -concat is removed in release 8.1.1 and above, but
                           -- recognize it here and warn the user.
                           if Check_Option_Name (Opt_Name => Opt_Name,
                                                 Str      => "concatenate") then
                              CommandLineData.Content.Valid := False;
                              Possible_Error (E => SOFstyle);
                           else
                              CommandLineData.Content.Valid := False;
                              Possible_Error2 (E => ES_InvalidOption,
                                               F => Opt_Name);
                           end if;
                        when others =>
                           CommandLineData.Content.Valid := False;
                           Possible_Error2 (E => ES_InvalidOption,
                                            F => Opt_Name);
                     end case;
                  when others =>
                     CommandLineData.Content.Valid := False;
                     Possible_Error2 (E => ES_InvalidOption,
                                      F => Opt_Name);
               end case;
            when others =>
               CommandLineData.Content.Valid := False;
               Possible_Error2 (E => ES_InvalidOption,
                                F => Opt_Name);
         end case;
         --# end accept;
      end Process_C;

      procedure Process_D
      --# global in     FDLignoreOptionFound;
      --#        in     Opt_Name;
      --#        in     Opt_Val;
      --#        in     Opt_Val_OK;
      --#        in out CommandLineData.Content;
      --#        in out DebugEnabledFound;
      --#        in out DictFound;
      --#        in out DPCFound;
      --#        in out SPARK_IO.File_Sys;
      --# derives CommandLineData.Content,
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CommandLineData.Content,
      --#                                      DebugEnabledFound,
      --#                                      DictFound,
      --#                                      DPCFound,
      --#                                      FDLignoreOptionFound,
      --#                                      Opt_Name,
      --#                                      Opt_Val,
      --#                                      Opt_Val_OK &
      --#         DebugEnabledFound,
      --#         DPCFound                from *,
      --#                                      Opt_Name &
      --#         DictFound               from *,
      --#                                      Opt_Name,
      --#                                      Opt_Val_OK;
      is
         Default_Dict_Extension : constant String := "dic";
         File_Name              : E_Strings.T;
      begin
         --# accept W, 169, CommandLineData.Content.DPC, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Write_Dict, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Dict_File_Name, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Debug.Enabled, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Debug.HTML, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Debug.Expressions, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Debug.Lookup_Trace, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Debug.File_Names, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Debug.Units, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Debug.Invariants, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Debug.Components, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Debug.Rho, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Debug.FDL_Ranking, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Debug.VCG, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Debug.Parser, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Debug.SLI, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Debug.VCG_All, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Debug.Extra_Stats, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Debug.DAG, "Direct updates OK here";
         case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                       Pos   => 2)) is
            when 'i' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Dictionary_File) then
                  CommandLineData.Content.Valid := Opt_Val_OK and then not DictFound;
                  Possible_Error (E => ES_Dict);

                  if CommandLineData.Content.Valid then
                     DictFound                          := True;
                     CommandLineData.Content.Write_Dict := True;
                     File_Name                          := Opt_Val;
                     FileSystem.Check_Extension (Fn  => File_Name,
                                                 Ext => E_Strings.Copy_String (Str => Default_Dict_Extension));
                     CommandLineData.Content.Dict_File_Name := File_Name;
                  end if;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;
            when 'e' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Debug) then
                  CommandLineData.Content.Valid := not DebugEnabledFound;
                  Possible_Error (E => ES_Debug);
                  DebugEnabledFound                     := True;
                  CommandLineData.Content.Debug.Enabled := True;

                  -- The -debug switch may also have a parameter which
                  -- is a list of character-codes for specific debug
                  -- options.  These are:
                  --   c  -  Print component manager state
                  --   e  -  Debug Expresion syntax and tree walking
                  --   f  -  Trace filename storage/open/create
                  --   h  -  Debug HTML generation
                  --   i  -  Print default loop invariants
                  --   k  -  Trace ranking and printing of FDL declarations
                  --   l  -  Trace dictionary Look-Ups
                  --   p  -  Print parser state on detection of syntax Error
                  --   r  -  Print computed Rho relation for each subprogram
                  --   u  -  Trace required units and index lookups
                  --   v  -  Print VCG State and BPG after DAG.BuildGraph
                  --   V  -  As v, but also print BPG during iteration of Graph.GenVCs
                  --   x  -  Print cross-reference debug
                  --   d  -  Print FDL DAG following BuildExpnDAG or
                  --         BuildAnnotationExpnDAG
                  -- These codes may be combined, so
                  --   -debug=eh and
                  --   -debug=he are both allowed and are equivalent

                  if Opt_Val_OK then
                     for I in Integer range 1 .. E_Strings.Get_Length (E_Str => Opt_Val) loop
                        case E_Strings.Get_Element (E_Str => Opt_Val,
                                                    Pos   => I) is
                           when CommandLineData.Option_Debug_C =>
                              CommandLineData.Content.Debug.Components := True;
                           when CommandLineData.Option_Debug_D =>
                              CommandLineData.Content.Debug.DAG := True;
                           when CommandLineData.Option_Debug_E =>
                              CommandLineData.Content.Debug.Expressions := True;
                           when CommandLineData.Option_Debug_F =>
                              CommandLineData.Content.Debug.File_Names := True;
                           when CommandLineData.Option_Debug_H =>
                              CommandLineData.Content.Debug.HTML := True;
                           when CommandLineData.Option_Debug_I =>
                              CommandLineData.Content.Debug.Invariants := True;
                           when CommandLineData.Option_Debug_K =>
                              CommandLineData.Content.Debug.FDL_Ranking := True;
                           when CommandLineData.Option_Debug_L =>
                              CommandLineData.Content.Debug.Lookup_Trace := True;
                           when CommandLineData.Option_Debug_P =>
                              CommandLineData.Content.Debug.Parser := True;
                           when CommandLineData.Option_Debug_R =>
                              CommandLineData.Content.Debug.Rho := True;
                           when CommandLineData.Option_Debug_T =>
                              CommandLineData.Content.Debug.Extra_Stats := True;
                           when CommandLineData.Option_Debug_U =>
                              CommandLineData.Content.Debug.Units := True;
                           when CommandLineData.Option_Debug_V =>
                              CommandLineData.Content.Debug.VCG := True;
                           when CommandLineData.Option_Debug_V_Upper =>
                              CommandLineData.Content.Debug.VCG     := True;
                              CommandLineData.Content.Debug.VCG_All := True;
                           when CommandLineData.Option_Debug_X =>
                              CommandLineData.Content.Debug.SLI := True;
                           when others =>
                              CommandLineData.Content.Valid := False;
                        end case;
                     end loop;
                     Possible_Error (E => ES_Debug);
                  end if;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when 'p' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Dpc) then
                  if DPCFound then
                     CommandLineData.Content.Valid := False;
                     Possible_Error (E => ES_DPCRepeated);
                  elsif FDLignoreOptionFound and then E_Strings.Is_Empty (E_Str => CommandLineData.Content.FDL_Mangle) then
                     CommandLineData.Content.Valid := False;
                     Possible_Error (E => ES_DPCandFDL);
                  else
                     CommandLineData.Content.Valid := True;
                  end if;
                  DPCFound                    := True;
                  CommandLineData.Content.DPC := True;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when others =>
               -- starts "d" but not valid
               CommandLineData.Content.Valid := False;
               Possible_Error2 (E => ES_InvalidOption,
                                F => Opt_Name);
         end case;
         --# end accept;
      end Process_D;

      procedure Process_E
      --# global in     Opt_Name;
      --#        in     Opt_Val;
      --#        in out CommandLineData.Content;
      --#        in out ErrorExplanationsFound;
      --#        in out SPARK_IO.File_Sys;
      --# derives CommandLineData.Content,
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CommandLineData.Content,
      --#                                      ErrorExplanationsFound,
      --#                                      Opt_Name,
      --#                                      Opt_Val &
      --#         ErrorExplanationsFound  from *,
      --#                                      Opt_Name;
      is
      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Error_Explanation, "Direct updates OK here";
         case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                       Pos   => 2)) is
            when 'x' => -- 2nd letter
               CommandLineData.Content.Valid := False;
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => "exp_checks") then
                  Possible_Error (E => ES_NoMoreEXP);
               else
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;
            when 'r' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Error_Explanations) then
                  CommandLineData.Content.Valid := not ErrorExplanationsFound;
                  Possible_Error (E => ES_ErrorExplanations);
                  if CommandLineData.Content.Valid then
                     ErrorExplanationsFound := True;
                     -- now check argument - must be one of Off, FirstOccurrence, EveryOccurrence
                     case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Val,
                                                                                   Pos   => 1)) is
                        when 'o' => -- 1st letter of option
                           if Check_Option_Name (Opt_Name => Opt_Val,
                                                 Str      => CommandLineData.Option_Error_Explanations_Off) then
                              CommandLineData.Content.Error_Explanation := CommandLineData.Off;
                           else -- error involving 'off'
                              CommandLineData.Content.Valid := False;
                              Possible_Error2 (E => ES_ErrorExplanationOption,
                                               F => Opt_Val);
                           end if;
                        when 'f' => -- 1st letter of option
                           if Check_Option_Name
                             (Opt_Name => Opt_Val,
                              Str      => CommandLineData.Option_Error_Explanations_First_Occurrence) then
                              CommandLineData.Content.Error_Explanation := CommandLineData.First_Occurrence;
                           else -- error involving 'first_occurrence'
                              CommandLineData.Content.Valid := False;
                              Possible_Error2 (E => ES_ErrorExplanationOption,
                                               F => Opt_Val);
                           end if;
                        when 'e' => -- 1st letter of option
                           if Check_Option_Name
                             (Opt_Name => Opt_Val,
                              Str      => CommandLineData.Option_Error_Explanations_Every_Occurrence) then
                              CommandLineData.Content.Error_Explanation := CommandLineData.Every_Occurrence;
                           else -- error involving 'every_occurrence'
                              CommandLineData.Content.Valid := False;
                              Possible_Error2 (E => ES_ErrorExplanationOption,
                                               F => Opt_Val);
                           end if;
                        when others =>
                           CommandLineData.Content.Valid := False;
                           Possible_Error2 (E => ES_ErrorExplanationOption,
                                            F => Opt_Val);
                     end case;
                  end if;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;
            when others =>
               CommandLineData.Content.Valid := False;
               Possible_Error2 (E => ES_InvalidOption,
                                F => Opt_Name);
         end case;
         --# end accept;
      end Process_E;

      procedure Process_F
      --# global in     DPCFound;
      --#        in     Opt_Name;
      --#        in     Opt_Val;
      --#        in     Opt_Val_OK;
      --#        in     VCGFound;
      --#        in out CommandLineData.Content;
      --#        in out FDLignoreOptionFound;
      --#        in out FDLreserveOptionFound;
      --#        in out FlowOptionFound;
      --#        in out SPARK_IO.File_Sys;
      --# derives CommandLineData.Content,
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CommandLineData.Content,
      --#                                      DPCFound,
      --#                                      FDLignoreOptionFound,
      --#                                      FDLreserveOptionFound,
      --#                                      FlowOptionFound,
      --#                                      Opt_Name,
      --#                                      Opt_Val,
      --#                                      Opt_Val_OK,
      --#                                      VCGFound &
      --#         FDLignoreOptionFound,
      --#         FDLreserveOptionFound   from *,
      --#                                      Opt_Name,
      --#                                      Opt_Val,
      --#                                      Opt_Val_OK &
      --#         FlowOptionFound         from *,
      --#                                      Opt_Name,
      --#                                      Opt_Val_OK;
      is
      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.FDL_Mangle, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.FDL_Reserved, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Flow_Option, "Direct updates OK here";
         case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                       Pos   => 2)) is
            when 'd' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Fdl_Identifiers) then
                  CommandLineData.Content.Valid := not (FDLreserveOptionFound or FDLignoreOptionFound);
                  Possible_Error (E => ES_FDLoption);
                  if Opt_Val_OK then
                     if Check_Option_Name (Opt_Name => Opt_Val,
                                           Str      => CommandLineData.Option_Fdl_Identifiers_Accept) then
                        CommandLineData.Content.FDL_Reserved := False;
                        CommandLineData.Content.Valid        := not VCGFound and not DPCFound;
                        if VCGFound then
                           Possible_Error (E => ES_VCGandFDL);
                        elsif DPCFound then
                           Possible_Error (E => ES_DPCandFDL);
                        end if;
                        FDLignoreOptionFound := True;
                     else
                        if Check_Option_Name (Opt_Name => Opt_Val,
                                              Str      => CommandLineData.Option_Fdl_Identifiers_Reject) then
                           CommandLineData.Content.FDL_Reserved := True;
                           FDLreserveOptionFound                := True;
                        else
                           CommandLineData.Content.FDL_Reserved := False; -- Will not reject fdl reserved words
                           CommandLineData.Content.FDL_Mangle   := Opt_Val;  -- But will mangle them
                           FDLignoreOptionFound                 := True;
                        end if;
                     end if;
                  else
                     ScreenEcho.Put_Line ("Warning: The -fdl option is now deprecated. Please use -fdl=reject");
                     FDLreserveOptionFound                := True;
                     CommandLineData.Content.FDL_Reserved := True;
                  end if;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when 'l' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Flow_Analysis) then
                  CommandLineData.Content.Valid := Opt_Val_OK and then not FlowOptionFound;
                  Possible_Error2 (E => ES_InformationFlow,
                                   F => Opt_Val);
                  if CommandLineData.Content.Valid then --go on to check selection
                     FlowOptionFound := True;
                     case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Val,
                                                                                   Pos   => 1)) is
                        when 'a' =>
                           if Check_Option_Name (Opt_Name => Opt_Val,
                                                 Str      => CommandLineData.Option_Flow_Analysis_Auto) then
                              CommandLineData.Content.Flow_Option := CommandLineData.Auto_Flow;
                           else -- something which begins with 'a' other than auto
                              CommandLineData.Content.Valid := False;
                              Possible_Error2 (E => ES_InformationFlow,
                                               F => Opt_Val);
                           end if;

                        when 'i' =>
                           if Check_Option_Name
                             (Opt_Name => Opt_Val,
                              Str      => CommandLineData.Option_Flow_Analysis_Information) then
                              CommandLineData.Content.Flow_Option := CommandLineData.Info_Flow;
                           else -- something which begins with 'i' other than information
                              CommandLineData.Content.Valid := False;
                              Possible_Error2 (E => ES_InformationFlow,
                                               F => Opt_Val);
                           end if;

                        when 'd' =>
                           if Check_Option_Name (Opt_Name => Opt_Val,
                                                 Str      => CommandLineData.Option_Flow_Analysis_Data) then
                              -- Here we have a potentially valid selection flow_analysis=data.
                              -- This is only allowed if information flow integrity checking has
                              -- not been selected
                              if (CommandLineData.Content.Info_Flow_Policy = CommandLineData.None) then
                                 CommandLineData.Content.Flow_Option := CommandLineData.Data_Flow;
                              else
                                 CommandLineData.Content.Valid := False;
                                 Possible_Error (E => ES_DataFlowAndInfoFlowPolicy);
                              end if;
                           else -- something which begins with 'd' other than data
                              CommandLineData.Content.Valid := False;
                              Possible_Error2 (E => ES_InformationFlow,
                                               F => Opt_Val);
                           end if;

                        when others => -- doesn't begin with 'i' or 'd'
                           CommandLineData.Content.Valid := False;
                           Possible_Error2 (E => ES_InformationFlow,
                                            F => Opt_Val);
                     end case;
                  end if;
               else -- begins with 'f' but not fdl... or flow...
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when others =>
               CommandLineData.Content.Valid := False;
               Possible_Error2 (E => ES_InvalidOption,
                                F => Opt_Name);
         end case;
         --# end accept;
      end Process_F;

      procedure Process_G
      --# global in     Opt_Name;
      --#        in out CommandLineData.Content;
      --#        in out SPARK_IO.File_Sys;
      --# derives CommandLineData.Content,
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CommandLineData.Content,
      --#                                      Opt_Name;
      is
      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Distribution_Is_Pro, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.GPL_Switch, "Direct updates OK here";
         if Check_Option_Name (Opt_Name => Opt_Name,
                               Str      => CommandLineData.Option_GPL) then
            CommandLineData.Content.Valid               := True;
            CommandLineData.Content.Distribution_Is_Pro := False;
            CommandLineData.Content.GPL_Switch          := True;
         else
            CommandLineData.Content.Valid := False;
            Possible_Error2 (E => ES_InvalidOption,
                             F => Opt_Name);
         end if;
      end Process_G;

      procedure Process_H
      --# global in     NoReportOptionFound;
      --#        in     Opt_Name;
      --#        in     Opt_Val;
      --#        in     Opt_Val_OK;
      --#        in     XMLFound;
      --#        in out CommandLineData.Content;
      --#        in out HTMLFound;
      --#        in out SPARK_IO.File_Sys;
      --# derives CommandLineData.Content from *,
      --#                                      HTMLFound,
      --#                                      NoReportOptionFound,
      --#                                      Opt_Name,
      --#                                      Opt_Val,
      --#                                      Opt_Val_OK,
      --#                                      XMLFound &
      --#         HTMLFound               from *,
      --#                                      Opt_Name &
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CommandLineData.Content,
      --#                                      HTMLFound,
      --#                                      NoReportOptionFound,
      --#                                      Opt_Name,
      --#                                      XMLFound;
      is
      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.HTML, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.HTML_Directory, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Plain_Output, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Help_Requested, "Direct updates OK here";
         case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                       Pos   => 2)) is
            when 't' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Html) then
                  CommandLineData.Content.Valid := not (HTMLFound or else NoReportOptionFound or else XMLFound);

                  if XMLFound then
                     Possible_Error (E => ES_XMLandHTML);
                  elsif NoReportOptionFound then
                     Possible_Error (E => ES_HTMLnorep);
                  else
                     Possible_Error (E => ES_Html);
                  end if;

                  HTMLFound                    := True;
                  CommandLineData.Content.HTML := True;
                  if Opt_Val_OK then
                     CommandLineData.Content.HTML_Directory := Opt_Val;
                  end if;

               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;
            when 'e' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Help) then
                  -- Examiner Help requested, so abandon all further
                  -- option processing by setting Valid = False.
                  CommandLineData.Content.Valid          := False;
                  CommandLineData.Content.Help_Requested := True;
                  -- Override setting of PlainOutput so Help information
                  -- always appears with Examiner version number and date.
                  CommandLineData.Content.Plain_Output := False;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;
            when others =>
               CommandLineData.Content.Valid := False;
               Possible_Error2 (E => ES_InvalidOption,
                                F => Opt_Name);
         end case;
         --# end accept;
      end Process_H;

      procedure Process_I
      --# global in     Opt_Name;
      --#        in     Opt_Val;
      --#        in     Opt_Val_OK;
      --#        in out CommandLineData.Content;
      --#        in out IndexFound;
      --#        in out SPARK_IO.File_Sys;
      --# derives CommandLineData.Content from *,
      --#                                      IndexFound,
      --#                                      Opt_Name,
      --#                                      Opt_Val,
      --#                                      Opt_Val_OK &
      --#         IndexFound              from *,
      --#                                      Opt_Name,
      --#                                      Opt_Val_OK &
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CommandLineData.Content,
      --#                                      IndexFound,
      --#                                      Opt_Name,
      --#                                      Opt_Val_OK;
      is
         File_Name : E_Strings.T;
      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Index, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Index_File_Name, "Direct updates OK here";
         if Check_Option_Name (Opt_Name => Opt_Name,
                               Str      => CommandLineData.Option_Index_File) then
            CommandLineData.Content.Valid := Opt_Val_OK;
            Possible_Error (E => ES_IndexName);
            if Opt_Val_OK then
               CommandLineData.Content.Valid := not IndexFound;
               Possible_Error (E => ES_Index);
            end if;

            if CommandLineData.Content.Valid then
               IndexFound                    := True;
               CommandLineData.Content.Index := True;
               File_Name                     := Opt_Val;

               FileSystem.Check_Extension
                 (Fn  => File_Name,
                  Ext => E_Strings.Copy_String (Str => CommandLineData.Default_Index_Extension));
               CommandLineData.Content.Index_File_Name := File_Name;
            end if;
         else
            CommandLineData.Content.Valid := False;
            Possible_Error2 (E => ES_InvalidOption,
                             F => Opt_Name);
         end if;
         --# end accept;
      end Process_I;

      procedure Process_J
      --# global in     Opt_Name;
      --#        in     Opt_Val;
      --#        in out CommandLineData.Content;
      --#        in out JustificationOptionFound;
      --#        in out SPARK_IO.File_Sys;
      --# derives CommandLineData.Content,
      --#         SPARK_IO.File_Sys        from *,
      --#                                       CommandLineData.Content,
      --#                                       JustificationOptionFound,
      --#                                       Opt_Name,
      --#                                       Opt_Val &
      --#         JustificationOptionFound from *,
      --#                                       Opt_Name;
      is
      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Justification_Option, "Direct updates OK here";
         if Check_Option_Name (Opt_Name => Opt_Name,
                               Str      => CommandLineData.Option_Justification_Option) then
            CommandLineData.Content.Valid := not JustificationOptionFound;
            Possible_Error (E => ES_JustificationRepeated);
            if CommandLineData.Content.Valid then
               JustificationOptionFound := True;
               -- now check argument - must be one of Ignore, Full, or Brief
               case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Val,
                                                                             Pos   => 1)) is
                  when 'i' => -- 1st letter of option
                     if Check_Option_Name (Opt_Name => Opt_Val,
                                           Str      => CommandLineData.Option_Justification_Option_Ignore) then
                        CommandLineData.Content.Justification_Option := CommandLineData.Ignore;
                     else -- error involving 'ignore'
                        CommandLineData.Content.Valid := False;
                        Possible_Error (E => ES_JustificationOption);
                     end if;
                  when 'f' => -- 1st letter of option
                     if Check_Option_Name (Opt_Name => Opt_Val,
                                           Str      => CommandLineData.Option_Justification_Option_Full) then
                        CommandLineData.Content.Justification_Option := CommandLineData.Full;
                     else -- error involving 'full'
                        CommandLineData.Content.Valid := False;
                        Possible_Error (E => ES_JustificationOption);
                     end if;
                  when 'b' => -- 1st letter of option
                     if Check_Option_Name (Opt_Name => Opt_Val,
                                           Str      => CommandLineData.Option_Justification_Option_Brief) then
                        CommandLineData.Content.Justification_Option := CommandLineData.Brief;
                     else -- error involving 'brief'
                        CommandLineData.Content.Valid := False;
                        Possible_Error (E => ES_JustificationOption);
                     end if;
                  when others =>
                     CommandLineData.Content.Valid := False;
                     Possible_Error (E => ES_JustificationOption);
               end case;
            end if;
         else
            CommandLineData.Content.Valid := False;
            Possible_Error2 (E => ES_InvalidOption,
                             F => Opt_Name);
         end if;
         --# end accept;
      end Process_J;

      procedure Process_L
      --# global in     FlowOptionFound;
      --#        in     Opt_Name;
      --#        in     Opt_Val;
      --#        in     Opt_Val_OK;
      --#        in out CommandLineData.Content;
      --#        in out LanguageProfileFound;
      --#        in out ListingFound;
      --#        in out SPARK_IO.File_Sys;
      --# derives CommandLineData.Content from *,
      --#                                      FlowOptionFound,
      --#                                      LanguageProfileFound,
      --#                                      ListingFound,
      --#                                      Opt_Name,
      --#                                      Opt_Val,
      --#                                      Opt_Val_OK &
      --#         LanguageProfileFound,
      --#         ListingFound            from *,
      --#                                      Opt_Name &
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CommandLineData.Content,
      --#                                      LanguageProfileFound,
      --#                                      ListingFound,
      --#                                      Opt_Name,
      --#                                      Opt_Val,
      --#                                      Opt_Val_OK;
      is
      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Flow_Option, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Language_Profile, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Listing_Extension, "Direct updates OK here";
         case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                       Pos   => 2)) is
            when 'i' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Listing_Extension) then
                  CommandLineData.Content.Valid := Opt_Val_OK and then not ListingFound;
                  Possible_Error (E => ES_ListingExt);
                  ListingFound                              := True;
                  CommandLineData.Content.Listing_Extension := Opt_Val;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when 'a' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Language) then
                  CommandLineData.Content.Valid := not LanguageProfileFound;
                  Possible_Error (E => ES_LanguageRepeated);
                  if CommandLineData.Content.Valid then
                     LanguageProfileFound := True;
                     -- now check argument - must be one of 83, 95, 2005, or KCG
                     case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Val,
                                                                                   Pos   => 1)) is
                        when '8' => -- 1st letter of option
                           if Check_Option_Name (Opt_Name => Opt_Val,
                                                 Str      => CommandLineData.Option_Language_83) then
                              CommandLineData.Content.Language_Profile := CommandLineData.SPARK83;
                              if not FlowOptionFound then
                                 CommandLineData.Content.Flow_Option := CommandLineData.Info_Flow;
                              end if;
                           else -- error involving '83'
                              CommandLineData.Content.Valid := False;
                              Possible_Error (E => ES_LanguageProfile);
                           end if;
                        when '9' =>
                           if Check_Option_Name (Opt_Name => Opt_Val,
                                                 Str      => CommandLineData.Option_Language_95) then
                              CommandLineData.Content.Language_Profile := CommandLineData.SPARK95;
                           else -- error involving '95'
                              CommandLineData.Content.Valid := False;
                              Possible_Error (E => ES_LanguageProfile);
                           end if;
                        when '2' =>
                           if Check_Option_Name (Opt_Name => Opt_Val,
                                                 Str      => CommandLineData.Option_Language_2005) then
                              CommandLineData.Content.Language_Profile := CommandLineData.SPARK2005;
                           else -- error involving '2005'
                              CommandLineData.Content.Valid := False;
                              Possible_Error (E => ES_LanguageProfile);
                           end if;
                        when 'k' =>
                           if Check_Option_Name (Opt_Name => Opt_Val,
                                                 Str      => CommandLineData.Option_Language_KCG)
                             and then CommandLineData.Content.Distribution_Is_Pro then
                              CommandLineData.Content.Language_Profile := CommandLineData.KCG;
                           else -- error involving 'KCG'
                              CommandLineData.Content.Valid := False;
                              Possible_Error (E => ES_LanguageProfile);
                           end if;
                        when others =>
                           CommandLineData.Content.Valid := False;
                           Possible_Error (E => ES_LanguageProfile);
                     end case;
                  end if;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;
            when others =>
               CommandLineData.Content.Valid := False;
               Possible_Error2 (E => ES_InvalidOption,
                                F => Opt_Name);
         end case;

         --# end accept;
      end Process_L;

      procedure Process_M
      --# global in     Opt_Name;
      --#        in out CommandLineData.Content;
      --#        in out Makefile_Found;
      --#        in out SPARK_IO.File_Sys;
      --# derives CommandLineData.Content,
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CommandLineData.Content,
      --#                                      Makefile_Found,
      --#                                      Opt_Name &
      --#         Makefile_Found          from *,
      --#                                      Opt_Name;
      is
      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Makefile_Mode, "Direct updates OK here";

         --  There is only a single option starting with m.
         if Check_Option_Name (Opt_Name => Opt_Name,
                               Str      => CommandLineData.Option_Makefile_Mode) then

            CommandLineData.Content.Valid := not Makefile_Found;
            Possible_Error (E => ES_Makefile_Repeated);

            if CommandLineData.Content.Valid then
               Makefile_Found                        := True;
               CommandLineData.Content.Makefile_Mode := True;
            end if;
         else
            CommandLineData.Content.Valid := False;
            Possible_Error2 (E => ES_InvalidOption,
                             F => Opt_Name);
         end if;
      end Process_M;

      procedure Process_N
      --# global in     DPCFound;
      --#        in     FDLreserveOptionFound;
      --#        in     HTMLFound;
      --#        in     Opt_Name;
      --#        in     VCGFound;
      --#        in     XMLFound;
      --#        in out CommandLineData.Content;
      --#        in out ConfigFileFound;
      --#        in out DictFound;
      --#        in out FDLignoreOptionFound;
      --#        in out IndexFound;
      --#        in out NoDurationFound;
      --#        in out NoListingsFound;
      --#        in out NoReportOptionFound;
      --#        in out NoWarningFound;
      --#        in out OutputFound;
      --#        in out ReportFound;
      --#        in out SPARK_IO.File_Sys;
      --#        in out StatisticsFound;
      --#        in out TargetDataFound;
      --# derives CommandLineData.Content,
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CommandLineData.Content,
      --#                                      ConfigFileFound,
      --#                                      DictFound,
      --#                                      DPCFound,
      --#                                      FDLignoreOptionFound,
      --#                                      FDLreserveOptionFound,
      --#                                      HTMLFound,
      --#                                      IndexFound,
      --#                                      NoDurationFound,
      --#                                      NoListingsFound,
      --#                                      NoWarningFound,
      --#                                      Opt_Name,
      --#                                      OutputFound,
      --#                                      ReportFound,
      --#                                      StatisticsFound,
      --#                                      TargetDataFound,
      --#                                      VCGFound,
      --#                                      XMLFound &
      --#         ConfigFileFound,
      --#         DictFound,
      --#         FDLignoreOptionFound,
      --#         IndexFound,
      --#         NoDurationFound,
      --#         NoListingsFound,
      --#         NoReportOptionFound,
      --#         NoWarningFound,
      --#         OutputFound,
      --#         ReportFound,
      --#         StatisticsFound,
      --#         TargetDataFound         from *,
      --#                                      Opt_Name;
      is
      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Index, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Warning, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Echo, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Generate_SLI, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Report, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.No_Duration, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Write_Dict, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Write_Statistics, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.FDL_Reserved, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Target_Data , "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Target_Config, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.No_Listings, "Direct updates OK here";
         case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                       Pos   => 3)) is
            when 'i' => -- 3rd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => "no" & CommandLineData.Option_Index_File) then
                  CommandLineData.Content.Valid := not IndexFound;
                  Possible_Error (E => ES_NoIndex);
                  IndexFound                    := True;
                  CommandLineData.Content.Index := False;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when 'w' => -- 3rd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => "no" & CommandLineData.Option_Warning_File) then
                  CommandLineData.Content.Valid := not NoWarningFound;
                  Possible_Error (E => ES_NoWarning);
                  NoWarningFound                  := True;
                  CommandLineData.Content.Warning := False;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when 'e' => -- 3rd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_No_Echo) then
                  CommandLineData.Content.Valid := not OutputFound;
                  Possible_Error (E => ES_NoEcho);
                  OutputFound                  := True;
                  CommandLineData.Content.Echo := False;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;
            when 'r' => -- 3rd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => "no" & CommandLineData.Option_Report_File) then
                  CommandLineData.Content.Valid := not (ReportFound or else HTMLFound or else XMLFound);
                  Possible_Error (E => ES_NoReport);
                  ReportFound                    := True;
                  NoReportOptionFound            := True;
                  CommandLineData.Content.Report := False;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;
            when 'd' => -- 3rd letter
               case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                             Pos   => 4)) is
                  when 'i' => -- 4th letter
                     if Check_Option_Name (Opt_Name => Opt_Name,
                                           Str      => CommandLineData.Option_No_Dictionary) then
                        CommandLineData.Content.Valid := not DictFound;
                        Possible_Error (E => ES_NoDict);
                        DictFound                          := True;
                        CommandLineData.Content.Write_Dict := False;
                     else
                        CommandLineData.Content.Valid := False;
                        Possible_Error2 (E => ES_InvalidOption,
                                         F => Opt_Name);
                     end if;
                  when 'u' => -- 4th letter
                     if Check_Option_Name (Opt_Name => Opt_Name,
                                           Str      => CommandLineData.Option_No_Duration) then
                        CommandLineData.Content.Valid := not NoDurationFound;
                        Possible_Error (E => ES_NoDuration);
                        NoDurationFound                     := True;
                        CommandLineData.Content.No_Duration := True;
                     else
                        CommandLineData.Content.Valid := False;
                        Possible_Error2 (E => ES_InvalidOption,
                                         F => Opt_Name);
                     end if;
                  when others =>
                     CommandLineData.Content.Valid := False;
                     Possible_Error2 (E => ES_InvalidOption,
                                      F => Opt_Name);
               end case;
            when 's' => -- 3rd letter
               case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                             Pos   => 4)) is
                  when 'l' => -- 4th letter
                     if Check_Option_Name (Opt_Name => Opt_Name,
                                           Str      => CommandLineData.Option_No_Sli) then
                        CommandLineData.Content.Generate_SLI := False;
                     else
                        CommandLineData.Content.Valid := False;
                        Possible_Error2 (E => ES_InvalidOption,
                                         F => Opt_Name);
                     end if;
                  when 't' => -- 4th letter
                     if Check_Option_Name (Opt_Name => Opt_Name,
                                           Str      => "no" & CommandLineData.Option_Statistics) then
                        CommandLineData.Content.Valid := not StatisticsFound;
                        Possible_Error (E => ES_NoStatistics);
                        StatisticsFound                          := True;
                        CommandLineData.Content.Write_Statistics := False;
                     else
                        CommandLineData.Content.Valid := False;
                        Possible_Error2 (E => ES_InvalidOption,
                                         F => Opt_Name);
                     end if;
                  when 'w' => -- 4th Letter

                     -- -noswitch
                     --
                     -- Already processed by Ignore_Default_Switch_File below,
                     -- so allow but ignore here.
                     if Check_Option_Name (Opt_Name => Opt_Name,
                                           Str      => CommandLineData.Option_No_Switch) then
                        null;
                     else
                        CommandLineData.Content.Valid := False;
                        Possible_Error2 (E => ES_InvalidOption,
                                         F => Opt_Name);
                     end if;
                  when others =>
                     CommandLineData.Content.Valid := False;
                     Possible_Error2 (E => ES_InvalidOption,
                                      F => Opt_Name);
               end case;
            when 'f' => -- 3rd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => "no" & CommandLineData.Option_Fdl_Identifiers) then
                  CommandLineData.Content.Valid :=
                    not (FDLreserveOptionFound or else FDLignoreOptionFound or else DPCFound or else VCGFound);
                  Possible_Error (E => ES_FDLoption);
                  FDLignoreOptionFound                 := True;
                  CommandLineData.Content.FDL_Reserved := False;
                  ScreenEcho.Put_Line ("Warning: the -nofdl option is now deprecated. Please use -fdl=accept");
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when 't' => -- 3rd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => "no" & CommandLineData.Option_Target_Compiler_Data) then
                  CommandLineData.Content.Valid := not TargetDataFound;
                  Possible_Error (E => ES_NoTargetData);
                  TargetDataFound                     := True;
                  CommandLineData.Content.Target_Data := False;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when 'c' => -- 3rd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => "no" & CommandLineData.Option_Config_File) then
                  CommandLineData.Content.Valid := not ConfigFileFound;
                  Possible_Error (E => ES_NoConfigFile);
                  ConfigFileFound                       := True;
                  CommandLineData.Content.Target_Config := False;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when 'l' => -- 3rd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_No_Listings) then
                  CommandLineData.Content.Valid := not NoListingsFound;
                  Possible_Error (E => ES_NoListings);
                  NoListingsFound                     := True;
                  CommandLineData.Content.No_Listings := True;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when others =>
               CommandLineData.Content.Valid := False;
               Possible_Error2 (E => ES_InvalidOption,
                                F => Opt_Name);
         end case;
         --# end accept;
      end Process_N;

      procedure Process_O
      --# global in     Opt_Name;
      --#        in     Opt_Val;
      --#        in     Opt_Val_OK;
      --#        in out CommandLineData.Content;
      --#        in out OriginalFlowErrorsFound;
      --#        in out OutputDirectoryFound;
      --#        in out SPARK_IO.File_Sys;
      --# derives CommandLineData.Content from *,
      --#                                      Opt_Name,
      --#                                      Opt_Val,
      --#                                      Opt_Val_OK,
      --#                                      OriginalFlowErrorsFound,
      --#                                      OutputDirectoryFound &
      --#         OriginalFlowErrorsFound from *,
      --#                                      Opt_Name &
      --#         OutputDirectoryFound    from *,
      --#                                      Opt_Name,
      --#                                      Opt_Val_OK &
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CommandLineData.Content,
      --#                                      Opt_Name,
      --#                                      Opt_Val_OK,
      --#                                      OriginalFlowErrorsFound,
      --#                                      OutputDirectoryFound;
      is
      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Output_Directory, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Output_Directory_Name, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Legacy_Errors, "Direct updates OK here";
         case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                       Pos   => 2)) is
            when 'r' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Original_Flow_Errors) then
                  CommandLineData.Content.Valid := not OriginalFlowErrorsFound;
                  Possible_Error (E => ES_OriginalFlowErrors);
                  OriginalFlowErrorsFound               := True;
                  CommandLineData.Content.Legacy_Errors := True;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;
            when 'u' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Output_Directory) then
                  CommandLineData.Content.Valid := Opt_Val_OK;
                  Possible_Error (E => ES_OutputDir);
                  if Opt_Val_OK then
                     CommandLineData.Content.Valid := not OutputDirectoryFound;
                     Possible_Error (E => ES_OutputDirRepeated);
                  end if;

                  if CommandLineData.Content.Valid then
                     OutputDirectoryFound                          := True;
                     CommandLineData.Content.Output_Directory      := True;
                     CommandLineData.Content.Output_Directory_Name := Opt_Val;
                  end if;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;
            when others =>
               CommandLineData.Content.Valid := False;
               Possible_Error2 (E => ES_InvalidOption,
                                F => Opt_Name);
         end case;
         --# end accept;
      end Process_O;

      procedure Process_P
      --# global in     Opt_Name;
      --#        in     Opt_Val;
      --#        in out CommandLineData.Content;
      --#        in out ConcurrencyProfileFound;
      --#        in out PlainOutputFound;
      --#        in out SPARK_IO.File_Sys;
      --# derives CommandLineData.Content,
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CommandLineData.Content,
      --#                                      ConcurrencyProfileFound,
      --#                                      Opt_Name,
      --#                                      Opt_Val,
      --#                                      PlainOutputFound &
      --#         ConcurrencyProfileFound,
      --#         PlainOutputFound        from *,
      --#                                      Opt_Name;
      is
      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Plain_Output, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Info_Flow_Policy, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Concurrency_Profile, "Direct updates OK here";
         case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                       Pos   => 2)) is
            when 'f' => -- 2nd letter
               CommandLineData.Content.Valid := False;
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => "pfs") then
                  Possible_Error (E => ES_NoMorePFS);
               else
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when 'l' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Plain_Output) then
                  CommandLineData.Content.Valid := not PlainOutputFound;
                  Possible_Error (E => ES_PlainOutput);
                  PlainOutputFound                     := True;
                  CommandLineData.Content.Plain_Output := True;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when 'r' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Profile) then
                  CommandLineData.Content.Valid := not ConcurrencyProfileFound;
                  Possible_Error (E => ES_Profile);
                  if CommandLineData.Content.Valid then
                     ConcurrencyProfileFound := True;
                     case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Val,
                                                                                   Pos   => 1)) is
                        when 'r' => -- 1st letter of option
                           if Check_Option_Name (Opt_Name => Opt_Val,
                                                 Str      => CommandLineData.Option_Profile_Ravenscar) then
                              CommandLineData.Content.Concurrency_Profile := CommandLineData.Ravenscar;
                           else -- other error involving ravenscar
                              CommandLineData.Content.Valid := False;
                              Possible_Error2 (E => ES_ProfileOption,
                                               F => Opt_Val);
                           end if;

                        when 's' => -- 1st letter of option
                           if Check_Option_Name (Opt_Name => Opt_Val,
                                                 Str      => CommandLineData.Option_Profile_Sequential) then
                              CommandLineData.Content.Concurrency_Profile := CommandLineData.Sequential;
                           else
                              CommandLineData.Content.Valid := False;
                              Possible_Error2 (E => ES_ProfileOption,
                                               F => Opt_Val);
                           end if;

                        when others =>
                           CommandLineData.Content.Valid := False;
                           Possible_Error2 (E => ES_ProfileOption,
                                            F => Opt_Val);
                     end case;
                  end if;
               else -- begins with "pr" but not "profile"
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when 'o' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Policy) then
                  CommandLineData.Content.Valid := CommandLineData.Content.Flow_Option = CommandLineData.Info_Flow;
                  Possible_Error (E => ES_DataFlowAndInfoFlowPolicy);
                  if CommandLineData.Content.Valid then
                     case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Val,
                                                                                   Pos   => 1)) is
                        when 's' => -- 1st letter of option
                           case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Val,
                                                                                         Pos   => 2)) is
                              when 'e' =>
                                 if Check_Option_Name (Opt_Name => Opt_Val,
                                                       Str      => CommandLineData.Option_Policy_Security) then
                                    CommandLineData.Content.Info_Flow_Policy := CommandLineData.Security;
                                 else
                                    CommandLineData.Content.Valid := False;
                                    Possible_Error2 (E => ES_ProfileOption,
                                                     F => Opt_Val);
                                 end if;
                              when 'a' =>
                                 if Check_Option_Name (Opt_Name => Opt_Val,
                                                       Str      => CommandLineData.Option_Policy_Safety) then
                                    CommandLineData.Content.Info_Flow_Policy := CommandLineData.Safety;
                                 else
                                    CommandLineData.Content.Valid := False;
                                    Possible_Error2 (E => ES_ProfileOption,
                                                     F => Opt_Val);
                                 end if;
                              when others =>
                                 CommandLineData.Content.Valid := False;
                                 Possible_Error2 (E => ES_ProfileOption,
                                                  F => Opt_Val);
                           end case;
                        when others =>
                           CommandLineData.Content.Valid := False;
                           Possible_Error2 (E => ES_ProfileOption,
                                            F => Opt_Val);
                     end case;
                  end if;
               end if;

               -- begin with "p" but not a valid option
            when others =>
               CommandLineData.Content.Valid := False;
               Possible_Error2 (E => ES_InvalidOption,
                                F => Opt_Name);
         end case;
         --# end accept;
      end Process_P;

      procedure Process_R
      --# global in     Opt_Name;
      --#        in     Opt_Val;
      --#        in     Opt_Val_OK;
      --#        in out CommandLineData.Content;
      --#        in out ReportFound;
      --#        in out RulesFound;
      --#        in out SPARK_IO.File_Sys;
      --# derives CommandLineData.Content,
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CommandLineData.Content,
      --#                                      Opt_Name,
      --#                                      Opt_Val,
      --#                                      Opt_Val_OK,
      --#                                      ReportFound,
      --#                                      RulesFound &
      --#         ReportFound             from *,
      --#                                      Opt_Name,
      --#                                      Opt_Val_OK &
      --#         RulesFound              from *,
      --#                                      Opt_Name;
      is
         Default_Report_Extension : constant String := "rep";
         File_Name                : E_Strings.T;
      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Report, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Report_File_Name, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Constant_Rules, "Direct updates OK here";
         case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                       Pos   => 2)) is
            when 'e' => -- 2nd letter
               case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                             Pos   => 3)) is
                  when 'p' => -- 3rd letter
                     if Check_Option_Name (Opt_Name => Opt_Name,
                                           Str      => CommandLineData.Option_Report_File) then
                        CommandLineData.Content.Valid := Opt_Val_OK;
                        Possible_Error (E => ES_ReportName);
                        if Opt_Val_OK then
                           CommandLineData.Content.Valid := not ReportFound;
                           Possible_Error (E => ES_Report);
                        end if;
                        if CommandLineData.Content.Valid then
                           ReportFound                    := True;
                           CommandLineData.Content.Report := True;
                           File_Name                      := Opt_Val;
                           FileSystem.Check_Extension
                             (Fn  => File_Name,
                              Ext => E_Strings.Copy_String (Str => Default_Report_Extension));
                           CommandLineData.Content.Report_File_Name := File_Name;
                        end if;
                     else -- starts "rep" but is not valid
                        CommandLineData.Content.Valid := False;
                        Possible_Error2 (E => ES_InvalidOption,
                                         F => Opt_Name);
                     end if;

                  when 'a' => -- 3rd letter
                     CommandLineData.Content.Valid := False;
                     if Check_Option_Name (Opt_Name => Opt_Name,
                                           Str      => "realrtcs") then
                        Possible_Error (E => ES_NoMoreReal);
                     else
                        Possible_Error2 (E => ES_InvalidOption,
                                         F => Opt_Name);
                     end if;

                  when others =>
                     -- starts "re" but isn't valid
                     CommandLineData.Content.Valid := False;
                     Possible_Error2 (E => ES_InvalidOption,
                                      F => Opt_Name);
               end case; -- 3rd letter

            when 't' => -- 2nd letter
               CommandLineData.Content.Valid := False;
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => "rtc") then
                  Possible_Error (E => ES_NoMoreRTC);
               else
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;
            when 'u' => -- 2nd letter u - should be "rules" switch
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Rules) then
                  if RulesFound then
                     CommandLineData.Content.Valid := False;
                     Possible_Error (E => ES_Rules);
                  else
                     RulesFound                    := True;
                     CommandLineData.Content.Valid := Opt_Val_OK;
                     if CommandLineData.Content.Valid then
                        case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Val,
                                                                                      Pos   => 1)) is
                           when 'n' => -- 1st letter of option
                              if Check_Option_Name (Opt_Name => Opt_Val,
                                                    Str      => CommandLineData.Option_Rules_None) then
                                 CommandLineData.Content.Constant_Rules := CommandLineData.No_Rules;
                              else
                                 CommandLineData.Content.Valid := False;
                                 Possible_Error (E => ES_RuleUnknown);
                              end if;

                           when 'l' => -- 1st letter of option
                              if Check_Option_Name (Opt_Name => Opt_Val,
                                                    Str      => CommandLineData.Option_Rules_Lazy) then
                                 CommandLineData.Content.Constant_Rules := CommandLineData.Lazy;
                              else
                                 CommandLineData.Content.Valid := False;
                                 Possible_Error (E => ES_RuleUnknown);
                              end if;

                           when 'k' => -- 1st letter of option
                              if Check_Option_Name (Opt_Name => Opt_Val,
                                                    Str      => CommandLineData.Option_Rules_Keen) then
                                 CommandLineData.Content.Constant_Rules := CommandLineData.Keen;
                              else
                                 CommandLineData.Content.Valid := False;
                                 Possible_Error (E => ES_RuleUnknown);
                              end if;

                           when 'a' => -- 1st letter of option
                              if Check_Option_Name (Opt_Name => Opt_Val,
                                                    Str      => CommandLineData.Option_Rules_All) then
                                 CommandLineData.Content.Constant_Rules := CommandLineData.All_Rules;
                              else
                                 CommandLineData.Content.Valid := False;
                                 Possible_Error (E => ES_RuleUnknown);
                              end if;
                           when others =>
                              CommandLineData.Content.Valid := False;
                              Possible_Error (E => ES_RuleUnknown);
                        end case;
                     else
                        CommandLineData.Content.Valid := False;
                        Possible_Error (E => ES_RuleUnknown);
                     end if;
                  end if;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when others =>
               -- starts "r" but not valid
               CommandLineData.Content.Valid := False;
               Possible_Error2 (E => ES_InvalidOption,
                                F => Opt_Name);
         end case;
         --# end accept;
      end Process_R;

      procedure Process_S
      --# global in     Opt_Name;
      --#        in     Opt_Val;
      --#        in     Opt_Val_OK;
      --#        in out CommandLineData.Content;
      --#        in out SourceFound;
      --#        in out SPARK_IO.File_Sys;
      --#        in out StatisticsFound;
      --#        in out SyntaxCheckFound;
      --# derives CommandLineData.Content from *,
      --#                                      Opt_Name,
      --#                                      Opt_Val,
      --#                                      Opt_Val_OK,
      --#                                      SourceFound,
      --#                                      StatisticsFound,
      --#                                      SyntaxCheckFound &
      --#         SourceFound,
      --#         StatisticsFound,
      --#         SyntaxCheckFound        from *,
      --#                                      Opt_Name &
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CommandLineData.Content,
      --#                                      Opt_Name,
      --#                                      Opt_Val_OK,
      --#                                      SourceFound,
      --#                                      StatisticsFound,
      --#                                      SyntaxCheckFound;
      is
      begin
         --# accept W, 169, CommandLineData.Content.Write_Statistics, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Source_Extension, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.SPARK_Lib,        "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Syntax_Only,      "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Valid,            "Direct updates OK here";
         case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                       Pos   => 2)) is
            when 'o' =>
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Source_Extension) then
                  CommandLineData.Content.Valid := Opt_Val_OK and then not SourceFound;
                  Possible_Error (E => ES_SourceExt);
                  SourceFound                              := True;
                  CommandLineData.Content.Source_Extension := Opt_Val;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when 'p' =>
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_SPARK_Lib) then
                  CommandLineData.Content.SPARK_Lib := True;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when 't' =>
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Statistics) then
                  CommandLineData.Content.Valid := not StatisticsFound;
                  Possible_Error (E => ES_Statistics);
                  StatisticsFound                          := True;
                  CommandLineData.Content.Write_Statistics := True;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when 'y' =>
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Syntax_Check) then
                  CommandLineData.Content.Valid := not SyntaxCheckFound;
                  Possible_Error (E => ES_Syntax);
                  SyntaxCheckFound                    := True;
                  CommandLineData.Content.Syntax_Only := True;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when others =>
               CommandLineData.Content.Valid := False;
               Possible_Error2 (E => ES_InvalidOption,
                                F => Opt_Name);
         end case;
         --# end accept;
      end Process_S;

      procedure Process_T
      --# global in     ConfigFileFound;
      --#        in     Opt_Name;
      --#        in     Opt_Val;
      --#        in     Opt_Val_OK;
      --#        in out CommandLineData.Content;
      --#        in out SPARK_IO.File_Sys;
      --#        in out TargetDataFound;
      --# derives CommandLineData.Content from *,
      --#                                      ConfigFileFound,
      --#                                      Opt_Name,
      --#                                      Opt_Val,
      --#                                      Opt_Val_OK,
      --#                                      TargetDataFound &
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CommandLineData.Content,
      --#                                      ConfigFileFound,
      --#                                      Opt_Name,
      --#                                      Opt_Val_OK,
      --#                                      TargetDataFound &
      --#         TargetDataFound         from *,
      --#                                      ConfigFileFound,
      --#                                      Opt_Name,
      --#                                      Opt_Val_OK;
      is
         File_Name : E_Strings.T;
      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Target_Data, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Target_Data_File, "Direct updates OK here";
         case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                       Pos   => 2)) is
            -- -tree is removed in release 8.1.1 and above, but it remains
            -- the default, so at least recognize it here and take no action
            -- for backward compatiblility with users' existing scripts.
            when 'r' => -- 2nd letter
               if not Check_Option_Name (Opt_Name => Opt_Name,
                                         Str      => "tree") then
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when 'a' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Target_Compiler_Data) then
                  if ConfigFileFound then
                     CommandLineData.Content.Valid := False;
                     Possible_Error (E => ES_DataAndConfig);
                  else
                     CommandLineData.Content.Valid := Opt_Val_OK;
                     Possible_Error (E => ES_TargetDataName);
                     if Opt_Val_OK then
                        CommandLineData.Content.Valid := not TargetDataFound;
                        Possible_Error (E => ES_TargetData);
                     end if;

                     if CommandLineData.Content.Valid then
                        TargetDataFound                     := True;
                        CommandLineData.Content.Target_Data := True;
                        File_Name                           := Opt_Val;
                        FileSystem.Check_Extension
                          (Fn  => File_Name,
                           Ext => E_Strings.Copy_String (Str => CommandLineData.Default_Data_Extension));
                        CommandLineData.Content.Target_Data_File := File_Name;
                     end if;
                  end if;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;

            when others =>
               CommandLineData.Content.Valid := False;
               Possible_Error2 (E => ES_InvalidOption,
                                F => Opt_Name);
         end case;
         --# end accept;
      end Process_T;

      procedure Process_V
      --# global in     FDLignoreOptionFound;
      --#        in     Opt_Name;
      --#        in out CommandLineData.Content;
      --#        in out SPARK_IO.File_Sys;
      --#        in out VCGFound;
      --# derives CommandLineData.Content,
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CommandLineData.Content,
      --#                                      FDLignoreOptionFound,
      --#                                      Opt_Name,
      --#                                      VCGFound &
      --#         VCGFound                from *,
      --#                                      Opt_Name;
      is
      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.VCG, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Plain_Output, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Version_Requested, "Direct updates OK here";
         case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                       Pos   => 2)) is
            when 'c' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Vcg) then
                  if VCGFound then
                     CommandLineData.Content.Valid := False;
                     Possible_Error (E => ES_VCGRepeated);
                  elsif FDLignoreOptionFound and then E_Strings.Is_Empty (E_Str => CommandLineData.Content.FDL_Mangle) then
                     CommandLineData.Content.Valid := False;
                     Possible_Error (E => ES_VCGandFDL);
                  else
                     CommandLineData.Content.Valid := True;
                  end if;
                  VCGFound                    := True;
                  CommandLineData.Content.VCG := True;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;
            when 'e' => -- 2nd letter
               if Check_Option_Name (Opt_Name => Opt_Name,
                                     Str      => CommandLineData.Option_Version) then
                  -- Examiner version requested, so abandon all further
                  -- option processing by setting Valid = False.
                  CommandLineData.Content.Valid             := False;
                  CommandLineData.Content.Version_Requested := True;
                  CommandLineData.Content.Plain_Output      := False;
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
               end if;
            when others =>
               CommandLineData.Content.Valid := False;
               Possible_Error2 (E => ES_InvalidOption,
                                F => Opt_Name);
         end case;
         --# end accept;
      end Process_V;

      procedure Process_W
      --# global in     Opt_Name;
      --#        in     Opt_Val;
      --#        in     Opt_Val_OK;
      --#        in out CommandLineData.Content;
      --#        in out SPARK_IO.File_Sys;
      --#        in out WarningFound;
      --# derives CommandLineData.Content from *,
      --#                                      Opt_Name,
      --#                                      Opt_Val,
      --#                                      Opt_Val_OK,
      --#                                      WarningFound &
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CommandLineData.Content,
      --#                                      Opt_Name,
      --#                                      Opt_Val_OK,
      --#                                      WarningFound &
      --#         WarningFound            from *,
      --#                                      Opt_Name,
      --#                                      Opt_Val_OK;
      is
         File_Name : E_Strings.T;
      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Warning, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Warning_File_Name, "Direct updates OK here";
         if Check_Option_Name (Opt_Name => Opt_Name,
                               Str      => CommandLineData.Option_Warning_File) then
            CommandLineData.Content.Valid := Opt_Val_OK;
            Possible_Error (E => ES_WarningName);
            if Opt_Val_OK then
               CommandLineData.Content.Valid := not WarningFound;
               Possible_Error (E => ES_Warning);
            end if;
            if CommandLineData.Content.Valid then
               WarningFound                    := True;
               CommandLineData.Content.Warning := True;
               File_Name                       := Opt_Val;
               FileSystem.Check_Extension
                 (Fn  => File_Name,
                  Ext => E_Strings.Copy_String (Str => CommandLineData.Default_Warning_Extension));
               CommandLineData.Content.Warning_File_Name := File_Name;
            end if;
         else
            CommandLineData.Content.Valid := False;
            Possible_Error2 (E => ES_InvalidOption,
                             F => Opt_Name);
         end if;
         --# end accept;
      end Process_W;

      procedure Process_X
      --# global in     HTMLFound;
      --#        in     NoReportOptionFound;
      --#        in     Opt_Name;
      --#        in out CommandLineData.Content;
      --#        in out SPARK_IO.File_Sys;
      --#        in out XMLFound;
      --# derives CommandLineData.Content,
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CommandLineData.Content,
      --#                                      HTMLFound,
      --#                                      NoReportOptionFound,
      --#                                      Opt_Name,
      --#                                      XMLFound &
      --#         XMLFound                from *,
      --#                                      Opt_Name;
      is
      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.XML, "Direct updates OK here";
         if Check_Option_Name (Opt_Name => Opt_Name,
                               Str      => CommandLineData.Option_Xml) then
            CommandLineData.Content.Valid := not (XMLFound or else NoReportOptionFound or else HTMLFound);
            if HTMLFound then
               Possible_Error (E => ES_XMLandHTML);
            elsif XMLFound then
               Possible_Error (E => ES_XML);
            else
               Possible_Error (E => ES_XMLnorep);
            end if;

            XMLFound := True;
            if CommandLineData.Content.Valid then
               CommandLineData.Content.XML := True;
            end if;
         else
            CommandLineData.Content.Valid := False;
            Possible_Error2 (E => ES_InvalidOption,
                             F => Opt_Name);
         end if;
         --# end accept;
      end Process_X;

   begin
      --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here";
      loop
         exit when Next_Symbol.Typ /= S_Switch_Character;
         Read_Option
           (Opt_Name       => Opt_Name,
            Opt_Name_OK    => Opt_Name_OK,
            Opt_Val        => Opt_Val,
            Opt_Val_OK     => Opt_Val_OK,
            Command_String => Command_String,
            Next_Symbol    => Next_Symbol);

         if Opt_Name_OK then
            case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                          Pos   => 1)) is
               when 'a' =>
                  Process_A;
               when 'b' =>
                  Process_B;
               when 'c' =>
                  Process_C;
               when 'd' =>
                  Process_D;
               when 'e' =>
                  Process_E;
               when 'f' =>
                  Process_F;
               when 'h' =>
                  Process_H;
               when 'g' =>
                  Process_G;
               when 'i' =>
                  Process_I;
               when 'j' =>
                  Process_J;
               when 'l' =>
                  Process_L;
               when 'm' =>
                  Process_M;
               when 'n' =>
                  Process_N;
               when 'o' =>
                  Process_O;
               when 'p' =>
                  Process_P;
               when 'r' =>
                  Process_R;
               when 's' =>
                  Process_S;
               when 't' =>
                  Process_T;
               when 'v' =>
                  Process_V;
               when 'w' =>
                  Process_W;
               when 'x' =>
                  Process_X;
               when others =>
                  CommandLineData.Content.Valid := False;
                  Possible_Error2 (E => ES_InvalidOption,
                                   F => Opt_Name);
            end case;
         else
            CommandLineData.Content.Valid := False;
            Possible_Error2 (E => ES_InvalidOption,
                             F => Opt_Name);
         end if;
         exit when not CommandLineData.Content.Valid;
      end loop;
      --# end accept;
   end Parse_Command_Options;

   procedure Parse_Command_Line (Command_String : in Command_Strings)
   --# global in out CommandLineData.Content;
   --#        in out SPARK_IO.File_Sys;
   --# derives CommandLineData.Content,
   --#         SPARK_IO.File_Sys       from *,
   --#                                      CommandLineData.Content,
   --#                                      Command_String;
   is
      Next_Symbol          : Symbols;
      Local_Command_String : Command_Strings;

      procedure Parse_Arguments (Command_String : in Command_Strings;
                                 Next_Symbol    : in Symbols)
      --# global in out CommandLineData.Content;
      --#        in out SPARK_IO.File_Sys;
      --# derives CommandLineData.Content,
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CommandLineData.Content,
      --#                                      Command_String,
      --#                                      Next_Symbol;
      --  pre Next_Symbol.Typ in {SString, SEmpty};
      is
         Local_Next_Symbol    : Symbols;
         Local_Command_String : Command_Strings;

         procedure Parse_File_Entry (Command_String : in out Command_Strings;
                                     Next_Symbol    : in out Symbols)
         --# global in out CommandLineData.Content;
         --#        in out SPARK_IO.File_Sys;
         --# derives CommandLineData.Content,
         --#         SPARK_IO.File_Sys       from *,
         --#                                      CommandLineData.Content,
         --#                                      Command_String,
         --#                                      Next_Symbol &
         --#         Command_String,
         --#         Next_Symbol             from Command_String,
         --#                                      Next_Symbol;
         --  pre  Next_Symbol.Typ = SString;
         --  post Next_Symbol.Typ in {SComma, SEmpty};
         is
            File_Name : E_Strings.T;

            procedure Parse_Argument_Option (Command_String : in out Command_Strings;
                                             Next_Symbol    : in out Symbols)
            --# global in out CommandLineData.Content;
            --#        in out SPARK_IO.File_Sys;
            --# derives CommandLineData.Content,
            --#         SPARK_IO.File_Sys       from *,
            --#                                      CommandLineData.Content,
            --#                                      Command_String,
            --#                                      Next_Symbol &
            --#         Command_String,
            --#         Next_Symbol             from Command_String,
            --#                                      Next_Symbol;
            is
               File_Name : E_Strings.T;
               Do_List   : Boolean;
               OK        : Boolean;

               procedure Read_Argument_Option
                 (Listing_File_Name :    out E_Strings.T;
                  Listing           :    out Boolean;
                  OK                :    out Boolean;
                  Command_String    : in out Command_Strings;
                  Next_Symbol       :    out Symbols)
               --# global in     CommandLineData.Content;
               --#        in out SPARK_IO.File_Sys;
               --# derives Command_String,
               --#         Listing,
               --#         Listing_File_Name,
               --#         Next_Symbol,
               --#         OK                from Command_String &
               --#         SPARK_IO.File_Sys from *,
               --#                                CommandLineData.Content,
               --#                                Command_String;
               --  pre  Next_Symbol.Typ = SSlash;
               --  post Next_Symbol.Typ in {SComma, SEmpty};
               is
                  Opt_Name    : E_Strings.T;
                  Opt_Val     : E_Strings.T;
                  Opt_Name_OK : Boolean;
                  Opt_Val_OK  : Boolean;
               begin
                  Listing_File_Name := E_Strings.Empty_String;
                  Listing           := False;

                  Read_Option
                    (Opt_Name       => Opt_Name,
                     Opt_Name_OK    => Opt_Name_OK,
                     Opt_Val        => Opt_Val,
                     Opt_Val_OK     => Opt_Val_OK,
                     Command_String => Command_String,
                     Next_Symbol    => Next_Symbol);
                  case Ada.Characters.Handling.To_Lower (E_Strings.Get_Element (E_Str => Opt_Name,
                                                                                Pos   => 1)) is
                     when 'l' =>
                        if Check_Option_Name (Opt_Name => Opt_Name,
                                              Str      => CommandLineData.Option_Listing_File) then
                           OK                := Opt_Name_OK and then Opt_Val_OK;
                           Listing           := True;
                           Listing_File_Name := Opt_Val;
                        else
                           OK      := False;
                           Listing := False;
                           Output_Error (E => ES_InvalidOption);
                           ScreenEcho.New_Line (1);
                        end if;
                     when 'n' =>
                        if Check_Option_Name (Opt_Name => Opt_Name,
                                              Str      => CommandLineData.Option_No_Listing_File) then
                           OK := Opt_Name_OK and then not Opt_Val_OK;
                        else
                           OK := False;
                           Output_Error (E => ES_InvalidOption);
                           ScreenEcho.New_Line (1);
                        end if;
                        Listing := False;
                     when others =>
                        OK := False;
                  end case;
               end Read_Argument_Option;

            begin
               --# accept W, 169, CommandLineData.Content.Source_File_List, "Direct updates OK here" &
               --#        W, 169, CommandLineData.Content.Valid, "Direct updates OK here";
               if Next_Symbol.Typ = S_Switch_Character then
                  Read_Argument_Option
                    (Listing_File_Name => File_Name,
                     Listing           => Do_List,
                     OK                => OK,
                     Command_String    => Command_String,
                     Next_Symbol       => Next_Symbol);
                  CommandLineData.Content.Source_File_List (CommandLineData.Content.Number_Source).Listing_File_Name := File_Name;
                  CommandLineData.Content.Source_File_List (CommandLineData.Content.Number_Source).Listing           := Do_List;
                  CommandLineData.Content.Valid                                                                      := OK;
                  Possible_Error (E => ES_ListingFile);
               else
                  CommandLineData.Content.Source_File_List (CommandLineData.Content.Number_Source).Listing := True;

                  CommandLineData.Content.Source_File_List (CommandLineData.Content.Number_Source).Listing_File_Name :=
                    FileSystem.Just_File
                    (Fn  => CommandLineData.Content.Source_File_List (CommandLineData.Content.Number_Source).Source_File_Name,
                     Ext => False);
               end if;

               if CommandLineData.Content.Valid
                 and then CommandLineData.Content.Source_File_List (CommandLineData.Content.Number_Source).Listing then

                  File_Name := CommandLineData.Content.Source_File_List (CommandLineData.Content.Number_Source).Listing_File_Name;

                  FileSystem.Check_Listing_Extension
                    (Source_Name => CommandLineData.Content.Source_File_List (CommandLineData.Content.Number_Source).Source_File_Name,
                     Fn          => File_Name,
                     Ext         => CommandLineData.Content.Listing_Extension);

                  CommandLineData.Content.Source_File_List (CommandLineData.Content.Number_Source).Listing_File_Name := File_Name;
               end if;
               --# end accept;
            end Parse_Argument_Option;

         begin
            --# accept W, 169, CommandLineData.Content.Source_File_List, "Direct updates OK here" &
            --#        W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
            --#        W, 169, CommandLineData.Content.Number_Source, "Direct updates OK here";
            if Next_Symbol.Typ = S_String then
               CommandLineData.Content.Number_Source := CommandLineData.Content.Number_Source + 1;

               File_Name := Next_Symbol.The_String;

               if E_Strings.Get_Element (E_Str => File_Name,
                                         Pos   => 1) = '@' then
                  FileSystem.Check_Extension
                    (Fn  => File_Name,
                     Ext => E_Strings.Copy_String (Str => CommandLineData.Meta_File_Extension));
                  CommandLineData.Content.Source_File_List (CommandLineData.Content.Number_Source).Source_File_Name := File_Name;
                  CommandLineData.Content.Source_File_List (CommandLineData.Content.Number_Source).Listing          := False;
                  Get_Next_Symbol (Command_String => Command_String,
                                   Next_Symbol    => Next_Symbol);
               else
                  FileSystem.Check_Extension (Fn  => File_Name,
                                              Ext => CommandLineData.Content.Source_Extension);
                  CommandLineData.Content.Source_File_List (CommandLineData.Content.Number_Source).Source_File_Name := File_Name;
                  Get_Next_Symbol (Command_String => Command_String,
                                   Next_Symbol    => Next_Symbol);
                  Parse_Argument_Option (Command_String => Command_String,
                                         Next_Symbol    => Next_Symbol);
               end if;
            else
               CommandLineData.Content.Valid := False;
               Possible_Error (E => ES_Source);
            end if;
            --# end accept;
         end Parse_File_Entry;

      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Number_Source, "Direct updates OK here";
         Local_Next_Symbol                     := Next_Symbol;
         Local_Command_String                  := Command_String;
         CommandLineData.Content.Number_Source := 0;
         loop
            Parse_File_Entry (Command_String => Local_Command_String,
                              Next_Symbol    => Local_Next_Symbol);

            exit when Local_Next_Symbol.Typ = S_Empty or else not CommandLineData.Content.Valid;
            if CommandLineData.Content.Number_Source = ExaminerConstants.MaxFilesOnCommandLine then
               CommandLineData.Content.Valid := False;
               Output_Error (E => EW_Too_Many);
               exit;
            end if;

            if FileSystem.Use_Windows_Command_Line and then Local_Next_Symbol.Typ = S_Comma then
               Get_Next_Symbol (Command_String => Local_Command_String,
                                Next_Symbol    => Local_Next_Symbol);
            end if;

         end loop;
         --# end accept;
      end Parse_Arguments;

   begin
      Local_Command_String := Command_String;
      Get_Next_Symbol (Command_String => Local_Command_String,
                       Next_Symbol    => Next_Symbol);
      Parse_Command_Options (Command_String => Local_Command_String,
                             Next_Symbol    => Next_Symbol);
      if CommandLineData.Content.Valid then
         Parse_Arguments (Command_String => Local_Command_String,
                          Next_Symbol    => Next_Symbol);
      end if;
   end Parse_Command_Line;

   ----------------------------------------------------------------------
   -- Does a quick "look ahead" through all the command-line
   -- switches to check for the presence of "-noswitch", "/noswitch"
   -- or any unambiguous abbreviation thereof.
   --
   -- Uses Ada.Command_Line directly, so is hidden from SPARK.
   ----------------------------------------------------------------------
   function Ignore_Default_Switch_File return Boolean
   --# global in SPARK_IO.File_Sys;
   is
      --# hide Ignore_Default_Switch_File;
      Result    : Boolean;
      Arg_Count : constant Natural := Ada.Command_Line.Argument_Count;
   begin
      Result := False;
      for I in Positive range 1 .. Arg_Count loop
         declare
            Arg : constant String := Ada.Command_Line.Argument (I);
         begin
            if Arg'Length >= 5 then
               declare
                  Prefix       : constant Character := Arg (1);
                  Switch       : constant String    := String (Arg (2 .. Arg'Last));
                  Prefix_Legal : Boolean;
               begin
                  Prefix_Legal := (Prefix = '-');

                  if Prefix_Legal
                    and then (Switch = "noswitch"
                                or else Switch = "noswitc"
                                or else Switch = "noswit"
                                or else Switch = "noswi"
                                or else Switch = "nosw") then

                     Result := True;
                     exit;
                  end if;
               end;
            end if;
         end;
      end loop;
      return Result;
   end Ignore_Default_Switch_File;

   procedure Process is
      Command_String : Command_Strings;

      procedure Wff_Command_Line
      --# global in out CommandLineData.Content;
      --#        in out SPARK_IO.File_Sys;
      --# derives CommandLineData.Content,
      --#         SPARK_IO.File_Sys       from CommandLineData.Content,
      --#                                      SPARK_IO.File_Sys;
      is

         procedure Wff_Non_Overlapping
         --# global in out CommandLineData.Content;
         --#        in out SPARK_IO.File_Sys;
         --# derives CommandLineData.Content,
         --#         SPARK_IO.File_Sys       from *,
         --#                                      CommandLineData.Content;
         is

            function Exists_In
              (F          : E_Strings.T;
               L          : CommandLineData.Source_File_Lists;
               Start_Pos  : CommandLineData.Source_File_Positions;
               Finish_Pos : CommandLineData.Source_File_Positions)
              return       Boolean
            is
               Result : Boolean;
            begin
               Result := False;
               for Ix in CommandLineData.Source_File_Positions range Start_Pos .. Finish_Pos loop
                  Result := FileSystem.Same_File (F1 => F,
                                                  F2 => L (Ix).Source_File_Name);
                  exit when Result;
                  if L (Ix).Listing then
                     Result := FileSystem.Same_File (F1 => F,
                                                     F2 => L (Ix).Listing_File_Name);
                  end if;
                  exit when Result;
               end loop;
               return Result;
            end Exists_In;

            procedure Index_Non_Overlapping
            --# global in out CommandLineData.Content;
            --#        in out SPARK_IO.File_Sys;
            --# derives CommandLineData.Content,
            --#         SPARK_IO.File_Sys       from *,
            --#                                      CommandLineData.Content;
            is
            begin
               --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here";
               if CommandLineData.Content.Index then
                  CommandLineData.Content.Valid :=
                    not FileSystem.Same_File
                    (F1 => CommandLineData.Content.Index_File_Name,
                     F2 => CommandLineData.Content.Report_File_Name)
                    and then not (CommandLineData.Content.Warning
                                    and then FileSystem.Same_File
                                    (F1 => CommandLineData.Content.Index_File_Name,
                                     F2 => CommandLineData.Content.Warning_File_Name))
                    and then not Exists_In
                    (F          => CommandLineData.Content.Index_File_Name,
                     L          => CommandLineData.Content.Source_File_List,
                     Start_Pos  => 1,
                     Finish_Pos => CommandLineData.Content.Number_Source);
                  Possible_Error2 (E => EW_Overlap,
                                   F => CommandLineData.Content.Index_File_Name);
               end if;
               --# end accept;
            end Index_Non_Overlapping;

            procedure Warning_Non_Overlapping
            --# global in out CommandLineData.Content;
            --#        in out SPARK_IO.File_Sys;
            --# derives CommandLineData.Content,
            --#         SPARK_IO.File_Sys       from *,
            --#                                      CommandLineData.Content;
            is
            begin
               --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here";
               if CommandLineData.Content.Warning then
                  CommandLineData.Content.Valid :=
                    not FileSystem.Same_File
                    (F1 => CommandLineData.Content.Warning_File_Name,
                     F2 => CommandLineData.Content.Report_File_Name)
                    and then not Exists_In
                    (F          => CommandLineData.Content.Warning_File_Name,
                     L          => CommandLineData.Content.Source_File_List,
                     Start_Pos  => 1,
                     Finish_Pos => CommandLineData.Content.Number_Source);
                  Possible_Error2 (E => EW_Overlap,
                                   F => CommandLineData.Content.Warning_File_Name);
               end if;
               --# end accept;
            end Warning_Non_Overlapping;

            procedure Report_Non_Overlapping
            --# global in out CommandLineData.Content;
            --#        in out SPARK_IO.File_Sys;
            --# derives CommandLineData.Content,
            --#         SPARK_IO.File_Sys       from *,
            --#                                      CommandLineData.Content;
            is
            begin
               --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here";
               if CommandLineData.Content.Report then
                  CommandLineData.Content.Valid :=
                    not Exists_In
                    (F          => CommandLineData.Content.Report_File_Name,
                     L          => CommandLineData.Content.Source_File_List,
                     Start_Pos  => 1,
                     Finish_Pos => CommandLineData.Content.Number_Source);
                  Possible_Error2 (E => EW_Overlap,
                                   F => CommandLineData.Content.Report_File_Name);
               end if;
               --# end accept;
            end Report_Non_Overlapping;

            procedure Source_File_List_Non_Overlapping
            --# global in out CommandLineData.Content;
            --#        in out SPARK_IO.File_Sys;
            --# derives CommandLineData.Content,
            --#         SPARK_IO.File_Sys       from *,
            --#                                      CommandLineData.Content;
            is
            begin
               --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here";
               for Ix in CommandLineData.Source_File_Positions range 1 .. (CommandLineData.Content.Number_Source - 1) loop
                  CommandLineData.Content.Valid :=
                    not Exists_In
                    (F          => CommandLineData.Content.Source_File_List (Ix).Source_File_Name,
                     L          => CommandLineData.Content.Source_File_List,
                     Start_Pos  => Ix + 1,
                     Finish_Pos => CommandLineData.Content.Number_Source);
                  Possible_Error2 (E => EW_Overlap,
                                   F => CommandLineData.Content.Source_File_List (Ix).Source_File_Name);
                  exit when not CommandLineData.Content.Valid;
                  if CommandLineData.Content.Source_File_List (Ix).Listing then
                     CommandLineData.Content.Valid :=
                       not FileSystem.Same_File
                       (F1 => CommandLineData.Content.Source_File_List (Ix).Source_File_Name,
                        F2 => CommandLineData.Content.Source_File_List (Ix).Listing_File_Name)
                       and then not Exists_In
                       (F          => CommandLineData.Content.Source_File_List (Ix).Source_File_Name,
                        L          => CommandLineData.Content.Source_File_List,
                        Start_Pos  => Ix + 1,
                        Finish_Pos => CommandLineData.Content.Number_Source);
                     Possible_Error2 (E => EW_Overlap,
                                      F => CommandLineData.Content.Source_File_List (Ix).Source_File_Name);
                  end if;
                  exit when not CommandLineData.Content.Valid;
               end loop;
               if CommandLineData.Content.Valid and then CommandLineData.Content.Number_Source /= 0 then
                  CommandLineData.Content.Valid :=
                    not FileSystem.Same_File
                    (F1 => CommandLineData.Content.Source_File_List (CommandLineData.Content.Number_Source).Source_File_Name,
                     F2 => CommandLineData.Content.Source_File_List (CommandLineData.Content.Number_Source).Listing_File_Name);
                  Possible_Error2
                    (E => EW_Overlap,
                     F => CommandLineData.Content.Source_File_List (CommandLineData.Content.Number_Source).Source_File_Name);
               end if;
               --# end accept;
            end Source_File_List_Non_Overlapping;

         begin
            Index_Non_Overlapping;

            if CommandLineData.Content.Valid then
               Warning_Non_Overlapping;
            end if;

            if CommandLineData.Content.Valid then
               Report_Non_Overlapping;
            end if;

            if CommandLineData.Content.Valid then
               Source_File_List_Non_Overlapping;
            end if;
         end Wff_Non_Overlapping;

         function Strip_Any_At (S : E_Strings.T) return E_Strings.T is
            Result : E_Strings.T;
         begin
            if E_Strings.Get_Element (E_Str => S,
                                      Pos   => 1) = '@' then
               Result := E_Strings.Section (E_Str     => S,
                                            Start_Pos => 2,
                                            Length    => E_Strings.Get_Length (E_Str => S) - 1);
            else
               Result := S;
            end if;
            return Result;
         end Strip_Any_At;

         function Adjust_Filename (S : E_Strings.T) return E_Strings.T
         --# global in CommandLineData.Content;
         is
            R : E_Strings.T;
         begin
            if CommandLineData.Content.Plain_Output then
               R := FileSystem.Just_File (Fn  => S,
                                          Ext => True);
            else
               R := S;
            end if;
            return R;
         end Adjust_Filename;

         procedure Check_Output_Directory_Exists
         --# global in out CommandLineData.Content;
         --#        in out SPARK_IO.File_Sys;
         --# derives CommandLineData.Content,
         --#         SPARK_IO.File_Sys       from CommandLineData.Content,
         --#                                      SPARK_IO.File_Sys;
         is
         begin
            --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here" &
            --#        W, 169, CommandLineData.Content, "Direct updates OK here";
            if CommandLineData.Content.Valid and then CommandLineData.Content.Output_Directory then

               if FileSystem.Is_Directory (F => CommandLineData.Content.Output_Directory_Name) then
                  -- Make sure it ends with an EndOfPath separator, so it can be used
                  -- later in a call to FileSystem.InterpretRelative
                  FileSystem.Append_End_Of_Path_If_Needed (D => CommandLineData.Content.Output_Directory_Name);
               else
                  CommandLineData.Content.Valid := False;
                  Possible_Error2
                    (E => ES_OutputDirNotFound,
                     F => Adjust_Filename (S => CommandLineData.Content.Output_Directory_Name));
               end if;

            end if;
            --# end accept;
         end Check_Output_Directory_Exists;

         procedure Check_Language_Profile
         --# global in out CommandLineData.Content;
         --#        in out SPARK_IO.File_Sys;
         --# derives CommandLineData.Content,
         --#         SPARK_IO.File_Sys       from *,
         --#                                      CommandLineData.Content;
         is
         begin
            --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here";

            if CommandLineData.Content.Language_Profile = CommandLineData.SPARK83 then
               -- Ravenscar is not permitted in SPARK83 mode
               if CommandLineData.Content.Concurrency_Profile = CommandLineData.Ravenscar then
                  CommandLineData.Content.Valid := False;
                  Possible_Error (E => ES_NoRavenscarInSPARK83);
               end if;
               -- -sparklib is not permitted in SPARK83 mode
               if CommandLineData.Content.SPARK_Lib then
                  CommandLineData.Content.Valid := False;
                  Possible_Error (E => ES_NoSPARKLibInSPARK83);
               end if;
               -- -flow=auto is not permitted in SPARK83 mode
               if CommandLineData.Content.Flow_Option = CommandLineData.Auto_Flow then
                  CommandLineData.Content.Valid := False;
                  Possible_Error (E => ES_NoAutoFlowInSPARK83);
               end if;
            end if;
            --# end accept;
         end Check_Language_Profile;

      begin
         --# accept W, 169, CommandLineData.Content.Valid, "Direct updates OK here";
         -- Check index file readable
         if CommandLineData.Content.Valid and then CommandLineData.Content.Index then
            CommandLineData.Content.Valid := FileSystem.Is_Readable_File (F => CommandLineData.Content.Index_File_Name);
            Possible_Error2 (E => EW_Index,
                             F => Adjust_Filename (S => CommandLineData.Content.Index_File_Name));
         end if;

         --# assert True;

         -- Check warning control file readable
         if CommandLineData.Content.Valid and then CommandLineData.Content.Warning then
            CommandLineData.Content.Valid := FileSystem.Is_Readable_File (F => CommandLineData.Content.Warning_File_Name);
            Possible_Error2 (E => EW_Warning,
                             F => Adjust_Filename (S => CommandLineData.Content.Warning_File_Name));
         end if;

         --# assert True;

         -- Check target data file readable
         if CommandLineData.Content.Valid and then CommandLineData.Content.Target_Data then
            CommandLineData.Content.Valid := FileSystem.Is_Readable_File (F => CommandLineData.Content.Target_Data_File);
            Possible_Error2 (E => EW_Target,
                             F => Adjust_Filename (S => CommandLineData.Content.Target_Data_File));
         end if;

         --# assert True;

         -- Check config file readable
         if CommandLineData.Content.Valid and then CommandLineData.Content.Target_Config then
            CommandLineData.Content.Valid := FileSystem.Is_Readable_File (F => CommandLineData.Content.Target_Config_File);
            Possible_Error2 (E => EW_Config,
                             F => Adjust_Filename (S => CommandLineData.Content.Target_Config_File));
         end if;

         --# assert True;

         -- Check source files readable
         if CommandLineData.Content.Valid then
            for Ix in CommandLineData.Source_File_Positions range 1 .. CommandLineData.Content.Number_Source loop

               CommandLineData.Content.Valid :=
                 FileSystem.Is_Readable_File
                 (F => Strip_Any_At (S => CommandLineData.Content.Source_File_List (Ix).Source_File_Name));

               Possible_Error2
                 (E => EW_Source,
                  F => Adjust_Filename (S => CommandLineData.Content.Source_File_List (Ix).Source_File_Name));
               exit when not CommandLineData.Content.Valid;
            end loop;
         end if;

         --# assert True;

         --  The -makefile option can only be specified in certain
         --  circumstances.
         if CommandLineData.Content.Valid and then CommandLineData.Content.Makefile_Mode then
            CommandLineData.Content.Valid := CommandLineData.Content.Echo and CommandLineData.Content.Brief;

            Possible_Error (ES_Makefile);
         end if;

         --# assert True;

         Check_Output_Directory_Exists;

         Check_Language_Profile;

         if CommandLineData.Content.Valid then
            Wff_Non_Overlapping;
         end if;
         --# end accept;
      end Wff_Command_Line;

      procedure Read_Command_Line (Command_String : out Command_Strings)
      --# global in out CommandLineData.Content;
      --#        in out SPARK_IO.File_Sys;
      --# derives CommandLineData.Content,
      --#         SPARK_IO.File_Sys       from *,
      --#                                      SPARK_IO.File_Sys &
      --#         Command_String          from SPARK_IO.File_Sys;
      is
         Cmd_Line_Found         : Boolean;
         Default_Switches_Found : Boolean;
         Cmd_Line               : E_Strings.T;
         Tmp                    : E_Strings.T;
      begin
         --# accept W, 169, CommandLineData.Content.Default_Switch_File, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Help_Requested, "Direct updates OK here" &
         --#        W, 169, CommandLineData.Content.Plain_Output, "Direct updates OK here";

         Cmd_Line := E_Strings.Empty_String;

         if Ignore_Default_Switch_File then
            CommandLineData.Content.Default_Switch_File := False;
         else
            Read_Default_Switches (Default_Switches_Found => Default_Switches_Found,
                                   Cmd_Line               => Cmd_Line);
            if Default_Switches_Found then
               CommandLineData.Content.Default_Switch_File := True;
            end if;
         end if;

         -- Read commandline and append to the `switch line' (if any)
         FileSystem.Read_Cmd_Line (Cmd_Line_Found => Cmd_Line_Found,
                                   Cmd_Line       => Tmp);
         E_Strings.Append_Examiner_String (E_Str1 => Cmd_Line,
                                           E_Str2 => Tmp);
         Command_String := Command_Strings'(Current_Position => 1,
                                            Contents         => Cmd_Line);

         if not Cmd_Line_Found then
            -- Nothing on command-line so abandon processing and
            -- indicate that the user needs Help!
            CommandLineData.Content.Help_Requested := True;

            -- Override setting of PlainOutput so Help information
            -- always appears with Examiner version number and date.
            CommandLineData.Content.Plain_Output := False;
         end if;
         --# end accept;
      end Read_Command_Line;

   begin -- Process

      Read_Command_Line (Command_String => Command_String);

      -- If there's no command line at all, then we assume Help
      -- is needed, so don't bother to parse the remainder or default switches.
      if not CommandLineData.Content.Help_Requested then
         Parse_Command_Line (Command_String => Command_String);

         if CommandLineData.Content.Valid then
            Wff_Command_Line;
         end if;

      end if;
   end Process;

   procedure Process_Defaults_From_Switch_File is
      Command_String : Command_Strings;

      procedure Read_Switch_File (Command_String : out Command_Strings)
      --# global in out CommandLineData.Content;
      --#        in out SPARK_IO.File_Sys;
      --# derives CommandLineData.Content,
      --#         SPARK_IO.File_Sys       from *,
      --#                                      SPARK_IO.File_Sys &
      --#         Command_String          from SPARK_IO.File_Sys;
      is
         Default_Switches_Found : Boolean;
         Switch_Line            : E_Strings.T;

         Command_String_Content : E_Strings.T;
      begin
         Command_String_Content := E_Strings.Empty_String;

         Read_Default_Switches (Default_Switches_Found => Default_Switches_Found,
                                Cmd_Line               => Switch_Line);

         if Default_Switches_Found then
            --# accept W, 169, CommandLineData.Content.Default_Switch_File, "Direct updates OK here";
            CommandLineData.Content.Default_Switch_File := True;
            --# end accept;
            Command_String_Content := Switch_Line;
         end if;
         Command_String := Command_Strings'(1, Command_String_Content);
      end Read_Switch_File;

      procedure Parse_Switch_File (Command_String : in Command_Strings)
      --# global in out CommandLineData.Content;
      --#        in out SPARK_IO.File_Sys;
      --# derives CommandLineData.Content,
      --#         SPARK_IO.File_Sys       from *,
      --#                                      CommandLineData.Content,
      --#                                      Command_String;
      is
         Next_Symbol          : Symbols;
         Local_Command_String : Command_Strings;
      begin
         Local_Command_String := Command_String;
         Get_Next_Symbol (Command_String => Local_Command_String,
                          Next_Symbol    => Next_Symbol);
         --# accept F, 10, Next_Symbol, "Next_Symbol not used here" &
         --#        F, 10, Local_Command_String, "Local_Command_String not used here";
         Parse_Command_Options (Command_String => Local_Command_String,
                                Next_Symbol    => Next_Symbol);
      end Parse_Switch_File;

   begin -- Process_Defaults_From_Switch_File

      if Ignore_Default_Switch_File then
         null;
      else
         Read_Switch_File (Command_String => Command_String);
         Parse_Switch_File (Command_String => Command_String);
      end if;
   end Process_Defaults_From_Switch_File;

end CommandLineHandler;