Alt-Acme-Math-XS-ModuleInstall
view release on metacpan or search on metacpan
inc/Inline.pm view on Meta::CPAN
}
else {
croak M02_usage();
}
$o->glue;
}
#==============================================================================
# Run time version of import (public method)
#==============================================================================
sub bind {
local ($/, $") = ("\n", ' '); local ($\, $,);
my ($code, @config);
my $o;
my ($pkg, $script) = caller;
my $class = shift;
croak M03_usage_bind() unless $class eq 'Inline';
$CONFIG{$pkg}{template} ||= $default_config;
my $language_id = shift or croak M03_usage_bind();
croak M03_usage_bind()
unless ($language_id =~ /^\S+$/ and $language_id !~ /\n/);
$code = shift or croak M03_usage_bind();
@config = @_;
my $next = 0;
for (@config) {
next if $next++ % 2;
croak M03_usage_bind() if /[\s\n]/;
}
$o = bless {}, $class;
$o->{INLINE}{version} = $VERSION;
$o->{API}{pkg} = $pkg;
$o->{API}{script} = $script;
$o->{API}{language_id} = $language_id;
$o->receive_code($code);
$o->{CONFIG} = handle_language_config(@config);
$o->glue;
inc/Inline.pm view on Meta::CPAN
# This is broken ????????????????????????????????????????????????????
$usage .= <<END if defined $Inline::languages;
Supported languages:
${\ join(', ', sort keys %$Inline::languages)}
END
return $usage;
}
sub M03_usage_bind {
my $usage = <<END;
Invalid usage of the Inline->bind() function. Valid usages are:
Inline->bind(language => "source-string", config-pair-list);
Inline->bind(language => "source-file", config-pair-list);
Inline->bind(language => [source-line-list], config-pair-list);
END
$usage .= <<END if defined $Inline::languages;
Supported languages:
${\ join(', ', sort keys %$Inline::languages)}
END
return $usage;
}
inc/Inline/C.pm view on Meta::CPAN
require FindBin;
$file = File::Spec->catfile($FindBin::Bin,"typemap");
if ( -f $file ) {
push(@{$o->{ILSM}{MAKEFILE}{TYPEMAPS}}, $file);
}
}
}
#==============================================================================
# This routine parses XS typemap files to get a list of valid types to create
# bindings to. This code is mostly hacked out of Larry Wall's xsubpp program.
#==============================================================================
sub get_types {
my (%type_kind, %proto_letter, %input_expr, %output_expr);
my $o = shift;
local $_;
croak "No typemaps specified for Inline C code"
unless @{$o->{ILSM}{MAKEFILE}{TYPEMAPS}};
my $proto_re = "[" . quotemeta('\$%&*@;') . "]";
foreach my $typemap (@{$o->{ILSM}{MAKEFILE}{TYPEMAPS}}) {
inc/Inline/C.pm view on Meta::CPAN
#==============================================================================
# Generate the XS glue code (piece together lots of snippets)
#==============================================================================
sub xs_generate {
my $o = shift;
return join '', (
$o->xs_includes,
$o->xs_struct_macros,
$o->xs_code,
$o->xs_struct_code,
$o->xs_bindings,
$o->xs_boot,
);
}
sub xs_includes {
my $o = shift;
return $o->{ILSM}{AUTO_INCLUDE};
}
sub xs_struct_macros {
inc/Inline/C.pm view on Meta::CPAN
my $o = shift;
if (defined $o->{ILSM}{XS}{BOOT} and $o->{ILSM}{XS}{BOOT}) {
return <<END;
BOOT:
$o->{ILSM}{XS}{BOOT}
END
}
return '';
}
sub xs_bindings {
my $o = shift;
my $dir = $o->{API}{directory};
if ($o->{CONFIG}{_TESTING}) {
my $file = "$dir/void_test";
if (! -f $file) {
warn "$file: $!" if !open(TEST_FH, '>', $file);
warn "$file: $!" if !close(TEST_FH);
}
}
( run in 0.927 second using v1.01-cache-2.11-cpan-df04353d9ac )