Re: Scilab 6.0 // Implementation of user-defined types
> is there (apart from source code of Scilab itself) any
> documentation/tutorial/example available, which provides
> a good starting point on how to implement user-defined types
> in the new Scilab 6.0?
Nice question, we currently only have internal code using it even if the code contains some
documentation. You can find example in the Scilab code :
* on Xcos adapters, see modules/scicos/src/cpp/view_scilab/BaseAdapter.hxx and other file on this
written by me (and Paul) without previous knowledge
* on MPI Communicators, see modules/mpi/includes/sciMpiComm.hxx
written by Cédric who also implemented part of the visitor_common.cpp (the interpreter)
As you will have access to all the inner implementation details of Scilab 6, you will probably
experience some crashes while developing and suffer on reference-counting issues but you will be
free to implement whatever you want !
Do not hesitate to share your experience or ask questions.
IMO, it was in the top 5 most obscure feature of Scilab <6 :)
I never saw any clear explanation nor example of usage about it
for 20 years.
Maybe it was only silently failing:
In Scilab 5: -->t = tlist(["test" "r"],%pi); -->t.r ans = 3.1415927 -->typename("test", 140) -->type(t) ans = 16.
Coming back to the example here-above: --> // Creating a new typeof object named "mytype" --> // with fields "num", "bool", "poly", "txt" --> t = tlist(["mytype" "num" "bool" "poly" "txt"]); --> // Assigning initial values to fields --> t.num = %pi; --> t.bool = %f; --> t.poly = (1-%z)^3; --> t.txt = ["Hello" "Allo" "Hallo"] t = t(1) !mytype num bool poly txt ! t(2) 3.1415927 t(3) F t(4) 2 3 1 -3z +3z -z t(5) !Hello Allo Hallo ! --> typeof(t) ans = mytype
Nothing has changed between Scilab 5 and Scilab 6 about that.
Le 18/02/2017 à 14:02, Dirk Reusch a écrit :
is there (apart from source code of Scilab itself) any
documentation/tutorial/example available, which provides
a good starting point on how to implement user-defined types
in the new Scilab 6.0?
dev mailing list