[glibmm/gmmproc-refactor] Revert "Blablabla."
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm/gmmproc-refactor] Revert "Blablabla."
- Date: Thu, 22 Sep 2011 08:36:44 +0000 (UTC)
commit e3219122ecc7c9de376493e9993a500602fbdfa3
Author: Krzesimir Nowak <qdlacz gmail com>
Date: Thu Sep 22 10:35:41 2011 +0200
Revert "Blablabla."
This was pushed by accident and should be split into several smaller
commits.
This reverts commit 97fe74201f3049835204e4ae62af0bff444a4b88.
.gitignore | 1 -
configure.ac | 2 -
tools/pm/Gir/Config.pm.in | 11 -
tools/pm/Gir/Handlers/Alias.pm | 50 ----
tools/pm/Gir/Handlers/Base.pm | 29 +--
tools/pm/Gir/Handlers/Bitfield.pm | 50 ----
tools/pm/Gir/Handlers/Callback.pm | 58 -----
tools/pm/Gir/Handlers/Class.pm | 106 ---------
tools/pm/Gir/Handlers/Common.pm | 38 +---
tools/pm/Gir/Handlers/Constant.pm | 50 ----
tools/pm/Gir/Handlers/Enumeration.pm | 58 -----
tools/pm/Gir/Handlers/Function.pm | 58 -----
tools/pm/Gir/Handlers/Ignore.pm | 18 +-
.../pm/Gir/Handlers/{Stores => }/IgnoreEndStore.pm | 8 +-
.../Gir/Handlers/{Stores => }/IgnoreStartStore.pm | 8 +-
tools/pm/Gir/Handlers/Interface.pm | 90 -------
tools/pm/Gir/Handlers/Namespace.pm | 139 -----------
tools/pm/Gir/Handlers/Record.pm | 82 -------
tools/pm/Gir/Handlers/Repository.pm | 52 ++--
tools/pm/Gir/Handlers/{Stores => }/Store.pm | 4 +-
tools/pm/Gir/Handlers/Stores/DocEndStore.pm | 28 ---
tools/pm/Gir/Handlers/Stores/DocStartStore.pm | 28 ---
tools/pm/Gir/Handlers/Stores/DocStores.pm | 6 -
tools/pm/Gir/Handlers/Stores/IgnoreStores.pm | 6 -
tools/pm/Gir/Handlers/TopLevel.pm | 26 +--
tools/pm/Gir/Parser.pm | 153 +++---------
tools/pm/Gir/State.pm | 37 +---
tools/pm/Gir/metadata | 21 +-
tools/pm/GobjectIntrospectionBUGS.txt | 18 --
tools/pm/girtest.pl | 12 -
tools/pm/metadatagetter.pl | 240 -------------------
tools/pm/moduleslist | 1 -
tools/pm/taghandlerwriter.pl | 250 --------------------
33 files changed, 115 insertions(+), 1623 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 3a527e7..ef2bba1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -157,4 +157,3 @@ giommconfig.h
/tools/extra_defs_gen/generate_defs_glib
/tools/generate_wrap_init.pl
/tools/gmmproc
-/tools/pm/Gir/Config.pm
diff --git a/configure.ac b/configure.ac
index b27260f..ef115f4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -72,7 +72,6 @@ PKG_CHECK_MODULES([GIOMM], [$GIOMM_MODULES])
MM_PKG_CONFIG_SUBST([GTHREAD_CFLAGS], [--cflags-only-other gthread-2.0])
MM_PKG_CONFIG_SUBST([GTHREAD_LIBS], [--libs gthread-2.0])
-MM_PKG_CONFIG_SUBST([GIR_DIR], [--variable=girdir gobject-introspection-1.0])
AC_CHECK_PROGS([M4], [gm4 m4], [m4])
GLIB_GSETTINGS
@@ -136,7 +135,6 @@ AC_CONFIG_FILES([Makefile
tools/Makefile
tools/gmmproc
tools/generate_wrap_init.pl
- tools/pm/Gir/Config.pm
glib/${GLIBMM_MODULE_NAME}.pc:glib/glibmm.pc.in
glib/${GLIBMM_MODULE_NAME}-uninstalled.pc:glib/glibmm-uninstalled.pc.in
glib/src/Makefile
diff --git a/tools/pm/Gir/Handlers/Base.pm b/tools/pm/Gir/Handlers/Base.pm
index b09ae47..c5a52ad 100644
--- a/tools/pm/Gir/Handlers/Base.pm
+++ b/tools/pm/Gir/Handlers/Base.pm
@@ -13,8 +13,7 @@ sub _new_impl_ ($)
my $self =
{
'start_handlers' => {},
- 'end_handlers' => {},
- 'subhandlers' => {}
+ 'end_handlers' => {}
};
return bless ($self, $class);
@@ -31,13 +30,6 @@ sub _set_handlers ($$$)
$self->{'end_handlers'} = $end_handlers;
}
-sub _set_subhandlers ($$)
-{
- my ($self, $subhandlers) = @_;
-
- $self->{'subhandlers'} = $subhandlers;
-}
-
##
## public:
##
@@ -62,24 +54,7 @@ sub get_end_handlers ($)
sub get_subhandlers_for ($$)
{
- my ($self, $elem) = @_;
- my $subhandlers = $self->{'subhandlers'};
- my $package = undef;
-
- if (exists ($subhandlers->{$elem}))
- {
- $package = $subhandlers->{$elem};
- }
- elsif (exists ($subhandlers->{'*'}))
- {
- $package = $subhandlers->{'*'};
- }
-
- if (defined ($package))
- {
- return $package->new ();
- }
- return undef;
+ #TODO: error - not implemented.
}
1;
diff --git a/tools/pm/Gir/Handlers/Common.pm b/tools/pm/Gir/Handlers/Common.pm
index edca9ad..16ab33f 100644
--- a/tools/pm/Gir/Handlers/Common.pm
+++ b/tools/pm/Gir/Handlers/Common.pm
@@ -12,26 +12,6 @@ sub start_ignore ($$@)
sub end_ignore ($$)
{}
-sub doc_start ($$@)
-{
- my ($self, $parser, @atts_vals) = @_;
- my $params = extract_values_warn (['xml:whitespace'], [], \ atts_vals, 'doc');
- my $state = $parser->get_current_state ();
- my $xml_parser = $state->get_xml_parser ();
-
- $self->{'doc'} = '';
- $xml_parser->setHandlers ('Char' => sub { $self->{'doc'} .= $_[1] });
-}
-
-sub doc_end ($$)
-{
- my ($self, $parser) = @_;
- my $state = $parser->get_current_state ();
- my $xml_parser = $state->get_xml_parser ();
-
- $xml_parser->setHandlers ('Char' => undef);
-}
-
sub extract_values($$$$)
{
my ($keys, $optional_keys, $atts_vals, $tag) = @_;
@@ -41,12 +21,12 @@ sub extract_values($$$$)
my $leftover = undef;
my $att = undef;
- foreach my $key (@{$keys})
+ foreach my $key (@keys)
{
$params->{$key} = undef;
$check->{$key} = undef;
}
- foreach my $key (@{$optional_keys})
+ foreach my $key in (@optional_keys)
{
$params->{$key} = undef;
}
@@ -72,12 +52,12 @@ sub extract_values($$$$)
}
else
{
- $params->{$att} = $entry;
+ $params{$att} = $entry;
$att = undef;
}
}
- my @check_keys = keys (%{$check});
+ my @check_keys = keys (%{$check})
if (@check_keys > 0)
{
@@ -88,8 +68,8 @@ sub extract_values($$$$)
$message .= " " . $key . "\n";
}
# TODO: change this later maybe to exception and remove $tag parameter.
- #print STDERR $message;
- #exit (1);
+ print STDERR $message;
+ exit (1);
}
return ($params, $leftovers);
@@ -98,7 +78,7 @@ sub extract_values($$$$)
sub extract_values_warn ($$$$)
{
my ($keys, $optional_keys, $atts_vals, $tag) = @_;
- my ($params, $leftovers) = extract_values ($keys, $optional_keys, $atts_vals, $tag);
+ my ($params, $leftovers) = extract_values ($keys, $optional_keys, $atts_vals);
my @leftover_keys = keys (%{$leftovers});
if (@leftover_keys > 0)
@@ -110,8 +90,8 @@ sub extract_values_warn ($$$$)
$message .= " " . $leftover . " => " . $leftovers->{$leftover} . "\n";
}
# TODO: change this later maybe to exception and remove $tag parameter.
- #print STDERR $message;
- #exit (1);
+ print STDERR $message;
+ exit (1);
}
return $params;
diff --git a/tools/pm/Gir/Handlers/Ignore.pm b/tools/pm/Gir/Handlers/Ignore.pm
index b7a9eaa..5b77b98 100644
--- a/tools/pm/Gir/Handlers/Ignore.pm
+++ b/tools/pm/Gir/Handlers/Ignore.pm
@@ -5,7 +5,8 @@ use warnings;
use parent qw(Gir::Handlers::Base);
-use Gir::Handlers::Stores::IgnoreStores;
+use Gir::Handlers::IgnoreEndStore;
+use Gir::Handlers::IgnoreStartStore;
##
## public:
@@ -14,19 +15,20 @@ sub new ($)
{
my $type = shift;
my $class = (ref ($type) or $type or 'Gir::Handlers::Ignore');
- my $self = $class->SUPER::new ();
+ my $self = $class->SUPER->new ();
$self->_set_handlers
(
- Gir::Handlers::Stores::IgnoreStartStore->new (),
- Gir::Handlers::Stores::IgnoreEndStore->new ()
+ Gir::Handlers::IgnoreStartStore->new (),
+ Gir::Handlers::IgnoreEndStore->new ()
);
- $self->_set_subhandlers
- ({
- '*' => "Gir::Handlers::Ignore"
- });
return bless ($self, $class);
}
+sub get_subhandlers_for ($$)
+{
+ return Gir::Handlers::Ignore->new ();
+}
+
1;
diff --git a/tools/pm/Gir/Handlers/Stores/IgnoreEndStore.pm b/tools/pm/Gir/Handlers/IgnoreEndStore.pm
similarity index 55%
rename from tools/pm/Gir/Handlers/Stores/IgnoreEndStore.pm
rename to tools/pm/Gir/Handlers/IgnoreEndStore.pm
index d74b060..40ed88a 100644
--- a/tools/pm/Gir/Handlers/Stores/IgnoreEndStore.pm
+++ b/tools/pm/Gir/Handlers/IgnoreEndStore.pm
@@ -1,9 +1,9 @@
-package Gir::Handlers::Stores::IgnoreEndStore;
+package Gir::Handlers::IgnoreEndStore;
use strict;
use warnings;
-use parent qw(Gir::Handlers::Stores::Store);
+use parent qw(Gir::Handlers::Store);
use Gir::Handlers::Common;
@@ -13,8 +13,8 @@ use Gir::Handlers::Common;
sub new ($)
{
my $type = shift;
- my $class = (ref ($type) or $type or 'Gir::Handlers::Stores::IgnoreEndStore');
- my $self = $class->SUPER::new ({});
+ my $class = (ref ($type) or $type or 'Gir::Handlers::IgnoreEndStore');
+ my $self = $class->SUPER->new ({});
return bless ($self, $class);
}
diff --git a/tools/pm/Gir/Handlers/Stores/IgnoreStartStore.pm b/tools/pm/Gir/Handlers/IgnoreStartStore.pm
similarity index 55%
rename from tools/pm/Gir/Handlers/Stores/IgnoreStartStore.pm
rename to tools/pm/Gir/Handlers/IgnoreStartStore.pm
index 166d4dc..1b5d3f5 100644
--- a/tools/pm/Gir/Handlers/Stores/IgnoreStartStore.pm
+++ b/tools/pm/Gir/Handlers/IgnoreStartStore.pm
@@ -1,9 +1,9 @@
-package Gir::Handlers::Stores::IgnoreStartStore;
+package Gir::Handlers::IgnoreStartStore;
use strict;
use warnings;
-use parent qw(Gir::Handlers::Stores::Store);
+use parent qw(Gir::Handlers::Store);
use Gir::Handlers::Common;
@@ -13,8 +13,8 @@ use Gir::Handlers::Common;
sub new ($)
{
my $type = shift;
- my $class = (ref ($type) or $type or 'Gir::Handlers::Stores::IgnoreStartStore');
- my $self = $class->SUPER::new ({});
+ my $class = (ref ($type) or $type or 'Gir::Handlers::IgnoreStartStore');
+ my $self = $class->SUPER->new ({});
return bless ($self, $class);
}
diff --git a/tools/pm/Gir/Handlers/Repository.pm b/tools/pm/Gir/Handlers/Repository.pm
index b1f4e1b..baf34b7 100644
--- a/tools/pm/Gir/Handlers/Repository.pm
+++ b/tools/pm/Gir/Handlers/Repository.pm
@@ -8,37 +8,32 @@ use parent qw(Gir::Handlers::Base);
use Gir::Handlers::Common;
use Gir::Handlers::Ignore;
use Gir::Handlers::Namespace;
-use Gir::Handlers::Stores::Store;
+use Gir::Handlers::Store;
use Gir::Parser;
##
## private:
##
-sub _include_start ($$@)
-{
- my ($self, $parser, @atts_vals) = @_;
- my $params = Gir::Handlers::Common::extract_values_warn (['name', 'version'], [], \ atts_vals, 'include');
-
- $parser->parse_file ($params->{'name'} . '-' . $params->{'version'} . '.gir');
-}
-
sub _namespace_start ($$@)
{
my ($self, $parser, @atts_vals) = @_;
- my $params = Gir::Handlers::Common::extract_values_warn (['name', 'version'], ['c:identifier-prefixes', 'c:prefix', 'c:symbol-prefixes', 'shared-library'], \ atts_vals, 'namespace');
+ my $params = Gir::Handlers::Common::extract_values (['name', 'version', 'shared-library', 'c:identifier-prefixes', 'c:symbol-prefixes'], [], \ atts_vals, 'namespace');
my $api = $parser->get_api ();
my $name = $params->{'name'};
- #if ($api->has_namespace ($name))
- #{
+ if ($api->has_namespace ($name))
+ {
# TODO: error? every gir probably should have different namespace, right?
- #}
- #$api->add_namespace ($name);
+ }
+ $api->add_namespace ($name);
+}
- my $state = $parser->get_current_state ();
+sub _include_start ($$@)
+{
+ my ($self, $parser, @atts_vals) = @_;
+ my $params = extract_values_warn (['name', 'version'], [], \ atts_vals, 'include');
- print STDOUT 'Parsing ' . $state->get_parsed_file () . "\n";
- $state->set_current_namespace ($name);
+ $parser->parse_file ($params->{'name'} . '-' . $params->{'version'});
}
##
@@ -48,11 +43,11 @@ sub new ($)
{
my $type = shift;
my $class = (ref ($type) or $type or 'Gir::Handlers::Repository');
- my $self = $class->SUPER::new ();
+ my $self = $class->SUPER->new ();
$self->_set_handlers
(
- Gir::Handlers::Stores::Store->new
+ Gir::Handlers::Store->new
({
'c:include' => \&Gir::Handlers::Common::start_ignore,
'implementation' => \&Gir::Handlers::Common::start_ignore,
@@ -60,7 +55,7 @@ sub new ($)
'namespace' => \&_namespace_start,
'package' => \&Gir::Handlers::Common::start_ignore
}),
- Gir::Handlers::Stores::Store->new
+ Gir::Handlers::Store->new
({
'c:include' => \&Gir::Handlers::Common::end_ignore,
'implementation' => \&Gir::Handlers::Common::end_ignore,
@@ -69,13 +64,20 @@ sub new ($)
'package' => \&Gir::Handlers::Common::end_ignore
})
);
- $self->_set_subhandlers
- ({
- 'namespace' => "Gir::Handlers::Namespace",
- '*' => "Gir::Handlers::Ignore"
- });
return bless ($self, $class);
}
+sub get_subhandlers_for ($$)
+{
+ my ($self, $elem) = @_;
+
+ if ($elem eq 'namespace')
+ {
+ return Gir::Handlers::Namespace->new ();
+ }
+ # rest is either ignored or has no children
+ return Gir::Handlers::Ignore->new ();
+}
+
1;
diff --git a/tools/pm/Gir/Handlers/Stores/Store.pm b/tools/pm/Gir/Handlers/Store.pm
similarity index 81%
rename from tools/pm/Gir/Handlers/Stores/Store.pm
rename to tools/pm/Gir/Handlers/Store.pm
index b7b59d4..1fbcf9d 100644
--- a/tools/pm/Gir/Handlers/Stores/Store.pm
+++ b/tools/pm/Gir/Handlers/Store.pm
@@ -1,4 +1,4 @@
-package Gir::Handlers::Stores::Store;
+package Gir::Handlers::Store;
use strict;
use warnings;
@@ -9,7 +9,7 @@ use warnings;
sub new ($$)
{
my ($type, $methods) = @_;
- my $class = (ref ($type) or $type or 'Gir::Handlers::Stores::Store');
+ my $class = (ref ($type) or $type or 'Gir::Handlers::Store');
my $self =
{
'methods' => $methods
diff --git a/tools/pm/Gir/Handlers/TopLevel.pm b/tools/pm/Gir/Handlers/TopLevel.pm
index dca1f8d..59fd9f6 100644
--- a/tools/pm/Gir/Handlers/TopLevel.pm
+++ b/tools/pm/Gir/Handlers/TopLevel.pm
@@ -7,13 +7,7 @@ use parent qw(Gir::Handlers::Base);
use Gir::Handlers::Common;
use Gir::Handlers::Repository;
-use Gir::Handlers::Stores::Store;
-
-sub _repository_start ($$@)
-{
- my ($self, $parser, @atts_vals) = @_;
- my $params = Gir::Handlers::Common::extract_values_warn (['version', 'xmlns', 'xmlns:c'], ['c:identifier-prefixes', 'c:symbol-prefixes', 'xmlns:glib'], \ atts_vals, 'repository');
-}
+use Gir::Handlers::Store;
##
## public:
@@ -22,20 +16,22 @@ sub new ($)
{
my $type = shift;
my $class = (ref ($type) or $type or 'Gir::Handlers::TopLevel');
- my $self = $class->SUPER::new ();
+ my $self = $class->SUPER->new ();
$self->_set_handlers
(
- Gir::Handlers::Stores::Store->new ({ 'repository' => \&_repository_start }),
- Gir::Handlers::Stores::Store->new ({ 'repository' => \&Gir::Handlers::Common::end_ignore })
+ Gir::Handlers::Store->new ({ 'repository' => \&Gir::Handlers::Common::start_ignore }),
+ Gir::Handlers::Store->new ({ 'repository' => \&Gir::Handlers::Common::end_ignore })
);
- $self->_set_subhandlers
- ({
- 'repository' => "Gir::Handlers::Repository",
- '*' => "Gir::Handlers::Ignore"
- });
return bless ($self, $class);
}
+sub get_subhandlers_for ($$)
+{
+ my ($self, $elem) = @_;
+
+ return Gir::Handlers::Repository->new ();
+}
+
1;
diff --git a/tools/pm/Gir/Parser.pm b/tools/pm/Gir/Parser.pm
index 4e0a481..289ceac 100644
--- a/tools/pm/Gir/Parser.pm
+++ b/tools/pm/Gir/Parser.pm
@@ -1,130 +1,62 @@
-package Gir::Parser;
+package GirParser;
use strict;
use warnings;
-use Encode;
-
-use Gir::Config;
-use Gir::Handlers::Stores::Store;
+use Gir::Handlers::Store;
use Gir::State;
-use IO::File;
-
-use XML::Parser::Expat;
+use XML::Parser;
-sub _print_error ($$$)
+sub _init ($)
{
- my ($state, $error, $elem) = @_;
- my $xml_parser = $state->get_xml_parser ();
- my $msg = $state->get_parsed_file ()
- . ':'
- . $xml_parser->current_line ()
- . ': '
- . $error
- . "\nTags stack:\n";
- my @context = $xml_parser->context ();
-
- foreach my $tag (@context)
- {
- $msg .= ' ' . $tag . "\n";
- }
- if (defined ($elem))
- {
- $msg .= ' ' . $elem . "\n";
- }
- print STDERR $msg;
+ my $self = shift;
+ my $new_state = Gir::State->new ();
+ my $state_stack = $self->{'states_stack'};
+
+ push (@{$state_stack}, $new_state);
+ $self->{'state'} = $new_state;
}
-sub _get_file_contents_as_utf8 ($)
+sub _final ($)
{
- my $real_filename = shift;
- my $xml = IO::File->new ($real_filename, 'r');
-
- unless (defined ($xml))
- {
- #TODO: error;
- print STDERR 'Could not open file: ' . $real_filename . ".\n";
- exit (1);
- }
-
- my $file_size = ($xml->stat ())[7];
- my $contents = undef;
-
- unless ($xml->binmode (':raw'))
- {
- #TODO: error;
- print STDERR "Calling binmode on " . $real_filename . " failed.\n";
- exit (1);
- }
-
- my $bytes_read = $xml->read ($contents, $file_size);
+ my $self = shift;
+ my $state_stack = $self->{'states_stack'};
- if ($bytes_read != $file_size)
- {
- #TODO: error;
- if (defined ($bytes_read))
- {
- print STDERR 'Read ' . $bytes_read . ' bytes from ' . $real_filename . ', wanted: ' . $file_size . " bytes.\n";
- }
- else
- {
- print STDERR 'Read error from ' . $real_filename . ".\n";
- }
- exit (1);
- }
- unless ($xml->close ())
- {
- print STDERR 'Closing ' . $real_filename . " failed.\n";
- exit (1);
- }
- return decode ('utf-8', $contents);
+ pop (@{$state_stack});
+ $self->{'state'} = $state_stack->[-1];
}
sub _start ($$$@)
{
- my ($self, undef, $elem, @atts_vals) = @_;
- my $state = $self->get_current_state ();
+ my ($self, undef, $elem, @attval) = @_;
+ my $state = $self->{'current_state'};
my $handlers = $state->get_current_handlers ();
my $start_handlers = $handlers->get_start_handlers ();
- if (defined ($start_handlers))
+ if ($start_handlers->has_method_for ($elem))
{
- if ($start_handlers->has_method_for ($elem))
+ my $method = $start_handlers->get_method_for ($elem);
+ my $subhandlers = $handlers->get_subhandlers_for ($elem);
+
+ if (defined ($subhandlers))
{
- my $method = $start_handlers->get_method_for ($elem);
- my $subhandlers = $handlers->get_subhandlers_for ($elem);
-
- if (defined ($subhandlers))
- {
- $state->push_handlers ($subhandlers);
- return $handlers->$method ($self, @atts_vals);
- }
- # TODO: internal error - wrong implementation of get_subhandlers_for?
- _print_error ($state, 'Internal error - wrong implementation of get_subhandlers_for?', $elem);
- exit (1);
+ $state->push_handlers ($subhandlers);
+ return $handlers->$method ($self, @attval);
}
- # TODO: unknown elem?
- _print_error ($state, 'Unknown tag: ' . $elem . '.', $elem);
- exit (1);
+ # TODO: internal error - wrong implementation of get_subhandlers_for?
}
- _print_error ($state, 'No start handlers: ' . $elem . '.', $elem);
- exit (1);
+ # TODO: unknown elem?
}
sub _end ($$$)
{
my ($self, undef, $elem) = @_;
- my $state = $self->get_current_state ();
+ my $state = $self->{'current_state'};
$state->pop_handlers ();
my $handlers = $state->get_current_handlers ();
- unless (defined $handlers)
- {
- _print_error ($state, 'No handlers for tag: ' . $elem . '.', $elem);
- exit (1);
- }
my $end_handlers = $handlers->get_end_handlers ();
if ($end_handlers->has_method_for ($elem))
@@ -133,8 +65,7 @@ sub _end ($$$)
return $handlers->$method ($self);
}
- _print_error ($state, 'Unknown tag: ' . $elem . '.', $elem);
- exit (1);
+ # TODO: unknown elem?
}
#
@@ -149,7 +80,8 @@ sub new($)
{
'states_stack' => [],
'parsed_girs' => {},
- 'api' => {}, # TODO: replace with Gir::Api->new () or something like that.
+ 'state' => undef,
+ 'api' => {} # TODO: replace with Gir::Api->new () or something like that.
};
return bless ($self, $class);
@@ -158,7 +90,7 @@ sub new($)
sub _create_xml_parser ($)
{
my $self = shift;
- my $xml_parser = XML::Parser::Expat->new ();
+ my $xml_parser = XML::Parser->new ();
#TODO: implement commented methods.
$xml_parser->setHandlers
@@ -167,6 +99,8 @@ sub _create_xml_parser ($)
# Comment => sub { $self->_comment (@_); },
# Default => sub { $self->_default (@_); },
End => sub { $self->_end (@_); },
+ Final => sub { $self->_final (@_); },
+ Init => sub { $self->_init (@_); },
Start => sub { $self ->_start (@_); },
# XMLDecl => sub { $self->_xmldecl (@_); }
);
@@ -181,20 +115,11 @@ sub parse_file ($$)
unless (exists ($parsed_girs->{$filename}))
{
- my $real_filename = File::Spec->catfile (Gir::Config::get_girdir(), $filename);
+ my $real_filename = File::Spec->catfile (GirConfig::get_girdir(), $filename);
my $xml_parser = $self->_create_xml_parser ();
- my $new_state = Gir::State->new ($real_filename, $xml_parser);
- my $states_stack = $self->{'states_stack'};
$parsed_girs->{$filename} = undef;
- push (@{$states_stack}, $new_state);
-
- my $contents = _get_file_contents_as_utf8 ($real_filename);
-
- $xml_parser->parse ($contents);
- $xml_parser->release ();
- pop (@{$states_stack});
- #print STDOUT 'Parsed ' . $real_filename . "\n";
+ $xml_parser->parsefile ($real_filename);
}
}
@@ -205,12 +130,4 @@ sub get_api ($)
return $self->{'api'};
}
-sub get_current_state ($)
-{
- my $self = shift;
- my $states_stack = $self->{'states_stack'};
-
- return $states_stack->[-1];
-}
-
1;
diff --git a/tools/pm/Gir/State.pm b/tools/pm/Gir/State.pm
index 6fafebb..18cfd01 100644
--- a/tools/pm/Gir/State.pm
+++ b/tools/pm/Gir/State.pm
@@ -7,16 +7,13 @@ use Gir::Handlers::TopLevel;
##
## public:
##
-sub new ($$$)
+sub new ($)
{
- my ($type, $parsed_file, $xml_parser) = @_;
+ my $type = shift;
my $class = (ref ($type) or $type or 'Gir::State');
my $self =
{
- 'handlers_stack' => [Gir::Handlers::TopLevel->new ()],
- 'current_namespace' => undef,
- 'parsed_file' => $parsed_file,
- 'xml_parser' => $xml_parser
+ 'handlers_stack' => [Gir::Handlers::TopLevel->new ()]
};
return bless ($self, $class);
@@ -46,32 +43,4 @@ sub get_current_handlers ($)
return ${handlers_stack}->[-1];
}
-sub get_current_namespace ($)
-{
- my $self = shift;
-
- return $self->{'current_namespace'};
-}
-
-sub set_current_namespace ($$)
-{
- my ($self, $namespace) = @_;
-
- $self->{'current_namespace'} = $namespace;
-}
-
-sub get_parsed_file ($)
-{
- my $self = shift;
-
- return $self->{'parsed_file'};
-}
-
-sub get_xml_parser ($)
-{
- my $self = shift;
-
- return $self->{'xml_parser'};
-}
-
1;
diff --git a/tools/pm/Gir/metadata b/tools/pm/Gir/metadata
index 2d0e6b5..872f140 100644
--- a/tools/pm/Gir/metadata
+++ b/tools/pm/Gir/metadata
@@ -12,21 +12,20 @@ ATTR_FUNC: name c:identifier ?version? ?introspectable? ?deprecated? ?deprecated
alias: name c:type
array: ?zero-terminated? c:type ?fixed-size? ?length? // length is actually an index of parameter describing its length; fixed-size us specified for array[];
-bitfield: name c:type ?version? ?glib:type-name? ?glib:get-type?
-callback: name c:type ?deprecated? ?deprecated-version? ?introspectable? ?version? ?throws?
-class: name c:symbol-prefix glib:type-name glib:get-type ?abstract? ?c:type? ?version? ?glib:type-struct? ?parent?]
-constant: name value
+bitfield: name ?version? glib:type-name glib:get-type c:type
+callback: name ?c:type? ?introspectable? ?version? ??deprecated?? ??deprecated-version??
+class: name, c:symbol-prefix, c:type, parent, abstract, glib:type-name, glib:get-type
constructor: name c:identifier ?version? ?deprecated? ?deprecated-version?
c:include: {ignored}
doc: // none important
-enumeration: name c:type ?version? ?glib:type-name? ?glib:get-type? ?glib:error-quark? ?deprecated? ?deprecated-version?
+enumeration: name ?version? glib:type-name glib:get-type c:type
field: name ?writable? ?introspectable? ?readable? ?private?
-function: name c:identifier ?introspectable? ?deprecated? ?deprecated-version? ?throws? ?version? ?shadowed-by? ?shadows?
+function: ATTR_FUNC
glib:signal: name when ?detailed? ?version? ??deprecated?? ??deprecated-version??
implements: name
implementation: {ignored}
include: name version
-interface: name c:symbol-prefix c:type glib:type-name glib:get-type ?glib:type-struct? ?version?
+interface: name c:symbol-prefix c:type glib:type-name glib:get-type glib:type-struct ?version?
member: name value c:identifier glib:nick
method: ATTR_FUNC
namespace: name, version, shared-library, c:identifier-prefixes, c:symbol-prefixes
@@ -35,12 +34,11 @@ parameters: // none
parameter: name transfer-ownership ?allow-none? ?direction? ?caller-allocates?
prerequisite: name
property: name ?writable? ?construct-only? transfer-ownership ?version? ?readable? ?construct?
-record: name c:type ?glib:type-name? ?version? ?c:symbol-prefix? ?glib:get-type? ?glib:is-gtype-struct-for? ?disguised? ?introspectable? ?foreign?
-repository: version xmlns xmlns:c xmlns:glib
+record: name c:type ?disguised? ?glib:type-name? ?glib:get-type? ?c:symbol-prefix? ?glib:is-gtype-struct-for? ?version?
+repository: version
return-value: transfer-ownership
type: name ?c:type?
virtual-method: name ?introspectable? ?invoker? ?version? ?throws? ??deprecated?? ??deprecated-version??
-union: name c:type ?glib:type-name? ?c:symbol-prefix? ?glib:get-type?
==============
TAGS HIERARCHY
@@ -111,9 +109,6 @@ repository 1
| | `-FUNC_COMMON 1
| +-callback n
| | `-FUNC_COMMON 1
-| +-union n
-| | +-CLASS_COMMON 1
-| | `-constructor n
| +-alias n
| | `-TYPE_COMMON 1
| `-constant n
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]