Menu

[025cc2]: / Docs / d3d11c_generate.py  Maximize  Restore  History

Download this file

95 lines (67 with data), 2.2 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import sys
PATH = "D:/Projektit/DirectPython11/Modules/d3d11c.py"
HEADER = """
The :mod:`d3d11c` Module
----------------------------
.. module:: d3d11c
DirectPython constants module. Most constants are directly from SDK-headers.
Certain prefixes are usually removed, for example ``D3D11_BLEND_ZERO`` in C-code
would be ``BLEND_ZERO`` (the ``D3D11_``-prefix is removed) in DirectPython.
All .fx-files use the same notation.
This module is usually imported with ``from d3d11 import *``, but you don't have
to if you don't want to clutter your namespace. You can use ``import d3d11c``
and access them by their module name (``d3d11c.BLEND_ZERO``).
============================
Constants
============================
"""
D3DHEADER = """
------------------------------
Direct3D 11 constants
------------------------------
"""
WINHEADER = """
------------------------------
Windows constants
------------------------------
"""
SUBHEADER = """
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%s
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%s
"""
input = open(PATH)
d3dlines = []
winlines = []
active = None
winstarts = ("| SW_", "| VK_", "| WM_", "MB_", "| ID_", "| IDC_")
def write(text):
active.append(text)
for line in input:
stripped = line.strip()
if stripped.startswith("#"):
active = d3dlines
for x in winstarts:
if stripped.find(x) != -1:
active = winlines
break
parts = stripped.split("|")
www = ""
if len(parts) > 1:
write("\n.. _%s:\n" % parts[1].strip())
line = parts[0].strip()
if len(parts) >= 3:
www = "MSDN: " + parts[2]
write(SUBHEADER % (line[1:], www + "\n"))
elif stripped:
#write("* " + stripped.split()[0] + "\n")
write(".. data:: " + stripped.split()[0] + "\n")
output = open("d3d11c.rst", "w")
output.write(HEADER)
output.write(D3DHEADER)
for x in d3dlines:
output.write(x)
output.write(WINHEADER)
for x in winlines:
output.write(x)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.