Index: libpolys/misc/sy_bit.h
===================================================================
--- libpolys/misc/sy_bit.h	(revision 351a5f98b6806d2385238578e737147580dc23de)
+++ libpolys/misc/sy_bit.h	(revision 351a5f98b6806d2385238578e737147580dc23de)
@@ -0,0 +1,12 @@
+#ifndef SY_BIT_H
+#define SY_BIT_H
+/*
+ * **  Set operations (small sets only)
+ * */
+
+#define Sy_bit(x)     ((unsigned)1<<(x))
+#define Sy_inset(x,s) ((Sy_bit(x)&(s))?TRUE:FALSE)
+#define BTEST1(a)     Sy_inset((a), test)
+#define BVERBOSE(a)   Sy_inset((a), verbose)
+
+#endif
Index: libpolys/polys/monomials/ring.cc
===================================================================
--- libpolys/polys/monomials/ring.cc	(revision 56790491568061b8fda62ac136d56bb3bca12583)
+++ libpolys/polys/monomials/ring.cc	(revision 351a5f98b6806d2385238578e737147580dc23de)
@@ -13,5 +13,7 @@
 // #include <polys/options.h>
 #include <omalloc/omalloc.h>
-#include <polys/polys.h>
+#include <misc/sy_bit.h>
+#include <polys/monomials/ring.h>
+#include <polys/monomials/p_polys.h>
 #include <coeffs/numbers.h>
 // #include <???/febase.h>
@@ -38,5 +40,5 @@
 #define BITS_PER_LONG 8*SIZEOF_LONG
 
-omBin sip_sring_bin = omGetSpecBin(sizeof(sip_sring));
+omBin sip_sring_bin = omGetSpecBin(sizeof(ip_sring));
 
 static const char * const ringorder_name[] =
@@ -102,6 +104,6 @@
  // }
   /*------------ set global ring vars --------------------------------*/
-  currRing = r;
-  currQuotient=NULL;
+  //currRing = r;
+  //currQuotient=NULL;
   if (r != NULL)
   {
@@ -111,8 +113,8 @@
 
     /*------------ global variables related to coefficients ------------*/
-    nSetChar(r);
+    nSetChar(r->cf);
 
     /*------------ global variables related to polys -------------------*/
-    pSetGlobals(r);
+    p_SetGlobals(r);
     /*------------ global variables related to factory -------------------*/
 #ifdef HAVE_FACTORY
@@ -138,5 +140,5 @@
   }
   /*weights: entries for 2 blocks: NULL*/
-  r->wvhdl = (int **)omAlloc0((ord_size+1) * sizeof(int_ptr));
+  r->wvhdl = (int **)omAlloc0((ord_size+1) * sizeof(int *));
   r->order = ord;
   r->block0 = block0;
@@ -250,5 +252,5 @@
   omCheckAddrSize(r->block0,nblocks*sizeof(int));
   omCheckAddrSize(r->block1,nblocks*sizeof(int));
-  omCheckAddrSize(r->wvhdl,nblocks*sizeof(int_ptr));
+  omCheckAddrSize(r->wvhdl,nblocks*sizeof(int *));
   omCheckAddrSize(r->names,r->N*sizeof(char_ptr));
 
@@ -260,9 +262,6 @@
     Print("//   # ground field : %d\n",rInternalChar(r));
     Print("//   primitive element : %s\n", r->parameter[0]);
-    if (r==currRing)
-    {
-      StringSetS("//   minpoly        : ");
-      nfShowMipo();PrintS(StringAppendS("\n"));
-    }
+    StringSetS("//   minpoly        : ");
+    nfShowMipo();PrintS(StringAppendS("\n"));
   }
 #ifdef HAVE_RINGS
@@ -313,16 +312,11 @@
         PrintS("0\n");
       }
-      else if (r==currRing)
-      {
-        StringSetS(""); nWrite(r->minpoly); PrintS(StringAppendS("\n"));
-      }
       else
       {
-        PrintS("...\n");
+        StringSetS(""); n_Write(r->minpoly,r->cf); PrintS(StringAppendS("\n"));
       }
       if (r->minideal!=NULL)
       {
-        if (r==currRing) iiWriteMatrix((matrix)r->minideal,"//   minpolys",1,0);
-        else PrintS("//   minpolys=...");
+        iiWriteMatrix((matrix)r->minideal,"//   minpolys",1,0);
         PrintLn();
       }
@@ -448,11 +442,6 @@
   if (r->qideal!=NULL)
   {
-    PrintS("\n// quotient ring from ideal");
-    if (r==currRing)
-    {
-      PrintLn();
-      iiWriteMatrix((matrix)r->qideal,"_",1);
-    }
-    else PrintS(" ...");
+    PrintS("\n// quotient ring from ideal\n");
+    iiWriteMatrix((matrix)r->qideal,"_",1);
   }
 }
@@ -1182,5 +1171,5 @@
     tmpR.block0=(int*)omAlloc0(4*sizeof(int));
     tmpR.block1=(int*)omAlloc0(4*sizeof(int));
-    tmpR.wvhdl=(int**)omAlloc0(4*sizeof(int_ptr));
+    tmpR.wvhdl=(int**)omAlloc0(4*sizeof(int *));
     tmpR.order[0]=ringorder_dp;
     tmpR.block0[0]=1;
@@ -1220,5 +1209,5 @@
       tmpR.block0=(int*)omAlloc(3*sizeof(int));
       tmpR.block1=(int*)omAlloc(3*sizeof(int));
-      tmpR.wvhdl=(int**)omAlloc0(3*sizeof(int_ptr));
+      tmpR.wvhdl=(int**)omAlloc0(3*sizeof(int *));
       tmpR.order[0]=ringorder_unspec;
       tmpR.order[1]=ringorder_C;
@@ -1253,5 +1242,5 @@
       tmpR.block0=(int*)omAlloc0(b*sizeof(int));
       tmpR.block1=(int*)omAlloc0(b*sizeof(int));
-      tmpR.wvhdl=(int**)omAlloc0(b*sizeof(int_ptr));
+      tmpR.wvhdl=(int**)omAlloc0(b*sizeof(int *));
       /* weights not implemented yet ...*/
       if (rb!=NULL)
@@ -1313,5 +1302,5 @@
       tmpR.block0=(int*)omAlloc0(b*sizeof(int));
       tmpR.block1=(int*)omAlloc0(b*sizeof(int));
-      tmpR.wvhdl=(int**)omAlloc0(b*sizeof(int_ptr));
+      tmpR.wvhdl=(int**)omAlloc0(b*sizeof(int *));
       /* weights not implemented yet ...*/
       for (i=0;i<b;i++)
@@ -1671,5 +1660,5 @@
   {
     i=rBlocks(r);
-    res->wvhdl   = (int **)omAlloc(i * sizeof(int_ptr));
+    res->wvhdl   = (int **)omAlloc(i * sizeof(int *));
     res->order   = (int *) omAlloc(i * sizeof(int));
     res->block0  = (int *) omAlloc(i * sizeof(int));
@@ -2066,5 +2055,5 @@
 
 // return TRUE if p->exp[r->pOrdIndex] holds a weighted degree of p */
-BOOLEAN rOrd_is_WeightedDegree_Ordering(ring r =currRing)
+BOOLEAN rOrd_is_WeightedDegree_Ordering(ring r )
 {
   // Hmm.... what about Syz orderings?
@@ -2742,5 +2731,5 @@
   int *block0=(int*)omAlloc0((nblocks+1)*sizeof(int));
   int *block1=(int*)omAlloc0((nblocks+1)*sizeof(int));
-  int **wvhdl=(int**)omAlloc0((nblocks+1)*sizeof(int_ptr));
+  int **wvhdl=(int**)omAlloc0((nblocks+1)*sizeof(int *));
 
   int i=0;
@@ -2871,5 +2860,5 @@
     omFreeSize(block0,(nblocks+1)*sizeof(int));
     omFreeSize(block1,(nblocks+1)*sizeof(int));
-    omFreeSize(wvhdl,(nblocks+1)*sizeof(int_ptr));
+    omFreeSize(wvhdl,(nblocks+1)*sizeof(int *));
     return r;
   }
@@ -2984,5 +2973,5 @@
 
   /*weights: entries for 3 blocks: NULL*/
-  res->wvhdl = (int **)omAlloc0(3 * sizeof(int_ptr));
+  res->wvhdl = (int **)omAlloc0(3 * sizeof(int *));
   /*order: Wp,C,0*/
   res->order = (int *) omAlloc(3 * sizeof(int *));
@@ -3041,5 +3030,5 @@
     int *block0=(int*)omAlloc0((nblocks+1)*sizeof(int));
     int *block1=(int*)omAlloc0((nblocks+1)*sizeof(int));
-    int **wvhdl=(int**)omAlloc0((nblocks+1)*sizeof(int_ptr));
+    int **wvhdl=(int**)omAlloc0((nblocks+1)*sizeof(int *));
 
     order[0]=ringorder_lp;
@@ -4231,8 +4220,4 @@
 }
 
-void pDebugPrint(poly p)
-{
-  p_DebugPrint(p, currRing);
-}
 #endif // RDEBUG
 
@@ -4288,5 +4273,5 @@
 //    F = system("ISUpdateComponents", F, V, MIN );
 //    // replace gen(i) -> gen(MIN + V[i-MIN]) for all i > MIN in all terms from F!
-void pISUpdateComponents(ideal F, const intvec *const V, const int MIN, const ring r = currRing)
+void pISUpdateComponents(ideal F, const intvec *const V, const int MIN, const ring r )
 {
   assume( V != NULL );
@@ -4589,5 +4574,5 @@
   ring new_r = rCopy0(r, FALSE, FALSE);
   i+=2;
-  new_r->wvhdl=(int **)omAlloc0(i * sizeof(int_ptr));
+  new_r->wvhdl=(int **)omAlloc0(i * sizeof(int *));
   new_r->order   = (int *) omAlloc0(i * sizeof(int));
   new_r->block0   = (int *) omAlloc0(i * sizeof(int));
@@ -4981,5 +4966,5 @@
 /// We will use it AS IS!
 /// returns true is everything was allright!
-bool rSetISReference(const ideal F, const int i = 0, const int p = 0, const intvec * componentWeights = NULL, const ring r = currRing)
+bool rSetISReference(const ideal F, const ring r,const int i = 0, const int p = 0, const intvec * componentWeights = NULL)
 {
   // Put the reference set F into the ring -ordering -recor
@@ -5189,7 +5174,7 @@
   #ifdef HAVE_RINGS
    if (rField_is_Ring_Z(r)) return n_Z;
-   if (rField_is_Ring_ModN(r)) return n_Zm;
+   if (rField_is_Ring_ModN(r)) return n_Zn;
    if (rField_is_Ring_PtoM(r)) return n_Zpn;
-   if (rField_is_Ring_2toM(r)) return  n_Z2n;
+   if (rField_is_Ring_2toM(r)) return  n_Z2m;
   #endif
 
@@ -5222,5 +5207,5 @@
   r->block0=(int*)omReallocSize(r->block0, size*sizeof(int), (size+1)*sizeof(int));
   r->block1=(int*)omReallocSize(r->block1, size*sizeof(int), (size+1)*sizeof(int));
-  r->wvhdl=(int_ptr*)omReallocSize(r->wvhdl,size*sizeof(int_ptr), (size+1)*sizeof(int_ptr));
+  r->wvhdl=(int **)omReallocSize(r->wvhdl,size*sizeof(int *), (size+1)*sizeof(int *));
   for(int k=size; k>pos; k--) r->wvhdl[k]=r->wvhdl[k-1];
   r->order[size]=0;
@@ -5233,5 +5218,5 @@
 //  r->block0=(int*)omReallocSize(r->block0, size*sizeof(int), (size-1)*sizeof(int));
 //  r->block1=(int*)omReallocSize(r->block1, size*sizeof(int), (size-1)*sizeof(int));
-//  r->wvhdl=(int_ptr*)omReallocSize(r->wvhdl,size*sizeof(int_ptr), (size-1)*sizeof(int_ptr));
+//  r->wvhdl=(int **)omReallocSize(r->wvhdl,size*sizeof(int *), (size-1)*sizeof(int *));
 //  for(int k=pos+1; k<size; k++) r->wvhdl[k]=r->wvhdl[k+1];
 //  size--;
Index: libpolys/polys/prCopy.h
===================================================================
--- libpolys/polys/prCopy.h	(revision 56790491568061b8fda62ac136d56bb3bca12583)
+++ libpolys/polys/prCopy.h	(revision 351a5f98b6806d2385238578e737147580dc23de)
@@ -1,2 +1,4 @@
+#ifndef PRCOPY_H
+#define PRCOPY_H
 /****************************************
 *  Computer Algebra System SINGULAR     *
@@ -19,26 +21,22 @@
  *
  ************************************************************************/
-poly prMoveR_NoSort(poly &p, ring r, ring dest_r = currRing);
-poly prMoveR(poly &p, ring r, ring dest_r = currRing);
-poly prCopyR_NoSort(poly p, ring r, ring dest_r = currRing);
-poly prCopyR(poly p, ring r, ring dest_r = currRing);
-poly prShallowCopyR_NoSort(poly p, ring r, ring dest_t = currRing);
-poly prShallowCopyR(poly p, ring r, ring dest_t = currRing);
-poly prHeadR(poly p, ring r, ring dest_r = currRing);
+poly prMoveR_NoSort(poly &p, ring r, ring dest_r);
+poly prMoveR(poly &p, ring r, ring dest_r);
+poly prCopyR_NoSort(poly p, ring r, ring dest_r);
+poly prCopyR(poly p, ring r, ring dest_r);
+poly prShallowCopyR_NoSort(poly p, ring r, ring dest_t);
+poly prShallowCopyR(poly p, ring r, ring dest_t);
+poly prHeadR(poly p, ring r, ring dest_rg);
 
-ideal idrMoveR_NoSort(ideal &id, ring r, ring dest_r = currRing);
-ideal idrMoveR(ideal &id, ring r, ring dest_r = currRing);
+ideal idrMoveR_NoSort(ideal &id, ring r, ring dest_r );
+ideal idrMoveR(ideal &id, ring r, ring dest_r );
 
-ideal idrCopyR_NoSort(ideal id, ring r, ring dest_r = currRing);
-ideal idrCopyR(ideal id, ring r, ring dest_r = currRing);
+ideal idrCopyR_NoSort(ideal id, ring r, ring dest_r );
+ideal idrCopyR(ideal id, ring r, ring dest_r );
 
-ideal idrShallowCopyR_NoSort(ideal id, ring r, ring dest_r = currRing);
-ideal idrShallowCopyR(ideal id, ring r, ring dest_r = currRing);
-
+ideal idrShallowCopyR_NoSort(ideal id, ring r, ring dest_r );
+ideal idrShallowCopyR(ideal id, ring r, ring dest_r );
 
 /// Copy leading terms of id[i] via prHeeadR into dest_r
-ideal idrHeadR(ideal id, ring r, ring dest_r = currRing);
-
-
-
-
+ideal idrHeadR(ideal id, ring r, ring dest_r );
+#endif
