(defun make-symbol-list ()
  (interactive "*")
  (setq default-case-fold-search nil)
  (goto-char 0)
  (insert "(setq file-list\n'(\"")
  (replace-string "\n" "\"\n\"")
  (kill-line 0)
  (insert "))\n")
  (not-modified)
  (eval-current-buffer nil)
  (while (not (equal file-list nil))
    (make-symbols (car file-list))
    (setq file-list (cdr file-list))
    )
  (switch-to-buffer "symbol-index")
  (goto-char 0)
  (insert "\n")
  (write-file "symbol-index")
  )

(defun make-symbols (file)
  (interactive "fFile name: ")
  (find-file file)
  (goto-char 0)
  (if (search-forward "EXPORT" nil t)
      (progn (setq buffer-read-only nil)
	     (re-search-forward "[,;]")
	     (forward-word -1)
	     (delete-region (point-min) (point))
	     (search-forward ";")
	     (delete-region (1- (point)) (point-max))
	     (insert ",\n : " (file-name-nondirectory file))
	     (beginning-of-line)
	     (if (search-forward "." nil t)
		 (delete-region (1- (point)) (point-max)))
	     (beginning-of-line)
	     (setq module (buffer-substring (point) (point-max)))
	     (delete-region (point) (point-max))
	     (goto-char 0)
	     (replace-regexp "^#.*" "")
	     (goto-char 0)
	     (replace-regexp "[ \t\n][ \t\n]*" "\n")
	     (goto-char 0)
	     (replace-string "," module)
	     (not-modified)
	     (append-to-buffer "symbol-index" (point-min) (point-max))
	     )
    )
  )
