.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "FFI::Platypus::API 3pm" .TH FFI::Platypus::API 3pm "2019-02-13" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" FFI::Platypus::API \- Platypus arguments and return value API for custom types .SH "VERSION" .IX Header "VERSION" version 0.83 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& package FFI::Platypus::Type::MyCustomType; \& \& use FFI::Platypus::API; \& \& sub ffi_custom_type_api_1 \& { \& { \& native_type => \*(Aquint32\*(Aq, \& perl_to_native => sub { \& my($value, $i) = @_; \& # Translates ($value) passed in from Perl \& # into ($value+1, $value+2) \& arguments_set_uint32($i, $value+1); \& arguments_set_uint32($i+1, $value+2); \& }, \& argument_count => 2, \& } \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The custom types \s-1API\s0 for FFI::Platypus allows you to set multiple C arguments from a single Perl argument as a common type. This is sometimes useful for pointer / size pairs which are a common pattern in C, but are usually represented by a single value (a string scalar) in Perl. .PP The custom type \s-1API\s0 is somewhat experimental, and you should expect some changes as needs arise (I won't break compatibility lightly, however). .SH "FUNCTIONS" .IX Header "FUNCTIONS" These functions are only valid within a custom type callback. .SS "arguments_count" .IX Subsection "arguments_count" .Vb 1 \& my $count = argument_count; .Ve .PP Returns the total number of native arguments. .SS "arguments_get_sint8" .IX Subsection "arguments_get_sint8" .Vb 1 \& my $sint8 = arguments_get_sint8 $i; .Ve .PP Get the 8 bit signed integer argument from position \fI\f(CI$i\fI\fR. .SS "arguments_set_sint8" .IX Subsection "arguments_set_sint8" .Vb 1 \& arguments_set_sint8 $i, $sint8; .Ve .PP Set the 8 bit signed integer argument at position \fI\f(CI$i\fI\fR to \fI\f(CI$sint8\fI\fR. .SS "arguments_get_uint8" .IX Subsection "arguments_get_uint8" .Vb 1 \& my $uint8 = arguments_get_uint8 $i; .Ve .PP Get the 8 bit unsigned integer argument from position \fI\f(CI$i\fI\fR. .SS "arguments_set_uint8" .IX Subsection "arguments_set_uint8" .Vb 1 \& arguments_set_uint8 $i, $uint8; .Ve .PP Set the 8 bit unsigned integer argument at position \fI\f(CI$i\fI\fR to \fI\f(CI$uint8\fI\fR. .SS "arguments_get_sint16" .IX Subsection "arguments_get_sint16" .Vb 1 \& my $sint16 = arguments_get_sint16 $i; .Ve .PP Get the 16 bit signed integer argument from position \fI\f(CI$i\fI\fR. .SS "arguments_set_sint16" .IX Subsection "arguments_set_sint16" .Vb 1 \& arguments_set_sint16 $i, $sint16; .Ve .PP Set the 16 bit signed integer argument at position \fI\f(CI$i\fI\fR to \fI\f(CI$sint16\fI\fR. .SS "arguments_get_uint16" .IX Subsection "arguments_get_uint16" .Vb 1 \& my $uint16 = arguments_get_uint16 $i; .Ve .PP Get the 16 bit unsigned integer argument from position \fI\f(CI$i\fI\fR. .SS "arguments_set_uint16" .IX Subsection "arguments_set_uint16" .Vb 1 \& arguments_set_uint16 $i, $uint16; .Ve .PP Set the 16 bit unsigned integer argument at position \fI\f(CI$i\fI\fR to \fI\f(CI$uint16\fI\fR. .SS "arguments_get_sint32" .IX Subsection "arguments_get_sint32" .Vb 1 \& my $sint32 = arguments_get_sint32 $i; .Ve .PP Get the 32 bit signed integer argument from position \fI\f(CI$i\fI\fR. .SS "arguments_set_sint32" .IX Subsection "arguments_set_sint32" .Vb 1 \& arguments_set_sint32 $i, $sint32; .Ve .PP Set the 32 bit signed integer argument at position \fI\f(CI$i\fI\fR to \fI\f(CI$sint32\fI\fR. .SS "arguments_get_uint32" .IX Subsection "arguments_get_uint32" .Vb 1 \& my $uint32 = arguments_get_uint32 $i; .Ve .PP Get the 32 bit unsigned integer argument from position \fI\f(CI$i\fI\fR. .SS "arguments_set_uint32" .IX Subsection "arguments_set_uint32" .Vb 1 \& arguments_set_uint32 $i, $uint32; .Ve .PP Set the 32 bit unsigned integer argument at position \fI\f(CI$i\fI\fR to \fI\f(CI$uint32\fI\fR. .SS "arguments_get_sint64" .IX Subsection "arguments_get_sint64" .Vb 1 \& my $sint64 = arguments_get_sint64 $i; .Ve .PP Get the 64 bit signed integer argument from position \fI\f(CI$i\fI\fR. .SS "arguments_set_sint64" .IX Subsection "arguments_set_sint64" .Vb 1 \& arguments_set_sint64 $i, $sint64; .Ve .PP Set the 64 bit signed integer argument at position \fI\f(CI$i\fI\fR to \fI\f(CI$sint64\fI\fR. .SS "arguments_get_uint64" .IX Subsection "arguments_get_uint64" .Vb 1 \& my $uint64 = arguments_get_uint64 $i; .Ve .PP Get the 64 bit unsigned integer argument from position \fI\f(CI$i\fI\fR. .SS "arguments_set_uint64" .IX Subsection "arguments_set_uint64" .Vb 1 \& arguments_set_uint64 $i, $uint64; .Ve .PP Set the 64 bit unsigned integer argument at position \fI\f(CI$i\fI\fR to \fI\f(CI$uint64\fI\fR. .SS "arguments_get_float" .IX Subsection "arguments_get_float" .Vb 1 \& my $float = arguments_get_float $i; .Ve .PP Get the floating point argument from position \fI\f(CI$i\fI\fR. .SS "arguments_set_float" .IX Subsection "arguments_set_float" .Vb 1 \& arguments_set_float $i, $float; .Ve .PP Set the floating point argument at position \fI\f(CI$i\fI\fR to \fI\f(CI$float\fI\fR .SS "arguments_get_double" .IX Subsection "arguments_get_double" .Vb 1 \& my $double = arguments_get_double $i; .Ve .PP Get the double precision floating point argument from position \fI\f(CI$i\fI\fR. .SS "arguments_set_double" .IX Subsection "arguments_set_double" .Vb 1 \& arguments_set_double $i, $double; .Ve .PP Set the double precision floating point argument at position \fI\f(CI$i\fI\fR to \&\fI\f(CI$double\fI\fR .SS "arguments_get_pointer" .IX Subsection "arguments_get_pointer" .Vb 1 \& my $pointer = arguments_get_pointer $i; .Ve .PP Get the pointer argument from position \fI\f(CI$i\fI\fR. .SS "arguments_set_pointer" .IX Subsection "arguments_set_pointer" .Vb 1 \& arguments_set_pointer $i, $pointer; .Ve .PP Set the pointer argument at position \fI\f(CI$i\fI\fR to \fI\f(CI$pointer\fI\fR. .SS "arguments_get_string" .IX Subsection "arguments_get_string" .Vb 1 \& my $string = arguments_get_string $i; .Ve .PP Get the string argument from position \fI\f(CI$i\fI\fR. .SS "arguments_set_string" .IX Subsection "arguments_set_string" .Vb 1 \& arguments_set_string $i, $string; .Ve .PP Set the string argument at position \fI\f(CI$i\fI\fR to \fI\f(CI$string\fI\fR. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "FFI::Platypus" 4 .IX Item "FFI::Platypus" .PP Examples of use: .IP "FFI::Platypus::Type::PointerSizeBuffer" 4 .IX Item "FFI::Platypus::Type::PointerSizeBuffer" .SH "AUTHOR" .IX Header "AUTHOR" Author: Graham Ollis .PP Contributors: .PP Bakkiaraj Murugesan (bakkiaraj) .PP Dylan Cali (calid) .PP pipcet .PP Zaki Mughal (zmughal) .PP Fitz Elliott (felliott) .PP Vickenty Fesunov (vyf) .PP Gregor Herrmann (gregoa) .PP Shlomi Fish (shlomif) .PP Damyan Ivanov .PP Ilya Pavlov (Ilya33) .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2015,2016,2017,2018,2019 by Graham Ollis. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.