Index: kernel/gr_kstd2.cc
===================================================================
--- kernel/gr_kstd2.cc	(revision a0a9f0d6ddf91bf97a108e81a1b1415c0ad58615)
+++ kernel/gr_kstd2.cc	(revision c7aad03a695808dc3f5aaaa108a93dbc905bf922)
@@ -217,4 +217,5 @@
   pDelete(&f);
 }
+
 #ifdef HAVE_RATGRING
 /*2
Index: kernel/kstd1.cc
===================================================================
--- kernel/kstd1.cc	(revision a0a9f0d6ddf91bf97a108e81a1b1415c0ad58615)
+++ kernel/kstd1.cc	(revision c7aad03a695808dc3f5aaaa108a93dbc905bf922)
@@ -52,4 +52,5 @@
 #include <polys/nc/nc.h>
 #include <polys/nc/sca.h>
+#include <kernel/nc.h>
 #endif
 
Index: kernel/nc.h
===================================================================
--- kernel/nc.h	(revision a0a9f0d6ddf91bf97a108e81a1b1415c0ad58615)
+++ kernel/nc.h	(revision c7aad03a695808dc3f5aaaa108a93dbc905bf922)
@@ -6,5 +6,5 @@
 #include <polys/simpleideals.h>
 
-
+#include <kernel/polys.h>
 
 /// Compute two-sided GB:
@@ -13,4 +13,77 @@
 /// Ann: ???
 ideal Approx_Step(ideal L);
+
+class skStrategy;
+typedef skStrategy * kStrategy;
+
+// ideal gnc_gr_mora(const ideal, const ideal, const intvec *, const intvec *, kStrategy/*, const ring r*/); // Not yet!
+ideal gnc_gr_bba (const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat/*, const ring r*/);
+
+
+static inline ideal nc_GB(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat, const ring r)
+{
+  assume(rIsPluralRing(r));
+   
+  const ring save = currRing;
+   
+  if( save != r )
+     rChangeCurrRing(r);
+   
+///////////  rGR->GetNC()->p_Procs.GB          = gnc_gr_bba; // bba even for local case!
+// old ///    r->GetNC()->GB()            = gnc_gr_bba;
+   
+//   rGR->GetNC()->p_Procs.GlobalGB    = gnc_gr_bba;
+//   rGR->GetNC()->p_Procs.LocalGB     = gnc_gr_mora;
+   
+//  assume(r->GetNC()->p_Procs.GB!=NULL);
+//  return r->GetNC()->p_Procs.GB(F, Q, w, hilb, strat, r);
+  ideal res = gnc_gr_bba(F, Q, w, hilb, strat/*, r*/);
+   
+   
+/*
+// Modified Plural's Buchberger's algorithmus.
+ideal sca_gr_bba(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing);
+
+// Modified modern Sinuglar Buchberger's algorithm.
+ideal sca_bba(const ideal F, const ideal Q, const intvec *w, const intvec *, kStrategy strat, const ring _currRing);
+
+// Modified modern Sinuglar Mora's algorithm.
+ideal sca_mora(const ideal F, const ideal Q, const intvec *w, const intvec *, kStrategy strat, const ring _currRing);
+*/
+
+   
+/*
+  if (rHasLocalOrMixedOrdering(rGR))
+  {
+#ifdef PDEBUG
+//           Print("Local case => GB == mora!\n");
+#endif
+    rGR->GetNC()->p_Procs.GB          = NULL; // sca_mora; // local ordering => Mora, otherwise - Buchberger!
+  }
+  else
+  {
+#ifdef PDEBUG
+//           Print("Global case => GB == bba!\n");
+#endif
+    rGR->GetNC()->p_Procs.GB          = NULL; // sca_bba; // sca_gr_bba; // sca_bba? // sca_bba;
+  }
+//   rGR->GetNC()->p_Procs.GlobalGB    = sca_gr_bba;
+//   rGR->GetNC()->p_Procs.LocalGB     = sca_mora;
+
+   
+/////        r->GetNC()->GB()            = sca_gr_bba;
+*/
+  if( save != r )
+     rChangeCurrRing(save);
+   
+  return (res);
+}
+/*
+
+// typedef ideal (*GB_Proc_Ptr)(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat, const ring r);
+  GB_Proc_Ptr                           GB;
+//                                         GlobalGB, // BBA
+//                                         LocalGB;  // MORA
+*/
 
 
Index: kernel/sca.cc
===================================================================
--- kernel/sca.cc	(revision c7aad03a695808dc3f5aaaa108a93dbc905bf922)
+++ kernel/sca.cc	(revision c7aad03a695808dc3f5aaaa108a93dbc905bf922)
@@ -0,0 +1,1255 @@
+#include "mod2.h"
+#include <misc/auxiliary.h>
+
+#include <misc/options.h>
+
+#include <polys/simpleideals.h>
+#include <kernel/polys.h>
+
+#include <polys/prCopy.h>
+
+#include "ideals.h"
+#include "kstd1.h"
+
+#include "nc.h"
+
+/*
+void addLObject(LObject& h, kStrategy& strat)
+{
+  if(h.IsNull()) return;
+
+  strat->initEcart(&h);
+  h.sev=0; // pGetShortExpVector(h.p);
+
+  // add h into S and L
+  int pos=posInS(strat, strat->sl, h.p, h.ecart);
+
+  if ( (pos <= strat->sl) && (pComparePolys(h.p, strat->S[pos])) )
+  {
+    if (TEST_OPT_PROT)
+      PrintS("d\n");
+  }
+  else
+  {
+    if (TEST_OPT_INTSTRATEGY)
+    {
+      p_Cleardenom(h.p, currRing);
+    }
+    else
+    {
+      pNorm(h.p);
+      p_Content(h.p,currRing);
+    }
+
+    if ((strat->syzComp==0)||(!strat->homog))
+    {
+      h.p = redtailBba(h.p,pos-1,strat);
+
+      if (TEST_OPT_INTSTRATEGY)
+      {
+//        pCleardenom(h.p);
+        p_Content(h.p,currRing);
+      }
+      else
+      {
+        pNorm(h.p);
+      }
+    }
+
+    if(h.IsNull()) return;
+
+    // statistic
+    if (TEST_OPT_PROT)
+    {
+      PrintS("s\n");
+    }
+
+#ifdef KDEBUG
+    if (TEST_OPT_DEBUG)
+    {
+      PrintS("new s:");
+      wrp(h.p);
+      PrintLn();
+    }
+#endif
+
+    enterpairs(h.p, strat->sl, h.ecart, 0, strat);
+
+    pos=0;
+
+    if (strat->sl!=-1) pos = posInS(strat, strat->sl, h.p, h.ecart);
+    strat->enterS(h, pos, strat, -1);
+//    enterT(h, strat); // ?!
+
+    if (h.lcm!=NULL) pLmFree(h.lcm);
+  }
+
+
+}
+
+*/
+
+ideal sca_gr_bba(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
+{
+/*
+#if MYTEST
+   PrintS("<sca_gr_bba>\n");
+#endif
+
+  assume(rIsSCA(currRing));
+
+#ifndef NDEBUG
+  idTest(F);
+  idTest(Q);
+#endif
+
+#ifdef HAVE_PLURAL
+#if MYTEST
+  PrintS("currRing: \n");
+  rWrite(currRing);
+#ifdef RDEBUG
+  rDebugPrint(currRing);
+#endif
+
+  PrintS("F: \n");
+  idPrint(F);
+  PrintS("Q: \n");
+  idPrint(Q);
+#endif
+#endif
+
+
+  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
+  const unsigned int m_iLastAltVar  = scaLastAltVar(currRing);
+
+  ideal tempF = id_KillSquares(F, m_iFirstAltVar, m_iLastAltVar, currRing);
+  ideal tempQ = Q;
+
+  if(Q == currQuotient)
+    tempQ = SCAQuotient(currRing);
+
+  strat->z2homog = id_IsSCAHomogeneous(tempF, NULL, NULL, currRing); // wCx == wCy == NULL!
+  // redo: no_prod_crit
+  const BOOLEAN bIsSCA  = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
+  strat->no_prod_crit   = ! bIsSCA;
+
+//  strat->homog = strat->homog && strat->z2homog; // ?
+
+#if MYTEST
+  {
+    PrintS("ideal tempF: \n");
+    idPrint(tempF);
+    PrintS("ideal tempQ: \n");
+    idPrint(tempQ);
+  }
+#endif
+
+#ifdef KDEBUG
+  om_Opts.MinTrack = 5;
+#endif
+
+  int srmax, lrmax;
+  int olddeg, reduc;
+  int red_result = 1;
+//  int hilbeledeg = 1, minimcnt = 0;
+  int hilbcount = 0;
+
+  initBuchMoraCrit(strat); // set Gebauer, honey, sugarCrit
+
+  nc_gr_initBba(tempF,strat); // set enterS, red, initEcart, initEcartPair
+
+  initBuchMoraPos(strat);
+
+
+  // ?? set spSpolyShort, reduce ???
+
+  initBuchMora(tempF, tempQ, strat); // SCAQuotient(currRing) instead of Q == squares!!!!!!!
+
+  strat->posInT=posInT110; // !!!
+
+  srmax = strat->sl;
+  reduc = olddeg = lrmax = 0;
+
+
+  // compute-------------------------------------------------------
+  for(; strat->Ll >= 0;
+#ifdef KDEBUG
+    strat->P.lcm = NULL,
+#endif
+    kTest(strat)
+    )
+  {
+    if (strat->Ll > lrmax) lrmax =strat->Ll;// stat.
+
+#ifdef KDEBUG
+    if (TEST_OPT_DEBUG) messageSets(strat);
+#endif
+
+    if (strat->Ll== 0) strat->interpt=TRUE;
+
+    if (TEST_OPT_DEGBOUND
+    && ((strat->honey
+    && (strat->L[strat->Ll].ecart+pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
+       || ((!strat->honey) && (pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
+    {
+      // stops computation if
+      // 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
+      // a predefined number Kstd1_deg
+      while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
+      break;
+    }
+
+    // picks the last element from the lazyset L
+    strat->P = strat->L[strat->Ll];
+    strat->Ll--;
+
+    //kTest(strat);
+
+//    assume(pNext(strat->P.p) != strat->tail); // !???
+    if(strat->P.IsNull()) continue;
+
+
+    if( pNext(strat->P.p) == strat->tail )
+    {
+      // deletes the int spoly and computes SPoly
+      pLmFree(strat->P.p); // ???
+      strat->P.p = nc_CreateSpoly(strat->P.p1, strat->P.p2, currRing);
+    }
+
+    if(strat->P.IsNull()) continue;
+
+//     poly save = NULL;
+//
+//     if(pNext(strat->P.p) != NULL)
+//       save = p_Copy(strat->P.p, currRing);
+
+    strat->initEcart(&strat->P); // remove it?
+
+    if (TEST_OPT_PROT)
+      message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(), &olddeg,&reduc,strat, red_result);
+
+    // reduction of the element chosen from L wrt S
+    strat->red(&strat->P,strat);
+
+    if(strat->P.IsNull()) continue;
+
+    addLObject(strat->P, strat);
+
+    if (strat->sl > srmax) srmax = strat->sl;
+
+    const poly save = strat->P.p;
+
+#ifdef PDEBUG
+      p_Test(save, currRing);
+#endif
+    assume( save != NULL );
+
+    // SCA Specials:
+
+    {
+      const poly p_next = pNext(save);
+
+      if( p_next != NULL )
+      for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
+      if( p_GetExp(save, i, currRing) != 0 )
+      {
+        assume(p_GetExp(save, i, currRing) == 1);
+
+        const poly tt = sca_pp_Mult_xi_pp(i, p_next, currRing);
+
+#ifdef PDEBUG
+        p_Test(tt, currRing);
+#endif
+
+        if( tt == NULL) continue;
+
+        LObject h(tt); // h = x_i * P
+
+        if (TEST_OPT_INTSTRATEGY)
+        {
+//           h.pCleardenom(); // also does a p_Content
+          p_Content(h.p,currRing);
+        }
+        else
+        {
+          h.pNorm();
+        }
+
+        strat->initEcart(&h);
+
+
+//         if (pOrdSgn==-1)
+//         {
+//           cancelunit(&h);  // tries to cancel a unit
+//           deleteHC(&h, strat);
+//         }
+
+//         if(h.IsNull()) continue;
+
+//         if (TEST_OPT_PROT)
+//           message((strat->honey ? h.ecart : 0) + h.pFDeg(), &olddeg, &reduc, strat, red_result);
+
+//         strat->red(&h, strat); // wrt S
+//         if(h.IsNull()) continue;
+
+//         poly save = p_Copy(h.p, currRing);
+
+        int pos;
+
+        if (strat->Ll==-1)
+          pos =0;
+        else
+          pos = strat->posInL(strat->L,strat->Ll,&h,strat);
+
+        h.sev = pGetShortExpVector(h.p);
+        enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
+
+  //       h.p = save;
+  //       addLObject(h, strat);
+
+//         if (strat->sl > srmax) srmax = strat->sl;
+      }
+
+      // p_Delete( &save, currRing );
+    }
+
+
+  } // for(;;)
+
+
+#ifdef KDEBUG
+  if (TEST_OPT_DEBUG) messageSets(strat);
+#endif
+
+  if (TEST_OPT_REDSB){
+    completeReduce(strat); // ???
+  }
+
+  // release temp data--------------------------------
+  exitBuchMora(strat);
+
+  if (TEST_OPT_WEIGHTM)
+  {
+    pFDeg=pFDegOld;
+    pLDeg=pLDegOld;
+    if (ecartWeights)
+    {
+      omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(int));
+      ecartWeights=NULL;
+    }
+  }
+
+  if (TEST_OPT_PROT) messageStat(srmax,lrmax,hilbcount,strat);
+
+  if (tempQ!=NULL) updateResult(strat->Shdl,tempQ,strat);
+
+  id_Delete(&tempF, currRing);
+
+
+  // complete reduction of the standard basis---------
+  if (TEST_OPT_REDSB){
+    ideal I = strat->Shdl;
+    ideal erg = kInterRedOld(I,tempQ);
+    assume(I!=erg);
+    id_Delete(&I, currRing);
+    strat->Shdl = erg;
+  }
+
+
+#if MYTEST
+//   PrintS("</sca_gr_bba>\n");
+#endif
+
+  return (strat->Shdl);
+*/
+}
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////
+//************* SCA BBA *************************************************************//
+///////////////////////////////////////////////////////////////////////////////////////
+
+// Under development!!!
+ideal sca_bba (const ideal F, const ideal Q, const intvec *w, const intvec * /*hilb*/, kStrategy strat)
+{
+/*
+#if MYTEST
+  PrintS("\n\n<sca_bba>\n\n");
+#endif
+
+  assume(rIsSCA(currRing));
+
+#ifndef NDEBUG
+  idTest(F);
+  idTest(Q);
+#endif
+
+#if MYTEST
+  PrintS("\ncurrRing: \n");
+  rWrite(currRing);
+#ifdef RDEBUG
+//  rDebugPrint(currRing);
+#endif
+
+  PrintS("\n\nF: \n");
+  idPrint(F);
+  PrintS("\n\nQ: \n");
+  idPrint(Q);
+
+  PrintLn();
+#endif
+
+
+  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
+  const unsigned int m_iLastAltVar  = scaLastAltVar(currRing);
+
+  ideal tempF = id_KillSquares(F, m_iFirstAltVar, m_iLastAltVar, currRing);
+
+  ideal tempQ = Q;
+
+  if(Q == currQuotient)
+    tempQ = SCAQuotient(currRing);
+
+  // Q or tempQ will not be used below :(((
+
+
+#if MYTEST
+
+  PrintS("tempF: \n");
+  idPrint(tempF);
+  PrintS("tempQ: \n");
+  idPrint(tempQ);
+#endif
+
+  strat->z2homog = id_IsSCAHomogeneous(tempF, NULL, NULL, currRing); // wCx == wCy == NULL!
+   // redo no_prod_crit:
+  const BOOLEAN bIsSCA  = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
+  strat->no_prod_crit   = ! bIsSCA;
+
+//  strat->homog = strat->homog && strat->z2homog; // ?
+
+
+
+#ifdef KDEBUG
+  om_Opts.MinTrack = 5;
+#endif
+
+  int   srmax, lrmax, red_result = 1;
+  int   olddeg, reduc;
+
+//  int hilbeledeg = 1, minimcnt = 0;
+  int hilbcount = 0;
+
+  BOOLEAN withT = FALSE;
+
+  initBuchMoraCrit(strat); // sets Gebauer, honey, sugarCrit // sca - ok???
+  initBuchMoraPos(strat); // sets strat->posInL, strat->posInT // check!! (Plural's: )
+
+//   initHilbCrit(F, Q, &hilb, strat);
+
+//  nc_gr_initBba(F,strat);
+  initBba(tempF, strat); // set enterS, red, initEcart, initEcartPair
+
+  // set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair
+  // ?? set spSpolyShort, reduce ???
+  initBuchMora(tempF, tempQ, strat); // tempQ = Q without squares!!!
+
+//   if (strat->minim>0) strat->M = idInit(IDELEMS(F),F->rank);
+
+  srmax = strat->sl;
+  reduc = olddeg = lrmax = 0;
+
+#define NO_BUCKETS
+
+#ifndef NO_BUCKETS
+  if (!TEST_OPT_NOT_BUCKETS)
+    strat->use_buckets = 1;
+#endif
+
+  // redtailBBa against T for inhomogenous input
+  if (!TEST_OPT_OLDSTD)
+    withT = ! strat->homog;
+
+  // strat->posInT = posInT_pLength;
+  kTest_TS(strat);
+
+#undef HAVE_TAIL_RING
+
+#ifdef HAVE_TAIL_RING
+  if(!idIs0(F) &&(!rField_is_Ring()))  // create strong gcd poly computes with tailring and S[i] ->to be fixed
+    kStratInitChangeTailRing(strat);
+#endif
+  if (BVERBOSE(23))
+  {
+    if (test_PosInT!=NULL) strat->posInT=test_PosInT;
+    if (test_PosInL!=NULL) strat->posInL=test_PosInL;
+    kDebugPrint(strat);
+  }
+  
+
+  ///////////////////////////////////////////////////////////////
+  // SCA:
+
+  //  due to std( SB, p).
+  // Note that after initBuchMora :: initSSpecial all these additional
+  // elements are in S and T (and some pairs are in L, which also has no initiall
+  // elements!!!)
+  if(TEST_OPT_SB_1)
+  {
+    // For all additional elements...
+    for (int iNewElement = strat->newIdeal; iNewElement < IDELEMS(tempF); iNewElement++)
+    {
+      const poly pSave = tempF->m[iNewElement];
+
+      if( pSave != NULL )
+      {
+//        tempF->m[iNewElement] = NULL;
+
+        const poly p_next = pNext(pSave);
+
+        if(p_next != NULL)
+          for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
+            if( p_GetExp(pSave, i, currRing) != 0 )
+            {
+              assume(p_GetExp(pSave, i, currRing) == 1);
+
+              const poly p_new = sca_pp_Mult_xi_pp(i, p_next, currRing);
+
+#ifdef PDEBUG
+              p_Test(p_new, currRing);
+#endif
+
+              if( p_new == NULL) continue;
+
+              LObject h(p_new); // h = x_i * strat->P
+              h.is_special = TRUE;
+
+              if (TEST_OPT_INTSTRATEGY)
+                h.pCleardenom(); // also does a p_Content
+              else
+                h.pNorm();
+
+              strat->initEcart(&h);
+              h.sev = pGetShortExpVector(h.p);
+
+              int pos = 0;
+
+              if (strat->Ll != -1)
+                pos = strat->posInL(strat->L,strat->Ll,&h,strat);
+
+              enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
+            }
+      }
+    }
+  }
+
+  // compute-------------------------------------------------------
+  while (strat->Ll >= 0)
+  {
+    if (strat->Ll > lrmax) lrmax =strat->Ll;// stat.
+
+#ifdef KDEBUG
+//     loop_count++;
+    if (TEST_OPT_DEBUG) messageSets(strat);
+#endif
+
+    if (strat->Ll== 0) strat->interpt=TRUE;
+
+    if (TEST_OPT_DEGBOUND
+        && ((strat->honey && (strat->L[strat->Ll].ecart+pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
+            || ((!strat->honey) && (pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
+    {
+
+#ifdef KDEBUG
+//      if (TEST_OPT_DEBUG){PrintS("^^^^?");}
+#endif
+
+      // *stops computation if
+      // * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
+      // *a predefined number Kstd1_deg
+      while ((strat->Ll >= 0)
+        && ( (strat->homog==isHomog) || strat->L[strat->Ll].is_special || ((strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)) )
+        && ((strat->honey && (strat->L[strat->Ll].ecart+pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
+            || ((!strat->honey) && (pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
+            )
+      {
+#ifdef KDEBUG
+//        if (TEST_OPT_DEBUG){PrintS("^^^^^^^^^^^^!!!!");}
+#endif
+        deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
+//        if (TEST_OPT_PROT) PrintS("^!");
+      }
+      if (strat->Ll<0) break;
+      else strat->noClearS=TRUE;
+    }
+
+    // picks the last element from the lazyset L
+    strat->P = strat->L[strat->Ll];
+    strat->Ll--;
+
+
+//    assume(pNext(strat->P.p) != strat->tail);
+
+    if(strat->P.IsNull()) continue;
+
+    if (pNext(strat->P.p) == strat->tail)
+    {
+      // deletes the short spoly
+      pLmFree(strat->P.p);
+
+      strat->P.p = nc_CreateSpoly(strat->P.p1, strat->P.p2, currRing);
+      if (strat->P.p!=NULL) strat->initEcart(&strat->P);
+    }//    else
+
+
+    if(strat->P.IsNull()) continue;
+
+    if (strat->P.p1 == NULL)
+    {
+//       if (strat->minim > 0)
+//         strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
+
+
+      // for input polys, prepare reduction
+        strat->P.PrepareRed(strat->use_buckets);
+    }
+
+    if (TEST_OPT_PROT)
+      message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
+              &olddeg,&reduc,strat, red_result);
+
+    // reduction of the element choosen from L
+    red_result = strat->red(&strat->P,strat);
+
+
+    // reduction to non-zero new poly
+    if (red_result == 1)
+    {
+      // statistic
+      if (TEST_OPT_PROT) PrintS("s");
+
+      // get the polynomial (canonicalize bucket, make sure P.p is set)
+      strat->P.GetP(strat->lmBin);
+
+      int pos = posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
+
+      // reduce the tail and normalize poly
+      if (TEST_OPT_INTSTRATEGY)
+      {
+        strat->P.pCleardenom();
+        if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
+        {
+          strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT); // !!!
+          strat->P.pCleardenom();
+        }
+      }
+      else
+      {
+        strat->P.pNorm();
+        if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
+          strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
+      }
+      strat->P.is_normalized=nIsOne(pGetCoeff(strat->P.p));
+
+#ifdef KDEBUG
+      if (TEST_OPT_DEBUG){PrintS(" ns:");p_wrp(strat->P.p,currRing);PrintLn();}
+#endif
+
+//       // min_std stuff
+//       if ((strat->P.p1==NULL) && (strat->minim>0))
+//       {
+//         if (strat->minim==1)
+//         {
+//           strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
+//           p_Delete(&strat->P.p2, currRing, strat->tailRing);
+//         }
+//         else
+//         {
+//           strat->M->m[minimcnt]=strat->P.p2;
+//           strat->P.p2=NULL;
+//         }
+//         if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
+//           pNext(strat->M->m[minimcnt])
+//             = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
+//                                            strat->tailRing, currRing,
+//                                            currRing->PolyBin);
+//         minimcnt++;
+//       }
+
+      // enter into S, L, and T
+      //if(withT)
+        enterT(strat->P, strat);
+
+      // L
+      enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
+
+      // posInS only depends on the leading term
+      strat->enterS(strat->P, pos, strat, strat->tl);
+
+//       if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
+
+//      Print("[%d]",hilbeledeg);
+      if (strat->P.lcm!=NULL) pLmFree(strat->P.lcm);
+
+      if (strat->sl>srmax) srmax = strat->sl;
+
+      // //////////////////////////////////////////////////////////
+      // SCA:
+      const poly pSave = strat->P.p;
+      const poly p_next = pNext(pSave);
+
+//       if(0)
+      if( p_next != NULL )
+      for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
+      if( p_GetExp(pSave, i, currRing) != 0 )
+      {
+        assume(p_GetExp(pSave, i, currRing) == 1);
+        const poly p_new = sca_pp_Mult_xi_pp(i, p_next, currRing);
+
+#ifdef PDEBUG
+        p_Test(p_new, currRing);
+#endif
+
+        if( p_new == NULL) continue;
+
+        LObject h(p_new); // h = x_i * strat->P
+
+        h.is_special = TRUE;
+
+        if (TEST_OPT_INTSTRATEGY)
+        {
+//          p_Content(h.p);
+          h.pCleardenom(); // also does a p_Content
+        }
+        else
+        {
+          h.pNorm();
+        }
+
+        strat->initEcart(&h);
+        h.sev = pGetShortExpVector(h.p);
+
+        int pos = 0;
+
+        if (strat->Ll != -1)
+          pos = strat->posInL(strat->L,strat->Ll,&h,strat);
+
+        enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
+
+ 
+ 
+ 
+#if 0   
+        h.sev = pGetShortExpVector(h.p);
+        strat->initEcart(&h);
+
+        h.PrepareRed(strat->use_buckets);
+
+        // reduction of the element choosen from L(?)
+        red_result = strat->red(&h,strat);
+
+        // reduction to non-zero new poly
+        if (red_result != 1) continue;
+
+
+        int pos = posInS(strat,strat->sl,h.p,h.ecart);
+
+        // reduce the tail and normalize poly
+        if (TEST_OPT_INTSTRATEGY)
+        {
+          h.pCleardenom();
+          if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
+          {
+            h.p = redtailBba(&(h),pos-1,strat, withT); // !!!
+            h.pCleardenom();
+          }
+        }
+        else
+        {
+          h.pNorm();
+          if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
+            h.p = redtailBba(&(h),pos-1,strat, withT);
+        }
+
+#ifdef KDEBUG
+        if (TEST_OPT_DEBUG){PrintS(" N:");h.wrp();PrintLn();}
+#endif
+
+//        h.PrepareRed(strat->use_buckets); // ???
+
+        h.sev = pGetShortExpVector(h.p);
+        strat->initEcart(&h);
+
+        if (strat->Ll==-1)
+          pos = 0;
+        else
+          pos = strat->posInL(strat->L,strat->Ll,&h,strat);
+
+         enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
+// the end of "#if 0" (comment) 
+#endif 
+
+      } // for all x_i \in Ann(lm(P))
+    } // if red(P) != NULL
+
+//     else if (strat->P.p1 == NULL && strat->minim > 0)
+//     {
+//       p_Delete(&strat->P.p2, currRing, strat->tailRing);
+//     }
+
+#ifdef KDEBUG
+//    memset(&(strat->P), 0, sizeof(strat->P));
+#endif
+
+    kTest_TS(strat); // even of T is not used!
+
+//     Print("\n$\n");
+
+  }
+
+#ifdef KDEBUG
+  if (TEST_OPT_DEBUG) messageSets(strat);
+#endif
+
+  // complete reduction of the standard basis---------
+
+  if (TEST_OPT_REDSB)
+  {
+    completeReduce(strat);
+  }
+
+  //release temp data--------------------------------
+
+  exitBuchMora(strat); // cleanT!
+
+  id_Delete(&tempF, currRing);
+
+  if (TEST_OPT_WEIGHTM)
+  {
+    pRestoreDegProcs(pFDegOld, pLDegOld);
+    if (ecartWeights)
+    {
+      omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
+      ecartWeights=NULL;
+    }
+  }
+
+  if (TEST_OPT_PROT) messageStat(srmax,lrmax,hilbcount,strat);
+
+
+
+  if (tempQ!=NULL) updateResult(strat->Shdl,tempQ,strat);
+
+
+  if (TEST_OPT_REDSB) // ???
+  {
+    // must be at the very end (after exitBuchMora) as it changes the S set!!!
+    ideal I = strat->Shdl;
+    ideal erg = kInterRedOld(I,tempQ);
+    assume(I!=erg);
+    id_Delete(&I, currRing);
+    strat->Shdl = erg;
+  }
+
+#if MYTEST
+  PrintS("\n\n</sca_bba>\n\n");
+#endif
+
+  return (strat->Shdl);
+*/
+}
+
+// //////////////////////////////////////////////////////////////////////////////
+// sca mora...
+
+/*
+// returns TRUE if mora should use buckets, false otherwise
+static BOOLEAN kMoraUseBucket(kStrategy strat)
+{
+#ifdef MORA_USE_BUCKETS
+  if (TEST_OPT_NOT_BUCKETS)
+    return FALSE;
+  if (strat->red == redFirst)
+  {
+#ifdef NO_LDEG
+    if (!strat->syzComp)
+      return TRUE;
+#else
+    if ((strat->homog || strat->honey) && !strat->syzComp)
+      return TRUE;
+#endif
+  }
+  else
+  {
+    assume(strat->red == redEcart);
+    if (strat->honey && !strat->syzComp)
+      return TRUE;
+  }
+#endif
+  return FALSE;
+}
+*/
+
+#ifdef HAVE_ASSUME
+static int sca_mora_count = 0;
+static int sca_mora_loop_count;
+#endif
+
+// ideal sca_mora (ideal F, ideal Q, intvec *w, intvec *, kStrategy strat)
+ideal sca_mora(const ideal F, const ideal Q, const intvec *w, const intvec *, kStrategy strat, const ring _currRing)
+{
+/*
+  assume(rIsSCA(currRing));
+
+  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
+  const unsigned int m_iLastAltVar  = scaLastAltVar(currRing);
+
+  ideal tempF = id_KillSquares(F, m_iFirstAltVar, m_iLastAltVar, currRing);
+
+  ideal tempQ = Q;
+
+  if(Q == currQuotient)
+    tempQ = SCAQuotient(currRing);
+
+  bool bIdHomog = id_IsSCAHomogeneous(tempF, NULL, NULL, currRing); // wCx == wCy == NULL!
+
+  assume( !bIdHomog || strat->homog ); //  bIdHomog =====[implies]>>>>> strat->homog
+
+  strat->homog = strat->homog && bIdHomog;
+
+#ifdef PDEBUG
+  assume( strat->homog == bIdHomog );
+#endif 
+
+#ifdef HAVE_ASSUME
+  sca_mora_count++;
+  sca_mora_loop_count = 0;
+#endif
+
+#ifdef KDEBUG
+  om_Opts.MinTrack = 5;
+#endif
+
+
+  strat->update = TRUE;
+  //- setting global variables ------------------- -
+  initBuchMoraCrit(strat);
+//   initHilbCrit(F,NULL,&hilb,strat); // no Q!
+  initMora(tempF, strat);
+  initBuchMoraPos(strat);
+  //Shdl=
+    initBuchMora(tempF, tempQ, strat); // temp Q, F!
+//   if (TEST_OPT_FASTHC) missingAxis(&strat->lastAxis,strat);
+  // updateS in initBuchMora has Hecketest
+  // * and could have put strat->kHEdgdeFound FALSE
+#if 0
+  if (ppNoether!=NULL)
+  {
+    strat->kHEdgeFound = TRUE;
+  }
+  if (strat->kHEdgeFound && strat->update)
+  {
+    firstUpdate(strat);
+    updateLHC(strat);
+    reorderL(strat);
+  }
+  if (TEST_OPT_FASTHC && (strat->lastAxis) && strat->posInLOldFlag)
+  {
+    strat->posInLOld = strat->posInL;
+    strat->posInLOldFlag = FALSE;
+    strat->posInL = posInL10;
+    updateL(strat);
+    reorderL(strat);
+  }
+#endif
+  strat->use_buckets = kMoraUseBucket(strat);
+
+  kTest_TS(strat);
+
+
+  int srmax = strat->sl;
+  int lrmax = strat->Ll;
+  int olddeg = 0;
+  int reduc = 0;
+  int red_result = 1;
+//  int hilbeledeg=1;
+  int hilbcount=0;
+
+
+  //- compute-------------------------------------------
+
+#undef HAVE_TAIL_RING
+
+#ifdef HAVE_TAIL_RING
+//  if (strat->homog && strat->red == redFirst)
+//     kStratInitChangeTailRing(strat);
+#endif
+
+
+
+
+
+//  due to std( SB, p)
+  if(TEST_OPT_SB_1)
+  {
+    for (int iNewElement = strat->newIdeal; iNewElement < IDELEMS(tempF); iNewElement++)
+    {
+
+      const poly pSave = tempF->m[iNewElement];
+
+      if( pSave != NULL )
+      {
+//        tempF->m[iNewElement] = NULL;
+
+        const poly p_next = pNext(pSave);
+
+        if(p_next != NULL)
+          for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
+            if( p_GetExp(pSave, i, currRing) != 0 )
+            {
+
+              assume(p_GetExp(pSave, i, currRing) == 1);
+
+              const poly p_new = sca_pp_Mult_xi_pp(i, p_next, currRing);
+
+#ifdef PDEBUG
+              p_Test(p_new, currRing);
+#endif
+
+              if( p_new == NULL) continue;
+
+              LObject h(p_new); // h = x_i * strat->P
+
+              if (TEST_OPT_INTSTRATEGY)
+                h.pCleardenom(); // also does a p_Content
+              else
+                h.pNorm();
+
+              strat->initEcart(&h);
+              h.sev = pGetShortExpVector(h.p);
+
+              int pos = 0;
+
+              if (strat->Ll != -1)
+                pos = strat->posInL(strat->L,strat->Ll,&h,strat);
+
+              enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
+
+              if (strat->Ll>lrmax) lrmax = strat->Ll;
+            }
+      }
+
+    }
+  }
+
+
+
+
+  while (strat->Ll >= 0)
+  {
+#ifdef HAVE_ASSUME
+    sca_mora_loop_count++;
+#endif
+    if (lrmax< strat->Ll) lrmax=strat->Ll; // stat
+    //test_int_std(strat->kIdeal);
+#ifdef KDEBUG
+    if (TEST_OPT_DEBUG) messageSets(strat);
+#endif
+    if (TEST_OPT_DEGBOUND
+    && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg))
+    {
+      // * stops computation if
+      // * - 24 (degBound)
+      // *   && upper degree is bigger than Kstd1_deg
+      while ((strat->Ll >= 0)
+        && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
+        && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg)
+      )
+      {
+        deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
+        //if (TEST_OPT_PROT)
+        //{
+        //   PrintS("D"); mflush();
+        //}
+      }
+      if (strat->Ll<0) break;
+      else strat->noClearS=TRUE;
+    }
+    strat->P = strat->L[strat->Ll];// - picks the last element from the lazyset L -
+    if (strat->Ll==0) strat->interpt=TRUE;
+    strat->Ll--;
+
+    // create the real Spoly
+//    assume(pNext(strat->P.p) != strat->tail);
+
+    if(strat->P.IsNull()) continue;
+
+
+    if( pNext(strat->P.p) == strat->tail )
+    {
+      // deletes the int spoly and computes SPoly
+      pLmFree(strat->P.p); // ???
+      strat->P.p = nc_CreateSpoly(strat->P.p1, strat->P.p2, currRing);
+    }
+
+
+
+    if (strat->P.p1 == NULL)
+    {
+      // for input polys, prepare reduction (buckets !)
+      strat->P.SetLength(strat->length_pLength);
+      strat->P.PrepareRed(strat->use_buckets);
+    }
+
+    if (!strat->P.IsNull())
+    {
+      // might be NULL from noether !!!
+      if (TEST_OPT_PROT)
+        message(strat->P.ecart+strat->P.GetpFDeg(),&olddeg,&reduc,strat, red_result);
+      // reduce
+      red_result = strat->red(&strat->P,strat);
+    }
+
+    if (! strat->P.IsNull())
+    {
+      strat->P.GetP();
+      // statistics
+      if (TEST_OPT_PROT) PrintS("s");
+      // normalization
+      if (!TEST_OPT_INTSTRATEGY)
+        strat->P.pNorm();
+      // tailreduction
+      strat->P.p = redtail(&(strat->P),strat->sl,strat);
+      // set ecart -- might have changed because of tail reductions
+      if ((!strat->noTailReduction) && (!strat->honey))
+        strat->initEcart(&strat->P);
+      // cancel unit
+      cancelunit(&strat->P);
+      // for char 0, clear denominators
+      if (TEST_OPT_INTSTRATEGY)
+        strat->P.pCleardenom();
+
+      // put in T
+      enterT(strat->P,strat);
+      // build new pairs
+      enterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat, strat->tl);
+      // put in S
+      strat->enterS(strat->P,
+                    posInS(strat,strat->sl,strat->P.p, strat->P.ecart),
+                    strat, strat->tl);
+
+
+      // clear strat->P
+      if (strat->P.lcm!=NULL) pLmFree(strat->P.lcm);
+      strat->P.lcm=NULL;
+
+      if (strat->sl>srmax) srmax = strat->sl; // stat.
+      if (strat->Ll>lrmax) lrmax = strat->Ll;
+
+
+
+      // //////////////////////////////////////////////////////////
+      // SCA:
+      const poly pSave = strat->P.p;
+      const poly p_next = pNext(pSave);
+
+      if(p_next != NULL)
+      for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
+      if( p_GetExp(pSave, i, currRing) != 0 )
+      {
+
+        assume(p_GetExp(pSave, i, currRing) == 1);
+
+        const poly p_new = sca_pp_Mult_xi_pp(i, p_next, currRing);
+
+#ifdef PDEBUG
+        p_Test(p_new, currRing);
+#endif
+
+        if( p_new == NULL) continue;
+
+        LObject h(p_new); // h = x_i * strat->P
+
+        if (TEST_OPT_INTSTRATEGY)
+           h.pCleardenom(); // also does a p_Content
+        else
+          h.pNorm();
+
+        strat->initEcart(&h);
+        h.sev = pGetShortExpVector(h.p);
+
+        int pos = 0;
+
+        if (strat->Ll != -1)
+          pos = strat->posInL(strat->L,strat->Ll,&h,strat);
+
+        enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
+
+        if (strat->Ll>lrmax) lrmax = strat->Ll;
+      }
+
+#ifdef KDEBUG
+      // make sure kTest_TS does not complain about strat->P
+      memset(&strat->P,0,sizeof(strat->P));
+#endif
+    }
+#if 0
+    if (strat->kHEdgeFound)
+    {
+      if ((TEST_OPT_FINDET)
+      || ((TEST_OPT_MULTBOUND) && (scMult0Int((strat->Shdl)) < mu)))
+      {
+        // obachman: is this still used ???
+        // * stops computation if strat->kHEdgeFound and
+        // * - 27 (finiteDeterminacyTest)
+        // * or
+        // * - 23
+        // *   (multBound)
+        // *   && multiplicity of the ideal is smaller then a predefined number mu
+        while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
+      }
+    }
+#endif
+    kTest_TS(strat);
+  }
+  // - complete reduction of the standard basis------------------------ -
+  if (TEST_OPT_REDSB) completeReduce(strat);
+  // - release temp data------------------------------- -
+  exitBuchMora(strat);
+  // - polynomials used for HECKE: HC, noether -
+  if (TEST_OPT_FINDET)
+  {
+    if (strat->kHEdge!=NULL)
+      Kstd1_mu=pFDeg(strat->kHEdge,currRing);
+    else
+      Kstd1_mu=-1;
+  }
+  pDelete(&strat->kHEdge);
+  strat->update = TRUE; //???
+  strat->lastAxis = 0; //???
+  pDelete(&strat->kNoether);
+  omFreeSize((ADDRESS)strat->NotUsedAxis,(pVariables+1)*sizeof(BOOLEAN));
+  if (TEST_OPT_PROT) messageStat(srmax,lrmax,hilbcount,strat);
+  if (TEST_OPT_WEIGHTM)
+  {
+    pRestoreDegProcs(pFDegOld, pLDegOld);
+    if (ecartWeights)
+    {
+      omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
+      ecartWeights=NULL;
+    }
+  }
+  if (tempQ!=NULL) updateResult(strat->Shdl,tempQ,strat);
+  idTest(strat->Shdl);
+
+  id_Delete( &tempF, currRing);
+
+  return (strat->Shdl);
+*/
+}
+
+
+
+
+
Index: libpolys/polys/nc/nc.h
===================================================================
--- libpolys/polys/nc/nc.h	(revision a0a9f0d6ddf91bf97a108e81a1b1415c0ad58615)
+++ libpolys/polys/nc/nc.h	(revision c7aad03a695808dc3f5aaaa108a93dbc905bf922)
@@ -16,7 +16,4 @@
 class ip_smatrix;
 typedef ip_smatrix *       matrix;
-
-class skStrategy;
-typedef skStrategy * kStrategy;
 
 
@@ -62,6 +59,4 @@
 
 
-typedef ideal (*GB_Proc_Ptr)(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat, const ring r);
-
 typedef poly (*SPoly_Proc_Ptr)(const poly p1, const poly p2, const ring r);
 typedef poly (*SPolyReduce_Proc_Ptr)(const poly p1, poly p2, const ring r);
@@ -80,8 +75,4 @@
   SPoly_Proc_Ptr                        SPoly;
   SPolyReduce_Proc_Ptr                  ReduceSPoly;
-
-  GB_Proc_Ptr                           GB;
-//                                         GlobalGB, // BBA
-//                                         LocalGB;  // MORA
 };
 
@@ -321,13 +312,4 @@
 }
 
-static inline ideal nc_GB(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat, const ring r)
-{
-  assume(rIsPluralRing(r));
-
-  assume(r->GetNC()->p_Procs.GB!=NULL);
-  return r->GetNC()->p_Procs.GB(F, Q, w, hilb, strat, r);
-}
-
-
 
 /* subst: */
Index: libpolys/polys/nc/old.gring.cc
===================================================================
--- libpolys/polys/nc/old.gring.cc	(revision a0a9f0d6ddf91bf97a108e81a1b1415c0ad58615)
+++ libpolys/polys/nc/old.gring.cc	(revision c7aad03a695808dc3f5aaaa108a93dbc905bf922)
@@ -69,5 +69,5 @@
 poly nc_p_Bracket_qq(poly p, const poly q, const ring r);
 
-int  iNCExtensions = 0x00001; // only SCA can be used by default
+int  iNCExtensions = 0; // SCAMASK; // only SCA can be used by default
 
 
@@ -145,8 +145,4 @@
 
 // void nc_kBucketPolyRed(kBucket_pt b, poly p);
-
-// ideal gnc_gr_mora(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring r); // Not yet!
-// ideal gnc_gr_bba (const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring r);
-
 
 void nc_CleanUp(nc_struct* p); // just free memory!
@@ -3213,10 +3209,4 @@
   rGR->GetNC()->p_Procs.mm_Mult_pp  = gnc_mm_Mult_pp;
 
-///////////  rGR->GetNC()->p_Procs.GB          = gnc_gr_bba; // bba even for local case!
-
-//   rGR->GetNC()->p_Procs.GlobalGB    = gnc_gr_bba;
-//   rGR->GetNC()->p_Procs.LocalGB     = gnc_gr_mora;
-
-
 #if 0
   // Previous Plural's implementation...
@@ -3251,6 +3241,4 @@
     r->GetNC()->mmMultP()       = gnc_mm_Mult_p;
     r->GetNC()->mmMultPP()      = gnc_mm_Mult_pp;
-
-//////////////    r->GetNC()->GB()            = gnc_gr_bba;
 
     r->GetNC()->SPoly()         = gnc_CreateSpoly;
Index: libpolys/polys/nc/sca.cc
===================================================================
--- libpolys/polys/nc/sca.cc	(revision a0a9f0d6ddf91bf97a108e81a1b1415c0ad58615)
+++ libpolys/polys/nc/sca.cc	(revision c7aad03a695808dc3f5aaaa108a93dbc905bf922)
@@ -81,34 +81,8 @@
 poly sca_ReduceSpoly(const poly p1, poly p2, const ring r);
 
-/*
-// Modified Plural's Buchberger's algorithmus.
-ideal sca_gr_bba(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing);
-
-// Modified modern Sinuglar Buchberger's algorithm.
-ideal sca_bba(const ideal F, const ideal Q, const intvec *w, const intvec *, kStrategy strat, const ring _currRing);
-
-// Modified modern Sinuglar Mora's algorithm.
-ideal sca_mora(const ideal F, const ideal Q, const intvec *w, const intvec *, kStrategy strat, const ring _currRing);
-*/
-
-
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 // Super Commutative Algebra extension by Oleksandr
 ////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/*
-static inline ring assureCurrentRing(ring r)
-{
-  ring save = currRing;
-
-  if( currRing != r )
-    rChangeCurrRing(r);
-
-  return save;
-}
-*/
-
-
 
 // returns the sign of: lm(pMonomM) * lm(pMonomMM),
@@ -932,359 +906,4 @@
 }
 
-/*
-void addLObject(LObject& h, kStrategy& strat)
-{
-  if(h.IsNull()) return;
-
-  strat->initEcart(&h);
-  h.sev=0; // pGetShortExpVector(h.p);
-
-  // add h into S and L
-  int pos=posInS(strat, strat->sl, h.p, h.ecart);
-
-  if ( (pos <= strat->sl) && (pComparePolys(h.p, strat->S[pos])) )
-  {
-    if (TEST_OPT_PROT)
-      PrintS("d\n");
-  }
-  else
-  {
-    if (TEST_OPT_INTSTRATEGY)
-    {
-      p_Cleardenom(h.p, currRing);
-    }
-    else
-    {
-      pNorm(h.p);
-      p_Content(h.p,currRing);
-    }
-
-    if ((strat->syzComp==0)||(!strat->homog))
-    {
-      h.p = redtailBba(h.p,pos-1,strat);
-
-      if (TEST_OPT_INTSTRATEGY)
-      {
-//        pCleardenom(h.p);
-        p_Content(h.p,currRing);
-      }
-      else
-      {
-        pNorm(h.p);
-      }
-    }
-
-    if(h.IsNull()) return;
-
-    // statistic
-    if (TEST_OPT_PROT)
-    {
-      PrintS("s\n");
-    }
-
-#ifdef KDEBUG
-    if (TEST_OPT_DEBUG)
-    {
-      PrintS("new s:");
-      wrp(h.p);
-      PrintLn();
-    }
-#endif
-
-    enterpairs(h.p, strat->sl, h.ecart, 0, strat);
-
-    pos=0;
-
-    if (strat->sl!=-1) pos = posInS(strat, strat->sl, h.p, h.ecart);
-    strat->enterS(h, pos, strat, -1);
-//    enterT(h, strat); // ?!
-
-    if (h.lcm!=NULL) pLmFree(h.lcm);
-  }
-
-
-}
-
-*/
-
-
-
-ideal sca_gr_bba(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
-{
-/*
-#if MYTEST
-   PrintS("<sca_gr_bba>\n");
-#endif
-
-  assume(rIsSCA(currRing));
-
-#ifndef NDEBUG
-  idTest(F);
-  idTest(Q);
-#endif
-
-#ifdef HAVE_PLURAL
-#if MYTEST
-  PrintS("currRing: \n");
-  rWrite(currRing);
-#ifdef RDEBUG
-  rDebugPrint(currRing);
-#endif
-
-  PrintS("F: \n");
-  idPrint(F);
-  PrintS("Q: \n");
-  idPrint(Q);
-#endif
-#endif
-
-
-  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
-  const unsigned int m_iLastAltVar  = scaLastAltVar(currRing);
-
-  ideal tempF = id_KillSquares(F, m_iFirstAltVar, m_iLastAltVar, currRing);
-  ideal tempQ = Q;
-
-  if(Q == currQuotient)
-    tempQ = SCAQuotient(currRing);
-
-  strat->z2homog = id_IsSCAHomogeneous(tempF, NULL, NULL, currRing); // wCx == wCy == NULL!
-  // redo: no_prod_crit
-  const BOOLEAN bIsSCA  = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
-  strat->no_prod_crit   = ! bIsSCA;
-
-//  strat->homog = strat->homog && strat->z2homog; // ?
-
-#if MYTEST
-  {
-    PrintS("ideal tempF: \n");
-    idPrint(tempF);
-    PrintS("ideal tempQ: \n");
-    idPrint(tempQ);
-  }
-#endif
-
-#ifdef KDEBUG
-  om_Opts.MinTrack = 5;
-#endif
-
-  int srmax, lrmax;
-  int olddeg, reduc;
-  int red_result = 1;
-//  int hilbeledeg = 1, minimcnt = 0;
-  int hilbcount = 0;
-
-  initBuchMoraCrit(strat); // set Gebauer, honey, sugarCrit
-
-  nc_gr_initBba(tempF,strat); // set enterS, red, initEcart, initEcartPair
-
-  initBuchMoraPos(strat);
-
-
-  // ?? set spSpolyShort, reduce ???
-
-  initBuchMora(tempF, tempQ, strat); // SCAQuotient(currRing) instead of Q == squares!!!!!!!
-
-  strat->posInT=posInT110; // !!!
-
-  srmax = strat->sl;
-  reduc = olddeg = lrmax = 0;
-
-
-  // compute-------------------------------------------------------
-  for(; strat->Ll >= 0;
-#ifdef KDEBUG
-    strat->P.lcm = NULL,
-#endif
-    kTest(strat)
-    )
-  {
-    if (strat->Ll > lrmax) lrmax =strat->Ll;// stat.
-
-#ifdef KDEBUG
-    if (TEST_OPT_DEBUG) messageSets(strat);
-#endif
-
-    if (strat->Ll== 0) strat->interpt=TRUE;
-
-    if (TEST_OPT_DEGBOUND
-    && ((strat->honey
-    && (strat->L[strat->Ll].ecart+pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
-       || ((!strat->honey) && (pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
-    {
-      // stops computation if
-      // 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
-      // a predefined number Kstd1_deg
-      while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
-      break;
-    }
-
-    // picks the last element from the lazyset L
-    strat->P = strat->L[strat->Ll];
-    strat->Ll--;
-
-    //kTest(strat);
-
-//    assume(pNext(strat->P.p) != strat->tail); // !???
-    if(strat->P.IsNull()) continue;
-
-
-    if( pNext(strat->P.p) == strat->tail )
-    {
-      // deletes the int spoly and computes SPoly
-      pLmFree(strat->P.p); // ???
-      strat->P.p = nc_CreateSpoly(strat->P.p1, strat->P.p2, currRing);
-    }
-
-    if(strat->P.IsNull()) continue;
-
-//     poly save = NULL;
-//
-//     if(pNext(strat->P.p) != NULL)
-//       save = p_Copy(strat->P.p, currRing);
-
-    strat->initEcart(&strat->P); // remove it?
-
-    if (TEST_OPT_PROT)
-      message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(), &olddeg,&reduc,strat, red_result);
-
-    // reduction of the element chosen from L wrt S
-    strat->red(&strat->P,strat);
-
-    if(strat->P.IsNull()) continue;
-
-    addLObject(strat->P, strat);
-
-    if (strat->sl > srmax) srmax = strat->sl;
-
-    const poly save = strat->P.p;
-
-#ifdef PDEBUG
-      p_Test(save, currRing);
-#endif
-    assume( save != NULL );
-
-    // SCA Specials:
-
-    {
-      const poly p_next = pNext(save);
-
-      if( p_next != NULL )
-      for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
-      if( p_GetExp(save, i, currRing) != 0 )
-      {
-        assume(p_GetExp(save, i, currRing) == 1);
-
-        const poly tt = sca_pp_Mult_xi_pp(i, p_next, currRing);
-
-#ifdef PDEBUG
-        p_Test(tt, currRing);
-#endif
-
-        if( tt == NULL) continue;
-
-        LObject h(tt); // h = x_i * P
-
-        if (TEST_OPT_INTSTRATEGY)
-        {
-//           h.pCleardenom(); // also does a p_Content
-          p_Content(h.p,currRing);
-        }
-        else
-        {
-          h.pNorm();
-        }
-
-        strat->initEcart(&h);
-
-
-//         if (pOrdSgn==-1)
-//         {
-//           cancelunit(&h);  // tries to cancel a unit
-//           deleteHC(&h, strat);
-//         }
-
-//         if(h.IsNull()) continue;
-
-//         if (TEST_OPT_PROT)
-//           message((strat->honey ? h.ecart : 0) + h.pFDeg(), &olddeg, &reduc, strat, red_result);
-
-//         strat->red(&h, strat); // wrt S
-//         if(h.IsNull()) continue;
-
-//         poly save = p_Copy(h.p, currRing);
-
-        int pos;
-
-        if (strat->Ll==-1)
-          pos =0;
-        else
-          pos = strat->posInL(strat->L,strat->Ll,&h,strat);
-
-        h.sev = pGetShortExpVector(h.p);
-        enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
-
-  //       h.p = save;
-  //       addLObject(h, strat);
-
-//         if (strat->sl > srmax) srmax = strat->sl;
-      }
-
-      // p_Delete( &save, currRing );
-    }
-
-
-  } // for(;;)
-
-
-#ifdef KDEBUG
-  if (TEST_OPT_DEBUG) messageSets(strat);
-#endif
-
-  if (TEST_OPT_REDSB){
-    completeReduce(strat); // ???
-  }
-
-  // release temp data--------------------------------
-  exitBuchMora(strat);
-
-  if (TEST_OPT_WEIGHTM)
-  {
-    pFDeg=pFDegOld;
-    pLDeg=pLDegOld;
-    if (ecartWeights)
-    {
-      omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(int));
-      ecartWeights=NULL;
-    }
-  }
-
-  if (TEST_OPT_PROT) messageStat(srmax,lrmax,hilbcount,strat);
-
-  if (tempQ!=NULL) updateResult(strat->Shdl,tempQ,strat);
-
-  id_Delete(&tempF, currRing);
-
-
-  // complete reduction of the standard basis---------
-  if (TEST_OPT_REDSB){
-    ideal I = strat->Shdl;
-    ideal erg = kInterRedOld(I,tempQ);
-    assume(I!=erg);
-    id_Delete(&I, currRing);
-    strat->Shdl = erg;
-  }
-
-
-#if MYTEST
-//   PrintS("</sca_gr_bba>\n");
-#endif
-
-  return (strat->Shdl);
-*/
-}
-
-
-
 // should be used only inside nc_SetupQuotient!
 // Check whether this our case:
@@ -1498,5 +1117,5 @@
     // NOTE: rSaveRing == currRing now!
     // NOTE: there is no better way to check this in general!
-
+    // 
 //////    TODO!!!!!
 //////    extern poly kNF(ideal I, ideal Q, poly f, int a, int b, const ring r);
@@ -1513,5 +1132,10 @@
 //  assureCurrentRing(rSaveRing);
 
-  if(!bSCA) return false;
+  if(!bSCA)
+  {
+    WarnS("sca_SetupQuotient: Sorry can not use NF: unfixed implementational issue :(");
+    return false;
+  }
+   
 
 
@@ -1625,893 +1249,4 @@
 }
 
-
-///////////////////////////////////////////////////////////////////////////////////////
-//************* SCA BBA *************************************************************//
-///////////////////////////////////////////////////////////////////////////////////////
-
-// Under development!!!
-ideal sca_bba (const ideal F, const ideal Q, const intvec *w, const intvec * /*hilb*/, kStrategy strat)
-{
-/*
-#if MYTEST
-  PrintS("\n\n<sca_bba>\n\n");
-#endif
-
-  assume(rIsSCA(currRing));
-
-#ifndef NDEBUG
-  idTest(F);
-  idTest(Q);
-#endif
-
-#if MYTEST
-  PrintS("\ncurrRing: \n");
-  rWrite(currRing);
-#ifdef RDEBUG
-//  rDebugPrint(currRing);
-#endif
-
-  PrintS("\n\nF: \n");
-  idPrint(F);
-  PrintS("\n\nQ: \n");
-  idPrint(Q);
-
-  PrintLn();
-#endif
-
-
-  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
-  const unsigned int m_iLastAltVar  = scaLastAltVar(currRing);
-
-  ideal tempF = id_KillSquares(F, m_iFirstAltVar, m_iLastAltVar, currRing);
-
-  ideal tempQ = Q;
-
-  if(Q == currQuotient)
-    tempQ = SCAQuotient(currRing);
-
-  // Q or tempQ will not be used below :(((
-
-
-#if MYTEST
-
-  PrintS("tempF: \n");
-  idPrint(tempF);
-  PrintS("tempQ: \n");
-  idPrint(tempQ);
-#endif
-
-  strat->z2homog = id_IsSCAHomogeneous(tempF, NULL, NULL, currRing); // wCx == wCy == NULL!
-   // redo no_prod_crit:
-  const BOOLEAN bIsSCA  = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
-  strat->no_prod_crit   = ! bIsSCA;
-
-//  strat->homog = strat->homog && strat->z2homog; // ?
-
-
-
-#ifdef KDEBUG
-  om_Opts.MinTrack = 5;
-#endif
-
-  int   srmax, lrmax, red_result = 1;
-  int   olddeg, reduc;
-
-//  int hilbeledeg = 1, minimcnt = 0;
-  int hilbcount = 0;
-
-  BOOLEAN withT = FALSE;
-
-  initBuchMoraCrit(strat); // sets Gebauer, honey, sugarCrit // sca - ok???
-  initBuchMoraPos(strat); // sets strat->posInL, strat->posInT // check!! (Plural's: )
-
-//   initHilbCrit(F, Q, &hilb, strat);
-
-//  nc_gr_initBba(F,strat);
-  initBba(tempF, strat); // set enterS, red, initEcart, initEcartPair
-
-  // set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair
-  // ?? set spSpolyShort, reduce ???
-  initBuchMora(tempF, tempQ, strat); // tempQ = Q without squares!!!
-
-//   if (strat->minim>0) strat->M = idInit(IDELEMS(F),F->rank);
-
-  srmax = strat->sl;
-  reduc = olddeg = lrmax = 0;
-
-#define NO_BUCKETS
-
-#ifndef NO_BUCKETS
-  if (!TEST_OPT_NOT_BUCKETS)
-    strat->use_buckets = 1;
-#endif
-
-  // redtailBBa against T for inhomogenous input
-  if (!TEST_OPT_OLDSTD)
-    withT = ! strat->homog;
-
-  // strat->posInT = posInT_pLength;
-  kTest_TS(strat);
-
-#undef HAVE_TAIL_RING
-
-#ifdef HAVE_TAIL_RING
-  if(!idIs0(F) &&(!rField_is_Ring()))  // create strong gcd poly computes with tailring and S[i] ->to be fixed
-    kStratInitChangeTailRing(strat);
-#endif
-  if (BVERBOSE(23))
-  {
-    if (test_PosInT!=NULL) strat->posInT=test_PosInT;
-    if (test_PosInL!=NULL) strat->posInL=test_PosInL;
-    kDebugPrint(strat);
-  }
-  
-
-  ///////////////////////////////////////////////////////////////
-  // SCA:
-
-  //  due to std( SB, p).
-  // Note that after initBuchMora :: initSSpecial all these additional
-  // elements are in S and T (and some pairs are in L, which also has no initiall
-  // elements!!!)
-  if(TEST_OPT_SB_1)
-  {
-    // For all additional elements...
-    for (int iNewElement = strat->newIdeal; iNewElement < IDELEMS(tempF); iNewElement++)
-    {
-      const poly pSave = tempF->m[iNewElement];
-
-      if( pSave != NULL )
-      {
-//        tempF->m[iNewElement] = NULL;
-
-        const poly p_next = pNext(pSave);
-
-        if(p_next != NULL)
-          for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
-            if( p_GetExp(pSave, i, currRing) != 0 )
-            {
-              assume(p_GetExp(pSave, i, currRing) == 1);
-
-              const poly p_new = sca_pp_Mult_xi_pp(i, p_next, currRing);
-
-#ifdef PDEBUG
-              p_Test(p_new, currRing);
-#endif
-
-              if( p_new == NULL) continue;
-
-              LObject h(p_new); // h = x_i * strat->P
-              h.is_special = TRUE;
-
-              if (TEST_OPT_INTSTRATEGY)
-                h.pCleardenom(); // also does a p_Content
-              else
-                h.pNorm();
-
-              strat->initEcart(&h);
-              h.sev = pGetShortExpVector(h.p);
-
-              int pos = 0;
-
-              if (strat->Ll != -1)
-                pos = strat->posInL(strat->L,strat->Ll,&h,strat);
-
-              enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
-            }
-      }
-    }
-  }
-
-  // compute-------------------------------------------------------
-  while (strat->Ll >= 0)
-  {
-    if (strat->Ll > lrmax) lrmax =strat->Ll;// stat.
-
-#ifdef KDEBUG
-//     loop_count++;
-    if (TEST_OPT_DEBUG) messageSets(strat);
-#endif
-
-    if (strat->Ll== 0) strat->interpt=TRUE;
-
-    if (TEST_OPT_DEGBOUND
-        && ((strat->honey && (strat->L[strat->Ll].ecart+pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
-            || ((!strat->honey) && (pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
-    {
-
-#ifdef KDEBUG
-//      if (TEST_OPT_DEBUG){PrintS("^^^^?");}
-#endif
-
-      // *stops computation if
-      // * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
-      // *a predefined number Kstd1_deg
-      while ((strat->Ll >= 0)
-        && ( (strat->homog==isHomog) || strat->L[strat->Ll].is_special || ((strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)) )
-        && ((strat->honey && (strat->L[strat->Ll].ecart+pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
-            || ((!strat->honey) && (pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
-            )
-      {
-#ifdef KDEBUG
-//        if (TEST_OPT_DEBUG){PrintS("^^^^^^^^^^^^!!!!");}
-#endif
-        deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
-//        if (TEST_OPT_PROT) PrintS("^!");
-      }
-      if (strat->Ll<0) break;
-      else strat->noClearS=TRUE;
-    }
-
-    // picks the last element from the lazyset L
-    strat->P = strat->L[strat->Ll];
-    strat->Ll--;
-
-
-//    assume(pNext(strat->P.p) != strat->tail);
-
-    if(strat->P.IsNull()) continue;
-
-    if (pNext(strat->P.p) == strat->tail)
-    {
-      // deletes the short spoly
-      pLmFree(strat->P.p);
-
-      strat->P.p = nc_CreateSpoly(strat->P.p1, strat->P.p2, currRing);
-      if (strat->P.p!=NULL) strat->initEcart(&strat->P);
-    }//    else
-
-
-    if(strat->P.IsNull()) continue;
-
-    if (strat->P.p1 == NULL)
-    {
-//       if (strat->minim > 0)
-//         strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
-
-
-      // for input polys, prepare reduction
-        strat->P.PrepareRed(strat->use_buckets);
-    }
-
-    if (TEST_OPT_PROT)
-      message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
-              &olddeg,&reduc,strat, red_result);
-
-    // reduction of the element choosen from L
-    red_result = strat->red(&strat->P,strat);
-
-
-    // reduction to non-zero new poly
-    if (red_result == 1)
-    {
-      // statistic
-      if (TEST_OPT_PROT) PrintS("s");
-
-      // get the polynomial (canonicalize bucket, make sure P.p is set)
-      strat->P.GetP(strat->lmBin);
-
-      int pos = posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
-
-      // reduce the tail and normalize poly
-      if (TEST_OPT_INTSTRATEGY)
-      {
-        strat->P.pCleardenom();
-        if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
-        {
-          strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT); // !!!
-          strat->P.pCleardenom();
-        }
-      }
-      else
-      {
-        strat->P.pNorm();
-        if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
-          strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
-      }
-      strat->P.is_normalized=nIsOne(pGetCoeff(strat->P.p));
-
-#ifdef KDEBUG
-      if (TEST_OPT_DEBUG){PrintS(" ns:");p_wrp(strat->P.p,currRing);PrintLn();}
-#endif
-
-//       // min_std stuff
-//       if ((strat->P.p1==NULL) && (strat->minim>0))
-//       {
-//         if (strat->minim==1)
-//         {
-//           strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
-//           p_Delete(&strat->P.p2, currRing, strat->tailRing);
-//         }
-//         else
-//         {
-//           strat->M->m[minimcnt]=strat->P.p2;
-//           strat->P.p2=NULL;
-//         }
-//         if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
-//           pNext(strat->M->m[minimcnt])
-//             = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
-//                                            strat->tailRing, currRing,
-//                                            currRing->PolyBin);
-//         minimcnt++;
-//       }
-
-      // enter into S, L, and T
-      //if(withT)
-        enterT(strat->P, strat);
-
-      // L
-      enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
-
-      // posInS only depends on the leading term
-      strat->enterS(strat->P, pos, strat, strat->tl);
-
-//       if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
-
-//      Print("[%d]",hilbeledeg);
-      if (strat->P.lcm!=NULL) pLmFree(strat->P.lcm);
-
-      if (strat->sl>srmax) srmax = strat->sl;
-
-      // //////////////////////////////////////////////////////////
-      // SCA:
-      const poly pSave = strat->P.p;
-      const poly p_next = pNext(pSave);
-
-//       if(0)
-      if( p_next != NULL )
-      for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
-      if( p_GetExp(pSave, i, currRing) != 0 )
-      {
-        assume(p_GetExp(pSave, i, currRing) == 1);
-        const poly p_new = sca_pp_Mult_xi_pp(i, p_next, currRing);
-
-#ifdef PDEBUG
-        p_Test(p_new, currRing);
-#endif
-
-        if( p_new == NULL) continue;
-
-        LObject h(p_new); // h = x_i * strat->P
-
-        h.is_special = TRUE;
-
-        if (TEST_OPT_INTSTRATEGY)
-        {
-//          p_Content(h.p);
-          h.pCleardenom(); // also does a p_Content
-        }
-        else
-        {
-          h.pNorm();
-        }
-
-        strat->initEcart(&h);
-        h.sev = pGetShortExpVector(h.p);
-
-        int pos = 0;
-
-        if (strat->Ll != -1)
-          pos = strat->posInL(strat->L,strat->Ll,&h,strat);
-
-        enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
-
- 
- 
- 
-#if 0   
-        h.sev = pGetShortExpVector(h.p);
-        strat->initEcart(&h);
-
-        h.PrepareRed(strat->use_buckets);
-
-        // reduction of the element choosen from L(?)
-        red_result = strat->red(&h,strat);
-
-        // reduction to non-zero new poly
-        if (red_result != 1) continue;
-
-
-        int pos = posInS(strat,strat->sl,h.p,h.ecart);
-
-        // reduce the tail and normalize poly
-        if (TEST_OPT_INTSTRATEGY)
-        {
-          h.pCleardenom();
-          if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
-          {
-            h.p = redtailBba(&(h),pos-1,strat, withT); // !!!
-            h.pCleardenom();
-          }
-        }
-        else
-        {
-          h.pNorm();
-          if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
-            h.p = redtailBba(&(h),pos-1,strat, withT);
-        }
-
-#ifdef KDEBUG
-        if (TEST_OPT_DEBUG){PrintS(" N:");h.wrp();PrintLn();}
-#endif
-
-//        h.PrepareRed(strat->use_buckets); // ???
-
-        h.sev = pGetShortExpVector(h.p);
-        strat->initEcart(&h);
-
-        if (strat->Ll==-1)
-          pos = 0;
-        else
-          pos = strat->posInL(strat->L,strat->Ll,&h,strat);
-
-         enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
-// the end of "#if 0" (comment) 
-#endif 
-
-      } // for all x_i \in Ann(lm(P))
-    } // if red(P) != NULL
-
-//     else if (strat->P.p1 == NULL && strat->minim > 0)
-//     {
-//       p_Delete(&strat->P.p2, currRing, strat->tailRing);
-//     }
-
-#ifdef KDEBUG
-//    memset(&(strat->P), 0, sizeof(strat->P));
-#endif
-
-    kTest_TS(strat); // even of T is not used!
-
-//     Print("\n$\n");
-
-  }
-
-#ifdef KDEBUG
-  if (TEST_OPT_DEBUG) messageSets(strat);
-#endif
-
-  // complete reduction of the standard basis---------
-
-  if (TEST_OPT_REDSB)
-  {
-    completeReduce(strat);
-  }
-
-  //release temp data--------------------------------
-
-  exitBuchMora(strat); // cleanT!
-
-  id_Delete(&tempF, currRing);
-
-  if (TEST_OPT_WEIGHTM)
-  {
-    pRestoreDegProcs(pFDegOld, pLDegOld);
-    if (ecartWeights)
-    {
-      omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
-      ecartWeights=NULL;
-    }
-  }
-
-  if (TEST_OPT_PROT) messageStat(srmax,lrmax,hilbcount,strat);
-
-
-
-  if (tempQ!=NULL) updateResult(strat->Shdl,tempQ,strat);
-
-
-  if (TEST_OPT_REDSB) // ???
-  {
-    // must be at the very end (after exitBuchMora) as it changes the S set!!!
-    ideal I = strat->Shdl;
-    ideal erg = kInterRedOld(I,tempQ);
-    assume(I!=erg);
-    id_Delete(&I, currRing);
-    strat->Shdl = erg;
-  }
-
-#if MYTEST
-  PrintS("\n\n</sca_bba>\n\n");
-#endif
-
-  return (strat->Shdl);
-*/
-}
-
-// //////////////////////////////////////////////////////////////////////////////
-// sca mora...
-
-/*
-// returns TRUE if mora should use buckets, false otherwise
-static BOOLEAN kMoraUseBucket(kStrategy strat)
-{
-#ifdef MORA_USE_BUCKETS
-  if (TEST_OPT_NOT_BUCKETS)
-    return FALSE;
-  if (strat->red == redFirst)
-  {
-#ifdef NO_LDEG
-    if (!strat->syzComp)
-      return TRUE;
-#else
-    if ((strat->homog || strat->honey) && !strat->syzComp)
-      return TRUE;
-#endif
-  }
-  else
-  {
-    assume(strat->red == redEcart);
-    if (strat->honey && !strat->syzComp)
-      return TRUE;
-  }
-#endif
-  return FALSE;
-}
-*/
-
-#ifdef HAVE_ASSUME
-static int sca_mora_count = 0;
-static int sca_mora_loop_count;
-#endif
-
-// ideal sca_mora (ideal F, ideal Q, intvec *w, intvec *, kStrategy strat)
-ideal sca_mora(const ideal F, const ideal Q, const intvec *w, const intvec *, kStrategy strat, const ring _currRing)
-{
-/*
-  assume(rIsSCA(currRing));
-
-  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
-  const unsigned int m_iLastAltVar  = scaLastAltVar(currRing);
-
-  ideal tempF = id_KillSquares(F, m_iFirstAltVar, m_iLastAltVar, currRing);
-
-  ideal tempQ = Q;
-
-  if(Q == currQuotient)
-    tempQ = SCAQuotient(currRing);
-
-  bool bIdHomog = id_IsSCAHomogeneous(tempF, NULL, NULL, currRing); // wCx == wCy == NULL!
-
-  assume( !bIdHomog || strat->homog ); //  bIdHomog =====[implies]>>>>> strat->homog
-
-  strat->homog = strat->homog && bIdHomog;
-
-#ifdef PDEBUG
-  assume( strat->homog == bIdHomog );
-#endif 
-
-#ifdef HAVE_ASSUME
-  sca_mora_count++;
-  sca_mora_loop_count = 0;
-#endif
-
-#ifdef KDEBUG
-  om_Opts.MinTrack = 5;
-#endif
-
-
-  strat->update = TRUE;
-  //- setting global variables ------------------- -
-  initBuchMoraCrit(strat);
-//   initHilbCrit(F,NULL,&hilb,strat); // no Q!
-  initMora(tempF, strat);
-  initBuchMoraPos(strat);
-  //Shdl=
-    initBuchMora(tempF, tempQ, strat); // temp Q, F!
-//   if (TEST_OPT_FASTHC) missingAxis(&strat->lastAxis,strat);
-  // updateS in initBuchMora has Hecketest
-  // * and could have put strat->kHEdgdeFound FALSE
-#if 0
-  if (ppNoether!=NULL)
-  {
-    strat->kHEdgeFound = TRUE;
-  }
-  if (strat->kHEdgeFound && strat->update)
-  {
-    firstUpdate(strat);
-    updateLHC(strat);
-    reorderL(strat);
-  }
-  if (TEST_OPT_FASTHC && (strat->lastAxis) && strat->posInLOldFlag)
-  {
-    strat->posInLOld = strat->posInL;
-    strat->posInLOldFlag = FALSE;
-    strat->posInL = posInL10;
-    updateL(strat);
-    reorderL(strat);
-  }
-#endif
-  strat->use_buckets = kMoraUseBucket(strat);
-
-  kTest_TS(strat);
-
-
-  int srmax = strat->sl;
-  int lrmax = strat->Ll;
-  int olddeg = 0;
-  int reduc = 0;
-  int red_result = 1;
-//  int hilbeledeg=1;
-  int hilbcount=0;
-
-
-  //- compute-------------------------------------------
-
-#undef HAVE_TAIL_RING
-
-#ifdef HAVE_TAIL_RING
-//  if (strat->homog && strat->red == redFirst)
-//     kStratInitChangeTailRing(strat);
-#endif
-
-
-
-
-
-//  due to std( SB, p)
-  if(TEST_OPT_SB_1)
-  {
-    for (int iNewElement = strat->newIdeal; iNewElement < IDELEMS(tempF); iNewElement++)
-    {
-
-      const poly pSave = tempF->m[iNewElement];
-
-      if( pSave != NULL )
-      {
-//        tempF->m[iNewElement] = NULL;
-
-        const poly p_next = pNext(pSave);
-
-        if(p_next != NULL)
-          for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
-            if( p_GetExp(pSave, i, currRing) != 0 )
-            {
-
-              assume(p_GetExp(pSave, i, currRing) == 1);
-
-              const poly p_new = sca_pp_Mult_xi_pp(i, p_next, currRing);
-
-#ifdef PDEBUG
-              p_Test(p_new, currRing);
-#endif
-
-              if( p_new == NULL) continue;
-
-              LObject h(p_new); // h = x_i * strat->P
-
-              if (TEST_OPT_INTSTRATEGY)
-                h.pCleardenom(); // also does a p_Content
-              else
-                h.pNorm();
-
-              strat->initEcart(&h);
-              h.sev = pGetShortExpVector(h.p);
-
-              int pos = 0;
-
-              if (strat->Ll != -1)
-                pos = strat->posInL(strat->L,strat->Ll,&h,strat);
-
-              enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
-
-              if (strat->Ll>lrmax) lrmax = strat->Ll;
-            }
-      }
-
-    }
-  }
-
-
-
-
-  while (strat->Ll >= 0)
-  {
-#ifdef HAVE_ASSUME
-    sca_mora_loop_count++;
-#endif
-    if (lrmax< strat->Ll) lrmax=strat->Ll; // stat
-    //test_int_std(strat->kIdeal);
-#ifdef KDEBUG
-    if (TEST_OPT_DEBUG) messageSets(strat);
-#endif
-    if (TEST_OPT_DEGBOUND
-    && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg))
-    {
-      // * stops computation if
-      // * - 24 (degBound)
-      // *   && upper degree is bigger than Kstd1_deg
-      while ((strat->Ll >= 0)
-        && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
-        && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg)
-      )
-      {
-        deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
-        //if (TEST_OPT_PROT)
-        //{
-        //   PrintS("D"); mflush();
-        //}
-      }
-      if (strat->Ll<0) break;
-      else strat->noClearS=TRUE;
-    }
-    strat->P = strat->L[strat->Ll];// - picks the last element from the lazyset L -
-    if (strat->Ll==0) strat->interpt=TRUE;
-    strat->Ll--;
-
-    // create the real Spoly
-//    assume(pNext(strat->P.p) != strat->tail);
-
-    if(strat->P.IsNull()) continue;
-
-
-    if( pNext(strat->P.p) == strat->tail )
-    {
-      // deletes the int spoly and computes SPoly
-      pLmFree(strat->P.p); // ???
-      strat->P.p = nc_CreateSpoly(strat->P.p1, strat->P.p2, currRing);
-    }
-
-
-
-    if (strat->P.p1 == NULL)
-    {
-      // for input polys, prepare reduction (buckets !)
-      strat->P.SetLength(strat->length_pLength);
-      strat->P.PrepareRed(strat->use_buckets);
-    }
-
-    if (!strat->P.IsNull())
-    {
-      // might be NULL from noether !!!
-      if (TEST_OPT_PROT)
-        message(strat->P.ecart+strat->P.GetpFDeg(),&olddeg,&reduc,strat, red_result);
-      // reduce
-      red_result = strat->red(&strat->P,strat);
-    }
-
-    if (! strat->P.IsNull())
-    {
-      strat->P.GetP();
-      // statistics
-      if (TEST_OPT_PROT) PrintS("s");
-      // normalization
-      if (!TEST_OPT_INTSTRATEGY)
-        strat->P.pNorm();
-      // tailreduction
-      strat->P.p = redtail(&(strat->P),strat->sl,strat);
-      // set ecart -- might have changed because of tail reductions
-      if ((!strat->noTailReduction) && (!strat->honey))
-        strat->initEcart(&strat->P);
-      // cancel unit
-      cancelunit(&strat->P);
-      // for char 0, clear denominators
-      if (TEST_OPT_INTSTRATEGY)
-        strat->P.pCleardenom();
-
-      // put in T
-      enterT(strat->P,strat);
-      // build new pairs
-      enterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat, strat->tl);
-      // put in S
-      strat->enterS(strat->P,
-                    posInS(strat,strat->sl,strat->P.p, strat->P.ecart),
-                    strat, strat->tl);
-
-
-      // clear strat->P
-      if (strat->P.lcm!=NULL) pLmFree(strat->P.lcm);
-      strat->P.lcm=NULL;
-
-      if (strat->sl>srmax) srmax = strat->sl; // stat.
-      if (strat->Ll>lrmax) lrmax = strat->Ll;
-
-
-
-      // //////////////////////////////////////////////////////////
-      // SCA:
-      const poly pSave = strat->P.p;
-      const poly p_next = pNext(pSave);
-
-      if(p_next != NULL)
-      for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
-      if( p_GetExp(pSave, i, currRing) != 0 )
-      {
-
-        assume(p_GetExp(pSave, i, currRing) == 1);
-
-        const poly p_new = sca_pp_Mult_xi_pp(i, p_next, currRing);
-
-#ifdef PDEBUG
-        p_Test(p_new, currRing);
-#endif
-
-        if( p_new == NULL) continue;
-
-        LObject h(p_new); // h = x_i * strat->P
-
-        if (TEST_OPT_INTSTRATEGY)
-           h.pCleardenom(); // also does a p_Content
-        else
-          h.pNorm();
-
-        strat->initEcart(&h);
-        h.sev = pGetShortExpVector(h.p);
-
-        int pos = 0;
-
-        if (strat->Ll != -1)
-          pos = strat->posInL(strat->L,strat->Ll,&h,strat);
-
-        enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
-
-        if (strat->Ll>lrmax) lrmax = strat->Ll;
-      }
-
-#ifdef KDEBUG
-      // make sure kTest_TS does not complain about strat->P
-      memset(&strat->P,0,sizeof(strat->P));
-#endif
-    }
-#if 0
-    if (strat->kHEdgeFound)
-    {
-      if ((TEST_OPT_FINDET)
-      || ((TEST_OPT_MULTBOUND) && (scMult0Int((strat->Shdl)) < mu)))
-      {
-        // obachman: is this still used ???
-        // * stops computation if strat->kHEdgeFound and
-        // * - 27 (finiteDeterminacyTest)
-        // * or
-        // * - 23
-        // *   (multBound)
-        // *   && multiplicity of the ideal is smaller then a predefined number mu
-        while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
-      }
-    }
-#endif
-    kTest_TS(strat);
-  }
-  // - complete reduction of the standard basis------------------------ -
-  if (TEST_OPT_REDSB) completeReduce(strat);
-  // - release temp data------------------------------- -
-  exitBuchMora(strat);
-  // - polynomials used for HECKE: HC, noether -
-  if (TEST_OPT_FINDET)
-  {
-    if (strat->kHEdge!=NULL)
-      Kstd1_mu=pFDeg(strat->kHEdge,currRing);
-    else
-      Kstd1_mu=-1;
-  }
-  pDelete(&strat->kHEdge);
-  strat->update = TRUE; //???
-  strat->lastAxis = 0; //???
-  pDelete(&strat->kNoether);
-  omFreeSize((ADDRESS)strat->NotUsedAxis,(pVariables+1)*sizeof(BOOLEAN));
-  if (TEST_OPT_PROT) messageStat(srmax,lrmax,hilbcount,strat);
-  if (TEST_OPT_WEIGHTM)
-  {
-    pRestoreDegProcs(pFDegOld, pLDegOld);
-    if (ecartWeights)
-    {
-      omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
-      ecartWeights=NULL;
-    }
-  }
-  if (tempQ!=NULL) updateResult(strat->Shdl,tempQ,strat);
-  idTest(strat->Shdl);
-
-  id_Delete( &tempF, currRing);
-
-  return (strat->Shdl);
-*/
-}
-
-
-
-
-
-
 void sca_p_ProcsSet(ring rGR, p_Procs_s* p_Procs)
 {
@@ -2528,25 +1263,4 @@
   rGR->GetNC()->p_Procs.mm_Mult_pp  = sca_mm_Mult_pp;
 
-
-  if (rHasLocalOrMixedOrdering(rGR))
-  {
-#ifdef PDEBUG
-//           Print("Local case => GB == mora!\n");
-#endif
-    rGR->GetNC()->p_Procs.GB          = NULL; // sca_mora; // local ordering => Mora, otherwise - Buchberger!
-  }
-  else
-  {
-#ifdef PDEBUG
-//           Print("Global case => GB == bba!\n");
-#endif
-    rGR->GetNC()->p_Procs.GB          = NULL; // sca_bba; // sca_gr_bba; // sca_bba? // sca_bba;
-  }
-
-
-//   rGR->GetNC()->p_Procs.GlobalGB    = sca_gr_bba;
-//   rGR->GetNC()->p_Procs.LocalGB     = sca_mora;
-
-
 //   rGR->GetNC()->p_Procs.SPoly         = sca_SPoly;
 //   rGR->GetNC()->p_Procs.ReduceSPoly   = sca_ReduceSpoly;
@@ -2565,5 +1279,4 @@
         r->GetNC()->mmMultPP()    = sca_mm_Mult_pp;
 
-        r->GetNC()->GB()            = sca_gr_bba;
 /*
         // ??????????????????????????????????????? coefficients swell...
@@ -2573,5 +1286,4 @@
 //         r->GetNC()->BucketPolyRed() = gnc_kBucketPolyRed;
 //         r->GetNC()->BucketPolyRed_Z()= gnc_kBucketPolyRed_Z;
-
 #endif
 }
