Function: idlwave-shell-routine-info-filter
idlwave-shell-routine-info-filter is a byte-compiled function defined
in idlw-shell.el.gz.
Signature
(idlwave-shell-routine-info-filter)
Documentation
Parse the special output from idlwave_routine_info.pro.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/idlw-shell.el.gz
(defun idlwave-shell-routine-info-filter ()
"Parse the special output from idlwave_routine_info.pro."
(let ((text idlwave-shell-command-output)
(start 0)
sep sep-re file type spec specs name cs key keys class entry)
;; (message "GOT: %s" text) ;??????????????????????
;; Initialize variables
(setq idlwave-compiled-routines nil
idlwave-unresolved-routines nil)
;; Cut out the correct part of the output.
(if (string-match
"^>>>BEGIN OF IDLWAVE ROUTINE INFO (\"\\(.+\\)\" IS THE SEPARATOR.*"
text)
(setq sep (match-string 1 text)
sep-re (concat (regexp-quote sep) " *")
text (substring text (match-end 0)))
;; Set dummy values and kill the text
(setq sep "@" sep-re "@ *" text "")
(if idlwave-idlwave_routine_info-compiled
(message
"Routine Info warning: No match for BEGIN line in \n>>>\n%s\n<<<\n"
idlwave-shell-command-output)))
(if (string-match "^>>>END OF IDLWAVE ROUTINE INFO.*" text)
(setq text (substring text 0 (match-beginning 0)))
(if idlwave-idlwave_routine_info-compiled
(message
"Routine Info warning: No match for END line in \n>>>\n%s\n<<<\n"
idlwave-shell-command-output)))
;; Match the output lines
(while (string-match "^IDLWAVE-\\(PRO\\|FUN\\): \\(.*\\)" text start)
(setq start (match-end 0))
(setq type (match-string 1 text)
spec (match-string 2 text)
specs (idlwave-split-string spec sep-re)
name (nth 0 specs)
class (if (equal (nth 1 specs) "") nil (nth 1 specs))
file (nth 2 specs)
cs (nth 3 specs)
key (nth 4 specs)
keys (if (and (stringp key)
(not (string-match "\\` *\\'" key)))
(mapcar #'list
(delete "" (idlwave-split-string key " +")))))
(setq name (idlwave-sintern-routine-or-method name class t)
class (idlwave-sintern-class class t)
file (if (equal file "") nil file)
keys (mapcar (lambda (x)
(list (idlwave-sintern-keyword (car x) t)))
keys))
;; In the following ignore routines already defined in buffers,
;; assuming that if the buffer stuff differs, it is a "new"
;; version, not yet compiled, and should take precedence.
;; We could do the same for the library to avoid duplicates -
;; but I think frequently a user might have several versions of
;; the same function in different programs, and in this case the
;; compiled one will be the best guess of all versions.
;; Therefore, we leave duplicates of library routines in.
(cond ((string= name "$MAIN$")) ; ignore this one
((and (string= type "PRO")
;; FIXME: is it OK to make the buffer routines dominate?
(or t (null file)
(not (idlwave-rinfo-assq name 'pro class
idlwave-buffer-routines)))
;; FIXME: is it OK to make the library routines dominate?
;;(not (idlwave-rinfo-assq name 'pro class
;; idlwave-library-routines))
)
(setq entry (list name 'pro class
(cons 'compiled
(if file
(list
(file-name-nondirectory file)
(idlwave-sintern-dir
(file-name-directory file)))))
cs (cons nil keys)))
(if file
(push entry idlwave-compiled-routines)
(push entry idlwave-unresolved-routines)))
((and (string= type "FUN")
;; FIXME: is it OK to make the buffer routines dominate?
(or t (not file)
(not (idlwave-rinfo-assq name 'fun class
idlwave-buffer-routines)))
;; FIXME: is it OK to make the library routines dominate?
;; (not (idlwave-rinfo-assq name 'fun class
;; idlwave-library-routines))
)
(setq entry (list name 'fun class
(cons 'compiled
(if file
(list
(file-name-nondirectory file)
(idlwave-sintern-dir
(file-name-directory file)))))
cs (cons nil keys)))
(if file
(push entry idlwave-compiled-routines)
(push entry idlwave-unresolved-routines))))))
;; Reverse the definitions so that they are alphabetically sorted.
(setq idlwave-compiled-routines (nreverse idlwave-compiled-routines)
idlwave-unresolved-routines (nreverse idlwave-unresolved-routines)))