Lines Matching refs:function

18 by the B<xsubpp> compiler, each XSUB amounts to a C function definition
23 Perl values to the formats expected by a C function, call this C function,
24 transfers the return values of the C function back to Perl.
26 function arguments that may serve as output parameters. These return
34 from the C function indicates failure, calling different C functions
49 C code and which are not related to a pre-existing C function. In cases
51 declaration is almost identical to a declaration of a C function (in K&R
60 uses B<typemaps> to determine how to map C function parameters
83 function is used to demonstrate many features of the XS language. This
84 function has two parameters; the first is an input parameter and the second
85 is an output parameter. The function also returns a status value.
89 From C this function will be called with the following
97 If an XSUB is created to offer a direct translation between this function
99 The $status and $timep variables will contain the output of the function.
106 function. This XSUB represents a direct translation between
152 function, and the XSUB must always ensure that the real rpcb_gettime()
153 function is called with the correct parameters. This abstraction will
155 function.
163 The following XSUB allows a Perl program to access a C library function
164 called sin(). The XSUB will imitate the C function which takes a single
203 The function name and the return type must be placed on
212 The rest of the function description may be indented or left-adjusted. The
213 following example shows a function with its body left-adjusted. Most
225 descriptions of the return type and the names of the function and its
240 function will be referred to as position 0 for that function.
244 function would be known to the XSUB as ST(0). The XSUB's incoming
254 function. The B<xsubpp> compiler will declare this variable in each XSUB
255 with non-C<void> return type. By default the generated C function
256 will use RETVAL to hold the return value of the C library function being
262 not declare a RETVAL variable for that function. When using
342 bootstrap function which is used to hook the XSUBs into Perl. The package
343 name of this bootstrap function will match the value of the last MODULE
381 removed from the Perl function names. If the C function is
383 see this function as C<gettime()>.
395 The OUTPUT: keyword indicates that certain function parameters should be
397 certain values should be returned to the calling Perl function. For
399 such as the sin() function above, the RETVAL variable is
410 The OUTPUT: keyword can also be used to indicate that function parameters
412 modified within the function and the programmer would like the update to
456 user-supplied code. It is especially useful to make a function interface
466 Here the generated XS function returns nothing on success, and will die()
472 special handling for the C function. The RETVAL variable is
476 The following XSUB is for a C function which requires special handling of
496 the compiler generates the call to the C function. Unlike the CODE: keyword
509 making a call to the C function:
523 The NO_INIT keyword is used to indicate that a function
526 all function parameters from the argument stack and assign
527 them to C variables upon entry to the function. NO_INIT
530 before the function terminates.
532 The following example shows a variation of the rpcb_gettime() function.
533 This function uses the timep variable only as an output variable and does
545 C function parameters are normally initialized with their values from
557 function parameters. The initialization code is eval'd within double
571 would normally use this when a function parameter must be processed by
572 another library function before it can be used. Default parameters are
613 XSUB will then call the real rpcb_gettime() function with
622 block is used to call the real rpcb_gettime() function with
623 the parameters in the correct order for that function.
832 signature of the generated Perl function.
835 parameters to the Perl function. With the exception of
838 function. It is expected that the C function will write through these
841 The return list of the generated Perl function consists of the C return value
842 from the function (unless the XSUB is of C<void> return type or
846 modified to have the values written by the C function.
860 The C signature of the corresponding function should be
875 the only difference being that the value C function writes through the
881 being read (and not being given to the C function - which gets some
882 garbage instead). For example, the same C function as above can be
898 However, the generated Perl function is called in very C-ish style:
905 If one of the input arguments to the C function is the length of a string
908 the generated Perl function is called. E.g.,
926 This directive is supported with ANSI-type function declarations only.
967 put as the argument to the called C function without any change.
969 For example, suppose that a C function is declared as
971 symbolic nth_derivative(int n, symbolic function, int flags);
977 $second_deriv = $function->nth_derivative(2);
982 nth_derivative(function, n)
983 symbolic function
986 n, function, default_flags
1002 entry to the XSUB: SP is on the function pointer (which follows the
1010 return value of the C function, and heuristics mentioned in
1018 The following XSUB will call the C rpcb_gettime() function
1035 to have the real rpcb_gettime() function called and to have
1038 The C<void> return type for this function tells the B<xsubpp> compiler that
1050 Now the rpcb_gettime() function can be used from Perl with
1061 C<undef> or an empty list if a function fails rather than a
1062 separate status value. The rpcb_gettime() function offers
1063 just this situation. If the function succeeds we would like
1185 function. The bootstrap function is generated by the B<xsubpp> compiler and
1188 statements to the bootstrap function.
1196 # bootstrap function executes.
1272 C<BAR::getit()> for this function.
1292 for the nomethod() function which needs four parameters). If any
1293 function has the OVERLOAD: keyword, several additional lines
1302 To use the OVERLOAD: keyword, create an XS function which takes
1312 { /* function defined here */}
1314 In this case, the function will overload both of the three way
1360 Perl function share names with corresponding C functions.
1363 is no need to code a switch statement, each Perl function (which shares
1364 the same XSUB) knows which C function it should call. Additionally, one
1365 can attach an extra function remainder() at runtime by using
1378 to extract a function pointer from an XSUB. The text which follows
1380 function pointer. The extractor macro is given return type, C<CV*>,
1382 and the function pointer.
1419 The file F<Rpcb1.xsh> contains our C<rpcb_gettime()> function:
1449 example shows CASE switched via C<ix> with a function C<rpcb_gettime()>
1450 having an alias C<x_gettime()>. When the function is called as
1452 but when the function is called as C<x_gettime()> its parameters are
1477 That function can be called with either of the following statements. Note
1488 of C<&>, but provide a pointer to this value when the C function is called.
1490 This is useful to avoid a CODE: block for a C function which takes a parameter
1509 C<&> through, so the function call looks like C<rpcb_gettime(host, &timep)>.
1539 versions of a function, use
1553 definition of the function. Also, put a blank line before the
1554 #else/#endif so it will not be seen as part of the function body.
1559 The generated Perl function will assume that
1562 have been created by C++ with the new() function and should
1569 function using the class::method() syntax. If the method is not static
1570 the function will be called using the THIS-E<gt>method() syntax.
1618 If the function's name is B<DESTROY> then the C++ C<delete> function will be
1630 If the function's name is B<new> then the C++ C<new> function will be called
1668 very C-like and occasionally nonintuitive, especially when the C function
1680 failure may be detected without a call to the C function, you may want to use
1682 function returns one may want to use a POSTCALL: section to process the
1696 themselves, say, when a parameter to a function should be a contents of a
1701 Identify the pointers in the C function parameter lists and return
1731 The following XS code shows the getnetconfigent() function which is used
1732 with ONC+ TIRPC. The getnetconfigent() function will return a pointer to a
1738 Destructors in XS can be created by specifying an XSUB function whose name
1781 object to the supplied XSUB DESTROY function. Perl cannot determine, and
1789 compiler to map C function parameters and values to Perl values. The