This file is indexed.

/usr/include/symmetrica/macro.h is in libsymmetrica2-dev 2.0+ds-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
/* file: macro.h symmetrica source code */
#ifndef MACRO_H

#include "string.h"

#ifdef SYMMAGMA
#define SYM_MALLOC(a) mem_malloc(a)
#else
#define SYM_MALLOC(a) SYM_malloc(a)
#endif

#ifdef SYMMAGMA
#define SYM_FREE(a) mem_free(a)
#else
#define SYM_FREE(a) SYM_free(a)
#endif



#define S_O_S(a) (((OP)(a))->ob_self)
#define S_O_K(a) (((OP)(a))->ob_kind)
#define C_O_K(a,b) ((a)->ob_kind = (OBJECTKIND)(b))
#define C_O_S(a,b) S_O_S(a)=(b)
#define B_KS_O(a,b,c) do { C_O_S(c,b); C_O_K(c,a); } while(0) 

#define EMPTYP(a) ((a)->ob_kind == (OBJECTKIND)0)

#define EQ_INTEGER(a,b) \
    ( S_O_K(b) == INTEGER ?(S_I_I(a) == S_I_I(b)):(comp_integer(a,b) == 0))
#define EQ_PARTITION(a,b) \
    ( S_O_K(b) == PARTITION ? eq_partition_partition(a,b) :FALSE )
#define EQ_LONGINT(a,b) \
    ( S_O_K(b) == LONGINT ? eq_longint_longint(a,b) :(comp_longint(a,b) == 0))
#define EQ_FF(a,b) \
    ( comp_ff(a,b) == 0 )
#define EQ(a,b) \
    (\
        S_O_K(a) == INTEGER? EQ_INTEGER(a,b) : \
          (\
          S_O_K(a) == LONGINT? EQ_LONGINT(a,b) :\
            ( \
            S_O_K(a) == PARTITION?EQ_PARTITION(a,b): \
                (\
                S_O_K(a)==FF?EQ_FF(a,b): eq(a,b) \
                )\
            ) \
          )\
    )



#define S_I_I(a) (((a)->ob_self).ob_INT)
#define C_I_I(a,b) (a)->ob_self.ob_INT = (INT)(b)
#define M_I_I(a,b)  (\
            ((b)->ob_self.ob_INT = (INT)(a)),\
             ((b)->ob_kind = INTEGER)\
            )

#define DEC_INTEGER(a) (((a)->ob_self).ob_INT --)
#define INC_INTEGER(a) (((a)->ob_self).ob_INT ++)


#define COPY_INTEGER(a,b) M_I_I(S_I_I(a),b)
#define FREESELF_INTEGER(a) C_O_K((a),0)
#define NULLP_INTEGER(a) (S_I_I(a) == 0)
#define POSP_INTEGER(a) (S_I_I(a) > (INT)0)
#define NEGP_INTEGER(a) (S_I_I(a) < (INT)0)
#define EINSP_INTEGER(a) (S_I_I(a) == (INT)1)
#define NEGEINSP_INTEGER(a) (S_I_I(a) == (INT)-1)
#define COMP_INTEGER_INTEGER(a,b) ((S_I_I(a) == S_I_I(b))? 0L :\
    ((S_I_I(a) > S_I_I(b))? 1L : -1L) )
#define INTEGERP(a) (S_O_K(a) == INTEGER)


#define S_V_S(a) ((((a)->ob_self).ob_vector)->v_self)
#define C_V_S(a,b) (((((a)->ob_self).ob_vector)->v_self) = ((OP) b))
#define S_V_L(a) ((((a)->ob_self).ob_vector)->v_length)
#define C_V_L(a,b) (((((a)->ob_self).ob_vector)->v_length) = (b))
#define S_V_I(a,i) (((((a)->ob_self).ob_vector)->v_self)+(i))
#define C_V_I(a,i,b) ( *(((((a)->ob_self).ob_vector)->v_self)+(i)) = *(b))
#define S_V_II(a,i) (((((((a)->ob_self).ob_vector)->v_self)+(i))\
            ->ob_self).ob_INT)
#define S_V_LI(a) ((((((a)->ob_self).ob_vector)->v_length)->ob_self).ob_INT)

#define B_O_V(a,b) \
do { \
struct vector *callocvectorstruct();\
FREESELF(b);C_O_K(b,VECTOR);b->ob_self.ob_vector = callocvectorstruct();\
C_V_S(b,a);C_V_L(b,CALLOCOBJECT()); M_I_I(1,S_V_L(b)); } while(0)



#define INTEGRALP(a) (       (S_O_K(a) == LONGINT) \
            || (S_O_K(a) == INTEGER)  \
                      )
#define VECTORP_CO1(a) (       (S_O_K(a) == VECTOR) \
            || (S_O_K(a) == WORD) \
            || (S_O_K(a) == QUEUE) \
            || (S_O_K(a) == INTEGERVECTOR) \
            || (S_O_K(a) == COMPOSITION) \
            || (S_O_K(a) == HASHTABLE) \
            || (S_O_K(a) == LAURENT) \
            || (S_O_K(a) == KRANZ) \
            || (S_O_K(a) == SUBSET) \
            || (S_O_K(a) == FF) \
        )

#define VECTORP(a) ((a == NULL)? FALSE: VECTORP_CO1(a))

#define LISTP_CO1(a) (         (S_O_K(a) == LIST) \
            || (S_O_K(a) == SCHUR) \
            || (S_O_K(a) == GRAL) \
            || (S_O_K(a) == POLYNOM) \
            || (S_O_K(a) == SCHUBERT) \
            || (S_O_K(a) == MONOPOLY) \
            || (S_O_K(a) == ELM_SYM) \
            || (S_O_K(a) == POW_SYM) \
            || (S_O_K(a) == MONOMIAL) \
            || (S_O_K(a) == HOM_SYM) \
        )
#define LISTP(a) ((a == NULL)? FALSE: LISTP_CO1(a))

#define POLYP(a) (          \
            (S_O_K(a) == SCHUR) \
            || (S_O_K(a) == GRAL) \
            || (S_O_K(a) == POLYNOM) \
            || (S_O_K(a) == SCHUBERT) \
            || (S_O_K(a) == MONOPOLY) \
            || (S_O_K(a) == ELM_SYM) \
            || (S_O_K(a) == POW_SYM) \
            || (S_O_K(a) == MONOMIAL) \
            || (S_O_K(a) == HOM_SYM) \
        )
 


#define S_L_S(a) ((((a)->ob_self).ob_list)->l_self)
#define C_L_S(a,b) (((((a)->ob_self).ob_list)->l_self) = (OP)(b))
#define S_L_N(a) ((((a)->ob_self).ob_list)->l_next)
#define C_L_N(a,b) (((((a)->ob_self).ob_list)->l_next) = (OP)(b))

#define S_PA_C(a) ((unsigned char *)  (S_PA_S(a))) 
#define S_PA_K(a) ((a)->ob_self.ob_partition->pa_kind)
#define C_PA_K(a,b) (((((a)->ob_self).ob_partition)->pa_kind) = b)
#define C_PA_HASH(a,b) (((((a)->ob_self).ob_partition)->pa_hash) = b)
#define S_PA_S(a) ((a)->ob_self.ob_partition->pa_self)
#define S_PA_HASH(a) ((a)->ob_self.ob_partition->pa_hash)
#define C_PA_S(a,b) ((a)->ob_self.ob_partition->pa_self = b)
#define S_PA_I(a,i) S_V_I((a)->ob_self.ob_partition->pa_self,i)
#define S_PA_II(a,i)  \
((S_O_K(a) == CHARPARTITION || S_O_K(a) == CHAR_AUG_PART) ?   \
        (INT)(S_PA_C(a)[i+1]) : \
        S_V_II((a)->ob_self.ob_partition->pa_self,i))
#define S_PA_CII(a,i) (S_PA_C(a)[i+1])
#define S_PA_CI(a,i) (S_PA_C(a)+i+1)
#define S_PA_CL(a) (S_PA_C(a)[0])
#define S_PA_L(a) S_V_L(S_PA_S(a))
#define S_PA_LI(a) \
((S_O_K(a) == CHARPARTITION || S_O_K(a) == CHAR_AUG_PART) ?  \
        (INT)(S_PA_C(a)[0]) : \
        S_V_LI(S_PA_S(a)))
#define INC_PARTITION(a) inc_vector(S_PA_S(a))
#define DEC_PARTITION(a) dec_integervector(S_PA_S(a))

#ifdef FAST
#define PART_CHECK_KIND(t,a,b)
#else
#define PART_CHECK_KIND(t,a,b)\
    CTO(PARTITION,t,a);\
    if (S_PA_K(a) != b)\
        wrong_kind_part(t,a,b);
#endif



extern INT partition_speichersize,partition_speicherindex,mem_counter_part;
extern struct partition **partition_speicher; 

#define FREEPARTITION(d)\
FREE_MEMMANAGER(struct partition *,\
                    partition_speicher,\
                    partition_speicherindex,\
                    partition_speichersize,\
                    mem_counter_part,\
                    d)
 
#define B_KS_PA(a,b,c) \
    do {\
    C_O_K(c,PARTITION);\
    CALLOC_MEMMANAGER(struct partition,\
                      partition_speicher,\
                      partition_speicherindex,\
                      mem_counter_part,\
                      (c ->ob_self).ob_partition);\
    /* (c ->ob_self).ob_partition=CALLOCPARTITION();*/\
    C_PA_K(c,a);\
    C_PA_S(c,b);\
    C_PA_HASH(c,-1L); \
    } while (0)
 
#define M_KL_PA(a,b,c) \
do { B_KS_PA(a,CALLOCOBJECT(),c);\
        erg += m_l_v(b,S_PA_S(c));\
        C_O_K(S_PA_S(c),INTEGERVECTOR) );\
while(0)
 
#define B_KL_PA(a,b,c) \
do { B_KS_PA(a,CALLOCOBJECT(),c);\
        erg += b_l_v(b,S_PA_S(c));\
        C_O_K(S_PA_S(c),INTEGERVECTOR);\
} while(0)
 



#define S_P_K(a) ((((a)->ob_self).ob_permutation)->p_kind)
#define C_P_K(a,b) (((((a)->ob_self).ob_permutation)->p_kind) = b)
#define S_P_S(a) ((((a)->ob_self).ob_permutation)->p_self)
#define C_P_S(a,b) (((((a)->ob_self).ob_permutation)->p_self) = b)
#define S_P_I(a,i) S_V_I(((((a)->ob_self).ob_permutation)->p_self),(i))
#define S_P_II(a,i) S_V_II(((((a)->ob_self).ob_permutation)->p_self),(i))
#define S_P_L(a) S_V_L(S_P_S(a))
#define S_P_LI(a) S_V_LI(S_P_S(a))

/* kranz produkt AK 120804 */
#define S_KR_G(a) S_V_I(a,0)
#define S_KR_GI(a,i) S_P_I(S_V_I(a,0),i)
#define S_KR_GL(a) S_P_L(S_V_I(a,0))
#define S_KR_GLI(a) S_P_LI(S_V_I(a,0))
#define S_KR_V(a) S_V_I(a,1)
#define S_KR_VL(a) S_V_L(S_V_I(a,1))
#define S_KR_VLI(a) S_V_LI(S_V_I(a,1))
#define S_KR_I(a,i) S_V_I(S_V_I(a,1),i)

#define S_M_L(a) ((((a)->ob_self).ob_matrix)->m_length)
#define C_M_L(a,b) (((((a)->ob_self).ob_matrix)->m_length)=(b))
#define S_M_LI(a) ((((((a)->ob_self).ob_matrix)->m_length)->ob_self).ob_INT)
#define S_M_H(a) ((((a)->ob_self).ob_matrix)->m_height)
#define S_M_HASH(a) ((((a)->ob_self).ob_matrix)->m_hash)
#define C_M_H(a,b) (((((a)->ob_self).ob_matrix)->m_height)=(b))
#define S_M_HI(a) ((((((a)->ob_self).ob_matrix)->m_height)->ob_self).ob_INT)
#define S_M_S(a) ((((a)->ob_self).ob_matrix)->m_self)
#define C_M_S(a,b) (((((a)->ob_self).ob_matrix)->m_self)=(b))
#define C_M_HASH(a,b) (((((a)->ob_self).ob_matrix)->m_hash)=(b))
#define S_M_IJ(a,i,j) ( ((((a)->ob_self).ob_matrix)->m_self)\
     + ((((((a)->ob_self).ob_matrix)->m_length)->ob_self).ob_INT)\
     * (i) + (j) )
#define S_M_IJI(a,i,j) S_I_I(S_M_IJ(a,i,j)) 
#define MATRIXP(a) ((S_O_K(a) == MATRIX) || (S_O_K(a) == KRANZTYPUS)\
    || (S_O_K(a) == KOSTKA) || (S_O_K(a) == INTEGERMATRIX) )

#define S_MO_S(a) (((a->ob_self).ob_monom)->mo_self)
#define C_MO_S(a,b) ((((a->ob_self).ob_monom)->mo_self)=(b))
#define S_MO_K(a) (((a->ob_self).ob_monom)->mo_koeff)
#define C_MO_K(a,b) ((((a->ob_self).ob_monom)->mo_koeff)=(b))
#define S_MO_KI(a) ((((a->ob_self).ob_monom)->mo_koeff)->ob_self.ob_INT)
#define S_MO_SI(a,i) S_V_I(S_MO_S(a),(i))
#define S_MO_SII(a,i) S_V_II(S_MO_S(a),(i))
#define S_MO_SL(a) S_V_L(S_MO_S(a))
#define S_MO_SLI(a) S_V_LI(S_MO_S(a))
#define COPY_MONOM(a,b) M_SK_MO(S_MO_S(a),S_MO_K(a),b)

#define B_SK_MO(a,b,c)\
do { \
      C_O_K(c,MONOM);\
      CALLOC_MEMMANAGER(struct monom, monom_speicher, monom_speicherindex,mem_counter_monom ,(c->ob_self).ob_monom);\
      C_MO_S(c,a) ; \
      C_MO_K(c,b); \
} while(0)

extern INT monom_speicherindex,mem_counter_monom,monom_speichersize;
extern struct monom **monom_speicher;

#define FREEMONOM(v) \
FREE_MEMMANAGER(struct monom *,\
 monom_speicher,\
 monom_speicherindex,\
 monom_speichersize,\
 mem_counter_monom,\
 v)


#define FREESELF_MONOM(a)\
do {\
    if (S_O_K(S_MO_S(a)) == PARTITION) \
        { erg+= freeself_partition(S_MO_S(a)); }\
    else if (S_O_K(S_MO_S(a)) == INTEGERMATRIX) \
        { erg+= freeself_integermatrix(S_MO_S(a)); }\
    else erg += freeself(S_MO_S(a));\
    FREE_EMPTY_OBJECT(S_MO_S(a));\
    if (S_O_K(S_MO_K(a)) == INTEGER) C_O_K(S_MO_K(a),EMPTY);\
    else if (S_O_K(S_MO_K(a)) == LONGINT) erg += freeself_longint(S_MO_K(a));\
    else if (S_O_K(S_MO_K(a)) == BRUCH) erg += freeself_bruch(S_MO_K(a));\
    else if (S_O_K(S_MO_K(a)) == FF) erg += freeself_ff(S_MO_K(a));\
    else  erg += freeself(S_MO_K(a));\
    FREE_EMPTY_OBJECT(S_MO_K(a));\
    FREEMONOM(((a)->ob_self).ob_monom);\
    C_O_K(a,EMPTY);\
} while(0)

#define S_B_I(a) ((INT)((((a)->ob_self).ob_bruch)->b_info))
#define S_B_O(a) ((OP)((((a)->ob_self).ob_bruch)->b_oben))
#define S_B_OI(a) ((INT)((((((a)->ob_self).ob_bruch)->b_oben)->ob_self).ob_INT))
#define S_B_U(a) ((OP)((((a)->ob_self).ob_bruch)->b_unten))
#define S_B_UI(a) ((INT)((((((a)->ob_self).ob_bruch)->b_unten)->ob_self).ob_INT))
#define FREESELF_BRUCH(a) (freeall(S_B_O(a)),freeall(S_B_U(a)),\
        free(S_O_S(a).ob_bruch),C_O_K(a,0),OK)
#define C_B_I(a,b) (((((a)->ob_self).ob_bruch)->b_info)=(INT)(b))
#define C_B_O(a,b) (((((a)->ob_self).ob_bruch)->b_oben)=(b))
#define C_B_U(a,b) (((((a)->ob_self).ob_bruch)->b_unten)=(b))
#define EINSP_BRUCH(a) (EQ(S_B_O((a)),S_B_U((a))))
#define BRUCHP(a) (S_O_K(a) == BRUCH)

#define S_S_S(a)  ((((((((a)->ob_self).ob_list)->l_self))\
        ->ob_self).ob_monom)->mo_self)
#define S_S_SL(a) S_PA_L( ((((((((a)->ob_self).ob_list)->l_self))\
        ->ob_self).ob_monom)->mo_self)\
            )
#define S_S_SLI(a) S_PA_LI( ((((((((a)->ob_self).ob_list)->l_self))\
        ->ob_self).ob_monom)->mo_self)\
            )
#define S_S_SI(a,i) S_PA_I( ((((((((a)->ob_self).ob_list)->l_self))\
        ->ob_self).ob_monom)->mo_self)\
        ,(i))
#define S_S_SII(a,i) S_PA_II( ((((((((a)->ob_self).ob_list)->l_self))\
        ->ob_self).ob_monom)->mo_self)\
        ,(i))
#define S_S_K(a) (S_MO_K(((((a)->ob_self).ob_list)->l_self)))
#define C_S_K(a,b) (C_MO_K(((((a)->ob_self).ob_list)->l_self),(b)))
#define C_S_S(a,b) (C_MO_S(((((a)->ob_self).ob_list)->l_self),(b)))
#define S_S_KI(a) (S_MO_KI(((((a)->ob_self).ob_list)->l_self)))
#define S_S_N(a) (S_L_N(a))
#define C_S_N(a,b) (C_L_N((a),(b)))

#define S_SCH_S(a) (S_MO_S(S_L_S(a)))
#define S_SCH_SL(a) (S_P_L(S_MO_S(S_L_S(a))))
#define S_SCH_SLI(a) (S_P_LI(S_MO_S(S_L_S(a))))
#define S_SCH_SI(a,i) S_P_I(S_SCH_S(a),(i))
#define S_SCH_SII(a,i) S_P_II(S_SCH_S(a),(i))
#define S_SCH_K(a) (S_MO_K(S_L_S(a)))
#define C_SCH_K(a,b) (C_MO_K(S_L_S(a),(b)))
#define S_SCH_KI(a) (S_MO_KI(S_L_S(a)))
#define S_SCH_N(a) (S_L_N(a))
#define C_SCH_N(a,b) (C_L_N((a),(b)))


#define POLYNOMP(a) (S_O_K(a) == POLYNOM)
#define S_PO_S(a) (S_MO_S(S_L_S(a)))
#define S_PO_SI(a,i) (S_V_I(S_MO_S(S_L_S(a)),i))
#define S_PO_SIJ(a,i,j) (S_M_IJ(S_MO_S(S_L_S(a)),i,j))
#define S_PO_SIJI(a,i,j) (S_M_IJI(S_MO_S(S_L_S(a)),i,j))
#define S_PO_SII(a,i) (S_V_II(S_MO_S(S_L_S(a)),i))
#define S_PO_SL(a) (S_V_L(S_MO_S(S_L_S(a))))
#define S_PO_SLI(a) (S_V_LI(S_MO_S(S_L_S(a))))
#define S_PO_K(a) (S_MO_K(S_L_S(a)))
#define S_PO_KI(a) (S_MO_KI(S_L_S(a)))
#define S_PO_N(a) (S_L_N(a))
#define C_PO_N(a,b) (C_L_N((a),(b)))
#define C_PO_K(a,b) (C_MO_K(S_L_S(a),(b)))
#define COPY_POLYNOM(a,b) copy_list(a,b)
#define M_SK_MO(a,b,c) (b_sk_mo(callocobject(),callocobject(),c),\
            copy(b,S_MO_K(c)),\
            copy(a,S_MO_S(c)))

#define S_SPA_G(a) ((((a)->ob_self).ob_skewpartition)->spa_gross)
#define S_SPA_GL(a) S_PA_L((((a)->ob_self).ob_skewpartition)->spa_gross)
#define S_SPA_GLI(a) S_PA_LI((((a)->ob_self).ob_skewpartition)->spa_gross)
#define S_SPA_GI(a,i) S_PA_I(((((a)->ob_self).ob_skewpartition)->spa_gross),i)
#define S_SPA_GII(a,i) S_PA_II(((((a)->ob_self).ob_skewpartition)->spa_gross),i)
#define S_SPA_GS(a) S_PA_S((((a)->ob_self).ob_skewpartition)->spa_gross)
#define S_SPA_K(a) ((((a)->ob_self).ob_skewpartition)->spa_klein)
#define S_SPA_KL(a) S_PA_L((((a)->ob_self).ob_skewpartition)->spa_klein)
#define S_SPA_KLI(a) S_PA_LI((((a)->ob_self).ob_skewpartition)->spa_klein)
#define S_SPA_KI(a,i) S_PA_I(S_SPA_K(a),i)
#define S_SPA_KII(a,i) S_PA_II(S_SPA_K(a),i)
#define S_SPA_KS(a) S_PA_S((((a)->ob_self).ob_skewpartition)->spa_klein)

#define S_T_S(a) ((((a)->ob_self).ob_tableaux)->t_self)
#define S_T_U(a) ((((a)->ob_self).ob_tableaux)->t_umriss)
#define S_T_IJ(a,i,j) S_M_IJ(S_T_S(a),i,j)
#define S_T_H(a) S_M_H(S_T_S(a))
#define S_T_HI(a) S_M_HI(S_T_S(a))
#define S_T_L(a) S_M_L(S_T_S(a))
#define S_T_LI(a) S_M_LI(S_T_S(a))
#define S_T_IJI(a,i,j) S_M_IJI(S_T_S(a),i,j)
#define S_T_UG(a) S_SPA_G(S_T_U(a))
#define S_T_UGLI(a) S_SPA_GLI(S_T_U(a))
#define S_T_UGL(a) S_SPA_GL(S_T_U(a))
#define S_T_UGII(a,i) S_SPA_GII(S_T_U(a),i)
#define S_T_UGI(a,i) S_SPA_GI(S_T_U(a),i)
#define S_T_UK(a) S_SPA_K(S_T_U(a))
#define S_T_UKLI(a) S_SPA_KLI(S_T_U(a))
#define S_T_UKL(a) S_SPA_KL(S_T_U(a))
#define S_T_UKII(a,i) S_SPA_KII(S_T_U(a),i)
#define S_T_UKI(a,i) S_SPA_KI(S_T_U(a),i)
#define S_T_UL(a) S_PA_L(S_T_U(a))
#define S_T_ULI(a) S_PA_LI(S_T_U(a))
#define S_T_UII(a,i) S_PA_II(S_T_U(a),i)
#define S_T_UI(a,i) S_PA_I(S_T_U(a),i)
#define TABLEAUXP(a) (S_O_K(a) == TABLEAUX)

#define S_W_I(a,i) S_V_I(a,i)
#define S_W_II(a,i) S_V_II(a,i)
#define S_W_L(a) S_V_L(a)
#define S_W_LI(a) S_V_LI(a)
#define S_W_S(a) S_V_S(a)
#define S_LA_I(a,i) S_V_I(a,i)
#define S_LA_II(a,i) S_V_II(a,i)
#define S_LA_L(a) S_V_L(a)
#define S_LA_LI(a) S_V_LI(a)
#define S_LA_S(a) S_V_S(a)
#define b_l_w(a,b) (b_l_v(a,b),C_O_K(b,WORD),OK)
#define m_l_w(a,b) (m_l_v(a,b),C_O_K(b,WORD),OK)
#define m_il_w(a,b) (m_il_v(a,b),C_O_K(b,WORD),OK)
#define m_il_nw(a,b) (m_il_nv(a,b),C_O_K(b,WORD),OK)
#define m_l_nw(a,b) (m_l_nv(a,b),C_O_K(b,WORD),OK)
#define b_l_la(a,b) (b_l_v(a,b),C_O_K(b,LAURENT),OK)
#define m_l_la(a,b) (m_l_v(a,b),C_O_K(b,LAURENT),OK)
#define m_il_la(a,b) (m_il_v(a,b),C_O_K(b,LAURENT),OK)
#define m_il_nla(a,b) (m_il_nv(a,b),C_O_K(b,LAURENT),OK)
#define m_l_nla(a,b) (m_l_nv(a,b),C_O_K(b,LAURENT),OK)

#define S_SC_D(a) ((((a)->ob_self).ob_symchar)->sy_dimension)
#define S_SC_DI(a) S_I_I((((a)->ob_self).ob_symchar)->sy_dimension)
#define S_SC_W(a) ((((a)->ob_self).ob_symchar)->sy_werte)
#define S_SC_WI(a,i) S_V_I(((((a)->ob_self).ob_symchar)->sy_werte),i)
#define S_SC_WII(a,i) S_V_II(((((a)->ob_self).ob_symchar)->sy_werte),i)
#define S_SC_P(a) ((((a)->ob_self).ob_symchar)->sy_parlist)
#define S_SC_PI(a,i) S_V_I(((((a)->ob_self).ob_symchar)->sy_parlist),i)
#define S_SC_PLI(a) S_V_LI(((((a)->ob_self).ob_symchar)->sy_parlist))
#define S_SC_WLI(a) S_V_LI(((((a)->ob_self).ob_symchar)->sy_werte))

/* MD */
#define S_N_S(a) ((((a)->ob_self).ob_number)->n_self)
#define C_N_S(a,b) (((((a)->ob_self).ob_number)->n_self) = (b))
#define S_N_D(a) (((((a)->ob_self).ob_number)->n_data).o_data)
#define C_N_D(a,b) ((((((a)->ob_self).ob_number)->n_data).o_data) = (b))
#define S_N_DC(a) (((((a)->ob_self).ob_number)->n_data).c_data)
#define S_N_DCI(a) ((((((a)->ob_self).ob_number)->n_data).c_data)->index)
#define S_N_DCII(a) S_I_I(S_N_DCI(a))
#define S_N_DCD(a) ((((((a)->ob_self).ob_number)->n_data).c_data)->deg)
#define S_N_DCP(a) ((((((a)->ob_self).ob_number)->n_data).c_data)->poly)
#define    OBJECTREAD_CYCLO(f,a)    objectread_number((f),(a),CYCLOTOMIC)
#define    OBJECTREAD_SQRAD(f,a)    objectread_number((f),(a),SQ_RADICAL)
#define    EINSP_MONOPOLY(a)    eq_fieldobject_int(MONOPOLY,(a),1L)
#define    EINSP_CYCLO(a)        eq_fieldobject_int(CYCLOTOMIC,(a),1L)
#define    EINSP_SQRAD(a)        eq_fieldobject_int(SQ_RADICAL,(a),1L)
#define    NEGEINSP_MONOPOLY(a)    eq_fieldobject_int(MONOPOLY,(a),-1L)
#define    NEGEINSP_CYCLO(a)    eq_fieldobject_int(CYCLOTOMIC,(a),-1L)
#define    NEGEINSP_SQRAD(a)    eq_fieldobject_int(SQ_RADICAL,(a),-1L)




#define evenp(a) even(a)
#define oddp(a) odd(a)
#define first_ym(a,b) ym_min(a,b)

#define addinvers_schubert(a,b) addinvers_polynom(a,b)
#define addinvers_schur(a,b) addinvers_polynom(a,b)
#define einsp_schur(a) einsp_symfunc(a)
#define add_apply_schur(a,b) add_apply_symfunc(a,b)
#define add_apply_schur_schur(a,b) add_apply_symfunc_symfunc(a,b)
#define m_part_schur(a,b) m_skn_s(a,cons_eins,NULL,b)

/* for MONOMIAL */
#define m_v_mon(a,b) (m_v_s(a,b),C_O_K(b,MONOMIAL),OK)
#define b_skn_mon(a,b,c,d) (b_skn_s(a,b,c,d),C_O_K(d,MONOMIAL),OK)
#define m_skn_mon(a,b,c,d) (m_skn_s(a,b,c,d),C_O_K(d,MONOMIAL),OK)
#define addinvers_monomial(a,b) addinvers_polynom(a,b)
#define add_apply_monomial(a,b) add_apply_symfunc(a,b)
#define add_apply_monomial_monomial(a,b) add_apply_symfunc_symfunc(a,b)
#define m_part_monomial(a,b) m_skn_mon(a,cons_eins,NULL,b)
#define einsp_monomial(a) einsp_symfunc(a)

/* for ELM_SYM */
#define m_v_e(a,b) (m_v_s(a,b),C_O_K(b,ELM_SYM),OK)
#define add_monom_elmsym(a,b,c) add_monom_schur(a,b,c)
#define addinvers_elmsym(a,b) addinvers_polynom(a,b)
#define b_skn_e(a,b,c,d) (b_skn_s(a,b,c,d),C_O_K(d,ELM_SYM),OK)
#define m_skn_e(a,b,c,d) (m_skn_s(a,b,c,d),C_O_K(d,ELM_SYM),OK)
#define add_apply_elmsym(a,b) add_apply_symfunc(a,b)
#define add_apply_elmsym_elmsym(a,b) add_apply_symfunc_symfunc(a,b)
#define m_part_elmsym(a,b) m_skn_e(a,cons_eins,NULL,b)
#define einsp_elmsym(a) einsp_symfunc(a)

/* for POW_SYM */
#define m_v_ps(a,b) (m_v_s(a,b),C_O_K(b,POW_SYM),OK)
#define add_monom_powsym(a,b,c) add_monom_schur(a,b,c)
#define addinvers_powsym(a,b) addinvers_polynom(a,b)
#define b_skn_ps(a,b,c,d) (b_skn_s(a,b,c,d),C_O_K(d,POW_SYM),OK)
#define m_skn_ps(a,b,c,d) (m_skn_s(a,b,c,d),C_O_K(d,POW_SYM),OK)
#define compute_powsym_with_alphabet(a,b,c) \
    compute_power_with_alphabet(a,b,c)
#define add_apply_powsym(a,b) add_apply_symfunc(a,b)
#define add_apply_powsym_powsym(a,b) add_apply_symfunc_symfunc(a,b)
#define m_part_powsym(a,b) m_skn_ps(a,cons_eins,NULL,b)
#define einsp_powsym(a) einsp_symfunc(a)

/* for HOM_SYM */
#define m_v_h(a,b) (m_v_s(a,b),C_O_K(b,HOM_SYM),OK)
#define add_monom_homsym(a,b,c) add_monom_schur(a,b,c)
#define addinvers_homsym(a,b) addinvers_schur(a,b)
#define b_skn_h(a,b,c,d) (b_skn_s(a,b,c,d),C_O_K(d,HOM_SYM),OK)
#define m_skn_h(a,b,c,d) (m_skn_s(a,b,c,d),C_O_K(d,HOM_SYM),OK)
#define compute_homsym_with_alphabet(a,b,c) \
    compute_complete_with_alphabet(a,b,c)
#define add_apply_homsym(a,b) add_apply_symfunc(a,b)
#define add_apply_homsym_homsym(a,b) add_apply_symfunc_symfunc(a,b)
#define m_part_homsym(a,b) m_skn_h(a,cons_eins,NULL,b)
#define einsp_homsym(a) einsp_symfunc(a)

/* for nc.c */
#define S_NC_GL(a) S_V_I(a,0L)
#define S_NC_C(a) S_V_I(a,1L)
#define SYM_GL(a) (S_V_II(a,0L)==1L) /* true falls sym */
#define ALT_GL(a) (S_V_II(a,0L)==2L) /* true falls alt */
#define KRANZ_GL(a) (S_V_II(a,0L)==3L) /* true falls kranz */
#define CYCLIC_GL(a) (S_V_II(a,0L)==4L) /* true falls cyclic */
#define GLNQ_GL(a) (S_V_II(a,0L)==5L) /* true falls gl(n,q) */
#define S_GL_SYM_A(a) S_V_I(a,1L)
#define S_GL_ALT_A(a) S_V_I(a,1L)
#define S_GL_CYCLIC_A(a) S_V_I(a,1L)
#define S_GL_KRANZ_A(a) S_GL_SYM_A(S_V_I(S_V_I(a,1L),0L))
#define S_GL_KRANZ_GLA(a) (S_V_I(S_V_I(a,1L),0L))
#define S_GL_KRANZ_B(a) S_GL_SYM_A(S_V_I(S_V_I(a,1L),1L))
#define S_GL_KRANZ_GLB(a) (S_V_I(S_V_I(a,1L),1L))
#define S_GL_GLNQ_N(a) (S_V_I(S_V_I(a,1L),0L))
#define S_GL_GLNQ_Q(a) (S_V_I(S_V_I(a,1L),1L))



/* for ga.c */

#define m_skn_gral(a,b,c,d) ( m_skn_po(a,b,c,d), C_O_K(d,GRAL), OK )
#define b_skn_gral(a,b,c,d) ( b_skn_po(a,b,c,d), C_O_K(d,GRAL), OK )
#define hplus_hecke(a,b) hplus(a,b)

/* for ff.c */
#define S_FF_C(a) S_V_I(a,0)
#define S_FF_CI(a) S_V_II(a,0)
#define S_FF_IP(a) S_O_S(S_V_I(a,1)).ob_INTpointer
#define C_FF_IP(a,p) S_O_S(S_V_I(a,1)).ob_INTpointer=(INT*)p
#define S_FF_II(a,i) *((S_O_S(S_V_I(a,1)).ob_INTpointer) + i)
#define S_FF_DI(a) S_FF_II(a,0)
#define S_FF_ME(a) S_V_I(a,2)
#define S_FF_MEI(a) S_V_II(a,2)

/* for galois.c */
#define S_GR_CI(a) S_V_II(a,1)
#define S_GR_C(a) S_V_I(a,1)
#define S_GR_D(a) S_V_I(a,0)
#define S_GR_DI(a) S_V_II(a,0)



/* for longint */

extern INT loc_index, loc_size,loc_counter;
extern struct loc **loc_speicher;

extern INT longint_speicherindex,mem_counter_loc,longint_speichersize;
extern struct longint **longint_speicher;



#define FREE_LOC(a) \
    FREE_MEMMANAGER(struct loc *,loc_speicher,loc_index,loc_size,loc_counter,a)

#define LOCSGN(lx) ( ((lx)->w2 || (lx)->w1 || (lx)->w0 ) ? 1 : 0 )
 
#define LOCNULL(lx) ((lx)->w0=0,(lx)->w1=0,(lx)->w2=0)

#define LOCHOLE(aloc) \
do {\
CALLOC_MEMMANAGER(struct loc,loc_speicher,loc_index,loc_counter,*(aloc));\
LOCNULL(*(aloc));\
(*(aloc))->nloc = NULL;\
} while(0)

#define GANZDEFINIERE(x) \
do {\
 (x)->signum = (signed char)0;\
    (x)->laenge = (INT)1;\
     (x)->floc = NULL;\
      LOCHOLE(&((x)->floc)) ;\
} while (0)

#define INTGANZ(x) \
    ( x->signum < 0 ?\
      - x->floc->w0 - x->floc->w1 * LO_B - x->floc->w2 * LO_B * LO_B :\
      (x->floc->w0&BMINUSEINS)\
              +(x->floc->w1&BMINUSEINS) * LO_B\
              +(x->floc->w2&BMINUSEINS) * LO_B * LO_B )
 
#define T_LONGINT_INT(a)\
    if ((S_O_S(a).ob_longint) ->laenge == 1)\
        if (S_O_S(a).ob_longint ->floc ->w2 <= 1) /* AK 051101 */\
        {\
        INT wert = INTGANZ(S_O_S(a).ob_longint);\
        FREESELF(a);\
        M_I_I(wert,a);\
        }


#define INIT_LONGINT(l) \
 do { \
 C_O_K(l,LONGINT); \
 CALLOC_MEMMANAGER(struct longint, longint_speicher,\
                   longint_speicherindex,mem_counter_loc,(l->ob_self).ob_longint);\
 GANZDEFINIERE(S_O_S(l).ob_longint);\
 } while(0)



#define t_INTEGER_LONGINT(a,b) m_i_longint(a,b)

#ifdef FAST
#define SYMCHECK(a,b) 
#define COP(text,object)
#define CTO(type,text,object)
#define CTTO(type,type2,text,object)
#define CTTTO(type,type2,type3,text,object)
#define CTTTTO(type,type2,type3,type4,text,object)
#define CTTTTTO(type,type2,type3,type4,type5,text,object)
#define CTTTTTTO(type,type2,type3,type4,type5,type6,text,object)
#define CTTTTTTTO(type,type2,type3,type4,type5,type6,type7,text,object)
#define CTTTTTTTTO(type,type2,type3,type4,type5,type6,type7,type8,text,object)
#define TCTO(type,text,object)
#define TCTTO(type,type2,text,object)
#define TCTTTO(type,type2,type3,text,object)
#define TCTTTTO(type,type2,type3,type4,text,object)
#define TCTTTTTO(type,type2,type3,type4,type5,text,object)
#define TCTTTTTTO(type,type2,type3,type4,type5,type6,text,object)
#define TCTTTTTTTO(type,type2,type3,type4,type5,type6,type7,text,object)
#define TCTTTTTTTTO(type,type2,type3,type4,type5,type6,type7,type8,text,object)
#else
#define SYMCHECK(a,b) if (a) { erg += error(b); goto endr_ende; }
#define COP(b,a) if (((void *)a) == NULL)  { erg += null_object(b); goto endr_ende;}
#define CTO(type,text,object) \
        if (type == INTTYPE);\
        else { \
            COP(text,object);\
            if (type == ANYTYPE);\
            else if(S_O_K(object) != type) {\
                erg += wrong_type_oneparameter(text,object);\
                goto endr_ende;\
               }\
            }

#define CTTO(type,type2,text,object) \
        COP(text,object);\
        if((S_O_K(object) != type)&&(S_O_K(object) != type2)) {\
            erg += wrong_type_oneparameter(text,object);\
            goto endr_ende;\
        }

#define CTTTO(type,type2,type3,text,object) \
        COP(text,object);\
        if((S_O_K(object) != type)&&(S_O_K(object) != type2)\
                &&(S_O_K(object) != type3)) {\
            erg += wrong_type_oneparameter(text,object);\
            goto endr_ende; }
#define CTTTTO(type,type2,type3,type4,text,object) \
        COP(text,object);\
        if(               (S_O_K(object) != type)\
                                &&(S_O_K(object) != type2)\
                &&(S_O_K(object) != type3) \
                                &&(S_O_K(object) != type4)) {\
            erg += wrong_type_oneparameter(text,object);\
            goto endr_ende; }
#define CTTTTTO(type,type2,type3,type4,type5,text,object) \
        COP(text,object);\
        if(       (S_O_K(object) != type)\
                &&(S_O_K(object) != type2)\
                &&(S_O_K(object) != type3)\
                &&(S_O_K(object) != type4)\
                &&(S_O_K(object) != type5)        ) {\
            erg += wrong_type_oneparameter(text,object);\
            goto endr_ende; }
#define CTTTTTTO(type,type2,type3,type4,type5,type6,text,object) \
        COP(text,object);\
        if(       (S_O_K(object) != type)\
                &&(S_O_K(object) != type2)\
                &&(S_O_K(object) != type3)\
                &&(S_O_K(object) != type4)\
                &&(S_O_K(object) != type5)\
                &&(S_O_K(object) != type6)        ) {\
            erg += wrong_type_oneparameter(text,object);\
            goto endr_ende; }

#define CTTTTTTTO(type,type2,type3,type4,type5,type6,type7,text,object) \
        COP(text,object);\
        if(       (S_O_K(object) != type)\
                &&(S_O_K(object) != type2)\
                &&(S_O_K(object) != type3)\
                &&(S_O_K(object) != type4)\
                &&(S_O_K(object) != type5)\
                &&(S_O_K(object) != type7)\
                &&(S_O_K(object) != type6)        ) {\
            erg += wrong_type_oneparameter(text,object);\
            goto endr_ende; }

#define CTTTTTTTTO(type,type2,type3,type4,type5,type6,type7,type8,text,object) \
        COP(text,object);\
        if(       (S_O_K(object) != type)\
                &&(S_O_K(object) != type2)\
                &&(S_O_K(object) != type3)\
                &&(S_O_K(object) != type4)\
                &&(S_O_K(object) != type5)\
                &&(S_O_K(object) != type7)\
                &&(S_O_K(object) != type8)\
                &&(S_O_K(object) != type6)        ) {\
            erg += wrong_type_oneparameter(text,object);\
            goto endr_ende; }



#define TCTO(type,text,object) \
       CTO(type,text,object);\
       if (type == INTTYPE)  printf("%s= %ld\n",text,(INT)object);\
       else { printf("%s=",text);println(object);}

#define TCTTO(type,type2,text,object) \
       CTTO(type,type2,text,object);\
       printf("%s=",text);println(object);
       
#define TCTTTO(type,type2,type3,text,object) \
        COP(text,object);\
        if((S_O_K(object) != type)&&\
            (S_O_K(object) != type3)&&(S_O_K(object) != type2)) {\
            erg += wrong_type_oneparameter(text,object);\
            goto endr_ende;\
       }\
       printf("%s=",text);println(object);
      
#define TCTTTTO(type,type2,type3,type4,text,object) \
        COP(text,object);\
        if((S_O_K(object) != type)&&(S_O_K(object) != type4)&&\
            (S_O_K(object) != type3)&&(S_O_K(object) != type2)) {\
            erg += wrong_type_oneparameter(text,object);\
            goto endr_ende;\
       }\
       printf("%s=",text);println(object);

#define TCTTTTTO(type,type2,type3,type4,type5,text,object) \
        COP(text,object);\
        if((S_O_K(object) != type)&&(S_O_K(object) != type4)&&\
            (S_O_K(object) != type5)&&\
            (S_O_K(object) != type3)&&(S_O_K(object) != type2)) {\
            erg += wrong_type_oneparameter(text,object);\
            goto endr_ende;\
       }\
       printf("%s=",text);println(object);

#define TCTTTTTTO(type,type2,type3,type4,type5,type6,text,object) \
        COP(text,object);\
        if((S_O_K(object) != type)&&(S_O_K(object) != type4)&&\
            (S_O_K(object) != type5)&&(S_O_K(object) != type6)&&\
            (S_O_K(object) != type3)&&(S_O_K(object) != type2)) {\
            erg += wrong_type_oneparameter(text,object);\
            goto endr_ende;\
       }\
       printf("%s=",text);println(object);

#define TCTTTTTTTO(type,type2,type3,type4,type5,type6,type7,text,object) \
        COP(text,object);\
        if((S_O_K(object) != type)&&(S_O_K(object) != type4)&&\
            (S_O_K(object) != type5)&&(S_O_K(object) != type6)&&\
            (S_O_K(object) != type7)&&\
            (S_O_K(object) != type3)&&(S_O_K(object) != type2)) {\
            erg += wrong_type_oneparameter(text,object);\
            goto endr_ende;\
       }\
       printf("%s=",text);println(object);

#define TCTTTTTTTTO(type,type2,type3,type4,type5,type6,type7,type8,text,object) \
        COP(text,object);\
        if((S_O_K(object) != type)&&(S_O_K(object) != type4)&&\
            (S_O_K(object) != type5)&&(S_O_K(object) != type6)&&\
            (S_O_K(object) != type7)&&(S_O_K(object) != type8)&&\
            (S_O_K(object) != type3)&&(S_O_K(object) != type2)) {\
            erg += wrong_type_oneparameter(text,object);\
            goto endr_ende;\
       }\
       printf("%s=",text);println(object);

 
#endif
#define C2R(a,b,t,c) if (check_result_2(a,b,t,c) \
    != NORESULT) goto strlabel
#define S2R(a,b,t,c) erg += store_result_2(a,b,t,c);strlabel:
#define C3R(a,b,d,t,c) if (check_result_3(a,b,d,t,c)\
     != NORESULT) goto strlabel
#define S3R(a,b,d,t,c)  erg += store_result_3(a,b,d,t,c);strlabel:
#define C5R(a,b,d,e,f,t,c) if (check_result_5(a,b,d,e,f,t,c)\
     != NORESULT) goto strlabel
#define S5R(a,b,d,e,f,t,c)  erg += store_result_5(a,b,d,e,f,t,c);strlabel:
#define C0R(t,c) if (check_result_0(t,c)\
     != NORESULT) goto strlabel
#define S0R(t,c) erg += store_result_0(t,c);strlabel:
#define C1R(a,t,c) if (check_result_1(a,t,c)\
     != NORESULT) goto strlabel
#define S1R(a,t,c) erg += store_result_1(a,t,c);strlabel:
#define WTO(text,b) erg += wrong_type_oneparameter(text,b)
#define WTT(text,b,c) erg += wrong_type_twoparameter(text,b,c)
#define EDC(b) error_during_computation_code(b,erg)
#define ENDR(a) endr_ende: if (erg != OK) EDC(a); return erg;
#define ENDO(a) endr_ende: if (erg != OK) EDC(a); return (OP) NULL;
#define ENDTYP(a,t) endr_ende: if (erg != OK) EDC(a); return (t) NULL;
#define NYI(b) not_yet_implemented(b)
#define NOP(a) null_object(a)
#define EOP(text,object) \
        COP(text,object);\
        if (EMPTYP(object)) {erg += empty_object(text); goto endr_ende;}
#define FATALERROR(text) fatal_error(text)
#define CH2D(a,b) if ((a) == (b) ) { erg += equal_2_error(); goto endr_ende;}

#define CE2A(a,b,f) if (check_equal_2a(a,b,f,&erg) == EQUAL) goto endr_ende;

#define CE3(a,b,c,f) \
    if ((a==c) && (b == c))\
        {\
        OP checkequal3_d = callocobject();\
        *checkequal3_d = *c;\
        C_O_K(c,EMPTY);\
        erg += (*f)(checkequal3_d,checkequal3_d,c);\
        erg += freeall(checkequal3_d);\
        goto endr_ende;\
        }\
    else if (a==c)\
        {\
        OP checkequal3_d = callocobject();\
        *checkequal3_d = *c;\
        C_O_K(c,EMPTY);\
        erg += (*f)(checkequal3_d,b,c);\
        erg += freeall(checkequal3_d);\
        goto endr_ende;\
        }\
    else if (b==c)\
        {\
        OP checkequal3_d = callocobject();\
        *checkequal3_d = *c;\
        C_O_K(c,EMPTY);\
        erg += (*f)(a,checkequal3_d,c);\
        erg += freeall(checkequal3_d);\
        goto endr_ende;\
        }\
    else\
        {\
        if (c != NULL)\
            FREESELF(c);\
        }

#define CE4(a,b,c,d,f) \
    if (check_equal_4(a,b,c,d,\
    f,&erg) == EQUAL) goto endr_ende;
#define CE5(a,b,c,d,e,f) \
    if (check_equal_5(a,b,c,d,e,\
    f,&erg) == EQUAL) goto endr_ende;

#define GET_BIT_I(a,i) (((*a) >> (i))&1)
/*
#define GET_BV_I(a,i) ((*(((unsigned char *)S_V_S(a) ) + ((i)>>3))  >> ((i)&7))&1)
*/
#define GET_BV_I(a,i) ((*(((unsigned char *)S_V_S(a) ) + ((i)>>3))  >> (7-((i)&7))&1))
#define GET_BV_B(a,i) (*(((unsigned char *)S_V_S(a) ) + (i)>>3)) 
/* 
#define UNSET_BV_I(a,i) (*((unsigned char *)S_V_S(a)  + ((i)>>3))  &= (~(1 << ((i)&7)))) 
*/
#define UNSET_BV_I(a,i) (\
    *((unsigned char *)S_V_S(a)  + ((i)>>3))  \
    &= (~(1 << (7-((i)&7))       )           )\
    ) 
#define UNSET_BIT_I(a,i) ((*(a))  &= (~(1 << (i))))
/*
#define SET_BV_I(a,i) ( *((unsigned char *)S_V_S(a)  + ((i)>>3))  |= (1 << ((i)&7)))
*/
#define SET_BV_I(a,i) ( *((unsigned char *)S_V_S(a)  + ((i)>>3))  |= (128 >> ((i)&7)))
#define SET_BIT_I(a,i) ( *(a)  |= (1 << (i)))
#define S_BV_LI(a) (S_V_LI(a) % 8 == 0 ? S_V_LI(a)>>3 : (S_V_LI(a)>>3) +1)


#define cons_two cons_zwei
#define ANFANG \
int main()\
{\
OP a,b,c,d,e,f,g,h;\
INT i,j,k;\
OP z=NULL;\
anfang();\
a=callocobject();\
b=callocobject();\
c=callocobject();\
d=callocobject();\
e=callocobject();\
f=callocobject();\
g=callocobject();\
h=callocobject();

#define ENDE \
freeall(a);\
freeall(b);\
freeall(c);\
freeall(d);\
freeall(e);\
freeall(f);\
freeall(g);\
freeall(h);\
ende();\
i=j=k=0;z=NULL;\
return 0;\
}
#define SYM_BEGIN ANFANG
#define SYM_END ENDE

#define inhalt(a,b) content(a,b)
#define inhalt_tableaux(a,b) content_tableaux(a,b)
#define inhalt_word(a,b) content_word(a,b)









/* FOR ALL macros */
#define FORALL_HASHTABLE_PRE060202(z,a,B)\
do { \
    OP FORALL_E;INT I,J; \
    for (FORALL_E=S_V_S(a), I=0; I<S_V_LI(a); I++,FORALL_E++) \
        {\
        if (S_O_K(FORALL_E)==VECTOR)\
           for (J=0;J<S_V_LI(FORALL_E) ;J++) \
               { \
               z = S_V_I(FORALL_E,J); \
               if (not EMPTYP(z)) {B;} \
               } \
        }\
} while(0)

#define FORALL_HASHTABLE(z,a,B)\
do { \
    OP FORALL_E;INT I,J; \
    for (FORALL_E=S_V_S(a), I=0; I<S_V_LI(a); I++,FORALL_E++) \
        {\
        if (S_O_K(FORALL_E)==VECTOR)\
           for (J=0,z=S_V_S(FORALL_E);J<S_V_LI(FORALL_E) ;J++,z++) \
               { if (not EMPTYP(z)) {B;} } \
        else if (S_I_I(FORALL_E) == -1) break;\
        else { I = S_I_I(FORALL_E)-1; FORALL_E=S_V_I(a,I); } \
        }\
} while(0)


#define FORALL(z,a,B)\
if (S_O_K(a) == HASHTABLE) \
do { \
    OP FORALL_E;INT I,J; \
    for (FORALL_E=S_V_S(a), I=0; I<S_V_LI(a); I++,FORALL_E++) \
        {\
        if (S_O_K(FORALL_E)==VECTOR)\
           for (J=0,z=S_V_S(FORALL_E);J<S_V_LI(FORALL_E) ;J++,z++) \
               { if (not EMPTYP(z)) {B;} }\
        else if (S_I_I(FORALL_E) == -1) break;\
        else { I = S_I_I(FORALL_E)-1; FORALL_E=S_V_I(a,I); } \
        }\
} while(0);\
else if (LISTP(a)) { \
            OP FORALL_E; \
            FORALL_E=a; \
            while (FORALL_E!=NULL) \
                { z = S_L_S(FORALL_E); \
                if (z != NULL) {B;}; \
                FORALL_E=S_L_N(FORALL_E); } \
            }\
else if (MATRIXP(a)) {\
    INT I=S_M_HI(a)*S_M_LI(a)-1;\
    for (z=S_M_S(a)+I;I>=0;I--,z--) {B;}\
}\
else if (VECTORP(a)) {\
    INT I=S_V_LI(a)-1;\
    for (z=S_V_S(a)+I;I>=0;I--,z--) {B;}\
}





/* new macros for main functions */

#define ABSOLUTE_INTEGER(a,b) \
    M_I_I((S_I_I(a) > 0 ? S_I_I(a) : -S_I_I(a)), b)

#define ADD_INTEGER(a,b,c) \
    if (S_O_K(b) == INTEGER) erg += add_integer_integer(a,b,c);\
    else if (S_O_K(b) == LONGINT) erg += add_longint_integer(b,a,c);\
    else if (S_O_K(b) == BRUCH) erg += add_bruch_integer(b,a,c);\
    else  erg += add_integer(a,b,c)

#define ADD(a,b,c) \
if (S_O_K(a) == INTEGER)    ADD_INTEGER(a,b,c); \
else if (S_O_K(a) == LONGINT)  \
    {\
    if (S_O_K(b) == INTEGER) erg += add_longint_integer(a,b,c);\
    else if (S_O_K(b) == LONGINT) erg += add_longint_longint(b,a,c);\
    else  erg += add_longint(a,b,c);\
    }\
else\
    erg += add(a,b,c)

#define ADD_APPLY_INTEGER(a,b)\
        if (S_O_K(b) == INTEGER) erg += add_apply_integer_integer(a,b);\
        else if (S_O_K(b) == LONGINT) erg += add_apply_integer_longint(a,b);\
        else if (S_O_K(b) == BRUCH) erg += add_apply_integer_bruch(a,b);\
        else  erg += add_apply_integer(a,b)

#define ADD_APPLY(a,b) \
    if (S_O_K(a) == INTEGER)  ADD_APPLY_INTEGER(a,b);\
    else if (S_O_K(a) == LONGINT)  \
        {\
        if (S_O_K(b) == INTEGER) erg += add_apply_longint_integer(a,b);\
        else if (S_O_K(b) == LONGINT) erg += add_apply_longint_longint(a,b);\
        else  erg += add_apply_longint(a,b);\
        }\
    else if (S_O_K(a) == BRUCH)  \
        {\
        if (S_O_K(b) == INTEGER) erg += add_apply_bruch_integer(a,b);\
        else if (S_O_K(b) == BRUCH) erg += add_apply_bruch_bruch(a,b);\
        else  erg += add_apply_bruch(a,b);\
        }\
    else if (S_O_K(a) == INTEGERVECTOR)  erg += add_apply_integervector(a,b);\
    else if (S_O_K(a) == POLYNOM)  erg += add_apply_polynom(a,b);\
    else if (S_O_K(a) == FF)  erg += add_apply_ff(a,b);\
    else\
        erg += add_apply(a,b)

#define ADDINVERS_INTEGER(a,b) M_I_I(-S_I_I(a),b)

#define ADDINVERS(a,b) \
if (S_O_K(a) == INTEGER) ADDINVERS_INTEGER(a,b);\
else if (S_O_K(a) == LONGINT) erg += addinvers_longint(a,b);\
else if (S_O_K(a) == BRUCH) erg += addinvers_bruch(a,b);\
else erg += addinvers(a,b)


#define ADDINVERS_APPLY_LONGINT(a) erg += (GANZNEG(S_O_S(a).ob_longint),OK)
#define ADDINVERS_APPLY_INTEGER(a) M_I_I( - S_I_I(a),a)

#define ADDINVERS_APPLY(a)\
if (S_O_K(a) == INTEGER) ADDINVERS_APPLY_INTEGER(a);\
else if (S_O_K(a) == LONGINT) ADDINVERS_APPLY_LONGINT(a);\
else if (S_O_K(a) == BRUCH) erg += addinvers_apply_bruch(a);\
else if (S_O_K(a) == MONOM) erg += addinvers_apply_monom(a);\
else erg += addinvers_apply(a)


#define BINOM_POSINTEGER_POSINTEGER(a,b,c)\
if (S_I_I(a) < BINOMLIMIT) {\
     M_I_I(  \
          (      (S_I_I(b)>S_I_I(a))     ? 0 :  binom_values [ S_I_I(a) ] [S_I_I(b)] )\
          ,c);\
    }\
else binom(a,b,c)


/*
#ifdef SYMMAGMA
#define CALLOCOBJECT() \
       ( (freeall_speicherposition >= 0L) ? \
         freeall_speicher[freeall_speicherposition--] : \
         mem_calloc(sizeof(struct object),1) )
#define CALLOCOBJECT() (OP)mem_calloc(sizeof(struct object),1)
#else
*/
/* freeall_speicherposition is next free object */
#define CALLOCOBJECT() \
       ( (freeall_speicherposition >= 0L) ? \
         freeall_speicher[freeall_speicherposition--] : \
         callocobject_fast() )
/*
#endif
*/

#define CALLOCOBJECT2(a,b) \
do { a=CALLOCOBJECT(); b=CALLOCOBJECT(); } while(0)

#define CALLOCOBJECT3(a,b,c) \
do { a=CALLOCOBJECT(); b=CALLOCOBJECT();c=CALLOCOBJECT(); } while(0)

#define CALLOCOBJECT4(a,b,c,d) \
do { a=CALLOCOBJECT(); b=CALLOCOBJECT();c=CALLOCOBJECT(); d=CALLOCOBJECT();} while(0)

#define CALLOCOBJECT5(a,b,c,d,e) \
do { a=CALLOCOBJECT(); b=CALLOCOBJECT();\
     c=CALLOCOBJECT(); d=CALLOCOBJECT();\
     e=CALLOCOBJECT();} while(0)

#define CALLOCOBJECT6(a,b,c,d,e,f) \
do { a=CALLOCOBJECT(); b=CALLOCOBJECT();\
     c=CALLOCOBJECT(); d=CALLOCOBJECT();\
     e=CALLOCOBJECT(); f=CALLOCOBJECT(); } while(0)

#define CALLOCOBJECT7(a,b,c,d,e,f,g) \
do { a=CALLOCOBJECT(); b=CALLOCOBJECT();\
     c=CALLOCOBJECT(); d=CALLOCOBJECT();\
     e=CALLOCOBJECT(); f=CALLOCOBJECT(); \
     g=CALLOCOBJECT();} while(0)

#define CALLOCOBJECT8(a,b,c,d,e,f,g,h) \
do { a=CALLOCOBJECT(); b=CALLOCOBJECT();\
     c=CALLOCOBJECT(); d=CALLOCOBJECT();\
     e=CALLOCOBJECT(); f=CALLOCOBJECT();h=CALLOCOBJECT(); \
     g=CALLOCOBJECT();} while(0)

#define CALLOCOBJECT9(a,b,c,d,e,f,g,h,i) \
do { a=CALLOCOBJECT(); b=CALLOCOBJECT(); h=CALLOCOBJECT(); i=CALLOCOBJECT();\
     c=CALLOCOBJECT(); d=CALLOCOBJECT();\
     e=CALLOCOBJECT(); f=CALLOCOBJECT(); \
     g=CALLOCOBJECT();} while(0)

#define COMP_INTEGER(a,b)\
    ( S_O_K(b) == INTEGER ? COMP_INTEGER_INTEGER(a,b) : \
       (S_O_K(b) == LONGINT ? - comp_longint_integer(b,a) : comp_integer(a,b) )\
    )

#define COMP(a,b)\
    ( S_O_K(a) == INTEGER ? COMP_INTEGER(a,b) :\
       (S_O_K(a) == LONGINT ? comp_longint(a,b) : \
          (S_O_K(a) == INTEGERMATRIX ? comp_integermatrix(a,b) : \
             comp(a,b) \
          )\
       )\
    )
    
#define COPY(a,b) \
    ( (S_O_K(a) == INTEGER) ? M_I_I(S_I_I(a),b):\
      ( (S_O_K(a) == LONGINT) ? copy_longint(a,b): \
        ( (S_O_K(a) == BRUCH) ? copy_bruch(a,b): \
          ( (S_O_K(a) == MONOM) ?  copy_monom(a,b): \
            ( (S_O_K(a) == PARTITION) ? copy_partition(a,b): \
              ( (S_O_K(a) == HASHTABLE)? copy_hashtable(a,b): \
                ( (S_O_K(a) == MATRIX)? copy_matrix(a,b): \
                  ( (S_O_K(a) == INTEGERMATRIX)? copy_integermatrix(a,b): \
                      copy(a,b)\
                  )\
                )\
              )\
            )\
          )\
        )\
      )\
    )

#define CLEVER_COPY_INTEGER(a,b) \
do { switch(S_O_K(b)) {\
        case INTEGER:\
        case EMPTY:\
             M_I_I(S_I_I(a),b);\
             break;\
        default:\
             FREESELF(b);\
             M_I_I(S_I_I(a),b);\
             break;\
        }\
} while (0)

#define CLEVER_COPY_FF(a,b) \
do { switch(S_O_K(b)) {\
        case INTEGER:\
             C_O_K(b,EMPTY);\
        case EMPTY:\
             erg += copy_ff(a,b);\
             break;\
        case FF:\
             {\
             INT *ap,*bp,i;\
             COPY(S_FF_C(a),S_FF_C(b));\
             COPY(S_FF_ME(a),S_FF_ME(b));\
             ap =S_FF_IP(a);bp=S_FF_IP(b);\
             if (*ap != *bp)\
                 bp = (INT*) SYM_realloc(bp,(S_FF_DI(a)+1)*sizeof(INT));\
             for(i=0;i<=ap[0];i++) bp[i]=ap[i];\
             C_FF_IP(b,bp);\
             };\
             break;   \
        default:\
             FREESELF(b);\
             erg += copy_ff(a,b);\
             break;\
        }\
} while (0)
#define CLEVER_COPY_BRUCH(a,b) \
do { switch(S_O_K(b)) {\
        case INTEGER:\
             C_O_K(b,EMPTY);\
        case EMPTY:\
             erg += copy_bruch(a,b);\
             break;\
        case BRUCH:\
             FREESELF(S_B_O(b));\
             FREESELF(S_B_U(b));\
             COPY(S_B_O(a),S_B_O(b));\
             COPY(S_B_U(a),S_B_U(b));\
             C_B_I(b,S_B_I(a));\
             break;\
        default:\
             FREESELF(b);\
             erg += copy_bruch(a,b);\
             break;\
        }\
} while (0)

#define CLEVER_COPY_LONGINT(a,b)\
do { switch(S_O_K(b)) {\
        case INTEGER:\
             C_O_K(b,EMPTY);\
        case EMPTY:\
             erg += copy_longint(a,b);\
             break;\
        default:\
             FREESELF(b);\
             erg += copy_longint(a,b);\
             break;\
        }\
} while(0)

#define CLEVER_COPY_PARTITION(a,b)\
do { switch(S_O_K(b)) {\
        case INTEGER:\
             C_O_K(b,EMPTY);\
        case EMPTY:\
             erg += copy_partition(a,b);\
             break;\
        case PARTITION:\
             FREESELF(S_PA_S(b));\
             if (S_O_K(S_PA_S(a))==INTEGERVECTOR) copy_integervector(S_PA_S(a),S_PA_S(b));\
             else COPY(S_PA_S(a),S_PA_S(b));\
             C_PA_K(b, S_PA_K(a));\
             C_PA_HASH(b, S_PA_HASH(a));\
             break;\
        default:\
             FREESELF(b);\
             erg += copy_partition(a,b);\
             break;\
        }\
} while(0)



#define CLEVER_COPY(a,b) \
do { if (S_O_K(a) == INTEGER) CLEVER_COPY_INTEGER(a,b);\
else if (S_O_K(a) == LONGINT) CLEVER_COPY_LONGINT(a,b);\
else if (S_O_K(a) == BRUCH) CLEVER_COPY_BRUCH(a,b);\
else if (S_O_K(a) == PARTITION) CLEVER_COPY_PARTITION(a,b);\
else if (S_O_K(a) == FF) CLEVER_COPY_FF(a,b);\
else { erg += copy(a,b); }\
} while(0)



#define DEC(a)\
if (S_O_K(a) == INTEGER) DEC_INTEGER(a);\
else if (S_O_K(a) == LONGINT) erg+= dec_longint(a);\
else dec(a)

#define EINSP_LONGINT(a)\
    (\
    ((S_O_S(a).ob_longint) ->floc ->w0 == 1) \
    &&\
    ((S_O_S(a).ob_longint) ->floc ->w1 == 0)\
    &&\
    ((S_O_S(a).ob_longint) ->floc ->w2 == 0)\
    &&\
    ((S_O_S(a).ob_longint) ->signum == 1)\
    &&\
    ((S_O_S(a).ob_longint) ->laenge == 1)\
    )


#define EINSP(a)\
    ( S_O_K(a) == INTEGER ? EINSP_INTEGER(a): \
       ( S_O_K(a) == LONGINT ? EINSP_LONGINT(a) : \
          ( S_O_K(a) == BRUCH ?  EINSP_BRUCH(a) : \
            ( einsp(a) ) \
          ) \
       ) \
    )

#define EVEN_INTEGER(a) (S_I_I(a) % 2 == 0)
#define EVEN_LONGINT(a) \
     (\
     ((S_O_S(a).ob_longint) ->signum == 0) \
     ||\
     ((S_O_S(a).ob_longint) ->floc ->w0 % 2 == 0)\
     )

#define EVEN(a) \
    ( S_O_K(a) == INTEGER ? (EVEN_INTEGER(a)) : \
       ( S_O_K(a) == LONGINT ? EVEN_LONGINT(a) : even(a) )\
    )

#define FREE_EMPTY_OBJECT(a)\
    do {\
    CTO(EMPTY,"FREE_EMPTY_OBJECT(1)",a);\
    if (freeall_speichersize+SPEICHERSIZE <freeall_speichersize_max)\
        {\
        if (freeall_speicherposition+1  == freeall_speichersize) \
            {\
            freeall_speicher = (OP *) \
                SYM_realloc(freeall_speicher,\
                            (freeall_speichersize+SPEICHERSIZE)*sizeof(OP));\
            if (freeall_speicher == NULL) {\
                erg += error("no more memory in freeall");\
                goto endr_ende;\
                }\
            freeall_speichersize = freeall_speichersize+SPEICHERSIZE;\
            }\
        freeall_speicher[++freeall_speicherposition] = a;\
        }\
    else SYM_FREE(a);\
    } while(0)

#define FREEALL_INTEGER(a) do { C_O_K(a,EMPTY); FREE_EMPTY_OBJECT(a); } while(0)
#define FREESELF_INTEGERVECTOR(a) \
    do {\
        extern INT freevectorstruct();\
        if (S_V_LI(a) == (INT)1) FREEALL_INTEGER(S_V_S(a));\
        else if (S_V_LI(a) > (INT)0) SYM_free(S_V_S(a));\
        FREEALL_INTEGER(S_V_L(a));\
        freevectorstruct(S_O_S(a).ob_vector);\
        C_O_K(a,EMPTY);\
    } while(0)
#define FREEALL_INTEGERVECTOR(a) do { \
    FREESELF_INTEGERVECTOR(a); FREE_EMPTY_OBJECT(a); } while(0)
       
    
#define FREESELF(a) \
    if (S_O_K(a) == EMPTY);\
    else if (S_O_K(a) == INTEGER) C_O_K(a,EMPTY);\
    else if (S_O_K(a) == LONGINT)  erg += freeself_longint(a);  \
    else if (S_O_K(a) == BRUCH)  erg += freeself_bruch(a);  \
    else if (S_O_K(a) == PARTITION)  erg += freeself_partition(a);  \
    else if (S_O_K(a) == MATRIX)  erg += freeself_matrix(a);  \
    else if (S_O_K(a) == INTEGERMATRIX)  erg += freeself_integermatrix(a);  \
    else if (S_O_K(a) == MONOM)  FREESELF_MONOM(a);  \
    else if (S_O_K(a) == INTEGERVECTOR)  FREESELF_INTEGERVECTOR(a);  \
    else if (S_O_K(a) == VECTOR)  erg += freeself_vector(a);  \
    else if (S_O_K(a) == HASHTABLE)  erg += freeself_hashtable(a);  \
    else if (LISTP(a))  erg += freeself_list(a);  \
    else if (S_O_K(a) == PERMUTATION)  erg += freeself_permutation(a);  \
    else if (S_O_K(a) == SKEWPARTITION)  erg += freeself_skewpartition(a);  \
    else if (S_O_K(a) == FF)  erg += freeself_ff(a);  \
    else erg += freeself(a)

#define FREESELF2(a,b) do { FREESELF(a); FREESELF(b); } while(0)
#define FREESELF2(a,b) do { FREESELF(a); FREESELF(b); } while(0) 
#define FREESELF3(a,b,c) do { FREESELF(a); FREESELF(b); FREESELF(c); } while(0) 
#define FREESELF4(a,b,c,d) do { FREESELF2(a,b); FREESELF2(c,d); } while(0) 
#define FREESELF5(a,b,c,d,e) do { FREESELF2(a,b); FREESELF3(c,d,e); } while(0) 
#define FREESELF6(a,b,c,d,e,f) do { FREESELF3(a,b,f); FREESELF3(c,d,e); } while(0) 
#define FREESELF7(a,b,c,d,e,f,g) do { FREESELF4(a,b,f,g); FREESELF3(c,d,e); } while(0) 

#define FREEALL(a) do { FREESELF(a); FREE_EMPTY_OBJECT(a); } while(0)
#define FREEALL2(a,b) do { FREEALL(a); FREEALL(b); } while(0) 
#define FREEALL3(a,b,c) do { FREEALL(a); FREEALL(b); FREEALL(c); } while(0) 
#define FREEALL4(a,b,c,d) do { FREEALL(a); FREEALL(b); FREEALL(c);FREEALL(d); } while(0) 
#define FREEALL5(a,b,c,d,e) do { FREEALL2(a,b); FREEALL3(c,d,e); } while(0) 
#define FREEALL6(a,b,c,d,e,f) do { FREEALL3(a,b,f); FREEALL3(c,d,e); } while(0) 
#define FREEALL7(a,b,c,d,e,f,g) do { FREEALL4(a,b,f,g); FREEALL3(c,d,e); } while(0) 
#define FREEALL8(a,b,c,d,e,f,g,h) do { FREEALL4(a,b,f,g); FREEALL4(c,d,e,h); } while(0) 
#define FREEALL9(a,b,c,d,e,f,g,h,i) do { FREEALL4(a,b,f,g); FREEALL5(c,d,e,h,i); } while(0) 

#define GANZDIV_INTEGER(a,b,c) \
    if (S_O_K(b) == INTEGER) M_I_I(S_I_I(a)/S_I_I(b),c);\
    else if (S_O_K(b) == LONGINT) erg += ganzdiv_integer_longint(a,b,c);\
    else  erg += ganzdiv_integer(a,b,c)
 
#define GANZDIV_LONGINT(a,b,c) \
    if (S_O_K(b) == INTEGER) erg += ganzdiv_longint_integer(a,b,c);\
    else if (S_O_K(b) == LONGINT) erg += ganzdiv_longint_longint(a,b,c);\
    else  erg += ganzdiv_longint(a,b,c)
 
#define GANZDIV(a,b,c) \
if (S_O_K(a) == INTEGER)    GANZDIV_INTEGER(a,b,c); \
else if (S_O_K(a) == LONGINT)  GANZDIV_LONGINT(a,b,c); \
else\
    erg += ganzdiv(a,b,c)


#define GANZDIV_APPLY_INTEGER(a,b) \
    if (S_O_K(b) == INTEGER) M_I_I(S_I_I(a)/S_I_I(b),a);\
    else ganzdiv_apply_integer(a,b)

#define GANZDIV_APPLY_LONGINT(a,b) \
    if (S_O_K(b) == INTEGER) erg += ganzdiv_apply_longint_integer(a,b);\
    else if (S_O_K(b) == LONGINT) erg += ganzdiv_apply_longint_longint(a,b);\
    else ganzdiv_apply_longint(a,b)

#define GANZDIV_APPLY(a,b) \
if (S_O_K(a) == INTEGER) GANZDIV_APPLY_INTEGER(a,b);\
else if (S_O_K(a) == LONGINT) GANZDIV_APPLY_LONGINT(a,b);\
else\
    erg += ganzdiv_apply(a,b);


#define GGT_INTEGER(a,b,c) \
    if (S_O_K(b) == INTEGER) erg += ggt_integer_integer(a,b,c);\
    else if (S_O_K(b) == LONGINT) erg += ggt_integer_longint(a,b,c);\
    else  erg += ggt_integer(a,b,c)

#define GGT_LONGINT(a,b,c) \
    if (S_O_K(b) == INTEGER) erg += ggt_integer_longint(b,a,c);\
    else if (S_O_K(b) == LONGINT) erg += ggt_longint_longint(a,b,c);\
    else  erg += ggt_longint(a,b,c)

#define GGT(a,b,c) \
if (S_O_K(a) == INTEGER)    GGT_INTEGER(a,b,c); \
else if (S_O_K(a) == LONGINT)  GGT_LONGINT(a,b,c); \
else\
    erg += ggt(a,b,c)

#define HALF_APPLY_INTEGER(a) M_I_I((S_I_I(a) >> 1),a)

#define HALF_APPLY(a)\
if (S_O_K(a) == INTEGER)\
    HALF_APPLY_INTEGER(a);\
else if (S_O_K(a) == LONGINT)\
    half_apply_longint(a);\
else\
    erg += half_apply(a)\


#define HASH_INTEGERVECTOR(a,res)\
    if (S_V_LI(a) == 0) res=4711;\
    else {\
        INT hash_integer_vector_i;\
        res = S_V_II(a,0);\
        for (hash_integer_vector_i=1;hash_integer_vector_i<S_V_LI(a);hash_integer_vector_i++)\
            {\
            res *= 4711;\
            res += S_V_II(a,hash_integer_vector_i);\
            }\
        }

#define HASH_MONOMPARTITION(a) \
    ( S_PA_HASH(S_MO_S(a)) == -1 ? hash_partition(S_MO_S(a)) : S_PA_HASH(S_MO_S(a))  )
#define HASH_PARTITION(a) \
    ( S_PA_HASH(a) == -1 ? hash_partition(a) : S_PA_HASH(a)  )
#define HASH_MONOM(a) \
    ( S_O_K(S_MO_S(a)) == PARTITION ? HASH_PARTITION(S_MO_S(a)) : hash(S_MO_S(a)) )
#define HASH(a) \
    ( S_O_K(a) == MONOM ?  HASH_MONOM(a): \
      ( S_O_K(a) == INTEGER ? S_I_I(a) : hash(a) )\
    )

#define INC(a)\
if (S_O_K(a) == INTEGER) INC_INTEGER(a);\
else if (S_O_K(a) == LONGINT) erg+= inc_longint(a);\
else inc(a)

#define INSERT_BINTREE(a,b,eh,cf) insert_bintree(a,b,eh,cf)
#define INSERT_HASHTABLE(a,b,eh,cf,hf) \
    if (S_O_K(a) == HASHTABLE) insert_hashtable_hashtable(a,b,eh,cf,hf);\
    else if (S_O_K(a) == SCHUR) insert_schur_hashtable(a,b,eh,cf,hf);\
    else if (S_O_K(a) == MONOMIAL) insert_monomial_hashtable(a,b,eh,cf,hf);\
    else if (S_O_K(a) == ELMSYM) insert_elmsym_hashtable(a,b,eh,cf,hf);\
    else if (S_O_K(a) == POWSYM) insert_powsym_hashtable(a,b,eh,cf,hf);\
    else if (S_O_K(a) == HOMSYM) insert_homsym_hashtable(a,b,eh,cf,hf);\
    else insert_scalar_hashtable(a,b,eh,cf,hf)
#define INSERT_LIST(a,b,eh,cf) \
    if (LISTP(a)) insert_list_list(a,b,eh,cf); \
    else insert_list(a,b,eh,cf)
    
#define INSERT(a,b,eh,cf) \
    if (S_O_K(b) == HASHTABLE) INSERT_HASHTABLE(a,b,eh,cf,hash); \
    else if (S_O_K(b) == BINTREE) INSERT_BINTREE(a,b,eh,cf); \
    else INSERT_LIST(a,b,eh,cf) 

#define INSERT_SCHURMONOM_(m,c)\
    if (S_O_K(c) == HASHTABLE)\
       INSERT_HASHTABLE(m,c,add_koeff,eq_monomsymfunc,hash_monompartition);\
    else if (S_O_K(c) == SCHUR)\
       INSERT_LIST(m,c,add_koeff,comp_monomschur);\
    else if (S_O_K(c) == BINTREE)\
       INSERT_BINTREE(m,c,add_koeff,comp_monomschur);\
    else\
       WTO("INSERT_SCHURMONOM_(2)",c)

#define INSERT_POWSYMMONOM_(m,c)\
    if (S_O_K(c) == HASHTABLE)\
       INSERT_HASHTABLE(m,c,add_koeff,eq_monomsymfunc,hash_monompartition);\
    else if (S_O_K(c) == POWSYM)\
       INSERT_LIST(m,c,add_koeff,comp_monompowsym);\
    else if (S_O_K(c) == BINTREE)\
       INSERT_BINTREE(m,c,add_koeff,comp_monompowsym);\
    else\
       WTO("INSERT_POWSYMMONOM_(2)",c)

#define INSERT_ELMSYMMONOM_(m,c)\
    if (S_O_K(c) == HASHTABLE)\
       INSERT_HASHTABLE(m,c,add_koeff,eq_monomsymfunc,hash_monompartition);\
    else if (S_O_K(c) == ELMSYM)\
       INSERT_LIST(m,c,add_koeff,comp_monomelmsym);\
    else if (S_O_K(c) == BINTREE)\
       INSERT_BINTREE(m,c,add_koeff,comp_monomelmsym);\
    else\
       WTO("INSERT_ELMSYMMONOM_(2)",c)

#define INSERT_HOMSYMMONOM_(m,c)\
    if (S_O_K(c) == HASHTABLE)\
       INSERT_HASHTABLE(m,c,add_koeff,eq_monomsymfunc,hash_monompartition);\
    else if (S_O_K(c) == HOMSYM)\
       INSERT_LIST(m,c,add_koeff,comp_monomhomsym);\
    else if (S_O_K(c) == BINTREE)\
       INSERT_BINTREE(m,c,add_koeff,comp_monomhomsym);\
    else\
       WTO("INSERT_HOMSYMMONOM_(2)",c)




 
#define INTLOGPOS5_4(ai)   (( ai >= 10000L)     ? 5 : 4)
#define INTLOGPOS5_3(ai)   (( ai >= 1000L)      ? INTLOGPOS5_4(ai) : 3)
#define INTLOGPOS2_1(ai)   (( ai >= 10L)        ? 2 : 1)
#define INTLOGPOS5_1(ai)   (( ai >= 100L)       ? INTLOGPOS5_3(ai) : INTLOGPOS2_1(ai))
#define INTLOGPOS7_6(ai)   (( ai >= 1000000L)   ? 7 : 6)
#define INTLOGPOS10_9(ai)  (( ai >= 1000000000L)? 10 : 9)
#define INTLOGPOS10_8(ai)  (( ai >= 100000000L) ? INTLOGPOS10_9(ai) : 8)
#define INTLOGPOS10_6(ai)  (( ai >= 10000000L ) ? INTLOGPOS10_8(ai) : INTLOGPOS7_6(ai) )
#define INTLOGPOS(ai)      (( ai >= 100000L )   ? INTLOGPOS10_6(ai) : INTLOGPOS5_1(ai) )
#define INTLOG(a) ( (S_I_I(a)) >= 0 ? INTLOGPOS(S_I_I(a)) : INTLOGPOS(-S_I_I(a)) )


#define INVERS_INTEGER(a,b) do {\
          if (S_I_I(a)==1)  M_I_I(1,b); else \
          if (S_I_I(a)==-1)  M_I_I(-1,b); else \
          { b_ou_b(CALLOCOBJECT(),CALLOCOBJECT(),b); \
            M_I_I(1,S_B_O(b)); \
            M_I_I(S_I_I(a),S_B_U(b)); \
            C_B_I(b,GEKUERZT); \
          }\
        } while(0)

#define INVERS_LONGINT(a,b) \
      do {  b_ou_b(CALLOCOBJECT(),CALLOCOBJECT(),b); M_I_I(1,S_B_O(b)); \
       copy_longint(a,S_B_U(b)); C_B_I(b,GEKUERZT) ; } while(0)

#define INVERS_BRUCH(a,b) \
      do {  b_ou_b(CALLOCOBJECT(),CALLOCOBJECT(),b); COPY(S_B_O(a),S_B_U(b)); \
      COPY(S_B_U(a), S_B_O(b)); C_B_I(b,S_B_I(a)) ;} while(0)

#define INVERS(a,b) \
if (S_O_K(a) == INTEGER)  INVERS_INTEGER(a,b);\
else if (S_O_K(a) == LONGINT)  INVERS_LONGINT(a,b);\
else if (S_O_K(a) == BRUCH)   INVERS_BRUCH(a,b);\
else\
    erg += invers(a,b)

#define KUERZEN(a)\
if (S_O_K(S_B_O(a)) == INTEGER) {\
    if (S_O_K(S_B_U(b)) == INTEGER) erg += kuerzen_integer_integer(a);\
    else if (S_O_K(S_B_U(b)) == LONGINT) erg += kuerzen_integer_longint(a);\
    else erg += krz(a);\
}\
else if (S_O_K(S_B_O(a)) == LONGINT) {\
    if (S_O_K(S_B_U(b)) == INTEGER) erg += kuerzen_longint_integer(a);\
    else if (S_O_K(S_B_U(b)) == LONGINT) erg += kuerzen_longint_longint(a);\
    else erg += krz(a);\
}\
else krz(a)


#define MOD_APPLY_INTEGER(a,b) \
    if (S_O_K(b) == INTEGER) M_I_I(S_I_I(a) % S_I_I(b), a);\
    else if (S_O_K(b) == LONGINT) erg += mod_apply_integer_longint(a,b);\
    else mod_apply(a,b)

#define MOD_APPLY(a,b) \
if (S_O_K(a) == INTEGER)  MOD_APPLY_INTEGER(a,b);\
else if (S_O_K(a) == LONGINT)  erg += mod_apply_longint(a,b);\
else erg += mod_apply(a,b)


#define MULT_APPLY_INTEGER_INTEGER(a,b) \
    if ( NULLP_INTEGER(a) || NULLP_INTEGER(b) ) \
            { \
            M_I_I(0,b); \
            } \
    else if ( (INTLOG(a) + INTLOG(b)) > 9L )\
            {\
            erg += t_int_longint(b,b);\
            erg += mult_apply_integer_longint(a,b);\
            }\
    else M_I_I(S_I_I(a)*S_I_I(b),b)

#define MULT_APPLY_INTEGER(a,b) \
    if (S_O_K(b) == INTEGER) MULT_APPLY_INTEGER_INTEGER(a,b);\
    else if (S_O_K(b) == LONGINT) erg += mult_apply_integer_longint(a,b);\
    else if (S_O_K(b) == BRUCH) erg += mult_apply_integer_bruch(a,b);\
    else if (S_O_K(b) == MONOM) erg += mult_apply_integer_monom(a,b);\
    else if (POLYP(b)) erg += mult_apply_integer_polynom(a,b);\
    else if (S_O_K(b) == HASHTABLE) erg += mult_apply_integer_hashtable(a,b);\
    else  erg += mult_apply_integer(a,b)

#define MULT_APPLY_LONGINT(a,b)\
    if (S_O_K(b) == INTEGER) erg += mult_apply_longint_integer(a,b);\
    else if (S_O_K(b) == LONGINT) erg += mult_apply_longint_longint(a,b);\
    else if (S_O_K(b) == BRUCH) erg += mult_apply_longint_bruch(a,b);\
    else if (POLYP(b)) erg += mult_apply_longint_polynom(a,b);\
    else  erg += mult_apply_longint(a,b)

#define MULT_APPLY_BRUCH(a,b)\
    if (S_O_K(b) == INTEGER) erg += mult_apply_bruch_integer(a,b);\
    else if (S_O_K(b) == LONGINT) erg += mult_apply_bruch_longint(a,b);\
    else if (S_O_K(b) == BRUCH) erg += mult_apply_bruch_bruch(a,b);\
    else if (POLYP(b)) erg += mult_apply_bruch_polynom(a,b);\
    else if (S_O_K(b) == HASHTABLE) erg += mult_apply_bruch_hashtable(a,b);\
    else  erg += mult_apply_bruch(a,b)

#define MULT_APPLY(a,b) \
if (S_O_K(a) == INTEGER)  MULT_APPLY_INTEGER(a,b);\
else if (S_O_K(a) == LONGINT)  MULT_APPLY_LONGINT(a,b);\
else if (S_O_K(a) == BRUCH)   MULT_APPLY_BRUCH(a,b);\
else if (S_O_K(a) == POLYNOM)   erg += mult_apply_polynom(a,b);\
else if (S_O_K(a) == FF)   erg += mult_apply_ff(a,b);\
else\
    erg += mult_apply(a,b)

#define MULT_INTEGER_INTEGER(a,b,c) \
    if (INTLOG(a) + INTLOG(b) > 9) {\
        OP mii_c= CALLOCOBJECT();\
        erg += t_int_longint(a,mii_c);\
        erg += mult_longint_integer(mii_c,b,c);\
        FREEALL(mii_c);\
        }\
    else\
        M_I_I(S_I_I(a)*S_I_I(b),c)

#define MULT_INTEGER(a,b,c) \
    if (S_O_K(b) == INTEGER) MULT_INTEGER_INTEGER(a,b,c);\
    else if (S_O_K(b) == LONGINT) erg += mult_longint_integer(b,a,c);\
    else if (S_O_K(b) == BRUCH) erg += mult_bruch_integer(b,a,c);\
    else if (S_O_K(b) == CYCLOTOMIC) erg += mult_scalar_cyclo(a,b,c);\
    else  erg += mult_integer(a,b,c)

#define MULT_LONGINT(a,b,c) \
    if (S_O_K(b) == INTEGER) erg += mult_longint_integer(a,b,c);\
    else if (S_O_K(b) == LONGINT) erg += mult_longint_longint(b,a,c);\
    else if (S_O_K(b) == CYCLOTOMIC) erg += mult_scalar_cyclo(a,b,c);\
    else  erg += mult_longint(a,b,c)

#define MULT_BRUCH(a,b,c) \
    if (S_O_K(b) == INTEGER) erg += mult_bruch_integer(a,b,c);\
    else if (S_O_K(b) == LONGINT) erg += mult_bruch_longint(a,b,c);\
    else if (S_O_K(b) == BRUCH) erg += mult_bruch_bruch(a,b,c);\
    else if (S_O_K(b) == CYCLOTOMIC) erg += mult_scalar_cyclo(a,b,c);\
    else  erg += mult_bruch(a,b,c)

#define MULT(a,b,c) \
if (S_O_K(a) == INTEGER)    MULT_INTEGER(a,b,c); \
else if (S_O_K(a) == LONGINT)  MULT_LONGINT(a,b,c); \
else if (S_O_K(a) == BRUCH)  MULT_BRUCH(a,b,c);\
else if (S_O_K(a) == CYCLOTOMIC)  mult_cyclo(a,b,c);\
else if (S_O_K(a) == FF)  mult_ff(a,b,c);\
else if (S_O_K(a) == SQ_RADICAL)  mult_sqrad(a,b,c);\
else\
    erg += mult(a,b,c)

#define MULT_SCALAR_MONOMLIST(a,b,c)\
if ((NULLP(a))|| (NULLP(b))) erg += init(S_O_K(b),c);\
else erg += trans2formlist(a,b,c,mult)

#define CLEVER_MULT_INTEGER(a,b,c)\
do {\
FREESELF(c); MULT_INTEGER(a,b,c);\
} while(0)

#define CLEVER_MULT_LONGINT(a,b,c)\
do {\
FREESELF(c); MULT_LONGINT(a,b,c);\
} while(0)

#define CLEVER_MULT_BRUCH(a,b,c)\
if (S_O_K(b) == BRUCH) {\
    switch (S_O_K(c)) {\
        case INTEGER: C_O_K(c,EMPTY);\
        case EMPTY:\
        case BRUCH: erg += mult_bruch_bruch(a,b,c); break;\
        default: FREESELF(c); mult_bruch_bruch(a,b,c); break;\
        }\
    }\
else do { FREESELF(c); MULT_BRUCH(a,b,c); } while(0)

#define CLEVER_MULT_FF(a,b,c)\
if (S_O_K(b) == FF) {\
    switch (S_O_K(c)) {\
        case INTEGER: C_O_K(c,EMPTY);\
        case EMPTY:\
        case BRUCH: erg += mult_ff_ff(a,b,c); break;\
        default: FREESELF(c); mult_ff_ff(a,b,c); break;\
        }\
    }\
else do { FREESELF(c); erg += mult_ff(a,b,c); } while(0) 

#define CLEVER_MULT(a,b,c) \
if (S_O_K(a) == INTEGER)    CLEVER_MULT_INTEGER(a,b,c); \
else if (S_O_K(a) == LONGINT)  CLEVER_MULT_LONGINT(a,b,c); \
else if (S_O_K(a) == BRUCH)  CLEVER_MULT_BRUCH(a,b,c);\
else if (S_O_K(a) == FF)  CLEVER_MULT_FF(a,b,c);\
else\
    do { FREESELF(c); MULT(a,b,c); } while(0)


#define NEGEINSP_LONGINT(a)\
    (\
    ((S_O_S(a).ob_longint) ->floc ->w0 == 1) \
    &&\
    ((S_O_S(a).ob_longint) ->floc ->w1 == 0)\
    &&\
    ((S_O_S(a).ob_longint) ->floc ->w2 == 0)\
    &&\
    ((S_O_S(a).ob_longint) ->signum == -1)\
    &&\
    ((S_O_S(a).ob_longint) ->laenge == 1)\
    )

#define NEGEINSP(a)\
    ( S_O_K(a) == INTEGER ? NEGEINSP_INTEGER(a): \
       ( S_O_K(a) == LONGINT ? NEGEINSP_LONGINT(a) : \
            ( negeinsp(a) ) \
       ) \
    )

#define NEGP_LONGINT(a)  (GANZSIGNUM(S_O_S(a).ob_longint) == (signed char)-1)

#define NEGP(a) \
    ( S_O_K(a) == INTEGER ? (NEGP_INTEGER(a)) : \
       ( S_O_K(a) == LONGINT ? NEGP_LONGINT(a) : negp(a) )\
    )

#define NEW_HASHTABLE(c)\
    do { c = CALLOCOBJECT(); erg += init_hashtable(c); } while(0)

#define CLEAR_HASHTABLE(c) /* removes all entries in a hashtable */ \
    do { OP z,zz;INT i,j;\
         for (i=0,z=S_V_S(c);i<S_V_LI(c);i++,z++)\
             { \
             if (not EMPTYP(z)) {\
                 for (j=0,zz=S_V_S(z);j<S_V_LI(z);j++,zz++) FREESELF(zz);\
                 /*FREESELF_INTEGERVECTOR(z);*/ C_I_I(S_V_L(z),1);\
                 }\
             /* C_I_I(z,-1);*/ \
             else if (S_I_I(z) == -1) break;\
             else { i = S_I_I(z)-1; z = S_V_I(c,i); }\
             }\
         M_I_I(0,S_V_I(c,S_V_LI(c)));} while(0)



#define NEW_INTEGER(m,i) do { m=CALLOCOBJECT(); M_I_I(i,m); } while(0)
#define NEW_TABLEAU(t,um) do { t=CALLOCOBJECT(); m_u_t(a,t); } while(0)
#define NEW_VECTOR(v,i)\
    do { v = CALLOCOBJECT(); erg += m_il_v(i,v); } while(0)
#define NEW_INTEGERVECTOR(v,i)\
    do { v = CALLOCOBJECT(); erg += m_il_integervector(i,v); } while(0)
#define NEW_HOMSYM(a)\
    do { a = CALLOCOBJECT(); erg += b_sn_l(NULL,NULL,a); \
         C_O_K(a,HOMSYM); } while(0)


#define NULLP_LONGINT(a)  (GANZSIGNUM(S_O_S(a).ob_longint) == (signed char) 0)
#define NULLP_HASHTABLE(a)  (S_V_II(a,S_V_LI(a)) == 0)
#define NULLP_BRUCH(a) \
   (S_O_K(S_B_O(a)) == INTEGER ? NULLP_INTEGER(S_B_O(a)) : \
       ( S_O_K(S_B_O(a)) == LONGINT  ?  NULLP_LONGINT(S_B_O(a)) : nullp(S_B_O(a))\
       )\
   )


#define NULLP(a)\
    ( S_O_K(a) == INTEGER ? NULLP_INTEGER(a) : \
       ( S_O_K(a) == LONGINT ? NULLP_LONGINT(a) : \
         ( S_O_K(a) == HASHTABLE ? NULLP_HASHTABLE(a) : \
          ( S_O_K(a) == BRUCH ?  nullp_bruch(a) : \
            ( S_O_K(a) == FF ? nullp_ff(a):  \
               ( POLYP(a) ? nullp_polynom(a): nullp(a) ) \
            )\
          ) \
         )\
       ) \
    )

#define ODD_INTEGER(a) (S_I_I(a) % 2 == 1)
#define ODD_LONGINT(a) \
     ((S_O_S(a).ob_longint) ->floc ->w0 % 2 == 1)

#define ODD(a) \
    ( S_O_K(a) == INTEGER ? (ODD_INTEGER(a)) : \
       ( S_O_K(a) == LONGINT ? ODD_LONGINT(a) : odd(a) )\
    )

#define PARTITION_WEIGHT(a,i) \
do { \
    OP z; \
    INT j; \
    for(j=S_PA_LI(a),i=0,z=S_V_S(S_PA_S(a));j>0;j--,z++) \
        i+=S_I_I(z); \
} while(0)

#define MAXPARTI(a) ((S_PA_LI(a) == 0) ? 0 : S_PA_II(a,S_PA_LI(a)-1) )

#define POSP_LONGINT(a)  (GANZSIGNUM(S_O_S(a).ob_longint) == (signed char)1)

#define POSP(a) \
    ( S_O_K(a) == INTEGER ? (POSP_INTEGER(a)) : \
       ( S_O_K(a) == LONGINT ? POSP_LONGINT(a) : posp(a) )\
    )

#define SWAP(a,b) do { \
        struct object swap_object;  \
        swap_object = *a; \
        *a = *b; \
        *b = swap_object; \
        } while(0)

#define CE2(a,b,f) \
    if (a==b)  {\
        OP checkequal2_c = CALLOCOBJECT();\
        *checkequal2_c = *b;\
        C_O_K(b,EMPTY);\
        erg += (*f)(checkequal2_c,b);\
        FREEALL(checkequal2_c);\
        goto endr_ende;\
        }\
    else   FREESELF(b) 
/* used for transfunctions */
#define TCE2(a,b,f,typ) \
    if (a==b)  {\
        OP checkequal2_c = CALLOCOBJECT();\
        *checkequal2_c = *b;\
        C_O_K(b,EMPTY);\
        erg += (*f)(checkequal2_c,b);\
        FREEALL(checkequal2_c);\
        goto endr_ende;\
        }\
    else   if ( (S_O_K(b) != HASHTABLE) && (S_O_K(b) != typ) ) \
        FREESELF(b)

#define ADD_KOEFF(a,b) \
    ADD_APPLY(S_MO_K(a), S_MO_K(b));\
    if (NULLP(S_MO_K(b)))\
        FREESELF_MONOM(b)
 
    

#define M_FORALL_MONOMIALS_IN_AB(a,b,c,f,partf)\
{\
OP ff,z,y;\
ff = CALLOCOBJECT();\
    FORALL (y,a, {\
    FORALL (z,b, {\
            FREESELF(ff);\
            MULT(S_MO_K(z),S_MO_K(y),ff);\
            if (not EINSP(f))\
                {\
                MULT_APPLY(f,ff);\
                }\
            erg += (*partf)(S_MO_S(y),S_MO_S(z),c,ff);\
            } );\
            } );\
    FREEALL(ff);\
}

#define M2_FORALL_MONOMIALS_IN_AB(a,b,c,f,m,partf)\
{\
OP ff,z,y;\
ff = CALLOCOBJECT();\
    FORALL (y,a, {\
    FORALL (z,b, {\
            FREESELF(ff);\
            MULT(S_MO_K(z),S_MO_K(y),ff);\
            if (not EINSP(f))\
                {\
                MULT_APPLY(f,ff);\
                }\
            erg += (*partf)(S_MO_S(y),S_MO_S(z),c,ff,m);\
            } );\
            } );\
    FREEALL(ff);\
}

#define M3_FORALL_MONOMIALS_IN_AB(a,b,c,f,m,l,partf)\
{\
OP ff,z,y;\
ff = CALLOCOBJECT();\
    FORALL (y,a, {\
    FORALL (z,b, {\
            FREESELF(ff);\
            MULT(S_MO_K(z),S_MO_K(y),ff);\
            if (not EINSP(f))\
                {\
                MULT_APPLY(f,ff);\
                }\
            erg += (*partf)(S_MO_S(y),S_MO_S(z),c,ff,m,l);\
            } );\
            } );\
    FREEALL(ff);\
}



#define M_FORALL_MONOMIALS_IN_B(a,b,c,f,partf)\
{\
OP ff,z;\
if (not EINSP(f)) {\
    ff = CALLOCOBJECT();\
    FORALL (z,b, {\
            FREESELF(ff);\
            MULT(S_MO_K(z),f,ff);\
            erg += (*partf)(a,S_MO_S(z),c,ff);\
            } );\
    FREEALL(ff);\
    }\
else {\
    FORALL (z,b, {\
       erg += (*partf)(a,S_MO_S(z),c,S_MO_K(z));\
            } );\
    }\
}
#define M2_FORALL_MONOMIALS_IN_B(a,b,c,f,m,partf)\
{\
OP ff,z;\
if (not EINSP(f)) {\
    ff = CALLOCOBJECT();\
    FORALL (z,b, {\
            MULT(S_MO_K(z),f,ff);\
            erg += (*partf)(a,S_MO_S(z),c,ff,m);\
            FREESELF(ff);\
            } );\
    FREEALL(ff);\
    }\
else {\
    FORALL (z,b, {\
       erg += (*partf)(a,S_MO_S(z),c,S_MO_K(z),m);\
            } );\
    }\
}

#define M3_FORALL_MONOMIALS_IN_B(a,b,c,f,m,l,partf)\
{\
OP ff,z;\
if (not EINSP(f)) {\
    ff = CALLOCOBJECT();\
    FORALL (z,b, {\
            MULT(S_MO_K(z),f,ff);\
            erg += (*partf)(a,S_MO_S(z),c,ff,m,l);\
            FREESELF(ff);\
            } );\
    FREEALL(ff);\
    }\
else {\
    FORALL (z,b, {\
       erg += (*partf)(a,S_MO_S(z),c,S_MO_K(z),m,l);\
            } );\
    }\
}



#define M_FORALL_MONOMIALS_IN_A(a,b,c,f,partf)\
{\
OP ff,z;\
if (not EINSP(f)) {\
    ff = CALLOCOBJECT();\
    FORALL (z,a, {\
            MULT(S_MO_K(z),f,ff);\
            erg += (*partf)(S_MO_S(z),b,c,ff);\
            FREESELF(ff);\
            } );\
    FREEALL(ff);\
    }\
else {\
    FORALL (z,a, {\
       erg += (*partf)(S_MO_S(z),b,c,S_MO_K(z));\
            } );\
    }\
}
#define M2_FORALL_MONOMIALS_IN_A(a,b,c,f,m,partf)\
{\
OP ff,z;\
if (not EINSP(f)) {\
    ff = CALLOCOBJECT();\
    FORALL (z,a, {\
            MULT(S_MO_K(z),f,ff);\
            erg += (*partf)(S_MO_S(z),b,c,ff,m);\
            FREESELF(ff);\
            } );\
    FREEALL(ff);\
    }\
else {\
    FORALL (z,a, {\
       erg += (*partf)(S_MO_S(z),b,c,S_MO_K(z),m);\
            } );\
    }\
}

#define M3_FORALL_MONOMIALS_IN_A(a,b,c,f,m,l,partf)\
{\
OP ff,z;\
if (not EINSP(f)) {\
    ff = CALLOCOBJECT();\
    FORALL (z,a, {\
            MULT(S_MO_K(z),f,ff);\
            erg += (*partf)(S_MO_S(z),b,c,ff,m,l);\
            FREESELF(ff);\
            } );\
    FREEALL(ff);\
    }\
else {\
    FORALL (z,a, {\
       erg += (*partf)(S_MO_S(z),b,c,S_MO_K(z),m,l);\
            } );\
    }\
}



#define T_FORALL_MONOMIALS_IN_A(a,b,f,partf)\
{\
OP ff,z;\
if (not EINSP(f)) {\
    ff = CALLOCOBJECT();\
    FORALL (z,a, {\
            MULT(S_MO_K(z),f,ff);\
            erg += (*partf)(S_MO_S(z),b,ff);\
            FREESELF(ff);\
            } );\
    FREEALL(ff);\
    }\
else {\
    FORALL (z,a, {\
       erg += (*partf)(S_MO_S(z),b,S_MO_K(z));\
            } );\
    }\
}

#define _NULL_PARTITION_(b,c,f) \
do { OP m;\
CTO(PARTITION,"_NULL_PARTITION_(1)",b);\
m=CALLOCOBJECT(); \
erg += b_sk_mo(CALLOCOBJECT(),CALLOCOBJECT(),m);\
erg += copy_partition(b,S_MO_S(m));\
COPY(f,S_MO_K(m));\
if (S_O_K(c)==HASHTABLE)\
insert_scalar_hashtable(m,c,add_koeff,eq_monomsymfunc,hash_monompartition);\
else \
INSERT_LIST(m,c,add_koeff,comp_monommonomial);\
} while(0)

#define WEIGHT_HASHTABLE(a) S_V_II(a,S_V_LI(a))



#define NEQ(a,b) (! EQ(a,b))
#define GR(a,b) (COMP(a,b) > (INT)0)
#define GT(a,b) (COMP(a,b) > (INT)0)
#define GE(a,b) (COMP(a,b) >= (INT)0)
#define LE(a,b) (COMP(a,b) <= (INT)0)
#define LT(a,b) (COMP(a,b) < (INT)0)


/* speicher managment */

#define FREE_MEMMANAGER(t,s,i,g,c,v)\
do {\
    c--;\
    if ((i+1) == g) {\
       if (g+SPEICHERSIZE <freeall_speichersize_max)\
       {\
       if (g == 0) {\
           s = (t*) SYM_MALLOC(SPEICHERSIZE * sizeof(t));\
           SYMCHECK(s == NULL,"no memory");\
           g = SPEICHERSIZE;\
           }\
       else {\
           s = (t*) SYM_realloc (s, (g+SPEICHERSIZE) * sizeof(t));\
           SYMCHECK(s == NULL,"no memory");\
           g += SPEICHERSIZE;\
           }\
       s[++i] = (v);\
       }\
       else SYM_FREE(v);\
       }\
    else s[++i] = (v);\
} while(0)
 
#define CALLOC_MEMMANAGER(t,s,i,c,v)\
do {\
    c++;\
    if (i>=0) v = s[i--];\
    else v = (t*) SYM_MALLOC(sizeof(t));\
} while(0)
 
#define ANFANG_MEMMANAGER(s,i,g,c) \
s = NULL; i = -1; c = 0; g = 0
 
#define ENDE_MEMMANAGER(s,i,g,c,text) \
if (no_banner != TRUE) { SYMCHECK(c, text);} \
if (s != NULL) { \
    INT jj;\
    for (jj = 0; jj<=i;jj++) SYM_FREE(s[jj]);\
    SYM_FREE(s);\
    s = NULL;\
    }\
i = -1;\
g = 0


#define MACRO_H
#endif /* MACRO_H */