Version 1.7.2: Add support external character formats for underlying implementation.
authorKevin Rosenberg <kevin@rosenberg.net>
Fri, 5 Feb 2010 21:36:43 +0000 (14:36 -0700)
committerKevin Rosenberg <kevin@rosenberg.net>
Fri, 5 Feb 2010 21:36:43 +0000 (14:36 -0700)
ChangeLog
debian/changelog
src/i18n.lisp [new file with mode: 0644]
src/package.lisp
uffi.asd

index 9e58645cd43acfeb6a28b0e9ad09b45769062eac..ff7854dff72844dc71fb5af068a68bf5ffc97a75 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-02-05 Kevin Rosenberg <kevin@rosenberg.net>
+       * Version 1.7.2
+       * src/i18n.lisp: New file for supporting non-ASCII foreign strings.
+
 2010-01-29 Kevin Rosenberg <kevin@rosenberg.net>
        * Version 1.7.1
        * src/primitives.lisp: Add :long-long and :unsigned-long-long
index 6c46ae65c9fa75380969202bb10cf598ab63930c..28801d08a2abcb0e7d33bbb9a4aaad045f63017d 100644 (file)
@@ -1,3 +1,9 @@
+cl-uffi (1.7.2-1) unstable; urgency=low
+
+  * New upstream
+
+ -- Kevin M. Rosenberg <kmr@debian.org>         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 (file)
index 0000000..e2d204a
--- /dev/null
@@ -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)))
index bdce95b70b5fcf3b91ede72cb5374a66eac66239..9bd3d25f2a38b496a690c0d13dd8cb01f425867b 100644 (file)
@@ -18,6 +18,7 @@
   (:export
 
    ;; immediate types
+   #:no-long-long
    #:def-constant
    #:def-foreign-type
    #:def-type
    ;; OS
    #:run-shell-command
    #:getenv
+
+   ;; Internatialization
+   #:no-i18n
+   #:*default-external-character-encoding*
+   #:*external-character-encodings*
    ))
 
 
index ddcf338210d3c8a2dfbffd095aff3323db577b17..1ca66a916cc490995ad5b36dafbd598e7c2c6f27 100644 (file)
--- 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 <kevin@rosenberg.net>"
-  :version "1.2.x"
+  :version "1.7.2"
   :maintainer "Kevin M. Rosenberg <kmr@debian.org>"
   :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"))