eaglexmw / seascope

Automatically exported from code.google.com/p/seascope
Other
0 stars 0 forks source link

Why Cpp header files are not recognized? #8

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. A source directory consists of *.cpp and header files without postfix
2. Add this source directory to seascope
3. Only *.cpp imported

What is the expected output? What do you see instead?
Cpp header files should be recognized and imported, however, that is not the 
case in seascope.

What version of the product are you using? On what operating system?
OS:
   Linux localhost 2.6.35.11-83.fc14.i686 #1 SMP Mon Feb 7 07:04:18 UTC 2011 i686 i686 i386 GNU/Linux
Seascope:
   seascope-0.3.tar.gz

Please provide any additional information below.

Original issue reported on code.google.com by wwthu...@gmail.com on 22 Oct 2011 at 1:06

GoogleCodeExporter commented 9 years ago
I have handled the problem by revising ProjectManage.py

def get_cscope_files_list(rootdir):
    file_list = []
    if (not os.path.isdir(rootdir)):
        print "Not a directory:", rootdir
        return file_list
    for root, subFolders, files in os.walk(rootdir):
        for f in files:
            f = os.path.join(root, f)
            if (re.search('\.(h|c|H|C|hh|cc|cpp|hxx|cxx||l|y|s|S|pl|pm|java)$', f) != None):
                file_list.append(f)
            if (re.search('include',f)!=None and re.search('\/[^.]+$',f)!=None):
                file_list.append(f)
    return file_list

2 lines are added to recognize CPP header file, perhaps it only works in linux. 
More robust methods expectd!
if (re.search('include',f)!=None and re.search('\/[^.]+$',f)!=None):
    file_list.append(f)

Original comment by wwthu...@gmail.com on 23 Oct 2011 at 2:56

GoogleCodeExporter commented 9 years ago
Suppose the directory contains files like README, they might get added with 
your approach.
For example if a directory has two files: x.c and README, then we want only x.c 
to be put into cscope.files. We have similar output when using  cscope-indexer.

I don't think its really a bug. But if there is a need to include more files 
then its better to modify cscope.files directly and just to "open project" from 
seascope.

Original comment by anil.om...@gmail.com on 26 Oct 2011 at 8:19

GoogleCodeExporter commented 9 years ago
Thanks for your advice.

In C++ programming, There is a convention of adding "-*-c++-*-" in the first 
line of source code. Maybe seascope should consider it for automation sake.

Original comment by wwthu...@gmail.com on 27 Oct 2011 at 1:46

GoogleCodeExporter commented 9 years ago
Inspecting deep into files to detect file-type is going to be expensive and 
slow the speed of scanning files. For now i will stick to cscope-indexer 
equivalent behaviour.

Probably we should have mechanism to execute a custom-script if file is not of 
standard prefix (for deciding inclusion into file list). Will think about it.

Original comment by anil.om...@gmail.com on 30 Oct 2011 at 9:08

GoogleCodeExporter commented 9 years ago

Original comment by anil.om...@gmail.com on 5 Dec 2011 at 10:06