Prog/TagSystem/cscope
の編集
[
トップ
] [
編集
|
差分
|
履歴
|
添付
|
リロード
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
-- 雛形とするページ --
App
App/archiver
App/audio
App/audio/audacity
App/audio/mpg321
App/audio/puddletag
App/base64
App/Browser
App/column
App/diff-patch
App/downloader
App/ffmpeg
App/ffprobe
App/find
App/gimp
App/gnuplot
App/ImageMagick
App/info
App/inxi
App/LibreOffice
App/locate
App/md5
App/Music
App/Music/frescobaldi
App/Music/MuseScore
App/OCR
App/od
App/OpenOffice.org
App/pagers
App/pdf
App/QRコード
App/ripgrep
App/screen
App/script
App/sed
App/selenium
App/signal-desktop
App/skype
App/sylpheed
App/tmux
App/ttyrec
App/uniq
App/UUID
App/wget
App/xargs
App/テキスト処理
App/仮想化
App/仮想化/Docker
App/仮想化/qemu
App/仮想化/webos
AutoTicketLinkName
BracketName
CentOS
CentOS/yum
CrossCompile
Debian
Debian/kernel
Debian/kernel/ver8-or-older
Debian/Plan9関連
Debian/ver5
Debian/ver6
Debian/ver7
Debian/ver8
Debian/ver9
Debian/ver10
Debian/ver11
Debian/ver12
Debian/X
Debian/X/日本語
Debian/パッケージ管理
Deveice/Sensor/MotionSensor
Device
Device/Mouse
Device/Net/wifi
Device/Scanner
Device/Sensor
Device/Sensor/MotionSensor
Device/tty
Device/xmodmap
Editor
Editor/atom
Editor/binary
Editor/binary/beav
Editor/binary/hexedit
Editor/emacs
Editor/emacs/clang-format
Editor/emacs/flycheck
Editor/emacs/gdb-mode
Editor/emacs/github/copilot
Editor/emacs/html-mode
Editor/emacs/lisp
Editor/emacs/lsp-mode
Editor/emacs/markdown-mode
Editor/emacs/neotree
Editor/emacs/package-install
Editor/emacs/sdic
Editor/emacs/speedbar
Editor/emacs/XEmacs
Editor/emacs/ローカルビルド
Editor/emacs/多言語
Editor/fte
Editor/vi
FormattingRules
FrontPage
Help
InterWiki
InterWikiName
InterWikiSandBox
iPhone
Lang
Lang/C++
Lang/C++/Boost
Lang/C++/C++11
Lang/C++/C++11/thread
Lang/C++/C++11/コンテナ
Lang/C++/C++11/コンテナ/string
Lang/C++/C++11/初期化子
Lang/C++/C++17
Lang/C++/C++20
Lang/C++/error
Lang/C++/macro
Lang/C++/template
Lang/C++/コンテナ
Lang/C++/処理系
Lang/C-Sharp
Lang/Go
Lang/html
Lang/html/5
Lang/html/5/canvas
Lang/html/css
Lang/Java
Lang/Java/jar
Lang/Objective-C
Lang/Pascal
Lang/Perl
Lang/Perl/CGI
Lang/Perl/thread
Lang/Perl/utf-8
Lang/pike
Lang/Python
Lang/Python/Class
Lang/Python/Error
Lang/Python/import対象パス
Lang/Python/pip
Lang/Python/基本文法
Lang/Python/開発環境
Lang/Rust
Lang/sed
Lang/shell
Lang/shell/bash
Lang/shell/bash/設定
Lang/shell/bash/設定/command-not-found
Lang/Tcl_Tk_Expect
Lang/Tcl_Tk_Expect/Ctrl-キーマップ
Lang/TypeScript
Lang/xml
Mac
Memo
memo
MenuBar
midi
Multimedia
Net
Net/apache
Net/apache2
Net/dig
Net/dns/server
Net/domain
Net/http/アクセス制御
Net/iptables
Net/IRC
Net/Jenkins
Net/lighttpd
Net/mail
Net/mail/X-Face
Net/news
Net/news/gnus
Net/ntp
Net/pukiwiki
Net/pukiwiki/plugin
Net/resolv.conf
Net/SPAM
Net/ss
Net/tcpdump
Net/traceroute
Net/twitter
Net/vpn
Net/web
Net/webAPI
Net/wifi
Net/wifi/AP
Net/監視
otherlinks
PHP
Plan9
PPC
PPC/LinuxPPC
PPC/MkLinux
Prog
Prog/AI
Prog/autotools
Prog/cmake
Prog/Compiler/gcc
Prog/CrossReferencer
Prog/debug
Prog/debug/gdb
Prog/debug/lldb
Prog/debug/ltrace
Prog/debug/memory
Prog/debug/strace
Prog/formatter/clang-format
Prog/GoogleTest
Prog/Gtk
Prog/IDE
Prog/IDE/Geany
Prog/ldd
Prog/make
Prog/nm
Prog/Profiler
Prog/Qt
Prog/readelf
Prog/Sound
Prog/StaticCodeAnalysis
Prog/StaticCodeAnalysis/cppcheck
Prog/strip
Prog/TagSystem
Prog/TagSystem/cscope
Prog/TagSystem/ctags-exuberant
Prog/TagSystem/ebrowse
Prog/TagSystem/etags
Prog/TagSystem/gtags
Prog/TagSystem/id-utils
Prog/TagSystem/lctags
Prog/TagSystem/rtags
Prog/TagSystem/SilentBob
Prog/X/X11
Prog/プロセス間通信
Prog/プロセス間通信/SharedMemory
Prog/プロセス間通信/singal
Prog/人為的なシグナル
Prog/分散ビルド/distcc
Prog/逆アセンブル
PukiWiki
PukiWiki/1.4
PukiWiki/1.4/Manual
PukiWiki/1.4/Manual/Plugin
PukiWiki/1.4/Manual/Plugin/A-D
PukiWiki/1.4/Manual/Plugin/E-G
PukiWiki/1.4/Manual/Plugin/H-K
PukiWiki/1.4/Manual/Plugin/L-N
PukiWiki/1.4/Manual/Plugin/O-R
PukiWiki/1.4/Manual/Plugin/S-U
PukiWiki/1.4/Manual/Plugin/V-Z
RecentDeleted
RS232C
SandBox
Security
Security/aide
Security/chkrootkit
Security/clamav
Security/gpg
Security/pkcs
Security/ssh
Security/test
Security/パスワード解析
System
System/Audio
System/beep
System/bluetooth
System/cpu
System/dm-crypt
System/fs
System/fs/ext2-3
System/fs/mount
System/fs/nfs
System/fs/tmpfs
System/fs/xfs
System/fs/大容量のファイルを高速に作成する
System/fs/強制物理フォーマット
System/grub
System/Hardware情報
System/HDD/IDE/チューニング
System/input
System/iostat
System/Kernel
System/Kernel/Module
System/locale
System/memory
System/OpenCL
System/os
System/power/battery
System/Process
System/random
System/rpm
System/runlevel
System/signal
System/sudo
System/swap
System/USB-Boot
System/user
System/シリアル接続
System/環境変数
TeX
TeX/MusiXTeX
tools
Top/Editor/emacs/python開発環境
transcription/old
Ubuntu
VersionCtl
VersionCtl/git
VersionCtl/git/Gerrit
VersionCtl/git/Gerrit/old
VersionCtl/git/git-gutter+
VersionCtl/git/git-imerge
VersionCtl/git/magit
VersionCtl/git/magit/2.1.0
VersionCtl/git/magit/2.8.0
VersionCtl/git/magit/2.13.1
VersionCtl/git/magit/v3.2.1
VersionCtl/git/magit/v3.3.0
VersionCtl/git/subversion からの移行
VersionCtl/git/subversion とのコマンド対比
VersionCtl/git/tig
VersionCtl/git/統計
VersionCtl/hg
VersionCtl/Mercurial
VersionCtl/repo
VersionCtl/Subversion
WikiEngines
WikiName
WikiWikiWeb
Windows
Windows/cmd
X
X/DisplayManager
X/DisplayManager/gdm3
X/DisplayManager/lightdm
X/font
X/font/old
X/GNOME3
X/input
X/input/OnScreenKeyboard
X/input/キーアサインを変更する
X/input/グラゴル文字
X/input/日本語
X/input/日本語/ATOK X3
X/input/日本語/ibus
X/input/日本語/uim
X/KDE
X/remote
X/screensaver
X/terminal
X/terminal/mlterm
X/terminal/urxvt
X/terminal/uxterm
X/vnc
X/vnc/tigervnc
X/WindowManager
X/WindowManager/9wm
X/WindowManager/amiwm
X/WindowManager/awesome
X/WindowManager/CDE
X/WindowManager/cinnamon
X/WindowManager/dwm
X/WindowManager/flwm
X/WindowManager/i3
X/WindowManager/jwm
X/WindowManager/matchbox
X/WindowManager/MATE
X/WindowManager/mlvwm
X/WindowManager/qvwm
X/WindowManager/ratpoison
X/WindowManager/ude
X/WindowManager/WindowMaker
X/WindowManager/xfce4
X/xdotool
X/Xnest
X/xrdp
X/xvfb
YukiWiki
スタジオ・ホール
旅
旅/Czech
旅/三重
旅/京都・滋賀
旅/兵庫
旅/千葉
旅/各務
旅/和歌山
旅/埼玉
旅/山形
旅/岐阜
旅/岡山
旅/岩手
旅/島根
旅/愛媛
旅/新潟
旅/東京
旅/栃木
旅/神奈川
旅/秋田
旅/群馬
旅/茨城
旅/長野・山梨
旅/静岡
旅/静岡/伊豆
未整理
食
食/チェコ
食/各国
食/料理
食/激辛
食/蕎麦
食/郷土料理
#topicpath /////////////////////////////////////////////////////////////////////////////// * 目次 [#ye0653a6] #contents(); /////////////////////////////////////////////////////////////////////////////// * cscope [#u92561d9] - debian では、 cscope は cscope パッケージに入っている - ソースコードは Linux ディストリビューションなどが配布しているもの、若しくは開発元の git repository から取得出来る -- git repository git://git.code.sf.net/p/cscope/cscope https://git.code.sf.net/p/cscope/cscope https://github.com/welash/cscope.git -- debian $ apt-get source cscope //============================================================================== ** tag の生成 [#se927a08] - コンソールから $ cscope-indexer -r - cscope-indexer のオプション |~option |~description | |-f <database-file> |出力先データベースのファイル名を指定する(default: cscope.out)| |-i <list-file> |リストファイル(ファイルのインデックスを記録したファイル)の名前を指定する(default: cscope.files)| |-l |データベースファイルの生成・更新を抑制する。&br;但し、リストファイルが生成済みであること | |-r |再帰的にディレクトリを走査する。&br;このオプションがない場合、走査対象はカレントディレクトリに限定される。| |-v |冗長モード | //============================================================================== ** cscope で SymLink になっているファイルを扱えるようにする(要コード修正・ビルド) [#q38ed002] - ソースコード・ヘッダが SymLink になっている場合、cscope では正しく DB 化出来ない。これは、cscope が DB 作成処理の際、 SymLink を対象外とするように動作する為である。 - 事前準備として、以下が必要となる gcc bison flex libncurses5 - SymLink も DB 化の対象にしたい場合は、ソースを取ってきて、以下のように修正する。 + cscsope の修正 ++ README.git の記述に従って autoconf を実行する $ autoreconf -i -s ++ 生成された config.h.in を編集 /* Define to 1 if you have the `lstat' function. */ #undef HAVE_LSTAT // この行を /* */ でコメントアウトする ++ configure を実行 $ ./configure ++ global.h を修正 /* This can happen on only vaguely Unix-ish platforms... */ #ifndef HAVE_LSTAT #include <sys/stat.h> # この include文が足りてないので追加する。 # define lstat(file,buf) stat(file,buf) #endif ++ ビルドする $ make + cscope-indexer の修正 -- 修正前 find $DIR \( -type f -o -type l \) -- 修正後 if [ "X$EXCLUDE" = "X" ] then find -L $DIR \( -xtype f -o -xtype l \) else find -L $DIR \( -xtype f -o -xtype l \) | grep -v $EXCLUDE fi --- cscsope, cscope-indexer をパスの通った所へ配置する。 --- パッケージをインストールしている場合は、念の為削除するか、自前の cscope, cscope-indexer が優先されるよう、環境変数 PATH を調整する。 //============================================================================== ** xcscope.el [#oe856328] - cscope を emacs で使用するのに xcscope.el を使う。そのために cscope-el パッケージを導入する - emacs起動時に問題がなくても xcscope.el が正しく動作しない時は、''cscope-minor-mode'' に正しく入れていない可能性がある。その場合には (setq c++-mode-hook '(lambda () (setq cscope-minor-mode t) )) のように ${HOME}/.emacs などの適切な初期設定ファイルに記述しておく。 - xcscope.el では、タグファイルを生成してあっても、リストを表示させるたびに grep が走る。そのため表示は速くない。速度が問題になる場合は、xcscope.el ではなく [[ascope>#ascope]] の使用を検討する余地がある。 - emacs 上の xcscope.el から tag ファイルを生成する C-c s L //------------------------------------------------------------------------------ *** シンボルを探す [#f5de474a] |~key |~description |~remark | |C-c s s |シンボルを指定して探す(定義・呼び出し箇所等の一覧をリストアップする)| | |C-c s C |指定したシンボルの呼び出し箇所をリストアップ | | |C-c s G |指定したシンボルの定義(宣言ではなく)、またはそれに関する定義をリストアップする | | |C-c s n |次のシンボルへ Jump | | |C-c s p |前のシンボルへ Jump | | |C-c s t |テキストを検索 |symbol や定義意外のテキスト全般はこれで検索する | |C-c s f |ファイルを検索 |1つだけ見つかればそれを自動的に開く | |C-c s i |そのファイルを include している include 文を検索 | | //------------------------------------------------------------------------------ *** xcscope のキーバインド一覧(xcscope.el ver.1.0) [#gb6bc7b4] ;; * Keybindings: ;; ;; All keybindings use the "C-c s" prefix, but are usable only while ;; editing a source file, or in the cscope results buffer: ;; ;; C-c s s Find symbol. ;; C-c s = Find assignments to this symbol ;; C-c s d Find global definition. ;; C-c s g Find global definition (alternate binding). ;; C-c s G Find global definition without prompting. ;; C-c s c Find functions calling a function. ;; C-c s C Find called functions (list functions called ;; from a function). ;; C-c s t Find text string. ;; C-c s e Find egrep pattern. ;; C-c s f Find a file. ;; C-c s i Find files #including a file. ;; ;; These pertain to navigation through the search results: ;; ;; C-c s b Display *cscope* buffer. ;; C-c s B Auto display *cscope* buffer toggle. ;; C-c s n Next symbol. ;; C-c s N Next file. ;; C-c s p Previous symbol. ;; C-c s P Previous file. ;; C-c s u Pop mark. ;; ;; These pertain to setting and unsetting the variable, ;; `cscope-initial-directory', (location searched for the cscope database ;; directory): ;; ;; C-c s a Set initial directory. ;; C-c s A Unset initial directory. ;; ;; These pertain to cscope database maintenance: ;; ;; C-c s L Create list of files to index. ;; C-c s I Create list and index. ;; C-c s E Edit list of files to index. ;; C-c s W Locate this buffer's cscope directory ;; ("W" --> "where"). ;; C-c s S Locate this buffer's cscope directory. ;; (alternate binding: "S" --> "show"). ;; C-c s T Locate this buffer's cscope directory. ;; (alternate binding: "T" --> "tell"). ;; C-c s D Dired this buffer's directory. ;; //------------------------------------------------------------------------------ *** xcscope のキーバインドが正しく動作しない場合 [#aa1fc78a] - xcscope.el を組み込んだ後、 C-c s と打っても C-c s is undefined とメッセージが出て動作しない場合は、xcscope.el が提供するマイナーモードに入れていない可能性がある。~ その場合は、c-mode-hook, c++-mode-hook に引っ掛けて ''cscope-minor-mode'' を呼び出すようにすると良い。 ; c-mode での設定 (setq c-mode-hook '(lambda () (cscope-minor-mode) )) ; c++-mode でも同様に... (setq c++-mode-hook '(lambda () (cscope-minor-mode) )) //------------------------------------------------------------------------------ *** 参考リンク [#fa5e1efc] - [[cscope Home Page>http://cscope.sourceforge.net/]] - [[Emacsからcscopeソースコードナビゲータを使ってみよう>http://prog.quarklink.org/linux/xcscope/]] - [[[Emacs] id-utils と cscope 導入してみた>http://d.hatena.ne.jp/khiker/20071018/cscope]] //============================================================================== ** acscope.el [#ub6ff3d4] - ascope.el は cscope の emacs 用 I/F の一つ。 - [[xcscope.el>#cscope]] と比べて -- 機能は少ない -- xcscope.el と違って毎回検索を行わない分、 --- 結果表示までの時間は早い --- 対象のソースコードに変更があった場合、検索結果に正しく反映されない場合がある - debian では、 cscope は cscope パッケージに入っている - この他、 emacs で使用するのに acscope.el を使う。debian8 にはパッケージはない。 //------------------------------------------------------------------------------ *** 導入 [#q2a6c78b] - debian8 のようにディストリビューションからパッケージが提供されていない場合は、[[GitHub>https://github.com/ameyp/ascope/blob/master/ascope.el]] または [[EmacsWiki>https://www.emacswiki.org/emacs/ascope.el]] などから Download して組み込む。~ 但し [[EmacsWiki>https://www.emacswiki.org/emacs/ascope.el]] に掲載されているものは、 GitHub の最新版より大分古いようなので注意が必要。 -- GitHub から取得する場合 $ git clone https://github.com/ameyp/ascope - キーバインドを設定する -- ascope.el ではキーバインドが設定されてない一方、関数名が xcscope.el と同じなので、xcscope.el から流用して設定する。~ #ただ、xcscope.el にあって ascope.el にないものが多い。 (setq load-path (cons (expand-file-name "~/.emacs.d/site-lisp/ascope") load-path)) (load-library "~/.emacs.d/site-lisp/ascope/ascope.el") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Original is from xcscope.el (defvar cscope-minor-mode-keymap (let ((map (make-sparse-keymap))) ;; xemacs has various issues with (cscope-mouse-popup-menu-or-search), so I ;; don't use that function for xemacs. Its popup menu support won't be as ;; good (cscope will still prompt for the search term) ;(if cscope-running-in-xemacs ; (progn ; (define-key map [(shift button3)] 'cscope-mouse-search-again)) ; (define-key map [mouse-3] 'cscope-mouse-popup-menu-or-search) ; (define-key map [S-mouse-3] 'cscope-mouse-search-again)) ;; The following line corresponds to be beginning of the "Cscope" menu. (define-key map "\C-css" 'cscope-find-this-symbol) (define-key map "\C-csd" 'cscope-find-global-definition) (define-key map "\C-csg" 'cscope-find-global-definition) ; (define-key map "\C-csG" 'cscope-find-global-definition-no-prompting) ; (define-key map "\C-cs=" 'cscope-find-assignments-to-this-symbol) (define-key map "\C-csc" 'cscope-find-functions-calling-this-function) (define-key map "\C-csC" 'cscope-find-called-functions) (define-key map "\C-cst" 'cscope-find-this-text-string) ; (define-key map "\C-cse" 'cscope-find-egrep-pattern) (define-key map "\C-csf" 'cscope-find-this-file) (define-key map "\C-csi" 'cscope-find-files-including-file) ;; --- (The '---' indicates that this line corresponds to a menu separator.) ; (define-key map "\C-csb" 'cscope-display-buffer) ; (define-key map "\C-csB" 'cscope-display-buffer-toggle) ; (define-key map "\C-csn" 'cscope-history-forward-line-current-result) ; (define-key map "\C-csN" 'cscope-history-forward-file-current-result) ; (define-key map "\C-csp" 'cscope-history-backward-line-current-result) ; (define-key map "\C-csP" 'cscope-history-backward-file-current-result) ; (define-key map "\C-csu" 'cscope-pop-mark) ;; --- ; (define-key map "\C-csa" 'cscope-set-initial-directory) ; (define-key map "\C-csA" 'cscope-unset-initial-directory) ;; --- ; (define-key map "\C-csL" 'cscope-create-list-of-files-to-index) ; (define-key map "\C-csI" 'cscope-index-files) ; (define-key map "\C-csE" 'cscope-edit-list-of-files-to-index) ; (define-key map "\C-csW" 'cscope-tell-user-about-directory) ; (define-key map "\C-csS" 'cscope-tell-user-about-directory) ; (define-key map "\C-csT" 'cscope-tell-user-about-directory) ; (define-key map "\C-csD" 'cscope-dired-directory) ;; The previous line corresponds to be end of the "Cscope" menu. ;; (START Add) -------------------------------------- ;; ここは xcscope.el にないものを追加 (define-key map "\C-csa" 'cscope-setup) ;; (END Add) -------------------------------------- map) "The global cscope keymap") (require 'ascope) //------------------------------------------------------------------------------ *** tagの生成 [#l1f49acc] - emacs 上のインターフェースが異なるのみで、cscope を使うという意味では [[xcscope.el>#xcscope]]と変わりない。&br; tag の生成については [[tag の生成(xcscope.el)>#cscope-indexer]] を参照のこと。 //------------------------------------------------------------------------------ *** 参考リンク [#ub3f4202] - [[Erlcscope and ascope.el>http://masayuki038.github.io/blog/2013/09/23/erlcscope-and-ascope-el/]] - [[ascope.el@github>https://github.com/ameyp/ascope/blob/master/ascope.el]] - [[EmacsWiki>https://www.emacswiki.org/emacs/ascope.el]] //============================================================================== ** ソースからのビルド [#n9346135] //------------------------------------------------------------------------------ *** ビルドに必要なパッケージ [#n755baaf] autoconf gcc make yacc flex - ※ yacc は、Debian では上位互換である bison パッケージに含まれる //------------------------------------------------------------------------------ *** ソース取得元 [#ue1ebbca] -- https://git.code.sf.net/p/cscope/cscope.git //------------------------------------------------------------------------------ *** ビルド方法 [#za061870] -- EADME.git を参照 - ビルド手順 $ autoreconf -i -s $ ./configure $ make src/cscope が出来ていれば成功。 //============================================================================== ** 参考リンク [#links] - [[Cscope Home Page>https://cscope.sourceforge.net/]] --- cscope 開発元 - [[CscopeとSilentBobによるソースコードの解析>https://mag.osdn.jp/07/03/13/0115244]] - [[Using Cscope on large projects (example: the Linux kernel)>http://cscope.sourceforge.net/large_projects.html]]
#topicpath /////////////////////////////////////////////////////////////////////////////// * 目次 [#ye0653a6] #contents(); /////////////////////////////////////////////////////////////////////////////// * cscope [#u92561d9] - debian では、 cscope は cscope パッケージに入っている - ソースコードは Linux ディストリビューションなどが配布しているもの、若しくは開発元の git repository から取得出来る -- git repository git://git.code.sf.net/p/cscope/cscope https://git.code.sf.net/p/cscope/cscope https://github.com/welash/cscope.git -- debian $ apt-get source cscope //============================================================================== ** tag の生成 [#se927a08] - コンソールから $ cscope-indexer -r - cscope-indexer のオプション |~option |~description | |-f <database-file> |出力先データベースのファイル名を指定する(default: cscope.out)| |-i <list-file> |リストファイル(ファイルのインデックスを記録したファイル)の名前を指定する(default: cscope.files)| |-l |データベースファイルの生成・更新を抑制する。&br;但し、リストファイルが生成済みであること | |-r |再帰的にディレクトリを走査する。&br;このオプションがない場合、走査対象はカレントディレクトリに限定される。| |-v |冗長モード | //============================================================================== ** cscope で SymLink になっているファイルを扱えるようにする(要コード修正・ビルド) [#q38ed002] - ソースコード・ヘッダが SymLink になっている場合、cscope では正しく DB 化出来ない。これは、cscope が DB 作成処理の際、 SymLink を対象外とするように動作する為である。 - 事前準備として、以下が必要となる gcc bison flex libncurses5 - SymLink も DB 化の対象にしたい場合は、ソースを取ってきて、以下のように修正する。 + cscsope の修正 ++ README.git の記述に従って autoconf を実行する $ autoreconf -i -s ++ 生成された config.h.in を編集 /* Define to 1 if you have the `lstat' function. */ #undef HAVE_LSTAT // この行を /* */ でコメントアウトする ++ configure を実行 $ ./configure ++ global.h を修正 /* This can happen on only vaguely Unix-ish platforms... */ #ifndef HAVE_LSTAT #include <sys/stat.h> # この include文が足りてないので追加する。 # define lstat(file,buf) stat(file,buf) #endif ++ ビルドする $ make + cscope-indexer の修正 -- 修正前 find $DIR \( -type f -o -type l \) -- 修正後 if [ "X$EXCLUDE" = "X" ] then find -L $DIR \( -xtype f -o -xtype l \) else find -L $DIR \( -xtype f -o -xtype l \) | grep -v $EXCLUDE fi --- cscsope, cscope-indexer をパスの通った所へ配置する。 --- パッケージをインストールしている場合は、念の為削除するか、自前の cscope, cscope-indexer が優先されるよう、環境変数 PATH を調整する。 //============================================================================== ** xcscope.el [#oe856328] - cscope を emacs で使用するのに xcscope.el を使う。そのために cscope-el パッケージを導入する - emacs起動時に問題がなくても xcscope.el が正しく動作しない時は、''cscope-minor-mode'' に正しく入れていない可能性がある。その場合には (setq c++-mode-hook '(lambda () (setq cscope-minor-mode t) )) のように ${HOME}/.emacs などの適切な初期設定ファイルに記述しておく。 - xcscope.el では、タグファイルを生成してあっても、リストを表示させるたびに grep が走る。そのため表示は速くない。速度が問題になる場合は、xcscope.el ではなく [[ascope>#ascope]] の使用を検討する余地がある。 - emacs 上の xcscope.el から tag ファイルを生成する C-c s L //------------------------------------------------------------------------------ *** シンボルを探す [#f5de474a] |~key |~description |~remark | |C-c s s |シンボルを指定して探す(定義・呼び出し箇所等の一覧をリストアップする)| | |C-c s C |指定したシンボルの呼び出し箇所をリストアップ | | |C-c s G |指定したシンボルの定義(宣言ではなく)、またはそれに関する定義をリストアップする | | |C-c s n |次のシンボルへ Jump | | |C-c s p |前のシンボルへ Jump | | |C-c s t |テキストを検索 |symbol や定義意外のテキスト全般はこれで検索する | |C-c s f |ファイルを検索 |1つだけ見つかればそれを自動的に開く | |C-c s i |そのファイルを include している include 文を検索 | | //------------------------------------------------------------------------------ *** xcscope のキーバインド一覧(xcscope.el ver.1.0) [#gb6bc7b4] ;; * Keybindings: ;; ;; All keybindings use the "C-c s" prefix, but are usable only while ;; editing a source file, or in the cscope results buffer: ;; ;; C-c s s Find symbol. ;; C-c s = Find assignments to this symbol ;; C-c s d Find global definition. ;; C-c s g Find global definition (alternate binding). ;; C-c s G Find global definition without prompting. ;; C-c s c Find functions calling a function. ;; C-c s C Find called functions (list functions called ;; from a function). ;; C-c s t Find text string. ;; C-c s e Find egrep pattern. ;; C-c s f Find a file. ;; C-c s i Find files #including a file. ;; ;; These pertain to navigation through the search results: ;; ;; C-c s b Display *cscope* buffer. ;; C-c s B Auto display *cscope* buffer toggle. ;; C-c s n Next symbol. ;; C-c s N Next file. ;; C-c s p Previous symbol. ;; C-c s P Previous file. ;; C-c s u Pop mark. ;; ;; These pertain to setting and unsetting the variable, ;; `cscope-initial-directory', (location searched for the cscope database ;; directory): ;; ;; C-c s a Set initial directory. ;; C-c s A Unset initial directory. ;; ;; These pertain to cscope database maintenance: ;; ;; C-c s L Create list of files to index. ;; C-c s I Create list and index. ;; C-c s E Edit list of files to index. ;; C-c s W Locate this buffer's cscope directory ;; ("W" --> "where"). ;; C-c s S Locate this buffer's cscope directory. ;; (alternate binding: "S" --> "show"). ;; C-c s T Locate this buffer's cscope directory. ;; (alternate binding: "T" --> "tell"). ;; C-c s D Dired this buffer's directory. ;; //------------------------------------------------------------------------------ *** xcscope のキーバインドが正しく動作しない場合 [#aa1fc78a] - xcscope.el を組み込んだ後、 C-c s と打っても C-c s is undefined とメッセージが出て動作しない場合は、xcscope.el が提供するマイナーモードに入れていない可能性がある。~ その場合は、c-mode-hook, c++-mode-hook に引っ掛けて ''cscope-minor-mode'' を呼び出すようにすると良い。 ; c-mode での設定 (setq c-mode-hook '(lambda () (cscope-minor-mode) )) ; c++-mode でも同様に... (setq c++-mode-hook '(lambda () (cscope-minor-mode) )) //------------------------------------------------------------------------------ *** 参考リンク [#fa5e1efc] - [[cscope Home Page>http://cscope.sourceforge.net/]] - [[Emacsからcscopeソースコードナビゲータを使ってみよう>http://prog.quarklink.org/linux/xcscope/]] - [[[Emacs] id-utils と cscope 導入してみた>http://d.hatena.ne.jp/khiker/20071018/cscope]] //============================================================================== ** acscope.el [#ub6ff3d4] - ascope.el は cscope の emacs 用 I/F の一つ。 - [[xcscope.el>#cscope]] と比べて -- 機能は少ない -- xcscope.el と違って毎回検索を行わない分、 --- 結果表示までの時間は早い --- 対象のソースコードに変更があった場合、検索結果に正しく反映されない場合がある - debian では、 cscope は cscope パッケージに入っている - この他、 emacs で使用するのに acscope.el を使う。debian8 にはパッケージはない。 //------------------------------------------------------------------------------ *** 導入 [#q2a6c78b] - debian8 のようにディストリビューションからパッケージが提供されていない場合は、[[GitHub>https://github.com/ameyp/ascope/blob/master/ascope.el]] または [[EmacsWiki>https://www.emacswiki.org/emacs/ascope.el]] などから Download して組み込む。~ 但し [[EmacsWiki>https://www.emacswiki.org/emacs/ascope.el]] に掲載されているものは、 GitHub の最新版より大分古いようなので注意が必要。 -- GitHub から取得する場合 $ git clone https://github.com/ameyp/ascope - キーバインドを設定する -- ascope.el ではキーバインドが設定されてない一方、関数名が xcscope.el と同じなので、xcscope.el から流用して設定する。~ #ただ、xcscope.el にあって ascope.el にないものが多い。 (setq load-path (cons (expand-file-name "~/.emacs.d/site-lisp/ascope") load-path)) (load-library "~/.emacs.d/site-lisp/ascope/ascope.el") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Original is from xcscope.el (defvar cscope-minor-mode-keymap (let ((map (make-sparse-keymap))) ;; xemacs has various issues with (cscope-mouse-popup-menu-or-search), so I ;; don't use that function for xemacs. Its popup menu support won't be as ;; good (cscope will still prompt for the search term) ;(if cscope-running-in-xemacs ; (progn ; (define-key map [(shift button3)] 'cscope-mouse-search-again)) ; (define-key map [mouse-3] 'cscope-mouse-popup-menu-or-search) ; (define-key map [S-mouse-3] 'cscope-mouse-search-again)) ;; The following line corresponds to be beginning of the "Cscope" menu. (define-key map "\C-css" 'cscope-find-this-symbol) (define-key map "\C-csd" 'cscope-find-global-definition) (define-key map "\C-csg" 'cscope-find-global-definition) ; (define-key map "\C-csG" 'cscope-find-global-definition-no-prompting) ; (define-key map "\C-cs=" 'cscope-find-assignments-to-this-symbol) (define-key map "\C-csc" 'cscope-find-functions-calling-this-function) (define-key map "\C-csC" 'cscope-find-called-functions) (define-key map "\C-cst" 'cscope-find-this-text-string) ; (define-key map "\C-cse" 'cscope-find-egrep-pattern) (define-key map "\C-csf" 'cscope-find-this-file) (define-key map "\C-csi" 'cscope-find-files-including-file) ;; --- (The '---' indicates that this line corresponds to a menu separator.) ; (define-key map "\C-csb" 'cscope-display-buffer) ; (define-key map "\C-csB" 'cscope-display-buffer-toggle) ; (define-key map "\C-csn" 'cscope-history-forward-line-current-result) ; (define-key map "\C-csN" 'cscope-history-forward-file-current-result) ; (define-key map "\C-csp" 'cscope-history-backward-line-current-result) ; (define-key map "\C-csP" 'cscope-history-backward-file-current-result) ; (define-key map "\C-csu" 'cscope-pop-mark) ;; --- ; (define-key map "\C-csa" 'cscope-set-initial-directory) ; (define-key map "\C-csA" 'cscope-unset-initial-directory) ;; --- ; (define-key map "\C-csL" 'cscope-create-list-of-files-to-index) ; (define-key map "\C-csI" 'cscope-index-files) ; (define-key map "\C-csE" 'cscope-edit-list-of-files-to-index) ; (define-key map "\C-csW" 'cscope-tell-user-about-directory) ; (define-key map "\C-csS" 'cscope-tell-user-about-directory) ; (define-key map "\C-csT" 'cscope-tell-user-about-directory) ; (define-key map "\C-csD" 'cscope-dired-directory) ;; The previous line corresponds to be end of the "Cscope" menu. ;; (START Add) -------------------------------------- ;; ここは xcscope.el にないものを追加 (define-key map "\C-csa" 'cscope-setup) ;; (END Add) -------------------------------------- map) "The global cscope keymap") (require 'ascope) //------------------------------------------------------------------------------ *** tagの生成 [#l1f49acc] - emacs 上のインターフェースが異なるのみで、cscope を使うという意味では [[xcscope.el>#xcscope]]と変わりない。&br; tag の生成については [[tag の生成(xcscope.el)>#cscope-indexer]] を参照のこと。 //------------------------------------------------------------------------------ *** 参考リンク [#ub3f4202] - [[Erlcscope and ascope.el>http://masayuki038.github.io/blog/2013/09/23/erlcscope-and-ascope-el/]] - [[ascope.el@github>https://github.com/ameyp/ascope/blob/master/ascope.el]] - [[EmacsWiki>https://www.emacswiki.org/emacs/ascope.el]] //============================================================================== ** ソースからのビルド [#n9346135] //------------------------------------------------------------------------------ *** ビルドに必要なパッケージ [#n755baaf] autoconf gcc make yacc flex - ※ yacc は、Debian では上位互換である bison パッケージに含まれる //------------------------------------------------------------------------------ *** ソース取得元 [#ue1ebbca] -- https://git.code.sf.net/p/cscope/cscope.git //------------------------------------------------------------------------------ *** ビルド方法 [#za061870] -- EADME.git を参照 - ビルド手順 $ autoreconf -i -s $ ./configure $ make src/cscope が出来ていれば成功。 //============================================================================== ** 参考リンク [#links] - [[Cscope Home Page>https://cscope.sourceforge.net/]] --- cscope 開発元 - [[CscopeとSilentBobによるソースコードの解析>https://mag.osdn.jp/07/03/13/0115244]] - [[Using Cscope on large projects (example: the Linux kernel)>http://cscope.sourceforge.net/large_projects.html]]
テキスト整形のルールを表示する