2 ;;; $Id: tl-num.el,v 1.1.1.1 1998-01-14 06:27:57 steve Exp $
4 ;;; by MORIOKA Tomohiko <morioka@jaist.ac.jp>, 1993/10/4
14 (defun n-char-to-int (chr)
15 "Convert n base character CHR to integer (n <= 36). [tl-num]"
16 (cond ((and (<= ?0 chr)(<= chr ?9)) (- chr ?0))
17 ((and (<= ?A chr)(<= chr ?Z)) (+ (- chr ?A) 10))
18 ((and (<= ?a chr)(<= chr ?z)) (+ (- chr ?a) 10))
21 (defun int-to-n-char (n)
22 "Convert integer N to n base character (n <= 36). [tl-num]"
28 (defun base-seq-to-int (base seq)
29 "Convert n base number sequence SEQ to number. [tl-num]"
36 (defun base-char-seq-to-int (base seq)
37 "Convert n base char sequence SEQ to number. [tl-num]"
40 (+ (* n base)(n-char-to-int chr))
48 (defun hex-char-to-number (chr)
49 "Convert hex character CHR to number. [tl-num]"
50 (cond ((and (<= ?0 chr)(<= chr ?9)) (- chr ?0))
51 ((and (<= ?A chr)(<= chr ?F)) (+ (- chr ?A) 10))
52 ((and (<= ?a chr)(<= chr ?f)) (+ (- chr ?a) 10))
55 (defalias 'number-to-hex-char 'int-to-n-char)
57 (defun hex-seq-to-int (seq)
58 "Convert hex number sequence SEQ to integer. [tl-num]"
59 (base-seq-to-int 16 seq)
62 (defun hex-char-seq-to-int (seq)
63 "Convert hex char sequence SEQ to integer. [tl-num]"
64 (base-char-seq-to-int 16 seq)