JIMS code

sploving sploving1 at gmail.com
Mon Mar 29 08:11:02 CEST 2010


在 2010-03-28日的 13:55 +0200,calixte写道:
Hello,
> Hello,
> 
> 
> > > is converted into the mlist : obj = mlist(['_JObj' '_id' 'M' 'F'])
> > >  * _id is the pos of the object in an array on the java side, for example _id=314
> > >  * for the method, I create a scilab function in using deff : deff('y=tmpmacro(varargin)','y=wrapInMList(invoke(314,''M'',varargin))')
> > >     invoke returns the id of the object returned by the invocation of the method M of the object 314. The function tmpmacro is     affected to the field 'M' of the mlist
> > >  * for the field, I create a function using deff too, the syntax in Scilab is obj.F(32) affects 32 to F on the java side and obj.F() gets the value of F.
> > I use the getfield to see what is the content of the keyword 'M' in
> > mlist.  the result is: y=ans(varargin). what is that mean? why not
> > "y=M(varargin)"?
> 
> You're right, it's probably a bug, but it isn't a problem...
> 
> > For example, when call "A.func(x, y)"( A is a mlist),I want to call the
> > C function "sci_func(A.id, x, y)" , then how to wrap the func in the
> > mlist?  if A=mlist(['name,id,func'],"example",1,?), what is the content
> > of '?'  
I made a small mistake here, I wanted to write A=mlist(['type' 'name'
'id' 'func'], 'example', 1, ?);
> 
> A mlist is a typed list, if the type of your mlist is for example
> PythObj, you should define it :
> 
> --> A=mlist(['PythObj' 'name' 'id' 'func'], 'example', 1, sci_func)
> 
> typeof(A) returns PythObj (take a look at the help page about
> overloading...)
> A.name returns example
> A.id returns 1
> A.func(x,y) returns sci_func(x,y)
>  
How to make "A.func(x,y) returns sci_func(x,y)"? Do I need write a
overloading function for that? 

For example, sci_func() is in a file 'a.c', I want to wrap it in the
file 'b.c', like the following:
extern int sci_gcd(int x, int y);
int sci_module(char* fname){
  ...
  int (*f)(int x, int y)
  f=sci_gcd;
  ...
 
  createPointerInList(pvApiCtx, Rhs + 1, mlistaddr, 4, f);
  ...
}

Is it right to use the createPointerInList API? when I run
it:a.gcd(15,25), it appears:
Undefined operation for the given operands.check or define function %
ptr_e for overloading.

Then Could you tell me how to overload it?
Thanks 

Baozeng

> Calixte
> 




More information about the dev mailing list