1
overloading Scilab Group Scilab keyword overloading
3
overloading - display, functions and operators overloading capabilities
6
In scilab, variable display, functions and operators may be defined for
7
new objects using functions (scilab coded or primitives).
9
Display : The display of new objects defined by tlist structure
10
may be overloaded (the default display is similar to
11
list's one). The overloading function must have no output
12
argument a single input argument. It's name is formed as
13
follow %<tlist_type>_p where %<tlist_type> stands for the
14
first entry of the tlist type component.
16
Operators : Each operator which is not defined for given operands
17
type may be defined. The overloading function must have a
18
single output argument and one or two inputs according to
19
the number of operands. The function name is formed as
23
%<first_operand_type>_<op_code>_<second_operand_type>
25
for unary operators: %<operand_type>_<op_code>
27
extraction and insertion operators which are n-nary
28
operators are described below.
30
<operand_type>, <first_operand_type>,
31
<second_operand_type> are sequence of characters
32
associated with each data type as described in the
46
<op_code> is a single character associated with each
47
operator as described in the following table:
83
The overloading function for extraction syntax
84
b=a(i1,...,in) has the following calling sequence:
85
b=%<type_of_a>_e_(i1,...,in,a) and the syntax
86
[x1,..,xm]=a(i1,...,in) has the following calling
87
sequence: [x1,..,xm]=%<type_of_a>_e_(i1,...,in,a)
89
The overloading function associated to the insertion
90
syntax a(i1,...,in)=b has the following calling sequence:
91
a=%<type_of_a>_i_<type_of_b>(i1,...,in,b,a).
93
Functions : Some basic primitive function may also be overloaded for new data type. When
94
such a function is undefined for a particular data types the function
95
%<type_of_an_argument>_<function_name> is called. User may
96
add in this called function the definition associated with
104
deff('[]=%tab_p(l)','disp([['' '';l(3)] [l(2);string(l(4))]])')
105
tlist('tab',['a','b'],['x';'y'],rand(2,2))
108
deff('x=%c_a_s(a,b)','x=a+string(b)')
112
deff('x=%c_sin(a)','x=''sin(''+a+'')''')