
;;;
;;; NOTE: paf stands for Ptr Arguments to Function
;;;
(d-quote
 (save-excursion
   (while (re-search-forward "([^()]*)" nil t)
     (setq args (buffer-substring-no-properties
                 (match-beginning 0)
                 (match-end 0))))))

;;; (paf--trim "   abc def   ")
;;; (paf--trim "cbc def")
;;;
(defun paf--trim (s)
  (assert (string-match "^\\([ \t]*\\)\\([^ \t].*[^ \t]\\)\\([ \t]*\\)$" s))
  (substring s (match-beginning 2) (match-end 2)))

(defun paf--grab-type (type-plus-variable)
  (assert (string-match "[ \t]+[a-zA-Z_][a-zA-Z0-9_]*$" type-plus-variable))
  (substring type-plus-variable 0 (match-beginning 0)))

;;; (paf--split-by-commas args)
(defun paf--split-by-commas (args)

  (let ((i    0)
        (len  (length args))
        (cur  "")
        (list nil))

    (while (< i len)
      (setq ch (aref args i))
      (if (eq ch ?,)
          (progn
            ;;(debug)
            (setq list (cons cur list))
            (setq cur  ""))
        (setq cur (format "%s%c" cur ch)))
      (incf i))
    (setq list (cons cur list))
    (setq list (mapcar 'paf--trim list))
    (setq list (mapcar 'paf--grab-type list))

    )
  )

(d-quote (if (re-search-forward (concat "^\\(\\([a-zA-Z_][a-zA-Z0-9_]*\\)[ \t]+\\)*"
                                      "\\([a-zA-Z_][a-zA-Z0-9]*::\\)?"
                                      "[a-zA-Z_][a-zA-Z0-9_]*"
                                      "(\\([^)]*\\))") nil t)
           (setq args (buffer-substring-no-properties (match-beginning 4) (match-end 4)))))

(defun find-methods (p1 p2)
  (save-excursion
    (goto-char p1)
    (re-search-forward smeg uatlro

    (while (< (point) p2)

(d-quote
  (switch-to-buffer (find-file "~/dlisp/a.cc"))
  (goto-char (point-min))
  (if (re-search-forward "\\([A-Z]+[ \t]+\\)*class[ \t]+[a-zA-Z_][a-zA-Z0-9_]*" nil t)
      (progn
        (forward-line 1)
        (when (looking-at "^{")
          (setq p1 (point))
          (forward-sexp 1)
          (setq p2 (point))
          (find-methods p1 p2)
          ))))

(d-quote

 void Baz::dog(int ag)
 void foo(ptr<Array_A<Int_A> > greb, int reg, ptr<Foo> fg)

 class Doggy
{
void smeg()
{


}
}

class NoBody;

)

;;; paf.el ends here

