=head1 NAME ExtUtils::ParseXS::Utilities - Subroutines used with ExtUtils::ParseXS =head1 SYNOPSIS use ExtUtils::ParseXS::Utilities qw( standard_typemap_locations trim_whitespace tidy_type C_string valid_proto_string process_typemaps make_targetable map_type standard_XS_defs assign_func_args analyze_preprocessor_statements set_cond Warn blurt death check_conditional_preprocessor_statements escape_file_for_line_directive report_typemap_failure ); =head1 SUBROUTINES The following functions are not considered to be part of the public interface. They are documented here for the benefit of future maintainers of this module. =head2 C =over 4 =item * Purpose Provide a list of filepaths where F files may be found. The filepaths -- relative paths to files (not just directory paths) -- appear in this list in lowest-to-highest priority. The highest priority is to look in the current directory. 'typemap' The second and third highest priorities are to look in the parent of the current directory and a directory called F underneath the parent directory. '../typemap', '../lib/ExtUtils/typemap', The fourth through ninth highest priorities are to look in the corresponding grandparent, great-grandparent and great-great-grandparent directories. '../../typemap', '../../lib/ExtUtils/typemap', '../../../typemap', '../../../lib/ExtUtils/typemap', '../../../../typemap', '../../../../lib/ExtUtils/typemap', The tenth and subsequent priorities are to look in directories named F which are subdirectories of directories found in C<@INC> -- I a file named F actually exists in such a directory. Example: '/usr/local/lib/perl5/5.10.1/ExtUtils/typemap', However, these filepaths appear in the list returned by C in reverse order, I, lowest-to-highest. '/usr/local/lib/perl5/5.10.1/ExtUtils/typemap', '../../../../lib/ExtUtils/typemap', '../../../../typemap', '../../../lib/ExtUtils/typemap', '../../../typemap', '../../lib/ExtUtils/typemap', '../../typemap', '../lib/ExtUtils/typemap', '../typemap', 'typemap' =item * Arguments my @stl = standard_typemap_locations( \@INC ); Reference to C<@INC>. =item * Return Value Array holding list of directories to be searched for F files. =back =cut =head2 C =over 4 =item * Purpose Perform an in-place trimming of leading and trailing whitespace from the first argument provided to the function. =item * Argument trim_whitespace($arg); =item * Return Value None. Remember: this is an I modification of the argument. =back =cut =head2 C =over 4 =item * Purpose Rationalize any asterisks (C<*>) by joining them into bunches, removing interior whitespace, then trimming leading and trailing whitespace. =item * Arguments ($ret_type) = tidy_type($_); String to be cleaned up. =item * Return Value String cleaned up. =back =cut =head2 C =over 4 =item * Purpose Escape backslashes (C<\>) in prototype strings. =item * Arguments $ProtoThisXSUB = C_string($_); String needing escaping. =item * Return Value Properly escaped string. =back =cut =head2 C =over 4 =item * Purpose Validate prototype string. =item * Arguments String needing checking. =item * Return Value Upon success, returns the same string passed as argument. Upon failure, returns C<0>. =back =cut =head2 C =over 4 =item * Purpose Process all typemap files. =item * Arguments my $typemaps_object = process_typemaps( $args{typemap}, $pwd ); List of two elements: C element from C<%args>; current working directory. =item * Return Value Upon success, returns an L object. =back =cut =head2 C =over 4 =item * Purpose Populate C<%targetable>. This constitutes a refinement of the output of C with respect to its fourth output, C<$output_expr_ref>. =item * Arguments %targetable = make_targetable($output_expr_ref); Single hash reference: the fourth such ref returned by C. =item * Return Value Hash. =back =cut =head2 C =over 4 =item * Purpose Performs a mapping at several places inside C loop. =item * Arguments $type = map_type($self, $type, $varname); List of three arguments. =item * Return Value String holding augmented version of second argument. =back =cut =head2 C =over 4 =item * Purpose Writes to the C<.c> output file certain preprocessor directives and function headers needed in all such files. =item * Arguments None. =item * Return Value Returns true. =back =cut =head2 C =over 4 =item * Purpose Perform assignment to the C attribute. =item * Arguments $string = assign_func_args($self, $argsref, $class); List of three elements. Second is an array reference; third is a string. =item * Return Value String. =back =cut =head2 C =over 4 =item * Purpose Within each function inside each Xsub, print to the F<.c> output file certain preprocessor statements. =item * Arguments ( $self, $XSS_work_idx, $BootCode_ref ) = analyze_preprocessor_statements( $self, $statement, $XSS_work_idx, $BootCode_ref ); List of four elements. =item * Return Value Modifed values of three of the arguments passed to the function. In particular, the C and C attributes are modified. =back =cut =head2 C =over 4 =item * Purpose =item * Arguments =item * Return Value =back =cut =head2 C =over 4 =item * Purpose Figures out the current line number in the XS file. =item * Arguments C<$self> =item * Return Value The current line number. =back =cut =head2 C =over 4 =item * Purpose =item * Arguments =item * Return Value =back =cut =head2 C =over 4 =item * Purpose =item * Arguments =item * Return Value =back =cut =head2 C =over 4 =item * Purpose =item * Arguments =item * Return Value =back =cut =head2 C =over 4 =item * Purpose =item * Arguments =item * Return Value =back =cut =head2 C =over 4 =item * Purpose Escapes a given code source name (typically a file name but can also be a command that was read from) so that double-quotes and backslashes are escaped. =item * Arguments A string. =item * Return Value A string with escapes for double-quotes and backslashes. =back =cut =head2 C =over 4 =item * Purpose Do error reporting for missing typemaps. =item * Arguments The C object. An C object. The string that represents the C type that was not found in the typemap. Optionally, the string C or C to choose whether the error is immediately fatal or not. Default: C =item * Return Value Returns nothing. Depending on the arguments, this may call C or C, the former of which is fatal. =back =cut