init
This commit is contained in:
452
squashfs-root/usr/lib/glibmm-2.4/proc/generate_wrap_init.pl
Executable file
452
squashfs-root/usr/lib/glibmm-2.4/proc/generate_wrap_init.pl
Executable file
@@ -0,0 +1,452 @@
|
||||
#! /usr/bin/perl
|
||||
#
|
||||
# tools/generate_wrap_init.pl. Generated from generate_wrap_init.pl.in by configure.
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
my @namespace_whole = (); # list of strings.
|
||||
my $function_prefix = "";
|
||||
my $parent_dir = ""; # e.g. gtkmm
|
||||
my $debug = 0;
|
||||
my %objects = (); # Hashmap of arrays of objects (classes) in each file
|
||||
my %exceptions = (); # Hashmap of arrays of exception classes in each file
|
||||
my %conditional_compilation = ();
|
||||
my %deprecated = ();
|
||||
my %extra_includes = ();
|
||||
|
||||
# Hashmap telling if the registration of the classes in a file should not be
|
||||
# included in the wrap_init() function. (This is useful for modules such as
|
||||
# gstreamermm that want to exclude plug-in types from being registered in their
|
||||
# wrap_init() function.)
|
||||
my %exclude_from_wrap_init = ();
|
||||
|
||||
# The keys in all hashes except %extra_includes are names of header files (xyz.h),
|
||||
# corresponding to the read .hg files.
|
||||
#
|
||||
# The keys in %extra_includes are names of header files to include without reading.
|
||||
# %extra_includes is a hash rather than a list because we don't want duplicates.
|
||||
# Its values are not used. In C++ it would have been a std::set.
|
||||
|
||||
# $objects{$filename_header} is a reference to an array. That array contains
|
||||
# references to arrays with two or more elements, ($cppname, $basename, @extra_namespace),
|
||||
# one reference per object defined in file $filename_header.
|
||||
# %exceptions has the same structure as %objects.
|
||||
|
||||
sub print_with_guards
|
||||
{
|
||||
my $file = $_[0];
|
||||
my $message = $_[1];
|
||||
if ($deprecated{$file})
|
||||
{
|
||||
# The uc(parent_dir) is a bit of a hack. One day it will get it wrong.
|
||||
print "#ifndef " . uc($parent_dir) ."_DISABLE_DEPRECATED\n"
|
||||
}
|
||||
|
||||
if ($conditional_compilation{$file})
|
||||
{
|
||||
print "#$conditional_compilation{$file}\n"
|
||||
}
|
||||
|
||||
print "$message";
|
||||
|
||||
if ($conditional_compilation{$file})
|
||||
{
|
||||
print "#endif // $conditional_compilation{$file}\n"
|
||||
}
|
||||
|
||||
if ($deprecated{$file})
|
||||
{
|
||||
print "#endif // *_DISABLE_DEPRECATED\n"
|
||||
}
|
||||
}
|
||||
|
||||
# Loop through command line flags, setting variables:
|
||||
while ($ARGV[0] =~ /^-/)
|
||||
{
|
||||
if ($ARGV[0] =~ /--namespace=(\S+)/)
|
||||
{
|
||||
push(@namespace_whole, split('::', $1));
|
||||
|
||||
if($parent_dir eq "")
|
||||
{ $parent_dir = lc($1) . "mm"; }
|
||||
}
|
||||
elsif ($ARGV[0] =~ /--function_prefix=(\S+)/)
|
||||
{
|
||||
$function_prefix = "$1";
|
||||
}
|
||||
elsif ($ARGV[0] =~ /--parent_dir=(\S+)/)
|
||||
{
|
||||
$parent_dir = "$1";
|
||||
}
|
||||
elsif ($ARGV[0] =~ /--debug/)
|
||||
{
|
||||
$debug = 1;
|
||||
}
|
||||
elsif ($ARGV[0] =~ /--path=(\S+)/)
|
||||
{
|
||||
# Do nothing. Just for backwards compatibility.
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Error: unknown option $ARGV[0]\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
shift @ARGV;
|
||||
}
|
||||
|
||||
# Loop through remaining command line arguments, names of .hg files.
|
||||
while ($ARGV[0])
|
||||
{
|
||||
if ($debug) {warn "Processing file : $ARGV[0]\n";}
|
||||
|
||||
my $filename = $ARGV[0];
|
||||
open FILE, $filename or die "Couldn't open file $filename : $!\n";
|
||||
|
||||
# Store header filename, so we can #include it later:
|
||||
my $filename_header = $filename;
|
||||
$filename_header =~ s#.*/([^/]+)\.hg#$1.h#;
|
||||
$conditional_compilation{$filename_header} = "";
|
||||
$deprecated{$filename_header} = 0;
|
||||
|
||||
# Keep track of sub-namespaces, if any.
|
||||
# Otherwise we can't tell the difference between Gio::Error and Gio::DBus::Error.
|
||||
my @extra_namespace = ();
|
||||
|
||||
while (<FILE>)
|
||||
{
|
||||
# Skip comments.
|
||||
# This is far from foolproof. It only skips one-line comments, and it does
|
||||
# not try to skip quoted strings.
|
||||
s#//.*##;
|
||||
s#/\*.*?\*/##g;
|
||||
|
||||
# This is useful when only some classes use a sub-namespace.
|
||||
# Alternatively, we could parse the namespace start and end parentheses,
|
||||
# but this hack is easier.
|
||||
if (/\b_GMMPROC_EXTRA_NAMESPACE\((\w+)\)/)
|
||||
{
|
||||
# debug: print "generate_wrap_init: namespace found: $1\n";
|
||||
push(@extra_namespace, $1);
|
||||
}
|
||||
elsif (/\b(_CLASS_GOBJECT|_CLASS_GTKOBJECT|_WRAP_GERROR)\s*\(/)
|
||||
{
|
||||
my $type_of_class = $1;
|
||||
my $line = $_;
|
||||
while ($line !~ /\)/ && ($_ = <FILE>))
|
||||
{
|
||||
$line .= $_;
|
||||
}
|
||||
if (!$_)
|
||||
{
|
||||
die "Reached end of file $filename in $type_of_class macro. " .
|
||||
"(No right parenthesis.)\n";
|
||||
}
|
||||
|
||||
$line =~ s/^.*$type_of_class\s*\(//;
|
||||
$line =~ s/\s+//g;
|
||||
$line =~ s/\).*//;
|
||||
my ($cppname, $cname, $ccast) = split(/,/, $line);
|
||||
my $basename = lc($ccast);
|
||||
my @names = ($cppname, $basename, @extra_namespace);
|
||||
|
||||
if ($type_of_class eq "_CLASS_GOBJECT" or
|
||||
($type_of_class eq "_CLASS_GTKOBJECT" and
|
||||
#TODO: Remove this hack eventually.
|
||||
($cname ne "GtkTree" && $cname ne "GtkTreeItem" && $cname ne "GtkText")))
|
||||
{
|
||||
push(@{$objects{$filename_header}}, \@names);
|
||||
}
|
||||
elsif ($type_of_class eq "_WRAP_GERROR")
|
||||
{
|
||||
push(@{$exceptions{$filename_header}}, \@names);
|
||||
}
|
||||
}
|
||||
elsif (/\b_INCLUDE_IN_WRAP_INIT\((.+)\)/)
|
||||
{
|
||||
$extra_includes{$1} = 1;
|
||||
}
|
||||
elsif (/\b_GTKMMPROC_WIN32_NO_WRAP\b/)
|
||||
{
|
||||
# This file will not be compiled on Win32.
|
||||
# No extra include is required. If G_OS_WIN32 is defined, it's defined in
|
||||
# a file included indirectly by glibmm.h.
|
||||
$conditional_compilation{$filename_header} = "ifndef G_OS_WIN32";
|
||||
}
|
||||
elsif (/\b_GMMPROC_WRAP_CONDITIONALLY\((.+)\)/)
|
||||
{
|
||||
# The compilation of this file will be controlled by a preprocessor directive.
|
||||
|
||||
# Allow m4 quotes in the parameter. There may be cases where the m4 processor
|
||||
# would misunderstand a parameter without quotes.
|
||||
my $par = $1;
|
||||
$par =~ s/^\s*`*\s*//; # Remove m4 quotes and leading and trailing white space.
|
||||
$par =~ s/\s*'*\s*$//;
|
||||
$conditional_compilation{$filename_header} = $par;
|
||||
}
|
||||
elsif (/\b_IS_DEPRECATED\b/)
|
||||
{
|
||||
$deprecated{$filename_header} = 1; # This file is deprecated
|
||||
}
|
||||
elsif (/\b_NO_WRAP_INIT_REGISTRATION\b/)
|
||||
{
|
||||
$exclude_from_wrap_init{$filename_header} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
shift @ARGV;
|
||||
close(FILE);
|
||||
}
|
||||
|
||||
|
||||
# Print the wrap_init.cc file.
|
||||
|
||||
print << "EOF";
|
||||
// Generated by generate_wrap_init.pl -- DO NOT MODIFY!
|
||||
|
||||
#define GLIBMM_INCLUDED_FROM_WRAP_INIT_CC
|
||||
#include <glibmm.h>
|
||||
|
||||
// Disable the 'const' function attribute of the get_type() functions.
|
||||
// GCC would optimize them out because we don't use the return value.
|
||||
#undef G_GNUC_CONST
|
||||
#define G_GNUC_CONST /* empty */
|
||||
|
||||
#include <${parent_dir}/wrap_init.h>
|
||||
#include <glibmm/error.h>
|
||||
#include <glibmm/object.h>
|
||||
EOF
|
||||
|
||||
foreach my $filename_header (sort keys %extra_includes)
|
||||
{
|
||||
print "#include <$filename_header>\n";
|
||||
}
|
||||
|
||||
print "\n// #include the widget headers so that we can call the get_type() static methods:\n";
|
||||
|
||||
# keys %deprecated contains all filenames, not just the names of deprecated files.
|
||||
foreach my $filename_header (sort keys %deprecated)
|
||||
{
|
||||
next if($exclude_from_wrap_init{$filename_header});
|
||||
print_with_guards($filename_header, "#include \"$filename_header\"\n");
|
||||
}
|
||||
|
||||
# Declarations of glib functions.
|
||||
|
||||
print "\nextern \"C\"\n";
|
||||
print "{\n";
|
||||
print "//Declarations of the *_get_type() functions:\n\n";
|
||||
|
||||
foreach my $filename_header (sort keys %objects)
|
||||
{
|
||||
next if($exclude_from_wrap_init{$filename_header});
|
||||
|
||||
my @objects_in_file = @{$objects{$filename_header}};
|
||||
my $message = "";
|
||||
foreach my $i (@objects_in_file)
|
||||
{
|
||||
# $i is a reference to an array with info on one object, declared in file $filename_header.
|
||||
my $basename = ${$i}[1];
|
||||
$message .= "GType ${basename}_get_type(void);\n";
|
||||
}
|
||||
print_with_guards($filename_header, $message);
|
||||
}
|
||||
|
||||
print "\n//Declarations of the *_error_quark() functions:\n\n";
|
||||
|
||||
foreach my $filename_header (sort keys %exceptions)
|
||||
{
|
||||
my @exceptions_in_file = @{$exceptions{$filename_header}};
|
||||
my $message = "";
|
||||
foreach my $i (@exceptions_in_file)
|
||||
{
|
||||
# $i is a reference to an array with info on one exception, declared in file $filename_header.
|
||||
my $basename = ${$i}[1];
|
||||
$message .= "GQuark ${basename}_quark(void);\n";
|
||||
}
|
||||
print_with_guards($filename_header, $message);
|
||||
}
|
||||
|
||||
print "} // extern \"C\"\n";
|
||||
print "\n";
|
||||
|
||||
my $namespace_whole_declarations = "";
|
||||
my $namespace_whole_close = "";
|
||||
foreach (@namespace_whole)
|
||||
{
|
||||
$namespace_whole_declarations .= "namespace $_ {\n";
|
||||
$namespace_whole_close = "} // $_\n$namespace_whole_close";
|
||||
}
|
||||
|
||||
print "$namespace_whole_declarations";
|
||||
|
||||
print "\n//Declarations of the *_Class::wrap_new() methods, instead of including all the private headers:\n\n";
|
||||
|
||||
foreach my $filename_header (sort keys %objects)
|
||||
{
|
||||
next if($exclude_from_wrap_init{$filename_header});
|
||||
|
||||
my @objects_in_file = @{$objects{$filename_header}};
|
||||
my $message = "";
|
||||
foreach my $i (@objects_in_file)
|
||||
{
|
||||
my ($cppname, undef, @extra_namespace) = @{$i};
|
||||
|
||||
my $namespace_declarations = "";
|
||||
my $namespace_close = "";
|
||||
foreach (@extra_namespace)
|
||||
{
|
||||
$namespace_declarations .= "namespace $_ { ";
|
||||
$namespace_close .= " }";
|
||||
}
|
||||
|
||||
$message .= "${namespace_declarations}class ${cppname}_Class " .
|
||||
"{ public: static Glib::ObjectBase* wrap_new(GObject*); };$namespace_close\n";
|
||||
}
|
||||
print_with_guards($filename_header, $message);
|
||||
}
|
||||
|
||||
# wrap_init() calls throw_func() in each exception class. throw_func() is a
|
||||
# private method. wrap_init() is declared as a friend of the exception class.
|
||||
# The friends will find each other easily only if the calling wrap_init()
|
||||
# function is declared in the same namespace as the exception class.
|
||||
# If there are extra namespaces, we define extra wrap_init() functions, which
|
||||
# are called from the wrap_init() function in @namespace_whole.
|
||||
|
||||
my %extra_namespaces = ();
|
||||
foreach my $filename_header (keys %exceptions)
|
||||
{
|
||||
my @exceptions_in_file = @{$exceptions{$filename_header}};
|
||||
foreach my $i (@exceptions_in_file)
|
||||
{
|
||||
if (@{$i} > 2)
|
||||
{
|
||||
my (undef, undef, @extra_namespace) = @{$i};
|
||||
$extra_namespaces{join("::", @extra_namespace)} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Generate the extra wrap_init() functions in sub-namespaces, if any.
|
||||
|
||||
# If you suspect that code with three levels of foreach is inefficient, you are
|
||||
# probably right, but it's not important here. The exception classes are few in
|
||||
# most modules (hardly more than about 10), and the sub-namespaces are even
|
||||
# fewer (usually 0 or 1).
|
||||
|
||||
print "\n// Register Error domains in sub-namespaces:\n" if keys %extra_namespaces > 0;
|
||||
|
||||
foreach my $sub_namespace (sort keys %extra_namespaces)
|
||||
{
|
||||
my @extra_namespace = split("::", $sub_namespace);
|
||||
my $namespace_declarations = "";
|
||||
my $namespace_close = "";
|
||||
foreach (@extra_namespace)
|
||||
{
|
||||
$namespace_declarations .= "namespace $_ {\n";
|
||||
$namespace_close = "} // $_\n$namespace_close";
|
||||
}
|
||||
|
||||
print "\n$namespace_declarations";
|
||||
print "\nvoid wrap_init()\n{\n";
|
||||
|
||||
foreach my $filename_header (sort keys %exceptions)
|
||||
{
|
||||
my @exceptions_in_file = @{$exceptions{$filename_header}};
|
||||
my $message = "";
|
||||
foreach my $i (@exceptions_in_file)
|
||||
{
|
||||
my ($cppname, $basename, @extra_namespace) = @{$i};
|
||||
if (@extra_namespace > 0 && $sub_namespace eq join("::", @extra_namespace))
|
||||
{
|
||||
$message .= " Glib::Error::register_domain(${basename}_quark(), &" .
|
||||
"${sub_namespace}::${cppname}::throw_func);\n";
|
||||
}
|
||||
}
|
||||
print_with_guards($filename_header, $message) if $message;
|
||||
}
|
||||
|
||||
print "\n} // wrap_init()\n";
|
||||
print "\n$namespace_close";
|
||||
}
|
||||
|
||||
# Generate namespace::wrap_init() body
|
||||
|
||||
print "\nvoid ${function_prefix}wrap_init()\n{\n";
|
||||
|
||||
print " // Register Error domains in the main namespace:\n";
|
||||
|
||||
foreach my $filename_header (sort keys %exceptions)
|
||||
{
|
||||
my @exceptions_in_file = @{$exceptions{$filename_header}};
|
||||
my $message = "";
|
||||
foreach my $i (@exceptions_in_file)
|
||||
{
|
||||
my ($cppname, $basename, @extra_namespace) = @{$i};
|
||||
if (@extra_namespace == 0)
|
||||
{
|
||||
$message .= " Glib::Error::register_domain(${basename}_quark(), &" .
|
||||
"${cppname}::throw_func);\n";
|
||||
}
|
||||
}
|
||||
print_with_guards($filename_header, $message) if $message;
|
||||
}
|
||||
|
||||
# Exception classes in sub-namespaces are registered after the ones in the main
|
||||
# namespace. If you ever change this order, check that it's ok with Glib::ThreadError
|
||||
# and Glib::Threads::ThreadError. Both these classes wrap GThreadError, and
|
||||
# Glib::ThreadError is deprecated (2012-02-27).
|
||||
|
||||
print "\n // Call the wrap_init() functions in sub-namespaces:\n" if keys %extra_namespaces > 0;
|
||||
|
||||
foreach my $sub_namespace (sort keys %extra_namespaces)
|
||||
{
|
||||
print " ${sub_namespace}::wrap_init();\n";
|
||||
}
|
||||
|
||||
print "\n";
|
||||
print " // Map gtypes to gtkmm wrapper-creation functions:\n";
|
||||
|
||||
foreach my $filename_header (sort keys %objects)
|
||||
{
|
||||
next if($exclude_from_wrap_init{$filename_header});
|
||||
|
||||
my @objects_in_file = @{$objects{$filename_header}};
|
||||
my $message = "";
|
||||
foreach my $i (@objects_in_file)
|
||||
{
|
||||
my ($cppname, $basename, @extra_namespace) = @{$i};
|
||||
my $qualified_cppname = join("::", (@extra_namespace, $cppname));
|
||||
$message .= " Glib::wrap_register(${basename}_get_type(), &" .
|
||||
"${qualified_cppname}_Class::wrap_new);\n";
|
||||
}
|
||||
print_with_guards($filename_header, $message);
|
||||
}
|
||||
|
||||
print "\n";
|
||||
print " // Register the gtkmm gtypes:\n";
|
||||
|
||||
foreach my $filename_header (sort keys %objects)
|
||||
{
|
||||
next if($exclude_from_wrap_init{$filename_header});
|
||||
|
||||
my @objects_in_file = @{$objects{$filename_header}};
|
||||
my $message = "";
|
||||
foreach my $i (@objects_in_file)
|
||||
{
|
||||
my ($cppname, $basename, @extra_namespace) = @{$i};
|
||||
my $qualified_cppname = join("::", (@extra_namespace, $cppname));
|
||||
$message .= " ${qualified_cppname}::get_type();\n"
|
||||
}
|
||||
print_with_guards($filename_header, $message);
|
||||
}
|
||||
|
||||
print << "EOF";
|
||||
|
||||
} // wrap_init()
|
||||
|
||||
$namespace_whole_close
|
||||
EOF
|
||||
|
||||
exit 0;
|
||||
239
squashfs-root/usr/lib/glibmm-2.4/proc/gmmproc
Executable file
239
squashfs-root/usr/lib/glibmm-2.4/proc/gmmproc
Executable file
@@ -0,0 +1,239 @@
|
||||
#! /usr/bin/perl
|
||||
#
|
||||
# tools/gmmproc. Generated from gmmproc.in by configure.
|
||||
#
|
||||
######################################################################
|
||||
# gmmproc (version 4)
|
||||
######################################################################
|
||||
#
|
||||
# *** WARNING: Only modify gmmproc.in. gmmproc is built. ***
|
||||
#
|
||||
# Copyright 2001, Karl Einar Nelson, Murray Cumming
|
||||
#
|
||||
# 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, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#
|
||||
# 'classes':
|
||||
# WrapParser: steps through .hg and .ccg files, outputting appropriate m4 code with Outputter.
|
||||
# Outputter: Used by WrapParser to output wrapper code. Outputs *.g1 temp file
|
||||
# and uses m4 to generate *.g2 from it. Then outputs .h and .cc files.
|
||||
# Function: Contains information about C and C++ functions and signals.
|
||||
#
|
||||
######################################################################
|
||||
|
||||
########################## 'main()' ##################################
|
||||
|
||||
$main::procdir;
|
||||
$main::m4path;
|
||||
$main::glibmm_version;
|
||||
|
||||
BEGIN {
|
||||
# get prefix info from configure
|
||||
my $prefix = "/usr";
|
||||
my $exec_prefix = "/usr";
|
||||
my $libdir = "${exec_prefix}/lib";
|
||||
|
||||
# This line must match the install directory
|
||||
$main::procdir = $libdir . '/glibmm-2.4/proc';
|
||||
$main::m4path = "m4";
|
||||
$main::glibmm_version = "2.54.1";
|
||||
|
||||
push(@INC, $main::procdir . '/pm');
|
||||
}
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Output;
|
||||
use WrapParser;
|
||||
|
||||
# initialize globals
|
||||
@main::macrodirs = ();
|
||||
$main::srcdir = '.';
|
||||
$main::defsdir = '.';
|
||||
$main::source = '';
|
||||
$main::unwrapped = 1;
|
||||
$main::return_mismatches = (exists $ENV{'GMMPROC_RETURN_MISMATCHES'}) ? $ENV{'GMMPROC_RETURN_MISMATCHES'} : 0;
|
||||
$main::debug = (exists $ENV{'GMMPROC_DEBUG'}) ? $ENV{'GMMPROC_DEBUG'} : '';
|
||||
|
||||
# prototypes
|
||||
sub parse_command_line_args();
|
||||
|
||||
#main()
|
||||
parse_command_line_args();
|
||||
|
||||
my $objOutputter = &Output::new($main::m4path, \@main::macrodirs);
|
||||
my $objWrapParser = &WrapParser::new($objOutputter);
|
||||
|
||||
$$objWrapParser{srcdir} = $main::srcdir;
|
||||
$$objWrapParser{defsdir} = $main::defsdir;
|
||||
$$objWrapParser{source} = $main::source;
|
||||
$$objOutputter{source} = $main::source;
|
||||
$$objOutputter{destdir} = $ARGV[1];
|
||||
|
||||
# Merge the C docs, e.g. gtk_docs.xml
|
||||
|
||||
# Suck the whole file into one big string, breaking it into tokens:
|
||||
$objWrapParser->read_file($main::srcdir, $main::source);
|
||||
|
||||
# Parse output
|
||||
$objWrapParser->parse_and_build_output();
|
||||
|
||||
# Write out *.g1 temporary file:
|
||||
$objOutputter->output_temp_g1($$objWrapParser{module}, $main::glibmm_version); # e.g. gtkmm, 2.38.0
|
||||
|
||||
# Execute m4 to get *.g2 file:
|
||||
{
|
||||
my $exitcode = $objOutputter->make_g2_from_g1();
|
||||
if ($exitcode)
|
||||
{
|
||||
$objOutputter->remove_temp_files() unless ($main::debug);
|
||||
|
||||
print STDERR "m4 failed with exit code $exitcode. Aborting...\n";
|
||||
exit($exitcode);
|
||||
}
|
||||
}
|
||||
|
||||
# Section out the resulting output
|
||||
$objOutputter->write_sections_to_files();
|
||||
$objOutputter->remove_temp_files() unless ($main::debug);
|
||||
|
||||
#Warn about any unwrapped function/signals:
|
||||
if ($main::unwrapped)
|
||||
{
|
||||
my @unwrapped = GtkDefs::get_unwrapped();
|
||||
@unwrapped = grep { exists $$_{entity_type} } @unwrapped;
|
||||
|
||||
if (@unwrapped)
|
||||
{
|
||||
my @methods = grep { $$_{entity_type} eq 'method' and $$_{c_name} !~ m/^_/s } @unwrapped;
|
||||
my @signals = grep { $$_{entity_type} eq 'signal' } @unwrapped;
|
||||
# Don't take non-readable construct-only properties into account.
|
||||
my @properties = grep { $$_{entity_type} eq 'property' and ( $$_{readable} or not $$_{construct_only} ) } @unwrapped;
|
||||
|
||||
# Don't print a name of any kind between the first and second colon on a line,
|
||||
# if there is any chance that "error" is (part of) the name.
|
||||
# MS Visual Studio will misunderstand.
|
||||
# See https://mail.gnome.org/archives/gtkmm-list/2014-November/msg00044.html
|
||||
|
||||
local $, = "\ngmmproc: ";
|
||||
local $\ = "\n";
|
||||
|
||||
if (@methods)
|
||||
{
|
||||
print STDERR ("gmmproc, $main::source: Unwrapped functions:",
|
||||
map($$_{c_name}, @methods));
|
||||
}
|
||||
if (@properties)
|
||||
{
|
||||
print STDERR ("gmmproc, $main::source: Unwrapped properties:",
|
||||
map($$_{class} . '::' . $$_{name}, @properties));
|
||||
}
|
||||
if (@signals)
|
||||
{
|
||||
print STDERR ("gmmproc, $main::source: Unwrapped signals:",
|
||||
map($$_{class} . '::' . $$_{name}, @signals));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# end of program
|
||||
exit;
|
||||
|
||||
|
||||
####################################################################
|
||||
|
||||
|
||||
sub print_usage()
|
||||
{
|
||||
print
|
||||
'Usage: gmmproc [options] name srcdir destdir
|
||||
-h
|
||||
--help This usage message.
|
||||
|
||||
--doc Produces a header file for documentation. (FIXME)
|
||||
|
||||
--debug Leave intermediate output arround for analysis.
|
||||
Alternatively, set GMMPROC_DEBUG=1 in the environment.
|
||||
|
||||
--unwrapped Warn about possible unwrapped functions.
|
||||
|
||||
--return-mismatches Warn about possible method return mismatches.
|
||||
|
||||
--defs dir Change the directory to seach for defs.
|
||||
|
||||
-I dir Specify the directory with m4 files.
|
||||
|
||||
|
||||
Note: This will read srcdir/name.{hg,ccg} file and generates destdir/name.cc
|
||||
';
|
||||
exit(1);
|
||||
}
|
||||
|
||||
# void parse_command_line_args()
|
||||
sub parse_command_line_args()
|
||||
{
|
||||
print_usage() if ($#ARGV == -1);
|
||||
|
||||
while ($#ARGV != -1)
|
||||
{
|
||||
$_ = shift @ARGV;
|
||||
|
||||
if (/^-/)
|
||||
{
|
||||
print_usage() if ( /^--help/);
|
||||
print_usage() if ( /^-h/);
|
||||
if (/^-I/)
|
||||
{
|
||||
push @main::macrodirs, shift @ARGV;
|
||||
}
|
||||
elsif (/^--unwrapped/)
|
||||
{
|
||||
$main::unwrapped = 1;
|
||||
}
|
||||
elsif (/^--return-mismatches/)
|
||||
{
|
||||
$main::return_mismatches = 1;
|
||||
}
|
||||
elsif (/^--defs/)
|
||||
{
|
||||
$main::defsdir = shift @ARGV;
|
||||
}
|
||||
elsif (/^--debug/)
|
||||
{
|
||||
$main::debug = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
print "unknown parameter $_\n";
|
||||
}
|
||||
next;
|
||||
}
|
||||
|
||||
last;
|
||||
}
|
||||
|
||||
# we already have one argument
|
||||
|
||||
if ($#ARGV != 1)
|
||||
{
|
||||
print STDERR ('Invalid number of arguments (', $#ARGV + 2, ")\n");
|
||||
print_usage();
|
||||
}
|
||||
|
||||
$main::srcdir = $ARGV[0];
|
||||
$main::source = $_;
|
||||
|
||||
push @main::macrodirs, $main::procdir . '/m4';
|
||||
}
|
||||
478
squashfs-root/usr/lib/glibmm-2.4/proc/m4/base.m4
Normal file
478
squashfs-root/usr/lib/glibmm-2.4/proc/m4/base.m4
Normal file
@@ -0,0 +1,478 @@
|
||||
dnl $Id$
|
||||
divert(-1)
|
||||
|
||||
dnl
|
||||
dnl The general convention is
|
||||
dnl _* are macros
|
||||
dnl __*__ are variables
|
||||
|
||||
dnl
|
||||
dnl rename several m4 builtins to avoid name clashes
|
||||
dnl
|
||||
|
||||
define(`_PREFIX_BUILTIN_ALIAS', `define(`m4_$1', defn(`$1'))')
|
||||
define(`_PREFIX_BUILTIN', `_PREFIX_BUILTIN_ALIAS(`$1')`'undefine(`$1')')
|
||||
|
||||
_PREFIX_BUILTIN(`builtin')
|
||||
_PREFIX_BUILTIN(`decr')
|
||||
_PREFIX_BUILTIN(`errprint')
|
||||
_PREFIX_BUILTIN(`esyscmd')
|
||||
_PREFIX_BUILTIN(`eval')
|
||||
_PREFIX_BUILTIN(`format')
|
||||
_PREFIX_BUILTIN(`incr')
|
||||
_PREFIX_BUILTIN(`index')
|
||||
_PREFIX_BUILTIN(`indir')
|
||||
_PREFIX_BUILTIN(`len')
|
||||
_PREFIX_BUILTIN(`maketemp')
|
||||
_PREFIX_BUILTIN(`syscmd')
|
||||
_PREFIX_BUILTIN(`substr')
|
||||
_PREFIX_BUILTIN(`sysval')
|
||||
_PREFIX_BUILTIN(`mkstemp')
|
||||
|
||||
dnl
|
||||
dnl More alternative names for m4 macros, not undefined (yet!).
|
||||
dnl
|
||||
|
||||
_PREFIX_BUILTIN_ALIAS(`changecom')
|
||||
_PREFIX_BUILTIN_ALIAS(`changequote')
|
||||
_PREFIX_BUILTIN_ALIAS(`define')
|
||||
_PREFIX_BUILTIN_ALIAS(`divert')
|
||||
_PREFIX_BUILTIN_ALIAS(`divnum')
|
||||
_PREFIX_BUILTIN_ALIAS(`ifdef')
|
||||
_PREFIX_BUILTIN_ALIAS(`ifelse')
|
||||
_PREFIX_BUILTIN_ALIAS(`include')
|
||||
_PREFIX_BUILTIN_ALIAS(`m4exit')
|
||||
_PREFIX_BUILTIN_ALIAS(`m4wrap')
|
||||
_PREFIX_BUILTIN_ALIAS(`patsubst')
|
||||
_PREFIX_BUILTIN_ALIAS(`popdef')
|
||||
_PREFIX_BUILTIN_ALIAS(`pushdef')
|
||||
_PREFIX_BUILTIN_ALIAS(`shift')
|
||||
_PREFIX_BUILTIN_ALIAS(`undefine')
|
||||
_PREFIX_BUILTIN_ALIAS(`undivert')
|
||||
_PREFIX_BUILTIN_ALIAS(`regexp')
|
||||
_PREFIX_BUILTIN_ALIAS(`translit')
|
||||
|
||||
dnl
|
||||
dnl Type Conversion Macros
|
||||
dnl
|
||||
|
||||
m4_include(convert.m4)
|
||||
|
||||
dnl
|
||||
dnl Initialization macros
|
||||
dnl
|
||||
|
||||
m4_include(initialize.m4)
|
||||
|
||||
dnl
|
||||
dnl ----------------------- Utility Macros -------------------------
|
||||
dnl
|
||||
|
||||
dnl
|
||||
dnl Add a comma before the arg if any, do nothing otherwise
|
||||
dnl _COMMA_PREFIX(a) -> ,a
|
||||
dnl _COMMA_PREFIX() -> `'
|
||||
dnl
|
||||
define(`_COMMA_PREFIX', `m4_ifelse(m4_eval(m4_len(`$*') >= 1), 1, `,$*')')dnl
|
||||
|
||||
dnl
|
||||
dnl Add a comma after the arg if any, do nothing otherwise
|
||||
dnl _COMMA_SUFFIX(a) -> a,
|
||||
dnl _COMMA_SUFFIX() -> `'
|
||||
dnl
|
||||
define(`_COMMA_SUFFIX', `m4_ifelse(m4_eval(m4_len(`$*') >= 1), 1, `$*,')')dnl
|
||||
|
||||
|
||||
dnl
|
||||
dnl _UPPER(string)
|
||||
dnl uppercase a string
|
||||
define(`_UPPER',`m4_translit(`$*',`abcdefghijklmnopqrstuvwxyz',`ABCDEFGHIJKLMNOPQRSTUVWXYZ')')
|
||||
|
||||
dnl
|
||||
dnl _LOWER(string)
|
||||
dnl lower a string
|
||||
define(`_LOWER',`m4_translit(`$*',`ABCDEFGHIJKLMNOPQRSTUVWXYZ',`abcdefghijklmnopqrstuvwxyz')')
|
||||
|
||||
dnl
|
||||
dnl _QUOTE(macro)
|
||||
dnl If a macro generates an output with commas we need to protect it
|
||||
dnl from being broken down and interpreted
|
||||
define(`_QUOTE',``$*'')
|
||||
|
||||
dnl
|
||||
dnl _NUM(arglist)
|
||||
dnl count number of arguments
|
||||
define(`_NUM',`m4_ifelse(m4_len(`$*'),0,0,`$#')')
|
||||
|
||||
dnl
|
||||
dnl For handling of included macro files.
|
||||
dnl
|
||||
|
||||
dnl _PUSH(section_name)
|
||||
dnl Uses pushdef() to redefine the __DIV__ macro
|
||||
dnl so that it diverts output to the section_name,
|
||||
dnl or discards it (-1) if no section_name is given.
|
||||
dnl _POP() uses __DIV__ for choosing diversion number.
|
||||
define(`_PUSH',`pushdef(`__DIV__',divnum)m4_divert(m4_ifelse($1,,-1,__SEC_$1))dnl`'')
|
||||
|
||||
dnl _POP(section_name)
|
||||
dnl Uses popdef() to go back to the previous definition of the __DIV__ macro.
|
||||
define(`_POP',`m4_divert(__DIV__)popdef(`__DIV__')dnl`'')
|
||||
|
||||
dnl _SECTION(section_name):
|
||||
dnl m4_divert() sends subsequent output to the specified file:
|
||||
define(`_SECTION',`m4_divert(__SEC_$1)dnl')
|
||||
|
||||
dnl _IMPORT(section_name):
|
||||
define(`_IMPORT',`m4_undivert(__SEC_$1)dnl')
|
||||
|
||||
dnl _GET_TYPE_FUNC(GtkWidget) -> gtk_widget_get_type()
|
||||
dnl The way the macro works is that (in the inner patsubst) it first finds
|
||||
dnl groups of caps, pre-pending an '_' to the groups . After (in the outer
|
||||
dnl patsubst), it finds pairs of a caps and a lowercase (like 'Fo' or 'Ba'),
|
||||
dnl also pre-pending an '_' to the pairs. Finally, it converts all characters
|
||||
dnl to lowercase (with the translit), removing the first '_' (with substr) and
|
||||
dnl appending _get_type(). This works with regular types like GtkWidget, but
|
||||
dnl also multi-cap types like GdkGCFooBar or GdkFOOBar.
|
||||
define(`_GET_TYPE_FUNC',`dnl
|
||||
m4_translit(m4_substr(m4_patsubst(m4_patsubst(`$1',`[A-Z][A-Z]+',`_\&'),`[A-Z][a-z]',`_\&'),1),`[A-Z]',`[a-z]')_get_type()`'dnl
|
||||
')
|
||||
|
||||
dnl Define a new diversion
|
||||
dnl In m4, m4_divert() selects the output file to be used for subsequent text output.
|
||||
dnl 0 is the normal output. We define extra output files with _NEW_SECTION().
|
||||
dnl This macro seems to redefine __SEC_COUNT as __SEC_COUNT+1, and also
|
||||
dnl define __SEC_<the macro argument> as __SEC_COUNT.
|
||||
dnl So it just sets that section identifier to the next number.
|
||||
|
||||
define(`__SEC_COUNT__',0)
|
||||
|
||||
define(`_NEW_SECTION',`dnl
|
||||
define(`__SEC_COUNT__',m4_eval(__SEC_COUNT__+1))dnl
|
||||
define(`__SEC_$1',__SEC_COUNT__)dnl
|
||||
')
|
||||
|
||||
|
||||
changequote([,])
|
||||
define([__BT__],[changequote(,)`changequote(`,')])
|
||||
define([__FT__],[changequote(,)'changequote(`,')])
|
||||
changequote(`,')
|
||||
|
||||
changecom()
|
||||
|
||||
dnl
|
||||
dnl ----------------------- Main Headers -------------------------
|
||||
dnl
|
||||
|
||||
_NEW_SECTION(SECTION_HEADER_FIRST)dnl Before any generated code
|
||||
_NEW_SECTION(SECTION_HEADER1) dnl header up to the first namespace
|
||||
_NEW_SECTION(SECTION_HEADER2) dnl header after the first namespace
|
||||
_NEW_SECTION(SECTION_HEADER3) dnl header after the first namespace
|
||||
_NEW_SECTION(SECTION_PHEADER) dnl private header
|
||||
_NEW_SECTION(SECTION_CC_PRE_INCLUDES) dnl section just before the includes
|
||||
_NEW_SECTION(SECTION_CC_INCLUDES) dnl section for additional includes
|
||||
_NEW_SECTION(SECTION_SRC_CUSTOM) dnl user supplied implementation
|
||||
_NEW_SECTION(SECTION_ANONYMOUS_NAMESPACE) dnl built implementation in anonymous namespace
|
||||
_NEW_SECTION(SECTION_SRC_GENERATED) dnl built implementation
|
||||
_NEW_SECTION(SECTION_CLASS1) dnl decl to _CLASS
|
||||
_NEW_SECTION(SECTION_CLASS2) dnl _CLASS to end of class
|
||||
_NEW_SECTION(SECTION_CC) dnl section for methods (in current namespace)
|
||||
|
||||
_NEW_SECTION(SECTION_CC_IMPLEMENTS_INTERFACES) dnl Calls SomeBaseInterface::add_interface(get_type()).
|
||||
_NEW_SECTION(SECTION_CC_MOVE_CONSTRUCTOR_INTERFACES) dnl Calls the base constructors
|
||||
_NEW_SECTION(SECTION_CC_MOVE_ASSIGNMENT_OPERATOR_INTERFACES) dnl Calls the base move assignment operator
|
||||
|
||||
dnl Virtual Functions and Default Signal Handlers (Very similar)
|
||||
_NEW_SECTION(SECTION_H_VFUNCS) dnl Declaration of vfunc hooks.
|
||||
_NEW_SECTION(SECTION_H_VFUNCS_CPPWRAPPER) dnl Convenience method, using C++ types, that just calls the vfunc.
|
||||
_NEW_SECTION(SECTION_H_DEFAULT_SIGNAL_HANDLERS) dnl Declaration of default signal handler' hooks.
|
||||
|
||||
_NEW_SECTION(SECTION_CC_DEFAULT_SIGNAL_HANDLERS)
|
||||
_NEW_SECTION(SECTION_CC_VFUNCS)
|
||||
_NEW_SECTION(SECTION_CC_VFUNCS_CPPWRAPPER) dnl Convenience method, using C++ types, that just calls the vfunc.
|
||||
|
||||
_NEW_SECTION(SECTION_PH_DEFAULT_SIGNAL_HANDLERS) dnl private class declaration
|
||||
_NEW_SECTION(SECTION_PH_VFUNCS) dnl private class declaration
|
||||
|
||||
_NEW_SECTION(SECTION_PCC_DEFAULT_SIGNAL_HANDLERS) dnl private class implementation
|
||||
_NEW_SECTION(SECTION_PCC_VFUNCS) dnl private class implementation
|
||||
|
||||
_NEW_SECTION(SECTION_PCC_CLASS_INIT_DEFAULT_SIGNAL_HANDLERS) dnl gtk+ class_init function
|
||||
_NEW_SECTION(SECTION_PCC_CLASS_INIT_VFUNCS) dnl gtk+ class_init function
|
||||
|
||||
|
||||
dnl Signal Proxies:
|
||||
dnl _NEW_SECTION(SECTION_H_SIGNALPROXIES) dnl signal member objects
|
||||
_NEW_SECTION(SECTION_CC_SIGNALPROXIES) dnl signal member objects
|
||||
|
||||
dnl Property Proxies:
|
||||
dnl _NEW_SECTION(SECTION_H_PROPERTYPROXIES)
|
||||
_NEW_SECTION(SECTION_CC_PROPERTYPROXIES)
|
||||
|
||||
dnl Just a hack for some GError wrappers:
|
||||
_NEW_SECTION(SECTION_H_GERROR_PRIVATE) dnl In the private part of the declaration.
|
||||
|
||||
_NEW_SECTION(SECTION_CC_INITIALIZE_CLASS_EXTRA) dnl For instance, to initialize special member data from all constructors. Not commonly used.
|
||||
|
||||
dnl _NEW_SECTION(PROXY)
|
||||
dnl _NEW_SECTION(SECTION_PCC_OBJECT_INIT) dnl gtk+ object_init function
|
||||
|
||||
|
||||
_NEW_SECTION(SECTION_CHECK)
|
||||
_NEW_SECTION(SECTION_USR)
|
||||
|
||||
dnl Used for documenting destructors if desired.
|
||||
_NEW_SECTION(SECTION_DTOR_DOCUMENTATION)
|
||||
|
||||
define(`_CHECK',`dnl
|
||||
_PUSH(SECTION_CHECK)
|
||||
$*
|
||||
_POP()
|
||||
')
|
||||
|
||||
dnl This macro is for including the config header before any code (such as
|
||||
dnl the #ifndef *_DISABLE_DEPRECATED in deprecated classes) is generated.
|
||||
define(`_CONFIGINCLUDE',`dnl
|
||||
_PUSH(SECTION_HEADER_FIRST)
|
||||
#include <$1>
|
||||
_POP()
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__FILENAME_CONFIGINCLUDE__',`$1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
dnl Start of processing
|
||||
dnl
|
||||
dnl _START(filename,module,module_canonical,glibmm_version) .e.g _START(button, gtkmm, gtkmm, 2.38.0)
|
||||
define(`_START',`dnl
|
||||
define(`__MODULE__',$2)dnl
|
||||
define(`__MODULE_CANONICAL__',$3)dnl
|
||||
define(`__HEADER_GUARD__',`_`'_UPPER(m4_translit(`$3`'_`'$1', `-', `_'))')dnl
|
||||
define(`__FILE__',$1)dnl
|
||||
define(`__DEPRECATION_GUARD__',`_UPPER($3)'`_DISABLE_DEPRECATED')dnl
|
||||
define(`__GLIBMM_VERSION__',$4)dnl
|
||||
_SECTION(SECTION_HEADER1)
|
||||
')
|
||||
|
||||
dnl Start deprecation of individual methods:
|
||||
define(`_DEPRECATE_IFDEF_START',`dnl
|
||||
#ifndef __DEPRECATION_GUARD__'
|
||||
)
|
||||
|
||||
dnl end deprecation of individual methods:
|
||||
define(`_DEPRECATE_IFDEF_END',`dnl
|
||||
#endif // __DEPRECATION_GUARD__'
|
||||
)
|
||||
|
||||
dnl begin optional deprecation of whole file
|
||||
define(`_DEPRECATE_IFDEF_CLASS_START',`dnl
|
||||
ifdef(`__BOOL_DEPRECATED__',`dnl
|
||||
_DEPRECATE_IFDEF_START',`dnl
|
||||
')
|
||||
')
|
||||
|
||||
dnl begin optional deprecation of whole file,
|
||||
dnl preceded by inclusion of config file
|
||||
dnl (the config file may define the __DEPRECATION_GUARD__)
|
||||
define(`_DEPRECATE_IFDEF_CLASS_CONFIG_START',`dnl
|
||||
ifdef(`__BOOL_DEPRECATED__',`dnl
|
||||
ifdef(`__FILENAME_CONFIGINCLUDE__',`dnl
|
||||
#include <__FILENAME_CONFIGINCLUDE__>',`dnl
|
||||
')
|
||||
_DEPRECATE_IFDEF_START',`dnl
|
||||
')
|
||||
')
|
||||
|
||||
dnl end optional deprecation of whole file
|
||||
define(`_DEPRECATE_IFDEF_CLASS_END',`dnl
|
||||
ifdef(`__BOOL_DEPRECATED__',`dnl
|
||||
_DEPRECATE_IFDEF_END',`dnl
|
||||
')
|
||||
')
|
||||
|
||||
dnl This does all the work of assembling the final output
|
||||
dnl
|
||||
dnl _END()
|
||||
dnl
|
||||
define(`_END',`dnl
|
||||
m4_divert(0)dnl
|
||||
#S 0 dnl Marks the beginning of the header file.
|
||||
|
||||
// Generated by gmmproc __GLIBMM_VERSION__ -- DO NOT MODIFY!
|
||||
#ifndef __HEADER_GUARD__`'_H
|
||||
#define __HEADER_GUARD__`'_H
|
||||
|
||||
_IMPORT(SECTION_HEADER_FIRST)
|
||||
|
||||
_DEPRECATE_IFDEF_CLASS_START
|
||||
|
||||
m4_ifelse(__MODULE__,glibmm,,`dnl else
|
||||
#include <glibmm/ustring.h>
|
||||
#include <sigc++/sigc++.h>
|
||||
')dnl
|
||||
_IMPORT(SECTION_HEADER1)
|
||||
_IMPORT(SECTION_HEADER2)
|
||||
_IMPORT(SECTION_HEADER3)
|
||||
|
||||
_DEPRECATE_IFDEF_CLASS_END
|
||||
|
||||
#endif /* __HEADER_GUARD__`'_H */
|
||||
|
||||
#S 1 dnl Marks the beginning of the private header file.
|
||||
|
||||
// Generated by gmmproc __GLIBMM_VERSION__ -- DO NOT MODIFY!
|
||||
#ifndef __HEADER_GUARD__`'_P_H
|
||||
#define __HEADER_GUARD__`'_P_H
|
||||
_DEPRECATE_IFDEF_CLASS_START
|
||||
_IMPORT(SECTION_PHEADER)
|
||||
_DEPRECATE_IFDEF_CLASS_END
|
||||
#endif /* __HEADER_GUARD__`'_P_H */
|
||||
|
||||
#S 2 dnl Marks the beginning of the source file.
|
||||
|
||||
// Generated by gmmproc __GLIBMM_VERSION__ -- DO NOT MODIFY!
|
||||
|
||||
_IMPORT(SECTION_CC_PRE_INCLUDES)
|
||||
|
||||
_DEPRECATE_IFDEF_CLASS_CONFIG_START
|
||||
|
||||
#include <glibmm.h>
|
||||
|
||||
#include <__MODULE__/__FILE__.h>
|
||||
#include <__MODULE__/private/__FILE__`'_p.h>
|
||||
|
||||
_IMPORT(SECTION_CC_INCLUDES)
|
||||
|
||||
_IMPORT(SECTION_SRC_CUSTOM)
|
||||
|
||||
namespace
|
||||
{
|
||||
_IMPORT(SECTION_ANONYMOUS_NAMESPACE)
|
||||
} // anonymous namespace
|
||||
|
||||
_IMPORT(SECTION_SRC_GENERATED)
|
||||
_DEPRECATE_IFDEF_CLASS_END
|
||||
|
||||
m4_divert(-1)
|
||||
m4_undivert
|
||||
')
|
||||
|
||||
define(`_NAMESPACE',`dnl
|
||||
_PUSH()
|
||||
m4_ifdef(`__NAMESPACE__',`dnl
|
||||
pushdef(`__NAMESPACE__',__NAMESPACE__`::'$1)
|
||||
pushdef(`__NAMESPACE_BEGIN__',__NAMESPACE_BEGIN__`
|
||||
|
||||
namespace '$1`
|
||||
{')
|
||||
pushdef(`__NAMESPACE_END__',`} // namespace '$1`
|
||||
|
||||
'__NAMESPACE_END__)
|
||||
',`dnl else
|
||||
pushdef(`__NAMESPACE__',$1)
|
||||
pushdef(`__NAMESPACE_BEGIN__',`namespace '$1`
|
||||
{')
|
||||
pushdef(`__NAMESPACE_END__',`} // namespace '$1)
|
||||
')dnl endif __NAMESPACE__
|
||||
_POP()
|
||||
')dnl enddef _NAMESPACE
|
||||
|
||||
define(`_END_NAMESPACE',`dnl
|
||||
_PUSH()
|
||||
popdef(`__NAMESPACE__')
|
||||
popdef(`__NAMESPACE_BEGIN__')
|
||||
popdef(`__NAMESPACE_END__')
|
||||
_POP()
|
||||
')dnl enddef _END_NAMESPACE
|
||||
|
||||
define(`_INCLUDE_FLAG',`__FLAG_$1_INCLUDE_`'_UPPER(m4_translit(`$2',`/.-',`___'))__')dnl
|
||||
|
||||
define(`_PH_INCLUDE',`dnl
|
||||
m4_ifdef(_INCLUDE_FLAG(PH,`$*'),,`dnl else
|
||||
define(_INCLUDE_FLAG(PH,`$*'))dnl
|
||||
_PUSH(SECTION_PHEADER)
|
||||
#include <$*>
|
||||
_POP()
|
||||
')dnl endif
|
||||
')dnl
|
||||
|
||||
define(`_CC_INCLUDE',`dnl
|
||||
m4_ifdef(_INCLUDE_FLAG(CC,`$*'),,`dnl else
|
||||
define(_INCLUDE_FLAG(CC,`$*'))dnl
|
||||
_PUSH(SECTION_CC_INCLUDES)
|
||||
#include <$*>
|
||||
_POP()
|
||||
')dnl endif
|
||||
')dnl
|
||||
|
||||
define(`_PINCLUDE', defn(`_PH_INCLUDE'))
|
||||
|
||||
# Put these, for instance, around gtkmmproc macros (_WRAP_SIGNAL)
|
||||
# to make the #ifndef appear around the generated code in both the .h
|
||||
# and .cc files.
|
||||
# e.g. _GTKMMPROC_H_AND_CC(#ifndef _SUN_CC_)
|
||||
# e.g. _GTKMMPROC_H_AND_CC(#endif //_SUN_CC_)
|
||||
# _GTKMMPROC_H_AND_CC(code)
|
||||
define(`_GTKMMPROC_H_AND_CC',`dnl
|
||||
$1
|
||||
_PUSH(SECTION_CC)
|
||||
$1
|
||||
|
||||
_POP()
|
||||
')dnl
|
||||
|
||||
# Same thing as _GTKMMPROC_H_AND_CC but for signals (_WRAP_SIGNAL)
|
||||
define(`_GTKMMPROC_SIGNAL_H_AND_CC',`dnl
|
||||
$1
|
||||
_PUSH(SECTION_ANONYMOUS_NAMESPACE)
|
||||
$1
|
||||
_POP()
|
||||
|
||||
$1
|
||||
_PUSH(SECTION_H_DEFAULT_SIGNAL_HANDLERS)
|
||||
$1
|
||||
_POP()
|
||||
|
||||
$1
|
||||
_PUSH(SECTION_PCC_CLASS_INIT_DEFAULT_SIGNAL_HANDLERS)
|
||||
$1
|
||||
_POP()
|
||||
|
||||
$1
|
||||
_PUSH(SECTION_CC_DEFAULT_SIGNAL_HANDLERS)
|
||||
$1
|
||||
_POP()
|
||||
|
||||
$1
|
||||
_PUSH(SECTION_PCC_DEFAULT_SIGNAL_HANDLERS)
|
||||
$1
|
||||
_POP()
|
||||
|
||||
$1
|
||||
_PUSH(SECTION_CC_SIGNALPROXIES)
|
||||
$1
|
||||
_POP()
|
||||
')dnl
|
||||
|
||||
m4_include(class_shared.m4)
|
||||
m4_include(class_generic.m4)
|
||||
m4_include(class_gobject.m4)
|
||||
dnl m4_include(class_gtkobject.m4)
|
||||
m4_include(class_boxedtype.m4)
|
||||
m4_include(class_boxedtype_static.m4)
|
||||
m4_include(class_interface.m4)
|
||||
m4_include(class_opaque_copyable.m4)
|
||||
m4_include(class_opaque_refcounted.m4)
|
||||
m4_include(gerror.m4)
|
||||
m4_include(signal.m4)
|
||||
m4_include(vfunc.m4)
|
||||
m4_include(method.m4)
|
||||
m4_include(member.m4)
|
||||
m4_include(compare.m4)
|
||||
m4_include(ctor.m4)
|
||||
m4_include(property.m4)
|
||||
m4_include(enum.m4)
|
||||
|
||||
_SECTION(SECTION_HEADER1)
|
||||
|
||||
246
squashfs-root/usr/lib/glibmm-2.4/proc/m4/class_boxedtype.m4
Normal file
246
squashfs-root/usr/lib/glibmm-2.4/proc/m4/class_boxedtype.m4
Normal file
@@ -0,0 +1,246 @@
|
||||
dnl $Id$
|
||||
|
||||
dnl
|
||||
dnl _CLASS_BOXEDTYPE(Region, GdkRegion, gdk_region_new, gdk_region_copy, gdk_region_destroy)
|
||||
dnl
|
||||
|
||||
define(`_CLASS_BOXEDTYPE',`dnl
|
||||
_PUSH()
|
||||
dnl
|
||||
dnl Define the args for later macros
|
||||
define(`__CPPNAME__',`$1')
|
||||
define(`__CNAME__',`$2')
|
||||
define(`__BOXEDTYPE_FUNC_NEW',`$3')
|
||||
define(`__BOXEDTYPE_FUNC_COPY',`$4')
|
||||
define(`__BOXEDTYPE_FUNC_FREE',`$5')
|
||||
|
||||
define(`_CUSTOM_DEFAULT_CTOR',`dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__BOOL_CUSTOM_DEFAULT_CTOR__',`$1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
define(`_CUSTOM_CTOR_CAST',`dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__BOOL_CUSTOM_CTOR_CAST__',`$1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
_POP()
|
||||
_SECTION(SECTION_CLASS2)
|
||||
') dnl End of _CLASS_BOXEDTYPE.
|
||||
|
||||
dnl Some of the Gdk types are unions - e.g. GdkEvent.
|
||||
define(`_CUSTOM_STRUCT_PROTOTYPE',`dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__BOOL_CUSTOM_STRUCT_PROTOTYPE__',`$1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
dnl
|
||||
dnl _END_CLASS_BOXEDTYPE()
|
||||
dnl denotes the end of a class
|
||||
dnl
|
||||
define(`_END_CLASS_BOXEDTYPE',`
|
||||
_SECTION(SECTION_HEADER1)
|
||||
ifdef(`__BOOL_CUSTOM_STRUCT_PROTOTYPE__',`dnl
|
||||
',`dnl
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
extern "C" { typedef struct _`'__CNAME__ __CNAME__; }
|
||||
#endif
|
||||
')dnl
|
||||
|
||||
_SECTION(SECTION_HEADER3)
|
||||
|
||||
__NAMESPACE_BEGIN__
|
||||
|
||||
/** @relates __NAMESPACE__::__CPPNAME__
|
||||
* @param lhs The left-hand side
|
||||
* @param rhs The right-hand side
|
||||
*/
|
||||
inline void swap(__CPPNAME__& lhs, __CPPNAME__& rhs) noexcept
|
||||
{ lhs.swap(rhs); }
|
||||
|
||||
__NAMESPACE_END__
|
||||
|
||||
namespace Glib
|
||||
{
|
||||
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
|
||||
',`dnl else
|
||||
|
||||
/** A Glib::wrap() method for this object.
|
||||
*
|
||||
* @param object The C instance.
|
||||
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
|
||||
* @result A C++ instance that wraps this C instance.
|
||||
*
|
||||
* @relates __NAMESPACE__::__CPPNAME__
|
||||
*/
|
||||
__NAMESPACE__::__CPPNAME__ wrap(__CNAME__* object, bool take_copy = false);
|
||||
')dnl endif __BOOL_NO_WRAP_FUNCTION__
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
template <>
|
||||
class Value<__NAMESPACE__::__CPPNAME__> : public Glib::Value_Boxed<__NAMESPACE__::__CPPNAME__>
|
||||
{};
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
} // namespace Glib
|
||||
|
||||
_SECTION(SECTION_SRC_GENERATED)
|
||||
|
||||
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
|
||||
',`dnl else
|
||||
namespace Glib
|
||||
{
|
||||
|
||||
__NAMESPACE__::__CPPNAME__ wrap(__CNAME__* object, bool take_copy)
|
||||
{
|
||||
return __NAMESPACE__::__CPPNAME__`'(object, take_copy);
|
||||
}
|
||||
|
||||
} // namespace Glib
|
||||
')dnl endif
|
||||
|
||||
|
||||
__NAMESPACE_BEGIN__
|
||||
|
||||
dnl
|
||||
dnl The implementation:
|
||||
dnl
|
||||
|
||||
// static
|
||||
GType __CPPNAME__::get_type()
|
||||
{
|
||||
return _GET_TYPE_FUNC(__CNAME__);
|
||||
}
|
||||
|
||||
ifdef(`__BOOL_CUSTOM_DEFAULT_CTOR__',`dnl
|
||||
',`dnl else
|
||||
__CPPNAME__::__CPPNAME__`'()
|
||||
:
|
||||
ifelse(__BOXEDTYPE_FUNC_NEW,NONE,`dnl
|
||||
gobject_ (nullptr) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
|
||||
',`dnl else
|
||||
gobject_ (__BOXEDTYPE_FUNC_NEW`'())
|
||||
')dnl
|
||||
{}
|
||||
')dnl endif __BOOL_CUSTOM_DEFAULT_CTOR__
|
||||
|
||||
__CPPNAME__::__CPPNAME__`'(const __CPPNAME__& other)
|
||||
:
|
||||
gobject_ ((other.gobject_) ? __BOXEDTYPE_FUNC_COPY`'(other.gobject_) : nullptr)
|
||||
{}
|
||||
|
||||
__CPPNAME__::__CPPNAME__`'(__CPPNAME__&& other) noexcept
|
||||
:
|
||||
gobject_(other.gobject_)
|
||||
{
|
||||
other.gobject_ = nullptr;
|
||||
}
|
||||
|
||||
__CPPNAME__& __CPPNAME__::operator=(__CPPNAME__`'&& other) noexcept
|
||||
{
|
||||
__CPPNAME__ temp (other);
|
||||
swap(temp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
ifdef(`__BOOL_CUSTOM_CTOR_CAST__',,`dnl else
|
||||
__CPPNAME__::__CPPNAME__`'(__CNAME__* gobject, bool make_a_copy)
|
||||
:
|
||||
// For BoxedType wrappers, make_a_copy is true by default. The static
|
||||
// BoxedType wrappers must always take a copy, thus make_a_copy = true
|
||||
// ensures identical behaviour if the default argument is used.
|
||||
gobject_ ((make_a_copy && gobject) ? __BOXEDTYPE_FUNC_COPY`'(gobject) : gobject)
|
||||
{}
|
||||
')dnl
|
||||
|
||||
__CPPNAME__& __CPPNAME__::operator=(const __CPPNAME__`'& other)
|
||||
{
|
||||
__CPPNAME__ temp (other);
|
||||
swap(temp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
__CPPNAME__::~__CPPNAME__`'() noexcept
|
||||
{
|
||||
dnl This could be a free or an unref, we do not need to know.
|
||||
if(gobject_)
|
||||
__BOXEDTYPE_FUNC_FREE`'(gobject_);
|
||||
}
|
||||
|
||||
void __CPPNAME__::swap(__CPPNAME__& other) noexcept
|
||||
{
|
||||
std::swap(gobject_, other.gobject_);
|
||||
}
|
||||
|
||||
__CNAME__* __CPPNAME__::gobj_copy() const
|
||||
{
|
||||
return __BOXEDTYPE_FUNC_COPY`'(gobject_);
|
||||
}
|
||||
|
||||
_IMPORT(SECTION_CC)
|
||||
|
||||
__NAMESPACE_END__
|
||||
|
||||
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
_POP()
|
||||
dnl
|
||||
dnl
|
||||
dnl The actual class, e.g. Pango::FontDescription, declaration:
|
||||
dnl
|
||||
_IMPORT(SECTION_CLASS1)
|
||||
public:
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
using CppObjectType = __CPPNAME__;
|
||||
using BaseObjectType = __CNAME__;
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
/** Get the GType for this class, for use with the underlying GObject type system.
|
||||
*/
|
||||
static GType get_type() G_GNUC_CONST;
|
||||
|
||||
ifdef(`__BOOL_CUSTOM_DEFAULT_CTOR__',`dnl
|
||||
',`dnl else
|
||||
__CPPNAME__`'();
|
||||
')dnl
|
||||
|
||||
ifdef(`__BOOL_CUSTOM_CTOR_CAST__',,`dnl else
|
||||
explicit __CPPNAME__`'(__CNAME__* gobject, bool make_a_copy = true);
|
||||
')dnl
|
||||
|
||||
__CPPNAME__`'(const __CPPNAME__& other);
|
||||
__CPPNAME__& operator=(const __CPPNAME__& other);
|
||||
|
||||
__CPPNAME__`'(__CPPNAME__&& other) noexcept;
|
||||
__CPPNAME__& operator=(__CPPNAME__&& other) noexcept;
|
||||
|
||||
_IMPORT(SECTION_DTOR_DOCUMENTATION)
|
||||
~__CPPNAME__`'() noexcept;
|
||||
|
||||
void swap(__CPPNAME__& other) noexcept;
|
||||
|
||||
///Provides access to the underlying C instance.
|
||||
__CNAME__* gobj() { return gobject_; }
|
||||
|
||||
///Provides access to the underlying C instance.
|
||||
const __CNAME__* gobj() const { return gobject_; }
|
||||
|
||||
///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
|
||||
__CNAME__* gobj_copy() const;
|
||||
|
||||
protected:
|
||||
__CNAME__* gobject_;
|
||||
|
||||
private:
|
||||
_IMPORT(SECTION_CLASS2)
|
||||
')
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
dnl $Id$
|
||||
|
||||
dnl
|
||||
dnl _CLASS_BOXEDTYPE_STATIC(TreeIter, GtkTreeIter)
|
||||
dnl
|
||||
define(`_CLASS_BOXEDTYPE_STATIC',`dnl
|
||||
_PUSH()
|
||||
dnl
|
||||
dnl Define the args for later macros
|
||||
define(`__CPPNAME__',`$1')
|
||||
define(`__CNAME__',`$2')
|
||||
|
||||
define(`_CUSTOM_DEFAULT_CTOR',`dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__BOOL_CUSTOM_DEFAULT_CTOR__',`$1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
define(`_CUSTOM_CTOR_CAST',`dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__BOOL_CUSTOM_CTOR_CAST__',`$1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
_POP()
|
||||
_SECTION(SECTION_CLASS2)
|
||||
') dnl End of _CLASS_BOXEDTYPE_STATIC.
|
||||
|
||||
dnl TreeIterBase shouldn't have a wrap() method - we'll custom implement them for TreeIter and TreeRow:
|
||||
define(`_NO_WRAP_FUNCTION',`dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__BOOL_NO_WRAP_FUNCTION__',`$1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
dnl
|
||||
dnl _END_CLASS_BOXEDTYPE_STATIC()
|
||||
dnl denotes the end of a class
|
||||
dnl
|
||||
define(`_END_CLASS_BOXEDTYPE_STATIC',`
|
||||
|
||||
_SECTION(SECTION_HEADER3)
|
||||
|
||||
namespace Glib
|
||||
{
|
||||
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
|
||||
',`dnl else
|
||||
|
||||
/** @relates __NAMESPACE__::__CPPNAME__
|
||||
* @param object The C instance
|
||||
* @result A C++ instance that wraps this C instance.
|
||||
*/
|
||||
__NAMESPACE__::__CPPNAME__& wrap(__CNAME__* object);
|
||||
|
||||
/** @relates __NAMESPACE__::__CPPNAME__
|
||||
* @param object The C instance
|
||||
* @result A C++ instance that wraps this C instance.
|
||||
*/
|
||||
const __NAMESPACE__::__CPPNAME__& wrap(const __CNAME__* object);
|
||||
')dnl endif __BOOL_NO_WRAP_FUNCTION__
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
template <>
|
||||
class Value<__NAMESPACE__::__CPPNAME__> : public Glib::Value_Boxed<__NAMESPACE__::__CPPNAME__>
|
||||
{};
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
} // namespace Glib
|
||||
|
||||
_SECTION(SECTION_CC_INCLUDES)
|
||||
#include <cstring> // std::memset`'()
|
||||
_SECTION(SECTION_SRC_GENERATED)
|
||||
|
||||
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
|
||||
',`dnl else
|
||||
namespace Glib
|
||||
{
|
||||
|
||||
__NAMESPACE__::__CPPNAME__& wrap(__CNAME__* object)
|
||||
{
|
||||
return *reinterpret_cast<__NAMESPACE__::__CPPNAME__*>(object);
|
||||
}
|
||||
|
||||
const __NAMESPACE__::__CPPNAME__& wrap(const __CNAME__* object)
|
||||
{
|
||||
return *reinterpret_cast<const __NAMESPACE__::__CPPNAME__*>(object);
|
||||
}
|
||||
|
||||
} // namespace Glib
|
||||
')dnl endif __BOOL_NO_WRAP_FUNCTION__
|
||||
|
||||
|
||||
__NAMESPACE_BEGIN__
|
||||
|
||||
dnl
|
||||
dnl The implementation:
|
||||
dnl
|
||||
|
||||
__CPPNAME__::__CPPNAME__`'(const __CPPNAME__& other) noexcept
|
||||
:
|
||||
gobject_(other.gobject_)
|
||||
{
|
||||
}
|
||||
|
||||
__CPPNAME__& __CPPNAME__::operator=(const __CPPNAME__`'& other) noexcept
|
||||
{
|
||||
gobject_ = other.gobject_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
__CPPNAME__::__CPPNAME__`'(__CPPNAME__&& other) noexcept
|
||||
:
|
||||
gobject_(std::move(other.gobject_))
|
||||
{
|
||||
//We could wipe other.gobject_ via memset,
|
||||
//but that is not really necessary:
|
||||
//other.gobject_ = nullptr;
|
||||
}
|
||||
|
||||
__CPPNAME__& __CPPNAME__::operator=(__CPPNAME__`'&& other) noexcept
|
||||
{
|
||||
gobject_ = std::move(other.gobject_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
dnl // static
|
||||
dnl const __CNAME__ __CPPNAME__::gobject_initializer_ = { 0, };
|
||||
dnl
|
||||
// static
|
||||
GType __CPPNAME__::get_type()
|
||||
{
|
||||
return _GET_TYPE_FUNC(__CNAME__);
|
||||
}
|
||||
|
||||
ifdef(`__BOOL_CUSTOM_DEFAULT_CTOR__',,`dnl else
|
||||
__CPPNAME__::__CPPNAME__`'()
|
||||
{
|
||||
std::memset`'(&gobject_, 0, sizeof(__CNAME__));
|
||||
}
|
||||
')dnl
|
||||
|
||||
ifdef(`__BOOL_CUSTOM_CTOR_CAST__',,`dnl else
|
||||
__CPPNAME__::__CPPNAME__`'(const __CNAME__* gobject)
|
||||
{
|
||||
if(gobject)
|
||||
gobject_ = *gobject;
|
||||
else
|
||||
std::memset`'(&gobject_, 0, sizeof(__CNAME__));
|
||||
}
|
||||
')dnl
|
||||
|
||||
_IMPORT(SECTION_CC)
|
||||
|
||||
__NAMESPACE_END__
|
||||
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
_POP()
|
||||
dnl
|
||||
dnl
|
||||
dnl The actual class, e.g. Gtk::TreeIter, declaration:
|
||||
dnl
|
||||
_IMPORT(SECTION_CLASS1)
|
||||
public:
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
using CppObjectType = __CPPNAME__;
|
||||
using BaseObjectType = __CNAME__;
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
__CPPNAME__`'(const __CPPNAME__& other) noexcept;
|
||||
__CPPNAME__& operator=(const __CPPNAME__& other) noexcept;
|
||||
|
||||
__CPPNAME__`'(__CPPNAME__&& other) noexcept;
|
||||
__CPPNAME__& operator=(__CPPNAME__&& other) noexcept;
|
||||
|
||||
/** Get the GType for this class, for use with the underlying GObject type system.
|
||||
*/
|
||||
static GType get_type() G_GNUC_CONST;
|
||||
|
||||
ifdef(`__BOOL_CUSTOM_DEFAULT_CTOR__',,`dnl else
|
||||
__CPPNAME__`'();
|
||||
')dnl
|
||||
|
||||
ifdef(`__BOOL_CUSTOM_CTOR_CAST__',,`dnl else
|
||||
explicit __CPPNAME__`'(const __CNAME__* gobject); // always takes a copy
|
||||
')dnl
|
||||
|
||||
///Provides access to the underlying C instance.
|
||||
__CNAME__* gobj() { return &gobject_; }
|
||||
|
||||
///Provides access to the underlying C instance.
|
||||
const __CNAME__* gobj() const { return &gobject_; }
|
||||
|
||||
protected:
|
||||
__CNAME__ gobject_;
|
||||
dnl static const __CNAME__ gobject_initializer_;
|
||||
|
||||
private:
|
||||
_IMPORT(SECTION_CLASS2)
|
||||
')
|
||||
|
||||
54
squashfs-root/usr/lib/glibmm-2.4/proc/m4/class_generic.m4
Normal file
54
squashfs-root/usr/lib/glibmm-2.4/proc/m4/class_generic.m4
Normal file
@@ -0,0 +1,54 @@
|
||||
dnl $Id$
|
||||
|
||||
dnl
|
||||
dnl _CLASS_GENERIC(LayoutIter, PangoLayoutIter)
|
||||
dnl
|
||||
|
||||
define(`_CLASS_GENERIC',`dnl
|
||||
_PUSH()
|
||||
dnl
|
||||
dnl Define the args for later macros
|
||||
define(`__CPPNAME__',`$1')
|
||||
define(`__CNAME__',`$2')
|
||||
|
||||
_POP()
|
||||
_SECTION(SECTION_CLASS2)
|
||||
') dnl End of _CLASS_GENERIC.
|
||||
|
||||
|
||||
dnl
|
||||
dnl _END_CLASS_GENERIC()
|
||||
dnl denotes the end of a class
|
||||
dnl
|
||||
define(`_END_CLASS_GENERIC',`
|
||||
|
||||
_SECTION(SECTION_SRC_GENERATED)
|
||||
|
||||
__NAMESPACE_BEGIN__
|
||||
|
||||
dnl The implementation:
|
||||
|
||||
_IMPORT(SECTION_CC)
|
||||
|
||||
__NAMESPACE_END__
|
||||
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
_POP()
|
||||
dnl
|
||||
dnl
|
||||
dnl The actual class, e.g. Pango::FontDescription, declaration:
|
||||
dnl
|
||||
_IMPORT(SECTION_CLASS1)
|
||||
public:
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
using CppObjectType = __CPPNAME__;
|
||||
using BaseObjectType = __CNAME__;
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
private:
|
||||
_IMPORT(SECTION_CLASS2)
|
||||
')
|
||||
|
||||
323
squashfs-root/usr/lib/glibmm-2.4/proc/m4/class_gobject.m4
Normal file
323
squashfs-root/usr/lib/glibmm-2.4/proc/m4/class_gobject.m4
Normal file
@@ -0,0 +1,323 @@
|
||||
dnl $Id$
|
||||
|
||||
|
||||
define(`_CLASS_GOBJECT',`dnl
|
||||
_PUSH()
|
||||
dnl
|
||||
dnl Define the args for later macros
|
||||
define(`__CPPNAME__',`$1')
|
||||
define(`__CNAME__',`$2')
|
||||
define(`__CCAST__',`$3')
|
||||
define(`__BASE__',_LOWER(__CPPNAME__))
|
||||
define(`__CPPPARENT__',`$4')
|
||||
define(`__CPARENT__',`$5')
|
||||
define(`__PCAST__',`($5*)')
|
||||
|
||||
dnl Some C types, e.g. GdkWindow or GdkPixmap, are a typedef to their base type,
|
||||
dnl rather than the real instance type. That is really ugly, yes. We get around
|
||||
dnl the problem by supporting optional __REAL_* arguments to this macro.
|
||||
define(`__REAL_CNAME__',ifelse(`$6',,__CNAME__,`$6'))
|
||||
define(`__REAL_CPARENT__',ifelse(`$7',,__CPARENT__,`$7'))
|
||||
|
||||
|
||||
_POP()
|
||||
_SECTION(SECTION_CLASS2)
|
||||
') dnl end of _CLASS_GOBJECT
|
||||
|
||||
dnl Widget and Object, and some others, have custom-written destructor implementations:
|
||||
define(`_CUSTOM_DTOR',`dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__BOOL_CUSTOM_DTOR__',`$1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
dnl For classes that need custom code for move operations.
|
||||
define(`_CUSTOM_MOVE_OPERATIONS', `dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__BOOL_CUSTOM_MOVE_OPERATIONS__',`$1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
dnl For classes that need custom code in their cast and construct_params
|
||||
dnl constructor.
|
||||
define(`_CUSTOM_CTOR_CAST',`dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__BOOL_CUSTOM_CTOR_CAST__',`$1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
dnl Gdk::Pixmap_Class::wrap_new() needs a custom implementation, in order
|
||||
dnl to create a Gdk::Bitmap object if appropriate. See comments there.
|
||||
define(`_CUSTOM_WRAP_NEW',`dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__BOOL_CUSTOM_WRAP_NEW__',`1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
dnl Gnome::Canvas::CanvasAA::CanvasAA() needs access to the
|
||||
dnl normally-private canvas_class_ member variable. See comments there.
|
||||
define(`_GMMPROC_PROTECTED_GCLASS',`dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__BOOL_PROTECTED_GCLASS__',`1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
dnl Some of the Gdk types are actually direct typedefs of their base type.
|
||||
dnl This means that 2 wrap functions would have the same argument.
|
||||
dnl define(`_NO_WRAP_FUNCTION',`dnl
|
||||
dnl _PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
dnl define(`__BOOL_NO_WRAP_FUNCTION__',`$1')
|
||||
dnl _POP()
|
||||
dnl ')
|
||||
|
||||
dnl In case a class needs to write its own implementation of its Glib::wrap()
|
||||
dnl function. The function will be declared in the header, but the body is not
|
||||
dnl generated.
|
||||
define(`_CUSTOM_WRAP_FUNCTION',`dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__BOOL_CUSTOM_WRAP_FUNCTION__',`$1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
dnl Some gobjects actually derive from GInitiallyUnowned, which does some odd reference-counting that is useful to C coders.
|
||||
dnl We don't want to expose that base class in our API,
|
||||
dnl but we do want to reverse what it does:
|
||||
define(`_DERIVES_INITIALLY_UNOWNED',`dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__BOOL_DERIVES_INITIALLY_UNOWNED__',`$1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
|
||||
dnl
|
||||
dnl _CREATE_METHOD(args_type_and_name_hpp, args_type_and_name_cpp,args_name_only);
|
||||
dnl
|
||||
define(`_CREATE_METHOD',`
|
||||
static Glib::RefPtr<`'__CPPNAME__`'> create(`'$1`');
|
||||
_PUSH(SECTION_CC)
|
||||
Glib::RefPtr<`'__CPPNAME__`'> __CPPNAME__`'::create(`'$2`')
|
||||
{
|
||||
return Glib::RefPtr<`'__CPPNAME__`'>( new __CPPNAME__`'(`'$3`') );
|
||||
}
|
||||
|
||||
_POP()
|
||||
')
|
||||
|
||||
|
||||
dnl
|
||||
dnl _END_CLASS_GOBJECT()
|
||||
dnl denotes the end of a class
|
||||
dnl
|
||||
define(`_END_CLASS_GOBJECT',`
|
||||
_SECTION(SECTION_HEADER1)
|
||||
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
|
||||
',`dnl
|
||||
_STRUCT_PROTOTYPE()
|
||||
')dnl
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
__NAMESPACE_BEGIN__ class __CPPNAME__`'_Class; __NAMESPACE_END__
|
||||
#endif //DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
_SECTION(SECTION_HEADER3)
|
||||
|
||||
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
|
||||
',`dnl
|
||||
namespace Glib
|
||||
{
|
||||
/** A Glib::wrap() method for this object.
|
||||
*
|
||||
* @param object The C instance.
|
||||
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
|
||||
* @result A C++ instance that wraps this C instance.
|
||||
*
|
||||
* @relates __NAMESPACE__::__CPPNAME__
|
||||
*/
|
||||
Glib::RefPtr<__NAMESPACE__::__CPPNAME__> wrap(__REAL_CNAME__`'* object, bool take_copy = false);
|
||||
}
|
||||
')dnl
|
||||
|
||||
|
||||
dnl
|
||||
dnl
|
||||
_SECTION(SECTION_PHEADER)
|
||||
|
||||
#include <glibmm/class.h>
|
||||
|
||||
__NAMESPACE_BEGIN__
|
||||
|
||||
_PH_CLASS_DECLARATION()
|
||||
|
||||
__NAMESPACE_END__
|
||||
|
||||
_SECTION(SECTION_SRC_GENERATED)
|
||||
|
||||
ifdef(`__BOOL_CUSTOM_WRAP_FUNCTION__',`dnl
|
||||
',`dnl else
|
||||
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
|
||||
',`dnl else
|
||||
namespace Glib
|
||||
{
|
||||
|
||||
Glib::RefPtr<__NAMESPACE__::__CPPNAME__> wrap(__REAL_CNAME__`'* object, bool take_copy)
|
||||
{
|
||||
return Glib::RefPtr<__NAMESPACE__::__CPPNAME__>( dynamic_cast<__NAMESPACE__::__CPPNAME__*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
|
||||
//We use dynamic_cast<> in case of multiple inheritance.
|
||||
}
|
||||
|
||||
} /* namespace Glib */
|
||||
')dnl endif
|
||||
')dnl endif
|
||||
|
||||
|
||||
|
||||
|
||||
__NAMESPACE_BEGIN__
|
||||
|
||||
|
||||
/* The *_Class implementation: */
|
||||
|
||||
_PCC_CLASS_IMPLEMENTATION()
|
||||
|
||||
m4_ifdef(`__BOOL_CUSTOM_WRAP_NEW__',,`dnl else
|
||||
Glib::ObjectBase* __CPPNAME__`'_Class::wrap_new(GObject* object)
|
||||
{
|
||||
return new __CPPNAME__`'((__CNAME__*)`'object);
|
||||
}
|
||||
|
||||
')dnl endif
|
||||
|
||||
/* The implementation: */
|
||||
|
||||
__CNAME__* __CPPNAME__::gobj_copy()
|
||||
{
|
||||
reference();
|
||||
return gobj();
|
||||
}
|
||||
|
||||
ifdef(`__BOOL_CUSTOM_CTOR_CAST__',`dnl
|
||||
',`dnl
|
||||
__CPPNAME__::__CPPNAME__`'(const Glib::ConstructParams& construct_params)
|
||||
:
|
||||
__CPPPARENT__`'(construct_params)
|
||||
{
|
||||
_INITIALLY_UNOWNED_SINK
|
||||
}
|
||||
|
||||
__CPPNAME__::__CPPNAME__`'(__CNAME__* castitem)
|
||||
:
|
||||
__CPPPARENT__`'(__PCAST__`'(castitem))
|
||||
{}
|
||||
|
||||
')dnl
|
||||
|
||||
ifdef(`__BOOL_CUSTOM_MOVE_OPERATIONS__',`dnl
|
||||
',`dnl
|
||||
__CPPNAME__::__CPPNAME__`'(__CPPNAME__&& src) noexcept
|
||||
: __CPPPARENT__`'(std::move(src))
|
||||
_IMPORT(SECTION_CC_MOVE_CONSTRUCTOR_INTERFACES)
|
||||
{}
|
||||
|
||||
__CPPNAME__& __CPPNAME__::operator=(__CPPNAME__&& src) noexcept
|
||||
{
|
||||
__CPPPARENT__::operator=`'(std::move(src));
|
||||
_IMPORT(SECTION_CC_MOVE_ASSIGNMENT_OPERATOR_INTERFACES)
|
||||
return *this;
|
||||
}
|
||||
|
||||
')dnl
|
||||
|
||||
ifdef(`__BOOL_CUSTOM_DTOR__',`dnl
|
||||
',`dnl
|
||||
__CPPNAME__::~__CPPNAME__`'() noexcept
|
||||
{}
|
||||
|
||||
')dnl
|
||||
|
||||
|
||||
_CC_CLASS_IMPLEMENTATION()
|
||||
|
||||
__NAMESPACE_END__
|
||||
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
_POP()
|
||||
dnl
|
||||
dnl The actual class, e.g. Gtk::Widget, declaration:
|
||||
dnl _IMPORT(SECTION_H_SIGNALPROXIES_CUSTOM)
|
||||
|
||||
_IMPORT(SECTION_CLASS1)
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
public:
|
||||
using CppObjectType = __CPPNAME__;
|
||||
using CppClassType = __CPPNAME__`'_Class;
|
||||
using BaseObjectType = __CNAME__;
|
||||
using BaseClassType = __REAL_CNAME__`'Class;
|
||||
|
||||
// noncopyable
|
||||
__CPPNAME__`'(const __CPPNAME__&) = delete;
|
||||
__CPPNAME__& operator=(const __CPPNAME__&) = delete;
|
||||
|
||||
m4_ifdef(`__BOOL_PROTECTED_GCLASS__',
|
||||
`protected:',`dnl else
|
||||
private:')dnl endif
|
||||
friend class __CPPNAME__`'_Class;
|
||||
static CppClassType `'__BASE__`'_class_;
|
||||
|
||||
protected:
|
||||
explicit __CPPNAME__`'(const Glib::ConstructParams& construct_params);
|
||||
explicit __CPPNAME__`'(__CNAME__* castitem);
|
||||
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
public:
|
||||
|
||||
ifdef(`__BOOL_CUSTOM_MOVE_OPERATIONS__',`dnl
|
||||
',`dnl
|
||||
__CPPNAME__`'(__CPPNAME__&& src) noexcept;
|
||||
__CPPNAME__& operator=(__CPPNAME__&& src) noexcept;
|
||||
')dnl
|
||||
|
||||
_IMPORT(SECTION_DTOR_DOCUMENTATION)
|
||||
~__CPPNAME__`'() noexcept override;
|
||||
|
||||
/** Get the GType for this class, for use with the underlying GObject type system.
|
||||
*/
|
||||
static GType get_type() G_GNUC_CONST;
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
ifdef(`__BOOL_DYNAMIC_GTYPE_REGISTRATION__',`
|
||||
static GType get_type(GTypeModule* module) G_GNUC_CONST;
|
||||
',`')
|
||||
|
||||
static GType get_base_type() G_GNUC_CONST;
|
||||
#endif
|
||||
|
||||
///Provides access to the underlying C GObject.
|
||||
__CNAME__* gobj() { return reinterpret_cast<__CNAME__*>(gobject_); }
|
||||
|
||||
///Provides access to the underlying C GObject.
|
||||
const __CNAME__* gobj() const { return reinterpret_cast<__CNAME__*>(gobject_); }
|
||||
|
||||
///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
|
||||
__CNAME__* gobj_copy();
|
||||
|
||||
private:
|
||||
_IMPORT(SECTION_CLASS2)
|
||||
|
||||
public:
|
||||
_H_VFUNCS_AND_SIGNALS()
|
||||
|
||||
')
|
||||
311
squashfs-root/usr/lib/glibmm-2.4/proc/m4/class_interface.m4
Normal file
311
squashfs-root/usr/lib/glibmm-2.4/proc/m4/class_interface.m4
Normal file
@@ -0,0 +1,311 @@
|
||||
dnl $Id$
|
||||
|
||||
|
||||
define(`_CLASS_INTERFACE',`dnl
|
||||
_PUSH()
|
||||
dnl
|
||||
dnl Define the args for later macros
|
||||
define(`__CPPNAME__',`$1')
|
||||
define(`__CNAME__',`$2')
|
||||
define(`__CCAST__',`$3')
|
||||
define(`__CCLASS__',`$4') dnl SomethingIface or SomethingClass, both suffixes are used.
|
||||
define(`__BASE__',_LOWER(__CPPNAME__))
|
||||
define(`__CPPPARENT__',m4_ifelse($5,`',`Glib::Interface',$5)) #Optional parameter.
|
||||
define(`__CPARENT__',m4_ifelse($6,`',`GObject',$6)) #Optional parameter.
|
||||
define(`__PCAST__',`(__CPARENT__`'*)')
|
||||
define(`__BOOL_IS_INTERFACE__',`1')
|
||||
|
||||
|
||||
dnl For classes that need custom code in their cast constructor.
|
||||
define(`_CUSTOM_CTOR_CAST',`dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__BOOL_CUSTOM_CTOR_CAST__',`$1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
_POP()
|
||||
_SECTION(SECTION_CLASS2)
|
||||
') dnl end of _CLASS_INTERFACE
|
||||
|
||||
|
||||
dnl Some of the Gdk types are actually direct typedefs of their base type.
|
||||
dnl This means that 2 wrap functions would have the same argument.
|
||||
dnl define(`_NO_WRAP_FUNCTION',`dnl
|
||||
dnl _PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
dnl define(`__BOOL_NO_WRAP_FUNCTION__',`$1')
|
||||
dnl _POP()
|
||||
dnl ')
|
||||
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
define(`_PH_CLASS_DECLARATION_INTERFACE',`dnl
|
||||
class __CPPNAME__`'_Class : public __CPPPARENT__`'_Class
|
||||
{
|
||||
public:
|
||||
using CppObjectType = __CPPNAME__;
|
||||
using BaseObjectType = __CNAME__;
|
||||
using BaseClassType = __CCLASS__;
|
||||
using CppClassParent = __CPPPARENT__`'_Class;
|
||||
|
||||
friend class __CPPNAME__;
|
||||
|
||||
const Glib::Interface_Class& init();
|
||||
|
||||
static void iface_init_function(void* g_iface, void* iface_data);
|
||||
|
||||
static Glib::ObjectBase* wrap_new(GObject*);
|
||||
|
||||
protected:
|
||||
|
||||
//Callbacks (default signal handlers):
|
||||
//These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
|
||||
//You could prevent the original default signal handlers being called by overriding the *_impl method.
|
||||
_IMPORT(SECTION_PH_DEFAULT_SIGNAL_HANDLERS)
|
||||
|
||||
//Callbacks (virtual functions):
|
||||
_IMPORT(SECTION_PH_VFUNCS)
|
||||
};
|
||||
')
|
||||
|
||||
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
define(`_PCC_CLASS_IMPLEMENTATION_INTERFACE',`dnl
|
||||
const Glib::Interface_Class& __CPPNAME__`'_Class::init()
|
||||
{
|
||||
if(!gtype_) // create the GType if necessary
|
||||
{
|
||||
// Glib::Interface_Class has to know the interface init function
|
||||
// in order to add interfaces to implementing types.
|
||||
class_init_func_ = &__CPPNAME__`'_Class::iface_init_function;
|
||||
|
||||
// We can not derive from another interface, and it is not necessary anyway.
|
||||
gtype_ = _LOWER(__CCAST__)_get_type();
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void __CPPNAME__`'_Class::iface_init_function(void* g_iface, void*)
|
||||
{
|
||||
const auto klass = static_cast<BaseClassType*>(g_iface);
|
||||
|
||||
//This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
|
||||
//This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
|
||||
g_assert(klass != nullptr);
|
||||
|
||||
_IMPORT(SECTION_PCC_CLASS_INIT_VFUNCS)
|
||||
|
||||
_IMPORT(SECTION_PCC_CLASS_INIT_DEFAULT_SIGNAL_HANDLERS)
|
||||
}
|
||||
|
||||
_IMPORT(SECTION_PCC_VFUNCS)
|
||||
|
||||
_IMPORT(SECTION_PCC_DEFAULT_SIGNAL_HANDLERS)
|
||||
')
|
||||
|
||||
|
||||
dnl
|
||||
dnl _END_CLASS_INTERFACE()
|
||||
dnl denotes the end of a class
|
||||
dnl
|
||||
define(`_END_CLASS_INTERFACE',`
|
||||
_SECTION(SECTION_HEADER1)
|
||||
_STRUCT_PROTOTYPE()
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
__NAMESPACE_BEGIN__ class __CPPNAME__`'_Class; __NAMESPACE_END__
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
_SECTION(SECTION_HEADER3)
|
||||
|
||||
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
|
||||
',`dnl
|
||||
namespace Glib
|
||||
{
|
||||
/** A Glib::wrap() method for this object.
|
||||
*
|
||||
* @param object The C instance.
|
||||
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
|
||||
* @result A C++ instance that wraps this C instance.
|
||||
*
|
||||
* @relates __NAMESPACE__::__CPPNAME__
|
||||
*/
|
||||
Glib::RefPtr<__NAMESPACE__::__CPPNAME__> wrap(__CNAME__`'* object, bool take_copy = false);
|
||||
|
||||
} // namespace Glib
|
||||
|
||||
')dnl
|
||||
dnl
|
||||
dnl
|
||||
_SECTION(SECTION_PHEADER)
|
||||
|
||||
#include <glibmm/private/interface_p.h>
|
||||
|
||||
__NAMESPACE_BEGIN__
|
||||
|
||||
_PH_CLASS_DECLARATION_INTERFACE()
|
||||
|
||||
__NAMESPACE_END__
|
||||
|
||||
_SECTION(SECTION_SRC_GENERATED)
|
||||
|
||||
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
|
||||
',`dnl else
|
||||
namespace Glib
|
||||
{
|
||||
|
||||
Glib::RefPtr<__NAMESPACE__::__CPPNAME__> wrap(__CNAME__`'* object, bool take_copy)
|
||||
{
|
||||
return Glib::RefPtr<__NAMESPACE__::__CPPNAME__>( dynamic_cast<__NAMESPACE__::__CPPNAME__*> (Glib::wrap_auto_interface<__NAMESPACE__::__CPPNAME__> ((GObject*)(object), take_copy)) );
|
||||
//We use dynamic_cast<> in case of multiple inheritance.
|
||||
}
|
||||
|
||||
} // namespace Glib
|
||||
')dnl endif
|
||||
|
||||
|
||||
__NAMESPACE_BEGIN__
|
||||
|
||||
|
||||
/* The *_Class implementation: */
|
||||
|
||||
_PCC_CLASS_IMPLEMENTATION_INTERFACE()
|
||||
|
||||
Glib::ObjectBase* __CPPNAME__`'_Class::wrap_new(GObject* object)
|
||||
{
|
||||
return new __CPPNAME__`'((__CNAME__*)`'(object));
|
||||
}
|
||||
|
||||
|
||||
/* The implementation: */
|
||||
|
||||
__CPPNAME__::__CPPNAME__`'()
|
||||
:
|
||||
__CPPPARENT__`'(__BASE__`'_class_.init())
|
||||
{}
|
||||
|
||||
ifdef(`__BOOL_CUSTOM_CTOR_CAST__',`dnl
|
||||
',`dnl
|
||||
__CPPNAME__::__CPPNAME__`'(__CNAME__* castitem)
|
||||
:
|
||||
__CPPPARENT__`'(__PCAST__`'(castitem))
|
||||
{}
|
||||
')dnl
|
||||
|
||||
__CPPNAME__::__CPPNAME__`'(const Glib::Interface_Class& interface_class)
|
||||
: __CPPPARENT__`'(interface_class)
|
||||
{
|
||||
}
|
||||
|
||||
__CPPNAME__::__CPPNAME__`'(__CPPNAME__&& src) noexcept
|
||||
: __CPPPARENT__`'(std::move(src))
|
||||
{}
|
||||
|
||||
__CPPNAME__& __CPPNAME__::operator=(__CPPNAME__&& src) noexcept
|
||||
{
|
||||
__CPPPARENT__::operator=`'(std::move(src));
|
||||
return *this;
|
||||
}
|
||||
|
||||
__CPPNAME__::~__CPPNAME__`'() noexcept
|
||||
{}
|
||||
|
||||
// static
|
||||
void __CPPNAME__`'::add_interface(GType gtype_implementer)
|
||||
{
|
||||
__BASE__`'_class_.init().add_interface(gtype_implementer);
|
||||
}
|
||||
|
||||
_CC_CLASS_IMPLEMENTATION()
|
||||
|
||||
__NAMESPACE_END__
|
||||
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
_POP()
|
||||
dnl
|
||||
dnl The actual class, e.g. Gtk::Widget, declaration:
|
||||
dnl _IMPORT(SECTION_H_SIGNALPROXIES_CUSTOM)
|
||||
|
||||
_IMPORT(SECTION_CLASS1)
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
public:
|
||||
using CppObjectType = __CPPNAME__;
|
||||
using CppClassType = __CPPNAME__`'_Class;
|
||||
using BaseObjectType = __CNAME__;
|
||||
using BaseClassType = __CCLASS__;
|
||||
|
||||
// noncopyable
|
||||
__CPPNAME__`'(const __CPPNAME__&) = delete;
|
||||
__CPPNAME__& operator=(const __CPPNAME__&) = delete;
|
||||
|
||||
private:
|
||||
friend class __CPPNAME__`'_Class;
|
||||
static CppClassType `'__BASE__`'_class_;
|
||||
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
protected:
|
||||
/**
|
||||
* You should derive from this class to use it.
|
||||
*/
|
||||
__CPPNAME__`'();
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
/** Called by constructors of derived classes. Provide the result of
|
||||
* the Class init() function to ensure that it is properly
|
||||
* initialized.
|
||||
*
|
||||
* @param interface_class The Class object for the derived type.
|
||||
*/
|
||||
explicit __CPPNAME__`'(const Glib::Interface_Class& interface_class);
|
||||
|
||||
public:
|
||||
// This is public so that C++ wrapper instances can be
|
||||
// created for C instances of unwrapped types.
|
||||
// For instance, if an unexpected C type implements the C interface.
|
||||
explicit __CPPNAME__`'(__CNAME__* castitem);
|
||||
|
||||
protected:
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
public:
|
||||
|
||||
__CPPNAME__`'(__CPPNAME__&& src) noexcept;
|
||||
__CPPNAME__& operator=(__CPPNAME__&& src) noexcept;
|
||||
|
||||
_IMPORT(SECTION_DTOR_DOCUMENTATION)
|
||||
~__CPPNAME__`'() noexcept override;
|
||||
|
||||
static void add_interface(GType gtype_implementer);
|
||||
|
||||
/** Get the GType for this class, for use with the underlying GObject type system.
|
||||
*/
|
||||
static GType get_type() G_GNUC_CONST;
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
static GType get_base_type() G_GNUC_CONST;
|
||||
#endif
|
||||
|
||||
///Provides access to the underlying C GObject.
|
||||
__CNAME__* gobj() { return reinterpret_cast<__CNAME__*>(gobject_); }
|
||||
|
||||
///Provides access to the underlying C GObject.
|
||||
const __CNAME__* gobj() const { return reinterpret_cast<__CNAME__*>(gobject_); }
|
||||
|
||||
private:
|
||||
_IMPORT(SECTION_CLASS2)
|
||||
|
||||
public:
|
||||
_H_VFUNCS_AND_SIGNALS()
|
||||
|
||||
')
|
||||
|
||||
@@ -0,0 +1,233 @@
|
||||
dnl $Id$
|
||||
|
||||
dnl
|
||||
dnl _CLASS_OPAQUE_COPYABLE(Region, GdkRegion, gdk_region_new, gdk_region_copy, gdk_region_destroy)
|
||||
dnl
|
||||
|
||||
define(`_CLASS_OPAQUE_COPYABLE',`dnl
|
||||
_PUSH()
|
||||
dnl
|
||||
dnl Define the args for later macros
|
||||
define(`__CPPNAME__',`$1')
|
||||
define(`__CNAME__',`$2')
|
||||
define(`__OPAQUE_FUNC_NEW',`$3')
|
||||
define(`__OPAQUE_FUNC_COPY',`$4')
|
||||
define(`__OPAQUE_FUNC_FREE',`$5')
|
||||
|
||||
define(`_CUSTOM_DEFAULT_CTOR',`dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__BOOL_CUSTOM_DEFAULT_CTOR__',`$1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
define(`_CUSTOM_CTOR_CAST',`dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__BOOL_CUSTOM_CTOR_CAST__',`$1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
_POP()
|
||||
_SECTION(SECTION_CLASS2)
|
||||
') dnl End of _CLASS_OPAQUE_COPYABLE.
|
||||
|
||||
|
||||
dnl
|
||||
dnl _END_CLASS_OPAQUE_COPYABLE()
|
||||
dnl denotes the end of a class
|
||||
dnl
|
||||
define(`_END_CLASS_OPAQUE_COPYABLE',`
|
||||
|
||||
_SECTION(SECTION_HEADER3)
|
||||
|
||||
__NAMESPACE_BEGIN__
|
||||
|
||||
/** @relates __NAMESPACE__::__CPPNAME__
|
||||
* @param lhs The left-hand side
|
||||
* @param rhs The right-hand side
|
||||
*/
|
||||
inline void swap(__CPPNAME__& lhs, __CPPNAME__& rhs) noexcept
|
||||
{ lhs.swap(rhs); }
|
||||
|
||||
__NAMESPACE_END__
|
||||
|
||||
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
|
||||
',`dnl else
|
||||
namespace Glib
|
||||
{
|
||||
|
||||
/** A Glib::wrap() method for this object.
|
||||
*
|
||||
* @param object The C instance.
|
||||
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
|
||||
* @result A C++ instance that wraps this C instance.
|
||||
*
|
||||
* @relates __NAMESPACE__::__CPPNAME__
|
||||
*/
|
||||
__NAMESPACE__::__CPPNAME__ wrap(__CNAME__* object, bool take_copy = false);
|
||||
|
||||
} // namespace Glib
|
||||
')dnl endif __BOOL_NO_WRAP_FUNCTION__
|
||||
|
||||
_SECTION(SECTION_SRC_GENERATED)
|
||||
|
||||
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
|
||||
',`dnl else
|
||||
namespace Glib
|
||||
{
|
||||
|
||||
__NAMESPACE__::__CPPNAME__ wrap(__CNAME__* object, bool take_copy /* = false */)
|
||||
{
|
||||
return __NAMESPACE__::__CPPNAME__`'(object, take_copy);
|
||||
}
|
||||
|
||||
} // namespace Glib
|
||||
')dnl endif
|
||||
|
||||
|
||||
__NAMESPACE_BEGIN__
|
||||
|
||||
dnl
|
||||
dnl The implementation:
|
||||
dnl
|
||||
|
||||
ifdef(`__BOOL_CUSTOM_DEFAULT_CTOR__',`dnl
|
||||
',`dnl else
|
||||
__CPPNAME__::__CPPNAME__`'()
|
||||
:
|
||||
ifelse(__OPAQUE_FUNC_NEW,NONE,`dnl
|
||||
gobject_ (nullptr) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
|
||||
',`dnl else
|
||||
gobject_ (__OPAQUE_FUNC_NEW`'())
|
||||
')dnl
|
||||
{}
|
||||
')dnl endif __BOOL_CUSTOM_DEFAULT_CTOR__
|
||||
|
||||
__CPPNAME__::__CPPNAME__`'(const __CPPNAME__& src)
|
||||
:
|
||||
gobject_ ((src.gobject_) ? __OPAQUE_FUNC_COPY`'(src.gobject_) : nullptr)
|
||||
{}
|
||||
|
||||
ifdef(`__BOOL_CUSTOM_CTOR_CAST__',,`dnl else
|
||||
__CPPNAME__::__CPPNAME__`'(__CNAME__* castitem, bool make_a_copy /* = false */)
|
||||
{
|
||||
if(!make_a_copy)
|
||||
{
|
||||
// It was given to us by a function which has already made a copy for us to keep.
|
||||
gobject_ = castitem;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We are probably getting it via direct access to a struct,
|
||||
// so we can not just take it - we have to take a copy of it.
|
||||
if(castitem)
|
||||
gobject_ = __OPAQUE_FUNC_COPY`'(castitem);
|
||||
else
|
||||
gobject_ = nullptr;
|
||||
}
|
||||
}
|
||||
')
|
||||
|
||||
ifelse(__OPAQUE_FUNC_COPY,NONE,`dnl
|
||||
',`dnl else
|
||||
__CPPNAME__& __CPPNAME__::operator=(const __CPPNAME__`'& src)
|
||||
{
|
||||
const auto new_gobject = (src.gobject_) ? __OPAQUE_FUNC_COPY`'(src.gobject_) : nullptr;
|
||||
|
||||
if(gobject_)
|
||||
__OPAQUE_FUNC_FREE`'(gobject_);
|
||||
|
||||
gobject_ = new_gobject;
|
||||
|
||||
return *this;
|
||||
}
|
||||
')dnl
|
||||
|
||||
__CPPNAME__::__CPPNAME__`'(__CPPNAME__&& other) noexcept
|
||||
:
|
||||
gobject_(other.gobject_)
|
||||
{
|
||||
other.gobject_ = nullptr;
|
||||
}
|
||||
|
||||
__CPPNAME__& __CPPNAME__::operator=(__CPPNAME__`'&& other) noexcept
|
||||
{
|
||||
__CPPNAME__ temp (other);
|
||||
swap(temp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
__CPPNAME__::~__CPPNAME__`'() noexcept
|
||||
{
|
||||
if(gobject_)
|
||||
__OPAQUE_FUNC_FREE`'(gobject_);
|
||||
}
|
||||
|
||||
void __CPPNAME__::swap(__CPPNAME__& other) noexcept
|
||||
{
|
||||
std::swap(gobject_, other.gobject_);
|
||||
}
|
||||
|
||||
__CNAME__* __CPPNAME__::gobj_copy() const
|
||||
{
|
||||
return __OPAQUE_FUNC_COPY`'(gobject_);
|
||||
}
|
||||
|
||||
_IMPORT(SECTION_CC)
|
||||
|
||||
__NAMESPACE_END__
|
||||
|
||||
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
_POP()
|
||||
dnl
|
||||
dnl
|
||||
dnl The actual class, e.g. Pango::FontDescription, declaration:
|
||||
dnl
|
||||
_IMPORT(SECTION_CLASS1)
|
||||
public:
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
using CppObjectType = __CPPNAME__;
|
||||
using BaseObjectType = __CNAME__;
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
ifdef(`__BOOL_CUSTOM_DEFAULT_CTOR__',`dnl
|
||||
',`dnl else
|
||||
/** Constructs an invalid object.
|
||||
* E.g. for output arguments to methods. There is not much you can do with
|
||||
* the object before it has been assigned a valid value.
|
||||
*/
|
||||
__CPPNAME__`'();
|
||||
')dnl
|
||||
|
||||
// Use make_a_copy=true when getting it directly from a struct.
|
||||
explicit __CPPNAME__`'(__CNAME__* castitem, bool make_a_copy = false);
|
||||
|
||||
__CPPNAME__`'(const __CPPNAME__& src);
|
||||
__CPPNAME__& operator=(const __CPPNAME__& src);
|
||||
|
||||
__CPPNAME__`'(__CPPNAME__&& other) noexcept;
|
||||
__CPPNAME__& operator=(__CPPNAME__&& other) noexcept;
|
||||
|
||||
_IMPORT(SECTION_DTOR_DOCUMENTATION)
|
||||
~__CPPNAME__`'() noexcept;
|
||||
|
||||
void swap(__CPPNAME__& other) noexcept;
|
||||
|
||||
__CNAME__* gobj() { return gobject_; }
|
||||
const __CNAME__* gobj() const { return gobject_; }
|
||||
|
||||
///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
|
||||
__CNAME__* gobj_copy() const;
|
||||
|
||||
protected:
|
||||
__CNAME__* gobject_;
|
||||
|
||||
private:
|
||||
_IMPORT(SECTION_CLASS2)
|
||||
')
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
dnl $Id$
|
||||
|
||||
dnl
|
||||
dnl _CLASS_OPAQUE_REFCOUNTED(Coverage, PangoCoverage, pango_coverage_new, pango_coverage_ref, pango_coverage_unref)
|
||||
dnl
|
||||
|
||||
define(`_CLASS_OPAQUE_REFCOUNTED',`dnl
|
||||
_PUSH()
|
||||
dnl
|
||||
dnl Define the args for later macros
|
||||
define(`__CPPNAME__',`$1')
|
||||
define(`__CNAME__',`$2')
|
||||
define(`__OPAQUE_FUNC_NEW',`$3')
|
||||
define(`__OPAQUE_FUNC_REF',`$4')
|
||||
define(`__OPAQUE_FUNC_UNREF',`$5')
|
||||
|
||||
_POP()
|
||||
_SECTION(SECTION_CLASS2)
|
||||
')dnl End of _CLASS_OPAQUE_REFCOUNTED.
|
||||
|
||||
|
||||
dnl
|
||||
dnl _END_CLASS_OPAQUE_REFCOUNTED()
|
||||
dnl denotes the end of a class
|
||||
dnl
|
||||
define(`_END_CLASS_OPAQUE_REFCOUNTED',`
|
||||
|
||||
_SECTION(SECTION_HEADER3)
|
||||
|
||||
namespace Glib
|
||||
{
|
||||
|
||||
/** A Glib::wrap() method for this object.
|
||||
*
|
||||
* @param object The C instance.
|
||||
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
|
||||
* @result A C++ instance that wraps this C instance.
|
||||
*
|
||||
* @relates __NAMESPACE__::__CPPNAME__
|
||||
*/
|
||||
Glib::RefPtr<__NAMESPACE__::__CPPNAME__> wrap(__CNAME__* object, bool take_copy = false);
|
||||
|
||||
} // namespace Glib
|
||||
|
||||
_SECTION(SECTION_SRC_GENERATED)
|
||||
|
||||
/* Why reinterpret_cast<__CPPNAME__*>(gobject) is needed:
|
||||
*
|
||||
* A __CPPNAME__ instance is in fact always a __CNAME__ instance.
|
||||
* Unfortunately, __CNAME__ cannot be a member of __CPPNAME__,
|
||||
* because it is an opaque struct. Also, the C interface does not provide
|
||||
* any hooks to install a destroy notification handler, thus we cannot
|
||||
* wrap it dynamically either.
|
||||
*
|
||||
* The cast works because __CPPNAME__ does not have any member data, and
|
||||
* it is impossible to derive from it. This is ensured by using final on the
|
||||
* class and by using = delete on the default constructor.
|
||||
*/
|
||||
|
||||
namespace Glib
|
||||
{
|
||||
|
||||
Glib::RefPtr<__NAMESPACE__::__CPPNAME__> wrap(__CNAME__* object, bool take_copy)
|
||||
{
|
||||
if(take_copy && object)
|
||||
__OPAQUE_FUNC_REF`'(object);
|
||||
|
||||
// See the comment at the top of this file, if you want to know why the cast works.
|
||||
return Glib::RefPtr<__NAMESPACE__::__CPPNAME__>(reinterpret_cast<__NAMESPACE__::__CPPNAME__*>(object));
|
||||
}
|
||||
|
||||
} // namespace Glib
|
||||
|
||||
|
||||
__NAMESPACE_BEGIN__
|
||||
|
||||
dnl
|
||||
dnl The implementation:
|
||||
dnl
|
||||
|
||||
ifelse(__OPAQUE_FUNC_NEW,NONE,`dnl
|
||||
',`dnl else
|
||||
// static
|
||||
Glib::RefPtr<__CPPNAME__> __CPPNAME__::create()
|
||||
{
|
||||
// See the comment at the top of this file, if you want to know why the cast works.
|
||||
return Glib::RefPtr<__CPPNAME__>(reinterpret_cast<__CPPNAME__*>(__OPAQUE_FUNC_NEW`'()));
|
||||
}
|
||||
')dnl endif __OPAQUE_FUNC_NEW
|
||||
|
||||
void __CPPNAME__::reference() const
|
||||
{
|
||||
// See the comment at the top of this file, if you want to know why the cast works.
|
||||
__OPAQUE_FUNC_REF`'(reinterpret_cast<__CNAME__*>(const_cast<__CPPNAME__*>(this)));
|
||||
}
|
||||
|
||||
void __CPPNAME__::unreference() const
|
||||
{
|
||||
// See the comment at the top of this file, if you want to know why the cast works.
|
||||
__OPAQUE_FUNC_UNREF`'(reinterpret_cast<__CNAME__*>(const_cast<__CPPNAME__*>(this)));
|
||||
}
|
||||
|
||||
__CNAME__* __CPPNAME__::gobj()
|
||||
{
|
||||
// See the comment at the top of this file, if you want to know why the cast works.
|
||||
return reinterpret_cast<__CNAME__*>(this);
|
||||
}
|
||||
|
||||
const __CNAME__* __CPPNAME__::gobj() const
|
||||
{
|
||||
// See the comment at the top of this file, if you want to know why the cast works.
|
||||
return reinterpret_cast<const __CNAME__*>(this);
|
||||
}
|
||||
|
||||
__CNAME__* __CPPNAME__::gobj_copy() const
|
||||
{
|
||||
// See the comment at the top of this file, if you want to know why the cast works.
|
||||
const auto gobject = reinterpret_cast<__CNAME__*>(const_cast<__CPPNAME__*>(this));
|
||||
__OPAQUE_FUNC_REF`'(gobject);
|
||||
return gobject;
|
||||
}
|
||||
|
||||
_IMPORT(SECTION_CC)
|
||||
|
||||
__NAMESPACE_END__
|
||||
|
||||
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
_POP()
|
||||
dnl
|
||||
dnl
|
||||
dnl The actual class, e.g. Pango::FontDescription, declaration:
|
||||
dnl
|
||||
_IMPORT(SECTION_CLASS1)
|
||||
public:
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
using CppObjectType = __CPPNAME__;
|
||||
using BaseObjectType = __CNAME__;
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
ifelse(__OPAQUE_FUNC_NEW,NONE,`dnl
|
||||
',`dnl else
|
||||
static Glib::RefPtr<__CPPNAME__> create();
|
||||
')dnl endif __OPAQUE_FUNC_NEW
|
||||
|
||||
/** Increment the reference count for this object.
|
||||
* You should never need to do this manually - use the object via a RefPtr instead.
|
||||
*/
|
||||
void reference() const;
|
||||
|
||||
/** Decrement the reference count for this object.
|
||||
* You should never need to do this manually - use the object via a RefPtr instead.
|
||||
*/
|
||||
void unreference() const;
|
||||
|
||||
///Provides access to the underlying C instance.
|
||||
__CNAME__* gobj();
|
||||
|
||||
///Provides access to the underlying C instance.
|
||||
const __CNAME__* gobj() const;
|
||||
|
||||
///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
|
||||
__CNAME__* gobj_copy() const;
|
||||
|
||||
__CPPNAME__`'() = delete;
|
||||
|
||||
// noncopyable
|
||||
__CPPNAME__`'(const __CPPNAME__&) = delete;
|
||||
__CPPNAME__& operator=(const __CPPNAME__&) = delete;
|
||||
|
||||
protected:
|
||||
// Do not derive this. __NAMESPACE__::__CPPNAME__ can neither be constructed nor deleted.
|
||||
|
||||
void operator delete(void*, std::size_t);
|
||||
|
||||
private:
|
||||
_IMPORT(SECTION_CLASS2)
|
||||
')
|
||||
|
||||
344
squashfs-root/usr/lib/glibmm-2.4/proc/m4/class_shared.m4
Normal file
344
squashfs-root/usr/lib/glibmm-2.4/proc/m4/class_shared.m4
Normal file
@@ -0,0 +1,344 @@
|
||||
dnl $Id$
|
||||
|
||||
|
||||
dnl This is just a hint to generate_wrap_init.pl.
|
||||
dnl It does not generate any code in the actual .h and .cc file.
|
||||
m4_define(`_GMMPROC_EXTRA_NAMESPACE',`')
|
||||
|
||||
define(`_CLASS_START',`dnl
|
||||
_PUSH(SECTION_CLASS1)
|
||||
')
|
||||
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
define(`_H_VFUNCS_AND_SIGNALS',`dnl
|
||||
|
||||
public:
|
||||
//C++ methods used to invoke GTK+ virtual functions:
|
||||
_IMPORT(SECTION_H_VFUNCS_CPPWRAPPER)
|
||||
|
||||
protected:
|
||||
//GTK+ Virtual Functions (override these to change behaviour):
|
||||
_IMPORT(SECTION_H_VFUNCS)
|
||||
|
||||
//Default Signal Handlers::
|
||||
_IMPORT(SECTION_H_DEFAULT_SIGNAL_HANDLERS)
|
||||
')
|
||||
|
||||
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
define(`_IMPLEMENTS_INTERFACE_CC',`dnl
|
||||
_PUSH(SECTION_CC_IMPLEMENTS_INTERFACES)
|
||||
ifelse(`$2',,,`#ifdef $2'
|
||||
)dnl
|
||||
$1`'::add_interface(get_type());
|
||||
ifelse(`$2',,,`
|
||||
#endif // $2
|
||||
')dnl
|
||||
_POP()
|
||||
_PUSH(SECTION_CC_MOVE_CONSTRUCTOR_INTERFACES)
|
||||
ifelse(`$2',,,`#ifdef $2'
|
||||
)dnl
|
||||
, $1`'(std::move(src))
|
||||
ifelse(`$2',,,`
|
||||
#endif // $2
|
||||
')dnl
|
||||
_POP()
|
||||
_PUSH(SECTION_CC_MOVE_ASSIGNMENT_OPERATOR_INTERFACES)
|
||||
ifelse(`$2',,,`#ifdef $2'
|
||||
)dnl
|
||||
$1`'::operator=(std::move(src));
|
||||
ifelse(`$2',,,`
|
||||
#endif // $2
|
||||
')dnl
|
||||
_POP()
|
||||
')
|
||||
|
||||
dnl GVolumeMonitor can be broken/impeded by defining a sub-type.
|
||||
define(`_DO_NOT_DERIVE_GTYPE',`dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__BOOL_DO_NOT_DERIVE_GTYPE__',`$1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
dnl GVolumeMonitor can be broken/impeded by defining a sub-type.
|
||||
define(`_DYNAMIC_GTYPE_REGISTRATION',`dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__BOOL_DYNAMIC_GTYPE_REGISTRATION__',`$1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
dnl This macro inserts the supplied text as a Doxygen comment block before the
|
||||
dnl automatically generated declaration of a class' destructor. The inner
|
||||
dnl m4_ifelse() attempts to remove double quotes before and after the text if
|
||||
dnl it is a single line. If it is not, it returns the supplied lines, removing
|
||||
dnl trailing spaces from each of them (with an m4_patsubst()). The following
|
||||
dnl outer m4_patsubst() prepends possible multiple lines below the first one
|
||||
dnl with ' * ' by assuming that these lines are preceded by at least one space.
|
||||
dnl Finally, the outer m4_patsubst() inserts spaces after commas which are
|
||||
dnl removed by m4 in the processing.
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
define(`_DOCUMENT_DTOR',`dnl
|
||||
_PUSH(SECTION_DTOR_DOCUMENTATION)
|
||||
m4_ifelse(`$*',,,`dnl
|
||||
m4_patsubst(`m4_patsubst(`/** m4_ifelse(m4_regexp(`$*',`".*"'),-1,`m4_patsubst(`$*',`\s*$')',`m4_regexp(`$*',`"\s*\(.*\)\(\S\)\s*"',`\1\2')')',`^\s+',` * ')',`,',`, ')
|
||||
*/
|
||||
')dnl
|
||||
_POP()
|
||||
')
|
||||
|
||||
|
||||
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
define(`_PH_CLASS_DECLARATION',`dnl
|
||||
class __CPPNAME__`'_Class : public Glib::Class
|
||||
{
|
||||
public:
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
using CppObjectType = __CPPNAME__;
|
||||
using BaseObjectType = __REAL_CNAME__;
|
||||
ifdef(`__BOOL_DO_NOT_DERIVE_GTYPE__',`dnl
|
||||
using CppClassParent = __CPPPARENT__`'_Class;
|
||||
',`dnl
|
||||
using BaseClassType = __REAL_CNAME__`'Class;
|
||||
using CppClassParent = __CPPPARENT__`'_Class;
|
||||
using BaseClassParent = __REAL_CPARENT__`'Class;
|
||||
')dnl
|
||||
|
||||
friend class __CPPNAME__;
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
const Glib::Class& init();
|
||||
|
||||
ifdef(`__BOOL_DYNAMIC_GTYPE_REGISTRATION__',`
|
||||
const Glib::Class& init(GTypeModule* module);
|
||||
',`')
|
||||
|
||||
ifdef(`__BOOL_DO_NOT_DERIVE_GTYPE__',`dnl
|
||||
',`dnl
|
||||
static void class_init_function(void* g_class, void* class_data);
|
||||
')dnl
|
||||
|
||||
static Glib::ObjectBase* wrap_new(GObject*);
|
||||
|
||||
protected:
|
||||
|
||||
//Callbacks (default signal handlers):
|
||||
//These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
|
||||
//You could prevent the original default signal handlers being called by overriding the *_impl method.
|
||||
_IMPORT(SECTION_PH_DEFAULT_SIGNAL_HANDLERS)
|
||||
|
||||
//Callbacks (virtual functions):
|
||||
_IMPORT(SECTION_PH_VFUNCS)
|
||||
};
|
||||
')
|
||||
|
||||
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
define(`_PCC_CLASS_IMPLEMENTATION',`dnl
|
||||
const Glib::Class& __CPPNAME__`'_Class::init()
|
||||
{
|
||||
if(!gtype_) // create the GType if necessary
|
||||
{
|
||||
ifdef(`__BOOL_DO_NOT_DERIVE_GTYPE__',`dnl
|
||||
// Do not derive a GType, or use a derived klass:
|
||||
gtype_ = CppClassParent::CppObjectType::get_type();
|
||||
',`dnl
|
||||
// Glib::Class has to know the class init function to clone custom types.
|
||||
class_init_func_ = &__CPPNAME__`'_Class::class_init_function;
|
||||
|
||||
// This is actually just optimized away, apparently with no harm.
|
||||
// Make sure that the parent type has been created.
|
||||
//CppClassParent::CppObjectType::get_type();
|
||||
|
||||
// Create the wrapper type, with the same class/instance size as the base type.
|
||||
register_derived_type(_LOWER(__CCAST__)_get_type());
|
||||
|
||||
// Add derived versions of interfaces, if the C type implements any interfaces:
|
||||
_IMPORT(SECTION_CC_IMPLEMENTS_INTERFACES)
|
||||
')
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
ifdef(`__BOOL_DYNAMIC_GTYPE_REGISTRATION__',`
|
||||
const Glib::Class& __CPPNAME__`'_Class::init(GTypeModule* module)
|
||||
{
|
||||
if(!gtype_) // create the GType if necessary
|
||||
{
|
||||
ifdef(`__BOOL_DO_NOT_DERIVE_GTYPE__',`dnl
|
||||
// Do not derive a GType, or use a derived klass:
|
||||
gtype_ = CppClassParent::CppObjectType::get_type();
|
||||
',`dnl
|
||||
// Glib::Class has to know the class init function to clone custom types.
|
||||
class_init_func_ = &__CPPNAME__`'_Class::class_init_function;
|
||||
|
||||
// This is actually just optimized away, apparently with no harm.
|
||||
// Make sure that the parent type has been created.
|
||||
//CppClassParent::CppObjectType::get_type();
|
||||
|
||||
// Create the wrapper type, with the same class/instance size as the base type.
|
||||
register_derived_type(_LOWER(__CCAST__)_get_type(), module);
|
||||
|
||||
// Add derived versions of interfaces, if the C type implements any interfaces:
|
||||
_IMPORT(SECTION_CC_IMPLEMENTS_INTERFACES)
|
||||
')
|
||||
}
|
||||
|
||||
return *this;
|
||||
',`')
|
||||
|
||||
ifdef(`__BOOL_DO_NOT_DERIVE_GTYPE__',`dnl
|
||||
',`dnl
|
||||
|
||||
void __CPPNAME__`'_Class::class_init_function(void* g_class, void* class_data)
|
||||
{
|
||||
const auto klass = static_cast<BaseClassType*>(g_class);
|
||||
CppClassParent::class_init_function(klass, class_data);
|
||||
|
||||
_IMPORT(SECTION_PCC_CLASS_INIT_VFUNCS)
|
||||
|
||||
_IMPORT(SECTION_PCC_CLASS_INIT_DEFAULT_SIGNAL_HANDLERS)
|
||||
}
|
||||
')dnl
|
||||
|
||||
_IMPORT(SECTION_PCC_VFUNCS)
|
||||
|
||||
_IMPORT(SECTION_PCC_DEFAULT_SIGNAL_HANDLERS)
|
||||
')
|
||||
|
||||
|
||||
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
define(`_CC_CLASS_IMPLEMENTATION',`dnl
|
||||
__CPPNAME__::CppClassType __CPPNAME__::`'__BASE__`'_class_; // initialize static member
|
||||
|
||||
GType __CPPNAME__::get_type()
|
||||
{
|
||||
return __BASE__`'_class_.init().get_type();
|
||||
}
|
||||
|
||||
ifdef(`__BOOL_DYNAMIC_GTYPE_REGISTRATION__',`
|
||||
GType __CPPNAME__::get_type(GTypeModule* module)
|
||||
{
|
||||
return __BASE__`'_class_.init(module).get_type();
|
||||
}
|
||||
'dnl
|
||||
,`'dnl
|
||||
)
|
||||
|
||||
GType __CPPNAME__::get_base_type()
|
||||
{
|
||||
return _LOWER(__CCAST__)_get_type();
|
||||
}
|
||||
|
||||
_IMPORT(SECTION_CC)
|
||||
|
||||
dnl _IMPORT(SECTION_CC_SIGNALPROXIES_CUSTOM)
|
||||
|
||||
_IMPORT(SECTION_CC_SIGNALPROXIES)
|
||||
|
||||
_IMPORT(SECTION_CC_PROPERTYPROXIES)
|
||||
|
||||
_IMPORT(SECTION_CC_DEFAULT_SIGNAL_HANDLERS)
|
||||
|
||||
_IMPORT(SECTION_CC_VFUNCS)
|
||||
_IMPORT(SECTION_CC_VFUNCS_CPPWRAPPER)
|
||||
')
|
||||
|
||||
dnl _PARENT_GCLASS_FROM_OBJECT(object_instance_name)
|
||||
define(`_PARENT_GCLASS_FROM_OBJECT',`dnl
|
||||
g_type_class_peek_parent`'(G_OBJECT_GET_CLASS`'($1)) // Get the parent class of the object class (The original underlying C class).
|
||||
')
|
||||
|
||||
dnl _IFACE_PARENT_FROM_OBJECT(object_instance_name)
|
||||
define(`_IFACE_PARENT_FROM_OBJECT',`dnl
|
||||
g_type_interface_peek_parent`'( // Get the parent interface of the interface (The original underlying C interface).
|
||||
g_type_interface_peek`'(G_OBJECT_GET_CLASS`'($1), CppObjectType::get_type`'()) // Get the interface.
|
||||
)dnl
|
||||
')
|
||||
|
||||
dnl Bonobo doesn't use the "typedef struct _somestruct struct" system.
|
||||
define(`_STRUCT_NOT_HIDDEN',`dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later.
|
||||
define(`__BOOL_STRUCT_NOT_HIDDEN__',`$1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
dnl _STRUCT_PROTOTYPE()
|
||||
define(`_STRUCT_PROTOTYPE',`dnl
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
ifdef(`__BOOL_STRUCT_NOT_HIDDEN__',`dnl
|
||||
',`dnl
|
||||
using __CNAME__ = struct _`'__CNAME__;
|
||||
using __CNAME__`'Class = struct _`'__CNAME__`'Class;
|
||||
')dnl
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
undefine(`__BOOL_STRUCT_NOT_HIDDEN__')dnl
|
||||
')
|
||||
|
||||
dnl _GTKMMPROC_WIN32_NO_WRAP
|
||||
dnl Just process it to remove it from the generated file.
|
||||
dnl generate_wrap_init.pl will look for this in the original .hg file.
|
||||
dnl
|
||||
define(`_GTKMMPROC_WIN32_NO_WRAP', dnl
|
||||
`//This is not available on Win32.
|
||||
//This source file will not be compiled on Win32,
|
||||
//and no class defined in it will be registered by wrap_init`'().
|
||||
')dnl
|
||||
|
||||
dnl _GMMPROC_WRAP_CONDITIONALLY(preprocessor_if/ifdef/ifndef_directive_without_#)
|
||||
dnl Just process it to remove it from the generated file.
|
||||
dnl generate_wrap_init.pl will look for this in the original .hg file.
|
||||
dnl
|
||||
dnl Example calls:
|
||||
dnl _GMMPROC_WRAP_CONDITIONALLY(ifndef G_OS_WIN32) # Same as _GTKMMPROC_WIN32_NO_WRAP
|
||||
dnl _GMMPROC_WRAP_CONDITIONALLY(ifdef GDK_WINDOWING_X11)
|
||||
dnl _GMMPROC_WRAP_CONDITIONALLY(`if defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_QUARTZ)')
|
||||
dnl
|
||||
define(`_GMMPROC_WRAP_CONDITIONALLY', dnl
|
||||
`//This is available only #$1.
|
||||
//Otherwise this source file will not be compiled,
|
||||
//and no class defined in it will be registered by wrap_init`'().
|
||||
')dnl
|
||||
|
||||
dnl _INCLUDE_IN_WRAP_INIT(file)
|
||||
dnl Usually used in combination with _GMMPROC_WRAP_CONDITIONALLY.
|
||||
dnl It does not generate any code in the .h and .cc files.
|
||||
dnl generate_wrap_init.pl will look for this in the original .hg file.
|
||||
dnl
|
||||
define(`_INCLUDE_IN_WRAP_INIT',`')dnl
|
||||
|
||||
dnl _IS_DEPRECATED
|
||||
dnl ifdef-out the whole .h and .cc files.
|
||||
dnl generate_wrap_init.pl will look for this in the original .hg file.
|
||||
define(`_IS_DEPRECATED',`dnl
|
||||
_PUSH()
|
||||
dnl Define this macro to be tested for later. See base.m4.
|
||||
define(`__BOOL_DEPRECATED__',`$1')
|
||||
_POP()
|
||||
')
|
||||
|
||||
dnl _NO_WRAP_INIT_REGISTRATION
|
||||
dnl Used to tag the classes in a file as one not be registered by the
|
||||
dnl wrap_init() function (all the classes in the file will not be registered).
|
||||
dnl This macro does not generate any code in the .h and .cc files.
|
||||
dnl generate_wrap_init.pl will look for this in the original .hg file.
|
||||
dnl
|
||||
define(`_NO_WRAP_INIT_REGISTRATION',`')dnl
|
||||
118
squashfs-root/usr/lib/glibmm-2.4/proc/m4/compare.m4
Normal file
118
squashfs-root/usr/lib/glibmm-2.4/proc/m4/compare.m4
Normal file
@@ -0,0 +1,118 @@
|
||||
dnl $Id$
|
||||
|
||||
define(`__OPERATOR_DECL',`dnl
|
||||
/** @relates __NAMESPACE__::__CPPNAME__
|
||||
* @param lhs The left-hand side
|
||||
* @param rhs The right-hand side
|
||||
* @result The result
|
||||
*/
|
||||
bool operator`'$1`'(const __CPPNAME__& lhs, const __CPPNAME__& rhs);
|
||||
')
|
||||
|
||||
define(`__OPERATOR_IMPL',`dnl
|
||||
bool operator`'$1`'(const __CPPNAME__& lhs, const __CPPNAME__& rhs)
|
||||
{'
|
||||
ifelse`'(`__UNCONST__',`unconst',`dnl
|
||||
return ($2`'(const_cast<__CNAME__*>(lhs.gobj()), const_cast<__CNAME__*>(rhs.gobj())) $3);
|
||||
',`dnl else
|
||||
return ($2`'(lhs.gobj(), rhs.gobj()) $3);
|
||||
')`dnl endif
|
||||
}
|
||||
')
|
||||
|
||||
|
||||
dnl
|
||||
dnl _WRAP_EQUAL(gdk_region_equal, unconst)
|
||||
dnl
|
||||
define(`_WRAP_EQUAL',`dnl
|
||||
pushdef(`__FUNC_EQUAL__',$1)dnl
|
||||
pushdef(`__UNCONST__',$2)dnl
|
||||
_PUSH(SECTION_HEADER3)
|
||||
|
||||
__NAMESPACE_BEGIN__
|
||||
|
||||
__OPERATOR_DECL(`==')
|
||||
__OPERATOR_DECL(`!=')
|
||||
|
||||
__NAMESPACE_END__
|
||||
|
||||
_SECTION(SECTION_CC)
|
||||
|
||||
__OPERATOR_IMPL(`==', __FUNC_EQUAL__, `!= 0')
|
||||
__OPERATOR_IMPL(`!=', __FUNC_EQUAL__, `== 0')
|
||||
|
||||
_POP()
|
||||
popdef(`__UNCONST__')dnl
|
||||
popdef(`__FUNC_EQUAL__')dnl
|
||||
')dnl enddef _WRAP_EQUAL
|
||||
|
||||
|
||||
dnl
|
||||
dnl _WRAP_COMPARE(gtk_tree_path_compare)
|
||||
dnl
|
||||
define(`_WRAP_COMPARE',`dnl
|
||||
pushdef(`__FUNC_COMPARE__',$1)dnl
|
||||
pushdef(`__UNCONST__',$2)dnl
|
||||
_PUSH(SECTION_HEADER3)
|
||||
|
||||
__NAMESPACE_BEGIN__
|
||||
|
||||
__OPERATOR_DECL(`==')
|
||||
__OPERATOR_DECL(`!=')
|
||||
__OPERATOR_DECL(`<')
|
||||
__OPERATOR_DECL(`>')
|
||||
__OPERATOR_DECL(`<=')
|
||||
__OPERATOR_DECL(`>=')
|
||||
|
||||
__NAMESPACE_END__
|
||||
|
||||
_SECTION(SECTION_CC)
|
||||
|
||||
__OPERATOR_IMPL(`==', __FUNC_COMPARE__, `== 0')
|
||||
__OPERATOR_IMPL(`!=', __FUNC_COMPARE__, `!= 0')
|
||||
__OPERATOR_IMPL(`<', __FUNC_COMPARE__, `< 0')
|
||||
__OPERATOR_IMPL(`>', __FUNC_COMPARE__, `> 0')
|
||||
__OPERATOR_IMPL(`<=', __FUNC_COMPARE__, `<= 0')
|
||||
__OPERATOR_IMPL(`>=', __FUNC_COMPARE__, `>= 0')
|
||||
|
||||
_POP()
|
||||
popdef(`__UNCONST__')dnl
|
||||
popdef(`__FUNC_COMPARE__')dnl
|
||||
')dnl enddef _WRAP_COMPARE
|
||||
|
||||
|
||||
dnl
|
||||
dnl _WRAP_EQUAL_AND_COMPARE(gtk_text_iter_equal, gtk_text_iter_compare)
|
||||
dnl
|
||||
define(`_WRAP_EQUAL_AND_COMPARE',`dnl
|
||||
pushdef(`__FUNC_EQUAL__',$1)dnl
|
||||
pushdef(`__FUNC_COMPARE__',$2)dnl
|
||||
pushdef(`__UNCONST__',$3)dnl
|
||||
_PUSH(SECTION_HEADER3)
|
||||
|
||||
__NAMESPACE_BEGIN__
|
||||
|
||||
__OPERATOR_DECL(`==')
|
||||
__OPERATOR_DECL(`!=')
|
||||
__OPERATOR_DECL(`<')
|
||||
__OPERATOR_DECL(`>')
|
||||
__OPERATOR_DECL(`<=')
|
||||
__OPERATOR_DECL(`>=')
|
||||
|
||||
__NAMESPACE_END__
|
||||
|
||||
_SECTION(SECTION_CC)
|
||||
|
||||
__OPERATOR_IMPL(`==', __FUNC_EQUAL__, `!= 0')
|
||||
__OPERATOR_IMPL(`!=', __FUNC_EQUAL__, `== 0')
|
||||
__OPERATOR_IMPL(`<', __FUNC_COMPARE__, `< 0')
|
||||
__OPERATOR_IMPL(`>', __FUNC_COMPARE__, `> 0')
|
||||
__OPERATOR_IMPL(`<=', __FUNC_COMPARE__, `<= 0')
|
||||
__OPERATOR_IMPL(`>=', __FUNC_COMPARE__, `>= 0')
|
||||
|
||||
_POP()
|
||||
popdef(`__UNCONST__')dnl
|
||||
popdef(`__FUNC_COMPARE__')dnl
|
||||
popdef(`__FUNC_EQUAL__')dnl
|
||||
')dnl enddef _WRAP_EQUAL_AND_COMPARE
|
||||
|
||||
6
squashfs-root/usr/lib/glibmm-2.4/proc/m4/convert.m4
Normal file
6
squashfs-root/usr/lib/glibmm-2.4/proc/m4/convert.m4
Normal file
@@ -0,0 +1,6 @@
|
||||
dnl $Id$
|
||||
|
||||
# Other libraries, such as libgnomeuimm, can provide their own convert.m4 files,
|
||||
# Maybe choosing to include the same files as this one.
|
||||
|
||||
include(convert_glibmm.m4)
|
||||
88
squashfs-root/usr/lib/glibmm-2.4/proc/m4/convert_base.m4
Normal file
88
squashfs-root/usr/lib/glibmm-2.4/proc/m4/convert_base.m4
Normal file
@@ -0,0 +1,88 @@
|
||||
dnl $Id$
|
||||
|
||||
#
|
||||
# Define a hashing for names
|
||||
#
|
||||
define(`__HASH',`__`'m4_translit(`$*',`ABCDEFGHIJKLMNOPQRSTUVWXYZ<>[]&*, ',`abcdefghijklmnopqrstuvwxyzVBNMRSC_')`'')
|
||||
define(`__EQUIV',`m4_ifdef(EV`'__HASH(`$1'),EV`'__HASH(`$1'),`$1')')
|
||||
|
||||
dnl __HASH2(firsttype, secondtype)
|
||||
dnl
|
||||
dnl Provides a textual combination of the two given types which can be used as
|
||||
dnl a hash to store and retrieve conversions and initializations. It first
|
||||
dnl sees if the two types have equivalent types that should be used in their
|
||||
dnl places (using the __EQUIV macro above). Since the types returned by
|
||||
dnl __EQUIV may contain commas (because of types such as std::map<>), quote the
|
||||
dnl call to the macro to avoid the types to be interpreted as more than one
|
||||
dnl argument to the pushdef() calls. Also quote the expansion of the __E1 and
|
||||
dnl __E2 macros in the m4_ifelse for the same reason.
|
||||
define(`__HASH2',`dnl
|
||||
pushdef(`__E1',`__EQUIV(`$1')')pushdef(`__E2',`__EQUIV(`$2')')dnl
|
||||
m4_ifelse(_QUOTE(__E1),_QUOTE(__E2),`__EQ',__HASH(__E1)`'__HASH(__E2))`'dnl
|
||||
popdef(`__E1')popdef(`__E2')`'')
|
||||
|
||||
define(`CF__EQ',`$3')
|
||||
|
||||
# _CONVERT(fromtype, totype, name, wrap_line)
|
||||
#
|
||||
# Print the conversion from 'fromtype' to 'totype'
|
||||
define(`_CONVERT',`dnl
|
||||
m4_ifelse(`$2',void,`$3',`dnl
|
||||
pushdef(`__COV',`CF`'__HASH2(`$1',`$2')')dnl
|
||||
m4_ifdef(__COV,`m4_indir(__COV,`$1',`$2',`$3')',`
|
||||
m4_errprint(`No conversion from $1 to $2 defined (line: $4, parameter name: $3)
|
||||
')
|
||||
m4_m4exit(1)
|
||||
')`'dnl
|
||||
')`'dnl
|
||||
')
|
||||
|
||||
|
||||
# _CONVERSION(fromtype, totype, conversion)
|
||||
#
|
||||
# Functions for populating the tables.
|
||||
#
|
||||
define(`_CONVERSION',`
|
||||
m4_ifelse(`$3',,,`define(CF`'__HASH2(`$1',`$2'),`$3')')
|
||||
')
|
||||
|
||||
define(`_EQUAL',`define(EV`'__HASH(`$1'),`$2')')
|
||||
|
||||
/*******************************************************************/
|
||||
|
||||
|
||||
define(`__ARG3__',`$`'3')
|
||||
define(`_CONV_ENUM',`dnl
|
||||
_CONVERSION(`$1$2', `$2', (($2)(__ARG3__)))
|
||||
_CONVERSION(`$1$2', `$1::$2', (($1::$2)(__ARG3__)))
|
||||
_CONVERSION(`$2', `$1$2', (($1$2)(__ARG3__)))
|
||||
_CONVERSION(`$1::$2', `$1$2', (($1$2)(__ARG3__)))
|
||||
')dnl
|
||||
|
||||
# e.g. Glib::RefPtr<Gdk::Something> to GdkSomething*
|
||||
define(`__CONVERT_REFPTR_TO_P',`Glib::unwrap($`'3)')
|
||||
|
||||
define(`__FR2P',`($`'3).gobj()')
|
||||
define(`__CFR2P',`const_cast<$`'2>($`'3.gobj())')
|
||||
define(`__FCR2P',`const_cast<$`'2>(($`'3).gobj())')
|
||||
|
||||
define(`__FL2H_SHALLOW',`$`'2($`'3, Glib::OWNERSHIP_SHALLOW)')
|
||||
|
||||
# e.g. Glib::RefPtr<const Gdk::Something> to GdkSomething*
|
||||
#define(`__CONVERT_CONST_REFPTR_TO_P',`const_cast<$`'2>($`'3->gobj())')
|
||||
define(`__CONVERT_CONST_REFPTR_TO_P',`const_cast<$`'2>(Glib::unwrap($`'3))')
|
||||
|
||||
# The Sun Forte compiler doesn't seem to be able to handle these, so we are using the altlernative, __CONVERT_CONST_REFPTR_TO_P_SUN.
|
||||
# The Sun compiler gives this error, for instance:
|
||||
#<23> "widget.cc", line 4463: Error: Overloading ambiguity between "Glib::unwrap<Gdk::Window>(const Glib::RefPtr<const Gdk::Window>&)" and
|
||||
# "Glib::unwrap<const Gdk::Window>(const Glib::RefPtr<const Gdk::Window>&)".
|
||||
#
|
||||
define(`__CONVERT_CONST_REFPTR_TO_P_SUN',`const_cast<$`'2>(Glib::unwrap<$1>($`'3))')
|
||||
|
||||
|
||||
#include(convert_gtk.m4)
|
||||
#include(convert_pango.m4)
|
||||
#include(convert_gdk.m4)
|
||||
#include(convert_atk.m4)
|
||||
include(convert_glib.m4)
|
||||
|
||||
341
squashfs-root/usr/lib/glibmm-2.4/proc/m4/convert_gio.m4
Normal file
341
squashfs-root/usr/lib/glibmm-2.4/proc/m4/convert_gio.m4
Normal file
@@ -0,0 +1,341 @@
|
||||
_CONV_ENUM(G,AppInfoCreateFlags)
|
||||
_CONV_ENUM(G,ApplicationFlags)
|
||||
_CONV_ENUM(G,AskPasswordFlags)
|
||||
_CONV_ENUM(G,BusType)
|
||||
_CONV_ENUM(G,ConverterFlags)
|
||||
_CONV_ENUM(G,ConverterResult)
|
||||
_CONV_ENUM(G,CredentialsType)
|
||||
_CONV_ENUM(G,DataStreamByteOrder)
|
||||
_CONV_ENUM(G,DataStreamNewlineType)
|
||||
_CONV_ENUM(GDBus,CallFlags)
|
||||
_CONV_ENUM(GDBus,CapabilityFlags)
|
||||
_CONV_ENUM(GDBus, InterfaceSkeletonFlags)
|
||||
_CONV_ENUM(GDBus,MessageFlags)
|
||||
_CONV_ENUM(GDBus,MessageHeaderField)
|
||||
_CONV_ENUM(GDBus,MessageType)
|
||||
_CONV_ENUM(GDBus,ProxyFlags)
|
||||
_CONV_ENUM(GDBus,SendMessageFlags)
|
||||
_CONV_ENUM(GDBus,ServerFlags)
|
||||
_CONV_ENUM(G,DriveStartFlags)
|
||||
_CONV_ENUM(G,DriveStartFlags)
|
||||
_CONV_ENUM(G,DriveStartStopType)
|
||||
_CONV_ENUM(G,EmblemOrigin)
|
||||
_CONV_ENUM(G,FileAttributeInfoFlags)
|
||||
_CONV_ENUM(G,FileAttributeStatus)
|
||||
_CONV_ENUM(G,FileAttributeType)
|
||||
_CONV_ENUM(G,FileCopyFlags)
|
||||
_CONV_ENUM(G,FileCreateFlags)
|
||||
_CONV_ENUM(G,FileMonitorEvent)
|
||||
_CONV_ENUM(G,FileMonitorFlags)
|
||||
_CONV_ENUM(G,FileQueryInfoFlags)
|
||||
_CONV_ENUM(G,FileType)
|
||||
_CONV_ENUM(G,MountMountFlags)
|
||||
_CONV_ENUM(G,MountOperationResult)
|
||||
_CONV_ENUM(G,MountUnmountFlags)
|
||||
_CONV_ENUM(G,NetworkConnectivity)
|
||||
_CONV_ENUM(G,NotificationPriority)
|
||||
_CONV_ENUM(G,OutputStreamSpliceFlags)
|
||||
_CONV_ENUM(G,PasswordSave)
|
||||
_CONV_ENUM(G,ResolverRecordType)
|
||||
_CONV_ENUM(G,ResourceFlags)
|
||||
_CONV_ENUM(G,ResourceLookupFlags)
|
||||
_CONV_ENUM(G,SettingsBindFlags)
|
||||
_CONV_ENUM(G,SocketClientEvent)
|
||||
_CONV_ENUM(G,SocketFamily)
|
||||
_CONV_ENUM(G,SocketMsgFlags)
|
||||
_CONV_ENUM(G,SocketProtocol)
|
||||
_CONV_ENUM(G,SocketType)
|
||||
_CONV_ENUM(G,TlsCertificateFlags)
|
||||
_CONV_ENUM(G,TlsCertificateRequestFlags)
|
||||
_CONV_ENUM(G,TlsDatabaseVerifyFlags)
|
||||
_CONV_ENUM(G,TlsDatabaseLookupFlags)
|
||||
_CONV_ENUM(G,TlsInteractionResult)
|
||||
_CONV_ENUM(G,TlsPasswordFlags)
|
||||
_CONV_ENUM(G,TlsRehandshakeMode)
|
||||
_CONV_ENUM(G,UnixSocketAddressType)
|
||||
_CONV_ENUM(G,ZlibCompressorFormat)
|
||||
|
||||
# Action
|
||||
_CONVERSION(`GAction*',`Glib::RefPtr<Action>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<Action>&',`GAction*',__CONVERT_REFPTR_TO_P)
|
||||
|
||||
# ActionGroup
|
||||
_CONVERSION(`const Glib::RefPtr<ActionGroup>&',`GActionGroup*',__CONVERT_REFPTR_TO_P)
|
||||
|
||||
# AppInfo
|
||||
_CONVERSION(`GAppInfo*',`Glib::RefPtr<AppInfo>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<AppLaunchContext>&',`GAppLaunchContext*',__CONVERT_REFPTR_TO_P)
|
||||
_CONVERSION(`GAppLaunchContext*',`const Glib::RefPtr<AppLaunchContext>&',Glib::wrap($3))
|
||||
_CONVERSION(`const Glib::RefPtr<AppInfo>&',`GAppInfo*',__CONVERT_REFPTR_TO_P)
|
||||
_CONVERSION(`Glib::RefPtr<AppInfo>',`GAppInfo*',__CONVERT_REFPTR_TO_P)
|
||||
_CONVERSION(`GAppInfo*',`const Glib::RefPtr<AppInfo>&',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::ListHandle< Glib::RefPtr<Gio::File> >&',`GList*',`$3.data()')
|
||||
|
||||
# Application
|
||||
_CONVERSION(`GApplication*',`Glib::RefPtr<Application>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<Application>&',`GApplication*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
|
||||
# ApplicationCommandLine
|
||||
_CONVERSION(`const Glib::RefPtr<ApplicationCommandLine>&',`GApplicationCommandLine*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
|
||||
# AsyncResult
|
||||
_CONVERSION(`Glib::RefPtr<Glib::Object>',`GObject*',__CONVERT_REFPTR_TO_P)
|
||||
_CONVERSION(`const Glib::RefPtr<AsyncResult>&',`GAsyncResult*',__CONVERT_REFPTR_TO_P)
|
||||
_CONVERSION(`Glib::RefPtr<AsyncResult>&',`GAsyncResult*',__CONVERT_REFPTR_TO_P)
|
||||
|
||||
#ByteArray
|
||||
_CONVERSION(`const Glib::RefPtr<Glib::ByteArray>&',`GByteArray*',`Glib::unwrap($3)')
|
||||
|
||||
# Cancellable
|
||||
_CONVERSION(`const Glib::RefPtr<Cancellable>&',`GCancellable*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
_CONVERSION(`const Glib::RefPtr<Gio::Cancellable>&',`GCancellable*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
_CONVERSION(`GCancellable*', `Glib::RefPtr<Cancellable>', `Glib::wrap($3)')
|
||||
_CONVERSION(`GCancellable*', `const Glib::RefPtr<Cancellable>&', `Glib::wrap($3)')
|
||||
|
||||
# Converter
|
||||
_CONVERSION(`const Glib::RefPtr<Converter>&',`GConverter*',`Glib::unwrap($3)')
|
||||
_CONVERSION(`GConverter*',`Glib::RefPtr<Converter>',`Glib::wrap($3)')
|
||||
|
||||
# Credentials
|
||||
_CONVERSION(`const Glib::RefPtr<Credentials>&',`GCredentials*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gio::Credentials))
|
||||
_CONVERSION(`const Glib::RefPtr<const Credentials>&',`GCredentials*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gio::Credentials))
|
||||
_CONVERSION(`GCredentials*',`Glib::RefPtr<Credentials>',`Glib::wrap($3)')
|
||||
_CONVERSION(`GCredentials*',`Glib::RefPtr<const Credentials>',`Glib::wrap($3)')
|
||||
|
||||
# DBusConnection
|
||||
_CONVERSION(`const Glib::RefPtr<Connection>&',`GDBusConnection*',__CONVERT_REFPTR_TO_P)
|
||||
_CONVERSION(`const Glib::RefPtr<const Connection>&',`GDBusConnection*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
_CONVERSION(`GDBusConnection*',`Glib::RefPtr<Connection>',Glib::wrap($3))
|
||||
_CONVERSION(`GDBusConnection*',`Glib::RefPtr<const Connection>',Glib::wrap($3))
|
||||
_CONVERSION(`GDBusConnection*',`Glib::RefPtr<DBus::Connection>',Glib::wrap($3))
|
||||
_CONVERSION(`GDBusConnection*',`Glib::RefPtr<const DBus::Connection>',Glib::wrap($3))
|
||||
|
||||
# DBusMessage
|
||||
_CONVERSION(`const Glib::RefPtr<Message>&',`GDBusMessage*',__CONVERT_REFPTR_TO_P)
|
||||
_CONVERSION(`GDBusMessage*',`Glib::RefPtr<Message>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<const Message>&',`GDBusMessage*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
|
||||
# DBus*Info
|
||||
_CONVERSION(`GDBusMethodInfo*',`Glib::RefPtr<MethodInfo>',`Glib::wrap($3)')
|
||||
_CONVERSION(`GDBusSignalInfo*',`Glib::RefPtr<SignalInfo>',`Glib::wrap($3)')
|
||||
_CONVERSION(`GDBusPropertyInfo*',`Glib::RefPtr<PropertyInfo>',`Glib::wrap($3)')
|
||||
_CONVERSION(`GDBusNodeInfo*',`Glib::RefPtr<NodeInfo>',`Glib::wrap($3)')
|
||||
_CONVERSION(`GDBusInterfaceInfo*',`Glib::RefPtr<InterfaceInfo>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<InterfaceInfo>&',`GDBusInterfaceInfo*',`Glib::unwrap($3)')
|
||||
_CONVERSION(`Glib::RefPtr<InterfaceInfo>',`GDBusInterfaceInfo*',`Glib::unwrap($3)')
|
||||
_CONVERSION(`GDBusInterfaceInfo*',`const Glib::RefPtr<InterfaceInfo>',`Glib::wrap($3)')
|
||||
|
||||
# DBusInterface
|
||||
_CONVERSION(`GDBusInterface*',`Glib::RefPtr<Gio::DBus::Interface>',`Glib::wrap($3)')
|
||||
_CONVERSION(`Glib::RefPtr<Gio::DBus::Interface>',`GDBusInterface*',`Glib::unwrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<Gio::DBus::Interface>&',`GDBusInterface*',`Glib::unwrap($3)')
|
||||
|
||||
# DBusMethodInvocation
|
||||
_CONVERSION(`const Glib::RefPtr<MethodInvocation>&',`GDBusMethodInvocation*',`Glib::unwrap($3)')
|
||||
|
||||
# DBusObject
|
||||
_CONVERSION(`GDBusObject*',`Glib::RefPtr<Gio::DBus::Object>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<Gio::DBus::Object>&',`GDBusObject*',`Glib::unwrap($3)')
|
||||
_CONVERSION(`Glib::RefPtr<Gio::DBus::Object>',`GDBusObject*',`Glib::unwrap($3)')
|
||||
|
||||
# DBusProxy
|
||||
_CONVERSION(`GDBusProxy*',`Glib::RefPtr<Gio::DBus::Proxy>',`Glib::wrap($3)')
|
||||
|
||||
# DesktopAppInfo
|
||||
_CONVERSION(`GDesktopAppInfo*', `Glib::RefPtr<DesktopAppInfo>', `Glib::wrap($3)')
|
||||
|
||||
# Drive
|
||||
_CONVERSION(`GDrive*',`Glib::RefPtr<Drive>',`Glib::wrap($3)')
|
||||
|
||||
# File
|
||||
_CONVERSION(`return-char*',`std::string',`Glib::convert_return_gchar_ptr_to_stdstring($3)')
|
||||
_CONVERSION(`Glib::RefPtr<File>',`GFile*',__CONVERT_REFPTR_TO_P)
|
||||
_CONVERSION(`const Glib::RefPtr<File>&',`GFile*',__CONVERT_REFPTR_TO_P)
|
||||
_CONVERSION(`const Glib::RefPtr<const File>&',`GFile*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gio::File))
|
||||
_CONVERSION(`GFile*',`Glib::RefPtr<File>',`Glib::wrap($3)')
|
||||
_CONVERSION(`GFile*',`Glib::RefPtr<const File>',`Glib::wrap($3)')
|
||||
|
||||
# FileAttribute
|
||||
_CONVERSION(`GFileAttributeValue*',`FileAttributeValue',`Glib::wrap($3)')
|
||||
_CONVERSION(`const FileAttributeValue&',`const GFileAttributeValue*',`$3.gobj()')
|
||||
_CONVERSION(`GFileAttributeInfoList*',`Glib::RefPtr<FileAttributeInfoList>',`Glib::wrap($3)')
|
||||
|
||||
# FileAttributeMatcher
|
||||
_CONVERSION(`GFileAttributeMatcher*',`Glib::RefPtr<FileAttributeMatcher>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<const FileAttributeMatcher>&',`GFileAttributeMatcher*',`const_cast<GFileAttributeMatcher*>(Glib::unwrap($3))')
|
||||
|
||||
#FileEnumerator
|
||||
_CONVERSION(`GFileEnumerator*',`Glib::RefPtr<FileEnumerator>',`Glib::wrap($3)')
|
||||
|
||||
# FileInfo
|
||||
_CONVERSION(`GFileInfo*',`Glib::RefPtr<FileInfo>',`Glib::wrap($3)')
|
||||
_CONVERSION(`Glib::RefPtr<FileInfo>&',`GFileInfo*',__CONVERT_REFPTR_TO_P)
|
||||
_CONVERSION(`const Glib::RefPtr<FileInfo>&',`GFileInfo*',__CONVERT_REFPTR_TO_P)
|
||||
_CONVERSION(`Glib::TimeVal&', `GTimeVal*', static_cast<$2>(&$3))
|
||||
_CONVERSION(`const Glib::TimeVal&', `GTimeVal*', const_cast<GTimeVal*>(static_cast<const GTimeVal*>(&$3)))
|
||||
_CONVERSION(`const Glib::RefPtr<FileAttributeMatcher>&',`GFileAttributeMatcher*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
|
||||
# FileInputStream
|
||||
_CONVERSION(`GFileInputStream*',`Glib::RefPtr<FileInputStream>',`Glib::wrap($3)')
|
||||
|
||||
# FileMonitor
|
||||
_CONVERSION(`GFileMonitor*',`Glib::RefPtr<FileMonitor>',`Glib::wrap($3)')
|
||||
|
||||
# FileOutputStream
|
||||
_CONVERSION(`GFileOutputStream*',`Glib::RefPtr<FileOutputStream>',`Glib::wrap($3)')
|
||||
|
||||
# FilterInputStream
|
||||
#_CONVERSION(`GFilterInputStream*',`Glib::RefPtr<FilterInputStream>',`Glib::wrap($3)')
|
||||
|
||||
_CONVERSION(`GFileIOStream*',`Glib::RefPtr<FileIOStream>',`Glib::wrap($3)')
|
||||
|
||||
# Icon
|
||||
_CONVERSION(`GIcon*',`Glib::RefPtr<Icon>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<Icon>&',`GIcon*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
_CONVERSION(`Glib::RefPtr<Icon>',`GIcon*',__CONVERT_REFPTR_TO_P)
|
||||
_CONVERSION(`Glib::RefPtr<const Icon>',`GIcon*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
|
||||
# Emblem
|
||||
_CONVERSION(`const Glib::RefPtr<Emblem>&',`GEmblem*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
|
||||
# IOStream
|
||||
_CONVERSION(`GIOStream*',`Glib::RefPtr<Gio::IOStream>',`Glib::wrap($3)')
|
||||
_CONVERSION(`GIOStream*',`Glib::RefPtr<IOStream>',`Glib::wrap($3)')
|
||||
_CONVERSION(`GIOStream*',`Glib::RefPtr<const Gio::IOStream>',`Glib::wrap($3)')
|
||||
_CONVERSION(`GIOStream*',`Glib::RefPtr<const IOStream>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<IOStream>&',`GIOStream*',`Glib::unwrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<const IOStream>&',`GIOStream*',`const_cast<GIOStream*>(Glib::unwrap($3))')
|
||||
|
||||
# InetAddress
|
||||
_CONVERSION(`const Glib::RefPtr<InetAddress>&',`GInetAddress*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
_CONVERSION(`const Glib::RefPtr<const InetAddress>&',`GInetAddress*',`const_cast<GInetAddress*>(Glib::unwrap($3))')
|
||||
_CONVERSION(`GInetAddress*',`Glib::RefPtr<InetAddress>',`Glib::wrap($3)')
|
||||
|
||||
# InputStream
|
||||
_CONVERSION(`const Glib::RefPtr<InputStream>&',`GInputStream*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
_CONVERSION(`const Glib::RefPtr<Gio::InputStream>&',`GInputStream*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
_CONVERSION(`GInputStream*',`Glib::RefPtr<InputStream>',`Glib::wrap($3)')
|
||||
|
||||
# MenuAttributeIter
|
||||
_CONVERSION(`GMenuAttributeIter*',`Glib::RefPtr<MenuAttributeIter>',`Glib::wrap($3)')
|
||||
|
||||
# MenuLinkIter
|
||||
_CONVERSION(`GMenuLinkIter*',`Glib::RefPtr<MenuLinkIter>',`Glib::wrap($3)')
|
||||
|
||||
# MenuModel
|
||||
_CONVERSION(`GMenuModel*',`Glib::RefPtr<MenuModel>',`Glib::wrap($3)')
|
||||
_CONVERSION(`GMenuModel*',`Glib::RefPtr<const MenuModel>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<MenuModel>&',`GMenuModel*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
|
||||
# MenuItem
|
||||
_CONVERSION(`GMenuItem*',`Glib::RefPtr<MenuItem>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<MenuItem>&',`GMenuItem*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
|
||||
# Mount
|
||||
_CONVERSION(`GMount*',`Glib::RefPtr<Mount>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<Mount>&',`GMount*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
|
||||
# MountOptions
|
||||
_CONVERSION(`GPasswordSave',`PasswordSave',`($2)$3')
|
||||
_CONVERSION(`PasswordSave',`GPasswordSave',`($2)$3')
|
||||
|
||||
#MountOperation
|
||||
#_CONVERSION(`GAskPasswordFlags',`AskPasswordFlags',`($2)$3')
|
||||
|
||||
# NetworkMonitor
|
||||
_CONVERSION(`GNetworkMonitor*',`Glib::RefPtr<NetworkMonitor>',`Glib::wrap($3)')
|
||||
|
||||
|
||||
# Notification
|
||||
_CONVERSION(`GNotification*',`Glib::RefPtr<Notification>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<Notification>&',`GNotification*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
|
||||
# OutputStream
|
||||
_CONVERSION(`GOutputStream*',`Glib::RefPtr<OutputStream>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<OutputStream>&',`GOutputStream*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
|
||||
_CONVERSION(`const Glib::RefPtr<ProxyResolver>&',`GProxyResolver*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
_CONVERSION(`GProxyResolver*',`Glib::RefPtr<ProxyResolver>',`Glib::wrap($3)')
|
||||
_CONVERSION(`GProxy*',`Glib::RefPtr<Proxy>',`Glib::wrap($3)')
|
||||
|
||||
_CONVERSION(`const Glib::RefPtr<const ProxyAddress>&',`GProxyAddress*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
|
||||
#Resource
|
||||
_CONVERSION(`GResource*',`Glib::RefPtr<Resource>',`Glib::wrap($3)')
|
||||
|
||||
#Settings
|
||||
_CONVERSION(`GSettings*',`Glib::RefPtr<Settings>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::StringArrayHandle&',`const gchar*-const*',`($3).data()')
|
||||
_CONVERSION(`const Glib::RefPtr<SettingsBackend>&',`GSettingsBackend*',__CONVERT_REFPTR_TO_P)
|
||||
|
||||
_CONVERSION(`GSettingsSchemaKey*',`Glib::RefPtr<SettingsSchemaKey>',`Glib::wrap($3)')
|
||||
_CONVERSION(`GSettingsSchemaKey*',`Glib::RefPtr<const SettingsSchemaKey>',`Glib::wrap($3)')
|
||||
|
||||
_CONVERSION(`GSettingsSchema*',`Glib::RefPtr<SettingsSchema>',`Glib::wrap($3)')
|
||||
_CONVERSION(`GSettingsSchema*',`Glib::RefPtr<const SettingsSchema>',`Glib::wrap($3)')
|
||||
|
||||
_CONVERSION(`GSettingsSchemaSource*',`Glib::RefPtr<SettingsSchemaSource>',`Glib::wrap($3)')
|
||||
|
||||
|
||||
#Socket
|
||||
_CONVERSION(`const Glib::RefPtr<Socket>&',`GSocket*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
_CONVERSION(`GSocket*',`Glib::RefPtr<Socket>',`Glib::wrap($3)')
|
||||
|
||||
#SocketAddress
|
||||
_CONVERSION(`GSocketAddress*',`Glib::RefPtr<SocketAddress>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<SocketAddress>&',`GSocketAddress*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
_CONVERSION(`Glib::RefPtr<SocketAddress>&',`GSocketAddress*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
_CONVERSION(`GSocketAddressEnumerator*',`Glib::RefPtr<SocketAddressEnumerator>',`Glib::wrap($3)')
|
||||
|
||||
#SocketConnectable
|
||||
_CONVERSION(`const Glib::RefPtr<SocketConnectable>&',`GSocketConnectable*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
_CONVERSION(`const Glib::RefPtr<const SocketConnectable>&', `GSocketConnectable*', `const_cast<GSocketConnectable*>(Glib::unwrap($3))')
|
||||
_CONVERSION(`GSocketConnectable*',`Glib::RefPtr<SocketConnectable>',`Glib::wrap($3)')
|
||||
|
||||
#SocketConnection
|
||||
_CONVERSION(`GSocketConnection*',`Glib::RefPtr<SocketConnection>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<SocketConnection>&',`GSocketConnection*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
|
||||
#SocketControlMessage
|
||||
_CONVERSION(`GSocketControlMessage*',`Glib::RefPtr<SocketControlMessage>',`Glib::wrap($3)')
|
||||
|
||||
#TimeZoneMonitor
|
||||
_CONVERSION(`GTimeZoneMonitor*',`Glib::RefPtr<TimeZoneMonitor>',`Glib::wrap($3)')
|
||||
|
||||
#TlsCertificate
|
||||
_CONVERSION(`GTlsCertificate*', `Glib::RefPtr<TlsCertificate>', `Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<const TlsCertificate>&', `GTlsCertificate*', `const_cast<GTlsCertificate*>(Glib::unwrap($3))')
|
||||
_CONVERSION(`const Glib::RefPtr<TlsCertificate>&',`GTlsCertificate*',`Glib::unwrap($3)')
|
||||
|
||||
#TlsConnection:
|
||||
_CONVERSION(`const Glib::RefPtr<TlsConnection>&',`GTlsConnection*',`Glib::unwrap($3)')
|
||||
|
||||
#TlsClientConnection:
|
||||
_CONVERSION(`const Glib::RefPtr<TlsClientConnection>&',`GTlsClientConnection*',__CONVERT_REFPTR_TO_P)
|
||||
|
||||
#TlsDatabase
|
||||
_CONVERSION(`GTlsDatabase*',`Glib::RefPtr<TlsDatabase>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<TlsDatabase>&',`GTlsDatabase*',__CONVERT_REFPTR_TO_P)
|
||||
|
||||
#TlsInteraction
|
||||
_CONVERSION(`const Glib::RefPtr<TlsInteraction>&',`GTlsInteraction*',`Glib::unwrap($3)')
|
||||
_CONVERSION(`GTlsInteraction*',`Glib::RefPtr<TlsInteraction>',`Glib::wrap($3)')
|
||||
|
||||
#TlsPassword
|
||||
_CONVERSION(`const Glib::RefPtr<TlsPassword>&',`GTlsPassword*',__CONVERT_REFPTR_TO_P)
|
||||
|
||||
#UnixFDList
|
||||
_CONVERSION(`GUnixFDList*',`Glib::RefPtr<UnixFDList>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<UnixFDList>&',`GUnixFDList*',__CONVERT_REFPTR_TO_P)
|
||||
|
||||
#Volume
|
||||
_CONVERSION(`GVolume*',`Glib::RefPtr<Volume>',`Glib::wrap($3)')
|
||||
|
||||
# VolumeMonitor
|
||||
_CONVERSION(`GVolumeMonitor*',`Glib::RefPtr<VolumeMonitor>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<Drive>&',`GDrive*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
_CONVERSION(`const Glib::RefPtr<Mount>&',`GMount*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
_CONVERSION(`const Glib::RefPtr<Volume>&',`GVolume*',__CONVERT_CONST_REFPTR_TO_P)
|
||||
|
||||
#Vfs
|
||||
_CONVERSION(`GVfs*', `Glib::RefPtr<Vfs>', `Glib::wrap($3)')
|
||||
180
squashfs-root/usr/lib/glibmm-2.4/proc/m4/convert_glib.m4
Normal file
180
squashfs-root/usr/lib/glibmm-2.4/proc/m4/convert_glib.m4
Normal file
@@ -0,0 +1,180 @@
|
||||
dnl
|
||||
dnl Glib C names have prefix 'G' but C++ namespace Glib
|
||||
dnl
|
||||
define(`_CONV_GLIB_ENUM',`dnl
|
||||
_CONVERSION(`G$1', `$1', (($1)(__ARG3__)))
|
||||
_CONVERSION(`G$1', `Glib::$1', ((Glib::$1)(__ARG3__)))
|
||||
_CONVERSION(`$1', `G$1', ((G$1)(__ARG3__)))
|
||||
_CONVERSION(`Glib::$1', `G$1', ((G$1)(__ARG3__)))
|
||||
')dnl
|
||||
|
||||
_EQUAL(gchar,char)
|
||||
_EQUAL(gchar*,char*)
|
||||
_EQUAL(gchar**,char**)
|
||||
_EQUAL(gint**,int**)
|
||||
_EQUAL(gchar**,char*[])
|
||||
_EQUAL(const gchar*,const char*)
|
||||
_EQUAL(const-gchar*,const char*)
|
||||
_EQUAL(gpointer*,void**)
|
||||
|
||||
_EQUAL(gboolean,int)
|
||||
_EQUAL(gint,int)
|
||||
_EQUAL(gint*,int*)
|
||||
_EQUAL(gint&,int&)
|
||||
_EQUAL(guint,unsigned int)
|
||||
_EQUAL(guint*,unsigned int*)
|
||||
_EQUAL(guint&,unsigned int&)
|
||||
_EQUAL(gdouble,double)
|
||||
_EQUAL(gdouble*,double*)
|
||||
_EQUAL(gfloat, float)
|
||||
_EQUAL(float*,gfloat[])
|
||||
|
||||
_EQUAL(const-char*,const-gchar*)
|
||||
_EQUAL(return-char*,return-gchar*)
|
||||
_EQUAL(gpointer,void*)
|
||||
_EQUAL(gconstpointer,const void*)
|
||||
|
||||
_EQUAL(GdkAtom,Gdk::Atom)
|
||||
_EQUAL(GTimeSpan,TimeSpan)
|
||||
|
||||
# Basic Types
|
||||
_CONVERSION(`int',`bool',`$3')
|
||||
_CONVERSION(`bool',`int',`static_cast<int>($3)')
|
||||
_CONVERSION(`unsigned int',`bool',`$3')
|
||||
_CONVERSION(`bool',`unsigned int',`static_cast<unsigned int>($3)')
|
||||
_CONVERSION(`bool&',`gboolean*',`(($2) &($3))')
|
||||
_CONVERSION(`int&',`gint*',`&($3)')
|
||||
_CONVERSION(`gint*',`int&',`*($3)')
|
||||
_CONVERSION(`guint&',`guint*',`&($3)')
|
||||
_CONVERSION(`guint64&',`guint64*',`&($3)')
|
||||
_CONVERSION(`double&',`gdouble*',`&($3)')
|
||||
_CONVERSION(`float&',`gfloat*',`&($3)')
|
||||
_CONVERSION(`gchar**',`char**',`$3')
|
||||
_CONVERSION(`char**',`gchar**',`$3')
|
||||
_CONVERSION(`gpointer&',`gpointer*',`&($3)')
|
||||
_CONVERSION(`void*&',`gpointer*',`&($3)')
|
||||
|
||||
_CONVERSION(`GError*&',`GError**',`&($3)')
|
||||
|
||||
dnl
|
||||
dnl # These are for fixmegtkconst
|
||||
_CONVERSION(`const guchar*',`guchar*',`const_cast<guchar*>($3)',`$3')
|
||||
|
||||
_CONV_GLIB_ENUM(BindingFlags)
|
||||
_CONV_GLIB_ENUM(IOCondition)
|
||||
_CONV_GLIB_ENUM(IOFlags)
|
||||
_CONV_GLIB_ENUM(IOStatus)
|
||||
_CONV_GLIB_ENUM(KeyFileFlags)
|
||||
_CONV_GLIB_ENUM(OptionArg)
|
||||
_CONV_GLIB_ENUM(RegexCompileFlags)
|
||||
_CONV_GLIB_ENUM(RegexMatchFlags)
|
||||
_CONV_GLIB_ENUM(SeekType)
|
||||
_CONV_GLIB_ENUM(TimeType)
|
||||
|
||||
|
||||
_CONVERSION(`gunichar&',`gunichar*',`&($3)')
|
||||
_CONVERSION(`gsize&',`gsize*',`&($3)')
|
||||
|
||||
|
||||
# Strings:
|
||||
define(`__GCHARP_TO_USTRING',`Glib::convert_const_gchar_ptr_to_ustring($`'3)')
|
||||
define(`__GCHARP_TO_STDSTRING',`Glib::convert_const_gchar_ptr_to_stdstring($`'3)')
|
||||
|
||||
_CONVERSION(`const Glib::ustring&',`const char*',`$3.c_str()')
|
||||
_CONVERSION(`const Glib::ustring&', `const guchar*', `(($2)$3.c_str())')
|
||||
_CONVERSION(`const std::string&',`const char*',`$3.c_str()')
|
||||
_CONVERSION(`std::string',`const char*',`$3.c_str()')
|
||||
_CONVERSION(`const Glib::ustring&',`gchar*',`const_cast<gchar*>($3.c_str())')
|
||||
_CONVERSION(`gchar*',`Glib::ustring',__GCHARP_TO_USTRING)
|
||||
_CONVERSION(`const-gchar*',`Glib::ustring',__GCHARP_TO_USTRING)
|
||||
_CONVERSION(`const-guchar*',`Glib::ustring',__GCHARP_TO_USTRING)
|
||||
_CONVERSION(`const gchar*',`Glib::ustring',__GCHARP_TO_USTRING)
|
||||
_CONVERSION(`const char*',`Glib::ustring',__GCHARP_TO_USTRING)
|
||||
_CONVERSION(`const char*',`const Glib::ustring&',__GCHARP_TO_USTRING)
|
||||
_CONVERSION(`const char*',`std::string',__GCHARP_TO_STDSTRING)
|
||||
_CONVERSION(`const char*',`const-gchar*',`$3')
|
||||
_CONVERSION(`const-gchar*',`const char*',`$3')
|
||||
_CONVERSION(`const char*',`const std::string&',__GCHARP_TO_STDSTRING)
|
||||
_CONVERSION(`char*',`std::string',__GCHARP_TO_STDSTRING)
|
||||
_CONVERSION(`std::string', `char*', `g_strdup(($3).c_str())')
|
||||
_CONVERSION(`const std::string&', `char*', `g_strdup(($3).c_str())')
|
||||
_CONVERSION(`Glib::ustring', `char*', `g_strdup(($3).c_str())')
|
||||
|
||||
_CONVERSION(`return-gchar*',`Glib::ustring',`Glib::convert_return_gchar_ptr_to_ustring($3)')
|
||||
_CONVERSION(`return-gchar*',`std::string',`Glib::convert_return_gchar_ptr_to_stdstring($3)')
|
||||
_CONVERSION(`return-char*',`Glib::ustring',`Glib::convert_return_gchar_ptr_to_ustring($3)')
|
||||
|
||||
dnl DateTime
|
||||
_CONVERSION(`GDateTime*',`DateTime',`Glib::wrap($3)')
|
||||
_CONVERSION(`GDateTime*',`Glib::DateTime',`Glib::wrap($3)')
|
||||
_CONVERSION(`const DateTime&',`GDateTime*',`const_cast<$2>($3.gobj())')
|
||||
|
||||
dnl KeyFile
|
||||
_CONVERSION(`Glib::KeyFile&',`GKeyFile*',`($3).gobj()')
|
||||
|
||||
dnl Object
|
||||
_CONVERSION(`const Glib::RefPtr<Glib::Object>&',`GObject*',__CONVERT_REFPTR_TO_P)
|
||||
_CONVERSION(`const Glib::RefPtr<const Glib::Object>&',`GObject*',__CONVERT_CONST_REFPTR_TO_P_SUN(Glib::Object))
|
||||
_CONVERSION(`GObject*',`Glib::RefPtr<Glib::Object>',`Glib::wrap($3)')
|
||||
_CONVERSION(`GObject*',`Glib::RefPtr<const Glib::Object>',`Glib::wrap($3)')
|
||||
|
||||
_CONVERSION(`GObject*',`Glib::RefPtr<Glib::ObjectBase>',`Glib::wrap($3)')
|
||||
_CONVERSION(`GObject*',`Glib::RefPtr<const Glib::ObjectBase>',`Glib::wrap($3)')
|
||||
|
||||
dnl OptionGroup
|
||||
_CONVERSION(`OptionGroup&',`GOptionGroup*',`($3).gobj()')
|
||||
_CONVERSION(`Glib::OptionGroup&',`GOptionGroup*',`($3).gobj()')
|
||||
|
||||
dnl Bytes
|
||||
_CONVERSION(`GBytes*',`Glib::RefPtr<Glib::Bytes>',`Glib::wrap($3)')
|
||||
_CONVERSION(`GBytes*',`Glib::RefPtr<const Glib::Bytes>',`Glib::wrap($3)')
|
||||
_CONVERSION(`const Glib::RefPtr<const Glib::Bytes>&',`GBytes*',__CONVERT_CONST_REFPTR_TO_P_SUN(Glib::Bytes)))
|
||||
|
||||
dnl ByteArray
|
||||
_CONVERSION(`GByteArray*',`Glib::RefPtr<ByteArray>',`Glib::wrap($3)')
|
||||
|
||||
dnl Regex
|
||||
_CONVERSION(`GRegex*',`Glib::RefPtr<Regex>',`Glib::wrap($3)')
|
||||
_CONVERSION(`GRegex*',`Glib::RefPtr<const Regex>',`Glib::wrap($3)')
|
||||
|
||||
#Source
|
||||
_CONVERSION(`GSource*',`Glib::RefPtr<Glib::Source>',`Glib::wrap($3)')
|
||||
|
||||
dnl TimeVal
|
||||
_CONVERSION(`const TimeVal&',`const GTimeVal*',`&($3)')
|
||||
_CONVERSION(`TimeVal&',`GTimeVal*',`&($3)')
|
||||
|
||||
dnl TimeZone
|
||||
_CONVERSION(`GTimeZone*',`TimeZone',`Glib::wrap($3)')
|
||||
_CONVERSION(`const TimeZone&',`GTimeZone*',`const_cast<$2>($3.gobj())')
|
||||
|
||||
dnl ValueBase
|
||||
_CONVERSION(`Glib::ValueBase&',`GValue*',`($3).gobj()')
|
||||
_CONVERSION(`const Glib::ValueBase&',`const GValue*',`($3).gobj()')
|
||||
_CONVERSION(`const Glib::ValueBase&',`GValue*',`const_cast<GValue*>(($3).gobj())')
|
||||
_CONVERSION(`GValue*', `Glib::ValueBase&', `*reinterpret_cast<Glib::ValueBase*>($3)')
|
||||
_CONVERSION(`const GValue*', `const Glib::ValueBase&', `*reinterpret_cast<const Glib::ValueBase*>($3)')
|
||||
|
||||
#Variant
|
||||
_CONVERSION(`GVariant*',`Glib::VariantBase',`Glib::wrap($3, false)')
|
||||
_CONVERSION(`GVariant*',`Glib::VariantContainerBase',`Glib::VariantContainerBase($3, false)')
|
||||
_CONVERSION(`const VariantBase&',`GVariant*',`const_cast<GVariant*>(($3).gobj())')
|
||||
_CONVERSION(`const Glib::VariantBase&',`GVariant*',`const_cast<GVariant*>(($3).gobj())')
|
||||
_CONVERSION(`const Glib::VariantContainerBase&',`GVariant*',`const_cast<GVariant*>(($3).gobj())')
|
||||
|
||||
# VariantContainerBase
|
||||
_CONVERSION(`const VariantContainerBase&',`GVariant*',`const_cast<GVariant*>(($3).gobj())')
|
||||
|
||||
#VariantDict
|
||||
_CONVERSION(`GVariantDict*',`Glib::RefPtr<VariantDict>',`Glib::wrap($3)')
|
||||
_CONVERSION(`GVariantDict*',`Glib::RefPtr<Glib::VariantDict>',`Glib::wrap($3)')
|
||||
_CONVERSION(`GVariantDict*',`Glib::RefPtr<const Glib::VariantDict>',`Glib::wrap($3)')
|
||||
|
||||
#VariantType
|
||||
_CONVERSION(`const GVariantType*',`Glib::VariantType',`Glib::wrap(const_cast<GVariantType*>($3), true)')
|
||||
_CONVERSION(`const VariantType&',`const GVariantType*',`($3).gobj()')
|
||||
_CONVERSION(`const Glib::VariantType&',`const GVariantType*',`($3).gobj()')
|
||||
_CONVERSION(`GVariantType*',`VariantType',`Glib::wrap($3)')
|
||||
|
||||
dnl Miscellaneous
|
||||
_CONVERSION(`gint64&',`gint64*',`&($3)')
|
||||
@@ -0,0 +1,6 @@
|
||||
dnl $Id$
|
||||
|
||||
include(convert_base.m4)
|
||||
include(convert_glib.m4)
|
||||
include(convert_gio.m4)
|
||||
|
||||
71
squashfs-root/usr/lib/glibmm-2.4/proc/m4/ctor.m4
Normal file
71
squashfs-root/usr/lib/glibmm-2.4/proc/m4/ctor.m4
Normal file
@@ -0,0 +1,71 @@
|
||||
dnl $Id$
|
||||
dnl
|
||||
dnl M4 macros for constructor generation.
|
||||
dnl
|
||||
|
||||
dnl Code to sink a GInitiallyUnowned:
|
||||
dnl
|
||||
m4_define(`_INITIALLY_UNOWNED_SINK',`dnl
|
||||
ifdef(`__BOOL_DERIVES_INITIALLY_UNOWNED__',`dnl
|
||||
if(gobject_ && g_object_is_floating (gobject_))
|
||||
g_object_ref_sink(gobject_); //Stops it from being floating.
|
||||
',`')')
|
||||
|
||||
dnl Declares and implements the default constructor
|
||||
dnl
|
||||
m4_define(`_CTOR_DEFAULT',`dnl
|
||||
__CPPNAME__`'();
|
||||
_PUSH(SECTION_CC)
|
||||
__CPPNAME__::__CPPNAME__`'()
|
||||
:
|
||||
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
|
||||
Glib::ObjectBase(nullptr),
|
||||
__CPPPARENT__`'(Glib::ConstructParams(__BASE__`'_class_.init()))
|
||||
{
|
||||
_IMPORT(SECTION_CC_INITIALIZE_CLASS_EXTRA)
|
||||
|
||||
_INITIALLY_UNOWNED_SINK
|
||||
}
|
||||
|
||||
_POP()')
|
||||
|
||||
dnl Constructors with property initializations.
|
||||
dnl
|
||||
dnl _CTOR_IMPL(cppname, cname, cppargs, c_varargs)
|
||||
dnl $1 $2 $3 $4
|
||||
dnl
|
||||
m4_define(`_CTOR_IMPL',`dnl
|
||||
_PUSH(SECTION_CC)
|
||||
__CPPNAME__::$1`'($3)
|
||||
:
|
||||
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
|
||||
Glib::ObjectBase(nullptr),
|
||||
__CPPPARENT__`'(Glib::ConstructParams(__BASE__`'_class_.init()m4_ifelse(`$4',,,`, $4, nullptr')))
|
||||
{
|
||||
_IMPORT(SECTION_CC_INITIALIZE_CLASS_EXTRA)
|
||||
|
||||
_INITIALLY_UNOWNED_SINK
|
||||
}
|
||||
|
||||
_POP()')
|
||||
|
||||
m4_define(`_CONSTRUCT',
|
||||
`// Mark this class as non-derived to allow C++ vfuncs to be skipped.
|
||||
Glib::ObjectBase(nullptr),
|
||||
__CPPPARENT__`'(Glib::ConstructParams(__BASE__`'_class_.init()m4_ifelse(`$1',,,`, $@, nullptr')))')
|
||||
|
||||
dnl _CONSTRUCT() does not deal with multiple class definitions in one file.
|
||||
dnl If necessary, _CONSTRUCT_SPECIFIC(BaseClass, Class) must be used instead.
|
||||
dnl
|
||||
m4_define(`_CONSTRUCT_SPECIFIC',
|
||||
`// Mark this class as non-derived to allow C++ vfuncs to be skipped.
|
||||
Glib::ObjectBase(nullptr),
|
||||
$1`'(Glib::ConstructParams(_LOWER(`$2')_class_.init()m4_ifelse(`$3',,,`, m4_shift(m4_shift($@)), nullptr')))')
|
||||
|
||||
dnl Extra code for initialize_class.
|
||||
dnl Not commonly used.
|
||||
dnl
|
||||
m4_define(`_INITIALIZE_CLASS_EXTRA',`dnl
|
||||
_PUSH(SECTION_CC_INITIALIZE_CLASS_EXTRA)
|
||||
$1
|
||||
_POP()')
|
||||
3
squashfs-root/usr/lib/glibmm-2.4/proc/m4/doc.m4
Normal file
3
squashfs-root/usr/lib/glibmm-2.4/proc/m4/doc.m4
Normal file
@@ -0,0 +1,3 @@
|
||||
dnl $Id$
|
||||
|
||||
divert(-1)
|
||||
105
squashfs-root/usr/lib/glibmm-2.4/proc/m4/enum.m4
Normal file
105
squashfs-root/usr/lib/glibmm-2.4/proc/m4/enum.m4
Normal file
@@ -0,0 +1,105 @@
|
||||
dnl
|
||||
dnl _ENUM(cpp_type, c_type, value_suffix, `element_list', `no_gtype', `optional_refdoc_comment', 'deprecated')
|
||||
dnl $1 $2 $3 $4 $5 $6 $7
|
||||
dnl
|
||||
m4_define(`_ENUM',`dnl
|
||||
_PUSH()
|
||||
|
||||
m4_define(`__ENUM_CPPNAME__',`$1')
|
||||
m4_define(`__ENUM_CNAME__',`$2')
|
||||
m4_define(`__ENUM_VALUE_BASE__',`Glib::Value_$3<__NAMESPACE__::__ENUM_CPPNAME__>')
|
||||
|
||||
_POP()
|
||||
dnl
|
||||
dnl // Define a new Doxygen group if this is the first enum in the file.
|
||||
dnl
|
||||
m4_ifdef(`__DOCGROUP_'__MODULE_CANONICAL__`_ENUMS__',,`dnl else
|
||||
m4_define(`__DOCGROUP_'__MODULE_CANONICAL__`_ENUMS__')dnl
|
||||
/** @addtogroup '__MODULE_CANONICAL__`Enums __MODULE_CANONICAL__ Enums and Flags */
|
||||
|
||||
')dnl endif
|
||||
dnl
|
||||
dnl
|
||||
ifelse(`$7',,,`_DEPRECATE_IFDEF_START')`'dnl The expansion of _DEPRECATE_IFDEF_START ends with a newline
|
||||
/** $6
|
||||
*
|
||||
* @ingroup __MODULE_CANONICAL__`'Enums
|
||||
m4_ifelse($3,Flags,`dnl
|
||||
* @par Bitwise operators:
|
||||
* <tt>%__ENUM_CPPNAME__ operator|(__ENUM_CPPNAME__, __ENUM_CPPNAME__)</tt><br>
|
||||
* <tt>%__ENUM_CPPNAME__ operator&(__ENUM_CPPNAME__, __ENUM_CPPNAME__)</tt><br>
|
||||
* <tt>%__ENUM_CPPNAME__ operator^(__ENUM_CPPNAME__, __ENUM_CPPNAME__)</tt><br>
|
||||
* <tt>%__ENUM_CPPNAME__ operator~(__ENUM_CPPNAME__)</tt><br>
|
||||
* <tt>%__ENUM_CPPNAME__& operator|=(__ENUM_CPPNAME__&, __ENUM_CPPNAME__)</tt><br>
|
||||
* <tt>%__ENUM_CPPNAME__& operator&=(__ENUM_CPPNAME__&, __ENUM_CPPNAME__)</tt><br>
|
||||
* <tt>%__ENUM_CPPNAME__& operator^=(__ENUM_CPPNAME__&, __ENUM_CPPNAME__)</tt><br>
|
||||
')dnl endif
|
||||
*/
|
||||
enum __ENUM_CPPNAME__
|
||||
{
|
||||
$4
|
||||
};
|
||||
m4_ifelse($3,Flags,`dnl
|
||||
|
||||
/** @ingroup __MODULE_CANONICAL__`'Enums */
|
||||
inline __ENUM_CPPNAME__ operator|(__ENUM_CPPNAME__ lhs, __ENUM_CPPNAME__ rhs)
|
||||
{ return static_cast<__ENUM_CPPNAME__>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
|
||||
|
||||
/** @ingroup __MODULE_CANONICAL__`'Enums */
|
||||
inline __ENUM_CPPNAME__ operator&(__ENUM_CPPNAME__ lhs, __ENUM_CPPNAME__ rhs)
|
||||
{ return static_cast<__ENUM_CPPNAME__>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
|
||||
|
||||
/** @ingroup __MODULE_CANONICAL__`'Enums */
|
||||
inline __ENUM_CPPNAME__ operator^(__ENUM_CPPNAME__ lhs, __ENUM_CPPNAME__ rhs)
|
||||
{ return static_cast<__ENUM_CPPNAME__>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
|
||||
|
||||
/** @ingroup __MODULE_CANONICAL__`'Enums */
|
||||
inline __ENUM_CPPNAME__ operator~(__ENUM_CPPNAME__ flags)
|
||||
{ return static_cast<__ENUM_CPPNAME__>(~static_cast<unsigned>(flags)); }
|
||||
|
||||
/** @ingroup __MODULE_CANONICAL__`'Enums */
|
||||
inline __ENUM_CPPNAME__& operator|=(__ENUM_CPPNAME__& lhs, __ENUM_CPPNAME__ rhs)
|
||||
{ return (lhs = static_cast<__ENUM_CPPNAME__>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
|
||||
|
||||
/** @ingroup __MODULE_CANONICAL__`'Enums */
|
||||
inline __ENUM_CPPNAME__& operator&=(__ENUM_CPPNAME__& lhs, __ENUM_CPPNAME__ rhs)
|
||||
{ return (lhs = static_cast<__ENUM_CPPNAME__>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
|
||||
|
||||
/** @ingroup __MODULE_CANONICAL__`'Enums */
|
||||
inline __ENUM_CPPNAME__& operator^=(__ENUM_CPPNAME__& lhs, __ENUM_CPPNAME__ rhs)
|
||||
{ return (lhs = static_cast<__ENUM_CPPNAME__>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
|
||||
')dnl endif Flags
|
||||
ifelse(`$7',,,`_DEPRECATE_IFDEF_END')`'dnl The expansion of _DEPRECATE_IFDEF_END ends with a newline
|
||||
|
||||
m4_ifelse($5,`NO_GTYPE',,`dnl else
|
||||
__NAMESPACE_END__
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
namespace Glib
|
||||
{
|
||||
|
||||
ifelse(`$7',,,`_DEPRECATE_IFDEF_START')`'dnl
|
||||
template <>
|
||||
class Value<__NAMESPACE__::__ENUM_CPPNAME__> : public __ENUM_VALUE_BASE__
|
||||
{
|
||||
public:
|
||||
static GType value_type() G_GNUC_CONST;
|
||||
};
|
||||
ifelse(`$7',,,`_DEPRECATE_IFDEF_END')`'dnl
|
||||
|
||||
} // namespace Glib
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
__NAMESPACE_BEGIN__
|
||||
_PUSH(SECTION_SRC_GENERATED)
|
||||
ifelse(`$7',,,`_DEPRECATE_IFDEF_START')`'dnl
|
||||
// static
|
||||
GType Glib::Value<__NAMESPACE__::__ENUM_CPPNAME__>::value_type()
|
||||
{
|
||||
return _GET_TYPE_FUNC(__ENUM_CNAME__);
|
||||
}
|
||||
ifelse(`$7',,,`_DEPRECATE_IFDEF_END')`'dnl
|
||||
|
||||
_POP()
|
||||
')dnl endif !NO_GTYPE
|
||||
')dnl enddef _ENUM
|
||||
100
squashfs-root/usr/lib/glibmm-2.4/proc/m4/gerror.m4
Normal file
100
squashfs-root/usr/lib/glibmm-2.4/proc/m4/gerror.m4
Normal file
@@ -0,0 +1,100 @@
|
||||
dnl
|
||||
dnl _GERROR(cpp_type, c_type, domain, `element_list', `no_gtype', `class_docs', `enum_docs', 'deprecated')
|
||||
dnl $1 $2 $3 $4 $5 $6 $7 $8
|
||||
dnl
|
||||
|
||||
m4_define(`_GERROR',`dnl
|
||||
_PUSH()
|
||||
dnl
|
||||
dnl Define the args for later macros
|
||||
m4_define(`__CPPNAME__',`$1')
|
||||
m4_define(`__CNAME__',`$2')
|
||||
m4_define(`__CQUARK__',`$3')
|
||||
m4_define(`__VALUE_BASE__',`Glib::Value_Enum<__NAMESPACE__::__CPPNAME__::Code>')
|
||||
_POP()
|
||||
ifelse(`$8',,,`_DEPRECATE_IFDEF_START')`'dnl The expansion of _DEPRECATE_IFDEF_START ends with a newline
|
||||
ifelse(`$6',,,`dnl
|
||||
/** $6
|
||||
*/
|
||||
')dnl
|
||||
class __CPPNAME__ : public Glib::Error
|
||||
{
|
||||
public:
|
||||
/** $7
|
||||
*/
|
||||
enum Code
|
||||
{
|
||||
$4
|
||||
};
|
||||
|
||||
__CPPNAME__`'(Code error_code, const Glib::ustring& error_message);
|
||||
explicit __CPPNAME__`'(GError* gobject);
|
||||
Code code() const;
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
private:
|
||||
|
||||
static void throw_func(GError* gobject);
|
||||
|
||||
friend void wrap_init(); // uses throw_func()
|
||||
|
||||
_IMPORT(SECTION_H_GERROR_PRIVATE)
|
||||
#endif //DOXYGEN_SHOULD_SKIP_THIS
|
||||
};
|
||||
ifelse(`$8',,,`_DEPRECATE_IFDEF_END')`'dnl The expansion of _DEPRECATE_IFDEF_END ends with a newline
|
||||
|
||||
m4_ifelse($5,`NO_GTYPE',,`dnl else
|
||||
__NAMESPACE_END__
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
namespace Glib
|
||||
{
|
||||
|
||||
ifelse(`$8',,,`_DEPRECATE_IFDEF_START')`'dnl
|
||||
template <>
|
||||
class Value<__NAMESPACE__::__CPPNAME__::Code> : public __VALUE_BASE__
|
||||
{
|
||||
public:
|
||||
static GType value_type() G_GNUC_CONST;
|
||||
};
|
||||
ifelse(`$8',,,`_DEPRECATE_IFDEF_END')`'dnl
|
||||
|
||||
} // namespace Glib
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
__NAMESPACE_BEGIN__
|
||||
')dnl endif !NO_GTYPE
|
||||
_PUSH(SECTION_SRC_GENERATED)
|
||||
|
||||
ifelse(`$8',,,`_DEPRECATE_IFDEF_START')`'dnl
|
||||
__NAMESPACE__::__CPPNAME__::__CPPNAME__`'(__NAMESPACE__::__CPPNAME__::Code error_code, const Glib::ustring& error_message)
|
||||
:
|
||||
Glib::Error (__CQUARK__, error_code, error_message)
|
||||
{}
|
||||
|
||||
__NAMESPACE__::__CPPNAME__::__CPPNAME__`'(GError* gobject)
|
||||
:
|
||||
Glib::Error (gobject)
|
||||
{}
|
||||
|
||||
__NAMESPACE__::__CPPNAME__::Code __NAMESPACE__::__CPPNAME__::code() const
|
||||
{
|
||||
return static_cast<Code>(Glib::Error::code());
|
||||
}
|
||||
|
||||
void __NAMESPACE__::__CPPNAME__::throw_func(GError* gobject)
|
||||
{
|
||||
throw __NAMESPACE__::__CPPNAME__`'(gobject);
|
||||
}
|
||||
|
||||
m4_ifelse($5,`NO_GTYPE',,`dnl else
|
||||
// static
|
||||
GType Glib::Value<__NAMESPACE__::__CPPNAME__::Code>::value_type()
|
||||
{
|
||||
return _GET_TYPE_FUNC(__CNAME__);
|
||||
}
|
||||
|
||||
')dnl endif !NO_GTYPE
|
||||
ifelse(`$8',,,`_DEPRECATE_IFDEF_END')`'dnl
|
||||
_POP()
|
||||
')dnl enddef _GERROR
|
||||
4
squashfs-root/usr/lib/glibmm-2.4/proc/m4/initialize.m4
Normal file
4
squashfs-root/usr/lib/glibmm-2.4/proc/m4/initialize.m4
Normal file
@@ -0,0 +1,4 @@
|
||||
dnl Other libraries, such as libgnomeuimm, can provide their own initialize.m4
|
||||
dnl files, maybe choosing to include the same files as this one.
|
||||
|
||||
include(initialize_glibmm.m4)
|
||||
51
squashfs-root/usr/lib/glibmm-2.4/proc/m4/initialize_base.m4
Normal file
51
squashfs-root/usr/lib/glibmm-2.4/proc/m4/initialize_base.m4
Normal file
@@ -0,0 +1,51 @@
|
||||
dnl
|
||||
dnl Macros for keeping track of how to initialize a C++ from a C type.
|
||||
|
||||
#
|
||||
# Define a hashing for names
|
||||
#
|
||||
define(`__HASH',`__`'m4_translit(`$*',`ABCDEFGHIJKLMNOPQRSTUVWXYZ<>[]&*, ',`abcdefghijklmnopqrstuvwxyzVBNMRSC_')`'')
|
||||
define(`__EQUIV',`m4_ifdef(EV`'__HASH(`$1'),EV`'__HASH(`$1'),`$1')')
|
||||
|
||||
dnl __HASH2(firsttype, secondtype)
|
||||
dnl
|
||||
dnl Provides a textual combination of the two given types which can be used as
|
||||
dnl a hash to store and retrieve conversions and initializations. It first
|
||||
dnl sees if the two types have equivalent types that should be used in their
|
||||
dnl places (using the __EQUIV macro above). Since the types returned by
|
||||
dnl __EQUIV may contain commas (because of types such as std::map<>), quote the
|
||||
dnl call to the macro to avoid the types to be interpreted as more than one
|
||||
dnl argument to the pushdef() calls. Also quote the expansion of the __E1 and
|
||||
dnl __E2 macros in the m4_ifelse for the same reason.
|
||||
define(`__HASH2',`dnl
|
||||
pushdef(`__E1',`__EQUIV(`$1')')pushdef(`__E2',`__EQUIV(`$2')')dnl
|
||||
m4_ifelse(_QUOTE(__E1),_QUOTE(__E2),`__EQ',__HASH(__E1)`'__HASH(__E2))`'dnl
|
||||
popdef(`__E1')popdef(`__E2')`'')
|
||||
|
||||
define(`IN__EQ',`$3')
|
||||
|
||||
# _INITIALIZE(target_type, fromtype, output_param_name, c_return, wrap_line)
|
||||
#
|
||||
# Print an initialize statement from ctype to cpptype
|
||||
define(`_INITIALIZE',`dnl
|
||||
m4_ifelse(`$1',void,`$4',`dnl
|
||||
pushdef(`__INI',`IN`'__HASH2(`$1',`$2')')dnl
|
||||
m4_ifdef(__INI,`m4_indir(__INI,m4_substr(`$1',`0',m4_decr(m4_len(`$1'))),`$2',`$3', $4)',`
|
||||
m4_errprint(`No initialization for type $1 from type $2 defined (line: $5, output param: $3, c return: $4)
|
||||
')
|
||||
m4_m4exit(1)
|
||||
')`'dnl
|
||||
')`'dnl
|
||||
')
|
||||
|
||||
# _INITIALIZATION(fromtype, totype, initialization)
|
||||
#
|
||||
# Functions for populating initialization tables.
|
||||
#
|
||||
define(`_INITIALIZATION',`
|
||||
m4_ifelse(`$3',,,`define(IN`'__HASH2(`$1',`$2'),m4_patsubst(`$3',`; +',`;
|
||||
'))')
|
||||
')
|
||||
|
||||
|
||||
include(initialize_glib.m4)
|
||||
@@ -0,0 +1,6 @@
|
||||
dnl
|
||||
dnl Initializations for giomm C++ types from Gio C types.
|
||||
dnl
|
||||
|
||||
dnl UnixFDList
|
||||
_INITIALIZATION(`Glib::RefPtr<UnixFDList>&',`GUnixFDList*', `$3 = Glib::wrap($4)')
|
||||
16
squashfs-root/usr/lib/glibmm-2.4/proc/m4/initialize_glib.m4
Normal file
16
squashfs-root/usr/lib/glibmm-2.4/proc/m4/initialize_glib.m4
Normal file
@@ -0,0 +1,16 @@
|
||||
dnl
|
||||
dnl Initialization rules for glibmm C++ types from Glib C types.
|
||||
dnl
|
||||
|
||||
dnl Basic Types
|
||||
_INITIALIZATION(`bool&',`gboolean',`$3 = static_cast<bool>($4)')
|
||||
|
||||
|
||||
dnl VariantBase
|
||||
_INITIALIZATION(`Glib::VariantBase&',`GVariant*',`$3 = Glib::wrap($4)')
|
||||
|
||||
dnl VariantType
|
||||
_INITIALIZATION(`Glib::VariantType&',`const GVariantType*',`$3 = Glib::wrap(const_cast<GVariantType*>($4))')
|
||||
|
||||
dnl ustring
|
||||
_INITIALIZATION(`Glib::ustring&',`gchar*',`$3 = Glib::convert_return_gchar_ptr_to_ustring($4)')
|
||||
@@ -0,0 +1,6 @@
|
||||
dnl $Id$
|
||||
|
||||
include(initialize_base.m4)
|
||||
include(initialize_glib.m4)
|
||||
include(initialize_gio.m4)
|
||||
|
||||
132
squashfs-root/usr/lib/glibmm-2.4/proc/m4/member.m4
Normal file
132
squashfs-root/usr/lib/glibmm-2.4/proc/m4/member.m4
Normal file
@@ -0,0 +1,132 @@
|
||||
dnl
|
||||
dnl --------------------------- Accessors ----------------------------
|
||||
dnl
|
||||
|
||||
|
||||
dnl Get:
|
||||
|
||||
|
||||
dnl Creates accessors for simple types:
|
||||
dnl _MEMBER_GET(cpp_name, c_name, cpp_type, c_type, deprecated (optional))
|
||||
define(`_MEMBER_GET',`dnl
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ')dnl
|
||||
$3 get_$1() const;
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ')dnl
|
||||
_PUSH(SECTION_CC)
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ')dnl
|
||||
$3 __CPPNAME__::get_$1() const
|
||||
{
|
||||
return _CONVERT($4,$3,`gobj()->$2');
|
||||
}
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ')dnl
|
||||
|
||||
_POP()')
|
||||
|
||||
dnl Creates two accessors for pointer types, one const and one non-const:
|
||||
define(`_MEMBER_GET_PTR',`dnl
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ')dnl
|
||||
$3 get_$1();
|
||||
const $3 get_$1() const;
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ')dnl
|
||||
_PUSH(SECTION_CC)
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ')dnl
|
||||
$3 __CPPNAME__::get_$1()
|
||||
{
|
||||
return _CONVERT($4,$3,`gobj()->$2');
|
||||
}
|
||||
|
||||
const $3 __CPPNAME__::get_$1() const
|
||||
{
|
||||
return _CONVERT($4,const $3,`gobj()->$2');
|
||||
}
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ')dnl
|
||||
|
||||
_POP()')
|
||||
|
||||
dnl Creates accessors for GObject-derived types that must be ref()ed.
|
||||
define(`_MEMBER_GET_GOBJECT',`dnl
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ')dnl
|
||||
Glib::RefPtr<$3> get_$1();
|
||||
Glib::RefPtr<const $3> get_$1() const;
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ')dnl
|
||||
_PUSH(SECTION_CC)
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ')dnl
|
||||
Glib::RefPtr<$3> __CPPNAME__::get_$1()
|
||||
{
|
||||
Glib::RefPtr<$3> ref_ptr(_CONVERT($4,Glib::RefPtr<$3>,`gobj()->$2'));
|
||||
|
||||
dnl We could use the bool with Glib::wrap(), but we want to share the m4 type-conversion map.
|
||||
if(ref_ptr)
|
||||
ref_ptr->reference();
|
||||
|
||||
return ref_ptr;
|
||||
}
|
||||
|
||||
Glib::RefPtr<const $3> __CPPNAME__::get_$1() const
|
||||
{
|
||||
Glib::RefPtr<const $3> ref_ptr(_CONVERT($4,Glib::RefPtr<const $3>,`gobj()->$2'));
|
||||
|
||||
dnl We could use the bool with Glib::wrap(), but we want to share the m4 type-conversion map.
|
||||
if(ref_ptr)
|
||||
ref_ptr->reference();
|
||||
|
||||
return ref_ptr;
|
||||
}
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ')dnl
|
||||
|
||||
_POP()')
|
||||
|
||||
|
||||
dnl Set:
|
||||
|
||||
dnl Creates accessors for simple types:
|
||||
define(`_MEMBER_SET',`dnl
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ')dnl
|
||||
void set_$1(const $3`'& value);
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ')dnl
|
||||
_PUSH(SECTION_CC)
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ')dnl
|
||||
void __CPPNAME__::set_$1(const $3`'& value)
|
||||
{
|
||||
gobj()->$2 = _CONVERT($3,$4,`value');
|
||||
}
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ')dnl
|
||||
|
||||
_POP()')
|
||||
|
||||
dnl Creates accessors for pointer types:
|
||||
define(`_MEMBER_SET_PTR',`dnl
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ')dnl
|
||||
void set_$1($3 value);
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ')dnl
|
||||
_PUSH(SECTION_CC)
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ')dnl
|
||||
void __CPPNAME__::set_$1($3 value)
|
||||
{
|
||||
gobj()->$2 = _CONVERT($3,$4,`value');
|
||||
}
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ')dnl
|
||||
|
||||
_POP()')
|
||||
|
||||
dnl Creates accessors for GObject-derived types that must be ref()ed.
|
||||
define(`_MEMBER_SET_GOBJECT',`dnl
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ')dnl
|
||||
void set_$1(const Glib::RefPtr<$3>& value);
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ')dnl
|
||||
_PUSH(SECTION_CC)
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ')dnl
|
||||
void __CPPNAME__::set_$1(const Glib::RefPtr<$3>& value)
|
||||
{
|
||||
Glib::RefPtr<$3> valueOld(_CONVERT($4,Glib::RefPtr<$3>,`gobj()->$2')); //Take possession of the old one, unref-ing it in the destructor.
|
||||
|
||||
if(value)
|
||||
value->reference(); //Ref once for the recipient.
|
||||
|
||||
gobj()->$2 = _CONVERT(const Glib::RefPtr<$3>&,$4,`value');
|
||||
}
|
||||
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ')dnl
|
||||
|
||||
_POP()')
|
||||
|
||||
|
||||
197
squashfs-root/usr/lib/glibmm-2.4/proc/m4/method.m4
Normal file
197
squashfs-root/usr/lib/glibmm-2.4/proc/m4/method.m4
Normal file
@@ -0,0 +1,197 @@
|
||||
dnl
|
||||
dnl
|
||||
dnl Code generation sections for making a method.
|
||||
dnl
|
||||
dnl
|
||||
|
||||
dnl
|
||||
dnl method
|
||||
dnl $1 $2 $3 $4 $5 $6 $7 $8
|
||||
dnl _METHOD(cppname,cname,cpprettype,crettype,arglist,cdeclarations,cargs,cinitializations,
|
||||
dnl $9 $10 $11 $12 $13 $14 $15
|
||||
dnl const,refreturn,errthrow,deprecated,constversion,arglist_without_types,ifdef,
|
||||
dnl $16 $17 $18 $19 $20 $21
|
||||
dnl out_param,out_param_cpptype,slot_type,slot_name,no_slot_copy,wrap_line)
|
||||
define(`_METHOD',`dnl
|
||||
_PUSH(SECTION_CC)
|
||||
ifelse(`$15',,,`#ifdef $15'
|
||||
)dnl
|
||||
ifelse(`$12',,,`_DEPRECATE_IFDEF_START`'dnl The expansion of _DEPRECATE_IFDEF_START ends with a newline
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
')dnl
|
||||
$3 __CPPNAME__::$1`'($5)ifelse(`$9',1,` const')
|
||||
{
|
||||
ifelse(`$13',,dnl
|
||||
`ifelse(`$10'`$11',,dnl If it is not errthrow or refreturn
|
||||
dnl If a slot type has been specified insert a slot copy declaration.
|
||||
`ifelse(`$18',,,dnl
|
||||
dnl See if the slot should or should not be copied
|
||||
`ifelse(`$20',,dnl
|
||||
` // Create a copy of the slot.
|
||||
auto slot_copy = new $18($19); ',dnl
|
||||
dnl
|
||||
` // Use the original slot (not a copy).
|
||||
auto slot_copy = const_cast<$18*>(&$19);')
|
||||
|
||||
')`'dnl
|
||||
dnl Insert the declarations for C output parameters
|
||||
ifelse(`$6',,,`$6
|
||||
')`'dnl
|
||||
ifelse(`$16',,dnl If no C++ output parameter is specified
|
||||
`ifelse(`$3',void,dnl If the C function returns voids:
|
||||
` $2(ifelse(`$9',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$7',,,`, ')$7);
|
||||
dnl Insert the initializations for the C output parameters
|
||||
ifelse(`$8',,,`$8
|
||||
')dnl
|
||||
',dnl If the C function returns non-void:
|
||||
dnl Store the return if there are C output parameters.
|
||||
`ifelse(`$6',,` return ',` `$3' retvalue = ')_CONVERT($4,`$3',`$2`'(ifelse(`$9',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$7',,,`, ')$7)');
|
||||
dnl Insert the initializations for the C output parameters
|
||||
ifelse(`$8',,,`$8
|
||||
')dnl
|
||||
dnl return the value
|
||||
ifelse(`$6',,,` return retvalue;
|
||||
')dnl
|
||||
')'dnl End if it returns voids.
|
||||
dnl A C++ output parameter is specified:
|
||||
,` _INITIALIZE($17,$4,`$16',`$2`'(ifelse(`$9',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$7',,,`, ')$7)',$21);
|
||||
dnl
|
||||
dnl Insert the initializations for the C output parameters
|
||||
ifelse(`$8',,,`$8
|
||||
')dnl
|
||||
')',dnl End if a C++ output parameter is specified.
|
||||
dnl If is errthrow or refreturn
|
||||
`ifelse(`$11',,,` GError* gerror = nullptr;
|
||||
')dnl
|
||||
dnl If a slot type has been specified insert a slot copy declaration.
|
||||
ifelse(`$18',,,dnl
|
||||
dnl See if the slot should or should not be copied
|
||||
`ifelse(`$20',,dnl
|
||||
` // Create a copy of the slot.
|
||||
auto slot_copy = new $18($19); ',dnl
|
||||
dnl
|
||||
` // Use the original slot (not a copy).
|
||||
auto slot_copy = const_cast<$18*>(&$19);')
|
||||
|
||||
')`'dnl
|
||||
dnl Insert the declarations for C output parameters
|
||||
ifelse(`$6',,,`$6
|
||||
')`'dnl
|
||||
ifelse(`$16',,dnl If no C++ output parameter is specified:
|
||||
` ifelse(`$3',void,,``$3' retvalue = ')_CONVERT($4,`$3',`$2`'(ifelse(`$9',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$7',,,`, ')$7)');
|
||||
'dnl
|
||||
,dnl A C++ output parameter is specified:
|
||||
` _INITIALIZE($17,$4,`$16',`$2`'(ifelse(`$9',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$7',,,`, ')$7)',$21);
|
||||
'dnl
|
||||
)dnl
|
||||
ifelse(`$11',,,`dnl
|
||||
if(gerror)
|
||||
::Glib::Error::throw_exception(gerror);
|
||||
')dnl
|
||||
ifelse(`$10',,,`dnl
|
||||
if(ifelse(`$16',,`retvalue',$16))
|
||||
ifelse(`$16',,`retvalue',$16)->reference(); //The function does not do a ref for us.
|
||||
')dnl
|
||||
dnl Insert the initializations for the C output parameters
|
||||
ifelse(`$8',,,`$8
|
||||
')`'dnl
|
||||
ifelse(`$3',void,,` return retvalue;
|
||||
')dnl
|
||||
')dnl End errthrow/refreturn
|
||||
',` return const_cast<__CPPNAME__*>(this)->$1($14);
|
||||
')dnl
|
||||
}
|
||||
ifelse(`$12',,,`G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
_DEPRECATE_IFDEF_END')`'dnl The expansion of _DEPRECATE_IFDEF_END ends with a newline
|
||||
ifelse(`$15',,,`#endif // $15
|
||||
')
|
||||
_POP()')
|
||||
|
||||
dnl
|
||||
dnl static method
|
||||
dnl $1 $2 $3 $4 $5 $6 $7
|
||||
dnl _STATIC_METHOD(cppname,cname,cpprettype,crettype,arglist,cdeclarations,cargs,
|
||||
dnl $8 $9 $10 $11 $12 $13
|
||||
dnl cinitializations,refreturn,errthrow,deprecated,ifdef,out_param,
|
||||
dnl $14 $15 $16 $17 $18
|
||||
dnl out_param_type,slot_type,slot_name,no_slot_copy,wrap_line)
|
||||
define(`_STATIC_METHOD',`dnl
|
||||
_PUSH(SECTION_CC)
|
||||
ifelse(`$12',,,`#ifdef $12'
|
||||
)dnl
|
||||
ifelse(`$11',,,`_DEPRECATE_IFDEF_START`'dnl The expansion of _DEPRECATE_IFDEF_START ends with a newline
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
')dnl
|
||||
$3 __CPPNAME__::$1($5)
|
||||
{
|
||||
ifelse(`$9'`$10',,dnl
|
||||
dnl If a slot type has been specified insert a slot copy declaration.
|
||||
ifelse(`$15',,,dnl
|
||||
dnl See if the slot should or should not be copied
|
||||
`ifelse(`$17',,dnl
|
||||
` // Create a copy of the slot.
|
||||
auto slot_copy = new $15($16); ',dnl
|
||||
dnl
|
||||
` // Use the original slot (not a copy).
|
||||
auto slot_copy = const_cast<$15*>(&$16);')
|
||||
|
||||
')`'dnl
|
||||
dnl Insert declarations for C the output parameters
|
||||
ifelse(`$6',,,`$6
|
||||
')`'dnl
|
||||
`ifelse(`$13',,
|
||||
dnl If no C++ output parameter is specified.
|
||||
` ifelse(`$3',void,,dnl
|
||||
dnl Returns non-void:
|
||||
dnl Store the return if there are C output parameters
|
||||
ifelse(`$6',,`return ',``$3' retval = '))_CONVERT($4,`$3',`$2`'($7)');'dnl
|
||||
dnl A C++ output parameter is specified so initialize it from C return
|
||||
,` _INITIALIZE($14,$4,`$13',`$2`'($7)',$18);'dnl
|
||||
)
|
||||
dnl Insert the initializations for the C output parameters if there are any
|
||||
ifelse(`$8',,,`$8
|
||||
')`'dnl
|
||||
dnl Return the value if it was stored and if the method returns something
|
||||
ifelse(`$3',void,,`ifelse(`$6',,,` return retval;
|
||||
')')dnl
|
||||
',dnl End if a C++ output parameter is specified.
|
||||
`ifelse(`$10',,,` GError* gerror = nullptr;')
|
||||
dnl If a slot type has been specified insert a slot copy declaration.
|
||||
ifelse(`$15',,,dnl
|
||||
dnl See if the slot should or should not be copied
|
||||
`ifelse(`$17',,dnl
|
||||
` // Create a copy of the slot.
|
||||
auto slot_copy = new $15($16); ',dnl
|
||||
dnl
|
||||
` // Use the original slot (not a copy).
|
||||
auto slot_copy = const_cast<$15*>(&$16);')
|
||||
|
||||
')`'dnl
|
||||
dnl Insert the declarations for the C output parameters
|
||||
ifelse(`$6',,,`$6
|
||||
')`'dnl
|
||||
ifelse(`$13',,dnl If no C++ output parameter is specified:
|
||||
ifelse(`$3',void,,``$3' retvalue = ')_CONVERT($4,`$3',`$2`'($7)');dnl
|
||||
dnl A C++ output parameter is specified:
|
||||
,` _INITIALIZE($14,$4,`$13',`$2`'($7)',$18);'dnl
|
||||
)dnl
|
||||
ifelse(`$10',,,`
|
||||
if(gerror)
|
||||
::Glib::Error::throw_exception(gerror);
|
||||
')dnl
|
||||
dnl Insert the initializations for the C output parameters.
|
||||
ifelse(`$8',,,`$8
|
||||
')`'dnl
|
||||
ifelse(`$9',,,`
|
||||
if(ifelse(`$13',,`retvalue',$13))
|
||||
ifelse(`$13',,`retvalue',$13)->reference(); //The function does not do a ref for us
|
||||
')dnl
|
||||
ifelse(`$3',void,,` return retvalue;
|
||||
')dnl
|
||||
')dnl
|
||||
}
|
||||
ifelse(`$11',,,`G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
_DEPRECATE_IFDEF_END')`'dnl The expansion of _DEPRECATE_IFDEF_END ends with a newline
|
||||
ifelse(`$12',,,`#endif // $12
|
||||
')
|
||||
_POP()')
|
||||
38
squashfs-root/usr/lib/glibmm-2.4/proc/m4/property.m4
Normal file
38
squashfs-root/usr/lib/glibmm-2.4/proc/m4/property.m4
Normal file
@@ -0,0 +1,38 @@
|
||||
dnl
|
||||
dnl
|
||||
dnl Code generation sections for properties
|
||||
dnl
|
||||
dnl
|
||||
|
||||
dnl $1 $2 $3 $4 $5 $6
|
||||
dnl _PROPERTY_PROXY(name, name_underscored, cpp_type, proxy_suffix, deprecated, docs)
|
||||
dnl proxy_suffix could be "", "_WriteOnly" or "_ReadOnly"
|
||||
dnl The method will be const if the propertyproxy is _ReadOnly.
|
||||
dnl
|
||||
define(`_PROPERTY_PROXY',`dnl
|
||||
dnl
|
||||
dnl Put spaces around the template parameter if necessary.
|
||||
pushdef(`__PROXY_TYPE__',`dnl
|
||||
Glib::PropertyProxy$4< _QUOTE($3) >'dnl
|
||||
)dnl
|
||||
/** $6
|
||||
*
|
||||
* @return A PropertyProxy$4 that allows you to dnl
|
||||
ifelse($4,_ReadOnly,get,`ifelse($4,_WriteOnly,set,get or set)') the value of the property,
|
||||
* or receive notification when the value of the property changes.
|
||||
*/
|
||||
__PROXY_TYPE__ property_$2`'() ifelse($4,_ReadOnly, const,);
|
||||
_PUSH(SECTION_CC_PROPERTYPROXIES)
|
||||
ifelse(`$5',,,`_DEPRECATE_IFDEF_START
|
||||
')dnl
|
||||
__PROXY_TYPE__ __CPPNAME__::property_$2`'() ifelse($4,_ReadOnly, const,)
|
||||
{
|
||||
return __PROXY_TYPE__`'(this, "$1");
|
||||
}
|
||||
ifelse(`$5',,,`_DEPRECATE_IFDEF_END
|
||||
')dnl
|
||||
|
||||
_POP()
|
||||
popdef(`__PROXY_TYPE__')dnl
|
||||
')dnl
|
||||
|
||||
353
squashfs-root/usr/lib/glibmm-2.4/proc/m4/signal.m4
Normal file
353
squashfs-root/usr/lib/glibmm-2.4/proc/m4/signal.m4
Normal file
@@ -0,0 +1,353 @@
|
||||
#
|
||||
# --------------------------- Signal Decl----------------------------
|
||||
#
|
||||
|
||||
dnl _SIGNAL_PROXY($1 = c_signal_name,
|
||||
dnl $2 = c_return_type,
|
||||
dnl $3 = `<c_arg_types_and_names>',
|
||||
dnl $4 = cpp_signal_name,
|
||||
dnl $5 = cpp_return_type,
|
||||
dnl $6 = `<cpp_arg_types>',
|
||||
dnl $7 = `<c_args_to_cpp>',
|
||||
dnl $8 = `custom_c_callback (boolean)',
|
||||
dnl $9 = `deprecated' (boolean),
|
||||
dnl $10 = `refdoc_comment',
|
||||
dnl $11 = ifdef,
|
||||
dnl $12 = exceptionHandler,
|
||||
dnl $13 = detail_name,
|
||||
dnl $14 = two_signal_methods (boolean))
|
||||
|
||||
define(`_SIGNAL_PROXY',`
|
||||
ifelse(`$11',,,`#ifdef $11'
|
||||
)dnl
|
||||
ifelse(`$9',,,`_DEPRECATE_IFDEF_START
|
||||
')dnl
|
||||
ifelse($13,,`dnl no detail_name
|
||||
$10
|
||||
Glib::SignalProxy< $5`'_COMMA_PREFIX($6) > signal_$4`'();
|
||||
',dnl detail_name
|
||||
$14,0,`dnl
|
||||
$10
|
||||
Glib::SignalProxyDetailedAnyType< $5`'_COMMA_PREFIX($6) > signal_$4`'(const Glib::ustring& $13 = Glib::ustring());
|
||||
',`dnl detail_name and two_signal_methods
|
||||
$10
|
||||
Glib::SignalProxy< $5`'_COMMA_PREFIX($6) > signal_$4`'();
|
||||
|
||||
$10
|
||||
Glib::SignalProxyDetailedAnyType< $5`'_COMMA_PREFIX($6) > signal_$4`'(const Glib::ustring& $13);
|
||||
')dnl end detail_name
|
||||
ifelse(`$9',,,`_DEPRECATE_IFDEF_END
|
||||
')dnl
|
||||
ifelse(`$11',,,`#endif // $11
|
||||
')dnl
|
||||
dnl
|
||||
_PUSH(SECTION_ANONYMOUS_NAMESPACE)
|
||||
|
||||
ifelse(`$11',,,`#ifdef $11'
|
||||
)dnl
|
||||
ifelse(`$9',,,`_DEPRECATE_IFDEF_START
|
||||
')dnl
|
||||
dnl
|
||||
ifelse($2`'_NUM($3)`'$5`'_NUM($6)`'$8`'_NUM($12),`void0void000',`dnl
|
||||
dnl
|
||||
dnl Use predefined callback for SignalProxy0<void>, to reduce code size,
|
||||
dnl if custom_c_callback or exception_handler is not specified.
|
||||
|
||||
static const Glib::SignalProxyInfo __CPPNAME__`'_signal_$4_info =
|
||||
{
|
||||
"$1",
|
||||
(GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
|
||||
(GCallback) &Glib::SignalProxyNormal::slot0_void_callback
|
||||
};
|
||||
',`dnl else
|
||||
|
||||
ifelse($8,`1',,`dnl Do not generate the implementation if it should be custom:
|
||||
static $2 __CPPNAME__`'_signal_$4_callback`'(__CNAME__`'* self, _COMMA_SUFFIX($3)`'void* data)
|
||||
{
|
||||
using namespace __NAMESPACE__;
|
||||
using SlotType = sigc::slot< $5`'_COMMA_PREFIX($6) >;
|
||||
|
||||
auto obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
|
||||
// Do not try to call a signal on a disassociated wrapper.
|
||||
if(obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(const auto slot = Glib::SignalProxyNormal::data_to_slot`'(data))
|
||||
ifelse(`$2',void,`dnl
|
||||
(*static_cast<SlotType*>(slot))($7);
|
||||
',`dnl else
|
||||
return _CONVERT($5,$2,`(*static_cast<SlotType*>(slot))($7)');
|
||||
')dnl endif
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
ifelse($12, `', `dnl
|
||||
Glib::exception_handlers_invoke`'();
|
||||
', `dnl
|
||||
try
|
||||
{
|
||||
return _CONVERT($5, $2, `obj->$12`'()');
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
Glib::exception_handlers_invoke`'();
|
||||
}
|
||||
')dnl
|
||||
}
|
||||
}
|
||||
ifelse($2,void,,`dnl else
|
||||
|
||||
using RType = $2;
|
||||
return RType`'();
|
||||
')dnl
|
||||
}
|
||||
ifelse($2,void,,`dnl else
|
||||
|
||||
static $2 __CPPNAME__`'_signal_$4_notify_callback`'(__CNAME__`'* self, _COMMA_SUFFIX($3)`' void* data)
|
||||
{
|
||||
using namespace __NAMESPACE__;
|
||||
using SlotType = sigc::slot< void`'_COMMA_PREFIX($6) >;
|
||||
|
||||
auto obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
|
||||
// Do not try to call a signal on a disassociated wrapper.
|
||||
if(obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(const auto slot = Glib::SignalProxyNormal::data_to_slot`'(data))
|
||||
(*static_cast<SlotType*>(slot))($7);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
ifelse($12, `', `dnl
|
||||
Glib::exception_handlers_invoke`'();
|
||||
', `dnl
|
||||
try
|
||||
{
|
||||
return _CONVERT($5, $2, `obj->$12`'()');
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
Glib::exception_handlers_invoke`'();
|
||||
}
|
||||
')dnl
|
||||
}
|
||||
}
|
||||
|
||||
using RType = $2;
|
||||
return RType`'();
|
||||
}
|
||||
')dnl endif
|
||||
')dnl endif
|
||||
|
||||
static const Glib::SignalProxyInfo __CPPNAME__`'_signal_$4_info =
|
||||
{
|
||||
"$1",
|
||||
(GCallback) &__CPPNAME__`'_signal_$4_callback,
|
||||
(GCallback) &__CPPNAME__`'_signal_$4_`'ifelse($2,void,,notify_)`'callback
|
||||
};
|
||||
')dnl endif
|
||||
|
||||
ifelse(`$9',,,`_DEPRECATE_IFDEF_END
|
||||
')dnl
|
||||
ifelse(`$11',,,`#endif // $11
|
||||
')dnl
|
||||
|
||||
_SECTION(SECTION_CC_SIGNALPROXIES)
|
||||
|
||||
ifelse(`$11',,,`#ifdef $11'
|
||||
)dnl
|
||||
ifelse(`$9',,,`_DEPRECATE_IFDEF_START
|
||||
')dnl
|
||||
ifelse($13,,`dnl no detail_name
|
||||
Glib::SignalProxy< $5`'_COMMA_PREFIX($6) > __CPPNAME__::signal_$4`'()
|
||||
{
|
||||
return Glib::SignalProxy< $5`'_COMMA_PREFIX($6) >(this, &__CPPNAME__`'_signal_$4_info);
|
||||
}
|
||||
',dnl detail_name
|
||||
$14,0,`dnl
|
||||
Glib::SignalProxyDetailedAnyType< $5`'_COMMA_PREFIX($6) > __CPPNAME__::signal_$4`'(const Glib::ustring& $13)
|
||||
{
|
||||
return Glib::SignalProxyDetailedAnyType< $5`'_COMMA_PREFIX($6) >(this, &__CPPNAME__`'_signal_$4_info, $13);
|
||||
}
|
||||
',`dnl detail_name and two_signal_methods
|
||||
Glib::SignalProxy< $5`'_COMMA_PREFIX($6) > __CPPNAME__::signal_$4`'()
|
||||
{
|
||||
return Glib::SignalProxy< $5`'_COMMA_PREFIX($6) >(this, &__CPPNAME__`'_signal_$4_info);
|
||||
}
|
||||
|
||||
Glib::SignalProxyDetailedAnyType< $5`'_COMMA_PREFIX($6) > __CPPNAME__::signal_$4`'(const Glib::ustring& $13)
|
||||
{
|
||||
return Glib::SignalProxyDetailedAnyType< $5`'_COMMA_PREFIX($6) >(this, &__CPPNAME__`'_signal_$4_info, $13);
|
||||
}
|
||||
')dnl end detail_name
|
||||
ifelse(`$9',,,`_DEPRECATE_IFDEF_END
|
||||
')dnl
|
||||
ifelse(`$11',,,`#endif // $11
|
||||
')dnl
|
||||
|
||||
_POP()')
|
||||
|
||||
|
||||
dnl $1 $2 $3 $4 $5 $6
|
||||
dnl _SIGNAL_PH(gname, crettype, cargs and names, ifdef, deprecated, exceptionHandler)
|
||||
dnl Create a callback and set it in our derived G*Class.
|
||||
dnl
|
||||
define(`_SIGNAL_PH',`dnl
|
||||
_PUSH(SECTION_PCC_CLASS_INIT_DEFAULT_SIGNAL_HANDLERS)
|
||||
ifelse(`$4',,,`#ifdef $4'
|
||||
)dnl
|
||||
ifelse(`$5',,,`_DEPRECATE_IFDEF_START
|
||||
')dnl
|
||||
klass->$1 = `&'$1_callback;
|
||||
ifelse(`$5',,,`_DEPRECATE_IFDEF_END
|
||||
')dnl
|
||||
ifelse(`$4',,,`#endif // $4
|
||||
')dnl
|
||||
_SECTION(SECTION_PH_DEFAULT_SIGNAL_HANDLERS)
|
||||
ifelse(`$4',,,`#ifdef $4'
|
||||
)dnl
|
||||
ifelse(`$5',,,`_DEPRECATE_IFDEF_START
|
||||
')dnl
|
||||
static $2 $1_callback`'($3);
|
||||
ifelse(`$5',,,`_DEPRECATE_IFDEF_END
|
||||
')dnl
|
||||
ifelse(`$4',,,`#endif // $4
|
||||
')dnl
|
||||
_POP()')
|
||||
|
||||
|
||||
|
||||
dnl $1 $2 $3 $4 $5 $6
|
||||
dnl _SIGNAL_PCC(cppname,gname,cpprettype,crettype,`<cargs and names>',`<cnames>',
|
||||
dnl $7 $8 $9 $10 $11
|
||||
dnl `<cpparg names>',firstarg,<ifdef>,deprecated,exceptionHandler)
|
||||
dnl
|
||||
define(`_SIGNAL_PCC',`dnl
|
||||
_PUSH(SECTION_PCC_DEFAULT_SIGNAL_HANDLERS)
|
||||
ifelse(`$9',,,`#ifdef $9'
|
||||
)dnl
|
||||
ifelse(`$10',,,`_DEPRECATE_IFDEF_START
|
||||
')dnl
|
||||
$4 __CPPNAME__`'_Class::$2_callback`'($5)
|
||||
{
|
||||
dnl First, do a simple cast to ObjectBase. We will have to do a dynamic_cast
|
||||
dnl eventually, but it is not necessary to check whether we need to call
|
||||
dnl the vfunc.
|
||||
const auto obj_base = static_cast<Glib::ObjectBase*>(
|
||||
Glib::ObjectBase::_get_current_wrapper`'((GObject*)$8));
|
||||
|
||||
_IMPORT(SECTION_CHECK)
|
||||
// Non-gtkmmproc-generated custom classes implicitly call the default
|
||||
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
|
||||
// generated classes can use this optimisation, which avoids the unnecessary
|
||||
// parameter conversions if there is no possibility of the virtual function
|
||||
// being overridden:
|
||||
if(obj_base && obj_base->is_derived_())
|
||||
{
|
||||
dnl We need to do a dynamic cast to get the real object type, to call the
|
||||
dnl C++ vfunc on it.
|
||||
const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
|
||||
if(obj) // This can be NULL during destruction.
|
||||
{
|
||||
try // Trap C++ exceptions which would normally be lost because this is a C callback.
|
||||
{
|
||||
// Call the virtual member method, which derived classes might override.
|
||||
ifelse($4,void,`dnl
|
||||
obj->on_$1`'($7);
|
||||
return;
|
||||
',`dnl
|
||||
return _CONVERT($3,$4,`obj->on_$1`'($7)');
|
||||
')dnl
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
ifelse($11, `', `dnl
|
||||
Glib::exception_handlers_invoke`'();
|
||||
', `dnl
|
||||
try
|
||||
{
|
||||
return _CONVERT($3, $4, `obj->$11`'()');
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
Glib::exception_handlers_invoke`'();
|
||||
}
|
||||
')dnl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const auto base = static_cast<BaseClassType*>(
|
||||
ifdef(`__BOOL_IS_INTERFACE__',`dnl
|
||||
_IFACE_PARENT_FROM_OBJECT($8)dnl
|
||||
',`dnl
|
||||
_PARENT_GCLASS_FROM_OBJECT($8)dnl
|
||||
') );
|
||||
dnl g_assert(base != nullptr);
|
||||
|
||||
// Call the original underlying C function:
|
||||
if(base && base->$2)
|
||||
ifelse($4,void,,`return ')(*base->$2)`'($6);
|
||||
ifelse($4,void,,`dnl
|
||||
|
||||
using RType = $4;
|
||||
return RType`'();
|
||||
')dnl
|
||||
}
|
||||
ifelse(`$10',,,`_DEPRECATE_IFDEF_END
|
||||
')dnl
|
||||
ifelse(`$9',,,`#endif // $9
|
||||
')dnl
|
||||
_POP()')
|
||||
|
||||
|
||||
dnl $1 $2 $3 $4
|
||||
dnl _SIGNAL_H(signame, rettype, `<cppargs>', <ifdef>)
|
||||
dnl
|
||||
define(`_SIGNAL_H',`dnl
|
||||
_PUSH(SECTION_H_DEFAULT_SIGNAL_HANDLERS)
|
||||
ifelse(`$4',,,`#ifdef $4'
|
||||
)dnl
|
||||
/// This is a default handler for the signal signal_$1`'().
|
||||
virtual $2 on_$1`'($3);
|
||||
ifelse(`$4',,,`#endif // $4
|
||||
')dnl
|
||||
_POP()')
|
||||
|
||||
dnl $1 $2 $3 $4 $5 $6 $7 $8 $9
|
||||
dnl _SIGNAL_CC(signame,gname,rettype,crettype,`<cppargs>',`<carg_names>', const, refreturn, <ifdef>)
|
||||
dnl
|
||||
define(`_SIGNAL_CC',`dnl
|
||||
_PUSH(SECTION_CC_DEFAULT_SIGNAL_HANDLERS)
|
||||
ifelse(`$9',,,`#ifdef $9'
|
||||
)dnl
|
||||
$3 __NAMESPACE__::__CPPNAME__::on_$1`'($5)
|
||||
{
|
||||
const auto base = static_cast<BaseClassType*>(
|
||||
ifdef(`__BOOL_IS_INTERFACE__',`dnl
|
||||
_IFACE_PARENT_FROM_OBJECT(gobject_)dnl
|
||||
',`dnl
|
||||
_PARENT_GCLASS_FROM_OBJECT(gobject_)dnl
|
||||
') );
|
||||
dnl g_assert(base != nullptr);
|
||||
|
||||
if(base && base->$2)
|
||||
ifelse($3,void,`dnl
|
||||
(*base->$2)`'(gobj`'()`'_COMMA_PREFIX($6));
|
||||
',`dnl
|
||||
ifelse($8,refreturn,`dnl Assume Glib::wrap() is correct if refreturn is requested.
|
||||
return Glib::wrap((*base->$2)`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'_COMMA_PREFIX($6)), true);
|
||||
',`dnl
|
||||
return _CONVERT($4,$3,`(*base->$2)`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'_COMMA_PREFIX($6))');
|
||||
')dnl
|
||||
|
||||
using RType = $3;
|
||||
return RType`'();
|
||||
')dnl
|
||||
}
|
||||
ifelse(`$9',,,`#endif // $9
|
||||
')dnl
|
||||
_POP()')
|
||||
|
||||
233
squashfs-root/usr/lib/glibmm-2.4/proc/m4/vfunc.m4
Normal file
233
squashfs-root/usr/lib/glibmm-2.4/proc/m4/vfunc.m4
Normal file
@@ -0,0 +1,233 @@
|
||||
dnl
|
||||
dnl _VFUNC_PH(gtkname, crettype, cargs and names)
|
||||
dnl Create a callback and set it in our derived G*Class.
|
||||
dnl
|
||||
define(`_VFUNC_PH',`dnl
|
||||
_PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
|
||||
ifelse(`$4',,,`#ifdef $4'
|
||||
)dnl
|
||||
klass->$1 = `&'$1_vfunc_callback;
|
||||
ifelse(`$4',,,`#endif // $4
|
||||
')dnl
|
||||
_SECTION(SECTION_PH_VFUNCS)
|
||||
ifelse(`$4',,,`#ifdef $4'
|
||||
)dnl
|
||||
static $2 $1_vfunc_callback`'($3);
|
||||
ifelse(`$4',,,`#endif // $4
|
||||
')dnl
|
||||
_POP()')
|
||||
|
||||
|
||||
dnl $1 $2 $3 $4
|
||||
dnl _VFUNC_PCC(cppname,gtkname,cpprettype,crettype,
|
||||
dnl $5 $6 $7 $8
|
||||
dnl `<cargs and names>',`<cnames>',`<cpparg names>',firstarg,
|
||||
dnl $9 $10 $11 $12
|
||||
dnl refreturn_ctype, keep_return, ifdef, errthrow,
|
||||
dnl $13 $14 $15 $16 $17
|
||||
dnl slot_type, c_data_param_name, return_value, err_return_value, exception_handler)
|
||||
dnl
|
||||
dnl Note: _get_current_wrapper_inline() could be used throughout for performance instead of _get_current_wrapper(),
|
||||
dnl and is_derived_() instead of is_derived_(),
|
||||
dnl but it is not yet clear whether that would be a worthwhile performance optimization.
|
||||
define(`_VFUNC_PCC',`dnl
|
||||
_PUSH(SECTION_PCC_VFUNCS)
|
||||
ifelse(`$11',,,`#ifdef $11'
|
||||
)dnl
|
||||
$4 __CPPNAME__`'_Class::$2_vfunc_callback`'($5)
|
||||
{
|
||||
ifelse(`$14',,,dnl
|
||||
` const auto slot = static_cast<$13*>($14);
|
||||
|
||||
')dnl
|
||||
dnl First, do a simple cast to ObjectBase. We will have to do a dynamic_cast
|
||||
dnl eventually, but it is not necessary to check whether we need to call
|
||||
dnl the vfunc.
|
||||
const auto obj_base = static_cast<Glib::ObjectBase*>(
|
||||
Glib::ObjectBase::_get_current_wrapper`'((GObject*)$8));
|
||||
|
||||
_IMPORT(SECTION_CHECK)
|
||||
// Non-gtkmmproc-generated custom classes implicitly call the default
|
||||
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
|
||||
// generated classes can use this optimisation, which avoids the unnecessary
|
||||
// parameter conversions if there is no possibility of the virtual function
|
||||
// being overridden:
|
||||
if(obj_base && obj_base->is_derived_())
|
||||
{
|
||||
dnl We need to do a dynamic cast to get the real object type, to call the
|
||||
dnl C++ vfunc on it.
|
||||
const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
|
||||
if(obj) // This can be NULL during destruction.
|
||||
{
|
||||
try // Trap C++ exceptions which would normally be lost because this is a C callback.
|
||||
{
|
||||
// Call the virtual member method, which derived classes might override.
|
||||
ifelse($4,void,`dnl
|
||||
obj->$1`'($7);
|
||||
return;
|
||||
',`dnl not void
|
||||
ifelse($9,refreturn_ctype,`dnl Assume Glib::unwrap_copy() is correct if refreturn_ctype is requested.
|
||||
return Glib::unwrap_copy`'(`obj->$1'($7));
|
||||
',`dnl not refreturn_ctype
|
||||
ifelse($10,keep_return,`dnl
|
||||
static auto quark_return_value = g_quark_from_static_string("__NAMESPACE__::__CPPNAME__::$1");
|
||||
|
||||
auto return_value = static_cast<$3*>(g_object_get_qdata(obj_base->gobj(), quark_return_value));
|
||||
if (!return_value)
|
||||
{
|
||||
return_value = new $3`'();
|
||||
g_object_set_qdata_full(obj_base->gobj(), quark_return_value, return_value,
|
||||
&Glib::destroy_notify_delete<$3>);
|
||||
}
|
||||
// Keep a copy of the return value. The caller is not expected
|
||||
// to free the object that the returned pointer points to.
|
||||
*return_value = obj->$1`'($7);
|
||||
return _CONVERT($3,$4,`(*return_value)');
|
||||
',`dnl not keep_return
|
||||
return _CONVERT($3,$4,`obj->$1`'($7)');
|
||||
')dnl end keep_return
|
||||
')dnl end refreturn_ctype
|
||||
')dnl end void
|
||||
}
|
||||
ifelse($17,,,`dnl if (exception_handler)
|
||||
catch(...)
|
||||
{
|
||||
try
|
||||
{
|
||||
ifelse($9,refreturn_ctype,`dnl
|
||||
return Glib::unwrap_copy`'(obj->$17`'());
|
||||
', `dnl
|
||||
return _CONVERT($3, $4, `obj->$17`'()');
|
||||
')dnl
|
||||
}
|
||||
')dnl end exception_handler
|
||||
ifelse($12,errthrow,`dnl
|
||||
catch(Glib::Error& errormm)
|
||||
{
|
||||
errormm.propagate(error);
|
||||
ifelse($4,void,`dnl
|
||||
return;
|
||||
',`dnl
|
||||
ifelse(`$16', `',`dnl
|
||||
using RType = $4;
|
||||
return RType`'();
|
||||
',`dnl
|
||||
return _CONVERT($3,$4,`$16');
|
||||
')dnl
|
||||
')dnl
|
||||
}
|
||||
')dnl end errthrow
|
||||
catch(...)
|
||||
{
|
||||
Glib::exception_handlers_invoke`'();
|
||||
}
|
||||
ifelse($17,,,`dnl if (exception_handler)
|
||||
}
|
||||
')dnl
|
||||
}
|
||||
}
|
||||
|
||||
BaseClassType *const base = static_cast<BaseClassType*>(
|
||||
ifdef(`__BOOL_IS_INTERFACE__',`dnl
|
||||
_IFACE_PARENT_FROM_OBJECT($8)dnl
|
||||
',`dnl
|
||||
_PARENT_GCLASS_FROM_OBJECT($8)dnl
|
||||
') );
|
||||
dnl g_assert(base != nullptr);
|
||||
|
||||
// Call the original underlying C function:
|
||||
if(base && base->$2)
|
||||
ifelse($4,void,,`return ')(*base->$2)`'($6);
|
||||
ifelse($4,void,,`dnl
|
||||
|
||||
ifelse(`$15', `',`dnl
|
||||
using RType = $4;
|
||||
return RType`'();
|
||||
',`dnl
|
||||
return _CONVERT($3,$4,`$15');
|
||||
')dnl
|
||||
')dnl
|
||||
}
|
||||
ifelse(`$11',,,`#endif // $11
|
||||
')dnl
|
||||
_POP()')
|
||||
|
||||
# $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14
|
||||
# _VFUNC_CC(vfunc_name, gtkname, cpp_rettype, c_rettype, `<cppargs>', `<carg_names>', is_const, refreturn, $ifdef, $errthrow, $slot_type, $slot_name, $no_slot_copy, $returnValue)
|
||||
#
|
||||
define(`_VFUNC_CC',`dnl
|
||||
_PUSH(SECTION_CC_VFUNCS)
|
||||
ifelse(`$9',,,`#ifdef $9'
|
||||
)dnl
|
||||
$3 __NAMESPACE__::__CPPNAME__::$1`'($5) ifelse($7,1,const,)
|
||||
{
|
||||
dnl If a slot type has been specified, insert code to create a copy of it.
|
||||
ifelse(`$11',,,dnl
|
||||
dnl See if the slot should or should not be copied
|
||||
`ifelse(`$13',,dnl
|
||||
` // Create a copy of the slot.
|
||||
auto slot_copy = new $11($12); ',dnl
|
||||
dnl
|
||||
` // Use the original slot (not a copy).
|
||||
auto slot_copy = const_cast<$11*>(&$12);')
|
||||
|
||||
')dnl
|
||||
const auto base = static_cast<BaseClassType*>(
|
||||
ifdef(`__BOOL_IS_INTERFACE__',`dnl
|
||||
_IFACE_PARENT_FROM_OBJECT(gobject_)dnl
|
||||
',`dnl
|
||||
_PARENT_GCLASS_FROM_OBJECT(gobject_)dnl
|
||||
') );
|
||||
dnl g_assert(base != nullptr);
|
||||
|
||||
if(base && base->$2)
|
||||
{
|
||||
ifelse($10,errthrow,`dnl
|
||||
GError* gerror = nullptr;
|
||||
')dnl
|
||||
ifelse($3,void,`dnl
|
||||
(*base->$2)`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'_COMMA_PREFIX($6));
|
||||
}
|
||||
',`dnl
|
||||
ifelse($8,refreturn,`dnl Assume Glib::wrap() is correct if refreturn is requested.
|
||||
$3 retval(Glib::wrap((*base->$2)`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'_COMMA_PREFIX($6)), true));
|
||||
',`dnl
|
||||
$3 retval(_CONVERT($4,$3,`(*base->$2)`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'_COMMA_PREFIX($6))'));
|
||||
')dnl
|
||||
ifelse($10,errthrow,`dnl
|
||||
if(gerror)
|
||||
::Glib::Error::throw_exception(gerror);
|
||||
')dnl
|
||||
return retval;
|
||||
}
|
||||
|
||||
ifelse(`$14', `',`dnl
|
||||
using RType = $3;
|
||||
return RType`'();
|
||||
',`dnl
|
||||
return $14;
|
||||
')dnl
|
||||
')dnl
|
||||
}
|
||||
ifelse(`$9',,,`#endif // $9
|
||||
')dnl
|
||||
_POP()')
|
||||
|
||||
|
||||
# $1 $2 $3 $4 $5
|
||||
# _VFUNC_H(vfunc_name, rettype, `<cppargs>', is_const, ifndef)
|
||||
# Only used for custom vfuncs.
|
||||
#
|
||||
define(`_VFUNC_H',`dnl
|
||||
_PUSH(SECTION_H_VFUNCS)
|
||||
ifelse(`$5',,,`#ifdef $5'
|
||||
)dnl
|
||||
ifelse($4,`1',`dnl
|
||||
virtual $2 $1`'($3) const;
|
||||
',`dnl
|
||||
virtual $2 $1`'($3);
|
||||
')
|
||||
ifelse(`$5',,,`#endif // $5
|
||||
')dnl
|
||||
_POP()')
|
||||
|
||||
970
squashfs-root/usr/lib/glibmm-2.4/proc/pm/DocsParser.pm
Normal file
970
squashfs-root/usr/lib/glibmm-2.4/proc/pm/DocsParser.pm
Normal file
@@ -0,0 +1,970 @@
|
||||
# gtkmm - DocsParser module
|
||||
#
|
||||
# Copyright 2001 Free Software Foundation
|
||||
#
|
||||
# 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, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# Based on XML::Parser tutorial found at http://www.devshed.com/Server_Side/Perl/PerlXML/PerlXML1/page1.html
|
||||
# This module isn't properly Object Orientated because the XML Parser needs global callbacks.
|
||||
|
||||
package DocsParser;
|
||||
use XML::Parser;
|
||||
use strict;
|
||||
use warnings;
|
||||
use feature 'state';
|
||||
|
||||
use Util;
|
||||
use Function;
|
||||
use GtkDefs;
|
||||
use Object;
|
||||
|
||||
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;
|
||||
|
||||
#####################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
#####################################
|
||||
|
||||
$DocsParser::CurrentFile = "";
|
||||
|
||||
$DocsParser::refAppendTo = undef; # string reference to store the data into
|
||||
$DocsParser::currentParam = undef;
|
||||
|
||||
$DocsParser::objCurrentFunction = undef; #Function
|
||||
%DocsParser::hasharrayFunctions = (); #Function elements
|
||||
%DocsParser::type_names = (); # Type names (e.g. enums) with non-standard C-to-C++ translation.
|
||||
%DocsParser::enumerator_name_prefixes = (); # Enumerator name prefixes with non-standard C-to-C++ translation.
|
||||
%DocsParser::enumerator_names = (); # Enumerator names with non-standard C-to-C++ translation.
|
||||
|
||||
$DocsParser::commentStart = " /** ";
|
||||
$DocsParser::commentMiddleStart = " * ";
|
||||
$DocsParser::commentEnd = " */";
|
||||
|
||||
sub read_defs($$$)
|
||||
{
|
||||
my ($path, $filename, $filename_override) = @_;
|
||||
|
||||
my $objParser = new XML::Parser(ErrorContext => 0);
|
||||
$objParser->setHandlers(Start => \&parse_on_start, End => \&parse_on_end, Char => \&parse_on_cdata);
|
||||
|
||||
# C documentation:
|
||||
$DocsParser::CurrentFile = "$path/$filename";
|
||||
if ( ! -r $DocsParser::CurrentFile)
|
||||
{
|
||||
print STDERR "DocsParser.pm: Warning: Can't read file \"" . $DocsParser::CurrentFile . "\".\n";
|
||||
return;
|
||||
}
|
||||
# Parse
|
||||
eval { $objParser->parsefile($DocsParser::CurrentFile) };
|
||||
if( $@ )
|
||||
{
|
||||
$@ =~ s/at \/.*?$//s;
|
||||
print STDERR "\nError in \"" . $DocsParser::CurrentFile . "\":$@\n";
|
||||
return;
|
||||
}
|
||||
|
||||
# C++ override documentation:
|
||||
$DocsParser::CurrentFile = $path . '/' . $filename_override;
|
||||
|
||||
# It is not an error if the documentation override file does not exist.
|
||||
return unless (-r $DocsParser::CurrentFile);
|
||||
|
||||
# Parse
|
||||
eval { $objParser->parsefile($DocsParser::CurrentFile) };
|
||||
if( $@ )
|
||||
{
|
||||
$@ =~ s/at \/.*?$//s;
|
||||
print STDERR "\nError in \"" . $DocsParser::CurrentFile . "\":$@";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
sub parse_on_start($$%)
|
||||
{
|
||||
my ($objParser, $tag, %attr) = @_;
|
||||
|
||||
$tag = lc($tag);
|
||||
|
||||
if($tag eq "function" or $tag eq "signal" or $tag eq "property" or $tag eq "enum")
|
||||
{
|
||||
if(defined $DocsParser::objCurrentFunction)
|
||||
{
|
||||
$objParser->xpcroak(
|
||||
"\nClose a function, signal, property or enum tag before you open another one.");
|
||||
}
|
||||
|
||||
my $functionName = $attr{name};
|
||||
|
||||
# Change signal name from Class::a-signal-name to Class::a_signal_name
|
||||
# and property name from Class:a-property-name to Class:a_property_name
|
||||
$functionName =~ s/-/_/g if ($tag eq "signal" or $tag eq "property");
|
||||
|
||||
#Reuse existing Function, if it exists:
|
||||
#(For instance, if this is the override parse)
|
||||
$DocsParser::objCurrentFunction = $DocsParser::hasharrayFunctions{$functionName};
|
||||
if(!$DocsParser::objCurrentFunction)
|
||||
{
|
||||
#Make a new one if necessary:
|
||||
$DocsParser::objCurrentFunction = Function::new_empty();
|
||||
# The idea is to change the policy a bit:
|
||||
# If a function is redefined in a later parsing run only values which are redefined
|
||||
# will be overwritten. For the name this is trivial. The description is simply rewritten.
|
||||
# Same goes for the return description and the class mapping. Only exception is the
|
||||
# parameter list. Everytime we enter a <parameters> tag the list is emptied again.
|
||||
$$DocsParser::objCurrentFunction{name} = $functionName;
|
||||
$$DocsParser::objCurrentFunction{description} = "";
|
||||
$$DocsParser::objCurrentFunction{param_names} = [];
|
||||
$$DocsParser::objCurrentFunction{param_descriptions} = ();
|
||||
$$DocsParser::objCurrentFunction{return_description} = "";
|
||||
$$DocsParser::objCurrentFunction{mapped_class} = "";
|
||||
}
|
||||
}
|
||||
elsif($tag eq "parameters")
|
||||
{
|
||||
$$DocsParser::objCurrentFunction{param_names} = [];
|
||||
$$DocsParser::objCurrentFunction{param_descriptions} = ();
|
||||
}
|
||||
elsif($tag eq "parameter")
|
||||
{
|
||||
$DocsParser::currentParam = $attr{name};
|
||||
$$DocsParser::objCurrentFunction{param_descriptions}->{$DocsParser::currentParam} = "";
|
||||
}
|
||||
elsif($tag eq "description")
|
||||
{
|
||||
$$DocsParser::objCurrentFunction{description} = "";
|
||||
# Set destination for parse_on_cdata().
|
||||
$DocsParser::refAppendTo = \$$DocsParser::objCurrentFunction{description};
|
||||
}
|
||||
elsif($tag eq "parameter_description")
|
||||
{
|
||||
# Set destination for parse_on_cdata().
|
||||
my $param_desc = \$$DocsParser::objCurrentFunction{param_descriptions};
|
||||
$DocsParser::refAppendTo = \$$param_desc->{$DocsParser::currentParam};
|
||||
}
|
||||
elsif($tag eq "return")
|
||||
{
|
||||
$$DocsParser::objCurrentFunction{return_description} = "";
|
||||
# Set destination for parse_on_cdata().
|
||||
$DocsParser::refAppendTo = \$$DocsParser::objCurrentFunction{return_description};
|
||||
}
|
||||
elsif($tag eq "mapping")
|
||||
{
|
||||
$$DocsParser::objCurrentFunction{mapped_class} = $attr{class};
|
||||
}
|
||||
elsif($tag eq "substitute_type_name")
|
||||
{
|
||||
$DocsParser::type_names{$attr{from}} = $attr{to};
|
||||
}
|
||||
elsif($tag eq "substitute_enumerator_name")
|
||||
{
|
||||
if (exists $attr{from_prefix})
|
||||
{
|
||||
$DocsParser::enumerator_name_prefixes{$attr{from_prefix}} = $attr{to_prefix};
|
||||
}
|
||||
if (exists $attr{from})
|
||||
{
|
||||
$DocsParser::enumerator_names{$attr{from}} = $attr{to};
|
||||
}
|
||||
}
|
||||
elsif($tag ne "root")
|
||||
{
|
||||
$objParser->xpcroak("\nUnknown tag \"$tag\".");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub parse_on_end($$)
|
||||
{
|
||||
my ($parser, $tag) = @_;
|
||||
|
||||
# Clear destination for parse_on_cdata().
|
||||
$DocsParser::refAppendTo = undef;
|
||||
|
||||
$tag = lc($tag);
|
||||
|
||||
if($tag eq "function" or $tag eq "signal" or $tag eq "property" or $tag eq "enum")
|
||||
{
|
||||
# Store the Function structure in the array:
|
||||
my $functionName = $$DocsParser::objCurrentFunction{name};
|
||||
$DocsParser::hasharrayFunctions{$functionName} = $DocsParser::objCurrentFunction;
|
||||
$DocsParser::objCurrentFunction = undef;
|
||||
}
|
||||
elsif($tag eq "parameter")
|
||||
{
|
||||
# <parameter name="returns"> and <return> means the same.
|
||||
if($DocsParser::currentParam eq "returns")
|
||||
{
|
||||
my $param_descriptions = \$$DocsParser::objCurrentFunction{param_descriptions};
|
||||
my $return_description = \$$DocsParser::objCurrentFunction{return_description};
|
||||
$$return_description = delete $$param_descriptions->{"returns"};
|
||||
}
|
||||
else
|
||||
{
|
||||
# Append to list of parameters.
|
||||
push(@{$$DocsParser::objCurrentFunction{param_names}}, $DocsParser::currentParam);
|
||||
}
|
||||
|
||||
$DocsParser::currentParam = undef;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub parse_on_cdata($$)
|
||||
{
|
||||
my ($parser, $data) = @_;
|
||||
|
||||
if(defined $DocsParser::refAppendTo)
|
||||
{
|
||||
# Dispatch $data to the current destination string.
|
||||
$$DocsParser::refAppendTo .= $data;
|
||||
}
|
||||
}
|
||||
|
||||
sub lookup_enum_documentation($$$$$$$)
|
||||
{
|
||||
my ($c_enum_name, $cpp_enum_name, $indent, $ref_subst_in, $ref_subst_out,
|
||||
$deprecation_docs, $newin) = @_;
|
||||
|
||||
my $objFunction = $DocsParser::hasharrayFunctions{$c_enum_name};
|
||||
if(!$objFunction)
|
||||
{
|
||||
#print "DocsParser.pm: Warning: enum not found: $enum_name\n";
|
||||
return ""
|
||||
}
|
||||
|
||||
my $docs = "";
|
||||
|
||||
my @param_names = @{$$objFunction{param_names}};
|
||||
my $param_descriptions = \$$objFunction{param_descriptions};
|
||||
|
||||
# Append the param docs first so that the enum description can come last and
|
||||
# the possible flag docs that the m4 _ENUM() macro appends goes in the right
|
||||
# place.
|
||||
foreach my $param (@param_names)
|
||||
{
|
||||
my $desc = $$param_descriptions->{$param};
|
||||
|
||||
# Remove the initial prefix in the name of the enum constant. Would be something like GTK_.
|
||||
$param =~ s/\b[A-Z]+_//;
|
||||
|
||||
# Now apply custom substitutions.
|
||||
for(my $i = 0; $i < scalar(@$ref_subst_in); ++$i)
|
||||
{
|
||||
$param =~ s/$$ref_subst_in[$i]/$$ref_subst_out[$i]/;
|
||||
$desc =~ s/$$ref_subst_in[$i]/$$ref_subst_out[$i]/;
|
||||
}
|
||||
|
||||
# Skip this element, if its name has been deleted.
|
||||
next if($param eq "");
|
||||
|
||||
$param =~ s/([a-zA-Z0-9]*(_[a-zA-Z0-9]+)*)_?/$1/g;
|
||||
if(length($desc) > 0)
|
||||
{
|
||||
# Chop off leading and trailing whitespace.
|
||||
$desc =~ s/^\s+//;
|
||||
$desc =~ s/\s+$//;
|
||||
$desc .= '.' unless($desc =~ /(?:^|\.)$/);
|
||||
$docs .= "\@var $cpp_enum_name ${param}\n\u${desc}\n\n"; # \u = Convert next char to uppercase
|
||||
}
|
||||
}
|
||||
|
||||
# Replace @newin in the enum description, but don't in the element descriptions.
|
||||
my $description = "\@enum $cpp_enum_name\n";
|
||||
$description .= $$objFunction{description};
|
||||
DocsParser::convert_docs_to_cpp($c_enum_name, \$description);
|
||||
DocsParser::replace_or_add_newin(\$description, $newin);
|
||||
|
||||
# Add note about deprecation if we have specified that in our _WRAP_ENUM(),
|
||||
# _WRAP_ENUM_DOCS_ONLY() or _WRAP_GERROR() call:
|
||||
if($deprecation_docs ne "")
|
||||
{
|
||||
$description .= "\n\@deprecated $deprecation_docs\n";
|
||||
}
|
||||
|
||||
# Append the enum description docs.
|
||||
DocsParser::convert_docs_to_cpp($c_enum_name, \$docs);
|
||||
$docs .= "\n\n$description";
|
||||
DocsParser::add_m4_quotes(\$docs);
|
||||
|
||||
# Escape the space after "i.e." or "e.g." in the brief description.
|
||||
$docs =~ s/^([^.]*\b(?:i\.e\.|e\.g\.))\s/$1\\ /;
|
||||
|
||||
remove_example_code($c_enum_name, \$docs);
|
||||
|
||||
# Add indentation and an asterisk on all lines except the first.
|
||||
# $docs does not contain leading "/**" and trailing "*/".
|
||||
$docs =~ s/\n/\n${indent}\* /g;
|
||||
|
||||
return $docs;
|
||||
}
|
||||
|
||||
# $strCommentBlock lookup_documentation($strFunctionName, $deprecation_docs, $newin, $objCppfunc)
|
||||
# The final objCppfunc parameter is optional. If passed, it is used to
|
||||
# decide if the final C parameter should be omitted if the C++ method
|
||||
# has a slot parameter. It is also used for converting C parameter names to
|
||||
# C++ parameter names in the documentation, if they differ.
|
||||
sub lookup_documentation($$$;$)
|
||||
{
|
||||
my ($functionName, $deprecation_docs, $newin, $objCppfunc) = @_;
|
||||
|
||||
my $objFunction = $DocsParser::hasharrayFunctions{$functionName};
|
||||
if(!$objFunction)
|
||||
{
|
||||
#print "DocsParser.pm: Warning: function not found: $functionName\n";
|
||||
return ""
|
||||
}
|
||||
|
||||
my $text = $$objFunction{description};
|
||||
|
||||
if(length($text) eq 0)
|
||||
{
|
||||
print "DocsParser.pm: Warning: No C docs for: \"$functionName\"\n";
|
||||
}
|
||||
|
||||
DocsParser::convert_docs_to_cpp($functionName, \$text);
|
||||
DocsParser::replace_or_add_newin(\$text, $newin);
|
||||
# A blank line, marking the end of a paragraph, is needed after @newin.
|
||||
# Most @newins are at the end of a function description.
|
||||
$text .= "\n";
|
||||
|
||||
# Add note about deprecation if we have specified that in our _WRAP_METHOD(),
|
||||
# _WRAP_SIGNAL(), _WRAP_PROPERTY() or _WRAP_CHILD_PROPERTY() call:
|
||||
if($deprecation_docs ne "")
|
||||
{
|
||||
$text .= "\n\@deprecated $deprecation_docs\n";
|
||||
}
|
||||
|
||||
my %param_name_mappings = DocsParser::append_parameter_docs($objFunction, \$text, $objCppfunc);
|
||||
DocsParser::append_return_docs($objFunction, \$text);
|
||||
|
||||
# Convert C parameter names to C++ parameter names where they differ.
|
||||
foreach my $key (keys %param_name_mappings)
|
||||
{
|
||||
$text =~ s/\@(param|a) $key\b/\@$1 $param_name_mappings{$key}/g;
|
||||
}
|
||||
|
||||
# Remove leading and trailing white space.
|
||||
$text = string_trim($text);
|
||||
|
||||
DocsParser::add_m4_quotes(\$text);
|
||||
|
||||
# Escape the space after "i.e." or "e.g." in the brief description.
|
||||
$text =~ s/^([^.]*\b(?:i\.e\.|e\.g\.))\s/$1\\ /;
|
||||
|
||||
remove_example_code($functionName, \$text);
|
||||
|
||||
# Convert to Doxygen-style comment.
|
||||
$text =~ s/\n/\n${DocsParser::commentMiddleStart}/g;
|
||||
$text = $DocsParser::commentStart . $text;
|
||||
$text .= "\n${DocsParser::commentEnd}\n";
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
# void convert_value_to_cpp(\$text)
|
||||
# Converts e.g. a property's default value.
|
||||
sub convert_value_to_cpp($)
|
||||
{
|
||||
my ($text) = @_;
|
||||
|
||||
$$text =~ s"\bFALSE\b"<tt>false</tt>"g;
|
||||
$$text =~ s"\bTRUE\b"<tt>true</tt>"g;
|
||||
$$text =~ s"\bNULL\b"<tt>nullptr</tt>"g;
|
||||
|
||||
# Enumerator names
|
||||
$$text =~ s/\b([A-Z]+)_([A-Z\d_]+)\b/&DocsParser::substitute_enumerator_name($1, $2)/eg;
|
||||
}
|
||||
|
||||
# void remove_example_code($obj_name, \$text)
|
||||
# Removes example code from the text of docs (passed by reference).
|
||||
sub remove_example_code($$)
|
||||
{
|
||||
my ($obj_name, $text) = @_;
|
||||
|
||||
# Remove C example code.
|
||||
my $example_removals =
|
||||
($$text =~ s"<informalexample>.*?</informalexample>"[C example ellipted]"sg);
|
||||
$example_removals +=
|
||||
($$text =~ s"<programlisting>.*?</programlisting>"\n[C example ellipted]"sg);
|
||||
$example_removals += ($$text =~ s"\|\[.*?]\|"\n[C example ellipted]"sg);
|
||||
|
||||
# See "MS Visual Studio" comment in gmmproc.in.
|
||||
print STDERR "gmmproc, $main::source, $obj_name: Example code discarded.\n"
|
||||
if ($example_removals);
|
||||
}
|
||||
|
||||
sub add_m4_quotes($)
|
||||
{
|
||||
my ($text) = @_;
|
||||
|
||||
# __BT__ and __FT__ are M4 macros defined in the base.m4 file that produce
|
||||
# a "`" and a "'" resp. without M4 errors.
|
||||
my %m4_quotes = (
|
||||
"`" => "'__BT__`",
|
||||
"'" => "'__FT__`",
|
||||
);
|
||||
|
||||
$$text =~ s/([`'])/$m4_quotes{$1}/g;
|
||||
$$text = "`" . $$text . "'";
|
||||
}
|
||||
|
||||
# The final objCppfunc is optional. If passed, it is used to determine
|
||||
# if the final C parameter should be omitted if the C++ method has a
|
||||
# slot parameter. It is also used for converting C parameter names to
|
||||
# C++ parameter names in the documentation, if they differ.
|
||||
sub append_parameter_docs($$;$)
|
||||
{
|
||||
my ($obj_function, $text, $objCppfunc) = @_;
|
||||
|
||||
my @docs_param_names = @{$$obj_function{param_names}};
|
||||
my $param_descriptions = \$$obj_function{param_descriptions};
|
||||
my $defs_method = GtkDefs::lookup_method_dont_mark($$obj_function{name});
|
||||
my @c_param_names = $defs_method ? @{$$defs_method{param_names}} : @docs_param_names;
|
||||
|
||||
# The information in
|
||||
# $obj_function comes from the docs.xml file,
|
||||
# $objCppfunc comes from _WRAP_METHOD() or _WRAP_SIGNAL() in the .hg file,
|
||||
# $defs_method comes from the methods.defs file.
|
||||
|
||||
# Ideally @docs_param_names and @c_param_names are identical.
|
||||
# In the real world the parameters in the C documentation are sometimes not
|
||||
# listed in the same order as the arguments in the C function declaration.
|
||||
# We try to handle that case to some extent. If no argument name is misspelt
|
||||
# in either the docs or the C function declaration, it usually succeeds for
|
||||
# methods, but not for signals. For signals there is no C function declaration
|
||||
# to compare with. If the docs of some method or signal get badly distorted
|
||||
# due to imperfections in the C docs, and it's difficult to get the C docs
|
||||
# corrected, correct docs can be added to the docs_override.xml file.
|
||||
|
||||
# Skip first param if this is a signal.
|
||||
if ($$obj_function{name} =~ /\w+::/)
|
||||
{
|
||||
shift(@docs_param_names);
|
||||
shift(@c_param_names);
|
||||
}
|
||||
# Skip first parameter if this is a non-static method.
|
||||
elsif (defined($objCppfunc))
|
||||
{
|
||||
if (!$$objCppfunc{static})
|
||||
{
|
||||
shift(@docs_param_names);
|
||||
shift(@c_param_names);
|
||||
}
|
||||
}
|
||||
# The second alternative is for use with method-mappings meaning:
|
||||
# this function is mapped into this Gtk::class.
|
||||
elsif (($defs_method && $$defs_method{class} ne "") ||
|
||||
$$obj_function{mapped_class} ne "")
|
||||
{
|
||||
shift(@docs_param_names);
|
||||
shift(@c_param_names);
|
||||
}
|
||||
|
||||
|
||||
# Skip the last param if there is a slot because it would be a
|
||||
# gpointer user_data parameter.
|
||||
if (defined($objCppfunc) && $$objCppfunc{slot_name})
|
||||
{
|
||||
pop(@docs_param_names);
|
||||
pop(@c_param_names);
|
||||
}
|
||||
|
||||
# Skip the last param if it's an error output param.
|
||||
if (scalar @docs_param_names && $docs_param_names[-1] eq "error")
|
||||
{
|
||||
pop(@docs_param_names);
|
||||
pop(@c_param_names);
|
||||
}
|
||||
|
||||
my $cpp_param_names;
|
||||
my $param_mappings;
|
||||
my $out_param_index = 1000; # No method has that many arguments, hopefully.
|
||||
if (defined($objCppfunc))
|
||||
{
|
||||
$cpp_param_names = $$objCppfunc{param_names};
|
||||
$param_mappings = $$objCppfunc{param_mappings}; # C name -> C++ index
|
||||
if (exists $$param_mappings{OUT})
|
||||
{
|
||||
$out_param_index = $$param_mappings{OUT};
|
||||
}
|
||||
}
|
||||
my %param_name_mappings; # C name -> C++ name
|
||||
|
||||
for (my $i = 0; $i < @docs_param_names; ++$i)
|
||||
{
|
||||
my $param = $docs_param_names[$i];
|
||||
my $desc = $$param_descriptions->{$param};
|
||||
my $param_without_trailing_underscore = $param;
|
||||
$param_without_trailing_underscore =~ s/([a-zA-Z0-9]*(_[a-zA-Z0-9]+)*)_?/$1/g;
|
||||
|
||||
if (defined($objCppfunc))
|
||||
{
|
||||
# If the C++ name is not equal to the C name, mark that the name
|
||||
# shall be changed in the documentation.
|
||||
my $cpp_name = $param;
|
||||
if (exists $$param_mappings{$param})
|
||||
{
|
||||
# Rename and/or reorder declaration ({c_name} or {.}) in _WRAP_*().
|
||||
$cpp_name = $$cpp_param_names[$$param_mappings{$param}];
|
||||
}
|
||||
elsif ($c_param_names[$i] eq $param)
|
||||
{
|
||||
# Location in docs coincides with location in C declaration.
|
||||
my $cpp_index = $i;
|
||||
$cpp_index++ if ($i >= $out_param_index);
|
||||
$cpp_name = $$cpp_param_names[$cpp_index];
|
||||
}
|
||||
else
|
||||
{
|
||||
# Search for the param in the C declaration.
|
||||
for (my $j = 0; $j < @c_param_names; ++$j)
|
||||
{
|
||||
if ($c_param_names[$j] eq $param)
|
||||
{
|
||||
my $cpp_index = $j;
|
||||
$cpp_index++ if ($j >= $out_param_index);
|
||||
$cpp_name = $$cpp_param_names[$cpp_index];
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($cpp_name ne $param)
|
||||
{
|
||||
$param_name_mappings{$param_without_trailing_underscore} = $cpp_name;
|
||||
}
|
||||
}
|
||||
elsif ($param eq "callback")
|
||||
{
|
||||
# Deal with callback parameters converting the docs to a slot
|
||||
# compatible format.
|
||||
$param_name_mappings{$param} = "slot";
|
||||
}
|
||||
|
||||
DocsParser::convert_docs_to_cpp($$obj_function{name}, \$desc);
|
||||
if(length($desc) > 0)
|
||||
{
|
||||
$desc .= '.' unless($desc =~ /(?:^|\.)$/);
|
||||
$$text .= "\n\@param ${param_without_trailing_underscore} \u${desc}";
|
||||
}
|
||||
}
|
||||
return %param_name_mappings;
|
||||
}
|
||||
|
||||
|
||||
sub append_return_docs($$)
|
||||
{
|
||||
my ($obj_function, $text) = @_;
|
||||
|
||||
my $desc = $$obj_function{return_description};
|
||||
DocsParser::convert_docs_to_cpp($$obj_function{name}, \$desc);
|
||||
|
||||
$desc =~ s/\.$//;
|
||||
$$text .= "\n\@return \u${desc}." unless($desc eq "");
|
||||
}
|
||||
|
||||
|
||||
sub convert_docs_to_cpp($$)
|
||||
{
|
||||
my ($doc_func, $text) = @_;
|
||||
|
||||
# Chop off leading and trailing whitespace.
|
||||
$$text =~ s/^\s+//;
|
||||
$$text =~ s/\s+$//;
|
||||
|
||||
# Convert C documentation to C++.
|
||||
DocsParser::remove_c_memory_handling_info($text);
|
||||
DocsParser::convert_tags_to_doxygen($text);
|
||||
DocsParser::substitute_identifiers($doc_func, $text);
|
||||
|
||||
$$text =~ s/\bX\s+Window\b/X \%Window/g;
|
||||
$$text =~ s/\bWindow\s+manager/\%Window manager/g;
|
||||
}
|
||||
|
||||
sub remove_c_memory_handling_info($)
|
||||
{
|
||||
my ($text) = @_;
|
||||
|
||||
# These C memory handling functions are removed, in most cases:
|
||||
# g_free, g_strfreev, g_list_free, g_slist_free
|
||||
my $mem_funcs = '\\bg_(?:free|strfreev|s?list_free)\\b';
|
||||
|
||||
return if ($$text !~ /$mem_funcs/);
|
||||
|
||||
# The text contains $mem_funcs. That's usually not relevant to C++ programmers.
|
||||
# Try to remove irrelevant text without removing too much.
|
||||
|
||||
# This function is called separately for the description of each method,
|
||||
# parameter and return value. Let's assume that only one removal is necessary.
|
||||
|
||||
# Don't modify the text, if $mem_funcs is part of example code.
|
||||
# remove_c_memory_handling_info() is called before remove_example_code().
|
||||
return if ($$text =~ m"(?:<informalexample>|<programlisting>|\|\[).*?$mem_funcs.*?(?:</informalexample>|</programlisting>|]\|)"s);
|
||||
|
||||
# First try to remove the sentence containing $mem_funcs.
|
||||
# For simplicity, assume that a sentence is any string ending with a period.
|
||||
my $tmp = $$text;
|
||||
if ($tmp =~ s/[^.]*$mem_funcs.*?(?:\.|$)//s)
|
||||
{
|
||||
if ($tmp =~ /\w/)
|
||||
{
|
||||
# A sentence contains $mem_funcs, and it's not the only sentence in the text.
|
||||
# Remove that sentence.
|
||||
$$text = $tmp;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$tmp = $$text;
|
||||
if ($tmp =~ s/[^.,]*$mem_funcs.*?(?:\.|,|$)//s)
|
||||
{
|
||||
if ($tmp =~ /\w/)
|
||||
{
|
||||
# A clause, delimited by comma or period, contains $mem_funcs,
|
||||
# and it's not the only clause in the text. Remove that clause.
|
||||
$tmp =~ s/,\s*$/./;
|
||||
$$text = $tmp;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# Last attempt. If this doesn't remove anything, don't modify the text.
|
||||
$$text =~ s/ that (?:must|should) be freed with g_free(?:\(\))?//;
|
||||
}
|
||||
|
||||
sub convert_tags_to_doxygen($)
|
||||
{
|
||||
my ($text) = @_;
|
||||
|
||||
for($$text)
|
||||
{
|
||||
# Replace format tags.
|
||||
s"<(/?)(?:emphasis|replaceable)>"<$1em>"g;
|
||||
s"<(/?)(?:constant|envar|filename|function|guimenuitem|literal|option|structfield|varname)>"<$1tt>"g;
|
||||
|
||||
# Some argument names are suffixed by "_" -- strip this.
|
||||
# gtk-doc uses @thearg, but doxygen uses @a thearg.
|
||||
s" ?\@([a-zA-Z0-9]*(_[a-zA-Z0-9]+)*)_?\b" \@a $1"g;
|
||||
|
||||
# Don't convert Doxygen's $throw, @throws and @param, so these can be used
|
||||
# in the docs_override.xml.
|
||||
# Also don't convert @enum and @var which are used for enum documentation.
|
||||
s" \@a (throws?|param|enum|var)\b" \@$1"g;
|
||||
|
||||
s"^Note ?\d?: "\@note "mg;
|
||||
s"</?programlisting>""g;
|
||||
s"<!>""g;
|
||||
|
||||
# Remove all link tags.
|
||||
s"</?u?link[^&]*?>""g;
|
||||
|
||||
# Remove all para tags and simpara tags (simple paragraph).
|
||||
s"</?(sim)?para>""g;
|
||||
|
||||
# Convert <simplelist>, <itemizedlist> and <variablelist> to something that
|
||||
# Doxygen understands.
|
||||
s"<simplelist>\n?(.*?)</simplelist>\n?"&DocsParser::convert_simplelist($1)"esg;
|
||||
s"<itemizedlist>\n?(.*?)</itemizedlist>\n?"&DocsParser::convert_itemizedlist($1)"esg;
|
||||
s"<variablelist>\n?(.*?)</variablelist>\n?"&DocsParser::convert_variablelist($1)"esg;
|
||||
|
||||
# Use our Doxygen @newin alias.
|
||||
# Accept "Since" with or without a following colon.
|
||||
# Require the Since clause to be
|
||||
# - at the end of the string,
|
||||
# - at the end of a line and followed by a blank line, or
|
||||
# - followed by "Deprecated".
|
||||
# If none of these requirements is met, "Since" may be embedded inside
|
||||
# a function description, referring to only a part of the description.
|
||||
# See e.g. g_date_time_format() and gdk_cursor_new_from_pixbuf().
|
||||
# Doxygen assumes that @newin is followed by a paragraph that describes
|
||||
# what is new, but we don't use it that way.
|
||||
my $first_part = '\bSince[:\h]\h*(\d+)\.(\d+)'; # \h == [\t ] (horizontal whitespace)
|
||||
my $last_part = '\.?(\s*$|\h*\n\h*\n|\s+Deprecated)';
|
||||
s/$first_part\.(\d+)$last_part/\@newin{$1,$2,$3}$4/g;
|
||||
s/$first_part$last_part/\@newin{$1,$2}$3/g;
|
||||
|
||||
# Doxygen is too dumb to handle —
|
||||
s"—" \@htmlonly—\@endhtmlonly "g;
|
||||
|
||||
s"\%?\bFALSE\b"<tt>false</tt>"g;
|
||||
s"\%?\bTRUE\b"<tt>true</tt>"g;
|
||||
s"\%?\bNULL\b"<tt>nullptr</tt>"g;
|
||||
|
||||
s"#?\bgboolean\b"<tt>bool</tt>"g;
|
||||
s"#?\bg(int|short|long)\b"<tt>$1</tt>"g;
|
||||
s"#?\bgu(int|short|long)\b"<tt>unsigned $1</tt>"g;
|
||||
|
||||
# Escape all backslashes, except in \throw, \throws and \param, which can
|
||||
# be Doxygen commands in the docs_override.xml.
|
||||
s"\\"\\\\"g;
|
||||
s"\\\\(throws?|param)\b"\\$1"g
|
||||
}
|
||||
}
|
||||
|
||||
# void replace_or_add_newin(\$text, $newin)
|
||||
# If $newin is not empty, replace the version numbers in an existing @newin
|
||||
# Doxygen alias, or add one if there is none.
|
||||
sub replace_or_add_newin($$)
|
||||
{
|
||||
my ($text, $newin) = @_;
|
||||
|
||||
return if ($newin eq "");
|
||||
|
||||
if (!($$text =~ s/\@newin\{[\d,]+\}/\@newin{$newin}/))
|
||||
{
|
||||
$$text .= "\n\n\@newin{$newin}";
|
||||
}
|
||||
}
|
||||
|
||||
# Convert <simplelist> tags to a list of newline-separated elements.
|
||||
sub convert_simplelist($)
|
||||
{
|
||||
my ($text) = @_;
|
||||
|
||||
$text =~ s"<member>(.*?)(\n?)</member>(\n?)"$1<br>\n"sg;
|
||||
return "<br>\n" . $text . "<br>\n";
|
||||
}
|
||||
|
||||
# Convert <itemizedlist> tags to Doxygen format.
|
||||
sub convert_itemizedlist($)
|
||||
{
|
||||
my ($text) = @_;
|
||||
|
||||
$text =~ s"<listitem>(.*?)(\n?)</listitem>(\n?)"- $1\n"sg;
|
||||
return $text;
|
||||
}
|
||||
|
||||
# Convert <variablelist> tags to an HTML definition list.
|
||||
sub convert_variablelist($)
|
||||
{
|
||||
my ($text) = @_;
|
||||
|
||||
$text =~ s"</?varlistentry>\n?""g;
|
||||
$text =~ s"<(/?)term>"<$1dt>"g;
|
||||
$text =~ s"<(/?)listitem>"<$1dd>"g;
|
||||
return "<dl>\n" . $text . "</dl>\n";
|
||||
}
|
||||
|
||||
sub substitute_identifiers($$)
|
||||
{
|
||||
my ($doc_func, $text) = @_;
|
||||
|
||||
for($$text)
|
||||
{
|
||||
# TODO: handle more than one namespace
|
||||
|
||||
# Convert property names to C++.
|
||||
# The standard (and correct) gtk-doc way of referring to properties.
|
||||
s/(#[A-Z]\w+):([a-z\d-]+)/my $name = "$1::property_$2()"; $name =~ s"-"_"g; "$name";/ge;
|
||||
# This is an incorrect format but widely used so correctly treat as a
|
||||
# property.
|
||||
s/(\s)::([a-z\d-]+)(\s+property)/my $name = "$1property_$2()$3"; $name =~ s"-"_"g; "$name";/ge;
|
||||
# This one catches properties written in the gtk-doc block as for example
|
||||
# '#GtkActivatable::related-action property'. The correct way to write it
|
||||
# would be 'GtkActivatable:related-action' (with a single colon and not
|
||||
# two because the double colons are specifically for signals -- see the
|
||||
# gtk-doc docs:
|
||||
# http://developer.gnome.org/gtk-doc-manual/unstable/documenting_symbols.html.en)
|
||||
# but a few are written with the double colon in the gtk+ docs so this
|
||||
# protects against those errors.
|
||||
s/([A-Z]\w+)::([a-z\d-]+)(\s+property)/my $name = "$1::property_$2()$3"; $name =~ s"-"_"g; "$name";/ge;
|
||||
|
||||
# Convert signal names to C++.
|
||||
s/(^|\s)::([a-z\d-]+)(\(\))*([^:\w]|$)/my $name = "$1signal_$2()$4"; $name =~ s"-"_"g; "$name";/ge;
|
||||
s/(#[A-Z]\w+)::([a-z\d-]+)(\(\))*([^:\w]|$)/my $name = "$1::signal_$2()$4"; $name =~ s"-"_"g; "$name";/ge;
|
||||
|
||||
# Type names
|
||||
s/[#%]([A-Z][a-z]*)([A-Z][A-Za-z]+)\b/&DocsParser::substitute_type_name($1, $2)/eg;
|
||||
|
||||
# Enumerator names
|
||||
s/[#%]([A-Z]+)_([A-Z\d_]+)\b/&DocsParser::substitute_enumerator_name($1, $2)/eg;
|
||||
|
||||
s/\bG:://g; #Rename G::Something to Something.
|
||||
|
||||
# Substitute callback types to slot types.
|
||||
s/(\b\w+)Callback/Slot$1/g;
|
||||
|
||||
# Replace C function names with C++ counterparts.
|
||||
s/\b([a-z]+_[a-z][a-z\d_]+) ?\(\)/&DocsParser::substitute_function($doc_func, $1)/eg;
|
||||
}
|
||||
}
|
||||
|
||||
sub substitute_type_name($$)
|
||||
{
|
||||
my ($module, $name) = @_;
|
||||
my $c_name = $module . $name;
|
||||
|
||||
if (exists $DocsParser::type_names{$c_name})
|
||||
{
|
||||
return $DocsParser::type_names{$c_name};
|
||||
}
|
||||
#print "DocsParser.pm: Assuming the type $c_name shall become " . (($module eq "G") ? "" : "${module}::") . "$name.\n";
|
||||
return $module . "::" . $name;
|
||||
}
|
||||
|
||||
sub substitute_enumerator_name($$)
|
||||
{
|
||||
state $first_call = 1;
|
||||
state @sorted_keys;
|
||||
|
||||
my ($module, $name) = @_;
|
||||
my $c_name = $module . "_" . $name;
|
||||
|
||||
if (exists $DocsParser::enumerator_names{$c_name})
|
||||
{
|
||||
return $DocsParser::enumerator_names{$c_name};
|
||||
}
|
||||
|
||||
if ($first_call)
|
||||
{
|
||||
# Sort only once, on the first call.
|
||||
# "state @sorted_keys = ...;" is not possible. Only a scalar variable
|
||||
# can have a one-time assignment in its defining "state" statement.
|
||||
$first_call = 0;
|
||||
@sorted_keys = reverse sort keys(%DocsParser::enumerator_name_prefixes);
|
||||
}
|
||||
|
||||
# This is a linear search through the keys of %DocsParser::enumerator_name_prefixes.
|
||||
# It's inefficient if %DocsParser::enumerator_name_prefixes contains many values.
|
||||
#
|
||||
# If one key is part of another key (e.g. G_REGEX_MATCH_ and G_REGEX_),
|
||||
# search for a match against the longer key before the shorter key.
|
||||
foreach my $key (@sorted_keys)
|
||||
{
|
||||
if ($c_name =~ m/^$key/)
|
||||
{
|
||||
# $c_name begins with $key. Replace that part of $c_name with the C++ analogue.
|
||||
$c_name =~ s/^$key/$DocsParser::enumerator_name_prefixes{$key}/;
|
||||
return $c_name; # Now it's the C++ name.
|
||||
}
|
||||
}
|
||||
|
||||
# Don't apply the default substitution to these module names.
|
||||
# They are not really modules.
|
||||
if (grep {$module eq $_} qw(HAS NO O SO AF))
|
||||
{
|
||||
return $c_name;
|
||||
}
|
||||
|
||||
my $cxx_name = (($module eq "G") ? "" : (ucfirst(lc($module)) . "::")) . $name;
|
||||
|
||||
#print "DocsParser.pm: Assuming the enumerator $c_name shall become $cxx_name.\n";
|
||||
return $cxx_name;
|
||||
}
|
||||
|
||||
sub substitute_function($$)
|
||||
{
|
||||
my ($doc_func, $name) = @_;
|
||||
|
||||
if(my $defs_method = GtkDefs::lookup_method_dont_mark($name))
|
||||
{
|
||||
if(my $defs_object = DocsParser::lookup_object_of_method($$defs_method{class}, $name))
|
||||
{
|
||||
my $module = $$defs_object{module};
|
||||
my $class = $$defs_object{name};
|
||||
|
||||
DocsParser::build_method_name($doc_func, $module, $class, \$name);
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "Documentation: Class/Namespace for $name not found\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# Not perfect, but better than nothing.
|
||||
$name =~ s/^g_/Glib::/;
|
||||
}
|
||||
|
||||
return $name . "()";
|
||||
}
|
||||
|
||||
sub lookup_object_of_method($$)
|
||||
{
|
||||
my ($object, $name) = @_;
|
||||
|
||||
if($object ne "")
|
||||
{
|
||||
my $result = GtkDefs::lookup_object($object);
|
||||
|
||||
# We already know the C object name, because $name is a non-static method.
|
||||
if(defined($result) and ($result ne ""))
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
print "DocsParser.pm: lookup_object_of_method(): Warning: GtkDefs::lookup_object() failed for object name=" . $object . ", function name=" . $name . "\n";
|
||||
print " This may be a missing define-object in a *.defs file.\n"
|
||||
}
|
||||
}
|
||||
|
||||
my @parts = split(/_/, $name);
|
||||
pop(@parts);
|
||||
|
||||
# (gtk, foo, bar) -> (Gtk, Foo, Bar)
|
||||
foreach(@parts) { $_ = (length > 2) ? ucfirst : uc; }
|
||||
|
||||
# Do a bit of try'n'error.
|
||||
while($#parts >= 1)
|
||||
{
|
||||
my $try = join("", @parts);
|
||||
|
||||
if(my $defs_object = GtkDefs::lookup_object($try))
|
||||
{ return $defs_object; }
|
||||
|
||||
pop(@parts);
|
||||
}
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
||||
sub build_method_name($$$$)
|
||||
{
|
||||
my ($doc_func, $module, $class, $name) = @_;
|
||||
|
||||
my $prefix = $module . $class;
|
||||
|
||||
$prefix =~ s/([a-z])([A-Z])/$1_$2/g;
|
||||
$prefix = lc($prefix) . '_';
|
||||
|
||||
if($$name =~ m/^\Q$prefix\E/)
|
||||
{
|
||||
my $scope = "";
|
||||
$scope = "${module}::${class}::" unless($doc_func =~ m/^\Q$prefix\E/);
|
||||
|
||||
substr($$name, 0, length($prefix)) = $scope;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1; # indicate proper module load.
|
||||
327
squashfs-root/usr/lib/glibmm-2.4/proc/pm/Enum.pm
Normal file
327
squashfs-root/usr/lib/glibmm-2.4/proc/pm/Enum.pm
Normal file
@@ -0,0 +1,327 @@
|
||||
package Enum;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use DocsParser;
|
||||
|
||||
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 Enum
|
||||
# {
|
||||
# bool flags;
|
||||
# string type;
|
||||
# string module;
|
||||
# string c_type;
|
||||
#
|
||||
# string array elem_names;
|
||||
# string array elem_values;
|
||||
# string c_prefix;
|
||||
#
|
||||
# bool mark;
|
||||
# }
|
||||
|
||||
#
|
||||
# private functions:
|
||||
#
|
||||
|
||||
sub split_enum_tokens($)
|
||||
{
|
||||
my ($token_string) = @_;
|
||||
my @tokens = ();
|
||||
# index of first opening double quotes between parens - beginning of a new
|
||||
# token.
|
||||
my $begin_token = 0;
|
||||
# index of last closing double quotes between parens - end of a token.
|
||||
my $end_token = 0;
|
||||
# whether we are inside double quotes.
|
||||
my $inside_dquotes = 0;
|
||||
# whether we are inside double and then single quotes (for situations like
|
||||
# "'"'").
|
||||
my $inside_squotes = 0;
|
||||
my $len = length($token_string);
|
||||
# whether we found opening paren and we are expecting an opening double
|
||||
# quotes.
|
||||
my $near_begin = 0;
|
||||
# count of double quotes pairs between parens.
|
||||
my $dq_count = 0;
|
||||
# whether previous char was a backslash - important only when being between
|
||||
# double quotes.
|
||||
my $backslash = 0;
|
||||
for (my $index = 0; $index < $len; $index++)
|
||||
{
|
||||
my $char = substr($token_string, $index, 1);
|
||||
if ($inside_dquotes)
|
||||
{
|
||||
# if prevous char was backslash, then current char is not important -
|
||||
# we are still inside double or double/single quotes anyway.
|
||||
if ($backslash)
|
||||
{
|
||||
$backslash = 0;
|
||||
}
|
||||
# if current char is backslash.
|
||||
elsif ($char eq '\\')
|
||||
{
|
||||
$backslash = 1;
|
||||
}
|
||||
# if current char is unescaped double quotes and we are not inside single
|
||||
# ones - means, we are going outside string. We mark this place as an end
|
||||
# of the token in case we find a closing paren after this.
|
||||
elsif ($char eq '"' and not $inside_squotes)
|
||||
{
|
||||
$inside_dquotes = 0;
|
||||
$end_token = $index;
|
||||
}
|
||||
# if current char is single quote then switch being inside single quotes
|
||||
# state.
|
||||
elsif ($char eq '\'')
|
||||
{
|
||||
$inside_squotes = not $inside_squotes;
|
||||
}
|
||||
}
|
||||
# current char is opening paren - this means we are near the beginning of
|
||||
# a token (first double quotes after this paren).
|
||||
elsif ($char eq '(')
|
||||
{
|
||||
$near_begin = 1;
|
||||
}
|
||||
# current char is closing paren - this means we reached end of a token at
|
||||
# last closing double quotes.
|
||||
elsif ($char eq ')')
|
||||
{
|
||||
my $token_len = $end_token + 1 - $begin_token;
|
||||
my $token = substr($token_string, $begin_token, $token_len);
|
||||
# there should be three pairs of double quotes.
|
||||
if ($dq_count == 3)
|
||||
{
|
||||
push(@tokens, $token);
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "Wrong value statement while parsing ($token)\n";
|
||||
}
|
||||
$dq_count = 0;
|
||||
}
|
||||
# current char is opening double quotes - this can be a beginning of
|
||||
# a token.
|
||||
elsif ($char eq '"')
|
||||
{
|
||||
if ($near_begin)
|
||||
{
|
||||
$begin_token = $index;
|
||||
$near_begin = 0;
|
||||
}
|
||||
$inside_dquotes = 1;
|
||||
$dq_count++;
|
||||
}
|
||||
}
|
||||
return @tokens;
|
||||
}
|
||||
|
||||
#
|
||||
# end of private functions.
|
||||
#
|
||||
|
||||
sub new
|
||||
{
|
||||
my ($def) = @_;
|
||||
my $self = {};
|
||||
bless $self;
|
||||
|
||||
$def =~ s/^\(//;
|
||||
$def =~ s/\)$//;
|
||||
|
||||
$$self{mark} = 0;
|
||||
$$self{flags} = 0;
|
||||
$$self{c_prefix} = "";
|
||||
|
||||
$$self{elem_names} = [];
|
||||
$$self{elem_values} = [];
|
||||
|
||||
# snarf down the fields
|
||||
|
||||
if($def =~ s/^define-(enum|flags)-extended (\S+)//)
|
||||
{
|
||||
$$self{type} = $2;
|
||||
$$self{flags} = 1 if($1 eq "flags");
|
||||
}
|
||||
|
||||
$$self{module} = $1 if($def =~ s/\(in-module "(\S+)"\)//);
|
||||
$$self{c_type} = $1 if($def =~ s/\(c-name "(\S+)"\)//);
|
||||
|
||||
# values are compound lisp statement
|
||||
if($def =~ s/\(values((?: '\("\S+" "\S+" "[^"]+"\))*) \)//)
|
||||
{
|
||||
$self->parse_values($1);
|
||||
}
|
||||
|
||||
if($def !~ /^\s*$/)
|
||||
{
|
||||
GtkDefs::error("Unhandled enum def ($def) in $$self{module}\::$$self{type}\n")
|
||||
}
|
||||
|
||||
# this should never happen
|
||||
warn if(scalar(@{$$self{elem_names}}) != scalar(@{$$self{elem_values}}));
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub parse_values($$)
|
||||
{
|
||||
my ($self, $value) = @_;
|
||||
|
||||
my $elem_names = [];
|
||||
my $elem_values = [];
|
||||
my $common_prefix = undef;
|
||||
# break up the value statements - it works with parens inside double quotes
|
||||
# and handles triples like '("dq-token", "MY_SCANNER_DQ_TOKEN", "'"'").
|
||||
foreach (split_enum_tokens($value))
|
||||
{
|
||||
if (/^"\S+" "(\S+)" "(.+)"$/)
|
||||
{
|
||||
my ($name, $value) = ($1, $2);
|
||||
|
||||
# detect whether there is module prefix common to all names, e.g. GTK_
|
||||
my $prefix = $1 if ($name =~ /^([^_]+_)/);
|
||||
|
||||
if (not defined($common_prefix))
|
||||
{
|
||||
$common_prefix = $prefix;
|
||||
}
|
||||
elsif ($prefix ne $common_prefix)
|
||||
{
|
||||
$common_prefix = "";
|
||||
}
|
||||
|
||||
push(@$elem_names, $name);
|
||||
push(@$elem_values, $value);
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkDefs::error("Unknown value statement ($_) in $$self{c_type}\n");
|
||||
}
|
||||
}
|
||||
|
||||
if ($common_prefix)
|
||||
{
|
||||
# cut off the module prefix, e.g. GTK_
|
||||
s/^$common_prefix// foreach (@$elem_names);
|
||||
|
||||
# Save the common prefix.
|
||||
$$self{c_prefix} = $common_prefix;
|
||||
}
|
||||
|
||||
$$self{elem_names} = $elem_names;
|
||||
$$self{elem_values} = $elem_values;
|
||||
}
|
||||
|
||||
sub beautify_values($)
|
||||
{
|
||||
my ($self) = @_;
|
||||
|
||||
return if($$self{flags});
|
||||
|
||||
my $elem_names = $$self{elem_names};
|
||||
my $elem_values = $$self{elem_values};
|
||||
|
||||
my $num_elements = scalar(@$elem_values);
|
||||
return if($num_elements == 0);
|
||||
|
||||
my $first = $$elem_values[0];
|
||||
return if($first !~ /^-?[0-9]+$/);
|
||||
|
||||
my $prev = $first;
|
||||
|
||||
# Continuous? (Aliases to prior enum values are allowed.)
|
||||
foreach my $value (@$elem_values)
|
||||
{
|
||||
return if ($value =~ /[G-WY-Zg-wy-z_]/);
|
||||
return if(($value < $first) || ($value > $prev + 1));
|
||||
$prev = $value;
|
||||
}
|
||||
|
||||
# This point is reached only if the values are a continuous range.
|
||||
# 1) Let's kill all the superfluous values, for better readability.
|
||||
# 2) Substitute aliases to prior enum values.
|
||||
|
||||
my %aliases = ();
|
||||
|
||||
for(my $i = 0; $i < $num_elements; ++$i)
|
||||
{
|
||||
my $value = \$$elem_values[$i];
|
||||
my $alias = \$aliases{$$value};
|
||||
|
||||
if(defined($$alias))
|
||||
{
|
||||
$$value = $$alias;
|
||||
}
|
||||
else
|
||||
{
|
||||
$$alias = $$elem_names[$i];
|
||||
$$value = "" unless($first != 0 && $$value == $first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub build_element_list($$$$)
|
||||
{
|
||||
my ($self, $ref_subst_in, $ref_subst_out, $indent) = @_;
|
||||
|
||||
my $elem_names = $$self{elem_names};
|
||||
my $elem_values = $$self{elem_values};
|
||||
|
||||
my $num_elements = scalar(@$elem_names);
|
||||
my $elements = "";
|
||||
|
||||
for(my $i = 0; $i < $num_elements; ++$i)
|
||||
{
|
||||
my $name = $$elem_names[$i];
|
||||
my $value = $$elem_values[$i];
|
||||
|
||||
for(my $ii = 0; $ii < scalar(@$ref_subst_in); ++$ii)
|
||||
{
|
||||
$name =~ s/$$ref_subst_in[$ii]/$$ref_subst_out[$ii]/;
|
||||
$value =~ s/$$ref_subst_in[$ii]/$$ref_subst_out[$ii]/;
|
||||
}
|
||||
|
||||
# Skip this element, if its name has been deleted.
|
||||
next if($name eq "");
|
||||
|
||||
$elements .= ",\n" if($elements ne "");
|
||||
$elements .= "${indent}${name}";
|
||||
$elements .= " = ${value}" if($value ne "");
|
||||
}
|
||||
|
||||
return $elements;
|
||||
}
|
||||
|
||||
sub dump($)
|
||||
{
|
||||
my ($self) = @_;
|
||||
|
||||
print "<enum module=\"$$self{module}\" type=\"$$self{type}\" flags=$$self{flags}>\n";
|
||||
|
||||
my $elem_names = $$self{elem_names};
|
||||
my $elem_values = $$self{elem_values};
|
||||
|
||||
for(my $i = 0; $i < scalar(@$elem_names); ++$i)
|
||||
{
|
||||
print " <element name=\"$$elem_names[$i]\" value=\"$$elem_values[$i]\"/>\n";
|
||||
}
|
||||
|
||||
print "</enum>\n\n";
|
||||
}
|
||||
|
||||
1; # indicate proper module load.
|
||||
497
squashfs-root/usr/lib/glibmm-2.4/proc/pm/Function.pm
Normal file
497
squashfs-root/usr/lib/glibmm-2.4/proc/pm/Function.pm
Normal file
@@ -0,0 +1,497 @@
|
||||
package Function;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Util;
|
||||
use FunctionBase;
|
||||
|
||||
# These flags indicate whether parameters are optional or output parameters.
|
||||
use constant FLAG_PARAM_OPTIONAL => 1;
|
||||
use constant FLAG_PARAM_OUTPUT => 2;
|
||||
# These flags indicate how an empty string shall be translated to a C string:
|
||||
# to a nullptr or to a pointer to an empty string.
|
||||
use constant FLAG_PARAM_NULLPTR => 4;
|
||||
use constant FLAG_PARAM_EMPTY_STRING => 8;
|
||||
|
||||
BEGIN {
|
||||
use Exporter ();
|
||||
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
|
||||
|
||||
# set the version for version checking
|
||||
$VERSION = 1.00;
|
||||
@ISA = qw(FunctionBase);
|
||||
@EXPORT = qw(&func1 &func2 &func4);
|
||||
%EXPORT_TAGS = ( );
|
||||
# your exported package globals go here,
|
||||
# as well as any optionally exported functions
|
||||
@EXPORT_OK = qw($Var1 %Hashit &func3 FLAG_PARAM_OPTIONAL FLAG_PARAM_OUTPUT
|
||||
FLAG_PARAM_NULLPTR FLAG_PARAM_EMPTY_STRING);
|
||||
}
|
||||
our @EXPORT_OK;
|
||||
|
||||
##################################################
|
||||
### Function
|
||||
# Commonly used algorithm for parsing a function declaration into
|
||||
# its component pieces
|
||||
#
|
||||
# class Function : FunctionBase
|
||||
# {
|
||||
# string rettype;
|
||||
# bool const;
|
||||
# bool static;
|
||||
# string name; e.g. gtk_accelerator_valid
|
||||
# string c_name;
|
||||
# string array param_type;
|
||||
# string array param_name;
|
||||
# string array param_default_value;
|
||||
# int array param_flags; (stores flags form params: 1 => optional, 2 => output)
|
||||
# hash param_mappings; (maps C param names (if specified) to the C++ index)
|
||||
# string array possible_args_list; (a list of space separated indexes)
|
||||
# string in_module; e.g. Gtk
|
||||
# string signal_when. e.g. first, last, or both.
|
||||
# string class e.g. GtkButton ( == of-object. Useful for signal because their names are not unique.
|
||||
# string entity_type. e.g. method or signal
|
||||
# }
|
||||
|
||||
# Subroutine to get an array of string of indices representing the possible
|
||||
# combination of arguments based on whether some parameters are optional.
|
||||
sub possible_args_list($$);
|
||||
|
||||
sub new_empty()
|
||||
{
|
||||
my $self = {};
|
||||
bless $self;
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
# $objFunction new($function_declaration, $objWrapParser)
|
||||
sub new($$)
|
||||
{
|
||||
#Parse a function/method declaration.
|
||||
#e.g. guint gtk_something_set_thing(guint a, const gchar* something)
|
||||
|
||||
my ($line, $objWrapParser) = @_;
|
||||
|
||||
my $self = {};
|
||||
bless $self;
|
||||
|
||||
#Initialize member data:
|
||||
$$self{rettype} = "";
|
||||
$$self{rettype_needs_ref} = 0; #Often the gtk function doesn't do an extra ref for the receiver.
|
||||
$$self{const} = 0;
|
||||
$$self{name} = "";
|
||||
$$self{param_types} = [];
|
||||
$$self{param_names} = [];
|
||||
$$self{param_default_values} = [];
|
||||
$$self{param_flags} = [];
|
||||
$$self{param_mappings} = {};
|
||||
$$self{possible_args_list} = [];
|
||||
$$self{in_module} = "";
|
||||
$$self{class} = "";
|
||||
$$self{entity_type} = "method";
|
||||
|
||||
$line =~ s/^\s+//; # Remove leading whitespace.
|
||||
$line =~ s/\s+/ /g; # Compress white space.
|
||||
|
||||
if ($line =~ /^static\s+([^()]+)\s+(\S+)\s*\((.*)\)\s*$/)
|
||||
{
|
||||
$$self{rettype} = $1;
|
||||
$$self{name} = $2;
|
||||
$$self{c_name} = $2;
|
||||
$self->parse_param($3);
|
||||
$$self{static} = 1;
|
||||
}
|
||||
elsif ($line =~ /^([^()]+)\s+(\S+)\s*\((.*)\)\s*(const)*$/)
|
||||
{
|
||||
$$self{rettype} = $1;
|
||||
$$self{name} = $2;
|
||||
$$self{c_name} = $2;
|
||||
$self->parse_param($3);
|
||||
$$self{const} = defined($4);
|
||||
}
|
||||
else
|
||||
{
|
||||
$objWrapParser->error("fail to parse $line\n");
|
||||
}
|
||||
|
||||
# Store the list of possible argument combinations based on if arguments
|
||||
# are optional.
|
||||
my $possible_args_list = $$self{possible_args_list};
|
||||
push(@$possible_args_list, $self->possible_args_list());
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
||||
# $objFunction new_ctor($function_declaration, $objWrapParser)
|
||||
# Like new(), but the function_declaration doesn't need a return type.
|
||||
sub new_ctor($$)
|
||||
{
|
||||
#Parse a function/method declaration.
|
||||
#e.g. guint gtk_something_set_thing(guint a, const gchar* something)
|
||||
|
||||
my ($line, $objWrapParser) = @_;
|
||||
|
||||
my $self = {};
|
||||
bless $self;
|
||||
|
||||
#Initialize member data:
|
||||
$$self{rettype} = "";
|
||||
$$self{rettype_needs_ref} = 0;
|
||||
$$self{const} = 0;
|
||||
$$self{name} = "";
|
||||
$$self{param_types} = [];
|
||||
$$self{param_names} = [];
|
||||
$$self{param_default_values} = [];
|
||||
$$self{param_flags} = [];
|
||||
$$self{param_mappings} = {};
|
||||
$$self{possible_args_list} = [];
|
||||
$$self{in_module} = "";
|
||||
$$self{class} = "";
|
||||
$$self{entity_type} = "method";
|
||||
|
||||
$line =~ s/^\s+//; # Remove leading whitespace.
|
||||
$line =~ s/\s+/ /g; # Compress white space.
|
||||
|
||||
if ($line =~ /^(\S+)\s*\((.*)\)\s*/)
|
||||
{
|
||||
$$self{name} = $1;
|
||||
$$self{c_name} = $1;
|
||||
$self->parse_param($2);
|
||||
}
|
||||
else
|
||||
{
|
||||
$objWrapParser->error("fail to parse $line\n");
|
||||
}
|
||||
|
||||
# Store the list of possible argument combinations based on if arguments
|
||||
# are optional.
|
||||
my $possible_args_list = $$self{possible_args_list};
|
||||
push(@$possible_args_list, $self->possible_args_list());
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
# $num num_args()
|
||||
sub num_args #($)
|
||||
{
|
||||
my ($self) = @_;
|
||||
my $param_types = $$self{param_types};
|
||||
return $#$param_types+1;
|
||||
}
|
||||
|
||||
# parses C++ parameter lists.
|
||||
# forms a list of types, names, and default values
|
||||
sub parse_param($$)
|
||||
{
|
||||
my ($self, $line) = @_;
|
||||
|
||||
my $type = "";
|
||||
my $name = "";
|
||||
my $name_pos = -1;
|
||||
my $value = "";
|
||||
my $id = 0;
|
||||
my $has_value = 0;
|
||||
my $flags = 0;
|
||||
my $curr_param = 0;
|
||||
|
||||
my $param_types = $$self{param_types};
|
||||
my $param_names = $$self{param_names};
|
||||
my $param_default_values = $$self{param_default_values};
|
||||
my $param_flags = $$self{param_flags};
|
||||
my $param_mappings = $$self{param_mappings};
|
||||
|
||||
# Mappings from a C name to this C++ param defaults to empty (no mapping).
|
||||
my $mapping = "";
|
||||
|
||||
# clean up space and handle empty case
|
||||
$line = string_trim($line);
|
||||
$line =~ s/\s+/ /g; # Compress whitespace.
|
||||
return if ($line =~ /^$/);
|
||||
|
||||
# Add a ',' at the end. No special treatment of the last parameter is necessary,
|
||||
# if it's followed by a comma, like the other parameters.
|
||||
$line .= ',' if (substr($line, -1) ne ',');
|
||||
|
||||
# Parse through the argument list.
|
||||
#
|
||||
# We must find commas (,) that separate parameters, and equal signs (=) that
|
||||
# separate parameter names from optional default values.
|
||||
# '&', '*' and '>' are delimiters in split() because they must be separated
|
||||
# from the parameter name even if there is no space char between.
|
||||
# Commas within "<.,.>" or "{.,.}" or "(.,.)" do not end a parameter.
|
||||
# This parsing is not guaranteed to work well if there are several levels
|
||||
# of (()) or {{}}. X<Y<Z>> works in the normal case where there is nothing
|
||||
# but possibly spaces between the multiple ">>".
|
||||
# Quoted strings are not detected. If a quoted string exists in a function
|
||||
# prototype, it's probably as part of a default value, inside ("x") or {"y"}.
|
||||
#
|
||||
my @str = ();
|
||||
foreach (split(/(\bconst\b|[,=&*>]|<.*?>|{.*?}|\(.*?\)|\s+)/, $line))
|
||||
{
|
||||
next if ( !defined($_) or $_ eq "" );
|
||||
|
||||
if ($_ =~ /^(?:const|[*&>]|<.*>|\(.*\)|\s+)$/)
|
||||
{
|
||||
# Any separator, except ',' or '=' or {.*}.
|
||||
push(@str, $_);
|
||||
next;
|
||||
}
|
||||
elsif ($_ =~ /^{(.*)}$/)
|
||||
{
|
||||
if (!$has_value)
|
||||
{
|
||||
# gmmproc options have been specified for the current parameter so
|
||||
# process them.
|
||||
|
||||
# Get the options.
|
||||
my $options = $1;
|
||||
|
||||
# Check if param should be optional or an output param.
|
||||
$flags = FLAG_PARAM_OPTIONAL if($options =~ /\?/);
|
||||
$flags |= FLAG_PARAM_OUTPUT if($options =~ />>/);
|
||||
|
||||
# Delete "NULL" from $options, so it won't be interpreted as a parameter name.
|
||||
if ($options =~ s/(!?\bNULL\b)//)
|
||||
{
|
||||
$flags |= ($1 eq "!NULL") ? FLAG_PARAM_EMPTY_STRING : FLAG_PARAM_NULLPTR;
|
||||
}
|
||||
|
||||
# Check if it should be mapped to a C param.
|
||||
if ($options =~ /(\w+|\.)/)
|
||||
{
|
||||
$mapping = $1;
|
||||
$mapping = $name if($mapping eq ".");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# {...} in a default value.
|
||||
push(@str, $_);
|
||||
}
|
||||
next;
|
||||
}
|
||||
elsif ( $_ eq "=" ) #Default value
|
||||
{
|
||||
$str[$name_pos] = "" if ($name_pos >= 0);
|
||||
# The type is everything before the = character, except the parameter name.
|
||||
$type = join("", @str);
|
||||
@str = (); #Wipe it so that it will only contain the default value, which comes next.
|
||||
$has_value = 1;
|
||||
next;
|
||||
}
|
||||
elsif ( $_ eq "," ) #The end of one parameter:
|
||||
{
|
||||
if ($has_value)
|
||||
{
|
||||
$value = join("", @str); # If there's a default value, then it's the part before the next ",".
|
||||
}
|
||||
else
|
||||
{
|
||||
$str[$name_pos] = "" if ($name_pos >= 0);
|
||||
$type = join("", @str);
|
||||
}
|
||||
|
||||
if ($name eq "")
|
||||
{
|
||||
$name = sprintf("p%s", $#$param_types + 2)
|
||||
}
|
||||
|
||||
$type = string_trim($type);
|
||||
|
||||
push(@$param_types, $type);
|
||||
push(@$param_names, $name);
|
||||
push(@$param_default_values, $value);
|
||||
push(@$param_flags, $flags);
|
||||
|
||||
# Map from the c_name to the C++ index (no map if no name given).
|
||||
$$param_mappings{$mapping} = $curr_param if($mapping);
|
||||
|
||||
#Clear variables, ready for the next parameter.
|
||||
@str = ();
|
||||
$type= "";
|
||||
$value = "";
|
||||
$has_value = 0;
|
||||
$name = "";
|
||||
$name_pos = -1;
|
||||
$flags = 0;
|
||||
$curr_param++;
|
||||
|
||||
# Mappings from a C name to this C++ param defaults to empty (no mapping).
|
||||
$mapping = "";
|
||||
|
||||
$id = 0;
|
||||
next;
|
||||
}
|
||||
|
||||
# Anything but a separator in split().
|
||||
push(@str, $_);
|
||||
|
||||
if (!$has_value)
|
||||
{
|
||||
# The last identifier before ',', '=', or '{.*}' is the parameter name.
|
||||
# E.g. int name, unsigned long int name = 42, const unsigned int& name.
|
||||
# The name must be preceded by at least one other identifier (the type).
|
||||
# 'const' is treated specially, as it can't by itself denote the type.
|
||||
$id++;
|
||||
if ($id >= 2)
|
||||
{
|
||||
$name = $_;
|
||||
$name_pos = $#str;
|
||||
}
|
||||
}
|
||||
} # end foreach
|
||||
}
|
||||
|
||||
# add_parameter_autoname($, $type, $name)
|
||||
# Adds e.g "sometype somename"
|
||||
sub add_parameter_autoname($$)
|
||||
{
|
||||
my ($self, $type) = @_;
|
||||
|
||||
add_parameter($self, $type, "");
|
||||
}
|
||||
|
||||
# add_parameter($, $type, $name)
|
||||
# Adds e.g GtkSomething* p1"
|
||||
sub add_parameter($$$)
|
||||
{
|
||||
my ($self, $type, $name) = @_;
|
||||
$type = string_unquote($type);
|
||||
$type =~ s/-/ /g;
|
||||
|
||||
my $param_names = $$self{param_names};
|
||||
|
||||
if ($name eq "")
|
||||
{
|
||||
$name = sprintf("p%s", $#$param_names + 2);
|
||||
}
|
||||
|
||||
push(@$param_names, $name);
|
||||
|
||||
my $param_types = $$self{param_types};
|
||||
push(@$param_types, $type);
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
# $string get_refdoc_comment($existing_signal_docs, $signal_flags)
|
||||
# Generate a readable prototype for signals and merge the prototype into the
|
||||
# existing Doxygen comment block.
|
||||
sub get_refdoc_comment($$$)
|
||||
{
|
||||
my ($self, $documentation, $signal_flags) = @_;
|
||||
|
||||
my $str = " /**\n";
|
||||
|
||||
$str .= " * \@par Slot Prototype:\n";
|
||||
$str .= " * <tt>$$self{rettype} on_my_\%$$self{name}(";
|
||||
|
||||
my $param_names = $$self{param_names};
|
||||
my $param_types = $$self{param_types};
|
||||
my $num_params = scalar(@$param_types);
|
||||
|
||||
# List the parameters:
|
||||
for(my $i = 0; $i < $num_params; ++$i)
|
||||
{
|
||||
$str .= $$param_types[$i] . ' ' . $$param_names[$i];
|
||||
$str .= ", " if($i < $num_params - 1);
|
||||
}
|
||||
|
||||
$str .= ")</tt>\n";
|
||||
$str .= " *\n";
|
||||
|
||||
if ($signal_flags)
|
||||
{
|
||||
$str .= " * Flags: $signal_flags\n *\n";
|
||||
}
|
||||
|
||||
if($documentation ne "")
|
||||
{
|
||||
# Remove the initial '/** ' from the existing docs and merge it.
|
||||
$documentation =~ s/\/\*\*\s+/ \* /;
|
||||
$str .= $documentation;
|
||||
}
|
||||
else
|
||||
{
|
||||
# Close the doc block if there's no existing docs.
|
||||
$str .= " */\n";
|
||||
}
|
||||
|
||||
# Return the merged documentation.
|
||||
return $str;
|
||||
}
|
||||
|
||||
sub get_is_const($)
|
||||
{
|
||||
my ($self) = @_;
|
||||
|
||||
return $$self{const};
|
||||
}
|
||||
|
||||
# string array possible_args_list()
|
||||
# Returns an array of string of space separated indexes representing the
|
||||
# possible argument combinations based on whether parameters are optional.
|
||||
sub possible_args_list($$)
|
||||
{
|
||||
my ($self, $start_index) = @_;
|
||||
|
||||
my $param_names = $$self{param_names};
|
||||
my $param_types = $$self{param_types};
|
||||
my $param_flags = $$self{param_flags};
|
||||
|
||||
my @result = ();
|
||||
|
||||
# Default starting index is 0 (The first call will have an undefined start
|
||||
# index).
|
||||
my $i = $start_index || 0;
|
||||
|
||||
if($i > $#$param_types)
|
||||
{
|
||||
# If index is past last arg, return an empty array inserting an empty
|
||||
# string if this function has no parameters.
|
||||
push(@result, "") if ($i == 0);
|
||||
return @result;
|
||||
}
|
||||
elsif($i == $#$param_types)
|
||||
{
|
||||
# If it's the last arg just add its index:
|
||||
push(@result, "$i");
|
||||
# And if it's optional also add an empty string to represent that it is
|
||||
# not added.
|
||||
push(@result, "") if ($$param_flags[$i] & FLAG_PARAM_OPTIONAL);
|
||||
return @result;
|
||||
}
|
||||
|
||||
# Get the possible indices for remaining params without this one.
|
||||
my @remaining = possible_args_list($self, $i + 1);
|
||||
|
||||
# Prepend this param's index to the remaining ones.
|
||||
foreach my $possibility (@remaining)
|
||||
{
|
||||
if($possibility)
|
||||
{
|
||||
push(@result, "$i " . $possibility);
|
||||
}
|
||||
else
|
||||
{
|
||||
push(@result, "$i");
|
||||
}
|
||||
}
|
||||
|
||||
# If this parameter is optional, append the remaining possibilities without
|
||||
# this param's type and name.
|
||||
if($$param_flags[$i] & FLAG_PARAM_OPTIONAL)
|
||||
{
|
||||
foreach my $possibility (@remaining)
|
||||
{
|
||||
push(@result, $possibility);
|
||||
}
|
||||
}
|
||||
|
||||
return @result;
|
||||
}
|
||||
|
||||
1; # indicate proper module load.
|
||||
|
||||
322
squashfs-root/usr/lib/glibmm-2.4/proc/pm/FunctionBase.pm
Normal file
322
squashfs-root/usr/lib/glibmm-2.4/proc/pm/FunctionBase.pm
Normal file
@@ -0,0 +1,322 @@
|
||||
package FunctionBase;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Util;
|
||||
|
||||
BEGIN {
|
||||
use Exporter ();
|
||||
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
|
||||
|
||||
# set the version for version checking
|
||||
$VERSION = 1.00;
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(&func1 &func2 &func4);
|
||||
%EXPORT_TAGS = ( );
|
||||
# your exported package globals go here,
|
||||
# as well as any optionally exported functions
|
||||
@EXPORT_OK = qw($Var1 %Hashit &func3);
|
||||
}
|
||||
our @EXPORT_OK;
|
||||
|
||||
##################################################
|
||||
### FunctionBase
|
||||
# Contains data and methods used by both Function (C++ declarations) and GtkDefs::Function (C defs descriptions)
|
||||
# Note that GtkDefs::Signal inherits from GtkDefs::Function so it get these methods too.
|
||||
#
|
||||
# class Function : FunctionBase
|
||||
# {
|
||||
# string array param_types;
|
||||
# string array param_names;
|
||||
# string array param_documentation;
|
||||
# string return_documention;
|
||||
# }
|
||||
|
||||
|
||||
# $string args_types_only($)
|
||||
# comma-delimited argument types.
|
||||
sub args_types_only($)
|
||||
{
|
||||
my ($self) = @_;
|
||||
|
||||
my $param_types = $$self{param_types};
|
||||
return join(", ", @$param_types);
|
||||
}
|
||||
|
||||
# $string args_names_only(int index = 0)
|
||||
# Gets the args names. The optional index specifies which argument
|
||||
# list should be used out of the possible combination of arguments based on
|
||||
# whether any arguments are optional. index = 0 ==> all the names.
|
||||
sub args_names_only($)
|
||||
{
|
||||
my ($self, $index) = @_;
|
||||
|
||||
$index = 0 unless defined($index);
|
||||
|
||||
my $param_names = $$self{param_names};
|
||||
my $possible_args_list = $$self{possible_args_list};
|
||||
my @out;
|
||||
|
||||
my @arg_indices;
|
||||
|
||||
if(defined($possible_args_list))
|
||||
{
|
||||
@arg_indices = split(" ", @$possible_args_list[$index]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@arg_indices = (0..@$param_names - 1);
|
||||
}
|
||||
|
||||
for (my $i = 0; $i < @arg_indices; $i++)
|
||||
{
|
||||
push(@out, $$param_names[$arg_indices[$i]]);
|
||||
}
|
||||
return join(", ", @out);
|
||||
}
|
||||
|
||||
# $string args_types_and_names(int index = 0)
|
||||
# Gets the args types and names. The optional index specifies which argument
|
||||
# list should be used out of the possible combination of arguments based on
|
||||
# whether any arguments are optional. index = 0 ==> all the types and names.
|
||||
sub args_types_and_names($)
|
||||
{
|
||||
my ($self, $index) = @_;
|
||||
|
||||
$index = 0 unless defined($index);
|
||||
|
||||
my $i;
|
||||
|
||||
my $param_names = $$self{param_names};
|
||||
my $param_types = $$self{param_types};
|
||||
my $possible_args_list = $$self{possible_args_list};
|
||||
my @out;
|
||||
|
||||
#debugging:
|
||||
#if($#$param_types)
|
||||
#{
|
||||
# return "NOARGS";
|
||||
#}
|
||||
|
||||
my @arg_indices;
|
||||
|
||||
if(defined($possible_args_list))
|
||||
{
|
||||
@arg_indices = split(" ", @$possible_args_list[$index]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@arg_indices = (0..@$param_names - 1);
|
||||
}
|
||||
|
||||
for ($i = 0; $i < @arg_indices; $i++)
|
||||
{
|
||||
my $str = sprintf("%s %s", $$param_types[$arg_indices[$i]],
|
||||
$$param_names[$arg_indices[$i]]);
|
||||
push(@out, $str);
|
||||
}
|
||||
|
||||
my $result = join(", ", @out);
|
||||
return $result;
|
||||
}
|
||||
|
||||
# $string args_names_only_without_object($)
|
||||
sub args_names_only_without_object2($)
|
||||
{
|
||||
my ($self) = @_;
|
||||
|
||||
my $param_names = $$self{param_names};
|
||||
|
||||
my $result = "";
|
||||
my $bInclude = 0; #Ignore the first (object) arg.
|
||||
foreach (@{$param_names})
|
||||
{
|
||||
# Add comma if there was an arg before this one:
|
||||
if( $result ne "")
|
||||
{
|
||||
$result .= ", ";
|
||||
}
|
||||
|
||||
# Append this arg if it's not the first one:
|
||||
if($bInclude)
|
||||
{
|
||||
$result .= $_;
|
||||
}
|
||||
|
||||
$bInclude = 1;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
# $string args_types_and_names_without_object($)
|
||||
sub args_types_and_names_without_object($)
|
||||
{
|
||||
my ($self) = @_;
|
||||
|
||||
my $param_names = $$self{param_names};
|
||||
my $param_types = $$self{param_types};
|
||||
my $i = 0;
|
||||
my @out;
|
||||
|
||||
for ($i = 1; $i < $#$param_types + 1; $i++) #Ignore the first arg.
|
||||
{
|
||||
my $str = sprintf("%s %s", $$param_types[$i], $$param_names[$i]);
|
||||
push(@out, $str);
|
||||
}
|
||||
|
||||
return join(", ", @out);
|
||||
}
|
||||
|
||||
# $string args_names_only_without_object($)
|
||||
sub args_names_only_without_object($)
|
||||
{
|
||||
my ($self) = @_;
|
||||
|
||||
my $param_names = $$self{param_names};
|
||||
|
||||
my $result = "";
|
||||
my $bInclude = 0; #Ignore the first (object) arg.
|
||||
foreach (@{$param_names})
|
||||
{
|
||||
# Add comma if there was an arg before this one:
|
||||
if( $result ne "")
|
||||
{
|
||||
$result .= ", ";
|
||||
}
|
||||
|
||||
# Append this arg if it's not the first one:
|
||||
if($bInclude)
|
||||
{
|
||||
$result .= $_;
|
||||
}
|
||||
|
||||
$bInclude = 1;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub dump($)
|
||||
{
|
||||
my ($self) = @_;
|
||||
|
||||
my $param_types = $$self{param_types};
|
||||
my $param_names = $$self{param_names};
|
||||
|
||||
print "<function>\n";
|
||||
foreach (keys %$self)
|
||||
{
|
||||
print " <$_ value=\"$$self{$_}\"/>\n" if (!ref $$self{$_} && $$self{$_} ne "");
|
||||
}
|
||||
|
||||
if (scalar(@$param_types)>0)
|
||||
{
|
||||
print " <parameters>\n";
|
||||
|
||||
for (my $i = 0; $i < scalar(@$param_types); $i++)
|
||||
{
|
||||
print " \"$$param_types[$i]\" \"$$param_names[$i]\" \n";
|
||||
}
|
||||
|
||||
print " </parameters>\n";
|
||||
}
|
||||
|
||||
print "</function>\n\n";
|
||||
}
|
||||
|
||||
# $string args_types_and_names_with_default_values(int index = 0)
|
||||
# Gets the args types and names with default values. The optional index
|
||||
# specifies which argument list should be used out of the possible
|
||||
# combination of arguments based on whether any arguments are optional.
|
||||
# index = 0 ==> all the types and names.
|
||||
sub args_types_and_names_with_default_values($)
|
||||
{
|
||||
my ($self, $index) = @_;
|
||||
|
||||
$index = 0 unless defined $index;
|
||||
|
||||
my $i;
|
||||
|
||||
my $param_names = $$self{param_names};
|
||||
my $param_types = $$self{param_types};
|
||||
my $param_default_values = $$self{param_default_values};
|
||||
my $possible_args_list = $$self{possible_args_list};
|
||||
my @out;
|
||||
|
||||
my @arg_indices;
|
||||
|
||||
if(defined($possible_args_list))
|
||||
{
|
||||
@arg_indices = split(" ", @$possible_args_list[$index]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@arg_indices = (0..@$param_names - 1);
|
||||
}
|
||||
|
||||
for ($i = 0; $i < @arg_indices; $i++)
|
||||
{
|
||||
my $str = sprintf("%s %s", $$param_types[$arg_indices[$i]],
|
||||
$$param_names[$arg_indices[$i]]);
|
||||
|
||||
|
||||
if(defined($$param_default_values[$arg_indices[$i]]))
|
||||
{
|
||||
my $default_value = $$param_default_values[$arg_indices[$i]];
|
||||
|
||||
if($default_value ne "")
|
||||
{
|
||||
$str .= " = " . $default_value;
|
||||
}
|
||||
}
|
||||
|
||||
push(@out, $str);
|
||||
}
|
||||
|
||||
return join(", ", @out);
|
||||
}
|
||||
|
||||
# $string get_declaration(int index = 0)
|
||||
# Gets the function declaration (this includes the default values of the
|
||||
# args). The optional index specifies which argument list should be used out
|
||||
# of the possible combination of arguments based on whether any arguments are
|
||||
# optional. index = 0 ==> all the types and names.
|
||||
sub get_declaration($)
|
||||
{
|
||||
my ($self, $index) = @_;
|
||||
|
||||
$index = 0 unless defined $index;
|
||||
my $out = "";
|
||||
|
||||
$out = "static " if($$self{static});
|
||||
$out = $out . "$$self{rettype} " if($$self{rettype});
|
||||
$out = $out . $$self{name} . "(" .
|
||||
$self->args_types_and_names_with_default_values($index) . ")";
|
||||
$out = $out . " const" if $$self{const};
|
||||
$out = $out . ";";
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
# int get_num_possible_args_list();
|
||||
# Returns the number of possible argument list based on whether some args are
|
||||
# optional.
|
||||
sub get_num_possible_args_list()
|
||||
{
|
||||
my ($self) = @_;
|
||||
|
||||
my $possible_args_list = $$self{possible_args_list};
|
||||
|
||||
if(defined($possible_args_list))
|
||||
{
|
||||
return @$possible_args_list;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
1; # indicate proper module load.
|
||||
|
||||
884
squashfs-root/usr/lib/glibmm-2.4/proc/pm/GtkDefs.pm
Normal file
884
squashfs-root/usr/lib/glibmm-2.4/proc/pm/GtkDefs.pm
Normal file
@@ -0,0 +1,884 @@
|
||||
# gtkmm - GtkDefs module
|
||||
#
|
||||
# Copyright 2001 Free Software Foundation
|
||||
#
|
||||
# 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, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
package GtkDefs;
|
||||
use strict;
|
||||
use warnings;
|
||||
use open IO => ":utf8";
|
||||
|
||||
use Util;
|
||||
use Enum;
|
||||
use Object;
|
||||
use Property;
|
||||
use FunctionBase;
|
||||
|
||||
#
|
||||
# Public functions
|
||||
# read_defs(path, file)
|
||||
#
|
||||
# @ get_methods()
|
||||
# @ get_signals()
|
||||
# @ get_properties()
|
||||
# @ get_child_properties()
|
||||
# @ get_unwrapped()
|
||||
#
|
||||
# $ lookup_enum(c_type)
|
||||
# $ lookup_object(c_name)
|
||||
# $ lookup_method_dont_mark(c_name)
|
||||
# $ lookup_method_set_weak_mark(c_name)
|
||||
# $ lookup_method(c_name)
|
||||
# $ lookup_function(c_name)
|
||||
# $ lookup_property(object, c_name)
|
||||
# $ lookup_child_property(object, c_name)
|
||||
# $ lookup_signal(object, c_name)
|
||||
#
|
||||
|
||||
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;
|
||||
|
||||
#####################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
#####################################
|
||||
|
||||
%GtkDefs::enums = (); #Enum
|
||||
%GtkDefs::objects = (); #Object
|
||||
%GtkDefs::methods = (); #GtkDefs::Function
|
||||
%GtkDefs::signals = (); #GtkDefs::Signal
|
||||
%GtkDefs::properties = (); #Property
|
||||
%GtkDefs::child_properties = (); #Property
|
||||
|
||||
@GtkDefs::read = ();
|
||||
@GtkDefs::file = ();
|
||||
|
||||
|
||||
#####################################
|
||||
#prototype to get rid of warning
|
||||
sub read_defs($$;$);
|
||||
|
||||
sub read_defs($$;$)
|
||||
{
|
||||
my ($path, $filename, $restrict) = @_;
|
||||
$restrict = "" if ($#_ < 2);
|
||||
|
||||
# check that the file is there.
|
||||
if ( ! -r "$path/$filename")
|
||||
{
|
||||
print "Error: can't read defs file $filename\n";
|
||||
return;
|
||||
}
|
||||
|
||||
# break the tokens into lisp phrases up to three levels deep.
|
||||
# WARNING: reading the following perl statement may induce seizures,
|
||||
# please flush eyes with water immediately, and consult a mortician.
|
||||
#
|
||||
# this regexp is weak - it does not work on multiple and/or unpaired parens
|
||||
# inside double quotes - those shouldn't be ever considered. i replaced this
|
||||
# splitting with my own function, which does the job very well - krnowak.
|
||||
# my @tokens = split(
|
||||
# m/(
|
||||
# \(
|
||||
# (?:
|
||||
# [^()]*
|
||||
# \(
|
||||
# (?:
|
||||
# [^()]*
|
||||
# \(
|
||||
# [^()]*
|
||||
# \)
|
||||
# )*
|
||||
# [^()]*
|
||||
# \)
|
||||
# )*
|
||||
# [^()]*
|
||||
# \)
|
||||
# )/x,
|
||||
# read_file($path, $filename));
|
||||
|
||||
my @tokens = split_tokens(read_file($path, $filename));
|
||||
|
||||
# scan through top level tokens
|
||||
while ($#tokens > -1)
|
||||
{
|
||||
my $token = shift @tokens;
|
||||
next if ($token =~ /^\s*$/);
|
||||
|
||||
if ($token =~ /\(include (\S+)\)/)
|
||||
{
|
||||
read_defs($path,$1,$restrict);
|
||||
next;
|
||||
}
|
||||
elsif ($token =~ /^\(define-flags-extended.*\)$/)
|
||||
{ on_enum($token); }
|
||||
elsif ($token =~ /^\(define-enum-extended.*\)$/)
|
||||
{ on_enum($token); }
|
||||
elsif ($token =~ /^\(define-flags.*\)$/)
|
||||
{ }
|
||||
elsif ($token =~ /^\(define-enum.*\)$/)
|
||||
{ }
|
||||
elsif ($token =~ /^\(define-object.*\)$/)
|
||||
{ on_object($token); }
|
||||
elsif ($token =~ /^\(define-function.*\)$/)
|
||||
{ on_function($token); }
|
||||
elsif ($token =~ /^\(define-method.*\)$/)
|
||||
{ on_method($token); }
|
||||
elsif ($token =~ /^\(define-property.*\)$/)
|
||||
{ on_property($token); }
|
||||
elsif ($token =~ /^\(define-child-property.*\)$/)
|
||||
{ on_child_property($token); }
|
||||
elsif ($token =~ /^\(define-signal.*\)$/)
|
||||
{ on_signal($token); }
|
||||
elsif ($token =~ /^\(define-vfunc.*\)$/)
|
||||
{ on_vfunc($token); }
|
||||
else
|
||||
{
|
||||
if ( $token =~ /^\(define-(\S+) (\S+)/)
|
||||
{
|
||||
# FIXME need to figure out the line number.
|
||||
print STDERR "Broken lisp definition for $1 $2.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "unknown token $token \n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub split_tokens($)
|
||||
{
|
||||
my ($token_string) = @_;
|
||||
my @tokens = ();
|
||||
# whether we are inside double quotes.
|
||||
my $inside_dquotes = 0;
|
||||
# whether we are inside double and then single quotes (for situations like
|
||||
# "'"'").
|
||||
my $inside_squotes = 0;
|
||||
# number of yet unpaired opening parens.
|
||||
my $parens = 0;
|
||||
# whether previous char was a backslash - important only when being between
|
||||
# double quotes.
|
||||
my $backslash = 0;
|
||||
# index of first opening paren - beginning of a new token.
|
||||
my $begin_token = 0;
|
||||
|
||||
# Isolate characters with special significance for the token split.
|
||||
my @substrings = split(/([\\"'()])/, $token_string);
|
||||
|
||||
my $index = -1;
|
||||
for my $substring (@substrings)
|
||||
{
|
||||
$index++;
|
||||
# if we are inside double quotes.
|
||||
if ($inside_dquotes)
|
||||
{
|
||||
# if prevous char was backslash, then current char is not important -
|
||||
# we are still inside double or double/single quotes anyway.
|
||||
if ($backslash)
|
||||
{
|
||||
$backslash = 0;
|
||||
}
|
||||
# if current char is backslash.
|
||||
elsif ($substring eq '\\')
|
||||
{
|
||||
$backslash = 1;
|
||||
}
|
||||
# if current char is unescaped double quotes and we are not inside single
|
||||
# ones - means, we are going outside string.
|
||||
elsif ($substring eq '"' and not $inside_squotes)
|
||||
{
|
||||
$inside_dquotes = 0;
|
||||
}
|
||||
# if current char is unescaped single quote, then we have two cases:
|
||||
# 1. it just plain apostrophe.
|
||||
# 2. it is a piece of a C code:
|
||||
# a) opening quotes,
|
||||
# b) closing quotes.
|
||||
# if there is near (2 or 3 indexes away) second quote, then it is 2a,
|
||||
# if 2a occured earlier, then it is 2b.
|
||||
# otherwise is 1.
|
||||
elsif ($substring eq '\'')
|
||||
{
|
||||
# if we are already inside single quotes, it is 2b.
|
||||
if ($inside_squotes)
|
||||
{
|
||||
$inside_squotes = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
# if there is closing quotes near, it is 2a.
|
||||
if (join('', @substrings[$index .. min($#substrings, $index+3)]) =~ /^'\\?.'/)
|
||||
{
|
||||
$inside_squotes = 1;
|
||||
}
|
||||
# else it is just 1.
|
||||
}
|
||||
}
|
||||
}
|
||||
# double quotes - beginning of a string.
|
||||
elsif ($substring eq '"')
|
||||
{
|
||||
$inside_dquotes = 1;
|
||||
}
|
||||
# opening paren - if paren count is 0 then this is a beginning of a token.
|
||||
elsif ($substring eq '(')
|
||||
{
|
||||
unless ($parens)
|
||||
{
|
||||
$begin_token = $index;
|
||||
}
|
||||
$parens++;
|
||||
}
|
||||
# closing paren - if paren count is 1 then this is an end of a token, so we
|
||||
# extract it from token string and push into token list.
|
||||
elsif ($substring eq ')')
|
||||
{
|
||||
$parens--;
|
||||
unless ($parens)
|
||||
{
|
||||
my $token = join('', @substrings[$begin_token .. $index]);
|
||||
push(@tokens, $token);
|
||||
}
|
||||
}
|
||||
# do nothing on other chars.
|
||||
}
|
||||
return @tokens;
|
||||
}
|
||||
|
||||
sub min($$)
|
||||
{
|
||||
return ($_[0] < $_[1]) ? $_[0] : $_[1];
|
||||
}
|
||||
|
||||
sub read_file($$)
|
||||
{
|
||||
my ($path, $filename)=@_;
|
||||
my @buf = ();
|
||||
|
||||
# don't read a file twice
|
||||
foreach (@GtkDefs::read)
|
||||
{
|
||||
return "" if ($_ eq "$path/$filename");
|
||||
}
|
||||
push @GtkDefs::read, "$path/$filename";
|
||||
|
||||
# read file while stripping comments
|
||||
open(FILE, "$path/$filename");
|
||||
while (<FILE>)
|
||||
{
|
||||
s/^;.*$//; # remove comments
|
||||
chop; # remove new lines
|
||||
push(@buf, $_);
|
||||
}
|
||||
close(FILE);
|
||||
|
||||
$_ = join("", @buf);
|
||||
s/\s+/ /g;
|
||||
return $_;
|
||||
}
|
||||
|
||||
|
||||
sub on_enum($)
|
||||
{
|
||||
my $thing = Enum::new(shift(@_));
|
||||
$GtkDefs::enums{$$thing{c_type}} = $thing;
|
||||
}
|
||||
|
||||
sub on_object($)
|
||||
{
|
||||
my $thing = Object::new(shift(@_));
|
||||
$GtkDefs::objects{$$thing{c_name}} = $thing;
|
||||
}
|
||||
|
||||
sub on_function($)
|
||||
{
|
||||
my $thing = GtkDefs::Function::new(shift(@_));
|
||||
$GtkDefs::methods{$$thing{c_name}} = $thing;
|
||||
}
|
||||
|
||||
sub on_method($)
|
||||
{
|
||||
my $thing = GtkDefs::Function::new(shift(@_));
|
||||
$GtkDefs::methods{$$thing{c_name}} = $thing if ($thing);
|
||||
}
|
||||
|
||||
sub on_property($)
|
||||
{
|
||||
my $thing = Property::new(shift(@_));
|
||||
$GtkDefs::properties{"$$thing{class}::$$thing{name}"} = $thing;
|
||||
}
|
||||
|
||||
sub on_child_property($)
|
||||
{
|
||||
my $thing = Property::new(shift(@_));
|
||||
$GtkDefs::child_properties{"$$thing{class}::$$thing{name}"} = $thing;
|
||||
}
|
||||
|
||||
sub on_signal($)
|
||||
{
|
||||
my $thing = GtkDefs::Signal::new(shift(@_));
|
||||
$GtkDefs::signals{"$$thing{class}::$$thing{name}"} = $thing;
|
||||
}
|
||||
|
||||
sub on_vfunc($)
|
||||
{
|
||||
my $thing = GtkDefs::Signal::new(shift(@_));
|
||||
$GtkDefs::signals{"$$thing{class}::$$thing{name}"} = $thing;
|
||||
}
|
||||
|
||||
##########################
|
||||
|
||||
sub get_enums
|
||||
{
|
||||
return sort {$$a{c_type} cmp $$b{c_type}} values %GtkDefs::enums;
|
||||
}
|
||||
sub get_methods
|
||||
{
|
||||
return sort {$$a{c_name} cmp $$b{c_name}} values %GtkDefs::methods;
|
||||
}
|
||||
sub get_signals
|
||||
{
|
||||
return sort {$$a{name} cmp $$b{name}} values %GtkDefs::signals;
|
||||
}
|
||||
sub get_properties
|
||||
{
|
||||
return sort {$$a{name} cmp $$b{name}} values %GtkDefs::properties;
|
||||
}
|
||||
|
||||
sub get_child_properties
|
||||
{
|
||||
return sort {$$a{name} cmp $$b{name}} values %GtkDefs::child_properties;
|
||||
}
|
||||
|
||||
sub get_marked
|
||||
{
|
||||
no warnings;
|
||||
return grep {$$_{mark}==1} values %GtkDefs::methods;
|
||||
}
|
||||
|
||||
# This searches for items wrapped by this file and then tries to locate
|
||||
# other methods/signals/properties which may have been left unmarked.
|
||||
sub get_unwrapped
|
||||
{
|
||||
# find methods which were used in a _WRAP or _IGNORE.
|
||||
my @targets;
|
||||
push @targets,grep {$$_{entity_type} eq "method" && $$_{mark}==1} values %GtkDefs::methods;
|
||||
push @targets,grep {$$_{mark}==1} values %GtkDefs::signals;
|
||||
push @targets,grep {$$_{mark}==1} values %GtkDefs::properties;
|
||||
push @targets,grep {$$_{mark}==1} values %GtkDefs::child_properties;
|
||||
|
||||
# find the classes which used them.
|
||||
my @classes = unique(map { $$_{class} } @targets);
|
||||
|
||||
# find methods/signals/properties which are in those classes which didn't get marked.
|
||||
my @unwrapped;
|
||||
my $class;
|
||||
foreach $class (@classes)
|
||||
{
|
||||
# if this class's parent is defined then don't put its properties as unwrapped.
|
||||
# this may not work if parent is from other library (GtkApplication's parent
|
||||
# is GApplication, so all its properties will be marked as unwrapped)
|
||||
my $detailed = 0;
|
||||
my $parent = undef;
|
||||
if (exists $GtkDefs::objects{$class})
|
||||
{
|
||||
my $object = $GtkDefs::objects{$class};
|
||||
|
||||
if (defined $object)
|
||||
{
|
||||
$parent = $object->{parent};
|
||||
|
||||
# may be empty for some classes deriving a GInterface?
|
||||
if ($parent)
|
||||
{
|
||||
$detailed = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($detailed)
|
||||
{
|
||||
push @unwrapped, grep {$$_{class} eq $class && $$_{mark}==0 && not exists $GtkDefs::properties{$parent . '::' . $_->{name}}} values %GtkDefs::properties;
|
||||
push @unwrapped, grep {$$_{class} eq $class && $$_{mark}==0 && not exists $GtkDefs::child_properties{$parent . '::' . $_->{name}}} values %GtkDefs::child_properties;
|
||||
}
|
||||
else
|
||||
{
|
||||
push @unwrapped, grep {$$_{class} eq $class && $$_{mark}==0} values %GtkDefs::properties;
|
||||
push @unwrapped, grep {$$_{class} eq $class && $$_{mark}==0} values %GtkDefs::child_properties;
|
||||
}
|
||||
|
||||
push @unwrapped, grep {$$_{class} eq $class && $$_{mark}==0} values %GtkDefs::methods;
|
||||
push @unwrapped, grep {$$_{class} eq $class && $$_{mark}==0} values %GtkDefs::signals;
|
||||
}
|
||||
|
||||
return @unwrapped;
|
||||
}
|
||||
|
||||
##########################
|
||||
|
||||
sub lookup_enum($)
|
||||
{
|
||||
no warnings;
|
||||
my ($c_type) = @_;
|
||||
my $obj = $GtkDefs::enums{$c_type};
|
||||
return 0 if(!$obj);
|
||||
$$obj{mark} = 1;
|
||||
return $obj;
|
||||
}
|
||||
|
||||
sub lookup_object($)
|
||||
{
|
||||
no warnings;
|
||||
|
||||
my $c_name = $_[0];
|
||||
my $result = $GtkDefs::objects{$c_name};
|
||||
|
||||
if (not defined($result))
|
||||
{
|
||||
# We do not print this error because it's not always an error,
|
||||
# because the caller will often try several object names,
|
||||
# while guessing an object name prefix from a function name.
|
||||
#
|
||||
# print "GtkDefs:lookup_object(): can't find object with name=" . $c_name . "\n";
|
||||
|
||||
# debug output:
|
||||
# foreach my $key (keys %GtkDefs::objects)
|
||||
# {
|
||||
# print " possible name=" . $key . "\n";
|
||||
# }
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
# $objProperty lookup_property($name, $parent_object_name)
|
||||
sub lookup_property($$)
|
||||
{
|
||||
no warnings;
|
||||
my ($parent_object_name, $name) = @_;
|
||||
$name =~ s/-/_/g;
|
||||
my $obj = $GtkDefs::properties{"${parent_object_name}::${name}"};
|
||||
return 0 if ($obj eq "");
|
||||
$$obj{mark} = 1;
|
||||
return $obj;
|
||||
}
|
||||
|
||||
# $objChildProperty lookup_child_property($name, $parent_object_name)
|
||||
sub lookup_child_property($$)
|
||||
{
|
||||
no warnings;
|
||||
my ($parent_object_name, $name) = @_;
|
||||
$name =~ s/-/_/g;
|
||||
my $obj = $GtkDefs::child_properties{"${parent_object_name}::${name}"};
|
||||
return 0 if ($obj eq "");
|
||||
$$obj{mark} = 1;
|
||||
return $obj;
|
||||
}
|
||||
|
||||
sub lookup_method_dont_mark($)
|
||||
{
|
||||
no warnings;
|
||||
my ($c_name) = @_;
|
||||
$c_name =~ s/-/_/g;
|
||||
|
||||
my $obj = $GtkDefs::methods{$c_name};
|
||||
return 0 if ($obj eq "");
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
sub lookup_method($)
|
||||
{
|
||||
my $obj = lookup_method_dont_mark($_[0]);
|
||||
|
||||
$$obj{mark} = 1 if($obj);
|
||||
return $obj;
|
||||
}
|
||||
|
||||
sub lookup_function($)
|
||||
{
|
||||
return lookup_method($_[0]);
|
||||
}
|
||||
|
||||
sub lookup_method_set_weak_mark($)
|
||||
{
|
||||
my $obj = lookup_method_dont_mark($_[0]);
|
||||
|
||||
# A constructor or a static method may be listed in the .defs file as a method
|
||||
# of another class, if its first parameter is a pointer to a class instance.
|
||||
# Examples:
|
||||
# GVariantIter* g_variant_iter_new(GVariant* value)
|
||||
# GtkWidget* gtk_application_window_new(GtkApplication* application)
|
||||
# GSocketConnection* g_socket_connection_factory_create_connection(GSocket* socket)
|
||||
#
|
||||
# The use of gtk_application_window_new() in Gtk::ApplicationWindow shall
|
||||
# not cause get_unwrapped() to list all methods, signals and properties of
|
||||
# GtkApplication as unwrapped in applicationwindow.hg.
|
||||
# Therefore mark=2 instead of mark=1.
|
||||
|
||||
$$obj{mark} = 2 if ($obj && $$obj{mark} == 0);
|
||||
return $obj;
|
||||
}
|
||||
|
||||
sub lookup_signal($$)
|
||||
{
|
||||
no warnings;
|
||||
my ($parent_object_name, $name) = @_;
|
||||
|
||||
$name =~ s/-/_/g;
|
||||
my $obj = $GtkDefs::signals{"${parent_object_name}::${name}"};
|
||||
return 0 if ($obj eq "");
|
||||
$$obj{mark} = 1;
|
||||
return $obj;
|
||||
}
|
||||
|
||||
sub error
|
||||
{
|
||||
my $format = shift @_;
|
||||
printf STDERR "GtkDefs.pm: $format\n", @_;
|
||||
}
|
||||
|
||||
|
||||
########################################################################
|
||||
package GtkDefs::Function;
|
||||
BEGIN { @GtkDefs::Function::ISA=qw(FunctionBase); }
|
||||
|
||||
# class Function : FunctionBase
|
||||
# {
|
||||
# string name; e.g. function: gtk_accelerator_valid, method: clicked
|
||||
# string c_name; e.g. gtk_accelerator_valid, gtk_button_clicked
|
||||
# string class; e.g. GtkButton
|
||||
#
|
||||
# string rettype;
|
||||
# string array param_types;
|
||||
# string array param_names;
|
||||
#
|
||||
# string entity_type; e.g. method or function
|
||||
#
|
||||
# bool varargs;
|
||||
# bool mark;
|
||||
# }
|
||||
|
||||
# "new" can't have prototype
|
||||
sub new
|
||||
{
|
||||
my ($def) = @_;
|
||||
my $whole = $def;
|
||||
my $self = {};
|
||||
bless $self;
|
||||
|
||||
#Remove first and last braces:
|
||||
$def =~ s/^\(//;
|
||||
$def =~ s/\)$//;
|
||||
|
||||
#In rare cases a method can be nameless (g_iconv).
|
||||
#Don't interpret the following "(of-object" as the method's name.
|
||||
$def =~ s/^\s*define-([^\s\(]+)\s*([^\s\(]*)\s*//;
|
||||
$$self{entity_type} = $1;
|
||||
$$self{name} = $2;
|
||||
$$self{name} =~ s/-/_/g; # change - to _
|
||||
|
||||
# init variables
|
||||
$$self{mark} = 0;
|
||||
$$self{rettype} = "none";
|
||||
$$self{param_types} = [];
|
||||
$$self{param_names} = [];
|
||||
$$self{class} = "";
|
||||
|
||||
# snarf down lisp fields
|
||||
$$self{c_name} = $1 if ($def=~s/\(c-name "(\S+)"\)//);
|
||||
$$self{class} = $1 if ($def=~s/\(of-object "(\S+)"\)//);
|
||||
|
||||
if ($def =~ s/\(return-type "(\S+)"\)//)
|
||||
{
|
||||
$$self{rettype} = $1;
|
||||
$$self{rettype} =~ s/-/ /g; #e.g. replace const-gchar* with const gchar*. Otherwise it will be used in code.
|
||||
}
|
||||
|
||||
$$self{varargs} = 1 if ($def=~s/\(varargs\s+#t\)//);
|
||||
$$self{rettype} = "void" if ($$self{rettype} eq "none");
|
||||
|
||||
# methods have a parameter not stated in the defs file
|
||||
if ($$self{entity_type} eq "method")
|
||||
{
|
||||
push( @{$$self{param_types}}, "$$self{class}*" );
|
||||
push( @{$$self{param_names}}, "self" );
|
||||
}
|
||||
|
||||
# parameters are compound lisp statement
|
||||
if ($def =~ s/\(parameters(( '\("\S+" "\S+"\))*) \)//)
|
||||
{
|
||||
$self->parse_param($1);
|
||||
}
|
||||
|
||||
# is-constructor-of:
|
||||
if ($def =~ s/\(is-constructor-of "(\S+)"\)//)
|
||||
{
|
||||
#Ignore them.
|
||||
}
|
||||
|
||||
# of-object
|
||||
if ($def =~ s/\(of-object "(\S+)"\)//)
|
||||
{
|
||||
#Ignore them.
|
||||
}
|
||||
|
||||
GtkDefs::error("Unhandled function parameter ($def) in $$self{c_name}\n")
|
||||
if ($def !~ /^\s*$/);
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub parse_param($$)
|
||||
{
|
||||
my ($self, $param) = @_;
|
||||
|
||||
# break up the parameter statements
|
||||
foreach (split(/\s*'*[()]\s*/, $param))
|
||||
{
|
||||
next if ($_ eq "");
|
||||
if (/^"(\S+)" "(\S+)"$/)
|
||||
{
|
||||
my ($p1, $p2) = ($1,$2);
|
||||
$p1 =~ s/-/ /;
|
||||
push( @{$$self{param_types}}, $p1);
|
||||
push( @{$$self{param_names}}, $p2);
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkDefs::error("Unknown parameter statement ($_) in $$self{c_name}\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# $string get_return_type_for_methods().
|
||||
# Changes gchar* (not const-gchar*) to return-gchar* so that _CONVERT knows that it needs to be freed.
|
||||
sub get_return_type_for_methods($)
|
||||
{
|
||||
my ($self) = @_;
|
||||
|
||||
my $rettype = $$self{rettype};
|
||||
if($rettype eq "gchar*" || $rettype eq "char*")
|
||||
{
|
||||
$rettype = "return-" . $rettype;
|
||||
}
|
||||
|
||||
return $rettype;
|
||||
}
|
||||
|
||||
sub get_param_names
|
||||
{
|
||||
my ($self) = @_;
|
||||
return @$self{param_names};
|
||||
}
|
||||
|
||||
######################################################################
|
||||
package GtkDefs::Signal;
|
||||
BEGIN { @GtkDefs::Signal::ISA=qw(GtkDefs::Function); }
|
||||
|
||||
# class Signal : Function
|
||||
# {
|
||||
# string name; e.g. gtk_accelerator_valid
|
||||
# string class e.g. GtkButton ( == of-object.)
|
||||
#
|
||||
# string rettype;
|
||||
#
|
||||
# string flags. e.g. Run Last, No Hooks
|
||||
# string entity_type. e.g. vfunc or signal
|
||||
# bool detailed; # optional
|
||||
# bool deprecated; # optional
|
||||
# }
|
||||
|
||||
# "new" can't have prototype
|
||||
sub new
|
||||
{
|
||||
my ($def) = @_;
|
||||
|
||||
my $whole = $def;
|
||||
my $self = {};
|
||||
bless $self;
|
||||
|
||||
#Remove first and last braces:
|
||||
$def =~ s/^\(//;
|
||||
$def =~ s/\)$//;
|
||||
|
||||
$def =~ s/^\s*define-(\S+)\s+(\S+)\s*//;
|
||||
$$self{entity_type} = $1;
|
||||
$$self{name} = $2;
|
||||
$$self{name} =~ s/-/_/g; #change - to _
|
||||
|
||||
# init variables
|
||||
$$self{mark}=0;
|
||||
$$self{rettype} = "none";
|
||||
$$self{param_types} = [];
|
||||
$$self{param_names} = [];
|
||||
$$self{flags} = "";
|
||||
$$self{class} = "";
|
||||
|
||||
# snarf down lisp fields
|
||||
if($def =~ s/\(of-object "(\S+)"\)//)
|
||||
{
|
||||
$$self{class} = $1;
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkDefs::error("define-signal/define-vfunc without of-object (entity type: $$self{entity_type}): $whole");
|
||||
}
|
||||
|
||||
if($def =~ s/\(return-type "(\S+)"\)//)
|
||||
{
|
||||
$$self{rettype} = $1;
|
||||
$$self{rettype} =~ s/-/ /g; #e.g. replace const-gchar* with const gchar*. Otherwise it will be used in code.
|
||||
}
|
||||
|
||||
if ($def =~ s/\(flags "(.*?)"\)//)
|
||||
{
|
||||
$$self{flags} = $1;
|
||||
}
|
||||
elsif ($def =~ s/\(when "(\S+)"\)//)
|
||||
{
|
||||
# "when" is a deprecated alternative to "flags".
|
||||
# when eq "none", "first", "last", or "both".
|
||||
if ($1 eq "first")
|
||||
{
|
||||
$$self{flags} = "Run First";
|
||||
}
|
||||
elsif ($1 eq "last")
|
||||
{
|
||||
$$self{flags} = "Run Last";
|
||||
}
|
||||
elsif ($1 eq "both")
|
||||
{
|
||||
$$self{flags} = "Run First, Run Last";
|
||||
}
|
||||
}
|
||||
|
||||
if($$self{rettype} eq "none")
|
||||
{
|
||||
$$self{rettype} = "void"
|
||||
}
|
||||
|
||||
$$self{detailed} = ($1 eq "#t") if ($def =~ s/\(detailed (\S+)\)//);
|
||||
$$self{deprecated} = ($1 eq "#t") if ($def =~ s/\(deprecated (\S+)\)//);
|
||||
|
||||
# signals always have a parameter
|
||||
push(@{$$self{param_types}}, "$$self{class}*");
|
||||
push(@{$$self{param_names}}, "self");
|
||||
|
||||
# parameters are compound lisp statement
|
||||
if ($def =~ s/\(parameters(( '\("\S+" "\S+"\))+) \)//)
|
||||
{
|
||||
$self->parse_param($1);
|
||||
}
|
||||
|
||||
if ($def!~/^\s*$/)
|
||||
{
|
||||
GtkDefs::error("Unhandled signal/vfunc def ($def) in $$self{class}::$$self{name}");
|
||||
}
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
# bool get_detailed()
|
||||
sub get_detailed($)
|
||||
{
|
||||
my ($self) = @_;
|
||||
return $$self{detailed}; # undef, 0 or 1
|
||||
}
|
||||
|
||||
# bool get_deprecated()
|
||||
sub get_deprecated($)
|
||||
{
|
||||
my ($self) = @_;
|
||||
return $$self{deprecated}; # undef, 0 or 1
|
||||
}
|
||||
|
||||
# bool has_same_types($objFunction)
|
||||
# Compares return types and argument types
|
||||
sub has_same_types($$)
|
||||
{
|
||||
my ($self, $objFuncOther) = @_;
|
||||
|
||||
#Compare return types:
|
||||
if($self->types_are_equal($$self{rettype}, $$objFuncOther{rettype}) ne 1)
|
||||
{
|
||||
# printf("debug: different return types: %s, %s\n", $$self{rettype}, $$objFuncOther{rettype});
|
||||
return 0; #Different types found.
|
||||
}
|
||||
|
||||
#Compare arguement types:
|
||||
my $i = 0;
|
||||
my $param_types = $$self{param_types};
|
||||
my $param_types_other = $$objFuncOther{param_types};
|
||||
for ($i = 1; $i < $#$param_types + 1; $i++)
|
||||
{
|
||||
my $type_a = $$param_types[$i];
|
||||
my $type_b = $$param_types_other[$i-1];
|
||||
|
||||
if($self->types_are_equal($type_a, $type_b) ne 1)
|
||||
{
|
||||
# printf("debug: different arg types: %s, %s\n", $type_a, $type_b);
|
||||
return 0; #Different types found.
|
||||
}
|
||||
}
|
||||
|
||||
return 1; #They must all be the same for it to get this far.
|
||||
}
|
||||
|
||||
# bool types_are_equal($a, $b)
|
||||
# Compares types, ignoring gint/int differences, etc.
|
||||
sub types_are_equal($$$)
|
||||
{
|
||||
#TODO: Proper method of getting a normalized type name.
|
||||
|
||||
my ($self, $type_a, $type_b) = @_;
|
||||
|
||||
if($type_a ne $type_b)
|
||||
{
|
||||
#Try adding g to one of them:
|
||||
if( ("g" . $type_a) ne $type_b )
|
||||
{
|
||||
#Try adding g to the other one:
|
||||
if( $type_a ne ("g" . $type_b) )
|
||||
{
|
||||
#After all these checks it's still not equal:
|
||||
return 0; #not equal.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# printf("DEBUG: types are equal: %s, %s\n", $$type_a, $$type_b);
|
||||
return 1; #They must be the same for it to get this far.
|
||||
}
|
||||
|
||||
1; # indicate proper module load.
|
||||
72
squashfs-root/usr/lib/glibmm-2.4/proc/pm/Object.pm
Normal file
72
squashfs-root/usr/lib/glibmm-2.4/proc/pm/Object.pm
Normal file
@@ -0,0 +1,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.
|
||||
1669
squashfs-root/usr/lib/glibmm-2.4/proc/pm/Output.pm
Normal file
1669
squashfs-root/usr/lib/glibmm-2.4/proc/pm/Output.pm
Normal file
File diff suppressed because it is too large
Load Diff
158
squashfs-root/usr/lib/glibmm-2.4/proc/pm/Property.pm
Normal file
158
squashfs-root/usr/lib/glibmm-2.4/proc/pm/Property.pm
Normal file
@@ -0,0 +1,158 @@
|
||||
package Property;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use DocsParser;
|
||||
|
||||
BEGIN {
|
||||
use Exporter ();
|
||||
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
|
||||
|
||||
# set the version for version checking
|
||||
$VERSION = 1.00;
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(&func1 &func2 &func4);
|
||||
%EXPORT_TAGS = ( );
|
||||
# your exported package globals go here,
|
||||
# as well as any optionally exported functions
|
||||
@EXPORT_OK = qw($Var1 %Hashit &func3);
|
||||
}
|
||||
our @EXPORT_OK;
|
||||
|
||||
# class Property
|
||||
# {
|
||||
# string name;
|
||||
# string class;
|
||||
# string type;
|
||||
# bool readable;
|
||||
# bool writable;
|
||||
# bool construct_only;
|
||||
# bool deprecated; # optional
|
||||
# string default_value; # optional
|
||||
# string docs;
|
||||
# }
|
||||
|
||||
|
||||
sub new
|
||||
{
|
||||
my ($def) = @_;
|
||||
my $self = {};
|
||||
bless $self;
|
||||
|
||||
$def=~s/^\(//;
|
||||
$def=~s/\)$//;
|
||||
# snarf down the fields
|
||||
$$self{mark} = 0;
|
||||
$$self{name} = $2 if ($def =~ s/(^define-property|^define-child-property) (\S+)//);
|
||||
$$self{class} = $1 if ($def =~ s/\(of-object "(\S+)"\)//);
|
||||
$$self{type} = $1 if ($def =~ s/\(prop-type "(\S+)"\)//);
|
||||
$$self{readable} = ($1 eq "#t") if ($def =~ s/\(readable (\S+)\)//);
|
||||
$$self{writable} = ($1 eq "#t") if ($def =~ s/\(writable (\S+)\)//);
|
||||
$$self{construct_only} = ($1 eq "#t") if ($def =~ s/\(construct-only (\S+)\)//);
|
||||
$$self{deprecated} = ($1 eq "#t") if ($def =~ s/\(deprecated (\S+)\)//);
|
||||
$$self{default_value} = $1 if ($def =~ s/\(default-value "(.*?)"\)//);
|
||||
$$self{entity_type} = 'property';
|
||||
|
||||
# Property documentation:
|
||||
my $propertydocs = $1 if ($def =~ s/\(docs "([^"]*)"\)//);
|
||||
# Add a full-stop if there is not one already:
|
||||
if(defined($propertydocs))
|
||||
{
|
||||
my $docslen = length($propertydocs);
|
||||
if($docslen)
|
||||
{
|
||||
if( !(substr($propertydocs, $docslen - 1, 1) eq ".") )
|
||||
{
|
||||
$propertydocs = $propertydocs . ".";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$$self{docs} = $propertydocs;
|
||||
|
||||
|
||||
$$self{name} =~ s/-/_/g; # change - to _
|
||||
|
||||
GtkDefs::error("Unhandled property def ($def) in $$self{class}\::$$self{name}\n")
|
||||
if ($def !~ /^\s*$/);
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub dump($)
|
||||
{
|
||||
my ($self) = @_;
|
||||
|
||||
print "<property>\n";
|
||||
|
||||
foreach (keys %$self)
|
||||
{ print " <$_ value=\"$$self{$_}\"/>\n"; }
|
||||
|
||||
print "</property>\n\n";
|
||||
}
|
||||
|
||||
sub get_construct_only($)
|
||||
{
|
||||
my ($self) = @_;
|
||||
return $$self{construct_only};
|
||||
}
|
||||
|
||||
sub get_type($)
|
||||
{
|
||||
my ($self) = @_;
|
||||
return $$self{type};
|
||||
}
|
||||
|
||||
sub get_readable($)
|
||||
{
|
||||
my ($self) = @_;
|
||||
return $$self{readable};
|
||||
}
|
||||
|
||||
sub get_writable($)
|
||||
{
|
||||
my ($self) = @_;
|
||||
return $$self{writable};
|
||||
}
|
||||
|
||||
sub get_deprecated($)
|
||||
{
|
||||
my ($self) = @_;
|
||||
return $$self{deprecated}; # undef, 0 or 1
|
||||
}
|
||||
|
||||
sub get_default_value($)
|
||||
{
|
||||
my ($self) = @_;
|
||||
return $$self{default_value}; # undef or a string (possibly empty)
|
||||
}
|
||||
|
||||
sub get_docs($$)
|
||||
{
|
||||
my ($self, $deprecation_docs, $newin) = @_;
|
||||
my $text = $$self{docs};
|
||||
|
||||
DocsParser::convert_docs_to_cpp("$$self{class}:$$self{name}", \$text);
|
||||
|
||||
#Add note about deprecation if we have specified that in our _WRAP_PROPERTY()
|
||||
#or_WRAP_CHILD_PROPERTY() call:
|
||||
if($deprecation_docs ne "")
|
||||
{
|
||||
$text .= "\n * \@deprecated $deprecation_docs";
|
||||
}
|
||||
|
||||
if ($newin ne "")
|
||||
{
|
||||
$text .= "\n *\n * \@newin{$newin}";
|
||||
}
|
||||
|
||||
if ($text ne "")
|
||||
{
|
||||
DocsParser::add_m4_quotes(\$text);
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
1; # indicate proper module load.
|
||||
112
squashfs-root/usr/lib/glibmm-2.4/proc/pm/Util.pm
Normal file
112
squashfs-root/usr/lib/glibmm-2.4/proc/pm/Util.pm
Normal file
@@ -0,0 +1,112 @@
|
||||
# gtkmm - Util module
|
||||
#
|
||||
# Copyright 2001 Free Software Foundation
|
||||
#
|
||||
# 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, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#
|
||||
# This file holds basic functions used throughout gtkmmproc modules.
|
||||
# Functions in this module are exported so there is no need to
|
||||
# request them by module name.
|
||||
#
|
||||
package Util;
|
||||
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 = qw(&string_unquote &string_trim &string_canonical
|
||||
&trace &unique);
|
||||
%EXPORT_TAGS = ( );
|
||||
|
||||
# your exported package globals go here,
|
||||
# as well as any optionally exported functions
|
||||
#@EXPORT_OK = qw($Var1 %Hashit &func3);
|
||||
}
|
||||
our @EXPORT_OK;
|
||||
|
||||
|
||||
#$ string_unquote($string)
|
||||
# Removes leading and trailing quotes.
|
||||
sub string_unquote($)
|
||||
{
|
||||
my ($str) = @_;
|
||||
|
||||
$str =~ s/^['`"]// ;
|
||||
$str =~ s/['`"]$// ;
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
# $ string_trim($string)
|
||||
# Removes leading and trailing white space.
|
||||
sub string_trim($)
|
||||
{
|
||||
($_) = @_;
|
||||
s/^\s+//;
|
||||
s/\s+$//;
|
||||
return $_;
|
||||
}
|
||||
|
||||
# $ string_canonical($string)
|
||||
# Convert - to _.
|
||||
sub string_canonical($)
|
||||
{
|
||||
($_) = @_;
|
||||
s/-/_/g ; # g means 'replace all'
|
||||
s/\//_/g ; # g means 'replace all'
|
||||
return $_;
|
||||
}
|
||||
|
||||
#
|
||||
# Back tracing utility.
|
||||
# Prints the call stack.
|
||||
#
|
||||
# void trace()
|
||||
sub trace()
|
||||
{
|
||||
my ($package, $filename, $line, $subroutine, $hasargs,
|
||||
$wantarray, $evaltext, $is_require, $hints, $bitmask) = caller(1);
|
||||
|
||||
no warnings qw(uninitialized);
|
||||
|
||||
my $i = 2;
|
||||
print "Trace on ${subroutine} called from ${filename}:${line}\n";
|
||||
while (1)
|
||||
{
|
||||
($package, $filename, $line, $subroutine) = caller($i);
|
||||
$i++;
|
||||
next if ($line eq "");
|
||||
print " From ${subroutine} call from ${filename}:${line}\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub unique(@)
|
||||
{
|
||||
my %hash;
|
||||
foreach (@_)
|
||||
{
|
||||
$hash{$_}=1;
|
||||
}
|
||||
|
||||
return keys %hash;
|
||||
}
|
||||
|
||||
1; # indicate proper module load.
|
||||
|
||||
1821
squashfs-root/usr/lib/glibmm-2.4/proc/pm/WrapParser.pm
Normal file
1821
squashfs-root/usr/lib/glibmm-2.4/proc/pm/WrapParser.pm
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user