[stdlib] Explicit visibility and return types: Native
This commit is contained in:
committed by
Space Team
parent
43fc4ccf40
commit
c77930c1ea
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:Suppress("DEPRECATION_ERROR", "TYPEALIAS_EXPANSION_DEPRECATION_ERROR", "UNUSED_PARAMETER") // Everything is scheduled for removal
|
||||
@file:Suppress("DEPRECATION_ERROR", "TYPEALIAS_EXPANSION_DEPRECATION_ERROR", "UNUSED_PARAMETER", "NO_EXPLICIT_VISIBILITY_IN_API_MODE", "NO_EXPLICIT_RETURN_TYPE_IN_API_MODE") // Everything is scheduled for removal
|
||||
@file:OptIn(ExperimentalForeignApi::class)
|
||||
|
||||
package kotlinx.wasm.jsinterop
|
||||
|
||||
@@ -9,312 +9,312 @@ package kotlinx.cinterop
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$Byte")
|
||||
inline operator fun <T : ByteVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
public inline operator fun <T : ByteVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
interpretCPointer(this.rawValue + index * 1)
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$Byte")
|
||||
inline operator fun <T : ByteVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
public inline operator fun <T : ByteVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
this + index.toLong()
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("get\$Byte")
|
||||
inline operator fun <T : Byte> CPointer<ByteVarOf<T>>.get(index: Int): T =
|
||||
public inline operator fun <T : Byte> CPointer<ByteVarOf<T>>.get(index: Int): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("set\$Byte")
|
||||
inline operator fun <T : Byte> CPointer<ByteVarOf<T>>.set(index: Int, value: T) {
|
||||
public inline operator fun <T : Byte> CPointer<ByteVarOf<T>>.set(index: Int, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("get\$Byte")
|
||||
inline operator fun <T : Byte> CPointer<ByteVarOf<T>>.get(index: Long): T =
|
||||
public inline operator fun <T : Byte> CPointer<ByteVarOf<T>>.get(index: Long): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("set\$Byte")
|
||||
inline operator fun <T : Byte> CPointer<ByteVarOf<T>>.set(index: Long, value: T) {
|
||||
public inline operator fun <T : Byte> CPointer<ByteVarOf<T>>.set(index: Long, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$Short")
|
||||
inline operator fun <T : ShortVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
public inline operator fun <T : ShortVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
interpretCPointer(this.rawValue + index * 2)
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$Short")
|
||||
inline operator fun <T : ShortVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
public inline operator fun <T : ShortVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
this + index.toLong()
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("get\$Short")
|
||||
inline operator fun <T : Short> CPointer<ShortVarOf<T>>.get(index: Int): T =
|
||||
public inline operator fun <T : Short> CPointer<ShortVarOf<T>>.get(index: Int): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("set\$Short")
|
||||
inline operator fun <T : Short> CPointer<ShortVarOf<T>>.set(index: Int, value: T) {
|
||||
public inline operator fun <T : Short> CPointer<ShortVarOf<T>>.set(index: Int, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("get\$Short")
|
||||
inline operator fun <T : Short> CPointer<ShortVarOf<T>>.get(index: Long): T =
|
||||
public inline operator fun <T : Short> CPointer<ShortVarOf<T>>.get(index: Long): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("set\$Short")
|
||||
inline operator fun <T : Short> CPointer<ShortVarOf<T>>.set(index: Long, value: T) {
|
||||
public inline operator fun <T : Short> CPointer<ShortVarOf<T>>.set(index: Long, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$Int")
|
||||
inline operator fun <T : IntVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
public inline operator fun <T : IntVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
interpretCPointer(this.rawValue + index * 4)
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$Int")
|
||||
inline operator fun <T : IntVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
public inline operator fun <T : IntVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
this + index.toLong()
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("get\$Int")
|
||||
inline operator fun <T : Int> CPointer<IntVarOf<T>>.get(index: Int): T =
|
||||
public inline operator fun <T : Int> CPointer<IntVarOf<T>>.get(index: Int): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("set\$Int")
|
||||
inline operator fun <T : Int> CPointer<IntVarOf<T>>.set(index: Int, value: T) {
|
||||
public inline operator fun <T : Int> CPointer<IntVarOf<T>>.set(index: Int, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("get\$Int")
|
||||
inline operator fun <T : Int> CPointer<IntVarOf<T>>.get(index: Long): T =
|
||||
public inline operator fun <T : Int> CPointer<IntVarOf<T>>.get(index: Long): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("set\$Int")
|
||||
inline operator fun <T : Int> CPointer<IntVarOf<T>>.set(index: Long, value: T) {
|
||||
public inline operator fun <T : Int> CPointer<IntVarOf<T>>.set(index: Long, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$Long")
|
||||
inline operator fun <T : LongVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
public inline operator fun <T : LongVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
interpretCPointer(this.rawValue + index * 8)
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$Long")
|
||||
inline operator fun <T : LongVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
public inline operator fun <T : LongVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
this + index.toLong()
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("get\$Long")
|
||||
inline operator fun <T : Long> CPointer<LongVarOf<T>>.get(index: Int): T =
|
||||
public inline operator fun <T : Long> CPointer<LongVarOf<T>>.get(index: Int): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("set\$Long")
|
||||
inline operator fun <T : Long> CPointer<LongVarOf<T>>.set(index: Int, value: T) {
|
||||
public inline operator fun <T : Long> CPointer<LongVarOf<T>>.set(index: Int, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("get\$Long")
|
||||
inline operator fun <T : Long> CPointer<LongVarOf<T>>.get(index: Long): T =
|
||||
public inline operator fun <T : Long> CPointer<LongVarOf<T>>.get(index: Long): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("set\$Long")
|
||||
inline operator fun <T : Long> CPointer<LongVarOf<T>>.set(index: Long, value: T) {
|
||||
public inline operator fun <T : Long> CPointer<LongVarOf<T>>.set(index: Long, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$UByte")
|
||||
inline operator fun <T : UByteVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
public inline operator fun <T : UByteVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
interpretCPointer(this.rawValue + index * 1)
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$UByte")
|
||||
inline operator fun <T : UByteVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
public inline operator fun <T : UByteVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
this + index.toLong()
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("get\$UByte")
|
||||
inline operator fun <T : UByte> CPointer<UByteVarOf<T>>.get(index: Int): T =
|
||||
public inline operator fun <T : UByte> CPointer<UByteVarOf<T>>.get(index: Int): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
inline operator fun <T : UByte> CPointer<UByteVarOf<T>>.set(index: Int, value: T) {
|
||||
public inline operator fun <T : UByte> CPointer<UByteVarOf<T>>.set(index: Int, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
inline operator fun <T : UByte> CPointer<UByteVarOf<T>>.get(index: Long): T =
|
||||
public inline operator fun <T : UByte> CPointer<UByteVarOf<T>>.get(index: Long): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
inline operator fun <T : UByte> CPointer<UByteVarOf<T>>.set(index: Long, value: T) {
|
||||
public inline operator fun <T : UByte> CPointer<UByteVarOf<T>>.set(index: Long, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$UShort")
|
||||
inline operator fun <T : UShortVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
public inline operator fun <T : UShortVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
interpretCPointer(this.rawValue + index * 2)
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$UShort")
|
||||
inline operator fun <T : UShortVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
public inline operator fun <T : UShortVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
this + index.toLong()
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("get\$UShort")
|
||||
inline operator fun <T : UShort> CPointer<UShortVarOf<T>>.get(index: Int): T =
|
||||
public inline operator fun <T : UShort> CPointer<UShortVarOf<T>>.get(index: Int): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
inline operator fun <T : UShort> CPointer<UShortVarOf<T>>.set(index: Int, value: T) {
|
||||
public inline operator fun <T : UShort> CPointer<UShortVarOf<T>>.set(index: Int, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("get\$UShort")
|
||||
inline operator fun <T : UShort> CPointer<UShortVarOf<T>>.get(index: Long): T =
|
||||
public inline operator fun <T : UShort> CPointer<UShortVarOf<T>>.get(index: Long): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
inline operator fun <T : UShort> CPointer<UShortVarOf<T>>.set(index: Long, value: T) {
|
||||
public inline operator fun <T : UShort> CPointer<UShortVarOf<T>>.set(index: Long, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$UInt")
|
||||
inline operator fun <T : UIntVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
public inline operator fun <T : UIntVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
interpretCPointer(this.rawValue + index * 4)
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$UInt")
|
||||
inline operator fun <T : UIntVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
public inline operator fun <T : UIntVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
this + index.toLong()
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("get\$UInt")
|
||||
inline operator fun <T : UInt> CPointer<UIntVarOf<T>>.get(index: Int): T =
|
||||
public inline operator fun <T : UInt> CPointer<UIntVarOf<T>>.get(index: Int): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
inline operator fun <T : UInt> CPointer<UIntVarOf<T>>.set(index: Int, value: T) {
|
||||
public inline operator fun <T : UInt> CPointer<UIntVarOf<T>>.set(index: Int, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("get\$UInt")
|
||||
inline operator fun <T : UInt> CPointer<UIntVarOf<T>>.get(index: Long): T =
|
||||
public inline operator fun <T : UInt> CPointer<UIntVarOf<T>>.get(index: Long): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
inline operator fun <T : UInt> CPointer<UIntVarOf<T>>.set(index: Long, value: T) {
|
||||
public inline operator fun <T : UInt> CPointer<UIntVarOf<T>>.set(index: Long, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$ULong")
|
||||
inline operator fun <T : ULongVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
public inline operator fun <T : ULongVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
interpretCPointer(this.rawValue + index * 8)
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$ULong")
|
||||
inline operator fun <T : ULongVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
public inline operator fun <T : ULongVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
this + index.toLong()
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("get\$ULong")
|
||||
inline operator fun <T : ULong> CPointer<ULongVarOf<T>>.get(index: Int): T =
|
||||
public inline operator fun <T : ULong> CPointer<ULongVarOf<T>>.get(index: Int): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
inline operator fun <T : ULong> CPointer<ULongVarOf<T>>.set(index: Int, value: T) {
|
||||
public inline operator fun <T : ULong> CPointer<ULongVarOf<T>>.set(index: Int, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("get\$ULong")
|
||||
inline operator fun <T : ULong> CPointer<ULongVarOf<T>>.get(index: Long): T =
|
||||
public inline operator fun <T : ULong> CPointer<ULongVarOf<T>>.get(index: Long): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
inline operator fun <T : ULong> CPointer<ULongVarOf<T>>.set(index: Long, value: T) {
|
||||
public inline operator fun <T : ULong> CPointer<ULongVarOf<T>>.set(index: Long, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$Float")
|
||||
inline operator fun <T : FloatVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
public inline operator fun <T : FloatVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
interpretCPointer(this.rawValue + index * 4)
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$Float")
|
||||
inline operator fun <T : FloatVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
public inline operator fun <T : FloatVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
this + index.toLong()
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("get\$Float")
|
||||
inline operator fun <T : Float> CPointer<FloatVarOf<T>>.get(index: Int): T =
|
||||
public inline operator fun <T : Float> CPointer<FloatVarOf<T>>.get(index: Int): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("set\$Float")
|
||||
inline operator fun <T : Float> CPointer<FloatVarOf<T>>.set(index: Int, value: T) {
|
||||
public inline operator fun <T : Float> CPointer<FloatVarOf<T>>.set(index: Int, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("get\$Float")
|
||||
inline operator fun <T : Float> CPointer<FloatVarOf<T>>.get(index: Long): T =
|
||||
public inline operator fun <T : Float> CPointer<FloatVarOf<T>>.get(index: Long): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("set\$Float")
|
||||
inline operator fun <T : Float> CPointer<FloatVarOf<T>>.set(index: Long, value: T) {
|
||||
public inline operator fun <T : Float> CPointer<FloatVarOf<T>>.set(index: Long, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$Double")
|
||||
inline operator fun <T : DoubleVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
public inline operator fun <T : DoubleVarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? =
|
||||
interpretCPointer(this.rawValue + index * 8)
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("plus\$Double")
|
||||
inline operator fun <T : DoubleVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
public inline operator fun <T : DoubleVarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? =
|
||||
this + index.toLong()
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("get\$Double")
|
||||
inline operator fun <T : Double> CPointer<DoubleVarOf<T>>.get(index: Int): T =
|
||||
public inline operator fun <T : Double> CPointer<DoubleVarOf<T>>.get(index: Int): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("set\$Double")
|
||||
inline operator fun <T : Double> CPointer<DoubleVarOf<T>>.set(index: Int, value: T) {
|
||||
public inline operator fun <T : Double> CPointer<DoubleVarOf<T>>.set(index: Int, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("get\$Double")
|
||||
inline operator fun <T : Double> CPointer<DoubleVarOf<T>>.get(index: Long): T =
|
||||
public inline operator fun <T : Double> CPointer<DoubleVarOf<T>>.get(index: Long): T =
|
||||
(this + index)!!.pointed.value
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@JvmName("set\$Double")
|
||||
inline operator fun <T : Double> CPointer<DoubleVarOf<T>>.set(index: Long, value: T) {
|
||||
public inline operator fun <T : Double> CPointer<DoubleVarOf<T>>.set(index: Long, value: T) {
|
||||
(this + index)!!.pointed.value = value
|
||||
}
|
||||
|
||||
@@ -326,28 +326,28 @@ Seva: It probably means the reasoning of this API and is general applicability s
|
||||
|
||||
function gen {
|
||||
echo "@JvmName(\"plus\\\$$1\")"
|
||||
echo "inline operator fun <T : ${1}VarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? ="
|
||||
echo "public inline operator fun <T : ${1}VarOf<*>> CPointer<T>?.plus(index: Long): CPointer<T>? ="
|
||||
echo " interpretCPointer(this.rawValue + index * ${2})"
|
||||
echo
|
||||
echo "@JvmName(\"plus\\\$$1\")"
|
||||
echo "inline operator fun <T : ${1}VarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? ="
|
||||
echo "public inline operator fun <T : ${1}VarOf<*>> CPointer<T>?.plus(index: Int): CPointer<T>? ="
|
||||
echo " this + index.toLong()"
|
||||
echo
|
||||
echo "@JvmName(\"get\\\$$1\")"
|
||||
echo "inline operator fun <T : $1> CPointer<${1}VarOf<T>>.get(index: Int): T ="
|
||||
echo "public inline operator fun <T : $1> CPointer<${1}VarOf<T>>.get(index: Int): T ="
|
||||
echo " (this + index)!!.pointed.value"
|
||||
echo
|
||||
echo "@JvmName(\"set\\\$$1\")"
|
||||
echo "inline operator fun <T : $1> CPointer<${1}VarOf<T>>.set(index: Int, value: T) {"
|
||||
echo "public inline operator fun <T : $1> CPointer<${1}VarOf<T>>.set(index: Int, value: T) {"
|
||||
echo " (this + index)!!.pointed.value = value"
|
||||
echo '}'
|
||||
echo
|
||||
echo "@JvmName(\"get\\\$$1\")"
|
||||
echo "inline operator fun <T : $1> CPointer<${1}VarOf<T>>.get(index: Long): T ="
|
||||
echo "public inline operator fun <T : $1> CPointer<${1}VarOf<T>>.get(index: Long): T ="
|
||||
echo " (this + index)!!.pointed.value"
|
||||
echo
|
||||
echo "@JvmName(\"set\\\$$1\")"
|
||||
echo "inline operator fun <T : $1> CPointer<${1}VarOf<T>>.set(index: Long, value: T) {"
|
||||
echo "public inline operator fun <T : $1> CPointer<${1}VarOf<T>>.set(index: Long, value: T) {"
|
||||
echo " (this + index)!!.pointed.value = value"
|
||||
echo '}'
|
||||
echo
|
||||
|
||||
@@ -19,12 +19,12 @@ public value class StableRef<out T : Any> @PublishedApi internal constructor(
|
||||
private val stablePtr: COpaquePointer
|
||||
) {
|
||||
|
||||
companion object {
|
||||
public companion object {
|
||||
|
||||
/**
|
||||
* Creates a handle for given object.
|
||||
*/
|
||||
fun <T : Any> create(any: T) = StableRef<T>(createStablePointer(any))
|
||||
public fun <T : Any> create(any: T): StableRef<T> = StableRef<T>(createStablePointer(any))
|
||||
|
||||
}
|
||||
|
||||
@@ -32,12 +32,12 @@ public value class StableRef<out T : Any> @PublishedApi internal constructor(
|
||||
* Converts the handle to C pointer.
|
||||
* @see [asStableRef]
|
||||
*/
|
||||
fun asCPointer(): COpaquePointer = this.stablePtr
|
||||
public fun asCPointer(): COpaquePointer = this.stablePtr
|
||||
|
||||
/**
|
||||
* Disposes the handle. It must not be used after that.
|
||||
*/
|
||||
fun dispose() {
|
||||
public fun dispose() {
|
||||
disposeStablePointer(this.stablePtr)
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public value class StableRef<out T : Any> @PublishedApi internal constructor(
|
||||
* Returns the object this handle was [created][StableRef.create] for.
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun get() = derefStablePointer(this.stablePtr) as T
|
||||
public fun get(): T = derefStablePointer(this.stablePtr) as T
|
||||
|
||||
}
|
||||
|
||||
@@ -53,4 +53,4 @@ public value class StableRef<out T : Any> @PublishedApi internal constructor(
|
||||
* Converts to [StableRef] this opaque pointer produced by [StableRef.asCPointer].
|
||||
*/
|
||||
@ExperimentalForeignApi
|
||||
inline fun <reified T : Any> CPointer<*>.asStableRef(): StableRef<T> = StableRef<T>(this).also { it.get() }
|
||||
public inline fun <reified T : Any> CPointer<*>.asStableRef(): StableRef<T> = StableRef<T>(this).also { it.get() }
|
||||
|
||||
@@ -17,7 +17,7 @@ import kotlin.native.*
|
||||
*/
|
||||
@ExperimentalForeignApi
|
||||
public open class NativePointed internal constructor(rawPtr: NonNullNativePtr) {
|
||||
var rawPtr = rawPtr.toNativePtr()
|
||||
public var rawPtr: NativePtr = rawPtr.toNativePtr()
|
||||
internal set
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public abstract class CValues<T : CVariable> : CValuesRef<T>() {
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
public fun <T : CVariable> CValues<T>.placeTo(scope: AutofreeScope) = this.getPointer(scope)
|
||||
public fun <T : CVariable> CValues<T>.placeTo(scope: AutofreeScope): CPointer<T> = this.getPointer(scope)
|
||||
|
||||
/**
|
||||
* The single immutable C value.
|
||||
@@ -161,9 +161,9 @@ public class CPointer<T : CPointed> internal constructor(@PublishedApi internal
|
||||
return rawValue.hashCode()
|
||||
}
|
||||
|
||||
public override fun toString() = this.cPointerToString()
|
||||
public override fun toString(): String = this.cPointerToString()
|
||||
|
||||
public override fun getPointer(scope: AutofreeScope) = this
|
||||
public override fun getPointer(scope: AutofreeScope): CPointer<T> = this
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,7 +191,7 @@ public val CPointer<*>?.rawValue: NativePtr
|
||||
public fun <T : CPointed> CPointer<*>.reinterpret(): CPointer<T> = interpretCPointer(this.rawValue)!!
|
||||
|
||||
@ExperimentalForeignApi
|
||||
public fun <T : CPointed> CPointer<T>?.toLong() = this.rawValue.toLong()
|
||||
public fun <T : CPointed> CPointer<T>?.toLong(): Long = this.rawValue.toLong()
|
||||
|
||||
@ExperimentalForeignApi
|
||||
public fun <T : CPointed> Long.toCPointer(): CPointer<T>? = interpretCPointer(nativeNullPtr + this)
|
||||
@@ -238,7 +238,7 @@ public abstract class CVariable(rawPtr: NativePtr) : CPointed(rawPtr) {
|
||||
* It may be greater than actually required for simplicity.
|
||||
*/
|
||||
@Deprecated("Use sizeOf<T>() or alignOf<T>() instead.")
|
||||
public open class Type(val size: Long, val align: Int) {
|
||||
public open class Type(public val size: Long, public val align: Int) {
|
||||
|
||||
init {
|
||||
require(size % align == 0L)
|
||||
@@ -249,11 +249,11 @@ public abstract class CVariable(rawPtr: NativePtr) : CPointed(rawPtr) {
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@ExperimentalForeignApi
|
||||
public inline fun <reified T : CVariable> sizeOf() = typeOf<T>().size
|
||||
public inline fun <reified T : CVariable> sizeOf(): Long = typeOf<T>().size
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@ExperimentalForeignApi
|
||||
public inline fun <reified T : CVariable> alignOf() = typeOf<T>().align
|
||||
public inline fun <reified T : CVariable> alignOf(): Int = typeOf<T>().align
|
||||
|
||||
/**
|
||||
* Returns the member of this [CStructVar] which is located by given offset in bytes.
|
||||
@@ -275,18 +275,18 @@ public inline fun <reified T : CVariable> CStructVar.arrayMemberAt(offset: Long)
|
||||
public abstract class CStructVar(rawPtr: NativePtr) : CVariable(rawPtr) {
|
||||
@Deprecated("Use sizeOf<T>() or alignOf<T>() instead.")
|
||||
@Suppress("DEPRECATION")
|
||||
open class Type(size: Long, align: Int) : CVariable.Type(size, align)
|
||||
public open class Type(size: Long, align: Int) : CVariable.Type(size, align)
|
||||
}
|
||||
|
||||
/**
|
||||
* The C primitive-typed variable located in memory.
|
||||
*/
|
||||
@ExperimentalForeignApi
|
||||
sealed class CPrimitiveVar(rawPtr: NativePtr) : CVariable(rawPtr) {
|
||||
public sealed class CPrimitiveVar(rawPtr: NativePtr) : CVariable(rawPtr) {
|
||||
// aligning by size is obviously enough
|
||||
@Deprecated("Use sizeOf<T>() or alignOf<T>() instead.")
|
||||
@Suppress("DEPRECATION")
|
||||
open class Type(size: Int) : CVariable.Type(size.toLong(), align = size)
|
||||
public open class Type(size: Int) : CVariable.Type(size.toLong(), align = size)
|
||||
}
|
||||
|
||||
@Deprecated("Will be removed.")
|
||||
@@ -305,7 +305,7 @@ public abstract class CEnumVar(rawPtr: NativePtr) : CPrimitiveVar(rawPtr)
|
||||
public class BooleanVarOf<T : Boolean>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr) {
|
||||
@Deprecated("Use sizeOf<T>() or alignOf<T>() instead.")
|
||||
@Suppress("DEPRECATION")
|
||||
companion object : Type(1)
|
||||
public companion object : Type(1)
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@@ -313,7 +313,7 @@ public class BooleanVarOf<T : Boolean>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr
|
||||
public class ByteVarOf<T : Byte>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr) {
|
||||
@Deprecated("Use sizeOf<T>() or alignOf<T>() instead.")
|
||||
@Suppress("DEPRECATION")
|
||||
companion object : Type(1)
|
||||
public companion object : Type(1)
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@@ -321,7 +321,7 @@ public class ByteVarOf<T : Byte>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr) {
|
||||
public class ShortVarOf<T : Short>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr) {
|
||||
@Deprecated("Use sizeOf<T>() or alignOf<T>() instead.")
|
||||
@Suppress("DEPRECATION")
|
||||
companion object : Type(2)
|
||||
public companion object : Type(2)
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@@ -329,7 +329,7 @@ public class ShortVarOf<T : Short>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr) {
|
||||
public class IntVarOf<T : Int>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr) {
|
||||
@Deprecated("Use sizeOf<T>() or alignOf<T>() instead.")
|
||||
@Suppress("DEPRECATION")
|
||||
companion object : Type(4)
|
||||
public companion object : Type(4)
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@@ -337,7 +337,7 @@ public class IntVarOf<T : Int>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr) {
|
||||
public class LongVarOf<T : Long>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr) {
|
||||
@Deprecated("Use sizeOf<T>() or alignOf<T>() instead.")
|
||||
@Suppress("DEPRECATION")
|
||||
companion object : Type(8)
|
||||
public companion object : Type(8)
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@@ -345,7 +345,7 @@ public class LongVarOf<T : Long>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr) {
|
||||
public class UByteVarOf<T : UByte>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr) {
|
||||
@Deprecated("Use sizeOf<T>() or alignOf<T>() instead.")
|
||||
@Suppress("DEPRECATION")
|
||||
companion object : Type(1)
|
||||
public companion object : Type(1)
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@@ -353,7 +353,7 @@ public class UByteVarOf<T : UByte>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr) {
|
||||
public class UShortVarOf<T : UShort>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr) {
|
||||
@Deprecated("Use sizeOf<T>() or alignOf<T>() instead.")
|
||||
@Suppress("DEPRECATION")
|
||||
companion object : Type(2)
|
||||
public companion object : Type(2)
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@@ -361,7 +361,7 @@ public class UShortVarOf<T : UShort>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr)
|
||||
public class UIntVarOf<T : UInt>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr) {
|
||||
@Deprecated("Use sizeOf<T>() or alignOf<T>() instead.")
|
||||
@Suppress("DEPRECATION")
|
||||
companion object : Type(4)
|
||||
public companion object : Type(4)
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@@ -369,7 +369,7 @@ public class UIntVarOf<T : UInt>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr) {
|
||||
public class ULongVarOf<T : ULong>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr) {
|
||||
@Deprecated("Use sizeOf<T>() or alignOf<T>() instead.")
|
||||
@Suppress("DEPRECATION")
|
||||
companion object : Type(8)
|
||||
public companion object : Type(8)
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@@ -377,7 +377,7 @@ public class ULongVarOf<T : ULong>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr) {
|
||||
public class FloatVarOf<T : Float>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr) {
|
||||
@Deprecated("Use sizeOf<T>() or alignOf<T>() instead.")
|
||||
@Suppress("DEPRECATION")
|
||||
companion object : Type(4)
|
||||
public companion object : Type(4)
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@@ -385,7 +385,7 @@ public class FloatVarOf<T : Float>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr) {
|
||||
public class DoubleVarOf<T : Double>(rawPtr: NativePtr) : CPrimitiveVar(rawPtr) {
|
||||
@Deprecated("Use sizeOf<T>() or alignOf<T>() instead.")
|
||||
@Suppress("DEPRECATION")
|
||||
companion object : Type(8)
|
||||
public companion object : Type(8)
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@@ -428,7 +428,7 @@ public inline fun Boolean.toByte(): Byte = if (this) 1 else 0
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
@ExperimentalForeignApi
|
||||
public inline fun Byte.toBoolean() = (this.toInt() != 0)
|
||||
public inline fun Byte.toBoolean(): Boolean = (this.toInt() != 0)
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@Suppress("FINAL_UPPER_BOUND", "UNCHECKED_CAST")
|
||||
@@ -497,7 +497,7 @@ public var <T : Double> DoubleVarOf<T>.value: T
|
||||
public class CPointerVarOf<T : CPointer<*>>(rawPtr: NativePtr) : CVariable(rawPtr) {
|
||||
@Deprecated("Use sizeOf<T>() or alignOf<T>() instead.")
|
||||
@Suppress("DEPRECATION")
|
||||
companion object : CVariable.Type(pointerSize.toLong(), pointerSize)
|
||||
public companion object : CVariable.Type(pointerSize.toLong(), pointerSize)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,15 +19,15 @@ public interface NativeFreeablePlacement : NativePlacement {
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
public fun NativeFreeablePlacement.free(pointer: CPointer<*>) = this.free(pointer.rawValue)
|
||||
public fun NativeFreeablePlacement.free(pointer: CPointer<*>): Unit = this.free(pointer.rawValue)
|
||||
@ExperimentalForeignApi
|
||||
public fun NativeFreeablePlacement.free(pointed: NativePointed) = this.free(pointed.rawPtr)
|
||||
public fun NativeFreeablePlacement.free(pointed: NativePointed): Unit = this.free(pointed.rawPtr)
|
||||
|
||||
@ExperimentalForeignApi
|
||||
public object nativeHeap : NativeFreeablePlacement {
|
||||
override fun alloc(size: Long, align: Int) = nativeMemUtils.alloc(size, align)
|
||||
override fun alloc(size: Long, align: Int): NativePointed = nativeMemUtils.alloc(size, align)
|
||||
|
||||
override fun free(mem: NativePtr) = nativeMemUtils.free(mem)
|
||||
override fun free(mem: NativePtr): Unit = nativeMemUtils.free(mem)
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@@ -46,7 +46,7 @@ public open class DeferScope {
|
||||
}
|
||||
}
|
||||
|
||||
inline fun defer(crossinline block: () -> Unit) {
|
||||
public inline fun defer(crossinline block: () -> Unit) {
|
||||
val currentTop = topDeferred
|
||||
topDeferred = {
|
||||
try {
|
||||
@@ -97,7 +97,7 @@ public open class ArenaBase(private val parent: NativeFreeablePlacement = native
|
||||
|
||||
@ExperimentalForeignApi
|
||||
public class Arena(parent: NativeFreeablePlacement = nativeHeap) : ArenaBase(parent) {
|
||||
fun clear() = this.clearImpl()
|
||||
public fun clear(): Unit = this.clearImpl()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -188,7 +188,7 @@ public fun <T : CPointed> NativePlacement.allocArrayOfPointersTo(elements: List<
|
||||
* Allocates C array of pointers to given elements.
|
||||
*/
|
||||
@ExperimentalForeignApi
|
||||
public fun <T : CPointed> NativePlacement.allocArrayOfPointersTo(vararg elements: T?) =
|
||||
public fun <T : CPointed> NativePlacement.allocArrayOfPointersTo(vararg elements: T?): CArrayPointer<CPointerVar<T>> =
|
||||
allocArrayOfPointersTo(listOf(*elements))
|
||||
|
||||
/**
|
||||
@@ -235,7 +235,7 @@ public fun NativePlacement.allocArrayOf(vararg elements: Float): CArrayPointer<F
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
public fun <T : CPointed> NativePlacement.allocPointerTo() = alloc<CPointerVar<T>>()
|
||||
public fun <T : CPointed> NativePlacement.allocPointerTo(): CPointerVar<T> = alloc<CPointerVar<T>>()
|
||||
|
||||
@PublishedApi
|
||||
@ExperimentalForeignApi
|
||||
@@ -354,7 +354,7 @@ public inline fun <reified T : CStructVar> cValue(initialize: T.() -> Unit): CVa
|
||||
zeroValue<T>().copy(modify = initialize)
|
||||
|
||||
@ExperimentalForeignApi
|
||||
public inline fun <reified T : CVariable> createValues(count: Int, initializer: T.(index: Int) -> Unit) = memScoped {
|
||||
public inline fun <reified T : CVariable> createValues(count: Int, initializer: T.(index: Int) -> Unit): CValues<T> = memScoped {
|
||||
val array = allocArray<T>(count, initializer)
|
||||
array[0].readValues(count)
|
||||
}
|
||||
@@ -403,21 +403,21 @@ public fun <T : CPointed> cValuesOf(vararg elements: CPointer<T>?): CValues<CPoi
|
||||
createValues(elements.size) { index -> this.value = elements[index] }
|
||||
|
||||
@ExperimentalForeignApi
|
||||
public fun ByteArray.toCValues() = cValuesOf(*this)
|
||||
public fun ByteArray.toCValues(): CValues<ByteVar> = cValuesOf(*this)
|
||||
@ExperimentalForeignApi
|
||||
public fun ShortArray.toCValues() = cValuesOf(*this)
|
||||
public fun ShortArray.toCValues(): CValues<ShortVar> = cValuesOf(*this)
|
||||
@ExperimentalForeignApi
|
||||
public fun IntArray.toCValues() = cValuesOf(*this)
|
||||
public fun IntArray.toCValues(): CValues<IntVar> = cValuesOf(*this)
|
||||
@ExperimentalForeignApi
|
||||
public fun LongArray.toCValues() = cValuesOf(*this)
|
||||
public fun LongArray.toCValues(): CValues<LongVar> = cValuesOf(*this)
|
||||
@ExperimentalForeignApi
|
||||
public fun FloatArray.toCValues() = cValuesOf(*this)
|
||||
public fun FloatArray.toCValues(): CValues<FloatVar> = cValuesOf(*this)
|
||||
@ExperimentalForeignApi
|
||||
public fun DoubleArray.toCValues() = cValuesOf(*this)
|
||||
public fun DoubleArray.toCValues(): CValues<DoubleVar> = cValuesOf(*this)
|
||||
@ExperimentalForeignApi
|
||||
public fun <T : CPointed> Array<CPointer<T>?>.toCValues() = cValuesOf(*this)
|
||||
public fun <T : CPointed> Array<CPointer<T>?>.toCValues(): CValues<CPointerVar<T>> = cValuesOf(*this)
|
||||
@ExperimentalForeignApi
|
||||
public fun <T : CPointed> List<CPointer<T>?>.toCValues() = this.toTypedArray().toCValues()
|
||||
public fun <T : CPointed> List<CPointer<T>?>.toCValues(): CValues<CPointerVar<T>> = this.toTypedArray().toCValues()
|
||||
|
||||
@ExperimentalForeignApi
|
||||
private class CString(val bytes: ByteArray) : CValues<ByteVar>() {
|
||||
@@ -683,10 +683,10 @@ private fun checkBoundsIndexes(startIndex: Int, endIndex: Int, size: Int) {
|
||||
@ExperimentalForeignApi
|
||||
public class MemScope : ArenaBase() {
|
||||
|
||||
val memScope: MemScope
|
||||
public val memScope: MemScope
|
||||
get() = this
|
||||
|
||||
val <T: CVariable> CValues<T>.ptr: CPointer<T>
|
||||
public val <T: CVariable> CValues<T>.ptr: CPointer<T>
|
||||
get() = this@ptr.getPointer(this@MemScope)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import kotlin.native.internal.ExportForCppRuntime
|
||||
import kotlin.native.internal.GCUnsafeCall
|
||||
|
||||
@BetaInteropApi
|
||||
public class ForeignException internal constructor(val nativeException: Any?) : Exception() {
|
||||
public class ForeignException internal constructor(public val nativeException: Any?) : Exception() {
|
||||
override val message: String = nativeException?.let {
|
||||
kotlin_ObjCExport_ExceptionDetails(nativeException)
|
||||
}?: ""
|
||||
|
||||
+46
-23
@@ -10,70 +10,93 @@ import kotlin.native.internal.IntrinsicType
|
||||
import kotlin.native.internal.ExportForCompiler
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <R> CPointer<CFunction<() -> R>>.invoke(): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <R> CPointer<CFunction<() -> R>>.invoke(): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, R> CPointer<CFunction<(P1) -> R>>.invoke(p1: P1): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, R> CPointer<CFunction<(P1) -> R>>.invoke(p1: P1): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, R> CPointer<CFunction<(P1, P2) -> R>>.invoke(p1: P1, p2: P2): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, R> CPointer<CFunction<(P1, P2) -> R>>.invoke(p1: P1, p2: P2): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, R> CPointer<CFunction<(P1, P2, P3) -> R>>.invoke(p1: P1, p2: P2, p3: P3): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, R> CPointer<CFunction<(P1, P2, P3) -> R>>.invoke(p1: P1, p2: P2, p3: P3): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, P4, R> CPointer<CFunction<(P1, P2, P3, P4) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, P4, R> CPointer<CFunction<(P1, P2, P3, P4) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, P4, P5, R> CPointer<CFunction<(P1, P2, P3, P4, P5) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, P4, P5, R> CPointer<CFunction<(P1, P2, P3, P4, P5) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, P4, P5, P6, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, P4, P5, P6, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, P4, P5, P6, P7, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, P4, P5, P6, P7, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13, p14: P14): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13, p14: P14): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13, p14: P14, p15: P15): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13, p14: P14, p15: P15): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13, p14: P14, p15: P15, p16: P16): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13, p14: P14, p15: P15, p16: P16): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13, p14: P14, p15: P15, p16: P16, p17: P17): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13, p14: P14, p15: P15, p16: P16, p17: P17): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13, p14: P14, p15: P15, p16: P16, p17: P17, p18: P18): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13, p14: P14, p15: P15, p16: P16, p17: P17, p18: P18): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13, p14: P14, p15: P15, p16: P16, p17: P17, p18: P18, p19: P19): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13, p14: P14, p15: P15, p16: P16, p17: P17, p18: P18, p19: P19): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13, p14: P14, p15: P15, p16: P16, p17: P17, p18: P18, p19: P19, p20: P20): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13, p14: P14, p15: P15, p16: P16, p17: P17, p18: P18, p19: P19, p20: P20): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13, p14: P14, p15: P15, p16: P16, p17: P17, p18: P18, p19: P19, p20: P20, p21: P21): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13, p14: P14, p15: P15, p16: P16, p17: P17, p18: P18, p19: P19, p20: P20, p21: P21): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE) external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13, p14: P14, p15: P15, p16: P16, p17: P17, p18: P18, p19: P19, p20: P20, p21: P21, p22: P22): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_FUNPTR_INVOKE)
|
||||
public external operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22) -> R>>.invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13, p14: P14, p15: P15, p16: P16, p17: P17, p18: P18, p19: P19, p20: P20, p21: P21, p22: P22): R
|
||||
|
||||
@@ -8,13 +8,13 @@ package kotlinx.cinterop
|
||||
import kotlinx.cinterop.CStructVar
|
||||
|
||||
@ExperimentalForeignApi
|
||||
interface SkiaRefCnt
|
||||
public interface SkiaRefCnt
|
||||
|
||||
@ExperimentalForeignApi
|
||||
interface CPlusPlusClass
|
||||
public interface CPlusPlusClass
|
||||
|
||||
@ExperimentalForeignApi
|
||||
abstract class ManagedType<T : CStructVar>(val cpp: T)
|
||||
public abstract class ManagedType<T : CStructVar>(public val cpp: T)
|
||||
|
||||
@ExperimentalForeignApi
|
||||
val <T : CStructVar> ManagedType<T>.ptr: CPointer<T> get() = this.cpp.ptr
|
||||
public val <T : CStructVar> ManagedType<T>.ptr: CPointer<T> get() = this.cpp.ptr
|
||||
|
||||
@@ -159,8 +159,8 @@ private external fun cfree(ptr: NativePtr)
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_READ_BITS)
|
||||
external fun readBits(ptr: NativePtr, offset: Long, size: Int, signed: Boolean): Long
|
||||
public external fun readBits(ptr: NativePtr, offset: Long, size: Int, signed: Boolean): Long
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_WRITE_BITS)
|
||||
external fun writeBits(ptr: NativePtr, offset: Long, size: Int, value: Long)
|
||||
public external fun writeBits(ptr: NativePtr, offset: Long, size: Int, value: Long)
|
||||
|
||||
@@ -11,7 +11,7 @@ import kotlin.native.internal.TypedIntrinsic
|
||||
import kotlin.native.internal.IntrinsicType
|
||||
|
||||
@ExperimentalForeignApi
|
||||
typealias NativePtr = kotlin.native.internal.NativePtr
|
||||
public typealias NativePtr = kotlin.native.internal.NativePtr
|
||||
internal typealias NonNullNativePtr = kotlin.native.internal.NonNullNativePtr
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
@@ -19,13 +19,13 @@ internal typealias NonNullNativePtr = kotlin.native.internal.NonNullNativePtr
|
||||
internal inline fun NativePtr.toNonNull() = this.reinterpret<NativePtr, NonNullNativePtr>()
|
||||
|
||||
@ExperimentalForeignApi
|
||||
inline val nativeNullPtr: NativePtr
|
||||
public inline val nativeNullPtr: NativePtr
|
||||
get() = NativePtr.NULL
|
||||
|
||||
@Deprecated("Use sizeOf<T>() or alignOf<T>() instead.")
|
||||
@Suppress("DEPRECATION")
|
||||
@ExperimentalForeignApi
|
||||
fun <T : CVariable> typeOf(): CVariable.Type = throw Error("typeOf() is called with erased argument")
|
||||
public fun <T : CVariable> typeOf(): CVariable.Type = throw Error("typeOf() is called with erased argument")
|
||||
|
||||
/**
|
||||
* Performs type cast of the native pointer to given interop type, including null values.
|
||||
@@ -34,22 +34,22 @@ fun <T : CVariable> typeOf(): CVariable.Type = throw Error("typeOf() is called w
|
||||
*/
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.IDENTITY)
|
||||
external fun <T : NativePointed> interpretNullablePointed(ptr: NativePtr): T?
|
||||
public external fun <T : NativePointed> interpretNullablePointed(ptr: NativePtr): T?
|
||||
|
||||
/**
|
||||
* Performs type cast of the [CPointer] from the given raw pointer.
|
||||
*/
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.IDENTITY)
|
||||
external fun <T : CPointed> interpretCPointer(rawValue: NativePtr): CPointer<T>?
|
||||
public external fun <T : CPointed> interpretCPointer(rawValue: NativePtr): CPointer<T>?
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.IDENTITY)
|
||||
external fun NativePointed.getRawPointer(): NativePtr
|
||||
public external fun NativePointed.getRawPointer(): NativePtr
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.IDENTITY)
|
||||
external fun CPointer<*>.getRawValue(): NativePtr
|
||||
public external fun CPointer<*>.getRawValue(): NativePtr
|
||||
|
||||
@ExperimentalForeignApi
|
||||
internal fun CPointer<*>.cPointerToString() = "CPointer(raw=$rawValue)"
|
||||
@@ -61,70 +61,93 @@ internal fun CPointer<*>.cPointerToString() = "CPointer(raw=$rawValue)"
|
||||
* a closure which doesn't capture any variable
|
||||
*/
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <R> staticCFunction(@VolatileLambda function: () -> R): CPointer<CFunction<() -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <R> staticCFunction(@VolatileLambda function: () -> R): CPointer<CFunction<() -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, R> staticCFunction(@VolatileLambda function: (P1) -> R): CPointer<CFunction<(P1) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, R> staticCFunction(@VolatileLambda function: (P1) -> R): CPointer<CFunction<(P1) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, R> staticCFunction(@VolatileLambda function: (P1, P2) -> R): CPointer<CFunction<(P1, P2) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, R> staticCFunction(@VolatileLambda function: (P1, P2) -> R): CPointer<CFunction<(P1, P2) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, R> staticCFunction(@VolatileLambda function: (P1, P2, P3) -> R): CPointer<CFunction<(P1, P2, P3) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, R> staticCFunction(@VolatileLambda function: (P1, P2, P3) -> R): CPointer<CFunction<(P1, P2, P3) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, P4, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4) -> R): CPointer<CFunction<(P1, P2, P3, P4) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, P4, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4) -> R): CPointer<CFunction<(P1, P2, P3, P4) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, P4, P5, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, P4, P5, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, P4, P5, P6, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, P4, P5, P6, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, P4, P5, P6, P7, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, P4, P5, P6, P7, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, P4, P5, P6, P7, P8, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, P4, P5, P6, P7, P8, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21) -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION) external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22) -> R>>
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
public external fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22, R> staticCFunction(@VolatileLambda function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22) -> R): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22) -> R>>
|
||||
|
||||
@@ -18,62 +18,70 @@ internal external fun CPointer<ByteVar>.toKStringFromUtf8Impl(): String
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_BITS_TO_FLOAT)
|
||||
external fun bitsToFloat(bits: Int): Float
|
||||
public external fun bitsToFloat(bits: Int): Float
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_BITS_TO_DOUBLE)
|
||||
external fun bitsToDouble(bits: Long): Double
|
||||
public external fun bitsToDouble(bits: Long): Double
|
||||
|
||||
@Deprecated("Deprecated without replacement as part of the obsolete interop API", level = DeprecationLevel.WARNING)
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_SIGN_EXTEND)
|
||||
external inline fun <reified R : Number> Number.signExtend(): R
|
||||
public external inline fun <reified R : Number> Number.signExtend(): R
|
||||
|
||||
@Deprecated("Deprecated without replacement as part of the obsolete interop API", level = DeprecationLevel.WARNING)
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_NARROW)
|
||||
external inline fun <reified R : Number> Number.narrow(): R
|
||||
public external inline fun <reified R : Number> Number.narrow(): R
|
||||
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_CONVERT) external inline fun <reified R : Any> Byte.convert(): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_CONVERT)
|
||||
public external inline fun <reified R : Any> Byte.convert(): R
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_CONVERT) external inline fun <reified R : Any> Short.convert(): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_CONVERT)
|
||||
public external inline fun <reified R : Any> Short.convert(): R
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_CONVERT) external inline fun <reified R : Any> Int.convert(): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_CONVERT)
|
||||
public external inline fun <reified R : Any> Int.convert(): R
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_CONVERT) external inline fun <reified R : Any> Long.convert(): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_CONVERT)
|
||||
public external inline fun <reified R : Any> Long.convert(): R
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_CONVERT) external inline fun <reified R : Any> UByte.convert(): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_CONVERT)
|
||||
public external inline fun <reified R : Any> UByte.convert(): R
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_CONVERT) external inline fun <reified R : Any> UShort.convert(): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_CONVERT)
|
||||
public external inline fun <reified R : Any> UShort.convert(): R
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_CONVERT) external inline fun <reified R : Any> UInt.convert(): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_CONVERT)
|
||||
public external inline fun <reified R : Any> UInt.convert(): R
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_CONVERT) external inline fun <reified R : Any> ULong.convert(): R
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_CONVERT)
|
||||
public external inline fun <reified R : Any> ULong.convert(): R
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.FILE)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
internal annotation class JvmName(val name: String)
|
||||
|
||||
@ExperimentalForeignApi
|
||||
fun cValuesOf(vararg elements: UByte): CValues<UByteVar> =
|
||||
public fun cValuesOf(vararg elements: UByte): CValues<UByteVar> =
|
||||
createValues(elements.size) { index -> this.value = elements[index] }
|
||||
|
||||
@ExperimentalForeignApi
|
||||
fun cValuesOf(vararg elements: UShort): CValues<UShortVar> =
|
||||
public fun cValuesOf(vararg elements: UShort): CValues<UShortVar> =
|
||||
createValues(elements.size) { index -> this.value = elements[index] }
|
||||
|
||||
@ExperimentalForeignApi
|
||||
fun cValuesOf(vararg elements: UInt): CValues<UIntVar> =
|
||||
public fun cValuesOf(vararg elements: UInt): CValues<UIntVar> =
|
||||
createValues(elements.size) { index -> this.value = elements[index] }
|
||||
|
||||
@ExperimentalForeignApi
|
||||
fun cValuesOf(vararg elements: ULong): CValues<ULongVar> =
|
||||
public fun cValuesOf(vararg elements: ULong): CValues<ULongVar> =
|
||||
createValues(elements.size) { index -> this.value = elements[index] }
|
||||
|
||||
@ExperimentalForeignApi
|
||||
fun UByteArray.toCValues() = cValuesOf(*this)
|
||||
public fun UByteArray.toCValues(): CValues<UByteVar> = cValuesOf(*this)
|
||||
@ExperimentalForeignApi
|
||||
fun UShortArray.toCValues() = cValuesOf(*this)
|
||||
public fun UShortArray.toCValues(): CValues<UShortVar> = cValuesOf(*this)
|
||||
@ExperimentalForeignApi
|
||||
fun UIntArray.toCValues() = cValuesOf(*this)
|
||||
public fun UIntArray.toCValues(): CValues<UIntVar> = cValuesOf(*this)
|
||||
@ExperimentalForeignApi
|
||||
fun ULongArray.toCValues() = cValuesOf(*this)
|
||||
public fun ULongArray.toCValues(): CValues<ULongVar> = cValuesOf(*this)
|
||||
|
||||
+21
-21
@@ -13,16 +13,16 @@ import kotlin.native.internal.*
|
||||
import kotlin.native.internal.InternalForKotlinNative
|
||||
|
||||
@BetaInteropApi
|
||||
interface ObjCObject
|
||||
public interface ObjCObject
|
||||
@BetaInteropApi
|
||||
interface ObjCClass : ObjCObject
|
||||
public interface ObjCClass : ObjCObject
|
||||
@BetaInteropApi
|
||||
interface ObjCClassOf<T : ObjCObject> : ObjCClass // TODO: T should be added to ObjCClass and all meta-classes instead.
|
||||
public interface ObjCClassOf<T : ObjCObject> : ObjCClass // TODO: T should be added to ObjCClass and all meta-classes instead.
|
||||
@BetaInteropApi
|
||||
typealias ObjCObjectMeta = ObjCClass
|
||||
public typealias ObjCObjectMeta = ObjCClass
|
||||
|
||||
@BetaInteropApi
|
||||
interface ObjCProtocol : ObjCObject
|
||||
public interface ObjCProtocol : ObjCObject
|
||||
|
||||
@ExportTypeInfo("theForeignObjCObjectTypeInfo")
|
||||
@OptIn(FreezingIsDeprecated::class)
|
||||
@@ -30,24 +30,24 @@ interface ObjCProtocol : ObjCObject
|
||||
internal open class ForeignObjCObject : kotlin.native.internal.ObjCObjectWrapper
|
||||
|
||||
@BetaInteropApi
|
||||
abstract class ObjCObjectBase protected constructor() : ObjCObject {
|
||||
public abstract class ObjCObjectBase protected constructor() : ObjCObject {
|
||||
@Target(AnnotationTarget.CONSTRUCTOR)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class OverrideInit
|
||||
public annotation class OverrideInit
|
||||
}
|
||||
|
||||
@BetaInteropApi
|
||||
abstract class ObjCObjectBaseMeta protected constructor() : ObjCObjectBase(), ObjCObjectMeta {}
|
||||
public abstract class ObjCObjectBaseMeta protected constructor() : ObjCObjectBase(), ObjCObjectMeta {}
|
||||
|
||||
@BetaInteropApi
|
||||
fun optional(): Nothing = throw RuntimeException("Do not call me!!!")
|
||||
public fun optional(): Nothing = throw RuntimeException("Do not call me!!!")
|
||||
|
||||
@Deprecated(
|
||||
"Add @OverrideInit to constructor to make it override Objective-C initializer",
|
||||
level = DeprecationLevel.ERROR
|
||||
)
|
||||
@TypedIntrinsic(IntrinsicType.OBJC_INIT_BY)
|
||||
external fun <T : ObjCObjectBase> T.initBy(constructorCall: T): T
|
||||
public external fun <T : ObjCObjectBase> T.initBy(constructorCall: T): T
|
||||
|
||||
@BetaInteropApi
|
||||
@kotlin.native.internal.ExportForCompiler
|
||||
@@ -64,11 +64,11 @@ internal fun <T : Any?> Any?.uncheckedCast(): T = @Suppress("UNCHECKED_CAST") (t
|
||||
// Note: if this is called for non-frozen object on a wrong worker, the program will terminate.
|
||||
@ExperimentalForeignApi
|
||||
@GCUnsafeCall("Kotlin_Interop_refFromObjC")
|
||||
external fun <T> interpretObjCPointerOrNull(objcPtr: NativePtr): T?
|
||||
public external fun <T> interpretObjCPointerOrNull(objcPtr: NativePtr): T?
|
||||
|
||||
@ExportForCppRuntime
|
||||
@ExperimentalForeignApi
|
||||
inline fun <T : Any> interpretObjCPointer(objcPtr: NativePtr): T = interpretObjCPointerOrNull<T>(objcPtr)!!
|
||||
public inline fun <T : Any> interpretObjCPointer(objcPtr: NativePtr): T = interpretObjCPointerOrNull<T>(objcPtr)!!
|
||||
|
||||
@GCUnsafeCall("Kotlin_Interop_refToObjC")
|
||||
@ExperimentalForeignApi
|
||||
@@ -89,28 +89,28 @@ public inline fun <reified T : Any> unwrapKotlinObjectHolder(holder: Any?): T {
|
||||
external internal fun unwrapKotlinObjectHolderImpl(ptr: NativePtr): Any
|
||||
|
||||
@ExperimentalForeignApi
|
||||
class ObjCObjectVar<T>(rawPtr: NativePtr) : CVariable(rawPtr) {
|
||||
public class ObjCObjectVar<T>(rawPtr: NativePtr) : CVariable(rawPtr) {
|
||||
@Deprecated("Use sizeOf<T>() or alignOf<T>() instead.")
|
||||
@Suppress("DEPRECATION")
|
||||
companion object : CVariable.Type(pointerSize.toLong(), pointerSize)
|
||||
public companion object : CVariable.Type(pointerSize.toLong(), pointerSize)
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
class ObjCNotImplementedVar<T : Any?>(rawPtr: NativePtr) : CVariable(rawPtr) {
|
||||
public class ObjCNotImplementedVar<T : Any?>(rawPtr: NativePtr) : CVariable(rawPtr) {
|
||||
@Deprecated("Use sizeOf<T>() or alignOf<T>() instead.")
|
||||
@Suppress("DEPRECATION")
|
||||
companion object : CVariable.Type(pointerSize.toLong(), pointerSize)
|
||||
public companion object : CVariable.Type(pointerSize.toLong(), pointerSize)
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
var <T : Any?> ObjCNotImplementedVar<T>.value: T
|
||||
public var <T : Any?> ObjCNotImplementedVar<T>.value: T
|
||||
get() = TODO()
|
||||
set(_) = TODO()
|
||||
|
||||
@ExperimentalForeignApi
|
||||
typealias ObjCStringVarOf<T> = ObjCNotImplementedVar<T>
|
||||
public typealias ObjCStringVarOf<T> = ObjCNotImplementedVar<T>
|
||||
@ExperimentalForeignApi
|
||||
typealias ObjCBlockVar<T> = ObjCNotImplementedVar<T>
|
||||
public typealias ObjCBlockVar<T> = ObjCNotImplementedVar<T>
|
||||
|
||||
@TypedIntrinsic(IntrinsicType.OBJC_CREATE_SUPER_STRUCT)
|
||||
@PublishedApi
|
||||
@@ -198,11 +198,11 @@ private external fun ObjCWeakReferenceImpl.init(objcPtr: NativePtr)
|
||||
|
||||
@Deprecated("Use plain Kotlin cast of String to NSString", level = DeprecationLevel.ERROR)
|
||||
@GCUnsafeCall("Kotlin_Interop_CreateNSStringFromKString")
|
||||
external fun CreateNSStringFromKString(str: String?): NativePtr
|
||||
public external fun CreateNSStringFromKString(str: String?): NativePtr
|
||||
|
||||
@Deprecated("Use plain Kotlin cast of NSString to String", level = DeprecationLevel.ERROR)
|
||||
@GCUnsafeCall("Kotlin_Interop_CreateKStringFromNSString")
|
||||
external fun CreateKStringFromNSString(ptr: NativePtr): String?
|
||||
public external fun CreateKStringFromNSString(ptr: NativePtr): String?
|
||||
|
||||
@PublishedApi
|
||||
@GCUnsafeCall("Kotlin_Interop_CreateObjCObjectHolder")
|
||||
|
||||
@@ -9,27 +9,27 @@ import kotlin.native.*
|
||||
import kotlin.native.internal.GCUnsafeCall
|
||||
|
||||
@ExperimentalForeignApi
|
||||
data class Pinned<out T : Any> internal constructor(private val stablePtr: COpaquePointer) {
|
||||
public data class Pinned<out T : Any> internal constructor(private val stablePtr: COpaquePointer) {
|
||||
|
||||
/**
|
||||
* Disposes the handle. It must not be [used][get] after that.
|
||||
*/
|
||||
fun unpin() {
|
||||
public fun unpin() {
|
||||
disposeStablePointer(this.stablePtr)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the underlying pinned object.
|
||||
*/
|
||||
fun get(): T = @Suppress("UNCHECKED_CAST") (derefStablePointer(stablePtr) as T)
|
||||
public fun get(): T = @Suppress("UNCHECKED_CAST") (derefStablePointer(stablePtr) as T)
|
||||
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
fun <T : Any> T.pin() = Pinned<T>(createStablePointer(this))
|
||||
public fun <T : Any> T.pin(): Pinned<T> = Pinned<T>(createStablePointer(this))
|
||||
|
||||
@ExperimentalForeignApi
|
||||
inline fun <T : Any, R> T.usePinned(block: (Pinned<T>) -> R): R {
|
||||
public inline fun <T : Any, R> T.usePinned(block: (Pinned<T>) -> R): R {
|
||||
val pinned = this.pin()
|
||||
return try {
|
||||
block(pinned)
|
||||
@@ -39,65 +39,65 @@ inline fun <T : Any, R> T.usePinned(block: (Pinned<T>) -> R): R {
|
||||
}
|
||||
|
||||
@ExperimentalForeignApi
|
||||
fun Pinned<ByteArray>.addressOf(index: Int): CPointer<ByteVar> = this.get().addressOfElement(index)
|
||||
public fun Pinned<ByteArray>.addressOf(index: Int): CPointer<ByteVar> = this.get().addressOfElement(index)
|
||||
@ExperimentalForeignApi
|
||||
fun ByteArray.refTo(index: Int): CValuesRef<ByteVar> = this.usingPinned { addressOf(index) }
|
||||
public fun ByteArray.refTo(index: Int): CValuesRef<ByteVar> = this.usingPinned { addressOf(index) }
|
||||
|
||||
@ExperimentalForeignApi
|
||||
fun Pinned<String>.addressOf(index: Int): CPointer<COpaque> = this.get().addressOfElement(index)
|
||||
public fun Pinned<String>.addressOf(index: Int): CPointer<COpaque> = this.get().addressOfElement(index)
|
||||
@ExperimentalForeignApi
|
||||
fun String.refTo(index: Int): CValuesRef<COpaque> = this.usingPinned { addressOf(index) }
|
||||
public fun String.refTo(index: Int): CValuesRef<COpaque> = this.usingPinned { addressOf(index) }
|
||||
|
||||
@ExperimentalForeignApi
|
||||
fun Pinned<CharArray>.addressOf(index: Int): CPointer<COpaque> = this.get().addressOfElement(index)
|
||||
public fun Pinned<CharArray>.addressOf(index: Int): CPointer<COpaque> = this.get().addressOfElement(index)
|
||||
@ExperimentalForeignApi
|
||||
fun CharArray.refTo(index: Int): CValuesRef<COpaque> = this.usingPinned { addressOf(index) }
|
||||
public fun CharArray.refTo(index: Int): CValuesRef<COpaque> = this.usingPinned { addressOf(index) }
|
||||
|
||||
@ExperimentalForeignApi
|
||||
fun Pinned<ShortArray>.addressOf(index: Int): CPointer<ShortVar> = this.get().addressOfElement(index)
|
||||
public fun Pinned<ShortArray>.addressOf(index: Int): CPointer<ShortVar> = this.get().addressOfElement(index)
|
||||
@ExperimentalForeignApi
|
||||
fun ShortArray.refTo(index: Int): CValuesRef<ShortVar> = this.usingPinned { addressOf(index) }
|
||||
public fun ShortArray.refTo(index: Int): CValuesRef<ShortVar> = this.usingPinned { addressOf(index) }
|
||||
|
||||
@ExperimentalForeignApi
|
||||
fun Pinned<IntArray>.addressOf(index: Int): CPointer<IntVar> = this.get().addressOfElement(index)
|
||||
public fun Pinned<IntArray>.addressOf(index: Int): CPointer<IntVar> = this.get().addressOfElement(index)
|
||||
@ExperimentalForeignApi
|
||||
fun IntArray.refTo(index: Int): CValuesRef<IntVar> = this.usingPinned { addressOf(index) }
|
||||
public fun IntArray.refTo(index: Int): CValuesRef<IntVar> = this.usingPinned { addressOf(index) }
|
||||
|
||||
@ExperimentalForeignApi
|
||||
fun Pinned<LongArray>.addressOf(index: Int): CPointer<LongVar> = this.get().addressOfElement(index)
|
||||
public fun Pinned<LongArray>.addressOf(index: Int): CPointer<LongVar> = this.get().addressOfElement(index)
|
||||
@ExperimentalForeignApi
|
||||
fun LongArray.refTo(index: Int): CValuesRef<LongVar> = this.usingPinned { addressOf(index) }
|
||||
public fun LongArray.refTo(index: Int): CValuesRef<LongVar> = this.usingPinned { addressOf(index) }
|
||||
|
||||
// TODO: pinning of unsigned arrays involves boxing as they are inline classes wrapping signed arrays.
|
||||
@ExperimentalForeignApi
|
||||
fun Pinned<UByteArray>.addressOf(index: Int): CPointer<UByteVar> = this.get().addressOfElement(index)
|
||||
public fun Pinned<UByteArray>.addressOf(index: Int): CPointer<UByteVar> = this.get().addressOfElement(index)
|
||||
@ExperimentalForeignApi
|
||||
fun UByteArray.refTo(index: Int): CValuesRef<UByteVar> = this.usingPinned { addressOf(index) }
|
||||
public fun UByteArray.refTo(index: Int): CValuesRef<UByteVar> = this.usingPinned { addressOf(index) }
|
||||
|
||||
@ExperimentalForeignApi
|
||||
fun Pinned<UShortArray>.addressOf(index: Int): CPointer<UShortVar> = this.get().addressOfElement(index)
|
||||
public fun Pinned<UShortArray>.addressOf(index: Int): CPointer<UShortVar> = this.get().addressOfElement(index)
|
||||
@ExperimentalForeignApi
|
||||
fun UShortArray.refTo(index: Int): CValuesRef<UShortVar> = this.usingPinned { addressOf(index) }
|
||||
public fun UShortArray.refTo(index: Int): CValuesRef<UShortVar> = this.usingPinned { addressOf(index) }
|
||||
|
||||
@ExperimentalForeignApi
|
||||
fun Pinned<UIntArray>.addressOf(index: Int): CPointer<UIntVar> = this.get().addressOfElement(index)
|
||||
public fun Pinned<UIntArray>.addressOf(index: Int): CPointer<UIntVar> = this.get().addressOfElement(index)
|
||||
@ExperimentalForeignApi
|
||||
fun UIntArray.refTo(index: Int): CValuesRef<UIntVar> = this.usingPinned { addressOf(index) }
|
||||
public fun UIntArray.refTo(index: Int): CValuesRef<UIntVar> = this.usingPinned { addressOf(index) }
|
||||
|
||||
@ExperimentalForeignApi
|
||||
fun Pinned<ULongArray>.addressOf(index: Int): CPointer<ULongVar> = this.get().addressOfElement(index)
|
||||
public fun Pinned<ULongArray>.addressOf(index: Int): CPointer<ULongVar> = this.get().addressOfElement(index)
|
||||
@ExperimentalForeignApi
|
||||
fun ULongArray.refTo(index: Int): CValuesRef<ULongVar> = this.usingPinned { addressOf(index) }
|
||||
public fun ULongArray.refTo(index: Int): CValuesRef<ULongVar> = this.usingPinned { addressOf(index) }
|
||||
|
||||
@ExperimentalForeignApi
|
||||
fun Pinned<FloatArray>.addressOf(index: Int): CPointer<FloatVar> = this.get().addressOfElement(index)
|
||||
public fun Pinned<FloatArray>.addressOf(index: Int): CPointer<FloatVar> = this.get().addressOfElement(index)
|
||||
@ExperimentalForeignApi
|
||||
fun FloatArray.refTo(index: Int): CValuesRef<FloatVar> = this.usingPinned { addressOf(index) }
|
||||
public fun FloatArray.refTo(index: Int): CValuesRef<FloatVar> = this.usingPinned { addressOf(index) }
|
||||
|
||||
@ExperimentalForeignApi
|
||||
fun Pinned<DoubleArray>.addressOf(index: Int): CPointer<DoubleVar> = this.get().addressOfElement(index)
|
||||
public fun Pinned<DoubleArray>.addressOf(index: Int): CPointer<DoubleVar> = this.get().addressOfElement(index)
|
||||
@ExperimentalForeignApi
|
||||
fun DoubleArray.refTo(index: Int): CValuesRef<DoubleVar> = this.usingPinned { addressOf(index) }
|
||||
public fun DoubleArray.refTo(index: Int): CValuesRef<DoubleVar> = this.usingPinned { addressOf(index) }
|
||||
|
||||
@ExperimentalForeignApi
|
||||
private inline fun <T : Any, P : CPointed> T.usingPinned(
|
||||
|
||||
@@ -14,30 +14,30 @@ import kotlinx.cinterop.ExperimentalForeignApi
|
||||
@ExperimentalForeignApi
|
||||
public final class Vector128 private constructor() {
|
||||
@TypedIntrinsic(IntrinsicType.EXTRACT_ELEMENT)
|
||||
external fun getByteAt(index: Int): Byte
|
||||
public external fun getByteAt(index: Int): Byte
|
||||
|
||||
@TypedIntrinsic(IntrinsicType.EXTRACT_ELEMENT)
|
||||
external fun getIntAt(index: Int): Int
|
||||
public external fun getIntAt(index: Int): Int
|
||||
|
||||
@TypedIntrinsic(IntrinsicType.EXTRACT_ELEMENT)
|
||||
external fun getLongAt(index: Int): Long
|
||||
public external fun getLongAt(index: Int): Long
|
||||
|
||||
@TypedIntrinsic(IntrinsicType.EXTRACT_ELEMENT)
|
||||
external fun getFloatAt(index: Int): Float
|
||||
public external fun getFloatAt(index: Int): Float
|
||||
|
||||
@TypedIntrinsic(IntrinsicType.EXTRACT_ELEMENT)
|
||||
external fun getDoubleAt(index: Int): Double
|
||||
public external fun getDoubleAt(index: Int): Double
|
||||
|
||||
@TypedIntrinsic(IntrinsicType.EXTRACT_ELEMENT)
|
||||
external fun getUByteAt(index: Int): UByte
|
||||
public external fun getUByteAt(index: Int): UByte
|
||||
|
||||
@TypedIntrinsic(IntrinsicType.EXTRACT_ELEMENT)
|
||||
external fun getUIntAt(index: Int): UInt
|
||||
public external fun getUIntAt(index: Int): UInt
|
||||
|
||||
@TypedIntrinsic(IntrinsicType.EXTRACT_ELEMENT)
|
||||
external fun getULongAt(index: Int): ULong
|
||||
public external fun getULongAt(index: Int): ULong
|
||||
|
||||
public override fun toString() =
|
||||
public override fun toString(): String =
|
||||
"(0x${getUIntAt(0).toString(16)}, 0x${getUIntAt(1).toString(16)}, 0x${getUIntAt(2).toString(16)}, 0x${getUIntAt(3).toString(16)})"
|
||||
|
||||
// Not as good for floating types
|
||||
@@ -69,7 +69,7 @@ public external fun vectorOf(f0: Int, f1: Int, f2: Int, f3: Int): Vector128
|
||||
public class Vector128VarOf<T : Vector128>(rawPtr: NativePtr) : CVariable(rawPtr) {
|
||||
@Deprecated("Use sizeOf<T>() or alignOf<T>() instead.")
|
||||
@Suppress("DEPRECATION")
|
||||
companion object : Type(size = 16, align = 16)
|
||||
public companion object : Type(size = 16, align = 16)
|
||||
}
|
||||
|
||||
@SinceKotlin("1.9")
|
||||
|
||||
+24
-24
@@ -6,35 +6,35 @@ import kotlin.native.internal.InternalForKotlinNative
|
||||
@InternalForKotlinNative
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class CStruct(val spelling: String) {
|
||||
public annotation class CStruct(val spelling: String) {
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@Target(
|
||||
AnnotationTarget.PROPERTY_GETTER,
|
||||
AnnotationTarget.PROPERTY_SETTER
|
||||
)
|
||||
annotation class MemberAt(val offset: Long)
|
||||
public annotation class MemberAt(val offset: Long)
|
||||
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@Target(AnnotationTarget.PROPERTY_GETTER)
|
||||
annotation class ArrayMemberAt(val offset: Long)
|
||||
public annotation class ArrayMemberAt(val offset: Long)
|
||||
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@Target(
|
||||
AnnotationTarget.PROPERTY_GETTER,
|
||||
AnnotationTarget.PROPERTY_SETTER
|
||||
)
|
||||
annotation class BitField(val offset: Long, val size: Int)
|
||||
public annotation class BitField(val offset: Long, val size: Int)
|
||||
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class VarType(val size: Long, val align: Int)
|
||||
public annotation class VarType(val size: Long, val align: Int)
|
||||
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class CPlusPlusClass
|
||||
public annotation class CPlusPlusClass
|
||||
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ManagedType
|
||||
public annotation class ManagedType
|
||||
}
|
||||
|
||||
@Target(
|
||||
@@ -47,11 +47,11 @@ annotation class CStruct(val spelling: String) {
|
||||
public annotation class CCall(val id: String) {
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class CString
|
||||
public annotation class CString
|
||||
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class WCString
|
||||
public annotation class WCString
|
||||
|
||||
@Target(
|
||||
AnnotationTarget.FUNCTION,
|
||||
@@ -59,7 +59,7 @@ public annotation class CCall(val id: String) {
|
||||
AnnotationTarget.PROPERTY_SETTER
|
||||
)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ReturnsRetained
|
||||
public annotation class ReturnsRetained
|
||||
|
||||
@Target(
|
||||
AnnotationTarget.FUNCTION,
|
||||
@@ -67,15 +67,15 @@ public annotation class CCall(val id: String) {
|
||||
AnnotationTarget.PROPERTY_SETTER
|
||||
)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ConsumesReceiver
|
||||
public annotation class ConsumesReceiver
|
||||
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class Consumed
|
||||
public annotation class Consumed
|
||||
|
||||
@Target(AnnotationTarget.CONSTRUCTOR)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class CppClassConstructor
|
||||
public annotation class CppClassConstructor
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,27 +85,27 @@ public annotation class CCall(val id: String) {
|
||||
@InternalForKotlinNative
|
||||
public object ConstantValue {
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class Byte(val value: kotlin.Byte)
|
||||
public annotation class Byte(val value: kotlin.Byte)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class Short(val value: kotlin.Short)
|
||||
public annotation class Short(val value: kotlin.Short)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class Int(val value: kotlin.Int)
|
||||
public annotation class Int(val value: kotlin.Int)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class Long(val value: kotlin.Long)
|
||||
public annotation class Long(val value: kotlin.Long)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class UByte(val value: kotlin.UByte)
|
||||
public annotation class UByte(val value: kotlin.UByte)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class UShort(val value: kotlin.UShort)
|
||||
public annotation class UShort(val value: kotlin.UShort)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class UInt(val value: kotlin.UInt)
|
||||
public annotation class UInt(val value: kotlin.UInt)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ULong(val value: kotlin.ULong)
|
||||
public annotation class ULong(val value: kotlin.ULong)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class Float(val value: kotlin.Float)
|
||||
public annotation class Float(val value: kotlin.Float)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class Double(val value: kotlin.Double)
|
||||
public annotation class Double(val value: kotlin.Double)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class String(val value: kotlin.String)
|
||||
public annotation class String(val value: kotlin.String)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ public final class ByteArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_ByteArray_get")
|
||||
external public operator fun get(index: Int): Byte
|
||||
public external operator fun get(index: Int): Byte
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
@@ -61,10 +61,10 @@ public final class ByteArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_ByteArray_set")
|
||||
external public operator fun set(index: Int, value: Byte): Unit
|
||||
public external operator fun set(index: Int, value: Byte): Unit
|
||||
|
||||
@GCUnsafeCall("Kotlin_ByteArray_getArrayLength")
|
||||
external private fun getArrayLength(): Int
|
||||
private external fun getArrayLength(): Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): ByteIterator {
|
||||
@@ -124,7 +124,7 @@ public final class CharArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_CharArray_get")
|
||||
external public operator fun get(index: Int): Char
|
||||
public external operator fun get(index: Int): Char
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
@@ -132,10 +132,10 @@ public final class CharArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_CharArray_set")
|
||||
external public operator fun set(index: Int, value: Char): Unit
|
||||
public external operator fun set(index: Int, value: Char): Unit
|
||||
|
||||
@GCUnsafeCall("Kotlin_CharArray_getArrayLength")
|
||||
external private fun getArrayLength(): Int
|
||||
private external fun getArrayLength(): Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): kotlin.collections.CharIterator {
|
||||
@@ -195,7 +195,7 @@ public final class ShortArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_ShortArray_get")
|
||||
external public operator fun get(index: Int): Short
|
||||
public external operator fun get(index: Int): Short
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
@@ -203,10 +203,10 @@ public final class ShortArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_ShortArray_set")
|
||||
external public operator fun set(index: Int, value: Short): Unit
|
||||
public external operator fun set(index: Int, value: Short): Unit
|
||||
|
||||
@GCUnsafeCall("Kotlin_ShortArray_getArrayLength")
|
||||
external private fun getArrayLength(): Int
|
||||
private external fun getArrayLength(): Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): kotlin.collections.ShortIterator {
|
||||
@@ -266,7 +266,7 @@ public final class IntArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_IntArray_get")
|
||||
external public operator fun get(index: Int): Int
|
||||
public external operator fun get(index: Int): Int
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
@@ -274,10 +274,10 @@ public final class IntArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_IntArray_set")
|
||||
external public operator fun set(index: Int, value: Int): Unit
|
||||
public external operator fun set(index: Int, value: Int): Unit
|
||||
|
||||
@GCUnsafeCall("Kotlin_IntArray_getArrayLength")
|
||||
external private fun getArrayLength(): Int
|
||||
private external fun getArrayLength(): Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): kotlin.collections.IntIterator {
|
||||
@@ -337,7 +337,7 @@ public final class LongArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_LongArray_get")
|
||||
external public operator fun get(index: Int): Long
|
||||
public external operator fun get(index: Int): Long
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
@@ -345,10 +345,10 @@ public final class LongArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_LongArray_set")
|
||||
external public operator fun set(index: Int, value: Long): Unit
|
||||
public external operator fun set(index: Int, value: Long): Unit
|
||||
|
||||
@GCUnsafeCall("Kotlin_LongArray_getArrayLength")
|
||||
external private fun getArrayLength(): Int
|
||||
private external fun getArrayLength(): Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): kotlin.collections.LongIterator {
|
||||
@@ -408,7 +408,7 @@ public final class FloatArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_FloatArray_get")
|
||||
external public operator fun get(index: Int): Float
|
||||
public external operator fun get(index: Int): Float
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
@@ -416,10 +416,10 @@ public final class FloatArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_FloatArray_set")
|
||||
external public operator fun set(index: Int, value: Float): Unit
|
||||
public external operator fun set(index: Int, value: Float): Unit
|
||||
|
||||
@GCUnsafeCall("Kotlin_FloatArray_getArrayLength")
|
||||
external private fun getArrayLength(): Int
|
||||
private external fun getArrayLength(): Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): kotlin.collections.FloatIterator {
|
||||
@@ -479,7 +479,7 @@ public final class DoubleArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_DoubleArray_get")
|
||||
external public operator fun get(index: Int): Double
|
||||
public external operator fun get(index: Int): Double
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
@@ -487,10 +487,10 @@ public final class DoubleArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_DoubleArray_set")
|
||||
external public operator fun set(index: Int, value: Double): Unit
|
||||
public external operator fun set(index: Int, value: Double): Unit
|
||||
|
||||
@GCUnsafeCall("Kotlin_DoubleArray_getArrayLength")
|
||||
external private fun getArrayLength(): Int
|
||||
private external fun getArrayLength(): Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): kotlin.collections.DoubleIterator {
|
||||
@@ -550,7 +550,7 @@ public final class BooleanArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_BooleanArray_get")
|
||||
external public operator fun get(index: Int): Boolean
|
||||
public external operator fun get(index: Int): Boolean
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
@@ -558,10 +558,10 @@ public final class BooleanArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_BooleanArray_set")
|
||||
external public operator fun set(index: Int, value: Boolean): Unit
|
||||
public external operator fun set(index: Int, value: Boolean): Unit
|
||||
|
||||
@GCUnsafeCall("Kotlin_BooleanArray_getArrayLength")
|
||||
external private fun getArrayLength(): Int
|
||||
private external fun getArrayLength(): Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): kotlin.collections.BooleanIterator {
|
||||
@@ -599,52 +599,52 @@ public inline fun <T> arrayOfNulls(size: Int): Array<T?> =
|
||||
public external inline fun <T> arrayOf(vararg elements: T): Array<T>
|
||||
|
||||
@GCUnsafeCall("Kotlin_emptyArray")
|
||||
external public fun <T> emptyArray(): Array<T>
|
||||
public external fun <T> emptyArray(): Array<T>
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified [Double] numbers.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public inline fun doubleArrayOf(vararg elements: Double) = elements
|
||||
public inline fun doubleArrayOf(vararg elements: Double): DoubleArray = elements
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified [Float] numbers.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public inline fun floatArrayOf(vararg elements: Float) = elements
|
||||
public inline fun floatArrayOf(vararg elements: Float): FloatArray = elements
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified [Long] numbers.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public inline fun longArrayOf(vararg elements: Long) = elements
|
||||
public inline fun longArrayOf(vararg elements: Long): LongArray = elements
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified [Int] numbers.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public inline fun intArrayOf(vararg elements: Int) = elements
|
||||
public inline fun intArrayOf(vararg elements: Int): IntArray = elements
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified characters.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public inline fun charArrayOf(vararg elements: Char) = elements
|
||||
public inline fun charArrayOf(vararg elements: Char): CharArray = elements
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified [Short] numbers.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public inline fun shortArrayOf(vararg elements: Short) = elements
|
||||
public inline fun shortArrayOf(vararg elements: Short): ShortArray = elements
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified [Byte] numbers.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public inline fun byteArrayOf(vararg elements: Byte) = elements
|
||||
public inline fun byteArrayOf(vararg elements: Byte): ByteArray = elements
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified boolean values.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public inline fun booleanArrayOf(vararg elements: Boolean) = elements
|
||||
public inline fun booleanArrayOf(vararg elements: Boolean): BooleanArray = elements
|
||||
|
||||
@@ -7,105 +7,105 @@ package kotlin
|
||||
|
||||
public actual open class Error : Throwable {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
|
||||
actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
|
||||
actual constructor(cause: Throwable?) : super(cause)
|
||||
public actual constructor(cause: Throwable?) : super(cause)
|
||||
}
|
||||
|
||||
public actual open class Exception : Throwable {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
|
||||
actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
|
||||
actual constructor(cause: Throwable?) : super(cause)
|
||||
public actual constructor(cause: Throwable?) : super(cause)
|
||||
}
|
||||
|
||||
public actual open class RuntimeException : Exception {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
|
||||
actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
|
||||
actual constructor(cause: Throwable?) : super(cause)
|
||||
public actual constructor(cause: Throwable?) : super(cause)
|
||||
}
|
||||
|
||||
public actual open class NullPointerException : RuntimeException {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
}
|
||||
|
||||
public actual open class NoSuchElementException : RuntimeException {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
}
|
||||
|
||||
public actual open class IllegalArgumentException : RuntimeException {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
|
||||
actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
|
||||
actual constructor(cause: Throwable?) : super(cause)
|
||||
public actual constructor(cause: Throwable?) : super(cause)
|
||||
}
|
||||
|
||||
public actual open class IllegalStateException : RuntimeException {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
|
||||
actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
|
||||
actual constructor(cause: Throwable?) : super(cause)
|
||||
public actual constructor(cause: Throwable?) : super(cause)
|
||||
}
|
||||
|
||||
public actual open class UnsupportedOperationException : RuntimeException {
|
||||
|
||||
actual constructor()
|
||||
public actual constructor()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
|
||||
actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
|
||||
actual constructor(cause: Throwable?) : super(cause)
|
||||
public actual constructor(cause: Throwable?) : super(cause)
|
||||
}
|
||||
|
||||
public actual open class IndexOutOfBoundsException : RuntimeException {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
}
|
||||
|
||||
@Deprecated("Use IndexOutOfBoundsException instead.")
|
||||
@DeprecatedSinceKotlin(warningSince = "1.9")
|
||||
public open class ArrayIndexOutOfBoundsException : IndexOutOfBoundsException {
|
||||
|
||||
constructor() : super()
|
||||
public constructor() : super()
|
||||
|
||||
constructor(message: String?) : super(message)
|
||||
public constructor(message: String?) : super(message)
|
||||
}
|
||||
|
||||
public actual open class ClassCastException : RuntimeException {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
}
|
||||
|
||||
@PublishedApi
|
||||
@@ -117,21 +117,21 @@ internal open class TypeCastException : ClassCastException {
|
||||
}
|
||||
|
||||
public actual open class ArithmeticException : RuntimeException {
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
}
|
||||
|
||||
public actual open class AssertionError : Error {
|
||||
|
||||
actual constructor()
|
||||
public actual constructor()
|
||||
|
||||
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
|
||||
constructor(cause: Throwable?) : super(cause)
|
||||
public constructor(cause: Throwable?) : super(cause)
|
||||
|
||||
actual constructor(message: Any?) : super(message?.toString(), message as? Throwable)
|
||||
public actual constructor(message: Any?) : super(message?.toString(), message as? Throwable)
|
||||
|
||||
actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
}
|
||||
|
||||
@Suppress("ACTUAL_WITHOUT_EXPECT")
|
||||
@@ -160,24 +160,24 @@ internal actual open class UninitializedPropertyAccessException : RuntimeExcepti
|
||||
|
||||
public open class OutOfMemoryError : Error {
|
||||
|
||||
constructor() : super()
|
||||
public constructor() : super()
|
||||
|
||||
constructor(message: String?) : super(message)
|
||||
public constructor(message: String?) : super(message)
|
||||
}
|
||||
|
||||
public actual open class NumberFormatException : IllegalArgumentException {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
}
|
||||
|
||||
public actual open class ConcurrentModificationException actual constructor(message: String?, cause: Throwable?) :
|
||||
RuntimeException(message, cause) {
|
||||
|
||||
actual constructor() : this(null, null)
|
||||
public actual constructor() : this(null, null)
|
||||
|
||||
actual constructor(message: String?) : this(message, null)
|
||||
public actual constructor(message: String?) : this(message, null)
|
||||
|
||||
actual constructor(cause: Throwable?) : this(null, cause)
|
||||
public actual constructor(cause: Throwable?) : this(null, cause)
|
||||
}
|
||||
@@ -68,4 +68,4 @@ public inline operator fun kotlin.String?.plus(other: kotlin.Any?): kotlin.Strin
|
||||
(this?.toString() ?: "null").plus(other?.toString() ?: "null")
|
||||
|
||||
|
||||
public inline fun Any?.toString() = this?.toString() ?: "null"
|
||||
public inline fun Any?.toString(): String = this?.toString() ?: "null"
|
||||
@@ -23,13 +23,13 @@ import kotlinx.cinterop.ExperimentalForeignApi
|
||||
*/
|
||||
@ExportTypeInfo("theThrowableTypeInfo")
|
||||
@OptIn(FreezingIsDeprecated::class)
|
||||
public open class Throwable(open val message: String?, open val cause: Throwable?) {
|
||||
public open class Throwable(public open val message: String?, public open val cause: Throwable?) {
|
||||
|
||||
constructor(message: String?) : this(message, null)
|
||||
public constructor(message: String?) : this(message, null)
|
||||
|
||||
constructor(cause: Throwable?) : this(cause?.toString(), cause)
|
||||
public constructor(cause: Throwable?) : this(cause?.toString(), cause)
|
||||
|
||||
constructor() : this(null, null)
|
||||
public constructor() : this(null, null)
|
||||
|
||||
@get:ExportForCppRuntime("Kotlin_Throwable_getStackTrace")
|
||||
private val stackTrace: NativePtrArray = getCurrentStackTrace()
|
||||
|
||||
@@ -12,5 +12,5 @@ import kotlin.native.internal.ExportTypeInfo
|
||||
*/
|
||||
@ExportTypeInfo("theUnitTypeInfo")
|
||||
public object Unit {
|
||||
override fun toString() = "kotlin.Unit"
|
||||
override fun toString(): String = "kotlin.Unit"
|
||||
}
|
||||
+4
-4
@@ -7,8 +7,8 @@ package kotlin.coroutines.cancellation
|
||||
|
||||
@SinceKotlin("1.4")
|
||||
public actual open class CancellationException : IllegalStateException {
|
||||
actual constructor() : super()
|
||||
actual constructor(message: String?) : super(message)
|
||||
constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
constructor(cause: Throwable?) : super(cause)
|
||||
public actual constructor() : super()
|
||||
public actual constructor(message: String?) : super(message)
|
||||
public constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public constructor(cause: Throwable?) : super(cause)
|
||||
}
|
||||
|
||||
+1
-1
@@ -294,7 +294,7 @@ internal inline fun createContinuationArgumentFromCallback(
|
||||
}
|
||||
|
||||
@PublishedApi
|
||||
internal fun <T> wrapWithContinuationImpl(completion: Continuation<T>) =
|
||||
internal fun <T> wrapWithContinuationImpl(completion: Continuation<T>): Continuation<T> =
|
||||
createSimpleCoroutineForSuspendFunction(probeCoroutineCreated(completion))
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,7 +15,7 @@ package kotlin.native
|
||||
public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
|
||||
@kotlin.native.internal.CanBePrecreated
|
||||
companion object {
|
||||
public companion object {
|
||||
// Default size of one element in the array used to store bits.
|
||||
private const val ELEMENT_SIZE = 64
|
||||
private const val MAX_BIT_OFFSET = ELEMENT_SIZE - 1
|
||||
@@ -29,21 +29,21 @@ public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
get() = size - 1
|
||||
|
||||
/** Returns an index of the last bit that has `true` value. Returns -1 if the set is empty. */
|
||||
val lastTrueIndex: Int
|
||||
public val lastTrueIndex: Int
|
||||
get() = previousSetBit(size)
|
||||
|
||||
/** True if this BitSet contains no bits set to true. */
|
||||
val isEmpty: Boolean
|
||||
public val isEmpty: Boolean
|
||||
get() = bits.all { it == ALL_FALSE }
|
||||
|
||||
/** Actual number of bits available in the set. All bits with indices >= size assumed to be 0 */
|
||||
var size: Int = size
|
||||
public var size: Int = size
|
||||
private set
|
||||
|
||||
/**
|
||||
* Creates a bit set of given [length] filling elements using [initializer]
|
||||
*/
|
||||
constructor(length: Int, initializer: (Int) -> Boolean): this(length) {
|
||||
public constructor(length: Int, initializer: (Int) -> Boolean): this(length) {
|
||||
for (i in 0 until length) {
|
||||
set(i, initializer(i))
|
||||
}
|
||||
@@ -135,17 +135,17 @@ public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
}
|
||||
|
||||
/** Set the bit specified to the specified value. */
|
||||
fun set(index: Int, value: Boolean = true) {
|
||||
public fun set(index: Int, value: Boolean = true) {
|
||||
ensureCapacity(index)
|
||||
val (elementIndex, offset) = index.asBitCoordinates
|
||||
setBitsWithMask(elementIndex, offset.asMask, value)
|
||||
}
|
||||
|
||||
/** Sets the bits with indices between [from] (inclusive) and [to] (exclusive) to the specified value. */
|
||||
fun set(from : Int, to: Int, value: Boolean = true) = set(from until to, value)
|
||||
public fun set(from : Int, to: Int, value: Boolean = true): Unit = set(from until to, value)
|
||||
|
||||
/** Sets the bits from the range specified to the specified value. */
|
||||
fun set(range: IntRange, value: Boolean = true) {
|
||||
public fun set(range: IntRange, value: Boolean = true) {
|
||||
if (range.start < 0 || range.endInclusive < 0) {
|
||||
throw IndexOutOfBoundsException()
|
||||
}
|
||||
@@ -172,31 +172,31 @@ public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
|
||||
|
||||
/** Clears the bit specified */
|
||||
fun clear(index: Int) = set(index, false)
|
||||
public fun clear(index: Int): Unit = set(index, false)
|
||||
/** Clears the bits with indices between [from] (inclusive) and [to] (exclusive) to the specified value. */
|
||||
fun clear(from : Int, to: Int) = set(from, to, false)
|
||||
public fun clear(from : Int, to: Int): Unit = set(from, to, false)
|
||||
/** Clears the bit specified */
|
||||
fun clear(range: IntRange) = set(range, false)
|
||||
public fun clear(range: IntRange): Unit = set(range, false)
|
||||
|
||||
/** Sets all bits in the BitSet to `false`. */
|
||||
fun clear() {
|
||||
public fun clear() {
|
||||
for (i in bits.indices) {
|
||||
bits[i] = ALL_FALSE
|
||||
}
|
||||
}
|
||||
|
||||
/** Reverses the bit specified. */
|
||||
fun flip(index: Int) {
|
||||
public fun flip(index: Int) {
|
||||
ensureCapacity(index)
|
||||
val (elementIndex, offset) = index.asBitCoordinates
|
||||
flipBitsWithMask(elementIndex, offset.asMask)
|
||||
}
|
||||
|
||||
/** Reverses the bits with indices between [from] (inclusive) and [to] (exclusive). */
|
||||
fun flip(from: Int, to: Int) = flip(from until to)
|
||||
public fun flip(from: Int, to: Int): Unit = flip(from until to)
|
||||
|
||||
/** Reverses the bits from the range specified. */
|
||||
fun flip(range: IntRange) {
|
||||
public fun flip(range: IntRange) {
|
||||
if (range.start < 0 || range.endInclusive < 0) {
|
||||
throw IndexOutOfBoundsException()
|
||||
}
|
||||
@@ -262,7 +262,7 @@ public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
* Returns -1 if there is no such bits after [startIndex].
|
||||
* @throws IndexOutOfBoundException if [startIndex] < 0.
|
||||
*/
|
||||
fun nextSetBit(startIndex: Int = 0): Int = nextBit(startIndex, true)
|
||||
public fun nextSetBit(startIndex: Int = 0): Int = nextBit(startIndex, true)
|
||||
|
||||
/**
|
||||
* Returns an index of a next bit which value is `false` after [startIndex] (inclusive).
|
||||
@@ -270,14 +270,14 @@ public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
* sequence of `false` bits after (size - 1)-th.
|
||||
* @throws IndexOutOfBoundException if [startIndex] < 0.
|
||||
*/
|
||||
fun nextClearBit(startIndex: Int = 0): Int = nextBit(startIndex, false)
|
||||
public fun nextClearBit(startIndex: Int = 0): Int = nextBit(startIndex, false)
|
||||
|
||||
/**
|
||||
* Returns the biggest index of a bit which value is [lookFor] before [startIndex] (inclusive).
|
||||
* Returns -1 if there is no such bits before [startIndex].
|
||||
* If [startIndex] >= [size] returns -1
|
||||
*/
|
||||
fun previousBit(startIndex: Int, lookFor: Boolean): Int {
|
||||
public fun previousBit(startIndex: Int, lookFor: Boolean): Int {
|
||||
var correctStartIndex = startIndex
|
||||
if (startIndex >= size) {
|
||||
// We assume that all bits after `size - 1` are 0. So we can return the start index if we are looking for 0.
|
||||
@@ -323,7 +323,7 @@ public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
* If [startIndex] >= size will search from (size - 1)-th bit.
|
||||
* @throws IndexOutOfBoundException if [startIndex] < -1.
|
||||
*/
|
||||
fun previousSetBit(startIndex: Int): Int = previousBit(startIndex, true)
|
||||
public fun previousSetBit(startIndex: Int): Int = previousBit(startIndex, true)
|
||||
|
||||
/**
|
||||
* Returns the biggest index of a bit which value is `false` before [startIndex] (inclusive).
|
||||
@@ -332,10 +332,10 @@ public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
* sequence of `false` bits after (size - 1)-th.
|
||||
* @throws IndexOutOfBoundException if [startIndex] < -1.
|
||||
*/
|
||||
fun previousClearBit(startIndex: Int): Int = previousBit(startIndex, false)
|
||||
public fun previousClearBit(startIndex: Int): Int = previousBit(startIndex, false)
|
||||
|
||||
/** Returns a value of a bit with the [index] specified. */
|
||||
operator fun get(index: Int): Boolean {
|
||||
public operator fun get(index: Int): Boolean {
|
||||
if (index < 0) {
|
||||
throw IndexOutOfBoundsException()
|
||||
}
|
||||
@@ -360,16 +360,16 @@ public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
}
|
||||
|
||||
/** Performs a logical and operation over corresponding bits of this and [another] BitSets. The result is saved in this BitSet. */
|
||||
fun and(another: BitSet) = doOperation(another, Long::and)
|
||||
public fun and(another: BitSet): Unit = doOperation(another, Long::and)
|
||||
|
||||
/** Performs a logical or operation over corresponding bits of this and [another] BitSets. The result is saved in this BitSet. */
|
||||
fun or(another: BitSet) = doOperation(another, Long::or)
|
||||
public fun or(another: BitSet): Unit = doOperation(another, Long::or)
|
||||
|
||||
/** Performs a logical xor operation over corresponding bits of this and [another] BitSets. The result is saved in this BitSet. */
|
||||
fun xor(another: BitSet) = doOperation(another, Long::xor)
|
||||
public fun xor(another: BitSet): Unit = doOperation(another, Long::xor)
|
||||
|
||||
/** Performs a logical and + not operations over corresponding bits of this and [another] BitSets. The result is saved in this BitSet. */
|
||||
fun andNot(another: BitSet) {
|
||||
public fun andNot(another: BitSet) {
|
||||
ensureCapacity(another.lastIndex)
|
||||
var index = 0
|
||||
while (index < another.bits.size) {
|
||||
@@ -383,7 +383,7 @@ public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
}
|
||||
|
||||
/** Returns true if the specified BitSet has any bits set to true that are also set to true in this BitSet. */
|
||||
fun intersects(another: BitSet): Boolean =
|
||||
public fun intersects(another: BitSet): Boolean =
|
||||
(0 until minOf(bits.size, another.bits.size)).any { bits[it] and another.bits[it] != 0L }
|
||||
|
||||
override fun toString(): String {
|
||||
|
||||
@@ -29,7 +29,7 @@ public enum class OsFamily {
|
||||
* Central Processor Unit architecture.
|
||||
*/
|
||||
@ExperimentalNativeApi
|
||||
public enum class CpuArchitecture(val bitness: Int) {
|
||||
public enum class CpuArchitecture(public val bitness: Int) {
|
||||
UNKNOWN(-1),
|
||||
ARM32(32),
|
||||
ARM64(64),
|
||||
@@ -182,4 +182,4 @@ private external fun Platform_getAvailableProcessors(): Int
|
||||
|
||||
@TypedIntrinsic(IntrinsicType.IS_EXPERIMENTAL_MM)
|
||||
@ExperimentalStdlibApi
|
||||
external fun isExperimentalMM(): Boolean
|
||||
public external fun isExperimentalMM(): Boolean
|
||||
|
||||
@@ -32,9 +32,9 @@ external public fun deinitRuntimeIfNeeded(): Unit
|
||||
*/
|
||||
@FreezingIsDeprecated
|
||||
public class IncorrectDereferenceException : RuntimeException {
|
||||
constructor() : super()
|
||||
public constructor() : super()
|
||||
|
||||
constructor(message: String) : super(message)
|
||||
public constructor(message: String) : super(message)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ public class AtomicLong(public @Volatile var value: Long = 0L) {
|
||||
* Atomically decrements the current value by one.
|
||||
*/
|
||||
@Deprecated("Use decrementAndGet() or getAndDecrement() instead.", ReplaceWith("this.decrementAndGet()"), DeprecationLevel.ERROR)
|
||||
fun decrement(): Unit {
|
||||
public fun decrement(): Unit {
|
||||
addAndGet(-1L)
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ public class Continuation2<T1, T2>(
|
||||
}
|
||||
}
|
||||
|
||||
fun dispose() {
|
||||
public fun dispose() {
|
||||
assert(!singleShot)
|
||||
stable.dispose()
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public fun <T> T.freeze(): T {
|
||||
* @return true if given object is null or frozen or permanent
|
||||
*/
|
||||
@FreezingIsDeprecated
|
||||
public val Any?.isFrozen
|
||||
public val Any?.isFrozen: Boolean
|
||||
get() = isFrozenInternal(this)
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,7 @@ import kotlin.native.internal.Frozen
|
||||
* State of the future object.
|
||||
*/
|
||||
@ObsoleteWorkersApi
|
||||
enum class FutureState(val value: Int) {
|
||||
public enum class FutureState(public val value: Int) {
|
||||
INVALID(0),
|
||||
/** Future is scheduled for execution. */
|
||||
SCHEDULED(1),
|
||||
@@ -28,7 +28,7 @@ enum class FutureState(val value: Int) {
|
||||
*/
|
||||
@Suppress("NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS")
|
||||
@ObsoleteWorkersApi
|
||||
public value class Future<T> @PublishedApi internal constructor(val id: Int) {
|
||||
public value class Future<T> @PublishedApi internal constructor(public val id: Int) {
|
||||
/**
|
||||
* Blocks execution until the future is ready.
|
||||
*
|
||||
|
||||
@@ -68,14 +68,14 @@ public class MutableData constructor(capacity: Int = 16) {
|
||||
/**
|
||||
* Reset the data buffer, makings its size 0.
|
||||
*/
|
||||
public fun reset() = locked(lock) {
|
||||
public fun reset(): Unit = locked(lock) {
|
||||
size_ = 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends data to the buffer.
|
||||
*/
|
||||
public fun append(data: MutableData) = locked(lock) {
|
||||
public fun append(data: MutableData): Unit = locked(lock) {
|
||||
val toCopy = data.size
|
||||
val where = resizeDataLocked(size + toCopy)
|
||||
data.copyInto(buffer, 0, toCopy, where)
|
||||
@@ -126,7 +126,7 @@ public class MutableData constructor(capacity: Int = 16) {
|
||||
* Executes provided block under lock with raw pointer to the data stored in the buffer.
|
||||
* Block is executed under the spinlock, and must be short.
|
||||
*/
|
||||
public fun <R> withPointerLocked(block: (COpaquePointer, dataSize: Int) -> R) = locked(lock) {
|
||||
public fun <R> withPointerLocked(block: (COpaquePointer, dataSize: Int) -> R): R = locked(lock) {
|
||||
buffer.usePinned {
|
||||
it -> block(it.addressOf(0), size)
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public class MutableData constructor(capacity: Int = 16) {
|
||||
* Executes provided block under lock with the raw data buffer.
|
||||
* Block is executed under the spinlock, and must be short.
|
||||
*/
|
||||
public fun <R> withBufferLocked(block: (array: ByteArray, dataSize: Int) -> R) = locked(lock) {
|
||||
public fun <R> withBufferLocked(block: (array: ByteArray, dataSize: Int) -> R): R = locked(lock) {
|
||||
block(buffer, size)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ import kotlin.concurrent.AtomicNativePtr
|
||||
*/
|
||||
// Not @FreezingIsDeprecated: every `Worker.execute` uses this.
|
||||
@ObsoleteWorkersApi
|
||||
public enum class TransferMode(val value: Int) {
|
||||
public enum class TransferMode(public val value: Int) {
|
||||
/**
|
||||
* Reachability check is performed.
|
||||
*/
|
||||
@@ -59,7 +59,7 @@ public enum class TransferMode(val value: Int) {
|
||||
@ObsoleteWorkersApi
|
||||
public class DetachedObjectGraph<T> internal constructor(pointer: NativePtr) {
|
||||
@PublishedApi
|
||||
internal val stable = AtomicNativePtr(pointer)
|
||||
internal val stable: AtomicNativePtr = AtomicNativePtr(pointer)
|
||||
|
||||
/**
|
||||
* Creates stable pointer to object, ensuring associated object subgraph is disjoint in specified mode
|
||||
|
||||
@@ -35,8 +35,8 @@ import kotlinx.cinterop.*
|
||||
@Suppress("NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS")
|
||||
@OptIn(FreezingIsDeprecated::class)
|
||||
@ObsoleteWorkersApi
|
||||
public value class Worker @PublishedApi internal constructor(val id: Int) {
|
||||
companion object {
|
||||
public value class Worker @PublishedApi internal constructor(public val id: Int) {
|
||||
public companion object {
|
||||
/**
|
||||
* Start new scheduling primitive, such as thread, to accept new tasks via `execute` interface.
|
||||
* Typically new worker may be needed for computations offload to another core, for IO it may be
|
||||
|
||||
+3
-3
@@ -51,19 +51,19 @@ public class WorkerBoundReference<out T : Any>(value: T) {
|
||||
* The referenced value.
|
||||
* @throws IncorrectDereferenceException if referred object is not frozen and current worker is different from the one created [this].
|
||||
*/
|
||||
val value: T
|
||||
public val value: T
|
||||
get() = valueOrNull ?: throw IncorrectDereferenceException("illegal attempt to access non-shared $valueDescription bound to `$ownerName` from `${Worker.current.name}`")
|
||||
|
||||
/**
|
||||
* The referenced value or null if referred object is not frozen and current worker is different from the one created [this].
|
||||
*/
|
||||
val valueOrNull: T?
|
||||
public val valueOrNull: T?
|
||||
get() = valueBeforeFreezing ?: @Suppress("UNCHECKED_CAST") (derefWorkerBoundReference(ptr) as T?)
|
||||
|
||||
/**
|
||||
* Worker that [value] is bound to.
|
||||
*/
|
||||
val worker: Worker = Worker.current
|
||||
public val worker: Worker = Worker.current
|
||||
|
||||
@ExportForCppRuntime("Kotlin_WorkerBoundReference_freezeHook")
|
||||
private fun freezeHook() {
|
||||
|
||||
@@ -168,7 +168,7 @@ internal annotation class HasFreezeHook
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(value = AnnotationRetention.BINARY)
|
||||
@InternalForKotlinNative
|
||||
annotation class GCUnsafeCall(val callee: String)
|
||||
public annotation class GCUnsafeCall(val callee: String)
|
||||
|
||||
/**
|
||||
* Marks a declaration that is internal for Kotlin/Native tests and shouldn't be used externally.
|
||||
|
||||
@@ -77,7 +77,7 @@ public interface Cleaner
|
||||
@ExperimentalStdlibApi
|
||||
@ExportForCompiler
|
||||
@OptIn(ExperimentalNativeApi::class, ObsoleteWorkersApi::class)
|
||||
fun <T> createCleaner(argument: T, block: (T) -> Unit): Cleaner =
|
||||
public fun <T> createCleaner(argument: T, block: (T) -> Unit): Cleaner =
|
||||
kotlin.native.ref.createCleanerImpl(argument, block) as Cleaner
|
||||
|
||||
/**
|
||||
@@ -85,7 +85,7 @@ fun <T> createCleaner(argument: T, block: (T) -> Unit): Cleaner =
|
||||
*/
|
||||
@InternalForKotlinNative
|
||||
@OptIn(kotlin.native.runtime.NativeRuntimeApi::class, ObsoleteWorkersApi::class)
|
||||
fun performGCOnCleanerWorker() =
|
||||
public fun performGCOnCleanerWorker(): Unit =
|
||||
getCleanerWorker().execute(TransferMode.SAFE, {}) {
|
||||
GC.collect()
|
||||
}.result
|
||||
@@ -95,14 +95,14 @@ fun performGCOnCleanerWorker() =
|
||||
*/
|
||||
@InternalForKotlinNative
|
||||
@OptIn(ObsoleteWorkersApi::class)
|
||||
fun waitCleanerWorker() =
|
||||
public fun waitCleanerWorker(): Unit =
|
||||
getCleanerWorker().execute(TransferMode.SAFE, {}) {
|
||||
Unit
|
||||
}.result
|
||||
|
||||
@GCUnsafeCall("Kotlin_CleanerImpl_getCleanerWorker")
|
||||
@OptIn(ObsoleteWorkersApi::class)
|
||||
external internal fun getCleanerWorker(): Worker
|
||||
internal external fun getCleanerWorker(): Worker
|
||||
|
||||
@ExportForCppRuntime("Kotlin_CleanerImpl_shutdownCleanerWorker")
|
||||
@OptIn(ObsoleteWorkersApi::class)
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:Suppress("NO_EXPLICIT_VISIBILITY_IN_API_MODE") // Scheduled for eventual removal
|
||||
|
||||
package kotlin.native.internal
|
||||
|
||||
import kotlin.time.*
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
package kotlin.native.internal
|
||||
|
||||
@InternalForKotlinNative
|
||||
object MemoryUsageInfo {
|
||||
public object MemoryUsageInfo {
|
||||
// An estimate of how much memory was committed by the process at its peak.
|
||||
// Resident Set Size in *nix, Working Set Size in Windows.
|
||||
// May return 0 if unimplemented on some platform, or in case of an error.
|
||||
val peakResidentSetSizeBytes: Long
|
||||
public val peakResidentSetSizeBytes: Long
|
||||
get() = MemoryUsageInfo_getPeakResidentSetSizeBytes()
|
||||
}
|
||||
|
||||
|
||||
@@ -14,23 +14,23 @@ import kotlinx.cinterop.*
|
||||
internal external fun getNativeNullPtr(): NativePtr
|
||||
|
||||
@ExperimentalForeignApi
|
||||
class NativePtr @PublishedApi internal constructor(private val value: NonNullNativePtr?) {
|
||||
companion object {
|
||||
public class NativePtr @PublishedApi internal constructor(private val value: NonNullNativePtr?) {
|
||||
public companion object {
|
||||
// TODO: make it properly precreated, maybe use an intrinsic for that.
|
||||
val NULL = getNativeNullPtr()
|
||||
public val NULL: NativePtr = getNativeNullPtr()
|
||||
}
|
||||
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_NATIVE_PTR_PLUS_LONG)
|
||||
external operator fun plus(offset: Long): NativePtr
|
||||
public external operator fun plus(offset: Long): NativePtr
|
||||
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_NATIVE_PTR_TO_LONG)
|
||||
external fun toLong(): Long
|
||||
public external fun toLong(): Long
|
||||
|
||||
override fun equals(other: Any?) = (other is NativePtr) && kotlin.native.internal.areEqualByValue(this, other)
|
||||
override fun equals(other: Any?): Boolean = (other is NativePtr) && kotlin.native.internal.areEqualByValue(this, other)
|
||||
|
||||
override fun hashCode() = this.toLong().hashCode()
|
||||
override fun hashCode(): Int = this.toLong().hashCode()
|
||||
|
||||
override fun toString() = "0x${this.toLong().toString(16)}"
|
||||
override fun toString(): String = "0x${this.toLong().toString(16)}"
|
||||
|
||||
internal fun isNull(): Boolean = (value == null)
|
||||
}
|
||||
@@ -40,11 +40,11 @@ internal class NonNullNativePtr private constructor() { // TODO: refactor to use
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun toNativePtr() = NativePtr(this)
|
||||
|
||||
override fun toString() = toNativePtr().toString()
|
||||
override fun toString(): String = toNativePtr().toString()
|
||||
|
||||
override fun hashCode() = toNativePtr().hashCode()
|
||||
override fun hashCode(): Int = toNativePtr().hashCode()
|
||||
|
||||
override fun equals(other: Any?) = other is NonNullNativePtr
|
||||
override fun equals(other: Any?): Boolean = other is NonNullNativePtr
|
||||
&& kotlin.native.internal.areEqualByValue(this.toNativePtr(), other.toNativePtr())
|
||||
}
|
||||
|
||||
@@ -52,14 +52,14 @@ internal class NonNullNativePtr private constructor() { // TODO: refactor to use
|
||||
internal class NativePtrArray {
|
||||
|
||||
@GCUnsafeCall("Kotlin_NativePtrArray_get")
|
||||
external public operator fun get(index: Int): NativePtr
|
||||
public external operator fun get(index: Int): NativePtr
|
||||
|
||||
@GCUnsafeCall("Kotlin_NativePtrArray_set")
|
||||
external public operator fun set(index: Int, value: NativePtr): Unit
|
||||
public external operator fun set(index: Int, value: NativePtr): Unit
|
||||
|
||||
val size: Int
|
||||
get() = getArrayLength()
|
||||
|
||||
@GCUnsafeCall("Kotlin_NativePtrArray_getArrayLength")
|
||||
external private fun getArrayLength(): Int
|
||||
private external fun getArrayLength(): Int
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ internal class NSEnumeratorAsKIterator : AbstractIterator<Any?>() {
|
||||
error: Any
|
||||
) = ObjCErrorException(message, error)
|
||||
|
||||
class ObjCErrorException(
|
||||
public class ObjCErrorException(
|
||||
message: String?,
|
||||
internal val error: Any
|
||||
) : Exception(message) {
|
||||
|
||||
@@ -225,10 +225,10 @@ internal external fun initInstance(thiz: Any, constructorCall: Any): Unit
|
||||
internal external fun <T> isSubtype(objTypeInfo: NativePtr): Boolean
|
||||
|
||||
@PublishedApi
|
||||
internal fun checkProgressionStep(step: Int) =
|
||||
internal fun checkProgressionStep(step: Int): Int =
|
||||
if (step > 0) step else throw IllegalArgumentException("Step must be positive, was: $step.")
|
||||
@PublishedApi
|
||||
internal fun checkProgressionStep(step: Long) =
|
||||
internal fun checkProgressionStep(step: Long): Long =
|
||||
if (step > 0) step else throw IllegalArgumentException("Step must be positive, was: $step.")
|
||||
|
||||
@PublishedApi
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:Suppress("NO_EXPLICIT_VISIBILITY_IN_API_MODE") // Scheduled for eventual removal
|
||||
|
||||
package kotlin.native.internal.gc
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,14 +13,14 @@ import kotlin.native.concurrent.*
|
||||
|
||||
// Advanced users may need an access to test suites generated by the compiler to integrate
|
||||
// our test machinery with third party test runners (e.g. with xctestrun).
|
||||
// So we keep this object public but protect it with @ExperimentalStdlibApi
|
||||
// So we keep this object public but protect it with @ExperimentalNativeApi
|
||||
// to stress that it is not a part of the stable API.
|
||||
// Related YT issue: KT-47915.
|
||||
@ExperimentalNativeApi
|
||||
@ThreadLocal
|
||||
public object GeneratedSuites {
|
||||
val suites = mutableListOf<TestSuite>()
|
||||
fun add(suite: TestSuite) = suites.add(suite)
|
||||
public val suites: MutableList<TestSuite> = mutableListOf<TestSuite>()
|
||||
public fun add(suite: TestSuite): Boolean = suites.add(suite)
|
||||
}
|
||||
|
||||
@ExperimentalNativeApi
|
||||
@@ -29,12 +29,12 @@ public fun registerSuite(suite: TestSuite): Unit {
|
||||
}
|
||||
|
||||
@ExperimentalNativeApi
|
||||
fun testLauncherEntryPoint(args: Array<String>): Int {
|
||||
public fun testLauncherEntryPoint(args: Array<String>): Int {
|
||||
return TestRunner(GeneratedSuites.suites, args).run()
|
||||
}
|
||||
|
||||
@ExperimentalNativeApi
|
||||
fun main(args: Array<String>) {
|
||||
public fun main(args: Array<String>) {
|
||||
val exitCode = testLauncherEntryPoint(args)
|
||||
if (exitCode != 0) {
|
||||
exitProcess(exitCode)
|
||||
@@ -44,7 +44,7 @@ fun main(args: Array<String>) {
|
||||
@OptIn(FreezingIsDeprecated::class)
|
||||
@ExperimentalNativeApi
|
||||
@ObsoleteWorkersApi
|
||||
fun worker(args: Array<String>) {
|
||||
public fun worker(args: Array<String>) {
|
||||
val worker = Worker.start()
|
||||
val exitCode = worker.execute(TransferMode.SAFE, { args.freeze() }) {
|
||||
it -> testLauncherEntryPoint(it)
|
||||
@@ -56,6 +56,6 @@ fun worker(args: Array<String>) {
|
||||
}
|
||||
|
||||
@ExperimentalNativeApi
|
||||
fun mainNoExit(args: Array<String>) {
|
||||
public fun mainNoExit(args: Array<String>) {
|
||||
testLauncherEntryPoint(args)
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ package kotlin.native.internal.test
|
||||
|
||||
import kotlin.experimental.ExperimentalNativeApi
|
||||
import kotlin.IllegalArgumentException
|
||||
import kotlin.system.getTimeMillis
|
||||
import kotlin.system.measureTimeMillis
|
||||
|
||||
/**
|
||||
* Represents a test case, that is a Kotlin test method marked with `@Test` annotaion.
|
||||
@@ -17,38 +15,38 @@ import kotlin.system.measureTimeMillis
|
||||
*/
|
||||
@ExperimentalNativeApi
|
||||
public interface TestCase {
|
||||
val name: String
|
||||
public val name: String
|
||||
|
||||
/**
|
||||
* Shows if this test is ignored by the `@Ignore` annotation.
|
||||
*
|
||||
* @see kotlin.test.Ignore
|
||||
*/
|
||||
val ignored: Boolean
|
||||
public val ignored: Boolean
|
||||
|
||||
/**
|
||||
* Test Suite the test belongs to.
|
||||
*/
|
||||
val suite: TestSuite
|
||||
public val suite: TestSuite
|
||||
|
||||
/**
|
||||
* Runs all methods that were marked with `@BeforeTest` annotation.
|
||||
*
|
||||
* @see kotlin.test.BeforeTest
|
||||
*/
|
||||
fun doBefore()
|
||||
public fun doBefore()
|
||||
|
||||
/**
|
||||
* Runs the test method itself
|
||||
*
|
||||
* @see kotlin.test.Test
|
||||
*/
|
||||
fun doRun()
|
||||
public fun doRun()
|
||||
|
||||
/**
|
||||
* Runs test with its before and after functions.
|
||||
*/
|
||||
fun run() {
|
||||
public fun run() {
|
||||
try {
|
||||
doBefore()
|
||||
doRun()
|
||||
@@ -62,7 +60,7 @@ public interface TestCase {
|
||||
*
|
||||
* @see kotlin.test.AfterTest
|
||||
*/
|
||||
fun doAfter()
|
||||
public fun doAfter()
|
||||
}
|
||||
|
||||
@ExperimentalNativeApi
|
||||
@@ -79,38 +77,38 @@ public interface TestSuite {
|
||||
/**
|
||||
* Test suite name.
|
||||
*/
|
||||
val name: String
|
||||
public val name: String
|
||||
|
||||
/**
|
||||
* Shows if the suite is ignored with `@Ignore` annotation.
|
||||
*
|
||||
* @see kotlin.test.Ignore
|
||||
*/
|
||||
val ignored: Boolean
|
||||
public val ignored: Boolean
|
||||
|
||||
/**
|
||||
* Test cases this test suite contains
|
||||
*/
|
||||
val testCases: Map<String, TestCase>
|
||||
public val testCases: Map<String, TestCase>
|
||||
|
||||
/**
|
||||
* Number of test cases
|
||||
*/
|
||||
val size : Int
|
||||
public val size : Int
|
||||
|
||||
/**
|
||||
* Executes all methods marked with `@BeforeClass` annotation
|
||||
*
|
||||
* @see kotlin.test.BeforeClass
|
||||
*/
|
||||
fun doBeforeClass()
|
||||
public fun doBeforeClass()
|
||||
|
||||
/**
|
||||
* Executes all methods marked with `@AfterClass` annotation
|
||||
*
|
||||
* @see @see kotlin.test.AfterClass
|
||||
*/
|
||||
fun doAfterClass()
|
||||
public fun doAfterClass()
|
||||
}
|
||||
|
||||
@ExperimentalNativeApi
|
||||
@@ -127,10 +125,10 @@ public abstract class AbstractTestSuite<F: Function<Unit>>(override val name: St
|
||||
override fun toString(): String = name
|
||||
|
||||
// TODO: Make inner and remove the type param when the bug is fixed.
|
||||
abstract class BasicTestCase<F: Function<Unit>>(
|
||||
public abstract class BasicTestCase<F: Function<Unit>>(
|
||||
override val name: String,
|
||||
override val suite: AbstractTestSuite<F>,
|
||||
val testFunction: F,
|
||||
public val testFunction: F,
|
||||
override val ignored: Boolean
|
||||
) : TestCase {
|
||||
override fun toString(): String = "$name ($suite)"
|
||||
@@ -142,10 +140,10 @@ public abstract class AbstractTestSuite<F: Function<Unit>>(override val name: St
|
||||
|
||||
private fun registerTestCase(testCase: BasicTestCase<F>) = _testCases.put(testCase.name, testCase)
|
||||
|
||||
fun registerTestCase(name: String, testFunction: F, ignored: Boolean) =
|
||||
public fun registerTestCase(name: String, testFunction: F, ignored: Boolean): BasicTestCase<F>? =
|
||||
registerTestCase(createTestCase(name, testFunction, ignored))
|
||||
|
||||
abstract fun createTestCase(name: String, testFunction: F, ignored: Boolean): BasicTestCase<F>
|
||||
public abstract fun createTestCase(name: String, testFunction: F, ignored: Boolean): BasicTestCase<F>
|
||||
|
||||
init {
|
||||
registerSuite(this)
|
||||
@@ -159,10 +157,10 @@ public abstract class AbstractTestSuite<F: Function<Unit>>(override val name: St
|
||||
public abstract class BaseClassSuite<INSTANCE, COMPANION>(name: String, ignored: Boolean)
|
||||
: AbstractTestSuite<INSTANCE.() -> Unit>(name, ignored) {
|
||||
|
||||
class TestCase<INSTANCE, COMPANION>(name: String,
|
||||
override val suite: BaseClassSuite<INSTANCE, COMPANION>,
|
||||
testFunction: INSTANCE.() -> Unit,
|
||||
ignored: Boolean)
|
||||
public class TestCase<INSTANCE, COMPANION>(name: String,
|
||||
override val suite: BaseClassSuite<INSTANCE, COMPANION>,
|
||||
testFunction: INSTANCE.() -> Unit,
|
||||
ignored: Boolean)
|
||||
: BasicTestCase<INSTANCE.() -> Unit>(name, suite, testFunction, ignored) {
|
||||
|
||||
internal val instance: INSTANCE by lazy { suite.createInstance() }
|
||||
@@ -181,12 +179,12 @@ public abstract class BaseClassSuite<INSTANCE, COMPANION>(name: String, ignored:
|
||||
}
|
||||
|
||||
// These two methods are overridden in test suite classes generated by the compiler.
|
||||
abstract fun createInstance(): INSTANCE
|
||||
open fun getCompanion(): COMPANION = throw NotImplementedError("Test class has no companion object")
|
||||
public abstract fun createInstance(): INSTANCE
|
||||
public open fun getCompanion(): COMPANION = throw NotImplementedError("Test class has no companion object")
|
||||
|
||||
companion object {
|
||||
val INSTANCE_KINDS = listOf(TestFunctionKind.BEFORE_TEST, TestFunctionKind.AFTER_TEST)
|
||||
val COMPANION_KINDS = listOf(TestFunctionKind.BEFORE_CLASS, TestFunctionKind.AFTER_CLASS)
|
||||
public companion object {
|
||||
public val INSTANCE_KINDS: List<TestFunctionKind> = listOf(TestFunctionKind.BEFORE_TEST, TestFunctionKind.AFTER_TEST)
|
||||
public val COMPANION_KINDS: List<TestFunctionKind> = listOf(TestFunctionKind.BEFORE_CLASS, TestFunctionKind.AFTER_CLASS)
|
||||
}
|
||||
|
||||
private val instanceFunctions = mutableMapOf<TestFunctionKind, MutableSet<INSTANCE.() -> Unit>>()
|
||||
@@ -201,22 +199,22 @@ public abstract class BaseClassSuite<INSTANCE, COMPANION>(name: String, ignored:
|
||||
return companionFunction.getOrPut(kind) { mutableSetOf() }
|
||||
}
|
||||
|
||||
val before: Collection<INSTANCE.() -> Unit> get() = getInstanceFunctions(TestFunctionKind.BEFORE_TEST)
|
||||
val after: Collection<INSTANCE.() -> Unit> get() = getInstanceFunctions(TestFunctionKind.AFTER_TEST)
|
||||
public val before: Collection<INSTANCE.() -> Unit> get() = getInstanceFunctions(TestFunctionKind.BEFORE_TEST)
|
||||
public val after: Collection<INSTANCE.() -> Unit> get() = getInstanceFunctions(TestFunctionKind.AFTER_TEST)
|
||||
|
||||
val beforeClass: Collection<COMPANION.() -> Unit> get() = getCompanionFunctions(TestFunctionKind.BEFORE_CLASS)
|
||||
val afterClass: Collection<COMPANION.() -> Unit> get() = getCompanionFunctions(TestFunctionKind.AFTER_CLASS)
|
||||
public val beforeClass: Collection<COMPANION.() -> Unit> get() = getCompanionFunctions(TestFunctionKind.BEFORE_CLASS)
|
||||
public val afterClass: Collection<COMPANION.() -> Unit> get() = getCompanionFunctions(TestFunctionKind.AFTER_CLASS)
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun registerFunction(kind: TestFunctionKind, function: Function1<*, Unit>) =
|
||||
public fun registerFunction(kind: TestFunctionKind, function: Function1<*, Unit>): Boolean =
|
||||
when (kind) {
|
||||
in INSTANCE_KINDS -> getInstanceFunctions(kind).add(function as INSTANCE.() -> Unit)
|
||||
in COMPANION_KINDS -> getCompanionFunctions(kind).add(function as COMPANION.() -> Unit)
|
||||
else -> throw IllegalArgumentException("Unknown function kind: $kind")
|
||||
}
|
||||
|
||||
override fun doBeforeClass() = beforeClass.forEach { getCompanion().it() }
|
||||
override fun doAfterClass() = afterClass.forEach { getCompanion().it() }
|
||||
override fun doBeforeClass(): Unit = beforeClass.forEach { getCompanion().it() }
|
||||
override fun doAfterClass(): Unit = afterClass.forEach { getCompanion().it() }
|
||||
|
||||
override fun createTestCase(name: String, testFunction: INSTANCE.() -> Unit, ignored: Boolean)
|
||||
: BasicTestCase<INSTANCE.() -> Unit> =
|
||||
@@ -228,7 +226,7 @@ private typealias TopLevelFun = () -> Unit
|
||||
@ExperimentalNativeApi
|
||||
public class TopLevelSuite(name: String): AbstractTestSuite<TopLevelFun>(name, false) {
|
||||
|
||||
class TestCase(name: String, override val suite: TopLevelSuite, testFunction: TopLevelFun, ignored: Boolean)
|
||||
public class TestCase(name: String, override val suite: TopLevelSuite, testFunction: TopLevelFun, ignored: Boolean)
|
||||
: BasicTestCase<TopLevelFun>(name, suite, testFunction, ignored) {
|
||||
override fun doBefore() {
|
||||
suite.before.forEach { it() }
|
||||
@@ -246,15 +244,15 @@ public class TopLevelSuite(name: String): AbstractTestSuite<TopLevelFun>(name, f
|
||||
private val specialFunctions = mutableMapOf<TestFunctionKind, MutableSet<TopLevelFun>>()
|
||||
private fun getFunctions(type: TestFunctionKind) = specialFunctions.getOrPut(type) { mutableSetOf() }
|
||||
|
||||
val before: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.BEFORE_TEST)
|
||||
val after: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.AFTER_TEST)
|
||||
val beforeClass: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.BEFORE_CLASS)
|
||||
val afterClass: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.AFTER_CLASS)
|
||||
public val before: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.BEFORE_TEST)
|
||||
public val after: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.AFTER_TEST)
|
||||
public val beforeClass: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.BEFORE_CLASS)
|
||||
public val afterClass: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.AFTER_CLASS)
|
||||
|
||||
fun registerFunction(kind: TestFunctionKind, function: TopLevelFun) = getFunctions(kind).add(function)
|
||||
public fun registerFunction(kind: TestFunctionKind, function: TopLevelFun): Boolean = getFunctions(kind).add(function)
|
||||
|
||||
override fun doBeforeClass() = beforeClass.forEach { it() }
|
||||
override fun doAfterClass() = afterClass.forEach { it() }
|
||||
override fun doBeforeClass(): Unit = beforeClass.forEach { it() }
|
||||
override fun doAfterClass(): Unit = afterClass.forEach { it() }
|
||||
|
||||
override fun createTestCase(name: String, testFunction: TopLevelFun, ignored: Boolean)
|
||||
: BasicTestCase<TopLevelFun> = TestCase(name, this, testFunction, ignored)
|
||||
|
||||
@@ -18,7 +18,7 @@ public class WeakReference<T : Any> {
|
||||
* Creates a weak reference object pointing to an object. Weak reference doesn't prevent
|
||||
* removing object, and is nullified once object is collected.
|
||||
*/
|
||||
constructor(referred: T) {
|
||||
public constructor(referred: T) {
|
||||
pointer = getWeakReferenceImpl(referred)
|
||||
}
|
||||
|
||||
|
||||
@@ -44,13 +44,13 @@ public object GC {
|
||||
* with [stop] operation. Even if GC is suspended, [collect] still triggers collection.
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_collect")
|
||||
external fun collect()
|
||||
public external fun collect()
|
||||
|
||||
/**
|
||||
* Trigger new collection without waiting for its completion.
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_schedule")
|
||||
external fun schedule()
|
||||
public external fun schedule()
|
||||
|
||||
/**
|
||||
* Deprecated and unused.
|
||||
@@ -59,7 +59,7 @@ public object GC {
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_collectCyclic")
|
||||
@Deprecated("No-op in modern GC implementation")
|
||||
external fun collectCyclic()
|
||||
public external fun collectCyclic()
|
||||
|
||||
/**
|
||||
* Deprecated and unused.
|
||||
@@ -68,7 +68,7 @@ public object GC {
|
||||
* GC algorithm is not executed.
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_suspend")
|
||||
external fun suspend()
|
||||
public external fun suspend()
|
||||
|
||||
/**
|
||||
* Deprecated and unused.
|
||||
@@ -77,7 +77,7 @@ public object GC {
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_resume")
|
||||
@Deprecated("No-op in modern GC implementation")
|
||||
external fun resume()
|
||||
public external fun resume()
|
||||
|
||||
/**
|
||||
* Deprecated and unused.
|
||||
@@ -86,7 +86,7 @@ public object GC {
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_stop")
|
||||
@Deprecated("No-op in modern GC implementation")
|
||||
external fun stop()
|
||||
public external fun stop()
|
||||
|
||||
/**
|
||||
* Deprecated and unused.
|
||||
@@ -96,7 +96,7 @@ public object GC {
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_start")
|
||||
@Deprecated("No-op in modern GC implementation")
|
||||
external fun start()
|
||||
public external fun start()
|
||||
|
||||
/**
|
||||
* Deprecated and unused.
|
||||
@@ -109,7 +109,7 @@ public object GC {
|
||||
* @throws [IllegalArgumentException] when value is not positive.
|
||||
*/
|
||||
@Deprecated("No-op in modern GC implementation")
|
||||
var threshold: Int
|
||||
public var threshold: Int
|
||||
get() = getThreshold()
|
||||
set(value) {
|
||||
require(value > 0) { "threshold must be positive: $value" }
|
||||
@@ -127,7 +127,7 @@ public object GC {
|
||||
* @throws [IllegalArgumentException] when value is not positive.
|
||||
*/
|
||||
@Deprecated("No-op in modern GC implementation")
|
||||
var collectCyclesThreshold: Long
|
||||
public var collectCyclesThreshold: Long
|
||||
get() = getCollectCyclesThreshold()
|
||||
set(value) {
|
||||
require(value > 0) { "collectCyclesThreshold must be positive: $value" }
|
||||
@@ -144,7 +144,7 @@ public object GC {
|
||||
*
|
||||
* @throws [IllegalArgumentException] when value is not positive.
|
||||
*/
|
||||
var thresholdAllocations: Long
|
||||
public var thresholdAllocations: Long
|
||||
get() = getThresholdAllocations()
|
||||
set(value) {
|
||||
require(value > 0) { "thresholdAllocations must be positive: $value" }
|
||||
@@ -158,7 +158,7 @@ public object GC {
|
||||
*
|
||||
* Default: true
|
||||
*/
|
||||
var autotune: Boolean
|
||||
public var autotune: Boolean
|
||||
get() = getTuneThreshold()
|
||||
set(value) = setTuneThreshold(value)
|
||||
|
||||
@@ -169,7 +169,7 @@ public object GC {
|
||||
* Legacy MM: If cyclic collector for atomic references to be deployed.
|
||||
*/
|
||||
@Deprecated("No-op in modern GC implementation")
|
||||
var cyclicCollectorEnabled: Boolean
|
||||
public var cyclicCollectorEnabled: Boolean
|
||||
get() = getCyclicCollectorEnabled()
|
||||
set(value) = setCyclicCollectorEnabled(value)
|
||||
|
||||
@@ -184,7 +184,7 @@ public object GC {
|
||||
*
|
||||
* @throws [IllegalArgumentException] when value is negative.
|
||||
*/
|
||||
var regularGCInterval: Duration
|
||||
public var regularGCInterval: Duration
|
||||
get() = getRegularGCIntervalMicroseconds().microseconds
|
||||
set(value) {
|
||||
require(!value.isNegative()) { "regularGCInterval must not be negative: $value" }
|
||||
@@ -207,7 +207,7 @@ public object GC {
|
||||
*
|
||||
* @throws [IllegalArgumentException] when value is negative.
|
||||
*/
|
||||
var targetHeapBytes: Long
|
||||
public var targetHeapBytes: Long
|
||||
get() = getTargetHeapBytes()
|
||||
set(value) {
|
||||
require(value >= 0) { "targetHeapBytes must not be negative: $value" }
|
||||
@@ -224,7 +224,7 @@ public object GC {
|
||||
*
|
||||
* @throws [IllegalArgumentException] when value is outside (0, 1] interval.
|
||||
*/
|
||||
var targetHeapUtilization: Double
|
||||
public var targetHeapUtilization: Double
|
||||
get() = getTargetHeapUtilization()
|
||||
set(value) {
|
||||
require(value > 0 && value <= 1) { "targetHeapUtilization must be in (0, 1] interval: $value" }
|
||||
@@ -241,7 +241,7 @@ public object GC {
|
||||
*
|
||||
* @throws [IllegalArgumentException] when value is negative.
|
||||
*/
|
||||
var minHeapBytes: Long
|
||||
public var minHeapBytes: Long
|
||||
get() = getMinHeapBytes()
|
||||
set(value) {
|
||||
require(value >= 0) { "minHeapBytes must not be negative: $value" }
|
||||
@@ -258,7 +258,7 @@ public object GC {
|
||||
*
|
||||
* @throws [IllegalArgumentException] when value is negative.
|
||||
*/
|
||||
var maxHeapBytes: Long
|
||||
public var maxHeapBytes: Long
|
||||
get() = getMaxHeapBytes()
|
||||
set(value) {
|
||||
require(value >= 0) { "maxHeapBytes must not be negative: $value" }
|
||||
@@ -272,7 +272,7 @@ public object GC {
|
||||
*
|
||||
* @throws [IllegalArgumentException] when value is outside (0, 1] interval.
|
||||
*/
|
||||
var heapTriggerCoefficient: Double
|
||||
public var heapTriggerCoefficient: Double
|
||||
get() = getHeapTriggerCoefficient()
|
||||
set(value) {
|
||||
require(value > 0 && value <= 1) { "heapTriggerCoefficient must be in (0, 1] interval: $value" }
|
||||
@@ -285,7 +285,7 @@ public object GC {
|
||||
*
|
||||
* Default: true, unless [autotune] is false or [maxHeapBytes] is less than [Long.MAX_VALUE].
|
||||
*/
|
||||
var pauseOnTargetHeapOverflow: Boolean
|
||||
public var pauseOnTargetHeapOverflow: Boolean
|
||||
get() = getPauseOnTargetHeapOverflow()
|
||||
set(value) = setPauseOnTargetHeapOverflow(value)
|
||||
|
||||
@@ -298,7 +298,7 @@ public object GC {
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_detectCycles")
|
||||
@Deprecated("No-op in modern GC implementation")
|
||||
external fun detectCycles(): Array<Any>?
|
||||
public external fun detectCycles(): Array<Any>?
|
||||
|
||||
/**
|
||||
* Returns statistics of the last finished garbage collection run.
|
||||
@@ -309,7 +309,7 @@ public object GC {
|
||||
* Legacy MM: Always returns null
|
||||
*/
|
||||
@ExperimentalStdlibApi
|
||||
val lastGCInfo: GCInfo?
|
||||
public val lastGCInfo: GCInfo?
|
||||
get() = GCInfo.lastGCInfo
|
||||
|
||||
/**
|
||||
@@ -319,7 +319,7 @@ public object GC {
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_findCycle")
|
||||
@Deprecated("No-op in modern GC implementation")
|
||||
external fun findCycle(root: Any): Array<Any>?
|
||||
public external fun findCycle(root: Any): Array<Any>?
|
||||
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_getThreshold")
|
||||
private external fun getThreshold(): Int
|
||||
|
||||
@@ -24,7 +24,7 @@ import kotlin.system.*
|
||||
@NativeRuntimeApi
|
||||
@SinceKotlin("1.9")
|
||||
public class MemoryUsage(
|
||||
val totalObjectsSizeBytes: Long,
|
||||
public val totalObjectsSizeBytes: Long,
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -36,8 +36,8 @@ public class MemoryUsage(
|
||||
@NativeRuntimeApi
|
||||
@SinceKotlin("1.9")
|
||||
public class SweepStatistics(
|
||||
val sweptCount: Long,
|
||||
val keptCount: Long,
|
||||
public val sweptCount: Long,
|
||||
public val keptCount: Long,
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -57,10 +57,10 @@ public class SweepStatistics(
|
||||
@NativeRuntimeApi
|
||||
@SinceKotlin("1.9")
|
||||
public class RootSetStatistics(
|
||||
val threadLocalReferences: Long,
|
||||
val stackReferences: Long,
|
||||
val globalReferences: Long,
|
||||
val stableReferences: Long
|
||||
public val threadLocalReferences: Long,
|
||||
public val stackReferences: Long,
|
||||
public val globalReferences: Long,
|
||||
public val stableReferences: Long
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -96,21 +96,21 @@ public class RootSetStatistics(
|
||||
@NativeRuntimeApi
|
||||
@SinceKotlin("1.9")
|
||||
public class GCInfo(
|
||||
val epoch: Long,
|
||||
val startTimeNs: Long,
|
||||
val endTimeNs: Long,
|
||||
val firstPauseRequestTimeNs: Long,
|
||||
val firstPauseStartTimeNs: Long,
|
||||
val firstPauseEndTimeNs: Long,
|
||||
val secondPauseRequestTimeNs: Long?,
|
||||
val secondPauseStartTimeNs: Long?,
|
||||
val secondPauseEndTimeNs: Long?,
|
||||
val postGcCleanupTimeNs: Long?,
|
||||
val rootSet: RootSetStatistics,
|
||||
val markedCount: Long,
|
||||
val sweepStatistics: Map<String, SweepStatistics>,
|
||||
val memoryUsageBefore: Map<String, MemoryUsage>,
|
||||
val memoryUsageAfter: Map<String, MemoryUsage>,
|
||||
public val epoch: Long,
|
||||
public val startTimeNs: Long,
|
||||
public val endTimeNs: Long,
|
||||
public val firstPauseRequestTimeNs: Long,
|
||||
public val firstPauseStartTimeNs: Long,
|
||||
public val firstPauseEndTimeNs: Long,
|
||||
public val secondPauseRequestTimeNs: Long?,
|
||||
public val secondPauseStartTimeNs: Long?,
|
||||
public val secondPauseEndTimeNs: Long?,
|
||||
public val postGcCleanupTimeNs: Long?,
|
||||
public val rootSet: RootSetStatistics,
|
||||
public val markedCount: Long,
|
||||
public val sweepStatistics: Map<String, SweepStatistics>,
|
||||
public val memoryUsageBefore: Map<String, MemoryUsage>,
|
||||
public val memoryUsageAfter: Map<String, MemoryUsage>,
|
||||
) {
|
||||
internal companion object {
|
||||
val lastGCInfo: GCInfo?
|
||||
|
||||
@@ -20,11 +20,11 @@ public typealias Vector128 = kotlinx.cinterop.Vector128
|
||||
@DeprecatedSinceKotlin(warningSince = "1.9")
|
||||
@ExperimentalForeignApi
|
||||
@GCUnsafeCall("Kotlin_Interop_Vector4f_of")
|
||||
external fun vectorOf(f0: Float, f1: Float, f2: Float, f3: Float): Vector128
|
||||
public external fun vectorOf(f0: Float, f1: Float, f2: Float, f3: Float): Vector128
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated("Use kotlinx.cinterop.vectorOf instead.", ReplaceWith("kotlinx.cinterop.vectorOf(f0, f1, f2, f3)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.9")
|
||||
@ExperimentalForeignApi
|
||||
@GCUnsafeCall("Kotlin_Interop_Vector4i32_of")
|
||||
external fun vectorOf(f0: Int, f1: Int, f2: Int, f3: Int): Vector128
|
||||
public external fun vectorOf(f0: Int, f1: Int, f2: Int, f3: Int): Vector128
|
||||
|
||||
@@ -10,5 +10,5 @@ package kotlin.text
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
public actual open class CharacterCodingException(message: String?) : Exception(message) {
|
||||
actual constructor() : this(null)
|
||||
public actual constructor() : this(null)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user