顯示具有 cscope 標籤的文章。 顯示所有文章
顯示具有 cscope 標籤的文章。 顯示所有文章

2015年1月26日 星期一

[cscope][vim] vim - Load cscope database


1. Please do reference 1

2. Put cscope_maps.vim under
~/.vim/bundle/multi-cscope-db/plugin

3. Go to the folder of code.
Create cscope.out. Ref [Bash] Create cscope.out and tags by using script

4. Edit source code
vim happy.c
:Loadcs ## Load database (cscope.out)

5. cscope command. Ref [cscope][vim] How to install cscope into vim

Reference:
1. [VIM] How to install vundle by script

2014年11月4日 星期二

[Bash] Create cscope.out and tags by using script

Usage :

Type bash ctags_cscope.sh /home/haha/20141103-11-54/project

This command will create four file like "cscope.in.out  cscope.po.out cscope.out tags" under /home/haha/20141103-11-54/project.

Code :

#!/bin/bash
DATE=`date +%m%d`
PWD=`pwd`
Directory=$1
function ctags_cscope()
{
#  [ Ctrl + \ + s ] : 搜尋游標上的 function 哪邊參考到
#  [ Ctrl + \ + c ] : 搜尋游標上的 function 哪邊呼叫到
#  [ Ctrl + \ + g ] : 搜尋游標上的 function 是在哪邊定義的
#  
#  [ Ctrl + \ + t ] : 跳回下一個位置
#  [ Ctrl + \ + o ] : 跳回上一個位置
    cd $Directory

    CSCOPE_FILE_TEMP=cscope.out
    if [ -n $Directory ]; then
  echo "Source code directory: " $1
        echo "Create file map database : " $CSCOPE_FILE_TEMP
  find $1 -name "*.h" -or -name "*.c" -or -name "*.cpp" -or -name "*.cc" > $CSCOPE_FILE_TEMP
  cscope -bkq -i $CSCOPE_FILE_TEMP
        ctags -R
    else
        echo "Please type path of project"
    fi  }
# Main Code
ctags_cscope

Manual :
cscope -bkqR

2014年10月28日 星期二

[cscope][vim] How to install cscope into vim

1. First Download the code, and write into .vimrc.
2. Reference [VIM] How to install vundle by script
3. Reference 「CSCOPE」 The script of cscope to create cscope.out into project.
4. vim any c code under project, then type LCS to load the cscope.out.

Usage :
:cs help   --  display operation message

Ctrl + \ + c = c: Find functions calling this function
Ctrl + \ + d: Find functions called by this function
Ctrl + \ + e: Find this egrep pattern
Ctrl + \ + f: Find this file
Ctrl + \ + g: Find this definition
Ctrl + \ + i: Find files #including this file
Ctrl + \ + s: Find this C symbol
Ctrl + \ + t: Find assignments to

Reference :
1. [VIM] How to install vundle by script
2.「CSCOPE」 The script of cscope


cscope commands:
add : Add a new database (Usage: add file|dir [pre-path] [flags])
find : Query for a pattern (Usage: find c|d|e|f|g|i|s|t name)
          c: Find functions calling this function
          d: Find functions called by this function
          e: Find this egrep pattern
          f: Find this file
          g: Find this definition
          i: Find files #including this file
          s: Find this C symbol
          t: Find assignments to

help : Show this message (Usage: help)
kill : Kill a connection (Usage: kill #)
reset: Reinit all connections (Usage: reset)
show : Show connections (Usage: show)

2014年1月12日 星期日

「CSCOPE」 The script of cscope

CSCOPE_FILE_TEMP=cscope.out
if [ -n "$1" ]; then
    echo "Source code directory: " $1
    echo "Create file map database : " $CSCOPE_FILE_TEMP
    find $1 -name "*.h" -or -name "*.c" -or -name "*.cpp" -or -name "*.cc" > $CSCOPE_FILE_TEMP
    cscope -bkq -i $CSCOPE_FILE_TEMP
else
    echo "Please type path of project"
fi