Commit 639a5f35 authored by Liam M. Healy's avatar Liam M. Healy
Browse files

Eliminate fsbv:object for built-in types

Eliminate fsbv:object for built-in types; started conversion of
special function result (sf-result*) structures but this requires a
modification to CFFI.  Simulated annealing structure called by value.
Use cffi-fsbv's sizet definition; this imposes a dependence on that
system.  No compilation attempted yet.
parent acb52420
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
;; Expand the body of a defmfun
;; Liam Healy 2009-04-13 22:07:13EDT body-expand.lisp
;; Time-stamp: <2010-12-16 11:46:22EST body-expand.lisp>
;; Time-stamp: <2011-10-23 22:06:16EDT body-expand.lisp>
;;
;; Copyright 2009, 2010 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
@@ -84,7 +84,7 @@

(defun cl-convert-form (decl)
  "Generate a form that calls the appropriate converter from C/GSL to CL."
  (list `(fsbv:object ,(grid:st-symbol decl) ',(grid:st-actual-type decl))))
  (list `(cffi:mem-ref ,(grid:st-symbol decl) ',(grid:st-actual-type decl))))

(defun values-unless-singleton (forms)
  (unless (listp forms) (error "Values are not a list."))
+3 −2
Original line number Diff line number Diff line
;; Generate a lambda that calls the user function; will be called by callback.
;; Liam Healy 
;; Time-stamp: <2011-10-23 20:25:24EDT funcallable.lisp>
;; Time-stamp: <2011-10-23 22:10:08EDT funcallable.lisp>
;;
;; Copyright 2009, 2010, 2011 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
@@ -97,7 +97,8 @@
	    ,@(affi::delinearize-index
	       (affi:make-affi (value-from-dimensions argspec dimension-values))
	       linear-index))
	  `(fsbv:object
	  ;; Would this be better replaced with grid:faref?
	  `(cffi:mem-aref
	    ,foreign-pointer-name
	    ',(parse-callback-argspec argspec 'element-type)
	    ,linear-index))
+2 −1
Original line number Diff line number Diff line
;; Load GSL
;; Liam Healy Sat Mar  4 2006 - 18:53
;; Time-stamp: <2011-10-17 23:09:40EDT init.lisp>
;; Time-stamp: <2011-10-23 21:57:41EDT init.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009, 2010, 2011 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
@@ -22,6 +22,7 @@
    (:nicknames :gsl)
  (:use :common-lisp :cffi)
  (:import-from :grid #:dim0 #:dim1 #:^ #:copy)
  #+fsbv (:import-from :cffi-fsbv #:sizet) ; and what do we do if #-fsbv?
  (:export #:dim0 #:dim1 #:copy)
  ;; No actual conflict due to different usage of symbols:
  ;; antik:psi means "pounds per square inch" vs. function #'gsl:psi
+5 −11
Original line number Diff line number Diff line
;; Number types used by GSL functions, and specification conversion
;; Liam Healy 2008-12-31 21:06:34EST types.lisp
;; Time-stamp: <2010-12-19 11:42:56EST types.lisp>
;; Time-stamp: <2011-10-23 20:54:45EDT types.lisp>
;;
;; Copyright 2008, 2009, 2010 Liam M. Healy
;; Copyright 2008, 2009, 2010, 2011 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
;;
;; This program is free software: you can redistribute it and/or modify
@@ -21,18 +21,12 @@
(in-package :gsl)

;;;;****************************************************************************
;;;; Unsigned address types size_t
;;;; Word size
;;;;****************************************************************************

(fsbv:defconvert (sizet :constructor values))

(case (cffi:foreign-type-size :long)
  (8
   (push :int64 *features*)
   #+fsbv (fsbv:define-equivalent-type sizet :uint64))
  (4
   (push :int32 *features*)
   #+fsbv (fsbv:define-equivalent-type sizet :uint32)))
  (8 (push :int64 *features*)
  (4 (push :int32 *features*))))

;;;;****************************************************************************
;;;; Type specification conversion
+2 −2
Original line number Diff line number Diff line
;; Generators of random numbers.
;; Liam Healy, Sat Jul 15 2006 - 14:43
;; Time-stamp: <2010-12-19 16:11:01EST generators.lisp>
;; Time-stamp: <2011-10-23 22:02:24EDT generators.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009, 2010 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
@@ -169,7 +169,7 @@
    (loop for i from 0 below (length ans)
       do
       (setf (aref ans i)
	     (fsbv:object (rng-state gen) :uint8 i)))
	     (cffi:mem-aref (rng-state gen) :uint8 i)))
    ans))

;;;;****************************************************************************
Loading