Index: kernel/sca.cc
===================================================================
--- kernel/sca.cc	(revision 6f49c34b8c235506ef7d34be2d0cd7b9ed4f708d)
+++ kernel/sca.cc	(revision b1a5c1b38182f45945fe83e5d4528646815a09e2)
@@ -7,5 +7,5 @@
  *  Author:  motsak (Oleksandr Motsak)
  *  Created: 2006/12/18
- *  Version: $Id: sca.cc,v 1.18 2008-06-20 12:28:17 Singular Exp $
+ *  Version: $Id: sca.cc,v 1.19 2008-06-20 16:54:45 Singular Exp $
  *******************************************************************/
 
@@ -388,5 +388,5 @@
       if(iComponentMonomM==0 )
       {
-        WarnS("sca_p_Mult_mm: Multiplication in the left module from the right");
+        dReportError("sca_p_Mult_mm: Multiplication in the left module from the right");
       }
 #endif
@@ -470,5 +470,5 @@
       if(iComponentMonomM==0 )
       {
-        WarnS("sca_pp_Mult_mm: Multiplication in the left module from the right");
+        dReportError("sca_pp_Mult_mm: Multiplication in the left module from the right");
       }
 #endif
@@ -580,8 +580,8 @@
       if(iComponent==0 )
       {
-        WarnS("sca_mm_Mult_pp: Multiplication in the left module from the right!");
+        dReportError("sca_mm_Mult_pp: Multiplication in the left module from the right!");
 //        PrintS("mm = "); p_Write(pMonom, rRing);
 //        PrintS("pp = "); p_Write(pPoly, rRing);
-//        assume(iComponent!=0);        
+//        assume(iComponent!=0);
       }
 #endif
@@ -644,5 +644,5 @@
     if( iComponentMonomM!=0 )
     {
-      if( iComponent!=0 ) 
+      if( iComponent!=0 )
       {
         // REPORT_ERROR
@@ -656,8 +656,8 @@
       if(iComponent==0)
       {
-        WarnS("sca_mm_Mult_p: Multiplication in the left module from the right!");
+        dReportError("sca_mm_Mult_p: Multiplication in the left module from the right!");
 //        PrintS("mm = "); p_Write(pMonom, rRing);
 //        PrintS("p = "); p_Write(pPoly, rRing);
-//        assume(iComponent!=0);        
+//        assume(iComponent!=0);
       }
 #endif
@@ -725,5 +725,5 @@
   {
 #ifdef PDEBUG
-    Print("sca_SPoly: different non-zero components!\n");
+    dReportError("sca_SPoly: different non-zero components!\n");
 #endif
     return(NULL);
@@ -815,5 +815,5 @@
   {
 #ifdef PDEBUG
-    Print("sca_ReduceSpoly: different non-zero components!");
+    dReportError("sca_ReduceSpoly: different non-zero components!");
 #endif
     return(NULL);
@@ -921,4 +921,5 @@
     }
 
+#ifdef KDEBUG
     if (TEST_OPT_DEBUG)
     {
@@ -927,4 +928,5 @@
       PrintLn();
     }
+#endif
 
     enterpairs(h.p, strat->sl, h.ecart, 0, strat);
@@ -978,11 +980,11 @@
 
   PrintS("F: \n");
-  idPrint(F);  
-  PrintS("Q: \n");  
+  idPrint(F);
+  PrintS("Q: \n");
   idPrint(Q);
 #endif
 #endif
 
-  
+
   const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
   const unsigned int m_iLastAltVar  = scaLastAltVar(currRing);
@@ -1044,5 +1046,7 @@
     if (strat->Ll > lrmax) lrmax =strat->Ll;/*stat.*/
 
+#ifdef KDEBUG
     if (TEST_OPT_DEBUG) messageSets(strat);
+#endif
 
     if (strat->Ll== 0) strat->interpt=TRUE;
@@ -1071,5 +1075,5 @@
     if(strat->P.IsNull()) continue;
 
-    
+
     if( pNext(strat->P.p) == strat->tail )
     {
@@ -1180,5 +1184,7 @@
 
 
+#ifdef KDEBUG
   if (TEST_OPT_DEBUG) messageSets(strat);
+#endif
 
   /* release temp data-------------------------------- */
@@ -1239,5 +1245,5 @@
   // checks...
   //////////////////////////////////////////////////////////////////////////
-  if( rG == NULL ) 
+  if( rG == NULL )
     rG = rGR;
 
@@ -1245,5 +1251,5 @@
   assume(rG  != NULL);
   assume(rIsPluralRing(rG));
-  
+
 
 #if MYTEST
@@ -1256,5 +1262,5 @@
     return false;
 
-  
+
 //  if( (ncRingType(rG) != nc_skew) || (ncRingType(rG) != nc_comm) )
 //    return false;
@@ -1270,5 +1276,5 @@
   PrintS("sca_SetupQuotient: qideal!!!\n");
 #endif
-  
+
   if((rG->qideal != NULL) && (rG != rGR) ) // we cannot change from factor to factor at the time, sorry!
     return false;
@@ -1284,5 +1290,5 @@
   PrintS("sca_SetupQuotient: AltVars?!\n");
 #endif
-  
+
   for(int i = 1; i < N; i++)
   {
@@ -1319,9 +1325,9 @@
 #endif
 
-  
+
   if( (iAltVarEnd == -1) || (iAltVarStart == (N+1)) )
     return false; // either no alternating varables, or a single one => we are in commutative case!
 
-  
+
   for(int i = 1; i < N; i++)
   {
@@ -1384,5 +1390,5 @@
   }
 
-  
+
   assume(rGR->qideal != NULL);
 //  assume(rG->qideal == NULL); // ?
@@ -1396,5 +1402,5 @@
 #endif
 
-  
+
   // check for
   // y_{iAltVarStart}^2, y_{iAltVarStart+1}^2, \ldots, y_{iAltVarEnd}^2  (iAltVarEnd > iAltVarStart)
@@ -1435,5 +1441,5 @@
 #endif
 #endif
-  
+
 
   //////////////////////////////////////////////////////////////////////////
@@ -1466,5 +1472,5 @@
   assume(rIsPluralRing(rGR));
   assume(!rIsSCA(rGR));
-  
+
   const int N = rGR->N;
 
@@ -1476,9 +1482,9 @@
   const ideal idQuotient = rGR->qideal;
 
-  
+
   ideal tempQ = idQuotient;
 
   if( b <= N && e >= 1 )
-    tempQ = id_KillSquares(idQuotient, b, e, rGR); 
+    tempQ = id_KillSquares(idQuotient, b, e, rGR);
 
   idSkipZeroes( tempQ );
@@ -1488,5 +1494,5 @@
   else
     rGR->GetNC()->SCAQuotient() = tempQ;
-  
+
   ncRingType( rGR, nc_exterior );
 
@@ -1499,7 +1505,7 @@
   if(rSaveRing != rGR)
     rChangeCurrRing(rSaveRing);
-  
+
   return true;
-  
+
 }
 
@@ -1658,9 +1664,10 @@
 
       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)
     {
@@ -1764,94 +1771,86 @@
       {
         assume(p_GetExp(pSave, i, currRing) == 1);
-
-        const poly pNew = sca_pp_Mult_xi_pp(i, pNext, currRing);
-
-#ifdef PDEBUG
-        p_Test(pNew, currRing);
-#endif
-
-        if( pNew == NULL) continue;
-
-        LObject h(pNew); // h = x_i * strat->P
-
-        if (TEST_OPT_INTSTRATEGY)
+        if (pNext!=NULL)
         {
-//           h.pCleardenom(); // also does a pContent
-          pContent(h.p);
+          const poly pNew = sca_pp_Mult_xi_pp(i, pNext, currRing);
+
+#ifdef PDEBUG
+          p_Test(pNew, currRing);
+#endif
+
+          if( pNew == NULL) continue;
+
+          LObject h(pNew); // h = x_i * strat->P
+
+          if (TEST_OPT_INTSTRATEGY)
+          {
+//            h.pCleardenom(); // also does a pContent
+            pContent(h.p);
+          }
+          else
+          {
+            h.pNorm();
+          }
+
+          strat->initEcart(&h);
+          h.sev = pGetShortExpVector(h.p);
+
+          int pos;
+          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);
+/*
+          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);*/
+
         }
-        else
-        {
-          h.pNorm();
-        }
-
-        strat->initEcart(&h);
-        h.sev = pGetShortExpVector(h.p);
-
-        int pos;
-
-        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);
-
-
-/*
-        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);*/
-
       } // for all x_i \in Ann(lm(P))
-
-
-
-
-
     } // if red(P) != NULL
 
@@ -1896,5 +1895,4 @@
 
 //   if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
-
 //    PrintS("</sca>\n");
 
@@ -2031,5 +2029,7 @@
     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))
@@ -2070,6 +2070,6 @@
       strat->P.p = nc_CreateSpoly(strat->P.p1, strat->P.p2, currRing);
     }
-    
-    
+
+
 
     if (strat->P.p1 == NULL)
@@ -2550,5 +2550,5 @@
 
   assume( (iFirstAltVar >= 1) && (iLastAltVar <= r->N) && (iFirstAltVar <= iLastAltVar) );
-  
+
   const int iSize = id->idelems();
 
