Search
???Home ???
Framework
Screenshots
FAQ
???TELL ???
Types
Operators
Functions
Example
???Toped ???
Database
Cells
Add
Select
Edit
Properties
Rendering
GUI
Miscellaneous
???Ifaces ???
GDSII
OASIS
CIF
DRC

Operators

Arithmetic

The operators listed below work in the expected fashion for int and real types. The same is true for their order of precedence.

Table?1.?Arithmetic operators

operator Description
- Unary minus, subtraction
+ Addition
* Multiplication
/ Division

See planar operators for further definitions of those operators with point and box operand types.

top

Relational and Logical

Operators below are implemented for int, real and bool. For the rest of the types they are not allowed.

Table?2.?Relational operators

operator Description
> Greater than
>= Greater than or equal
< Less than
<= Less than or equal
== Equal
!= Not equal

top

Assignment

Assignment operator is = and it works in the expected way. The only reminder here is that TELL maintains strict type checking. Internal silent conversion is provided only from int to real. For lists and structures assignment see variable initialization

top

Member operator

The . (dot) operator is used to access the individual fields of the build-in and user defined structures. The dot operator is applied to a variable and must be followed by a valid field name. Struct members accessed using a member operator can be used exactly as any other TELL variable.

   box source_area;
   source_area.p1 = {0,0};
   source_area.p2 = {source_area.p1.x + 2.6 , source_area.p1.y + 1.6};

   struct circle { point center; real radius };
   circle c1;
   c1.center = source_area.p2;
   c1.radius = source_area.p2.x - source_area.p1.x;

top

List operations

See list types

Indexing

It looks and works as a traditional array indexing. Indexes start at 0, thus a list of (say) 5 points will have indexes from 0 to 4. Reference to an unexisting component will trigger runtime error Invalid index.

   point list p1 = {{0,0},{2,0},{2,1},{1,1},{1,2},{0,2}};
   point list p2 = {{100,100},{102,100},{102,101},{101,101}};
   p2[0] = p1[5];
   p2[1] = p1[4];
   p2[2] = p1[3];
   p2[3] = {100,90};

top

Index range

In addition to the traditional indexing, Tell defines also index range operator : (colon). It produces a new list of the same type without changing the original list. The members of the resulting list are a copy of the corresponding members of the original list.

   int list l1 = {0,1,2,3,4,5};
   int list l2 = l1[2:4]; // Index range
   echo(l2); // shall produce: list members: { 2 , 3 , 4 }
   echo(l1[2:4]); // this shall report the same

top

Add/Insert

A component can be added to or inserted into a list using the operators below. The symbols +: and :+ determine whether to insert before or after the target index. If target index is omitted, then they determine whether to insert the component in the beginning of the list or to add it at the end.

[Tip]Add/insert operator

listvar[<index>:+] = <init> - insert a component with value <init> after index

listvar[+:<index>] = <init> - insert a component with value <init> before index

listvar[:+] = <init> - add a component to the end of the list

listvar[+:] = <init> - add a component to the beginning of the list

The examples below demonstrate the use of add/insert operator

   int list alst = {1,2,3,4,5};

   alst[+:] = 0;        // push front
   //alst[+:0] = 0;     // same as above
   alst[:+] = 6;        // push back
   //alst[5:+] = 6;     // same as above

   alst[3:+] = 33;      // insert 33  after  the 3rd component
   alst[+:3] = -33;     // insert -33 before the 3rd component

top

List union

Add/insert operators will take also a list as an rvalue. This produces not only a simple list union, but is also capable of inserting a list anywhere into another list.

[Tip]List union operator

listvar[<index>:+] = <var_list> - insert the list <var_list> after <index>

listvar[+:<index>] = <var_list> - insert he list <var_list> before <index>

listvar[:+] = <var_list> - Add <var_list> at the end of listvar

listvar[+:] = <var_list> - Add <var_list> at the beginning of listvar

   alst[3:+] = { 33, 34, 35}; // insert the list  after  the 3rd component
   alst[+:3] = {-32,-33,-34}; // insert the list  before the 3rd component

top

Reduce/delete

A component can be removed from the list using the following operators. Note the semantic difference with :+ operator. Here if index is given, operators :- and -: execute the same operation

[Tip]Reduce/delete operator

comp = listvar[<index>:-] - remove the index-th component of the list

comp = listvar[-:<index>] - same as above

comp = listvar[:-] - remove the last component of the list

comp = listvar[-:] - remove the first component of the list

   echo(alst[-:3]); // remove the third component and print it
   echo(alst[4:-]); // remove the fourth component and print it
   alst[-:];        // remove the first from the list
   alst[:-];        // remove the last one

top

List slicing

Reduce/delete operators are removing a single component from the list. Slice operator is an extention, making possible to extract a number of consecutive components from a list.

[Tip]Slice operator

comp_list = listvar[<num>-:<index>] - removes <num> components ending with the index-th

comp_list = listvar[<index>:-<num>] - removes <num> components starting from the index-th

comp_list = listvar[:-<num>] - remove the trailing <num> components

comp_list = listvar[<num>-:] - remove the leading <num> components

   int list blst;
   echo(blst = alst[3-:]); // remove first 3 components and print them
   alst[:+] = blst[:-2];   // put last 2 of them at the back of the
                           // original list
   alst[:+] = alst[2-:];   // move first pair of components at the end
                           // of the list
   alst[5:-2]              // remove 5-th and 6-th component from the list
   alst[2-:5]              // remove 4-th and 5-th component from the list

top

List traversing

The foreach loop traverses the list and sets the loop variable to each element of the list in turn. The operator syntax is similar to the corresponding perl operator.

[Tip]foreach operator

foreach(<loop_var>; <list_var>) <block>

___________________________________________
loop_var
loop variable
list_var
List which is iterated
block
the cycle body which will be executed foreach of the list_var components
   foreach (int i; int list {5,4,3,2,1})
   {
      echo(i);
   };

top

Planar operators

This class of operators works on points and boxes. The tables below define the accepted operands for each operator.

Table?3.?Addition operator with box and poly types

+ real/int point box
real/int arithmetic shift blow
point shift shift shift
box blow shift -

Table?4.?Subtraction operator with box and poly types

- real/int point box
real/int arithmetic - -
point shift shift -
box shrink shift -

Table?5.?Multiplication operator with box and poly types

* real/int point box
real/int arithmetic scale scale
point scale - -
box scale - -

Table?6.?Division operator with box and poly types

/ real/int point box
real/int arithmetic - -
point scale - -
box scale - -

Shift

This operation can be invoked with almost any combination of box , point and int/real operands as described in the + and - tables above. The result always takes the type of the more complex operand. As the name suggests it shifts the location in the plane of the more complex operand.

   /* This example lists all cases of shift */
   real  r = 10;
   point p = {1,2};
   box   b = {{1,2},{3,4}};

   //Point and scalar
   echo(p+r); // {X = 11, Y = 12}
   echo(r+p); // {X = 11, Y = 12}
   echo(p-r); // {X = -9, Y = -8}
   echo(r-p); // error - unexpected operand type

   // point and point
   echo(p+p); // {X = 2, Y = 4}
   echo(p-p); // {X = 0, Y = 0}

   // box and point
   echo(b+p); // {{X = 2, Y = 4}, {X = 4, Y = 6}}
   echo(p+b); // {{X = 2, Y = 4}, {X = 4, Y = 6}}
   echo(b-p); // {{X = 0, Y = 0}, {X = 2, Y = 2}}
   echo(p-b); // error - unexpected operand type

Blow

The operation works on a box and produces a new enlarged box

   /* This example lists all cases of blow */
   real  r = 10;
   box   b = {{1,2},{3,4}};

   // box and scalar
   echo(b+r); // {{X = -9, Y = -8}, {X = 13, Y = 14}}
   echo(r+b); // {{X = -9, Y = -8}, {X = 13, Y = 14}}

Shrink

Pretty much the same as blow, but simply modifies the box in the opposite direction

   /* This example lists all cases of shrink */
   real  r = 1;
   box   b = {{1,2},{3,4}};

   // box and scalar
   echo(b-r); // {{X = 2, Y = 3}, {X = 2, Y = 3}}
   echo(r-b); // error - unexpected operand type

Scale

Works on point or box.

   /* This example lists all cases of scale */
   real  r = 10;
   point p = {1,2};
   box   b = {{1,2},{3,4}};

   //Point and scalar
   echo(p*r); // {X = 10, Y = 20}
   echo(r*p); // {X = 10, Y = 20}
   echo(p/r); // {X = 0.1, Y = 0.2}
   echo(r/p); // error - unexpected operand type

   // box and scalar
   echo(b*r); // {{X = 10, Y = 20}, {X = 30, Y = 40}}
   echo(r*b); // {{X = 10, Y = 20}, {X = 30, Y = 40}}
   echo(b/r); // {{X = 0.1, Y = 0.2}, {X = 0.3, Y = 0.4}}
   echo(r/b); // error - unexpected operand type

Directional shift

In addition to the above operators Tell defines another set of operators for convenience.

[Tip]directional shift operators

result = op1 <shift_operator> op2

result
has always the type of op1
op1, op2
Possible operand types are listed in table below
<shift_operator>
the operator itself - four directions defined, see below

Table?7.?Directional shift operands

op1\op2 int point
point OK OK
box OK OK

This class of operators has the same precedence as arithmetic addition or subtraction. Four operators are defined. The idea behind the syntax choice is that the chars constitute an angle which points in the direction of the shift.

Table?8.?Directional shift operators

operator Description
/| shift North East
|\ shift North West
\| shift South East
|/ shift South West

Some of the cases have direct arithmetic representation and the introduction of the shift operator can be seen as a syntactic sugar

Example?1.?shift a point

   point a = {1,1};
   point a1;
   point a2;
   point a3;
   a1 = a /| 1;                  // will produce the same as
   a2 = {a.x + 1, a.y + 1}       // or
   a3 = a + 1;                   // (shift)
   //
   a1 = a |/ 1;                  // will produce the same as
   a2 = {a.x - 1, a.y - 1}       // or
   a3 = a - 1;                   //(shift)
   //
   a1 = a |\ 1;                  // will produce the same as
   a2 = {a.x - 1, a.y + 1}       //
   //
   a1 = a \| 1;                  // will produce the same as
   a2 = {a.x + 1, a.y - 1}       //
   //-------------------------------------------------
   point b = {1,2};
   a1 = a /| b;                  // will produce the same as
   a2 = {a.x + b.x, a.y + b.y}   // or
   a3 = a + b;                   // (shift)
   //
   a1 = a |/ b;                  // will produce the same as
   a2 = {a.x - b.x, a.y - b.y}   // or
   a3 = a - b;                   // (shift)
   //
   a1 = a |\ b;                  // will produce the same as
   a2 = {a.x - b.x, a.y + b.y}   //
   //
   a1 = a \| b;                  // will produce the same as
   a2 = {a.x + b.x, a.y - b.y}   //

When the operator is applied to a box, only one vertex of the box is shifted - the target vertex. Depending on the operator it is top right(NE), top left (NW), bottom right(SE) or bottom left (SW) corner of the box.

Example?2.?shift a box

   point b = {1,2};
   // The boxes below represent equivalent planar objects
   box bx1 = {{ 1, 1}, {11,11}};
   box bx2 = {{ 1,11}, {11, 1}};
   // after shift the result is also equivalent planar objects
   box bx1a;
   box bx2a;
   bx1a = bx1 /| b; // shifting the top right corner
   bx2a = bx2 /| b; // of the box

top

网赌被黑取款通道维护异常不给怎么办