(defun goop (index)
  (interactive "*nprofileTable index: \n")
  (goto-char (point-min))
  (search-forward "MODULE ")
  (setq name (buffer-substring (point)
			       (progn (forward-word 1) (point))
			       ))
  (beginning-of-line 2)
  (if (search-forward "BEGIN" nil t)
      (progn (beginning-of-line 2)
	     (insert (format "#ifdef PROF\n\tINC(profileTable[%d]);\t(* " index) name " *)\n#endif PROF\n#ifdef LONGTRACE\n\ttypeLine('+" name "');\n#endif LONGTRACE\n")
	     (search-forward (concat "END " name))
	     (beginning-of-line)
	     (insert (format "#ifdef LONGTRACE\n\ttypeLine('-%s');\n#endif LONGTRACE\n#ifdef PROF\n\tINC(profileTable[%d]);\n#endif PROF\n" name index)))
    (insert (format "BEGIN\n#ifdef PROF\n\tINC(profileTable[%d], 2);\t(* " index) name " *)\n#endif PROF\n#ifdef LONGTRACE\n\ttypeLine('*" name "');\n#endif LONGTRACE\n")
    )
  )
