Changeset c012463 in git
- Timestamp:
- Jun 15, 2005, 11:38:16 AM (18 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- 04f6a4e219c5180c44ff638afd7e63cc8ffa3699
- Parents:
- d0eb8c62a0f20ffc02130a688aabd569d1ac4430
- Location:
- modules/openmathserver
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/openmathserver/binding.py
rd0eb8c rc012463 1 from objects import OM object, OMsymbol1 from objects import OMObjectBase, OMsymbol 2 2 from cd import * 3 3 from omexceptions import * 4 4 from itertools import izip 5 from copy import copy 5 6 cdFns1=OMcd("fns1") 6 7 lambdasym=OMsymbol("lambda",cdFns1) … … 9 10 return lambdasym==sym 10 11 11 class OMbinding(OMobject): 12 class OMbinding(OMObjectBase): 13 """hopefully fixed possible problems: reevaluation writes new scope, if it isn't 14 meant so, references do not work correctly because of scopes 15 solve this by first evaluation to bounded OMbinding""" 12 16 def __init__(self, binder,variables,block): 13 17 super(OMbinding,self).__init__() … … 15 19 self.binder=binder 16 20 self.variables=variables 21 self.bounded=False 17 22 def evaluate(self,context): 18 23 assert islambda(self.binder) 19 self.scope=context.scopeFromCurrentScope() 20 return self 24 if not self.bounded: 25 mycopy=copy(self) 26 mycopy.scope=context.scopeFromCurrentScope() 27 mycopy.bounded=True 28 return mycopy 29 else: 30 return self 21 31 def bind(self, args): 22 32 #print args, self.variables -
modules/openmathserver/context.py
rd0eb8c rc012463 55 55 return erg 56 56 def package(self, val): 57 if isinstance(val, OM object):57 if isinstance(val, OMObjectBase): 58 58 return val 59 59 else: -
modules/openmathserver/objects.py
rd0eb8c rc012463 8 8 def encode(self, context): 9 9 return "".join([self.name,"=\"",self.value,"\""]) 10 class OM object(object):10 class OMObjectBase(object): 11 11 """ at the moment only a base class""" 12 12 def __init__(self): … … 33 33 self.setChildren(children) 34 34 except AttributeError: 35 self.__children=children35 raise UnsupportedOperationError 36 36 def __getBody(self): 37 37 try: … … 55 55 self.setBody(body) 56 56 except AttributeError: 57 self.__body=body57 raise UnsupportedOperationError 58 58 def __getXMLattributes(self): 59 59 try: … … 78 78 self.setBody(XMLattributes) 79 79 except AttributeError: 80 self.__XMLattributes=XMLattributes80 raise UnsupportedOperationError 81 81 children=property(__getChildren, __setChildren,__delChildren,\ 82 82 """ children in an OMtree""") … … 105 105 closing="".join(["</"+self.XMLtag+">"]) 106 106 return "".join([opening,body,closing]) 107 class OMvar(OM object):107 class OMvar(OMObjectBase): 108 108 def __init__(self,name): 109 109 super(OMvar,self).__init__() … … 120 120 return [XMLattribute("name", self.name)] 121 121 122 class OMapplication(OM object):122 class OMapplication(OMObjectBase): 123 123 def __init__(self, func, args): 124 124 super(OMapplication,self).__init__() … … 142 142 raise UnsupportedOperationError 143 143 144 class OMsymbol(OM object):144 class OMsymbol(OMObjectBase): 145 145 def __init__(self,name,cd=None): 146 146 super(OMsymbol,self).__init__() … … 162 162 def setXMLattributes(self): 163 163 raise UnsupportedOperationError 164 class SimpleValue(OM object):164 class SimpleValue(OMObjectBase): 165 165 def __init__(self,value): 166 166 super(SimpleValue,self).__init__()
Note: See TracChangeset
for help on using the changeset viewer.