Merge pull request #26 from aewag/develop
[tomsfastmath.git] / filter.pl
blob6313f754955eb08f5c6e39a8772ceda629908d1e
1 #!/usr/bin/perl
3 # we want to filter every between START_INS and END_INS out and then insert crap from another file (this is fun)
5 # SPDX-License-Identifier: Unlicense
7 $dst = shift;
8 $ins = shift;
10 open(SRC,"<$dst");
11 open(INS,"<$ins");
12 open(TMP,">tmp.delme");
14 $l = 0;
15 while (<SRC>) {
16 if ($_ =~ /START_INS/) {
17 print TMP $_;
18 $l = 1;
19 while (<INS>) {
20 print TMP $_;
22 close INS;
23 } elsif ($_ =~ /END_INS/) {
24 print TMP $_;
25 $l = 0;
26 } elsif ($l == 0) {
27 print TMP $_;
31 close TMP;
32 close SRC;