开发者

Get name of c function given the filename and the line number - elisp

开发者 https://www.devze.com 2023-03-26 03:10 出处:网络
I am trying to make a script that tells me all the functions in C codebase that contain a call of of function X.

I am trying to make a script that tells me all the functions in C codebase that contain a call of of function X.

My strategy is to call rgrep and from te output determine from which functions the searched string is called.

I know little to no lisp so this is an educational exp开发者_运维百科erience too for me so please don give answers meaning something along the lines of "USE AWK NOOB"


Did you try cscope? http://cscope.sourceforge.net/


This function worked for finding the function name given that the point is in the function :D

(defun search-fun () (interactive)
  (search-backward-regexp "[a-zA-Z_][a-zA-Z0-9_]*[ \n\t]+\\([a-zA-Z_][a-zA-Z0-9_]*\\)[ \n\t]*([^<>=]*)[ \n\t]*{")
  (setq str (match-string 1))
  (if (string= str "if") (search-fun ) (return str)))
0

精彩评论

暂无评论...
验证码 换一张
取 消