Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
PATCH: File extension handling improvement
DrewBoo:
I have submitted a patch to BerliOS for your consideration.
http://developer.berlios.de/patch/?func=detailpatch&patch_id=2425&group_id=5358
Currently, Code::Blocks has inconsistent concepts of what a "source file" and "header file" are, which prevents some functionality from working. See discussion here: http://forums.codeblocks.org/index.php/topic,8098.msg60489.html and here: http://forums.codeblocks.org/index.php/topic,7905.0.html
The Project Manager has predefined file masks to define "Source Files" and "Header Files". ".C" (capital letter) is a valid extension, for example. You can also add you own extensions, such as ".inl" for inline code.
Elsewhere in Code::Blocks, functionality that requires knowing header and source files ignore extensions defined in the Project Manager - even many of the default ones - and use a hard coded list.
This patch will retain the existing hard-coded extensions, but before returning failure also check whatever extensions are known by the Project Manager.
If you use non-standard file extensions such as .C or .H or .inl or any other extensions you teach the Project Manager, the following functionality will now work with those files:
* Source Code Formatter (AStyle) will format these files
* Code completion will always consider these files
* GCC compiler will support "Build file" on right-click
* GCC compiler will support building a single file outside of a project
* GDB Debugger will always show the file in the editor when appropriate
* Swap header/source (F11) works
* Code::Blocks will always assume that the file should be viewed in the editor
* File name can be used as command-line parameter to Code::Blocks to open it immediately.
Files affected:
src/sdk/globals.cpp
Modified FileTypeOf() so that, before giving up and returning ftOther, check the Project Manager to see if it would consider the file a source or header
src/sdk/filegroupsandmasks.cpp
Improved const-correctness
src/sdk/editormanager.cpp
Changed swap header/source code to consider file extensions known by the project manager
src/include/projectmanager.h
Provided an accessor to a const FileGroupsAndMasks object
src/include/filegroupsandmasks.h
Improved const-correctness
joubertdj:
:) Nice ... I hope all the tests succeed for your sake, so that it can be included in SVN!
mandrav:
--- Quote ---src/include/projectmanager.h
Provided an accessor to a const FileGroupsAndMasks object
src/include/filegroupsandmasks.h
Improved const-correctness
--- End quote ---
Without having looked at the patch yet, I can safely say it's probably not going to be accepted for the time being. That is because touching those files I quoted is going to break binary compatibility with the 8.02 release. And that is something that hasn't been yet decided by the devs how to handle.
Still, thanks for providing patches to improve C::B :).
DrewBoo:
--- Quote from: mandrav on April 01, 2008, 08:30:34 am ---Without having looked at the patch yet, I can safely say it's probably not going to be accepted for the time being. That is because touching those files I quoted is going to break binary compatibility with the 8.02 release. And that is something that hasn't been yet decided by the devs how to handle.
--- End quote ---
Hmm...I don't have to change filegroupsandmasks.h...I made it more const correct because it seemed like the right thing to do.
As for projectmanager.h...it's holding on to that FileGroupsAndMasks object really tight. I could get my hands on it by doing some OFFSETOF voodoo instead of changing the interface in the header. You know, just while the devs are deciding how this should usually be handled.
What do you think?
--- Quote from: mandrav on April 01, 2008, 08:30:34 am ---Still, thanks for providing patches to improve C::B :).
--- End quote ---
Bah...it's fun. :lol:
DrewBoo:
--- Quote from: mandrav on April 01, 2008, 08:30:34 am ---Still, thanks for providing patches to improve C::B :).
--- End quote ---
Oh, and congratulations on your 212th post.
Navigation
[0] Message Index
[#] Next page
Go to full version