Skip to content

Commit

Permalink
powereditor: introduce funcguard category setup
Browse files Browse the repository at this point in the history
- Add FuncGuards files to the VC 8 and 9 project files for the release
  and debug builds.  Omitting the FuncGuards.cpp from the Shipping
  build.
- Add pre-build event to copy FuncGuards_skel.h to FuncGuards.h when
  it doesn't exist.
- Add FuncGuards.h,*.tmp, and MISC/Debug/templates/ to .gitignore
- Include the FunGuardsImporter header in the precompiled_headers.

[#32]

Signed-off-by: Thell Fowler <git@tbfowler.name>
  • Loading branch information
Thell Fowler committed Oct 30, 2010
1 parent 07430ce commit 2c746d8
Show file tree
Hide file tree
Showing 7 changed files with 257 additions and 4 deletions.
4 changes: 4 additions & 0 deletions PowerEditor/src/MISC/Debug/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FuncGuards.h
# Ignore developer's private funcguards templates
Templates/
*.tmp
56 changes: 56 additions & 0 deletions PowerEditor/src/MISC/Debug/FuncGuards.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// This file is part of Notepad++ Community Release's FuncGuard project.
// Copyright (C)2009 The Notepad++ Community
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

#include "precompiled_headers.h"
#include "MISC/Debug/FuncGuards.h"

///////////////////////////////////////////////////////////////////////////////
//
// This source enables/disables all functions guards based on whether or not
// the NPPCR_GUARD_... macro is defined in FuncGuards.h
//
// When new functions guards are created they should be added to this file
// in alphabetical order.
//
//
// IT IS RECOMMENDED TO USE THE POWERSHELL FUNCGUARD MODULE TO KEEP THE RELATED
// FILES IN SYNCH AND PROPERLY ORDERED!
//
//
// Any desired documentation for the function guard belongs in FuncGuards.h
//
///////////////////////////////////////////////////////////////////////////////

/*
Usage:
The entries in this file need to remain between the block start and block
end statements.
All entries need to follow the format and have a blank line above and below
the entry:
#ifdef FUNCGUARD_PREFIX_GUARDNAME
func_guard_enable_cat(guardName);
#else
func_guard_disable_cat(guardName);
#endif
*/

// FUNCGUARD_BLOCK_START << Do not alter or remove

// FUNCGUARD_BLOCK_END << Do not alter or remove
55 changes: 55 additions & 0 deletions PowerEditor/src/MISC/Debug/FuncGuardsImport.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// This file is part of Notepad++ Community Release's FuncGuard project.
// Copyright (C)2009 The Notepad++ Community
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

///////////////////////////////////////////////////////////////////////////////
//
// All function guards should be listed here to make them available in any
// source. The simplest method is by using the precompiled headers.
//
// When new functions guards are created they should be added to this file
// in alphabetical order.
//
//
// IT IS RECOMMENDED TO USE THE POWERSHELL FUNCGUARD MODULE TO KEEP THE RELATED
// FILES IN SYNCH AND PROPERLY ORDERED!
//
//
// Any desired documentation for the function guard belongs in FuncGuards.h
//
///////////////////////////////////////////////////////////////////////////////

/*
Usage:
- Entries in this file need to remain between the '#ifndef' and '#endif'
statements for FUNCGUARDIMPORT and should have no spacing between the
entries.
Example:
#ifndef MISC_DEBUG_FUNCGUARDIMPORT_H
#define MISC_DEBUG_FUNCGUARDIMPORT_H
func_guard_import_cat(guardClass1);
func_guard_import_cat(guardClass1Class2_Communications);
func_guard_import_cat(guardClass2);
#endif // MISC_DEBUG_FUNCGUARDS_H
*/

#ifndef MISC_DEBUG_FUNCGUARDIMPORT_H
#define MISC_DEBUG_FUNCGUARDIMPORT_H

#endif // MISC_DEBUG_FUNCGUARDS_H
87 changes: 87 additions & 0 deletions PowerEditor/src/MISC/Debug/FuncGuards_skel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// This file is part of Notepad++ Community Release's FuncGuard project.
// Copyright (C)2009 The Notepad++ Community
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

///////////////////////////////////////////////////////////////////////////////
//
// Uncomment/Comment out the desired guard definitions to enable/disable. Use
// the provided func_guard() statement in the functions you want to trace.
//
// When new functions guards are created they should be added to this file
// in alphabetical order.
//
//
// IT IS RECOMMENDED TO USE THE POWERSHELL FUNCGUARD MODULE TO KEEP THE RELATED
// FILES IN SYNCH AND PROPERLY ORDERED!
//
//
///////////////////////////////////////////////////////////////////////////////

/*
Usage:
This skeleton file should be copied to FuncGuards.h by a pre-build event when
FuncGuards.h doesn't exist. It serves as your projects 'tracked' version of
available function guards.
ALL FUNCTION GUARDS SHOULD BE DISABLED (commented out) IN THIS FILE
Notes:
- Every define and usage needs to start with '//'
- Cat is CamelCase with '_' spacing between either the filename or major
class category followed by a subclass or particular function area if
needed.
- This is the validation regex used by the Powershell FuncGuard module:
$Name -cmatch "^(\p{Lu}\p{Ll}+)+($|_((\p{Lu}\p{Ll}+)|\d)+|\d+)+$"
- Entries in this file need to remain between the '#ifndef SHIPPING' and
'#endif // SHIPPING' statements and should have a single line before and
after the entry.
- The format of the entries need to follow one of the following two
examples:
*/

// func_guard(guardClass1);
// Description: Used in tracing functions in the Class1 class.
// #define FUNCGUARD_PSUNIT_CLASS1

// func_guard(guardClass1Class2_Communications);
// Description: For tracing TestGuard1 and TestGuard2 communication.
/*
This enables tracing of _only_ the communication functions of the
TestGuard1 and TestGuard2 classes.
Modify the local function area to filter messages, to output use:
func_guard_debugf_cat(guardTestGuard_MultiClass);
Enable by adding to the current func_guard(#cat) statement.
example: func_guard(guardClass1 | guardClass1Class2_Communications);
If both TestGuard1 and TestGuard2 are active then enabling this is not
needed, but doesn't hurt anything.
*/
// #define FUNCGUARD_PSUNIT_CLASS1CLASS2_COMMUNICATIONS

#ifndef MISC_DEBUG_FUNCGUARD_H
#define MISC_DEBUG_FUNCGUARD_H

#ifndef SHIPPING

#endif // SHIPPING
#endif // MISC_DEBUG_FUNCGUARD_H
3 changes: 3 additions & 0 deletions PowerEditor/src/precompiled_headers.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@
// Power Editor
#include "MISC/Common/CommonGenerics.h"
#include "MISC/Debug/npp_debug.h"
#ifndef SHIPPING
#include "MISC/Debug/FuncGuardsImport.h"
#endif
#include "MISC/Common/Common.h"

#endif // PRECOMPILED_HEADERS_H
28 changes: 26 additions & 2 deletions PowerEditor/visual.net/notepadPlus.8.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<Tool
Name="VCPreBuildEventTool"
Description="Runtime build and version generation."
CommandLine="CALL &quot;$(SolutionDir)\scripts\GIT-VS-VERSION-GEN.bat&quot; &quot;$(IntDir)\&quot; &quot;$(SolutionDir)PowerEditor\src\gen-versioninfo.h&quot;"
CommandLine="CALL &quot;$(SolutionDir)\scripts\GIT-VS-VERSION-GEN.bat&quot; &quot;$(IntDir)\&quot; &quot;$(SolutionDir)PowerEditor\src\gen-versioninfo.h&quot;&#x0D;&#x0A;IF NOT EXIST &quot;$(ProjectDir)..\src\MISC\Debug\FuncGuards.h&quot; copy &quot;$(ProjectDir)..\src\MISC\Debug\FuncGuards_skel.h&quot; &quot;$(ProjectDir)..\src\MISC\Debug\FuncGuards.h&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
Expand Down Expand Up @@ -123,7 +123,7 @@
<Tool
Name="VCPreBuildEventTool"
Description="Runtime build and version generation."
CommandLine="CALL $(SolutionDir)\scripts\GIT-VS-VERSION-GEN.bat &quot;$(IntDir)\&quot; &quot;$(SolutionDir)PowerEditor\src\gen-versioninfo.h&quot;"
CommandLine="CALL $(SolutionDir)\scripts\GIT-VS-VERSION-GEN.bat &quot;$(IntDir)\&quot; &quot;$(SolutionDir)PowerEditor\src\gen-versioninfo.h&quot;&#x0D;&#x0A;IF NOT EXIST &quot;$(ProjectDir)..\src\MISC\Debug\FuncGuards.h&quot; copy &quot;$(ProjectDir)..\src\MISC\Debug\FuncGuards_skel.h&quot; &quot;$(ProjectDir)..\src\MISC\Debug\FuncGuards.h&quot;"
/>
<Tool
Name="VCCustomBuildTool"
Expand Down Expand Up @@ -538,6 +538,18 @@
<Filter
Name="Debug"
>
<File
RelativePath="..\src\MISC\Debug\FuncGuards.cpp"
>
<FileConfiguration
Name="Shipping|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\MISC\Debug\npp_debug.cpp"
>
Expand Down Expand Up @@ -943,6 +955,18 @@
<Filter
Name="Debug"
>
<File
RelativePath="..\src\MISC\Debug\FuncGuards.h"
>
</File>
<File
RelativePath="..\src\MISC\Debug\FuncGuards_skel.h"
>
</File>
<File
RelativePath="..\src\MISC\Debug\FuncGuardsImport.h"
>
</File>
<File
RelativePath="..\src\MISC\Debug\npp_debug.h"
>
Expand Down
28 changes: 26 additions & 2 deletions PowerEditor/visual.net/notepadPlus.9.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<Tool
Name="VCPreBuildEventTool"
Description="Runtime build and version generation."
CommandLine="CALL &quot;$(SolutionDir)\scripts\GIT-VS-VERSION-GEN.bat&quot; &quot;$(IntDir)\&quot; &quot;$(SolutionDir)PowerEditor\src\gen-versioninfo.h&quot;"
CommandLine="CALL &quot;$(SolutionDir)\scripts\GIT-VS-VERSION-GEN.bat&quot; &quot;$(IntDir)\&quot; &quot;$(SolutionDir)PowerEditor\src\gen-versioninfo.h&quot;&#x0D;&#x0A;IF NOT EXIST &quot;$(ProjectDir)..\src\MISC\Debug\FuncGuards.h&quot; copy &quot;$(ProjectDir)..\src\MISC\Debug\FuncGuards_skel.h&quot; &quot;$(ProjectDir)..\src\MISC\Debug\FuncGuards.h&quot;&#x0D;&#x0A;"
ExcludedFromBuild="false"
/>
<Tool
Expand Down Expand Up @@ -126,7 +126,7 @@
<Tool
Name="VCPreBuildEventTool"
Description="Runtime build and version generation."
CommandLine="CALL $(SolutionDir)\scripts\GIT-VS-VERSION-GEN.bat &quot;$(IntDir)\&quot; &quot;$(SolutionDir)PowerEditor\src\gen-versioninfo.h&quot;"
CommandLine="CALL $(SolutionDir)\scripts\GIT-VS-VERSION-GEN.bat &quot;$(IntDir)\&quot; &quot;$(SolutionDir)PowerEditor\src\gen-versioninfo.h&quot;&#x0D;&#x0A;IF NOT EXIST &quot;$(ProjectDir)..\src\MISC\Debug\FuncGuards.h&quot; copy &quot;$(ProjectDir)..\src\MISC\Debug\FuncGuards_skel.h&quot; &quot;$(ProjectDir)..\src\MISC\Debug\FuncGuards.h&quot;"
/>
<Tool
Name="VCCustomBuildTool"
Expand Down Expand Up @@ -459,6 +459,18 @@
<Filter
Name="Debug"
>
<File
RelativePath="..\src\MISC\Debug\FuncGuards.h"
>
</File>
<File
RelativePath="..\src\MISC\Debug\FuncGuards_skel.h"
>
</File>
<File
RelativePath="..\src\MISC\Debug\FuncGuardsImport.h"
>
</File>
<File
RelativePath="..\src\MISC\Debug\npp_debug.h"
>
Expand Down Expand Up @@ -1462,6 +1474,18 @@
<Filter
Name="Debug"
>
<File
RelativePath="..\src\MISC\Debug\FuncGuards.cpp"
>
<FileConfiguration
Name="Shipping|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\MISC\Debug\npp_debug.cpp"
>
Expand Down

0 comments on commit 2c746d8

Please sign in to comment.