~ubuntu-branches/ubuntu/maverick/swig1.3/maverick

« back to all changes in this revision

Viewing changes to Examples/s-exp/uffi.lisp

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-09-01 18:35:55 UTC
  • mfrom: (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050901183555-eq59uwhq8b62e44c
Tags: 1.3.24-1ubuntu4
* Use php5-dev instead of php4-dev, to kick php4 out of main.
* Drop support for generation of pike bindings, as nothing uses it,
  and swig is the only thing keeping pike7.6 in main (Ubuntu #13796)

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
(defvar *swig-source-directory* #p"/home/mkoeppe/s/swig1.3/")
17
17
 
18
 
(defvar *swig-program* (merge-pathnames "swig" *swig-source-directory*))
 
18
(defvar *swig-program* (merge-pathnames "preinst-swig" *swig-source-directory*))
19
19
 
20
20
(defun run-swig (swig-interface-file-name &key directory-search-list module
21
21
                 ignore-errors c++)
22
 
  (setf (port:getenv :SWIG_LIB)
23
 
        (namestring (merge-pathnames "Lib" *swig-source-directory*)))
24
22
  (let ((temp-file-name "/tmp/swig.lsp"))
25
23
    (let ((process
26
24
           (port:run-prog (namestring *swig-program*)
212
210
 
213
211
(defvar *struct-fields* '())
214
212
 
215
 
(defvar *linkage* nil "NIL or :C")
 
213
(defvar *linkage* :C "NIL or :C")
216
214
 
217
215
(defgeneric handle-node (node-type &key &allow-other-keys)
218
216
  (:documentation "Handle a node of SWIG's parse tree of a C/C++ program"))
345
343
;;  (eval (cons 'progn (compute-uffi-definitions *simple-gifplot-interface*))))
346
344
 
347
345
 
348
 
(with-open-file (f "/tmp/swig-uffi.lisp" :direction :output)
 
346
(with-open-file (f "/tmp/swig-uffi.lisp" :direction :output
 
347
                   :if-exists :supersede)
349
348
  (let ((*uffi-definitions* '())
350
349
        (*uffi-output* f)
351
350
        (*uffi-primitive-type-alist*
362
361
 
363
362
(compile-file "/tmp/swig-uffi.lisp")
364
363
 
365
 
(load "/tmp/swig-uffi.lisp")
366
 
 
367
364
(uffi:load-foreign-library (merge-pathnames "Examples/GIFPlot/libgifplot.a"
368
365
                                            *swig-source-directory*))
369
366
 
 
367
(load "/tmp/swig-uffi.lisp")
 
368
 
370
369
(load (merge-pathnames "Examples/GIFPlot/Common-Lisp/full/runme.lisp" *swig-source-directory*))
371
370
 
372
371
(action (namestring (merge-pathnames "Examples/GIFPlot/Common-Lisp/full/cmap"
376
375
 
377
376
;;; Link to SWIG itself
378
377
 
 
378
#||
 
379
 
379
380
(defparameter *c++-compiler* "g++")
380
381
 
381
382
(defun stdc++-library (&key env)
409
410
                  :ignore-errors t
410
411
                  :c++ t))
411
412
  (with-open-file (f *swig-uffi-pathname* :direction :output)
412
 
                  (let ((*uffi-definitions* '())
413
 
                        (*uffi-output* f)
414
 
                        (*uffi-primitive-type-alist* *uffi-default-primitive-type-alist*))
415
 
                    (apply 'handle-node *swig-interface*)))
 
413
    (let ((*linkage* :c++)
 
414
          (*uffi-definitions* '())
 
415
          (*uffi-output* f)
 
416
          (*uffi-primitive-type-alist* *uffi-default-primitive-type-alist*))
 
417
      (apply 'handle-node *swig-interface*)))
416
418
  (compile-file *swig-uffi-pathname*)
417
419
  (alien:load-foreign (merge-pathnames "Source/libswig.a"
418
420
                                       *swig-source-directory*)
424
426
  ;;                             (list (stdc++-library)))
425
427
  (load (compile-file-pathname *swig-uffi-pathname*)))
426
428
 
 
429
||#
 
430
 
427
431
;;;; TODO:
428
432
 
429
433
;; * How to do type lookups?  Is everything important that SWIG knows