Skip to content

Commit 584aeb7

Browse files
Joe-DownsJoseph Downs
authored andcommitted
WIP: generate API prototypes
1 parent 7c73091 commit 584aeb7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

ompi/mpi/bindings/ompi_bindings/c_header.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import consts
44
from consts import Lang
55

6+
import pympistandard as std
7+
68
categories = {}
79

810
def comment(message, lang=Lang.C, indentation=0):
@@ -59,6 +61,7 @@ def output_constant(const, use_enum):
5961
value = f"(({c_type}) {abi_value})"
6062
return def_name + " " * (45 - len(def_name)) + value + "\n"
6163

64+
# ========================= Manipulate Template Header =========================
6265
lines = []
6366
with open(consts.DIR / "abi.h.in", 'r') as header_in:
6467
lines = header_in.readlines()
@@ -91,5 +94,19 @@ def output_constant(const, use_enum):
9194
else:
9295
output.append(line)
9396

97+
# ============================= Function Prototypes ============================
98+
std.use_api_version()
99+
100+
output.append("\n")
101+
output.append("/* MPI API */\n")
102+
for proc in std.all_iso_c_procedures():
103+
output.append(f"{proc.express.iso_c}\n")
104+
105+
output.append("\n")
106+
output.append("/* Profiling MPI API */\n")
107+
for proc in std.all_iso_c_procedures():
108+
output.append(f"{proc.express.profile.iso_c}\n")
109+
110+
# ================================ Final Output ================================
94111
with open(consts.DIR / "abi.h", 'tw') as header_out:
95112
header_out.writelines(output)

0 commit comments

Comments
 (0)