;;;-*- Mode: Lisp; Package: STRING-NET -*- ;; Copyright (C) Paul Meurer 2000 - 2007. All rights reserved. ;; paul.meurer@aksis.uib.no ;; Aksis, UNIFOB, University of Bergen ;; ;;------------------------------------------------------------------------------------- ;; TO DO: ;; - put into utils package ;;------------------------------------------------------------------------------------- (in-package "STRING-NET") (defparameter *mac-char-codes* #(127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255)) (defparameter *win-char-codes* #(127 196 197 199 201 209 214 220 225 224 226 228 227 229 231 233 232 234 235 237 236 238 239 241 243 242 244 246 245 250 249 251 252 221 176 162 163 167 128 182 223 174 169 129 180 168 130 198 216 131 177 190 132 165 181 143 133 189 188 134 170 186 135 230 248 191 161 172 136 159 137 144 171 187 138 160 192 195 213 145 166 173 139 179 178 140 185 247 215 255 141 142 164 208 240 222 254 253 183 146 147 148 194 202 193 203 200 205 206 207 204 211 212 149 210 218 219 217 158 150 151 175 152 153 154 184 155 156 157)) (defparameter *unix-char-codes* #(127 196 197 199 201 209 214 220 225 224 226 228 227 229 231 233 232 234 235 237 236 238 239 241 243 242 244 246 245 250 249 251 252 221 176 162 163 167 128 182 223 174 169 129 180 168 130 198 216 131 177 190 132 165 181 143 133 189 188 134 170 186 135 230 248 191 161 172 136 159 137 144 171 187 138 160 192 195 213 145 166 173 139 179 178 140 185 247 215 255 141 142 164 208 240 222 254 253 183 146 147 148 194 202 193 203 200 205 206 207 204 211 212 149 210 218 219 217 158 150 151 175 152 153 154 184 155 156 157)) (defparameter *mac-to-win-table* (make-hash-table)) (defparameter *win-to-mac-table* (make-hash-table)) (defparameter *mac-to-unix-table* (make-hash-table)) (defparameter *unix-to-mac-table* (make-hash-table)) (loop for mac across *mac-char-codes* and win across *win-char-codes* and unix across *unix-char-codes* do (setf (gethash mac *mac-to-win-table*) win (gethash win *win-to-mac-table*) mac (gethash mac *mac-to-unix-table*) unix (gethash unix *unix-to-mac-table*) mac)) (defun mac-to-win-char-code (mac-code) (gethash mac-code *mac-to-win-table* mac-code)) (defun win-to-mac-char-code (win-code) (gethash win-code *win-to-mac-table* win-code)) (defun mac-to-unix-char-code (mac-code) (gethash mac-code *mac-to-unix-table* mac-code)) (defun unix-to-mac-char-code (unix-code) (gethash unix-code *unix-to-mac-table* unix-code)) :eof