Skip to content

Commit

Permalink
A python script that reads the spec and spits out a list of functions…
Browse files Browse the repository at this point in the history
… for the rest of the code to use.
  • Loading branch information
BSVino committed Aug 14, 2014
1 parent c2817c8 commit 4f501a7
Show file tree
Hide file tree
Showing 8 changed files with 86,306 additions and 1,748 deletions.
26 changes: 18 additions & 8 deletions compile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import os
import shutil
import time

import opengl
import shared

def create_directory(dir):
if not os.path.exists(dir):
Expand Down Expand Up @@ -50,7 +52,7 @@ def create_directory(dir):
footer_fp.close()
print "Done."

unhandled_commands = opengl.commands_version.keys()
unhandled_commands = opengl.commands_version_flat.keys()

def spew_category(name, commands):
commands.sort()
Expand All @@ -59,7 +61,7 @@ def spew_category(name, commands):
commands_list = ""
category_versions = []
for command in commands:
versions_available = opengl.commands_version[command]
versions_available = opengl.commands_version_flat[command]
versions_available.sort()

classes = "command"
Expand Down Expand Up @@ -103,6 +105,9 @@ def spew_category(name, commands):
major_versions = opengl.get_major_versions(opengl.version_commands.keys())

for version in major_versions:
if int(version) < 2:
continue

written = 0

print "Compiling GL" + version + " ..."
Expand All @@ -121,15 +126,18 @@ def spew_category(name, commands):

toc_versions_options = ""
for version_option in all_versions:
if float(version_option) < 2.1:
continue

selected = ""
if version_option == latest_minor:
selected = " selected='selected'"
toc_versions_options = toc_versions_options + "<option value='gl" + version_option.replace(".", "") + "'" + selected + ">GL" + version_option + "</option>"
header_for_version = header_for_version.replace("{$versions_options}", toc_versions_options)
header_for_version = header_for_version.replace("{$current_api}", "gl" + latest_minor.replace(".", ""))

for command in opengl.commands_version:
if not version in opengl.get_major_versions(opengl.commands_version[command]):
for command in opengl.commands_version_flat:
if not version in opengl.get_major_versions(opengl.commands_version_flat[command]):
continue

header_for_command = header_for_version
Expand All @@ -153,10 +161,12 @@ def spew_category(name, commands):
version_dir = version[0]

create_directory(output_dir + version_dir)

gldir = "gl" + version[0]

fp = open(gldir + "/" + command + ".xhtml")

command_file = shared.find_command_file(version[0], command)
if command_file == False:
raise IOError("Couldn't find page for command " + command + " (" + version[0] + ")")

fp = open(command_file)
command_html = fp.read().decode('utf8')
fp.close()

Expand Down
1 change: 1 addition & 0 deletions gl4/glEndQueryIndexed.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<script>window.location.replace("glBeginQueryIndexed");</script>
Loading

0 comments on commit 4f501a7

Please sign in to comment.