-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathc_reference_make.py
More file actions
executable file
·60 lines (48 loc) · 1.53 KB
/
Copy pathc_reference_make.py
File metadata and controls
executable file
·60 lines (48 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python3
# This script creates markdown files in the docs directory documenting elements
# of the C functions corresponding to each fetish
#
# Requires Python >=3.6
from common import *
import shutil
def makeDoxygenConfigFiles():
if not os.path.exists("./doxygen"):
os.makedirs("./doxygen")
fetishes = getListOfFetishes()
tabs = "\t" * 4
for fetish in fetishes:
name = f"{fetish}_c_reference"
config_text = f"""PROJECT_NAME{tabs}= {name}
HIDE_UNDOC_MEMBERS{tabs}= YES
OUTPUT_DIRECTORY{tabs}= ./doxygen/output
WARNINGS{tabs}= YES
INPUT{tabs}= {getFetishDirectory()}/{fetish}/include
FILE_PATTERNS{tabs}= *.h
GENERATE_XML{tabs}= YES
XML_OUTPUT{tabs}= ./{name}_xml
"""
fp = open("doxygen/" + name, "w")
fp.write(config_text)
fp.close()
def runDoxygen():
files = [x[2] for x in os.walk("./doxygen")][0]
print(files)
for fname in files:
os.system("doxygen ./doxygen/" + fname)
def runMoxygen():
fetishes = getListOfFetishes()
for fetish in fetishes:
filepath = f"../docs/c_reference/{fetish}.md"
os.system(f"moxygen ./doxygen/output/{fetish}_c_reference_xml -o {filepath}")
# Remove `public, cause this ain't C++
doc = open(filepath, "r")
new_contents = doc.read().replace("`public ", "`")
doc.close()
doc = open(filepath, "w")
doc.write(new_contents)
doc.close()
if __name__ == "__main__":
makeDoxygenConfigFiles()
runDoxygen()
runMoxygen()
shutil.rmtree("./doxygen")