Fix symbol name
[uffi.git] / src / i18n.lisp
1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: UFFI -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:          i18n.lisp
6 ;;;; Purpose:       non-ASCII character support
7 ;;;; Programmer:    Kevin M. Rosenberg
8 ;;;; Date Started:  Feb 2010
9 ;;;;
10 ;;;; This file, part of UFFI, is Copyright (c) 2002-2010 by Kevin M. Rosenberg
11 ;;;;
12 ;;;; *************************************************************************
13
14 (in-package #:uffi)
15
16 #-(or (and lispworks unicode) (and sbcl sb-unicode)
17       (and allegro ics) (and clisp i18n)
18       (and openmcl openmcl-unicode-strings))
19 (pushnew 'no-i18n cl:*features*)
20
21 (defvar *default-external-character-encoding*
22   nil
23   "Normalized name of default external character encoding to use
24 for foreign string conversions. nil means use implementation default
25 encoding.")
26
27 (defvar *external-encoding-mapping*
28     #+(and lispworks unicode)
29     '((:ascii . :ascii) (:latin-1 . :latin-1) (:ucs-2 . :unicode)
30       (:utf-8 . :utf-8) (:jis . :jis) (:sjis . :sjis) (:gbk . :gbk))
31     #+(and sbcl sb-unicode)
32     '((:ascii . :ascii) (:latin-1 . :latin-1) (:utf-8 . :utf-8)
33       (:ucs-2 . :ucs-2) (:sjis . :sjis) (:gbk . :gbk))
34     #+(and allegro ics)
35     '((:ascii . :ascii) (:latin-1 . :latin1) (:utf-8 . :utf-8)
36       (:sjis . :shift-jis) (:euc-jp . :euc) (:gbk . :gb2313)
37       (:ucs-2 . :unicode))
38     #+(and clisp unicode)
39     '((:ascii . charset:ascii) (:ucs-2 . charset:ucs-2)
40       (:utf-8 . charset:utf-8) (:latin-1 . charset:iso-8859-1)
41       (:jis . charset:jis_x0201) (:jis . charset:shift-jis)
42       (:gbk . charset:gbk) (:euc-jp . charset:euc-jp))
43     #+(and openmcl openmcl-unicode-strings)
44     '((:ascii . :ascii) (:latin-1 . :iso-8859-1) (:utf-8 . :utf-8)
45       (:ucs-2 . :ucs-2) (:euc-jp . :euc-jp))
46     #-(or (and lispworks unicode) (and sbcl sb-unicode)
47           (and allegro ics) (and clisp unicode)
48           (and openmcl openmcl-unicode-strings))
49     nil
50   "Mapping between normalized external encoding name and implementation name.")
51
52 (defvar *external-character-encodings*
53   (mapcar 'car *external-encoding-mapping*)
54   "List of normalized names of external encodings support by underlying implementation.")
55
56 (defun map-normalized-external-encoding (normalized)
57   (cdr (assoc normalized *external-encoding-mapping* :test 'eql)))