From 16489fee8dfb01cfe20cdf7c5c8729a608fac06f Mon Sep 17 00:00:00 2001 From: "Liam M. Healy" <lhealy@common-lisp.net> Date: Thu, 13 Jan 2011 10:29:18 -0500 Subject: [PATCH] Antik user package symbol shadowing and package use Define symbols to be shadowed and packages to be used for convenience and conflict resolution in the Antik user packages. --- basis-splines.lisp | 7 +------ init/init.lisp | 41 +++++++++++++++++++++++++------------- interpolation/lookup.lisp | 7 +------ special-functions/psi.lisp | 7 +------ 4 files changed, 30 insertions(+), 32 deletions(-) diff --git a/basis-splines.lisp b/basis-splines.lisp index a462751c..109b94e5 100644 --- a/basis-splines.lisp +++ b/basis-splines.lisp @@ -1,6 +1,6 @@ ;; Basis splines. ;; Liam Healy 2008-02-18 14:43:20EST basis-splines.lisp -;; Time-stamp: <2011-01-10 10:30:07EST basis-splines.lisp> +;; Time-stamp: <2011-01-13 10:24:59EST basis-splines.lisp> ;; ;; Copyright 2008, 2009, 2011 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -20,11 +20,6 @@ (in-package :gsl) -;;; antik:knots means "nautical miles per hour" but there's no conflict -;;; here with the function #'gsl:knots, so we shadow import the symbol -;;; from antik. -(shadowing-import 'antik:knots) - ;;; /usr/include/gsl/gsl_bspline.h ;;; Should be subclass of interpolation? diff --git a/init/init.lisp b/init/init.lisp index c9f8fe77..7cde22dc 100644 --- a/init/init.lisp +++ b/init/init.lisp @@ -1,6 +1,6 @@ ;; Load GSL ;; Liam Healy Sat Mar 4 2006 - 18:53 -;; Time-stamp: <2011-01-12 00:35:16EST init.lisp> +;; Time-stamp: <2011-01-13 09:38:45EST init.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009, 2010, 2011 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -19,23 +19,36 @@ ;; along with this program. If not, see <http://www.gnu.org/licenses/>. (defpackage gsll - (:nicknames :gsl) + (:nicknames :gsl) (:use :common-lisp :cffi) (:import-from :grid #:dim0 #:dim1 #:^ #:copy) - (:export #:dim0 #:dim1 #:copy)) + (:export #:dim0 #:dim1 #:copy) + ;; No actual conflict due to different usage of symbols: + ;; antik:psi means "pounds per square inch" vs. function #'gsl:psi + ;; antik:knots means "nautical miles per hour" vs. function #'gsl:knots + ;; antik:acceleration refers to the time derivative of velocity vs. object 'gsl:acceleration. + ;; si units symbol-macro vs. GSLL's sine integral. + (:shadowing-import-from :antik #:psi #:knots #:acceleration #:si)) -;;; Where there is a symbol conflict, take the other one. -(shadow '#:row :antik-user) ; conflict with grid:row; they are equivalent -(shadow '#:column :antik-user) ; conflict with grid:column; they are equivalent -(shadow '#:sum :antik-user) ; conflict of histogram function with iterate:sum, both pretty obscure -(shadow '#:multiply :antik-user) ; conflict if GSL's duplicate '* with iterate:multiply -(shadow '#:si :antik-user) ; si units symbol-macro vs. GSLL's sine integral; technically not a conflict -(shadow '#:polar-to-rectangular :antik-user) ; GSLL's doesn't use vectors -(shadow '#:rectangular-to-polar :antik-user) ; GSLL's doesn't use vectors -;;; Where there is a symbol conflict, take GSLL's -(shadowing-import 'gsl::iterate :antik-user) ; conflict with iterate:iterate, but iterate:iter is a synonym +(setf + antik::*antik-user-shadow-symbols* + (append antik::*antik-user-shadow-symbols* + ;; Where there is a symbol conflict between GSLL and other packages, + '( + ;; take from the other package + grid:row ; GSLL alternate is equivalent + grid:column ; GSLL alternate is equivalent + iterate:sum ; GSLL histogram function, both pretty obscure + iterate:multiply ; GSLL function duplicates '* + antik:polar-to-rectangular ; GSLL's doesn't use vectors + antik:rectangular-to-polar ; GSLL's doesn't use vectors + ;; taken from GSLL + gsll::iterate ; conflict with iterate:iterate, but iterate:iter is a synonym + )) + antik::*antik-user-use-packages* + (cons '#:gsll antik::*antik-user-use-packages*)) -(use-package :gsll :antik-user) +(antik:make-user-package :antik-user) ; Add the new use package and shadow symbols to :antik-user (in-package :gsl) diff --git a/interpolation/lookup.lisp b/interpolation/lookup.lisp index a3a35344..78b754c6 100644 --- a/interpolation/lookup.lisp +++ b/interpolation/lookup.lisp @@ -1,6 +1,6 @@ ;; Index lookup and acceleration ;; Liam Healy, Sun Nov 4 2007 - 18:09 -;; Time-stamp: <2011-01-10 10:29:57EST lookup.lisp> +;; Time-stamp: <2011-01-13 10:24:57EST lookup.lisp> ;; ;; Copyright 2007, 2008, 2009, 2011 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -20,11 +20,6 @@ (in-package :gsl) -;;; antik:acceleration refers to the time derivative of velocity but -;;; there's no conflict here with the object 'gsl:acceleration, so we -;;; shadow import the symbol from antik. -(shadowing-import 'antik:acceleration) - (defmobject acceleration "gsl_interp_accel" () "acceleration for interpolation" diff --git a/special-functions/psi.lisp b/special-functions/psi.lisp index 43ee948a..745f4c78 100644 --- a/special-functions/psi.lisp +++ b/special-functions/psi.lisp @@ -1,6 +1,6 @@ ;; Psi (digamma) functions ;; Liam Healy, Mon May 1 2006 - 22:11 -;; Time-stamp: <2011-01-10 10:21:07EST psi.lisp> +;; Time-stamp: <2011-01-13 10:25:00EST psi.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009, 2011 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -20,11 +20,6 @@ (in-package :gsl) -;;; antik:psi means "pounds per square inch" but there's no conflict -;;; here with the function #'gsl:psi, so we shadow import the symbol -;;; from antik. -(shadowing-import 'antik:psi) - ;;;;**************************************************************************** ;;;; Digamma Function ;;;;**************************************************************************** -- GitLab