annotate lisp/language/indian.el @ 41859:ff9ec69df33d

(HAVE_VFORK): Remove #undef.
author Paul Eggert <eggert@twinsun.com>
date Fri, 07 Dec 2001 05:55:03 +0000
parents f091948e4d1c
children 3bf347fb3060
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
41469
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
1 ;;; indian.el --- Indian languages support -*- coding: iso-2022-7bit; -*-
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2
41469
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
3 ;; Copyright (C) 1999, 2001 Free Software Foundation, Inc.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
4
41469
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
5 ;; Maintainer: KAWABATA, Taichi <batta@beige.ocn.ne.jp>
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
6 ;; Keywords: multilingual, Indian
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
7
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
9
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
13 ;; any later version.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
14
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
19
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
17314
f438ebf1c679 Fix FSF address in comment.
Kenichi Handa <handa@m17n.org>
parents: 17300
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
f438ebf1c679 Fix FSF address in comment.
Kenichi Handa <handa@m17n.org>
parents: 17300
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
f438ebf1c679 Fix FSF address in comment.
Kenichi Handa <handa@m17n.org>
parents: 17300
diff changeset
23 ;; Boston, MA 02111-1307, USA.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
24
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
25 ;;; Commentary:
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
26
41469
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
27 ;; This file defines in-is13194 coding system and relationship between
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
28 ;; indian-glyph character-set and various CDAC fonts.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
29
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
30 ;;; Code:
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
31
41469
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
32 (make-coding-system
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
33 'in-is13194 2 ?D
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
34 "8-bit encoding for ASCII (MSB=0) and IS13194-Devanagari (MSB=1)"
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
35 '(ascii indian-is13194 nil nil
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
36 nil ascii-eol)
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
37 '((safe-charsets ascii indian-is13194)
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
38 (post-read-conversion . in-is13194-post-read-conversion)
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
39 (pre-write-conversion . in-is13194-pre-write-conversion)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
40
41469
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
41 (defvar indian-script-table
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
42 '[
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
43 devanagari
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
44 sanskrit
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
45 bengali
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
46 tamil
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
47 telugu
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
48 assamese
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
49 oriya
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
50 kannada
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
51 malayalam
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
52 gujarati
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
53 punjabi
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
54 ]
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
55 "Vector of Indian script names.")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
56
41469
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
57 (let ((len (length indian-script-table))
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
58 (i 0))
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
59 (while (< i len)
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
60 (put (aref indian-script-table i) 'indian-glyph-code-offset (* 256 i))
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
61 (setq i (1+ i))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
62
41469
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
63 (defvar indian-default-script 'devanagari
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
64 "Default script for Indian languages.
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
65 Each Indian language environment sets this value
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
66 to one of `indian-script-table' (which see).
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
67 The default value is `devanagari'.")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
68
41469
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
69 (defun indian-glyph-char (index &optional script)
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
70 "Return character of charset `indian-glyph' made from glyph index INDEX.
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
71 The variable `indian-default-script' specifies the script of the glyph.
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
72 Optional argument SCRIPT, if non-nil, overrides `indian-default-script'.
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
73 See also the function `indian-char-glyph'."
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
74 (or script
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
75 (setq script indian-default-script))
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
76 (let ((offset (get script 'indian-glyph-code-offset)))
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
77 (or (integerp offset)
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
78 (error "Invalid script name: %s" script))
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
79 (or (and (>= index 0) (< index 256))
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
80 (error "Invalid glyph index: %d" index))
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
81 (setq index (+ offset index))
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
82 (make-char 'indian-glyph (+ (/ index 96) 32) (+ (% index 96) 32))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
83
41469
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
84 (defvar indian-glyph-max-char
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
85 (indian-glyph-char
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
86 255 (aref indian-script-table (1- (length indian-script-table))))
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
87 "The maximum valid code of characters in the charset `indian-glyph'")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
88
41469
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
89 (defun indian-char-glyph (char)
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
90 "Return information about the glphy code for CHAR of `indian-glyph' charset.
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
91 The value is (INDEX . SCRIPT), where INDEX is the glyph index
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
92 in the font that Indian script name SCRIPT specifies.
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
93 See also the function `indian-glyph-char'."
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
94 (let ((split (split-char char))
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
95 code)
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
96 (or (eq (car split) 'indian-glyph)
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
97 (error "Charset of `%c' is not indian-glyph" char))
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
98 (or (<= char indian-glyph-max-char)
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
99 (error "Invalid indian-glyph char: %d" char))
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
100 (setq code (+ (* (- (nth 1 split) 32) 96) (nth 2 split) -32))
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
101 (cons (% code 256) (aref indian-script-table (/ code 256)))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
102
41469
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
103 (define-ccl-program ccl-encode-indian-glyph-font
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
104 `(0
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
105 ;; Shorten (r1 = (((((r1 - 32) * 96) + r2) - 32) % 256))
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
106 (r1 = ((((r1 * 96) + r2) - ,(+ (* 32 96) 32)) % 256))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
107
41469
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
108 (setq font-ccl-encoder-alist
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
109 (cons (cons "-CDAC" 'ccl-encode-indian-glyph-font)
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
110 font-ccl-encoder-alist))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
111
41469
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
112 (setq font-ccl-encoder-alist
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
113 (cons '("ISO10646.*-1" . ccl-encode-unicode-font)
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
114 font-ccl-encoder-alist))
33778
6d966e8b4bbe Use provide.
Dave Love <fx@gnu.org>
parents: 23158
diff changeset
115
6d966e8b4bbe Use provide.
Dave Love <fx@gnu.org>
parents: 23158
diff changeset
116 (provide 'indian)
41469
f091948e4d1c Completely re-written.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
117
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
118 ;;; indian.el ends here