You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to fricas-devel
This patch simplifies 'sock_get_string_buf' further by using
"fricas-foreign-call", instead of repeating FFI declarations for
each Lisp (except for GCL).
To achieve this, I add a new FFI type "char-*", basically a
pointer/address, in some Lisps it is defined as "void *",
so type checking is lost.
Also I did some renames and indentations.
Tested on sbcl/ecl/cmucl/ccl/clisp. Not tested on lispworks,
but this patch should not break it.
- Qian
diff --git a/src/lisp/fricas-lisp.lisp b/src/lisp/fricas-lisp.lisp
index fe916bbe..6e13b64e 100644
--- a/src/lisp/fricas-lisp.lisp
+++ b/src/lisp/fricas-lisp.lisp
@@ -399,6 +399,7 @@ with this hack and will try to convince the GCL
crowd to fix this.
(int "int")
(c-string "char *")
(double "double")
+ (char-* "char *")
))
(defun c_type_as_string(c_type) (nth 1 (assoc c_type *c_type_as_string*)))
@@ -446,6 +447,7 @@ with this hack and will try to convince the GCL
crowd to fix this.
(int ffi:int)
(c-string ffi:c-string)
(double ffi:double-float)
+ (char-* ffi:c-pointer)
))
(defun c-args-to-clisp (arguments)
@@ -474,6 +476,7 @@ with this hack and will try to convince the GCL
crowd to fix this.
(int c-call:int)
(c-string c-call:c-string)
(double c-call:double)
+ (char-* (alien:* c-call:char))
))
(defun c-args-to-cmucl (arguments)
@@ -498,6 +501,7 @@ with this hack and will try to convince the GCL
crowd to fix this.
(int SB-ALIEN::int)
(c-string SB-ALIEN::c-string)
(double SB-ALIEN::double)
+ (char-* (sb-alien:* sb-alien:char))
))
(defun c-args-to-sbcl (arguments)
@@ -522,6 +526,7 @@ with this hack and will try to convince the GCL
crowd to fix this.
(int :int)
(c-string :address)
(double :double-float)
+ (char-* :address)
))
(defun c-args-to-openmcl (arguments)
@@ -562,6 +567,7 @@ with this hack and will try to convince the GCL
crowd to fix this.
(int :int)
(c-string :cstring )
(double :double)
+ (char-* :pointer-void)
))
(defun c-args-to-ecl (arguments)
@@ -617,7 +623,9 @@ with this hack and will try to convince the GCL
crowd to fix this.
(setf *c-type-to-ffi*
'((int :int)
(c-string (:reference-pass :ef-mb-string))
- (double :double)))
+ (double :double)
+ (char-* :pointer)
+ ))
(defun c-args-to-lispworks (arguments)
(mapcar (lambda (x) (list (nth 0 x) (c-type-to-ffi (nth 1 x))))
@@ -687,6 +695,12 @@ with this hack and will try to convince the GCL
crowd to fix this.
(purpose int)
(sig int))
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to fricas...@googlegroups.com
On Tue, Nov 14, 2023 at 06:06:14PM +0800, Qian Yun wrote:
> This patch simplifies 'sock_get_string_buf' further by using
> "fricas-foreign-call", instead of repeating FFI declarations for
> each Lisp (except for GCL).
>
> To achieve this, I add a new FFI type "char-*", basically a
> pointer/address, in some Lisps it is defined as "void *",
> so type checking is lost.
>
> Also I did some renames and indentations.
>
> Tested on sbcl/ecl/cmucl/ccl/clisp. Not tested on lispworks,
> but this patch should not break it.
Looks good. One little thing: in sockGetStringFrom for CMUCL
and sbcl you create line longer than 80 characters, please avoid
such lines.