/usr/lib/x86_64-linux-gnu/glibmm-2.4/proc/pm/FunctionBase.pm is in libglibmm-2.4-dev 2.42.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | 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.
|