Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

imager::preprocess(3pm) [debian man page]

Imager::Preprocess(3pm) 				User Contributed Perl Documentation				   Imager::Preprocess(3pm)

NAME
Imager::Preprocess - simple preprocessor for handling multiple sample sizes SYNOPSIS
/* in the source: */ #code condition true to work with 8-bit samples ... code using preprocessor types/values ... #/code # process and make #line directives perl -MImager::Preprocess -epreprocess foo.im foo.c # process and no #line directives perl -MImager::Preprocess -epreprocess -l foo.im foo.c DESCRIPTION
This is a simple preprocessor that aims to reduce duplication of source code when implementing an algorithm both for 8-bit samples and double samples in Imager. Imager's "Makefile.PL" currently scans the MANIFEST for .im files and adds Makefile files to convert these to .c files. The beginning of a sample-independent section of code is preceded by: #code expression where expression should return true if processing should be done at 8-bits/sample. You can also use a #code block around a function definition to produce 8-bit and double sample versions of a function. In this case #code has no expression and you will need to use IM_SUFFIX() to produce different function names. The end of a sample-independent section of code is terminated by: #/code #code sections cannot be nested. #/code without a starting #code is an error. The following types and values are defined in a #code section: o IM_GPIX("im", "x", "y", &col) o IM_GLIN("im", "l", "r", "y", "colors") o IM_PPIX("im", "x", "y", &col) o IM_PLIN("im", "x", "y", "colors") o IM_GSAMP("im", "l", "r", "y", "samples", "chans", "chan_count") These correspond to the appropriate image function, eg. IM_GPIX() becomes i_gpix() or i_gpixf() as appropriate. o IM_ADAPT_COLORS("dest_channels", "src_channels", "colors", "count") Call i_adapt_colors() or i_adapt_fcolors(). o IM_FILL_COMBINE("fill") - retrieve the combine function from a fill object. o IM_FILL_FILLER("fill") - retrieve the fill_with_* function from a fill object. o IM_SAMPLE_MAX - maximum value for a sample o IM_SAMPLE_MAX2 - maximum value for a sample, squared o IM_SAMPLE_T - type of a sample (i_sample_t or i_fsample_t) o IM_COLOR - color type, either i_color or i_fcolor. o IM_WORK_T - working sample type, either int or double. o IM_Sf - format string for the sample type, "%d" or "%f". o IM_Wf - format string for the work type, "%d" or "%f". o IM_SUFFIX(identifier) - adds _8 or _double onto the end of identifier. o IM_EIGHT_BIT - this is a macro defined only in 8-bit/sample code. Other types, functions and values may be added in the future. AUTHOR
Tony Cook <tonyc@cpan.org> perl v5.14.2 2011-06-06 Imager::Preprocess(3pm)

Check Out this Related Man Page

Text::Template::Preprocess(3pm) 			User Contributed Perl Documentation			   Text::Template::Preprocess(3pm)

NAME
Text::Template::Preprocess - Expand template text with embedded Perl VERSION
This file documents "Text::Template::Preprocess" version 1.45 SYNOPSIS
use Text::Template::Preprocess; my $t = Text::Template::Preprocess->new(...); # identical to Text::Template # Fill in template, but preprocess each code fragment with pp(). my $result = $t->fill_in(..., PREPROCESSOR => &pp); my $old_pp = $t->preprocessor(&new_pp); DESCRIPTION
"Text::Template::Preprocess" provides a new "PREPROCESSOR" option to "fill_in". If the "PREPROCESSOR" option is supplied, it must be a reference to a preprocessor subroutine. When filling out a template, "Text::Template::Preprocessor" will use this subroutine to preprocess the program fragment prior to evaluating the code. The preprocessor subroutine will be called repeatedly, once for each program fragment. The program fragment will be in $_. The subroutine should modify the contents of $_ and return. "Text::Template::Preprocess" will then execute contents of $_ and insert the result into the appropriate part of the template. "Text::Template::Preprocess" objects also support a utility method, "preprocessor()", which sets a new preprocessor for the object. This preprocessor is used for all subsequent calls to "fill_in" except where overridden by an explicit "PREPROCESSOR" option. "preprocessor()" returns the previous default preprocessor function, or undefined if there wasn't one. When invoked with no arguments, "preprocessor()" returns the object's current default preprocessor function without changing it. In all other respects, "Text::Template::Preprocess" is identical to "Text::Template". WHY
? One possible purpose: If your files contain a lot of JavaScript, like this: Plain text here... { perl code } <script language=JavaScript> if (br== "n3") { // etc. } </script> { more perl code } More plain text... You don't want "Text::Template" to confuse the curly braces in the JavaScript program with executable Perl code. One strategy: sub quote_scripts { s(<script(.*?)</script>)(q{$1})gsi; } Then use "PREPROCESSOR => &quote_scripts". This will transform SEE ALSO
Text::Template AUTHOR
Mark-Jason Dominus, Plover Systems Please send questions and other remarks about this software to "mjd-perl-template+@plover.com" You can join a very low-volume (<10 messages per year) mailing list for announcements about this package. Send an empty note to "mjd-perl-template-request@plover.com" to join. For updates, visit "http://www.plover.com/~mjd/perl/Template/". LICENSE
Text::Template::Preprocess version 1.45 Copyright (C) 2008 Mark Jason Dominus This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. You may also can redistribute it and/or modify it under the terms of the Perl Artistic License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. perl v5.10.1 2008-04-16 Text::Template::Preprocess(3pm)
Man Page