Changeset 37f527b in mainline for uspace/dist/sysel/list.sy


Ignore:
Timestamp:
2010-03-26T21:55:23Z (14 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.