# -*- mode: Awk; -*- vim: set filetype=awk : define(xpand,`ifelse($#,2,`$1_$2',`$1_$2,xpand($1,shift(shift($@)))')') #define(fields,`name,age,shoesize') #define(class,Apple) #define(class,`xpand($1,fields) define(_$1,`xpand($1,fields)')') define(def,`define($1,`xpand($`'1,`$2') define(_$`'1,`xpand($`'1,`$2')')')') #def Apple name,age,shoesize function name(a,b,c,Apple(x)) { x_name="/dev/stdin" x_age="%.*" x_white="[ \t]" call(_x) } function slurp (Apple,act) { while ( (getline < _in) > 0) { gsub(_comment,"") gsub(_white,"") if ($0) @act(w,$0); } close(_in) } dumpdef