1#!/usr/bin/env python3
2
3import sys, os
4
5assert(len(sys.argv) == 3)
6
7h_templ = '''#pragma once
8unsigned int %s(void);
9'''
10
11c_templ = '''#include"%s.h"
12
13unsigned int %s(void) {
14  return 0;
15}
16'''
17
18ifile = sys.argv[1]
19outdir = sys.argv[2]
20
21base = os.path.splitext(os.path.split(ifile)[-1])[0]
22
23cfile = os.path.join(outdir, base + '.c')
24hfile = os.path.join(outdir, base + '.h')
25
26c_code = c_templ % (base, base)
27h_code = h_templ % base
28
29with open(cfile, 'w') as f:
30    f.write(c_code)
31with open(hfile, 'w') as f:
32    f.write(h_code)
33