Raymond Toy pushed to branch issue-242-c-call-char-result-wrong at cmucl / cmucl
Commits:
-
d7f0d936
by Raymond Toy at 2023-06-16T06:29:46-07:00
-
10a18a52
by Raymond Toy at 2023-06-16T06:35:11-07:00
2 changed files:
Changes:
... | ... | @@ -170,7 +170,10 @@ |
170 | 170 | (alien-rep nil :type (or null function))
|
171 | 171 | (extract-gen nil :type (or null function))
|
172 | 172 | (deposit-gen nil :type (or null function))
|
173 | - (naturalize-gen nil :type (or null function))
|
|
173 | + ;;
|
|
174 | + ;; Method that accepts the alien type and the alien value. The
|
|
175 | + ;; method converts the alien value into an appropriate lisp value.
|
|
176 | + (naturalize-gen nil :type (or null function)
|
|
174 | 177 | (deport-gen nil :type (or null function))
|
175 | 178 | ;; Cast?
|
176 | 179 | (arg-tn nil :type (or null function))
|
... | ... | @@ -1036,3 +1036,39 @@ |
1036 | 1036 | n)))
|
1037 | 1037 | (dolist (x '(1023 -1023 #x7fffffff #x-80000000))
|
1038 | 1038 | (assert-equal x (fun x)))))
|
1039 | + |
|
1040 | +(define-test issue.242.test-alien-return-unsigned-char
|
|
1041 | + (:tag :issues)
|
|
1042 | + (flet ((fun (n)
|
|
1043 | + (alien:alien-funcall
|
|
1044 | + (alien:extern-alien "int_to_unsigned_char"
|
|
1045 | + (function c-call:unsigned-char c-call:int))
|
|
1046 | + n))
|
|
1047 | + (expected (n)
|
|
1048 | + (ldb (byte 8 0) n)))
|
|
1049 | + (dolist (x '(99 -99 1023 -1023))
|
|
1050 | + (assert-equal (expected x) (fun x)))))
|
|
1051 | + |
|
1052 | +(define-test issue.242.test-alien-return-unsigned-short
|
|
1053 | + (:tag :issues)
|
|
1054 | + (flet ((fun (n)
|
|
1055 | + (alien:alien-funcall
|
|
1056 | + (alien:extern-alien "int_to_unsigned_short"
|
|
1057 | + (function c-call:unsigned-short c-call:int))
|
|
1058 | + n))
|
|
1059 | + (expected (n)
|
|
1060 | + (ldb (byte 16 0) n)))
|
|
1061 | + (dolist (x '(1023 -1023 100000 -100000))
|
|
1062 | + (assert-equal (expected x) (fun x)))))
|
|
1063 | + |
|
1064 | +(define-test issue.242.test-alien-return-unsigned-int
|
|
1065 | + (:tag :issues)
|
|
1066 | + (flet ((fun (n)
|
|
1067 | + (alien:alien-funcall
|
|
1068 | + (alien:extern-alien "int_to_unsigned_int"
|
|
1069 | + (function c-call:unsigned-int c-call:int))
|
|
1070 | + n))
|
|
1071 | + (expected (n)
|
|
1072 | + (ldb (byte 32 0) n)))
|
|
1073 | + (dolist (x '(1023 -1023 #x7fffffff #x-80000000))
|
|
1074 | + (assert-equal (expected x) (fun x))))) |