Menu

[r976]: / manual.html  Maximize  Restore  History

Download this file

5199 lines (4363 with data), 206.7 kB

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<meta name="GENERATOR" content="TtH 3.00">
<style type="text/css"><!--
td div.comp { margin-top: -0.6ex; margin-bottom: -1ex;}
td div.comb { margin-top: -0.6ex; margin-bottom: -.6ex;}
td div.hrcomp { line-height: 0.9; margin-top: -0.8ex; margin-bottom: -1ex;}
td div.norm {line-height:normal;}
span.roman {font-family: serif; font-style: normal; font-weight: normal;}
span.overacc2 {position: relative; left: .8em; top: -1.2ex;}
span.overacc1 {position: relative; left: .6em; top: -1.2ex;} --></style>
<title> Vector Pascal</title>
<h1 align="center"> Vector Pascal </h1>
<p>
<h3 align="center">Paul Cockshott and Ken Renfrew </h3>
<p>
<h1>Contents </h1>
<a href="#tth_chAp1"
>1&nbsp; Elements of the language</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc1.1"
>1.1&nbsp; Alphabet</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc1.1.1"
>1.1.1&nbsp; Extended alphabet</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc1.2"
>1.2&nbsp; Reserved words</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc1.3"
>1.3&nbsp; Comments</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc1.4"
>1.4&nbsp; Identifiers</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc1.5"
>1.5&nbsp; Literals</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc1.5.1"
>1.5.1&nbsp; Integer numbers</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc1.5.2"
>1.5.2&nbsp; Real numbers</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc1.5.3"
>1.5.3&nbsp; Character strings</a><br />
<a href="#tth_chAp2"
>2&nbsp; Declarations</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc2.1"
>2.1&nbsp; Constants</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc2.1.1"
>2.1.1&nbsp; Array constants</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc2.1.2"
>2.1.2&nbsp; Pre-declared constants</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc2.2"
>2.2&nbsp; Labels</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc2.3"
>2.3&nbsp; Types</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc2.3.1"
>2.3.1&nbsp; Simple types</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc2.3.2"
>2.3.2&nbsp; Structured types</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc2.3.3"
>2.3.3&nbsp; Dynamic types</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc2.4"
>2.4&nbsp; File types</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc2.5"
>2.5&nbsp; Variables</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc2.5.1"
>2.5.1&nbsp; External Variables</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc2.5.2"
>2.5.2&nbsp; Entire Variables</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc2.5.3"
>2.5.3&nbsp; Indexed Variables</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc2.5.4"
>2.5.4&nbsp; Field Designators</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc2.5.5"
>2.5.5&nbsp; Referenced Variables</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc2.6"
>2.6&nbsp; Procedures and Functions</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc2.6.1"
>2.6.1&nbsp; Procedural Parameters to Procedures</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc2.6.2"
>2.6.2&nbsp; Procedure types</a><br />
<a href="#tth_chAp3"
>3&nbsp; Algorithms</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.1"
>3.1&nbsp; Expressions</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.1.1"
>3.1.1&nbsp; Mixed type expressions</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.1.2"
>3.1.2&nbsp; Primary expressions</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.1.3"
>3.1.3&nbsp; Unary expressions</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.1.4"
>3.1.4&nbsp; Operator Reduction</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.1.5"
>3.1.5&nbsp; Complex conversion</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.1.6"
>3.1.6&nbsp; Conditional expressions</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.1.7"
>3.1.7&nbsp; Factor</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.1.8"
>3.1.8&nbsp; Multiplicative expressions</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.1.9"
>3.1.9&nbsp; Additive expressions</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.1.10"
>3.1.10&nbsp; Expressions</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.1.11"
>3.1.11&nbsp; Operator overloading</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.2"
>3.2&nbsp; Statements</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.2.1"
>3.2.1&nbsp; Assignment</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.2.2"
>3.2.2&nbsp; Procedure statement</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.2.3"
>3.2.3&nbsp; Goto statement</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.2.4"
>3.2.4&nbsp; Exit Statement</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.2.5"
>3.2.5&nbsp; Compound statement</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.2.6"
>3.2.6&nbsp; If statement</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.2.7"
>3.2.7&nbsp; Case statement</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.2.8"
>3.2.8&nbsp; With statement</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.2.9"
>3.2.9&nbsp; For statement</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.2.10"
>3.2.10&nbsp; While statement</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.2.11"
>3.2.11&nbsp; Repeat statement</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.3"
>3.3&nbsp; Input Output </a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.3.1"
>3.3.1&nbsp; Input</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc3.3.2"
>3.3.2&nbsp; Output </a><br />
<a href="#tth_chAp4"
>4&nbsp; Programs and Units</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc4.1"
>4.1&nbsp; The export of identifiers from units</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc4.1.1"
>4.1.1&nbsp; The export of procedures from libraries.</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc4.1.2"
>4.1.2&nbsp; The export of Operators from units</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc4.2"
>4.2&nbsp; Unit parameterisation and generic functions</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc4.3"
>4.3&nbsp; The invocation of programs and units</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc4.4"
>4.4&nbsp; The compilation of programs and units.</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc4.4.1"
>4.4.1&nbsp; Linking to external libraries</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc4.5"
>4.5&nbsp; Instantiation of parametric units</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc4.5.1"
>4.5.1&nbsp; Direct instantiation</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc4.5.2"
>4.5.2&nbsp; Indirect instantiation</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc4.6"
>4.6&nbsp; The System Unit</a><br />
<a href="#tth_chAp5"
>5&nbsp; Implementation issues</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc5.1"
>5.1&nbsp; Invoking the compiler</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc5.1.1"
>5.1.1&nbsp; Environment variable</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc5.1.2"
>5.1.2&nbsp; Compiler options</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc5.1.3"
>5.1.3&nbsp; Dependencies</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc5.2"
>5.2&nbsp; Calling conventions</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc5.3"
>5.3&nbsp; Array representation</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#tth_sEc5.3.1"
>5.3.1&nbsp; Range checking</a><br />
<a href="#tth_sEcindex">Index</a><br />
<p>
<h1>Introduction</h1>
<p>
Vector Pascal is a dialect of Pascal designed to make efficient use of the multi-media
instructionsets of recent procesors. It supports data parallel operations and
saturated arithmetic. This manual describes the Vector Pascal language.
<p>
A number of widely used contemporary processors have instructionset extensions
for improved performance in multi-media applications. The aim is to allow operations
to proceed on multiple pixels each clock cycle. Such instructionsets have been
incorporated both in specialist DSP chips like the Texas C62xx[<a href="#Texas" name="CITETexas">35</a>]
and in general purpose CPU chips like the Intel IA32[<a href="#Intel00" name="CITEIntel00">14</a>] or the AMD
K6 [<a href="#AMD" name="CITEAMD">2</a>].
<p>
These instructionset extensions are typically based on the Single Instruction-stream
Multiple Data-stream (SIMD<a name="SIMD00">
</a>) model in which a single instruction
causes the same mathematical operation to be carried out on several operands,
or pairs of operands at the same time. The level or parallelism supported ranges
from 2 floating point operations at a time on the AMD<a name="AMD00">
</a> K<a name="K600">
</a>6
architecture to 16 byte operations at a time on the intel P4 architecture. Whilst
processor architectures are moving towards greater levels of parallelism, the
most widely used programming languages like C<a name="C00">
</a>, Java<a name="Java00">
</a> and
Delphi<a name="Delphi00">
</a> are structured around a model of computation in which
operations take place on a single value at a time. This was appropriate when
processors worked this way, but has become an impediment to programmers seeking
to make use of the performance offered by multi-media instructionsets. The introduction
of SIMD instruction sets[<a href="#IA32" name="CITEIA32">13</a>][<a href="#Peleg97" name="CITEPeleg97">29</a>] to Personal Computers potentially
provides substantial performance increases, but the ability of most programmers
to harness this performance is held back by two factors. The first is the limited
availability of compilers that make effective use of these instructionsets in
a machine independent manner. This remains the case despite the research efforts
to develop compilers for multi-media instructionsets[<a href="#Cheong97" name="CITECheong97">8</a>][<a href="#Leupers99" name="CITELeupers99">26</a>][<a href="#Krall00" name="CITEKrall00">24</a>][<a href="#Sreraman00" name="CITESreraman00">32</a>].
The second is the fact that most popular programming languages were designed
on the word at a time model of the classic von Neumann computer.
<p>
Vector Pascal aims to provide an efficient and concise notation for programmers
using Multi-Media enhanced CPUs. In doing so it borrows concepts for expressing
data parallelism that have a long history, dating back to Iverson's work on
APL<a name="APL00">
</a> in the early '60s[<a href="#Iverson62" name="CITEIverson62">17</a>].
<p>
Define a vector of type <em>T</em> as having type T[] . Then if we have
a binary operator <font face="symbol">w</font
>:(T<font face="symbol">Ä</font
>T)<font face="symbol">®</font
> T , in languages derived
from APL we automatically have an operator <font face="symbol">w</font
>:(T[]<font face="symbol">Ä</font
>T[])<font face="symbol">®</font
> T[]
. Thus if x,y are arrays of integers k=x+y is the array
of integers where k<sub>i</sub>=x<sub>i</sub>+y<sub>i</sub> .
<p>
The basic concept is simple, there are complications to do with the semantics
of operations between arrays of different lengths and different dimensions,
but Iverson provides a consistent treatment of these. The most recent languages
to be built round this model are J<a name="J00">
</a>, an interpretive language[<a href="#Jmanual" name="CITEJmanual">19</a>][<a href="#Burke" name="CITEBurke">5</a>][<a href="#Jintro" name="CITEJintro">20</a>],
and F[<a href="#Metcalf96" name="CITEMetcalf96">28</a>] a modernised Fortran<a name="Fortran00">
</a>. In principle though
any language with array types can be extended in a similar way. Iverson's approach
to data parallelism is machine independent. It can be implemented using scalar
instructions or using the SIMD model. The only difference is speed.
<p>
Vector Pascal incorporates Iverson's approach to data parallelism. Its aim is
to provide a notation that allows the natural and elegant expression of data
parallel algorithms within a base language that is already familiar to a considerable
body of programmers and combine this with modern compilation techniques.
<p>
By an elegant algorithm I mean one which is expressed as concisely as possible.
Elegance is a goal that one approaches asymptotically, approaching but never
attaining[<a href="#Chaitin" name="CITEChaitin">7</a>]. APL and J allow the construction of very elegant programs,
but at a cost. An inevitable consequence of elegance is the loss of redundancy.
APL programs are as concise, or even more concise than conventional mathematical
notation[<a href="#Iverson80" name="CITEIverson80">18</a>] and use a special character-set. This makes them hard
for the uninitiated to understand. J attempts to remedy this by restricting
itself to the ASCII character-set, but still looks dauntingly unfamiliar to
programmers brought up on more conventional languages. Both APL and J are interpretive
which makes them ill suited to many of the applications for which SIMD speed
is required. The aim of Vector Pascal is to provide the conceptual gains of
Iverson's notation within a framework familiar to imperative programmers.
<p>
Pascal<a name="Pascal00">
</a>[<a href="#Jensen" name="CITEJensen">21</a>]was chosen as a base language over the alternatives
of C and Java. C was rejected because notations like <tt>x+y</tt> for <tt>x</tt>
and <tt>y</tt> declared as <tt>int x[4]</tt>, <tt>y[4]</tt>, already have the
meaning of adding the addresses of the arrays together. Java was rejected because
of the difficulty of efficiently transmitting data parallel operations via its
intermediate code to a just in time code generator.
<p>
Iverson's approach to data parallelism is machine independent. It can be implemented
using scalar instructions or using the SIMD<a name="SIMD00">
</a> model. The only difference
is speed. Vector Pascal incorporates Iverson's approach to data parallelism.
<p>
<h1><a name="tth_chAp1">
Chapter 1 </a><br />Elements of the language</h1>
<p>
<h2><a name="tth_sEc1.1">
1.1</a>&nbsp;&nbsp;Alphabet</h2>
The Vector Pascal compiler accepts files in the UTF-8 encoding of
Unicode as source. Since ASCII is a subset of this, ASCII files are valid input.
<p>
Vector Pascal programs are made up of letter, digits and special
symbols. The letters digits and special symbols are draw either from a base
character set or from an extended character set. The base character set is drawn
from ASCII and restricts the letters to be from the Latin alphabet.
The extended character set allows letters from other alphabets.
<p>
The special symbols used in the base alphabet are shown in table<a href="#specials">1.1</a> .
<p>
<a name="tth_tAb1.1">
</a> <center>Table 1.1: Special symbols<a name="specials">
</a></center>
<center>
<table border="1">
<tr><td align="center">+</td><td align="center">:</td><td align="center">(</td></tr>
<tr><td align="center">-</td><td align="center">'</td><td align="center">)</td></tr>
<tr><td align="center">*</td><td align="center">=</td><td align="center">[</td></tr>
<tr><td align="center">/</td><td align="center">&lt;&#62;</td><td align="center">]</td></tr>
<tr><td align="center">:=</td><td align="center">&lt;</td><td align="center">{</td></tr>
<tr><td align="center">.</td><td align="center">&lt;=</td><td align="center">}</td></tr>
<tr><td align="center">,</td><td align="center">&#62;=</td><td align="center"></td></tr>
<tr><td align="center">;</td><td align="center">&#62;</td><td align="center">..</td></tr>
<tr><td align="center">+:</td><td align="center">@</td><td align="center">*)</td></tr>
<tr><td align="center">-:</td><td align="center">$</td><td align="center">(*</td></tr>
<tr><td align="center">_</td><td align="center">**</td><td align="center"></td></tr></table>
<p>
</center>
<p>
<h3><a name="tth_sEc1.1.1">
1.1.1</a>&nbsp;&nbsp;Extended alphabet</h3>
The extended alphabet is described in <a href="VPUnicode.htm">Using Unicode with Vector Pascal</a>.
<p>
<h2><a name="tth_sEc1.2">
1.2</a>&nbsp;&nbsp;Reserved words</h2>
<a name="resw">
</a>
The reserved words are
<p>
<tt>ABS, ADDR, AND, ARRAY,</tt>
<p>
<tt>BEGIN, BYTE2PIXEL,</tt>
<p>
<tt>CASE, CAST, CDECL, CHR, CONST, COS,</tt>
<p>
<tt> DIV, DO, DOWNTO,</tt>
<p>
<tt>END, ELSE, EXIT, EXTERNAL,</tt>
<p>
<tt>FALSE, FILE, FOR, FUNCTION,</tt>
<p>
<tt>GOTO,</tt>
<p>
<tt>IF, IMPLEMENTATION, IN, INTERFACE, IOTA,</tt>
<p>
<tt>LABEL, LIBRARY, LN,</tt>
<p>
<tt>MAX, MIN, MOD,</tt>
<p>
<tt>NAME, NDX, NOT,</tt>
<p>
<tt>OF, OR, ORD, OTHERWISE,</tt>
<p>
<tt>PACKED, PERM, PIXEL2BYTE, POW, PRED,</tt> <br /><tt>PROCEDURE, PROGRAM,</tt>
<tt>PROTECTED ,</tt>
<p>
<tt>RDU, RECORD, REPEAT, ROUND,</tt>
<p>
<tt>SET, SHL, SHR, SIN, SIZEOF, STRING, SQRT, SUCC,</tt>
<p>
<tt>TAN, THEN, TO, TRANS, TRUE, TYPE,</tt>
<p>
<tt>VAR,</tt>
<p>
<tt>WITH, WHILE, </tt>
<tt>UNIT, UNTIL, USES </tt>
<p>
Reserved words may be written in either lower case or upper case letters, or
any combination of the two.
<p>
<h2><a name="tth_sEc1.3">
1.3</a>&nbsp;&nbsp;Comments</h2>
<p>
The comment<a name="comment13">
</a> construct
<p>
<tt>{<a name="13">
</a></tt> &lt; any sequence of characters not containing ``}''
&#62; <tt>}</tt>
<p>
may be inserted between any two identifiers, special symbols, numbers or reserved
words without altering the semantics or syntactic correctness of the program.
The bracketing pair <tt>(* *)<a name="*)13">
</a></tt> may substitute for <tt>{
}</tt>. Where a comment starts with <tt>{</tt> it continues until the next <tt>}</tt>.
Where it starts with <tt>(*<a name="(*13">
</a></tt> it must be terminated by <tt>*)</tt><a href="#tthFtNtAAB" name="tthFrefAAB"><sup>1</sup></a>.
<p>
<h2><a name="tth_sEc1.4">
1.4</a>&nbsp;&nbsp;Identifiers</h2>
<p>
Identifiers are used to name values, storage locations, programs, program modules,
types, procedures and functions. An identifier<a name="identifier14">
</a> starts with
a letter followed by zero or more letters, digits or the special symbol <tt>_</tt>.
Case is not significant in identifiers.
ISO Pascal allows the Latin letters A-Z to be used in identifiers.
Vector Pascal extends this by allowing symbols from the Greek,
Cyrillic, Katakana and Hiragana, or CJK character sets
<p>
<h2><a name="tth_sEc1.5">
1.5</a>&nbsp;&nbsp;Literals</h2>
<p>
<h3><a name="tth_sEc1.5.1">
1.5.1</a>&nbsp;&nbsp;Integer numbers</h3>
<p>
Integer numbers are formed of a sequence of decimal digits, thus <tt>1</tt>,
<tt>23</tt>, <tt>9976</tt> etc, or as hexadecimal<a name="hexadecimal15">
</a> numbers,
or as numbers of any base between 2 and 36. A hexadecimal number takes the form
of a <tt>$</tt> followed by a sequence of hexadecimal digits thus <tt>$01,
$3ff, $5A</tt>. The letters in a hexadecimal number may be upper or lower case
and drawn from the range <tt>a..f</tt> or <tt>A..F. </tt>
<p>
A based integer<a name="integer15">
</a> is written with the base first followed by a
# character and then a sequence of letters or digits. Thus <tt>2#1101</tt>
is a binary number <tt>8#67</tt> an octal<a name="octal15">
</a> number and <tt>20#7i</tt>
a base 20 number.
<p>
The default precision for integers is 32 bits<a href="#tthFtNtAAC" name="tthFrefAAC"><sup>2</sup></a>.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;digit sequence&#62;</td><td align="center">&lt;digit&#62; +</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;decimal integer&#62;</td><td align="center">&lt;digit sequence&#62;</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;hex integer&#62;</td><td align="center">`$'&lt;hexdigit&#62;+</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;based integer&#62; </td><td align="center">&lt;digit sequence&#62;'#'&lt;alphanumeric&#62;+</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;unsigned integer&#62;</td><td align="center">&lt;decimal integer&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;hex integer&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;based integer&#62;</td></tr></table>
<p>
<a name="tth_tAb1.2">
</a> <center>Table 1.2: The hexadecimal digits of Vector Pascal.</center>
<center>
<table border="1">
<tr><td align="center">Value</td><td align="center">0</td><td align="center">1</td><td align="center">2</td><td align="center">3</td><td align="center">4</td><td align="center">5</td><td align="center">6</td><td align="center">7</td><td align="center">8</td><td align="center">9</td><td align="center">10</td><td align="center">11</td><td align="center">12</td><td align="center">13</td><td align="center">14</td><td align="center">15</td></tr>
<tr><td align="center">Notation 1</td><td align="center">0</td><td align="center">1</td><td align="center">2</td><td align="center">3</td><td align="center">4</td><td align="center">5</td><td align="center">6</td><td align="center">7</td><td align="center">8</td><td align="center">9</td><td align="center">A</td><td align="center">B</td><td align="center">C</td><td align="center">D</td><td align="center">E</td><td align="center">F</td></tr>
<tr><td align="center">Notation 2</td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center">a</td><td align="center">b</td><td align="center">c</td><td align="center">d</td><td align="center">e</td><td align="center">f</td></tr></table>
<p>
</center>.
<p>
</center> <h3><a name="tth_sEc1.5.2">
1.5.2</a>&nbsp;&nbsp;Real numbers</h3>
<p>
Real numbers are supported in floating point notation, thus <tt>14.7</tt>,
<tt>&nbsp;9.99e5</tt>,
<tt>
38E3,</tt> &nbsp;<tt>3.6e-4</tt> are all valid denotations for real<a name="real15">
</a> numbers. The default
precision for real numbers is also 32 bit, though intermediate calculations
may use higher precision. The choice of 32 bits as the default precision is
influenced by the fact that 32 bit floating point vector operations are well
supported in multi-media<a name="media15">
</a> instructions.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;exp&#62;</td><td align="center">`e'</td></tr>
<tr><td align="center"></td><td align="center">`E'</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;scale factor&#62;</td><td align="center">[&lt;sign&#62;] &lt;unsigned integer&#62;</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;sign&#62;</td><td align="center">`-'</td></tr>
<tr><td align="center"></td><td align="center">`+'</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;unsigned real&#62;</td><td align="center">&lt;decimal integer&#62; `.' &lt;digit sequence&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;decimal integer&#62;` .' &lt;digit sequence&#62; &lt;exp&#62;&lt;scale factor&#62; </td></tr>
<tr><td align="center"></td><td align="center">&lt;decimal integer&#62;&lt;exp&#62; &lt;scale factor&#62;</td></tr></table>
<p>
</center>
<h4>Fixed point numbers</h4>
<p>
In Vector Pascal pixels<a name="pixels15">
</a> are represented as signed fixed point
fractions in the range -1.0 to 1.0. Within this range, fixed point literals
have the same syntactic form as real numbers.
<p>
<h3><a name="tth_sEc1.5.3">
1.5.3</a>&nbsp;&nbsp;Character strings</h3>
<p>
Sequences of characters enclosed by quotes are called literal<a name="literal15">
</a>
strings. Literal strings<a name="strings15">
</a> consisting of a single character are
constants of the standard type char. If the string is to contain a quote character
this quote character must be written twice.
<p>
<tt><font size="-1">'A' 'x' 'hello' 'John''s house'</font></tt><font size="-1">
<p>
</font>are all valid literal strings. The allowable characters in literal strings are
any of the Unicode characters above u0020. The character strings must be input
to the compiler in UTF-8 format.
<p>
<h1><a name="tth_chAp2">
Chapter 2 </a><br />Declarations</h1>
<p>
Vector Pascal is a language supporting nested declaration<a name="declaration20">
</a>
contexts. A declaration context is either a program context, and unit interface
or implementation context, or a procedure or function context. A resolution
context determines the meaning of an identifier. Within a resolution context,
identifiers can be declared to stand for constants, types, variables, procedures
or functions. When an identifier is used, the meaning taken on by the identifier
is that given in the closest containing resolution context. Resolution contexts
are any declaration context or a <tt>with</tt> statement context. The ordering
of these contexts when resolving an identifier is:
<p>
<ol type="1"><p>
<li> The declaration context identified by any <tt>with</tt> statements which nest
the current occurrence of the identifier. These <tt>with</tt> statement contexts
are searched from the innermost to the outermost.</li>
<p>
<li> The declaration context of the currently nested procedure<a name="procedure20">
</a>
declarations. These procedure contexts are searched from the innermost to the
outermost.</li>
<p>
<li> The declaration context of the current unit<a name="unit20">
</a> or program<a name="program20">
</a>.</li>
<p>
<li> The interface declaration contexts of the units mentioned in the use list of
the current unit or program. These contexts are searched from the rightmost
unit mentioned in the use list to the leftmost identifier in the use list.</li>
<p>
<li> The interface declaration context of the System<a name="System20">
</a> unit.</li>
<p>
<li> The pre-declared identifiers of the language.</li>
</ol>
<p>
<h2><a name="tth_sEc2.1">
2.1</a>&nbsp;&nbsp;Constants</h2>
<p>
A constant definition introduces an identifier as a synonym for a constant.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;constant declaration&#62;</td><td align="center">&lt;identifier&#62;=&lt;expression&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;identifier&#62;':'&lt;type&#62;'='&lt;typed constant&#62;</td></tr></table>
<p>
</center>Constants can be simple constants or typed constants. A simple constant must
be a constant expression whose value is known at compile time. This restricts
it to expressions for which all component identifiers are other constants, and
for which the permitted operators<a name="operators21">
</a> are given in table<a href="#MMConst">2.1</a>
. This restricts simple constants to be of scalar or string types.
<p>
<p>
<a name="tth_tAb2.1">
</a> <center>Table 2.1: The operators permitted in Vector Pascal constant expressions.<a name="MMConst">
</a></center>
<center>
<table border="1">
<tr><td align="center">+</td><td align="center">-</td><td align="center">*</td><td align="center">/</td><td align="center">div</td><td align="center">mod</td><td align="center">shr</td><td align="center">shl</td><td align="center">and</td><td align="center">or</td></tr></table>
<p>
</center>
<p>
Typed constants provide the program with initialised variables which may hold
array types.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;typed constant&#62;</td><td align="center">&lt;expression&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;array constant&#62;</td></tr></table>
<p>
</center> <h3><a name="tth_sEc2.1.1">
2.1.1</a>&nbsp;&nbsp;Array constants</h3>
<p>
Array constants are comma separated lists of constant expressions enclosed by
brackets. Thus
<p>
<tt>tr:array[1..3] of real =(1.0,1.0,2.0);</tt>
<p>
is a valid array constant declaration, as is:
<p>
<font size="-1"><tt>t2:array[1..2,1..3] of real=((1.0,2.0,4.0),(1.0,3.0,9.0));</tt></font>
<p>
The array constant<a name="constant21">
</a><a name="array constant21">
</a> must structurally
match the type<a name="type21">
</a> given to the identifier. That is to say it must
match with respect to number of dimensions, length of each dimension, and type
of the array elements.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;array constant&#62;</td><td align="center">'(' &lt;typed constant&#62; [,&lt;typed constant&#62;]* ')'</td></tr></table>
<p>
</center> <h3><a name="tth_sEc2.1.2">
2.1.2</a>&nbsp;&nbsp;Pre-declared constants<a name="constants21">
</a></h3>
<p>
<dl compact="compact">
<dt><b><tt>maxint<a name="maxint21">
</a></tt></b></dt>
<dd>The largest supported integer value.</dd>
<dt><b><tt>pi<a name="pi21">
</a></tt></b></dt>
<dd> A real numbered approximation to <font face="symbol">p</font
></dd>
<dt><b><tt>maxchar<a name="maxchar21">
</a></tt></b></dt>
<dd> The highest character in the character set.</dd>
<dt><b><tt>maxstring<a name="maxstring21">
</a></tt></b></dt>
<dd>The maximum number of characters allowed
in a string.</dd>
<dt><b><tt>maxreal<a name="maxreal21">
</a></tt></b></dt>
<dd>The highest representable real.</dd>
<dt><b><tt>minreal<a name="minreal21">
</a></tt></b></dt>
<dd>The smallest representable positive real number.</dd>
<dt><b><tt>epsreal<a name="epsreal21">
</a></tt></b></dt>
<dd>The smallest real number which when added
to 1.0 yields a value distinguishable from 1.0.</dd>
<dt><b><tt>maxdouble<a name="maxdouble21">
</a></tt></b></dt>
<dd>The highest representable double precision
real number.</dd>
<dt><b><tt>mindouble<a name="mindouble21">
</a></tt></b></dt>
<dd>The smallest representable positive double
precision real number.</dd>
<dt><b><tt>complexzero<a name="complexzero21">
</a></tt></b></dt>
<dd>A complex number with zero real and
imaginary parts.</dd>
<dt><b><tt>complexone</tt><a name="complexone21">
</a></b></dt>
<dd>A complex number with real part 1 and
imaginary part 0.
</dd>
</dl>
<p>
<h2><a name="tth_sEc2.2">
2.2</a>&nbsp;&nbsp;Labels</h2>
<p>
Labels are written as digit sequences. Labels must be declared before they are
used. They can be used to label the start of a statement and can be the destination
of a <tt>goto<a name="goto22">
</a></tt> statement. A <tt>goto</tt> statement must have
as its destination a label<a name="label22">
</a> declared within the current innermost
declaration context. A statement can be prefixed by a label followed by a colon.
<p>
Example
<p>
<tt>label 99;</tt>
<p>
<tt>begin read(x); if x&#62;9 goto 99; write(x*2);99: end;</tt>
<p>
<h2><a name="tth_sEc2.3">
2.3</a>&nbsp;&nbsp;Types</h2>
<p>
A type declaration determines the set of values that expressions of this type
may assume and associates with this set an identifier.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;type&#62;</td><td align="center">&lt;simple type&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;structured type&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;pointer type&#62;</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;type definition&#62;</td><td align="center">&lt;identifier&#62;'='&lt;type&#62; </td></tr></table>
<p>
</center> <h3><a name="tth_sEc2.3.1">
2.3.1</a>&nbsp;&nbsp;Simple types</h3>
<p>
Simple types are either scalar, standard, subrange or dimensioned types.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;simple type&#62;</td><td align="center">&lt;scalar type&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;integral type&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;subrange type&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;dimensioned type&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;floating point type&#62;</td></tr></table>
<p>
</center>
<h4>Scalar types</h4>
<p>
A scalar<a name="scalar23">
</a> type<a name="type23">
</a> defines an ordered set of identifier
by listing these identifiers. The declaration takes the form of a comma separated
list of identifiers enclosed by brackets. The identifiers in the list are declared
simultaneously with the declared scalar type to be constants of this declared
scalar type. Thus
<pre>
colour = (red,green,blue);
day=(monday,tuesday,wednesday,thursday,
friday,saturday,sunday);
</pre>
are valid scalar type declarations.
<p>
<h4>Standard types</h4><a name="auxtypes">
</a>
<p>
The following types are provided as standard in Vector Pascal:
<p>
<a name="tth_tAb2.2">
</a> <center>Table 2.2: Categorisation of the standard types.</center>
<center>
<table border="1">
<tr><td align="center">type</td><td align="center">category</td></tr><tr><td>
<tr><td align="center">real</td><td align="center">floating point</td></tr>
<tr><td align="center">double</td><td align="center">floating point</td></tr>
<tr><td align="center">byte</td><td align="center">integral</td></tr>
<tr><td align="center">pixel</td><td align="center">fixed point</td></tr>
<tr><td align="center">shortint</td><td align="center">integral</td></tr>
<tr><td align="center">word</td><td align="center">integral</td></tr>
<tr><td align="center">integer</td><td align="center">integral</td></tr>
<tr><td align="center">cardinal</td><td align="center">integral</td></tr>
<tr><td align="center">boolean</td><td align="center">scalar</td></tr>
<tr><td align="center">char</td><td align="center">scalar</td></tr></table>
<p>
</center>
<p>
<dl compact="compact">
<dt><b><tt>integer<a name="integer23">
</a></tt></b></dt>
<dd>The numbers are in the range -maxint to +maxint.</dd>
<dt><b><tt>real<a name="real23">
</a></tt></b></dt>
<dd>These are a subset of the reals constrained by the
IEEE 32 bit floating point format.</dd>
<dt><b><tt>double<a name="double23">
</a></tt></b></dt>
<dd>These are a subset of the real numbers constrained
by the IEEE<a name="IEEE23">
</a> 64 bit floating point format.</dd>
<dt><b><tt>pixel<a name="pixel23">
</a></tt></b></dt>
<dd>These are represented as fixed<a name="fixed23">
</a> point<a name="point23">
</a>
binary<a name="binary23">
</a> fractions<a name="fractions23">
</a> in the range -1.0 to 1.0.</dd>
<dt><b><tt>boolean<a name="boolean23">
</a></tt></b></dt>
<dd>These take on the values <tt>(false<a name="false23">
</a>,true<a name="true23">
</a>)</tt>
which are ordered such that <tt>true&#62;false</tt>.</dd>
<dt><b><tt>char<a name="char23">
</a></tt></b></dt>
<dd>These include the characters from <tt>chr(0)</tt>
to <tt>charmax</tt><a name="charmax23">
</a>. All the allowed characters for string literals
are in the type char, but the character-set may include other characters whose
printable form is country specific.</dd>
<dt><b><tt>pchar</tt><a name="pchar23">
</a></b></dt>
<dd>Defined as <tt>char</tt>.</dd>
<dt><b><tt>byte<a name="byte23">
</a></tt></b></dt>
<dd>These take on the positive integers between 0 and
255.</dd>
<dt><b><tt>shortint<a name="shortint23">
</a></tt></b></dt>
<dd>These take on the signed values between
-128 and 127.</dd>
<dt><b><tt>word<a name="word23">
</a></tt></b></dt>
<dd>These take on the positive integers from 0 to 65535.</dd>
<dt><b><tt>cardinal<a name="cardinal23">
</a></tt></b></dt>
<dd>These take on the positive integers form
0 to 4292967295, i.e., the most that can be represented in a 32 bit unsigned
number.</dd>
<dt><b><tt>longint<a name="longint23">
</a></tt></b></dt>
<dd>A 32 bit integer, retained for compatibility
with Turbo Pascal.</dd>
<dt><b><tt>int<a name="int6423">
</a>64</tt></b></dt>
<dd>A 64 bit integer.</dd>
<dt><b><tt>complex<a name="complex23">
</a></tt></b></dt>
<dd>A complex number with the real and imaginary
parts held to 32 bit precision.
</dd>
</dl>
<p>
<h4>Subrange types</h4>
<p>
A type may be declared as a subrange<a name="subrange23">
</a> of another scalar<a name="scalar23">
</a>
or integer<a name="integer23">
</a> type by indicating the largest and smallest value
in the subrange. These values must be constants known at compile time.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;subrange type&#62;</td><td align="center">&lt;constant&#62; '..' &lt;constant&#62;</td></tr></table>
<p>
</center>Examples: 1..10, 'a'..'f', monday..thursday.
<p>
<h4>Pixels</h4>
<p>
The <em>conceptual model</em> of pixels in Vector Pascal is that they are real
numbers in the range <font face="symbol">-</font
>1.0..1.0 . As a signed representation it lends itself
to subtraction. As an unbiased representation, it makes the adjustment of contrast
easier. For example, one can reduce contrast 50% simply by multiplying an image
by 0.5 <a href="#tthFtNtAAD" name="tthFrefAAD"><sup>3</sup></a>. Assignment to pixel variables in Vector Pascal is defined to be saturating
- real numbers outside the range <font face="symbol">-</font
>1..1 are clipped to it. The multiplications
involved in convolution operations fall naturally into place.
<p>
The <em>implementation model</em> of pixels used in Vector Pascal is of 8 bit
signed integers treated as fixed point binary fractions. All the conversions
necessary to preserve the monotonicity of addition, the range of multiplication
etc, are delegated to the code generator which, where possible, will implement
the semantics using efficient, saturated multi-media arithmetic instructions.
<p>
<h4>Dimensioned types</h4>
<p>
These provide a means by which floating point types can be specialised to represent
dimensioned numbers as is required in physics calculations. For example:
<p>
<tt>kms =(mass,distance,time);</tt>
<p>
<tt>meter=real of distance;</tt>
<p>
<tt>kilo=real of mass;</tt>
<p>
<tt>second=real of time;</tt>
<p>
<tt>newton=real of mass * distance * time POW -2;</tt>
<p>
<tt>meterpersecond = real of distance *time POW -1;</tt>
<p>
The grammar is given by:
<p>
<center>
<table border="1">
<tr><td align="center">&lt;dimensioned type&#62;</td><td align="center">&lt;real type&#62; &lt;dimension &#62;['*' &lt;dimension&#62;]*</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;real type&#62;</td><td align="center">'real'</td></tr>
<tr><td align="center"></td><td align="center">'double'</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;dimension&#62;</td><td align="center">&lt;identifier&#62; ['POW' [&lt;sign&#62;] &lt;unsigned integer&#62;]</td></tr></table>
<p>
</center>The identifier<a name="identifier23">
</a> must be a member of a scalar type, and that
scalar type is then referred to as the basis space of the dimensioned type.
The identifiers of the basis<a name="basis23">
</a> space are referred to as the dimensions
of the dimensioned type<a name="type23">
</a>. Associated with each dimension of a dimensioned
type there is an integer number referred to as the power of that dimension.
This is either introduced explicitly at type declaration time, or determined
implicitly for the dimensional type of expressions.
<p>
A value of a dimensioned type is a dimensioned value. Let log<sub>d</sub>t
of a dimensioned type t be the power to which the dimension d
of type t is raised. Thus for t = newton in the example above, and
d = time, log<sub>d</sub>t=<font face="symbol">-</font
>2
<p>
If x and y are values of dimensioned<a name="dimensioned23">
</a> types
t<sub>x</sub> and t<sub>y</sub> respectively, then the following operators are only
permissible if t<sub>x</sub>=t<sub>y</sub>
<p>
<center>
<table border="1">
<tr><td align="center">+</td><td align="center">-</td><td align="center">&lt;</td><td align="center">&#62;</td><td align="center">&lt;&#62;</td><td align="center">=</td><td align="center">&lt;=</td><td align="center">&#62;=</td></tr></table>
<p>
</center>For + and -, the dimensional<a name="dimensional23">
</a> type of the result is the same
as that of the arguments. The operations
<p>
<center>
<table border="1">
<tr><td align="center">*</td><td align="center">/</td></tr></table>
<p>
</center>are permitted if the types t<sub>x</sub> and t<sub>y</sub> share the same basis
space, or if the basis space of one of the types is a subrange of the basis
space of the other.
<p>
The operation <tt>POW</tt> is permitted between dimensioned types and integers.
<p>
<b>*&nbsp;&nbsp;</b>Dimension deduction rules
<p>
<ol type="1"><p>
<li> If x=y*z for x:t<sub>1</sub>,y:t<sub>2</sub>,z:t<sub>3</sub> with basis space B
then
<p>
<br clear="all" /><table border="0" width="95%"><tr><td>
<table align="center"><tr><td nowrap="nowrap" align="center">
<font face="symbol">"</font
><sub> d <font face="symbol">Î</font
> B </sub> log<sub>d</sub>t<sub>1</sub> = log<sub>d</sub>t<sub>2</sub>+log<sub>d</sub>t<sub>3</sub> </td></tr></table>
</td></tr></table>
</li>
<p>
<li> If x=y/z for x:t<sub>1</sub>,y:t<sub>2</sub>,z:t<sub>3</sub> with basis space B
then
<p>
<br clear="all" /><table border="0" width="95%"><tr><td>
<table align="center"><tr><td nowrap="nowrap" align="center">
<font face="symbol">"</font
><sub>d <font face="symbol">Î</font
> B</sub>log<sub>d</sub>t<sub>1</sub>=log<sub>d</sub>t<sub>2</sub><font face="symbol">-</font
>log<sub>d</sub>t<sub>3</sub> </td></tr></table>
</td></tr></table>
</li>
<p>
<li> If x=y <tt>POW</tt> z for x:t<sub>1</sub>,y:t<sub>2</sub>,z:integer with
basis space for t<sub>2</sub> , B then
<p>
<br clear="all" /><table border="0" width="95%"><tr><td>
<table align="center"><tr><td nowrap="nowrap" align="center">
<font face="symbol">"</font
><sub>d <font face="symbol">Î</font
> B</sub>log<sub>d</sub>t<sub>1</sub>=log<sub>d</sub>t<sub>2</sub>&times;z </td></tr></table>
</td></tr></table>
.</li>
</ol>
<p>
<h3><a name="tth_sEc2.3.2">
2.3.2</a>&nbsp;&nbsp;Structured types</h3>
<p>
<h4>Static Array<a name="array23">
</a><a name="array, static23">
</a> types</h4>
<p>
An array type is a structure consisting of a fixed number of elements all of
which are the same type. The type of the elements is referred to as the element
type. The elements of an array value are indicated by bracketed indexing expressions.
The definition of an array<a name="array23">
</a> type<a name="type23">
</a> simultaneously defines
the permitted type of indexing expression and the element type.
<p>
The index<a name="index23">
</a> type<a name="type23">
</a> of a static<a name="static23">
</a> array<a name="array, static23">
</a>
must be a scalar<a name="scalar23">
</a> or subrange<a name="subrange23">
</a> type. This implies
that the bounds of a static array are known at compile time.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;array type&#62;</td><td align="center">'array' '[' &lt;index type&#62;[,&lt;index type&#62;]* ']' 'of' &lt;type&#62;</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;index type&#62;</td><td align="center">&lt;subrange type&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;scalar type&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;integral type&#62;</td></tr></table>
<p>
</center>Examples
<p>
<tt>array[colour] of boolean;</tt>
<p>
<tt>array[1..100] of integer;</tt>
<p>
<tt>array[1..2,4..6] of byte;</tt>
<p>
<tt>array[1..2] of array[4..6] of byte;</tt>
<p>
The notation [<em>b,c</em>] in an array declaration is shorthand for the notation
[<em>b</em>] <tt>of array</tt> [ <em>c</em> ]. The number of dimensions of an
array type is referred to as its rank. Scalar types have rank 0.
<p>
<h4>String types</h4>
<p>
A string<a name="string23">
</a> type denotes the set of all sequences of characters
up to some finite length and must have the syntactic form:
<p>
<center>
<table border="1">
<tr><td align="center">&lt;string-type&#62;</td><td align="center">'string[' &lt;integer constant&#62;']'</td></tr>
<tr><td align="center"></td><td align="center">'string'</td></tr>
<tr><td align="center"></td><td align="center">'string(' &lt;ingeger constant&#62;')'</td></tr></table>
<p>
</center>the integer constant indicates the maximum number of characters that may be
held in the string type. The maximum number of characters that can be held in
any string is indicated by the pre-declared constant <tt>maxstring</tt>. The
type <tt>string</tt> is shorthand for <tt>string[maxstring]</tt>.
<p>
<h4>Record types</h4>
<p>
A record type defines a set of similar data structures. Each member of this
set, a record instance, is a Cartesian product of number of components or <em>fields</em>
specified in the record<a name="record23">
</a> type definition. Each field has an identifier
and a type. The scope of these identifiers is the record itself.
<p>
A record type may have as a final component a <em>variant<a name="variant23">
</a>
part</em>. The variant part, if a variant part exists, is a union of several variants,
each of which may itself be a Cartesian product of a set of fields. If a variant
part exists there may be a tag field whose value indicates which variant is
assumed by the record instance.
<p>
All field identifiers even if they occur within different variant parts, must
be unique within the record type.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;record type&#62;</td><td align="center">'record' &lt;field list&#62; 'end'</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;field list&#62;</td><td align="center">&lt;fixed part&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;fixed part&#62;';' &lt;variant part&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;variant part&#62;</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;fixed part&#62;</td><td align="center">&lt;record section&#62; [ ';' &lt;record section.]*</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;record section&#62;</td><td align="center">&lt;identifier&#62;[',' &lt;identifier&#62;]* ':' &lt;type&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;empty&#62;</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;variant part&#62;</td><td align="center">'case' [&lt;tag field&#62; ':'] &lt;type identifier&#62; 'of'&lt;variant&#62;[';' &lt;variant&#62;]*</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;variant&#62;</td><td align="center">&lt;constant&#62; [',' &lt;constant&#62;]*':' '(' &lt;field list&#62; ')'</td></tr>
<tr><td align="center"></td><td align="center">&lt;empty&#62;</td></tr></table>
<p>
</center>
<h4>Set types</h4>
<p>
A set<a name="set23">
</a> type defines the range of values which is the power-set of
its base type. The base type must be an ordered type, that is a type on which the
operations &lt; , = and &gt; are defined<a href="#tthFtNtAAE" name="tthFrefAAE"><sup>4</sup></a>.
Thus sets may be declared whose base types are characters, numbers, ordinals, or strings. Any user
defined type on which the comparison operators have been defined can also be the base type
of a set.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;set type&#62;</td><td align="center">'set' 'of' &lt;base type&#62;</td></tr></table>
<p>
</center> <h3><a name="tth_sEc2.3.3">
2.3.3</a>&nbsp;&nbsp;Dynamic<a name="Dynamic23">
</a> types</h3>
<p>
Variables declared within the program are accessed by their identifier. These
variables exist throughout the existence of the scope within which they are
declared, be this unit, program or procedure. These variables are assigned storage
locations whose addresses, either absolute or relative to some register, can
be determined at compile time. Such locations a referred to as static<a name="static23">
</a><a href="#tthFtNtAAF" name="tthFrefAAF"><sup>5</sup></a>. Storage locations may also be allocated dynamically. Given a type <tt>t</tt>,
the type of a pointer<a name="pointer23">
</a> to an instance of type <tt>t</tt> is <tt>t</tt>.
<p>
A pointer of type <tt>t</tt> can be initialised to point to
a new store location of type t by use of the built in procedure <tt>new</tt>.
Thus if <tt>p:t</tt>,
<p>
<tt>new(p);</tt>
<p>
causes <tt>p</tt> to point at a store location of type <tt>t</tt>.
<p>
<h4>Pointers to dynamic<a name="dynamic23">
</a><a name="dynamic array23">
</a> arrays<a name="array, dynamic23">
</a><a name="array23">
</a></h4>
<p>
The types pointed to by pointer types can be any of the types mentioned so far,
that is to say, any of the types allowed for static<a name="static23">
</a> variables.
In addition however, pointer types can be declared to point at dynamic arrays.
A dynamic array is an array whose bounds are determined at run time.
<p>
Pascal<a name="Pascal9023">
</a> 90[<a href="#ISO90" name="CITEISO90">15</a>] introduced the notion of schematic or
parameterised types as a means of creating dynamic arrays. Thus where <tt>r</tt>
is some integral or ordinal type one can write
<p>
<tt>type z(a,b:r)=array[a..b] of t;</tt>
<p>
If <tt>p:z</tt>, then
<p>
<tt>new(p,n,m)</tt>
<p>
where <tt>n,m:r</tt> initialises <tt>p</tt> to point to an array of bounds <tt>n..m</tt>.
The bounds of the array can then be accessed as <tt>p.a,
p.b</tt>. In this case <tt>a, b</tt> are the formal parameters of
the array type. Vector Pascal currently only allows
parameterised types to be allocated on the heap via <tt>new</tt>. The extended form of the procedure <tt>new </tt> must be passed an actual
parameter for each formal parameter in the array type.
<p>
<h4>Dynamic arrays<a name="dynamic array23">
</a></h4>
Vector Pascal also allows the use of Delphi style declarations for dynamic arrays. Thus one
can declare:
<pre>
type vector = array of real;
matrix = array of array of real;
</pre>
The size of such arrays has to be explicitly initialised at runtime by a call to the
library procedure <tt>setlength</tt>.
Thus one might have:
<pre>
function readtotal:real;
var len:integer;
v:vector;
begin
readln(len);
setlength(v,len);
readln(v);
readtotal := \+ v;
end;
</pre>
The function <tt>readtotal</tt> reads the number of elements in a vector from
the standard input. It then calls <tt>setlength</tt> to initialise the vector length.
Next it reads in the vector and computes its total using the reduction operator <tt> \+</tt>.
<p>
In the example, the variable <tt>v</tt> denotes an array of reals not a pointer
to an array of reals. However, since the array size is not known at compile time
<tt>setlength</tt> will allocate space for the array on the heap not in the local stack
frame. The use of <tt>setlength</tt> is thus restricted to programs which have been
compiled with the garbage collection flag enabled (see section <a href="#BOEHM">5.1.2</a>).
The procedure <tt>setlength </tt> must be passed a parameter for each dimension of
the dynamic array. The bounds of the array <tt>a</tt> formed by <tt><br />setlength(a,i,j,k)<br /></tt>
would then be <tt>0..i-1, 0..j-1, 0..k-1</tt>.
<p>
<h4>Low <a name="low23">
</a> and High <a name="high23">
</a></h4>
The build in functions <tt>low </tt> and <tt>high</tt> return the lower and upper bounds
of an array respectively. They work with both static and dynamic arrays.
Consider the following examples.
<pre>
program arrays;
type z(a,b:integer)=array[a..b] of real;
vec = array of real;
line= array [1..80] of char;
matrix = array of array of real;
var i:^z; v:vec; l:line; m:matrix;
begin
setlength(v,10);setlength(m,5,4);
new(i,11,13);
writeln(low(v), high(v));
writeln(low(m), high(m));
writeln(low(m[0]),high(m[0]));
writeln(low(l),high(l));
writeln(low(i^),high(i^));
end.
</pre>
would print
<pre>
0 9
0 4
0 3
1 80
11 13
</pre>
<h2><a name="tth_sEc2.4">
2.4</a>&nbsp;&nbsp;File types</h2>
<p>
A type may be declared to be a file of a type. This form of definition is kept
only for backward compatibility. All file types are treated as being equivalent.
A file type corresponds to a handle to an operating system file. A file variable
must be associated with the operating system file by using the procedures <tt>assign,
rewrite, append</tt>, and <tt>reset</tt> provided by the system unit. A pre-declared
file type <tt>text</tt> exists.
<p>
Text files are assumed to be in Unicode UTF-8 format. Conversions are performed between
the internal representation of characters and UTF-8 on input/output from/to a text file.
<p>
<h2><a name="tth_sEc2.5">
2.5</a>&nbsp;&nbsp;Variables<a name="Variables25">
</a></h2>
<p>
Variable declarations consist of a list of identifiers denoting the new variables,
followed by their types.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;variable declaration&#62;</td><td align="center">&lt;identifier&#62; [',' &lt;identifier&#62;]* ':' &lt;type&#62;&lt;extmod&#62;</td></tr></table>
<p>
</center>Variables are abstractions over values. They can be either simple identifiers,
components or ranges of components of arrays, fields of records or referenced
dynamic variables.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;variable&#62;</td><td align="center">&lt;identifier&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;indexed variable&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;indexed range&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;field designator&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;referenced variable&#62;</td></tr></table>
<p>
</center>Examples
<p>
<tt>x,y:real;</tt>
<p>
<tt>i:integer;</tt>
<p>
<tt>point:real;</tt>
<p>
<tt>dataset:array[1..n]of integer;</tt>
<p>
<tt>twoDdata:array[1..n,4..7] of real;</tt>
<p>
<h3><a name="tth_sEc2.5.1">
2.5.1</a>&nbsp;&nbsp;External Variables</h3>
<p>
A variable may be declared to be external by appending the external modifier.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;extmod&#62;</td><td align="center">';' 'external' 'name' &lt;stringlit&#62;</td></tr></table>
<p>
</center>This indicates that the variable is declared in a non Vector Pascal external
library. The name by which the variable is known in the external library is
specified in a string literal.
<p>
Example
<p>
<tt>count:integer; external name '_count';</tt>
<p>
<h3><a name="tth_sEc2.5.2">
2.5.2</a>&nbsp;&nbsp;Entire Variables</h3><a name="entire">
</a>
<p>
An entire variable is denoted by its identifier. Examples <tt>x,y,point</tt>,
<p>
<h3><a name="tth_sEc2.5.3">
2.5.3</a>&nbsp;&nbsp;Indexed Variables</h3>
<p>
A component of an <em>n</em> dimensional array variable is denoted by the variable
followed by <em>n</em> index expressions in brackets.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;indexed variable&#62;</td><td align="center">&lt;variable&#62;'[' &lt;expression&#62;[','&lt;expression&#62;]* ']'</td></tr></table>
<p>
</center>The type of the indexing expression must conform to the index type of the array
variable. The type of the indexed variable is the component type of the array.
<p>
Examples
<p>
<tt>twoDdata[2,6]</tt>
<p>
<tt>dataset[i]</tt>
<p>
Given the declaration
<p>
<tt>a=array[p] of q</tt>
<p>
then the elements of arrays of type <tt>a</tt>, will have type <tt>q</tt> and
will be identified by indices<a name="indices25">
</a> of type <tt>p</tt> thus:
<p>
<tt>b[i]</tt>
<p>
where <tt>i:p</tt>, <tt>b:a</tt>.
<p>
Given the declaration
<p>
<tt>z = string[x]</tt>
<p>
for some integer x <tt> <font face="symbol">£</font
> maxstring</tt>, then the characters within
strings<a name="strings25">
</a> of type <tt>z</tt> will be identified by indices in
the range <tt>1..x,</tt> thus:
<p>
<tt>y[j]</tt>
<p>
where <tt>y:z</tt>, <tt>j:1..x</tt>.
<p>
<h4>Indexed Ranges</h4>
<p>
A range of components of an array variable are denoted by the variable followed
by a range expression in brackets.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;indexed range&#62;</td><td align="center">&lt;variable&#62; '[' &lt;range expression&#62;[',' &lt;range expression&#62;]* ']'</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;range expression&#62;</td><td align="center">&lt;expression&#62; '..' &lt;expression&#62;</td></tr></table>
<p>
</center>The expressions within the range<a name="range25">
</a> expression must conform to the
index type of the array variable. The type of a range expression <tt>a[i..j]</tt>
where <tt>a: array[p..q] of t</tt> is <tt>array[0..j-i] of t.</tt>
<p>
Examples:
<p>
<tt>dataset[i..i+2]:=blank;</tt>
<p>
<tt>twoDdata[2..3,5..6]:=twoDdata[4..5,11..12]*0.5;</tt>
<p>
Subranges<a name="Subranges25">
</a> may be passed in as actual parameters to procedures
whose corresponding formal parameters<a name="parameters25">
</a> are declared as variables
of a schematic<a name="schematic25">
</a> type. Hence given the following declarations:
<p>
<tt>type image(miny,maxy,minx,maxx:integer)=array[miny..maxy,minx..maxx]
of byte;</tt>
<p>
<tt>procedure invert(var im:image);begin im:=255-im; end;</tt>
<p>
<tt>var screen:array[0..319,0..199] of byte;</tt>
<p>
then the following statement would be valid:
<p>
<tt>invert(screen[40..60,20..30]);</tt>
<p>
<h4>Indexing arrays with arrays</h4>
<p>
If an array<a name="array25">
</a> variable occurs on the right hand side of an assignment
statement, there is a further form of indexing possible. An array may be indexed
by another array. If <tt>x:array[t0] of t1</tt> and <tt>y:array[t1]
of t2</tt>, then <tt>y[x]</tt> denotes the virtual array of type <tt>array[t0]
of t2</tt> such that <tt>y[x][i]=y[x[i]]</tt>. This construct is
useful for performing permutations. To fully understand the following example
refer to sections <a href="#iota">3.1.3</a>,<a href="#manimplicitindices">3.2.1</a>.
<p>
<b>Example&nbsp;&nbsp;</b>
<p>
Given the declarations
<p>
<tt>const perms:array[0..3] of integer=(3,1,2,0);</tt>
<p>
<tt>var ma,m0:array[0..3] of integer; </tt>
<p>
then the statements
<p>
<tt>m0:= (iota 0)+1;</tt>
<p>
<tt>write('m0=');for j:=0 to 3 do write(m0[j]);writeln;</tt>
<p>
<tt>ma:=m0[perms]; </tt>
<p>
<tt>write('perms=');for j:=0 to 3 do write(perms[j]);writeln; </tt>
<p>
<tt>writeln('ma:=m0[perms]');for j:=0 to 3 do write(ma[j]);writeln;</tt>
<p>
would produce the output
<p>
<dl compact="compact">
<dt><b></b></dt>
<dd>
m0=&nbsp;1&nbsp;2&nbsp;3&nbsp;4
<p>
perms=&nbsp;&nbsp;3&nbsp;1&nbsp;2&nbsp;0&nbsp;
<p>
ma:=m0[perms]&nbsp;
<p>
4&nbsp;2&nbsp;3&nbsp;1
</dd>
</dl>
<p>
This basic method can also be applied to multi-dimensional array. Consider the
following example of an image warp:
<pre>
type pos = 0..255;
image = array[pos,pos] of pixel;
warper = array[pos,pos,0..1] of pos;
var im1 ,im2 :image;
warp :warper;
begin
....
getbackwardswarp(warp);
im2 := im1 [ warp ];
....
</pre>
The procedure <tt>getbackwardswarp </tt> determines for each pixel position <tt>x, y</tt> in an
image the position in the source image from which it is to be obtained.
After the assignment we have the postcondition
<br clear="all" /><table border="0" width="100%"><tr><td>
<table align="center"><tr><td nowrap="nowrap" align="center">
<tt>im</tt><tt>2</tt><tt>[</tt><tt>x</tt><tt>,</tt><tt>y</tt><tt>]</tt> = <tt>im</tt><tt>1</tt><tt>[</tt><tt>warp</tt><tt>[</tt><tt>x</tt><tt>,</tt><tt>y</tt><tt>,</tt><tt>0</tt><tt>]</tt><tt>,</tt><tt>warp</tt><tt>[</tt><tt>x</tt><tt>,</tt><tt>y</tt><tt>,</tt><tt>1</tt><tt>]</tt><tt>]</tt> <font face="symbol">"</font
> <tt>x</tt><tt>,</tt><tt>y</tt> <font face="symbol">Î</font
> <tt>pos</tt></td></tr></table>
</td></tr></table>
<h3><a name="tth_sEc2.5.4">
2.5.4</a>&nbsp;&nbsp;Field<a name="Field25">
</a> Designators</h3>
<p>
A component of an instance of a record type, or the parameters of an instance
of a schematic type are denoted by the record or schematic type instance followed
by the field or parameter name.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;field designator&#62;</td><td align="center">&lt;variable&#62;'.'&lt;identifier&#62;</td></tr></table>
<p>
</center> <h3><a name="tth_sEc2.5.5">
2.5.5</a>&nbsp;&nbsp;Referenced Variables<a name="Variables25">
</a></h3>
<p>
If <tt>p:t</tt>, then <tt>p</tt> denotes
the dynamic variable of type <tt>t</tt> referenced by <tt>p</tt>.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;referenced variable&#62;</td><td align="center">&lt;variable&#62; ''</td></tr></table>
<p>
</center> <h2><a name="tth_sEc2.6">
2.6</a>&nbsp;&nbsp;Procedures and Functions</h2>
<p>
Procedure and function declarations allow algorithms to be identified by name
and have arguments associated with them so that they may be invoked by procedure
statements or function calls.
<p>
<table border="1">
<tr><td>&lt;procedure declaration&#62;</td><td>&lt;procedure heading&#62;';'[&lt;proc tail&#62;]</td></tr><tr><td>
<tr><td>&lt;proc tail&#62;</td><td>'forward' </td></tr>
<tr><td></td><td>'external' [ 'name' &lt;string&#62;]</td></tr>
<tr><td></td><td>&lt;block&#62;</td></tr>
<tr><td>&lt;paramlist&#62;</td><td>'('&lt;formal parameter sec&#62;[';'&lt;formal parameter sec&#62;]*')'</td></tr>
<tr><td>&lt;procedure heading&#62; </td><td>'procedure' &lt;identifier&#62; [&lt;paramlist&#62;]</td></tr>
<tr><td></td><td>'function'&lt;identifier&#62; [&lt;paramlist&#62;]':'&lt;type&#62;</td></tr><tr><td>
<tr><td>&lt;formal parameter sec&#62;</td><td>['var']&lt;identifier&#62;[','&lt;identifier&#62;]':'&lt;type&#62;
</td><td>&lt;procedure heading&#62;
</tr><tr><td>
&lt;procedure type&#62;</td><td>'procedure' [&lt;paramlist&#62;]
</td><td>'function' [&lt;paramlist&#62;]':'&lt;type&#62;
</td></tr></table>
<p>
The parameters declared in the procedure heading are local to the scope of the
procedure. The parameters in the procedure heading are termed formal<a name="formal parameter26">
</a>
parameters. If the identifiers in a formal parameter section are preceded by
the word <tt>var</tt>, then the formal parameters are termed variable parameters.
The block<a href="#tthFtNtAAG" name="tthFrefAAG"><sup>6</sup></a> of a procedure or function constitutes a scope local to its executable compound
statement. Within a function declaration there must be at least one statement
assigning a value to the function identifier. This assignment determines the
result of a function, but assignment to this identifier does not cause an immediate
return from the function.
<p>
Function return values can be scalars, pointers, records, strings, static arrays or sets. Arrays whose size is determined at run time
may not be returned from a function.
<p>
Where a procedure is declared as forward it
must be followed by a full definition of procedure lower in the current scope.
<p>
The external declaration form allows calls to be made to libraries written in other languages.
<p>
<b>Examples&nbsp;&nbsp;</b>
<p>
The function sba is the mirror image of the abs function.
<p>
<tt>function sba(i:integer):integer; </tt>
<p>
<tt>begin if i&#62;o then sba:=-i else sba:=i end;</tt>
<p>
<tt>type stack:array[0..100] of integer;</tt>
<p>
<tt>procedure push(var s:stack;i:integer);</tt>
<p>
<tt>begin s[s[0]]:=i;s[0]:=s[0]+1; end;</tt>
<p>
<pre>
procedure append(var f:fileptr);external;
procedure close (var f:fileptr); external name 'pasclose';
</pre>
<p>
<h3><a name="tth_sEc2.6.1">
2.6.1</a>&nbsp;&nbsp;Procedural Parameters to Procedures</h3>
<p>
<dl compact="compact">
<dt><b></b></dt>
<dd>
<p>
</dd>
</dl>A procedure may have parameters that are themselves procedures as
shown in the following example.
<p>
<dl compact="compact">
<dt><b></b></dt>
<dd>
<p>
program&nbsp;CONF103(output);
<p>
var
<p>
&nbsp;&nbsp;&nbsp;i&nbsp;:&nbsp;integer;
<p>
procedure&nbsp;alsoconforms(x&nbsp;:&nbsp;integer);
<p>
begin
<p>
&nbsp;&nbsp;writeln('&nbsp;PASS...6.6.3.1-4&nbsp;(CONF103)')
<p>
end;
<p>
procedure&nbsp;conforms(procedure&nbsp;alsoconforms(x&nbsp;:&nbsp;integer));
<p>
&nbsp;&nbsp;&nbsp;var&nbsp;x&nbsp;:&nbsp;boolean;
<p>
begin&nbsp;
<p>
&nbsp;&nbsp;&nbsp;x:=true;
<p>
&nbsp;&nbsp;&nbsp;alsoconforms(1)
<p>
end;
<p>
begin
<p>
&nbsp;&nbsp;&nbsp;i:=2;
<p>
&nbsp;&nbsp;&nbsp;conforms(alsoconforms)
<p>
end.
<p>
</dd>
</dl> <h3><a name="tth_sEc2.6.2">
2.6.2</a>&nbsp;&nbsp;Procedure types</h3>
<p>
Procedural types may be declared. This in turn allows procedure variables.
These store the address of a procedure or function and can be assigned
to using the address operator @.
<p>
<b>Example&nbsp;&nbsp;</b>
<p>
<dl compact="compact">
<dt><b></b></dt>
<dd>
program&nbsp;procvar;
<p>
type&nbsp;t=procedure&nbsp;(x:integer);
<p>
var&nbsp;v:t;
<p>
&nbsp;&nbsp;&nbsp;&nbsp;procedure&nbsp;f(a:integer);begin&nbsp;writeln(a);end;
<p>
begin
<p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v:=&nbsp;@f;
<p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v(3);
<p>
end.
<p>
</dd>
</dl> <h1><a name="tth_chAp3">
Chapter 3 </a><br />Algorithms</h1>
<p>
<h2><a name="tth_sEc3.1">
3.1</a>&nbsp;&nbsp;Expressions<a name="Expressions31">
</a></h2>
<p>
An expression is a rule for computing a value by the application of operators
and functions to other values. These operators can be <em>monadic</em> - taking
a single argument, or <em>dyadic</em> - taking two arguments.
<p>
<h3><a name="tth_sEc3.1.1">
3.1.1</a>&nbsp;&nbsp;Mixed type expressions</h3>
<p>
The arithmetic operators are defined over the base types integer and real. If
a dyadic operator that can take either real<a name="real31">
</a> or integer<a name="integer31">
</a>
arguments is applied to arguments one of which is an integer and the other a
real, the integer argument is first implicitly converted to a real before the
operator is applied. Similarly, if a dyadic operator is applied to two integral
numbers of different precision, the number of lower precision is initially converted
to the higher precisions, and the result is of the higher precision. Higher
precision of types <em>t,u</em> is defined such that the type with the greater
precision is the one which can represent the largest range of numbers. Hence
reals<a name="reals31">
</a> are taken to be higher precision than longints even though
the number of significant bits in a real may be less than in a longint.
<p>
When performing mixed type arithmetic between pixels and another numeric data
type, the values of both types are converted to reals before the arithmetic
is performed. If the result of such a mixed type expression is subsequently
assigned to a pixel<a name="pixel31">
</a> variable, all values greater than 1.0 are
mapped to 1.0 and all values below -1.0 are mapped to -1.0.
<p>
<h3><a name="tth_sEc3.1.2">
3.1.2</a>&nbsp;&nbsp;Primary expressions</h3>
<p>
<center>
<table border="1">
<tr><td align="center">&lt;primary expression&#62; </td><td align="center">'(' &lt;expression&#62; ')'</td></tr>
<tr><td align="center"></td><td align="center">&lt;literal string&#62;</td></tr>
<tr><td align="center"></td><td align="center">'true'</td></tr>
<tr><td align="center"></td><td align="center">'false'</td></tr>
<tr><td align="center"></td><td align="center">&lt;unsigned integer&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;unsigned real&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;variable&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;constant id&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;function call&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;set construction&#62;</td></tr></table>
<p>
</center>The most primitive expressions are instances of the literals defined in the
language: literal strings, boolean literals, literal reals and literal integers.
'Salerno', <tt>true</tt>, 12, $ea8f, 1.2e9 are all primary expressions. The
next level of abstraction is provided by symbolic identifiers for values. <tt>X</tt>,
<tt>left</tt>, <tt>a.max</tt>, <tt>p.next</tt>, <tt>z[1]</tt>,
<tt>image[4..200,100..150]</tt> are all primary expressions provided that
the identifiers have been declared as variables or constants.
<p>
An expression surrounded by brackets <tt>( )</tt> is also a primary expression.
Thus if <em>e</em> is an expression so is <tt>(</tt> <em>e</em> <tt>)</tt>.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;function call&#62;</td><td align="center">&lt;function id&#62; [ '(' &lt;expression&#62; [,&lt;expression&#62;]* ')' ]</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;element&#62;</td><td align="center">&lt;expression&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;range expression&#62;</td></tr></table>
<p>
</center>Let <em>e</em> be an expression of type t<sub>1</sub> and if <tt>f</tt> is an identifier
of type <tt>function<a name="function31">
</a>( t<sub>1</sub> ): t<sub>2</sub> </tt>, then
<tt>f(</tt> <em>e</em> <tt>)</tt> is a primary expression of type t<sub>2</sub> .
A function which takes no parameters is invoked without following its identifier
by brackets. It will be an error if any of the actual parameters supplied to
a function are incompatible with the formal parameters declared for the function.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;set construction&#62;</td><td align="center">'[' [&lt;element&#62;[,&lt;element&#62;]*] ']'</td></tr></table>
<p>
</center>Finally a primary expression may be a set construction. A set construction is
written as a sequence of zero or more elements enclosed in brackets <tt>[
]</tt> and separated by commas. The elements themselves are either expressions
evaluating to single values or range expressions denoting a sequence of consecutive
values. The type of a set construction is deduced by the compiler from the context
in which it occurs. A set construction occurring on the right hand side of an
assignment inherits the type of the variable to which it is being assigned.
The following are all valid set constructions:
<p>
<tt>[], [1..9], [z..j,9], [a,b,c,]</tt>
<p>
<tt>[]</tt> denotes the empty set.
<p>
<h3><a name="tth_sEc3.1.3">
3.1.3</a>&nbsp;&nbsp;Unary expressions</h3>
<p>
A unary expression is formed by applying a unary operator to another unary or
primary expression. The unary operators supported are <tt>+, -, *, /,
div<a name="div31">
</a>, mod<a name="mod31">
</a>, and<a name="and31">
</a>, or<a name="or31">
</a>, not<a name="not31">
</a>,
round<a name="round31">
</a>, sqrt<a name="sqrt31">
</a>, sin<a name="sin31">
</a>, cos<a name="cos31">
</a>, tan<a name="tan31">
</a>,
abs<a name="abs31">
</a>, ln<a name="ln31">
</a>, ord<a name="ord31">
</a>, chr<a name="chr31">
</a>, byte2pixel<a name="pixel31">
</a>,
pixel2byte<a name="byte31">
</a>, succ<a name="succ31">
</a>, pred<a name="pred31">
</a>, iota<a name="iota31">
</a>,
trans<a name="trans31">
</a>, addr<a name="addr31">
</a></tt> and <tt>@</tt><a name="31">
</a>.
<p>
Thus the following are valid unary expressions<tt>: -1</tt>, <tt>+b, not true</tt>, <tt>sqrt
abs x</tt>, <tt>sin theta.</tt><a name="primfns">
</a> In standard Pascal some of these operators are treated as
functions,. Syntactically this means that their arguments must be enclosed in
brackets, as in <tt>sin(theta)</tt>. This usage remains syntactically correct
in Vector Pascal.
<p>
The dyadic operators <tt>+, -, *, /, div, mod , and or</tt> are all extended
to unary context by the insertion of an implicit value under the operation.
Thus just as <tt>-a = 0-a</tt> so too <tt>/2 = 1/2</tt>. For sets the notation
<tt>-s</tt> means the complement of the set <tt>s</tt>. The implicit value inserted
are given below.
<p>
<center>
<table border="1">
<tr><td align="center">type</td><td align="center">operator<tt>s</tt></td><td align="center"><tt>implicit value</tt></td></tr><tr><td>
<tr><td align="center"><tt>number</tt></td><td align="center"><tt>+,-</tt></td><td align="center">0</td></tr>
<tr><td align="center">string</td><td align="center"><tt>+</tt></td><td align="center">''</td></tr>
<tr><td align="center">set<a name="set31">
</a></td><td align="center"><tt>+</tt></td><td align="center">empty set</td></tr>
<tr><td align="center">number</td><td align="center"><tt>*,/ ,div,mod</tt></td><td align="center">1</td></tr>
<tr><td align="center">number</td><td align="center"><tt>max</tt></td><td align="center">lowest representable number of the type</td></tr>
<tr><td align="center">number</td><td align="center"><tt>min</tt></td><td align="center">highest representable number of the type</td></tr>
<tr><td align="center">boolean<a name="boolean31">
</a></td><td align="center"><tt>and</tt></td><td align="center">true</td></tr>
<tr><td align="center">boolean</td><td align="center"><tt>or</tt> </td><td align="center">false</td></tr></table>
<p>
</center>A unary operator can be applied to an array<a name="array31">
</a> argument and returns
an array result. Similarly any user declared function over a scalar<a name="scalar31">
</a>
type can be applied to an array type and return an array. If <tt>f</tt> is a
function or unary operator mapping from type <tt>r</tt> to type <tt>t</tt> then
if <tt>x</tt> is an array of <tt>r,</tt> and <tt>a</tt> an array of <tt>t</tt>,
then <tt>a:=f(x)</tt> assigns an array of <tt>t</tt> such that <tt>a[i]=f(x[i])</tt>
<p>
<p>
<a name="tth_tAb3.1">
</a> <center>Table 3.1: Unary operators</center><a name="tab:unops">
</a>
<center>
<table border="1">
<tr><td align="center"><font size="-1">lhs </font></td><td align="center"><font size="-1">rhs</font></td><td><font size="-1">meaning</font></td></tr>
<tr><td align="center"><font size="-1">&lt;unaryop&#62;</font></td><td align="center"><font size="-1">'+'</font></td><td><font size="-1">+x = 0+x identity operator</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'-'</font></td><td><font size="-1">-x = 0-x, </font></td></tr>
<tr><td align="center"></td><td align="center"></td><td><font size="-1">note: this is defined on integer, real and complex</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'*', '&times;'</font></td><td><font size="-1">*x=1*x identity operator</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'/'</font></td><td><font size="-1">/x=1.0/x </font></td></tr>
<tr><td align="center"></td><td align="center"></td><td><font size="-1">note: this is defined on integer, real and complex</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'div', '<font face="symbol">¸</font
>'</font></td><td><font size="-1">div x =1 div x</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'mod'</font></td><td><font size="-1">mod x = 1 mod x</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'and'</font></td><td><font size="-1">and x = true and x</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'or'</font></td><td><font size="-1">or x = false or x</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'not', '<font face="symbol">Ø</font
>'</font></td><td><font size="-1">complements booleans</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'round'</font></td><td><font size="-1">rounds a real to the closest integer</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'sqrt', '<font face="symbol">Ö</font>{} '</font> </td><td><font size="-1">returns square root as a real<a name="real31">
</a> number.</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'sin'</font></td><td><font size="-1">sine of its argument. Argument in radians. Result is real.</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'cos'</font></td><td><font size="-1">cosine of its argument. Argument in radians. Result is real.</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'tan'</font></td><td><font size="-1">tangent of its argument. Argument in radians. Result is real.</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'abs'</font></td><td><font size="-1">if x&lt;0 then abs x = -x else abs x= x</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'ln'</font></td><td><font size="-1"> log<sub>e</sub> of its argument. Result is real.</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'ord'</font></td><td><font size="-1">argument scalar type, returns ordinal </font></td></tr>
<tr><td align="center"></td><td align="center"></td><td><font size="-1">number of the argument.</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'chr'</font></td><td><font size="-1">converts an integer<a name="integer31">
</a> into a character<a name="character31">
</a>.</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'succ'</font></td><td><font size="-1">argument scalar type,</font></td></tr>
<tr><td align="center"></td><td align="center"></td><td><font size="-1">returns the next scalar in the type.</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'pred'</font></td><td><font size="-1">argument scalar type, </font></td></tr>
<tr><td align="center"></td><td align="center"></td><td><font size="-1">returns the previous scalar in the type.</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'iota', '<font face="symbol">i</font
>'</font></td><td><font size="-1">iota i returns the ith current index<a name="index31">
</a></font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'trans'</font></td><td><font size="-1">transposes a matrix<a name="matrix31">
</a> or vector<a name="vector31">
</a></font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'pixel2byte'</font></td><td><font size="-1">convert pixel in range -1.0..1.0 to byte in range 0..255</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'byte2pixel'</font></td><td><font size="-1">convert a byte in range 0..255 to a pixel in</font></td></tr>
<tr><td align="center"></td><td align="center"></td><td><font size="-1">the range -1.0..1.0</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'@','addr'</font></td><td><font size="-1">Given a variable, this returns an</font> </td></tr>
<tr><td align="center"></td><td align="center"></td><td><font size="-1">untyped pointer<a name="pointer31">
</a> to the variable.</font></td></tr></table>
<font size="-1">
<p>
</font></center>
<p>
<center>
<table border="1">
<tr><td align="center">&lt;unary expression&#62;</td><td align="center">&lt;unaryop&#62; &lt;unary expression&#62;</td></tr>
<tr><td align="center"></td><td align="center">'sizeof' '(' &lt;type&#62; ')'</td></tr>
<tr><td align="center"></td><td align="center">&lt;operator reduction&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;primary expression&#62;</td></tr>
<tr><td align="center"></td><td align="center">'if'&lt;expression&#62; 'then' &lt;expression&#62; 'else' &lt;expression&#62;</td></tr></table>
<p>
</center>
<h4>sizeof</h4>
<p>
The construct <tt>sizeof<a name="sizeof31">
</a>(</tt> <em>t</em> <tt>)</tt> where <em>t</em>
is a type, returns the number of bytes<a name="bytes31">
</a> occupied by an instance
of the type.
<p>
<h4>iota<a name="iota">
</a></h4>
<p>
The operator iota i returns the ith current implicit index<a href="#tthFtNtAAH" name="tthFrefAAH"><sup>7</sup></a>.
<p>
<b>Examples&nbsp;&nbsp;</b>
<p>
Thus given the definitions
<p>
<tt>var v1:array[1..3]of integer; </tt>
<p>
<tt>v2:array[0..4] of integer;</tt>
<p>
then the program fragment
<p>
<tt>v1:=iota 0;</tt>
<p>
<tt>v2:=iota 0 *2;</tt>
<p>
<tt></tt><tt>for i:=1 to 3 do write( v1[i]); writeln; </tt>
<p>
<tt>writeln('v2'); </tt>
<p>
<tt>for i:=0 to 4 do write( v2[i]); writeln; </tt>
<p>
would produce the output
<p>
<dl compact="compact">
<dt><b></b></dt>
<dd>
v1
<p>
1&nbsp;2&nbsp;3&nbsp;
<p>
v2&nbsp;
<p>
0&nbsp;2&nbsp;4&nbsp;6&nbsp;8
</dd>
</dl>
whilst given the definitions
<p>
<tt>m1:array[1..3,0..4] of integer;m2:array[0..4,1..3]of integer;</tt>
<p>
then the program fragment
<p>
<tt>m2:= iota 0 +2*iota 1; </tt>
<p>
<tt>writeln('m2:= iota 0 +2*iota 1 '); </tt>
<p>
<tt>for i:=0 to 4 do begin for j:=1 to 3 do write(m2[i,j]); writeln;
end; </tt>
<p>
would produce the output
<p>
<dl compact="compact">
<dt><b></b></dt>
<dd>
m2:=&nbsp;iota&nbsp;0&nbsp;+2*iota&nbsp;1&nbsp;
<p>
2&nbsp;4&nbsp;6&nbsp;
<p>
3&nbsp;5&nbsp;7&nbsp;
<p>
4&nbsp;6&nbsp;8&nbsp;
<p>
5&nbsp;7&nbsp;9&nbsp;
<p>
6&nbsp;8&nbsp;10&nbsp;&nbsp;
</dd>
</dl>
The argument to <tt>iota</tt><a name="iota31">
</a> must be an integer known at compile
time within the range of implicit indices in the current context. The reserved
word <tt>ndx<a name="ndx31">
</a></tt> is a synonym for <tt>iota</tt>.
<p>
<b>perm&nbsp;&nbsp;</b>
<p>
A generalised permutation of the implicit indices is performed using the syntactic
form:
<p>
<blockquote><tt>perm</tt><tt>[</tt><tt><i>index-sel[,index-sel]* ]expression </i></tt>
</blockquote>
The <i>index-sel</i>s are integers known at compile time which specify a permutation
on the implicit indices. Thus in e evaluated in context <tt>perm</tt><tt>[ i,j,k ] e </tt>,
then:
<p>
<blockquote><tt>iota 0 = iota</tt> <tt> i, </tt> <tt>iota 1= iota</tt> <tt> j, </tt>
<tt>iota 2= iota</tt> <tt> k </tt>
</blockquote>
This is particularly useful in converting between different image formats. Hardware
frame buffers typically represent images with the pixels in the red, green,
blue, and alpha channels adjacent in memory. For image processing it is convenient
to hold them in distinct planes. The <tt>perm</tt> operator provides a concise
notation for translation between these formats:
<pre>
type rowindex=0..479;
colindex=0..639;
var channel=red..alpha;
screen:array[rowindex,colindex,channel] of pixel;
img:array[channel,colindex,rowindex] of pixel;
...
screen:=perm[2,0,1]img;
</pre>
<p>
<tt>trans<a name="trans31">
</a></tt> and <tt>diag</tt> <a name="diag">
</a> provide shorthand
notions for expressions in terms of <tt>perm</tt><a name="perm31">
</a>. Thus in an assignment
context of rank 2, <tt>trans = perm[1,0]</tt> and <tt>diag = perm[0,0]</tt>.
<p>
<h4>trans</h4>
<p>
The operator trans<a name="trans31">
</a> transposes a vector or matrix. It achieves
this by cyclic rotation of the implicit indices<a name="indices31">
</a><a name="implicit indices31">
</a>.
Thus if <tt>trans</tt> <em>e</em> is evaluated in a context with implicit indices
<p>
<tt>iota</tt> <em>0</em>.. <tt>iota</tt> <em>n </em>
<p>
then the expression e is evaluated in a context with implicit indices
<p>
<tt>iota</tt>'<em>0</em>.. <tt>iota</tt>'<em>n</em>
<p>
where
<p>
<tt>iota</tt>'<em>x</em> = <tt>iota</tt> ( (<em>x+1</em>)<tt>mod</tt> <em>n+1</em>)
<p>
It should be noted that transposition is generalised to arrays of rank greater
than 2.
<p>
<b>Examples&nbsp;&nbsp;</b>
<p>
Given the definitions used above in section <a href="#iota">3.1.3</a>, the program fragment:
<p>
<tt>m1:= (trans v1)*v2; </tt>
<p>
<tt>writeln('(trans v1)*v2'); </tt>
<p>
<tt>for i:=1 to 3 do begin for j:=0 to 4 do write(m1[i,j]); writeln;
end; </tt>
<p>
<tt>m2 := trans m1; </tt>
<p>
<tt>writeln('transpose 1..3,0..4 matrix'); </tt>
<p>
<tt>for i:=0 to 4 do begin for j:=1 to 3 do write(m2[i,j]); writeln;
end;</tt>
<p>
will produce the output:
<p>
<dl compact="compact">
<dt><b></b></dt>
<dd>
(trans&nbsp;v1)*v2&nbsp;
<p>
0&nbsp;&nbsp;2&nbsp;&nbsp;4&nbsp;&nbsp;6&nbsp;&nbsp;8&nbsp;
<p>
0&nbsp;&nbsp;4&nbsp;&nbsp;8&nbsp;12&nbsp;16&nbsp;
<p>
0&nbsp;&nbsp;6&nbsp;12&nbsp;18&nbsp;24&nbsp;
<p>
transpose&nbsp;1..3,0..4&nbsp;matrix&nbsp;
<p>
0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;
<p>
2&nbsp;&nbsp;4&nbsp;&nbsp;6&nbsp;
<p>
4&nbsp;&nbsp;8&nbsp;12&nbsp;
<p>
6&nbsp;12&nbsp;18&nbsp;
<p>
8&nbsp;16&nbsp;24
</dd>
</dl>
<p>
<h3><a name="tth_sEc3.1.4">
3.1.4</a>&nbsp;&nbsp;Operator Reduction</h3>
<p>
Any dyadic operator can be converted to a monadic<a name="monadic31">
</a> reduction<a name="reduction31">
</a>
operator by the functional . Thus if <tt>a</tt> is an array,
<tt>+a</tt> denotes the sum over the array. More generally \<font face="symbol">F</font
>x
for some dyadic operator <font face="symbol">F</font
> means x<sub>0</sub><font face="symbol">F</font
>(x<sub>1</sub><font face="symbol">F</font
>..(x<sub>n</sub><font face="symbol">F</font
><font face="symbol">i</font
>))
where <font face="symbol">i</font
> is the implicit value given the operator and the type. Thus
we can write <tt>+</tt> for summation, <tt>*</tt> for nary product
etc. The dot product of two vectors can thus be written as
<pre>
x:= \+ y*x;
</pre>
<p>
instead of
<p>
<tt>x:=0;</tt>
<p>
<tt>for i:=0 to n do x:= x+ y[i]*z[i];</tt>
<p>
A reduction operation takes an argument of rank<a name="rank31">
</a> <em>r</em> and returns
an argument of rank <em>r-1</em> except in the case where its argument is of rank
0, in which case it acts as the identity operation. Reduction is always performed
along the last array<a name="array31">
</a> dimension<a name="dimension31">
</a> of its argument.
<p>
The operations of summation and product can be be written eithter as the two
functional forms \ +
and \ * or as the prefix operators <font face="symbol">å</font
> (Unicode 2211) and <font face="symbol">Õ</font
> (Unicode 220f).
<p>
<center>
<table border="1">
<tr><td align="center">&lt;operator reduction&#62;</td><td align="center">''&lt;dyadic op&#62; &lt;multiplicative expression&#62;</td></tr>
<tr><td align="center"></td><td align="center">'<font face="symbol">å</font
>' &lt;mutliplicative expression&#62;</td></tr>
<tr><td align="center"></td><td align="center">'<font face="symbol">Õ</font
>' &lt; multiplicative expression&#62;</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;dyadic op&#62;</td><td align="center">&lt;expop&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;multop&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;addop&#62;</td></tr></table>
<p>
</center>The reserved word <tt>rdu<a name="rdu31">
</a></tt> is available as a lexical alternative
to , so + is equivalent to <tt>rdu</tt>+.
<p>
<h3><a name="tth_sEc3.1.5">
3.1.5</a>&nbsp;&nbsp;Complex conversion</h3>
<p>
Complex<a name="Complex31">
</a> numbers can be produced from reals using the function
<tt>cmplx</tt><a name="cmplx31">
</a>. <tt>cmplx(</tt><em>re,im</em><tt>)</tt> is the complex
number with real part <em>re</em>, and imaginaray part <em>im</em>.
<p>
The real and imaginary parts of a complex number can be obtained by the functions
<tt>re</tt> and <tt>im</tt>. <tt>re</tt>(<em>c</em>) is the real part of the complex
number <em>c</em>. <tt>im</tt>(<em>c</em>) is the imaginary part of the complex
number <em>c</em>.
<p>
<h3><a name="tth_sEc3.1.6">
3.1.6</a>&nbsp;&nbsp;Conditional expressions</h3>
<p>
The conditional expression allows two different values to be returned depenent
upon a boolean expression.
<p>
<pre>
var a:array[0..63] of real;
...
a:=if a&#62;0 then a else -a;
...
</pre>
<p>
The <tt>if</tt> expression can be compiled in two ways:
<p>
<ol type="1"><p>
<li> Where the two arms of the if expression are parallelisable, the condition and
both arms are evaluated and then merged under a boolean mask. Thus, the above
assignment would be equivalent to:
<p>
<tt>a:= (a and (a &gt; 0))or(not (a &gt; 0) and -a);</tt>
<p>
were the above legal Pascal<a href="#tthFtNtAAI" name="tthFrefAAI"><sup>8</sup></a>.</li>
<p>
<li> If the code is not paralleliseable it is translated as equivalent to a standard
if statement. Thus, the previous example would be equivalent to:
<p>
<tt>for i:=0 to 63 do if a[i] &gt; 0 then a[i]:=a[i] else
a[i]:=-a[i];</tt>
<p>
Expressions are non parallelisable if they include function calls.</li>
</ol>
The dual compilation strategy allows the same linguistic construct to be used
in recursive function definitions and parallel data selection.
<p>
<h4>Use of boolean mask vectors</h4>
In array programming many operations can be efficiently be expressed in terms
of boolean mask vectors.
Given the declarations:
<pre>
i:array[1..4] of integer;
r:array[1..4] of real;
c:array[1..4] of complex;
b:array[1..4] of boolean;
s:array[1..4] of string;
</pre>
and if
<p>
<h3><a name="tth_sEc3.1.7">
3.1.7</a>&nbsp;&nbsp;Factor<a name="Factor31">
</a></h3>
<p>
A factor is an expression that optionally performs exponentiation. Vector Pascal
supports exponentiation either by integer exponents or by real exponents. A
number <em>x</em> can be raised to an integral power <em>y</em> by using the construction
<em>x</em> <tt>pow<a name="pow31">
</a></tt> <em>y</em>. A number can be raised to an arbitrary
real power by the <tt>**</tt> operator. The result of <tt>**<a name="**31">
</a></tt>
is always real valued.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;expop&#62;</td><td align="center">'pow'</td></tr>
<tr><td align="center"></td><td align="center">'**'</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;factor&#62;</td><td align="center">&lt;unary expression&#62; [ &lt;expop&#62; &lt;unary expression&#62;]</td></tr></table>
<p>
</center> <h3><a name="tth_sEc3.1.8">
3.1.8</a>&nbsp;&nbsp;Multiplicative expressions</h3>
<p>
Multiplicative expressions consist of factors linked by the multiplicative operators
<tt>*, &times;, /, div, <font face="symbol">¸</font
>,<a name="div31">
</a>, mod<a name="mod31">
</a>, shr<a name="shr31">
</a>, shl<a name="shl31">
</a>
and</tt><a name="and31">
</a>. The use of these operators is summarised in table <a href="#multop">3.2</a>.
<p>
<p>
<a name="tth_tAb3.2">
</a> <center>Table 3.2: Multiplicative operators<a name="multop">
</a></center>
<center>
<table>
<tr><td align="center"><font size="-1">Operator</font></td><td align="center"><font size="-1">Left</font></td><td align="center"><font size="-1">Right</font></td><td align="center"><font size="-1">Result</font></td><td align="center"><font size="-1">Effect of</font> <em><font size="-1">a</font></em> <tt><font size="-1">op</font></tt> <em><font size="-1">b</font></em><font size="-1"></font></td></tr>
<tr><td align="center"><tt><font size="-1">*, &times;</font></tt><font size="-1"></font></td><td align="center"><font size="-1">integer</font></td><td align="center"><font size="-1">integer</font></td><td align="center"><font size="-1">integer</font></td><td align="center"><font size="-1">multiply</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">real</font></td><td align="center"><font size="-1">real</font></td><td align="center"><font size="-1">real</font></td><td align="center"><font size="-1">multiply</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">complex</font></td><td align="center"><font size="-1">complex</font></td><td align="center"><font size="-1">complex</font></td><td align="center"><font size="-1">multiply</font></td></tr>
<tr><td align="center"><tt><font size="-1">/</font></tt><font size="-1"></font></td><td align="center"><font size="-1">integer</font></td><td align="center"><font size="-1">integer</font></td><td align="center"><font size="-1">real</font></td><td align="center"><font size="-1">division</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">real</font></td><td align="center"><font size="-1">real</font></td><td align="center"><font size="-1">real</font></td><td align="center"><font size="-1">division</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">complex</font></td><td align="center"><font size="-1">complex</font></td><td align="center"><font size="-1">complex</font></td><td align="center"><font size="-1">division</font></td></tr>
<tr><td align="center"><tt><font size="-1">div, <font face="symbol">¸</font
></font></tt><font size="-1"></font></td><td align="center"><font size="-1">integer</font></td><td align="center"><font size="-1">integer</font></td><td align="center"><font size="-1">integer</font></td><td align="center"><font size="-1">division</font></td></tr>
<tr><td align="center"><tt><font size="-1">mod</font></tt><font size="-1"></font></td><td align="center"><font size="-1">integer</font></td><td align="center"><font size="-1">integer</font></td><td align="center"><font size="-1">integer</font></td><td align="center"><font size="-1">remainder</font></td></tr>
<tr><td align="center"><tt><font size="-1">and</font></tt><font size="-1"></font></td><td align="center"><font size="-1">boolean</font></td><td align="center"><font size="-1">boolean</font></td><td align="center"><font size="-1">boolean</font></td><td align="center"><font size="-1">logical and</font></td></tr>
<tr><td align="center"><tt><font size="-1">shr</font></tt><font size="-1"></font></td><td align="center"><font size="-1">integer</font></td><td align="center"><font size="-1">integer</font></td><td align="center"><font size="-1">integer</font></td><td align="center"><font size="-1">shift</font> <em><font size="-1">a</font></em> <font size="-1">by</font> <em><font size="-1">b</font></em> <font size="-1">bits right</font></td></tr>
<tr><td align="center"><tt><font size="-1">shl</font></tt><font size="-1"></font></td><td align="center"><font size="-1">integer</font></td><td align="center"><font size="-1">integer</font></td><td align="center"><font size="-1">integer</font></td><td align="center"><font size="-1">shift</font> <em><font size="-1">a</font></em> <font size="-1">by</font> <em><font size="-1">b</font></em> <font size="-1">bits left</font></td></tr>
<tr><td align="center"><tt><font size="-1">in, <font face="symbol">Î</font
> </font></tt><font size="-1"></font></td><td align="center"><em><font size="-1">t</font></em><font size="-1"></font></td><td align="center"><tt><font size="-1">set of</font></tt> <em><font size="-1">t</font></em><font size="-1"></font></td><td align="center"><font size="-1">boolean</font></td><td align="center"><font size="-1">true if</font> <em><font size="-1">a</font></em> <font size="-1">is member of</font> <em><font size="-1">b</font></em></td></tr></table>
<font size="-1">
<p>
</font></center>
<p>
<center>
<table border="1">
<tr><td align="center">&lt;multop&#62;</td><td align="center">'*'</td></tr>
<tr><td align="center"></td><td align="center">'&times;'</td></tr>
<tr><td align="center"></td><td align="center">'/'</td></tr>
<tr><td align="center"></td><td align="center">'div'</td></tr>
<tr><td align="center"></td><td align="center">'<font face="symbol">¸</font
>'</td></tr>
<tr><td align="center"></td><td align="center">'shr'</td></tr>
<tr><td align="center"></td><td align="center">'shl'</td></tr>
<tr><td align="center"></td><td align="center">'and'</td></tr>
<tr><td align="center"></td><td align="center">'mod'</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;multiplicative expression&#62;</td><td align="center">&lt;factor&#62; [ &lt;multop&#62; &lt;factor&#62; ]*</td></tr>
<tr><td align="center"></td><td align="center">&lt;factor&#62;'in'&lt;multiplicative expression&#62;</td></tr></table>
<p>
</center> <h3><a name="tth_sEc3.1.9">
3.1.9</a>&nbsp;&nbsp;Additive expressions</h3>
<p>
An additive expression allows multiplicative expressions to be combined using
the addition operators <tt>+<a name="+31">
</a>, -<a name="-31">
</a>, or, +:<a name="+:31">
</a><a name="or31">
</a>,max<a name="max31">
</a>,
min<a name="min31">
</a>, -:</tt><a name="-:31">
</a>,
<tt>&gt;&lt;</tt><a name="\verb+><+31">
</a>. The additive operations are summarised in table<a href="#addops">3.3</a>
.
<p>
<p>
<a name="tth_tAb3.3">
</a> <center>Table 3.3: Addition operations<a name="addops">
</a></center>
<center>
<table>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">Left</font></td><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">Right</font></td><td align="center"><font size="-1">Result</font></td><td align="center"><font size="-1">Effect of</font> <em><font size="-1">a</font></em> <tt><font size="-1">op</font></tt> <em><font size="-1">b</font></em><font size="-1"></font></td></tr><tr><td>
<tr><td align="center"><tt><font size="-2">+</font></tt><font size="-2"></font></td><td align="center"><font size="-2">integer</font></td><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">integer</font></td><td align="center"><font size="-2">integer</font></td><td align="center"><font size="-2">sum of</font> <em><font size="-2">a</font></em> <font size="-2">and</font> <em><font size="-2">b</font></em><font size="-2"></font></td></tr>
<tr><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">real</font></td><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">real</font></td><td align="center"><font size="-2">real</font></td><td align="center"><font size="-2">sum of</font> <em><font size="-2">a</font></em> <font size="-2">and</font> <em><font size="-2">b</font></em><font size="-2"></font></td></tr>
<tr><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">complex</font></td><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">complex</font></td><td align="center"><font size="-2">complex</font></td><td align="center"><font size="-2">sum of</font> <em><font size="-2">a</font></em> <font size="-2">and</font> <em><font size="-2">b</font></em><font size="-2"></font></td></tr>
<tr><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">set</font></td><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">set</font></td><td align="center"><font size="-2">set</font></td><td align="center"><font size="-2">union of</font> <em><font size="-2">a</font></em> <font size="-2">and</font> <em><font size="-2">b</font></em><font size="-2"></font></td></tr>
<tr><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">string</font></td><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">string</font></td><td align="center"><font size="-2">string</font></td><td align="center"><font size="-2">concatenate<a name="concatenate31">
</a></font> <em><font size="-2">a</font></em> <font size="-2">with</font>
<em><font size="-2">b</font></em> <font size="-2">'ac'+'de'='acde'</font></td></tr>
<tr><td align="center"><tt><font size="-2">-</font></tt><font size="-2"></font></td><td align="center"><font size="-2">integer</font></td><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">integer</font></td><td align="center"><font size="-2">integer</font></td><td align="center"><font size="-2">result of subtracting</font> <em><font size="-2">b</font></em> <font size="-2">from</font>
<em><font size="-2">a</font></em><font size="-2"></font></td></tr>
<tr><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">real</font></td><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">real</font></td><td align="center"><font size="-2">real</font></td><td align="center"><font size="-2">result of subtracting</font> <em><font size="-2">b</font></em> <font size="-2">from</font>
<em><font size="-2">a</font></em><font size="-2"></font></td></tr>
<tr><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">complex</font></td><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">complex</font></td><td align="center"><font size="-2">complex</font></td><td align="center"><font size="-2">result of subtracting</font> <em><font size="-2">b</font></em> <font size="-2">from</font>
<em><font size="-2">a</font></em><font size="-2"></font></td></tr>
<tr><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">set</font></td><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">set</font></td><td align="center"><font size="-2">set</font></td><td align="center"><font size="-2">complement<a name="complement31">
</a> of</font> <em><font size="-2">b</font></em> <font size="-2">relative
to</font> <em><font size="-2">a</font></em><font size="-2"></font></td></tr>
<tr><td align="center"><tt><font size="-2">+:</font></tt><font size="-2"></font></td><td align="center"><font size="-2">0..255</font></td><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">0..255</font></td><td align="center"><font size="-2">0..255</font></td><td align="center"><font size="-2">saturated + clipped to 0..255 </font></td></tr>
<tr><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">-128..127</font></td><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">-128..127</font></td><td align="center"><font size="-2">-128..127</font></td><td align="center"><font size="-2">saturated + clipped to -128..127</font></td></tr>
<tr><td align="center"><tt><font size="-2">-:</font></tt><font size="-2"></font></td><td align="center"><font size="-2">0..255</font></td><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">0..255</font></td><td align="center"><font size="-2">0..255</font></td><td align="center"><font size="-2">saturated<a name="saturated31">
</a> - clipped to 0..255</font></td></tr>
<tr><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">-128..127</font></td><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">-128..127</font></td><td align="center"><font size="-2">-128..127</font></td><td align="center"><font size="-2">saturated - clipped to -128..127</font></td></tr>
<tr><td align="center"><tt><font size="-2">min<a name="min31">
</a></font></tt><font size="-2"></font></td><td align="center"><font size="-2">integer</font></td><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">integer</font></td><td align="center"><font size="-2">integer</font></td><td align="center"><font size="-2">returns the lesser of the numbers</font></td></tr>
<tr><td align="center"></td><td align="center"><font size="-2">real</font></td><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">real</font></td><td align="center"><font size="-2">real</font></td><td align="center"><font size="-2">returns the lesser of the numbers</font></td></tr>
<tr><td align="center"><tt><font size="-2">max<a name="max31">
</a></font></tt><font size="-2"></font></td><td align="center"><font size="-2">integer</font></td><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">integer</font></td><td align="center"><font size="-2">integer</font></td><td align="center"><font size="-2">returns the greater of the numbers</font></td></tr>
<tr><td align="center"></td><td align="center"><font size="-2">real</font></td><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">real</font></td><td align="center"><font size="-2">real</font></td><td align="center"><font size="-2">returns the greater of the numbers</font></td></tr>
<tr><td align="center"><tt><font size="-2">or</font></tt><font size="-2"></font></td><td align="center"><font size="-2">boolean</font></td><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">boolean</font></td><td align="center"><font size="-2">boolean</font></td><td align="center"><font size="-2">logical or</font></td></tr>
<tr><td align="center"> <tt>&gt;&lt;</tt></td><td align="center"><font size="-2">set</font></td><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">set</font></td><td align="center"><font size="-2">set</font></td><td align="center"><font size="-2">symetric difference</font></td></tr></table>
<font size="-2">
<p>
</font></center>
<p>
<center>
<table border="1">
<tr><td align="center"><font size="-2">&lt;addop&#62;</font></td><td align="center"><font size="-2">'+'</font></td></tr>
<tr><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">'-'</font></td></tr>
<tr><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">'or'</font></td></tr>
<tr><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">'max'</font></td></tr>
<tr><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">'min'</font></td></tr>
<tr><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">'+:'</font></td></tr>
<tr><td align="center"><font size="-2"></font></td><td align="center"><font size="-2">'-:'</font></td></tr></table>
<font size="-2">
<p>
</font></center><center>
<table border="1">
<tr><td align="center"><font size="-2">&lt;additive expression&#62;</font></td><td align="center"><font size="-2">&lt;multiplicative expression&#62; [ &lt;addop&#62; &lt;multiplicative expression&#62;
]*</font></td></tr></table>
<font size="-2">
<p>
</font></center><center>
<table border="1">
<tr><td align="center"><font size="-2">&lt;expression&#62;</font></td><td align="center"><font size="-2">&lt;additive expression&#62; &lt;relational operator&#62; &lt;expression&#62;</font></td></tr></table>
<font size="-2">
<p>
</font></center> <h3><a name="tth_sEc3.1.10">
3.1.10</a>&nbsp;&nbsp;Expressions</h3>
An expression can optionally involve the use of a relational operator
to compare the results of two additive expressions. Relational operators
always return boolean results and are listed in table <a href="#relop">3.4</a>.
<p>
<a name="tth_tAb3.4">
</a> <center>Table 3.4: Relational operators</center><a name="relop">
</a>
<table>
<tr><td align="center"><tt>&lt;</tt></td><td align="center">Less than</td></tr>
<tr><td align="center"><tt>&gt;</tt></td><td align="center">Greater than</td></tr>
<tr><td align="center"><tt>&lt;=</tt></td><td align="center">Less than or equal to</td></tr>
<tr><td align="center"><tt>&gt;=</tt></td><td align="center">Greater than or equal to</td></tr>
<tr><td align="center"><tt>&lt;&gt;</tt> </td><td align="center">Not equal to</td></tr>
<tr><td align="center"><tt>=</tt></td><td align="center">Equal to</td></tr></table>
<p>
<p>
<h3><a name="tth_sEc3.1.11">
3.1.11</a>&nbsp;&nbsp;Operator overloading</h3>
<p>
The dyadic operators<a name="operator31">
</a>
<a name="operator, overloadin31">
</a> can be extended to operate on new types by operator overloading.
Figure <a href="#complex">3.1</a> shows how arithmetic on the type <tt>complex</tt> required
by Extended Pascal [<a href="#ISO90" name="CITEISO90">15</a>] is defined in Vector Pascal. Each operator
is associated with a semantic function and
if it is a non-relational operator,
an identity element. The operator
symbols must be drawn from the set of predefined Vector Pascal operators, and
when expressions involving them are parsed, priorities are inherited from the
predefined operators. The type signature of the operator is deduced from the
type of the function<a href="#tthFtNtAAJ" name="tthFrefAAJ"><sup>9</sup></a>.
<p>
<center>
<table border="1">
<tr><td align="center"><font size="-2">&lt;operator-declaration&#62;</font></td><td align="center"><font size="-2">'operator' 'cast' '=' &lt;identifier&#62;</font></td></tr>
<tr><td align="center"></td><td align="center"><font size="-2">'operator' &lt;dyadicop&#62; '=' &lt;identifier&#62;','&lt;identifier&#62;</font></td></tr>
<tr><td align="center"></td><td align="center"><font size="-2">'operator' &lt;relational operator&#62; '=' &lt;identifier&#62;</font></td></tr></table>
<font size="-2">
<p>
</font></center>
<p>
<a name="tth_fIg3.1">
</a> <font size="-1">***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;
<br /><table align="left" border="0"><tr><td width="553">
<tt>interface </tt></td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<tt>type </tt></td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<tt>Complex = record data : array [0..1] of real ;</tt></td></tr></table><!--hbox-->
<br />\&lt;<br /><table align="left" border="0"><tr><td width="553">
<tt>end ;</tt></td></tr></table><!--hbox-->
<br /><br />\&lt;<br /><table align="left" border="0"><tr><td width="553">
<tt>var </tt></td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<tt> complexzero, complexone : complex;</tt></td></tr></table><!--hbox-->
<br /><br />\&lt;<tt>function real2cmplx
( realpart :real ):complex ;</tt> <br />
\&lt;<tt>function cmplx
( realpart ,imag :real ):complex ;</tt> <br />
\&lt;<tt>function complex_add
( A ,B :Complex ):complex ;</tt> <br />
\&lt;<tt>function complex_conjugate
( A :Complex ):complex ;</tt> <br />
\&lt;<tt>function complex_subtract
( A ,B :Complex ):complex ;</tt> <br />
\&lt;<tt>function complex_multiply
( A ,B :Complex ):complex ;</tt> <br />
\&lt;<tt>function complex_divide
( A ,B :Complex ):complex ;</tt> <br />
<br /><table align="left" border="0"><tr><td width="553">
<tt><font size="-1">{ Standard operators on complex numbers }</font></tt></td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<tt><font size="-1">{ symbol function identity element }</font></tt></td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<tt>operator + = Complex_add , complexzero ;</tt></td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<tt>operator / = complex_divide , complexone ;</tt></td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<tt>operator * = complex_multiply , complexone ;</tt></td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<tt>operator - = complex_subtract , complexzero ;</tt></td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<tt>operator cast = real2cmplx ;</tt></td></tr></table><!--hbox-->
<br /><br /></font>
<center>Figure 3.1: Defining operations on complex numbers</center>
<p>
<a name="complex">
</a><font size="-1">Note that only the function headers are given here as
this code comes from the interface part of the system unit. The function bodies
and the initialisation of the variables complexone and complexzero are handled
in the implementation part of the unit.</font><font size="-1">
<p>
</font>
<p>
When parsing expressions, the compiler first tries to resolve operations in
terms of the predefined operators of the language, taking into account the standard
mechanisms allowing operators to work on arrays. Only if these fail does it
search for an overloaded operator whose type signature matches the context.
<p>
In the example in figure <a href="#complex">3.1</a>, complex numbers are defined to be records
containing an array of reals, rather than simply as an array of reals. Had they
been so defined, the operators <tt>+,*,-,/</tt> on reals would have masked
the corresponding operators on complex numbers.
<p>
The provision of an identity element for complex addition and subtraction ensures
that unary minus, as in <font face="symbol">-</font
>x for x: complex, is well defined, and
correspondingly that unary / denotes complex reciprocal. Overloaded operators
can be used in array maps and array reductions.
<p>
<h4>Implicit casts</h4><a name="cast31">
</a>
The Vector Pascal language already contains a number of implicit type
conversions that are context determind. An example is the promotion of
integers to reals in the context of arithmetic expressions. The set of
implicit casts can be added to by declaring an operator to be a cast
as is shown in the line:
<p>
<table align="left" border="0"><tr><td width="553">
<tt><i>operator</i> <i>cast</i> = <i>real2cmplx</i> ;</tt></td></tr></table><!--hbox-->
<br clear="all" /><br />Given an implict cast from type t<sub>0</sub><font face="symbol">®</font
> t<sub>1</sub>,
the function associated with the implicit cast is then called
on the result
of any expression e:t<sub>0</sub> whose expression context requires
it to be of type t<sub>1</sub>.
<h2><a name="tth_sEc3.2">
3.2</a>&nbsp;&nbsp;Statements</h2>
<p>
<center>
<table border="1">
<tr><td align="center">&lt;statement&#62;</td><td align="center"><font size="-1">&lt;variable&#62;':='&lt;expression&#62;</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">&lt;procedure statement&#62;</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">&lt;empty statement&#62;</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'goto' &lt;label&#62;;</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'exit'['('&lt;expression&#62;')']</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'begin' &lt;statement&#62;[;&lt;statement&#62;]*'end'</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'if'&lt;expression&#62;'then'&lt;statement&#62;['else'&lt;statement&#62;]</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">&lt;case statement&#62;</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'for' &lt;variable&#62;:= &lt;expression&#62; 'to' &lt;expression&#62; 'do' &lt;statement&#62;</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'for' &lt;variable&#62;:= &lt;expression&#62; 'downto' &lt;expression&#62; 'do' &lt;statement&#62;</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'repeat' &lt;statement&#62; 'until' &lt;expression&#62;</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'with' &lt;record variable&#62; 'do' &lt; statement&#62;</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">&lt;io statement&#62;</font></td></tr>
<tr><td align="center"><font size="-1"></font></td><td align="center"><font size="-1">'while' &lt;expression&#62; 'do' &lt;statement&#62;</font></td></tr></table>
<font size="-1">
<p>
</font></center> <h3><a name="tth_sEc3.2.1">
3.2.1</a>&nbsp;&nbsp;Assignment<a name="assignment">
</a></h3>
<p>
An assignment replaces the current value of a variable by a new value specified
by an expression. The assignment operator<a name="operator32">
</a> is<a name="is32">
</a> :=<a name=":=32">
</a>.
Standard Pascal allows assignment<a name="assignment32">
</a> of whole arrays<a name="array32">
</a>.
Vector Pascal extends this to allow consistent use of mixed rank<a name="rank32">
</a>
expressions on the right hand side of an assignment. Given
<p>
<tt>r0:real; r1:array[0..7] of real; </tt>
<p>
<tt>r2:array[0..7,0..7] of real</tt>
<p>
then we can write
<p>
<ol type="1"><p>
<li> r<tt>1:= r2[3]; { supported in standard Pascal }</tt></li>
<p>
<li> <tt>r1:= /2; { assign 0.5 to each element of r1 }</tt></li>
<p>
<li> <tt>r2:= r1*3; { assign 1.5 to every element of r2}</tt></li>
<p>
<li> <tt>r1:= + r2; { r1 gets the totals along the rows of r2}</tt></li>
<p>
<li> <tt>r1:= r1+r2[1];{ r1 gets the corresponding elements of row 1 of
r2 added to it}</tt></li>
</ol>
The assignment of arrays is a generalisation of what standard Pascal allows.
Consider the first examples above, they are equivalent to:
<p>
<ol type="1"><p>
<li> <tt>for i:=0 to 7 do r1[i]:=r2[3,i];</tt></li>
<p>
<li> <tt>for i:=0 to 7 do r1[i]:=/2;</tt></li>
<p>
<li> <tt>for i:=0 to 7 do
<p>
for j:=0 to 7 do r2[i,j]:=r1[j]*3;</tt></li>
<p>
<li> <tt>for i:=0 to 7 do
<p>
begin
<p>
&nbsp;t:=0;
<p>
&nbsp;for j:=7 downto 0 do t:=r2[i,j]+t;
<p>
&nbsp;r1[i]:=t;
<p>
end;</tt></li>
<p>
<li> <tt>for i:=0 to 7 do r1[i]:=r1[i]+r2[1,i];</tt></li>
</ol>
In other words the compiler has to generate an implicit loop<a name="loop32">
</a> over
the elements of the array being assigned to and over the elements of the array
acting as the data-source. In the above <tt>i,j,t</tt> are assumed to be temporary
variables not referred to anywhere else in the program. The loop variables are
called implicit indices<a name="indices32">
</a><a name="implicit indices32">
</a> <a name="manimplicitindices">
</a>and
may be accessed using <tt>iota</tt>.
<p>
The variable on the left hand side of an assignment defines an array<a name="array32">
</a>
context within which expressions on the right hand side are evaluated. Each
array context has a rank given by the number of dimensions<a name="dimensions32">
</a>
of the array on the left hand side. A scalar variable has rank<a name="rank32">
</a>
0. Variables occurring in expressions with an array context of rank <em>r</em>
must have <em>r</em> or fewer dimensions. The <em>n</em> bounds of any <em>n</em>
dimensional array variable, with n <font face="symbol">£</font
> r occurring within an expression
evaluated in an array context of rank <em>r</em> must match with the rightmost
<em>n</em> bounds of the array on the left hand side of the assignment statement.
<p>
Where a variable is of lower rank than its array context, the variable is replicated
to fill the array context<a name="array context32">
</a>. This is shown in examples 2
and 3 above. Because the rank of any assignment is constrained by the variable
on the left hand side, no temporary arrays, other than machine registers, need
be allocated to store the intermediate array results of expressions.
<p>
<h3><a name="tth_sEc3.2.2">
3.2.2</a>&nbsp;&nbsp;Procedure statement</h3>
<p>
A procedure statement executes a named procedure<a name="procedure32">
</a>. A procedure
statement may, in the case where the named procedure has formal parameters,
contain a list of actual parameters. These are substituted in place of the formal
parameters contained in the declaration. Parameters may be value parameters
or variable parameters.
<p>
Semantically the effect of a value parameter is that a copy is taken of the
actual parameter<a name="parameter32">
</a> and this copy substituted into the body of
the procedure. Value parameters may be structured values such as records and
arrays. For scalar values, expressions may be passed as actual parameters. Array
expressions are not currently allowed as actual parameters.
<p>
A variable parameter is passed by reference, and any alteration of the formal
parameter induces a corresponding change in the actual parameter. Actual variable
parameters must be variables.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;parameter&#62;</td><td align="center">&lt;variable&#62;</td><td align="center">for formal parameters declared as var</td></tr>
<tr><td align="center"></td><td align="center">&lt;expression&#62;</td><td align="center">for other formal parameters </td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;procedure statement&#62;</td><td align="center">&lt;identifier&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;identifier&#62; '(' &lt;parameter&#62; [','&lt;parameter&#62;]* ')'</td></tr></table>
<p>
</center>
<b>Examples&nbsp;&nbsp;</b>
<p>
<ol type="1"><p>
<li> <tt>printlist;</tt></li>
<p>
<li> <tt>compare(avec,bvec,result);</tt></li>
</ol>
<p>
<h3><a name="tth_sEc3.2.3">
3.2.3</a>&nbsp;&nbsp;Goto statement</h3>
<p>
A goto statement transfers control to a labelled statement. The destination
label must be declared in a label<a name="label32">
</a> declaration. It is illegal to
jump into or out of a procedure.
<p>
<b>Example&nbsp;&nbsp;</b>
<p>
<tt>goto<a name="goto32">
</a> 99;</tt>
<p>
<h3><a name="tth_sEc3.2.4">
3.2.4</a>&nbsp;&nbsp;Exit<a name="Exit32">
</a> Statement</h3>
<p>
An exit statement transfers control to the calling point of the current procedure
or function. If the exit statement is within a function then the exit statement
can have a parameter: an expression whose value is returned from the function.
<p>
<b>Examples&nbsp;&nbsp;</b>
<p>
<ol type="1"><p>
<li> <tt>exit;</tt></li>
<p>
<li> <tt>exit(5);</tt></li>
</ol>
<p>
<h3><a name="tth_sEc3.2.5">
3.2.5</a>&nbsp;&nbsp;Compound statement</h3>
<p>
A list of statements separated by semicolons may be grouped into a compound
statement by bracketing them with <tt>begin</tt> and <tt>end</tt> .
<p>
<b>Example&nbsp;&nbsp;</b>
<p>
<tt>begin<a name="begin32">
</a> a:=x*3; b:=sqrt a end<a name="end32">
</a>;</tt>
<p>
<h3><a name="tth_sEc3.2.6">
3.2.6</a>&nbsp;&nbsp;If statement</h3>
<p>
The basic control flow construct is the if statement. If the boolean expression
between <tt>if<a name="if32">
</a></tt> and <tt>then<a name="then32">
</a></tt> is true then the
statement following <tt>then</tt> is followed. If it is false and an else part
is present, the statement following <tt>else<a name="else32">
</a></tt> is executed.
<p>
<h3><a name="tth_sEc3.2.7">
3.2.7</a>&nbsp;&nbsp;Case statement</h3>
<p>
The case<a name="case32">
</a> statement specifies an expression which is evaluated and
which must be of integral or ordinal type. Dependent upon the value of the expression
control transfers to the statement labelled by the matching constant.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;case statement&#62;</td><td align="center">'case'&lt;expression&#62;'of'&lt;case actions&#62;'end'</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;case actions&#62;</td><td align="center">&lt;case list&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;case list&#62; 'else' &lt;statement&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;case list&#62; 'otherwise' &lt;statement&#62;</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;case list&#62;</td><td align="center">&lt;case list element&#62;[';'&lt;case list element.]*</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;case list element&#62;</td><td align="center">&lt;case label&#62;[',' &lt;case label&#62;]':'&lt;statement&#62;</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;case label&#62;</td><td align="center">&lt;constant&#62;</td></tr>
<tr><td align="center"></td><td align="center">&lt;constant&#62; '..' &lt;constant&#62;</td></tr></table>
<p>
</center>
<b>Examples&nbsp;&nbsp;</b>
<p>
<table>
<tr><td><tt>case</tt> i <tt>of</tt></td><td><tt>case</tt> c <tt>of</tt></td></tr>
<tr><td><tt>1:s:=abs s;</tt></td><td><tt>'a':write('A');</tt></td></tr>
<tr><td><tt>2:s:= sqrt s;</tt></td><td><tt>'b','B':write('B');</tt></td></tr>
<tr><td><tt>3: s:=0</tt></td><td><tt>'A','C'..'Z','c'..'z':write(' ');</tt></td></tr>
<tr><td><tt>end</tt></td><td><tt>end</tt></td></tr></table>
<p>
<h3><a name="tth_sEc3.2.8">
3.2.8</a>&nbsp;&nbsp;With statement</h3>
<p>
Within the component statement of the with<a name="with32">
</a> statement the fields
of the record variable can be referred to without prefixing them by the name
of the record variable. The effect is to import the component statement into
the scope defined by the record<a name="record32">
</a> variable declaration so that
the field-names appear as simple variable names.
<p>
<b>Example&nbsp;&nbsp;</b>
<p>
<tt>var s:record x,y:real end;</tt>
<p>
<tt>begin</tt>
<p>
<tt>with s do begin x:=0;y:=1 end ;</tt>
<p>
<tt>end</tt>
<p>
<h3><a name="tth_sEc3.2.9">
3.2.9</a>&nbsp;&nbsp;For statement</h3>
<p>
A for<a name="for32">
</a> statement executes its component statement repeatedly under
the control of an iteration<a name="iteration32">
</a> variable. The iteration variable
must be of an integral or ordinal type. The variable is either set to count
up through a range or down through a range.
<p>
<tt>for i:= e1 to<a name="to32">
</a> e2 do s</tt>
<p>
is equivalent to
<p>
<tt>i:=e1; temp:=e2;while i&lt;=temp do s;</tt>
<p>
whilst
<p>
<tt>for i:= e1 downto<a name="downto32">
</a> e2 do s</tt>
<p>
is equivalent to
<p>
<tt>i:=e1; temp:=e2;while i&#62;= temp do s;</tt>
<p>
<h3><a name="tth_sEc3.2.10">
3.2.10</a>&nbsp;&nbsp;While statement</h3>
<p>
A while<a name="while32">
</a> statement executes its component statement whilst its
boolean expression is true. The statement
<p>
<tt>while e do s</tt>
<p>
is equivalent to
<p>
<tt>10: if not e then goto 99; s; goto 10; 99:</tt>
<p>
<h3><a name="tth_sEc3.2.11">
3.2.11</a>&nbsp;&nbsp;Repeat statement</h3>
<p>
A repeat<a name="repeat32">
</a> statement executes its component statement at least
once, and then continues to execute the component statement until its component
expression becomes true.
<p>
<tt>repeat s until e</tt>
<p>
is equivalent to
<p>
<tt>10: s;if e then goto 99; goto 10;99:</tt>
<p>
<h2><a name="tth_sEc3.3">
3.3</a>&nbsp;&nbsp;Input Output </h2>
<p>
<center>
<table border="1">
<tr><td align="center">&lt;io statement&#62;</td><td align="center">'writeln'[&lt;outparamlist&#62;]</td></tr>
<tr><td align="center"></td><td align="center">'write'&lt;outparamlist&#62;</td></tr>
<tr><td align="center"></td><td align="center">'readln'[&lt;inparamlist&#62;]</td></tr>
<tr><td align="center"></td><td align="center">'read'&lt;inparamlist&#62;</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;outparamlist&#62;</td><td align="center">'('&lt;outparam&#62;[','&lt;outparam&#62;]*')'</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;outparam&#62;</td><td align="center">&lt;expression&#62;[':' &lt;expression&#62;] [':'&lt;expression&#62;] </td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;inparamlist&#62;</td><td align="center">'('&lt;variable&#62;[','&lt;variable&#62;]*')'</td></tr></table>
<p>
</center>Input and output are supported from and to the console and also from and to
files.
<p>
<h3><a name="tth_sEc3.3.1">
3.3.1</a>&nbsp;&nbsp;Input</h3>
<p>
The basic form of input is the <tt>read</tt> statement. This takes a list of
parameters the first of which may optionally be a file variable. If this file
variable is present it is the input file. In the absence of a leading file variable
the input file is the standard input stream. The parameters take the form of
variables into which appropriate translations of textual representations of
values in the file are read. The statement
<p>
<tt>read<a name="read33">
</a>(</tt><em>a,b,c</em><tt>) </tt>
<p>
where <em>a,b,c</em> are non file parameters is exactly equivalent to the sequence
of statements
<p>
<tt>read(</tt><em>a</em><tt>);read(</tt><em>b</em><tt>);read(</tt><em>c</em><tt>) </tt>
<p>
The <tt>readln</tt><a name="readln33">
</a> statement has the same effect as the read
statement but finishes by reading a new line from the input file. The representation
of the new line is operating system dependent. The statement
<p>
<tt>readln(</tt><em>a,b,c</em><tt>) </tt>
<p>
where <em>a,b,c</em> are non file parameters is thus exactly equivalent to the
sequence of statements
<p>
<tt>read(</tt><em>a</em><tt>);read(</tt><em>b</em><tt>);read(</tt><em>c</em><tt>);readln; </tt>
<p>
Allowed typed for read statements are: integers, reals, strings and enumerated
types.
<p>
<h3><a name="tth_sEc3.3.2">
3.3.2</a>&nbsp;&nbsp;Output </h3>
<p>
The basic form of output is the <tt>write<a name="write33">
</a></tt> statement. This
takes a list of parameters the first of which may optionally be a file variable.
If this file variable is present it is the output file. In the absence of a
leading file variable the output file is the console. The parameters take the
form of expressions whose values whose textual representations are written to
the output file. The statement
<p>
<tt>write(</tt><em>a,b,c</em><tt>) </tt>
<p>
where <em>a,b,c</em> are non file parameters is exactly equivalent to the sequence
of statements
<p>
<tt>write(</tt><em>a</em><tt>);write(</tt><em>b</em><tt>);write(</tt><em>c</em><tt>) </tt>
<p>
The <tt>writeln<a name="writeln33">
</a></tt> statement has the same effect as the write
statement but finishes by writing a new line to the output file. The representation
of the new line is operating system dependent. The statement
<p>
<tt>writeln(</tt><em>a,b,c</em><tt>) </tt>
<p>
where <em>a,b,c</em> are non file parameters is thus exactly equivalent to the
sequence of statements
<p>
<tt>write(</tt><em>a</em><tt>);write(</tt><em>b</em><tt>);write(</tt><em>c</em><tt>);writeln; </tt>
<p>
Allowed types for write statements are integers, reals, strings and enumerated
types.
<p>
<h4>Parameter formating<a name="formating33">
</a> </h4>
<p>
A non file parameter can be followed by up to two integer expressions prefixed
by colons which specify the field widths to be used in the output. The write
parameters can thus have the following forms:
<p>
<em>e e</em>:<em>m e</em>:<em>m</em>:<em>n </em>
<p>
<ol type="1"><p>
<li> If <em>e</em> is an integral type its decimal expansion will be written preceeded
by sufficient blanks to ensure that the total textual field width produced is
not less than <em>m</em>.</li>
<p>
<li> If <em>e</em> is a real its decimal expansion will be written preceeded by sufficient
blanks to ensure that the total textual field width produced is not less than
<em>m</em>. If <em>n</em> is present the total number of digits after the decimal
point will be <em>n</em>. If <em>n</em> is omitted then the number will be written
out in exponent and mantissa form with 6 digits after the decimal point</li>
<p>
<li> If <em>e</em> is boolean the strings 'true' or 'false' will be written into a
field of width not less than m.</li>
<p>
<li> If <em>e</em> is a string then the string will be written into a field of width
not less than <em>m</em>.</li>
</ol>
<p>
<h1><a name="tth_chAp4">
Chapter 4 </a><br />Programs and Units</h1>
<a name="progunit">
</a>
Vector Pascal supports the popular system of separate compilation units<a name="units40">
</a>
found in Turbo<a name="Turbo Pascal40">
</a> Pascal. A compilation unit can be either
a program, a unit or a library<a name="library40">
</a>.
<p>
<center>
<table border="1">
<tr><td align="center">&lt;program&#62;</td><td align="center">'program' &lt;identifier&#62;';'[&lt;uses&#62;';']&lt;block&#62;'.'</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;invocation&#62;</td><td align="center">&lt;unitid&#62;['(' &lt;type identifier&#62;[','&lt;type identifier&#62;]*')']</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;unitid&#62;
</td><td align="center">&lt;identifier&#62;[ ':' 'apu' &lt;identifier&#62; '[' &lt;intconst&#62;']' ]</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;uses&#62;</td><td align="center">'uses' &lt;invocation&#62;[','&lt;invocation&#62;]*</td></tr></table>
<p>
</center><center>
<table border="1"><a name="block">
</a>
<tr><td align="center">&lt;block&#62;</td><td align="center">[&lt;decls&#62;';']*'begin' &lt;statement&#62;[';'&lt;statement&#62;]*'end'</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;decls&#62;</td><td align="center">'const' &lt;constant declaration&#62;[';'&lt;constant declaration&#62;]*</td></tr>
<tr><td align="center"></td><td align="center">'type'&lt;type definition&#62;[';'&lt;type definition&#62;]*</td></tr>
<tr><td align="center"></td><td align="center">'label' &lt;label&#62;[',' &lt;label&#62;]</td></tr>
<tr><td align="center"></td><td align="center">&lt;procedure declaration&#62;</td></tr>
<tr><td align="center"></td><td align="center">'var' &lt;variable declaration&#62;[ ';' &lt;variable declaration&#62; ]</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;unit&#62;</td><td align="center">&lt;unit header&#62; &lt;unit body&#62;</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;unit body&#62;</td><td align="center">'interface'[&lt;uses&#62;][&lt;decls&#62;] 'implementation'&lt;block&#62;'.'</td></tr>
<tr><td align="center"></td><td align="center">'interface'[ &lt;uses&#62;][&lt;decls&#62;] 'in' &lt;invocation&#62; ';'</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;unit header&#62;</td><td align="center">&lt;unit type&#62;&lt;identifier&#62;</td></tr>
<tr><td align="center"></td><td align="center">'unit' &lt;identifier&#62; '(' &lt;type identifier&#62; [',' &lt;type identifier&#62;]* ')'</td></tr></table>
<p>
</center><center>
<table border="1">
<tr><td align="center">&lt;unit type&#62;</td><td align="center">'unit'</td></tr>
<tr><td align="center"></td><td align="center">'library'</td></tr></table>
<p>
</center>An executable compilation unit must be declared as a program<a name="program40">
</a>.
The program can use several other compilation units all of which must be either
units or libraries. The units or libraries that it directly uses are specified
by a list of identifiers in an optional use list at the start of the program.
A unit or library has two declaration portions and an executable block.
<p>
<h2><a name="tth_sEc4.1">
4.1</a>&nbsp;&nbsp;The export of identifiers from units</h2>
<p>
The first declaration portion is the interface part and is preceded by the reserved
word <tt>interface</tt><a name="interface41">
</a>.
<p>
The definitions in the interface section of unit files constitute a sequence
of enclosing scopes, such that successive units in the with list ever more closely
contain the program itself. Thus when resolving an identifier, if the identifier
can not be resolved within the program scope, the declaration of the identifier
within the interface section of the rightmost unit in the uses list is taken
as the defining occurrence. It follows that rightmost occurrence of an identifier
definition within the interface parts of units on the uses list overrides all
occurrences in interface parts of units to its left in the uses list.
<p>
The implementation part of a unit consists of declarations<a name="declarations41">
</a>,
preceded by the reserved word <tt>implementatio</tt>n<a name="implementation41">
</a>
that are private to the unit with the exception that a function or procedure
declared in an interface context can omit the procedure body, provided that
the function or procedure is redeclared in the implementation part of the unit.
In that case the function or procedure heading given in the interface part is
taken to refer to the function or procedure of the same name whose body is declared
in the implementation part. The function or procedure headings sharing the same
name in the interface and implementation parts must correspond with respect
to parameter types, parameter order and, in the case of functions, with respect
to return types.
<p>
A unit may itself contain a use list, which is treated in the same way as the
use lists of a program. That is to say, the use list of a unit makes accessible
identifiers declared within the interface parts of the units named within the
use list to the unit itself.
<p>
<h3><a name="tth_sEc4.1.1">
4.1.1</a>&nbsp;&nbsp;The export of procedures from libraries.</h3>
<p>
If a compilation unit is prefixed by the reserved word <tt>library</tt> rather
than the words <tt>program</tt> or <tt>unit</tt>, then the procedure and function
declarations in its interface part are made accessible to routines written in
other languages.
<p>
<h3><a name="tth_sEc4.1.2">
4.1.2</a>&nbsp;&nbsp;The export of Operators from units</h3>
<p>
A unit can declare a type and export operators for that type.
<p>
<h2><a name="tth_sEc4.2">
4.2</a>&nbsp;&nbsp;Unit parameterisation and generic functions</h2>
Standard Pascal provides es some limited support for polymorphism<a name="polymorphism42">
</a>
in its <tt>read</tt> and <tt>write</tt> functions.
Vector Pascal allows the writing of polymorphic functions and
procedures through the use of parameteric units.
<p>
A unit header can include an optional parameter list. The parameters identifiers which are
interepreted as type names. These can be used to declare polymorphic procedures and
functions, parameterised by these type names.
This is shown in figure <a href="#unit:genericsort">4.1</a>.
<p>
<p>
<a name="tth_fIg4.1">
</a> ***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;
<br /><table align="left" border="0"><tr><td width="138">
<font size="-3"></font></td></tr></table><!--hbox-->
\'<br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><b>unit</b> <i>genericsort(t)</i> ;</font></td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><b>interface</b> </font></td></tr></table><!--hbox-->
<br />\&lt;<br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><b>type</b> </font></td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><i>dataarray</i> <i>(</i> <i>n</i> ,<i>m</i> :<i>integer</i> )=<b>array</b> [<i>n</i> ..<i>m</i> ] <b>of</b> <i>t</i> ;</font></td></tr></table><!--hbox-->
<br />\&lt;<font face="helvetica"><b>procedure</b> <i>sort</i> <i>(</i> <b>var</b> <i>a</i> :<i>dataarray</i> );</font> (see Figure <a href="#sec:./genericsortsort">4.2</a> )<br />
<br />
\&lt;<br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><b>implementation</b> </font></td></tr></table><!--hbox-->
<br /><br />\&lt;<font face="helvetica"><b>procedure</b> <i>sort</i> <i>(</i> <b>var</b> <i>a</i> :<i>dataarray</i> );</font> (see Figure <a href="#sec:./genericsortsort">4.2</a> )<br />
\&lt;<br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><b>begin</b> </font></td></tr></table><!--hbox-->
<br />\&lt;<br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><b>end</b> .</font></td></tr></table><!--hbox-->
<br />
<center>Figure 4.1: A polymorphic sorting unit.</center><a name="unit:genericsort">
</a>
<p>
<p>
<p>
<a name="tth_fIg4.2">
</a> ***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;
<br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><b>procedure </b> <font face="helvetica"> <i>sort</i> <i>(</i> </font> <b> var </b> <font face="helvetica"> <i>a</i> :<i>dataarray</i> );</font></font></td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><b>var</b> </font></td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica">Let <i>i</i>, <i>j</i> <font face="symbol">Î</font
> integer;</font></td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica">Let <i>temp</i> <font face="symbol">Î</font
> t;</font></td></tr></table><!--hbox-->
<br />\&lt;<br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><b>begin</b> </font></td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><b>for </b> <font face="helvetica"><i>i</i><font face="symbol">¬</font
> <i>a.n</i></font> <b> to </b> <font face="helvetica"><i>a.m</i> - 1</font> <b> do </b> </font></td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><b>for </b> <font face="helvetica"><i>j</i><font face="symbol">¬</font
> <i>a.n</i></font> <b> to </b> <font face="helvetica"><i>a.m</i> - 1</font> <b> do </b> </font></td></tr></table><!--hbox-->
<br />\&lt;<br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><b>if </b> <font face="helvetica"><i>a</i><sub><i>j</i></sub> &gt; <i>a</i><sub><i>j</i> + 1</sub></font> <b> then </b> <font face="helvetica"><i>begin</i></font> <b> begin </b> </font></td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><i>temp</i><font face="symbol">¬</font
> <i>a</i><sub><i>j</i></sub></font>; </td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><i>a</i><sub><i>j</i></sub> <font face="symbol">¬</font
> <i>a</i><sub><i>j</i> + 1</sub></font>; </td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><i>a</i><sub><i>j</i> + 1</sub> <font face="symbol">¬</font
> <i>temp</i></font>; </td></tr></table><!--hbox-->
<br />\&lt;<br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><b>end</b> ;</font></td></tr></table><!--hbox-->
<br />\&lt;\&lt;\&lt;<br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><b>end</b> ;</font></td></tr></table><!--hbox-->
<br />
<center>Figure 4.2: procedure sort</center><a name="sec:./genericsortsort">
</a>
<p>
<p>
<h2><a name="tth_sEc4.3">
4.3</a>&nbsp;&nbsp;The invocation of programs and units</h2>
<p>
Programs and units contain an executable block<a name="block43">
</a>. The rules for
the execution of these are as follows:
<p>
<ol type="1"><p>
<li> When a program is invoked by the operating system, the units or libraries in
its use list are invoked first followed by the executable block of the program
itself.</li>
<p>
<li> When a unit or library is invoked, the units or libraries in its use list are
invoked first followed by the executable block of the unit or library itself.</li>
<p>
<li> The order of invocation of the units or libraries in a use list is left to right
with the exception provided by rule 4.</li>
<p>
<li> No unit or library may be invoked more than once.</li>
</ol>
Note that rule 4 implies that a unit <em>x</em> to the right of a unit <em>y</em>
within a use list, may be invoked before the unit <em>y,</em> if the unit <em>y</em>
or some other unit to <em>y</em>'s left names <em>x</em> in its use list.
<p>
Note that the executable part of a library will only be invoked if the library
in the context of a Vector Pascal program. If the library is linked to a main
program in some other language, then the library and any units that it uses
will not be invoked. Care should thus be taken to ensure that Vector Pascal
libraries to be called from main programs written in other languages do not
depend upon initialisation code contained within the executable blocks of units.
<p>
<h2><a name="tth_sEc4.4">
4.4</a>&nbsp;&nbsp;The compilation of programs and units.</h2>
<p>
When the compiler<a name="compiler44">
</a> processes the use list of a unit or a program
then, from left to right, for each identifier in the use list it attempts to
find an already compiled unit whose filename prefix is equal to the identifier.
If such a file exists, it then looks for a source<a name="source44">
</a> file whose
filename prefix is equal to the identifier, and whose suffix<a name="suffix44">
</a>
is <tt>.pas</tt><a name="'.pas'44">
</a>. If such a file exists and is older than the
already compiled file, the already compiled unit, the compiler loads the definitions
contained in the pre-compiled unit. If such a file exists and is newer than
the pre-compiled unit, then the compiler attempts to re-compile the unit source
file. If this recompilation proceeds without the detection of any errors the
compiler loads the definitions of the newly compiled unit. The definitions in
a unit are saved to a file with the suffix <tt>.mpu,</tt> and prefix given by
the unit name. The compiler also generates an assembler file for each unit compiled.
<p>
<h3><a name="tth_sEc4.4.1">
4.4.1</a>&nbsp;&nbsp;Linking to external libraries</h3>
<p>
It is possible to specify to which external libraries - that is to say libraries
written in another languge, a program should be linked by placing in the main
program linkage directives. For example
<p>
<tt>{$linklib ncurses}</tt>
<p>
would cause the program to be linked to the ncurses library.
<p>
<h2><a name="tth_sEc4.5">
4.5</a>&nbsp;&nbsp;Instantiation of parametric units</h2>
Instantiation of a parametric unit refers to the process by which the unbound type variables introduced
in the parameter list of the unit are bound to actual types.
In Vector Pascal all instantiation of parametric units and all type polymorphism are resolved<a name="polymorphism45">
</a>
at compile time.
Two mechanisms are provided by which a parametric unit may be instantiated.
<h3><a name="tth_sEc4.5.1">
4.5.1</a>&nbsp;&nbsp;Direct instantiation</h3>
If a generic unit is invoked in the use list of a program or unit, then the unit name
must be followed by a list of type identifiers. Thus given the generic sort unit
in figure <a href="#unit:genericsort">4.1</a>, one could instantiate it to sort arrays of reals by
writing
<p>
<font face="helvetica"><b>uses </b> <i>genericsort</i>(<i>real</i>);</font>
<p>
at the head of a program. Following this header, the
procedure <font face="helvetica"><i>sort</i></font> would be declared as operating
on arrays of reals.
<h3><a name="tth_sEc4.5.2">
4.5.2</a>&nbsp;&nbsp;Indirect instantiation</h3>
A named unit file can indirectly instantiate a generic unit where its unit body
uses the syntax
<p>
'interface' &lt;uses&#62;&lt;decls&#62; 'in' &lt;invocation&#62; ';'
<p>
For example
<p>
***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;***&#175;
<br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><b>unit</b> <i>intsort</i> ;</font></td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><b>interface</b> </font></td></tr></table><!--hbox-->
<br /><br /><table align="left" border="0"><tr><td width="553">
<font face="helvetica"><b>in </b> <font face="helvetica"><i>genericsort</i> (<i>integer</i>)</font>; </font></td></tr></table><!--hbox-->
<br /><br />would create a named unit to sort integers. The naming of the parametric
units allows more than one instance of a given parametric unit to be used
in a program. The generic sort unit could be used to provide both integer and
real sorting procedures. The different variants of the procedures would be
distinquished by using fully qualified names - e.g., <font face="helvetica"><i> intsort.sort</i></font>.
<h2><a name="tth_sEc4.6">
4.6</a>&nbsp;&nbsp;The System Unit</h2>
<a name="sysunit">
</a>
All programs and units include by default the unit system.pas as an implicit
member of their with list. This contains declarations of private run time routines
needed by Vector Pascal and also the following user accessible routines.
<p>
<dl compact="compact">
<dt><b><tt>function</tt></b></dt>
<dd><tt>abs<a name="abs46">
</a></tt> Return absolute value of a real or integer.</dd>
<dt><b><tt>procedure</tt></b></dt>
<dd><tt>append<a name="append46">
</a>(var f:file);</tt> This opens a
file in append mode.</dd>
<dt><b><tt>function</tt></b></dt>
<dd><tt>arctan<a name="arctan46">
</a>(x:Real):Real;</tt></dd>
<dt><b><tt>procedure</tt></b></dt>
<dd><tt>assign<a name="assign46">
</a>(var f:file;var fname:string);</tt>
Associates a file name with a file. It does not open the file.</dd>
<dt><b><tt>procedure</tt></b></dt>
<dd><tt>blockread<a name="blockread46">
</a>(var f:file;var buf;count:integer;
var resultcount:integer);</tt> Trys to read count bytes from the file into the buffer.
Resultcount contains the number actually read.</dd>
<dt><b><tt>LatexCommand</tt></b></dt>
<dd><tt>index{blockwrite}procedure
blockwrite(var f:file;var buf;count:integer; var resultcount:integer);</tt> Write
count bytes from the buffer. Resultcount gives the number actually read.</dd>
<dt><b><tt>procedure</tt></b></dt>
<dd><tt>close</tt><a name="close46">
</a>(var f:file); Closes a file.</dd>
<dt><b><tt>function</tt></b></dt>
<dd><tt>eof</tt><a name="eof46">
</a>(var f:file):boolean; True if we
are at the end of file f.</dd>
<dt><b><tt>procedure</tt></b></dt>
<dd><tt>erase</tt><a name="erase46">
</a>(var f:file); Delete file f.</dd>
<dt><b><tt>function</tt></b></dt>
<dd><tt>eoln</tt><a name="eoln46">
</a>(var f:file):boolean; True if at
the end of a line.</dd>
<dt><b><tt>function</tt></b></dt>
<dd><tt>exp</tt><a name="exp46">
</a>(d:real):real; Return e<sup>x</sup> </dd>
<dt><b><tt>function</tt></b></dt>
<dd><tt>filesize</tt><a name="filesize46">
</a>(var f: fileptr):integer;
Return number of bytes in a file.</dd>
<dt><b><tt>function</tt></b></dt>
<dd><tt>filepos</tt><a name="filepos46">
</a>(var f:fileptr):integer;
Return current position in a file.</dd>
<dt><b><tt>procedure</tt></b></dt>
<dd><tt>freemem<a name="freemem46">
</a>(var p:pointer; num:integer);</tt>
Free num bytes of heap store. Called by dispose.</dd>
<dt><b>bold</b></dt>
<dd>procedure getmem<a name="getmem46">
</a>(var p:pointer; num:integer); Allocate
num bytes of heap. Called by new.</dd>
<dt><b><tt>procedure</tt></b></dt>
<dd><tt>gettime<a name="gettime46">
</a>(var hour,min,sec,hundredth:integer);</tt>
Return time of day.</dd>
<dt><b><tt></tt></b></dt>
<dd>Return the integer part of r as a real.</dd>
<dt><b><tt>function</tt></b></dt>
<dd><tt>ioresult:integer;</tt> Returns a code indicating if the
previous file operation completed ok. Zero if no error occurred.</dd>
<dt><b><tt>function</tt></b></dt>
<dd><tt>length<a name="length46">
</a>(var s:string):integer;</tt> Returns
the length of s.</dd>
<dt><b><tt>procedure</tt></b></dt>
<dd><tt>pascalexit<a name="pascalexit46">
</a>(code:integer);</tt> Terminate
the program with code.</dd>
<dt><b><tt></tt></b></dt>
<dd>Time in 1/100 seconds since program started.</dd>
<dt><b><tt>function</tt></b></dt>
<dd><tt>random<a name="random46">
</a>:integer;</tt> Returns a random
integer.</dd>
<dt><b><tt>procedure</tt></b></dt>
<dd><tt>randomize<a name="randomize46">
</a>;</tt> Assign a new time
dependent seed to the random number generator.</dd>
<dt><b><tt>procedure</tt></b></dt>
<dd><tt>reset<a name="reset46">
</a>(var f:file);</tt> Open a file for
reading.</dd>
<dt><b><tt>procedure</tt></b></dt>
<dd><tt>rewrite<a name="rewrite46">
</a>(var f :file);</tt> Open a file
for writing.</dd>
<dt><b><tt>function</tt></b></dt>
<dd><tt>trunc(r:real):integer;</tt> Truncates a real to an integer.
</dd>
</dl>
<p>
<h1><a name="tth_chAp5">
Chapter 5 </a><br />Implementation issues</h1>
<p>
The compiler is implemented in java to ease portability between operating systems.
<p>
<h2><a name="tth_sEc5.1">
5.1</a>&nbsp;&nbsp;Invoking the compiler</h2>
<p>
The compiler is invoked with the command <a name="commandline">
</a>
<p>
<dl compact="compact">
<dt><b></b></dt>
<dd>
vpc<a name="vpc51">
</a>&nbsp;filename
</dd>
</dl>
where filename is the name of a Pascal program or unit. For example
<p>
<dl compact="compact">
<dt><b></b></dt>
<dd>
vpc&nbsp;test
</dd>
</dl>
will compile the program test.pas and generate an executable file <tt>test</tt>,
(<tt>test.exe</tt> under windows).
<p>
The command <tt>vpc</tt> is a shell script which invokes the java runtime system
to execute a <tt>.jar</tt> file containing the compiler classes. Instead of
running vpc the java interpreter can be directly invoked as follows
<p>
<dl compact="compact">
<dt><b></b></dt>
<dd>
java&nbsp;-jar&nbsp;mmpc.jar&nbsp;filename
</dd>
</dl>
The <tt>vpc</tt> script sets various compiler options appropriate to the operating
system being used.
<p>
<h3><a name="tth_sEc5.1.1">
5.1.1</a>&nbsp;&nbsp;Environment variable</h3>
<p>
The environment variable <tt>mmpcdir<a name="mmpcdir51">
</a></tt> must be set to the
directory which contains the <tt>mmpc<a name="mmpc51">
</a>.jar</tt> file, the runtime
library <tt>rtl.o</tt> and the <tt>system.pas</tt> file.
<p>
<h3><a name="tth_sEc5.1.2">
5.1.2</a>&nbsp;&nbsp;Compiler options</h3>
<a name="comp:opt">
</a>
The following flags<a name="flags51">
</a> can be supplied to the compiler :
<p>
<dl compact="compact">
<dt><b><tt>-L</tt></b></dt>
<dd> Causes a latex listing to be produced of
all files compiled. The level of detail can be controled
using the codes -L1 to -L3, otherwise the maximum detail level is used.</dd>
<dt><b><tt>-OPTn</tt></b></dt>
<dd> Sets the optimisation level attempted.
-OPT0 is no optimisation, -OPT3 is the maximum level attempted.
The default is -OPT1.</dd>
<dt><b><tt>-Afilename<a name="-Afilename51">
</a></tt></b></dt>
<dd>Defines the assembler file to be created.
In the absence of this option the assembler file is <tt>p.asm.</tt></dd>
<dt><b><tt>-Ddirname<a name="-Ddirname51">
</a></tt></b></dt>
<dd>Defines the directory in which to find
<tt>rtl.o</tt> and <tt>system.pas</tt>.</dd>
<dt><b><tt>-BOEHM</tt><a name="-BOEHM51">
</a><a name="garbage collection51">
</a><a name="garbage">
</a><a name="BOEHM">
</a></b></dt>
<dd>
Causes the program to be linked with the Boehm conservative garbage
collector.</dd>
<dt><b><tt>-V<a name="-V51">
</a></tt></b></dt>
<dd>Causes the code generator to produce a verbose diagnostic
listing to <tt>foo.lst</tt> when compiling <tt>foo.pas</tt>.</dd>
<dt><b><tt>-oexefile<a name="-oexefile51">
</a></tt></b></dt>
<dd>Causes the linker to output to <tt>exefile</tt>
instead of the default output of <tt>p.exe.</tt></dd>
<dt><b><tt>-U<a name="-U51">
</a></tt></b></dt>
<dd>Defines whether references to external procedures in
the assembler file should be preceded by an under-bar '_'. This is required
for the coff object format but not for elf.</dd>
<dt><b><tt>-S<a name="-S51">
</a></tt></b></dt>
<dd>Suppresses assembly and linking of the program. An assembler
file is still generated.</dd>
<dt><b><tt>-fFORMAT<a name="-fFORMAT51">
</a></tt></b></dt>
<dd>Specifies the object format to be generated
by the assembler. The object formats currently used are elf when compiling under
Unix or when compiling under windows using the cygwin version of the gcc linker,
or coff when using the djgpp version of the gcc linker. for other formats consult
the NASM documentation.</dd>
<dt><b><tt>-cpuCGFLAG<a name="-cpuCGFLAG51">
</a></tt></b></dt>
<dd>Specifies the code generator to be used.
Currently the code generators shown in table <a href="#cgs">5.1</a> are supported.</dd>
<dt><b></b></dt>
<dd>
<p>
<a name="tth_tAb5.1">
</a> <center>Table 5.1: Code generators supported<a name="cgs">
</a></center>
<center>
<table border="1">
<tr><td align="center"><tt>CGFLAG</tt></td><td><tt>description</tt></td></tr><tr><td>
<tr><td align="center"><tt>IA<a name="IA3251">
</a>32</tt></td><td>generates code for the Intel 486 instruction-set</td></tr>
<tr><td align="center"></td><td>uses the NASM assembler</td></tr>
<tr><td align="center"><tt>Pentium<a name="Pentium51">
</a></tt></td><td>generates code for the Intel P6 with MMX instruction-set</td></tr>
<tr><td align="center"></td><td>uses the NASM <a name="NASM51">
</a> assembler</td></tr><tr><td>
<tr><td align="center"><tt>gnuPentium<a name="Pentium51">
</a></tt></td><td>generates code for the Intel P6 with MMX instruction-set</td></tr>
<tr><td align="center"></td><td>using the <tt>as</tt> <a name="as51">
</a> assembler in the gcc package</td></tr>
<tr><td align="center"><tt>K6<a name="K651">
</a></tt></td><td>generates code for the AMD<a name="AMD51">
</a> K6 instruction-set, use for Athlon</td></tr>
<tr><td align="center"></td><td>uses the NASM assembler</td></tr>
<tr><td align="center"><tt>P3<a name="P351">
</a></tt></td><td>generates code for the Intel<a name="Intel51">
</a> PIII processor family<tt></tt></td></tr>
<tr><td align="center"></td><td>uses the NASM assembler</td></tr>
<tr><td align="center"><tt>P4</tt> </td><td>generates code for the Intel PIV family and Athlon XP</td></tr>
<tr><td align="center"></td><td>uses the NASM assembler</td></tr></table>
<p>
</center>
<p>
</dd>
</dl> <h3><a name="tth_sEc5.1.3">
5.1.3</a>&nbsp;&nbsp;Dependencies</h3>
<p>
The Vector Pascal compiler depends upon a number of other utilities which are
usually pre-installed on Linux systems, and are freely available for Windows
systems.
<p>
<dl compact="compact">
<dt><b>NASM</b></dt>
<dd>The net-wide assembler. This is used to convert the output of the code
generator to linkable modules. It is freely available on the web for Windows.
For the Pentium processor it is possible to use the <tt>as</tt> assembler instead.</dd>
<dt><b>gcc</b></dt>
<dd>The GNU C Compiler, used to compile the run time library and to link modules
produced by the assembler to the run time library.</dd>
<dt><b>java</b></dt>
<dd>The java virtual machine must be available to interpret the compiler.
There are number of java interpreters and just in time compilers are freely available
for Windows.
</dd>
</dl>
<p>
<h2><a name="tth_sEc5.2">
5.2</a>&nbsp;&nbsp;Calling conventions</h2>
<p>
Procedure parameters are passed using a modified C calling convention to facilitate
calls to external C procedures. Parameters are pushed on to the stack from right
to left. Value parameters are pushed entire onto the stack, var parameters are
pushed as addresses.
<p>
<b>Example &nbsp;&nbsp;</b>
<p>
<dl compact="compact">
<dt><b></b></dt>
<dd>
<span class="roman"><tt><font size="-1">unit&nbsp;callconv;</font></tt></span><font size="-1">
<p>
</font><span class="roman"><tt><font size="-1">interface</font></tt></span><font size="-1">
<p>
</font><span class="roman"><tt><font size="-1">type&nbsp;intarr=&nbsp;array[1..8]&nbsp;of&nbsp;integer;</font></tt></span><font size="-1">
<p>
</font><span class="roman"><tt><font size="-1">procedure&nbsp;foo(var&nbsp;a:intarr;&nbsp;b:intarr;&nbsp;c:integer);</font></tt></span><font size="-1">
<p>
</font><span class="roman"><tt><font size="-1">implementation</font></tt></span><font size="-1">
<p>
</font><span class="roman"><tt><font size="-1">procedure&nbsp;foo(var&nbsp;a:intarr;&nbsp;b:intarr;&nbsp;c:integer);</font></tt></span><font size="-1">
<p>
</font><span class="roman"><tt><font size="-1">begin</font></tt></span><font size="-1">
<p>
</font><span class="roman"><tt><font size="-1">end;</font></tt></span><font size="-1">
<p>
</font><span class="roman"><tt><font size="-1">var&nbsp;x,y:intarr;</font></tt></span><font size="-1">
<p>
</font><span class="roman"><tt><font size="-1">begin</font></tt></span><font size="-1">
<p>
</font>&nbsp;<span class="roman"><tt><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foo(x,y,3);</font></tt></span><font size="-1">
<p>
</font><span class="roman"><tt><font size="-1">end.</font></tt></span><font size="-1">
<p>
</font></dd>
</dl>This would generate the following code for the procedure foo.
<p>
<dl compact="compact">
<dt><b></b></dt>
<dd>
<tt><font size="-2">;&nbsp;procedure&nbsp;generated&nbsp;by&nbsp;code&nbsp;generator&nbsp;class&nbsp;ilcg.tree.PentiumCG</font></tt><font size="-2">
<p>
</font><tt><font size="-2">le8e68de10c5:</font></tt><font size="-2">
<p>
</font><tt><font size="-2">;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foo</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">enter&nbsp;&nbsp;&nbsp;spaceforfoo-4*1,1</font></tt><font size="-2">
<p>
</font><tt><font size="-2">;8</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">le8e68de118a:</font></tt><font size="-2">
<p>
</font><tt><font size="-2">spaceforfoo&nbsp;equ&nbsp;4</font></tt><font size="-2">
<p>
</font><tt><font size="-2">;....&nbsp;code&nbsp;for&nbsp;foo&nbsp;goes&nbsp;here</font></tt><font size="-2">
<p>
</font><tt><font size="-2">fooexit:</font></tt><font size="-2">
<p>
</font><tt><font size="-2">leave</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">ret&nbsp;0</font></tt><font size="-2">
<p>
</font></dd>
</dl>and the calling code is
<p>
<dl compact="compact">
<dt><b></b></dt>
<dd>
&nbsp;<tt><font size="-2">push&nbsp;DWORD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;push&nbsp;rightmost&nbsp;argument</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">lea&nbsp;esp,[&nbsp;&nbsp;esp-32]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;create&nbsp;space&nbsp;for&nbsp;the&nbsp;array</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">mov&nbsp;DWORD&nbsp;&nbsp;[&nbsp;&nbsp;ebp&nbsp;-52],0&nbsp;&nbsp;;&nbsp;for&nbsp;loop&nbsp;to&nbsp;copy&nbsp;the&nbsp;array</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">le8e68de87fd:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;the&nbsp;loop&nbsp;is&nbsp;</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;unrolled&nbsp;twice&nbsp;and</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">cmp&nbsp;DWORD&nbsp;&nbsp;[&nbsp;&nbsp;ebp-52],&nbsp;7&nbsp;&nbsp;;&nbsp;parallelised&nbsp;to&nbsp;copy&nbsp;</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;16&nbsp;bytes&nbsp;per&nbsp;cycle</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">jg&nbsp;near&nbsp;&nbsp;le8e68de87fe</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">mov&nbsp;ebx,DWORD&nbsp;&nbsp;[&nbsp;&nbsp;ebp&nbsp;&nbsp;-52]</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">imul&nbsp;&nbsp;&nbsp;ebx,&nbsp;&nbsp;&nbsp;&nbsp;4</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">movq&nbsp;MM1,&nbsp;[&nbsp;&nbsp;ebx+&nbsp;le8e68dddaa2-48]</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">movq&nbsp;&nbsp;[&nbsp;&nbsp;esp+ebx],MM1</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">mov&nbsp;eax,DWORD&nbsp;&nbsp;[&nbsp;&nbsp;ebp+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-52]</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">lea&nbsp;ebx,[&nbsp;&nbsp;eax+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2]</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">imul&nbsp;&nbsp;&nbsp;ebx,&nbsp;&nbsp;&nbsp;&nbsp;4</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">movq&nbsp;MM1,&nbsp;[&nbsp;&nbsp;ebx+&nbsp;le8e68dddaa2&nbsp;-48]</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">movq&nbsp;&nbsp;[&nbsp;&nbsp;esp+ebx],MM1</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">lea&nbsp;ebx,[&nbsp;&nbsp;ebp+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-52]</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">add&nbsp;&nbsp;DWORD&nbsp;&nbsp;[&nbsp;ebx],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">jmp&nbsp;&nbsp;le8e68de87fd</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">le8e68de87fe:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;end&nbsp;of&nbsp;array&nbsp;</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;copying&nbsp;loop</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">push&nbsp;DWORD&nbsp;&nbsp;le8e68dddaa2-32&nbsp;;&nbsp;push&nbsp;the&nbsp;address&nbsp;of&nbsp;the&nbsp;</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;var&nbsp;parameter</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">EMMS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;clear&nbsp;MMX&nbsp;state</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">&nbsp;call&nbsp;le8e68de10c5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;call&nbsp;the&nbsp;local&nbsp;</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;label&nbsp;for&nbsp;foo</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">add&nbsp;esp,&nbsp;40&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;free&nbsp;space&nbsp;on&nbsp;the&nbsp;stack</font></tt><font size="-2">
<p>
</font></dd>
</dl>
<h4>Function results</h4>
<p>
Function results are returned in registers for scalars following the C calling
convention for the operating system on which the compiler is implemented. Records,
strings and sets are returned by the caller passing an implicit parameter containing
the address of a temporary buffer in the calling environment into which the
result can be assigned. Given the following program
<p>
<tt>program</tt>
<p>
<tt>type t1= set of char;</tt>
<p>
<tt>var x,y:t1;</tt>
<p>
<tt>function bar:t1;begin bar:=y;end;</tt>
<p>
<tt>&nbsp;</tt>
<p>
<tt>begin</tt>
<p>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x:=bar;</tt>
<p>
<tt>end.</tt>
<p>
The call of bar would generate
<p>
<dl compact="compact">
<dt><b></b></dt>
<dd>
&nbsp;<font size="-2"></font><tt><font size="-2">push&nbsp;ebp</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">add&nbsp;&nbsp;dword[esp]&nbsp;,&nbsp;-128&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;address&nbsp;of&nbsp;buffer&nbsp;on&nbsp;stack</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">call&nbsp;le8eb6156ca8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;call&nbsp;bar&nbsp;to&nbsp;place&nbsp;</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;result&nbsp;in&nbsp;buffer</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">add&nbsp;esp,&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;discard&nbsp;the&nbsp;address</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">mov&nbsp;DWORD&nbsp;&nbsp;[&nbsp;&nbsp;ebp+&nbsp;-132],&nbsp;0;&nbsp;for&nbsp;loop&nbsp;to&nbsp;copy&nbsp;</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;the&nbsp;set&nbsp;16&nbsp;bytes</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">le8eb615d99f:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;at&nbsp;a&nbsp;time&nbsp;into&nbsp;x&nbsp;using&nbsp;the&nbsp;</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;MMX&nbsp;registers</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">cmp&nbsp;DWORD&nbsp;&nbsp;[&nbsp;&nbsp;ebp+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-132],&nbsp;&nbsp;31</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">jg&nbsp;near&nbsp;&nbsp;le8eb615d9910</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">mov&nbsp;ebx,DWORD&nbsp;&nbsp;[&nbsp;&nbsp;ebp+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-132]</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">movq&nbsp;MM1,&nbsp;[&nbsp;&nbsp;ebx+ebp&nbsp;+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-128]</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">movq&nbsp;&nbsp;[&nbsp;&nbsp;ebx+ebp&nbsp;+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-64],MM1</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">mov&nbsp;eax,DWORD&nbsp;&nbsp;[&nbsp;&nbsp;ebp+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-132]</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">lea&nbsp;ebx,[&nbsp;&nbsp;eax+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8]</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">movq&nbsp;MM1,&nbsp;[&nbsp;&nbsp;ebx+ebp&nbsp;+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-128]</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">movq&nbsp;&nbsp;[&nbsp;&nbsp;ebx+ebp&nbsp;+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-64],MM1</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">lea&nbsp;ebx,[&nbsp;&nbsp;ebp+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-132]</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">add&nbsp;&nbsp;DWORD&nbsp;&nbsp;[&nbsp;ebx],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">jmp&nbsp;&nbsp;le8eb615d99f</font></tt><font size="-2">
<p>
</font>&nbsp;<tt><font size="-2">le8eb615d9910:</font></tt><font size="-2">
<p>
</font></dd>
</dl> <h2><a name="tth_sEc5.3">
5.3</a>&nbsp;&nbsp;Array representation</h2>
<p>
The maximum number of array dimensions supported in the compiler is 5.
<p>
A static<a name="static53">
</a> array<a name="array, static53">
</a> is represented simply by
the number of bytes required to store the array being allocated in the global
segment or on the stack.
<p>
A dynamic array<a name="array53">
</a><a name="array, dynamic53">
</a> is always represented on
the heap<a name="heap53">
</a>. Since its rank<a name="rank53">
</a> is known to the compiler
what needs to be stored at run time are the bounds and the means to access it.
For simplicity we make the format of dynamic and conformant arrays the same.
Thus for schema<a name="schema53">
</a>
<p>
<tt>s(a,b,c,d:integer)= array[a..b,c..d] of integer </tt>
<p>
whose run time bounds are evaluated to be 2..4,3..7 we would have the following
structure:
<p>
<center>
<table border="1">
<tr><td align="center">address</td><td align="center">field</td><td align="center">value</td></tr><tr><td>
<tr><td align="center">x</td><td align="center">base of data</td><td align="center">address of first integer in the array</td></tr>
<tr><td align="center">x+4</td><td align="center">a</td><td align="center">2</td></tr>
<tr><td align="center">x+8</td><td align="center">b</td><td align="center">4</td></tr>
<tr><td align="center">x+12</td><td align="center">step</td><td align="center">20</td></tr>
<tr><td align="center">x+16</td><td align="center">c</td><td align="center">3</td></tr>
<tr><td align="center">x+20</td><td align="center">d</td><td align="center">7</td></tr></table>
<p>
</center>The base address for a schematic array on the heap, will point at the first
byte after the array header show. For a conformant array, it will point at the
first data byte of the array or array range<a name="range53">
</a> being passed as a
parameter. The step field specifies the length of an element of the second dimension
in bytes. It is included to allow for the case where we have a conformant<a name="conformant53">
</a>
array<a name="array, conformant53">
</a> formal parameter
<p>
<tt>x:array[a..b:integer,c..d:integer] of integer</tt>
<p>
to which we pass as actual parameter<a name="parameter53">
</a> the range
<p>
<tt>p[2..4,3..7] </tt>
<p>
as actual parameter, where <tt>p:array[1..10,1..10] of integer</tt>
<p>
In this case the base address would point at @p[2,3] and the step would
be 40 - the length of 10 integers.
<p>
<h3><a name="tth_sEc5.3.1">
5.3.1</a>&nbsp;&nbsp;Range<a name="range53">
</a> checking</h3>
<p>
When arrays are indexed, the compiler plants run time checks to see if the indices
are within bounds<a name="bounds53">
</a>. In many cases the optimiser is able to remove
these checks, but in those cases where it is unable to do so, some performance
degradation can occur. Range checks can be disabled or enabled by the compiler
directives.
<p>
{$r-} { disable range checks }
<p>
{$r+} { enable range checks }
<p>
Performance can be further enhanced by the practice of declaring arrays to have
lower bounds of zero. The optimiser is generally able to generate more efficient
code for zero based arrays.
<p>
<a name="ilcg">
</a>
<p>
<p>
<p>
<a name="tth_sEcindex"></a>
<h2> Index (showing section)</h2>
<table width="100%"><tr><td width="48%" valign="top">
<dl compact="compact">
<dt><b></b></dt>
<dd>'.pas', <a href="#'.pas'44">4-4</a></dd>
<dt><b></b></dt>
<dd>(*, <a href="#(*13">1-3</a></dd>
<dt><b></b></dt>
<dd>*), <a href="#*)13">1-3</a></dd>
<dt><b></b></dt>
<dd>**, <a href="#**31">3-1</a></dd>
<dt><b></b></dt>
<dd>+, <a href="#+31">3-1</a></dd>
<dt><b></b></dt>
<dd>+:, <a href="#+:31">3-1</a></dd>
<dt><b></b></dt>
<dd>-, <a href="#-31">3-1</a></dd>
<dt><b></b></dt>
<dd>-:, <a href="#-:31">3-1</a></dd>
<dt><b></b></dt>
<dd>-Afilename, <a href="#-Afilename51">5-1</a></dd>
<dt><b></b></dt>
<dd>-BOEHM, <a href="#-BOEHM51">5-1</a></dd>
<dt><b></b></dt>
<dd>-Ddirname, <a href="#-Ddirname51">5-1</a></dd>
<dt><b></b></dt>
<dd>-S, <a href="#-S51">5-1</a></dd>
<dt><b></b></dt>
<dd>-U, <a href="#-U51">5-1</a></dd>
<dt><b></b></dt>
<dd>-V, <a href="#-V51">5-1</a></dd>
<dt><b></b></dt>
<dd>-cpuCGFLAG, <a href="#-cpuCGFLAG51">5-1</a></dd>
<dt><b></b></dt>
<dd>-fFORMAT, <a href="#-fFORMAT51">5-1</a></dd>
<dt><b></b></dt>
<dd>-oexefile, <a href="#-oexefile51">5-1</a></dd>
<dt><b></b></dt>
<dd>:=, <a href="#:=32">3-2</a></dd>
<dt><b></b></dt>
<dd><tt>&gt;&lt;</tt>, <a href="#\verb+><+31">3-1</a><br /><br /></dd>
<dt><b></b></dt>
<dd>abs, <a href="#abs31">3-1</a>, <a href="#abs46">4-6</a></dd>
<dt><b></b></dt>
<dd>addr, <a href="#addr31">3-1</a></dd>
<dt><b></b></dt>
<dd>AMD, <a href="#AMD00">0-0</a>, <a href="#AMD51">5-1</a></dd>
<dt><b></b></dt>
<dd>and, <a href="#and31">3-1</a></dd>
<dt><b></b></dt>
<dd>APL, <a href="#APL00">0-0</a></dd>
<dt><b></b></dt>
<dd>append, <a href="#append46">4-6</a></dd>
<dt><b></b></dt>
<dd>arctan, <a href="#arctan46">4-6</a></dd>
<dt><b></b></dt>
<dd>array, <a href="#array23">2-3</a>, <a href="#array25">2-5</a>,
<a href="#array31">3-1</a>, <a href="#array32">3-2</a>,
<a href="#array53">5-3</a></dd>
<dt><b></b></dt>
<dd>array constant, <a href="#array constant21">2-1</a></dd>
<dt><b></b></dt>
<dd>array context, <a href="#array context32">3-2</a></dd>
<dt><b></b></dt>
<dd>array, conformant, <a href="#array, conformant53">5-3</a></dd>
<dt><b></b></dt>
<dd>array, dynamic, <a href="#array, dynamic23">2-3</a>,
<a href="#array, dynamic53">5-3</a></dd>
<dt><b></b></dt>
<dd>array, static, <a href="#array, static23">2-3</a>,
<a href="#array, static53">5-3</a></dd>
<dt><b></b></dt>
<dd>as, <a href="#as51">5-1</a></dd>
<dt><b></b></dt>
<dd>assign, <a href="#assign46">4-6</a></dd>
<dt><b></b></dt>
<dd>assignment, <a href="#assignment32">3-2</a></dl></td><td width="8%" valign="top">
<dl compact="compact">
</dd>
<dt><b></b></dt>
<dd>basis, <a href="#basis23">2-3</a></dd>
<dt><b></b></dt>
<dd>begin, <a href="#begin32">3-2</a></dd>
<dt><b></b></dt>
<dd>binary, <a href="#binary23">2-3</a></dd>
<dt><b></b></dt>
<dd>block, <a href="#block43">4-3</a></dd>
<dt><b></b></dt>
<dd>blockread, <a href="#blockread46">4-6</a></dd>
<dt><b></b></dt>
<dd>boolean, <a href="#boolean23">2-3</a>, <a href="#boolean31">3-1</a></dd>
<dt><b></b></dt>
<dd>bounds, <a href="#bounds53">5-3</a></dd>
<dt><b></b></dt>
<dd>byte, <a href="#byte23">2-3</a>, <a href="#byte31">3-1</a></dd>
<dt><b></b></dt>
<dd>bytes, <a href="#bytes31">3-1</a><br /><br /></dd>
<dt><b></b></dt>
<dd>C, <a href="#C00">0-0</a></dd>
<dt><b></b></dt>
<dd>cardinal, <a href="#cardinal23">2-3</a></dd>
<dt><b></b></dt>
<dd>case, <a href="#case32">3-2</a></dd>
<dt><b></b></dt>
<dd>cast, <a href="#cast31">3-1</a></dd>
<dt><b></b></dt>
<dd>char, <a href="#char23">2-3</a></dd>
<dt><b></b></dt>
<dd>character, <a href="#character31">3-1</a></dd>
<dt><b></b></dt>
<dd>charmax, <a href="#charmax23">2-3</a></dd>
<dt><b></b></dt>
<dd>chr, <a href="#chr31">3-1</a></dd>
<dt><b></b></dt>
<dd>close, <a href="#close46">4-6</a></dd>
<dt><b></b></dt>
<dd>cmplx, <a href="#cmplx31">3-1</a></dd>
<dt><b></b></dt>
<dd>comment, <a href="#comment13">1-3</a></dd>
<dt><b></b></dt>
<dd>compiler, <a href="#compiler44">4-4</a></dd>
<dt><b></b></dt>
<dd>complement, <a href="#complement31">3-1</a></dd>
<dt><b></b></dt>
<dd>Complex, <a href="#Complex31">3-1</a></dd>
<dt><b></b></dt>
<dd>complex, <a href="#complex23">2-3</a></dd>
<dt><b></b></dt>
<dd>complexone, <a href="#complexone21">2-1</a></dd>
<dt><b></b></dt>
<dd>complexzero, <a href="#complexzero21">2-1</a></dd>
<dt><b></b></dt>
<dd>concatenate, <a href="#concatenate31">3-1</a></dd>
<dt><b></b></dt>
<dd>conformant, <a href="#conformant53">5-3</a></dd>
<dt><b></b></dt>
<dd>constant, <a href="#constant21">2-1</a></dd>
<dt><b></b></dt>
<dd>constants, <a href="#constants21">2-1</a></dd>
<dt><b></b></dt>
<dd>cos, <a href="#cos31">3-1</a></dl></td></tr><tr><td width="48%" valign="top">
<dl compact="compact">
</dd>
<dt><b></b></dt>
<dd>declaration, <a href="#declaration20">2-0</a></dd>
<dt><b></b></dt>
<dd>declarations, <a href="#declarations41">4-1</a></dd>
<dt><b></b></dt>
<dd>Delphi, <a href="#Delphi00">0-0</a></dd>
<dt><b></b></dt>
<dd>dimension, <a href="#dimension31">3-1</a></dd>
<dt><b></b></dt>
<dd>dimensional, <a href="#dimensional23">2-3</a></dd>
<dt><b></b></dt>
<dd>dimensioned, <a href="#dimensioned23">2-3</a></dd>
<dt><b></b></dt>
<dd>dimensions, <a href="#dimensions32">3-2</a></dd>
<dt><b></b></dt>
<dd>div, <a href="#div31">3-1</a></dd>
<dt><b></b></dt>
<dd>double, <a href="#double23">2-3</a></dd>
<dt><b></b></dt>
<dd>downto, <a href="#downto32">3-2</a></dd>
<dt><b></b></dt>
<dd>Dynamic, <a href="#Dynamic23">2-3</a></dd>
<dt><b></b></dt>
<dd>dynamic, <a href="#dynamic23">2-3</a></dd>
<dt><b></b></dt>
<dd>dynamic array, <a href="#dynamic array23">2-3</a><br /><br /></dd>
<dt><b></b></dt>
<dd>else, <a href="#else32">3-2</a></dd>
<dt><b></b></dt>
<dd>end, <a href="#end32">3-2</a></dd>
<dt><b></b></dt>
<dd>eof, <a href="#eof46">4-6</a></dd>
<dt><b></b></dt>
<dd>eoln, <a href="#eoln46">4-6</a></dd>
<dt><b></b></dt>
<dd>epsreal, <a href="#epsreal21">2-1</a></dd>
<dt><b></b></dt>
<dd>erase, <a href="#erase46">4-6</a></dd>
<dt><b></b></dt>
<dd>Exit, <a href="#Exit32">3-2</a></dd>
<dt><b></b></dt>
<dd>exp, <a href="#exp46">4-6</a></dd>
<dt><b></b></dt>
<dd>Expressions, <a href="#Expressions31">3-1</a></dl></td><td width="8%" valign="top">
<dl compact="compact">
</dd>
<dt><b></b></dt>
<dd>Factor, <a href="#Factor31">3-1</a></dd>
<dt><b></b></dt>
<dd>false, <a href="#false23">2-3</a></dd>
<dt><b></b></dt>
<dd>Field, <a href="#Field25">2-5</a></dd>
<dt><b></b></dt>
<dd>filepos, <a href="#filepos46">4-6</a></dd>
<dt><b></b></dt>
<dd>filesize, <a href="#filesize46">4-6</a></dd>
<dt><b></b></dt>
<dd>fixed, <a href="#fixed23">2-3</a></dd>
<dt><b></b></dt>
<dd>flags, <a href="#flags51">5-1</a></dd>
<dt><b></b></dt>
<dd>for, <a href="#for32">3-2</a></dd>
<dt><b></b></dt>
<dd>formal parameter, <a href="#formal parameter26">2-6</a></dd>
<dt><b></b></dt>
<dd>formating, <a href="#formating33">3-3</a></dd>
<dt><b></b></dt>
<dd>Fortran, <a href="#Fortran00">0-0</a></dd>
<dt><b></b></dt>
<dd>fractions, <a href="#fractions23">2-3</a></dd>
<dt><b></b></dt>
<dd>freemem, <a href="#freemem46">4-6</a></dd>
<dt><b></b></dt>
<dd>function, <a href="#function31">3-1</a><br /><br /></dd>
<dt><b></b></dt>
<dd>garbage collection, <a href="#garbage collection51">5-1</a></dd>
<dt><b></b></dt>
<dd>getmem, <a href="#getmem46">4-6</a></dd>
<dt><b></b></dt>
<dd>gettime, <a href="#gettime46">4-6</a></dd>
<dt><b></b></dt>
<dd>goto, <a href="#goto22">2-2</a>, <a href="#goto32">3-2</a><br /><br /></dd>
<dt><b></b></dt>
<dd>heap, <a href="#heap53">5-3</a></dd>
<dt><b></b></dt>
<dd>hexadecimal, <a href="#hexadecimal15">1-5</a></dd>
<dt><b></b></dt>
<dd>high, <a href="#high23">2-3</a></dl></td></tr><tr><td width="48%" valign="top">
<dl compact="compact">
</dd>
<dt><b></b></dt>
<dd>IA32, <a href="#IA3251">5-1</a></dd>
<dt><b></b></dt>
<dd>identifier, <a href="#identifier14">1-4</a>,
<a href="#identifier23">2-3</a></dd>
<dt><b></b></dt>
<dd>IEEE, <a href="#IEEE23">2-3</a></dd>
<dt><b></b></dt>
<dd>if, <a href="#if32">3-2</a></dd>
<dt><b></b></dt>
<dd>implementation, <a href="#implementation41">4-1</a></dd>
<dt><b></b></dt>
<dd>implicit indices, <a href="#implicit indices31">3-1</a>,
<a href="#implicit indices32">3-2</a></dd>
<dt><b></b></dt>
<dd>index, <a href="#index23">2-3</a>, <a href="#index31">3-1</a></dd>
<dt><b></b></dt>
<dd>indices, <a href="#indices25">2-5</a>, <a href="#indices31">3-1</a>,
<a href="#indices32">3-2</a></dd>
<dt><b></b></dt>
<dd>int64, <a href="#int6423">2-3</a></dd>
<dt><b></b></dt>
<dd>integer, <a href="#integer15">1-5</a>, <a href="#integer23">2-3</a>,
<a href="#integer31">3-1</a></dd>
<dt><b></b></dt>
<dd>Intel, <a href="#Intel51">5-1</a></dd>
<dt><b></b></dt>
<dd>interface, <a href="#interface41">4-1</a></dd>
<dt><b></b></dt>
<dd>iota, <a href="#iota31">3-1</a></dd>
<dt><b></b></dt>
<dd>is, <a href="#is32">3-2</a></dd>
<dt><b></b></dt>
<dd>iteration, <a href="#iteration32">3-2</a><br /><br /></dd>
<dt><b></b></dt>
<dd>J, <a href="#J00">0-0</a></dd>
<dt><b></b></dt>
<dd>Java, <a href="#Java00">0-0</a><br /><br /></dd>
<dt><b></b></dt>
<dd>K6, <a href="#K600">0-0</a>, <a href="#K651">5-1</a><br /><br /></dd>
<dt><b></b></dt>
<dd>label, <a href="#label22">2-2</a>, <a href="#label32">3-2</a></dd>
<dt><b></b></dt>
<dd>length, <a href="#length46">4-6</a></dd>
<dt><b></b></dt>
<dd>library, <a href="#library40">4-0</a></dd>
<dt><b></b></dt>
<dd>literal, <a href="#literal15">1-5</a></dd>
<dt><b></b></dt>
<dd>ln, <a href="#ln31">3-1</a></dd>
<dt><b></b></dt>
<dd>longint, <a href="#longint23">2-3</a></dd>
<dt><b></b></dt>
<dd>loop, <a href="#loop32">3-2</a></dd>
<dt><b></b></dt>
<dd>low, <a href="#low23">2-3</a></dl></td><td width="8%" valign="top">
<dl compact="compact">
</dd>
<dt><b></b></dt>
<dd>matrix, <a href="#matrix31">3-1</a></dd>
<dt><b></b></dt>
<dd>max, <a href="#max31">3-1</a></dd>
<dt><b></b></dt>
<dd>maxchar, <a href="#maxchar21">2-1</a></dd>
<dt><b></b></dt>
<dd>maxdouble, <a href="#maxdouble21">2-1</a></dd>
<dt><b></b></dt>
<dd>maxint, <a href="#maxint21">2-1</a></dd>
<dt><b></b></dt>
<dd>maxreal, <a href="#maxreal21">2-1</a></dd>
<dt><b></b></dt>
<dd>maxstring, <a href="#maxstring21">2-1</a></dd>
<dt><b></b></dt>
<dd>media, <a href="#media15">1-5</a></dd>
<dt><b></b></dt>
<dd>min, <a href="#min31">3-1</a></dd>
<dt><b></b></dt>
<dd>mindouble, <a href="#mindouble21">2-1</a></dd>
<dt><b></b></dt>
<dd>minreal, <a href="#minreal21">2-1</a></dd>
<dt><b></b></dt>
<dd>mmpc, <a href="#mmpc51">5-1</a></dd>
<dt><b></b></dt>
<dd>mmpcdir, <a href="#mmpcdir51">5-1</a></dd>
<dt><b></b></dt>
<dd>mod, <a href="#mod31">3-1</a></dd>
<dt><b></b></dt>
<dd>monadic, <a href="#monadic31">3-1</a><br /><br /></dd>
<dt><b></b></dt>
<dd>NASM, <a href="#NASM51">5-1</a></dd>
<dt><b></b></dt>
<dd>ndx, <a href="#ndx31">3-1</a></dd>
<dt><b></b></dt>
<dd>not, <a href="#not31">3-1</a><br /><br /></dd>
<dt><b></b></dt>
<dd>octal, <a href="#octal15">1-5</a></dd>
<dt><b></b></dt>
<dd>operator, <a href="#operator31">3-1</a>, <a href="#operator32">3-2</a></dd>
<dt><b></b></dt>
<dd>operator, overloadin, <a href="#operator, overloadin31">3-1</a></dd>
<dt><b></b></dt>
<dd>operators, <a href="#operators21">2-1</a></dd>
<dt><b></b></dt>
<dd>or, <a href="#or31">3-1</a></dd>
<dt><b></b></dt>
<dd>ord, <a href="#ord31">3-1</a></dl></td></tr><tr><td width="48%" valign="top">
<dl compact="compact">
</dd>
<dt><b></b></dt>
<dd>P3, <a href="#P351">5-1</a></dd>
<dt><b></b></dt>
<dd>parameter, <a href="#parameter32">3-2</a>, <a href="#parameter53">5-3</a></dd>
<dt><b></b></dt>
<dd>parameters, <a href="#parameters25">2-5</a></dd>
<dt><b></b></dt>
<dd>Pascal, <a href="#Pascal00">0-0</a></dd>
<dt><b></b></dt>
<dd>Pascal90, <a href="#Pascal9023">2-3</a></dd>
<dt><b></b></dt>
<dd>pascalexit, <a href="#pascalexit46">4-6</a></dd>
<dt><b></b></dt>
<dd>pchar, <a href="#pchar23">2-3</a></dd>
<dt><b></b></dt>
<dd>Pentium, <a href="#Pentium51">5-1</a></dd>
<dt><b></b></dt>
<dd>perm, <a href="#perm31">3-1</a></dd>
<dt><b></b></dt>
<dd>pi, <a href="#pi21">2-1</a></dd>
<dt><b></b></dt>
<dd>pixel, <a href="#pixel23">2-3</a>, <a href="#pixel31">3-1</a></dd>
<dt><b></b></dt>
<dd>pixels, <a href="#pixels15">1-5</a></dd>
<dt><b></b></dt>
<dd>point, <a href="#point23">2-3</a></dd>
<dt><b></b></dt>
<dd>pointer, <a href="#pointer23">2-3</a>, <a href="#pointer31">3-1</a></dd>
<dt><b></b></dt>
<dd>polymorphism, <a href="#polymorphism42">4-2</a>,
<a href="#polymorphism45">4-5</a></dd>
<dt><b></b></dt>
<dd>pow, <a href="#pow31">3-1</a></dd>
<dt><b></b></dt>
<dd>pred, <a href="#pred31">3-1</a></dd>
<dt><b></b></dt>
<dd>procedure, <a href="#procedure20">2-0</a>, <a href="#procedure32">3-2</a></dd>
<dt><b></b></dt>
<dd>program, <a href="#program20">2-0</a>, <a href="#program40">4-0</a><br /><br /></dd>
<dt><b></b></dt>
<dd>random, <a href="#random46">4-6</a></dd>
<dt><b></b></dt>
<dd>randomize, <a href="#randomize46">4-6</a></dd>
<dt><b></b></dt>
<dd>range, <a href="#range25">2-5</a>, <a href="#range53">5-3</a></dd>
<dt><b></b></dt>
<dd>rank, <a href="#rank31">3-1</a>, <a href="#rank32">3-2</a>,
<a href="#rank53">5-3</a></dd>
<dt><b></b></dt>
<dd>rdu, <a href="#rdu31">3-1</a></dd>
<dt><b></b></dt>
<dd>read, <a href="#read33">3-3</a></dd>
<dt><b></b></dt>
<dd>readln, <a href="#readln33">3-3</a></dd>
<dt><b></b></dt>
<dd>real, <a href="#real15">1-5</a>, <a href="#real23">2-3</a>,
<a href="#real31">3-1</a></dd>
<dt><b></b></dt>
<dd>reals, <a href="#reals31">3-1</a></dd>
<dt><b></b></dt>
<dd>record, <a href="#record23">2-3</a>, <a href="#record32">3-2</a></dd>
<dt><b></b></dt>
<dd>reduction, <a href="#reduction31">3-1</a></dd>
<dt><b></b></dt>
<dd>repeat, <a href="#repeat32">3-2</a></dd>
<dt><b></b></dt>
<dd>reset, <a href="#reset46">4-6</a></dd>
<dt><b></b></dt>
<dd>rewrite, <a href="#rewrite46">4-6</a></dd>
<dt><b></b></dt>
<dd>round, <a href="#round31">3-1</a></dl></td><td width="8%" valign="top">
<dl compact="compact">
</dd>
<dt><b></b></dt>
<dd>saturated, <a href="#saturated31">3-1</a></dd>
<dt><b></b></dt>
<dd>scalar, <a href="#scalar23">2-3</a>, <a href="#scalar31">3-1</a></dd>
<dt><b></b></dt>
<dd>schema, <a href="#schema53">5-3</a></dd>
<dt><b></b></dt>
<dd>schematic, <a href="#schematic25">2-5</a></dd>
<dt><b></b></dt>
<dd>set, <a href="#set23">2-3</a>, <a href="#set31">3-1</a></dd>
<dt><b></b></dt>
<dd>shl, <a href="#shl31">3-1</a></dd>
<dt><b></b></dt>
<dd>shortint, <a href="#shortint23">2-3</a></dd>
<dt><b></b></dt>
<dd>shr, <a href="#shr31">3-1</a></dd>
<dt><b></b></dt>
<dd>SIMD, <a href="#SIMD00">0-0</a></dd>
<dt><b></b></dt>
<dd>sin, <a href="#sin31">3-1</a></dd>
<dt><b></b></dt>
<dd>sizeof, <a href="#sizeof31">3-1</a></dd>
<dt><b></b></dt>
<dd>source, <a href="#source44">4-4</a></dd>
<dt><b></b></dt>
<dd>sqrt, <a href="#sqrt31">3-1</a></dd>
<dt><b></b></dt>
<dd>static, <a href="#static23">2-3</a>, <a href="#static53">5-3</a></dd>
<dt><b></b></dt>
<dd>string, <a href="#string23">2-3</a></dd>
<dt><b></b></dt>
<dd>strings, <a href="#strings15">1-5</a>, <a href="#strings25">2-5</a></dd>
<dt><b></b></dt>
<dd>subrange, <a href="#subrange23">2-3</a></dd>
<dt><b></b></dt>
<dd>Subranges, <a href="#Subranges25">2-5</a></dd>
<dt><b></b></dt>
<dd>succ, <a href="#succ31">3-1</a></dd>
<dt><b></b></dt>
<dd>suffix, <a href="#suffix44">4-4</a></dd>
<dt><b></b></dt>
<dd>System, <a href="#System20">2-0</a></dl></td></tr><tr><td width="48%" valign="top">
<dl compact="compact">
</dd>
<dt><b></b></dt>
<dd>tan, <a href="#tan31">3-1</a></dd>
<dt><b></b></dt>
<dd>then, <a href="#then32">3-2</a></dd>
<dt><b></b></dt>
<dd>to, <a href="#to32">3-2</a></dd>
<dt><b></b></dt>
<dd>trans, <a href="#trans31">3-1</a></dd>
<dt><b></b></dt>
<dd>true, <a href="#true23">2-3</a></dd>
<dt><b></b></dt>
<dd>Turbo Pascal, <a href="#Turbo Pascal40">4-0</a></dd>
<dt><b></b></dt>
<dd>type, <a href="#type21">2-1</a>, <a href="#type23">2-3</a><br /><br /></dd>
<dt><b></b></dt>
<dd>unit, <a href="#unit20">2-0</a></dd>
<dt><b></b></dt>
<dd>units, <a href="#units40">4-0</a><br /><br /></dd>
<dt><b></b></dt>
<dd>Variables, <a href="#Variables25">2-5</a></dd>
<dt><b></b></dt>
<dd>variant, <a href="#variant23">2-3</a></dd>
<dt><b></b></dt>
<dd>vector, <a href="#vector31">3-1</a></dd>
<dt><b></b></dt>
<dd>vpc, <a href="#vpc51">5-1</a><br /><br /></dd>
<dt><b></b></dt>
<dd>while, <a href="#while32">3-2</a></dd>
<dt><b></b></dt>
<dd>with, <a href="#with32">3-2</a></dd>
<dt><b></b></dt>
<dd>word, <a href="#word23">2-3</a></dd>
<dt><b></b></dt>
<dd>write, <a href="#write33">3-3</a></dd>
<dt><b></b></dt>
<dd>writeln, <a href="#writeln33">3-3</a></dd>
</dl></td></tr></table>
<p>
<h2>Bibliography</h2>
<dl compact="compact">
<dt><a href="#CITEThreeL" name="ThreeL">[1]</a></dt><dd>
3L Limited, Parallel C V2.2, Software Product Description, 1995.
<p>
</dd>
<dt><a href="#CITEAMD" name="AMD">[2]</a></dt><dd>Advanced Micro Devices, 3DNow! Technology Manual, 1999.
</dd>
<dt><a href="#CITE2" name="2">[3]</a></dt><dd>Aho, A.V., Ganapathi, M, TJiang S.W.K., Code Generation Using Tree Matching
and Dynamic Programming, ACM Trans, Programming Languages and Systems 11, no.4,
1989, pp.491-516.
<p>
</dd>
<dt><a href="#CITEblelloch" name="blelloch">[4]</a></dt><dd>
Blelloch, G. E., Nesl: A Nested Data-Parallel Language, Carnegie
Mellon University, CMU-CS-95-170, Sept 1995.
<p>
</dd>
<dt><a href="#CITEBurke" name="Burke">[5]</a></dt><dd>Burke, Chris, J User Manual, ISI, 1995.
</dd>
<dt><a href="#CITECattel80" name="Cattel80">[6]</a></dt><dd>Cattell R. G. G., Automatic derivation of code generators from machine descriptions,
ACM Transactions on Programming Languages and Systems, 2(2), pp. 173-190, April
1980.
</dd>
<dt><a href="#CITEChaitin" name="Chaitin">[7]</a></dt><dd>Chaitin. G., Elegant Lisp Programs, in The Limits of Mathematics, pp. 29-56,
Springer, 1997.
</dd>
<dt><a href="#CITECheong97" name="Cheong97">[8]</a></dt><dd>Cheong, G., and Lam, M., An Optimizer for Multimedia Instruction Sets, 2nd SUIF
Workshop, Stanford University, August 1997.
</dd>
<dt><a href="#CITECherry" name="Cherry">[9]</a></dt><dd> Cherry, G., W., Pascal Programming Structures, Reston Publishing, Reston, 1980.
</dd>
<dt><a href="#CITECockshott00" name="Cockshott00">[10]</a></dt><dd>Cockshott, Paul, Direct Compilation of High Level Languages for Multi-media
Instruction-sets, Department of Computer Science, University of Glasgow, Nov
2000.
<p>
</dd>
<dt><a href="#CITEEwing" name="Ewing">[11]</a></dt><dd>
Ewing, A. K., Richardson, H., Simpson, A. D., Kulkarni, R., Writing Data
Parallel Programs with High Performance Fortran, Edinburgh Parallel Computing
Centre, Ver 1.3.1.
<p>
</dd>
<dt><a href="#CITEgraham80" name="graham80">[12]</a></dt><dd>Susan L. Graham, Table Driven Code Generation, IEEE Computer, Vol 13, No. 8,
August 1980, pp 25..37.
</dd>
<dt><a href="#CITEIA32" name="IA32">[13]</a></dt><dd>Intel, Intel Architecture Software Developers Manual Volumes 1 and 2, 1999.
</dd>
<dt><a href="#CITEIntel00" name="Intel00">[14]</a></dt><dd>Intel, Willamette Processor Software Developer's Guide, February, 2000.
</dd>
<dt><a href="#CITEISO90" name="ISO90">[15]</a></dt><dd>ISO, Extended Pascal ISO 10206:1990, 1991.
</dd>
<dt><a href="#CITEISO90a" name="ISO90a">[16]</a></dt><dd>ISO, Pascal, ISO 7185:1990, 1991.
<p>
</dd>
<dt><a href="#CITEIverson62" name="Iverson62">[17]</a></dt><dd>K. E. Iverson, A Programming Language, John Wiley &amp; Sons, Inc., New York (1962),
p. 16.
</dd>
<dt><a href="#CITEIverson80" name="Iverson80">[18]</a></dt><dd>Iverson, K. E. . Notation as a tool of thought. Communications of the ACM, 23(8),
444-465, 1980.
</dd>
<dt><a href="#CITEJmanual" name="Jmanual">[19]</a></dt><dd>Iverson K. E, A personal View of APL, IBM Systems Journal, Vol 30, No 4, 1991.
</dd>
<dt><a href="#CITEJintro" name="Jintro">[20]</a></dt><dd>Iverson, Kenneth E., J Introduction and Dictionary, Iverson Software Inc. (ISI),
Toronto, Ontario, 1995. 4, pp 347-361, 2000.
</dd>
<dt><a href="#CITEJensen" name="Jensen">[21]</a></dt><dd>Jensen, K., Wirth, N., PASCAL User Manual and Report, Springer 1978.
<p>
</dd>
<dt><a href="#CITEJohnston" name="Johnston">[22]</a></dt><dd>
Johnston, D., C++ Parallel Systems, ECH: Engineering Computing Newsletter,
No. 55, Daresbury Laboratory/Rutherford Appleton Laboratory, March 1995,pp 6-7.
</dd>
<dt><a href="#CITEKnuth" name="Knuth">[23]</a></dt><dd> Knuth, D., Computers and Typesetting, Addison Wesley, 1994.
</dd>
<dt><a href="#CITEKrall00" name="Krall00">[24]</a></dt><dd>
Krall, A., and Lelait, S., Compilation Techniques for Multimedia Processors,
International Journal of Parallel Programming, Vol. 28, No. 4, pp 347-361, 2000.
<p>
</dd>
<dt><a href="#CITELamport" name="Lamport">[25]</a></dt><dd> Lamport, L., <span class="roman">L</span><sup><span class="roman">A</span></sup><span class="roman">T</span><sub><span class="roman">E</span></sub><span class="roman">X</span>a document preparation system, Addison Wesley, 1994.
<p>
</dd>
<dt><a href="#CITELeupers99" name="Leupers99">[26]</a></dt><dd>Leupers, R., Compiler Optimization for Media Processors, EMMSEC 99/Sweden 1999.
<p>
</dd>
<dt><a href="#CITEMarx" name="Marx">[27]</a></dt><dd>Marx, K., 1976,<i>Capital </i>, Volume I, Harmondsworth: Penguin/New Left
Review.
<p>
</dd>
<dt><a href="#CITEMetcalf96" name="Metcalf96">[28]</a></dt><dd>Metcalf, M., and Reid., J., The F Programming Language, OUP, 1996.
</dd>
<dt><a href="#CITEPeleg97" name="Peleg97">[29]</a></dt><dd>Peleg, A., Wilke S., Weiser U., Intel MMX for Multimedia PCs, Comm. ACM, vol
40, no. 1 1997.
<p>
</dd>
<dt><a href="#CITEShannon" name="Shannon">[30]</a></dt><dd>
Shannon, C., A Mathematical Theory of Communication, The Bell System Technical
Journal, Vol 27, pp 379-423 and 623-656, 1948.
<p>
</dd>
<dt><a href="#CITESnyder" name="Snyder">[31]</a></dt><dd>
Snyder, L., A Programmer's Guide to ZPL, MIT Press, Cambridge, Mass, 1999.
<p>
</dd>
<dt><a href="#CITESreraman00" name="Sreraman00">[32]</a></dt><dd>Srereman, N., and Govindarajan, G., A Vectorizing Compiler for Multimedia Extensions,
International Journal of Parallel Programming, Vol. 28, No. 4, pp 363-400, 2000.
<p>
</dd>
<dt><a href="#CITEStrachey" name="Strachey">[33]</a></dt><dd>
Strachey, C., Fundamental Concepts of Programming Languages, University of
Oxford, 1967.
<p>
</dd>
<dt><a href="#CITEsable" name="sable">[34]</a></dt><dd>\' Etienne Gagnon, SABLECC, AN OBJECT-ORIENTED COMPILER FRAMEWORK, School
of Computer Science McGill University, Montreal, March 1998.
</dd>
<dt><a href="#CITETexas" name="Texas">[35]</a></dt><dd>Texas Instruments, TMS320C62xx CPU and Instruction Set Reference Guide, 1998.
</dd>
<dt><a href="#CITEWirth" name="Wirth">[36]</a></dt><dd> Wirth, N., Recollections about the development of Pascal, in <em>
History of Programming Languages-II</em>, ACM-Press, pp 97-111, 1996.</dd>
</dl>
<hr /><h3>Footnotes:</h3>
<p>
<a name="tthFtNtAAB"></a><a href="#tthFrefAAB"><sup>1</sup></a>Note this differs from ISO Pascal which allows a comment starting with { to
terminate with *) and vice versa.
<p>
<a name="tthFtNtAAC"></a><a href="#tthFrefAAC"><sup>2</sup></a>The notation used for grammar definition is a tabularised BNF . Each boxed table
defines a production, with the production name in the left column. Each line
in the right column is an alternative for the production. The metasymbol + indicates
one or more repetitions of what immediately preceeds it. The Kleene star *
is used for zero or more repetitions. Terminal symbols are in single quotes.
Sequences in brackets [ ] are optional.
<p>
<a name="tthFtNtAAD"></a><a href="#tthFrefAAD"><sup>3</sup></a>When pixels are represented as integers in the range 0..255, a 50% contrast
reduction has to be expressed as ((p<font face="symbol">-</font
>128)<font face="symbol">¸</font
>2)+128 .
<p>
<a name="tthFtNtAAE"></a><a href="#tthFrefAAE"><sup>4</sup></a> ISO Pascal requires
the base type to be a scalar type, a character type, integer
type or a subrange thereof. When the base type is one of these, Vector Pascal implements
the set using bitmaps. When the type is other than these, balanced binary trees are used.
It is strongly recomended that use be made of Boehm garbage collector (see section <a href="#garbage">5.1.2</a>) if non-bitmapped
sets are used in a program.
<p>
<a name="tthFtNtAAF"></a><a href="#tthFrefAAF"><sup>5</sup></a>The Pascal concept of static variables should not be equated with the notion
of static variables in some other languages such as C or Java. In Pascal a variable
is considered static if its offset either relative to the stack base or relative
to the start of the global segment can be determined at compile/link time. In
C a variable is static only if its location relative to the start of the global
segment is known at compile time.
<p>
<a name="tthFtNtAAG"></a><a href="#tthFrefAAG"><sup>6</sup></a>see section <a href="#block">4</a>.
<p>
<a name="tthFtNtAAH"></a><a href="#tthFrefAAH"><sup>7</sup></a>See section <a href="#manimplicitindices">3.2.1</a>.
<p>
<a name="tthFtNtAAI"></a><a href="#tthFrefAAI"><sup>8</sup></a>This compilation strategy requires that true is equivalent to -1 and false to
0. This is typically the representation of booleans returned by vector comparison
instructions on SIMD instruction sets. In Vector Pascal this representation
is used generally and in consequence, <tt>true</tt> &lt; <tt>false</tt>.
<p>
<a name="tthFtNtAAJ"></a><a href="#tthFrefAAJ"><sup>9</sup></a>Vector Pascal allows function results to be of any non-procedural type.
<br /><br /><hr /><small>File translated from
T<sub><font size="-1">E</font></sub>X
by <a href="http://hutchinson.belmont.ma.us/tth/">
T<sub><font size="-1">T</font></sub>H</a>,
version 3.00.<br />On 13 Feb 2007, 10:52.</small>
</html>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.