Changeset 37f527b in mainline for uspace/dist


Ignore:
Timestamp:
2010-03-26T21:55:23Z (16 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4204ad9
Parents:
b535aeb
Message:

Update SBI to rev. 144.

Location:
uspace/dist/sysel
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/dist/sysel/except.sy

    rb535aeb r37f527b  
    2828
    2929class ExceptionDemo is
    30         fun foo() : int is
     30        fun foo() is
    3131                Builtin.WriteLine("Entered foo().");
    3232                raise new BaseException();
  • uspace/dist/sysel/hexec.sy

    rb535aeb r37f527b  
    2929class HelenOSExecDemo is
    3030        fun Main() is
    31                 Builtin.Exec("/app/tester");
    32                 Builtin.Exec("/app/tester", "print1");
     31                Task.Exec("/app/tester");
     32                Task.Exec("/app/tester", "print1");
    3333        end
    3434end
  • uspace/dist/sysel/inherit.sy

    rb535aeb r37f527b  
    4545        fun Main() is
    4646                var a : A;
     47                var c : C;
    4748
     49                -- Construct and assign object.
    4850                a = new A();
    4951                a.Foo();
    5052
     53                -- Implicit conversion to base type.
    5154                a = new B();
    5255                a.Foo();
     
    5457                a = new C();
    5558                a.Foo();
     59
     60                -- Test 'as' operator for conversion to derived type.
     61                c = a as C;
     62
     63                -- Test grandfather class.
     64                var d : Object;
     65                d = a;
     66                d = new B();
     67                d = c;
    5668        end
    5769end
  • uspace/dist/sysel/list.sy

    rb535aeb r37f527b  
    2727--
    2828
     29-- Doubly-linked list implementation.
    2930class List is
    3031        var head : ListNode;
    3132
     33        -- Initialize list.
    3234        fun Init() is
    3335                head = new ListNode();
     
    3638        end
    3739
     40        -- Append new entry at the end of the list.
    3841        fun Append(data : int) is
    3942                var n : ListNode;
     
    5356        end
    5457
    55         fun GetFirst() : ListNode is
    56                 return head.next;
     58        -- Return first node in the list or @c nil if there is none.
     59        prop First : ListNode is
     60                get is
     61                    return get_first();
     62                end
     63        end
     64
     65        -- Return first node in the list or @c nil if there is none.
     66        fun get_first() : ListNode is
     67                if head.next == head then
     68                        return nil;
     69                else
     70                        return head.next;
     71                end
    5772        end
    5873end
     
    6580        var head : ListNode;
    6681
    67         fun GetNext() : ListNode is
     82        -- Value stored in this node.
     83        prop Value : int is
     84                get is
     85                        return value;
     86                end
     87        end
     88
     89        -- Previous node in list.
     90        prop Prev : ListNode is
     91                get is
     92                        return get_prev();
     93                end
     94        end
     95
     96        -- Next node in list.
     97        prop Next : ListNode is
     98                get is
     99                        return get_next();
     100                end
     101        end
     102
     103        -- Get next node.
     104        fun get_next() : ListNode is
    68105                if next != head then
    69106                        return next;
     
    73110        end
    74111
    75         fun GetPrev() : ListNode is
     112        -- Get previous node.
     113        fun get_prev() : ListNode is
    76114                if prev != head then
    77115                        return next;
     
    81119        end
    82120
    83         fun GetValue() : int is
    84                 return value;
    85         end
    86121end
    87122
     
    100135                var n : ListNode;
    101136
    102                 n = list.GetFirst();
     137                n = list.First;
    103138                while n != nil do
    104139                        Builtin.WriteLine(n.value);
    105                         n = n.GetNext();
     140                        n = n.Next;
    106141                end
    107142        end
  • uspace/dist/sysel/property.sy

    rb535aeb r37f527b  
    2727--
    2828
    29 class A is
     29class Foo is
    3030        var x : int;
    3131
     
    6868                end
    6969        end
     70
     71        --
     72        -- Class-type property. This is used for demonstrating property
     73        -- field access. This case is still quite easy. It does not require
     74        -- read-modify-write. Since class is a reference type, access
     75        -- operator will read the value and dereference it, thereby
     76        -- getting somewhere else (so the value will not be modified and
     77        -- need not be written back).
     78        --
     79
     80        var bprop : Bar;
     81
     82        prop B : Bar is
     83                get is
     84                        Builtin.WriteLine("Getting B");
     85                        return bprop;
     86                end
     87                set value is
     88                        Builtin.WriteLine("Setting B");
     89                        bprop = value;
     90                end
     91        end
     92
     93end
     94
     95class Bar is
     96        var i : int;
    7097end
    7198
    7299class PropertyDemo is
    73100        fun Main() is
    74                 var a : A;
     101                var a : Foo;
    75102                var i : int;
    76103
    77                 a = new A();
     104                a = new Foo();
    78105
    79106                -- Get value of named property.
     
    96123                Builtin.WriteLine("Main(): Got ");
    97124                Builtin.WriteLine(i);
     125
     126                -- Property field access
     127                var b : Bar;
     128
     129                b = new Bar();
     130
     131                b.i = 42;
     132                a.bprop = b;
     133
     134                Builtin.WriteLine(a.bprop.i);
     135                a.bprop.i = 2;
     136                Builtin.WriteLine(a.bprop.i);
    98137        end
    99138end
  • uspace/dist/sysel/string.sy

    rb535aeb r37f527b  
    3131                -- Concatenate some strings.
    3232                Builtin.WriteLine("One-" + "two-" + "three!");
     33
     34                -- Extract characters from a string.
     35                var i : int;
     36                i = 0;
     37                while i < 5 do
     38                        Builtin.WriteLine("ABCDE"[i]);
     39                        i = i + 1;
     40                end
    3341        end
    3442end
Note: See TracChangeset for help on using the changeset viewer.