- Timestamp:
- Sep 24, 2005, 4:26:14 PM (19 years ago)
- Branches:
- (u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
- Children:
- 22ed4cf89aab148fdc7f4bd4b032c31b19d38331
- Parents:
- ab8c32a4fe42867e782301943eaf5f0c16f6d6e8
- Location:
- modules/python
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/python/interpreter.py
rab8c32 rf3517a2 1 1 from Singular import * 2 from _Singular import * 2 #from _Singular import * 3 import _Singular 3 4 try: 4 5 import psyco … … 13 14 #def build_arg_list(*args) 14 15 def list2arg_list(args): 15 l= i_arg_list()16 l=_Singular.i_arg_list() 16 17 for a in args: 17 18 if isinstance(a,list): … … 25 26 return l 26 27 class singular_globals_proxy(object): 28 def __mycbm(self,name,*args): 29 l=list2arg_list(args) 30 prepare_ring(args) 31 res= _Singular.cbm(name,l) 32 finish_ring() 33 return res 34 27 35 def __getattr__(self,name): 28 proc= get_idhdl(name)36 proc=_Singular.get_idhdl(name) 29 37 if proc.is_zero(): 30 if is_builtin(name):38 if _Singular.is_builtin(name): 31 39 def fun_wrapper(*args): 32 return mycbm(name,*args)40 return self.__mycbm(name,*args) 33 41 try: 34 42 fun_wrapper.__name__=name … … 42 50 43 51 44 proc= get_idhdl(name)52 proc=_Singular.get_idhdl(name) 45 53 if not proc.is_proc(): 46 54 proc.print_type() … … 48 56 prepare_ring(args) 49 57 l=list2arg_list(args) 50 erg= call_interpreter_method(proc, l)58 erg= _Singular.call_interpreter_method(proc, l) 51 59 finish_ring() 52 60 return erg … … 57 65 return fun_wrapper 58 66 else: 59 res= transfer_to_python(proc)67 res=_Singular.transfer_to_python(proc) 60 68 if res is None: 61 69 raise AttributeError("Global variable "+name+" has unknown type") 62 70 return res 63 71 def __setattr__(self,name,value): 64 id= get_idhdl(name)72 id=_Singular.get_idhdl(name) 65 73 if id.is_zero(): 66 74 raise Expception … … 72 80 global_functions=singular_globals_proxy 73 81 74 def mycbm(name,*args):75 l=list2arg_list(args)76 prepare_ring(args)77 res= cbm(name,l)78 finish_ring()79 return res80 82 81 83 def find_rings(arglist): -
modules/python/interpretertester
rab8c32 rf3517a2 56 56 list mylist=1,2,3; 57 57 LIB("python_module.so"); 58 Python_module::python("from Singular import number, polynomial, interpreter_id, get_idhdl,call_interpreter_method, i_arg_list,gen, ideal59 print call_interpreter_method 58 Python_module::python("from Singular import number, polynomial, gen, ideal 59 60 60 from interpreter import global_functions 61 61 functions=global_functions()
Note: See TracChangeset
for help on using the changeset viewer.