#!/usr/bin/perl open STDIN, "def0.h" or die "def0.h: $!"; print <) { if (/^\s*const_iv\s*\((\S+)\)\s*$/ || /^\s*const_niv\s*\([^,]+,\s*(\S+)\)\s*$/) { print "#ifndef $1\n", "#define $1 0\n", "#endif\n"; } }