Skip to content

Commit 99e9992

Browse files
Joe-DownsJoseph Downs
authored andcommitted
WIP: generate header with ABI values for #defines
1 parent 3d2b84c commit 99e9992

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import consts
2+
3+
lines = []
4+
5+
for value in consts.consts.values():
6+
name = value["name"]
7+
abi_value = value["abi_value"]
8+
c_type = value["handle_types"]["c"]["type"]
9+
if c_type is None:
10+
continue
11+
def_name = f"#define {name}"
12+
if c_type == "int":
13+
value = f"{abi_value}\n"
14+
else:
15+
value = f"(({c_type}) {abi_value})\n"
16+
line = def_name + " " * (45 - len(def_name)) + value
17+
lines.append(line)
18+
19+
with open(consts.DIR / "mpi_abi.h", 'wt') as header:
20+
header.writelines(lines)

0 commit comments

Comments
 (0)