From f14760717eb60ac01bb854986d9e4ba9eacdf8bc Mon Sep 17 00:00:00 2001 From: Kevin Rosenberg Date: Fri, 5 Feb 2010 14:36:43 -0700 Subject: [PATCH] Version 1.7.2: Add support external character formats for underlying implementation. --- ChangeLog | 4 ++++ debian/changelog | 6 +++++ src/i18n.lisp | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ src/package.lisp | 6 +++++ uffi.asd | 7 +++--- 5 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 src/i18n.lisp diff --git a/ChangeLog b/ChangeLog index 9e58645..ff7854d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-02-05 Kevin Rosenberg + * Version 1.7.2 + * src/i18n.lisp: New file for supporting non-ASCII foreign strings. + 2010-01-29 Kevin Rosenberg * Version 1.7.1 * src/primitives.lisp: Add :long-long and :unsigned-long-long diff --git a/debian/changelog b/debian/changelog index 6c46ae6..28801d0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +cl-uffi (1.7.2-1) unstable; urgency=low + + * New upstream + + -- Kevin M. Rosenberg Fri, 05 Feb 2010 11:03:20 -0700 + cl-uffi (1.7.1-1) unstable; urgency=low * New upstream diff --git a/src/i18n.lisp b/src/i18n.lisp new file mode 100644 index 0000000..e2d204a --- /dev/null +++ b/src/i18n.lisp @@ -0,0 +1,57 @@ +;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: UFFI -*- +;;;; ************************************************************************* +;;;; FILE IDENTIFICATION +;;;; +;;;; Name: i18n.lisp +;;;; Purpose: non-ASCII character support +;;;; Programmer: Kevin M. Rosenberg +;;;; Date Started: Feb 2010 +;;;; +;;;; This file, part of UFFI, is Copyright (c) 2002-2010 by Kevin M. Rosenberg +;;;; +;;;; ************************************************************************* + +(in-package #:uffi) + +#-(or (and lispworks unicode) (and sbcl sb-unicode) + (and allegro ics) (and clisp i18n) + (and openmcl openmcl-unicode-strings)) +(pushnew 'no-i18n *features*) + +(defvar *default-external-character-encoding* + nil + "Normalized name of default external character encoding to use +for foreign string conversions. nil means use implementation default +encoding.") + +(defvar *external-encoding-mapping* + #+(and lispworks unicode) + '((:ascii . :ascii) (:latin-1 . :latin-1) (:ucs-2 . :unicode) + (:utf-8 . :utf-8) (:jis . :jis) (:sjis . :sjis) (:gbk . :gbk)) + #+(and sbcl sb-unicode) + '((:ascii . :ascii) (:latin-1 . :latin-1) (:utf-8 . :utf-8) + (:ucs-2 . :ucs-2) (:sjis . :sjis) (:gbk . :gbk)) + #+(and allegro ics) + '((:ascii . :ascii) (:latin-1 . :latin1) (:utf-8 . :utf-8) + (:sjis . :shift-jis) (:euc-jp . :euc) (:gbk . :gb2313) + (:ucs-2 . :unicode)) + #+(and clisp unicode) + '((:ascii . charset:ascii) (:ucs-2 . charset:ucs-2) + (:utf-8 . charset:utf-8) (:latin-1 . charset:iso-8859-1) + (:jis . charset:jis_x0201) (:jis . charset:shift-jis) + (:gbk . charset:gbk) (:euc-jp . charset:euc-jp)) + #+(and openmcl openmcl-unicode-strings) + '((:ascii . :ascii) (:latin-1 . :iso-8859-1) (:utf-8 . :utf-8) + (:ucs-2 . :ucs-2) (:euc-jp . :euc-jp)) + #-(or (and lispworks unicode) (and sbcl sb-unicode) + (and allegro ics) (and clisp unicode) + (and openmcl openmcl-unicode-strings)) + nil + "Mapping between normalized external encoding name and implementation name.") + +(defvar *external-character-encodings* + (mapcar 'car *external-encoding-mapping*) + "List of normalized names of external encodings support by underlying implementation.") + +(defun map-normalized-external-encoding (normalized) + (cdr (assoc normalized *external-encoding-mapping* :test 'eql))) diff --git a/src/package.lisp b/src/package.lisp index bdce95b..9bd3d25 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -18,6 +18,7 @@ (:export ;; immediate types + #:no-long-long #:def-constant #:def-foreign-type #:def-type @@ -79,6 +80,11 @@ ;; OS #:run-shell-command #:getenv + + ;; Internatialization + #:no-i18n + #:*default-external-character-encoding* + #:*external-character-encodings* )) diff --git a/uffi.asd b/uffi.asd index ddcf338..1ca66a9 100644 --- a/uffi.asd +++ b/uffi.asd @@ -7,7 +7,7 @@ ;;;; Author: Kevin M. Rosenberg ;;;; Date Started: Aug 2002 ;;;; -;;;; This file, part of UFFI, is Copyright (c) 2002-2009 by Kevin M. Rosenberg +;;;; This file, part of UFFI, is Copyright (c) 2002-2010 by Kevin M. Rosenberg ;;;; ;;;; ************************************************************************* @@ -18,7 +18,7 @@ (defsystem uffi :name "uffi" :author "Kevin Rosenberg " - :version "1.2.x" + :version "1.7.2" :maintainer "Kevin M. Rosenberg " :licence "Lessor Lisp General Public License" :description "Universal Foreign Function Library for Common Lisp" @@ -28,7 +28,8 @@ ((:module :src :components ((:file "package") - (:file "primitives" :depends-on ("package")) + (:file "i18n" :depends-on ("package")) + (:file "primitives" :depends-on ("i18n")) #+(or openmcl digitool) (:file "readmacros-mcl" :depends-on ("package")) (:file "objects" :depends-on ("primitives")) (:file "aggregates" :depends-on ("primitives")) -- 2.34.1