Changeset 051bc69a in mainline for uspace/dist/src/sysel


Ignore:
Timestamp:
2010-05-08T08:10:44Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
640ffe6, c5cb943d
Parents:
25a76ab8
Message:

Update SBI to rev. 244.

Location:
uspace/dist/src/sysel
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/dist/src/sysel/demos/htxtfile.sy

    r25a76ab8 r051bc69a  
    4343                out_file.OpenWrite("/out.txt");
    4444
    45                 while in_file.EOF != 1 do
     45                while not in_file.EOF do
    4646                        line = in_file.ReadLine();
    4747                        Builtin.WriteLine(name + ": " + line);
  • uspace/dist/src/sysel/demos/list.sy

    r25a76ab8 r051bc69a  
    3333
    3434                list = new List/int();
    35                 list.Init();
    3635
    3736                list.Append(5);
     
    4443                n = list.First;
    4544                while n != nil do
    46                         Builtin.WriteLine(n.Value);
     45                        Builtin.WriteLine(n.Data);
    4746                        n = n.Next;
    4847                end
  • uspace/dist/src/sysel/demos/string.sy

    r25a76ab8 r051bc69a  
    3939                        i = i + 1;
    4040                end
     41
     42                Builtin.WriteLine("Abracadabra".Slice(2, 4));
    4143        end
    4244end
  • uspace/dist/src/sysel/demos/varargs.sy

    r25a76ab8 r051bc69a  
    3535        fun Print(args : string[], packed) is
    3636                var i : int;
    37                 var error : int;
     37                var error : bool;
    3838
    39                 error = 0;
     39                error = false;
    4040                i = 0;
    41                 while error == 0 do
     41                while not error do
    4242                        -- This is definitely the wrong way to determine
    4343                        -- array bounds, but until a better one is
     
    4646                                Builtin.WriteLine(args[i]);
    4747                        except e : Error.OutOfBounds do
    48                                 error = 1;
     48                                error = true;
    4949                        end
    5050
  • uspace/dist/src/sysel/lib/boxed.sy

    r25a76ab8 r051bc69a  
    4646class String is
    4747        var Value : string;
     48
     49        fun get_length() : int, builtin;
     50
     51        -- Length of string.
     52        prop Length : int is
     53                get is
     54                        return get_length();
     55                end
     56        end
     57
     58        -- Slice (sub-string).
     59        fun Slice(start : int; length : int) : string, builtin;
    4860end
  • uspace/dist/src/sysel/lib/libflist

    r25a76ab8 r051bc69a  
    22boxed.sy
    33list.sy
     4map.sy
  • uspace/dist/src/sysel/lib/list.sy

    r25a76ab8 r051bc69a  
    3131        var head : ListNode/t;
    3232
    33         -- Initialize list.
    34         fun Init() is
     33        -- New empty list.
     34        new() is
    3535                head = new ListNode/t();
    3636                head.prev = head;
     
    4646
    4747                n = new ListNode/t();
    48                 n.value = data;
     48                n.data = data;
    4949
    5050                n.prev = ntl;
     
    7474
    7575class ListNode/t is
    76         var value : t;
     76        var data : t;
    7777
    7878        var prev : ListNode/t;
     
    8080        var head : ListNode/t;
    8181
    82         -- Value stored in this node.
    83         prop Value : t is
     82        -- Data stored in this node.
     83        prop Data : t is
    8484                get is
    85                         return value;
     85                        return data;
    8686                end
    8787        end
     
    9999                        return get_next();
    100100                end
     101        end
     102
     103        -- Remove node from list.
     104        fun Remove() is
     105                var p : ListNode/t;
     106                var n : ListNode/t;
     107
     108                p = prev; n = next;
     109                p.next = n;
     110                n.prev = p;
     111
     112                prev = nil;
     113                next = nil;
    101114        end
    102115
Note: See TracChangeset for help on using the changeset viewer.