blob: aef72c395305d3e436a6a8030e23a5f6c17498b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
package Object;
use strict;
use warnings;
BEGIN {
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
# set the version for version checking
$VERSION = 1.00;
@ISA = qw(Exporter);
@EXPORT = ( );
%EXPORT_TAGS = ( );
# your exported package globals go here,
# as well as any optionally exported functions
@EXPORT_OK = ( );
}
our @EXPORT_OK;
# class Object
# {
# string name;
# string module;
# string parent;
# string c_name;
# string gtype_id;
# }
sub new
{
my ($def) = @_;
my $self = {};
bless $self;
$def =~ s/^\(//;
$def =~ s/\)$//;
# snarf down the fields
$$self{name} = $1 if($def =~ s/^define-object (\S+)//);
$$self{module} = $1 if($def =~ s/\(in-module "(\S+)"\)//);
$$self{parent} = $1 if($def =~ s/\(parent "(\S+)"\)//);
$$self{c_name} = $1 if($def =~ s/\(c-name "(\S+)"\)//);
$$self{gtype_id} = $1 if($def =~ s/\(gtype-id "(\S+)"\)//);
if($def !~ /^\s*$/)
{
GtkDefs::error("Unhandled object def ($def) in $$self{module}\::$$self{name}\n")
}
return $self;
}
sub dump($)
{
my ($self) = @_;
print "<object>\n";
foreach(keys %$self)
{ print " <$_ value=\"$$self{$_}\"/>\n"; }
print "</object>\n\n";
}
1; # indicate proper module load.
|