NAME

C::Blocks::Filter - base package for writing filters for C::Blocks

SYNOPSIS

# If you want to print out the code as it is sent
# to the C compiler:

use strict;
use warnings;
use C::Blocks;
use C::Blocks::Filter;

cblock {
    ... /* this code will be printed */
}


# If you want to write your own filter

package My::Filter;
use C::Blocks::Filter ();
our @ISA = qw(C::Blocks::Filter);

sub c_blocks_filter {
    # Modify $_ directly. Allow a new 'keyword'
    # called 'loop':
    s/loop/for/g;
}

# Then in another bit of code using this:
use strict;
use warnings;
use C::Blocks;
use My::Filter;

cblock {
    int i;
    for (i = 0; i < 10; i++) {
        printf("i = %d\n", i);
    }
    loop (i = 0; i < 10; i++) {
        printf("i = %d\n", i);
    }
}