Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
handle/add longlong and ulonglong in NativeCall
  • Loading branch information
FROGGS committed Apr 4, 2015
1 parent df5acd2 commit 1c1e9a3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/NativeCall.pm
Expand Up @@ -21,6 +21,7 @@ sub param_hash_for(Parameter $p, :$with-typeobj) {
my Mu $result := nqp::hash();
my $type := $p.type();
nqp::bindkey($result, 'typeobj', nqp::decont($type)) if $with-typeobj;
nqp::bindkey($result, 'rw', nqp::unbox_i(1)) if $p.rw;
if $type ~~ Str {
my $enc := $p.?native_call_encoded() || 'utf8';
nqp::bindkey($result, 'type', nqp::unbox_s(string_encoding_to_nci_type($enc)));
Expand Down Expand Up @@ -67,8 +68,10 @@ sub return_hash_for(Signature $s, &r?, :$with-typeobj) {
$result
}

my native long is Int is ctype("long") is repr("P6int") is export(:types, :DEFAULT) { };
my native longlong is Int is ctype("longlong") is repr("P6int") is export(:types, :DEFAULT) { };
my native long is Int is ctype("long") is repr("P6int") is export(:types, :DEFAULT) { };
my native longlong is Int is ctype("longlong") is repr("P6int") is export(:types, :DEFAULT) { };
my native ulong is Int is ctype("long") is unsigned is repr("P6int") is export(:types, :DEFAULT) { };
my native ulonglong is Int is ctype("longlong") is unsigned is repr("P6int") is export(:types, :DEFAULT) { };
my class void is repr('Uninstantiable') is export(:types, :DEFAULT) { };
# Expose a Pointer class for working with raw pointers.
my class Pointer is repr('CPointer') is export(:types, :DEFAULT) { };
Expand Down Expand Up @@ -133,13 +136,15 @@ my %type_map =
'int64' => 'longlong',
'long' => 'long',
'int' => 'long',
'longlong' => 'longlong',
'Int' => 'longlong',
'uint8' => 'uchar',
'uint16' => 'ushort',
'uint32' => 'uint',
'uint64' => 'ulonglong',
'ulonglong' => 'ulonglong',
'ulong' => 'ulong',
'uint' => 'ulong',
'Int' => 'longlong',
'num32' => 'float',
'num64' => 'double',
'num' => 'double',
Expand Down

0 comments on commit 1c1e9a3

Please sign in to comment.