diff --git a/racket/src/rktio/parse.rkt b/racket/src/rktio/parse.rkt index eb66c447f7..b6cd9c8a5b 100644 --- a/racket/src/rktio/parse.rkt +++ b/racket/src/rktio/parse.rkt @@ -24,8 +24,8 @@ ;; => fails when result equals , keep step ;; ;; = -;; | (ref ) ; opaque, needs to be deallocated somehow -;; | (* ) ; transparent argument, can be represented by a byte string +;; | (ref ) ; opaque, needs to be deallocated somehow +;; | (*ref ) ; transparent argument, can be represented by a byte string (define output-file #f) @@ -138,7 +138,7 @@ (append (map (lambda (id) `(,(shift-stars id $1) ,(unstar id))) $2) $3)]) ( [(ID) $1] - [(STAR ) `(* ,$2)]) + [(STAR ) `(*ref ,$2)]) ( [( SEMI) (list $1)] [( COMMA ) (cons $1 $3)]) ( [(ID) $1] @@ -162,19 +162,20 @@ [(eq? r 'rktio_bool_t) '(define-function)] [(eq? r 'void) '(define-function)] [(pair? def-kind) def-kind] - [(pair? r) '(define-function/errno NULL)] - [(eq? r 'rktio_ok_t) '(define-function/errno #f)] + [(eq? def-kind 'define-function) (list def-kind)] + [(pair? r) `(,def-kind NULL)] + [(eq? r 'rktio_ok_t) `(,def-kind #f)] [else (list def-kind)])) (define (shift-stars from to) (if (and (pair? from) - (eq? '* (car from))) - `(* ,(shift-stars (cadr from) to)) + (eq? '*ref (car from))) + `(*ref ,(shift-stars (cadr from) to)) to)) (define (unstar from) (if (and (pair? from) - (eq? '* (car from))) + (eq? '*ref (car from))) (unstar (cadr from)) from)) @@ -244,12 +245,12 @@ ;; explicitly freed. (define (update-type t #:as-argument? [as-argument? #f]) (cond - [(and (pair? t) (eq? (car t) '*)) + [(and (pair? t) (eq? (car t) '*ref)) (let ([s (update-type (cadr t))]) (if (and as-argument? (or (pair? s) (hash-ref defined-types s #f))) - `(* ,s) + `(*ref ,s) `(ref ,s)))] [else t])) @@ -261,6 +262,9 @@ [`(,def ,ret ,name ,args) `(,def ,(update-type ret) ,name ,(map (lambda (a) (update-bind a #:as-argument? #t)) args))] + [`(,def ,err-val ,ret ,name ,args) + `(,def ,err-val ,(update-type ret) ,name + ,(map (lambda (a) (update-bind a #:as-argument? #t)) args))] [else e])) (define (update-type-types e) diff --git a/racket/src/rktio/rktio.h b/racket/src/rktio/rktio.h index a1d8a48932..afd1f6cf7a 100644 --- a/racket/src/rktio/rktio.h +++ b/racket/src/rktio/rktio.h @@ -728,7 +728,7 @@ RKTIO_EXTERN rktio_bool_t rktio_is_regular_file(rktio_t *rktio, const char *file RKTIO_EXTERN rktio_ok_t rktio_delete_file(rktio_t *rktio, const char *fn, rktio_bool_t enable_write_on_fail); -RKTIO_EXTERN rktio_ok_t rktio_rename_file(rktio_t *rktio, const char *dest, const char *src, int exists_ok); +RKTIO_EXTERN rktio_ok_t rktio_rename_file(rktio_t *rktio, const char *dest, const char *src, rktio_bool_t exists_ok); /* Can report `RKTIO_ERROR_EXISTS`. */ RKTIO_EXTERN char *rktio_get_current_directory(rktio_t *rktio); @@ -738,7 +738,7 @@ RKTIO_EXTERN rktio_ok_t rktio_make_directory(rktio_t *rktio, const char *filenam /* Can report `RKTIO_ERROR_EXISTS`. */ RKTIO_EXTERN rktio_ok_t rktio_delete_directory(rktio_t *rktio, const char *filename, const char *current_directory, - int enable_write_on_fail); + rktio_bool_t enable_write_on_fail); /* The `current_directory` argument is used on Windows to avoid being in `filename` (instead) as a directory while trying to delete it. The `enable_write_on_fail` argument also applied to Windows. */ @@ -748,7 +748,7 @@ RKTIO_EXTERN char *rktio_readlink(rktio_t *rktio, const char *fullfilename); `RKTIO_ERROR_NOT_A_LINK`. */ RKTIO_EXTERN rktio_ok_t rktio_make_link(rktio_t *rktio, const char *src, const char *dest, - int dest_is_directory); + rktio_bool_t dest_is_directory); /* The `dest_is_directory` argument is used only on Windows. Can report `RKTIO_ERROR_EXISTS`. */ @@ -768,7 +768,7 @@ typedef struct rktio_identity_t { } rktio_identity_t; RKTIO_EXTERN rktio_identity_t *rktio_fd_identity(rktio_t *rktio, rktio_fd_t *fd); -RKTIO_EXTERN rktio_identity_t *rktio_path_identity(rktio_t *rktio, const char *path, int follow_links); +RKTIO_EXTERN rktio_identity_t *rktio_path_identity(rktio_t *rktio, const char *path, rktio_bool_t follow_links); /*************************************************/ /* Permissions */ @@ -781,7 +781,7 @@ RKTIO_EXTERN rktio_identity_t *rktio_path_identity(rktio_t *rktio, const char *p #define RKTIO_PERMISSION_ERROR (-1) RKTIO_EXTERN_ERR(RKTIO_PERMISSION_ERROR) -int rktio_get_file_or_directory_permissions(rktio_t *rktio, const char *filename, int all_bits); +int rktio_get_file_or_directory_permissions(rktio_t *rktio, const char *filename, rktio_bool_t all_bits); /* Result is `RKTIO_PERMISSION_ERROR` for error, otherwise a combination of bits. If not `all_bits`, then use constants above. */