Skip to content

Commit

Permalink
daily submit
Browse files Browse the repository at this point in the history
  • Loading branch information
dxma committed Feb 28, 2011
1 parent 055266b commit 1ea5a3f
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 7 deletions.
1 change: 1 addition & 0 deletions PerlQt/module.conf
Expand Up @@ -4,6 +4,7 @@ root_namespace : 'Qt'
default_namespace : 'Qt::Global'
template_filename : _template.unsorted
template_filename_final : _template
root_filename : 'Qt'
skip_includes:
- "QtCore/qsharedpointer_impl.h"

25 changes: 23 additions & 2 deletions PerlQt/script/create_top_dot_xs.pl
Expand Up @@ -74,10 +74,31 @@ sub main {
$header{$meta->{FILE}}++ if exists $meta->{FILE};
}
elsif (/\.typedef$/o) {
( my $m = $_ ) =~ s/\.typedef$/.meta/o;
my $meta = load_yaml($m);
my $class = $meta->{NAME};
my @class = split /\:\:/, $class;
my @path = File::Spec::->splitdir($_);
pop @path;
my $path = File::Spec::->catdir(@path);
my $typedef = load_yaml($_);
foreach my $k (keys %$typedef) {
push @typedef, $typedef->{$k} if
$k =~ /^T_(?:ARRAY|FPOINTER)_/o;
if ($k =~ /^T_(?:ARRAY|FPOINTER)_/o) {
my $v = $typedef->{$k};
if ($class ne $mod_conf->{default_namespace}) {
# subst with full name
for (my $i = $#class; $i >= 0; $i--) {
my $file = File::Spec::->catdir($path, join('__', @class[0..$i]). '.typedef');
next if !-f $file;
my $typedef2 = load_yaml($file);
foreach my $j (keys %$typedef2) {
next if $j eq $k;
$v =~ s/(?<!\:\:)\b\Q$j\E\b/$class. '::'. $j/ge;
}
}
}
push @typedef, $v;
}
}
}
}
Expand Down
27 changes: 22 additions & 5 deletions PerlQt/script/format_qtedi_production.pl
Expand Up @@ -11,8 +11,12 @@
use strict;
#use English qw( -no_match_vars );
use Fcntl qw(O_RDONLY O_WRONLY O_TRUNC O_CREAT);
use File::Spec;

use YAML::Syck qw(Dump Load);

my $filename;

=head1 DESCIPTION
Format production from Parse::QTEDI into more binding-make-specific
Expand Down Expand Up @@ -412,7 +416,7 @@ sub __format_fpointer {
my $fullname = shift;
my @n = split /\:\:/, $fullname;
( my $patched = $n[-1] ) =~
s/^(\*+\s*)(.+)/$1.$FP_TYPE_PREFIX.uc($2)/eio;
s/^(\*+\s*)(.+)/$1.$FP_TYPE_PREFIX.uc($2).'_'.uc($filename)/eio;
my $origin = $2;
return [ join("::", @n[0 .. -1], $patched),
join("::", @n[0 .. -1], $origin)];
Expand Down Expand Up @@ -676,9 +680,20 @@ sub __format_function {
# similar to fpointer
# store variable name in TYPE
# fall decl string in NAME
$pname_with_type =~ s{^(.*?)\b(\w+)\b(\s*\[)}
{$1.$2.' T_ARRAY_'.uc($2).$3}eio;
$ptype = 'T_ARRAY_'. uc($2);
# NOTE: transform char array[] into char *array
if ($pname_with_type =~ /^(.+?)\b(\w+)(\s*\[\])/o) {
$pname_with_type = $1. '* T_ARRAY_'. uc($2);
$ptype = 'T_ARRAY_'. uc($2);
}
elsif ($pname_with_type =~ /^(.+?\*)\s*(\w+)(\s*\[)/o) {
$pname_with_type = $1. ' T_ARRAY_'. uc($2). $3;
$ptype = 'T_ARRAY_'. uc($2);
}
else {
$pname_with_type =~ s{^(.+?)\b(\w+)(\s*\[)}
{$1.$2.' T_ARRAY_'.uc($2).$3}eio;
$ptype = 'T_ARRAY_'. uc($2);
}
$pname = $pname_with_type;
}
else {
Expand Down Expand Up @@ -1317,7 +1332,9 @@ sub main {
usage() unless @ARGV;
my ( $in, $out ) = @ARGV;
die "file not found" unless -f $in;

my @path = File::Spec::->splitdir($in);
$filename = $path[-1];
$filename =~ s/\.yml$//o;
local ( *INPUT );
open INPUT, '<', $in or die "cannot open file: $!";
my $cont = do { local $/; <INPUT>; };
Expand Down

0 comments on commit 1ea5a3f

Please sign in to comment.