Changeset db7488 in git


Ignore:
Timestamp:
Oct 9, 2014, 4:55:18 PM (10 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
14ace0b9984562c3e892c13717dd1d04c0c259f2
Parents:
7761b3315768e0864934f15733eaa71709bdb431
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2014-10-09 16:55:18+02:00
git-committer:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2014-10-09 16:56:09+02:00
Message:
jjSYSTEM: cleanup, format, documentation
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/extra.cc

    r7761b3 rdb7488  
    44/*
    55* ABSTRACT: general interface to internals of Singular ("system" command)
     6* jjSYSTEM: official commands, must be documented in the manual,
     7*           #defines must be local to each command
     8* jjEXTENDED_SYSTEM: tests, temporary comands etc.
    69*/
    710
     
    162165#endif
    163166
    164 /*
    165  *   New function/system-calls that will be included as dynamic module
    166  * should be inserted here.
    167  * - without HAVE_DYNAMIC_LOADING: these functions comes as system("....");
    168  * - with    HAVE_DYNAMIC_LOADING: these functions are loaded as module.
    169  */
    170 //#ifndef HAVE_DYNAMIC_LOADING
    171 
    172167#ifdef HAVE_PCV
    173168#include "pcv.h"
    174169#endif
    175 
    176 //#endif /* not HAVE_DYNAMIC_LOADING */
    177170
    178171#ifdef __CYGWIN__
     
    309302    else
    310303
    311 /*==================== gen ==================================*/
    312 // // This seems to be obsolette...?!
    313 // // TODO: cleanup doc/reference.doc:6998 to system("gen")
    314 //     if(strcmp(sys_cmd,"gen")==0)
    315 //     {
    316 //       res->rtyp=INT_CMD;
    317 //       res->data=(void *)(long)npGen;
    318 //       return FALSE;
    319 //     }
    320 //     else
    321304/*==================== sh ==================================*/
    322305    if(strcmp(sys_cmd,"sh")==0)
     
    631614    if(strcmp(sys_cmd,"complexNearZero")==0)
    632615    {
    633       if (h->Typ()==NUMBER_CMD )
     616      if ((h!=NULL) && (h->Typ()==NUMBER_CMD))
    634617      {
    635618        if ( h->next!=NULL && h->next->Typ()==INT_CMD )
     
    664647    if(strcmp(sys_cmd,"getPrecDigits")==0)
    665648    {
    666       if ( !rField_is_long_C(currRing) && !rField_is_long_R(currRing) )
     649      if ( (currRing==NULL)
     650      ||  (!rField_is_long_C(currRing) && !rField_is_long_R(currRing)))
    667651      {
    668652        WerrorS( "unsupported ground field!");
     
    674658      //{ Print("%d, %d\n",getGMPFloatDigits(),gmp_output_digits);}
    675659      return FALSE;
    676     }
    677     else
    678   /*==================== mpz_t loader ======================*/
    679     if(strcmp(sys_cmd, "GNUmpLoad")==0)
    680     {
    681       if ((h != NULL) && (h->Typ() == STRING_CMD))
    682       {
    683         char* filename = (char*)h->Data();
    684         FILE* f = fopen(filename, "r");
    685         if (f == NULL)
    686         {
    687           WerrorS( "invalid file name (in paths use '/')");
    688           return FALSE;
    689         }
    690         mpz_t m; mpz_init(m);
    691         mpz_inp_str(m, f, 10);
    692         fclose(f);
    693         number n = n_InitMPZ(m, coeffs_BIGINT);
    694         res->rtyp = BIGINT_CMD;
    695         res->data = (void*)n;
    696         return FALSE;
    697       }
    698       else
    699       {
    700         WerrorS( "expected valid file name as a string");
    701         return TRUE;
    702       }
    703     }
    704     else
    705   /*==================== intvec matching ======================*/
    706     /* Given two non-empty intvecs, the call
    707             'system("intvecMatchingSegments", ivec, jvec);'
    708          computes all occurences of jvec in ivec, i.e., it returns
    709          a list of int indices k such that ivec[k..size(jvec)+k-1] = jvec.
    710          If no such k exists (e.g. when ivec is shorter than jvec), an
    711          intvec with the single entry 0 is being returned. */
    712     if(strcmp(sys_cmd, "intvecMatchingSegments")==0)
    713     {
    714       if ((h       != NULL) && (h->Typ()       == INTVEC_CMD) &&
    715           (h->next != NULL) && (h->next->Typ() == INTVEC_CMD) &&
    716           (h->next->next == NULL))
    717       {
    718         intvec* ivec = (intvec*)h->Data();
    719         intvec* jvec = (intvec*)h->next->Data();
    720         intvec* r = new intvec(1); (*r)[0] = 0;
    721         int validEntries = 0;
    722         for (int k = 0; k <= ivec->rows() - jvec->rows(); k++)
    723         {
    724           if (memcmp(&(*ivec)[k], &(*jvec)[0],
    725                        sizeof(int) * jvec->rows()) == 0)
    726           {
    727             if (validEntries == 0)
    728               (*r)[0] = k + 1;
    729             else
    730             {
    731               r->resize(validEntries + 1);
    732               (*r)[validEntries] = k + 1;
    733             }
    734             validEntries++;
    735           }
    736         }
    737         res->rtyp = INTVEC_CMD;
    738         res->data = (void*)r;
    739         return FALSE;
    740       }
    741       else
    742       {
    743         WerrorS("expected two non-empty intvecs as arguments");
    744         return TRUE;
    745       }
    746     }
    747     else
    748   /* ================== intvecOverlap ======================= */ 
    749     /* Given two non-empty intvecs, the call
    750             'system("intvecOverlap", ivec, jvec);'
    751          computes the longest intvec kvec such that ivec ends with kvec
    752          and jvec starts with kvec. The length of this overlap is being
    753          returned. If there is no overlap at all, then 0 is being returned. */
    754     if(strcmp(sys_cmd, "intvecOverlap")==0)
    755     {
    756       if ((h       != NULL) && (h->Typ()       == INTVEC_CMD) &&
    757             (h->next != NULL) && (h->next->Typ() == INTVEC_CMD) &&
    758             (h->next->next == NULL))
    759       {
    760         intvec* ivec = (intvec*)h->Data();
    761         intvec* jvec = (intvec*)h->next->Data();
    762         int ir = ivec->rows(); int jr = jvec->rows();
    763         int r = jr; if (ir < jr) r = ir;   /* r = min{ir, jr} */
    764         while ((r >= 1) && (memcmp(&(*ivec)[ir - r], &(*jvec)[0],
    765                                      sizeof(int) * r) != 0))
    766           r--;
    767         res->rtyp = INT_CMD;
    768         res->data = (void*)(long)r;
    769         return FALSE;
    770       }
    771       else
    772       {
    773         WerrorS("expected two non-empty intvecs as arguments");
    774         return TRUE;
    775       }
    776     }
    777     else
    778   /*==================== Hensel's lemma ======================*/
    779     if(strcmp(sys_cmd, "henselfactors")==0)
    780     {
    781       if ((h != NULL) && (h->Typ() == INT_CMD) &&
    782         (h->next != NULL) && (h->next->Typ() == INT_CMD) &&
    783         (h->next->next != NULL) && (h->next->next->Typ() == POLY_CMD) &&
    784         (h->next->next->next != NULL) &&
    785         (h->next->next->next->Typ() == POLY_CMD) &&
    786         (h->next->next->next->next != NULL) &&
    787         (h->next->next->next->next->Typ() == POLY_CMD) &&
    788         (h->next->next->next->next->next != NULL) &&
    789         (h->next->next->next->next->next->Typ() == INT_CMD) &&
    790         (h->next->next->next->next->next->next == NULL))
    791       {
    792         int xIndex = (int)(long)h->Data();
    793         int yIndex = (int)(long)h->next->Data();
    794         poly hh    = (poly)h->next->next->Data();
    795         poly f0    = (poly)h->next->next->next->Data();
    796         poly g0    = (poly)h->next->next->next->next->Data();
    797         int d      = (int)(long)h->next->next->next->next->next->Data();
    798         poly f; poly g;
    799         henselFactors(xIndex, yIndex, hh, f0, g0, d, f, g);
    800         lists L = (lists)omAllocBin(slists_bin);
    801         L->Init(2);
    802         L->m[0].rtyp = POLY_CMD; L->m[0].data=(void*)f;
    803         L->m[1].rtyp = POLY_CMD; L->m[1].data=(void*)g;
    804         res->rtyp = LIST_CMD;
    805         res->data = (char *)L;
    806         return FALSE;
    807       }
    808       else
    809       {
    810         WerrorS( "expected argument list (int, int, poly, poly, poly, int)");
    811         return TRUE;
    812       }
    813660    }
    814661    else
     
    945792    }
    946793    else
    947   /*==================== neworder =============================*/
    948   // should go below
    949     if(strcmp(sys_cmd,"neworder")==0)
    950     {
    951       if ((h!=NULL) &&(h->Typ()==IDEAL_CMD))
    952       {
    953         res->rtyp=STRING_CMD;
    954         res->data=(void *)singclap_neworder((ideal)h->Data(), currRing);
    955         return FALSE;
    956       }
    957       else
    958         WerrorS("ideal expected");
    959     }
    960     else
    961794  /*==== countedref: reference and shared ====*/
    962795    if (strcmp(sys_cmd, "shared") == 0)
     
    1078911      {
    1079912        res->rtyp=LIST_CMD;
    1080         if (h->Typ()==POLY_CMD)
     913        if ((h->Typ()==POLY_CMD)
     914        && (currRing!=NULL)
     915        && (getCoeffType(currRing->cf)==n_transExt))
    1081916        {
    1082917          intvec *v=NULL;
     
    1105940    else
    1106941    #endif
    1107   /* =================== LLL via NTL ==============================*/   
     942  /* =================== LLL via NTL ==============================*/
    1108943  #ifdef HAVE_NTL
    1109944    if (strcmp(sys_cmd, "LLL") == 0)
     
    12131048    else
    12141049  #endif
    1215   //#ifndef HAVE_DYNAMIC_LOADING
    12161050  /*==================== pcv ==================================*/
    12171051  #ifdef HAVE_PCV
     
    12521086    else
    12531087  #endif
     1088  /*==================== hessenberg/eigenvalues ==================================*/
     1089  #ifdef HAVE_EIGENVAL
     1090    if(strcmp(sys_cmd,"hessenberg")==0)
     1091    {
     1092      return evHessenberg(res,h);
     1093    }
     1094    else
     1095  #endif
    12541096  /*==================== eigenvalues ==================================*/
    12551097  #ifdef HAVE_EIGENVAL
    1256     if(strcmp(sys_cmd,"hessenberg")==0)
    1257     {
    1258       return evHessenberg(res,h);
    1259     }
    1260     else
    12611098    if(strcmp(sys_cmd,"eigenvals")==0)
    12621099    {
     
    12731110    else
    12741111  #endif
    1275   //#endif /* HAVE_DYNAMIC_LOADING */
    12761112  /*==================== contributors =============================*/
    12771113    if(strcmp(sys_cmd,"contributors") == 0)
     
    12871123    if(strcmp(sys_cmd,"spectrum") == 0)
    12881124    {
    1289       if (h->Typ()!=POLY_CMD)
     1125      if ((h==NULL) || (h->Typ()!=POLY_CMD))
    12901126      {
    12911127        WerrorS("poly expected");
     
    13461182    else
    13471183  #endif
    1348 /*==================== tensorModuleMult ========================= */ 
     1184/*==================== tensorModuleMult ========================= */
    13491185  #define HAVE_SHEAFCOH_TRICKS 1
    13501186
     
    13681204    else
    13691205  #endif
    1370   ////////////////////////////////////////////////////////////////////////
    1371   /// Additional interface functions to non-commutative subsystem (PLURAL)
    1372   ///
    1373 
    1374 
    1375   /*==================== Approx_Step  =================*/
    1376   #ifdef HAVE_PLURAL
    1377     if (strcmp(sys_cmd, "astep") == 0)
    1378     {
    1379          ideal I;
    1380          if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
    1381          {
    1382            I=(ideal)h->CopyD();
    1383            res->rtyp=IDEAL_CMD;
    1384            if (rIsPluralRing(currRing)) res->data=Approx_Step(I);
    1385            else res->data=I;
    1386            setFlag(res,FLAG_STD);
    1387          }
    1388          else return TRUE;
    1389          return FALSE;
    1390     }
    1391     else
    1392   #endif
    1393   /*==================== PrintMat  =================*/
    1394   #ifdef HAVE_PLURAL
    1395     if (strcmp(sys_cmd, "PrintMat") == 0)
    1396     {
    1397           int a;
    1398           int b;
    1399           ring r;
    1400           int metric;
    1401           if ((h!=NULL) && (h->Typ()==INT_CMD))
    1402           {
    1403             a=(int)((long)(h->Data()));
    1404             h=h->next;
    1405           }
    1406           else if ((h!=NULL) && (h->Typ()==INT_CMD))
    1407           {
    1408             b=(int)((long)(h->Data()));
    1409             h=h->next;
    1410           }
    1411           else if ((h!=NULL) && (h->Typ()==RING_CMD))
    1412           {
    1413             r=(ring)h->Data();
    1414             h=h->next;
    1415           }
    1416           else
    1417             return TRUE;
    1418           if ((h!=NULL) && (h->Typ()==INT_CMD))
    1419           {
    1420             metric=(int)((long)(h->Data()));
    1421           }
    1422           res->rtyp=MATRIX_CMD;
    1423           if (rIsPluralRing(r)) res->data=nc_PrintMat(a,b,r,metric);
    1424           else res->data=NULL;
    1425           return FALSE;
    1426     }
    1427     else
    1428   #endif
    14291206  /*==================== twostd  =================*/
    14301207  #ifdef HAVE_PLURAL
    14311208    if (strcmp(sys_cmd, "twostd") == 0)
    14321209    {
    1433           ideal I;
    1434           if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
    1435           {
    1436             I=(ideal)h->CopyD();
    1437             res->rtyp=IDEAL_CMD;
    1438             if (rIsPluralRing(currRing)) res->data=twostd(I);
    1439             else res->data=I;
    1440             setFlag(res,FLAG_TWOSTD);
    1441             setFlag(res,FLAG_STD);
    1442           }
    1443           else return TRUE;
    1444           return FALSE;
    1445     }
    1446     else
    1447   #endif 
     1210      ideal I;
     1211      if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
     1212      {
     1213        I=(ideal)h->CopyD();
     1214        res->rtyp=IDEAL_CMD;
     1215        if (rIsPluralRing(currRing)) res->data=twostd(I);
     1216        else res->data=I;
     1217        setFlag(res,FLAG_TWOSTD);
     1218        setFlag(res,FLAG_STD);
     1219      }
     1220      else return TRUE;
     1221      return FALSE;
     1222    }
     1223    else
     1224  #endif
    14481225  /*==================== lie bracket =================*/
    14491226  #ifdef HAVE_PLURAL
    14501227    if (strcmp(sys_cmd, "bracket") == 0)
    14511228    {
    1452         poly p;
    1453         poly q;
    1454         if ((h!=NULL) && (h->Typ()==POLY_CMD))
    1455         {
    1456           p=(poly)h->CopyD();
    1457           h=h->next;
    1458         }
    1459         else return TRUE;
    1460         if ((h!=NULL) && (h->Typ()==POLY_CMD))
    1461         {
    1462           q=(poly)h->Data();
    1463         }
    1464         else return TRUE;
    1465         res->rtyp=POLY_CMD;
    1466         if (rIsPluralRing(currRing))  res->data=nc_p_Bracket_qq(p,q, currRing);
    1467         else res->data=NULL;
     1229      poly p;
     1230      poly q;
     1231      if ((h!=NULL) && (h->Typ()==POLY_CMD))
     1232      {
     1233        p=(poly)h->CopyD();
     1234        h=h->next;
     1235      }
     1236      else return TRUE;
     1237      if ((h!=NULL) && (h->Typ()==POLY_CMD))
     1238      {
     1239        q=(poly)h->Data();
     1240      }
     1241      else return TRUE;
     1242      res->rtyp=POLY_CMD;
     1243      if (rIsPluralRing(currRing))  res->data=nc_p_Bracket_qq(p,q, currRing);
     1244      else res->data=NULL;
     1245      return FALSE;
     1246    }
     1247    else
     1248  #endif
     1249  /*==================== env ==================================*/
     1250  #ifdef HAVE_PLURAL
     1251    if (strcmp(sys_cmd, "env")==0)
     1252    {
     1253      if ((h!=NULL) && (h->Typ()==RING_CMD))
     1254      {
     1255        ring r = (ring)h->Data();
     1256        res->data = rEnvelope(r);
     1257        res->rtyp = RING_CMD;
    14681258        return FALSE;
    1469     }
    1470     else
    1471   #endif
    1472 /* ============ NCUseExtensions ======================== */
    1473   #ifdef HAVE_PLURAL
    1474     if(strcmp(sys_cmd,"NCUseExtensions")==0)
    1475     {
    1476         if ((h!=NULL) && (h->Typ()==INT_CMD))
    1477           res->data=(void *)(long)setNCExtensions( (int)((long)(h->Data())) );
    1478         else
    1479           res->data=(void *)(long)getNCExtensions();
    1480         res->rtyp=INT_CMD;
    1481         return FALSE;
    1482     }
    1483     else
    1484   #endif
    1485 /* ============ NCGetType ======================== */
    1486   #ifdef HAVE_PLURAL
    1487     if(strcmp(sys_cmd,"NCGetType")==0)
    1488     {
    1489         res->rtyp=INT_CMD;
    1490         if( rIsPluralRing(currRing) )
    1491           res->data=(void *)(long)ncRingType(currRing);
    1492         else
    1493           res->data=(void *)(-1L);
    1494         return FALSE;
    1495     }
    1496     else
    1497   #endif
    1498 /* ============ ForceSCA ======================== */
    1499   #ifdef HAVE_PLURAL
    1500     if(strcmp(sys_cmd,"ForceSCA")==0)
    1501     {
    1502         if( !rIsPluralRing(currRing) )
    1503           return TRUE;
    1504         int b, e;
    1505         if ((h!=NULL) && (h->Typ()==INT_CMD))
    1506         {
    1507           b = (int)((long)(h->Data()));
    1508           h=h->next;
    1509         }
    1510         else return TRUE;
    1511         if ((h!=NULL) && (h->Typ()==INT_CMD))
    1512         {
    1513           e = (int)((long)(h->Data()));
    1514         }
    1515         else return TRUE;
    1516         if( !sca_Force(currRing, b, e) )
    1517           return TRUE;
    1518         return FALSE;
    1519     }
    1520     else
    1521   #endif
    1522 /* ============ ForceNewNCMultiplication ======================== */
    1523   #ifdef HAVE_PLURAL
    1524     if(strcmp(sys_cmd,"ForceNewNCMultiplication")==0)
    1525     {
    1526         if( !rIsPluralRing(currRing) )
    1527           return TRUE;
    1528         if( !ncInitSpecialPairMultiplication(currRing) ) // No Plural!
    1529           return TRUE;
    1530 
    1531         return FALSE;
    1532     }
    1533     else
    1534   #endif
    1535 /* ============ ForceNewOldNCMultiplication ======================== */
    1536   #ifdef HAVE_PLURAL
    1537     if(strcmp(sys_cmd,"ForceNewOldNCMultiplication")==0)
    1538     {
    1539         if( !rIsPluralRing(currRing) )
    1540           return TRUE;
    1541         if( !ncInitSpecialPowersMultiplication(currRing) ) // Enable Formula for Plural (depends on swiches)!
    1542           return TRUE;
    1543         return FALSE;
     1259      }
     1260      else
     1261      {
     1262        WerrorS("`system(\"env\",<ring>)` expected");
     1263        return TRUE;
     1264      }
    15441265    }
    15451266    else
     
    15641285    else
    15651286  #endif
    1566   /*==================== env ==================================*/
    1567   #ifdef HAVE_PLURAL
    1568     if (strcmp(sys_cmd, "env")==0)
    1569     {
    1570         if ((h!=NULL) && (h->Typ()==RING_CMD))
    1571         {
    1572           ring r = (ring)h->Data();
    1573           res->data = rEnvelope(r);
    1574           res->rtyp = RING_CMD;
    1575           return FALSE;
    1576         }
    1577         else
    1578         {
    1579           WerrorS("`system(\"env\",<ring>)` expected");
    1580           return TRUE;
    1581         }
    1582     }
    1583     else
    1584   #endif 
    15851287  /*==================== oppose ==================================*/
    15861288  #ifdef HAVE_PLURAL
     
    16141316    if (strcmp(sys_cmd, "freegb") == 0)
    16151317    {
    1616         ideal I;
    1617         int uptodeg, lVblock;
    1618         if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
    1619         {
    1620           I=(ideal)h->CopyD();
    1621           h=h->next;
    1622         }
    1623         else return TRUE;
    1624         if ((h!=NULL) && (h->Typ()==INT_CMD))
    1625         {
    1626           uptodeg=(int)((long)(h->Data()));
    1627           h=h->next;
    1628         }
    1629         else return TRUE;
    1630         if ((h!=NULL) && (h->Typ()==INT_CMD))
    1631         {
    1632           lVblock=(int)((long)(h->Data()));
    1633           res->data = freegb(I,uptodeg,lVblock);
    1634           if (res->data == NULL)
    1635           {
    1636             /* that is there were input errors */
    1637             res->data = I;
    1638           }
    1639           res->rtyp = IDEAL_CMD;
    1640         }
    1641         else return TRUE;
    1642         return FALSE;
     1318      ideal I;
     1319      int uptodeg, lVblock;
     1320      if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
     1321      {
     1322        I=(ideal)h->CopyD();
     1323        h=h->next;
     1324      }
     1325      else return TRUE;
     1326      if ((h!=NULL) && (h->Typ()==INT_CMD))
     1327      {
     1328        uptodeg=(int)((long)(h->Data()));
     1329        h=h->next;
     1330      }
     1331      else return TRUE;
     1332      if ((h!=NULL) && (h->Typ()==INT_CMD))
     1333      {
     1334        lVblock=(int)((long)(h->Data()));
     1335        res->data = freegb(I,uptodeg,lVblock);
     1336        if (res->data == NULL)
     1337        {
     1338          /* that is there were input errors */
     1339          res->data = I;
     1340        }
     1341        res->rtyp = IDEAL_CMD;
     1342      }
     1343      else return TRUE;
     1344      return FALSE;
    16431345    }
    16441346    else
     
    16511353    if (strcmp(sys_cmd, "walkNextWeight") == 0)
    16521354    {
    1653         if (h == NULL || h->Typ() != INTVEC_CMD ||
    1654             h->next == NULL || h->next->Typ() != INTVEC_CMD ||
    1655             h->next->next == NULL || h->next->next->Typ() != IDEAL_CMD)
    1656         {
    1657           WerrorS("system(\"walkNextWeight\", intvec, intvec, ideal) expected");
    1658           return TRUE;
    1659         }
    1660 
    1661         if (((intvec*) h->Data())->length() != currRing->N ||
    1662             ((intvec*) h->next->Data())->length() != currRing->N)
    1663         {
    1664           Werror("system(\"walkNextWeight\" ...) intvecs not of length %d\n",
    1665                  currRing->N);
    1666           return TRUE;
    1667         }
    1668         res->data = (void*) walkNextWeight(((intvec*) h->Data()),
    1669                                            ((intvec*) h->next->Data()),
    1670                                            (ideal) h->next->next->Data());
    1671         if (res->data == NULL || res->data == (void*) 1L)
    1672         {
    1673           res->rtyp = INT_CMD;
    1674         }
    1675         else
    1676         {
    1677           res->rtyp = INTVEC_CMD;
    1678         }
    1679         return FALSE;
    1680     }
    1681     else
     1355      if (h == NULL || h->Typ() != INTVEC_CMD ||
     1356        h->next == NULL || h->next->Typ() != INTVEC_CMD ||
     1357        h->next->next == NULL || h->next->next->Typ() != IDEAL_CMD)
     1358      {
     1359        WerrorS("system(\"walkNextWeight\", intvec, intvec, ideal) expected");
     1360        return TRUE;
     1361      }
     1362      if (((intvec*) h->Data())->length() != currRing->N ||
     1363          ((intvec*) h->next->Data())->length() != currRing->N)
     1364      {
     1365        Werror("system(\"walkNextWeight\" ...) intvecs not of length %d\n",
     1366               currRing->N);
     1367        return TRUE;
     1368      }
     1369      res->data = (void*) walkNextWeight(((intvec*) h->Data()),
     1370                                         ((intvec*) h->next->Data()),
     1371                                         (ideal) h->next->next->Data());
     1372      if (res->data == NULL || res->data == (void*) 1L)
     1373      {
     1374        res->rtyp = INT_CMD;
     1375      }
     1376      else
     1377      {
     1378        res->rtyp = INTVEC_CMD;
     1379      }
     1380      return FALSE;
     1381    }
     1382    else
     1383  #endif
     1384  #endif
    16821385  /*==================== walkNextWeight =================*/
     1386  #ifdef HAVE_WALK
     1387  #ifdef OWNW
    16831388    if (strcmp(sys_cmd, "walkInitials") == 0)
    16841389    {
    1685         if (h == NULL || h->Typ() != IDEAL_CMD)
    1686         {
    1687           WerrorS("system(\"walkInitials\", ideal) expected");
    1688           return TRUE;
    1689         }
    1690 
    1691         res->data = (void*) walkInitials((ideal) h->Data());
    1692         res->rtyp = IDEAL_CMD;
    1693         return FALSE;
    1694     }
    1695     else
     1390      if (h == NULL || h->Typ() != IDEAL_CMD)
     1391      {
     1392        WerrorS("system(\"walkInitials\", ideal) expected");
     1393        return TRUE;
     1394      }
     1395      res->data = (void*) walkInitials((ideal) h->Data());
     1396      res->rtyp = IDEAL_CMD;
     1397      return FALSE;
     1398    }
     1399    else
     1400  #endif
    16961401  #endif
    16971402  /*==================== walkAddIntVec =================*/
     1403  #ifdef HAVE_WALK
    16981404  #ifdef WAIV
    16991405    if (strcmp(sys_cmd, "walkAddIntVec") == 0)
    17001406    {
    1701         if (h == NULL || h->Typ() != INTVEC_CMD ||
    1702             h->next == NULL || h->next->Typ() != INTVEC_CMD)
    1703         {
    1704           WerrorS("system(\"walkAddIntVec\", intvec, intvec) expected");
    1705           return TRUE;
    1706         }
    1707         intvec* arg1 = (intvec*) h->Data();
    1708         intvec* arg2 = (intvec*) h->next->Data();
    1709 
    1710 
    1711         res->data = (intvec*) walkAddIntVec(arg1, arg2);
    1712         res->rtyp = INTVEC_CMD;
    1713         return FALSE;
    1714     }
    1715     else
     1407      if (h == NULL || h->Typ() != INTVEC_CMD ||
     1408        h->next == NULL || h->next->Typ() != INTVEC_CMD)
     1409      {
     1410        WerrorS("system(\"walkAddIntVec\", intvec, intvec) expected");
     1411        return TRUE;
     1412      }
     1413      intvec* arg1 = (intvec*) h->Data();
     1414      intvec* arg2 = (intvec*) h->next->Data();
     1415      res->data = (intvec*) walkAddIntVec(arg1, arg2);
     1416      res->rtyp = INTVEC_CMD;
     1417      return FALSE;
     1418    }
     1419    else
     1420  #endif
    17161421  #endif
    17171422  /*==================== MwalkNextWeight =================*/
     1423  #ifdef HAVE_WALK
    17181424  #ifdef MwaklNextWeight
    17191425    if (strcmp(sys_cmd, "MwalkNextWeight") == 0)
    17201426    {
    1721         if (h == NULL || h->Typ() != INTVEC_CMD ||
    1722             h->next == NULL || h->next->Typ() != INTVEC_CMD ||
    1723             h->next->next == NULL || h->next->next->Typ() != IDEAL_CMD)
    1724         {
    1725           WerrorS("system(\"MwalkNextWeight\", intvec, intvec, ideal) expected");
    1726           return TRUE;
    1727         }
    1728 
    1729         if (((intvec*) h->Data())->length() != currRing->N ||
    1730             ((intvec*) h->next->Data())->length() != currRing->N)
    1731         {
    1732           Werror("system(\"MwalkNextWeight\" ...) intvecs not of length %d\n",
    1733                  currRing->N);
    1734           return TRUE;
    1735         }
    1736         intvec* arg1 = (intvec*) h->Data();
    1737         intvec* arg2 = (intvec*) h->next->Data();
    1738         ideal arg3   =   (ideal) h->next->next->Data();
    1739 
    1740         intvec* result = (intvec*) MwalkNextWeight(arg1, arg2, arg3);
    1741 
    1742         res->rtyp = INTVEC_CMD;
    1743         res->data =  result;
    1744 
    1745         return FALSE;
     1427      if (h == NULL || h->Typ() != INTVEC_CMD ||
     1428        h->next == NULL || h->next->Typ() != INTVEC_CMD ||
     1429        h->next->next == NULL || h->next->next->Typ() != IDEAL_CMD)
     1430      {
     1431        WerrorS("system(\"MwalkNextWeight\", intvec, intvec, ideal) expected");
     1432        return TRUE;
     1433      }
     1434      if (((intvec*) h->Data())->length() != currRing->N ||
     1435        ((intvec*) h->next->Data())->length() != currRing->N)
     1436      {
     1437        Werror("system(\"MwalkNextWeight\" ...) intvecs not of length %d\n",
     1438               currRing->N);
     1439        return TRUE;
     1440      }
     1441      intvec* arg1 = (intvec*) h->Data();
     1442      intvec* arg2 = (intvec*) h->next->Data();
     1443      ideal arg3   =   (ideal) h->next->next->Data();
     1444      intvec* result = (intvec*) MwalkNextWeight(arg1, arg2, arg3);
     1445      res->rtyp = INTVEC_CMD;
     1446      res->data =  result;
     1447      return FALSE;
    17461448    }
    17471449    else
    17481450  #endif //MWalkNextWeight
     1451  #endif
    17491452  /*==================== Mivdp =================*/
     1453  #ifdef HAVE_WALK
    17501454    if(strcmp(sys_cmd, "Mivdp") == 0)
    17511455    {
    1752         if (h == NULL || h->Typ() != INT_CMD)
    1753         {
    1754           WerrorS("system(\"Mivdp\", int) expected");
    1755           return TRUE;
    1756         }
    1757         if ((int) ((long)(h->Data())) != currRing->N)
    1758         {
    1759           Werror("system(\"Mivdp\" ...) intvecs not of length %d\n",
    1760                  currRing->N);
    1761           return TRUE;
    1762         }
    1763         int arg1 = (int) ((long)(h->Data()));
    1764 
    1765         intvec* result = (intvec*) Mivdp(arg1);
    1766 
    1767         res->rtyp = INTVEC_CMD;
    1768         res->data =  result;
    1769 
    1770         return FALSE;
    1771     }
    1772     else
     1456      if (h == NULL || h->Typ() != INT_CMD)
     1457      {
     1458        WerrorS("system(\"Mivdp\", int) expected");
     1459        return TRUE;
     1460      }
     1461      if ((int) ((long)(h->Data())) != currRing->N)
     1462      {
     1463        Werror("system(\"Mivdp\" ...) intvecs not of length %d\n",
     1464               currRing->N);
     1465        return TRUE;
     1466      }
     1467      int arg1 = (int) ((long)(h->Data()));
     1468      intvec* result = (intvec*) Mivdp(arg1);
     1469      res->rtyp = INTVEC_CMD;
     1470      res->data =  result;
     1471      return FALSE;
     1472    }
     1473    else
     1474  #endif
    17731475  /*==================== Mivlp =================*/
     1476  #ifdef HAVE_WALK
    17741477    if(strcmp(sys_cmd, "Mivlp") == 0)
    17751478    {
    1776         if (h == NULL || h->Typ() != INT_CMD)
    1777         {
    1778           WerrorS("system(\"Mivlp\", int) expected");
    1779           return TRUE;
    1780         }
    1781         if ((int) ((long)(h->Data())) != currRing->N)
    1782         {
    1783           Werror("system(\"Mivlp\" ...) intvecs not of length %d\n",
    1784                  currRing->N);
    1785           return TRUE;
    1786         }
    1787         int arg1 = (int) ((long)(h->Data()));
    1788 
    1789         intvec* result = (intvec*) Mivlp(arg1);
    1790 
    1791         res->rtyp = INTVEC_CMD;
    1792         res->data =  result;
    1793 
    1794         return FALSE;
    1795     }
    1796     else
     1479      if (h == NULL || h->Typ() != INT_CMD)
     1480      {
     1481        WerrorS("system(\"Mivlp\", int) expected");
     1482        return TRUE;
     1483      }
     1484      if ((int) ((long)(h->Data())) != currRing->N)
     1485      {
     1486        Werror("system(\"Mivlp\" ...) intvecs not of length %d\n",
     1487               currRing->N);
     1488        return TRUE;
     1489      }
     1490      int arg1 = (int) ((long)(h->Data()));
     1491      intvec* result = (intvec*) Mivlp(arg1);
     1492      res->rtyp = INTVEC_CMD;
     1493      res->data =  result;
     1494      return FALSE;
     1495    }
     1496    else
     1497  #endif
    17971498  /*==================== MpDiv =================*/
     1499  #ifdef HAVE_WALK
    17981500  #ifdef MpDiv
    17991501    if(strcmp(sys_cmd, "MpDiv") == 0)
    18001502    {
    1801           if(h==NULL || h->Typ() != POLY_CMD ||
    1802              h->next == NULL || h->next->Typ() != POLY_CMD)
    1803           {
    1804             WerrorS("system(\"MpDiv\",poly, poly) expected");
    1805             return TRUE;
    1806           }
    1807           poly arg1 = (poly) h->Data();
    1808           poly arg2 = (poly) h->next->Data();
    1809 
    1810           poly result = MpDiv(arg1, arg2);
    1811 
    1812           res->rtyp = POLY_CMD;
    1813           res->data = result;
    1814           return FALSE;
    1815     }
    1816     else
     1503      if(h==NULL || h->Typ() != POLY_CMD ||
     1504        h->next == NULL || h->next->Typ() != POLY_CMD)
     1505      {
     1506        WerrorS("system(\"MpDiv\",poly, poly) expected");
     1507        return TRUE;
     1508      }
     1509      poly arg1 = (poly) h->Data();
     1510      poly arg2 = (poly) h->next->Data();
     1511      poly result = MpDiv(arg1, arg2);
     1512      res->rtyp = POLY_CMD;
     1513      res->data = result;
     1514      return FALSE;
     1515    }
     1516    else
     1517  #endif
    18171518  #endif
    18181519  /*==================== MpMult =================*/
     1520  #ifdef HAVE_WALK
    18191521  #ifdef MpMult
    18201522    if(strcmp(sys_cmd, "MpMult") == 0)
    18211523    {
    1822           if(h==NULL || h->Typ() != POLY_CMD ||
    1823              h->next == NULL || h->next->Typ() != POLY_CMD)
    1824           {
    1825             WerrorS("system(\"MpMult\",poly, poly) expected");
    1826             return TRUE;
    1827           }
    1828           poly arg1 = (poly) h->Data();
    1829           poly arg2 = (poly) h->next->Data();
    1830 
    1831           poly result = MpMult(arg1, arg2);
    1832           res->rtyp = POLY_CMD;
    1833           res->data = result;
    1834           return FALSE;
    1835     }
    1836     else
     1524      if(h==NULL || h->Typ() != POLY_CMD ||
     1525        h->next == NULL || h->next->Typ() != POLY_CMD)
     1526      {
     1527        WerrorS("system(\"MpMult\",poly, poly) expected");
     1528        return TRUE;
     1529      }
     1530      poly arg1 = (poly) h->Data();
     1531      poly arg2 = (poly) h->next->Data();
     1532      poly result = MpMult(arg1, arg2);
     1533      res->rtyp = POLY_CMD;
     1534      res->data = result;
     1535      return FALSE;
     1536    }
     1537    else
     1538  #endif
    18371539  #endif
    18381540  /*==================== MivSame =================*/
     1541  #ifdef HAVE_WALK
    18391542    if (strcmp(sys_cmd, "MivSame") == 0)
    18401543    {
    1841         if(h == NULL || h->Typ() != INTVEC_CMD ||
    1842            h->next == NULL || h->next->Typ() != INTVEC_CMD )
    1843         {
    1844           WerrorS("system(\"MivSame\", intvec, intvec) expected");
    1845           return TRUE;
    1846         }
    1847         /*
    1848         if (((intvec*) h->Data())->length() != currRing->N ||
    1849             ((intvec*) h->next->Data())->length() != currRing->N)
    1850         {
    1851           Werror("system(\"MivSame\" ...) intvecs not of length %d\n",
    1852                  currRing->N);
    1853           return TRUE;
    1854         }
    1855         */
    1856         intvec* arg1 = (intvec*) h->Data();
    1857         intvec* arg2 = (intvec*) h->next->Data();
    1858         /*
    1859         poly result = (poly) MivSame(arg1, arg2);
    1860 
    1861         res->rtyp = POLY_CMD;
    1862         res->data =  (poly) result;
    1863         */
    1864         res->rtyp = INT_CMD;
    1865         res->data = (void*)(long) MivSame(arg1, arg2);
    1866         return FALSE;
    1867     }
    1868     else
     1544      if(h == NULL || h->Typ() != INTVEC_CMD ||
     1545        h->next == NULL || h->next->Typ() != INTVEC_CMD )
     1546      {
     1547        WerrorS("system(\"MivSame\", intvec, intvec) expected");
     1548        return TRUE;
     1549      }
     1550      /*
     1551      if (((intvec*) h->Data())->length() != currRing->N ||
     1552      ((intvec*) h->next->Data())->length() != currRing->N)
     1553      {
     1554        Werror("system(\"MivSame\" ...) intvecs not of length %d\n",
     1555               currRing->N);
     1556        return TRUE;
     1557      }
     1558      */
     1559      intvec* arg1 = (intvec*) h->Data();
     1560      intvec* arg2 = (intvec*) h->next->Data();
     1561      /*
     1562      poly result = (poly) MivSame(arg1, arg2);
     1563      res->rtyp = POLY_CMD;
     1564      res->data =  (poly) result;
     1565      */
     1566      res->rtyp = INT_CMD;
     1567      res->data = (void*)(long) MivSame(arg1, arg2);
     1568      return FALSE;
     1569    }
     1570    else
     1571  #endif
    18691572  /*==================== M3ivSame =================*/
     1573  #ifdef HAVE_WALK
    18701574    if (strcmp(sys_cmd, "M3ivSame") == 0)
    18711575    {
    1872         if(h == NULL || h->Typ() != INTVEC_CMD ||
    1873            h->next == NULL || h->next->Typ() != INTVEC_CMD ||
    1874            h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD  )
    1875         {
    1876           WerrorS("system(\"M3ivSame\", intvec, intvec, intvec) expected");
    1877           return TRUE;
    1878         }
    1879         /*
    1880         if (((intvec*) h->Data())->length() != currRing->N ||
    1881             ((intvec*) h->next->Data())->length() != currRing->N ||
    1882             ((intvec*) h->next->next->Data())->length() != currRing->N )
    1883         {
    1884           Werror("system(\"M3ivSame\" ...) intvecs not of length %d\n",
    1885                  currRing->N);
    1886           return TRUE;
    1887         }
    1888         */
    1889         intvec* arg1 = (intvec*) h->Data();
    1890         intvec* arg2 = (intvec*) h->next->Data();
    1891         intvec* arg3 = (intvec*) h->next->next->Data();
    1892         /*
    1893         poly result = (poly) M3ivSame(arg1, arg2, arg3);
    1894 
    1895         res->rtyp = POLY_CMD;
    1896         res->data =  (poly) result;
    1897         */
    1898         res->rtyp = INT_CMD;
    1899         res->data = (void*)(long) M3ivSame(arg1, arg2, arg3);
    1900         return FALSE;
    1901     }
    1902     else
     1576      if(h == NULL || h->Typ() != INTVEC_CMD ||
     1577        h->next == NULL || h->next->Typ() != INTVEC_CMD ||
     1578        h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD  )
     1579      {
     1580        WerrorS("system(\"M3ivSame\", intvec, intvec, intvec) expected");
     1581        return TRUE;
     1582      }
     1583      /*
     1584      if (((intvec*) h->Data())->length() != currRing->N ||
     1585        ((intvec*) h->next->Data())->length() != currRing->N ||
     1586        ((intvec*) h->next->next->Data())->length() != currRing->N )
     1587      {
     1588        Werror("system(\"M3ivSame\" ...) intvecs not of length %d\n",
     1589              currRing->N);
     1590        return TRUE;
     1591      }
     1592      */
     1593      intvec* arg1 = (intvec*) h->Data();
     1594      intvec* arg2 = (intvec*) h->next->Data();
     1595      intvec* arg3 = (intvec*) h->next->next->Data();
     1596      /*
     1597      poly result = (poly) M3ivSame(arg1, arg2, arg3);
     1598      res->rtyp = POLY_CMD;
     1599      res->data =  (poly) result;
     1600      */
     1601      res->rtyp = INT_CMD;
     1602      res->data = (void*)(long) M3ivSame(arg1, arg2, arg3);
     1603      return FALSE;
     1604    }
     1605    else
     1606  #endif
    19031607  /*==================== MwalkInitialForm =================*/
     1608  #ifdef HAVE_WALK
    19041609    if(strcmp(sys_cmd, "MwalkInitialForm") == 0)
    19051610    {
    1906           if(h == NULL || h->Typ() != IDEAL_CMD ||
    1907              h->next == NULL || h->next->Typ() != INTVEC_CMD)
    1908           {
    1909             WerrorS("system(\"MwalkInitialForm\", ideal, intvec) expected");
    1910             return TRUE;
    1911           }
    1912           if(((intvec*) h->next->Data())->length() != currRing->N)
    1913           {
    1914             Werror("system \"MwalkInitialForm\"...) intvec not of length %d\n",
    1915                    currRing->N);
    1916             return TRUE;
    1917           }
    1918           ideal id      = (ideal) h->Data();
    1919           intvec* int_w = (intvec*) h->next->Data();
    1920           ideal result  = (ideal) MwalkInitialForm(id, int_w);
    1921 
    1922           res->rtyp = IDEAL_CMD;
    1923           res->data = result;
    1924           return FALSE;
    1925     }
    1926     else
     1611      if(h == NULL || h->Typ() != IDEAL_CMD ||
     1612        h->next == NULL || h->next->Typ() != INTVEC_CMD)
     1613      {
     1614        WerrorS("system(\"MwalkInitialForm\", ideal, intvec) expected");
     1615        return TRUE;
     1616      }
     1617      if(((intvec*) h->next->Data())->length() != currRing->N)
     1618      {
     1619        Werror("system \"MwalkInitialForm\"...) intvec not of length %d\n",
     1620               currRing->N);
     1621        return TRUE;
     1622      }
     1623      ideal id      = (ideal) h->Data();
     1624      intvec* int_w = (intvec*) h->next->Data();
     1625      ideal result  = (ideal) MwalkInitialForm(id, int_w);
     1626      res->rtyp = IDEAL_CMD;
     1627      res->data = result;
     1628      return FALSE;
     1629    }
     1630    else
     1631  #endif
    19271632  /*==================== MivMatrixOrder =================*/
     1633  #ifdef HAVE_WALK
    19281634    /************** Perturbation walk **********/
    19291635    if(strcmp(sys_cmd, "MivMatrixOrder") == 0)
    19301636    {
    1931           if(h==NULL || h->Typ() != INTVEC_CMD)
    1932           {
    1933             WerrorS("system(\"MivMatrixOrder\",intvec) expected");
    1934             return TRUE;
    1935           }
    1936           intvec* arg1 = (intvec*) h->Data();
    1937 
    1938           intvec* result = MivMatrixOrder(arg1);
    1939 
    1940           res->rtyp = INTVEC_CMD;
    1941           res->data =  result;
    1942           return FALSE;
    1943     }
    1944     else
     1637      if(h==NULL || h->Typ() != INTVEC_CMD)
     1638      {
     1639        WerrorS("system(\"MivMatrixOrder\",intvec) expected");
     1640        return TRUE;
     1641      }
     1642      intvec* arg1 = (intvec*) h->Data();
     1643      intvec* result = MivMatrixOrder(arg1);
     1644      res->rtyp = INTVEC_CMD;
     1645      res->data =  result;
     1646      return FALSE;
     1647    }
     1648    else
     1649  #endif
    19451650  /*==================== MivMatrixOrderdp =================*/
     1651  #ifdef HAVE_WALK
    19461652    if(strcmp(sys_cmd, "MivMatrixOrderdp") == 0)
    19471653    {
    1948           if(h==NULL || h->Typ() != INT_CMD)
    1949           {
    1950             WerrorS("system(\"MivMatrixOrderdp\",intvec) expected");
    1951             return TRUE;
    1952           }
    1953           int arg1 = (int) ((long)(h->Data()));
    1954 
    1955           intvec* result = (intvec*) MivMatrixOrderdp(arg1);
    1956 
    1957           res->rtyp = INTVEC_CMD;
    1958           res->data =  result;
    1959           return FALSE;
    1960         }
    1961     else
     1654      if(h==NULL || h->Typ() != INT_CMD)
     1655      {
     1656        WerrorS("system(\"MivMatrixOrderdp\",intvec) expected");
     1657        return TRUE;
     1658      }
     1659      int arg1 = (int) ((long)(h->Data()));
     1660      intvec* result = (intvec*) MivMatrixOrderdp(arg1);
     1661      res->rtyp = INTVEC_CMD;
     1662      res->data =  result;
     1663      return FALSE;
     1664    }
     1665    else
     1666  #endif
    19621667  /*==================== MPertVectors =================*/
     1668  #ifdef HAVE_WALK
    19631669    if(strcmp(sys_cmd, "MPertVectors") == 0)
    19641670    {
    1965           if(h==NULL || h->Typ() != IDEAL_CMD ||
    1966              h->next == NULL || h->next->Typ() != INTVEC_CMD ||
    1967              h->next->next == NULL || h->next->next->Typ() != INT_CMD)
    1968           {
    1969             WerrorS("system(\"MPertVectors\",ideal, intvec, int) expected");
    1970             return TRUE;
    1971           }
    1972 
    1973           ideal arg1 = (ideal) h->Data();
    1974           intvec* arg2 = (intvec*) h->next->Data();
    1975           int arg3 = (int) ((long)(h->next->next->Data()));
    1976 
    1977           intvec* result = (intvec*) MPertVectors(arg1, arg2, arg3);
    1978 
    1979           res->rtyp = INTVEC_CMD;
    1980           res->data =  result;
    1981           return FALSE;
    1982     }
    1983     else
     1671      if(h==NULL || h->Typ() != IDEAL_CMD ||
     1672        h->next == NULL || h->next->Typ() != INTVEC_CMD ||
     1673        h->next->next == NULL || h->next->next->Typ() != INT_CMD)
     1674      {
     1675        WerrorS("system(\"MPertVectors\",ideal, intvec, int) expected");
     1676        return TRUE;
     1677      }
     1678      ideal arg1 = (ideal) h->Data();
     1679      intvec* arg2 = (intvec*) h->next->Data();
     1680      int arg3 = (int) ((long)(h->next->next->Data()));
     1681      intvec* result = (intvec*) MPertVectors(arg1, arg2, arg3);
     1682      res->rtyp = INTVEC_CMD;
     1683      res->data =  result;
     1684      return FALSE;
     1685    }
     1686    else
     1687  #endif
    19841688  /*==================== MPertVectorslp =================*/
     1689  #ifdef HAVE_WALK
    19851690    if(strcmp(sys_cmd, "MPertVectorslp") == 0)
    19861691    {
    1987           if(h==NULL || h->Typ() != IDEAL_CMD ||
    1988              h->next == NULL || h->next->Typ() != INTVEC_CMD ||
    1989              h->next->next == NULL || h->next->next->Typ() != INT_CMD)
    1990           {
    1991             WerrorS("system(\"MPertVectorslp\",ideal, intvec, int) expected");
    1992             return TRUE;
    1993           }
    1994 
    1995           ideal arg1 = (ideal) h->Data();
    1996           intvec* arg2 = (intvec*) h->next->Data();
    1997           int arg3 = (int) ((long)(h->next->next->Data()));
    1998 
    1999           intvec* result = (intvec*) MPertVectorslp(arg1, arg2, arg3);
    2000 
    2001           res->rtyp = INTVEC_CMD;
    2002           res->data =  result;
    2003           return FALSE;
    2004     }
     1692      if(h==NULL || h->Typ() != IDEAL_CMD ||
     1693        h->next == NULL || h->next->Typ() != INTVEC_CMD ||
     1694        h->next->next == NULL || h->next->next->Typ() != INT_CMD)
     1695      {
     1696        WerrorS("system(\"MPertVectorslp\",ideal, intvec, int) expected");
     1697        return TRUE;
     1698      }
     1699      ideal arg1 = (ideal) h->Data();
     1700      intvec* arg2 = (intvec*) h->next->Data();
     1701      int arg3 = (int) ((long)(h->next->next->Data()));
     1702      intvec* result = (intvec*) MPertVectorslp(arg1, arg2, arg3);
     1703      res->rtyp = INTVEC_CMD;
     1704      res->data =  result;
     1705      return FALSE;
     1706    }
     1707    else
     1708  #endif
    20051709    /************** fractal walk **********/
    2006     else
     1710  #ifdef HAVE_WALK
    20071711    if(strcmp(sys_cmd, "Mfpertvector") == 0)
    20081712    {
    2009           if(h==NULL || h->Typ() != IDEAL_CMD ||
    2010             h->next==NULL || h->next->Typ() != INTVEC_CMD  )
    2011           {
    2012             WerrorS("system(\"Mfpertvector\", ideal,intvec) expected");
    2013             return TRUE;
    2014           }
    2015           ideal arg1 = (ideal) h->Data();
    2016           intvec* arg2 = (intvec*) h->next->Data();
    2017           intvec* result = Mfpertvector(arg1, arg2);
    2018 
    2019           res->rtyp = INTVEC_CMD;
    2020           res->data =  result;
    2021           return FALSE;
    2022     }
    2023     else
     1713      if(h==NULL || h->Typ() != IDEAL_CMD ||
     1714        h->next==NULL || h->next->Typ() != INTVEC_CMD  )
     1715      {
     1716        WerrorS("system(\"Mfpertvector\", ideal,intvec) expected");
     1717        return TRUE;
     1718      }
     1719      ideal arg1 = (ideal) h->Data();
     1720      intvec* arg2 = (intvec*) h->next->Data();
     1721      intvec* result = Mfpertvector(arg1, arg2);
     1722      res->rtyp = INTVEC_CMD;
     1723      res->data =  result;
     1724      return FALSE;
     1725    }
     1726    else
     1727  #endif
     1728  /*==================== MivUnit =================*/
     1729  #ifdef HAVE_WALK
    20241730    if(strcmp(sys_cmd, "MivUnit") == 0)
    20251731    {
    2026           int arg1 = (int) ((long)(h->Data()));
    2027 
    2028           intvec* result = (intvec*) MivUnit(arg1);
    2029 
    2030           res->rtyp = INTVEC_CMD;
    2031           res->data =  result;
    2032           return FALSE;
    2033     }
    2034     else
     1732      int arg1 = (int) ((long)(h->Data()));
     1733      intvec* result = (intvec*) MivUnit(arg1);
     1734      res->rtyp = INTVEC_CMD;
     1735      res->data =  result;
     1736      return FALSE;
     1737    }
     1738    else
     1739  #endif
     1740  /*==================== MivWeightOrderlp =================*/
     1741  #ifdef HAVE_WALK
    20351742    if(strcmp(sys_cmd, "MivWeightOrderlp") == 0)
    20361743    {
    2037           if(h==NULL || h->Typ() != INTVEC_CMD)
    2038           {
    2039             WerrorS("system(\"MivWeightOrderlp\",intvec) expected");
    2040             return TRUE;
    2041           }
    2042           intvec* arg1 = (intvec*) h->Data();
    2043           intvec* result = MivWeightOrderlp(arg1);
    2044 
    2045           res->rtyp = INTVEC_CMD;
    2046           res->data =  result;
    2047           return FALSE;
    2048     }
    2049     else
     1744      if(h==NULL || h->Typ() != INTVEC_CMD)
     1745      {
     1746        WerrorS("system(\"MivWeightOrderlp\",intvec) expected");
     1747        return TRUE;
     1748      }
     1749      intvec* arg1 = (intvec*) h->Data();
     1750      intvec* result = MivWeightOrderlp(arg1);
     1751      res->rtyp = INTVEC_CMD;
     1752      res->data =  result;
     1753      return FALSE;
     1754    }
     1755    else
     1756  #endif
     1757  /*==================== MivWeightOrderdp =================*/
     1758  #ifdef HAVE_WALK
    20501759    if(strcmp(sys_cmd, "MivWeightOrderdp") == 0)
    20511760    {
    2052           if(h==NULL || h->Typ() != INTVEC_CMD)
    2053           {
    2054             WerrorS("system(\"MivWeightOrderdp\",intvec) expected");
    2055             return TRUE;
    2056           }
    2057           intvec* arg1 = (intvec*) h->Data();
    2058           //int arg2 = (int) h->next->Data();
    2059 
    2060           intvec* result = MivWeightOrderdp(arg1);
    2061 
    2062           res->rtyp = INTVEC_CMD;
    2063           res->data =  result;
    2064           return FALSE;
    2065     }
    2066     else
     1761      if(h==NULL || h->Typ() != INTVEC_CMD)
     1762      {
     1763        WerrorS("system(\"MivWeightOrderdp\",intvec) expected");
     1764        return TRUE;
     1765      }
     1766      intvec* arg1 = (intvec*) h->Data();
     1767      //int arg2 = (int) h->next->Data();
     1768      intvec* result = MivWeightOrderdp(arg1);
     1769      res->rtyp = INTVEC_CMD;
     1770      res->data =  result;
     1771      return FALSE;
     1772    }
     1773    else
     1774  #endif
     1775  /*==================== MivMatrixOrderlp =================*/
     1776  #ifdef HAVE_WALK
    20671777    if(strcmp(sys_cmd, "MivMatrixOrderlp") == 0)
    20681778    {
    2069           if(h==NULL || h->Typ() != INT_CMD)
    2070           {
    2071             WerrorS("system(\"MivMatrixOrderlp\",int) expected");
    2072             return TRUE;
    2073           }
    2074           int arg1 = (int) ((long)(h->Data()));
    2075 
    2076           intvec* result = (intvec*) MivMatrixOrderlp(arg1);
    2077 
    2078           res->rtyp = INTVEC_CMD;
    2079           res->data =  result;
    2080           return FALSE;
    2081     }
    2082     else
     1779      if(h==NULL || h->Typ() != INT_CMD)
     1780      {
     1781        WerrorS("system(\"MivMatrixOrderlp\",int) expected");
     1782        return TRUE;
     1783      }
     1784      int arg1 = (int) ((long)(h->Data()));
     1785      intvec* result = (intvec*) MivMatrixOrderlp(arg1);
     1786      res->rtyp = INTVEC_CMD;
     1787      res->data =  result;
     1788      return FALSE;
     1789    }
     1790    else
     1791  #endif
     1792  /*==================== MkInterRedNextWeight =================*/
     1793  #ifdef HAVE_WALK
    20831794    if (strcmp(sys_cmd, "MkInterRedNextWeight") == 0)
    20841795    {
    2085         if (h == NULL || h->Typ() != INTVEC_CMD ||
    2086             h->next == NULL || h->next->Typ() != INTVEC_CMD ||
    2087             h->next->next == NULL || h->next->next->Typ() != IDEAL_CMD)
    2088         {
    2089           WerrorS("system(\"MkInterRedNextWeight\", intvec, intvec, ideal) expected");
    2090           return TRUE;
    2091         }
    2092 
    2093         if (((intvec*) h->Data())->length() != currRing->N ||
    2094             ((intvec*) h->next->Data())->length() != currRing->N)
    2095         {
    2096           Werror("system(\"MkInterRedNextWeight\" ...) intvecs not of length %d\n",
     1796      if (h == NULL || h->Typ() != INTVEC_CMD ||
     1797        h->next == NULL || h->next->Typ() != INTVEC_CMD ||
     1798        h->next->next == NULL || h->next->next->Typ() != IDEAL_CMD)
     1799      {
     1800        WerrorS("system(\"MkInterRedNextWeight\", intvec, intvec, ideal) expected");
     1801        return TRUE;
     1802      }
     1803      if (((intvec*) h->Data())->length() != currRing->N ||
     1804        ((intvec*) h->next->Data())->length() != currRing->N)
     1805      {
     1806        Werror("system(\"MkInterRedNextWeight\" ...) intvecs not of length %d\n",
    20971807                 currRing->N);
    2098           return TRUE;
    2099         }
    2100         intvec* arg1 = (intvec*) h->Data();
    2101         intvec* arg2 = (intvec*) h->next->Data();
    2102         ideal arg3   =   (ideal) h->next->next->Data();
    2103 
    2104         intvec* result = (intvec*) MkInterRedNextWeight(arg1, arg2, arg3);
    2105 
    2106         res->rtyp = INTVEC_CMD;
    2107         res->data =  result;
    2108 
    2109         return FALSE;
    2110     }
    2111     else
     1808        return TRUE;
     1809      }
     1810      intvec* arg1 = (intvec*) h->Data();
     1811      intvec* arg2 = (intvec*) h->next->Data();
     1812      ideal arg3   =   (ideal) h->next->next->Data();
     1813      intvec* result = (intvec*) MkInterRedNextWeight(arg1, arg2, arg3);
     1814      res->rtyp = INTVEC_CMD;
     1815      res->data =  result;
     1816      return FALSE;
     1817    }
     1818    else
     1819  #endif
     1820  /*==================== MPertNextWeight =================*/
     1821  #ifdef HAVE_WALK
    21121822  #ifdef MPertNextWeight
    21131823    if (strcmp(sys_cmd, "MPertNextWeight") == 0)
    21141824    {
    2115         if (h == NULL || h->Typ() != INTVEC_CMD ||
    2116             h->next == NULL || h->next->Typ() != IDEAL_CMD ||
    2117             h->next->next == NULL || h->next->next->Typ() != INT_CMD)
    2118         {
    2119           WerrorS("system(\"MPertNextWeight\", intvec, ideal, int) expected");
    2120           return TRUE;
    2121         }
    2122 
    2123         if (((intvec*) h->Data())->length() != currRing->N)
    2124         {
    2125           Werror("system(\"MPertNextWeight\" ...) intvecs not of length %d\n",
     1825      if (h == NULL || h->Typ() != INTVEC_CMD ||
     1826        h->next == NULL || h->next->Typ() != IDEAL_CMD ||
     1827        h->next->next == NULL || h->next->next->Typ() != INT_CMD)
     1828      {
     1829        WerrorS("system(\"MPertNextWeight\", intvec, ideal, int) expected");
     1830        return TRUE;
     1831      }
     1832      if (((intvec*) h->Data())->length() != currRing->N)
     1833      {
     1834        Werror("system(\"MPertNextWeight\" ...) intvecs not of length %d\n",
    21261835                 currRing->N);
    2127           return TRUE;
    2128         }
    2129         intvec* arg1 = (intvec*) h->Data();
    2130         ideal arg2 = (ideal) h->next->Data();
    2131         int arg3   =   (int) h->next->next->Data();
    2132 
    2133         intvec* result = (intvec*) MPertNextWeight(arg1, arg2, arg3);
    2134 
    2135         res->rtyp = INTVEC_CMD;
    2136         res->data =  result;
    2137 
    2138         return FALSE;
     1836        return TRUE;
     1837      }
     1838      intvec* arg1 = (intvec*) h->Data();
     1839      ideal arg2 = (ideal) h->next->Data();
     1840      int arg3   =   (int) h->next->next->Data();
     1841      intvec* result = (intvec*) MPertNextWeight(arg1, arg2, arg3);
     1842      res->rtyp = INTVEC_CMD;
     1843      res->data =  result;
     1844      return FALSE;
    21391845    }
    21401846    else
    21411847  #endif //MPertNextWeight
     1848  #endif
     1849  /*==================== Mivperttarget =================*/
     1850  #ifdef HAVE_WALK
    21421851  #ifdef Mivperttarget
    21431852    if (strcmp(sys_cmd, "Mivperttarget") == 0)
    21441853    {
    2145         if (h == NULL || h->Typ() != IDEAL_CMD ||
    2146             h->next == NULL || h->next->Typ() != INT_CMD )
    2147         {
    2148           WerrorS("system(\"Mivperttarget\", ideal, int) expected");
    2149           return TRUE;
    2150         }
    2151 
    2152         ideal arg1 = (ideal) h->Data();
    2153         int arg2 = (int) h->next->Data();
    2154 
    2155         intvec* result = (intvec*) Mivperttarget(arg1, arg2);
    2156 
    2157         res->rtyp = INTVEC_CMD;
    2158         res->data =  result;
    2159 
    2160         return FALSE;
     1854      if (h == NULL || h->Typ() != IDEAL_CMD ||
     1855        h->next == NULL || h->next->Typ() != INT_CMD )
     1856      {
     1857        WerrorS("system(\"Mivperttarget\", ideal, int) expected");
     1858        return TRUE;
     1859      }
     1860      ideal arg1 = (ideal) h->Data();
     1861      int arg2 = (int) h->next->Data();
     1862      intvec* result = (intvec*) Mivperttarget(arg1, arg2);
     1863      res->rtyp = INTVEC_CMD;
     1864      res->data =  result;
     1865      return FALSE;
    21611866    }
    21621867    else
    21631868  #endif //Mivperttarget
     1869  #endif
     1870  /*==================== Mwalk =================*/
     1871  #ifdef HAVE_WALK
    21641872    if (strcmp(sys_cmd, "Mwalk") == 0)
    21651873    {
    2166         if (h == NULL || h->Typ() != IDEAL_CMD ||
    2167             h->next == NULL || h->next->Typ() != INTVEC_CMD ||
    2168             h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD)
    2169         {
    2170           WerrorS("system(\"Mwalk\", ideal, intvec, intvec) expected");
    2171           return TRUE;
    2172         }
    2173 
    2174         if (((intvec*) h->next->Data())->length() != currRing->N &&
    2175             ((intvec*) h->next->next->Data())->length() != currRing->N )
    2176         {
    2177           Werror("system(\"Mwalk\" ...) intvecs not of length %d\n",
    2178                  currRing->N);
    2179           return TRUE;
    2180         }
    2181         ideal arg1 = (ideal) h->Data();
    2182         intvec* arg2 = (intvec*) h->next->Data();
    2183         intvec* arg3   =  (intvec*) h->next->next->Data();
    2184 
    2185 
    2186         ideal result = (ideal) Mwalk(arg1, arg2, arg3);
    2187 
    2188         res->rtyp = IDEAL_CMD;
    2189         res->data =  result;
    2190 
    2191         return FALSE;
    2192     }
    2193     else
     1874      if (h == NULL || h->Typ() != IDEAL_CMD ||
     1875        h->next == NULL || h->next->Typ() != INTVEC_CMD ||
     1876        h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD)
     1877      {
     1878        WerrorS("system(\"Mwalk\", ideal, intvec, intvec) expected");
     1879        return TRUE;
     1880      }
     1881      if (((intvec*) h->next->Data())->length() != currRing->N &&
     1882        ((intvec*) h->next->next->Data())->length() != currRing->N )
     1883      {
     1884        Werror("system(\"Mwalk\" ...) intvecs not of length %d\n",
     1885           currRing->N);
     1886        return TRUE;
     1887      }
     1888      ideal arg1 = (ideal) h->Data();
     1889      intvec* arg2 = (intvec*) h->next->Data();
     1890      intvec* arg3   =  (intvec*) h->next->next->Data();
     1891      ideal result = (ideal) Mwalk(arg1, arg2, arg3);
     1892      res->rtyp = IDEAL_CMD;
     1893      res->data =  result;
     1894      return FALSE;
     1895    }
     1896    else
     1897  #endif
     1898  /*==================== Mpwalk =================*/
     1899  #ifdef HAVE_WALK
    21941900  #ifdef MPWALK_ORIG
    21951901    if (strcmp(sys_cmd, "Mpwalk") == 0)
    21961902    {
    2197         if (h == NULL || h->Typ() != IDEAL_CMD ||
    2198             h->next == NULL || h->next->Typ() != INT_CMD ||
    2199             h->next->next == NULL || h->next->next->Typ() != INT_CMD ||
    2200             h->next->next->next == NULL ||
    2201               h->next->next->next->Typ() != INTVEC_CMD ||
    2202             h->next->next->next->next == NULL ||
    2203               h->next->next->next->next->Typ() != INTVEC_CMD)
    2204         {
    2205           WerrorS("system(\"Mpwalk\", ideal, int, int, intvec, intvec) expected");
    2206           return TRUE;
    2207         }
    2208 
    2209         if (((intvec*) h->next->next->next->Data())->length() != currRing->N &&
    2210             ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N)
    2211         {
    2212           Werror("system(\"Mpwalk\" ...) intvecs not of length %d\n",
     1903      if (h == NULL || h->Typ() != IDEAL_CMD ||
     1904        h->next == NULL || h->next->Typ() != INT_CMD ||
     1905        h->next->next == NULL || h->next->next->Typ() != INT_CMD ||
     1906        h->next->next->next == NULL ||
     1907        h->next->next->next->Typ() != INTVEC_CMD ||
     1908        h->next->next->next->next == NULL ||
     1909        h->next->next->next->next->Typ() != INTVEC_CMD)
     1910      {
     1911        WerrorS("system(\"Mpwalk\", ideal, int, int, intvec, intvec) expected");
     1912        return TRUE;
     1913      }
     1914      if (((intvec*) h->next->next->next->Data())->length() != currRing->N &&
     1915        ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N)
     1916      {
     1917        Werror("system(\"Mpwalk\" ...) intvecs not of length %d\n",
     1918               currRing->N);
     1919        return TRUE;
     1920      }
     1921      ideal arg1 = (ideal) h->Data();
     1922      int arg2 = (int) h->next->Data();
     1923      int arg3 = (int) h->next->next->Data();
     1924      intvec* arg4 = (intvec*) h->next->next->next->Data();
     1925      intvec* arg5   =  (intvec*) h->next->next->next->next->Data();
     1926      ideal result = (ideal) Mpwalk(arg1, arg2, arg3, arg4, arg5);
     1927      res->rtyp = IDEAL_CMD;
     1928      res->data =  result;
     1929      return FALSE;
     1930    }
     1931    else
     1932  #else
     1933    if (strcmp(sys_cmd, "Mpwalk") == 0)
     1934    {
     1935      if (h == NULL || h->Typ() != IDEAL_CMD ||
     1936        h->next == NULL || h->next->Typ() != INT_CMD ||
     1937        h->next->next == NULL || h->next->next->Typ() != INT_CMD ||
     1938        h->next->next->next == NULL ||
     1939        h->next->next->next->Typ() != INTVEC_CMD ||
     1940        h->next->next->next->next == NULL ||
     1941        h->next->next->next->next->Typ() != INTVEC_CMD||
     1942        h->next->next->next->next->next == NULL ||
     1943        h->next->next->next->next->next->Typ() != INT_CMD)
     1944      {
     1945        WerrorS("system(\"Mpwalk\", ideal, int, int, intvec, intvec, int) expected");
     1946        return TRUE;
     1947      }
     1948      if (((intvec*) h->next->next->next->Data())->length() != currRing->N &&
     1949        ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N)
     1950      {
     1951        Werror("system(\"Mpwalk\" ...) intvecs not of length %d\n",
    22131952                 currRing->N);
    2214           return TRUE;
    2215         }
    2216         ideal arg1 = (ideal) h->Data();
    2217         int arg2 = (int) h->next->Data();
    2218         int arg3 = (int) h->next->next->Data();
    2219         intvec* arg4 = (intvec*) h->next->next->next->Data();
    2220         intvec* arg5   =  (intvec*) h->next->next->next->next->Data();
    2221 
    2222 
    2223         ideal result = (ideal) Mpwalk(arg1, arg2, arg3, arg4, arg5);
    2224 
    2225         res->rtyp = IDEAL_CMD;
    2226         res->data =  result;
    2227 
    2228         return FALSE;
    2229     }
    2230     else
    2231   #endif
    2232     if (strcmp(sys_cmd, "Mpwalk") == 0)
    2233     {
    2234         if (h == NULL || h->Typ() != IDEAL_CMD ||
    2235             h->next == NULL || h->next->Typ() != INT_CMD ||
    2236             h->next->next == NULL || h->next->next->Typ() != INT_CMD ||
    2237             h->next->next->next == NULL ||
    2238               h->next->next->next->Typ() != INTVEC_CMD ||
    2239             h->next->next->next->next == NULL ||
    2240               h->next->next->next->next->Typ() != INTVEC_CMD||
    2241             h->next->next->next->next->next == NULL ||
    2242               h->next->next->next->next->next->Typ() != INT_CMD)
    2243         {
    2244           WerrorS("system(\"Mpwalk\", ideal, int, int, intvec, intvec, int) expected");
    2245           return TRUE;
    2246         }
    2247 
    2248         if (((intvec*) h->next->next->next->Data())->length() != currRing->N &&
    2249             ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N)
    2250         {
    2251           Werror("system(\"Mpwalk\" ...) intvecs not of length %d\n",
    2252                  currRing->N);
    2253           return TRUE;
    2254         }
    2255         ideal arg1 = (ideal) h->Data();
    2256         int arg2 = (int) ((long)(h->next->Data()));
    2257         int arg3 = (int) ((long)(h->next->next->Data()));
    2258         intvec* arg4 = (intvec*) h->next->next->next->Data();
    2259         intvec* arg5   =  (intvec*) h->next->next->next->next->Data();
    2260         int arg6   =  (int) ((long)(h->next->next->next->next->next->Data()));
    2261 
    2262 
    2263         ideal result = (ideal) Mpwalk(arg1, arg2, arg3, arg4, arg5, arg6);
    2264 
    2265         res->rtyp = IDEAL_CMD;
    2266         res->data =  result;
    2267 
    2268         return FALSE;
    2269     }
    2270     else
     1953        return TRUE;
     1954      }
     1955      ideal arg1 = (ideal) h->Data();
     1956      int arg2 = (int) ((long)(h->next->Data()));
     1957      int arg3 = (int) ((long)(h->next->next->Data()));
     1958      intvec* arg4 = (intvec*) h->next->next->next->Data();
     1959      intvec* arg5   =  (intvec*) h->next->next->next->next->Data();
     1960      int arg6   =  (int) ((long)(h->next->next->next->next->next->Data()));
     1961      ideal result = (ideal) Mpwalk(arg1, arg2, arg3, arg4, arg5, arg6);
     1962      res->rtyp = IDEAL_CMD;
     1963      res->data =  result;
     1964      return FALSE;
     1965    }
     1966    else
     1967    #endif
     1968  #endif
     1969  /*==================== Mrwalk =================*/
     1970  #ifdef HAVE_WALK
    22711971    if (strcmp(sys_cmd, "Mrwalk") == 0)
    22721972    { // Random Walk
    2273         if (h == NULL || h->Typ() != IDEAL_CMD ||
    2274             h->next == NULL || h->next->Typ() != INTVEC_CMD ||
    2275             h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD ||
    2276             h->next->next->next == NULL || h->next->next->next->Typ() != INT_CMD ||
    2277             h->next->next->next->next == NULL || h->next->next->next->next->Typ() != INT_CMD)
    2278         {
    2279           WerrorS("system(\"Mrwalk\", ideal, intvec, intvec, int, int) expected");
    2280           return TRUE;
    2281         }
    2282 
    2283         if (((intvec*) h->next->Data())->length() != currRing->N &&
    2284             ((intvec*) h->next->next->Data())->length() != currRing->N )
    2285         {
    2286           Werror("system(\"Mrwalk\" ...) intvecs not of length %d\n",
     1973      if (h == NULL || h->Typ() != IDEAL_CMD ||
     1974        h->next == NULL || h->next->Typ() != INTVEC_CMD ||
     1975        h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD ||
     1976        h->next->next->next == NULL || h->next->next->next->Typ() != INT_CMD ||
     1977        h->next->next->next->next == NULL || h->next->next->next->next->Typ() != INT_CMD)
     1978      {
     1979        WerrorS("system(\"Mrwalk\", ideal, intvec, intvec, int, int) expected");
     1980        return TRUE;
     1981      }
     1982      if (((intvec*) h->next->Data())->length() != currRing->N &&
     1983        ((intvec*) h->next->next->Data())->length() != currRing->N )
     1984      {
     1985        Werror("system(\"Mrwalk\" ...) intvecs not of length %d\n",
     1986               currRing->N);
     1987        return TRUE;
     1988      }
     1989      ideal arg1 = (ideal) h->Data();
     1990      intvec* arg2 = (intvec*) h->next->Data();
     1991      intvec* arg3 =  (intvec*) h->next->next->Data();
     1992      int arg4 = (int)(long) h->next->next->next->Data();
     1993      int arg5 = (int)(long) h->next->next->next->next->Data();
     1994      ideal result = (ideal) Mrwalk(arg1, arg2, arg3, arg4, arg5);
     1995      res->rtyp = IDEAL_CMD;
     1996      res->data =  result;
     1997      return FALSE;
     1998    }
     1999    else
     2000  #endif
     2001  /*==================== MAltwalk1 =================*/
     2002  #ifdef HAVE_WALK
     2003    if (strcmp(sys_cmd, "MAltwalk1") == 0)
     2004    {
     2005      if (h == NULL || h->Typ() != IDEAL_CMD ||
     2006        h->next == NULL || h->next->Typ() != INT_CMD ||
     2007        h->next->next == NULL || h->next->next->Typ() != INT_CMD ||
     2008        h->next->next->next == NULL ||
     2009        h->next->next->next->Typ() != INTVEC_CMD ||
     2010        h->next->next->next->next == NULL ||
     2011        h->next->next->next->next->Typ() != INTVEC_CMD)
     2012      {
     2013        WerrorS("system(\"MAltwalk1\", ideal, int, int, intvec, intvec) expected");
     2014        return TRUE;
     2015      }
     2016      if (((intvec*) h->next->next->next->Data())->length() != currRing->N &&
     2017        ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N)
     2018      {
     2019        Werror("system(\"MAltwalk1\" ...) intvecs not of length %d\n",
    22872020                 currRing->N);
    2288           return TRUE;
    2289         }
    2290         ideal arg1 = (ideal) h->Data();
    2291         intvec* arg2 = (intvec*) h->next->Data();
    2292         intvec* arg3 =  (intvec*) h->next->next->Data();
    2293         int arg4 = (int)(long) h->next->next->next->Data();
    2294         int arg5 = (int)(long) h->next->next->next->next->Data();
    2295 
    2296 
    2297         ideal result = (ideal) Mrwalk(arg1, arg2, arg3, arg4, arg5);
    2298 
    2299         res->rtyp = IDEAL_CMD;
    2300         res->data =  result;
    2301 
    2302         return FALSE;
    2303     }
    2304     else
    2305     if (strcmp(sys_cmd, "MAltwalk1") == 0)
    2306     {
    2307         if (h == NULL || h->Typ() != IDEAL_CMD ||
    2308             h->next == NULL || h->next->Typ() != INT_CMD ||
    2309             h->next->next == NULL || h->next->next->Typ() != INT_CMD ||
    2310             h->next->next->next == NULL ||
    2311               h->next->next->next->Typ() != INTVEC_CMD ||
    2312             h->next->next->next->next == NULL ||
    2313               h->next->next->next->next->Typ() != INTVEC_CMD)
    2314         {
    2315           WerrorS("system(\"MAltwalk1\", ideal, int, int, intvec, intvec) expected");
    2316           return TRUE;
    2317         }
    2318 
    2319         if (((intvec*) h->next->next->next->Data())->length() != currRing->N &&
    2320             ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N)
    2321         {
    2322           Werror("system(\"MAltwalk1\" ...) intvecs not of length %d\n",
     2021        return TRUE;
     2022      }
     2023      ideal arg1 = (ideal) h->Data();
     2024      int arg2 = (int) ((long)(h->next->Data()));
     2025      int arg3 = (int) ((long)(h->next->next->Data()));
     2026      intvec* arg4 = (intvec*) h->next->next->next->Data();
     2027      intvec* arg5   =  (intvec*) h->next->next->next->next->Data();
     2028      ideal result = (ideal) MAltwalk1(arg1, arg2, arg3, arg4, arg5);
     2029      res->rtyp = IDEAL_CMD;
     2030      res->data =  result;
     2031      return FALSE;
     2032    }
     2033    else
     2034  #endif
     2035  /*==================== MAltwalk1 =================*/
     2036  #ifdef HAVE_WALK
     2037  #ifdef MFWALK_ALT
     2038    if (strcmp(sys_cmd, "Mfwalk_alt") == 0)
     2039    {
     2040      if (h == NULL || h->Typ() != IDEAL_CMD ||
     2041        h->next == NULL || h->next->Typ() != INTVEC_CMD ||
     2042        h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD ||
     2043        h->next->next->next == NULL || h->next->next->next->Typ() !=INT_CMD)
     2044      {
     2045        WerrorS("system(\"Mfwalk\", ideal, intvec, intvec,int) expected");
     2046        return TRUE;
     2047      }
     2048      if (((intvec*) h->next->Data())->length() != currRing->N &&
     2049        ((intvec*) h->next->next->Data())->length() != currRing->N )
     2050      {
     2051        Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n",
     2052              currRing->N);
     2053        return TRUE;
     2054      }
     2055      ideal arg1 = (ideal) h->Data();
     2056      intvec* arg2 = (intvec*) h->next->Data();
     2057      intvec* arg3   =  (intvec*) h->next->next->Data();
     2058      int arg4 = (int) h->next->next->next->Data();
     2059      ideal result = (ideal) Mfwalk_alt(arg1, arg2, arg3, arg4);
     2060      res->rtyp = IDEAL_CMD;
     2061      res->data =  result;
     2062      return FALSE;
     2063    }
     2064    else
     2065  #endif
     2066  #endif
     2067  /*==================== Mfwalk =================*/
     2068  #ifdef HAVE_WALK
     2069    if (strcmp(sys_cmd, "Mfwalk") == 0)
     2070    {
     2071      if (h == NULL || h->Typ() != IDEAL_CMD ||
     2072        h->next == NULL || h->next->Typ() != INTVEC_CMD ||
     2073        h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD)
     2074      {
     2075        WerrorS("system(\"Mfwalk\", ideal, intvec, intvec) expected");
     2076        return TRUE;
     2077      }
     2078      if (((intvec*) h->next->Data())->length() != currRing->N &&
     2079        ((intvec*) h->next->next->Data())->length() != currRing->N )
     2080      {
     2081        Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n",
    23232082                 currRing->N);
    2324           return TRUE;
    2325         }
    2326         ideal arg1 = (ideal) h->Data();
    2327         int arg2 = (int) ((long)(h->next->Data()));
    2328         int arg3 = (int) ((long)(h->next->next->Data()));
    2329         intvec* arg4 = (intvec*) h->next->next->next->Data();
    2330         intvec* arg5   =  (intvec*) h->next->next->next->next->Data();
    2331 
    2332 
    2333         ideal result = (ideal) MAltwalk1(arg1, arg2, arg3, arg4, arg5);
    2334 
    2335         res->rtyp = IDEAL_CMD;
    2336         res->data =  result;
    2337 
    2338         return FALSE;
    2339     }
    2340   #ifdef MFWALK_ALT
    2341     else
    2342     if (strcmp(sys_cmd, "Mfwalk_alt") == 0)
    2343     {
    2344         if (h == NULL || h->Typ() != IDEAL_CMD ||
    2345             h->next == NULL || h->next->Typ() != INTVEC_CMD ||
    2346             h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD ||
    2347             h->next->next->next == NULL || h->next->next->next->Typ() !=INT_CMD)
    2348         {
    2349           WerrorS("system(\"Mfwalk\", ideal, intvec, intvec,int) expected");
    2350           return TRUE;
    2351         }
    2352 
    2353         if (((intvec*) h->next->Data())->length() != currRing->N &&
    2354             ((intvec*) h->next->next->Data())->length() != currRing->N )
    2355         {
    2356           Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n",
     2083        return TRUE;
     2084      }
     2085      ideal arg1 = (ideal) h->Data();
     2086      intvec* arg2 = (intvec*) h->next->Data();
     2087      intvec* arg3   =  (intvec*) h->next->next->Data();
     2088      ideal result = (ideal) Mfwalk(arg1, arg2, arg3);
     2089      res->rtyp = IDEAL_CMD;
     2090      res->data =  result;
     2091      return FALSE;
     2092    }
     2093    else
     2094  #endif
     2095  /*==================== Mfrwalk =================*/
     2096  #ifdef HAVE_WALK
     2097    if (strcmp(sys_cmd, "Mfrwalk") == 0)
     2098    {
     2099      if (h == NULL || h->Typ() != IDEAL_CMD ||
     2100        h->next == NULL || h->next->Typ() != INTVEC_CMD ||
     2101        h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD ||
     2102        h->next->next->next == NULL || h->next->next->next->Typ() != INT_CMD)
     2103      {
     2104        WerrorS("system(\"Mfrwalk\", ideal, intvec, intvec, int) expected");
     2105        return TRUE;
     2106      }
     2107      if (((intvec*) h->next->Data())->length() != currRing->N &&
     2108        ((intvec*) h->next->next->Data())->length() != currRing->N )
     2109      {
     2110        Werror("system(\"Mfrwalk\" ...) intvecs not of length %d\n",
    23572111                 currRing->N);
    2358           return TRUE;
    2359         }
    2360         ideal arg1 = (ideal) h->Data();
    2361         intvec* arg2 = (intvec*) h->next->Data();
    2362         intvec* arg3   =  (intvec*) h->next->next->Data();
    2363         int arg4 = (int) h->next->next->next->Data();
    2364 
    2365         ideal result = (ideal) Mfwalk_alt(arg1, arg2, arg3, arg4);
    2366 
    2367         res->rtyp = IDEAL_CMD;
    2368         res->data =  result;
    2369 
    2370         return FALSE;
    2371     }
    2372   #endif
    2373     else
    2374     if (strcmp(sys_cmd, "Mfwalk") == 0)
    2375     {
    2376         if (h == NULL || h->Typ() != IDEAL_CMD ||
    2377             h->next == NULL || h->next->Typ() != INTVEC_CMD ||
    2378             h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD)
    2379         {
    2380           WerrorS("system(\"Mfwalk\", ideal, intvec, intvec) expected");
    2381           return TRUE;
    2382         }
    2383 
    2384         if (((intvec*) h->next->Data())->length() != currRing->N &&
    2385             ((intvec*) h->next->next->Data())->length() != currRing->N )
    2386         {
    2387           Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n",
    2388                  currRing->N);
    2389           return TRUE;
    2390         }
    2391         ideal arg1 = (ideal) h->Data();
    2392         intvec* arg2 = (intvec*) h->next->Data();
    2393         intvec* arg3   =  (intvec*) h->next->next->Data();
    2394 
    2395         ideal result = (ideal) Mfwalk(arg1, arg2, arg3);
    2396 
    2397         res->rtyp = IDEAL_CMD;
    2398         res->data =  result;
    2399 
    2400         return FALSE;
    2401     }
    2402     else
    2403     if (strcmp(sys_cmd, "Mfrwalk") == 0)
    2404     {
    2405         if (h == NULL || h->Typ() != IDEAL_CMD ||
    2406             h->next == NULL || h->next->Typ() != INTVEC_CMD ||
    2407             h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD ||
    2408             h->next->next->next == NULL || h->next->next->next->Typ() != INT_CMD)
    2409         {
    2410           WerrorS("system(\"Mfrwalk\", ideal, intvec, intvec, int) expected");
    2411           return TRUE;
    2412         }
    2413 
    2414         if (((intvec*) h->next->Data())->length() != currRing->N &&
    2415             ((intvec*) h->next->next->Data())->length() != currRing->N )
    2416         {
    2417           Werror("system(\"Mfrwalk\" ...) intvecs not of length %d\n",
    2418                  currRing->N);
    2419           return TRUE;
    2420         }
    2421         ideal arg1 = (ideal) h->Data();
    2422         intvec* arg2 = (intvec*) h->next->Data();
    2423         intvec* arg3 = (intvec*) h->next->next->Data();
    2424         int arg4 = (int)(long) h->next->next->next->Data();
    2425 
    2426         ideal result = (ideal) Mfrwalk(arg1, arg2, arg3, arg4);
    2427 
    2428         res->rtyp = IDEAL_CMD;
    2429         res->data =  result;
    2430 
    2431         return FALSE;
    2432     }
    2433     else
    2434 
     2112        return TRUE;
     2113      }
     2114      ideal arg1 = (ideal) h->Data();
     2115      intvec* arg2 = (intvec*) h->next->Data();
     2116      intvec* arg3 = (intvec*) h->next->next->Data();
     2117      int arg4 = (int)(long) h->next->next->next->Data();
     2118      ideal result = (ideal) Mfrwalk(arg1, arg2, arg3, arg4);
     2119      res->rtyp = IDEAL_CMD;
     2120      res->data =  result;
     2121      return FALSE;
     2122    }
     2123    else
     2124  #endif
     2125  /*==================== TranMImprovwalk =================*/
     2126  #ifdef HAVE_WALK
    24352127  #ifdef TRAN_Orig
    24362128    if (strcmp(sys_cmd, "TranMImprovwalk") == 0)
    24372129    {
    2438         if (h == NULL || h->Typ() != IDEAL_CMD ||
    2439             h->next == NULL || h->next->Typ() != INTVEC_CMD ||
    2440             h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD)
    2441         {
    2442           WerrorS("system(\"TranMImprovwalk\", ideal, intvec, intvec) expected");
    2443           return TRUE;
    2444         }
    2445 
    2446         if (((intvec*) h->next->Data())->length() != currRing->N &&
    2447             ((intvec*) h->next->next->Data())->length() != currRing->N )
    2448         {
    2449           Werror("system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
     2130      if (h == NULL || h->Typ() != IDEAL_CMD ||
     2131        h->next == NULL || h->next->Typ() != INTVEC_CMD ||
     2132        h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD)
     2133      {
     2134        WerrorS("system(\"TranMImprovwalk\", ideal, intvec, intvec) expected");
     2135        return TRUE;
     2136      }
     2137      if (((intvec*) h->next->Data())->length() != currRing->N &&
     2138        ((intvec*) h->next->next->Data())->length() != currRing->N )
     2139      {
     2140        Werror("system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
     2141              currRing->N);
     2142        return TRUE;
     2143      }
     2144      ideal arg1 = (ideal) h->Data();
     2145      intvec* arg2 = (intvec*) h->next->Data();
     2146      intvec* arg3   =  (intvec*) h->next->next->Data();
     2147      ideal result = (ideal) TranMImprovwalk(arg1, arg2, arg3);
     2148      res->rtyp = IDEAL_CMD;
     2149      res->data =  result;
     2150      return FALSE;
     2151    }
     2152    else
     2153  #endif
     2154  #endif
     2155  /*==================== MAltwalk2 =================*/
     2156  #ifdef HAVE_WALK
     2157    if (strcmp(sys_cmd, "MAltwalk2") == 0)
     2158    {
     2159      if (h == NULL || h->Typ() != IDEAL_CMD ||
     2160        h->next == NULL || h->next->Typ() != INTVEC_CMD ||
     2161        h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD)
     2162      {
     2163        WerrorS("system(\"MAltwalk2\", ideal, intvec, intvec) expected");
     2164        return TRUE;
     2165      }
     2166      if (((intvec*) h->next->Data())->length() != currRing->N &&
     2167        ((intvec*) h->next->next->Data())->length() != currRing->N )
     2168      {
     2169        Werror("system(\"MAltwalk2\" ...) intvecs not of length %d\n",
    24502170                 currRing->N);
    2451           return TRUE;
    2452         }
    2453         ideal arg1 = (ideal) h->Data();
    2454         intvec* arg2 = (intvec*) h->next->Data();
    2455         intvec* arg3   =  (intvec*) h->next->next->Data();
    2456 
    2457 
    2458         ideal result = (ideal) TranMImprovwalk(arg1, arg2, arg3);
    2459 
    2460         res->rtyp = IDEAL_CMD;
    2461         res->data =  result;
    2462 
    2463         return FALSE;
    2464     }
    2465     else
    2466   #endif
    2467     if (strcmp(sys_cmd, "MAltwalk2") == 0)
    2468     {
    2469         if (h == NULL || h->Typ() != IDEAL_CMD ||
    2470             h->next == NULL || h->next->Typ() != INTVEC_CMD ||
    2471             h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD)
    2472         {
    2473           WerrorS("system(\"MAltwalk2\", ideal, intvec, intvec) expected");
    2474           return TRUE;
    2475         }
    2476 
    2477         if (((intvec*) h->next->Data())->length() != currRing->N &&
    2478             ((intvec*) h->next->next->Data())->length() != currRing->N )
    2479         {
    2480           Werror("system(\"MAltwalk2\" ...) intvecs not of length %d\n",
     2171        return TRUE;
     2172      }
     2173      ideal arg1 = (ideal) h->Data();
     2174      intvec* arg2 = (intvec*) h->next->Data();
     2175      intvec* arg3   =  (intvec*) h->next->next->Data();
     2176      ideal result = (ideal) MAltwalk2(arg1, arg2, arg3);
     2177      res->rtyp = IDEAL_CMD;
     2178      res->data =  result;
     2179      return FALSE;
     2180    }
     2181    else
     2182  #endif
     2183  /*==================== MAltwalk2 =================*/
     2184  #ifdef HAVE_WALK
     2185    if (strcmp(sys_cmd, "TranMImprovwalk") == 0)
     2186    {
     2187      if (h == NULL || h->Typ() != IDEAL_CMD ||
     2188        h->next == NULL || h->next->Typ() != INTVEC_CMD ||
     2189        h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD||
     2190        h->next->next->next == NULL || h->next->next->next->Typ() != INT_CMD)
     2191      {
     2192        WerrorS("system(\"TranMImprovwalk\", ideal, intvec, intvec, int) expected");
     2193        return TRUE;
     2194      }
     2195      if (((intvec*) h->next->Data())->length() != currRing->N &&
     2196        ((intvec*) h->next->next->Data())->length() != currRing->N )
     2197      {
     2198        Werror("system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
    24812199                 currRing->N);
    2482           return TRUE;
    2483         }
    2484         ideal arg1 = (ideal) h->Data();
    2485         intvec* arg2 = (intvec*) h->next->Data();
    2486         intvec* arg3   =  (intvec*) h->next->next->Data();
    2487 
    2488 
    2489         ideal result = (ideal) MAltwalk2(arg1, arg2, arg3);
    2490 
    2491         res->rtyp = IDEAL_CMD;
    2492         res->data =  result;
    2493 
    2494         return FALSE;
    2495     }
    2496     else
    2497     if (strcmp(sys_cmd, "TranMImprovwalk") == 0)
    2498     {
    2499         if (h == NULL || h->Typ() != IDEAL_CMD ||
    2500             h->next == NULL || h->next->Typ() != INTVEC_CMD ||
    2501             h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD||
    2502             h->next->next->next == NULL || h->next->next->next->Typ() != INT_CMD)
    2503         {
    2504           WerrorS("system(\"TranMImprovwalk\", ideal, intvec, intvec, int) expected");
    2505           return TRUE;
    2506         }
    2507 
    2508         if (((intvec*) h->next->Data())->length() != currRing->N &&
    2509             ((intvec*) h->next->next->Data())->length() != currRing->N )
    2510         {
    2511           Werror("system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
    2512                  currRing->N);
    2513           return TRUE;
    2514         }
    2515         ideal arg1 = (ideal) h->Data();
    2516         intvec* arg2 = (intvec*) h->next->Data();
    2517         intvec* arg3   =  (intvec*) h->next->next->Data();
    2518         int arg4   =  (int) ((long)(h->next->next->next->Data()));
    2519 
    2520         ideal result = (ideal) TranMImprovwalk(arg1, arg2, arg3, arg4);
    2521 
    2522         res->rtyp = IDEAL_CMD;
    2523         res->data =  result;
    2524 
    2525         return FALSE;
    2526     }
    2527     else
     2200        return TRUE;
     2201      }
     2202      ideal arg1 = (ideal) h->Data();
     2203      intvec* arg2 = (intvec*) h->next->Data();
     2204      intvec* arg3   =  (intvec*) h->next->next->Data();
     2205      int arg4   =  (int) ((long)(h->next->next->next->Data()));
     2206      ideal result = (ideal) TranMImprovwalk(arg1, arg2, arg3, arg4);
     2207      res->rtyp = IDEAL_CMD;
     2208      res->data =  result;
     2209      return FALSE;
     2210    }
     2211    else
     2212  #endif
     2213  /*==================== TranMrImprovwalk =================*/
     2214  #ifdef HAVE_WALK
    25282215    if (strcmp(sys_cmd, "TranMrImprovwalk") == 0)
    25292216    {
    2530         if (h == NULL || h->Typ() != IDEAL_CMD ||
    2531             h->next == NULL || h->next->Typ() != INTVEC_CMD ||
    2532             h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD ||
    2533             h->next->next->next == NULL || h->next->next->next->Typ() != INT_CMD ||
    2534             h->next->next->next == NULL || h->next->next->next->next->Typ() != INT_CMD ||
    2535             h->next->next->next == NULL || h->next->next->next->next->next->Typ() != INT_CMD)
    2536         {
    2537           WerrorS("system(\"TranMrImprovwalk\", ideal, intvec, intvec) expected");
    2538           return TRUE;
    2539         }
    2540 
    2541         if (((intvec*) h->next->Data())->length() != currRing->N &&
    2542             ((intvec*) h->next->next->Data())->length() != currRing->N )
    2543         {
    2544           Werror("system(\"TranMrImprovwalk\" ...) intvecs not of length %d\n", currRing->N);
    2545           return TRUE;
    2546         }
    2547         ideal arg1 = (ideal) h->Data();
    2548         intvec* arg2 = (intvec*) h->next->Data();
    2549         intvec* arg3 = (intvec*) h->next->next->Data();
    2550         int arg4 = (int)(long) h->next->next->next->Data();
    2551         int arg5 = (int)(long) h->next->next->next->next->Data();
    2552         int arg6 = (int)(long) h->next->next->next->next->next->Data();
    2553 
    2554         ideal result = (ideal) TranMrImprovwalk(arg1, arg2, arg3, arg4, arg5, arg6);
    2555 
    2556         res->rtyp = IDEAL_CMD;
    2557         res->data =  result;
    2558 
    2559         return FALSE;
     2217      if (h == NULL || h->Typ() != IDEAL_CMD ||
     2218        h->next == NULL || h->next->Typ() != INTVEC_CMD ||
     2219        h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD ||
     2220        h->next->next->next == NULL || h->next->next->next->Typ() != INT_CMD ||
     2221        h->next->next->next == NULL || h->next->next->next->next->Typ() != INT_CMD ||
     2222        h->next->next->next == NULL || h->next->next->next->next->next->Typ() != INT_CMD)
     2223      {
     2224        WerrorS("system(\"TranMrImprovwalk\", ideal, intvec, intvec) expected");
     2225        return TRUE;
     2226      }
     2227      if (((intvec*) h->next->Data())->length() != currRing->N &&
     2228        ((intvec*) h->next->next->Data())->length() != currRing->N )
     2229      {
     2230        Werror("system(\"TranMrImprovwalk\" ...) intvecs not of length %d\n", currRing->N);
     2231        return TRUE;
     2232      }
     2233      ideal arg1 = (ideal) h->Data();
     2234      intvec* arg2 = (intvec*) h->next->Data();
     2235      intvec* arg3 = (intvec*) h->next->next->Data();
     2236      int arg4 = (int)(long) h->next->next->next->Data();
     2237      int arg5 = (int)(long) h->next->next->next->next->Data();
     2238      int arg6 = (int)(long) h->next->next->next->next->next->Data();
     2239      ideal result = (ideal) TranMrImprovwalk(arg1, arg2, arg3, arg4, arg5, arg6);
     2240      res->rtyp = IDEAL_CMD;
     2241      res->data =  result;
     2242      return FALSE;
    25602243    }
    25612244    else
     
    38473530  }
    38483531  else
     3532  /*==================== mpz_t loader ======================*/
     3533    if(strcmp(sys_cmd, "GNUmpLoad")==0)
     3534    {
     3535      if ((h != NULL) && (h->Typ() == STRING_CMD))
     3536      {
     3537        char* filename = (char*)h->Data();
     3538        FILE* f = fopen(filename, "r");
     3539        if (f == NULL)
     3540        {
     3541          WerrorS( "invalid file name (in paths use '/')");
     3542          return FALSE;
     3543        }
     3544        mpz_t m; mpz_init(m);
     3545        mpz_inp_str(m, f, 10);
     3546        fclose(f);
     3547        number n = n_InitMPZ(m, coeffs_BIGINT);
     3548        res->rtyp = BIGINT_CMD;
     3549        res->data = (void*)n;
     3550        return FALSE;
     3551      }
     3552      else
     3553      {
     3554        WerrorS( "expected valid file name as a string");
     3555        return TRUE;
     3556      }
     3557    }
     3558    else
     3559  /*==================== intvec matching ======================*/
     3560    /* Given two non-empty intvecs, the call
     3561            'system("intvecMatchingSegments", ivec, jvec);'
     3562         computes all occurences of jvec in ivec, i.e., it returns
     3563         a list of int indices k such that ivec[k..size(jvec)+k-1] = jvec.
     3564         If no such k exists (e.g. when ivec is shorter than jvec), an
     3565         intvec with the single entry 0 is being returned. */
     3566    if(strcmp(sys_cmd, "intvecMatchingSegments")==0)
     3567    {
     3568      if ((h       != NULL) && (h->Typ()       == INTVEC_CMD) &&
     3569          (h->next != NULL) && (h->next->Typ() == INTVEC_CMD) &&
     3570          (h->next->next == NULL))
     3571      {
     3572        intvec* ivec = (intvec*)h->Data();
     3573        intvec* jvec = (intvec*)h->next->Data();
     3574        intvec* r = new intvec(1); (*r)[0] = 0;
     3575        int validEntries = 0;
     3576        for (int k = 0; k <= ivec->rows() - jvec->rows(); k++)
     3577        {
     3578          if (memcmp(&(*ivec)[k], &(*jvec)[0],
     3579                       sizeof(int) * jvec->rows()) == 0)
     3580          {
     3581            if (validEntries == 0)
     3582              (*r)[0] = k + 1;
     3583            else
     3584            {
     3585              r->resize(validEntries + 1);
     3586              (*r)[validEntries] = k + 1;
     3587            }
     3588            validEntries++;
     3589          }
     3590        }
     3591        res->rtyp = INTVEC_CMD;
     3592        res->data = (void*)r;
     3593        return FALSE;
     3594      }
     3595      else
     3596      {
     3597        WerrorS("expected two non-empty intvecs as arguments");
     3598        return TRUE;
     3599      }
     3600    }
     3601    else
     3602  /* ================== intvecOverlap ======================= */
     3603    /* Given two non-empty intvecs, the call
     3604            'system("intvecOverlap", ivec, jvec);'
     3605         computes the longest intvec kvec such that ivec ends with kvec
     3606         and jvec starts with kvec. The length of this overlap is being
     3607         returned. If there is no overlap at all, then 0 is being returned. */
     3608    if(strcmp(sys_cmd, "intvecOverlap")==0)
     3609    {
     3610      if ((h       != NULL) && (h->Typ()       == INTVEC_CMD) &&
     3611            (h->next != NULL) && (h->next->Typ() == INTVEC_CMD) &&
     3612            (h->next->next == NULL))
     3613      {
     3614        intvec* ivec = (intvec*)h->Data();
     3615        intvec* jvec = (intvec*)h->next->Data();
     3616        int ir = ivec->rows(); int jr = jvec->rows();
     3617        int r = jr; if (ir < jr) r = ir;   /* r = min{ir, jr} */
     3618        while ((r >= 1) && (memcmp(&(*ivec)[ir - r], &(*jvec)[0],
     3619                                     sizeof(int) * r) != 0))
     3620          r--;
     3621        res->rtyp = INT_CMD;
     3622        res->data = (void*)(long)r;
     3623        return FALSE;
     3624      }
     3625      else
     3626      {
     3627        WerrorS("expected two non-empty intvecs as arguments");
     3628        return TRUE;
     3629      }
     3630    }
     3631    else
     3632  /*==================== Hensel's lemma ======================*/
     3633    if(strcmp(sys_cmd, "henselfactors")==0)
     3634    {
     3635      if ((h != NULL) && (h->Typ() == INT_CMD) &&
     3636        (h->next != NULL) && (h->next->Typ() == INT_CMD) &&
     3637        (h->next->next != NULL) && (h->next->next->Typ() == POLY_CMD) &&
     3638        (h->next->next->next != NULL) &&
     3639        (h->next->next->next->Typ() == POLY_CMD) &&
     3640        (h->next->next->next->next != NULL) &&
     3641        (h->next->next->next->next->Typ() == POLY_CMD) &&
     3642        (h->next->next->next->next->next != NULL) &&
     3643        (h->next->next->next->next->next->Typ() == INT_CMD) &&
     3644        (h->next->next->next->next->next->next == NULL))
     3645      {
     3646        int xIndex = (int)(long)h->Data();
     3647        int yIndex = (int)(long)h->next->Data();
     3648        poly hh    = (poly)h->next->next->Data();
     3649        poly f0    = (poly)h->next->next->next->Data();
     3650        poly g0    = (poly)h->next->next->next->next->Data();
     3651        int d      = (int)(long)h->next->next->next->next->next->Data();
     3652        poly f; poly g;
     3653        henselFactors(xIndex, yIndex, hh, f0, g0, d, f, g);
     3654        lists L = (lists)omAllocBin(slists_bin);
     3655        L->Init(2);
     3656        L->m[0].rtyp = POLY_CMD; L->m[0].data=(void*)f;
     3657        L->m[1].rtyp = POLY_CMD; L->m[1].data=(void*)g;
     3658        res->rtyp = LIST_CMD;
     3659        res->data = (char *)L;
     3660        return FALSE;
     3661      }
     3662      else
     3663      {
     3664        WerrorS( "expected argument list (int, int, poly, poly, poly, int)");
     3665        return TRUE;
     3666      }
     3667    }
     3668    else
     3669  /*==================== neworder =============================*/
     3670    if(strcmp(sys_cmd,"neworder")==0)
     3671    {
     3672      if ((h!=NULL) &&(h->Typ()==IDEAL_CMD))
     3673      {
     3674        res->rtyp=STRING_CMD;
     3675        res->data=(void *)singclap_neworder((ideal)h->Data(), currRing);
     3676        return FALSE;
     3677      }
     3678      else
     3679        WerrorS("ideal expected");
     3680    }
     3681    else
     3682  /*==================== Approx_Step  =================*/
     3683  #ifdef HAVE_PLURAL
     3684    if (strcmp(sys_cmd, "astep") == 0)
     3685    {
     3686      ideal I;
     3687      if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
     3688      {
     3689        I=(ideal)h->CopyD();
     3690        res->rtyp=IDEAL_CMD;
     3691        if (rIsPluralRing(currRing)) res->data=Approx_Step(I);
     3692        else res->data=I;
     3693        setFlag(res,FLAG_STD);
     3694      }
     3695      else return TRUE;
     3696      return FALSE;
     3697    }
     3698    else
     3699  #endif
     3700  /*==================== PrintMat  =================*/
     3701  #ifdef HAVE_PLURAL
     3702    if (strcmp(sys_cmd, "PrintMat") == 0)
     3703    {
     3704      int a;
     3705      int b;
     3706      ring r;
     3707      int metric;
     3708      if (h!=NULL)
     3709      {
     3710        if (h->Typ()==INT_CMD)
     3711        {
     3712          a=(int)((long)(h->Data()));
     3713          h=h->next;
     3714        }
     3715        else if (h->Typ()==INT_CMD)
     3716        {
     3717          b=(int)((long)(h->Data()));
     3718          h=h->next;
     3719        }
     3720        else if (h->Typ()==RING_CMD)
     3721        {
     3722          r=(ring)h->Data();
     3723          h=h->next;
     3724        }
     3725        else
     3726          return TRUE;
     3727      }
     3728      else
     3729        return TRUE;
     3730      if ((h!=NULL) && (h->Typ()==INT_CMD))
     3731      {
     3732        metric=(int)((long)(h->Data()));
     3733      }
     3734      res->rtyp=MATRIX_CMD;
     3735      if (rIsPluralRing(r)) res->data=nc_PrintMat(a,b,r,metric);
     3736      else res->data=NULL;
     3737      return FALSE;
     3738    }
     3739    else
     3740  #endif
     3741/* ============ NCUseExtensions ======================== */
     3742  #ifdef HAVE_PLURAL
     3743    if(strcmp(sys_cmd,"NCUseExtensions")==0)
     3744    {
     3745      if ((h!=NULL) && (h->Typ()==INT_CMD))
     3746        res->data=(void *)(long)setNCExtensions( (int)((long)(h->Data())) );
     3747      else
     3748        res->data=(void *)(long)getNCExtensions();
     3749      res->rtyp=INT_CMD;
     3750      return FALSE;
     3751    }
     3752    else
     3753  #endif
     3754/* ============ NCGetType ======================== */
     3755  #ifdef HAVE_PLURAL
     3756    if(strcmp(sys_cmd,"NCGetType")==0)
     3757    {
     3758      res->rtyp=INT_CMD;
     3759      if( rIsPluralRing(currRing) )
     3760        res->data=(void *)(long)ncRingType(currRing);
     3761      else
     3762        res->data=(void *)(-1L);
     3763      return FALSE;
     3764    }
     3765    else
     3766  #endif
     3767/* ============ ForceSCA ======================== */
     3768  #ifdef HAVE_PLURAL
     3769    if(strcmp(sys_cmd,"ForceSCA")==0)
     3770    {
     3771      if( !rIsPluralRing(currRing) )
     3772        return TRUE;
     3773      int b, e;
     3774      if ((h!=NULL) && (h->Typ()==INT_CMD))
     3775      {
     3776        b = (int)((long)(h->Data()));
     3777        h=h->next;
     3778      }
     3779      else return TRUE;
     3780      if ((h!=NULL) && (h->Typ()==INT_CMD))
     3781      {
     3782        e = (int)((long)(h->Data()));
     3783      }
     3784      else return TRUE;
     3785      if( !sca_Force(currRing, b, e) )
     3786        return TRUE;
     3787      return FALSE;
     3788    }
     3789    else
     3790  #endif
     3791/* ============ ForceNewNCMultiplication ======================== */
     3792  #ifdef HAVE_PLURAL
     3793    if(strcmp(sys_cmd,"ForceNewNCMultiplication")==0)
     3794    {
     3795      if( !rIsPluralRing(currRing) )
     3796        return TRUE;
     3797      if( !ncInitSpecialPairMultiplication(currRing) ) // No Plural!
     3798        return TRUE;
     3799      return FALSE;
     3800    }
     3801    else
     3802  #endif
     3803/* ============ ForceNewOldNCMultiplication ======================== */
     3804  #ifdef HAVE_PLURAL
     3805    if(strcmp(sys_cmd,"ForceNewOldNCMultiplication")==0)
     3806    {
     3807      if( !rIsPluralRing(currRing) )
     3808        return TRUE;
     3809      if( !ncInitSpecialPowersMultiplication(currRing) ) // Enable Formula for Plural (depends on swiches)!
     3810        return TRUE;
     3811      return FALSE;
     3812    }
     3813    else
     3814  #endif
    38493815/*==================== Error =================*/
    38503816      Werror( "(extended) system(\"%s\",...) %s", sys_cmd, feNotImplemented );
  • kernel/mod2.h

    r7761b3 rdb7488  
    4646#define FAST_AND_DIRTY
    4747
    48 #if 0
    49 /* defined(HAVE_DYNAMIC_LOADING)? TODO: the following features are not tested in legacy Singular! :( */
    50 
    5148/* eigenvalues */
    5249#define HAVE_EIGENVAL 1
     
    5451/* Gauss-Manin system */
    5552#define HAVE_GMS 1
    56 
    57 #endif
    5853
    5954/* include simpleipc/semaphore code, link against librt/libpthread */
Note: See TracChangeset for help on using the changeset viewer.