Changeset 051bc69a in mainline for uspace/dist/src/sysel
- Timestamp:
- 2010-05-08T08:10:44Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 640ffe6, c5cb943d
- Parents:
- 25a76ab8
- Location:
- uspace/dist/src/sysel
- Files:
-
- 4 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/dist/src/sysel/demos/htxtfile.sy
r25a76ab8 r051bc69a 43 43 out_file.OpenWrite("/out.txt"); 44 44 45 while in_file.EOF != 1do45 while not in_file.EOF do 46 46 line = in_file.ReadLine(); 47 47 Builtin.WriteLine(name + ": " + line); -
uspace/dist/src/sysel/demos/list.sy
r25a76ab8 r051bc69a 33 33 34 34 list = new List/int(); 35 list.Init();36 35 37 36 list.Append(5); … … 44 43 n = list.First; 45 44 while n != nil do 46 Builtin.WriteLine(n. Value);45 Builtin.WriteLine(n.Data); 47 46 n = n.Next; 48 47 end -
uspace/dist/src/sysel/demos/string.sy
r25a76ab8 r051bc69a 39 39 i = i + 1; 40 40 end 41 42 Builtin.WriteLine("Abracadabra".Slice(2, 4)); 41 43 end 42 44 end -
uspace/dist/src/sysel/demos/varargs.sy
r25a76ab8 r051bc69a 35 35 fun Print(args : string[], packed) is 36 36 var i : int; 37 var error : int;37 var error : bool; 38 38 39 error = 0;39 error = false; 40 40 i = 0; 41 while error == 0do41 while not error do 42 42 -- This is definitely the wrong way to determine 43 43 -- array bounds, but until a better one is … … 46 46 Builtin.WriteLine(args[i]); 47 47 except e : Error.OutOfBounds do 48 error = 1;48 error = true; 49 49 end 50 50 -
uspace/dist/src/sysel/lib/boxed.sy
r25a76ab8 r051bc69a 46 46 class String is 47 47 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; 48 60 end -
uspace/dist/src/sysel/lib/libflist
r25a76ab8 r051bc69a 2 2 boxed.sy 3 3 list.sy 4 map.sy -
uspace/dist/src/sysel/lib/list.sy
r25a76ab8 r051bc69a 31 31 var head : ListNode/t; 32 32 33 -- Initializelist.34 fun Init() is33 -- New empty list. 34 new() is 35 35 head = new ListNode/t(); 36 36 head.prev = head; … … 46 46 47 47 n = new ListNode/t(); 48 n. value= data;48 n.data = data; 49 49 50 50 n.prev = ntl; … … 74 74 75 75 class ListNode/t is 76 var value: t;76 var data : t; 77 77 78 78 var prev : ListNode/t; … … 80 80 var head : ListNode/t; 81 81 82 -- Valuestored in this node.83 prop Value: t is82 -- Data stored in this node. 83 prop Data : t is 84 84 get is 85 return value;85 return data; 86 86 end 87 87 end … … 99 99 return get_next(); 100 100 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; 101 114 end 102 115
Note:
See TracChangeset
for help on using the changeset viewer.