parent
e97639e525
commit
8ae53d9e8b
|
@ -12,6 +12,8 @@ typedef unsigned char byte;
|
|||
#define X
|
||||
#endif
|
||||
|
||||
X void* return_null() { return NULL; }
|
||||
|
||||
X int add1_int_int (int x) { return x + 1; }
|
||||
X int add1_byte_int (byte x) { return x + 1; }
|
||||
X byte add1_int_byte (int x) { return x + 1; }
|
||||
|
|
|
@ -575,6 +575,11 @@
|
|||
free)])
|
||||
(free p)))
|
||||
|
||||
(let ([return_null (get-ffi-obj 'return_null test-lib (_fun -> _bytes/nul-terminated))])
|
||||
(test #f return_null))
|
||||
(let ([return_null (get-ffi-obj 'return_null test-lib (_fun -> (_bytes/nul-terminated o 20)))])
|
||||
(test #f return_null))
|
||||
|
||||
;; Test equality and hashing of c pointers:
|
||||
(let ([seventeen1 (cast 17 _intptr _pointer)]
|
||||
[seventeen2 (cast 17 _intptr _pointer)]
|
||||
|
|
|
@ -1161,16 +1161,17 @@
|
|||
(define _bytes/nul-terminated
|
||||
(make-ctype _bytes
|
||||
(lambda (bstr) (and bstr (bytes-append bstr #"\0")))
|
||||
(lambda (bstr) (bytes-copy bstr))))
|
||||
(lambda (bstr) (and bstr (bytes-copy bstr)))))
|
||||
(provide (rename-out [_bytes/nul-terminated* _bytes/nul-terminated]))
|
||||
(define-fun-syntax _bytes/nul-terminated*
|
||||
(syntax-id-rules (o)
|
||||
[(_ o n) (type: _pointer
|
||||
pre: (make-bytes n)
|
||||
;; post is needed when this is used as a function output type
|
||||
post: (x => (let ([s (make-bytes n)])
|
||||
(memcpy s x n)
|
||||
s)))]
|
||||
post: (x => (and x
|
||||
(let ([s (make-bytes n)])
|
||||
(memcpy s x n)
|
||||
s))))]
|
||||
[(_ . xs) (_bytes/nul-teriminated . xs)]
|
||||
[_ _bytes/nul-terminated]))
|
||||
|
||||
|
|
|
@ -3020,6 +3020,8 @@ Scheme_Object *scheme_dump_gc_stats(int c, Scheme_Object *p[])
|
|||
# endif
|
||||
#endif
|
||||
|
||||
scheme_console_printf("JIT-generated code: %ld\n", scheme_code_page_total);
|
||||
|
||||
#if MZ_PRECISE_GC_TRACE
|
||||
if (for_each_struct) {
|
||||
scheme_console_printf("Begin Struct\n");
|
||||
|
|
Loading…
Reference in New Issue
Block a user