Hi,

currently, the bind egg parses const char * as (const (c-pointer char)),
even though that's the type signature of a pointer to constant characters
and not of a constant pointer to characters.

The patch below fixes that--though I am not sure whether the parsing
strategy wouldn't actually need a more fundamental change to make it scope
specifiers and qualifiers correctly in general.

Regards, Florian

---------------------------------------------------------------------------
diff --git a/bind-translator.scm b/bind-translator.scm
index 6ec4088..966168c 100644
--- a/bind-translator.scm
+++ b/bind-translator.scm
@@ -248,9 +248,13 @@
 
 (define parse-type-rec
   (match-lambda
-    [('const . more) 
+    [('const . more)
      (let-values ([(t0 more) (parse-type-rec more)])
-       (values `(const ,t0) more) ) ]
+       (values
+         (match t0
+           [`(c-pointer . ,t0) `(c-pointer (const . ,t0))]
+           [_ `(const ,t0)])
+         more))]
     [('unsigned t 'star . more)
      (let-values ([(t0 more) (parse-type-rec (cons* 'unsigned t more))])
        (values `(c-pointer ,t0) more) ) ]

_______________________________________________
Chicken-hackers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to