;;; hankana.el --- hankaku katakana utils ;; Copyright (C) 2002 Masanao Izumo ;; Maintainer: Masanao Izumo ;; Version: 1.0.0 ;; This library is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; This library is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with library; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. (defvar zenkana-hankana-map '(("ガ" . "ガ") ("ギ" . "ギ") ("グ" . "グ") ("ゲ" . "ゲ") ("ゴ" . "ゴ") ("ザ" . "ザ") ("ジ" . "ジ") ("ズ" . "ズ") ("ゼ" . "ゼ") ("ゾ" . "ゾ") ("ダ" . "ダ") ("ヂ" . "ヂ") ("ヅ" . "ヅ") ("デ" . "デ") ("ド" . "ド") ("バ" . "バ") ("ビ" . "ビ") ("ブ" . "ブ") ("ベ" . "ベ") ("ボ" . "ボ") ("パ" . "パ") ("ピ" . "ピ") ("プ" . "プ") ("ペ" . "ペ") ("ポ" . "ポ") ("。" . "。") ("「" . "「") ("」" . "」") ("、" . "、") ("," . "、") ("・" . "・") ("ヲ" . "ヲ") ("ァ" . "ァ") ("ィ" . "ィ") ("ゥ" . "ゥ") ("ェ" . "ェ") ("ォ" . "ォ") ("ャ" . "ャ") ("ュ" . "ュ") ("ョ" . "ョ") ("ッ" . "ッ") ("ー" . "ー") ("―" . "ー") ("‐" . "ー") ("−" . "ー") ("ア" . "ア") ("イ" . "イ") ("ウ" . "ウ") ("エ" . "エ") ("オ" . "オ") ("カ" . "カ") ("キ" . "キ") ("ク" . "ク") ("ケ" . "ケ") ("コ" . "コ") ("サ" . "サ") ("シ" . "シ") ("ス" . "ス") ("セ" . "セ") ("ソ" . "ソ") ("タ" . "タ") ("チ" . "チ") ("ツ" . "ツ") ("テ" . "テ") ("ト" . "ト") ("ナ" . "ナ") ("ニ" . "ニ") ("ヌ" . "ヌ") ("ネ" . "ネ") ("ノ" . "ノ") ("ハ" . "ハ") ("ヒ" . "ヒ") ("フ" . "フ") ("ヘ" . "ヘ") ("ホ" . "ホ") ("マ" . "マ") ("ミ" . "ミ") ("ム" . "ム") ("メ" . "メ") ("モ" . "モ") ("ヤ" . "ヤ") ("ユ" . "ユ") ("ヨ" . "ヨ") ("ラ" . "ラ") ("リ" . "リ") ("ル" . "ル") ("レ" . "レ") ("ロ" . "ロ") ("ワ" . "ワ") ("ン" . "ン") ("゛" . "゙") ("゜" . "゚") )) (defvar hankana-zenkana-map (mapcar #'(lambda (pair) (cons (cdr pair) (car pair))) zenkana-hankana-map)) (defun hankana-convert-region (start end map-alist) (save-excursion (save-restriction (narrow-to-region (point-min) end) (goto-char start) (while (not (eobp)) (let ((found nil) (map map-alist)) (while (and map (not found)) (if (looking-at (car (car map))) (setq found (car map)) (setq map (cdr map)))) (if found (progn (delete-region (match-beginning 0) (match-end 0)) (insert (cdr found))) (forward-char 1))))))) (defun hankana-zenkana-region (start end) (interactive "r") (hankana-convert-region start end hankana-zenkana-map)) (defun zenkana-hankana-region (start end) (interactive "r") (hankana-convert-region start end zenkana-hankana-map)) (provide 'hankana)