make.ops 317 B

123456789101112131415161718
  1. awk '
  2. BEGIN { n = 0 }
  3. { print "#define " $1 " " n; n++
  4. if ($3 !~ /0/) print "extern int " $3 "();" ;
  5. }
  6. ' < $1 > ops.h
  7. cat > ops.c <<'EOF'
  8. #include "operator.h"
  9. #include "ops.h"
  10. t_operator operators[] = {
  11. EOF
  12. awk ' { print "{ " $2 ", " $3 "}, /* " $1 " */" }' < $1 >> ops.c
  13. cat >> ops.c <<'EOF'
  14. { 0, 0 }
  15. };
  16. EOF