feat: replace IO class with System class and remove separate IO module

- Delete wren_io.c, wren_io.h, and io.wren source files
- Remove multi-arity print overloads and IO.read/IO.time methods
- Add System class with print, printAll, write, writeAll methods to core.wren
- Update all documentation examples and README to use System.print instead of IO.print
This commit is contained in:
Bob Nystrom
2015-09-15 14:46:09 +00:00
parent f12581a674
commit aa72900a9e
491 changed files with 3285 additions and 3544 deletions
+5 -5
View File
@@ -1,15 +1,15 @@
// Simple.
IO.print("".bytes.count) // expect: 0
IO.print("123".bytes.count) // expect: 3
System.print("".bytes.count) // expect: 0
System.print("123".bytes.count) // expect: 3
// UTF-8.
// Bytes:
// 123456789
// Chars: sø mé ஃ
IO.print("søméஃ".bytes.count) // expect: 9
System.print("søméஃ".bytes.count) // expect: 9
// Null bytes.
IO.print("\0\0\0".bytes.count) // expect: 3
System.print("\0\0\0".bytes.count) // expect: 3
// Invalid UTF-8.
IO.print("\xef\xf7".bytes.count) // expect: 2
System.print("\xef\xf7".bytes.count) // expect: 2
+13 -13
View File
@@ -3,19 +3,19 @@
// Chars: sø mé ஃ
var bytes = "søméஃ".bytes
IO.print(bytes.iterate(null)) // expect: 0
IO.print("".bytes.iterate(null)) // expect: false
System.print(bytes.iterate(null)) // expect: 0
System.print("".bytes.iterate(null)) // expect: false
IO.print(bytes.iterate(0)) // expect: 1
IO.print(bytes.iterate(1)) // expect: 2
IO.print(bytes.iterate(2)) // expect: 3
IO.print(bytes.iterate(3)) // expect: 4
IO.print(bytes.iterate(4)) // expect: 5
IO.print(bytes.iterate(5)) // expect: 6
IO.print(bytes.iterate(6)) // expect: 7
IO.print(bytes.iterate(7)) // expect: 8
IO.print(bytes.iterate(8)) // expect: false
System.print(bytes.iterate(0)) // expect: 1
System.print(bytes.iterate(1)) // expect: 2
System.print(bytes.iterate(2)) // expect: 3
System.print(bytes.iterate(3)) // expect: 4
System.print(bytes.iterate(4)) // expect: 5
System.print(bytes.iterate(5)) // expect: 6
System.print(bytes.iterate(6)) // expect: 7
System.print(bytes.iterate(7)) // expect: 8
System.print(bytes.iterate(8)) // expect: false
// Out of bounds.
IO.print(bytes.iterate(123)) // expect: false
IO.print(bytes.iterate(-1)) // expect: false
System.print(bytes.iterate(123)) // expect: false
System.print(bytes.iterate(-1)) // expect: false
@@ -3,22 +3,22 @@
// Chars: sø mé ஃ
var bytes = "søméஃ".bytes
IO.print(bytes.iteratorValue(0)) // expect: 115
IO.print(bytes.iteratorValue(1)) // expect: 195
IO.print(bytes.iteratorValue(2)) // expect: 184
IO.print(bytes.iteratorValue(3)) // expect: 109
IO.print(bytes.iteratorValue(4)) // expect: 195
IO.print(bytes.iteratorValue(5)) // expect: 169
IO.print(bytes.iteratorValue(6)) // expect: 224
IO.print(bytes.iteratorValue(7)) // expect: 174
IO.print(bytes.iteratorValue(8)) // expect: 131
System.print(bytes.iteratorValue(0)) // expect: 115
System.print(bytes.iteratorValue(1)) // expect: 195
System.print(bytes.iteratorValue(2)) // expect: 184
System.print(bytes.iteratorValue(3)) // expect: 109
System.print(bytes.iteratorValue(4)) // expect: 195
System.print(bytes.iteratorValue(5)) // expect: 169
System.print(bytes.iteratorValue(6)) // expect: 224
System.print(bytes.iteratorValue(7)) // expect: 174
System.print(bytes.iteratorValue(8)) // expect: 131
IO.print(bytes.iteratorValue(-9)) // expect: 115
IO.print(bytes.iteratorValue(-8)) // expect: 195
IO.print(bytes.iteratorValue(-7)) // expect: 184
IO.print(bytes.iteratorValue(-6)) // expect: 109
IO.print(bytes.iteratorValue(-5)) // expect: 195
IO.print(bytes.iteratorValue(-4)) // expect: 169
IO.print(bytes.iteratorValue(-3)) // expect: 224
IO.print(bytes.iteratorValue(-2)) // expect: 174
IO.print(bytes.iteratorValue(-1)) // expect: 131
System.print(bytes.iteratorValue(-9)) // expect: 115
System.print(bytes.iteratorValue(-8)) // expect: 195
System.print(bytes.iteratorValue(-7)) // expect: 184
System.print(bytes.iteratorValue(-6)) // expect: 109
System.print(bytes.iteratorValue(-5)) // expect: 195
System.print(bytes.iteratorValue(-4)) // expect: 169
System.print(bytes.iteratorValue(-3)) // expect: 224
System.print(bytes.iteratorValue(-2)) // expect: 174
System.print(bytes.iteratorValue(-1)) // expect: 131
+18 -18
View File
@@ -3,22 +3,22 @@
// Chars: sø mé ஃ
var bytes = "søméஃ".bytes
IO.print(bytes[0]) // expect: 115
IO.print(bytes[1]) // expect: 195
IO.print(bytes[2]) // expect: 184
IO.print(bytes[3]) // expect: 109
IO.print(bytes[4]) // expect: 195
IO.print(bytes[5]) // expect: 169
IO.print(bytes[6]) // expect: 224
IO.print(bytes[7]) // expect: 174
IO.print(bytes[8]) // expect: 131
System.print(bytes[0]) // expect: 115
System.print(bytes[1]) // expect: 195
System.print(bytes[2]) // expect: 184
System.print(bytes[3]) // expect: 109
System.print(bytes[4]) // expect: 195
System.print(bytes[5]) // expect: 169
System.print(bytes[6]) // expect: 224
System.print(bytes[7]) // expect: 174
System.print(bytes[8]) // expect: 131
IO.print(bytes[-9]) // expect: 115
IO.print(bytes[-8]) // expect: 195
IO.print(bytes[-7]) // expect: 184
IO.print(bytes[-6]) // expect: 109
IO.print(bytes[-5]) // expect: 195
IO.print(bytes[-4]) // expect: 169
IO.print(bytes[-3]) // expect: 224
IO.print(bytes[-2]) // expect: 174
IO.print(bytes[-1]) // expect: 131
System.print(bytes[-9]) // expect: 115
System.print(bytes[-8]) // expect: 195
System.print(bytes[-7]) // expect: 184
System.print(bytes[-6]) // expect: 109
System.print(bytes[-5]) // expect: 195
System.print(bytes[-4]) // expect: 169
System.print(bytes[-3]) // expect: 224
System.print(bytes[-2]) // expect: 174
System.print(bytes[-1]) // expect: 131