1 ;;; liece-q-ccl.el --- CTCP binary data quotation in CCL.
2 ;; Copyright (C) 1998-2000 Daiki Ueno
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
7 ;; Keywords: IRC, liece, CTCP
9 ;; This file is part of Liece.
11 ;; This program is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; This program is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
36 (defconst liece-quote-ccl-256-table
37 '( 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
38 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
39 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
40 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
41 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
42 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
43 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
44 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
45 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
46 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
47 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
48 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
49 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
50 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
51 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
52 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255)))
54 (broken-facility ccl-cascading-write
55 "Emacs CCL write command does not accept more than 2 arguments."
58 (define-ccl-program cascading-read-test
64 (define-ccl-program liece-quote-ccl-decode
84 (if-broken ccl-cascading-write
88 liece-quote-ccl-256-table))))
92 (define-ccl-program liece-quote-ccl-encode
100 ((= r0 (char-int ?\\))
101 `(write-repeat "\\\\"))
102 ((= r0 (char-int ?\x01))
103 `(write-repeat "\\a"))
104 ((= r0 (char-int ?\n))
105 `(write-repeat "\\n"))
106 ((= r0 (char-int ?\r))
107 `(write-repeat "\\r"))
109 `(write-repeat r0))))
110 liece-quote-ccl-256-table)))))
112 (make-ccl-coding-system
113 'liece-quote-ccl-cs ?Q "CTCP Quote Decoder/Encoder"
114 'liece-quote-ccl-decode 'liece-quote-ccl-encode)
116 (defun liece-quote-ccl-decode-string (string-to-decode)
117 (decode-coding-string string-to-decode 'liece-quote-ccl-cs))
119 (defun liece-quote-ccl-encode-string (string-to-encode)
120 (encode-coding-string string-to-encode 'liece-quote-ccl-cs))
122 (defun liece-quote-ccl-decode-region (min max)
123 (decode-coding-region min max 'liece-quote-ccl-cs))
125 (defun liece-quote-ccl-encode-region (min max)
126 (encode-coding-region min max 'liece-quote-ccl-cs))
128 (defalias 'liece-quote-decode-string 'liece-quote-ccl-decode-string)
129 (defalias 'liece-quote-encode-string 'liece-quote-ccl-encode-string)
131 (defalias 'liece-quote-decode-region 'liece-quote-ccl-decode-region)
132 (defalias 'liece-quote-encode-region 'liece-quote-ccl-encode-region)
134 (provide 'liece-q-ccl)
136 ;;; liece-q-ccl.el ends here