From 708ab89d283979ffaa907e6e7754ba353738eb1f Mon Sep 17 00:00:00 2001 From: retropikzel Date: Sat, 26 Jul 2025 14:37:17 +0300 Subject: [PATCH] Fixing Kawa --- foreign/c/primitives/kawa.scm | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/foreign/c/primitives/kawa.scm b/foreign/c/primitives/kawa.scm index 2fc44a0..8bad2c8 100644 --- a/foreign/c/primitives/kawa.scm +++ b/foreign/c/primitives/kawa.scm @@ -10,19 +10,12 @@ ((equal? type 'int8) (java.lang.Integer value)) ((equal? type 'uint8) - (java.lang.Integer (invoke (gnu.math.UInt value) 'toIntNum))) + (java.lang.Integer value)) ((equal? type 'short) (java.lang.Short value)) ((equal? type 'unsigned-short) (java.lang.Short value)) ((equal? type 'int) - (display "VALUE HERE: ") - (write value) - (newline) - (write type) - (newline) - (write (invoke (invoke value 'getClass) 'getName)) - (newline) (java.lang.Integer value)) ((equal? type 'unsigned-int) (java.lang.Integer value)) @@ -41,7 +34,7 @@ (define type->native-type (lambda (type) (cond - ((equal? type 'int8) (invoke (static-field java.lang.foreign.ValueLayout 'JAVA_BYTE) 'withByteAlignment 1)) + ((equal? type 'int8) (invoke (static-field java.lang.foreign.ValueLayout 'JAVA_INT) 'withByteAlignment 1)) ((equal? type 'uint8) (invoke (static-field java.lang.foreign.ValueLayout 'JAVA_BYTE) 'withByteAlignment 1)) ((equal? type 'int16) (invoke (static-field java.lang.foreign.ValueLayout 'JAVA_INT) 'withByteAlignment 2)) ((equal? type 'uint16) (invoke (static-field java.lang.foreign.ValueLayout 'JAVA_INT) 'withByteAlignment 2)) @@ -179,10 +172,21 @@ (define c-bytevector-u8-ref (lambda (c-bytevector k) - (invoke (invoke c-bytevector 'reinterpret INTEGER-MAX-VALUE) - 'get - u8-value-layout - k))) + (display "HERE:") + (display (invoke (invoke (invoke (invoke c-bytevector 'reinterpret INTEGER-MAX-VALUE) + 'get + u8-value-layout + k) + 'getClass) + 'getName)) + (newline) + (invoke + (invoke + (invoke c-bytevector 'reinterpret INTEGER-MAX-VALUE) + 'get + u8-value-layout + k) + 'intValue))) (define pointer-value-layout (invoke (static-field java.lang.foreign.ValueLayout 'ADDRESS)