;; | --------------------------------------------------------------------------- ;; | MI_hxlist ;; | --------------------------------------------------------------------------- ;; | Function : HXLIST accepts a hexadecimal string and returns it as ;; | a list in the form:(1's 16s 16x16s 16x16x16s ...) ;; | Argument : 'str - Hexadecimal String ;; | Return : The hexadecimal list ;; | Update : August 6, 1998 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | --------------------------------------------------------------------------- (defun MI_hxlist (str / prmpt num num1 lst) (setq num1 0 str (strcase str) ;force str uppercase prmpt (strcat "\nInvalid hex value " str) ;build error prompt ) (while ;process each character (/= 0 (setq num (substr str 1 1) ;get 1st str (substr str 2) ;remainder num (ascii num) ;return ascii value ) ) (if (setq num ;return base 10 value (cond ( (< num 48) (prompt prmpt)) ;not a number ( (< num 58) (- num 48)) ;convert 0-9 ( (< num 65) (prompt prmpt)) ;not a number ( (< num 71) (- num 55)) ;convert A-F ( T (prompt prmpt)) ;anything else ) ) (setq lst (append (list num) lst)) ;accumulate results ) ) lst ;return results )