in reply to C code pre-processor
#!/usr/bin/perl use strict; use warnings; use Text::CPP; my $MyData = <DATA>; my $reader = new Text::CPP( Language => 'STDC99', Options => {}, Builtins => { foo => 'this', bar => 'that', }, ); $reader->read('/root/Desktop/file.c'); while (my $token = $reader->token) { print "Token: $token\n"; } $reader->data->{MyKey} = $MyData; __DATA__ #ifdef pathtest 38. This should appear. #else #define pathtest 37. This should appear. #include test.txt 39. This should appear. #undef pathtest #endif
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: C code pre-processor
by educated_foo (Vicar) on Feb 03, 2012 at 19:52 UTC | |
by dgsmith_50 (Initiate) on Feb 13, 2012 at 19:23 UTC | |
by educated_foo (Vicar) on Feb 14, 2012 at 03:15 UTC |