[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ANN] nyacc 0.82.0 released
From: |
Matt Wette |
Subject: |
Re: [ANN] nyacc 0.82.0 released |
Date: |
Mon, 11 Sep 2017 18:44:06 -0700 |
> On Sep 10, 2017, at 8:37 AM, Matt Wette <address@hidden> wrote:
>
> Nyacc 0.82.0 has been released
Appologies if you have tried this and running into problems. I found a few
bugs.
I have been working on macos but now trying on Centos system. I will release
a minor update by end of the coming weekend. The patch below should help you
get by for now. -- Matt
diff --git a/examples/nyacc/lang/c99/ffi-help.scm
b/examples/nyacc/lang/c99/ffi-help.scm
index a9ec063..f4a2221 100644
--- a/examples/nyacc/lang/c99/ffi-help.scm
+++ b/examples/nyacc/lang/c99/ffi-help.scm
@@ -19,6 +19,8 @@
;; bytestructure->descriptor->ffi-descriptor
;; bs:pointer->proc
+;; For enum typedefs we are not creating types but just using wrappers.
+
(define-module (nyacc lang c99 ffi-help)
#:export (*ffi-help-version*
define-ffi-module
@@ -73,7 +75,7 @@
"__attribute__(X)="
"__inline=" "__inline__="
"__asm(X)=" "__asm__(X)="
- "__has_include=(X)__has_include__(X)"
+ "__has_include(X)=__has_include__(X)"
"__extension__="
)
;;("sys/cdefs.h" "__DARWIN_ALIAS(X)=")
@@ -82,9 +84,10 @@
'(("__builtin"
"__builtin_va_list=void*" "__attribute__(X)="
"__inline=" "__inline__="
- "__asm(X)=" "__asm__(X)=")
- "__has_include=(X)__has_include__(X)"
+ "__asm(X)=" "__asm__(X)="
+ "__has_include(X)=__has_include__(X)"
"__extension__="
+ )
))))
(define fh-cpp-defs
(cond
@@ -753,7 +756,9 @@
(define (gen-exec-params params)
(fold-right
(lambda (param-decl seed)
- (let* ((param-decl (expand-typerefs param-decl (*udict*) (*defined*)))
+ ;; Changed to (*wrapped*) to include enum types. If we need (*defined*)
+ ;; then we will need to create enum types in cnvt-udecl typedefs.
+ (let* ((param-decl (expand-typerefs param-decl (*udict*) (*wrapped*)))
(param-decl (udecl-rem-type-qual param-decl)) ;; ???
(mspec (udecl->mspec param-decl)))
(acons (car mspec) (mspec->fh-unwrapper mspec) seed)))
@@ -798,27 +803,6 @@
;; specl is decl-spec-list tree
;; params is list of param-decl trees (i.e., cdr of param-list tree)
;; @end deffn
-(define (OLD-cnvt-fctn name rdecl params)
- #;(when (string=? name "gdbm_store") (sfout "cnvt-fctn\n") (ppout params))
- (let* ((decl-return (gen-decl-return rdecl))
- (decl-params (gen-decl-params params))
- (exec-return (gen-exec-return-wrapper rdecl))
- (exec-params (gen-exec-params params)))
- (when #f
- (sfout "cnvt-fctn\n") (ppout params)
- (ppout decl-params) (ppout exec-params))
- (ppscm
- `(define ,(string->symbol name)
- (let ((~f #f))
- (lambda ,(gen-exec-arg-names exec-params)
- (unless ~f
- (set! ~f (fh-link-proc
- ,name ,decl-return (list ,@decl-params))))
- (let ,(gen-exec-unwrappers exec-params)
- ,(if exec-return
- `(,exec-return (~f ,@(gen-exec-call-args exec-params)))
- `(~f ,@(gen-exec-call-args exec-params))))))))
- (sfscm "(export ~A)\n" name)))
(define (cnvt-fctn name rdecl params)
(let* ((decl-return (gen-decl-return rdecl))
(decl-params (gen-decl-params params))
diff --git a/examples/system/ffi-help-rt.scm b/examples/system/ffi-help-rt.scm
index 80f0382..9550ac7 100644
--- a/examples/system/ffi-help-rt.scm
+++ b/examples/system/ffi-help-rt.scm
@@ -194,7 +194,7 @@
(make-fht (quote type) unwrap #f #f
(make-bs*-printer (quote type))))
(define (wrap val) ;; pointer returned from code
- (make (bytestructure type val)))
+ (make (bytestructure desc (ffi:pointer-address val))))
(export make type? unwrap type wrap)
)))
@@ -353,7 +353,7 @@
(define (unwrap~pointer obj)
(cond
((ffi:pointer? obj) obj)
- ((string? obj) (string->pointer obj))
+ ((string? obj) (ffi:string->pointer obj))
((bytestructure? obj) (ffi:make-pointer (bytestructure-ref obj)))
((fh-object? obj) (unwrap~pointer (struct-ref obj 0)))
(else (error "expecting pointer type"))))