mygen.py 439 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env python3
  2. import sys, os
  3. if len(sys.argv) != 3:
  4. print("You is fail.")
  5. sys.exit(1)
  6. with open(sys.argv[1]) as f:
  7. val = f.read().strip()
  8. outdir = sys.argv[2]
  9. outhdr = os.path.join(outdir, 'source%s.h' % val)
  10. outsrc = os.path.join(outdir, 'source%s.cpp' % val)
  11. with open(outhdr, 'w') as f:
  12. f.write('int func%s();\n' % val)
  13. with open(outsrc, 'w') as f:
  14. f.write('''int func%s() {
  15. return 0;
  16. }
  17. ''' % val)