Prog/TagSystem/cscope
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#topicpath
/////////////////////////////////////////////////////////...
* 目次 [#ye0653a6]
#contents();
/////////////////////////////////////////////////////////...
* cscope [#u92561d9]
- debian では、 cscope は cscope パッケージに入っている
- ソースコードは Linux ディストリビューションなどが配布し...
-- 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> |出力先データベースのファイル名を指定...
|-i <list-file> |リストファイル(ファイルのインデックスを...
|-l |データベースファイルの生成・更新を抑制する。&br;但し...
|-r |再帰的にディレクトリを走査する。&br;このオプションが...
|-v |冗長モード |
//=======================================================...
** cscope で SymLink になっているファイルを扱えるようにす...
- ソースコード・ヘッダが SymLink になっている場合、cscope...
- 事前準備として、以下が必要となる
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 -...
fi
--- cscsope, cscope-indexer をパスの通った所へ配置する。
--- パッケージをインストールしている場合は、念の為削除す...
//=======================================================...
** xcscope.el [#oe856328]
- cscope を emacs で使用するのに xcscope.el を使う。その...
- emacs起動時に問題がなくても xcscope.el が正しく動作しな...
(setq c++-mode-hook
'(lambda ()
(setq cscope-minor-mode t)
))
のように ${HOME}/.emacs などの適切な初期設定ファイルに記...
- xcscope.el では、タグファイルを生成してあっても、リスト...
- 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) [#gb6b...
;; * Keybindings:
;;
;; All keybindings use the "C-c s" prefix, but are usabl...
;; 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 (alternat...
;; C-c s G Find global definition without p...
;; C-c s c Find functions calling a function.
;; C-c s C Find called functions (list func...
;; 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 tog...
;; 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 th...
;; 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 dire...
;; ("W" --> "where").
;; C-c s S Locate this buffer's cscope dire...
;; (alternate binding: "S" --> "sho...
;; C-c s T Locate this buffer's cscope dire...
;; (alternate binding: "T" --> "tel...
;; C-c s D Dired this buffer's directory.
;;
//-------------------------------------------------------...
*** xcscope のキーバインドが正しく動作しない場合 [#aa1fc7...
- xcscope.el を組み込んだ後、
C-c s
と打っても
C-c s is undefined
とメッセージが出て動作しない場合は、xcscope.el が提供する...
その場合は、c-mode-hook, c++-mode-hook に引っ掛けて ''csc...
; 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ソースコードナビゲータを使ってみよう>h...
- [[[Emacs] id-utils と cscope 導入してみた>http://d.hate...
//=======================================================...
** acscope.el [#ub6ff3d4]
- ascope.el は cscope の emacs 用 I/F の一つ。
- [[xcscope.el>#cscope]] と比べて
-- 機能は少ない
-- xcscope.el と違って毎回検索を行わない分、
--- 結果表示までの時間は早い
--- 対象のソースコードに変更があった場合、検索結果に正し...
- debian では、 cscope は cscope パッケージに入っている
- この他、 emacs で使用するのに acscope.el を使う。debian...
//-------------------------------------------------------...
*** 導入 [#q2a6c78b]
- debian8 のようにディストリビューションからパッケージが...
但し [[EmacsWiki>https://www.emacswiki.org/emacs/ascope.e...
-- GitHub から取得する場合
$ git clone https://github.com/ameyp/ascope
- キーバインドを設定する
-- ascope.el ではキーバインドが設定されてない一方、関数名...
#ただ、xcscope.el にあって ascope.el にないものが多い。
(setq load-path (cons (expand-file-name "~/.emacs.d/site...
(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-popu...
;; don't use that function for xemacs. Its popup men...
;; good (cscope will still prompt for the search term)
;(if cscope-running-in-xemacs
; (progn
; (define-key map [(shift button3)] 'cscope-mou...
; (define-key map [mouse-3] 'cscope-mouse-popup-m...
; (define-key map [S-mouse-3] 'cscope-mouse-search-...
;; The following line corresponds to be beginning of...
(define-key map "\C-css" 'cscope-find-this-symbol)
(define-key map "\C-csd" 'cscope-find-global-definit...
(define-key map "\C-csg" 'cscope-find-global-definit...
; (define-key map "\C-csG" 'cscope-find-global-defin...
; (define-key map "\C-cs=" 'cscope-find-assignments-...
(define-key map "\C-csc" 'cscope-find-functions-call...
(define-key map "\C-csC" 'cscope-find-called-functio...
(define-key map "\C-cst" 'cscope-find-this-text-stri...
; (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-includin...
;; --- (The '---' indicates that this line correspon...
; (define-key map "\C-csb" 'cscope-display-buffer)
; (define-key map "\C-csB" 'cscope-display-buffer-to...
; (define-key map "\C-csn" 'cscope-history-forward-l...
; (define-key map "\C-csN" 'cscope-history-forward-f...
; (define-key map "\C-csp" 'cscope-history-backward-...
; (define-key map "\C-csP" 'cscope-history-backward-...
; (define-key map "\C-csu" 'cscope-pop-mark)
;; ---
; (define-key map "\C-csa" 'cscope-set-initial-direc...
; (define-key map "\C-csA" 'cscope-unset-initial-dir...
;; ---
; (define-key map "\C-csL" 'cscope-create-list-of-fi...
; (define-key map "\C-csI" 'cscope-index-files)
; (define-key map "\C-csE" 'cscope-edit-list-of-file...
; (define-key map "\C-csW" 'cscope-tell-user-about-d...
; (define-key map "\C-csS" 'cscope-tell-user-about-d...
; (define-key map "\C-csT" 'cscope-tell-user-about-d...
; (define-key map "\C-csD" 'cscope-dired-directory)
;; The previous line corresponds to be end of the "C...
;; (START Add) --------------------------------------
;; ここは xcscope.el にないものを追加
(define-key map "\C-csa" 'cscope-setup)
;; (END Add) --------------------------------------
map)
"The global cscope keymap")
(require 'ascope)
//-------------------------------------------------------...
*** tagの生成 [#l1f49acc]
- emacs 上のインターフェースが異なるのみで、cscope を使う...
tag の生成については [[tag の生成(xcscope.el)>#cscope-ind...
//-------------------------------------------------------...
*** 参考リンク [#ub3f4202]
- [[Erlcscope and ascope.el>http://masayuki038.github.io/...
- [[ascope.el@github>https://github.com/ameyp/ascope/blob...
- [[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とSilentBobによるソースコードの解析>https://mag...
- [[Using Cscope on large projects (example: the Linux ke...
終了行:
#topicpath
/////////////////////////////////////////////////////////...
* 目次 [#ye0653a6]
#contents();
/////////////////////////////////////////////////////////...
* cscope [#u92561d9]
- debian では、 cscope は cscope パッケージに入っている
- ソースコードは Linux ディストリビューションなどが配布し...
-- 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> |出力先データベースのファイル名を指定...
|-i <list-file> |リストファイル(ファイルのインデックスを...
|-l |データベースファイルの生成・更新を抑制する。&br;但し...
|-r |再帰的にディレクトリを走査する。&br;このオプションが...
|-v |冗長モード |
//=======================================================...
** cscope で SymLink になっているファイルを扱えるようにす...
- ソースコード・ヘッダが SymLink になっている場合、cscope...
- 事前準備として、以下が必要となる
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 -...
fi
--- cscsope, cscope-indexer をパスの通った所へ配置する。
--- パッケージをインストールしている場合は、念の為削除す...
//=======================================================...
** xcscope.el [#oe856328]
- cscope を emacs で使用するのに xcscope.el を使う。その...
- emacs起動時に問題がなくても xcscope.el が正しく動作しな...
(setq c++-mode-hook
'(lambda ()
(setq cscope-minor-mode t)
))
のように ${HOME}/.emacs などの適切な初期設定ファイルに記...
- xcscope.el では、タグファイルを生成してあっても、リスト...
- 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) [#gb6b...
;; * Keybindings:
;;
;; All keybindings use the "C-c s" prefix, but are usabl...
;; 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 (alternat...
;; C-c s G Find global definition without p...
;; C-c s c Find functions calling a function.
;; C-c s C Find called functions (list func...
;; 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 tog...
;; 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 th...
;; 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 dire...
;; ("W" --> "where").
;; C-c s S Locate this buffer's cscope dire...
;; (alternate binding: "S" --> "sho...
;; C-c s T Locate this buffer's cscope dire...
;; (alternate binding: "T" --> "tel...
;; C-c s D Dired this buffer's directory.
;;
//-------------------------------------------------------...
*** xcscope のキーバインドが正しく動作しない場合 [#aa1fc7...
- xcscope.el を組み込んだ後、
C-c s
と打っても
C-c s is undefined
とメッセージが出て動作しない場合は、xcscope.el が提供する...
その場合は、c-mode-hook, c++-mode-hook に引っ掛けて ''csc...
; 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ソースコードナビゲータを使ってみよう>h...
- [[[Emacs] id-utils と cscope 導入してみた>http://d.hate...
//=======================================================...
** acscope.el [#ub6ff3d4]
- ascope.el は cscope の emacs 用 I/F の一つ。
- [[xcscope.el>#cscope]] と比べて
-- 機能は少ない
-- xcscope.el と違って毎回検索を行わない分、
--- 結果表示までの時間は早い
--- 対象のソースコードに変更があった場合、検索結果に正し...
- debian では、 cscope は cscope パッケージに入っている
- この他、 emacs で使用するのに acscope.el を使う。debian...
//-------------------------------------------------------...
*** 導入 [#q2a6c78b]
- debian8 のようにディストリビューションからパッケージが...
但し [[EmacsWiki>https://www.emacswiki.org/emacs/ascope.e...
-- GitHub から取得する場合
$ git clone https://github.com/ameyp/ascope
- キーバインドを設定する
-- ascope.el ではキーバインドが設定されてない一方、関数名...
#ただ、xcscope.el にあって ascope.el にないものが多い。
(setq load-path (cons (expand-file-name "~/.emacs.d/site...
(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-popu...
;; don't use that function for xemacs. Its popup men...
;; good (cscope will still prompt for the search term)
;(if cscope-running-in-xemacs
; (progn
; (define-key map [(shift button3)] 'cscope-mou...
; (define-key map [mouse-3] 'cscope-mouse-popup-m...
; (define-key map [S-mouse-3] 'cscope-mouse-search-...
;; The following line corresponds to be beginning of...
(define-key map "\C-css" 'cscope-find-this-symbol)
(define-key map "\C-csd" 'cscope-find-global-definit...
(define-key map "\C-csg" 'cscope-find-global-definit...
; (define-key map "\C-csG" 'cscope-find-global-defin...
; (define-key map "\C-cs=" 'cscope-find-assignments-...
(define-key map "\C-csc" 'cscope-find-functions-call...
(define-key map "\C-csC" 'cscope-find-called-functio...
(define-key map "\C-cst" 'cscope-find-this-text-stri...
; (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-includin...
;; --- (The '---' indicates that this line correspon...
; (define-key map "\C-csb" 'cscope-display-buffer)
; (define-key map "\C-csB" 'cscope-display-buffer-to...
; (define-key map "\C-csn" 'cscope-history-forward-l...
; (define-key map "\C-csN" 'cscope-history-forward-f...
; (define-key map "\C-csp" 'cscope-history-backward-...
; (define-key map "\C-csP" 'cscope-history-backward-...
; (define-key map "\C-csu" 'cscope-pop-mark)
;; ---
; (define-key map "\C-csa" 'cscope-set-initial-direc...
; (define-key map "\C-csA" 'cscope-unset-initial-dir...
;; ---
; (define-key map "\C-csL" 'cscope-create-list-of-fi...
; (define-key map "\C-csI" 'cscope-index-files)
; (define-key map "\C-csE" 'cscope-edit-list-of-file...
; (define-key map "\C-csW" 'cscope-tell-user-about-d...
; (define-key map "\C-csS" 'cscope-tell-user-about-d...
; (define-key map "\C-csT" 'cscope-tell-user-about-d...
; (define-key map "\C-csD" 'cscope-dired-directory)
;; The previous line corresponds to be end of the "C...
;; (START Add) --------------------------------------
;; ここは xcscope.el にないものを追加
(define-key map "\C-csa" 'cscope-setup)
;; (END Add) --------------------------------------
map)
"The global cscope keymap")
(require 'ascope)
//-------------------------------------------------------...
*** tagの生成 [#l1f49acc]
- emacs 上のインターフェースが異なるのみで、cscope を使う...
tag の生成については [[tag の生成(xcscope.el)>#cscope-ind...
//-------------------------------------------------------...
*** 参考リンク [#ub3f4202]
- [[Erlcscope and ascope.el>http://masayuki038.github.io/...
- [[ascope.el@github>https://github.com/ameyp/ascope/blob...
- [[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とSilentBobによるソースコードの解析>https://mag...
- [[Using Cscope on large projects (example: the Linux ke...
ページ名: