[glibmm/gmmproc-refactor] Fix some section bugs.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm/gmmproc-refactor] Fix some section bugs.
- Date: Sun, 22 Jul 2012 18:17:06 +0000 (UTC)
commit 3e8343b710969ec49ff371b528d17b70a6fac250
Author: Krzesimir Nowak <qdlacz gmail com>
Date: Sun Jul 22 17:22:00 2012 +0200
Fix some section bugs.
Add H_INCLUDE section - used by GError wrappers for including wrap
init header and by GTyped enums/flags for including value
header. Added own public and private header inclusion in
implementation files.
tools/pm/Common/SectionManager.pm | 14 +++++++---
tools/pm/Common/Sections.pm | 50 +++++++++++++++++++++---------------
2 files changed, 39 insertions(+), 25 deletions(-)
---
diff --git a/tools/pm/Common/SectionManager.pm b/tools/pm/Common/SectionManager.pm
index 93dbdcc..d160820 100644
--- a/tools/pm/Common/SectionManager.pm
+++ b/tools/pm/Common/SectionManager.pm
@@ -89,6 +89,7 @@ sub _prepare_h_section ($)
);
$self->append_string (join "\n", @code);
}
+ $self->append_section (Common::Sections::H_INCLUDES->[0]);
$self->append_section (Common::Sections::H_CONTENTS->[0]);
@code =
(
@@ -100,19 +101,24 @@ sub _prepare_h_section ($)
$self->pop_entry;
}
-sub _prepare_cc_section ($)
+sub _prepare_cc_section
{
my ($self) = @_;
+ my $base = $self->_get_base ();
+ my $mm_module = $self->_get_mm_module ();
my @code =
(
- _get_header,
+ '#include <glibmm.h>',
+ '',
+ '#include <' . $mm_module . '/' . $base . '.h>',
+ '#include <' . $mm_module . '/private/' . $base . '_p.h>',
''
);
$self->push_section (Common::Sections::CC->[0]);
- $self->append_string (join "\n", @code);
+ $self->append_string (_get_header ());
$self->append_section (Common::Sections::CC_PRE_INCLUDES->[0]);
- $self->append_string ("\n");
+ $self->append_string (join ("\n", @code));
$self->append_section (Common::Sections::CC_GENERATED_INCLUDES->[0]);
$self->append_string ("\n");
$self->append_section (Common::Sections::CC_INCLUDES->[0]);
diff --git a/tools/pm/Common/Sections.pm b/tools/pm/Common/Sections.pm
index 1e37fdc..5449d69 100644
--- a/tools/pm/Common/Sections.pm
+++ b/tools/pm/Common/Sections.pm
@@ -29,48 +29,56 @@ use Common::Sections::Section;
use Common::Sections::Conditional;
use Common::Sections::Entries;
-# TODO: sort those sections in some sensible manner.
-
use constant
{
+ # header constants
'H' => ['SECTION_H', Common::Constants::FILE ()], # main header section
- 'CC' => ['SECTION_CC', Common::Constants::FILE ()], # main implementation section
- 'P_H' => ['SECTION_P_H', Common::Constants::FILE ()], # main private header section
- 'DEV_NULL' => ['SECTION_DEV_NULL', Common::Constants::FILE ()], # everything put into this section goes to /dev/null
+ 'H_BEGIN' => ['SECTION_HEADER_BEGIN', Common::Constants::FILE ()], # SECTION_HEADER_FIRST
+ 'H_INCLUDES' => ['SECTION_H_INCLUDES', Common::Constants::FILE ()],
'H_CONTENTS' => ['SECTION_H_CONTENTS', Common::Constants::FILE ()], # for code in header template
+ 'H_VFUNCS' => ['SECTION_H_VFUNCS', Common::Constants::CLASS ()],
+ 'H_VFUNCS_CXX_WRAPPER' => ['SECTION_H_VFUNCS_CXX_WRAPPER', Common::Constants::CLASS ()], # TODO: probably not needed.
+ 'H_DEFAULT_SIGNAL_HANDLERS' => ['SECTION_H_DEFAULT_SIGNAL_HANDLERS', Common::Constants::CLASS ()],
+ 'H_BEFORE_FIRST_NAMESPACE' => ['SECTION_BEFORE_FIRST_NAMESPACE', Common::Constants::FIRST_NAMESPACE ()],
+ 'H_BEFORE_FIRST_CLASS' => ['SECTION_BEFORE_FIRST_CLASS', Common::Constants::FIRST_CLASS ()],
+ 'H_AFTER_FIRST_CLASS' => ['SECTION_AFTER_FIRST_CLASS', Common::Constants::FIRST_CLASS ()],
+ 'H_AFTER_FIRST_NAMESPACE' => ['SECTION_AFTER_FIRST_NAMESPACE', Common::Constants::FIRST_NAMESPACE ()],
+ 'H_SIGNAL_PROXIES' => ['SECTION_H_SIGNAL_PROXIES', Common::Constants::CLASS ()],
+ 'H_PROPERTY_PROXIES' => ['SECTION_H_PROPERTY_PROXIES', Common::Constants::CLASS ()],
+
+ # source constants
+ 'CC' => ['SECTION_CC', Common::Constants::FILE ()], # main implementation section
'CC_CONTENTS' => ['SECTION_CC_CONTENTS', Common::Constants::FILE ()], # for code in source header
- 'P_H_GENERATED' => ['SECTION_P_H_GENERATED', Common::Constants::FILE ()],
'CC_GENERATED_INCLUDES' => ['SECTION_CC_GENERATED_INCLUDES', Common::Constants::FILE ()],
'CC_UNNAMED_NAMESPACE' => ['SECTION_UNNAMED_NAMESPACE', Common::Constants::FILE ()], # blablabla
- 'H_BEGIN' => ['SECTION_HEADER_BEGIN', Common::Constants::FILE ()], # SECTION_HEADER_FIRST
'CC_PRE_INCLUDES' => ['SECTION_CC_PRE_INCLUDES', Common::Constants::FILE ()],
'CC_INCLUDES' => ['SECTION_CC_INCLUDES', Common::Constants::FILE ()],
'CC_GENERATED' => ['SECTION_CC_GENERATED', Common::Constants::FILE ()], # TODO: check if needed, SECTION_CC_GENERATED
'CC_NAMESPACE' => ['SECTION_CC_NAMESPACE', Common::Constants::NAMESPACE ()],
- 'P_CC_IMPLEMENTS_INTERFACES' => ['SECTION_P_CC_IMPLEMENTS_INTERFACES', Common::Constants::CLASS ()],
- 'H_VFUNCS' => ['SECTION_H_VFUNCS', Common::Constants::CLASS ()],
- 'H_VFUNCS_CXX_WRAPPER' => ['SECTION_H_VFUNCS_CXX_WRAPPER', Common::Constants::CLASS ()], # TODO: probably not needed.
- 'H_DEFAULT_SIGNAL_HANDLERS' => ['SECTION_H_DEFAULT_SIGNAL_HANDLERS', Common::Constants::CLASS ()],
'CC_DEFAULT_SIGNAL_HANDLERS' => ['SECTION_CC_DEFAULT_SIGNAL_HANDLERS', Common::Constants::CLASS ()],
'CC_VFUNCS' => ['SECTION_CC_VFUNCS', Common::Constants::CLASS ()],
'CC_VFUNCS_CXX_WRAPPER' => ['SECTION_CC_VFUNCS_CXX_WRAPPER', Common::Constants::CLASS ()], # TODO: probably not needed
+ 'CC_SIGNAL_PROXIES' => ['SECTION_CC_SIGNAL_PROXIES', Common::Constants::CLASS ()],
+ 'CC_PROPERTY_PROXIES' => ['SECTION_CC_PROPERTY_PROXIES', Common::Constants::CLASS ()],
+ 'CC_INITIALIZE_EXTRA' => ['SECTION_CC_INITIALIZE_EXTRA', Common::Constants::CLASS ()], # TODO: check if needed.
+
+ # private header constants
+ 'P_H' => ['SECTION_P_H', Common::Constants::FILE ()], # main private header section
+ 'P_H_GENERATED' => ['SECTION_P_H_GENERATED', Common::Constants::FILE ()],
'P_H_DEFAULT_SIGNAL_HANDLERS' => ['SECTION_P_H_DEFAULT_SIGNAL_HANDLERS', Common::Constants::CLASS ()],
'P_H_VFUNCS' => ['SECTION_P_H_VFUNCS', Common::Constants::CLASS ()],
+ 'P_H_INCLUDES' => ['SECTION_P_H_INCLUDES', Common::Constants::FILE ()],
+
+ # private source constants
+ 'P_CC_IMPLEMENTS_INTERFACES' => ['SECTION_P_CC_IMPLEMENTS_INTERFACES', Common::Constants::CLASS ()],
'P_CC_DEFAULT_SIGNAL_HANDLERS' => ['SECTION_P_CC_DEFAULT_SIGNAL_HANDLERS', Common::Constants::CLASS ()],
'P_CC_VFUNCS' => ['SECTION_P_CC_VFUNCS', Common::Constants::CLASS ()],
'P_CC_INIT_DEFAULT_SIGNAL_HANDLERS' => ['SECTION_P_CC_INIT_DEFAULT_SIGNAL_HANDLERS', Common::Constants::CLASS ()],
'P_CC_INIT_VFUNCS' => ['SECTION_P_CC_INIT_VFUNCS', Common::Constants::CLASS ()],
'P_CC_NAMESPACE' => ['SECTION_P_CC_NAMESPACE', Common::Constants::CLASS ()],
- 'H_BEFORE_FIRST_NAMESPACE' => ['SECTION_BEFORE_FIRST_NAMESPACE', Common::Constants::FIRST_NAMESPACE ()],
- 'H_BEFORE_FIRST_CLASS' => ['SECTION_BEFORE_FIRST_CLASS', Common::Constants::FIRST_CLASS ()],
- 'H_AFTER_FIRST_CLASS' => ['SECTION_AFTER_FIRST_CLASS', Common::Constants::FIRST_CLASS ()],
- 'H_AFTER_FIRST_NAMESPACE' => ['SECTION_AFTER_FIRST_NAMESPACE', Common::Constants::FIRST_NAMESPACE ()],
- 'H_SIGNAL_PROXIES' => ['SECTION_H_SIGNAL_PROXIES', Common::Constants::CLASS ()],
- 'CC_SIGNAL_PROXIES' => ['SECTION_CC_SIGNAL_PROXIES', Common::Constants::CLASS ()],
- 'H_PROPERTY_PROXIES' => ['SECTION_H_PROPERTY_PROXIES', Common::Constants::CLASS ()],
- 'CC_PROPERTY_PROXIES' => ['SECTION_CC_PROPERTY_PROXIES', Common::Constants::CLASS ()],
- 'CC_INITIALIZE_EXTRA' => ['SECTION_CC_INITIALIZE_EXTRA', Common::Constants::CLASS ()], # TODO: check if needed.
- 'P_H_INCLUDES' => ['SECTION_P_H_INCLUDES', Common::Constants::FILE ()]
+
+ # other
+ 'DEV_NULL' => ['SECTION_DEV_NULL', Common::Constants::FILE ()] # everything put into this section goes to /dev/null
};
sub get_section_traits_from_string
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]