Function: idlwave-find-structure-definition

idlwave-find-structure-definition is a byte-compiled function defined in idlwave.el.gz.

Signature

(idlwave-find-structure-definition &optional VAR NAME BOUND)

Documentation

Search forward for a structure definition.

If VAR is non-nil, search for a structure assigned to variable VAR. If NAME is non-nil, search for a named structure NAME, if a string, or a generic named structure otherwise. If BOUND is an integer, limit the search. If BOUND is the symbol all, we search first back and then forward through the entire file. If BOUND is the symbol back we search only backward.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/idlwave.el.gz
(defun idlwave-find-structure-definition (&optional var name bound)
  "Search forward for a structure definition.
If VAR is non-nil, search for a structure assigned to variable VAR.
If NAME is non-nil, search for a named structure NAME, if a string,
or a generic named structure otherwise.  If BOUND is an integer, limit
the search.  If BOUND is the symbol `all', we search first back and
then forward through the entire file.  If BOUND is the symbol `back'
we search only backward."
  (let* ((ws "[ \t]*\\(\\$.*\n[ \t]*\\)*")
	 (case-fold-search t)
	 (lim (if (integerp bound) bound nil))
	 (re (concat
	      (if var
		  (concat "\\<" (regexp-quote (downcase var)) "\\>" ws)
		"\\(\\)")
	      "=" ws "\\({\\)"
	      (if name
		  (if (stringp name)
		      (concat ws "\\(\\<" (downcase name) "\\)[^a-zA-Z0-9_$]")
		    ;; Just a generic name
		    (concat ws "\\<\\([a-zA-Z_0-9$]+\\)" ws ","))
		""))))
    (if (or (and (or (eq bound 'all) (eq bound 'back))
		 (re-search-backward re nil t))
	    (and (not (eq bound 'back)) (re-search-forward re lim t)))
	(progn
	  (goto-char (match-beginning 3))
	  (match-string-no-properties 5)))))