diff options
author | Nicolas Dandrimont <Nicolas.Dandrimont@crans.org> | 2008-08-22 22:01:16 +0200 |
---|---|---|
committer | Nicolas Dandrimont <Nicolas.Dandrimont@crans.org> | 2008-08-22 22:01:16 +0200 |
commit | 92a3c1002e7b674da978bb01ae5dc4f9d70537d2 (patch) | |
tree | 6ed5ad19df4b75c8b72924fcb72fd93cd8644f13 | |
parent | e66726bc49786a1c12926250f1901786799080e6 (diff) | |
download | gmathlib-master.tar.gz gmathlib-master.tar.bz2 |
`type' is in fact a Python builtin function, so pyrex chokes on this
argument...
-rw-r--r-- | bindings/python/pygmathlib/gmathlib.pyx | 16 | ||||
-rw-r--r-- | test/pygmathlib_test_formula.py | 36 | ||||
-rwxr-xr-x | test/test_tex_output_module.py | 40 |
3 files changed, 46 insertions, 46 deletions
diff --git a/bindings/python/pygmathlib/gmathlib.pyx b/bindings/python/pygmathlib/gmathlib.pyx index a16807a..807b822 100644 --- a/bindings/python/pygmathlib/gmathlib.pyx +++ b/bindings/python/pygmathlib/gmathlib.pyx @@ -134,7 +134,7 @@ cdef class Symbol: cdef object context cdef object children - def __new__ (self, context, type = "", symbol = None, c_symbol = False, + def __new__ (self, context, symtype = "", symbol = None, c_symbol = False, copy = None): cdef GMathSymbol *child cdef GMathContext *ccontext @@ -142,8 +142,8 @@ cdef class Symbol: ccontext = <GMathContext *> context.c_context if c_symbol: self.csymbol = <GMathSymbol *> symbol - elif type: - self.csymbol = gmathsymbol_new (ccontext, type) + elif symtype: + self.csymbol = gmathsymbol_new (ccontext, symtype) if copy: self.children = [None] * len (copy.children_) @@ -177,7 +177,7 @@ cdef class Symbol: copy = self else: copy = None - symbol = Symbol (self.context, type = self.type, copy = copy) + symbol = Symbol (self.context, symtype = self.type, copy = copy) symbol.value = self.value return symbol @@ -307,7 +307,7 @@ cdef class Formula: def free (self): if self.root: self.root.free () - self.set_root (None) + self.set_root (None) gmathformula_free (self.cformula) def __dealloc__ (self): @@ -404,15 +404,15 @@ cdef class Context: self.formulas.append (formula) def Atom (self, value): - symbol = self.Symbol (type = "atom") + symbol = self.Symbol (symtype = "atom") symbol.value = value return symbol def Formula (self): return Formula (self) - def Symbol (self, type = "", symbol = None): - return Symbol (self, type, symbol) + def Symbol (self, symtype = "", symbol = None): + return Symbol (self, symtype, symbol) def Array (self, rows, columns): return Array (self, rows, columns) diff --git a/test/pygmathlib_test_formula.py b/test/pygmathlib_test_formula.py index 598d240..fb550bd 100644 --- a/test/pygmathlib_test_formula.py +++ b/test/pygmathlib_test_formula.py @@ -33,19 +33,19 @@ def make_test_formula (context): symbolx = context.Atom ("x") symboly = context.Atom ("y") symboli = context.Atom ("i") - symbolalpha = context.Symbol (type = "alpha") - symbolinfty = context.Symbol (type = "infty") + symbolalpha = context.Symbol (symtype = "alpha") + symbolinfty = context.Symbol (symtype = "infty") - sin = context.Symbol (type = "fun") + sin = context.Symbol (symtype = "fun") sin.value = "sin" sin.set_child (symbolx, 0) - frac = context.Symbol (type = "frac") + frac = context.Symbol (symtype = "frac") frac.set_child (sin, 0) frac.set_child (symbolx.copy (), 1) - app = context.Symbol (type = "approach") + app = context.Symbol (symtype = "approach") app.set_child (symbolx.copy (), 0) app.set_child (symbol0, 1) - lim = context.Symbol (type = "lim") + lim = context.Symbol (symtype = "lim") lim.set_child (app, 0) lim.set_child (frac, 1) equal = context.Symbol ("2op") @@ -53,43 +53,43 @@ def make_test_formula (context): equal.set_child (lim, 0) equal.set_child (symbol1, 1) - super = context.Symbol (type = "super") + super = context.Symbol (symtype = "super") super.set_child (symbolx.copy (), 0) super.set_child (symbol2, 1) - sub = context.Symbol (type = "sub") + sub = context.Symbol (symtype = "sub") sub.set_child (symboly, 0) sub.set_child (symbolalpha, 1) - add = context.Symbol (type = "2op") + add = context.Symbol (symtype = "2op") add.value = "+" add.set_child (super, 0) add.set_child (sub, 1) - lparen = context.Symbol (type = "lparen") + lparen = context.Symbol (symtype = "lparen") lparen.value = "(" - rparen = context.Symbol (type = "rparen") + rparen = context.Symbol (symtype = "rparen") rparen.value = ")" - paren = context.Symbol (type = "paren") + paren = context.Symbol (symtype = "paren") paren.set_child (lparen, 0) paren.set_child (add, 1) paren.set_child (rparen, 2) - fun = context.Symbol (type = "fun") + fun = context.Symbol (symtype = "fun") fun.value = "sin" fun.set_child (paren, 0) - frac = context.Symbol (type = "frac") + frac = context.Symbol (symtype = "frac") frac.set_child (fun, 0) eq = equal.copy () eq.set_child (symboli, 0) eq.set_child (symbol0.copy (), 1) lparen = lparen.copy () rparen = rparen.copy () - paren = context.Symbol (type = "paren") + paren = context.Symbol (symtype = "paren") paren.set_child (lparen, 0) paren.set_child (frac, 1) paren.set_child (rparen, 2) - integral = context.Symbol (type = "integral") + integral = context.Symbol (symtype = "integral") integral.set_child (symbol0.copy (), 0) integral.set_child (symbol1.copy (), 1) integral.set_child (paren, 2) - product = context.Symbol (type = "product") + product = context.Symbol (symtype = "product") product.set_child (eq, 0) product.set_child (symbol10, 1) product.set_child (integral, 2) @@ -97,7 +97,7 @@ def make_test_formula (context): equal2.set_child (product, 0) equal2.set_child (symbolinfty, 1) - comma = context.Symbol (type = "2op") + comma = context.Symbol (symtype = "2op") comma.value = ", " comma.set_child (equal, 0) comma.set_child (equal2, 1) diff --git a/test/test_tex_output_module.py b/test/test_tex_output_module.py index 70b17a5..b3a2180 100755 --- a/test/test_tex_output_module.py +++ b/test/test_tex_output_module.py @@ -41,18 +41,18 @@ if __name__ == "__main__": symbolx = context.Atom ("x") symboly = context.Atom ("y") symboli = context.Atom ("i") - symbolinfty = context.Symbol (type = "infty") + symbolinfty = context.Symbol (symtype = "infty") - sin = context.Symbol (type = "fun") + sin = context.Symbol (symtype = "fun") sin.value = "sin" sin.set_child (symbolx, 0) - frac = context.Symbol (type = "frac") + frac = context.Symbol (symtype = "frac") frac.set_child (sin, 0) frac.set_child (symbolx.copy (), 1) - app = context.Symbol (type = "approach") + app = context.Symbol (symtype = "approach") app.set_child (symbolx.copy (), 0) app.set_child (symbol0, 1) - lim = context.Symbol (type = "lim") + lim = context.Symbol (symtype = "lim") lim.set_child (app, 0) lim.set_child (frac, 1) equal = context.Symbol ("2op") @@ -60,33 +60,33 @@ if __name__ == "__main__": equal.set_child (lim, 0) equal.set_child (symbol1, 1) - super = context.Symbol (type = "super") + super = context.Symbol (symtype = "super") super.set_child (symbol2, 0) super.set_child (symbolx.copy (), 1) - sub = context.Symbol (type = "sub") + sub = context.Symbol (symtype = "sub") sub.set_child (symbol3, 0) sub.set_child (symboly, 1) - sqrt = context.Symbol (type = "sqrt") + sqrt = context.Symbol (symtype = "sqrt") sqrt.set_child (sub, 0); - add = context.Symbol (type = "2op") + add = context.Symbol (symtype = "2op") add.value = "+" add.set_child (super, 0) add.set_child (sqrt, 1) - lparen = context.Symbol (type = "lparen") + lparen = context.Symbol (symtype = "lparen") lparen.value = "(" - rparen = context.Symbol (type = "rparen") + rparen = context.Symbol (symtype = "rparen") rparen.value = ")" - paren = context.Symbol (type = "paren") + paren = context.Symbol (symtype = "paren") paren.set_child (lparen, 0) paren.set_child (add, 1) paren.set_child (rparen, 2) - fun = context.Symbol (type = "fun") + fun = context.Symbol (symtype = "fun") fun.value = "sin" fun.set_child (paren, 0) - sqrt2 = context.Symbol (type = "sqrt") + sqrt2 = context.Symbol (symtype = "sqrt") sqrt2.set_child (fun, 0) sqrt2.set_child (symboli.copy (), 1) - frac = context.Symbol (type = "frac") + frac = context.Symbol (symtype = "frac") frac.set_child (sqrt2, 0) frac.set_child (symbol0.copy (), 1) eq = equal.copy () @@ -94,11 +94,11 @@ if __name__ == "__main__": eq.set_child (symbol0.copy (), 1) lparen = lparen.copy () rparen = rparen.copy () - paren = context.Symbol (type = "paren") + paren = context.Symbol (symtype = "paren") paren.set_child (lparen, 0) paren.set_child (frac, 1) paren.set_child (rparen, 2) - product = context.Symbol (type = "product") + product = context.Symbol (symtype = "product") product.set_child (eq, 0) product.set_child (symbol10, 1) product.set_child (paren, 2) @@ -106,17 +106,17 @@ if __name__ == "__main__": equal2.set_child (product, 0) equal2.set_child (symbolinfty, 1) - lcurly = context.Symbol (type = "lparen") + lcurly = context.Symbol (symtype = "lparen") lcurly.value = "{" - rnone = context.Symbol (type = "rparen") + rnone = context.Symbol (symtype = "rparen") rnone.value = "." array = context.Array (2, 1) array.set_child (equal, 0, 0) array.set_child (equal2, 1, 0) - curly = context.Symbol (type = "paren") + curly = context.Symbol (symtype = "paren") curly.set_child (lcurly, 0) curly.set_child (array, 1) curly.set_child (rnone, 2) |