;;; Reads-in comma-delimited file and returns a list ;;; Version 1.1 ;;; written in 1994 ;;; By Eric Boehlke ;;; http://truevis.com ;;; design@truevis.com (if (not collect) (load "collect")) (defun read-cdf (line-data / line-list quoted?) (if line-data (progn (setq word "" count 0 line-length (strlen line-data)) (repeat line-length (setq count (1+ count) letter (substr line-data count 1)) (cond ((= count line-length) (cond ((= letter ",") (setq comma? T)) ((= letter "\"") (setq quoted? nil)) (T (setq word (strcat word letter)))) (setq line-list (collect line-list word) word "") (if comma? (setq line-list (collect line-list "") comma? nil))) ((= letter "\"") ;switch quoted? on if first, off if second... (if quoted? (setq quoted? nil) (setq quoted? T))) ((and (not quoted?) (= letter ",")) (setq line-list (collect line-list word) word "")) (T (setq word (strcat word letter)))) ;cond ) ;repeat line-list ;return the collected-list ) ;progn nil)) ;defun