emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FFI


From: Zajcev Evgeny
Subject: Re: FFI
Date: Sun, 18 Apr 2010 22:53:57 +0400
User-agent: Gnus/5.1008 (Gnus v5.10.8) SXEmacs/22.1.11 (darwin)

Florian Weimer <address@hidden> writes:

> * Juri Linkov:
>
>> If using its implementation in GNU Emacs is not possible due to legal
>> reasons, then maybe at least it would be a good idea to implement
>> FFI in GNU Emacs compatible with SXEmacs.  In this case all existing
>> library bindings will be readily available for GNU Emacs.
>
> This is only true if Emacs also implements all SXEmacs types, so it is
> a bit more ambitious than just implementing the FFI.

I think I can port SXEmacsen FFI to GNU Emacs with small blood.
SXEmacsen FFI does not uses lisp types (it does actually, but this is
another question), so you can create almost any data accessible from
FFI with only numbers, floats and strings.  Let me show live example:

    (setq db (sqlite-open "~/mtest.db"))
      ==> #<ffiobject type=pointer size=4 fotype=0 foptr=0xb6a6600>
    (sqlite-execute db "CREATE TABLE PARAMS
       (NAME VARCHAR(256) NULL, VALUE VARCHAR(1024) NULL)")
      ==> t
    (sqlite-execute db "INSERT INTO PARAMS (NAME,VALUE)
       VALUES (?, ?)" '("nthoteh" "HRCHRCCR"))
      ==> t
    (sqlite-rows db "select * from params")
      ==> (("nthoteh" "HRCHRCCR"))
    (sqlite-close db)
      ==> 0

As you can see there are only strings, and numbers (boolean type is
done via dinamic type/value translators implemented in ffi)

thanks

-- 
lg




reply via email to

[Prev in Thread] Current Thread [Next in Thread]