Scilab 6.0 // Implementation of user-defined types

classic Classic list List threaded Threaded
4 messages Options
Dirk Reusch Dirk Reusch
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Scilab 6.0 // Implementation of user-defined types

CONTENTS DELETED
The author has deleted this message.
Clément David-2 Clément David-2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Scilab 6.0 // Implementation of user-defined types

Hi Dirk,

> 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
   directory.
    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.

Thanks,

--
Clément
_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Scilab 6.0 // Implementation of user-defined types

In reply to this post by Dirk Reusch
Hello Dirk,

Your question is funny, because it could be somewhat about the typename() function, that has been simplified in Scilab 6:
The syntax typename(name, type) has been removed:
5.5.2: https://help.scilab.org/docs/5.5.2/en_US/typename.html
6.0.0: https://help.scilab.org/docs/6.0.0/en_US/typename.html

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. 

Maybe the only really related (and not concluding) entry in the whole Scilab knowledges database is:
http://bugzilla.scilab.org/5621

But your question could also be about custom "typeof". Then, the best entries are likely
https://help.scilab.org/docs/6.0.0/en_US/tlist.html
and
https://help.scilab.org/docs/6.0.0/en_US/mlist.html

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.

HTH
Samuel


Le 18/02/2017 à 14:02, Dirk Reusch a écrit :
Hello,

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?

Thanks,

Dirk
_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev



_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Scilab 6.0 // Implementation of user-defined types

Le 21/02/2017 à 21:44, Samuel Gougeon a écrit :
> .../...
> Nothing has changed between Scilab 5 and Scilab 6 about that.

Except that types names can now be longer than 8 characters.

Regards

_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Loading...