Index: Singular/Makefile.in
===================================================================
--- Singular/Makefile.in	(revision 29e62514626f845660020d97137e7ff0ee326383)
+++ Singular/Makefile.in	(revision a2745db7e07b064fc487c999bf008aea7b0069df)
@@ -42,5 +42,5 @@
 BISON		= bison
 INSTALL		= @INSTALL@
-INSTALL_PROGRAM	= @INSTALL_PROGRAM@ 
+INSTALL_PROGRAM	= @INSTALL_PROGRAM@
 INSTALL_DATA	= @INSTALL_DATA@
 MKINSTALLDIRS   = ./mkinstalldirs
@@ -54,5 +54,10 @@
 CXXFLAGS	= @CXXFLAGS@ ${PIPE}
 CXXTEMPLFLAGS	= @CXXTEMPLFLAGS@
+ifneq ($(SINGUNAME),ix86-Win)
 CPPFLAGS	= -I${srcdir} -I../kernel @CPPFLAGS@
+else
+## Dirs after @CPPFLAGS@ are for PySingular
+CPPFLAGS	= -I${srcdir} -I../kernel @CPPFLAGS@ -I/usr/include/python2.4 -I/usr/local/include/boost-1_32 -I/home/Singular/singular-python/modules/python
+endif
 DEFS		= -DNDEBUG -DOM_NDEBUG -D@SING_UNAME@ @DEFS@
 LDFLAGS2	= @LDFLAGS@
@@ -60,5 +65,6 @@
 LDFLAGS		= -L../kernel -lkernel @LDFLAGS@
 else
-LDFLAGS		= -L../kernel -L/bin -lkernel @LDFLAGS@
+## -L/usr/local/lib -L/home/Singular/singular-python/modules/python --> PySingular
+LDFLAGS		= -L../kernel -L/bin -lkernel @LDFLAGS@ -L/usr/local/lib -L../modules/python
 endif
 LDFLAGSG	= -L../kernel -lkernel-g @LDFLAGS@
@@ -73,7 +79,7 @@
 # arguments to link
 ifneq ($(SINGUNAME),ix86-Win)
-LIBS		= -lm @NEED_LIBS@ 
+LIBS		= -lm @NEED_LIBS@
 else
-LIBS		= -lsingfac -lsingcf -lntl  -static -lreadline -lhtmlhelp -Xlinker -Bdynamic -lgmp -lcygncurses6 
+LIBS		= -lsingfac -lsingcf -lntl  -static -lreadline -lhtmlhelp -Xlinker -Bdynamic -lgmp -lcygncurses6 -lpython_module -lpython2.4 /usr/local/lib/libboost_python-gcc-d-1_32.dll
 endif
 MP_LIBS		= @MP_LIBS@
@@ -82,10 +88,10 @@
 
 ifdef LD_STATIC
-LDFLAGS  := ${STATIC_LDFLAGS} ${LDFLAGS} 
+LDFLAGS  := ${STATIC_LDFLAGS} ${LDFLAGS}
 SING_EXEC = Singular-static
-LIBS := ${MP_LIBS} ${LIBS} 
+LIBS := ${MP_LIBS} ${LIBS}
 DL_KERNEL =
 else
-LDFLAGS  := ${LD_DYN_FLAGS} ${LDFLAGS} 
+LDFLAGS  := ${LD_DYN_FLAGS} ${LDFLAGS}
 SING_EXEC = Singular
 endif
@@ -174,5 +180,5 @@
 	gms.h pcv.h eigenval_ip.h \
 	fegetopt.h distrib.h walk.h \
-        static.h\
+        static.h \
         omSingularConfig.h
 
Index: Singular/extra.cc
===================================================================
--- Singular/extra.cc	(revision 29e62514626f845660020d97137e7ff0ee326383)
+++ Singular/extra.cc	(revision a2745db7e07b064fc487c999bf008aea7b0069df)
@@ -2,5 +2,5 @@
 *  Computer Algebra System SINGULAR      *
 *****************************************/
-/* $Id: extra.cc,v 1.229 2005-07-27 15:47:53 Singular Exp $ */
+/* $Id: extra.cc,v 1.230 2005-10-05 07:23:21 wienand Exp $ */
 /*
 * ABSTRACT: general interface to internals of Singular ("system" command)
@@ -131,4 +131,10 @@
 //#endif /* not HAVE_DYNAMIC_LOADING */
 
+#ifdef ix86_Win
+#include <Python.h>
+#include <python_wrapper.h>
+#endif
+
+
 // see clapsing.cc for a description of the `FACTORY_*' options
 
@@ -152,4 +158,7 @@
 extern BOOLEAN jjJanetBasis(leftv res, leftv v);
 
+#ifdef ix86_Win  /* PySingular initialized? */
+static int PyInitialized = 0;
+#endif
 
 //void emStart();
@@ -2604,5 +2613,5 @@
         mipo_id->m[i]=p;
       }
-      new_ring->minideal=id_Copy(alg_ring->qideal,new_ring); 
+      new_ring->minideal=id_Copy(alg_ring->qideal,new_ring);
       // convert factors =============================================
       ideal fac_id=idInit(L.length(),1);
@@ -2620,8 +2629,8 @@
       LL->m[0].rtyp=IDEAL_CMD;
       LL->m[0].data=(char *)fac_id;
-      LL->m[1].rtyp=INTVEC_CMD; 
+      LL->m[1].rtyp=INTVEC_CMD;
       LL->m[1].data=(char *)v;
       IDDATA(hh)=(char *)LL;
-  
+
       rChangeCurrRing(save_currRing);
       currRingHdl=save_currRingHdl;
@@ -2633,4 +2642,57 @@
     }
     else
+#endif
+#ifdef ix86_Win
+/*==================== Python Singular =================*/
+    if (strcmp(sys_cmd, "python") == 0)
+    {
+      const char* c;
+      if ((h!=NULL) && (h->Typ()==STRING_CMD))
+      {
+        c=(const char*)h->Data();
+        if (!PyInitialized) {
+          PyInitialized = 1;
+          Py_Initialize();
+          initPySingular();
+        }
+	PyRun_SimpleString(c);
+        return FALSE;
+      }
+      else return TRUE;
+    }
+    else
+/*==================== Python Singular =================*/
+    if (strcmp(sys_cmd, "ipython") == 0)
+    {
+      const char* c;
+      {
+        if (!PyInitialized) {
+          PyInitialized = 1;
+          Py_Initialize();
+          initPySingular();
+        }
+	PyRun_SimpleString(
+"try:                                                                                       \n\
+    __IPYTHON__                                                                             \n\
+except NameError:                                                                           \n\
+    argv = ['']                                                                             \n\
+    banner = exit_msg = ''                                                                  \n\
+else:                                                                                       \n\
+    # Command-line options for IPython (a list like sys.argv)                               \n\
+    argv = ['-pi1','In <\\#>:','-pi2','   .\\D.:','-po','Out<\\#>:']                        \n\
+    banner = '*** Nested interpreter ***'                                                   \n\
+    exit_msg = '*** Back in main IPython ***'                                               \n\
+											    \n\
+# First import the embeddable shell class                                                   \n\
+from IPython.Shell import IPShellEmbed                                                      \n\
+# Now create the IPython shell instance. Put ipshell() anywhere in your code                \n\
+# where you want it to open.                                                                \n\
+ipshell = IPShellEmbed(argv,banner=banner,exit_msg=exit_msg)                                \n\
+ipshell()");
+        return FALSE;
+      }
+    }
+    else
+
 #endif
 /*==================== Error =================*/
@@ -2640,2 +2702,3 @@
 }
 #endif // HAVE_EXTENDED_SYSTEM
+
