Move *ROOT* to toplevel.lisp because of an error.
[jscl.git] / src / ffi.lisp
1 ;;; ffi.lisp ---
2
3 ;; JSCL is free software: you can redistribute it and/or
4 ;; modify it under the terms of the GNU General Public License as
5 ;; published by the Free Software Foundation, either version 3 of the
6 ;; License, or (at your option) any later version.
7 ;;
8 ;; JSCL is distributed in the hope that it will be useful, but
9 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
10 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 ;; General Public License for more details.
12 ;;
13 ;; You should have received a copy of the GNU General Public License
14 ;; along with JSCL.  If not, see <http://www.gnu.org/licenses/>.
15
16 (define-setf-expander oget (object key &rest keys)
17   (let* ((keys (cons key keys))
18          (g!object (gensym))
19          (g!keys (mapcar (lambda (s)
20                            (declare (ignore s))
21                            (gensym))
22                          keys))
23          (g!value (gensym)))
24     (values `(,g!object ,@g!keys)
25             `(,object ,@keys)
26             `(,g!value)
27             `(oset ,g!value ,g!object ,@g!keys)
28             `(oget ,g!object ,@g!keys))))
29
30 (define-setf-expander oget* (object key &rest keys)
31   (let* ((keys (cons key keys))
32          (g!object (gensym))
33          (g!keys (mapcar (lambda (s)
34                            (declare (ignore s))
35                            (gensym))
36                          keys))
37          (g!value (gensym)))
38     (values `(,g!object ,@g!keys)
39             `(,object ,@keys)
40             `(,g!value)
41             `(oset* ,g!value ,g!object ,@g!keys)
42             `(oget* ,g!object ,@g!keys))))
43
44
45