# HG changeset patch
# User Burcin Erocal <burcin@erocal.org>
# Date 1270251191 -7200
# Node ID 10de7f23ddb4013233504adc7abe90760884f8c9
# Parent  b7495417f9a2bfb3b57aab7bb3a1a34285e3be3c
trac 6781: minor cosmetic changes to the ecl library interface.

diff --git a/module_list.py b/module_list.py
--- a/module_list.py
+++ b/module_list.py
@@ -398,7 +398,7 @@
     ################################
 
     Extension('sage.libs.ecl',
-              sources = ["sage/libs/ecl/ecl.pyx"],
+              sources = ["sage/libs/ecl.pyx"],
               libraries = ["ecl"],
               include_dirs = [SAGE_ROOT+'/local/include/ecl/'],
               depends = [SAGE_ROOT + '/local/include/ecl/ecl.h']),
diff --git a/sage/libs/ecl/ecl.pxd b/sage/libs/ecl.pxd
rename from sage/libs/ecl/ecl.pxd
rename to sage/libs/ecl.pxd
diff --git a/sage/libs/ecl/ecl.pyx b/sage/libs/ecl.pyx
rename from sage/libs/ecl/ecl.pyx
rename to sage/libs/ecl.pyx
--- a/sage/libs/ecl/ecl.pyx
+++ b/sage/libs/ecl.pyx
@@ -13,13 +13,12 @@
 #rationals to SAGE types Integer and Rational. These parts could easily be
 #adapted to work with pure Python types.
 
-cimport sage.rings.integer
+include "../ext/interrupt.pxi"
+include "../ext/stdsage.pxi"
+include "../ext/cdefs.pxi"
+
 from sage.rings.integer cimport Integer
-import sage.rings.integer
-from sage.rings.integer import Integer
-cimport sage.rings.rational
 from sage.rings.rational cimport Rational
-import sage.rings.rational
 from sage.rings.rational import Rational
 
 #it would be preferrable to let bint_symbolp wrap an efficient macro
@@ -277,7 +276,7 @@
             return Ct
         else:
             return Cnil
-    elif pyobj==None:
+    elif pyobj is None:
         return Cnil
     elif isinstance(pyobj,int):
         return ecl_make_integer(pyobj)
@@ -630,9 +629,7 @@
             NotImplementedError: EclObjects can only be compared for equality
             sage: EclObject("<")(a,b)
             <ECL: T>
-
         """
-    
         if   op == 2: # "=="
             if not(isinstance(left,EclObject)) or not(isinstance(right,EclObject)):
                 return False
@@ -650,18 +647,18 @@
         #inappropriate for an *interface*.
         raise NotImplementedError,"EclObjects can only be compared for equality"
  
-        if not(isinstance(left,EclObject)) or not(isinstance(right,EclObject)):
-            raise TypeError,"Can only compare EclObjects"
-        if op == 0: # "<"
-            pass
-        elif op == 1: # "<="
-            pass
-        elif op == 4: # ">"
-            pass
-        elif op == 5: # ">="
-            pass
-        else:
-            raise ValueError,"richcmp received operation code %d"%op
+        #if not(isinstance(left,EclObject)) or not(isinstance(right,EclObject)):
+        #    raise TypeError,"Can only compare EclObjects"
+        #if op == 0: # "<"
+        #    pass
+        #elif op == 1: # "<="
+        #    pass
+        #elif op == 4: # ">"
+        #    pass
+        #elif op == 5: # ">="
+        #    pass
+        #else:
+        #    raise ValueError,"richcmp received operation code %d"%op
 
     def eval(self):
         r"""
@@ -993,8 +990,7 @@
 
 #input: a cl-object. Output: EclObject wrapping that.
 cdef EclObject ecl_wrap(cl_object o):
-    cdef EclObject obj
-    obj = EclObject()
+    cdef EclObject obj = PY_NEW(EclObject)
     obj.set_obj(o)
     return obj
 
