App-s2p

 view release on metacpan or  search on metacpan

script/s2p  view on Meta::CPAN



# append optional functions, prepend prototypes
#
my $Proto = "# prototypes\n";
if( $GenKey{'l'} ){
    $Proto .= "sub _l();\n";
    $Func .= <<'[TheEnd]';
# _l: l command processing
#
sub _l(){
    my $h = $_;
    my $mcpl = 70;
    # transform non printing chars into escape notation
    $h =~ s/\\/\\\\/g;
    if( $h =~ /[^[:print:]]/ ){
	$h =~ s/\a/\\a/g;
	$h =~ s/\f/\\f/g;
	$h =~ s/\n/\\n/g;
	$h =~ s/\t/\\t/g;
	$h =~ s/\r/\\r/g;

script/s2p  view on Meta::CPAN

}

[TheEnd]
}

if( $GenKey{'r'} ){
    $Proto .= "sub _r(\$);\n";
    $Func .= <<'[TheEnd]';
# _r: r command processing: Save a reference to the pathname.
#
sub _r($){
    my $path = shift();
    push( @Q, \$path );
}

[TheEnd]
}

if( $GenKey{'t'} ){
    $Proto .= "sub _t();\n";
    $Func .= <<'[TheEnd]';
# _t: t command - condition register test/reset
#
sub _t(){
    my $res = $CondReg;
    $CondReg = 0;
    $res;
}

[TheEnd]
}

if( $GenKey{'w'} ){
    $Proto .= "sub _w(\$);\n";
    $Func .= <<'[TheEnd]';
# _w: w command and s command's w flag - write to file
#
sub _w($){
    my $path   = shift();
    my $handle = $wFiles{$path};
    if( ! $doOpenWrite && ! defined( fileno( $handle ) ) ){
	open( $handle, ">$path" )
	|| die( "$0: $path: cannot open ($!)\n" );
    }
    print $handle $_, "\n";
}

[TheEnd]



( run in 0.490 second using v1.01-cache-2.11-cpan-63c85eba8c4 )