diff --git a/kotstd/include/Console.kt b/kotstd/include/Console.kt index d06919b0fb1..aea57dbabc8 100644 --- a/kotstd/include/Console.kt +++ b/kotstd/include/Console.kt @@ -1,5 +1,7 @@ import ByteArray import IntArray +import LongArray +import ShortArray /* * Library for console interaction @@ -85,6 +87,16 @@ fun print(message: IntArray) { message.print() } +/** Prints the given message and newline to the standard output stream. */ +fun print(message: LongArray) { + message.print() +} + +/** Prints the given message and newline to the standard output stream. */ +fun print(message: ShortArray) { + message.print() +} + /** Prints the given message and newline to the standard output stream. */ fun println(message: Int) { @@ -146,6 +158,16 @@ fun println(message: IntArray) { message.println() } +/** Prints the given message and newline to the standard output stream. */ +fun println(message: LongArray) { + message.println() +} + +/** Prints the given message and newline to the standard output stream. */ +fun println(message: ShortArray) { + message.println() +} + /** Prints newline to the standard output stream. */ fun println() { kotlinclib_println() diff --git a/kotstd/include/LongArray.kt b/kotstd/include/LongArray.kt index 210b22625b7..989cc4198a6 100644 --- a/kotstd/include/LongArray.kt +++ b/kotstd/include/LongArray.kt @@ -43,6 +43,25 @@ class LongArray(var size: Int) { } } +fun LongArray.print() { + var index = 0 + print('[') + while (index < size) { + print(get(index)) + index++ + if (index < size) { + print(';') + print(' ') + } + } + print(']') +} + +fun LongArray.println() { + this.print() + println() +} + fun LongArray.copyOf(newSize: Int): LongArray { val newInstance = LongArray(newSize) var index = 0 diff --git a/kotstd/include/ShortArray.kt b/kotstd/include/ShortArray.kt index 798fa96975f..dd7e438ba23 100644 --- a/kotstd/include/ShortArray.kt +++ b/kotstd/include/ShortArray.kt @@ -44,6 +44,26 @@ class ShortArray(var size: Int) { } +fun ShortArray.print() { + var index = 0 + print('[') + while (index < size) { + print(get(index)) + index++ + if (index < size) { + print(';') + print(' ') + } + } + print(']') +} + +fun ShortArray.println() { + this.print() + println() +} + + fun ShortArray.copyOf(newSize: Int): ShortArray { val newInstance = ShortArray(newSize) var index = 0