diff --git a/Assets.py b/Assets.py
new file mode 100644
index 0000000..9a3515f
--- /dev/null
+++ b/Assets.py
@@ -0,0 +1,21 @@
+#####
+#Paths / Assets
+#####
+import pyglet
+
+draw_batch = pyglet.graphics.Batch()
+#-> batch to identify who needs what to do
+#-> draw_batch = should be drawn
+
+pyglet.resource.path = ['graphics']
+pyglet.resource.reindex()
+
+max_design_intro_image = pyglet.resource.image("Max Design Introscreen.png")
+artwork_intro_image = pyglet.resource.image("Introscreen_Artwork.png")
+programmers_intro_image = pyglet.resource.image("Introscreen_Programmers.png")
+music_intro_image = pyglet.resource.image("Introscreen_Musik.png")
+title_intro_image = pyglet.resource.image("TitleScreen.png")
+blackScreen = pyglet.resource.image("Blackscreen.png")
+configScreen = pyglet.resource.image("ConfigScreen.png")
+
+
diff --git a/Labels.py b/Labels.py
new file mode 100644
index 0000000..d764a67
--- /dev/null
+++ b/Labels.py
@@ -0,0 +1,41 @@
+#####
+#Labels
+#####
+
+globalLabels = {
+ 'CONFIG':{
+ '1' : "EIN ALTES SPIEL LADEN \"J\" SONST LEERTASTE.",
+ '2' : "WIE VIELE SPIELER 1-4",
+ '3' : "DEN NAMEN DES {} SPIELERS EINGEBEN.",
+ '4' : "\"M\" - MÄNNLICH ODER \"W\" - WEIBLICH ?",
+ '5' : "WIE SOLL DIE FIRMA DES {} SPIELERS HEISSEN ?",
+ '6' : (
+ "IN WELCHEM HAFEN WOLLEN SIE STARTEN?",
+ "\"1\" {} {}",
+ "\"2\" {} {}",
+ "\"3\" {} {}",
+ "\"4\" {} {}",
+ "\"5\" {} {}",
+ ),
+ '7': (
+ "SPIELERNAME {}",
+ "GESCHLECHT {}",
+ "FIRMENNAME {}",
+ "STARTHAFEN {}",
+ "",
+ "SIND DIESE EINSTELLUNGEN RICHTIG? \"J\" ODER \"N\"",
+ ),
+ '8':(
+ "WIE LANGE WOLLEN SIE SPIELEN?",
+ "A - 5 JAHRE",
+ "B - 10 JAHRE",
+ "C - 15 JAHRE",
+ "D - 20 JAHRE",
+ "E - 26 JAHRE",
+ "",
+ "F - 5 JAHRE \"EINSTEIGER SPIEL\"",
+ ),
+ },
+
+
+}
\ No newline at end of file
diff --git a/Remake_1869.py b/Remake_1869.py
new file mode 100644
index 0000000..1cdab83
--- /dev/null
+++ b/Remake_1869.py
@@ -0,0 +1,412 @@
+# /////
+# Remake of 1869 in python
+# ////
+
+import pyglet
+import Assets
+import Labels
+import Utils
+import logging # TODO to be implemented
+
+from pyglet.window import key
+from pyglet.window import mouse
+from pyglet.gl import *
+from scenes import IntroScreen
+from scenes import ConfigScreen
+
+glEnable(GL_BLEND)
+glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+
+pyglet.gl.glClearColor(0.1, 0.1, 0.1, 1)
+
+"""
+naming conventions:
+d_varname = dict
+s_varname = set
+l_varname = list
+t_varname = tuple
+b_varname = batch
+og_varname = orderedGroup for z relation of graphics
+"""
+
+class main(pyglet.window.Window):
+ def __init__(self, width=640, height=480, fps=False, *args, **kwargs):
+ super(main, self).__init__(width, height,
+ caption='1869 Remake', *args, **kwargs)
+ self.x = 0
+ self.y = 0
+ self.WindowMinWidth = width
+ self.WindowMinHeight = height
+ self.currentWindowWidth = width
+ self.currentWindowHeight = height
+ # self.push_handlers(pyglet.window.event.WindowEventLogger())
+ # -> gibt aus welche events an das window geschickt wurden -> gut zum finden von events die manipuliert werden sollen
+
+ self.og_background = pyglet.graphics.OrderedGroup(0)
+ self.og_semi_background = pyglet.graphics.OrderedGroup(1)
+ self.og_semi_foreground = pyglet.graphics.OrderedGroup(2)
+ self.og_foreground = pyglet.graphics.OrderedGroup(3)
+
+ self.b_sprites = pyglet.graphics.Batch()
+ self.b_labels = pyglet.graphics.Batch()
+ self.b_widgets = pyglet.graphics.Batch()
+
+ self.mouse_x = 0
+ self.mouse_y = 0
+ self.alive = 1
+
+ self.activeScene = None
+ self.activeSceneName = None
+ self.sceneTransferPhase = 1
+ self.d_stopWatch = dict()
+
+ self.d_active_SpriteAnimations = dict()
+ self.d_active_LabelAnimations = dict()
+ self.d_active_WidgetAnimations = dict()
+ self.targetScene = 'INTRO'
+ self.d_active_sprites = dict()
+ self.d_active_labels = dict()
+ self.d_active_widgets = dict()
+
+ # TODO check if this widget system for text input can be used to imitate text lieferant from c# code
+ self.text_cursor = self.get_system_mouse_cursor('text')
+ self.focus = None
+
+ #####
+ # system funcs
+ #####
+ def on_resize(self, width, height):
+ width = max(width,self.WindowMinWidth)
+ height = max(height, self.WindowMinHeight)
+ super(main, self).on_resize(width, height)
+
+ currentScaleFactor_x = width/self.currentWindowWidth
+ currentScaleFactor_y = height/self.currentWindowHeight
+
+ self.currentWindowWidth = width
+ self.currentWindowHeight = height
+ if self.d_active_sprites is not None:
+ for keys, sprite in self.d_active_sprites.items():
+ sprite.scale_x = max(width, sprite.image.width)/min(width, sprite.width)
+ sprite.scale_y = max(sprite.image.height, height)/min(sprite.image.height, height)
+ if self.d_active_labels is not None:
+ for keys, label in self.d_active_labels.items():
+ label.content_width = label.content_width*(max(label.content_width, width)/ min(label.content_width, width))
+ label.content_height = label.content_height*(max(label.content_height, height)/ min(label.content_height, height))
+ label.x = label.x* currentScaleFactor_x
+ label.y = label.y* currentScaleFactor_y
+ label.font_size = label.font_size*currentScaleFactor_x
+ if self.d_active_widgets is not None:
+ for keys, widget in self.d_active_widgets.items():
+ #widget.width = width - 110
+ pass
+
+ def on_draw(self):
+ self.render()
+
+ def render(self):
+ self.clear()
+
+ self.b_sprites.draw()
+ self.b_labels.draw()
+ self.b_widgets.draw()
+
+ self.flip()
+
+ def on_close(self):
+ self.alive = 0
+
+ #####
+ # input Handler Funcs
+ #####
+
+ def on_mouse_motion(self, x, y, dx, dy):
+ # forward mouse information to active scene
+ self.activeScene.on_mouse_motion(self, x, y, dx, dy)
+ self.mouse_x = x
+ self.mouse_y = y
+
+ if self.d_active_widgets is not None:
+ for key,widget in self.d_active_widgets.items():
+ if widget.hit_test(x, y):
+ self.set_mouse_cursor(self.text_cursor)
+ break
+ else:
+ self.set_mouse_cursor(None)
+
+ def on_mouse_press(self, x, y, button, modifiers):
+ # forward mouse information to active scene
+ self.activeScene.on_mouse_press(self, x, y, button, modifiers)
+ if button == 1: # Left click
+ pass
+ for key,widget in self.d_active_widgets.items():
+ if widget.hit_test(x, y):
+ self.set_focus(widget)
+ break
+ else:
+ self.set_focus(None)
+
+ if self.focus:
+ self.focus.caret.on_mouse_press(x, y, button, modifiers)
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ if self.focus:
+ self.focus.caret.on_mouse_drag(x, y, dx, dy, buttons, modifiers)
+
+ def on_key_press(self, symbol, modifiers):
+ # forward keypress information to active scene
+ self.activeScene.on_key_press(self, symbol, modifiers)
+ if symbol == key.ESCAPE:
+ self.alive = 0
+ if symbol == key.TAB:
+ if modifiers & key.MOD_SHIFT:
+ dir = -1
+ else:
+ dir = 1
+
+ if self.focus in self.d_active_widgets:
+ i = self.d_active_widgets.index(self.focus)
+ else:
+ i = 0
+ dir = 0
+
+ self.set_focus(self.d_active_widgets[(i + dir) % len(self.d_active_widgets)])
+
+ def on_text(self, text):
+ if self.focus:
+ self.focus.caret.on_text(text)
+
+ def on_text_motion(self, motion):
+ if self.focus:
+ self.focus.caret.on_text_motion(motion)
+
+ def on_text_motion_select(self, motion):
+ if self.focus:
+ self.focus.caret.on_text_motion_select(motion)
+
+ def set_focus(self, focus):
+ if self.focus:
+ self.focus.caret.visible = False
+ self.focus.caret.mark = self.focus.caret.position = 0
+ print('defocused')
+ self.focus = focus
+ if self.focus:
+ print('focused')
+ self.focus.caret.visible = True
+ self.focus.caret.mark = 0
+ self.focus.caret.position = len(self.focus.document.text)
+ #####
+ # stopwatch functions
+ ####
+
+ def checkStopwatch(self, obj, targetSeconds):
+ """
+ tracks time based operations for given objects
+ -> targetSeconds: returns true if current Timer is below /reached targetSeconds
+ """
+ if obj in self.d_stopWatch:
+ if self.d_stopWatch[obj] <= targetSeconds:
+ return True
+ else:
+ return False
+ else:
+ return False
+
+ def setStopwatch(self, obj, seconds):
+ if obj not in self.d_stopWatch:
+ self.d_stopWatch[obj] = seconds
+ return True
+ else:
+ # not allowed to set a timer on an object twice
+ return False
+
+ def stopwatch_tick(self):
+ for obj in self.d_stopWatch:
+ self.d_stopWatch[obj] -= 1
+
+ def clearStopwatchTask(self, obj):
+ if obj in self.d_stopWatch:
+ self.d_stopWatch.pop(obj)
+ return True
+ else:
+ return False
+
+ def clearStopwatch(self):
+ self.d_stopWatch.clear()
+
+ #####
+ # resource loaders
+ #####
+ def load_sprites(self):
+ """
+ load all sprites used in the specific scene
+ """
+ if isinstance(self.activeScene, IntroScreen.IntroScene):
+ return {
+ 'max_design_intro_sprite': pyglet.sprite.Sprite(Assets.max_design_intro_image, batch=self.b_sprites, group=self.og_background),
+ 'artwork_intro_sprite': pyglet.sprite.Sprite(Assets.artwork_intro_image, batch=self.b_sprites, group=self.og_background),
+ 'programmers_intro_sprite': pyglet.sprite.Sprite(Assets.programmers_intro_image, batch=self.b_sprites, group=self.og_background),
+ 'music_intro_sprite': pyglet.sprite.Sprite(Assets.music_intro_image, batch=self.b_sprites, group=self.og_background),
+ 'title_intro_sprite': pyglet.sprite.Sprite(Assets.title_intro_image, batch=self.b_sprites, group=self.og_background),
+ 'blackscreen': pyglet.sprite.Sprite(Assets.blackScreen, batch=self.b_sprites, group=self.og_foreground),
+ }
+ if isinstance(self.activeScene, ConfigScreen.ConfigScene):
+ return {
+ 'configSprite': pyglet.sprite.Sprite(Assets.configScreen, batch=self.b_sprites, group=self.og_background),
+ 'blackscreen': pyglet.sprite.Sprite(Assets.blackScreen, batch=self.b_sprites, group=self.og_foreground),
+ }
+
+ def load_labels(self):
+ """
+ load all labels used in the specific scene
+ """
+ if isinstance(self.activeScene, IntroScreen.IntroScene):
+ return {
+ 'press_enter': pyglet.text.Label(text="Press Enter", font_name=None, font_size=10, color=(255, 255, 255, 0), x=(self.width*7/10), y=(self.height*2/7), anchor_x='center', batch=self.b_labels, group=self.og_semi_foreground),
+ }
+ if isinstance(self.activeScene, ConfigScreen.ConfigScene):
+ return {}#CONFIG has no preset Labels -> they are created by the scene on demand
+
+ def load_widgets(self):
+ """
+ load all widgets used in the specific scene
+ """
+ if isinstance(self.activeScene, ConfigScreen.ConfigScene):
+ return {
+ 'mainInput': Utils.TextWidget("-TEST TEXT-", x=(self.width/2 )-50, y=self.height/2, width=100 ,batch=self.b_widgets),
+ 'textController':Utils.ControledTextBox(x=(self.width/2 )-50, y=(self.height/2) - 50, width=100 , height = 150, batch=self.b_widgets),
+ }
+
+ def load_sounds(self):
+ """
+ load all sound resources -> probably optimize for scenes
+ """
+ return {
+ }
+
+ #####
+ # maintanence funcs
+ #####
+ def clear_externalLabel(self, target=None):
+ pass
+
+ def register_externalLabel(self, keyName, text, x, y, width, batch):
+ if keyName in self.d_active_labels:
+ return False
+ else:
+ self.d_active_labels[keyName]
+
+
+ def clear_animationLists(self, target=None):
+ if target in [None, 'sprites']:
+ self.d_active_SpriteAnimations.clear()
+ if target in [None, 'labels']:
+ self.d_active_LabelAnimations.clear()
+ if target in [None, 'widgets']:
+ self.d_active_WidgetAnimations.clear()
+
+ def register_animation(self, anim, wantedAnimation):
+ """
+ registers anims to be animated by custom animations
+ """
+ if isinstance(anim, pyglet.sprite.Sprite):
+ if anim in self.d_active_SpriteAnimations:
+ return False
+ else:
+ self.d_active_SpriteAnimations[anim] = wantedAnimation
+ elif isinstance(anim, pyglet.text.Label):
+ if anim in self.d_active_LabelAnimations:
+ return False
+ else:
+ self.d_active_LabelAnimations[anim] = wantedAnimation
+ else:
+ if anim in self.d_active_WidgetAnimations:
+ return False
+ else:
+ self.d_active_WidgetAnimations[anim] = wantedAnimation
+
+ def run_AnimationManager(self):
+ """
+ animates all registered animations that are currently active
+ """
+ l_deactivateAnims = list()
+ for sprite, animationType in self.d_active_SpriteAnimations.items():
+ # forward sprite animation infos to active scene
+ self.activeScene.maintain_SpriteAnimations(l_deactivateAnims, sprite, animationType)
+ for label, animationType in self.d_active_LabelAnimations.items():
+ # forward label animation infos to active scene
+ self.activeScene.maintain_LabelAnimations(l_deactivateAnims, label, animationType)
+ for widget, animationType in self.d_active_WidgetAnimations.items():
+ # forward label animation infos to active scene
+ self.activeScene.maintain_WidgetAnimations(l_deactivateAnims, widget, animationType)
+ # when all anims are played out active anims must be cleared for finished ones
+ for anim in l_deactivateAnims:
+ if isinstance(anim, pyglet.sprite.Sprite):
+ self.d_active_SpriteAnimations.pop(anim, None)
+ if isinstance(anim, pyglet.text.Label):
+ self.d_active_LabelAnimations.pop(anim, None)
+ if isinstance(anim, Utils.TextWidget):
+ self.d_active_WidgetAnimations.pop(anim, None)
+
+ def activate_scene(self, scene):
+ self.activeScene = scene
+ self.activeSceneName = self.activeScene.sceneName
+
+ def transferToScene(self, originScene, targetScene):
+ """
+ transfers from a scene to a scene
+ phase false = no transition
+ phase 1 = origin is deactivated
+ phase 2 = target is loaded
+ """
+ if self.sceneTransferPhase is False:
+ self.sceneTransferPhase = 1
+ if self.sceneTransferPhase is 1:
+ if self.activeScene is None :
+ self.sceneTransferPhase = 2
+ elif self.activeScene.isAlive is False:
+ self.activeScene.killSprites(self,self.d_active_sprites)
+ self.activeScene.killLabels(self,self.d_active_labels)
+ self.activeScene.killWidgets(self,self.d_active_widgets)
+ self.sceneTransferPhase = 2
+ if self.sceneTransferPhase is 2:
+ if self.targetScene is "INTRO":
+ self.activate_scene(IntroScreen.IntroScene())
+ if self.targetScene is "CONFIG":
+ self.activate_scene(ConfigScreen.ConfigScene())
+ self.d_active_sprites = self.load_sprites()
+ self.d_active_labels = self.load_labels()
+ self.d_active_widgets = self.load_widgets()
+ self.activeScene.prepareSprites(self, self.d_active_sprites)
+ self.activeScene.prepareLabels(self, self.d_active_labels)
+ self.activeScene.prepareWidgets(self,self.d_active_widgets)
+ self.targetScene = False
+ self.sceneTransferPhase = False
+
+ def checkSceneTransfers(self):
+ """
+ check if any scene transferes have to be made
+ """
+ #scenetransfer is broken -> repair + more control (e.g. introscene)
+ if self.activeScene is None:
+ self.transferToScene(self.activeScene,self.targetScene)
+ elif self.activeScene.isInTransfer is True or self.sceneTransferPhase is 1:
+ self.transferToScene(self.activeScene,self.targetScene)
+
+ #####
+ # main loop
+ #####
+ def run(self):
+ while self.alive == 1:
+ self.run_AnimationManager()
+ self.checkSceneTransfers()
+ if self.activeScene is not None:
+ self.targetScene = self.activeScene.run(self)
+ self.render()
+ event = self.dispatch_events()
+
+
+# Programm starting point
+if __name__ == '__main__':
+ game = main(resizable=True)
+ game.run()
diff --git a/ToDo_list.txt b/ToDo_list.txt
new file mode 100644
index 0000000..c447286
--- /dev/null
+++ b/ToDo_list.txt
@@ -0,0 +1,9 @@
+ToDo:
+IntroScreen:
+- done
+ConfigScreen:
+- Textfeld informationen verarbeiten
+- animationsmaschinerie mit IntroScreen vergleichen und anpassen(bei bedarf)
+- doScene + close funktionen mit intro abgleichen
+utils:
+- textcontroller -> mouse daten übergabe zuende implementieren
\ No newline at end of file
diff --git a/Utils.py b/Utils.py
new file mode 100644
index 0000000..cbad584
--- /dev/null
+++ b/Utils.py
@@ -0,0 +1,234 @@
+###
+#util functions
+###
+import pyglet
+
+def center_image(image):
+ """Sets an image's anchor point to its center"""
+ image.anchor_x = image.width // 2
+ image.anchor_y = image.height // 2
+
+def fadeIn_sprite(sprite , currentOpacity ,speed):
+ if sprite.opacity < 255:
+ if sprite.opacity + speed > 255:
+ sprite.opacity = 255
+ else:
+ sprite.opacity = currentOpacity + speed
+ else:
+ return False # returns False if max reached
+
+def fadeOut_sprite(sprite, currentOpacity ,speed):
+ if sprite.opacity > 0:
+ if sprite.opacity - speed < 0:
+ sprite.opacity = 0
+ else:
+ sprite.opacity = currentOpacity - speed
+ else:
+ return False # returns False if 0 reached
+
+def fadeIn_label(label, currentColor,speed):
+ red = currentColor[0]
+ green = currentColor[1]
+ blue = currentColor[2]
+ alpha = currentColor[3]
+ inProgess = True
+ if alpha + speed > 255:
+ alpha = 255
+ inProgess = False
+ else:
+ alpha += speed
+ toggledColor = (red,green,blue,alpha)
+ label.color = toggledColor
+ return inProgess
+
+def toggle_label(label, currentColor):
+ red = currentColor[0]
+ green = currentColor[1]
+ blue = currentColor[2]
+ alpha = currentColor[3]
+ if alpha > 0:
+ alpha = 0
+ else:
+ alpha = 255
+ toggledColor = (red,green,blue,alpha)
+ label.color = toggledColor
+ return True
+
+def fading_toggle_label(label, currentColor,remaining_alpha):
+ if remaining_alpha is 0:
+ return True
+ red = currentColor[0]
+ green = currentColor[1]
+ blue = currentColor[2]
+ alpha = currentColor[3]
+ if alpha > 0:
+ alpha = 0
+ else:
+ alpha = remaining_alpha
+ toggledColor = (red,green,blue,alpha)
+ label.color = toggledColor
+ return True
+
+def fadeIn_widget(widget, Alpha,speed):
+ inProgess = True
+ if Alpha + speed > 255:
+ widget.set_opacity(255)
+ inProgess = False
+ else:
+ widget.set_opacity(Alpha + speed)
+ return inProgess
+
+def fadeOut_widget(widget, Alpha,speed):
+ inProgess = True
+ if Alpha > 0:
+ if Alpha - speed < 0:
+ widget.set_opacity(0)
+ inProgess = False
+ else:
+ widget.set_opacity(Alpha - speed)
+ return inProgress
+
+class Rectangle(object):
+ '''Draws a rectangle into a batch.'''
+ def __init__(self, x1, y1, x2, y2, batch):
+ self.vertex_list = batch.add(4, pyglet.gl.GL_QUADS, None,
+ ('v2i', [x1, y1, x2, y1, x2, y2, x1, y2]),
+ ('c4B', [200, 200, 220, 255] * 4)
+ )
+
+class TextWidget(object):
+ """
+ Texteingabe Feld
+ """
+ def __init__(self, text, x, y, width, batch):
+ self.document = pyglet.text.document.UnformattedDocument(text)
+ self.document.set_style(0, len(self.document.text),
+ dict(color=(0, 0, 0, 0))
+ )
+ font = self.document.get_font()
+ height = font.ascent - font.descent
+
+ # checken wo groups integriert werden können da sich einige sachen überlagern
+ self.layout = pyglet.text.layout.IncrementalTextLayout(
+ self.document, width, height, multiline=False, batch=batch)
+ self.caret = pyglet.text.caret.Caret(self.layout)
+
+ self.layout.x = x
+ self.layout.y = y
+
+ # Rectangular outline
+ pad = 2
+ #self.rectangle = Rectangle(x - pad, y - pad,
+ #x + width + pad, y + height + pad, batch)
+
+ def hit_test(self, x, y):
+ return (0 < x - self.layout.x < self.layout.width and
+ 0 < y - self.layout.y < self.layout.height)
+
+ def set_opacity (self,alpha):
+ self.document.set_style(0,len(self.document.text), dict(color=(0,0,0,alpha)))
+ #self.rectangle.opacity = alpha
+
+ def get_opacity (self):
+ color = self.document.get_style_range('color', 0, len(self.document.text))
+ #color = self.rectangle.opacity
+ return color[3]
+
+class ControledTextBox(object):
+ """
+ controller for textdisplay, input via text/button selection, sitewise type specific handling
+ 3 Data feeds are needed:
+ -> a) basic information about the controller (general size, how many lines, how many columns[and their specific sizes])
+ -> b) dictionary which element
+ -> c) dictionary describing a site-tree with indexes
+ """
+ def __init__(self, x, y, width, height,batch):
+ """
+ constructs the basic frame
+ """
+ self.ContentTree = None
+ self.currentPage = 1
+ self.xPos = x
+ self.yPos = y
+ self.width = width
+ self.height = height
+
+ def render(self):
+ pass
+#todo: anpassen dass mouse daten übergeben werden
+ """def on_mouse_motion(self, x, y, dx, dy):
+ # forward mouse information to active scene
+ self.activeScene.on_mouse_motion(self, x, y, dx, dy)
+ self.mouse_x = x
+ self.mouse_y = y
+
+ if self.d_active_widgets is not None:
+ for key,widget in self.d_active_widgets.items():
+ if widget.hit_test(x, y):
+ self.set_mouse_cursor(self.text_cursor)
+ break
+ else:
+ self.set_mouse_cursor(None)
+
+ def on_mouse_press(self, x, y, button, modifiers):
+ # forward mouse information to active scene
+ self.activeScene.on_mouse_press(self, x, y, button, modifiers)
+ if button == 1: # Left click
+ pass
+ for key,widget in self.d_active_widgets.items():
+ if widget.hit_test(x, y):
+ self.set_focus(widget)
+ break
+ else:
+ self.set_focus(None)
+
+ if self.focus:
+ self.focus.caret.on_mouse_press(x, y, button, modifiers)
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ if self.focus:
+ self.focus.caret.on_mouse_drag(x, y, dx, dy, buttons, modifiers)
+
+ def on_key_press(self, symbol, modifiers):
+ # forward keypress information to active scene
+ self.activeScene.on_key_press(self, symbol, modifiers)
+ if symbol == key.ESCAPE:
+ self.alive = 0
+ if symbol == key.TAB:
+ if modifiers & key.MOD_SHIFT:
+ dir = -1
+ else:
+ dir = 1
+
+ if self.focus in self.d_active_widgets:
+ i = self.d_active_widgets.index(self.focus)
+ else:
+ i = 0
+ dir = 0
+
+ self.set_focus(self.d_active_widgets[(i + dir) % len(self.d_active_widgets)])
+"""
+
+ def setPageStructure(self, d_structure):
+ """
+ sets the structure of the containing pages
+ types:
+ -TextSelection -> pick a text from a list of texts (returns index of text in the current page)
+ -ListSelection -> pick a listentry gathered from a defined datapool (returns the text of the entry)
+ e.g.: [pageIndex]:(type,typeSpecificDetails)
+ e.g.: "1.1":(TextSelection,rows,maxVisibleRows)
+ """
+ pass
+
+ def setContent(self, d_pageToContent):
+ """
+ sets the content of each page (structure must be considered while filling it)
+ e.g.: [pageIndex]:{[index1]:(TEXT1), [index2]:(TEXT2)}
+ """
+ pass
+
+ def checkInput(self):
+ """
+ check if there is input to give back to the requester
+ """
+ pass
diff --git a/__pycache__/Assets.cpython-35.pyc b/__pycache__/Assets.cpython-35.pyc
new file mode 100644
index 0000000..a7f7fb7
Binary files /dev/null and b/__pycache__/Assets.cpython-35.pyc differ
diff --git a/__pycache__/Labels.cpython-35.pyc b/__pycache__/Labels.cpython-35.pyc
new file mode 100644
index 0000000..830db62
Binary files /dev/null and b/__pycache__/Labels.cpython-35.pyc differ
diff --git a/__pycache__/Remake_1869.cpython-35.pyc b/__pycache__/Remake_1869.cpython-35.pyc
new file mode 100644
index 0000000..2e970fc
Binary files /dev/null and b/__pycache__/Remake_1869.cpython-35.pyc differ
diff --git a/__pycache__/Utils.cpython-35.pyc b/__pycache__/Utils.cpython-35.pyc
new file mode 100644
index 0000000..bc2fcb6
Binary files /dev/null and b/__pycache__/Utils.cpython-35.pyc differ
diff --git a/graphics/Blackscreen.png b/graphics/Blackscreen.png
new file mode 100644
index 0000000..21e74de
Binary files /dev/null and b/graphics/Blackscreen.png differ
diff --git a/graphics/ConfigScreen.png b/graphics/ConfigScreen.png
new file mode 100644
index 0000000..f356658
Binary files /dev/null and b/graphics/ConfigScreen.png differ
diff --git a/graphics/Introscreen_Artwork.png b/graphics/Introscreen_Artwork.png
new file mode 100644
index 0000000..e621f58
Binary files /dev/null and b/graphics/Introscreen_Artwork.png differ
diff --git a/graphics/Introscreen_Musik.png b/graphics/Introscreen_Musik.png
new file mode 100644
index 0000000..879aae8
Binary files /dev/null and b/graphics/Introscreen_Musik.png differ
diff --git a/graphics/Introscreen_Programmers.png b/graphics/Introscreen_Programmers.png
new file mode 100644
index 0000000..7be847b
Binary files /dev/null and b/graphics/Introscreen_Programmers.png differ
diff --git a/graphics/MainScreen_Frame.png b/graphics/MainScreen_Frame.png
new file mode 100644
index 0000000..1c6076e
Binary files /dev/null and b/graphics/MainScreen_Frame.png differ
diff --git a/graphics/Max Design Introscreen.png b/graphics/Max Design Introscreen.png
new file mode 100644
index 0000000..c88ecfe
Binary files /dev/null and b/graphics/Max Design Introscreen.png differ
diff --git a/graphics/TitleScreen.png b/graphics/TitleScreen.png
new file mode 100644
index 0000000..c1ecd1f
Binary files /dev/null and b/graphics/TitleScreen.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0.zip b/pyglet-1.3.0/pyglet-1.3.0.zip
new file mode 100644
index 0000000..4ea4cd5
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0.zip differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/LICENSE b/pyglet-1.3.0/pyglet-1.3.0/LICENSE
new file mode 100644
index 0000000..f3c32b5
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/LICENSE
@@ -0,0 +1,30 @@
+Copyright (c) 2006-2008 Alex Holkner
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name of pyglet nor the names of its
+ contributors may be used to endorse or promote products
+ derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/MANIFEST.in b/pyglet-1.3.0/pyglet-1.3.0/MANIFEST.in
new file mode 100644
index 0000000..32954ee
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/MANIFEST.in
@@ -0,0 +1,27 @@
+include LICENSE
+include NOTICE
+include README
+include CHANGELOG
+include RELEASE_NOTES
+
+# Public tools
+include tools/inspect_font.py
+
+# Examples
+recursive-include examples *
+prune examples/**/dist
+
+# Tests
+recursive-include tests *
+recursive-exclude tests/regression/images *.png
+recursive-exclude tests *.log
+
+# Docs
+# removed - docs available separately
+#recursive-include doc/html *
+#recursive-include doc/pdf *
+
+# Development artifacts
+prune **/.svn
+recursive-exclude * *.pyc
+recursive-exclude * *.pyo
diff --git a/pyglet-1.3.0/pyglet-1.3.0/NOTICE b/pyglet-1.3.0/pyglet-1.3.0/NOTICE
new file mode 100644
index 0000000..b855c8c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/NOTICE
@@ -0,0 +1,49 @@
+pyglet
+Copyright 2006-2008 Alex Holkner
+http://www.pyglet.org
+
+pyglet includes contributions from the following organisations and
+individuals:
+
+Blue Box Devices
+SR Research
+
+Jesse Archer
+Ben Atkin
+Anthony Baxter
+Anthony Briggs
+Andrew Campbell
+Ondrej Certik
+Peter Dilley
+Casey Duncan
+Dunk Fordyce
+Alan Green
+Brian Grogan Jr
+Richard Jones
+George LeCompte
+Matthew Marshall
+Michael Romer
+Tobias Sargeant
+Andreas Schiefer
+Peter Shinners
+Nathan Stocks
+Martin Di Paola
+Walter Woods
+anatoly techtonik
+Juan J. Martinez
+Txema Vicente
+Claudio Canepa
+
+pyglet/libs/win32/constants.py is derived from Python for Windows
+Extensions. Copyright 1994-2001 Mark Hammond.
+
+pyglet/image/codecs/pypng.py is derived from png.py. Copyright 2006
+Johann C. Rocholl.
+
+contrib/layout/layout/Plex/ is derived from Plex. Copyright Greg Ewing.
+
+tools/wraptypes/lex.py and tools/wraptypes/yacc.py are derived from ply.
+Copyright 2001-2006 David M. Beazley.
+
+pyglet/font/win32query.py is fontquery.py placed into public domain by
+anatoly techtonik.
diff --git a/pyglet-1.3.0/pyglet-1.3.0/PKG-INFO b/pyglet-1.3.0/pyglet-1.3.0/PKG-INFO
new file mode 100644
index 0000000..9202aaa
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/PKG-INFO
@@ -0,0 +1,30 @@
+Metadata-Version: 1.1
+Name: pyglet
+Version: 1.3.0
+Summary: Cross-platform windowing and multimedia library
+Home-page: http://pyglet.readthedocs.org/en/latest/
+Author: Alex Holkner
+Author-email: Alex.Holkner@gmail.com
+License: BSD
+Download-URL: http://pypi.python.org/pypi/pyglet
+Description: pyglet provides an object-oriented programming
+ interface for developing games and other visually-rich applications
+ for Windows, Mac OS X and Linux.
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: MacOS X
+Classifier: Environment :: Win32 (MS Windows)
+Classifier: Environment :: X11 Applications
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Operating System :: MacOS :: MacOS X
+Classifier: Operating System :: Microsoft :: Windows
+Classifier: Operating System :: POSIX :: Linux
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Topic :: Games/Entertainment
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
diff --git a/pyglet-1.3.0/pyglet-1.3.0/README b/pyglet-1.3.0/pyglet-1.3.0/README
new file mode 100644
index 0000000..76ffbd2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/README
@@ -0,0 +1,61 @@
+pyglet
+======
+
+http://www.pyglet.org/
+
+pyglet provides an object-oriented programming interface for developing games
+and other visually-rich applications for Windows, Mac OS X and Linux.
+
+Requirements
+------------
+
+pyglet runs under Python 2.7, and 3.4+. The entire codebase is fully 2/3 dual
+compatible, making use of the future module for backwards compatibility with
+legacy Python. Being written in pure Python, it also works on other Python
+interpreters such as PyPy. pyglet works on the following operating systems:
+
+* Windows XP or later
+* Mac OS X 10.3 or later
+* Linux, with the following libraries (most recent distributions will have
+ these in a default installation):
+ * OpenGL and GLX
+ * GDK 2.0+ or PIL (required for loading images other than PNG and BMP)
+ * Pulseaudio or OpenAL (required for playing audio)
+
+Installation
+------------
+
+If you're reading this README from a source distribution, you can install
+pyglet with:
+
+ python setup.py install
+
+There are no compilation steps during the installation; if you prefer,
+you can simply add this directory to your PYTHONPATH and use pyglet without
+installing it. You can also copy pyglet directly into your project folder.
+
+The documentation is available online at pyglet.org, but if you want to
+build the documentation yourself, please check the README file in the doc
+directory.
+
+Support
+-------
+
+pyglet has an active developer and user community. If you find a bug, please
+open an issue at https://bitbucket.org/pyglet/pyglet/issues.
+
+Please join us on the mailing list at:
+
+ http://groups.google.com/group/pyglet-users
+
+For more information, visit http://www.pyglet.org
+
+Testing
+-------
+
+pyglet makes use of pytest for it's test suite.
+
+ % py.test tests/
+
+Please check the documentation for more information about running and writing
+tests.
\ No newline at end of file
diff --git a/pyglet-1.3.0/pyglet-1.3.0/RELEASE_NOTES b/pyglet-1.3.0/pyglet-1.3.0/RELEASE_NOTES
new file mode 100644
index 0000000..5b6c63f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/RELEASE_NOTES
@@ -0,0 +1,240 @@
+Pyglet 1.3.0
+============
+This major release takes Python 3 support to the next level. The entire codebase is now compatible
+with both Python 2 and Python 3 without the need for 2to3. This should make it easier to develop
+pyglet and pyglet apps for both Python versions.
+
+The rest of this release is focussed on code quality and test coverage. There are no API breaking
+changes, and only a few minor additions. Dozens of bugs have been fixed, and the codebase is in a
+better state for future improvement and maintainability.
+
+New features
+------------
+- The procedural audio module is now more usable. This module allows synthesis of basic
+ waveforms, such as sine, square, triangle, sawtooth, and simple FM (two operator sine).
+ In addition, several basic amplitude envelopes are now available to apply to generated audio.
+ These include ADSR, linear decay, tremolo, and flat envelopes.
+
+Improvements
+------------
+- Improved font rendering for fonts with negative bearing (#99)
+- Sprites now have `scale_x` and `scale_y` attributes, allowing for aspect ratio changes. The
+ existing `scale` attribute sets the overall scaling, and functions as before.
+- Sprites have a new `update` method which allows simultaneous changing of position, scale, and
+ rotation. This reduces some overhead when changing multiple attributes at once.
+- The pyglet.resource module now defaults to a 2048x2048 texture for it's internal texture atlas,
+ but will fall back to the maximum available size that the GPU can provide.
+- All modern joysticks and game controllers should now be detected on Linux and Windows.
+- Refactored and reimplemented pyglet.media. Many improvements to stability. Different drivers
+ should now behave more similar.
+- WM_CLASS hints are now set on Linux. On modern Linux desktop environments and window managers,
+ this allows for proper tracking of pyglet applications. Previously, pyglet apps may show up as
+ "Unknown" under the active window list in the environment. The window class hints are set
+ to the same name as the Window caption, but will fall back to "pyglet" if the Window caption
+ contains non-ascii characters.
+- Vastly improved documentation and programming guide.
+
+Bugfixes
+--------
+- Limit the minimum window size 1x1 pixel, preventing an OpenGL exception when resizing (#49).
+- Font module no longer leaks memory when text is changed (#66).
+- Fix crash on Python 2 when sys.argv[0] has non-ASCII characters (#74).
+- Windows: Fix crash when opening multiple windows in succession (#81).
+- Windows: Fix local font loading (#100).
+- Windows: Italic fonts no longer render parts of their neighbors.
+- Prevent memory leak from orphaned StreamingSources in long running applications (#103).
+- Windows: Fix kerning regression (#115)
+- Windows: Window.set_icon no longer fails when given a Texture instead of ImageData (#136)
+
+Pyglet 1.2.3
+============
+Minor bugfix release.
+
+Bugfixes:
+- Windows: Fix issue where ALT key causes app to hang.
+- Media: Many fixes to PulseAudio and OpenAL media drivers (a.o. #26, #27).
+- OSX: Fix stealing the menu when already present in cocoa.
+- Fix multi texturing support (#28).
+- OSX: Prevent segfault with multiple runs (#37/GC728)
+- ArchLinux: Fix segmentation fault when using gdk_pixbuf (#25)
+
+Pyglet 1.2.2
+============
+Minor bugfix release. Includes documentation updates for deprecated code.
+
+Bugfixes
+--------
+- BB#21: X11: Error on fontconfig cache eviction
+- BB#23: Windows: Disable ARB context on Intel devices.
+
+Pyglet 1.2.1
+============
+Minor bugfix release. Fixes some issues on Linux.
+
+Bugfixes
+--------
+- BB#18: X11: Events not processed while animating
+- X11: on_resize event not triggered
+- X11: Fix deletion of PulseAudioPlayer.
+
+Pyglet 1.2
+==========
+The major 1.2 release brings pyglet to Python 3. Pyglet now also runs on 64-bit operating systems
+Linux, Windows and OS X. The OS X layer has switched to Cocoa.
+
+Backwards-incompatible API changes:
+* renamed Label parameter 'halign' to 'align', fix for issue:460
+* remove unused module 'glext_missing' - everything should already be in 'glext_arb'
+
+Python support
+--------------
+- 2.6 and up
+- NEW: 3.3 and up
+
+Platform support
+----------------
+- Improved win32 support
+- Windows: DirectInput support
+- OSX: Joystick support
+- Linux: GL 3 support
+- Linux: ALSA replaced by PulseAudio
+- Windows: Tablet API support
+- OSX: Tablet support
+- Linux: Tablet support
+- OSX: Cocoa support
+- OSX: Support for PyObjC 2.3
+
+Bugfixes
+--------
+- 294: pyglet.image.get_texture(rectangle=True) returns GL_TEXTURE_2D for tex.target if image is
+ POT
+- 345: image mouse cursor shows up after fullscreen switch
+- 347: vowel in Thai language did not display
+- 353: X11: Wrong keysym reported in on_key_press/release if shift pressed.
+- 355: wraptypes does not wrap hex or octal enum values properly
+- 357: Non-conforming ATI cards missing glGenBuffers
+- 358: ResourceNotFoundException has spelling error in message (in pyglet 1.1.2)
+- 361: xlib: initial mouse dx/dy incorrect if mouse on window
+- 362: Support for generic attributes are broken
+- 363: pyglet.resource no longer finds files within directories
+- 368: permission issues with some doc and example files
+- 371: pyglet.sprite uses integer coordinates for drawing
+- 376: Windows Installer Ambiguous about Supported Python Versions
+- 377: on_mouse_scroll not being called with latest pyglet revision (from svn) on vista64
+- 379: pyglet.media.drivers.alsa not in trunk r2421
+- 380: mac osx HID not working
+- 381: Missing attribute in VertexDomain when changing the group attribute of a sprite multiple
+ times
+- 382: evdev device name unicode problem
+- 387: input events stop being processed
+- 391: code cleanups for pyglet.image
+- 392: code cleanups for text and font
+- 393: code cleanup for input and app
+- 405: Virtual key codes are not mapped in OS X
+- 407: random crash with pyglet.clock.tick()
+- 408: IncrementalTextLayout, when deleted, still renders into its batch on document update
+- 409: pyglet.media.have_avbin missing in 1.2dev (svn rev 2445)
+- 411: Problem loading gif animation with alpha
+- 413: TileableTexture interchanges red and blue in some JPGs
+- 414: Carbon platform missing support for multiple mouse buttons during drag
+- 416: Endless loop in pyglet.resource.reindex()
+- 418: Vertical mouse scroll problem under windows
+- 422: Documentation: pyglet.resource and pats
+- 423: glMultiDrawElements called with incorrect arguments in method IndexedVertexDomain.draw
+- 424: Small documentation error in document layout model page
+- 426: Attempt to load resource from zipfile with no internal directory structure fail
+- 429: Exception when attributed text contains multiple trailing newlines
+- 439: EVENT_CLOSE test can't be passed
+- 440: tests/window/WINDOW_SET_MOUSE_SYSTEM_CURSOR does not exit when escape is pressed
+- 443: after the test window.EVENT_SHOW_HIDE process must be killed
+- 444: tests/resources/RES_LOAD_IMAGE opens a slew of windows and doesn't close them
+- 460: multiline label will not center align
+- 463: Min/Mag filter cannot be used with pyglets texture
+- 467: Setting the mouse position should be exposed to pyglet users
+- 471: Exception when clearing text of FormattedDocument with IncrementalTextLayout
+- 485: Wrapper generation (e.g. gengl.py) fails to parse L-prefaced character literals
+- 487: vendor specific keys on linux are crashing pyglet
+- 493: GdkPixbuf2ImageDecoder unable to decode images smaller than 1kb
+- 496: Another OpenGL 1.5 non-conforming video card
+- 510: Win-amd64 issues
+- 512: Fix missing parenthesis in docs
+- 517: tests/window/CONTEXT_SHARE.py glIsList exceptions
+- 519: Windows test log errors
+- 523: some incorrect key constants in the programming guide
+- 524: Pyglet 1.2dev events do not fire on OS X
+- 529: pyglet crashes on FreeBSD-8/amd64 if fonts are used. [patch included]
+- 533: pyglet.media.Player broken on Python3
+- 536: Pitch change functionality with pulseaudio driver.
+- 538: deleting text before an InlineElement fails to adjust its position properly, causes
+ tracebacks if style changed later
+- 551: image encoder fails on python 3
+- 552: Memory leak in pyglet.image.load
+- 558: Patch for /doc/programming_guide/graphics.txt
+- 565: Race condition leads to crash calling glDeleteBuffers
+- 570: xlib 100% CPU usage after post_event
+- 571: pyglet fails for sys.platform=='linux3'
+- 572: Patch for /pyglet/lib.py
+- 579: Failing to load libraries that exist but have fatal problems is _silently_ ignored on Linux
+ and OS X.
+- 580: image.DDS_RGB_DXT1_LOAD (and similar) throw ImageException
+- 610: Wrong messages in the NOTICE file
+- 611: Mouse event incorrect on OS-X
+- 616: Mention font.Font.have_font() in proguide, and expose font.have_font() for convenience
+- 624: mouse_motion events get delivered to cocoa windows on start
+- 625: osx platform segmentation fault when opening input devices
+- 630: pyglet 1.2alpha1 with Python 3.2
+- 637: 'pulse' audio driver sets the volume to 100%
+- 638: Player set_pitch crashes with 'directaudio' driver
+- 653: Unsupported PNG color type: 3
+- 657: gdiplus.py : n_delays must be long, not float.
+- 659: image.save method doesnt catch correct Exception
+- 660: platform_event_loop.post_event doesn't work for Cocoa loop
+- 661: Player.next is converted to Player.__next__ for python3
+- 662: gamepad cannot be found in linux
+- 664: bug in font/win32query.py on win x64 (its not always occur )
+- 665: remove_handler does not remove handler
+- 668: Sync pypng with upstream
+- 671: Support for local libraries
+- 672: User preferences shouldn't use ~/.ApplicationName/ but ~/.config/AplicationName/ in Linux
+- 673: Documentation building requirements are not documented
+- 674: README errors
+- 681: Tuple slice on ImageGrid documented but not implemented
+- 682: Documentation Link on homepage is incorrect.
+- 683: Improving "contribute" page
+- 684: Displaying large font fails under very specific conditions
+- 687: Exposing _draw_list_dirty in batch API.
+- 688: Doc folder refactorization
+- 692: docstring style modifications
+- 696: 2to3 convertsizip_longest to zip_longest
+- 699: SolidColorImagePattern and CheckerImagePattern appear to fail in python3 and pyglet1.2a
+- 704: [patch] py3 compatibility problem in pyglet/graphics/__init__.py
+- 710: resource path when using
+- 715: Patch for /pyglet/image/codecs/dds.py
+- 716: FIX: Pulseaudio / ctypes on Py3k
+- 718: False "ImageDecodeException: Not a GIF stream" in python3.x
+- 719: .bmp files traceback with py3
+- 720: tests/image compatibility StringIO vs BytesIO
+- 721: compatibilty py3 for tests/image TEXTURE_3D.py and TEXTURE_GRID.py
+- 722: TypeError in graphics test suite with python3.x
+- 723: py3 compatibility in tests/image MATRIX_RGB.py, MATRIX_RGBA.py
+- 724: py3 compatibility for png s (bytes vs str)
+- 727: tabs looking bad, especially in monospace fonts
+- 729: "ImportError: No module named future" in image.MATRIX_RGB test suite.
+- 731: Expectations about supported font formats
+- 734: spurious 'class plain' showing in sphinx rendering of doc/programming_guide/text.txt
+- 735: py3: BytesIO and disambiguate div for pyglet/image/__init__.py
+- 736: Pyglet media fails to close PulseAudio instances
+- 737: 1.2 programming guide mentions ALSA and not Pulse
+- 739: FIX: Prevent user mouse stupidity
+- 744: expectations and exploration of fonts in Windows
+- 747: Document pyglet's "shadow window" functionality
+- 754: tests/test.py -- AttributeError: 'module' object has no attribute 'platform' (i.e. pyglet
+ has no platform)
+
+New features
+------------
+- New eventloop implementation
+- Quartz image decoder
+- Improved documentation
+- new API: font.have_font(name) return True if named font is installed
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/apple_remote.py b/pyglet-1.3.0/pyglet-1.3.0/examples/apple_remote.py
new file mode 100644
index 0000000..5afbc7a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/apple_remote.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+
+'''
+'''
+
+from __future__ import print_function
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import pyglet
+import sys
+
+window = pyglet.window.Window()
+
+@window.event
+def on_draw():
+ window.clear()
+
+remote = pyglet.input.get_apple_remote()
+if not remote:
+ print('Apple IR Remote not available.')
+ sys.exit(0)
+
+remote.open(window, exclusive=True)
+
+@remote.select_control.event
+def on_press():
+ print('Press select')
+
+@remote.menu_control.event
+def on_press():
+ print('Press menu')
+
+@remote.up_control.event
+def on_press():
+ print('Press up')
+
+@remote.down_control.event
+def on_press():
+ print('Press down')
+
+@remote.left_control.event
+def on_press():
+ print('Press left')
+
+@remote.right_control.event
+def on_press():
+ print('Press right')
+
+@remote.select_control.event
+def on_release():
+ print('Release select')
+
+@remote.menu_control.event
+def on_release():
+ print('Release menu')
+
+@remote.up_control.event
+def on_release():
+ print('Release up')
+
+@remote.down_control.event
+def on_release():
+ print('Release down')
+
+@remote.left_control.event
+def on_release():
+ print('Release left')
+
+@remote.right_control.event
+def on_release():
+ print('Release right')
+
+pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/apple_remote_demo.py b/pyglet-1.3.0/pyglet-1.3.0/examples/apple_remote_demo.py
new file mode 100644
index 0000000..d57ddf3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/apple_remote_demo.py
@@ -0,0 +1,226 @@
+'''
+A silly demonstration of how to use the Apple remote.
+'''
+
+from __future__ import print_function
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import pyglet
+from pyglet.gl import *
+import sys
+
+
+class MainWindow(pyglet.window.Window):
+ def __init__(self):
+ super(MainWindow, self).__init__(visible=False)
+ self.set_caption('Apple Remote Example')
+
+ # Look for the Apple Remote device.
+ remote = pyglet.input.get_apple_remote()
+ if not remote:
+ print('Apple IR Remote not available.')
+ sys.exit(0)
+
+ # Open the remote in exclusive mode so that pressing the remote
+ # buttons does not activate Front Row, change volume, etc. while
+ # the remote is being used by our program.
+ remote.open(self, exclusive=True)
+
+ # We push this class onto the remote's event handler stack so that
+ # the on_button_press and on_button_release methods which we define
+ # below will be called for the appropriate remote events.
+ remote.push_handlers(self)
+
+ self.carousel = Carousel()
+ self.setup_opengl()
+ pyglet.clock.schedule_interval(self.update, 1/60.0)
+
+ # Event handler for Apple Remote button press events.
+ # The button parameter is a string specifying the button that was pressed.
+ def on_button_press(self, button):
+ print('on_button_press', button)
+
+ if button == 'up':
+ self.carousel.scroll_up()
+ elif button == 'down':
+ self.carousel.scroll_down()
+ elif button == 'left':
+ self.carousel.step_left()
+ elif button == 'right':
+ self.carousel.step_right()
+ elif button == 'left_hold':
+ self.carousel.rotate_left()
+ elif button == 'right_hold':
+ self.carousel.rotate_right()
+ elif button == 'select' or button == 'select_hold':
+ self.carousel.swap_left()
+ elif button == 'menu' or button == 'menu_hold':
+ self.carousel.swap_right()
+
+ # Event handler for Apple Remote button release events.
+ # The button parameter is a string specifying the button that was released.
+ def on_button_release(self, button):
+ print('on_button_release', button)
+
+ if button == 'left_hold':
+ self.carousel.stop_rotating()
+ elif button == 'right_hold':
+ self.carousel.stop_rotating()
+
+ def on_draw(self):
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
+ glLoadIdentity()
+ gluLookAt(0,3,-12,0,3,0,0,1,0)
+ self.carousel.draw()
+
+ def on_resize(self, width, height):
+ glViewport(0, 0, width, height)
+ glMatrixMode(GL_PROJECTION)
+ glLoadIdentity()
+ aspect = width / float(height)
+ glFrustum(-1,1,-1.8/aspect,0.2/aspect,1,100)
+ glMatrixMode(GL_MODELVIEW)
+ return pyglet.event.EVENT_HANDLED
+
+ def setup_opengl(self):
+ glClearColor(1,1,1,1)
+ glEnable(GL_DEPTH_TEST)
+ glEnable(GL_BLEND)
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+
+ def update(self, dt):
+ self.carousel.update(dt)
+
+
+class Carousel:
+ """A rotating collection of labeled tiles."""
+ def __init__(self):
+ self.num_tiles = 14
+ self.index = 0
+ self.float_index = 0.0
+ self.float_increment = 1.0 / self.num_tiles
+ self.angle = 0
+ self.index_diff = 0
+ self.is_rotating = False
+ self.speed = 4 * self.num_tiles
+
+ # Create the tiles in the carousel.
+ self.tiles = []
+ colors = [(255,0,0), (0,255,0), (0,0,255), (255,255,0), (0,205,205), (128,0,128), (255,165,0)]
+ class Tile:
+ value = 0
+ color = [255,255,255]
+ for i in range(self.num_tiles):
+ tile = Tile()
+ tile.value = i % 26
+ tile.color = colors[i%len(colors)]
+ self.tiles.append(tile)
+
+ # Create glyphs for the characters displayed on the tiles.
+ font = pyglet.font.load('Courier', 64)
+ self.glyphs = font.get_glyphs('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
+
+ def scroll_up(self):
+ """Increment the character displayed on the main tile."""
+ self.tiles[self.index].value = (self.tiles[self.index].value + 1) % 26
+
+ def scroll_down(self):
+ """Decrement the character displayed on the main tile."""
+ self.tiles[self.index].value = (self.tiles[self.index].value - 1) % 26
+
+ def swap_left(self):
+ """Swap the two left tiles."""
+ i = self.index
+ j = (self.index - 1) % self.num_tiles
+ self.tiles[i], self.tiles[j] = self.tiles[j], self.tiles[i]
+
+ def swap_right(self):
+ """Swap the two right tiles."""
+ i = self.index
+ j = (self.index + 1) % self.num_tiles
+ self.tiles[i], self.tiles[j] = self.tiles[j], self.tiles[i]
+
+ def step_left(self):
+ """Rotate the carousel one tile to the left."""
+ self.direction = -1
+ self.index_diff += 1.0
+
+ def step_right(self):
+ """Rotate the carousel one tile to the right."""
+ self.direction = 1
+ self.index_diff += 1.0
+
+ def rotate_left(self):
+ """Start the carousel rotating continuously to the left."""
+ self.is_rotating = True
+ self.direction = -1
+
+ def rotate_right(self):
+ """Start the carousel rotating continuously to the right."""
+ self.is_rotating = True
+ self.direction = 1
+
+ def stop_rotating(self):
+ """Stop continuous rotation and make sure we end up at a tile location."""
+ self.index_diff = round(self.float_index) - self.float_index
+ if self.index_diff < 0:
+ self.direction = -1
+ else:
+ self.direction = 1
+ self.index_diff = abs(self.index_diff)
+
+ def draw(self):
+ glPushMatrix()
+ glRotatef(-self.angle, 0, 1, 0)
+ for i in range(self.num_tiles):
+ self.draw_tile(i)
+ glPopMatrix()
+
+ def draw_tile(self, index):
+ angle = index * (360.0 / self.num_tiles)
+
+ glPushMatrix()
+ glRotatef(angle,0,1,0)
+ glTranslatef(0,0,-7.5)
+ glRotatef(-angle+self.angle,0,1,0)
+
+ texture = self.glyphs[self.tiles[index].value].texture
+ vertex_list = pyglet.graphics.vertex_list(4, 'v2f', ('t3f', texture.tex_coords))
+ vertex_list.vertices[:] = [-1, -1, 1, -1, 1, 1, -1, 1]
+ # Draw tile background.
+ glColor3ub(*self.tiles[index].color)
+ vertex_list.draw(GL_QUADS)
+ # Draw tile label.
+ glBindTexture(texture.target, texture.id)
+ glEnable(texture.target)
+ glColor3ub(0,0,0)
+ vertex_list.vertices[:] = [.8, -.8, -.8, -.8, -.8, .8, .8, .8]
+ glTranslatef(0,0,-.01)
+ vertex_list.draw(GL_QUADS)
+ glDisable(texture.target)
+ glPopMatrix()
+
+ def update(self, dt):
+ if self.is_rotating or self.index_diff:
+ increment = self.direction * self.speed * self.float_increment * dt
+ self.float_index = (self.float_index + increment) % self.num_tiles
+
+ if self.index_diff:
+ self.index_diff -= abs(increment)
+ if self.index_diff < 0:
+ self.index_diff = 0
+ self.float_index = round(self.float_index) % self.num_tiles
+ self.index = int(self.float_index)
+ self.is_rotating = False
+
+ self.angle = (self.float_index / self.num_tiles) * 360
+
+
+if __name__ == '__main__':
+ window = MainWindow()
+ window.clear()
+ window.flip()
+ window.set_visible(True)
+ pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/README b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/README
new file mode 100644
index 0000000..9cfa41f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/README
@@ -0,0 +1,9 @@
+Astraea
+=======
+
+This is an example program that accompanies pyglet (http://www.pyglet.org).
+
+The source code is licensed under the BSD license, which is quite permissive
+(see the source header for details).
+
+All artwork is placed is Copyright 2007 Alex Holkner.
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/assets/app.icns b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/assets/app.icns
new file mode 100644
index 0000000..ce9e61f
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/assets/app.icns differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/assets/app.ico b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/assets/app.ico
new file mode 100644
index 0000000..69ff855
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/assets/app.ico differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/assets/ship.svg b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/assets/ship.svg
new file mode 100644
index 0000000..5ff7ac0
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/assets/ship.svg
@@ -0,0 +1,209 @@
+
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/astraea.py b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/astraea.py
new file mode 100644
index 0000000..e6aeb15
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/astraea.py
@@ -0,0 +1,895 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''A sprite-based game loosely based on the classic "Asteroids".
+
+Shoot the asteroids, get high score.
+
+Left/right: Turn ship
+Up: Thrusters
+Space: Shoot
+'''
+
+import math
+import os
+import random
+import sys
+
+import pyglet
+from pyglet.gl import *
+from pyglet import resource
+from pyglet.window import key
+
+PLAYER_SPIN_SPEED = 360.
+PLAYER_ACCEL = 200.
+PLAYER_FIRE_DELAY = 0.1
+
+BULLET_SPEED = 1000.
+
+MAX_ASTEROID_SPIN_SPEED = 180.
+MAX_ASTEROID_SPEED = 100.
+
+INITIAL_ASTEROIDS = [2, 3, 4, 5]
+ASTEROID_DEBRIS_COUNT = 3
+MAX_DIFFICULTY = len(INITIAL_ASTEROIDS) - 1
+
+ARENA_WIDTH = 640
+ARENA_HEIGHT = 480
+
+KEY_FIRE = key.SPACE
+KEY_PAUSE = key.ESCAPE
+
+COLLISION_RESOLUTION = 8
+
+SMOKE_ANIMATION_PERIOD = 0.05
+EXPLOSION_ANIMATION_PERIOD = 0.07
+PLAYER_FLASH_PERIOD = 0.15
+
+GET_READY_DELAY = 1.
+BEGIN_PLAY_DELAY = 2.
+LIFE_LOST_DELAY = 2.
+
+FONT_NAME = ('Verdana', 'Helvetica', 'Arial')
+
+INSTRUCTIONS = \
+'''Your ship is lost in a peculiar unchartered area of space-time infested with asteroids! You have no chance for survival except to rack up the highest score possible.
+
+Left/Right: Turn ship
+Up: Thrusters
+Space: Shoot
+
+Be careful, there's not much friction in space.'''
+
+def center_anchor(img):
+ img.anchor_x = img.width // 2
+ img.anchor_y = img.height // 2
+
+# --------------------------------------------------------------------------
+# Game objects
+# --------------------------------------------------------------------------
+
+def wrap(value, width):
+ if value > width:
+ value -= width
+ if value < 0:
+ value += width
+ return value
+
+def to_radians(degrees):
+ return math.pi * degrees / 180.0
+
+class WrappingSprite(pyglet.sprite.Sprite):
+ dx = 0
+ dy = 0
+ rotation_speed = 0
+
+ def __init__(self, img, x, y, batch=None):
+ super(WrappingSprite, self).__init__(img, x, y, batch=batch)
+ self.collision_radius = self.image.width // COLLISION_RESOLUTION // 2
+
+ def update(self, dt):
+ x = self.x + self.dx * dt
+ y = self.y + self.dy * dt
+ rotation = self.rotation + self.rotation_speed * dt
+
+ self.x = wrap(x, ARENA_WIDTH)
+ self.y = wrap(y, ARENA_HEIGHT)
+ self.rotation = wrap(rotation, 360.)
+
+ def collision_cells(self):
+ '''Generate a sequence of (x, y) cells this object covers,
+ approximately.'''
+ radius = self.collision_radius
+ cellx = int(self.x / COLLISION_RESOLUTION)
+ celly = int(self.y / COLLISION_RESOLUTION)
+ for y in range(celly - radius, celly + radius + 1):
+ for x in range(cellx - radius, cellx + radius + 1):
+ yield x, y
+
+class AsteroidSize(object):
+ def __init__(self, filename, points):
+ self.img = resource.image(filename)
+ center_anchor(self.img)
+ self.next_size = None
+ self.points = points
+
+class Asteroid(WrappingSprite):
+ def __init__(self, size, x, y, batch=None):
+ super(Asteroid, self).__init__(size.img, x, y, batch=batch)
+ self.dx = (random.random() - 0.5) * MAX_ASTEROID_SPEED
+ self.dy = (random.random() - 0.5) * MAX_ASTEROID_SPEED
+ self.size = size
+ self.rotation = random.random() * 360.
+ self.rotation_speed = (random.random() - 0.5) * MAX_ASTEROID_SPIN_SPEED
+ self.hit = False
+
+ def destroy(self):
+ global score
+ score += self.size.points
+
+ # Modifies the asteroids list.
+ next_size = self.size.next_size
+ if next_size:
+ # Spawn debris
+ for i in range(ASTEROID_DEBRIS_COUNT):
+ asteroids.append(Asteroid(next_size, self.x, self.y,
+ batch=self.batch))
+
+ self.delete()
+ asteroids.remove(self)
+
+class Player(WrappingSprite, key.KeyStateHandler):
+ def __init__(self, img, batch=None):
+ super(Player, self).__init__(img, ARENA_WIDTH // 2, ARENA_HEIGHT // 2,
+ batch=batch)
+ center_anchor(img)
+ self.reset()
+
+ def reset(self):
+ self.x = ARENA_WIDTH // 2
+ self.y = ARENA_HEIGHT // 2
+ self.dx = 0
+ self.dy = 0
+ self.rotation = 0
+ self.fire_timeout = 0
+ self.hit = False
+ self.invincible = True
+ self.visible = True
+
+ self.flash_timeout = 0
+ self.flash_visible = False
+
+ def update(self, dt):
+ # Update rotation
+ if self[key.LEFT]:
+ self.rotation -= PLAYER_SPIN_SPEED * dt
+ if self[key.RIGHT]:
+ self.rotation += PLAYER_SPIN_SPEED * dt
+
+ # Get x/y components of orientation
+ rotation_x = math.cos(to_radians(-self.rotation))
+ rotation_y = math.sin(to_radians(-self.rotation))
+
+ # Update velocity
+ if self[key.UP]:
+ self.dx += PLAYER_ACCEL * rotation_x * dt
+ self.dy += PLAYER_ACCEL * rotation_y * dt
+
+ # Update position
+ super(Player, self).update(dt)
+
+ # Fire bullet?
+ self.fire_timeout -= dt
+ if self[KEY_FIRE] and self.fire_timeout <= 0 and not self.invincible:
+ self.fire_timeout = PLAYER_FIRE_DELAY
+
+ # For simplicity, start the bullet at the player position. If the
+ # ship were bigger, or if bullets moved slower we'd adjust this
+ # based on the orientation of the ship.
+ bullets.append(Bullet(self.x, self.y,
+ rotation_x * BULLET_SPEED,
+ rotation_y * BULLET_SPEED, batch=batch))
+
+ if enable_sound:
+ bullet_sound.play()
+
+ # Update flash (invincible) animation
+ if self.invincible:
+ self.flash_timeout -= dt
+ if self.flash_timeout <= 0:
+ self.flash_timeout = PLAYER_FLASH_PERIOD
+ self.flash_visible = not self.flash_visible
+ else:
+ self.flash_visible = True
+
+ self.opacity = (self.visible and self.flash_visible) and 255 or 0
+
+class MovingSprite(pyglet.sprite.Sprite):
+ def __init__(self, image, x, y, dx, dy, batch=None):
+ super(MovingSprite, self).__init__(image, x, y, batch=batch)
+ self.dx = dx
+ self.dy = dy
+
+ def update(self, dt):
+ self.x += self.dx * dt
+ self.y += self.dy * dt
+
+class Bullet(MovingSprite):
+ def __init__(self, x, y, dx, dy, batch=None):
+ super(Bullet, self).__init__(bullet_image, x, y, dx, dy, batch=batch)
+
+ def update(self, dt):
+ self.x += self.dx * dt
+ self.y += self.dy * dt
+ if not (self.x >= 0 and self.x < ARENA_WIDTH and
+ self.y >= 0 and self.y < ARENA_HEIGHT):
+ self.delete()
+ bullets.remove(self)
+
+class EffectSprite(MovingSprite):
+ def on_animation_end(self):
+ self.delete()
+ animations.remove(self)
+
+class Starfield(object):
+ def __init__(self, img):
+ self.x = 0
+ self.y = 0
+ self.dx = 0.05
+ self.dy = -0.06
+ self.img = img
+
+ def update(self, dt):
+ self.x += self.dx * dt
+ self.y += self.dy * dt
+
+ def draw(self):
+ # Fiddle with the texture matrix to make the starfield slide slowly
+ # over the window.
+ glMatrixMode(GL_TEXTURE)
+ glPushMatrix()
+ glTranslatef(self.x, self.y, 0)
+
+ self.img.blit(0, 0, width=ARENA_WIDTH, height=ARENA_HEIGHT)
+
+ glPopMatrix()
+ glMatrixMode(GL_MODELVIEW)
+
+# --------------------------------------------------------------------------
+# Overlays, such as menus and "Game Over" banners
+# --------------------------------------------------------------------------
+
+class Overlay(object):
+ def update(self, dt):
+ pass
+
+ def draw(self):
+ pass
+
+class Banner(Overlay):
+ def __init__(self, label, dismiss_func=None, timeout=None):
+ self.text = pyglet.text.Label(label,
+ font_name=FONT_NAME,
+ font_size=36,
+ x=ARENA_WIDTH // 2,
+ y=ARENA_HEIGHT // 2,
+ anchor_x='center',
+ anchor_y='center')
+
+ self.dismiss_func = dismiss_func
+ self.timeout = timeout
+ if timeout and dismiss_func:
+ pyglet.clock.schedule_once(dismiss_func, timeout)
+
+ def draw(self):
+ self.text.draw()
+
+ def on_key_press(self, symbol, modifiers):
+ if self.dismiss_func and not self.timeout:
+ self.dismiss_func()
+ return True
+
+class Menu(Overlay):
+ def __init__(self, title):
+ self.items = []
+ self.title_text = pyglet.text.Label(title,
+ font_name=FONT_NAME,
+ font_size=36,
+ x=ARENA_WIDTH // 2,
+ y=350,
+ anchor_x='center',
+ anchor_y='center')
+
+ def reset(self):
+ self.selected_index = 0
+ self.items[self.selected_index].selected = True
+
+ def on_key_press(self, symbol, modifiers):
+ if symbol == key.DOWN:
+ self.selected_index += 1
+ elif symbol == key.UP:
+ self.selected_index -= 1
+ self.selected_index = min(max(self.selected_index, 0),
+ len(self.items) - 1)
+
+ if symbol in (key.DOWN, key.UP) and enable_sound:
+ bullet_sound.play()
+
+ def on_key_release(self, symbol, modifiers):
+ self.items[self.selected_index].on_key_release(symbol, modifiers)
+
+ def draw(self):
+ self.title_text.draw()
+ for i, item in enumerate(self.items):
+ item.draw(i == self.selected_index)
+
+class MenuItem(object):
+ pointer_color = (.46, 0, 1.)
+ inverted_pointers = False
+
+ def __init__(self, label, y, activate_func):
+ self.y = y
+ self.text = pyglet.text.Label(label,
+ font_name=FONT_NAME,
+ font_size=14,
+ x=ARENA_WIDTH // 2,
+ y=y,
+ anchor_x='center',
+ anchor_y='center')
+ self.activate_func = activate_func
+
+ def draw_pointer(self, x, y, color, flip=False):
+ # Tint the pointer image to a color
+ glPushAttrib(GL_CURRENT_BIT)
+ glColor3f(*color)
+ if flip:
+ pointer_image_flip.blit(x, y)
+ else:
+ pointer_image.blit(x, y)
+ glPopAttrib()
+
+ def draw(self, selected):
+ self.text.draw()
+
+ if selected:
+ self.draw_pointer(
+ self.text.x - self.text.content_width // 2 -
+ pointer_image.width // 2,
+ self.y,
+ self.pointer_color,
+ self.inverted_pointers)
+ self.draw_pointer(
+ self.text.x + self.text.content_width // 2 +
+ pointer_image.width // 2,
+ self.y,
+ self.pointer_color,
+ not self.inverted_pointers)
+
+ def on_key_release(self, symbol, modifiers):
+ if symbol == key.ENTER and self.activate_func:
+ self.activate_func()
+ if enable_sound:
+ bullet_sound.play()
+
+class ToggleMenuItem(MenuItem):
+ pointer_color = (.27, .82, .25)
+ inverted_pointers = True
+
+ def __init__(self, label, value, y, toggle_func):
+ self.value = value
+ self.label = label
+ self.toggle_func = toggle_func
+ super(ToggleMenuItem, self).__init__(self.get_label(), y, None)
+
+ def get_label(self):
+ return self.label + (self.value and ': ON' or ': OFF')
+
+ def on_key_release(self, symbol, modifiers):
+ if symbol == key.LEFT or symbol == key.RIGHT:
+ self.value = not self.value
+ self.text.text = self.get_label()
+ self.toggle_func(self.value)
+ if enable_sound:
+ bullet_sound.play()
+
+class DifficultyMenuItem(MenuItem):
+ pointer_color = (.27, .82, .25)
+ inverted_pointers = True
+
+ def __init__(self, y):
+ super(DifficultyMenuItem, self).__init__(self.get_label(), y, None)
+
+ def get_label(self):
+ if difficulty == 0:
+ return 'Difficulty: Pebbles'
+ elif difficulty == 1:
+ return 'Difficulty: Stones'
+ elif difficulty == 2:
+ return 'Difficulty: Asteroids'
+ elif difficulty == 3:
+ return 'Difficulty: Meteors'
+ else:
+ return 'Difficulty: %d' % difficulty
+
+ def on_key_release(self, symbol, modifiers):
+ global difficulty
+ if symbol == key.LEFT:
+ difficulty -= 1
+ elif symbol == key.RIGHT:
+ difficulty += 1
+ difficulty = min(max(difficulty, 0), MAX_DIFFICULTY)
+ self.text.text = self.get_label()
+
+ if symbol in (key.LEFT, key.RIGHT) and enable_sound:
+ bullet_sound.play()
+
+class MainMenu(Menu):
+ def __init__(self):
+ super(MainMenu, self).__init__('Astraea')
+
+ self.items.append(MenuItem('New Game', 240, begin_game))
+ self.items.append(MenuItem('Instructions', 200,
+ begin_instructions_menu))
+ self.items.append(MenuItem('Options', 160, begin_options_menu))
+ self.items.append(MenuItem('Quit', 120, sys.exit))
+ self.reset()
+
+class OptionsMenu(Menu):
+ def __init__(self):
+ super(OptionsMenu, self).__init__('Options')
+
+ self.items.append(DifficultyMenuItem(280))
+ def set_enable_sound(value):
+ global enable_sound
+ enable_sound = value
+ self.items.append(ToggleMenuItem('Sound', enable_sound, 240,
+ set_enable_sound))
+
+ def set_enable_fullscreen(value):
+ win.set_fullscreen(value, width=ARENA_WIDTH, height=ARENA_HEIGHT)
+ self.items.append(ToggleMenuItem('Fullscreen', win.fullscreen, 200,
+ set_enable_fullscreen))
+
+ self.items.append(ToggleMenuItem('Vsync', win.vsync, 160,
+ win.set_vsync))
+
+ def set_show_fps(value):
+ global show_fps
+ show_fps = value
+ self.items.append(ToggleMenuItem('FPS', show_fps, 120, set_show_fps))
+ self.items.append(MenuItem('Ok', 60, begin_main_menu))
+ self.reset()
+
+class InstructionsMenu(Menu):
+ def __init__(self):
+ super(InstructionsMenu, self).__init__('Instructions')
+
+ self.items.append(MenuItem('Ok', 50, begin_main_menu))
+ self.reset()
+
+ self.instruction_text = pyglet.text.Label(INSTRUCTIONS,
+ font_name=FONT_NAME,
+ font_size=14,
+ x=20, y=300,
+ width=ARENA_WIDTH - 40,
+ anchor_y='top',
+ multiline=True)
+
+ def draw(self):
+ super(InstructionsMenu, self).draw()
+ self.instruction_text.draw()
+
+class PauseMenu(Menu):
+ def __init__(self):
+ super(PauseMenu, self).__init__('Paused')
+
+ self.items.append(MenuItem('Continue Game', 240, resume_game))
+ self.items.append(MenuItem('Main Menu', 200, end_game))
+ self.reset()
+
+# --------------------------------------------------------------------------
+# Game state functions
+# --------------------------------------------------------------------------
+
+def check_collisions():
+ # Check for collisions using an approximate uniform grid.
+ #
+ # 1. Mark all grid cells that the bullets are in
+ # 2. Mark all grid cells that the player is in
+ # 3. For each asteroid, check grid cells that are covered for
+ # a collision.
+ #
+ # This is by no means perfect collision detection (in particular,
+ # there are rounding errors, and it doesn't take into account the
+ # arena wrapping). Improving it is left as an exercise for the
+ # reader.
+
+ # The collision grid. It is recreated each iteration, as bullets move
+ # quickly.
+ hit_squares = {}
+
+ # 1. Mark all grid cells that the bullets are in. Assume bullets
+ # occupy a single cell.
+ for bullet in bullets:
+ hit_squares[int(bullet.x / COLLISION_RESOLUTION),
+ int(bullet.y / COLLISION_RESOLUTION)] = bullet
+
+ # 2. Mark all grid cells that the player is in.
+ for x, y in player.collision_cells():
+ hit_squares[x, y] = player
+
+ # 3. Check grid cells of each asteroid for a collision.
+ for asteroid in asteroids:
+ for x, y in asteroid.collision_cells():
+ if (x, y) in hit_squares:
+ asteroid.hit = True
+ hit_squares[x, y].hit = True
+ del hit_squares[x, y]
+
+def begin_main_menu():
+ set_overlay(MainMenu())
+
+def begin_options_menu():
+ set_overlay(OptionsMenu())
+
+def begin_instructions_menu():
+ set_overlay(InstructionsMenu())
+
+def begin_game():
+ global player_lives
+ global score
+ player_lives = 3
+ score = 0
+
+ begin_clear_background()
+ set_overlay(Banner('Get Ready', begin_first_round, GET_READY_DELAY))
+
+def begin_first_round(*args):
+ player.reset()
+ player.visible = True
+ begin_round()
+
+def next_round(*args):
+ global in_game
+ player.invincible = True
+ in_game = False
+ set_overlay(Banner('Get Ready', begin_round, GET_READY_DELAY))
+
+def begin_round(*args):
+ global asteroids
+ global bullets
+ global animations
+ global in_game
+ asteroids = []
+ for i in range(INITIAL_ASTEROIDS[difficulty]):
+ x = random.random() * ARENA_WIDTH
+ y = random.random() * ARENA_HEIGHT
+ asteroids.append(Asteroid(asteroid_sizes[-1], x, y, wrapping_batch))
+
+ for bullet in bullets:
+ bullet.delete()
+
+ for animation in animations:
+ animation.delete()
+
+ bullets = []
+ animations = []
+ in_game = True
+ set_overlay(None)
+ pyglet.clock.schedule_once(begin_play, BEGIN_PLAY_DELAY)
+
+def begin_play(*args):
+ player.invincible = False
+
+def begin_life(*args):
+ player.reset()
+ pyglet.clock.schedule_once(begin_play, BEGIN_PLAY_DELAY)
+
+def life_lost(*args):
+ global player_lives
+ player_lives -= 1
+
+ if player_lives > 0:
+ begin_life()
+ else:
+ game_over()
+
+def game_over():
+ set_overlay(Banner('Game Over', end_game))
+
+def pause_game():
+ global paused
+ paused = True
+ set_overlay(PauseMenu())
+
+def resume_game():
+ global paused
+ paused = False
+ set_overlay(None)
+
+def end_game():
+ global in_game
+ global paused
+ paused = False
+ in_game = False
+ player.invincible = True
+ pyglet.clock.unschedule(life_lost)
+ pyglet.clock.unschedule(begin_play)
+ begin_menu_background()
+ set_overlay(MainMenu())
+
+def set_overlay(new_overlay):
+ global overlay
+ if overlay:
+ win.remove_handlers(overlay)
+ overlay = new_overlay
+ if overlay:
+ win.push_handlers(overlay)
+
+def begin_menu_background():
+ global asteroids
+ global bullets
+ global animations
+ global in_game
+ global player_lives
+
+ asteroids = []
+ for i in range(11):
+ x = random.random() * ARENA_WIDTH
+ y = random.random() * ARENA_HEIGHT
+ asteroids.append(Asteroid(asteroid_sizes[i // 4], x, y, wrapping_batch))
+
+ for bullet in bullets:
+ bullet.delete()
+
+ for animation in animations:
+ animation.delete()
+
+ bullets = []
+ animations = []
+ in_game = False
+ player_lives = 0
+ player.visible = False
+
+def begin_clear_background():
+ global asteroids
+ global bullets
+ global animations
+
+ for bullet in bullets:
+ bullet.delete()
+
+ for animation in animations:
+ animation.delete()
+
+ asteroids = []
+ bullets = []
+ animations = []
+ player.visible = False
+
+# --------------------------------------------------------------------------
+# Create window
+# --------------------------------------------------------------------------
+
+win = pyglet.window.Window(ARENA_WIDTH, ARENA_HEIGHT, caption='Astraea')
+
+@win.event
+def on_key_press(symbol, modifiers):
+ # Overrides default Escape key behaviour
+ if symbol == KEY_PAUSE and in_game:
+ if not paused:
+ pause_game()
+ else:
+ resume_game()
+ return True
+ elif symbol == key.ESCAPE:
+ sys.exit()
+ return pyglet.event.EVENT_HANDLED
+
+@win.event
+def on_draw():
+ glColor3f(1, 1, 1)
+
+ # Render
+ starfield.draw()
+
+ for (x, y) in ((0, ARENA_HEIGHT), # Top
+ (-ARENA_WIDTH, 0), # Left
+ (0, 0), # Center
+ (ARENA_WIDTH, 0), # Right
+ (0, -ARENA_HEIGHT)): # Bottom
+ glLoadIdentity()
+ glTranslatef(x, y, 0)
+ wrapping_batch.draw()
+
+ glLoadIdentity()
+ batch.draw()
+
+ glLoadIdentity()
+
+ if in_game:
+ # HUD ship lives
+ x = 10 + player.image.width // 2
+ for i in range(player_lives - 1):
+ player.image.blit(x, win.height - player.image.height // 2 - 10, 0)
+ x += player.image.width + 10
+
+ # HUD score
+ score_text.text = str(score)
+ score_text.draw()
+
+ if overlay:
+ overlay.draw()
+
+ if show_fps:
+ fps_display.draw()
+
+
+# --------------------------------------------------------------------------
+# Load resources
+# --------------------------------------------------------------------------
+
+batch = pyglet.graphics.Batch()
+wrapping_batch = pyglet.graphics.Batch()
+
+resource.path.append('res')
+resource.reindex()
+
+asteroid_sizes = [AsteroidSize('asteroid1.png', 100),
+ AsteroidSize('asteroid2.png', 50),
+ AsteroidSize('asteroid3.png', 10)]
+for small, big in zip(asteroid_sizes[:-1], asteroid_sizes[1:]):
+ big.next_size = small
+
+bullet_image = resource.image('bullet.png')
+center_anchor(bullet_image)
+
+smoke_images_image = resource.image('smoke.png')
+smoke_images = pyglet.image.ImageGrid(smoke_images_image, 1, 8)
+for smoke_image in smoke_images:
+ center_anchor(smoke_image)
+smoke_animation = \
+ pyglet.image.Animation.from_image_sequence(smoke_images,
+ SMOKE_ANIMATION_PERIOD,
+ loop=False)
+
+explosion_images_image = resource.image('explosion.png')
+explosion_images = pyglet.image.ImageGrid(explosion_images_image, 2, 8)
+explosion_images = explosion_images.get_texture_sequence()
+for explosion_image in explosion_images:
+ center_anchor(explosion_image)
+explosion_animation = \
+ pyglet.image.Animation.from_image_sequence(explosion_images,
+ EXPLOSION_ANIMATION_PERIOD,
+ loop=False)
+
+pointer_image = resource.image('pointer.png')
+pointer_image.anchor_x = pointer_image.width // 2
+pointer_image.anchor_y = pointer_image.height // 2
+pointer_image_flip = resource.image('pointer.png', flip_x=True)
+
+explosion_sound = resource.media('explosion.wav', streaming=False)
+bullet_sound = resource.media('bullet.wav', streaming=False)
+
+starfield = Starfield(resource.image('starfield.jpg'))
+player = Player(resource.image('ship.png'), wrapping_batch)
+win.push_handlers(player)
+
+# --------------------------------------------------------------------------
+# Global game state vars
+# --------------------------------------------------------------------------
+
+overlay = None
+in_game = False
+paused = False
+score = 0
+
+difficulty = 2
+show_fps = False
+enable_sound = True
+
+score_text = pyglet.text.Label('',
+ font_name=FONT_NAME,
+ font_size=18,
+ x=ARENA_WIDTH - 10,
+ y=ARENA_HEIGHT - 10,
+ anchor_x='right',
+ anchor_y='top')
+
+fps_display = pyglet.window.FPSDisplay(win)
+
+bullets = []
+animations = []
+
+# --------------------------------------------------------------------------
+# Game update
+# --------------------------------------------------------------------------
+
+def update(dt):
+ if overlay:
+ overlay.update(dt)
+
+ if not paused:
+ starfield.update(dt)
+
+ player.update(dt)
+ for asteroid in asteroids:
+ asteroid.update(dt)
+ for bullet in bullets[:]:
+ bullet.update(dt)
+ for animation in animations[:]:
+ animation.update(dt)
+
+
+ if not player.invincible:
+ # Collide bullets and player with asteroids
+ check_collisions()
+
+ # Destroy asteroids that were hit
+ for asteroid in [a for a in asteroids if a.hit]:
+ animations.append(EffectSprite(smoke_animation,
+ asteroid.x, asteroid.y,
+ asteroid.dx, asteroid.dy,
+ batch=batch))
+ asteroid.destroy()
+ if enable_sound:
+ explosion_sound.play()
+
+ # Check if the player was hit
+ if player.hit:
+ animations.append(EffectSprite(explosion_animation,
+ player.x, player.y,
+ player.dx, player.dy,
+ batch=batch))
+ player.invincible = True
+ player.visible = False
+ pyglet.clock.schedule_once(life_lost, LIFE_LOST_DELAY)
+
+ # Check if the area is clear
+ if not asteroids:
+ next_round()
+pyglet.clock.schedule_interval(update, 1/60.)
+
+# --------------------------------------------------------------------------
+# Start game
+# --------------------------------------------------------------------------
+
+glEnable(GL_BLEND)
+glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+
+begin_menu_background()
+begin_main_menu()
+
+pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/asteroid1.png b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/asteroid1.png
new file mode 100644
index 0000000..2f7118d
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/asteroid1.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/asteroid2.png b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/asteroid2.png
new file mode 100644
index 0000000..4fb0dc2
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/asteroid2.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/asteroid3.png b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/asteroid3.png
new file mode 100644
index 0000000..079a53c
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/asteroid3.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/bullet.png b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/bullet.png
new file mode 100644
index 0000000..bfb6ad4
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/bullet.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/bullet.wav b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/bullet.wav
new file mode 100644
index 0000000..b1ebaaf
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/bullet.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/explosion.png b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/explosion.png
new file mode 100644
index 0000000..38b9e4a
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/explosion.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/explosion.wav b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/explosion.wav
new file mode 100644
index 0000000..e881fa1
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/explosion.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/pointer.png b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/pointer.png
new file mode 100644
index 0000000..f3c5b0b
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/pointer.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/ship.png b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/ship.png
new file mode 100644
index 0000000..b2b525a
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/ship.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/smoke.png b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/smoke.png
new file mode 100644
index 0000000..4d666aa
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/smoke.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/starfield.jpg b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/starfield.jpg
new file mode 100644
index 0000000..f965ddc
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/res/starfield.jpg differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/setup.py b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/setup.py
new file mode 100644
index 0000000..d204cd3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/astraea/setup.py
@@ -0,0 +1,92 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+# An example setup.py that can be used to create both standalone Windows
+# executables (requires py2exe) and Mac OS X applications (requires py2app).
+#
+# On Windows::
+#
+# python setup.py py2exe
+#
+# On Mac OS X::
+#
+# python setup.py py2app
+#
+
+from distutils.core import setup
+
+import os
+
+# The main entry point of the program
+script_file = 'astraea.py'
+
+# Create a list of data files. Add everything in the 'res/' directory.
+data_files = []
+for file in os.listdir('res'):
+ file = os.path.join('res', file)
+ if os.path.isfile(file):
+ data_files.append(file)
+
+# Setup args that apply to all setups, including ordinary distutils.
+setup_args = dict(
+ data_files=[('res', data_files)]
+)
+
+# py2exe options
+try:
+ import py2exe
+ setup_args.update(dict(
+ windows=[dict(
+ script=script_file,
+ icon_resources=[(1, 'assets/app.ico')],
+ )],
+ ))
+except ImportError:
+ pass
+
+# py2app options
+try:
+ import py2app
+ setup_args.update(dict(
+ app=[script_file],
+ options=dict(py2app=dict(
+ argv_emulation=True,
+ iconfile='assets/app.icns',
+ )),
+ ))
+except ImportError:
+ pass
+
+setup(**setup_args)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/events.py b/pyglet-1.3.0/pyglet-1.3.0/examples/events.py
new file mode 100644
index 0000000..cfa7ca5
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/events.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Prints all window events to stdout.
+'''
+
+import pyglet
+
+window = pyglet.window.Window(resizable=True)
+
+@window.event
+def on_draw():
+ window.clear()
+
+window.push_handlers(pyglet.window.event.WindowEventLogger())
+
+pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/fixed_resolution.py b/pyglet-1.3.0/pyglet-1.3.0/examples/fixed_resolution.py
new file mode 100644
index 0000000..1c0ac22
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/fixed_resolution.py
@@ -0,0 +1,156 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+# $Id:$
+
+'''Demonstrates one way of fixing the display resolution to a certain
+size, but rendering to the full screen.
+
+The method used in this example is:
+
+1. Set the OpenGL viewport to the fixed resolution
+2. Render the scene using any OpenGL functions (here, just a polygon)
+3. Copy the framebuffer into a texture
+4. Reset the OpenGL viewport to the window (full screen) size
+5. Blit the texture to the framebuffer
+
+Recent video cards could also render the scene directly to the texture
+using EXT_framebuffer_object. (This is not demonstrated in this example).
+'''
+
+from pyglet.gl import *
+import pyglet
+
+# Create a fullscreen window using the user's desktop resolution. You can
+# also use this technique on ordinary resizable windows.
+window = pyglet.window.Window(fullscreen=True)
+
+# Use 320x200 fixed resolution to make the effect completely obvious. You
+# can change this to a more reasonable value such as 800x600 here.
+target_resolution = 320, 200
+
+class FixedResolutionViewport(object):
+ def __init__(self, window, width, height, filtered=False):
+ self.window = window
+ self.width = width
+ self.height = height
+ self.texture = pyglet.image.Texture.create(width, height,
+ rectangle=True)
+
+ if not filtered:
+ # By default the texture will be bilinear filtered when scaled
+ # up. If requested, turn filtering off. This makes the image
+ # aliased, but is more suitable for pixel art.
+ glTexParameteri(self.texture.target,
+ GL_TEXTURE_MAG_FILTER, GL_NEAREST)
+ glTexParameteri(self.texture.target,
+ GL_TEXTURE_MIN_FILTER, GL_NEAREST)
+
+ def begin(self):
+ glViewport(0, 0, self.width, self.height)
+ self.set_fixed_projection()
+
+ def end(self):
+ buffer = pyglet.image.get_buffer_manager().get_color_buffer()
+ self.texture.blit_into(buffer, 0, 0, 0)
+
+ glViewport(0, 0, self.window.width, self.window.height)
+ self.set_window_projection()
+
+ aspect_width = self.window.width / float(self.width)
+ aspect_height = self.window.height / float(self.height)
+ if aspect_width > aspect_height:
+ scale_width = aspect_height * self.width
+ scale_height = aspect_height * self.height
+ else:
+ scale_width = aspect_width * self.width
+ scale_height = aspect_width * self.height
+ x = (self.window.width - scale_width) / 2
+ y = (self.window.height - scale_height) / 2
+
+ glClearColor(0, 0, 0, 1)
+ glClear(GL_COLOR_BUFFER_BIT)
+ glLoadIdentity()
+ glColor3f(1, 1, 1)
+ self.texture.blit(x, y, width=scale_width, height=scale_height)
+
+ def set_fixed_projection(self):
+ # Override this method if you need to change the projection of the
+ # fixed resolution viewport.
+ glMatrixMode(GL_PROJECTION)
+ glLoadIdentity()
+ glOrtho(0, self.width, 0, self.height, -1, 1)
+ glMatrixMode(GL_MODELVIEW)
+
+ def set_window_projection(self):
+ # This is the same as the default window projection, reprinted here
+ # for clarity.
+ glMatrixMode(GL_PROJECTION)
+ glLoadIdentity()
+ glOrtho(0, self.window.width, 0, self.window.height, -1, 1)
+ glMatrixMode(GL_MODELVIEW)
+
+target_width, target_height = target_resolution
+viewport = FixedResolutionViewport(window,
+ target_width, target_height, filtered=False)
+
+def draw_scene():
+ '''Draw the scene, assuming the fixed resolution viewport and projection
+ have been set up. This just draws the rotated polygon.'''
+ glClearColor(1, 1, 1, 1)
+ glClear(GL_COLOR_BUFFER_BIT)
+
+ glLoadIdentity()
+ w, h = target_resolution
+ glTranslatef(w//2, h//2, 0)
+ glRotatef(rotate, 0, 0, 1)
+ glColor3f(1, 0, 0)
+ s = min(w, h) // 3
+ glRectf(-s, -s, s, s)
+
+rotate = 0
+def update(dt):
+ global rotate
+ rotate += dt * 20
+pyglet.clock.schedule_interval(update, 1/60.)
+
+@window.event
+def on_draw():
+ viewport.begin()
+ window.clear()
+ draw_scene()
+ viewport.end()
+
+pyglet.app.run()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/font_comparison.py b/pyglet-1.3.0/pyglet-1.3.0/examples/font_comparison.py
new file mode 100644
index 0000000..a631d5a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/font_comparison.py
@@ -0,0 +1,155 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''A simple tool that may be used to explore font faces. (Windows only)
+
+Only the fonts installed in the system are visible.
+
+Use the left/right cursor keys to change font faces.
+
+By default only the pyglet safe fonts are shown, toggle the safe flag
+to see all.
+
+Don't include tabs in the text sample (see
+http://pyglet.org/doc-current/programming_guide/text.html#id9 )
+'''
+
+from __future__ import print_function, unicode_literals
+
+import pyglet
+import pyglet.font.win32query as wq
+
+
+# support to generate a sample text good to spot monospace compliance.
+# Chosen to do a table of fields_per_line columns, each column with field_size
+# characters. Fields are filled with a rolling subset of ASCII characters.
+class SampleTable(object):
+ field_size = 7
+ gap_size = 3
+ fields_per_line = 7
+ spaces = ' ' * field_size
+ max_chars_per_line = (field_size + gap_size) * fields_per_line - gap_size
+
+ def __init__(self):
+ self.lines = []
+ self.current_line = ''
+
+ def newline(self):
+ self.lines.append(self.current_line)
+ self.current_line = ''
+
+ def add_field(self, s):
+ assert len(s) <= self.field_size
+ to_add = self.spaces[len(s):] + s
+ if self.current_line:
+ to_add = ' ' * self.gap_size + to_add
+ if len(self.current_line) + len(to_add) > self.max_chars_per_line:
+ self.newline()
+ self.add_field(s)
+ else:
+ self.current_line = self.current_line + to_add
+
+ def text(self):
+ return '\n'.join(self.lines)
+
+def sample_text_monospaced_table():
+ printables = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ '
+ table = SampleTable()
+ for i in range(6):
+ s = printables[i:] + printables[:i]
+ for k in range(0, len(printables), table.field_size):
+ table.add_field(s[k:k + table.field_size])
+ table.newline()
+ return table.text()
+
+# this worked right with all fonts in a win xp installation
+def pyglet_safe(fontentry):
+ """ this is heuristic and conservative. YMMV. """
+ return fontentry.vector and fontentry.family != wq.FF_DONTCARE
+
+
+class Window(pyglet.window.Window):
+ font_num = 0
+ def on_text_motion(self, motion):
+ if motion == pyglet.window.key.MOTION_RIGHT:
+ self.font_num += 1
+ if self.font_num == len(font_names):
+ self.font_num = 0
+ elif motion == pyglet.window.key.MOTION_LEFT:
+ self.font_num -= 1
+ if self.font_num < 0:
+ self.font_num = len(font_names) - 1
+
+ face = font_names[self.font_num]
+ self.head = pyglet.text.Label(face, font_size=16, y=0,
+ anchor_y='bottom')
+ self.text = pyglet.text.Label(sample_text, font_name=face, font_size=12,
+ y=self.height, anchor_y='top', width=self.width, multiline=True)
+
+ def on_draw(self):
+ self.clear()
+ self.head.draw()
+ self.text.draw()
+
+
+lorem_ipsum = """
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus.
+Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec
+consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget
+libero egestas mattis sit amet vitae augue.
+
+
+"""
+
+if __name__ == '__main__':
+ print(__doc__)
+ safe = True
+ sample_text = lorem_ipsum + sample_text_monospaced_table()
+ # all fonts known by the OS
+ fontdb = wq.query()
+
+ if safe:
+ candidates = [ f for f in fontdb if pyglet_safe(f)]
+ else:
+ canditates = fontdb
+
+ # theres one fontentry for each charset supported, so reduce names
+ font_names = list(set([f.name for f in candidates]))
+
+ font_names.sort()
+ window = Window(1024, 600)
+ window.on_text_motion(None)
+ pyglet.app.run()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/resources/asteroid.png b/pyglet-1.3.0/pyglet-1.3.0/examples/game/resources/asteroid.png
new file mode 100644
index 0000000..7ca669c
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/game/resources/asteroid.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/resources/bullet.png b/pyglet-1.3.0/pyglet-1.3.0/examples/game/resources/bullet.png
new file mode 100644
index 0000000..56a609f
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/game/resources/bullet.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/resources/bullet.wav b/pyglet-1.3.0/pyglet-1.3.0/examples/game/resources/bullet.wav
new file mode 100644
index 0000000..05da01e
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/game/resources/bullet.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/resources/engine_flame.png b/pyglet-1.3.0/pyglet-1.3.0/examples/game/resources/engine_flame.png
new file mode 100644
index 0000000..9b00300
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/game/resources/engine_flame.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/resources/player.png b/pyglet-1.3.0/pyglet-1.3.0/examples/game/resources/player.png
new file mode 100644
index 0000000..0e2fa84
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/game/resources/player.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version1/asteroid.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version1/asteroid.py
new file mode 100644
index 0000000..c194533
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version1/asteroid.py
@@ -0,0 +1,33 @@
+import pyglet
+from game import load, resources
+
+# Set up a window
+game_window = pyglet.window.Window(800, 600)
+
+# Set up the two top labels
+score_label = pyglet.text.Label(text="Score: 0", x=10, y=575)
+level_label = pyglet.text.Label(text="Version 1: Static Graphics",
+ x=400, y=575, anchor_x='center')
+
+# Initialize the player sprite
+player_ship = pyglet.sprite.Sprite(img=resources.player_image, x=400, y=300)
+
+# Make three asteroids so we have something to shoot at
+asteroids = load.asteroids(3, player_ship.position)
+
+
+@game_window.event
+def on_draw():
+ game_window.clear()
+
+ player_ship.draw()
+ for asteroid in asteroids:
+ asteroid.draw()
+
+ level_label.draw()
+ score_label.draw()
+
+
+if __name__ == "__main__":
+ # Tell pyglet to do its thing
+ pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version1/game/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version1/game/__init__.py
new file mode 100644
index 0000000..50116a7
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version1/game/__init__.py
@@ -0,0 +1 @@
+from . import load, resources
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version1/game/load.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version1/game/load.py
new file mode 100644
index 0000000..bb574b5
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version1/game/load.py
@@ -0,0 +1,25 @@
+import pyglet
+import random
+import math
+from . import resources
+
+
+def distance(point_1=(0, 0), point_2=(0, 0)):
+ """Returns the distance between two points"""
+ return math.sqrt((point_1[0] - point_2[0]) ** 2 + (point_1[1] - point_2[1]) ** 2)
+
+
+def asteroids(num_asteroids, player_position):
+ """Generate asteroid objects with random positions and velocities,
+ not close to the player"""
+ asteroids = []
+ for i in range(num_asteroids):
+ asteroid_x, asteroid_y = player_position
+ while distance((asteroid_x, asteroid_y), player_position) < 100:
+ asteroid_x = random.randint(0, 800)
+ asteroid_y = random.randint(0, 600)
+ new_asteroid = pyglet.sprite.Sprite(img=resources.asteroid_image,
+ x=asteroid_x, y=asteroid_y)
+ new_asteroid.rotation = random.randint(0, 360)
+ asteroids.append(new_asteroid)
+ return asteroids
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version1/game/resources.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version1/game/resources.py
new file mode 100644
index 0000000..2c233ad
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version1/game/resources.py
@@ -0,0 +1,22 @@
+import pyglet
+
+
+def center_image(image):
+ """Sets an image's anchor point to its center"""
+ image.anchor_x = image.width / 2
+ image.anchor_y = image.height / 2
+
+
+# Tell pyglet where to find the resources
+pyglet.resource.path = ['../resources']
+pyglet.resource.reindex()
+
+# Load the three main resources and get them to draw centered
+player_image = pyglet.resource.image("player.png")
+center_image(player_image)
+
+bullet_image = pyglet.resource.image("bullet.png")
+center_image(bullet_image)
+
+asteroid_image = pyglet.resource.image("asteroid.png")
+center_image(asteroid_image)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version2/asteroid.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version2/asteroid.py
new file mode 100644
index 0000000..0941226
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version2/asteroid.py
@@ -0,0 +1,46 @@
+import pyglet, random, math
+from game import load, player, resources
+
+# Set up a window
+game_window = pyglet.window.Window(800, 600)
+
+main_batch = pyglet.graphics.Batch()
+
+# Set up the two top labels
+score_label = pyglet.text.Label(text="Score: 0", x=10, y=575, batch=main_batch)
+level_label = pyglet.text.Label(text="Version 2: Basic Motion",
+ x=400, y=575, anchor_x='center', batch=main_batch)
+
+# Initialize the player sprite
+player_ship = player.Player(x=400, y=300, batch=main_batch)
+
+# Make three sprites to represent remaining lives
+player_lives = load.player_lives(2, main_batch)
+
+# Make three asteroids so we have something to shoot at
+asteroids = load.asteroids(3, player_ship.position, main_batch)
+
+# Store all objects that update each frame in a list
+game_objects = [player_ship] + asteroids
+
+# Tell the main window that the player object responds to events
+game_window.push_handlers(player_ship)
+
+
+@game_window.event
+def on_draw():
+ game_window.clear()
+ main_batch.draw()
+
+
+def update(dt):
+ for obj in game_objects:
+ obj.update(dt)
+
+
+if __name__ == "__main__":
+ # Update the game 120 times per second
+ pyglet.clock.schedule_interval(update, 1 / 120.0)
+
+ # Tell pyglet to do its thing
+ pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version2/game/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version2/game/__init__.py
new file mode 100644
index 0000000..ff80397
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version2/game/__init__.py
@@ -0,0 +1 @@
+from . import load, player, resources
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version2/game/load.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version2/game/load.py
new file mode 100644
index 0000000..201bfcb
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version2/game/load.py
@@ -0,0 +1,36 @@
+import pyglet, math, random
+from . import physicalobject, resources
+
+
+def distance(point_1=(0, 0), point_2=(0, 0)):
+ """Returns the distance between two points"""
+ return math.sqrt((point_1[0] - point_2[0]) ** 2 + (point_1[1] - point_2[1]) ** 2)
+
+
+def player_lives(num_icons, batch=None):
+ """Generate sprites for player life icons"""
+ player_lives = []
+ for i in range(num_icons):
+ new_sprite = pyglet.sprite.Sprite(img=resources.player_image,
+ x=785 - i * 30, y=585,
+ batch=batch)
+ new_sprite.scale = 0.5
+ player_lives.append(new_sprite)
+ return player_lives
+
+
+def asteroids(num_asteroids, player_position, batch=None):
+ """Generate asteroid objects with random positions and velocities, not close to the player"""
+ asteroids = []
+ for i in range(num_asteroids):
+ asteroid_x, asteroid_y = player_position
+ while distance((asteroid_x, asteroid_y), player_position) < 100:
+ asteroid_x = random.randint(0, 800)
+ asteroid_y = random.randint(0, 600)
+ new_asteroid = physicalobject.PhysicalObject(img=resources.asteroid_image,
+ x=asteroid_x, y=asteroid_y,
+ batch=batch)
+ new_asteroid.rotation = random.randint(0, 360)
+ new_asteroid.velocity_x, new_asteroid.velocity_y = random.random() * 40, random.random() * 40
+ asteroids.append(new_asteroid)
+ return asteroids
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version2/game/physicalobject.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version2/game/physicalobject.py
new file mode 100644
index 0000000..31996b7
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version2/game/physicalobject.py
@@ -0,0 +1,36 @@
+import pyglet
+
+
+class PhysicalObject(pyglet.sprite.Sprite):
+ """A sprite with physical properties such as velocity"""
+
+ def __init__(self, *args, **kwargs):
+ super(PhysicalObject, self).__init__(*args, **kwargs)
+
+ # In addition to position, we have velocity
+ self.velocity_x, self.velocity_y = 0.0, 0.0
+
+ def update(self, dt):
+ """This method should be called every frame."""
+
+ # Update position according to velocity and time
+ self.x += self.velocity_x * dt
+ self.y += self.velocity_y * dt
+
+ # Wrap around the screen if necessary
+ self.check_bounds()
+
+ def check_bounds(self):
+ """Use the classic Asteroids screen wrapping behavior"""
+ min_x = -self.image.width / 2
+ min_y = -self.image.height / 2
+ max_x = 800 + self.image.width / 2
+ max_y = 600 + self.image.height / 2
+ if self.x < min_x:
+ self.x = max_x
+ elif self.x > max_x:
+ self.x = min_x
+ if self.y < min_y:
+ self.y = max_y
+ elif self.y > max_y:
+ self.y = min_y
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version2/game/player.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version2/game/player.py
new file mode 100644
index 0000000..c4ce1a1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version2/game/player.py
@@ -0,0 +1,48 @@
+import math
+from pyglet.window import key
+from . import physicalobject, resources
+
+
+class Player(physicalobject.PhysicalObject):
+ """Physical object that responds to user input"""
+
+ def __init__(self, *args, **kwargs):
+ super(Player, self).__init__(img=resources.player_image, *args, **kwargs)
+
+ # Set some easy-to-tweak constants
+ self.thrust = 300.0
+ self.rotate_speed = 200.0
+
+ self.keys = dict(left=False, right=False, up=False)
+
+ def on_key_press(self, symbol, modifiers):
+ if symbol == key.UP:
+ self.keys['up'] = True
+ elif symbol == key.LEFT:
+ self.keys['left'] = True
+ elif symbol == key.RIGHT:
+ self.keys['right'] = True
+
+ def on_key_release(self, symbol, modifiers):
+ if symbol == key.UP:
+ self.keys['up'] = False
+ elif symbol == key.LEFT:
+ self.keys['left'] = False
+ elif symbol == key.RIGHT:
+ self.keys['right'] = False
+
+ def update(self, dt):
+ # Do all the normal physics stuff
+ super(Player, self).update(dt)
+
+ if self.keys['left']:
+ self.rotation -= self.rotate_speed * dt
+ if self.keys['right']:
+ self.rotation += self.rotate_speed * dt
+
+ if self.keys['up']:
+ angle_radians = -math.radians(self.rotation)
+ force_x = math.cos(angle_radians) * self.thrust * dt
+ force_y = math.sin(angle_radians) * self.thrust * dt
+ self.velocity_x += force_x
+ self.velocity_y += force_y
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version2/game/resources.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version2/game/resources.py
new file mode 100644
index 0000000..2c233ad
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version2/game/resources.py
@@ -0,0 +1,22 @@
+import pyglet
+
+
+def center_image(image):
+ """Sets an image's anchor point to its center"""
+ image.anchor_x = image.width / 2
+ image.anchor_y = image.height / 2
+
+
+# Tell pyglet where to find the resources
+pyglet.resource.path = ['../resources']
+pyglet.resource.reindex()
+
+# Load the three main resources and get them to draw centered
+player_image = pyglet.resource.image("player.png")
+center_image(player_image)
+
+bullet_image = pyglet.resource.image("bullet.png")
+center_image(bullet_image)
+
+asteroid_image = pyglet.resource.image("asteroid.png")
+center_image(asteroid_image)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/asteroid.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/asteroid.py
new file mode 100644
index 0000000..4f003d6
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/asteroid.py
@@ -0,0 +1,68 @@
+import pyglet, random, math
+from game import load, player, resources
+
+# Set up a window
+game_window = pyglet.window.Window(800, 600)
+
+main_batch = pyglet.graphics.Batch()
+
+# Set up the two top labels
+score_label = pyglet.text.Label(text="Score: 0", x=10, y=575, batch=main_batch)
+level_label = pyglet.text.Label(text="Version 3: Basic Collision",
+ x=400, y=575, anchor_x='center', batch=main_batch)
+
+# Initialize the player sprite
+player_ship = player.Player(x=400, y=300, batch=main_batch)
+
+# Make three sprites to represent remaining lives
+player_lives = load.player_lives(2, main_batch)
+
+# Make three asteroids so we have something to shoot at
+asteroids = load.asteroids(3, player_ship.position, main_batch)
+
+# Store all objects that update each frame in a list
+game_objects = [player_ship] + asteroids
+
+# Tell the main window that the player object responds to events
+game_window.push_handlers(player_ship.key_handler)
+
+
+@game_window.event
+def on_draw():
+ game_window.clear()
+ main_batch.draw()
+
+
+def update(dt):
+ for obj in game_objects:
+ obj.update(dt)
+
+ # To avoid handling collisions twice, we employ nested loops of ranges.
+ # This method also avoids the problem of colliding an object with itself.
+ for i in range(len(game_objects)):
+ for j in range(i + 1, len(game_objects)):
+
+ obj_1 = game_objects[i]
+ obj_2 = game_objects[j]
+
+ # Make sure the objects haven't already been killed
+ if not obj_1.dead and not obj_2.dead:
+ if obj_1.collides_with(obj_2):
+ obj_1.handle_collision_with(obj_2)
+ obj_2.handle_collision_with(obj_1)
+
+ # Get rid of dead objects
+ for to_remove in [obj for obj in game_objects if obj.dead]:
+ # Remove the object from any batches it is a member of
+ to_remove.delete()
+
+ # Remove the object from our list
+ game_objects.remove(to_remove)
+
+
+if __name__ == "__main__":
+ # Update the game 120 times per second
+ pyglet.clock.schedule_interval(update, 1 / 120.0)
+
+ # Tell pyglet to do its thing
+ pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/game/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/game/__init__.py
new file mode 100644
index 0000000..ff80397
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/game/__init__.py
@@ -0,0 +1 @@
+from . import load, player, resources
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/game/load.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/game/load.py
new file mode 100644
index 0000000..e777aad
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/game/load.py
@@ -0,0 +1,32 @@
+import pyglet
+import random
+from . import physicalobject, resources, util
+
+
+def player_lives(num_icons, batch=None):
+ """Generate sprites for player life icons"""
+ player_lives = []
+ for i in range(num_icons):
+ new_sprite = pyglet.sprite.Sprite(img=resources.player_image,
+ x=785 - i * 30, y=585,
+ batch=batch)
+ new_sprite.scale = 0.5
+ player_lives.append(new_sprite)
+ return player_lives
+
+
+def asteroids(num_asteroids, player_position, batch=None):
+ """Generate asteroid objects with random positions and velocities, not close to the player"""
+ asteroids = []
+ for i in range(num_asteroids):
+ asteroid_x, asteroid_y = player_position
+ while util.distance((asteroid_x, asteroid_y), player_position) < 100:
+ asteroid_x = random.randint(0, 800)
+ asteroid_y = random.randint(0, 600)
+ new_asteroid = physicalobject.PhysicalObject(img=resources.asteroid_image,
+ x=asteroid_x, y=asteroid_y,
+ batch=batch)
+ new_asteroid.rotation = random.randint(0, 360)
+ new_asteroid.velocity_x, new_asteroid.velocity_y = random.random() * 40, random.random() * 40
+ asteroids.append(new_asteroid)
+ return asteroids
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/game/physicalobject.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/game/physicalobject.py
new file mode 100644
index 0000000..1039723
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/game/physicalobject.py
@@ -0,0 +1,55 @@
+import pyglet
+from . import util
+
+
+class PhysicalObject(pyglet.sprite.Sprite):
+ """A sprite with physical properties such as velocity"""
+
+ def __init__(self, *args, **kwargs):
+ super(PhysicalObject, self).__init__(*args, **kwargs)
+
+ # In addition to position, we have velocity
+ self.velocity_x, self.velocity_y = 0.0, 0.0
+
+ # And a flag to remove this object from the game_object list
+ self.dead = False
+
+ def update(self, dt):
+ """This method should be called every frame."""
+
+ # Update position according to velocity and time
+ self.x += self.velocity_x * dt
+ self.y += self.velocity_y * dt
+
+ # Wrap around the screen if necessary
+ self.check_bounds()
+
+ def check_bounds(self):
+ """Use the classic Asteroids screen wrapping behavior"""
+ min_x = -self.image.width / 2
+ min_y = -self.image.height / 2
+ max_x = 800 + self.image.width / 2
+ max_y = 600 + self.image.height / 2
+ if self.x < min_x:
+ self.x = max_x
+ if self.y < min_y:
+ self.y = max_y
+ if self.x > max_x:
+ self.x = min_x
+ if self.y > max_y:
+ self.y = min_y
+
+ def collides_with(self, other_object):
+ """Determine if this object collides with another"""
+
+ # Calculate distance between object centers that would be a collision,
+ # assuming square resources
+ collision_distance = self.image.width / 2 + other_object.image.width / 2
+
+ # Get distance using position tuples
+ actual_distance = util.distance(self.position, other_object.position)
+
+ return (actual_distance <= collision_distance)
+
+ def handle_collision_with(self, other_object):
+ self.dead = True
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/game/player.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/game/player.py
new file mode 100644
index 0000000..415e890
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/game/player.py
@@ -0,0 +1,52 @@
+import pyglet, math
+from pyglet.window import key
+from . import physicalobject, resources
+
+
+class Player(physicalobject.PhysicalObject):
+ """Physical object that responds to user input"""
+
+ def __init__(self, *args, **kwargs):
+ super(Player, self).__init__(img=resources.player_image, *args, **kwargs)
+
+ # Create a child sprite to show when the ship is thrusting
+ self.engine_sprite = pyglet.sprite.Sprite(img=resources.engine_image, *args, **kwargs)
+ self.engine_sprite.visible = False
+
+ # Set some easy-to-tweak constants
+ self.thrust = 300.0
+ self.rotate_speed = 200.0
+
+ # Let pyglet handle keyboard events for us
+ self.key_handler = key.KeyStateHandler()
+
+ def update(self, dt):
+ # Do all the normal physics stuff
+ super(Player, self).update(dt)
+
+ if self.key_handler[key.LEFT]:
+ self.rotation -= self.rotate_speed * dt
+ if self.key_handler[key.RIGHT]:
+ self.rotation += self.rotate_speed * dt
+
+ if self.key_handler[key.UP]:
+ angle_radians = -math.radians(self.rotation)
+ force_x = math.cos(angle_radians) * self.thrust * dt
+ force_y = math.sin(angle_radians) * self.thrust * dt
+ self.velocity_x += force_x
+ self.velocity_y += force_y
+
+ # If thrusting, update the engine sprite
+ self.engine_sprite.rotation = self.rotation
+ self.engine_sprite.x = self.x
+ self.engine_sprite.y = self.y
+ self.engine_sprite.visible = True
+ else:
+ # Otherwise, hide it
+ self.engine_sprite.visible = False
+
+ def delete(self):
+ # We have a child sprite which must be deleted when this object
+ # is deleted from batches, etc.
+ self.engine_sprite.delete()
+ super(Player, self).delete()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/game/resources.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/game/resources.py
new file mode 100644
index 0000000..88d515a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/game/resources.py
@@ -0,0 +1,29 @@
+import pyglet
+
+
+def center_image(image):
+ """Sets an image's anchor point to its center"""
+ image.anchor_x = image.width / 2
+ image.anchor_y = image.height / 2
+
+
+# Tell pyglet where to find the resources
+pyglet.resource.path = ['../resources']
+pyglet.resource.reindex()
+
+# Load the three main resources and get them to draw centered
+player_image = pyglet.resource.image("player.png")
+center_image(player_image)
+
+bullet_image = pyglet.resource.image("bullet.png")
+center_image(bullet_image)
+
+asteroid_image = pyglet.resource.image("asteroid.png")
+center_image(asteroid_image)
+
+# The engine flame should not be centered on the ship. Rather, it should be shown
+# behind it. To achieve this effect, we just set the anchor point outside the
+# image bounds.
+engine_image = pyglet.resource.image("engine_flame.png")
+engine_image.anchor_x = engine_image.width * 1.5
+engine_image.anchor_y = engine_image.height / 2
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/game/util.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/game/util.py
new file mode 100644
index 0000000..d28e563
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version3/game/util.py
@@ -0,0 +1,6 @@
+import pyglet, math
+
+
+def distance(point_1=(0, 0), point_2=(0, 0)):
+ """Returns the distance between two points"""
+ return math.sqrt((point_1[0] - point_2[0]) ** 2 + (point_1[1] - point_2[1]) ** 2)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/asteroid.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/asteroid.py
new file mode 100644
index 0000000..10dca66
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/asteroid.py
@@ -0,0 +1,81 @@
+import pyglet, random, math
+from game import load, player, resources
+
+# Set up a window
+game_window = pyglet.window.Window(800, 600)
+
+main_batch = pyglet.graphics.Batch()
+
+# Set up the two top labels
+score_label = pyglet.text.Label(text="Score: 0", x=10, y=575, batch=main_batch)
+level_label = pyglet.text.Label(text="Version 4: Bullets and Structure",
+ x=400, y=575, anchor_x='center', batch=main_batch)
+
+# Initialize the player sprite
+player_ship = player.Player(x=400, y=300, batch=main_batch)
+
+# Make three sprites to represent remaining lives
+player_lives = load.player_lives(2, main_batch)
+
+# Make three asteroids so we have something to shoot at
+asteroids = load.asteroids(3, player_ship.position, main_batch)
+
+# Store all objects that update each frame in a list
+game_objects = [player_ship] + asteroids
+
+# Add any specified event handlers to the event handler stack
+for obj in game_objects:
+ for handler in obj.event_handlers:
+ game_window.push_handlers(handler)
+
+
+@game_window.event
+def on_draw():
+ game_window.clear()
+ main_batch.draw()
+
+
+def update(dt):
+ # To avoid handling collisions twice, we employ nested loops of ranges.
+ # This method also avoids the problem of colliding an object with itself.
+ for i in range(len(game_objects)):
+ for j in range(i + 1, len(game_objects)):
+
+ obj_1 = game_objects[i]
+ obj_2 = game_objects[j]
+
+ # Make sure the objects haven't already been killed
+ if not obj_1.dead and not obj_2.dead:
+ if obj_1.collides_with(obj_2):
+ obj_1.handle_collision_with(obj_2)
+ obj_2.handle_collision_with(obj_1)
+
+ # Let's not modify the list while traversing it
+ to_add = []
+
+ for obj in game_objects:
+ obj.update(dt)
+ to_add.extend(obj.new_objects)
+ obj.new_objects = []
+
+ # Get rid of dead objects
+ for to_remove in [obj for obj in game_objects if obj.dead]:
+ # If the dying object spawned any new objects, add those to the game_objects list later
+ to_add.extend(obj.new_objects)
+
+ # Remove the object from any batches it is a member of
+ to_remove.delete()
+
+ # Remove the object from our list
+ game_objects.remove(to_remove)
+
+ # Add new objects to the list
+ game_objects.extend(to_add)
+
+
+if __name__ == "__main__":
+ # Update the game 120 times per second
+ pyglet.clock.schedule_interval(update, 1 / 120.0)
+
+ # Tell pyglet to do its thing
+ pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/__init__.py
new file mode 100644
index 0000000..ff80397
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/__init__.py
@@ -0,0 +1 @@
+from . import load, player, resources
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/asteroid.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/asteroid.py
new file mode 100644
index 0000000..e1db3be
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/asteroid.py
@@ -0,0 +1,30 @@
+import random
+from . import physicalobject, resources
+
+
+class Asteroid(physicalobject.PhysicalObject):
+ """An asteroid that divides a little before it dies"""
+
+ def __init__(self, *args, **kwargs):
+ super(Asteroid, self).__init__(resources.asteroid_image, *args, **kwargs)
+
+ # Slowly rotate the asteroid as it moves
+ self.rotate_speed = random.random() * 100.0 - 50.0
+
+ def update(self, dt):
+ super(Asteroid, self).update(dt)
+ self.rotation += self.rotate_speed * dt
+
+ def handle_collision_with(self, other_object):
+ super(Asteroid, self).handle_collision_with(other_object)
+
+ # Superclass handles deadness already
+ if self.dead and self.scale > 0.25:
+ num_asteroids = random.randint(2, 3)
+ for i in range(num_asteroids):
+ new_asteroid = Asteroid(x=self.x, y=self.y, batch=self.batch)
+ new_asteroid.rotation = random.randint(0, 360)
+ new_asteroid.velocity_x = random.random() * 70 + self.velocity_x
+ new_asteroid.velocity_y = random.random() * 70 + self.velocity_y
+ new_asteroid.scale = self.scale * 0.5
+ self.new_objects.append(new_asteroid)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/bullet.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/bullet.py
new file mode 100644
index 0000000..c9ed756
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/bullet.py
@@ -0,0 +1,18 @@
+import pyglet
+from . import physicalobject, resources
+
+
+class Bullet(physicalobject.PhysicalObject):
+ """Bullets fired by the player"""
+
+ def __init__(self, *args, **kwargs):
+ super(Bullet, self).__init__(resources.bullet_image, *args, **kwargs)
+
+ # Bullets shouldn't stick around forever
+ pyglet.clock.schedule_once(self.die, 0.5)
+
+ # Flag as a bullet
+ self.is_bullet = True
+
+ def die(self, dt):
+ self.dead = True
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/load.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/load.py
new file mode 100644
index 0000000..044ee46
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/load.py
@@ -0,0 +1,30 @@
+import pyglet
+import random
+from . import asteroid, resources, util
+
+
+def player_lives(num_icons, batch=None):
+ """Generate sprites for player life icons"""
+ player_lives = []
+ for i in range(num_icons):
+ new_sprite = pyglet.sprite.Sprite(img=resources.player_image,
+ x=785 - i * 30, y=585,
+ batch=batch)
+ new_sprite.scale = 0.5
+ player_lives.append(new_sprite)
+ return player_lives
+
+
+def asteroids(num_asteroids, player_position, batch=None):
+ """Generate asteroid objects with random positions and velocities, not close to the player"""
+ asteroids = []
+ for i in range(num_asteroids):
+ asteroid_x, asteroid_y = player_position
+ while util.distance((asteroid_x, asteroid_y), player_position) < 100:
+ asteroid_x = random.randint(0, 800)
+ asteroid_y = random.randint(0, 600)
+ new_asteroid = asteroid.Asteroid(x=asteroid_x, y=asteroid_y, batch=batch)
+ new_asteroid.rotation = random.randint(0, 360)
+ new_asteroid.velocity_x, new_asteroid.velocity_y = random.random() * 40, random.random() * 40
+ asteroids.append(new_asteroid)
+ return asteroids
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/physicalobject.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/physicalobject.py
new file mode 100644
index 0000000..bc04ec0
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/physicalobject.py
@@ -0,0 +1,73 @@
+import pyglet
+from . import util
+
+
+class PhysicalObject(pyglet.sprite.Sprite):
+ """A sprite with physical properties such as velocity"""
+
+ def __init__(self, *args, **kwargs):
+ super(PhysicalObject, self).__init__(*args, **kwargs)
+
+ # Velocity
+ self.velocity_x, self.velocity_y = 0.0, 0.0
+
+ # Flags to toggle collision with bullets
+ self.reacts_to_bullets = True
+ self.is_bullet = False
+
+ # Flag to remove this object from the game_object list
+ self.dead = False
+
+ # List of new objects to go in the game_objects list
+ self.new_objects = []
+
+ # Tell the game handler about any event handlers
+ # Only applies to things with keyboard/mouse input
+ self.event_handlers = []
+
+ def update(self, dt):
+ """This method should be called every frame."""
+
+ # Update position according to velocity and time
+ self.x += self.velocity_x * dt
+ self.y += self.velocity_y * dt
+
+ # Wrap around the screen if necessary
+ self.check_bounds()
+
+ def check_bounds(self):
+ """Use the classic Asteroids screen wrapping behavior"""
+ min_x = -self.image.width / 2
+ min_y = -self.image.height / 2
+ max_x = 800 + self.image.width / 2
+ max_y = 600 + self.image.height / 2
+ if self.x < min_x:
+ self.x = max_x
+ if self.y < min_y:
+ self.y = max_y
+ if self.x > max_x:
+ self.x = min_x
+ if self.y > max_y:
+ self.y = min_y
+
+ def collides_with(self, other_object):
+ """Determine if this object collides with another"""
+
+ # Ignore bullet collisions if we're supposed to
+ if not self.reacts_to_bullets and other_object.is_bullet:
+ return False
+ if self.is_bullet and not other_object.reacts_to_bullets:
+ return False
+
+ # Calculate distance between object centers that would be a collision,
+ # assuming square resources
+ collision_distance = self.image.width / 2 + other_object.image.width / 2
+
+ # Get distance using position tuples
+ actual_distance = util.distance(self.position, other_object.position)
+
+ return (actual_distance <= collision_distance)
+
+ def handle_collision_with(self, other_object):
+ if other_object.__class__ is not self.__class__:
+ self.dead = True
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/player.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/player.py
new file mode 100644
index 0000000..1a34bf6
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/player.py
@@ -0,0 +1,83 @@
+import pyglet, math
+from pyglet.window import key
+from . import bullet, physicalobject, resources
+
+
+class Player(physicalobject.PhysicalObject):
+ """Physical object that responds to user input"""
+
+ def __init__(self, *args, **kwargs):
+ super(Player, self).__init__(img=resources.player_image, *args, **kwargs)
+
+ # Create a child sprite to show when the ship is thrusting
+ self.engine_sprite = pyglet.sprite.Sprite(img=resources.engine_image, *args, **kwargs)
+ self.engine_sprite.visible = False
+
+ # Set some easy-to-tweak constants
+ self.thrust = 300.0
+ self.rotate_speed = 200.0
+ self.bullet_speed = 700.0
+
+ # Player should not collide with own bullets
+ self.reacts_to_bullets = False
+
+ # Tell the game handler about any event handlers
+ self.key_handler = key.KeyStateHandler()
+ self.event_handlers = [self, self.key_handler]
+
+ def update(self, dt):
+ # Do all the normal physics stuff
+ super(Player, self).update(dt)
+
+ if self.key_handler[key.LEFT]:
+ self.rotation -= self.rotate_speed * dt
+ if self.key_handler[key.RIGHT]:
+ self.rotation += self.rotate_speed * dt
+
+ if self.key_handler[key.UP]:
+ # Note: pyglet's rotation attributes are in "negative degrees"
+ angle_radians = -math.radians(self.rotation)
+ force_x = math.cos(angle_radians) * self.thrust * dt
+ force_y = math.sin(angle_radians) * self.thrust * dt
+ self.velocity_x += force_x
+ self.velocity_y += force_y
+
+ # If thrusting, update the engine sprite
+ self.engine_sprite.rotation = self.rotation
+ self.engine_sprite.x = self.x
+ self.engine_sprite.y = self.y
+ self.engine_sprite.visible = True
+ else:
+ # Otherwise, hide it
+ self.engine_sprite.visible = False
+
+ def on_key_press(self, symbol, modifiers):
+ if symbol == key.SPACE:
+ self.fire()
+
+ def fire(self):
+ # Note: pyglet's rotation attributes are in "negative degrees"
+ angle_radians = -math.radians(self.rotation)
+
+ # Create a new bullet just in front of the player
+ ship_radius = self.image.width / 2
+ bullet_x = self.x + math.cos(angle_radians) * ship_radius
+ bullet_y = self.y + math.sin(angle_radians) * ship_radius
+ new_bullet = bullet.Bullet(bullet_x, bullet_y, batch=self.batch)
+
+ # Give it some speed
+ bullet_vx = self.velocity_x + math.cos(angle_radians) * self.bullet_speed
+ bullet_vy = self.velocity_y + math.sin(angle_radians) * self.bullet_speed
+ new_bullet.velocity_x, new_bullet.velocity_y = bullet_vx, bullet_vy
+
+ # Add it to the list of objects to be added to the game_objects list
+ self.new_objects.append(new_bullet)
+
+ # Play the bullet sound
+ resources.bullet_sound.play()
+
+ def delete(self):
+ # We have a child sprite which must be deleted when this object
+ # is deleted from batches, etc.
+ self.engine_sprite.delete()
+ super(Player, self).delete()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/resources.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/resources.py
new file mode 100644
index 0000000..e8d93d2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/resources.py
@@ -0,0 +1,32 @@
+import pyglet
+
+
+def center_image(image):
+ """Sets an image's anchor point to its center"""
+ image.anchor_x = image.width / 2
+ image.anchor_y = image.height / 2
+
+
+# Tell pyglet where to find the resources
+pyglet.resource.path = ['../resources']
+pyglet.resource.reindex()
+
+# Load the three main resources and get them to draw centered
+player_image = pyglet.resource.image("player.png")
+center_image(player_image)
+
+bullet_image = pyglet.resource.image("bullet.png")
+center_image(bullet_image)
+
+asteroid_image = pyglet.resource.image("asteroid.png")
+center_image(asteroid_image)
+
+# The engine flame should not be centered on the ship. Rather, it should be shown
+# behind it. To achieve this effect, we just set the anchor point outside the
+# image bounds.
+engine_image = pyglet.resource.image("engine_flame.png")
+engine_image.anchor_x = engine_image.width * 1.5
+engine_image.anchor_y = engine_image.height / 2
+
+# Load the bullet sound _without_ streaming so we can play it more than once at a time
+bullet_sound = pyglet.resource.media("bullet.wav", streaming=False)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/util.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/util.py
new file mode 100644
index 0000000..d1c3faf
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version4/game/util.py
@@ -0,0 +1,12 @@
+import pyglet, math
+
+
+def distance(point_1=(0, 0), point_2=(0, 0)):
+ """Returns the distance between two points"""
+ return math.sqrt((point_1[0] - point_2[0]) ** 2 + (point_1[1] - point_2[1]) ** 2)
+
+
+def center_image(image):
+ """Sets an image's anchor point to its center"""
+ image.anchor_x = image.width / 2
+ image.anchor_y = image.height / 2
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/asteroid.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/asteroid.py
new file mode 100644
index 0000000..07f747a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/asteroid.py
@@ -0,0 +1,163 @@
+import pyglet, random, math
+from game import asteroid, load, player, resources
+
+# Set up a window
+game_window = pyglet.window.Window(800, 600)
+
+main_batch = pyglet.graphics.Batch()
+
+# Set up the two top labels
+score_label = pyglet.text.Label(text="Score: 0", x=10, y=575, batch=main_batch)
+level_label = pyglet.text.Label(text="Version 5: It's a Game!",
+ x=400, y=575, anchor_x='center', batch=main_batch)
+
+# Set up the game over label offscreen
+game_over_label = pyglet.text.Label(text="GAME OVER",
+ x=400, y=-300, anchor_x='center',
+ batch=main_batch, font_size=48)
+
+counter = pyglet.clock.ClockDisplay()
+
+player_ship = None
+player_lives = []
+score = 0
+num_asteroids = 3
+game_objects = []
+
+# We need to pop off as many event stack frames as we pushed on
+# every time we reset the level.
+event_stack_size = 0
+
+
+def init():
+ global score, num_asteroids
+
+ score = 0
+ score_label.text = "Score: " + str(score)
+
+ num_asteroids = 3
+ reset_level(2)
+
+
+def reset_level(num_lives=2):
+ global player_ship, player_lives, game_objects, event_stack_size
+
+ # Clear the event stack of any remaining handlers from other levels
+ while event_stack_size > 0:
+ game_window.pop_handlers()
+ event_stack_size -= 1
+
+ for life in player_lives:
+ life.delete()
+
+ # Initialize the player sprite
+ player_ship = player.Player(x=400, y=300, batch=main_batch)
+
+ # Make three sprites to represent remaining lives
+ player_lives = load.player_lives(num_lives, main_batch)
+
+ # Make some asteroids so we have something to shoot at
+ asteroids = load.asteroids(num_asteroids, player_ship.position, main_batch)
+
+ # Store all objects that update each frame in a list
+ game_objects = [player_ship] + asteroids
+
+ # Add any specified event handlers to the event handler stack
+ for obj in game_objects:
+ for handler in obj.event_handlers:
+ game_window.push_handlers(handler)
+ event_stack_size += 1
+
+
+@game_window.event
+def on_draw():
+ game_window.clear()
+ main_batch.draw()
+ counter.draw()
+
+
+def update(dt):
+ global score, num_asteroids
+
+ player_dead = False
+ victory = False
+
+ # To avoid handling collisions twice, we employ nested loops of ranges.
+ # This method also avoids the problem of colliding an object with itself.
+ for i in range(len(game_objects)):
+ for j in range(i + 1, len(game_objects)):
+
+ obj_1 = game_objects[i]
+ obj_2 = game_objects[j]
+
+ # Make sure the objects haven't already been killed
+ if not obj_1.dead and not obj_2.dead:
+ if obj_1.collides_with(obj_2):
+ obj_1.handle_collision_with(obj_2)
+ obj_2.handle_collision_with(obj_1)
+
+ # Let's not modify the list while traversing it
+ to_add = []
+
+ # Check for win condition
+ asteroids_remaining = 0
+
+ for obj in game_objects:
+ obj.update(dt)
+
+ to_add.extend(obj.new_objects)
+ obj.new_objects = []
+
+ # Check for win condition
+ if isinstance(obj, asteroid.Asteroid):
+ asteroids_remaining += 1
+
+ if asteroids_remaining == 0:
+ # Don't act on victory until the end of the time step
+ victory = True
+
+ # Get rid of dead objects
+ for to_remove in [obj for obj in game_objects if obj.dead]:
+ if to_remove == player_ship:
+ player_dead = True
+ # If the dying object spawned any new objects, add those to the
+ # game_objects list later
+ to_add.extend(to_remove.new_objects)
+
+ # Remove the object from any batches it is a member of
+ to_remove.delete()
+
+ # Remove the object from our list
+ game_objects.remove(to_remove)
+
+ # Bump the score if the object to remove is an asteroid
+ if isinstance(to_remove, asteroid.Asteroid):
+ score += 1
+ score_label.text = "Score: " + str(score)
+
+ # Add new objects to the list
+ game_objects.extend(to_add)
+
+ # Check for win/lose conditions
+ if player_dead:
+ # We can just use the length of the player_lives list as the number of lives
+ if len(player_lives) > 0:
+ reset_level(len(player_lives) - 1)
+ else:
+ game_over_label.y = 300
+ elif victory:
+ num_asteroids += 1
+ player_ship.delete()
+ score += 10
+ reset_level(len(player_lives))
+
+
+if __name__ == "__main__":
+ # Start it up!
+ init()
+
+ # Update the game 120 times per second
+ pyglet.clock.schedule_interval(update, 1 / 120.0)
+
+ # Tell pyglet to do its thing
+ pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/__init__.py
new file mode 100644
index 0000000..ff80397
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/__init__.py
@@ -0,0 +1 @@
+from . import load, player, resources
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/asteroid.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/asteroid.py
new file mode 100644
index 0000000..e1db3be
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/asteroid.py
@@ -0,0 +1,30 @@
+import random
+from . import physicalobject, resources
+
+
+class Asteroid(physicalobject.PhysicalObject):
+ """An asteroid that divides a little before it dies"""
+
+ def __init__(self, *args, **kwargs):
+ super(Asteroid, self).__init__(resources.asteroid_image, *args, **kwargs)
+
+ # Slowly rotate the asteroid as it moves
+ self.rotate_speed = random.random() * 100.0 - 50.0
+
+ def update(self, dt):
+ super(Asteroid, self).update(dt)
+ self.rotation += self.rotate_speed * dt
+
+ def handle_collision_with(self, other_object):
+ super(Asteroid, self).handle_collision_with(other_object)
+
+ # Superclass handles deadness already
+ if self.dead and self.scale > 0.25:
+ num_asteroids = random.randint(2, 3)
+ for i in range(num_asteroids):
+ new_asteroid = Asteroid(x=self.x, y=self.y, batch=self.batch)
+ new_asteroid.rotation = random.randint(0, 360)
+ new_asteroid.velocity_x = random.random() * 70 + self.velocity_x
+ new_asteroid.velocity_y = random.random() * 70 + self.velocity_y
+ new_asteroid.scale = self.scale * 0.5
+ self.new_objects.append(new_asteroid)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/bullet.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/bullet.py
new file mode 100644
index 0000000..c9ed756
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/bullet.py
@@ -0,0 +1,18 @@
+import pyglet
+from . import physicalobject, resources
+
+
+class Bullet(physicalobject.PhysicalObject):
+ """Bullets fired by the player"""
+
+ def __init__(self, *args, **kwargs):
+ super(Bullet, self).__init__(resources.bullet_image, *args, **kwargs)
+
+ # Bullets shouldn't stick around forever
+ pyglet.clock.schedule_once(self.die, 0.5)
+
+ # Flag as a bullet
+ self.is_bullet = True
+
+ def die(self, dt):
+ self.dead = True
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/load.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/load.py
new file mode 100644
index 0000000..044ee46
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/load.py
@@ -0,0 +1,30 @@
+import pyglet
+import random
+from . import asteroid, resources, util
+
+
+def player_lives(num_icons, batch=None):
+ """Generate sprites for player life icons"""
+ player_lives = []
+ for i in range(num_icons):
+ new_sprite = pyglet.sprite.Sprite(img=resources.player_image,
+ x=785 - i * 30, y=585,
+ batch=batch)
+ new_sprite.scale = 0.5
+ player_lives.append(new_sprite)
+ return player_lives
+
+
+def asteroids(num_asteroids, player_position, batch=None):
+ """Generate asteroid objects with random positions and velocities, not close to the player"""
+ asteroids = []
+ for i in range(num_asteroids):
+ asteroid_x, asteroid_y = player_position
+ while util.distance((asteroid_x, asteroid_y), player_position) < 100:
+ asteroid_x = random.randint(0, 800)
+ asteroid_y = random.randint(0, 600)
+ new_asteroid = asteroid.Asteroid(x=asteroid_x, y=asteroid_y, batch=batch)
+ new_asteroid.rotation = random.randint(0, 360)
+ new_asteroid.velocity_x, new_asteroid.velocity_y = random.random() * 40, random.random() * 40
+ asteroids.append(new_asteroid)
+ return asteroids
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/physicalobject.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/physicalobject.py
new file mode 100644
index 0000000..5e27434
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/physicalobject.py
@@ -0,0 +1,74 @@
+import pyglet
+from . import util
+
+
+class PhysicalObject(pyglet.sprite.Sprite):
+ """A sprite with physical properties such as velocity"""
+
+ def __init__(self, *args, **kwargs):
+ super(PhysicalObject, self).__init__(*args, **kwargs)
+
+ # Velocity
+ self.velocity_x, self.velocity_y = 0.0, 0.0
+
+ # Flags to toggle collision with bullets
+ self.reacts_to_bullets = True
+ self.is_bullet = False
+
+ # Flag to remove this object from the game_object list
+ self.dead = False
+
+ # List of new objects to go in the game_objects list
+ self.new_objects = []
+
+ # Tell the game handler about any event handlers
+ # Only applies to things with keyboard/mouse input
+ self.event_handlers = []
+
+ def update(self, dt):
+ """This method should be called every frame."""
+
+ # Update position according to velocity and time
+ self.x += self.velocity_x * dt
+ self.y += self.velocity_y * dt
+
+ # Wrap around the screen if necessary
+ self.check_bounds()
+
+ def check_bounds(self):
+ """Use the classic Asteroids screen wrapping behavior"""
+ min_x = -self.image.width / 2
+ min_y = -self.image.height / 2
+ max_x = 800 + self.image.width / 2
+ max_y = 600 + self.image.height / 2
+ if self.x < min_x:
+ self.x = max_x
+ if self.y < min_y:
+ self.y = max_y
+ if self.x > max_x:
+ self.x = min_x
+ if self.y > max_y:
+ self.y = min_y
+
+ def collides_with(self, other_object):
+ """Determine if this object collides with another"""
+
+ # Ignore bullet collisions if we're supposed to
+ if not self.reacts_to_bullets and other_object.is_bullet:
+ return False
+ if self.is_bullet and not other_object.reacts_to_bullets:
+ return False
+
+ # Calculate distance between object centers that would be a collision,
+ # assuming square resources
+ collision_distance = self.image.width * 0.5 * self.scale \
+ + other_object.image.width * 0.5 * other_object.scale
+
+ # Get distance using position tuples
+ actual_distance = util.distance(self.position, other_object.position)
+
+ return (actual_distance <= collision_distance)
+
+ def handle_collision_with(self, other_object):
+ if other_object.__class__ is not self.__class__:
+ self.dead = True
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/player.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/player.py
new file mode 100644
index 0000000..1a34bf6
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/player.py
@@ -0,0 +1,83 @@
+import pyglet, math
+from pyglet.window import key
+from . import bullet, physicalobject, resources
+
+
+class Player(physicalobject.PhysicalObject):
+ """Physical object that responds to user input"""
+
+ def __init__(self, *args, **kwargs):
+ super(Player, self).__init__(img=resources.player_image, *args, **kwargs)
+
+ # Create a child sprite to show when the ship is thrusting
+ self.engine_sprite = pyglet.sprite.Sprite(img=resources.engine_image, *args, **kwargs)
+ self.engine_sprite.visible = False
+
+ # Set some easy-to-tweak constants
+ self.thrust = 300.0
+ self.rotate_speed = 200.0
+ self.bullet_speed = 700.0
+
+ # Player should not collide with own bullets
+ self.reacts_to_bullets = False
+
+ # Tell the game handler about any event handlers
+ self.key_handler = key.KeyStateHandler()
+ self.event_handlers = [self, self.key_handler]
+
+ def update(self, dt):
+ # Do all the normal physics stuff
+ super(Player, self).update(dt)
+
+ if self.key_handler[key.LEFT]:
+ self.rotation -= self.rotate_speed * dt
+ if self.key_handler[key.RIGHT]:
+ self.rotation += self.rotate_speed * dt
+
+ if self.key_handler[key.UP]:
+ # Note: pyglet's rotation attributes are in "negative degrees"
+ angle_radians = -math.radians(self.rotation)
+ force_x = math.cos(angle_radians) * self.thrust * dt
+ force_y = math.sin(angle_radians) * self.thrust * dt
+ self.velocity_x += force_x
+ self.velocity_y += force_y
+
+ # If thrusting, update the engine sprite
+ self.engine_sprite.rotation = self.rotation
+ self.engine_sprite.x = self.x
+ self.engine_sprite.y = self.y
+ self.engine_sprite.visible = True
+ else:
+ # Otherwise, hide it
+ self.engine_sprite.visible = False
+
+ def on_key_press(self, symbol, modifiers):
+ if symbol == key.SPACE:
+ self.fire()
+
+ def fire(self):
+ # Note: pyglet's rotation attributes are in "negative degrees"
+ angle_radians = -math.radians(self.rotation)
+
+ # Create a new bullet just in front of the player
+ ship_radius = self.image.width / 2
+ bullet_x = self.x + math.cos(angle_radians) * ship_radius
+ bullet_y = self.y + math.sin(angle_radians) * ship_radius
+ new_bullet = bullet.Bullet(bullet_x, bullet_y, batch=self.batch)
+
+ # Give it some speed
+ bullet_vx = self.velocity_x + math.cos(angle_radians) * self.bullet_speed
+ bullet_vy = self.velocity_y + math.sin(angle_radians) * self.bullet_speed
+ new_bullet.velocity_x, new_bullet.velocity_y = bullet_vx, bullet_vy
+
+ # Add it to the list of objects to be added to the game_objects list
+ self.new_objects.append(new_bullet)
+
+ # Play the bullet sound
+ resources.bullet_sound.play()
+
+ def delete(self):
+ # We have a child sprite which must be deleted when this object
+ # is deleted from batches, etc.
+ self.engine_sprite.delete()
+ super(Player, self).delete()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/resources.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/resources.py
new file mode 100644
index 0000000..e8d93d2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/resources.py
@@ -0,0 +1,32 @@
+import pyglet
+
+
+def center_image(image):
+ """Sets an image's anchor point to its center"""
+ image.anchor_x = image.width / 2
+ image.anchor_y = image.height / 2
+
+
+# Tell pyglet where to find the resources
+pyglet.resource.path = ['../resources']
+pyglet.resource.reindex()
+
+# Load the three main resources and get them to draw centered
+player_image = pyglet.resource.image("player.png")
+center_image(player_image)
+
+bullet_image = pyglet.resource.image("bullet.png")
+center_image(bullet_image)
+
+asteroid_image = pyglet.resource.image("asteroid.png")
+center_image(asteroid_image)
+
+# The engine flame should not be centered on the ship. Rather, it should be shown
+# behind it. To achieve this effect, we just set the anchor point outside the
+# image bounds.
+engine_image = pyglet.resource.image("engine_flame.png")
+engine_image.anchor_x = engine_image.width * 1.5
+engine_image.anchor_y = engine_image.height / 2
+
+# Load the bullet sound _without_ streaming so we can play it more than once at a time
+bullet_sound = pyglet.resource.media("bullet.wav", streaming=False)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/util.py b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/util.py
new file mode 100644
index 0000000..d1c3faf
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/game/version5/game/util.py
@@ -0,0 +1,12 @@
+import pyglet, math
+
+
+def distance(point_1=(0, 0), point_2=(0, 0)):
+ """Returns the distance between two points"""
+ return math.sqrt((point_1[0] - point_2[0]) ** 2 + (point_1[1] - point_2[1]) ** 2)
+
+
+def center_image(image):
+ """Sets an image's anchor point to its center"""
+ image.anchor_x = image.width / 2
+ image.anchor_y = image.height / 2
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/graphics.py b/pyglet-1.3.0/pyglet-1.3.0/examples/graphics.py
new file mode 100644
index 0000000..72a9fd7
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/graphics.py
@@ -0,0 +1,179 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Displays a rotating torus using the pyglet.graphics API.
+
+This example is very similar to examples/opengl.py, but uses the
+pyglet.graphics API to construct the indexed vertex arrays instead of
+using OpenGL calls explicitly. This has the advantage that VBOs will
+be used on supporting hardware automatically.
+
+The vertex list is added to a batch, allowing it to be easily rendered
+alongside other vertex lists with minimal overhead.
+'''
+
+from math import pi, sin, cos
+
+import pyglet
+from pyglet.gl import *
+
+try:
+ # Try and create a window with multisampling (antialiasing)
+ config = Config(sample_buffers=1, samples=4,
+ depth_size=16, double_buffer=True,)
+ window = pyglet.window.Window(resizable=True, config=config)
+except pyglet.window.NoSuchConfigException:
+ # Fall back to no multisampling for old hardware
+ window = pyglet.window.Window(resizable=True)
+
+@window.event
+def on_resize(width, height):
+ # Override the default on_resize handler to create a 3D projection
+ glViewport(0, 0, width, height)
+ glMatrixMode(GL_PROJECTION)
+ glLoadIdentity()
+ gluPerspective(60., width / float(height), .1, 1000.)
+ glMatrixMode(GL_MODELVIEW)
+ return pyglet.event.EVENT_HANDLED
+
+def update(dt):
+ global rx, ry, rz
+ rx += dt * 1
+ ry += dt * 80
+ rz += dt * 30
+ rx %= 360
+ ry %= 360
+ rz %= 360
+pyglet.clock.schedule(update)
+
+@window.event
+def on_draw():
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
+ glLoadIdentity()
+ glTranslatef(0, 0, -4)
+ glRotatef(rz, 0, 0, 1)
+ glRotatef(ry, 0, 1, 0)
+ glRotatef(rx, 1, 0, 0)
+ batch.draw()
+
+def setup():
+ # One-time GL setup
+ glClearColor(1, 1, 1, 1)
+ glColor3f(1, 0, 0)
+ glEnable(GL_DEPTH_TEST)
+ glEnable(GL_CULL_FACE)
+
+ # Uncomment this line for a wireframe view
+ #glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
+
+ # Simple light setup. On Windows GL_LIGHT0 is enabled by default,
+ # but this is not the case on Linux or Mac, so remember to always
+ # include it.
+ glEnable(GL_LIGHTING)
+ glEnable(GL_LIGHT0)
+ glEnable(GL_LIGHT1)
+
+ # Define a simple function to create ctypes arrays of floats:
+ def vec(*args):
+ return (GLfloat * len(args))(*args)
+
+ glLightfv(GL_LIGHT0, GL_POSITION, vec(.5, .5, 1, 0))
+ glLightfv(GL_LIGHT0, GL_SPECULAR, vec(.5, .5, 1, 1))
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, vec(1, 1, 1, 1))
+ glLightfv(GL_LIGHT1, GL_POSITION, vec(1, 0, .5, 0))
+ glLightfv(GL_LIGHT1, GL_DIFFUSE, vec(.5, .5, .5, 1))
+ glLightfv(GL_LIGHT1, GL_SPECULAR, vec(1, 1, 1, 1))
+
+ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, vec(0.5, 0, 0.3, 1))
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, vec(1, 1, 1, 1))
+ glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 50)
+
+class Torus(object):
+ list = None
+ def __init__(self, radius, inner_radius, slices, inner_slices,
+ batch, group=None):
+ # Create the vertex and normal arrays.
+ vertices = []
+ normals = []
+
+ u_step = 2 * pi / (slices - 1)
+ v_step = 2 * pi / (inner_slices - 1)
+ u = 0.
+ for i in range(slices):
+ cos_u = cos(u)
+ sin_u = sin(u)
+ v = 0.
+ for j in range(inner_slices):
+ cos_v = cos(v)
+ sin_v = sin(v)
+
+ d = (radius + inner_radius * cos_v)
+ x = d * cos_u
+ y = d * sin_u
+ z = inner_radius * sin_v
+
+ nx = cos_u * cos_v
+ ny = sin_u * cos_v
+ nz = sin_v
+
+ vertices.extend([x, y, z])
+ normals.extend([nx, ny, nz])
+ v += v_step
+ u += u_step
+
+ # Create a list of triangle indices.
+ indices = []
+ for i in range(slices - 1):
+ for j in range(inner_slices - 1):
+ p = i * inner_slices + j
+ indices.extend([p, p + inner_slices, p + inner_slices + 1])
+ indices.extend([p, p + inner_slices + 1, p + 1])
+
+ self.vertex_list = batch.add_indexed(len(vertices)//3,
+ GL_TRIANGLES,
+ group,
+ indices,
+ ('v3f/static', vertices),
+ ('n3f/static', normals))
+
+ def delete(self):
+ self.vertex_list.delete()
+
+setup()
+batch = pyglet.graphics.Batch()
+torus = Torus(1, 0.3, 50, 30, batch=batch)
+rx = ry = rz = 0
+
+pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/html_label.py b/pyglet-1.3.0/pyglet-1.3.0/examples/html_label.py
new file mode 100644
index 0000000..16d777f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/html_label.py
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''A simple demonstration of the HTMLLabel class, as it might be used on a
+help or introductory screen.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import os
+import pyglet
+
+html = '''
+
HTML labels in pyglet
+
+
+
+
HTML labels are a simple way to add formatted text to your application.
+Different fonts, styles
+and colours are supported.
+
+
This window has been made resizable; text will reflow to fit the new size.
+'''
+
+window = pyglet.window.Window(resizable=True)
+location = pyglet.resource.FileLocation(os.path.dirname(__file__))
+label = pyglet.text.HTMLLabel(html, location=location,
+ width=window.width,
+ multiline=True, anchor_y='center')
+
+@window.event
+def on_resize(width, height):
+ # Wrap text to the width of the window
+ label.width = window.width
+
+ # Keep text vertically centered in the window
+ label.y = window.height // 2
+
+@window.event
+def on_draw():
+ window.clear()
+ label.draw()
+
+pyglet.gl.glClearColor(1, 1, 1, 1)
+pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/image_convert.py b/pyglet-1.3.0/pyglet-1.3.0/examples/image_convert.py
new file mode 100644
index 0000000..238eb5c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/image_convert.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Convert an image to another file format supported by pyglet.
+
+Usage::
+ python image_convert.py
+
+'''
+
+from __future__ import print_function
+
+import sys
+
+import pyglet
+
+
+def convert(src, dest):
+ if '.dds' in src.lower():
+ # Compressed textures need to be uploaded to the video card before
+ # they can be saved.
+ texture = pyglet.image.load(src).get_texture()
+ texture.save(dest)
+ else:
+ # Otherwise just save the loaded image in the new format.
+ image = pyglet.image.load(src)
+ image.save(dest)
+
+if __name__ == '__main__':
+ if len(sys.argv) != 3:
+ print(__doc__)
+ sys.exit(1)
+
+ src = sys.argv[1]
+ dest = sys.argv[2]
+ convert(src, dest)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/image_display.py b/pyglet-1.3.0/pyglet-1.3.0/examples/image_display.py
new file mode 100644
index 0000000..5503e88
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/image_display.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Display an image.
+
+Usage::
+
+ display.py
+
+A checkerboard background is visible behind any transparent areas of the
+image.
+'''
+
+from __future__ import print_function
+
+import sys
+
+import pyglet
+from pyglet.gl import *
+
+window = pyglet.window.Window(visible=False, resizable=True)
+
+
+@window.event
+def on_draw():
+ background.blit_tiled(0, 0, 0, window.width, window.height)
+ img.blit(window.width // 2, window.height // 2, 0)
+
+
+if __name__ == '__main__':
+ if len(sys.argv) != 2:
+ print(__doc__)
+ sys.exit(1)
+
+ filename = sys.argv[1]
+
+ img = pyglet.image.load(filename).get_texture(rectangle=True)
+ img.anchor_x = img.width // 2
+ img.anchor_y = img.height // 2
+
+ checks = pyglet.image.create(32, 32, pyglet.image.CheckerImagePattern())
+ background = pyglet.image.TileableTexture.create_for_image(checks)
+
+ # Enable alpha blending, required for image.blit.
+ glEnable(GL_BLEND)
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+
+ window.width = img.width
+ window.height = img.height
+ window.set_visible()
+
+ pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/input.py b/pyglet-1.3.0/pyglet-1.3.0/examples/input.py
new file mode 100644
index 0000000..e587425
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/input.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+
+'''
+'''
+
+from __future__ import print_function
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import pyglet
+
+window = pyglet.window.Window()
+devices = pyglet.input.get_devices()
+
+
+def watch_control(device, control):
+ @control.event
+ def on_change(value):
+ print('%r: %r.on_change(%r)' % (device, control, value))
+
+ if isinstance(control, pyglet.input.base.Button):
+ @control.event
+ def on_press():
+ print('%r: %r.on_press()' % (device, control))
+
+ @control.event
+ def on_release():
+ print('%r: %r.on_release()' % (device, control))
+
+print('Devices:')
+for device in devices:
+ print(' ', device.name, end=' ')
+ try:
+ device.open(window=window)
+ print('OK')
+
+ for control in device.get_controls():
+ print(' ', control.name)
+ watch_control(device, control)
+
+ except pyglet.input.DeviceException:
+ print('Fail')
+
+pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/joystick.py b/pyglet-1.3.0/pyglet-1.3.0/examples/joystick.py
new file mode 100644
index 0000000..24839fe
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/joystick.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+
+'''
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import pyglet
+from pyglet.gl import *
+
+joysticks = pyglet.input.get_joysticks()
+assert joysticks, 'No joystick device is connected'
+joystick = joysticks[0]
+joystick.open()
+
+window = pyglet.window.Window()
+
+@window.event
+def on_draw():
+ x = (0.8*joystick.x + 1) * window.width / 2
+ y = (-0.8*joystick.y + 1) * window.height / 2
+ z = joystick.z
+ angle = joystick.rz * 180
+
+ # Axes
+
+ glClear(GL_COLOR_BUFFER_BIT)
+ glColor3f(1, 0, 0)
+ glLoadIdentity()
+ glTranslatef(x, y, 0)
+ glScalef(1 + z, 1 + z, 1 + z)
+ glRotatef(-angle, 0, 0, 1)
+ glBegin(GL_TRIANGLES)
+ glVertex2f(-10, 0)
+ glVertex2f(0, 13)
+ glVertex2f(10, 0)
+ glEnd()
+
+ # Buttons
+
+ glLoadIdentity()
+ x = 10
+ y = 10
+ glPointSize(5)
+ glBegin(GL_POINTS)
+ for button in joystick.buttons:
+ if button:
+ glVertex2f(x, y)
+ x += 20
+ glEnd()
+
+ # Hat
+
+ glColor3f(0, 0, 1)
+ x = window.width / 2
+ y = window.height / 2
+ glBegin(GL_POINTS)
+ glVertex2f(x + joystick.hat_x * 50, y + joystick.hat_y * 50)
+ glEnd()
+
+pyglet.clock.schedule(lambda dt: None)
+pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/media_info.py b/pyglet-1.3.0/pyglet-1.3.0/examples/media_info.py
new file mode 100644
index 0000000..3c618d1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/media_info.py
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+
+'''Print details of a media file that pyglet can open (requires AVbin).
+
+Usage::
+
+ media_info.py
+
+'''
+
+from __future__ import print_function
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import sys
+import pyglet
+
+
+def print_avbin_info():
+ from pyglet.media import have_avbin
+
+ if have_avbin():
+ from pyglet.media.sources import avbin
+ print('Using AVbin version %d (FFmpeg r%d)' % (
+ avbin.get_version(),
+ avbin.av.avbin_get_ffmpeg_revision()))
+ else:
+ print('AVbin not available; required for media decoding.')
+ print('http://code.google.com/p/avbin')
+ print()
+
+
+def print_source_info(source):
+ if source.info:
+ if source.info.title:
+ print('Title: %s' % source.info.title)
+ if source.info.album:
+ print('Album: %s' % source.info.album)
+ if source.info.author:
+ print('Author: %s' % source.info.author)
+ if source.info.year:
+ print('Year: %d' % source.info.year)
+ if source.info.track:
+ print('Track: %d' % source.info.track)
+ if source.info.genre:
+ print('Genre: %s' % source.info.genre)
+ if source.info.copyright:
+ print('Copyright: %s' % source.info.copyright)
+ if source.info.comment:
+ print('Comment: %s' % source.info.comment)
+
+ if source.audio_format:
+ af = source.audio_format
+ print('Audio: %d channel(s), %d bits, %.02f Hz' % (
+ af.channels, af.sample_size, af.sample_rate))
+
+ if source.video_format:
+ vf = source.video_format
+ if vf.frame_rate:
+ frame_rate = '%.02f' % vf.frame_rate
+ else:
+ frame_rate = 'unknown'
+ if vf.sample_aspect >= 1:
+ display_width = vf.sample_aspect * vf.width
+ display_height = vf.height
+ else:
+ display_width = vf.width
+ display_height = vf.sample_aspect / vf.height
+ print('Video: %dx%d at aspect %r (displays at %dx%d), %s fps' % (
+ vf.width, vf.height, vf.sample_aspect,
+ display_width, display_height, frame_rate))
+
+ hours = int(source.duration / 3600)
+ minutes = int(source.duration / 60) % 60
+ seconds = int(source.duration) % 60
+ milliseconds = int(source.duration * 1000) % 1000
+ print('Duration: %d:%02d:%02d.%03d' % (
+ hours, minutes, seconds, milliseconds))
+
+if __name__ == '__main__':
+ if len(sys.argv) != 2:
+ print(__doc__)
+ print_avbin_info()
+ sys.exit(1)
+
+ print_avbin_info()
+
+ filename = sys.argv[1]
+ try:
+ source = pyglet.media.load(filename, streaming=True)
+ print_source_info(source)
+ except pyglet.media.MediaException:
+ print('Could not open %s' % filename)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/media_player.py b/pyglet-1.3.0/pyglet-1.3.0/examples/media_player.py
new file mode 100644
index 0000000..a126875
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/media_player.py
@@ -0,0 +1,345 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Audio and video player with simple GUI controls.
+'''
+
+from __future__ import print_function
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import sys
+
+from pyglet.gl import *
+import pyglet
+from pyglet.window import key
+
+
+def draw_rect(x, y, width, height):
+ glBegin(GL_LINE_LOOP)
+ glVertex2f(x, y)
+ glVertex2f(x + width, y)
+ glVertex2f(x + width, y + height)
+ glVertex2f(x, y + height)
+ glEnd()
+
+
+class Control(pyglet.event.EventDispatcher):
+ x = y = 0
+ width = height = 10
+
+ def __init__(self, parent):
+ super(Control, self).__init__()
+ self.parent = parent
+
+ def hit_test(self, x, y):
+ return (self.x < x < self.x + self.width and
+ self.y < y < self.y + self.height)
+
+ def capture_events(self):
+ self.parent.push_handlers(self)
+
+ def release_events(self):
+ self.parent.remove_handlers(self)
+
+
+class Button(Control):
+ charged = False
+
+ def draw(self):
+ if self.charged:
+ glColor3f(1, 0, 0)
+ draw_rect(self.x, self.y, self.width, self.height)
+ glColor3f(1, 1, 1)
+ self.draw_label()
+
+ def on_mouse_press(self, x, y, button, modifiers):
+ self.capture_events()
+ self.charged = True
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ self.charged = self.hit_test(x, y)
+
+ def on_mouse_release(self, x, y, button, modifiers):
+ self.release_events()
+ if self.hit_test(x, y):
+ self.dispatch_event('on_press')
+ self.charged = False
+
+Button.register_event_type('on_press')
+
+
+class TextButton(Button):
+ def __init__(self, *args, **kwargs):
+ super(TextButton, self).__init__(*args, **kwargs)
+ self._text = pyglet.text.Label('', anchor_x='center', anchor_y='center')
+
+ def draw_label(self):
+ self._text.x = self.x + self.width / 2
+ self._text.y = self.y + self.height / 2
+ self._text.draw()
+
+ def set_text(self, text):
+ self._text.text = text
+
+ text = property(lambda self: self._text.text,
+ set_text)
+
+
+class Slider(Control):
+ THUMB_WIDTH = 6
+ THUMB_HEIGHT = 10
+ GROOVE_HEIGHT = 2
+
+ def draw(self):
+ center_y = self.y + self.height / 2
+ draw_rect(self.x, center_y - self.GROOVE_HEIGHT / 2,
+ self.width, self.GROOVE_HEIGHT)
+ pos = self.x + self.value * self.width / (self.max - self.min)
+ draw_rect(pos - self.THUMB_WIDTH / 2, center_y - self.THUMB_HEIGHT / 2,
+ self.THUMB_WIDTH, self.THUMB_HEIGHT)
+
+ def coordinate_to_value(self, x):
+ return float(x - self.x) / self.width * (self.max - self.min) + self.min
+
+ def on_mouse_press(self, x, y, button, modifiers):
+ value = self.coordinate_to_value(x)
+ self.capture_events()
+ self.dispatch_event('on_begin_scroll')
+ self.dispatch_event('on_change', value)
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ value = min(max(self.coordinate_to_value(x), self.min), self.max)
+ self.dispatch_event('on_change', value)
+
+ def on_mouse_release(self, x, y, button, modifiers):
+ self.release_events()
+ self.dispatch_event('on_end_scroll')
+
+Slider.register_event_type('on_begin_scroll')
+Slider.register_event_type('on_end_scroll')
+Slider.register_event_type('on_change')
+
+
+class PlayerWindow(pyglet.window.Window):
+ GUI_WIDTH = 400
+ GUI_HEIGHT = 40
+ GUI_PADDING = 4
+ GUI_BUTTON_HEIGHT = 16
+
+ def __init__(self, player):
+ super(PlayerWindow, self).__init__(caption='Media Player',
+ visible=False,
+ resizable=True)
+ self.player = player
+ self.player.push_handlers(self)
+ # TODO compat #self.player.eos_action = self.player.EOS_PAUSE
+
+ self.slider = Slider(self)
+ self.slider.x = self.GUI_PADDING
+ self.slider.y = self.GUI_PADDING * 2 + self.GUI_BUTTON_HEIGHT
+ self.slider.on_begin_scroll = lambda: player.pause()
+ self.slider.on_end_scroll = lambda: player.play()
+ self.slider.on_change = lambda value: player.seek(value)
+
+ self.play_pause_button = TextButton(self)
+ self.play_pause_button.x = self.GUI_PADDING
+ self.play_pause_button.y = self.GUI_PADDING
+ self.play_pause_button.height = self.GUI_BUTTON_HEIGHT
+ self.play_pause_button.width = 45
+ self.play_pause_button.on_press = self.on_play_pause
+
+ win = self
+ self.window_button = TextButton(self)
+ self.window_button.x = self.play_pause_button.x + \
+ self.play_pause_button.width + self.GUI_PADDING
+ self.window_button.y = self.GUI_PADDING
+ self.window_button.height = self.GUI_BUTTON_HEIGHT
+ self.window_button.width = 90
+ self.window_button.text = 'Windowed'
+ self.window_button.on_press = lambda: win.set_fullscreen(False)
+
+ self.controls = [
+ self.slider,
+ self.play_pause_button,
+ self.window_button,
+ ]
+
+ x = self.window_button.x + self.window_button.width + self.GUI_PADDING
+ i = 0
+ for screen in self.display.get_screens():
+ screen_button = TextButton(self)
+ screen_button.x = x
+ screen_button.y = self.GUI_PADDING
+ screen_button.height = self.GUI_BUTTON_HEIGHT
+ screen_button.width = 80
+ screen_button.text = 'Screen %d' % (i + 1)
+ screen_button.on_press = \
+ (lambda s: lambda: win.set_fullscreen(True, screen=s))(screen)
+ self.controls.append(screen_button)
+ i += 1
+ x += screen_button.width + self.GUI_PADDING
+
+ def on_eos(self):
+ self.gui_update_state()
+
+ def gui_update_source(self):
+ if self.player.source:
+ source = self.player.source
+ self.slider.min = 0.
+ self.slider.max = source.duration
+ self.gui_update_state()
+
+ def gui_update_state(self):
+ if self.player.playing:
+ self.play_pause_button.text = 'Pause'
+ else:
+ self.play_pause_button.text = 'Play'
+
+ def get_video_size(self):
+ if not self.player.source or not self.player.source.video_format:
+ return 0, 0
+ video_format = self.player.source.video_format
+ width = video_format.width
+ height = video_format.height
+ if video_format.sample_aspect > 1:
+ width *= video_format.sample_aspect
+ elif video_format.sample_aspect < 1:
+ height /= video_format.sample_aspect
+ return width, height
+
+ def set_default_video_size(self):
+ '''Make the window size just big enough to show the current
+ video and the GUI.'''
+ width = self.GUI_WIDTH
+ height = self.GUI_HEIGHT
+ video_width, video_height = self.get_video_size()
+ width = max(width, video_width)
+ height += video_height
+ self.set_size(int(width), int(height))
+
+ def on_resize(self, width, height):
+ '''Position and size video image.'''
+ super(PlayerWindow, self).on_resize(width, height)
+
+ self.slider.width = width - self.GUI_PADDING * 2
+
+ height -= self.GUI_HEIGHT
+ if height <= 0:
+ return
+
+ video_width, video_height = self.get_video_size()
+ if video_width == 0 or video_height == 0:
+ return
+
+ display_aspect = width / float(height)
+ video_aspect = video_width / float(video_height)
+ if video_aspect > display_aspect:
+ self.video_width = width
+ self.video_height = width / video_aspect
+ else:
+ self.video_height = height
+ self.video_width = height * video_aspect
+ self.video_x = (width - self.video_width) / 2
+ self.video_y = (height - self.video_height) / 2 + self.GUI_HEIGHT
+
+ def on_mouse_press(self, x, y, button, modifiers):
+ for control in self.controls:
+ if control.hit_test(x, y):
+ control.on_mouse_press(x, y, button, modifiers)
+
+ def on_key_press(self, symbol, modifiers):
+ if symbol == key.SPACE:
+ self.on_play_pause()
+ elif symbol == key.ESCAPE:
+ self.dispatch_event('on_close')
+
+ def on_close(self):
+ self.player.pause()
+ self.close()
+
+ def on_play_pause(self):
+ if self.player.playing:
+ self.player.pause()
+ else:
+ if self.player.time >= self.player.source.duration:
+ self.player.seek(0)
+ self.player.play()
+ self.gui_update_state()
+
+ def on_draw(self):
+ self.clear()
+
+ # Video
+ if self.player.source and self.player.source.video_format:
+ self.player.get_texture().blit(self.video_x,
+ self.video_y,
+ width=self.video_width,
+ height=self.video_height)
+
+ # GUI
+ self.slider.value = self.player.time
+ for control in self.controls:
+ control.draw()
+
+
+if __name__ == '__main__':
+ if len(sys.argv) < 2:
+ print('Usage: media_player.py [ ...]')
+ sys.exit(1)
+
+ have_video = False
+
+ for filename in sys.argv[1:]:
+ player = pyglet.media.Player()
+ window = PlayerWindow(player)
+
+ source = pyglet.media.load(filename)
+ player.queue(source)
+
+ have_video = have_video or bool(source.video_format)
+
+ window.gui_update_source()
+ window.set_default_video_size()
+ window.set_visible(True)
+
+ player.play()
+ window.gui_update_state()
+
+ if not have_video:
+ pyglet.clock.schedule_interval(lambda dt: None, 0.2)
+
+ pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/multiple_windows.py b/pyglet-1.3.0/pyglet-1.3.0/examples/multiple_windows.py
new file mode 100644
index 0000000..96128e2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/multiple_windows.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Demonstrates how to manage OpenGL calls between two independent windows.
+'''
+
+import pyglet
+from pyglet.gl import *
+
+def on_resize(width, height):
+ glViewport(0, 0, width, height)
+ glMatrixMode(GL_PROJECTION)
+ glLoadIdentity()
+ gluPerspective(60., width / float(height), 1., 100.)
+ glMatrixMode(GL_MODELVIEW)
+
+def setup():
+ glClearColor(1, 1, 1, 1)
+ glColor3f(.5, .5, .5)
+
+def on_draw():
+ glClear(GL_COLOR_BUFFER_BIT)
+ glLoadIdentity()
+ glTranslatef(0, 0, -5)
+ glRotatef(r, 0, 0, 1)
+ glRectf(-1, -1, 1, 1)
+
+r = 0
+def update(dt):
+ global r
+ r += 1
+ if r > 360:
+ r = 0
+pyglet.clock.schedule_interval(update, 1/20.)
+
+w1 = pyglet.window.Window(200, 200, caption='First window', resizable=True)
+w1.on_resize = on_resize
+w1.on_draw = on_draw
+w1.switch_to()
+setup()
+
+w2 = pyglet.window.Window(300, 300, caption='Second window', resizable=True)
+w2.on_resize = on_resize
+w2.on_draw = on_draw
+w2.switch_to()
+setup()
+
+pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/noisy/README b/pyglet-1.3.0/pyglet-1.3.0/examples/noisy/README
new file mode 100644
index 0000000..efe0c0c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/noisy/README
@@ -0,0 +1,11 @@
+noisy
+=====
+
+This is an example program that accompanies pyglet (http://www.pyglet.org).
+Due to licensing restrictions on some of the assets, this game cannot be used
+for commercial purposes.
+
+The source code is licensed under the BSD license, which is quite permissive
+(see the source header for details).
+
+All artwork and the sound is Copyright 2007 Alex Holkner.
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/noisy/ball.png b/pyglet-1.3.0/pyglet-1.3.0/examples/noisy/ball.png
new file mode 100644
index 0000000..f86f2a0
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/noisy/ball.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/noisy/ball.wav b/pyglet-1.3.0/pyglet-1.3.0/examples/noisy/ball.wav
new file mode 100644
index 0000000..984ed32
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/noisy/ball.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/noisy/noisy.py b/pyglet-1.3.0/pyglet-1.3.0/examples/noisy/noisy.py
new file mode 100644
index 0000000..c837389
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/noisy/noisy.py
@@ -0,0 +1,116 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Bounces balls around a window and plays noises.
+
+This is a simple demonstration of how pyglet efficiently manages many sound
+channels without intervention.
+'''
+
+import os
+import random
+import sys
+
+from pyglet.gl import *
+import pyglet
+from pyglet.window import key
+
+BALL_IMAGE = 'ball.png'
+BALL_SOUND = 'ball.wav'
+
+if len(sys.argv) > 1:
+ BALL_SOUND = sys.argv[1]
+
+sound = pyglet.resource.media(BALL_SOUND, streaming=False)
+
+class Ball(pyglet.sprite.Sprite):
+ ball_image = pyglet.resource.image(BALL_IMAGE)
+ width = ball_image.width
+ height = ball_image.height
+
+ def __init__(self):
+ x = random.random() * (window.width - self.width)
+ y = random.random() * (window.height - self.height)
+
+ super(Ball, self).__init__(self.ball_image, x, y, batch=balls_batch)
+
+ self.dx = (random.random() - 0.5) * 1000
+ self.dy = (random.random() - 0.5) * 1000
+
+ def update(self, dt):
+ if self.x <= 0 or self.x + self.width >= window.width:
+ self.dx *= -1
+ sound.play()
+ if self.y <= 0 or self.y + self.height >= window.height:
+ self.dy *= -1
+ sound.play()
+ self.x += self.dx * dt
+ self.y += self.dy * dt
+
+ self.x = min(max(self.x, 0), window.width - self.width)
+ self.y = min(max(self.y, 0), window.height - self.height)
+
+window = pyglet.window.Window(640, 480)
+
+@window.event
+def on_key_press(symbol, modifiers):
+ if symbol == key.SPACE:
+ balls.append(Ball())
+ elif symbol == key.BACKSPACE:
+ if balls:
+ del balls[-1]
+ elif symbol == key.ESCAPE:
+ window.has_exit = True
+
+@window.event
+def on_draw():
+ window.clear()
+ balls_batch.draw()
+ label.draw()
+
+def update(dt):
+ for ball in balls:
+ ball.update(dt)
+pyglet.clock.schedule_interval(update, 1/30.)
+
+balls_batch = pyglet.graphics.Batch()
+balls = []
+label = pyglet.text.Label('Press space to add a ball, backspace to remove',
+ font_size=14,
+ x=window.width // 2, y=10,
+ anchor_x='center')
+
+if __name__ == '__main__':
+ pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/opengl.py b/pyglet-1.3.0/pyglet-1.3.0/examples/opengl.py
new file mode 100644
index 0000000..098e052
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/opengl.py
@@ -0,0 +1,190 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Displays a rotating torus using OpenGL.
+
+This example demonstrates:
+
+ * Using a 3D projection on a window by overriding the default on_resize
+ handler
+ * Enabling multisampling if available
+ * Drawing a simple 3D primitive using vertex and index arrays
+ * Using a display list
+ * Fixed-pipeline lighting
+
+'''
+
+from math import pi, sin, cos
+
+from pyglet.gl import *
+import pyglet
+
+try:
+ # Try and create a window with multisampling (antialiasing)
+ config = Config(sample_buffers=1, samples=4,
+ depth_size=16, double_buffer=True,)
+ window = pyglet.window.Window(resizable=True, config=config)
+except pyglet.window.NoSuchConfigException:
+ # Fall back to no multisampling for old hardware
+ window = pyglet.window.Window(resizable=True)
+
+@window.event
+def on_resize(width, height):
+ # Override the default on_resize handler to create a 3D projection
+ glViewport(0, 0, width, height)
+ glMatrixMode(GL_PROJECTION)
+ glLoadIdentity()
+ gluPerspective(60., width / float(height), .1, 1000.)
+ glMatrixMode(GL_MODELVIEW)
+ return pyglet.event.EVENT_HANDLED
+
+def update(dt):
+ global rx, ry, rz
+ rx += dt * 1
+ ry += dt * 80
+ rz += dt * 30
+ rx %= 360
+ ry %= 360
+ rz %= 360
+pyglet.clock.schedule(update)
+
+@window.event
+def on_draw():
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
+ glLoadIdentity()
+ glTranslatef(0, 0, -4)
+ glRotatef(rz, 0, 0, 1)
+ glRotatef(ry, 0, 1, 0)
+ glRotatef(rx, 1, 0, 0)
+ torus.draw()
+
+def setup():
+ # One-time GL setup
+ glClearColor(1, 1, 1, 1)
+ glColor3f(1, 0, 0)
+ glEnable(GL_DEPTH_TEST)
+ glEnable(GL_CULL_FACE)
+
+ # Uncomment this line for a wireframe view
+ #glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
+
+ # Simple light setup. On Windows GL_LIGHT0 is enabled by default,
+ # but this is not the case on Linux or Mac, so remember to always
+ # include it.
+ glEnable(GL_LIGHTING)
+ glEnable(GL_LIGHT0)
+ glEnable(GL_LIGHT1)
+
+ # Define a simple function to create ctypes arrays of floats:
+ def vec(*args):
+ return (GLfloat * len(args))(*args)
+
+ glLightfv(GL_LIGHT0, GL_POSITION, vec(.5, .5, 1, 0))
+ glLightfv(GL_LIGHT0, GL_SPECULAR, vec(.5, .5, 1, 1))
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, vec(1, 1, 1, 1))
+ glLightfv(GL_LIGHT1, GL_POSITION, vec(1, 0, .5, 0))
+ glLightfv(GL_LIGHT1, GL_DIFFUSE, vec(.5, .5, .5, 1))
+ glLightfv(GL_LIGHT1, GL_SPECULAR, vec(1, 1, 1, 1))
+
+ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, vec(0.5, 0, 0.3, 1))
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, vec(1, 1, 1, 1))
+ glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 50)
+
+class Torus(object):
+ def __init__(self, radius, inner_radius, slices, inner_slices):
+ # Create the vertex and normal arrays.
+ vertices = []
+ normals = []
+
+ u_step = 2 * pi / (slices - 1)
+ v_step = 2 * pi / (inner_slices - 1)
+ u = 0.
+ for i in range(slices):
+ cos_u = cos(u)
+ sin_u = sin(u)
+ v = 0.
+ for j in range(inner_slices):
+ cos_v = cos(v)
+ sin_v = sin(v)
+
+ d = (radius + inner_radius * cos_v)
+ x = d * cos_u
+ y = d * sin_u
+ z = inner_radius * sin_v
+
+ nx = cos_u * cos_v
+ ny = sin_u * cos_v
+ nz = sin_v
+
+ vertices.extend([x, y, z])
+ normals.extend([nx, ny, nz])
+ v += v_step
+ u += u_step
+
+ # Create ctypes arrays of the lists
+ vertices = (GLfloat * len(vertices))(*vertices)
+ normals = (GLfloat * len(normals))(*normals)
+
+ # Create a list of triangle indices.
+ indices = []
+ for i in range(slices - 1):
+ for j in range(inner_slices - 1):
+ p = i * inner_slices + j
+ indices.extend([p, p + inner_slices, p + inner_slices + 1])
+ indices.extend([p, p + inner_slices + 1, p + 1])
+ indices = (GLuint * len(indices))(*indices)
+
+ # Compile a display list
+ self.list = glGenLists(1)
+ glNewList(self.list, GL_COMPILE)
+
+ glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
+ glEnableClientState(GL_VERTEX_ARRAY)
+ glEnableClientState(GL_NORMAL_ARRAY)
+ glVertexPointer(3, GL_FLOAT, 0, vertices)
+ glNormalPointer(GL_FLOAT, 0, normals)
+ glDrawElements(GL_TRIANGLES, len(indices), GL_UNSIGNED_INT, indices)
+ glPopClientAttrib()
+
+ glEndList()
+
+ def draw(self):
+ glCallList(self.list)
+
+setup()
+torus = Torus(1, 0.3, 50, 30)
+rx = ry = rz = 0
+
+pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/opengl_3.py b/pyglet-1.3.0/pyglet-1.3.0/examples/opengl_3.py
new file mode 100644
index 0000000..8e639d1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/opengl_3.py
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+# $Id:$
+
+'''In order to use the new features of OpenGL 3, you must explicitly create
+an OpenGL 3 context. You can do this by supplying the `major_version` and
+`minor_version` attributes for a GL Config.
+
+This example creates an OpenGL 3 context, prints the version string to stdout,
+and exits.
+
+At time of writing, only the beta nvidia driver on Windows and Linux support
+OpenGL 3, and requires an 8-series or higher.
+
+On Windows, OpenGL 3 API must be explicitly enabled using the nvemulate tool
+[1]. Additionally, at time of writing the latest driver did not yet support
+forward compatible or debug contexts.
+
+On Linux, the only driver that currently exposes the required GLX extensions
+is 177.61.02 -- later drivers (177.67, 177.68, 177.7*, 177.8*, 180.06) seem to
+be missing the extensions.
+
+[1] http://developer.nvidia.com/object/nvemulate.html
+'''
+
+from __future__ import print_function
+
+import pyglet
+
+# Specify the OpenGL version explicitly to request 3.0 features, including
+# GLSL 1.3.
+#
+# Some other attributes relevant to OpenGL 3:
+# forward_compatible = True To request a context without deprecated
+# functionality
+# debug = True To request a debug context
+config = pyglet.gl.Config(major_version=3, minor_version=0)
+
+# Create a context matching the above configuration. Will fail if
+# OpenGL 3 is not supported by the driver.
+window = pyglet.window.Window(config=config, visible=False)
+
+# Print the version of the context created.
+print('OpenGL version:', window.context.get_info().get_version())
+
+window.close()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/animation.py b/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/animation.py
new file mode 100644
index 0000000..4e7025a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/animation.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Load and display a GIF animation.
+
+Usage::
+
+ animation.py []
+
+If the filename is omitted, a sample animation is loaded
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+# The dinosaur.gif file packaged alongside this script is in the public
+# domain, it was obtained from http://www.gifanimations.com/.
+
+import sys
+
+import pyglet
+
+if len(sys.argv) > 1:
+ # Load the animation from file path.
+ animation = pyglet.image.load_animation(sys.argv[1])
+ bin = pyglet.image.atlas.TextureBin()
+ animation.add_to_texture_bin(bin)
+else:
+ # Load animation from resource (this script's directory).
+ animation = pyglet.resource.animation('dinosaur.gif')
+sprite = pyglet.sprite.Sprite(animation)
+
+window = pyglet.window.Window(width=sprite.width, height=sprite.height)
+
+# Set window background color to white.
+pyglet.gl.glClearColor(1, 1, 1, 1)
+
+@window.event
+def on_draw():
+ window.clear()
+ sprite.draw()
+
+pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/dinosaur.gif b/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/dinosaur.gif
new file mode 100644
index 0000000..90210a2
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/dinosaur.gif differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/events.py b/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/events.py
new file mode 100644
index 0000000..35854b7
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/events.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+
+from __future__ import print_function
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import pyglet
+from pyglet.window import key
+from pyglet.window import mouse
+
+window = pyglet.window.Window()
+
+@window.event
+def on_key_press(symbol, modifiers):
+ if symbol == key.A:
+ print('The "A" key was pressed.')
+ elif symbol == key.LEFT:
+ print('The left arrow key was pressed.')
+ elif symbol == key.ENTER:
+ print('The enter key was pressed.')
+
+@window.event
+def on_mouse_press(x, y, button, modifiers):
+ if button == mouse.LEFT:
+ print('The left mouse button was pressed.')
+
+@window.event
+def on_draw():
+ window.clear()
+
+pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/hello_world.py b/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/hello_world.py
new file mode 100644
index 0000000..61952b8
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/hello_world.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import pyglet
+
+window = pyglet.window.Window()
+label = pyglet.text.Label('Hello, world',
+ font_name='Times New Roman',
+ font_size=36,
+ x=window.width//2, y=window.height//2,
+ anchor_x='center', anchor_y='center')
+
+@window.event
+def on_draw():
+ window.clear()
+ label.draw()
+
+pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/image_viewer.py b/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/image_viewer.py
new file mode 100644
index 0000000..cc8eab3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/image_viewer.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import pyglet
+
+window = pyglet.window.Window()
+image = pyglet.resource.image('kitten.jpg')
+
+@window.event
+def on_draw():
+ window.clear()
+ image.blit(0, 0)
+
+pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/kitten.jpg b/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/kitten.jpg
new file mode 100644
index 0000000..5338414
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/kitten.jpg differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/window_subclass.py b/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/window_subclass.py
new file mode 100644
index 0000000..b1680a9
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/programming_guide/window_subclass.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Demonstrates a useful pattern for pyglet applications: subclassing Window.
+'''
+
+import pyglet
+
+class HelloWorldWindow(pyglet.window.Window):
+ def __init__(self):
+ super(HelloWorldWindow, self).__init__()
+
+ self.label = pyglet.text.Label('Hello, world!')
+
+ def on_draw(self):
+ self.clear()
+ self.label.draw()
+
+if __name__ == '__main__':
+ window = HelloWorldWindow()
+ pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/pyglet.png b/pyglet-1.3.0/pyglet-1.3.0/examples/pyglet.png
new file mode 100644
index 0000000..c8bbfc8
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/pyglet.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/show_input.py b/pyglet-1.3.0/pyglet-1.3.0/examples/show_input.py
new file mode 100644
index 0000000..b5241a2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/show_input.py
@@ -0,0 +1,396 @@
+#!/usr/bin/env python
+
+'''Graphically show all devices available via the pyglet.input interface.
+
+Each device is shown in its own collapsed panel. Click on a device panel
+to expand it, revealing that device's controls. The controls show the
+current live values, and flash white when the value changes.
+'''
+
+from __future__ import print_function
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import pyglet
+from pyglet import gl
+
+
+class LineGroup(pyglet.graphics.OrderedGroup):
+ def set_state(self):
+ gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_LINE)
+
+ def unset_state(self):
+ gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL)
+
+
+class Box(object):
+ def __init__(self, batch, group=None,
+ stroke_color=(255, 255, 255, 255),
+ fill_color=(200, 200, 200, 255)):
+ self.x1 = 0
+ self.y1 = 0
+ self.x2 = 0
+ self.y2 = 0
+
+ self.fill_vertices = batch.add(4, gl.GL_QUADS,
+ pyglet.graphics.OrderedGroup(0, group),
+ 'v2f', ('c4B', fill_color * 4))
+ self.stroke_vertices = batch.add(4, gl.GL_QUADS,
+ LineGroup(1, group),
+ 'v2f', ('c4B', stroke_color * 4))
+
+ def set_bounds(self, x1, y1, x2, y2):
+ self.x1 = 0
+ self.y1 = 0
+ self.x2 = 0
+ self.y2 = 0
+ self.fill_vertices.vertices[:] = (x1, y1, x2, y1, x2, y2, x1, y2)
+ self.stroke_vertices.vertices[:] = (x1, y1, x2, y1, x2, y2, x1-1, y2)
+
+ def set_fill(self, r, g, b):
+ self.fill_vertices.colors[:] = (r, g, b, 255) * 4
+
+ def delete(self):
+ self.fill_vertices.delete()
+ self.stroke_vertices.delete()
+
+
+class DevicePanel(object):
+ BORDER_MARGIN = 5
+ CONTENT_MARGIN = 8
+
+ def __init__(self, device):
+ self.device = device
+
+ self.box = Box(batch, group=background_group,
+ stroke_color=(0, 0, 200, 255),
+ fill_color=(200, 200, 255, 255))
+ self.name_label = pyglet.text.Label(device.name or 'Unknown device',
+ font_size=10,
+ color=(0, 0, 0, 255),
+ anchor_y='top',
+ batch=batch, group=text_group)
+ self.manufacturer_label = pyglet.text.Label(device.manufacturer or '',
+ font_size=10,
+ color=(0, 0, 0, 255), anchor_x='right', anchor_y='top',
+ batch=batch, group=text_group)
+
+ self.is_open = False
+ self.widgets = []
+
+ def set_bounds(self, left, right, top):
+ self.left = left
+ self.right = right
+ self.top = top
+ self.layout()
+
+ def layout_widgets(self):
+ max_row_width = self.right - self.left - self.CONTENT_MARGIN * 2
+
+ row = []
+ row_width = 0
+ row_height = 0
+
+ def layout_row(row, x1, y1, x2, y2):
+ x = x1
+ for widget in row:
+ widget.set_bounds(x,
+ y1,
+ x + widget.min_width,
+ y1 + widget.min_height)
+ x += widget.min_width
+
+ y = self.bottom + self.CONTENT_MARGIN
+ for widget in self.widgets:
+ if widget is None or row_width + widget.min_width > max_row_width:
+ layout_row(row,
+ self.left + self.CONTENT_MARGIN,
+ y - row_height,
+ self.right - self.CONTENT_MARGIN,
+ y)
+ row = []
+ y -= row_height
+ row_width = 0
+
+ if widget is None:
+ break
+
+ row.append(widget)
+ row_width += widget.min_width
+ row_height = max(row_height, widget.min_height)
+
+ self.bottom = y - self.CONTENT_MARGIN
+
+ def layout(self):
+ self.title_bottom = self.top - \
+ self.name_label.content_height - self.CONTENT_MARGIN * 2
+ self.bottom = self.title_bottom
+ if self.is_open:
+ self.layout_widgets()
+
+ self.box.set_bounds(self.left + self.BORDER_MARGIN,
+ self.bottom + self.BORDER_MARGIN,
+ self.right - self.BORDER_MARGIN,
+ self.top - self.BORDER_MARGIN)
+
+ self.name_label.x = self.left + self.CONTENT_MARGIN
+ self.name_label.y = self.top - self.CONTENT_MARGIN
+ self.manufacturer_label.x = self.right - self.CONTENT_MARGIN
+ self.manufacturer_label.y = self.top - self.CONTENT_MARGIN
+
+ def hit_test(self, x, y):
+ return self.left < x < self.right and self.title_bottom < y < self.top
+
+ def toggle(self):
+ if self.is_open:
+ self.close()
+ else:
+ self.open()
+
+ def open(self):
+ if self.is_open:
+ return
+
+ try:
+ self.device.open()
+ except pyglet.input.DeviceException as e:
+ try:
+ self.device.open(window)
+ except pyglet.input.DeviceException as e:
+ print(e) # TODO show error
+ return
+
+ window.set_mouse_cursor(window.get_system_mouse_cursor('wait'))
+ for control in self.device.get_controls():
+ if isinstance(control, pyglet.input.Button):
+ widget = ButtonWidget(control, batch, group=text_group)
+ else:
+ widget = ControlWidget(control, batch, group=text_group)
+ self.widgets.append(widget)
+
+ if not self.widgets:
+ self.widgets.append(NoControlsWidget(batch, group=text_group))
+
+ self.widgets.append(None)
+ window.set_mouse_cursor(None)
+
+ self.is_open = True
+
+ def close(self):
+ if not self.is_open:
+ return
+
+ for widget in self.widgets:
+ if widget:
+ widget.delete()
+ del self.widgets[:]
+
+ self.device.close()
+
+ self.is_open = False
+
+
+class ControlWidget(object):
+ BORDER_MARGIN = 2
+ CONTENT_MARGIN = 4
+
+ def __init__(self, control, batch, group=None):
+ self.control_name = control.name
+ if not self.control_name:
+ self.control_name = control.raw_name
+ self.box = Box(batch, pyglet.graphics.OrderedGroup(0, group))
+ self.name_label = pyglet.text.Label(self.control_name,
+ font_size=10,
+ anchor_x='left',
+ anchor_y='bottom',
+ color=(0, 0, 0, 255),
+ batch=batch,
+ group=pyglet.graphics.OrderedGroup(1, group))
+ self.value_label = pyglet.text.Label(' ',
+ font_size=8,
+ anchor_x='right',
+ anchor_y='bottom',
+ color=(0, 0, 0, 255),
+ batch=batch,
+ group=pyglet.graphics.OrderedGroup(1, group))
+
+ self.min_width = \
+ self.name_label.content_width + \
+ self.value_label.content_width + self.CONTENT_MARGIN * 2
+ self.min_height = self.name_label.content_height + self.CONTENT_MARGIN * 2
+
+ self.relative = isinstance(control, pyglet.input.RelativeAxis)
+ self.fade = 200
+
+ self.control = control
+ control.push_handlers(self)
+
+ def set_bounds(self, x1, y1, x2, y2):
+ self.box.set_bounds(
+ x1 + self.BORDER_MARGIN,
+ y1 + self.BORDER_MARGIN,
+ x2 - self.BORDER_MARGIN,
+ y2 - self.BORDER_MARGIN)
+ self.name_label.x = x1 + self.CONTENT_MARGIN
+ self.name_label.y = y1 + self.CONTENT_MARGIN
+ self.value_label.x = x2 - self.CONTENT_MARGIN
+ self.value_label.y = y1 + self.CONTENT_MARGIN
+
+ def delete(self):
+ if self in changed_widgets:
+ changed_widgets.remove(self)
+ self.control.remove_handlers(self)
+ self.name_label.delete()
+ self.value_label.delete()
+ self.box.delete()
+
+ def on_change(self, value):
+ self.value = value
+ self.fade = 255
+ changed_widgets.add(self)
+
+ def update(self):
+ self.value_label.text = str(self.value)
+ if self.relative and self.value:
+ self.value = 0
+ changed_widgets.add(self)
+
+ self.box.set_fill(self.fade, self.fade, self.fade)
+ if self.fade > 200:
+ self.fade = max(200, self.fade - 10)
+ changed_widgets.add(self)
+
+
+class ButtonWidget(ControlWidget):
+ BORDER_MARGIN = 2
+ CONTENT_MARGIN = 4
+
+ def __init__(self, control, batch, group=None):
+ self.control_name = control.name
+ if not self.control_name:
+ self.control_name = control.raw_name
+ self.box = Box(batch, pyglet.graphics.OrderedGroup(0, group))
+ self.name_label = pyglet.text.Label(self.control_name,
+ font_size=10,
+ anchor_x='center',
+ anchor_y='bottom',
+ color=(0, 0, 0, 255),
+ batch=batch,
+ group=pyglet.graphics.OrderedGroup(1, group))
+
+ self.min_width = self.name_label.content_width + self.CONTENT_MARGIN * 2
+ self.min_height = self.name_label.content_height + self.CONTENT_MARGIN * 2
+
+ self.fade = 200
+
+ self.control = control
+ control.push_handlers(self)
+
+ def set_bounds(self, x1, y1, x2, y2):
+ self.box.set_bounds(
+ x1 + self.BORDER_MARGIN,
+ y1 + self.BORDER_MARGIN,
+ x2 - self.BORDER_MARGIN,
+ y2 - self.BORDER_MARGIN)
+ self.name_label.x = (x1 + x2) // 2
+ self.name_label.y = y1 + self.CONTENT_MARGIN
+
+ def delete(self):
+ if self in changed_widgets:
+ changed_widgets.remove(self)
+ self.control.remove_handlers(self)
+ self.name_label.delete()
+ self.box.delete()
+
+ def on_change(self, value):
+ self.value = value
+ if value:
+ self.fade = 255
+ changed_widgets.add(self)
+
+ def update(self):
+ self.box.set_fill(self.fade, self.fade, self.fade)
+ if not self.value and self.fade > 200:
+ self.fade = max(200, self.fade - 10)
+ changed_widgets.add(self)
+
+
+class NoControlsWidget(object):
+ CONTENT_MARGIN = 4
+
+ def __init__(self, batch, group):
+ self.label = pyglet.text.Label('No controls on this device.',
+ font_size=10,
+ color=(0, 0, 0, 255),
+ anchor_y='bottom',
+ batch=batch,
+ group=group)
+
+ self.min_width = self.label.content_width + self.CONTENT_MARGIN * 2
+ self.min_height = self.label.content_height + self.CONTENT_MARGIN * 2
+
+ def set_bounds(self, x1, y1, x2, y2):
+ self.label.x = x1 + ControlWidget.CONTENT_MARGIN
+ self.label.y = y1 + ControlWidget.CONTENT_MARGIN
+
+ def delete(self):
+ self.label.delete()
+
+
+window = pyglet.window.Window(caption='Input Devices', resizable=True)
+batch = pyglet.graphics.Batch()
+background_group = pyglet.graphics.OrderedGroup(0)
+text_group = pyglet.graphics.OrderedGroup(1)
+
+panels = [DevicePanel(device) for device in pyglet.input.get_devices()]
+help_label = pyglet.text.Label(
+ 'Click on a device name to show or hide its controls.',
+ x=DevicePanel.CONTENT_MARGIN,
+ anchor_y='top',
+ font_size=10,
+ color=(255, 255, 255, 255),
+ batch=batch,
+ group=background_group)
+
+
+def layout_panels():
+ y = window.height
+ for panel in panels:
+ panel.set_bounds(left=0, right=window.width, top=y)
+ y = panel.bottom
+ help_label.y = y
+
+@window.event
+def on_draw():
+ gl.glClearColor(0.3, 0.3, 0.4, 1.0)
+ window.clear()
+ batch.draw()
+ window.invalid = False
+
+@window.event
+def on_resize(width, height):
+ layout_panels()
+ window.invalid = True
+ return pyglet.event.EVENT_UNHANDLED
+
+@window.event
+def on_mouse_press(x, y, button, modifiers):
+ for panel in panels:
+ if panel.hit_test(x, y):
+ panel.toggle()
+ layout_panels()
+ window.invalid = True
+
+changed_widgets = set()
+
+
+def update(dt):
+ pending = list(changed_widgets)
+ changed_widgets.clear()
+ for widget in pending:
+ widget.update()
+ window.invalid = True
+
+pyglet.clock.schedule_interval(update, 0.05)
+pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/README b/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/README
new file mode 100644
index 0000000..dc11a85
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/README
@@ -0,0 +1,38 @@
+Sound Space
+===========
+
+This is a toy program for playing with positional audio in pyglet
+(http://www.pyglet.org). On Linux, OpenAL is required.
+
+The source code is licensed under the BSD license, which is quite permissive
+(see the source headers for details).
+
+Audio samples were generated with Apple GarageBand.
+
+Usage
+-----
+
+Run the toy with::
+
+ python soundspace.py
+
+Everything is controlled with the mouse. Hover over a control to
+see its name. Click and drag an empty area to pan the view, and scroll the
+scroll wheel to zoom in and out.
+
+The red triangles can be dragged to move the position of a player or listener.
+
+The dashed line to the yellow handle shows the cone orientation; this can be
+reoriented by dragging it.
+
+The blue and green segments represent the outer and inner cone angles,
+respectively. You can resize the angle by dragging the handle attached to the
+cone.
+
+There is a master volume control beneath the listener.
+
+Click the (+) sign on a player to show the min_gain, max_gain, cone_outer_gain
+and volume controls.
+
+The initial configuration is given in res/space.txt; it should be
+self-explanatory (parsed by reader.py).
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/reader.py b/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/reader.py
new file mode 100644
index 0000000..1acddfd
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/reader.py
@@ -0,0 +1,110 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+# $Id$
+
+import os
+import math
+
+from pyglet import media
+
+class PlayerReader(object):
+ def __init__(self, player):
+ self.player = player
+
+ def line(self, line, lineno):
+ parts = line.split()
+ if parts[0] == 'position':
+ if len(parts) < 4:
+ raise ReaderException('Invalid position line %d' % lineno)
+ self.player.position = tuple([float(x) for x in parts[1:]])
+ if parts[0] == 'cone_orientation':
+ if len(parts) < 4:
+ raise ReaderException('Invalid orientation line %d' % lineno)
+ self.player.cone_orientation = tuple([float(x) for x in parts[1:]])
+ elif parts[0] == 'outer_cone_angle':
+ if len(parts) < 2:
+ raise ReaderException('Invalid angle line %d' % lineno)
+ self.player.cone_outer_angle = float(parts[1])
+ elif parts[0] == 'inner_cone_angle':
+ if len(parts) < 2:
+ raise ReaderException('Invalid angle line %d' % lineno)
+ self.player.cone_inner_angle = float(parts[1])
+ elif parts[0] == 'label':
+ if len(parts) < 2:
+ raise ReaderException('Invalid label line %d' % lineno)
+ self.player.label = parts[1]
+
+class SpaceReader(object):
+ def __init__(self, space):
+ self.basedir = ''
+ self.space = space
+
+ def read(self, file):
+ if not hasattr(file, 'read'):
+ self.basedir = os.path.dirname(file)
+ file = open(file, 'rt')
+ elif hasattr(file, 'name'):
+ self.basedir = os.path.dirname(file.name)
+ reader = None
+ lineno = 0
+ for line in file:
+ lineno += 1
+
+ if not isinstance('', bytes) and isinstance(line, bytes):
+ # decode bytes to str on Python 3
+ line = line.decode('ascii')
+
+ if not line.strip() or line.startswith('#'):
+ continue
+ if line.startswith(' '):
+ if not reader:
+ raise ReaderException(
+ 'Unexpected indented block line %d' % lineno)
+ reader.line(line, lineno)
+ else:
+ reader = None
+ parts = line.split()
+ if parts[0] == 'loop':
+ if len(parts) < 2:
+ raise ReaderException(
+ 'No loop filename line %d' % lineno)
+ player = media.Player()
+ player.eos_action = 'loop'
+ player.queue(self.source(parts[1], streaming=False))
+ self.space.add_player(player)
+ reader = PlayerReader(player)
+
+ def source(self, filename, **kwargs):
+ filename = os.path.join(self.basedir, filename)
+ return media.load(filename, **kwargs)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/res/bass.ogg b/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/res/bass.ogg
new file mode 100644
index 0000000..5ace4a1
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/res/bass.ogg differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/res/drums.ogg b/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/res/drums.ogg
new file mode 100644
index 0000000..38f9176
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/res/drums.ogg differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/res/guitar.ogg b/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/res/guitar.ogg
new file mode 100644
index 0000000..43837b2
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/res/guitar.ogg differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/res/piano.ogg b/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/res/piano.ogg
new file mode 100644
index 0000000..fb0985e
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/res/piano.ogg differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/res/space.txt b/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/res/space.txt
new file mode 100644
index 0000000..9cd978c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/res/space.txt
@@ -0,0 +1,24 @@
+loop drums.ogg
+ label Drums
+ position -1.5 0 4
+ cone_orientation 1 0 -1
+ outer_cone_angle 360
+ inner_cone_angle 90
+loop piano.ogg
+ label Piano
+ position 3 0 4.5
+ cone_orientation -.5 0 -1
+ outer_cone_angle 360
+ inner_cone_angle 90
+loop bass.ogg
+ label Bass
+ position -3 0 -4
+ cone_orientation .5 0 1
+ outer_cone_angle 270
+ inner_cone_angle 90
+loop guitar.ogg
+ label Guitar
+ position 5 0 -3
+ cone_orientation -1.5 0 1
+ outer_cone_angle 270
+ inner_cone_angle 90
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/soundspace.py b/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/soundspace.py
new file mode 100644
index 0000000..60b626b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/soundspace/soundspace.py
@@ -0,0 +1,608 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+# $Id$
+
+import math
+import os
+
+import pyglet
+from pyglet.gl import *
+
+import reader
+
+pyglet.resource.path.append('res')
+pyglet.resource.reindex()
+
+# Check for AVbin
+from pyglet.media import have_avbin
+
+if not have_avbin():
+ raise ImportError('AVbin is required for this example, see '
+ 'http://code.google.com/p/avbin')
+
+def disc(r, x, y, slices=20, start=0, end=2*math.pi):
+ d = (end - start) / (slices - 1)
+ s = start
+ points = [(x, y)] + [(x + r * math.cos(a*d+s), y + r * math.sin(a*d+s)) \
+ for a in range(slices)]
+ points = ((GLfloat * 2) * len(points))(*points)
+ glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
+ glEnableClientState(GL_VERTEX_ARRAY)
+ glVertexPointer(2, GL_FLOAT, 0, points)
+ glDrawArrays(GL_TRIANGLE_FAN, 0, len(points))
+ glPopClientAttrib()
+
+def circle(r, x, y, slices=20):
+ d = 2 * math.pi / slices
+ points = [(x + r * math.cos(a*d), y + r * math.sin(a*d)) \
+ for a in range(slices)]
+ points = ((GLfloat * 2) * len(points))(*points)
+ glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
+ glEnableClientState(GL_VERTEX_ARRAY)
+ glVertexPointer(2, GL_FLOAT, 0, points)
+ glDrawArrays(GL_LINE_LOOP, 0, len(points))
+ glPopClientAttrib()
+
+
+def orientation_angle(orientation):
+ return math.atan2(orientation[2], orientation[0])
+
+class Handle(object):
+ tip = ''
+
+ def __init__(self, player):
+ self.player = player
+
+ def hit_test(self, x, y, z):
+ dx, dy, dz = [a - b for a, b in zip(self.pos(), (x, y, z))]
+ if dx * dx + dy * dy + dz * dz < self.radius * self.radius:
+ return -dx, -dy, -dz
+
+ def draw(self):
+ pass
+
+ def begin_drag(self, window, offset):
+ self.win = window
+ self.offset = offset
+ return self
+
+ def on_mouse_press(self, x, y, button, modifiers):
+ self.win.remove_handlers(self)
+
+ def on_mouse_release(self, x, y, button, modifiers):
+ self.win.remove_handlers(self)
+
+class LabelHandle(Handle):
+ def __init__(self, player):
+ super(LabelHandle, self).__init__(player)
+ self.text = pyglet.text.Label('', font_size=10, color=(0, 0, 0, 255),
+ anchor_y='top', anchor_x='center')
+
+ def hit_test(self, x, y, z):
+ return None
+
+ def draw(self):
+ if hasattr(self.player, 'label'):
+ x, _, y = self.player.position
+
+ # ech. fudge scale back to 1
+ mat = (GLfloat * 16)()
+ glGetFloatv(GL_MODELVIEW_MATRIX, mat)
+
+ glPushMatrix()
+ glTranslatef(x, y, 0)
+ glScalef(1/mat[0], 1/mat[5], 1/mat[10])
+ glTranslatef(0, -5, 0)
+
+ self.text.text = self.player.label
+ self.text.draw()
+
+ glPopMatrix()
+
+class PositionHandle(Handle):
+ tip = 'position'
+ radius = .3
+
+ def draw(self):
+ glPushMatrix()
+ glTranslatef(self.player.position[0], self.player.position[2], 0)
+ glColor3f(1, 0, 0)
+ glBegin(GL_TRIANGLES)
+ glVertex2f(0, self.radius)
+ glVertex2f(-self.radius * math.sqrt(3) / 2, -.5 * self.radius)
+ glVertex2f(self.radius * math.sqrt(3) / 2, -.5 * self.radius)
+ glEnd()
+ glPopMatrix()
+
+ def pos(self):
+ return self.player.position
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ pos = self.win.mouse_transform(x, y)
+ self.player.position = \
+ (pos[0] - self.offset[0],
+ pos[1] - self.offset[1],
+ pos[2] - self.offset[2])
+
+class OrientationHandle(Handle):
+ radius = .1
+ length = 1.5
+
+ def pos(self):
+ x, _, z = self.player.position
+ dir = self.get_orientation()
+ sz = math.sqrt(dir[0] ** 2 + dir[1] ** 2 + dir[2] ** 2) or 1
+ if sz != 0:
+ x += dir[0] / sz * self.length
+ z += dir[2] / sz * self.length
+ return x, 0, z
+
+ def draw(self):
+ glPushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT)
+
+ px, _, py = self.player.position
+ x, _, y = self.pos()
+
+ # Dashed line
+ glColor3f(.3, .3, .3)
+ glEnable(GL_LINE_STIPPLE)
+ glLineStipple(1, 0x7777)
+ glBegin(GL_LINES)
+ glVertex2f(px, py)
+ glVertex2f(x, y)
+ glEnd()
+
+ # This handle (orientation)
+ glColor3f(1, 1, 0)
+ disc(self.radius, x, y)
+
+ glPopAttrib()
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ px, py, pz = self.player.position
+ hx, hy, hz = self.win.mouse_transform(x, y)
+ self.set_orientation(
+ (hx - self.offset[0] - px,
+ hy - self.offset[1] - py,
+ hz - self.offset[2] - pz))
+
+class ConeOrientationHandle(OrientationHandle):
+ tip = 'cone_orientation'
+
+ def get_orientation(self):
+ return self.player.cone_orientation
+
+ def set_orientation(self, orientation):
+ self.player.cone_orientation = orientation
+
+class ForwardOrientationHandle(OrientationHandle):
+ tip = 'forward_orientation'
+
+ def get_orientation(self):
+ return self.player.forward_orientation
+
+ def set_orientation(self, orientation):
+ self.player.forward_orientation = orientation
+
+class ConeAngleHandle(Handle):
+ radius = .1
+
+ def pos(self):
+ px, py, pz = self.player.position
+ angle = orientation_angle(self.player.cone_orientation)
+ angle += self.get_angle() * math.pi / 180. / 2
+ x = math.cos(angle) * self.length
+ z = math.sin(angle) * self.length
+ return px + x, py, pz + z
+
+ def draw(self):
+ glPushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT)
+
+ # Fill
+ glEnable(GL_BLEND)
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+ glColor4f(*self.fill_color)
+ px, _, py = self.player.position
+ angle = orientation_angle(self.player.cone_orientation)
+ a = self.get_angle() * math.pi / 180.
+ disc(self.length, px, py,
+ start=angle - a/2,
+ end=angle + a/2)
+
+ # Handle
+ x, _, y = self.pos()
+ glColor4f(*self.color)
+ disc(self.radius, x, y)
+ glPopAttrib()
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ px, py, pz = self.player.position
+ hx, hy, hz = self.win.mouse_transform(x, y)
+ angle = orientation_angle(self.player.cone_orientation)
+ hangle = orientation_angle((hx - px, hy - py, hz - pz))
+ if hangle < angle:
+ hangle += math.pi * 2
+ res = min(max((hangle - angle) * 2, 0), math.pi * 2)
+ self.set_angle(res * 180. / math.pi)
+
+class ConeInnerAngleHandle(ConeAngleHandle):
+ tip = 'cone_inner_angle'
+ length = 1.
+ color = (.2, .8, .2, 1)
+ fill_color = (0, 1, 0, .1)
+
+ def get_angle(self):
+ return self.player.cone_inner_angle
+
+ def set_angle(self, angle):
+ self.player.cone_inner_angle = angle
+
+class ConeOuterAngleHandle(ConeAngleHandle):
+ tip = 'cone_outer_angle'
+ length = 1.2
+ color = (.2, .2, .8, 1)
+ fill_color = (0, 0, 1, .1)
+
+ def get_angle(self):
+ return self.player.cone_outer_angle
+
+ def set_angle(self, angle):
+ self.player.cone_outer_angle = angle
+
+class MoreHandle(Handle):
+ tip = 'More...'
+ radius = .2
+
+ open = False
+ open_width = 1.5
+ open_height = 1.5
+
+ def pos(self):
+ x, y, z = self.player.position
+ return x + 1, y, z + 1
+
+ def draw(self):
+ x, _, z = self.pos()
+
+ if self.open:
+ x -= .2
+ z += .2
+ glPushAttrib(GL_ENABLE_BIT)
+ glEnable(GL_BLEND)
+
+ glColor4f(1, 1, 1, .8)
+ glBegin(GL_QUADS)
+ glVertex2f(x, z)
+ glVertex2f(x + self.open_width, z)
+ glVertex2f(x + self.open_width, z - self.open_height)
+ glVertex2f(x, z - self.open_height)
+ glEnd()
+
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
+ glColor4f(0, 0, 0, 1)
+ glBegin(GL_QUADS)
+ glVertex2f(x, z)
+ glVertex2f(x + self.open_width, z)
+ glVertex2f(x + self.open_width, z - self.open_height)
+ glVertex2f(x, z - self.open_height)
+ glEnd()
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
+
+ glPopAttrib()
+ else:
+ glColor3f(1, 1, 1)
+ disc(self.radius, x, z)
+
+ glColor3f(0, 0, 0)
+ circle(self.radius, x, z)
+
+ r = self.radius - 0.1
+ glBegin(GL_LINES)
+ glVertex2f(x - r, z)
+ glVertex2f(x + r, z)
+ glVertex2f(x, z - r)
+ glVertex2f(x, z + r)
+ glEnd()
+
+ def begin_drag(self, window, offset):
+ self.open = True
+ self.win = window
+ self.win.set_more_player_handles(self.player)
+ return self
+
+ def on_mouse_press(self, x, y, button, modifiers):
+ x, y, z = self.win.mouse_transform(x, y)
+ for handle in self.win.more_handles:
+ if handle.hit_test(x, y, z):
+ return
+ self.win.set_more_player_handles(None)
+ self.win.remove_handlers(self)
+ self.open = False
+
+ def on_mouse_release(self, x, y, button, modifiers):
+ pass
+
+class SliderHandle(Handle):
+ length = 1.
+ width = .05
+ radius = .1
+
+ def __init__(self, player, x, z):
+ super(SliderHandle, self).__init__(player)
+ self.x = x
+ self.z = z
+
+ def pos(self):
+ x, y, z = self.player.position
+ x += self.x + self.get_value() * self.length
+ z += self.z
+ return x, y, z
+
+ def draw(self):
+ x = self.x + self.player.position[0]
+ z = self.z + self.player.position[2]
+
+ # Groove
+ glColor3f(.5, .5, .5)
+ glBegin(GL_QUADS)
+ glVertex2f(x, z - self.width/2)
+ glVertex2f(x + self.length, z - self.width/2)
+ glVertex2f(x + self.length, z + self.width/2)
+ glVertex2f(x, z + self.width/2)
+ glEnd()
+
+ # Thumb
+ x, _, z = self.pos()
+ glColor3f(.2, .2, .2)
+ disc(self.radius, x, z)
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ px, py, pz = self.player.position
+ hx, hy, hz = self.win.mouse_transform(x, y)
+ value = float(hx - px - self.x) / self.length
+ value = min(max(value, 0), 1)
+ self.set_value(value)
+
+class VolumeHandle(SliderHandle):
+ tip = 'volume'
+
+ def __init__(self, player):
+ super(VolumeHandle, self).__init__(player, 1, .9)
+
+ def get_value(self):
+ return self.player.volume
+
+ def set_value(self, value):
+ self.player.volume = value
+
+class ListenerVolumeHandle(SliderHandle):
+ tip = 'volume'
+
+ def __init__(self, player):
+ super(ListenerVolumeHandle, self).__init__(player, -.5, -1)
+
+ def get_value(self):
+ return self.player.volume
+
+ def set_value(self, value):
+ self.player.volume = value
+
+class MinDistanceHandle(SliderHandle):
+ tip = 'min_distance'
+
+ def __init__(self, player):
+ super(MinDistanceHandle, self).__init__(player, 1, .6)
+
+ def get_value(self):
+ return self.player.min_distance / 5.
+
+ def set_value(self, value):
+ self.player.min_distance = value * 5.
+
+class MaxDistanceHandle(SliderHandle):
+ tip = 'max_distance'
+
+ def __init__(self, player):
+ super(MaxDistanceHandle, self).__init__(player, 1, .3)
+
+ def get_value(self):
+ return min(self.player.max_distance / 5., 1.0)
+
+ def set_value(self, value):
+ self.player.max_distance = value * 5.
+
+class ConeOuterGainHandle(SliderHandle):
+ tip = 'cone_outer_gain'
+
+ def __init__(self, player):
+ super(ConeOuterGainHandle, self).__init__(player, 1, 0)
+
+ def get_value(self):
+ return self.player.cone_outer_gain
+
+ def set_value(self, value):
+ self.player.cone_outer_gain = value
+
+class SoundSpaceWindow(pyglet.window.Window):
+ def __init__(self, **kwargs):
+ kwargs.update(dict(
+ caption='Sound Space',
+ resizable=True,
+ ))
+ super(SoundSpaceWindow, self).__init__(**kwargs)
+
+ self.players = []
+ self.handles = []
+ self.more_handles = []
+
+ listener = pyglet.media.get_audio_driver().get_listener()
+ self.handles.append(PositionHandle(listener))
+ self.handles.append(ForwardOrientationHandle(listener))
+ self.handles.append(ListenerVolumeHandle(listener))
+ self.handles.append(LabelHandle(listener))
+
+ self.tip = pyglet.text.Label('', font_size=10, color=(0, 0, 0, 255),
+ anchor_y='top', anchor_x='center')
+ self.tip_player = None
+
+ # pixels per unit
+ self.zoom = 40
+ self.tx = self.width/2
+ self.ty = self.height/2
+
+ def add_player(self, player):
+ self.players.append(player)
+ self.handles.append(PositionHandle(player))
+ self.handles.append(ConeOrientationHandle(player))
+ self.handles.append(ConeInnerAngleHandle(player))
+ self.handles.append(ConeOuterAngleHandle(player))
+ self.handles.append(LabelHandle(player))
+ self.handles.append(MoreHandle(player))
+
+ def set_more_player_handles(self, player):
+ if player:
+ self.more_handles = [
+ VolumeHandle(player),
+ MinDistanceHandle(player),
+ MaxDistanceHandle(player),
+ ConeOuterGainHandle(player),
+ ]
+ else:
+ self.more_handles = []
+
+ def draw_background(self):
+ glLoadIdentity()
+ glPushAttrib(GL_CURRENT_BIT)
+ glColor3f(1, 1, 1)
+ glBegin(GL_LINES)
+ for i in range(0, self.width, self.zoom):
+ glVertex2f(i, 0)
+ glVertex2f(i, self.height)
+ for i in range(0, self.height, self.zoom):
+ glVertex2f(0, i)
+ glVertex2f(self.width, i)
+ glEnd()
+ glPopAttrib()
+
+ def camera_transform(self):
+ glLoadIdentity()
+ glTranslatef(self.tx, self.ty, 0)
+ glScalef(self.zoom, self.zoom, 1)
+
+ def mouse_transform(self, x, y):
+ return (float(x - self.tx) / self.zoom,
+ 0,
+ float(y - self.ty) / self.zoom)
+
+ def player_transform(self, player):
+ return (player.position[0] * self.zoom + self.tx,
+ player.position[2] * self.zoom + self.ty)
+
+ def hit_test(self, mouse_x, mouse_y):
+ x, y, z = self.mouse_transform(mouse_x, mouse_y)
+ for handle in self.more_handles[::-1] + self.handles[::-1]:
+ offset = handle.hit_test(x, y, z)
+ if offset:
+ return handle, offset
+ return None, None
+
+ def on_draw(self):
+ glClearColor(.8, .8, .8, 1)
+ self.clear()
+ self.draw_background()
+
+ glPushMatrix()
+ self.camera_transform()
+ for handle in self.handles + self.more_handles:
+ handle.draw()
+ glPopMatrix()
+
+ if self.tip_player:
+ player_pos = self.player_transform(self.tip_player)
+ self.tip.x = player_pos[0]
+ self.tip.y = player_pos[1] - 15
+ self.tip.draw()
+
+ def on_mouse_scroll(self, x, y, dx, dy):
+ self.zoom += dy * 10
+ self.zoom = min(max(self.zoom, 10), 100)
+
+ def on_mouse_press(self, x, y, button, modifiers):
+ handle, offset = self.hit_test(x, y)
+ if handle:
+ self.push_handlers(handle.begin_drag(self, offset))
+ else:
+ self.push_handlers(PanView(self))
+
+ def on_mouse_motion(self, x, y, dx, dy):
+ handle, offset = self.hit_test(x, y)
+ if handle:
+ self.tip.text = handle.tip
+ pos = self.player_transform(handle.player)
+ self.tip_player = handle.player
+ else:
+ self.tip.text = ''
+
+class PanView(object):
+ def __init__(self, window):
+ self.win = window
+
+ def on_mouse_release(self, x, y, button, modifiers):
+ self.win.remove_handlers(self)
+
+ def on_mouse_press(self, x, y, button, modifiers):
+ self.win.remove_handlers(self)
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ self.win.tx += dx
+ self.win.ty += dy
+
+if __name__ == '__main__':
+ # We swap Y and Z, moving to left-handed system
+ listener = pyglet.media.get_audio_driver().get_listener()
+ listener.up_orientation = (0, -1, 0)
+
+ # Start facing up (er, forwards)
+ listener.forward_orientation = (0, 0, 1)
+
+ listener.label = 'Listener'
+
+ w = SoundSpaceWindow()
+ r = reader.SpaceReader(w)
+ r.read(pyglet.resource.file('space.txt'))
+ player_group = pyglet.media.PlayerGroup(w.players)
+ player_group.play()
+
+ pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/synthesizer.py b/pyglet-1.3.0/pyglet-1.3.0/examples/synthesizer.py
new file mode 100644
index 0000000..fa2e4b1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/synthesizer.py
@@ -0,0 +1,68 @@
+import pyglet
+
+
+class Keyboard:
+ def __init__(self):
+ """A VERY basic semi-realtime synthesizer."""
+ self.window = pyglet.window.Window(720, 480)
+ instructions = "Press keys on your keyboard to play notes."
+ self.instructions = pyglet.text.Label(text=instructions, font_size=20, x=10, y=10)
+ self.current_note = pyglet.text.Label(text="", font_size=33, x=50, y=200)
+
+ self.c4_notes = {"C": 261.63, "C#": 277.183,
+ "D": 293.66, "D#": 311.127,
+ "E": 329.63,
+ "F": 349.23, "F#": 369.994,
+ "G": 392.00, "G#": 415.305,
+ "A": 440.00, "A#": 466.164,
+ "B": 493.88, "R": 0}
+
+ self.key_map = {pyglet.window.key.S: "C#",
+ pyglet.window.key.D: "D#",
+ pyglet.window.key.G: "F#",
+ pyglet.window.key.H: "G#",
+ pyglet.window.key.J: "A#",
+ pyglet.window.key.L: "C#",
+ pyglet.window.key.SEMICOLON: "D#",
+ pyglet.window.key.Z: "C",
+ pyglet.window.key.X: "D",
+ pyglet.window.key.C: "E",
+ pyglet.window.key.V: "F",
+ pyglet.window.key.B: "G",
+ pyglet.window.key.N: "A",
+ pyglet.window.key.M: "B",
+ pyglet.window.key.COMMA: "C",
+ pyglet.window.key.PERIOD: "D",
+ pyglet.window.key.BACKSLASH: "E"}
+
+ self.note_cache = {}
+
+ @self.window.event
+ def on_key_press(key, mod):
+ try:
+ self.play_note(self.c4_notes[self.key_map[key]])
+ self.current_note.text = "Current note: {0}".format(self.key_map[key])
+ except KeyError:
+ pass
+
+ @self.window.event
+ def on_draw():
+ self.window.clear()
+ self.instructions.draw()
+ self.current_note.draw()
+
+ def play_note(self, frequency, length=0.6):
+ if frequency in self.note_cache:
+ note_wave = self.note_cache[frequency]
+ note_wave.play()
+ else:
+ adsr = pyglet.media.procedural.ADSREnvelope(0.05, 0.2, 0.1)
+ note_wave = pyglet.media.StaticSource(
+ pyglet.media.procedural.Sawtooth(duration=length, frequency=frequency, envelope=adsr))
+ self.note_cache[frequency] = note_wave
+ note_wave.play()
+
+
+if __name__ == "__main__":
+ keyboard = Keyboard()
+ pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/tablet.py b/pyglet-1.3.0/pyglet-1.3.0/examples/tablet.py
new file mode 100644
index 0000000..ba3377a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/tablet.py
@@ -0,0 +1,63 @@
+#!/usr/bin/python
+# $Id:$
+
+from __future__ import print_function
+
+import pyglet
+
+window = pyglet.window.Window()
+tablets = pyglet.input.get_tablets()
+canvases = []
+
+if tablets:
+ print('Tablets:')
+ for i, tablet in enumerate(tablets):
+ print(' (%d) %s' % (i + 1, tablet.name))
+ print('Press number key to open corresponding tablet device.')
+else:
+ print('No tablets found.')
+
+
+@window.event
+def on_text(text):
+ try:
+ index = int(text) - 1
+ except ValueError:
+ return
+
+ if not (0 <= index < len(tablets)):
+ return
+
+ name = tablets[i].name
+
+ try:
+ canvas = tablets[i].open(window)
+ except pyglet.input.DeviceException:
+ print('Failed to open tablet %d on window' % index)
+
+ print('Opened %s' % name)
+
+ @canvas.event
+ def on_enter(cursor):
+ print('%s: on_enter(%r)' % (name, cursor))
+
+ @canvas.event
+ def on_leave(cursor):
+ print('%s: on_leave(%r)' % (name, cursor))
+
+ @canvas.event
+ def on_motion(cursor, x, y, pressure):
+ print('%s: on_motion(%r, %r, %r, %r)' % (name, cursor, x, y, pressure))
+
+
+@window.event
+def on_mouse_press(x, y, button, modifiers):
+ print('on_mouse_press(%r, %r, %r, %r' % (x, y, button, modifiers))
+
+
+@window.event
+def on_mouse_release(x, y, button, modifiers):
+ print('on_mouse_release(%r, %r, %r, %r' % (x, y, button, modifiers))
+
+pyglet.app.run()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/text_input.py b/pyglet-1.3.0/pyglet-1.3.0/examples/text_input.py
new file mode 100644
index 0000000..1ff78ce
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/text_input.py
@@ -0,0 +1,146 @@
+#!/usr/bin/env python
+
+'''Demonstrates basic use of IncrementalTextLayout and Caret.
+
+A simple widget-like system is created in this example supporting keyboard and
+mouse focus.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import pyglet
+
+class Rectangle(object):
+ '''Draws a rectangle into a batch.'''
+ def __init__(self, x1, y1, x2, y2, batch):
+ self.vertex_list = batch.add(4, pyglet.gl.GL_QUADS, None,
+ ('v2i', [x1, y1, x2, y1, x2, y2, x1, y2]),
+ ('c4B', [200, 200, 220, 255] * 4)
+ )
+
+class TextWidget(object):
+ def __init__(self, text, x, y, width, batch):
+ self.document = pyglet.text.document.UnformattedDocument(text)
+ self.document.set_style(0, len(self.document.text),
+ dict(color=(0, 0, 0, 255))
+ )
+ font = self.document.get_font()
+ height = font.ascent - font.descent
+
+ self.layout = pyglet.text.layout.IncrementalTextLayout(
+ self.document, width, height, multiline=False, batch=batch)
+ self.caret = pyglet.text.caret.Caret(self.layout)
+
+ self.layout.x = x
+ self.layout.y = y
+
+ # Rectangular outline
+ pad = 2
+ self.rectangle = Rectangle(x - pad, y - pad,
+ x + width + pad, y + height + pad, batch)
+
+ def hit_test(self, x, y):
+ return (0 < x - self.layout.x < self.layout.width and
+ 0 < y - self.layout.y < self.layout.height)
+
+class Window(pyglet.window.Window):
+ def __init__(self, *args, **kwargs):
+ super(Window, self).__init__(400, 140, caption='Text entry')
+
+ self.batch = pyglet.graphics.Batch()
+ self.labels = [
+ pyglet.text.Label('Name', x=10, y=100, anchor_y='bottom',
+ color=(0, 0, 0, 255), batch=self.batch),
+ pyglet.text.Label('Species', x=10, y=60, anchor_y='bottom',
+ color=(0, 0, 0, 255), batch=self.batch),
+ pyglet.text.Label('Special abilities', x=10, y=20,
+ anchor_y='bottom', color=(0, 0, 0, 255),
+ batch=self.batch)
+ ]
+ self.widgets = [
+ TextWidget('', 200, 100, self.width - 210, self.batch),
+ TextWidget('', 200, 60, self.width - 210, self.batch),
+ TextWidget('', 200, 20, self.width - 210, self.batch)
+ ]
+ self.text_cursor = self.get_system_mouse_cursor('text')
+
+ self.focus = None
+ self.set_focus(self.widgets[0])
+
+ def on_resize(self, width, height):
+ super(Window, self).on_resize(width, height)
+ for widget in self.widgets:
+ widget.width = width - 110
+
+ def on_draw(self):
+ pyglet.gl.glClearColor(1, 1, 1, 1)
+ self.clear()
+ self.batch.draw()
+
+ def on_mouse_motion(self, x, y, dx, dy):
+ for widget in self.widgets:
+ if widget.hit_test(x, y):
+ self.set_mouse_cursor(self.text_cursor)
+ break
+ else:
+ self.set_mouse_cursor(None)
+
+ def on_mouse_press(self, x, y, button, modifiers):
+ for widget in self.widgets:
+ if widget.hit_test(x, y):
+ self.set_focus(widget)
+ break
+ else:
+ self.set_focus(None)
+
+ if self.focus:
+ self.focus.caret.on_mouse_press(x, y, button, modifiers)
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ if self.focus:
+ self.focus.caret.on_mouse_drag(x, y, dx, dy, buttons, modifiers)
+
+ def on_text(self, text):
+ if self.focus:
+ self.focus.caret.on_text(text)
+
+ def on_text_motion(self, motion):
+ if self.focus:
+ self.focus.caret.on_text_motion(motion)
+
+ def on_text_motion_select(self, motion):
+ if self.focus:
+ self.focus.caret.on_text_motion_select(motion)
+
+ def on_key_press(self, symbol, modifiers):
+ if symbol == pyglet.window.key.TAB:
+ if modifiers & pyglet.window.key.MOD_SHIFT:
+ dir = -1
+ else:
+ dir = 1
+
+ if self.focus in self.widgets:
+ i = self.widgets.index(self.focus)
+ else:
+ i = 0
+ dir = 0
+
+ self.set_focus(self.widgets[(i + dir) % len(self.widgets)])
+
+ elif symbol == pyglet.window.key.ESCAPE:
+ pyglet.app.exit()
+
+ def set_focus(self, focus):
+ if self.focus:
+ self.focus.caret.visible = False
+ self.focus.caret.mark = self.focus.caret.position = 0
+
+ self.focus = focus
+ if self.focus:
+ self.focus.caret.visible = True
+ self.focus.caret.mark = 0
+ self.focus.caret.position = len(self.focus.document.text)
+
+window = Window(resizable=True)
+pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/timer.py b/pyglet-1.3.0/pyglet-1.3.0/examples/timer.py
new file mode 100644
index 0000000..af9a7be
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/timer.py
@@ -0,0 +1,91 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''A full-screen minute:second timer. Leave it in charge of your conference
+lighting talks.
+
+After 5 minutes, the timer goes red. This limit is easily adjustable by
+hacking the source code.
+
+Press spacebar to start, stop and reset the timer.
+'''
+
+import pyglet
+
+window = pyglet.window.Window(fullscreen=True)
+
+class Timer(object):
+ def __init__(self):
+ self.label = pyglet.text.Label('00:00', font_size=360,
+ x=window.width//2, y=window.height//2,
+ anchor_x='center', anchor_y='center')
+ self.reset()
+
+ def reset(self):
+ self.time = 0
+ self.running = False
+ self.label.text = '00:00'
+ self.label.color = (255, 255, 255, 255)
+
+ def update(self, dt):
+ if self.running:
+ self.time += dt
+ m, s = divmod(self.time, 60)
+ self.label.text = '%02d:%02d' % (m, s)
+ if m >= 5:
+ self.label.color = (180, 0, 0, 255)
+
+@window.event
+def on_key_press(symbol, modifiers):
+ if symbol == pyglet.window.key.SPACE:
+ if timer.running:
+ timer.running = False
+ else:
+ if timer.time > 0:
+ timer.reset()
+ else:
+ timer.running = True
+ elif symbol == pyglet.window.key.ESCAPE:
+ window.close()
+
+@window.event
+def on_draw():
+ window.clear()
+ timer.label.draw()
+
+timer = Timer()
+pyglet.clock.schedule_interval(timer.update, 1/30.0)
+pyglet.app.run()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/video.py b/pyglet-1.3.0/pyglet-1.3.0/examples/video.py
new file mode 100644
index 0000000..c41cfc2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/video.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Simple example of video playback.
+
+Usage::
+
+ video.py
+
+See the Programming Guide for a partial list of supported video formats.
+'''
+
+from __future__ import print_function
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import sys
+import pyglet
+
+if len(sys.argv) < 2:
+ print(__doc__)
+ sys.exit(1)
+
+source = pyglet.media.load(sys.argv[1])
+format = source.video_format
+if not format:
+ print('No video track in this source.')
+ sys.exit(1)
+
+player = pyglet.media.Player()
+player.queue(source)
+player.play()
+
+window = pyglet.window.Window(width=format.width, height=format.height)
+
+
+@window.event
+def on_draw():
+ player.get_texture().blit(0, 0)
+
+pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/examples/window_platform_event.py b/pyglet-1.3.0/pyglet-1.3.0/examples/window_platform_event.py
new file mode 100644
index 0000000..4646679
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/examples/window_platform_event.py
@@ -0,0 +1,96 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Demonstrates how to handle a platform-specific event not defined in
+pyglet by subclassing Window. This is not for the faint-hearted!
+
+A message will be printed to stdout when the following events are caught:
+
+ - On Mac OS X, the window drag region is clicked.
+ - On Windows, the display resolution is changed.
+ - On Linux, the window properties are changed.
+
+'''
+
+from __future__ import print_function
+
+import pyglet
+
+# Check for Carbon (OS X)
+try:
+ from pyglet.window.carbon import *
+ _have_carbon = True
+except ImportError:
+ _have_carbon = False
+
+# Check for Win32
+try:
+ from pyglet.window.win32 import *
+ from pyglet.window.win32.constants import *
+ _have_win32 = True
+except ImportError:
+ _have_win32 = False
+
+# Check for Xlib (Linux)
+try:
+ from pyglet.window.xlib import *
+ _have_xlib = True
+except ImportError:
+ _have_xlib = False
+
+
+# Subclass Window
+class MyWindow(pyglet.window.Window):
+ if _have_carbon:
+ @CarbonEventHandler(kEventClassWindow, kEventWindowClickDragRgn)
+ def _on_window_click_drag_rgn(self, next_handler, event, data):
+ print('Clicked drag rgn.')
+ carbon.CallNextEventHandler(next_handler, event)
+ return noErr
+
+ if _have_win32:
+ @Win32EventHandler(WM_DISPLAYCHANGE)
+ def _on_window_display_change(self, msg, lParam, wParam):
+ print('Display resolution changed.')
+ return 0
+
+ if _have_xlib:
+ @XlibEventHandler(xlib.PropertyNotify)
+ def _on_window_property_notify(self, event):
+ print('Property notify.')
+
+if __name__ == '__main__':
+ window = MyWindow()
+ pyglet.app.run()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet.egg-info/PKG-INFO b/pyglet-1.3.0/pyglet-1.3.0/pyglet.egg-info/PKG-INFO
new file mode 100644
index 0000000..9202aaa
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet.egg-info/PKG-INFO
@@ -0,0 +1,30 @@
+Metadata-Version: 1.1
+Name: pyglet
+Version: 1.3.0
+Summary: Cross-platform windowing and multimedia library
+Home-page: http://pyglet.readthedocs.org/en/latest/
+Author: Alex Holkner
+Author-email: Alex.Holkner@gmail.com
+License: BSD
+Download-URL: http://pypi.python.org/pypi/pyglet
+Description: pyglet provides an object-oriented programming
+ interface for developing games and other visually-rich applications
+ for Windows, Mac OS X and Linux.
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: MacOS X
+Classifier: Environment :: Win32 (MS Windows)
+Classifier: Environment :: X11 Applications
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Operating System :: MacOS :: MacOS X
+Classifier: Operating System :: Microsoft :: Windows
+Classifier: Operating System :: POSIX :: Linux
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Topic :: Games/Entertainment
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet.egg-info/SOURCES.txt b/pyglet-1.3.0/pyglet-1.3.0/pyglet.egg-info/SOURCES.txt
new file mode 100644
index 0000000..334313e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet.egg-info/SOURCES.txt
@@ -0,0 +1,917 @@
+LICENSE
+MANIFEST.in
+NOTICE
+README
+RELEASE_NOTES
+setup.cfg
+setup.py
+examples/apple_remote.py
+examples/apple_remote_demo.py
+examples/events.py
+examples/fixed_resolution.py
+examples/font_comparison.py
+examples/graphics.py
+examples/html_label.py
+examples/image_convert.py
+examples/image_display.py
+examples/input.py
+examples/joystick.py
+examples/media_info.py
+examples/media_player.py
+examples/multiple_windows.py
+examples/opengl.py
+examples/opengl_3.py
+examples/pyglet.png
+examples/show_input.py
+examples/synthesizer.py
+examples/tablet.py
+examples/text_input.py
+examples/timer.py
+examples/video.py
+examples/window_platform_event.py
+examples/astraea/README
+examples/astraea/astraea.py
+examples/astraea/setup.py
+examples/astraea/assets/app.icns
+examples/astraea/assets/app.ico
+examples/astraea/assets/ship.svg
+examples/astraea/res/asteroid1.png
+examples/astraea/res/asteroid2.png
+examples/astraea/res/asteroid3.png
+examples/astraea/res/bullet.png
+examples/astraea/res/bullet.wav
+examples/astraea/res/explosion.png
+examples/astraea/res/explosion.wav
+examples/astraea/res/pointer.png
+examples/astraea/res/ship.png
+examples/astraea/res/smoke.png
+examples/astraea/res/starfield.jpg
+examples/game/resources/asteroid.png
+examples/game/resources/bullet.png
+examples/game/resources/bullet.wav
+examples/game/resources/engine_flame.png
+examples/game/resources/player.png
+examples/game/version1/asteroid.py
+examples/game/version1/game/__init__.py
+examples/game/version1/game/load.py
+examples/game/version1/game/resources.py
+examples/game/version2/asteroid.py
+examples/game/version2/game/__init__.py
+examples/game/version2/game/load.py
+examples/game/version2/game/physicalobject.py
+examples/game/version2/game/player.py
+examples/game/version2/game/resources.py
+examples/game/version3/asteroid.py
+examples/game/version3/game/__init__.py
+examples/game/version3/game/load.py
+examples/game/version3/game/physicalobject.py
+examples/game/version3/game/player.py
+examples/game/version3/game/resources.py
+examples/game/version3/game/util.py
+examples/game/version4/asteroid.py
+examples/game/version4/game/__init__.py
+examples/game/version4/game/asteroid.py
+examples/game/version4/game/bullet.py
+examples/game/version4/game/load.py
+examples/game/version4/game/physicalobject.py
+examples/game/version4/game/player.py
+examples/game/version4/game/resources.py
+examples/game/version4/game/util.py
+examples/game/version5/asteroid.py
+examples/game/version5/game/__init__.py
+examples/game/version5/game/asteroid.py
+examples/game/version5/game/bullet.py
+examples/game/version5/game/load.py
+examples/game/version5/game/physicalobject.py
+examples/game/version5/game/player.py
+examples/game/version5/game/resources.py
+examples/game/version5/game/util.py
+examples/noisy/README
+examples/noisy/ball.png
+examples/noisy/ball.wav
+examples/noisy/noisy.py
+examples/programming_guide/animation.py
+examples/programming_guide/dinosaur.gif
+examples/programming_guide/events.py
+examples/programming_guide/hello_world.py
+examples/programming_guide/image_viewer.py
+examples/programming_guide/kitten.jpg
+examples/programming_guide/window_subclass.py
+examples/soundspace/README
+examples/soundspace/reader.py
+examples/soundspace/soundspace.py
+examples/soundspace/res/bass.ogg
+examples/soundspace/res/drums.ogg
+examples/soundspace/res/guitar.ogg
+examples/soundspace/res/piano.ogg
+examples/soundspace/res/space.txt
+pyglet/__init__.py
+pyglet/clock.py
+pyglet/com.py
+pyglet/compat.py
+pyglet/debug.py
+pyglet/event.py
+pyglet/info.py
+pyglet/lib.py
+pyglet/resource.py
+pyglet/sprite.py
+pyglet.egg-info/PKG-INFO
+pyglet.egg-info/SOURCES.txt
+pyglet.egg-info/dependency_links.txt
+pyglet.egg-info/top_level.txt
+pyglet.egg-info/zip-safe
+pyglet/app/__init__.py
+pyglet/app/base.py
+pyglet/app/carbon.py
+pyglet/app/cocoa.py
+pyglet/app/win32.py
+pyglet/app/xlib.py
+pyglet/canvas/__init__.py
+pyglet/canvas/base.py
+pyglet/canvas/carbon.py
+pyglet/canvas/cocoa.py
+pyglet/canvas/win32.py
+pyglet/canvas/xlib.py
+pyglet/canvas/xlib_vidmoderestore.py
+pyglet/extlibs/__init__.py
+pyglet/extlibs/png.py
+pyglet/extlibs/future/__init__.py
+pyglet/extlibs/future/py2/__init__.py
+pyglet/extlibs/future/py2/_dummy_thread/__init__.py
+pyglet/extlibs/future/py2/_markupbase/__init__.py
+pyglet/extlibs/future/py2/_thread/__init__.py
+pyglet/extlibs/future/py2/builtins/__init__.py
+pyglet/extlibs/future/py2/configparser/__init__.py
+pyglet/extlibs/future/py2/copyreg/__init__.py
+pyglet/extlibs/future/py2/html/__init__.py
+pyglet/extlibs/future/py2/html/entities.py
+pyglet/extlibs/future/py2/html/parser.py
+pyglet/extlibs/future/py2/http/__init__.py
+pyglet/extlibs/future/py2/http/client.py
+pyglet/extlibs/future/py2/http/cookiejar.py
+pyglet/extlibs/future/py2/http/cookies.py
+pyglet/extlibs/future/py2/http/server.py
+pyglet/extlibs/future/py2/queue/__init__.py
+pyglet/extlibs/future/py2/reprlib/__init__.py
+pyglet/extlibs/future/py2/socketserver/__init__.py
+pyglet/extlibs/future/py2/tkinter/__init__.py
+pyglet/extlibs/future/py2/tkinter/colorchooser.py
+pyglet/extlibs/future/py2/tkinter/commondialog.py
+pyglet/extlibs/future/py2/tkinter/constants.py
+pyglet/extlibs/future/py2/tkinter/dialog.py
+pyglet/extlibs/future/py2/tkinter/dnd.py
+pyglet/extlibs/future/py2/tkinter/filedialog.py
+pyglet/extlibs/future/py2/tkinter/font.py
+pyglet/extlibs/future/py2/tkinter/messagebox.py
+pyglet/extlibs/future/py2/tkinter/scrolledtext.py
+pyglet/extlibs/future/py2/tkinter/simpledialog.py
+pyglet/extlibs/future/py2/tkinter/tix.py
+pyglet/extlibs/future/py2/winreg/__init__.py
+pyglet/extlibs/future/py2/xmlrpc/__init__.py
+pyglet/extlibs/future/py2/xmlrpc/client.py
+pyglet/extlibs/future/py2/xmlrpc/server.py
+pyglet/extlibs/future/py2_3/__init__.py
+pyglet/extlibs/future/py2_3/future/__init__.py
+pyglet/extlibs/future/py2_3/future/backports/__init__.py
+pyglet/extlibs/future/py2_3/future/backports/_markupbase.py
+pyglet/extlibs/future/py2_3/future/backports/datetime.py
+pyglet/extlibs/future/py2_3/future/backports/misc.py
+pyglet/extlibs/future/py2_3/future/backports/socket.py
+pyglet/extlibs/future/py2_3/future/backports/socketserver.py
+pyglet/extlibs/future/py2_3/future/backports/total_ordering.py
+pyglet/extlibs/future/py2_3/future/backports/email/__init__.py
+pyglet/extlibs/future/py2_3/future/backports/email/_encoded_words.py
+pyglet/extlibs/future/py2_3/future/backports/email/_header_value_parser.py
+pyglet/extlibs/future/py2_3/future/backports/email/_parseaddr.py
+pyglet/extlibs/future/py2_3/future/backports/email/_policybase.py
+pyglet/extlibs/future/py2_3/future/backports/email/base64mime.py
+pyglet/extlibs/future/py2_3/future/backports/email/charset.py
+pyglet/extlibs/future/py2_3/future/backports/email/encoders.py
+pyglet/extlibs/future/py2_3/future/backports/email/errors.py
+pyglet/extlibs/future/py2_3/future/backports/email/feedparser.py
+pyglet/extlibs/future/py2_3/future/backports/email/generator.py
+pyglet/extlibs/future/py2_3/future/backports/email/header.py
+pyglet/extlibs/future/py2_3/future/backports/email/headerregistry.py
+pyglet/extlibs/future/py2_3/future/backports/email/iterators.py
+pyglet/extlibs/future/py2_3/future/backports/email/message.py
+pyglet/extlibs/future/py2_3/future/backports/email/parser.py
+pyglet/extlibs/future/py2_3/future/backports/email/policy.py
+pyglet/extlibs/future/py2_3/future/backports/email/quoprimime.py
+pyglet/extlibs/future/py2_3/future/backports/email/utils.py
+pyglet/extlibs/future/py2_3/future/backports/email/mime/__init__.py
+pyglet/extlibs/future/py2_3/future/backports/email/mime/application.py
+pyglet/extlibs/future/py2_3/future/backports/email/mime/audio.py
+pyglet/extlibs/future/py2_3/future/backports/email/mime/base.py
+pyglet/extlibs/future/py2_3/future/backports/email/mime/image.py
+pyglet/extlibs/future/py2_3/future/backports/email/mime/message.py
+pyglet/extlibs/future/py2_3/future/backports/email/mime/multipart.py
+pyglet/extlibs/future/py2_3/future/backports/email/mime/nonmultipart.py
+pyglet/extlibs/future/py2_3/future/backports/email/mime/text.py
+pyglet/extlibs/future/py2_3/future/backports/html/__init__.py
+pyglet/extlibs/future/py2_3/future/backports/html/entities.py
+pyglet/extlibs/future/py2_3/future/backports/html/parser.py
+pyglet/extlibs/future/py2_3/future/backports/http/__init__.py
+pyglet/extlibs/future/py2_3/future/backports/http/client.py
+pyglet/extlibs/future/py2_3/future/backports/http/cookiejar.py
+pyglet/extlibs/future/py2_3/future/backports/http/cookies.py
+pyglet/extlibs/future/py2_3/future/backports/http/server.py
+pyglet/extlibs/future/py2_3/future/backports/test/__init__.py
+pyglet/extlibs/future/py2_3/future/backports/test/pystone.py
+pyglet/extlibs/future/py2_3/future/backports/test/ssl_servers.py
+pyglet/extlibs/future/py2_3/future/backports/test/support.py
+pyglet/extlibs/future/py2_3/future/backports/urllib/__init__.py
+pyglet/extlibs/future/py2_3/future/backports/urllib/error.py
+pyglet/extlibs/future/py2_3/future/backports/urllib/parse.py
+pyglet/extlibs/future/py2_3/future/backports/urllib/request.py
+pyglet/extlibs/future/py2_3/future/backports/urllib/response.py
+pyglet/extlibs/future/py2_3/future/backports/urllib/robotparser.py
+pyglet/extlibs/future/py2_3/future/backports/xmlrpc/__init__.py
+pyglet/extlibs/future/py2_3/future/backports/xmlrpc/client.py
+pyglet/extlibs/future/py2_3/future/backports/xmlrpc/server.py
+pyglet/extlibs/future/py2_3/future/builtins/__init__.py
+pyglet/extlibs/future/py2_3/future/builtins/disabled.py
+pyglet/extlibs/future/py2_3/future/builtins/iterators.py
+pyglet/extlibs/future/py2_3/future/builtins/misc.py
+pyglet/extlibs/future/py2_3/future/builtins/newnext.py
+pyglet/extlibs/future/py2_3/future/builtins/newround.py
+pyglet/extlibs/future/py2_3/future/builtins/newsuper.py
+pyglet/extlibs/future/py2_3/future/moves/__init__.py
+pyglet/extlibs/future/py2_3/future/moves/_dummy_thread.py
+pyglet/extlibs/future/py2_3/future/moves/_markupbase.py
+pyglet/extlibs/future/py2_3/future/moves/_thread.py
+pyglet/extlibs/future/py2_3/future/moves/builtins.py
+pyglet/extlibs/future/py2_3/future/moves/collections.py
+pyglet/extlibs/future/py2_3/future/moves/configparser.py
+pyglet/extlibs/future/py2_3/future/moves/copyreg.py
+pyglet/extlibs/future/py2_3/future/moves/itertools.py
+pyglet/extlibs/future/py2_3/future/moves/pickle.py
+pyglet/extlibs/future/py2_3/future/moves/queue.py
+pyglet/extlibs/future/py2_3/future/moves/reprlib.py
+pyglet/extlibs/future/py2_3/future/moves/socketserver.py
+pyglet/extlibs/future/py2_3/future/moves/subprocess.py
+pyglet/extlibs/future/py2_3/future/moves/sys.py
+pyglet/extlibs/future/py2_3/future/moves/winreg.py
+pyglet/extlibs/future/py2_3/future/moves/dbm/__init__.py
+pyglet/extlibs/future/py2_3/future/moves/dbm/dumb.py
+pyglet/extlibs/future/py2_3/future/moves/dbm/gnu.py
+pyglet/extlibs/future/py2_3/future/moves/dbm/ndbm.py
+pyglet/extlibs/future/py2_3/future/moves/html/__init__.py
+pyglet/extlibs/future/py2_3/future/moves/html/entities.py
+pyglet/extlibs/future/py2_3/future/moves/html/parser.py
+pyglet/extlibs/future/py2_3/future/moves/http/__init__.py
+pyglet/extlibs/future/py2_3/future/moves/http/client.py
+pyglet/extlibs/future/py2_3/future/moves/http/cookiejar.py
+pyglet/extlibs/future/py2_3/future/moves/http/cookies.py
+pyglet/extlibs/future/py2_3/future/moves/http/server.py
+pyglet/extlibs/future/py2_3/future/moves/test/__init__.py
+pyglet/extlibs/future/py2_3/future/moves/test/support.py
+pyglet/extlibs/future/py2_3/future/moves/tkinter/__init__.py
+pyglet/extlibs/future/py2_3/future/moves/tkinter/colorchooser.py
+pyglet/extlibs/future/py2_3/future/moves/tkinter/commondialog.py
+pyglet/extlibs/future/py2_3/future/moves/tkinter/constants.py
+pyglet/extlibs/future/py2_3/future/moves/tkinter/dialog.py
+pyglet/extlibs/future/py2_3/future/moves/tkinter/dnd.py
+pyglet/extlibs/future/py2_3/future/moves/tkinter/filedialog.py
+pyglet/extlibs/future/py2_3/future/moves/tkinter/font.py
+pyglet/extlibs/future/py2_3/future/moves/tkinter/messagebox.py
+pyglet/extlibs/future/py2_3/future/moves/tkinter/scrolledtext.py
+pyglet/extlibs/future/py2_3/future/moves/tkinter/simpledialog.py
+pyglet/extlibs/future/py2_3/future/moves/tkinter/tix.py
+pyglet/extlibs/future/py2_3/future/moves/urllib/__init__.py
+pyglet/extlibs/future/py2_3/future/moves/urllib/error.py
+pyglet/extlibs/future/py2_3/future/moves/urllib/parse.py
+pyglet/extlibs/future/py2_3/future/moves/urllib/request.py
+pyglet/extlibs/future/py2_3/future/moves/urllib/response.py
+pyglet/extlibs/future/py2_3/future/moves/urllib/robotparser.py
+pyglet/extlibs/future/py2_3/future/moves/xmlrpc/__init__.py
+pyglet/extlibs/future/py2_3/future/moves/xmlrpc/client.py
+pyglet/extlibs/future/py2_3/future/moves/xmlrpc/server.py
+pyglet/extlibs/future/py2_3/future/standard_library/__init__.py
+pyglet/extlibs/future/py2_3/future/tests/__init__.py
+pyglet/extlibs/future/py2_3/future/tests/base.py
+pyglet/extlibs/future/py2_3/future/types/__init__.py
+pyglet/extlibs/future/py2_3/future/types/newbytes.py
+pyglet/extlibs/future/py2_3/future/types/newdict.py
+pyglet/extlibs/future/py2_3/future/types/newint.py
+pyglet/extlibs/future/py2_3/future/types/newlist.py
+pyglet/extlibs/future/py2_3/future/types/newmemoryview.py
+pyglet/extlibs/future/py2_3/future/types/newobject.py
+pyglet/extlibs/future/py2_3/future/types/newopen.py
+pyglet/extlibs/future/py2_3/future/types/newrange.py
+pyglet/extlibs/future/py2_3/future/types/newstr.py
+pyglet/extlibs/future/py2_3/future/utils/__init__.py
+pyglet/extlibs/future/py2_3/future/utils/surrogateescape.py
+pyglet/extlibs/future/py2_3/libfuturize/__init__.py
+pyglet/extlibs/future/py2_3/libfuturize/fixer_util.py
+pyglet/extlibs/future/py2_3/libfuturize/main.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/__init__.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_UserDict.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_absolute_import.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_add__future__imports_except_unicode_literals.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_bytes.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_cmp.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_division.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_division_safe.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_execfile.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_future_builtins.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_future_standard_library.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_future_standard_library_urllib.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_metaclass.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_next_call.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_object.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_oldstr_wrap.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_order___future__imports.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_print.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_print_with_import.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_raise.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_remove_old__future__imports.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_unicode_keep_u.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_unicode_literals_import.py
+pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_xrange_with_import.py
+pyglet/extlibs/future/py2_3/libpasteurize/__init__.py
+pyglet/extlibs/future/py2_3/libpasteurize/main.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/__init__.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/feature_base.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_add_all__future__imports.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_add_all_future_builtins.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_add_future_standard_library_import.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_annotations.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_division.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_features.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_fullargspec.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_future_builtins.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_getcwd.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_imports.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_imports2.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_kwargs.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_memoryview.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_metaclass.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_newstyle.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_next.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_printfunction.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_raise.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_raise_.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_throw.py
+pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_unpacking.py
+pyglet/extlibs/future/py2_3/past/__init__.py
+pyglet/extlibs/future/py2_3/past/builtins/__init__.py
+pyglet/extlibs/future/py2_3/past/builtins/misc.py
+pyglet/extlibs/future/py2_3/past/builtins/noniterators.py
+pyglet/extlibs/future/py2_3/past/tests/__init__.py
+pyglet/extlibs/future/py2_3/past/translation/__init__.py
+pyglet/extlibs/future/py2_3/past/types/__init__.py
+pyglet/extlibs/future/py2_3/past/types/basestring.py
+pyglet/extlibs/future/py2_3/past/types/olddict.py
+pyglet/extlibs/future/py2_3/past/types/oldstr.py
+pyglet/extlibs/future/py2_3/past/utils/__init__.py
+pyglet/font/__init__.py
+pyglet/font/base.py
+pyglet/font/carbon.py
+pyglet/font/fontconfig.py
+pyglet/font/freetype.py
+pyglet/font/freetype_lib.py
+pyglet/font/quartz.py
+pyglet/font/text.py
+pyglet/font/ttf.py
+pyglet/font/win32.py
+pyglet/font/win32query.py
+pyglet/gl/__init__.py
+pyglet/gl/agl.py
+pyglet/gl/base.py
+pyglet/gl/carbon.py
+pyglet/gl/cocoa.py
+pyglet/gl/gl.py
+pyglet/gl/gl_info.py
+pyglet/gl/glext_arb.py
+pyglet/gl/glext_nv.py
+pyglet/gl/glu.py
+pyglet/gl/glu_info.py
+pyglet/gl/glx.py
+pyglet/gl/glx_info.py
+pyglet/gl/glxext_arb.py
+pyglet/gl/glxext_mesa.py
+pyglet/gl/glxext_nv.py
+pyglet/gl/lib.py
+pyglet/gl/lib_agl.py
+pyglet/gl/lib_glx.py
+pyglet/gl/lib_wgl.py
+pyglet/gl/wgl.py
+pyglet/gl/wgl_info.py
+pyglet/gl/wglext_arb.py
+pyglet/gl/wglext_nv.py
+pyglet/gl/win32.py
+pyglet/gl/xlib.py
+pyglet/graphics/__init__.py
+pyglet/graphics/allocation.py
+pyglet/graphics/vertexattribute.py
+pyglet/graphics/vertexbuffer.py
+pyglet/graphics/vertexdomain.py
+pyglet/image/__init__.py
+pyglet/image/atlas.py
+pyglet/image/codecs/__init__.py
+pyglet/image/codecs/bmp.py
+pyglet/image/codecs/dds.py
+pyglet/image/codecs/gdiplus.py
+pyglet/image/codecs/gdkpixbuf2.py
+pyglet/image/codecs/gif.py
+pyglet/image/codecs/pil.py
+pyglet/image/codecs/png.py
+pyglet/image/codecs/quartz.py
+pyglet/image/codecs/quicktime.py
+pyglet/image/codecs/s3tc.py
+pyglet/input/__init__.py
+pyglet/input/base.py
+pyglet/input/carbon_hid.py
+pyglet/input/carbon_tablet.py
+pyglet/input/darwin_hid.py
+pyglet/input/directinput.py
+pyglet/input/evdev.py
+pyglet/input/evdev_constants.py
+pyglet/input/wintab.py
+pyglet/input/x11_xinput.py
+pyglet/input/x11_xinput_tablet.py
+pyglet/libs/__init__.py
+pyglet/libs/darwin/__init__.py
+pyglet/libs/darwin/constants.py
+pyglet/libs/darwin/quartzkey.py
+pyglet/libs/darwin/types.py
+pyglet/libs/darwin/cocoapy/__init__.py
+pyglet/libs/darwin/cocoapy/cocoalibs.py
+pyglet/libs/darwin/cocoapy/cocoatypes.py
+pyglet/libs/darwin/cocoapy/runtime.py
+pyglet/libs/win32/__init__.py
+pyglet/libs/win32/constants.py
+pyglet/libs/win32/dinput.py
+pyglet/libs/win32/libwintab.py
+pyglet/libs/win32/types.py
+pyglet/libs/win32/winkey.py
+pyglet/libs/x11/__init__.py
+pyglet/libs/x11/cursorfont.py
+pyglet/libs/x11/xf86vmode.py
+pyglet/libs/x11/xinerama.py
+pyglet/libs/x11/xinput.py
+pyglet/libs/x11/xlib.py
+pyglet/libs/x11/xsync.py
+pyglet/media/__init__.py
+pyglet/media/events.py
+pyglet/media/exceptions.py
+pyglet/media/listener.py
+pyglet/media/player.py
+pyglet/media/threads.py
+pyglet/media/drivers/__init__.py
+pyglet/media/drivers/base.py
+pyglet/media/drivers/silent.py
+pyglet/media/drivers/directsound/__init__.py
+pyglet/media/drivers/directsound/adaptation.py
+pyglet/media/drivers/directsound/exceptions.py
+pyglet/media/drivers/directsound/interface.py
+pyglet/media/drivers/directsound/lib_dsound.py
+pyglet/media/drivers/openal/__init__.py
+pyglet/media/drivers/openal/adaptation.py
+pyglet/media/drivers/openal/interface.py
+pyglet/media/drivers/openal/lib_alc.py
+pyglet/media/drivers/openal/lib_openal.py
+pyglet/media/drivers/pulse/__init__.py
+pyglet/media/drivers/pulse/adaptation.py
+pyglet/media/drivers/pulse/interface.py
+pyglet/media/drivers/pulse/lib_pulseaudio.py
+pyglet/media/sources/__init__.py
+pyglet/media/sources/avbin.py
+pyglet/media/sources/base.py
+pyglet/media/sources/loader.py
+pyglet/media/sources/procedural.py
+pyglet/media/sources/riff.py
+pyglet/text/__init__.py
+pyglet/text/caret.py
+pyglet/text/document.py
+pyglet/text/layout.py
+pyglet/text/runlist.py
+pyglet/text/formats/__init__.py
+pyglet/text/formats/attributed.py
+pyglet/text/formats/html.py
+pyglet/text/formats/plaintext.py
+pyglet/text/formats/structured.py
+pyglet/window/__init__.py
+pyglet/window/event.py
+pyglet/window/key.py
+pyglet/window/mouse.py
+pyglet/window/carbon/__init__.py
+pyglet/window/cocoa/__init__.py
+pyglet/window/cocoa/pyglet_delegate.py
+pyglet/window/cocoa/pyglet_textview.py
+pyglet/window/cocoa/pyglet_view.py
+pyglet/window/cocoa/pyglet_window.py
+pyglet/window/cocoa/systemcursor.py
+pyglet/window/win32/__init__.py
+pyglet/window/xlib/__init__.py
+tests/__init__.py
+tests/annotations.py
+tests/conftest.py
+tests/run.py
+tests/base/__init__.py
+tests/base/data.py
+tests/base/event_loop.py
+tests/base/future_test.py
+tests/base/interactive.py
+tests/base/performance.py
+tests/base/test_interactive_test_base.py
+tests/data/fonts/README
+tests/data/fonts/action_man.ttf
+tests/data/fonts/action_man_bold.ttf
+tests/data/fonts/action_man_bold_italic.ttf
+tests/data/fonts/action_man_italic.ttf
+tests/data/fonts/courR12-ISO8859-1.pcf
+tests/data/images/8bpp.gif
+tests/data/images/cursor.png
+tests/data/images/dinosaur.gif
+tests/data/images/gdk_close.png
+tests/data/images/grey_background.png
+tests/data/images/icon1.png
+tests/data/images/icon_size1.png
+tests/data/images/icon_size2.png
+tests/data/images/icon_size3.png
+tests/data/images/icon_size4.png
+tests/data/images/icon_size5.png
+tests/data/images/l.png
+tests/data/images/la.png
+tests/data/images/multitexture.png
+tests/data/images/rgb.png
+tests/data/images/rgb_16bpp.bmp
+tests/data/images/rgb_1bpp.bmp
+tests/data/images/rgb_24bpp.bmp
+tests/data/images/rgb_32bpp.bmp
+tests/data/images/rgb_4bpp.bmp
+tests/data/images/rgb_8bpp.bmp
+tests/data/images/rgb_8bpp.png
+tests/data/images/rgb_8bpp_trans.png
+tests/data/images/rgb_dxt1.dds
+tests/data/images/rgba.png
+tests/data/images/rgba_32bpp.bmp
+tests/data/images/rgba_dxt1.dds
+tests/data/images/rgba_dxt3.dds
+tests/data/images/rgba_dxt5.dds
+tests/data/images/tests.interactive.test_interactive_test_base._Test.test_1.001.png
+tests/data/media/README
+tests/data/media/alert.wav
+tests/data/media/alert_pcm_16_11025_1ch.wav
+tests/data/media/alert_pcm_16_22050_1ch.wav
+tests/data/media/alert_pcm_8_22050_1ch.wav
+tests/data/media/login.wav
+tests/data/media/logout.wav
+tests/data/media/procedural_digitar_16_11025_1ch.wav
+tests/data/media/procedural_digitar_16_44800_1ch.wav
+tests/data/media/procedural_digitar_8_44800_1ch.wav
+tests/data/media/procedural_fm_16_11025_1ch.wav
+tests/data/media/procedural_fm_16_44800_1ch.wav
+tests/data/media/procedural_fm_8_44800_1ch.wav
+tests/data/media/procedural_sawtooth_16_11025_1ch.wav
+tests/data/media/procedural_sawtooth_16_44800_1ch.wav
+tests/data/media/procedural_sawtooth_8_44800_1ch.wav
+tests/data/media/procedural_silence_16_11025_1ch.wav
+tests/data/media/procedural_silence_16_44800_1ch.wav
+tests/data/media/procedural_silence_8_44800_1ch.wav
+tests/data/media/procedural_sine_16_11025_1ch.wav
+tests/data/media/procedural_sine_16_44800_1ch.wav
+tests/data/media/procedural_sine_8_44800_1ch.wav
+tests/data/media/procedural_square_16_11025_1ch.wav
+tests/data/media/procedural_square_16_44800_1ch.wav
+tests/data/media/procedural_square_8_44800_1ch.wav
+tests/data/media/procedural_triangle_16_11025_1ch.wav
+tests/data/media/procedural_triangle_16_44800_1ch.wav
+tests/data/media/procedural_triangle_8_44800_1ch.wav
+tests/data/media/receive.wav
+tests/data/media/send.wav
+tests/extlibs/__init__.py
+tests/extlibs/mock.py
+tests/extlibs/future/py2/_dummy_thread/__init__.py
+tests/extlibs/future/py2/_markupbase/__init__.py
+tests/extlibs/future/py2/_thread/__init__.py
+tests/extlibs/future/py2/builtins/__init__.py
+tests/extlibs/future/py2/configparser/__init__.py
+tests/extlibs/future/py2/copyreg/__init__.py
+tests/extlibs/future/py2/html/__init__.py
+tests/extlibs/future/py2/html/entities.py
+tests/extlibs/future/py2/html/parser.py
+tests/extlibs/future/py2/http/__init__.py
+tests/extlibs/future/py2/http/client.py
+tests/extlibs/future/py2/http/cookiejar.py
+tests/extlibs/future/py2/http/cookies.py
+tests/extlibs/future/py2/http/server.py
+tests/extlibs/future/py2/queue/__init__.py
+tests/extlibs/future/py2/reprlib/__init__.py
+tests/extlibs/future/py2/socketserver/__init__.py
+tests/extlibs/future/py2/tkinter/__init__.py
+tests/extlibs/future/py2/tkinter/colorchooser.py
+tests/extlibs/future/py2/tkinter/commondialog.py
+tests/extlibs/future/py2/tkinter/constants.py
+tests/extlibs/future/py2/tkinter/dialog.py
+tests/extlibs/future/py2/tkinter/dnd.py
+tests/extlibs/future/py2/tkinter/filedialog.py
+tests/extlibs/future/py2/tkinter/font.py
+tests/extlibs/future/py2/tkinter/messagebox.py
+tests/extlibs/future/py2/tkinter/scrolledtext.py
+tests/extlibs/future/py2/tkinter/simpledialog.py
+tests/extlibs/future/py2/tkinter/tix.py
+tests/extlibs/future/py2/winreg/__init__.py
+tests/extlibs/future/py2/xmlrpc/__init__.py
+tests/extlibs/future/py2/xmlrpc/client.py
+tests/extlibs/future/py2/xmlrpc/server.py
+tests/extlibs/future/py2_3/future/__init__.py
+tests/extlibs/future/py2_3/future/backports/__init__.py
+tests/extlibs/future/py2_3/future/backports/_markupbase.py
+tests/extlibs/future/py2_3/future/backports/datetime.py
+tests/extlibs/future/py2_3/future/backports/misc.py
+tests/extlibs/future/py2_3/future/backports/socket.py
+tests/extlibs/future/py2_3/future/backports/socketserver.py
+tests/extlibs/future/py2_3/future/backports/total_ordering.py
+tests/extlibs/future/py2_3/future/backports/email/__init__.py
+tests/extlibs/future/py2_3/future/backports/email/_encoded_words.py
+tests/extlibs/future/py2_3/future/backports/email/_header_value_parser.py
+tests/extlibs/future/py2_3/future/backports/email/_parseaddr.py
+tests/extlibs/future/py2_3/future/backports/email/_policybase.py
+tests/extlibs/future/py2_3/future/backports/email/base64mime.py
+tests/extlibs/future/py2_3/future/backports/email/charset.py
+tests/extlibs/future/py2_3/future/backports/email/encoders.py
+tests/extlibs/future/py2_3/future/backports/email/errors.py
+tests/extlibs/future/py2_3/future/backports/email/feedparser.py
+tests/extlibs/future/py2_3/future/backports/email/generator.py
+tests/extlibs/future/py2_3/future/backports/email/header.py
+tests/extlibs/future/py2_3/future/backports/email/headerregistry.py
+tests/extlibs/future/py2_3/future/backports/email/iterators.py
+tests/extlibs/future/py2_3/future/backports/email/message.py
+tests/extlibs/future/py2_3/future/backports/email/parser.py
+tests/extlibs/future/py2_3/future/backports/email/policy.py
+tests/extlibs/future/py2_3/future/backports/email/quoprimime.py
+tests/extlibs/future/py2_3/future/backports/email/utils.py
+tests/extlibs/future/py2_3/future/backports/email/mime/__init__.py
+tests/extlibs/future/py2_3/future/backports/email/mime/application.py
+tests/extlibs/future/py2_3/future/backports/email/mime/audio.py
+tests/extlibs/future/py2_3/future/backports/email/mime/base.py
+tests/extlibs/future/py2_3/future/backports/email/mime/image.py
+tests/extlibs/future/py2_3/future/backports/email/mime/message.py
+tests/extlibs/future/py2_3/future/backports/email/mime/multipart.py
+tests/extlibs/future/py2_3/future/backports/email/mime/nonmultipart.py
+tests/extlibs/future/py2_3/future/backports/email/mime/text.py
+tests/extlibs/future/py2_3/future/backports/html/__init__.py
+tests/extlibs/future/py2_3/future/backports/html/entities.py
+tests/extlibs/future/py2_3/future/backports/html/parser.py
+tests/extlibs/future/py2_3/future/backports/http/__init__.py
+tests/extlibs/future/py2_3/future/backports/http/client.py
+tests/extlibs/future/py2_3/future/backports/http/cookiejar.py
+tests/extlibs/future/py2_3/future/backports/http/cookies.py
+tests/extlibs/future/py2_3/future/backports/http/server.py
+tests/extlibs/future/py2_3/future/backports/test/__init__.py
+tests/extlibs/future/py2_3/future/backports/test/badcert.pem
+tests/extlibs/future/py2_3/future/backports/test/badkey.pem
+tests/extlibs/future/py2_3/future/backports/test/dh512.pem
+tests/extlibs/future/py2_3/future/backports/test/https_svn_python_org_root.pem
+tests/extlibs/future/py2_3/future/backports/test/keycert.passwd.pem
+tests/extlibs/future/py2_3/future/backports/test/keycert.pem
+tests/extlibs/future/py2_3/future/backports/test/keycert2.pem
+tests/extlibs/future/py2_3/future/backports/test/nokia.pem
+tests/extlibs/future/py2_3/future/backports/test/nullbytecert.pem
+tests/extlibs/future/py2_3/future/backports/test/nullcert.pem
+tests/extlibs/future/py2_3/future/backports/test/pystone.py
+tests/extlibs/future/py2_3/future/backports/test/sha256.pem
+tests/extlibs/future/py2_3/future/backports/test/ssl_cert.pem
+tests/extlibs/future/py2_3/future/backports/test/ssl_key.passwd.pem
+tests/extlibs/future/py2_3/future/backports/test/ssl_key.pem
+tests/extlibs/future/py2_3/future/backports/test/ssl_servers.py
+tests/extlibs/future/py2_3/future/backports/test/support.py
+tests/extlibs/future/py2_3/future/backports/urllib/__init__.py
+tests/extlibs/future/py2_3/future/backports/urllib/error.py
+tests/extlibs/future/py2_3/future/backports/urllib/parse.py
+tests/extlibs/future/py2_3/future/backports/urllib/request.py
+tests/extlibs/future/py2_3/future/backports/urllib/response.py
+tests/extlibs/future/py2_3/future/backports/urllib/robotparser.py
+tests/extlibs/future/py2_3/future/backports/xmlrpc/__init__.py
+tests/extlibs/future/py2_3/future/backports/xmlrpc/client.py
+tests/extlibs/future/py2_3/future/backports/xmlrpc/server.py
+tests/extlibs/future/py2_3/future/builtins/__init__.py
+tests/extlibs/future/py2_3/future/builtins/disabled.py
+tests/extlibs/future/py2_3/future/builtins/iterators.py
+tests/extlibs/future/py2_3/future/builtins/misc.py
+tests/extlibs/future/py2_3/future/builtins/newnext.py
+tests/extlibs/future/py2_3/future/builtins/newround.py
+tests/extlibs/future/py2_3/future/builtins/newsuper.py
+tests/extlibs/future/py2_3/future/moves/__init__.py
+tests/extlibs/future/py2_3/future/moves/_dummy_thread.py
+tests/extlibs/future/py2_3/future/moves/_markupbase.py
+tests/extlibs/future/py2_3/future/moves/_thread.py
+tests/extlibs/future/py2_3/future/moves/builtins.py
+tests/extlibs/future/py2_3/future/moves/collections.py
+tests/extlibs/future/py2_3/future/moves/configparser.py
+tests/extlibs/future/py2_3/future/moves/copyreg.py
+tests/extlibs/future/py2_3/future/moves/itertools.py
+tests/extlibs/future/py2_3/future/moves/pickle.py
+tests/extlibs/future/py2_3/future/moves/queue.py
+tests/extlibs/future/py2_3/future/moves/reprlib.py
+tests/extlibs/future/py2_3/future/moves/socketserver.py
+tests/extlibs/future/py2_3/future/moves/subprocess.py
+tests/extlibs/future/py2_3/future/moves/sys.py
+tests/extlibs/future/py2_3/future/moves/winreg.py
+tests/extlibs/future/py2_3/future/moves/dbm/__init__.py
+tests/extlibs/future/py2_3/future/moves/dbm/dumb.py
+tests/extlibs/future/py2_3/future/moves/dbm/gnu.py
+tests/extlibs/future/py2_3/future/moves/dbm/ndbm.py
+tests/extlibs/future/py2_3/future/moves/html/__init__.py
+tests/extlibs/future/py2_3/future/moves/html/entities.py
+tests/extlibs/future/py2_3/future/moves/html/parser.py
+tests/extlibs/future/py2_3/future/moves/http/__init__.py
+tests/extlibs/future/py2_3/future/moves/http/client.py
+tests/extlibs/future/py2_3/future/moves/http/cookiejar.py
+tests/extlibs/future/py2_3/future/moves/http/cookies.py
+tests/extlibs/future/py2_3/future/moves/http/server.py
+tests/extlibs/future/py2_3/future/moves/test/__init__.py
+tests/extlibs/future/py2_3/future/moves/test/support.py
+tests/extlibs/future/py2_3/future/moves/tkinter/__init__.py
+tests/extlibs/future/py2_3/future/moves/tkinter/colorchooser.py
+tests/extlibs/future/py2_3/future/moves/tkinter/commondialog.py
+tests/extlibs/future/py2_3/future/moves/tkinter/constants.py
+tests/extlibs/future/py2_3/future/moves/tkinter/dialog.py
+tests/extlibs/future/py2_3/future/moves/tkinter/dnd.py
+tests/extlibs/future/py2_3/future/moves/tkinter/filedialog.py
+tests/extlibs/future/py2_3/future/moves/tkinter/font.py
+tests/extlibs/future/py2_3/future/moves/tkinter/messagebox.py
+tests/extlibs/future/py2_3/future/moves/tkinter/scrolledtext.py
+tests/extlibs/future/py2_3/future/moves/tkinter/simpledialog.py
+tests/extlibs/future/py2_3/future/moves/tkinter/tix.py
+tests/extlibs/future/py2_3/future/moves/urllib/__init__.py
+tests/extlibs/future/py2_3/future/moves/urllib/error.py
+tests/extlibs/future/py2_3/future/moves/urllib/parse.py
+tests/extlibs/future/py2_3/future/moves/urllib/request.py
+tests/extlibs/future/py2_3/future/moves/urllib/response.py
+tests/extlibs/future/py2_3/future/moves/urllib/robotparser.py
+tests/extlibs/future/py2_3/future/moves/xmlrpc/__init__.py
+tests/extlibs/future/py2_3/future/moves/xmlrpc/client.py
+tests/extlibs/future/py2_3/future/moves/xmlrpc/server.py
+tests/extlibs/future/py2_3/future/standard_library/__init__.py
+tests/extlibs/future/py2_3/future/tests/__init__.py
+tests/extlibs/future/py2_3/future/tests/base.py
+tests/extlibs/future/py2_3/future/types/__init__.py
+tests/extlibs/future/py2_3/future/types/newbytes.py
+tests/extlibs/future/py2_3/future/types/newdict.py
+tests/extlibs/future/py2_3/future/types/newint.py
+tests/extlibs/future/py2_3/future/types/newlist.py
+tests/extlibs/future/py2_3/future/types/newmemoryview.py
+tests/extlibs/future/py2_3/future/types/newobject.py
+tests/extlibs/future/py2_3/future/types/newopen.py
+tests/extlibs/future/py2_3/future/types/newrange.py
+tests/extlibs/future/py2_3/future/types/newstr.py
+tests/extlibs/future/py2_3/future/utils/__init__.py
+tests/extlibs/future/py2_3/future/utils/surrogateescape.py
+tests/extlibs/future/py2_3/libfuturize/__init__.py
+tests/extlibs/future/py2_3/libfuturize/fixer_util.py
+tests/extlibs/future/py2_3/libfuturize/main.py
+tests/extlibs/future/py2_3/libfuturize/fixes/__init__.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_UserDict.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_absolute_import.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_add__future__imports_except_unicode_literals.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_bytes.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_cmp.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_division.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_division_safe.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_execfile.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_future_builtins.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_future_standard_library.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_future_standard_library_urllib.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_metaclass.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_next_call.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_object.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_oldstr_wrap.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_order___future__imports.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_print.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_print_with_import.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_raise.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_remove_old__future__imports.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_unicode_keep_u.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_unicode_literals_import.py
+tests/extlibs/future/py2_3/libfuturize/fixes/fix_xrange_with_import.py
+tests/extlibs/future/py2_3/libpasteurize/__init__.py
+tests/extlibs/future/py2_3/libpasteurize/main.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/__init__.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/feature_base.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_add_all__future__imports.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_add_all_future_builtins.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_add_future_standard_library_import.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_annotations.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_division.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_features.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_fullargspec.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_future_builtins.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_getcwd.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_imports.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_imports2.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_kwargs.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_memoryview.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_metaclass.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_newstyle.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_next.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_printfunction.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_raise.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_raise_.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_throw.py
+tests/extlibs/future/py2_3/libpasteurize/fixes/fix_unpacking.py
+tests/extlibs/future/py2_3/past/__init__.py
+tests/extlibs/future/py2_3/past/builtins/__init__.py
+tests/extlibs/future/py2_3/past/builtins/misc.py
+tests/extlibs/future/py2_3/past/builtins/noniterators.py
+tests/extlibs/future/py2_3/past/tests/__init__.py
+tests/extlibs/future/py2_3/past/translation/__init__.py
+tests/extlibs/future/py2_3/past/types/__init__.py
+tests/extlibs/future/py2_3/past/types/basestring.py
+tests/extlibs/future/py2_3/past/types/olddict.py
+tests/extlibs/future/py2_3/past/types/oldstr.py
+tests/extlibs/future/py2_3/past/utils/__init__.py
+tests/integration/__init__.py
+tests/integration/test_toplevel_imports.py
+tests/integration/app/__init__.py
+tests/integration/app/test_eventloop.py
+tests/integration/font/test_fontconfig.py
+tests/integration/font/test_freetype_face.py
+tests/integration/graphics/__init__.py
+tests/integration/graphics/graphics_common.py
+tests/integration/graphics/test_allocation.py
+tests/integration/graphics/test_immediate_drawing.py
+tests/integration/graphics/test_immediate_drawing_indexed_data.py
+tests/integration/graphics/test_multitexture.py
+tests/integration/graphics/test_retained_drawing.py
+tests/integration/graphics/test_retained_drawing_indexed_data.py
+tests/integration/image/__init__.py
+tests/integration/image/test_gdkpixbuf2.py
+tests/integration/image/test_imagegrid.py
+tests/integration/image/test_texture3d.py
+tests/integration/image/texture_compat.py
+tests/integration/media/__init__.py
+tests/integration/media/test_directsound.py
+tests/integration/media/test_driver.py
+tests/integration/media/test_openal.py
+tests/integration/media/test_player.py
+tests/integration/media/test_pulse.py
+tests/integration/media/test_threads.py
+tests/integration/platform/__init__.py
+tests/integration/platform/test_linux_fontconfig.py
+tests/integration/platform/test_win_multicore_clock.py
+tests/integration/resource/__init__.py
+tests/integration/resource/file.txt
+tests/integration/resource/rgbm.png
+tests/integration/resource/test_resource_image_loading.py
+tests/integration/resource/test_resource_loading.py
+tests/integration/resource/dir1/file.txt
+tests/integration/resource/dir1/res.zip
+tests/integration/resource/dir1/dir1/file.txt
+tests/integration/resource/dir2/file.txt
+tests/integration/text/__init__.py
+tests/integration/text/test_empty_document.py
+tests/integration/window/__init__.py
+tests/integration/window/test_context_share.py
+tests/integration/window/test_event_sequence.py
+tests/integration/window/test_window_caption.py
+tests/interactive/__init__.py
+tests/interactive/conftest.py
+tests/interactive/windowed_test_base.py
+tests/interactive/font/__init__.py
+tests/interactive/font/font_test_base.py
+tests/interactive/font/test_font.py
+tests/interactive/font/test_text_label.py
+tests/interactive/graphics/__init__.py
+tests/interactive/graphics/test_multitexture.py
+tests/interactive/image/__init__.py
+tests/interactive/image/test_image.py
+tests/interactive/media/__init__.py
+tests/interactive/media/test_player.py
+tests/interactive/screenshots/committed/README
+tests/interactive/screenshots/session/README
+tests/interactive/text/__init__.py
+tests/interactive/text/test_content_valign.py
+tests/interactive/text/test_html.py
+tests/interactive/text/test_inline_elements.py
+tests/interactive/text/test_inline_elements_style_change.py
+tests/interactive/text/test_multiline_wrap.py
+tests/interactive/text/test_plain.py
+tests/interactive/text/test_style.py
+tests/interactive/window/__init__.py
+tests/interactive/window/test_window_events.py
+tests/interactive/window/test_window_fullscreen.py
+tests/interactive/window/test_window_modes.py
+tests/interactive/window/test_window_multisample.py
+tests/interactive/window/test_window_open.py
+tests/interactive/window/test_window_settings.py
+tests/interactive/window/test_window_styles.py
+tests/interactive/window/window_util.py
+tests/unit/__init__.py
+tests/unit/test_atlas.py
+tests/unit/test_clock.py
+tests/unit/test_clock_fps.py
+tests/unit/test_events.py
+tests/unit/test_font.py
+tests/unit/test_osx.py
+tests/unit/test_resource_path.py
+tests/unit/test_text.py
+tests/unit/media/__init__.py
+tests/unit/media/test_player.py
+tests/unit/media/test_procedural.py
+tests/unit/media/test_riff.py
+tests/unit/media/test_silent_player.py
+tests/unit/media/test_sources.py
+tools/inspect_font.py
\ No newline at end of file
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet.egg-info/dependency_links.txt b/pyglet-1.3.0/pyglet-1.3.0/pyglet.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet.egg-info/top_level.txt b/pyglet-1.3.0/pyglet-1.3.0/pyglet.egg-info/top_level.txt
new file mode 100644
index 0000000..fdadde2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet.egg-info/top_level.txt
@@ -0,0 +1 @@
+pyglet
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet.egg-info/zip-safe b/pyglet-1.3.0/pyglet-1.3.0/pyglet.egg-info/zip-safe
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet.egg-info/zip-safe
@@ -0,0 +1 @@
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/__init__.py
new file mode 100644
index 0000000..c580d09
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/__init__.py
@@ -0,0 +1,444 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+"""pyglet is a cross-platform games and multimedia package.
+
+Detailed documentation is available at http://www.pyglet.org
+"""
+from __future__ import print_function
+from __future__ import absolute_import
+
+# Check if future is installed, if not use included batteries
+try:
+ import future
+except ImportError:
+ import os.path as op
+ import sys
+ future_base = op.abspath(op.join(op.dirname(__file__), 'extlibs', 'future'))
+ sys.path.insert(0, op.join(future_base, 'py2_3'))
+ if sys.version_info[:2] < (3, 0):
+ sys.path.insert(0, op.join(future_base, 'py2'))
+ del future_base
+ del sys
+ del op
+ try:
+ import future
+ except ImportError:
+ print('Failed to get python-future')
+ raise
+
+from builtins import range
+from builtins import object
+
+import os
+import sys
+import warnings
+
+if 'sphinx' in sys.modules:
+ setattr(sys, 'is_epydoc', True)
+_is_epydoc = hasattr(sys, 'is_epydoc') and sys.is_epydoc
+
+#: The release version of this pyglet installation.
+#:
+#: Valid only if pyglet was installed from a source or binary distribution
+#: (i.e. not in a checked-out copy from SVN).
+#:
+#: Use setuptools if you need to check for a specific release version, e.g.::
+#:
+#: >>> import pyglet
+#: >>> from pkg_resources import parse_version
+#: >>> parse_version(pyglet.version) >= parse_version('1.1')
+#: True
+#:
+version = '1.3.0'
+
+# Pyglet platform treats *BSD systems as Linux
+compat_platform = sys.platform
+if "bsd" in compat_platform:
+ compat_platform = "linux-compat"
+
+_enable_optimisations = not __debug__
+if getattr(sys, 'frozen', None):
+ _enable_optimisations = True
+
+#: Global dict of pyglet options. To change an option from its default, you
+#: must import ``pyglet`` before any sub-packages. For example::
+#:
+#: import pyglet
+#: pyglet.options['debug_gl'] = False
+#:
+#: The default options can be overridden from the OS environment. The
+#: corresponding environment variable for each option key is prefaced by
+#: ``PYGLET_``. For example, in Bash you can set the ``debug_gl`` option with::
+#:
+#: PYGLET_DEBUG_GL=True; export PYGLET_DEBUG_GL
+#:
+#: For options requiring a tuple of values, separate each value with a comma.
+#:
+#: The non-development options are:
+#:
+#: audio
+#: A sequence of the names of audio modules to attempt to load, in
+#: order of preference. Valid driver names are:
+#:
+#: * directsound, the Windows DirectSound audio module (Windows only)
+#: * pulse, the PulseAudio module (Linux only)
+#: * openal, the OpenAL audio module
+#: * silent, no audio
+#: debug_lib
+#: If True, prints the path of each dynamic library loaded.
+#: debug_gl
+#: If True, all calls to OpenGL functions are checked afterwards for
+#: errors using ``glGetError``. This will severely impact performance,
+#: but provides useful exceptions at the point of failure. By default,
+#: this option is enabled if ``__debug__`` is (i.e., if Python was not run
+#: with the -O option). It is disabled by default when pyglet is "frozen"
+#: within a py2exe or py2app library archive.
+#: shadow_window
+#: By default, pyglet creates a hidden window with a GL context when
+#: pyglet.gl is imported. This allows resources to be loaded before
+#: the application window is created, and permits GL objects to be
+#: shared between windows even after they've been closed. You can
+#: disable the creation of the shadow window by setting this option to
+#: False.
+#:
+#: Some OpenGL driver implementations may not support shared OpenGL
+#: contexts and may require disabling the shadow window (and all resources
+#: must be loaded after the window using them was created). Recommended
+#: for advanced developers only.
+#:
+#: .. versionadded:: 1.1
+#: vsync
+#: If set, the `pyglet.window.Window.vsync` property is ignored, and
+#: this option overrides it (to either force vsync on or off). If unset,
+#: or set to None, the `pyglet.window.Window.vsync` property behaves
+#: as documented.
+#: xsync
+#: If set (the default), pyglet will attempt to synchronise the drawing of
+#: double-buffered windows to the border updates of the X11 window
+#: manager. This improves the appearance of the window during resize
+#: operations. This option only affects double-buffered windows on
+#: X11 servers supporting the Xsync extension with a window manager
+#: that implements the _NET_WM_SYNC_REQUEST protocol.
+#:
+#: .. versionadded:: 1.1
+#: darwin_cocoa
+#: If True, the Cocoa-based pyglet implementation is used as opposed to
+#: the 32-bit Carbon implementation. When python is running in 64-bit mode
+#: on Mac OS X 10.6 or later, this option is set to True by default.
+#: Otherwise the Carbon implementation is preferred.
+#:
+#: .. versionadded:: 1.2
+#:
+#: search_local_libs
+#: If False, pyglet won't try to search for libraries in the script
+#: directory and its `lib` subdirectory. This is useful to load a local
+#: library instead of the system installed version. This option is set
+#: to True by default.
+#:
+#: .. versionadded:: 1.2
+#:
+options = {
+ 'audio': ('directsound', 'pulse', 'openal', 'silent'),
+ 'font': ('gdiplus', 'win32'), # ignored outside win32; win32 is deprecated
+ 'debug_font': False,
+ 'debug_gl': not _enable_optimisations,
+ 'debug_gl_trace': False,
+ 'debug_gl_trace_args': False,
+ 'debug_graphics_batch': False,
+ 'debug_lib': False,
+ 'debug_media': False,
+ 'debug_texture': False,
+ 'debug_trace': False,
+ 'debug_trace_args': False,
+ 'debug_trace_depth': 1,
+ 'debug_trace_flush': True,
+ 'debug_win32': False,
+ 'debug_x11': False,
+ 'graphics_vbo': True,
+ 'shadow_window': True,
+ 'vsync': None,
+ 'xsync': True,
+ 'xlib_fullscreen_override_redirect': False,
+ 'darwin_cocoa': False,
+ 'search_local_libs': True,
+}
+
+_option_types = {
+ 'audio': tuple,
+ 'font': tuple,
+ 'debug_font': bool,
+ 'debug_gl': bool,
+ 'debug_gl_trace': bool,
+ 'debug_gl_trace_args': bool,
+ 'debug_graphics_batch': bool,
+ 'debug_lib': bool,
+ 'debug_media': bool,
+ 'debug_texture': bool,
+ 'debug_trace': bool,
+ 'debug_trace_args': bool,
+ 'debug_trace_depth': int,
+ 'debug_trace_flush': bool,
+ 'debug_win32': bool,
+ 'debug_x11': bool,
+ 'graphics_vbo': bool,
+ 'shadow_window': bool,
+ 'vsync': bool,
+ 'xsync': bool,
+ 'xlib_fullscreen_override_redirect': bool,
+ 'darwin_cocoa': bool,
+}
+
+
+def _choose_darwin_platform():
+ """Choose between Darwin's Carbon and Cocoa implementations."""
+ if compat_platform != 'darwin':
+ return
+ import struct
+ numbits = 8*struct.calcsize("P")
+ if numbits == 64:
+ import platform
+ osx_version = platform.mac_ver()[0].split(".")
+ if int(osx_version[0]) == 10 and int(osx_version[1]) < 6:
+ raise Exception('pyglet is not compatible with 64-bit Python '
+ 'for versions of Mac OS X prior to 10.6.')
+ options['darwin_cocoa'] = True
+ else:
+ options['darwin_cocoa'] = False
+_choose_darwin_platform() # can be overridden by an environment variable below
+
+
+def _read_environment():
+ """Read defaults for options from environment"""
+ for key in options:
+ env = 'PYGLET_%s' % key.upper()
+ try:
+ value = os.environ[env]
+ if _option_types[key] is tuple:
+ options[key] = value.split(',')
+ elif _option_types[key] is bool:
+ options[key] = value in ('true', 'TRUE', 'True', '1')
+ elif _option_types[key] is int:
+ options[key] = int(value)
+ except KeyError:
+ pass
+_read_environment()
+
+if compat_platform == 'cygwin':
+ # This hack pretends that the posix-like ctypes provides windows
+ # functionality. COM does not work with this hack, so there is no
+ # DirectSound support.
+ import ctypes
+ ctypes.windll = ctypes.cdll
+ ctypes.oledll = ctypes.cdll
+ ctypes.WINFUNCTYPE = ctypes.CFUNCTYPE
+ ctypes.HRESULT = ctypes.c_long
+
+if compat_platform == 'darwin' and not options['darwin_cocoa']:
+ warnings.warn('Carbon support is to be deprecated in Pyglet 1.4', PendingDeprecationWarning)
+
+
+# Call tracing
+# ------------
+
+_trace_filename_abbreviations = {}
+
+
+def _trace_repr(value, size=40):
+ value = repr(value)
+ if len(value) > size:
+ value = value[:size//2-2] + '...' + value[-size//2-1:]
+ return value
+
+
+def _trace_frame(thread, frame, indent):
+ from pyglet import lib
+ if frame.f_code is lib._TraceFunction.__call__.__code__:
+ is_ctypes = True
+ func = frame.f_locals['self']._func
+ name = func.__name__
+ location = '[ctypes]'
+ else:
+ is_ctypes = False
+ code = frame.f_code
+ name = code.co_name
+ path = code.co_filename
+ line = code.co_firstlineno
+
+ try:
+ filename = _trace_filename_abbreviations[path]
+ except KeyError:
+ # Trim path down
+ dir = ''
+ path, filename = os.path.split(path)
+ while len(dir + filename) < 30:
+ filename = os.path.join(dir, filename)
+ path, dir = os.path.split(path)
+ if not dir:
+ filename = os.path.join('', filename)
+ break
+ else:
+ filename = os.path.join('...', filename)
+ _trace_filename_abbreviations[path] = filename
+
+ location = '(%s:%d)' % (filename, line)
+
+ if indent:
+ name = 'Called from %s' % name
+ print('[%d] %s%s %s' % (thread, indent, name, location))
+
+ if _trace_args:
+ if is_ctypes:
+ args = [_trace_repr(arg) for arg in frame.f_locals['args']]
+ print(' %sargs=(%s)' % (indent, ', '.join(args)))
+ else:
+ for argname in code.co_varnames[:code.co_argcount]:
+ try:
+ argvalue = _trace_repr(frame.f_locals[argname])
+ print(' %s%s=%s' % (indent, argname, argvalue))
+ except:
+ pass
+
+ if _trace_flush:
+ sys.stdout.flush()
+
+
+def _thread_trace_func(thread):
+ def _trace_func(frame, event, arg):
+ if event == 'call':
+ indent = ''
+ for i in range(_trace_depth):
+ _trace_frame(thread, frame, indent)
+ indent += ' '
+ frame = frame.f_back
+ if not frame:
+ break
+
+ elif event == 'exception':
+ (exception, value, traceback) = arg
+ print('First chance exception raised:', repr(exception))
+ return _trace_func
+
+
+def _install_trace():
+ global _trace_thread_count
+ sys.setprofile(_thread_trace_func(_trace_thread_count))
+ _trace_thread_count += 1
+
+_trace_thread_count = 0
+_trace_args = options['debug_trace_args']
+_trace_depth = options['debug_trace_depth']
+_trace_flush = options['debug_trace_flush']
+if options['debug_trace']:
+ _install_trace()
+
+
+# Lazy loading
+# ------------
+
+class _ModuleProxy(object):
+ _module = None
+
+ def __init__(self, name):
+ self.__dict__['_module_name'] = name
+
+ def __getattr__(self, name):
+ try:
+ return getattr(self._module, name)
+ except AttributeError:
+ if self._module is not None:
+ raise
+
+ import_name = 'pyglet.%s' % self._module_name
+ __import__(import_name)
+ module = sys.modules[import_name]
+ object.__setattr__(self, '_module', module)
+ globals()[self._module_name] = module
+ return getattr(module, name)
+
+ def __setattr__(self, name, value):
+ try:
+ setattr(self._module, name, value)
+ except AttributeError:
+ if self._module is not None:
+ raise
+
+ import_name = 'pyglet.%s' % self._module_name
+ __import__(import_name)
+ module = sys.modules[import_name]
+ object.__setattr__(self, '_module', module)
+ globals()[self._module_name] = module
+ setattr(module, name, value)
+
+if True:
+ app = _ModuleProxy('app')
+ canvas = _ModuleProxy('canvas')
+ clock = _ModuleProxy('clock')
+ com = _ModuleProxy('com')
+ event = _ModuleProxy('event')
+ font = _ModuleProxy('font')
+ gl = _ModuleProxy('gl')
+ graphics = _ModuleProxy('graphics')
+ image = _ModuleProxy('image')
+ input = _ModuleProxy('input')
+ lib = _ModuleProxy('lib')
+ media = _ModuleProxy('media')
+ resource = _ModuleProxy('resource')
+ sprite = _ModuleProxy('sprite')
+ text = _ModuleProxy('text')
+ window = _ModuleProxy('window')
+
+# Fool py2exe, py2app into including all top-level modules (doesn't understand
+# lazy loading)
+if False:
+ from . import app
+ from . import canvas
+ from . import clock
+ from . import com
+ from . import event
+ from . import font
+ from . import gl
+ from . import graphics
+ from . import input
+ from . import image
+ from . import lib
+ from . import media
+ from . import resource
+ from . import sprite
+ from . import text
+ from . import window
+
+# Hack around some epydoc bug that causes it to think pyglet.window is None.
+if False:
+ from . import window
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/app/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/app/__init__.py
new file mode 100644
index 0000000..f43727e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/app/__init__.py
@@ -0,0 +1,182 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Application-wide functionality.
+
+Applications
+------------
+
+Most applications need only call :func:`run` after creating one or more
+windows to begin processing events. For example, a simple application
+consisting of one window is::
+
+ import pyglet
+
+ win = pyglet.window.Window()
+ pyglet.app.run()
+
+
+Events
+======
+
+To handle events on the main event loop, instantiate it manually. The
+following example exits the application as soon as any window is closed (the
+default policy is to wait until all windows are closed)::
+
+ event_loop = pyglet.app.EventLoop()
+
+ @event_loop.event
+ def on_window_close(window):
+ event_loop.exit()
+
+.. versionadded:: 1.1
+'''
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import sys
+import weakref
+
+_is_epydoc = hasattr(sys, 'is_epydoc') and sys.is_epydoc
+
+class AppException(Exception):
+ pass
+
+class WeakSet(object):
+ '''Set of objects, referenced weakly.
+
+ Adding an object to this set does not prevent it from being garbage
+ collected. Upon being garbage collected, the object is automatically
+ removed from the set.
+ '''
+ def __init__(self):
+ self._dict = weakref.WeakKeyDictionary()
+
+ def add(self, value):
+ self._dict[value] = True
+
+ def remove(self, value):
+ # Value might be removed already if this is during __del__ of the item.
+ self._dict.pop(value, None)
+
+ def pop(self):
+ value, _ = self._dict.popitem()
+ return value
+
+ def __iter__(self):
+ for key in self._dict.keys():
+ yield key
+
+ def __contains__(self, other):
+ return other in self._dict
+
+ def __len__(self):
+ return len(self._dict)
+
+
+displays = WeakSet()
+'''Set of all open displays. Instances of :class:`pyglet.canvas.Display`
+are automatically added to this set upon construction. The set uses weak
+references, so displays are removed from the set when they are no longer
+referenced.
+
+:deprecated: Use :func:`pyglet.canvas.get_display`.
+
+:type: :class:`WeakSet`
+'''
+
+
+windows = WeakSet()
+'''Set of all open windows (including invisible windows). Instances of
+:class:`pyglet.window.Window` are automatically added to this set upon
+construction. The set uses weak references, so windows are removed from
+the set when they are no longer referenced or are closed explicitly.
+'''
+
+
+def run():
+ '''Begin processing events, scheduled functions and window updates.
+
+ This is a convenience function, equivalent to::
+
+ pyglet.app.event_loop.run()
+
+ '''
+ event_loop.run()
+
+def exit():
+ '''Exit the application event loop.
+
+ Causes the application event loop to finish, if an event loop is currently
+ running. The application may not necessarily exit (for example, there may
+ be additional code following the `run` invocation).
+
+ This is a convenience function, equivalent to::
+
+ event_loop.exit()
+
+ '''
+ event_loop.exit()
+
+from pyglet.app.base import EventLoop
+from pyglet import compat_platform
+if _is_epydoc:
+ from pyglet.app.base import PlatformEventLoop
+else:
+ if compat_platform == 'darwin':
+ from pyglet import options as pyglet_options
+ if pyglet_options['darwin_cocoa']:
+ from pyglet.app.cocoa import CocoaEventLoop as PlatformEventLoop
+ else:
+ from pyglet.app.carbon import CarbonEventLoop as PlatformEventLoop
+ elif compat_platform in ('win32', 'cygwin'):
+ from pyglet.app.win32 import Win32EventLoop as PlatformEventLoop
+ else:
+ from pyglet.app.xlib import XlibEventLoop as PlatformEventLoop
+
+
+
+#: The global event loop. Applications can replace this
+#: with their own subclass of :class:`EventLoop` before calling
+#: :meth:`EventLoop.run`.
+event_loop = EventLoop()
+
+platform_event_loop = PlatformEventLoop()
+
+"""The platform-dependent event loop.
+Applications must not subclass or replace this :class:`PlatformEventLoop`
+object.
+"""
\ No newline at end of file
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/app/base.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/app/base.py
new file mode 100644
index 0000000..3bcc092
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/app/base.py
@@ -0,0 +1,390 @@
+from __future__ import print_function
+from __future__ import division
+from future import standard_library
+standard_library.install_aliases()
+from builtins import next
+from builtins import object
+
+import platform
+import queue
+import sys
+import threading
+
+from pyglet import app
+from pyglet import compat_platform
+from pyglet import clock
+from pyglet import event
+
+_is_epydoc = hasattr(sys, 'is_epydoc') and sys.is_epydoc
+
+
+class PlatformEventLoop(object):
+ """ Abstract class, implementation depends on platform.
+
+ .. versionadded:: 1.2
+ """
+ def __init__(self):
+ self._event_queue = queue.Queue()
+ self._is_running = threading.Event()
+ self._is_running.clear()
+
+ def is_running(self):
+ """Return True if the event loop is currently processing, or False
+ if it is blocked or not activated.
+
+ :rtype: bool
+ """
+ return self._is_running.is_set()
+
+ def post_event(self, dispatcher, event, *args):
+ """Post an event into the main application thread.
+
+ The event is queued internally until the :py:meth:`run` method's thread
+ is able to dispatch the event. This method can be safely called
+ from any thread.
+
+ If the method is called from the :py:meth:`run` method's thread (for
+ example, from within an event handler), the event may be dispatched
+ within the same runloop iteration or the next one; the choice is
+ nondeterministic.
+
+ :Parameters:
+ `dispatcher` : EventDispatcher
+ Dispatcher to process the event.
+ `event` : str
+ Event name.
+ `args` : sequence
+ Arguments to pass to the event handlers.
+
+ """
+ self._event_queue.put((dispatcher, event, args))
+ self.notify()
+
+ def dispatch_posted_events(self):
+ """Immediately dispatch all pending events.
+
+ Normally this is called automatically by the runloop iteration.
+ """
+ while True:
+ try:
+ dispatcher, event, args = self._event_queue.get(False)
+ except queue.Empty:
+ break
+
+ dispatcher.dispatch_event(event, *args)
+
+ def notify(self):
+ """Notify the event loop that something needs processing.
+
+ If the event loop is blocked, it will unblock and perform an iteration
+ immediately. If the event loop is running, another iteration is
+ scheduled for immediate execution afterwards.
+ """
+ raise NotImplementedError('abstract')
+
+ def start(self):
+ pass
+
+ def step(self, timeout=None):
+ """:TODO: in mac/linux: return True if didn't time out"""
+ raise NotImplementedError('abstract')
+
+ def set_timer(self, func, interval):
+ raise NotImplementedError('abstract')
+
+ def stop(self):
+ pass
+
+
+class EventLoop(event.EventDispatcher):
+ """The main run loop of the application.
+
+ Calling `run` begins the application event loop, which processes
+ operating system events, calls :py:func:`pyglet.clock.tick` to call
+ scheduled functions and calls :py:meth:`pyglet.window.Window.on_draw` and
+ :py:meth:`pyglet.window.Window.flip` to update window contents.
+
+ Applications can subclass :py:class:`EventLoop` and override certain methods
+ to integrate another framework's run loop, or to customise processing
+ in some other way. You should not in general override :py:meth:`run`, as
+ this method contains platform-specific code that ensures the application
+ remains responsive to the user while keeping CPU usage to a minimum.
+ """
+
+ _has_exit_condition = None
+ _has_exit = False
+
+ def __init__(self):
+ self._has_exit_condition = threading.Condition()
+ self.clock = clock.get_default()
+ self.is_running = False
+
+ def run(self):
+ """Begin processing events, scheduled functions and window updates.
+
+ This method returns when :py:attr:`has_exit` is set to True.
+
+ Developers are discouraged from overriding this method, as the
+ implementation is platform-specific.
+ """
+ self.has_exit = False
+ self._legacy_setup()
+
+ platform_event_loop = app.platform_event_loop
+ platform_event_loop.start()
+ self.dispatch_event('on_enter')
+
+ self.is_running = True
+ legacy_platforms = ('XP', '2000', '2003Server', 'post2003')
+ if compat_platform == 'win32' and platform.win32_ver()[0] in legacy_platforms:
+ self._run_estimated()
+ else:
+ self._run()
+ self.is_running = False
+
+ self.dispatch_event('on_exit')
+ platform_event_loop.stop()
+
+ def _run(self):
+ """The simplest standard run loop, using constant timeout. Suitable
+ for well-behaving platforms (Mac, Linux and some Windows).
+ """
+ platform_event_loop = app.platform_event_loop
+ while not self.has_exit:
+ timeout = self.idle()
+ platform_event_loop.step(timeout)
+
+ def _run_estimated(self):
+ """Run-loop that continually estimates function mapping requested
+ timeout to measured timeout using a least-squares linear regression.
+ Suitable for oddball platforms (Windows).
+
+ XXX: There is no real relation between the timeout given by self.idle(), and used
+ to calculate the estimate, and the time actually spent waiting for events. I have
+ seen this cause a negative gradient, showing a negative relation. Then CPU use
+ runs out of control due to very small estimates.
+ """
+ platform_event_loop = app.platform_event_loop
+
+ predictor = self._least_squares()
+ gradient, offset = next(predictor)
+
+ time = self.clock.time
+ while not self.has_exit:
+ timeout = self.idle()
+ if timeout is None:
+ estimate = None
+ else:
+ estimate = max(gradient * timeout + offset, 0.0)
+ if False:
+ print('Gradient = %f, Offset = %f' % (gradient, offset))
+ print('Timeout = %f, Estimate = %f' % (timeout, estimate))
+
+ t = time()
+ if not platform_event_loop.step(estimate) and estimate != 0.0 and estimate is not None:
+ dt = time() - t
+ gradient, offset = predictor.send((dt, estimate))
+
+ @staticmethod
+ def _least_squares(gradient=1, offset=0):
+ X = 0
+ Y = 0
+ XX = 0
+ XY = 0
+ n = 0
+
+ while True:
+ x, y = yield gradient, offset
+ X += x
+ Y += y
+ XX += x * x
+ XY += x * y
+ n += 1
+
+ try:
+ gradient = (n * XY - X * Y) / (n * XX - X * X)
+ offset = (Y - gradient * X) / n
+ except ZeroDivisionError:
+ # Can happen in pathalogical case; keep current
+ # gradient/offset for now.
+ pass
+
+ def _legacy_setup(self):
+ # Disable event queuing for dispatch_events
+ from pyglet.window import Window
+ Window._enable_event_queue = False
+
+ # Dispatch pending events
+ for window in app.windows:
+ window.switch_to()
+ window.dispatch_pending_events()
+
+ def enter_blocking(self):
+ """Called by pyglet internal processes when the operating system
+ is about to block due to a user interaction. For example, this
+ is common when the user begins resizing or moving a window.
+
+ This method provides the event loop with an opportunity to set up
+ an OS timer on the platform event loop, which will continue to
+ be invoked during the blocking operation.
+
+ The default implementation ensures that :py:meth:`idle` continues to be
+ called as documented.
+
+ .. versionadded:: 1.2
+ """
+ timeout = self.idle()
+ app.platform_event_loop.set_timer(self._blocking_timer, timeout)
+
+ def exit_blocking(self):
+ """Called by pyglet internal processes when the blocking operation
+ completes. See :py:meth:`enter_blocking`.
+ """
+ app.platform_event_loop.set_timer(None, None)
+
+ def _blocking_timer(self):
+ timeout = self.idle()
+ app.platform_event_loop.set_timer(self._blocking_timer, timeout)
+
+ def idle(self):
+ """Called during each iteration of the event loop.
+
+ The method is called immediately after any window events (i.e., after
+ any user input). The method can return a duration after which
+ the idle method will be called again. The method may be called
+ earlier if the user creates more input events. The method
+ can return `None` to only wait for user events.
+
+ For example, return ``1.0`` to have the idle method called every
+ second, or immediately after any user events.
+
+ The default implementation dispatches the
+ :py:meth:`pyglet.window.Window.on_draw` event for all windows and uses
+ :py:func:`pyglet.clock.tick` and :py:func:`pyglet.clock.get_sleep_time`
+ on the default clock to determine the return value.
+
+ This method should be overridden by advanced users only. To have
+ code execute at regular intervals, use the
+ :py:func:`pyglet.clock.schedule` methods.
+
+ :rtype: float
+ :return: The number of seconds before the idle method should
+ be called again, or `None` to block for user input.
+ """
+ dt = self.clock.update_time()
+ redraw_all = self.clock.call_scheduled_functions(dt)
+
+ # Redraw all windows
+ for window in app.windows:
+ if redraw_all or (window._legacy_invalid and window.invalid):
+ window.switch_to()
+ window.dispatch_event('on_draw')
+ window.flip()
+ window._legacy_invalid = False
+
+ # Update timout
+ return self.clock.get_sleep_time(True)
+
+ def _get_has_exit(self):
+ self._has_exit_condition.acquire()
+ result = self._has_exit
+ self._has_exit_condition.release()
+ return result
+
+ def _set_has_exit(self, value):
+ self._has_exit_condition.acquire()
+ self._has_exit = value
+ self._has_exit_condition.notify()
+ self._has_exit_condition.release()
+
+ @property
+ def has_exit(self):
+ """Flag indicating if the event loop will exit in
+ the next iteration. When set, all waiting threads are interrupted (see
+ :py:meth:`sleep`).
+
+ Thread-safe since pyglet 1.2.
+
+ :see: `exit`
+ :type: bool
+ """
+ return self._get_has_exit()
+
+ @has_exit.setter
+ def has_exit(self, value):
+ self._set_has_exit(value)
+
+ def exit(self):
+ """Safely exit the event loop at the end of the current iteration.
+
+ This method is a thread-safe equivalent for for setting
+ :py:attr:`has_exit` to ``True``. All waiting threads will be
+ interrupted (see :py:meth:`sleep`).
+ """
+ self._set_has_exit(True)
+ app.platform_event_loop.notify()
+
+ def sleep(self, timeout):
+ """Wait for some amount of time, or until the :py:attr:`has_exit` flag
+ is set or :py:meth:`exit` is called.
+
+ This method is thread-safe.
+
+ :Parameters:
+ `timeout` : float
+ Time to wait, in seconds.
+
+ .. versionadded:: 1.2
+
+ :rtype: bool
+ :return: ``True`` if the `has_exit` flag is set, otherwise ``False``.
+ """
+ self._has_exit_condition.acquire()
+ self._has_exit_condition.wait(timeout)
+ result = self._has_exit
+ self._has_exit_condition.release()
+ return result
+
+ def on_window_close(self, window):
+ """Default window close handler."""
+ if len(app.windows) == 0:
+ self.exit()
+
+ if _is_epydoc:
+ def on_window_close(self, window):
+ """A window was closed.
+
+ This event is dispatched when a window is closed. It is not
+ dispatched if the window's close button was pressed but the
+ window did not close.
+
+ The default handler calls :py:meth:`exit` if no more windows are
+ open. You can override this handler to base your application exit
+ on some other policy.
+
+ :event:
+ """
+
+ def on_enter(self):
+ """The event loop is about to begin.
+
+ This is dispatched when the event loop is prepared to enter
+ the main run loop, and represents the last chance for an
+ application to initialise itself.
+
+ :event:
+ """
+
+ def on_exit(self):
+ """The event loop is about to exit.
+
+ After dispatching this event, the :py:meth:`run` method returns (the
+ application may not actually exit if you have more code
+ following the :py:meth:`run` invocation).
+
+ :event:
+ """
+
+EventLoop.register_event_type('on_window_close')
+EventLoop.register_event_type('on_enter')
+EventLoop.register_event_type('on_exit')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/app/carbon.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/app/carbon.py
new file mode 100644
index 0000000..a818895
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/app/carbon.py
@@ -0,0 +1,150 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import ctypes
+
+from pyglet import app
+from pyglet.app.base import PlatformEventLoop
+
+from pyglet.libs.darwin import *
+
+EventLoopTimerProc = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p)
+
+
+class CarbonEventLoop(PlatformEventLoop):
+ def __init__(self):
+ self._event_loop = carbon.GetMainEventLoop()
+ self._timer = ctypes.c_void_p()
+ self._timer_func = None
+ self._timer_func_proc = EventLoopTimerProc(self._timer_proc)
+ super(CarbonEventLoop, self).__init__()
+
+ def notify(self):
+ carbon.SetEventLoopTimerNextFireTime(
+ self._timer, ctypes.c_double(0.0))
+
+ def start(self):
+ # Create timer
+ timer = self._timer
+ carbon.InstallEventLoopTimer(self._event_loop,
+ ctypes.c_double(0.1), #?
+ ctypes.c_double(kEventDurationForever),
+ self._timer_func_proc,
+ None,
+ ctypes.byref(timer))
+
+ def stop(self):
+ carbon.RemoveEventLoopTimer(self._timer)
+
+ def step(self, timeout=None):
+ self.dispatch_posted_events()
+
+ event_dispatcher = carbon.GetEventDispatcherTarget()
+ e = ctypes.c_void_p()
+ if timeout is None:
+ timeout = kEventDurationForever
+ self._is_running.set()
+ # XXX should spin on multiple events after first timeout
+ if carbon.ReceiveNextEvent(0, None, ctypes.c_double(timeout),
+ True, ctypes.byref(e)) == 0:
+ carbon.SendEventToEventTarget(e, event_dispatcher)
+ carbon.ReleaseEvent(e)
+ timed_out = False
+ else:
+ timed_out = True
+ self._is_running.clear()
+
+ return not timed_out
+
+ def set_timer(self, func, interval):
+ if interval is None or func is None:
+ interval = kEventDurationForever
+
+ self._timer_func = func
+ carbon.SetEventLoopTimerNextFireTime(self._timer,
+ ctypes.c_double(interval))
+
+ def _timer_proc(self, timer, data):
+ if self._timer_func:
+ self._timer_func()
+
+ '''
+ self.dispatch_posted_events()
+
+ allow_polling = True
+
+ for window in app.windows:
+ # Check for live resizing
+ if window._resizing is not None:
+ allow_polling = False
+ old_width, old_height = window._resizing
+ rect = Rect()
+ carbon.GetWindowBounds(window._window,
+ kWindowContentRgn,
+ ctypes.byref(rect))
+ width = rect.right - rect.left
+ height = rect.bottom - rect.top
+ if width != old_width or height != old_height:
+ window._resizing = width, height
+ window.switch_to()
+ window.dispatch_event('on_resize', width, height)
+
+ # Check for live dragging
+ if window._dragging:
+ allow_polling = False
+
+ # Check for deferred recreate
+ if window._recreate_deferred:
+ # Break out of ReceiveNextEvent so it can be processed
+ # in next iteration.
+ carbon.QuitEventLoop(self._event_loop)
+ self._force_idle = True
+
+ sleep_time = self.idle()
+
+ if sleep_time is None:
+ sleep_time = kEventDurationForever
+ elif sleep_time < 0.01 and allow_polling and self._allow_polling:
+ # Switch event loop to polling.
+ carbon.QuitEventLoop(self._event_loop)
+ self._force_idle = True
+ sleep_time = kEventDurationForever
+ carbon.SetEventLoopTimerNextFireTime(timer, ctypes.c_double(sleep_time))
+ '''
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/app/cocoa.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/app/cocoa.py
new file mode 100644
index 0000000..3c6682a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/app/cocoa.py
@@ -0,0 +1,198 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+from pyglet.app.base import PlatformEventLoop
+from pyglet.libs.darwin.cocoapy import *
+
+NSApplication = ObjCClass('NSApplication')
+NSMenu = ObjCClass('NSMenu')
+NSMenuItem = ObjCClass('NSMenuItem')
+NSAutoreleasePool = ObjCClass('NSAutoreleasePool')
+NSDate = ObjCClass('NSDate')
+NSEvent = ObjCClass('NSEvent')
+NSUserDefaults = ObjCClass('NSUserDefaults')
+
+
+class AutoReleasePool(object):
+ def __enter__(self):
+ self.pool = NSAutoreleasePool.alloc().init()
+ return self.pool
+
+ def __exit__(self, exc_type, exc_value, traceback):
+ self.pool.drain()
+ del self.pool
+
+
+def add_menu_item(menu, title, action, key):
+ with AutoReleasePool():
+ title = CFSTR(title)
+ action = get_selector(action)
+ key = CFSTR(key)
+ menuItem = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_(
+ title, action, key)
+ menu.addItem_(menuItem)
+
+ # cleanup
+ title.release()
+ key.release()
+ menuItem.release()
+
+def create_menu():
+ with AutoReleasePool():
+ appMenu = NSMenu.alloc().init()
+
+ # Hide still doesn't work!?
+ add_menu_item(appMenu, 'Hide!', 'hide:', 'h')
+ appMenu.addItem_(NSMenuItem.separatorItem())
+ add_menu_item(appMenu, 'Quit!', 'terminate:', 'q')
+
+ menubar = NSMenu.alloc().init()
+ appMenuItem = NSMenuItem.alloc().init()
+ appMenuItem.setSubmenu_(appMenu)
+ menubar.addItem_(appMenuItem)
+ NSApp = NSApplication.sharedApplication()
+ NSApp.setMainMenu_(menubar)
+
+ # cleanup
+ appMenu.release()
+ menubar.release()
+ appMenuItem.release()
+
+
+class CocoaEventLoop(PlatformEventLoop):
+
+ def __init__(self):
+ super(CocoaEventLoop, self).__init__()
+ with AutoReleasePool():
+ # Prepare the default application.
+ self.NSApp = NSApplication.sharedApplication()
+ if self.NSApp.isRunning():
+ # Application was already started by GUI library (e.g. wxPython).
+ return
+ if not self.NSApp.mainMenu():
+ create_menu()
+ self.NSApp.setActivationPolicy_(NSApplicationActivationPolicyRegular)
+ # Prevent Lion / Mountain Lion from automatically saving application state.
+ # If we don't do this, new windows will not display on 10.8 after finishLaunching
+ # has been called.
+ defaults = NSUserDefaults.standardUserDefaults()
+ ignoreState = CFSTR("ApplePersistenceIgnoreState")
+ if not defaults.objectForKey_(ignoreState):
+ defaults.setBool_forKey_(True, ignoreState)
+ self._finished_launching = False
+
+ def start(self):
+ with AutoReleasePool():
+ if not self.NSApp.isRunning() and not self._finished_launching:
+ # finishLaunching should be called only once. However isRunning will not
+ # guard this, as we are not using the normal event loop.
+ self.NSApp.finishLaunching()
+ self.NSApp.activateIgnoringOtherApps_(True)
+ self._finished_launching = True
+
+ def step(self, timeout=None):
+ with AutoReleasePool():
+ self.dispatch_posted_events()
+
+ # Determine the timeout date.
+ if timeout is None:
+ # Using distantFuture as untilDate means that nextEventMatchingMask
+ # will wait until the next event comes along.
+ timeout_date = NSDate.distantFuture()
+ else:
+ timeout_date = NSDate.dateWithTimeIntervalSinceNow_(timeout)
+
+ # Retrieve the next event (if any). We wait for an event to show up
+ # and then process it, or if timeout_date expires we simply return.
+ # We only process one event per call of step().
+ self._is_running.set()
+ event = self.NSApp.nextEventMatchingMask_untilDate_inMode_dequeue_(
+ NSAnyEventMask, timeout_date, NSDefaultRunLoopMode, True)
+
+ # Dispatch the event (if any).
+ if event is not None:
+ event_type = event.type()
+ if event_type != NSApplicationDefined:
+ # Send out event as normal. Responders will still receive
+ # keyUp:, keyDown:, and flagsChanged: events.
+ self.NSApp.sendEvent_(event)
+
+ # Resend key events as special pyglet-specific messages
+ # which supplant the keyDown:, keyUp:, and flagsChanged: messages
+ # because NSApplication translates multiple key presses into key
+ # equivalents before sending them on, which means that some keyUp:
+ # messages are never sent for individual keys. Our pyglet-specific
+ # replacements ensure that we see all the raw key presses & releases.
+ # We also filter out key-down repeats since pyglet only sends one
+ # on_key_press event per key press.
+ if event_type == NSKeyDown and not event.isARepeat():
+ self.NSApp.sendAction_to_from_(get_selector("pygletKeyDown:"), None, event)
+ elif event_type == NSKeyUp:
+ self.NSApp.sendAction_to_from_(get_selector("pygletKeyUp:"), None, event)
+ elif event_type == NSFlagsChanged:
+ self.NSApp.sendAction_to_from_(get_selector("pygletFlagsChanged:"), None, event)
+
+ self.NSApp.updateWindows()
+ did_time_out = False
+ else:
+ did_time_out = True
+
+ self._is_running.clear()
+
+ return did_time_out
+
+ def stop(self):
+ pass
+
+ def notify(self):
+ with AutoReleasePool():
+ notifyEvent = NSEvent.otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2_(
+ NSApplicationDefined, # type
+ NSPoint(0.0, 0.0), # location
+ 0, # modifierFlags
+ 0, # timestamp
+ 0, # windowNumber
+ None, # graphicsContext
+ 0, # subtype
+ 0, # data1
+ 0, # data2
+ )
+
+ self.NSApp.postEvent_atStart_(notifyEvent, False)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/app/win32.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/app/win32.py
new file mode 100644
index 0000000..83e3433
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/app/win32.py
@@ -0,0 +1,149 @@
+from __future__ import absolute_import
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+# $Id:$
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import ctypes
+
+from pyglet import app
+from .base import PlatformEventLoop
+
+from pyglet.libs.win32 import _kernel32, _user32, types, constants
+from pyglet.libs.win32.constants import *
+from pyglet.libs.win32.types import *
+
+class Win32EventLoop(PlatformEventLoop):
+ def __init__(self):
+ super(Win32EventLoop, self).__init__()
+
+ self._next_idle_time = None
+
+ # Force immediate creation of an event queue on this thread -- note
+ # that since event loop is created on pyglet.app import, whatever
+ # imports pyglet.app _must_ own the main run loop.
+ msg = types.MSG()
+ _user32.PeekMessageW(ctypes.byref(msg), 0,
+ constants.WM_USER, constants.WM_USER,
+ constants.PM_NOREMOVE)
+
+ self._event_thread = _kernel32.GetCurrentThreadId()
+
+ self._wait_objects = []
+ self._recreate_wait_objects_array()
+
+ self._timer_proc = types.TIMERPROC(self._timer_proc_func)
+ self._timer = _user32.SetTimer(
+ 0, 0, constants.USER_TIMER_MAXIMUM, self._timer_proc)
+
+ def add_wait_object(self, object, func):
+ self._wait_objects.append((object, func))
+ self._recreate_wait_objects_array()
+
+ def remove_wait_object(self, object):
+ for i, (_object, _) in enumerate(self._wait_objects):
+ if object == _object:
+ del self._wait_objects[i]
+ break
+ self._recreate_wait_objects_array()
+
+ def _recreate_wait_objects_array(self):
+ if not self._wait_objects:
+ self._wait_objects_n = 0
+ self._wait_objects_array = None
+ return
+
+ self._wait_objects_n = len(self._wait_objects)
+ self._wait_objects_array = \
+ (HANDLE * self._wait_objects_n)(*[o for o, f in self._wait_objects])
+
+ def start(self):
+ if _kernel32.GetCurrentThreadId() != self._event_thread:
+ raise RuntimeError('EventLoop.run() must be called from the same ' +
+ 'thread that imports pyglet.app')
+
+ self._timer_func = None
+ self._polling = False
+ self._allow_polling = True
+
+ def step(self, timeout=None):
+ self.dispatch_posted_events()
+
+ msg = types.MSG()
+ if timeout is None:
+ timeout = constants.INFINITE
+ else:
+ timeout = int(timeout * 1000) # milliseconds
+
+ result = _user32.MsgWaitForMultipleObjects(
+ self._wait_objects_n,
+ self._wait_objects_array,
+ False,
+ timeout,
+ constants.QS_ALLINPUT)
+ result -= constants.WAIT_OBJECT_0
+
+ if result == self._wait_objects_n:
+ while _user32.PeekMessageW(ctypes.byref(msg),
+ 0, 0, 0, constants.PM_REMOVE):
+ _user32.TranslateMessage(ctypes.byref(msg))
+ _user32.DispatchMessageW(ctypes.byref(msg))
+ elif 0 <= result < self._wait_objects_n:
+ object, func = self._wait_objects[result]
+ func()
+
+ # Return True if timeout was interrupted.
+ return result <= self._wait_objects_n
+
+ def notify(self):
+ # Nudge the event loop with a message it will discard. Note that only
+ # user events are actually posted. The posted event will not
+ # interrupt the window move/size drag loop -- it seems there's no way
+ # to do this.
+ _user32.PostThreadMessageW(self._event_thread, constants.WM_USER, 0, 0)
+
+ def set_timer(self, func, interval):
+ if func is None or interval is None:
+ interval = constants.USER_TIMER_MAXIMUM
+ else:
+ interval = int(interval * 1000) # milliseconds
+
+ self._timer_func = func
+ _user32.SetTimer(0, self._timer, interval, self._timer_proc)
+
+ def _timer_proc_func(self, hwnd, msg, timer, t):
+ if self._timer_func:
+ self._timer_func()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/app/xlib.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/app/xlib.py
new file mode 100644
index 0000000..f3c1627
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/app/xlib.py
@@ -0,0 +1,128 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import os
+import select
+import threading
+from ctypes import *
+
+from pyglet import app
+from pyglet.app.base import PlatformEventLoop
+from pyglet.compat import asbytes
+
+class XlibSelectDevice(object):
+ def fileno(self):
+ '''Get the file handle for ``select()`` for this device.
+
+ :rtype: int
+ '''
+ raise NotImplementedError('abstract')
+
+ def select(self):
+ '''Perform event processing on the device.
+
+ Called when ``select()`` returns this device in its list of active
+ files.
+ '''
+ raise NotImplementedError('abstract')
+
+ def poll(self):
+ '''Check if the device has events ready to process.
+
+ :rtype: bool
+ :return: True if there are events to process, False otherwise.
+ '''
+ return False
+
+class NotificationDevice(XlibSelectDevice):
+ def __init__(self):
+ self._sync_file_read, self._sync_file_write = os.pipe()
+ self._event = threading.Event()
+
+ def fileno(self):
+ return self._sync_file_read
+
+ def set(self):
+ self._event.set()
+ os.write(self._sync_file_write, asbytes('1'))
+
+ def select(self):
+ self._event.clear()
+ os.read(self._sync_file_read, 1)
+ app.platform_event_loop.dispatch_posted_events()
+
+ def poll(self):
+ return self._event.isSet()
+
+class XlibEventLoop(PlatformEventLoop):
+ def __init__(self):
+ super(XlibEventLoop, self).__init__()
+ self._notification_device = NotificationDevice()
+ self._select_devices = set()
+ self._select_devices.add(self._notification_device)
+
+ def notify(self):
+ self._notification_device.set()
+
+ def step(self, timeout=None):
+ # Timeout is from EventLoop.idle(). Return after that timeout or directly
+ # after receiving a new event. None means: block for user input.
+
+ # Poll devices to check for already pending events (select.select is not enough)
+ pending_devices = []
+ for device in self._select_devices:
+ if device.poll():
+ pending_devices.append(device)
+
+ # If no devices were ready, wait until one gets ready
+ if not pending_devices:
+ pending_devices, _, _ = select.select(self._select_devices, (), (), timeout)
+
+ if not pending_devices:
+ # Notify caller that timeout expired without incoming events
+ return False
+
+ # Dispatch activity on matching devices
+ for device in pending_devices:
+ device.select()
+
+ # Notify caller that events were handled before timeout expired
+ return True
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/__init__.py
new file mode 100644
index 0000000..f4e3916
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/__init__.py
@@ -0,0 +1,105 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Display and screen management.
+
+Rendering is performed on a :class:`Canvas`, which conceptually could be an
+off-screen buffer, the content area of a :class:`pyglet.window.Window`, or an
+entire screen. Currently, canvases can only be created with windows (though
+windows can be set fullscreen).
+
+Windows and canvases must belong to a :class`~pyglet.canvas.Display` On Windows and Mac OS
+X there is only one display, which can be obtained with :func:`get_display`.
+Linux supports multiple displays, corresponding to discrete X11 display
+connections and screens. :func:`get_display` on Linux returns the default
+display and screen 0 (``localhost:0.0``); if a particular screen or display is
+required then :class`~pyglet.canvas.Display`can be instantiated directly.
+
+Within a display one or more screens are attached. A :class:`Screen` often
+corresponds to a physical attached monitor, however a monitor or projector set
+up to clone another screen will not be listed. Use :meth:`Display.get_screens`
+to get a list of the attached screens; these can then be queried for their
+sizes and virtual positions on the desktop.
+
+The size of a screen is determined by its current mode, which can be changed
+by the application; see the documentation for :class:`Screen`.
+
+.. versionadded:: 1.2
+'''
+
+import sys
+_is_epydoc = hasattr(sys, 'is_epydoc') and sys.is_epydoc
+
+def get_display():
+ '''Get the default display device.
+
+ If there is already a :class`~pyglet.canvas.Display`connection, that display will be
+ returned. Otherwise, a default :class`~pyglet.canvas.Display`is created and returned.
+ If multiple display connections are active, an arbitrary one is returned.
+
+ .. versionadded:: 1.2
+
+ :rtype: :class`~pyglet.canvas.Display`
+ '''
+ # If there's an existing display, return it (return arbitrary display if
+ # there are multiple).
+ from pyglet.app import displays
+ for display in displays:
+ return display
+
+ # Otherwise, create a new display and return it.
+ return Display()
+
+if _is_epydoc:
+ from pyglet.canvas.base import Display, Screen, Canvas, ScreenMode
+else:
+ from pyglet import compat_platform
+ if compat_platform == 'darwin':
+ from pyglet import options as pyglet_options
+ if pyglet_options['darwin_cocoa']:
+ from pyglet.canvas.cocoa import CocoaDisplay as Display
+ from pyglet.canvas.cocoa import CocoaScreen as Screen
+ from pyglet.canvas.cocoa import CocoaCanvas as Canvas
+ else:
+ from pyglet.canvas.carbon import CarbonDisplay as Display
+ from pyglet.canvas.carbon import CarbonScreen as Screen
+ from pyglet.canvas.carbon import CarbonCanvas as Canvas
+ elif compat_platform in ('win32', 'cygwin'):
+ from pyglet.canvas.win32 import Win32Display as Display
+ from pyglet.canvas.win32 import Win32Screen as Screen
+ from pyglet.canvas.win32 import Win32Canvas as Canvas
+ else:
+ from pyglet.canvas.xlib import XlibDisplay as Display
+ from pyglet.canvas.xlib import XlibScreen as Screen
+ from pyglet.canvas.xlib import XlibCanvas as Canvas
\ No newline at end of file
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/base.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/base.py
new file mode 100644
index 0000000..1b7f5ba
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/base.py
@@ -0,0 +1,331 @@
+from builtins import object
+#!/usr/bin/python
+# $Id:$
+
+from pyglet import app
+from pyglet import gl
+from pyglet import window
+
+class Display(object):
+ '''A display device supporting one or more screens.
+
+ .. versionadded:: 1.2
+ '''
+
+ name = None
+ '''Name of this display, if applicable.
+
+ :type: str
+ '''
+
+ x_screen = None
+ '''The X11 screen number of this display, if applicable.
+
+ :type: int
+ '''
+
+ def __init__(self, name=None, x_screen=None):
+ '''Create a display connection for the given name and screen.
+
+ On X11, :attr:`name` is of the form ``"hostname:display"``, where the
+ default is usually ``":1"``. On X11, :attr:`x_screen` gives the X
+ screen number to use with this display. A pyglet display can only be
+ used with one X screen; open multiple display connections to access
+ multiple X screens.
+
+ Note that TwinView, Xinerama, xrandr and other extensions present
+ multiple monitors on a single X screen; this is usually the preferred
+ mechanism for working with multiple monitors under X11 and allows each
+ screen to be accessed through a single pyglet`~pyglet.canvas.Display`
+
+ On platforms other than X11, :attr:`name` and :attr:`x_screen` are
+ ignored; there is only a single display device on these systems.
+
+ :Parameters:
+ name : str
+ The name of the display to connect to.
+ x_screen : int
+ The X11 screen number to use.
+
+ '''
+ app.displays.add(self)
+
+ def get_screens(self):
+ '''Get the available screens.
+
+ A typical multi-monitor workstation comprises one :class`~pyglet.canvas.Display`
+ with multiple :class:`Screen` s. This method returns a list of
+ screens which can be enumerated to select one for full-screen display.
+
+ For the purposes of creating an OpenGL config, the default screen
+ will suffice.
+
+ :rtype: list of :class:`Screen`
+ '''
+ raise NotImplementedError('abstract')
+
+ def get_default_screen(self):
+ '''Get the default screen as specified by the user's operating system
+ preferences.
+
+ :rtype: :class:`Screen`
+ '''
+ return self.get_screens()[0]
+
+ def get_windows(self):
+ '''Get the windows currently attached to this display.
+
+ :rtype: sequence of :class:`~pyglet.window.Window`
+ '''
+ return [window for window in app.windows if window.display is self]
+
+class Screen(object):
+ '''A virtual monitor that supports fullscreen windows.
+
+ Screens typically map onto a physical display such as a
+ monitor, television or projector. Selecting a screen for a window
+ has no effect unless the window is made fullscreen, in which case
+ the window will fill only that particular virtual screen.
+
+ The :attr:`width` and :attr:`height` attributes of a screen give the
+ current resolution of the screen. The :attr:`x` and :attr:`y` attributes
+ give the global location of the top-left corner of the screen. This is
+ useful for determining if screens are arranged above or next to one
+ another.
+
+ Use :func:`~Display.get_screens` or :func:`~Display.get_default_screen`
+ to obtain an instance of this class.
+ '''
+
+ def __init__(self, display, x, y, width, height):
+ '''
+
+ :parameters:
+ `display` : `~pyglet.canvas.Display`
+ :attr:`display`
+ `x` : int
+ Left edge :attr:`x`
+ `y` : int
+ Top edge :attr:`y`
+ `width` : int
+ :attr:`width`
+ `height` : int
+ :attr:`height`
+ '''
+ self.display = display
+ '''Display this screen belongs to.'''
+ self.x = x
+ '''Left edge of the screen on the virtual desktop.'''
+ self.y = y
+ '''Top edge of the screen on the virtual desktop.'''
+ self.width = width
+ '''Width of the screen, in pixels.'''
+ self.height = height
+ '''Height of the screen, in pixels.'''
+
+ def __repr__(self):
+ return '%s(x=%d, y=%d, width=%d, height=%d)' % \
+ (self.__class__.__name__, self.x, self.y, self.width, self.height)
+
+ def get_best_config(self, template=None):
+ '''Get the best available GL config.
+
+ Any required attributes can be specified in `template`. If
+ no configuration matches the template,
+ :class:`~pyglet.window.NoSuchConfigException` will be raised.
+
+ :deprecated: Use :meth:`pyglet.gl.Config.match`.
+
+ :Parameters:
+ `template` : `pyglet.gl.Config`
+ A configuration with desired attributes filled in.
+
+ :rtype: :class:`~pyglet.gl.Config`
+ :return: A configuration supported by the platform that best
+ fulfils the needs described by the template.
+ '''
+ configs = None
+ if template is None:
+ for template_config in [
+ gl.Config(double_buffer=True, depth_size=24),
+ gl.Config(double_buffer=True, depth_size=16),
+ None]:
+ try:
+ configs = self.get_matching_configs(template_config)
+ break
+ except NoSuchConfigException:
+ pass
+ else:
+ configs = self.get_matching_configs(template)
+ if not configs:
+ raise window.NoSuchConfigException()
+ return configs[0]
+
+ def get_matching_configs(self, template):
+ '''Get a list of configs that match a specification.
+
+ Any attributes specified in `template` will have values equal
+ to or greater in each returned config. If no configs satisfy
+ the template, an empty list is returned.
+
+ :deprecated: Use :meth:`pyglet.gl.Config.match`.
+
+ :Parameters:
+ `template` : `pyglet.gl.Config`
+ A configuration with desired attributes filled in.
+
+ :rtype: list of :class:`~pyglet.gl.Config`
+ :return: A list of matching configs.
+ '''
+ raise NotImplementedError('abstract')
+
+ def get_modes(self):
+ '''Get a list of screen modes supported by this screen.
+
+ :rtype: list of :class:`ScreenMode`
+
+ .. versionadded:: 1.2
+ '''
+ raise NotImplementedError('abstract')
+
+ def get_mode(self):
+ '''Get the current display mode for this screen.
+
+ :rtype: :class:`ScreenMode`
+
+ .. versionadded:: 1.2
+ '''
+ raise NotImplementedError('abstract')
+
+ def get_closest_mode(self, width, height):
+ '''Get the screen mode that best matches a given size.
+
+ If no supported mode exactly equals the requested size, a larger one
+ is returned; or ``None`` if no mode is large enough.
+
+ :Parameters:
+ `width` : int
+ Requested screen width.
+ `height` : int
+ Requested screen height.
+
+ :rtype: :class:`ScreenMode`
+
+ .. versionadded:: 1.2
+ '''
+ # Best mode is one with smallest resolution larger than width/height,
+ # with depth and refresh rate equal to current mode.
+ current = self.get_mode()
+
+ best = None
+ for mode in self.get_modes():
+ # Reject resolutions that are too small
+ if mode.width < width or mode.height < height:
+ continue
+
+ if best is None:
+ best = mode
+
+ # Must strictly dominate dimensions
+ if (mode.width <= best.width and mode.height <= best.height and
+ (mode.width < best.width or mode.height < best.height)):
+ best = mode
+
+ # Preferably match rate, then depth.
+ if mode.width == best.width and mode.height == best.height:
+ points = 0
+ if mode.rate == current.rate:
+ points += 2
+ if best.rate == current.rate:
+ points -= 2
+ if mode.depth == current.depth:
+ points += 1
+ if best.depth == current.depth:
+ points -= 1
+ if points > 0:
+ best = mode
+ return best
+
+ def set_mode(self, mode):
+ '''Set the display mode for this screen.
+
+ The mode must be one previously returned by :meth:`get_mode` or
+ :meth:`get_modes`.
+
+ :Parameters:
+ `mode` : `ScreenMode`
+ Screen mode to switch this screen to.
+
+ '''
+ raise NotImplementedError('abstract')
+
+ def restore_mode(self):
+ '''Restore the screen mode to the user's default.
+ '''
+ raise NotImplementedError('abstract')
+
+class ScreenMode(object):
+ '''Screen resolution and display settings.
+
+ Applications should not construct `ScreenMode` instances themselves; see
+ :meth:`Screen.get_modes`.
+
+ The :attr:`depth` and :attr:`rate` variables may be ``None`` if the
+ operating system does not provide relevant data.
+
+ .. versionadded:: 1.2
+
+ '''
+
+ width = None
+ '''Width of screen, in pixels.
+
+ :type: int
+ '''
+ height = None
+ '''Height of screen, in pixels.
+
+ :type: int
+ '''
+ depth = None
+ '''Pixel color depth, in bits per pixel.
+
+ :type: int
+ '''
+ rate = None
+ '''Screen refresh rate in Hz.
+
+ :type: int
+ '''
+
+ def __init__(self, screen):
+ '''
+
+ :parameters:
+ `screen` : `Screen`
+ '''
+ self.screen = screen
+
+ def __repr__(self):
+ return '%s(width=%r, height=%r, depth=%r, rate=%r)' % (
+ self.__class__.__name__,
+ self.width, self.height, self.depth, self.rate)
+
+class Canvas(object):
+ '''Abstract drawing area.
+
+ Canvases are used internally by pyglet to represent drawing areas --
+ either within a window or full-screen.
+
+ .. versionadded:: 1.2
+ '''
+ def __init__(self, display):
+ '''
+
+ :parameters:
+ `display` : `Display`
+ :attr:`display`
+
+ '''
+ self.display = display
+ '''Display this canvas was created on.'''
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/carbon.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/carbon.py
new file mode 100644
index 0000000..c14e15c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/carbon.py
@@ -0,0 +1,254 @@
+#!/usr/bin/env python
+
+'''
+'''
+from __future__ import absolute_import
+from builtins import range
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+from pyglet import app
+from .base import Display, Screen, ScreenMode, Canvas
+
+from pyglet.libs.darwin import *
+from pyglet.libs.darwin import _oscheck
+
+class CarbonDisplay(Display):
+ # TODO: CarbonDisplay could be per display device, which would make
+ # reporting of screens and available configs more accurate. The number of
+ # Macs with more than one video card is probably small, though.
+ def __init__(self):
+ super(CarbonDisplay, self).__init__()
+
+ import MacOS
+ if not MacOS.WMAvailable():
+ raise app.AppException('Window manager is not available. ' \
+ 'Ensure you run "pythonw", not "python"')
+
+ self._install_application_event_handlers()
+
+ def get_screens(self):
+ count = CGDisplayCount()
+ carbon.CGGetActiveDisplayList(0, None, byref(count))
+ displays = (CGDirectDisplayID * count.value)()
+ carbon.CGGetActiveDisplayList(count.value, displays, byref(count))
+ return [CarbonScreen(self, id) for id in displays]
+
+ def _install_application_event_handlers(self):
+ self._carbon_event_handlers = []
+ self._carbon_event_handler_refs = []
+
+ target = carbon.GetApplicationEventTarget()
+
+ # TODO something with a metaclass or hacky like CarbonWindow
+ # to make this list extensible
+ handlers = [
+ (self._on_mouse_down, kEventClassMouse, kEventMouseDown),
+ (self._on_apple_event, kEventClassAppleEvent, kEventAppleEvent),
+ (self._on_command, kEventClassCommand, kEventProcessCommand),
+ ]
+
+ ae_handlers = [
+ (self._on_ae_quit, kCoreEventClass, kAEQuitApplication),
+ ]
+
+ # Install the application-wide handlers
+ for method, cls, event in handlers:
+ proc = EventHandlerProcPtr(method)
+ self._carbon_event_handlers.append(proc)
+ upp = carbon.NewEventHandlerUPP(proc)
+ types = EventTypeSpec()
+ types.eventClass = cls
+ types.eventKind = event
+ handler_ref = EventHandlerRef()
+ carbon.InstallEventHandler(
+ target,
+ upp,
+ 1,
+ byref(types),
+ c_void_p(),
+ byref(handler_ref))
+ self._carbon_event_handler_refs.append(handler_ref)
+
+ # Install Apple event handlers
+ for method, cls, event in ae_handlers:
+ proc = EventHandlerProcPtr(method)
+ self._carbon_event_handlers.append(proc)
+ upp = carbon.NewAEEventHandlerUPP(proc)
+ carbon.AEInstallEventHandler(
+ cls,
+ event,
+ upp,
+ 0,
+ False)
+
+ def _on_command(self, next_handler, ev, data):
+ command = HICommand()
+ carbon.GetEventParameter(ev, kEventParamDirectObject,
+ typeHICommand, c_void_p(), sizeof(command), c_void_p(),
+ byref(command))
+
+ if command.commandID == kHICommandQuit:
+ self._on_quit()
+
+ return noErr
+
+ def _on_mouse_down(self, next_handler, ev, data):
+ # Check for menubar hit
+ position = Point()
+ carbon.GetEventParameter(ev, kEventParamMouseLocation,
+ typeQDPoint, c_void_p(), sizeof(position), c_void_p(),
+ byref(position))
+ if carbon.FindWindow(position, None) == inMenuBar:
+ # Mouse down in menu bar. MenuSelect() takes care of all
+ # menu tracking and blocks until the menu is dismissed.
+ # Use command events to handle actual menu item invokations.
+
+ # This function blocks, so tell the event loop it needs to install
+ # a timer.
+ app.event_loop.enter_blocking()
+ carbon.MenuSelect(position)
+ app.event_loop.exit_blocking()
+
+ # Menu selection has now returned. Remove highlight from the
+ # menubar.
+ carbon.HiliteMenu(0)
+
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ def _on_apple_event(self, next_handler, ev, data):
+ # Somewhat involved way of redispatching Apple event contained
+ # within a Carbon event, described in
+ # http://developer.apple.com/documentation/AppleScript/
+ # Conceptual/AppleEvents/dispatch_aes_aepg/chapter_4_section_3.html
+
+ release = False
+ if carbon.IsEventInQueue(carbon.GetMainEventQueue(), ev):
+ carbon.RetainEvent(ev)
+ release = True
+ carbon.RemoveEventFromQueue(carbon.GetMainEventQueue(), ev)
+
+ ev_record = EventRecord()
+ carbon.ConvertEventRefToEventRecord(ev, byref(ev_record))
+ carbon.AEProcessAppleEvent(byref(ev_record))
+
+ if release:
+ carbon.ReleaseEvent(ev)
+
+ return noErr
+
+ def _on_ae_quit(self, ae, reply, refcon):
+ self._on_quit()
+ return noErr
+
+ def _on_quit(self):
+ '''Called when the user tries to quit the application.
+
+ This is not an actual event handler, it is called in response
+ to Command+Q, the Quit menu item, and the Dock context menu's Quit
+ item.
+
+ The default implementation calls `EventLoop.exit` on
+ `pyglet.app.event_loop`.
+ '''
+ app.event_loop.exit()
+
+class CarbonScreen(Screen):
+ _initial_mode = None
+
+ def __init__(self, display, id):
+ self.display = display
+ rect = carbon.CGDisplayBounds(id)
+ super(CarbonScreen, self).__init__(display,
+ int(rect.origin.x), int(rect.origin.y),
+ int(rect.size.width), int(rect.size.height))
+ self.id = id
+
+ mode = carbon.CGDisplayCurrentMode(id)
+ kCGDisplayRefreshRate = create_cfstring('RefreshRate')
+ number = carbon.CFDictionaryGetValue(mode, kCGDisplayRefreshRate)
+ refresh = c_long()
+ kCFNumberLongType = 10
+ carbon.CFNumberGetValue(number, kCFNumberLongType, byref(refresh))
+ self._refresh_rate = refresh.value
+
+ def get_gdevice(self):
+ gdevice = POINTER(None)()
+ _oscheck(carbon.DMGetGDeviceByDisplayID(self.id, byref(gdevice), False))
+ return gdevice
+
+ def get_matching_configs(self, template):
+ canvas = CarbonCanvas(self.display, self, None)
+ configs = template.match(canvas)
+ # XXX deprecate
+ for config in configs:
+ config.screen = self
+ return configs
+
+ def get_modes(self):
+ modes_array = carbon.CGDisplayAvailableModes(self.id)
+ n_modes_array = carbon.CFArrayGetCount(modes_array)
+
+ modes = []
+ for i in range(n_modes_array):
+ mode = carbon.CFArrayGetValueAtIndex(modes_array, i)
+ modes.append(CarbonScreenMode(self, mode))
+
+ return modes
+
+ def get_mode(self):
+ mode = carbon.CGDisplayCurrentMode(self.id)
+ return CarbonScreenMode(self, mode)
+
+ def set_mode(self, mode):
+ assert mode.screen is self
+ if not self._initial_mode:
+ self._initial_mode = self.get_mode()
+
+ _oscheck(carbon.CGDisplayCapture(self.id))
+ _oscheck(carbon.CGDisplaySwitchToMode(self.id, mode.mode))
+ self.width = mode.width
+ self.height = mode.height
+
+ def restore_mode(self):
+ if self._initial_mode:
+ _oscheck(carbon.CGDisplaySwitchToMode(self.id,
+ self._initial_mode.mode))
+ _oscheck(carbon.CGDisplayRelease(self.id))
+
+class CarbonScreenMode(ScreenMode):
+ def __init__(self, screen, mode):
+ super(CarbonScreenMode, self).__init__(screen)
+ self.mode = mode
+ self.width = self._get_long('Width')
+ self.height = self._get_long('Height')
+ self.depth = self._get_long('BitsPerPixel')
+ self.rate = self._get_long('RefreshRate')
+
+ def _get_long(self, key):
+ kCFNumberLongType = 10
+ cfkey = create_cfstring(key)
+ number = carbon.CFDictionaryGetValue(self.mode, cfkey)
+ if not number:
+ return None
+ value = c_long()
+ carbon.CFNumberGetValue(number, kCFNumberLongType, byref(value))
+ return value.value
+
+class CarbonCanvas(Canvas):
+ bounds = None
+
+ def __init__(self, display, screen, drawable):
+ super(CarbonCanvas, self).__init__(display)
+ self.screen = screen
+ self.drawable = drawable
+
+class CarbonFullScreenCanvas(Canvas):
+ # XXX not used any more.
+ def __init__(self, display, screen, width, height):
+ super(CarbonFullScreenCanvas, self).__init__(display)
+ self.screen = screen
+ self.width = width
+ self.height = height
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/cocoa.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/cocoa.py
new file mode 100644
index 0000000..f9d680b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/cocoa.py
@@ -0,0 +1,135 @@
+# Note: The display mode API used here is Mac OS 10.6 only.
+
+'''
+'''
+from __future__ import absolute_import
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+from ctypes import *
+from ctypes import util
+
+from pyglet import app
+from .base import Display, Screen, ScreenMode, Canvas
+
+from pyglet.libs.darwin.cocoapy import *
+
+
+class CocoaDisplay(Display):
+
+ def get_screens(self):
+ maxDisplays = 256
+ activeDisplays = (CGDirectDisplayID * maxDisplays)()
+ count = c_uint32()
+ quartz.CGGetActiveDisplayList(maxDisplays, activeDisplays, byref(count))
+ return [CocoaScreen(self, displayID) for displayID in list(activeDisplays)[:count.value]]
+
+
+class CocoaScreen(Screen):
+
+ def __init__(self, display, displayID):
+ bounds = quartz.CGDisplayBounds(displayID)
+ # FIX ME:
+ # Probably need to convert the origin coordinates depending on context:
+ # http://www.cocoabuilder.com/archive/cocoa/233492-ns-cg-rect-conversion-and-screen-coordinates.html
+ x, y = bounds.origin.x, bounds.origin.y
+ width, height = bounds.size.width, bounds.size.height
+ super(CocoaScreen, self).__init__(display, int(x), int(y), int(width), int(height))
+ self._cg_display_id = displayID
+ # Save the default mode so we can restore to it.
+ self._default_mode = self.get_mode()
+
+ # FIX ME:
+ # This method is needed to get multi-monitor support working properly.
+ # However the NSScreens.screens() message currently sends out a warning:
+ # "*** -[NSLock unlock]: lock ( '(null)') unlocked when not locked"
+ # on Snow Leopard and apparently causes python to crash on Lion.
+ #
+ # def get_nsscreen(self):
+ # """Returns the NSScreen instance that matches our CGDirectDisplayID."""
+ # NSScreen = ObjCClass('NSScreen')
+ # # Get a list of all currently active NSScreens and then search through
+ # # them until we find one that matches our CGDisplayID.
+ # screen_array = NSScreen.screens()
+ # count = screen_array.count()
+ # for i in range(count):
+ # nsscreen = screen_array.objectAtIndex_(i)
+ # screenInfo = nsscreen.deviceDescription()
+ # displayID = screenInfo.objectForKey_(get_NSString('NSScreenNumber'))
+ # displayID = displayID.intValue()
+ # if displayID == self._cg_display_id:
+ # return nsscreen
+ # return None
+
+ def get_matching_configs(self, template):
+ canvas = CocoaCanvas(self.display, self, None)
+ return template.match(canvas)
+
+ def get_modes(self):
+ cgmodes = c_void_p(quartz.CGDisplayCopyAllDisplayModes(self._cg_display_id, None))
+ modes = [ CocoaScreenMode(self, cgmode) for cgmode in cfarray_to_list(cgmodes) ]
+ cf.CFRelease(cgmodes)
+ return modes
+
+ def get_mode(self):
+ cgmode = c_void_p(quartz.CGDisplayCopyDisplayMode(self._cg_display_id))
+ mode = CocoaScreenMode(self, cgmode)
+ quartz.CGDisplayModeRelease(cgmode)
+ return mode
+
+ def set_mode(self, mode):
+ assert mode.screen is self
+ quartz.CGDisplayCapture(self._cg_display_id)
+ quartz.CGDisplaySetDisplayMode(self._cg_display_id, mode.cgmode, None)
+ self.width = mode.width
+ self.height = mode.height
+
+ def restore_mode(self):
+ quartz.CGDisplaySetDisplayMode(self._cg_display_id, self._default_mode.cgmode, None)
+ quartz.CGDisplayRelease(self._cg_display_id)
+
+ def capture_display(self):
+ quartz.CGDisplayCapture(self._cg_display_id)
+
+ def release_display(self):
+ quartz.CGDisplayRelease(self._cg_display_id)
+
+
+class CocoaScreenMode(ScreenMode):
+
+ def __init__(self, screen, cgmode):
+ super(CocoaScreenMode, self).__init__(screen)
+ quartz.CGDisplayModeRetain(cgmode)
+ self.cgmode = cgmode
+ self.width = int(quartz.CGDisplayModeGetWidth(cgmode))
+ self.height = int(quartz.CGDisplayModeGetHeight(cgmode))
+ self.depth = self.getBitsPerPixel(cgmode)
+ self.rate = quartz.CGDisplayModeGetRefreshRate(cgmode)
+
+ def __del__(self):
+ quartz.CGDisplayModeRelease(self.cgmode)
+ self.cgmode = None
+
+ def getBitsPerPixel(self, cgmode):
+ # from /System/Library/Frameworks/IOKit.framework/Headers/graphics/IOGraphicsTypes.h
+ IO8BitIndexedPixels = "PPPPPPPP"
+ IO16BitDirectPixels = "-RRRRRGGGGGBBBBB"
+ IO32BitDirectPixels = "--------RRRRRRRRGGGGGGGGBBBBBBBB"
+
+ cfstring = c_void_p(quartz.CGDisplayModeCopyPixelEncoding(cgmode))
+ pixelEncoding = cfstring_to_string(cfstring)
+ cf.CFRelease(cfstring)
+
+ if pixelEncoding == IO8BitIndexedPixels: return 8
+ if pixelEncoding == IO16BitDirectPixels: return 16
+ if pixelEncoding == IO32BitDirectPixels: return 32
+ return 0
+
+
+class CocoaCanvas(Canvas):
+
+ def __init__(self, display, screen, nsview):
+ super(CocoaCanvas, self).__init__(display)
+ self.screen = screen
+ self.nsview = nsview
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/win32.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/win32.py
new file mode 100644
index 0000000..41ffcde
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/win32.py
@@ -0,0 +1,102 @@
+#!/usr/bin/python
+# $Id:$
+
+from __future__ import absolute_import
+from .base import Display, Screen, ScreenMode, Canvas
+
+from pyglet.libs.win32 import _kernel32, _user32, types, constants
+from pyglet.libs.win32.constants import *
+from pyglet.libs.win32.types import *
+
+class Win32Display(Display):
+ def get_screens(self):
+ screens = []
+ def enum_proc(hMonitor, hdcMonitor, lprcMonitor, dwData):
+ r = lprcMonitor.contents
+ width = r.right - r.left
+ height = r.bottom - r.top
+ screens.append(
+ Win32Screen(self, hMonitor, r.left, r.top, width, height))
+ return True
+ enum_proc_ptr = MONITORENUMPROC(enum_proc)
+ _user32.EnumDisplayMonitors(None, None, enum_proc_ptr, 0)
+ return screens
+
+class Win32Screen(Screen):
+ _initial_mode = None
+
+ def __init__(self, display, handle, x, y, width, height):
+ super(Win32Screen, self).__init__(display, x, y, width, height)
+ self._handle = handle
+
+ def get_matching_configs(self, template):
+ canvas = Win32Canvas(self.display, 0, _user32.GetDC(0))
+ configs = template.match(canvas)
+ # XXX deprecate config's being screen-specific
+ for config in configs:
+ config.screen = self
+ return configs
+
+ def get_device_name(self):
+ info = MONITORINFOEX()
+ info.cbSize = sizeof(MONITORINFOEX)
+ _user32.GetMonitorInfoW(self._handle, byref(info))
+ return info.szDevice
+
+ def get_modes(self):
+ device_name = self.get_device_name()
+ i = 0
+ modes = []
+ while True:
+ mode = DEVMODE()
+ mode.dmSize = sizeof(DEVMODE)
+ r = _user32.EnumDisplaySettingsW(device_name, i, byref(mode))
+ if not r:
+ break
+
+ modes.append(Win32ScreenMode(self, mode))
+ i += 1
+
+ return modes
+
+ def get_mode(self):
+ mode = DEVMODE()
+ mode.dmSize = sizeof(DEVMODE)
+ _user32.EnumDisplaySettingsW(self.get_device_name(),
+ ENUM_CURRENT_SETTINGS,
+ byref(mode))
+ return Win32ScreenMode(self, mode)
+
+ def set_mode(self, mode):
+ assert mode.screen is self
+
+ if not self._initial_mode:
+ self._initial_mode = self.get_mode()
+ r = _user32.ChangeDisplaySettingsExW(self.get_device_name(),
+ byref(mode._mode),
+ None,
+ CDS_FULLSCREEN,
+ None)
+ if r == DISP_CHANGE_SUCCESSFUL:
+ self.width = mode.width
+ self.height = mode.height
+
+ def restore_mode(self):
+ if self._initial_mode:
+ self.set_mode(self._initial_mode)
+
+class Win32ScreenMode(ScreenMode):
+ def __init__(self, screen, mode):
+ super(Win32ScreenMode, self).__init__(screen)
+ self._mode = mode
+ self.width = mode.dmPelsWidth
+ self.height = mode.dmPelsHeight
+ self.depth = mode.dmBitsPerPel
+ self.rate = mode.dmDisplayFrequency
+
+class Win32Canvas(Canvas):
+ def __init__(self, display, hwnd, hdc):
+ super(Win32Canvas, self).__init__(display)
+ self.hwnd = hwnd
+ self.hdc = hdc
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/xlib.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/xlib.py
new file mode 100644
index 0000000..24ad4c5
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/xlib.py
@@ -0,0 +1,263 @@
+#!/usr/bin/env python
+
+'''
+'''
+from __future__ import print_function
+from __future__ import absolute_import
+from builtins import range
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+from ctypes import *
+import ctypes
+
+from pyglet import app
+from pyglet.app.xlib import XlibSelectDevice
+from .base import Display, Screen, ScreenMode, Canvas
+
+from . import xlib_vidmoderestore
+
+# XXX
+#from pyglet.window import NoSuchDisplayException
+class NoSuchDisplayException(Exception):
+ pass
+
+from pyglet.libs.x11 import xlib
+try:
+ from pyglet.libs.x11 import xinerama
+ _have_xinerama = True
+except:
+ _have_xinerama = False
+
+try:
+ from pyglet.libs.x11 import xsync
+ _have_xsync = True
+except:
+ _have_xsync = False
+
+try:
+ from pyglet.libs.x11 import xf86vmode
+ _have_xf86vmode = True
+except:
+ _have_xf86vmode = False
+
+# Set up error handler
+def _error_handler(display, event):
+ # By default, all errors are silently ignored: this has a better chance
+ # of working than the default behaviour of quitting ;-)
+ #
+ # We've actually never seen an error that was our fault; they're always
+ # driver bugs (and so the reports are useless). Nevertheless, set
+ # environment variable PYGLET_DEBUG_X11 to 1 to get dumps of the error
+ # and a traceback (execution will continue).
+ import pyglet
+ if pyglet.options['debug_x11']:
+ event = event.contents
+ buf = c_buffer(1024)
+ xlib.XGetErrorText(display, event.error_code, buf, len(buf))
+ print('X11 error:', buf.value)
+ print(' serial:', event.serial)
+ print(' request:', event.request_code)
+ print(' minor:', event.minor_code)
+ print(' resource:', event.resourceid)
+
+ import traceback
+ print('Python stack trace (innermost last):')
+ traceback.print_stack()
+ return 0
+_error_handler_ptr = xlib.XErrorHandler(_error_handler)
+xlib.XSetErrorHandler(_error_handler_ptr)
+
+class XlibDisplay(XlibSelectDevice, Display):
+ _display = None # POINTER(xlib.Display)
+
+ _x_im = None # X input method
+ # TODO close _x_im when display connection closed.
+ _enable_xsync = False
+ _screens = None # Cache of get_screens()
+
+ def __init__(self, name=None, x_screen=None):
+ if x_screen is None:
+ x_screen = 0
+
+ self._display = xlib.XOpenDisplay(name)
+ if not self._display:
+ raise NoSuchDisplayException('Cannot connect to "%s"' % name)
+
+ screen_count = xlib.XScreenCount(self._display)
+ if x_screen >= screen_count:
+ raise NoSuchDisplayException(
+ 'Display "%s" has no screen %d' % (name, x_screen))
+
+ super(XlibDisplay, self).__init__()
+ self.name = name
+ self.x_screen = x_screen
+
+ self._fileno = xlib.XConnectionNumber(self._display)
+ self._window_map = {}
+
+ # Initialise XSync
+ if _have_xsync:
+ event_base = c_int()
+ error_base = c_int()
+ if xsync.XSyncQueryExtension(self._display,
+ byref(event_base),
+ byref(error_base)):
+ major_version = c_int()
+ minor_version = c_int()
+ if xsync.XSyncInitialize(self._display,
+ byref(major_version),
+ byref(minor_version)):
+ self._enable_xsync = True
+
+ # Add to event loop select list. Assume we never go away.
+ app.platform_event_loop._select_devices.add(self)
+
+ def get_screens(self):
+ if self._screens:
+ return self._screens
+
+ if _have_xinerama and xinerama.XineramaIsActive(self._display):
+ number = c_int()
+ infos = xinerama.XineramaQueryScreens(self._display,
+ byref(number))
+ infos = cast(infos,
+ POINTER(xinerama.XineramaScreenInfo * number.value)).contents
+ self._screens = []
+ using_xinerama = number.value > 1
+ for info in infos:
+ self._screens.append(XlibScreen(self,
+ info.x_org,
+ info.y_org,
+ info.width,
+ info.height,
+ using_xinerama))
+ xlib.XFree(infos)
+ else:
+ # No xinerama
+ screen_info = xlib.XScreenOfDisplay(self._display, self.x_screen)
+ screen = XlibScreen(self,
+ 0, 0,
+ screen_info.contents.width,
+ screen_info.contents.height,
+ False)
+ self._screens = [screen]
+ return self._screens
+
+ # XlibSelectDevice interface
+
+ def fileno(self):
+ return self._fileno
+
+ def select(self):
+ e = xlib.XEvent()
+ while xlib.XPending(self._display):
+ xlib.XNextEvent(self._display, e)
+
+ # Key events are filtered by the xlib window event
+ # handler so they get a shot at the prefiltered event.
+ if e.xany.type not in (xlib.KeyPress, xlib.KeyRelease):
+ if xlib.XFilterEvent(e, e.xany.window):
+ continue
+ try:
+ dispatch = self._window_map[e.xany.window]
+ except KeyError:
+ continue
+
+ dispatch(e)
+
+ def poll(self):
+ return xlib.XPending(self._display)
+
+class XlibScreen(Screen):
+ _initial_mode = None
+
+ def __init__(self, display, x, y, width, height, xinerama):
+ super(XlibScreen, self).__init__(display, x, y, width, height)
+ self._xinerama = xinerama
+
+ def get_matching_configs(self, template):
+ canvas = XlibCanvas(self.display, None)
+ configs = template.match(canvas)
+ # XXX deprecate
+ for config in configs:
+ config.screen = self
+ return configs
+
+ def get_modes(self):
+ if not _have_xf86vmode:
+ return []
+
+ if self._xinerama:
+ # If Xinerama/TwinView is enabled, xf86vidmode's modelines
+ # correspond to metamodes, which don't distinguish one screen from
+ # another. XRandR (broken) or NV (complicated) extensions needed.
+ return []
+
+ count = ctypes.c_int()
+ info_array = \
+ ctypes.POINTER(ctypes.POINTER(xf86vmode.XF86VidModeModeInfo))()
+ xf86vmode.XF86VidModeGetAllModeLines(
+ self.display._display, self.display.x_screen, count, info_array)
+
+ # Copy modes out of list and free list
+ modes = []
+ for i in range(count.value):
+ info = xf86vmode.XF86VidModeModeInfo()
+ ctypes.memmove(ctypes.byref(info),
+ ctypes.byref(info_array.contents[i]),
+ ctypes.sizeof(info))
+ modes.append(XlibScreenMode(self, info))
+ if info.privsize:
+ xlib.XFree(info.private)
+ xlib.XFree(info_array)
+
+ return modes
+
+ def get_mode(self):
+ modes = self.get_modes()
+ if modes:
+ return modes[0]
+ return None
+
+ def set_mode(self, mode):
+ assert mode.screen is self
+
+ if not self._initial_mode:
+ self._initial_mode = self.get_mode()
+ xlib_vidmoderestore.set_initial_mode(self._initial_mode)
+
+ xf86vmode.XF86VidModeSwitchToMode(self.display._display,
+ self.display.x_screen, mode.info)
+ xlib.XFlush(self.display._display)
+ xf86vmode.XF86VidModeSetViewPort(self.display._display,
+ self.display.x_screen, 0, 0)
+ xlib.XFlush(self.display._display)
+
+ self.width = mode.width
+ self.height = mode.height
+
+ def restore_mode(self):
+ if self._initial_mode:
+ self.set_mode(self._initial_mode)
+
+ def __repr__(self):
+ return 'XlibScreen(display=%r, x=%d, y=%d, ' \
+ 'width=%d, height=%d, xinerama=%d)' % \
+ (self.display, self.x, self.y, self.width, self.height,
+ self._xinerama)
+
+class XlibScreenMode(ScreenMode):
+ def __init__(self, screen, info):
+ super(XlibScreenMode, self).__init__(screen)
+ self.info = info
+ self.width = info.hdisplay
+ self.height = info.vdisplay
+ self.rate = info.dotclock
+ self.depth = None
+
+class XlibCanvas(Canvas):
+ def __init__(self, display, x_window):
+ super(XlibCanvas, self).__init__(display)
+ self.x_window = x_window
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/xlib_vidmoderestore.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/xlib_vidmoderestore.py
new file mode 100644
index 0000000..e662596
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/canvas/xlib_vidmoderestore.py
@@ -0,0 +1,172 @@
+#!/usr/bin/python
+# $Id: $
+
+'''Fork a child process and inform it of mode changes to each screen. The
+child waits until the parent process dies, and then connects to each X server
+with a mode change and restores the mode.
+
+This emulates the behaviour of Windows and Mac, so that resolution changes
+made by an application are not permanent after the program exits, even if
+the process is terminated uncleanly.
+
+The child process is communicated to via a pipe, and watches for parent
+death with a Linux extension signal handler.
+'''
+from builtins import object
+
+import ctypes
+import os
+import signal
+import struct
+import threading
+
+from pyglet.libs.x11 import xlib
+from pyglet.compat import asbytes
+try:
+ from pyglet.libs.x11 import xf86vmode
+except:
+ # No xf86vmode... should not be switching modes.
+ pass
+
+_restore_mode_child_installed = False
+_restorable_screens = set()
+_mode_write_pipe = None
+
+# Mode packets tell the child process how to restore a given display and
+# screen. Only one packet should be sent per display/screen (more would
+# indicate redundancy or incorrect restoration). Packet format is:
+# display (max 256 chars),
+# screen
+# width
+# height
+# rate
+class ModePacket(object):
+ format = '256siHHI'
+ size = struct.calcsize(format)
+ def __init__(self, display, screen, width, height, rate):
+ self.display = display
+ self.screen = screen
+ self.width = width
+ self.height = height
+ self.rate = rate
+
+ def encode(self):
+ return struct.pack(self.format, self.display, self.screen,
+ self.width, self.height, self.rate)
+
+ @classmethod
+ def decode(cls, data):
+ display, screen, width, height, rate = \
+ struct.unpack(cls.format, data)
+ return cls(display.strip(asbytes('\0')), screen, width, height, rate)
+
+ def __repr__(self):
+ return '%s(%r, %r, %r, %r, %r)' % (
+ self.__class__.__name__, self.display, self.screen,
+ self.width, self.height, self.rate)
+
+ def set(self):
+ display = xlib.XOpenDisplay(self.display)
+ modes, n_modes = get_modes_array(display, self.screen)
+ mode = get_matching_mode(modes, n_modes,
+ self.width, self.height, self.rate)
+ if mode is not None:
+ xf86vmode.XF86VidModeSwitchToMode(display, self.screen, mode)
+ free_modes_array(modes, n_modes)
+ xlib.XCloseDisplay(display)
+
+def get_modes_array(display, screen):
+ count = ctypes.c_int()
+ modes = ctypes.POINTER(ctypes.POINTER(xf86vmode.XF86VidModeModeInfo))()
+ xf86vmode.XF86VidModeGetAllModeLines(display, screen, count, modes)
+ return modes, count.value
+
+def get_matching_mode(modes, n_modes, width, height, rate):
+ # Copy modes out of list and free list
+ for i in range(n_modes):
+ mode = modes.contents[i]
+ if (mode.hdisplay == width and
+ mode.vdisplay == height and
+ mode.dotclock == rate):
+ return mode
+ return None
+
+def free_modes_array(modes, n_modes):
+ for i in range(n_modes):
+ mode = modes.contents[i]
+ if mode.privsize:
+ xlib.XFree(mode.private)
+ xlib.XFree(modes)
+
+def _install_restore_mode_child():
+ global _mode_write_pipe
+ global _restore_mode_child_installed
+
+ if _restore_mode_child_installed:
+ return
+
+ # Parent communicates to child by sending "mode packets" through a pipe:
+ mode_read_pipe, _mode_write_pipe = os.pipe()
+
+ if os.fork() == 0:
+ # Child process (watches for parent to die then restores video mode(s).
+ os.close(_mode_write_pipe)
+
+ # Set up SIGHUP to be the signal for when the parent dies.
+ PR_SET_PDEATHSIG = 1
+ libc = ctypes.cdll.LoadLibrary('libc.so.6')
+ libc.prctl.argtypes = (ctypes.c_int, ctypes.c_ulong, ctypes.c_ulong,
+ ctypes.c_ulong, ctypes.c_ulong)
+ libc.prctl(PR_SET_PDEATHSIG, signal.SIGHUP, 0, 0, 0)
+
+ # SIGHUP indicates the parent has died. The child lock is unlocked, it
+ # stops reading from the mode packet pipe and restores video modes on
+ # all displays/screens it knows about.
+ def _sighup(signum, frame):
+ parent_wait_lock.release();
+ parent_wait_lock = threading.Lock();
+ parent_wait_lock.acquire()
+ signal.signal(signal.SIGHUP, _sighup)
+
+ # Wait for parent to die and read packets from parent pipe
+ packets = []
+ buffer = asbytes('')
+ while parent_wait_lock.locked():
+ try:
+ data = os.read(mode_read_pipe, ModePacket.size)
+ buffer += data
+ # Decode packets
+ while len(buffer) >= ModePacket.size:
+ packet = ModePacket.decode(buffer[:ModePacket.size])
+ packets.append(packet)
+ buffer = buffer[ModePacket.size:]
+ except OSError:
+ pass # Interrupted system call
+
+ for packet in packets:
+ packet.set()
+ os._exit(0)
+
+ else:
+ # Parent process. Clean up pipe then continue running program as
+ # normal. Send mode packets through pipe as additional
+ # displays/screens are mode switched.
+ os.close(mode_read_pipe)
+ _restore_mode_child_installed = True
+
+def set_initial_mode(mode):
+ _install_restore_mode_child()
+
+ display = xlib.XDisplayString(mode.screen.display._display)
+ screen = mode.screen.display.x_screen
+
+ # Only store one mode per screen.
+ if (display, screen) in _restorable_screens:
+ return
+
+ packet = ModePacket(display, screen, mode.width, mode.height, mode.rate)
+
+ os.write(_mode_write_pipe, packet.encode())
+ _restorable_screens.add((display, screen))
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/clock.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/clock.py
new file mode 100644
index 0000000..d84eb0f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/clock.py
@@ -0,0 +1,1036 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+"""Precise framerate calculation, scheduling and framerate limiting.
+
+Measuring time
+==============
+
+The `tick` and `get_fps` functions can be used in conjunction to fulfil most
+games' basic requirements::
+
+ from pyglet import clock
+ while True:
+ dt = clock.tick()
+ # ... update and render ...
+ print 'FPS is %f' % clock.get_fps()
+
+The ``dt`` value returned gives the number of seconds (as a float) since the
+last "tick".
+
+The `get_fps` function averages the framerate over a sliding window of
+approximately 1 second. (You can calculate the instantaneous framerate by
+taking the reciprocal of ``dt``).
+
+Always remember to `tick` the clock!
+
+Limiting frame-rate
+===================
+
+The framerate can be limited::
+
+ clock.set_fps_limit(60)
+
+This causes :py:class:`~pyglet.clock.Clock` to sleep during each `tick` in an
+attempt to keep the number of ticks (frames) per second below 60.
+
+The implementation uses platform-dependent high-resolution sleep functions
+to achieve better accuracy with busy-waiting than would be possible using
+just the `time` module.
+
+Scheduling
+==========
+
+You can schedule a function to be called every time the clock is ticked::
+
+ def callback(dt):
+ print '%f seconds since last callback' % dt
+
+ clock.schedule(callback)
+
+The `schedule_interval` method causes a function to be called every "n"
+seconds::
+
+ clock.schedule_interval(callback, .5) # called twice a second
+
+The `schedule_once` method causes a function to be called once "n" seconds
+in the future::
+
+ clock.schedule_once(callback, 5) # called in 5 seconds
+
+All of the `schedule` methods will pass on any additional args or keyword args
+you specify to the callback function::
+
+ def animate(dt, velocity, sprite):
+ sprite.position += dt * velocity
+
+ clock.schedule(animate, velocity=5.0, sprite=alien)
+
+You can cancel a function scheduled with any of these methods using
+`unschedule`::
+
+ clock.unschedule(animate)
+
+Displaying FPS
+==============
+
+The ClockDisplay class provides a simple FPS counter. You should create
+an instance of ClockDisplay once during the application's start up::
+
+ fps_display = clock.ClockDisplay()
+
+Call draw on the ClockDisplay object for each frame::
+
+ fps_display.draw()
+
+There are several options to change the font, color and text displayed
+within the __init__ method.
+
+Using multiple clocks
+=====================
+
+The clock functions are all relayed to an instance of
+:py:class:`~pyglet.clock.Clock` which is initialised with the module. You can
+get this instance to use directly::
+
+ clk = clock.get_default()
+
+You can also replace the default clock with your own:
+
+ myclk = clock.Clock()
+ clock.set_default(myclk)
+
+Each clock maintains its own set of scheduled functions and FPS
+limiting/measurement. Each clock must be "ticked" separately.
+
+Multiple and derived clocks potentially allow you to separate "game-time" and
+"wall-time", or to synchronise your clock to an audio or video stream instead
+of the system clock.
+"""
+from __future__ import print_function
+from __future__ import division
+from builtins import range
+from builtins import object
+
+import time
+import ctypes
+from operator import attrgetter
+from heapq import heappush, heappop, heappushpop
+from collections import deque
+
+import pyglet.lib
+from pyglet import compat_platform
+
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+
+if compat_platform in ('win32', 'cygwin'):
+
+ class _ClockBase(object):
+ def sleep(self, microseconds):
+ time.sleep(microseconds * 1e-6)
+
+ _default_time_function = time.clock
+
+else:
+ _c = pyglet.lib.load_library('c')
+ _c.usleep.argtypes = [ctypes.c_ulong]
+
+ class _ClockBase(object):
+ def sleep(self, microseconds):
+ _c.usleep(int(microseconds))
+
+ _default_time_function = time.time
+
+
+class _ScheduledItem(object):
+ __slots__ = ['func', 'args', 'kwargs']
+
+ def __init__(self, func, args, kwargs):
+ self.func = func
+ self.args = args
+ self.kwargs = kwargs
+
+
+class _ScheduledIntervalItem(object):
+ __slots__ = ['func', 'interval', 'last_ts', 'next_ts',
+ 'args', 'kwargs']
+
+ def __init__(self, func, interval, last_ts, next_ts, args, kwargs):
+ self.func = func
+ self.interval = interval
+ self.last_ts = last_ts
+ self.next_ts = next_ts
+ self.args = args
+ self.kwargs = kwargs
+
+ def __lt__(self, other):
+ try:
+ return self.next_ts < other.next_ts
+ except AttributeError:
+ return self.next_ts < other
+
+
+class Clock(_ClockBase):
+ """Class for calculating and limiting framerate.
+
+ It is also used for calling scheduled functions.
+ """
+
+ #: The minimum amount of time in seconds this clock will attempt to sleep
+ #: for when framerate limiting. Higher values will increase the
+ #: accuracy of the limiting but also increase CPU usage while
+ #: busy-waiting. Lower values mean the process sleeps more often, but is
+ #: prone to over-sleep and run at a potentially lower or uneven framerate
+ #: than desired.
+ #: On Windows, MIN_SLEEP is larger because the default timer resolution
+ #: is set by default to 15 .6 ms.
+ MIN_SLEEP = 0.008 if compat_platform in ('win32', 'cygwin') else 0.005
+
+ #: The amount of time in seconds this clock subtracts from sleep values
+ #: to compensate for lazy operating systems.
+ SLEEP_UNDERSHOOT = MIN_SLEEP - 0.001
+
+ # List of functions to call every tick.
+ _schedule_items = None
+
+ # List of schedule interval items kept in sort order.
+ _schedule_interval_items = None
+
+ # If True, a sleep(0) is inserted on every tick.
+ _force_sleep = False
+
+ def __init__(self, fps_limit=None, time_function=_default_time_function):
+ """Initialise a Clock, with optional framerate limit and custom time function.
+
+ :Parameters:
+ `fps_limit` : float
+ If not None, the maximum allowable framerate. Defaults
+ to None. Deprecated in pyglet 1.2.
+ `time_function` : function
+ Function to return the elapsed time of the application,
+ in seconds. Defaults to time.time, but can be replaced
+ to allow for easy time dilation effects or game pausing.
+
+ """
+ super(Clock, self).__init__()
+ self.time = time_function
+ self.next_ts = self.time()
+ self.last_ts = None
+ self.times = deque()
+
+ self.set_fps_limit(fps_limit)
+ self.cumulative_time = 0
+
+ self._schedule_items = []
+ self._schedule_interval_items = []
+ self._current_interval_item = None
+
+ def update_time(self):
+ """Get the elapsed time since the last call to `update_time`.
+
+ This updates the clock's internal measure of time and returns
+ the difference since the last update (or since the clock was created).
+
+ .. versionadded:: 1.2
+
+ :rtype: float
+ :return: The number of seconds since the last `update_time`, or 0
+ if this was the first time it was called.
+ """
+ ts = self.time()
+ if self.last_ts is None:
+ delta_t = 0
+ else:
+ delta_t = ts - self.last_ts
+ self.times.appendleft(delta_t)
+ if len(self.times) > self.window_size:
+ self.cumulative_time -= self.times.pop()
+ self.cumulative_time += delta_t
+ self.last_ts = ts
+
+ return delta_t
+
+ def call_scheduled_functions(self, dt):
+ """Call scheduled functions that elapsed on the last `update_time`.
+
+ .. versionadded:: 1.2
+
+ :Parameters:
+ dt : float
+ The elapsed time since the last update to pass to each
+ scheduled function. This is *not* used to calculate which
+ functions have elapsed.
+
+ :rtype: bool
+ :return: True if any functions were called, otherwise False.
+ """
+ now = self.last_ts
+ result = False # flag indicates if any function was called
+
+ # handle items scheduled for every tick
+ if self._schedule_items:
+ result = True
+ # duplicate list in case event unschedules itself
+ for item in list(self._schedule_items):
+ item.func(dt, *item.args, **item.kwargs)
+
+ # check the next scheduled item that is not called each tick
+ # if it is scheduled in the future, then exit
+ interval_items = self._schedule_interval_items
+ try:
+ if interval_items[0].next_ts > now:
+ return result
+
+ # raised when the interval_items list is empty
+ except IndexError:
+ return result
+
+ # NOTE: there is no special handling required to manage things
+ # that are scheduled during this loop, due to the heap
+ self._current_interval_item = item = None
+ get_soft_next_ts = self._get_soft_next_ts
+ while interval_items:
+
+ # the scheduler will hold onto a reference to an item in
+ # case it needs to be rescheduled. it is more efficient
+ # to push and pop the heap at once rather than two operations
+ if item is None:
+ item = heappop(interval_items)
+ else:
+ item = heappushpop(interval_items, item)
+
+ # a scheduled function may try and unschedule itself
+ # so we need to keep a reference to the current
+ # item no longer on heap to be able to check
+ self._current_interval_item = item
+
+ # if next item is scheduled in the future then break
+ if item.next_ts > now:
+ break
+
+ # execute the callback
+ item.func(now - item.last_ts, *item.args, **item.kwargs)
+
+ if item.interval:
+
+ # Try to keep timing regular, even if overslept this time;
+ # but don't schedule in the past (which could lead to
+ # infinitely-worsening error).
+ item.next_ts = item.last_ts + item.interval
+ item.last_ts = now
+
+ # test the schedule for the next execution
+ if item.next_ts <= now:
+ # the scheduled time of this item has already passed
+ # so it must be rescheduled
+ if now - item.next_ts < 0.05:
+ # missed execution time by 'reasonable' amount, so
+ # reschedule at normal interval
+ item.next_ts = now + item.interval
+ else:
+ # missed by significant amount, now many events have
+ # likely missed execution. do a soft reschedule to
+ # avoid lumping many events together.
+ # in this case, the next dt will not be accurate
+ item.next_ts = get_soft_next_ts(now, item.interval)
+ item.last_ts = item.next_ts - item.interval
+ else:
+ # not an interval, so this item will not be rescheduled
+ self._current_interval_item = item = None
+
+ if item is not None:
+ heappush(interval_items, item)
+
+ return True
+
+ def tick(self, poll=False):
+ """Signify that one frame has passed.
+
+ This will call any scheduled functions that have elapsed.
+
+ :Parameters:
+ `poll` : bool
+ If True, the function will call any scheduled functions
+ but will not sleep or busy-wait for any reason. Recommended
+ for advanced applications managing their own sleep timers
+ only.
+
+ Since pyglet 1.1.
+
+ :rtype: float
+ :return: The number of seconds since the last "tick", or 0 if this was
+ the first frame.
+ """
+ if poll:
+ if self.period_limit:
+ self.next_ts += self.period_limit
+ else:
+ if self.period_limit:
+ self._limit()
+
+ if self._force_sleep:
+ self.sleep(0)
+
+ delta_t = self.update_time()
+ self.call_scheduled_functions(delta_t)
+ return delta_t
+
+ def _limit(self):
+ """Sleep until the next frame is due.
+
+ Called automatically by :meth:`.tick` if a framerate limit has been
+ set.
+
+ This method uses several heuristics to determine whether to
+ sleep or busy-wait (or both).
+ """
+ ts = self.time()
+ # Sleep to just before the desired time
+ sleeptime = self.get_sleep_time(False)
+ while sleeptime - self.SLEEP_UNDERSHOOT > self.MIN_SLEEP:
+ self.sleep(1000000 * (sleeptime - self.SLEEP_UNDERSHOOT))
+ sleeptime = self.get_sleep_time(False)
+
+ # Busy-loop CPU to get closest to the mark
+ sleeptime = self.next_ts - self.time()
+ while sleeptime > 0:
+ sleeptime = self.next_ts - self.time()
+
+ if sleeptime < -2 * self.period_limit:
+ # Missed the time by a long shot, let's reset the clock
+ # print >> sys.stderr, 'Step %f' % -sleeptime
+ self.next_ts = ts + 2 * self.period_limit
+ else:
+ # Otherwise keep the clock steady
+ self.next_ts += self.period_limit
+
+ def get_sleep_time(self, sleep_idle):
+ """Get the time until the next item is scheduled.
+
+ This method considers all scheduled items and the current
+ ``fps_limit``, if any.
+
+ Applications can choose to continue receiving updates at the
+ maximum framerate during idle time (when no functions are scheduled),
+ or they can sleep through their idle time and allow the CPU to
+ switch to other processes or run in low-power mode.
+
+ If `sleep_idle` is ``True`` the latter behaviour is selected, and
+ ``None`` will be returned if there are no scheduled items.
+
+ Otherwise, if `sleep_idle` is ``False``, a sleep time allowing
+ the maximum possible framerate (considering ``fps_limit``) will
+ be returned; or an earlier time if a scheduled function is ready.
+
+ :Parameters:
+ `sleep_idle` : bool
+ If True, the application intends to sleep through its idle
+ time; otherwise it will continue ticking at the maximum
+ frame rate allowed.
+
+ :rtype: float
+ :return: Time until the next scheduled event in seconds, or ``None``
+ if there is no event scheduled.
+
+ .. versionadded:: 1.1
+ """
+ if self._schedule_items or not sleep_idle:
+ if not self.period_limit:
+ return 0.
+ else:
+ wake_time = self.next_ts
+ if self._schedule_interval_items:
+ wake_time = min(wake_time,
+ self._schedule_interval_items[0].next_ts)
+ return max(wake_time - self.time(), 0.)
+
+ if self._schedule_interval_items:
+ return max(self._schedule_interval_items[0].next_ts - self.time(),
+ 0)
+
+ return None
+
+ def set_fps_limit(self, fps_limit):
+ """Set the framerate limit.
+
+ The framerate limit applies only when a function is scheduled
+ for every frame. That is, the framerate limit can be exceeded by
+ scheduling a function for a very small period of time.
+
+ :Parameters:
+ `fps_limit` : float
+ Maximum frames per second allowed, or None to disable
+ limiting.
+
+ :deprecated: Use `pyglet.app.run` and `schedule_interval` instead.
+ """
+ if not fps_limit:
+ self.period_limit = None
+ else:
+ self.period_limit = 1. / fps_limit
+ self.window_size = fps_limit or 60
+
+ def get_fps_limit(self):
+ """Get the framerate limit.
+
+ :rtype: float
+ :return: The framerate limit previously set in the constructor or
+ `set_fps_limit`, or None if no limit was set.
+ """
+ if self.period_limit:
+ return 1. / self.period_limit
+ else:
+ return 0
+
+ def get_fps(self):
+ """Get the average FPS of recent history.
+
+ The result is the average of a sliding window of the last "n" frames,
+ where "n" is some number designed to cover approximately 1 second.
+
+ :rtype: float
+ :return: The measured frames per second.
+ """
+ if not self.cumulative_time:
+ return 0
+ return len(self.times) / self.cumulative_time
+
+ def _get_nearest_ts(self):
+ """Get the nearest timestamp.
+
+ Schedule from now, unless now is sufficiently close to last_ts, in
+ which case use last_ts. This clusters together scheduled items that
+ probably want to be scheduled together. The old (pre 1.1.1)
+ behaviour was to always use self.last_ts, and not look at ts. The
+ new behaviour is needed because clock ticks can now be quite
+ irregular, and span several seconds.
+ """
+ last_ts = self.last_ts or self.next_ts
+ ts = self.time()
+ if ts - last_ts > 0.2:
+ return ts
+ return last_ts
+
+ def _get_soft_next_ts(self, last_ts, interval):
+ def taken(ts, e):
+ """Check if `ts` has already got an item scheduled nearby."""
+ # TODO this function is slow and called very often.
+ # Optimise it, maybe?
+ for item in self._schedule_interval_items:
+ if abs(item.next_ts - ts) <= e:
+ return True
+ elif item.next_ts > ts + e:
+ return False
+
+ return False
+
+ # sorted list is required required to produce expected results
+ # taken() will iterate through the heap, expecting it to be sorted
+ # and will not always catch smallest value, so sort here.
+ # do not remove the sort key...it is faster than relaying comparisons
+ # NOTE: do not rewrite as popping from heap, as that is super slow!
+ self._schedule_interval_items.sort(key=attrgetter('next_ts'))
+
+ # Binary division over interval:
+ #
+ # 0 interval
+ # |--------------------------|
+ # 5 3 6 2 7 4 8 1 Order of search
+ #
+ # i.e., first scheduled at interval,
+ # then at interval/2
+ # then at interval/4
+ # then at interval*3/4
+ # then at ...
+ #
+ # Schedule is hopefully then evenly distributed for any interval,
+ # and any number of scheduled functions.
+
+ next_ts = last_ts + interval
+ if not taken(next_ts, interval / 4):
+ return next_ts
+
+ dt = interval
+ divs = 1
+ while True:
+ next_ts = last_ts
+ for i in range(divs - 1):
+ next_ts += dt
+ if not taken(next_ts, dt / 4):
+ return next_ts
+ dt /= 2
+ divs *= 2
+
+ # Avoid infinite loop in pathological case
+ if divs > 16:
+ return next_ts
+
+ def schedule(self, func, *args, **kwargs):
+ """Schedule a function to be called every frame.
+
+ The function should have a prototype that includes ``dt`` as the
+ first argument, which gives the elapsed time, in seconds, since the
+ last clock tick. Any additional arguments given to this function
+ are passed on to the callback::
+
+ def callback(dt, *args, **kwargs):
+ pass
+
+ :Parameters:
+ `func` : callable
+ The function to call each frame.
+ """
+ item = _ScheduledItem(func, args, kwargs)
+ self._schedule_items.append(item)
+
+ def schedule_once(self, func, delay, *args, **kwargs):
+ """Schedule a function to be called once after `delay` seconds.
+
+ The callback function prototype is the same as for `schedule`.
+
+ :Parameters:
+ `func` : callable
+ The function to call when the timer lapses.
+ `delay` : float
+ The number of seconds to wait before the timer lapses.
+ """
+ last_ts = self._get_nearest_ts()
+ next_ts = last_ts + delay
+ item = _ScheduledIntervalItem(func, 0, last_ts, next_ts, args, kwargs)
+ heappush(self._schedule_interval_items, item)
+
+ def schedule_interval(self, func, interval, *args, **kwargs):
+ """Schedule a function to be called every `interval` seconds.
+
+ Specifying an interval of 0 prevents the function from being
+ called again (see `schedule` to call a function as often as possible).
+
+ The callback function prototype is the same as for `schedule`.
+
+ :Parameters:
+ `func` : callable
+ The function to call when the timer lapses.
+ `interval` : float
+ The number of seconds to wait between each call.
+
+ """
+ last_ts = self._get_nearest_ts()
+ next_ts = last_ts + interval
+ item = _ScheduledIntervalItem(func, interval, last_ts,
+ next_ts, args, kwargs)
+ heappush(self._schedule_interval_items, item)
+
+ def schedule_interval_soft(self, func, interval, *args, **kwargs):
+ """Schedule a function to be called every ``interval`` seconds.
+
+ This method is similar to `schedule_interval`, except that the
+ clock will move the interval out of phase with other scheduled
+ functions so as to distribute CPU more load evenly over time.
+
+ This is useful for functions that need to be called regularly,
+ but not relative to the initial start time. :py:mod:`pyglet.media`
+ does this for scheduling audio buffer updates, which need to occur
+ regularly -- if all audio updates are scheduled at the same time
+ (for example, mixing several tracks of a music score, or playing
+ multiple videos back simultaneously), the resulting load on the
+ CPU is excessive for those intervals but idle outside. Using
+ the soft interval scheduling, the load is more evenly distributed.
+
+ Soft interval scheduling can also be used as an easy way to schedule
+ graphics animations out of phase; for example, multiple flags
+ waving in the wind.
+
+ .. versionadded:: 1.1
+
+ :Parameters:
+ `func` : callable
+ The function to call when the timer lapses.
+ `interval` : float
+ The number of seconds to wait between each call.
+
+ """
+ next_ts = self._get_soft_next_ts(self._get_nearest_ts(), interval)
+ last_ts = next_ts - interval
+ item = _ScheduledIntervalItem(func, interval, last_ts,
+ next_ts, args, kwargs)
+ heappush(self._schedule_interval_items, item)
+
+ def unschedule(self, func):
+ """Remove a function from the schedule.
+
+ If the function appears in the schedule more than once, all occurrences
+ are removed. If the function was not scheduled, no error is raised.
+
+ :Parameters:
+ `func` : callable
+ The function to remove from the schedule.
+
+ """
+ # clever remove item without disturbing the heap:
+ # 1. set function to an empty lambda -- original function is not called
+ # 2. set interval to 0 -- item will be removed from heap
+ # eventually
+ valid_items = set(item
+ for item in self._schedule_interval_items
+ if item.func == func)
+
+ if self._current_interval_item:
+ if self._current_interval_item.func == func:
+ valid_items.add(self._current_interval_item)
+
+ for item in valid_items:
+ item.interval = 0
+ item.func = lambda x, *args, **kwargs: x
+
+ self._schedule_items = [i for i in self._schedule_items
+ if i.func != func]
+
+
+# Default clock.
+_default = Clock()
+
+
+def set_default(default):
+ """Set the default clock to use for all module-level functions.
+
+ By default an instance of :py:class:`~pyglet.clock.Clock` is used.
+
+ :Parameters:
+ `default` : `Clock`
+ The default clock to use.
+ """
+ global _default
+ _default = default
+
+
+def get_default():
+ """Get the pyglet default Clock.
+
+ Return the :py:class:`~pyglet.clock.Clock` instance that is used by all
+ module-level clock functions.
+
+ :rtype: `Clock`
+ :return: The default clock.
+ """
+ return _default
+
+
+def tick(poll=False):
+ """Signify that one frame has passed on the default clock.
+
+ This will call any scheduled functions that have elapsed.
+
+ :Parameters:
+ `poll` : bool
+ If True, the function will call any scheduled functions
+ but will not sleep or busy-wait for any reason. Recommended
+ for advanced applications managing their own sleep timers
+ only.
+
+ Since pyglet 1.1.
+
+ :rtype: float
+ :return: The number of seconds since the last "tick", or 0 if this was the
+ first frame.
+ """
+ return _default.tick(poll)
+
+
+def get_sleep_time(sleep_idle):
+ """Get the time until the next item is scheduled on the default clock.
+
+ See `Clock.get_sleep_time` for details.
+
+ :Parameters:
+ `sleep_idle` : bool
+ If True, the application intends to sleep through its idle
+ time; otherwise it will continue ticking at the maximum
+ frame rate allowed.
+
+ :rtype: float
+ :return: Time until the next scheduled event in seconds, or ``None``
+ if there is no event scheduled.
+
+ .. versionadded:: 1.1
+ """
+ return _default.get_sleep_time(sleep_idle)
+
+
+def get_fps():
+ """Return the current measured FPS of the default clock.
+
+ :rtype: float
+ """
+ return _default.get_fps()
+
+
+def set_fps_limit(fps_limit):
+ """Set the framerate limit for the default clock.
+
+ :Parameters:
+ `fps_limit` : float
+ Maximum frames per second allowed, or None to disable
+ limiting.
+
+ :deprecated: Use `pyglet.app.run` and `schedule_interval` instead.
+ """
+ _default.set_fps_limit(fps_limit)
+
+
+def get_fps_limit():
+ """Get the framerate limit for the default clock.
+
+ :return: The framerate limit previously set by `set_fps_limit`, or None if
+ no limit was set.
+
+ """
+ return _default.get_fps_limit()
+
+
+def schedule(func, *args, **kwargs):
+ """Schedule 'func' to be called every frame on the default clock.
+
+ The arguments passed to func are ``dt``, followed by any ``*args`` and
+ ``**kwargs`` given here.
+
+ :Parameters:
+ `func` : callable
+ The function to call each frame.
+ """
+ _default.schedule(func, *args, **kwargs)
+
+
+def schedule_interval(func, interval, *args, **kwargs):
+ """Schedule ``func`` on the default clock every interval seconds.
+
+ The arguments passed to ``func`` are ``dt`` (time since last function
+ call), followed by any ``*args`` and ``**kwargs`` given here.
+
+ :Parameters:
+ `func` : callable
+ The function to call when the timer lapses.
+ `interval` : float
+ The number of seconds to wait between each call.
+ """
+ _default.schedule_interval(func, interval, *args, **kwargs)
+
+
+def schedule_interval_soft(func, interval, *args, **kwargs):
+ """Schedule ``func`` on the default clock every interval seconds.
+
+ The clock will move the interval out of phase with other scheduled
+ functions so as to distribute CPU more load evenly over time.
+
+ The arguments passed to ``func`` are ``dt`` (time since last function
+ call), followed by any ``*args`` and ``**kwargs`` given here.
+
+ :see: `Clock.schedule_interval_soft`
+
+ .. versionadded:: 1.1
+
+ :Parameters:
+ `func` : callable
+ The function to call when the timer lapses.
+ `interval` : float
+ The number of seconds to wait between each call.
+
+ """
+ _default.schedule_interval_soft(func, interval, *args, **kwargs)
+
+
+def schedule_once(func, delay, *args, **kwargs):
+ """Schedule ``func`` to be called once after ``delay`` seconds.
+
+ This function uses the fefault clock. ``delay`` can be a float. The
+ arguments passed to ``func`` are ``dt`` (time since last function call),
+ followed by any ``*args`` and ``**kwargs`` given here.
+
+ If no default clock is set, the func is queued and will be scheduled
+ on the default clock as soon as it is created.
+
+ :Parameters:
+ `func` : callable
+ The function to call when the timer lapses.
+ `delay` : float
+ The number of seconds to wait before the timer lapses.
+ """
+ _default.schedule_once(func, delay, *args, **kwargs)
+
+
+def unschedule(func):
+ """Remove ``func`` from the default clock's schedule.
+
+ No error is raised if the ``func`` was never scheduled.
+
+ :Parameters:
+ `func` : callable
+ The function to remove from the schedule.
+ """
+ _default.unschedule(func)
+
+
+class ClockDisplay(object):
+ """Display current clock values, such as FPS.
+
+ This is a convenience class for displaying diagnostics such as the
+ framerate. See the module documentation for example usage.
+
+ :Ivariables:
+ `label` : `pyglet.font.Text`
+ The label which is displayed.
+
+ :deprecated: This class presents values that are often misleading, as
+ they reflect the rate of clock ticks, not displayed framerate. Use
+ pyglet.window.FPSDisplay instead.
+
+ """
+
+ def __init__(self,
+ font=None,
+ interval=0.25,
+ format='%(fps).2f',
+ color=(.5, .5, .5, .5),
+ clock=None):
+ """Create a ClockDisplay.
+
+ All parameters are optional. By default, a large translucent
+ font will be used to display the FPS to two decimal places.
+
+ :Parameters:
+ `font` : `pyglet.font.Font`
+ The font to format text in.
+ `interval` : float
+ The number of seconds between updating the display.
+ `format` : str
+ A format string describing the format of the text. This
+ string is modulated with the dict ``{'fps' : fps}``.
+ `color` : 4-tuple of float
+ The color, including alpha, passed to ``glColor4f``.
+ `clock` : `Clock`
+ The clock which determines the time. If None, the default
+ clock is used.
+
+ """
+ if clock is None:
+ clock = _default
+ self.clock = clock
+ self.clock.schedule_interval(self.update_text, interval)
+
+ if not font:
+ from pyglet.font import load as load_font
+ font = load_font('', 36, bold=True)
+
+ import pyglet.font
+ self.label = pyglet.font.Text(font, '', color=color, x=10, y=10)
+
+ self.format = format
+
+ def unschedule(self):
+ """Remove the display from its clock's schedule.
+
+ :class:`~pyglet.clock.ClockDisplay` uses
+ :class:`~pyglet.clocl.Clock.schedule_interval` to periodically update
+ its display label. Even if the ClockDisplay is not being used any
+ more, its update method will still be scheduled, which can be a
+ resource drain. Call this method to unschedule the update method
+ and allow the ClockDisplay to be garbage collected.
+
+ .. versionadded:: 1.1
+ """
+ self.clock.unschedule(self.update_text)
+
+ def update_text(self, dt=0):
+ """Scheduled method to update the label text."""
+ fps = self.clock.get_fps()
+ self.label.text = self.format % {'fps': fps}
+
+ def draw(self):
+ """Method called each frame to render the label."""
+ self.label.draw()
+
+
+def test_clock():
+ """Test clock implementation."""
+ import getopt
+ import sys
+ test_seconds = 1
+ test_fps = 60
+ show_fps = False
+ options, args = getopt.getopt(sys.argv[1:], 'vht:f:',
+ ['time=', 'fps=', 'help'])
+ for key, value in options:
+ if key in ('-t', '--time'):
+ test_seconds = float(value)
+ elif key in ('-f', '--fps'):
+ test_fps = float(value)
+ elif key in ('-v', ):
+ show_fps = True
+ elif key in ('-h', '--help'):
+ print('Usage: clock.py \n'
+ '\n'
+ 'Options:\n'
+ ' -t --time Number of seconds to run for.\n'
+ ' -f --fps Target FPS.\n'
+ '\n'
+ 'Tests the clock module by measuring how close we can\n'
+ 'get to the desired FPS by sleeping and busy-waiting.')
+ sys.exit(0)
+
+ set_fps_limit(test_fps)
+ start = time.time()
+
+ # Add one because first frame has no update interval.
+ n_frames = int(test_seconds * test_fps + 1)
+
+ print('Testing %f FPS for %f seconds...' % (test_fps, test_seconds))
+ for i in range(n_frames):
+ tick()
+ if show_fps:
+ print(get_fps())
+ total_time = time.time() - start
+ total_error = total_time - test_seconds
+ print('Total clock error: %f secs' % total_error)
+ print('Total clock error / secs: %f secs/secs' %
+ (total_error / test_seconds))
+
+ # Not fair to add the extra frame in this calc, since no-one's interested
+ # in the startup situation.
+ print('Average FPS: %f' % ((n_frames - 1) / total_time))
+
+
+if __name__ == '__main__':
+ test_clock()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/com.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/com.py
new file mode 100644
index 0000000..8fc9e5e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/com.py
@@ -0,0 +1,171 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Minimal Windows COM interface.
+
+Allows pyglet to use COM interfaces on Windows without comtypes. Unlike
+comtypes, this module does not provide property interfaces, read typelibs,
+nice-ify return values or permit Python implementations of COM interfaces. We
+don't need anything that sophisticated to work with DirectX.
+
+All interfaces should derive from IUnknown (defined in this module). The
+Python COM interfaces are actually pointers to the implementation (take note
+when translating methods that take an interface as argument).
+
+Interfaces can define methods::
+
+ class IDirectSound8(com.IUnknown):
+ _methods_ = [
+ ('CreateSoundBuffer', com.STDMETHOD()),
+ ('GetCaps', com.STDMETHOD(LPDSCAPS)),
+ ...
+ ]
+
+Only use STDMETHOD or METHOD for the method types (not ordinary ctypes
+function types). The 'this' pointer is bound automatically... e.g., call::
+
+ device = IDirectSound8()
+ DirectSoundCreate8(None, ctypes.byref(device), None)
+
+ caps = DSCAPS()
+ device.GetCaps(caps)
+
+Because STDMETHODs use HRESULT as the return type, there is no need to check
+the return value.
+
+Don't forget to manually manage memory... call Release() when you're done with
+an interface.
+'''
+from builtins import object
+
+import ctypes
+import sys
+
+from pyglet.debug import debug_print
+
+_debug_com = debug_print('debug_com')
+
+if sys.platform != 'win32':
+ raise ImportError('pyglet.com requires a Windows build of Python')
+
+class GUID(ctypes.Structure):
+ _fields_ = [
+ ('Data1', ctypes.c_ulong),
+ ('Data2', ctypes.c_ushort),
+ ('Data3', ctypes.c_ushort),
+ ('Data4', ctypes.c_ubyte * 8)
+ ]
+
+ def __init__(self, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8):
+ self.Data1 = l
+ self.Data2 = w1
+ self.Data3 = w2
+ self.Data4[:] = (b1, b2, b3, b4, b5, b6, b7, b8)
+
+ def __repr__(self):
+ b1, b2, b3, b4, b5, b6, b7, b8 = self.Data4
+ return 'GUID(%x, %x, %x, %x, %x, %x, %x, %x, %x, %x, %x)' % (
+ self.Data1, self.Data2, self.Data3, b1, b2, b3, b4, b5, b6, b7, b8)
+
+LPGUID = ctypes.POINTER(GUID)
+IID = GUID
+REFIID = ctypes.POINTER(IID)
+
+class METHOD(object):
+ '''COM method.'''
+ def __init__(self, restype, *args):
+ self.restype = restype
+ self.argtypes = args
+
+ def get_field(self):
+ return ctypes.WINFUNCTYPE(self.restype, *self.argtypes)
+
+class STDMETHOD(METHOD):
+ '''COM method with HRESULT return value.'''
+ def __init__(self, *args):
+ super(STDMETHOD, self).__init__(ctypes.HRESULT, *args)
+
+class COMMethodInstance(object):
+ '''Binds a COM interface method.'''
+ def __init__(self, name, i, method):
+ self.name = name
+ self.i = i
+ self.method = method
+
+ def __get__(self, obj, tp):
+ if obj is not None:
+ def _call(*args):
+ assert _debug_com('COM: IN {}({}, {})'.format(self.name, obj.__class__.__name__, args))
+ ret = self.method.get_field()(self.i, self.name)(obj, *args)
+ assert _debug_com('COM: OUT {}({}, {})'.format(self.name, obj.__class__.__name__, args))
+ assert _debug_com('COM: RETURN {}'.format(ret))
+ return ret
+ return _call
+
+ raise AttributeError()
+
+class COMInterface(ctypes.Structure):
+ '''Dummy struct to serve as the type of all COM pointers.'''
+ _fields_ = [
+ ('lpVtbl', ctypes.c_void_p),
+ ]
+
+class InterfaceMetaclass(type(ctypes.POINTER(COMInterface))):
+ '''Creates COM interface pointers.'''
+ def __new__(cls, name, bases, dct):
+ methods = []
+ for base in bases[::-1]:
+ methods.extend(base.__dict__.get('_methods_', ()))
+ methods.extend(dct.get('_methods_', ()))
+
+ for i, (n, method) in enumerate(methods):
+ dct[n] = COMMethodInstance(n, i, method)
+
+ dct['_type_'] = COMInterface
+
+ return super(InterfaceMetaclass, cls).__new__(cls, name, bases, dct)
+
+# future.utils.with_metaclass does not work here, as the base class is from _ctypes.lib
+# See https://wiki.python.org/moin/PortingToPy3k/BilingualQuickRef
+Interface = InterfaceMetaclass(str('Interface'), (ctypes.POINTER(COMInterface),), {
+ '__doc__': 'Base COM interface pointer.',
+ })
+
+class IUnknown(Interface):
+ _methods_ = [
+ ('QueryInterface', STDMETHOD(REFIID, ctypes.c_void_p)),
+ ('AddRef', METHOD(ctypes.c_int)),
+ ('Release', METHOD(ctypes.c_int))
+ ]
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/compat.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/compat.py
new file mode 100644
index 0000000..b0ac4c1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/compat.py
@@ -0,0 +1,101 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Compatibility tools
+
+Various tools for simultaneous Python 2.x and Python 3.x support
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import sys
+import itertools
+
+if sys.version_info[0] == 2:
+ if sys.version_info[1] < 6:
+ #Pure Python implementation from
+ #http://docs.python.org/library/itertools.html#itertools.izip_longest
+ def izip_longest(*args, **kwds):
+ # izip_longest('ABCD', 'xy', fillvalue='-') --> Ax By C- D-
+ fillvalue = kwds.get('fillvalue')
+ def sentinel(counter = ([fillvalue]*(len(args)-1)).pop):
+ yield counter() # yields the fillvalue, or raises IndexError
+ fillers = itertools.repeat(fillvalue)
+ iters = [itertools.chain(it, sentinel(), fillers) for it in args]
+ try:
+ for tup in itertools.izip(*iters):
+ yield tup
+ except IndexError:
+ pass
+ else:
+ izip_longest = itertools.izip_longest
+else:
+ izip_longest = itertools.zip_longest
+
+
+if sys.version_info[0] >= 3:
+ import io
+
+ def asbytes(s):
+ if isinstance(s, bytes):
+ return s
+ elif isinstance(s, str):
+ return bytes(ord(c) for c in s)
+ else:
+ return bytes(s)
+
+ def asbytes_filename(s):
+ if isinstance(s, bytes):
+ return s
+ elif isinstance(s, str):
+ return s.encode(encoding=sys.getfilesystemencoding())
+
+ def asstr(s):
+ if s is None:
+ return ''
+ if isinstance(s, str):
+ return s
+ return s.decode("utf-8")
+
+ bytes_type = bytes
+ BytesIO = io.BytesIO
+else:
+ import StringIO
+
+ asbytes = str
+ asbytes_filename = str
+ asstr = str
+ bytes_type = str
+ BytesIO = StringIO.StringIO
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/debug.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/debug.py
new file mode 100644
index 0000000..c27174a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/debug.py
@@ -0,0 +1,74 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+from __future__ import print_function
+
+import pyglet
+
+
+def debug_print(enabled_or_option='debug'):
+ """Get a debug printer that is enabled based on a boolean input or a pyglet option.
+ The debug print function returned should be used in an assert. This way it can be
+ optimized out when running python with the -O flag.
+
+ Usage example::
+
+ from pyglet.debug import debug_print
+ _debug_media = debug_print('debug_media')
+
+ def some_func():
+ assert _debug_media('My debug statement')
+
+ :parameters:
+ `enabled_or_options` : bool or str
+ If a bool is passed, debug printing is enabled if it is True. If str is passed
+ debug printing is enabled if the pyglet option with that name is True.
+
+ :returns: Function for debug printing.
+ """
+ if isinstance(enabled_or_option, bool):
+ enabled = enabled_or_option
+ else:
+ enabled = pyglet.options.get(enabled_or_option, False)
+
+ if enabled:
+ def _debug_print(*args, **kwargs):
+ print(*args, **kwargs)
+ return True
+
+ else:
+ def _debug_print(*args, **kwargs):
+ return True
+
+ return _debug_print
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/event.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/event.py
new file mode 100644
index 0000000..fd97d9c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/event.py
@@ -0,0 +1,459 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Event dispatch framework.
+
+All objects that produce events in pyglet implement :py:class:`~pyglet.event.EventDispatcher`,
+providing a consistent interface for registering and manipulating event
+handlers. A commonly used event dispatcher is `pyglet.window.Window`.
+
+Event types
+===========
+
+For each event dispatcher there is a set of events that it dispatches; these
+correspond with the type of event handlers you can attach. Event types are
+identified by their name, for example, ''on_resize''. If you are creating a
+new class which implements :py:class:`~pyglet.event.EventDispatcher`, you must call
+`EventDispatcher.register_event_type` for each event type.
+
+Attaching event handlers
+========================
+
+An event handler is simply a function or method. You can attach an event
+handler by setting the appropriate function on the instance::
+
+ def on_resize(width, height):
+ # ...
+ dispatcher.on_resize = on_resize
+
+There is also a convenience decorator that reduces typing::
+
+ @dispatcher.event
+ def on_resize(width, height):
+ # ...
+
+You may prefer to subclass and override the event handlers instead::
+
+ class MyDispatcher(DispatcherClass):
+ def on_resize(self, width, height):
+ # ...
+
+Event handler stack
+===================
+
+When attaching an event handler to a dispatcher using the above methods, it
+replaces any existing handler (causing the original handler to no longer be
+called). Each dispatcher maintains a stack of event handlers, allowing you to
+insert an event handler "above" the existing one rather than replacing it.
+
+There are two main use cases for "pushing" event handlers:
+
+* Temporarily intercepting the events coming from the dispatcher by pushing a
+ custom set of handlers onto the dispatcher, then later "popping" them all
+ off at once.
+* Creating "chains" of event handlers, where the event propagates from the
+ top-most (most recently added) handler to the bottom, until a handler
+ takes care of it.
+
+Use `EventDispatcher.push_handlers` to create a new level in the stack and
+attach handlers to it. You can push several handlers at once::
+
+ dispatcher.push_handlers(on_resize, on_key_press)
+
+If your function handlers have different names to the events they handle, use
+keyword arguments::
+
+ dispatcher.push_handlers(on_resize=my_resize,
+ on_key_press=my_key_press)
+
+After an event handler has processed an event, it is passed on to the
+next-lowest event handler, unless the handler returns `EVENT_HANDLED`, which
+prevents further propagation.
+
+To remove all handlers on the top stack level, use
+`EventDispatcher.pop_handlers`.
+
+Note that any handlers pushed onto the stack have precedence over the
+handlers set directly on the instance (for example, using the methods
+described in the previous section), regardless of when they were set.
+For example, handler ``foo`` is called before handler ``bar`` in the following
+example::
+
+ dispatcher.push_handlers(on_resize=foo)
+ dispatcher.on_resize = bar
+
+Dispatching events
+==================
+
+pyglet uses a single-threaded model for all application code. Event
+handlers are only ever invoked as a result of calling
+EventDispatcher.dispatch_events`.
+
+It is up to the specific event dispatcher to queue relevant events until they
+can be dispatched, at which point the handlers are called in the order the
+events were originally generated.
+
+This implies that your application runs with a main loop that continuously
+updates the application state and checks for new events::
+
+ while True:
+ dispatcher.dispatch_events()
+ # ... additional per-frame processing
+
+Not all event dispatchers require the call to ``dispatch_events``; check with
+the particular class documentation.
+
+'''
+from builtins import object
+from past.builtins import basestring
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import inspect
+
+EVENT_HANDLED = True
+EVENT_UNHANDLED = None
+
+class EventException(Exception):
+ '''An exception raised when an event handler could not be attached.
+ '''
+ pass
+
+class EventDispatcher(object):
+ '''Generic event dispatcher interface.
+
+ See the module docstring for usage.
+ '''
+ # Placeholder empty stack; real stack is created only if needed
+ _event_stack = ()
+
+ @classmethod
+ def register_event_type(cls, name):
+ '''Register an event type with the dispatcher.
+
+ Registering event types allows the dispatcher to validate event
+ handler names as they are attached, and to search attached objects for
+ suitable handlers.
+
+ :Parameters:
+ `name` : str
+ Name of the event to register.
+
+ '''
+ if not hasattr(cls, 'event_types'):
+ cls.event_types = []
+ cls.event_types.append(name)
+ return name
+
+ def push_handlers(self, *args, **kwargs):
+ '''Push a level onto the top of the handler stack, then attach zero or
+ more event handlers.
+
+ If keyword arguments are given, they name the event type to attach.
+ Otherwise, a callable's `__name__` attribute will be used. Any other
+ object may also be specified, in which case it will be searched for
+ callables with event names.
+ '''
+ # Create event stack if necessary
+ if type(self._event_stack) is tuple:
+ self._event_stack = []
+
+ # Place dict full of new handlers at beginning of stack
+ self._event_stack.insert(0, {})
+ self.set_handlers(*args, **kwargs)
+
+ def _get_handlers(self, args, kwargs):
+ '''Implement handler matching on arguments for set_handlers and
+ remove_handlers.
+ '''
+ for object in args:
+ if inspect.isroutine(object):
+ # Single magically named function
+ name = object.__name__
+ if name not in self.event_types:
+ raise EventException('Unknown event "%s"' % name)
+ yield name, object
+ else:
+ # Single instance with magically named methods
+ for name in dir(object):
+ if name in self.event_types:
+ yield name, getattr(object, name)
+ for name, handler in kwargs.items():
+ # Function for handling given event (no magic)
+ if name not in self.event_types:
+ raise EventException('Unknown event "%s"' % name)
+ yield name, handler
+
+ def set_handlers(self, *args, **kwargs):
+ '''Attach one or more event handlers to the top level of the handler
+ stack.
+
+ See :py:meth:`~pyglet.event.EventDispatcher.push_handlers` for the accepted argument types.
+ '''
+ # Create event stack if necessary
+ if type(self._event_stack) is tuple:
+ self._event_stack = [{}]
+
+ for name, handler in self._get_handlers(args, kwargs):
+ self.set_handler(name, handler)
+
+ def set_handler(self, name, handler):
+ '''Attach a single event handler.
+
+ :Parameters:
+ `name` : str
+ Name of the event type to attach to.
+ `handler` : callable
+ Event handler to attach.
+
+ '''
+ # Create event stack if necessary
+ if type(self._event_stack) is tuple:
+ self._event_stack = [{}]
+
+ self._event_stack[0][name] = handler
+
+ def pop_handlers(self):
+ '''Pop the top level of event handlers off the stack.
+ '''
+ assert self._event_stack and 'No handlers pushed'
+
+ del self._event_stack[0]
+
+ def remove_handlers(self, *args, **kwargs):
+ '''Remove event handlers from the event stack.
+
+ See :py:meth:`~pyglet.event.EventDispatcher.push_handlers` for the accepted argument types. All handlers
+ are removed from the first stack frame that contains any of the given
+ handlers. No error is raised if any handler does not appear in that
+ frame, or if no stack frame contains any of the given handlers.
+
+ If the stack frame is empty after removing the handlers, it is
+ removed from the stack. Note that this interferes with the expected
+ symmetry of :py:meth:`~pyglet.event.EventDispatcher.push_handlers` and :py:meth:`~pyglet.event.EventDispatcher.pop_handlers`.
+ '''
+ handlers = list(self._get_handlers(args, kwargs))
+
+ # Find the first stack frame containing any of the handlers
+ def find_frame():
+ for frame in self._event_stack:
+ for name, handler in handlers:
+ try:
+ if frame[name] == handler:
+ return frame
+ except KeyError:
+ pass
+ frame = find_frame()
+
+ # No frame matched; no error.
+ if not frame:
+ return
+
+ # Remove each handler from the frame.
+ for name, handler in handlers:
+ try:
+ if frame[name] == handler:
+ del frame[name]
+ except KeyError:
+ pass
+
+ # Remove the frame if it's empty.
+ if not frame:
+ self._event_stack.remove(frame)
+
+ def remove_handler(self, name, handler):
+ '''Remove a single event handler.
+
+ The given event handler is removed from the first handler stack frame
+ it appears in. The handler must be the exact same callable as passed
+ to `set_handler`, `set_handlers` or :py:meth:`~pyglet.event.EventDispatcher.push_handlers`; and the name
+ must match the event type it is bound to.
+
+ No error is raised if the event handler is not set.
+
+ :Parameters:
+ `name` : str
+ Name of the event type to remove.
+ `handler` : callable
+ Event handler to remove.
+ '''
+ for frame in self._event_stack:
+ try:
+ if frame[name] == handler:
+ del frame[name]
+ break
+ except KeyError:
+ pass
+
+ def dispatch_event(self, event_type, *args):
+ '''Dispatch a single event to the attached handlers.
+
+ The event is propagated to all handlers from from the top of the stack
+ until one returns `EVENT_HANDLED`. This method should be used only by
+ :py:class:`~pyglet.event.EventDispatcher` implementors; applications should call
+ the ``dispatch_events`` method.
+
+ Since pyglet 1.2, the method returns `EVENT_HANDLED` if an event
+ handler returned `EVENT_HANDLED` or `EVENT_UNHANDLED` if all events
+ returned `EVENT_UNHANDLED`. If no matching event handlers are in the
+ stack, ``False`` is returned.
+
+ :Parameters:
+ `event_type` : str
+ Name of the event.
+ `args` : sequence
+ Arguments to pass to the event handler.
+
+ :rtype: bool or None
+ :return: (Since pyglet 1.2) `EVENT_HANDLED` if an event handler
+ returned `EVENT_HANDLED`; `EVENT_UNHANDLED` if one or more event
+ handlers were invoked but returned only `EVENT_UNHANDLED`;
+ otherwise ``False``. In pyglet 1.1 and earler, the return value
+ is always ``None``.
+
+ '''
+ assert event_type in self.event_types, "%r not found in %r.event_types == %r" % (event_type, self, self.event_types)
+
+ invoked = False
+
+ # Search handler stack for matching event handlers
+ for frame in list(self._event_stack):
+ handler = frame.get(event_type, None)
+ if handler:
+ try:
+ invoked = True
+ if handler(*args):
+ return EVENT_HANDLED
+ except TypeError:
+ self._raise_dispatch_exception(event_type, args, handler)
+
+
+ # Check instance for an event handler
+ if hasattr(self, event_type):
+ try:
+ invoked = True
+ if getattr(self, event_type)(*args):
+ return EVENT_HANDLED
+ except TypeError:
+ self._raise_dispatch_exception(
+ event_type, args, getattr(self, event_type))
+
+ if invoked:
+ return EVENT_UNHANDLED
+
+ return False
+
+ def _raise_dispatch_exception(self, event_type, args, handler):
+ # A common problem in applications is having the wrong number of
+ # arguments in an event handler. This is caught as a TypeError in
+ # dispatch_event but the error message is obfuscated.
+ #
+ # Here we check if there is indeed a mismatch in argument count,
+ # and construct a more useful exception message if so. If this method
+ # doesn't find a problem with the number of arguments, the error
+ # is re-raised as if we weren't here.
+
+ n_args = len(args)
+
+ # Inspect the handler
+ handler_args, handler_varargs, _, handler_defaults = \
+ inspect.getargspec(handler)
+ n_handler_args = len(handler_args)
+
+ # Remove "self" arg from handler if it's a bound method
+ if inspect.ismethod(handler) and handler.__self__:
+ n_handler_args -= 1
+
+ # Allow *args varargs to overspecify arguments
+ if handler_varargs:
+ n_handler_args = max(n_handler_args, n_args)
+
+ # Allow default values to overspecify arguments
+ if (n_handler_args > n_args and
+ handler_defaults and
+ n_handler_args - len(handler_defaults) <= n_args):
+ n_handler_args = n_args
+
+ if n_handler_args != n_args:
+ if inspect.isfunction(handler) or inspect.ismethod(handler):
+ descr = '%s at %s:%d' % (
+ handler.__name__,
+ handler.__code__.co_filename,
+ handler.__code__.co_firstlineno)
+ else:
+ descr = repr(handler)
+
+ raise TypeError(
+ '%s event was dispatched with %d arguments, but '
+ 'handler %s has an incompatible function signature' %
+ (event_type, len(args), descr))
+ else:
+ raise
+
+ def event(self, *args):
+ '''Function decorator for an event handler.
+
+ Usage::
+
+ win = window.Window()
+
+ @win.event
+ def on_resize(self, width, height):
+ # ...
+
+ or::
+
+ @win.event('on_resize')
+ def foo(self, width, height):
+ # ...
+
+ '''
+ if len(args) == 0: # @window.event()
+ def decorator(func):
+ name = func.__name__
+ self.set_handler(name, func)
+ return func
+ return decorator
+ elif inspect.isroutine(args[0]): # @window.event
+ func = args[0]
+ name = func.__name__
+ self.set_handler(name, func)
+ return args[0]
+ elif isinstance(args[0], basestring): # @window.event('on_resize')
+ name = args[0]
+ def decorator(func):
+ self.set_handler(name, func)
+ return func
+ return decorator
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/__init__.py
new file mode 100644
index 0000000..ac859ee
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/__init__.py
@@ -0,0 +1,39 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+"""
+External dependencies for Pyglet.
+
+These dependencies are included to publish Pyglet as a fully self-contained package.
+"""
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/_dummy_thread/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/_dummy_thread/__init__.py
new file mode 100644
index 0000000..63dced6
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/_dummy_thread/__init__.py
@@ -0,0 +1,10 @@
+from __future__ import absolute_import
+import sys
+__future_module__ = True
+
+if sys.version_info[0] < 3:
+ from dummy_thread import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/_markupbase/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/_markupbase/__init__.py
new file mode 100644
index 0000000..2909065
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/_markupbase/__init__.py
@@ -0,0 +1,10 @@
+from __future__ import absolute_import
+import sys
+__future_module__ = True
+
+if sys.version_info[0] < 3:
+ from markupbase import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/_thread/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/_thread/__init__.py
new file mode 100644
index 0000000..9f2a51c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/_thread/__init__.py
@@ -0,0 +1,10 @@
+from __future__ import absolute_import
+import sys
+__future_module__ = True
+
+if sys.version_info[0] < 3:
+ from thread import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/builtins/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/builtins/__init__.py
new file mode 100644
index 0000000..4f936f2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/builtins/__init__.py
@@ -0,0 +1,12 @@
+from __future__ import absolute_import
+import sys
+__future_module__ = True
+
+if sys.version_info[0] < 3:
+ from __builtin__ import *
+ # Overwrite any old definitions with the equivalent future.builtins ones:
+ from future.builtins import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/configparser/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/configparser/__init__.py
new file mode 100644
index 0000000..3642c5e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/configparser/__init__.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+import sys
+
+if sys.version_info[0] < 3:
+ from ConfigParser import *
+ try:
+ from ConfigParser import (_Chainmap, Error, InterpolationMissingOptionError)
+ except ImportError:
+ pass
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/copyreg/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/copyreg/__init__.py
new file mode 100644
index 0000000..51bd4b9
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/copyreg/__init__.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+import sys
+
+if sys.version_info[0] < 3:
+ from copy_reg import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/html/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/html/__init__.py
new file mode 100644
index 0000000..e957e74
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/html/__init__.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+import sys
+
+if sys.version_info[0] < 3:
+ from future.moves.html import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/html/entities.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/html/entities.py
new file mode 100644
index 0000000..211649e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/html/entities.py
@@ -0,0 +1,7 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from html.entities import *
+else:
+ from future.moves.html.entities import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/html/parser.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/html/parser.py
new file mode 100644
index 0000000..541def3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/html/parser.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+import sys
+__future_module__ = True
+
+if sys.version_info[0] == 3:
+ raise ImportError('Cannot import module from python-future source folder')
+else:
+ from future.moves.html.parser import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/http/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/http/__init__.py
new file mode 100644
index 0000000..e4f853e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/http/__init__.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+import sys
+
+if sys.version_info[0] < 3:
+ pass
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/http/client.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/http/client.py
new file mode 100644
index 0000000..429cac4
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/http/client.py
@@ -0,0 +1,6 @@
+from __future__ import absolute_import
+import sys
+
+assert sys.version_info[0] < 3
+
+from httplib import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/http/cookiejar.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/http/cookiejar.py
new file mode 100644
index 0000000..d847b2b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/http/cookiejar.py
@@ -0,0 +1,6 @@
+from __future__ import absolute_import
+import sys
+
+assert sys.version_info[0] < 3
+
+from cookielib import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/http/cookies.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/http/cookies.py
new file mode 100644
index 0000000..eb2a823
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/http/cookies.py
@@ -0,0 +1,7 @@
+from __future__ import absolute_import
+import sys
+
+assert sys.version_info[0] < 3
+
+from Cookie import *
+from Cookie import Morsel # left out of __all__ on Py2.7!
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/http/server.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/http/server.py
new file mode 100644
index 0000000..2971055
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/http/server.py
@@ -0,0 +1,18 @@
+from __future__ import absolute_import
+import sys
+
+assert sys.version_info[0] < 3
+
+from BaseHTTPServer import *
+from CGIHTTPServer import *
+from SimpleHTTPServer import *
+try:
+ from CGIHTTPServer import _url_collapse_path # needed for a test
+except ImportError:
+ try:
+ # Python 2.7.0 to 2.7.3
+ from CGIHTTPServer import (
+ _url_collapse_path_split as _url_collapse_path)
+ except ImportError:
+ # Doesn't exist on Python 2.6.x. Ignore it.
+ pass
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/queue/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/queue/__init__.py
new file mode 100644
index 0000000..22bd296
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/queue/__init__.py
@@ -0,0 +1,10 @@
+from __future__ import absolute_import
+import sys
+__future_module__ = True
+
+if sys.version_info[0] < 3:
+ from Queue import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/reprlib/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/reprlib/__init__.py
new file mode 100644
index 0000000..6ccf9c0
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/reprlib/__init__.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+import sys
+
+if sys.version_info[0] < 3:
+ from repr import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/socketserver/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/socketserver/__init__.py
new file mode 100644
index 0000000..c5b8c9c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/socketserver/__init__.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+import sys
+
+if sys.version_info[0] < 3:
+ from SocketServer import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/__init__.py
new file mode 100644
index 0000000..cff06c0
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/__init__.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+import sys
+
+if sys.version_info[0] < 3:
+ from Tkinter import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/colorchooser.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/colorchooser.py
new file mode 100644
index 0000000..5e7c97f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/colorchooser.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.colorchooser import *
+else:
+ try:
+ from tkColorChooser import *
+ except ImportError:
+ raise ImportError('The tkColorChooser module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/commondialog.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/commondialog.py
new file mode 100644
index 0000000..7747a0b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/commondialog.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.commondialog import *
+else:
+ try:
+ from tkCommonDialog import *
+ except ImportError:
+ raise ImportError('The tkCommonDialog module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/constants.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/constants.py
new file mode 100644
index 0000000..99216f3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/constants.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.constants import *
+else:
+ try:
+ from Tkconstants import *
+ except ImportError:
+ raise ImportError('The Tkconstants module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/dialog.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/dialog.py
new file mode 100644
index 0000000..a5b7778
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/dialog.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.dialog import *
+else:
+ try:
+ from Dialog import *
+ except ImportError:
+ raise ImportError('The Dialog module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/dnd.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/dnd.py
new file mode 100644
index 0000000..748b111
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/dnd.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.dnd import *
+else:
+ try:
+ from Tkdnd import *
+ except ImportError:
+ raise ImportError('The Tkdnd module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/filedialog.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/filedialog.py
new file mode 100644
index 0000000..35e21ac
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/filedialog.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.filedialog import *
+else:
+ try:
+ from FileDialog import *
+ except ImportError:
+ raise ImportError('The FileDialog module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/font.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/font.py
new file mode 100644
index 0000000..63d86dc
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/font.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.font import *
+else:
+ try:
+ from tkFont import *
+ except ImportError:
+ raise ImportError('The tkFont module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/messagebox.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/messagebox.py
new file mode 100644
index 0000000..3ed52e1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/messagebox.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.messagebox import *
+else:
+ try:
+ from tkMessageBox import *
+ except ImportError:
+ raise ImportError('The tkMessageBox module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/scrolledtext.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/scrolledtext.py
new file mode 100644
index 0000000..13bd660
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/scrolledtext.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.scrolledtext import *
+else:
+ try:
+ from ScrolledText import *
+ except ImportError:
+ raise ImportError('The ScrolledText module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/simpledialog.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/simpledialog.py
new file mode 100644
index 0000000..e952fa9
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/simpledialog.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.simpledialog import *
+else:
+ try:
+ from SimpleDialog import *
+ except ImportError:
+ raise ImportError('The SimpleDialog module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/tix.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/tix.py
new file mode 100644
index 0000000..019df6f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/tkinter/tix.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.tix import *
+else:
+ try:
+ from Tix import *
+ except ImportError:
+ raise ImportError('The Tix module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/winreg/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/winreg/__init__.py
new file mode 100644
index 0000000..97243bb
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/winreg/__init__.py
@@ -0,0 +1,10 @@
+from __future__ import absolute_import
+import sys
+__future_module__ = True
+
+if sys.version_info[0] < 3:
+ from _winreg import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/xmlrpc/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/xmlrpc/__init__.py
new file mode 100644
index 0000000..e4f853e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/xmlrpc/__init__.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+import sys
+
+if sys.version_info[0] < 3:
+ pass
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/xmlrpc/client.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/xmlrpc/client.py
new file mode 100644
index 0000000..a8d0827
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/xmlrpc/client.py
@@ -0,0 +1,5 @@
+from __future__ import absolute_import
+import sys
+
+assert sys.version_info[0] < 3
+from xmlrpclib import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/xmlrpc/server.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/xmlrpc/server.py
new file mode 100644
index 0000000..a8d0827
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2/xmlrpc/server.py
@@ -0,0 +1,5 @@
+from __future__ import absolute_import
+import sys
+
+assert sys.version_info[0] < 3
+from xmlrpclib import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/__init__.py
new file mode 100644
index 0000000..a93381f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/__init__.py
@@ -0,0 +1,94 @@
+"""
+future: Easy, safe support for Python 2/3 compatibility
+=======================================================
+
+``future`` is the missing compatibility layer between Python 2 and Python
+3. It allows you to use a single, clean Python 3.x-compatible codebase to
+support both Python 2 and Python 3 with minimal overhead.
+
+It is designed to be used as follows::
+
+ from __future__ import (absolute_import, division,
+ print_function, unicode_literals)
+ from builtins import (
+ bytes, dict, int, list, object, range, str,
+ ascii, chr, hex, input, next, oct, open,
+ pow, round, super,
+ filter, map, zip)
+
+followed by predominantly standard, idiomatic Python 3 code that then runs
+similarly on Python 2.6/2.7 and Python 3.3+.
+
+The imports have no effect on Python 3. On Python 2, they shadow the
+corresponding builtins, which normally have different semantics on Python 3
+versus 2, to provide their Python 3 semantics.
+
+
+Standard library reorganization
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+``future`` supports the standard library reorganization (PEP 3108) through the
+following Py3 interfaces:
+
+ >>> # Top-level packages with Py3 names provided on Py2:
+ >>> import configparser
+ >>> import html.parser
+ >>> import queue
+ >>> import tkinter.dialog
+ >>> import xmlrpc.client
+ >>> # etc.
+
+ >>> # Aliases provided for extensions to existing Py2 module names:
+ >>> from future.standard_library import install_aliases
+ >>> install_aliases()
+
+ >>> from collections import Counter, OrderedDict # backported to Py2.6
+ >>> from collections import UserDict, UserList, UserString
+ >>> import urllib.request
+ >>> from itertools import filterfalse, zip_longest
+ >>> from subprocess import getoutput, getstatusoutput
+
+
+Automatic conversion
+--------------------
+
+An included script called `futurize
+`_ aids in converting
+code (from either Python 2 or Python 3) to code compatible with both
+platforms. It is similar to ``python-modernize`` but goes further in
+providing Python 3 compatibility through the use of the backported types
+and builtin functions in ``future``.
+
+
+Documentation
+-------------
+
+See: http://python-future.org
+
+
+Credits
+-------
+
+:Author: Ed Schofield
+:Sponsor: Python Charmers Pty Ltd, Australia, and Python Charmers Pte
+ Ltd, Singapore. http://pythoncharmers.com
+:Others: See docs/credits.rst or http://python-future.org/credits.html
+
+
+Licensing
+---------
+Copyright 2013-2015 Python Charmers Pty Ltd, Australia.
+The software is distributed under an MIT licence. See LICENSE.txt.
+
+"""
+
+__title__ = 'future'
+__author__ = 'Ed Schofield'
+__license__ = 'MIT'
+__copyright__ = 'Copyright 2013-2015 Python Charmers Pty Ltd'
+__ver_major__ = 0
+__ver_minor__ = 14
+__ver_patch__ = 3
+__ver_sub__ = ''
+__version__ = "%d.%d.%d%s" % (__ver_major__, __ver_minor__,
+ __ver_patch__, __ver_sub__)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/__init__.py
new file mode 100644
index 0000000..d68c0f4
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/__init__.py
@@ -0,0 +1,8 @@
+# future.backports package
+from __future__ import absolute_import
+import sys
+__future_module__ = True
+from future.standard_library import import_top_level_modules
+
+if sys.version_info[0] == 3:
+ import_top_level_modules()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/_markupbase.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/_markupbase.py
new file mode 100644
index 0000000..d51bfc7
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/_markupbase.py
@@ -0,0 +1,422 @@
+"""Shared support for scanning document type declarations in HTML and XHTML.
+
+Backported for python-future from Python 3.3. Reason: ParserBase is an
+old-style class in the Python 2.7 source of markupbase.py, which I suspect
+might be the cause of sporadic unit-test failures on travis-ci.org with
+test_htmlparser.py. The test failures look like this:
+
+ ======================================================================
+
+ERROR: test_attr_entity_replacement (future.tests.test_htmlparser.AttributesStrictTestCase)
+
+----------------------------------------------------------------------
+
+Traceback (most recent call last):
+ File "/home/travis/build/edschofield/python-future/future/tests/test_htmlparser.py", line 661, in test_attr_entity_replacement
+ [("starttag", "a", [("b", "&><\"'")])])
+ File "/home/travis/build/edschofield/python-future/future/tests/test_htmlparser.py", line 93, in _run_check
+ collector = self.get_collector()
+ File "/home/travis/build/edschofield/python-future/future/tests/test_htmlparser.py", line 617, in get_collector
+ return EventCollector(strict=True)
+ File "/home/travis/build/edschofield/python-future/future/tests/test_htmlparser.py", line 27, in __init__
+ html.parser.HTMLParser.__init__(self, *args, **kw)
+ File "/home/travis/build/edschofield/python-future/future/backports/html/parser.py", line 135, in __init__
+ self.reset()
+ File "/home/travis/build/edschofield/python-future/future/backports/html/parser.py", line 143, in reset
+ _markupbase.ParserBase.reset(self)
+
+TypeError: unbound method reset() must be called with ParserBase instance as first argument (got EventCollector instance instead)
+
+This module is used as a foundation for the html.parser module. It has no
+documented public API and should not be used directly.
+
+"""
+
+import re
+
+_declname_match = re.compile(r'[a-zA-Z][-_.a-zA-Z0-9]*\s*').match
+_declstringlit_match = re.compile(r'(\'[^\']*\'|"[^"]*")\s*').match
+_commentclose = re.compile(r'--\s*>')
+_markedsectionclose = re.compile(r']\s*]\s*>')
+
+# An analysis of the MS-Word extensions is available at
+# http://www.planetpublish.com/xmlarena/xap/Thursday/WordtoXML.pdf
+
+_msmarkedsectionclose = re.compile(r']\s*>')
+
+del re
+
+
+class ParserBase(object):
+ """Parser base class which provides some common support methods used
+ by the SGML/HTML and XHTML parsers."""
+
+ def __init__(self):
+ if self.__class__ is ParserBase:
+ raise RuntimeError(
+ "_markupbase.ParserBase must be subclassed")
+
+ def error(self, message):
+ raise NotImplementedError(
+ "subclasses of ParserBase must override error()")
+
+ def reset(self):
+ self.lineno = 1
+ self.offset = 0
+
+ def getpos(self):
+ """Return current line number and offset."""
+ return self.lineno, self.offset
+
+ # Internal -- update line number and offset. This should be
+ # called for each piece of data exactly once, in order -- in other
+ # words the concatenation of all the input strings to this
+ # function should be exactly the entire input.
+ def updatepos(self, i, j):
+ if i >= j:
+ return j
+ rawdata = self.rawdata
+ nlines = rawdata.count("\n", i, j)
+ if nlines:
+ self.lineno = self.lineno + nlines
+ pos = rawdata.rindex("\n", i, j) # Should not fail
+ self.offset = j-(pos+1)
+ else:
+ self.offset = self.offset + j-i
+ return j
+
+ _decl_otherchars = ''
+
+ # Internal -- parse declaration (for use by subclasses).
+ def parse_declaration(self, i):
+ # This is some sort of declaration; in "HTML as
+ # deployed," this should only be the document type
+ # declaration ("").
+ # ISO 8879:1986, however, has more complex
+ # declaration syntax for elements in , including:
+ # --comment--
+ # [marked section]
+ # name in the following list: ENTITY, DOCTYPE, ELEMENT,
+ # ATTLIST, NOTATION, SHORTREF, USEMAP,
+ # LINKTYPE, LINK, IDLINK, USELINK, SYSTEM
+ rawdata = self.rawdata
+ j = i + 2
+ assert rawdata[i:j] == "":
+ # the empty comment
+ return j + 1
+ if rawdata[j:j+1] in ("-", ""):
+ # Start of comment followed by buffer boundary,
+ # or just a buffer boundary.
+ return -1
+ # A simple, practical version could look like: ((name|stringlit) S*) + '>'
+ n = len(rawdata)
+ if rawdata[j:j+2] == '--': #comment
+ # Locate --.*-- as the body of the comment
+ return self.parse_comment(i)
+ elif rawdata[j] == '[': #marked section
+ # Locate [statusWord [...arbitrary SGML...]] as the body of the marked section
+ # Where statusWord is one of TEMP, CDATA, IGNORE, INCLUDE, RCDATA
+ # Note that this is extended by Microsoft Office "Save as Web" function
+ # to include [if...] and [endif].
+ return self.parse_marked_section(i)
+ else: #all other declaration elements
+ decltype, j = self._scan_name(j, i)
+ if j < 0:
+ return j
+ if decltype == "doctype":
+ self._decl_otherchars = ''
+ while j < n:
+ c = rawdata[j]
+ if c == ">":
+ # end of declaration syntax
+ data = rawdata[i+2:j]
+ if decltype == "doctype":
+ self.handle_decl(data)
+ else:
+ # According to the HTML5 specs sections "8.2.4.44 Bogus
+ # comment state" and "8.2.4.45 Markup declaration open
+ # state", a comment token should be emitted.
+ # Calling unknown_decl provides more flexibility though.
+ self.unknown_decl(data)
+ return j + 1
+ if c in "\"'":
+ m = _declstringlit_match(rawdata, j)
+ if not m:
+ return -1 # incomplete
+ j = m.end()
+ elif c in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ":
+ name, j = self._scan_name(j, i)
+ elif c in self._decl_otherchars:
+ j = j + 1
+ elif c == "[":
+ # this could be handled in a separate doctype parser
+ if decltype == "doctype":
+ j = self._parse_doctype_subset(j + 1, i)
+ elif decltype in set(["attlist", "linktype", "link", "element"]):
+ # must tolerate []'d groups in a content model in an element declaration
+ # also in data attribute specifications of attlist declaration
+ # also link type declaration subsets in linktype declarations
+ # also link attribute specification lists in link declarations
+ self.error("unsupported '[' char in %s declaration" % decltype)
+ else:
+ self.error("unexpected '[' char in declaration")
+ else:
+ self.error(
+ "unexpected %r char in declaration" % rawdata[j])
+ if j < 0:
+ return j
+ return -1 # incomplete
+
+ # Internal -- parse a marked section
+ # Override this to handle MS-word extension syntax content
+ def parse_marked_section(self, i, report=1):
+ rawdata= self.rawdata
+ assert rawdata[i:i+3] == ' ending
+ match= _markedsectionclose.search(rawdata, i+3)
+ elif sectName in set(["if", "else", "endif"]):
+ # look for MS Office ]> ending
+ match= _msmarkedsectionclose.search(rawdata, i+3)
+ else:
+ self.error('unknown status keyword %r in marked section' % rawdata[i+3:j])
+ if not match:
+ return -1
+ if report:
+ j = match.start(0)
+ self.unknown_decl(rawdata[i+3: j])
+ return match.end(0)
+
+ # Internal -- parse comment, return length or -1 if not terminated
+ def parse_comment(self, i, report=1):
+ rawdata = self.rawdata
+ if rawdata[i:i+4] != ' delimiter transport-padding
+ # --> CRLF body-part
+ for body_part in msgtexts:
+ # delimiter transport-padding CRLF
+ self.write(self._NL + '--' + boundary + self._NL)
+ # body-part
+ self._fp.write(body_part)
+ # close-delimiter transport-padding
+ self.write(self._NL + '--' + boundary + '--')
+ if msg.epilogue is not None:
+ self.write(self._NL)
+ if self._mangle_from_:
+ epilogue = fcre.sub('>From ', msg.epilogue)
+ else:
+ epilogue = msg.epilogue
+ self._write_lines(epilogue)
+
+ def _handle_multipart_signed(self, msg):
+ # The contents of signed parts has to stay unmodified in order to keep
+ # the signature intact per RFC1847 2.1, so we disable header wrapping.
+ # RDM: This isn't enough to completely preserve the part, but it helps.
+ p = self.policy
+ self.policy = p.clone(max_line_length=0)
+ try:
+ self._handle_multipart(msg)
+ finally:
+ self.policy = p
+
+ def _handle_message_delivery_status(self, msg):
+ # We can't just write the headers directly to self's file object
+ # because this will leave an extra newline between the last header
+ # block and the boundary. Sigh.
+ blocks = []
+ for part in msg.get_payload():
+ s = self._new_buffer()
+ g = self.clone(s)
+ g.flatten(part, unixfrom=False, linesep=self._NL)
+ text = s.getvalue()
+ lines = text.split(self._encoded_NL)
+ # Strip off the unnecessary trailing empty line
+ if lines and lines[-1] == self._encoded_EMPTY:
+ blocks.append(self._encoded_NL.join(lines[:-1]))
+ else:
+ blocks.append(text)
+ # Now join all the blocks with an empty line. This has the lovely
+ # effect of separating each block with an empty line, but not adding
+ # an extra one after the last one.
+ self._fp.write(self._encoded_NL.join(blocks))
+
+ def _handle_message(self, msg):
+ s = self._new_buffer()
+ g = self.clone(s)
+ # The payload of a message/rfc822 part should be a multipart sequence
+ # of length 1. The zeroth element of the list should be the Message
+ # object for the subpart. Extract that object, stringify it, and
+ # write it out.
+ # Except, it turns out, when it's a string instead, which happens when
+ # and only when HeaderParser is used on a message of mime type
+ # message/rfc822. Such messages are generated by, for example,
+ # Groupwise when forwarding unadorned messages. (Issue 7970.) So
+ # in that case we just emit the string body.
+ payload = msg._payload
+ if isinstance(payload, list):
+ g.flatten(msg.get_payload(0), unixfrom=False, linesep=self._NL)
+ payload = s.getvalue()
+ else:
+ payload = self._encode(payload)
+ self._fp.write(payload)
+
+ # This used to be a module level function; we use a classmethod for this
+ # and _compile_re so we can continue to provide the module level function
+ # for backward compatibility by doing
+ # _make_boudary = Generator._make_boundary
+ # at the end of the module. It *is* internal, so we could drop that...
+ @classmethod
+ def _make_boundary(cls, text=None):
+ # Craft a random boundary. If text is given, ensure that the chosen
+ # boundary doesn't appear in the text.
+ token = random.randrange(sys.maxsize)
+ boundary = ('=' * 15) + (_fmt % token) + '=='
+ if text is None:
+ return boundary
+ b = boundary
+ counter = 0
+ while True:
+ cre = cls._compile_re('^--' + re.escape(b) + '(--)?$', re.MULTILINE)
+ if not cre.search(text):
+ break
+ b = boundary + '.' + str(counter)
+ counter += 1
+ return b
+
+ @classmethod
+ def _compile_re(cls, s, flags):
+ return re.compile(s, flags)
+
+class BytesGenerator(Generator):
+ """Generates a bytes version of a Message object tree.
+
+ Functionally identical to the base Generator except that the output is
+ bytes and not string. When surrogates were used in the input to encode
+ bytes, these are decoded back to bytes for output. If the policy has
+ cte_type set to 7bit, then the message is transformed such that the
+ non-ASCII bytes are properly content transfer encoded, using the charset
+ unknown-8bit.
+
+ The outfp object must accept bytes in its write method.
+ """
+
+ # Bytes versions of this constant for use in manipulating data from
+ # the BytesIO buffer.
+ _encoded_EMPTY = b''
+
+ def write(self, s):
+ self._fp.write(str(s).encode('ascii', 'surrogateescape'))
+
+ def _new_buffer(self):
+ return BytesIO()
+
+ def _encode(self, s):
+ return s.encode('ascii')
+
+ def _write_headers(self, msg):
+ # This is almost the same as the string version, except for handling
+ # strings with 8bit bytes.
+ for h, v in msg.raw_items():
+ self._fp.write(self.policy.fold_binary(h, v))
+ # A blank line always separates headers from body
+ self.write(self._NL)
+
+ def _handle_text(self, msg):
+ # If the string has surrogates the original source was bytes, so
+ # just write it back out.
+ if msg._payload is None:
+ return
+ if _has_surrogates(msg._payload) and not self.policy.cte_type=='7bit':
+ if self._mangle_from_:
+ msg._payload = fcre.sub(">From ", msg._payload)
+ self._write_lines(msg._payload)
+ else:
+ super(BytesGenerator,self)._handle_text(msg)
+
+ # Default body handler
+ _writeBody = _handle_text
+
+ @classmethod
+ def _compile_re(cls, s, flags):
+ return re.compile(s.encode('ascii'), flags)
+
+
+_FMT = '[Non-text (%(type)s) part of message omitted, filename %(filename)s]'
+
+class DecodedGenerator(Generator):
+ """Generates a text representation of a message.
+
+ Like the Generator base class, except that non-text parts are substituted
+ with a format string representing the part.
+ """
+ def __init__(self, outfp, mangle_from_=True, maxheaderlen=78, fmt=None):
+ """Like Generator.__init__() except that an additional optional
+ argument is allowed.
+
+ Walks through all subparts of a message. If the subpart is of main
+ type `text', then it prints the decoded payload of the subpart.
+
+ Otherwise, fmt is a format string that is used instead of the message
+ payload. fmt is expanded with the following keywords (in
+ %(keyword)s format):
+
+ type : Full MIME type of the non-text part
+ maintype : Main MIME type of the non-text part
+ subtype : Sub-MIME type of the non-text part
+ filename : Filename of the non-text part
+ description: Description associated with the non-text part
+ encoding : Content transfer encoding of the non-text part
+
+ The default value for fmt is None, meaning
+
+ [Non-text (%(type)s) part of message omitted, filename %(filename)s]
+ """
+ Generator.__init__(self, outfp, mangle_from_, maxheaderlen)
+ if fmt is None:
+ self._fmt = _FMT
+ else:
+ self._fmt = fmt
+
+ def _dispatch(self, msg):
+ for part in msg.walk():
+ maintype = part.get_content_maintype()
+ if maintype == 'text':
+ print(part.get_payload(decode=False), file=self)
+ elif maintype == 'multipart':
+ # Just skip this
+ pass
+ else:
+ print(self._fmt % {
+ 'type' : part.get_content_type(),
+ 'maintype' : part.get_content_maintype(),
+ 'subtype' : part.get_content_subtype(),
+ 'filename' : part.get_filename('[no filename]'),
+ 'description': part.get('Content-Description',
+ '[no description]'),
+ 'encoding' : part.get('Content-Transfer-Encoding',
+ '[no encoding]'),
+ }, file=self)
+
+
+# Helper used by Generator._make_boundary
+_width = len(repr(sys.maxsize-1))
+_fmt = '%%0%dd' % _width
+
+# Backward compatibility
+_make_boundary = Generator._make_boundary
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/header.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/header.py
new file mode 100644
index 0000000..63bf038
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/header.py
@@ -0,0 +1,581 @@
+# Copyright (C) 2002-2007 Python Software Foundation
+# Author: Ben Gertzfield, Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Header encoding and decoding functionality."""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+from future.builtins import bytes, range, str, super, zip
+
+__all__ = [
+ 'Header',
+ 'decode_header',
+ 'make_header',
+ ]
+
+import re
+import binascii
+
+from future.backports import email
+from future.backports.email import base64mime
+from future.backports.email.errors import HeaderParseError
+import future.backports.email.charset as _charset
+
+# Helpers
+from future.backports.email.quoprimime import _max_append, header_decode
+
+Charset = _charset.Charset
+
+NL = '\n'
+SPACE = ' '
+BSPACE = b' '
+SPACE8 = ' ' * 8
+EMPTYSTRING = ''
+MAXLINELEN = 78
+FWS = ' \t'
+
+USASCII = Charset('us-ascii')
+UTF8 = Charset('utf-8')
+
+# Match encoded-word strings in the form =?charset?q?Hello_World?=
+ecre = re.compile(r'''
+ =\? # literal =?
+ (?P[^?]*?) # non-greedy up to the next ? is the charset
+ \? # literal ?
+ (?P[qb]) # either a "q" or a "b", case insensitive
+ \? # literal ?
+ (?P.*?) # non-greedy up to the next ?= is the encoded string
+ \?= # literal ?=
+ ''', re.VERBOSE | re.IGNORECASE | re.MULTILINE)
+
+# Field name regexp, including trailing colon, but not separating whitespace,
+# according to RFC 2822. Character range is from tilde to exclamation mark.
+# For use with .match()
+fcre = re.compile(r'[\041-\176]+:$')
+
+# Find a header embedded in a putative header value. Used to check for
+# header injection attack.
+_embeded_header = re.compile(r'\n[^ \t]+:')
+
+
+def decode_header(header):
+ """Decode a message header value without converting charset.
+
+ Returns a list of (string, charset) pairs containing each of the decoded
+ parts of the header. Charset is None for non-encoded parts of the header,
+ otherwise a lower-case string containing the name of the character set
+ specified in the encoded string.
+
+ header may be a string that may or may not contain RFC2047 encoded words,
+ or it may be a Header object.
+
+ An email.errors.HeaderParseError may be raised when certain decoding error
+ occurs (e.g. a base64 decoding exception).
+ """
+ # If it is a Header object, we can just return the encoded chunks.
+ if hasattr(header, '_chunks'):
+ return [(_charset._encode(string, str(charset)), str(charset))
+ for string, charset in header._chunks]
+ # If no encoding, just return the header with no charset.
+ if not ecre.search(header):
+ return [(header, None)]
+ # First step is to parse all the encoded parts into triplets of the form
+ # (encoded_string, encoding, charset). For unencoded strings, the last
+ # two parts will be None.
+ words = []
+ for line in header.splitlines():
+ parts = ecre.split(line)
+ first = True
+ while parts:
+ unencoded = parts.pop(0)
+ if first:
+ unencoded = unencoded.lstrip()
+ first = False
+ if unencoded:
+ words.append((unencoded, None, None))
+ if parts:
+ charset = parts.pop(0).lower()
+ encoding = parts.pop(0).lower()
+ encoded = parts.pop(0)
+ words.append((encoded, encoding, charset))
+ # Now loop over words and remove words that consist of whitespace
+ # between two encoded strings.
+ import sys
+ droplist = []
+ for n, w in enumerate(words):
+ if n>1 and w[1] and words[n-2][1] and words[n-1][0].isspace():
+ droplist.append(n-1)
+ for d in reversed(droplist):
+ del words[d]
+
+ # The next step is to decode each encoded word by applying the reverse
+ # base64 or quopri transformation. decoded_words is now a list of the
+ # form (decoded_word, charset).
+ decoded_words = []
+ for encoded_string, encoding, charset in words:
+ if encoding is None:
+ # This is an unencoded word.
+ decoded_words.append((encoded_string, charset))
+ elif encoding == 'q':
+ word = header_decode(encoded_string)
+ decoded_words.append((word, charset))
+ elif encoding == 'b':
+ paderr = len(encoded_string) % 4 # Postel's law: add missing padding
+ if paderr:
+ encoded_string += '==='[:4 - paderr]
+ try:
+ word = base64mime.decode(encoded_string)
+ except binascii.Error:
+ raise HeaderParseError('Base64 decoding error')
+ else:
+ decoded_words.append((word, charset))
+ else:
+ raise AssertionError('Unexpected encoding: ' + encoding)
+ # Now convert all words to bytes and collapse consecutive runs of
+ # similarly encoded words.
+ collapsed = []
+ last_word = last_charset = None
+ for word, charset in decoded_words:
+ if isinstance(word, str):
+ word = bytes(word, 'raw-unicode-escape')
+ if last_word is None:
+ last_word = word
+ last_charset = charset
+ elif charset != last_charset:
+ collapsed.append((last_word, last_charset))
+ last_word = word
+ last_charset = charset
+ elif last_charset is None:
+ last_word += BSPACE + word
+ else:
+ last_word += word
+ collapsed.append((last_word, last_charset))
+ return collapsed
+
+
+def make_header(decoded_seq, maxlinelen=None, header_name=None,
+ continuation_ws=' '):
+ """Create a Header from a sequence of pairs as returned by decode_header()
+
+ decode_header() takes a header value string and returns a sequence of
+ pairs of the format (decoded_string, charset) where charset is the string
+ name of the character set.
+
+ This function takes one of those sequence of pairs and returns a Header
+ instance. Optional maxlinelen, header_name, and continuation_ws are as in
+ the Header constructor.
+ """
+ h = Header(maxlinelen=maxlinelen, header_name=header_name,
+ continuation_ws=continuation_ws)
+ for s, charset in decoded_seq:
+ # None means us-ascii but we can simply pass it on to h.append()
+ if charset is not None and not isinstance(charset, Charset):
+ charset = Charset(charset)
+ h.append(s, charset)
+ return h
+
+
+class Header(object):
+ def __init__(self, s=None, charset=None,
+ maxlinelen=None, header_name=None,
+ continuation_ws=' ', errors='strict'):
+ """Create a MIME-compliant header that can contain many character sets.
+
+ Optional s is the initial header value. If None, the initial header
+ value is not set. You can later append to the header with .append()
+ method calls. s may be a byte string or a Unicode string, but see the
+ .append() documentation for semantics.
+
+ Optional charset serves two purposes: it has the same meaning as the
+ charset argument to the .append() method. It also sets the default
+ character set for all subsequent .append() calls that omit the charset
+ argument. If charset is not provided in the constructor, the us-ascii
+ charset is used both as s's initial charset and as the default for
+ subsequent .append() calls.
+
+ The maximum line length can be specified explicitly via maxlinelen. For
+ splitting the first line to a shorter value (to account for the field
+ header which isn't included in s, e.g. `Subject') pass in the name of
+ the field in header_name. The default maxlinelen is 78 as recommended
+ by RFC 2822.
+
+ continuation_ws must be RFC 2822 compliant folding whitespace (usually
+ either a space or a hard tab) which will be prepended to continuation
+ lines.
+
+ errors is passed through to the .append() call.
+ """
+ if charset is None:
+ charset = USASCII
+ elif not isinstance(charset, Charset):
+ charset = Charset(charset)
+ self._charset = charset
+ self._continuation_ws = continuation_ws
+ self._chunks = []
+ if s is not None:
+ self.append(s, charset, errors)
+ if maxlinelen is None:
+ maxlinelen = MAXLINELEN
+ self._maxlinelen = maxlinelen
+ if header_name is None:
+ self._headerlen = 0
+ else:
+ # Take the separating colon and space into account.
+ self._headerlen = len(header_name) + 2
+
+ def __str__(self):
+ """Return the string value of the header."""
+ self._normalize()
+ uchunks = []
+ lastcs = None
+ lastspace = None
+ for string, charset in self._chunks:
+ # We must preserve spaces between encoded and non-encoded word
+ # boundaries, which means for us we need to add a space when we go
+ # from a charset to None/us-ascii, or from None/us-ascii to a
+ # charset. Only do this for the second and subsequent chunks.
+ # Don't add a space if the None/us-ascii string already has
+ # a space (trailing or leading depending on transition)
+ nextcs = charset
+ if nextcs == _charset.UNKNOWN8BIT:
+ original_bytes = string.encode('ascii', 'surrogateescape')
+ string = original_bytes.decode('ascii', 'replace')
+ if uchunks:
+ hasspace = string and self._nonctext(string[0])
+ if lastcs not in (None, 'us-ascii'):
+ if nextcs in (None, 'us-ascii') and not hasspace:
+ uchunks.append(SPACE)
+ nextcs = None
+ elif nextcs not in (None, 'us-ascii') and not lastspace:
+ uchunks.append(SPACE)
+ lastspace = string and self._nonctext(string[-1])
+ lastcs = nextcs
+ uchunks.append(string)
+ return EMPTYSTRING.join(uchunks)
+
+ # Rich comparison operators for equality only. BAW: does it make sense to
+ # have or explicitly disable <, <=, >, >= operators?
+ def __eq__(self, other):
+ # other may be a Header or a string. Both are fine so coerce
+ # ourselves to a unicode (of the unencoded header value), swap the
+ # args and do another comparison.
+ return other == str(self)
+
+ def __ne__(self, other):
+ return not self == other
+
+ def append(self, s, charset=None, errors='strict'):
+ """Append a string to the MIME header.
+
+ Optional charset, if given, should be a Charset instance or the name
+ of a character set (which will be converted to a Charset instance). A
+ value of None (the default) means that the charset given in the
+ constructor is used.
+
+ s may be a byte string or a Unicode string. If it is a byte string
+ (i.e. isinstance(s, str) is false), then charset is the encoding of
+ that byte string, and a UnicodeError will be raised if the string
+ cannot be decoded with that charset. If s is a Unicode string, then
+ charset is a hint specifying the character set of the characters in
+ the string. In either case, when producing an RFC 2822 compliant
+ header using RFC 2047 rules, the string will be encoded using the
+ output codec of the charset. If the string cannot be encoded to the
+ output codec, a UnicodeError will be raised.
+
+ Optional `errors' is passed as the errors argument to the decode
+ call if s is a byte string.
+ """
+ if charset is None:
+ charset = self._charset
+ elif not isinstance(charset, Charset):
+ charset = Charset(charset)
+ if not isinstance(s, str):
+ input_charset = charset.input_codec or 'us-ascii'
+ if input_charset == _charset.UNKNOWN8BIT:
+ s = s.decode('us-ascii', 'surrogateescape')
+ else:
+ s = s.decode(input_charset, errors)
+ # Ensure that the bytes we're storing can be decoded to the output
+ # character set, otherwise an early error is raised.
+ output_charset = charset.output_codec or 'us-ascii'
+ if output_charset != _charset.UNKNOWN8BIT:
+ try:
+ s.encode(output_charset, errors)
+ except UnicodeEncodeError:
+ if output_charset!='us-ascii':
+ raise
+ charset = UTF8
+ self._chunks.append((s, charset))
+
+ def _nonctext(self, s):
+ """True if string s is not a ctext character of RFC822.
+ """
+ return s.isspace() or s in ('(', ')', '\\')
+
+ def encode(self, splitchars=';, \t', maxlinelen=None, linesep='\n'):
+ r"""Encode a message header into an RFC-compliant format.
+
+ There are many issues involved in converting a given string for use in
+ an email header. Only certain character sets are readable in most
+ email clients, and as header strings can only contain a subset of
+ 7-bit ASCII, care must be taken to properly convert and encode (with
+ Base64 or quoted-printable) header strings. In addition, there is a
+ 75-character length limit on any given encoded header field, so
+ line-wrapping must be performed, even with double-byte character sets.
+
+ Optional maxlinelen specifies the maximum length of each generated
+ line, exclusive of the linesep string. Individual lines may be longer
+ than maxlinelen if a folding point cannot be found. The first line
+ will be shorter by the length of the header name plus ": " if a header
+ name was specified at Header construction time. The default value for
+ maxlinelen is determined at header construction time.
+
+ Optional splitchars is a string containing characters which should be
+ given extra weight by the splitting algorithm during normal header
+ wrapping. This is in very rough support of RFC 2822's `higher level
+ syntactic breaks': split points preceded by a splitchar are preferred
+ during line splitting, with the characters preferred in the order in
+ which they appear in the string. Space and tab may be included in the
+ string to indicate whether preference should be given to one over the
+ other as a split point when other split chars do not appear in the line
+ being split. Splitchars does not affect RFC 2047 encoded lines.
+
+ Optional linesep is a string to be used to separate the lines of
+ the value. The default value is the most useful for typical
+ Python applications, but it can be set to \r\n to produce RFC-compliant
+ line separators when needed.
+ """
+ self._normalize()
+ if maxlinelen is None:
+ maxlinelen = self._maxlinelen
+ # A maxlinelen of 0 means don't wrap. For all practical purposes,
+ # choosing a huge number here accomplishes that and makes the
+ # _ValueFormatter algorithm much simpler.
+ if maxlinelen == 0:
+ maxlinelen = 1000000
+ formatter = _ValueFormatter(self._headerlen, maxlinelen,
+ self._continuation_ws, splitchars)
+ lastcs = None
+ hasspace = lastspace = None
+ for string, charset in self._chunks:
+ if hasspace is not None:
+ hasspace = string and self._nonctext(string[0])
+ import sys
+ if lastcs not in (None, 'us-ascii'):
+ if not hasspace or charset not in (None, 'us-ascii'):
+ formatter.add_transition()
+ elif charset not in (None, 'us-ascii') and not lastspace:
+ formatter.add_transition()
+ lastspace = string and self._nonctext(string[-1])
+ lastcs = charset
+ hasspace = False
+ lines = string.splitlines()
+ if lines:
+ formatter.feed('', lines[0], charset)
+ else:
+ formatter.feed('', '', charset)
+ for line in lines[1:]:
+ formatter.newline()
+ if charset.header_encoding is not None:
+ formatter.feed(self._continuation_ws, ' ' + line.lstrip(),
+ charset)
+ else:
+ sline = line.lstrip()
+ fws = line[:len(line)-len(sline)]
+ formatter.feed(fws, sline, charset)
+ if len(lines) > 1:
+ formatter.newline()
+ if self._chunks:
+ formatter.add_transition()
+ value = formatter._str(linesep)
+ if _embeded_header.search(value):
+ raise HeaderParseError("header value appears to contain "
+ "an embedded header: {!r}".format(value))
+ return value
+
+ def _normalize(self):
+ # Step 1: Normalize the chunks so that all runs of identical charsets
+ # get collapsed into a single unicode string.
+ chunks = []
+ last_charset = None
+ last_chunk = []
+ for string, charset in self._chunks:
+ if charset == last_charset:
+ last_chunk.append(string)
+ else:
+ if last_charset is not None:
+ chunks.append((SPACE.join(last_chunk), last_charset))
+ last_chunk = [string]
+ last_charset = charset
+ if last_chunk:
+ chunks.append((SPACE.join(last_chunk), last_charset))
+ self._chunks = chunks
+
+
+class _ValueFormatter(object):
+ def __init__(self, headerlen, maxlen, continuation_ws, splitchars):
+ self._maxlen = maxlen
+ self._continuation_ws = continuation_ws
+ self._continuation_ws_len = len(continuation_ws)
+ self._splitchars = splitchars
+ self._lines = []
+ self._current_line = _Accumulator(headerlen)
+
+ def _str(self, linesep):
+ self.newline()
+ return linesep.join(self._lines)
+
+ def __str__(self):
+ return self._str(NL)
+
+ def newline(self):
+ end_of_line = self._current_line.pop()
+ if end_of_line != (' ', ''):
+ self._current_line.push(*end_of_line)
+ if len(self._current_line) > 0:
+ if self._current_line.is_onlyws():
+ self._lines[-1] += str(self._current_line)
+ else:
+ self._lines.append(str(self._current_line))
+ self._current_line.reset()
+
+ def add_transition(self):
+ self._current_line.push(' ', '')
+
+ def feed(self, fws, string, charset):
+ # If the charset has no header encoding (i.e. it is an ASCII encoding)
+ # then we must split the header at the "highest level syntactic break"
+ # possible. Note that we don't have a lot of smarts about field
+ # syntax; we just try to break on semi-colons, then commas, then
+ # whitespace. Eventually, this should be pluggable.
+ if charset.header_encoding is None:
+ self._ascii_split(fws, string, self._splitchars)
+ return
+ # Otherwise, we're doing either a Base64 or a quoted-printable
+ # encoding which means we don't need to split the line on syntactic
+ # breaks. We can basically just find enough characters to fit on the
+ # current line, minus the RFC 2047 chrome. What makes this trickier
+ # though is that we have to split at octet boundaries, not character
+ # boundaries but it's only safe to split at character boundaries so at
+ # best we can only get close.
+ encoded_lines = charset.header_encode_lines(string, self._maxlengths())
+ # The first element extends the current line, but if it's None then
+ # nothing more fit on the current line so start a new line.
+ try:
+ first_line = encoded_lines.pop(0)
+ except IndexError:
+ # There are no encoded lines, so we're done.
+ return
+ if first_line is not None:
+ self._append_chunk(fws, first_line)
+ try:
+ last_line = encoded_lines.pop()
+ except IndexError:
+ # There was only one line.
+ return
+ self.newline()
+ self._current_line.push(self._continuation_ws, last_line)
+ # Everything else are full lines in themselves.
+ for line in encoded_lines:
+ self._lines.append(self._continuation_ws + line)
+
+ def _maxlengths(self):
+ # The first line's length.
+ yield self._maxlen - len(self._current_line)
+ while True:
+ yield self._maxlen - self._continuation_ws_len
+
+ def _ascii_split(self, fws, string, splitchars):
+ # The RFC 2822 header folding algorithm is simple in principle but
+ # complex in practice. Lines may be folded any place where "folding
+ # white space" appears by inserting a linesep character in front of the
+ # FWS. The complication is that not all spaces or tabs qualify as FWS,
+ # and we are also supposed to prefer to break at "higher level
+ # syntactic breaks". We can't do either of these without intimate
+ # knowledge of the structure of structured headers, which we don't have
+ # here. So the best we can do here is prefer to break at the specified
+ # splitchars, and hope that we don't choose any spaces or tabs that
+ # aren't legal FWS. (This is at least better than the old algorithm,
+ # where we would sometimes *introduce* FWS after a splitchar, or the
+ # algorithm before that, where we would turn all white space runs into
+ # single spaces or tabs.)
+ parts = re.split("(["+FWS+"]+)", fws+string)
+ if parts[0]:
+ parts[:0] = ['']
+ else:
+ parts.pop(0)
+ for fws, part in zip(*[iter(parts)]*2):
+ self._append_chunk(fws, part)
+
+ def _append_chunk(self, fws, string):
+ self._current_line.push(fws, string)
+ if len(self._current_line) > self._maxlen:
+ # Find the best split point, working backward from the end.
+ # There might be none, on a long first line.
+ for ch in self._splitchars:
+ for i in range(self._current_line.part_count()-1, 0, -1):
+ if ch.isspace():
+ fws = self._current_line[i][0]
+ if fws and fws[0]==ch:
+ break
+ prevpart = self._current_line[i-1][1]
+ if prevpart and prevpart[-1]==ch:
+ break
+ else:
+ continue
+ break
+ else:
+ fws, part = self._current_line.pop()
+ if self._current_line._initial_size > 0:
+ # There will be a header, so leave it on a line by itself.
+ self.newline()
+ if not fws:
+ # We don't use continuation_ws here because the whitespace
+ # after a header should always be a space.
+ fws = ' '
+ self._current_line.push(fws, part)
+ return
+ remainder = self._current_line.pop_from(i)
+ self._lines.append(str(self._current_line))
+ self._current_line.reset(remainder)
+
+
+class _Accumulator(list):
+
+ def __init__(self, initial_size=0):
+ self._initial_size = initial_size
+ super().__init__()
+
+ def push(self, fws, string):
+ self.append((fws, string))
+
+ def pop_from(self, i=0):
+ popped = self[i:]
+ self[i:] = []
+ return popped
+
+ def pop(self):
+ if self.part_count()==0:
+ return ('', '')
+ return super().pop()
+
+ def __len__(self):
+ return sum((len(fws)+len(part) for fws, part in self),
+ self._initial_size)
+
+ def __str__(self):
+ return EMPTYSTRING.join((EMPTYSTRING.join((fws, part))
+ for fws, part in self))
+
+ def reset(self, startval=None):
+ if startval is None:
+ startval = []
+ self[:] = startval
+ self._initial_size = 0
+
+ def is_onlyws(self):
+ return self._initial_size==0 and (not self or str(self).isspace())
+
+ def part_count(self):
+ return super().__len__()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/headerregistry.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/headerregistry.py
new file mode 100644
index 0000000..9aaad65
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/headerregistry.py
@@ -0,0 +1,592 @@
+"""Representing and manipulating email headers via custom objects.
+
+This module provides an implementation of the HeaderRegistry API.
+The implementation is designed to flexibly follow RFC5322 rules.
+
+Eventually HeaderRegistry will be a public API, but it isn't yet,
+and will probably change some before that happens.
+
+"""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+from future.builtins import super
+from future.builtins import str
+from future.utils import text_to_native_str
+from future.backports.email import utils
+from future.backports.email import errors
+from future.backports.email import _header_value_parser as parser
+
+class Address(object):
+
+ def __init__(self, display_name='', username='', domain='', addr_spec=None):
+ """Create an object represeting a full email address.
+
+ An address can have a 'display_name', a 'username', and a 'domain'. In
+ addition to specifying the username and domain separately, they may be
+ specified together by using the addr_spec keyword *instead of* the
+ username and domain keywords. If an addr_spec string is specified it
+ must be properly quoted according to RFC 5322 rules; an error will be
+ raised if it is not.
+
+ An Address object has display_name, username, domain, and addr_spec
+ attributes, all of which are read-only. The addr_spec and the string
+ value of the object are both quoted according to RFC5322 rules, but
+ without any Content Transfer Encoding.
+
+ """
+ # This clause with its potential 'raise' may only happen when an
+ # application program creates an Address object using an addr_spec
+ # keyword. The email library code itself must always supply username
+ # and domain.
+ if addr_spec is not None:
+ if username or domain:
+ raise TypeError("addrspec specified when username and/or "
+ "domain also specified")
+ a_s, rest = parser.get_addr_spec(addr_spec)
+ if rest:
+ raise ValueError("Invalid addr_spec; only '{}' "
+ "could be parsed from '{}'".format(
+ a_s, addr_spec))
+ if a_s.all_defects:
+ raise a_s.all_defects[0]
+ username = a_s.local_part
+ domain = a_s.domain
+ self._display_name = display_name
+ self._username = username
+ self._domain = domain
+
+ @property
+ def display_name(self):
+ return self._display_name
+
+ @property
+ def username(self):
+ return self._username
+
+ @property
+ def domain(self):
+ return self._domain
+
+ @property
+ def addr_spec(self):
+ """The addr_spec (username@domain) portion of the address, quoted
+ according to RFC 5322 rules, but with no Content Transfer Encoding.
+ """
+ nameset = set(self.username)
+ if len(nameset) > len(nameset-parser.DOT_ATOM_ENDS):
+ lp = parser.quote_string(self.username)
+ else:
+ lp = self.username
+ if self.domain:
+ return lp + '@' + self.domain
+ if not lp:
+ return '<>'
+ return lp
+
+ def __repr__(self):
+ return "Address(display_name={!r}, username={!r}, domain={!r})".format(
+ self.display_name, self.username, self.domain)
+
+ def __str__(self):
+ nameset = set(self.display_name)
+ if len(nameset) > len(nameset-parser.SPECIALS):
+ disp = parser.quote_string(self.display_name)
+ else:
+ disp = self.display_name
+ if disp:
+ addr_spec = '' if self.addr_spec=='<>' else self.addr_spec
+ return "{} <{}>".format(disp, addr_spec)
+ return self.addr_spec
+
+ def __eq__(self, other):
+ if type(other) != type(self):
+ return False
+ return (self.display_name == other.display_name and
+ self.username == other.username and
+ self.domain == other.domain)
+
+
+class Group(object):
+
+ def __init__(self, display_name=None, addresses=None):
+ """Create an object representing an address group.
+
+ An address group consists of a display_name followed by colon and an
+ list of addresses (see Address) terminated by a semi-colon. The Group
+ is created by specifying a display_name and a possibly empty list of
+ Address objects. A Group can also be used to represent a single
+ address that is not in a group, which is convenient when manipulating
+ lists that are a combination of Groups and individual Addresses. In
+ this case the display_name should be set to None. In particular, the
+ string representation of a Group whose display_name is None is the same
+ as the Address object, if there is one and only one Address object in
+ the addresses list.
+
+ """
+ self._display_name = display_name
+ self._addresses = tuple(addresses) if addresses else tuple()
+
+ @property
+ def display_name(self):
+ return self._display_name
+
+ @property
+ def addresses(self):
+ return self._addresses
+
+ def __repr__(self):
+ return "Group(display_name={!r}, addresses={!r}".format(
+ self.display_name, self.addresses)
+
+ def __str__(self):
+ if self.display_name is None and len(self.addresses)==1:
+ return str(self.addresses[0])
+ disp = self.display_name
+ if disp is not None:
+ nameset = set(disp)
+ if len(nameset) > len(nameset-parser.SPECIALS):
+ disp = parser.quote_string(disp)
+ adrstr = ", ".join(str(x) for x in self.addresses)
+ adrstr = ' ' + adrstr if adrstr else adrstr
+ return "{}:{};".format(disp, adrstr)
+
+ def __eq__(self, other):
+ if type(other) != type(self):
+ return False
+ return (self.display_name == other.display_name and
+ self.addresses == other.addresses)
+
+
+# Header Classes #
+
+class BaseHeader(str):
+
+ """Base class for message headers.
+
+ Implements generic behavior and provides tools for subclasses.
+
+ A subclass must define a classmethod named 'parse' that takes an unfolded
+ value string and a dictionary as its arguments. The dictionary will
+ contain one key, 'defects', initialized to an empty list. After the call
+ the dictionary must contain two additional keys: parse_tree, set to the
+ parse tree obtained from parsing the header, and 'decoded', set to the
+ string value of the idealized representation of the data from the value.
+ (That is, encoded words are decoded, and values that have canonical
+ representations are so represented.)
+
+ The defects key is intended to collect parsing defects, which the message
+ parser will subsequently dispose of as appropriate. The parser should not,
+ insofar as practical, raise any errors. Defects should be added to the
+ list instead. The standard header parsers register defects for RFC
+ compliance issues, for obsolete RFC syntax, and for unrecoverable parsing
+ errors.
+
+ The parse method may add additional keys to the dictionary. In this case
+ the subclass must define an 'init' method, which will be passed the
+ dictionary as its keyword arguments. The method should use (usually by
+ setting them as the value of similarly named attributes) and remove all the
+ extra keys added by its parse method, and then use super to call its parent
+ class with the remaining arguments and keywords.
+
+ The subclass should also make sure that a 'max_count' attribute is defined
+ that is either None or 1. XXX: need to better define this API.
+
+ """
+
+ def __new__(cls, name, value):
+ kwds = {'defects': []}
+ cls.parse(value, kwds)
+ if utils._has_surrogates(kwds['decoded']):
+ kwds['decoded'] = utils._sanitize(kwds['decoded'])
+ self = str.__new__(cls, kwds['decoded'])
+ # del kwds['decoded']
+ self.init(name, **kwds)
+ return self
+
+ def init(self, name, **_3to2kwargs):
+ defects = _3to2kwargs['defects']; del _3to2kwargs['defects']
+ parse_tree = _3to2kwargs['parse_tree']; del _3to2kwargs['parse_tree']
+ self._name = name
+ self._parse_tree = parse_tree
+ self._defects = defects
+
+ @property
+ def name(self):
+ return self._name
+
+ @property
+ def defects(self):
+ return tuple(self._defects)
+
+ def __reduce__(self):
+ return (
+ _reconstruct_header,
+ (
+ self.__class__.__name__,
+ self.__class__.__bases__,
+ str(self),
+ ),
+ self.__dict__)
+
+ @classmethod
+ def _reconstruct(cls, value):
+ return str.__new__(cls, value)
+
+ def fold(self, **_3to2kwargs):
+ policy = _3to2kwargs['policy']; del _3to2kwargs['policy']
+ """Fold header according to policy.
+
+ The parsed representation of the header is folded according to
+ RFC5322 rules, as modified by the policy. If the parse tree
+ contains surrogateescaped bytes, the bytes are CTE encoded using
+ the charset 'unknown-8bit".
+
+ Any non-ASCII characters in the parse tree are CTE encoded using
+ charset utf-8. XXX: make this a policy setting.
+
+ The returned value is an ASCII-only string possibly containing linesep
+ characters, and ending with a linesep character. The string includes
+ the header name and the ': ' separator.
+
+ """
+ # At some point we need to only put fws here if it was in the source.
+ header = parser.Header([
+ parser.HeaderLabel([
+ parser.ValueTerminal(self.name, 'header-name'),
+ parser.ValueTerminal(':', 'header-sep')]),
+ parser.CFWSList([parser.WhiteSpaceTerminal(' ', 'fws')]),
+ self._parse_tree])
+ return header.fold(policy=policy)
+
+
+def _reconstruct_header(cls_name, bases, value):
+ return type(text_to_native_str(cls_name), bases, {})._reconstruct(value)
+
+
+class UnstructuredHeader(object):
+
+ max_count = None
+ value_parser = staticmethod(parser.get_unstructured)
+
+ @classmethod
+ def parse(cls, value, kwds):
+ kwds['parse_tree'] = cls.value_parser(value)
+ kwds['decoded'] = str(kwds['parse_tree'])
+
+
+class UniqueUnstructuredHeader(UnstructuredHeader):
+
+ max_count = 1
+
+
+class DateHeader(object):
+
+ """Header whose value consists of a single timestamp.
+
+ Provides an additional attribute, datetime, which is either an aware
+ datetime using a timezone, or a naive datetime if the timezone
+ in the input string is -0000. Also accepts a datetime as input.
+ The 'value' attribute is the normalized form of the timestamp,
+ which means it is the output of format_datetime on the datetime.
+ """
+
+ max_count = None
+
+ # This is used only for folding, not for creating 'decoded'.
+ value_parser = staticmethod(parser.get_unstructured)
+
+ @classmethod
+ def parse(cls, value, kwds):
+ if not value:
+ kwds['defects'].append(errors.HeaderMissingRequiredValue())
+ kwds['datetime'] = None
+ kwds['decoded'] = ''
+ kwds['parse_tree'] = parser.TokenList()
+ return
+ if isinstance(value, str):
+ value = utils.parsedate_to_datetime(value)
+ kwds['datetime'] = value
+ kwds['decoded'] = utils.format_datetime(kwds['datetime'])
+ kwds['parse_tree'] = cls.value_parser(kwds['decoded'])
+
+ def init(self, *args, **kw):
+ self._datetime = kw.pop('datetime')
+ super().init(*args, **kw)
+
+ @property
+ def datetime(self):
+ return self._datetime
+
+
+class UniqueDateHeader(DateHeader):
+
+ max_count = 1
+
+
+class AddressHeader(object):
+
+ max_count = None
+
+ @staticmethod
+ def value_parser(value):
+ address_list, value = parser.get_address_list(value)
+ assert not value, 'this should not happen'
+ return address_list
+
+ @classmethod
+ def parse(cls, value, kwds):
+ if isinstance(value, str):
+ # We are translating here from the RFC language (address/mailbox)
+ # to our API language (group/address).
+ kwds['parse_tree'] = address_list = cls.value_parser(value)
+ groups = []
+ for addr in address_list.addresses:
+ groups.append(Group(addr.display_name,
+ [Address(mb.display_name or '',
+ mb.local_part or '',
+ mb.domain or '')
+ for mb in addr.all_mailboxes]))
+ defects = list(address_list.all_defects)
+ else:
+ # Assume it is Address/Group stuff
+ if not hasattr(value, '__iter__'):
+ value = [value]
+ groups = [Group(None, [item]) if not hasattr(item, 'addresses')
+ else item
+ for item in value]
+ defects = []
+ kwds['groups'] = groups
+ kwds['defects'] = defects
+ kwds['decoded'] = ', '.join([str(item) for item in groups])
+ if 'parse_tree' not in kwds:
+ kwds['parse_tree'] = cls.value_parser(kwds['decoded'])
+
+ def init(self, *args, **kw):
+ self._groups = tuple(kw.pop('groups'))
+ self._addresses = None
+ super().init(*args, **kw)
+
+ @property
+ def groups(self):
+ return self._groups
+
+ @property
+ def addresses(self):
+ if self._addresses is None:
+ self._addresses = tuple([address for group in self._groups
+ for address in group.addresses])
+ return self._addresses
+
+
+class UniqueAddressHeader(AddressHeader):
+
+ max_count = 1
+
+
+class SingleAddressHeader(AddressHeader):
+
+ @property
+ def address(self):
+ if len(self.addresses)!=1:
+ raise ValueError(("value of single address header {} is not "
+ "a single address").format(self.name))
+ return self.addresses[0]
+
+
+class UniqueSingleAddressHeader(SingleAddressHeader):
+
+ max_count = 1
+
+
+class MIMEVersionHeader(object):
+
+ max_count = 1
+
+ value_parser = staticmethod(parser.parse_mime_version)
+
+ @classmethod
+ def parse(cls, value, kwds):
+ kwds['parse_tree'] = parse_tree = cls.value_parser(value)
+ kwds['decoded'] = str(parse_tree)
+ kwds['defects'].extend(parse_tree.all_defects)
+ kwds['major'] = None if parse_tree.minor is None else parse_tree.major
+ kwds['minor'] = parse_tree.minor
+ if parse_tree.minor is not None:
+ kwds['version'] = '{}.{}'.format(kwds['major'], kwds['minor'])
+ else:
+ kwds['version'] = None
+
+ def init(self, *args, **kw):
+ self._version = kw.pop('version')
+ self._major = kw.pop('major')
+ self._minor = kw.pop('minor')
+ super().init(*args, **kw)
+
+ @property
+ def major(self):
+ return self._major
+
+ @property
+ def minor(self):
+ return self._minor
+
+ @property
+ def version(self):
+ return self._version
+
+
+class ParameterizedMIMEHeader(object):
+
+ # Mixin that handles the params dict. Must be subclassed and
+ # a property value_parser for the specific header provided.
+
+ max_count = 1
+
+ @classmethod
+ def parse(cls, value, kwds):
+ kwds['parse_tree'] = parse_tree = cls.value_parser(value)
+ kwds['decoded'] = str(parse_tree)
+ kwds['defects'].extend(parse_tree.all_defects)
+ if parse_tree.params is None:
+ kwds['params'] = {}
+ else:
+ # The MIME RFCs specify that parameter ordering is arbitrary.
+ kwds['params'] = dict((utils._sanitize(name).lower(),
+ utils._sanitize(value))
+ for name, value in parse_tree.params)
+
+ def init(self, *args, **kw):
+ self._params = kw.pop('params')
+ super().init(*args, **kw)
+
+ @property
+ def params(self):
+ return self._params.copy()
+
+
+class ContentTypeHeader(ParameterizedMIMEHeader):
+
+ value_parser = staticmethod(parser.parse_content_type_header)
+
+ def init(self, *args, **kw):
+ super().init(*args, **kw)
+ self._maintype = utils._sanitize(self._parse_tree.maintype)
+ self._subtype = utils._sanitize(self._parse_tree.subtype)
+
+ @property
+ def maintype(self):
+ return self._maintype
+
+ @property
+ def subtype(self):
+ return self._subtype
+
+ @property
+ def content_type(self):
+ return self.maintype + '/' + self.subtype
+
+
+class ContentDispositionHeader(ParameterizedMIMEHeader):
+
+ value_parser = staticmethod(parser.parse_content_disposition_header)
+
+ def init(self, *args, **kw):
+ super().init(*args, **kw)
+ cd = self._parse_tree.content_disposition
+ self._content_disposition = cd if cd is None else utils._sanitize(cd)
+
+ @property
+ def content_disposition(self):
+ return self._content_disposition
+
+
+class ContentTransferEncodingHeader(object):
+
+ max_count = 1
+
+ value_parser = staticmethod(parser.parse_content_transfer_encoding_header)
+
+ @classmethod
+ def parse(cls, value, kwds):
+ kwds['parse_tree'] = parse_tree = cls.value_parser(value)
+ kwds['decoded'] = str(parse_tree)
+ kwds['defects'].extend(parse_tree.all_defects)
+
+ def init(self, *args, **kw):
+ super().init(*args, **kw)
+ self._cte = utils._sanitize(self._parse_tree.cte)
+
+ @property
+ def cte(self):
+ return self._cte
+
+
+# The header factory #
+
+_default_header_map = {
+ 'subject': UniqueUnstructuredHeader,
+ 'date': UniqueDateHeader,
+ 'resent-date': DateHeader,
+ 'orig-date': UniqueDateHeader,
+ 'sender': UniqueSingleAddressHeader,
+ 'resent-sender': SingleAddressHeader,
+ 'to': UniqueAddressHeader,
+ 'resent-to': AddressHeader,
+ 'cc': UniqueAddressHeader,
+ 'resent-cc': AddressHeader,
+ 'bcc': UniqueAddressHeader,
+ 'resent-bcc': AddressHeader,
+ 'from': UniqueAddressHeader,
+ 'resent-from': AddressHeader,
+ 'reply-to': UniqueAddressHeader,
+ 'mime-version': MIMEVersionHeader,
+ 'content-type': ContentTypeHeader,
+ 'content-disposition': ContentDispositionHeader,
+ 'content-transfer-encoding': ContentTransferEncodingHeader,
+ }
+
+class HeaderRegistry(object):
+
+ """A header_factory and header registry."""
+
+ def __init__(self, base_class=BaseHeader, default_class=UnstructuredHeader,
+ use_default_map=True):
+ """Create a header_factory that works with the Policy API.
+
+ base_class is the class that will be the last class in the created
+ header class's __bases__ list. default_class is the class that will be
+ used if "name" (see __call__) does not appear in the registry.
+ use_default_map controls whether or not the default mapping of names to
+ specialized classes is copied in to the registry when the factory is
+ created. The default is True.
+
+ """
+ self.registry = {}
+ self.base_class = base_class
+ self.default_class = default_class
+ if use_default_map:
+ self.registry.update(_default_header_map)
+
+ def map_to_type(self, name, cls):
+ """Register cls as the specialized class for handling "name" headers.
+
+ """
+ self.registry[name.lower()] = cls
+
+ def __getitem__(self, name):
+ cls = self.registry.get(name.lower(), self.default_class)
+ return type(text_to_native_str('_'+cls.__name__), (cls, self.base_class), {})
+
+ def __call__(self, name, value):
+ """Create a header instance for header 'name' from 'value'.
+
+ Creates a header instance by creating a specialized class for parsing
+ and representing the specified header by combining the factory
+ base_class with a specialized class from the registry or the
+ default_class, and passing the name and value to the constructed
+ class's constructor.
+
+ """
+ return self[name](name, value)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/iterators.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/iterators.py
new file mode 100644
index 0000000..82d320f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/iterators.py
@@ -0,0 +1,74 @@
+# Copyright (C) 2001-2006 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Various types of useful iterators and generators."""
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+__all__ = [
+ 'body_line_iterator',
+ 'typed_subpart_iterator',
+ 'walk',
+ # Do not include _structure() since it's part of the debugging API.
+ ]
+
+import sys
+from io import StringIO
+
+
+# This function will become a method of the Message class
+def walk(self):
+ """Walk over the message tree, yielding each subpart.
+
+ The walk is performed in depth-first order. This method is a
+ generator.
+ """
+ yield self
+ if self.is_multipart():
+ for subpart in self.get_payload():
+ for subsubpart in subpart.walk():
+ yield subsubpart
+
+
+# These two functions are imported into the Iterators.py interface module.
+def body_line_iterator(msg, decode=False):
+ """Iterate over the parts, returning string payloads line-by-line.
+
+ Optional decode (default False) is passed through to .get_payload().
+ """
+ for subpart in msg.walk():
+ payload = subpart.get_payload(decode=decode)
+ if isinstance(payload, str):
+ for line in StringIO(payload):
+ yield line
+
+
+def typed_subpart_iterator(msg, maintype='text', subtype=None):
+ """Iterate over the subparts with a given MIME type.
+
+ Use `maintype' as the main MIME type to match against; this defaults to
+ "text". Optional `subtype' is the MIME subtype to match against; if
+ omitted, only the main type is matched.
+ """
+ for subpart in msg.walk():
+ if subpart.get_content_maintype() == maintype:
+ if subtype is None or subpart.get_content_subtype() == subtype:
+ yield subpart
+
+
+def _structure(msg, fp=None, level=0, include_default=False):
+ """A handy debugging aid"""
+ if fp is None:
+ fp = sys.stdout
+ tab = ' ' * (level * 4)
+ print(tab + msg.get_content_type(), end='', file=fp)
+ if include_default:
+ print(' [%s]' % msg.get_default_type(), file=fp)
+ else:
+ print(file=fp)
+ if msg.is_multipart():
+ for subpart in msg.get_payload():
+ _structure(subpart, fp, level+1, include_default)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/message.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/message.py
new file mode 100644
index 0000000..99715fc
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/message.py
@@ -0,0 +1,882 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2001-2007 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Basic message object for the email package object model."""
+from __future__ import absolute_import, division, unicode_literals
+from future.builtins import list, range, str, zip
+
+__all__ = ['Message']
+
+import re
+import uu
+import base64
+import binascii
+from io import BytesIO, StringIO
+
+# Intrapackage imports
+from future.utils import as_native_str
+from future.backports.email import utils
+from future.backports.email import errors
+from future.backports.email._policybase import compat32
+from future.backports.email import charset as _charset
+from future.backports.email._encoded_words import decode_b
+Charset = _charset.Charset
+
+SEMISPACE = '; '
+
+# Regular expression that matches `special' characters in parameters, the
+# existence of which force quoting of the parameter value.
+tspecials = re.compile(r'[ \(\)<>@,;:\\"/\[\]\?=]')
+
+
+def _splitparam(param):
+ # Split header parameters. BAW: this may be too simple. It isn't
+ # strictly RFC 2045 (section 5.1) compliant, but it catches most headers
+ # found in the wild. We may eventually need a full fledged parser.
+ # RDM: we might have a Header here; for now just stringify it.
+ a, sep, b = str(param).partition(';')
+ if not sep:
+ return a.strip(), None
+ return a.strip(), b.strip()
+
+def _formatparam(param, value=None, quote=True):
+ """Convenience function to format and return a key=value pair.
+
+ This will quote the value if needed or if quote is true. If value is a
+ three tuple (charset, language, value), it will be encoded according
+ to RFC2231 rules. If it contains non-ascii characters it will likewise
+ be encoded according to RFC2231 rules, using the utf-8 charset and
+ a null language.
+ """
+ if value is not None and len(value) > 0:
+ # A tuple is used for RFC 2231 encoded parameter values where items
+ # are (charset, language, value). charset is a string, not a Charset
+ # instance. RFC 2231 encoded values are never quoted, per RFC.
+ if isinstance(value, tuple):
+ # Encode as per RFC 2231
+ param += '*'
+ value = utils.encode_rfc2231(value[2], value[0], value[1])
+ return '%s=%s' % (param, value)
+ else:
+ try:
+ value.encode('ascii')
+ except UnicodeEncodeError:
+ param += '*'
+ value = utils.encode_rfc2231(value, 'utf-8', '')
+ return '%s=%s' % (param, value)
+ # BAW: Please check this. I think that if quote is set it should
+ # force quoting even if not necessary.
+ if quote or tspecials.search(value):
+ return '%s="%s"' % (param, utils.quote(value))
+ else:
+ return '%s=%s' % (param, value)
+ else:
+ return param
+
+def _parseparam(s):
+ # RDM This might be a Header, so for now stringify it.
+ s = ';' + str(s)
+ plist = []
+ while s[:1] == ';':
+ s = s[1:]
+ end = s.find(';')
+ while end > 0 and (s.count('"', 0, end) - s.count('\\"', 0, end)) % 2:
+ end = s.find(';', end + 1)
+ if end < 0:
+ end = len(s)
+ f = s[:end]
+ if '=' in f:
+ i = f.index('=')
+ f = f[:i].strip().lower() + '=' + f[i+1:].strip()
+ plist.append(f.strip())
+ s = s[end:]
+ return plist
+
+
+def _unquotevalue(value):
+ # This is different than utils.collapse_rfc2231_value() because it doesn't
+ # try to convert the value to a unicode. Message.get_param() and
+ # Message.get_params() are both currently defined to return the tuple in
+ # the face of RFC 2231 parameters.
+ if isinstance(value, tuple):
+ return value[0], value[1], utils.unquote(value[2])
+ else:
+ return utils.unquote(value)
+
+
+class Message(object):
+ """Basic message object.
+
+ A message object is defined as something that has a bunch of RFC 2822
+ headers and a payload. It may optionally have an envelope header
+ (a.k.a. Unix-From or From_ header). If the message is a container (i.e. a
+ multipart or a message/rfc822), then the payload is a list of Message
+ objects, otherwise it is a string.
+
+ Message objects implement part of the `mapping' interface, which assumes
+ there is exactly one occurrence of the header per message. Some headers
+ do in fact appear multiple times (e.g. Received) and for those headers,
+ you must use the explicit API to set or get all the headers. Not all of
+ the mapping methods are implemented.
+ """
+ def __init__(self, policy=compat32):
+ self.policy = policy
+ self._headers = list()
+ self._unixfrom = None
+ self._payload = None
+ self._charset = None
+ # Defaults for multipart messages
+ self.preamble = self.epilogue = None
+ self.defects = []
+ # Default content type
+ self._default_type = 'text/plain'
+
+ @as_native_str(encoding='utf-8')
+ def __str__(self):
+ """Return the entire formatted message as a string.
+ This includes the headers, body, and envelope header.
+ """
+ return self.as_string()
+
+ def as_string(self, unixfrom=False, maxheaderlen=0):
+ """Return the entire formatted message as a (unicode) string.
+ Optional `unixfrom' when True, means include the Unix From_ envelope
+ header.
+
+ This is a convenience method and may not generate the message exactly
+ as you intend. For more flexibility, use the flatten() method of a
+ Generator instance.
+ """
+ from future.backports.email.generator import Generator
+ fp = StringIO()
+ g = Generator(fp, mangle_from_=False, maxheaderlen=maxheaderlen)
+ g.flatten(self, unixfrom=unixfrom)
+ return fp.getvalue()
+
+ def is_multipart(self):
+ """Return True if the message consists of multiple parts."""
+ return isinstance(self._payload, list)
+
+ #
+ # Unix From_ line
+ #
+ def set_unixfrom(self, unixfrom):
+ self._unixfrom = unixfrom
+
+ def get_unixfrom(self):
+ return self._unixfrom
+
+ #
+ # Payload manipulation.
+ #
+ def attach(self, payload):
+ """Add the given payload to the current payload.
+
+ The current payload will always be a list of objects after this method
+ is called. If you want to set the payload to a scalar object, use
+ set_payload() instead.
+ """
+ if self._payload is None:
+ self._payload = [payload]
+ else:
+ self._payload.append(payload)
+
+ def get_payload(self, i=None, decode=False):
+ """Return a reference to the payload.
+
+ The payload will either be a list object or a string. If you mutate
+ the list object, you modify the message's payload in place. Optional
+ i returns that index into the payload.
+
+ Optional decode is a flag indicating whether the payload should be
+ decoded or not, according to the Content-Transfer-Encoding header
+ (default is False).
+
+ When True and the message is not a multipart, the payload will be
+ decoded if this header's value is `quoted-printable' or `base64'. If
+ some other encoding is used, or the header is missing, or if the
+ payload has bogus data (i.e. bogus base64 or uuencoded data), the
+ payload is returned as-is.
+
+ If the message is a multipart and the decode flag is True, then None
+ is returned.
+ """
+ # Here is the logic table for this code, based on the email5.0.0 code:
+ # i decode is_multipart result
+ # ------ ------ ------------ ------------------------------
+ # None True True None
+ # i True True None
+ # None False True _payload (a list)
+ # i False True _payload element i (a Message)
+ # i False False error (not a list)
+ # i True False error (not a list)
+ # None False False _payload
+ # None True False _payload decoded (bytes)
+ # Note that Barry planned to factor out the 'decode' case, but that
+ # isn't so easy now that we handle the 8 bit data, which needs to be
+ # converted in both the decode and non-decode path.
+ if self.is_multipart():
+ if decode:
+ return None
+ if i is None:
+ return self._payload
+ else:
+ return self._payload[i]
+ # For backward compatibility, Use isinstance and this error message
+ # instead of the more logical is_multipart test.
+ if i is not None and not isinstance(self._payload, list):
+ raise TypeError('Expected list, got %s' % type(self._payload))
+ payload = self._payload
+ # cte might be a Header, so for now stringify it.
+ cte = str(self.get('content-transfer-encoding', '')).lower()
+ # payload may be bytes here.
+ if isinstance(payload, str):
+ payload = str(payload) # for Python-Future, so surrogateescape works
+ if utils._has_surrogates(payload):
+ bpayload = payload.encode('ascii', 'surrogateescape')
+ if not decode:
+ try:
+ payload = bpayload.decode(self.get_param('charset', 'ascii'), 'replace')
+ except LookupError:
+ payload = bpayload.decode('ascii', 'replace')
+ elif decode:
+ try:
+ bpayload = payload.encode('ascii')
+ except UnicodeError:
+ # This won't happen for RFC compliant messages (messages
+ # containing only ASCII codepoints in the unicode input).
+ # If it does happen, turn the string into bytes in a way
+ # guaranteed not to fail.
+ bpayload = payload.encode('raw-unicode-escape')
+ if not decode:
+ return payload
+ if cte == 'quoted-printable':
+ return utils._qdecode(bpayload)
+ elif cte == 'base64':
+ # XXX: this is a bit of a hack; decode_b should probably be factored
+ # out somewhere, but I haven't figured out where yet.
+ value, defects = decode_b(b''.join(bpayload.splitlines()))
+ for defect in defects:
+ self.policy.handle_defect(self, defect)
+ return value
+ elif cte in ('x-uuencode', 'uuencode', 'uue', 'x-uue'):
+ in_file = BytesIO(bpayload)
+ out_file = BytesIO()
+ try:
+ uu.decode(in_file, out_file, quiet=True)
+ return out_file.getvalue()
+ except uu.Error:
+ # Some decoding problem
+ return bpayload
+ if isinstance(payload, str):
+ return bpayload
+ return payload
+
+ def set_payload(self, payload, charset=None):
+ """Set the payload to the given value.
+
+ Optional charset sets the message's default character set. See
+ set_charset() for details.
+ """
+ self._payload = payload
+ if charset is not None:
+ self.set_charset(charset)
+
+ def set_charset(self, charset):
+ """Set the charset of the payload to a given character set.
+
+ charset can be a Charset instance, a string naming a character set, or
+ None. If it is a string it will be converted to a Charset instance.
+ If charset is None, the charset parameter will be removed from the
+ Content-Type field. Anything else will generate a TypeError.
+
+ The message will be assumed to be of type text/* encoded with
+ charset.input_charset. It will be converted to charset.output_charset
+ and encoded properly, if needed, when generating the plain text
+ representation of the message. MIME headers (MIME-Version,
+ Content-Type, Content-Transfer-Encoding) will be added as needed.
+ """
+ if charset is None:
+ self.del_param('charset')
+ self._charset = None
+ return
+ if not isinstance(charset, Charset):
+ charset = Charset(charset)
+ self._charset = charset
+ if 'MIME-Version' not in self:
+ self.add_header('MIME-Version', '1.0')
+ if 'Content-Type' not in self:
+ self.add_header('Content-Type', 'text/plain',
+ charset=charset.get_output_charset())
+ else:
+ self.set_param('charset', charset.get_output_charset())
+ if charset != charset.get_output_charset():
+ self._payload = charset.body_encode(self._payload)
+ if 'Content-Transfer-Encoding' not in self:
+ cte = charset.get_body_encoding()
+ try:
+ cte(self)
+ except TypeError:
+ self._payload = charset.body_encode(self._payload)
+ self.add_header('Content-Transfer-Encoding', cte)
+
+ def get_charset(self):
+ """Return the Charset instance associated with the message's payload.
+ """
+ return self._charset
+
+ #
+ # MAPPING INTERFACE (partial)
+ #
+ def __len__(self):
+ """Return the total number of headers, including duplicates."""
+ return len(self._headers)
+
+ def __getitem__(self, name):
+ """Get a header value.
+
+ Return None if the header is missing instead of raising an exception.
+
+ Note that if the header appeared multiple times, exactly which
+ occurrence gets returned is undefined. Use get_all() to get all
+ the values matching a header field name.
+ """
+ return self.get(name)
+
+ def __setitem__(self, name, val):
+ """Set the value of a header.
+
+ Note: this does not overwrite an existing header with the same field
+ name. Use __delitem__() first to delete any existing headers.
+ """
+ max_count = self.policy.header_max_count(name)
+ if max_count:
+ lname = name.lower()
+ found = 0
+ for k, v in self._headers:
+ if k.lower() == lname:
+ found += 1
+ if found >= max_count:
+ raise ValueError("There may be at most {} {} headers "
+ "in a message".format(max_count, name))
+ self._headers.append(self.policy.header_store_parse(name, val))
+
+ def __delitem__(self, name):
+ """Delete all occurrences of a header, if present.
+
+ Does not raise an exception if the header is missing.
+ """
+ name = name.lower()
+ newheaders = list()
+ for k, v in self._headers:
+ if k.lower() != name:
+ newheaders.append((k, v))
+ self._headers = newheaders
+
+ def __contains__(self, name):
+ return name.lower() in [k.lower() for k, v in self._headers]
+
+ def __iter__(self):
+ for field, value in self._headers:
+ yield field
+
+ def keys(self):
+ """Return a list of all the message's header field names.
+
+ These will be sorted in the order they appeared in the original
+ message, or were added to the message, and may contain duplicates.
+ Any fields deleted and re-inserted are always appended to the header
+ list.
+ """
+ return [k for k, v in self._headers]
+
+ def values(self):
+ """Return a list of all the message's header values.
+
+ These will be sorted in the order they appeared in the original
+ message, or were added to the message, and may contain duplicates.
+ Any fields deleted and re-inserted are always appended to the header
+ list.
+ """
+ return [self.policy.header_fetch_parse(k, v)
+ for k, v in self._headers]
+
+ def items(self):
+ """Get all the message's header fields and values.
+
+ These will be sorted in the order they appeared in the original
+ message, or were added to the message, and may contain duplicates.
+ Any fields deleted and re-inserted are always appended to the header
+ list.
+ """
+ return [(k, self.policy.header_fetch_parse(k, v))
+ for k, v in self._headers]
+
+ def get(self, name, failobj=None):
+ """Get a header value.
+
+ Like __getitem__() but return failobj instead of None when the field
+ is missing.
+ """
+ name = name.lower()
+ for k, v in self._headers:
+ if k.lower() == name:
+ return self.policy.header_fetch_parse(k, v)
+ return failobj
+
+ #
+ # "Internal" methods (public API, but only intended for use by a parser
+ # or generator, not normal application code.
+ #
+
+ def set_raw(self, name, value):
+ """Store name and value in the model without modification.
+
+ This is an "internal" API, intended only for use by a parser.
+ """
+ self._headers.append((name, value))
+
+ def raw_items(self):
+ """Return the (name, value) header pairs without modification.
+
+ This is an "internal" API, intended only for use by a generator.
+ """
+ return iter(self._headers.copy())
+
+ #
+ # Additional useful stuff
+ #
+
+ def get_all(self, name, failobj=None):
+ """Return a list of all the values for the named field.
+
+ These will be sorted in the order they appeared in the original
+ message, and may contain duplicates. Any fields deleted and
+ re-inserted are always appended to the header list.
+
+ If no such fields exist, failobj is returned (defaults to None).
+ """
+ values = []
+ name = name.lower()
+ for k, v in self._headers:
+ if k.lower() == name:
+ values.append(self.policy.header_fetch_parse(k, v))
+ if not values:
+ return failobj
+ return values
+
+ def add_header(self, _name, _value, **_params):
+ """Extended header setting.
+
+ name is the header field to add. keyword arguments can be used to set
+ additional parameters for the header field, with underscores converted
+ to dashes. Normally the parameter will be added as key="value" unless
+ value is None, in which case only the key will be added. If a
+ parameter value contains non-ASCII characters it can be specified as a
+ three-tuple of (charset, language, value), in which case it will be
+ encoded according to RFC2231 rules. Otherwise it will be encoded using
+ the utf-8 charset and a language of ''.
+
+ Examples:
+
+ msg.add_header('content-disposition', 'attachment', filename='bud.gif')
+ msg.add_header('content-disposition', 'attachment',
+ filename=('utf-8', '', 'Fußballer.ppt'))
+ msg.add_header('content-disposition', 'attachment',
+ filename='Fußballer.ppt'))
+ """
+ parts = []
+ for k, v in _params.items():
+ if v is None:
+ parts.append(k.replace('_', '-'))
+ else:
+ parts.append(_formatparam(k.replace('_', '-'), v))
+ if _value is not None:
+ parts.insert(0, _value)
+ self[_name] = SEMISPACE.join(parts)
+
+ def replace_header(self, _name, _value):
+ """Replace a header.
+
+ Replace the first matching header found in the message, retaining
+ header order and case. If no matching header was found, a KeyError is
+ raised.
+ """
+ _name = _name.lower()
+ for i, (k, v) in zip(range(len(self._headers)), self._headers):
+ if k.lower() == _name:
+ self._headers[i] = self.policy.header_store_parse(k, _value)
+ break
+ else:
+ raise KeyError(_name)
+
+ #
+ # Use these three methods instead of the three above.
+ #
+
+ def get_content_type(self):
+ """Return the message's content type.
+
+ The returned string is coerced to lower case of the form
+ `maintype/subtype'. If there was no Content-Type header in the
+ message, the default type as given by get_default_type() will be
+ returned. Since according to RFC 2045, messages always have a default
+ type this will always return a value.
+
+ RFC 2045 defines a message's default type to be text/plain unless it
+ appears inside a multipart/digest container, in which case it would be
+ message/rfc822.
+ """
+ missing = object()
+ value = self.get('content-type', missing)
+ if value is missing:
+ # This should have no parameters
+ return self.get_default_type()
+ ctype = _splitparam(value)[0].lower()
+ # RFC 2045, section 5.2 says if its invalid, use text/plain
+ if ctype.count('/') != 1:
+ return 'text/plain'
+ return ctype
+
+ def get_content_maintype(self):
+ """Return the message's main content type.
+
+ This is the `maintype' part of the string returned by
+ get_content_type().
+ """
+ ctype = self.get_content_type()
+ return ctype.split('/')[0]
+
+ def get_content_subtype(self):
+ """Returns the message's sub-content type.
+
+ This is the `subtype' part of the string returned by
+ get_content_type().
+ """
+ ctype = self.get_content_type()
+ return ctype.split('/')[1]
+
+ def get_default_type(self):
+ """Return the `default' content type.
+
+ Most messages have a default content type of text/plain, except for
+ messages that are subparts of multipart/digest containers. Such
+ subparts have a default content type of message/rfc822.
+ """
+ return self._default_type
+
+ def set_default_type(self, ctype):
+ """Set the `default' content type.
+
+ ctype should be either "text/plain" or "message/rfc822", although this
+ is not enforced. The default content type is not stored in the
+ Content-Type header.
+ """
+ self._default_type = ctype
+
+ def _get_params_preserve(self, failobj, header):
+ # Like get_params() but preserves the quoting of values. BAW:
+ # should this be part of the public interface?
+ missing = object()
+ value = self.get(header, missing)
+ if value is missing:
+ return failobj
+ params = []
+ for p in _parseparam(value):
+ try:
+ name, val = p.split('=', 1)
+ name = name.strip()
+ val = val.strip()
+ except ValueError:
+ # Must have been a bare attribute
+ name = p.strip()
+ val = ''
+ params.append((name, val))
+ params = utils.decode_params(params)
+ return params
+
+ def get_params(self, failobj=None, header='content-type', unquote=True):
+ """Return the message's Content-Type parameters, as a list.
+
+ The elements of the returned list are 2-tuples of key/value pairs, as
+ split on the `=' sign. The left hand side of the `=' is the key,
+ while the right hand side is the value. If there is no `=' sign in
+ the parameter the value is the empty string. The value is as
+ described in the get_param() method.
+
+ Optional failobj is the object to return if there is no Content-Type
+ header. Optional header is the header to search instead of
+ Content-Type. If unquote is True, the value is unquoted.
+ """
+ missing = object()
+ params = self._get_params_preserve(missing, header)
+ if params is missing:
+ return failobj
+ if unquote:
+ return [(k, _unquotevalue(v)) for k, v in params]
+ else:
+ return params
+
+ def get_param(self, param, failobj=None, header='content-type',
+ unquote=True):
+ """Return the parameter value if found in the Content-Type header.
+
+ Optional failobj is the object to return if there is no Content-Type
+ header, or the Content-Type header has no such parameter. Optional
+ header is the header to search instead of Content-Type.
+
+ Parameter keys are always compared case insensitively. The return
+ value can either be a string, or a 3-tuple if the parameter was RFC
+ 2231 encoded. When it's a 3-tuple, the elements of the value are of
+ the form (CHARSET, LANGUAGE, VALUE). Note that both CHARSET and
+ LANGUAGE can be None, in which case you should consider VALUE to be
+ encoded in the us-ascii charset. You can usually ignore LANGUAGE.
+ The parameter value (either the returned string, or the VALUE item in
+ the 3-tuple) is always unquoted, unless unquote is set to False.
+
+ If your application doesn't care whether the parameter was RFC 2231
+ encoded, it can turn the return value into a string as follows:
+
+ param = msg.get_param('foo')
+ param = email.utils.collapse_rfc2231_value(rawparam)
+
+ """
+ if header not in self:
+ return failobj
+ for k, v in self._get_params_preserve(failobj, header):
+ if k.lower() == param.lower():
+ if unquote:
+ return _unquotevalue(v)
+ else:
+ return v
+ return failobj
+
+ def set_param(self, param, value, header='Content-Type', requote=True,
+ charset=None, language=''):
+ """Set a parameter in the Content-Type header.
+
+ If the parameter already exists in the header, its value will be
+ replaced with the new value.
+
+ If header is Content-Type and has not yet been defined for this
+ message, it will be set to "text/plain" and the new parameter and
+ value will be appended as per RFC 2045.
+
+ An alternate header can specified in the header argument, and all
+ parameters will be quoted as necessary unless requote is False.
+
+ If charset is specified, the parameter will be encoded according to RFC
+ 2231. Optional language specifies the RFC 2231 language, defaulting
+ to the empty string. Both charset and language should be strings.
+ """
+ if not isinstance(value, tuple) and charset:
+ value = (charset, language, value)
+
+ if header not in self and header.lower() == 'content-type':
+ ctype = 'text/plain'
+ else:
+ ctype = self.get(header)
+ if not self.get_param(param, header=header):
+ if not ctype:
+ ctype = _formatparam(param, value, requote)
+ else:
+ ctype = SEMISPACE.join(
+ [ctype, _formatparam(param, value, requote)])
+ else:
+ ctype = ''
+ for old_param, old_value in self.get_params(header=header,
+ unquote=requote):
+ append_param = ''
+ if old_param.lower() == param.lower():
+ append_param = _formatparam(param, value, requote)
+ else:
+ append_param = _formatparam(old_param, old_value, requote)
+ if not ctype:
+ ctype = append_param
+ else:
+ ctype = SEMISPACE.join([ctype, append_param])
+ if ctype != self.get(header):
+ del self[header]
+ self[header] = ctype
+
+ def del_param(self, param, header='content-type', requote=True):
+ """Remove the given parameter completely from the Content-Type header.
+
+ The header will be re-written in place without the parameter or its
+ value. All values will be quoted as necessary unless requote is
+ False. Optional header specifies an alternative to the Content-Type
+ header.
+ """
+ if header not in self:
+ return
+ new_ctype = ''
+ for p, v in self.get_params(header=header, unquote=requote):
+ if p.lower() != param.lower():
+ if not new_ctype:
+ new_ctype = _formatparam(p, v, requote)
+ else:
+ new_ctype = SEMISPACE.join([new_ctype,
+ _formatparam(p, v, requote)])
+ if new_ctype != self.get(header):
+ del self[header]
+ self[header] = new_ctype
+
+ def set_type(self, type, header='Content-Type', requote=True):
+ """Set the main type and subtype for the Content-Type header.
+
+ type must be a string in the form "maintype/subtype", otherwise a
+ ValueError is raised.
+
+ This method replaces the Content-Type header, keeping all the
+ parameters in place. If requote is False, this leaves the existing
+ header's quoting as is. Otherwise, the parameters will be quoted (the
+ default).
+
+ An alternative header can be specified in the header argument. When
+ the Content-Type header is set, we'll always also add a MIME-Version
+ header.
+ """
+ # BAW: should we be strict?
+ if not type.count('/') == 1:
+ raise ValueError
+ # Set the Content-Type, you get a MIME-Version
+ if header.lower() == 'content-type':
+ del self['mime-version']
+ self['MIME-Version'] = '1.0'
+ if header not in self:
+ self[header] = type
+ return
+ params = self.get_params(header=header, unquote=requote)
+ del self[header]
+ self[header] = type
+ # Skip the first param; it's the old type.
+ for p, v in params[1:]:
+ self.set_param(p, v, header, requote)
+
+ def get_filename(self, failobj=None):
+ """Return the filename associated with the payload if present.
+
+ The filename is extracted from the Content-Disposition header's
+ `filename' parameter, and it is unquoted. If that header is missing
+ the `filename' parameter, this method falls back to looking for the
+ `name' parameter.
+ """
+ missing = object()
+ filename = self.get_param('filename', missing, 'content-disposition')
+ if filename is missing:
+ filename = self.get_param('name', missing, 'content-type')
+ if filename is missing:
+ return failobj
+ return utils.collapse_rfc2231_value(filename).strip()
+
+ def get_boundary(self, failobj=None):
+ """Return the boundary associated with the payload if present.
+
+ The boundary is extracted from the Content-Type header's `boundary'
+ parameter, and it is unquoted.
+ """
+ missing = object()
+ boundary = self.get_param('boundary', missing)
+ if boundary is missing:
+ return failobj
+ # RFC 2046 says that boundaries may begin but not end in w/s
+ return utils.collapse_rfc2231_value(boundary).rstrip()
+
+ def set_boundary(self, boundary):
+ """Set the boundary parameter in Content-Type to 'boundary'.
+
+ This is subtly different than deleting the Content-Type header and
+ adding a new one with a new boundary parameter via add_header(). The
+ main difference is that using the set_boundary() method preserves the
+ order of the Content-Type header in the original message.
+
+ HeaderParseError is raised if the message has no Content-Type header.
+ """
+ missing = object()
+ params = self._get_params_preserve(missing, 'content-type')
+ if params is missing:
+ # There was no Content-Type header, and we don't know what type
+ # to set it to, so raise an exception.
+ raise errors.HeaderParseError('No Content-Type header found')
+ newparams = []
+ foundp = False
+ for pk, pv in params:
+ if pk.lower() == 'boundary':
+ newparams.append(('boundary', '"%s"' % boundary))
+ foundp = True
+ else:
+ newparams.append((pk, pv))
+ if not foundp:
+ # The original Content-Type header had no boundary attribute.
+ # Tack one on the end. BAW: should we raise an exception
+ # instead???
+ newparams.append(('boundary', '"%s"' % boundary))
+ # Replace the existing Content-Type header with the new value
+ newheaders = []
+ for h, v in self._headers:
+ if h.lower() == 'content-type':
+ parts = []
+ for k, v in newparams:
+ if v == '':
+ parts.append(k)
+ else:
+ parts.append('%s=%s' % (k, v))
+ val = SEMISPACE.join(parts)
+ newheaders.append(self.policy.header_store_parse(h, val))
+
+ else:
+ newheaders.append((h, v))
+ self._headers = newheaders
+
+ def get_content_charset(self, failobj=None):
+ """Return the charset parameter of the Content-Type header.
+
+ The returned string is always coerced to lower case. If there is no
+ Content-Type header, or if that header has no charset parameter,
+ failobj is returned.
+ """
+ missing = object()
+ charset = self.get_param('charset', missing)
+ if charset is missing:
+ return failobj
+ if isinstance(charset, tuple):
+ # RFC 2231 encoded, so decode it, and it better end up as ascii.
+ pcharset = charset[0] or 'us-ascii'
+ try:
+ # LookupError will be raised if the charset isn't known to
+ # Python. UnicodeError will be raised if the encoded text
+ # contains a character not in the charset.
+ as_bytes = charset[2].encode('raw-unicode-escape')
+ charset = str(as_bytes, pcharset)
+ except (LookupError, UnicodeError):
+ charset = charset[2]
+ # charset characters must be in us-ascii range
+ try:
+ charset.encode('us-ascii')
+ except UnicodeError:
+ return failobj
+ # RFC 2046, $4.1.2 says charsets are not case sensitive
+ return charset.lower()
+
+ def get_charsets(self, failobj=None):
+ """Return a list containing the charset(s) used in this message.
+
+ The returned list of items describes the Content-Type headers'
+ charset parameter for this message and all the subparts in its
+ payload.
+
+ Each item will either be a string (the value of the charset parameter
+ in the Content-Type header of that part) or the value of the
+ 'failobj' parameter (defaults to None), if the part does not have a
+ main MIME type of "text", or the charset is not defined.
+
+ The list will contain one string for each part of the message, plus
+ one for the container message (i.e. self), so that a non-multipart
+ message will still return a list of length 1.
+ """
+ return [part.get_content_charset(failobj) for part in self.walk()]
+
+ # I.e. def walk(self): ...
+ from future.backports.email.iterators import walk
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/application.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/application.py
new file mode 100644
index 0000000..5cbfb17
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/application.py
@@ -0,0 +1,39 @@
+# Copyright (C) 2001-2006 Python Software Foundation
+# Author: Keith Dart
+# Contact: email-sig@python.org
+
+"""Class representing application/* type MIME documents."""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+from future.backports.email import encoders
+from future.backports.email.mime.nonmultipart import MIMENonMultipart
+
+__all__ = ["MIMEApplication"]
+
+
+class MIMEApplication(MIMENonMultipart):
+ """Class for generating application/* MIME documents."""
+
+ def __init__(self, _data, _subtype='octet-stream',
+ _encoder=encoders.encode_base64, **_params):
+ """Create an application/* type MIME document.
+
+ _data is a string containing the raw application data.
+
+ _subtype is the MIME content type subtype, defaulting to
+ 'octet-stream'.
+
+ _encoder is a function which will perform the actual encoding for
+ transport of the application data, defaulting to base64 encoding.
+
+ Any additional keyword arguments are passed to the base class
+ constructor, which turns them into parameters on the Content-Type
+ header.
+ """
+ if _subtype is None:
+ raise TypeError('Invalid application MIME subtype')
+ MIMENonMultipart.__init__(self, 'application', _subtype, **_params)
+ self.set_payload(_data)
+ _encoder(self)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/audio.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/audio.py
new file mode 100644
index 0000000..4989c11
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/audio.py
@@ -0,0 +1,74 @@
+# Copyright (C) 2001-2007 Python Software Foundation
+# Author: Anthony Baxter
+# Contact: email-sig@python.org
+
+"""Class representing audio/* type MIME documents."""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+__all__ = ['MIMEAudio']
+
+import sndhdr
+
+from io import BytesIO
+from future.backports.email import encoders
+from future.backports.email.mime.nonmultipart import MIMENonMultipart
+
+
+_sndhdr_MIMEmap = {'au' : 'basic',
+ 'wav' :'x-wav',
+ 'aiff':'x-aiff',
+ 'aifc':'x-aiff',
+ }
+
+# There are others in sndhdr that don't have MIME types. :(
+# Additional ones to be added to sndhdr? midi, mp3, realaudio, wma??
+def _whatsnd(data):
+ """Try to identify a sound file type.
+
+ sndhdr.what() has a pretty cruddy interface, unfortunately. This is why
+ we re-do it here. It would be easier to reverse engineer the Unix 'file'
+ command and use the standard 'magic' file, as shipped with a modern Unix.
+ """
+ hdr = data[:512]
+ fakefile = BytesIO(hdr)
+ for testfn in sndhdr.tests:
+ res = testfn(hdr, fakefile)
+ if res is not None:
+ return _sndhdr_MIMEmap.get(res[0])
+ return None
+
+
+class MIMEAudio(MIMENonMultipart):
+ """Class for generating audio/* MIME documents."""
+
+ def __init__(self, _audiodata, _subtype=None,
+ _encoder=encoders.encode_base64, **_params):
+ """Create an audio/* type MIME document.
+
+ _audiodata is a string containing the raw audio data. If this data
+ can be decoded by the standard Python `sndhdr' module, then the
+ subtype will be automatically included in the Content-Type header.
+ Otherwise, you can specify the specific audio subtype via the
+ _subtype parameter. If _subtype is not given, and no subtype can be
+ guessed, a TypeError is raised.
+
+ _encoder is a function which will perform the actual encoding for
+ transport of the image data. It takes one argument, which is this
+ Image instance. It should use get_payload() and set_payload() to
+ change the payload to the encoded form. It should also add any
+ Content-Transfer-Encoding or other headers to the message as
+ necessary. The default encoding is Base64.
+
+ Any additional keyword arguments are passed to the base class
+ constructor, which turns them into parameters on the Content-Type
+ header.
+ """
+ if _subtype is None:
+ _subtype = _whatsnd(_audiodata)
+ if _subtype is None:
+ raise TypeError('Could not find audio MIME subtype')
+ MIMENonMultipart.__init__(self, 'audio', _subtype, **_params)
+ self.set_payload(_audiodata)
+ _encoder(self)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/base.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/base.py
new file mode 100644
index 0000000..e77f3ca
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/base.py
@@ -0,0 +1,25 @@
+# Copyright (C) 2001-2006 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Base class for MIME specializations."""
+from __future__ import absolute_import, division, unicode_literals
+from future.backports.email import message
+
+__all__ = ['MIMEBase']
+
+
+class MIMEBase(message.Message):
+ """Base class for MIME specializations."""
+
+ def __init__(self, _maintype, _subtype, **_params):
+ """This constructor adds a Content-Type: and a MIME-Version: header.
+
+ The Content-Type: header is taken from the _maintype and _subtype
+ arguments. Additional parameters for this header are taken from the
+ keyword arguments.
+ """
+ message.Message.__init__(self)
+ ctype = '%s/%s' % (_maintype, _subtype)
+ self.add_header('Content-Type', ctype, **_params)
+ self['MIME-Version'] = '1.0'
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/image.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/image.py
new file mode 100644
index 0000000..a036024
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/image.py
@@ -0,0 +1,48 @@
+# Copyright (C) 2001-2006 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Class representing image/* type MIME documents."""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+__all__ = ['MIMEImage']
+
+import imghdr
+
+from future.backports.email import encoders
+from future.backports.email.mime.nonmultipart import MIMENonMultipart
+
+
+class MIMEImage(MIMENonMultipart):
+ """Class for generating image/* type MIME documents."""
+
+ def __init__(self, _imagedata, _subtype=None,
+ _encoder=encoders.encode_base64, **_params):
+ """Create an image/* type MIME document.
+
+ _imagedata is a string containing the raw image data. If this data
+ can be decoded by the standard Python `imghdr' module, then the
+ subtype will be automatically included in the Content-Type header.
+ Otherwise, you can specify the specific image subtype via the _subtype
+ parameter.
+
+ _encoder is a function which will perform the actual encoding for
+ transport of the image data. It takes one argument, which is this
+ Image instance. It should use get_payload() and set_payload() to
+ change the payload to the encoded form. It should also add any
+ Content-Transfer-Encoding or other headers to the message as
+ necessary. The default encoding is Base64.
+
+ Any additional keyword arguments are passed to the base class
+ constructor, which turns them into parameters on the Content-Type
+ header.
+ """
+ if _subtype is None:
+ _subtype = imghdr.what(None, _imagedata)
+ if _subtype is None:
+ raise TypeError('Could not guess image MIME subtype')
+ MIMENonMultipart.__init__(self, 'image', _subtype, **_params)
+ self.set_payload(_imagedata)
+ _encoder(self)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/message.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/message.py
new file mode 100644
index 0000000..7f92075
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/message.py
@@ -0,0 +1,36 @@
+# Copyright (C) 2001-2006 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Class representing message/* MIME documents."""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+__all__ = ['MIMEMessage']
+
+from future.backports.email import message
+from future.backports.email.mime.nonmultipart import MIMENonMultipart
+
+
+class MIMEMessage(MIMENonMultipart):
+ """Class representing message/* MIME documents."""
+
+ def __init__(self, _msg, _subtype='rfc822'):
+ """Create a message/* type MIME document.
+
+ _msg is a message object and must be an instance of Message, or a
+ derived class of Message, otherwise a TypeError is raised.
+
+ Optional _subtype defines the subtype of the contained message. The
+ default is "rfc822" (this is defined by the MIME standard, even though
+ the term "rfc822" is technically outdated by RFC 2822).
+ """
+ MIMENonMultipart.__init__(self, 'message', _subtype)
+ if not isinstance(_msg, message.Message):
+ raise TypeError('Argument is not an instance of Message')
+ # It's convenient to use this base class method. We need to do it
+ # this way or we'll get an exception
+ message.Message.attach(self, _msg)
+ # And be sure our default type is set correctly
+ self.set_default_type('message/rfc822')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/multipart.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/multipart.py
new file mode 100644
index 0000000..6d7ed3d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/multipart.py
@@ -0,0 +1,49 @@
+# Copyright (C) 2002-2006 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Base class for MIME multipart/* type messages."""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+__all__ = ['MIMEMultipart']
+
+from future.backports.email.mime.base import MIMEBase
+
+
+class MIMEMultipart(MIMEBase):
+ """Base class for MIME multipart/* type messages."""
+
+ def __init__(self, _subtype='mixed', boundary=None, _subparts=None,
+ **_params):
+ """Creates a multipart/* type message.
+
+ By default, creates a multipart/mixed message, with proper
+ Content-Type and MIME-Version headers.
+
+ _subtype is the subtype of the multipart content type, defaulting to
+ `mixed'.
+
+ boundary is the multipart boundary string. By default it is
+ calculated as needed.
+
+ _subparts is a sequence of initial subparts for the payload. It
+ must be an iterable object, such as a list. You can always
+ attach new subparts to the message by using the attach() method.
+
+ Additional parameters for the Content-Type header are taken from the
+ keyword arguments (or passed into the _params argument).
+ """
+ MIMEBase.__init__(self, 'multipart', _subtype, **_params)
+
+ # Initialise _payload to an empty list as the Message superclass's
+ # implementation of is_multipart assumes that _payload is a list for
+ # multipart messages.
+ self._payload = []
+
+ if _subparts:
+ for p in _subparts:
+ self.attach(p)
+ if boundary:
+ self.set_boundary(boundary)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/nonmultipart.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/nonmultipart.py
new file mode 100644
index 0000000..08c37c3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/nonmultipart.py
@@ -0,0 +1,24 @@
+# Copyright (C) 2002-2006 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Base class for MIME type messages that are not multipart."""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+__all__ = ['MIMENonMultipart']
+
+from future.backports.email import errors
+from future.backports.email.mime.base import MIMEBase
+
+
+class MIMENonMultipart(MIMEBase):
+ """Base class for MIME multipart/* type messages."""
+
+ def attach(self, payload):
+ # The public API prohibits attaching multiple subparts to MIMEBase
+ # derived subtypes since none of them are, by definition, of content
+ # type multipart/*
+ raise errors.MultipartConversionError(
+ 'Cannot attach additional subparts to non-multipart/*')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/text.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/text.py
new file mode 100644
index 0000000..6269f4a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/mime/text.py
@@ -0,0 +1,44 @@
+# Copyright (C) 2001-2006 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Class representing text/* type MIME documents."""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+__all__ = ['MIMEText']
+
+from future.backports.email.encoders import encode_7or8bit
+from future.backports.email.mime.nonmultipart import MIMENonMultipart
+
+
+class MIMEText(MIMENonMultipart):
+ """Class for generating text/* type MIME documents."""
+
+ def __init__(self, _text, _subtype='plain', _charset=None):
+ """Create a text/* type MIME document.
+
+ _text is the string for this message object.
+
+ _subtype is the MIME sub content type, defaulting to "plain".
+
+ _charset is the character set parameter added to the Content-Type
+ header. This defaults to "us-ascii". Note that as a side-effect, the
+ Content-Transfer-Encoding header will also be set.
+ """
+
+ # If no _charset was specified, check to see if there are non-ascii
+ # characters present. If not, use 'us-ascii', otherwise use utf-8.
+ # XXX: This can be removed once #7304 is fixed.
+ if _charset is None:
+ try:
+ _text.encode('us-ascii')
+ _charset = 'us-ascii'
+ except UnicodeEncodeError:
+ _charset = 'utf-8'
+
+ MIMENonMultipart.__init__(self, 'text', _subtype,
+ **{'charset': _charset})
+
+ self.set_payload(_text, _charset)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/parser.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/parser.py
new file mode 100644
index 0000000..df1c6e2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/parser.py
@@ -0,0 +1,135 @@
+# Copyright (C) 2001-2007 Python Software Foundation
+# Author: Barry Warsaw, Thomas Wouters, Anthony Baxter
+# Contact: email-sig@python.org
+
+"""A parser of RFC 2822 and MIME email messages."""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+__all__ = ['Parser', 'HeaderParser', 'BytesParser', 'BytesHeaderParser']
+
+import warnings
+from io import StringIO, TextIOWrapper
+
+from future.backports.email.feedparser import FeedParser, BytesFeedParser
+from future.backports.email.message import Message
+from future.backports.email._policybase import compat32
+
+
+class Parser(object):
+ def __init__(self, _class=Message, **_3to2kwargs):
+ """Parser of RFC 2822 and MIME email messages.
+
+ Creates an in-memory object tree representing the email message, which
+ can then be manipulated and turned over to a Generator to return the
+ textual representation of the message.
+
+ The string must be formatted as a block of RFC 2822 headers and header
+ continuation lines, optionally preceeded by a `Unix-from' header. The
+ header block is terminated either by the end of the string or by a
+ blank line.
+
+ _class is the class to instantiate for new message objects when they
+ must be created. This class must have a constructor that can take
+ zero arguments. Default is Message.Message.
+
+ The policy keyword specifies a policy object that controls a number of
+ aspects of the parser's operation. The default policy maintains
+ backward compatibility.
+
+ """
+ if 'policy' in _3to2kwargs: policy = _3to2kwargs['policy']; del _3to2kwargs['policy']
+ else: policy = compat32
+ self._class = _class
+ self.policy = policy
+
+ def parse(self, fp, headersonly=False):
+ """Create a message structure from the data in a file.
+
+ Reads all the data from the file and returns the root of the message
+ structure. Optional headersonly is a flag specifying whether to stop
+ parsing after reading the headers or not. The default is False,
+ meaning it parses the entire contents of the file.
+ """
+ feedparser = FeedParser(self._class, policy=self.policy)
+ if headersonly:
+ feedparser._set_headersonly()
+ while True:
+ data = fp.read(8192)
+ if not data:
+ break
+ feedparser.feed(data)
+ return feedparser.close()
+
+ def parsestr(self, text, headersonly=False):
+ """Create a message structure from a string.
+
+ Returns the root of the message structure. Optional headersonly is a
+ flag specifying whether to stop parsing after reading the headers or
+ not. The default is False, meaning it parses the entire contents of
+ the file.
+ """
+ return self.parse(StringIO(text), headersonly=headersonly)
+
+
+
+class HeaderParser(Parser):
+ def parse(self, fp, headersonly=True):
+ return Parser.parse(self, fp, True)
+
+ def parsestr(self, text, headersonly=True):
+ return Parser.parsestr(self, text, True)
+
+
+class BytesParser(object):
+
+ def __init__(self, *args, **kw):
+ """Parser of binary RFC 2822 and MIME email messages.
+
+ Creates an in-memory object tree representing the email message, which
+ can then be manipulated and turned over to a Generator to return the
+ textual representation of the message.
+
+ The input must be formatted as a block of RFC 2822 headers and header
+ continuation lines, optionally preceeded by a `Unix-from' header. The
+ header block is terminated either by the end of the input or by a
+ blank line.
+
+ _class is the class to instantiate for new message objects when they
+ must be created. This class must have a constructor that can take
+ zero arguments. Default is Message.Message.
+ """
+ self.parser = Parser(*args, **kw)
+
+ def parse(self, fp, headersonly=False):
+ """Create a message structure from the data in a binary file.
+
+ Reads all the data from the file and returns the root of the message
+ structure. Optional headersonly is a flag specifying whether to stop
+ parsing after reading the headers or not. The default is False,
+ meaning it parses the entire contents of the file.
+ """
+ fp = TextIOWrapper(fp, encoding='ascii', errors='surrogateescape')
+ with fp:
+ return self.parser.parse(fp, headersonly)
+
+
+ def parsebytes(self, text, headersonly=False):
+ """Create a message structure from a byte string.
+
+ Returns the root of the message structure. Optional headersonly is a
+ flag specifying whether to stop parsing after reading the headers or
+ not. The default is False, meaning it parses the entire contents of
+ the file.
+ """
+ text = text.decode('ASCII', errors='surrogateescape')
+ return self.parser.parsestr(text, headersonly)
+
+
+class BytesHeaderParser(BytesParser):
+ def parse(self, fp, headersonly=True):
+ return BytesParser.parse(self, fp, headersonly=True)
+
+ def parsebytes(self, text, headersonly=True):
+ return BytesParser.parsebytes(self, text, headersonly=True)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/policy.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/policy.py
new file mode 100644
index 0000000..2f609a2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/policy.py
@@ -0,0 +1,193 @@
+"""This will be the home for the policy that hooks in the new
+code that adds all the email6 features.
+"""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+from future.builtins import super
+
+from future.standard_library.email._policybase import (Policy, Compat32,
+ compat32, _extend_docstrings)
+from future.standard_library.email.utils import _has_surrogates
+from future.standard_library.email.headerregistry import HeaderRegistry as HeaderRegistry
+
+__all__ = [
+ 'Compat32',
+ 'compat32',
+ 'Policy',
+ 'EmailPolicy',
+ 'default',
+ 'strict',
+ 'SMTP',
+ 'HTTP',
+ ]
+
+@_extend_docstrings
+class EmailPolicy(Policy):
+
+ """+
+ PROVISIONAL
+
+ The API extensions enabled by this policy are currently provisional.
+ Refer to the documentation for details.
+
+ This policy adds new header parsing and folding algorithms. Instead of
+ simple strings, headers are custom objects with custom attributes
+ depending on the type of the field. The folding algorithm fully
+ implements RFCs 2047 and 5322.
+
+ In addition to the settable attributes listed above that apply to
+ all Policies, this policy adds the following additional attributes:
+
+ refold_source -- if the value for a header in the Message object
+ came from the parsing of some source, this attribute
+ indicates whether or not a generator should refold
+ that value when transforming the message back into
+ stream form. The possible values are:
+
+ none -- all source values use original folding
+ long -- source values that have any line that is
+ longer than max_line_length will be
+ refolded
+ all -- all values are refolded.
+
+ The default is 'long'.
+
+ header_factory -- a callable that takes two arguments, 'name' and
+ 'value', where 'name' is a header field name and
+ 'value' is an unfolded header field value, and
+ returns a string-like object that represents that
+ header. A default header_factory is provided that
+ understands some of the RFC5322 header field types.
+ (Currently address fields and date fields have
+ special treatment, while all other fields are
+ treated as unstructured. This list will be
+ completed before the extension is marked stable.)
+ """
+
+ refold_source = 'long'
+ header_factory = HeaderRegistry()
+
+ def __init__(self, **kw):
+ # Ensure that each new instance gets a unique header factory
+ # (as opposed to clones, which share the factory).
+ if 'header_factory' not in kw:
+ object.__setattr__(self, 'header_factory', HeaderRegistry())
+ super().__init__(**kw)
+
+ def header_max_count(self, name):
+ """+
+ The implementation for this class returns the max_count attribute from
+ the specialized header class that would be used to construct a header
+ of type 'name'.
+ """
+ return self.header_factory[name].max_count
+
+ # The logic of the next three methods is chosen such that it is possible to
+ # switch a Message object between a Compat32 policy and a policy derived
+ # from this class and have the results stay consistent. This allows a
+ # Message object constructed with this policy to be passed to a library
+ # that only handles Compat32 objects, or to receive such an object and
+ # convert it to use the newer style by just changing its policy. It is
+ # also chosen because it postpones the relatively expensive full rfc5322
+ # parse until as late as possible when parsing from source, since in many
+ # applications only a few headers will actually be inspected.
+
+ def header_source_parse(self, sourcelines):
+ """+
+ The name is parsed as everything up to the ':' and returned unmodified.
+ The value is determined by stripping leading whitespace off the
+ remainder of the first line, joining all subsequent lines together, and
+ stripping any trailing carriage return or linefeed characters. (This
+ is the same as Compat32).
+
+ """
+ name, value = sourcelines[0].split(':', 1)
+ value = value.lstrip(' \t') + ''.join(sourcelines[1:])
+ return (name, value.rstrip('\r\n'))
+
+ def header_store_parse(self, name, value):
+ """+
+ The name is returned unchanged. If the input value has a 'name'
+ attribute and it matches the name ignoring case, the value is returned
+ unchanged. Otherwise the name and value are passed to header_factory
+ method, and the resulting custom header object is returned as the
+ value. In this case a ValueError is raised if the input value contains
+ CR or LF characters.
+
+ """
+ if hasattr(value, 'name') and value.name.lower() == name.lower():
+ return (name, value)
+ if isinstance(value, str) and len(value.splitlines())>1:
+ raise ValueError("Header values may not contain linefeed "
+ "or carriage return characters")
+ return (name, self.header_factory(name, value))
+
+ def header_fetch_parse(self, name, value):
+ """+
+ If the value has a 'name' attribute, it is returned to unmodified.
+ Otherwise the name and the value with any linesep characters removed
+ are passed to the header_factory method, and the resulting custom
+ header object is returned. Any surrogateescaped bytes get turned
+ into the unicode unknown-character glyph.
+
+ """
+ if hasattr(value, 'name'):
+ return value
+ return self.header_factory(name, ''.join(value.splitlines()))
+
+ def fold(self, name, value):
+ """+
+ Header folding is controlled by the refold_source policy setting. A
+ value is considered to be a 'source value' if and only if it does not
+ have a 'name' attribute (having a 'name' attribute means it is a header
+ object of some sort). If a source value needs to be refolded according
+ to the policy, it is converted into a custom header object by passing
+ the name and the value with any linesep characters removed to the
+ header_factory method. Folding of a custom header object is done by
+ calling its fold method with the current policy.
+
+ Source values are split into lines using splitlines. If the value is
+ not to be refolded, the lines are rejoined using the linesep from the
+ policy and returned. The exception is lines containing non-ascii
+ binary data. In that case the value is refolded regardless of the
+ refold_source setting, which causes the binary data to be CTE encoded
+ using the unknown-8bit charset.
+
+ """
+ return self._fold(name, value, refold_binary=True)
+
+ def fold_binary(self, name, value):
+ """+
+ The same as fold if cte_type is 7bit, except that the returned value is
+ bytes.
+
+ If cte_type is 8bit, non-ASCII binary data is converted back into
+ bytes. Headers with binary data are not refolded, regardless of the
+ refold_header setting, since there is no way to know whether the binary
+ data consists of single byte characters or multibyte characters.
+
+ """
+ folded = self._fold(name, value, refold_binary=self.cte_type=='7bit')
+ return folded.encode('ascii', 'surrogateescape')
+
+ def _fold(self, name, value, refold_binary=False):
+ if hasattr(value, 'name'):
+ return value.fold(policy=self)
+ maxlen = self.max_line_length if self.max_line_length else float('inf')
+ lines = value.splitlines()
+ refold = (self.refold_source == 'all' or
+ self.refold_source == 'long' and
+ (lines and len(lines[0])+len(name)+2 > maxlen or
+ any(len(x) > maxlen for x in lines[1:])))
+ if refold or refold_binary and _has_surrogates(value):
+ return self.header_factory(name, ''.join(lines)).fold(policy=self)
+ return name + ': ' + self.linesep.join(lines) + self.linesep
+
+
+default = EmailPolicy()
+# Make the default policy use the class default header_factory
+del default.header_factory
+strict = default.clone(raise_on_defect=True)
+SMTP = default.clone(linesep='\r\n')
+HTTP = default.clone(linesep='\r\n', max_line_length=None)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/quoprimime.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/quoprimime.py
new file mode 100644
index 0000000..b69d158
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/quoprimime.py
@@ -0,0 +1,326 @@
+# Copyright (C) 2001-2006 Python Software Foundation
+# Author: Ben Gertzfield
+# Contact: email-sig@python.org
+
+"""Quoted-printable content transfer encoding per RFCs 2045-2047.
+
+This module handles the content transfer encoding method defined in RFC 2045
+to encode US ASCII-like 8-bit data called `quoted-printable'. It is used to
+safely encode text that is in a character set similar to the 7-bit US ASCII
+character set, but that includes some 8-bit characters that are normally not
+allowed in email bodies or headers.
+
+Quoted-printable is very space-inefficient for encoding binary files; use the
+email.base64mime module for that instead.
+
+This module provides an interface to encode and decode both headers and bodies
+with quoted-printable encoding.
+
+RFC 2045 defines a method for including character set information in an
+`encoded-word' in a header. This method is commonly used for 8-bit real names
+in To:/From:/Cc: etc. fields, as well as Subject: lines.
+
+This module does not do the line wrapping or end-of-line character
+conversion necessary for proper internationalized headers; it only
+does dumb encoding and decoding. To deal with the various line
+wrapping issues, use the email.header module.
+"""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+from future.builtins import bytes, chr, dict, int, range, super
+
+__all__ = [
+ 'body_decode',
+ 'body_encode',
+ 'body_length',
+ 'decode',
+ 'decodestring',
+ 'header_decode',
+ 'header_encode',
+ 'header_length',
+ 'quote',
+ 'unquote',
+ ]
+
+import re
+import io
+
+from string import ascii_letters, digits, hexdigits
+
+CRLF = '\r\n'
+NL = '\n'
+EMPTYSTRING = ''
+
+# Build a mapping of octets to the expansion of that octet. Since we're only
+# going to have 256 of these things, this isn't terribly inefficient
+# space-wise. Remember that headers and bodies have different sets of safe
+# characters. Initialize both maps with the full expansion, and then override
+# the safe bytes with the more compact form.
+_QUOPRI_HEADER_MAP = dict((c, '=%02X' % c) for c in range(256))
+_QUOPRI_BODY_MAP = _QUOPRI_HEADER_MAP.copy()
+
+# Safe header bytes which need no encoding.
+for c in bytes(b'-!*+/' + ascii_letters.encode('ascii') + digits.encode('ascii')):
+ _QUOPRI_HEADER_MAP[c] = chr(c)
+# Headers have one other special encoding; spaces become underscores.
+_QUOPRI_HEADER_MAP[ord(' ')] = '_'
+
+# Safe body bytes which need no encoding.
+for c in bytes(b' !"#$%&\'()*+,-./0123456789:;<>'
+ b'?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`'
+ b'abcdefghijklmnopqrstuvwxyz{|}~\t'):
+ _QUOPRI_BODY_MAP[c] = chr(c)
+
+
+
+# Helpers
+def header_check(octet):
+ """Return True if the octet should be escaped with header quopri."""
+ return chr(octet) != _QUOPRI_HEADER_MAP[octet]
+
+
+def body_check(octet):
+ """Return True if the octet should be escaped with body quopri."""
+ return chr(octet) != _QUOPRI_BODY_MAP[octet]
+
+
+def header_length(bytearray):
+ """Return a header quoted-printable encoding length.
+
+ Note that this does not include any RFC 2047 chrome added by
+ `header_encode()`.
+
+ :param bytearray: An array of bytes (a.k.a. octets).
+ :return: The length in bytes of the byte array when it is encoded with
+ quoted-printable for headers.
+ """
+ return sum(len(_QUOPRI_HEADER_MAP[octet]) for octet in bytearray)
+
+
+def body_length(bytearray):
+ """Return a body quoted-printable encoding length.
+
+ :param bytearray: An array of bytes (a.k.a. octets).
+ :return: The length in bytes of the byte array when it is encoded with
+ quoted-printable for bodies.
+ """
+ return sum(len(_QUOPRI_BODY_MAP[octet]) for octet in bytearray)
+
+
+def _max_append(L, s, maxlen, extra=''):
+ if not isinstance(s, str):
+ s = chr(s)
+ if not L:
+ L.append(s.lstrip())
+ elif len(L[-1]) + len(s) <= maxlen:
+ L[-1] += extra + s
+ else:
+ L.append(s.lstrip())
+
+
+def unquote(s):
+ """Turn a string in the form =AB to the ASCII character with value 0xab"""
+ return chr(int(s[1:3], 16))
+
+
+def quote(c):
+ return '=%02X' % ord(c)
+
+
+
+def header_encode(header_bytes, charset='iso-8859-1'):
+ """Encode a single header line with quoted-printable (like) encoding.
+
+ Defined in RFC 2045, this `Q' encoding is similar to quoted-printable, but
+ used specifically for email header fields to allow charsets with mostly 7
+ bit characters (and some 8 bit) to remain more or less readable in non-RFC
+ 2045 aware mail clients.
+
+ charset names the character set to use in the RFC 2046 header. It
+ defaults to iso-8859-1.
+ """
+ # Return empty headers as an empty string.
+ if not header_bytes:
+ return ''
+ # Iterate over every byte, encoding if necessary.
+ encoded = []
+ for octet in header_bytes:
+ encoded.append(_QUOPRI_HEADER_MAP[octet])
+ # Now add the RFC chrome to each encoded chunk and glue the chunks
+ # together.
+ return '=?%s?q?%s?=' % (charset, EMPTYSTRING.join(encoded))
+
+
+class _body_accumulator(io.StringIO):
+
+ def __init__(self, maxlinelen, eol, *args, **kw):
+ super().__init__(*args, **kw)
+ self.eol = eol
+ self.maxlinelen = self.room = maxlinelen
+
+ def write_str(self, s):
+ """Add string s to the accumulated body."""
+ self.write(s)
+ self.room -= len(s)
+
+ def newline(self):
+ """Write eol, then start new line."""
+ self.write_str(self.eol)
+ self.room = self.maxlinelen
+
+ def write_soft_break(self):
+ """Write a soft break, then start a new line."""
+ self.write_str('=')
+ self.newline()
+
+ def write_wrapped(self, s, extra_room=0):
+ """Add a soft line break if needed, then write s."""
+ if self.room < len(s) + extra_room:
+ self.write_soft_break()
+ self.write_str(s)
+
+ def write_char(self, c, is_last_char):
+ if not is_last_char:
+ # Another character follows on this line, so we must leave
+ # extra room, either for it or a soft break, and whitespace
+ # need not be quoted.
+ self.write_wrapped(c, extra_room=1)
+ elif c not in ' \t':
+ # For this and remaining cases, no more characters follow,
+ # so there is no need to reserve extra room (since a hard
+ # break will immediately follow).
+ self.write_wrapped(c)
+ elif self.room >= 3:
+ # It's a whitespace character at end-of-line, and we have room
+ # for the three-character quoted encoding.
+ self.write(quote(c))
+ elif self.room == 2:
+ # There's room for the whitespace character and a soft break.
+ self.write(c)
+ self.write_soft_break()
+ else:
+ # There's room only for a soft break. The quoted whitespace
+ # will be the only content on the subsequent line.
+ self.write_soft_break()
+ self.write(quote(c))
+
+
+def body_encode(body, maxlinelen=76, eol=NL):
+ """Encode with quoted-printable, wrapping at maxlinelen characters.
+
+ Each line of encoded text will end with eol, which defaults to "\\n". Set
+ this to "\\r\\n" if you will be using the result of this function directly
+ in an email.
+
+ Each line will be wrapped at, at most, maxlinelen characters before the
+ eol string (maxlinelen defaults to 76 characters, the maximum value
+ permitted by RFC 2045). Long lines will have the 'soft line break'
+ quoted-printable character "=" appended to them, so the decoded text will
+ be identical to the original text.
+
+ The minimum maxlinelen is 4 to have room for a quoted character ("=XX")
+ followed by a soft line break. Smaller values will generate a
+ ValueError.
+
+ """
+
+ if maxlinelen < 4:
+ raise ValueError("maxlinelen must be at least 4")
+ if not body:
+ return body
+
+ # The last line may or may not end in eol, but all other lines do.
+ last_has_eol = (body[-1] in '\r\n')
+
+ # This accumulator will make it easier to build the encoded body.
+ encoded_body = _body_accumulator(maxlinelen, eol)
+
+ lines = body.splitlines()
+ last_line_no = len(lines) - 1
+ for line_no, line in enumerate(lines):
+ last_char_index = len(line) - 1
+ for i, c in enumerate(line):
+ if body_check(ord(c)):
+ c = quote(c)
+ encoded_body.write_char(c, i==last_char_index)
+ # Add an eol if input line had eol. All input lines have eol except
+ # possibly the last one.
+ if line_no < last_line_no or last_has_eol:
+ encoded_body.newline()
+
+ return encoded_body.getvalue()
+
+
+
+# BAW: I'm not sure if the intent was for the signature of this function to be
+# the same as base64MIME.decode() or not...
+def decode(encoded, eol=NL):
+ """Decode a quoted-printable string.
+
+ Lines are separated with eol, which defaults to \\n.
+ """
+ if not encoded:
+ return encoded
+ # BAW: see comment in encode() above. Again, we're building up the
+ # decoded string with string concatenation, which could be done much more
+ # efficiently.
+ decoded = ''
+
+ for line in encoded.splitlines():
+ line = line.rstrip()
+ if not line:
+ decoded += eol
+ continue
+
+ i = 0
+ n = len(line)
+ while i < n:
+ c = line[i]
+ if c != '=':
+ decoded += c
+ i += 1
+ # Otherwise, c == "=". Are we at the end of the line? If so, add
+ # a soft line break.
+ elif i+1 == n:
+ i += 1
+ continue
+ # Decode if in form =AB
+ elif i+2 < n and line[i+1] in hexdigits and line[i+2] in hexdigits:
+ decoded += unquote(line[i:i+3])
+ i += 3
+ # Otherwise, not in form =AB, pass literally
+ else:
+ decoded += c
+ i += 1
+
+ if i == n:
+ decoded += eol
+ # Special case if original string did not end with eol
+ if encoded[-1] not in '\r\n' and decoded.endswith(eol):
+ decoded = decoded[:-1]
+ return decoded
+
+
+# For convenience and backwards compatibility w/ standard base64 module
+body_decode = decode
+decodestring = decode
+
+
+
+def _unquote_match(match):
+ """Turn a match in the form =AB to the ASCII character with value 0xab"""
+ s = match.group(0)
+ return unquote(s)
+
+
+# Header decoding is done a bit differently
+def header_decode(s):
+ """Decode a string encoded with RFC 2045 MIME header `Q' encoding.
+
+ This function does not parse a full MIME header value encoded with
+ quoted-printable (like =?iso-8895-1?q?Hello_World?=) -- please use
+ the high level email.header class for that functionality.
+ """
+ s = s.replace('_', ' ')
+ return re.sub(r'=[a-fA-F0-9]{2}', _unquote_match, s, re.ASCII)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/utils.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/utils.py
new file mode 100644
index 0000000..4abebf7
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/email/utils.py
@@ -0,0 +1,400 @@
+# Copyright (C) 2001-2010 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Miscellaneous utilities."""
+
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+from future import utils
+from future.builtins import bytes, int, str
+
+__all__ = [
+ 'collapse_rfc2231_value',
+ 'decode_params',
+ 'decode_rfc2231',
+ 'encode_rfc2231',
+ 'formataddr',
+ 'formatdate',
+ 'format_datetime',
+ 'getaddresses',
+ 'make_msgid',
+ 'mktime_tz',
+ 'parseaddr',
+ 'parsedate',
+ 'parsedate_tz',
+ 'parsedate_to_datetime',
+ 'unquote',
+ ]
+
+import os
+import re
+if utils.PY2:
+ re.ASCII = 0
+import time
+import base64
+import random
+import socket
+from future.backports import datetime
+from future.backports.urllib.parse import quote as url_quote, unquote as url_unquote
+import warnings
+from io import StringIO
+
+from future.backports.email._parseaddr import quote
+from future.backports.email._parseaddr import AddressList as _AddressList
+from future.backports.email._parseaddr import mktime_tz
+
+from future.backports.email._parseaddr import parsedate, parsedate_tz, _parsedate_tz
+
+from quopri import decodestring as _qdecode
+
+# Intrapackage imports
+from future.backports.email.encoders import _bencode, _qencode
+from future.backports.email.charset import Charset
+
+COMMASPACE = ', '
+EMPTYSTRING = ''
+UEMPTYSTRING = ''
+CRLF = '\r\n'
+TICK = "'"
+
+specialsre = re.compile(r'[][\\()<>@,:;".]')
+escapesre = re.compile(r'[\\"]')
+
+# How to figure out if we are processing strings that come from a byte
+# source with undecodable characters.
+_has_surrogates = re.compile(
+ '([^\ud800-\udbff]|\A)[\udc00-\udfff]([^\udc00-\udfff]|\Z)').search
+
+# How to deal with a string containing bytes before handing it to the
+# application through the 'normal' interface.
+def _sanitize(string):
+ # Turn any escaped bytes into unicode 'unknown' char.
+ original_bytes = string.encode('ascii', 'surrogateescape')
+ return original_bytes.decode('ascii', 'replace')
+
+
+# Helpers
+
+def formataddr(pair, charset='utf-8'):
+ """The inverse of parseaddr(), this takes a 2-tuple of the form
+ (realname, email_address) and returns the string value suitable
+ for an RFC 2822 From, To or Cc header.
+
+ If the first element of pair is false, then the second element is
+ returned unmodified.
+
+ Optional charset if given is the character set that is used to encode
+ realname in case realname is not ASCII safe. Can be an instance of str or
+ a Charset-like object which has a header_encode method. Default is
+ 'utf-8'.
+ """
+ name, address = pair
+ # The address MUST (per RFC) be ascii, so raise an UnicodeError if it isn't.
+ address.encode('ascii')
+ if name:
+ try:
+ name.encode('ascii')
+ except UnicodeEncodeError:
+ if isinstance(charset, str):
+ charset = Charset(charset)
+ encoded_name = charset.header_encode(name)
+ return "%s <%s>" % (encoded_name, address)
+ else:
+ quotes = ''
+ if specialsre.search(name):
+ quotes = '"'
+ name = escapesre.sub(r'\\\g<0>', name)
+ return '%s%s%s <%s>' % (quotes, name, quotes, address)
+ return address
+
+
+
+def getaddresses(fieldvalues):
+ """Return a list of (REALNAME, EMAIL) for each fieldvalue."""
+ all = COMMASPACE.join(fieldvalues)
+ a = _AddressList(all)
+ return a.addresslist
+
+
+
+ecre = re.compile(r'''
+ =\? # literal =?
+ (?P[^?]*?) # non-greedy up to the next ? is the charset
+ \? # literal ?
+ (?P[qb]) # either a "q" or a "b", case insensitive
+ \? # literal ?
+ (?P.*?) # non-greedy up to the next ?= is the atom
+ \?= # literal ?=
+ ''', re.VERBOSE | re.IGNORECASE)
+
+
+def _format_timetuple_and_zone(timetuple, zone):
+ return '%s, %02d %s %04d %02d:%02d:%02d %s' % (
+ ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'][timetuple[6]],
+ timetuple[2],
+ ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][timetuple[1] - 1],
+ timetuple[0], timetuple[3], timetuple[4], timetuple[5],
+ zone)
+
+def formatdate(timeval=None, localtime=False, usegmt=False):
+ """Returns a date string as specified by RFC 2822, e.g.:
+
+ Fri, 09 Nov 2001 01:08:47 -0000
+
+ Optional timeval if given is a floating point time value as accepted by
+ gmtime() and localtime(), otherwise the current time is used.
+
+ Optional localtime is a flag that when True, interprets timeval, and
+ returns a date relative to the local timezone instead of UTC, properly
+ taking daylight savings time into account.
+
+ Optional argument usegmt means that the timezone is written out as
+ an ascii string, not numeric one (so "GMT" instead of "+0000"). This
+ is needed for HTTP, and is only used when localtime==False.
+ """
+ # Note: we cannot use strftime() because that honors the locale and RFC
+ # 2822 requires that day and month names be the English abbreviations.
+ if timeval is None:
+ timeval = time.time()
+ if localtime:
+ now = time.localtime(timeval)
+ # Calculate timezone offset, based on whether the local zone has
+ # daylight savings time, and whether DST is in effect.
+ if time.daylight and now[-1]:
+ offset = time.altzone
+ else:
+ offset = time.timezone
+ hours, minutes = divmod(abs(offset), 3600)
+ # Remember offset is in seconds west of UTC, but the timezone is in
+ # minutes east of UTC, so the signs differ.
+ if offset > 0:
+ sign = '-'
+ else:
+ sign = '+'
+ zone = '%s%02d%02d' % (sign, hours, minutes // 60)
+ else:
+ now = time.gmtime(timeval)
+ # Timezone offset is always -0000
+ if usegmt:
+ zone = 'GMT'
+ else:
+ zone = '-0000'
+ return _format_timetuple_and_zone(now, zone)
+
+def format_datetime(dt, usegmt=False):
+ """Turn a datetime into a date string as specified in RFC 2822.
+
+ If usegmt is True, dt must be an aware datetime with an offset of zero. In
+ this case 'GMT' will be rendered instead of the normal +0000 required by
+ RFC2822. This is to support HTTP headers involving date stamps.
+ """
+ now = dt.timetuple()
+ if usegmt:
+ if dt.tzinfo is None or dt.tzinfo != datetime.timezone.utc:
+ raise ValueError("usegmt option requires a UTC datetime")
+ zone = 'GMT'
+ elif dt.tzinfo is None:
+ zone = '-0000'
+ else:
+ zone = dt.strftime("%z")
+ return _format_timetuple_and_zone(now, zone)
+
+
+def make_msgid(idstring=None, domain=None):
+ """Returns a string suitable for RFC 2822 compliant Message-ID, e.g:
+
+ <20020201195627.33539.96671@nightshade.la.mastaler.com>
+
+ Optional idstring if given is a string used to strengthen the
+ uniqueness of the message id. Optional domain if given provides the
+ portion of the message id after the '@'. It defaults to the locally
+ defined hostname.
+ """
+ timeval = time.time()
+ utcdate = time.strftime('%Y%m%d%H%M%S', time.gmtime(timeval))
+ pid = os.getpid()
+ randint = random.randrange(100000)
+ if idstring is None:
+ idstring = ''
+ else:
+ idstring = '.' + idstring
+ if domain is None:
+ domain = socket.getfqdn()
+ msgid = '<%s.%s.%s%s@%s>' % (utcdate, pid, randint, idstring, domain)
+ return msgid
+
+
+def parsedate_to_datetime(data):
+ _3to2list = list(_parsedate_tz(data))
+ dtuple, tz, = [_3to2list[:-1]] + _3to2list[-1:]
+ if tz is None:
+ return datetime.datetime(*dtuple[:6])
+ return datetime.datetime(*dtuple[:6],
+ tzinfo=datetime.timezone(datetime.timedelta(seconds=tz)))
+
+
+def parseaddr(addr):
+ addrs = _AddressList(addr).addresslist
+ if not addrs:
+ return '', ''
+ return addrs[0]
+
+
+# rfc822.unquote() doesn't properly de-backslash-ify in Python pre-2.3.
+def unquote(str):
+ """Remove quotes from a string."""
+ if len(str) > 1:
+ if str.startswith('"') and str.endswith('"'):
+ return str[1:-1].replace('\\\\', '\\').replace('\\"', '"')
+ if str.startswith('<') and str.endswith('>'):
+ return str[1:-1]
+ return str
+
+
+
+# RFC2231-related functions - parameter encoding and decoding
+def decode_rfc2231(s):
+ """Decode string according to RFC 2231"""
+ parts = s.split(TICK, 2)
+ if len(parts) <= 2:
+ return None, None, s
+ return parts
+
+
+def encode_rfc2231(s, charset=None, language=None):
+ """Encode string according to RFC 2231.
+
+ If neither charset nor language is given, then s is returned as-is. If
+ charset is given but not language, the string is encoded using the empty
+ string for language.
+ """
+ s = url_quote(s, safe='', encoding=charset or 'ascii')
+ if charset is None and language is None:
+ return s
+ if language is None:
+ language = ''
+ return "%s'%s'%s" % (charset, language, s)
+
+
+rfc2231_continuation = re.compile(r'^(?P\w+)\*((?P[0-9]+)\*?)?$',
+ re.ASCII)
+
+def decode_params(params):
+ """Decode parameters list according to RFC 2231.
+
+ params is a sequence of 2-tuples containing (param name, string value).
+ """
+ # Copy params so we don't mess with the original
+ params = params[:]
+ new_params = []
+ # Map parameter's name to a list of continuations. The values are a
+ # 3-tuple of the continuation number, the string value, and a flag
+ # specifying whether a particular segment is %-encoded.
+ rfc2231_params = {}
+ name, value = params.pop(0)
+ new_params.append((name, value))
+ while params:
+ name, value = params.pop(0)
+ if name.endswith('*'):
+ encoded = True
+ else:
+ encoded = False
+ value = unquote(value)
+ mo = rfc2231_continuation.match(name)
+ if mo:
+ name, num = mo.group('name', 'num')
+ if num is not None:
+ num = int(num)
+ rfc2231_params.setdefault(name, []).append((num, value, encoded))
+ else:
+ new_params.append((name, '"%s"' % quote(value)))
+ if rfc2231_params:
+ for name, continuations in rfc2231_params.items():
+ value = []
+ extended = False
+ # Sort by number
+ continuations.sort()
+ # And now append all values in numerical order, converting
+ # %-encodings for the encoded segments. If any of the
+ # continuation names ends in a *, then the entire string, after
+ # decoding segments and concatenating, must have the charset and
+ # language specifiers at the beginning of the string.
+ for num, s, encoded in continuations:
+ if encoded:
+ # Decode as "latin-1", so the characters in s directly
+ # represent the percent-encoded octet values.
+ # collapse_rfc2231_value treats this as an octet sequence.
+ s = url_unquote(s, encoding="latin-1")
+ extended = True
+ value.append(s)
+ value = quote(EMPTYSTRING.join(value))
+ if extended:
+ charset, language, value = decode_rfc2231(value)
+ new_params.append((name, (charset, language, '"%s"' % value)))
+ else:
+ new_params.append((name, '"%s"' % value))
+ return new_params
+
+def collapse_rfc2231_value(value, errors='replace',
+ fallback_charset='us-ascii'):
+ if not isinstance(value, tuple) or len(value) != 3:
+ return unquote(value)
+ # While value comes to us as a unicode string, we need it to be a bytes
+ # object. We do not want bytes() normal utf-8 decoder, we want a straight
+ # interpretation of the string as character bytes.
+ charset, language, text = value
+ rawbytes = bytes(text, 'raw-unicode-escape')
+ try:
+ return str(rawbytes, charset, errors)
+ except LookupError:
+ # charset is not a known codec.
+ return unquote(text)
+
+
+#
+# datetime doesn't provide a localtime function yet, so provide one. Code
+# adapted from the patch in issue 9527. This may not be perfect, but it is
+# better than not having it.
+#
+
+def localtime(dt=None, isdst=-1):
+ """Return local time as an aware datetime object.
+
+ If called without arguments, return current time. Otherwise *dt*
+ argument should be a datetime instance, and it is converted to the
+ local time zone according to the system time zone database. If *dt* is
+ naive (that is, dt.tzinfo is None), it is assumed to be in local time.
+ In this case, a positive or zero value for *isdst* causes localtime to
+ presume initially that summer time (for example, Daylight Saving Time)
+ is or is not (respectively) in effect for the specified time. A
+ negative value for *isdst* causes the localtime() function to attempt
+ to divine whether summer time is in effect for the specified time.
+
+ """
+ if dt is None:
+ return datetime.datetime.now(datetime.timezone.utc).astimezone()
+ if dt.tzinfo is not None:
+ return dt.astimezone()
+ # We have a naive datetime. Convert to a (localtime) timetuple and pass to
+ # system mktime together with the isdst hint. System mktime will return
+ # seconds since epoch.
+ tm = dt.timetuple()[:-1] + (isdst,)
+ seconds = time.mktime(tm)
+ localtm = time.localtime(seconds)
+ try:
+ delta = datetime.timedelta(seconds=localtm.tm_gmtoff)
+ tz = datetime.timezone(delta, localtm.tm_zone)
+ except AttributeError:
+ # Compute UTC offset and compare with the value implied by tm_isdst.
+ # If the values match, use the zone name implied by tm_isdst.
+ delta = dt - datetime.datetime(*time.gmtime(seconds)[:6])
+ dst = time.daylight and localtm.tm_isdst > 0
+ gmtoff = -(time.altzone if dst else time.timezone)
+ if delta == datetime.timedelta(seconds=gmtoff):
+ tz = datetime.timezone(delta, time.tzname[dst])
+ else:
+ tz = datetime.timezone(delta)
+ return dt.replace(tzinfo=tz)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/html/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/html/__init__.py
new file mode 100644
index 0000000..837afce
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/html/__init__.py
@@ -0,0 +1,28 @@
+"""
+General functions for HTML manipulation, backported from Py3.
+
+Note that this uses Python 2.7 code with the corresponding Python 3
+module names and locations.
+"""
+
+from __future__ import unicode_literals
+
+
+_escape_map = {ord('&'): '&', ord('<'): '<', ord('>'): '>'}
+_escape_map_full = {ord('&'): '&', ord('<'): '<', ord('>'): '>',
+ ord('"'): '"', ord('\''): '''}
+
+# NB: this is a candidate for a bytes/string polymorphic interface
+
+def escape(s, quote=True):
+ """
+ Replace special characters "&", "<" and ">" to HTML-safe sequences.
+ If the optional flag quote is true (the default), the quotation mark
+ characters, both double quote (") and single quote (') characters are also
+ translated.
+ """
+ assert not isinstance(s, bytes), 'Pass a unicode string'
+ if quote:
+ return s.translate(_escape_map_full)
+ return s.translate(_escape_map)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/html/entities.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/html/entities.py
new file mode 100644
index 0000000..6798187
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/html/entities.py
@@ -0,0 +1,2515 @@
+"""HTML character entity references.
+
+Backported for python-future from Python 3.3
+"""
+
+from __future__ import (absolute_import, division,
+ print_function, unicode_literals)
+from future.builtins import *
+
+
+# maps the HTML entity name to the Unicode codepoint
+name2codepoint = {
+ 'AElig': 0x00c6, # latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1
+ 'Aacute': 0x00c1, # latin capital letter A with acute, U+00C1 ISOlat1
+ 'Acirc': 0x00c2, # latin capital letter A with circumflex, U+00C2 ISOlat1
+ 'Agrave': 0x00c0, # latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1
+ 'Alpha': 0x0391, # greek capital letter alpha, U+0391
+ 'Aring': 0x00c5, # latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1
+ 'Atilde': 0x00c3, # latin capital letter A with tilde, U+00C3 ISOlat1
+ 'Auml': 0x00c4, # latin capital letter A with diaeresis, U+00C4 ISOlat1
+ 'Beta': 0x0392, # greek capital letter beta, U+0392
+ 'Ccedil': 0x00c7, # latin capital letter C with cedilla, U+00C7 ISOlat1
+ 'Chi': 0x03a7, # greek capital letter chi, U+03A7
+ 'Dagger': 0x2021, # double dagger, U+2021 ISOpub
+ 'Delta': 0x0394, # greek capital letter delta, U+0394 ISOgrk3
+ 'ETH': 0x00d0, # latin capital letter ETH, U+00D0 ISOlat1
+ 'Eacute': 0x00c9, # latin capital letter E with acute, U+00C9 ISOlat1
+ 'Ecirc': 0x00ca, # latin capital letter E with circumflex, U+00CA ISOlat1
+ 'Egrave': 0x00c8, # latin capital letter E with grave, U+00C8 ISOlat1
+ 'Epsilon': 0x0395, # greek capital letter epsilon, U+0395
+ 'Eta': 0x0397, # greek capital letter eta, U+0397
+ 'Euml': 0x00cb, # latin capital letter E with diaeresis, U+00CB ISOlat1
+ 'Gamma': 0x0393, # greek capital letter gamma, U+0393 ISOgrk3
+ 'Iacute': 0x00cd, # latin capital letter I with acute, U+00CD ISOlat1
+ 'Icirc': 0x00ce, # latin capital letter I with circumflex, U+00CE ISOlat1
+ 'Igrave': 0x00cc, # latin capital letter I with grave, U+00CC ISOlat1
+ 'Iota': 0x0399, # greek capital letter iota, U+0399
+ 'Iuml': 0x00cf, # latin capital letter I with diaeresis, U+00CF ISOlat1
+ 'Kappa': 0x039a, # greek capital letter kappa, U+039A
+ 'Lambda': 0x039b, # greek capital letter lambda, U+039B ISOgrk3
+ 'Mu': 0x039c, # greek capital letter mu, U+039C
+ 'Ntilde': 0x00d1, # latin capital letter N with tilde, U+00D1 ISOlat1
+ 'Nu': 0x039d, # greek capital letter nu, U+039D
+ 'OElig': 0x0152, # latin capital ligature OE, U+0152 ISOlat2
+ 'Oacute': 0x00d3, # latin capital letter O with acute, U+00D3 ISOlat1
+ 'Ocirc': 0x00d4, # latin capital letter O with circumflex, U+00D4 ISOlat1
+ 'Ograve': 0x00d2, # latin capital letter O with grave, U+00D2 ISOlat1
+ 'Omega': 0x03a9, # greek capital letter omega, U+03A9 ISOgrk3
+ 'Omicron': 0x039f, # greek capital letter omicron, U+039F
+ 'Oslash': 0x00d8, # latin capital letter O with stroke = latin capital letter O slash, U+00D8 ISOlat1
+ 'Otilde': 0x00d5, # latin capital letter O with tilde, U+00D5 ISOlat1
+ 'Ouml': 0x00d6, # latin capital letter O with diaeresis, U+00D6 ISOlat1
+ 'Phi': 0x03a6, # greek capital letter phi, U+03A6 ISOgrk3
+ 'Pi': 0x03a0, # greek capital letter pi, U+03A0 ISOgrk3
+ 'Prime': 0x2033, # double prime = seconds = inches, U+2033 ISOtech
+ 'Psi': 0x03a8, # greek capital letter psi, U+03A8 ISOgrk3
+ 'Rho': 0x03a1, # greek capital letter rho, U+03A1
+ 'Scaron': 0x0160, # latin capital letter S with caron, U+0160 ISOlat2
+ 'Sigma': 0x03a3, # greek capital letter sigma, U+03A3 ISOgrk3
+ 'THORN': 0x00de, # latin capital letter THORN, U+00DE ISOlat1
+ 'Tau': 0x03a4, # greek capital letter tau, U+03A4
+ 'Theta': 0x0398, # greek capital letter theta, U+0398 ISOgrk3
+ 'Uacute': 0x00da, # latin capital letter U with acute, U+00DA ISOlat1
+ 'Ucirc': 0x00db, # latin capital letter U with circumflex, U+00DB ISOlat1
+ 'Ugrave': 0x00d9, # latin capital letter U with grave, U+00D9 ISOlat1
+ 'Upsilon': 0x03a5, # greek capital letter upsilon, U+03A5 ISOgrk3
+ 'Uuml': 0x00dc, # latin capital letter U with diaeresis, U+00DC ISOlat1
+ 'Xi': 0x039e, # greek capital letter xi, U+039E ISOgrk3
+ 'Yacute': 0x00dd, # latin capital letter Y with acute, U+00DD ISOlat1
+ 'Yuml': 0x0178, # latin capital letter Y with diaeresis, U+0178 ISOlat2
+ 'Zeta': 0x0396, # greek capital letter zeta, U+0396
+ 'aacute': 0x00e1, # latin small letter a with acute, U+00E1 ISOlat1
+ 'acirc': 0x00e2, # latin small letter a with circumflex, U+00E2 ISOlat1
+ 'acute': 0x00b4, # acute accent = spacing acute, U+00B4 ISOdia
+ 'aelig': 0x00e6, # latin small letter ae = latin small ligature ae, U+00E6 ISOlat1
+ 'agrave': 0x00e0, # latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1
+ 'alefsym': 0x2135, # alef symbol = first transfinite cardinal, U+2135 NEW
+ 'alpha': 0x03b1, # greek small letter alpha, U+03B1 ISOgrk3
+ 'amp': 0x0026, # ampersand, U+0026 ISOnum
+ 'and': 0x2227, # logical and = wedge, U+2227 ISOtech
+ 'ang': 0x2220, # angle, U+2220 ISOamso
+ 'aring': 0x00e5, # latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1
+ 'asymp': 0x2248, # almost equal to = asymptotic to, U+2248 ISOamsr
+ 'atilde': 0x00e3, # latin small letter a with tilde, U+00E3 ISOlat1
+ 'auml': 0x00e4, # latin small letter a with diaeresis, U+00E4 ISOlat1
+ 'bdquo': 0x201e, # double low-9 quotation mark, U+201E NEW
+ 'beta': 0x03b2, # greek small letter beta, U+03B2 ISOgrk3
+ 'brvbar': 0x00a6, # broken bar = broken vertical bar, U+00A6 ISOnum
+ 'bull': 0x2022, # bullet = black small circle, U+2022 ISOpub
+ 'cap': 0x2229, # intersection = cap, U+2229 ISOtech
+ 'ccedil': 0x00e7, # latin small letter c with cedilla, U+00E7 ISOlat1
+ 'cedil': 0x00b8, # cedilla = spacing cedilla, U+00B8 ISOdia
+ 'cent': 0x00a2, # cent sign, U+00A2 ISOnum
+ 'chi': 0x03c7, # greek small letter chi, U+03C7 ISOgrk3
+ 'circ': 0x02c6, # modifier letter circumflex accent, U+02C6 ISOpub
+ 'clubs': 0x2663, # black club suit = shamrock, U+2663 ISOpub
+ 'cong': 0x2245, # approximately equal to, U+2245 ISOtech
+ 'copy': 0x00a9, # copyright sign, U+00A9 ISOnum
+ 'crarr': 0x21b5, # downwards arrow with corner leftwards = carriage return, U+21B5 NEW
+ 'cup': 0x222a, # union = cup, U+222A ISOtech
+ 'curren': 0x00a4, # currency sign, U+00A4 ISOnum
+ 'dArr': 0x21d3, # downwards double arrow, U+21D3 ISOamsa
+ 'dagger': 0x2020, # dagger, U+2020 ISOpub
+ 'darr': 0x2193, # downwards arrow, U+2193 ISOnum
+ 'deg': 0x00b0, # degree sign, U+00B0 ISOnum
+ 'delta': 0x03b4, # greek small letter delta, U+03B4 ISOgrk3
+ 'diams': 0x2666, # black diamond suit, U+2666 ISOpub
+ 'divide': 0x00f7, # division sign, U+00F7 ISOnum
+ 'eacute': 0x00e9, # latin small letter e with acute, U+00E9 ISOlat1
+ 'ecirc': 0x00ea, # latin small letter e with circumflex, U+00EA ISOlat1
+ 'egrave': 0x00e8, # latin small letter e with grave, U+00E8 ISOlat1
+ 'empty': 0x2205, # empty set = null set = diameter, U+2205 ISOamso
+ 'emsp': 0x2003, # em space, U+2003 ISOpub
+ 'ensp': 0x2002, # en space, U+2002 ISOpub
+ 'epsilon': 0x03b5, # greek small letter epsilon, U+03B5 ISOgrk3
+ 'equiv': 0x2261, # identical to, U+2261 ISOtech
+ 'eta': 0x03b7, # greek small letter eta, U+03B7 ISOgrk3
+ 'eth': 0x00f0, # latin small letter eth, U+00F0 ISOlat1
+ 'euml': 0x00eb, # latin small letter e with diaeresis, U+00EB ISOlat1
+ 'euro': 0x20ac, # euro sign, U+20AC NEW
+ 'exist': 0x2203, # there exists, U+2203 ISOtech
+ 'fnof': 0x0192, # latin small f with hook = function = florin, U+0192 ISOtech
+ 'forall': 0x2200, # for all, U+2200 ISOtech
+ 'frac12': 0x00bd, # vulgar fraction one half = fraction one half, U+00BD ISOnum
+ 'frac14': 0x00bc, # vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum
+ 'frac34': 0x00be, # vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum
+ 'frasl': 0x2044, # fraction slash, U+2044 NEW
+ 'gamma': 0x03b3, # greek small letter gamma, U+03B3 ISOgrk3
+ 'ge': 0x2265, # greater-than or equal to, U+2265 ISOtech
+ 'gt': 0x003e, # greater-than sign, U+003E ISOnum
+ 'hArr': 0x21d4, # left right double arrow, U+21D4 ISOamsa
+ 'harr': 0x2194, # left right arrow, U+2194 ISOamsa
+ 'hearts': 0x2665, # black heart suit = valentine, U+2665 ISOpub
+ 'hellip': 0x2026, # horizontal ellipsis = three dot leader, U+2026 ISOpub
+ 'iacute': 0x00ed, # latin small letter i with acute, U+00ED ISOlat1
+ 'icirc': 0x00ee, # latin small letter i with circumflex, U+00EE ISOlat1
+ 'iexcl': 0x00a1, # inverted exclamation mark, U+00A1 ISOnum
+ 'igrave': 0x00ec, # latin small letter i with grave, U+00EC ISOlat1
+ 'image': 0x2111, # blackletter capital I = imaginary part, U+2111 ISOamso
+ 'infin': 0x221e, # infinity, U+221E ISOtech
+ 'int': 0x222b, # integral, U+222B ISOtech
+ 'iota': 0x03b9, # greek small letter iota, U+03B9 ISOgrk3
+ 'iquest': 0x00bf, # inverted question mark = turned question mark, U+00BF ISOnum
+ 'isin': 0x2208, # element of, U+2208 ISOtech
+ 'iuml': 0x00ef, # latin small letter i with diaeresis, U+00EF ISOlat1
+ 'kappa': 0x03ba, # greek small letter kappa, U+03BA ISOgrk3
+ 'lArr': 0x21d0, # leftwards double arrow, U+21D0 ISOtech
+ 'lambda': 0x03bb, # greek small letter lambda, U+03BB ISOgrk3
+ 'lang': 0x2329, # left-pointing angle bracket = bra, U+2329 ISOtech
+ 'laquo': 0x00ab, # left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum
+ 'larr': 0x2190, # leftwards arrow, U+2190 ISOnum
+ 'lceil': 0x2308, # left ceiling = apl upstile, U+2308 ISOamsc
+ 'ldquo': 0x201c, # left double quotation mark, U+201C ISOnum
+ 'le': 0x2264, # less-than or equal to, U+2264 ISOtech
+ 'lfloor': 0x230a, # left floor = apl downstile, U+230A ISOamsc
+ 'lowast': 0x2217, # asterisk operator, U+2217 ISOtech
+ 'loz': 0x25ca, # lozenge, U+25CA ISOpub
+ 'lrm': 0x200e, # left-to-right mark, U+200E NEW RFC 2070
+ 'lsaquo': 0x2039, # single left-pointing angle quotation mark, U+2039 ISO proposed
+ 'lsquo': 0x2018, # left single quotation mark, U+2018 ISOnum
+ 'lt': 0x003c, # less-than sign, U+003C ISOnum
+ 'macr': 0x00af, # macron = spacing macron = overline = APL overbar, U+00AF ISOdia
+ 'mdash': 0x2014, # em dash, U+2014 ISOpub
+ 'micro': 0x00b5, # micro sign, U+00B5 ISOnum
+ 'middot': 0x00b7, # middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum
+ 'minus': 0x2212, # minus sign, U+2212 ISOtech
+ 'mu': 0x03bc, # greek small letter mu, U+03BC ISOgrk3
+ 'nabla': 0x2207, # nabla = backward difference, U+2207 ISOtech
+ 'nbsp': 0x00a0, # no-break space = non-breaking space, U+00A0 ISOnum
+ 'ndash': 0x2013, # en dash, U+2013 ISOpub
+ 'ne': 0x2260, # not equal to, U+2260 ISOtech
+ 'ni': 0x220b, # contains as member, U+220B ISOtech
+ 'not': 0x00ac, # not sign, U+00AC ISOnum
+ 'notin': 0x2209, # not an element of, U+2209 ISOtech
+ 'nsub': 0x2284, # not a subset of, U+2284 ISOamsn
+ 'ntilde': 0x00f1, # latin small letter n with tilde, U+00F1 ISOlat1
+ 'nu': 0x03bd, # greek small letter nu, U+03BD ISOgrk3
+ 'oacute': 0x00f3, # latin small letter o with acute, U+00F3 ISOlat1
+ 'ocirc': 0x00f4, # latin small letter o with circumflex, U+00F4 ISOlat1
+ 'oelig': 0x0153, # latin small ligature oe, U+0153 ISOlat2
+ 'ograve': 0x00f2, # latin small letter o with grave, U+00F2 ISOlat1
+ 'oline': 0x203e, # overline = spacing overscore, U+203E NEW
+ 'omega': 0x03c9, # greek small letter omega, U+03C9 ISOgrk3
+ 'omicron': 0x03bf, # greek small letter omicron, U+03BF NEW
+ 'oplus': 0x2295, # circled plus = direct sum, U+2295 ISOamsb
+ 'or': 0x2228, # logical or = vee, U+2228 ISOtech
+ 'ordf': 0x00aa, # feminine ordinal indicator, U+00AA ISOnum
+ 'ordm': 0x00ba, # masculine ordinal indicator, U+00BA ISOnum
+ 'oslash': 0x00f8, # latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1
+ 'otilde': 0x00f5, # latin small letter o with tilde, U+00F5 ISOlat1
+ 'otimes': 0x2297, # circled times = vector product, U+2297 ISOamsb
+ 'ouml': 0x00f6, # latin small letter o with diaeresis, U+00F6 ISOlat1
+ 'para': 0x00b6, # pilcrow sign = paragraph sign, U+00B6 ISOnum
+ 'part': 0x2202, # partial differential, U+2202 ISOtech
+ 'permil': 0x2030, # per mille sign, U+2030 ISOtech
+ 'perp': 0x22a5, # up tack = orthogonal to = perpendicular, U+22A5 ISOtech
+ 'phi': 0x03c6, # greek small letter phi, U+03C6 ISOgrk3
+ 'pi': 0x03c0, # greek small letter pi, U+03C0 ISOgrk3
+ 'piv': 0x03d6, # greek pi symbol, U+03D6 ISOgrk3
+ 'plusmn': 0x00b1, # plus-minus sign = plus-or-minus sign, U+00B1 ISOnum
+ 'pound': 0x00a3, # pound sign, U+00A3 ISOnum
+ 'prime': 0x2032, # prime = minutes = feet, U+2032 ISOtech
+ 'prod': 0x220f, # n-ary product = product sign, U+220F ISOamsb
+ 'prop': 0x221d, # proportional to, U+221D ISOtech
+ 'psi': 0x03c8, # greek small letter psi, U+03C8 ISOgrk3
+ 'quot': 0x0022, # quotation mark = APL quote, U+0022 ISOnum
+ 'rArr': 0x21d2, # rightwards double arrow, U+21D2 ISOtech
+ 'radic': 0x221a, # square root = radical sign, U+221A ISOtech
+ 'rang': 0x232a, # right-pointing angle bracket = ket, U+232A ISOtech
+ 'raquo': 0x00bb, # right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum
+ 'rarr': 0x2192, # rightwards arrow, U+2192 ISOnum
+ 'rceil': 0x2309, # right ceiling, U+2309 ISOamsc
+ 'rdquo': 0x201d, # right double quotation mark, U+201D ISOnum
+ 'real': 0x211c, # blackletter capital R = real part symbol, U+211C ISOamso
+ 'reg': 0x00ae, # registered sign = registered trade mark sign, U+00AE ISOnum
+ 'rfloor': 0x230b, # right floor, U+230B ISOamsc
+ 'rho': 0x03c1, # greek small letter rho, U+03C1 ISOgrk3
+ 'rlm': 0x200f, # right-to-left mark, U+200F NEW RFC 2070
+ 'rsaquo': 0x203a, # single right-pointing angle quotation mark, U+203A ISO proposed
+ 'rsquo': 0x2019, # right single quotation mark, U+2019 ISOnum
+ 'sbquo': 0x201a, # single low-9 quotation mark, U+201A NEW
+ 'scaron': 0x0161, # latin small letter s with caron, U+0161 ISOlat2
+ 'sdot': 0x22c5, # dot operator, U+22C5 ISOamsb
+ 'sect': 0x00a7, # section sign, U+00A7 ISOnum
+ 'shy': 0x00ad, # soft hyphen = discretionary hyphen, U+00AD ISOnum
+ 'sigma': 0x03c3, # greek small letter sigma, U+03C3 ISOgrk3
+ 'sigmaf': 0x03c2, # greek small letter final sigma, U+03C2 ISOgrk3
+ 'sim': 0x223c, # tilde operator = varies with = similar to, U+223C ISOtech
+ 'spades': 0x2660, # black spade suit, U+2660 ISOpub
+ 'sub': 0x2282, # subset of, U+2282 ISOtech
+ 'sube': 0x2286, # subset of or equal to, U+2286 ISOtech
+ 'sum': 0x2211, # n-ary sumation, U+2211 ISOamsb
+ 'sup': 0x2283, # superset of, U+2283 ISOtech
+ 'sup1': 0x00b9, # superscript one = superscript digit one, U+00B9 ISOnum
+ 'sup2': 0x00b2, # superscript two = superscript digit two = squared, U+00B2 ISOnum
+ 'sup3': 0x00b3, # superscript three = superscript digit three = cubed, U+00B3 ISOnum
+ 'supe': 0x2287, # superset of or equal to, U+2287 ISOtech
+ 'szlig': 0x00df, # latin small letter sharp s = ess-zed, U+00DF ISOlat1
+ 'tau': 0x03c4, # greek small letter tau, U+03C4 ISOgrk3
+ 'there4': 0x2234, # therefore, U+2234 ISOtech
+ 'theta': 0x03b8, # greek small letter theta, U+03B8 ISOgrk3
+ 'thetasym': 0x03d1, # greek small letter theta symbol, U+03D1 NEW
+ 'thinsp': 0x2009, # thin space, U+2009 ISOpub
+ 'thorn': 0x00fe, # latin small letter thorn with, U+00FE ISOlat1
+ 'tilde': 0x02dc, # small tilde, U+02DC ISOdia
+ 'times': 0x00d7, # multiplication sign, U+00D7 ISOnum
+ 'trade': 0x2122, # trade mark sign, U+2122 ISOnum
+ 'uArr': 0x21d1, # upwards double arrow, U+21D1 ISOamsa
+ 'uacute': 0x00fa, # latin small letter u with acute, U+00FA ISOlat1
+ 'uarr': 0x2191, # upwards arrow, U+2191 ISOnum
+ 'ucirc': 0x00fb, # latin small letter u with circumflex, U+00FB ISOlat1
+ 'ugrave': 0x00f9, # latin small letter u with grave, U+00F9 ISOlat1
+ 'uml': 0x00a8, # diaeresis = spacing diaeresis, U+00A8 ISOdia
+ 'upsih': 0x03d2, # greek upsilon with hook symbol, U+03D2 NEW
+ 'upsilon': 0x03c5, # greek small letter upsilon, U+03C5 ISOgrk3
+ 'uuml': 0x00fc, # latin small letter u with diaeresis, U+00FC ISOlat1
+ 'weierp': 0x2118, # script capital P = power set = Weierstrass p, U+2118 ISOamso
+ 'xi': 0x03be, # greek small letter xi, U+03BE ISOgrk3
+ 'yacute': 0x00fd, # latin small letter y with acute, U+00FD ISOlat1
+ 'yen': 0x00a5, # yen sign = yuan sign, U+00A5 ISOnum
+ 'yuml': 0x00ff, # latin small letter y with diaeresis, U+00FF ISOlat1
+ 'zeta': 0x03b6, # greek small letter zeta, U+03B6 ISOgrk3
+ 'zwj': 0x200d, # zero width joiner, U+200D NEW RFC 2070
+ 'zwnj': 0x200c, # zero width non-joiner, U+200C NEW RFC 2070
+}
+
+
+# maps the HTML5 named character references to the equivalent Unicode character(s)
+html5 = {
+ 'Aacute': '\xc1',
+ 'aacute': '\xe1',
+ 'Aacute;': '\xc1',
+ 'aacute;': '\xe1',
+ 'Abreve;': '\u0102',
+ 'abreve;': '\u0103',
+ 'ac;': '\u223e',
+ 'acd;': '\u223f',
+ 'acE;': '\u223e\u0333',
+ 'Acirc': '\xc2',
+ 'acirc': '\xe2',
+ 'Acirc;': '\xc2',
+ 'acirc;': '\xe2',
+ 'acute': '\xb4',
+ 'acute;': '\xb4',
+ 'Acy;': '\u0410',
+ 'acy;': '\u0430',
+ 'AElig': '\xc6',
+ 'aelig': '\xe6',
+ 'AElig;': '\xc6',
+ 'aelig;': '\xe6',
+ 'af;': '\u2061',
+ 'Afr;': '\U0001d504',
+ 'afr;': '\U0001d51e',
+ 'Agrave': '\xc0',
+ 'agrave': '\xe0',
+ 'Agrave;': '\xc0',
+ 'agrave;': '\xe0',
+ 'alefsym;': '\u2135',
+ 'aleph;': '\u2135',
+ 'Alpha;': '\u0391',
+ 'alpha;': '\u03b1',
+ 'Amacr;': '\u0100',
+ 'amacr;': '\u0101',
+ 'amalg;': '\u2a3f',
+ 'AMP': '&',
+ 'amp': '&',
+ 'AMP;': '&',
+ 'amp;': '&',
+ 'And;': '\u2a53',
+ 'and;': '\u2227',
+ 'andand;': '\u2a55',
+ 'andd;': '\u2a5c',
+ 'andslope;': '\u2a58',
+ 'andv;': '\u2a5a',
+ 'ang;': '\u2220',
+ 'ange;': '\u29a4',
+ 'angle;': '\u2220',
+ 'angmsd;': '\u2221',
+ 'angmsdaa;': '\u29a8',
+ 'angmsdab;': '\u29a9',
+ 'angmsdac;': '\u29aa',
+ 'angmsdad;': '\u29ab',
+ 'angmsdae;': '\u29ac',
+ 'angmsdaf;': '\u29ad',
+ 'angmsdag;': '\u29ae',
+ 'angmsdah;': '\u29af',
+ 'angrt;': '\u221f',
+ 'angrtvb;': '\u22be',
+ 'angrtvbd;': '\u299d',
+ 'angsph;': '\u2222',
+ 'angst;': '\xc5',
+ 'angzarr;': '\u237c',
+ 'Aogon;': '\u0104',
+ 'aogon;': '\u0105',
+ 'Aopf;': '\U0001d538',
+ 'aopf;': '\U0001d552',
+ 'ap;': '\u2248',
+ 'apacir;': '\u2a6f',
+ 'apE;': '\u2a70',
+ 'ape;': '\u224a',
+ 'apid;': '\u224b',
+ 'apos;': "'",
+ 'ApplyFunction;': '\u2061',
+ 'approx;': '\u2248',
+ 'approxeq;': '\u224a',
+ 'Aring': '\xc5',
+ 'aring': '\xe5',
+ 'Aring;': '\xc5',
+ 'aring;': '\xe5',
+ 'Ascr;': '\U0001d49c',
+ 'ascr;': '\U0001d4b6',
+ 'Assign;': '\u2254',
+ 'ast;': '*',
+ 'asymp;': '\u2248',
+ 'asympeq;': '\u224d',
+ 'Atilde': '\xc3',
+ 'atilde': '\xe3',
+ 'Atilde;': '\xc3',
+ 'atilde;': '\xe3',
+ 'Auml': '\xc4',
+ 'auml': '\xe4',
+ 'Auml;': '\xc4',
+ 'auml;': '\xe4',
+ 'awconint;': '\u2233',
+ 'awint;': '\u2a11',
+ 'backcong;': '\u224c',
+ 'backepsilon;': '\u03f6',
+ 'backprime;': '\u2035',
+ 'backsim;': '\u223d',
+ 'backsimeq;': '\u22cd',
+ 'Backslash;': '\u2216',
+ 'Barv;': '\u2ae7',
+ 'barvee;': '\u22bd',
+ 'Barwed;': '\u2306',
+ 'barwed;': '\u2305',
+ 'barwedge;': '\u2305',
+ 'bbrk;': '\u23b5',
+ 'bbrktbrk;': '\u23b6',
+ 'bcong;': '\u224c',
+ 'Bcy;': '\u0411',
+ 'bcy;': '\u0431',
+ 'bdquo;': '\u201e',
+ 'becaus;': '\u2235',
+ 'Because;': '\u2235',
+ 'because;': '\u2235',
+ 'bemptyv;': '\u29b0',
+ 'bepsi;': '\u03f6',
+ 'bernou;': '\u212c',
+ 'Bernoullis;': '\u212c',
+ 'Beta;': '\u0392',
+ 'beta;': '\u03b2',
+ 'beth;': '\u2136',
+ 'between;': '\u226c',
+ 'Bfr;': '\U0001d505',
+ 'bfr;': '\U0001d51f',
+ 'bigcap;': '\u22c2',
+ 'bigcirc;': '\u25ef',
+ 'bigcup;': '\u22c3',
+ 'bigodot;': '\u2a00',
+ 'bigoplus;': '\u2a01',
+ 'bigotimes;': '\u2a02',
+ 'bigsqcup;': '\u2a06',
+ 'bigstar;': '\u2605',
+ 'bigtriangledown;': '\u25bd',
+ 'bigtriangleup;': '\u25b3',
+ 'biguplus;': '\u2a04',
+ 'bigvee;': '\u22c1',
+ 'bigwedge;': '\u22c0',
+ 'bkarow;': '\u290d',
+ 'blacklozenge;': '\u29eb',
+ 'blacksquare;': '\u25aa',
+ 'blacktriangle;': '\u25b4',
+ 'blacktriangledown;': '\u25be',
+ 'blacktriangleleft;': '\u25c2',
+ 'blacktriangleright;': '\u25b8',
+ 'blank;': '\u2423',
+ 'blk12;': '\u2592',
+ 'blk14;': '\u2591',
+ 'blk34;': '\u2593',
+ 'block;': '\u2588',
+ 'bne;': '=\u20e5',
+ 'bnequiv;': '\u2261\u20e5',
+ 'bNot;': '\u2aed',
+ 'bnot;': '\u2310',
+ 'Bopf;': '\U0001d539',
+ 'bopf;': '\U0001d553',
+ 'bot;': '\u22a5',
+ 'bottom;': '\u22a5',
+ 'bowtie;': '\u22c8',
+ 'boxbox;': '\u29c9',
+ 'boxDL;': '\u2557',
+ 'boxDl;': '\u2556',
+ 'boxdL;': '\u2555',
+ 'boxdl;': '\u2510',
+ 'boxDR;': '\u2554',
+ 'boxDr;': '\u2553',
+ 'boxdR;': '\u2552',
+ 'boxdr;': '\u250c',
+ 'boxH;': '\u2550',
+ 'boxh;': '\u2500',
+ 'boxHD;': '\u2566',
+ 'boxHd;': '\u2564',
+ 'boxhD;': '\u2565',
+ 'boxhd;': '\u252c',
+ 'boxHU;': '\u2569',
+ 'boxHu;': '\u2567',
+ 'boxhU;': '\u2568',
+ 'boxhu;': '\u2534',
+ 'boxminus;': '\u229f',
+ 'boxplus;': '\u229e',
+ 'boxtimes;': '\u22a0',
+ 'boxUL;': '\u255d',
+ 'boxUl;': '\u255c',
+ 'boxuL;': '\u255b',
+ 'boxul;': '\u2518',
+ 'boxUR;': '\u255a',
+ 'boxUr;': '\u2559',
+ 'boxuR;': '\u2558',
+ 'boxur;': '\u2514',
+ 'boxV;': '\u2551',
+ 'boxv;': '\u2502',
+ 'boxVH;': '\u256c',
+ 'boxVh;': '\u256b',
+ 'boxvH;': '\u256a',
+ 'boxvh;': '\u253c',
+ 'boxVL;': '\u2563',
+ 'boxVl;': '\u2562',
+ 'boxvL;': '\u2561',
+ 'boxvl;': '\u2524',
+ 'boxVR;': '\u2560',
+ 'boxVr;': '\u255f',
+ 'boxvR;': '\u255e',
+ 'boxvr;': '\u251c',
+ 'bprime;': '\u2035',
+ 'Breve;': '\u02d8',
+ 'breve;': '\u02d8',
+ 'brvbar': '\xa6',
+ 'brvbar;': '\xa6',
+ 'Bscr;': '\u212c',
+ 'bscr;': '\U0001d4b7',
+ 'bsemi;': '\u204f',
+ 'bsim;': '\u223d',
+ 'bsime;': '\u22cd',
+ 'bsol;': '\\',
+ 'bsolb;': '\u29c5',
+ 'bsolhsub;': '\u27c8',
+ 'bull;': '\u2022',
+ 'bullet;': '\u2022',
+ 'bump;': '\u224e',
+ 'bumpE;': '\u2aae',
+ 'bumpe;': '\u224f',
+ 'Bumpeq;': '\u224e',
+ 'bumpeq;': '\u224f',
+ 'Cacute;': '\u0106',
+ 'cacute;': '\u0107',
+ 'Cap;': '\u22d2',
+ 'cap;': '\u2229',
+ 'capand;': '\u2a44',
+ 'capbrcup;': '\u2a49',
+ 'capcap;': '\u2a4b',
+ 'capcup;': '\u2a47',
+ 'capdot;': '\u2a40',
+ 'CapitalDifferentialD;': '\u2145',
+ 'caps;': '\u2229\ufe00',
+ 'caret;': '\u2041',
+ 'caron;': '\u02c7',
+ 'Cayleys;': '\u212d',
+ 'ccaps;': '\u2a4d',
+ 'Ccaron;': '\u010c',
+ 'ccaron;': '\u010d',
+ 'Ccedil': '\xc7',
+ 'ccedil': '\xe7',
+ 'Ccedil;': '\xc7',
+ 'ccedil;': '\xe7',
+ 'Ccirc;': '\u0108',
+ 'ccirc;': '\u0109',
+ 'Cconint;': '\u2230',
+ 'ccups;': '\u2a4c',
+ 'ccupssm;': '\u2a50',
+ 'Cdot;': '\u010a',
+ 'cdot;': '\u010b',
+ 'cedil': '\xb8',
+ 'cedil;': '\xb8',
+ 'Cedilla;': '\xb8',
+ 'cemptyv;': '\u29b2',
+ 'cent': '\xa2',
+ 'cent;': '\xa2',
+ 'CenterDot;': '\xb7',
+ 'centerdot;': '\xb7',
+ 'Cfr;': '\u212d',
+ 'cfr;': '\U0001d520',
+ 'CHcy;': '\u0427',
+ 'chcy;': '\u0447',
+ 'check;': '\u2713',
+ 'checkmark;': '\u2713',
+ 'Chi;': '\u03a7',
+ 'chi;': '\u03c7',
+ 'cir;': '\u25cb',
+ 'circ;': '\u02c6',
+ 'circeq;': '\u2257',
+ 'circlearrowleft;': '\u21ba',
+ 'circlearrowright;': '\u21bb',
+ 'circledast;': '\u229b',
+ 'circledcirc;': '\u229a',
+ 'circleddash;': '\u229d',
+ 'CircleDot;': '\u2299',
+ 'circledR;': '\xae',
+ 'circledS;': '\u24c8',
+ 'CircleMinus;': '\u2296',
+ 'CirclePlus;': '\u2295',
+ 'CircleTimes;': '\u2297',
+ 'cirE;': '\u29c3',
+ 'cire;': '\u2257',
+ 'cirfnint;': '\u2a10',
+ 'cirmid;': '\u2aef',
+ 'cirscir;': '\u29c2',
+ 'ClockwiseContourIntegral;': '\u2232',
+ 'CloseCurlyDoubleQuote;': '\u201d',
+ 'CloseCurlyQuote;': '\u2019',
+ 'clubs;': '\u2663',
+ 'clubsuit;': '\u2663',
+ 'Colon;': '\u2237',
+ 'colon;': ':',
+ 'Colone;': '\u2a74',
+ 'colone;': '\u2254',
+ 'coloneq;': '\u2254',
+ 'comma;': ',',
+ 'commat;': '@',
+ 'comp;': '\u2201',
+ 'compfn;': '\u2218',
+ 'complement;': '\u2201',
+ 'complexes;': '\u2102',
+ 'cong;': '\u2245',
+ 'congdot;': '\u2a6d',
+ 'Congruent;': '\u2261',
+ 'Conint;': '\u222f',
+ 'conint;': '\u222e',
+ 'ContourIntegral;': '\u222e',
+ 'Copf;': '\u2102',
+ 'copf;': '\U0001d554',
+ 'coprod;': '\u2210',
+ 'Coproduct;': '\u2210',
+ 'COPY': '\xa9',
+ 'copy': '\xa9',
+ 'COPY;': '\xa9',
+ 'copy;': '\xa9',
+ 'copysr;': '\u2117',
+ 'CounterClockwiseContourIntegral;': '\u2233',
+ 'crarr;': '\u21b5',
+ 'Cross;': '\u2a2f',
+ 'cross;': '\u2717',
+ 'Cscr;': '\U0001d49e',
+ 'cscr;': '\U0001d4b8',
+ 'csub;': '\u2acf',
+ 'csube;': '\u2ad1',
+ 'csup;': '\u2ad0',
+ 'csupe;': '\u2ad2',
+ 'ctdot;': '\u22ef',
+ 'cudarrl;': '\u2938',
+ 'cudarrr;': '\u2935',
+ 'cuepr;': '\u22de',
+ 'cuesc;': '\u22df',
+ 'cularr;': '\u21b6',
+ 'cularrp;': '\u293d',
+ 'Cup;': '\u22d3',
+ 'cup;': '\u222a',
+ 'cupbrcap;': '\u2a48',
+ 'CupCap;': '\u224d',
+ 'cupcap;': '\u2a46',
+ 'cupcup;': '\u2a4a',
+ 'cupdot;': '\u228d',
+ 'cupor;': '\u2a45',
+ 'cups;': '\u222a\ufe00',
+ 'curarr;': '\u21b7',
+ 'curarrm;': '\u293c',
+ 'curlyeqprec;': '\u22de',
+ 'curlyeqsucc;': '\u22df',
+ 'curlyvee;': '\u22ce',
+ 'curlywedge;': '\u22cf',
+ 'curren': '\xa4',
+ 'curren;': '\xa4',
+ 'curvearrowleft;': '\u21b6',
+ 'curvearrowright;': '\u21b7',
+ 'cuvee;': '\u22ce',
+ 'cuwed;': '\u22cf',
+ 'cwconint;': '\u2232',
+ 'cwint;': '\u2231',
+ 'cylcty;': '\u232d',
+ 'Dagger;': '\u2021',
+ 'dagger;': '\u2020',
+ 'daleth;': '\u2138',
+ 'Darr;': '\u21a1',
+ 'dArr;': '\u21d3',
+ 'darr;': '\u2193',
+ 'dash;': '\u2010',
+ 'Dashv;': '\u2ae4',
+ 'dashv;': '\u22a3',
+ 'dbkarow;': '\u290f',
+ 'dblac;': '\u02dd',
+ 'Dcaron;': '\u010e',
+ 'dcaron;': '\u010f',
+ 'Dcy;': '\u0414',
+ 'dcy;': '\u0434',
+ 'DD;': '\u2145',
+ 'dd;': '\u2146',
+ 'ddagger;': '\u2021',
+ 'ddarr;': '\u21ca',
+ 'DDotrahd;': '\u2911',
+ 'ddotseq;': '\u2a77',
+ 'deg': '\xb0',
+ 'deg;': '\xb0',
+ 'Del;': '\u2207',
+ 'Delta;': '\u0394',
+ 'delta;': '\u03b4',
+ 'demptyv;': '\u29b1',
+ 'dfisht;': '\u297f',
+ 'Dfr;': '\U0001d507',
+ 'dfr;': '\U0001d521',
+ 'dHar;': '\u2965',
+ 'dharl;': '\u21c3',
+ 'dharr;': '\u21c2',
+ 'DiacriticalAcute;': '\xb4',
+ 'DiacriticalDot;': '\u02d9',
+ 'DiacriticalDoubleAcute;': '\u02dd',
+ 'DiacriticalGrave;': '`',
+ 'DiacriticalTilde;': '\u02dc',
+ 'diam;': '\u22c4',
+ 'Diamond;': '\u22c4',
+ 'diamond;': '\u22c4',
+ 'diamondsuit;': '\u2666',
+ 'diams;': '\u2666',
+ 'die;': '\xa8',
+ 'DifferentialD;': '\u2146',
+ 'digamma;': '\u03dd',
+ 'disin;': '\u22f2',
+ 'div;': '\xf7',
+ 'divide': '\xf7',
+ 'divide;': '\xf7',
+ 'divideontimes;': '\u22c7',
+ 'divonx;': '\u22c7',
+ 'DJcy;': '\u0402',
+ 'djcy;': '\u0452',
+ 'dlcorn;': '\u231e',
+ 'dlcrop;': '\u230d',
+ 'dollar;': '$',
+ 'Dopf;': '\U0001d53b',
+ 'dopf;': '\U0001d555',
+ 'Dot;': '\xa8',
+ 'dot;': '\u02d9',
+ 'DotDot;': '\u20dc',
+ 'doteq;': '\u2250',
+ 'doteqdot;': '\u2251',
+ 'DotEqual;': '\u2250',
+ 'dotminus;': '\u2238',
+ 'dotplus;': '\u2214',
+ 'dotsquare;': '\u22a1',
+ 'doublebarwedge;': '\u2306',
+ 'DoubleContourIntegral;': '\u222f',
+ 'DoubleDot;': '\xa8',
+ 'DoubleDownArrow;': '\u21d3',
+ 'DoubleLeftArrow;': '\u21d0',
+ 'DoubleLeftRightArrow;': '\u21d4',
+ 'DoubleLeftTee;': '\u2ae4',
+ 'DoubleLongLeftArrow;': '\u27f8',
+ 'DoubleLongLeftRightArrow;': '\u27fa',
+ 'DoubleLongRightArrow;': '\u27f9',
+ 'DoubleRightArrow;': '\u21d2',
+ 'DoubleRightTee;': '\u22a8',
+ 'DoubleUpArrow;': '\u21d1',
+ 'DoubleUpDownArrow;': '\u21d5',
+ 'DoubleVerticalBar;': '\u2225',
+ 'DownArrow;': '\u2193',
+ 'Downarrow;': '\u21d3',
+ 'downarrow;': '\u2193',
+ 'DownArrowBar;': '\u2913',
+ 'DownArrowUpArrow;': '\u21f5',
+ 'DownBreve;': '\u0311',
+ 'downdownarrows;': '\u21ca',
+ 'downharpoonleft;': '\u21c3',
+ 'downharpoonright;': '\u21c2',
+ 'DownLeftRightVector;': '\u2950',
+ 'DownLeftTeeVector;': '\u295e',
+ 'DownLeftVector;': '\u21bd',
+ 'DownLeftVectorBar;': '\u2956',
+ 'DownRightTeeVector;': '\u295f',
+ 'DownRightVector;': '\u21c1',
+ 'DownRightVectorBar;': '\u2957',
+ 'DownTee;': '\u22a4',
+ 'DownTeeArrow;': '\u21a7',
+ 'drbkarow;': '\u2910',
+ 'drcorn;': '\u231f',
+ 'drcrop;': '\u230c',
+ 'Dscr;': '\U0001d49f',
+ 'dscr;': '\U0001d4b9',
+ 'DScy;': '\u0405',
+ 'dscy;': '\u0455',
+ 'dsol;': '\u29f6',
+ 'Dstrok;': '\u0110',
+ 'dstrok;': '\u0111',
+ 'dtdot;': '\u22f1',
+ 'dtri;': '\u25bf',
+ 'dtrif;': '\u25be',
+ 'duarr;': '\u21f5',
+ 'duhar;': '\u296f',
+ 'dwangle;': '\u29a6',
+ 'DZcy;': '\u040f',
+ 'dzcy;': '\u045f',
+ 'dzigrarr;': '\u27ff',
+ 'Eacute': '\xc9',
+ 'eacute': '\xe9',
+ 'Eacute;': '\xc9',
+ 'eacute;': '\xe9',
+ 'easter;': '\u2a6e',
+ 'Ecaron;': '\u011a',
+ 'ecaron;': '\u011b',
+ 'ecir;': '\u2256',
+ 'Ecirc': '\xca',
+ 'ecirc': '\xea',
+ 'Ecirc;': '\xca',
+ 'ecirc;': '\xea',
+ 'ecolon;': '\u2255',
+ 'Ecy;': '\u042d',
+ 'ecy;': '\u044d',
+ 'eDDot;': '\u2a77',
+ 'Edot;': '\u0116',
+ 'eDot;': '\u2251',
+ 'edot;': '\u0117',
+ 'ee;': '\u2147',
+ 'efDot;': '\u2252',
+ 'Efr;': '\U0001d508',
+ 'efr;': '\U0001d522',
+ 'eg;': '\u2a9a',
+ 'Egrave': '\xc8',
+ 'egrave': '\xe8',
+ 'Egrave;': '\xc8',
+ 'egrave;': '\xe8',
+ 'egs;': '\u2a96',
+ 'egsdot;': '\u2a98',
+ 'el;': '\u2a99',
+ 'Element;': '\u2208',
+ 'elinters;': '\u23e7',
+ 'ell;': '\u2113',
+ 'els;': '\u2a95',
+ 'elsdot;': '\u2a97',
+ 'Emacr;': '\u0112',
+ 'emacr;': '\u0113',
+ 'empty;': '\u2205',
+ 'emptyset;': '\u2205',
+ 'EmptySmallSquare;': '\u25fb',
+ 'emptyv;': '\u2205',
+ 'EmptyVerySmallSquare;': '\u25ab',
+ 'emsp13;': '\u2004',
+ 'emsp14;': '\u2005',
+ 'emsp;': '\u2003',
+ 'ENG;': '\u014a',
+ 'eng;': '\u014b',
+ 'ensp;': '\u2002',
+ 'Eogon;': '\u0118',
+ 'eogon;': '\u0119',
+ 'Eopf;': '\U0001d53c',
+ 'eopf;': '\U0001d556',
+ 'epar;': '\u22d5',
+ 'eparsl;': '\u29e3',
+ 'eplus;': '\u2a71',
+ 'epsi;': '\u03b5',
+ 'Epsilon;': '\u0395',
+ 'epsilon;': '\u03b5',
+ 'epsiv;': '\u03f5',
+ 'eqcirc;': '\u2256',
+ 'eqcolon;': '\u2255',
+ 'eqsim;': '\u2242',
+ 'eqslantgtr;': '\u2a96',
+ 'eqslantless;': '\u2a95',
+ 'Equal;': '\u2a75',
+ 'equals;': '=',
+ 'EqualTilde;': '\u2242',
+ 'equest;': '\u225f',
+ 'Equilibrium;': '\u21cc',
+ 'equiv;': '\u2261',
+ 'equivDD;': '\u2a78',
+ 'eqvparsl;': '\u29e5',
+ 'erarr;': '\u2971',
+ 'erDot;': '\u2253',
+ 'Escr;': '\u2130',
+ 'escr;': '\u212f',
+ 'esdot;': '\u2250',
+ 'Esim;': '\u2a73',
+ 'esim;': '\u2242',
+ 'Eta;': '\u0397',
+ 'eta;': '\u03b7',
+ 'ETH': '\xd0',
+ 'eth': '\xf0',
+ 'ETH;': '\xd0',
+ 'eth;': '\xf0',
+ 'Euml': '\xcb',
+ 'euml': '\xeb',
+ 'Euml;': '\xcb',
+ 'euml;': '\xeb',
+ 'euro;': '\u20ac',
+ 'excl;': '!',
+ 'exist;': '\u2203',
+ 'Exists;': '\u2203',
+ 'expectation;': '\u2130',
+ 'ExponentialE;': '\u2147',
+ 'exponentiale;': '\u2147',
+ 'fallingdotseq;': '\u2252',
+ 'Fcy;': '\u0424',
+ 'fcy;': '\u0444',
+ 'female;': '\u2640',
+ 'ffilig;': '\ufb03',
+ 'fflig;': '\ufb00',
+ 'ffllig;': '\ufb04',
+ 'Ffr;': '\U0001d509',
+ 'ffr;': '\U0001d523',
+ 'filig;': '\ufb01',
+ 'FilledSmallSquare;': '\u25fc',
+ 'FilledVerySmallSquare;': '\u25aa',
+ 'fjlig;': 'fj',
+ 'flat;': '\u266d',
+ 'fllig;': '\ufb02',
+ 'fltns;': '\u25b1',
+ 'fnof;': '\u0192',
+ 'Fopf;': '\U0001d53d',
+ 'fopf;': '\U0001d557',
+ 'ForAll;': '\u2200',
+ 'forall;': '\u2200',
+ 'fork;': '\u22d4',
+ 'forkv;': '\u2ad9',
+ 'Fouriertrf;': '\u2131',
+ 'fpartint;': '\u2a0d',
+ 'frac12': '\xbd',
+ 'frac12;': '\xbd',
+ 'frac13;': '\u2153',
+ 'frac14': '\xbc',
+ 'frac14;': '\xbc',
+ 'frac15;': '\u2155',
+ 'frac16;': '\u2159',
+ 'frac18;': '\u215b',
+ 'frac23;': '\u2154',
+ 'frac25;': '\u2156',
+ 'frac34': '\xbe',
+ 'frac34;': '\xbe',
+ 'frac35;': '\u2157',
+ 'frac38;': '\u215c',
+ 'frac45;': '\u2158',
+ 'frac56;': '\u215a',
+ 'frac58;': '\u215d',
+ 'frac78;': '\u215e',
+ 'frasl;': '\u2044',
+ 'frown;': '\u2322',
+ 'Fscr;': '\u2131',
+ 'fscr;': '\U0001d4bb',
+ 'gacute;': '\u01f5',
+ 'Gamma;': '\u0393',
+ 'gamma;': '\u03b3',
+ 'Gammad;': '\u03dc',
+ 'gammad;': '\u03dd',
+ 'gap;': '\u2a86',
+ 'Gbreve;': '\u011e',
+ 'gbreve;': '\u011f',
+ 'Gcedil;': '\u0122',
+ 'Gcirc;': '\u011c',
+ 'gcirc;': '\u011d',
+ 'Gcy;': '\u0413',
+ 'gcy;': '\u0433',
+ 'Gdot;': '\u0120',
+ 'gdot;': '\u0121',
+ 'gE;': '\u2267',
+ 'ge;': '\u2265',
+ 'gEl;': '\u2a8c',
+ 'gel;': '\u22db',
+ 'geq;': '\u2265',
+ 'geqq;': '\u2267',
+ 'geqslant;': '\u2a7e',
+ 'ges;': '\u2a7e',
+ 'gescc;': '\u2aa9',
+ 'gesdot;': '\u2a80',
+ 'gesdoto;': '\u2a82',
+ 'gesdotol;': '\u2a84',
+ 'gesl;': '\u22db\ufe00',
+ 'gesles;': '\u2a94',
+ 'Gfr;': '\U0001d50a',
+ 'gfr;': '\U0001d524',
+ 'Gg;': '\u22d9',
+ 'gg;': '\u226b',
+ 'ggg;': '\u22d9',
+ 'gimel;': '\u2137',
+ 'GJcy;': '\u0403',
+ 'gjcy;': '\u0453',
+ 'gl;': '\u2277',
+ 'gla;': '\u2aa5',
+ 'glE;': '\u2a92',
+ 'glj;': '\u2aa4',
+ 'gnap;': '\u2a8a',
+ 'gnapprox;': '\u2a8a',
+ 'gnE;': '\u2269',
+ 'gne;': '\u2a88',
+ 'gneq;': '\u2a88',
+ 'gneqq;': '\u2269',
+ 'gnsim;': '\u22e7',
+ 'Gopf;': '\U0001d53e',
+ 'gopf;': '\U0001d558',
+ 'grave;': '`',
+ 'GreaterEqual;': '\u2265',
+ 'GreaterEqualLess;': '\u22db',
+ 'GreaterFullEqual;': '\u2267',
+ 'GreaterGreater;': '\u2aa2',
+ 'GreaterLess;': '\u2277',
+ 'GreaterSlantEqual;': '\u2a7e',
+ 'GreaterTilde;': '\u2273',
+ 'Gscr;': '\U0001d4a2',
+ 'gscr;': '\u210a',
+ 'gsim;': '\u2273',
+ 'gsime;': '\u2a8e',
+ 'gsiml;': '\u2a90',
+ 'GT': '>',
+ 'gt': '>',
+ 'GT;': '>',
+ 'Gt;': '\u226b',
+ 'gt;': '>',
+ 'gtcc;': '\u2aa7',
+ 'gtcir;': '\u2a7a',
+ 'gtdot;': '\u22d7',
+ 'gtlPar;': '\u2995',
+ 'gtquest;': '\u2a7c',
+ 'gtrapprox;': '\u2a86',
+ 'gtrarr;': '\u2978',
+ 'gtrdot;': '\u22d7',
+ 'gtreqless;': '\u22db',
+ 'gtreqqless;': '\u2a8c',
+ 'gtrless;': '\u2277',
+ 'gtrsim;': '\u2273',
+ 'gvertneqq;': '\u2269\ufe00',
+ 'gvnE;': '\u2269\ufe00',
+ 'Hacek;': '\u02c7',
+ 'hairsp;': '\u200a',
+ 'half;': '\xbd',
+ 'hamilt;': '\u210b',
+ 'HARDcy;': '\u042a',
+ 'hardcy;': '\u044a',
+ 'hArr;': '\u21d4',
+ 'harr;': '\u2194',
+ 'harrcir;': '\u2948',
+ 'harrw;': '\u21ad',
+ 'Hat;': '^',
+ 'hbar;': '\u210f',
+ 'Hcirc;': '\u0124',
+ 'hcirc;': '\u0125',
+ 'hearts;': '\u2665',
+ 'heartsuit;': '\u2665',
+ 'hellip;': '\u2026',
+ 'hercon;': '\u22b9',
+ 'Hfr;': '\u210c',
+ 'hfr;': '\U0001d525',
+ 'HilbertSpace;': '\u210b',
+ 'hksearow;': '\u2925',
+ 'hkswarow;': '\u2926',
+ 'hoarr;': '\u21ff',
+ 'homtht;': '\u223b',
+ 'hookleftarrow;': '\u21a9',
+ 'hookrightarrow;': '\u21aa',
+ 'Hopf;': '\u210d',
+ 'hopf;': '\U0001d559',
+ 'horbar;': '\u2015',
+ 'HorizontalLine;': '\u2500',
+ 'Hscr;': '\u210b',
+ 'hscr;': '\U0001d4bd',
+ 'hslash;': '\u210f',
+ 'Hstrok;': '\u0126',
+ 'hstrok;': '\u0127',
+ 'HumpDownHump;': '\u224e',
+ 'HumpEqual;': '\u224f',
+ 'hybull;': '\u2043',
+ 'hyphen;': '\u2010',
+ 'Iacute': '\xcd',
+ 'iacute': '\xed',
+ 'Iacute;': '\xcd',
+ 'iacute;': '\xed',
+ 'ic;': '\u2063',
+ 'Icirc': '\xce',
+ 'icirc': '\xee',
+ 'Icirc;': '\xce',
+ 'icirc;': '\xee',
+ 'Icy;': '\u0418',
+ 'icy;': '\u0438',
+ 'Idot;': '\u0130',
+ 'IEcy;': '\u0415',
+ 'iecy;': '\u0435',
+ 'iexcl': '\xa1',
+ 'iexcl;': '\xa1',
+ 'iff;': '\u21d4',
+ 'Ifr;': '\u2111',
+ 'ifr;': '\U0001d526',
+ 'Igrave': '\xcc',
+ 'igrave': '\xec',
+ 'Igrave;': '\xcc',
+ 'igrave;': '\xec',
+ 'ii;': '\u2148',
+ 'iiiint;': '\u2a0c',
+ 'iiint;': '\u222d',
+ 'iinfin;': '\u29dc',
+ 'iiota;': '\u2129',
+ 'IJlig;': '\u0132',
+ 'ijlig;': '\u0133',
+ 'Im;': '\u2111',
+ 'Imacr;': '\u012a',
+ 'imacr;': '\u012b',
+ 'image;': '\u2111',
+ 'ImaginaryI;': '\u2148',
+ 'imagline;': '\u2110',
+ 'imagpart;': '\u2111',
+ 'imath;': '\u0131',
+ 'imof;': '\u22b7',
+ 'imped;': '\u01b5',
+ 'Implies;': '\u21d2',
+ 'in;': '\u2208',
+ 'incare;': '\u2105',
+ 'infin;': '\u221e',
+ 'infintie;': '\u29dd',
+ 'inodot;': '\u0131',
+ 'Int;': '\u222c',
+ 'int;': '\u222b',
+ 'intcal;': '\u22ba',
+ 'integers;': '\u2124',
+ 'Integral;': '\u222b',
+ 'intercal;': '\u22ba',
+ 'Intersection;': '\u22c2',
+ 'intlarhk;': '\u2a17',
+ 'intprod;': '\u2a3c',
+ 'InvisibleComma;': '\u2063',
+ 'InvisibleTimes;': '\u2062',
+ 'IOcy;': '\u0401',
+ 'iocy;': '\u0451',
+ 'Iogon;': '\u012e',
+ 'iogon;': '\u012f',
+ 'Iopf;': '\U0001d540',
+ 'iopf;': '\U0001d55a',
+ 'Iota;': '\u0399',
+ 'iota;': '\u03b9',
+ 'iprod;': '\u2a3c',
+ 'iquest': '\xbf',
+ 'iquest;': '\xbf',
+ 'Iscr;': '\u2110',
+ 'iscr;': '\U0001d4be',
+ 'isin;': '\u2208',
+ 'isindot;': '\u22f5',
+ 'isinE;': '\u22f9',
+ 'isins;': '\u22f4',
+ 'isinsv;': '\u22f3',
+ 'isinv;': '\u2208',
+ 'it;': '\u2062',
+ 'Itilde;': '\u0128',
+ 'itilde;': '\u0129',
+ 'Iukcy;': '\u0406',
+ 'iukcy;': '\u0456',
+ 'Iuml': '\xcf',
+ 'iuml': '\xef',
+ 'Iuml;': '\xcf',
+ 'iuml;': '\xef',
+ 'Jcirc;': '\u0134',
+ 'jcirc;': '\u0135',
+ 'Jcy;': '\u0419',
+ 'jcy;': '\u0439',
+ 'Jfr;': '\U0001d50d',
+ 'jfr;': '\U0001d527',
+ 'jmath;': '\u0237',
+ 'Jopf;': '\U0001d541',
+ 'jopf;': '\U0001d55b',
+ 'Jscr;': '\U0001d4a5',
+ 'jscr;': '\U0001d4bf',
+ 'Jsercy;': '\u0408',
+ 'jsercy;': '\u0458',
+ 'Jukcy;': '\u0404',
+ 'jukcy;': '\u0454',
+ 'Kappa;': '\u039a',
+ 'kappa;': '\u03ba',
+ 'kappav;': '\u03f0',
+ 'Kcedil;': '\u0136',
+ 'kcedil;': '\u0137',
+ 'Kcy;': '\u041a',
+ 'kcy;': '\u043a',
+ 'Kfr;': '\U0001d50e',
+ 'kfr;': '\U0001d528',
+ 'kgreen;': '\u0138',
+ 'KHcy;': '\u0425',
+ 'khcy;': '\u0445',
+ 'KJcy;': '\u040c',
+ 'kjcy;': '\u045c',
+ 'Kopf;': '\U0001d542',
+ 'kopf;': '\U0001d55c',
+ 'Kscr;': '\U0001d4a6',
+ 'kscr;': '\U0001d4c0',
+ 'lAarr;': '\u21da',
+ 'Lacute;': '\u0139',
+ 'lacute;': '\u013a',
+ 'laemptyv;': '\u29b4',
+ 'lagran;': '\u2112',
+ 'Lambda;': '\u039b',
+ 'lambda;': '\u03bb',
+ 'Lang;': '\u27ea',
+ 'lang;': '\u27e8',
+ 'langd;': '\u2991',
+ 'langle;': '\u27e8',
+ 'lap;': '\u2a85',
+ 'Laplacetrf;': '\u2112',
+ 'laquo': '\xab',
+ 'laquo;': '\xab',
+ 'Larr;': '\u219e',
+ 'lArr;': '\u21d0',
+ 'larr;': '\u2190',
+ 'larrb;': '\u21e4',
+ 'larrbfs;': '\u291f',
+ 'larrfs;': '\u291d',
+ 'larrhk;': '\u21a9',
+ 'larrlp;': '\u21ab',
+ 'larrpl;': '\u2939',
+ 'larrsim;': '\u2973',
+ 'larrtl;': '\u21a2',
+ 'lat;': '\u2aab',
+ 'lAtail;': '\u291b',
+ 'latail;': '\u2919',
+ 'late;': '\u2aad',
+ 'lates;': '\u2aad\ufe00',
+ 'lBarr;': '\u290e',
+ 'lbarr;': '\u290c',
+ 'lbbrk;': '\u2772',
+ 'lbrace;': '{',
+ 'lbrack;': '[',
+ 'lbrke;': '\u298b',
+ 'lbrksld;': '\u298f',
+ 'lbrkslu;': '\u298d',
+ 'Lcaron;': '\u013d',
+ 'lcaron;': '\u013e',
+ 'Lcedil;': '\u013b',
+ 'lcedil;': '\u013c',
+ 'lceil;': '\u2308',
+ 'lcub;': '{',
+ 'Lcy;': '\u041b',
+ 'lcy;': '\u043b',
+ 'ldca;': '\u2936',
+ 'ldquo;': '\u201c',
+ 'ldquor;': '\u201e',
+ 'ldrdhar;': '\u2967',
+ 'ldrushar;': '\u294b',
+ 'ldsh;': '\u21b2',
+ 'lE;': '\u2266',
+ 'le;': '\u2264',
+ 'LeftAngleBracket;': '\u27e8',
+ 'LeftArrow;': '\u2190',
+ 'Leftarrow;': '\u21d0',
+ 'leftarrow;': '\u2190',
+ 'LeftArrowBar;': '\u21e4',
+ 'LeftArrowRightArrow;': '\u21c6',
+ 'leftarrowtail;': '\u21a2',
+ 'LeftCeiling;': '\u2308',
+ 'LeftDoubleBracket;': '\u27e6',
+ 'LeftDownTeeVector;': '\u2961',
+ 'LeftDownVector;': '\u21c3',
+ 'LeftDownVectorBar;': '\u2959',
+ 'LeftFloor;': '\u230a',
+ 'leftharpoondown;': '\u21bd',
+ 'leftharpoonup;': '\u21bc',
+ 'leftleftarrows;': '\u21c7',
+ 'LeftRightArrow;': '\u2194',
+ 'Leftrightarrow;': '\u21d4',
+ 'leftrightarrow;': '\u2194',
+ 'leftrightarrows;': '\u21c6',
+ 'leftrightharpoons;': '\u21cb',
+ 'leftrightsquigarrow;': '\u21ad',
+ 'LeftRightVector;': '\u294e',
+ 'LeftTee;': '\u22a3',
+ 'LeftTeeArrow;': '\u21a4',
+ 'LeftTeeVector;': '\u295a',
+ 'leftthreetimes;': '\u22cb',
+ 'LeftTriangle;': '\u22b2',
+ 'LeftTriangleBar;': '\u29cf',
+ 'LeftTriangleEqual;': '\u22b4',
+ 'LeftUpDownVector;': '\u2951',
+ 'LeftUpTeeVector;': '\u2960',
+ 'LeftUpVector;': '\u21bf',
+ 'LeftUpVectorBar;': '\u2958',
+ 'LeftVector;': '\u21bc',
+ 'LeftVectorBar;': '\u2952',
+ 'lEg;': '\u2a8b',
+ 'leg;': '\u22da',
+ 'leq;': '\u2264',
+ 'leqq;': '\u2266',
+ 'leqslant;': '\u2a7d',
+ 'les;': '\u2a7d',
+ 'lescc;': '\u2aa8',
+ 'lesdot;': '\u2a7f',
+ 'lesdoto;': '\u2a81',
+ 'lesdotor;': '\u2a83',
+ 'lesg;': '\u22da\ufe00',
+ 'lesges;': '\u2a93',
+ 'lessapprox;': '\u2a85',
+ 'lessdot;': '\u22d6',
+ 'lesseqgtr;': '\u22da',
+ 'lesseqqgtr;': '\u2a8b',
+ 'LessEqualGreater;': '\u22da',
+ 'LessFullEqual;': '\u2266',
+ 'LessGreater;': '\u2276',
+ 'lessgtr;': '\u2276',
+ 'LessLess;': '\u2aa1',
+ 'lesssim;': '\u2272',
+ 'LessSlantEqual;': '\u2a7d',
+ 'LessTilde;': '\u2272',
+ 'lfisht;': '\u297c',
+ 'lfloor;': '\u230a',
+ 'Lfr;': '\U0001d50f',
+ 'lfr;': '\U0001d529',
+ 'lg;': '\u2276',
+ 'lgE;': '\u2a91',
+ 'lHar;': '\u2962',
+ 'lhard;': '\u21bd',
+ 'lharu;': '\u21bc',
+ 'lharul;': '\u296a',
+ 'lhblk;': '\u2584',
+ 'LJcy;': '\u0409',
+ 'ljcy;': '\u0459',
+ 'Ll;': '\u22d8',
+ 'll;': '\u226a',
+ 'llarr;': '\u21c7',
+ 'llcorner;': '\u231e',
+ 'Lleftarrow;': '\u21da',
+ 'llhard;': '\u296b',
+ 'lltri;': '\u25fa',
+ 'Lmidot;': '\u013f',
+ 'lmidot;': '\u0140',
+ 'lmoust;': '\u23b0',
+ 'lmoustache;': '\u23b0',
+ 'lnap;': '\u2a89',
+ 'lnapprox;': '\u2a89',
+ 'lnE;': '\u2268',
+ 'lne;': '\u2a87',
+ 'lneq;': '\u2a87',
+ 'lneqq;': '\u2268',
+ 'lnsim;': '\u22e6',
+ 'loang;': '\u27ec',
+ 'loarr;': '\u21fd',
+ 'lobrk;': '\u27e6',
+ 'LongLeftArrow;': '\u27f5',
+ 'Longleftarrow;': '\u27f8',
+ 'longleftarrow;': '\u27f5',
+ 'LongLeftRightArrow;': '\u27f7',
+ 'Longleftrightarrow;': '\u27fa',
+ 'longleftrightarrow;': '\u27f7',
+ 'longmapsto;': '\u27fc',
+ 'LongRightArrow;': '\u27f6',
+ 'Longrightarrow;': '\u27f9',
+ 'longrightarrow;': '\u27f6',
+ 'looparrowleft;': '\u21ab',
+ 'looparrowright;': '\u21ac',
+ 'lopar;': '\u2985',
+ 'Lopf;': '\U0001d543',
+ 'lopf;': '\U0001d55d',
+ 'loplus;': '\u2a2d',
+ 'lotimes;': '\u2a34',
+ 'lowast;': '\u2217',
+ 'lowbar;': '_',
+ 'LowerLeftArrow;': '\u2199',
+ 'LowerRightArrow;': '\u2198',
+ 'loz;': '\u25ca',
+ 'lozenge;': '\u25ca',
+ 'lozf;': '\u29eb',
+ 'lpar;': '(',
+ 'lparlt;': '\u2993',
+ 'lrarr;': '\u21c6',
+ 'lrcorner;': '\u231f',
+ 'lrhar;': '\u21cb',
+ 'lrhard;': '\u296d',
+ 'lrm;': '\u200e',
+ 'lrtri;': '\u22bf',
+ 'lsaquo;': '\u2039',
+ 'Lscr;': '\u2112',
+ 'lscr;': '\U0001d4c1',
+ 'Lsh;': '\u21b0',
+ 'lsh;': '\u21b0',
+ 'lsim;': '\u2272',
+ 'lsime;': '\u2a8d',
+ 'lsimg;': '\u2a8f',
+ 'lsqb;': '[',
+ 'lsquo;': '\u2018',
+ 'lsquor;': '\u201a',
+ 'Lstrok;': '\u0141',
+ 'lstrok;': '\u0142',
+ 'LT': '<',
+ 'lt': '<',
+ 'LT;': '<',
+ 'Lt;': '\u226a',
+ 'lt;': '<',
+ 'ltcc;': '\u2aa6',
+ 'ltcir;': '\u2a79',
+ 'ltdot;': '\u22d6',
+ 'lthree;': '\u22cb',
+ 'ltimes;': '\u22c9',
+ 'ltlarr;': '\u2976',
+ 'ltquest;': '\u2a7b',
+ 'ltri;': '\u25c3',
+ 'ltrie;': '\u22b4',
+ 'ltrif;': '\u25c2',
+ 'ltrPar;': '\u2996',
+ 'lurdshar;': '\u294a',
+ 'luruhar;': '\u2966',
+ 'lvertneqq;': '\u2268\ufe00',
+ 'lvnE;': '\u2268\ufe00',
+ 'macr': '\xaf',
+ 'macr;': '\xaf',
+ 'male;': '\u2642',
+ 'malt;': '\u2720',
+ 'maltese;': '\u2720',
+ 'Map;': '\u2905',
+ 'map;': '\u21a6',
+ 'mapsto;': '\u21a6',
+ 'mapstodown;': '\u21a7',
+ 'mapstoleft;': '\u21a4',
+ 'mapstoup;': '\u21a5',
+ 'marker;': '\u25ae',
+ 'mcomma;': '\u2a29',
+ 'Mcy;': '\u041c',
+ 'mcy;': '\u043c',
+ 'mdash;': '\u2014',
+ 'mDDot;': '\u223a',
+ 'measuredangle;': '\u2221',
+ 'MediumSpace;': '\u205f',
+ 'Mellintrf;': '\u2133',
+ 'Mfr;': '\U0001d510',
+ 'mfr;': '\U0001d52a',
+ 'mho;': '\u2127',
+ 'micro': '\xb5',
+ 'micro;': '\xb5',
+ 'mid;': '\u2223',
+ 'midast;': '*',
+ 'midcir;': '\u2af0',
+ 'middot': '\xb7',
+ 'middot;': '\xb7',
+ 'minus;': '\u2212',
+ 'minusb;': '\u229f',
+ 'minusd;': '\u2238',
+ 'minusdu;': '\u2a2a',
+ 'MinusPlus;': '\u2213',
+ 'mlcp;': '\u2adb',
+ 'mldr;': '\u2026',
+ 'mnplus;': '\u2213',
+ 'models;': '\u22a7',
+ 'Mopf;': '\U0001d544',
+ 'mopf;': '\U0001d55e',
+ 'mp;': '\u2213',
+ 'Mscr;': '\u2133',
+ 'mscr;': '\U0001d4c2',
+ 'mstpos;': '\u223e',
+ 'Mu;': '\u039c',
+ 'mu;': '\u03bc',
+ 'multimap;': '\u22b8',
+ 'mumap;': '\u22b8',
+ 'nabla;': '\u2207',
+ 'Nacute;': '\u0143',
+ 'nacute;': '\u0144',
+ 'nang;': '\u2220\u20d2',
+ 'nap;': '\u2249',
+ 'napE;': '\u2a70\u0338',
+ 'napid;': '\u224b\u0338',
+ 'napos;': '\u0149',
+ 'napprox;': '\u2249',
+ 'natur;': '\u266e',
+ 'natural;': '\u266e',
+ 'naturals;': '\u2115',
+ 'nbsp': '\xa0',
+ 'nbsp;': '\xa0',
+ 'nbump;': '\u224e\u0338',
+ 'nbumpe;': '\u224f\u0338',
+ 'ncap;': '\u2a43',
+ 'Ncaron;': '\u0147',
+ 'ncaron;': '\u0148',
+ 'Ncedil;': '\u0145',
+ 'ncedil;': '\u0146',
+ 'ncong;': '\u2247',
+ 'ncongdot;': '\u2a6d\u0338',
+ 'ncup;': '\u2a42',
+ 'Ncy;': '\u041d',
+ 'ncy;': '\u043d',
+ 'ndash;': '\u2013',
+ 'ne;': '\u2260',
+ 'nearhk;': '\u2924',
+ 'neArr;': '\u21d7',
+ 'nearr;': '\u2197',
+ 'nearrow;': '\u2197',
+ 'nedot;': '\u2250\u0338',
+ 'NegativeMediumSpace;': '\u200b',
+ 'NegativeThickSpace;': '\u200b',
+ 'NegativeThinSpace;': '\u200b',
+ 'NegativeVeryThinSpace;': '\u200b',
+ 'nequiv;': '\u2262',
+ 'nesear;': '\u2928',
+ 'nesim;': '\u2242\u0338',
+ 'NestedGreaterGreater;': '\u226b',
+ 'NestedLessLess;': '\u226a',
+ 'NewLine;': '\n',
+ 'nexist;': '\u2204',
+ 'nexists;': '\u2204',
+ 'Nfr;': '\U0001d511',
+ 'nfr;': '\U0001d52b',
+ 'ngE;': '\u2267\u0338',
+ 'nge;': '\u2271',
+ 'ngeq;': '\u2271',
+ 'ngeqq;': '\u2267\u0338',
+ 'ngeqslant;': '\u2a7e\u0338',
+ 'nges;': '\u2a7e\u0338',
+ 'nGg;': '\u22d9\u0338',
+ 'ngsim;': '\u2275',
+ 'nGt;': '\u226b\u20d2',
+ 'ngt;': '\u226f',
+ 'ngtr;': '\u226f',
+ 'nGtv;': '\u226b\u0338',
+ 'nhArr;': '\u21ce',
+ 'nharr;': '\u21ae',
+ 'nhpar;': '\u2af2',
+ 'ni;': '\u220b',
+ 'nis;': '\u22fc',
+ 'nisd;': '\u22fa',
+ 'niv;': '\u220b',
+ 'NJcy;': '\u040a',
+ 'njcy;': '\u045a',
+ 'nlArr;': '\u21cd',
+ 'nlarr;': '\u219a',
+ 'nldr;': '\u2025',
+ 'nlE;': '\u2266\u0338',
+ 'nle;': '\u2270',
+ 'nLeftarrow;': '\u21cd',
+ 'nleftarrow;': '\u219a',
+ 'nLeftrightarrow;': '\u21ce',
+ 'nleftrightarrow;': '\u21ae',
+ 'nleq;': '\u2270',
+ 'nleqq;': '\u2266\u0338',
+ 'nleqslant;': '\u2a7d\u0338',
+ 'nles;': '\u2a7d\u0338',
+ 'nless;': '\u226e',
+ 'nLl;': '\u22d8\u0338',
+ 'nlsim;': '\u2274',
+ 'nLt;': '\u226a\u20d2',
+ 'nlt;': '\u226e',
+ 'nltri;': '\u22ea',
+ 'nltrie;': '\u22ec',
+ 'nLtv;': '\u226a\u0338',
+ 'nmid;': '\u2224',
+ 'NoBreak;': '\u2060',
+ 'NonBreakingSpace;': '\xa0',
+ 'Nopf;': '\u2115',
+ 'nopf;': '\U0001d55f',
+ 'not': '\xac',
+ 'Not;': '\u2aec',
+ 'not;': '\xac',
+ 'NotCongruent;': '\u2262',
+ 'NotCupCap;': '\u226d',
+ 'NotDoubleVerticalBar;': '\u2226',
+ 'NotElement;': '\u2209',
+ 'NotEqual;': '\u2260',
+ 'NotEqualTilde;': '\u2242\u0338',
+ 'NotExists;': '\u2204',
+ 'NotGreater;': '\u226f',
+ 'NotGreaterEqual;': '\u2271',
+ 'NotGreaterFullEqual;': '\u2267\u0338',
+ 'NotGreaterGreater;': '\u226b\u0338',
+ 'NotGreaterLess;': '\u2279',
+ 'NotGreaterSlantEqual;': '\u2a7e\u0338',
+ 'NotGreaterTilde;': '\u2275',
+ 'NotHumpDownHump;': '\u224e\u0338',
+ 'NotHumpEqual;': '\u224f\u0338',
+ 'notin;': '\u2209',
+ 'notindot;': '\u22f5\u0338',
+ 'notinE;': '\u22f9\u0338',
+ 'notinva;': '\u2209',
+ 'notinvb;': '\u22f7',
+ 'notinvc;': '\u22f6',
+ 'NotLeftTriangle;': '\u22ea',
+ 'NotLeftTriangleBar;': '\u29cf\u0338',
+ 'NotLeftTriangleEqual;': '\u22ec',
+ 'NotLess;': '\u226e',
+ 'NotLessEqual;': '\u2270',
+ 'NotLessGreater;': '\u2278',
+ 'NotLessLess;': '\u226a\u0338',
+ 'NotLessSlantEqual;': '\u2a7d\u0338',
+ 'NotLessTilde;': '\u2274',
+ 'NotNestedGreaterGreater;': '\u2aa2\u0338',
+ 'NotNestedLessLess;': '\u2aa1\u0338',
+ 'notni;': '\u220c',
+ 'notniva;': '\u220c',
+ 'notnivb;': '\u22fe',
+ 'notnivc;': '\u22fd',
+ 'NotPrecedes;': '\u2280',
+ 'NotPrecedesEqual;': '\u2aaf\u0338',
+ 'NotPrecedesSlantEqual;': '\u22e0',
+ 'NotReverseElement;': '\u220c',
+ 'NotRightTriangle;': '\u22eb',
+ 'NotRightTriangleBar;': '\u29d0\u0338',
+ 'NotRightTriangleEqual;': '\u22ed',
+ 'NotSquareSubset;': '\u228f\u0338',
+ 'NotSquareSubsetEqual;': '\u22e2',
+ 'NotSquareSuperset;': '\u2290\u0338',
+ 'NotSquareSupersetEqual;': '\u22e3',
+ 'NotSubset;': '\u2282\u20d2',
+ 'NotSubsetEqual;': '\u2288',
+ 'NotSucceeds;': '\u2281',
+ 'NotSucceedsEqual;': '\u2ab0\u0338',
+ 'NotSucceedsSlantEqual;': '\u22e1',
+ 'NotSucceedsTilde;': '\u227f\u0338',
+ 'NotSuperset;': '\u2283\u20d2',
+ 'NotSupersetEqual;': '\u2289',
+ 'NotTilde;': '\u2241',
+ 'NotTildeEqual;': '\u2244',
+ 'NotTildeFullEqual;': '\u2247',
+ 'NotTildeTilde;': '\u2249',
+ 'NotVerticalBar;': '\u2224',
+ 'npar;': '\u2226',
+ 'nparallel;': '\u2226',
+ 'nparsl;': '\u2afd\u20e5',
+ 'npart;': '\u2202\u0338',
+ 'npolint;': '\u2a14',
+ 'npr;': '\u2280',
+ 'nprcue;': '\u22e0',
+ 'npre;': '\u2aaf\u0338',
+ 'nprec;': '\u2280',
+ 'npreceq;': '\u2aaf\u0338',
+ 'nrArr;': '\u21cf',
+ 'nrarr;': '\u219b',
+ 'nrarrc;': '\u2933\u0338',
+ 'nrarrw;': '\u219d\u0338',
+ 'nRightarrow;': '\u21cf',
+ 'nrightarrow;': '\u219b',
+ 'nrtri;': '\u22eb',
+ 'nrtrie;': '\u22ed',
+ 'nsc;': '\u2281',
+ 'nsccue;': '\u22e1',
+ 'nsce;': '\u2ab0\u0338',
+ 'Nscr;': '\U0001d4a9',
+ 'nscr;': '\U0001d4c3',
+ 'nshortmid;': '\u2224',
+ 'nshortparallel;': '\u2226',
+ 'nsim;': '\u2241',
+ 'nsime;': '\u2244',
+ 'nsimeq;': '\u2244',
+ 'nsmid;': '\u2224',
+ 'nspar;': '\u2226',
+ 'nsqsube;': '\u22e2',
+ 'nsqsupe;': '\u22e3',
+ 'nsub;': '\u2284',
+ 'nsubE;': '\u2ac5\u0338',
+ 'nsube;': '\u2288',
+ 'nsubset;': '\u2282\u20d2',
+ 'nsubseteq;': '\u2288',
+ 'nsubseteqq;': '\u2ac5\u0338',
+ 'nsucc;': '\u2281',
+ 'nsucceq;': '\u2ab0\u0338',
+ 'nsup;': '\u2285',
+ 'nsupE;': '\u2ac6\u0338',
+ 'nsupe;': '\u2289',
+ 'nsupset;': '\u2283\u20d2',
+ 'nsupseteq;': '\u2289',
+ 'nsupseteqq;': '\u2ac6\u0338',
+ 'ntgl;': '\u2279',
+ 'Ntilde': '\xd1',
+ 'ntilde': '\xf1',
+ 'Ntilde;': '\xd1',
+ 'ntilde;': '\xf1',
+ 'ntlg;': '\u2278',
+ 'ntriangleleft;': '\u22ea',
+ 'ntrianglelefteq;': '\u22ec',
+ 'ntriangleright;': '\u22eb',
+ 'ntrianglerighteq;': '\u22ed',
+ 'Nu;': '\u039d',
+ 'nu;': '\u03bd',
+ 'num;': '#',
+ 'numero;': '\u2116',
+ 'numsp;': '\u2007',
+ 'nvap;': '\u224d\u20d2',
+ 'nVDash;': '\u22af',
+ 'nVdash;': '\u22ae',
+ 'nvDash;': '\u22ad',
+ 'nvdash;': '\u22ac',
+ 'nvge;': '\u2265\u20d2',
+ 'nvgt;': '>\u20d2',
+ 'nvHarr;': '\u2904',
+ 'nvinfin;': '\u29de',
+ 'nvlArr;': '\u2902',
+ 'nvle;': '\u2264\u20d2',
+ 'nvlt;': '<\u20d2',
+ 'nvltrie;': '\u22b4\u20d2',
+ 'nvrArr;': '\u2903',
+ 'nvrtrie;': '\u22b5\u20d2',
+ 'nvsim;': '\u223c\u20d2',
+ 'nwarhk;': '\u2923',
+ 'nwArr;': '\u21d6',
+ 'nwarr;': '\u2196',
+ 'nwarrow;': '\u2196',
+ 'nwnear;': '\u2927',
+ 'Oacute': '\xd3',
+ 'oacute': '\xf3',
+ 'Oacute;': '\xd3',
+ 'oacute;': '\xf3',
+ 'oast;': '\u229b',
+ 'ocir;': '\u229a',
+ 'Ocirc': '\xd4',
+ 'ocirc': '\xf4',
+ 'Ocirc;': '\xd4',
+ 'ocirc;': '\xf4',
+ 'Ocy;': '\u041e',
+ 'ocy;': '\u043e',
+ 'odash;': '\u229d',
+ 'Odblac;': '\u0150',
+ 'odblac;': '\u0151',
+ 'odiv;': '\u2a38',
+ 'odot;': '\u2299',
+ 'odsold;': '\u29bc',
+ 'OElig;': '\u0152',
+ 'oelig;': '\u0153',
+ 'ofcir;': '\u29bf',
+ 'Ofr;': '\U0001d512',
+ 'ofr;': '\U0001d52c',
+ 'ogon;': '\u02db',
+ 'Ograve': '\xd2',
+ 'ograve': '\xf2',
+ 'Ograve;': '\xd2',
+ 'ograve;': '\xf2',
+ 'ogt;': '\u29c1',
+ 'ohbar;': '\u29b5',
+ 'ohm;': '\u03a9',
+ 'oint;': '\u222e',
+ 'olarr;': '\u21ba',
+ 'olcir;': '\u29be',
+ 'olcross;': '\u29bb',
+ 'oline;': '\u203e',
+ 'olt;': '\u29c0',
+ 'Omacr;': '\u014c',
+ 'omacr;': '\u014d',
+ 'Omega;': '\u03a9',
+ 'omega;': '\u03c9',
+ 'Omicron;': '\u039f',
+ 'omicron;': '\u03bf',
+ 'omid;': '\u29b6',
+ 'ominus;': '\u2296',
+ 'Oopf;': '\U0001d546',
+ 'oopf;': '\U0001d560',
+ 'opar;': '\u29b7',
+ 'OpenCurlyDoubleQuote;': '\u201c',
+ 'OpenCurlyQuote;': '\u2018',
+ 'operp;': '\u29b9',
+ 'oplus;': '\u2295',
+ 'Or;': '\u2a54',
+ 'or;': '\u2228',
+ 'orarr;': '\u21bb',
+ 'ord;': '\u2a5d',
+ 'order;': '\u2134',
+ 'orderof;': '\u2134',
+ 'ordf': '\xaa',
+ 'ordf;': '\xaa',
+ 'ordm': '\xba',
+ 'ordm;': '\xba',
+ 'origof;': '\u22b6',
+ 'oror;': '\u2a56',
+ 'orslope;': '\u2a57',
+ 'orv;': '\u2a5b',
+ 'oS;': '\u24c8',
+ 'Oscr;': '\U0001d4aa',
+ 'oscr;': '\u2134',
+ 'Oslash': '\xd8',
+ 'oslash': '\xf8',
+ 'Oslash;': '\xd8',
+ 'oslash;': '\xf8',
+ 'osol;': '\u2298',
+ 'Otilde': '\xd5',
+ 'otilde': '\xf5',
+ 'Otilde;': '\xd5',
+ 'otilde;': '\xf5',
+ 'Otimes;': '\u2a37',
+ 'otimes;': '\u2297',
+ 'otimesas;': '\u2a36',
+ 'Ouml': '\xd6',
+ 'ouml': '\xf6',
+ 'Ouml;': '\xd6',
+ 'ouml;': '\xf6',
+ 'ovbar;': '\u233d',
+ 'OverBar;': '\u203e',
+ 'OverBrace;': '\u23de',
+ 'OverBracket;': '\u23b4',
+ 'OverParenthesis;': '\u23dc',
+ 'par;': '\u2225',
+ 'para': '\xb6',
+ 'para;': '\xb6',
+ 'parallel;': '\u2225',
+ 'parsim;': '\u2af3',
+ 'parsl;': '\u2afd',
+ 'part;': '\u2202',
+ 'PartialD;': '\u2202',
+ 'Pcy;': '\u041f',
+ 'pcy;': '\u043f',
+ 'percnt;': '%',
+ 'period;': '.',
+ 'permil;': '\u2030',
+ 'perp;': '\u22a5',
+ 'pertenk;': '\u2031',
+ 'Pfr;': '\U0001d513',
+ 'pfr;': '\U0001d52d',
+ 'Phi;': '\u03a6',
+ 'phi;': '\u03c6',
+ 'phiv;': '\u03d5',
+ 'phmmat;': '\u2133',
+ 'phone;': '\u260e',
+ 'Pi;': '\u03a0',
+ 'pi;': '\u03c0',
+ 'pitchfork;': '\u22d4',
+ 'piv;': '\u03d6',
+ 'planck;': '\u210f',
+ 'planckh;': '\u210e',
+ 'plankv;': '\u210f',
+ 'plus;': '+',
+ 'plusacir;': '\u2a23',
+ 'plusb;': '\u229e',
+ 'pluscir;': '\u2a22',
+ 'plusdo;': '\u2214',
+ 'plusdu;': '\u2a25',
+ 'pluse;': '\u2a72',
+ 'PlusMinus;': '\xb1',
+ 'plusmn': '\xb1',
+ 'plusmn;': '\xb1',
+ 'plussim;': '\u2a26',
+ 'plustwo;': '\u2a27',
+ 'pm;': '\xb1',
+ 'Poincareplane;': '\u210c',
+ 'pointint;': '\u2a15',
+ 'Popf;': '\u2119',
+ 'popf;': '\U0001d561',
+ 'pound': '\xa3',
+ 'pound;': '\xa3',
+ 'Pr;': '\u2abb',
+ 'pr;': '\u227a',
+ 'prap;': '\u2ab7',
+ 'prcue;': '\u227c',
+ 'prE;': '\u2ab3',
+ 'pre;': '\u2aaf',
+ 'prec;': '\u227a',
+ 'precapprox;': '\u2ab7',
+ 'preccurlyeq;': '\u227c',
+ 'Precedes;': '\u227a',
+ 'PrecedesEqual;': '\u2aaf',
+ 'PrecedesSlantEqual;': '\u227c',
+ 'PrecedesTilde;': '\u227e',
+ 'preceq;': '\u2aaf',
+ 'precnapprox;': '\u2ab9',
+ 'precneqq;': '\u2ab5',
+ 'precnsim;': '\u22e8',
+ 'precsim;': '\u227e',
+ 'Prime;': '\u2033',
+ 'prime;': '\u2032',
+ 'primes;': '\u2119',
+ 'prnap;': '\u2ab9',
+ 'prnE;': '\u2ab5',
+ 'prnsim;': '\u22e8',
+ 'prod;': '\u220f',
+ 'Product;': '\u220f',
+ 'profalar;': '\u232e',
+ 'profline;': '\u2312',
+ 'profsurf;': '\u2313',
+ 'prop;': '\u221d',
+ 'Proportion;': '\u2237',
+ 'Proportional;': '\u221d',
+ 'propto;': '\u221d',
+ 'prsim;': '\u227e',
+ 'prurel;': '\u22b0',
+ 'Pscr;': '\U0001d4ab',
+ 'pscr;': '\U0001d4c5',
+ 'Psi;': '\u03a8',
+ 'psi;': '\u03c8',
+ 'puncsp;': '\u2008',
+ 'Qfr;': '\U0001d514',
+ 'qfr;': '\U0001d52e',
+ 'qint;': '\u2a0c',
+ 'Qopf;': '\u211a',
+ 'qopf;': '\U0001d562',
+ 'qprime;': '\u2057',
+ 'Qscr;': '\U0001d4ac',
+ 'qscr;': '\U0001d4c6',
+ 'quaternions;': '\u210d',
+ 'quatint;': '\u2a16',
+ 'quest;': '?',
+ 'questeq;': '\u225f',
+ 'QUOT': '"',
+ 'quot': '"',
+ 'QUOT;': '"',
+ 'quot;': '"',
+ 'rAarr;': '\u21db',
+ 'race;': '\u223d\u0331',
+ 'Racute;': '\u0154',
+ 'racute;': '\u0155',
+ 'radic;': '\u221a',
+ 'raemptyv;': '\u29b3',
+ 'Rang;': '\u27eb',
+ 'rang;': '\u27e9',
+ 'rangd;': '\u2992',
+ 'range;': '\u29a5',
+ 'rangle;': '\u27e9',
+ 'raquo': '\xbb',
+ 'raquo;': '\xbb',
+ 'Rarr;': '\u21a0',
+ 'rArr;': '\u21d2',
+ 'rarr;': '\u2192',
+ 'rarrap;': '\u2975',
+ 'rarrb;': '\u21e5',
+ 'rarrbfs;': '\u2920',
+ 'rarrc;': '\u2933',
+ 'rarrfs;': '\u291e',
+ 'rarrhk;': '\u21aa',
+ 'rarrlp;': '\u21ac',
+ 'rarrpl;': '\u2945',
+ 'rarrsim;': '\u2974',
+ 'Rarrtl;': '\u2916',
+ 'rarrtl;': '\u21a3',
+ 'rarrw;': '\u219d',
+ 'rAtail;': '\u291c',
+ 'ratail;': '\u291a',
+ 'ratio;': '\u2236',
+ 'rationals;': '\u211a',
+ 'RBarr;': '\u2910',
+ 'rBarr;': '\u290f',
+ 'rbarr;': '\u290d',
+ 'rbbrk;': '\u2773',
+ 'rbrace;': '}',
+ 'rbrack;': ']',
+ 'rbrke;': '\u298c',
+ 'rbrksld;': '\u298e',
+ 'rbrkslu;': '\u2990',
+ 'Rcaron;': '\u0158',
+ 'rcaron;': '\u0159',
+ 'Rcedil;': '\u0156',
+ 'rcedil;': '\u0157',
+ 'rceil;': '\u2309',
+ 'rcub;': '}',
+ 'Rcy;': '\u0420',
+ 'rcy;': '\u0440',
+ 'rdca;': '\u2937',
+ 'rdldhar;': '\u2969',
+ 'rdquo;': '\u201d',
+ 'rdquor;': '\u201d',
+ 'rdsh;': '\u21b3',
+ 'Re;': '\u211c',
+ 'real;': '\u211c',
+ 'realine;': '\u211b',
+ 'realpart;': '\u211c',
+ 'reals;': '\u211d',
+ 'rect;': '\u25ad',
+ 'REG': '\xae',
+ 'reg': '\xae',
+ 'REG;': '\xae',
+ 'reg;': '\xae',
+ 'ReverseElement;': '\u220b',
+ 'ReverseEquilibrium;': '\u21cb',
+ 'ReverseUpEquilibrium;': '\u296f',
+ 'rfisht;': '\u297d',
+ 'rfloor;': '\u230b',
+ 'Rfr;': '\u211c',
+ 'rfr;': '\U0001d52f',
+ 'rHar;': '\u2964',
+ 'rhard;': '\u21c1',
+ 'rharu;': '\u21c0',
+ 'rharul;': '\u296c',
+ 'Rho;': '\u03a1',
+ 'rho;': '\u03c1',
+ 'rhov;': '\u03f1',
+ 'RightAngleBracket;': '\u27e9',
+ 'RightArrow;': '\u2192',
+ 'Rightarrow;': '\u21d2',
+ 'rightarrow;': '\u2192',
+ 'RightArrowBar;': '\u21e5',
+ 'RightArrowLeftArrow;': '\u21c4',
+ 'rightarrowtail;': '\u21a3',
+ 'RightCeiling;': '\u2309',
+ 'RightDoubleBracket;': '\u27e7',
+ 'RightDownTeeVector;': '\u295d',
+ 'RightDownVector;': '\u21c2',
+ 'RightDownVectorBar;': '\u2955',
+ 'RightFloor;': '\u230b',
+ 'rightharpoondown;': '\u21c1',
+ 'rightharpoonup;': '\u21c0',
+ 'rightleftarrows;': '\u21c4',
+ 'rightleftharpoons;': '\u21cc',
+ 'rightrightarrows;': '\u21c9',
+ 'rightsquigarrow;': '\u219d',
+ 'RightTee;': '\u22a2',
+ 'RightTeeArrow;': '\u21a6',
+ 'RightTeeVector;': '\u295b',
+ 'rightthreetimes;': '\u22cc',
+ 'RightTriangle;': '\u22b3',
+ 'RightTriangleBar;': '\u29d0',
+ 'RightTriangleEqual;': '\u22b5',
+ 'RightUpDownVector;': '\u294f',
+ 'RightUpTeeVector;': '\u295c',
+ 'RightUpVector;': '\u21be',
+ 'RightUpVectorBar;': '\u2954',
+ 'RightVector;': '\u21c0',
+ 'RightVectorBar;': '\u2953',
+ 'ring;': '\u02da',
+ 'risingdotseq;': '\u2253',
+ 'rlarr;': '\u21c4',
+ 'rlhar;': '\u21cc',
+ 'rlm;': '\u200f',
+ 'rmoust;': '\u23b1',
+ 'rmoustache;': '\u23b1',
+ 'rnmid;': '\u2aee',
+ 'roang;': '\u27ed',
+ 'roarr;': '\u21fe',
+ 'robrk;': '\u27e7',
+ 'ropar;': '\u2986',
+ 'Ropf;': '\u211d',
+ 'ropf;': '\U0001d563',
+ 'roplus;': '\u2a2e',
+ 'rotimes;': '\u2a35',
+ 'RoundImplies;': '\u2970',
+ 'rpar;': ')',
+ 'rpargt;': '\u2994',
+ 'rppolint;': '\u2a12',
+ 'rrarr;': '\u21c9',
+ 'Rrightarrow;': '\u21db',
+ 'rsaquo;': '\u203a',
+ 'Rscr;': '\u211b',
+ 'rscr;': '\U0001d4c7',
+ 'Rsh;': '\u21b1',
+ 'rsh;': '\u21b1',
+ 'rsqb;': ']',
+ 'rsquo;': '\u2019',
+ 'rsquor;': '\u2019',
+ 'rthree;': '\u22cc',
+ 'rtimes;': '\u22ca',
+ 'rtri;': '\u25b9',
+ 'rtrie;': '\u22b5',
+ 'rtrif;': '\u25b8',
+ 'rtriltri;': '\u29ce',
+ 'RuleDelayed;': '\u29f4',
+ 'ruluhar;': '\u2968',
+ 'rx;': '\u211e',
+ 'Sacute;': '\u015a',
+ 'sacute;': '\u015b',
+ 'sbquo;': '\u201a',
+ 'Sc;': '\u2abc',
+ 'sc;': '\u227b',
+ 'scap;': '\u2ab8',
+ 'Scaron;': '\u0160',
+ 'scaron;': '\u0161',
+ 'sccue;': '\u227d',
+ 'scE;': '\u2ab4',
+ 'sce;': '\u2ab0',
+ 'Scedil;': '\u015e',
+ 'scedil;': '\u015f',
+ 'Scirc;': '\u015c',
+ 'scirc;': '\u015d',
+ 'scnap;': '\u2aba',
+ 'scnE;': '\u2ab6',
+ 'scnsim;': '\u22e9',
+ 'scpolint;': '\u2a13',
+ 'scsim;': '\u227f',
+ 'Scy;': '\u0421',
+ 'scy;': '\u0441',
+ 'sdot;': '\u22c5',
+ 'sdotb;': '\u22a1',
+ 'sdote;': '\u2a66',
+ 'searhk;': '\u2925',
+ 'seArr;': '\u21d8',
+ 'searr;': '\u2198',
+ 'searrow;': '\u2198',
+ 'sect': '\xa7',
+ 'sect;': '\xa7',
+ 'semi;': ';',
+ 'seswar;': '\u2929',
+ 'setminus;': '\u2216',
+ 'setmn;': '\u2216',
+ 'sext;': '\u2736',
+ 'Sfr;': '\U0001d516',
+ 'sfr;': '\U0001d530',
+ 'sfrown;': '\u2322',
+ 'sharp;': '\u266f',
+ 'SHCHcy;': '\u0429',
+ 'shchcy;': '\u0449',
+ 'SHcy;': '\u0428',
+ 'shcy;': '\u0448',
+ 'ShortDownArrow;': '\u2193',
+ 'ShortLeftArrow;': '\u2190',
+ 'shortmid;': '\u2223',
+ 'shortparallel;': '\u2225',
+ 'ShortRightArrow;': '\u2192',
+ 'ShortUpArrow;': '\u2191',
+ 'shy': '\xad',
+ 'shy;': '\xad',
+ 'Sigma;': '\u03a3',
+ 'sigma;': '\u03c3',
+ 'sigmaf;': '\u03c2',
+ 'sigmav;': '\u03c2',
+ 'sim;': '\u223c',
+ 'simdot;': '\u2a6a',
+ 'sime;': '\u2243',
+ 'simeq;': '\u2243',
+ 'simg;': '\u2a9e',
+ 'simgE;': '\u2aa0',
+ 'siml;': '\u2a9d',
+ 'simlE;': '\u2a9f',
+ 'simne;': '\u2246',
+ 'simplus;': '\u2a24',
+ 'simrarr;': '\u2972',
+ 'slarr;': '\u2190',
+ 'SmallCircle;': '\u2218',
+ 'smallsetminus;': '\u2216',
+ 'smashp;': '\u2a33',
+ 'smeparsl;': '\u29e4',
+ 'smid;': '\u2223',
+ 'smile;': '\u2323',
+ 'smt;': '\u2aaa',
+ 'smte;': '\u2aac',
+ 'smtes;': '\u2aac\ufe00',
+ 'SOFTcy;': '\u042c',
+ 'softcy;': '\u044c',
+ 'sol;': '/',
+ 'solb;': '\u29c4',
+ 'solbar;': '\u233f',
+ 'Sopf;': '\U0001d54a',
+ 'sopf;': '\U0001d564',
+ 'spades;': '\u2660',
+ 'spadesuit;': '\u2660',
+ 'spar;': '\u2225',
+ 'sqcap;': '\u2293',
+ 'sqcaps;': '\u2293\ufe00',
+ 'sqcup;': '\u2294',
+ 'sqcups;': '\u2294\ufe00',
+ 'Sqrt;': '\u221a',
+ 'sqsub;': '\u228f',
+ 'sqsube;': '\u2291',
+ 'sqsubset;': '\u228f',
+ 'sqsubseteq;': '\u2291',
+ 'sqsup;': '\u2290',
+ 'sqsupe;': '\u2292',
+ 'sqsupset;': '\u2290',
+ 'sqsupseteq;': '\u2292',
+ 'squ;': '\u25a1',
+ 'Square;': '\u25a1',
+ 'square;': '\u25a1',
+ 'SquareIntersection;': '\u2293',
+ 'SquareSubset;': '\u228f',
+ 'SquareSubsetEqual;': '\u2291',
+ 'SquareSuperset;': '\u2290',
+ 'SquareSupersetEqual;': '\u2292',
+ 'SquareUnion;': '\u2294',
+ 'squarf;': '\u25aa',
+ 'squf;': '\u25aa',
+ 'srarr;': '\u2192',
+ 'Sscr;': '\U0001d4ae',
+ 'sscr;': '\U0001d4c8',
+ 'ssetmn;': '\u2216',
+ 'ssmile;': '\u2323',
+ 'sstarf;': '\u22c6',
+ 'Star;': '\u22c6',
+ 'star;': '\u2606',
+ 'starf;': '\u2605',
+ 'straightepsilon;': '\u03f5',
+ 'straightphi;': '\u03d5',
+ 'strns;': '\xaf',
+ 'Sub;': '\u22d0',
+ 'sub;': '\u2282',
+ 'subdot;': '\u2abd',
+ 'subE;': '\u2ac5',
+ 'sube;': '\u2286',
+ 'subedot;': '\u2ac3',
+ 'submult;': '\u2ac1',
+ 'subnE;': '\u2acb',
+ 'subne;': '\u228a',
+ 'subplus;': '\u2abf',
+ 'subrarr;': '\u2979',
+ 'Subset;': '\u22d0',
+ 'subset;': '\u2282',
+ 'subseteq;': '\u2286',
+ 'subseteqq;': '\u2ac5',
+ 'SubsetEqual;': '\u2286',
+ 'subsetneq;': '\u228a',
+ 'subsetneqq;': '\u2acb',
+ 'subsim;': '\u2ac7',
+ 'subsub;': '\u2ad5',
+ 'subsup;': '\u2ad3',
+ 'succ;': '\u227b',
+ 'succapprox;': '\u2ab8',
+ 'succcurlyeq;': '\u227d',
+ 'Succeeds;': '\u227b',
+ 'SucceedsEqual;': '\u2ab0',
+ 'SucceedsSlantEqual;': '\u227d',
+ 'SucceedsTilde;': '\u227f',
+ 'succeq;': '\u2ab0',
+ 'succnapprox;': '\u2aba',
+ 'succneqq;': '\u2ab6',
+ 'succnsim;': '\u22e9',
+ 'succsim;': '\u227f',
+ 'SuchThat;': '\u220b',
+ 'Sum;': '\u2211',
+ 'sum;': '\u2211',
+ 'sung;': '\u266a',
+ 'sup1': '\xb9',
+ 'sup1;': '\xb9',
+ 'sup2': '\xb2',
+ 'sup2;': '\xb2',
+ 'sup3': '\xb3',
+ 'sup3;': '\xb3',
+ 'Sup;': '\u22d1',
+ 'sup;': '\u2283',
+ 'supdot;': '\u2abe',
+ 'supdsub;': '\u2ad8',
+ 'supE;': '\u2ac6',
+ 'supe;': '\u2287',
+ 'supedot;': '\u2ac4',
+ 'Superset;': '\u2283',
+ 'SupersetEqual;': '\u2287',
+ 'suphsol;': '\u27c9',
+ 'suphsub;': '\u2ad7',
+ 'suplarr;': '\u297b',
+ 'supmult;': '\u2ac2',
+ 'supnE;': '\u2acc',
+ 'supne;': '\u228b',
+ 'supplus;': '\u2ac0',
+ 'Supset;': '\u22d1',
+ 'supset;': '\u2283',
+ 'supseteq;': '\u2287',
+ 'supseteqq;': '\u2ac6',
+ 'supsetneq;': '\u228b',
+ 'supsetneqq;': '\u2acc',
+ 'supsim;': '\u2ac8',
+ 'supsub;': '\u2ad4',
+ 'supsup;': '\u2ad6',
+ 'swarhk;': '\u2926',
+ 'swArr;': '\u21d9',
+ 'swarr;': '\u2199',
+ 'swarrow;': '\u2199',
+ 'swnwar;': '\u292a',
+ 'szlig': '\xdf',
+ 'szlig;': '\xdf',
+ 'Tab;': '\t',
+ 'target;': '\u2316',
+ 'Tau;': '\u03a4',
+ 'tau;': '\u03c4',
+ 'tbrk;': '\u23b4',
+ 'Tcaron;': '\u0164',
+ 'tcaron;': '\u0165',
+ 'Tcedil;': '\u0162',
+ 'tcedil;': '\u0163',
+ 'Tcy;': '\u0422',
+ 'tcy;': '\u0442',
+ 'tdot;': '\u20db',
+ 'telrec;': '\u2315',
+ 'Tfr;': '\U0001d517',
+ 'tfr;': '\U0001d531',
+ 'there4;': '\u2234',
+ 'Therefore;': '\u2234',
+ 'therefore;': '\u2234',
+ 'Theta;': '\u0398',
+ 'theta;': '\u03b8',
+ 'thetasym;': '\u03d1',
+ 'thetav;': '\u03d1',
+ 'thickapprox;': '\u2248',
+ 'thicksim;': '\u223c',
+ 'ThickSpace;': '\u205f\u200a',
+ 'thinsp;': '\u2009',
+ 'ThinSpace;': '\u2009',
+ 'thkap;': '\u2248',
+ 'thksim;': '\u223c',
+ 'THORN': '\xde',
+ 'thorn': '\xfe',
+ 'THORN;': '\xde',
+ 'thorn;': '\xfe',
+ 'Tilde;': '\u223c',
+ 'tilde;': '\u02dc',
+ 'TildeEqual;': '\u2243',
+ 'TildeFullEqual;': '\u2245',
+ 'TildeTilde;': '\u2248',
+ 'times': '\xd7',
+ 'times;': '\xd7',
+ 'timesb;': '\u22a0',
+ 'timesbar;': '\u2a31',
+ 'timesd;': '\u2a30',
+ 'tint;': '\u222d',
+ 'toea;': '\u2928',
+ 'top;': '\u22a4',
+ 'topbot;': '\u2336',
+ 'topcir;': '\u2af1',
+ 'Topf;': '\U0001d54b',
+ 'topf;': '\U0001d565',
+ 'topfork;': '\u2ada',
+ 'tosa;': '\u2929',
+ 'tprime;': '\u2034',
+ 'TRADE;': '\u2122',
+ 'trade;': '\u2122',
+ 'triangle;': '\u25b5',
+ 'triangledown;': '\u25bf',
+ 'triangleleft;': '\u25c3',
+ 'trianglelefteq;': '\u22b4',
+ 'triangleq;': '\u225c',
+ 'triangleright;': '\u25b9',
+ 'trianglerighteq;': '\u22b5',
+ 'tridot;': '\u25ec',
+ 'trie;': '\u225c',
+ 'triminus;': '\u2a3a',
+ 'TripleDot;': '\u20db',
+ 'triplus;': '\u2a39',
+ 'trisb;': '\u29cd',
+ 'tritime;': '\u2a3b',
+ 'trpezium;': '\u23e2',
+ 'Tscr;': '\U0001d4af',
+ 'tscr;': '\U0001d4c9',
+ 'TScy;': '\u0426',
+ 'tscy;': '\u0446',
+ 'TSHcy;': '\u040b',
+ 'tshcy;': '\u045b',
+ 'Tstrok;': '\u0166',
+ 'tstrok;': '\u0167',
+ 'twixt;': '\u226c',
+ 'twoheadleftarrow;': '\u219e',
+ 'twoheadrightarrow;': '\u21a0',
+ 'Uacute': '\xda',
+ 'uacute': '\xfa',
+ 'Uacute;': '\xda',
+ 'uacute;': '\xfa',
+ 'Uarr;': '\u219f',
+ 'uArr;': '\u21d1',
+ 'uarr;': '\u2191',
+ 'Uarrocir;': '\u2949',
+ 'Ubrcy;': '\u040e',
+ 'ubrcy;': '\u045e',
+ 'Ubreve;': '\u016c',
+ 'ubreve;': '\u016d',
+ 'Ucirc': '\xdb',
+ 'ucirc': '\xfb',
+ 'Ucirc;': '\xdb',
+ 'ucirc;': '\xfb',
+ 'Ucy;': '\u0423',
+ 'ucy;': '\u0443',
+ 'udarr;': '\u21c5',
+ 'Udblac;': '\u0170',
+ 'udblac;': '\u0171',
+ 'udhar;': '\u296e',
+ 'ufisht;': '\u297e',
+ 'Ufr;': '\U0001d518',
+ 'ufr;': '\U0001d532',
+ 'Ugrave': '\xd9',
+ 'ugrave': '\xf9',
+ 'Ugrave;': '\xd9',
+ 'ugrave;': '\xf9',
+ 'uHar;': '\u2963',
+ 'uharl;': '\u21bf',
+ 'uharr;': '\u21be',
+ 'uhblk;': '\u2580',
+ 'ulcorn;': '\u231c',
+ 'ulcorner;': '\u231c',
+ 'ulcrop;': '\u230f',
+ 'ultri;': '\u25f8',
+ 'Umacr;': '\u016a',
+ 'umacr;': '\u016b',
+ 'uml': '\xa8',
+ 'uml;': '\xa8',
+ 'UnderBar;': '_',
+ 'UnderBrace;': '\u23df',
+ 'UnderBracket;': '\u23b5',
+ 'UnderParenthesis;': '\u23dd',
+ 'Union;': '\u22c3',
+ 'UnionPlus;': '\u228e',
+ 'Uogon;': '\u0172',
+ 'uogon;': '\u0173',
+ 'Uopf;': '\U0001d54c',
+ 'uopf;': '\U0001d566',
+ 'UpArrow;': '\u2191',
+ 'Uparrow;': '\u21d1',
+ 'uparrow;': '\u2191',
+ 'UpArrowBar;': '\u2912',
+ 'UpArrowDownArrow;': '\u21c5',
+ 'UpDownArrow;': '\u2195',
+ 'Updownarrow;': '\u21d5',
+ 'updownarrow;': '\u2195',
+ 'UpEquilibrium;': '\u296e',
+ 'upharpoonleft;': '\u21bf',
+ 'upharpoonright;': '\u21be',
+ 'uplus;': '\u228e',
+ 'UpperLeftArrow;': '\u2196',
+ 'UpperRightArrow;': '\u2197',
+ 'Upsi;': '\u03d2',
+ 'upsi;': '\u03c5',
+ 'upsih;': '\u03d2',
+ 'Upsilon;': '\u03a5',
+ 'upsilon;': '\u03c5',
+ 'UpTee;': '\u22a5',
+ 'UpTeeArrow;': '\u21a5',
+ 'upuparrows;': '\u21c8',
+ 'urcorn;': '\u231d',
+ 'urcorner;': '\u231d',
+ 'urcrop;': '\u230e',
+ 'Uring;': '\u016e',
+ 'uring;': '\u016f',
+ 'urtri;': '\u25f9',
+ 'Uscr;': '\U0001d4b0',
+ 'uscr;': '\U0001d4ca',
+ 'utdot;': '\u22f0',
+ 'Utilde;': '\u0168',
+ 'utilde;': '\u0169',
+ 'utri;': '\u25b5',
+ 'utrif;': '\u25b4',
+ 'uuarr;': '\u21c8',
+ 'Uuml': '\xdc',
+ 'uuml': '\xfc',
+ 'Uuml;': '\xdc',
+ 'uuml;': '\xfc',
+ 'uwangle;': '\u29a7',
+ 'vangrt;': '\u299c',
+ 'varepsilon;': '\u03f5',
+ 'varkappa;': '\u03f0',
+ 'varnothing;': '\u2205',
+ 'varphi;': '\u03d5',
+ 'varpi;': '\u03d6',
+ 'varpropto;': '\u221d',
+ 'vArr;': '\u21d5',
+ 'varr;': '\u2195',
+ 'varrho;': '\u03f1',
+ 'varsigma;': '\u03c2',
+ 'varsubsetneq;': '\u228a\ufe00',
+ 'varsubsetneqq;': '\u2acb\ufe00',
+ 'varsupsetneq;': '\u228b\ufe00',
+ 'varsupsetneqq;': '\u2acc\ufe00',
+ 'vartheta;': '\u03d1',
+ 'vartriangleleft;': '\u22b2',
+ 'vartriangleright;': '\u22b3',
+ 'Vbar;': '\u2aeb',
+ 'vBar;': '\u2ae8',
+ 'vBarv;': '\u2ae9',
+ 'Vcy;': '\u0412',
+ 'vcy;': '\u0432',
+ 'VDash;': '\u22ab',
+ 'Vdash;': '\u22a9',
+ 'vDash;': '\u22a8',
+ 'vdash;': '\u22a2',
+ 'Vdashl;': '\u2ae6',
+ 'Vee;': '\u22c1',
+ 'vee;': '\u2228',
+ 'veebar;': '\u22bb',
+ 'veeeq;': '\u225a',
+ 'vellip;': '\u22ee',
+ 'Verbar;': '\u2016',
+ 'verbar;': '|',
+ 'Vert;': '\u2016',
+ 'vert;': '|',
+ 'VerticalBar;': '\u2223',
+ 'VerticalLine;': '|',
+ 'VerticalSeparator;': '\u2758',
+ 'VerticalTilde;': '\u2240',
+ 'VeryThinSpace;': '\u200a',
+ 'Vfr;': '\U0001d519',
+ 'vfr;': '\U0001d533',
+ 'vltri;': '\u22b2',
+ 'vnsub;': '\u2282\u20d2',
+ 'vnsup;': '\u2283\u20d2',
+ 'Vopf;': '\U0001d54d',
+ 'vopf;': '\U0001d567',
+ 'vprop;': '\u221d',
+ 'vrtri;': '\u22b3',
+ 'Vscr;': '\U0001d4b1',
+ 'vscr;': '\U0001d4cb',
+ 'vsubnE;': '\u2acb\ufe00',
+ 'vsubne;': '\u228a\ufe00',
+ 'vsupnE;': '\u2acc\ufe00',
+ 'vsupne;': '\u228b\ufe00',
+ 'Vvdash;': '\u22aa',
+ 'vzigzag;': '\u299a',
+ 'Wcirc;': '\u0174',
+ 'wcirc;': '\u0175',
+ 'wedbar;': '\u2a5f',
+ 'Wedge;': '\u22c0',
+ 'wedge;': '\u2227',
+ 'wedgeq;': '\u2259',
+ 'weierp;': '\u2118',
+ 'Wfr;': '\U0001d51a',
+ 'wfr;': '\U0001d534',
+ 'Wopf;': '\U0001d54e',
+ 'wopf;': '\U0001d568',
+ 'wp;': '\u2118',
+ 'wr;': '\u2240',
+ 'wreath;': '\u2240',
+ 'Wscr;': '\U0001d4b2',
+ 'wscr;': '\U0001d4cc',
+ 'xcap;': '\u22c2',
+ 'xcirc;': '\u25ef',
+ 'xcup;': '\u22c3',
+ 'xdtri;': '\u25bd',
+ 'Xfr;': '\U0001d51b',
+ 'xfr;': '\U0001d535',
+ 'xhArr;': '\u27fa',
+ 'xharr;': '\u27f7',
+ 'Xi;': '\u039e',
+ 'xi;': '\u03be',
+ 'xlArr;': '\u27f8',
+ 'xlarr;': '\u27f5',
+ 'xmap;': '\u27fc',
+ 'xnis;': '\u22fb',
+ 'xodot;': '\u2a00',
+ 'Xopf;': '\U0001d54f',
+ 'xopf;': '\U0001d569',
+ 'xoplus;': '\u2a01',
+ 'xotime;': '\u2a02',
+ 'xrArr;': '\u27f9',
+ 'xrarr;': '\u27f6',
+ 'Xscr;': '\U0001d4b3',
+ 'xscr;': '\U0001d4cd',
+ 'xsqcup;': '\u2a06',
+ 'xuplus;': '\u2a04',
+ 'xutri;': '\u25b3',
+ 'xvee;': '\u22c1',
+ 'xwedge;': '\u22c0',
+ 'Yacute': '\xdd',
+ 'yacute': '\xfd',
+ 'Yacute;': '\xdd',
+ 'yacute;': '\xfd',
+ 'YAcy;': '\u042f',
+ 'yacy;': '\u044f',
+ 'Ycirc;': '\u0176',
+ 'ycirc;': '\u0177',
+ 'Ycy;': '\u042b',
+ 'ycy;': '\u044b',
+ 'yen': '\xa5',
+ 'yen;': '\xa5',
+ 'Yfr;': '\U0001d51c',
+ 'yfr;': '\U0001d536',
+ 'YIcy;': '\u0407',
+ 'yicy;': '\u0457',
+ 'Yopf;': '\U0001d550',
+ 'yopf;': '\U0001d56a',
+ 'Yscr;': '\U0001d4b4',
+ 'yscr;': '\U0001d4ce',
+ 'YUcy;': '\u042e',
+ 'yucy;': '\u044e',
+ 'yuml': '\xff',
+ 'Yuml;': '\u0178',
+ 'yuml;': '\xff',
+ 'Zacute;': '\u0179',
+ 'zacute;': '\u017a',
+ 'Zcaron;': '\u017d',
+ 'zcaron;': '\u017e',
+ 'Zcy;': '\u0417',
+ 'zcy;': '\u0437',
+ 'Zdot;': '\u017b',
+ 'zdot;': '\u017c',
+ 'zeetrf;': '\u2128',
+ 'ZeroWidthSpace;': '\u200b',
+ 'Zeta;': '\u0396',
+ 'zeta;': '\u03b6',
+ 'Zfr;': '\u2128',
+ 'zfr;': '\U0001d537',
+ 'ZHcy;': '\u0416',
+ 'zhcy;': '\u0436',
+ 'zigrarr;': '\u21dd',
+ 'Zopf;': '\u2124',
+ 'zopf;': '\U0001d56b',
+ 'Zscr;': '\U0001d4b5',
+ 'zscr;': '\U0001d4cf',
+ 'zwj;': '\u200d',
+ 'zwnj;': '\u200c',
+}
+
+# maps the Unicode codepoint to the HTML entity name
+codepoint2name = {}
+
+# maps the HTML entity name to the character
+# (or a character reference if the character is outside the Latin-1 range)
+entitydefs = {}
+
+for (name, codepoint) in name2codepoint.items():
+ codepoint2name[codepoint] = name
+ entitydefs[name] = chr(codepoint)
+
+del name, codepoint
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/html/parser.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/html/parser.py
new file mode 100644
index 0000000..7b8cdba
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/html/parser.py
@@ -0,0 +1,537 @@
+"""A parser for HTML and XHTML.
+
+Backported for python-future from Python 3.3.
+"""
+
+# This file is based on sgmllib.py, but the API is slightly different.
+
+# XXX There should be a way to distinguish between PCDATA (parsed
+# character data -- the normal case), RCDATA (replaceable character
+# data -- only char and entity references and end tags are special)
+# and CDATA (character data -- only end tags are special).
+
+from __future__ import (absolute_import, division,
+ print_function, unicode_literals)
+from future.builtins import *
+from future.backports import _markupbase
+import re
+import warnings
+
+# Regular expressions used for parsing
+
+interesting_normal = re.compile('[&<]')
+incomplete = re.compile('&[a-zA-Z#]')
+
+entityref = re.compile('&([a-zA-Z][-.a-zA-Z0-9]*)[^a-zA-Z0-9]')
+charref = re.compile('(?:[0-9]+|[xX][0-9a-fA-F]+)[^0-9a-fA-F]')
+
+starttagopen = re.compile('<[a-zA-Z]')
+piclose = re.compile('>')
+commentclose = re.compile(r'--\s*>')
+tagfind = re.compile('([a-zA-Z][-.a-zA-Z0-9:_]*)(?:\s|/(?!>))*')
+# see http://www.w3.org/TR/html5/tokenization.html#tag-open-state
+# and http://www.w3.org/TR/html5/tokenization.html#tag-name-state
+tagfind_tolerant = re.compile('[a-zA-Z][^\t\n\r\f />\x00]*')
+# Note:
+# 1) the strict attrfind isn't really strict, but we can't make it
+# correctly strict without breaking backward compatibility;
+# 2) if you change attrfind remember to update locatestarttagend too;
+# 3) if you change attrfind and/or locatestarttagend the parser will
+# explode, so don't do it.
+attrfind = re.compile(
+ r'\s*([a-zA-Z_][-.:a-zA-Z_0-9]*)(\s*=\s*'
+ r'(\'[^\']*\'|"[^"]*"|[^\s"\'=<>`]*))?')
+attrfind_tolerant = re.compile(
+ r'((?<=[\'"\s/])[^\s/>][^\s/=>]*)(\s*=+\s*'
+ r'(\'[^\']*\'|"[^"]*"|(?![\'"])[^>\s]*))?(?:\s|/(?!>))*')
+locatestarttagend = re.compile(r"""
+ <[a-zA-Z][-.a-zA-Z0-9:_]* # tag name
+ (?:\s+ # whitespace before attribute name
+ (?:[a-zA-Z_][-.:a-zA-Z0-9_]* # attribute name
+ (?:\s*=\s* # value indicator
+ (?:'[^']*' # LITA-enclosed value
+ |\"[^\"]*\" # LIT-enclosed value
+ |[^'\">\s]+ # bare value
+ )
+ )?
+ )
+ )*
+ \s* # trailing whitespace
+""", re.VERBOSE)
+locatestarttagend_tolerant = re.compile(r"""
+ <[a-zA-Z][-.a-zA-Z0-9:_]* # tag name
+ (?:[\s/]* # optional whitespace before attribute name
+ (?:(?<=['"\s/])[^\s/>][^\s/=>]* # attribute name
+ (?:\s*=+\s* # value indicator
+ (?:'[^']*' # LITA-enclosed value
+ |"[^"]*" # LIT-enclosed value
+ |(?!['"])[^>\s]* # bare value
+ )
+ (?:\s*,)* # possibly followed by a comma
+ )?(?:\s|/(?!>))*
+ )*
+ )?
+ \s* # trailing whitespace
+""", re.VERBOSE)
+endendtag = re.compile('>')
+# the HTML 5 spec, section 8.1.2.2, doesn't allow spaces between
+# and the tag name, so maybe this should be fixed
+endtagfind = re.compile('\s*([a-zA-Z][-.a-zA-Z0-9:_]*)\s*>')
+
+
+class HTMLParseError(Exception):
+ """Exception raised for all parse errors."""
+
+ def __init__(self, msg, position=(None, None)):
+ assert msg
+ self.msg = msg
+ self.lineno = position[0]
+ self.offset = position[1]
+
+ def __str__(self):
+ result = self.msg
+ if self.lineno is not None:
+ result = result + ", at line %d" % self.lineno
+ if self.offset is not None:
+ result = result + ", column %d" % (self.offset + 1)
+ return result
+
+
+class HTMLParser(_markupbase.ParserBase):
+ """Find tags and other markup and call handler functions.
+
+ Usage:
+ p = HTMLParser()
+ p.feed(data)
+ ...
+ p.close()
+
+ Start tags are handled by calling self.handle_starttag() or
+ self.handle_startendtag(); end tags by self.handle_endtag(). The
+ data between tags is passed from the parser to the derived class
+ by calling self.handle_data() with the data as argument (the data
+ may be split up in arbitrary chunks). Entity references are
+ passed by calling self.handle_entityref() with the entity
+ reference as the argument. Numeric character references are
+ passed to self.handle_charref() with the string containing the
+ reference as the argument.
+ """
+
+ CDATA_CONTENT_ELEMENTS = ("script", "style")
+
+ def __init__(self, strict=False):
+ """Initialize and reset this instance.
+
+ If strict is set to False (the default) the parser will parse invalid
+ markup, otherwise it will raise an error. Note that the strict mode
+ is deprecated.
+ """
+ if strict:
+ warnings.warn("The strict mode is deprecated.",
+ DeprecationWarning, stacklevel=2)
+ self.strict = strict
+ self.reset()
+
+ def reset(self):
+ """Reset this instance. Loses all unprocessed data."""
+ self.rawdata = ''
+ self.lasttag = '???'
+ self.interesting = interesting_normal
+ self.cdata_elem = None
+ _markupbase.ParserBase.reset(self)
+
+ def feed(self, data):
+ r"""Feed data to the parser.
+
+ Call this as often as you want, with as little or as much text
+ as you want (may include '\n').
+ """
+ self.rawdata = self.rawdata + data
+ self.goahead(0)
+
+ def close(self):
+ """Handle any buffered data."""
+ self.goahead(1)
+
+ def error(self, message):
+ raise HTMLParseError(message, self.getpos())
+
+ __starttag_text = None
+
+ def get_starttag_text(self):
+ """Return full source of start tag: '<...>'."""
+ return self.__starttag_text
+
+ def set_cdata_mode(self, elem):
+ self.cdata_elem = elem.lower()
+ self.interesting = re.compile(r'\s*%s\s*>' % self.cdata_elem, re.I)
+
+ def clear_cdata_mode(self):
+ self.interesting = interesting_normal
+ self.cdata_elem = None
+
+ # Internal -- handle data as far as reasonable. May leave state
+ # and data to be processed by a subsequent call. If 'end' is
+ # true, force handling all data as if followed by EOF marker.
+ def goahead(self, end):
+ rawdata = self.rawdata
+ i = 0
+ n = len(rawdata)
+ while i < n:
+ match = self.interesting.search(rawdata, i) # < or &
+ if match:
+ j = match.start()
+ else:
+ if self.cdata_elem:
+ break
+ j = n
+ if i < j: self.handle_data(rawdata[i:j])
+ i = self.updatepos(i, j)
+ if i == n: break
+ startswith = rawdata.startswith
+ if startswith('<', i):
+ if starttagopen.match(rawdata, i): # < + letter
+ k = self.parse_starttag(i)
+ elif startswith("", i):
+ k = self.parse_endtag(i)
+ elif startswith(" \n
+ # \" --> "
+ #
+ i = 0
+ n = len(mystr)
+ res = []
+ while 0 <= i < n:
+ o_match = _OctalPatt.search(mystr, i)
+ q_match = _QuotePatt.search(mystr, i)
+ if not o_match and not q_match: # Neither matched
+ res.append(mystr[i:])
+ break
+ # else:
+ j = k = -1
+ if o_match:
+ j = o_match.start(0)
+ if q_match:
+ k = q_match.start(0)
+ if q_match and (not o_match or k < j): # QuotePatt matched
+ res.append(mystr[i:k])
+ res.append(mystr[k+1])
+ i = k + 2
+ else: # OctalPatt matched
+ res.append(mystr[i:j])
+ res.append(chr(int(mystr[j+1:j+4], 8)))
+ i = j + 4
+ return _nulljoin(res)
+
+# The _getdate() routine is used to set the expiration time in the cookie's HTTP
+# header. By default, _getdate() returns the current time in the appropriate
+# "expires" format for a Set-Cookie header. The one optional argument is an
+# offset from now, in seconds. For example, an offset of -3600 means "one hour
+# ago". The offset may be a floating point number.
+#
+
+_weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+
+_monthname = [None,
+ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
+
+def _getdate(future=0, weekdayname=_weekdayname, monthname=_monthname):
+ from time import gmtime, time
+ now = time()
+ year, month, day, hh, mm, ss, wd, y, z = gmtime(now + future)
+ return "%s, %02d %3s %4d %02d:%02d:%02d GMT" % \
+ (weekdayname[wd], day, monthname[month], year, hh, mm, ss)
+
+
+class Morsel(dict):
+ """A class to hold ONE (key, value) pair.
+
+ In a cookie, each such pair may have several attributes, so this class is
+ used to keep the attributes associated with the appropriate key,value pair.
+ This class also includes a coded_value attribute, which is used to hold
+ the network representation of the value. This is most useful when Python
+ objects are pickled for network transit.
+ """
+ # RFC 2109 lists these attributes as reserved:
+ # path comment domain
+ # max-age secure version
+ #
+ # For historical reasons, these attributes are also reserved:
+ # expires
+ #
+ # This is an extension from Microsoft:
+ # httponly
+ #
+ # This dictionary provides a mapping from the lowercase
+ # variant on the left to the appropriate traditional
+ # formatting on the right.
+ _reserved = {
+ "expires" : "expires",
+ "path" : "Path",
+ "comment" : "Comment",
+ "domain" : "Domain",
+ "max-age" : "Max-Age",
+ "secure" : "secure",
+ "httponly" : "httponly",
+ "version" : "Version",
+ }
+
+ _flags = set(['secure', 'httponly'])
+
+ def __init__(self):
+ # Set defaults
+ self.key = self.value = self.coded_value = None
+
+ # Set default attributes
+ for key in self._reserved:
+ dict.__setitem__(self, key, "")
+
+ def __setitem__(self, K, V):
+ K = K.lower()
+ if not K in self._reserved:
+ raise CookieError("Invalid Attribute %s" % K)
+ dict.__setitem__(self, K, V)
+
+ def isReservedKey(self, K):
+ return K.lower() in self._reserved
+
+ def set(self, key, val, coded_val, LegalChars=_LegalChars):
+ # First we verify that the key isn't a reserved word
+ # Second we make sure it only contains legal characters
+ if key.lower() in self._reserved:
+ raise CookieError("Attempt to set a reserved key: %s" % key)
+ if any(c not in LegalChars for c in key):
+ raise CookieError("Illegal key value: %s" % key)
+
+ # It's a good key, so save it.
+ self.key = key
+ self.value = val
+ self.coded_value = coded_val
+
+ def output(self, attrs=None, header="Set-Cookie:"):
+ return "%s %s" % (header, self.OutputString(attrs))
+
+ __str__ = output
+
+ @as_native_str()
+ def __repr__(self):
+ if PY2 and isinstance(self.value, unicode):
+ val = str(self.value) # make it a newstr to remove the u prefix
+ else:
+ val = self.value
+ return '<%s: %s=%s>' % (self.__class__.__name__,
+ str(self.key), repr(val))
+
+ def js_output(self, attrs=None):
+ # Print javascript
+ return """
+
+ """ % (self.OutputString(attrs).replace('"', r'\"'))
+
+ def OutputString(self, attrs=None):
+ # Build up our result
+ #
+ result = []
+ append = result.append
+
+ # First, the key=value pair
+ append("%s=%s" % (self.key, self.coded_value))
+
+ # Now add any defined attributes
+ if attrs is None:
+ attrs = self._reserved
+ items = sorted(self.items())
+ for key, value in items:
+ if value == "":
+ continue
+ if key not in attrs:
+ continue
+ if key == "expires" and isinstance(value, int):
+ append("%s=%s" % (self._reserved[key], _getdate(value)))
+ elif key == "max-age" and isinstance(value, int):
+ append("%s=%d" % (self._reserved[key], value))
+ elif key == "secure":
+ append(str(self._reserved[key]))
+ elif key == "httponly":
+ append(str(self._reserved[key]))
+ else:
+ append("%s=%s" % (self._reserved[key], value))
+
+ # Return the result
+ return _semispacejoin(result)
+
+
+#
+# Pattern for finding cookie
+#
+# This used to be strict parsing based on the RFC2109 and RFC2068
+# specifications. I have since discovered that MSIE 3.0x doesn't
+# follow the character rules outlined in those specs. As a
+# result, the parsing rules here are less strict.
+#
+
+_LegalCharsPatt = r"[\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=]"
+_CookiePattern = re.compile(r"""
+ (?x) # This is a verbose pattern
+ (?P # Start of group 'key'
+ """ + _LegalCharsPatt + r"""+? # Any word of at least one letter
+ ) # End of group 'key'
+ ( # Optional group: there may not be a value.
+ \s*=\s* # Equal Sign
+ (?P # Start of group 'val'
+ "(?:[^\\"]|\\.)*" # Any doublequoted string
+ | # or
+ \w{3},\s[\w\d\s-]{9,11}\s[\d:]{8}\sGMT # Special case for "expires" attr
+ | # or
+ """ + _LegalCharsPatt + r"""* # Any word or empty string
+ ) # End of group 'val'
+ )? # End of optional value group
+ \s* # Any number of spaces.
+ (\s+|;|$) # Ending either at space, semicolon, or EOS.
+ """, re.ASCII) # May be removed if safe.
+
+
+# At long last, here is the cookie class. Using this class is almost just like
+# using a dictionary. See this module's docstring for example usage.
+#
+class BaseCookie(dict):
+ """A container class for a set of Morsels."""
+
+ def value_decode(self, val):
+ """real_value, coded_value = value_decode(STRING)
+ Called prior to setting a cookie's value from the network
+ representation. The VALUE is the value read from HTTP
+ header.
+ Override this function to modify the behavior of cookies.
+ """
+ return val, val
+
+ def value_encode(self, val):
+ """real_value, coded_value = value_encode(VALUE)
+ Called prior to setting a cookie's value from the dictionary
+ representation. The VALUE is the value being assigned.
+ Override this function to modify the behavior of cookies.
+ """
+ strval = str(val)
+ return strval, strval
+
+ def __init__(self, input=None):
+ if input:
+ self.load(input)
+
+ def __set(self, key, real_value, coded_value):
+ """Private method for setting a cookie's value"""
+ M = self.get(key, Morsel())
+ M.set(key, real_value, coded_value)
+ dict.__setitem__(self, key, M)
+
+ def __setitem__(self, key, value):
+ """Dictionary style assignment."""
+ rval, cval = self.value_encode(value)
+ self.__set(key, rval, cval)
+
+ def output(self, attrs=None, header="Set-Cookie:", sep="\015\012"):
+ """Return a string suitable for HTTP."""
+ result = []
+ items = sorted(self.items())
+ for key, value in items:
+ result.append(value.output(attrs, header))
+ return sep.join(result)
+
+ __str__ = output
+
+ @as_native_str()
+ def __repr__(self):
+ l = []
+ items = sorted(self.items())
+ for key, value in items:
+ if PY2 and isinstance(value.value, unicode):
+ val = str(value.value) # make it a newstr to remove the u prefix
+ else:
+ val = value.value
+ l.append('%s=%s' % (str(key), repr(val)))
+ return '<%s: %s>' % (self.__class__.__name__, _spacejoin(l))
+
+ def js_output(self, attrs=None):
+ """Return a string suitable for JavaScript."""
+ result = []
+ items = sorted(self.items())
+ for key, value in items:
+ result.append(value.js_output(attrs))
+ return _nulljoin(result)
+
+ def load(self, rawdata):
+ """Load cookies from a string (presumably HTTP_COOKIE) or
+ from a dictionary. Loading cookies from a dictionary 'd'
+ is equivalent to calling:
+ map(Cookie.__setitem__, d.keys(), d.values())
+ """
+ if isinstance(rawdata, str):
+ self.__parse_string(rawdata)
+ else:
+ # self.update() wouldn't call our custom __setitem__
+ for key, value in rawdata.items():
+ self[key] = value
+ return
+
+ def __parse_string(self, mystr, patt=_CookiePattern):
+ i = 0 # Our starting point
+ n = len(mystr) # Length of string
+ M = None # current morsel
+
+ while 0 <= i < n:
+ # Start looking for a cookie
+ match = patt.search(mystr, i)
+ if not match:
+ # No more cookies
+ break
+
+ key, value = match.group("key"), match.group("val")
+
+ i = match.end(0)
+
+ # Parse the key, value in case it's metainfo
+ if key[0] == "$":
+ # We ignore attributes which pertain to the cookie
+ # mechanism as a whole. See RFC 2109.
+ # (Does anyone care?)
+ if M:
+ M[key[1:]] = value
+ elif key.lower() in Morsel._reserved:
+ if M:
+ if value is None:
+ if key.lower() in Morsel._flags:
+ M[key] = True
+ else:
+ M[key] = _unquote(value)
+ elif value is not None:
+ rval, cval = self.value_decode(value)
+ self.__set(key, rval, cval)
+ M = self[key]
+
+
+class SimpleCookie(BaseCookie):
+ """
+ SimpleCookie supports strings as cookie values. When setting
+ the value using the dictionary assignment notation, SimpleCookie
+ calls the builtin str() to convert the value to a string. Values
+ received from HTTP are kept as strings.
+ """
+ def value_decode(self, val):
+ return _unquote(val), val
+
+ def value_encode(self, val):
+ strval = str(val)
+ return strval, _quote(strval)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/http/server.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/http/server.py
new file mode 100644
index 0000000..b1c11e0
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/http/server.py
@@ -0,0 +1,1226 @@
+"""HTTP server classes.
+
+From Python 3.3
+
+Note: BaseHTTPRequestHandler doesn't implement any HTTP request; see
+SimpleHTTPRequestHandler for simple implementations of GET, HEAD and POST,
+and CGIHTTPRequestHandler for CGI scripts.
+
+It does, however, optionally implement HTTP/1.1 persistent connections,
+as of version 0.3.
+
+Notes on CGIHTTPRequestHandler
+------------------------------
+
+This class implements GET and POST requests to cgi-bin scripts.
+
+If the os.fork() function is not present (e.g. on Windows),
+subprocess.Popen() is used as a fallback, with slightly altered semantics.
+
+In all cases, the implementation is intentionally naive -- all
+requests are executed synchronously.
+
+SECURITY WARNING: DON'T USE THIS CODE UNLESS YOU ARE INSIDE A FIREWALL
+-- it may execute arbitrary Python code or external programs.
+
+Note that status code 200 is sent prior to execution of a CGI script, so
+scripts cannot send other status codes such as 302 (redirect).
+
+XXX To do:
+
+- log requests even later (to capture byte count)
+- log user-agent header and other interesting goodies
+- send error log to separate file
+"""
+
+from __future__ import (absolute_import, division,
+ print_function, unicode_literals)
+from future import utils
+from future.builtins import *
+
+
+# See also:
+#
+# HTTP Working Group T. Berners-Lee
+# INTERNET-DRAFT R. T. Fielding
+# H. Frystyk Nielsen
+# Expires September 8, 1995 March 8, 1995
+#
+# URL: http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-v10-spec-00.txt
+#
+# and
+#
+# Network Working Group R. Fielding
+# Request for Comments: 2616 et al
+# Obsoletes: 2068 June 1999
+# Category: Standards Track
+#
+# URL: http://www.faqs.org/rfcs/rfc2616.html
+
+# Log files
+# ---------
+#
+# Here's a quote from the NCSA httpd docs about log file format.
+#
+# | The logfile format is as follows. Each line consists of:
+# |
+# | host rfc931 authuser [DD/Mon/YYYY:hh:mm:ss] "request" ddd bbbb
+# |
+# | host: Either the DNS name or the IP number of the remote client
+# | rfc931: Any information returned by identd for this person,
+# | - otherwise.
+# | authuser: If user sent a userid for authentication, the user name,
+# | - otherwise.
+# | DD: Day
+# | Mon: Month (calendar name)
+# | YYYY: Year
+# | hh: hour (24-hour format, the machine's timezone)
+# | mm: minutes
+# | ss: seconds
+# | request: The first line of the HTTP request as sent by the client.
+# | ddd: the status code returned by the server, - if not available.
+# | bbbb: the total number of bytes sent,
+# | *not including the HTTP/1.0 header*, - if not available
+# |
+# | You can determine the name of the file accessed through request.
+#
+# (Actually, the latter is only true if you know the server configuration
+# at the time the request was made!)
+
+__version__ = "0.6"
+
+__all__ = ["HTTPServer", "BaseHTTPRequestHandler"]
+
+from future.backports import html
+from future.backports.http import client as http_client
+from future.backports.urllib import parse as urllib_parse
+from future.backports import socketserver
+
+import io
+import mimetypes
+import os
+import posixpath
+import select
+import shutil
+import socket # For gethostbyaddr()
+import sys
+import time
+import copy
+import argparse
+
+
+# Default error message template
+DEFAULT_ERROR_MESSAGE = """\
+
+
+
+
+ Error response
+
+
+
Error response
+
Error code: %(code)d
+
Message: %(message)s.
+
Error code explanation: %(code)s - %(explain)s.
+
+
+"""
+
+DEFAULT_ERROR_CONTENT_TYPE = "text/html;charset=utf-8"
+
+def _quote_html(html):
+ return html.replace("&", "&").replace("<", "<").replace(">", ">")
+
+class HTTPServer(socketserver.TCPServer):
+
+ allow_reuse_address = 1 # Seems to make sense in testing environment
+
+ def server_bind(self):
+ """Override server_bind to store the server name."""
+ socketserver.TCPServer.server_bind(self)
+ host, port = self.socket.getsockname()[:2]
+ self.server_name = socket.getfqdn(host)
+ self.server_port = port
+
+
+class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
+
+ """HTTP request handler base class.
+
+ The following explanation of HTTP serves to guide you through the
+ code as well as to expose any misunderstandings I may have about
+ HTTP (so you don't need to read the code to figure out I'm wrong
+ :-).
+
+ HTTP (HyperText Transfer Protocol) is an extensible protocol on
+ top of a reliable stream transport (e.g. TCP/IP). The protocol
+ recognizes three parts to a request:
+
+ 1. One line identifying the request type and path
+ 2. An optional set of RFC-822-style headers
+ 3. An optional data part
+
+ The headers and data are separated by a blank line.
+
+ The first line of the request has the form
+
+
+
+ where is a (case-sensitive) keyword such as GET or POST,
+ is a string containing path information for the request,
+ and should be the string "HTTP/1.0" or "HTTP/1.1".
+ is encoded using the URL encoding scheme (using %xx to signify
+ the ASCII character with hex code xx).
+
+ The specification specifies that lines are separated by CRLF but
+ for compatibility with the widest range of clients recommends
+ servers also handle LF. Similarly, whitespace in the request line
+ is treated sensibly (allowing multiple spaces between components
+ and allowing trailing whitespace).
+
+ Similarly, for output, lines ought to be separated by CRLF pairs
+ but most clients grok LF characters just fine.
+
+ If the first line of the request has the form
+
+
+
+ (i.e. is left out) then this is assumed to be an HTTP
+ 0.9 request; this form has no optional headers and data part and
+ the reply consists of just the data.
+
+ The reply form of the HTTP 1.x protocol again has three parts:
+
+ 1. One line giving the response code
+ 2. An optional set of RFC-822-style headers
+ 3. The data
+
+ Again, the headers and data are separated by a blank line.
+
+ The response code line has the form
+
+
+
+ where is the protocol version ("HTTP/1.0" or "HTTP/1.1"),
+ is a 3-digit response code indicating success or
+ failure of the request, and is an optional
+ human-readable string explaining what the response code means.
+
+ This server parses the request and the headers, and then calls a
+ function specific to the request type (). Specifically,
+ a request SPAM will be handled by a method do_SPAM(). If no
+ such method exists the server sends an error response to the
+ client. If it exists, it is called with no arguments:
+
+ do_SPAM()
+
+ Note that the request name is case sensitive (i.e. SPAM and spam
+ are different requests).
+
+ The various request details are stored in instance variables:
+
+ - client_address is the client IP address in the form (host,
+ port);
+
+ - command, path and version are the broken-down request line;
+
+ - headers is an instance of email.message.Message (or a derived
+ class) containing the header information;
+
+ - rfile is a file object open for reading positioned at the
+ start of the optional input data part;
+
+ - wfile is a file object open for writing.
+
+ IT IS IMPORTANT TO ADHERE TO THE PROTOCOL FOR WRITING!
+
+ The first thing to be written must be the response line. Then
+ follow 0 or more header lines, then a blank line, and then the
+ actual data (if any). The meaning of the header lines depends on
+ the command executed by the server; in most cases, when data is
+ returned, there should be at least one header line of the form
+
+ Content-type: /
+
+ where and should be registered MIME types,
+ e.g. "text/html" or "text/plain".
+
+ """
+
+ # The Python system version, truncated to its first component.
+ sys_version = "Python/" + sys.version.split()[0]
+
+ # The server software version. You may want to override this.
+ # The format is multiple whitespace-separated strings,
+ # where each string is of the form name[/version].
+ server_version = "BaseHTTP/" + __version__
+
+ error_message_format = DEFAULT_ERROR_MESSAGE
+ error_content_type = DEFAULT_ERROR_CONTENT_TYPE
+
+ # The default request version. This only affects responses up until
+ # the point where the request line is parsed, so it mainly decides what
+ # the client gets back when sending a malformed request line.
+ # Most web servers default to HTTP 0.9, i.e. don't send a status line.
+ default_request_version = "HTTP/0.9"
+
+ def parse_request(self):
+ """Parse a request (internal).
+
+ The request should be stored in self.raw_requestline; the results
+ are in self.command, self.path, self.request_version and
+ self.headers.
+
+ Return True for success, False for failure; on failure, an
+ error is sent back.
+
+ """
+ self.command = None # set in case of error on the first line
+ self.request_version = version = self.default_request_version
+ self.close_connection = 1
+ requestline = str(self.raw_requestline, 'iso-8859-1')
+ requestline = requestline.rstrip('\r\n')
+ self.requestline = requestline
+ words = requestline.split()
+ if len(words) == 3:
+ command, path, version = words
+ if version[:5] != 'HTTP/':
+ self.send_error(400, "Bad request version (%r)" % version)
+ return False
+ try:
+ base_version_number = version.split('/', 1)[1]
+ version_number = base_version_number.split(".")
+ # RFC 2145 section 3.1 says there can be only one "." and
+ # - major and minor numbers MUST be treated as
+ # separate integers;
+ # - HTTP/2.4 is a lower version than HTTP/2.13, which in
+ # turn is lower than HTTP/12.3;
+ # - Leading zeros MUST be ignored by recipients.
+ if len(version_number) != 2:
+ raise ValueError
+ version_number = int(version_number[0]), int(version_number[1])
+ except (ValueError, IndexError):
+ self.send_error(400, "Bad request version (%r)" % version)
+ return False
+ if version_number >= (1, 1) and self.protocol_version >= "HTTP/1.1":
+ self.close_connection = 0
+ if version_number >= (2, 0):
+ self.send_error(505,
+ "Invalid HTTP Version (%s)" % base_version_number)
+ return False
+ elif len(words) == 2:
+ command, path = words
+ self.close_connection = 1
+ if command != 'GET':
+ self.send_error(400,
+ "Bad HTTP/0.9 request type (%r)" % command)
+ return False
+ elif not words:
+ return False
+ else:
+ self.send_error(400, "Bad request syntax (%r)" % requestline)
+ return False
+ self.command, self.path, self.request_version = command, path, version
+
+ # Examine the headers and look for a Connection directive.
+ try:
+ self.headers = http_client.parse_headers(self.rfile,
+ _class=self.MessageClass)
+ except http_client.LineTooLong:
+ self.send_error(400, "Line too long")
+ return False
+
+ conntype = self.headers.get('Connection', "")
+ if conntype.lower() == 'close':
+ self.close_connection = 1
+ elif (conntype.lower() == 'keep-alive' and
+ self.protocol_version >= "HTTP/1.1"):
+ self.close_connection = 0
+ # Examine the headers and look for an Expect directive
+ expect = self.headers.get('Expect', "")
+ if (expect.lower() == "100-continue" and
+ self.protocol_version >= "HTTP/1.1" and
+ self.request_version >= "HTTP/1.1"):
+ if not self.handle_expect_100():
+ return False
+ return True
+
+ def handle_expect_100(self):
+ """Decide what to do with an "Expect: 100-continue" header.
+
+ If the client is expecting a 100 Continue response, we must
+ respond with either a 100 Continue or a final response before
+ waiting for the request body. The default is to always respond
+ with a 100 Continue. You can behave differently (for example,
+ reject unauthorized requests) by overriding this method.
+
+ This method should either return True (possibly after sending
+ a 100 Continue response) or send an error response and return
+ False.
+
+ """
+ self.send_response_only(100)
+ self.flush_headers()
+ return True
+
+ def handle_one_request(self):
+ """Handle a single HTTP request.
+
+ You normally don't need to override this method; see the class
+ __doc__ string for information on how to handle specific HTTP
+ commands such as GET and POST.
+
+ """
+ try:
+ self.raw_requestline = self.rfile.readline(65537)
+ if len(self.raw_requestline) > 65536:
+ self.requestline = ''
+ self.request_version = ''
+ self.command = ''
+ self.send_error(414)
+ return
+ if not self.raw_requestline:
+ self.close_connection = 1
+ return
+ if not self.parse_request():
+ # An error code has been sent, just exit
+ return
+ mname = 'do_' + self.command
+ if not hasattr(self, mname):
+ self.send_error(501, "Unsupported method (%r)" % self.command)
+ return
+ method = getattr(self, mname)
+ method()
+ self.wfile.flush() #actually send the response if not already done.
+ except socket.timeout as e:
+ #a read or a write timed out. Discard this connection
+ self.log_error("Request timed out: %r", e)
+ self.close_connection = 1
+ return
+
+ def handle(self):
+ """Handle multiple requests if necessary."""
+ self.close_connection = 1
+
+ self.handle_one_request()
+ while not self.close_connection:
+ self.handle_one_request()
+
+ def send_error(self, code, message=None):
+ """Send and log an error reply.
+
+ Arguments are the error code, and a detailed message.
+ The detailed message defaults to the short entry matching the
+ response code.
+
+ This sends an error response (so it must be called before any
+ output has been generated), logs the error, and finally sends
+ a piece of HTML explaining the error to the user.
+
+ """
+
+ try:
+ shortmsg, longmsg = self.responses[code]
+ except KeyError:
+ shortmsg, longmsg = '???', '???'
+ if message is None:
+ message = shortmsg
+ explain = longmsg
+ self.log_error("code %d, message %s", code, message)
+ # using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201)
+ content = (self.error_message_format %
+ {'code': code, 'message': _quote_html(message), 'explain': explain})
+ self.send_response(code, message)
+ self.send_header("Content-Type", self.error_content_type)
+ self.send_header('Connection', 'close')
+ self.end_headers()
+ if self.command != 'HEAD' and code >= 200 and code not in (204, 304):
+ self.wfile.write(content.encode('UTF-8', 'replace'))
+
+ def send_response(self, code, message=None):
+ """Add the response header to the headers buffer and log the
+ response code.
+
+ Also send two standard headers with the server software
+ version and the current date.
+
+ """
+ self.log_request(code)
+ self.send_response_only(code, message)
+ self.send_header('Server', self.version_string())
+ self.send_header('Date', self.date_time_string())
+
+ def send_response_only(self, code, message=None):
+ """Send the response header only."""
+ if message is None:
+ if code in self.responses:
+ message = self.responses[code][0]
+ else:
+ message = ''
+ if self.request_version != 'HTTP/0.9':
+ if not hasattr(self, '_headers_buffer'):
+ self._headers_buffer = []
+ self._headers_buffer.append(("%s %d %s\r\n" %
+ (self.protocol_version, code, message)).encode(
+ 'latin-1', 'strict'))
+
+ def send_header(self, keyword, value):
+ """Send a MIME header to the headers buffer."""
+ if self.request_version != 'HTTP/0.9':
+ if not hasattr(self, '_headers_buffer'):
+ self._headers_buffer = []
+ self._headers_buffer.append(
+ ("%s: %s\r\n" % (keyword, value)).encode('latin-1', 'strict'))
+
+ if keyword.lower() == 'connection':
+ if value.lower() == 'close':
+ self.close_connection = 1
+ elif value.lower() == 'keep-alive':
+ self.close_connection = 0
+
+ def end_headers(self):
+ """Send the blank line ending the MIME headers."""
+ if self.request_version != 'HTTP/0.9':
+ self._headers_buffer.append(b"\r\n")
+ self.flush_headers()
+
+ def flush_headers(self):
+ if hasattr(self, '_headers_buffer'):
+ self.wfile.write(b"".join(self._headers_buffer))
+ self._headers_buffer = []
+
+ def log_request(self, code='-', size='-'):
+ """Log an accepted request.
+
+ This is called by send_response().
+
+ """
+
+ self.log_message('"%s" %s %s',
+ self.requestline, str(code), str(size))
+
+ def log_error(self, format, *args):
+ """Log an error.
+
+ This is called when a request cannot be fulfilled. By
+ default it passes the message on to log_message().
+
+ Arguments are the same as for log_message().
+
+ XXX This should go to the separate error log.
+
+ """
+
+ self.log_message(format, *args)
+
+ def log_message(self, format, *args):
+ """Log an arbitrary message.
+
+ This is used by all other logging functions. Override
+ it if you have specific logging wishes.
+
+ The first argument, FORMAT, is a format string for the
+ message to be logged. If the format string contains
+ any % escapes requiring parameters, they should be
+ specified as subsequent arguments (it's just like
+ printf!).
+
+ The client ip and current date/time are prefixed to
+ every message.
+
+ """
+
+ sys.stderr.write("%s - - [%s] %s\n" %
+ (self.address_string(),
+ self.log_date_time_string(),
+ format%args))
+
+ def version_string(self):
+ """Return the server software version string."""
+ return self.server_version + ' ' + self.sys_version
+
+ def date_time_string(self, timestamp=None):
+ """Return the current date and time formatted for a message header."""
+ if timestamp is None:
+ timestamp = time.time()
+ year, month, day, hh, mm, ss, wd, y, z = time.gmtime(timestamp)
+ s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % (
+ self.weekdayname[wd],
+ day, self.monthname[month], year,
+ hh, mm, ss)
+ return s
+
+ def log_date_time_string(self):
+ """Return the current time formatted for logging."""
+ now = time.time()
+ year, month, day, hh, mm, ss, x, y, z = time.localtime(now)
+ s = "%02d/%3s/%04d %02d:%02d:%02d" % (
+ day, self.monthname[month], year, hh, mm, ss)
+ return s
+
+ weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+
+ monthname = [None,
+ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
+
+ def address_string(self):
+ """Return the client address."""
+
+ return self.client_address[0]
+
+ # Essentially static class variables
+
+ # The version of the HTTP protocol we support.
+ # Set this to HTTP/1.1 to enable automatic keepalive
+ protocol_version = "HTTP/1.0"
+
+ # MessageClass used to parse headers
+ MessageClass = http_client.HTTPMessage
+
+ # Table mapping response codes to messages; entries have the
+ # form {code: (shortmessage, longmessage)}.
+ # See RFC 2616 and 6585.
+ responses = {
+ 100: ('Continue', 'Request received, please continue'),
+ 101: ('Switching Protocols',
+ 'Switching to new protocol; obey Upgrade header'),
+
+ 200: ('OK', 'Request fulfilled, document follows'),
+ 201: ('Created', 'Document created, URL follows'),
+ 202: ('Accepted',
+ 'Request accepted, processing continues off-line'),
+ 203: ('Non-Authoritative Information', 'Request fulfilled from cache'),
+ 204: ('No Content', 'Request fulfilled, nothing follows'),
+ 205: ('Reset Content', 'Clear input form for further input.'),
+ 206: ('Partial Content', 'Partial content follows.'),
+
+ 300: ('Multiple Choices',
+ 'Object has several resources -- see URI list'),
+ 301: ('Moved Permanently', 'Object moved permanently -- see URI list'),
+ 302: ('Found', 'Object moved temporarily -- see URI list'),
+ 303: ('See Other', 'Object moved -- see Method and URL list'),
+ 304: ('Not Modified',
+ 'Document has not changed since given time'),
+ 305: ('Use Proxy',
+ 'You must use proxy specified in Location to access this '
+ 'resource.'),
+ 307: ('Temporary Redirect',
+ 'Object moved temporarily -- see URI list'),
+
+ 400: ('Bad Request',
+ 'Bad request syntax or unsupported method'),
+ 401: ('Unauthorized',
+ 'No permission -- see authorization schemes'),
+ 402: ('Payment Required',
+ 'No payment -- see charging schemes'),
+ 403: ('Forbidden',
+ 'Request forbidden -- authorization will not help'),
+ 404: ('Not Found', 'Nothing matches the given URI'),
+ 405: ('Method Not Allowed',
+ 'Specified method is invalid for this resource.'),
+ 406: ('Not Acceptable', 'URI not available in preferred format.'),
+ 407: ('Proxy Authentication Required', 'You must authenticate with '
+ 'this proxy before proceeding.'),
+ 408: ('Request Timeout', 'Request timed out; try again later.'),
+ 409: ('Conflict', 'Request conflict.'),
+ 410: ('Gone',
+ 'URI no longer exists and has been permanently removed.'),
+ 411: ('Length Required', 'Client must specify Content-Length.'),
+ 412: ('Precondition Failed', 'Precondition in headers is false.'),
+ 413: ('Request Entity Too Large', 'Entity is too large.'),
+ 414: ('Request-URI Too Long', 'URI is too long.'),
+ 415: ('Unsupported Media Type', 'Entity body in unsupported format.'),
+ 416: ('Requested Range Not Satisfiable',
+ 'Cannot satisfy request range.'),
+ 417: ('Expectation Failed',
+ 'Expect condition could not be satisfied.'),
+ 428: ('Precondition Required',
+ 'The origin server requires the request to be conditional.'),
+ 429: ('Too Many Requests', 'The user has sent too many requests '
+ 'in a given amount of time ("rate limiting").'),
+ 431: ('Request Header Fields Too Large', 'The server is unwilling to '
+ 'process the request because its header fields are too large.'),
+
+ 500: ('Internal Server Error', 'Server got itself in trouble'),
+ 501: ('Not Implemented',
+ 'Server does not support this operation'),
+ 502: ('Bad Gateway', 'Invalid responses from another server/proxy.'),
+ 503: ('Service Unavailable',
+ 'The server cannot process the request due to a high load'),
+ 504: ('Gateway Timeout',
+ 'The gateway server did not receive a timely response'),
+ 505: ('HTTP Version Not Supported', 'Cannot fulfill request.'),
+ 511: ('Network Authentication Required',
+ 'The client needs to authenticate to gain network access.'),
+ }
+
+
+class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
+
+ """Simple HTTP request handler with GET and HEAD commands.
+
+ This serves files from the current directory and any of its
+ subdirectories. The MIME type for files is determined by
+ calling the .guess_type() method.
+
+ The GET and HEAD requests are identical except that the HEAD
+ request omits the actual contents of the file.
+
+ """
+
+ server_version = "SimpleHTTP/" + __version__
+
+ def do_GET(self):
+ """Serve a GET request."""
+ f = self.send_head()
+ if f:
+ self.copyfile(f, self.wfile)
+ f.close()
+
+ def do_HEAD(self):
+ """Serve a HEAD request."""
+ f = self.send_head()
+ if f:
+ f.close()
+
+ def send_head(self):
+ """Common code for GET and HEAD commands.
+
+ This sends the response code and MIME headers.
+
+ Return value is either a file object (which has to be copied
+ to the outputfile by the caller unless the command was HEAD,
+ and must be closed by the caller under all circumstances), or
+ None, in which case the caller has nothing further to do.
+
+ """
+ path = self.translate_path(self.path)
+ f = None
+ if os.path.isdir(path):
+ if not self.path.endswith('/'):
+ # redirect browser - doing basically what apache does
+ self.send_response(301)
+ self.send_header("Location", self.path + "/")
+ self.end_headers()
+ return None
+ for index in "index.html", "index.htm":
+ index = os.path.join(path, index)
+ if os.path.exists(index):
+ path = index
+ break
+ else:
+ return self.list_directory(path)
+ ctype = self.guess_type(path)
+ try:
+ f = open(path, 'rb')
+ except IOError:
+ self.send_error(404, "File not found")
+ return None
+ self.send_response(200)
+ self.send_header("Content-type", ctype)
+ fs = os.fstat(f.fileno())
+ self.send_header("Content-Length", str(fs[6]))
+ self.send_header("Last-Modified", self.date_time_string(fs.st_mtime))
+ self.end_headers()
+ return f
+
+ def list_directory(self, path):
+ """Helper to produce a directory listing (absent index.html).
+
+ Return value is either a file object, or None (indicating an
+ error). In either case, the headers are sent, making the
+ interface the same as for send_head().
+
+ """
+ try:
+ list = os.listdir(path)
+ except os.error:
+ self.send_error(404, "No permission to list directory")
+ return None
+ list.sort(key=lambda a: a.lower())
+ r = []
+ displaypath = html.escape(urllib_parse.unquote(self.path))
+ enc = sys.getfilesystemencoding()
+ title = 'Directory listing for %s' % displaypath
+ r.append('')
+ r.append('\n')
+ r.append('' % enc)
+ r.append('%s\n' % title)
+ r.append('\n
%s
' % title)
+ r.append('\n
')
+ for name in list:
+ fullname = os.path.join(path, name)
+ displayname = linkname = name
+ # Append / for directories or @ for symbolic links
+ if os.path.isdir(fullname):
+ displayname = name + "/"
+ linkname = name + "/"
+ if os.path.islink(fullname):
+ displayname = name + "@"
+ # Note: a link to a directory displays with @ and links with /
+ r.append('
\n\n\n\n')
+ encoded = '\n'.join(r).encode(enc)
+ f = io.BytesIO()
+ f.write(encoded)
+ f.seek(0)
+ self.send_response(200)
+ self.send_header("Content-type", "text/html; charset=%s" % enc)
+ self.send_header("Content-Length", str(len(encoded)))
+ self.end_headers()
+ return f
+
+ def translate_path(self, path):
+ """Translate a /-separated PATH to the local filename syntax.
+
+ Components that mean special things to the local file system
+ (e.g. drive or directory names) are ignored. (XXX They should
+ probably be diagnosed.)
+
+ """
+ # abandon query parameters
+ path = path.split('?',1)[0]
+ path = path.split('#',1)[0]
+ path = posixpath.normpath(urllib_parse.unquote(path))
+ words = path.split('/')
+ words = filter(None, words)
+ path = os.getcwd()
+ for word in words:
+ drive, word = os.path.splitdrive(word)
+ head, word = os.path.split(word)
+ if word in (os.curdir, os.pardir): continue
+ path = os.path.join(path, word)
+ return path
+
+ def copyfile(self, source, outputfile):
+ """Copy all data between two file objects.
+
+ The SOURCE argument is a file object open for reading
+ (or anything with a read() method) and the DESTINATION
+ argument is a file object open for writing (or
+ anything with a write() method).
+
+ The only reason for overriding this would be to change
+ the block size or perhaps to replace newlines by CRLF
+ -- note however that this the default server uses this
+ to copy binary data as well.
+
+ """
+ shutil.copyfileobj(source, outputfile)
+
+ def guess_type(self, path):
+ """Guess the type of a file.
+
+ Argument is a PATH (a filename).
+
+ Return value is a string of the form type/subtype,
+ usable for a MIME Content-type header.
+
+ The default implementation looks the file's extension
+ up in the table self.extensions_map, using application/octet-stream
+ as a default; however it would be permissible (if
+ slow) to look inside the data to make a better guess.
+
+ """
+
+ base, ext = posixpath.splitext(path)
+ if ext in self.extensions_map:
+ return self.extensions_map[ext]
+ ext = ext.lower()
+ if ext in self.extensions_map:
+ return self.extensions_map[ext]
+ else:
+ return self.extensions_map['']
+
+ if not mimetypes.inited:
+ mimetypes.init() # try to read system mime.types
+ extensions_map = mimetypes.types_map.copy()
+ extensions_map.update({
+ '': 'application/octet-stream', # Default
+ '.py': 'text/plain',
+ '.c': 'text/plain',
+ '.h': 'text/plain',
+ })
+
+
+# Utilities for CGIHTTPRequestHandler
+
+def _url_collapse_path(path):
+ """
+ Given a URL path, remove extra '/'s and '.' path elements and collapse
+ any '..' references and returns a colllapsed path.
+
+ Implements something akin to RFC-2396 5.2 step 6 to parse relative paths.
+ The utility of this function is limited to is_cgi method and helps
+ preventing some security attacks.
+
+ Returns: A tuple of (head, tail) where tail is everything after the final /
+ and head is everything before it. Head will always start with a '/' and,
+ if it contains anything else, never have a trailing '/'.
+
+ Raises: IndexError if too many '..' occur within the path.
+
+ """
+ # Similar to os.path.split(os.path.normpath(path)) but specific to URL
+ # path semantics rather than local operating system semantics.
+ path_parts = path.split('/')
+ head_parts = []
+ for part in path_parts[:-1]:
+ if part == '..':
+ head_parts.pop() # IndexError if more '..' than prior parts
+ elif part and part != '.':
+ head_parts.append( part )
+ if path_parts:
+ tail_part = path_parts.pop()
+ if tail_part:
+ if tail_part == '..':
+ head_parts.pop()
+ tail_part = ''
+ elif tail_part == '.':
+ tail_part = ''
+ else:
+ tail_part = ''
+
+ splitpath = ('/' + '/'.join(head_parts), tail_part)
+ collapsed_path = "/".join(splitpath)
+
+ return collapsed_path
+
+
+
+nobody = None
+
+def nobody_uid():
+ """Internal routine to get nobody's uid"""
+ global nobody
+ if nobody:
+ return nobody
+ try:
+ import pwd
+ except ImportError:
+ return -1
+ try:
+ nobody = pwd.getpwnam('nobody')[2]
+ except KeyError:
+ nobody = 1 + max(x[2] for x in pwd.getpwall())
+ return nobody
+
+
+def executable(path):
+ """Test for executable file."""
+ return os.access(path, os.X_OK)
+
+
+class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
+
+ """Complete HTTP server with GET, HEAD and POST commands.
+
+ GET and HEAD also support running CGI scripts.
+
+ The POST command is *only* implemented for CGI scripts.
+
+ """
+
+ # Determine platform specifics
+ have_fork = hasattr(os, 'fork')
+
+ # Make rfile unbuffered -- we need to read one line and then pass
+ # the rest to a subprocess, so we can't use buffered input.
+ rbufsize = 0
+
+ def do_POST(self):
+ """Serve a POST request.
+
+ This is only implemented for CGI scripts.
+
+ """
+
+ if self.is_cgi():
+ self.run_cgi()
+ else:
+ self.send_error(501, "Can only POST to CGI scripts")
+
+ def send_head(self):
+ """Version of send_head that support CGI scripts"""
+ if self.is_cgi():
+ return self.run_cgi()
+ else:
+ return SimpleHTTPRequestHandler.send_head(self)
+
+ def is_cgi(self):
+ """Test whether self.path corresponds to a CGI script.
+
+ Returns True and updates the cgi_info attribute to the tuple
+ (dir, rest) if self.path requires running a CGI script.
+ Returns False otherwise.
+
+ If any exception is raised, the caller should assume that
+ self.path was rejected as invalid and act accordingly.
+
+ The default implementation tests whether the normalized url
+ path begins with one of the strings in self.cgi_directories
+ (and the next character is a '/' or the end of the string).
+
+ """
+ collapsed_path = _url_collapse_path(self.path)
+ dir_sep = collapsed_path.find('/', 1)
+ head, tail = collapsed_path[:dir_sep], collapsed_path[dir_sep+1:]
+ if head in self.cgi_directories:
+ self.cgi_info = head, tail
+ return True
+ return False
+
+
+ cgi_directories = ['/cgi-bin', '/htbin']
+
+ def is_executable(self, path):
+ """Test whether argument path is an executable file."""
+ return executable(path)
+
+ def is_python(self, path):
+ """Test whether argument path is a Python script."""
+ head, tail = os.path.splitext(path)
+ return tail.lower() in (".py", ".pyw")
+
+ def run_cgi(self):
+ """Execute a CGI script."""
+ path = self.path
+ dir, rest = self.cgi_info
+
+ i = path.find('/', len(dir) + 1)
+ while i >= 0:
+ nextdir = path[:i]
+ nextrest = path[i+1:]
+
+ scriptdir = self.translate_path(nextdir)
+ if os.path.isdir(scriptdir):
+ dir, rest = nextdir, nextrest
+ i = path.find('/', len(dir) + 1)
+ else:
+ break
+
+ # find an explicit query string, if present.
+ i = rest.rfind('?')
+ if i >= 0:
+ rest, query = rest[:i], rest[i+1:]
+ else:
+ query = ''
+
+ # dissect the part after the directory name into a script name &
+ # a possible additional path, to be stored in PATH_INFO.
+ i = rest.find('/')
+ if i >= 0:
+ script, rest = rest[:i], rest[i:]
+ else:
+ script, rest = rest, ''
+
+ scriptname = dir + '/' + script
+ scriptfile = self.translate_path(scriptname)
+ if not os.path.exists(scriptfile):
+ self.send_error(404, "No such CGI script (%r)" % scriptname)
+ return
+ if not os.path.isfile(scriptfile):
+ self.send_error(403, "CGI script is not a plain file (%r)" %
+ scriptname)
+ return
+ ispy = self.is_python(scriptname)
+ if self.have_fork or not ispy:
+ if not self.is_executable(scriptfile):
+ self.send_error(403, "CGI script is not executable (%r)" %
+ scriptname)
+ return
+
+ # Reference: http://hoohoo.ncsa.uiuc.edu/cgi/env.html
+ # XXX Much of the following could be prepared ahead of time!
+ env = copy.deepcopy(os.environ)
+ env['SERVER_SOFTWARE'] = self.version_string()
+ env['SERVER_NAME'] = self.server.server_name
+ env['GATEWAY_INTERFACE'] = 'CGI/1.1'
+ env['SERVER_PROTOCOL'] = self.protocol_version
+ env['SERVER_PORT'] = str(self.server.server_port)
+ env['REQUEST_METHOD'] = self.command
+ uqrest = urllib_parse.unquote(rest)
+ env['PATH_INFO'] = uqrest
+ env['PATH_TRANSLATED'] = self.translate_path(uqrest)
+ env['SCRIPT_NAME'] = scriptname
+ if query:
+ env['QUERY_STRING'] = query
+ env['REMOTE_ADDR'] = self.client_address[0]
+ authorization = self.headers.get("authorization")
+ if authorization:
+ authorization = authorization.split()
+ if len(authorization) == 2:
+ import base64, binascii
+ env['AUTH_TYPE'] = authorization[0]
+ if authorization[0].lower() == "basic":
+ try:
+ authorization = authorization[1].encode('ascii')
+ if utils.PY3:
+ # In Py3.3, was:
+ authorization = base64.decodebytes(authorization).\
+ decode('ascii')
+ else:
+ # Backport to Py2.7:
+ authorization = base64.decodestring(authorization).\
+ decode('ascii')
+ except (binascii.Error, UnicodeError):
+ pass
+ else:
+ authorization = authorization.split(':')
+ if len(authorization) == 2:
+ env['REMOTE_USER'] = authorization[0]
+ # XXX REMOTE_IDENT
+ if self.headers.get('content-type') is None:
+ env['CONTENT_TYPE'] = self.headers.get_content_type()
+ else:
+ env['CONTENT_TYPE'] = self.headers['content-type']
+ length = self.headers.get('content-length')
+ if length:
+ env['CONTENT_LENGTH'] = length
+ referer = self.headers.get('referer')
+ if referer:
+ env['HTTP_REFERER'] = referer
+ accept = []
+ for line in self.headers.getallmatchingheaders('accept'):
+ if line[:1] in "\t\n\r ":
+ accept.append(line.strip())
+ else:
+ accept = accept + line[7:].split(',')
+ env['HTTP_ACCEPT'] = ','.join(accept)
+ ua = self.headers.get('user-agent')
+ if ua:
+ env['HTTP_USER_AGENT'] = ua
+ co = filter(None, self.headers.get_all('cookie', []))
+ cookie_str = ', '.join(co)
+ if cookie_str:
+ env['HTTP_COOKIE'] = cookie_str
+ # XXX Other HTTP_* headers
+ # Since we're setting the env in the parent, provide empty
+ # values to override previously set values
+ for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH',
+ 'HTTP_USER_AGENT', 'HTTP_COOKIE', 'HTTP_REFERER'):
+ env.setdefault(k, "")
+
+ self.send_response(200, "Script output follows")
+ self.flush_headers()
+
+ decoded_query = query.replace('+', ' ')
+
+ if self.have_fork:
+ # Unix -- fork as we should
+ args = [script]
+ if '=' not in decoded_query:
+ args.append(decoded_query)
+ nobody = nobody_uid()
+ self.wfile.flush() # Always flush before forking
+ pid = os.fork()
+ if pid != 0:
+ # Parent
+ pid, sts = os.waitpid(pid, 0)
+ # throw away additional data [see bug #427345]
+ while select.select([self.rfile], [], [], 0)[0]:
+ if not self.rfile.read(1):
+ break
+ if sts:
+ self.log_error("CGI script exit status %#x", sts)
+ return
+ # Child
+ try:
+ try:
+ os.setuid(nobody)
+ except os.error:
+ pass
+ os.dup2(self.rfile.fileno(), 0)
+ os.dup2(self.wfile.fileno(), 1)
+ os.execve(scriptfile, args, env)
+ except:
+ self.server.handle_error(self.request, self.client_address)
+ os._exit(127)
+
+ else:
+ # Non-Unix -- use subprocess
+ import subprocess
+ cmdline = [scriptfile]
+ if self.is_python(scriptfile):
+ interp = sys.executable
+ if interp.lower().endswith("w.exe"):
+ # On Windows, use python.exe, not pythonw.exe
+ interp = interp[:-5] + interp[-4:]
+ cmdline = [interp, '-u'] + cmdline
+ if '=' not in query:
+ cmdline.append(query)
+ self.log_message("command: %s", subprocess.list2cmdline(cmdline))
+ try:
+ nbytes = int(length)
+ except (TypeError, ValueError):
+ nbytes = 0
+ p = subprocess.Popen(cmdline,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ env = env
+ )
+ if self.command.lower() == "post" and nbytes > 0:
+ data = self.rfile.read(nbytes)
+ else:
+ data = None
+ # throw away additional data [see bug #427345]
+ while select.select([self.rfile._sock], [], [], 0)[0]:
+ if not self.rfile._sock.recv(1):
+ break
+ stdout, stderr = p.communicate(data)
+ self.wfile.write(stdout)
+ if stderr:
+ self.log_error('%s', stderr)
+ p.stderr.close()
+ p.stdout.close()
+ status = p.returncode
+ if status:
+ self.log_error("CGI script exit status %#x", status)
+ else:
+ self.log_message("CGI script exited OK")
+
+
+def test(HandlerClass = BaseHTTPRequestHandler,
+ ServerClass = HTTPServer, protocol="HTTP/1.0", port=8000):
+ """Test the HTTP request handler class.
+
+ This runs an HTTP server on port 8000 (or the first command line
+ argument).
+
+ """
+ server_address = ('', port)
+
+ HandlerClass.protocol_version = protocol
+ httpd = ServerClass(server_address, HandlerClass)
+
+ sa = httpd.socket.getsockname()
+ print("Serving HTTP on", sa[0], "port", sa[1], "...")
+ try:
+ httpd.serve_forever()
+ except KeyboardInterrupt:
+ print("\nKeyboard interrupt received, exiting.")
+ httpd.server_close()
+ sys.exit(0)
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--cgi', action='store_true',
+ help='Run as CGI Server')
+ parser.add_argument('port', action='store',
+ default=8000, type=int,
+ nargs='?',
+ help='Specify alternate port [default: 8000]')
+ args = parser.parse_args()
+ if args.cgi:
+ test(HandlerClass=CGIHTTPRequestHandler, port=args.port)
+ else:
+ test(HandlerClass=SimpleHTTPRequestHandler, port=args.port)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/misc.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/misc.py
new file mode 100644
index 0000000..03c68c1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/misc.py
@@ -0,0 +1,505 @@
+"""
+Miscellaneous function (re)definitions from the Py3.3 standard library for
+Python 2.6/2.7.
+
+math.ceil
+
+collections.OrderedDict (for Python 2.6)
+collections.Counter (for Python 2.6)
+"""
+
+from math import ceil as oldceil
+import subprocess
+
+from future.utils import iteritems, itervalues, PY26
+
+
+def ceil(x):
+ """
+ Return the ceiling of x as an int.
+ This is the smallest integral value >= x.
+ """
+ return int(oldceil(x))
+
+
+# OrderedDict Shim from Raymond Hettinger, python core dev
+# http://code.activestate.com/recipes/576693-ordered-dictionary-for-py24/
+# here to support version 2.6.
+
+if PY26:
+ # don't need this except in 2.6
+ try:
+ from thread import get_ident
+ except ImportError:
+ from dummy_thread import get_ident
+
+try:
+ from _abcoll import KeysView, ValuesView, ItemsView
+except ImportError:
+ pass
+
+
+class _OrderedDict(dict):
+
+ 'Dictionary that remembers insertion order'
+ # An inherited dict maps keys to values.
+ # The inherited dict provides __getitem__, __len__, __contains__, and get.
+ # The remaining methods are order-aware.
+ # Big-O running times for all methods are the same as for regular
+ # dictionaries.
+
+ # The internal self.__map dictionary maps keys to links in a doubly linked
+ # list. The circular doubly linked list starts and ends with a sentinel
+ # element. The sentinel element never gets deleted (this simplifies the
+ # algorithm). Each link is stored as a list of length three: [PREV, NEXT,
+ # KEY].
+
+ def __init__(self, *args, **kwds):
+ '''Initialize an ordered dictionary. Signature is the same as for
+ regular dictionaries, but keyword arguments are not recommended
+ because their insertion order is arbitrary.
+
+ '''
+ if len(args) > 1:
+ raise TypeError('expected at most 1 arguments, got %d' % len(args))
+ try:
+ self.__root
+ except AttributeError:
+ self.__root = root = [] # sentinel node
+ root[:] = [root, root, None]
+ self.__map = {}
+ self.__update(*args, **kwds)
+
+ def __setitem__(self, key, value, dict_setitem=dict.__setitem__):
+ 'od.__setitem__(i, y) <==> od[i]=y'
+ # Setting a new item creates a new link which goes at the end of the
+ # linked list, and the inherited dictionary is updated with the new
+ # key/value pair.
+ if key not in self:
+ root = self.__root
+ last = root[0]
+ last[1] = root[0] = self.__map[key] = [last, root, key]
+ dict_setitem(self, key, value)
+
+ def __delitem__(self, key, dict_delitem=dict.__delitem__):
+ 'od.__delitem__(y) <==> del od[y]'
+ # Deleting an existing item uses self.__map to find the link which is
+ # then removed by updating the links in the predecessor and successor
+ # nodes.
+ dict_delitem(self, key)
+ link_prev, link_next, key = self.__map.pop(key)
+ link_prev[1] = link_next
+ link_next[0] = link_prev
+
+ def __iter__(self):
+ 'od.__iter__() <==> iter(od)'
+ root = self.__root
+ curr = root[1]
+ while curr is not root:
+ yield curr[2]
+ curr = curr[1]
+
+ def __reversed__(self):
+ 'od.__reversed__() <==> reversed(od)'
+ root = self.__root
+ curr = root[0]
+ while curr is not root:
+ yield curr[2]
+ curr = curr[0]
+
+ def clear(self):
+ 'od.clear() -> None. Remove all items from od.'
+ try:
+ for node in itervalues(self.__map):
+ del node[:]
+ root = self.__root
+ root[:] = [root, root, None]
+ self.__map.clear()
+ except AttributeError:
+ pass
+ dict.clear(self)
+
+ def popitem(self, last=True):
+ '''od.popitem() -> (k, v), return and remove a (key, value) pair.
+ Pairs are returned in LIFO order if last is true or FIFO order if
+ false.
+ '''
+ if not self:
+ raise KeyError('dictionary is empty')
+ root = self.__root
+ if last:
+ link = root[0]
+ link_prev = link[0]
+ link_prev[1] = root
+ root[0] = link_prev
+ else:
+ link = root[1]
+ link_next = link[1]
+ root[1] = link_next
+ link_next[0] = root
+ key = link[2]
+ del self.__map[key]
+ value = dict.pop(self, key)
+ return key, value
+
+ # -- the following methods do not depend on the internal structure --
+
+ def keys(self):
+ 'od.keys() -> list of keys in od'
+ return list(self)
+
+ def values(self):
+ 'od.values() -> list of values in od'
+ return [self[key] for key in self]
+
+ def items(self):
+ 'od.items() -> list of (key, value) pairs in od'
+ return [(key, self[key]) for key in self]
+
+ def iterkeys(self):
+ 'od.iterkeys() -> an iterator over the keys in od'
+ return iter(self)
+
+ def itervalues(self):
+ 'od.itervalues -> an iterator over the values in od'
+ for k in self:
+ yield self[k]
+
+ def iteritems(self):
+ 'od.iteritems -> an iterator over the (key, value) items in od'
+ for k in self:
+ yield (k, self[k])
+
+ def update(*args, **kwds):
+ '''od.update(E, **F) -> None. Update od from dict/iterable E and F.
+
+ If E is a dict instance, does: for k in E: od[k] = E[k]
+ If E has a .keys() method, does: for k in E.keys(): od[k] = E[k]
+ Or if E is an iterable of items, does:for k, v in E: od[k] = v
+ In either case, this is followed by: for k, v in F.items(): od[k] = v
+ '''
+ if len(args) > 2:
+ raise TypeError('update() takes at most 2 positional '
+ 'arguments (%d given)' % (len(args),))
+ elif not args:
+ raise TypeError('update() takes at least 1 argument (0 given)')
+ self = args[0]
+ # Make progressively weaker assumptions about "other"
+ other = ()
+ if len(args) == 2:
+ other = args[1]
+ if isinstance(other, dict):
+ for key in other:
+ self[key] = other[key]
+ elif hasattr(other, 'keys'):
+ for key in other.keys():
+ self[key] = other[key]
+ else:
+ for key, value in other:
+ self[key] = value
+ for key, value in kwds.items():
+ self[key] = value
+ # let subclasses override update without breaking __init__
+ __update = update
+
+ __marker = object()
+
+ def pop(self, key, default=__marker):
+ '''od.pop(k[,d]) -> v, remove specified key and return the\
+ corresponding value. If key is not found, d is returned if given,
+ otherwise KeyError is raised.
+ '''
+ if key in self:
+ result = self[key]
+ del self[key]
+ return result
+ if default is self.__marker:
+ raise KeyError(key)
+ return default
+
+ def setdefault(self, key, default=None):
+ 'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od'
+ if key in self:
+ return self[key]
+ self[key] = default
+ return default
+
+ def __repr__(self, _repr_running={}):
+ 'od.__repr__() <==> repr(od)'
+ call_key = id(self), get_ident()
+ if call_key in _repr_running:
+ return '...'
+ _repr_running[call_key] = 1
+ try:
+ if not self:
+ return '%s()' % (self.__class__.__name__,)
+ return '%s(%r)' % (self.__class__.__name__, list(self.items()))
+ finally:
+ del _repr_running[call_key]
+
+ def __reduce__(self):
+ 'Return state information for pickling'
+ items = [[k, self[k]] for k in self]
+ inst_dict = vars(self).copy()
+ for k in vars(OrderedDict()):
+ inst_dict.pop(k, None)
+ if inst_dict:
+ return (self.__class__, (items,), inst_dict)
+ return self.__class__, (items,)
+
+ def copy(self):
+ 'od.copy() -> a shallow copy of od'
+ return self.__class__(self)
+
+ @classmethod
+ def fromkeys(cls, iterable, value=None):
+ '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S and
+ values equal to v (which defaults to None).
+ '''
+ d = cls()
+ for key in iterable:
+ d[key] = value
+ return d
+
+ def __eq__(self, other):
+ '''od.__eq__(y) <==> od==y. Comparison to another OD is
+ order-sensitive while comparison to a regular mapping is
+ order-insensitive.
+ '''
+ if isinstance(other, OrderedDict):
+ return (len(self) == len(other) and
+ list(self.items()) == list(other.items()))
+ return dict.__eq__(self, other)
+
+ def __ne__(self, other):
+ return not self == other
+
+ # -- the following methods are only used in Python 2.7 --
+
+ def viewkeys(self):
+ "od.viewkeys() -> a set-like object providing a view on od's keys"
+ return KeysView(self)
+
+ def viewvalues(self):
+ "od.viewvalues() -> an object providing a view on od's values"
+ return ValuesView(self)
+
+ def viewitems(self):
+ "od.viewitems() -> a set-like object providing a view on od's items"
+ return ItemsView(self)
+
+
+# {{{ http://code.activestate.com/recipes/576611/ (r11)
+
+try:
+ from operator import itemgetter
+ from heapq import nlargest
+except ImportError:
+ pass
+
+
+class _Counter(dict):
+
+ '''Dict subclass for counting hashable objects. Sometimes called a bag
+ or multiset. Elements are stored as dictionary keys and their counts
+ are stored as dictionary values.
+
+ >>> Counter('zyzygy')
+ Counter({'y': 3, 'z': 2, 'g': 1})
+
+ '''
+
+ def __init__(self, iterable=None, **kwds):
+ '''Create a new, empty Counter object. And if given, count elements
+ from an input iterable. Or, initialize the count from another mapping
+ of elements to their counts.
+
+ >>> c = Counter() # a new, empty counter
+ >>> c = Counter('gallahad') # a new counter from an iterable
+ >>> c = Counter({'a': 4, 'b': 2}) # a new counter from a mapping
+ >>> c = Counter(a=4, b=2) # a new counter from keyword args
+
+ '''
+ self.update(iterable, **kwds)
+
+ def __missing__(self, key):
+ return 0
+
+ def most_common(self, n=None):
+ '''List the n most common elements and their counts from the most
+ common to the least. If n is None, then list all element counts.
+
+ >>> Counter('abracadabra').most_common(3)
+ [('a', 5), ('r', 2), ('b', 2)]
+
+ '''
+ if n is None:
+ return sorted(iteritems(self), key=itemgetter(1), reverse=True)
+ return nlargest(n, iteritems(self), key=itemgetter(1))
+
+ def elements(self):
+ '''Iterator over elements repeating each as many times as its count.
+
+ >>> c = Counter('ABCABC')
+ >>> sorted(c.elements())
+ ['A', 'A', 'B', 'B', 'C', 'C']
+
+ If an element's count has been set to zero or is a negative number,
+ elements() will ignore it.
+
+ '''
+ for elem, count in iteritems(self):
+ for _ in range(count):
+ yield elem
+
+ # Override dict methods where the meaning changes for Counter objects.
+
+ @classmethod
+ def fromkeys(cls, iterable, v=None):
+ raise NotImplementedError(
+ 'Counter.fromkeys() is undefined. Use Counter(iterable) instead.')
+
+ def update(self, iterable=None, **kwds):
+ '''Like dict.update() but add counts instead of replacing them.
+
+ Source can be an iterable, a dictionary, or another Counter instance.
+
+ >>> c = Counter('which')
+ >>> c.update('witch') # add elements from another iterable
+ >>> d = Counter('watch')
+ >>> c.update(d) # add elements from another counter
+ >>> c['h'] # four 'h' in which, witch, and watch
+ 4
+
+ '''
+ if iterable is not None:
+ if hasattr(iterable, 'iteritems'):
+ if self:
+ self_get = self.get
+ for elem, count in iteritems(iterable):
+ self[elem] = self_get(elem, 0) + count
+ else:
+ dict.update(
+ self, iterable) # fast path when counter is empty
+ else:
+ self_get = self.get
+ for elem in iterable:
+ self[elem] = self_get(elem, 0) + 1
+ if kwds:
+ self.update(kwds)
+
+ def copy(self):
+ 'Like dict.copy() but returns a Counter instance instead of a dict.'
+ return Counter(self)
+
+ def __delitem__(self, elem):
+ '''Like dict.__delitem__() but does not raise KeyError for missing
+ values.'''
+ if elem in self:
+ dict.__delitem__(self, elem)
+
+ def __repr__(self):
+ if not self:
+ return '%s()' % self.__class__.__name__
+ items = ', '.join(map('%r: %r'.__mod__, self.most_common()))
+ return '%s({%s})' % (self.__class__.__name__, items)
+
+ # Multiset-style mathematical operations discussed in:
+ # Knuth TAOCP Volume II section 4.6.3 exercise 19
+ # and at http://en.wikipedia.org/wiki/Multiset
+ #
+ # Outputs guaranteed to only include positive counts.
+ #
+ # To strip negative and zero counts, add-in an empty counter:
+ # c += Counter()
+
+ def __add__(self, other):
+ '''Add counts from two counters.
+
+ >>> Counter('abbb') + Counter('bcc')
+ Counter({'b': 4, 'c': 2, 'a': 1})
+
+
+ '''
+ if not isinstance(other, Counter):
+ return NotImplemented
+ result = Counter()
+ for elem in set(self) | set(other):
+ newcount = self[elem] + other[elem]
+ if newcount > 0:
+ result[elem] = newcount
+ return result
+
+ def __sub__(self, other):
+ ''' Subtract count, but keep only results with positive counts.
+
+ >>> Counter('abbbc') - Counter('bccd')
+ Counter({'b': 2, 'a': 1})
+
+ '''
+ if not isinstance(other, Counter):
+ return NotImplemented
+ result = Counter()
+ for elem in set(self) | set(other):
+ newcount = self[elem] - other[elem]
+ if newcount > 0:
+ result[elem] = newcount
+ return result
+
+ def __or__(self, other):
+ '''Union is the maximum of value in either of the input counters.
+
+ >>> Counter('abbb') | Counter('bcc')
+ Counter({'b': 3, 'c': 2, 'a': 1})
+
+ '''
+ if not isinstance(other, Counter):
+ return NotImplemented
+ _max = max
+ result = Counter()
+ for elem in set(self) | set(other):
+ newcount = _max(self[elem], other[elem])
+ if newcount > 0:
+ result[elem] = newcount
+ return result
+
+ def __and__(self, other):
+ ''' Intersection is the minimum of corresponding counts.
+
+ >>> Counter('abbb') & Counter('bcc')
+ Counter({'b': 1})
+
+ '''
+ if not isinstance(other, Counter):
+ return NotImplemented
+ _min = min
+ result = Counter()
+ if len(self) < len(other):
+ self, other = other, self
+ for elem in filter(self.__contains__, other):
+ newcount = _min(self[elem], other[elem])
+ if newcount > 0:
+ result[elem] = newcount
+ return result
+
+try:
+ from collections import OrderedDict, Counter
+except ImportError:
+ # Python 2.6 doesn't have these:
+ OrderedDict = _OrderedDict
+ Counter = _Counter
+
+
+# For Python 2.6 compatibility: see http://stackoverflow.com/questions/4814970/
+def check_output(*popenargs, **kwargs):
+ if 'stdout' in kwargs:
+ raise ValueError('stdout argument not allowed, it will be overridden.')
+ process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
+ output, unused_err = process.communicate()
+ retcode = process.poll()
+ if retcode:
+ cmd = kwargs.get("args")
+ if cmd is None:
+ cmd = popenargs[0]
+ raise subprocess.CalledProcessError(retcode, cmd)
+ return output
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/socket.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/socket.py
new file mode 100644
index 0000000..84e0e9d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/socket.py
@@ -0,0 +1,451 @@
+# Wrapper module for _socket, providing some additional facilities
+# implemented in Python.
+
+"""\
+This module provides socket operations and some related functions.
+On Unix, it supports IP (Internet Protocol) and Unix domain sockets.
+On other systems, it only supports IP. Functions specific for a
+socket are available as methods of the socket object.
+
+Functions:
+
+socket() -- create a new socket object
+socketpair() -- create a pair of new socket objects [*]
+fromfd() -- create a socket object from an open file descriptor [*]
+fromshare() -- create a socket object from data received from socket.share() [*]
+gethostname() -- return the current hostname
+gethostbyname() -- map a hostname to its IP number
+gethostbyaddr() -- map an IP number or hostname to DNS info
+getservbyname() -- map a service name and a protocol name to a port number
+getprotobyname() -- map a protocol name (e.g. 'tcp') to a number
+ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order
+htons(), htonl() -- convert 16, 32 bit int from host to network byte order
+inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format
+inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89)
+socket.getdefaulttimeout() -- get the default timeout value
+socket.setdefaulttimeout() -- set the default timeout value
+create_connection() -- connects to an address, with an optional timeout and
+ optional source address.
+
+ [*] not available on all platforms!
+
+Special objects:
+
+SocketType -- type object for socket objects
+error -- exception raised for I/O errors
+has_ipv6 -- boolean value indicating if IPv6 is supported
+
+Integer constants:
+
+AF_INET, AF_UNIX -- socket domains (first argument to socket() call)
+SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument)
+
+Many other constants may be defined; these may be used in calls to
+the setsockopt() and getsockopt() methods.
+"""
+
+from __future__ import unicode_literals
+from __future__ import print_function
+from __future__ import division
+from __future__ import absolute_import
+from future.builtins import super
+
+import _socket
+from _socket import *
+
+import os, sys, io
+
+try:
+ import errno
+except ImportError:
+ errno = None
+EBADF = getattr(errno, 'EBADF', 9)
+EAGAIN = getattr(errno, 'EAGAIN', 11)
+EWOULDBLOCK = getattr(errno, 'EWOULDBLOCK', 11)
+
+__all__ = ["getfqdn", "create_connection"]
+__all__.extend(os._get_exports_list(_socket))
+
+
+_realsocket = socket
+
+# WSA error codes
+if sys.platform.lower().startswith("win"):
+ errorTab = {}
+ errorTab[10004] = "The operation was interrupted."
+ errorTab[10009] = "A bad file handle was passed."
+ errorTab[10013] = "Permission denied."
+ errorTab[10014] = "A fault occurred on the network??" # WSAEFAULT
+ errorTab[10022] = "An invalid operation was attempted."
+ errorTab[10035] = "The socket operation would block"
+ errorTab[10036] = "A blocking operation is already in progress."
+ errorTab[10048] = "The network address is in use."
+ errorTab[10054] = "The connection has been reset."
+ errorTab[10058] = "The network has been shut down."
+ errorTab[10060] = "The operation timed out."
+ errorTab[10061] = "Connection refused."
+ errorTab[10063] = "The name is too long."
+ errorTab[10064] = "The host is down."
+ errorTab[10065] = "The host is unreachable."
+ __all__.append("errorTab")
+
+
+class socket(_socket.socket):
+
+ """A subclass of _socket.socket adding the makefile() method."""
+
+ __slots__ = ["__weakref__", "_io_refs", "_closed"]
+
+ def __init__(self, family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None):
+ if fileno is None:
+ _socket.socket.__init__(self, family, type, proto)
+ else:
+ _socket.socket.__init__(self, family, type, proto, fileno)
+ self._io_refs = 0
+ self._closed = False
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *args):
+ if not self._closed:
+ self.close()
+
+ def __repr__(self):
+ """Wrap __repr__() to reveal the real class name."""
+ s = _socket.socket.__repr__(self)
+ if s.startswith(" socket object
+
+ Return a new socket object connected to the same system resource.
+ """
+ fd = dup(self.fileno())
+ sock = self.__class__(self.family, self.type, self.proto, fileno=fd)
+ sock.settimeout(self.gettimeout())
+ return sock
+
+ def accept(self):
+ """accept() -> (socket object, address info)
+
+ Wait for an incoming connection. Return a new socket
+ representing the connection, and the address of the client.
+ For IP sockets, the address info is a pair (hostaddr, port).
+ """
+ fd, addr = self._accept()
+ sock = socket(self.family, self.type, self.proto, fileno=fd)
+ # Issue #7995: if no default timeout is set and the listening
+ # socket had a (non-zero) timeout, force the new socket in blocking
+ # mode to override platform-specific socket flags inheritance.
+ if getdefaulttimeout() is None and self.gettimeout():
+ sock.setblocking(True)
+ return sock, addr
+
+ def makefile(self, mode="r", buffering=None, **_3to2kwargs):
+ """makefile(...) -> an I/O stream connected to the socket
+
+ The arguments are as for io.open() after the filename,
+ except the only mode characters supported are 'r', 'w' and 'b'.
+ The semantics are similar too. (XXX refactor to share code?)
+ """
+ if 'newline' in _3to2kwargs: newline = _3to2kwargs['newline']; del _3to2kwargs['newline']
+ else: newline = None
+ if 'errors' in _3to2kwargs: errors = _3to2kwargs['errors']; del _3to2kwargs['errors']
+ else: errors = None
+ if 'encoding' in _3to2kwargs: encoding = _3to2kwargs['encoding']; del _3to2kwargs['encoding']
+ else: encoding = None
+ for c in mode:
+ if c not in ("r", "w", "b"):
+ raise ValueError("invalid mode %r (only r, w, b allowed)")
+ writing = "w" in mode
+ reading = "r" in mode or not writing
+ assert reading or writing
+ binary = "b" in mode
+ rawmode = ""
+ if reading:
+ rawmode += "r"
+ if writing:
+ rawmode += "w"
+ raw = SocketIO(self, rawmode)
+ self._io_refs += 1
+ if buffering is None:
+ buffering = -1
+ if buffering < 0:
+ buffering = io.DEFAULT_BUFFER_SIZE
+ if buffering == 0:
+ if not binary:
+ raise ValueError("unbuffered streams must be binary")
+ return raw
+ if reading and writing:
+ buffer = io.BufferedRWPair(raw, raw, buffering)
+ elif reading:
+ buffer = io.BufferedReader(raw, buffering)
+ else:
+ assert writing
+ buffer = io.BufferedWriter(raw, buffering)
+ if binary:
+ return buffer
+ text = io.TextIOWrapper(buffer, encoding, errors, newline)
+ text.mode = mode
+ return text
+
+ def _decref_socketios(self):
+ if self._io_refs > 0:
+ self._io_refs -= 1
+ if self._closed:
+ self.close()
+
+ def _real_close(self, _ss=_socket.socket):
+ # This function should not reference any globals. See issue #808164.
+ _ss.close(self)
+
+ def close(self):
+ # This function should not reference any globals. See issue #808164.
+ self._closed = True
+ if self._io_refs <= 0:
+ self._real_close()
+
+ def detach(self):
+ """detach() -> file descriptor
+
+ Close the socket object without closing the underlying file descriptor.
+ The object cannot be used after this call, but the file descriptor
+ can be reused for other purposes. The file descriptor is returned.
+ """
+ self._closed = True
+ return super().detach()
+
+def fromfd(fd, family, type, proto=0):
+ """ fromfd(fd, family, type[, proto]) -> socket object
+
+ Create a socket object from a duplicate of the given file
+ descriptor. The remaining arguments are the same as for socket().
+ """
+ nfd = dup(fd)
+ return socket(family, type, proto, nfd)
+
+if hasattr(_socket.socket, "share"):
+ def fromshare(info):
+ """ fromshare(info) -> socket object
+
+ Create a socket object from a the bytes object returned by
+ socket.share(pid).
+ """
+ return socket(0, 0, 0, info)
+
+if hasattr(_socket, "socketpair"):
+
+ def socketpair(family=None, type=SOCK_STREAM, proto=0):
+ """socketpair([family[, type[, proto]]]) -> (socket object, socket object)
+
+ Create a pair of socket objects from the sockets returned by the platform
+ socketpair() function.
+ The arguments are the same as for socket() except the default family is
+ AF_UNIX if defined on the platform; otherwise, the default is AF_INET.
+ """
+ if family is None:
+ try:
+ family = AF_UNIX
+ except NameError:
+ family = AF_INET
+ a, b = _socket.socketpair(family, type, proto)
+ a = socket(family, type, proto, a.detach())
+ b = socket(family, type, proto, b.detach())
+ return a, b
+
+
+_blocking_errnos = set([EAGAIN, EWOULDBLOCK])
+
+class SocketIO(io.RawIOBase):
+
+ """Raw I/O implementation for stream sockets.
+
+ This class supports the makefile() method on sockets. It provides
+ the raw I/O interface on top of a socket object.
+ """
+
+ # One might wonder why not let FileIO do the job instead. There are two
+ # main reasons why FileIO is not adapted:
+ # - it wouldn't work under Windows (where you can't used read() and
+ # write() on a socket handle)
+ # - it wouldn't work with socket timeouts (FileIO would ignore the
+ # timeout and consider the socket non-blocking)
+
+ # XXX More docs
+
+ def __init__(self, sock, mode):
+ if mode not in ("r", "w", "rw", "rb", "wb", "rwb"):
+ raise ValueError("invalid mode: %r" % mode)
+ io.RawIOBase.__init__(self)
+ self._sock = sock
+ if "b" not in mode:
+ mode += "b"
+ self._mode = mode
+ self._reading = "r" in mode
+ self._writing = "w" in mode
+ self._timeout_occurred = False
+
+ def readinto(self, b):
+ """Read up to len(b) bytes into the writable buffer *b* and return
+ the number of bytes read. If the socket is non-blocking and no bytes
+ are available, None is returned.
+
+ If *b* is non-empty, a 0 return value indicates that the connection
+ was shutdown at the other end.
+ """
+ self._checkClosed()
+ self._checkReadable()
+ if self._timeout_occurred:
+ raise IOError("cannot read from timed out object")
+ while True:
+ try:
+ return self._sock.recv_into(b)
+ except timeout:
+ self._timeout_occurred = True
+ raise
+ # except InterruptedError:
+ # continue
+ except error as e:
+ if e.args[0] in _blocking_errnos:
+ return None
+ raise
+
+ def write(self, b):
+ """Write the given bytes or bytearray object *b* to the socket
+ and return the number of bytes written. This can be less than
+ len(b) if not all data could be written. If the socket is
+ non-blocking and no bytes could be written None is returned.
+ """
+ self._checkClosed()
+ self._checkWritable()
+ try:
+ return self._sock.send(b)
+ except error as e:
+ # XXX what about EINTR?
+ if e.args[0] in _blocking_errnos:
+ return None
+ raise
+
+ def readable(self):
+ """True if the SocketIO is open for reading.
+ """
+ if self.closed:
+ raise ValueError("I/O operation on closed socket.")
+ return self._reading
+
+ def writable(self):
+ """True if the SocketIO is open for writing.
+ """
+ if self.closed:
+ raise ValueError("I/O operation on closed socket.")
+ return self._writing
+
+ def seekable(self):
+ """True if the SocketIO is open for seeking.
+ """
+ if self.closed:
+ raise ValueError("I/O operation on closed socket.")
+ return super().seekable()
+
+ def fileno(self):
+ """Return the file descriptor of the underlying socket.
+ """
+ self._checkClosed()
+ return self._sock.fileno()
+
+ @property
+ def name(self):
+ if not self.closed:
+ return self.fileno()
+ else:
+ return -1
+
+ @property
+ def mode(self):
+ return self._mode
+
+ def close(self):
+ """Close the SocketIO object. This doesn't close the underlying
+ socket, except if all references to it have disappeared.
+ """
+ if self.closed:
+ return
+ io.RawIOBase.close(self)
+ self._sock._decref_socketios()
+ self._sock = None
+
+
+def getfqdn(name=''):
+ """Get fully qualified domain name from name.
+
+ An empty argument is interpreted as meaning the local host.
+
+ First the hostname returned by gethostbyaddr() is checked, then
+ possibly existing aliases. In case no FQDN is available, hostname
+ from gethostname() is returned.
+ """
+ name = name.strip()
+ if not name or name == '0.0.0.0':
+ name = gethostname()
+ try:
+ hostname, aliases, ipaddrs = gethostbyaddr(name)
+ except error:
+ pass
+ else:
+ aliases.insert(0, hostname)
+ for name in aliases:
+ if '.' in name:
+ break
+ else:
+ name = hostname
+ return name
+
+
+_GLOBAL_DEFAULT_TIMEOUT = object()
+
+def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT,
+ source_address=None):
+ """Connect to *address* and return the socket object.
+
+ Convenience function. Connect to *address* (a 2-tuple ``(host,
+ port)``) and return the socket object. Passing the optional
+ *timeout* parameter will set the timeout on the socket instance
+ before attempting to connect. If no *timeout* is supplied, the
+ global default timeout setting returned by :func:`getdefaulttimeout`
+ is used. If *source_address* is set it must be a tuple of (host, port)
+ for the socket to bind as a source address before making the connection.
+ An host of '' or port 0 tells the OS to use the default.
+ """
+
+ host, port = address
+ err = None
+ for res in getaddrinfo(host, port, 0, SOCK_STREAM):
+ af, socktype, proto, canonname, sa = res
+ sock = None
+ try:
+ sock = socket(af, socktype, proto)
+ if timeout is not _GLOBAL_DEFAULT_TIMEOUT:
+ sock.settimeout(timeout)
+ if source_address:
+ sock.bind(source_address)
+ sock.connect(sa)
+ return sock
+
+ except error as _:
+ err = _
+ if sock is not None:
+ sock.close()
+
+ if err is not None:
+ raise err
+ else:
+ raise error("getaddrinfo returns an empty list")
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/socketserver.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/socketserver.py
new file mode 100644
index 0000000..d1e24a6
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/socketserver.py
@@ -0,0 +1,747 @@
+"""Generic socket server classes.
+
+This module tries to capture the various aspects of defining a server:
+
+For socket-based servers:
+
+- address family:
+ - AF_INET{,6}: IP (Internet Protocol) sockets (default)
+ - AF_UNIX: Unix domain sockets
+ - others, e.g. AF_DECNET are conceivable (see
+- socket type:
+ - SOCK_STREAM (reliable stream, e.g. TCP)
+ - SOCK_DGRAM (datagrams, e.g. UDP)
+
+For request-based servers (including socket-based):
+
+- client address verification before further looking at the request
+ (This is actually a hook for any processing that needs to look
+ at the request before anything else, e.g. logging)
+- how to handle multiple requests:
+ - synchronous (one request is handled at a time)
+ - forking (each request is handled by a new process)
+ - threading (each request is handled by a new thread)
+
+The classes in this module favor the server type that is simplest to
+write: a synchronous TCP/IP server. This is bad class design, but
+save some typing. (There's also the issue that a deep class hierarchy
+slows down method lookups.)
+
+There are five classes in an inheritance diagram, four of which represent
+synchronous servers of four types:
+
+ +------------+
+ | BaseServer |
+ +------------+
+ |
+ v
+ +-----------+ +------------------+
+ | TCPServer |------->| UnixStreamServer |
+ +-----------+ +------------------+
+ |
+ v
+ +-----------+ +--------------------+
+ | UDPServer |------->| UnixDatagramServer |
+ +-----------+ +--------------------+
+
+Note that UnixDatagramServer derives from UDPServer, not from
+UnixStreamServer -- the only difference between an IP and a Unix
+stream server is the address family, which is simply repeated in both
+unix server classes.
+
+Forking and threading versions of each type of server can be created
+using the ForkingMixIn and ThreadingMixIn mix-in classes. For
+instance, a threading UDP server class is created as follows:
+
+ class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass
+
+The Mix-in class must come first, since it overrides a method defined
+in UDPServer! Setting the various member variables also changes
+the behavior of the underlying server mechanism.
+
+To implement a service, you must derive a class from
+BaseRequestHandler and redefine its handle() method. You can then run
+various versions of the service by combining one of the server classes
+with your request handler class.
+
+The request handler class must be different for datagram or stream
+services. This can be hidden by using the request handler
+subclasses StreamRequestHandler or DatagramRequestHandler.
+
+Of course, you still have to use your head!
+
+For instance, it makes no sense to use a forking server if the service
+contains state in memory that can be modified by requests (since the
+modifications in the child process would never reach the initial state
+kept in the parent process and passed to each child). In this case,
+you can use a threading server, but you will probably have to use
+locks to avoid two requests that come in nearly simultaneous to apply
+conflicting changes to the server state.
+
+On the other hand, if you are building e.g. an HTTP server, where all
+data is stored externally (e.g. in the file system), a synchronous
+class will essentially render the service "deaf" while one request is
+being handled -- which may be for a very long time if a client is slow
+to read all the data it has requested. Here a threading or forking
+server is appropriate.
+
+In some cases, it may be appropriate to process part of a request
+synchronously, but to finish processing in a forked child depending on
+the request data. This can be implemented by using a synchronous
+server and doing an explicit fork in the request handler class
+handle() method.
+
+Another approach to handling multiple simultaneous requests in an
+environment that supports neither threads nor fork (or where these are
+too expensive or inappropriate for the service) is to maintain an
+explicit table of partially finished requests and to use select() to
+decide which request to work on next (or whether to handle a new
+incoming request). This is particularly important for stream services
+where each client can potentially be connected for a long time (if
+threads or subprocesses cannot be used).
+
+Future work:
+- Standard classes for Sun RPC (which uses either UDP or TCP)
+- Standard mix-in classes to implement various authentication
+ and encryption schemes
+- Standard framework for select-based multiplexing
+
+XXX Open problems:
+- What to do with out-of-band data?
+
+BaseServer:
+- split generic "request" functionality out into BaseServer class.
+ Copyright (C) 2000 Luke Kenneth Casson Leighton
+
+ example: read entries from a SQL database (requires overriding
+ get_request() to return a table entry from the database).
+ entry is processed by a RequestHandlerClass.
+
+"""
+
+# Author of the BaseServer patch: Luke Kenneth Casson Leighton
+
+# XXX Warning!
+# There is a test suite for this module, but it cannot be run by the
+# standard regression test.
+# To run it manually, run Lib/test/test_socketserver.py.
+
+from __future__ import (absolute_import, print_function)
+
+__version__ = "0.4"
+
+
+import socket
+import select
+import sys
+import os
+import errno
+try:
+ import threading
+except ImportError:
+ import dummy_threading as threading
+
+__all__ = ["TCPServer","UDPServer","ForkingUDPServer","ForkingTCPServer",
+ "ThreadingUDPServer","ThreadingTCPServer","BaseRequestHandler",
+ "StreamRequestHandler","DatagramRequestHandler",
+ "ThreadingMixIn", "ForkingMixIn"]
+if hasattr(socket, "AF_UNIX"):
+ __all__.extend(["UnixStreamServer","UnixDatagramServer",
+ "ThreadingUnixStreamServer",
+ "ThreadingUnixDatagramServer"])
+
+def _eintr_retry(func, *args):
+ """restart a system call interrupted by EINTR"""
+ while True:
+ try:
+ return func(*args)
+ except OSError as e:
+ if e.errno != errno.EINTR:
+ raise
+
+class BaseServer(object):
+
+ """Base class for server classes.
+
+ Methods for the caller:
+
+ - __init__(server_address, RequestHandlerClass)
+ - serve_forever(poll_interval=0.5)
+ - shutdown()
+ - handle_request() # if you do not use serve_forever()
+ - fileno() -> int # for select()
+
+ Methods that may be overridden:
+
+ - server_bind()
+ - server_activate()
+ - get_request() -> request, client_address
+ - handle_timeout()
+ - verify_request(request, client_address)
+ - server_close()
+ - process_request(request, client_address)
+ - shutdown_request(request)
+ - close_request(request)
+ - service_actions()
+ - handle_error()
+
+ Methods for derived classes:
+
+ - finish_request(request, client_address)
+
+ Class variables that may be overridden by derived classes or
+ instances:
+
+ - timeout
+ - address_family
+ - socket_type
+ - allow_reuse_address
+
+ Instance variables:
+
+ - RequestHandlerClass
+ - socket
+
+ """
+
+ timeout = None
+
+ def __init__(self, server_address, RequestHandlerClass):
+ """Constructor. May be extended, do not override."""
+ self.server_address = server_address
+ self.RequestHandlerClass = RequestHandlerClass
+ self.__is_shut_down = threading.Event()
+ self.__shutdown_request = False
+
+ def server_activate(self):
+ """Called by constructor to activate the server.
+
+ May be overridden.
+
+ """
+ pass
+
+ def serve_forever(self, poll_interval=0.5):
+ """Handle one request at a time until shutdown.
+
+ Polls for shutdown every poll_interval seconds. Ignores
+ self.timeout. If you need to do periodic tasks, do them in
+ another thread.
+ """
+ self.__is_shut_down.clear()
+ try:
+ while not self.__shutdown_request:
+ # XXX: Consider using another file descriptor or
+ # connecting to the socket to wake this up instead of
+ # polling. Polling reduces our responsiveness to a
+ # shutdown request and wastes cpu at all other times.
+ r, w, e = _eintr_retry(select.select, [self], [], [],
+ poll_interval)
+ if self in r:
+ self._handle_request_noblock()
+
+ self.service_actions()
+ finally:
+ self.__shutdown_request = False
+ self.__is_shut_down.set()
+
+ def shutdown(self):
+ """Stops the serve_forever loop.
+
+ Blocks until the loop has finished. This must be called while
+ serve_forever() is running in another thread, or it will
+ deadlock.
+ """
+ self.__shutdown_request = True
+ self.__is_shut_down.wait()
+
+ def service_actions(self):
+ """Called by the serve_forever() loop.
+
+ May be overridden by a subclass / Mixin to implement any code that
+ needs to be run during the loop.
+ """
+ pass
+
+ # The distinction between handling, getting, processing and
+ # finishing a request is fairly arbitrary. Remember:
+ #
+ # - handle_request() is the top-level call. It calls
+ # select, get_request(), verify_request() and process_request()
+ # - get_request() is different for stream or datagram sockets
+ # - process_request() is the place that may fork a new process
+ # or create a new thread to finish the request
+ # - finish_request() instantiates the request handler class;
+ # this constructor will handle the request all by itself
+
+ def handle_request(self):
+ """Handle one request, possibly blocking.
+
+ Respects self.timeout.
+ """
+ # Support people who used socket.settimeout() to escape
+ # handle_request before self.timeout was available.
+ timeout = self.socket.gettimeout()
+ if timeout is None:
+ timeout = self.timeout
+ elif self.timeout is not None:
+ timeout = min(timeout, self.timeout)
+ fd_sets = _eintr_retry(select.select, [self], [], [], timeout)
+ if not fd_sets[0]:
+ self.handle_timeout()
+ return
+ self._handle_request_noblock()
+
+ def _handle_request_noblock(self):
+ """Handle one request, without blocking.
+
+ I assume that select.select has returned that the socket is
+ readable before this function was called, so there should be
+ no risk of blocking in get_request().
+ """
+ try:
+ request, client_address = self.get_request()
+ except socket.error:
+ return
+ if self.verify_request(request, client_address):
+ try:
+ self.process_request(request, client_address)
+ except:
+ self.handle_error(request, client_address)
+ self.shutdown_request(request)
+
+ def handle_timeout(self):
+ """Called if no new request arrives within self.timeout.
+
+ Overridden by ForkingMixIn.
+ """
+ pass
+
+ def verify_request(self, request, client_address):
+ """Verify the request. May be overridden.
+
+ Return True if we should proceed with this request.
+
+ """
+ return True
+
+ def process_request(self, request, client_address):
+ """Call finish_request.
+
+ Overridden by ForkingMixIn and ThreadingMixIn.
+
+ """
+ self.finish_request(request, client_address)
+ self.shutdown_request(request)
+
+ def server_close(self):
+ """Called to clean-up the server.
+
+ May be overridden.
+
+ """
+ pass
+
+ def finish_request(self, request, client_address):
+ """Finish one request by instantiating RequestHandlerClass."""
+ self.RequestHandlerClass(request, client_address, self)
+
+ def shutdown_request(self, request):
+ """Called to shutdown and close an individual request."""
+ self.close_request(request)
+
+ def close_request(self, request):
+ """Called to clean up an individual request."""
+ pass
+
+ def handle_error(self, request, client_address):
+ """Handle an error gracefully. May be overridden.
+
+ The default is to print a traceback and continue.
+
+ """
+ print('-'*40)
+ print('Exception happened during processing of request from', end=' ')
+ print(client_address)
+ import traceback
+ traceback.print_exc() # XXX But this goes to stderr!
+ print('-'*40)
+
+
+class TCPServer(BaseServer):
+
+ """Base class for various socket-based server classes.
+
+ Defaults to synchronous IP stream (i.e., TCP).
+
+ Methods for the caller:
+
+ - __init__(server_address, RequestHandlerClass, bind_and_activate=True)
+ - serve_forever(poll_interval=0.5)
+ - shutdown()
+ - handle_request() # if you don't use serve_forever()
+ - fileno() -> int # for select()
+
+ Methods that may be overridden:
+
+ - server_bind()
+ - server_activate()
+ - get_request() -> request, client_address
+ - handle_timeout()
+ - verify_request(request, client_address)
+ - process_request(request, client_address)
+ - shutdown_request(request)
+ - close_request(request)
+ - handle_error()
+
+ Methods for derived classes:
+
+ - finish_request(request, client_address)
+
+ Class variables that may be overridden by derived classes or
+ instances:
+
+ - timeout
+ - address_family
+ - socket_type
+ - request_queue_size (only for stream sockets)
+ - allow_reuse_address
+
+ Instance variables:
+
+ - server_address
+ - RequestHandlerClass
+ - socket
+
+ """
+
+ address_family = socket.AF_INET
+
+ socket_type = socket.SOCK_STREAM
+
+ request_queue_size = 5
+
+ allow_reuse_address = False
+
+ def __init__(self, server_address, RequestHandlerClass, bind_and_activate=True):
+ """Constructor. May be extended, do not override."""
+ BaseServer.__init__(self, server_address, RequestHandlerClass)
+ self.socket = socket.socket(self.address_family,
+ self.socket_type)
+ if bind_and_activate:
+ self.server_bind()
+ self.server_activate()
+
+ def server_bind(self):
+ """Called by constructor to bind the socket.
+
+ May be overridden.
+
+ """
+ if self.allow_reuse_address:
+ self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ self.socket.bind(self.server_address)
+ self.server_address = self.socket.getsockname()
+
+ def server_activate(self):
+ """Called by constructor to activate the server.
+
+ May be overridden.
+
+ """
+ self.socket.listen(self.request_queue_size)
+
+ def server_close(self):
+ """Called to clean-up the server.
+
+ May be overridden.
+
+ """
+ self.socket.close()
+
+ def fileno(self):
+ """Return socket file number.
+
+ Interface required by select().
+
+ """
+ return self.socket.fileno()
+
+ def get_request(self):
+ """Get the request and client address from the socket.
+
+ May be overridden.
+
+ """
+ return self.socket.accept()
+
+ def shutdown_request(self, request):
+ """Called to shutdown and close an individual request."""
+ try:
+ #explicitly shutdown. socket.close() merely releases
+ #the socket and waits for GC to perform the actual close.
+ request.shutdown(socket.SHUT_WR)
+ except socket.error:
+ pass #some platforms may raise ENOTCONN here
+ self.close_request(request)
+
+ def close_request(self, request):
+ """Called to clean up an individual request."""
+ request.close()
+
+
+class UDPServer(TCPServer):
+
+ """UDP server class."""
+
+ allow_reuse_address = False
+
+ socket_type = socket.SOCK_DGRAM
+
+ max_packet_size = 8192
+
+ def get_request(self):
+ data, client_addr = self.socket.recvfrom(self.max_packet_size)
+ return (data, self.socket), client_addr
+
+ def server_activate(self):
+ # No need to call listen() for UDP.
+ pass
+
+ def shutdown_request(self, request):
+ # No need to shutdown anything.
+ self.close_request(request)
+
+ def close_request(self, request):
+ # No need to close anything.
+ pass
+
+class ForkingMixIn(object):
+
+ """Mix-in class to handle each request in a new process."""
+
+ timeout = 300
+ active_children = None
+ max_children = 40
+
+ def collect_children(self):
+ """Internal routine to wait for children that have exited."""
+ if self.active_children is None: return
+ while len(self.active_children) >= self.max_children:
+ # XXX: This will wait for any child process, not just ones
+ # spawned by this library. This could confuse other
+ # libraries that expect to be able to wait for their own
+ # children.
+ try:
+ pid, status = os.waitpid(0, 0)
+ except os.error:
+ pid = None
+ if pid not in self.active_children: continue
+ self.active_children.remove(pid)
+
+ # XXX: This loop runs more system calls than it ought
+ # to. There should be a way to put the active_children into a
+ # process group and then use os.waitpid(-pgid) to wait for any
+ # of that set, but I couldn't find a way to allocate pgids
+ # that couldn't collide.
+ for child in self.active_children:
+ try:
+ pid, status = os.waitpid(child, os.WNOHANG)
+ except os.error:
+ pid = None
+ if not pid: continue
+ try:
+ self.active_children.remove(pid)
+ except ValueError as e:
+ raise ValueError('%s. x=%d and list=%r' % (e.message, pid,
+ self.active_children))
+
+ def handle_timeout(self):
+ """Wait for zombies after self.timeout seconds of inactivity.
+
+ May be extended, do not override.
+ """
+ self.collect_children()
+
+ def service_actions(self):
+ """Collect the zombie child processes regularly in the ForkingMixIn.
+
+ service_actions is called in the BaseServer's serve_forver loop.
+ """
+ self.collect_children()
+
+ def process_request(self, request, client_address):
+ """Fork a new subprocess to process the request."""
+ pid = os.fork()
+ if pid:
+ # Parent process
+ if self.active_children is None:
+ self.active_children = []
+ self.active_children.append(pid)
+ self.close_request(request)
+ return
+ else:
+ # Child process.
+ # This must never return, hence os._exit()!
+ try:
+ self.finish_request(request, client_address)
+ self.shutdown_request(request)
+ os._exit(0)
+ except:
+ try:
+ self.handle_error(request, client_address)
+ self.shutdown_request(request)
+ finally:
+ os._exit(1)
+
+
+class ThreadingMixIn(object):
+ """Mix-in class to handle each request in a new thread."""
+
+ # Decides how threads will act upon termination of the
+ # main process
+ daemon_threads = False
+
+ def process_request_thread(self, request, client_address):
+ """Same as in BaseServer but as a thread.
+
+ In addition, exception handling is done here.
+
+ """
+ try:
+ self.finish_request(request, client_address)
+ self.shutdown_request(request)
+ except:
+ self.handle_error(request, client_address)
+ self.shutdown_request(request)
+
+ def process_request(self, request, client_address):
+ """Start a new thread to process the request."""
+ t = threading.Thread(target = self.process_request_thread,
+ args = (request, client_address))
+ t.daemon = self.daemon_threads
+ t.start()
+
+
+class ForkingUDPServer(ForkingMixIn, UDPServer): pass
+class ForkingTCPServer(ForkingMixIn, TCPServer): pass
+
+class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass
+class ThreadingTCPServer(ThreadingMixIn, TCPServer): pass
+
+if hasattr(socket, 'AF_UNIX'):
+
+ class UnixStreamServer(TCPServer):
+ address_family = socket.AF_UNIX
+
+ class UnixDatagramServer(UDPServer):
+ address_family = socket.AF_UNIX
+
+ class ThreadingUnixStreamServer(ThreadingMixIn, UnixStreamServer): pass
+
+ class ThreadingUnixDatagramServer(ThreadingMixIn, UnixDatagramServer): pass
+
+class BaseRequestHandler(object):
+
+ """Base class for request handler classes.
+
+ This class is instantiated for each request to be handled. The
+ constructor sets the instance variables request, client_address
+ and server, and then calls the handle() method. To implement a
+ specific service, all you need to do is to derive a class which
+ defines a handle() method.
+
+ The handle() method can find the request as self.request, the
+ client address as self.client_address, and the server (in case it
+ needs access to per-server information) as self.server. Since a
+ separate instance is created for each request, the handle() method
+ can define arbitrary other instance variariables.
+
+ """
+
+ def __init__(self, request, client_address, server):
+ self.request = request
+ self.client_address = client_address
+ self.server = server
+ self.setup()
+ try:
+ self.handle()
+ finally:
+ self.finish()
+
+ def setup(self):
+ pass
+
+ def handle(self):
+ pass
+
+ def finish(self):
+ pass
+
+
+# The following two classes make it possible to use the same service
+# class for stream or datagram servers.
+# Each class sets up these instance variables:
+# - rfile: a file object from which receives the request is read
+# - wfile: a file object to which the reply is written
+# When the handle() method returns, wfile is flushed properly
+
+
+class StreamRequestHandler(BaseRequestHandler):
+
+ """Define self.rfile and self.wfile for stream sockets."""
+
+ # Default buffer sizes for rfile, wfile.
+ # We default rfile to buffered because otherwise it could be
+ # really slow for large data (a getc() call per byte); we make
+ # wfile unbuffered because (a) often after a write() we want to
+ # read and we need to flush the line; (b) big writes to unbuffered
+ # files are typically optimized by stdio even when big reads
+ # aren't.
+ rbufsize = -1
+ wbufsize = 0
+
+ # A timeout to apply to the request socket, if not None.
+ timeout = None
+
+ # Disable nagle algorithm for this socket, if True.
+ # Use only when wbufsize != 0, to avoid small packets.
+ disable_nagle_algorithm = False
+
+ def setup(self):
+ self.connection = self.request
+ if self.timeout is not None:
+ self.connection.settimeout(self.timeout)
+ if self.disable_nagle_algorithm:
+ self.connection.setsockopt(socket.IPPROTO_TCP,
+ socket.TCP_NODELAY, True)
+ self.rfile = self.connection.makefile('rb', self.rbufsize)
+ self.wfile = self.connection.makefile('wb', self.wbufsize)
+
+ def finish(self):
+ if not self.wfile.closed:
+ try:
+ self.wfile.flush()
+ except socket.error:
+ # An final socket error may have occurred here, such as
+ # the local error ECONNABORTED.
+ pass
+ self.wfile.close()
+ self.rfile.close()
+
+
+class DatagramRequestHandler(BaseRequestHandler):
+
+ # XXX Regrettably, I cannot get this working on Linux;
+ # s.recvfrom() doesn't return a meaningful client address.
+
+ """Define self.rfile and self.wfile for datagram sockets."""
+
+ def setup(self):
+ from io import BytesIO
+ self.packet, self.socket = self.request
+ self.rfile = BytesIO(self.packet)
+ self.wfile = BytesIO()
+
+ def finish(self):
+ self.socket.sendto(self.wfile.getvalue(), self.client_address)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/test/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/test/__init__.py
new file mode 100644
index 0000000..0bba5e6
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/test/__init__.py
@@ -0,0 +1,9 @@
+"""
+test package backported for python-future.
+
+Its primary purpose is to allow use of "import test.support" for running
+the Python standard library unit tests using the new Python 3 stdlib
+import location.
+
+Python 3 renamed test.test_support to test.support.
+"""
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/test/pystone.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/test/pystone.py
new file mode 100644
index 0000000..7652027
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/test/pystone.py
@@ -0,0 +1,272 @@
+#!/usr/bin/env python3
+
+"""
+"PYSTONE" Benchmark Program
+
+Version: Python/1.1 (corresponds to C/1.1 plus 2 Pystone fixes)
+
+Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013.
+
+ Translated from ADA to C by Rick Richardson.
+ Every method to preserve ADA-likeness has been used,
+ at the expense of C-ness.
+
+ Translated from C to Python by Guido van Rossum.
+
+Version History:
+
+ Version 1.1 corrects two bugs in version 1.0:
+
+ First, it leaked memory: in Proc1(), NextRecord ends
+ up having a pointer to itself. I have corrected this
+ by zapping NextRecord.PtrComp at the end of Proc1().
+
+ Second, Proc3() used the operator != to compare a
+ record to None. This is rather inefficient and not
+ true to the intention of the original benchmark (where
+ a pointer comparison to None is intended; the !=
+ operator attempts to find a method __cmp__ to do value
+ comparison of the record). Version 1.1 runs 5-10
+ percent faster than version 1.0, so benchmark figures
+ of different versions can't be compared directly.
+
+"""
+
+from __future__ import print_function
+
+from time import clock
+
+LOOPS = 50000
+
+__version__ = "1.1"
+
+[Ident1, Ident2, Ident3, Ident4, Ident5] = range(1, 6)
+
+class Record(object):
+
+ def __init__(self, PtrComp = None, Discr = 0, EnumComp = 0,
+ IntComp = 0, StringComp = 0):
+ self.PtrComp = PtrComp
+ self.Discr = Discr
+ self.EnumComp = EnumComp
+ self.IntComp = IntComp
+ self.StringComp = StringComp
+
+ def copy(self):
+ return Record(self.PtrComp, self.Discr, self.EnumComp,
+ self.IntComp, self.StringComp)
+
+TRUE = 1
+FALSE = 0
+
+def main(loops=LOOPS):
+ benchtime, stones = pystones(loops)
+ print("Pystone(%s) time for %d passes = %g" % \
+ (__version__, loops, benchtime))
+ print("This machine benchmarks at %g pystones/second" % stones)
+
+
+def pystones(loops=LOOPS):
+ return Proc0(loops)
+
+IntGlob = 0
+BoolGlob = FALSE
+Char1Glob = '\0'
+Char2Glob = '\0'
+Array1Glob = [0]*51
+Array2Glob = [x[:] for x in [Array1Glob]*51]
+PtrGlb = None
+PtrGlbNext = None
+
+def Proc0(loops=LOOPS):
+ global IntGlob
+ global BoolGlob
+ global Char1Glob
+ global Char2Glob
+ global Array1Glob
+ global Array2Glob
+ global PtrGlb
+ global PtrGlbNext
+
+ starttime = clock()
+ for i in range(loops):
+ pass
+ nulltime = clock() - starttime
+
+ PtrGlbNext = Record()
+ PtrGlb = Record()
+ PtrGlb.PtrComp = PtrGlbNext
+ PtrGlb.Discr = Ident1
+ PtrGlb.EnumComp = Ident3
+ PtrGlb.IntComp = 40
+ PtrGlb.StringComp = "DHRYSTONE PROGRAM, SOME STRING"
+ String1Loc = "DHRYSTONE PROGRAM, 1'ST STRING"
+ Array2Glob[8][7] = 10
+
+ starttime = clock()
+
+ for i in range(loops):
+ Proc5()
+ Proc4()
+ IntLoc1 = 2
+ IntLoc2 = 3
+ String2Loc = "DHRYSTONE PROGRAM, 2'ND STRING"
+ EnumLoc = Ident2
+ BoolGlob = not Func2(String1Loc, String2Loc)
+ while IntLoc1 < IntLoc2:
+ IntLoc3 = 5 * IntLoc1 - IntLoc2
+ IntLoc3 = Proc7(IntLoc1, IntLoc2)
+ IntLoc1 = IntLoc1 + 1
+ Proc8(Array1Glob, Array2Glob, IntLoc1, IntLoc3)
+ PtrGlb = Proc1(PtrGlb)
+ CharIndex = 'A'
+ while CharIndex <= Char2Glob:
+ if EnumLoc == Func1(CharIndex, 'C'):
+ EnumLoc = Proc6(Ident1)
+ CharIndex = chr(ord(CharIndex)+1)
+ IntLoc3 = IntLoc2 * IntLoc1
+ IntLoc2 = IntLoc3 / IntLoc1
+ IntLoc2 = 7 * (IntLoc3 - IntLoc2) - IntLoc1
+ IntLoc1 = Proc2(IntLoc1)
+
+ benchtime = clock() - starttime - nulltime
+ if benchtime == 0.0:
+ loopsPerBenchtime = 0.0
+ else:
+ loopsPerBenchtime = (loops / benchtime)
+ return benchtime, loopsPerBenchtime
+
+def Proc1(PtrParIn):
+ PtrParIn.PtrComp = NextRecord = PtrGlb.copy()
+ PtrParIn.IntComp = 5
+ NextRecord.IntComp = PtrParIn.IntComp
+ NextRecord.PtrComp = PtrParIn.PtrComp
+ NextRecord.PtrComp = Proc3(NextRecord.PtrComp)
+ if NextRecord.Discr == Ident1:
+ NextRecord.IntComp = 6
+ NextRecord.EnumComp = Proc6(PtrParIn.EnumComp)
+ NextRecord.PtrComp = PtrGlb.PtrComp
+ NextRecord.IntComp = Proc7(NextRecord.IntComp, 10)
+ else:
+ PtrParIn = NextRecord.copy()
+ NextRecord.PtrComp = None
+ return PtrParIn
+
+def Proc2(IntParIO):
+ IntLoc = IntParIO + 10
+ while 1:
+ if Char1Glob == 'A':
+ IntLoc = IntLoc - 1
+ IntParIO = IntLoc - IntGlob
+ EnumLoc = Ident1
+ if EnumLoc == Ident1:
+ break
+ return IntParIO
+
+def Proc3(PtrParOut):
+ global IntGlob
+
+ if PtrGlb is not None:
+ PtrParOut = PtrGlb.PtrComp
+ else:
+ IntGlob = 100
+ PtrGlb.IntComp = Proc7(10, IntGlob)
+ return PtrParOut
+
+def Proc4():
+ global Char2Glob
+
+ BoolLoc = Char1Glob == 'A'
+ BoolLoc = BoolLoc or BoolGlob
+ Char2Glob = 'B'
+
+def Proc5():
+ global Char1Glob
+ global BoolGlob
+
+ Char1Glob = 'A'
+ BoolGlob = FALSE
+
+def Proc6(EnumParIn):
+ EnumParOut = EnumParIn
+ if not Func3(EnumParIn):
+ EnumParOut = Ident4
+ if EnumParIn == Ident1:
+ EnumParOut = Ident1
+ elif EnumParIn == Ident2:
+ if IntGlob > 100:
+ EnumParOut = Ident1
+ else:
+ EnumParOut = Ident4
+ elif EnumParIn == Ident3:
+ EnumParOut = Ident2
+ elif EnumParIn == Ident4:
+ pass
+ elif EnumParIn == Ident5:
+ EnumParOut = Ident3
+ return EnumParOut
+
+def Proc7(IntParI1, IntParI2):
+ IntLoc = IntParI1 + 2
+ IntParOut = IntParI2 + IntLoc
+ return IntParOut
+
+def Proc8(Array1Par, Array2Par, IntParI1, IntParI2):
+ global IntGlob
+
+ IntLoc = IntParI1 + 5
+ Array1Par[IntLoc] = IntParI2
+ Array1Par[IntLoc+1] = Array1Par[IntLoc]
+ Array1Par[IntLoc+30] = IntLoc
+ for IntIndex in range(IntLoc, IntLoc+2):
+ Array2Par[IntLoc][IntIndex] = IntLoc
+ Array2Par[IntLoc][IntLoc-1] = Array2Par[IntLoc][IntLoc-1] + 1
+ Array2Par[IntLoc+20][IntLoc] = Array1Par[IntLoc]
+ IntGlob = 5
+
+def Func1(CharPar1, CharPar2):
+ CharLoc1 = CharPar1
+ CharLoc2 = CharLoc1
+ if CharLoc2 != CharPar2:
+ return Ident1
+ else:
+ return Ident2
+
+def Func2(StrParI1, StrParI2):
+ IntLoc = 1
+ while IntLoc <= 1:
+ if Func1(StrParI1[IntLoc], StrParI2[IntLoc+1]) == Ident1:
+ CharLoc = 'A'
+ IntLoc = IntLoc + 1
+ if CharLoc >= 'W' and CharLoc <= 'Z':
+ IntLoc = 7
+ if CharLoc == 'X':
+ return TRUE
+ else:
+ if StrParI1 > StrParI2:
+ IntLoc = IntLoc + 7
+ return TRUE
+ else:
+ return FALSE
+
+def Func3(EnumParIn):
+ EnumLoc = EnumParIn
+ if EnumLoc == Ident3: return TRUE
+ return FALSE
+
+if __name__ == '__main__':
+ import sys
+ def error(msg):
+ print(msg, end=' ', file=sys.stderr)
+ print("usage: %s [number_of_loops]" % sys.argv[0], file=sys.stderr)
+ sys.exit(100)
+ nargs = len(sys.argv) - 1
+ if nargs > 1:
+ error("%d arguments are too many;" % nargs)
+ elif nargs == 1:
+ try: loops = int(sys.argv[1])
+ except ValueError:
+ error("Invalid argument %r;" % sys.argv[1])
+ else:
+ loops = LOOPS
+ main(loops)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/test/ssl_servers.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/test/ssl_servers.py
new file mode 100644
index 0000000..87a3fb8
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/test/ssl_servers.py
@@ -0,0 +1,207 @@
+from __future__ import absolute_import, division, print_function, unicode_literals
+from future.builtins import filter, str
+from future import utils
+import os
+import sys
+import ssl
+import pprint
+import socket
+from future.backports.urllib import parse as urllib_parse
+from future.backports.http.server import (HTTPServer as _HTTPServer,
+ SimpleHTTPRequestHandler, BaseHTTPRequestHandler)
+from future.backports.test import support
+threading = support.import_module("threading")
+
+here = os.path.dirname(__file__)
+
+HOST = support.HOST
+CERTFILE = os.path.join(here, 'keycert.pem')
+
+# This one's based on HTTPServer, which is based on SocketServer
+
+class HTTPSServer(_HTTPServer):
+
+ def __init__(self, server_address, handler_class, context):
+ _HTTPServer.__init__(self, server_address, handler_class)
+ self.context = context
+
+ def __str__(self):
+ return ('<%s %s:%s>' %
+ (self.__class__.__name__,
+ self.server_name,
+ self.server_port))
+
+ def get_request(self):
+ # override this to wrap socket with SSL
+ try:
+ sock, addr = self.socket.accept()
+ sslconn = self.context.wrap_socket(sock, server_side=True)
+ except socket.error as e:
+ # socket errors are silenced by the caller, print them here
+ if support.verbose:
+ sys.stderr.write("Got an error:\n%s\n" % e)
+ raise
+ return sslconn, addr
+
+class RootedHTTPRequestHandler(SimpleHTTPRequestHandler):
+ # need to override translate_path to get a known root,
+ # instead of using os.curdir, since the test could be
+ # run from anywhere
+
+ server_version = "TestHTTPS/1.0"
+ root = here
+ # Avoid hanging when a request gets interrupted by the client
+ timeout = 5
+
+ def translate_path(self, path):
+ """Translate a /-separated PATH to the local filename syntax.
+
+ Components that mean special things to the local file system
+ (e.g. drive or directory names) are ignored. (XXX They should
+ probably be diagnosed.)
+
+ """
+ # abandon query parameters
+ path = urllib.parse.urlparse(path)[2]
+ path = os.path.normpath(urllib.parse.unquote(path))
+ words = path.split('/')
+ words = filter(None, words)
+ path = self.root
+ for word in words:
+ drive, word = os.path.splitdrive(word)
+ head, word = os.path.split(word)
+ path = os.path.join(path, word)
+ return path
+
+ def log_message(self, format, *args):
+ # we override this to suppress logging unless "verbose"
+ if support.verbose:
+ sys.stdout.write(" server (%s:%d %s):\n [%s] %s\n" %
+ (self.server.server_address,
+ self.server.server_port,
+ self.request.cipher(),
+ self.log_date_time_string(),
+ format%args))
+
+
+class StatsRequestHandler(BaseHTTPRequestHandler):
+ """Example HTTP request handler which returns SSL statistics on GET
+ requests.
+ """
+
+ server_version = "StatsHTTPS/1.0"
+
+ def do_GET(self, send_body=True):
+ """Serve a GET request."""
+ sock = self.rfile.raw._sock
+ context = sock.context
+ stats = {
+ 'session_cache': context.session_stats(),
+ 'cipher': sock.cipher(),
+ 'compression': sock.compression(),
+ }
+ body = pprint.pformat(stats)
+ body = body.encode('utf-8')
+ self.send_response(200)
+ self.send_header("Content-type", "text/plain; charset=utf-8")
+ self.send_header("Content-Length", str(len(body)))
+ self.end_headers()
+ if send_body:
+ self.wfile.write(body)
+
+ def do_HEAD(self):
+ """Serve a HEAD request."""
+ self.do_GET(send_body=False)
+
+ def log_request(self, format, *args):
+ if support.verbose:
+ BaseHTTPRequestHandler.log_request(self, format, *args)
+
+
+class HTTPSServerThread(threading.Thread):
+
+ def __init__(self, context, host=HOST, handler_class=None):
+ self.flag = None
+ self.server = HTTPSServer((host, 0),
+ handler_class or RootedHTTPRequestHandler,
+ context)
+ self.port = self.server.server_port
+ threading.Thread.__init__(self)
+ self.daemon = True
+
+ def __str__(self):
+ return "<%s %s>" % (self.__class__.__name__, self.server)
+
+ def start(self, flag=None):
+ self.flag = flag
+ threading.Thread.start(self)
+
+ def run(self):
+ if self.flag:
+ self.flag.set()
+ try:
+ self.server.serve_forever(0.05)
+ finally:
+ self.server.server_close()
+
+ def stop(self):
+ self.server.shutdown()
+
+
+def make_https_server(case, certfile=CERTFILE, host=HOST, handler_class=None):
+ # we assume the certfile contains both private key and certificate
+ context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
+ context.load_cert_chain(certfile)
+ server = HTTPSServerThread(context, host, handler_class)
+ flag = threading.Event()
+ server.start(flag)
+ flag.wait()
+ def cleanup():
+ if support.verbose:
+ sys.stdout.write('stopping HTTPS server\n')
+ server.stop()
+ if support.verbose:
+ sys.stdout.write('joining HTTPS thread\n')
+ server.join()
+ case.addCleanup(cleanup)
+ return server
+
+
+if __name__ == "__main__":
+ import argparse
+ parser = argparse.ArgumentParser(
+ description='Run a test HTTPS server. '
+ 'By default, the current directory is served.')
+ parser.add_argument('-p', '--port', type=int, default=4433,
+ help='port to listen on (default: %(default)s)')
+ parser.add_argument('-q', '--quiet', dest='verbose', default=True,
+ action='store_false', help='be less verbose')
+ parser.add_argument('-s', '--stats', dest='use_stats_handler', default=False,
+ action='store_true', help='always return stats page')
+ parser.add_argument('--curve-name', dest='curve_name', type=str,
+ action='store',
+ help='curve name for EC-based Diffie-Hellman')
+ parser.add_argument('--dh', dest='dh_file', type=str, action='store',
+ help='PEM file containing DH parameters')
+ args = parser.parse_args()
+
+ support.verbose = args.verbose
+ if args.use_stats_handler:
+ handler_class = StatsRequestHandler
+ else:
+ handler_class = RootedHTTPRequestHandler
+ if utils.PY2:
+ handler_class.root = os.getcwdu()
+ else:
+ handler_class.root = os.getcwd()
+ context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
+ context.load_cert_chain(CERTFILE)
+ if args.curve_name:
+ context.set_ecdh_curve(args.curve_name)
+ if args.dh_file:
+ context.load_dh_params(args.dh_file)
+
+ server = HTTPSServer(("", args.port), handler_class, context)
+ if args.verbose:
+ print("Listening on https://localhost:{0.port}".format(args))
+ server.serve_forever(0.1)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/test/support.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/test/support.py
new file mode 100644
index 0000000..b59c4ff
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/test/support.py
@@ -0,0 +1,2048 @@
+# -*- coding: utf-8 -*-
+"""Supporting definitions for the Python regression tests.
+
+Backported for python-future from Python 3.3 test/support.py.
+"""
+
+from __future__ import (absolute_import, division,
+ print_function, unicode_literals)
+from future import utils
+from future.builtins import str, range, open, int, map, list
+
+import contextlib
+import errno
+import functools
+import gc
+import socket
+import sys
+import os
+import platform
+import shutil
+import warnings
+import unittest
+# For Python 2.6 compatibility:
+if not hasattr(unittest, 'skip'):
+ import unittest2 as unittest
+
+import importlib
+# import collections.abc # not present on Py2.7
+import re
+import subprocess
+import imp
+import time
+try:
+ import sysconfig
+except ImportError:
+ # sysconfig is not available on Python 2.6. Try using distutils.sysconfig instead:
+ from distutils import sysconfig
+import fnmatch
+import logging.handlers
+import struct
+import tempfile
+
+try:
+ if utils.PY3:
+ import _thread, threading
+ else:
+ import thread as _thread, threading
+except ImportError:
+ _thread = None
+ threading = None
+try:
+ import multiprocessing.process
+except ImportError:
+ multiprocessing = None
+
+try:
+ import zlib
+except ImportError:
+ zlib = None
+
+try:
+ import gzip
+except ImportError:
+ gzip = None
+
+try:
+ import bz2
+except ImportError:
+ bz2 = None
+
+try:
+ import lzma
+except ImportError:
+ lzma = None
+
+__all__ = [
+ "Error", "TestFailed", "ResourceDenied", "import_module", "verbose",
+ "use_resources", "max_memuse", "record_original_stdout",
+ "get_original_stdout", "unload", "unlink", "rmtree", "forget",
+ "is_resource_enabled", "requires", "requires_freebsd_version",
+ "requires_linux_version", "requires_mac_ver", "find_unused_port",
+ "bind_port", "IPV6_ENABLED", "is_jython", "TESTFN", "HOST", "SAVEDCWD",
+ "temp_cwd", "findfile", "create_empty_file", "sortdict",
+ "check_syntax_error", "open_urlresource", "check_warnings", "CleanImport",
+ "EnvironmentVarGuard", "TransientResource", "captured_stdout",
+ "captured_stdin", "captured_stderr", "time_out", "socket_peer_reset",
+ "ioerror_peer_reset", "run_with_locale", 'temp_umask',
+ "transient_internet", "set_memlimit", "bigmemtest", "bigaddrspacetest",
+ "BasicTestRunner", "run_unittest", "run_doctest", "threading_setup",
+ "threading_cleanup", "reap_children", "cpython_only", "check_impl_detail",
+ "get_attribute", "swap_item", "swap_attr", "requires_IEEE_754",
+ "TestHandler", "Matcher", "can_symlink", "skip_unless_symlink",
+ "skip_unless_xattr", "import_fresh_module", "requires_zlib",
+ "PIPE_MAX_SIZE", "failfast", "anticipate_failure", "run_with_tz",
+ "requires_gzip", "requires_bz2", "requires_lzma", "suppress_crash_popup",
+ ]
+
+class Error(Exception):
+ """Base class for regression test exceptions."""
+
+class TestFailed(Error):
+ """Test failed."""
+
+class ResourceDenied(unittest.SkipTest):
+ """Test skipped because it requested a disallowed resource.
+
+ This is raised when a test calls requires() for a resource that
+ has not be enabled. It is used to distinguish between expected
+ and unexpected skips.
+ """
+
+@contextlib.contextmanager
+def _ignore_deprecated_imports(ignore=True):
+ """Context manager to suppress package and module deprecation
+ warnings when importing them.
+
+ If ignore is False, this context manager has no effect."""
+ if ignore:
+ with warnings.catch_warnings():
+ warnings.filterwarnings("ignore", ".+ (module|package)",
+ DeprecationWarning)
+ yield
+ else:
+ yield
+
+
+def import_module(name, deprecated=False):
+ """Import and return the module to be tested, raising SkipTest if
+ it is not available.
+
+ If deprecated is True, any module or package deprecation messages
+ will be suppressed."""
+ with _ignore_deprecated_imports(deprecated):
+ try:
+ return importlib.import_module(name)
+ except ImportError as msg:
+ raise unittest.SkipTest(str(msg))
+
+
+def _save_and_remove_module(name, orig_modules):
+ """Helper function to save and remove a module from sys.modules
+
+ Raise ImportError if the module can't be imported.
+ """
+ # try to import the module and raise an error if it can't be imported
+ if name not in sys.modules:
+ __import__(name)
+ del sys.modules[name]
+ for modname in list(sys.modules):
+ if modname == name or modname.startswith(name + '.'):
+ orig_modules[modname] = sys.modules[modname]
+ del sys.modules[modname]
+
+def _save_and_block_module(name, orig_modules):
+ """Helper function to save and block a module in sys.modules
+
+ Return True if the module was in sys.modules, False otherwise.
+ """
+ saved = True
+ try:
+ orig_modules[name] = sys.modules[name]
+ except KeyError:
+ saved = False
+ sys.modules[name] = None
+ return saved
+
+
+def anticipate_failure(condition):
+ """Decorator to mark a test that is known to be broken in some cases
+
+ Any use of this decorator should have a comment identifying the
+ associated tracker issue.
+ """
+ if condition:
+ return unittest.expectedFailure
+ return lambda f: f
+
+
+def import_fresh_module(name, fresh=(), blocked=(), deprecated=False):
+ """Import and return a module, deliberately bypassing sys.modules.
+ This function imports and returns a fresh copy of the named Python module
+ by removing the named module from sys.modules before doing the import.
+ Note that unlike reload, the original module is not affected by
+ this operation.
+
+ *fresh* is an iterable of additional module names that are also removed
+ from the sys.modules cache before doing the import.
+
+ *blocked* is an iterable of module names that are replaced with None
+ in the module cache during the import to ensure that attempts to import
+ them raise ImportError.
+
+ The named module and any modules named in the *fresh* and *blocked*
+ parameters are saved before starting the import and then reinserted into
+ sys.modules when the fresh import is complete.
+
+ Module and package deprecation messages are suppressed during this import
+ if *deprecated* is True.
+
+ This function will raise ImportError if the named module cannot be
+ imported.
+
+ If deprecated is True, any module or package deprecation messages
+ will be suppressed.
+ """
+ # NOTE: test_heapq, test_json and test_warnings include extra sanity checks
+ # to make sure that this utility function is working as expected
+ with _ignore_deprecated_imports(deprecated):
+ # Keep track of modules saved for later restoration as well
+ # as those which just need a blocking entry removed
+ orig_modules = {}
+ names_to_remove = []
+ _save_and_remove_module(name, orig_modules)
+ try:
+ for fresh_name in fresh:
+ _save_and_remove_module(fresh_name, orig_modules)
+ for blocked_name in blocked:
+ if not _save_and_block_module(blocked_name, orig_modules):
+ names_to_remove.append(blocked_name)
+ fresh_module = importlib.import_module(name)
+ except ImportError:
+ fresh_module = None
+ finally:
+ for orig_name, module in orig_modules.items():
+ sys.modules[orig_name] = module
+ for name_to_remove in names_to_remove:
+ del sys.modules[name_to_remove]
+ return fresh_module
+
+
+def get_attribute(obj, name):
+ """Get an attribute, raising SkipTest if AttributeError is raised."""
+ try:
+ attribute = getattr(obj, name)
+ except AttributeError:
+ raise unittest.SkipTest("object %r has no attribute %r" % (obj, name))
+ else:
+ return attribute
+
+verbose = 1 # Flag set to 0 by regrtest.py
+use_resources = None # Flag set to [] by regrtest.py
+max_memuse = 0 # Disable bigmem tests (they will still be run with
+ # small sizes, to make sure they work.)
+real_max_memuse = 0
+failfast = False
+match_tests = None
+
+# _original_stdout is meant to hold stdout at the time regrtest began.
+# This may be "the real" stdout, or IDLE's emulation of stdout, or whatever.
+# The point is to have some flavor of stdout the user can actually see.
+_original_stdout = None
+def record_original_stdout(stdout):
+ global _original_stdout
+ _original_stdout = stdout
+
+def get_original_stdout():
+ return _original_stdout or sys.stdout
+
+def unload(name):
+ try:
+ del sys.modules[name]
+ except KeyError:
+ pass
+
+if sys.platform.startswith("win"):
+ def _waitfor(func, pathname, waitall=False):
+ # Perform the operation
+ func(pathname)
+ # Now setup the wait loop
+ if waitall:
+ dirname = pathname
+ else:
+ dirname, name = os.path.split(pathname)
+ dirname = dirname or '.'
+ # Check for `pathname` to be removed from the filesystem.
+ # The exponential backoff of the timeout amounts to a total
+ # of ~1 second after which the deletion is probably an error
+ # anyway.
+ # Testing on a i7@4.3GHz shows that usually only 1 iteration is
+ # required when contention occurs.
+ timeout = 0.001
+ while timeout < 1.0:
+ # Note we are only testing for the existence of the file(s) in
+ # the contents of the directory regardless of any security or
+ # access rights. If we have made it this far, we have sufficient
+ # permissions to do that much using Python's equivalent of the
+ # Windows API FindFirstFile.
+ # Other Windows APIs can fail or give incorrect results when
+ # dealing with files that are pending deletion.
+ L = os.listdir(dirname)
+ if not (L if waitall else name in L):
+ return
+ # Increase the timeout and try again
+ time.sleep(timeout)
+ timeout *= 2
+ warnings.warn('tests may fail, delete still pending for ' + pathname,
+ RuntimeWarning, stacklevel=4)
+
+ def _unlink(filename):
+ _waitfor(os.unlink, filename)
+
+ def _rmdir(dirname):
+ _waitfor(os.rmdir, dirname)
+
+ def _rmtree(path):
+ def _rmtree_inner(path):
+ for name in os.listdir(path):
+ fullname = os.path.join(path, name)
+ if os.path.isdir(fullname):
+ _waitfor(_rmtree_inner, fullname, waitall=True)
+ os.rmdir(fullname)
+ else:
+ os.unlink(fullname)
+ _waitfor(_rmtree_inner, path, waitall=True)
+ _waitfor(os.rmdir, path)
+else:
+ _unlink = os.unlink
+ _rmdir = os.rmdir
+ _rmtree = shutil.rmtree
+
+def unlink(filename):
+ try:
+ _unlink(filename)
+ except OSError as error:
+ # The filename need not exist.
+ if error.errno not in (errno.ENOENT, errno.ENOTDIR):
+ raise
+
+def rmdir(dirname):
+ try:
+ _rmdir(dirname)
+ except OSError as error:
+ # The directory need not exist.
+ if error.errno != errno.ENOENT:
+ raise
+
+def rmtree(path):
+ try:
+ _rmtree(path)
+ except OSError as error:
+ if error.errno != errno.ENOENT:
+ raise
+
+def make_legacy_pyc(source):
+ """Move a PEP 3147 pyc/pyo file to its legacy pyc/pyo location.
+
+ The choice of .pyc or .pyo extension is done based on the __debug__ flag
+ value.
+
+ :param source: The file system path to the source file. The source file
+ does not need to exist, however the PEP 3147 pyc file must exist.
+ :return: The file system path to the legacy pyc file.
+ """
+ pyc_file = imp.cache_from_source(source)
+ up_one = os.path.dirname(os.path.abspath(source))
+ legacy_pyc = os.path.join(up_one, source + ('c' if __debug__ else 'o'))
+ os.rename(pyc_file, legacy_pyc)
+ return legacy_pyc
+
+def forget(modname):
+ """'Forget' a module was ever imported.
+
+ This removes the module from sys.modules and deletes any PEP 3147 or
+ legacy .pyc and .pyo files.
+ """
+ unload(modname)
+ for dirname in sys.path:
+ source = os.path.join(dirname, modname + '.py')
+ # It doesn't matter if they exist or not, unlink all possible
+ # combinations of PEP 3147 and legacy pyc and pyo files.
+ unlink(source + 'c')
+ unlink(source + 'o')
+ unlink(imp.cache_from_source(source, debug_override=True))
+ unlink(imp.cache_from_source(source, debug_override=False))
+
+# On some platforms, should not run gui test even if it is allowed
+# in `use_resources'.
+if sys.platform.startswith('win'):
+ import ctypes
+ import ctypes.wintypes
+ def _is_gui_available():
+ UOI_FLAGS = 1
+ WSF_VISIBLE = 0x0001
+ class USEROBJECTFLAGS(ctypes.Structure):
+ _fields_ = [("fInherit", ctypes.wintypes.BOOL),
+ ("fReserved", ctypes.wintypes.BOOL),
+ ("dwFlags", ctypes.wintypes.DWORD)]
+ dll = ctypes.windll.user32
+ h = dll.GetProcessWindowStation()
+ if not h:
+ raise ctypes.WinError()
+ uof = USEROBJECTFLAGS()
+ needed = ctypes.wintypes.DWORD()
+ res = dll.GetUserObjectInformationW(h,
+ UOI_FLAGS,
+ ctypes.byref(uof),
+ ctypes.sizeof(uof),
+ ctypes.byref(needed))
+ if not res:
+ raise ctypes.WinError()
+ return bool(uof.dwFlags & WSF_VISIBLE)
+else:
+ def _is_gui_available():
+ return True
+
+def is_resource_enabled(resource):
+ """Test whether a resource is enabled. Known resources are set by
+ regrtest.py."""
+ return use_resources is not None and resource in use_resources
+
+def requires(resource, msg=None):
+ """Raise ResourceDenied if the specified resource is not available.
+
+ If the caller's module is __main__ then automatically return True. The
+ possibility of False being returned occurs when regrtest.py is
+ executing.
+ """
+ if resource == 'gui' and not _is_gui_available():
+ raise unittest.SkipTest("Cannot use the 'gui' resource")
+ # see if the caller's module is __main__ - if so, treat as if
+ # the resource was set
+ if sys._getframe(1).f_globals.get("__name__") == "__main__":
+ return
+ if not is_resource_enabled(resource):
+ if msg is None:
+ msg = "Use of the %r resource not enabled" % resource
+ raise ResourceDenied(msg)
+
+def _requires_unix_version(sysname, min_version):
+ """Decorator raising SkipTest if the OS is `sysname` and the version is less
+ than `min_version`.
+
+ For example, @_requires_unix_version('FreeBSD', (7, 2)) raises SkipTest if
+ the FreeBSD version is less than 7.2.
+ """
+ def decorator(func):
+ @functools.wraps(func)
+ def wrapper(*args, **kw):
+ if platform.system() == sysname:
+ version_txt = platform.release().split('-', 1)[0]
+ try:
+ version = tuple(map(int, version_txt.split('.')))
+ except ValueError:
+ pass
+ else:
+ if version < min_version:
+ min_version_txt = '.'.join(map(str, min_version))
+ raise unittest.SkipTest(
+ "%s version %s or higher required, not %s"
+ % (sysname, min_version_txt, version_txt))
+ return func(*args, **kw)
+ wrapper.min_version = min_version
+ return wrapper
+ return decorator
+
+def requires_freebsd_version(*min_version):
+ """Decorator raising SkipTest if the OS is FreeBSD and the FreeBSD version is
+ less than `min_version`.
+
+ For example, @requires_freebsd_version(7, 2) raises SkipTest if the FreeBSD
+ version is less than 7.2.
+ """
+ return _requires_unix_version('FreeBSD', min_version)
+
+def requires_linux_version(*min_version):
+ """Decorator raising SkipTest if the OS is Linux and the Linux version is
+ less than `min_version`.
+
+ For example, @requires_linux_version(2, 6, 32) raises SkipTest if the Linux
+ version is less than 2.6.32.
+ """
+ return _requires_unix_version('Linux', min_version)
+
+def requires_mac_ver(*min_version):
+ """Decorator raising SkipTest if the OS is Mac OS X and the OS X
+ version if less than min_version.
+
+ For example, @requires_mac_ver(10, 5) raises SkipTest if the OS X version
+ is lesser than 10.5.
+ """
+ def decorator(func):
+ @functools.wraps(func)
+ def wrapper(*args, **kw):
+ if sys.platform == 'darwin':
+ version_txt = platform.mac_ver()[0]
+ try:
+ version = tuple(map(int, version_txt.split('.')))
+ except ValueError:
+ pass
+ else:
+ if version < min_version:
+ min_version_txt = '.'.join(map(str, min_version))
+ raise unittest.SkipTest(
+ "Mac OS X %s or higher required, not %s"
+ % (min_version_txt, version_txt))
+ return func(*args, **kw)
+ wrapper.min_version = min_version
+ return wrapper
+ return decorator
+
+# Don't use "localhost", since resolving it uses the DNS under recent
+# Windows versions (see issue #18792).
+HOST = "127.0.0.1"
+HOSTv6 = "::1"
+
+
+def find_unused_port(family=socket.AF_INET, socktype=socket.SOCK_STREAM):
+ """Returns an unused port that should be suitable for binding. This is
+ achieved by creating a temporary socket with the same family and type as
+ the 'sock' parameter (default is AF_INET, SOCK_STREAM), and binding it to
+ the specified host address (defaults to 0.0.0.0) with the port set to 0,
+ eliciting an unused ephemeral port from the OS. The temporary socket is
+ then closed and deleted, and the ephemeral port is returned.
+
+ Either this method or bind_port() should be used for any tests where a
+ server socket needs to be bound to a particular port for the duration of
+ the test. Which one to use depends on whether the calling code is creating
+ a python socket, or if an unused port needs to be provided in a constructor
+ or passed to an external program (i.e. the -accept argument to openssl's
+ s_server mode). Always prefer bind_port() over find_unused_port() where
+ possible. Hard coded ports should *NEVER* be used. As soon as a server
+ socket is bound to a hard coded port, the ability to run multiple instances
+ of the test simultaneously on the same host is compromised, which makes the
+ test a ticking time bomb in a buildbot environment. On Unix buildbots, this
+ may simply manifest as a failed test, which can be recovered from without
+ intervention in most cases, but on Windows, the entire python process can
+ completely and utterly wedge, requiring someone to log in to the buildbot
+ and manually kill the affected process.
+
+ (This is easy to reproduce on Windows, unfortunately, and can be traced to
+ the SO_REUSEADDR socket option having different semantics on Windows versus
+ Unix/Linux. On Unix, you can't have two AF_INET SOCK_STREAM sockets bind,
+ listen and then accept connections on identical host/ports. An EADDRINUSE
+ socket.error will be raised at some point (depending on the platform and
+ the order bind and listen were called on each socket).
+
+ However, on Windows, if SO_REUSEADDR is set on the sockets, no EADDRINUSE
+ will ever be raised when attempting to bind two identical host/ports. When
+ accept() is called on each socket, the second caller's process will steal
+ the port from the first caller, leaving them both in an awkwardly wedged
+ state where they'll no longer respond to any signals or graceful kills, and
+ must be forcibly killed via OpenProcess()/TerminateProcess().
+
+ The solution on Windows is to use the SO_EXCLUSIVEADDRUSE socket option
+ instead of SO_REUSEADDR, which effectively affords the same semantics as
+ SO_REUSEADDR on Unix. Given the propensity of Unix developers in the Open
+ Source world compared to Windows ones, this is a common mistake. A quick
+ look over OpenSSL's 0.9.8g source shows that they use SO_REUSEADDR when
+ openssl.exe is called with the 's_server' option, for example. See
+ http://bugs.python.org/issue2550 for more info. The following site also
+ has a very thorough description about the implications of both REUSEADDR
+ and EXCLUSIVEADDRUSE on Windows:
+ http://msdn2.microsoft.com/en-us/library/ms740621(VS.85).aspx)
+
+ XXX: although this approach is a vast improvement on previous attempts to
+ elicit unused ports, it rests heavily on the assumption that the ephemeral
+ port returned to us by the OS won't immediately be dished back out to some
+ other process when we close and delete our temporary socket but before our
+ calling code has a chance to bind the returned port. We can deal with this
+ issue if/when we come across it.
+ """
+
+ tempsock = socket.socket(family, socktype)
+ port = bind_port(tempsock)
+ tempsock.close()
+ del tempsock
+ return port
+
+def bind_port(sock, host=HOST):
+ """Bind the socket to a free port and return the port number. Relies on
+ ephemeral ports in order to ensure we are using an unbound port. This is
+ important as many tests may be running simultaneously, especially in a
+ buildbot environment. This method raises an exception if the sock.family
+ is AF_INET and sock.type is SOCK_STREAM, *and* the socket has SO_REUSEADDR
+ or SO_REUSEPORT set on it. Tests should *never* set these socket options
+ for TCP/IP sockets. The only case for setting these options is testing
+ multicasting via multiple UDP sockets.
+
+ Additionally, if the SO_EXCLUSIVEADDRUSE socket option is available (i.e.
+ on Windows), it will be set on the socket. This will prevent anyone else
+ from bind()'ing to our host/port for the duration of the test.
+ """
+
+ if sock.family == socket.AF_INET and sock.type == socket.SOCK_STREAM:
+ if hasattr(socket, 'SO_REUSEADDR'):
+ if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) == 1:
+ raise TestFailed("tests should never set the SO_REUSEADDR " \
+ "socket option on TCP/IP sockets!")
+ if hasattr(socket, 'SO_REUSEPORT'):
+ try:
+ if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1:
+ raise TestFailed("tests should never set the SO_REUSEPORT " \
+ "socket option on TCP/IP sockets!")
+ except socket.error:
+ # Python's socket module was compiled using modern headers
+ # thus defining SO_REUSEPORT but this process is running
+ # under an older kernel that does not support SO_REUSEPORT.
+ pass
+ if hasattr(socket, 'SO_EXCLUSIVEADDRUSE'):
+ sock.setsockopt(socket.SOL_SOCKET, socket.SO_EXCLUSIVEADDRUSE, 1)
+
+ sock.bind((host, 0))
+ port = sock.getsockname()[1]
+ return port
+
+def _is_ipv6_enabled():
+ """Check whether IPv6 is enabled on this host."""
+ if socket.has_ipv6:
+ sock = None
+ try:
+ sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
+ sock.bind(('::1', 0))
+ return True
+ except (socket.error, socket.gaierror):
+ pass
+ finally:
+ if sock:
+ sock.close()
+ return False
+
+IPV6_ENABLED = _is_ipv6_enabled()
+
+
+# A constant likely larger than the underlying OS pipe buffer size, to
+# make writes blocking.
+# Windows limit seems to be around 512 B, and many Unix kernels have a
+# 64 KiB pipe buffer size or 16 * PAGE_SIZE: take a few megs to be sure.
+# (see issue #17835 for a discussion of this number).
+PIPE_MAX_SIZE = 4 * 1024 * 1024 + 1
+
+# A constant likely larger than the underlying OS socket buffer size, to make
+# writes blocking.
+# The socket buffer sizes can usually be tuned system-wide (e.g. through sysctl
+# on Linux), or on a per-socket basis (SO_SNDBUF/SO_RCVBUF). See issue #18643
+# for a discussion of this number).
+SOCK_MAX_SIZE = 16 * 1024 * 1024 + 1
+
+# # decorator for skipping tests on non-IEEE 754 platforms
+# requires_IEEE_754 = unittest.skipUnless(
+# float.__getformat__("double").startswith("IEEE"),
+# "test requires IEEE 754 doubles")
+
+requires_zlib = unittest.skipUnless(zlib, 'requires zlib')
+
+requires_bz2 = unittest.skipUnless(bz2, 'requires bz2')
+
+requires_lzma = unittest.skipUnless(lzma, 'requires lzma')
+
+is_jython = sys.platform.startswith('java')
+
+# Filename used for testing
+if os.name == 'java':
+ # Jython disallows @ in module names
+ TESTFN = '$test'
+else:
+ TESTFN = '@test'
+
+# Disambiguate TESTFN for parallel testing, while letting it remain a valid
+# module name.
+TESTFN = "{0}_{1}_tmp".format(TESTFN, os.getpid())
+
+# # FS_NONASCII: non-ASCII character encodable by os.fsencode(),
+# # or None if there is no such character.
+# FS_NONASCII = None
+# for character in (
+# # First try printable and common characters to have a readable filename.
+# # For each character, the encoding list are just example of encodings able
+# # to encode the character (the list is not exhaustive).
+#
+# # U+00E6 (Latin Small Letter Ae): cp1252, iso-8859-1
+# '\u00E6',
+# # U+0130 (Latin Capital Letter I With Dot Above): cp1254, iso8859_3
+# '\u0130',
+# # U+0141 (Latin Capital Letter L With Stroke): cp1250, cp1257
+# '\u0141',
+# # U+03C6 (Greek Small Letter Phi): cp1253
+# '\u03C6',
+# # U+041A (Cyrillic Capital Letter Ka): cp1251
+# '\u041A',
+# # U+05D0 (Hebrew Letter Alef): Encodable to cp424
+# '\u05D0',
+# # U+060C (Arabic Comma): cp864, cp1006, iso8859_6, mac_arabic
+# '\u060C',
+# # U+062A (Arabic Letter Teh): cp720
+# '\u062A',
+# # U+0E01 (Thai Character Ko Kai): cp874
+# '\u0E01',
+#
+# # Then try more "special" characters. "special" because they may be
+# # interpreted or displayed differently depending on the exact locale
+# # encoding and the font.
+#
+# # U+00A0 (No-Break Space)
+# '\u00A0',
+# # U+20AC (Euro Sign)
+# '\u20AC',
+# ):
+# try:
+# os.fsdecode(os.fsencode(character))
+# except UnicodeError:
+# pass
+# else:
+# FS_NONASCII = character
+# break
+#
+# # TESTFN_UNICODE is a non-ascii filename
+# TESTFN_UNICODE = TESTFN + "-\xe0\xf2\u0258\u0141\u011f"
+# if sys.platform == 'darwin':
+# # In Mac OS X's VFS API file names are, by definition, canonically
+# # decomposed Unicode, encoded using UTF-8. See QA1173:
+# # http://developer.apple.com/mac/library/qa/qa2001/qa1173.html
+# import unicodedata
+# TESTFN_UNICODE = unicodedata.normalize('NFD', TESTFN_UNICODE)
+# TESTFN_ENCODING = sys.getfilesystemencoding()
+#
+# # TESTFN_UNENCODABLE is a filename (str type) that should *not* be able to be
+# # encoded by the filesystem encoding (in strict mode). It can be None if we
+# # cannot generate such filename.
+# TESTFN_UNENCODABLE = None
+# if os.name in ('nt', 'ce'):
+# # skip win32s (0) or Windows 9x/ME (1)
+# if sys.getwindowsversion().platform >= 2:
+# # Different kinds of characters from various languages to minimize the
+# # probability that the whole name is encodable to MBCS (issue #9819)
+# TESTFN_UNENCODABLE = TESTFN + "-\u5171\u0141\u2661\u0363\uDC80"
+# try:
+# TESTFN_UNENCODABLE.encode(TESTFN_ENCODING)
+# except UnicodeEncodeError:
+# pass
+# else:
+# print('WARNING: The filename %r CAN be encoded by the filesystem encoding (%s). '
+# 'Unicode filename tests may not be effective'
+# % (TESTFN_UNENCODABLE, TESTFN_ENCODING))
+# TESTFN_UNENCODABLE = None
+# # Mac OS X denies unencodable filenames (invalid utf-8)
+# elif sys.platform != 'darwin':
+# try:
+# # ascii and utf-8 cannot encode the byte 0xff
+# b'\xff'.decode(TESTFN_ENCODING)
+# except UnicodeDecodeError:
+# # 0xff will be encoded using the surrogate character u+DCFF
+# TESTFN_UNENCODABLE = TESTFN \
+# + b'-\xff'.decode(TESTFN_ENCODING, 'surrogateescape')
+# else:
+# # File system encoding (eg. ISO-8859-* encodings) can encode
+# # the byte 0xff. Skip some unicode filename tests.
+# pass
+#
+# # TESTFN_UNDECODABLE is a filename (bytes type) that should *not* be able to be
+# # decoded from the filesystem encoding (in strict mode). It can be None if we
+# # cannot generate such filename (ex: the latin1 encoding can decode any byte
+# # sequence). On UNIX, TESTFN_UNDECODABLE can be decoded by os.fsdecode() thanks
+# # to the surrogateescape error handler (PEP 383), but not from the filesystem
+# # encoding in strict mode.
+# TESTFN_UNDECODABLE = None
+# for name in (
+# # b'\xff' is not decodable by os.fsdecode() with code page 932. Windows
+# # accepts it to create a file or a directory, or don't accept to enter to
+# # such directory (when the bytes name is used). So test b'\xe7' first: it is
+# # not decodable from cp932.
+# b'\xe7w\xf0',
+# # undecodable from ASCII, UTF-8
+# b'\xff',
+# # undecodable from iso8859-3, iso8859-6, iso8859-7, cp424, iso8859-8, cp856
+# # and cp857
+# b'\xae\xd5'
+# # undecodable from UTF-8 (UNIX and Mac OS X)
+# b'\xed\xb2\x80', b'\xed\xb4\x80',
+# # undecodable from shift_jis, cp869, cp874, cp932, cp1250, cp1251, cp1252,
+# # cp1253, cp1254, cp1255, cp1257, cp1258
+# b'\x81\x98',
+# ):
+# try:
+# name.decode(TESTFN_ENCODING)
+# except UnicodeDecodeError:
+# TESTFN_UNDECODABLE = os.fsencode(TESTFN) + name
+# break
+#
+# if FS_NONASCII:
+# TESTFN_NONASCII = TESTFN + '-' + FS_NONASCII
+# else:
+# TESTFN_NONASCII = None
+
+# Save the initial cwd
+SAVEDCWD = os.getcwd()
+
+@contextlib.contextmanager
+def temp_cwd(name='tempcwd', quiet=False, path=None):
+ """
+ Context manager that temporarily changes the CWD.
+
+ An existing path may be provided as *path*, in which case this
+ function makes no changes to the file system.
+
+ Otherwise, the new CWD is created in the current directory and it's
+ named *name*. If *quiet* is False (default) and it's not possible to
+ create or change the CWD, an error is raised. If it's True, only a
+ warning is raised and the original CWD is used.
+ """
+ saved_dir = os.getcwd()
+ is_temporary = False
+ if path is None:
+ path = name
+ try:
+ os.mkdir(name)
+ is_temporary = True
+ except OSError:
+ if not quiet:
+ raise
+ warnings.warn('tests may fail, unable to create temp CWD ' + name,
+ RuntimeWarning, stacklevel=3)
+ try:
+ os.chdir(path)
+ except OSError:
+ if not quiet:
+ raise
+ warnings.warn('tests may fail, unable to change the CWD to ' + path,
+ RuntimeWarning, stacklevel=3)
+ try:
+ yield os.getcwd()
+ finally:
+ os.chdir(saved_dir)
+ if is_temporary:
+ rmtree(name)
+
+
+if hasattr(os, "umask"):
+ @contextlib.contextmanager
+ def temp_umask(umask):
+ """Context manager that temporarily sets the process umask."""
+ oldmask = os.umask(umask)
+ try:
+ yield
+ finally:
+ os.umask(oldmask)
+
+
+def findfile(file, here=__file__, subdir=None):
+ """Try to find a file on sys.path and the working directory. If it is not
+ found the argument passed to the function is returned (this does not
+ necessarily signal failure; could still be the legitimate path)."""
+ if os.path.isabs(file):
+ return file
+ if subdir is not None:
+ file = os.path.join(subdir, file)
+ path = sys.path
+ path = [os.path.dirname(here)] + path
+ for dn in path:
+ fn = os.path.join(dn, file)
+ if os.path.exists(fn): return fn
+ return file
+
+def create_empty_file(filename):
+ """Create an empty file. If the file already exists, truncate it."""
+ fd = os.open(filename, os.O_WRONLY | os.O_CREAT | os.O_TRUNC)
+ os.close(fd)
+
+def sortdict(dict):
+ "Like repr(dict), but in sorted order."
+ items = sorted(dict.items())
+ reprpairs = ["%r: %r" % pair for pair in items]
+ withcommas = ", ".join(reprpairs)
+ return "{%s}" % withcommas
+
+def make_bad_fd():
+ """
+ Create an invalid file descriptor by opening and closing a file and return
+ its fd.
+ """
+ file = open(TESTFN, "wb")
+ try:
+ return file.fileno()
+ finally:
+ file.close()
+ unlink(TESTFN)
+
+def check_syntax_error(testcase, statement):
+ testcase.assertRaises(SyntaxError, compile, statement,
+ '', 'exec')
+
+def open_urlresource(url, *args, **kw):
+ from future.backports.urllib import (request as urllib_request,
+ parse as urllib_parse)
+
+ check = kw.pop('check', None)
+
+ filename = urllib_parse.urlparse(url)[2].split('/')[-1] # '/': it's URL!
+
+ fn = os.path.join(os.path.dirname(__file__), "data", filename)
+
+ def check_valid_file(fn):
+ f = open(fn, *args, **kw)
+ if check is None:
+ return f
+ elif check(f):
+ f.seek(0)
+ return f
+ f.close()
+
+ if os.path.exists(fn):
+ f = check_valid_file(fn)
+ if f is not None:
+ return f
+ unlink(fn)
+
+ # Verify the requirement before downloading the file
+ requires('urlfetch')
+
+ print('\tfetching %s ...' % url, file=get_original_stdout())
+ f = urllib_request.urlopen(url, timeout=15)
+ try:
+ with open(fn, "wb") as out:
+ s = f.read()
+ while s:
+ out.write(s)
+ s = f.read()
+ finally:
+ f.close()
+
+ f = check_valid_file(fn)
+ if f is not None:
+ return f
+ raise TestFailed('invalid resource %r' % fn)
+
+
+class WarningsRecorder(object):
+ """Convenience wrapper for the warnings list returned on
+ entry to the warnings.catch_warnings() context manager.
+ """
+ def __init__(self, warnings_list):
+ self._warnings = warnings_list
+ self._last = 0
+
+ def __getattr__(self, attr):
+ if len(self._warnings) > self._last:
+ return getattr(self._warnings[-1], attr)
+ elif attr in warnings.WarningMessage._WARNING_DETAILS:
+ return None
+ raise AttributeError("%r has no attribute %r" % (self, attr))
+
+ @property
+ def warnings(self):
+ return self._warnings[self._last:]
+
+ def reset(self):
+ self._last = len(self._warnings)
+
+
+def _filterwarnings(filters, quiet=False):
+ """Catch the warnings, then check if all the expected
+ warnings have been raised and re-raise unexpected warnings.
+ If 'quiet' is True, only re-raise the unexpected warnings.
+ """
+ # Clear the warning registry of the calling module
+ # in order to re-raise the warnings.
+ frame = sys._getframe(2)
+ registry = frame.f_globals.get('__warningregistry__')
+ if registry:
+ if utils.PY3:
+ registry.clear()
+ else:
+ # Py2-compatible:
+ for i in range(len(registry)):
+ registry.pop()
+ with warnings.catch_warnings(record=True) as w:
+ # Set filter "always" to record all warnings. Because
+ # test_warnings swap the module, we need to look up in
+ # the sys.modules dictionary.
+ sys.modules['warnings'].simplefilter("always")
+ yield WarningsRecorder(w)
+ # Filter the recorded warnings
+ reraise = list(w)
+ missing = []
+ for msg, cat in filters:
+ seen = False
+ for w in reraise[:]:
+ warning = w.message
+ # Filter out the matching messages
+ if (re.match(msg, str(warning), re.I) and
+ issubclass(warning.__class__, cat)):
+ seen = True
+ reraise.remove(w)
+ if not seen and not quiet:
+ # This filter caught nothing
+ missing.append((msg, cat.__name__))
+ if reraise:
+ raise AssertionError("unhandled warning %s" % reraise[0])
+ if missing:
+ raise AssertionError("filter (%r, %s) did not catch any warning" %
+ missing[0])
+
+
+@contextlib.contextmanager
+def check_warnings(*filters, **kwargs):
+ """Context manager to silence warnings.
+
+ Accept 2-tuples as positional arguments:
+ ("message regexp", WarningCategory)
+
+ Optional argument:
+ - if 'quiet' is True, it does not fail if a filter catches nothing
+ (default True without argument,
+ default False if some filters are defined)
+
+ Without argument, it defaults to:
+ check_warnings(("", Warning), quiet=True)
+ """
+ quiet = kwargs.get('quiet')
+ if not filters:
+ filters = (("", Warning),)
+ # Preserve backward compatibility
+ if quiet is None:
+ quiet = True
+ return _filterwarnings(filters, quiet)
+
+
+class CleanImport(object):
+ """Context manager to force import to return a new module reference.
+
+ This is useful for testing module-level behaviours, such as
+ the emission of a DeprecationWarning on import.
+
+ Use like this:
+
+ with CleanImport("foo"):
+ importlib.import_module("foo") # new reference
+ """
+
+ def __init__(self, *module_names):
+ self.original_modules = sys.modules.copy()
+ for module_name in module_names:
+ if module_name in sys.modules:
+ module = sys.modules[module_name]
+ # It is possible that module_name is just an alias for
+ # another module (e.g. stub for modules renamed in 3.x).
+ # In that case, we also need delete the real module to clear
+ # the import cache.
+ if module.__name__ != module_name:
+ del sys.modules[module.__name__]
+ del sys.modules[module_name]
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *ignore_exc):
+ sys.modules.update(self.original_modules)
+
+### Added for python-future:
+if utils.PY3:
+ import collections.abc
+ mybase = collections.abc.MutableMapping
+else:
+ import UserDict
+ mybase = UserDict.DictMixin
+###
+
+class EnvironmentVarGuard(mybase):
+
+ """Class to help protect the environment variable properly. Can be used as
+ a context manager."""
+
+ def __init__(self):
+ self._environ = os.environ
+ self._changed = {}
+
+ def __getitem__(self, envvar):
+ return self._environ[envvar]
+
+ def __setitem__(self, envvar, value):
+ # Remember the initial value on the first access
+ if envvar not in self._changed:
+ self._changed[envvar] = self._environ.get(envvar)
+ self._environ[envvar] = value
+
+ def __delitem__(self, envvar):
+ # Remember the initial value on the first access
+ if envvar not in self._changed:
+ self._changed[envvar] = self._environ.get(envvar)
+ if envvar in self._environ:
+ del self._environ[envvar]
+
+ def keys(self):
+ return self._environ.keys()
+
+ def __iter__(self):
+ return iter(self._environ)
+
+ def __len__(self):
+ return len(self._environ)
+
+ def set(self, envvar, value):
+ self[envvar] = value
+
+ def unset(self, envvar):
+ del self[envvar]
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *ignore_exc):
+ for (k, v) in self._changed.items():
+ if v is None:
+ if k in self._environ:
+ del self._environ[k]
+ else:
+ self._environ[k] = v
+ os.environ = self._environ
+
+
+class DirsOnSysPath(object):
+ """Context manager to temporarily add directories to sys.path.
+
+ This makes a copy of sys.path, appends any directories given
+ as positional arguments, then reverts sys.path to the copied
+ settings when the context ends.
+
+ Note that *all* sys.path modifications in the body of the
+ context manager, including replacement of the object,
+ will be reverted at the end of the block.
+ """
+
+ def __init__(self, *paths):
+ self.original_value = sys.path[:]
+ self.original_object = sys.path
+ sys.path.extend(paths)
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *ignore_exc):
+ sys.path = self.original_object
+ sys.path[:] = self.original_value
+
+
+class TransientResource(object):
+
+ """Raise ResourceDenied if an exception is raised while the context manager
+ is in effect that matches the specified exception and attributes."""
+
+ def __init__(self, exc, **kwargs):
+ self.exc = exc
+ self.attrs = kwargs
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, type_=None, value=None, traceback=None):
+ """If type_ is a subclass of self.exc and value has attributes matching
+ self.attrs, raise ResourceDenied. Otherwise let the exception
+ propagate (if any)."""
+ if type_ is not None and issubclass(self.exc, type_):
+ for attr, attr_value in self.attrs.items():
+ if not hasattr(value, attr):
+ break
+ if getattr(value, attr) != attr_value:
+ break
+ else:
+ raise ResourceDenied("an optional resource is not available")
+
+# Context managers that raise ResourceDenied when various issues
+# with the Internet connection manifest themselves as exceptions.
+# XXX deprecate these and use transient_internet() instead
+time_out = TransientResource(IOError, errno=errno.ETIMEDOUT)
+socket_peer_reset = TransientResource(socket.error, errno=errno.ECONNRESET)
+ioerror_peer_reset = TransientResource(IOError, errno=errno.ECONNRESET)
+
+
+@contextlib.contextmanager
+def transient_internet(resource_name, timeout=30.0, errnos=()):
+ """Return a context manager that raises ResourceDenied when various issues
+ with the Internet connection manifest themselves as exceptions."""
+ default_errnos = [
+ ('ECONNREFUSED', 111),
+ ('ECONNRESET', 104),
+ ('EHOSTUNREACH', 113),
+ ('ENETUNREACH', 101),
+ ('ETIMEDOUT', 110),
+ ]
+ default_gai_errnos = [
+ ('EAI_AGAIN', -3),
+ ('EAI_FAIL', -4),
+ ('EAI_NONAME', -2),
+ ('EAI_NODATA', -5),
+ # Encountered when trying to resolve IPv6-only hostnames
+ ('WSANO_DATA', 11004),
+ ]
+
+ denied = ResourceDenied("Resource %r is not available" % resource_name)
+ captured_errnos = errnos
+ gai_errnos = []
+ if not captured_errnos:
+ captured_errnos = [getattr(errno, name, num)
+ for (name, num) in default_errnos]
+ gai_errnos = [getattr(socket, name, num)
+ for (name, num) in default_gai_errnos]
+
+ def filter_error(err):
+ n = getattr(err, 'errno', None)
+ if (isinstance(err, socket.timeout) or
+ (isinstance(err, socket.gaierror) and n in gai_errnos) or
+ n in captured_errnos):
+ if not verbose:
+ sys.stderr.write(denied.args[0] + "\n")
+ # Was: raise denied from err
+ # For Python-Future:
+ exc = denied
+ exc.__cause__ = err
+ raise exc
+
+ old_timeout = socket.getdefaulttimeout()
+ try:
+ if timeout is not None:
+ socket.setdefaulttimeout(timeout)
+ yield
+ except IOError as err:
+ # urllib can wrap original socket errors multiple times (!), we must
+ # unwrap to get at the original error.
+ while True:
+ a = err.args
+ if len(a) >= 1 and isinstance(a[0], IOError):
+ err = a[0]
+ # The error can also be wrapped as args[1]:
+ # except socket.error as msg:
+ # raise IOError('socket error', msg).with_traceback(sys.exc_info()[2])
+ elif len(a) >= 2 and isinstance(a[1], IOError):
+ err = a[1]
+ else:
+ break
+ filter_error(err)
+ raise
+ # XXX should we catch generic exceptions and look for their
+ # __cause__ or __context__?
+ finally:
+ socket.setdefaulttimeout(old_timeout)
+
+
+@contextlib.contextmanager
+def captured_output(stream_name):
+ """Return a context manager used by captured_stdout/stdin/stderr
+ that temporarily replaces the sys stream *stream_name* with a StringIO."""
+ import io
+ orig_stdout = getattr(sys, stream_name)
+ setattr(sys, stream_name, io.StringIO())
+ try:
+ yield getattr(sys, stream_name)
+ finally:
+ setattr(sys, stream_name, orig_stdout)
+
+def captured_stdout():
+ """Capture the output of sys.stdout:
+
+ with captured_stdout() as s:
+ print("hello")
+ self.assertEqual(s.getvalue(), "hello")
+ """
+ return captured_output("stdout")
+
+def captured_stderr():
+ return captured_output("stderr")
+
+def captured_stdin():
+ return captured_output("stdin")
+
+
+def gc_collect():
+ """Force as many objects as possible to be collected.
+
+ In non-CPython implementations of Python, this is needed because timely
+ deallocation is not guaranteed by the garbage collector. (Even in CPython
+ this can be the case in case of reference cycles.) This means that __del__
+ methods may be called later than expected and weakrefs may remain alive for
+ longer than expected. This function tries its best to force all garbage
+ objects to disappear.
+ """
+ gc.collect()
+ if is_jython:
+ time.sleep(0.1)
+ gc.collect()
+ gc.collect()
+
+@contextlib.contextmanager
+def disable_gc():
+ have_gc = gc.isenabled()
+ gc.disable()
+ try:
+ yield
+ finally:
+ if have_gc:
+ gc.enable()
+
+
+def python_is_optimized():
+ """Find if Python was built with optimizations."""
+ # We don't have sysconfig on Py2.6:
+ import sysconfig
+ cflags = sysconfig.get_config_var('PY_CFLAGS') or ''
+ final_opt = ""
+ for opt in cflags.split():
+ if opt.startswith('-O'):
+ final_opt = opt
+ return final_opt != '' and final_opt != '-O0'
+
+
+_header = 'nP'
+_align = '0n'
+if hasattr(sys, "gettotalrefcount"):
+ _header = '2P' + _header
+ _align = '0P'
+_vheader = _header + 'n'
+
+def calcobjsize(fmt):
+ return struct.calcsize(_header + fmt + _align)
+
+def calcvobjsize(fmt):
+ return struct.calcsize(_vheader + fmt + _align)
+
+
+_TPFLAGS_HAVE_GC = 1<<14
+_TPFLAGS_HEAPTYPE = 1<<9
+
+def check_sizeof(test, o, size):
+ result = sys.getsizeof(o)
+ # add GC header size
+ if ((type(o) == type) and (o.__flags__ & _TPFLAGS_HEAPTYPE) or\
+ ((type(o) != type) and (type(o).__flags__ & _TPFLAGS_HAVE_GC))):
+ size += _testcapi.SIZEOF_PYGC_HEAD
+ msg = 'wrong size for %s: got %d, expected %d' \
+ % (type(o), result, size)
+ test.assertEqual(result, size, msg)
+
+#=======================================================================
+# Decorator for running a function in a different locale, correctly resetting
+# it afterwards.
+
+def run_with_locale(catstr, *locales):
+ def decorator(func):
+ def inner(*args, **kwds):
+ try:
+ import locale
+ category = getattr(locale, catstr)
+ orig_locale = locale.setlocale(category)
+ except AttributeError:
+ # if the test author gives us an invalid category string
+ raise
+ except:
+ # cannot retrieve original locale, so do nothing
+ locale = orig_locale = None
+ else:
+ for loc in locales:
+ try:
+ locale.setlocale(category, loc)
+ break
+ except:
+ pass
+
+ # now run the function, resetting the locale on exceptions
+ try:
+ return func(*args, **kwds)
+ finally:
+ if locale and orig_locale:
+ locale.setlocale(category, orig_locale)
+ inner.__name__ = func.__name__
+ inner.__doc__ = func.__doc__
+ return inner
+ return decorator
+
+#=======================================================================
+# Decorator for running a function in a specific timezone, correctly
+# resetting it afterwards.
+
+def run_with_tz(tz):
+ def decorator(func):
+ def inner(*args, **kwds):
+ try:
+ tzset = time.tzset
+ except AttributeError:
+ raise unittest.SkipTest("tzset required")
+ if 'TZ' in os.environ:
+ orig_tz = os.environ['TZ']
+ else:
+ orig_tz = None
+ os.environ['TZ'] = tz
+ tzset()
+
+ # now run the function, resetting the tz on exceptions
+ try:
+ return func(*args, **kwds)
+ finally:
+ if orig_tz is None:
+ del os.environ['TZ']
+ else:
+ os.environ['TZ'] = orig_tz
+ time.tzset()
+
+ inner.__name__ = func.__name__
+ inner.__doc__ = func.__doc__
+ return inner
+ return decorator
+
+#=======================================================================
+# Big-memory-test support. Separate from 'resources' because memory use
+# should be configurable.
+
+# Some handy shorthands. Note that these are used for byte-limits as well
+# as size-limits, in the various bigmem tests
+_1M = 1024*1024
+_1G = 1024 * _1M
+_2G = 2 * _1G
+_4G = 4 * _1G
+
+MAX_Py_ssize_t = sys.maxsize
+
+def set_memlimit(limit):
+ global max_memuse
+ global real_max_memuse
+ sizes = {
+ 'k': 1024,
+ 'm': _1M,
+ 'g': _1G,
+ 't': 1024*_1G,
+ }
+ m = re.match(r'(\d+(\.\d+)?) (K|M|G|T)b?$', limit,
+ re.IGNORECASE | re.VERBOSE)
+ if m is None:
+ raise ValueError('Invalid memory limit %r' % (limit,))
+ memlimit = int(float(m.group(1)) * sizes[m.group(3).lower()])
+ real_max_memuse = memlimit
+ if memlimit > MAX_Py_ssize_t:
+ memlimit = MAX_Py_ssize_t
+ if memlimit < _2G - 1:
+ raise ValueError('Memory limit %r too low to be useful' % (limit,))
+ max_memuse = memlimit
+
+class _MemoryWatchdog(object):
+ """An object which periodically watches the process' memory consumption
+ and prints it out.
+ """
+
+ def __init__(self):
+ self.procfile = '/proc/{pid}/statm'.format(pid=os.getpid())
+ self.started = False
+
+ def start(self):
+ try:
+ f = open(self.procfile, 'r')
+ except OSError as e:
+ warnings.warn('/proc not available for stats: {0}'.format(e),
+ RuntimeWarning)
+ sys.stderr.flush()
+ return
+
+ watchdog_script = findfile("memory_watchdog.py")
+ self.mem_watchdog = subprocess.Popen([sys.executable, watchdog_script],
+ stdin=f, stderr=subprocess.DEVNULL)
+ f.close()
+ self.started = True
+
+ def stop(self):
+ if self.started:
+ self.mem_watchdog.terminate()
+ self.mem_watchdog.wait()
+
+
+def bigmemtest(size, memuse, dry_run=True):
+ """Decorator for bigmem tests.
+
+ 'minsize' is the minimum useful size for the test (in arbitrary,
+ test-interpreted units.) 'memuse' is the number of 'bytes per size' for
+ the test, or a good estimate of it.
+
+ if 'dry_run' is False, it means the test doesn't support dummy runs
+ when -M is not specified.
+ """
+ def decorator(f):
+ def wrapper(self):
+ size = wrapper.size
+ memuse = wrapper.memuse
+ if not real_max_memuse:
+ maxsize = 5147
+ else:
+ maxsize = size
+
+ if ((real_max_memuse or not dry_run)
+ and real_max_memuse < maxsize * memuse):
+ raise unittest.SkipTest(
+ "not enough memory: %.1fG minimum needed"
+ % (size * memuse / (1024 ** 3)))
+
+ if real_max_memuse and verbose:
+ print()
+ print(" ... expected peak memory use: {peak:.1f}G"
+ .format(peak=size * memuse / (1024 ** 3)))
+ watchdog = _MemoryWatchdog()
+ watchdog.start()
+ else:
+ watchdog = None
+
+ try:
+ return f(self, maxsize)
+ finally:
+ if watchdog:
+ watchdog.stop()
+
+ wrapper.size = size
+ wrapper.memuse = memuse
+ return wrapper
+ return decorator
+
+def bigaddrspacetest(f):
+ """Decorator for tests that fill the address space."""
+ def wrapper(self):
+ if max_memuse < MAX_Py_ssize_t:
+ if MAX_Py_ssize_t >= 2**63 - 1 and max_memuse >= 2**31:
+ raise unittest.SkipTest(
+ "not enough memory: try a 32-bit build instead")
+ else:
+ raise unittest.SkipTest(
+ "not enough memory: %.1fG minimum needed"
+ % (MAX_Py_ssize_t / (1024 ** 3)))
+ else:
+ return f(self)
+ return wrapper
+
+#=======================================================================
+# unittest integration.
+
+class BasicTestRunner(object):
+ def run(self, test):
+ result = unittest.TestResult()
+ test(result)
+ return result
+
+def _id(obj):
+ return obj
+
+def requires_resource(resource):
+ if resource == 'gui' and not _is_gui_available():
+ return unittest.skip("resource 'gui' is not available")
+ if is_resource_enabled(resource):
+ return _id
+ else:
+ return unittest.skip("resource {0!r} is not enabled".format(resource))
+
+def cpython_only(test):
+ """
+ Decorator for tests only applicable on CPython.
+ """
+ return impl_detail(cpython=True)(test)
+
+def impl_detail(msg=None, **guards):
+ if check_impl_detail(**guards):
+ return _id
+ if msg is None:
+ guardnames, default = _parse_guards(guards)
+ if default:
+ msg = "implementation detail not available on {0}"
+ else:
+ msg = "implementation detail specific to {0}"
+ guardnames = sorted(guardnames.keys())
+ msg = msg.format(' or '.join(guardnames))
+ return unittest.skip(msg)
+
+def _parse_guards(guards):
+ # Returns a tuple ({platform_name: run_me}, default_value)
+ if not guards:
+ return ({'cpython': True}, False)
+ is_true = list(guards.values())[0]
+ assert list(guards.values()) == [is_true] * len(guards) # all True or all False
+ return (guards, not is_true)
+
+# Use the following check to guard CPython's implementation-specific tests --
+# or to run them only on the implementation(s) guarded by the arguments.
+def check_impl_detail(**guards):
+ """This function returns True or False depending on the host platform.
+ Examples:
+ if check_impl_detail(): # only on CPython (default)
+ if check_impl_detail(jython=True): # only on Jython
+ if check_impl_detail(cpython=False): # everywhere except on CPython
+ """
+ guards, default = _parse_guards(guards)
+ return guards.get(platform.python_implementation().lower(), default)
+
+
+def no_tracing(func):
+ """Decorator to temporarily turn off tracing for the duration of a test."""
+ if not hasattr(sys, 'gettrace'):
+ return func
+ else:
+ @functools.wraps(func)
+ def wrapper(*args, **kwargs):
+ original_trace = sys.gettrace()
+ try:
+ sys.settrace(None)
+ return func(*args, **kwargs)
+ finally:
+ sys.settrace(original_trace)
+ return wrapper
+
+
+def refcount_test(test):
+ """Decorator for tests which involve reference counting.
+
+ To start, the decorator does not run the test if is not run by CPython.
+ After that, any trace function is unset during the test to prevent
+ unexpected refcounts caused by the trace function.
+
+ """
+ return no_tracing(cpython_only(test))
+
+
+def _filter_suite(suite, pred):
+ """Recursively filter test cases in a suite based on a predicate."""
+ newtests = []
+ for test in suite._tests:
+ if isinstance(test, unittest.TestSuite):
+ _filter_suite(test, pred)
+ newtests.append(test)
+ else:
+ if pred(test):
+ newtests.append(test)
+ suite._tests = newtests
+
+def _run_suite(suite):
+ """Run tests from a unittest.TestSuite-derived class."""
+ if verbose:
+ runner = unittest.TextTestRunner(sys.stdout, verbosity=2,
+ failfast=failfast)
+ else:
+ runner = BasicTestRunner()
+
+ result = runner.run(suite)
+ if not result.wasSuccessful():
+ if len(result.errors) == 1 and not result.failures:
+ err = result.errors[0][1]
+ elif len(result.failures) == 1 and not result.errors:
+ err = result.failures[0][1]
+ else:
+ err = "multiple errors occurred"
+ if not verbose: err += "; run in verbose mode for details"
+ raise TestFailed(err)
+
+
+def run_unittest(*classes):
+ """Run tests from unittest.TestCase-derived classes."""
+ valid_types = (unittest.TestSuite, unittest.TestCase)
+ suite = unittest.TestSuite()
+ for cls in classes:
+ if isinstance(cls, str):
+ if cls in sys.modules:
+ suite.addTest(unittest.findTestCases(sys.modules[cls]))
+ else:
+ raise ValueError("str arguments must be keys in sys.modules")
+ elif isinstance(cls, valid_types):
+ suite.addTest(cls)
+ else:
+ suite.addTest(unittest.makeSuite(cls))
+ def case_pred(test):
+ if match_tests is None:
+ return True
+ for name in test.id().split("."):
+ if fnmatch.fnmatchcase(name, match_tests):
+ return True
+ return False
+ _filter_suite(suite, case_pred)
+ _run_suite(suite)
+
+# We don't have sysconfig on Py2.6:
+# #=======================================================================
+# # Check for the presence of docstrings.
+#
+# HAVE_DOCSTRINGS = (check_impl_detail(cpython=False) or
+# sys.platform == 'win32' or
+# sysconfig.get_config_var('WITH_DOC_STRINGS'))
+#
+# requires_docstrings = unittest.skipUnless(HAVE_DOCSTRINGS,
+# "test requires docstrings")
+#
+#
+# #=======================================================================
+# doctest driver.
+
+def run_doctest(module, verbosity=None, optionflags=0):
+ """Run doctest on the given module. Return (#failures, #tests).
+
+ If optional argument verbosity is not specified (or is None), pass
+ support's belief about verbosity on to doctest. Else doctest's
+ usual behavior is used (it searches sys.argv for -v).
+ """
+
+ import doctest
+
+ if verbosity is None:
+ verbosity = verbose
+ else:
+ verbosity = None
+
+ f, t = doctest.testmod(module, verbose=verbosity, optionflags=optionflags)
+ if f:
+ raise TestFailed("%d of %d doctests failed" % (f, t))
+ if verbose:
+ print('doctest (%s) ... %d tests with zero failures' %
+ (module.__name__, t))
+ return f, t
+
+
+#=======================================================================
+# Support for saving and restoring the imported modules.
+
+def modules_setup():
+ return sys.modules.copy(),
+
+def modules_cleanup(oldmodules):
+ # Encoders/decoders are registered permanently within the internal
+ # codec cache. If we destroy the corresponding modules their
+ # globals will be set to None which will trip up the cached functions.
+ encodings = [(k, v) for k, v in sys.modules.items()
+ if k.startswith('encodings.')]
+ # Was:
+ # sys.modules.clear()
+ # Py2-compatible:
+ for i in range(len(sys.modules)):
+ sys.modules.pop()
+
+ sys.modules.update(encodings)
+ # XXX: This kind of problem can affect more than just encodings. In particular
+ # extension modules (such as _ssl) don't cope with reloading properly.
+ # Really, test modules should be cleaning out the test specific modules they
+ # know they added (ala test_runpy) rather than relying on this function (as
+ # test_importhooks and test_pkg do currently).
+ # Implicitly imported *real* modules should be left alone (see issue 10556).
+ sys.modules.update(oldmodules)
+
+#=======================================================================
+# Backported versions of threading_setup() and threading_cleanup() which don't refer
+# to threading._dangling (not available on Py2.7).
+
+# Threading support to prevent reporting refleaks when running regrtest.py -R
+
+# NOTE: we use thread._count() rather than threading.enumerate() (or the
+# moral equivalent thereof) because a threading.Thread object is still alive
+# until its __bootstrap() method has returned, even after it has been
+# unregistered from the threading module.
+# thread._count(), on the other hand, only gets decremented *after* the
+# __bootstrap() method has returned, which gives us reliable reference counts
+# at the end of a test run.
+
+def threading_setup():
+ if _thread:
+ return _thread._count(),
+ else:
+ return 1,
+
+def threading_cleanup(nb_threads):
+ if not _thread:
+ return
+
+ _MAX_COUNT = 10
+ for count in range(_MAX_COUNT):
+ n = _thread._count()
+ if n == nb_threads:
+ break
+ time.sleep(0.1)
+ # XXX print a warning in case of failure?
+
+def reap_threads(func):
+ """Use this function when threads are being used. This will
+ ensure that the threads are cleaned up even when the test fails.
+ If threading is unavailable this function does nothing.
+ """
+ if not _thread:
+ return func
+
+ @functools.wraps(func)
+ def decorator(*args):
+ key = threading_setup()
+ try:
+ return func(*args)
+ finally:
+ threading_cleanup(*key)
+ return decorator
+
+def reap_children():
+ """Use this function at the end of test_main() whenever sub-processes
+ are started. This will help ensure that no extra children (zombies)
+ stick around to hog resources and create problems when looking
+ for refleaks.
+ """
+
+ # Reap all our dead child processes so we don't leave zombies around.
+ # These hog resources and might be causing some of the buildbots to die.
+ if hasattr(os, 'waitpid'):
+ any_process = -1
+ while True:
+ try:
+ # This will raise an exception on Windows. That's ok.
+ pid, status = os.waitpid(any_process, os.WNOHANG)
+ if pid == 0:
+ break
+ except:
+ break
+
+@contextlib.contextmanager
+def swap_attr(obj, attr, new_val):
+ """Temporary swap out an attribute with a new object.
+
+ Usage:
+ with swap_attr(obj, "attr", 5):
+ ...
+
+ This will set obj.attr to 5 for the duration of the with: block,
+ restoring the old value at the end of the block. If `attr` doesn't
+ exist on `obj`, it will be created and then deleted at the end of the
+ block.
+ """
+ if hasattr(obj, attr):
+ real_val = getattr(obj, attr)
+ setattr(obj, attr, new_val)
+ try:
+ yield
+ finally:
+ setattr(obj, attr, real_val)
+ else:
+ setattr(obj, attr, new_val)
+ try:
+ yield
+ finally:
+ delattr(obj, attr)
+
+@contextlib.contextmanager
+def swap_item(obj, item, new_val):
+ """Temporary swap out an item with a new object.
+
+ Usage:
+ with swap_item(obj, "item", 5):
+ ...
+
+ This will set obj["item"] to 5 for the duration of the with: block,
+ restoring the old value at the end of the block. If `item` doesn't
+ exist on `obj`, it will be created and then deleted at the end of the
+ block.
+ """
+ if item in obj:
+ real_val = obj[item]
+ obj[item] = new_val
+ try:
+ yield
+ finally:
+ obj[item] = real_val
+ else:
+ obj[item] = new_val
+ try:
+ yield
+ finally:
+ del obj[item]
+
+def strip_python_stderr(stderr):
+ """Strip the stderr of a Python process from potential debug output
+ emitted by the interpreter.
+
+ This will typically be run on the result of the communicate() method
+ of a subprocess.Popen object.
+ """
+ stderr = re.sub(br"\[\d+ refs\]\r?\n?", b"", stderr).strip()
+ return stderr
+
+def args_from_interpreter_flags():
+ """Return a list of command-line arguments reproducing the current
+ settings in sys.flags and sys.warnoptions."""
+ return subprocess._args_from_interpreter_flags()
+
+#============================================================
+# Support for assertions about logging.
+#============================================================
+
+class TestHandler(logging.handlers.BufferingHandler):
+ def __init__(self, matcher):
+ # BufferingHandler takes a "capacity" argument
+ # so as to know when to flush. As we're overriding
+ # shouldFlush anyway, we can set a capacity of zero.
+ # You can call flush() manually to clear out the
+ # buffer.
+ logging.handlers.BufferingHandler.__init__(self, 0)
+ self.matcher = matcher
+
+ def shouldFlush(self):
+ return False
+
+ def emit(self, record):
+ self.format(record)
+ self.buffer.append(record.__dict__)
+
+ def matches(self, **kwargs):
+ """
+ Look for a saved dict whose keys/values match the supplied arguments.
+ """
+ result = False
+ for d in self.buffer:
+ if self.matcher.matches(d, **kwargs):
+ result = True
+ break
+ return result
+
+class Matcher(object):
+
+ _partial_matches = ('msg', 'message')
+
+ def matches(self, d, **kwargs):
+ """
+ Try to match a single dict with the supplied arguments.
+
+ Keys whose values are strings and which are in self._partial_matches
+ will be checked for partial (i.e. substring) matches. You can extend
+ this scheme to (for example) do regular expression matching, etc.
+ """
+ result = True
+ for k in kwargs:
+ v = kwargs[k]
+ dv = d.get(k)
+ if not self.match_value(k, dv, v):
+ result = False
+ break
+ return result
+
+ def match_value(self, k, dv, v):
+ """
+ Try to match a single stored value (dv) with a supplied value (v).
+ """
+ if type(v) != type(dv):
+ result = False
+ elif type(dv) is not str or k not in self._partial_matches:
+ result = (v == dv)
+ else:
+ result = dv.find(v) >= 0
+ return result
+
+
+_can_symlink = None
+def can_symlink():
+ global _can_symlink
+ if _can_symlink is not None:
+ return _can_symlink
+ symlink_path = TESTFN + "can_symlink"
+ try:
+ os.symlink(TESTFN, symlink_path)
+ can = True
+ except (OSError, NotImplementedError, AttributeError):
+ can = False
+ else:
+ os.remove(symlink_path)
+ _can_symlink = can
+ return can
+
+def skip_unless_symlink(test):
+ """Skip decorator for tests that require functional symlink"""
+ ok = can_symlink()
+ msg = "Requires functional symlink implementation"
+ return test if ok else unittest.skip(msg)(test)
+
+_can_xattr = None
+def can_xattr():
+ global _can_xattr
+ if _can_xattr is not None:
+ return _can_xattr
+ if not hasattr(os, "setxattr"):
+ can = False
+ else:
+ tmp_fp, tmp_name = tempfile.mkstemp()
+ try:
+ with open(TESTFN, "wb") as fp:
+ try:
+ # TESTFN & tempfile may use different file systems with
+ # different capabilities
+ os.setxattr(tmp_fp, b"user.test", b"")
+ os.setxattr(fp.fileno(), b"user.test", b"")
+ # Kernels < 2.6.39 don't respect setxattr flags.
+ kernel_version = platform.release()
+ m = re.match("2.6.(\d{1,2})", kernel_version)
+ can = m is None or int(m.group(1)) >= 39
+ except OSError:
+ can = False
+ finally:
+ unlink(TESTFN)
+ unlink(tmp_name)
+ _can_xattr = can
+ return can
+
+def skip_unless_xattr(test):
+ """Skip decorator for tests that require functional extended attributes"""
+ ok = can_xattr()
+ msg = "no non-broken extended attribute support"
+ return test if ok else unittest.skip(msg)(test)
+
+
+if sys.platform.startswith('win'):
+ @contextlib.contextmanager
+ def suppress_crash_popup():
+ """Disable Windows Error Reporting dialogs using SetErrorMode."""
+ # see http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621%28v=vs.85%29.aspx
+ # GetErrorMode is not available on Windows XP and Windows Server 2003,
+ # but SetErrorMode returns the previous value, so we can use that
+ import ctypes
+ k32 = ctypes.windll.kernel32
+ SEM_NOGPFAULTERRORBOX = 0x02
+ old_error_mode = k32.SetErrorMode(SEM_NOGPFAULTERRORBOX)
+ k32.SetErrorMode(old_error_mode | SEM_NOGPFAULTERRORBOX)
+ try:
+ yield
+ finally:
+ k32.SetErrorMode(old_error_mode)
+else:
+ # this is a no-op for other platforms
+ @contextlib.contextmanager
+ def suppress_crash_popup():
+ yield
+
+
+def patch(test_instance, object_to_patch, attr_name, new_value):
+ """Override 'object_to_patch'.'attr_name' with 'new_value'.
+
+ Also, add a cleanup procedure to 'test_instance' to restore
+ 'object_to_patch' value for 'attr_name'.
+ The 'attr_name' should be a valid attribute for 'object_to_patch'.
+
+ """
+ # check that 'attr_name' is a real attribute for 'object_to_patch'
+ # will raise AttributeError if it does not exist
+ getattr(object_to_patch, attr_name)
+
+ # keep a copy of the old value
+ attr_is_local = False
+ try:
+ old_value = object_to_patch.__dict__[attr_name]
+ except (AttributeError, KeyError):
+ old_value = getattr(object_to_patch, attr_name, None)
+ else:
+ attr_is_local = True
+
+ # restore the value when the test is done
+ def cleanup():
+ if attr_is_local:
+ setattr(object_to_patch, attr_name, old_value)
+ else:
+ delattr(object_to_patch, attr_name)
+
+ test_instance.addCleanup(cleanup)
+
+ # actually override the attribute
+ setattr(object_to_patch, attr_name, new_value)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/total_ordering.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/total_ordering.py
new file mode 100644
index 0000000..760f06d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/total_ordering.py
@@ -0,0 +1,38 @@
+"""
+For Python < 2.7.2. total_ordering in versions prior to 2.7.2 is buggy.
+See http://bugs.python.org/issue10042 for details. For these versions use
+code borrowed from Python 2.7.3.
+
+From django.utils.
+"""
+
+import sys
+if sys.version_info >= (2, 7, 2):
+ from functools import total_ordering
+else:
+ def total_ordering(cls):
+ """Class decorator that fills in missing ordering methods"""
+ convert = {
+ '__lt__': [('__gt__', lambda self, other: not (self < other or self == other)),
+ ('__le__', lambda self, other: self < other or self == other),
+ ('__ge__', lambda self, other: not self < other)],
+ '__le__': [('__ge__', lambda self, other: not self <= other or self == other),
+ ('__lt__', lambda self, other: self <= other and not self == other),
+ ('__gt__', lambda self, other: not self <= other)],
+ '__gt__': [('__lt__', lambda self, other: not (self > other or self == other)),
+ ('__ge__', lambda self, other: self > other or self == other),
+ ('__le__', lambda self, other: not self > other)],
+ '__ge__': [('__le__', lambda self, other: (not self >= other) or self == other),
+ ('__gt__', lambda self, other: self >= other and not self == other),
+ ('__lt__', lambda self, other: not self >= other)]
+ }
+ roots = set(dir(cls)) & set(convert)
+ if not roots:
+ raise ValueError('must define at least one ordering operation: < > <= >=')
+ root = max(roots) # prefer __lt__ to __le__ to __gt__ to __ge__
+ for opname, opfunc in convert[root]:
+ if opname not in roots:
+ opfunc.__name__ = opname
+ opfunc.__doc__ = getattr(int, opname).__doc__
+ setattr(cls, opname, opfunc)
+ return cls
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/urllib/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/urllib/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/urllib/error.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/urllib/error.py
new file mode 100644
index 0000000..a473e44
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/urllib/error.py
@@ -0,0 +1,75 @@
+"""Exception classes raised by urllib.
+
+The base exception class is URLError, which inherits from IOError. It
+doesn't define any behavior of its own, but is the base class for all
+exceptions defined in this package.
+
+HTTPError is an exception class that is also a valid HTTP response
+instance. It behaves this way because HTTP protocol errors are valid
+responses, with a status code, headers, and a body. In some contexts,
+an application may want to handle an exception like a regular
+response.
+"""
+from __future__ import absolute_import, division, unicode_literals
+from future import standard_library
+
+from future.backports.urllib import response as urllib_response
+
+
+__all__ = ['URLError', 'HTTPError', 'ContentTooShortError']
+
+
+# do these error classes make sense?
+# make sure all of the IOError stuff is overridden. we just want to be
+# subtypes.
+
+class URLError(IOError):
+ # URLError is a sub-type of IOError, but it doesn't share any of
+ # the implementation. need to override __init__ and __str__.
+ # It sets self.args for compatibility with other EnvironmentError
+ # subclasses, but args doesn't have the typical format with errno in
+ # slot 0 and strerror in slot 1. This may be better than nothing.
+ def __init__(self, reason, filename=None):
+ self.args = reason,
+ self.reason = reason
+ if filename is not None:
+ self.filename = filename
+
+ def __str__(self):
+ return '' % self.reason
+
+class HTTPError(URLError, urllib_response.addinfourl):
+ """Raised when HTTP error occurs, but also acts like non-error return"""
+ __super_init = urllib_response.addinfourl.__init__
+
+ def __init__(self, url, code, msg, hdrs, fp):
+ self.code = code
+ self.msg = msg
+ self.hdrs = hdrs
+ self.fp = fp
+ self.filename = url
+ # The addinfourl classes depend on fp being a valid file
+ # object. In some cases, the HTTPError may not have a valid
+ # file object. If this happens, the simplest workaround is to
+ # not initialize the base classes.
+ if fp is not None:
+ self.__super_init(fp, hdrs, url, code)
+
+ def __str__(self):
+ return 'HTTP Error %s: %s' % (self.code, self.msg)
+
+ # since URLError specifies a .reason attribute, HTTPError should also
+ # provide this attribute. See issue13211 for discussion.
+ @property
+ def reason(self):
+ return self.msg
+
+ def info(self):
+ return self.hdrs
+
+
+# exception raised when downloaded size does not match content-length
+class ContentTooShortError(URLError):
+ def __init__(self, message, content):
+ URLError.__init__(self, message)
+ self.content = content
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/urllib/parse.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/urllib/parse.py
new file mode 100644
index 0000000..ada2f8b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/urllib/parse.py
@@ -0,0 +1,991 @@
+"""
+Ported using Python-Future from the Python 3.3 standard library.
+
+Parse (absolute and relative) URLs.
+
+urlparse module is based upon the following RFC specifications.
+
+RFC 3986 (STD66): "Uniform Resource Identifiers" by T. Berners-Lee, R. Fielding
+and L. Masinter, January 2005.
+
+RFC 2732 : "Format for Literal IPv6 Addresses in URL's by R.Hinden, B.Carpenter
+and L.Masinter, December 1999.
+
+RFC 2396: "Uniform Resource Identifiers (URI)": Generic Syntax by T.
+Berners-Lee, R. Fielding, and L. Masinter, August 1998.
+
+RFC 2368: "The mailto URL scheme", by P.Hoffman , L Masinter, J. Zawinski, July 1998.
+
+RFC 1808: "Relative Uniform Resource Locators", by R. Fielding, UC Irvine, June
+1995.
+
+RFC 1738: "Uniform Resource Locators (URL)" by T. Berners-Lee, L. Masinter, M.
+McCahill, December 1994
+
+RFC 3986 is considered the current standard and any future changes to
+urlparse module should conform with it. The urlparse module is
+currently not entirely compliant with this RFC due to defacto
+scenarios for parsing, and for backward compatibility purposes, some
+parsing quirks from older RFCs are retained. The testcases in
+test_urlparse.py provides a good indicator of parsing behavior.
+"""
+from __future__ import absolute_import, division, unicode_literals
+from future.builtins import bytes, chr, dict, int, range, str
+from future.utils import raise_with_traceback
+
+import re
+import sys
+import collections
+
+__all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag",
+ "urlsplit", "urlunsplit", "urlencode", "parse_qs",
+ "parse_qsl", "quote", "quote_plus", "quote_from_bytes",
+ "unquote", "unquote_plus", "unquote_to_bytes"]
+
+# A classification of schemes ('' means apply by default)
+uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap',
+ 'wais', 'file', 'https', 'shttp', 'mms',
+ 'prospero', 'rtsp', 'rtspu', '', 'sftp',
+ 'svn', 'svn+ssh']
+uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet',
+ 'imap', 'wais', 'file', 'mms', 'https', 'shttp',
+ 'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', '',
+ 'svn', 'svn+ssh', 'sftp', 'nfs', 'git', 'git+ssh']
+uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap',
+ 'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips',
+ 'mms', '', 'sftp', 'tel']
+
+# These are not actually used anymore, but should stay for backwards
+# compatibility. (They are undocumented, but have a public-looking name.)
+non_hierarchical = ['gopher', 'hdl', 'mailto', 'news',
+ 'telnet', 'wais', 'imap', 'snews', 'sip', 'sips']
+uses_query = ['http', 'wais', 'imap', 'https', 'shttp', 'mms',
+ 'gopher', 'rtsp', 'rtspu', 'sip', 'sips', '']
+uses_fragment = ['ftp', 'hdl', 'http', 'gopher', 'news',
+ 'nntp', 'wais', 'https', 'shttp', 'snews',
+ 'file', 'prospero', '']
+
+# Characters valid in scheme names
+scheme_chars = ('abcdefghijklmnopqrstuvwxyz'
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ '0123456789'
+ '+-.')
+
+# XXX: Consider replacing with functools.lru_cache
+MAX_CACHE_SIZE = 20
+_parse_cache = {}
+
+def clear_cache():
+ """Clear the parse cache and the quoters cache."""
+ _parse_cache.clear()
+ _safe_quoters.clear()
+
+
+# Helpers for bytes handling
+# For 3.2, we deliberately require applications that
+# handle improperly quoted URLs to do their own
+# decoding and encoding. If valid use cases are
+# presented, we may relax this by using latin-1
+# decoding internally for 3.3
+_implicit_encoding = 'ascii'
+_implicit_errors = 'strict'
+
+def _noop(obj):
+ return obj
+
+def _encode_result(obj, encoding=_implicit_encoding,
+ errors=_implicit_errors):
+ return obj.encode(encoding, errors)
+
+def _decode_args(args, encoding=_implicit_encoding,
+ errors=_implicit_errors):
+ return tuple(x.decode(encoding, errors) if x else '' for x in args)
+
+def _coerce_args(*args):
+ # Invokes decode if necessary to create str args
+ # and returns the coerced inputs along with
+ # an appropriate result coercion function
+ # - noop for str inputs
+ # - encoding function otherwise
+ str_input = isinstance(args[0], str)
+ for arg in args[1:]:
+ # We special-case the empty string to support the
+ # "scheme=''" default argument to some functions
+ if arg and isinstance(arg, str) != str_input:
+ raise TypeError("Cannot mix str and non-str arguments")
+ if str_input:
+ return args + (_noop,)
+ return _decode_args(args) + (_encode_result,)
+
+# Result objects are more helpful than simple tuples
+class _ResultMixinStr(object):
+ """Standard approach to encoding parsed results from str to bytes"""
+ __slots__ = ()
+
+ def encode(self, encoding='ascii', errors='strict'):
+ return self._encoded_counterpart(*(x.encode(encoding, errors) for x in self))
+
+
+class _ResultMixinBytes(object):
+ """Standard approach to decoding parsed results from bytes to str"""
+ __slots__ = ()
+
+ def decode(self, encoding='ascii', errors='strict'):
+ return self._decoded_counterpart(*(x.decode(encoding, errors) for x in self))
+
+
+class _NetlocResultMixinBase(object):
+ """Shared methods for the parsed result objects containing a netloc element"""
+ __slots__ = ()
+
+ @property
+ def username(self):
+ return self._userinfo[0]
+
+ @property
+ def password(self):
+ return self._userinfo[1]
+
+ @property
+ def hostname(self):
+ hostname = self._hostinfo[0]
+ if not hostname:
+ hostname = None
+ elif hostname is not None:
+ hostname = hostname.lower()
+ return hostname
+
+ @property
+ def port(self):
+ port = self._hostinfo[1]
+ if port is not None:
+ port = int(port, 10)
+ # Return None on an illegal port
+ if not ( 0 <= port <= 65535):
+ return None
+ return port
+
+
+class _NetlocResultMixinStr(_NetlocResultMixinBase, _ResultMixinStr):
+ __slots__ = ()
+
+ @property
+ def _userinfo(self):
+ netloc = self.netloc
+ userinfo, have_info, hostinfo = netloc.rpartition('@')
+ if have_info:
+ username, have_password, password = userinfo.partition(':')
+ if not have_password:
+ password = None
+ else:
+ username = password = None
+ return username, password
+
+ @property
+ def _hostinfo(self):
+ netloc = self.netloc
+ _, _, hostinfo = netloc.rpartition('@')
+ _, have_open_br, bracketed = hostinfo.partition('[')
+ if have_open_br:
+ hostname, _, port = bracketed.partition(']')
+ _, have_port, port = port.partition(':')
+ else:
+ hostname, have_port, port = hostinfo.partition(':')
+ if not have_port:
+ port = None
+ return hostname, port
+
+
+class _NetlocResultMixinBytes(_NetlocResultMixinBase, _ResultMixinBytes):
+ __slots__ = ()
+
+ @property
+ def _userinfo(self):
+ netloc = self.netloc
+ userinfo, have_info, hostinfo = netloc.rpartition(b'@')
+ if have_info:
+ username, have_password, password = userinfo.partition(b':')
+ if not have_password:
+ password = None
+ else:
+ username = password = None
+ return username, password
+
+ @property
+ def _hostinfo(self):
+ netloc = self.netloc
+ _, _, hostinfo = netloc.rpartition(b'@')
+ _, have_open_br, bracketed = hostinfo.partition(b'[')
+ if have_open_br:
+ hostname, _, port = bracketed.partition(b']')
+ _, have_port, port = port.partition(b':')
+ else:
+ hostname, have_port, port = hostinfo.partition(b':')
+ if not have_port:
+ port = None
+ return hostname, port
+
+
+from collections import namedtuple
+
+_DefragResultBase = namedtuple('DefragResult', 'url fragment')
+_SplitResultBase = namedtuple('SplitResult', 'scheme netloc path query fragment')
+_ParseResultBase = namedtuple('ParseResult', 'scheme netloc path params query fragment')
+
+# For backwards compatibility, alias _NetlocResultMixinStr
+# ResultBase is no longer part of the documented API, but it is
+# retained since deprecating it isn't worth the hassle
+ResultBase = _NetlocResultMixinStr
+
+# Structured result objects for string data
+class DefragResult(_DefragResultBase, _ResultMixinStr):
+ __slots__ = ()
+ def geturl(self):
+ if self.fragment:
+ return self.url + '#' + self.fragment
+ else:
+ return self.url
+
+class SplitResult(_SplitResultBase, _NetlocResultMixinStr):
+ __slots__ = ()
+ def geturl(self):
+ return urlunsplit(self)
+
+class ParseResult(_ParseResultBase, _NetlocResultMixinStr):
+ __slots__ = ()
+ def geturl(self):
+ return urlunparse(self)
+
+# Structured result objects for bytes data
+class DefragResultBytes(_DefragResultBase, _ResultMixinBytes):
+ __slots__ = ()
+ def geturl(self):
+ if self.fragment:
+ return self.url + b'#' + self.fragment
+ else:
+ return self.url
+
+class SplitResultBytes(_SplitResultBase, _NetlocResultMixinBytes):
+ __slots__ = ()
+ def geturl(self):
+ return urlunsplit(self)
+
+class ParseResultBytes(_ParseResultBase, _NetlocResultMixinBytes):
+ __slots__ = ()
+ def geturl(self):
+ return urlunparse(self)
+
+# Set up the encode/decode result pairs
+def _fix_result_transcoding():
+ _result_pairs = (
+ (DefragResult, DefragResultBytes),
+ (SplitResult, SplitResultBytes),
+ (ParseResult, ParseResultBytes),
+ )
+ for _decoded, _encoded in _result_pairs:
+ _decoded._encoded_counterpart = _encoded
+ _encoded._decoded_counterpart = _decoded
+
+_fix_result_transcoding()
+del _fix_result_transcoding
+
+def urlparse(url, scheme='', allow_fragments=True):
+ """Parse a URL into 6 components:
+ :///;?#
+ Return a 6-tuple: (scheme, netloc, path, params, query, fragment).
+ Note that we don't break the components up in smaller bits
+ (e.g. netloc is a single string) and we don't expand % escapes."""
+ url, scheme, _coerce_result = _coerce_args(url, scheme)
+ splitresult = urlsplit(url, scheme, allow_fragments)
+ scheme, netloc, url, query, fragment = splitresult
+ if scheme in uses_params and ';' in url:
+ url, params = _splitparams(url)
+ else:
+ params = ''
+ result = ParseResult(scheme, netloc, url, params, query, fragment)
+ return _coerce_result(result)
+
+def _splitparams(url):
+ if '/' in url:
+ i = url.find(';', url.rfind('/'))
+ if i < 0:
+ return url, ''
+ else:
+ i = url.find(';')
+ return url[:i], url[i+1:]
+
+def _splitnetloc(url, start=0):
+ delim = len(url) # position of end of domain part of url, default is end
+ for c in '/?#': # look for delimiters; the order is NOT important
+ wdelim = url.find(c, start) # find first of this delim
+ if wdelim >= 0: # if found
+ delim = min(delim, wdelim) # use earliest delim position
+ return url[start:delim], url[delim:] # return (domain, rest)
+
+def urlsplit(url, scheme='', allow_fragments=True):
+ """Parse a URL into 5 components:
+ :///?#
+ Return a 5-tuple: (scheme, netloc, path, query, fragment).
+ Note that we don't break the components up in smaller bits
+ (e.g. netloc is a single string) and we don't expand % escapes."""
+ url, scheme, _coerce_result = _coerce_args(url, scheme)
+ allow_fragments = bool(allow_fragments)
+ key = url, scheme, allow_fragments, type(url), type(scheme)
+ cached = _parse_cache.get(key, None)
+ if cached:
+ return _coerce_result(cached)
+ if len(_parse_cache) >= MAX_CACHE_SIZE: # avoid runaway growth
+ clear_cache()
+ netloc = query = fragment = ''
+ i = url.find(':')
+ if i > 0:
+ if url[:i] == 'http': # optimize the common case
+ scheme = url[:i].lower()
+ url = url[i+1:]
+ if url[:2] == '//':
+ netloc, url = _splitnetloc(url, 2)
+ if (('[' in netloc and ']' not in netloc) or
+ (']' in netloc and '[' not in netloc)):
+ raise ValueError("Invalid IPv6 URL")
+ if allow_fragments and '#' in url:
+ url, fragment = url.split('#', 1)
+ if '?' in url:
+ url, query = url.split('?', 1)
+ v = SplitResult(scheme, netloc, url, query, fragment)
+ _parse_cache[key] = v
+ return _coerce_result(v)
+ for c in url[:i]:
+ if c not in scheme_chars:
+ break
+ else:
+ # make sure "url" is not actually a port number (in which case
+ # "scheme" is really part of the path)
+ rest = url[i+1:]
+ if not rest or any(c not in '0123456789' for c in rest):
+ # not a port number
+ scheme, url = url[:i].lower(), rest
+
+ if url[:2] == '//':
+ netloc, url = _splitnetloc(url, 2)
+ if (('[' in netloc and ']' not in netloc) or
+ (']' in netloc and '[' not in netloc)):
+ raise ValueError("Invalid IPv6 URL")
+ if allow_fragments and '#' in url:
+ url, fragment = url.split('#', 1)
+ if '?' in url:
+ url, query = url.split('?', 1)
+ v = SplitResult(scheme, netloc, url, query, fragment)
+ _parse_cache[key] = v
+ return _coerce_result(v)
+
+def urlunparse(components):
+ """Put a parsed URL back together again. This may result in a
+ slightly different, but equivalent URL, if the URL that was parsed
+ originally had redundant delimiters, e.g. a ? with an empty query
+ (the draft states that these are equivalent)."""
+ scheme, netloc, url, params, query, fragment, _coerce_result = (
+ _coerce_args(*components))
+ if params:
+ url = "%s;%s" % (url, params)
+ return _coerce_result(urlunsplit((scheme, netloc, url, query, fragment)))
+
+def urlunsplit(components):
+ """Combine the elements of a tuple as returned by urlsplit() into a
+ complete URL as a string. The data argument can be any five-item iterable.
+ This may result in a slightly different, but equivalent URL, if the URL that
+ was parsed originally had unnecessary delimiters (for example, a ? with an
+ empty query; the RFC states that these are equivalent)."""
+ scheme, netloc, url, query, fragment, _coerce_result = (
+ _coerce_args(*components))
+ if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'):
+ if url and url[:1] != '/': url = '/' + url
+ url = '//' + (netloc or '') + url
+ if scheme:
+ url = scheme + ':' + url
+ if query:
+ url = url + '?' + query
+ if fragment:
+ url = url + '#' + fragment
+ return _coerce_result(url)
+
+def urljoin(base, url, allow_fragments=True):
+ """Join a base URL and a possibly relative URL to form an absolute
+ interpretation of the latter."""
+ if not base:
+ return url
+ if not url:
+ return base
+ base, url, _coerce_result = _coerce_args(base, url)
+ bscheme, bnetloc, bpath, bparams, bquery, bfragment = \
+ urlparse(base, '', allow_fragments)
+ scheme, netloc, path, params, query, fragment = \
+ urlparse(url, bscheme, allow_fragments)
+ if scheme != bscheme or scheme not in uses_relative:
+ return _coerce_result(url)
+ if scheme in uses_netloc:
+ if netloc:
+ return _coerce_result(urlunparse((scheme, netloc, path,
+ params, query, fragment)))
+ netloc = bnetloc
+ if path[:1] == '/':
+ return _coerce_result(urlunparse((scheme, netloc, path,
+ params, query, fragment)))
+ if not path and not params:
+ path = bpath
+ params = bparams
+ if not query:
+ query = bquery
+ return _coerce_result(urlunparse((scheme, netloc, path,
+ params, query, fragment)))
+ segments = bpath.split('/')[:-1] + path.split('/')
+ # XXX The stuff below is bogus in various ways...
+ if segments[-1] == '.':
+ segments[-1] = ''
+ while '.' in segments:
+ segments.remove('.')
+ while 1:
+ i = 1
+ n = len(segments) - 1
+ while i < n:
+ if (segments[i] == '..'
+ and segments[i-1] not in ('', '..')):
+ del segments[i-1:i+1]
+ break
+ i = i+1
+ else:
+ break
+ if segments == ['', '..']:
+ segments[-1] = ''
+ elif len(segments) >= 2 and segments[-1] == '..':
+ segments[-2:] = ['']
+ return _coerce_result(urlunparse((scheme, netloc, '/'.join(segments),
+ params, query, fragment)))
+
+def urldefrag(url):
+ """Removes any existing fragment from URL.
+
+ Returns a tuple of the defragmented URL and the fragment. If
+ the URL contained no fragments, the second element is the
+ empty string.
+ """
+ url, _coerce_result = _coerce_args(url)
+ if '#' in url:
+ s, n, p, a, q, frag = urlparse(url)
+ defrag = urlunparse((s, n, p, a, q, ''))
+ else:
+ frag = ''
+ defrag = url
+ return _coerce_result(DefragResult(defrag, frag))
+
+_hexdig = '0123456789ABCDEFabcdef'
+_hextobyte = dict(((a + b).encode(), bytes([int(a + b, 16)]))
+ for a in _hexdig for b in _hexdig)
+
+def unquote_to_bytes(string):
+ """unquote_to_bytes('abc%20def') -> b'abc def'."""
+ # Note: strings are encoded as UTF-8. This is only an issue if it contains
+ # unescaped non-ASCII characters, which URIs should not.
+ if not string:
+ # Is it a string-like object?
+ string.split
+ return bytes(b'')
+ if isinstance(string, str):
+ string = string.encode('utf-8')
+ ### For Python-Future:
+ # It is already a byte-string object, but force it to be newbytes here on
+ # Py2:
+ string = bytes(string)
+ ###
+ bits = string.split(b'%')
+ if len(bits) == 1:
+ return string
+ res = [bits[0]]
+ append = res.append
+ for item in bits[1:]:
+ try:
+ append(_hextobyte[item[:2]])
+ append(item[2:])
+ except KeyError:
+ append(b'%')
+ append(item)
+ return bytes(b'').join(res)
+
+_asciire = re.compile('([\x00-\x7f]+)')
+
+def unquote(string, encoding='utf-8', errors='replace'):
+ """Replace %xx escapes by their single-character equivalent. The optional
+ encoding and errors parameters specify how to decode percent-encoded
+ sequences into Unicode characters, as accepted by the bytes.decode()
+ method.
+ By default, percent-encoded sequences are decoded with UTF-8, and invalid
+ sequences are replaced by a placeholder character.
+
+ unquote('abc%20def') -> 'abc def'.
+ """
+ if '%' not in string:
+ string.split
+ return string
+ if encoding is None:
+ encoding = 'utf-8'
+ if errors is None:
+ errors = 'replace'
+ bits = _asciire.split(string)
+ res = [bits[0]]
+ append = res.append
+ for i in range(1, len(bits), 2):
+ append(unquote_to_bytes(bits[i]).decode(encoding, errors))
+ append(bits[i + 1])
+ return ''.join(res)
+
+def parse_qs(qs, keep_blank_values=False, strict_parsing=False,
+ encoding='utf-8', errors='replace'):
+ """Parse a query given as a string argument.
+
+ Arguments:
+
+ qs: percent-encoded query string to be parsed
+
+ keep_blank_values: flag indicating whether blank values in
+ percent-encoded queries should be treated as blank strings.
+ A true value indicates that blanks should be retained as
+ blank strings. The default false value indicates that
+ blank values are to be ignored and treated as if they were
+ not included.
+
+ strict_parsing: flag indicating what to do with parsing errors.
+ If false (the default), errors are silently ignored.
+ If true, errors raise a ValueError exception.
+
+ encoding and errors: specify how to decode percent-encoded sequences
+ into Unicode characters, as accepted by the bytes.decode() method.
+ """
+ parsed_result = {}
+ pairs = parse_qsl(qs, keep_blank_values, strict_parsing,
+ encoding=encoding, errors=errors)
+ for name, value in pairs:
+ if name in parsed_result:
+ parsed_result[name].append(value)
+ else:
+ parsed_result[name] = [value]
+ return parsed_result
+
+def parse_qsl(qs, keep_blank_values=False, strict_parsing=False,
+ encoding='utf-8', errors='replace'):
+ """Parse a query given as a string argument.
+
+ Arguments:
+
+ qs: percent-encoded query string to be parsed
+
+ keep_blank_values: flag indicating whether blank values in
+ percent-encoded queries should be treated as blank strings. A
+ true value indicates that blanks should be retained as blank
+ strings. The default false value indicates that blank values
+ are to be ignored and treated as if they were not included.
+
+ strict_parsing: flag indicating what to do with parsing errors. If
+ false (the default), errors are silently ignored. If true,
+ errors raise a ValueError exception.
+
+ encoding and errors: specify how to decode percent-encoded sequences
+ into Unicode characters, as accepted by the bytes.decode() method.
+
+ Returns a list, as G-d intended.
+ """
+ qs, _coerce_result = _coerce_args(qs)
+ pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')]
+ r = []
+ for name_value in pairs:
+ if not name_value and not strict_parsing:
+ continue
+ nv = name_value.split('=', 1)
+ if len(nv) != 2:
+ if strict_parsing:
+ raise ValueError("bad query field: %r" % (name_value,))
+ # Handle case of a control-name with no equal sign
+ if keep_blank_values:
+ nv.append('')
+ else:
+ continue
+ if len(nv[1]) or keep_blank_values:
+ name = nv[0].replace('+', ' ')
+ name = unquote(name, encoding=encoding, errors=errors)
+ name = _coerce_result(name)
+ value = nv[1].replace('+', ' ')
+ value = unquote(value, encoding=encoding, errors=errors)
+ value = _coerce_result(value)
+ r.append((name, value))
+ return r
+
+def unquote_plus(string, encoding='utf-8', errors='replace'):
+ """Like unquote(), but also replace plus signs by spaces, as required for
+ unquoting HTML form values.
+
+ unquote_plus('%7e/abc+def') -> '~/abc def'
+ """
+ string = string.replace('+', ' ')
+ return unquote(string, encoding, errors)
+
+_ALWAYS_SAFE = frozenset(bytes(b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ b'abcdefghijklmnopqrstuvwxyz'
+ b'0123456789'
+ b'_.-'))
+_ALWAYS_SAFE_BYTES = bytes(_ALWAYS_SAFE)
+_safe_quoters = {}
+
+class Quoter(collections.defaultdict):
+ """A mapping from bytes (in range(0,256)) to strings.
+
+ String values are percent-encoded byte values, unless the key < 128, and
+ in the "safe" set (either the specified safe set, or default set).
+ """
+ # Keeps a cache internally, using defaultdict, for efficiency (lookups
+ # of cached keys don't call Python code at all).
+ def __init__(self, safe):
+ """safe: bytes object."""
+ self.safe = _ALWAYS_SAFE.union(bytes(safe))
+
+ def __repr__(self):
+ # Without this, will just display as a defaultdict
+ return "" % dict(self)
+
+ def __missing__(self, b):
+ # Handle a cache miss. Store quoted string in cache and return.
+ res = chr(b) if b in self.safe else '%{0:02X}'.format(b)
+ self[b] = res
+ return res
+
+def quote(string, safe='/', encoding=None, errors=None):
+ """quote('abc def') -> 'abc%20def'
+
+ Each part of a URL, e.g. the path info, the query, etc., has a
+ different set of reserved characters that must be quoted.
+
+ RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists
+ the following reserved characters.
+
+ reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
+ "$" | ","
+
+ Each of these characters is reserved in some component of a URL,
+ but not necessarily in all of them.
+
+ By default, the quote function is intended for quoting the path
+ section of a URL. Thus, it will not encode '/'. This character
+ is reserved, but in typical usage the quote function is being
+ called on a path where the existing slash characters are used as
+ reserved characters.
+
+ string and safe may be either str or bytes objects. encoding must
+ not be specified if string is a str.
+
+ The optional encoding and errors parameters specify how to deal with
+ non-ASCII characters, as accepted by the str.encode method.
+ By default, encoding='utf-8' (characters are encoded with UTF-8), and
+ errors='strict' (unsupported characters raise a UnicodeEncodeError).
+ """
+ if isinstance(string, str):
+ if not string:
+ return string
+ if encoding is None:
+ encoding = 'utf-8'
+ if errors is None:
+ errors = 'strict'
+ string = string.encode(encoding, errors)
+ else:
+ if encoding is not None:
+ raise TypeError("quote() doesn't support 'encoding' for bytes")
+ if errors is not None:
+ raise TypeError("quote() doesn't support 'errors' for bytes")
+ return quote_from_bytes(string, safe)
+
+def quote_plus(string, safe='', encoding=None, errors=None):
+ """Like quote(), but also replace ' ' with '+', as required for quoting
+ HTML form values. Plus signs in the original string are escaped unless
+ they are included in safe. It also does not have safe default to '/'.
+ """
+ # Check if ' ' in string, where string may either be a str or bytes. If
+ # there are no spaces, the regular quote will produce the right answer.
+ if ((isinstance(string, str) and ' ' not in string) or
+ (isinstance(string, bytes) and b' ' not in string)):
+ return quote(string, safe, encoding, errors)
+ if isinstance(safe, str):
+ space = str(' ')
+ else:
+ space = bytes(b' ')
+ string = quote(string, safe + space, encoding, errors)
+ return string.replace(' ', '+')
+
+def quote_from_bytes(bs, safe='/'):
+ """Like quote(), but accepts a bytes object rather than a str, and does
+ not perform string-to-bytes encoding. It always returns an ASCII string.
+ quote_from_bytes(b'abc def\x3f') -> 'abc%20def%3f'
+ """
+ if not isinstance(bs, (bytes, bytearray)):
+ raise TypeError("quote_from_bytes() expected bytes")
+ if not bs:
+ return str('')
+ ### For Python-Future:
+ bs = bytes(bs)
+ ###
+ if isinstance(safe, str):
+ # Normalize 'safe' by converting to bytes and removing non-ASCII chars
+ safe = str(safe).encode('ascii', 'ignore')
+ else:
+ ### For Python-Future:
+ safe = bytes(safe)
+ ###
+ safe = bytes([c for c in safe if c < 128])
+ if not bs.rstrip(_ALWAYS_SAFE_BYTES + safe):
+ return bs.decode()
+ try:
+ quoter = _safe_quoters[safe]
+ except KeyError:
+ _safe_quoters[safe] = quoter = Quoter(safe).__getitem__
+ return str('').join([quoter(char) for char in bs])
+
+def urlencode(query, doseq=False, safe='', encoding=None, errors=None):
+ """Encode a sequence of two-element tuples or dictionary into a URL query string.
+
+ If any values in the query arg are sequences and doseq is true, each
+ sequence element is converted to a separate parameter.
+
+ If the query arg is a sequence of two-element tuples, the order of the
+ parameters in the output will match the order of parameters in the
+ input.
+
+ The query arg may be either a string or a bytes type. When query arg is a
+ string, the safe, encoding and error parameters are sent the quote_plus for
+ encoding.
+ """
+
+ if hasattr(query, "items"):
+ query = query.items()
+ else:
+ # It's a bother at times that strings and string-like objects are
+ # sequences.
+ try:
+ # non-sequence items should not work with len()
+ # non-empty strings will fail this
+ if len(query) and not isinstance(query[0], tuple):
+ raise TypeError
+ # Zero-length sequences of all types will get here and succeed,
+ # but that's a minor nit. Since the original implementation
+ # allowed empty dicts that type of behavior probably should be
+ # preserved for consistency
+ except TypeError:
+ ty, va, tb = sys.exc_info()
+ raise_with_traceback(TypeError("not a valid non-string sequence "
+ "or mapping object"), tb)
+
+ l = []
+ if not doseq:
+ for k, v in query:
+ if isinstance(k, bytes):
+ k = quote_plus(k, safe)
+ else:
+ k = quote_plus(str(k), safe, encoding, errors)
+
+ if isinstance(v, bytes):
+ v = quote_plus(v, safe)
+ else:
+ v = quote_plus(str(v), safe, encoding, errors)
+ l.append(k + '=' + v)
+ else:
+ for k, v in query:
+ if isinstance(k, bytes):
+ k = quote_plus(k, safe)
+ else:
+ k = quote_plus(str(k), safe, encoding, errors)
+
+ if isinstance(v, bytes):
+ v = quote_plus(v, safe)
+ l.append(k + '=' + v)
+ elif isinstance(v, str):
+ v = quote_plus(v, safe, encoding, errors)
+ l.append(k + '=' + v)
+ else:
+ try:
+ # Is this a sufficient test for sequence-ness?
+ x = len(v)
+ except TypeError:
+ # not a sequence
+ v = quote_plus(str(v), safe, encoding, errors)
+ l.append(k + '=' + v)
+ else:
+ # loop over the sequence
+ for elt in v:
+ if isinstance(elt, bytes):
+ elt = quote_plus(elt, safe)
+ else:
+ elt = quote_plus(str(elt), safe, encoding, errors)
+ l.append(k + '=' + elt)
+ return str('&').join(l)
+
+# Utilities to parse URLs (most of these return None for missing parts):
+# unwrap('') --> 'type://host/path'
+# splittype('type:opaquestring') --> 'type', 'opaquestring'
+# splithost('//host[:port]/path') --> 'host[:port]', '/path'
+# splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'
+# splitpasswd('user:passwd') -> 'user', 'passwd'
+# splitport('host:port') --> 'host', 'port'
+# splitquery('/path?query') --> '/path', 'query'
+# splittag('/path#tag') --> '/path', 'tag'
+# splitattr('/path;attr1=value1;attr2=value2;...') ->
+# '/path', ['attr1=value1', 'attr2=value2', ...]
+# splitvalue('attr=value') --> 'attr', 'value'
+# urllib.parse.unquote('abc%20def') -> 'abc def'
+# quote('abc def') -> 'abc%20def')
+
+def to_bytes(url):
+ """to_bytes(u"URL") --> 'URL'."""
+ # Most URL schemes require ASCII. If that changes, the conversion
+ # can be relaxed.
+ # XXX get rid of to_bytes()
+ if isinstance(url, str):
+ try:
+ url = url.encode("ASCII").decode()
+ except UnicodeError:
+ raise UnicodeError("URL " + repr(url) +
+ " contains non-ASCII characters")
+ return url
+
+def unwrap(url):
+ """unwrap('') --> 'type://host/path'."""
+ url = str(url).strip()
+ if url[:1] == '<' and url[-1:] == '>':
+ url = url[1:-1].strip()
+ if url[:4] == 'URL:': url = url[4:].strip()
+ return url
+
+_typeprog = None
+def splittype(url):
+ """splittype('type:opaquestring') --> 'type', 'opaquestring'."""
+ global _typeprog
+ if _typeprog is None:
+ import re
+ _typeprog = re.compile('^([^/:]+):')
+
+ match = _typeprog.match(url)
+ if match:
+ scheme = match.group(1)
+ return scheme.lower(), url[len(scheme) + 1:]
+ return None, url
+
+_hostprog = None
+def splithost(url):
+ """splithost('//host[:port]/path') --> 'host[:port]', '/path'."""
+ global _hostprog
+ if _hostprog is None:
+ import re
+ _hostprog = re.compile('^//([^/?]*)(.*)$')
+
+ match = _hostprog.match(url)
+ if match:
+ host_port = match.group(1)
+ path = match.group(2)
+ if path and not path.startswith('/'):
+ path = '/' + path
+ return host_port, path
+ return None, url
+
+_userprog = None
+def splituser(host):
+ """splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'."""
+ global _userprog
+ if _userprog is None:
+ import re
+ _userprog = re.compile('^(.*)@(.*)$')
+
+ match = _userprog.match(host)
+ if match: return match.group(1, 2)
+ return None, host
+
+_passwdprog = None
+def splitpasswd(user):
+ """splitpasswd('user:passwd') -> 'user', 'passwd'."""
+ global _passwdprog
+ if _passwdprog is None:
+ import re
+ _passwdprog = re.compile('^([^:]*):(.*)$',re.S)
+
+ match = _passwdprog.match(user)
+ if match: return match.group(1, 2)
+ return user, None
+
+# splittag('/path#tag') --> '/path', 'tag'
+_portprog = None
+def splitport(host):
+ """splitport('host:port') --> 'host', 'port'."""
+ global _portprog
+ if _portprog is None:
+ import re
+ _portprog = re.compile('^(.*):([0-9]+)$')
+
+ match = _portprog.match(host)
+ if match: return match.group(1, 2)
+ return host, None
+
+_nportprog = None
+def splitnport(host, defport=-1):
+ """Split host and port, returning numeric port.
+ Return given default port if no ':' found; defaults to -1.
+ Return numerical port if a valid number are found after ':'.
+ Return None if ':' but not a valid number."""
+ global _nportprog
+ if _nportprog is None:
+ import re
+ _nportprog = re.compile('^(.*):(.*)$')
+
+ match = _nportprog.match(host)
+ if match:
+ host, port = match.group(1, 2)
+ try:
+ if not port: raise ValueError("no digits")
+ nport = int(port)
+ except ValueError:
+ nport = None
+ return host, nport
+ return host, defport
+
+_queryprog = None
+def splitquery(url):
+ """splitquery('/path?query') --> '/path', 'query'."""
+ global _queryprog
+ if _queryprog is None:
+ import re
+ _queryprog = re.compile('^(.*)\?([^?]*)$')
+
+ match = _queryprog.match(url)
+ if match: return match.group(1, 2)
+ return url, None
+
+_tagprog = None
+def splittag(url):
+ """splittag('/path#tag') --> '/path', 'tag'."""
+ global _tagprog
+ if _tagprog is None:
+ import re
+ _tagprog = re.compile('^(.*)#([^#]*)$')
+
+ match = _tagprog.match(url)
+ if match: return match.group(1, 2)
+ return url, None
+
+def splitattr(url):
+ """splitattr('/path;attr1=value1;attr2=value2;...') ->
+ '/path', ['attr1=value1', 'attr2=value2', ...]."""
+ words = url.split(';')
+ return words[0], words[1:]
+
+_valueprog = None
+def splitvalue(attr):
+ """splitvalue('attr=value') --> 'attr', 'value'."""
+ global _valueprog
+ if _valueprog is None:
+ import re
+ _valueprog = re.compile('^([^=]*)=(.*)$')
+
+ match = _valueprog.match(attr)
+ if match: return match.group(1, 2)
+ return attr, None
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/urllib/request.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/urllib/request.py
new file mode 100644
index 0000000..b1545ca
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/urllib/request.py
@@ -0,0 +1,2641 @@
+"""
+Ported using Python-Future from the Python 3.3 standard library.
+
+An extensible library for opening URLs using a variety of protocols
+
+The simplest way to use this module is to call the urlopen function,
+which accepts a string containing a URL or a Request object (described
+below). It opens the URL and returns the results as file-like
+object; the returned object has some extra methods described below.
+
+The OpenerDirector manages a collection of Handler objects that do
+all the actual work. Each Handler implements a particular protocol or
+option. The OpenerDirector is a composite object that invokes the
+Handlers needed to open the requested URL. For example, the
+HTTPHandler performs HTTP GET and POST requests and deals with
+non-error returns. The HTTPRedirectHandler automatically deals with
+HTTP 301, 302, 303 and 307 redirect errors, and the HTTPDigestAuthHandler
+deals with digest authentication.
+
+urlopen(url, data=None) -- Basic usage is the same as original
+urllib. pass the url and optionally data to post to an HTTP URL, and
+get a file-like object back. One difference is that you can also pass
+a Request instance instead of URL. Raises a URLError (subclass of
+IOError); for HTTP errors, raises an HTTPError, which can also be
+treated as a valid response.
+
+build_opener -- Function that creates a new OpenerDirector instance.
+Will install the default handlers. Accepts one or more Handlers as
+arguments, either instances or Handler classes that it will
+instantiate. If one of the argument is a subclass of the default
+handler, the argument will be installed instead of the default.
+
+install_opener -- Installs a new opener as the default opener.
+
+objects of interest:
+
+OpenerDirector -- Sets up the User Agent as the Python-urllib client and manages
+the Handler classes, while dealing with requests and responses.
+
+Request -- An object that encapsulates the state of a request. The
+state can be as simple as the URL. It can also include extra HTTP
+headers, e.g. a User-Agent.
+
+BaseHandler --
+
+internals:
+BaseHandler and parent
+_call_chain conventions
+
+Example usage:
+
+import urllib.request
+
+# set up authentication info
+authinfo = urllib.request.HTTPBasicAuthHandler()
+authinfo.add_password(realm='PDQ Application',
+ uri='https://mahler:8092/site-updates.py',
+ user='klem',
+ passwd='geheim$parole')
+
+proxy_support = urllib.request.ProxyHandler({"http" : "http://ahad-haam:3128"})
+
+# build a new opener that adds authentication and caching FTP handlers
+opener = urllib.request.build_opener(proxy_support, authinfo,
+ urllib.request.CacheFTPHandler)
+
+# install it
+urllib.request.install_opener(opener)
+
+f = urllib.request.urlopen('http://www.python.org/')
+"""
+
+# XXX issues:
+# If an authentication error handler that tries to perform
+# authentication for some reason but fails, how should the error be
+# signalled? The client needs to know the HTTP error code. But if
+# the handler knows that the problem was, e.g., that it didn't know
+# that hash algo that requested in the challenge, it would be good to
+# pass that information along to the client, too.
+# ftp errors aren't handled cleanly
+# check digest against correct (i.e. non-apache) implementation
+
+# Possible extensions:
+# complex proxies XXX not sure what exactly was meant by this
+# abstract factory for opener
+
+from __future__ import absolute_import, division, print_function, unicode_literals
+from future.builtins import bytes, dict, filter, input, int, map, open, str
+from future.utils import PY2, PY3, raise_with_traceback
+
+import base64
+import bisect
+import hashlib
+import array
+
+from future.backports import email
+from future.backports.http import client as http_client
+from .error import URLError, HTTPError, ContentTooShortError
+from .parse import (
+ urlparse, urlsplit, urljoin, unwrap, quote, unquote,
+ splittype, splithost, splitport, splituser, splitpasswd,
+ splitattr, splitquery, splitvalue, splittag, to_bytes, urlunparse)
+from .response import addinfourl, addclosehook
+
+import io
+import os
+import posixpath
+import re
+import socket
+import sys
+import time
+import collections
+import tempfile
+import contextlib
+import warnings
+
+# check for SSL
+try:
+ import ssl
+ # Not available in the SSL module in Py2:
+ from ssl import SSLContext
+except ImportError:
+ _have_ssl = False
+else:
+ _have_ssl = True
+
+__all__ = [
+ # Classes
+ 'Request', 'OpenerDirector', 'BaseHandler', 'HTTPDefaultErrorHandler',
+ 'HTTPRedirectHandler', 'HTTPCookieProcessor', 'ProxyHandler',
+ 'HTTPPasswordMgr', 'HTTPPasswordMgrWithDefaultRealm',
+ 'AbstractBasicAuthHandler', 'HTTPBasicAuthHandler', 'ProxyBasicAuthHandler',
+ 'AbstractDigestAuthHandler', 'HTTPDigestAuthHandler', 'ProxyDigestAuthHandler',
+ 'HTTPHandler', 'FileHandler', 'FTPHandler', 'CacheFTPHandler',
+ 'UnknownHandler', 'HTTPErrorProcessor',
+ # Functions
+ 'urlopen', 'install_opener', 'build_opener',
+ 'pathname2url', 'url2pathname', 'getproxies',
+ # Legacy interface
+ 'urlretrieve', 'urlcleanup', 'URLopener', 'FancyURLopener',
+]
+
+# used in User-Agent header sent
+__version__ = sys.version[:3]
+
+_opener = None
+def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, **_3to2kwargs):
+ if 'cadefault' in _3to2kwargs: cadefault = _3to2kwargs['cadefault']; del _3to2kwargs['cadefault']
+ else: cadefault = False
+ if 'capath' in _3to2kwargs: capath = _3to2kwargs['capath']; del _3to2kwargs['capath']
+ else: capath = None
+ if 'cafile' in _3to2kwargs: cafile = _3to2kwargs['cafile']; del _3to2kwargs['cafile']
+ else: cafile = None
+ global _opener
+ if cafile or capath or cadefault:
+ if not _have_ssl:
+ raise ValueError('SSL support not available')
+ context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
+ context.options |= ssl.OP_NO_SSLv2
+ context.verify_mode = ssl.CERT_REQUIRED
+ if cafile or capath:
+ context.load_verify_locations(cafile, capath)
+ else:
+ context.set_default_verify_paths()
+ https_handler = HTTPSHandler(context=context, check_hostname=True)
+ opener = build_opener(https_handler)
+ elif _opener is None:
+ _opener = opener = build_opener()
+ else:
+ opener = _opener
+ return opener.open(url, data, timeout)
+
+def install_opener(opener):
+ global _opener
+ _opener = opener
+
+_url_tempfiles = []
+def urlretrieve(url, filename=None, reporthook=None, data=None):
+ """
+ Retrieve a URL into a temporary location on disk.
+
+ Requires a URL argument. If a filename is passed, it is used as
+ the temporary file location. The reporthook argument should be
+ a callable that accepts a block number, a read size, and the
+ total file size of the URL target. The data argument should be
+ valid URL encoded data.
+
+ If a filename is passed and the URL points to a local resource,
+ the result is a copy from local file to new file.
+
+ Returns a tuple containing the path to the newly created
+ data file as well as the resulting HTTPMessage object.
+ """
+ url_type, path = splittype(url)
+
+ with contextlib.closing(urlopen(url, data)) as fp:
+ headers = fp.info()
+
+ # Just return the local path and the "headers" for file://
+ # URLs. No sense in performing a copy unless requested.
+ if url_type == "file" and not filename:
+ return os.path.normpath(path), headers
+
+ # Handle temporary file setup.
+ if filename:
+ tfp = open(filename, 'wb')
+ else:
+ tfp = tempfile.NamedTemporaryFile(delete=False)
+ filename = tfp.name
+ _url_tempfiles.append(filename)
+
+ with tfp:
+ result = filename, headers
+ bs = 1024*8
+ size = -1
+ read = 0
+ blocknum = 0
+ if "content-length" in headers:
+ size = int(headers["Content-Length"])
+
+ if reporthook:
+ reporthook(blocknum, bs, size)
+
+ while True:
+ block = fp.read(bs)
+ if not block:
+ break
+ read += len(block)
+ tfp.write(block)
+ blocknum += 1
+ if reporthook:
+ reporthook(blocknum, bs, size)
+
+ if size >= 0 and read < size:
+ raise ContentTooShortError(
+ "retrieval incomplete: got only %i out of %i bytes"
+ % (read, size), result)
+
+ return result
+
+def urlcleanup():
+ for temp_file in _url_tempfiles:
+ try:
+ os.unlink(temp_file)
+ except EnvironmentError:
+ pass
+
+ del _url_tempfiles[:]
+ global _opener
+ if _opener:
+ _opener = None
+
+if PY3:
+ _cut_port_re = re.compile(r":\d+$", re.ASCII)
+else:
+ _cut_port_re = re.compile(r":\d+$")
+
+def request_host(request):
+
+ """Return request-host, as defined by RFC 2965.
+
+ Variation from RFC: returned value is lowercased, for convenient
+ comparison.
+
+ """
+ url = request.full_url
+ host = urlparse(url)[1]
+ if host == "":
+ host = request.get_header("Host", "")
+
+ # remove port, if present
+ host = _cut_port_re.sub("", host, 1)
+ return host.lower()
+
+class Request(object):
+
+ def __init__(self, url, data=None, headers={},
+ origin_req_host=None, unverifiable=False,
+ method=None):
+ # unwrap('') --> 'type://host/path'
+ self.full_url = unwrap(url)
+ self.full_url, self.fragment = splittag(self.full_url)
+ self.data = data
+ self.headers = {}
+ self._tunnel_host = None
+ for key, value in headers.items():
+ self.add_header(key, value)
+ self.unredirected_hdrs = {}
+ if origin_req_host is None:
+ origin_req_host = request_host(self)
+ self.origin_req_host = origin_req_host
+ self.unverifiable = unverifiable
+ self.method = method
+ self._parse()
+
+ def _parse(self):
+ self.type, rest = splittype(self.full_url)
+ if self.type is None:
+ raise ValueError("unknown url type: %r" % self.full_url)
+ self.host, self.selector = splithost(rest)
+ if self.host:
+ self.host = unquote(self.host)
+
+ def get_method(self):
+ """Return a string indicating the HTTP request method."""
+ if self.method is not None:
+ return self.method
+ elif self.data is not None:
+ return "POST"
+ else:
+ return "GET"
+
+ def get_full_url(self):
+ if self.fragment:
+ return '%s#%s' % (self.full_url, self.fragment)
+ else:
+ return self.full_url
+
+ # Begin deprecated methods
+
+ def add_data(self, data):
+ msg = "Request.add_data method is deprecated."
+ warnings.warn(msg, DeprecationWarning, stacklevel=1)
+ self.data = data
+
+ def has_data(self):
+ msg = "Request.has_data method is deprecated."
+ warnings.warn(msg, DeprecationWarning, stacklevel=1)
+ return self.data is not None
+
+ def get_data(self):
+ msg = "Request.get_data method is deprecated."
+ warnings.warn(msg, DeprecationWarning, stacklevel=1)
+ return self.data
+
+ def get_type(self):
+ msg = "Request.get_type method is deprecated."
+ warnings.warn(msg, DeprecationWarning, stacklevel=1)
+ return self.type
+
+ def get_host(self):
+ msg = "Request.get_host method is deprecated."
+ warnings.warn(msg, DeprecationWarning, stacklevel=1)
+ return self.host
+
+ def get_selector(self):
+ msg = "Request.get_selector method is deprecated."
+ warnings.warn(msg, DeprecationWarning, stacklevel=1)
+ return self.selector
+
+ def is_unverifiable(self):
+ msg = "Request.is_unverifiable method is deprecated."
+ warnings.warn(msg, DeprecationWarning, stacklevel=1)
+ return self.unverifiable
+
+ def get_origin_req_host(self):
+ msg = "Request.get_origin_req_host method is deprecated."
+ warnings.warn(msg, DeprecationWarning, stacklevel=1)
+ return self.origin_req_host
+
+ # End deprecated methods
+
+ def set_proxy(self, host, type):
+ if self.type == 'https' and not self._tunnel_host:
+ self._tunnel_host = self.host
+ else:
+ self.type= type
+ self.selector = self.full_url
+ self.host = host
+
+ def has_proxy(self):
+ return self.selector == self.full_url
+
+ def add_header(self, key, val):
+ # useful for something like authentication
+ self.headers[key.capitalize()] = val
+
+ def add_unredirected_header(self, key, val):
+ # will not be added to a redirected request
+ self.unredirected_hdrs[key.capitalize()] = val
+
+ def has_header(self, header_name):
+ return (header_name in self.headers or
+ header_name in self.unredirected_hdrs)
+
+ def get_header(self, header_name, default=None):
+ return self.headers.get(
+ header_name,
+ self.unredirected_hdrs.get(header_name, default))
+
+ def header_items(self):
+ hdrs = self.unredirected_hdrs.copy()
+ hdrs.update(self.headers)
+ return list(hdrs.items())
+
+class OpenerDirector(object):
+ def __init__(self):
+ client_version = "Python-urllib/%s" % __version__
+ self.addheaders = [('User-agent', client_version)]
+ # self.handlers is retained only for backward compatibility
+ self.handlers = []
+ # manage the individual handlers
+ self.handle_open = {}
+ self.handle_error = {}
+ self.process_response = {}
+ self.process_request = {}
+
+ def add_handler(self, handler):
+ if not hasattr(handler, "add_parent"):
+ raise TypeError("expected BaseHandler instance, got %r" %
+ type(handler))
+
+ added = False
+ for meth in dir(handler):
+ if meth in ["redirect_request", "do_open", "proxy_open"]:
+ # oops, coincidental match
+ continue
+
+ i = meth.find("_")
+ protocol = meth[:i]
+ condition = meth[i+1:]
+
+ if condition.startswith("error"):
+ j = condition.find("_") + i + 1
+ kind = meth[j+1:]
+ try:
+ kind = int(kind)
+ except ValueError:
+ pass
+ lookup = self.handle_error.get(protocol, {})
+ self.handle_error[protocol] = lookup
+ elif condition == "open":
+ kind = protocol
+ lookup = self.handle_open
+ elif condition == "response":
+ kind = protocol
+ lookup = self.process_response
+ elif condition == "request":
+ kind = protocol
+ lookup = self.process_request
+ else:
+ continue
+
+ handlers = lookup.setdefault(kind, [])
+ if handlers:
+ bisect.insort(handlers, handler)
+ else:
+ handlers.append(handler)
+ added = True
+
+ if added:
+ bisect.insort(self.handlers, handler)
+ handler.add_parent(self)
+
+ def close(self):
+ # Only exists for backwards compatibility.
+ pass
+
+ def _call_chain(self, chain, kind, meth_name, *args):
+ # Handlers raise an exception if no one else should try to handle
+ # the request, or return None if they can't but another handler
+ # could. Otherwise, they return the response.
+ handlers = chain.get(kind, ())
+ for handler in handlers:
+ func = getattr(handler, meth_name)
+ result = func(*args)
+ if result is not None:
+ return result
+
+ def open(self, fullurl, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
+ """
+ Accept a URL or a Request object
+
+ Python-Future: if the URL is passed as a byte-string, decode it first.
+ """
+ if isinstance(fullurl, bytes):
+ fullurl = fullurl.decode()
+ if isinstance(fullurl, str):
+ req = Request(fullurl, data)
+ else:
+ req = fullurl
+ if data is not None:
+ req.data = data
+
+ req.timeout = timeout
+ protocol = req.type
+
+ # pre-process request
+ meth_name = protocol+"_request"
+ for processor in self.process_request.get(protocol, []):
+ meth = getattr(processor, meth_name)
+ req = meth(req)
+
+ response = self._open(req, data)
+
+ # post-process response
+ meth_name = protocol+"_response"
+ for processor in self.process_response.get(protocol, []):
+ meth = getattr(processor, meth_name)
+ response = meth(req, response)
+
+ return response
+
+ def _open(self, req, data=None):
+ result = self._call_chain(self.handle_open, 'default',
+ 'default_open', req)
+ if result:
+ return result
+
+ protocol = req.type
+ result = self._call_chain(self.handle_open, protocol, protocol +
+ '_open', req)
+ if result:
+ return result
+
+ return self._call_chain(self.handle_open, 'unknown',
+ 'unknown_open', req)
+
+ def error(self, proto, *args):
+ if proto in ('http', 'https'):
+ # XXX http[s] protocols are special-cased
+ dict = self.handle_error['http'] # https is not different than http
+ proto = args[2] # YUCK!
+ meth_name = 'http_error_%s' % proto
+ http_err = 1
+ orig_args = args
+ else:
+ dict = self.handle_error
+ meth_name = proto + '_error'
+ http_err = 0
+ args = (dict, proto, meth_name) + args
+ result = self._call_chain(*args)
+ if result:
+ return result
+
+ if http_err:
+ args = (dict, 'default', 'http_error_default') + orig_args
+ return self._call_chain(*args)
+
+# XXX probably also want an abstract factory that knows when it makes
+# sense to skip a superclass in favor of a subclass and when it might
+# make sense to include both
+
+def build_opener(*handlers):
+ """Create an opener object from a list of handlers.
+
+ The opener will use several default handlers, including support
+ for HTTP, FTP and when applicable HTTPS.
+
+ If any of the handlers passed as arguments are subclasses of the
+ default handlers, the default handlers will not be used.
+ """
+ def isclass(obj):
+ return isinstance(obj, type) or hasattr(obj, "__bases__")
+
+ opener = OpenerDirector()
+ default_classes = [ProxyHandler, UnknownHandler, HTTPHandler,
+ HTTPDefaultErrorHandler, HTTPRedirectHandler,
+ FTPHandler, FileHandler, HTTPErrorProcessor]
+ if hasattr(http_client, "HTTPSConnection"):
+ default_classes.append(HTTPSHandler)
+ skip = set()
+ for klass in default_classes:
+ for check in handlers:
+ if isclass(check):
+ if issubclass(check, klass):
+ skip.add(klass)
+ elif isinstance(check, klass):
+ skip.add(klass)
+ for klass in skip:
+ default_classes.remove(klass)
+
+ for klass in default_classes:
+ opener.add_handler(klass())
+
+ for h in handlers:
+ if isclass(h):
+ h = h()
+ opener.add_handler(h)
+ return opener
+
+class BaseHandler(object):
+ handler_order = 500
+
+ def add_parent(self, parent):
+ self.parent = parent
+
+ def close(self):
+ # Only exists for backwards compatibility
+ pass
+
+ def __lt__(self, other):
+ if not hasattr(other, "handler_order"):
+ # Try to preserve the old behavior of having custom classes
+ # inserted after default ones (works only for custom user
+ # classes which are not aware of handler_order).
+ return True
+ return self.handler_order < other.handler_order
+
+
+class HTTPErrorProcessor(BaseHandler):
+ """Process HTTP error responses."""
+ handler_order = 1000 # after all other processing
+
+ def http_response(self, request, response):
+ code, msg, hdrs = response.code, response.msg, response.info()
+
+ # According to RFC 2616, "2xx" code indicates that the client's
+ # request was successfully received, understood, and accepted.
+ if not (200 <= code < 300):
+ response = self.parent.error(
+ 'http', request, response, code, msg, hdrs)
+
+ return response
+
+ https_response = http_response
+
+class HTTPDefaultErrorHandler(BaseHandler):
+ def http_error_default(self, req, fp, code, msg, hdrs):
+ raise HTTPError(req.full_url, code, msg, hdrs, fp)
+
+class HTTPRedirectHandler(BaseHandler):
+ # maximum number of redirections to any single URL
+ # this is needed because of the state that cookies introduce
+ max_repeats = 4
+ # maximum total number of redirections (regardless of URL) before
+ # assuming we're in a loop
+ max_redirections = 10
+
+ def redirect_request(self, req, fp, code, msg, headers, newurl):
+ """Return a Request or None in response to a redirect.
+
+ This is called by the http_error_30x methods when a
+ redirection response is received. If a redirection should
+ take place, return a new Request to allow http_error_30x to
+ perform the redirect. Otherwise, raise HTTPError if no-one
+ else should try to handle this url. Return None if you can't
+ but another Handler might.
+ """
+ m = req.get_method()
+ if (not (code in (301, 302, 303, 307) and m in ("GET", "HEAD")
+ or code in (301, 302, 303) and m == "POST")):
+ raise HTTPError(req.full_url, code, msg, headers, fp)
+
+ # Strictly (according to RFC 2616), 301 or 302 in response to
+ # a POST MUST NOT cause a redirection without confirmation
+ # from the user (of urllib.request, in this case). In practice,
+ # essentially all clients do redirect in this case, so we do
+ # the same.
+ # be conciliant with URIs containing a space
+ newurl = newurl.replace(' ', '%20')
+ CONTENT_HEADERS = ("content-length", "content-type")
+ newheaders = dict((k, v) for k, v in req.headers.items()
+ if k.lower() not in CONTENT_HEADERS)
+ return Request(newurl,
+ headers=newheaders,
+ origin_req_host=req.origin_req_host,
+ unverifiable=True)
+
+ # Implementation note: To avoid the server sending us into an
+ # infinite loop, the request object needs to track what URLs we
+ # have already seen. Do this by adding a handler-specific
+ # attribute to the Request object.
+ def http_error_302(self, req, fp, code, msg, headers):
+ # Some servers (incorrectly) return multiple Location headers
+ # (so probably same goes for URI). Use first header.
+ if "location" in headers:
+ newurl = headers["location"]
+ elif "uri" in headers:
+ newurl = headers["uri"]
+ else:
+ return
+
+ # fix a possible malformed URL
+ urlparts = urlparse(newurl)
+
+ # For security reasons we don't allow redirection to anything other
+ # than http, https or ftp.
+
+ if urlparts.scheme not in ('http', 'https', 'ftp', ''):
+ raise HTTPError(
+ newurl, code,
+ "%s - Redirection to url '%s' is not allowed" % (msg, newurl),
+ headers, fp)
+
+ if not urlparts.path:
+ urlparts = list(urlparts)
+ urlparts[2] = "/"
+ newurl = urlunparse(urlparts)
+
+ newurl = urljoin(req.full_url, newurl)
+
+ # XXX Probably want to forget about the state of the current
+ # request, although that might interact poorly with other
+ # handlers that also use handler-specific request attributes
+ new = self.redirect_request(req, fp, code, msg, headers, newurl)
+ if new is None:
+ return
+
+ # loop detection
+ # .redirect_dict has a key url if url was previously visited.
+ if hasattr(req, 'redirect_dict'):
+ visited = new.redirect_dict = req.redirect_dict
+ if (visited.get(newurl, 0) >= self.max_repeats or
+ len(visited) >= self.max_redirections):
+ raise HTTPError(req.full_url, code,
+ self.inf_msg + msg, headers, fp)
+ else:
+ visited = new.redirect_dict = req.redirect_dict = {}
+ visited[newurl] = visited.get(newurl, 0) + 1
+
+ # Don't close the fp until we are sure that we won't use it
+ # with HTTPError.
+ fp.read()
+ fp.close()
+
+ return self.parent.open(new, timeout=req.timeout)
+
+ http_error_301 = http_error_303 = http_error_307 = http_error_302
+
+ inf_msg = "The HTTP server returned a redirect error that would " \
+ "lead to an infinite loop.\n" \
+ "The last 30x error message was:\n"
+
+
+def _parse_proxy(proxy):
+ """Return (scheme, user, password, host/port) given a URL or an authority.
+
+ If a URL is supplied, it must have an authority (host:port) component.
+ According to RFC 3986, having an authority component means the URL must
+ have two slashes after the scheme:
+
+ >>> _parse_proxy('file:/ftp.example.com/')
+ Traceback (most recent call last):
+ ValueError: proxy URL with no authority: 'file:/ftp.example.com/'
+
+ The first three items of the returned tuple may be None.
+
+ Examples of authority parsing:
+
+ >>> _parse_proxy('proxy.example.com')
+ (None, None, None, 'proxy.example.com')
+ >>> _parse_proxy('proxy.example.com:3128')
+ (None, None, None, 'proxy.example.com:3128')
+
+ The authority component may optionally include userinfo (assumed to be
+ username:password):
+
+ >>> _parse_proxy('joe:password@proxy.example.com')
+ (None, 'joe', 'password', 'proxy.example.com')
+ >>> _parse_proxy('joe:password@proxy.example.com:3128')
+ (None, 'joe', 'password', 'proxy.example.com:3128')
+
+ Same examples, but with URLs instead:
+
+ >>> _parse_proxy('http://proxy.example.com/')
+ ('http', None, None, 'proxy.example.com')
+ >>> _parse_proxy('http://proxy.example.com:3128/')
+ ('http', None, None, 'proxy.example.com:3128')
+ >>> _parse_proxy('http://joe:password@proxy.example.com/')
+ ('http', 'joe', 'password', 'proxy.example.com')
+ >>> _parse_proxy('http://joe:password@proxy.example.com:3128')
+ ('http', 'joe', 'password', 'proxy.example.com:3128')
+
+ Everything after the authority is ignored:
+
+ >>> _parse_proxy('ftp://joe:password@proxy.example.com/rubbish:3128')
+ ('ftp', 'joe', 'password', 'proxy.example.com')
+
+ Test for no trailing '/' case:
+
+ >>> _parse_proxy('http://joe:password@proxy.example.com')
+ ('http', 'joe', 'password', 'proxy.example.com')
+
+ """
+ scheme, r_scheme = splittype(proxy)
+ if not r_scheme.startswith("/"):
+ # authority
+ scheme = None
+ authority = proxy
+ else:
+ # URL
+ if not r_scheme.startswith("//"):
+ raise ValueError("proxy URL with no authority: %r" % proxy)
+ # We have an authority, so for RFC 3986-compliant URLs (by ss 3.
+ # and 3.3.), path is empty or starts with '/'
+ end = r_scheme.find("/", 2)
+ if end == -1:
+ end = None
+ authority = r_scheme[2:end]
+ userinfo, hostport = splituser(authority)
+ if userinfo is not None:
+ user, password = splitpasswd(userinfo)
+ else:
+ user = password = None
+ return scheme, user, password, hostport
+
+class ProxyHandler(BaseHandler):
+ # Proxies must be in front
+ handler_order = 100
+
+ def __init__(self, proxies=None):
+ if proxies is None:
+ proxies = getproxies()
+ assert hasattr(proxies, 'keys'), "proxies must be a mapping"
+ self.proxies = proxies
+ for type, url in proxies.items():
+ setattr(self, '%s_open' % type,
+ lambda r, proxy=url, type=type, meth=self.proxy_open:
+ meth(r, proxy, type))
+
+ def proxy_open(self, req, proxy, type):
+ orig_type = req.type
+ proxy_type, user, password, hostport = _parse_proxy(proxy)
+ if proxy_type is None:
+ proxy_type = orig_type
+
+ if req.host and proxy_bypass(req.host):
+ return None
+
+ if user and password:
+ user_pass = '%s:%s' % (unquote(user),
+ unquote(password))
+ creds = base64.b64encode(user_pass.encode()).decode("ascii")
+ req.add_header('Proxy-authorization', 'Basic ' + creds)
+ hostport = unquote(hostport)
+ req.set_proxy(hostport, proxy_type)
+ if orig_type == proxy_type or orig_type == 'https':
+ # let other handlers take care of it
+ return None
+ else:
+ # need to start over, because the other handlers don't
+ # grok the proxy's URL type
+ # e.g. if we have a constructor arg proxies like so:
+ # {'http': 'ftp://proxy.example.com'}, we may end up turning
+ # a request for http://acme.example.com/a into one for
+ # ftp://proxy.example.com/a
+ return self.parent.open(req, timeout=req.timeout)
+
+class HTTPPasswordMgr(object):
+
+ def __init__(self):
+ self.passwd = {}
+
+ def add_password(self, realm, uri, user, passwd):
+ # uri could be a single URI or a sequence
+ if isinstance(uri, str):
+ uri = [uri]
+ if realm not in self.passwd:
+ self.passwd[realm] = {}
+ for default_port in True, False:
+ reduced_uri = tuple(
+ [self.reduce_uri(u, default_port) for u in uri])
+ self.passwd[realm][reduced_uri] = (user, passwd)
+
+ def find_user_password(self, realm, authuri):
+ domains = self.passwd.get(realm, {})
+ for default_port in True, False:
+ reduced_authuri = self.reduce_uri(authuri, default_port)
+ for uris, authinfo in domains.items():
+ for uri in uris:
+ if self.is_suburi(uri, reduced_authuri):
+ return authinfo
+ return None, None
+
+ def reduce_uri(self, uri, default_port=True):
+ """Accept authority or URI and extract only the authority and path."""
+ # note HTTP URLs do not have a userinfo component
+ parts = urlsplit(uri)
+ if parts[1]:
+ # URI
+ scheme = parts[0]
+ authority = parts[1]
+ path = parts[2] or '/'
+ else:
+ # host or host:port
+ scheme = None
+ authority = uri
+ path = '/'
+ host, port = splitport(authority)
+ if default_port and port is None and scheme is not None:
+ dport = {"http": 80,
+ "https": 443,
+ }.get(scheme)
+ if dport is not None:
+ authority = "%s:%d" % (host, dport)
+ return authority, path
+
+ def is_suburi(self, base, test):
+ """Check if test is below base in a URI tree
+
+ Both args must be URIs in reduced form.
+ """
+ if base == test:
+ return True
+ if base[0] != test[0]:
+ return False
+ common = posixpath.commonprefix((base[1], test[1]))
+ if len(common) == len(base[1]):
+ return True
+ return False
+
+
+class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr):
+
+ def find_user_password(self, realm, authuri):
+ user, password = HTTPPasswordMgr.find_user_password(self, realm,
+ authuri)
+ if user is not None:
+ return user, password
+ return HTTPPasswordMgr.find_user_password(self, None, authuri)
+
+
+class AbstractBasicAuthHandler(object):
+
+ # XXX this allows for multiple auth-schemes, but will stupidly pick
+ # the last one with a realm specified.
+
+ # allow for double- and single-quoted realm values
+ # (single quotes are a violation of the RFC, but appear in the wild)
+ rx = re.compile('(?:.*,)*[ \t]*([^ \t]+)[ \t]+'
+ 'realm=(["\']?)([^"\']*)\\2', re.I)
+
+ # XXX could pre-emptively send auth info already accepted (RFC 2617,
+ # end of section 2, and section 1.2 immediately after "credentials"
+ # production).
+
+ def __init__(self, password_mgr=None):
+ if password_mgr is None:
+ password_mgr = HTTPPasswordMgr()
+ self.passwd = password_mgr
+ self.add_password = self.passwd.add_password
+ self.retried = 0
+
+ def reset_retry_count(self):
+ self.retried = 0
+
+ def http_error_auth_reqed(self, authreq, host, req, headers):
+ # host may be an authority (without userinfo) or a URL with an
+ # authority
+ # XXX could be multiple headers
+ authreq = headers.get(authreq, None)
+
+ if self.retried > 5:
+ # retry sending the username:password 5 times before failing.
+ raise HTTPError(req.get_full_url(), 401, "basic auth failed",
+ headers, None)
+ else:
+ self.retried += 1
+
+ if authreq:
+ scheme = authreq.split()[0]
+ if scheme.lower() != 'basic':
+ raise ValueError("AbstractBasicAuthHandler does not"
+ " support the following scheme: '%s'" %
+ scheme)
+ else:
+ mo = AbstractBasicAuthHandler.rx.search(authreq)
+ if mo:
+ scheme, quote, realm = mo.groups()
+ if quote not in ['"',"'"]:
+ warnings.warn("Basic Auth Realm was unquoted",
+ UserWarning, 2)
+ if scheme.lower() == 'basic':
+ response = self.retry_http_basic_auth(host, req, realm)
+ if response and response.code != 401:
+ self.retried = 0
+ return response
+
+ def retry_http_basic_auth(self, host, req, realm):
+ user, pw = self.passwd.find_user_password(realm, host)
+ if pw is not None:
+ raw = "%s:%s" % (user, pw)
+ auth = "Basic " + base64.b64encode(raw.encode()).decode("ascii")
+ if req.headers.get(self.auth_header, None) == auth:
+ return None
+ req.add_unredirected_header(self.auth_header, auth)
+ return self.parent.open(req, timeout=req.timeout)
+ else:
+ return None
+
+
+class HTTPBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler):
+
+ auth_header = 'Authorization'
+
+ def http_error_401(self, req, fp, code, msg, headers):
+ url = req.full_url
+ response = self.http_error_auth_reqed('www-authenticate',
+ url, req, headers)
+ self.reset_retry_count()
+ return response
+
+
+class ProxyBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler):
+
+ auth_header = 'Proxy-authorization'
+
+ def http_error_407(self, req, fp, code, msg, headers):
+ # http_error_auth_reqed requires that there is no userinfo component in
+ # authority. Assume there isn't one, since urllib.request does not (and
+ # should not, RFC 3986 s. 3.2.1) support requests for URLs containing
+ # userinfo.
+ authority = req.host
+ response = self.http_error_auth_reqed('proxy-authenticate',
+ authority, req, headers)
+ self.reset_retry_count()
+ return response
+
+
+# Return n random bytes.
+_randombytes = os.urandom
+
+
+class AbstractDigestAuthHandler(object):
+ # Digest authentication is specified in RFC 2617.
+
+ # XXX The client does not inspect the Authentication-Info header
+ # in a successful response.
+
+ # XXX It should be possible to test this implementation against
+ # a mock server that just generates a static set of challenges.
+
+ # XXX qop="auth-int" supports is shaky
+
+ def __init__(self, passwd=None):
+ if passwd is None:
+ passwd = HTTPPasswordMgr()
+ self.passwd = passwd
+ self.add_password = self.passwd.add_password
+ self.retried = 0
+ self.nonce_count = 0
+ self.last_nonce = None
+
+ def reset_retry_count(self):
+ self.retried = 0
+
+ def http_error_auth_reqed(self, auth_header, host, req, headers):
+ authreq = headers.get(auth_header, None)
+ if self.retried > 5:
+ # Don't fail endlessly - if we failed once, we'll probably
+ # fail a second time. Hm. Unless the Password Manager is
+ # prompting for the information. Crap. This isn't great
+ # but it's better than the current 'repeat until recursion
+ # depth exceeded' approach
+ raise HTTPError(req.full_url, 401, "digest auth failed",
+ headers, None)
+ else:
+ self.retried += 1
+ if authreq:
+ scheme = authreq.split()[0]
+ if scheme.lower() == 'digest':
+ return self.retry_http_digest_auth(req, authreq)
+ elif scheme.lower() != 'basic':
+ raise ValueError("AbstractDigestAuthHandler does not support"
+ " the following scheme: '%s'" % scheme)
+
+ def retry_http_digest_auth(self, req, auth):
+ token, challenge = auth.split(' ', 1)
+ chal = parse_keqv_list(filter(None, parse_http_list(challenge)))
+ auth = self.get_authorization(req, chal)
+ if auth:
+ auth_val = 'Digest %s' % auth
+ if req.headers.get(self.auth_header, None) == auth_val:
+ return None
+ req.add_unredirected_header(self.auth_header, auth_val)
+ resp = self.parent.open(req, timeout=req.timeout)
+ return resp
+
+ def get_cnonce(self, nonce):
+ # The cnonce-value is an opaque
+ # quoted string value provided by the client and used by both client
+ # and server to avoid chosen plaintext attacks, to provide mutual
+ # authentication, and to provide some message integrity protection.
+ # This isn't a fabulous effort, but it's probably Good Enough.
+ s = "%s:%s:%s:" % (self.nonce_count, nonce, time.ctime())
+ b = s.encode("ascii") + _randombytes(8)
+ dig = hashlib.sha1(b).hexdigest()
+ return dig[:16]
+
+ def get_authorization(self, req, chal):
+ try:
+ realm = chal['realm']
+ nonce = chal['nonce']
+ qop = chal.get('qop')
+ algorithm = chal.get('algorithm', 'MD5')
+ # mod_digest doesn't send an opaque, even though it isn't
+ # supposed to be optional
+ opaque = chal.get('opaque', None)
+ except KeyError:
+ return None
+
+ H, KD = self.get_algorithm_impls(algorithm)
+ if H is None:
+ return None
+
+ user, pw = self.passwd.find_user_password(realm, req.full_url)
+ if user is None:
+ return None
+
+ # XXX not implemented yet
+ if req.data is not None:
+ entdig = self.get_entity_digest(req.data, chal)
+ else:
+ entdig = None
+
+ A1 = "%s:%s:%s" % (user, realm, pw)
+ A2 = "%s:%s" % (req.get_method(),
+ # XXX selector: what about proxies and full urls
+ req.selector)
+ if qop == 'auth':
+ if nonce == self.last_nonce:
+ self.nonce_count += 1
+ else:
+ self.nonce_count = 1
+ self.last_nonce = nonce
+ ncvalue = '%08x' % self.nonce_count
+ cnonce = self.get_cnonce(nonce)
+ noncebit = "%s:%s:%s:%s:%s" % (nonce, ncvalue, cnonce, qop, H(A2))
+ respdig = KD(H(A1), noncebit)
+ elif qop is None:
+ respdig = KD(H(A1), "%s:%s" % (nonce, H(A2)))
+ else:
+ # XXX handle auth-int.
+ raise URLError("qop '%s' is not supported." % qop)
+
+ # XXX should the partial digests be encoded too?
+
+ base = 'username="%s", realm="%s", nonce="%s", uri="%s", ' \
+ 'response="%s"' % (user, realm, nonce, req.selector,
+ respdig)
+ if opaque:
+ base += ', opaque="%s"' % opaque
+ if entdig:
+ base += ', digest="%s"' % entdig
+ base += ', algorithm="%s"' % algorithm
+ if qop:
+ base += ', qop=auth, nc=%s, cnonce="%s"' % (ncvalue, cnonce)
+ return base
+
+ def get_algorithm_impls(self, algorithm):
+ # lambdas assume digest modules are imported at the top level
+ if algorithm == 'MD5':
+ H = lambda x: hashlib.md5(x.encode("ascii")).hexdigest()
+ elif algorithm == 'SHA':
+ H = lambda x: hashlib.sha1(x.encode("ascii")).hexdigest()
+ # XXX MD5-sess
+ KD = lambda s, d: H("%s:%s" % (s, d))
+ return H, KD
+
+ def get_entity_digest(self, data, chal):
+ # XXX not implemented yet
+ return None
+
+
+class HTTPDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler):
+ """An authentication protocol defined by RFC 2069
+
+ Digest authentication improves on basic authentication because it
+ does not transmit passwords in the clear.
+ """
+
+ auth_header = 'Authorization'
+ handler_order = 490 # before Basic auth
+
+ def http_error_401(self, req, fp, code, msg, headers):
+ host = urlparse(req.full_url)[1]
+ retry = self.http_error_auth_reqed('www-authenticate',
+ host, req, headers)
+ self.reset_retry_count()
+ return retry
+
+
+class ProxyDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler):
+
+ auth_header = 'Proxy-Authorization'
+ handler_order = 490 # before Basic auth
+
+ def http_error_407(self, req, fp, code, msg, headers):
+ host = req.host
+ retry = self.http_error_auth_reqed('proxy-authenticate',
+ host, req, headers)
+ self.reset_retry_count()
+ return retry
+
+class AbstractHTTPHandler(BaseHandler):
+
+ def __init__(self, debuglevel=0):
+ self._debuglevel = debuglevel
+
+ def set_http_debuglevel(self, level):
+ self._debuglevel = level
+
+ def do_request_(self, request):
+ host = request.host
+ if not host:
+ raise URLError('no host given')
+
+ if request.data is not None: # POST
+ data = request.data
+ if isinstance(data, str):
+ msg = "POST data should be bytes or an iterable of bytes. " \
+ "It cannot be of type str."
+ raise TypeError(msg)
+ if not request.has_header('Content-type'):
+ request.add_unredirected_header(
+ 'Content-type',
+ 'application/x-www-form-urlencoded')
+ if not request.has_header('Content-length'):
+ size = None
+ try:
+ ### For Python-Future:
+ if PY2 and isinstance(data, array.array):
+ # memoryviews of arrays aren't supported
+ # in Py2.7. (e.g. memoryview(array.array('I',
+ # [1, 2, 3, 4])) raises a TypeError.)
+ # So we calculate the size manually instead:
+ size = len(data) * data.itemsize
+ ###
+ else:
+ mv = memoryview(data)
+ size = len(mv) * mv.itemsize
+ except TypeError:
+ if isinstance(data, collections.Iterable):
+ raise ValueError("Content-Length should be specified "
+ "for iterable data of type %r %r" % (type(data),
+ data))
+ else:
+ request.add_unredirected_header(
+ 'Content-length', '%d' % size)
+
+ sel_host = host
+ if request.has_proxy():
+ scheme, sel = splittype(request.selector)
+ sel_host, sel_path = splithost(sel)
+ if not request.has_header('Host'):
+ request.add_unredirected_header('Host', sel_host)
+ for name, value in self.parent.addheaders:
+ name = name.capitalize()
+ if not request.has_header(name):
+ request.add_unredirected_header(name, value)
+
+ return request
+
+ def do_open(self, http_class, req, **http_conn_args):
+ """Return an HTTPResponse object for the request, using http_class.
+
+ http_class must implement the HTTPConnection API from http.client.
+ """
+ host = req.host
+ if not host:
+ raise URLError('no host given')
+
+ # will parse host:port
+ h = http_class(host, timeout=req.timeout, **http_conn_args)
+
+ headers = dict(req.unredirected_hdrs)
+ headers.update(dict((k, v) for k, v in req.headers.items()
+ if k not in headers))
+
+ # TODO(jhylton): Should this be redesigned to handle
+ # persistent connections?
+
+ # We want to make an HTTP/1.1 request, but the addinfourl
+ # class isn't prepared to deal with a persistent connection.
+ # It will try to read all remaining data from the socket,
+ # which will block while the server waits for the next request.
+ # So make sure the connection gets closed after the (only)
+ # request.
+ headers["Connection"] = "close"
+ headers = dict((name.title(), val) for name, val in headers.items())
+
+ if req._tunnel_host:
+ tunnel_headers = {}
+ proxy_auth_hdr = "Proxy-Authorization"
+ if proxy_auth_hdr in headers:
+ tunnel_headers[proxy_auth_hdr] = headers[proxy_auth_hdr]
+ # Proxy-Authorization should not be sent to origin
+ # server.
+ del headers[proxy_auth_hdr]
+ h.set_tunnel(req._tunnel_host, headers=tunnel_headers)
+
+ try:
+ h.request(req.get_method(), req.selector, req.data, headers)
+ except socket.error as err: # timeout error
+ h.close()
+ raise URLError(err)
+ else:
+ r = h.getresponse()
+ # If the server does not send us a 'Connection: close' header,
+ # HTTPConnection assumes the socket should be left open. Manually
+ # mark the socket to be closed when this response object goes away.
+ if h.sock:
+ h.sock.close()
+ h.sock = None
+
+
+ r.url = req.get_full_url()
+ # This line replaces the .msg attribute of the HTTPResponse
+ # with .headers, because urllib clients expect the response to
+ # have the reason in .msg. It would be good to mark this
+ # attribute is deprecated and get then to use info() or
+ # .headers.
+ r.msg = r.reason
+ return r
+
+
+class HTTPHandler(AbstractHTTPHandler):
+
+ def http_open(self, req):
+ return self.do_open(http_client.HTTPConnection, req)
+
+ http_request = AbstractHTTPHandler.do_request_
+
+if hasattr(http_client, 'HTTPSConnection'):
+
+ class HTTPSHandler(AbstractHTTPHandler):
+
+ def __init__(self, debuglevel=0, context=None, check_hostname=None):
+ AbstractHTTPHandler.__init__(self, debuglevel)
+ self._context = context
+ self._check_hostname = check_hostname
+
+ def https_open(self, req):
+ return self.do_open(http_client.HTTPSConnection, req,
+ context=self._context, check_hostname=self._check_hostname)
+
+ https_request = AbstractHTTPHandler.do_request_
+
+ __all__.append('HTTPSHandler')
+
+class HTTPCookieProcessor(BaseHandler):
+ def __init__(self, cookiejar=None):
+ import future.backports.http.cookiejar as http_cookiejar
+ if cookiejar is None:
+ cookiejar = http_cookiejar.CookieJar()
+ self.cookiejar = cookiejar
+
+ def http_request(self, request):
+ self.cookiejar.add_cookie_header(request)
+ return request
+
+ def http_response(self, request, response):
+ self.cookiejar.extract_cookies(response, request)
+ return response
+
+ https_request = http_request
+ https_response = http_response
+
+class UnknownHandler(BaseHandler):
+ def unknown_open(self, req):
+ type = req.type
+ raise URLError('unknown url type: %s' % type)
+
+def parse_keqv_list(l):
+ """Parse list of key=value strings where keys are not duplicated."""
+ parsed = {}
+ for elt in l:
+ k, v = elt.split('=', 1)
+ if v[0] == '"' and v[-1] == '"':
+ v = v[1:-1]
+ parsed[k] = v
+ return parsed
+
+def parse_http_list(s):
+ """Parse lists as described by RFC 2068 Section 2.
+
+ In particular, parse comma-separated lists where the elements of
+ the list may include quoted-strings. A quoted-string could
+ contain a comma. A non-quoted string could have quotes in the
+ middle. Neither commas nor quotes count if they are escaped.
+ Only double-quotes count, not single-quotes.
+ """
+ res = []
+ part = ''
+
+ escape = quote = False
+ for cur in s:
+ if escape:
+ part += cur
+ escape = False
+ continue
+ if quote:
+ if cur == '\\':
+ escape = True
+ continue
+ elif cur == '"':
+ quote = False
+ part += cur
+ continue
+
+ if cur == ',':
+ res.append(part)
+ part = ''
+ continue
+
+ if cur == '"':
+ quote = True
+
+ part += cur
+
+ # append last part
+ if part:
+ res.append(part)
+
+ return [part.strip() for part in res]
+
+class FileHandler(BaseHandler):
+ # Use local file or FTP depending on form of URL
+ def file_open(self, req):
+ url = req.selector
+ if url[:2] == '//' and url[2:3] != '/' and (req.host and
+ req.host != 'localhost'):
+ if not req.host is self.get_names():
+ raise URLError("file:// scheme is supported only on localhost")
+ else:
+ return self.open_local_file(req)
+
+ # names for the localhost
+ names = None
+ def get_names(self):
+ if FileHandler.names is None:
+ try:
+ FileHandler.names = tuple(
+ socket.gethostbyname_ex('localhost')[2] +
+ socket.gethostbyname_ex(socket.gethostname())[2])
+ except socket.gaierror:
+ FileHandler.names = (socket.gethostbyname('localhost'),)
+ return FileHandler.names
+
+ # not entirely sure what the rules are here
+ def open_local_file(self, req):
+ import future.backports.email.utils as email_utils
+ import mimetypes
+ host = req.host
+ filename = req.selector
+ localfile = url2pathname(filename)
+ try:
+ stats = os.stat(localfile)
+ size = stats.st_size
+ modified = email_utils.formatdate(stats.st_mtime, usegmt=True)
+ mtype = mimetypes.guess_type(filename)[0]
+ headers = email.message_from_string(
+ 'Content-type: %s\nContent-length: %d\nLast-modified: %s\n' %
+ (mtype or 'text/plain', size, modified))
+ if host:
+ host, port = splitport(host)
+ if not host or \
+ (not port and _safe_gethostbyname(host) in self.get_names()):
+ if host:
+ origurl = 'file://' + host + filename
+ else:
+ origurl = 'file://' + filename
+ return addinfourl(open(localfile, 'rb'), headers, origurl)
+ except OSError as exp:
+ # users shouldn't expect OSErrors coming from urlopen()
+ raise URLError(exp)
+ raise URLError('file not on local host')
+
+def _safe_gethostbyname(host):
+ try:
+ return socket.gethostbyname(host)
+ except socket.gaierror:
+ return None
+
+class FTPHandler(BaseHandler):
+ def ftp_open(self, req):
+ import ftplib
+ import mimetypes
+ host = req.host
+ if not host:
+ raise URLError('ftp error: no host given')
+ host, port = splitport(host)
+ if port is None:
+ port = ftplib.FTP_PORT
+ else:
+ port = int(port)
+
+ # username/password handling
+ user, host = splituser(host)
+ if user:
+ user, passwd = splitpasswd(user)
+ else:
+ passwd = None
+ host = unquote(host)
+ user = user or ''
+ passwd = passwd or ''
+
+ try:
+ host = socket.gethostbyname(host)
+ except socket.error as msg:
+ raise URLError(msg)
+ path, attrs = splitattr(req.selector)
+ dirs = path.split('/')
+ dirs = list(map(unquote, dirs))
+ dirs, file = dirs[:-1], dirs[-1]
+ if dirs and not dirs[0]:
+ dirs = dirs[1:]
+ try:
+ fw = self.connect_ftp(user, passwd, host, port, dirs, req.timeout)
+ type = file and 'I' or 'D'
+ for attr in attrs:
+ attr, value = splitvalue(attr)
+ if attr.lower() == 'type' and \
+ value in ('a', 'A', 'i', 'I', 'd', 'D'):
+ type = value.upper()
+ fp, retrlen = fw.retrfile(file, type)
+ headers = ""
+ mtype = mimetypes.guess_type(req.full_url)[0]
+ if mtype:
+ headers += "Content-type: %s\n" % mtype
+ if retrlen is not None and retrlen >= 0:
+ headers += "Content-length: %d\n" % retrlen
+ headers = email.message_from_string(headers)
+ return addinfourl(fp, headers, req.full_url)
+ except ftplib.all_errors as exp:
+ exc = URLError('ftp error: %r' % exp)
+ raise_with_traceback(exc)
+
+ def connect_ftp(self, user, passwd, host, port, dirs, timeout):
+ return ftpwrapper(user, passwd, host, port, dirs, timeout,
+ persistent=False)
+
+class CacheFTPHandler(FTPHandler):
+ # XXX would be nice to have pluggable cache strategies
+ # XXX this stuff is definitely not thread safe
+ def __init__(self):
+ self.cache = {}
+ self.timeout = {}
+ self.soonest = 0
+ self.delay = 60
+ self.max_conns = 16
+
+ def setTimeout(self, t):
+ self.delay = t
+
+ def setMaxConns(self, m):
+ self.max_conns = m
+
+ def connect_ftp(self, user, passwd, host, port, dirs, timeout):
+ key = user, host, port, '/'.join(dirs), timeout
+ if key in self.cache:
+ self.timeout[key] = time.time() + self.delay
+ else:
+ self.cache[key] = ftpwrapper(user, passwd, host, port,
+ dirs, timeout)
+ self.timeout[key] = time.time() + self.delay
+ self.check_cache()
+ return self.cache[key]
+
+ def check_cache(self):
+ # first check for old ones
+ t = time.time()
+ if self.soonest <= t:
+ for k, v in list(self.timeout.items()):
+ if v < t:
+ self.cache[k].close()
+ del self.cache[k]
+ del self.timeout[k]
+ self.soonest = min(list(self.timeout.values()))
+
+ # then check the size
+ if len(self.cache) == self.max_conns:
+ for k, v in list(self.timeout.items()):
+ if v == self.soonest:
+ del self.cache[k]
+ del self.timeout[k]
+ break
+ self.soonest = min(list(self.timeout.values()))
+
+ def clear_cache(self):
+ for conn in self.cache.values():
+ conn.close()
+ self.cache.clear()
+ self.timeout.clear()
+
+
+# Code move from the old urllib module
+
+MAXFTPCACHE = 10 # Trim the ftp cache beyond this size
+
+# Helper for non-unix systems
+if os.name == 'nt':
+ from nturl2path import url2pathname, pathname2url
+else:
+ def url2pathname(pathname):
+ """OS-specific conversion from a relative URL of the 'file' scheme
+ to a file system path; not recommended for general use."""
+ return unquote(pathname)
+
+ def pathname2url(pathname):
+ """OS-specific conversion from a file system path to a relative URL
+ of the 'file' scheme; not recommended for general use."""
+ return quote(pathname)
+
+# This really consists of two pieces:
+# (1) a class which handles opening of all sorts of URLs
+# (plus assorted utilities etc.)
+# (2) a set of functions for parsing URLs
+# XXX Should these be separated out into different modules?
+
+
+ftpcache = {}
+class URLopener(object):
+ """Class to open URLs.
+ This is a class rather than just a subroutine because we may need
+ more than one set of global protocol-specific options.
+ Note -- this is a base class for those who don't want the
+ automatic handling of errors type 302 (relocated) and 401
+ (authorization needed)."""
+
+ __tempfiles = None
+
+ version = "Python-urllib/%s" % __version__
+
+ # Constructor
+ def __init__(self, proxies=None, **x509):
+ msg = "%(class)s style of invoking requests is deprecated. " \
+ "Use newer urlopen functions/methods" % {'class': self.__class__.__name__}
+ warnings.warn(msg, DeprecationWarning, stacklevel=3)
+ if proxies is None:
+ proxies = getproxies()
+ assert hasattr(proxies, 'keys'), "proxies must be a mapping"
+ self.proxies = proxies
+ self.key_file = x509.get('key_file')
+ self.cert_file = x509.get('cert_file')
+ self.addheaders = [('User-Agent', self.version)]
+ self.__tempfiles = []
+ self.__unlink = os.unlink # See cleanup()
+ self.tempcache = None
+ # Undocumented feature: if you assign {} to tempcache,
+ # it is used to cache files retrieved with
+ # self.retrieve(). This is not enabled by default
+ # since it does not work for changing documents (and I
+ # haven't got the logic to check expiration headers
+ # yet).
+ self.ftpcache = ftpcache
+ # Undocumented feature: you can use a different
+ # ftp cache by assigning to the .ftpcache member;
+ # in case you want logically independent URL openers
+ # XXX This is not threadsafe. Bah.
+
+ def __del__(self):
+ self.close()
+
+ def close(self):
+ self.cleanup()
+
+ def cleanup(self):
+ # This code sometimes runs when the rest of this module
+ # has already been deleted, so it can't use any globals
+ # or import anything.
+ if self.__tempfiles:
+ for file in self.__tempfiles:
+ try:
+ self.__unlink(file)
+ except OSError:
+ pass
+ del self.__tempfiles[:]
+ if self.tempcache:
+ self.tempcache.clear()
+
+ def addheader(self, *args):
+ """Add a header to be used by the HTTP interface only
+ e.g. u.addheader('Accept', 'sound/basic')"""
+ self.addheaders.append(args)
+
+ # External interface
+ def open(self, fullurl, data=None):
+ """Use URLopener().open(file) instead of open(file, 'r')."""
+ fullurl = unwrap(to_bytes(fullurl))
+ fullurl = quote(fullurl, safe="%/:=&?~#+!$,;'@()*[]|")
+ if self.tempcache and fullurl in self.tempcache:
+ filename, headers = self.tempcache[fullurl]
+ fp = open(filename, 'rb')
+ return addinfourl(fp, headers, fullurl)
+ urltype, url = splittype(fullurl)
+ if not urltype:
+ urltype = 'file'
+ if urltype in self.proxies:
+ proxy = self.proxies[urltype]
+ urltype, proxyhost = splittype(proxy)
+ host, selector = splithost(proxyhost)
+ url = (host, fullurl) # Signal special case to open_*()
+ else:
+ proxy = None
+ name = 'open_' + urltype
+ self.type = urltype
+ name = name.replace('-', '_')
+ if not hasattr(self, name):
+ if proxy:
+ return self.open_unknown_proxy(proxy, fullurl, data)
+ else:
+ return self.open_unknown(fullurl, data)
+ try:
+ if data is None:
+ return getattr(self, name)(url)
+ else:
+ return getattr(self, name)(url, data)
+ except HTTPError:
+ raise
+ except socket.error as msg:
+ raise_with_traceback(IOError('socket error', msg))
+
+ def open_unknown(self, fullurl, data=None):
+ """Overridable interface to open unknown URL type."""
+ type, url = splittype(fullurl)
+ raise IOError('url error', 'unknown url type', type)
+
+ def open_unknown_proxy(self, proxy, fullurl, data=None):
+ """Overridable interface to open unknown URL type."""
+ type, url = splittype(fullurl)
+ raise IOError('url error', 'invalid proxy for %s' % type, proxy)
+
+ # External interface
+ def retrieve(self, url, filename=None, reporthook=None, data=None):
+ """retrieve(url) returns (filename, headers) for a local object
+ or (tempfilename, headers) for a remote object."""
+ url = unwrap(to_bytes(url))
+ if self.tempcache and url in self.tempcache:
+ return self.tempcache[url]
+ type, url1 = splittype(url)
+ if filename is None and (not type or type == 'file'):
+ try:
+ fp = self.open_local_file(url1)
+ hdrs = fp.info()
+ fp.close()
+ return url2pathname(splithost(url1)[1]), hdrs
+ except IOError as msg:
+ pass
+ fp = self.open(url, data)
+ try:
+ headers = fp.info()
+ if filename:
+ tfp = open(filename, 'wb')
+ else:
+ import tempfile
+ garbage, path = splittype(url)
+ garbage, path = splithost(path or "")
+ path, garbage = splitquery(path or "")
+ path, garbage = splitattr(path or "")
+ suffix = os.path.splitext(path)[1]
+ (fd, filename) = tempfile.mkstemp(suffix)
+ self.__tempfiles.append(filename)
+ tfp = os.fdopen(fd, 'wb')
+ try:
+ result = filename, headers
+ if self.tempcache is not None:
+ self.tempcache[url] = result
+ bs = 1024*8
+ size = -1
+ read = 0
+ blocknum = 0
+ if "content-length" in headers:
+ size = int(headers["Content-Length"])
+ if reporthook:
+ reporthook(blocknum, bs, size)
+ while 1:
+ block = fp.read(bs)
+ if not block:
+ break
+ read += len(block)
+ tfp.write(block)
+ blocknum += 1
+ if reporthook:
+ reporthook(blocknum, bs, size)
+ finally:
+ tfp.close()
+ finally:
+ fp.close()
+
+ # raise exception if actual size does not match content-length header
+ if size >= 0 and read < size:
+ raise ContentTooShortError(
+ "retrieval incomplete: got only %i out of %i bytes"
+ % (read, size), result)
+
+ return result
+
+ # Each method named open_ knows how to open that type of URL
+
+ def _open_generic_http(self, connection_factory, url, data):
+ """Make an HTTP connection using connection_class.
+
+ This is an internal method that should be called from
+ open_http() or open_https().
+
+ Arguments:
+ - connection_factory should take a host name and return an
+ HTTPConnection instance.
+ - url is the url to retrieval or a host, relative-path pair.
+ - data is payload for a POST request or None.
+ """
+
+ user_passwd = None
+ proxy_passwd= None
+ if isinstance(url, str):
+ host, selector = splithost(url)
+ if host:
+ user_passwd, host = splituser(host)
+ host = unquote(host)
+ realhost = host
+ else:
+ host, selector = url
+ # check whether the proxy contains authorization information
+ proxy_passwd, host = splituser(host)
+ # now we proceed with the url we want to obtain
+ urltype, rest = splittype(selector)
+ url = rest
+ user_passwd = None
+ if urltype.lower() != 'http':
+ realhost = None
+ else:
+ realhost, rest = splithost(rest)
+ if realhost:
+ user_passwd, realhost = splituser(realhost)
+ if user_passwd:
+ selector = "%s://%s%s" % (urltype, realhost, rest)
+ if proxy_bypass(realhost):
+ host = realhost
+
+ if not host: raise IOError('http error', 'no host given')
+
+ if proxy_passwd:
+ proxy_passwd = unquote(proxy_passwd)
+ proxy_auth = base64.b64encode(proxy_passwd.encode()).decode('ascii')
+ else:
+ proxy_auth = None
+
+ if user_passwd:
+ user_passwd = unquote(user_passwd)
+ auth = base64.b64encode(user_passwd.encode()).decode('ascii')
+ else:
+ auth = None
+ http_conn = connection_factory(host)
+ headers = {}
+ if proxy_auth:
+ headers["Proxy-Authorization"] = "Basic %s" % proxy_auth
+ if auth:
+ headers["Authorization"] = "Basic %s" % auth
+ if realhost:
+ headers["Host"] = realhost
+
+ # Add Connection:close as we don't support persistent connections yet.
+ # This helps in closing the socket and avoiding ResourceWarning
+
+ headers["Connection"] = "close"
+
+ for header, value in self.addheaders:
+ headers[header] = value
+
+ if data is not None:
+ headers["Content-Type"] = "application/x-www-form-urlencoded"
+ http_conn.request("POST", selector, data, headers)
+ else:
+ http_conn.request("GET", selector, headers=headers)
+
+ try:
+ response = http_conn.getresponse()
+ except http_client.BadStatusLine:
+ # something went wrong with the HTTP status line
+ raise URLError("http protocol error: bad status line")
+
+ # According to RFC 2616, "2xx" code indicates that the client's
+ # request was successfully received, understood, and accepted.
+ if 200 <= response.status < 300:
+ return addinfourl(response, response.msg, "http:" + url,
+ response.status)
+ else:
+ return self.http_error(
+ url, response.fp,
+ response.status, response.reason, response.msg, data)
+
+ def open_http(self, url, data=None):
+ """Use HTTP protocol."""
+ return self._open_generic_http(http_client.HTTPConnection, url, data)
+
+ def http_error(self, url, fp, errcode, errmsg, headers, data=None):
+ """Handle http errors.
+
+ Derived class can override this, or provide specific handlers
+ named http_error_DDD where DDD is the 3-digit error code."""
+ # First check if there's a specific handler for this error
+ name = 'http_error_%d' % errcode
+ if hasattr(self, name):
+ method = getattr(self, name)
+ if data is None:
+ result = method(url, fp, errcode, errmsg, headers)
+ else:
+ result = method(url, fp, errcode, errmsg, headers, data)
+ if result: return result
+ return self.http_error_default(url, fp, errcode, errmsg, headers)
+
+ def http_error_default(self, url, fp, errcode, errmsg, headers):
+ """Default error handler: close the connection and raise IOError."""
+ fp.close()
+ raise HTTPError(url, errcode, errmsg, headers, None)
+
+ if _have_ssl:
+ def _https_connection(self, host):
+ return http_client.HTTPSConnection(host,
+ key_file=self.key_file,
+ cert_file=self.cert_file)
+
+ def open_https(self, url, data=None):
+ """Use HTTPS protocol."""
+ return self._open_generic_http(self._https_connection, url, data)
+
+ def open_file(self, url):
+ """Use local file or FTP depending on form of URL."""
+ if not isinstance(url, str):
+ raise URLError('file error: proxy support for file protocol currently not implemented')
+ if url[:2] == '//' and url[2:3] != '/' and url[2:12].lower() != 'localhost/':
+ raise ValueError("file:// scheme is supported only on localhost")
+ else:
+ return self.open_local_file(url)
+
+ def open_local_file(self, url):
+ """Use local file."""
+ import future.backports.email.utils as email_utils
+ import mimetypes
+ host, file = splithost(url)
+ localname = url2pathname(file)
+ try:
+ stats = os.stat(localname)
+ except OSError as e:
+ raise URLError(e.strerror, e.filename)
+ size = stats.st_size
+ modified = email_utils.formatdate(stats.st_mtime, usegmt=True)
+ mtype = mimetypes.guess_type(url)[0]
+ headers = email.message_from_string(
+ 'Content-Type: %s\nContent-Length: %d\nLast-modified: %s\n' %
+ (mtype or 'text/plain', size, modified))
+ if not host:
+ urlfile = file
+ if file[:1] == '/':
+ urlfile = 'file://' + file
+ return addinfourl(open(localname, 'rb'), headers, urlfile)
+ host, port = splitport(host)
+ if (not port
+ and socket.gethostbyname(host) in ((localhost(),) + thishost())):
+ urlfile = file
+ if file[:1] == '/':
+ urlfile = 'file://' + file
+ elif file[:2] == './':
+ raise ValueError("local file url may start with / or file:. Unknown url of type: %s" % url)
+ return addinfourl(open(localname, 'rb'), headers, urlfile)
+ raise URLError('local file error: not on local host')
+
+ def open_ftp(self, url):
+ """Use FTP protocol."""
+ if not isinstance(url, str):
+ raise URLError('ftp error: proxy support for ftp protocol currently not implemented')
+ import mimetypes
+ host, path = splithost(url)
+ if not host: raise URLError('ftp error: no host given')
+ host, port = splitport(host)
+ user, host = splituser(host)
+ if user: user, passwd = splitpasswd(user)
+ else: passwd = None
+ host = unquote(host)
+ user = unquote(user or '')
+ passwd = unquote(passwd or '')
+ host = socket.gethostbyname(host)
+ if not port:
+ import ftplib
+ port = ftplib.FTP_PORT
+ else:
+ port = int(port)
+ path, attrs = splitattr(path)
+ path = unquote(path)
+ dirs = path.split('/')
+ dirs, file = dirs[:-1], dirs[-1]
+ if dirs and not dirs[0]: dirs = dirs[1:]
+ if dirs and not dirs[0]: dirs[0] = '/'
+ key = user, host, port, '/'.join(dirs)
+ # XXX thread unsafe!
+ if len(self.ftpcache) > MAXFTPCACHE:
+ # Prune the cache, rather arbitrarily
+ for k in self.ftpcache.keys():
+ if k != key:
+ v = self.ftpcache[k]
+ del self.ftpcache[k]
+ v.close()
+ try:
+ if key not in self.ftpcache:
+ self.ftpcache[key] = \
+ ftpwrapper(user, passwd, host, port, dirs)
+ if not file: type = 'D'
+ else: type = 'I'
+ for attr in attrs:
+ attr, value = splitvalue(attr)
+ if attr.lower() == 'type' and \
+ value in ('a', 'A', 'i', 'I', 'd', 'D'):
+ type = value.upper()
+ (fp, retrlen) = self.ftpcache[key].retrfile(file, type)
+ mtype = mimetypes.guess_type("ftp:" + url)[0]
+ headers = ""
+ if mtype:
+ headers += "Content-Type: %s\n" % mtype
+ if retrlen is not None and retrlen >= 0:
+ headers += "Content-Length: %d\n" % retrlen
+ headers = email.message_from_string(headers)
+ return addinfourl(fp, headers, "ftp:" + url)
+ except ftperrors() as exp:
+ raise_with_traceback(URLError('ftp error %r' % exp))
+
+ def open_data(self, url, data=None):
+ """Use "data" URL."""
+ if not isinstance(url, str):
+ raise URLError('data error: proxy support for data protocol currently not implemented')
+ # ignore POSTed data
+ #
+ # syntax of data URLs:
+ # dataurl := "data:" [ mediatype ] [ ";base64" ] "," data
+ # mediatype := [ type "/" subtype ] *( ";" parameter )
+ # data := *urlchar
+ # parameter := attribute "=" value
+ try:
+ [type, data] = url.split(',', 1)
+ except ValueError:
+ raise IOError('data error', 'bad data URL')
+ if not type:
+ type = 'text/plain;charset=US-ASCII'
+ semi = type.rfind(';')
+ if semi >= 0 and '=' not in type[semi:]:
+ encoding = type[semi+1:]
+ type = type[:semi]
+ else:
+ encoding = ''
+ msg = []
+ msg.append('Date: %s'%time.strftime('%a, %d %b %Y %H:%M:%S GMT',
+ time.gmtime(time.time())))
+ msg.append('Content-type: %s' % type)
+ if encoding == 'base64':
+ # XXX is this encoding/decoding ok?
+ data = base64.decodebytes(data.encode('ascii')).decode('latin-1')
+ else:
+ data = unquote(data)
+ msg.append('Content-Length: %d' % len(data))
+ msg.append('')
+ msg.append(data)
+ msg = '\n'.join(msg)
+ headers = email.message_from_string(msg)
+ f = io.StringIO(msg)
+ #f.fileno = None # needed for addinfourl
+ return addinfourl(f, headers, url)
+
+
+class FancyURLopener(URLopener):
+ """Derived class with handlers for errors we can handle (perhaps)."""
+
+ def __init__(self, *args, **kwargs):
+ URLopener.__init__(self, *args, **kwargs)
+ self.auth_cache = {}
+ self.tries = 0
+ self.maxtries = 10
+
+ def http_error_default(self, url, fp, errcode, errmsg, headers):
+ """Default error handling -- don't raise an exception."""
+ return addinfourl(fp, headers, "http:" + url, errcode)
+
+ def http_error_302(self, url, fp, errcode, errmsg, headers, data=None):
+ """Error 302 -- relocated (temporarily)."""
+ self.tries += 1
+ if self.maxtries and self.tries >= self.maxtries:
+ if hasattr(self, "http_error_500"):
+ meth = self.http_error_500
+ else:
+ meth = self.http_error_default
+ self.tries = 0
+ return meth(url, fp, 500,
+ "Internal Server Error: Redirect Recursion", headers)
+ result = self.redirect_internal(url, fp, errcode, errmsg, headers,
+ data)
+ self.tries = 0
+ return result
+
+ def redirect_internal(self, url, fp, errcode, errmsg, headers, data):
+ if 'location' in headers:
+ newurl = headers['location']
+ elif 'uri' in headers:
+ newurl = headers['uri']
+ else:
+ return
+ fp.close()
+
+ # In case the server sent a relative URL, join with original:
+ newurl = urljoin(self.type + ":" + url, newurl)
+
+ urlparts = urlparse(newurl)
+
+ # For security reasons, we don't allow redirection to anything other
+ # than http, https and ftp.
+
+ # We are using newer HTTPError with older redirect_internal method
+ # This older method will get deprecated in 3.3
+
+ if urlparts.scheme not in ('http', 'https', 'ftp', ''):
+ raise HTTPError(newurl, errcode,
+ errmsg +
+ " Redirection to url '%s' is not allowed." % newurl,
+ headers, fp)
+
+ return self.open(newurl)
+
+ def http_error_301(self, url, fp, errcode, errmsg, headers, data=None):
+ """Error 301 -- also relocated (permanently)."""
+ return self.http_error_302(url, fp, errcode, errmsg, headers, data)
+
+ def http_error_303(self, url, fp, errcode, errmsg, headers, data=None):
+ """Error 303 -- also relocated (essentially identical to 302)."""
+ return self.http_error_302(url, fp, errcode, errmsg, headers, data)
+
+ def http_error_307(self, url, fp, errcode, errmsg, headers, data=None):
+ """Error 307 -- relocated, but turn POST into error."""
+ if data is None:
+ return self.http_error_302(url, fp, errcode, errmsg, headers, data)
+ else:
+ return self.http_error_default(url, fp, errcode, errmsg, headers)
+
+ def http_error_401(self, url, fp, errcode, errmsg, headers, data=None,
+ retry=False):
+ """Error 401 -- authentication required.
+ This function supports Basic authentication only."""
+ if 'www-authenticate' not in headers:
+ URLopener.http_error_default(self, url, fp,
+ errcode, errmsg, headers)
+ stuff = headers['www-authenticate']
+ match = re.match('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', stuff)
+ if not match:
+ URLopener.http_error_default(self, url, fp,
+ errcode, errmsg, headers)
+ scheme, realm = match.groups()
+ if scheme.lower() != 'basic':
+ URLopener.http_error_default(self, url, fp,
+ errcode, errmsg, headers)
+ if not retry:
+ URLopener.http_error_default(self, url, fp, errcode, errmsg,
+ headers)
+ name = 'retry_' + self.type + '_basic_auth'
+ if data is None:
+ return getattr(self,name)(url, realm)
+ else:
+ return getattr(self,name)(url, realm, data)
+
+ def http_error_407(self, url, fp, errcode, errmsg, headers, data=None,
+ retry=False):
+ """Error 407 -- proxy authentication required.
+ This function supports Basic authentication only."""
+ if 'proxy-authenticate' not in headers:
+ URLopener.http_error_default(self, url, fp,
+ errcode, errmsg, headers)
+ stuff = headers['proxy-authenticate']
+ match = re.match('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', stuff)
+ if not match:
+ URLopener.http_error_default(self, url, fp,
+ errcode, errmsg, headers)
+ scheme, realm = match.groups()
+ if scheme.lower() != 'basic':
+ URLopener.http_error_default(self, url, fp,
+ errcode, errmsg, headers)
+ if not retry:
+ URLopener.http_error_default(self, url, fp, errcode, errmsg,
+ headers)
+ name = 'retry_proxy_' + self.type + '_basic_auth'
+ if data is None:
+ return getattr(self,name)(url, realm)
+ else:
+ return getattr(self,name)(url, realm, data)
+
+ def retry_proxy_http_basic_auth(self, url, realm, data=None):
+ host, selector = splithost(url)
+ newurl = 'http://' + host + selector
+ proxy = self.proxies['http']
+ urltype, proxyhost = splittype(proxy)
+ proxyhost, proxyselector = splithost(proxyhost)
+ i = proxyhost.find('@') + 1
+ proxyhost = proxyhost[i:]
+ user, passwd = self.get_user_passwd(proxyhost, realm, i)
+ if not (user or passwd): return None
+ proxyhost = "%s:%s@%s" % (quote(user, safe=''),
+ quote(passwd, safe=''), proxyhost)
+ self.proxies['http'] = 'http://' + proxyhost + proxyselector
+ if data is None:
+ return self.open(newurl)
+ else:
+ return self.open(newurl, data)
+
+ def retry_proxy_https_basic_auth(self, url, realm, data=None):
+ host, selector = splithost(url)
+ newurl = 'https://' + host + selector
+ proxy = self.proxies['https']
+ urltype, proxyhost = splittype(proxy)
+ proxyhost, proxyselector = splithost(proxyhost)
+ i = proxyhost.find('@') + 1
+ proxyhost = proxyhost[i:]
+ user, passwd = self.get_user_passwd(proxyhost, realm, i)
+ if not (user or passwd): return None
+ proxyhost = "%s:%s@%s" % (quote(user, safe=''),
+ quote(passwd, safe=''), proxyhost)
+ self.proxies['https'] = 'https://' + proxyhost + proxyselector
+ if data is None:
+ return self.open(newurl)
+ else:
+ return self.open(newurl, data)
+
+ def retry_http_basic_auth(self, url, realm, data=None):
+ host, selector = splithost(url)
+ i = host.find('@') + 1
+ host = host[i:]
+ user, passwd = self.get_user_passwd(host, realm, i)
+ if not (user or passwd): return None
+ host = "%s:%s@%s" % (quote(user, safe=''),
+ quote(passwd, safe=''), host)
+ newurl = 'http://' + host + selector
+ if data is None:
+ return self.open(newurl)
+ else:
+ return self.open(newurl, data)
+
+ def retry_https_basic_auth(self, url, realm, data=None):
+ host, selector = splithost(url)
+ i = host.find('@') + 1
+ host = host[i:]
+ user, passwd = self.get_user_passwd(host, realm, i)
+ if not (user or passwd): return None
+ host = "%s:%s@%s" % (quote(user, safe=''),
+ quote(passwd, safe=''), host)
+ newurl = 'https://' + host + selector
+ if data is None:
+ return self.open(newurl)
+ else:
+ return self.open(newurl, data)
+
+ def get_user_passwd(self, host, realm, clear_cache=0):
+ key = realm + '@' + host.lower()
+ if key in self.auth_cache:
+ if clear_cache:
+ del self.auth_cache[key]
+ else:
+ return self.auth_cache[key]
+ user, passwd = self.prompt_user_passwd(host, realm)
+ if user or passwd: self.auth_cache[key] = (user, passwd)
+ return user, passwd
+
+ def prompt_user_passwd(self, host, realm):
+ """Override this in a GUI environment!"""
+ import getpass
+ try:
+ user = input("Enter username for %s at %s: " % (realm, host))
+ passwd = getpass.getpass("Enter password for %s in %s at %s: " %
+ (user, realm, host))
+ return user, passwd
+ except KeyboardInterrupt:
+ print()
+ return None, None
+
+
+# Utility functions
+
+_localhost = None
+def localhost():
+ """Return the IP address of the magic hostname 'localhost'."""
+ global _localhost
+ if _localhost is None:
+ _localhost = socket.gethostbyname('localhost')
+ return _localhost
+
+_thishost = None
+def thishost():
+ """Return the IP addresses of the current host."""
+ global _thishost
+ if _thishost is None:
+ try:
+ _thishost = tuple(socket.gethostbyname_ex(socket.gethostname())[2])
+ except socket.gaierror:
+ _thishost = tuple(socket.gethostbyname_ex('localhost')[2])
+ return _thishost
+
+_ftperrors = None
+def ftperrors():
+ """Return the set of errors raised by the FTP class."""
+ global _ftperrors
+ if _ftperrors is None:
+ import ftplib
+ _ftperrors = ftplib.all_errors
+ return _ftperrors
+
+_noheaders = None
+def noheaders():
+ """Return an empty email Message object."""
+ global _noheaders
+ if _noheaders is None:
+ _noheaders = email.message_from_string("")
+ return _noheaders
+
+
+# Utility classes
+
+class ftpwrapper(object):
+ """Class used by open_ftp() for cache of open FTP connections."""
+
+ def __init__(self, user, passwd, host, port, dirs, timeout=None,
+ persistent=True):
+ self.user = user
+ self.passwd = passwd
+ self.host = host
+ self.port = port
+ self.dirs = dirs
+ self.timeout = timeout
+ self.refcount = 0
+ self.keepalive = persistent
+ self.init()
+
+ def init(self):
+ import ftplib
+ self.busy = 0
+ self.ftp = ftplib.FTP()
+ self.ftp.connect(self.host, self.port, self.timeout)
+ self.ftp.login(self.user, self.passwd)
+ _target = '/'.join(self.dirs)
+ self.ftp.cwd(_target)
+
+ def retrfile(self, file, type):
+ import ftplib
+ self.endtransfer()
+ if type in ('d', 'D'): cmd = 'TYPE A'; isdir = 1
+ else: cmd = 'TYPE ' + type; isdir = 0
+ try:
+ self.ftp.voidcmd(cmd)
+ except ftplib.all_errors:
+ self.init()
+ self.ftp.voidcmd(cmd)
+ conn = None
+ if file and not isdir:
+ # Try to retrieve as a file
+ try:
+ cmd = 'RETR ' + file
+ conn, retrlen = self.ftp.ntransfercmd(cmd)
+ except ftplib.error_perm as reason:
+ if str(reason)[:3] != '550':
+ raise_with_traceback(URLError('ftp error: %r' % reason))
+ if not conn:
+ # Set transfer mode to ASCII!
+ self.ftp.voidcmd('TYPE A')
+ # Try a directory listing. Verify that directory exists.
+ if file:
+ pwd = self.ftp.pwd()
+ try:
+ try:
+ self.ftp.cwd(file)
+ except ftplib.error_perm as reason:
+ ### Was:
+ # raise URLError('ftp error: %r' % reason) from reason
+ exc = URLError('ftp error: %r' % reason)
+ exc.__cause__ = reason
+ raise exc
+ finally:
+ self.ftp.cwd(pwd)
+ cmd = 'LIST ' + file
+ else:
+ cmd = 'LIST'
+ conn, retrlen = self.ftp.ntransfercmd(cmd)
+ self.busy = 1
+
+ ftpobj = addclosehook(conn.makefile('rb'), self.file_close)
+ self.refcount += 1
+ conn.close()
+ # Pass back both a suitably decorated object and a retrieval length
+ return (ftpobj, retrlen)
+
+ def endtransfer(self):
+ self.busy = 0
+
+ def close(self):
+ self.keepalive = False
+ if self.refcount <= 0:
+ self.real_close()
+
+ def file_close(self):
+ self.endtransfer()
+ self.refcount -= 1
+ if self.refcount <= 0 and not self.keepalive:
+ self.real_close()
+
+ def real_close(self):
+ self.endtransfer()
+ try:
+ self.ftp.close()
+ except ftperrors():
+ pass
+
+# Proxy handling
+def getproxies_environment():
+ """Return a dictionary of scheme -> proxy server URL mappings.
+
+ Scan the environment for variables named _proxy;
+ this seems to be the standard convention. If you need a
+ different way, you can pass a proxies dictionary to the
+ [Fancy]URLopener constructor.
+
+ """
+ proxies = {}
+ for name, value in os.environ.items():
+ name = name.lower()
+ if value and name[-6:] == '_proxy':
+ proxies[name[:-6]] = value
+ return proxies
+
+def proxy_bypass_environment(host):
+ """Test if proxies should not be used for a particular host.
+
+ Checks the environment for a variable named no_proxy, which should
+ be a list of DNS suffixes separated by commas, or '*' for all hosts.
+ """
+ no_proxy = os.environ.get('no_proxy', '') or os.environ.get('NO_PROXY', '')
+ # '*' is special case for always bypass
+ if no_proxy == '*':
+ return 1
+ # strip port off host
+ hostonly, port = splitport(host)
+ # check if the host ends with any of the DNS suffixes
+ no_proxy_list = [proxy.strip() for proxy in no_proxy.split(',')]
+ for name in no_proxy_list:
+ if name and (hostonly.endswith(name) or host.endswith(name)):
+ return 1
+ # otherwise, don't bypass
+ return 0
+
+
+# This code tests an OSX specific data structure but is testable on all
+# platforms
+def _proxy_bypass_macosx_sysconf(host, proxy_settings):
+ """
+ Return True iff this host shouldn't be accessed using a proxy
+
+ This function uses the MacOSX framework SystemConfiguration
+ to fetch the proxy information.
+
+ proxy_settings come from _scproxy._get_proxy_settings or get mocked ie:
+ { 'exclude_simple': bool,
+ 'exceptions': ['foo.bar', '*.bar.com', '127.0.0.1', '10.1', '10.0/16']
+ }
+ """
+ from fnmatch import fnmatch
+
+ hostonly, port = splitport(host)
+
+ def ip2num(ipAddr):
+ parts = ipAddr.split('.')
+ parts = list(map(int, parts))
+ if len(parts) != 4:
+ parts = (parts + [0, 0, 0, 0])[:4]
+ return (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8) | parts[3]
+
+ # Check for simple host names:
+ if '.' not in host:
+ if proxy_settings['exclude_simple']:
+ return True
+
+ hostIP = None
+
+ for value in proxy_settings.get('exceptions', ()):
+ # Items in the list are strings like these: *.local, 169.254/16
+ if not value: continue
+
+ m = re.match(r"(\d+(?:\.\d+)*)(/\d+)?", value)
+ if m is not None:
+ if hostIP is None:
+ try:
+ hostIP = socket.gethostbyname(hostonly)
+ hostIP = ip2num(hostIP)
+ except socket.error:
+ continue
+
+ base = ip2num(m.group(1))
+ mask = m.group(2)
+ if mask is None:
+ mask = 8 * (m.group(1).count('.') + 1)
+ else:
+ mask = int(mask[1:])
+ mask = 32 - mask
+
+ if (hostIP >> mask) == (base >> mask):
+ return True
+
+ elif fnmatch(host, value):
+ return True
+
+ return False
+
+
+if sys.platform == 'darwin':
+ from _scproxy import _get_proxy_settings, _get_proxies
+
+ def proxy_bypass_macosx_sysconf(host):
+ proxy_settings = _get_proxy_settings()
+ return _proxy_bypass_macosx_sysconf(host, proxy_settings)
+
+ def getproxies_macosx_sysconf():
+ """Return a dictionary of scheme -> proxy server URL mappings.
+
+ This function uses the MacOSX framework SystemConfiguration
+ to fetch the proxy information.
+ """
+ return _get_proxies()
+
+
+
+ def proxy_bypass(host):
+ if getproxies_environment():
+ return proxy_bypass_environment(host)
+ else:
+ return proxy_bypass_macosx_sysconf(host)
+
+ def getproxies():
+ return getproxies_environment() or getproxies_macosx_sysconf()
+
+
+elif os.name == 'nt':
+ def getproxies_registry():
+ """Return a dictionary of scheme -> proxy server URL mappings.
+
+ Win32 uses the registry to store proxies.
+
+ """
+ proxies = {}
+ try:
+ import winreg
+ except ImportError:
+ # Std module, so should be around - but you never know!
+ return proxies
+ try:
+ internetSettings = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
+ r'Software\Microsoft\Windows\CurrentVersion\Internet Settings')
+ proxyEnable = winreg.QueryValueEx(internetSettings,
+ 'ProxyEnable')[0]
+ if proxyEnable:
+ # Returned as Unicode but problems if not converted to ASCII
+ proxyServer = str(winreg.QueryValueEx(internetSettings,
+ 'ProxyServer')[0])
+ if '=' in proxyServer:
+ # Per-protocol settings
+ for p in proxyServer.split(';'):
+ protocol, address = p.split('=', 1)
+ # See if address has a type:// prefix
+ if not re.match('^([^/:]+)://', address):
+ address = '%s://%s' % (protocol, address)
+ proxies[protocol] = address
+ else:
+ # Use one setting for all protocols
+ if proxyServer[:5] == 'http:':
+ proxies['http'] = proxyServer
+ else:
+ proxies['http'] = 'http://%s' % proxyServer
+ proxies['https'] = 'https://%s' % proxyServer
+ proxies['ftp'] = 'ftp://%s' % proxyServer
+ internetSettings.Close()
+ except (WindowsError, ValueError, TypeError):
+ # Either registry key not found etc, or the value in an
+ # unexpected format.
+ # proxies already set up to be empty so nothing to do
+ pass
+ return proxies
+
+ def getproxies():
+ """Return a dictionary of scheme -> proxy server URL mappings.
+
+ Returns settings gathered from the environment, if specified,
+ or the registry.
+
+ """
+ return getproxies_environment() or getproxies_registry()
+
+ def proxy_bypass_registry(host):
+ try:
+ import winreg
+ except ImportError:
+ # Std modules, so should be around - but you never know!
+ return 0
+ try:
+ internetSettings = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
+ r'Software\Microsoft\Windows\CurrentVersion\Internet Settings')
+ proxyEnable = winreg.QueryValueEx(internetSettings,
+ 'ProxyEnable')[0]
+ proxyOverride = str(winreg.QueryValueEx(internetSettings,
+ 'ProxyOverride')[0])
+ # ^^^^ Returned as Unicode but problems if not converted to ASCII
+ except WindowsError:
+ return 0
+ if not proxyEnable or not proxyOverride:
+ return 0
+ # try to make a host list from name and IP address.
+ rawHost, port = splitport(host)
+ host = [rawHost]
+ try:
+ addr = socket.gethostbyname(rawHost)
+ if addr != rawHost:
+ host.append(addr)
+ except socket.error:
+ pass
+ try:
+ fqdn = socket.getfqdn(rawHost)
+ if fqdn != rawHost:
+ host.append(fqdn)
+ except socket.error:
+ pass
+ # make a check value list from the registry entry: replace the
+ # '' string by the localhost entry and the corresponding
+ # canonical entry.
+ proxyOverride = proxyOverride.split(';')
+ # now check if we match one of the registry values.
+ for test in proxyOverride:
+ if test == '':
+ if '.' not in rawHost:
+ return 1
+ test = test.replace(".", r"\.") # mask dots
+ test = test.replace("*", r".*") # change glob sequence
+ test = test.replace("?", r".") # change glob char
+ for val in host:
+ if re.match(test, val, re.I):
+ return 1
+ return 0
+
+ def proxy_bypass(host):
+ """Return a dictionary of scheme -> proxy server URL mappings.
+
+ Returns settings gathered from the environment, if specified,
+ or the registry.
+
+ """
+ if getproxies_environment():
+ return proxy_bypass_environment(host)
+ else:
+ return proxy_bypass_registry(host)
+
+else:
+ # By default use environment variables
+ getproxies = getproxies_environment
+ proxy_bypass = proxy_bypass_environment
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/urllib/response.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/urllib/response.py
new file mode 100644
index 0000000..adbf6e5
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/urllib/response.py
@@ -0,0 +1,103 @@
+"""Response classes used by urllib.
+
+The base class, addbase, defines a minimal file-like interface,
+including read() and readline(). The typical response object is an
+addinfourl instance, which defines an info() method that returns
+headers and a geturl() method that returns the url.
+"""
+from __future__ import absolute_import, division, unicode_literals
+from future.builtins import object
+
+class addbase(object):
+ """Base class for addinfo and addclosehook."""
+
+ # XXX Add a method to expose the timeout on the underlying socket?
+
+ def __init__(self, fp):
+ # TODO(jhylton): Is there a better way to delegate using io?
+ self.fp = fp
+ self.read = self.fp.read
+ self.readline = self.fp.readline
+ # TODO(jhylton): Make sure an object with readlines() is also iterable
+ if hasattr(self.fp, "readlines"):
+ self.readlines = self.fp.readlines
+ if hasattr(self.fp, "fileno"):
+ self.fileno = self.fp.fileno
+ else:
+ self.fileno = lambda: None
+
+ def __iter__(self):
+ # Assigning `__iter__` to the instance doesn't work as intended
+ # because the iter builtin does something like `cls.__iter__(obj)`
+ # and thus fails to find the _bound_ method `obj.__iter__`.
+ # Returning just `self.fp` works for built-in file objects but
+ # might not work for general file-like objects.
+ return iter(self.fp)
+
+ def __repr__(self):
+ return '<%s at %r whose fp = %r>' % (self.__class__.__name__,
+ id(self), self.fp)
+
+ def close(self):
+ if self.fp:
+ self.fp.close()
+ self.fp = None
+ self.read = None
+ self.readline = None
+ self.readlines = None
+ self.fileno = None
+ self.__iter__ = None
+ self.__next__ = None
+
+ def __enter__(self):
+ if self.fp is None:
+ raise ValueError("I/O operation on closed file")
+ return self
+
+ def __exit__(self, type, value, traceback):
+ self.close()
+
+class addclosehook(addbase):
+ """Class to add a close hook to an open file."""
+
+ def __init__(self, fp, closehook, *hookargs):
+ addbase.__init__(self, fp)
+ self.closehook = closehook
+ self.hookargs = hookargs
+
+ def close(self):
+ if self.closehook:
+ self.closehook(*self.hookargs)
+ self.closehook = None
+ self.hookargs = None
+ addbase.close(self)
+
+class addinfo(addbase):
+ """class to add an info() method to an open file."""
+
+ def __init__(self, fp, headers):
+ addbase.__init__(self, fp)
+ self.headers = headers
+
+ def info(self):
+ return self.headers
+
+class addinfourl(addbase):
+ """class to add info() and geturl() methods to an open file."""
+
+ def __init__(self, fp, headers, url, code=None):
+ addbase.__init__(self, fp)
+ self.headers = headers
+ self.url = url
+ self.code = code
+
+ def info(self):
+ return self.headers
+
+ def getcode(self):
+ return self.code
+
+ def geturl(self):
+ return self.url
+
+del absolute_import, division, unicode_literals, object
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/urllib/robotparser.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/urllib/robotparser.py
new file mode 100644
index 0000000..a0f3651
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/urllib/robotparser.py
@@ -0,0 +1,211 @@
+from __future__ import absolute_import, division, unicode_literals
+from future.builtins import str
+""" robotparser.py
+
+ Copyright (C) 2000 Bastian Kleineidam
+
+ You can choose between two licenses when using this package:
+ 1) GNU GPLv2
+ 2) PSF license for Python 2.2
+
+ The robots.txt Exclusion Protocol is implemented as specified in
+ http://info.webcrawler.com/mak/projects/robots/norobots-rfc.html
+"""
+
+# Was: import urllib.parse, urllib.request
+from future.backports import urllib
+from future.backports.urllib import parse as _parse, request as _request
+urllib.parse = _parse
+urllib.request = _request
+
+
+__all__ = ["RobotFileParser"]
+
+class RobotFileParser(object):
+ """ This class provides a set of methods to read, parse and answer
+ questions about a single robots.txt file.
+
+ """
+
+ def __init__(self, url=''):
+ self.entries = []
+ self.default_entry = None
+ self.disallow_all = False
+ self.allow_all = False
+ self.set_url(url)
+ self.last_checked = 0
+
+ def mtime(self):
+ """Returns the time the robots.txt file was last fetched.
+
+ This is useful for long-running web spiders that need to
+ check for new robots.txt files periodically.
+
+ """
+ return self.last_checked
+
+ def modified(self):
+ """Sets the time the robots.txt file was last fetched to the
+ current time.
+
+ """
+ import time
+ self.last_checked = time.time()
+
+ def set_url(self, url):
+ """Sets the URL referring to a robots.txt file."""
+ self.url = url
+ self.host, self.path = urllib.parse.urlparse(url)[1:3]
+
+ def read(self):
+ """Reads the robots.txt URL and feeds it to the parser."""
+ try:
+ f = urllib.request.urlopen(self.url)
+ except urllib.error.HTTPError as err:
+ if err.code in (401, 403):
+ self.disallow_all = True
+ elif err.code >= 400:
+ self.allow_all = True
+ else:
+ raw = f.read()
+ self.parse(raw.decode("utf-8").splitlines())
+
+ def _add_entry(self, entry):
+ if "*" in entry.useragents:
+ # the default entry is considered last
+ if self.default_entry is None:
+ # the first default entry wins
+ self.default_entry = entry
+ else:
+ self.entries.append(entry)
+
+ def parse(self, lines):
+ """Parse the input lines from a robots.txt file.
+
+ We allow that a user-agent: line is not preceded by
+ one or more blank lines.
+ """
+ # states:
+ # 0: start state
+ # 1: saw user-agent line
+ # 2: saw an allow or disallow line
+ state = 0
+ entry = Entry()
+
+ for line in lines:
+ if not line:
+ if state == 1:
+ entry = Entry()
+ state = 0
+ elif state == 2:
+ self._add_entry(entry)
+ entry = Entry()
+ state = 0
+ # remove optional comment and strip line
+ i = line.find('#')
+ if i >= 0:
+ line = line[:i]
+ line = line.strip()
+ if not line:
+ continue
+ line = line.split(':', 1)
+ if len(line) == 2:
+ line[0] = line[0].strip().lower()
+ line[1] = urllib.parse.unquote(line[1].strip())
+ if line[0] == "user-agent":
+ if state == 2:
+ self._add_entry(entry)
+ entry = Entry()
+ entry.useragents.append(line[1])
+ state = 1
+ elif line[0] == "disallow":
+ if state != 0:
+ entry.rulelines.append(RuleLine(line[1], False))
+ state = 2
+ elif line[0] == "allow":
+ if state != 0:
+ entry.rulelines.append(RuleLine(line[1], True))
+ state = 2
+ if state == 2:
+ self._add_entry(entry)
+
+
+ def can_fetch(self, useragent, url):
+ """using the parsed robots.txt decide if useragent can fetch url"""
+ if self.disallow_all:
+ return False
+ if self.allow_all:
+ return True
+ # search for given user agent matches
+ # the first match counts
+ parsed_url = urllib.parse.urlparse(urllib.parse.unquote(url))
+ url = urllib.parse.urlunparse(('','',parsed_url.path,
+ parsed_url.params,parsed_url.query, parsed_url.fragment))
+ url = urllib.parse.quote(url)
+ if not url:
+ url = "/"
+ for entry in self.entries:
+ if entry.applies_to(useragent):
+ return entry.allowance(url)
+ # try the default entry last
+ if self.default_entry:
+ return self.default_entry.allowance(url)
+ # agent not found ==> access granted
+ return True
+
+ def __str__(self):
+ return ''.join([str(entry) + "\n" for entry in self.entries])
+
+
+class RuleLine(object):
+ """A rule line is a single "Allow:" (allowance==True) or "Disallow:"
+ (allowance==False) followed by a path."""
+ def __init__(self, path, allowance):
+ if path == '' and not allowance:
+ # an empty value means allow all
+ allowance = True
+ self.path = urllib.parse.quote(path)
+ self.allowance = allowance
+
+ def applies_to(self, filename):
+ return self.path == "*" or filename.startswith(self.path)
+
+ def __str__(self):
+ return (self.allowance and "Allow" or "Disallow") + ": " + self.path
+
+
+class Entry(object):
+ """An entry has one or more user-agents and zero or more rulelines"""
+ def __init__(self):
+ self.useragents = []
+ self.rulelines = []
+
+ def __str__(self):
+ ret = []
+ for agent in self.useragents:
+ ret.extend(["User-agent: ", agent, "\n"])
+ for line in self.rulelines:
+ ret.extend([str(line), "\n"])
+ return ''.join(ret)
+
+ def applies_to(self, useragent):
+ """check if this entry applies to the specified agent"""
+ # split the name token and make it lower case
+ useragent = useragent.split("/")[0].lower()
+ for agent in self.useragents:
+ if agent == '*':
+ # we have the catch-all agent
+ return True
+ agent = agent.lower()
+ if agent in useragent:
+ return True
+ return False
+
+ def allowance(self, filename):
+ """Preconditions:
+ - our agent applies to this entry
+ - filename is URL decoded"""
+ for line in self.rulelines:
+ if line.applies_to(filename):
+ return line.allowance
+ return True
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/xmlrpc/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/xmlrpc/__init__.py
new file mode 100644
index 0000000..196d378
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/xmlrpc/__init__.py
@@ -0,0 +1 @@
+# This directory is a Python package.
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/xmlrpc/client.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/xmlrpc/client.py
new file mode 100644
index 0000000..b78e5ba
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/xmlrpc/client.py
@@ -0,0 +1,1496 @@
+#
+# XML-RPC CLIENT LIBRARY
+# $Id$
+#
+# an XML-RPC client interface for Python.
+#
+# the marshalling and response parser code can also be used to
+# implement XML-RPC servers.
+#
+# Notes:
+# this version is designed to work with Python 2.1 or newer.
+#
+# History:
+# 1999-01-14 fl Created
+# 1999-01-15 fl Changed dateTime to use localtime
+# 1999-01-16 fl Added Binary/base64 element, default to RPC2 service
+# 1999-01-19 fl Fixed array data element (from Skip Montanaro)
+# 1999-01-21 fl Fixed dateTime constructor, etc.
+# 1999-02-02 fl Added fault handling, handle empty sequences, etc.
+# 1999-02-10 fl Fixed problem with empty responses (from Skip Montanaro)
+# 1999-06-20 fl Speed improvements, pluggable parsers/transports (0.9.8)
+# 2000-11-28 fl Changed boolean to check the truth value of its argument
+# 2001-02-24 fl Added encoding/Unicode/SafeTransport patches
+# 2001-02-26 fl Added compare support to wrappers (0.9.9/1.0b1)
+# 2001-03-28 fl Make sure response tuple is a singleton
+# 2001-03-29 fl Don't require empty params element (from Nicholas Riley)
+# 2001-06-10 fl Folded in _xmlrpclib accelerator support (1.0b2)
+# 2001-08-20 fl Base xmlrpclib.Error on built-in Exception (from Paul Prescod)
+# 2001-09-03 fl Allow Transport subclass to override getparser
+# 2001-09-10 fl Lazy import of urllib, cgi, xmllib (20x import speedup)
+# 2001-10-01 fl Remove containers from memo cache when done with them
+# 2001-10-01 fl Use faster escape method (80% dumps speedup)
+# 2001-10-02 fl More dumps microtuning
+# 2001-10-04 fl Make sure import expat gets a parser (from Guido van Rossum)
+# 2001-10-10 sm Allow long ints to be passed as ints if they don't overflow
+# 2001-10-17 sm Test for int and long overflow (allows use on 64-bit systems)
+# 2001-11-12 fl Use repr() to marshal doubles (from Paul Felix)
+# 2002-03-17 fl Avoid buffered read when possible (from James Rucker)
+# 2002-04-07 fl Added pythondoc comments
+# 2002-04-16 fl Added __str__ methods to datetime/binary wrappers
+# 2002-05-15 fl Added error constants (from Andrew Kuchling)
+# 2002-06-27 fl Merged with Python CVS version
+# 2002-10-22 fl Added basic authentication (based on code from Phillip Eby)
+# 2003-01-22 sm Add support for the bool type
+# 2003-02-27 gvr Remove apply calls
+# 2003-04-24 sm Use cStringIO if available
+# 2003-04-25 ak Add support for nil
+# 2003-06-15 gn Add support for time.struct_time
+# 2003-07-12 gp Correct marshalling of Faults
+# 2003-10-31 mvl Add multicall support
+# 2004-08-20 mvl Bump minimum supported Python version to 2.1
+#
+# Copyright (c) 1999-2002 by Secret Labs AB.
+# Copyright (c) 1999-2002 by Fredrik Lundh.
+#
+# info@pythonware.com
+# http://www.pythonware.com
+#
+# --------------------------------------------------------------------
+# The XML-RPC client interface is
+#
+# Copyright (c) 1999-2002 by Secret Labs AB
+# Copyright (c) 1999-2002 by Fredrik Lundh
+#
+# By obtaining, using, and/or copying this software and/or its
+# associated documentation, you agree that you have read, understood,
+# and will comply with the following terms and conditions:
+#
+# Permission to use, copy, modify, and distribute this software and
+# its associated documentation for any purpose and without fee is
+# hereby granted, provided that the above copyright notice appears in
+# all copies, and that both that copyright notice and this permission
+# notice appear in supporting documentation, and that the name of
+# Secret Labs AB or the author not be used in advertising or publicity
+# pertaining to distribution of the software without specific, written
+# prior permission.
+#
+# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
+# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
+# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
+# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+# --------------------------------------------------------------------
+
+"""
+Ported using Python-Future from the Python 3.3 standard library.
+
+An XML-RPC client interface for Python.
+
+The marshalling and response parser code can also be used to
+implement XML-RPC servers.
+
+Exported exceptions:
+
+ Error Base class for client errors
+ ProtocolError Indicates an HTTP protocol error
+ ResponseError Indicates a broken response package
+ Fault Indicates an XML-RPC fault package
+
+Exported classes:
+
+ ServerProxy Represents a logical connection to an XML-RPC server
+
+ MultiCall Executor of boxcared xmlrpc requests
+ DateTime dateTime wrapper for an ISO 8601 string or time tuple or
+ localtime integer value to generate a "dateTime.iso8601"
+ XML-RPC value
+ Binary binary data wrapper
+
+ Marshaller Generate an XML-RPC params chunk from a Python data structure
+ Unmarshaller Unmarshal an XML-RPC response from incoming XML event message
+ Transport Handles an HTTP transaction to an XML-RPC server
+ SafeTransport Handles an HTTPS transaction to an XML-RPC server
+
+Exported constants:
+
+ (none)
+
+Exported functions:
+
+ getparser Create instance of the fastest available parser & attach
+ to an unmarshalling object
+ dumps Convert an argument tuple or a Fault instance to an XML-RPC
+ request (or response, if the methodresponse option is used).
+ loads Convert an XML-RPC packet to unmarshalled data plus a method
+ name (None if not present).
+"""
+
+from __future__ import (absolute_import, division, print_function,
+ unicode_literals)
+from future.builtins import bytes, dict, int, range, str
+
+import base64
+# Py2.7 compatibility hack
+base64.encodebytes = base64.encodestring
+base64.decodebytes = base64.decodestring
+import sys
+import time
+from datetime import datetime
+from future.backports.http import client as http_client
+from future.backports.urllib import parse as urllib_parse
+from future.utils import ensure_new_type
+from xml.parsers import expat
+import socket
+import errno
+from io import BytesIO
+try:
+ import gzip
+except ImportError:
+ gzip = None #python can be built without zlib/gzip support
+
+# --------------------------------------------------------------------
+# Internal stuff
+
+def escape(s):
+ s = s.replace("&", "&")
+ s = s.replace("<", "<")
+ return s.replace(">", ">",)
+
+# used in User-Agent header sent
+__version__ = sys.version[:3]
+
+# xmlrpc integer limits
+MAXINT = 2**31-1
+MININT = -2**31
+
+# --------------------------------------------------------------------
+# Error constants (from Dan Libby's specification at
+# http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php)
+
+# Ranges of errors
+PARSE_ERROR = -32700
+SERVER_ERROR = -32600
+APPLICATION_ERROR = -32500
+SYSTEM_ERROR = -32400
+TRANSPORT_ERROR = -32300
+
+# Specific errors
+NOT_WELLFORMED_ERROR = -32700
+UNSUPPORTED_ENCODING = -32701
+INVALID_ENCODING_CHAR = -32702
+INVALID_XMLRPC = -32600
+METHOD_NOT_FOUND = -32601
+INVALID_METHOD_PARAMS = -32602
+INTERNAL_ERROR = -32603
+
+# --------------------------------------------------------------------
+# Exceptions
+
+##
+# Base class for all kinds of client-side errors.
+
+class Error(Exception):
+ """Base class for client errors."""
+ def __str__(self):
+ return repr(self)
+
+##
+# Indicates an HTTP-level protocol error. This is raised by the HTTP
+# transport layer, if the server returns an error code other than 200
+# (OK).
+#
+# @param url The target URL.
+# @param errcode The HTTP error code.
+# @param errmsg The HTTP error message.
+# @param headers The HTTP header dictionary.
+
+class ProtocolError(Error):
+ """Indicates an HTTP protocol error."""
+ def __init__(self, url, errcode, errmsg, headers):
+ Error.__init__(self)
+ self.url = url
+ self.errcode = errcode
+ self.errmsg = errmsg
+ self.headers = headers
+ def __repr__(self):
+ return (
+ "" %
+ (self.url, self.errcode, self.errmsg)
+ )
+
+##
+# Indicates a broken XML-RPC response package. This exception is
+# raised by the unmarshalling layer, if the XML-RPC response is
+# malformed.
+
+class ResponseError(Error):
+ """Indicates a broken response package."""
+ pass
+
+##
+# Indicates an XML-RPC fault response package. This exception is
+# raised by the unmarshalling layer, if the XML-RPC response contains
+# a fault string. This exception can also be used as a class, to
+# generate a fault XML-RPC message.
+#
+# @param faultCode The XML-RPC fault code.
+# @param faultString The XML-RPC fault string.
+
+class Fault(Error):
+ """Indicates an XML-RPC fault package."""
+ def __init__(self, faultCode, faultString, **extra):
+ Error.__init__(self)
+ self.faultCode = faultCode
+ self.faultString = faultString
+ def __repr__(self):
+ return "" % (ensure_new_type(self.faultCode),
+ ensure_new_type(self.faultString))
+
+# --------------------------------------------------------------------
+# Special values
+
+##
+# Backwards compatibility
+
+boolean = Boolean = bool
+
+##
+# Wrapper for XML-RPC DateTime values. This converts a time value to
+# the format used by XML-RPC.
+#
+# The value can be given as a datetime object, as a string in the
+# format "yyyymmddThh:mm:ss", as a 9-item time tuple (as returned by
+# time.localtime()), or an integer value (as returned by time.time()).
+# The wrapper uses time.localtime() to convert an integer to a time
+# tuple.
+#
+# @param value The time, given as a datetime object, an ISO 8601 string,
+# a time tuple, or an integer time value.
+
+
+### For Python-Future:
+def _iso8601_format(value):
+ return "%04d%02d%02dT%02d:%02d:%02d" % (
+ value.year, value.month, value.day,
+ value.hour, value.minute, value.second)
+###
+# Issue #13305: different format codes across platforms
+# _day0 = datetime(1, 1, 1)
+# if _day0.strftime('%Y') == '0001': # Mac OS X
+# def _iso8601_format(value):
+# return value.strftime("%Y%m%dT%H:%M:%S")
+# elif _day0.strftime('%4Y') == '0001': # Linux
+# def _iso8601_format(value):
+# return value.strftime("%4Y%m%dT%H:%M:%S")
+# else:
+# def _iso8601_format(value):
+# return value.strftime("%Y%m%dT%H:%M:%S").zfill(17)
+# del _day0
+
+
+def _strftime(value):
+ if isinstance(value, datetime):
+ return _iso8601_format(value)
+
+ if not isinstance(value, (tuple, time.struct_time)):
+ if value == 0:
+ value = time.time()
+ value = time.localtime(value)
+
+ return "%04d%02d%02dT%02d:%02d:%02d" % value[:6]
+
+class DateTime(object):
+ """DateTime wrapper for an ISO 8601 string or time tuple or
+ localtime integer value to generate 'dateTime.iso8601' XML-RPC
+ value.
+ """
+
+ def __init__(self, value=0):
+ if isinstance(value, str):
+ self.value = value
+ else:
+ self.value = _strftime(value)
+
+ def make_comparable(self, other):
+ if isinstance(other, DateTime):
+ s = self.value
+ o = other.value
+ elif isinstance(other, datetime):
+ s = self.value
+ o = _iso8601_format(other)
+ elif isinstance(other, str):
+ s = self.value
+ o = other
+ elif hasattr(other, "timetuple"):
+ s = self.timetuple()
+ o = other.timetuple()
+ else:
+ otype = (hasattr(other, "__class__")
+ and other.__class__.__name__
+ or type(other))
+ raise TypeError("Can't compare %s and %s" %
+ (self.__class__.__name__, otype))
+ return s, o
+
+ def __lt__(self, other):
+ s, o = self.make_comparable(other)
+ return s < o
+
+ def __le__(self, other):
+ s, o = self.make_comparable(other)
+ return s <= o
+
+ def __gt__(self, other):
+ s, o = self.make_comparable(other)
+ return s > o
+
+ def __ge__(self, other):
+ s, o = self.make_comparable(other)
+ return s >= o
+
+ def __eq__(self, other):
+ s, o = self.make_comparable(other)
+ return s == o
+
+ def __ne__(self, other):
+ s, o = self.make_comparable(other)
+ return s != o
+
+ def timetuple(self):
+ return time.strptime(self.value, "%Y%m%dT%H:%M:%S")
+
+ ##
+ # Get date/time value.
+ #
+ # @return Date/time value, as an ISO 8601 string.
+
+ def __str__(self):
+ return self.value
+
+ def __repr__(self):
+ return "" % (ensure_new_type(self.value), id(self))
+
+ def decode(self, data):
+ self.value = str(data).strip()
+
+ def encode(self, out):
+ out.write("")
+ out.write(self.value)
+ out.write("\n")
+
+def _datetime(data):
+ # decode xml element contents into a DateTime structure.
+ value = DateTime()
+ value.decode(data)
+ return value
+
+def _datetime_type(data):
+ return datetime.strptime(data, "%Y%m%dT%H:%M:%S")
+
+##
+# Wrapper for binary data. This can be used to transport any kind
+# of binary data over XML-RPC, using BASE64 encoding.
+#
+# @param data An 8-bit string containing arbitrary data.
+
+class Binary(object):
+ """Wrapper for binary data."""
+
+ def __init__(self, data=None):
+ if data is None:
+ data = b""
+ else:
+ if not isinstance(data, (bytes, bytearray)):
+ raise TypeError("expected bytes or bytearray, not %s" %
+ data.__class__.__name__)
+ data = bytes(data) # Make a copy of the bytes!
+ self.data = data
+
+ ##
+ # Get buffer contents.
+ #
+ # @return Buffer contents, as an 8-bit string.
+
+ def __str__(self):
+ return str(self.data, "latin-1") # XXX encoding?!
+
+ def __eq__(self, other):
+ if isinstance(other, Binary):
+ other = other.data
+ return self.data == other
+
+ def __ne__(self, other):
+ if isinstance(other, Binary):
+ other = other.data
+ return self.data != other
+
+ def decode(self, data):
+ self.data = base64.decodebytes(data)
+
+ def encode(self, out):
+ out.write("\n")
+ encoded = base64.encodebytes(self.data)
+ out.write(encoded.decode('ascii'))
+ out.write("\n")
+
+def _binary(data):
+ # decode xml element contents into a Binary structure
+ value = Binary()
+ value.decode(data)
+ return value
+
+WRAPPERS = (DateTime, Binary)
+
+# --------------------------------------------------------------------
+# XML parsers
+
+class ExpatParser(object):
+ # fast expat parser for Python 2.0 and later.
+ def __init__(self, target):
+ self._parser = parser = expat.ParserCreate(None, None)
+ self._target = target
+ parser.StartElementHandler = target.start
+ parser.EndElementHandler = target.end
+ parser.CharacterDataHandler = target.data
+ encoding = None
+ target.xml(encoding, None)
+
+ def feed(self, data):
+ self._parser.Parse(data, 0)
+
+ def close(self):
+ self._parser.Parse("", 1) # end of data
+ del self._target, self._parser # get rid of circular references
+
+# --------------------------------------------------------------------
+# XML-RPC marshalling and unmarshalling code
+
+##
+# XML-RPC marshaller.
+#
+# @param encoding Default encoding for 8-bit strings. The default
+# value is None (interpreted as UTF-8).
+# @see dumps
+
+class Marshaller(object):
+ """Generate an XML-RPC params chunk from a Python data structure.
+
+ Create a Marshaller instance for each set of parameters, and use
+ the "dumps" method to convert your data (represented as a tuple)
+ to an XML-RPC params chunk. To write a fault response, pass a
+ Fault instance instead. You may prefer to use the "dumps" module
+ function for this purpose.
+ """
+
+ # by the way, if you don't understand what's going on in here,
+ # that's perfectly ok.
+
+ def __init__(self, encoding=None, allow_none=False):
+ self.memo = {}
+ self.data = None
+ self.encoding = encoding
+ self.allow_none = allow_none
+
+ dispatch = {}
+
+ def dumps(self, values):
+ out = []
+ write = out.append
+ dump = self.__dump
+ if isinstance(values, Fault):
+ # fault instance
+ write("\n")
+ dump({'faultCode': values.faultCode,
+ 'faultString': values.faultString},
+ write)
+ write("\n")
+ else:
+ # parameter block
+ # FIXME: the xml-rpc specification allows us to leave out
+ # the entire block if there are no parameters.
+ # however, changing this may break older code (including
+ # old versions of xmlrpclib.py), so this is better left as
+ # is for now. See @XMLRPC3 for more information. /F
+ write("\n")
+ for v in values:
+ write("\n")
+ dump(v, write)
+ write("\n")
+ write("\n")
+ result = "".join(out)
+ return str(result)
+
+ def __dump(self, value, write):
+ try:
+ f = self.dispatch[type(ensure_new_type(value))]
+ except KeyError:
+ # check if this object can be marshalled as a structure
+ if not hasattr(value, '__dict__'):
+ raise TypeError("cannot marshal %s objects" % type(value))
+ # check if this class is a sub-class of a basic type,
+ # because we don't know how to marshal these types
+ # (e.g. a string sub-class)
+ for type_ in type(value).__mro__:
+ if type_ in self.dispatch.keys():
+ raise TypeError("cannot marshal %s objects" % type(value))
+ # XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
+ # for the p3yk merge, this should probably be fixed more neatly.
+ f = self.dispatch["_arbitrary_instance"]
+ f(self, value, write)
+
+ def dump_nil (self, value, write):
+ if not self.allow_none:
+ raise TypeError("cannot marshal None unless allow_none is enabled")
+ write("")
+ dispatch[type(None)] = dump_nil
+
+ def dump_bool(self, value, write):
+ write("")
+ write(value and "1" or "0")
+ write("\n")
+ dispatch[bool] = dump_bool
+
+ def dump_long(self, value, write):
+ if value > MAXINT or value < MININT:
+ raise OverflowError("long int exceeds XML-RPC limits")
+ write("")
+ write(str(int(value)))
+ write("\n")
+ dispatch[int] = dump_long
+
+ # backward compatible
+ dump_int = dump_long
+
+ def dump_double(self, value, write):
+ write("")
+ write(repr(ensure_new_type(value)))
+ write("\n")
+ dispatch[float] = dump_double
+
+ def dump_unicode(self, value, write, escape=escape):
+ write("")
+ write(escape(value))
+ write("\n")
+ dispatch[str] = dump_unicode
+
+ def dump_bytes(self, value, write):
+ write("\n")
+ encoded = base64.encodebytes(value)
+ write(encoded.decode('ascii'))
+ write("\n")
+ dispatch[bytes] = dump_bytes
+ dispatch[bytearray] = dump_bytes
+
+ def dump_array(self, value, write):
+ i = id(value)
+ if i in self.memo:
+ raise TypeError("cannot marshal recursive sequences")
+ self.memo[i] = None
+ dump = self.__dump
+ write("\n")
+ for v in value:
+ dump(v, write)
+ write("\n")
+ del self.memo[i]
+ dispatch[tuple] = dump_array
+ dispatch[list] = dump_array
+
+ def dump_struct(self, value, write, escape=escape):
+ i = id(value)
+ if i in self.memo:
+ raise TypeError("cannot marshal recursive dictionaries")
+ self.memo[i] = None
+ dump = self.__dump
+ write("\n")
+ for k, v in value.items():
+ write("\n")
+ if not isinstance(k, str):
+ raise TypeError("dictionary key must be string")
+ write("%s\n" % escape(k))
+ dump(v, write)
+ write("\n")
+ write("\n")
+ del self.memo[i]
+ dispatch[dict] = dump_struct
+
+ def dump_datetime(self, value, write):
+ write("")
+ write(_strftime(value))
+ write("\n")
+ dispatch[datetime] = dump_datetime
+
+ def dump_instance(self, value, write):
+ # check for special wrappers
+ if value.__class__ in WRAPPERS:
+ self.write = write
+ value.encode(self)
+ del self.write
+ else:
+ # store instance attributes as a struct (really?)
+ self.dump_struct(value.__dict__, write)
+ dispatch[DateTime] = dump_instance
+ dispatch[Binary] = dump_instance
+ # XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
+ # for the p3yk merge, this should probably be fixed more neatly.
+ dispatch["_arbitrary_instance"] = dump_instance
+
+##
+# XML-RPC unmarshaller.
+#
+# @see loads
+
+class Unmarshaller(object):
+ """Unmarshal an XML-RPC response, based on incoming XML event
+ messages (start, data, end). Call close() to get the resulting
+ data structure.
+
+ Note that this reader is fairly tolerant, and gladly accepts bogus
+ XML-RPC data without complaining (but not bogus XML).
+ """
+
+ # and again, if you don't understand what's going on in here,
+ # that's perfectly ok.
+
+ def __init__(self, use_datetime=False, use_builtin_types=False):
+ self._type = None
+ self._stack = []
+ self._marks = []
+ self._data = []
+ self._methodname = None
+ self._encoding = "utf-8"
+ self.append = self._stack.append
+ self._use_datetime = use_builtin_types or use_datetime
+ self._use_bytes = use_builtin_types
+
+ def close(self):
+ # return response tuple and target method
+ if self._type is None or self._marks:
+ raise ResponseError()
+ if self._type == "fault":
+ raise Fault(**self._stack[0])
+ return tuple(self._stack)
+
+ def getmethodname(self):
+ return self._methodname
+
+ #
+ # event handlers
+
+ def xml(self, encoding, standalone):
+ self._encoding = encoding
+ # FIXME: assert standalone == 1 ???
+
+ def start(self, tag, attrs):
+ # prepare to handle this element
+ if tag == "array" or tag == "struct":
+ self._marks.append(len(self._stack))
+ self._data = []
+ self._value = (tag == "value")
+
+ def data(self, text):
+ self._data.append(text)
+
+ def end(self, tag):
+ # call the appropriate end tag handler
+ try:
+ f = self.dispatch[tag]
+ except KeyError:
+ pass # unknown tag ?
+ else:
+ return f(self, "".join(self._data))
+
+ #
+ # accelerator support
+
+ def end_dispatch(self, tag, data):
+ # dispatch data
+ try:
+ f = self.dispatch[tag]
+ except KeyError:
+ pass # unknown tag ?
+ else:
+ return f(self, data)
+
+ #
+ # element decoders
+
+ dispatch = {}
+
+ def end_nil (self, data):
+ self.append(None)
+ self._value = 0
+ dispatch["nil"] = end_nil
+
+ def end_boolean(self, data):
+ if data == "0":
+ self.append(False)
+ elif data == "1":
+ self.append(True)
+ else:
+ raise TypeError("bad boolean value")
+ self._value = 0
+ dispatch["boolean"] = end_boolean
+
+ def end_int(self, data):
+ self.append(int(data))
+ self._value = 0
+ dispatch["i4"] = end_int
+ dispatch["i8"] = end_int
+ dispatch["int"] = end_int
+
+ def end_double(self, data):
+ self.append(float(data))
+ self._value = 0
+ dispatch["double"] = end_double
+
+ def end_string(self, data):
+ if self._encoding:
+ data = data.decode(self._encoding)
+ self.append(data)
+ self._value = 0
+ dispatch["string"] = end_string
+ dispatch["name"] = end_string # struct keys are always strings
+
+ def end_array(self, data):
+ mark = self._marks.pop()
+ # map arrays to Python lists
+ self._stack[mark:] = [self._stack[mark:]]
+ self._value = 0
+ dispatch["array"] = end_array
+
+ def end_struct(self, data):
+ mark = self._marks.pop()
+ # map structs to Python dictionaries
+ dict = {}
+ items = self._stack[mark:]
+ for i in range(0, len(items), 2):
+ dict[items[i]] = items[i+1]
+ self._stack[mark:] = [dict]
+ self._value = 0
+ dispatch["struct"] = end_struct
+
+ def end_base64(self, data):
+ value = Binary()
+ value.decode(data.encode("ascii"))
+ if self._use_bytes:
+ value = value.data
+ self.append(value)
+ self._value = 0
+ dispatch["base64"] = end_base64
+
+ def end_dateTime(self, data):
+ value = DateTime()
+ value.decode(data)
+ if self._use_datetime:
+ value = _datetime_type(data)
+ self.append(value)
+ dispatch["dateTime.iso8601"] = end_dateTime
+
+ def end_value(self, data):
+ # if we stumble upon a value element with no internal
+ # elements, treat it as a string element
+ if self._value:
+ self.end_string(data)
+ dispatch["value"] = end_value
+
+ def end_params(self, data):
+ self._type = "params"
+ dispatch["params"] = end_params
+
+ def end_fault(self, data):
+ self._type = "fault"
+ dispatch["fault"] = end_fault
+
+ def end_methodName(self, data):
+ if self._encoding:
+ data = data.decode(self._encoding)
+ self._methodname = data
+ self._type = "methodName" # no params
+ dispatch["methodName"] = end_methodName
+
+## Multicall support
+#
+
+class _MultiCallMethod(object):
+ # some lesser magic to store calls made to a MultiCall object
+ # for batch execution
+ def __init__(self, call_list, name):
+ self.__call_list = call_list
+ self.__name = name
+ def __getattr__(self, name):
+ return _MultiCallMethod(self.__call_list, "%s.%s" % (self.__name, name))
+ def __call__(self, *args):
+ self.__call_list.append((self.__name, args))
+
+class MultiCallIterator(object):
+ """Iterates over the results of a multicall. Exceptions are
+ raised in response to xmlrpc faults."""
+
+ def __init__(self, results):
+ self.results = results
+
+ def __getitem__(self, i):
+ item = self.results[i]
+ if isinstance(type(item), dict):
+ raise Fault(item['faultCode'], item['faultString'])
+ elif type(item) == type([]):
+ return item[0]
+ else:
+ raise ValueError("unexpected type in multicall result")
+
+class MultiCall(object):
+ """server -> a object used to boxcar method calls
+
+ server should be a ServerProxy object.
+
+ Methods can be added to the MultiCall using normal
+ method call syntax e.g.:
+
+ multicall = MultiCall(server_proxy)
+ multicall.add(2,3)
+ multicall.get_address("Guido")
+
+ To execute the multicall, call the MultiCall object e.g.:
+
+ add_result, address = multicall()
+ """
+
+ def __init__(self, server):
+ self.__server = server
+ self.__call_list = []
+
+ def __repr__(self):
+ return "" % id(self)
+
+ __str__ = __repr__
+
+ def __getattr__(self, name):
+ return _MultiCallMethod(self.__call_list, name)
+
+ def __call__(self):
+ marshalled_list = []
+ for name, args in self.__call_list:
+ marshalled_list.append({'methodName' : name, 'params' : args})
+
+ return MultiCallIterator(self.__server.system.multicall(marshalled_list))
+
+# --------------------------------------------------------------------
+# convenience functions
+
+FastMarshaller = FastParser = FastUnmarshaller = None
+
+##
+# Create a parser object, and connect it to an unmarshalling instance.
+# This function picks the fastest available XML parser.
+#
+# return A (parser, unmarshaller) tuple.
+
+def getparser(use_datetime=False, use_builtin_types=False):
+ """getparser() -> parser, unmarshaller
+
+ Create an instance of the fastest available parser, and attach it
+ to an unmarshalling object. Return both objects.
+ """
+ if FastParser and FastUnmarshaller:
+ if use_builtin_types:
+ mkdatetime = _datetime_type
+ mkbytes = base64.decodebytes
+ elif use_datetime:
+ mkdatetime = _datetime_type
+ mkbytes = _binary
+ else:
+ mkdatetime = _datetime
+ mkbytes = _binary
+ target = FastUnmarshaller(True, False, mkbytes, mkdatetime, Fault)
+ parser = FastParser(target)
+ else:
+ target = Unmarshaller(use_datetime=use_datetime, use_builtin_types=use_builtin_types)
+ if FastParser:
+ parser = FastParser(target)
+ else:
+ parser = ExpatParser(target)
+ return parser, target
+
+##
+# Convert a Python tuple or a Fault instance to an XML-RPC packet.
+#
+# @def dumps(params, **options)
+# @param params A tuple or Fault instance.
+# @keyparam methodname If given, create a methodCall request for
+# this method name.
+# @keyparam methodresponse If given, create a methodResponse packet.
+# If used with a tuple, the tuple must be a singleton (that is,
+# it must contain exactly one element).
+# @keyparam encoding The packet encoding.
+# @return A string containing marshalled data.
+
+def dumps(params, methodname=None, methodresponse=None, encoding=None,
+ allow_none=False):
+ """data [,options] -> marshalled data
+
+ Convert an argument tuple or a Fault instance to an XML-RPC
+ request (or response, if the methodresponse option is used).
+
+ In addition to the data object, the following options can be given
+ as keyword arguments:
+
+ methodname: the method name for a methodCall packet
+
+ methodresponse: true to create a methodResponse packet.
+ If this option is used with a tuple, the tuple must be
+ a singleton (i.e. it can contain only one element).
+
+ encoding: the packet encoding (default is UTF-8)
+
+ All byte strings in the data structure are assumed to use the
+ packet encoding. Unicode strings are automatically converted,
+ where necessary.
+ """
+
+ assert isinstance(params, (tuple, Fault)), "argument must be tuple or Fault instance"
+ if isinstance(params, Fault):
+ methodresponse = 1
+ elif methodresponse and isinstance(params, tuple):
+ assert len(params) == 1, "response tuple must be a singleton"
+
+ if not encoding:
+ encoding = "utf-8"
+
+ if FastMarshaller:
+ m = FastMarshaller(encoding)
+ else:
+ m = Marshaller(encoding, allow_none)
+
+ data = m.dumps(params)
+
+ if encoding != "utf-8":
+ xmlheader = "\n" % str(encoding)
+ else:
+ xmlheader = "\n" # utf-8 is default
+
+ # standard XML-RPC wrappings
+ if methodname:
+ # a method call
+ if not isinstance(methodname, str):
+ methodname = methodname.encode(encoding)
+ data = (
+ xmlheader,
+ "\n"
+ "", methodname, "\n",
+ data,
+ "\n"
+ )
+ elif methodresponse:
+ # a method response, or a fault structure
+ data = (
+ xmlheader,
+ "\n",
+ data,
+ "\n"
+ )
+ else:
+ return data # return as is
+ return str("").join(data)
+
+##
+# Convert an XML-RPC packet to a Python object. If the XML-RPC packet
+# represents a fault condition, this function raises a Fault exception.
+#
+# @param data An XML-RPC packet, given as an 8-bit string.
+# @return A tuple containing the unpacked data, and the method name
+# (None if not present).
+# @see Fault
+
+def loads(data, use_datetime=False, use_builtin_types=False):
+ """data -> unmarshalled data, method name
+
+ Convert an XML-RPC packet to unmarshalled data plus a method
+ name (None if not present).
+
+ If the XML-RPC packet represents a fault condition, this function
+ raises a Fault exception.
+ """
+ p, u = getparser(use_datetime=use_datetime, use_builtin_types=use_builtin_types)
+ p.feed(data)
+ p.close()
+ return u.close(), u.getmethodname()
+
+##
+# Encode a string using the gzip content encoding such as specified by the
+# Content-Encoding: gzip
+# in the HTTP header, as described in RFC 1952
+#
+# @param data the unencoded data
+# @return the encoded data
+
+def gzip_encode(data):
+ """data -> gzip encoded data
+
+ Encode data using the gzip content encoding as described in RFC 1952
+ """
+ if not gzip:
+ raise NotImplementedError
+ f = BytesIO()
+ gzf = gzip.GzipFile(mode="wb", fileobj=f, compresslevel=1)
+ gzf.write(data)
+ gzf.close()
+ encoded = f.getvalue()
+ f.close()
+ return encoded
+
+##
+# Decode a string using the gzip content encoding such as specified by the
+# Content-Encoding: gzip
+# in the HTTP header, as described in RFC 1952
+#
+# @param data The encoded data
+# @return the unencoded data
+# @raises ValueError if data is not correctly coded.
+
+def gzip_decode(data):
+ """gzip encoded data -> unencoded data
+
+ Decode data using the gzip content encoding as described in RFC 1952
+ """
+ if not gzip:
+ raise NotImplementedError
+ f = BytesIO(data)
+ gzf = gzip.GzipFile(mode="rb", fileobj=f)
+ try:
+ decoded = gzf.read()
+ except IOError:
+ raise ValueError("invalid data")
+ f.close()
+ gzf.close()
+ return decoded
+
+##
+# Return a decoded file-like object for the gzip encoding
+# as described in RFC 1952.
+#
+# @param response A stream supporting a read() method
+# @return a file-like object that the decoded data can be read() from
+
+class GzipDecodedResponse(gzip.GzipFile if gzip else object):
+ """a file-like object to decode a response encoded with the gzip
+ method, as described in RFC 1952.
+ """
+ def __init__(self, response):
+ #response doesn't support tell() and read(), required by
+ #GzipFile
+ if not gzip:
+ raise NotImplementedError
+ self.io = BytesIO(response.read())
+ gzip.GzipFile.__init__(self, mode="rb", fileobj=self.io)
+
+ def close(self):
+ gzip.GzipFile.close(self)
+ self.io.close()
+
+
+# --------------------------------------------------------------------
+# request dispatcher
+
+class _Method(object):
+ # some magic to bind an XML-RPC method to an RPC server.
+ # supports "nested" methods (e.g. examples.getStateName)
+ def __init__(self, send, name):
+ self.__send = send
+ self.__name = name
+ def __getattr__(self, name):
+ return _Method(self.__send, "%s.%s" % (self.__name, name))
+ def __call__(self, *args):
+ return self.__send(self.__name, args)
+
+##
+# Standard transport class for XML-RPC over HTTP.
+#
+# You can create custom transports by subclassing this method, and
+# overriding selected methods.
+
+class Transport(object):
+ """Handles an HTTP transaction to an XML-RPC server."""
+
+ # client identifier (may be overridden)
+ user_agent = "Python-xmlrpc/%s" % __version__
+
+ #if true, we'll request gzip encoding
+ accept_gzip_encoding = True
+
+ # if positive, encode request using gzip if it exceeds this threshold
+ # note that many server will get confused, so only use it if you know
+ # that they can decode such a request
+ encode_threshold = None #None = don't encode
+
+ def __init__(self, use_datetime=False, use_builtin_types=False):
+ self._use_datetime = use_datetime
+ self._use_builtin_types = use_builtin_types
+ self._connection = (None, None)
+ self._extra_headers = []
+
+ ##
+ # Send a complete request, and parse the response.
+ # Retry request if a cached connection has disconnected.
+ #
+ # @param host Target host.
+ # @param handler Target PRC handler.
+ # @param request_body XML-RPC request body.
+ # @param verbose Debugging flag.
+ # @return Parsed response.
+
+ def request(self, host, handler, request_body, verbose=False):
+ #retry request once if cached connection has gone cold
+ for i in (0, 1):
+ try:
+ return self.single_request(host, handler, request_body, verbose)
+ except socket.error as e:
+ if i or e.errno not in (errno.ECONNRESET, errno.ECONNABORTED, errno.EPIPE):
+ raise
+ except http_client.BadStatusLine: #close after we sent request
+ if i:
+ raise
+
+ def single_request(self, host, handler, request_body, verbose=False):
+ # issue XML-RPC request
+ try:
+ http_conn = self.send_request(host, handler, request_body, verbose)
+ resp = http_conn.getresponse()
+ if resp.status == 200:
+ self.verbose = verbose
+ return self.parse_response(resp)
+
+ except Fault:
+ raise
+ except Exception:
+ #All unexpected errors leave connection in
+ # a strange state, so we clear it.
+ self.close()
+ raise
+
+ #We got an error response.
+ #Discard any response data and raise exception
+ if resp.getheader("content-length", ""):
+ resp.read()
+ raise ProtocolError(
+ host + handler,
+ resp.status, resp.reason,
+ dict(resp.getheaders())
+ )
+
+
+ ##
+ # Create parser.
+ #
+ # @return A 2-tuple containing a parser and a unmarshaller.
+
+ def getparser(self):
+ # get parser and unmarshaller
+ return getparser(use_datetime=self._use_datetime,
+ use_builtin_types=self._use_builtin_types)
+
+ ##
+ # Get authorization info from host parameter
+ # Host may be a string, or a (host, x509-dict) tuple; if a string,
+ # it is checked for a "user:pw@host" format, and a "Basic
+ # Authentication" header is added if appropriate.
+ #
+ # @param host Host descriptor (URL or (URL, x509 info) tuple).
+ # @return A 3-tuple containing (actual host, extra headers,
+ # x509 info). The header and x509 fields may be None.
+
+ def get_host_info(self, host):
+
+ x509 = {}
+ if isinstance(host, tuple):
+ host, x509 = host
+
+ auth, host = urllib_parse.splituser(host)
+
+ if auth:
+ auth = urllib_parse.unquote_to_bytes(auth)
+ auth = base64.encodebytes(auth).decode("utf-8")
+ auth = "".join(auth.split()) # get rid of whitespace
+ extra_headers = [
+ ("Authorization", "Basic " + auth)
+ ]
+ else:
+ extra_headers = []
+
+ return host, extra_headers, x509
+
+ ##
+ # Connect to server.
+ #
+ # @param host Target host.
+ # @return An HTTPConnection object
+
+ def make_connection(self, host):
+ #return an existing connection if possible. This allows
+ #HTTP/1.1 keep-alive.
+ if self._connection and host == self._connection[0]:
+ return self._connection[1]
+ # create a HTTP connection object from a host descriptor
+ chost, self._extra_headers, x509 = self.get_host_info(host)
+ self._connection = host, http_client.HTTPConnection(chost)
+ return self._connection[1]
+
+ ##
+ # Clear any cached connection object.
+ # Used in the event of socket errors.
+ #
+ def close(self):
+ if self._connection[1]:
+ self._connection[1].close()
+ self._connection = (None, None)
+
+ ##
+ # Send HTTP request.
+ #
+ # @param host Host descriptor (URL or (URL, x509 info) tuple).
+ # @param handler Targer RPC handler (a path relative to host)
+ # @param request_body The XML-RPC request body
+ # @param debug Enable debugging if debug is true.
+ # @return An HTTPConnection.
+
+ def send_request(self, host, handler, request_body, debug):
+ connection = self.make_connection(host)
+ headers = self._extra_headers[:]
+ if debug:
+ connection.set_debuglevel(1)
+ if self.accept_gzip_encoding and gzip:
+ connection.putrequest("POST", handler, skip_accept_encoding=True)
+ headers.append(("Accept-Encoding", "gzip"))
+ else:
+ connection.putrequest("POST", handler)
+ headers.append(("Content-Type", "text/xml"))
+ headers.append(("User-Agent", self.user_agent))
+ self.send_headers(connection, headers)
+ self.send_content(connection, request_body)
+ return connection
+
+ ##
+ # Send request headers.
+ # This function provides a useful hook for subclassing
+ #
+ # @param connection httpConnection.
+ # @param headers list of key,value pairs for HTTP headers
+
+ def send_headers(self, connection, headers):
+ for key, val in headers:
+ connection.putheader(key, val)
+
+ ##
+ # Send request body.
+ # This function provides a useful hook for subclassing
+ #
+ # @param connection httpConnection.
+ # @param request_body XML-RPC request body.
+
+ def send_content(self, connection, request_body):
+ #optionally encode the request
+ if (self.encode_threshold is not None and
+ self.encode_threshold < len(request_body) and
+ gzip):
+ connection.putheader("Content-Encoding", "gzip")
+ request_body = gzip_encode(request_body)
+
+ connection.putheader("Content-Length", str(len(request_body)))
+ connection.endheaders(request_body)
+
+ ##
+ # Parse response.
+ #
+ # @param file Stream.
+ # @return Response tuple and target method.
+
+ def parse_response(self, response):
+ # read response data from httpresponse, and parse it
+ # Check for new http response object, otherwise it is a file object.
+ if hasattr(response, 'getheader'):
+ if response.getheader("Content-Encoding", "") == "gzip":
+ stream = GzipDecodedResponse(response)
+ else:
+ stream = response
+ else:
+ stream = response
+
+ p, u = self.getparser()
+
+ while 1:
+ data = stream.read(1024)
+ if not data:
+ break
+ if self.verbose:
+ print("body:", repr(data))
+ p.feed(data)
+
+ if stream is not response:
+ stream.close()
+ p.close()
+
+ return u.close()
+
+##
+# Standard transport class for XML-RPC over HTTPS.
+
+class SafeTransport(Transport):
+ """Handles an HTTPS transaction to an XML-RPC server."""
+
+ # FIXME: mostly untested
+
+ def make_connection(self, host):
+ if self._connection and host == self._connection[0]:
+ return self._connection[1]
+
+ if not hasattr(http_client, "HTTPSConnection"):
+ raise NotImplementedError(
+ "your version of http.client doesn't support HTTPS")
+ # create a HTTPS connection object from a host descriptor
+ # host may be a string, or a (host, x509-dict) tuple
+ chost, self._extra_headers, x509 = self.get_host_info(host)
+ self._connection = host, http_client.HTTPSConnection(chost,
+ None, **(x509 or {}))
+ return self._connection[1]
+
+##
+# Standard server proxy. This class establishes a virtual connection
+# to an XML-RPC server.
+#
+# This class is available as ServerProxy and Server. New code should
+# use ServerProxy, to avoid confusion.
+#
+# @def ServerProxy(uri, **options)
+# @param uri The connection point on the server.
+# @keyparam transport A transport factory, compatible with the
+# standard transport class.
+# @keyparam encoding The default encoding used for 8-bit strings
+# (default is UTF-8).
+# @keyparam verbose Use a true value to enable debugging output.
+# (printed to standard output).
+# @see Transport
+
+class ServerProxy(object):
+ """uri [,options] -> a logical connection to an XML-RPC server
+
+ uri is the connection point on the server, given as
+ scheme://host/target.
+
+ The standard implementation always supports the "http" scheme. If
+ SSL socket support is available (Python 2.0), it also supports
+ "https".
+
+ If the target part and the slash preceding it are both omitted,
+ "/RPC2" is assumed.
+
+ The following options can be given as keyword arguments:
+
+ transport: a transport factory
+ encoding: the request encoding (default is UTF-8)
+
+ All 8-bit strings passed to the server proxy are assumed to use
+ the given encoding.
+ """
+
+ def __init__(self, uri, transport=None, encoding=None, verbose=False,
+ allow_none=False, use_datetime=False, use_builtin_types=False):
+ # establish a "logical" server connection
+
+ # get the url
+ type, uri = urllib_parse.splittype(uri)
+ if type not in ("http", "https"):
+ raise IOError("unsupported XML-RPC protocol")
+ self.__host, self.__handler = urllib_parse.splithost(uri)
+ if not self.__handler:
+ self.__handler = "/RPC2"
+
+ if transport is None:
+ if type == "https":
+ handler = SafeTransport
+ else:
+ handler = Transport
+ transport = handler(use_datetime=use_datetime,
+ use_builtin_types=use_builtin_types)
+ self.__transport = transport
+
+ self.__encoding = encoding or 'utf-8'
+ self.__verbose = verbose
+ self.__allow_none = allow_none
+
+ def __close(self):
+ self.__transport.close()
+
+ def __request(self, methodname, params):
+ # call a method on the remote server
+
+ request = dumps(params, methodname, encoding=self.__encoding,
+ allow_none=self.__allow_none).encode(self.__encoding)
+
+ response = self.__transport.request(
+ self.__host,
+ self.__handler,
+ request,
+ verbose=self.__verbose
+ )
+
+ if len(response) == 1:
+ response = response[0]
+
+ return response
+
+ def __repr__(self):
+ return (
+ "" %
+ (self.__host, self.__handler)
+ )
+
+ __str__ = __repr__
+
+ def __getattr__(self, name):
+ # magic method dispatcher
+ return _Method(self.__request, name)
+
+ # note: to call a remote object with an non-standard name, use
+ # result getattr(server, "strange-python-name")(args)
+
+ def __call__(self, attr):
+ """A workaround to get special attributes on the ServerProxy
+ without interfering with the magic __getattr__
+ """
+ if attr == "close":
+ return self.__close
+ elif attr == "transport":
+ return self.__transport
+ raise AttributeError("Attribute %r not found" % (attr,))
+
+# compatibility
+
+Server = ServerProxy
+
+# --------------------------------------------------------------------
+# test code
+
+if __name__ == "__main__":
+
+ # simple test program (from the XML-RPC specification)
+
+ # local server, available from Lib/xmlrpc/server.py
+ server = ServerProxy("http://localhost:8000")
+
+ try:
+ print(server.currentTime.getCurrentTime())
+ except Error as v:
+ print("ERROR", v)
+
+ multi = MultiCall(server)
+ multi.getData()
+ multi.pow(2,9)
+ multi.add(1,2)
+ try:
+ for response in multi():
+ print(response)
+ except Error as v:
+ print("ERROR", v)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/xmlrpc/server.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/xmlrpc/server.py
new file mode 100644
index 0000000..28072bf
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/backports/xmlrpc/server.py
@@ -0,0 +1,999 @@
+r"""
+Ported using Python-Future from the Python 3.3 standard library.
+
+XML-RPC Servers.
+
+This module can be used to create simple XML-RPC servers
+by creating a server and either installing functions, a
+class instance, or by extending the SimpleXMLRPCServer
+class.
+
+It can also be used to handle XML-RPC requests in a CGI
+environment using CGIXMLRPCRequestHandler.
+
+The Doc* classes can be used to create XML-RPC servers that
+serve pydoc-style documentation in response to HTTP
+GET requests. This documentation is dynamically generated
+based on the functions and methods registered with the
+server.
+
+A list of possible usage patterns follows:
+
+1. Install functions:
+
+server = SimpleXMLRPCServer(("localhost", 8000))
+server.register_function(pow)
+server.register_function(lambda x,y: x+y, 'add')
+server.serve_forever()
+
+2. Install an instance:
+
+class MyFuncs:
+ def __init__(self):
+ # make all of the sys functions available through sys.func_name
+ import sys
+ self.sys = sys
+ def _listMethods(self):
+ # implement this method so that system.listMethods
+ # knows to advertise the sys methods
+ return list_public_methods(self) + \
+ ['sys.' + method for method in list_public_methods(self.sys)]
+ def pow(self, x, y): return pow(x, y)
+ def add(self, x, y) : return x + y
+
+server = SimpleXMLRPCServer(("localhost", 8000))
+server.register_introspection_functions()
+server.register_instance(MyFuncs())
+server.serve_forever()
+
+3. Install an instance with custom dispatch method:
+
+class Math:
+ def _listMethods(self):
+ # this method must be present for system.listMethods
+ # to work
+ return ['add', 'pow']
+ def _methodHelp(self, method):
+ # this method must be present for system.methodHelp
+ # to work
+ if method == 'add':
+ return "add(2,3) => 5"
+ elif method == 'pow':
+ return "pow(x, y[, z]) => number"
+ else:
+ # By convention, return empty
+ # string if no help is available
+ return ""
+ def _dispatch(self, method, params):
+ if method == 'pow':
+ return pow(*params)
+ elif method == 'add':
+ return params[0] + params[1]
+ else:
+ raise ValueError('bad method')
+
+server = SimpleXMLRPCServer(("localhost", 8000))
+server.register_introspection_functions()
+server.register_instance(Math())
+server.serve_forever()
+
+4. Subclass SimpleXMLRPCServer:
+
+class MathServer(SimpleXMLRPCServer):
+ def _dispatch(self, method, params):
+ try:
+ # We are forcing the 'export_' prefix on methods that are
+ # callable through XML-RPC to prevent potential security
+ # problems
+ func = getattr(self, 'export_' + method)
+ except AttributeError:
+ raise Exception('method "%s" is not supported' % method)
+ else:
+ return func(*params)
+
+ def export_add(self, x, y):
+ return x + y
+
+server = MathServer(("localhost", 8000))
+server.serve_forever()
+
+5. CGI script:
+
+server = CGIXMLRPCRequestHandler()
+server.register_function(pow)
+server.handle_request()
+"""
+
+from __future__ import absolute_import, division, print_function, unicode_literals
+from future.builtins import int, str
+
+# Written by Brian Quinlan (brian@sweetapp.com).
+# Based on code written by Fredrik Lundh.
+
+from future.backports.xmlrpc.client import Fault, dumps, loads, gzip_encode, gzip_decode
+from future.backports.http.server import BaseHTTPRequestHandler
+import future.backports.http.server as http_server
+from future.backports import socketserver
+import sys
+import os
+import re
+import pydoc
+import inspect
+import traceback
+try:
+ import fcntl
+except ImportError:
+ fcntl = None
+
+def resolve_dotted_attribute(obj, attr, allow_dotted_names=True):
+ """resolve_dotted_attribute(a, 'b.c.d') => a.b.c.d
+
+ Resolves a dotted attribute name to an object. Raises
+ an AttributeError if any attribute in the chain starts with a '_'.
+
+ If the optional allow_dotted_names argument is false, dots are not
+ supported and this function operates similar to getattr(obj, attr).
+ """
+
+ if allow_dotted_names:
+ attrs = attr.split('.')
+ else:
+ attrs = [attr]
+
+ for i in attrs:
+ if i.startswith('_'):
+ raise AttributeError(
+ 'attempt to access private attribute "%s"' % i
+ )
+ else:
+ obj = getattr(obj,i)
+ return obj
+
+def list_public_methods(obj):
+ """Returns a list of attribute strings, found in the specified
+ object, which represent callable attributes"""
+
+ return [member for member in dir(obj)
+ if not member.startswith('_') and
+ callable(getattr(obj, member))]
+
+class SimpleXMLRPCDispatcher(object):
+ """Mix-in class that dispatches XML-RPC requests.
+
+ This class is used to register XML-RPC method handlers
+ and then to dispatch them. This class doesn't need to be
+ instanced directly when used by SimpleXMLRPCServer but it
+ can be instanced when used by the MultiPathXMLRPCServer
+ """
+
+ def __init__(self, allow_none=False, encoding=None,
+ use_builtin_types=False):
+ self.funcs = {}
+ self.instance = None
+ self.allow_none = allow_none
+ self.encoding = encoding or 'utf-8'
+ self.use_builtin_types = use_builtin_types
+
+ def register_instance(self, instance, allow_dotted_names=False):
+ """Registers an instance to respond to XML-RPC requests.
+
+ Only one instance can be installed at a time.
+
+ If the registered instance has a _dispatch method then that
+ method will be called with the name of the XML-RPC method and
+ its parameters as a tuple
+ e.g. instance._dispatch('add',(2,3))
+
+ If the registered instance does not have a _dispatch method
+ then the instance will be searched to find a matching method
+ and, if found, will be called. Methods beginning with an '_'
+ are considered private and will not be called by
+ SimpleXMLRPCServer.
+
+ If a registered function matches a XML-RPC request, then it
+ will be called instead of the registered instance.
+
+ If the optional allow_dotted_names argument is true and the
+ instance does not have a _dispatch method, method names
+ containing dots are supported and resolved, as long as none of
+ the name segments start with an '_'.
+
+ *** SECURITY WARNING: ***
+
+ Enabling the allow_dotted_names options allows intruders
+ to access your module's global variables and may allow
+ intruders to execute arbitrary code on your machine. Only
+ use this option on a secure, closed network.
+
+ """
+
+ self.instance = instance
+ self.allow_dotted_names = allow_dotted_names
+
+ def register_function(self, function, name=None):
+ """Registers a function to respond to XML-RPC requests.
+
+ The optional name argument can be used to set a Unicode name
+ for the function.
+ """
+
+ if name is None:
+ name = function.__name__
+ self.funcs[name] = function
+
+ def register_introspection_functions(self):
+ """Registers the XML-RPC introspection methods in the system
+ namespace.
+
+ see http://xmlrpc.usefulinc.com/doc/reserved.html
+ """
+
+ self.funcs.update({'system.listMethods' : self.system_listMethods,
+ 'system.methodSignature' : self.system_methodSignature,
+ 'system.methodHelp' : self.system_methodHelp})
+
+ def register_multicall_functions(self):
+ """Registers the XML-RPC multicall method in the system
+ namespace.
+
+ see http://www.xmlrpc.com/discuss/msgReader$1208"""
+
+ self.funcs.update({'system.multicall' : self.system_multicall})
+
+ def _marshaled_dispatch(self, data, dispatch_method = None, path = None):
+ """Dispatches an XML-RPC method from marshalled (XML) data.
+
+ XML-RPC methods are dispatched from the marshalled (XML) data
+ using the _dispatch method and the result is returned as
+ marshalled data. For backwards compatibility, a dispatch
+ function can be provided as an argument (see comment in
+ SimpleXMLRPCRequestHandler.do_POST) but overriding the
+ existing method through subclassing is the preferred means
+ of changing method dispatch behavior.
+ """
+
+ try:
+ params, method = loads(data, use_builtin_types=self.use_builtin_types)
+
+ # generate response
+ if dispatch_method is not None:
+ response = dispatch_method(method, params)
+ else:
+ response = self._dispatch(method, params)
+ # wrap response in a singleton tuple
+ response = (response,)
+ response = dumps(response, methodresponse=1,
+ allow_none=self.allow_none, encoding=self.encoding)
+ except Fault as fault:
+ response = dumps(fault, allow_none=self.allow_none,
+ encoding=self.encoding)
+ except:
+ # report exception back to server
+ exc_type, exc_value, exc_tb = sys.exc_info()
+ response = dumps(
+ Fault(1, "%s:%s" % (exc_type, exc_value)),
+ encoding=self.encoding, allow_none=self.allow_none,
+ )
+
+ return response.encode(self.encoding)
+
+ def system_listMethods(self):
+ """system.listMethods() => ['add', 'subtract', 'multiple']
+
+ Returns a list of the methods supported by the server."""
+
+ methods = set(self.funcs.keys())
+ if self.instance is not None:
+ # Instance can implement _listMethod to return a list of
+ # methods
+ if hasattr(self.instance, '_listMethods'):
+ methods |= set(self.instance._listMethods())
+ # if the instance has a _dispatch method then we
+ # don't have enough information to provide a list
+ # of methods
+ elif not hasattr(self.instance, '_dispatch'):
+ methods |= set(list_public_methods(self.instance))
+ return sorted(methods)
+
+ def system_methodSignature(self, method_name):
+ """system.methodSignature('add') => [double, int, int]
+
+ Returns a list describing the signature of the method. In the
+ above example, the add method takes two integers as arguments
+ and returns a double result.
+
+ This server does NOT support system.methodSignature."""
+
+ # See http://xmlrpc.usefulinc.com/doc/sysmethodsig.html
+
+ return 'signatures not supported'
+
+ def system_methodHelp(self, method_name):
+ """system.methodHelp('add') => "Adds two integers together"
+
+ Returns a string containing documentation for the specified method."""
+
+ method = None
+ if method_name in self.funcs:
+ method = self.funcs[method_name]
+ elif self.instance is not None:
+ # Instance can implement _methodHelp to return help for a method
+ if hasattr(self.instance, '_methodHelp'):
+ return self.instance._methodHelp(method_name)
+ # if the instance has a _dispatch method then we
+ # don't have enough information to provide help
+ elif not hasattr(self.instance, '_dispatch'):
+ try:
+ method = resolve_dotted_attribute(
+ self.instance,
+ method_name,
+ self.allow_dotted_names
+ )
+ except AttributeError:
+ pass
+
+ # Note that we aren't checking that the method actually
+ # be a callable object of some kind
+ if method is None:
+ return ""
+ else:
+ return pydoc.getdoc(method)
+
+ def system_multicall(self, call_list):
+ """system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => \
+[[4], ...]
+
+ Allows the caller to package multiple XML-RPC calls into a single
+ request.
+
+ See http://www.xmlrpc.com/discuss/msgReader$1208
+ """
+
+ results = []
+ for call in call_list:
+ method_name = call['methodName']
+ params = call['params']
+
+ try:
+ # XXX A marshalling error in any response will fail the entire
+ # multicall. If someone cares they should fix this.
+ results.append([self._dispatch(method_name, params)])
+ except Fault as fault:
+ results.append(
+ {'faultCode' : fault.faultCode,
+ 'faultString' : fault.faultString}
+ )
+ except:
+ exc_type, exc_value, exc_tb = sys.exc_info()
+ results.append(
+ {'faultCode' : 1,
+ 'faultString' : "%s:%s" % (exc_type, exc_value)}
+ )
+ return results
+
+ def _dispatch(self, method, params):
+ """Dispatches the XML-RPC method.
+
+ XML-RPC calls are forwarded to a registered function that
+ matches the called XML-RPC method name. If no such function
+ exists then the call is forwarded to the registered instance,
+ if available.
+
+ If the registered instance has a _dispatch method then that
+ method will be called with the name of the XML-RPC method and
+ its parameters as a tuple
+ e.g. instance._dispatch('add',(2,3))
+
+ If the registered instance does not have a _dispatch method
+ then the instance will be searched to find a matching method
+ and, if found, will be called.
+
+ Methods beginning with an '_' are considered private and will
+ not be called.
+ """
+
+ func = None
+ try:
+ # check to see if a matching function has been registered
+ func = self.funcs[method]
+ except KeyError:
+ if self.instance is not None:
+ # check for a _dispatch method
+ if hasattr(self.instance, '_dispatch'):
+ return self.instance._dispatch(method, params)
+ else:
+ # call instance method directly
+ try:
+ func = resolve_dotted_attribute(
+ self.instance,
+ method,
+ self.allow_dotted_names
+ )
+ except AttributeError:
+ pass
+
+ if func is not None:
+ return func(*params)
+ else:
+ raise Exception('method "%s" is not supported' % method)
+
+class SimpleXMLRPCRequestHandler(BaseHTTPRequestHandler):
+ """Simple XML-RPC request handler class.
+
+ Handles all HTTP POST requests and attempts to decode them as
+ XML-RPC requests.
+ """
+
+ # Class attribute listing the accessible path components;
+ # paths not on this list will result in a 404 error.
+ rpc_paths = ('/', '/RPC2')
+
+ #if not None, encode responses larger than this, if possible
+ encode_threshold = 1400 #a common MTU
+
+ #Override form StreamRequestHandler: full buffering of output
+ #and no Nagle.
+ wbufsize = -1
+ disable_nagle_algorithm = True
+
+ # a re to match a gzip Accept-Encoding
+ aepattern = re.compile(r"""
+ \s* ([^\s;]+) \s* #content-coding
+ (;\s* q \s*=\s* ([0-9\.]+))? #q
+ """, re.VERBOSE | re.IGNORECASE)
+
+ def accept_encodings(self):
+ r = {}
+ ae = self.headers.get("Accept-Encoding", "")
+ for e in ae.split(","):
+ match = self.aepattern.match(e)
+ if match:
+ v = match.group(3)
+ v = float(v) if v else 1.0
+ r[match.group(1)] = v
+ return r
+
+ def is_rpc_path_valid(self):
+ if self.rpc_paths:
+ return self.path in self.rpc_paths
+ else:
+ # If .rpc_paths is empty, just assume all paths are legal
+ return True
+
+ def do_POST(self):
+ """Handles the HTTP POST request.
+
+ Attempts to interpret all HTTP POST requests as XML-RPC calls,
+ which are forwarded to the server's _dispatch method for handling.
+ """
+
+ # Check that the path is legal
+ if not self.is_rpc_path_valid():
+ self.report_404()
+ return
+
+ try:
+ # Get arguments by reading body of request.
+ # We read this in chunks to avoid straining
+ # socket.read(); around the 10 or 15Mb mark, some platforms
+ # begin to have problems (bug #792570).
+ max_chunk_size = 10*1024*1024
+ size_remaining = int(self.headers["content-length"])
+ L = []
+ while size_remaining:
+ chunk_size = min(size_remaining, max_chunk_size)
+ chunk = self.rfile.read(chunk_size)
+ if not chunk:
+ break
+ L.append(chunk)
+ size_remaining -= len(L[-1])
+ data = b''.join(L)
+
+ data = self.decode_request_content(data)
+ if data is None:
+ return #response has been sent
+
+ # In previous versions of SimpleXMLRPCServer, _dispatch
+ # could be overridden in this class, instead of in
+ # SimpleXMLRPCDispatcher. To maintain backwards compatibility,
+ # check to see if a subclass implements _dispatch and dispatch
+ # using that method if present.
+ response = self.server._marshaled_dispatch(
+ data, getattr(self, '_dispatch', None), self.path
+ )
+ except Exception as e: # This should only happen if the module is buggy
+ # internal error, report as HTTP server error
+ self.send_response(500)
+
+ # Send information about the exception if requested
+ if hasattr(self.server, '_send_traceback_header') and \
+ self.server._send_traceback_header:
+ self.send_header("X-exception", str(e))
+ trace = traceback.format_exc()
+ trace = str(trace.encode('ASCII', 'backslashreplace'), 'ASCII')
+ self.send_header("X-traceback", trace)
+
+ self.send_header("Content-length", "0")
+ self.end_headers()
+ else:
+ self.send_response(200)
+ self.send_header("Content-type", "text/xml")
+ if self.encode_threshold is not None:
+ if len(response) > self.encode_threshold:
+ q = self.accept_encodings().get("gzip", 0)
+ if q:
+ try:
+ response = gzip_encode(response)
+ self.send_header("Content-Encoding", "gzip")
+ except NotImplementedError:
+ pass
+ self.send_header("Content-length", str(len(response)))
+ self.end_headers()
+ self.wfile.write(response)
+
+ def decode_request_content(self, data):
+ #support gzip encoding of request
+ encoding = self.headers.get("content-encoding", "identity").lower()
+ if encoding == "identity":
+ return data
+ if encoding == "gzip":
+ try:
+ return gzip_decode(data)
+ except NotImplementedError:
+ self.send_response(501, "encoding %r not supported" % encoding)
+ except ValueError:
+ self.send_response(400, "error decoding gzip content")
+ else:
+ self.send_response(501, "encoding %r not supported" % encoding)
+ self.send_header("Content-length", "0")
+ self.end_headers()
+
+ def report_404 (self):
+ # Report a 404 error
+ self.send_response(404)
+ response = b'No such page'
+ self.send_header("Content-type", "text/plain")
+ self.send_header("Content-length", str(len(response)))
+ self.end_headers()
+ self.wfile.write(response)
+
+ def log_request(self, code='-', size='-'):
+ """Selectively log an accepted request."""
+
+ if self.server.logRequests:
+ BaseHTTPRequestHandler.log_request(self, code, size)
+
+class SimpleXMLRPCServer(socketserver.TCPServer,
+ SimpleXMLRPCDispatcher):
+ """Simple XML-RPC server.
+
+ Simple XML-RPC server that allows functions and a single instance
+ to be installed to handle requests. The default implementation
+ attempts to dispatch XML-RPC calls to the functions or instance
+ installed in the server. Override the _dispatch method inherited
+ from SimpleXMLRPCDispatcher to change this behavior.
+ """
+
+ allow_reuse_address = True
+
+ # Warning: this is for debugging purposes only! Never set this to True in
+ # production code, as will be sending out sensitive information (exception
+ # and stack trace details) when exceptions are raised inside
+ # SimpleXMLRPCRequestHandler.do_POST
+ _send_traceback_header = False
+
+ def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler,
+ logRequests=True, allow_none=False, encoding=None,
+ bind_and_activate=True, use_builtin_types=False):
+ self.logRequests = logRequests
+
+ SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding, use_builtin_types)
+ socketserver.TCPServer.__init__(self, addr, requestHandler, bind_and_activate)
+
+ # [Bug #1222790] If possible, set close-on-exec flag; if a
+ # method spawns a subprocess, the subprocess shouldn't have
+ # the listening socket open.
+ if fcntl is not None and hasattr(fcntl, 'FD_CLOEXEC'):
+ flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD)
+ flags |= fcntl.FD_CLOEXEC
+ fcntl.fcntl(self.fileno(), fcntl.F_SETFD, flags)
+
+class MultiPathXMLRPCServer(SimpleXMLRPCServer):
+ """Multipath XML-RPC Server
+ This specialization of SimpleXMLRPCServer allows the user to create
+ multiple Dispatcher instances and assign them to different
+ HTTP request paths. This makes it possible to run two or more
+ 'virtual XML-RPC servers' at the same port.
+ Make sure that the requestHandler accepts the paths in question.
+ """
+ def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler,
+ logRequests=True, allow_none=False, encoding=None,
+ bind_and_activate=True, use_builtin_types=False):
+
+ SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests, allow_none,
+ encoding, bind_and_activate, use_builtin_types)
+ self.dispatchers = {}
+ self.allow_none = allow_none
+ self.encoding = encoding or 'utf-8'
+
+ def add_dispatcher(self, path, dispatcher):
+ self.dispatchers[path] = dispatcher
+ return dispatcher
+
+ def get_dispatcher(self, path):
+ return self.dispatchers[path]
+
+ def _marshaled_dispatch(self, data, dispatch_method = None, path = None):
+ try:
+ response = self.dispatchers[path]._marshaled_dispatch(
+ data, dispatch_method, path)
+ except:
+ # report low level exception back to server
+ # (each dispatcher should have handled their own
+ # exceptions)
+ exc_type, exc_value = sys.exc_info()[:2]
+ response = dumps(
+ Fault(1, "%s:%s" % (exc_type, exc_value)),
+ encoding=self.encoding, allow_none=self.allow_none)
+ response = response.encode(self.encoding)
+ return response
+
+class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher):
+ """Simple handler for XML-RPC data passed through CGI."""
+
+ def __init__(self, allow_none=False, encoding=None, use_builtin_types=False):
+ SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding, use_builtin_types)
+
+ def handle_xmlrpc(self, request_text):
+ """Handle a single XML-RPC request"""
+
+ response = self._marshaled_dispatch(request_text)
+
+ print('Content-Type: text/xml')
+ print('Content-Length: %d' % len(response))
+ print()
+ sys.stdout.flush()
+ sys.stdout.buffer.write(response)
+ sys.stdout.buffer.flush()
+
+ def handle_get(self):
+ """Handle a single HTTP GET request.
+
+ Default implementation indicates an error because
+ XML-RPC uses the POST method.
+ """
+
+ code = 400
+ message, explain = BaseHTTPRequestHandler.responses[code]
+
+ response = http_server.DEFAULT_ERROR_MESSAGE % \
+ {
+ 'code' : code,
+ 'message' : message,
+ 'explain' : explain
+ }
+ response = response.encode('utf-8')
+ print('Status: %d %s' % (code, message))
+ print('Content-Type: %s' % http_server.DEFAULT_ERROR_CONTENT_TYPE)
+ print('Content-Length: %d' % len(response))
+ print()
+ sys.stdout.flush()
+ sys.stdout.buffer.write(response)
+ sys.stdout.buffer.flush()
+
+ def handle_request(self, request_text=None):
+ """Handle a single XML-RPC request passed through a CGI post method.
+
+ If no XML data is given then it is read from stdin. The resulting
+ XML-RPC response is printed to stdout along with the correct HTTP
+ headers.
+ """
+
+ if request_text is None and \
+ os.environ.get('REQUEST_METHOD', None) == 'GET':
+ self.handle_get()
+ else:
+ # POST data is normally available through stdin
+ try:
+ length = int(os.environ.get('CONTENT_LENGTH', None))
+ except (ValueError, TypeError):
+ length = -1
+ if request_text is None:
+ request_text = sys.stdin.read(length)
+
+ self.handle_xmlrpc(request_text)
+
+
+# -----------------------------------------------------------------------------
+# Self documenting XML-RPC Server.
+
+class ServerHTMLDoc(pydoc.HTMLDoc):
+ """Class used to generate pydoc HTML document for a server"""
+
+ def markup(self, text, escape=None, funcs={}, classes={}, methods={}):
+ """Mark up some plain text, given a context of symbols to look for.
+ Each context dictionary maps object names to anchor names."""
+ escape = escape or self.escape
+ results = []
+ here = 0
+
+ # XXX Note that this regular expression does not allow for the
+ # hyperlinking of arbitrary strings being used as method
+ # names. Only methods with names consisting of word characters
+ # and '.'s are hyperlinked.
+ pattern = re.compile(r'\b((http|ftp)://\S+[\w/]|'
+ r'RFC[- ]?(\d+)|'
+ r'PEP[- ]?(\d+)|'
+ r'(self\.)?((?:\w|\.)+))\b')
+ while 1:
+ match = pattern.search(text, here)
+ if not match: break
+ start, end = match.span()
+ results.append(escape(text[here:start]))
+
+ all, scheme, rfc, pep, selfdot, name = match.groups()
+ if scheme:
+ url = escape(all).replace('"', '"')
+ results.append('%s' % (url, url))
+ elif rfc:
+ url = 'http://www.rfc-editor.org/rfc/rfc%d.txt' % int(rfc)
+ results.append('%s' % (url, escape(all)))
+ elif pep:
+ url = 'http://www.python.org/dev/peps/pep-%04d/' % int(pep)
+ results.append('%s' % (url, escape(all)))
+ elif text[end:end+1] == '(':
+ results.append(self.namelink(name, methods, funcs, classes))
+ elif selfdot:
+ results.append('self.%s' % name)
+ else:
+ results.append(self.namelink(name, classes))
+ here = end
+ results.append(escape(text[here:]))
+ return ''.join(results)
+
+ def docroutine(self, object, name, mod=None,
+ funcs={}, classes={}, methods={}, cl=None):
+ """Produce HTML documentation for a function or method object."""
+
+ anchor = (cl and cl.__name__ or '') + '-' + name
+ note = ''
+
+ title = '%s' % (
+ self.escape(anchor), self.escape(name))
+
+ if inspect.ismethod(object):
+ args = inspect.getfullargspec(object)
+ # exclude the argument bound to the instance, it will be
+ # confusing to the non-Python user
+ argspec = inspect.formatargspec (
+ args.args[1:],
+ args.varargs,
+ args.varkw,
+ args.defaults,
+ annotations=args.annotations,
+ formatvalue=self.formatvalue
+ )
+ elif inspect.isfunction(object):
+ args = inspect.getfullargspec(object)
+ argspec = inspect.formatargspec(
+ args.args, args.varargs, args.varkw, args.defaults,
+ annotations=args.annotations,
+ formatvalue=self.formatvalue)
+ else:
+ argspec = '(...)'
+
+ if isinstance(object, tuple):
+ argspec = object[0] or argspec
+ docstring = object[1] or ""
+ else:
+ docstring = pydoc.getdoc(object)
+
+ decl = title + argspec + (note and self.grey(
+ '%s' % note))
+
+ doc = self.markup(
+ docstring, self.preformat, funcs, classes, methods)
+ doc = doc and '
%s
' % doc
+ return '
%s
%s
\n' % (decl, doc)
+
+ def docserver(self, server_name, package_documentation, methods):
+ """Produce HTML documentation for an XML-RPC server."""
+
+ fdict = {}
+ for key, value in methods.items():
+ fdict[key] = '#-' + key
+ fdict[value] = fdict[key]
+
+ server_name = self.escape(server_name)
+ head = '%s' % server_name
+ result = self.heading(head, '#ffffff', '#7799ee')
+
+ doc = self.markup(package_documentation, self.preformat, fdict)
+ doc = doc and '%s' % doc
+ result = result + '
%s
\n' % doc
+
+ contents = []
+ method_items = sorted(methods.items())
+ for key, value in method_items:
+ contents.append(self.docroutine(value, key, funcs=fdict))
+ result = result + self.bigsection(
+ 'Methods', '#ffffff', '#eeaa77', ''.join(contents))
+
+ return result
+
+class XMLRPCDocGenerator(object):
+ """Generates documentation for an XML-RPC server.
+
+ This class is designed as mix-in and should not
+ be constructed directly.
+ """
+
+ def __init__(self):
+ # setup variables used for HTML documentation
+ self.server_name = 'XML-RPC Server Documentation'
+ self.server_documentation = \
+ "This server exports the following methods through the XML-RPC "\
+ "protocol."
+ self.server_title = 'XML-RPC Server Documentation'
+
+ def set_server_title(self, server_title):
+ """Set the HTML title of the generated server documentation"""
+
+ self.server_title = server_title
+
+ def set_server_name(self, server_name):
+ """Set the name of the generated HTML server documentation"""
+
+ self.server_name = server_name
+
+ def set_server_documentation(self, server_documentation):
+ """Set the documentation string for the entire server."""
+
+ self.server_documentation = server_documentation
+
+ def generate_html_documentation(self):
+ """generate_html_documentation() => html documentation for the server
+
+ Generates HTML documentation for the server using introspection for
+ installed functions and instances that do not implement the
+ _dispatch method. Alternatively, instances can choose to implement
+ the _get_method_argstring(method_name) method to provide the
+ argument string used in the documentation and the
+ _methodHelp(method_name) method to provide the help text used
+ in the documentation."""
+
+ methods = {}
+
+ for method_name in self.system_listMethods():
+ if method_name in self.funcs:
+ method = self.funcs[method_name]
+ elif self.instance is not None:
+ method_info = [None, None] # argspec, documentation
+ if hasattr(self.instance, '_get_method_argstring'):
+ method_info[0] = self.instance._get_method_argstring(method_name)
+ if hasattr(self.instance, '_methodHelp'):
+ method_info[1] = self.instance._methodHelp(method_name)
+
+ method_info = tuple(method_info)
+ if method_info != (None, None):
+ method = method_info
+ elif not hasattr(self.instance, '_dispatch'):
+ try:
+ method = resolve_dotted_attribute(
+ self.instance,
+ method_name
+ )
+ except AttributeError:
+ method = method_info
+ else:
+ method = method_info
+ else:
+ assert 0, "Could not find method in self.functions and no "\
+ "instance installed"
+
+ methods[method_name] = method
+
+ documenter = ServerHTMLDoc()
+ documentation = documenter.docserver(
+ self.server_name,
+ self.server_documentation,
+ methods
+ )
+
+ return documenter.page(self.server_title, documentation)
+
+class DocXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
+ """XML-RPC and documentation request handler class.
+
+ Handles all HTTP POST requests and attempts to decode them as
+ XML-RPC requests.
+
+ Handles all HTTP GET requests and interprets them as requests
+ for documentation.
+ """
+
+ def do_GET(self):
+ """Handles the HTTP GET request.
+
+ Interpret all HTTP GET requests as requests for server
+ documentation.
+ """
+ # Check that the path is legal
+ if not self.is_rpc_path_valid():
+ self.report_404()
+ return
+
+ response = self.server.generate_html_documentation().encode('utf-8')
+ self.send_response(200)
+ self.send_header("Content-type", "text/html")
+ self.send_header("Content-length", str(len(response)))
+ self.end_headers()
+ self.wfile.write(response)
+
+class DocXMLRPCServer( SimpleXMLRPCServer,
+ XMLRPCDocGenerator):
+ """XML-RPC and HTML documentation server.
+
+ Adds the ability to serve server documentation to the capabilities
+ of SimpleXMLRPCServer.
+ """
+
+ def __init__(self, addr, requestHandler=DocXMLRPCRequestHandler,
+ logRequests=True, allow_none=False, encoding=None,
+ bind_and_activate=True, use_builtin_types=False):
+ SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests,
+ allow_none, encoding, bind_and_activate,
+ use_builtin_types)
+ XMLRPCDocGenerator.__init__(self)
+
+class DocCGIXMLRPCRequestHandler( CGIXMLRPCRequestHandler,
+ XMLRPCDocGenerator):
+ """Handler for XML-RPC data and documentation requests passed through
+ CGI"""
+
+ def handle_get(self):
+ """Handles the HTTP GET request.
+
+ Interpret all HTTP GET requests as requests for server
+ documentation.
+ """
+
+ response = self.generate_html_documentation().encode('utf-8')
+
+ print('Content-Type: text/html')
+ print('Content-Length: %d' % len(response))
+ print()
+ sys.stdout.flush()
+ sys.stdout.buffer.write(response)
+ sys.stdout.buffer.flush()
+
+ def __init__(self):
+ CGIXMLRPCRequestHandler.__init__(self)
+ XMLRPCDocGenerator.__init__(self)
+
+
+if __name__ == '__main__':
+ import datetime
+
+ class ExampleService:
+ def getData(self):
+ return '42'
+
+ class currentTime:
+ @staticmethod
+ def getCurrentTime():
+ return datetime.datetime.now()
+
+ server = SimpleXMLRPCServer(("localhost", 8000))
+ server.register_function(pow)
+ server.register_function(lambda x,y: x+y, 'add')
+ server.register_instance(ExampleService(), allow_dotted_names=True)
+ server.register_multicall_functions()
+ print('Serving XML-RPC on localhost port 8000')
+ print('It is advisable to run this example server within a secure, closed network.')
+ try:
+ server.serve_forever()
+ except KeyboardInterrupt:
+ print("\nKeyboard interrupt received, exiting.")
+ server.server_close()
+ sys.exit(0)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/__init__.py
new file mode 100644
index 0000000..94011f9
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/__init__.py
@@ -0,0 +1,51 @@
+"""
+A module that brings in equivalents of the new and modified Python 3
+builtins into Py2. Has no effect on Py3.
+
+See the docs `here `_
+(``docs/what-else.rst``) for more information.
+
+"""
+
+from future.builtins.iterators import (filter, map, zip)
+# The isinstance import is no longer needed. We provide it only for
+# backward-compatibility with future v0.8.2. It will be removed in future v1.0.
+from future.builtins.misc import (ascii, chr, hex, input, isinstance, next,
+ oct, open, pow, round, super)
+from future.utils import PY3
+
+if PY3:
+ import builtins
+ bytes = builtins.bytes
+ dict = builtins.dict
+ int = builtins.int
+ list = builtins.list
+ object = builtins.object
+ range = builtins.range
+ str = builtins.str
+ __all__ = []
+else:
+ from future.types import (newbytes as bytes,
+ newdict as dict,
+ newint as int,
+ newlist as list,
+ newobject as object,
+ newrange as range,
+ newstr as str)
+from future import utils
+
+
+if not utils.PY3:
+ # We only import names that shadow the builtins on Py2. No other namespace
+ # pollution on Py2.
+
+ # Only shadow builtins on Py2; no new names
+ __all__ = ['filter', 'map', 'zip',
+ 'ascii', 'chr', 'hex', 'input', 'next', 'oct', 'open', 'pow',
+ 'round', 'super',
+ 'bytes', 'dict', 'int', 'list', 'object', 'range', 'str',
+ ]
+
+else:
+ # No namespace pollution on Py3
+ __all__ = []
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/disabled.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/disabled.py
new file mode 100644
index 0000000..f6d6ea9
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/disabled.py
@@ -0,0 +1,66 @@
+"""
+This disables builtin functions (and one exception class) which are
+removed from Python 3.3.
+
+This module is designed to be used like this::
+
+ from future.builtins.disabled import *
+
+This disables the following obsolete Py2 builtin functions::
+
+ apply, cmp, coerce, execfile, file, input, long,
+ raw_input, reduce, reload, unicode, xrange
+
+We don't hack __builtin__, which is very fragile because it contaminates
+imported modules too. Instead, we just create new functions with
+the same names as the obsolete builtins from Python 2 which raise
+NameError exceptions when called.
+
+Note that both ``input()`` and ``raw_input()`` are among the disabled
+functions (in this module). Although ``input()`` exists as a builtin in
+Python 3, the Python 2 ``input()`` builtin is unsafe to use because it
+can lead to shell injection. Therefore we shadow it by default upon ``from
+future.builtins.disabled import *``, in case someone forgets to import our
+replacement ``input()`` somehow and expects Python 3 semantics.
+
+See the ``future.builtins.misc`` module for a working version of
+``input`` with Python 3 semantics.
+
+(Note that callable() is not among the functions disabled; this was
+reintroduced into Python 3.2.)
+
+This exception class is also disabled:
+
+ StandardError
+
+"""
+
+from __future__ import division, absolute_import, print_function
+
+from future import utils
+
+
+OBSOLETE_BUILTINS = ['apply', 'chr', 'cmp', 'coerce', 'execfile', 'file',
+ 'input', 'long', 'raw_input', 'reduce', 'reload',
+ 'unicode', 'xrange', 'StandardError']
+
+
+def disabled_function(name):
+ '''
+ Returns a function that cannot be called
+ '''
+ def disabled(*args, **kwargs):
+ '''
+ A function disabled by the ``future`` module. This function is
+ no longer a builtin in Python 3.
+ '''
+ raise NameError('obsolete Python 2 builtin {0} is disabled'.format(name))
+ return disabled
+
+
+if not utils.PY3:
+ for fname in OBSOLETE_BUILTINS:
+ locals()[fname] = disabled_function(fname)
+ __all__ = OBSOLETE_BUILTINS
+else:
+ __all__ = []
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/iterators.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/iterators.py
new file mode 100644
index 0000000..b82f29f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/iterators.py
@@ -0,0 +1,53 @@
+"""
+This module is designed to be used as follows::
+
+ from future.builtins.iterators import *
+
+And then, for example::
+
+ for i in range(10**15):
+ pass
+
+ for (a, b) in zip(range(10**15), range(-10**15, 0)):
+ pass
+
+Note that this is standard Python 3 code, plus some imports that do
+nothing on Python 3.
+
+The iterators this brings in are::
+
+- ``range``
+- ``filter``
+- ``map``
+- ``zip``
+
+On Python 2, ``range`` is a pure-Python backport of Python 3's ``range``
+iterator with slicing support. The other iterators (``filter``, ``map``,
+``zip``) are from the ``itertools`` module on Python 2. On Python 3 these
+are available in the module namespace but not exported for * imports via
+__all__ (zero no namespace pollution).
+
+Note that these are also available in the standard library
+``future_builtins`` module on Python 2 -- but not Python 3, so using
+the standard library version is not portable, nor anywhere near complete.
+"""
+
+from __future__ import division, absolute_import, print_function
+
+import itertools
+from future import utils
+
+if not utils.PY3:
+ filter = itertools.ifilter
+ map = itertools.imap
+ from future.types import newrange as range
+ zip = itertools.izip
+ __all__ = ['filter', 'map', 'range', 'zip']
+else:
+ import builtins
+ filter = builtins.filter
+ map = builtins.map
+ range = builtins.range
+ zip = builtins.zip
+ __all__ = []
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/misc.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/misc.py
new file mode 100644
index 0000000..90dc384
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/misc.py
@@ -0,0 +1,124 @@
+"""
+A module that brings in equivalents of various modified Python 3 builtins
+into Py2. Has no effect on Py3.
+
+The builtin functions are:
+
+- ``ascii`` (from Py2's future_builtins module)
+- ``hex`` (from Py2's future_builtins module)
+- ``oct`` (from Py2's future_builtins module)
+- ``chr`` (equivalent to ``unichr`` on Py2)
+- ``input`` (equivalent to ``raw_input`` on Py2)
+- ``next`` (calls ``__next__`` if it exists, else ``next`` method)
+- ``open`` (equivalent to io.open on Py2)
+- ``super`` (backport of Py3's magic zero-argument super() function
+- ``round`` (new "Banker's Rounding" behaviour from Py3)
+
+``isinstance`` is also currently exported for backwards compatibility
+with v0.8.2, although this has been deprecated since v0.9.
+
+
+input()
+-------
+Like the new ``input()`` function from Python 3 (without eval()), except
+that it returns bytes. Equivalent to Python 2's ``raw_input()``.
+
+Warning: By default, importing this module *removes* the old Python 2
+input() function entirely from ``__builtin__`` for safety. This is
+because forgetting to import the new ``input`` from ``future`` might
+otherwise lead to a security vulnerability (shell injection) on Python 2.
+
+To restore it, you can retrieve it yourself from
+``__builtin__._old_input``.
+
+Fortunately, ``input()`` seems to be seldom used in the wild in Python
+2...
+
+"""
+
+from future import utils
+
+
+if utils.PY2:
+ from io import open
+ from future_builtins import ascii, oct, hex
+ from __builtin__ import unichr as chr, pow as _builtin_pow
+ import __builtin__
+
+ # Only for backward compatibility with future v0.8.2:
+ isinstance = __builtin__.isinstance
+
+ # Warning: Python 2's input() is unsafe and MUST not be able to be used
+ # accidentally by someone who expects Python 3 semantics but forgets
+ # to import it on Python 2. Versions of ``future`` prior to 0.11
+ # deleted it from __builtin__. Now we keep in __builtin__ but shadow
+ # the name like all others. Just be sure to import ``input``.
+
+ input = raw_input
+
+ from future.builtins.newnext import newnext as next
+ from future.builtins.newround import newround as round
+ from future.builtins.newsuper import newsuper as super
+ from future.types.newint import newint
+
+ _SENTINEL = object()
+
+ def pow(x, y, z=_SENTINEL):
+ """
+ pow(x, y[, z]) -> number
+
+ With two arguments, equivalent to x**y. With three arguments,
+ equivalent to (x**y) % z, but may be more efficient (e.g. for ints).
+ """
+ # Handle newints
+ if isinstance(x, newint):
+ x = long(x)
+ if isinstance(y, newint):
+ y = long(y)
+ if isinstance(z, newint):
+ z = long(z)
+
+ try:
+ if z == _SENTINEL:
+ return _builtin_pow(x, y)
+ else:
+ return _builtin_pow(x, y, z)
+ except ValueError:
+ if z == _SENTINEL:
+ return _builtin_pow(x+0j, y)
+ else:
+ return _builtin_pow(x+0j, y, z)
+
+ # ``future`` doesn't support Py3.0/3.1. If we ever did, we'd add this:
+ # callable = __builtin__.callable
+
+ __all__ = ['ascii', 'chr', 'hex', 'input', 'isinstance', 'next', 'oct',
+ 'open', 'pow', 'round', 'super']
+
+else:
+ import builtins
+ ascii = builtins.ascii
+ chr = builtins.chr
+ hex = builtins.hex
+ input = builtins.input
+ next = builtins.next
+ # Only for backward compatibility with future v0.8.2:
+ isinstance = builtins.isinstance
+ oct = builtins.oct
+ open = builtins.open
+ pow = builtins.pow
+ round = builtins.round
+ super = builtins.super
+
+ __all__ = []
+
+ # The callable() function was removed from Py3.0 and 3.1 and
+ # reintroduced into Py3.2+. ``future`` doesn't support Py3.0/3.1. If we ever
+ # did, we'd add this:
+ # try:
+ # callable = builtins.callable
+ # except AttributeError:
+ # # Definition from Pandas
+ # def callable(obj):
+ # return any("__call__" in klass.__dict__ for klass in type(obj).__mro__)
+ # __all__.append('callable')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/newnext.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/newnext.py
new file mode 100644
index 0000000..9364023
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/newnext.py
@@ -0,0 +1,71 @@
+'''
+This module provides a newnext() function in Python 2 that mimics the
+behaviour of ``next()`` in Python 3, falling back to Python 2's behaviour for
+compatibility if this fails.
+
+``newnext(iterator)`` calls the iterator's ``__next__()`` method if it exists. If this
+doesn't exist, it falls back to calling a ``next()`` method.
+
+For example:
+
+ >>> class Odds(object):
+ ... def __init__(self, start=1):
+ ... self.value = start - 2
+ ... def __next__(self): # note the Py3 interface
+ ... self.value += 2
+ ... return self.value
+ ... def __iter__(self):
+ ... return self
+ ...
+ >>> iterator = Odds()
+ >>> next(iterator)
+ 1
+ >>> next(iterator)
+ 3
+
+If you are defining your own custom iterator class as above, it is preferable
+to explicitly decorate the class with the @implements_iterator decorator from
+``future.utils`` as follows:
+
+ >>> @implements_iterator
+ ... class Odds(object):
+ ... # etc
+ ... pass
+
+This next() function is primarily for consuming iterators defined in Python 3
+code elsewhere that we would like to run on Python 2 or 3.
+'''
+
+_builtin_next = next
+
+_SENTINEL = object()
+
+def newnext(iterator, default=_SENTINEL):
+ """
+ next(iterator[, default])
+
+ Return the next item from the iterator. If default is given and the iterator
+ is exhausted, it is returned instead of raising StopIteration.
+ """
+
+ # args = []
+ # if default is not _SENTINEL:
+ # args.append(default)
+ try:
+ try:
+ return iterator.__next__()
+ except AttributeError:
+ try:
+ return iterator.next()
+ except AttributeError:
+ raise TypeError("'{0}' object is not an iterator".format(
+ iterator.__class__.__name__))
+ except StopIteration as e:
+ if default is _SENTINEL:
+ raise e
+ else:
+ return default
+
+
+__all__ = ['newnext']
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/newround.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/newround.py
new file mode 100644
index 0000000..f59b35b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/newround.py
@@ -0,0 +1,99 @@
+"""
+``python-future``: pure Python implementation of Python 3 round().
+"""
+
+from future.utils import PYPY, PY26, bind_method
+
+# Use the decimal module for simplicity of implementation (and
+# hopefully correctness).
+from decimal import Decimal, ROUND_HALF_EVEN
+
+
+def newround(number, ndigits=None):
+ """
+ See Python 3 documentation: uses Banker's Rounding.
+
+ Delegates to the __round__ method if for some reason this exists.
+
+ If not, rounds a number to a given precision in decimal digits (default
+ 0 digits). This returns an int when called with one argument,
+ otherwise the same type as the number. ndigits may be negative.
+
+ See the test_round method in future/tests/test_builtins.py for
+ examples.
+ """
+ return_int = False
+ if ndigits is None:
+ return_int = True
+ ndigits = 0
+ if hasattr(number, '__round__'):
+ return number.__round__(ndigits)
+
+ if ndigits < 0:
+ raise NotImplementedError('negative ndigits not supported yet')
+ exponent = Decimal('10') ** (-ndigits)
+
+ if PYPY:
+ # Work around issue #24: round() breaks on PyPy with NumPy's types
+ if 'numpy' in repr(type(number)):
+ number = float(number)
+
+ if not PY26:
+ d = Decimal.from_float(number).quantize(exponent,
+ rounding=ROUND_HALF_EVEN)
+ else:
+ d = from_float_26(number).quantize(exponent, rounding=ROUND_HALF_EVEN)
+
+ if return_int:
+ return int(d)
+ else:
+ return float(d)
+
+
+### From Python 2.7's decimal.py. Only needed to support Py2.6:
+
+def from_float_26(f):
+ """Converts a float to a decimal number, exactly.
+
+ Note that Decimal.from_float(0.1) is not the same as Decimal('0.1').
+ Since 0.1 is not exactly representable in binary floating point, the
+ value is stored as the nearest representable value which is
+ 0x1.999999999999ap-4. The exact equivalent of the value in decimal
+ is 0.1000000000000000055511151231257827021181583404541015625.
+
+ >>> Decimal.from_float(0.1)
+ Decimal('0.1000000000000000055511151231257827021181583404541015625')
+ >>> Decimal.from_float(float('nan'))
+ Decimal('NaN')
+ >>> Decimal.from_float(float('inf'))
+ Decimal('Infinity')
+ >>> Decimal.from_float(-float('inf'))
+ Decimal('-Infinity')
+ >>> Decimal.from_float(-0.0)
+ Decimal('-0')
+
+ """
+ import math as _math
+ from decimal import _dec_from_triple # only available on Py2.6 and Py2.7 (not 3.3)
+
+ if isinstance(f, (int, long)): # handle integer inputs
+ return Decimal(f)
+ if _math.isinf(f) or _math.isnan(f): # raises TypeError if not a float
+ return Decimal(repr(f))
+ if _math.copysign(1.0, f) == 1.0:
+ sign = 0
+ else:
+ sign = 1
+ n, d = abs(f).as_integer_ratio()
+ # int.bit_length() method doesn't exist on Py2.6:
+ def bit_length(d):
+ if d != 0:
+ return len(bin(abs(d))) - 2
+ else:
+ return 0
+ k = bit_length(d) - 1
+ result = _dec_from_triple(sign, str(n*5**k), -k)
+ return result
+
+
+__all__ = ['newround']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/newsuper.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/newsuper.py
new file mode 100644
index 0000000..5190a2a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/builtins/newsuper.py
@@ -0,0 +1,115 @@
+'''
+This module provides a newsuper() function in Python 2 that mimics the
+behaviour of super() in Python 3. It is designed to be used as follows:
+
+ from __future__ import division, absolute_import, print_function
+ from future.builtins import super
+
+And then, for example:
+
+ class VerboseList(list):
+ def append(self, item):
+ print('Adding an item')
+ super().append(item) # new simpler super() function
+
+Importing this module on Python 3 has no effect.
+
+This is based on (i.e. almost identical to) Ryan Kelly's magicsuper
+module here:
+
+ https://github.com/rfk/magicsuper.git
+
+Excerpts from Ryan's docstring:
+
+ "Of course, you can still explicitly pass in the arguments if you want
+ to do something strange. Sometimes you really do want that, e.g. to
+ skip over some classes in the method resolution order.
+
+ "How does it work? By inspecting the calling frame to determine the
+ function object being executed and the object on which it's being
+ called, and then walking the object's __mro__ chain to find out where
+ that function was defined. Yuck, but it seems to work..."
+'''
+
+from __future__ import absolute_import
+import sys
+from types import FunctionType
+
+from future.utils import PY3, PY26
+
+
+_builtin_super = super
+
+_SENTINEL = object()
+
+def newsuper(typ=_SENTINEL, type_or_obj=_SENTINEL, framedepth=1):
+ '''Like builtin super(), but capable of magic.
+
+ This acts just like the builtin super() function, but if called
+ without any arguments it attempts to infer them at runtime.
+ '''
+ # Infer the correct call if used without arguments.
+ if typ is _SENTINEL:
+ # We'll need to do some frame hacking.
+ f = sys._getframe(framedepth)
+
+ try:
+ # Get the function's first positional argument.
+ type_or_obj = f.f_locals[f.f_code.co_varnames[0]]
+ except (IndexError, KeyError,):
+ raise RuntimeError('super() used in a function with no args')
+
+ try:
+ # Get the MRO so we can crawl it.
+ mro = type_or_obj.__mro__
+ except AttributeError:
+ try:
+ mro = type_or_obj.__class__.__mro__
+ except AttributeError:
+ raise RuntimeError('super() used with a non-newstyle class')
+
+ # A ``for...else`` block? Yes! It's odd, but useful.
+ # If unfamiliar with for...else, see:
+ #
+ # http://psung.blogspot.com/2007/12/for-else-in-python.html
+ for typ in mro:
+ # Find the class that owns the currently-executing method.
+ for meth in typ.__dict__.values():
+ # Drill down through any wrappers to the underlying func.
+ # This handles e.g. classmethod() and staticmethod().
+ try:
+ while not isinstance(meth,FunctionType):
+ if isinstance(meth, property):
+ # Calling __get__ on the property will invoke
+ # user code which might throw exceptions or have
+ # side effects
+ meth = meth.fget
+ else:
+ try:
+ meth = meth.__func__
+ except AttributeError:
+ meth = meth.__get__(type_or_obj)
+ except (AttributeError, TypeError):
+ continue
+ if meth.func_code is f.f_code:
+ break # Aha! Found you.
+ else:
+ continue # Not found! Move onto the next class in MRO.
+ break # Found! Break out of the search loop.
+ else:
+ raise RuntimeError('super() called outside a method')
+
+ # Dispatch to builtin super().
+ if type_or_obj is not _SENTINEL:
+ return _builtin_super(typ, type_or_obj)
+ return _builtin_super(typ)
+
+
+def superm(*args, **kwds):
+ f = sys._getframe(1)
+ nm = f.f_code.co_name
+ return getattr(newsuper(framedepth=2),nm)(*args, **kwds)
+
+
+__all__ = ['newsuper']
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/__init__.py
new file mode 100644
index 0000000..040fdcf
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/__init__.py
@@ -0,0 +1,8 @@
+# future.moves package
+from __future__ import absolute_import
+import sys
+__future_module__ = True
+from future.standard_library import import_top_level_modules
+
+if sys.version_info[0] == 3:
+ import_top_level_modules()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/_dummy_thread.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/_dummy_thread.py
new file mode 100644
index 0000000..688d249
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/_dummy_thread.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from _dummy_thread import *
+else:
+ __future_module__ = True
+ from dummy_thread import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/_markupbase.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/_markupbase.py
new file mode 100644
index 0000000..f9fb4bb
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/_markupbase.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from _markupbase import *
+else:
+ __future_module__ = True
+ from markupbase import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/_thread.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/_thread.py
new file mode 100644
index 0000000..c68018b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/_thread.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from _thread import *
+else:
+ __future_module__ = True
+ from thread import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/builtins.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/builtins.py
new file mode 100644
index 0000000..e4b6221
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/builtins.py
@@ -0,0 +1,10 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from builtins import *
+else:
+ __future_module__ = True
+ from __builtin__ import *
+ # Overwrite any old definitions with the equivalent future.builtins ones:
+ from future.builtins import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/collections.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/collections.py
new file mode 100644
index 0000000..f4dfb5a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/collections.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+from future.utils import PY2, PY26
+__future_module__ = True
+
+from collections import *
+
+if PY2:
+ from UserDict import UserDict
+ from UserList import UserList
+ from UserString import UserString
+
+if PY26:
+ from future.backports.misc import OrderedDict, Counter
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/configparser.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/configparser.py
new file mode 100644
index 0000000..33d9cf9
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/configparser.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+
+from future.utils import PY2
+
+if PY2:
+ from ConfigParser import *
+else:
+ from configparser import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/copyreg.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/copyreg.py
new file mode 100644
index 0000000..21c7a42
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/copyreg.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from copyreg import *
+else:
+ __future_module__ = True
+ from copy_reg import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/dbm/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/dbm/__init__.py
new file mode 100644
index 0000000..626b406
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/dbm/__init__.py
@@ -0,0 +1,20 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from dbm import *
+else:
+ __future_module__ = True
+ from whichdb import *
+ from anydbm import *
+
+# Py3.3's dbm/__init__.py imports ndbm but doesn't expose it via __all__.
+# In case some (badly written) code depends on dbm.ndbm after import dbm,
+# we simulate this:
+if PY3:
+ from dbm import ndbm
+else:
+ try:
+ from future.moves.dbm import ndbm
+ except ImportError:
+ ndbm = None
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/dbm/dumb.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/dbm/dumb.py
new file mode 100644
index 0000000..528383f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/dbm/dumb.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from dbm.dumb import *
+else:
+ __future_module__ = True
+ from dumbdbm import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/dbm/gnu.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/dbm/gnu.py
new file mode 100644
index 0000000..68ccf67
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/dbm/gnu.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from dbm.gnu import *
+else:
+ __future_module__ = True
+ from gdbm import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/dbm/ndbm.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/dbm/ndbm.py
new file mode 100644
index 0000000..8c6fff8
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/dbm/ndbm.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from dbm.ndbm import *
+else:
+ __future_module__ = True
+ from dbm import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/html/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/html/__init__.py
new file mode 100644
index 0000000..22ed6e7
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/html/__init__.py
@@ -0,0 +1,31 @@
+from __future__ import absolute_import
+from future.utils import PY3
+__future_module__ = True
+
+if PY3:
+ from html import *
+else:
+ # cgi.escape isn't good enough for the single Py3.3 html test to pass.
+ # Define it inline here instead. From the Py3.4 stdlib. Note that the
+ # html.escape() function from the Py3.3 stdlib is not suitable for use on
+ # Py2.x.
+ """
+ General functions for HTML manipulation.
+ """
+
+ def escape(s, quote=True):
+ """
+ Replace special characters "&", "<" and ">" to HTML-safe sequences.
+ If the optional flag quote is true (the default), the quotation mark
+ characters, both double quote (") and single quote (') characters are also
+ translated.
+ """
+ s = s.replace("&", "&") # Must be done first!
+ s = s.replace("<", "<")
+ s = s.replace(">", ">")
+ if quote:
+ s = s.replace('"', """)
+ s = s.replace('\'', "'")
+ return s
+
+ __all__ = ['escape']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/html/entities.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/html/entities.py
new file mode 100644
index 0000000..56a8860
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/html/entities.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from html.entities import *
+else:
+ __future_module__ = True
+ from htmlentitydefs import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/html/parser.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/html/parser.py
new file mode 100644
index 0000000..a6115b5
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/html/parser.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+__future_module__ = True
+
+if PY3:
+ from html.parser import *
+else:
+ from HTMLParser import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/http/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/http/__init__.py
new file mode 100644
index 0000000..917b3d7
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/http/__init__.py
@@ -0,0 +1,4 @@
+from future.utils import PY3
+
+if not PY3:
+ __future_module__ = True
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/http/client.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/http/client.py
new file mode 100644
index 0000000..1ca0e9b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/http/client.py
@@ -0,0 +1,7 @@
+from future.utils import PY3
+
+if PY3:
+ from http.client import *
+else:
+ from httplib import *
+ __future_module__ = True
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/http/cookiejar.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/http/cookiejar.py
new file mode 100644
index 0000000..ea00df7
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/http/cookiejar.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from http.cookiejar import *
+else:
+ __future_module__ = True
+ from cookielib import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/http/cookies.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/http/cookies.py
new file mode 100644
index 0000000..1b74fe2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/http/cookies.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from http.cookies import *
+else:
+ __future_module__ = True
+ from Cookie import *
+ from Cookie import Morsel # left out of __all__ on Py2.7!
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/http/server.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/http/server.py
new file mode 100644
index 0000000..4e75cc1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/http/server.py
@@ -0,0 +1,20 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from http.server import *
+else:
+ __future_module__ = True
+ from BaseHTTPServer import *
+ from CGIHTTPServer import *
+ from SimpleHTTPServer import *
+ try:
+ from CGIHTTPServer import _url_collapse_path # needed for a test
+ except ImportError:
+ try:
+ # Python 2.7.0 to 2.7.3
+ from CGIHTTPServer import (
+ _url_collapse_path_split as _url_collapse_path)
+ except ImportError:
+ # Doesn't exist on Python 2.6.x. Ignore it.
+ pass
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/itertools.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/itertools.py
new file mode 100644
index 0000000..e5eb20d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/itertools.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+
+from itertools import *
+try:
+ zip_longest = izip_longest
+ filterfalse = ifilterfalse
+except NameError:
+ pass
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/pickle.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/pickle.py
new file mode 100644
index 0000000..c53d693
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/pickle.py
@@ -0,0 +1,11 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from pickle import *
+else:
+ __future_module__ = True
+ try:
+ from cPickle import *
+ except ImportError:
+ from pickle import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/queue.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/queue.py
new file mode 100644
index 0000000..1cb1437
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/queue.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from queue import *
+else:
+ __future_module__ = True
+ from Queue import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/reprlib.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/reprlib.py
new file mode 100644
index 0000000..a313a13
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/reprlib.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from reprlib import *
+else:
+ __future_module__ = True
+ from repr import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/socketserver.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/socketserver.py
new file mode 100644
index 0000000..062e084
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/socketserver.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from socketserver import *
+else:
+ __future_module__ = True
+ from SocketServer import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/subprocess.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/subprocess.py
new file mode 100644
index 0000000..43ffd2a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/subprocess.py
@@ -0,0 +1,11 @@
+from __future__ import absolute_import
+from future.utils import PY2, PY26
+
+from subprocess import *
+
+if PY2:
+ __future_module__ = True
+ from commands import getoutput, getstatusoutput
+
+if PY26:
+ from future.backports.misc import check_output
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/sys.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/sys.py
new file mode 100644
index 0000000..1293bcb
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/sys.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+
+from future.utils import PY2
+
+from sys import *
+
+if PY2:
+ from __builtin__ import intern
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/test/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/test/__init__.py
new file mode 100644
index 0000000..5cf428b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/test/__init__.py
@@ -0,0 +1,5 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if not PY3:
+ __future_module__ = True
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/test/support.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/test/support.py
new file mode 100644
index 0000000..ab189f4
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/test/support.py
@@ -0,0 +1,11 @@
+from __future__ import absolute_import
+from future.standard_library import suspend_hooks
+from future.utils import PY3
+
+if PY3:
+ from test.support import *
+else:
+ __future_module__ = True
+ with suspend_hooks():
+ from test.test_support import *
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/__init__.py
new file mode 100644
index 0000000..09442e4
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/__init__.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+__future_module__ = True
+
+if not PY3:
+ from Tkinter import *
+else:
+ from tkinter import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/colorchooser.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/colorchooser.py
new file mode 100644
index 0000000..5e7c97f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/colorchooser.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.colorchooser import *
+else:
+ try:
+ from tkColorChooser import *
+ except ImportError:
+ raise ImportError('The tkColorChooser module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/commondialog.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/commondialog.py
new file mode 100644
index 0000000..7747a0b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/commondialog.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.commondialog import *
+else:
+ try:
+ from tkCommonDialog import *
+ except ImportError:
+ raise ImportError('The tkCommonDialog module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/constants.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/constants.py
new file mode 100644
index 0000000..99216f3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/constants.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.constants import *
+else:
+ try:
+ from Tkconstants import *
+ except ImportError:
+ raise ImportError('The Tkconstants module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/dialog.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/dialog.py
new file mode 100644
index 0000000..a5b7778
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/dialog.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.dialog import *
+else:
+ try:
+ from Dialog import *
+ except ImportError:
+ raise ImportError('The Dialog module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/dnd.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/dnd.py
new file mode 100644
index 0000000..748b111
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/dnd.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.dnd import *
+else:
+ try:
+ from Tkdnd import *
+ except ImportError:
+ raise ImportError('The Tkdnd module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/filedialog.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/filedialog.py
new file mode 100644
index 0000000..35e21ac
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/filedialog.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.filedialog import *
+else:
+ try:
+ from FileDialog import *
+ except ImportError:
+ raise ImportError('The FileDialog module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/font.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/font.py
new file mode 100644
index 0000000..63d86dc
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/font.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.font import *
+else:
+ try:
+ from tkFont import *
+ except ImportError:
+ raise ImportError('The tkFont module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/messagebox.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/messagebox.py
new file mode 100644
index 0000000..3ed52e1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/messagebox.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.messagebox import *
+else:
+ try:
+ from tkMessageBox import *
+ except ImportError:
+ raise ImportError('The tkMessageBox module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/scrolledtext.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/scrolledtext.py
new file mode 100644
index 0000000..13bd660
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/scrolledtext.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.scrolledtext import *
+else:
+ try:
+ from ScrolledText import *
+ except ImportError:
+ raise ImportError('The ScrolledText module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/simpledialog.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/simpledialog.py
new file mode 100644
index 0000000..e952fa9
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/simpledialog.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.simpledialog import *
+else:
+ try:
+ from SimpleDialog import *
+ except ImportError:
+ raise ImportError('The SimpleDialog module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/tix.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/tix.py
new file mode 100644
index 0000000..019df6f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/tkinter/tix.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.tix import *
+else:
+ try:
+ from Tix import *
+ except ImportError:
+ raise ImportError('The Tix module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/urllib/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/urllib/__init__.py
new file mode 100644
index 0000000..8d1298c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/urllib/__init__.py
@@ -0,0 +1,6 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if not PY3:
+ __future_module__ = True
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/urllib/error.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/urllib/error.py
new file mode 100644
index 0000000..ae49255
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/urllib/error.py
@@ -0,0 +1,16 @@
+from __future__ import absolute_import
+from future.standard_library import suspend_hooks
+
+from future.utils import PY3
+
+if PY3:
+ from urllib.error import *
+else:
+ __future_module__ = True
+
+ # We use this method to get at the original Py2 urllib before any renaming magic
+ # ContentTooShortError = sys.py2_modules['urllib'].ContentTooShortError
+
+ with suspend_hooks():
+ from urllib import ContentTooShortError
+ from urllib2 import URLError, HTTPError
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/urllib/parse.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/urllib/parse.py
new file mode 100644
index 0000000..832dfb5
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/urllib/parse.py
@@ -0,0 +1,28 @@
+from __future__ import absolute_import
+from future.standard_library import suspend_hooks
+
+from future.utils import PY3
+
+if PY3:
+ from urllib.parse import *
+else:
+ __future_module__ = True
+ from urlparse import (ParseResult, SplitResult, parse_qs, parse_qsl,
+ urldefrag, urljoin, urlparse, urlsplit,
+ urlunparse, urlunsplit)
+
+ # we use this method to get at the original py2 urllib before any renaming
+ # quote = sys.py2_modules['urllib'].quote
+ # quote_plus = sys.py2_modules['urllib'].quote_plus
+ # unquote = sys.py2_modules['urllib'].unquote
+ # unquote_plus = sys.py2_modules['urllib'].unquote_plus
+ # urlencode = sys.py2_modules['urllib'].urlencode
+ # splitquery = sys.py2_modules['urllib'].splitquery
+
+ with suspend_hooks():
+ from urllib import (quote,
+ quote_plus,
+ unquote,
+ unquote_plus,
+ urlencode,
+ splitquery)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/urllib/request.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/urllib/request.py
new file mode 100644
index 0000000..375dc29
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/urllib/request.py
@@ -0,0 +1,93 @@
+from __future__ import absolute_import
+
+from future.standard_library import suspend_hooks
+from future.utils import PY3
+
+if PY3:
+ from urllib.request import *
+ # This aren't in __all__:
+ from urllib.request import (getproxies,
+ pathname2url,
+ proxy_bypass,
+ quote,
+ request_host,
+ splitattr,
+ splithost,
+ splitpasswd,
+ splitport,
+ splitquery,
+ splittag,
+ splittype,
+ splituser,
+ splitvalue,
+ thishost,
+ to_bytes,
+ unquote,
+ unwrap,
+ url2pathname,
+ urlcleanup,
+ urljoin,
+ urlopen,
+ urlparse,
+ urlretrieve,
+ urlsplit,
+ urlunparse)
+else:
+ __future_module__ = True
+ with suspend_hooks():
+ from urllib import *
+ from urllib2 import *
+ from urlparse import *
+
+ # Rename:
+ from urllib import toBytes # missing from __all__ on Py2.6
+ to_bytes = toBytes
+
+ # from urllib import (pathname2url,
+ # url2pathname,
+ # getproxies,
+ # urlretrieve,
+ # urlcleanup,
+ # URLopener,
+ # FancyURLopener,
+ # proxy_bypass)
+
+ # from urllib2 import (
+ # AbstractBasicAuthHandler,
+ # AbstractDigestAuthHandler,
+ # BaseHandler,
+ # CacheFTPHandler,
+ # FileHandler,
+ # FTPHandler,
+ # HTTPBasicAuthHandler,
+ # HTTPCookieProcessor,
+ # HTTPDefaultErrorHandler,
+ # HTTPDigestAuthHandler,
+ # HTTPErrorProcessor,
+ # HTTPHandler,
+ # HTTPPasswordMgr,
+ # HTTPPasswordMgrWithDefaultRealm,
+ # HTTPRedirectHandler,
+ # HTTPSHandler,
+ # URLError,
+ # build_opener,
+ # install_opener,
+ # OpenerDirector,
+ # ProxyBasicAuthHandler,
+ # ProxyDigestAuthHandler,
+ # ProxyHandler,
+ # Request,
+ # UnknownHandler,
+ # urlopen,
+ # )
+
+ # from urlparse import (
+ # urldefrag
+ # urljoin,
+ # urlparse,
+ # urlunparse,
+ # urlsplit,
+ # urlunsplit,
+ # parse_qs,
+ # parse_q"
+ # )
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/urllib/response.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/urllib/response.py
new file mode 100644
index 0000000..120ea13
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/urllib/response.py
@@ -0,0 +1,13 @@
+from future import standard_library
+from future.utils import PY3
+
+if PY3:
+ from urllib.response import *
+else:
+ __future_module__ = True
+ with standard_library.suspend_hooks():
+ from urllib import (addbase,
+ addclosehook,
+ addinfo,
+ addinfourl)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/urllib/robotparser.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/urllib/robotparser.py
new file mode 100644
index 0000000..0dc8f57
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/urllib/robotparser.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from urllib.robotparser import *
+else:
+ __future_module__ = True
+ from robotparser import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/winreg.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/winreg.py
new file mode 100644
index 0000000..c8b1475
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/winreg.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from winreg import *
+else:
+ __future_module__ = True
+ from _winreg import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/xmlrpc/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/xmlrpc/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/xmlrpc/client.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/xmlrpc/client.py
new file mode 100644
index 0000000..4708cf8
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/xmlrpc/client.py
@@ -0,0 +1,7 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from xmlrpc.client import *
+else:
+ from xmlrpclib import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/xmlrpc/server.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/xmlrpc/server.py
new file mode 100644
index 0000000..1a8af34
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/moves/xmlrpc/server.py
@@ -0,0 +1,7 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from xmlrpc.server import *
+else:
+ from xmlrpclib import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/standard_library/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/standard_library/__init__.py
new file mode 100644
index 0000000..2923e2d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/standard_library/__init__.py
@@ -0,0 +1,810 @@
+"""
+Python 3 reorganized the standard library (PEP 3108). This module exposes
+several standard library modules to Python 2 under their new Python 3
+names.
+
+It is designed to be used as follows::
+
+ from future import standard_library
+ standard_library.install_aliases()
+
+And then these normal Py3 imports work on both Py3 and Py2::
+
+ import builtins
+ import configparser
+ import copyreg
+ import queue
+ import reprlib
+ import socketserver
+ import winreg # on Windows only
+ import test.support
+ import html, html.parser, html.entites
+ import http, http.client, http.server
+ import http.cookies, http.cookiejar
+ import urllib.parse, urllib.request, urllib.response, urllib.error, urllib.robotparser
+ import xmlrpc.client, xmlrpc.server
+
+ import _thread
+ import _dummy_thread
+ import _markupbase
+
+ from itertools import filterfalse, zip_longest
+ from sys import intern
+ from collections import UserDict, UserList, UserString
+ from collections import OrderedDict, Counter # even on Py2.6
+ from subprocess import getoutput, getstatusoutput
+ from subprocess import check_output # even on Py2.6
+
+(The renamed modules and functions are still available under their old
+names on Python 2.)
+
+This is a cleaner alternative to this idiom (see
+http://docs.pythonsprints.com/python3_porting/py-porting.html)::
+
+ try:
+ import queue
+ except ImportError:
+ import Queue as queue
+
+
+Limitations
+-----------
+We don't currently support these modules, but would like to::
+
+ import dbm
+ import dbm.dumb
+ import dbm.gnu
+ import collections.abc # on Py33
+ import tkinter
+ import pickle # should (optionally) bring in cPickle on Python 2
+
+"""
+
+from __future__ import absolute_import, division, print_function
+
+import sys
+import logging
+import imp
+import contextlib
+import types
+import copy
+import os
+
+# Make a dedicated logger; leave the root logger to be configured
+# by the application.
+flog = logging.getLogger('future_stdlib')
+_formatter = logging.Formatter(logging.BASIC_FORMAT)
+_handler = logging.StreamHandler()
+_handler.setFormatter(_formatter)
+flog.addHandler(_handler)
+flog.setLevel(logging.WARN)
+
+from future.utils import PY2, PY3
+
+# The modules that are defined under the same names on Py3 but with
+# different contents in a significant way (e.g. submodules) are:
+# pickle (fast one)
+# dbm
+# urllib
+# test
+# email
+
+REPLACED_MODULES = set(['test', 'urllib', 'pickle', 'dbm']) # add email and dbm when we support it
+
+# The following module names are not present in Python 2.x, so they cause no
+# potential clashes between the old and new names:
+# http
+# html
+# tkinter
+# xmlrpc
+# Keys: Py2 / real module names
+# Values: Py3 / simulated module names
+RENAMES = {
+ # 'cStringIO': 'io', # there's a new io module in Python 2.6
+ # that provides StringIO and BytesIO
+ # 'StringIO': 'io', # ditto
+ # 'cPickle': 'pickle',
+ '__builtin__': 'builtins',
+ 'copy_reg': 'copyreg',
+ 'Queue': 'queue',
+ 'future.moves.socketserver': 'socketserver',
+ 'ConfigParser': 'configparser',
+ 'repr': 'reprlib',
+ # 'FileDialog': 'tkinter.filedialog',
+ # 'tkFileDialog': 'tkinter.filedialog',
+ # 'SimpleDialog': 'tkinter.simpledialog',
+ # 'tkSimpleDialog': 'tkinter.simpledialog',
+ # 'tkColorChooser': 'tkinter.colorchooser',
+ # 'tkCommonDialog': 'tkinter.commondialog',
+ # 'Dialog': 'tkinter.dialog',
+ # 'Tkdnd': 'tkinter.dnd',
+ # 'tkFont': 'tkinter.font',
+ # 'tkMessageBox': 'tkinter.messagebox',
+ # 'ScrolledText': 'tkinter.scrolledtext',
+ # 'Tkconstants': 'tkinter.constants',
+ # 'Tix': 'tkinter.tix',
+ # 'ttk': 'tkinter.ttk',
+ # 'Tkinter': 'tkinter',
+ '_winreg': 'winreg',
+ 'thread': '_thread',
+ 'dummy_thread': '_dummy_thread',
+ # 'anydbm': 'dbm', # causes infinite import loop
+ # 'whichdb': 'dbm', # causes infinite import loop
+ # anydbm and whichdb are handled by fix_imports2
+ # 'dbhash': 'dbm.bsd',
+ # 'dumbdbm': 'dbm.dumb',
+ # 'dbm': 'dbm.ndbm',
+ # 'gdbm': 'dbm.gnu',
+ 'future.moves.xmlrpc': 'xmlrpc',
+ # 'future.backports.email': 'email', # for use by urllib
+ # 'DocXMLRPCServer': 'xmlrpc.server',
+ # 'SimpleXMLRPCServer': 'xmlrpc.server',
+ # 'httplib': 'http.client',
+ # 'htmlentitydefs' : 'html.entities',
+ # 'HTMLParser' : 'html.parser',
+ # 'Cookie': 'http.cookies',
+ # 'cookielib': 'http.cookiejar',
+ # 'BaseHTTPServer': 'http.server',
+ # 'SimpleHTTPServer': 'http.server',
+ # 'CGIHTTPServer': 'http.server',
+ # 'future.backports.test': 'test', # primarily for renaming test_support to support
+ # 'commands': 'subprocess',
+ # 'urlparse' : 'urllib.parse',
+ # 'robotparser' : 'urllib.robotparser',
+ # 'abc': 'collections.abc', # for Py33
+ # 'future.utils.six.moves.html': 'html',
+ # 'future.utils.six.moves.http': 'http',
+ 'future.moves.html': 'html',
+ 'future.moves.http': 'http',
+ # 'future.backports.urllib': 'urllib',
+ # 'future.utils.six.moves.urllib': 'urllib',
+ 'future.moves._markupbase': '_markupbase',
+ }
+
+
+# It is complicated and apparently brittle to mess around with the
+# ``sys.modules`` cache in order to support "import urllib" meaning two
+# different things (Py2.7 urllib and backported Py3.3-like urllib) in different
+# contexts. So we require explicit imports for these modules.
+assert len(set(RENAMES.values()) & set(REPLACED_MODULES)) == 0
+
+
+# Harmless renames that we can insert.
+# These modules need names from elsewhere being added to them:
+# subprocess: should provide getoutput and other fns from commands
+# module but these fns are missing: getstatus, mk2arg,
+# mkarg
+# re: needs an ASCII constant that works compatibly with Py3
+
+# etc: see lib2to3/fixes/fix_imports.py
+
+# (New module name, new object name, old module name, old object name)
+MOVES = [('collections', 'UserList', 'UserList', 'UserList'),
+ ('collections', 'UserDict', 'UserDict', 'UserDict'),
+ ('collections', 'UserString','UserString', 'UserString'),
+ ('itertools', 'filterfalse','itertools', 'ifilterfalse'),
+ ('itertools', 'zip_longest','itertools', 'izip_longest'),
+ ('sys', 'intern','__builtin__', 'intern'),
+ # The re module has no ASCII flag in Py2, but this is the default.
+ # Set re.ASCII to a zero constant. stat.ST_MODE just happens to be one
+ # (and it exists on Py2.6+).
+ ('re', 'ASCII','stat', 'ST_MODE'),
+ ('base64', 'encodebytes','base64', 'encodestring'),
+ ('base64', 'decodebytes','base64', 'decodestring'),
+ ('subprocess', 'getoutput', 'commands', 'getoutput'),
+ ('subprocess', 'getstatusoutput', 'commands', 'getstatusoutput'),
+ ('subprocess', 'check_output', 'future.backports.misc', 'check_output'),
+ ('math', 'ceil', 'future.backports.misc', 'ceil'),
+ ('collections', 'OrderedDict', 'future.backports.misc', 'OrderedDict'),
+ ('collections', 'Counter', 'future.backports.misc', 'Counter'),
+
+# This is no use, since "import urllib.request" etc. still fails:
+# ('urllib', 'error', 'future.moves.urllib', 'error'),
+# ('urllib', 'parse', 'future.moves.urllib', 'parse'),
+# ('urllib', 'request', 'future.moves.urllib', 'request'),
+# ('urllib', 'response', 'future.moves.urllib', 'response'),
+# ('urllib', 'robotparser', 'future.moves.urllib', 'robotparser'),
+ ]
+
+
+# A minimal example of an import hook:
+# class WarnOnImport(object):
+# def __init__(self, *args):
+# self.module_names = args
+#
+# def find_module(self, fullname, path=None):
+# if fullname in self.module_names:
+# self.path = path
+# return self
+# return None
+#
+# def load_module(self, name):
+# if name in sys.modules:
+# return sys.modules[name]
+# module_info = imp.find_module(name, self.path)
+# module = imp.load_module(name, *module_info)
+# sys.modules[name] = module
+# flog.warning("Imported deprecated module %s", name)
+# return module
+
+
+class RenameImport(object):
+ """
+ A class for import hooks mapping Py3 module names etc. to the Py2 equivalents.
+ """
+ # Different RenameImport classes are created when importing this module from
+ # different source files. This causes isinstance(hook, RenameImport) checks
+ # to produce inconsistent results. We add this RENAMER attribute here so
+ # remove_hooks() and install_hooks() can find instances of these classes
+ # easily:
+ RENAMER = True
+
+ def __init__(self, old_to_new):
+ '''
+ Pass in a dictionary-like object mapping from old names to new
+ names. E.g. {'ConfigParser': 'configparser', 'cPickle': 'pickle'}
+ '''
+ self.old_to_new = old_to_new
+ both = set(old_to_new.keys()) & set(old_to_new.values())
+ assert (len(both) == 0 and
+ len(set(old_to_new.values())) == len(old_to_new.values())), \
+ 'Ambiguity in renaming (handler not implemented)'
+ self.new_to_old = dict((new, old) for (old, new) in old_to_new.items())
+
+ def find_module(self, fullname, path=None):
+ # Handles hierarchical importing: package.module.module2
+ new_base_names = set([s.split('.')[0] for s in self.new_to_old])
+ # Before v0.12: Was: if fullname in set(self.old_to_new) | new_base_names:
+ if fullname in new_base_names:
+ return self
+ return None
+
+ def load_module(self, name):
+ path = None
+ if name in sys.modules:
+ return sys.modules[name]
+ elif name in self.new_to_old:
+ # New name. Look up the corresponding old (Py2) name:
+ oldname = self.new_to_old[name]
+ module = self._find_and_load_module(oldname)
+ # module.__future_module__ = True
+ else:
+ module = self._find_and_load_module(name)
+ # In any case, make it available under the requested (Py3) name
+ sys.modules[name] = module
+ return module
+
+ def _find_and_load_module(self, name, path=None):
+ """
+ Finds and loads it. But if there's a . in the name, handles it
+ properly.
+ """
+ bits = name.split('.')
+ while len(bits) > 1:
+ # Treat the first bit as a package
+ packagename = bits.pop(0)
+ package = self._find_and_load_module(packagename, path)
+ try:
+ path = package.__path__
+ except AttributeError:
+ # This could be e.g. moves.
+ flog.debug('Package {0} has no __path__.'.format(package))
+ if name in sys.modules:
+ return sys.modules[name]
+ flog.debug('What to do here?')
+
+ name = bits[0]
+ module_info = imp.find_module(name, path)
+ return imp.load_module(name, *module_info)
+
+
+class hooks(object):
+ """
+ Acts as a context manager. Saves the state of sys.modules and restores it
+ after the 'with' block.
+
+ Use like this:
+
+ >>> from future import standard_library
+ >>> with standard_library.hooks():
+ ... import http.client
+ >>> import requests
+
+ For this to work, http.client will be scrubbed from sys.modules after the
+ 'with' block. That way the modules imported in the 'with' block will
+ continue to be accessible in the current namespace but not from any
+ imported modules (like requests).
+ """
+ def __enter__(self):
+ # flog.debug('Entering hooks context manager')
+ self.old_sys_modules = copy.copy(sys.modules)
+ self.hooks_were_installed = detect_hooks()
+ # self.scrubbed = scrub_py2_sys_modules()
+ install_hooks()
+ return self
+
+ def __exit__(self, *args):
+ # flog.debug('Exiting hooks context manager')
+ # restore_sys_modules(self.scrubbed)
+ if not self.hooks_were_installed:
+ remove_hooks()
+ # scrub_future_sys_modules()
+
+# Sanity check for is_py2_stdlib_module(): We aren't replacing any
+# builtin modules names:
+if PY2:
+ assert len(set(RENAMES.values()) & set(sys.builtin_module_names)) == 0
+
+
+def is_py2_stdlib_module(m):
+ """
+ Tries to infer whether the module m is from the Python 2 standard library.
+ This may not be reliable on all systems.
+ """
+ if PY3:
+ return False
+ if not 'stdlib_path' in is_py2_stdlib_module.__dict__:
+ stdlib_files = [contextlib.__file__, os.__file__, copy.__file__]
+ stdlib_paths = [os.path.split(f)[0] for f in stdlib_files]
+ if not len(set(stdlib_paths)) == 1:
+ # This seems to happen on travis-ci.org. Very strange. We'll try to
+ # ignore it.
+ flog.warn('Multiple locations found for the Python standard '
+ 'library: %s' % stdlib_paths)
+ # Choose the first one arbitrarily
+ is_py2_stdlib_module.stdlib_path = stdlib_paths[0]
+
+ if m.__name__ in sys.builtin_module_names:
+ return True
+
+ if hasattr(m, '__file__'):
+ modpath = os.path.split(m.__file__)
+ if (modpath[0].startswith(is_py2_stdlib_module.stdlib_path) and
+ 'site-packages' not in modpath[0]):
+ return True
+
+ return False
+
+
+def scrub_py2_sys_modules():
+ """
+ Removes any Python 2 standard library modules from ``sys.modules`` that
+ would interfere with Py3-style imports using import hooks. Examples are
+ modules with the same names (like urllib or email).
+
+ (Note that currently import hooks are disabled for modules like these
+ with ambiguous names anyway ...)
+ """
+ if PY3:
+ return {}
+ scrubbed = {}
+ for modulename in REPLACED_MODULES & set(RENAMES.keys()):
+ if not modulename in sys.modules:
+ continue
+
+ module = sys.modules[modulename]
+
+ if is_py2_stdlib_module(module):
+ flog.debug('Deleting (Py2) {} from sys.modules'.format(modulename))
+ scrubbed[modulename] = sys.modules[modulename]
+ del sys.modules[modulename]
+ return scrubbed
+
+
+def scrub_future_sys_modules():
+ """
+ Deprecated.
+ """
+ return {}
+
+class suspend_hooks(object):
+ """
+ Acts as a context manager. Use like this:
+
+ >>> from future import standard_library
+ >>> standard_library.install_hooks()
+ >>> import http.client
+ >>> # ...
+ >>> with standard_library.suspend_hooks():
+ >>> import requests # incompatible with ``future``'s standard library hooks
+
+ If the hooks were disabled before the context, they are not installed when
+ the context is left.
+ """
+ def __enter__(self):
+ self.hooks_were_installed = detect_hooks()
+ remove_hooks()
+ # self.scrubbed = scrub_future_sys_modules()
+ return self
+
+ def __exit__(self, *args):
+ if self.hooks_were_installed:
+ install_hooks()
+ # restore_sys_modules(self.scrubbed)
+
+
+def restore_sys_modules(scrubbed):
+ """
+ Add any previously scrubbed modules back to the sys.modules cache,
+ but only if it's safe to do so.
+ """
+ clash = set(sys.modules) & set(scrubbed)
+ if len(clash) != 0:
+ # If several, choose one arbitrarily to raise an exception about
+ first = list(clash)[0]
+ raise ImportError('future module {} clashes with Py2 module'
+ .format(first))
+ sys.modules.update(scrubbed)
+
+
+def install_aliases():
+ """
+ Monkey-patches the standard library in Py2.6/7 to provide
+ aliases for better Py3 compatibility.
+ """
+ if PY3:
+ return
+ # if hasattr(install_aliases, 'run_already'):
+ # return
+ for (newmodname, newobjname, oldmodname, oldobjname) in MOVES:
+ __import__(newmodname)
+ # We look up the module in sys.modules because __import__ just returns the
+ # top-level package:
+ newmod = sys.modules[newmodname]
+ # newmod.__future_module__ = True
+
+ __import__(oldmodname)
+ oldmod = sys.modules[oldmodname]
+
+ obj = getattr(oldmod, oldobjname)
+ setattr(newmod, newobjname, obj)
+
+ # Hack for urllib so it appears to have the same structure on Py2 as on Py3
+ import urllib
+ from future.moves.urllib import request
+ from future.moves.urllib import response
+ from future.moves.urllib import parse
+ from future.moves.urllib import error
+ from future.moves.urllib import robotparser
+ urllib.request = request
+ urllib.response = response
+ urllib.parse = parse
+ urllib.error = error
+ urllib.robotparser = robotparser
+ sys.modules['urllib.request'] = request
+ sys.modules['urllib.response'] = response
+ sys.modules['urllib.parse'] = parse
+ sys.modules['urllib.error'] = error
+ sys.modules['urllib.robotparser'] = robotparser
+
+ # Patch the test module so it appears to have the same structure on Py2 as on Py3
+ try:
+ import test
+ except ImportError:
+ pass
+ try:
+ from future.moves.test import support
+ except ImportError:
+ pass
+ else:
+ test.support = support
+ sys.modules['test.support'] = support
+
+ # Patch the dbm module so it appears to have the same structure on Py2 as on Py3
+ try:
+ import dbm
+ except ImportError:
+ pass
+ else:
+ from future.moves.dbm import dumb
+ dbm.dumb = dumb
+ sys.modules['dbm.dumb'] = dumb
+ try:
+ from future.moves.dbm import gnu
+ except ImportError:
+ pass
+ else:
+ dbm.gnu = gnu
+ sys.modules['dbm.gnu'] = gnu
+ try:
+ from future.moves.dbm import ndbm
+ except ImportError:
+ pass
+ else:
+ dbm.ndbm = ndbm
+ sys.modules['dbm.ndbm'] = ndbm
+
+ # install_aliases.run_already = True
+
+
+def install_hooks():
+ """
+ This function installs the future.standard_library import hook into
+ sys.meta_path.
+ """
+ if PY3:
+ return
+
+ install_aliases()
+
+ flog.debug('sys.meta_path was: {0}'.format(sys.meta_path))
+ flog.debug('Installing hooks ...')
+
+ # Add it unless it's there already
+ newhook = RenameImport(RENAMES)
+ if not detect_hooks():
+ sys.meta_path.append(newhook)
+ flog.debug('sys.meta_path is now: {0}'.format(sys.meta_path))
+
+
+def enable_hooks():
+ """
+ Deprecated. Use install_hooks() instead. This will be removed by
+ ``future`` v1.0.
+ """
+ install_hooks()
+
+
+def remove_hooks(scrub_sys_modules=False):
+ """
+ This function removes the import hook from sys.meta_path.
+ """
+ if PY3:
+ return
+ flog.debug('Uninstalling hooks ...')
+ # Loop backwards, so deleting items keeps the ordering:
+ for i, hook in list(enumerate(sys.meta_path))[::-1]:
+ if hasattr(hook, 'RENAMER'):
+ del sys.meta_path[i]
+
+ # Explicit is better than implicit. In the future the interface should
+ # probably change so that scrubbing the import hooks requires a separate
+ # function call. Left as is for now for backward compatibility with
+ # v0.11.x.
+ if scrub_sys_modules:
+ scrub_future_sys_modules()
+
+
+def disable_hooks():
+ """
+ Deprecated. Use remove_hooks() instead. This will be removed by
+ ``future`` v1.0.
+ """
+ remove_hooks()
+
+
+def detect_hooks():
+ """
+ Returns True if the import hooks are installed, False if not.
+ """
+ flog.debug('Detecting hooks ...')
+ present = any([hasattr(hook, 'RENAMER') for hook in sys.meta_path])
+ if present:
+ flog.debug('Detected.')
+ else:
+ flog.debug('Not detected.')
+ return present
+
+
+# As of v0.12, this no longer happens implicitly:
+# if not PY3:
+# install_hooks()
+
+
+if not hasattr(sys, 'py2_modules'):
+ sys.py2_modules = {}
+
+def cache_py2_modules():
+ """
+ Currently this function is unneeded, as we are not attempting to provide import hooks
+ for modules with ambiguous names: email, urllib, pickle.
+ """
+ if len(sys.py2_modules) != 0:
+ return
+ assert not detect_hooks()
+ import urllib
+ sys.py2_modules['urllib'] = urllib
+
+ import email
+ sys.py2_modules['email'] = email
+
+ import pickle
+ sys.py2_modules['pickle'] = pickle
+
+ # Not all Python installations have test module. (Anaconda doesn't, for example.)
+ # try:
+ # import test
+ # except ImportError:
+ # sys.py2_modules['test'] = None
+ # sys.py2_modules['test'] = test
+
+ # import dbm
+ # sys.py2_modules['dbm'] = dbm
+
+
+def import_(module_name, backport=False):
+ """
+ Pass a (potentially dotted) module name of a Python 3 standard library
+ module. This function imports the module compatibly on Py2 and Py3 and
+ returns the top-level module.
+
+ Example use:
+ >>> http = import_('http.client')
+ >>> http = import_('http.server')
+ >>> urllib = import_('urllib.request')
+
+ Then:
+ >>> conn = http.client.HTTPConnection(...)
+ >>> response = urllib.request.urlopen('http://mywebsite.com')
+ >>> # etc.
+
+ Use as follows:
+ >>> package_name = import_(module_name)
+
+ On Py3, equivalent to this:
+
+ >>> import module_name
+
+ On Py2, equivalent to this if backport=False:
+
+ >>> from future.moves import module_name
+
+ or to this if backport=True:
+
+ >>> from future.backports import module_name
+
+ except that it also handles dotted module names such as ``http.client``
+ The effect then is like this:
+
+ >>> from future.backports import module
+ >>> from future.backports.module import submodule
+ >>> module.submodule = submodule
+
+ Note that this would be a SyntaxError in Python:
+
+ >>> from future.backports import http.client
+
+ """
+ # Python 2.6 doesn't have importlib in the stdlib, so it requires
+ # the backported ``importlib`` package from PyPI as a dependency to use
+ # this function:
+ import importlib
+
+ if PY3:
+ return __import__(module_name)
+ else:
+ # client.blah = blah
+ # Then http.client = client
+ # etc.
+ if backport:
+ prefix = 'future.backports'
+ else:
+ prefix = 'future.moves'
+ parts = prefix.split('.') + module_name.split('.')
+
+ modules = []
+ for i, part in enumerate(parts):
+ sofar = '.'.join(parts[:i+1])
+ modules.append(importlib.import_module(sofar))
+ for i, part in reversed(list(enumerate(parts))):
+ if i == 0:
+ break
+ setattr(modules[i-1], part, modules[i])
+
+ # Return the next-most top-level module after future.backports / future.moves:
+ return modules[2]
+
+
+def from_import(module_name, *symbol_names, **kwargs):
+ """
+ Example use:
+ >>> HTTPConnection = from_import('http.client', 'HTTPConnection')
+ >>> HTTPServer = from_import('http.server', 'HTTPServer')
+ >>> urlopen, urlparse = from_import('urllib.request', 'urlopen', 'urlparse')
+
+ Equivalent to this on Py3:
+
+ >>> from module_name import symbol_names[0], symbol_names[1], ...
+
+ and this on Py2:
+
+ >>> from future.moves.module_name import symbol_names[0], ...
+
+ or:
+
+ >>> from future.backports.module_name import symbol_names[0], ...
+
+ except that it also handles dotted module names such as ``http.client``.
+ """
+
+ if PY3:
+ return __import__(module_name)
+ else:
+ if 'backport' in kwargs and bool(kwargs['backport']):
+ prefix = 'future.backports'
+ else:
+ prefix = 'future.moves'
+ parts = prefix.split('.') + module_name.split('.')
+ module = importlib.import_module(prefix + '.' + module_name)
+ output = [getattr(module, name) for name in symbol_names]
+ if len(output) == 1:
+ return output[0]
+ else:
+ return output
+
+
+class exclude_local_folder_imports(object):
+ """
+ A context-manager that prevents standard library modules like configparser
+ from being imported from the local python-future source folder on Py3.
+
+ (The presence of a configparser folder would otherwise prevent setuptools
+ from running on Py3.)
+ """
+ def __init__(self, *args):
+ assert len(args) > 0
+ self.module_names = args
+ # Disallow dotted module names like http.client:
+ if any(['.' in m for m in self.module_names]):
+ raise NotImplementedError('Dotted module names are not supported')
+
+ def __enter__(self):
+ self.old_sys_path = copy.copy(sys.path)
+ self.old_sys_modules = copy.copy(sys.modules)
+ if sys.version_info[0] < 3:
+ return
+ FUTURE_SOURCE_SUBFOLDERS = ['future', 'past', 'libfuturize', 'configparser']
+
+ # Look for the future source folder:
+ for folder in self.old_sys_path:
+ if all([os.path.exists(os.path.join(folder, subfolder))
+ for subfolder in FUTURE_SOURCE_SUBFOLDERS]):
+ # Found it. Remove it.
+ sys.path.remove(folder)
+
+ # Ensure we import the system module:
+ for m in self.module_names:
+ # Delete the module and any submodules from sys.modules:
+ # for key in list(sys.modules):
+ # if key == m or key.startswith(m + '.'):
+ # try:
+ # del sys.modules[key]
+ # except KeyError:
+ # pass
+ try:
+ module = __import__(m, level=0)
+ except ImportError:
+ # There's a problem importing the system module. E.g. the
+ # winreg module is not available except on Windows.
+ pass
+
+ def __exit__(self, *args):
+ # Restore sys.path and sys.modules:
+ sys.path = self.old_sys_path
+ for m in set(self.old_sys_modules.keys()) - set(sys.modules.keys()):
+ sys.modules[m] = self.old_sys_modules[m]
+
+TOP_LEVEL_MODULES = ['builtins',
+ 'configparser',
+ 'copyreg',
+ 'html',
+ 'http',
+ 'queue',
+ 'reprlib',
+ 'socketserver',
+ 'test',
+ 'tkinter',
+ 'winreg',
+ 'xmlrpc',
+ '_dummy_thread',
+ '_markupbase',
+ '_thread',
+ ]
+
+def import_top_level_modules():
+ with exclude_local_folder_imports(*TOP_LEVEL_MODULES):
+ for m in TOP_LEVEL_MODULES:
+ try:
+ __import__(m)
+ except ImportError: # e.g. winreg
+ pass
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/tests/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/tests/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/tests/base.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/tests/base.py
new file mode 100644
index 0000000..f81c66d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/tests/base.py
@@ -0,0 +1,524 @@
+from __future__ import print_function
+import os
+import tempfile
+import unittest
+import sys
+import re
+import warnings
+import io
+import functools
+from textwrap import dedent
+
+from future.utils import bind_method, PY26, PY3, PY2
+from future.moves.subprocess import check_output, STDOUT, CalledProcessError
+
+if PY26:
+ import unittest2 as unittest
+
+
+def reformat_code(code):
+ """
+ Removes any leading \n and dedents.
+ """
+ if code.startswith('\n'):
+ code = code[1:]
+ return dedent(code)
+
+
+def order_future_lines(code):
+ """
+ Returns the code block with any ``__future__`` import lines sorted, and
+ then any ``future`` import lines sorted, then any ``builtins`` import lines
+ sorted.
+
+ This only sorts the lines within the expected blocks.
+
+ See test_order_future_lines() for an example.
+ """
+
+ # We need .splitlines(keepends=True), which doesn't exist on Py2,
+ # so we use this instead:
+ lines = code.split('\n')
+
+ uufuture_line_numbers = [i for i, line in enumerate(lines)
+ if line.startswith('from __future__ import ')]
+
+ future_line_numbers = [i for i, line in enumerate(lines)
+ if line.startswith('from future')
+ or line.startswith('from past')]
+
+ builtins_line_numbers = [i for i, line in enumerate(lines)
+ if line.startswith('from builtins')]
+
+ assert code.lstrip() == code, ('internal usage error: '
+ 'dedent the code before calling order_future_lines()')
+
+ def mymax(numbers):
+ return max(numbers) if len(numbers) > 0 else 0
+
+ def mymin(numbers):
+ return min(numbers) if len(numbers) > 0 else float('inf')
+
+ assert mymax(uufuture_line_numbers) <= mymin(future_line_numbers), \
+ 'the __future__ and future imports are out of order'
+
+ # assert mymax(future_line_numbers) <= mymin(builtins_line_numbers), \
+ # 'the future and builtins imports are out of order'
+
+ uul = sorted([lines[i] for i in uufuture_line_numbers])
+ sorted_uufuture_lines = dict(zip(uufuture_line_numbers, uul))
+
+ fl = sorted([lines[i] for i in future_line_numbers])
+ sorted_future_lines = dict(zip(future_line_numbers, fl))
+
+ bl = sorted([lines[i] for i in builtins_line_numbers])
+ sorted_builtins_lines = dict(zip(builtins_line_numbers, bl))
+
+ # Replace the old unsorted "from __future__ import ..." lines with the
+ # new sorted ones:
+ new_lines = []
+ for i in range(len(lines)):
+ if i in uufuture_line_numbers:
+ new_lines.append(sorted_uufuture_lines[i])
+ elif i in future_line_numbers:
+ new_lines.append(sorted_future_lines[i])
+ elif i in builtins_line_numbers:
+ new_lines.append(sorted_builtins_lines[i])
+ else:
+ new_lines.append(lines[i])
+ return '\n'.join(new_lines)
+
+
+class VerboseCalledProcessError(CalledProcessError):
+ """
+ Like CalledProcessError, but it displays more information (message and
+ script output) for diagnosing test failures etc.
+ """
+ def __init__(self, msg, returncode, cmd, output=None):
+ self.msg = msg
+ self.returncode = returncode
+ self.cmd = cmd
+ self.output = output
+
+ def __str__(self):
+ return ("Command '%s' failed with exit status %d\nMessage: %s\nOutput: %s"
+ % (self.cmd, self.returncode, self.msg, self.output))
+
+class FuturizeError(VerboseCalledProcessError):
+ pass
+
+class PasteurizeError(VerboseCalledProcessError):
+ pass
+
+
+class CodeHandler(unittest.TestCase):
+ """
+ Handy mixin for test classes for writing / reading / futurizing /
+ running .py files in the test suite.
+ """
+ def setUp(self):
+ """
+ The outputs from the various futurize stages should have the
+ following headers:
+ """
+ # After stage1:
+ # TODO: use this form after implementing a fixer to consolidate
+ # __future__ imports into a single line:
+ # self.headers1 = """
+ # from __future__ import absolute_import, division, print_function
+ # """
+ self.headers1 = reformat_code("""
+ from __future__ import absolute_import
+ from __future__ import division
+ from __future__ import print_function
+ """)
+
+ # After stage2 --all-imports:
+ # TODO: use this form after implementing a fixer to consolidate
+ # __future__ imports into a single line:
+ # self.headers2 = """
+ # from __future__ import (absolute_import, division,
+ # print_function, unicode_literals)
+ # from future import standard_library
+ # from future.builtins import *
+ # """
+ self.headers2 = reformat_code("""
+ from __future__ import absolute_import
+ from __future__ import division
+ from __future__ import print_function
+ from __future__ import unicode_literals
+ from future import standard_library
+ standard_library.install_aliases()
+ from builtins import *
+ """)
+ self.interpreters = [sys.executable]
+ self.tempdir = tempfile.mkdtemp() + os.path.sep
+ pypath = os.getenv('PYTHONPATH')
+ if pypath:
+ self.env = {'PYTHONPATH': os.getcwd() + os.pathsep + pypath}
+ else:
+ self.env = {'PYTHONPATH': os.getcwd()}
+
+ def convert(self, code, stages=(1, 2), all_imports=False, from3=False,
+ reformat=True, run=True, conservative=False):
+ """
+ Converts the code block using ``futurize`` and returns the
+ resulting code.
+
+ Passing stages=[1] or stages=[2] passes the flag ``--stage1`` or
+ ``stage2`` to ``futurize``. Passing both stages runs ``futurize``
+ with both stages by default.
+
+ If from3 is False, runs ``futurize``, converting from Python 2 to
+ both 2 and 3. If from3 is True, runs ``pasteurize`` to convert
+ from Python 3 to both 2 and 3.
+
+ Optionally reformats the code block first using the reformat() function.
+
+ If run is True, runs the resulting code under all Python
+ interpreters in self.interpreters.
+ """
+ if reformat:
+ code = reformat_code(code)
+ self._write_test_script(code)
+ self._futurize_test_script(stages=stages, all_imports=all_imports,
+ from3=from3, conservative=conservative)
+ output = self._read_test_script()
+ if run:
+ for interpreter in self.interpreters:
+ _ = self._run_test_script(interpreter=interpreter)
+ return output
+
+ def compare(self, output, expected, ignore_imports=True):
+ """
+ Compares whether the code blocks are equal. If not, raises an
+ exception so the test fails. Ignores any trailing whitespace like
+ blank lines.
+
+ If ignore_imports is True, passes the code blocks into the
+ strip_future_imports method.
+
+ If one code block is a unicode string and the other a
+ byte-string, it assumes the byte-string is encoded as utf-8.
+ """
+ if ignore_imports:
+ output = self.strip_future_imports(output)
+ expected = self.strip_future_imports(expected)
+ if isinstance(output, bytes) and not isinstance(expected, bytes):
+ output = output.decode('utf-8')
+ if isinstance(expected, bytes) and not isinstance(output, bytes):
+ expected = expected.decode('utf-8')
+ self.assertEqual(order_future_lines(output.rstrip()),
+ expected.rstrip())
+
+ def strip_future_imports(self, code):
+ """
+ Strips any of these import lines:
+
+ from __future__ import
+ from future
+ from future.
+ from builtins
+
+ or any line containing:
+ install_hooks()
+ or:
+ install_aliases()
+
+ Limitation: doesn't handle imports split across multiple lines like
+ this:
+
+ from __future__ import (absolute_import, division, print_function,
+ unicode_literals)
+ """
+ output = []
+ # We need .splitlines(keepends=True), which doesn't exist on Py2,
+ # so we use this instead:
+ for line in code.split('\n'):
+ if not (line.startswith('from __future__ import ')
+ or line.startswith('from future ')
+ or line.startswith('from builtins ')
+ or 'install_hooks()' in line
+ or 'install_aliases()' in line
+ # but don't match "from future_builtins" :)
+ or line.startswith('from future.')):
+ output.append(line)
+ return '\n'.join(output)
+
+ def convert_check(self, before, expected, stages=(1, 2), all_imports=False,
+ ignore_imports=True, from3=False, run=True,
+ conservative=False):
+ """
+ Convenience method that calls convert() and compare().
+
+ Reformats the code blocks automatically using the reformat_code()
+ function.
+
+ If all_imports is passed, we add the appropriate import headers
+ for the stage(s) selected to the ``expected`` code-block, so they
+ needn't appear repeatedly in the test code.
+
+ If ignore_imports is True, ignores the presence of any lines
+ beginning:
+
+ from __future__ import ...
+ from future import ...
+
+ for the purpose of the comparison.
+ """
+ output = self.convert(before, stages=stages, all_imports=all_imports,
+ from3=from3, run=run, conservative=conservative)
+ if all_imports:
+ headers = self.headers2 if 2 in stages else self.headers1
+ else:
+ headers = ''
+
+ self.compare(output, headers + reformat_code(expected),
+ ignore_imports=ignore_imports)
+
+ def unchanged(self, code, **kwargs):
+ """
+ Convenience method to ensure the code is unchanged by the
+ futurize process.
+ """
+ self.convert_check(code, code, **kwargs)
+
+ def _write_test_script(self, code, filename='mytestscript.py'):
+ """
+ Dedents the given code (a multiline string) and writes it out to
+ a file in a temporary folder like /tmp/tmpUDCn7x/mytestscript.py.
+ """
+ if isinstance(code, bytes):
+ code = code.decode('utf-8')
+ # Be explicit about encoding the temp file as UTF-8 (issue #63):
+ with io.open(self.tempdir + filename, 'wt', encoding='utf-8') as f:
+ f.write(dedent(code))
+
+ def _read_test_script(self, filename='mytestscript.py'):
+ with io.open(self.tempdir + filename, 'rt', encoding='utf-8') as f:
+ newsource = f.read()
+ return newsource
+
+ def _futurize_test_script(self, filename='mytestscript.py', stages=(1, 2),
+ all_imports=False, from3=False,
+ conservative=False):
+ params = []
+ stages = list(stages)
+ if all_imports:
+ params.append('--all-imports')
+ if from3:
+ script = 'pasteurize.py'
+ else:
+ script = 'futurize.py'
+ if stages == [1]:
+ params.append('--stage1')
+ elif stages == [2]:
+ params.append('--stage2')
+ else:
+ assert stages == [1, 2]
+ if conservative:
+ params.append('--conservative')
+ # No extra params needed
+
+ # Absolute file path:
+ fn = self.tempdir + filename
+ call_args = [sys.executable, script] + params + ['-w', fn]
+ try:
+ output = check_output(call_args, stderr=STDOUT, env=self.env)
+ except CalledProcessError as e:
+ with open(fn) as f:
+ msg = (
+ 'Error running the command %s\n'
+ '%s\n'
+ 'Contents of file %s:\n'
+ '\n'
+ '%s') % (
+ ' '.join(call_args),
+ 'env=%s' % self.env,
+ fn,
+ '----\n%s\n----' % f.read(),
+ )
+ ErrorClass = (FuturizeError if 'futurize' in script else PasteurizeError)
+ raise ErrorClass(msg, e.returncode, e.cmd, output=e.output)
+ return output
+
+ def _run_test_script(self, filename='mytestscript.py',
+ interpreter=sys.executable):
+ # Absolute file path:
+ fn = self.tempdir + filename
+ try:
+ output = check_output([interpreter, fn],
+ env=self.env, stderr=STDOUT)
+ except CalledProcessError as e:
+ with open(fn) as f:
+ msg = (
+ 'Error running the command %s\n'
+ '%s\n'
+ 'Contents of file %s:\n'
+ '\n'
+ '%s') % (
+ ' '.join([interpreter, fn]),
+ 'env=%s' % self.env,
+ fn,
+ '----\n%s\n----' % f.read(),
+ )
+ raise VerboseCalledProcessError(msg, e.returncode, e.cmd, output=e.output)
+ return output
+
+
+# Decorator to skip some tests on Python 2.6 ...
+skip26 = unittest.skipIf(PY26, "this test is known to fail on Py2.6")
+
+
+def expectedFailurePY3(func):
+ if not PY3:
+ return func
+ return unittest.expectedFailure(func)
+
+
+def expectedFailurePY26(func):
+ if not PY26:
+ return func
+ return unittest.expectedFailure(func)
+
+
+def expectedFailurePY2(func):
+ if not PY2:
+ return func
+ return unittest.expectedFailure(func)
+
+
+# Renamed in Py3.3:
+if not hasattr(unittest.TestCase, 'assertRaisesRegex'):
+ unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
+
+# From Py3.3:
+def assertRegex(self, text, expected_regex, msg=None):
+ """Fail the test unless the text matches the regular expression."""
+ if isinstance(expected_regex, (str, unicode)):
+ assert expected_regex, "expected_regex must not be empty."
+ expected_regex = re.compile(expected_regex)
+ if not expected_regex.search(text):
+ msg = msg or "Regex didn't match"
+ msg = '%s: %r not found in %r' % (msg, expected_regex.pattern, text)
+ raise self.failureException(msg)
+
+if not hasattr(unittest.TestCase, 'assertRegex'):
+ bind_method(unittest.TestCase, 'assertRegex', assertRegex)
+
+class _AssertRaisesBaseContext(object):
+
+ def __init__(self, expected, test_case, callable_obj=None,
+ expected_regex=None):
+ self.expected = expected
+ self.test_case = test_case
+ if callable_obj is not None:
+ try:
+ self.obj_name = callable_obj.__name__
+ except AttributeError:
+ self.obj_name = str(callable_obj)
+ else:
+ self.obj_name = None
+ if isinstance(expected_regex, (bytes, str)):
+ expected_regex = re.compile(expected_regex)
+ self.expected_regex = expected_regex
+ self.msg = None
+
+ def _raiseFailure(self, standardMsg):
+ msg = self.test_case._formatMessage(self.msg, standardMsg)
+ raise self.test_case.failureException(msg)
+
+ def handle(self, name, callable_obj, args, kwargs):
+ """
+ If callable_obj is None, assertRaises/Warns is being used as a
+ context manager, so check for a 'msg' kwarg and return self.
+ If callable_obj is not None, call it passing args and kwargs.
+ """
+ if callable_obj is None:
+ self.msg = kwargs.pop('msg', None)
+ return self
+ with self:
+ callable_obj(*args, **kwargs)
+
+class _AssertWarnsContext(_AssertRaisesBaseContext):
+ """A context manager used to implement TestCase.assertWarns* methods."""
+
+ def __enter__(self):
+ # The __warningregistry__'s need to be in a pristine state for tests
+ # to work properly.
+ for v in sys.modules.values():
+ if getattr(v, '__warningregistry__', None):
+ v.__warningregistry__ = {}
+ self.warnings_manager = warnings.catch_warnings(record=True)
+ self.warnings = self.warnings_manager.__enter__()
+ warnings.simplefilter("always", self.expected)
+ return self
+
+ def __exit__(self, exc_type, exc_value, tb):
+ self.warnings_manager.__exit__(exc_type, exc_value, tb)
+ if exc_type is not None:
+ # let unexpected exceptions pass through
+ return
+ try:
+ exc_name = self.expected.__name__
+ except AttributeError:
+ exc_name = str(self.expected)
+ first_matching = None
+ for m in self.warnings:
+ w = m.message
+ if not isinstance(w, self.expected):
+ continue
+ if first_matching is None:
+ first_matching = w
+ if (self.expected_regex is not None and
+ not self.expected_regex.search(str(w))):
+ continue
+ # store warning for later retrieval
+ self.warning = w
+ self.filename = m.filename
+ self.lineno = m.lineno
+ return
+ # Now we simply try to choose a helpful failure message
+ if first_matching is not None:
+ self._raiseFailure('"{}" does not match "{}"'.format(
+ self.expected_regex.pattern, str(first_matching)))
+ if self.obj_name:
+ self._raiseFailure("{} not triggered by {}".format(exc_name,
+ self.obj_name))
+ else:
+ self._raiseFailure("{} not triggered".format(exc_name))
+
+
+def assertWarns(self, expected_warning, callable_obj=None, *args, **kwargs):
+ """Fail unless a warning of class warnClass is triggered
+ by callable_obj when invoked with arguments args and keyword
+ arguments kwargs. If a different type of warning is
+ triggered, it will not be handled: depending on the other
+ warning filtering rules in effect, it might be silenced, printed
+ out, or raised as an exception.
+
+ If called with callable_obj omitted or None, will return a
+ context object used like this::
+
+ with self.assertWarns(SomeWarning):
+ do_something()
+
+ An optional keyword argument 'msg' can be provided when assertWarns
+ is used as a context object.
+
+ The context manager keeps a reference to the first matching
+ warning as the 'warning' attribute; similarly, the 'filename'
+ and 'lineno' attributes give you information about the line
+ of Python code from which the warning was triggered.
+ This allows you to inspect the warning after the assertion::
+
+ with self.assertWarns(SomeWarning) as cm:
+ do_something()
+ the_warning = cm.warning
+ self.assertEqual(the_warning.some_attribute, 147)
+ """
+ context = _AssertWarnsContext(expected_warning, self, callable_obj)
+ return context.handle('assertWarns', callable_obj, args, kwargs)
+
+if not hasattr(unittest.TestCase, 'assertWarns'):
+ bind_method(unittest.TestCase, 'assertWarns', assertWarns)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/__init__.py
new file mode 100644
index 0000000..71279bb
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/__init__.py
@@ -0,0 +1,258 @@
+"""
+This module contains backports the data types that were significantly changed
+in the transition from Python 2 to Python 3.
+
+- an implementation of Python 3's bytes object (pure Python subclass of
+ Python 2's builtin 8-bit str type)
+- an implementation of Python 3's str object (pure Python subclass of
+ Python 2's builtin unicode type)
+- a backport of the range iterator from Py3 with slicing support
+
+It is used as follows::
+
+ from __future__ import division, absolute_import, print_function
+ from builtins import bytes, dict, int, range, str
+
+to bring in the new semantics for these functions from Python 3. And
+then, for example::
+
+ b = bytes(b'ABCD')
+ assert list(b) == [65, 66, 67, 68]
+ assert repr(b) == "b'ABCD'"
+ assert [65, 66] in b
+
+ # These raise TypeErrors:
+ # b + u'EFGH'
+ # b.split(u'B')
+ # bytes(b',').join([u'Fred', u'Bill'])
+
+
+ s = str(u'ABCD')
+
+ # These raise TypeErrors:
+ # s.join([b'Fred', b'Bill'])
+ # s.startswith(b'A')
+ # b'B' in s
+ # s.find(b'A')
+ # s.replace(u'A', b'a')
+
+ # This raises an AttributeError:
+ # s.decode('utf-8')
+
+ assert repr(s) == 'ABCD' # consistent repr with Py3 (no u prefix)
+
+
+ for i in range(10**11)[:10]:
+ pass
+
+and::
+
+ class VerboseList(list):
+ def append(self, item):
+ print('Adding an item')
+ super().append(item) # new simpler super() function
+
+For more information:
+---------------------
+
+- future.types.newbytes
+- future.types.newdict
+- future.types.newint
+- future.types.newobject
+- future.types.newrange
+- future.types.newstr
+
+
+Notes
+=====
+
+range()
+-------
+``range`` is a custom class that backports the slicing behaviour from
+Python 3 (based on the ``xrange`` module by Dan Crosta). See the
+``newrange`` module docstring for more details.
+
+
+super()
+-------
+``super()`` is based on Ryan Kelly's ``magicsuper`` module. See the
+``newsuper`` module docstring for more details.
+
+
+round()
+-------
+Python 3 modifies the behaviour of ``round()`` to use "Banker's Rounding".
+See http://stackoverflow.com/a/10825998. See the ``newround`` module
+docstring for more details.
+
+"""
+
+from __future__ import absolute_import, division, print_function
+
+import functools
+from numbers import Integral
+
+from future import utils
+
+
+# Some utility functions to enforce strict type-separation of unicode str and
+# bytes:
+def disallow_types(argnums, disallowed_types):
+ """
+ A decorator that raises a TypeError if any of the given numbered
+ arguments is of the corresponding given type (e.g. bytes or unicode
+ string).
+
+ For example:
+
+ @disallow_types([0, 1], [unicode, bytes])
+ def f(a, b):
+ pass
+
+ raises a TypeError when f is called if a unicode object is passed as
+ `a` or a bytes object is passed as `b`.
+
+ This also skips over keyword arguments, so
+
+ @disallow_types([0, 1], [unicode, bytes])
+ def g(a, b=None):
+ pass
+
+ doesn't raise an exception if g is called with only one argument a,
+ e.g.:
+
+ g(b'Byte string')
+
+ Example use:
+
+ >>> class newbytes(object):
+ ... @disallow_types([1], [unicode])
+ ... def __add__(self, other):
+ ... pass
+
+ >>> newbytes('1234') + u'1234' #doctest: +IGNORE_EXCEPTION_DETAIL
+ Traceback (most recent call last):
+ ...
+ TypeError: can't concat 'bytes' to (unicode) str
+ """
+
+ def decorator(function):
+
+ @functools.wraps(function)
+ def wrapper(*args, **kwargs):
+ # These imports are just for this decorator, and are defined here
+ # to prevent circular imports:
+ from .newbytes import newbytes
+ from .newint import newint
+ from .newstr import newstr
+
+ errmsg = "argument can't be {0}"
+ for (argnum, mytype) in zip(argnums, disallowed_types):
+ # Handle the case where the type is passed as a string like 'newbytes'.
+ if isinstance(mytype, str) or isinstance(mytype, bytes):
+ mytype = locals()[mytype]
+
+ # Only restrict kw args only if they are passed:
+ if len(args) <= argnum:
+ break
+
+ # Here we use type() rather than isinstance() because
+ # __instancecheck__ is being overridden. E.g.
+ # isinstance(b'abc', newbytes) is True on Py2.
+ if type(args[argnum]) == mytype:
+ raise TypeError(errmsg.format(mytype))
+
+ return function(*args, **kwargs)
+ return wrapper
+ return decorator
+
+
+def no(mytype, argnums=(1,)):
+ """
+ A shortcut for the disallow_types decorator that disallows only one type
+ (in any position in argnums).
+
+ Example use:
+
+ >>> class newstr(object):
+ ... @no('bytes')
+ ... def __add__(self, other):
+ ... pass
+
+ >>> newstr(u'1234') + b'1234' #doctest: +IGNORE_EXCEPTION_DETAIL
+ Traceback (most recent call last):
+ ...
+ TypeError: argument can't be bytes
+
+ The object can also be passed directly, but passing the string helps
+ to prevent circular import problems.
+ """
+ if isinstance(argnums, Integral):
+ argnums = (argnums,)
+ disallowed_types = [mytype] * len(argnums)
+ return disallow_types(argnums, disallowed_types)
+
+
+def issubset(list1, list2):
+ """
+ Examples:
+
+ >>> issubset([], [65, 66, 67])
+ True
+ >>> issubset([65], [65, 66, 67])
+ True
+ >>> issubset([65, 66], [65, 66, 67])
+ True
+ >>> issubset([65, 67], [65, 66, 67])
+ False
+ """
+ n = len(list1)
+ for startpos in range(len(list2) - n + 1):
+ if list2[startpos:startpos+n] == list1:
+ return True
+ return False
+
+
+if utils.PY3:
+ import builtins
+ bytes = builtins.bytes
+ dict = builtins.dict
+ int = builtins.int
+ list = builtins.list
+ object = builtins.object
+ range = builtins.range
+ str = builtins.str
+
+ # The identity mapping
+ newtypes = {bytes: bytes,
+ dict: dict,
+ int: int,
+ list: list,
+ object: object,
+ range: range,
+ str: str}
+
+ __all__ = ['newtypes']
+
+else:
+
+ from .newbytes import newbytes
+ from .newdict import newdict
+ from .newint import newint
+ from .newlist import newlist
+ from .newrange import newrange
+ from .newobject import newobject
+ from .newstr import newstr
+
+ newtypes = {bytes: newbytes,
+ dict: newdict,
+ int: newint,
+ long: newint,
+ list: newlist,
+ object: newobject,
+ range: newrange,
+ str: newbytes,
+ unicode: newstr}
+
+ __all__ = ['newbytes', 'newdict', 'newint', 'newlist', 'newrange', 'newstr', 'newtypes']
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newbytes.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newbytes.py
new file mode 100644
index 0000000..2f96be6
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newbytes.py
@@ -0,0 +1,411 @@
+"""
+Pure-Python implementation of a Python 3-like bytes object for Python 2.
+
+Why do this? Without it, the Python 2 bytes object is a very, very
+different beast to the Python 3 bytes object.
+"""
+
+from collections import Iterable
+from numbers import Integral
+import string
+
+from future.utils import istext, isbytes, PY3, with_metaclass
+from future.types import no, issubset
+from future.types.newobject import newobject
+
+
+_builtin_bytes = bytes
+
+if PY3:
+ # We'll probably never use newstr on Py3 anyway...
+ unicode = str
+
+
+class BaseNewBytes(type):
+ def __instancecheck__(cls, instance):
+ if cls == newbytes:
+ return isinstance(instance, _builtin_bytes)
+ else:
+ return issubclass(instance.__class__, cls)
+
+
+class newbytes(with_metaclass(BaseNewBytes, _builtin_bytes)):
+ """
+ A backport of the Python 3 bytes object to Py2
+ """
+ def __new__(cls, *args, **kwargs):
+ """
+ From the Py3 bytes docstring:
+
+ bytes(iterable_of_ints) -> bytes
+ bytes(string, encoding[, errors]) -> bytes
+ bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer
+ bytes(int) -> bytes object of size given by the parameter initialized with null bytes
+ bytes() -> empty bytes object
+
+ Construct an immutable array of bytes from:
+ - an iterable yielding integers in range(256)
+ - a text string encoded using the specified encoding
+ - any object implementing the buffer API.
+ - an integer
+ """
+
+ encoding = None
+ errors = None
+
+ if len(args) == 0:
+ return super(newbytes, cls).__new__(cls)
+ elif len(args) >= 2:
+ args = list(args)
+ if len(args) == 3:
+ errors = args.pop()
+ encoding=args.pop()
+ # Was: elif isinstance(args[0], newbytes):
+ # We use type() instead of the above because we're redefining
+ # this to be True for all unicode string subclasses. Warning:
+ # This may render newstr un-subclassable.
+ if type(args[0]) == newbytes:
+ # Special-case: for consistency with Py3.3, we return the same object
+ # (with the same id) if a newbytes object is passed into the
+ # newbytes constructor.
+ return args[0]
+ elif isinstance(args[0], _builtin_bytes):
+ value = args[0]
+ elif isinstance(args[0], unicode):
+ try:
+ if 'encoding' in kwargs:
+ assert encoding is None
+ encoding = kwargs['encoding']
+ if 'errors' in kwargs:
+ assert errors is None
+ errors = kwargs['errors']
+ except AssertionError:
+ raise TypeError('Argument given by name and position')
+ if encoding is None:
+ raise TypeError('unicode string argument without an encoding')
+ ###
+ # Was: value = args[0].encode(**kwargs)
+ # Python 2.6 string encode() method doesn't take kwargs:
+ # Use this instead:
+ newargs = [encoding]
+ if errors is not None:
+ newargs.append(errors)
+ value = args[0].encode(*newargs)
+ ###
+ elif isinstance(args[0], Iterable):
+ if len(args[0]) == 0:
+ # This could be an empty list or tuple. Return b'' as on Py3.
+ value = b''
+ else:
+ # Was: elif len(args[0])>0 and isinstance(args[0][0], Integral):
+ # # It's a list of integers
+ # But then we can't index into e.g. frozensets. Try to proceed
+ # anyway.
+ try:
+ values = [chr(x) for x in args[0]]
+ value = b''.join(values)
+ except:
+ raise ValueError('bytes must be in range(0, 256)')
+ elif isinstance(args[0], Integral):
+ if args[0] < 0:
+ raise ValueError('negative count')
+ value = b'\x00' * args[0]
+ else:
+ value = args[0]
+ return super(newbytes, cls).__new__(cls, value)
+
+ def __repr__(self):
+ return 'b' + super(newbytes, self).__repr__()
+
+ def __str__(self):
+ return 'b' + "'{0}'".format(super(newbytes, self).__str__())
+
+ def __getitem__(self, y):
+ value = super(newbytes, self).__getitem__(y)
+ if isinstance(y, Integral):
+ return ord(value)
+ else:
+ return newbytes(value)
+
+ def __getslice__(self, *args):
+ return self.__getitem__(slice(*args))
+
+ def __contains__(self, key):
+ if isinstance(key, int):
+ newbyteskey = newbytes([key])
+ # Don't use isinstance() here because we only want to catch
+ # newbytes, not Python 2 str:
+ elif type(key) == newbytes:
+ newbyteskey = key
+ else:
+ newbyteskey = newbytes(key)
+ return issubset(list(newbyteskey), list(self))
+
+ @no(unicode)
+ def __add__(self, other):
+ return newbytes(super(newbytes, self).__add__(other))
+
+ @no(unicode)
+ def __radd__(self, left):
+ return newbytes(left) + self
+
+ @no(unicode)
+ def __mul__(self, other):
+ return newbytes(super(newbytes, self).__mul__(other))
+
+ @no(unicode)
+ def __rmul__(self, other):
+ return newbytes(super(newbytes, self).__rmul__(other))
+
+ def join(self, iterable_of_bytes):
+ errmsg = 'sequence item {0}: expected bytes, {1} found'
+ if isbytes(iterable_of_bytes) or istext(iterable_of_bytes):
+ raise TypeError(errmsg.format(0, type(iterable_of_bytes)))
+ for i, item in enumerate(iterable_of_bytes):
+ if istext(item):
+ raise TypeError(errmsg.format(i, type(item)))
+ return newbytes(super(newbytes, self).join(iterable_of_bytes))
+
+ @classmethod
+ def fromhex(cls, string):
+ # Only on Py2:
+ return cls(string.replace(' ', '').decode('hex'))
+
+ @no(unicode)
+ def find(self, sub, *args):
+ return super(newbytes, self).find(sub, *args)
+
+ @no(unicode)
+ def rfind(self, sub, *args):
+ return super(newbytes, self).rfind(sub, *args)
+
+ @no(unicode, (1, 2))
+ def replace(self, old, new, *args):
+ return newbytes(super(newbytes, self).replace(old, new, *args))
+
+ def encode(self, *args):
+ raise AttributeError("encode method has been disabled in newbytes")
+
+ def decode(self, encoding='utf-8', errors='strict'):
+ """
+ Returns a newstr (i.e. unicode subclass)
+
+ Decode B using the codec registered for encoding. Default encoding
+ is 'utf-8'. errors may be given to set a different error
+ handling scheme. Default is 'strict' meaning that encoding errors raise
+ a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'
+ as well as any other name registered with codecs.register_error that is
+ able to handle UnicodeDecodeErrors.
+ """
+ # Py2 str.encode() takes encoding and errors as optional parameter,
+ # not keyword arguments as in Python 3 str.
+
+ from future.types.newstr import newstr
+ return newstr(super(newbytes, self).decode(encoding, errors))
+
+ # This is currently broken:
+ # # We implement surrogateescape error handling here in addition rather
+ # # than relying on the custom error handler from
+ # # future.utils.surrogateescape to be registered globally, even though
+ # # that is fine in the case of decoding. (But not encoding: see the
+ # # comments in newstr.encode()``.)
+ #
+ # if errors == 'surrogateescape':
+ # # Decode char by char
+ # mybytes = []
+ # for code in self:
+ # # Code is an int
+ # if 0x80 <= code <= 0xFF:
+ # b = 0xDC00 + code
+ # elif code <= 0x7F:
+ # b = _unichr(c).decode(encoding=encoding)
+ # else:
+ # # # It may be a bad byte
+ # # FIXME: What to do in this case? See the Py3 docs / tests.
+ # # # Try swallowing it.
+ # # continue
+ # # print("RAISE!")
+ # raise NotASurrogateError
+ # mybytes.append(b)
+ # return newbytes(mybytes)
+ # return newbytes(super(newstr, self).decode(encoding, errors))
+
+ @no(unicode)
+ def startswith(self, prefix, *args):
+ return super(newbytes, self).startswith(prefix, *args)
+
+ @no(unicode)
+ def endswith(self, prefix, *args):
+ return super(newbytes, self).endswith(prefix, *args)
+
+ @no(unicode)
+ def split(self, sep=None, maxsplit=-1):
+ # Py2 str.split() takes maxsplit as an optional parameter, not as a
+ # keyword argument as in Python 3 bytes.
+ parts = super(newbytes, self).split(sep, maxsplit)
+ return [newbytes(part) for part in parts]
+
+ def splitlines(self, keepends=False):
+ """
+ B.splitlines([keepends]) -> list of lines
+
+ Return a list of the lines in B, breaking at line boundaries.
+ Line breaks are not included in the resulting list unless keepends
+ is given and true.
+ """
+ # Py2 str.splitlines() takes keepends as an optional parameter,
+ # not as a keyword argument as in Python 3 bytes.
+ parts = super(newbytes, self).splitlines(keepends)
+ return [newbytes(part) for part in parts]
+
+ @no(unicode)
+ def rsplit(self, sep=None, maxsplit=-1):
+ # Py2 str.rsplit() takes maxsplit as an optional parameter, not as a
+ # keyword argument as in Python 3 bytes.
+ parts = super(newbytes, self).rsplit(sep, maxsplit)
+ return [newbytes(part) for part in parts]
+
+ @no(unicode)
+ def partition(self, sep):
+ parts = super(newbytes, self).partition(sep)
+ return tuple(newbytes(part) for part in parts)
+
+ @no(unicode)
+ def rpartition(self, sep):
+ parts = super(newbytes, self).rpartition(sep)
+ return tuple(newbytes(part) for part in parts)
+
+ @no(unicode, (1,))
+ def rindex(self, sub, *args):
+ '''
+ S.rindex(sub [,start [,end]]) -> int
+
+ Like S.rfind() but raise ValueError when the substring is not found.
+ '''
+ pos = self.rfind(sub, *args)
+ if pos == -1:
+ raise ValueError('substring not found')
+
+ @no(unicode)
+ def index(self, sub, *args):
+ '''
+ Returns index of sub in bytes.
+ Raises ValueError if byte is not in bytes and TypeError if can't
+ be converted bytes or its length is not 1.
+ '''
+ if isinstance(sub, int):
+ if len(args) == 0:
+ start, end = 0, len(self)
+ elif len(args) == 1:
+ start = args[0]
+ elif len(args) == 2:
+ start, end = args
+ else:
+ raise TypeError('takes at most 3 arguments')
+ return list(self)[start:end].index(sub)
+ if not isinstance(sub, bytes):
+ try:
+ sub = self.__class__(sub)
+ except (TypeError, ValueError):
+ raise TypeError("can't convert sub to bytes")
+ try:
+ return super(newbytes, self).index(sub, *args)
+ except ValueError:
+ raise ValueError('substring not found')
+
+ def __eq__(self, other):
+ if isinstance(other, (_builtin_bytes, bytearray)):
+ return super(newbytes, self).__eq__(other)
+ else:
+ return False
+
+ def __ne__(self, other):
+ if isinstance(other, _builtin_bytes):
+ return super(newbytes, self).__ne__(other)
+ else:
+ return True
+
+ unorderable_err = 'unorderable types: bytes() and {0}'
+
+ def __lt__(self, other):
+ if not isbytes(other):
+ raise TypeError(self.unorderable_err.format(type(other)))
+ return super(newbytes, self).__lt__(other)
+
+ def __le__(self, other):
+ if not isbytes(other):
+ raise TypeError(self.unorderable_err.format(type(other)))
+ return super(newbytes, self).__le__(other)
+
+ def __gt__(self, other):
+ if not isbytes(other):
+ raise TypeError(self.unorderable_err.format(type(other)))
+ return super(newbytes, self).__gt__(other)
+
+ def __ge__(self, other):
+ if not isbytes(other):
+ raise TypeError(self.unorderable_err.format(type(other)))
+ return super(newbytes, self).__ge__(other)
+
+ def __native__(self):
+ # We can't just feed a newbytes object into str(), because
+ # newbytes.__str__() returns e.g. "b'blah'", consistent with Py3 bytes.
+ return super(newbytes, self).__str__()
+
+ def __getattribute__(self, name):
+ """
+ A trick to cause the ``hasattr`` builtin-fn to return False for
+ the 'encode' method on Py2.
+ """
+ if name in ['encode', u'encode']:
+ raise AttributeError("encode method has been disabled in newbytes")
+ return super(newbytes, self).__getattribute__(name)
+
+ @no(unicode)
+ def rstrip(self, bytes_to_strip=None):
+ """
+ Strip trailing bytes contained in the argument.
+ If the argument is omitted, strip trailing ASCII whitespace.
+ """
+ return newbytes(super(newbytes, self).rstrip(bytes_to_strip))
+
+ @no(unicode)
+ def strip(self, bytes_to_strip=None):
+ """
+ Strip leading and trailing bytes contained in the argument.
+ If the argument is omitted, strip trailing ASCII whitespace.
+ """
+ return newbytes(super(newbytes, self).strip(bytes_to_strip))
+
+ def lower(self):
+ """
+ b.lower() -> copy of b
+
+ Return a copy of b with all ASCII characters converted to lowercase.
+ """
+ return newbytes(super(newbytes, self).lower())
+
+ @no(unicode)
+ def upper(self):
+ """
+ b.upper() -> copy of b
+
+ Return a copy of b with all ASCII characters converted to uppercase.
+ """
+ return newbytes(super(newbytes, self).upper())
+
+ @classmethod
+ @no(unicode)
+ def maketrans(cls, frm, to):
+ """
+ B.maketrans(frm, to) -> translation table
+
+ Return a translation table (a bytes object of length 256) suitable
+ for use in the bytes or bytearray translate method where each byte
+ in frm is mapped to the byte at the same position in to.
+ The bytes objects frm and to must be of the same length.
+ """
+ return newbytes(string.maketrans(frm, to))
+
+
+__all__ = ['newbytes']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newdict.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newdict.py
new file mode 100644
index 0000000..5dbcc4b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newdict.py
@@ -0,0 +1,111 @@
+"""
+A dict subclass for Python 2 that behaves like Python 3's dict
+
+Example use:
+
+>>> from builtins import dict
+>>> d1 = dict() # instead of {} for an empty dict
+>>> d2 = dict(key1='value1', key2='value2')
+
+The keys, values and items methods now return iterators on Python 2.x
+(with set-like behaviour on Python 2.7).
+
+>>> for d in (d1, d2):
+... assert not isinstance(d.keys(), list)
+... assert not isinstance(d.values(), list)
+... assert not isinstance(d.items(), list)
+"""
+
+import sys
+
+from future.utils import with_metaclass
+from future.types.newobject import newobject
+
+
+_builtin_dict = dict
+ver = sys.version_info[:2]
+
+
+class BaseNewDict(type):
+ def __instancecheck__(cls, instance):
+ if cls == newdict:
+ return isinstance(instance, _builtin_dict)
+ else:
+ return issubclass(instance.__class__, cls)
+
+
+class newdict(with_metaclass(BaseNewDict, _builtin_dict)):
+ """
+ A backport of the Python 3 dict object to Py2
+ """
+ def items(self):
+ """
+ On Python 2.7+:
+ D.items() -> a set-like object providing a view on D's items
+ On Python 2.6:
+ D.items() -> an iterator over D's items
+ """
+ if ver == (2, 7):
+ return self.viewitems()
+ elif ver == (2, 6):
+ return self.iteritems()
+ elif ver >= (3, 0):
+ return self.items()
+
+ def keys(self):
+ """
+ On Python 2.7+:
+ D.keys() -> a set-like object providing a view on D's keys
+ On Python 2.6:
+ D.keys() -> an iterator over D's keys
+ """
+ if ver == (2, 7):
+ return self.viewkeys()
+ elif ver == (2, 6):
+ return self.iterkeys()
+ elif ver >= (3, 0):
+ return self.keys()
+
+ def values(self):
+ """
+ On Python 2.7+:
+ D.values() -> a set-like object providing a view on D's values
+ On Python 2.6:
+ D.values() -> an iterator over D's values
+ """
+ if ver == (2, 7):
+ return self.viewvalues()
+ elif ver == (2, 6):
+ return self.itervalues()
+ elif ver >= (3, 0):
+ return self.values()
+
+ def __new__(cls, *args, **kwargs):
+ """
+ dict() -> new empty dictionary
+ dict(mapping) -> new dictionary initialized from a mapping object's
+ (key, value) pairs
+ dict(iterable) -> new dictionary initialized as if via:
+ d = {}
+ for k, v in iterable:
+ d[k] = v
+ dict(**kwargs) -> new dictionary initialized with the name=value pairs
+ in the keyword argument list. For example: dict(one=1, two=2)
+ """
+
+ if len(args) == 0:
+ return super(newdict, cls).__new__(cls)
+ elif type(args[0]) == newdict:
+ value = args[0]
+ else:
+ value = args[0]
+ return super(newdict, cls).__new__(cls, value)
+
+ def __native__(self):
+ """
+ Hook for the future.utils.native() function
+ """
+ return dict(self)
+
+
+__all__ = ['newdict']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newint.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newint.py
new file mode 100644
index 0000000..1917b87
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newint.py
@@ -0,0 +1,373 @@
+"""
+Backport of Python 3's int, based on Py2's long.
+
+They are very similar. The most notable difference is:
+
+- representation: trailing L in Python 2 removed in Python 3
+"""
+from __future__ import division
+
+import struct
+import collections
+
+from future.types.newbytes import newbytes
+from future.types.newobject import newobject
+from future.utils import PY3, isint, istext, isbytes, with_metaclass, native
+
+
+if PY3:
+ long = int
+
+
+class BaseNewInt(type):
+ def __instancecheck__(cls, instance):
+ if cls == newint:
+ # Special case for Py2 short or long int
+ return isinstance(instance, (int, long))
+ else:
+ return issubclass(instance.__class__, cls)
+
+
+class newint(with_metaclass(BaseNewInt, long)):
+ """
+ A backport of the Python 3 int object to Py2
+ """
+ def __new__(cls, x=0, base=10):
+ """
+ From the Py3 int docstring:
+
+ | int(x=0) -> integer
+ | int(x, base=10) -> integer
+ |
+ | Convert a number or string to an integer, or return 0 if no
+ | arguments are given. If x is a number, return x.__int__(). For
+ | floating point numbers, this truncates towards zero.
+ |
+ | If x is not a number or if base is given, then x must be a string,
+ | bytes, or bytearray instance representing an integer literal in the
+ | given base. The literal can be preceded by '+' or '-' and be
+ | surrounded by whitespace. The base defaults to 10. Valid bases are
+ | 0 and 2-36. Base 0 means to interpret the base from the string as an
+ | integer literal.
+ | >>> int('0b100', base=0)
+ | 4
+
+ """
+ try:
+ val = x.__int__()
+ except AttributeError:
+ val = x
+ else:
+ if not isint(val):
+ raise TypeError('__int__ returned non-int ({0})'.format(
+ type(val)))
+
+ if base != 10:
+ # Explicit base
+ if not (istext(val) or isbytes(val) or isinstance(val, bytearray)):
+ raise TypeError(
+ "int() can't convert non-string with explicit base")
+ try:
+ return super(newint, cls).__new__(cls, val, base)
+ except TypeError:
+ return super(newint, cls).__new__(cls, newbytes(val), base)
+ # After here, base is 10
+ try:
+ return super(newint, cls).__new__(cls, val)
+ except TypeError:
+ # Py2 long doesn't handle bytearray input with an explicit base, so
+ # handle this here.
+ # Py3: int(bytearray(b'10'), 2) == 2
+ # Py2: int(bytearray(b'10'), 2) == 2 raises TypeError
+ # Py2: long(bytearray(b'10'), 2) == 2 raises TypeError
+ try:
+ return super(newint, cls).__new__(cls, newbytes(val))
+ except:
+ raise TypeError("newint argument must be a string or a number,"
+ "not '{0}'".format(type(val)))
+
+ def __repr__(self):
+ """
+ Without the L suffix
+ """
+ value = super(newint, self).__repr__()
+ assert value[-1] == 'L'
+ return value[:-1]
+
+ def __add__(self, other):
+ value = super(newint, self).__add__(other)
+ if value is NotImplemented:
+ return long(self) + other
+ return newint(value)
+
+ def __radd__(self, other):
+ value = super(newint, self).__radd__(other)
+ if value is NotImplemented:
+ return other + long(self)
+ return newint(value)
+
+ def __sub__(self, other):
+ value = super(newint, self).__sub__(other)
+ if value is NotImplemented:
+ return long(self) - other
+ return newint(value)
+
+ def __rsub__(self, other):
+ value = super(newint, self).__rsub__(other)
+ if value is NotImplemented:
+ return other - long(self)
+ return newint(value)
+
+ def __mul__(self, other):
+ value = super(newint, self).__mul__(other)
+ if isint(value):
+ return newint(value)
+ elif value is NotImplemented:
+ return long(self) * other
+ return value
+
+ def __rmul__(self, other):
+ value = super(newint, self).__rmul__(other)
+ if isint(value):
+ return newint(value)
+ elif value is NotImplemented:
+ return other * long(self)
+ return value
+
+ def __div__(self, other):
+ # We override this rather than e.g. relying on object.__div__ or
+ # long.__div__ because we want to wrap the value in a newint()
+ # call if other is another int
+ value = long(self) / other
+ if isinstance(other, (int, long)):
+ return newint(value)
+ else:
+ return value
+
+ def __rdiv__(self, other):
+ value = other / long(self)
+ if isinstance(other, (int, long)):
+ return newint(value)
+ else:
+ return value
+
+ def __idiv__(self, other):
+ # long has no __idiv__ method. Use __itruediv__ and cast back to
+ # newint:
+ value = self.__itruediv__(other)
+ if isinstance(other, (int, long)):
+ return newint(value)
+ else:
+ return value
+
+ def __truediv__(self, other):
+ value = super(newint, self).__truediv__(other)
+ if value is NotImplemented:
+ value = long(self) / other
+ return value
+
+ def __rtruediv__(self, other):
+ return super(newint, self).__rtruediv__(other)
+
+ def __itruediv__(self, other):
+ # long has no __itruediv__ method
+ mylong = long(self)
+ mylong /= other
+ return mylong
+
+ def __floordiv__(self, other):
+ return newint(super(newint, self).__floordiv__(other))
+
+ def __rfloordiv__(self, other):
+ return newint(super(newint, self).__rfloordiv__(other))
+
+ def __ifloordiv__(self, other):
+ # long has no __ifloordiv__ method
+ mylong = long(self)
+ mylong //= other
+ return newint(mylong)
+
+ def __mod__(self, other):
+ value = super(newint, self).__mod__(other)
+ if value is NotImplemented:
+ return long(self) % other
+ return newint(value)
+
+ def __rmod__(self, other):
+ value = super(newint, self).__rmod__(other)
+ if value is NotImplemented:
+ return other % long(self)
+ return newint(value)
+
+ def __divmod__(self, other):
+ value = super(newint, self).__divmod__(other)
+ return (newint(value[0]), newint(value[1]))
+
+ def __rdivmod__(self, other):
+ value = super(newint, self).__rdivmod__(other)
+ return (newint(value[0]), newint(value[1]))
+
+ def __pow__(self, other):
+ value = super(newint, self).__pow__(other)
+ if value is NotImplemented:
+ return long(self) ** other
+ return newint(value)
+
+ def __rpow__(self, other):
+ value = super(newint, self).__rpow__(other)
+ if value is NotImplemented:
+ return other ** long(self)
+ return newint(value)
+
+ def __lshift__(self, other):
+ if not isint(other):
+ raise TypeError(
+ "unsupported operand type(s) for <<: '%s' and '%s'" %
+ (type(self).__name__, type(other).__name__))
+ return newint(super(newint, self).__lshift__(other))
+
+ def __rshift__(self, other):
+ if not isint(other):
+ raise TypeError(
+ "unsupported operand type(s) for >>: '%s' and '%s'" %
+ (type(self).__name__, type(other).__name__))
+ return newint(super(newint, self).__rshift__(other))
+
+ def __and__(self, other):
+ if not isint(other):
+ raise TypeError(
+ "unsupported operand type(s) for &: '%s' and '%s'" %
+ (type(self).__name__, type(other).__name__))
+ return newint(super(newint, self).__and__(other))
+
+ def __or__(self, other):
+ if not isint(other):
+ raise TypeError(
+ "unsupported operand type(s) for |: '%s' and '%s'" %
+ (type(self).__name__, type(other).__name__))
+ return newint(super(newint, self).__or__(other))
+
+ def __xor__(self, other):
+ if not isint(other):
+ raise TypeError(
+ "unsupported operand type(s) for ^: '%s' and '%s'" %
+ (type(self).__name__, type(other).__name__))
+ return newint(super(newint, self).__xor__(other))
+
+ def __neg__(self):
+ return newint(super(newint, self).__neg__())
+
+ def __pos__(self):
+ return newint(super(newint, self).__pos__())
+
+ def __abs__(self):
+ return newint(super(newint, self).__abs__())
+
+ def __invert__(self):
+ return newint(super(newint, self).__invert__())
+
+ def __int__(self):
+ return self
+
+ def __nonzero__(self):
+ return self.__bool__()
+
+ def __bool__(self):
+ """
+ So subclasses can override this, Py3-style
+ """
+ return super(newint, self).__nonzero__()
+
+ def __native__(self):
+ return long(self)
+
+ def to_bytes(self, length, byteorder='big', signed=False):
+ """
+ Return an array of bytes representing an integer.
+
+ The integer is represented using length bytes. An OverflowError is
+ raised if the integer is not representable with the given number of
+ bytes.
+
+ The byteorder argument determines the byte order used to represent the
+ integer. If byteorder is 'big', the most significant byte is at the
+ beginning of the byte array. If byteorder is 'little', the most
+ significant byte is at the end of the byte array. To request the native
+ byte order of the host system, use `sys.byteorder' as the byte order value.
+
+ The signed keyword-only argument determines whether two's complement is
+ used to represent the integer. If signed is False and a negative integer
+ is given, an OverflowError is raised.
+ """
+ if length < 0:
+ raise ValueError("length argument must be non-negative")
+ if length == 0 and self == 0:
+ return newbytes()
+ if signed and self < 0:
+ bits = length * 8
+ num = (2**bits) + self
+ if num <= 0:
+ raise OverflowError("int too smal to convert")
+ else:
+ if self < 0:
+ raise OverflowError("can't convert negative int to unsigned")
+ num = self
+ if byteorder not in ('little', 'big'):
+ raise ValueError("byteorder must be either 'little' or 'big'")
+ h = b'%x' % num
+ s = newbytes((b'0'*(len(h) % 2) + h).zfill(length*2).decode('hex'))
+ if signed:
+ high_set = s[0] & 0x80
+ if self > 0 and high_set:
+ raise OverflowError("int too big to convert")
+ if self < 0 and not high_set:
+ raise OverflowError("int too small to convert")
+ if len(s) > length:
+ raise OverflowError("int too big to convert")
+ return s if byteorder == 'big' else s[::-1]
+
+ @classmethod
+ def from_bytes(cls, mybytes, byteorder='big', signed=False):
+ """
+ Return the integer represented by the given array of bytes.
+
+ The mybytes argument must either support the buffer protocol or be an
+ iterable object producing bytes. Bytes and bytearray are examples of
+ built-in objects that support the buffer protocol.
+
+ The byteorder argument determines the byte order used to represent the
+ integer. If byteorder is 'big', the most significant byte is at the
+ beginning of the byte array. If byteorder is 'little', the most
+ significant byte is at the end of the byte array. To request the native
+ byte order of the host system, use `sys.byteorder' as the byte order value.
+
+ The signed keyword-only argument indicates whether two's complement is
+ used to represent the integer.
+ """
+ if byteorder not in ('little', 'big'):
+ raise ValueError("byteorder must be either 'little' or 'big'")
+ if isinstance(mybytes, unicode):
+ raise TypeError("cannot convert unicode objects to bytes")
+ # mybytes can also be passed as a sequence of integers on Py3.
+ # Test for this:
+ elif isinstance(mybytes, collections.Iterable):
+ mybytes = newbytes(mybytes)
+ b = mybytes if byteorder == 'big' else mybytes[::-1]
+ if len(b) == 0:
+ b = b'\x00'
+ # The encode() method has been disabled by newbytes, but Py2's
+ # str has it:
+ num = int(native(b).encode('hex'), 16)
+ if signed and (b[0] & 0x80):
+ num = num - (2 ** (len(b)*8))
+ return cls(num)
+
+
+# def _twos_comp(val, bits):
+# """compute the 2's compliment of int value val"""
+# if( (val&(1<<(bits-1))) != 0 ):
+# val = val - (1<>> from builtins import list
+>>> l1 = list() # instead of {} for an empty list
+>>> l1.append('hello')
+>>> l2 = l1.copy()
+
+"""
+
+import sys
+import copy
+
+from future.utils import with_metaclass
+from future.types.newobject import newobject
+
+
+_builtin_list = list
+ver = sys.version_info[:2]
+
+
+class BaseNewList(type):
+ def __instancecheck__(cls, instance):
+ if cls == newlist:
+ return isinstance(instance, _builtin_list)
+ else:
+ return issubclass(instance.__class__, cls)
+
+
+class newlist(with_metaclass(BaseNewList, _builtin_list)):
+ """
+ A backport of the Python 3 list object to Py2
+ """
+ def copy(self):
+ """
+ L.copy() -> list -- a shallow copy of L
+ """
+ return copy.copy(self)
+
+ def clear(self):
+ """L.clear() -> None -- remove all items from L"""
+ for i in range(len(self)):
+ self.pop()
+
+ def __new__(cls, *args, **kwargs):
+ """
+ list() -> new empty list
+ list(iterable) -> new list initialized from iterable's items
+ """
+
+ if len(args) == 0:
+ return super(newlist, cls).__new__(cls)
+ elif type(args[0]) == newlist:
+ value = args[0]
+ else:
+ value = args[0]
+ return super(newlist, cls).__new__(cls, value)
+
+ def __add__(self, value):
+ return newlist(super(newlist, self).__add__(value))
+
+ def __radd__(self, left):
+ " left + self "
+ try:
+ return newlist(left) + self
+ except:
+ return NotImplemented
+
+ def __getitem__(self, y):
+ """
+ x.__getitem__(y) <==> x[y]
+
+ Warning: a bug in Python 2.x prevents indexing via a slice from
+ returning a newlist object.
+ """
+ if isinstance(y, slice):
+ return newlist(super(newlist, self).__getitem__(y))
+ else:
+ return super(newlist, self).__getitem__(y)
+
+ def __native__(self):
+ """
+ Hook for the future.utils.native() function
+ """
+ return list(self)
+
+ def __nonzero__(self):
+ return len(self) > 0
+
+
+__all__ = ['newlist']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newmemoryview.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newmemoryview.py
new file mode 100644
index 0000000..72c6990
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newmemoryview.py
@@ -0,0 +1,27 @@
+"""
+A pretty lame implementation of a memoryview object for Python 2.6.
+"""
+
+from collections import Iterable
+from numbers import Integral
+import string
+
+from future.utils import istext, isbytes, PY3, with_metaclass
+from future.types import no, issubset
+
+
+# class BaseNewBytes(type):
+# def __instancecheck__(cls, instance):
+# return isinstance(instance, _builtin_bytes)
+
+
+class newmemoryview(object): # with_metaclass(BaseNewBytes, _builtin_bytes)):
+ """
+ A pretty lame backport of the Python 2.7 and Python 3.x
+ memoryviewview object to Py2.6.
+ """
+ def __init__(self, obj):
+ return obj
+
+
+__all__ = ['newmemoryview']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newobject.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newobject.py
new file mode 100644
index 0000000..59c19ea
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newobject.py
@@ -0,0 +1,132 @@
+"""
+An object subclass for Python 2 that gives new-style classes written in the
+style of Python 3 (with ``__next__`` and unicode-returning ``__str__`` methods)
+the appropriate Python 2-style ``next`` and ``__unicode__`` methods for compatible.
+
+Example use::
+
+ from builtins import object
+
+ my_unicode_str = u'Unicode string: \u5b54\u5b50'
+
+ class A(object):
+ def __str__(self):
+ return my_unicode_str
+
+ a = A()
+ print(str(a))
+
+ # On Python 2, these relations hold:
+ assert unicode(a) == my_unicode_string
+ assert str(a) == my_unicode_string.encode('utf-8')
+
+
+Another example::
+
+ from builtins import object
+
+ class Upper(object):
+ def __init__(self, iterable):
+ self._iter = iter(iterable)
+ def __next__(self): # note the Py3 interface
+ return next(self._iter).upper()
+ def __iter__(self):
+ return self
+
+ assert list(Upper('hello')) == list('HELLO')
+
+"""
+
+import sys
+
+from future.utils import with_metaclass
+
+
+_builtin_object = object
+ver = sys.version_info[:2]
+
+
+# We no longer define a metaclass for newobject because this breaks multiple
+# inheritance and custom metaclass use with this exception:
+
+# TypeError: Error when calling the metaclass bases
+# metaclass conflict: the metaclass of a derived class must be a
+# (non-strict) subclass of the metaclasses of all its bases
+
+# See issues #91 and #96.
+
+
+class newobject(object):
+ """
+ A magical object class that provides Python 2 compatibility methods::
+ next
+ __unicode__
+ __nonzero__
+
+ Subclasses of this class can merely define the Python 3 methods (__next__,
+ __str__, and __bool__).
+ """
+ def next(self):
+ if hasattr(self, '__next__'):
+ return type(self).__next__(self)
+ raise TypeError('newobject is not an iterator')
+
+ def __unicode__(self):
+ # All subclasses of the builtin object should have __str__ defined.
+ # Note that old-style classes do not have __str__ defined.
+ if hasattr(self, '__str__'):
+ s = type(self).__str__(self)
+ else:
+ s = str(self)
+ if isinstance(s, unicode):
+ return s
+ else:
+ return s.decode('utf-8')
+
+ def __nonzero__(self):
+ if hasattr(self, '__bool__'):
+ return type(self).__bool__(self)
+ # object has no __nonzero__ method
+ return True
+
+ # Are these ever needed?
+ # def __div__(self):
+ # return self.__truediv__()
+
+ # def __idiv__(self, other):
+ # return self.__itruediv__(other)
+
+ def __long__(self):
+ if not hasattr(self, '__int__'):
+ return NotImplemented
+ return self.__int__() # not type(self).__int__(self)
+
+ # def __new__(cls, *args, **kwargs):
+ # """
+ # dict() -> new empty dictionary
+ # dict(mapping) -> new dictionary initialized from a mapping object's
+ # (key, value) pairs
+ # dict(iterable) -> new dictionary initialized as if via:
+ # d = {}
+ # for k, v in iterable:
+ # d[k] = v
+ # dict(**kwargs) -> new dictionary initialized with the name=value pairs
+ # in the keyword argument list. For example: dict(one=1, two=2)
+ # """
+
+ # if len(args) == 0:
+ # return super(newdict, cls).__new__(cls)
+ # elif type(args[0]) == newdict:
+ # return args[0]
+ # else:
+ # value = args[0]
+ # return super(newdict, cls).__new__(cls, value)
+
+ def __native__(self):
+ """
+ Hook for the future.utils.native() function
+ """
+ return object(self)
+
+
+__all__ = ['newobject']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newopen.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newopen.py
new file mode 100644
index 0000000..8da0642
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newopen.py
@@ -0,0 +1,33 @@
+"""
+A substitute for the Python 3 open() function.
+
+Note that io.open() is more complete but maybe slower. Even so, the
+completeness may be a better default. TODO: compare these
+"""
+
+_builtin_open = open
+
+class newopen(object):
+ """Wrapper providing key part of Python 3 open() interface.
+
+ From IPython's py3compat.py module. License: BSD.
+ """
+ def __init__(self, fname, mode="r", encoding="utf-8"):
+ self.f = _builtin_open(fname, mode)
+ self.enc = encoding
+
+ def write(self, s):
+ return self.f.write(s.encode(self.enc))
+
+ def read(self, size=-1):
+ return self.f.read(size).decode(self.enc)
+
+ def close(self):
+ return self.f.close()
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, etype, value, traceback):
+ self.f.close()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newrange.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newrange.py
new file mode 100644
index 0000000..432f11a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newrange.py
@@ -0,0 +1,160 @@
+"""
+Nearly identical to xrange.py, by Dan Crosta, from
+
+ https://github.com/dcrosta/xrange.git
+
+This is included here in the ``future`` package rather than pointed to as
+a dependency because there is no package for ``xrange`` on PyPI. It is
+also tweaked to appear like a regular Python 3 ``range`` object rather
+than a Python 2 xrange.
+
+From Dan Crosta's README:
+
+ "A pure-Python implementation of Python 2.7's xrange built-in, with
+ some features backported from the Python 3.x range built-in (which
+ replaced xrange) in that version."
+
+ Read more at
+ https://late.am/post/2012/06/18/what-the-heck-is-an-xrange
+"""
+
+from collections import Sequence, Iterator
+from itertools import islice
+
+
+class newrange(Sequence):
+ """
+ Pure-Python backport of Python 3's range object. See `the CPython
+ documentation for details:
+ `_
+ """
+
+ def __init__(self, *args):
+ if len(args) == 1:
+ start, stop, step = 0, args[0], 1
+ elif len(args) == 2:
+ start, stop, step = args[0], args[1], 1
+ elif len(args) == 3:
+ start, stop, step = args
+ else:
+ raise TypeError('range() requires 1-3 int arguments')
+
+ try:
+ start, stop, step = int(start), int(stop), int(step)
+ except ValueError:
+ raise TypeError('an integer is required')
+
+ if step == 0:
+ raise ValueError('range() arg 3 must not be zero')
+ elif step < 0:
+ stop = min(stop, start)
+ else:
+ stop = max(stop, start)
+
+ self._start = start
+ self._stop = stop
+ self._step = step
+ self._len = (stop - start) // step + bool((stop - start) % step)
+
+ @property
+ def start(self):
+ return self._start
+
+ @property
+ def stop(self):
+ return self._stop
+
+ @property
+ def step(self):
+ return self._step
+
+ def __repr__(self):
+ if self._step == 1:
+ return 'range(%d, %d)' % (self._start, self._stop)
+ return 'range(%d, %d, %d)' % (self._start, self._stop, self._step)
+
+ def __eq__(self, other):
+ return (isinstance(other, newrange) and
+ (self._len == 0 == other._len or
+ (self._start, self._step, self._len) ==
+ (other._start, other._step, self._len)))
+
+ def __len__(self):
+ return self._len
+
+ def index(self, value):
+ """Return the 0-based position of integer `value` in
+ the sequence this range represents."""
+ diff = value - self._start
+ quotient, remainder = divmod(diff, self._step)
+ if remainder == 0 and 0 <= quotient < self._len:
+ return abs(quotient)
+ raise ValueError('%r is not in range' % value)
+
+ def count(self, value):
+ """Return the number of ocurrences of integer `value`
+ in the sequence this range represents."""
+ # a value can occur exactly zero or one times
+ return int(value in self)
+
+ def __contains__(self, value):
+ """Return ``True`` if the integer `value` occurs in
+ the sequence this range represents."""
+ try:
+ self.index(value)
+ return True
+ except ValueError:
+ return False
+
+ def __reversed__(self):
+ return iter(self[::-1])
+
+ def __getitem__(self, index):
+ """Return the element at position ``index`` in the sequence
+ this range represents, or raise :class:`IndexError` if the
+ position is out of range."""
+ if isinstance(index, slice):
+ return self.__getitem_slice(index)
+ if index < 0:
+ # negative indexes access from the end
+ index = self._len + index
+ if index < 0 or index >= self._len:
+ raise IndexError('range object index out of range')
+ return self._start + index * self._step
+
+ def __getitem_slice(self, slce):
+ """Return a range which represents the requested slce
+ of the sequence represented by this range.
+ """
+ start, stop, step = slce.indices(self._len)
+ return newrange(self._start + self._step*start,
+ self._start + stop,
+ self._step * step)
+
+ def __iter__(self):
+ """Return an iterator which enumerates the elements of the
+ sequence this range represents."""
+ return range_iterator(self)
+
+
+class range_iterator(Iterator):
+ """An iterator for a :class:`range`.
+ """
+ def __init__(self, range_):
+ self._stepper = islice(_count(range_.start, range_.step), len(range_))
+
+ def __iter__(self):
+ return self
+
+ def next(self):
+ return next(self._stepper)
+
+
+# itertools.count in Py 2.6 doesn't accept a step parameter
+def _count(start=0, step=1):
+ while True:
+ yield start
+ start += step
+
+
+__all__ = ['newrange']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newstr.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newstr.py
new file mode 100644
index 0000000..fd8615a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/types/newstr.py
@@ -0,0 +1,412 @@
+"""
+This module redefines ``str`` on Python 2.x to be a subclass of the Py2
+``unicode`` type that behaves like the Python 3.x ``str``.
+
+The main differences between ``newstr`` and Python 2.x's ``unicode`` type are
+the stricter type-checking and absence of a `u''` prefix in the representation.
+
+It is designed to be used together with the ``unicode_literals`` import
+as follows:
+
+ >>> from __future__ import unicode_literals
+ >>> from builtins import str, isinstance
+
+On Python 3.x and normally on Python 2.x, these expressions hold
+
+ >>> str('blah') is 'blah'
+ True
+ >>> isinstance('blah', str)
+ True
+
+However, on Python 2.x, with this import:
+
+ >>> from __future__ import unicode_literals
+
+the same expressions are False:
+
+ >>> str('blah') is 'blah'
+ False
+ >>> isinstance('blah', str)
+ False
+
+This module is designed to be imported together with ``unicode_literals`` on
+Python 2 to bring the meaning of ``str`` back into alignment with unprefixed
+string literals (i.e. ``unicode`` subclasses).
+
+Note that ``str()`` (and ``print()``) would then normally call the
+``__unicode__`` method on objects in Python 2. To define string
+representations of your objects portably across Py3 and Py2, use the
+:func:`python_2_unicode_compatible` decorator in :mod:`future.utils`.
+
+"""
+
+from collections import Iterable
+from numbers import Number
+
+from future.utils import PY3, istext, with_metaclass, isnewbytes
+from future.types import no, issubset
+from future.types.newobject import newobject
+
+
+if PY3:
+ # We'll probably never use newstr on Py3 anyway...
+ unicode = str
+
+
+class BaseNewStr(type):
+ def __instancecheck__(cls, instance):
+ if cls == newstr:
+ return isinstance(instance, unicode)
+ else:
+ return issubclass(instance.__class__, cls)
+
+
+class newstr(with_metaclass(BaseNewStr, unicode)):
+ """
+ A backport of the Python 3 str object to Py2
+ """
+ no_convert_msg = "Can't convert '{0}' object to str implicitly"
+
+ def __new__(cls, *args, **kwargs):
+ """
+ From the Py3 str docstring:
+
+ str(object='') -> str
+ str(bytes_or_buffer[, encoding[, errors]]) -> str
+
+ Create a new string object from the given object. If encoding or
+ errors is specified, then the object must expose a data buffer
+ that will be decoded using the given encoding and error handler.
+ Otherwise, returns the result of object.__str__() (if defined)
+ or repr(object).
+ encoding defaults to sys.getdefaultencoding().
+ errors defaults to 'strict'.
+
+ """
+ if len(args) == 0:
+ return super(newstr, cls).__new__(cls)
+ # Special case: If someone requests str(str(u'abc')), return the same
+ # object (same id) for consistency with Py3.3. This is not true for
+ # other objects like list or dict.
+ elif type(args[0]) == newstr and cls == newstr:
+ return args[0]
+ elif isinstance(args[0], unicode):
+ value = args[0]
+ elif isinstance(args[0], bytes): # i.e. Py2 bytes or newbytes
+ if 'encoding' in kwargs or len(args) > 1:
+ value = args[0].decode(*args[1:], **kwargs)
+ else:
+ value = args[0].__str__()
+ else:
+ value = args[0]
+ return super(newstr, cls).__new__(cls, value)
+
+ def __repr__(self):
+ """
+ Without the u prefix
+ """
+ value = super(newstr, self).__repr__()
+ # assert value[0] == u'u'
+ return value[1:]
+
+ def __getitem__(self, y):
+ """
+ Warning: Python <= 2.7.6 has a bug that causes this method never to be called
+ when y is a slice object. Therefore the type of newstr()[:2] is wrong
+ (unicode instead of newstr).
+ """
+ return newstr(super(newstr, self).__getitem__(y))
+
+ def __contains__(self, key):
+ errmsg = "'in ' requires string as left operand, not {0}"
+ # Don't use isinstance() here because we only want to catch
+ # newstr, not Python 2 unicode:
+ if type(key) == newstr:
+ newkey = key
+ elif isinstance(key, unicode) or isinstance(key, bytes) and not isnewbytes(key):
+ newkey = newstr(key)
+ else:
+ raise TypeError(errmsg.format(type(key)))
+ return issubset(list(newkey), list(self))
+
+ @no('newbytes')
+ def __add__(self, other):
+ return newstr(super(newstr, self).__add__(other))
+
+ @no('newbytes')
+ def __radd__(self, left):
+ " left + self "
+ try:
+ return newstr(left) + self
+ except:
+ return NotImplemented
+
+ def __mul__(self, other):
+ return newstr(super(newstr, self).__mul__(other))
+
+ def __rmul__(self, other):
+ return newstr(super(newstr, self).__rmul__(other))
+
+ def join(self, iterable):
+ errmsg = 'sequence item {0}: expected unicode string, found bytes'
+ for i, item in enumerate(iterable):
+ # Here we use type() rather than isinstance() because
+ # __instancecheck__ is being overridden. E.g.
+ # isinstance(b'abc', newbytes) is True on Py2.
+ if isnewbytes(item):
+ raise TypeError(errmsg.format(i))
+ # Support use as a staticmethod: str.join('-', ['a', 'b'])
+ if type(self) == newstr:
+ return newstr(super(newstr, self).join(iterable))
+ else:
+ return newstr(super(newstr, newstr(self)).join(iterable))
+
+ @no('newbytes')
+ def find(self, sub, *args):
+ return super(newstr, self).find(sub, *args)
+
+ @no('newbytes')
+ def rfind(self, sub, *args):
+ return super(newstr, self).rfind(sub, *args)
+
+ @no('newbytes', (1, 2))
+ def replace(self, old, new, *args):
+ return newstr(super(newstr, self).replace(old, new, *args))
+
+ def decode(self, *args):
+ raise AttributeError("decode method has been disabled in newstr")
+
+ def encode(self, encoding='utf-8', errors='strict'):
+ """
+ Returns bytes
+
+ Encode S using the codec registered for encoding. Default encoding
+ is 'utf-8'. errors may be given to set a different error
+ handling scheme. Default is 'strict' meaning that encoding errors raise
+ a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and
+ 'xmlcharrefreplace' as well as any other name registered with
+ codecs.register_error that can handle UnicodeEncodeErrors.
+ """
+ from future.types.newbytes import newbytes
+ # Py2 unicode.encode() takes encoding and errors as optional parameter,
+ # not keyword arguments as in Python 3 str.
+
+ # For the surrogateescape error handling mechanism, the
+ # codecs.register_error() function seems to be inadequate for an
+ # implementation of it when encoding. (Decoding seems fine, however.)
+ # For example, in the case of
+ # u'\udcc3'.encode('ascii', 'surrogateescape_handler')
+ # after registering the ``surrogateescape_handler`` function in
+ # future.utils.surrogateescape, both Python 2.x and 3.x raise an
+ # exception anyway after the function is called because the unicode
+ # string it has to return isn't encodable strictly as ASCII.
+
+ if errors == 'surrogateescape':
+ if encoding == 'utf-16':
+ # Known to fail here. See test_encoding_works_normally()
+ raise NotImplementedError('FIXME: surrogateescape handling is '
+ 'not yet implemented properly')
+ # Encode char by char, building up list of byte-strings
+ mybytes = []
+ for c in self:
+ code = ord(c)
+ if 0xD800 <= code <= 0xDCFF:
+ mybytes.append(newbytes([code - 0xDC00]))
+ else:
+ mybytes.append(c.encode(encoding=encoding))
+ return newbytes(b'').join(mybytes)
+ return newbytes(super(newstr, self).encode(encoding, errors))
+
+ @no('newbytes', 1)
+ def startswith(self, prefix, *args):
+ if isinstance(prefix, Iterable):
+ for thing in prefix:
+ if isnewbytes(thing):
+ raise TypeError(self.no_convert_msg.format(type(thing)))
+ return super(newstr, self).startswith(prefix, *args)
+
+ @no('newbytes', 1)
+ def endswith(self, prefix, *args):
+ # Note we need the decorator above as well as the isnewbytes()
+ # check because prefix can be either a bytes object or e.g. a
+ # tuple of possible prefixes. (If it's a bytes object, each item
+ # in it is an int.)
+ if isinstance(prefix, Iterable):
+ for thing in prefix:
+ if isnewbytes(thing):
+ raise TypeError(self.no_convert_msg.format(type(thing)))
+ return super(newstr, self).endswith(prefix, *args)
+
+ @no('newbytes', 1)
+ def split(self, sep=None, maxsplit=-1):
+ # Py2 unicode.split() takes maxsplit as an optional parameter,
+ # not as a keyword argument as in Python 3 str.
+ parts = super(newstr, self).split(sep, maxsplit)
+ return [newstr(part) for part in parts]
+
+ @no('newbytes', 1)
+ def rsplit(self, sep=None, maxsplit=-1):
+ # Py2 unicode.rsplit() takes maxsplit as an optional parameter,
+ # not as a keyword argument as in Python 3 str.
+ parts = super(newstr, self).rsplit(sep, maxsplit)
+ return [newstr(part) for part in parts]
+
+ @no('newbytes', 1)
+ def partition(self, sep):
+ parts = super(newstr, self).partition(sep)
+ return tuple(newstr(part) for part in parts)
+
+ @no('newbytes', 1)
+ def rpartition(self, sep):
+ parts = super(newstr, self).rpartition(sep)
+ return tuple(newstr(part) for part in parts)
+
+ @no('newbytes', 1)
+ def index(self, sub, *args):
+ """
+ Like newstr.find() but raise ValueError when the substring is not
+ found.
+ """
+ pos = self.find(sub, *args)
+ if pos == -1:
+ raise ValueError('substring not found')
+ return pos
+
+ def splitlines(self, keepends=False):
+ """
+ S.splitlines(keepends=False) -> list of strings
+
+ Return a list of the lines in S, breaking at line boundaries.
+ Line breaks are not included in the resulting list unless keepends
+ is given and true.
+ """
+ # Py2 unicode.splitlines() takes keepends as an optional parameter,
+ # not as a keyword argument as in Python 3 str.
+ parts = super(newstr, self).splitlines(keepends)
+ return [newstr(part) for part in parts]
+
+ def __eq__(self, other):
+ if (isinstance(other, unicode) or
+ isinstance(other, bytes) and not isnewbytes(other)):
+ return super(newstr, self).__eq__(other)
+ else:
+ return False
+
+ def __ne__(self, other):
+ if (isinstance(other, unicode) or
+ isinstance(other, bytes) and not isnewbytes(other)):
+ return super(newstr, self).__ne__(other)
+ else:
+ return True
+
+ unorderable_err = 'unorderable types: str() and {0}'
+
+ def __lt__(self, other):
+ if not istext(other):
+ raise TypeError(self.unorderable_err.format(type(other)))
+ return super(newstr, self).__lt__(other)
+
+ def __le__(self, other):
+ if not istext(other):
+ raise TypeError(self.unorderable_err.format(type(other)))
+ return super(newstr, self).__le__(other)
+
+ def __gt__(self, other):
+ if not istext(other):
+ raise TypeError(self.unorderable_err.format(type(other)))
+ return super(newstr, self).__gt__(other)
+
+ def __ge__(self, other):
+ if not istext(other):
+ raise TypeError(self.unorderable_err.format(type(other)))
+ return super(newstr, self).__ge__(other)
+
+ def __getattribute__(self, name):
+ """
+ A trick to cause the ``hasattr`` builtin-fn to return False for
+ the 'decode' method on Py2.
+ """
+ if name in ['decode', u'decode']:
+ raise AttributeError("decode method has been disabled in newstr")
+ return super(newstr, self).__getattribute__(name)
+
+ def __native__(self):
+ """
+ A hook for the future.utils.native() function.
+ """
+ return unicode(self)
+
+ @staticmethod
+ def maketrans(x, y=None, z=None):
+ """
+ Return a translation table usable for str.translate().
+
+ If there is only one argument, it must be a dictionary mapping Unicode
+ ordinals (integers) or characters to Unicode ordinals, strings or None.
+ Character keys will be then converted to ordinals.
+ If there are two arguments, they must be strings of equal length, and
+ in the resulting dictionary, each character in x will be mapped to the
+ character at the same position in y. If there is a third argument, it
+ must be a string, whose characters will be mapped to None in the result.
+ """
+
+ if y is None:
+ assert z is None
+ if not isinstance(x, dict):
+ raise TypeError('if you give only one argument to maketrans it must be a dict')
+ result = {}
+ for (key, value) in x.items():
+ if len(key) > 1:
+ raise ValueError('keys in translate table must be strings or integers')
+ result[ord(key)] = value
+ else:
+ if not isinstance(x, unicode) and isinstance(y, unicode):
+ raise TypeError('x and y must be unicode strings')
+ if not len(x) == len(y):
+ raise ValueError('the first two maketrans arguments must have equal length')
+ result = {}
+ for (xi, yi) in zip(x, y):
+ if len(xi) > 1:
+ raise ValueError('keys in translate table must be strings or integers')
+ result[ord(xi)] = ord(yi)
+
+ if z is not None:
+ for char in z:
+ result[ord(char)] = None
+ return result
+
+ def translate(self, table):
+ """
+ S.translate(table) -> str
+
+ Return a copy of the string S, where all characters have been mapped
+ through the given translation table, which must be a mapping of
+ Unicode ordinals to Unicode ordinals, strings, or None.
+ Unmapped characters are left untouched. Characters mapped to None
+ are deleted.
+ """
+ l = []
+ for c in self:
+ if ord(c) in table:
+ val = table[ord(c)]
+ if val is None:
+ continue
+ elif isinstance(val, unicode):
+ l.append(val)
+ else:
+ l.append(chr(val))
+ else:
+ l.append(c)
+ return ''.join(l)
+
+ def isprintable(self):
+ raise NotImplementedError('fixme')
+
+ def isidentifier(self):
+ raise NotImplementedError('fixme')
+
+ def format_map(self):
+ raise NotImplementedError('fixme')
+
+
+__all__ = ['newstr']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/utils/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/utils/__init__.py
new file mode 100644
index 0000000..6466fa2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/utils/__init__.py
@@ -0,0 +1,724 @@
+"""
+A selection of cross-compatible functions for Python 2 and 3.
+
+This exports useful functions for 2/3 compatible code that are not
+builtins on Python 3:
+
+ * bind_method: binds functions to classes
+ * ``native_str_to_bytes`` and ``bytes_to_native_str``
+ * ``native_str``: always equal to the native platform string object (because
+ this may be shadowed by imports from future.builtins)
+ * lists: lrange(), lmap(), lzip(), lfilter()
+ * iterable method compatibility: iteritems, iterkeys, itervalues
+
+ * Uses the original method if available, otherwise uses items, keys, values.
+
+ * types:
+
+ * text_type: unicode in Python 2, str in Python 3
+ * binary_type: str in Python 2, bythes in Python 3
+ * string_types: basestring in Python 2, str in Python 3
+
+ * bchr(c):
+ Take an integer and make a 1-character byte string
+ * bord(c)
+ Take the result of indexing on a byte string and make an integer
+ * tobytes(s)
+ Take a text string, a byte string, or a sequence of characters taken
+ from a byte string, and make a byte string.
+
+This module also defines a simple decorator called
+``python_2_unicode_compatible`` (from django.utils.encoding) which
+defines ``__unicode__`` and ``__str__`` methods consistently under Python
+3 and 2. To support Python 3 and 2 with a single code base, simply define
+a ``__str__`` method returning unicode text and apply the
+python_2_unicode_compatible decorator to the class like this::
+
+ >>> from future.utils import python_2_unicode_compatible
+
+ >>> @python_2_unicode_compatible
+ ... class MyClass(object):
+ ... def __str__(self):
+ ... return u'Unicode string: \u5b54\u5b50'
+
+ >>> a = MyClass()
+
+Then, after this import:
+
+ >>> from future.builtins import str
+
+the following is ``True`` on both Python 3 and 2::
+
+ >>> str(a) == a.encode('utf-8').decode('utf-8')
+ True
+
+and, on a Unicode-enabled terminal with the right fonts, these both print the
+Chinese characters for Confucius::
+
+ print(a)
+ print(str(a))
+
+On Python 3, this decorator is a no-op.
+
+Some of the functions in this module come from the following sources:
+
+ * Jinja2 (BSD licensed: see
+ https://github.com/mitsuhiko/jinja2/blob/master/LICENSE)
+ * Pandas compatibility module pandas.compat
+ * six.py by Benjamin Peterson
+ * Django
+"""
+
+import types
+import sys
+import numbers
+import functools
+import copy
+import inspect
+
+
+PY3 = sys.version_info[0] == 3
+PY2 = sys.version_info[0] == 2
+PY26 = sys.version_info[0:2] == (2, 6)
+PYPY = hasattr(sys, 'pypy_translation_info')
+
+
+def python_2_unicode_compatible(cls):
+ """
+ A decorator that defines __unicode__ and __str__ methods under Python
+ 2. Under Python 3 it does nothing.
+
+ To support Python 2 and 3 with a single code base, define a __str__
+ method returning unicode text and apply this decorator to the class.
+
+ The implementation comes from django.utils.encoding.
+ """
+ if not PY3:
+ cls.__unicode__ = cls.__str__
+ cls.__str__ = lambda self: self.__unicode__().encode('utf-8')
+ return cls
+
+
+def with_metaclass(meta, *bases):
+ """
+ Function from jinja2/_compat.py. License: BSD.
+
+ Use it like this::
+
+ class BaseForm(object):
+ pass
+
+ class FormType(type):
+ pass
+
+ class Form(with_metaclass(FormType, BaseForm)):
+ pass
+
+ This requires a bit of explanation: the basic idea is to make a
+ dummy metaclass for one level of class instantiation that replaces
+ itself with the actual metaclass. Because of internal type checks
+ we also need to make sure that we downgrade the custom metaclass
+ for one level to something closer to type (that's why __call__ and
+ __init__ comes back from type etc.).
+
+ This has the advantage over six.with_metaclass of not introducing
+ dummy classes into the final MRO.
+ """
+ class metaclass(meta):
+ __call__ = type.__call__
+ __init__ = type.__init__
+ def __new__(cls, name, this_bases, d):
+ if this_bases is None:
+ return type.__new__(cls, name, (), d)
+ return meta(name, bases, d)
+ return metaclass('temporary_class', None, {})
+
+
+# Definitions from pandas.compat follow:
+if PY3:
+ def bchr(s):
+ return bytes([s])
+ def bstr(s):
+ if isinstance(s, str):
+ return bytes(s, 'latin-1')
+ else:
+ return bytes(s)
+ def bord(s):
+ return s
+else:
+ # Python 2
+ def bchr(s):
+ return chr(s)
+ def bstr(s):
+ return str(s)
+ def bord(s):
+ return ord(s)
+
+###
+
+if PY3:
+ def tobytes(s):
+ if isinstance(s, bytes):
+ return s
+ else:
+ if isinstance(s, str):
+ return s.encode('latin-1')
+ else:
+ return bytes(s)
+else:
+ # Python 2
+ def tobytes(s):
+ if isinstance(s, unicode):
+ return s.encode('latin-1')
+ else:
+ return ''.join(s)
+
+tobytes.__doc__ = """
+ Encodes to latin-1 (where the first 256 chars are the same as
+ ASCII.)
+ """
+
+if PY3:
+ def native_str_to_bytes(s, encoding='utf-8'):
+ return s.encode(encoding)
+
+ def bytes_to_native_str(b, encoding='utf-8'):
+ return b.decode(encoding)
+
+ def text_to_native_str(t, encoding=None):
+ return t
+else:
+ # Python 2
+ def native_str_to_bytes(s, encoding=None):
+ from future.types import newbytes # to avoid a circular import
+ return newbytes(s)
+
+ def bytes_to_native_str(b, encoding=None):
+ return native(b)
+
+ def text_to_native_str(t, encoding='ascii'):
+ """
+ Use this to create a Py2 native string when "from __future__ import
+ unicode_literals" is in effect.
+ """
+ return unicode(t).encode(encoding)
+
+native_str_to_bytes.__doc__ = """
+ On Py3, returns an encoded string.
+ On Py2, returns a newbytes type, ignoring the ``encoding`` argument.
+ """
+
+if PY3:
+ # list-producing versions of the major Python iterating functions
+ def lrange(*args, **kwargs):
+ return list(range(*args, **kwargs))
+
+ def lzip(*args, **kwargs):
+ return list(zip(*args, **kwargs))
+
+ def lmap(*args, **kwargs):
+ return list(map(*args, **kwargs))
+
+ def lfilter(*args, **kwargs):
+ return list(filter(*args, **kwargs))
+else:
+ import __builtin__
+ # Python 2-builtin ranges produce lists
+ lrange = __builtin__.range
+ lzip = __builtin__.zip
+ lmap = __builtin__.map
+ lfilter = __builtin__.filter
+
+
+def isidentifier(s, dotted=False):
+ '''
+ A function equivalent to the str.isidentifier method on Py3
+ '''
+ if dotted:
+ return all(isidentifier(a) for a in s.split('.'))
+ if PY3:
+ return s.isidentifier()
+ else:
+ import re
+ _name_re = re.compile(r"[a-zA-Z_][a-zA-Z0-9_]*$")
+ return bool(_name_re.match(s))
+
+
+def viewitems(obj, **kwargs):
+ """
+ Function for iterating over dictionary items with the same set-like
+ behaviour on Py2.7 as on Py3.
+
+ Passes kwargs to method."""
+ func = getattr(obj, "viewitems", None)
+ if not func:
+ func = obj.items
+ return func(**kwargs)
+
+
+def viewkeys(obj, **kwargs):
+ """
+ Function for iterating over dictionary keys with the same set-like
+ behaviour on Py2.7 as on Py3.
+
+ Passes kwargs to method."""
+ func = getattr(obj, "viewkeys", None)
+ if not func:
+ func = obj.keys
+ return func(**kwargs)
+
+
+def viewvalues(obj, **kwargs):
+ """
+ Function for iterating over dictionary values with the same set-like
+ behaviour on Py2.7 as on Py3.
+
+ Passes kwargs to method."""
+ func = getattr(obj, "viewvalues", None)
+ if not func:
+ func = obj.values
+ return func(**kwargs)
+
+
+def iteritems(obj, **kwargs):
+ """Use this only if compatibility with Python versions before 2.7 is
+ required. Otherwise, prefer viewitems().
+ """
+ func = getattr(obj, "iteritems", None)
+ if not func:
+ func = obj.items
+ return func(**kwargs)
+
+
+def iterkeys(obj, **kwargs):
+ """Use this only if compatibility with Python versions before 2.7 is
+ required. Otherwise, prefer viewkeys().
+ """
+ func = getattr(obj, "iterkeys", None)
+ if not func:
+ func = obj.keys
+ return func(**kwargs)
+
+
+def itervalues(obj, **kwargs):
+ """Use this only if compatibility with Python versions before 2.7 is
+ required. Otherwise, prefer viewvalues().
+ """
+ func = getattr(obj, "itervalues", None)
+ if not func:
+ func = obj.values
+ return func(**kwargs)
+
+
+def bind_method(cls, name, func):
+ """Bind a method to class, python 2 and python 3 compatible.
+
+ Parameters
+ ----------
+
+ cls : type
+ class to receive bound method
+ name : basestring
+ name of method on class instance
+ func : function
+ function to be bound as method
+
+ Returns
+ -------
+ None
+ """
+ # only python 2 has an issue with bound/unbound methods
+ if not PY3:
+ setattr(cls, name, types.MethodType(func, None, cls))
+ else:
+ setattr(cls, name, func)
+
+
+def getexception():
+ return sys.exc_info()[1]
+
+
+def _get_caller_globals_and_locals():
+ """
+ Returns the globals and locals of the calling frame.
+
+ Is there an alternative to frame hacking here?
+ """
+ caller_frame = inspect.stack()[2]
+ myglobals = caller_frame[0].f_globals
+ mylocals = caller_frame[0].f_locals
+ return myglobals, mylocals
+
+
+def _repr_strip(mystring):
+ """
+ Returns the string without any initial or final quotes.
+ """
+ r = repr(mystring)
+ if r.startswith("'") and r.endswith("'"):
+ return r[1:-1]
+ else:
+ return r
+
+
+if PY3:
+ def raise_from(exc, cause):
+ """
+ Equivalent to:
+
+ raise EXCEPTION from CAUSE
+
+ on Python 3. (See PEP 3134).
+ """
+ # Is either arg an exception class (e.g. IndexError) rather than
+ # instance (e.g. IndexError('my message here')? If so, pass the
+ # name of the class undisturbed through to "raise ... from ...".
+ if isinstance(exc, type) and issubclass(exc, Exception):
+ exc = exc.__name__
+ if isinstance(cause, type) and issubclass(cause, Exception):
+ cause = cause.__name__
+ execstr = "raise " + _repr_strip(exc) + " from " + _repr_strip(cause)
+ myglobals, mylocals = _get_caller_globals_and_locals()
+ exec(execstr, myglobals, mylocals)
+
+ def raise_(tp, value=None, tb=None):
+ """
+ A function that matches the Python 2.x ``raise`` statement. This
+ allows re-raising exceptions with the cls value and traceback on
+ Python 2 and 3.
+ """
+ if value is not None and isinstance(tp, Exception):
+ raise TypeError("instance exception may not have a separate value")
+ if value is not None:
+ exc = tp(value)
+ else:
+ exc = tp
+ if exc.__traceback__ is not tb:
+ raise exc.with_traceback(tb)
+ raise exc
+
+ def raise_with_traceback(exc, traceback=Ellipsis):
+ if traceback == Ellipsis:
+ _, _, traceback = sys.exc_info()
+ raise exc.with_traceback(traceback)
+
+else:
+ def raise_from(exc, cause):
+ """
+ Equivalent to:
+
+ raise EXCEPTION from CAUSE
+
+ on Python 3. (See PEP 3134).
+ """
+ # Is either arg an exception class (e.g. IndexError) rather than
+ # instance (e.g. IndexError('my message here')? If so, pass the
+ # name of the class undisturbed through to "raise ... from ...".
+ if isinstance(exc, type) and issubclass(exc, Exception):
+ e = exc()
+ # exc = exc.__name__
+ # execstr = "e = " + _repr_strip(exc) + "()"
+ # myglobals, mylocals = _get_caller_globals_and_locals()
+ # exec(execstr, myglobals, mylocals)
+ else:
+ e = exc
+ e.__suppress_context__ = False
+ if isinstance(cause, type) and issubclass(cause, Exception):
+ e.__cause__ = cause()
+ e.__suppress_context__ = True
+ elif cause is None:
+ e.__cause__ = None
+ e.__suppress_context__ = True
+ elif isinstance(cause, BaseException):
+ e.__cause__ = cause
+ e.__suppress_context__ = True
+ else:
+ raise TypeError("exception causes must derive from BaseException")
+ e.__context__ = sys.exc_info()[1]
+ raise e
+
+ exec('''
+def raise_(tp, value=None, tb=None):
+ raise tp, value, tb
+
+def raise_with_traceback(exc, traceback=Ellipsis):
+ if traceback == Ellipsis:
+ _, _, traceback = sys.exc_info()
+ raise exc, None, traceback
+'''.strip())
+
+
+raise_with_traceback.__doc__ = (
+"""Raise exception with existing traceback.
+If traceback is not passed, uses sys.exc_info() to get traceback."""
+)
+
+
+# Deprecated alias for backward compatibility with ``future`` versions < 0.11:
+reraise = raise_
+
+
+def implements_iterator(cls):
+ '''
+ From jinja2/_compat.py. License: BSD.
+
+ Use as a decorator like this::
+
+ @implements_iterator
+ class UppercasingIterator(object):
+ def __init__(self, iterable):
+ self._iter = iter(iterable)
+ def __iter__(self):
+ return self
+ def __next__(self):
+ return next(self._iter).upper()
+
+ '''
+ if PY3:
+ return cls
+ else:
+ cls.next = cls.__next__
+ del cls.__next__
+ return cls
+
+if PY3:
+ get_next = lambda x: x.next
+else:
+ get_next = lambda x: x.__next__
+
+
+def encode_filename(filename):
+ if PY3:
+ return filename
+ else:
+ if isinstance(filename, unicode):
+ return filename.encode('utf-8')
+ return filename
+
+
+def is_new_style(cls):
+ """
+ Python 2.7 has both new-style and old-style classes. Old-style classes can
+ be pesky in some circumstances, such as when using inheritance. Use this
+ function to test for whether a class is new-style. (Python 3 only has
+ new-style classes.)
+ """
+ return hasattr(cls, '__class__') and ('__dict__' in dir(cls)
+ or hasattr(cls, '__slots__'))
+
+# The native platform string and bytes types. Useful because ``str`` and
+# ``bytes`` are redefined on Py2 by ``from future.builtins import *``.
+native_str = str
+native_bytes = bytes
+
+
+def istext(obj):
+ """
+ Deprecated. Use::
+ >>> isinstance(obj, str)
+ after this import:
+ >>> from future.builtins import str
+ """
+ return isinstance(obj, type(u''))
+
+
+def isbytes(obj):
+ """
+ Deprecated. Use::
+ >>> isinstance(obj, bytes)
+ after this import:
+ >>> from future.builtins import bytes
+ """
+ return isinstance(obj, type(b''))
+
+
+def isnewbytes(obj):
+ """
+ Equivalent to the result of ``isinstance(obj, newbytes)`` were
+ ``__instancecheck__`` not overridden on the newbytes subclass. In
+ other words, it is REALLY a newbytes instance, not a Py2 native str
+ object?
+ """
+ # TODO: generalize this so that it works with subclasses of newbytes
+ # Import is here to avoid circular imports:
+ from future.types.newbytes import newbytes
+ return type(obj) == newbytes
+
+
+def isint(obj):
+ """
+ Deprecated. Tests whether an object is a Py3 ``int`` or either a Py2 ``int`` or
+ ``long``.
+
+ Instead of using this function, you can use:
+
+ >>> from future.builtins import int
+ >>> isinstance(obj, int)
+
+ The following idiom is equivalent:
+
+ >>> from numbers import Integral
+ >>> isinstance(obj, Integral)
+ """
+
+ return isinstance(obj, numbers.Integral)
+
+
+def native(obj):
+ """
+ On Py3, this is a no-op: native(obj) -> obj
+
+ On Py2, returns the corresponding native Py2 types that are
+ superclasses for backported objects from Py3:
+
+ >>> from builtins import str, bytes, int
+
+ >>> native(str(u'ABC'))
+ u'ABC'
+ >>> type(native(str(u'ABC')))
+ unicode
+
+ >>> native(bytes(b'ABC'))
+ b'ABC'
+ >>> type(native(bytes(b'ABC')))
+ bytes
+
+ >>> native(int(10**20))
+ 100000000000000000000L
+ >>> type(native(int(10**20)))
+ long
+
+ Existing native types on Py2 will be returned unchanged:
+
+ >>> type(native(u'ABC'))
+ unicode
+ """
+ if hasattr(obj, '__native__'):
+ return obj.__native__()
+ else:
+ return obj
+
+
+# Implementation of exec_ is from ``six``:
+if PY3:
+ import builtins
+ exec_ = getattr(builtins, "exec")
+else:
+ def exec_(code, globs=None, locs=None):
+ """Execute code in a namespace."""
+ if globs is None:
+ frame = sys._getframe(1)
+ globs = frame.f_globals
+ if locs is None:
+ locs = frame.f_locals
+ del frame
+ elif locs is None:
+ locs = globs
+ exec("""exec code in globs, locs""")
+
+
+# Defined here for backward compatibility:
+def old_div(a, b):
+ """
+ DEPRECATED: import ``old_div`` from ``past.utils`` instead.
+
+ Equivalent to ``a / b`` on Python 2 without ``from __future__ import
+ division``.
+
+ TODO: generalize this to other objects (like arrays etc.)
+ """
+ if isinstance(a, numbers.Integral) and isinstance(b, numbers.Integral):
+ return a // b
+ else:
+ return a / b
+
+
+def as_native_str(encoding='utf-8'):
+ '''
+ A decorator to turn a function or method call that returns text, i.e.
+ unicode, into one that returns a native platform str.
+
+ Use it as a decorator like this::
+
+ from __future__ import unicode_literals
+
+ class MyClass(object):
+ @as_native_str(encoding='ascii')
+ def __repr__(self):
+ return next(self._iter).upper()
+ '''
+ if PY3:
+ return lambda f: f
+ else:
+ def encoder(f):
+ @functools.wraps(f)
+ def wrapper(*args, **kwargs):
+ return f(*args, **kwargs).encode(encoding=encoding)
+ return wrapper
+ return encoder
+
+# listvalues and listitems definitions from Nick Coghlan's (withdrawn)
+# PEP 496:
+try:
+ dict.iteritems
+except AttributeError:
+ # Python 3
+ def listvalues(d):
+ return list(d.values())
+ def listitems(d):
+ return list(d.items())
+else:
+ # Python 2
+ def listvalues(d):
+ return d.values()
+ def listitems(d):
+ return d.items()
+
+if PY3:
+ def ensure_new_type(obj):
+ return obj
+else:
+ def ensure_new_type(obj):
+ from future.types.newbytes import newbytes
+ from future.types.newstr import newstr
+ from future.types.newint import newint
+ from future.types.newdict import newdict
+
+ native_type = type(native(obj))
+
+ # Upcast only if the type is already a native (non-future) type
+ if issubclass(native_type, type(obj)):
+ # Upcast
+ if native_type == str: # i.e. Py2 8-bit str
+ return newbytes(obj)
+ elif native_type == unicode:
+ return newstr(obj)
+ elif native_type == int:
+ return newint(obj)
+ elif native_type == long:
+ return newint(obj)
+ elif native_type == dict:
+ return newdict(obj)
+ else:
+ return NotImplementedError('type %s not supported' % type(obj))
+ else:
+ # Already a new type
+ assert type(obj) in [newbytes, newstr]
+ return obj
+
+
+__all__ = ['PY2', 'PY26', 'PY3', 'PYPY',
+ 'as_native_str', 'bind_method', 'bord', 'bstr',
+ 'bytes_to_native_str', 'encode_filename', 'ensure_new_type',
+ 'exec_', 'get_next', 'getexception', 'implements_iterator',
+ 'is_new_style', 'isbytes', 'isidentifier', 'isint',
+ 'isnewbytes', 'istext', 'iteritems', 'iterkeys', 'itervalues',
+ 'lfilter', 'listitems', 'listvalues', 'lmap', 'lrange',
+ 'lzip', 'native', 'native_bytes', 'native_str',
+ 'native_str_to_bytes', 'old_div',
+ 'python_2_unicode_compatible', 'raise_',
+ 'raise_with_traceback', 'reraise', 'text_to_native_str',
+ 'tobytes', 'viewitems', 'viewkeys', 'viewvalues',
+ 'with_metaclass'
+ ]
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/utils/surrogateescape.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/utils/surrogateescape.py
new file mode 100644
index 0000000..a0d8d44
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/future/utils/surrogateescape.py
@@ -0,0 +1,199 @@
+"""
+This is Victor Stinner's pure-Python implementation of PEP 383: the "surrogateescape" error
+handler of Python 3.
+
+Source: misc/python/surrogateescape.py in https://bitbucket.org/haypo/misc
+"""
+
+# This code is released under the Python license and the BSD 2-clause license
+
+import codecs
+import sys
+
+from future import utils
+
+
+FS_ERRORS = 'surrogateescape'
+
+# # -- Python 2/3 compatibility -------------------------------------
+# FS_ERRORS = 'my_surrogateescape'
+
+def u(text):
+ if utils.PY3:
+ return text
+ else:
+ return text.decode('unicode_escape')
+
+def b(data):
+ if utils.PY3:
+ return data.encode('latin1')
+ else:
+ return data
+
+if utils.PY3:
+ _unichr = chr
+ bytes_chr = lambda code: bytes((code,))
+else:
+ _unichr = unichr
+ bytes_chr = chr
+
+def surrogateescape_handler(exc):
+ """
+ Pure Python implementation of the PEP 383: the "surrogateescape" error
+ handler of Python 3. Undecodable bytes will be replaced by a Unicode
+ character U+DCxx on decoding, and these are translated into the
+ original bytes on encoding.
+ """
+ mystring = exc.object[exc.start:exc.end]
+
+ try:
+ if isinstance(exc, UnicodeDecodeError):
+ # mystring is a byte-string in this case
+ decoded = replace_surrogate_decode(mystring)
+ elif isinstance(exc, UnicodeEncodeError):
+ # In the case of u'\udcc3'.encode('ascii',
+ # 'this_surrogateescape_handler'), both Python 2.x and 3.x raise an
+ # exception anyway after this function is called, even though I think
+ # it's doing what it should. It seems that the strict encoder is called
+ # to encode the unicode string that this function returns ...
+ decoded = replace_surrogate_encode(mystring)
+ else:
+ raise exc
+ except NotASurrogateError:
+ raise exc
+ return (decoded, exc.end)
+
+
+class NotASurrogateError(Exception):
+ pass
+
+
+def replace_surrogate_encode(mystring):
+ """
+ Returns a (unicode) string, not the more logical bytes, because the codecs
+ register_error functionality expects this.
+ """
+ decoded = []
+ for ch in mystring:
+ # if utils.PY3:
+ # code = ch
+ # else:
+ code = ord(ch)
+
+ # The following magic comes from Py3.3's Python/codecs.c file:
+ if not 0xD800 <= code <= 0xDCFF:
+ # Not a surrogate. Fail with the original exception.
+ raise exc
+ # mybytes = [0xe0 | (code >> 12),
+ # 0x80 | ((code >> 6) & 0x3f),
+ # 0x80 | (code & 0x3f)]
+ # Is this a good idea?
+ if 0xDC00 <= code <= 0xDC7F:
+ decoded.append(_unichr(code - 0xDC00))
+ elif code <= 0xDCFF:
+ decoded.append(_unichr(code - 0xDC00))
+ else:
+ raise NotASurrogateError
+ return str().join(decoded)
+
+
+def replace_surrogate_decode(mybytes):
+ """
+ Returns a (unicode) string
+ """
+ decoded = []
+ for ch in mybytes:
+ # We may be parsing newbytes (in which case ch is an int) or a native
+ # str on Py2
+ if isinstance(ch, int):
+ code = ch
+ else:
+ code = ord(ch)
+ if 0x80 <= code <= 0xFF:
+ decoded.append(_unichr(0xDC00 + code))
+ elif code <= 0x7F:
+ decoded.append(_unichr(code))
+ else:
+ # # It may be a bad byte
+ # # Try swallowing it.
+ # continue
+ # print("RAISE!")
+ raise NotASurrogateError
+ return str().join(decoded)
+
+
+def encodefilename(fn):
+ if FS_ENCODING == 'ascii':
+ # ASCII encoder of Python 2 expects that the error handler returns a
+ # Unicode string encodable to ASCII, whereas our surrogateescape error
+ # handler has to return bytes in 0x80-0xFF range.
+ encoded = []
+ for index, ch in enumerate(fn):
+ code = ord(ch)
+ if code < 128:
+ ch = bytes_chr(code)
+ elif 0xDC80 <= code <= 0xDCFF:
+ ch = bytes_chr(code - 0xDC00)
+ else:
+ raise UnicodeEncodeError(FS_ENCODING,
+ fn, index, index+1,
+ 'ordinal not in range(128)')
+ encoded.append(ch)
+ return bytes().join(encoded)
+ elif FS_ENCODING == 'utf-8':
+ # UTF-8 encoder of Python 2 encodes surrogates, so U+DC80-U+DCFF
+ # doesn't go through our error handler
+ encoded = []
+ for index, ch in enumerate(fn):
+ code = ord(ch)
+ if 0xD800 <= code <= 0xDFFF:
+ if 0xDC80 <= code <= 0xDCFF:
+ ch = bytes_chr(code - 0xDC00)
+ encoded.append(ch)
+ else:
+ raise UnicodeEncodeError(
+ FS_ENCODING,
+ fn, index, index+1, 'surrogates not allowed')
+ else:
+ ch_utf8 = ch.encode('utf-8')
+ encoded.append(ch_utf8)
+ return bytes().join(encoded)
+ else:
+ return fn.encode(FS_ENCODING, FS_ERRORS)
+
+def decodefilename(fn):
+ return fn.decode(FS_ENCODING, FS_ERRORS)
+
+FS_ENCODING = 'ascii'; fn = b('[abc\xff]'); encoded = u('[abc\udcff]')
+# FS_ENCODING = 'cp932'; fn = b('[abc\x81\x00]'); encoded = u('[abc\udc81\x00]')
+# FS_ENCODING = 'UTF-8'; fn = b('[abc\xff]'); encoded = u('[abc\udcff]')
+
+
+# normalize the filesystem encoding name.
+# For example, we expect "utf-8", not "UTF8".
+FS_ENCODING = codecs.lookup(FS_ENCODING).name
+
+
+def register_surrogateescape():
+ """
+ Registers the surrogateescape error handler on Python 2 (only)
+ """
+ if utils.PY3:
+ return
+ try:
+ codecs.lookup_error(FS_ERRORS)
+ except LookupError:
+ codecs.register_error(FS_ERRORS, surrogateescape_handler)
+
+
+if True:
+ # Tests:
+ register_surrogateescape()
+
+ b = decodefilename(fn)
+ assert b == encoded, "%r != %r" % (b, encoded)
+ c = encodefilename(b)
+ assert c == fn, '%r != %r' % (c, fn)
+ # print("ok")
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/__init__.py
new file mode 100644
index 0000000..4cb1cbc
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/__init__.py
@@ -0,0 +1 @@
+# empty to make this a package
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixer_util.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixer_util.py
new file mode 100644
index 0000000..0013437
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixer_util.py
@@ -0,0 +1,476 @@
+"""
+Utility functions from 2to3, 3to2 and python-modernize (and some home-grown
+ones).
+
+Licences:
+2to3: PSF License v2
+3to2: Apache Software License (from 3to2/setup.py)
+python-modernize licence: BSD (from python-modernize/LICENSE)
+"""
+
+from lib2to3.fixer_util import (FromImport, Newline, is_import,
+ find_root, does_tree_import, Comma)
+from lib2to3.pytree import Leaf, Node
+from lib2to3.pygram import python_symbols as syms, python_grammar
+from lib2to3.pygram import token
+from lib2to3.fixer_util import (Node, Call, Name, syms, Comma, Number)
+import re
+
+
+## These functions are from 3to2 by Joe Amenta:
+
+def Star(prefix=None):
+ return Leaf(token.STAR, u'*', prefix=prefix)
+
+def DoubleStar(prefix=None):
+ return Leaf(token.DOUBLESTAR, u'**', prefix=prefix)
+
+def Minus(prefix=None):
+ return Leaf(token.MINUS, u'-', prefix=prefix)
+
+def commatize(leafs):
+ u"""
+ Accepts/turns: (Name, Name, ..., Name, Name)
+ Returns/into: (Name, Comma, Name, Comma, ..., Name, Comma, Name)
+ """
+ new_leafs = []
+ for leaf in leafs:
+ new_leafs.append(leaf)
+ new_leafs.append(Comma())
+ del new_leafs[-1]
+ return new_leafs
+
+def indentation(node):
+ u"""
+ Returns the indentation for this node
+ Iff a node is in a suite, then it has indentation.
+ """
+ while node.parent is not None and node.parent.type != syms.suite:
+ node = node.parent
+ if node.parent is None:
+ return u""
+ # The first three children of a suite are NEWLINE, INDENT, (some other node)
+ # INDENT.value contains the indentation for this suite
+ # anything after (some other node) has the indentation as its prefix.
+ if node.type == token.INDENT:
+ return node.value
+ elif node.prev_sibling is not None and node.prev_sibling.type == token.INDENT:
+ return node.prev_sibling.value
+ elif node.prev_sibling is None:
+ return u""
+ else:
+ return node.prefix
+
+def indentation_step(node):
+ u"""
+ Dirty little trick to get the difference between each indentation level
+ Implemented by finding the shortest indentation string
+ (technically, the "least" of all of the indentation strings, but
+ tabs and spaces mixed won't get this far, so those are synonymous.)
+ """
+ r = find_root(node)
+ # Collect all indentations into one set.
+ all_indents = set(i.value for i in r.pre_order() if i.type == token.INDENT)
+ if not all_indents:
+ # nothing is indented anywhere, so we get to pick what we want
+ return u" " # four spaces is a popular convention
+ else:
+ return min(all_indents)
+
+def suitify(parent):
+ u"""
+ Turn the stuff after the first colon in parent's children
+ into a suite, if it wasn't already
+ """
+ for node in parent.children:
+ if node.type == syms.suite:
+ # already in the prefered format, do nothing
+ return
+
+ # One-liners have no suite node, we have to fake one up
+ for i, node in enumerate(parent.children):
+ if node.type == token.COLON:
+ break
+ else:
+ raise ValueError(u"No class suite and no ':'!")
+ # Move everything into a suite node
+ suite = Node(syms.suite, [Newline(), Leaf(token.INDENT, indentation(node) + indentation_step(node))])
+ one_node = parent.children[i+1]
+ one_node.remove()
+ one_node.prefix = u''
+ suite.append_child(one_node)
+ parent.append_child(suite)
+
+def NameImport(package, as_name=None, prefix=None):
+ u"""
+ Accepts a package (Name node), name to import it as (string), and
+ optional prefix and returns a node:
+ import [as ]
+ """
+ if prefix is None:
+ prefix = u""
+ children = [Name(u"import", prefix=prefix), package]
+ if as_name is not None:
+ children.extend([Name(u"as", prefix=u" "),
+ Name(as_name, prefix=u" ")])
+ return Node(syms.import_name, children)
+
+_compound_stmts = (syms.if_stmt, syms.while_stmt, syms.for_stmt, syms.try_stmt, syms.with_stmt)
+_import_stmts = (syms.import_name, syms.import_from)
+
+def import_binding_scope(node):
+ u"""
+ Generator yields all nodes for which a node (an import_stmt) has scope
+ The purpose of this is for a call to _find() on each of them
+ """
+ # import_name / import_from are small_stmts
+ assert node.type in _import_stmts
+ test = node.next_sibling
+ # A small_stmt can only be followed by a SEMI or a NEWLINE.
+ while test.type == token.SEMI:
+ nxt = test.next_sibling
+ # A SEMI can only be followed by a small_stmt or a NEWLINE
+ if nxt.type == token.NEWLINE:
+ break
+ else:
+ yield nxt
+ # A small_stmt can only be followed by either a SEMI or a NEWLINE
+ test = nxt.next_sibling
+ # Covered all subsequent small_stmts after the import_stmt
+ # Now to cover all subsequent stmts after the parent simple_stmt
+ parent = node.parent
+ assert parent.type == syms.simple_stmt
+ test = parent.next_sibling
+ while test is not None:
+ # Yes, this will yield NEWLINE and DEDENT. Deal with it.
+ yield test
+ test = test.next_sibling
+
+ context = parent.parent
+ # Recursively yield nodes following imports inside of a if/while/for/try/with statement
+ if context.type in _compound_stmts:
+ # import is in a one-liner
+ c = context
+ while c.next_sibling is not None:
+ yield c.next_sibling
+ c = c.next_sibling
+ context = context.parent
+
+ # Can't chain one-liners on one line, so that takes care of that.
+
+ p = context.parent
+ if p is None:
+ return
+
+ # in a multi-line suite
+
+ while p.type in _compound_stmts:
+
+ if context.type == syms.suite:
+ yield context
+
+ context = context.next_sibling
+
+ if context is None:
+ context = p.parent
+ p = context.parent
+ if p is None:
+ break
+
+def ImportAsName(name, as_name, prefix=None):
+ new_name = Name(name)
+ new_as = Name(u"as", prefix=u" ")
+ new_as_name = Name(as_name, prefix=u" ")
+ new_node = Node(syms.import_as_name, [new_name, new_as, new_as_name])
+ if prefix is not None:
+ new_node.prefix = prefix
+ return new_node
+
+
+def future_import(feature, node):
+ """
+ This seems to work
+ """
+ root = find_root(node)
+
+ if does_tree_import(u"__future__", feature, node):
+ return
+
+ # Look for a shebang or encoding line
+ shebang_encoding_idx = None
+
+ for idx, node in enumerate(root.children):
+ # Is it a shebang or encoding line?
+ if is_shebang_comment(node) or is_encoding_comment(node):
+ shebang_encoding_idx = idx
+ if node.type == syms.simple_stmt and \
+ len(node.children) > 0 and node.children[0].type == token.STRING:
+ # skip over docstring
+ continue
+ names = check_future_import(node)
+ if not names:
+ # not a future statement; need to insert before this
+ break
+ if feature in names:
+ # already imported
+ return
+
+ import_ = FromImport(u'__future__', [Leaf(token.NAME, feature, prefix=" ")])
+ if shebang_encoding_idx == 0 and idx == 0:
+ # If this __future__ import would go on the first line,
+ # detach the shebang / encoding prefix from the current first line.
+ # and attach it to our new __future__ import node.
+ import_.prefix = root.children[0].prefix
+ root.children[0].prefix = u''
+ # End the __future__ import line with a newline and add a blank line
+ # afterwards:
+ children = [import_ , Newline()]
+ root.insert_child(idx, Node(syms.simple_stmt, children))
+
+
+def future_import2(feature, node):
+ """
+ An alternative to future_import() which might not work ...
+ """
+ root = find_root(node)
+
+ if does_tree_import(u"__future__", feature, node):
+ return
+
+ insert_pos = 0
+ for idx, node in enumerate(root.children):
+ if node.type == syms.simple_stmt and node.children and \
+ node.children[0].type == token.STRING:
+ insert_pos = idx + 1
+ break
+
+ for thing_after in root.children[insert_pos:]:
+ if thing_after.type == token.NEWLINE:
+ insert_pos += 1
+ continue
+
+ prefix = thing_after.prefix
+ thing_after.prefix = u""
+ break
+ else:
+ prefix = u""
+
+ import_ = FromImport(u"__future__", [Leaf(token.NAME, feature, prefix=u" ")])
+
+ children = [import_, Newline()]
+ root.insert_child(insert_pos, Node(syms.simple_stmt, children, prefix=prefix))
+
+def parse_args(arglist, scheme):
+ u"""
+ Parse a list of arguments into a dict
+ """
+ arglist = [i for i in arglist if i.type != token.COMMA]
+
+ ret_mapping = dict([(k, None) for k in scheme])
+
+ for i, arg in enumerate(arglist):
+ if arg.type == syms.argument and arg.children[1].type == token.EQUAL:
+ # argument < NAME '=' any >
+ slot = arg.children[0].value
+ ret_mapping[slot] = arg.children[2]
+ else:
+ slot = scheme[i]
+ ret_mapping[slot] = arg
+
+ return ret_mapping
+
+
+# def is_import_from(node):
+# """Returns true if the node is a statement "from ... import ..."
+# """
+# return node.type == syms.import_from
+
+
+def is_import_stmt(node):
+ return (node.type == syms.simple_stmt and node.children and
+ is_import(node.children[0]))
+
+
+def touch_import_top(package, name_to_import, node):
+ """Works like `does_tree_import` but adds an import statement at the
+ top if it was not imported (but below any __future__ imports).
+
+ Based on lib2to3.fixer_util.touch_import()
+
+ Calling this multiple times adds the imports in reverse order.
+
+ Also adds "standard_library.install_aliases()" after "from future import
+ standard_library". This should probably be factored into another function.
+ """
+
+ root = find_root(node)
+
+ if does_tree_import(package, name_to_import, root):
+ return
+
+ # Ideally, we would look for whether futurize --all-imports has been run,
+ # as indicated by the presence of ``from builtins import (ascii, ...,
+ # zip)`` -- and, if it has, we wouldn't import the name again.
+
+ # Look for __future__ imports and insert below them
+ found = False
+ for name in ['absolute_import', 'division', 'print_function',
+ 'unicode_literals']:
+ if does_tree_import('__future__', name, root):
+ found = True
+ break
+ if found:
+ # At least one __future__ import. We want to loop until we've seen them
+ # all.
+ start, end = None, None
+ for idx, node in enumerate(root.children):
+ if check_future_import(node):
+ start = idx
+ # Start looping
+ idx2 = start
+ while node:
+ node = node.next_sibling
+ idx2 += 1
+ if not check_future_import(node):
+ end = idx2
+ break
+ break
+ assert start is not None
+ assert end is not None
+ insert_pos = end
+ else:
+ # No __future__ imports.
+ # We look for a docstring and insert the new node below that. If no docstring
+ # exists, just insert the node at the top.
+ for idx, node in enumerate(root.children):
+ if node.type != syms.simple_stmt:
+ break
+ if not (node.children and node.children[0].type == token.STRING):
+ # This is the usual case.
+ break
+ insert_pos = idx
+
+ if package is None:
+ import_ = Node(syms.import_name, [
+ Leaf(token.NAME, u"import"),
+ Leaf(token.NAME, name_to_import, prefix=u" ")
+ ])
+ else:
+ import_ = FromImport(package, [Leaf(token.NAME, name_to_import, prefix=u" ")])
+ if name_to_import == u'standard_library':
+ # Add:
+ # standard_library.install_aliases()
+ # after:
+ # from future import standard_library
+ install_hooks = Node(syms.simple_stmt,
+ [Node(syms.power,
+ [Leaf(token.NAME, u'standard_library'),
+ Node(syms.trailer, [Leaf(token.DOT, u'.'),
+ Leaf(token.NAME, u'install_aliases')]),
+ Node(syms.trailer, [Leaf(token.LPAR, u'('),
+ Leaf(token.RPAR, u')')])
+ ])
+ ]
+ )
+ children_hooks = [install_hooks, Newline()]
+ else:
+ children_hooks = []
+
+ FromImport(package, [Leaf(token.NAME, name_to_import, prefix=u" ")])
+
+ children_import = [import_, Newline()]
+ root.insert_child(insert_pos, Node(syms.simple_stmt, children_import))
+ if len(children_hooks) > 0:
+ root.insert_child(insert_pos + 1, Node(syms.simple_stmt, children_hooks))
+
+
+## The following functions are from python-modernize by Armin Ronacher:
+# (a little edited).
+
+def check_future_import(node):
+ """If this is a future import, return set of symbols that are imported,
+ else return None."""
+ # node should be the import statement here
+ savenode = node
+ if not (node.type == syms.simple_stmt and node.children):
+ return set()
+ node = node.children[0]
+ # now node is the import_from node
+ if not (node.type == syms.import_from and
+ # node.type == token.NAME and # seems to break it
+ hasattr(node.children[1], 'value') and
+ node.children[1].value == u'__future__'):
+ return set()
+ node = node.children[3]
+ # now node is the import_as_name[s]
+ # print(python_grammar.number2symbol[node.type]) # breaks sometimes
+ if node.type == syms.import_as_names:
+ result = set()
+ for n in node.children:
+ if n.type == token.NAME:
+ result.add(n.value)
+ elif n.type == syms.import_as_name:
+ n = n.children[0]
+ assert n.type == token.NAME
+ result.add(n.value)
+ return result
+ elif node.type == syms.import_as_name:
+ node = node.children[0]
+ assert node.type == token.NAME
+ return set([node.value])
+ elif node.type == token.NAME:
+ return set([node.value])
+ else:
+ # TODO: handle brackets like this:
+ # from __future__ import (absolute_import, division)
+ assert False, "strange import: %s" % savenode
+
+
+SHEBANG_REGEX = r'^#!.*python'
+ENCODING_REGEX = r"^#.*coding[:=]\s*([-\w.]+)"
+
+
+def is_shebang_comment(node):
+ """
+ Comments are prefixes for Leaf nodes. Returns whether the given node has a
+ prefix that looks like a shebang line or an encoding line:
+
+ #!/usr/bin/env python
+ #!/usr/bin/python3
+ """
+ return bool(re.match(SHEBANG_REGEX, node.prefix))
+
+
+def is_encoding_comment(node):
+ """
+ Comments are prefixes for Leaf nodes. Returns whether the given node has a
+ prefix that looks like an encoding line:
+
+ # coding: utf-8
+ # encoding: utf-8
+ # -*- coding: -*-
+ # vim: set fileencoding= :
+ """
+ return bool(re.match(ENCODING_REGEX, node.prefix))
+
+
+def wrap_in_fn_call(fn_name, args, prefix=None):
+ """
+ Example:
+ >>> wrap_in_fn_call("oldstr", (arg,))
+ oldstr(arg)
+
+ >>> wrap_in_fn_call("olddiv", (arg1, arg2))
+ olddiv(arg1, arg2)
+ """
+ assert len(args) > 0
+ if len(args) == 1:
+ newargs = args
+ elif len(args) == 2:
+ expr1, expr2 = args
+ newargs = [expr1, Comma(), expr2]
+ else:
+ assert NotImplementedError('write me')
+ return Call(Name(fn_name), newargs, prefix=prefix)
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/__init__.py
new file mode 100644
index 0000000..556abe8
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/__init__.py
@@ -0,0 +1,97 @@
+import sys
+from lib2to3 import refactor
+
+# The following fixers are "safe": they convert Python 2 code to more
+# modern Python 2 code. They should be uncontroversial to apply to most
+# projects that are happy to drop support for Py2.5 and below. Applying
+# them first will reduce the size of the patch set for the real porting.
+lib2to3_fix_names_stage1 = set([
+ 'lib2to3.fixes.fix_apply',
+ 'lib2to3.fixes.fix_except',
+ 'lib2to3.fixes.fix_exitfunc',
+ 'lib2to3.fixes.fix_funcattrs',
+ 'lib2to3.fixes.fix_has_key',
+ 'lib2to3.fixes.fix_idioms',
+ # 'lib2to3.fixes.fix_import', # makes any implicit relative imports explicit. (Use with ``from __future__ import absolute_import)
+ 'lib2to3.fixes.fix_intern',
+ 'lib2to3.fixes.fix_isinstance',
+ 'lib2to3.fixes.fix_methodattrs',
+ 'lib2to3.fixes.fix_ne',
+ # 'lib2to3.fixes.fix_next', # would replace ``next`` method names
+ # with ``__next__``.
+ 'lib2to3.fixes.fix_numliterals', # turns 1L into 1, 0755 into 0o755
+ 'lib2to3.fixes.fix_paren',
+ # 'lib2to3.fixes.fix_print', # see the libfuturize fixer that also
+ # adds ``from __future__ import print_function``
+ # 'lib2to3.fixes.fix_raise', # uses incompatible with_traceback() method on exceptions
+ 'lib2to3.fixes.fix_reduce', # reduce is available in functools on Py2.6/Py2.7
+ 'lib2to3.fixes.fix_renames', # sys.maxint -> sys.maxsize
+ # 'lib2to3.fixes.fix_set_literal', # this is unnecessary and breaks Py2.6 support
+ 'lib2to3.fixes.fix_repr',
+ 'lib2to3.fixes.fix_standarderror',
+ 'lib2to3.fixes.fix_sys_exc',
+ 'lib2to3.fixes.fix_throw',
+ 'lib2to3.fixes.fix_tuple_params',
+ 'lib2to3.fixes.fix_types',
+ 'lib2to3.fixes.fix_ws_comma', # can perhaps decrease readability: see issue #58
+ 'lib2to3.fixes.fix_xreadlines',
+])
+
+# The following fixers add a dependency on the ``future`` package on order to
+# support Python 2:
+lib2to3_fix_names_stage2 = set([
+ 'lib2to3.fixes.fix_basestring',
+ # 'lib2to3.fixes.fix_buffer', # perhaps not safe. Test this.
+ # 'lib2to3.fixes.fix_callable', # not needed in Py3.2+
+ 'lib2to3.fixes.fix_dict', # TODO: add support for utils.viewitems() etc. and move to stage2
+ 'lib2to3.fixes.fix_exec',
+ # 'lib2to3.fixes.fix_execfile', # some problems: see issue #37.
+ # We use a custom fixer instead (see below)
+ # 'lib2to3.fixes.fix_future', # we don't want to remove __future__ imports
+ 'lib2to3.fixes.fix_getcwdu',
+ # 'lib2to3.fixes.fix_imports', # called by libfuturize.fixes.fix_future_standard_library
+ # 'lib2to3.fixes.fix_imports2', # we don't handle this yet (dbm)
+ 'lib2to3.fixes.fix_input',
+ 'lib2to3.fixes.fix_itertools',
+ 'lib2to3.fixes.fix_itertools_imports',
+ 'lib2to3.fixes.fix_filter',
+ 'lib2to3.fixes.fix_long',
+ 'lib2to3.fixes.fix_map',
+ # 'lib2to3.fixes.fix_metaclass', # causes SyntaxError in Py2! Use the one from ``six`` instead
+ 'lib2to3.fixes.fix_next',
+ 'lib2to3.fixes.fix_nonzero', # TODO: cause this to import ``object`` and/or add a decorator for mapping __bool__ to __nonzero__
+ 'lib2to3.fixes.fix_operator', # we will need support for this by e.g. extending the Py2 operator module to provide those functions in Py3
+ 'lib2to3.fixes.fix_raw_input',
+ # 'lib2to3.fixes.fix_unicode', # strips off the u'' prefix, which removes a potentially helpful source of information for disambiguating unicode/byte strings
+ # 'lib2to3.fixes.fix_urllib', # included in libfuturize.fix_future_standard_library_urllib
+ # 'lib2to3.fixes.fix_xrange', # custom one because of a bug with Py3.3's lib2to3
+ 'lib2to3.fixes.fix_zip',
+])
+
+libfuturize_fix_names_stage1 = set([
+ 'libfuturize.fixes.fix_absolute_import',
+ 'libfuturize.fixes.fix_next_call', # obj.next() -> next(obj). Unlike
+ # lib2to3.fixes.fix_next, doesn't change
+ # the ``next`` method to ``__next__``.
+ 'libfuturize.fixes.fix_print_with_import',
+ 'libfuturize.fixes.fix_raise',
+ # 'libfuturize.fixes.fix_order___future__imports', # TODO: consolidate to a single line to simplify testing
+])
+
+libfuturize_fix_names_stage2 = set([
+ # 'libfuturize.fixes.fix_add__future__imports_except_unicode_literals', # just in case
+ 'libfuturize.fixes.fix_cmp',
+ 'libfuturize.fixes.fix_division_safe',
+ 'libfuturize.fixes.fix_execfile',
+ 'libfuturize.fixes.fix_future_builtins',
+ 'libfuturize.fixes.fix_future_standard_library',
+ 'libfuturize.fixes.fix_future_standard_library_urllib',
+ 'libfuturize.fixes.fix_metaclass',
+ 'libpasteurize.fixes.fix_newstyle',
+ 'libfuturize.fixes.fix_object',
+ # 'libfuturize.fixes.fix_order___future__imports', # TODO: consolidate to a single line to simplify testing
+ 'libfuturize.fixes.fix_unicode_keep_u',
+ # 'libfuturize.fixes.fix_unicode_literals_import',
+ 'libfuturize.fixes.fix_xrange_with_import', # custom one because of a bug with Py3.3's lib2to3
+])
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_UserDict.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_UserDict.py
new file mode 100644
index 0000000..d028b31
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_UserDict.py
@@ -0,0 +1,104 @@
+"""Fix UserDict.
+
+Incomplete!
+
+TODO: base this on fix_urllib perhaps?
+"""
+
+
+# Local imports
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Name, attr_chain
+from lib2to3.fixes.fix_imports import alternates, build_pattern, FixImports
+
+MAPPING = {'UserDict': 'collections',
+}
+
+# def alternates(members):
+# return "(" + "|".join(map(repr, members)) + ")"
+#
+#
+# def build_pattern(mapping=MAPPING):
+# mod_list = ' | '.join(["module_name='%s'" % key for key in mapping])
+# bare_names = alternates(mapping.keys())
+#
+# yield """name_import=import_name< 'import' ((%s) |
+# multiple_imports=dotted_as_names< any* (%s) any* >) >
+# """ % (mod_list, mod_list)
+# yield """import_from< 'from' (%s) 'import' ['(']
+# ( any | import_as_name< any 'as' any > |
+# import_as_names< any* >) [')'] >
+# """ % mod_list
+# yield """import_name< 'import' (dotted_as_name< (%s) 'as' any > |
+# multiple_imports=dotted_as_names<
+# any* dotted_as_name< (%s) 'as' any > any* >) >
+# """ % (mod_list, mod_list)
+#
+# # Find usages of module members in code e.g. thread.foo(bar)
+# yield "power< bare_with_attr=(%s) trailer<'.' any > any* >" % bare_names
+
+
+# class FixUserDict(fixer_base.BaseFix):
+class FixUserdict(FixImports):
+
+ BM_compatible = True
+ keep_line_order = True
+ # This is overridden in fix_imports2.
+ mapping = MAPPING
+
+ # We want to run this fixer late, so fix_import doesn't try to make stdlib
+ # renames into relative imports.
+ run_order = 6
+
+ def build_pattern(self):
+ return "|".join(build_pattern(self.mapping))
+
+ def compile_pattern(self):
+ # We override this, so MAPPING can be pragmatically altered and the
+ # changes will be reflected in PATTERN.
+ self.PATTERN = self.build_pattern()
+ super(FixImports, self).compile_pattern()
+
+ # Don't match the node if it's within another match.
+ def match(self, node):
+ match = super(FixImports, self).match
+ results = match(node)
+ if results:
+ # Module usage could be in the trailer of an attribute lookup, so we
+ # might have nested matches when "bare_with_attr" is present.
+ if "bare_with_attr" not in results and \
+ any(match(obj) for obj in attr_chain(node, "parent")):
+ return False
+ return results
+ return False
+
+ def start_tree(self, tree, filename):
+ super(FixImports, self).start_tree(tree, filename)
+ self.replace = {}
+
+ def transform(self, node, results):
+ import_mod = results.get("module_name")
+ if import_mod:
+ mod_name = import_mod.value
+ new_name = unicode(self.mapping[mod_name])
+ import_mod.replace(Name(new_name, prefix=import_mod.prefix))
+ if "name_import" in results:
+ # If it's not a "from x import x, y" or "import x as y" import,
+ # marked its usage to be replaced.
+ self.replace[mod_name] = new_name
+ if "multiple_imports" in results:
+ # This is a nasty hack to fix multiple imports on a line (e.g.,
+ # "import StringIO, urlparse"). The problem is that I can't
+ # figure out an easy way to make a pattern recognize the keys of
+ # MAPPING randomly sprinkled in an import statement.
+ results = self.match(node)
+ if results:
+ self.transform(node, results)
+ else:
+ # Replace usage of the module.
+ import pdb; pdb.set_trace()
+ bare_name = results["bare_with_attr"][0]
+ new_name = self.replace.get(bare_name.value)
+ if new_name:
+ bare_name.replace(Name(new_name, prefix=bare_name.prefix))
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_absolute_import.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_absolute_import.py
new file mode 100644
index 0000000..ab6a764
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_absolute_import.py
@@ -0,0 +1,92 @@
+"""
+Fixer for import statements, with a __future__ import line.
+
+Based on lib2to3/fixes/fix_import.py, but extended slightly so it also
+supports Cython modules.
+
+If spam is being imported from the local directory, this import:
+ from spam import eggs
+becomes:
+ from __future__ import absolute_import
+ from .spam import eggs
+
+and this import:
+ import spam
+becomes:
+ from __future__ import absolute_import
+ from . import spam
+"""
+
+from os.path import dirname, join, exists, sep
+from lib2to3.fixes.fix_import import FixImport
+from lib2to3.fixer_util import FromImport, syms
+from lib2to3.fixes.fix_import import traverse_imports
+
+from libfuturize.fixer_util import future_import
+
+
+class FixAbsoluteImport(FixImport):
+ run_order = 9
+
+ def transform(self, node, results):
+ """
+ Copied from FixImport.transform(), but with this line added in
+ any modules that had implicit relative imports changed:
+
+ from __future__ import absolute_import"
+ """
+ if self.skip:
+ return
+ imp = results['imp']
+
+ if node.type == syms.import_from:
+ # Some imps are top-level (eg: 'import ham')
+ # some are first level (eg: 'import ham.eggs')
+ # some are third level (eg: 'import ham.eggs as spam')
+ # Hence, the loop
+ while not hasattr(imp, 'value'):
+ imp = imp.children[0]
+ if self.probably_a_local_import(imp.value):
+ imp.value = u"." + imp.value
+ imp.changed()
+ future_import(u"absolute_import", node)
+ else:
+ have_local = False
+ have_absolute = False
+ for mod_name in traverse_imports(imp):
+ if self.probably_a_local_import(mod_name):
+ have_local = True
+ else:
+ have_absolute = True
+ if have_absolute:
+ if have_local:
+ # We won't handle both sibling and absolute imports in the
+ # same statement at the moment.
+ self.warning(node, "absolute and local imports together")
+ return
+
+ new = FromImport(u".", [imp])
+ new.prefix = node.prefix
+ future_import(u"absolute_import", node)
+ return new
+
+ def probably_a_local_import(self, imp_name):
+ """
+ Like the corresponding method in the base class, but this also
+ supports Cython modules.
+ """
+ if imp_name.startswith(u"."):
+ # Relative imports are certainly not local imports.
+ return False
+ imp_name = imp_name.split(u".", 1)[0]
+ base_path = dirname(self.filename)
+ base_path = join(base_path, imp_name)
+ # If there is no __init__.py next to the file its not in a package
+ # so can't be a relative import.
+ if not exists(join(dirname(base_path), "__init__.py")):
+ return False
+ for ext in [".py", sep, ".pyc", ".so", ".sl", ".pyd", ".pyx"]:
+ if exists(base_path + ext):
+ return True
+ return False
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_add__future__imports_except_unicode_literals.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_add__future__imports_except_unicode_literals.py
new file mode 100644
index 0000000..1904d37
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_add__future__imports_except_unicode_literals.py
@@ -0,0 +1,27 @@
+"""
+Fixer for adding:
+
+ from __future__ import absolute_import
+ from __future__ import division
+ from __future__ import print_function
+
+This is "stage 1": hopefully uncontroversial changes.
+
+Stage 2 adds ``unicode_literals``.
+"""
+
+from lib2to3 import fixer_base
+from libfuturize.fixer_util import future_import
+
+class FixAddFutureImportsExceptUnicodeLiterals(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "file_input"
+
+ run_order = 9
+
+ def transform(self, node, results):
+ # Reverse order:
+ future_import(u"print_function", node)
+ future_import(u"division", node)
+ future_import(u"absolute_import", node)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_bytes.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_bytes.py
new file mode 100644
index 0000000..4202122
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_bytes.py
@@ -0,0 +1,24 @@
+"""Optional fixer that changes all unprefixed string literals "..." to b"...".
+
+br'abcd' is a SyntaxError on Python 2 but valid on Python 3.
+ur'abcd' is a SyntaxError on Python 3 but valid on Python 2.
+
+"""
+from __future__ import unicode_literals
+
+import re
+from lib2to3.pgen2 import token
+from lib2to3 import fixer_base
+
+_literal_re = re.compile(r"[^bBuUrR]?[\'\"]")
+
+class FixBytes(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "STRING"
+
+ def transform(self, node, results):
+ if node.type == token.STRING:
+ if _literal_re.match(node.value):
+ new = node.clone()
+ new.value = u'b' + new.value
+ return new
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_cmp.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_cmp.py
new file mode 100644
index 0000000..be56507
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_cmp.py
@@ -0,0 +1,34 @@
+# coding: utf-8
+"""
+Fixer for the cmp() function on Py2, which was removed in Py3.
+
+Adds this import line::
+
+ from past.builtins import cmp
+
+if cmp() is called in the code.
+"""
+
+from __future__ import unicode_literals
+from lib2to3 import fixer_base
+
+from libfuturize.fixer_util import touch_import_top
+
+
+expression = "name='cmp'"
+
+
+class FixCmp(fixer_base.BaseFix):
+ BM_compatible = True
+ run_order = 9
+
+ PATTERN = """
+ power<
+ ({0}) trailer< '(' args=[any] ')' >
+ rest=any* >
+ """.format(expression)
+
+ def transform(self, node, results):
+ name = results["name"]
+ touch_import_top(u'past.builtins', name.value, node)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_division.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_division.py
new file mode 100644
index 0000000..4874550
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_division.py
@@ -0,0 +1,13 @@
+"""
+UNFINISHED
+For the ``future`` package.
+
+Adds this import line:
+
+ from __future__ import division
+
+at the top so the code runs identically on Py3 and Py2.6/2.7
+"""
+
+from libpasteurize.fixes.fix_division import FixDivision
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_division_safe.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_division_safe.py
new file mode 100644
index 0000000..5e16b0a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_division_safe.py
@@ -0,0 +1,72 @@
+"""
+For the ``future`` package.
+
+Adds this import line:
+
+ from __future__ import division
+
+at the top and changes any old-style divisions to be calls to
+past.utils.old_div so the code runs as before on Py2.6/2.7 and has the same
+behaviour on Py3.
+
+If "from __future__ import division" is already in effect, this fixer does
+nothing.
+"""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import syms, does_tree_import
+from libfuturize.fixer_util import (token, future_import, touch_import_top,
+ wrap_in_fn_call)
+
+
+def match_division(node):
+ u"""
+ __future__.division redefines the meaning of a single slash for division,
+ so we match that and only that.
+ """
+ slash = token.SLASH
+ return node.type == slash and not node.next_sibling.type == slash and \
+ not node.prev_sibling.type == slash
+
+
+class FixDivisionSafe(fixer_base.BaseFix):
+ # BM_compatible = True
+ run_order = 4 # this seems to be ignored?
+
+ _accept_type = token.SLASH
+
+ PATTERN = """
+ term<(not('/') any)+ '/' ((not('/') any))>
+ """
+
+ def start_tree(self, tree, name):
+ """
+ Skip this fixer if "__future__.division" is already imported.
+ """
+ super(FixDivisionSafe, self).start_tree(tree, name)
+ self.skip = "division" in tree.future_features
+
+ def match(self, node):
+ u"""
+ Since the tree needs to be fixed once and only once if and only if it
+ matches, we can start discarding matches after the first.
+ """
+ if (node.type == self.syms.term and
+ len(node.children) == 3 and
+ match_division(node.children[1])):
+ expr1, expr2 = node.children[0], node.children[2]
+ return expr1, expr2
+ else:
+ return False
+
+ def transform(self, node, results):
+ if self.skip:
+ return
+ future_import(u"division", node)
+
+ touch_import_top(u'past.utils', u'old_div', node)
+ expr1, expr2 = results[0].clone(), results[1].clone()
+ # Strip any leading space for the first number:
+ expr1.prefix = u''
+ return wrap_in_fn_call("old_div", (expr1, expr2), prefix=node.prefix)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_execfile.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_execfile.py
new file mode 100644
index 0000000..2b794c8
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_execfile.py
@@ -0,0 +1,38 @@
+# coding: utf-8
+"""
+Fixer for the execfile() function on Py2, which was removed in Py3.
+
+The Lib/lib2to3/fixes/fix_execfile.py module has some problems: see
+python-future issue #37. This fixer merely imports execfile() from
+past.builtins and leaves the code alone.
+
+Adds this import line::
+
+ from past.builtins import execfile
+
+for the function execfile() that was removed from Py3.
+"""
+
+from __future__ import unicode_literals
+from lib2to3 import fixer_base
+
+from libfuturize.fixer_util import touch_import_top
+
+
+expression = "name='execfile'"
+
+
+class FixExecfile(fixer_base.BaseFix):
+ BM_compatible = True
+ run_order = 9
+
+ PATTERN = """
+ power<
+ ({0}) trailer< '(' args=[any] ')' >
+ rest=any* >
+ """.format(expression)
+
+ def transform(self, node, results):
+ name = results["name"]
+ touch_import_top(u'past.builtins', name.value, node)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_future_builtins.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_future_builtins.py
new file mode 100644
index 0000000..bf3aba4
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_future_builtins.py
@@ -0,0 +1,60 @@
+"""
+For the ``future`` package.
+
+Adds this import line::
+
+ from builtins import XYZ
+
+for each of the functions XYZ that is used in the module.
+
+Adds these imports after any other imports (in an initial block of them).
+"""
+
+from __future__ import unicode_literals
+
+from lib2to3 import fixer_base
+from lib2to3.pygram import python_symbols as syms
+from lib2to3.fixer_util import Name, Call, in_special_context
+
+from libfuturize.fixer_util import touch_import_top
+
+# All builtins are:
+# from future.builtins.iterators import (filter, map, zip)
+# from future.builtins.misc import (ascii, chr, hex, input, isinstance, oct, open, round, super)
+# from future.types import (bytes, dict, int, range, str)
+# We don't need isinstance any more.
+
+replaced_builtin_fns = '''filter map zip
+ ascii chr hex input next oct
+ bytes range str raw_input'''.split()
+ # This includes raw_input as a workaround for the
+ # lib2to3 fixer for raw_input on Py3 (only), allowing
+ # the correct import to be included. (Py3 seems to run
+ # the fixers the wrong way around, perhaps ignoring the
+ # run_order class attribute below ...)
+
+expression = '|'.join(["name='{0}'".format(name) for name in replaced_builtin_fns])
+
+
+class FixFutureBuiltins(fixer_base.BaseFix):
+ BM_compatible = True
+ run_order = 7
+
+ # Currently we only match uses as a function. This doesn't match e.g.:
+ # if isinstance(s, str):
+ # ...
+ PATTERN = """
+ power<
+ ({0}) trailer< '(' [arglist=any] ')' >
+ rest=any* >
+ |
+ power<
+ 'map' trailer< '(' [arglist=any] ')' >
+ >
+ """.format(expression)
+
+ def transform(self, node, results):
+ name = results["name"]
+ touch_import_top(u'builtins', name.value, node)
+ # name.replace(Name(u"input", prefix=name.prefix))
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_future_standard_library.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_future_standard_library.py
new file mode 100644
index 0000000..501c2a9
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_future_standard_library.py
@@ -0,0 +1,26 @@
+"""
+For the ``future`` package.
+
+Changes any imports needed to reflect the standard library reorganization. Also
+Also adds these import lines:
+
+ from future import standard_library
+ standard_library.install_aliases()
+
+after any __future__ imports but before any other imports.
+"""
+
+from lib2to3.fixes.fix_imports import FixImports
+from libfuturize.fixer_util import touch_import_top
+
+
+class FixFutureStandardLibrary(FixImports):
+ run_order = 8
+
+ def transform(self, node, results):
+ result = super(FixFutureStandardLibrary, self).transform(node, results)
+ # TODO: add a blank line between any __future__ imports and this?
+ touch_import_top(u'future', u'standard_library', node)
+ return result
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_future_standard_library_urllib.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_future_standard_library_urllib.py
new file mode 100644
index 0000000..3d62959
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_future_standard_library_urllib.py
@@ -0,0 +1,30 @@
+"""
+For the ``future`` package.
+
+A special fixer that ensures that these lines have been added::
+
+ from future import standard_library
+ standard_library.install_hooks()
+
+even if the only module imported was ``urllib``, in which case the regular fixer
+wouldn't have added these lines.
+
+"""
+
+from lib2to3.fixes.fix_urllib import FixUrllib
+from libfuturize.fixer_util import touch_import_top, find_root
+
+
+class FixFutureStandardLibraryUrllib(FixUrllib): # not a subclass of FixImports
+ run_order = 8
+
+ def transform(self, node, results):
+ # transform_member() in lib2to3/fixes/fix_urllib.py breaks node so find_root(node)
+ # no longer works after the super() call below. So we find the root first:
+ root = find_root(node)
+ result = super(FixFutureStandardLibraryUrllib, self).transform(node, results)
+ # TODO: add a blank line between any __future__ imports and this?
+ touch_import_top(u'future', u'standard_library', root)
+ return result
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_metaclass.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_metaclass.py
new file mode 100644
index 0000000..a917341
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_metaclass.py
@@ -0,0 +1,257 @@
+# coding: utf-8
+"""Fixer for __metaclass__ = X -> (future.utils.with_metaclass(X)) methods.
+
+ The various forms of classef (inherits nothing, inherits once, inherints
+ many) don't parse the same in the CST so we look at ALL classes for
+ a __metaclass__ and if we find one normalize the inherits to all be
+ an arglist.
+
+ For one-liner classes ('class X: pass') there is no indent/dedent so
+ we normalize those into having a suite.
+
+ Moving the __metaclass__ into the classdef can also cause the class
+ body to be empty so there is some special casing for that as well.
+
+ This fixer also tries very hard to keep original indenting and spacing
+ in all those corner cases.
+"""
+# This is a derived work of Lib/lib2to3/fixes/fix_metaclass.py under the
+# copyright of the Python Software Foundation, licensed under the Python
+# Software Foundation License 2.
+#
+# Copyright notice:
+#
+# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+# 2011, 2012, 2013 Python Software Foundation. All rights reserved.
+#
+# Full license text: http://docs.python.org/3.4/license.html
+
+# Author: Jack Diederich, Daniel Neuhäuser
+
+# Local imports
+from lib2to3 import fixer_base
+from lib2to3.pygram import token
+from lib2to3.fixer_util import Name, syms, Node, Leaf, touch_import, Call, \
+ String, Comma, parenthesize
+
+
+def has_metaclass(parent):
+ """ we have to check the cls_node without changing it.
+ There are two possiblities:
+ 1) clsdef => suite => simple_stmt => expr_stmt => Leaf('__meta')
+ 2) clsdef => simple_stmt => expr_stmt => Leaf('__meta')
+ """
+ for node in parent.children:
+ if node.type == syms.suite:
+ return has_metaclass(node)
+ elif node.type == syms.simple_stmt and node.children:
+ expr_node = node.children[0]
+ if expr_node.type == syms.expr_stmt and expr_node.children:
+ left_side = expr_node.children[0]
+ if isinstance(left_side, Leaf) and \
+ left_side.value == '__metaclass__':
+ return True
+ return False
+
+
+def fixup_parse_tree(cls_node):
+ """ one-line classes don't get a suite in the parse tree so we add
+ one to normalize the tree
+ """
+ for node in cls_node.children:
+ if node.type == syms.suite:
+ # already in the preferred format, do nothing
+ return
+
+ # !%@#! oneliners have no suite node, we have to fake one up
+ for i, node in enumerate(cls_node.children):
+ if node.type == token.COLON:
+ break
+ else:
+ raise ValueError("No class suite and no ':'!")
+
+ # move everything into a suite node
+ suite = Node(syms.suite, [])
+ while cls_node.children[i+1:]:
+ move_node = cls_node.children[i+1]
+ suite.append_child(move_node.clone())
+ move_node.remove()
+ cls_node.append_child(suite)
+ node = suite
+
+
+def fixup_simple_stmt(parent, i, stmt_node):
+ """ if there is a semi-colon all the parts count as part of the same
+ simple_stmt. We just want the __metaclass__ part so we move
+ everything efter the semi-colon into its own simple_stmt node
+ """
+ for semi_ind, node in enumerate(stmt_node.children):
+ if node.type == token.SEMI: # *sigh*
+ break
+ else:
+ return
+
+ node.remove() # kill the semicolon
+ new_expr = Node(syms.expr_stmt, [])
+ new_stmt = Node(syms.simple_stmt, [new_expr])
+ while stmt_node.children[semi_ind:]:
+ move_node = stmt_node.children[semi_ind]
+ new_expr.append_child(move_node.clone())
+ move_node.remove()
+ parent.insert_child(i, new_stmt)
+ new_leaf1 = new_stmt.children[0].children[0]
+ old_leaf1 = stmt_node.children[0].children[0]
+ new_leaf1.prefix = old_leaf1.prefix
+
+
+def remove_trailing_newline(node):
+ if node.children and node.children[-1].type == token.NEWLINE:
+ node.children[-1].remove()
+
+
+def find_metas(cls_node):
+ # find the suite node (Mmm, sweet nodes)
+ for node in cls_node.children:
+ if node.type == syms.suite:
+ break
+ else:
+ raise ValueError("No class suite!")
+
+ # look for simple_stmt[ expr_stmt[ Leaf('__metaclass__') ] ]
+ for i, simple_node in list(enumerate(node.children)):
+ if simple_node.type == syms.simple_stmt and simple_node.children:
+ expr_node = simple_node.children[0]
+ if expr_node.type == syms.expr_stmt and expr_node.children:
+ # Check if the expr_node is a simple assignment.
+ left_node = expr_node.children[0]
+ if isinstance(left_node, Leaf) and \
+ left_node.value == u'__metaclass__':
+ # We found a assignment to __metaclass__.
+ fixup_simple_stmt(node, i, simple_node)
+ remove_trailing_newline(simple_node)
+ yield (node, i, simple_node)
+
+
+def fixup_indent(suite):
+ """ If an INDENT is followed by a thing with a prefix then nuke the prefix
+ Otherwise we get in trouble when removing __metaclass__ at suite start
+ """
+ kids = suite.children[::-1]
+ # find the first indent
+ while kids:
+ node = kids.pop()
+ if node.type == token.INDENT:
+ break
+
+ # find the first Leaf
+ while kids:
+ node = kids.pop()
+ if isinstance(node, Leaf) and node.type != token.DEDENT:
+ if node.prefix:
+ node.prefix = u''
+ return
+ else:
+ kids.extend(node.children[::-1])
+
+
+class FixMetaclass(fixer_base.BaseFix):
+ BM_compatible = True
+
+ PATTERN = """
+ classdef
+ """
+
+ def transform(self, node, results):
+ if not has_metaclass(node):
+ return
+
+ fixup_parse_tree(node)
+
+ # find metaclasses, keep the last one
+ last_metaclass = None
+ for suite, i, stmt in find_metas(node):
+ last_metaclass = stmt
+ stmt.remove()
+
+ text_type = node.children[0].type # always Leaf(nnn, 'class')
+
+ # figure out what kind of classdef we have
+ if len(node.children) == 7:
+ # Node(classdef, ['class', 'name', '(', arglist, ')', ':', suite])
+ # 0 1 2 3 4 5 6
+ if node.children[3].type == syms.arglist:
+ arglist = node.children[3]
+ # Node(classdef, ['class', 'name', '(', 'Parent', ')', ':', suite])
+ else:
+ parent = node.children[3].clone()
+ arglist = Node(syms.arglist, [parent])
+ node.set_child(3, arglist)
+ elif len(node.children) == 6:
+ # Node(classdef, ['class', 'name', '(', ')', ':', suite])
+ # 0 1 2 3 4 5
+ arglist = Node(syms.arglist, [])
+ node.insert_child(3, arglist)
+ elif len(node.children) == 4:
+ # Node(classdef, ['class', 'name', ':', suite])
+ # 0 1 2 3
+ arglist = Node(syms.arglist, [])
+ node.insert_child(2, Leaf(token.RPAR, u')'))
+ node.insert_child(2, arglist)
+ node.insert_child(2, Leaf(token.LPAR, u'('))
+ else:
+ raise ValueError("Unexpected class definition")
+
+ # Was: touch_import(None, u'future.utils', node)
+ touch_import(u'future.utils', u'with_metaclass', node)
+
+ metaclass = last_metaclass.children[0].children[2].clone()
+ metaclass.prefix = u''
+
+ arguments = [metaclass]
+
+ if arglist.children:
+ if len(arglist.children) == 1:
+ base = arglist.children[0].clone()
+ base.prefix = u' '
+ else:
+ # Unfortunately six.with_metaclass() only allows one base
+ # class, so we have to dynamically generate a base class if
+ # there is more than one.
+ bases = parenthesize(arglist.clone())
+ bases.prefix = u' '
+ base = Call(Name('type'), [
+ String("'NewBase'"),
+ Comma(),
+ bases,
+ Comma(),
+ Node(
+ syms.atom,
+ [Leaf(token.LBRACE, u'{'), Leaf(token.RBRACE, u'}')],
+ prefix=u' '
+ )
+ ], prefix=u' ')
+ arguments.extend([Comma(), base])
+
+ arglist.replace(Call(
+ Name(u'with_metaclass', prefix=arglist.prefix),
+ arguments
+ ))
+
+ fixup_indent(suite)
+
+ # check for empty suite
+ if not suite.children:
+ # one-liner that was just __metaclass_
+ suite.remove()
+ pass_leaf = Leaf(text_type, u'pass')
+ pass_leaf.prefix = orig_meta_prefix
+ node.append_child(pass_leaf)
+ node.append_child(Leaf(token.NEWLINE, u'\n'))
+
+ elif len(suite.children) > 1 and \
+ (suite.children[-2].type == token.INDENT and
+ suite.children[-1].type == token.DEDENT):
+ # there was only one line in the class body and it was __metaclass__
+ pass_leaf = Leaf(text_type, u'pass')
+ suite.insert_child(-1, pass_leaf)
+ suite.insert_child(-1, Leaf(token.NEWLINE, u'\n'))
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_next_call.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_next_call.py
new file mode 100644
index 0000000..282f185
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_next_call.py
@@ -0,0 +1,104 @@
+"""
+Based on fix_next.py by Collin Winter.
+
+Replaces it.next() -> next(it), per PEP 3114.
+
+Unlike fix_next.py, this fixer doesn't replace the name of a next method with __next__,
+which would break Python 2 compatibility without further help from fixers in
+stage 2.
+"""
+
+# Local imports
+from lib2to3.pgen2 import token
+from lib2to3.pygram import python_symbols as syms
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Name, Call, find_binding
+
+bind_warning = "Calls to builtin next() possibly shadowed by global binding"
+
+
+class FixNextCall(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = """
+ power< base=any+ trailer< '.' attr='next' > trailer< '(' ')' > >
+ |
+ power< head=any+ trailer< '.' attr='next' > not trailer< '(' ')' > >
+ |
+ global=global_stmt< 'global' any* 'next' any* >
+ """
+
+ order = "pre" # Pre-order tree traversal
+
+ def start_tree(self, tree, filename):
+ super(FixNextCall, self).start_tree(tree, filename)
+
+ n = find_binding('next', tree)
+ if n:
+ self.warning(n, bind_warning)
+ self.shadowed_next = True
+ else:
+ self.shadowed_next = False
+
+ def transform(self, node, results):
+ assert results
+
+ base = results.get("base")
+ attr = results.get("attr")
+ name = results.get("name")
+
+ if base:
+ if self.shadowed_next:
+ # Omit this:
+ # attr.replace(Name("__next__", prefix=attr.prefix))
+ pass
+ else:
+ base = [n.clone() for n in base]
+ base[0].prefix = ""
+ node.replace(Call(Name("next", prefix=node.prefix), base))
+ elif name:
+ # Omit this:
+ # n = Name("__next__", prefix=name.prefix)
+ # name.replace(n)
+ pass
+ elif attr:
+ # We don't do this transformation if we're assigning to "x.next".
+ # Unfortunately, it doesn't seem possible to do this in PATTERN,
+ # so it's being done here.
+ if is_assign_target(node):
+ head = results["head"]
+ if "".join([str(n) for n in head]).strip() == '__builtin__':
+ self.warning(node, bind_warning)
+ return
+ # Omit this:
+ # attr.replace(Name("__next__"))
+ elif "global" in results:
+ self.warning(node, bind_warning)
+ self.shadowed_next = True
+
+
+### The following functions help test if node is part of an assignment
+### target.
+
+def is_assign_target(node):
+ assign = find_assign(node)
+ if assign is None:
+ return False
+
+ for child in assign.children:
+ if child.type == token.EQUAL:
+ return False
+ elif is_subtree(child, node):
+ return True
+ return False
+
+def find_assign(node):
+ if node.type == syms.expr_stmt:
+ return node
+ if node.type == syms.simple_stmt or node.parent is None:
+ return None
+ return find_assign(node.parent)
+
+def is_subtree(root, node):
+ if root == node:
+ return True
+ return any(is_subtree(c, node) for c in root.children)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_object.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_object.py
new file mode 100644
index 0000000..accf2c5
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_object.py
@@ -0,0 +1,17 @@
+"""
+Fixer that adds ``from builtins import object`` if there is a line
+like this:
+ class Foo(object):
+"""
+
+from lib2to3 import fixer_base
+
+from libfuturize.fixer_util import touch_import_top
+
+
+class FixObject(fixer_base.BaseFix):
+
+ PATTERN = u"classdef< 'class' NAME '(' name='object' ')' colon=':' any >"
+
+ def transform(self, node, results):
+ touch_import_top(u'builtins', 'object', node)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_oldstr_wrap.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_oldstr_wrap.py
new file mode 100644
index 0000000..4258f6a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_oldstr_wrap.py
@@ -0,0 +1,80 @@
+"""
+For the ``future`` package.
+
+Adds this import line:
+
+ from past.builtins import str as oldstr
+
+at the top and wraps any unadorned string literals 'abc' or explicit byte-string
+literals b'abc' in oldstr() calls so the code has the same behaviour on Py3 as
+on Py2.6/2.7.
+"""
+
+from __future__ import unicode_literals
+import re
+from lib2to3 import fixer_base
+from lib2to3.pgen2 import token
+from lib2to3.fixer_util import syms
+from libfuturize.fixer_util import (future_import, touch_import_top,
+ wrap_in_fn_call)
+
+
+_literal_re = re.compile(r"[^uUrR]?[\'\"]")
+
+
+class FixOldstrWrap(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "STRING"
+
+ def transform(self, node, results):
+ import pdb
+ pdb.set_trace()
+ if node.type == token.STRING:
+ touch_import_top(u'past.types', u'oldstr', node)
+ if _literal_re.match(node.value):
+ new = node.clone()
+ # Strip any leading space or comments:
+ # TODO: check: do we really want to do this?
+ new.prefix = u''
+ new.value = u'b' + new.value
+ wrapped = wrap_in_fn_call("oldstr", [new], prefix=node.prefix)
+ return wrapped
+
+ def transform(self, node, results):
+ expr1, expr2 = results[0].clone(), results[1].clone()
+ # Strip any leading space for the first number:
+ expr1.prefix = u''
+ return wrap_in_fn_call("old_div", expr1, expr2, prefix=node.prefix)
+
+
+class FixDivisionSafe(fixer_base.BaseFix):
+ # BM_compatible = True
+ run_order = 4 # this seems to be ignored?
+
+ _accept_type = token.SLASH
+
+ PATTERN = """
+ term<(not('/') any)+ '/' ((not('/') any))>
+ """
+
+ def match(self, node):
+ u"""
+ Since the tree needs to be fixed once and only once if and only if it
+ matches, then we can start discarding matches after we make the first.
+ """
+ if (node.type == self.syms.term and
+ len(node.children) == 3 and
+ match_division(node.children[1])):
+ expr1, expr2 = node.children[0], node.children[2]
+ return expr1, expr2
+ else:
+ return False
+
+ def transform(self, node, results):
+ future_import(u"division", node)
+ touch_import_top(u'past.utils', u'old_div', node)
+ expr1, expr2 = results[0].clone(), results[1].clone()
+ # Strip any leading space for the first number:
+ expr1.prefix = u''
+ return wrap_in_fn_call("old_div", expr1, expr2, prefix=node.prefix)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_order___future__imports.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_order___future__imports.py
new file mode 100644
index 0000000..120665a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_order___future__imports.py
@@ -0,0 +1,39 @@
+"""
+UNFINISHED
+
+Fixer for turning multiple lines like these:
+
+ from __future__ import division
+ from __future__ import absolute_import
+ from __future__ import print_function
+
+into a single line like this:
+
+ from __future__ import (absolute_import, division, print_function)
+
+This helps with testing of ``futurize``.
+"""
+
+from lib2to3 import fixer_base
+from libfuturize.fixer_util import future_import
+
+class FixOrderFutureImports(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "file_input"
+
+ run_order = 10
+
+ # def match(self, node):
+ # """
+ # Match only once per file
+ # """
+ # if hasattr(node, 'type') and node.type == syms.file_input:
+ # import pdb
+ # pdb.set_trace()
+ # return True
+ # return False
+
+ def transform(self, node, results):
+ # TODO # write me
+ pass
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_print.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_print.py
new file mode 100644
index 0000000..247b91b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_print.py
@@ -0,0 +1,94 @@
+# Copyright 2006 Google, Inc. All Rights Reserved.
+# Licensed to PSF under a Contributor Agreement.
+
+"""Fixer for print.
+
+Change:
+ "print" into "print()"
+ "print ..." into "print(...)"
+ "print(...)" not changed
+ "print ... ," into "print(..., end=' ')"
+ "print >>x, ..." into "print(..., file=x)"
+
+No changes are applied if print_function is imported from __future__
+
+"""
+
+# Local imports
+from lib2to3 import patcomp, pytree, fixer_base
+from lib2to3.pgen2 import token
+from lib2to3.fixer_util import Name, Call, Comma, String
+# from libmodernize import add_future
+
+parend_expr = patcomp.compile_pattern(
+ """atom< '(' [arith_expr|atom|power|term|STRING|NAME] ')' >"""
+ )
+
+
+class FixPrint(fixer_base.BaseFix):
+
+ BM_compatible = True
+
+ PATTERN = """
+ simple_stmt< any* bare='print' any* > | print_stmt
+ """
+
+ def transform(self, node, results):
+ assert results
+
+ bare_print = results.get("bare")
+
+ if bare_print:
+ # Special-case print all by itself.
+ bare_print.replace(Call(Name(u"print"), [],
+ prefix=bare_print.prefix))
+ # The "from __future__ import print_function"" declaration is added
+ # by the fix_print_with_import fixer, so we skip it here.
+ # add_future(node, u'print_function')
+ return
+ assert node.children[0] == Name(u"print")
+ args = node.children[1:]
+ if len(args) == 1 and parend_expr.match(args[0]):
+ # We don't want to keep sticking parens around an
+ # already-parenthesised expression.
+ return
+
+ sep = end = file = None
+ if args and args[-1] == Comma():
+ args = args[:-1]
+ end = " "
+ if args and args[0] == pytree.Leaf(token.RIGHTSHIFT, u">>"):
+ assert len(args) >= 2
+ file = args[1].clone()
+ args = args[3:] # Strip a possible comma after the file expression
+ # Now synthesize a print(args, sep=..., end=..., file=...) node.
+ l_args = [arg.clone() for arg in args]
+ if l_args:
+ l_args[0].prefix = u""
+ if sep is not None or end is not None or file is not None:
+ if sep is not None:
+ self.add_kwarg(l_args, u"sep", String(repr(sep)))
+ if end is not None:
+ self.add_kwarg(l_args, u"end", String(repr(end)))
+ if file is not None:
+ self.add_kwarg(l_args, u"file", file)
+ n_stmt = Call(Name(u"print"), l_args)
+ n_stmt.prefix = node.prefix
+
+ # Note that there are corner cases where adding this future-import is
+ # incorrect, for example when the file also has a 'print ()' statement
+ # that was intended to print "()".
+ # add_future(node, u'print_function')
+ return n_stmt
+
+ def add_kwarg(self, l_nodes, s_kwd, n_expr):
+ # XXX All this prefix-setting may lose comments (though rarely)
+ n_expr.prefix = u""
+ n_argument = pytree.Node(self.syms.argument,
+ (Name(s_kwd),
+ pytree.Leaf(token.EQUAL, u"="),
+ n_expr))
+ if l_nodes:
+ l_nodes.append(Comma())
+ n_argument.prefix = u" "
+ l_nodes.append(n_argument)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_print_with_import.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_print_with_import.py
new file mode 100644
index 0000000..5308d92
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_print_with_import.py
@@ -0,0 +1,23 @@
+"""
+For the ``future`` package.
+
+Turns any print statements into functions and adds this import line:
+
+ from __future__ import print_function
+
+at the top to retain compatibility with Python 2.6+.
+"""
+
+from libfuturize.fixes.fix_print import FixPrint
+from libfuturize.fixer_util import future_import
+
+class FixPrintWithImport(FixPrint):
+ run_order = 7
+ def transform(self, node, results):
+ # Add the __future__ import first. (Otherwise any shebang or encoding
+ # comment line attached as a prefix to the print statement will be
+ # copied twice and appear twice.)
+ future_import(u'print_function', node)
+ n_stmt = super(FixPrintWithImport, self).transform(node, results)
+ return n_stmt
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_raise.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_raise.py
new file mode 100644
index 0000000..3e8323d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_raise.py
@@ -0,0 +1,73 @@
+"""Fixer for 'raise E, V'
+
+From Armin Ronacher's ``python-modernize``.
+
+raise -> raise
+raise E -> raise E
+raise E, V -> raise E(V)
+
+raise (((E, E'), E''), E'''), V -> raise E(V)
+
+
+CAVEATS:
+1) "raise E, V" will be incorrectly translated if V is an exception
+ instance. The correct Python 3 idiom is
+
+ raise E from V
+
+ but since we can't detect instance-hood by syntax alone and since
+ any client code would have to be changed as well, we don't automate
+ this.
+"""
+# Author: Collin Winter, Armin Ronacher
+
+# Local imports
+from lib2to3 import pytree, fixer_base
+from lib2to3.pgen2 import token
+from lib2to3.fixer_util import Name, Call, is_tuple
+
+class FixRaise(fixer_base.BaseFix):
+
+ BM_compatible = True
+ PATTERN = """
+ raise_stmt< 'raise' exc=any [',' val=any] >
+ """
+
+ def transform(self, node, results):
+ syms = self.syms
+
+ exc = results["exc"].clone()
+ if exc.type == token.STRING:
+ msg = "Python 3 does not support string exceptions"
+ self.cannot_convert(node, msg)
+ return
+
+ # Python 2 supports
+ # raise ((((E1, E2), E3), E4), E5), V
+ # as a synonym for
+ # raise E1, V
+ # Since Python 3 will not support this, we recurse down any tuple
+ # literals, always taking the first element.
+ if is_tuple(exc):
+ while is_tuple(exc):
+ # exc.children[1:-1] is the unparenthesized tuple
+ # exc.children[1].children[0] is the first element of the tuple
+ exc = exc.children[1].children[0].clone()
+ exc.prefix = u" "
+
+ if "val" not in results:
+ # One-argument raise
+ new = pytree.Node(syms.raise_stmt, [Name(u"raise"), exc])
+ new.prefix = node.prefix
+ return new
+
+ val = results["val"].clone()
+ if is_tuple(val):
+ args = [c.clone() for c in val.children[1:-1]]
+ else:
+ val.prefix = u""
+ args = [val]
+
+ return pytree.Node(syms.raise_stmt,
+ [Name(u"raise"), Call(exc, args)],
+ prefix=node.prefix)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_remove_old__future__imports.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_remove_old__future__imports.py
new file mode 100644
index 0000000..060eb00
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_remove_old__future__imports.py
@@ -0,0 +1,27 @@
+"""
+Fixer for removing any of these lines:
+
+ from __future__ import with_statement
+ from __future__ import nested_scopes
+ from __future__ import generators
+
+The reason is that __future__ imports like these are required to be the first
+line of code (after docstrings) on Python 2.6+, which can get in the way.
+
+These imports are always enabled in Python 2.6+, which is the minimum sane
+version to target for Py2/3 compatibility.
+"""
+
+from lib2to3 import fixer_base
+from libfuturize.fixer_util import remove_future_import
+
+class FixRemoveOldFutureImports(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "file_input"
+ run_order = 1
+
+ def transform(self, node, results):
+ remove_future_import(u"with_statement", node)
+ remove_future_import(u"nested_scopes", node)
+ remove_future_import(u"generators", node)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_unicode_keep_u.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_unicode_keep_u.py
new file mode 100644
index 0000000..a6f70f0
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_unicode_keep_u.py
@@ -0,0 +1,25 @@
+"""Fixer that changes unicode to str and unichr to chr, but -- unlike the
+lib2to3 fix_unicode.py fixer, does not change u"..." into "...".
+
+The reason is that Py3.3+ supports the u"..." string prefix, and, if
+present, the prefix may provide useful information for disambiguating
+between byte strings and unicode strings, which is often the hardest part
+of the porting task.
+
+"""
+
+from lib2to3.pgen2 import token
+from lib2to3 import fixer_base
+
+_mapping = {u"unichr" : u"chr", u"unicode" : u"str"}
+
+class FixUnicodeKeepU(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "'unicode' | 'unichr'"
+
+ def transform(self, node, results):
+ if node.type == token.NAME:
+ new = node.clone()
+ new.value = _mapping[node.value]
+ return new
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_unicode_literals_import.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_unicode_literals_import.py
new file mode 100644
index 0000000..9f21d7c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_unicode_literals_import.py
@@ -0,0 +1,19 @@
+"""
+Adds this import:
+
+ from __future__ import unicode_literals
+
+"""
+
+from lib2to3 import fixer_base
+from libfuturize.fixer_util import future_import
+
+class FixUnicodeLiteralsImport(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "file_input"
+
+ run_order = 9
+
+ def transform(self, node, results):
+ future_import(u"unicode_literals", node)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_xrange_with_import.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_xrange_with_import.py
new file mode 100644
index 0000000..c910f81
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/fixes/fix_xrange_with_import.py
@@ -0,0 +1,20 @@
+"""
+For the ``future`` package.
+
+Turns any xrange calls into range calls and adds this import line:
+
+ from builtins import range
+
+at the top.
+"""
+
+from lib2to3.fixes.fix_xrange import FixXrange
+
+from libfuturize.fixer_util import touch_import_top
+
+
+class FixXrangeWithImport(FixXrange):
+ def transform(self, node, results):
+ result = super(FixXrangeWithImport, self).transform(node, results)
+ touch_import_top('builtins', 'range', node)
+ return result
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/main.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/main.py
new file mode 100644
index 0000000..18f33ec
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libfuturize/main.py
@@ -0,0 +1,302 @@
+"""
+futurize: automatic conversion to clean 2/3 code using ``python-future``
+======================================================================
+
+Like Armin Ronacher's modernize.py, ``futurize`` attempts to produce clean
+standard Python 3 code that runs on both Py2 and Py3.
+
+One pass
+--------
+
+Use it like this on Python 2 code:
+
+ $ futurize --verbose mypython2script.py
+
+This will attempt to port the code to standard Py3 code that also
+provides Py2 compatibility with the help of the right imports from
+``future``.
+
+To write changes to the files, use the -w flag.
+
+Two stages
+----------
+
+The ``futurize`` script can also be called in two separate stages. First:
+
+ $ futurize --stage1 mypython2script.py
+
+This produces more modern Python 2 code that is not yet compatible with Python
+3. The tests should still run and the diff should be uncontroversial to apply to
+most Python projects that are willing to drop support for Python 2.5 and lower.
+
+After this, the recommended approach is to explicitly mark all strings that must
+be byte-strings with a b'' prefix and all text (unicode) strings with a u''
+prefix, and then invoke the second stage of Python 2 to 2/3 conversion with::
+
+ $ futurize --stage2 mypython2script.py
+
+Stage 2 adds a dependency on ``future``. It converts most remaining Python
+2-specific code to Python 3 code and adds appropriate imports from ``future``
+to restore Py2 support.
+
+The command above leaves all unadorned string literals as native strings
+(byte-strings on Py2, unicode strings on Py3). If instead you would like all
+unadorned string literals to be promoted to unicode, you can also pass this
+flag:
+
+ $ futurize --stage2 --unicode-literals mypython2script.py
+
+This adds the declaration ``from __future__ import unicode_literals`` to the
+top of each file, which implicitly declares all unadorned string literals to be
+unicode strings (``unicode`` on Py2).
+
+All imports
+-----------
+
+The --all-imports option forces adding all ``__future__`` imports,
+``builtins`` imports, and standard library aliases, even if they don't
+seem necessary for the current state of each module. (This can simplify
+testing, and can reduce the need to think about Py2 compatibility when editing
+the code further.)
+
+"""
+
+from __future__ import (absolute_import, print_function, unicode_literals)
+import future.utils
+from future import __version__
+
+import sys
+import logging
+import optparse
+import os
+
+from lib2to3.main import main, warn, StdoutRefactoringTool
+from lib2to3 import refactor
+
+from libfuturize.fixes import (lib2to3_fix_names_stage1,
+ lib2to3_fix_names_stage2,
+ libfuturize_fix_names_stage1,
+ libfuturize_fix_names_stage2)
+
+fixer_pkg = 'libfuturize.fixes'
+
+
+def main(args=None):
+ """Main program.
+
+ Args:
+ fixer_pkg: the name of a package where the fixers are located.
+ args: optional; a list of command line arguments. If omitted,
+ sys.argv[1:] is used.
+
+ Returns a suggested exit status (0, 1, 2).
+ """
+
+ # Set up option parser
+ parser = optparse.OptionParser(usage="futurize [options] file|dir ...")
+ parser.add_option("-V", "--version", action="store_true",
+ help="Report the version number of futurize")
+ parser.add_option("-a", "--all-imports", action="store_true",
+ help="Add all __future__ and future imports to each module")
+ parser.add_option("-1", "--stage1", action="store_true",
+ help="Modernize Python 2 code only; no compatibility with Python 3 (or dependency on ``future``)")
+ parser.add_option("-2", "--stage2", action="store_true",
+ help="Take modernized (stage1) code and add a dependency on ``future`` to provide Py3 compatibility.")
+ parser.add_option("-0", "--both-stages", action="store_true",
+ help="Apply both stages 1 and 2")
+ parser.add_option("-u", "--unicode-literals", action="store_true",
+ help="Add ``from __future__ import unicode_literals`` to implicitly convert all unadorned string literals '' into unicode strings")
+ parser.add_option("-f", "--fix", action="append", default=[],
+ help="Each FIX specifies a transformation; default: all.\nEither use '-f division -f metaclass' etc. or use the fully-qualified module name: '-f lib2to3.fixes.fix_types -f libfuturize.fixes.fix_unicode_keep_u'")
+ parser.add_option("-j", "--processes", action="store", default=1,
+ type="int", help="Run 2to3 concurrently")
+ parser.add_option("-x", "--nofix", action="append", default=[],
+ help="Prevent a fixer from being run.")
+ parser.add_option("-l", "--list-fixes", action="store_true",
+ help="List available transformations")
+ parser.add_option("-p", "--print-function", action="store_true",
+ help="Modify the grammar so that print() is a function")
+ parser.add_option("-v", "--verbose", action="store_true",
+ help="More verbose logging")
+ parser.add_option("--no-diffs", action="store_true",
+ help="Don't show diffs of the refactoring")
+ parser.add_option("-w", "--write", action="store_true",
+ help="Write back modified files")
+ parser.add_option("-n", "--nobackups", action="store_true", default=False,
+ help="Don't write backups for modified files.")
+ parser.add_option("-o", "--output-dir", action="store", type="str",
+ default="", help="Put output files in this directory "
+ "instead of overwriting the input files. Requires -n. "
+ "For Python >= 2.7 only.")
+ parser.add_option("-W", "--write-unchanged-files", action="store_true",
+ help="Also write files even if no changes were required"
+ " (useful with --output-dir); implies -w.")
+ parser.add_option("--add-suffix", action="store", type="str", default="",
+ help="Append this string to all output filenames."
+ " Requires -n if non-empty. For Python >= 2.7 only."
+ "ex: --add-suffix='3' will generate .py3 files.")
+
+ # Parse command line arguments
+ flags = {}
+ refactor_stdin = False
+ options, args = parser.parse_args(args)
+
+ if options.write_unchanged_files:
+ flags["write_unchanged_files"] = True
+ if not options.write:
+ warn("--write-unchanged-files/-W implies -w.")
+ options.write = True
+ # If we allowed these, the original files would be renamed to backup names
+ # but not replaced.
+ if options.output_dir and not options.nobackups:
+ parser.error("Can't use --output-dir/-o without -n.")
+ if options.add_suffix and not options.nobackups:
+ parser.error("Can't use --add-suffix without -n.")
+
+ if not options.write and options.no_diffs:
+ warn("not writing files and not printing diffs; that's not very useful")
+ if not options.write and options.nobackups:
+ parser.error("Can't use -n without -w")
+ if "-" in args:
+ refactor_stdin = True
+ if options.write:
+ print("Can't write to stdin.", file=sys.stderr)
+ return 2
+ # Is this ever necessary?
+ if options.print_function:
+ flags["print_function"] = True
+
+ # Set up logging handler
+ level = logging.DEBUG if options.verbose else logging.INFO
+ logging.basicConfig(format='%(name)s: %(message)s', level=level)
+ logger = logging.getLogger('libfuturize.main')
+
+ if options.stage1 or options.stage2:
+ assert options.both_stages is None
+ options.both_stages = False
+ else:
+ options.both_stages = True
+
+ avail_fixes = set()
+
+ if options.stage1 or options.both_stages:
+ avail_fixes.update(lib2to3_fix_names_stage1)
+ avail_fixes.update(libfuturize_fix_names_stage1)
+ if options.stage2 or options.both_stages:
+ avail_fixes.update(lib2to3_fix_names_stage2)
+ avail_fixes.update(libfuturize_fix_names_stage2)
+
+ if options.unicode_literals:
+ avail_fixes.add('libfuturize.fixes.fix_unicode_literals_import')
+
+ if options.version:
+ print(__version__)
+ return 0
+ if options.list_fixes:
+ print("Available transformations for the -f/--fix option:")
+ # for fixname in sorted(refactor.get_all_fix_names(fixer_pkg)):
+ for fixname in sorted(avail_fixes):
+ print(fixname)
+ if not args:
+ return 0
+ if not args:
+ print("At least one file or directory argument required.",
+ file=sys.stderr)
+ print("Use --help to show usage.", file=sys.stderr)
+ return 2
+
+ unwanted_fixes = set(fixer_pkg + ".fix_" + fix for fix in options.nofix)
+
+ extra_fixes = set()
+ if options.all_imports:
+ if options.stage1:
+ prefix = 'libfuturize.fixes.'
+ extra_fixes.add(prefix +
+ 'fix_add__future__imports_except_unicode_literals')
+ else:
+ # In case the user hasn't run stage1 for some reason:
+ prefix = 'libpasteurize.fixes.'
+ extra_fixes.add(prefix + 'fix_add_all__future__imports')
+ extra_fixes.add(prefix + 'fix_add_future_standard_library_import')
+ extra_fixes.add(prefix + 'fix_add_all_future_builtins')
+ explicit = set()
+ if options.fix:
+ all_present = False
+ for fix in options.fix:
+ if fix == 'all':
+ all_present = True
+ else:
+ if ".fix_" in fix:
+ explicit.add(fix)
+ else:
+ # Infer the full module name for the fixer.
+ # First ensure that no names clash (e.g.
+ # lib2to3.fixes.fix_blah and libfuturize.fixes.fix_blah):
+ found = [f for f in avail_fixes
+ if f.endswith('fix_{0}'.format(fix))]
+ if len(found) > 1:
+ print("Ambiguous fixer name. Choose a fully qualified "
+ "module name instead from these:\n" +
+ "\n".join(" " + myf for myf in found),
+ file=sys.stderr)
+ return 2
+ elif len(found) == 0:
+ print("Unknown fixer. Use --list-fixes or -l for a list.",
+ file=sys.stderr)
+ return 2
+ explicit.add(found[0])
+ if len(explicit & unwanted_fixes) > 0:
+ print("Conflicting usage: the following fixers have been "
+ "simultaneously requested and disallowed:\n" +
+ "\n".join(" " + myf for myf in (explicit & unwanted_fixes)),
+ file=sys.stderr)
+ return 2
+ requested = avail_fixes.union(explicit) if all_present else explicit
+ else:
+ requested = avail_fixes.union(explicit)
+ fixer_names = (requested | extra_fixes) - unwanted_fixes
+
+ input_base_dir = os.path.commonprefix(args)
+ if (input_base_dir and not input_base_dir.endswith(os.sep)
+ and not os.path.isdir(input_base_dir)):
+ # One or more similar names were passed, their directory is the base.
+ # os.path.commonprefix() is ignorant of path elements, this corrects
+ # for that weird API.
+ input_base_dir = os.path.dirname(input_base_dir)
+ if options.output_dir:
+ input_base_dir = input_base_dir.rstrip(os.sep)
+ logger.info('Output in %r will mirror the input directory %r layout.',
+ options.output_dir, input_base_dir)
+
+ # Initialize the refactoring tool
+ if future.utils.PY26:
+ extra_kwargs = {}
+ else:
+ extra_kwargs = {
+ 'append_suffix': options.add_suffix,
+ 'output_dir': options.output_dir,
+ 'input_base_dir': input_base_dir,
+ }
+
+ rt = StdoutRefactoringTool(
+ sorted(fixer_names), flags, sorted(explicit),
+ options.nobackups, not options.no_diffs,
+ **extra_kwargs)
+
+ # Refactor all files and directories passed as arguments
+ if not rt.errors:
+ if refactor_stdin:
+ rt.refactor_stdin()
+ else:
+ try:
+ rt.refactor(args, options.write, None,
+ options.processes)
+ except refactor.MultiprocessingUnsupported:
+ assert options.processes > 1
+ print("Sorry, -j isn't " \
+ "supported on this platform.", file=sys.stderr)
+ return 1
+ rt.summarize()
+
+ # Return error status (0 if rt.errors is zero)
+ return int(bool(rt.errors))
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/__init__.py
new file mode 100644
index 0000000..4cb1cbc
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/__init__.py
@@ -0,0 +1 @@
+# empty to make this a package
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/__init__.py
new file mode 100644
index 0000000..c362ada
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/__init__.py
@@ -0,0 +1,55 @@
+import sys
+from lib2to3 import refactor
+
+# The original set of these fixes comes from lib3to2 (https://bitbucket.org/amentajo/lib3to2):
+fix_names = set([
+ 'libpasteurize.fixes.fix_add_all__future__imports', # from __future__ import absolute_import etc. on separate lines
+ 'libpasteurize.fixes.fix_add_future_standard_library_import', # we force adding this import for now, even if it doesn't seem necessary to the fix_future_standard_library fixer, for ease of testing
+ # 'libfuturize.fixes.fix_order___future__imports', # consolidates to a single line to simplify testing -- UNFINISHED
+ 'libpasteurize.fixes.fix_future_builtins', # adds "from future.builtins import *"
+ 'libfuturize.fixes.fix_future_standard_library', # adds "from future import standard_library"
+
+ 'libpasteurize.fixes.fix_annotations',
+ # 'libpasteurize.fixes.fix_bitlength', # ints have this in Py2.7
+ # 'libpasteurize.fixes.fix_bool', # need a decorator or Mixin
+ # 'libpasteurize.fixes.fix_bytes', # leave bytes as bytes
+ # 'libpasteurize.fixes.fix_classdecorator', # available in
+ # Py2.6+
+ # 'libpasteurize.fixes.fix_collections', hmmm ...
+ # 'libpasteurize.fixes.fix_dctsetcomp', # avail in Py27
+ 'libpasteurize.fixes.fix_division', # yes
+ # 'libpasteurize.fixes.fix_except', # avail in Py2.6+
+ # 'libpasteurize.fixes.fix_features', # ?
+ 'libpasteurize.fixes.fix_fullargspec',
+ # 'libpasteurize.fixes.fix_funcattrs',
+ 'libpasteurize.fixes.fix_getcwd',
+ 'libpasteurize.fixes.fix_imports', # adds "from future import standard_library"
+ 'libpasteurize.fixes.fix_imports2',
+ # 'libpasteurize.fixes.fix_input',
+ # 'libpasteurize.fixes.fix_int',
+ # 'libpasteurize.fixes.fix_intern',
+ # 'libpasteurize.fixes.fix_itertools',
+ 'libpasteurize.fixes.fix_kwargs', # yes, we want this
+ # 'libpasteurize.fixes.fix_memoryview',
+ # 'libpasteurize.fixes.fix_metaclass', # write a custom handler for
+ # this
+ # 'libpasteurize.fixes.fix_methodattrs', # __func__ and __self__ seem to be defined on Py2.7 already
+ 'libpasteurize.fixes.fix_newstyle', # yes, we want this: explicit inheritance from object. Without new-style classes in Py2, super() will break etc.
+ # 'libpasteurize.fixes.fix_next', # use a decorator for this
+ # 'libpasteurize.fixes.fix_numliterals', # prob not
+ # 'libpasteurize.fixes.fix_open', # huh?
+ # 'libpasteurize.fixes.fix_print', # no way
+ 'libpasteurize.fixes.fix_printfunction', # adds __future__ import print_function
+ # 'libpasteurize.fixes.fix_raise_', # TODO: get this working!
+
+ # 'libpasteurize.fixes.fix_range', # nope
+ # 'libpasteurize.fixes.fix_reduce',
+ # 'libpasteurize.fixes.fix_setliteral',
+ # 'libpasteurize.fixes.fix_str',
+ # 'libpasteurize.fixes.fix_super', # maybe, if our magic super() isn't robust enough
+ 'libpasteurize.fixes.fix_throw', # yes, if Py3 supports it
+ # 'libpasteurize.fixes.fix_unittest',
+ 'libpasteurize.fixes.fix_unpacking', # yes, this is useful
+ # 'libpasteurize.fixes.fix_with' # way out of date
+ ])
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/feature_base.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/feature_base.py
new file mode 100644
index 0000000..8a26496
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/feature_base.py
@@ -0,0 +1,57 @@
+u"""
+Base classes for features that are backwards-incompatible.
+
+Usage:
+features = Features()
+features.add(Feature("py3k_feature", "power< 'py3k' any* >", "2.7"))
+PATTERN = features.PATTERN
+"""
+
+pattern_unformatted = u"%s=%s" # name=pattern, for dict lookups
+message_unformatted = u"""
+%s is only supported in Python %s and above."""
+
+class Feature(object):
+ u"""
+ A feature has a name, a pattern, and a minimum version of Python 2.x
+ required to use the feature (or 3.x if there is no backwards-compatible
+ version of 2.x)
+ """
+ def __init__(self, name, PATTERN, version):
+ self.name = name
+ self._pattern = PATTERN
+ self.version = version
+
+ def message_text(self):
+ u"""
+ Format the above text with the name and minimum version required.
+ """
+ return message_unformatted % (self.name, self.version)
+
+class Features(set):
+ u"""
+ A set of features that generates a pattern for the features it contains.
+ This set will act like a mapping in that we map names to patterns.
+ """
+ mapping = {}
+
+ def update_mapping(self):
+ u"""
+ Called every time we care about the mapping of names to features.
+ """
+ self.mapping = dict([(f.name, f) for f in iter(self)])
+
+ @property
+ def PATTERN(self):
+ u"""
+ Uses the mapping of names to features to return a PATTERN suitable
+ for using the lib2to3 patcomp.
+ """
+ self.update_mapping()
+ return u" |\n".join([pattern_unformatted % (f.name, f._pattern) for f in iter(self)])
+
+ def __getitem__(self, key):
+ u"""
+ Implement a simple mapping to get patterns from names.
+ """
+ return self.mapping[key]
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_add_all__future__imports.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_add_all__future__imports.py
new file mode 100644
index 0000000..32f89ec
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_add_all__future__imports.py
@@ -0,0 +1,25 @@
+"""
+Fixer for adding:
+
+ from __future__ import absolute_import
+ from __future__ import division
+ from __future__ import print_function
+ from __future__ import unicode_literals
+
+This is done when converting from Py3 to both Py3/Py2.
+"""
+
+from lib2to3 import fixer_base
+from libfuturize.fixer_util import future_import
+
+class FixAddAllFutureImports(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "file_input"
+ run_order = 1
+
+ def transform(self, node, results):
+ future_import(u"unicode_literals", node)
+ future_import(u"print_function", node)
+ future_import(u"division", node)
+ future_import(u"absolute_import", node)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_add_all_future_builtins.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_add_all_future_builtins.py
new file mode 100644
index 0000000..97204b5
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_add_all_future_builtins.py
@@ -0,0 +1,38 @@
+"""
+For the ``future`` package.
+
+Adds this import line::
+
+ from builtins import (ascii, bytes, chr, dict, filter, hex, input,
+ int, list, map, next, object, oct, open, pow,
+ range, round, str, super, zip)
+
+to a module, irrespective of whether each definition is used.
+
+Adds these imports after any other imports (in an initial block of them).
+"""
+
+from __future__ import unicode_literals
+
+from lib2to3 import fixer_base
+
+from libfuturize.fixer_util import touch_import_top
+
+
+class FixAddAllFutureBuiltins(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "file_input"
+ run_order = 1
+
+ def transform(self, node, results):
+ # import_str = """(ascii, bytes, chr, dict, filter, hex, input,
+ # int, list, map, next, object, oct, open, pow,
+ # range, round, str, super, zip)"""
+ touch_import_top(u'builtins', '*', node)
+
+ # builtins = """ascii bytes chr dict filter hex input
+ # int list map next object oct open pow
+ # range round str super zip"""
+ # for builtin in sorted(builtins.split(), reverse=True):
+ # touch_import_top(u'builtins', builtin, node)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_add_future_standard_library_import.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_add_future_standard_library_import.py
new file mode 100644
index 0000000..0778406
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_add_future_standard_library_import.py
@@ -0,0 +1,23 @@
+"""
+For the ``future`` package.
+
+Adds this import line:
+
+ from future import standard_library
+
+after any __future__ imports but before any other imports. Doesn't actually
+change the imports to Py3 style.
+"""
+
+from lib2to3 import fixer_base
+from libfuturize.fixer_util import touch_import_top
+
+class FixAddFutureStandardLibraryImport(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "file_input"
+ run_order = 8
+
+ def transform(self, node, results):
+ # TODO: add a blank line between any __future__ imports and this?
+ touch_import_top(u'future', u'standard_library', node)
+ # TODO: also add standard_library.install_hooks()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_annotations.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_annotations.py
new file mode 100644
index 0000000..1926288
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_annotations.py
@@ -0,0 +1,48 @@
+u"""
+Fixer to remove function annotations
+"""
+
+from lib2to3 import fixer_base
+from lib2to3.pgen2 import token
+from lib2to3.fixer_util import syms
+
+warning_text = u"Removing function annotations completely."
+
+def param_without_annotations(node):
+ return node.children[0]
+
+class FixAnnotations(fixer_base.BaseFix):
+
+ warned = False
+
+ def warn_once(self, node, reason):
+ if not self.warned:
+ self.warned = True
+ self.warning(node, reason=reason)
+
+ PATTERN = u"""
+ funcdef< 'def' any parameters< '(' [params=any] ')' > ['->' ret=any] ':' any* >
+ """
+
+ def transform(self, node, results):
+ u"""
+ This just strips annotations from the funcdef completely.
+ """
+ params = results.get(u"params")
+ ret = results.get(u"ret")
+ if ret is not None:
+ assert ret.prev_sibling.type == token.RARROW, u"Invalid return annotation"
+ self.warn_once(node, reason=warning_text)
+ ret.prev_sibling.remove()
+ ret.remove()
+ if params is None: return
+ if params.type == syms.typedargslist:
+ # more than one param in a typedargslist
+ for param in params.children:
+ if param.type == syms.tname:
+ self.warn_once(node, reason=warning_text)
+ param.replace(param_without_annotations(param))
+ elif params.type == syms.tname:
+ # one param
+ self.warn_once(node, reason=warning_text)
+ params.replace(param_without_annotations(params))
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_division.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_division.py
new file mode 100644
index 0000000..6a04871
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_division.py
@@ -0,0 +1,28 @@
+u"""
+Fixer for division: from __future__ import division if needed
+"""
+
+from lib2to3 import fixer_base
+from libfuturize.fixer_util import token, future_import
+
+def match_division(node):
+ u"""
+ __future__.division redefines the meaning of a single slash for division,
+ so we match that and only that.
+ """
+ slash = token.SLASH
+ return node.type == slash and not node.next_sibling.type == slash and \
+ not node.prev_sibling.type == slash
+
+class FixDivision(fixer_base.BaseFix):
+ run_order = 4 # this seems to be ignored?
+
+ def match(self, node):
+ u"""
+ Since the tree needs to be fixed once and only once if and only if it
+ matches, then we can start discarding matches after we make the first.
+ """
+ return match_division(node)
+
+ def transform(self, node, results):
+ future_import(u"division", node)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_features.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_features.py
new file mode 100644
index 0000000..7e5f545
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_features.py
@@ -0,0 +1,86 @@
+u"""
+Warn about features that are not present in Python 2.5, giving a message that
+points to the earliest version of Python 2.x (or 3.x, if none) that supports it
+"""
+
+from .feature_base import Feature, Features
+from lib2to3 import fixer_base
+
+FEATURES = [
+ #(FeatureName,
+ # FeaturePattern,
+ # FeatureMinVersion,
+ #),
+ (u"memoryview",
+ u"power < 'memoryview' trailer < '(' any* ')' > any* >",
+ u"2.7",
+ ),
+ (u"numbers",
+ u"""import_from< 'from' 'numbers' 'import' any* > |
+ import_name< 'import' ('numbers' dotted_as_names< any* 'numbers' any* >) >""",
+ u"2.6",
+ ),
+ (u"abc",
+ u"""import_name< 'import' ('abc' dotted_as_names< any* 'abc' any* >) > |
+ import_from< 'from' 'abc' 'import' any* >""",
+ u"2.6",
+ ),
+ (u"io",
+ u"""import_name< 'import' ('io' dotted_as_names< any* 'io' any* >) > |
+ import_from< 'from' 'io' 'import' any* >""",
+ u"2.6",
+ ),
+ (u"bin",
+ u"power< 'bin' trailer< '(' any* ')' > any* >",
+ u"2.6",
+ ),
+ (u"formatting",
+ u"power< any trailer< '.' 'format' > trailer< '(' any* ')' > >",
+ u"2.6",
+ ),
+ (u"nonlocal",
+ u"global_stmt< 'nonlocal' any* >",
+ u"3.0",
+ ),
+ (u"with_traceback",
+ u"trailer< '.' 'with_traceback' >",
+ u"3.0",
+ ),
+]
+
+class FixFeatures(fixer_base.BaseFix):
+
+ run_order = 9 # Wait until all other fixers have run to check for these
+
+ # To avoid spamming, we only want to warn for each feature once.
+ features_warned = set()
+
+ # Build features from the list above
+ features = Features([Feature(name, pattern, version) for \
+ name, pattern, version in FEATURES])
+
+ PATTERN = features.PATTERN
+
+ def match(self, node):
+ to_ret = super(FixFeatures, self).match(node)
+ # We want the mapping only to tell us the node's specific information.
+ try:
+ del to_ret[u'node']
+ except Exception:
+ # We want it to delete the 'node' from the results
+ # if it's there, so we don't care if it fails for normal reasons.
+ pass
+ return to_ret
+
+ def transform(self, node, results):
+ for feature_name in results:
+ if feature_name in self.features_warned:
+ continue
+ else:
+ curr_feature = self.features[feature_name]
+ if curr_feature.version >= u"3":
+ fail = self.cannot_convert
+ else:
+ fail = self.warning
+ fail(node, reason=curr_feature.message_text())
+ self.features_warned.add(feature_name)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_fullargspec.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_fullargspec.py
new file mode 100644
index 0000000..489295f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_fullargspec.py
@@ -0,0 +1,16 @@
+u"""
+Fixer for getfullargspec -> getargspec
+"""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Name
+
+warn_msg = u"some of the values returned by getfullargspec are not valid in Python 2 and have no equivalent."
+
+class FixFullargspec(fixer_base.BaseFix):
+
+ PATTERN = u"'getfullargspec'"
+
+ def transform(self, node, results):
+ self.warning(node, warn_msg)
+ return Name(u"getargspec", prefix=node.prefix)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_future_builtins.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_future_builtins.py
new file mode 100644
index 0000000..27339ab
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_future_builtins.py
@@ -0,0 +1,47 @@
+"""
+Adds this import line:
+
+ from builtins import XYZ
+
+for each of the functions XYZ that is used in the module.
+"""
+
+from __future__ import unicode_literals
+
+from lib2to3 import fixer_base
+from lib2to3.pygram import python_symbols as syms
+from lib2to3.fixer_util import Name, Call, in_special_context
+
+from libfuturize.fixer_util import touch_import_top
+
+# All builtins are:
+# from future.builtins.iterators import (filter, map, zip)
+# from future.builtins.misc import (ascii, chr, hex, input, isinstance, oct, open, round, super)
+# from future.types import (bytes, dict, int, range, str)
+# We don't need isinstance any more.
+
+replaced_builtins = '''filter map zip
+ ascii chr hex input next oct open round super
+ bytes dict int range str'''.split()
+
+expression = '|'.join(["name='{0}'".format(name) for name in replaced_builtins])
+
+
+class FixFutureBuiltins(fixer_base.BaseFix):
+ BM_compatible = True
+ run_order = 9
+
+ # Currently we only match uses as a function. This doesn't match e.g.:
+ # if isinstance(s, str):
+ # ...
+ PATTERN = """
+ power<
+ ({0}) trailer< '(' args=[any] ')' >
+ rest=any* >
+ """.format(expression)
+
+ def transform(self, node, results):
+ name = results["name"]
+ touch_import_top(u'builtins', name.value, node)
+ # name.replace(Name(u"input", prefix=name.prefix))
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_getcwd.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_getcwd.py
new file mode 100644
index 0000000..9b7f002
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_getcwd.py
@@ -0,0 +1,26 @@
+u"""
+Fixer for os.getcwd() -> os.getcwdu().
+Also warns about "from os import getcwd", suggesting the above form.
+"""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Name
+
+class FixGetcwd(fixer_base.BaseFix):
+
+ PATTERN = u"""
+ power< 'os' trailer< dot='.' name='getcwd' > any* >
+ |
+ import_from< 'from' 'os' 'import' bad='getcwd' >
+ """
+
+ def transform(self, node, results):
+ if u"name" in results:
+ name = results[u"name"]
+ name.replace(Name(u"getcwdu", prefix=name.prefix))
+ elif u"bad" in results:
+ # Can't convert to getcwdu and then expect to catch every use.
+ self.cannot_convert(node, u"import os, use os.getcwd() instead.")
+ return
+ else:
+ raise ValueError(u"For some reason, the pattern matcher failed.")
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_imports.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_imports.py
new file mode 100644
index 0000000..d79558c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_imports.py
@@ -0,0 +1,112 @@
+u"""
+Fixer for standard library imports renamed in Python 3
+"""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Name, is_probably_builtin, Newline, does_tree_import
+from lib2to3.pygram import python_symbols as syms
+from lib2to3.pgen2 import token
+from lib2to3.pytree import Node, Leaf
+
+from libfuturize.fixer_util import touch_import_top
+# from ..fixer_util import NameImport
+
+# used in simple_mapping_to_pattern()
+MAPPING = {u"reprlib": u"repr",
+ u"winreg": u"_winreg",
+ u"configparser": u"ConfigParser",
+ u"copyreg": u"copy_reg",
+ u"queue": u"Queue",
+ u"socketserver": u"SocketServer",
+ u"_markupbase": u"markupbase",
+ u"test.support": u"test.test_support",
+ u"dbm.bsd": u"dbhash",
+ u"dbm.ndbm": u"dbm",
+ u"dbm.dumb": u"dumbdbm",
+ u"dbm.gnu": u"gdbm",
+ u"html.parser": u"HTMLParser",
+ u"html.entities": u"htmlentitydefs",
+ u"http.client": u"httplib",
+ u"http.cookies": u"Cookie",
+ u"http.cookiejar": u"cookielib",
+# "tkinter": "Tkinter",
+ u"tkinter.dialog": u"Dialog",
+ u"tkinter._fix": u"FixTk",
+ u"tkinter.scrolledtext": u"ScrolledText",
+ u"tkinter.tix": u"Tix",
+ u"tkinter.constants": u"Tkconstants",
+ u"tkinter.dnd": u"Tkdnd",
+ u"tkinter.__init__": u"Tkinter",
+ u"tkinter.colorchooser": u"tkColorChooser",
+ u"tkinter.commondialog": u"tkCommonDialog",
+ u"tkinter.font": u"tkFont",
+ u"tkinter.messagebox": u"tkMessageBox",
+ u"tkinter.turtle": u"turtle",
+ u"urllib.robotparser": u"robotparser",
+ u"xmlrpc.client": u"xmlrpclib",
+ u"builtins": u"__builtin__",
+}
+
+# generic strings to help build patterns
+# these variables mean (with http.client.HTTPConnection as an example):
+# name = http
+# attr = client
+# used = HTTPConnection
+# fmt_name is a formatted subpattern (simple_name_match or dotted_name_match)
+
+# helps match 'queue', as in 'from queue import ...'
+simple_name_match = u"name='%s'"
+# helps match 'client', to be used if client has been imported from http
+subname_match = u"attr='%s'"
+# helps match 'http.client', as in 'import urllib.request'
+dotted_name_match = u"dotted_name=dotted_name< %s '.' %s >"
+# helps match 'queue', as in 'queue.Queue(...)'
+power_onename_match = u"%s"
+# helps match 'http.client', as in 'http.client.HTTPConnection(...)'
+power_twoname_match = u"power< %s trailer< '.' %s > any* >"
+# helps match 'client.HTTPConnection', if 'client' has been imported from http
+power_subname_match = u"power< %s any* >"
+# helps match 'from http.client import HTTPConnection'
+from_import_match = u"from_import=import_from< 'from' %s 'import' imported=any >"
+# helps match 'from http import client'
+from_import_submod_match = u"from_import_submod=import_from< 'from' %s 'import' (%s | import_as_name< %s 'as' renamed=any > | import_as_names< any* (%s | import_as_name< %s 'as' renamed=any >) any* > ) >"
+# helps match 'import urllib.request'
+name_import_match = u"name_import=import_name< 'import' %s > | name_import=import_name< 'import' dotted_as_name< %s 'as' renamed=any > >"
+# helps match 'import http.client, winreg'
+multiple_name_import_match = u"name_import=import_name< 'import' dotted_as_names< names=any* > >"
+
+def all_patterns(name):
+ u"""
+ Accepts a string and returns a pattern of possible patterns involving that name
+ Called by simple_mapping_to_pattern for each name in the mapping it receives.
+ """
+
+ # i_ denotes an import-like node
+ # u_ denotes a node that appears to be a usage of the name
+ if u'.' in name:
+ name, attr = name.split(u'.', 1)
+ simple_name = simple_name_match % (name)
+ simple_attr = subname_match % (attr)
+ dotted_name = dotted_name_match % (simple_name, simple_attr)
+ i_from = from_import_match % (dotted_name)
+ i_from_submod = from_import_submod_match % (simple_name, simple_attr, simple_attr, simple_attr, simple_attr)
+ i_name = name_import_match % (dotted_name, dotted_name)
+ u_name = power_twoname_match % (simple_name, simple_attr)
+ u_subname = power_subname_match % (simple_attr)
+ return u' | \n'.join((i_name, i_from, i_from_submod, u_name, u_subname))
+ else:
+ simple_name = simple_name_match % (name)
+ i_name = name_import_match % (simple_name, simple_name)
+ i_from = from_import_match % (simple_name)
+ u_name = power_onename_match % (simple_name)
+ return u' | \n'.join((i_name, i_from, u_name))
+
+
+class FixImports(fixer_base.BaseFix):
+
+ PATTERN = u' | \n'.join([all_patterns(name) for name in MAPPING])
+ PATTERN = u' | \n'.join((PATTERN, multiple_name_import_match))
+
+ def transform(self, node, results):
+ touch_import_top(u'future', u'standard_library', node)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_imports2.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_imports2.py
new file mode 100644
index 0000000..5b30b5f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_imports2.py
@@ -0,0 +1,175 @@
+u"""
+Fixer for complicated imports
+"""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Name, String, FromImport, Newline, Comma
+from libfuturize.fixer_util import touch_import_top
+
+
+TK_BASE_NAMES = (u'ACTIVE', u'ALL', u'ANCHOR', u'ARC',u'BASELINE', u'BEVEL', u'BOTH',
+ u'BOTTOM', u'BROWSE', u'BUTT', u'CASCADE', u'CENTER', u'CHAR',
+ u'CHECKBUTTON', u'CHORD', u'COMMAND', u'CURRENT', u'DISABLED',
+ u'DOTBOX', u'E', u'END', u'EW', u'EXCEPTION', u'EXTENDED', u'FALSE',
+ u'FIRST', u'FLAT', u'GROOVE', u'HIDDEN', u'HORIZONTAL', u'INSERT',
+ u'INSIDE', u'LAST', u'LEFT', u'MITER', u'MOVETO', u'MULTIPLE', u'N',
+ u'NE', u'NO', u'NONE', u'NORMAL', u'NS', u'NSEW', u'NUMERIC', u'NW',
+ u'OFF', u'ON', u'OUTSIDE', u'PAGES', u'PIESLICE', u'PROJECTING',
+ u'RADIOBUTTON', u'RAISED', u'READABLE', u'RIDGE', u'RIGHT',
+ u'ROUND', u'S', u'SCROLL', u'SE', u'SEL', u'SEL_FIRST', u'SEL_LAST',
+ u'SEPARATOR', u'SINGLE', u'SOLID', u'SUNKEN', u'SW', u'StringTypes',
+ u'TOP', u'TRUE', u'TclVersion', u'TkVersion', u'UNDERLINE',
+ u'UNITS', u'VERTICAL', u'W', u'WORD', u'WRITABLE', u'X', u'Y', u'YES',
+ u'wantobjects')
+
+PY2MODULES = {
+ u'urllib2' : (
+ u'AbstractBasicAuthHandler', u'AbstractDigestAuthHandler',
+ u'AbstractHTTPHandler', u'BaseHandler', u'CacheFTPHandler',
+ u'FTPHandler', u'FileHandler', u'HTTPBasicAuthHandler',
+ u'HTTPCookieProcessor', u'HTTPDefaultErrorHandler',
+ u'HTTPDigestAuthHandler', u'HTTPError', u'HTTPErrorProcessor',
+ u'HTTPHandler', u'HTTPPasswordMgr',
+ u'HTTPPasswordMgrWithDefaultRealm', u'HTTPRedirectHandler',
+ u'HTTPSHandler', u'OpenerDirector', u'ProxyBasicAuthHandler',
+ u'ProxyDigestAuthHandler', u'ProxyHandler', u'Request',
+ u'StringIO', u'URLError', u'UnknownHandler', u'addinfourl',
+ u'build_opener', u'install_opener', u'parse_http_list',
+ u'parse_keqv_list', u'randombytes', u'request_host', u'urlopen'),
+ u'urllib' : (
+ u'ContentTooShortError', u'FancyURLopener',u'URLopener',
+ u'basejoin', u'ftperrors', u'getproxies',
+ u'getproxies_environment', u'localhost', u'pathname2url',
+ u'quote', u'quote_plus', u'splitattr', u'splithost',
+ u'splitnport', u'splitpasswd', u'splitport', u'splitquery',
+ u'splittag', u'splittype', u'splituser', u'splitvalue',
+ u'thishost', u'unquote', u'unquote_plus', u'unwrap',
+ u'url2pathname', u'urlcleanup', u'urlencode', u'urlopen',
+ u'urlretrieve',),
+ u'urlparse' : (
+ u'parse_qs', u'parse_qsl', u'urldefrag', u'urljoin',
+ u'urlparse', u'urlsplit', u'urlunparse', u'urlunsplit'),
+ u'dbm' : (
+ u'ndbm', u'gnu', u'dumb'),
+ u'anydbm' : (
+ u'error', u'open'),
+ u'whichdb' : (
+ u'whichdb',),
+ u'BaseHTTPServer' : (
+ u'BaseHTTPRequestHandler', u'HTTPServer'),
+ u'CGIHTTPServer' : (
+ u'CGIHTTPRequestHandler',),
+ u'SimpleHTTPServer' : (
+ u'SimpleHTTPRequestHandler',),
+ u'FileDialog' : TK_BASE_NAMES + (
+ u'FileDialog', u'LoadFileDialog', u'SaveFileDialog',
+ u'dialogstates', u'test'),
+ u'tkFileDialog' : (
+ u'Directory', u'Open', u'SaveAs', u'_Dialog', u'askdirectory',
+ u'askopenfile', u'askopenfilename', u'askopenfilenames',
+ u'askopenfiles', u'asksaveasfile', u'asksaveasfilename'),
+ u'SimpleDialog' : TK_BASE_NAMES + (
+ u'SimpleDialog',),
+ u'tkSimpleDialog' : TK_BASE_NAMES + (
+ u'askfloat', u'askinteger', u'askstring', u'Dialog'),
+ u'SimpleXMLRPCServer' : (
+ u'CGIXMLRPCRequestHandler', u'SimpleXMLRPCDispatcher',
+ u'SimpleXMLRPCRequestHandler', u'SimpleXMLRPCServer',
+ u'list_public_methods', u'remove_duplicates',
+ u'resolve_dotted_attribute'),
+ u'DocXMLRPCServer' : (
+ u'DocCGIXMLRPCRequestHandler', u'DocXMLRPCRequestHandler',
+ u'DocXMLRPCServer', u'ServerHTMLDoc',u'XMLRPCDocGenerator'),
+ }
+
+MAPPING = { u'urllib.request' :
+ (u'urllib2', u'urllib'),
+ u'urllib.error' :
+ (u'urllib2', u'urllib'),
+ u'urllib.parse' :
+ (u'urllib2', u'urllib', u'urlparse'),
+ u'dbm.__init__' :
+ (u'anydbm', u'whichdb'),
+ u'http.server' :
+ (u'CGIHTTPServer', u'SimpleHTTPServer', u'BaseHTTPServer'),
+ u'tkinter.filedialog' :
+ (u'tkFileDialog', u'FileDialog'),
+ u'tkinter.simpledialog' :
+ (u'tkSimpleDialog', u'SimpleDialog'),
+ u'xmlrpc.server' :
+ (u'DocXMLRPCServer', u'SimpleXMLRPCServer'),
+ }
+
+# helps match 'http', as in 'from http.server import ...'
+simple_name = u"name='%s'"
+# helps match 'server', as in 'from http.server import ...'
+simple_attr = u"attr='%s'"
+# helps match 'HTTPServer', as in 'from http.server import HTTPServer'
+simple_using = u"using='%s'"
+# helps match 'urllib.request', as in 'import urllib.request'
+dotted_name = u"dotted_name=dotted_name< %s '.' %s >"
+# helps match 'http.server', as in 'http.server.HTTPServer(...)'
+power_twoname = u"pow=power< %s trailer< '.' %s > trailer< '.' using=any > any* >"
+# helps match 'dbm.whichdb', as in 'dbm.whichdb(...)'
+power_onename = u"pow=power< %s trailer< '.' using=any > any* >"
+# helps match 'from http.server import HTTPServer'
+# also helps match 'from http.server import HTTPServer, SimpleHTTPRequestHandler'
+# also helps match 'from http.server import *'
+from_import = u"from_import=import_from< 'from' %s 'import' (import_as_name< using=any 'as' renamed=any> | in_list=import_as_names< using=any* > | using='*' | using=NAME) >"
+# helps match 'import urllib.request'
+name_import = u"name_import=import_name< 'import' (%s | in_list=dotted_as_names< imp_list=any* >) >"
+
+#############
+# WON'T FIX #
+#############
+
+# helps match 'import urllib.request as name'
+name_import_rename = u"name_import_rename=dotted_as_name< %s 'as' renamed=any >"
+# helps match 'from http import server'
+from_import_rename = u"from_import_rename=import_from< 'from' %s 'import' (%s | import_as_name< %s 'as' renamed=any > | in_list=import_as_names< any* (%s | import_as_name< %s 'as' renamed=any >) any* >) >"
+
+
+def all_modules_subpattern():
+ u"""
+ Builds a pattern for all toplevel names
+ (urllib, http, etc)
+ """
+ names_dot_attrs = [mod.split(u".") for mod in MAPPING]
+ ret = u"( " + u" | ".join([dotted_name % (simple_name % (mod[0]),
+ simple_attr % (mod[1])) for mod in names_dot_attrs])
+ ret += u" | "
+ ret += u" | ".join([simple_name % (mod[0]) for mod in names_dot_attrs if mod[1] == u"__init__"]) + u" )"
+ return ret
+
+
+def build_import_pattern(mapping1, mapping2):
+ u"""
+ mapping1: A dict mapping py3k modules to all possible py2k replacements
+ mapping2: A dict mapping py2k modules to the things they do
+ This builds a HUGE pattern to match all ways that things can be imported
+ """
+ # py3k: urllib.request, py2k: ('urllib2', 'urllib')
+ yield from_import % (all_modules_subpattern())
+ for py3k, py2k in mapping1.items():
+ name, attr = py3k.split(u'.')
+ s_name = simple_name % (name)
+ s_attr = simple_attr % (attr)
+ d_name = dotted_name % (s_name, s_attr)
+ yield name_import % (d_name)
+ yield power_twoname % (s_name, s_attr)
+ if attr == u'__init__':
+ yield name_import % (s_name)
+ yield power_onename % (s_name)
+ yield name_import_rename % (d_name)
+ yield from_import_rename % (s_name, s_attr, s_attr, s_attr, s_attr)
+
+
+class FixImports2(fixer_base.BaseFix):
+
+ run_order = 4
+
+ PATTERN = u" | \n".join(build_import_pattern(MAPPING, PY2MODULES))
+
+ def transform(self, node, results):
+ touch_import_top(u'future', u'standard_library', node)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_kwargs.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_kwargs.py
new file mode 100644
index 0000000..59a3043
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_kwargs.py
@@ -0,0 +1,148 @@
+u"""
+Fixer for Python 3 function parameter syntax
+This fixer is rather sensitive to incorrect py3k syntax.
+"""
+
+# Note: "relevant" parameters are parameters following the first STAR in the list.
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import token, String, Newline, Comma, Name
+from libfuturize.fixer_util import indentation, suitify, DoubleStar
+
+_assign_template = u"%(name)s = %(kwargs)s['%(name)s']; del %(kwargs)s['%(name)s']"
+_if_template = u"if '%(name)s' in %(kwargs)s: %(assign)s"
+_else_template = u"else: %(name)s = %(default)s"
+_kwargs_default_name = u"_3to2kwargs"
+
+def gen_params(raw_params):
+ u"""
+ Generator that yields tuples of (name, default_value) for each parameter in the list
+ If no default is given, then it is default_value is None (not Leaf(token.NAME, 'None'))
+ """
+ assert raw_params[0].type == token.STAR and len(raw_params) > 2
+ curr_idx = 2 # the first place a keyword-only parameter name can be is index 2
+ max_idx = len(raw_params)
+ while curr_idx < max_idx:
+ curr_item = raw_params[curr_idx]
+ prev_item = curr_item.prev_sibling
+ if curr_item.type != token.NAME:
+ curr_idx += 1
+ continue
+ if prev_item is not None and prev_item.type == token.DOUBLESTAR:
+ break
+ name = curr_item.value
+ nxt = curr_item.next_sibling
+ if nxt is not None and nxt.type == token.EQUAL:
+ default_value = nxt.next_sibling
+ curr_idx += 2
+ else:
+ default_value = None
+ yield (name, default_value)
+ curr_idx += 1
+
+def remove_params(raw_params, kwargs_default=_kwargs_default_name):
+ u"""
+ Removes all keyword-only args from the params list and a bare star, if any.
+ Does not add the kwargs dict if needed.
+ Returns True if more action is needed, False if not
+ (more action is needed if no kwargs dict exists)
+ """
+ assert raw_params[0].type == token.STAR
+ if raw_params[1].type == token.COMMA:
+ raw_params[0].remove()
+ raw_params[1].remove()
+ kw_params = raw_params[2:]
+ else:
+ kw_params = raw_params[3:]
+ for param in kw_params:
+ if param.type != token.DOUBLESTAR:
+ param.remove()
+ else:
+ return False
+ else:
+ return True
+
+def needs_fixing(raw_params, kwargs_default=_kwargs_default_name):
+ u"""
+ Returns string with the name of the kwargs dict if the params after the first star need fixing
+ Otherwise returns empty string
+ """
+ found_kwargs = False
+ needs_fix = False
+
+ for t in raw_params[2:]:
+ if t.type == token.COMMA:
+ # Commas are irrelevant at this stage.
+ continue
+ elif t.type == token.NAME and not found_kwargs:
+ # Keyword-only argument: definitely need to fix.
+ needs_fix = True
+ elif t.type == token.NAME and found_kwargs:
+ # Return 'foobar' of **foobar, if needed.
+ return t.value if needs_fix else u''
+ elif t.type == token.DOUBLESTAR:
+ # Found either '*' from **foobar.
+ found_kwargs = True
+ else:
+ # Never found **foobar. Return a synthetic name, if needed.
+ return kwargs_default if needs_fix else u''
+
+class FixKwargs(fixer_base.BaseFix):
+
+ run_order = 7 # Run after function annotations are removed
+
+ PATTERN = u"funcdef< 'def' NAME parameters< '(' arglist=typedargslist< params=any* > ')' > ':' suite=any >"
+
+ def transform(self, node, results):
+ params_rawlist = results[u"params"]
+ for i, item in enumerate(params_rawlist):
+ if item.type == token.STAR:
+ params_rawlist = params_rawlist[i:]
+ break
+ else:
+ return
+ # params is guaranteed to be a list starting with *.
+ # if fixing is needed, there will be at least 3 items in this list:
+ # [STAR, COMMA, NAME] is the minimum that we need to worry about.
+ new_kwargs = needs_fixing(params_rawlist)
+ # new_kwargs is the name of the kwargs dictionary.
+ if not new_kwargs:
+ return
+ suitify(node)
+
+ # At this point, params_rawlist is guaranteed to be a list
+ # beginning with a star that includes at least one keyword-only param
+ # e.g., [STAR, NAME, COMMA, NAME, COMMA, DOUBLESTAR, NAME] or
+ # [STAR, COMMA, NAME], or [STAR, COMMA, NAME, COMMA, DOUBLESTAR, NAME]
+
+ # Anatomy of a funcdef: ['def', 'name', parameters, ':', suite]
+ # Anatomy of that suite: [NEWLINE, INDENT, first_stmt, all_other_stmts]
+ # We need to insert our new stuff before the first_stmt and change the
+ # first_stmt's prefix.
+
+ suite = node.children[4]
+ first_stmt = suite.children[2]
+ ident = indentation(first_stmt)
+
+ for name, default_value in gen_params(params_rawlist):
+ if default_value is None:
+ suite.insert_child(2, Newline())
+ suite.insert_child(2, String(_assign_template %{u'name':name, u'kwargs':new_kwargs}, prefix=ident))
+ else:
+ suite.insert_child(2, Newline())
+ suite.insert_child(2, String(_else_template %{u'name':name, u'default':default_value}, prefix=ident))
+ suite.insert_child(2, Newline())
+ suite.insert_child(2, String(_if_template %{u'assign':_assign_template %{u'name':name, u'kwargs':new_kwargs}, u'name':name, u'kwargs':new_kwargs}, prefix=ident))
+ first_stmt.prefix = ident
+ suite.children[2].prefix = u""
+
+ # Now, we need to fix up the list of params.
+
+ must_add_kwargs = remove_params(params_rawlist)
+ if must_add_kwargs:
+ arglist = results[u'arglist']
+ if len(arglist.children) > 0 and arglist.children[-1].type != token.COMMA:
+ arglist.append_child(Comma())
+ arglist.append_child(DoubleStar(prefix=u" "))
+ arglist.append_child(Name(new_kwargs))
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_memoryview.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_memoryview.py
new file mode 100644
index 0000000..a20f6f3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_memoryview.py
@@ -0,0 +1,21 @@
+u"""
+Fixer for memoryview(s) -> buffer(s).
+Explicit because some memoryview methods are invalid on buffer objects.
+"""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Name
+
+
+class FixMemoryview(fixer_base.BaseFix):
+
+ explicit = True # User must specify that they want this.
+
+ PATTERN = u"""
+ power< name='memoryview' trailer< '(' [any] ')' >
+ rest=any* >
+ """
+
+ def transform(self, node, results):
+ name = results[u"name"]
+ name.replace(Name(u"buffer", prefix=name.prefix))
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_metaclass.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_metaclass.py
new file mode 100644
index 0000000..5e6e64d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_metaclass.py
@@ -0,0 +1,78 @@
+u"""
+Fixer for (metaclass=X) -> __metaclass__ = X
+Some semantics (see PEP 3115) may be altered in the translation."""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Name, syms, Node, Leaf, Newline, find_root
+from lib2to3.pygram import token
+from libfuturize.fixer_util import indentation, suitify
+# from ..fixer_util import Name, syms, Node, Leaf, Newline, find_root, indentation, suitify
+
+def has_metaclass(parent):
+ results = None
+ for node in parent.children:
+ kids = node.children
+ if node.type == syms.argument:
+ if kids[0] == Leaf(token.NAME, u"metaclass") and \
+ kids[1] == Leaf(token.EQUAL, u"=") and \
+ kids[2]:
+ #Hack to avoid "class X(=):" with this case.
+ results = [node] + kids
+ break
+ elif node.type == syms.arglist:
+ # Argument list... loop through it looking for:
+ # Node(*, [*, Leaf(token.NAME, u"metaclass"), Leaf(token.EQUAL, u"="), Leaf(*, *)]
+ for child in node.children:
+ if results: break
+ if child.type == token.COMMA:
+ #Store the last comma, which precedes the metaclass
+ comma = child
+ elif type(child) == Node:
+ meta = equal = name = None
+ for arg in child.children:
+ if arg == Leaf(token.NAME, u"metaclass"):
+ #We have the (metaclass) part
+ meta = arg
+ elif meta and arg == Leaf(token.EQUAL, u"="):
+ #We have the (metaclass=) part
+ equal = arg
+ elif meta and equal:
+ #Here we go, we have (metaclass=X)
+ name = arg
+ results = (comma, meta, equal, name)
+ break
+ return results
+
+
+class FixMetaclass(fixer_base.BaseFix):
+
+ PATTERN = u"""
+ classdef
+ """
+
+ def transform(self, node, results):
+ meta_results = has_metaclass(node)
+ if not meta_results: return
+ for meta in meta_results:
+ meta.remove()
+ target = Leaf(token.NAME, u"__metaclass__")
+ equal = Leaf(token.EQUAL, u"=", prefix=u" ")
+ # meta is the last item in what was returned by has_metaclass(): name
+ name = meta
+ name.prefix = u" "
+ stmt_node = Node(syms.atom, [target, equal, name])
+
+ suitify(node)
+ for item in node.children:
+ if item.type == syms.suite:
+ for stmt in item.children:
+ if stmt.type == token.INDENT:
+ # Insert, in reverse order, the statement, a newline,
+ # and an indent right after the first indented line
+ loc = item.children.index(stmt) + 1
+ # Keep consistent indentation form
+ ident = Leaf(token.INDENT, stmt.value)
+ item.insert_child(loc, ident)
+ item.insert_child(loc, Newline())
+ item.insert_child(loc, stmt_node)
+ break
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_newstyle.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_newstyle.py
new file mode 100644
index 0000000..cc6b3ad
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_newstyle.py
@@ -0,0 +1,33 @@
+u"""
+Fixer for "class Foo: ..." -> "class Foo(object): ..."
+"""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import LParen, RParen, Name
+
+from libfuturize.fixer_util import touch_import_top
+
+
+def insert_object(node, idx):
+ node.insert_child(idx, RParen())
+ node.insert_child(idx, Name(u"object"))
+ node.insert_child(idx, LParen())
+
+class FixNewstyle(fixer_base.BaseFix):
+
+ # Match:
+ # class Blah:
+ # and:
+ # class Blah():
+
+ PATTERN = u"classdef< 'class' NAME ['(' ')'] colon=':' any >"
+
+ def transform(self, node, results):
+ colon = results[u"colon"]
+ idx = node.children.index(colon)
+ if (node.children[idx-2].value == '(' and
+ node.children[idx-1].value == ')'):
+ del node.children[idx-2:idx]
+ idx -= 2
+ insert_object(node, idx)
+ touch_import_top(u'builtins', 'object', node)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_next.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_next.py
new file mode 100644
index 0000000..9ecb6c0
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_next.py
@@ -0,0 +1,43 @@
+u"""
+Fixer for:
+it.__next__() -> it.next().
+next(it) -> it.next().
+"""
+
+from lib2to3.pgen2 import token
+from lib2to3.pygram import python_symbols as syms
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Name, Call, find_binding, Attr
+
+bind_warning = u"Calls to builtin next() possibly shadowed by global binding"
+
+
+class FixNext(fixer_base.BaseFix):
+
+ PATTERN = u"""
+ power< base=any+ trailer< '.' attr='__next__' > any* >
+ |
+ power< head='next' trailer< '(' arg=any ')' > any* >
+ |
+ classdef< 'class' base=any+ ':'
+ suite< any*
+ funcdef< 'def'
+ attr='__next__'
+ parameters< '(' NAME ')' > any+ >
+ any* > >
+ """
+
+ def transform(self, node, results):
+ assert results
+
+ base = results.get(u"base")
+ attr = results.get(u"attr")
+ head = results.get(u"head")
+ arg_ = results.get(u"arg")
+ if arg_:
+ arg = arg_.clone()
+ head.replace(Attr(Name(unicode(arg),prefix=head.prefix),
+ Name(u"next")))
+ arg_.remove()
+ elif base:
+ attr.replace(Name(u"next", prefix=attr.prefix))
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_printfunction.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_printfunction.py
new file mode 100644
index 0000000..a2a6e08
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_printfunction.py
@@ -0,0 +1,17 @@
+u"""
+Fixer for print: from __future__ import print_function.
+"""
+
+from lib2to3 import fixer_base
+from libfuturize.fixer_util import future_import
+
+class FixPrintfunction(fixer_base.BaseFix):
+
+ # explicit = True
+
+ PATTERN = u"""
+ power< 'print' trailer < '(' any* ')' > any* >
+ """
+
+ def transform(self, node, results):
+ future_import(u"print_function", node)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_raise.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_raise.py
new file mode 100644
index 0000000..9c9c192
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_raise.py
@@ -0,0 +1,25 @@
+u"""Fixer for 'raise E(V).with_traceback(T)' -> 'raise E, V, T'"""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Comma, Node, Leaf, token, syms
+
+class FixRaise(fixer_base.BaseFix):
+
+ PATTERN = u"""
+ raise_stmt< 'raise' (power< name=any [trailer< '(' val=any* ')' >]
+ [trailer< '.' 'with_traceback' > trailer< '(' trc=any ')' >] > | any) ['from' chain=any] >"""
+
+ def transform(self, node, results):
+ name, val, trc = (results.get(u"name"), results.get(u"val"), results.get(u"trc"))
+ chain = results.get(u"chain")
+ if chain is not None:
+ self.warning(node, u"explicit exception chaining is not supported in Python 2")
+ chain.prev_sibling.remove()
+ chain.remove()
+ if trc is not None:
+ val = val[0] if val else Leaf(token.NAME, u"None")
+ val.prefix = trc.prefix = u" "
+ kids = [Leaf(token.NAME, u"raise"), name.clone(), Comma(),
+ val.clone(), Comma(), trc.clone()]
+ raise_stmt = Node(syms.raise_stmt, kids)
+ node.replace(raise_stmt)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_raise_.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_raise_.py
new file mode 100644
index 0000000..0f020c4
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_raise_.py
@@ -0,0 +1,35 @@
+u"""Fixer for
+ raise E(V).with_traceback(T)
+ to:
+ from future.utils import raise_
+ ...
+ raise_(E, V, T)
+
+TODO: FIXME!!
+
+"""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Comma, Node, Leaf, token, syms
+
+class FixRaise(fixer_base.BaseFix):
+
+ PATTERN = u"""
+ raise_stmt< 'raise' (power< name=any [trailer< '(' val=any* ')' >]
+ [trailer< '.' 'with_traceback' > trailer< '(' trc=any ')' >] > | any) ['from' chain=any] >"""
+
+ def transform(self, node, results):
+ FIXME
+ name, val, trc = (results.get(u"name"), results.get(u"val"), results.get(u"trc"))
+ chain = results.get(u"chain")
+ if chain is not None:
+ self.warning(node, u"explicit exception chaining is not supported in Python 2")
+ chain.prev_sibling.remove()
+ chain.remove()
+ if trc is not None:
+ val = val[0] if val else Leaf(token.NAME, u"None")
+ val.prefix = trc.prefix = u" "
+ kids = [Leaf(token.NAME, u"raise"), name.clone(), Comma(),
+ val.clone(), Comma(), trc.clone()]
+ raise_stmt = Node(syms.raise_stmt, kids)
+ node.replace(raise_stmt)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_throw.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_throw.py
new file mode 100644
index 0000000..c0feed1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_throw.py
@@ -0,0 +1,23 @@
+u"""Fixer for 'g.throw(E(V).with_traceback(T))' -> 'g.throw(E, V, T)'"""
+
+from lib2to3 import fixer_base
+from lib2to3.pytree import Node, Leaf
+from lib2to3.pgen2 import token
+from lib2to3.fixer_util import Comma
+
+class FixThrow(fixer_base.BaseFix):
+
+ PATTERN = u"""
+ power< any trailer< '.' 'throw' >
+ trailer< '(' args=power< exc=any trailer< '(' val=any* ')' >
+ trailer< '.' 'with_traceback' > trailer< '(' trc=any ')' > > ')' > >
+ """
+
+ def transform(self, node, results):
+ syms = self.syms
+ exc, val, trc = (results[u"exc"], results[u"val"], results[u"trc"])
+ val = val[0] if val else Leaf(token.NAME, u"None")
+ val.prefix = trc.prefix = u" "
+ kids = [exc.clone(), Comma(), val.clone(), Comma(), trc.clone()]
+ args = results[u"args"]
+ args.children = kids
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_unpacking.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_unpacking.py
new file mode 100644
index 0000000..1e53a9b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/fixes/fix_unpacking.py
@@ -0,0 +1,120 @@
+u"""
+Fixer for:
+(a,)* *b (,c)* [,] = s
+for (a,)* *b (,c)* [,] in d: ...
+"""
+
+from lib2to3 import fixer_base
+from itertools import count
+from lib2to3.fixer_util import (Assign, Comma, Call, Newline, Name,
+ Number, token, syms, Node, Leaf)
+from libfuturize.fixer_util import indentation, suitify, commatize
+# from libfuturize.fixer_util import Assign, Comma, Call, Newline, Name, Number, indentation, suitify, commatize, token, syms, Node, Leaf
+
+def assignment_source(num_pre, num_post, LISTNAME, ITERNAME):
+ u"""
+ Accepts num_pre and num_post, which are counts of values
+ before and after the starg (not including the starg)
+ Returns a source fit for Assign() from fixer_util
+ """
+ children = []
+ pre = unicode(num_pre)
+ post = unicode(num_post)
+ # This code builds the assignment source from lib2to3 tree primitives.
+ # It's not very readable, but it seems like the most correct way to do it.
+ if num_pre > 0:
+ pre_part = Node(syms.power, [Name(LISTNAME), Node(syms.trailer, [Leaf(token.LSQB, u"["), Node(syms.subscript, [Leaf(token.COLON, u":"), Number(pre)]), Leaf(token.RSQB, u"]")])])
+ children.append(pre_part)
+ children.append(Leaf(token.PLUS, u"+", prefix=u" "))
+ main_part = Node(syms.power, [Leaf(token.LSQB, u"[", prefix=u" "), Name(LISTNAME), Node(syms.trailer, [Leaf(token.LSQB, u"["), Node(syms.subscript, [Number(pre) if num_pre > 0 else Leaf(1, u""), Leaf(token.COLON, u":"), Node(syms.factor, [Leaf(token.MINUS, u"-"), Number(post)]) if num_post > 0 else Leaf(1, u"")]), Leaf(token.RSQB, u"]"), Leaf(token.RSQB, u"]")])])
+ children.append(main_part)
+ if num_post > 0:
+ children.append(Leaf(token.PLUS, u"+", prefix=u" "))
+ post_part = Node(syms.power, [Name(LISTNAME, prefix=u" "), Node(syms.trailer, [Leaf(token.LSQB, u"["), Node(syms.subscript, [Node(syms.factor, [Leaf(token.MINUS, u"-"), Number(post)]), Leaf(token.COLON, u":")]), Leaf(token.RSQB, u"]")])])
+ children.append(post_part)
+ source = Node(syms.arith_expr, children)
+ return source
+
+class FixUnpacking(fixer_base.BaseFix):
+
+ PATTERN = u"""
+ expl=expr_stmt< testlist_star_expr<
+ pre=(any ',')*
+ star_expr< '*' name=NAME >
+ post=(',' any)* [','] > '=' source=any > |
+ impl=for_stmt< 'for' lst=exprlist<
+ pre=(any ',')*
+ star_expr< '*' name=NAME >
+ post=(',' any)* [','] > 'in' it=any ':' suite=any>"""
+
+ def fix_explicit_context(self, node, results):
+ pre, name, post, source = (results.get(n) for n in (u"pre", u"name", u"post", u"source"))
+ pre = [n.clone() for n in pre if n.type == token.NAME]
+ name.prefix = u" "
+ post = [n.clone() for n in post if n.type == token.NAME]
+ target = [n.clone() for n in commatize(pre + [name.clone()] + post)]
+ # to make the special-case fix for "*z, = ..." correct with the least
+ # amount of modification, make the left-side into a guaranteed tuple
+ target.append(Comma())
+ source.prefix = u""
+ setup_line = Assign(Name(self.LISTNAME), Call(Name(u"list"), [source.clone()]))
+ power_line = Assign(target, assignment_source(len(pre), len(post), self.LISTNAME, self.ITERNAME))
+ return setup_line, power_line
+
+ def fix_implicit_context(self, node, results):
+ u"""
+ Only example of the implicit context is
+ a for loop, so only fix that.
+ """
+ pre, name, post, it = (results.get(n) for n in (u"pre", u"name", u"post", u"it"))
+ pre = [n.clone() for n in pre if n.type == token.NAME]
+ name.prefix = u" "
+ post = [n.clone() for n in post if n.type == token.NAME]
+ target = [n.clone() for n in commatize(pre + [name.clone()] + post)]
+ # to make the special-case fix for "*z, = ..." correct with the least
+ # amount of modification, make the left-side into a guaranteed tuple
+ target.append(Comma())
+ source = it.clone()
+ source.prefix = u""
+ setup_line = Assign(Name(self.LISTNAME), Call(Name(u"list"), [Name(self.ITERNAME)]))
+ power_line = Assign(target, assignment_source(len(pre), len(post), self.LISTNAME, self.ITERNAME))
+ return setup_line, power_line
+
+ def transform(self, node, results):
+ u"""
+ a,b,c,d,e,f,*g,h,i = range(100) changes to
+ _3to2list = list(range(100))
+ a,b,c,d,e,f,g,h,i, = _3to2list[:6] + [_3to2list[6:-2]] + _3to2list[-2:]
+
+ and
+
+ for a,b,*c,d,e in iter_of_iters: do_stuff changes to
+ for _3to2iter in iter_of_iters:
+ _3to2list = list(_3to2iter)
+ a,b,c,d,e, = _3to2list[:2] + [_3to2list[2:-2]] + _3to2list[-2:]
+ do_stuff
+ """
+ self.LISTNAME = self.new_name(u"_3to2list")
+ self.ITERNAME = self.new_name(u"_3to2iter")
+ expl, impl = results.get(u"expl"), results.get(u"impl")
+ if expl is not None:
+ setup_line, power_line = self.fix_explicit_context(node, results)
+ setup_line.prefix = expl.prefix
+ power_line.prefix = indentation(expl.parent)
+ setup_line.append_child(Newline())
+ parent = node.parent
+ i = node.remove()
+ parent.insert_child(i, power_line)
+ parent.insert_child(i, setup_line)
+ elif impl is not None:
+ setup_line, power_line = self.fix_implicit_context(node, results)
+ suitify(node)
+ suite = [k for k in node.children if k.type == syms.suite][0]
+ setup_line.prefix = u""
+ power_line.prefix = suite.children[1].value
+ suite.children[2].prefix = indentation(suite.children[2])
+ suite.insert_child(2, Newline())
+ suite.insert_child(2, power_line)
+ suite.insert_child(2, Newline())
+ suite.insert_child(2, setup_line)
+ results.get(u"lst").replace(Name(self.ITERNAME, prefix=u" "))
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/main.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/main.py
new file mode 100644
index 0000000..cc0e6ec
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/libpasteurize/main.py
@@ -0,0 +1,149 @@
+"""
+pasteurize: automatic conversion of Python 3 code to clean 2/3 code
+===================================================================
+
+``pasteurize`` attempts to convert existing Python 3 code into source-compatible
+Python 2 and 3 code.
+
+Use it like this on Python 3 code:
+
+ $ pasteurize --verbose mypython3script.py
+
+This removes any Py3-only syntax (e.g. new metaclasses) and adds these
+import lines:
+
+ from __future__ import absolute_import
+ from __future__ import division
+ from __future__ import print_function
+ from __future__ import unicode_literals
+ from future import standard_library
+ standard_library.install_hooks()
+ from builtins import *
+
+To write changes to the files, use the -w flag.
+
+It also adds any other wrappers needed for Py2/3 compatibility.
+
+Note that separate stages are not available (or needed) when converting from
+Python 3 with ``pasteurize`` as they are when converting from Python 2 with
+``futurize``.
+
+The --all-imports option forces adding all ``__future__`` imports,
+``builtins`` imports, and standard library aliases, even if they don't
+seem necessary for the current state of each module. (This can simplify
+testing, and can reduce the need to think about Py2 compatibility when editing
+the code further.)
+
+"""
+
+from __future__ import (absolute_import, print_function, unicode_literals)
+
+import sys
+import logging
+import optparse
+from lib2to3.main import main, warn, StdoutRefactoringTool
+from lib2to3 import refactor
+
+from future import __version__
+from libpasteurize.fixes import fix_names
+
+
+def main(args=None):
+ """Main program.
+
+ Returns a suggested exit status (0, 1, 2).
+ """
+ # Set up option parser
+ parser = optparse.OptionParser(usage="pasteurize [options] file|dir ...")
+ parser.add_option("-V", "--version", action="store_true",
+ help="Report the version number of pasteurize")
+ parser.add_option("-a", "--all-imports", action="store_true",
+ help="Adds all __future__ and future imports to each module")
+ parser.add_option("-f", "--fix", action="append", default=[],
+ help="Each FIX specifies a transformation; default: all")
+ parser.add_option("-j", "--processes", action="store", default=1,
+ type="int", help="Run 2to3 concurrently")
+ parser.add_option("-x", "--nofix", action="append", default=[],
+ help="Prevent a fixer from being run.")
+ parser.add_option("-l", "--list-fixes", action="store_true",
+ help="List available transformations")
+ # parser.add_option("-p", "--print-function", action="store_true",
+ # help="Modify the grammar so that print() is a function")
+ parser.add_option("-v", "--verbose", action="store_true",
+ help="More verbose logging")
+ parser.add_option("--no-diffs", action="store_true",
+ help="Don't show diffs of the refactoring")
+ parser.add_option("-w", "--write", action="store_true",
+ help="Write back modified files")
+ parser.add_option("-n", "--nobackups", action="store_true", default=False,
+ help="Don't write backups for modified files.")
+
+ # Parse command line arguments
+ refactor_stdin = False
+ flags = {}
+ options, args = parser.parse_args(args)
+ fixer_pkg = 'libpasteurize.fixes'
+ avail_fixes = fix_names
+ flags["print_function"] = True
+
+ if not options.write and options.no_diffs:
+ warn("not writing files and not printing diffs; that's not very useful")
+ if not options.write and options.nobackups:
+ parser.error("Can't use -n without -w")
+ if options.version:
+ print(__version__)
+ return 0
+ if options.list_fixes:
+ print("Available transformations for the -f/--fix option:")
+ for fixname in sorted(avail_fixes):
+ print(fixname)
+ if not args:
+ return 0
+ if not args:
+ print("At least one file or directory argument required.",
+ file=sys.stderr)
+ print("Use --help to show usage.", file=sys.stderr)
+ return 2
+ if "-" in args:
+ refactor_stdin = True
+ if options.write:
+ print("Can't write to stdin.", file=sys.stderr)
+ return 2
+
+ # Set up logging handler
+ level = logging.DEBUG if options.verbose else logging.INFO
+ logging.basicConfig(format='%(name)s: %(message)s', level=level)
+
+ # Initialize the refactoring tool
+ unwanted_fixes = set(fixer_pkg + ".fix_" + fix for fix in options.nofix)
+
+ extra_fixes = set()
+ if options.all_imports:
+ prefix = 'libpasteurize.fixes.'
+ extra_fixes.add(prefix + 'fix_add_all__future__imports')
+ extra_fixes.add(prefix + 'fix_add_future_standard_library_import')
+ extra_fixes.add(prefix + 'fix_add_all_future_builtins')
+
+ fixer_names = avail_fixes | extra_fixes - unwanted_fixes
+
+ rt = StdoutRefactoringTool(sorted(fixer_names), flags, set(),
+ options.nobackups, not options.no_diffs)
+
+ # Refactor all files and directories passed as arguments
+ if not rt.errors:
+ if refactor_stdin:
+ rt.refactor_stdin()
+ else:
+ try:
+ rt.refactor(args, options.write, None,
+ options.processes)
+ except refactor.MultiprocessingUnsupported:
+ assert options.processes > 1
+ print("Sorry, -j isn't " \
+ "supported on this platform.", file=sys.stderr)
+ return 1
+ rt.summarize()
+
+ # Return error status (0 if rt.errors is zero)
+ return int(bool(rt.errors))
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/__init__.py
new file mode 100644
index 0000000..e31678b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/__init__.py
@@ -0,0 +1,93 @@
+# coding=utf-8
+"""
+past: compatibility with Python 2 from Python 3
+===============================================
+
+``past`` is a package to aid with Python 2/3 compatibility. Whereas ``future``
+contains backports of Python 3 constructs to Python 2, ``past`` provides
+implementations of some Python 2 constructs in Python 3 and tools to import and
+run Python 2 code in Python 3. It is intended to be used sparingly, as a way of
+running old Python 2 code from Python 3 until the code is ported properly.
+
+Potential uses for libraries:
+
+- as a step in porting a Python 2 codebase to Python 3 (e.g. with the ``futurize`` script)
+- to provide Python 3 support for previously Python 2-only libraries with the
+ same APIs as on Python 2 -- particularly with regard to 8-bit strings (the
+ ``past.builtins.str`` type).
+- to aid in providing minimal-effort Python 3 support for applications using
+ libraries that do not yet wish to upgrade their code properly to Python 3, or
+ wish to upgrade it gradually to Python 3 style.
+
+
+Here are some code examples that run identically on Python 3 and 2::
+
+ >>> from past.builtins import str as oldstr
+
+ >>> philosopher = oldstr(u'\u5b54\u5b50'.encode('utf-8'))
+ >>> # This now behaves like a Py2 byte-string on both Py2 and Py3.
+ >>> # For example, indexing returns a Python 2-like string object, not
+ >>> # an integer:
+ >>> philosopher[0]
+ '\xe5'
+ >>> type(philosopher[0])
+
+
+ >>> # List-producing versions of range, reduce, map, filter
+ >>> from past.builtins import range, reduce
+ >>> range(10)
+ [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+ >>> reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])
+ 15
+
+ >>> # Other functions removed in Python 3 are resurrected ...
+ >>> from past.builtins import execfile
+ >>> execfile('myfile.py')
+
+ >>> from past.builtins import raw_input
+ >>> name = raw_input('What is your name? ')
+ What is your name? [cursor]
+
+ >>> from past.builtins import reload
+ >>> reload(mymodule) # equivalent to imp.reload(mymodule) in Python 3
+
+ >>> from past.builtins import xrange
+ >>> for i in xrange(10):
+ ... pass
+
+
+It also provides import hooks so you can import and use Python 2 modules like
+this::
+
+ $ python3
+
+ >>> from past import autotranslate
+ >>> authotranslate('mypy2module')
+ >>> import mypy2module
+
+until the authors of the Python 2 modules have upgraded their code. Then, for
+example::
+
+ >>> mypy2module.func_taking_py2_string(oldstr(b'abcd'))
+
+
+Credits
+-------
+
+:Author: Ed Schofield
+:Sponsor: Python Charmers Pty Ltd, Australia: http://pythoncharmers.com
+
+
+Licensing
+---------
+Copyright 2013-2015 Python Charmers Pty Ltd, Australia.
+The software is distributed under an MIT licence. See LICENSE.txt.
+"""
+
+
+from past.translation import install_hooks as autotranslate
+from future import __version__, __copyright__, __license__
+
+__title__ = 'past'
+__author__ = 'Ed Schofield'
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/builtins/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/builtins/__init__.py
new file mode 100644
index 0000000..a967736
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/builtins/__init__.py
@@ -0,0 +1,72 @@
+"""
+A resurrection of some old functions from Python 2 for use in Python 3. These
+should be used sparingly, to help with porting efforts, since code using them
+is no longer standard Python 3 code.
+
+This module provides the following:
+
+1. Implementations of these builtin functions which have no equivalent on Py3:
+
+- apply
+- chr
+- cmp
+- execfile
+
+2. Aliases:
+
+- intern <- sys.intern
+- raw_input <- input
+- reduce <- functools.reduce
+- reload <- imp.reload
+- unichr <- chr
+- unicode <- str
+- xrange <- range
+
+3. List-producing versions of the corresponding Python 3 iterator-producing functions:
+
+- filter
+- map
+- range
+- zip
+
+4. Forward-ported Py2 types:
+
+- basestring
+- dict
+- str
+- long
+- unicode
+
+"""
+
+from future.utils import PY3
+from past.builtins.noniterators import (filter, map, range, reduce, zip)
+# from past.builtins.misc import (ascii, hex, input, oct, open)
+if PY3:
+ from past.types import (basestring,
+ olddict as dict,
+ oldstr as str,
+ long,
+ unicode)
+else:
+ from __builtin__ import (basestring, dict, str, long, unicode)
+
+from past.builtins.misc import (apply, chr, cmp, execfile, intern, oct,
+ raw_input, reload, unichr, unicode, xrange)
+from past import utils
+
+
+if utils.PY3:
+ # We only import names that shadow the builtins on Py3. No other namespace
+ # pollution on Py3.
+
+ # Only shadow builtins on Py3; no new names
+ __all__ = ['filter', 'map', 'range', 'reduce', 'zip',
+ 'basestring', 'dict', 'str', 'long', 'unicode',
+ 'apply', 'chr', 'cmp', 'execfile', 'intern', 'raw_input',
+ 'reload', 'unichr', 'xrange'
+ ]
+
+else:
+ # No namespace pollution on Py2
+ __all__ = []
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/builtins/misc.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/builtins/misc.py
new file mode 100644
index 0000000..55dc63c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/builtins/misc.py
@@ -0,0 +1,90 @@
+from __future__ import unicode_literals
+import sys
+import inspect
+from collections import Mapping
+
+from future.utils import PY3, exec_
+
+
+if PY3:
+ import builtins
+
+ def apply(f, *args, **kw):
+ return f(*args, **kw)
+
+ from past.builtins import str as oldstr
+
+ def chr(i):
+ """
+ Return a byte-string of one character with ordinal i; 0 <= i <= 256
+ """
+ return oldstr(bytes((i,)))
+
+ def cmp(x, y):
+ """
+ cmp(x, y) -> integer
+
+ Return negative if xy.
+ """
+ return (x > y) - (x < y)
+
+ from sys import intern
+
+ def oct(number):
+ """oct(number) -> string
+
+ Return the octal representation of an integer
+ """
+ return '0' + builtins.oct(number)[2:]
+
+ raw_input = input
+ from imp import reload
+ unicode = str
+ unichr = chr
+ xrange = range
+else:
+ import __builtin__
+ apply = __builtin__.apply
+ chr = __builtin__.chr
+ cmp = __builtin__.cmp
+ execfile = __builtin__.execfile
+ intern = __builtin__.intern
+ oct = __builtin__.oct
+ raw_input = __builtin__.raw_input
+ reload = __builtin__.reload
+ unicode = __builtin__.unicode
+ unichr = __builtin__.unichr
+ xrange = __builtin__.xrange
+
+
+if PY3:
+ def execfile(filename, myglobals=None, mylocals=None):
+ """
+ Read and execute a Python script from a file in the given namespaces.
+ The globals and locals are dictionaries, defaulting to the current
+ globals and locals. If only globals is given, locals defaults to it.
+ """
+ if myglobals is None:
+ # There seems to be no alternative to frame hacking here.
+ caller_frame = inspect.stack()[1]
+ myglobals = caller_frame[0].f_globals
+ mylocals = caller_frame[0].f_locals
+ elif mylocals is None:
+ # Only if myglobals is given do we set mylocals to it.
+ mylocals = myglobals
+ if not isinstance(myglobals, Mapping):
+ raise TypeError('globals must be a mapping')
+ if not isinstance(mylocals, Mapping):
+ raise TypeError('locals must be a mapping')
+ with open(filename, "rbU") as fin:
+ source = fin.read()
+ code = compile(source, filename, "exec")
+ exec_(code, myglobals, mylocals)
+
+
+if PY3:
+ __all__ = ['apply', 'chr', 'cmp', 'execfile', 'intern', 'raw_input',
+ 'reload', 'unichr', 'unicode', 'xrange']
+else:
+ __all__ = []
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/builtins/noniterators.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/builtins/noniterators.py
new file mode 100644
index 0000000..66a4a8a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/builtins/noniterators.py
@@ -0,0 +1,273 @@
+"""
+This module is designed to be used as follows::
+
+ from past.builtins.noniterators import filter, map, range, reduce, zip
+
+And then, for example::
+
+ assert isinstance(range(5), list)
+
+The list-producing functions this brings in are::
+
+- ``filter``
+- ``map``
+- ``range``
+- ``reduce``
+- ``zip``
+
+"""
+
+from __future__ import division, absolute_import, print_function
+
+from itertools import chain, starmap
+import itertools # since zip_longest doesn't exist on Py2
+from past.types import basestring
+from past.utils import PY3
+
+
+def flatmap(f, items):
+ return chain.from_iterable(map(f, items))
+
+
+if PY3:
+ import builtins
+
+ # list-producing versions of the major Python iterating functions
+ def oldfilter(*args):
+ """
+ filter(function or None, sequence) -> list, tuple, or string
+
+ Return those items of sequence for which function(item) is true.
+ If function is None, return the items that are true. If sequence
+ is a tuple or string, return the same type, else return a list.
+ """
+ mytype = type(args[1])
+ if isinstance(args[1], basestring):
+ return mytype().join(builtins.filter(*args))
+ elif isinstance(args[1], (tuple, list)):
+ return mytype(builtins.filter(*args))
+ else:
+ # Fall back to list. Is this the right thing to do?
+ return list(builtins.filter(*args))
+
+ # This is surprisingly difficult to get right. For example, the
+ # solutions here fail with the test cases in the docstring below:
+ # http://stackoverflow.com/questions/8072755/
+ def oldmap(func, *iterables):
+ """
+ map(function, sequence[, sequence, ...]) -> list
+
+ Return a list of the results of applying the function to the
+ items of the argument sequence(s). If more than one sequence is
+ given, the function is called with an argument list consisting of
+ the corresponding item of each sequence, substituting None for
+ missing values when not all sequences have the same length. If
+ the function is None, return a list of the items of the sequence
+ (or a list of tuples if more than one sequence).
+
+ Test cases:
+ >>> oldmap(None, 'hello world')
+ ['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']
+
+ >>> oldmap(None, range(4))
+ [0, 1, 2, 3]
+
+ More test cases are in past.tests.test_builtins.
+ """
+ zipped = itertools.zip_longest(*iterables)
+ l = list(zipped)
+ if len(l) == 0:
+ return []
+ if func is None:
+ result = l
+ else:
+ result = list(starmap(func, l))
+
+ # Inspect to see whether it's a simple sequence of tuples
+ try:
+ if max([len(item) for item in result]) == 1:
+ return list(chain.from_iterable(result))
+ # return list(flatmap(func, result))
+ except TypeError as e:
+ # Simple objects like ints have no len()
+ pass
+ return result
+
+ ############################
+ ### For reference, the source code for Py2.7 map function:
+ # static PyObject *
+ # builtin_map(PyObject *self, PyObject *args)
+ # {
+ # typedef struct {
+ # PyObject *it; /* the iterator object */
+ # int saw_StopIteration; /* bool: did the iterator end? */
+ # } sequence;
+ #
+ # PyObject *func, *result;
+ # sequence *seqs = NULL, *sqp;
+ # Py_ssize_t n, len;
+ # register int i, j;
+ #
+ # n = PyTuple_Size(args);
+ # if (n < 2) {
+ # PyErr_SetString(PyExc_TypeError,
+ # "map() requires at least two args");
+ # return NULL;
+ # }
+ #
+ # func = PyTuple_GetItem(args, 0);
+ # n--;
+ #
+ # if (func == Py_None) {
+ # if (PyErr_WarnPy3k("map(None, ...) not supported in 3.x; "
+ # "use list(...)", 1) < 0)
+ # return NULL;
+ # if (n == 1) {
+ # /* map(None, S) is the same as list(S). */
+ # return PySequence_List(PyTuple_GetItem(args, 1));
+ # }
+ # }
+ #
+ # /* Get space for sequence descriptors. Must NULL out the iterator
+ # * pointers so that jumping to Fail_2 later doesn't see trash.
+ # */
+ # if ((seqs = PyMem_NEW(sequence, n)) == NULL) {
+ # PyErr_NoMemory();
+ # return NULL;
+ # }
+ # for (i = 0; i < n; ++i) {
+ # seqs[i].it = (PyObject*)NULL;
+ # seqs[i].saw_StopIteration = 0;
+ # }
+ #
+ # /* Do a first pass to obtain iterators for the arguments, and set len
+ # * to the largest of their lengths.
+ # */
+ # len = 0;
+ # for (i = 0, sqp = seqs; i < n; ++i, ++sqp) {
+ # PyObject *curseq;
+ # Py_ssize_t curlen;
+ #
+ # /* Get iterator. */
+ # curseq = PyTuple_GetItem(args, i+1);
+ # sqp->it = PyObject_GetIter(curseq);
+ # if (sqp->it == NULL) {
+ # static char errmsg[] =
+ # "argument %d to map() must support iteration";
+ # char errbuf[sizeof(errmsg) + 25];
+ # PyOS_snprintf(errbuf, sizeof(errbuf), errmsg, i+2);
+ # PyErr_SetString(PyExc_TypeError, errbuf);
+ # goto Fail_2;
+ # }
+ #
+ # /* Update len. */
+ # curlen = _PyObject_LengthHint(curseq, 8);
+ # if (curlen > len)
+ # len = curlen;
+ # }
+ #
+ # /* Get space for the result list. */
+ # if ((result = (PyObject *) PyList_New(len)) == NULL)
+ # goto Fail_2;
+ #
+ # /* Iterate over the sequences until all have stopped. */
+ # for (i = 0; ; ++i) {
+ # PyObject *alist, *item=NULL, *value;
+ # int numactive = 0;
+ #
+ # if (func == Py_None && n == 1)
+ # alist = NULL;
+ # else if ((alist = PyTuple_New(n)) == NULL)
+ # goto Fail_1;
+ #
+ # for (j = 0, sqp = seqs; j < n; ++j, ++sqp) {
+ # if (sqp->saw_StopIteration) {
+ # Py_INCREF(Py_None);
+ # item = Py_None;
+ # }
+ # else {
+ # item = PyIter_Next(sqp->it);
+ # if (item)
+ # ++numactive;
+ # else {
+ # if (PyErr_Occurred()) {
+ # Py_XDECREF(alist);
+ # goto Fail_1;
+ # }
+ # Py_INCREF(Py_None);
+ # item = Py_None;
+ # sqp->saw_StopIteration = 1;
+ # }
+ # }
+ # if (alist)
+ # PyTuple_SET_ITEM(alist, j, item);
+ # else
+ # break;
+ # }
+ #
+ # if (!alist)
+ # alist = item;
+ #
+ # if (numactive == 0) {
+ # Py_DECREF(alist);
+ # break;
+ # }
+ #
+ # if (func == Py_None)
+ # value = alist;
+ # else {
+ # value = PyEval_CallObject(func, alist);
+ # Py_DECREF(alist);
+ # if (value == NULL)
+ # goto Fail_1;
+ # }
+ # if (i >= len) {
+ # int status = PyList_Append(result, value);
+ # Py_DECREF(value);
+ # if (status < 0)
+ # goto Fail_1;
+ # }
+ # else if (PyList_SetItem(result, i, value) < 0)
+ # goto Fail_1;
+ # }
+ #
+ # if (i < len && PyList_SetSlice(result, i, len, NULL) < 0)
+ # goto Fail_1;
+ #
+ # goto Succeed;
+ #
+ # Fail_1:
+ # Py_DECREF(result);
+ # Fail_2:
+ # result = NULL;
+ # Succeed:
+ # assert(seqs);
+ # for (i = 0; i < n; ++i)
+ # Py_XDECREF(seqs[i].it);
+ # PyMem_DEL(seqs);
+ # return result;
+ # }
+
+ def oldrange(*args, **kwargs):
+ return list(builtins.range(*args, **kwargs))
+
+ def oldzip(*args, **kwargs):
+ return list(builtins.zip(*args, **kwargs))
+
+ filter = oldfilter
+ map = oldmap
+ range = oldrange
+ from functools import reduce
+ zip = oldzip
+ __all__ = ['filter', 'map', 'range', 'reduce', 'zip']
+
+else:
+ import __builtin__
+ # Python 2-builtin ranges produce lists
+ filter = __builtin__.filter
+ map = __builtin__.map
+ range = __builtin__.range
+ reduce = __builtin__.reduce
+ zip = __builtin__.zip
+ __all__ = []
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/tests/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/tests/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/translation/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/translation/__init__.py
new file mode 100644
index 0000000..7b21d9f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/translation/__init__.py
@@ -0,0 +1,498 @@
+# -*- coding: utf-8 -*-
+"""
+past.translation
+==================
+
+The ``past.translation`` package provides an import hook for Python 3 which
+transparently runs ``futurize`` fixers over Python 2 code on import to convert
+print statements into functions, etc.
+
+It is intended to assist users in migrating to Python 3.x even if some
+dependencies still only support Python 2.x.
+
+Usage
+-----
+
+Once your Py2 package is installed in the usual module search path, the import
+hook is invoked as follows:
+
+ >>> from past import autotranslate
+ >>> autotranslate('mypackagename')
+
+Or:
+
+ >>> autotranslate(['mypackage1', 'mypackage2'])
+
+You can unregister the hook using::
+
+ >>> from past.translation import remove_hooks
+ >>> remove_hooks()
+
+Author: Ed Schofield.
+Inspired by and based on ``uprefix`` by Vinay M. Sajip.
+"""
+
+import imp
+import logging
+import marshal
+import os
+import sys
+import copy
+from lib2to3.pgen2.parse import ParseError
+from lib2to3.refactor import RefactoringTool
+
+from libfuturize import fixes
+
+
+logger = logging.getLogger(__name__)
+logger.setLevel(logging.DEBUG)
+
+myfixes = (list(fixes.libfuturize_fix_names_stage1) +
+ list(fixes.lib2to3_fix_names_stage1) +
+ list(fixes.libfuturize_fix_names_stage2) +
+ list(fixes.lib2to3_fix_names_stage2))
+
+
+# We detect whether the code is Py2 or Py3 by applying certain lib2to3 fixers
+# to it. If the diff is empty, it's Python 3 code.
+
+py2_detect_fixers = [
+# From stage 1:
+ 'lib2to3.fixes.fix_apply',
+ # 'lib2to3.fixes.fix_dict', # TODO: add support for utils.viewitems() etc. and move to stage2
+ 'lib2to3.fixes.fix_except',
+ 'lib2to3.fixes.fix_execfile',
+ 'lib2to3.fixes.fix_exitfunc',
+ 'lib2to3.fixes.fix_funcattrs',
+ 'lib2to3.fixes.fix_filter',
+ 'lib2to3.fixes.fix_has_key',
+ 'lib2to3.fixes.fix_idioms',
+ 'lib2to3.fixes.fix_import', # makes any implicit relative imports explicit. (Use with ``from __future__ import absolute_import)
+ 'lib2to3.fixes.fix_intern',
+ 'lib2to3.fixes.fix_isinstance',
+ 'lib2to3.fixes.fix_methodattrs',
+ 'lib2to3.fixes.fix_ne',
+ 'lib2to3.fixes.fix_numliterals', # turns 1L into 1, 0755 into 0o755
+ 'lib2to3.fixes.fix_paren',
+ 'lib2to3.fixes.fix_print',
+ 'lib2to3.fixes.fix_raise', # uses incompatible with_traceback() method on exceptions
+ 'lib2to3.fixes.fix_renames',
+ 'lib2to3.fixes.fix_reduce',
+ # 'lib2to3.fixes.fix_set_literal', # this is unnecessary and breaks Py2.6 support
+ 'lib2to3.fixes.fix_repr',
+ 'lib2to3.fixes.fix_standarderror',
+ 'lib2to3.fixes.fix_sys_exc',
+ 'lib2to3.fixes.fix_throw',
+ 'lib2to3.fixes.fix_tuple_params',
+ 'lib2to3.fixes.fix_types',
+ 'lib2to3.fixes.fix_ws_comma',
+ 'lib2to3.fixes.fix_xreadlines',
+
+# From stage 2:
+ 'lib2to3.fixes.fix_basestring',
+ # 'lib2to3.fixes.fix_buffer', # perhaps not safe. Test this.
+ # 'lib2to3.fixes.fix_callable', # not needed in Py3.2+
+ # 'lib2to3.fixes.fix_dict', # TODO: add support for utils.viewitems() etc.
+ 'lib2to3.fixes.fix_exec',
+ # 'lib2to3.fixes.fix_future', # we don't want to remove __future__ imports
+ 'lib2to3.fixes.fix_getcwdu',
+ # 'lib2to3.fixes.fix_imports', # called by libfuturize.fixes.fix_future_standard_library
+ # 'lib2to3.fixes.fix_imports2', # we don't handle this yet (dbm)
+ # 'lib2to3.fixes.fix_input',
+ # 'lib2to3.fixes.fix_itertools',
+ # 'lib2to3.fixes.fix_itertools_imports',
+ 'lib2to3.fixes.fix_long',
+ # 'lib2to3.fixes.fix_map',
+ # 'lib2to3.fixes.fix_metaclass', # causes SyntaxError in Py2! Use the one from ``six`` instead
+ 'lib2to3.fixes.fix_next',
+ 'lib2to3.fixes.fix_nonzero', # TODO: add a decorator for mapping __bool__ to __nonzero__
+ # 'lib2to3.fixes.fix_operator', # we will need support for this by e.g. extending the Py2 operator module to provide those functions in Py3
+ 'lib2to3.fixes.fix_raw_input',
+ # 'lib2to3.fixes.fix_unicode', # strips off the u'' prefix, which removes a potentially helpful source of information for disambiguating unicode/byte strings
+ # 'lib2to3.fixes.fix_urllib',
+ 'lib2to3.fixes.fix_xrange',
+ # 'lib2to3.fixes.fix_zip',
+]
+
+
+class RTs:
+ """
+ A namespace for the refactoring tools. This avoids creating these at
+ the module level, which slows down the module import. (See issue #117).
+
+ There are two possible grammars: with or without the print statement.
+ Hence we have two possible refactoring tool implementations.
+ """
+ _rt = None
+ _rtp = None
+ _rt_py2_detect = None
+ _rtp_py2_detect = None
+
+ @staticmethod
+ def setup():
+ """
+ Call this before using the refactoring tools to create them on demand
+ if needed.
+ """
+ if None in [RTs._rt, RTs._rtp]:
+ RTs._rt = RefactoringTool(myfixes)
+ RTs._rtp = RefactoringTool(myfixes, {'print_function': True})
+
+
+ @staticmethod
+ def setup_detect_python2():
+ """
+ Call this before using the refactoring tools to create them on demand
+ if needed.
+ """
+ if None in [RTs._rt_py2_detect, RTs._rtp_py2_detect]:
+ RTs._rt_py2_detect = RefactoringTool(py2_detect_fixers)
+ RTs._rtp_py2_detect = RefactoringTool(py2_detect_fixers,
+ {'print_function': True})
+
+
+# We need to find a prefix for the standard library, as we don't want to
+# process any files there (they will already be Python 3).
+#
+# The following method is used by Sanjay Vinip in uprefix. This fails for
+# ``conda`` environments:
+# # In a non-pythonv virtualenv, sys.real_prefix points to the installed Python.
+# # In a pythonv venv, sys.base_prefix points to the installed Python.
+# # Outside a virtual environment, sys.prefix points to the installed Python.
+
+# if hasattr(sys, 'real_prefix'):
+# _syslibprefix = sys.real_prefix
+# else:
+# _syslibprefix = getattr(sys, 'base_prefix', sys.prefix)
+
+# Instead, we use the portion of the path common to both the stdlib modules
+# ``math`` and ``urllib``.
+
+def splitall(path):
+ """
+ Split a path into all components. From Python Cookbook.
+ """
+ allparts = []
+ while True:
+ parts = os.path.split(path)
+ if parts[0] == path: # sentinel for absolute paths
+ allparts.insert(0, parts[0])
+ break
+ elif parts[1] == path: # sentinel for relative paths
+ allparts.insert(0, parts[1])
+ break
+ else:
+ path = parts[0]
+ allparts.insert(0, parts[1])
+ return allparts
+
+
+def common_substring(s1, s2):
+ """
+ Returns the longest common substring to the two strings, starting from the
+ left.
+ """
+ chunks = []
+ path1 = splitall(s1)
+ path2 = splitall(s2)
+ for (dir1, dir2) in zip(path1, path2):
+ if dir1 != dir2:
+ break
+ chunks.append(dir1)
+ return os.path.join(*chunks)
+
+# _stdlibprefix = common_substring(math.__file__, urllib.__file__)
+
+
+def detect_python2(source, pathname):
+ """
+ Returns a bool indicating whether we think the code is Py2
+ """
+ RTs.setup_detect_python2()
+ try:
+ tree = RTs._rt_py2_detect.refactor_string(source, pathname)
+ except ParseError as e:
+ if e.msg != 'bad input' or e.value != '=':
+ raise
+ tree = RTs._rtp.refactor_string(source, pathname)
+
+ if source != str(tree)[:-1]: # remove added newline
+ # The above fixers made changes, so we conclude it's Python 2 code
+ logger.debug('Detected Python 2 code: {0}'.format(pathname))
+ with open('/tmp/original_code.py', 'w') as f:
+ f.write('### Original code (detected as py2): %s\n%s' %
+ (pathname, source))
+ with open('/tmp/py2_detection_code.py', 'w') as f:
+ f.write('### Code after running py3 detection (from %s)\n%s' %
+ (pathname, str(tree)[:-1]))
+ return True
+ else:
+ logger.debug('Detected Python 3 code: {0}'.format(pathname))
+ with open('/tmp/original_code.py', 'w') as f:
+ f.write('### Original code (detected as py3): %s\n%s' %
+ (pathname, source))
+ try:
+ os.remove('/tmp/futurize_code.py')
+ except OSError:
+ pass
+ return False
+
+
+class Py2Fixer(object):
+ """
+ An import hook class that uses lib2to3 for source-to-source translation of
+ Py2 code to Py3.
+ """
+
+ # See the comments on :class:future.standard_library.RenameImport.
+ # We add this attribute here so remove_hooks() and install_hooks() can
+ # unambiguously detect whether the import hook is installed:
+ PY2FIXER = True
+
+ def __init__(self):
+ self.found = None
+ self.base_exclude_paths = ['future', 'past']
+ self.exclude_paths = copy.copy(self.base_exclude_paths)
+ self.include_paths = []
+
+ def include(self, paths):
+ """
+ Pass in a sequence of module names such as 'plotrique.plotting' that,
+ if present at the leftmost side of the full package name, would
+ specify the module to be transformed from Py2 to Py3.
+ """
+ self.include_paths += paths
+
+ def exclude(self, paths):
+ """
+ Pass in a sequence of strings such as 'mymodule' that, if
+ present at the leftmost side of the full package name, would cause
+ the module not to undergo any source transformation.
+ """
+ self.exclude_paths += paths
+
+ def find_module(self, fullname, path=None):
+ logger.debug('Running find_module: {0}...'.format(fullname))
+ if '.' in fullname:
+ parent, child = fullname.rsplit('.', 1)
+ if path is None:
+ loader = self.find_module(parent, path)
+ mod = loader.load_module(parent)
+ path = mod.__path__
+ fullname = child
+
+ # Perhaps we should try using the new importlib functionality in Python
+ # 3.3: something like this?
+ # thing = importlib.machinery.PathFinder.find_module(fullname, path)
+ try:
+ self.found = imp.find_module(fullname, path)
+ except Exception as e:
+ logger.debug('Py2Fixer could not find {0}')
+ logger.debug('Exception was: {0})'.format(fullname, e))
+ return None
+ self.kind = self.found[-1][-1]
+ if self.kind == imp.PKG_DIRECTORY:
+ self.pathname = os.path.join(self.found[1], '__init__.py')
+ elif self.kind == imp.PY_SOURCE:
+ self.pathname = self.found[1]
+ return self
+
+ def transform(self, source):
+ # This implementation uses lib2to3,
+ # you can override and use something else
+ # if that's better for you
+
+ # lib2to3 likes a newline at the end
+ RTs.setup()
+ source += '\n'
+ try:
+ tree = RTs._rt.refactor_string(source, self.pathname)
+ except ParseError as e:
+ if e.msg != 'bad input' or e.value != '=':
+ raise
+ tree = RTs._rtp.refactor_string(source, self.pathname)
+ # could optimise a bit for only doing str(tree) if
+ # getattr(tree, 'was_changed', False) returns True
+ return str(tree)[:-1] # remove added newline
+
+ def load_module(self, fullname):
+ logger.debug('Running load_module for {0}...'.format(fullname))
+ if fullname in sys.modules:
+ mod = sys.modules[fullname]
+ else:
+ if self.kind in (imp.PY_COMPILED, imp.C_EXTENSION, imp.C_BUILTIN,
+ imp.PY_FROZEN):
+ convert = False
+ # elif (self.pathname.startswith(_stdlibprefix)
+ # and 'site-packages' not in self.pathname):
+ # # We assume it's a stdlib package in this case. Is this too brittle?
+ # # Please file a bug report at https://github.com/PythonCharmers/python-future
+ # # if so.
+ # convert = False
+ # in theory, other paths could be configured to be excluded here too
+ elif any([fullname.startswith(path) for path in self.exclude_paths]):
+ convert = False
+ elif any([fullname.startswith(path) for path in self.include_paths]):
+ convert = True
+ else:
+ convert = False
+ if not convert:
+ logger.debug('Excluded {0} from translation'.format(fullname))
+ mod = imp.load_module(fullname, *self.found)
+ else:
+ logger.debug('Autoconverting {0} ...'.format(fullname))
+ mod = imp.new_module(fullname)
+ sys.modules[fullname] = mod
+
+ # required by PEP 302
+ mod.__file__ = self.pathname
+ mod.__name__ = fullname
+ mod.__loader__ = self
+
+ # This:
+ # mod.__package__ = '.'.join(fullname.split('.')[:-1])
+ # seems to result in "SystemError: Parent module '' not loaded,
+ # cannot perform relative import" for a package's __init__.py
+ # file. We use the approach below. Another option to try is the
+ # minimal load_module pattern from the PEP 302 text instead.
+
+ # Is the test in the next line more or less robust than the
+ # following one? Presumably less ...
+ # ispkg = self.pathname.endswith('__init__.py')
+
+ if self.kind == imp.PKG_DIRECTORY:
+ mod.__path__ = [ os.path.dirname(self.pathname) ]
+ mod.__package__ = fullname
+ else:
+ #else, regular module
+ mod.__path__ = []
+ mod.__package__ = fullname.rpartition('.')[0]
+
+ try:
+ cachename = imp.cache_from_source(self.pathname)
+ if not os.path.exists(cachename):
+ update_cache = True
+ else:
+ sourcetime = os.stat(self.pathname).st_mtime
+ cachetime = os.stat(cachename).st_mtime
+ update_cache = cachetime < sourcetime
+ # # Force update_cache to work around a problem with it being treated as Py3 code???
+ # update_cache = True
+ if not update_cache:
+ with open(cachename, 'rb') as f:
+ data = f.read()
+ try:
+ code = marshal.loads(data)
+ except Exception:
+ # pyc could be corrupt. Regenerate it
+ update_cache = True
+ if update_cache:
+ if self.found[0]:
+ source = self.found[0].read()
+ elif self.kind == imp.PKG_DIRECTORY:
+ with open(self.pathname) as f:
+ source = f.read()
+
+ if detect_python2(source, self.pathname):
+ source = self.transform(source)
+ with open('/tmp/futurized_code.py', 'w') as f:
+ f.write('### Futurized code (from %s)\n%s' %
+ (self.pathname, source))
+
+ code = compile(source, self.pathname, 'exec')
+
+ dirname = os.path.dirname(cachename)
+ if not os.path.exists(dirname):
+ os.makedirs(dirname)
+ try:
+ with open(cachename, 'wb') as f:
+ data = marshal.dumps(code)
+ f.write(data)
+ except Exception: # could be write-protected
+ pass
+ exec(code, mod.__dict__)
+ except Exception as e:
+ # must remove module from sys.modules
+ del sys.modules[fullname]
+ raise # keep it simple
+
+ if self.found[0]:
+ self.found[0].close()
+ return mod
+
+_hook = Py2Fixer()
+
+
+def install_hooks(include_paths=(), exclude_paths=()):
+ if isinstance(include_paths, str):
+ include_paths = (include_paths,)
+ if isinstance(exclude_paths, str):
+ exclude_paths = (exclude_paths,)
+ assert len(include_paths) + len(exclude_paths) > 0, 'Pass at least one argument'
+ _hook.include(include_paths)
+ _hook.exclude(exclude_paths)
+ # _hook.debug = debug
+ enable = sys.version_info[0] >= 3 # enabled for all 3.x
+ if enable and _hook not in sys.meta_path:
+ sys.meta_path.insert(0, _hook) # insert at beginning. This could be made a parameter
+
+ # We could return the hook when there are ways of configuring it
+ #return _hook
+
+
+def remove_hooks():
+ if _hook in sys.meta_path:
+ sys.meta_path.remove(_hook)
+
+
+def detect_hooks():
+ """
+ Returns True if the import hooks are installed, False if not.
+ """
+ return _hook in sys.meta_path
+ # present = any([hasattr(hook, 'PY2FIXER') for hook in sys.meta_path])
+ # return present
+
+
+class hooks(object):
+ """
+ Acts as a context manager. Use like this:
+
+ >>> from past import translation
+ >>> with translation.hooks():
+ ... import mypy2module
+ >>> import requests # py2/3 compatible anyway
+ >>> # etc.
+ """
+ def __enter__(self):
+ self.hooks_were_installed = detect_hooks()
+ install_hooks()
+ return self
+
+ def __exit__(self, *args):
+ if not self.hooks_were_installed:
+ remove_hooks()
+
+
+class suspend_hooks(object):
+ """
+ Acts as a context manager. Use like this:
+
+ >>> from past import translation
+ >>> translation.install_hooks()
+ >>> import http.client
+ >>> # ...
+ >>> with translation.suspend_hooks():
+ >>> import requests # or others that support Py2/3
+
+ If the hooks were disabled before the context, they are not installed when
+ the context is left.
+ """
+ def __enter__(self):
+ self.hooks_were_installed = detect_hooks()
+ remove_hooks()
+ return self
+ def __exit__(self, *args):
+ if self.hooks_were_installed:
+ install_hooks()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/types/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/types/__init__.py
new file mode 100644
index 0000000..a31b264
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/types/__init__.py
@@ -0,0 +1,30 @@
+"""
+Forward-ports of types from Python 2 for use with Python 3:
+
+- ``basestring``: equivalent to ``(str, bytes)`` in ``isinstance`` checks
+- ``dict``: with list-producing .keys() etc. methods
+- ``str``: bytes-like, but iterating over them doesn't product integers
+- ``long``: alias of Py3 int with ``L`` suffix in the ``repr``
+- ``unicode``: alias of Py3 str with ``u`` prefix in the ``repr``
+
+"""
+
+from past import utils
+
+if utils.PY2:
+ import __builtin__
+ basestring = __builtin__.basestring
+ dict = __builtin__.dict
+ str = __builtin__.str
+ long = __builtin__.long
+ unicode = __builtin__.unicode
+ __all__ = []
+else:
+ from .basestring import basestring
+ from .olddict import olddict
+ from .oldstr import oldstr
+ long = int
+ unicode = str
+ # from .unicode import unicode
+ __all__ = ['basestring', 'olddict', 'oldstr', 'long', 'unicode']
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/types/basestring.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/types/basestring.py
new file mode 100644
index 0000000..15437bf
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/types/basestring.py
@@ -0,0 +1,40 @@
+"""
+An implementation of the basestring type for Python 3
+
+Example use:
+
+>>> s = b'abc'
+>>> assert isinstance(s, basestring)
+>>> from past.types import str as oldstr
+>>> s2 = oldstr(b'abc')
+>>> assert isinstance(s2, basestring)
+
+"""
+
+import sys
+
+from past.utils import with_metaclass, PY2
+
+if PY2:
+ str = unicode
+
+ver = sys.version_info[:2]
+
+
+class BaseBaseString(type):
+ def __instancecheck__(cls, instance):
+ return isinstance(instance, (bytes, str))
+
+ def __subclasshook__(cls, thing):
+ # TODO: What should go here?
+ raise NotImplemented
+
+
+class basestring(with_metaclass(BaseBaseString)):
+ """
+ A minimal backport of the Python 2 basestring type to Py3
+ """
+
+
+__all__ = ['basestring']
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/types/olddict.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/types/olddict.py
new file mode 100644
index 0000000..b213e28
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/types/olddict.py
@@ -0,0 +1,97 @@
+"""
+A dict subclass for Python 3 that behaves like Python 2's dict
+
+Example use:
+
+>>> from past.builtins import dict
+>>> d1 = dict() # instead of {} for an empty dict
+>>> d2 = dict(key1='value1', key2='value2')
+
+The keys, values and items methods now return lists on Python 3.x and there are
+methods for iterkeys, itervalues, iteritems, and viewkeys etc.
+
+>>> for d in (d1, d2):
+... assert isinstance(d.keys(), list)
+... assert isinstance(d.values(), list)
+... assert isinstance(d.items(), list)
+"""
+
+import sys
+
+from past.utils import with_metaclass
+
+
+_builtin_dict = dict
+ver = sys.version_info[:2]
+
+
+class BaseOldDict(type):
+ def __instancecheck__(cls, instance):
+ return isinstance(instance, _builtin_dict)
+
+
+class olddict(with_metaclass(BaseOldDict, _builtin_dict)):
+ """
+ A backport of the Python 3 dict object to Py2
+ """
+ iterkeys = _builtin_dict.keys
+ viewkeys = _builtin_dict.keys
+
+ def keys(self):
+ return list(super(olddict, self).keys())
+
+ itervalues = _builtin_dict.values
+ viewvalues = _builtin_dict.values
+
+ def values(self):
+ return list(super(olddict, self).values())
+
+ iteritems = _builtin_dict.items
+ viewitems = _builtin_dict.items
+
+ def items(self):
+ return list(super(olddict, self).items())
+
+ def has_key(self, k):
+ """
+ D.has_key(k) -> True if D has a key k, else False
+ """
+ return k in self
+
+ # def __new__(cls, *args, **kwargs):
+ # """
+ # dict() -> new empty dictionary
+ # dict(mapping) -> new dictionary initialized from a mapping object's
+ # (key, value) pairs
+ # dict(iterable) -> new dictionary initialized as if via:
+ # d = {}
+ # for k, v in iterable:
+ # d[k] = v
+ # dict(**kwargs) -> new dictionary initialized with the name=value pairs
+ # in the keyword argument list. For example: dict(one=1, two=2)
+
+ # """
+ #
+ # if len(args) == 0:
+ # return super(olddict, cls).__new__(cls)
+ # # Was: elif isinstance(args[0], newbytes):
+ # # We use type() instead of the above because we're redefining
+ # # this to be True for all unicode string subclasses. Warning:
+ # # This may render newstr un-subclassable.
+ # elif type(args[0]) == olddict:
+ # return args[0]
+ # # elif isinstance(args[0], _builtin_dict):
+ # # value = args[0]
+ # else:
+ # value = args[0]
+ # return super(olddict, cls).__new__(cls, value)
+
+ def __native__(self):
+ """
+ Hook for the past.utils.native() function
+ """
+ return super(oldbytes, self)
+
+
+__all__ = ['olddict']
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/types/oldstr.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/types/oldstr.py
new file mode 100644
index 0000000..1b90e3e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/types/oldstr.py
@@ -0,0 +1,132 @@
+"""
+Pure-Python implementation of a Python 2-like str object for Python 3.
+"""
+
+from collections import Iterable
+from numbers import Integral
+
+from past.utils import PY2, with_metaclass
+
+
+_builtin_bytes = bytes
+
+
+class BaseOldStr(type):
+ def __instancecheck__(cls, instance):
+ return isinstance(instance, _builtin_bytes)
+
+
+def unescape(s):
+ """
+ Interprets strings with escape sequences
+
+ Example:
+ >>> s = unescape(r'abc\\def') # i.e. 'abc\\\\def'
+ >>> print(s)
+ 'abc\def'
+ >>> s2 = unescape('abc\\ndef')
+ >>> len(s2)
+ 8
+ >>> print(s2)
+ abc
+ def
+ """
+ return s.encode().decode('unicode_escape')
+
+
+class oldstr(with_metaclass(BaseOldStr, _builtin_bytes)):
+ """
+ A forward port of the Python 2 8-bit string object to Py3
+ """
+ # Python 2 strings have no __iter__ method:
+ @property
+ def __iter__(self):
+ raise AttributeError
+
+ def __dir__(self):
+ return [thing for thing in dir(_builtin_bytes) if thing != '__iter__']
+
+ # def __new__(cls, *args, **kwargs):
+ # """
+ # From the Py3 bytes docstring:
+
+ # bytes(iterable_of_ints) -> bytes
+ # bytes(string, encoding[, errors]) -> bytes
+ # bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer
+ # bytes(int) -> bytes object of size given by the parameter initialized with null bytes
+ # bytes() -> empty bytes object
+ #
+ # Construct an immutable array of bytes from:
+ # - an iterable yielding integers in range(256)
+ # - a text string encoded using the specified encoding
+ # - any object implementing the buffer API.
+ # - an integer
+ # """
+ #
+ # if len(args) == 0:
+ # return super(newbytes, cls).__new__(cls)
+ # # Was: elif isinstance(args[0], newbytes):
+ # # We use type() instead of the above because we're redefining
+ # # this to be True for all unicode string subclasses. Warning:
+ # # This may render newstr un-subclassable.
+ # elif type(args[0]) == newbytes:
+ # return args[0]
+ # elif isinstance(args[0], _builtin_bytes):
+ # value = args[0]
+ # elif isinstance(args[0], unicode):
+ # if 'encoding' not in kwargs:
+ # raise TypeError('unicode string argument without an encoding')
+ # ###
+ # # Was: value = args[0].encode(**kwargs)
+ # # Python 2.6 string encode() method doesn't take kwargs:
+ # # Use this instead:
+ # newargs = [kwargs['encoding']]
+ # if 'errors' in kwargs:
+ # newargs.append(kwargs['errors'])
+ # value = args[0].encode(*newargs)
+ # ###
+ # elif isinstance(args[0], Iterable):
+ # if len(args[0]) == 0:
+ # # What is this?
+ # raise ValueError('unknown argument type')
+ # elif len(args[0]) > 0 and isinstance(args[0][0], Integral):
+ # # It's a list of integers
+ # value = b''.join([chr(x) for x in args[0]])
+ # else:
+ # raise ValueError('item cannot be interpreted as an integer')
+ # elif isinstance(args[0], Integral):
+ # if args[0] < 0:
+ # raise ValueError('negative count')
+ # value = b'\x00' * args[0]
+ # else:
+ # value = args[0]
+ # return super(newbytes, cls).__new__(cls, value)
+
+ def __repr__(self):
+ s = super(oldstr, self).__repr__() # e.g. b'abc' on Py3, b'abc' on Py3
+ return s[1:]
+
+ def __str__(self):
+ s = super(oldstr, self).__str__() # e.g. "b'abc'" or "b'abc\\ndef'
+ # TODO: fix this:
+ assert s[:2] == "b'" and s[-1] == "'"
+ return unescape(s[2:-1]) # e.g. 'abc' or 'abc\ndef'
+
+ def __getitem__(self, y):
+ if isinstance(y, Integral):
+ return super(oldstr, self).__getitem__(slice(y, y+1))
+ else:
+ return super(oldstr, self).__getitem__(y)
+
+ def __getslice__(self, *args):
+ return self.__getitem__(slice(*args))
+
+ def __contains__(self, key):
+ if isinstance(key, int):
+ return False
+
+ def __native__(self):
+ return bytes(self)
+
+
+__all__ = ['oldstr']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/utils/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/utils/__init__.py
new file mode 100644
index 0000000..02f06d5
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/future/py2_3/past/utils/__init__.py
@@ -0,0 +1,97 @@
+"""
+Various non-built-in utility functions and definitions for Py2
+compatibility in Py3.
+
+For example:
+
+ >>> # The old_div() function behaves like Python 2's / operator
+ >>> # without "from __future__ import division"
+ >>> from past.utils import old_div
+ >>> old_div(3, 2) # like 3/2 in Py2
+ 0
+ >>> old_div(3, 2.0) # like 3/2.0 in Py2
+ 1.5
+"""
+
+import sys
+import numbers
+
+PY3 = sys.version_info[0] == 3
+PY2 = sys.version_info[0] == 2
+PYPY = hasattr(sys, 'pypy_translation_info')
+
+
+def with_metaclass(meta, *bases):
+ """
+ Function from jinja2/_compat.py. License: BSD.
+
+ Use it like this::
+
+ class BaseForm(object):
+ pass
+
+ class FormType(type):
+ pass
+
+ class Form(with_metaclass(FormType, BaseForm)):
+ pass
+
+ This requires a bit of explanation: the basic idea is to make a
+ dummy metaclass for one level of class instantiation that replaces
+ itself with the actual metaclass. Because of internal type checks
+ we also need to make sure that we downgrade the custom metaclass
+ for one level to something closer to type (that's why __call__ and
+ __init__ comes back from type etc.).
+
+ This has the advantage over six.with_metaclass of not introducing
+ dummy classes into the final MRO.
+ """
+ class metaclass(meta):
+ __call__ = type.__call__
+ __init__ = type.__init__
+ def __new__(cls, name, this_bases, d):
+ if this_bases is None:
+ return type.__new__(cls, name, (), d)
+ return meta(name, bases, d)
+ return metaclass('temporary_class', None, {})
+
+
+def native(obj):
+ """
+ On Py2, this is a no-op: native(obj) -> obj
+
+ On Py3, returns the corresponding native Py3 types that are
+ superclasses for forward-ported objects from Py2:
+
+ >>> from past.builtins import str, dict
+
+ >>> native(str(b'ABC')) # Output on Py3 follows. On Py2, output is 'ABC'
+ b'ABC'
+ >>> type(native(str(b'ABC')))
+ bytes
+
+ Existing native types on Py3 will be returned unchanged:
+
+ >>> type(native(b'ABC'))
+ bytes
+ """
+ if hasattr(obj, '__native__'):
+ return obj.__native__()
+ else:
+ return obj
+
+
+# An alias for future.utils.old_div():
+def old_div(a, b):
+ """
+ Equivalent to ``a / b`` on Python 2 without ``from __future__ import
+ division``.
+
+ TODO: generalize this to other objects (like arrays etc.)
+ """
+ if isinstance(a, numbers.Integral) and isinstance(b, numbers.Integral):
+ return a // b
+ else:
+ return a / b
+
+__all__ = ['PY3', 'PY2', 'PYPY', 'with_metaclass', 'native', 'old_div']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/png.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/png.py
new file mode 100644
index 0000000..d21416d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/extlibs/png.py
@@ -0,0 +1,2788 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+# Retrieved from https://github.com/drj11/pypng
+# Revision: 1739028ef55c93ad41312a1d3b9133a720479094
+#
+# Pyglet Changelog
+# ----------------
+# * Removed shebang
+# * Added Pyglet license
+
+# png.py - PNG encoder/decoder in pure Python
+#
+# Copyright (C) 2006 Johann C. Rocholl
+# Portions Copyright (C) 2009 David Jones
+# And probably portions Copyright (C) 2006 Nicko van Someren
+#
+# Original concept by Johann C. Rocholl.
+#
+# LICENCE (MIT)
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation files
+# (the "Software"), to deal in the Software without restriction,
+# including without limitation the rights to use, copy, modify, merge,
+# publish, distribute, sublicense, and/or sell copies of the Software,
+# and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+"""
+Pure Python PNG Reader/Writer
+
+This Python module implements support for PNG images (see PNG
+specification at http://www.w3.org/TR/2003/REC-PNG-20031110/ ). It reads
+and writes PNG files with all allowable bit depths
+(1/2/4/8/16/24/32/48/64 bits per pixel) and colour combinations:
+greyscale (1/2/4/8/16 bit); RGB, RGBA, LA (greyscale with alpha) with
+8/16 bits per channel; colour mapped images (1/2/4/8 bit).
+Adam7 interlacing is supported for reading and
+writing. A number of optional chunks can be specified (when writing)
+and understood (when reading): ``tRNS``, ``bKGD``, ``gAMA``.
+
+For help, type ``import png; help(png)`` in your python interpreter.
+
+A good place to start is the :class:`Reader` and :class:`Writer`
+classes.
+
+Requires Python 2.3. Limited support is available for Python 2.2, but
+not everything works. Best with Python 2.4 and higher. Installation is
+trivial, but see the ``README.txt`` file (with the source distribution)
+for details.
+
+This file can also be used as a command-line utility to convert
+`Netpbm `_ PNM files to PNG, and the
+reverse conversion from PNG to PNM. The interface is similar to that
+of the ``pnmtopng`` program from Netpbm. Type ``python png.py --help``
+at the shell prompt for usage and a list of options.
+
+A note on spelling and terminology
+----------------------------------
+
+Generally British English spelling is used in the documentation. So
+that's "greyscale" and "colour". This not only matches the author's
+native language, it's also used by the PNG specification.
+
+The major colour models supported by PNG (and hence by PyPNG) are:
+greyscale, RGB, greyscale--alpha, RGB--alpha. These are sometimes
+referred to using the abbreviations: L, RGB, LA, RGBA. In this case
+each letter abbreviates a single channel: *L* is for Luminance or Luma
+or Lightness which is the channel used in greyscale images; *R*, *G*,
+*B* stand for Red, Green, Blue, the components of a colour image; *A*
+stands for Alpha, the opacity channel (used for transparency effects,
+but higher values are more opaque, so it makes sense to call it
+opacity).
+
+A note on formats
+-----------------
+
+When getting pixel data out of this module (reading) and presenting
+data to this module (writing) there are a number of ways the data could
+be represented as a Python value. Generally this module uses one of
+three formats called "flat row flat pixel", "boxed row flat pixel", and
+"boxed row boxed pixel". Basically the concern is whether each pixel
+and each row comes in its own little tuple (box), or not.
+
+Consider an image that is 3 pixels wide by 2 pixels high, and each pixel
+has RGB components:
+
+Boxed row flat pixel::
+
+ list([R,G,B, R,G,B, R,G,B],
+ [R,G,B, R,G,B, R,G,B])
+
+Each row appears as its own list, but the pixels are flattened so
+that three values for one pixel simply follow the three values for
+the previous pixel. This is the most common format used, because it
+provides a good compromise between space and convenience. PyPNG regards
+itself as at liberty to replace any sequence type with any sufficiently
+compatible other sequence type; in practice each row is an array (from
+the array module), and the outer list is sometimes an iterator rather
+than an explicit list (so that streaming is possible).
+
+Flat row flat pixel::
+
+ [R,G,B, R,G,B, R,G,B,
+ R,G,B, R,G,B, R,G,B]
+
+The entire image is one single giant sequence of colour values.
+Generally an array will be used (to save space), not a list.
+
+Boxed row boxed pixel::
+
+ list([ (R,G,B), (R,G,B), (R,G,B) ],
+ [ (R,G,B), (R,G,B), (R,G,B) ])
+
+Each row appears in its own list, but each pixel also appears in its own
+tuple. A serious memory burn in Python.
+
+In all cases the top row comes first, and for each row the pixels are
+ordered from left-to-right. Within a pixel the values appear in the
+order, R-G-B-A (or L-A for greyscale--alpha).
+
+There is a fourth format, mentioned because it is used internally,
+is close to what lies inside a PNG file itself, and has some support
+from the public API. This format is called packed. When packed,
+each row is a sequence of bytes (integers from 0 to 255), just as
+it is before PNG scanline filtering is applied. When the bit depth
+is 8 this is essentially the same as boxed row flat pixel; when the
+bit depth is less than 8, several pixels are packed into each byte;
+when the bit depth is 16 (the only value more than 8 that is supported
+by the PNG image format) each pixel value is decomposed into 2 bytes
+(and `packed` is a misnomer). This format is used by the
+:meth:`Writer.write_packed` method. It isn't usually a convenient
+format, but may be just right if the source data for the PNG image
+comes from something that uses a similar format (for example, 1-bit
+BMPs, or another PNG file).
+
+And now, my famous members
+--------------------------
+"""
+
+# http://www.python.org/doc/2.2.3/whatsnew/node5.html
+from __future__ import generators
+from __future__ import division
+from __future__ import print_function
+from builtins import str
+from builtins import zip
+from builtins import map
+from builtins import range
+from builtins import object
+from functools import reduce
+from io import open
+
+__version__ = "0.0.17"
+
+from array import array
+try: # See :pyver:old
+ import itertools
+except ImportError:
+ pass
+import math
+# http://www.python.org/doc/2.4.4/lib/module-operator.html
+import operator
+import struct
+import sys
+import zlib
+# http://www.python.org/doc/2.4.4/lib/module-warnings.html
+import warnings
+try:
+ # `cpngfilters` is a Cython module: it must be compiled by
+ # Cython for this import to work.
+ # If this import does work, then it overrides pure-python
+ # filtering functions defined later in this file (see `class
+ # pngfilters`).
+ import cpngfilters as pngfilters
+except ImportError:
+ pass
+
+
+__all__ = ['Image', 'Reader', 'Writer', 'write_chunks', 'from_array']
+
+
+# The PNG signature.
+# http://www.w3.org/TR/PNG/#5PNG-file-signature
+_signature = struct.pack('8B', 137, 80, 78, 71, 13, 10, 26, 10)
+
+_adam7 = ((0, 0, 8, 8),
+ (4, 0, 8, 8),
+ (0, 4, 4, 8),
+ (2, 0, 4, 4),
+ (0, 2, 2, 4),
+ (1, 0, 2, 2),
+ (0, 1, 1, 2))
+
+def group(s, n):
+ # See http://www.python.org/doc/2.6/library/functions.html#zip
+ return list(zip(*[iter(s)]*n))
+
+def isarray(x):
+ """Same as ``isinstance(x, array)`` except on Python 2.2, where it
+ always returns ``False``. This helps PyPNG work on Python 2.2.
+ """
+
+ try:
+ return isinstance(x, array)
+ except TypeError:
+ # Because on Python 2.2 array.array is not a type.
+ return False
+
+try:
+ array.tobytes
+except AttributeError:
+ try: # see :pyver:old
+ array.tostring
+ except AttributeError:
+ def tostring(row):
+ l = len(row)
+ return struct.pack('%dB' % l, *row)
+ else:
+ def tostring(row):
+ """Convert row of bytes to string. Expects `row` to be an
+ ``array``.
+ """
+ return row.tostring()
+else:
+ def tostring(row):
+ """ Python3 definition, array.tostring() is deprecated in Python3
+ """
+ return row.tobytes()
+
+
+def interleave_planes(ipixels, apixels, ipsize, apsize):
+ """
+ Interleave (colour) planes, e.g. RGB + A = RGBA.
+
+ Return an array of pixels consisting of the `ipsize` elements of
+ data from each pixel in `ipixels` followed by the `apsize` elements
+ of data from each pixel in `apixels`. Conventionally `ipixels`
+ and `apixels` are byte arrays so the sizes are bytes, but it
+ actually works with any arrays of the same type. The returned
+ array is the same type as the input arrays which should be the
+ same type as each other.
+ """
+
+ itotal = len(ipixels)
+ atotal = len(apixels)
+ newtotal = itotal + atotal
+ newpsize = ipsize + apsize
+ # Set up the output buffer
+ # See http://www.python.org/doc/2.4.4/lib/module-array.html#l2h-1356
+ out = array(ipixels.typecode)
+ # It's annoying that there is no cheap way to set the array size :-(
+ out.extend(ipixels)
+ out.extend(apixels)
+ # Interleave in the pixel data
+ for i in range(ipsize):
+ out[i:newtotal:newpsize] = ipixels[i:itotal:ipsize]
+ for i in range(apsize):
+ out[i+ipsize:newtotal:newpsize] = apixels[i:atotal:apsize]
+ return out
+
+def check_palette(palette):
+ """Check a palette argument (to the :class:`Writer` class)
+ for validity. Returns the palette as a list if okay; raises an
+ exception otherwise.
+ """
+
+ # None is the default and is allowed.
+ if palette is None:
+ return None
+
+ p = list(palette)
+ if not (0 < len(p) <= 256):
+ raise ValueError("a palette must have between 1 and 256 entries")
+ seen_triple = False
+ for i,t in enumerate(p):
+ if len(t) not in (3,4):
+ raise ValueError(
+ "palette entry %d: entries must be 3- or 4-tuples." % i)
+ if len(t) == 3:
+ seen_triple = True
+ if seen_triple and len(t) == 4:
+ raise ValueError(
+ "palette entry %d: all 4-tuples must precede all 3-tuples" % i)
+ for x in t:
+ if int(x) != x or not(0 <= x <= 255):
+ raise ValueError(
+ "palette entry %d: values must be integer: 0 <= x <= 255" % i)
+ return p
+
+def check_sizes(size, width, height):
+ """Check that these arguments, in supplied, are consistent.
+ Return a (width, height) pair.
+ """
+
+ if not size:
+ return width, height
+
+ if len(size) != 2:
+ raise ValueError(
+ "size argument should be a pair (width, height)")
+ if width is not None and width != size[0]:
+ raise ValueError(
+ "size[0] (%r) and width (%r) should match when both are used."
+ % (size[0], width))
+ if height is not None and height != size[1]:
+ raise ValueError(
+ "size[1] (%r) and height (%r) should match when both are used."
+ % (size[1], height))
+ return size
+
+def check_color(c, greyscale, which):
+ """Checks that a colour argument for transparent or
+ background options is the right form. Returns the colour
+ (which, if it's a bar integer, is "corrected" to a 1-tuple).
+ """
+
+ if c is None:
+ return c
+ if greyscale:
+ try:
+ l = len(c)
+ except TypeError:
+ c = (c,)
+ if len(c) != 1:
+ raise ValueError("%s for greyscale must be 1-tuple" %
+ which)
+ if not isinteger(c[0]):
+ raise ValueError(
+ "%s colour for greyscale must be integer" % which)
+ else:
+ if not (len(c) == 3 and
+ isinteger(c[0]) and
+ isinteger(c[1]) and
+ isinteger(c[2])):
+ raise ValueError(
+ "%s colour must be a triple of integers" % which)
+ return c
+
+class Error(Exception):
+ def __str__(self):
+ return self.__class__.__name__ + ': ' + ' '.join(self.args)
+
+class FormatError(Error):
+ """Problem with input file format. In other words, PNG file does
+ not conform to the specification in some way and is invalid.
+ """
+
+class ChunkError(FormatError):
+ pass
+
+
+class Writer(object):
+ """
+ PNG encoder in pure Python.
+ """
+
+ def __init__(self, width=None, height=None,
+ size=None,
+ greyscale=False,
+ alpha=False,
+ bitdepth=8,
+ palette=None,
+ transparent=None,
+ background=None,
+ gamma=None,
+ compression=None,
+ interlace=False,
+ bytes_per_sample=None, # deprecated
+ planes=None,
+ colormap=None,
+ maxval=None,
+ chunk_limit=2**20):
+ """
+ Create a PNG encoder object.
+
+ Arguments:
+
+ width, height
+ Image size in pixels, as two separate arguments.
+ size
+ Image size (w,h) in pixels, as single argument.
+ greyscale
+ Input data is greyscale, not RGB.
+ alpha
+ Input data has alpha channel (RGBA or LA).
+ bitdepth
+ Bit depth: from 1 to 16.
+ palette
+ Create a palette for a colour mapped image (colour type 3).
+ transparent
+ Specify a transparent colour (create a ``tRNS`` chunk).
+ background
+ Specify a default background colour (create a ``bKGD`` chunk).
+ gamma
+ Specify a gamma value (create a ``gAMA`` chunk).
+ compression
+ zlib compression level: 0 (none) to 9 (more compressed);
+ default: -1 or None.
+ interlace
+ Create an interlaced image.
+ chunk_limit
+ Write multiple ``IDAT`` chunks to save memory.
+
+ The image size (in pixels) can be specified either by using the
+ `width` and `height` arguments, or with the single `size`
+ argument. If `size` is used it should be a pair (*width*,
+ *height*).
+
+ `greyscale` and `alpha` are booleans that specify whether
+ an image is greyscale (or colour), and whether it has an
+ alpha channel (or not).
+
+ `bitdepth` specifies the bit depth of the source pixel values.
+ Each source pixel value must be an integer between 0 and
+ ``2**bitdepth-1``. For example, 8-bit images have values
+ between 0 and 255. PNG only stores images with bit depths of
+ 1,2,4,8, or 16. When `bitdepth` is not one of these values,
+ the next highest valid bit depth is selected, and an ``sBIT``
+ (significant bits) chunk is generated that specifies the
+ original precision of the source image. In this case the
+ supplied pixel values will be rescaled to fit the range of
+ the selected bit depth.
+
+ The details of which bit depth / colour model combinations the
+ PNG file format supports directly, are somewhat arcane
+ (refer to the PNG specification for full details). Briefly:
+ "small" bit depths (1,2,4) are only allowed with greyscale and
+ colour mapped images; colour mapped images cannot have bit depth
+ 16.
+
+ For colour mapped images (in other words, when the `palette`
+ argument is specified) the `bitdepth` argument must match one of
+ the valid PNG bit depths: 1, 2, 4, or 8. (It is valid to have a
+ PNG image with a palette and an ``sBIT`` chunk, but the meaning
+ is slightly different; it would be awkward to press the
+ `bitdepth` argument into service for this.)
+
+ The `palette` option, when specified, causes a colour mapped
+ image to be created: the PNG colour type is set to 3; greyscale
+ must not be set; alpha must not be set; transparent must not be
+ set; the bit depth must be 1,2,4, or 8. When a colour mapped
+ image is created, the pixel values are palette indexes and
+ the `bitdepth` argument specifies the size of these indexes
+ (not the size of the colour values in the palette).
+
+ The palette argument value should be a sequence of 3- or
+ 4-tuples. 3-tuples specify RGB palette entries; 4-tuples
+ specify RGBA palette entries. If both 4-tuples and 3-tuples
+ appear in the sequence then all the 4-tuples must come
+ before all the 3-tuples. A ``PLTE`` chunk is created; if there
+ are 4-tuples then a ``tRNS`` chunk is created as well. The
+ ``PLTE`` chunk will contain all the RGB triples in the same
+ sequence; the ``tRNS`` chunk will contain the alpha channel for
+ all the 4-tuples, in the same sequence. Palette entries
+ are always 8-bit.
+
+ If specified, the `transparent` and `background` parameters must
+ be a tuple with three integer values for red, green, blue, or
+ a simple integer (or singleton tuple) for a greyscale image.
+
+ If specified, the `gamma` parameter must be a positive number
+ (generally, a float). A ``gAMA`` chunk will be created.
+ Note that this will not change the values of the pixels as
+ they appear in the PNG file, they are assumed to have already
+ been converted appropriately for the gamma specified.
+
+ The `compression` argument specifies the compression level to
+ be used by the ``zlib`` module. Values from 1 to 9 specify
+ compression, with 9 being "more compressed" (usually smaller
+ and slower, but it doesn't always work out that way). 0 means
+ no compression. -1 and ``None`` both mean that the default
+ level of compession will be picked by the ``zlib`` module
+ (which is generally acceptable).
+
+ If `interlace` is true then an interlaced image is created
+ (using PNG's so far only interace method, *Adam7*). This does
+ not affect how the pixels should be presented to the encoder,
+ rather it changes how they are arranged into the PNG file.
+ On slow connexions interlaced images can be partially decoded
+ by the browser to give a rough view of the image that is
+ successively refined as more image data appears.
+
+ .. note ::
+
+ Enabling the `interlace` option requires the entire image
+ to be processed in working memory.
+
+ `chunk_limit` is used to limit the amount of memory used whilst
+ compressing the image. In order to avoid using large amounts of
+ memory, multiple ``IDAT`` chunks may be created.
+ """
+
+ # At the moment the `planes` argument is ignored;
+ # its purpose is to act as a dummy so that
+ # ``Writer(x, y, **info)`` works, where `info` is a dictionary
+ # returned by Reader.read and friends.
+ # Ditto for `colormap`.
+
+ width, height = check_sizes(size, width, height)
+ del size
+
+ if width <= 0 or height <= 0:
+ raise ValueError("width and height must be greater than zero")
+ if not isinteger(width) or not isinteger(height):
+ raise ValueError("width and height must be integers")
+ # http://www.w3.org/TR/PNG/#7Integers-and-byte-order
+ if width > 2**32-1 or height > 2**32-1:
+ raise ValueError("width and height cannot exceed 2**32-1")
+
+ if alpha and transparent is not None:
+ raise ValueError(
+ "transparent colour not allowed with alpha channel")
+
+ if bytes_per_sample is not None:
+ warnings.warn('please use bitdepth instead of bytes_per_sample',
+ DeprecationWarning)
+ if bytes_per_sample not in (0.125, 0.25, 0.5, 1, 2):
+ raise ValueError(
+ "bytes per sample must be .125, .25, .5, 1, or 2")
+ bitdepth = int(8*bytes_per_sample)
+ del bytes_per_sample
+ if not isinteger(bitdepth) or bitdepth < 1 or 16 < bitdepth:
+ raise ValueError("bitdepth (%r) must be a positive integer <= 16" %
+ bitdepth)
+
+ self.rescale = None
+ if palette:
+ if bitdepth not in (1,2,4,8):
+ raise ValueError("with palette, bitdepth must be 1, 2, 4, or 8")
+ if transparent is not None:
+ raise ValueError("transparent and palette not compatible")
+ if alpha:
+ raise ValueError("alpha and palette not compatible")
+ if greyscale:
+ raise ValueError("greyscale and palette not compatible")
+ else:
+ # No palette, check for sBIT chunk generation.
+ if alpha or not greyscale:
+ if bitdepth not in (8,16):
+ targetbitdepth = (8,16)[bitdepth > 8]
+ self.rescale = (bitdepth, targetbitdepth)
+ bitdepth = targetbitdepth
+ del targetbitdepth
+ else:
+ assert greyscale
+ assert not alpha
+ if bitdepth not in (1,2,4,8,16):
+ if bitdepth > 8:
+ targetbitdepth = 16
+ elif bitdepth == 3:
+ targetbitdepth = 4
+ else:
+ assert bitdepth in (5,6,7)
+ targetbitdepth = 8
+ self.rescale = (bitdepth, targetbitdepth)
+ bitdepth = targetbitdepth
+ del targetbitdepth
+
+ if bitdepth < 8 and (alpha or not greyscale and not palette):
+ raise ValueError(
+ "bitdepth < 8 only permitted with greyscale or palette")
+ if bitdepth > 8 and palette:
+ raise ValueError(
+ "bit depth must be 8 or less for images with palette")
+
+ transparent = check_color(transparent, greyscale, 'transparent')
+ background = check_color(background, greyscale, 'background')
+
+ # It's important that the true boolean values (greyscale, alpha,
+ # colormap, interlace) are converted to bool because Iverson's
+ # convention is relied upon later on.
+ self.width = width
+ self.height = height
+ self.transparent = transparent
+ self.background = background
+ self.gamma = gamma
+ self.greyscale = bool(greyscale)
+ self.alpha = bool(alpha)
+ self.colormap = bool(palette)
+ self.bitdepth = int(bitdepth)
+ self.compression = compression
+ self.chunk_limit = chunk_limit
+ self.interlace = bool(interlace)
+ self.palette = check_palette(palette)
+
+ self.color_type = 4*self.alpha + 2*(not greyscale) + 1*self.colormap
+ assert self.color_type in (0,2,3,4,6)
+
+ self.color_planes = (3,1)[self.greyscale or self.colormap]
+ self.planes = self.color_planes + self.alpha
+ # :todo: fix for bitdepth < 8
+ self.psize = (self.bitdepth//8) * self.planes
+
+ def make_palette(self):
+ """Create the byte sequences for a ``PLTE`` and if necessary a
+ ``tRNS`` chunk. Returned as a pair (*p*, *t*). *t* will be
+ ``None`` if no ``tRNS`` chunk is necessary.
+ """
+
+ p = array('B')
+ t = array('B')
+
+ for x in self.palette:
+ p.extend(x[0:3])
+ if len(x) > 3:
+ t.append(x[3])
+ p = tostring(p)
+ t = tostring(t)
+ if t:
+ return p,t
+ return p,None
+
+ def write(self, outfile, rows):
+ """Write a PNG image to the output file. `rows` should be
+ an iterable that yields each row in boxed row flat pixel
+ format. The rows should be the rows of the original image,
+ so there should be ``self.height`` rows of ``self.width *
+ self.planes`` values. If `interlace` is specified (when
+ creating the instance), then an interlaced PNG file will
+ be written. Supply the rows in the normal image order;
+ the interlacing is carried out internally.
+
+ .. note ::
+
+ Interlacing will require the entire image to be in working
+ memory.
+ """
+
+ if self.interlace:
+ fmt = 'BH'[self.bitdepth > 8]
+ a = array(fmt, itertools.chain(*rows))
+ return self.write_array(outfile, a)
+
+ nrows = self.write_passes(outfile, rows)
+ if nrows != self.height:
+ raise ValueError(
+ "rows supplied (%d) does not match height (%d)" %
+ (nrows, self.height))
+
+ def write_passes(self, outfile, rows, packed=False):
+ """
+ Write a PNG image to the output file.
+
+ Most users are expected to find the :meth:`write` or
+ :meth:`write_array` method more convenient.
+
+ The rows should be given to this method in the order that
+ they appear in the output file. For straightlaced images,
+ this is the usual top to bottom ordering, but for interlaced
+ images the rows should have already been interlaced before
+ passing them to this function.
+
+ `rows` should be an iterable that yields each row. When
+ `packed` is ``False`` the rows should be in boxed row flat pixel
+ format; when `packed` is ``True`` each row should be a packed
+ sequence of bytes.
+ """
+
+ # http://www.w3.org/TR/PNG/#5PNG-file-signature
+ outfile.write(_signature)
+
+ # http://www.w3.org/TR/PNG/#11IHDR
+ write_chunk(outfile, b'IHDR',
+ struct.pack("!2I5B", self.width, self.height,
+ self.bitdepth, self.color_type,
+ 0, 0, self.interlace))
+
+ # See :chunk:order
+ # http://www.w3.org/TR/PNG/#11gAMA
+ if self.gamma is not None:
+ write_chunk(outfile, b'gAMA',
+ struct.pack("!L", int(round(self.gamma*1e5))))
+
+ # See :chunk:order
+ # http://www.w3.org/TR/PNG/#11sBIT
+ if self.rescale:
+ write_chunk(outfile, b'sBIT',
+ struct.pack('%dB' % self.planes,
+ *[self.rescale[0]]*self.planes))
+
+ # :chunk:order: Without a palette (PLTE chunk), ordering is
+ # relatively relaxed. With one, gAMA chunk must precede PLTE
+ # chunk which must precede tRNS and bKGD.
+ # See http://www.w3.org/TR/PNG/#5ChunkOrdering
+ if self.palette:
+ p,t = self.make_palette()
+ write_chunk(outfile, b'PLTE', p)
+ if t:
+ # tRNS chunk is optional. Only needed if palette entries
+ # have alpha.
+ write_chunk(outfile, b'tRNS', t)
+
+ # http://www.w3.org/TR/PNG/#11tRNS
+ if self.transparent is not None:
+ if self.greyscale:
+ write_chunk(outfile, b'tRNS',
+ struct.pack("!1H", *self.transparent))
+ else:
+ write_chunk(outfile, b'tRNS',
+ struct.pack("!3H", *self.transparent))
+
+ # http://www.w3.org/TR/PNG/#11bKGD
+ if self.background is not None:
+ if self.greyscale:
+ write_chunk(outfile, b'bKGD',
+ struct.pack("!1H", *self.background))
+ else:
+ write_chunk(outfile, b'bKGD',
+ struct.pack("!3H", *self.background))
+
+ # http://www.w3.org/TR/PNG/#11IDAT
+ if self.compression is not None:
+ compressor = zlib.compressobj(self.compression)
+ else:
+ compressor = zlib.compressobj()
+
+ # Choose an extend function based on the bitdepth. The extend
+ # function packs/decomposes the pixel values into bytes and
+ # stuffs them onto the data array.
+ data = array('B')
+ if self.bitdepth == 8 or packed:
+ extend = data.extend
+ elif self.bitdepth == 16:
+ # Decompose into bytes
+ def extend(sl):
+ fmt = '!%dH' % len(sl)
+ data.extend(array('B', struct.pack(fmt, *sl)))
+ else:
+ # Pack into bytes
+ assert self.bitdepth < 8
+ # samples per byte
+ spb = int(8//self.bitdepth)
+ def extend(sl):
+ a = array('B', sl)
+ # Adding padding bytes so we can group into a whole
+ # number of spb-tuples.
+ l = float(len(a))
+ extra = math.ceil(l / float(spb))*spb - l
+ a.extend([0]*int(extra))
+ # Pack into bytes
+ l = group(a, spb)
+ l = [reduce(lambda x,y:
+ (x << self.bitdepth) + y, e) for e in l]
+ data.extend(l)
+ if self.rescale:
+ oldextend = extend
+ factor = \
+ float(2**self.rescale[1]-1) / float(2**self.rescale[0]-1)
+ def extend(sl):
+ oldextend([int(round(factor*x)) for x in sl])
+
+ # Build the first row, testing mostly to see if we need to
+ # changed the extend function to cope with NumPy integer types
+ # (they cause our ordinary definition of extend to fail, so we
+ # wrap it). See
+ # http://code.google.com/p/pypng/issues/detail?id=44
+ enumrows = enumerate(rows)
+ del rows
+
+ # First row's filter type.
+ data.append(0)
+ # :todo: Certain exceptions in the call to ``.next()`` or the
+ # following try would indicate no row data supplied.
+ # Should catch.
+ i,row = next(enumrows)
+ try:
+ # If this fails...
+ extend(row)
+ except:
+ # ... try a version that converts the values to int first.
+ # Not only does this work for the (slightly broken) NumPy
+ # types, there are probably lots of other, unknown, "nearly"
+ # int types it works for.
+ def wrapmapint(f):
+ return lambda sl: f(list(map(int, sl)))
+ extend = wrapmapint(extend)
+ del wrapmapint
+ extend(row)
+
+ for i,row in enumrows:
+ # Add "None" filter type. Currently, it's essential that
+ # this filter type be used for every scanline as we do not
+ # mark the first row of a reduced pass image; that means we
+ # could accidentally compute the wrong filtered scanline if
+ # we used "up", "average", or "paeth" on such a line.
+ data.append(0)
+ extend(row)
+ if len(data) > self.chunk_limit:
+ compressed = compressor.compress(tostring(data))
+ if len(compressed):
+ write_chunk(outfile, b'IDAT', compressed)
+ # Because of our very witty definition of ``extend``,
+ # above, we must re-use the same ``data`` object. Hence
+ # we use ``del`` to empty this one, rather than create a
+ # fresh one (which would be my natural FP instinct).
+ del data[:]
+ if len(data):
+ compressed = compressor.compress(tostring(data))
+ else:
+ compressed = b''
+ flushed = compressor.flush()
+ if len(compressed) or len(flushed):
+ write_chunk(outfile, b'IDAT', compressed + flushed)
+ # http://www.w3.org/TR/PNG/#11IEND
+ write_chunk(outfile, b'IEND')
+ return i+1
+
+ def write_array(self, outfile, pixels):
+ """
+ Write an array in flat row flat pixel format as a PNG file on
+ the output file. See also :meth:`write` method.
+ """
+
+ if self.interlace:
+ self.write_passes(outfile, self.array_scanlines_interlace(pixels))
+ else:
+ self.write_passes(outfile, self.array_scanlines(pixels))
+
+ def write_packed(self, outfile, rows):
+ """
+ Write PNG file to `outfile`. The pixel data comes from `rows`
+ which should be in boxed row packed format. Each row should be
+ a sequence of packed bytes.
+
+ Technically, this method does work for interlaced images but it
+ is best avoided. For interlaced images, the rows should be
+ presented in the order that they appear in the file.
+
+ This method should not be used when the source image bit depth
+ is not one naturally supported by PNG; the bit depth should be
+ 1, 2, 4, 8, or 16.
+ """
+
+ if self.rescale:
+ raise Error("write_packed method not suitable for bit depth %d" %
+ self.rescale[0])
+ return self.write_passes(outfile, rows, packed=True)
+
+ def convert_pnm(self, infile, outfile):
+ """
+ Convert a PNM file containing raw pixel data into a PNG file
+ with the parameters set in the writer object. Works for
+ (binary) PGM, PPM, and PAM formats.
+ """
+
+ if self.interlace:
+ pixels = array('B')
+ pixels.fromfile(infile,
+ (self.bitdepth//8) * self.color_planes *
+ self.width * self.height)
+ self.write_passes(outfile, self.array_scanlines_interlace(pixels))
+ else:
+ self.write_passes(outfile, self.file_scanlines(infile))
+
+ def convert_ppm_and_pgm(self, ppmfile, pgmfile, outfile):
+ """
+ Convert a PPM and PGM file containing raw pixel data into a
+ PNG outfile with the parameters set in the writer object.
+ """
+ pixels = array('B')
+ pixels.fromfile(ppmfile,
+ (self.bitdepth//8) * self.color_planes *
+ self.width * self.height)
+ apixels = array('B')
+ apixels.fromfile(pgmfile,
+ (self.bitdepth//8) *
+ self.width * self.height)
+ pixels = interleave_planes(pixels, apixels,
+ (self.bitdepth//8) * self.color_planes,
+ (self.bitdepth//8))
+ if self.interlace:
+ self.write_passes(outfile, self.array_scanlines_interlace(pixels))
+ else:
+ self.write_passes(outfile, self.array_scanlines(pixels))
+
+ def file_scanlines(self, infile):
+ """
+ Generates boxed rows in flat pixel format, from the input file
+ `infile`. It assumes that the input file is in a "Netpbm-like"
+ binary format, and is positioned at the beginning of the first
+ pixel. The number of pixels to read is taken from the image
+ dimensions (`width`, `height`, `planes`) and the number of bytes
+ per value is implied by the image `bitdepth`.
+ """
+
+ # Values per row
+ vpr = self.width * self.planes
+ row_bytes = vpr
+ if self.bitdepth > 8:
+ assert self.bitdepth == 16
+ row_bytes *= 2
+ fmt = '>%dH' % vpr
+ def line():
+ return array('H', struct.unpack(fmt, infile.read(row_bytes)))
+ else:
+ def line():
+ scanline = array('B', infile.read(row_bytes))
+ return scanline
+ for y in range(self.height):
+ yield line()
+
+ def array_scanlines(self, pixels):
+ """
+ Generates boxed rows (flat pixels) from flat rows (flat pixels)
+ in an array.
+ """
+
+ # Values per row
+ vpr = self.width * self.planes
+ stop = 0
+ for y in range(self.height):
+ start = stop
+ stop = start + vpr
+ yield pixels[start:stop]
+
+ def array_scanlines_interlace(self, pixels):
+ """
+ Generator for interlaced scanlines from an array. `pixels` is
+ the full source image in flat row flat pixel format. The
+ generator yields each scanline of the reduced passes in turn, in
+ boxed row flat pixel format.
+ """
+
+ # http://www.w3.org/TR/PNG/#8InterlaceMethods
+ # Array type.
+ fmt = 'BH'[self.bitdepth > 8]
+ # Value per row
+ vpr = self.width * self.planes
+ for xstart, ystart, xstep, ystep in _adam7:
+ if xstart >= self.width:
+ continue
+ # Pixels per row (of reduced image)
+ ppr = int(math.ceil((self.width-xstart)/float(xstep)))
+ # number of values in reduced image row.
+ row_len = ppr*self.planes
+ for y in range(ystart, self.height, ystep):
+ if xstep == 1:
+ offset = y * vpr
+ yield pixels[offset:offset+vpr]
+ else:
+ row = array(fmt)
+ # There's no easier way to set the length of an array
+ row.extend(pixels[0:row_len])
+ offset = y * vpr + xstart * self.planes
+ end_offset = (y+1) * vpr
+ skip = self.planes * xstep
+ for i in range(self.planes):
+ row[i::self.planes] = \
+ pixels[offset+i:end_offset:skip]
+ yield row
+
+def write_chunk(outfile, tag, data=b''):
+ """
+ Write a PNG chunk to the output file, including length and
+ checksum.
+ """
+
+ # http://www.w3.org/TR/PNG/#5Chunk-layout
+ outfile.write(struct.pack("!I", len(data)))
+ outfile.write(tag)
+ outfile.write(data)
+ checksum = zlib.crc32(tag)
+ checksum = zlib.crc32(data, checksum)
+ checksum &= 2**32-1
+ outfile.write(struct.pack("!I", checksum))
+
+def write_chunks(out, chunks):
+ """Create a PNG file by writing out the chunks."""
+
+ out.write(_signature)
+ for chunk in chunks:
+ write_chunk(out, *chunk)
+
+def filter_scanline(type, line, fo, prev=None):
+ """Apply a scanline filter to a scanline. `type` specifies the
+ filter type (0 to 4); `line` specifies the current (unfiltered)
+ scanline as a sequence of bytes; `prev` specifies the previous
+ (unfiltered) scanline as a sequence of bytes. `fo` specifies the
+ filter offset; normally this is size of a pixel in bytes (the number
+ of bytes per sample times the number of channels), but when this is
+ < 1 (for bit depths < 8) then the filter offset is 1.
+ """
+
+ assert 0 <= type < 5
+
+ # The output array. Which, pathetically, we extend one-byte at a
+ # time (fortunately this is linear).
+ out = array('B', [type])
+
+ def sub():
+ ai = -fo
+ for x in line:
+ if ai >= 0:
+ x = (x - line[ai]) & 0xff
+ out.append(x)
+ ai += 1
+ def up():
+ for i,x in enumerate(line):
+ x = (x - prev[i]) & 0xff
+ out.append(x)
+ def average():
+ ai = -fo
+ for i,x in enumerate(line):
+ if ai >= 0:
+ x = (x - ((line[ai] + prev[i]) >> 1)) & 0xff
+ else:
+ x = (x - (prev[i] >> 1)) & 0xff
+ out.append(x)
+ ai += 1
+ def paeth():
+ # http://www.w3.org/TR/PNG/#9Filter-type-4-Paeth
+ ai = -fo # also used for ci
+ for i,x in enumerate(line):
+ a = 0
+ b = prev[i]
+ c = 0
+
+ if ai >= 0:
+ a = line[ai]
+ c = prev[ai]
+ p = a + b - c
+ pa = abs(p - a)
+ pb = abs(p - b)
+ pc = abs(p - c)
+ if pa <= pb and pa <= pc:
+ Pr = a
+ elif pb <= pc:
+ Pr = b
+ else:
+ Pr = c
+
+ x = (x - Pr) & 0xff
+ out.append(x)
+ ai += 1
+
+ if not prev:
+ # We're on the first line. Some of the filters can be reduced
+ # to simpler cases which makes handling the line "off the top"
+ # of the image simpler. "up" becomes "none"; "paeth" becomes
+ # "left" (non-trivial, but true). "average" needs to be handled
+ # specially.
+ if type == 2: # "up"
+ type = 0
+ elif type == 3:
+ prev = [0]*len(line)
+ elif type == 4: # "paeth"
+ type = 1
+ if type == 0:
+ out.extend(line)
+ elif type == 1:
+ sub()
+ elif type == 2:
+ up()
+ elif type == 3:
+ average()
+ else: # type == 4
+ paeth()
+ return out
+
+
+def from_array(a, mode=None, info={}):
+ """Create a PNG :class:`Image` object from a 2- or 3-dimensional
+ array. One application of this function is easy PIL-style saving:
+ ``png.from_array(pixels, 'L').save('foo.png')``.
+
+ .. note :
+
+ The use of the term *3-dimensional* is for marketing purposes
+ only. It doesn't actually work. Please bear with us. Meanwhile
+ enjoy the complimentary snacks (on request) and please use a
+ 2-dimensional array.
+
+ Unless they are specified using the *info* parameter, the PNG's
+ height and width are taken from the array size. For a 3 dimensional
+ array the first axis is the height; the second axis is the width;
+ and the third axis is the channel number. Thus an RGB image that is
+ 16 pixels high and 8 wide will use an array that is 16x8x3. For 2
+ dimensional arrays the first axis is the height, but the second axis
+ is ``width*channels``, so an RGB image that is 16 pixels high and 8
+ wide will use a 2-dimensional array that is 16x24 (each row will be
+ 8*3==24 sample values).
+
+ *mode* is a string that specifies the image colour format in a
+ PIL-style mode. It can be:
+
+ ``'L'``
+ greyscale (1 channel)
+ ``'LA'``
+ greyscale with alpha (2 channel)
+ ``'RGB'``
+ colour image (3 channel)
+ ``'RGBA'``
+ colour image with alpha (4 channel)
+
+ The mode string can also specify the bit depth (overriding how this
+ function normally derives the bit depth, see below). Appending
+ ``';16'`` to the mode will cause the PNG to be 16 bits per channel;
+ any decimal from 1 to 16 can be used to specify the bit depth.
+
+ When a 2-dimensional array is used *mode* determines how many
+ channels the image has, and so allows the width to be derived from
+ the second array dimension.
+
+ The array is expected to be a ``numpy`` array, but it can be any
+ suitable Python sequence. For example, a list of lists can be used:
+ ``png.from_array([[0, 255, 0], [255, 0, 255]], 'L')``. The exact
+ rules are: ``len(a)`` gives the first dimension, height;
+ ``len(a[0])`` gives the second dimension; ``len(a[0][0])`` gives the
+ third dimension, unless an exception is raised in which case a
+ 2-dimensional array is assumed. It's slightly more complicated than
+ that because an iterator of rows can be used, and it all still
+ works. Using an iterator allows data to be streamed efficiently.
+
+ The bit depth of the PNG is normally taken from the array element's
+ datatype (but if *mode* specifies a bitdepth then that is used
+ instead). The array element's datatype is determined in a way which
+ is supposed to work both for ``numpy`` arrays and for Python
+ ``array.array`` objects. A 1 byte datatype will give a bit depth of
+ 8, a 2 byte datatype will give a bit depth of 16. If the datatype
+ does not have an implicit size, for example it is a plain Python
+ list of lists, as above, then a default of 8 is used.
+
+ The *info* parameter is a dictionary that can be used to specify
+ metadata (in the same style as the arguments to the
+ :class:``png.Writer`` class). For this function the keys that are
+ useful are:
+
+ height
+ overrides the height derived from the array dimensions and allows
+ *a* to be an iterable.
+ width
+ overrides the width derived from the array dimensions.
+ bitdepth
+ overrides the bit depth derived from the element datatype (but
+ must match *mode* if that also specifies a bit depth).
+
+ Generally anything specified in the
+ *info* dictionary will override any implicit choices that this
+ function would otherwise make, but must match any explicit ones.
+ For example, if the *info* dictionary has a ``greyscale`` key then
+ this must be true when mode is ``'L'`` or ``'LA'`` and false when
+ mode is ``'RGB'`` or ``'RGBA'``.
+ """
+
+ # We abuse the *info* parameter by modifying it. Take a copy here.
+ # (Also typechecks *info* to some extent).
+ info = dict(info)
+
+ # Syntax check mode string.
+ bitdepth = None
+ try:
+ # Assign the 'L' or 'RGBA' part to `gotmode`.
+ if mode.startswith('L'):
+ gotmode = 'L'
+ mode = mode[1:]
+ elif mode.startswith('RGB'):
+ gotmode = 'RGB'
+ mode = mode[3:]
+ else:
+ raise Error()
+ if mode.startswith('A'):
+ gotmode += 'A'
+ mode = mode[1:]
+
+ # Skip any optional ';'
+ while mode.startswith(';'):
+ mode = mode[1:]
+
+ # Parse optional bitdepth
+ if mode:
+ try:
+ bitdepth = int(mode)
+ except (TypeError, ValueError):
+ raise Error()
+ except Error:
+ raise Error("mode string should be 'RGB' or 'L;16' or similar.")
+ mode = gotmode
+
+ # Get bitdepth from *mode* if possible.
+ if bitdepth:
+ if info.get('bitdepth') and bitdepth != info['bitdepth']:
+ raise Error("mode bitdepth (%d) should match info bitdepth (%d)." %
+ (bitdepth, info['bitdepth']))
+ info['bitdepth'] = bitdepth
+
+ # Fill in and/or check entries in *info*.
+ # Dimensions.
+ if 'size' in info:
+ # Check width, height, size all match where used.
+ for dimension,axis in [('width', 0), ('height', 1)]:
+ if dimension in info:
+ if info[dimension] != info['size'][axis]:
+ raise Error(
+ "info[%r] should match info['size'][%r]." %
+ (dimension, axis))
+ info['width'],info['height'] = info['size']
+ if 'height' not in info:
+ try:
+ l = len(a)
+ except TypeError:
+ raise Error(
+ "len(a) does not work, supply info['height'] instead.")
+ info['height'] = l
+ # Colour format.
+ if 'greyscale' in info:
+ if bool(info['greyscale']) != ('L' in mode):
+ raise Error("info['greyscale'] should match mode.")
+ info['greyscale'] = 'L' in mode
+ if 'alpha' in info:
+ if bool(info['alpha']) != ('A' in mode):
+ raise Error("info['alpha'] should match mode.")
+ info['alpha'] = 'A' in mode
+
+ planes = len(mode)
+ if 'planes' in info:
+ if info['planes'] != planes:
+ raise Error("info['planes'] should match mode.")
+
+ # In order to work out whether we the array is 2D or 3D we need its
+ # first row, which requires that we take a copy of its iterator.
+ # We may also need the first row to derive width and bitdepth.
+ a,t = itertools.tee(a)
+ row = next(t)
+ del t
+ try:
+ row[0][0]
+ threed = True
+ testelement = row[0]
+ except (IndexError, TypeError):
+ threed = False
+ testelement = row
+ if 'width' not in info:
+ if threed:
+ width = len(row)
+ else:
+ width = len(row) // planes
+ info['width'] = width
+
+ # Not implemented yet
+ assert not threed
+
+ if 'bitdepth' not in info:
+ try:
+ dtype = testelement.dtype
+ # goto the "else:" clause. Sorry.
+ except AttributeError:
+ try:
+ # Try a Python array.array.
+ bitdepth = 8 * testelement.itemsize
+ except AttributeError:
+ # We can't determine it from the array element's
+ # datatype, use a default of 8.
+ bitdepth = 8
+ else:
+ # If we got here without exception, we now assume that
+ # the array is a numpy array.
+ if dtype.kind == 'b':
+ bitdepth = 1
+ else:
+ bitdepth = 8 * dtype.itemsize
+ info['bitdepth'] = bitdepth
+
+ for thing in 'width height bitdepth greyscale alpha'.split():
+ assert thing in info
+ return Image(a, info)
+
+# So that refugee's from PIL feel more at home. Not documented.
+fromarray = from_array
+
+class Image(object):
+ """A PNG image. You can create an :class:`Image` object from
+ an array of pixels by calling :meth:`png.from_array`. It can be
+ saved to disk with the :meth:`save` method.
+ """
+
+ def __init__(self, rows, info):
+ """
+ .. note ::
+
+ The constructor is not public. Please do not call it.
+ """
+
+ self.rows = rows
+ self.info = info
+
+ def save(self, file):
+ """Save the image to *file*. If *file* looks like an open file
+ descriptor then it is used, otherwise it is treated as a
+ filename and a fresh file is opened.
+
+ In general, you can only call this method once; after it has
+ been called the first time and the PNG image has been saved, the
+ source data will have been streamed, and cannot be streamed
+ again.
+ """
+
+ w = Writer(**self.info)
+
+ try:
+ file.write
+ def close(): pass
+ except AttributeError:
+ file = open(file, 'wb')
+ def close(): file.close()
+
+ try:
+ w.write(file, self.rows)
+ finally:
+ close()
+
+class _readable(object):
+ """
+ A simple file-like interface for strings and arrays.
+ """
+
+ def __init__(self, buf):
+ self.buf = buf
+ self.offset = 0
+
+ def read(self, n):
+ r = self.buf[self.offset:self.offset+n]
+ if isarray(r):
+ r = r.tostring()
+ self.offset += n
+ return r
+
+
+class Reader(object):
+ """
+ PNG decoder in pure Python.
+ """
+
+ def __init__(self, _guess=None, **kw):
+ """
+ Create a PNG decoder object.
+
+ The constructor expects exactly one keyword argument. If you
+ supply a positional argument instead, it will guess the input
+ type. You can choose among the following keyword arguments:
+
+ filename
+ Name of input file (a PNG file).
+ file
+ A file-like object (object with a read() method).
+ bytes
+ ``array`` or ``string`` with PNG data.
+
+ """
+ if ((_guess is not None and len(kw) != 0) or
+ (_guess is None and len(kw) != 1)):
+ raise TypeError("Reader() takes exactly 1 argument")
+
+ # Will be the first 8 bytes, later on. See validate_signature.
+ self.signature = None
+ self.transparent = None
+ # A pair of (len,type) if a chunk has been read but its data and
+ # checksum have not (in other words the file position is just
+ # past the 4 bytes that specify the chunk type). See preamble
+ # method for how this is used.
+ self.atchunk = None
+
+ if _guess is not None:
+ if isarray(_guess):
+ kw["bytes"] = _guess
+ elif isinstance(_guess, str):
+ kw["filename"] = _guess
+ elif hasattr(_guess, 'read'):
+ kw["file"] = _guess
+
+ if "filename" in kw:
+ self.file = open(kw["filename"], "rb")
+ elif "file" in kw:
+ self.file = kw["file"]
+ elif "bytes" in kw:
+ self.file = _readable(kw["bytes"])
+ else:
+ raise TypeError("expecting filename, file or bytes array")
+
+
+ def chunk(self, seek=None, lenient=False):
+ """
+ Read the next PNG chunk from the input file; returns a
+ (*type*,*data*) tuple. *type* is the chunk's type as a string
+ (all PNG chunk types are 4 characters long). *data* is the
+ chunk's data content, as a string.
+
+ If the optional `seek` argument is
+ specified then it will keep reading chunks until it either runs
+ out of file or finds the type specified by the argument. Note
+ that in general the order of chunks in PNGs is unspecified, so
+ using `seek` can cause you to miss chunks.
+
+ If the optional `lenient` argument evaluates to True,
+ checksum failures will raise warnings rather than exceptions.
+ """
+
+ self.validate_signature()
+
+ while True:
+ # http://www.w3.org/TR/PNG/#5Chunk-layout
+ if not self.atchunk:
+ self.atchunk = self.chunklentype()
+ length,type = self.atchunk
+ self.atchunk = None
+ data = self.file.read(length)
+ if len(data) != length:
+ raise ChunkError('Chunk %s too short for required %i octets.'
+ % (type, length))
+ checksum = self.file.read(4)
+ if len(checksum) != 4:
+ raise ValueError('Chunk %s too short for checksum.', tag)
+ if seek and type != seek:
+ continue
+ verify = zlib.crc32(type)
+ verify = zlib.crc32(data, verify)
+ # Whether the output from zlib.crc32 is signed or not varies
+ # according to hideous implementation details, see
+ # http://bugs.python.org/issue1202 .
+ # We coerce it to be positive here (in a way which works on
+ # Python 2.3 and older).
+ verify &= 2**32 - 1
+ verify = struct.pack('!I', verify)
+ if checksum != verify:
+ (a, ) = struct.unpack('!I', checksum)
+ (b, ) = struct.unpack('!I', verify)
+ message = "Checksum error in %s chunk: 0x%08X != 0x%08X." % (type, a, b)
+ if lenient:
+ warnings.warn(message, RuntimeWarning)
+ else:
+ raise ChunkError(message)
+ return type, data
+
+ def chunks(self):
+ """Return an iterator that will yield each chunk as a
+ (*chunktype*, *content*) pair.
+ """
+
+ while True:
+ t,v = self.chunk()
+ yield t,v
+ if t == b'IEND':
+ break
+
+ def undo_filter(self, filter_type, scanline, previous):
+ """Undo the filter for a scanline. `scanline` is a sequence of
+ bytes that does not include the initial filter type byte.
+ `previous` is decoded previous scanline (for straightlaced
+ images this is the previous pixel row, but for interlaced
+ images, it is the previous scanline in the reduced image, which
+ in general is not the previous pixel row in the final image).
+ When there is no previous scanline (the first row of a
+ straightlaced image, or the first row in one of the passes in an
+ interlaced image), then this argument should be ``None``.
+
+ The scanline will have the effects of filtering removed, and the
+ result will be returned as a fresh sequence of bytes.
+ """
+
+ # :todo: Would it be better to update scanline in place?
+ # Yes, with the Cython extension making the undo_filter fast,
+ # updating scanline inplace makes the code 3 times faster
+ # (reading 50 images of 800x800 went from 40s to 16s)
+ result = scanline
+
+ if filter_type == 0:
+ return result
+
+ if filter_type not in (1,2,3,4):
+ raise FormatError('Invalid PNG Filter Type.'
+ ' See http://www.w3.org/TR/2003/REC-PNG-20031110/#9Filters .')
+
+ # Filter unit. The stride from one pixel to the corresponding
+ # byte from the previous pixel. Normally this is the pixel
+ # size in bytes, but when this is smaller than 1, the previous
+ # byte is used instead.
+ fu = max(1, self.psize)
+
+ # For the first line of a pass, synthesize a dummy previous
+ # line. An alternative approach would be to observe that on the
+ # first line 'up' is the same as 'null', 'paeth' is the same
+ # as 'sub', with only 'average' requiring any special case.
+ if not previous:
+ previous = array('B', [0]*len(scanline))
+
+ def sub():
+ """Undo sub filter."""
+
+ ai = 0
+ # Loop starts at index fu. Observe that the initial part
+ # of the result is already filled in correctly with
+ # scanline.
+ for i in range(fu, len(result)):
+ x = scanline[i]
+ a = result[ai]
+ result[i] = (x + a) & 0xff
+ ai += 1
+
+ def up():
+ """Undo up filter."""
+
+ for i in range(len(result)):
+ x = scanline[i]
+ b = previous[i]
+ result[i] = (x + b) & 0xff
+
+ def average():
+ """Undo average filter."""
+
+ ai = -fu
+ for i in range(len(result)):
+ x = scanline[i]
+ if ai < 0:
+ a = 0
+ else:
+ a = result[ai]
+ b = previous[i]
+ result[i] = (x + ((a + b) >> 1)) & 0xff
+ ai += 1
+
+ def paeth():
+ """Undo Paeth filter."""
+
+ # Also used for ci.
+ ai = -fu
+ for i in range(len(result)):
+ x = scanline[i]
+ if ai < 0:
+ a = c = 0
+ else:
+ a = result[ai]
+ c = previous[ai]
+ b = previous[i]
+ p = a + b - c
+ pa = abs(p - a)
+ pb = abs(p - b)
+ pc = abs(p - c)
+ if pa <= pb and pa <= pc:
+ pr = a
+ elif pb <= pc:
+ pr = b
+ else:
+ pr = c
+ result[i] = (x + pr) & 0xff
+ ai += 1
+
+ # Call appropriate filter algorithm. Note that 0 has already
+ # been dealt with.
+ (None,
+ pngfilters.undo_filter_sub,
+ pngfilters.undo_filter_up,
+ pngfilters.undo_filter_average,
+ pngfilters.undo_filter_paeth)[filter_type](fu, scanline, previous, result)
+ return result
+
+ def deinterlace(self, raw):
+ """
+ Read raw pixel data, undo filters, deinterlace, and flatten.
+ Return in flat row flat pixel format.
+ """
+
+ # Values per row (of the target image)
+ vpr = self.width * self.planes
+
+ # Make a result array, and make it big enough. Interleaving
+ # writes to the output array randomly (well, not quite), so the
+ # entire output array must be in memory.
+ fmt = 'BH'[self.bitdepth > 8]
+ a = array(fmt, [0]*vpr*self.height)
+ source_offset = 0
+
+ for xstart, ystart, xstep, ystep in _adam7:
+ if xstart >= self.width:
+ continue
+ # The previous (reconstructed) scanline. None at the
+ # beginning of a pass to indicate that there is no previous
+ # line.
+ recon = None
+ # Pixels per row (reduced pass image)
+ ppr = int(math.ceil((self.width-xstart)/float(xstep)))
+ # Row size in bytes for this pass.
+ row_size = int(math.ceil(self.psize * ppr))
+ for y in range(ystart, self.height, ystep):
+ filter_type = raw[source_offset]
+ source_offset += 1
+ scanline = raw[source_offset:source_offset+row_size]
+ source_offset += row_size
+ recon = self.undo_filter(filter_type, scanline, recon)
+ # Convert so that there is one element per pixel value
+ flat = self.serialtoflat(recon, ppr)
+ if xstep == 1:
+ assert xstart == 0
+ offset = y * vpr
+ a[offset:offset+vpr] = flat
+ else:
+ offset = y * vpr + xstart * self.planes
+ end_offset = (y+1) * vpr
+ skip = self.planes * xstep
+ for i in range(self.planes):
+ a[offset+i:end_offset:skip] = \
+ flat[i::self.planes]
+ return a
+
+ def iterboxed(self, rows):
+ """Iterator that yields each scanline in boxed row flat pixel
+ format. `rows` should be an iterator that yields the bytes of
+ each row in turn.
+ """
+
+ def asvalues(raw):
+ """Convert a row of raw bytes into a flat row. Result will
+ be a freshly allocated object, not shared with
+ argument.
+ """
+
+ if self.bitdepth == 8:
+ return array('B', raw)
+ if self.bitdepth == 16:
+ raw = tostring(raw)
+ return array('H', struct.unpack('!%dH' % (len(raw)//2), raw))
+ assert self.bitdepth < 8
+ width = self.width
+ # Samples per byte
+ spb = 8//self.bitdepth
+ out = array('B')
+ mask = 2**self.bitdepth - 1
+ shifts = list(map(self.bitdepth.__mul__, reversed(list(range(spb)))))
+ for o in raw:
+ out.extend([mask&(o>>i) for i in shifts])
+ return out[:width]
+
+ return map(asvalues, rows)
+
+ def serialtoflat(self, bytes, width=None):
+ """Convert serial format (byte stream) pixel data to flat row
+ flat pixel.
+ """
+
+ if self.bitdepth == 8:
+ return bytes
+ if self.bitdepth == 16:
+ bytes = tostring(bytes)
+ return array('H',
+ struct.unpack('!%dH' % (len(bytes)//2), bytes))
+ assert self.bitdepth < 8
+ if width is None:
+ width = self.width
+ # Samples per byte
+ spb = 8//self.bitdepth
+ out = array('B')
+ mask = 2**self.bitdepth - 1
+ shifts = list(map(self.bitdepth.__mul__, reversed(list(range(spb)))))
+ l = width
+ for o in bytes:
+ out.extend([(mask&(o>>s)) for s in shifts][:l])
+ l -= spb
+ if l <= 0:
+ l = width
+ return out
+
+ def iterstraight(self, raw):
+ """Iterator that undoes the effect of filtering, and yields
+ each row in serialised format (as a sequence of bytes).
+ Assumes input is straightlaced. `raw` should be an iterable
+ that yields the raw bytes in chunks of arbitrary size.
+ """
+
+ # length of row, in bytes
+ rb = self.row_bytes
+ a = array('B')
+ # The previous (reconstructed) scanline. None indicates first
+ # line of image.
+ recon = None
+ for some in raw:
+ a.extend(some)
+ while len(a) >= rb + 1:
+ filter_type = a[0]
+ scanline = a[1:rb+1]
+ del a[:rb+1]
+ recon = self.undo_filter(filter_type, scanline, recon)
+ yield recon
+ if len(a) != 0:
+ # :file:format We get here with a file format error:
+ # when the available bytes (after decompressing) do not
+ # pack into exact rows.
+ raise FormatError(
+ 'Wrong size for decompressed IDAT chunk.')
+ assert len(a) == 0
+
+ def validate_signature(self):
+ """If signature (header) has not been read then read and
+ validate it; otherwise do nothing.
+ """
+
+ if self.signature:
+ return
+ self.signature = self.file.read(8)
+ if self.signature != _signature:
+ raise FormatError("PNG file has invalid signature.")
+
+ def preamble(self, lenient=False):
+ """
+ Extract the image metadata by reading the initial part of
+ the PNG file up to the start of the ``IDAT`` chunk. All the
+ chunks that precede the ``IDAT`` chunk are read and either
+ processed for metadata or discarded.
+
+ If the optional `lenient` argument evaluates to True, checksum
+ failures will raise warnings rather than exceptions.
+ """
+
+ self.validate_signature()
+
+ while True:
+ if not self.atchunk:
+ self.atchunk = self.chunklentype()
+ if self.atchunk is None:
+ raise FormatError(
+ 'This PNG file has no IDAT chunks.')
+ if self.atchunk[1] == b'IDAT':
+ return
+ self.process_chunk(lenient=lenient)
+
+ def chunklentype(self):
+ """Reads just enough of the input to determine the next
+ chunk's length and type, returned as a (*length*, *type*) pair
+ where *type* is a string. If there are no more chunks, ``None``
+ is returned.
+ """
+
+ x = self.file.read(8)
+ if not x:
+ return None
+ if len(x) != 8:
+ raise FormatError(
+ 'End of file whilst reading chunk length and type.')
+ length,type = struct.unpack('!I4s', x)
+ if length > 2**31-1:
+ raise FormatError('Chunk %s is too large: %d.' % (type,length))
+ return length,type
+
+ def process_chunk(self, lenient=False):
+ """Process the next chunk and its data. This only processes the
+ following chunk types, all others are ignored: ``IHDR``,
+ ``PLTE``, ``bKGD``, ``tRNS``, ``gAMA``, ``sBIT``.
+
+ If the optional `lenient` argument evaluates to True,
+ checksum failures will raise warnings rather than exceptions.
+ """
+
+ type, data = self.chunk(lenient=lenient)
+ method = '_process_' + str(type, 'ascii')
+ m = getattr(self, method, None)
+ if m:
+ m(data)
+
+ def _process_IHDR(self, data):
+ # http://www.w3.org/TR/PNG/#11IHDR
+ if len(data) != 13:
+ raise FormatError('IHDR chunk has incorrect length.')
+ (self.width, self.height, self.bitdepth, self.color_type,
+ self.compression, self.filter,
+ self.interlace) = struct.unpack("!2I5B", data)
+
+ check_bitdepth_colortype(self.bitdepth, self.color_type)
+
+ if self.compression != 0:
+ raise Error("unknown compression method %d" % self.compression)
+ if self.filter != 0:
+ raise FormatError("Unknown filter method %d,"
+ " see http://www.w3.org/TR/2003/REC-PNG-20031110/#9Filters ."
+ % self.filter)
+ if self.interlace not in (0,1):
+ raise FormatError("Unknown interlace method %d,"
+ " see http://www.w3.org/TR/2003/REC-PNG-20031110/#8InterlaceMethods ."
+ % self.interlace)
+
+ # Derived values
+ # http://www.w3.org/TR/PNG/#6Colour-values
+ colormap = bool(self.color_type & 1)
+ greyscale = not (self.color_type & 2)
+ alpha = bool(self.color_type & 4)
+ color_planes = (3,1)[greyscale or colormap]
+ planes = color_planes + alpha
+
+ self.colormap = colormap
+ self.greyscale = greyscale
+ self.alpha = alpha
+ self.color_planes = color_planes
+ self.planes = planes
+ self.psize = float(self.bitdepth)/float(8) * planes
+ if int(self.psize) == self.psize:
+ self.psize = int(self.psize)
+ self.row_bytes = int(math.ceil(self.width * self.psize))
+ # Stores PLTE chunk if present, and is used to check
+ # chunk ordering constraints.
+ self.plte = None
+ # Stores tRNS chunk if present, and is used to check chunk
+ # ordering constraints.
+ self.trns = None
+ # Stores sbit chunk if present.
+ self.sbit = None
+
+ def _process_PLTE(self, data):
+ # http://www.w3.org/TR/PNG/#11PLTE
+ if self.plte:
+ warnings.warn("Multiple PLTE chunks present.")
+ self.plte = data
+ if len(data) % 3 != 0:
+ raise FormatError(
+ "PLTE chunk's length should be a multiple of 3.")
+ if len(data) > (2**self.bitdepth)*3:
+ raise FormatError("PLTE chunk is too long.")
+ if len(data) == 0:
+ raise FormatError("Empty PLTE is not allowed.")
+
+ def _process_bKGD(self, data):
+ try:
+ if self.colormap:
+ if not self.plte:
+ warnings.warn(
+ "PLTE chunk is required before bKGD chunk.")
+ self.background = struct.unpack('B', data)
+ else:
+ self.background = struct.unpack("!%dH" % self.color_planes,
+ data)
+ except struct.error:
+ raise FormatError("bKGD chunk has incorrect length.")
+
+ def _process_tRNS(self, data):
+ # http://www.w3.org/TR/PNG/#11tRNS
+ self.trns = data
+ if self.colormap:
+ if not self.plte:
+ warnings.warn("PLTE chunk is required before tRNS chunk.")
+ else:
+ if len(data) > len(self.plte)//3:
+ # Was warning, but promoted to Error as it
+ # would otherwise cause pain later on.
+ raise FormatError("tRNS chunk is too long.")
+ else:
+ if self.alpha:
+ raise FormatError(
+ "tRNS chunk is not valid with colour type %d." %
+ self.color_type)
+ try:
+ self.transparent = \
+ struct.unpack("!%dH" % self.color_planes, data)
+ except struct.error:
+ raise FormatError("tRNS chunk has incorrect length.")
+
+ def _process_gAMA(self, data):
+ try:
+ self.gamma = struct.unpack("!L", data)[0] / 100000.0
+ except struct.error:
+ raise FormatError("gAMA chunk has incorrect length.")
+
+ def _process_sBIT(self, data):
+ self.sbit = data
+ if (self.colormap and len(data) != 3 or
+ not self.colormap and len(data) != self.planes):
+ raise FormatError("sBIT chunk has incorrect length.")
+
+ def read(self, lenient=False):
+ """
+ Read the PNG file and decode it. Returns (`width`, `height`,
+ `pixels`, `metadata`).
+
+ May use excessive memory.
+
+ `pixels` are returned in boxed row flat pixel format.
+
+ If the optional `lenient` argument evaluates to True,
+ checksum failures will raise warnings rather than exceptions.
+ """
+
+ def iteridat():
+ """Iterator that yields all the ``IDAT`` chunks as strings."""
+ while True:
+ try:
+ type, data = self.chunk(lenient=lenient)
+ except ValueError as e:
+ raise ChunkError(e.args[0])
+ if type == b'IEND':
+ # http://www.w3.org/TR/PNG/#11IEND
+ break
+ if type != b'IDAT':
+ continue
+ # type == 'IDAT'
+ # http://www.w3.org/TR/PNG/#11IDAT
+ if self.colormap and not self.plte:
+ warnings.warn("PLTE chunk is required before IDAT chunk")
+ yield data
+
+ def iterdecomp(idat):
+ """Iterator that yields decompressed strings. `idat` should
+ be an iterator that yields the ``IDAT`` chunk data.
+ """
+
+ # Currently, with no max_length parameter to decompress,
+ # this routine will do one yield per IDAT chunk: Not very
+ # incremental.
+ d = zlib.decompressobj()
+ # Each IDAT chunk is passed to the decompressor, then any
+ # remaining state is decompressed out.
+ for data in idat:
+ # :todo: add a max_length argument here to limit output
+ # size.
+ yield array('B', d.decompress(data))
+ yield array('B', d.flush())
+
+ self.preamble(lenient=lenient)
+ raw = iterdecomp(iteridat())
+
+ if self.interlace:
+ raw = array('B', itertools.chain(*raw))
+ arraycode = 'BH'[self.bitdepth>8]
+ # Like :meth:`group` but producing an array.array object for
+ # each row.
+ pixels = map(lambda *row: array(arraycode, row),
+ *[iter(self.deinterlace(raw))]*self.width*self.planes)
+ else:
+ pixels = self.iterboxed(self.iterstraight(raw))
+ meta = dict()
+ for attr in 'greyscale alpha planes bitdepth interlace'.split():
+ meta[attr] = getattr(self, attr)
+ meta['size'] = (self.width, self.height)
+ for attr in 'gamma transparent background'.split():
+ a = getattr(self, attr, None)
+ if a is not None:
+ meta[attr] = a
+ if self.plte:
+ meta['palette'] = self.palette()
+ return self.width, self.height, pixels, meta
+
+
+ def read_flat(self):
+ """
+ Read a PNG file and decode it into flat row flat pixel format.
+ Returns (*width*, *height*, *pixels*, *metadata*).
+
+ May use excessive memory.
+
+ `pixels` are returned in flat row flat pixel format.
+
+ See also the :meth:`read` method which returns pixels in the
+ more stream-friendly boxed row flat pixel format.
+ """
+
+ x, y, pixel, meta = self.read()
+ arraycode = 'BH'[meta['bitdepth']>8]
+ pixel = array(arraycode, itertools.chain(*pixel))
+ return x, y, pixel, meta
+
+ def palette(self, alpha='natural'):
+ """Returns a palette that is a sequence of 3-tuples or 4-tuples,
+ synthesizing it from the ``PLTE`` and ``tRNS`` chunks. These
+ chunks should have already been processed (for example, by
+ calling the :meth:`preamble` method). All the tuples are the
+ same size: 3-tuples if there is no ``tRNS`` chunk, 4-tuples when
+ there is a ``tRNS`` chunk. Assumes that the image is colour type
+ 3 and therefore a ``PLTE`` chunk is required.
+
+ If the `alpha` argument is ``'force'`` then an alpha channel is
+ always added, forcing the result to be a sequence of 4-tuples.
+ """
+
+ if not self.plte:
+ raise FormatError(
+ "Required PLTE chunk is missing in colour type 3 image.")
+ plte = group(array('B', self.plte), 3)
+ if self.trns or alpha == 'force':
+ trns = array('B', self.trns or '')
+ trns.extend([255]*(len(plte)-len(trns)))
+ plte = list(map(operator.add, plte, group(trns, 1)))
+ return plte
+
+ def asDirect(self):
+ """Returns the image data as a direct representation of an
+ ``x * y * planes`` array. This method is intended to remove the
+ need for callers to deal with palettes and transparency
+ themselves. Images with a palette (colour type 3)
+ are converted to RGB or RGBA; images with transparency (a
+ ``tRNS`` chunk) are converted to LA or RGBA as appropriate.
+ When returned in this format the pixel values represent the
+ colour value directly without needing to refer to palettes or
+ transparency information.
+
+ Like the :meth:`read` method this method returns a 4-tuple:
+
+ (*width*, *height*, *pixels*, *meta*)
+
+ This method normally returns pixel values with the bit depth
+ they have in the source image, but when the source PNG has an
+ ``sBIT`` chunk it is inspected and can reduce the bit depth of
+ the result pixels; pixel values will be reduced according to
+ the bit depth specified in the ``sBIT`` chunk (PNG nerds should
+ note a single result bit depth is used for all channels; the
+ maximum of the ones specified in the ``sBIT`` chunk. An RGB565
+ image will be rescaled to 6-bit RGB666).
+
+ The *meta* dictionary that is returned reflects the `direct`
+ format and not the original source image. For example, an RGB
+ source image with a ``tRNS`` chunk to represent a transparent
+ colour, will have ``planes=3`` and ``alpha=False`` for the
+ source image, but the *meta* dictionary returned by this method
+ will have ``planes=4`` and ``alpha=True`` because an alpha
+ channel is synthesized and added.
+
+ *pixels* is the pixel data in boxed row flat pixel format (just
+ like the :meth:`read` method).
+
+ All the other aspects of the image data are not changed.
+ """
+
+ self.preamble()
+
+ # Simple case, no conversion necessary.
+ if not self.colormap and not self.trns and not self.sbit:
+ return self.read()
+
+ x,y,pixels,meta = self.read()
+
+ if self.colormap:
+ meta['colormap'] = False
+ meta['alpha'] = bool(self.trns)
+ meta['bitdepth'] = 8
+ meta['planes'] = 3 + bool(self.trns)
+ plte = self.palette()
+ def iterpal(pixels):
+ for row in pixels:
+ row = list(map(plte.__getitem__, row))
+ yield array('B', itertools.chain(*row))
+ pixels = iterpal(pixels)
+ elif self.trns:
+ # It would be nice if there was some reasonable way
+ # of doing this without generating a whole load of
+ # intermediate tuples. But tuples does seem like the
+ # easiest way, with no other way clearly much simpler or
+ # much faster. (Actually, the L to LA conversion could
+ # perhaps go faster (all those 1-tuples!), but I still
+ # wonder whether the code proliferation is worth it)
+ it = self.transparent
+ maxval = 2**meta['bitdepth']-1
+ planes = meta['planes']
+ meta['alpha'] = True
+ meta['planes'] += 1
+ typecode = 'BH'[meta['bitdepth']>8]
+ def itertrns(pixels):
+ for row in pixels:
+ # For each row we group it into pixels, then form a
+ # characterisation vector that says whether each
+ # pixel is opaque or not. Then we convert
+ # True/False to 0/maxval (by multiplication),
+ # and add it as the extra channel.
+ row = group(row, planes)
+ opa = list(map(it.__ne__, row))
+ opa = list(map(maxval.__mul__, opa))
+ opa = list(zip(opa)) # convert to 1-tuples
+ yield array(typecode,
+ itertools.chain(*list(map(operator.add, row, opa))))
+ pixels = itertrns(pixels)
+ targetbitdepth = None
+ if self.sbit:
+ sbit = struct.unpack('%dB' % len(self.sbit), self.sbit)
+ targetbitdepth = max(sbit)
+ if targetbitdepth > meta['bitdepth']:
+ raise Error('sBIT chunk %r exceeds bitdepth %d' %
+ (sbit,self.bitdepth))
+ if min(sbit) <= 0:
+ raise Error('sBIT chunk %r has a 0-entry' % sbit)
+ if targetbitdepth == meta['bitdepth']:
+ targetbitdepth = None
+ if targetbitdepth:
+ shift = meta['bitdepth'] - targetbitdepth
+ meta['bitdepth'] = targetbitdepth
+ def itershift(pixels):
+ for row in pixels:
+ yield list(map(shift.__rrshift__, row))
+ pixels = itershift(pixels)
+ return x,y,pixels,meta
+
+ def asFloat(self, maxval=1.0):
+ """Return image pixels as per :meth:`asDirect` method, but scale
+ all pixel values to be floating point values between 0.0 and
+ *maxval*.
+ """
+
+ x,y,pixels,info = self.asDirect()
+ sourcemaxval = 2**info['bitdepth']-1
+ del info['bitdepth']
+ info['maxval'] = float(maxval)
+ factor = float(maxval)/float(sourcemaxval)
+ def iterfloat():
+ for row in pixels:
+ yield list(map(factor.__mul__, row))
+ return x,y,iterfloat(),info
+
+ def _as_rescale(self, get, targetbitdepth):
+ """Helper used by :meth:`asRGB8` and :meth:`asRGBA8`."""
+
+ width,height,pixels,meta = get()
+ maxval = 2**meta['bitdepth'] - 1
+ targetmaxval = 2**targetbitdepth - 1
+ factor = float(targetmaxval) / float(maxval)
+ meta['bitdepth'] = targetbitdepth
+ def iterscale():
+ for row in pixels:
+ yield [int(round(x*factor)) for x in row]
+ if maxval == targetmaxval:
+ return width, height, pixels, meta
+ else:
+ return width, height, iterscale(), meta
+
+ def asRGB8(self):
+ """Return the image data as an RGB pixels with 8-bits per
+ sample. This is like the :meth:`asRGB` method except that
+ this method additionally rescales the values so that they
+ are all between 0 and 255 (8-bit). In the case where the
+ source image has a bit depth < 8 the transformation preserves
+ all the information; where the source image has bit depth
+ > 8, then rescaling to 8-bit values loses precision. No
+ dithering is performed. Like :meth:`asRGB`, an alpha channel
+ in the source image will raise an exception.
+
+ This function returns a 4-tuple:
+ (*width*, *height*, *pixels*, *metadata*).
+ *width*, *height*, *metadata* are as per the
+ :meth:`read` method.
+
+ *pixels* is the pixel data in boxed row flat pixel format.
+ """
+
+ return self._as_rescale(self.asRGB, 8)
+
+ def asRGBA8(self):
+ """Return the image data as RGBA pixels with 8-bits per
+ sample. This method is similar to :meth:`asRGB8` and
+ :meth:`asRGBA`: The result pixels have an alpha channel, *and*
+ values are rescaled to the range 0 to 255. The alpha channel is
+ synthesized if necessary (with a small speed penalty).
+ """
+
+ return self._as_rescale(self.asRGBA, 8)
+
+ def asRGB(self):
+ """Return image as RGB pixels. RGB colour images are passed
+ through unchanged; greyscales are expanded into RGB
+ triplets (there is a small speed overhead for doing this).
+
+ An alpha channel in the source image will raise an
+ exception.
+
+ The return values are as for the :meth:`read` method
+ except that the *metadata* reflect the returned pixels, not the
+ source image. In particular, for this method
+ ``metadata['greyscale']`` will be ``False``.
+ """
+
+ width,height,pixels,meta = self.asDirect()
+ if meta['alpha']:
+ raise Error("will not convert image with alpha channel to RGB")
+ if not meta['greyscale']:
+ return width,height,pixels,meta
+ meta['greyscale'] = False
+ typecode = 'BH'[meta['bitdepth'] > 8]
+ def iterrgb():
+ for row in pixels:
+ a = array(typecode, [0]) * 3 * width
+ for i in range(3):
+ a[i::3] = row
+ yield a
+ return width,height,iterrgb(),meta
+
+ def asRGBA(self):
+ """Return image as RGBA pixels. Greyscales are expanded into
+ RGB triplets; an alpha channel is synthesized if necessary.
+ The return values are as for the :meth:`read` method
+ except that the *metadata* reflect the returned pixels, not the
+ source image. In particular, for this method
+ ``metadata['greyscale']`` will be ``False``, and
+ ``metadata['alpha']`` will be ``True``.
+ """
+
+ width,height,pixels,meta = self.asDirect()
+ if meta['alpha'] and not meta['greyscale']:
+ return width,height,pixels,meta
+ typecode = 'BH'[meta['bitdepth'] > 8]
+ maxval = 2**meta['bitdepth'] - 1
+ maxbuffer = struct.pack('=' + typecode, maxval) * 4 * width
+ def newarray():
+ return array(typecode, maxbuffer)
+
+ if meta['alpha'] and meta['greyscale']:
+ # LA to RGBA
+ def convert():
+ for row in pixels:
+ # Create a fresh target row, then copy L channel
+ # into first three target channels, and A channel
+ # into fourth channel.
+ a = newarray()
+ pngfilters.convert_la_to_rgba(row, a)
+ yield a
+ elif meta['greyscale']:
+ # L to RGBA
+ def convert():
+ for row in pixels:
+ a = newarray()
+ pngfilters.convert_l_to_rgba(row, a)
+ yield a
+ else:
+ assert not meta['alpha'] and not meta['greyscale']
+ # RGB to RGBA
+ def convert():
+ for row in pixels:
+ a = newarray()
+ pngfilters.convert_rgb_to_rgba(row, a)
+ yield a
+ meta['alpha'] = True
+ meta['greyscale'] = False
+ return width,height,convert(),meta
+
+def check_bitdepth_colortype(bitdepth, colortype):
+ """Check that `bitdepth` and `colortype` are both valid,
+ and specified in a valid combination. Returns if valid,
+ raise an Exception if not valid.
+ """
+
+ if bitdepth not in (1,2,4,8,16):
+ raise FormatError("invalid bit depth %d" % bitdepth)
+ if colortype not in (0,2,3,4,6):
+ raise FormatError("invalid colour type %d" % colortype)
+ # Check indexed (palettized) images have 8 or fewer bits
+ # per pixel; check only indexed or greyscale images have
+ # fewer than 8 bits per pixel.
+ if colortype & 1 and bitdepth > 8:
+ raise FormatError(
+ "Indexed images (colour type %d) cannot"
+ " have bitdepth > 8 (bit depth %d)."
+ " See http://www.w3.org/TR/2003/REC-PNG-20031110/#table111 ."
+ % (bitdepth, colortype))
+ if bitdepth < 8 and colortype not in (0,3):
+ raise FormatError("Illegal combination of bit depth (%d)"
+ " and colour type (%d)."
+ " See http://www.w3.org/TR/2003/REC-PNG-20031110/#table111 ."
+ % (bitdepth, colortype))
+
+def isinteger(x):
+ try:
+ return int(x) == x
+ except (TypeError, ValueError):
+ return False
+
+
+# === Legacy Version Support ===
+
+# :pyver:old: PyPNG works on Python versions 2.3 and 2.2, but not
+# without some awkward problems. Really PyPNG works on Python 2.4 (and
+# above); it works on Pythons 2.3 and 2.2 by virtue of fixing up
+# problems here. It's a bit ugly (which is why it's hidden down here).
+#
+# Generally the strategy is one of pretending that we're running on
+# Python 2.4 (or above), and patching up the library support on earlier
+# versions so that it looks enough like Python 2.4. When it comes to
+# Python 2.2 there is one thing we cannot patch: extended slices
+# http://www.python.org/doc/2.3/whatsnew/section-slices.html.
+# Instead we simply declare that features that are implemented using
+# extended slices will not work on Python 2.2.
+#
+# In order to work on Python 2.3 we fix up a recurring annoyance involving
+# the array type. In Python 2.3 an array cannot be initialised with an
+# array, and it cannot be extended with a list (or other sequence).
+# Both of those are repeated issues in the code. Whilst I would not
+# normally tolerate this sort of behaviour, here we "shim" a replacement
+# for array into place (and hope no-one notices). You never read this.
+#
+# In an amusing case of warty hacks on top of warty hacks... the array
+# shimming we try and do only works on Python 2.3 and above (you can't
+# subclass array.array in Python 2.2). So to get it working on Python
+# 2.2 we go for something much simpler and (probably) way slower.
+try:
+ array('B').extend([])
+ array('B', array('B'))
+# :todo:(drj) Check that TypeError is correct for Python 2.3
+except TypeError:
+ # Expect to get here on Python 2.3
+ try:
+ class _array_shim(array):
+ true_array = array
+ def __new__(cls, typecode, init=None):
+ super_new = super(_array_shim, cls).__new__
+ it = super_new(cls, typecode)
+ if init is None:
+ return it
+ it.extend(init)
+ return it
+ def extend(self, extension):
+ super_extend = super(_array_shim, self).extend
+ if isinstance(extension, self.true_array):
+ return super_extend(extension)
+ if not isinstance(extension, (list, str)):
+ # Convert to list. Allows iterators to work.
+ extension = list(extension)
+ return super_extend(self.true_array(self.typecode, extension))
+ array = _array_shim
+ except TypeError:
+ # Expect to get here on Python 2.2
+ def array(typecode, init=()):
+ if type(init) == str:
+ return list(map(ord, init))
+ return list(init)
+
+# Further hacks to get it limping along on Python 2.2
+try:
+ enumerate
+except NameError:
+ def enumerate(seq):
+ i=0
+ for x in seq:
+ yield i,x
+ i += 1
+
+try:
+ reversed
+except NameError:
+ def reversed(l):
+ l = list(l)
+ l.reverse()
+ for x in l:
+ yield x
+
+try:
+ itertools
+except NameError:
+ class _dummy_itertools(object):
+ pass
+ itertools = _dummy_itertools()
+ def _itertools_imap(f, seq):
+ for x in seq:
+ yield f(x)
+ itertools.imap = _itertools_imap
+ def _itertools_chain(*iterables):
+ for it in iterables:
+ for element in it:
+ yield element
+ itertools.chain = _itertools_chain
+
+
+# === Support for users without Cython ===
+
+try:
+ pngfilters
+except NameError:
+ class pngfilters(object):
+ def undo_filter_sub(filter_unit, scanline, previous, result):
+ """Undo sub filter."""
+
+ ai = 0
+ # Loops starts at index fu. Observe that the initial part
+ # of the result is already filled in correctly with
+ # scanline.
+ for i in range(filter_unit, len(result)):
+ x = scanline[i]
+ a = result[ai]
+ result[i] = (x + a) & 0xff
+ ai += 1
+ undo_filter_sub = staticmethod(undo_filter_sub)
+
+ def undo_filter_up(filter_unit, scanline, previous, result):
+ """Undo up filter."""
+
+ for i in range(len(result)):
+ x = scanline[i]
+ b = previous[i]
+ result[i] = (x + b) & 0xff
+ undo_filter_up = staticmethod(undo_filter_up)
+
+ def undo_filter_average(filter_unit, scanline, previous, result):
+ """Undo up filter."""
+
+ ai = -filter_unit
+ for i in range(len(result)):
+ x = scanline[i]
+ if ai < 0:
+ a = 0
+ else:
+ a = result[ai]
+ b = previous[i]
+ result[i] = (x + ((a + b) >> 1)) & 0xff
+ ai += 1
+ undo_filter_average = staticmethod(undo_filter_average)
+
+ def undo_filter_paeth(filter_unit, scanline, previous, result):
+ """Undo Paeth filter."""
+
+ # Also used for ci.
+ ai = -filter_unit
+ for i in range(len(result)):
+ x = scanline[i]
+ if ai < 0:
+ a = c = 0
+ else:
+ a = result[ai]
+ c = previous[ai]
+ b = previous[i]
+ p = a + b - c
+ pa = abs(p - a)
+ pb = abs(p - b)
+ pc = abs(p - c)
+ if pa <= pb and pa <= pc:
+ pr = a
+ elif pb <= pc:
+ pr = b
+ else:
+ pr = c
+ result[i] = (x + pr) & 0xff
+ ai += 1
+ undo_filter_paeth = staticmethod(undo_filter_paeth)
+
+ def convert_la_to_rgba(row, result):
+ for i in range(3):
+ result[i::4] = row[0::2]
+ result[3::4] = row[1::2]
+ convert_la_to_rgba = staticmethod(convert_la_to_rgba)
+
+ def convert_l_to_rgba(row, result):
+ """Convert a grayscale image to RGBA. This method assumes
+ the alpha channel in result is already correctly
+ initialized.
+ """
+ for i in range(3):
+ result[i::4] = row
+ convert_l_to_rgba = staticmethod(convert_l_to_rgba)
+
+ def convert_rgb_to_rgba(row, result):
+ """Convert an RGB image to RGBA. This method assumes the
+ alpha channel in result is already correctly initialized.
+ """
+ for i in range(3):
+ result[i::4] = row[i::3]
+ convert_rgb_to_rgba = staticmethod(convert_rgb_to_rgba)
+
+
+# === Command Line Support ===
+
+def read_pam_header(infile):
+ """
+ Read (the rest of a) PAM header. `infile` should be positioned
+ immediately after the initial 'P7' line (at the beginning of the
+ second line). Returns are as for `read_pnm_header`.
+ """
+
+ # Unlike PBM, PGM, and PPM, we can read the header a line at a time.
+ header = dict()
+ while True:
+ l = infile.readline().strip()
+ if l == b'ENDHDR':
+ break
+ if not l:
+ raise EOFError('PAM ended prematurely')
+ if l[0] == b'#':
+ continue
+ l = l.split(None, 1)
+ if l[0] not in header:
+ header[l[0]] = l[1]
+ else:
+ header[l[0]] += b' ' + l[1]
+
+ required = [b'WIDTH', b'HEIGHT', b'DEPTH', b'MAXVAL']
+ WIDTH,HEIGHT,DEPTH,MAXVAL = required
+ present = [x for x in required if x in header]
+ if len(present) != len(required):
+ raise Error('PAM file must specify WIDTH, HEIGHT, DEPTH, and MAXVAL')
+ width = int(header[WIDTH])
+ height = int(header[HEIGHT])
+ depth = int(header[DEPTH])
+ maxval = int(header[MAXVAL])
+ if (width <= 0 or
+ height <= 0 or
+ depth <= 0 or
+ maxval <= 0):
+ raise Error(
+ 'WIDTH, HEIGHT, DEPTH, MAXVAL must all be positive integers')
+ return 'P7', width, height, depth, maxval
+
+def read_pnm_header(infile, supported=(b'P5',b'P6')):
+ """
+ Read a PNM header, returning (format,width,height,depth,maxval).
+ `width` and `height` are in pixels. `depth` is the number of
+ channels in the image; for PBM and PGM it is synthesized as 1, for
+ PPM as 3; for PAM images it is read from the header. `maxval` is
+ synthesized (as 1) for PBM images.
+ """
+
+ # Generally, see http://netpbm.sourceforge.net/doc/ppm.html
+ # and http://netpbm.sourceforge.net/doc/pam.html
+
+ # Technically 'P7' must be followed by a newline, so by using
+ # rstrip() we are being liberal in what we accept. I think this
+ # is acceptable.
+ type = infile.read(3).rstrip()
+ if type not in supported:
+ raise NotImplementedError('file format %s not supported' % type)
+ if type == b'P7':
+ # PAM header parsing is completely different.
+ return read_pam_header(infile)
+ # Expected number of tokens in header (3 for P4, 4 for P6)
+ expected = 4
+ pbm = (b'P1', b'P4')
+ if type in pbm:
+ expected = 3
+ header = [type]
+
+ # We have to read the rest of the header byte by byte because the
+ # final whitespace character (immediately following the MAXVAL in
+ # the case of P6) may not be a newline. Of course all PNM files in
+ # the wild use a newline at this point, so it's tempting to use
+ # readline; but it would be wrong.
+ def getc():
+ c = infile.read(1)
+ if not c:
+ raise Error('premature EOF reading PNM header')
+ return c
+
+ c = getc()
+ while True:
+ # Skip whitespace that precedes a token.
+ while c.isspace():
+ c = getc()
+ # Skip comments.
+ while c == '#':
+ while c not in '\n\r':
+ c = getc()
+ if not c.isdigit():
+ raise Error('unexpected character %s found in header' % c)
+ # According to the specification it is legal to have comments
+ # that appear in the middle of a token.
+ # This is bonkers; I've never seen it; and it's a bit awkward to
+ # code good lexers in Python (no goto). So we break on such
+ # cases.
+ token = b''
+ while c.isdigit():
+ token += c
+ c = getc()
+ # Slight hack. All "tokens" are decimal integers, so convert
+ # them here.
+ header.append(int(token))
+ if len(header) == expected:
+ break
+ # Skip comments (again)
+ while c == '#':
+ while c not in '\n\r':
+ c = getc()
+ if not c.isspace():
+ raise Error('expected header to end with whitespace, not %s' % c)
+
+ if type in pbm:
+ # synthesize a MAXVAL
+ header.append(1)
+ depth = (1,3)[type == b'P6']
+ return header[0], header[1], header[2], depth, header[3]
+
+def write_pnm(file, width, height, pixels, meta):
+ """Write a Netpbm PNM/PAM file.
+ """
+
+ bitdepth = meta['bitdepth']
+ maxval = 2**bitdepth - 1
+ # Rudely, the number of image planes can be used to determine
+ # whether we are L (PGM), LA (PAM), RGB (PPM), or RGBA (PAM).
+ planes = meta['planes']
+ # Can be an assert as long as we assume that pixels and meta came
+ # from a PNG file.
+ assert planes in (1,2,3,4)
+ if planes in (1,3):
+ if 1 == planes:
+ # PGM
+ # Could generate PBM if maxval is 1, but we don't (for one
+ # thing, we'd have to convert the data, not just blat it
+ # out).
+ fmt = 'P5'
+ else:
+ # PPM
+ fmt = 'P6'
+ header = '%s %d %d %d\n' % (fmt, width, height, maxval)
+ if planes in (2,4):
+ # PAM
+ # See http://netpbm.sourceforge.net/doc/pam.html
+ if 2 == planes:
+ tupltype = 'GRAYSCALE_ALPHA'
+ else:
+ tupltype = 'RGB_ALPHA'
+ header = ('P7\nWIDTH %d\nHEIGHT %d\nDEPTH %d\nMAXVAL %d\n'
+ 'TUPLTYPE %s\nENDHDR\n' %
+ (width, height, planes, maxval, tupltype))
+ file.write(header.encode('ascii'))
+ # Values per row
+ vpr = planes * width
+ # struct format
+ fmt = '>%d' % vpr
+ if maxval > 0xff:
+ fmt = fmt + 'H'
+ else:
+ fmt = fmt + 'B'
+ for row in pixels:
+ file.write(struct.pack(fmt, *row))
+ file.flush()
+
+def color_triple(color):
+ """
+ Convert a command line colour value to a RGB triple of integers.
+ FIXME: Somewhere we need support for greyscale backgrounds etc.
+ """
+ if color.startswith('#') and len(color) == 4:
+ return (int(color[1], 16),
+ int(color[2], 16),
+ int(color[3], 16))
+ if color.startswith('#') and len(color) == 7:
+ return (int(color[1:3], 16),
+ int(color[3:5], 16),
+ int(color[5:7], 16))
+ elif color.startswith('#') and len(color) == 13:
+ return (int(color[1:5], 16),
+ int(color[5:9], 16),
+ int(color[9:13], 16))
+
+def _add_common_options(parser):
+ """Call *parser.add_option* for each of the options that are
+ common between this PNG--PNM conversion tool and the gen
+ tool.
+ """
+ parser.add_option("-i", "--interlace",
+ default=False, action="store_true",
+ help="create an interlaced PNG file (Adam7)")
+ parser.add_option("-t", "--transparent",
+ action="store", type="string", metavar="#RRGGBB",
+ help="mark the specified colour as transparent")
+ parser.add_option("-b", "--background",
+ action="store", type="string", metavar="#RRGGBB",
+ help="save the specified background colour")
+ parser.add_option("-g", "--gamma",
+ action="store", type="float", metavar="value",
+ help="save the specified gamma value")
+ parser.add_option("-c", "--compression",
+ action="store", type="int", metavar="level",
+ help="zlib compression level (0-9)")
+ return parser
+
+def _main(argv):
+ """
+ Run the PNG encoder with options from the command line.
+ """
+
+ # Parse command line arguments
+ from optparse import OptionParser
+ import re
+ version = '%prog ' + __version__
+ parser = OptionParser(version=version)
+ parser.set_usage("%prog [options] [imagefile]")
+ parser.add_option('-r', '--read-png', default=False,
+ action='store_true',
+ help='Read PNG, write PNM')
+ parser.add_option("-a", "--alpha",
+ action="store", type="string", metavar="pgmfile",
+ help="alpha channel transparency (RGBA)")
+ _add_common_options(parser)
+
+ (options, args) = parser.parse_args(args=argv[1:])
+
+ # Convert options
+ if options.transparent is not None:
+ options.transparent = color_triple(options.transparent)
+ if options.background is not None:
+ options.background = color_triple(options.background)
+
+ # Prepare input and output files
+ if len(args) == 0:
+ infilename = '-'
+ infile = sys.stdin
+ elif len(args) == 1:
+ infilename = args[0]
+ infile = open(infilename, 'rb')
+ else:
+ parser.error("more than one input file")
+ outfile = sys.stdout
+ if sys.platform == "win32":
+ import msvcrt, os
+ msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
+
+ if options.read_png:
+ # Encode PNG to PPM
+ png = Reader(file=infile)
+ width,height,pixels,meta = png.asDirect()
+ write_pnm(outfile, width, height, pixels, meta)
+ else:
+ # Encode PNM to PNG
+ format, width, height, depth, maxval = \
+ read_pnm_header(infile, (b'P5',b'P6',b'P7'))
+ # When it comes to the variety of input formats, we do something
+ # rather rude. Observe that L, LA, RGB, RGBA are the 4 colour
+ # types supported by PNG and that they correspond to 1, 2, 3, 4
+ # channels respectively. So we use the number of channels in
+ # the source image to determine which one we have. We do not
+ # care about TUPLTYPE.
+ greyscale = depth <= 2
+ pamalpha = depth in (2,4)
+ supported = [2**x-1 for x in range(1,17)]
+ try:
+ mi = supported.index(maxval)
+ except ValueError:
+ raise NotImplementedError(
+ 'your maxval (%s) not in supported list %s' %
+ (maxval, str(supported)))
+ bitdepth = mi+1
+ writer = Writer(width, height,
+ greyscale=greyscale,
+ bitdepth=bitdepth,
+ interlace=options.interlace,
+ transparent=options.transparent,
+ background=options.background,
+ alpha=bool(pamalpha or options.alpha),
+ gamma=options.gamma,
+ compression=options.compression)
+ if options.alpha:
+ pgmfile = open(options.alpha, 'rb')
+ format, awidth, aheight, adepth, amaxval = \
+ read_pnm_header(pgmfile, b'P5')
+ if amaxval != '255':
+ raise NotImplementedError(
+ 'maxval %s not supported for alpha channel' % amaxval)
+ if (awidth, aheight) != (width, height):
+ raise ValueError("alpha channel image size mismatch"
+ " (%s has %sx%s but %s has %sx%s)"
+ % (infilename, width, height,
+ options.alpha, awidth, aheight))
+ writer.convert_ppm_and_pgm(infile, pgmfile, outfile)
+ else:
+ writer.convert_pnm(infile, outfile)
+
+
+if __name__ == '__main__':
+ try:
+ _main(sys.argv)
+ except Error as e:
+ print(e, file=sys.stderr)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/__init__.py
new file mode 100644
index 0000000..a2c7cbc
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/__init__.py
@@ -0,0 +1,217 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+"""Load fonts and render text.
+
+This is a fairly-low level interface to text rendering. Obtain a font using :meth:`load`::
+
+ from pyglet import font
+ arial = font.load('Arial', 14, bold=True, italic=False)
+
+Manually loading fonts is only required in the following situations:
+
+* When manually rendering fonts;
+* When using the deprecated font rendering in :mod:`pyglet.font.text`.
+
+You are encouraged to use :mod:`pyglet.text` for actual text rendering. Classes in this module will
+handle font loading for you, so manual loading is not required.
+
+pyglet will automatically load any system-installed fonts. You can add additional fonts
+(for example, from your program resources) using :meth:`add_file` or
+:meth:`add_directory`. These fonts are then available in the same way as system-installed fonts::
+
+ from pyglet import font
+ font.add_file('action_man.ttf')
+ action_man = font.load('Action Man', 16)
+
+
+See the :mod:`pyglet.font.base` module for documentation on the base classes used
+by this package.
+"""
+from __future__ import absolute_import, division
+from past.builtins import basestring
+
+import os
+import sys
+import weakref
+
+import pyglet
+from pyglet import gl
+
+
+if not getattr(sys, 'is_epydoc', False):
+ if pyglet.compat_platform == 'darwin':
+ if pyglet.options['darwin_cocoa']:
+ from pyglet.font.quartz import QuartzFont
+ _font_class = QuartzFont
+ else:
+ from pyglet.font.carbon import CarbonFont
+ _font_class = CarbonFont
+ elif pyglet.compat_platform in ('win32', 'cygwin'):
+ if pyglet.options['font'][0] == 'win32':
+ from pyglet.font.win32 import Win32Font
+ _font_class = Win32Font
+ elif pyglet.options['font'][0] == 'gdiplus':
+ from pyglet.font.win32 import GDIPlusFont
+ _font_class = GDIPlusFont
+ else:
+ assert False, 'Unknown font driver'
+ else:
+ from pyglet.font.freetype import FreeTypeFont
+ _font_class = FreeTypeFont
+
+
+def have_font(name):
+ """Check if specified system font name is available."""
+ return _font_class.have_font(name)
+
+
+def load(name=None, size=None, bold=False, italic=False, dpi=None):
+ """Load a font for rendering.
+
+ :Parameters:
+ `name` : str, or list of str
+ Font family, for example, "Times New Roman". If a list of names
+ is provided, the first one matching a known font is used. If no
+ font can be matched to the name(s), a default font is used. In
+ pyglet 1.1, the name may be omitted.
+ `size` : float
+ Size of the font, in points. The returned font may be an exact
+ match or the closest available. In pyglet 1.1, the size may be
+ omitted, and defaults to 12pt.
+ `bold` : bool
+ If True, a bold variant is returned, if one exists for the given
+ family and size.
+ `italic` : bool
+ If True, an italic variant is returned, if one exists for the given
+ family and size.
+ `dpi` : float
+ The assumed resolution of the display device, for the purposes of
+ determining the pixel size of the font. Defaults to 96.
+
+ :rtype: `Font`
+ """
+ # Arbitrary default size
+ if size is None:
+ size = 12
+
+ if dpi is None:
+ dpi = 96
+
+ # Find first matching name
+ if type(name) in (tuple, list):
+ for n in name:
+ if _font_class.have_font(n):
+ name = n
+ break
+ else:
+ name = None
+
+ # Locate or create font cache
+ shared_object_space = gl.current_context.object_space
+ if not hasattr(shared_object_space, 'pyglet_font_font_cache'):
+ shared_object_space.pyglet_font_font_cache = \
+ weakref.WeakValueDictionary()
+ shared_object_space.pyglet_font_font_hold = []
+ font_cache = shared_object_space.pyglet_font_font_cache
+ font_hold = shared_object_space.pyglet_font_font_hold
+
+ # Look for font name in font cache
+ descriptor = (name, size, bold, italic, dpi)
+ if descriptor in font_cache:
+ return font_cache[descriptor]
+
+ # Not in cache, create from scratch
+ font = _font_class(name, size, bold=bold, italic=italic, dpi=dpi)
+
+ # Save parameters for new-style layout classes to recover
+ font.name = name
+ font.size = size
+ font.bold = bold
+ font.italic = italic
+ font.dpi = dpi
+
+ # Cache font in weak-ref dictionary to avoid reloading while still in use
+ font_cache[descriptor] = font
+
+ # Hold onto refs of last three loaded fonts to prevent them being
+ # collected if momentarily dropped.
+ del font_hold[3:]
+ font_hold.insert(0, font)
+
+ return font
+
+def add_file(font):
+ """Add a font to pyglet's search path.
+
+ In order to load a font that is not installed on the system, you must
+ call this method to tell pyglet that it exists. You can supply
+ either a filename or any file-like object.
+
+ The font format is platform-dependent, but is typically a TrueType font
+ file containing a single font face. Note that to use a font added with this method,
+ you should pass the face name (not the file name) to :meth::py:func:`pyglet.font.load` or any
+ other place where you normally specify a font.
+
+ :Parameters:
+ `font` : str or file-like object
+ Filename or file-like object to load fonts from.
+
+ """
+ if isinstance(font, basestring):
+ font = open(font, 'rb')
+ if hasattr(font, 'read'):
+ font = font.read()
+ _font_class.add_font_data(font)
+
+
+def add_directory(dir):
+ """Add a directory of fonts to pyglet's search path.
+
+ This function simply calls :meth:`pyglet.font.add_file` for each file with a ``.ttf``
+ extension in the given directory. Subdirectories are not searched.
+
+ :Parameters:
+ `dir` : str
+ Directory that contains font files.
+
+ """
+ for file in os.listdir(dir):
+ if file[-4:].lower() == '.ttf':
+ add_file(os.path.join(dir, file))
+
+
+from .text import Text
+__all__ = ('Text', 'add_file', 'add_directory', 'load', 'have_font')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/base.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/base.py
new file mode 100644
index 0000000..7082dc3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/base.py
@@ -0,0 +1,449 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Abstract classes used by pyglet.font implementations.
+
+These classes should not be constructed directly. Instead, use the functions
+in `pyglet.font` to obtain platform-specific instances. You can use these
+classes as a documented interface to the concrete classes.
+'''
+from builtins import chr
+from builtins import str
+from builtins import map
+from builtins import range
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import unicodedata
+
+from pyglet.gl import *
+from pyglet import image
+
+_other_grapheme_extend = \
+ list(map(chr, [0x09be, 0x09d7, 0x0be3, 0x0b57, 0x0bbe, 0x0bd7, 0x0cc2,
+ 0x0cd5, 0x0cd6, 0x0d3e, 0x0d57, 0x0dcf, 0x0ddf, 0x200c,
+ 0x200d, 0xff9e, 0xff9f])) # skip codepoints above U+10000
+_logical_order_exception = \
+ list(map(chr, list(range(0xe40, 0xe45)) + list(range(0xec0, 0xec4))))
+
+_grapheme_extend = lambda c, cc: \
+ cc in ('Me', 'Mn') or c in _other_grapheme_extend
+
+_CR = u'\u000d'
+_LF = u'\u000a'
+_control = lambda c, cc: cc in ('ZI', 'Zp', 'Cc', 'Cf') and not \
+ c in list(map(chr, [0x000d, 0x000a, 0x200c, 0x200d]))
+_extend = lambda c, cc: _grapheme_extend(c, cc) or \
+ c in list(map(chr, [0xe30, 0xe32, 0xe33, 0xe45, 0xeb0, 0xeb2, 0xeb3]))
+_prepend = lambda c, cc: c in _logical_order_exception
+_spacing_mark = lambda c, cc: cc == 'Mc' and c not in _other_grapheme_extend
+
+def _grapheme_break(left, right):
+ # GB1
+ if left is None:
+ return True
+
+ # GB2 not required, see end of get_grapheme_clusters
+
+ # GB3
+ if left == _CR and right == _LF:
+ return False
+
+ left_cc = unicodedata.category(left)
+
+ # GB4
+ if _control(left, left_cc):
+ return True
+
+ right_cc = unicodedata.category(right)
+
+ # GB5
+ if _control(right, right_cc):
+ return True
+
+ # GB6, GB7, GB8 not implemented
+
+ # GB9
+ if _extend(right, right_cc):
+ return False
+
+ # GB9a
+ if _spacing_mark(right, right_cc):
+ return False
+
+ # GB9b
+ if _prepend(left, left_cc):
+ return False
+
+ # GB10
+ return True
+
+def get_grapheme_clusters(text):
+ '''Implements Table 2 of UAX #29: Grapheme Cluster Boundaries.
+
+ Does not currently implement Hangul syllable rules.
+
+ :Parameters:
+ `text` : unicode
+ String to cluster.
+
+ .. versionadded:: 1.1.2
+
+ :rtype: List of `unicode`
+ :return: List of Unicode grapheme clusters
+ '''
+ clusters = []
+ cluster = ''
+ left = None
+ for right in text:
+ if cluster and _grapheme_break(left, right):
+ clusters.append(cluster)
+ cluster = ''
+ elif cluster:
+ # Add a zero-width space to keep len(clusters) == len(text)
+ clusters.append(u'\u200b')
+ cluster += right
+ left = right
+
+ # GB2
+ if cluster:
+ clusters.append(cluster)
+ return clusters
+
+class Glyph(image.TextureRegion):
+ '''A single glyph located within a larger texture.
+
+ Glyphs are drawn most efficiently using the higher level APIs, for example
+ `GlyphString`.
+
+ :Ivariables:
+ `advance` : int
+ The horizontal advance of this glyph, in pixels.
+ `vertices` : (int, int, int, int)
+ The vertices of this glyph, with (0,0) originating at the
+ left-side bearing at the baseline.
+
+ '''
+
+ advance = 0
+ vertices = (0, 0, 0, 0)
+
+ def set_bearings(self, baseline, left_side_bearing, advance):
+ '''Set metrics for this glyph.
+
+ :Parameters:
+ `baseline` : int
+ Distance from the bottom of the glyph to its baseline;
+ typically negative.
+ `left_side_bearing` : int
+ Distance to add to the left edge of the glyph.
+ `advance` : int
+ Distance to move the horizontal advance to the next glyph.
+
+ '''
+ self.advance = advance
+ self.vertices = (
+ left_side_bearing,
+ -baseline,
+ left_side_bearing + self.width,
+ -baseline + self.height)
+
+ def draw(self):
+ '''Debug method.
+
+ Use the higher level APIs for performance and kerning.
+ '''
+ glBindTexture(GL_TEXTURE_2D, self.owner.id)
+ glBegin(GL_QUADS)
+ self.draw_quad_vertices()
+ glEnd()
+
+ def draw_quad_vertices(self):
+ '''Debug method.
+
+ Use the higher level APIs for performance and kerning.
+ '''
+ glTexCoord3f(*self.tex_coords[:3])
+ glVertex2f(self.vertices[0], self.vertices[1])
+ glTexCoord3f(*self.tex_coords[3:6])
+ glVertex2f(self.vertices[2], self.vertices[1])
+ glTexCoord3f(*self.tex_coords[6:9])
+ glVertex2f(self.vertices[2], self.vertices[3])
+ glTexCoord3f(*self.tex_coords[9:12])
+ glVertex2f(self.vertices[0], self.vertices[3])
+
+ def get_kerning_pair(self, right_glyph):
+ '''Not implemented.
+ '''
+ return 0
+
+class GlyphTextureAtlas(image.Texture):
+ '''A texture within which glyphs can be drawn.
+ '''
+ region_class = Glyph
+ x = 0
+ y = 0
+ line_height = 0
+
+ def apply_blend_state(self):
+ '''Set the OpenGL blend state for the glyphs in this texture.
+ '''
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+ glEnable(GL_BLEND)
+
+ def fit(self, image):
+ '''Place `image` within this texture.
+
+ :Parameters:
+ `image` : `pyglet.image.AbstractImage`
+ Image to place within the texture.
+
+ :rtype: `Glyph`
+ :return: The glyph representing the image from this texture, or None
+ if the image doesn't fit.
+ '''
+ if image.width > self.width or image.height > self.height:
+ return None
+
+ if self.x + image.width > self.width:
+ self.x = 0
+ self.y += self.line_height + 1
+ self.line_height = 0
+ if self.y + image.height > self.height:
+ return None
+
+ self.line_height = max(self.line_height, image.height)
+ region = self.get_region(
+ self.x, self.y, image.width, image.height)
+ if image.width > 0:
+ region.blit_into(image, 0, 0, 0)
+ self.x += image.width + 1
+ return region
+
+class GlyphRenderer(object):
+ '''Abstract class for creating glyph images.
+ '''
+ def __init__(self, font):
+ pass
+
+ def render(self, text):
+ raise NotImplementedError('Subclass must override')
+
+class FontException(Exception):
+ '''Generic exception related to errors from the font module. Typically
+ these relate to invalid font data.'''
+ pass
+
+class Font(object):
+ '''Abstract font class able to produce glyphs.
+
+ To construct a font, use :py:func:`pyglet.font.load`, which will instantiate the
+ platform-specific font class.
+
+ Internally, this class is used by the platform classes to manage the set
+ of textures into which glyphs are written.
+
+ :Ivariables:
+ `ascent` : int
+ Maximum ascent above the baseline, in pixels.
+ `descent` : int
+ Maximum descent below the baseline, in pixels. Usually negative.
+ '''
+ texture_width = 256
+ texture_height = 256
+ texture_internalformat = GL_ALPHA
+
+ # These should also be set by subclass when known
+ ascent = 0
+ descent = 0
+
+ glyph_renderer_class = GlyphRenderer
+ texture_class = GlyphTextureAtlas
+
+ def __init__(self):
+ self.textures = []
+ self.glyphs = {}
+
+ @classmethod
+ def add_font_data(cls, data):
+ '''Add font data to the font loader.
+
+ This is a class method and affects all fonts loaded. Data must be
+ some byte string of data, for example, the contents of a TrueType font
+ file. Subclasses can override this method to add the font data into
+ the font registry.
+
+ There is no way to instantiate a font given the data directly, you
+ must use :py:func:`pyglet.font.load` specifying the font name.
+ '''
+ pass
+
+ @classmethod
+ def have_font(cls, name):
+ '''Determine if a font with the given name is installed.
+
+ :Parameters:
+ `name` : str
+ Name of a font to search for
+
+ :rtype: bool
+ '''
+ return True
+
+ def create_glyph(self, image):
+ '''Create a glyph using the given image.
+
+ This is used internally by `Font` subclasses to add glyph data
+ to the font. Glyphs are packed within large textures maintained by
+ `Font`. This method inserts the image into a font texture and returns
+ a glyph reference; it is up to the subclass to add metadata to the
+ glyph.
+
+ Applications should not use this method directly.
+
+ :Parameters:
+ `image` : `pyglet.image.AbstractImage`
+ The image to write to the font texture.
+
+ :rtype: `Glyph`
+ '''
+ glyph = None
+ self._adapt_texture_size(image)
+ for texture in self.textures:
+ glyph = texture.fit(image)
+ if glyph:
+ break
+ if not glyph:
+ texture = self.texture_class.create_for_size(GL_TEXTURE_2D,
+ self.texture_width, self.texture_height,
+ self.texture_internalformat)
+ self.textures.insert(0, texture)
+ glyph = texture.fit(image)
+ return glyph
+
+ def _adapt_texture_size(self, image):
+ if image.width > self.texture_width or \
+ image.height > self.texture_height:
+ largest_dimension = max(image.width, image.height)
+ self.texture_height = self.texture_width = largest_dimension * 4
+
+ def get_glyphs(self, text):
+ '''Create and return a list of Glyphs for `text`.
+
+ If any characters do not have a known glyph representation in this
+ font, a substitution will be made.
+
+ :Parameters:
+ `text` : str or unicode
+ Text to render.
+
+ :rtype: list of `Glyph`
+ '''
+ glyph_renderer = None
+ glyphs = [] # glyphs that are committed.
+ for c in get_grapheme_clusters(str(text)):
+ # Get the glyph for 'c'. Hide tabs (Windows and Linux render
+ # boxes)
+ if c == '\t':
+ c = ' '
+ if c not in self.glyphs:
+ if not glyph_renderer:
+ glyph_renderer = self.glyph_renderer_class(self)
+ self.glyphs[c] = glyph_renderer.render(c)
+ glyphs.append(self.glyphs[c])
+ return glyphs
+
+
+ def get_glyphs_for_width(self, text, width):
+ '''Return a list of glyphs for `text` that fit within the given width.
+
+ If the entire text is larger than 'width', as much as possible will be
+ used while breaking after a space or zero-width space character. If a
+ newline is encountered in text, only text up to that newline will be
+ used. If no break opportunities (newlines or spaces) occur within
+ `width`, the text up to the first break opportunity will be used (this
+ will exceed `width`). If there are no break opportunities, the entire
+ text will be used.
+
+ You can assume that each character of the text is represented by
+ exactly one glyph; so the amount of text "used up" can be determined
+ by examining the length of the returned glyph list.
+
+ :Parameters:
+ `text` : str or unicode
+ Text to render.
+ `width` : int
+ Maximum width of returned glyphs.
+
+ :rtype: list of `Glyph`
+
+ :see: `GlyphString`
+ '''
+ glyph_renderer = None
+ glyph_buffer = [] # next glyphs to be added, as soon as a BP is found
+ glyphs = [] # glyphs that are committed.
+ for c in text:
+ if c == '\n':
+ glyphs += glyph_buffer
+ break
+
+ # Get the glyph for 'c'
+ if c not in self.glyphs:
+ if not glyph_renderer:
+ glyph_renderer = self.glyph_renderer_class(self)
+ self.glyphs[c] = glyph_renderer.render(c)
+ glyph = self.glyphs[c]
+
+ # Add to holding buffer and measure
+ glyph_buffer.append(glyph)
+ width -= glyph.advance
+
+ # If over width and have some committed glyphs, finish.
+ if width <= 0 and len(glyphs) > 0:
+ break
+
+ # If a valid breakpoint, commit holding buffer
+ if c in u'\u0020\u200b':
+ glyphs += glyph_buffer
+ glyph_buffer = []
+
+ # If nothing was committed, commit everything (no breakpoints found).
+ if len(glyphs) == 0:
+ glyphs = glyph_buffer
+
+ return glyphs
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/carbon.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/carbon.py
new file mode 100644
index 0000000..4333cdd
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/carbon.py
@@ -0,0 +1,438 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+# TODO Tiger and later: need to set kWindowApplicationScaledAttribute for DPI
+# independence?
+
+from ctypes import *
+import math
+from sys import byteorder
+
+from pyglet.font import base
+import pyglet.image
+from pyglet.libs.darwin import *
+from pyglet.libs.darwin import _oscheck
+
+class FixedPoint(Structure):
+ _fields_ = [
+ ('x', Fixed),
+ ('y', Fixed)
+ ]
+
+class ATSTrapezoid(Structure):
+ _fields_ = [
+ ('upperLeft', FixedPoint),
+ ('upperRight', FixedPoint),
+ ('lowerRight', FixedPoint),
+ ('lowerLeft', FixedPoint)
+ ]
+
+# TODO: most of the ATS and CG here not used any more.
+
+CGGlyph = c_ushort
+ATSUFontID = c_uint32
+RGBColor = c_short * 3
+ATSURGBAlphaColor = c_float * 4
+
+kCGImageAlphaNone = 0
+kCGImageAlphaPremultipliedLast = 1
+kCGTextFill = 0
+
+kATSUInvalidFontErr = -8796
+
+kATSFontContextUnspecified = 0
+kATSFontContextGlobal = 1
+kATSFontContextLocal = 2
+
+kATSFontFilterSelectorUnspecified = 0
+kATSFontFilterSelectorGeneration = 3
+kATSFontFilterSelectorFontFamily = 7
+kATSFontFilterSelectorFontFamilyApplierFunction = 8
+kATSFontFilterSelectorFontApplierFunction = 9
+
+kATSOptionFlagsDoNotNotify = 0x00000001 << 8
+kATSOptionFlagsIterationScopeMask = 0x00000007 << 12
+kATSOptionFlagsDefaultScope = 0x00000000 << 12
+kATSOptionFlagsUnRestrictedScope = 0x00000001 << 12
+kATSOptionFlagsRestrictedScope = 0x00000002 << 12
+kATSOptionFlagsProcessSubdirectories = 0x00000001 << 6
+
+kATSUFromTextBeginning = c_ulong(0xFFFFFFFF)
+kATSUToTextEnd = c_ulong(0xFFFFFFFF)
+
+kATSULineAscentTag = 8
+kATSULineDescentTag = 9
+ATSUTextMeasurement = Fixed
+
+kATSUQDBoldfaceTag = 256
+kATSUQDItalicTag = 257
+kATSUFontTag = 261
+kATSUSizeTag = 262
+kATSUCGContextTag = 32767
+kATSUColorTag = 263
+kATSURGBAlphaColorTag = 288
+
+kATSULineWidthTag = 1
+
+kFontFullName = 4
+kFontNoPlatformCode = c_ulong(-1)
+kFontNoScriptCode = c_ulong(-1)
+kFontNoLanguageCode = c_ulong(-1)
+
+kATSUseDeviceOrigins = 1
+
+kATSFontFormatUnspecified = 0
+kATSFontContextLocal = 2
+
+carbon.CGColorSpaceCreateWithName.restype = c_void_p
+carbon.CGBitmapContextCreate.restype = POINTER(c_void_p)
+
+UniCharArrayOffset = c_uint32
+UniCharCount = c_uint32
+
+kATSULayoutOperationJustification = 1
+kATSULayoutOperationPostLayoutAdjustment = 0x20
+kATSULayoutOperationCallbackStatusHandled = 0
+kATSULayoutOperationCallbackStatusContinue = c_long(1)
+kATSULayoutOperationOverrideTag = 15
+kATSUDirectDataAdvanceDeltaFixedArray = 0
+kATSUDirectDataDeviceDeltaSInt16Array = 2
+kATSUDirectDataLayoutRecordATSLayoutRecordVersion1 = 100
+
+ATSUDirectLayoutOperationOverrideUPP = CFUNCTYPE(c_int,
+ c_int, c_void_p, c_uint32, c_void_p, POINTER(c_int))
+
+class ATSULayoutOperationOverrideSpecifier(Structure):
+ _fields_ = [
+ ('operationSelector', c_uint32),
+ ('overrideUPP', ATSUDirectLayoutOperationOverrideUPP)
+ ]
+
+class ATSLayoutRecord(Structure):
+ _pack_ = 2
+ _fields_ = [
+ ('glyphID', c_uint16),
+ ('flags', c_uint32),
+ ('originalOffset', c_uint32),
+ ('realPos', Fixed),
+ ]
+
+def fixed(value):
+ return c_int32(carbon.Long2Fix(c_long(int(value))))
+
+carbon.Fix2X.restype = c_double
+def fix2float(value):
+ return carbon.Fix2X(value)
+
+def create_atsu_style(attributes):
+ # attributes is a dict of ATSUAttributeTag => ctypes value
+ tags, values = zip(*attributes.items())
+ tags = (c_int * len(tags))(*tags)
+ sizes = (c_uint * len(values))(*[sizeof(v) for v in values])
+ values = (c_void_p * len(values))(*[cast(pointer(v), c_void_p) \
+ for v in values])
+
+ style = c_void_p()
+ carbon.ATSUCreateStyle(byref(style))
+ carbon.ATSUSetAttributes(style, len(tags), tags, sizes, values)
+ return style
+
+def set_layout_attributes(layout, attributes):
+ if attributes:
+ # attributes is a dict of ATSUAttributeTag => ctypes value
+ tags, values = zip(*attributes.items())
+ tags = (c_int * len(tags))(*tags)
+ sizes = (c_uint * len(values))(*[sizeof(v) for v in values])
+ values = (c_void_p * len(values))(*[cast(pointer(v), c_void_p) \
+ for v in values])
+
+ r = carbon.ATSUSetLayoutControls(layout, len(tags), tags, sizes, values)
+ _oscheck(r)
+
+def str_ucs2(text):
+ if byteorder == 'big':
+ text = text.encode('utf_16_be')
+ else:
+ text = text.encode('utf_16_le') # explicit endian avoids BOM
+ return create_string_buffer(text + '\0')
+
+
+class CarbonGlyphRenderer(base.GlyphRenderer):
+ _bitmap = None
+ _bitmap_context = None
+ _bitmap_rect = None
+
+ _glyph_advance = 0 # set through callback
+
+ def __init__(self, font):
+ super(CarbonGlyphRenderer, self).__init__(font)
+ self._create_bitmap_context(256, 256)
+ self.font = font
+
+ def __del__(self):
+ try:
+ if self._bitmap_context:
+ carbon.CGContextRelease(self._bitmap_context)
+ except:
+ pass
+
+ def _layout_callback(self, operation, line, ref, extra, callback_status):
+ if not line:
+ return 0
+
+ records = c_void_p()
+ n_records = c_uint()
+
+ r = carbon.ATSUDirectGetLayoutDataArrayPtrFromLineRef(line,
+ kATSUDirectDataLayoutRecordATSLayoutRecordVersion1,
+ 0,
+ byref(records),
+ byref(n_records))
+ _oscheck(r)
+
+ records = cast(records,
+ POINTER(ATSLayoutRecord * n_records.value)).contents
+ self._glyph_advance = fix2float(records[-1].realPos)
+
+ callback_status.contents = kATSULayoutOperationCallbackStatusContinue
+ return 0
+
+ def render(self, text):
+ # Convert text to UCS2
+ text_len = len(text)
+ text_ucs2 = str_ucs2(text)
+
+ # Create layout override handler to extract device advance value.
+ override_spec = ATSULayoutOperationOverrideSpecifier()
+ override_spec.operationSelector = \
+ kATSULayoutOperationPostLayoutAdjustment
+ override_spec.overrideUPP = \
+ ATSUDirectLayoutOperationOverrideUPP(self._layout_callback)
+
+ # Create ATSU text layout for this text and font
+ layout = c_void_p()
+ carbon.ATSUCreateTextLayout(byref(layout))
+ set_layout_attributes(layout, {
+ kATSUCGContextTag: self._bitmap_context,
+ kATSULayoutOperationOverrideTag: override_spec})
+ carbon.ATSUSetTextPointerLocation(layout,
+ text_ucs2,
+ kATSUFromTextBeginning,
+ kATSUToTextEnd,
+ text_len)
+ carbon.ATSUSetRunStyle(layout, self.font.atsu_style,
+ kATSUFromTextBeginning, kATSUToTextEnd)
+
+ # Turning on transient font matching screws up font layout
+ # predictability when strange fonts are installed
+ # Don't believe this. Can't get foreign/special characters
+ # without transient on.
+ carbon.ATSUSetTransientFontMatching(layout, True)
+
+ # Get bitmap dimensions required
+ rect = Rect()
+ carbon.ATSUMeasureTextImage(layout,
+ kATSUFromTextBeginning,
+ kATSUToTextEnd,
+ 0, 0,
+ byref(rect))
+ image_width = rect.right - rect.left + 2
+ image_height = rect.bottom - rect.top + 2
+ baseline = rect.bottom + 1
+ lsb = rect.left
+
+ # Resize Quartz context if necessary
+ if (image_width > self._bitmap_rect.size.width or
+ image_height > self._bitmap_rect.size.height):
+ self._create_bitmap_context(
+ int(max(image_width, self._bitmap_rect.size.width)),
+ int(max(image_height, self._bitmap_rect.size.height)))
+
+ set_layout_attributes(layout, {
+ kATSUCGContextTag: self._bitmap_context})
+
+ # Draw to the bitmap
+ carbon.CGContextClearRect(self._bitmap_context, self._bitmap_rect)
+ carbon.ATSUDrawText(layout,
+ 0,
+ kATSUToTextEnd,
+ fixed(-lsb + 1), fixed(baseline))
+
+ advance = self._glyph_advance
+
+ # Round advance to nearest int. It actually looks good with sub-pixel
+ # advance as well -- Helvetica at 12pt is more tightly spaced, but
+ # Times New Roman at 12pt is too light. With integer positioning
+ # overall look seems darker and perhaps more uniform. It's also more
+ # similar (programmatically) to Win32 and FreeType. Still, worth
+ # messing around with (comment out next line) if you're interested.
+ advance = int(round(advance))
+
+ # Fix advance for zero-width space
+ if text == u'\u200b':
+ advance = 0
+
+ # A negative pitch is required, but it is much faster to load the
+ # glyph upside-down and flip the tex_coords. Note region used
+ # to start at top of glyph image.
+ pitch = int(4 * self._bitmap_rect.size.width)
+ image = pyglet.image.ImageData(image_width,
+ self._bitmap_rect.size.height, 'RGBA', self._bitmap, pitch)
+ skip_rows = int(self._bitmap_rect.size.height - image_height)
+ image = image.get_region(0, skip_rows, image.width, image_height)
+ glyph = self.font.create_glyph(image)
+ glyph.set_bearings(baseline, lsb - 1, int(advance))
+ t = list(glyph.tex_coords)
+ glyph.tex_coords = t[9:12] + t[6:9] + t[3:6] + t[:3]
+
+ return glyph
+
+ def _create_bitmap_context(self, width, height):
+ '''Create or recreate bitmap and Quartz context.'''
+ if self._bitmap_context:
+ carbon.CGContextRelease(self._bitmap_context)
+ components = 4
+ pitch = width * components
+ self._bitmap = (c_ubyte * (pitch * height))()
+ color_space = carbon.CGColorSpaceCreateDeviceRGB()
+ context = carbon.CGBitmapContextCreate(self._bitmap,
+ width, height, 8, pitch,
+ color_space, kCGImageAlphaPremultipliedLast)
+ carbon.CGColorSpaceRelease(color_space)
+
+ # Disable RGB decimated antialiasing, use standard
+ # antialiasing which won't break alpha.
+ carbon.CGContextSetShouldSmoothFonts(context, False)
+ carbon.CGContextSetShouldAntialias(context, True)
+
+ self._bitmap_context = context
+ self._bitmap_rect = CGRect()
+ self._bitmap_rect.origin.x = 0
+ self._bitmap_rect.origin.y = 0
+ self._bitmap_rect.size.width = width
+ self._bitmap_rect.size.height = height
+
+
+class CarbonFont(base.Font):
+ glyph_renderer_class = CarbonGlyphRenderer
+
+ def __init__(self, name, size, bold=False, italic=False, dpi=None):
+ super(CarbonFont, self).__init__()
+
+ if not name:
+ name = 'Helvetica'
+
+ if dpi is None:
+ dpi = 96 # pyglet 1.1; in pyglet 1.0 this was 72.
+
+ # If application is not DPI-aware, DPI is fixed at 72. Scale
+ # font size to emulate other DPI. This will need to be fixed if issue
+ # #87 is implemented.
+ size = size * dpi / 72.
+
+ name = name.encode('ascii', 'ignore')
+
+ font_id = ATSUFontID()
+ carbon.ATSUFindFontFromName(
+ name,
+ len(name),
+ kFontFullName,
+ kFontNoPlatformCode,
+ kFontNoScriptCode,
+ kFontNoLanguageCode,
+ byref(font_id))
+
+ attributes = {
+ kATSUSizeTag: fixed(size),
+ kATSUFontTag: font_id,
+ kATSURGBAlphaColorTag: ATSURGBAlphaColor(1, 1, 1, 1),
+ kATSUQDBoldfaceTag: c_byte(bold),
+ kATSUQDItalicTag: c_byte(italic)
+ }
+ self.atsu_style = create_atsu_style(attributes)
+
+ self.calculate_metrics()
+
+ @classmethod
+ def have_font(cls, name):
+ font_id = ATSUFontID()
+ name = name.encode('ascii', 'ignore')
+ r = carbon.ATSUFindFontFromName(
+ name,
+ len(name),
+ kFontFullName,
+ kFontNoPlatformCode,
+ kFontNoScriptCode,
+ kFontNoLanguageCode,
+ byref(font_id))
+ return r != kATSUInvalidFontErr
+
+ def calculate_metrics(self):
+ # It seems the only way to get the font's ascent and descent is to lay
+ # out some glyphs and measure them.
+
+ # fake ucs2 string
+ text = '\0a'
+
+ layout = c_void_p()
+ carbon.ATSUCreateTextLayout(byref(layout))
+ carbon.ATSUSetTextPointerLocation(layout, text,
+ kATSUFromTextBeginning, kATSUToTextEnd, 1)
+ carbon.ATSUSetRunStyle(layout, self.atsu_style,
+ kATSUFromTextBeginning, kATSUToTextEnd)
+
+ # determine the metrics for this font only
+ carbon.ATSUSetTransientFontMatching(layout, False)
+
+ value = ATSUTextMeasurement()
+ carbon.ATSUGetLineControl(layout, 0, kATSULineAscentTag,
+ sizeof(value), byref(value), None)
+ self.ascent = int(math.ceil(fix2float(value)))
+ carbon.ATSUGetLineControl(layout, 0, kATSULineDescentTag,
+ sizeof(value), byref(value), None)
+ self.descent = -int(math.ceil(fix2float(value)))
+
+ @classmethod
+ def add_font_data(cls, data):
+ container = c_void_p()
+ r = carbon.ATSFontActivateFromMemory(data, len(data),
+ kATSFontContextLocal, kATSFontFormatUnspecified, None, 0,
+ byref(container))
+ _oscheck(r)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/fontconfig.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/fontconfig.py
new file mode 100644
index 0000000..73a2670
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/fontconfig.py
@@ -0,0 +1,398 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+"""
+Wrapper around the Linux FontConfig library. Used to find available fonts.
+"""
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+from collections import OrderedDict
+from ctypes import *
+
+import pyglet.lib
+from pyglet.compat import asbytes, asstr
+from pyglet.font.base import FontException
+
+# fontconfig library definitions
+
+(FcResultMatch,
+ FcResultNoMatch,
+ FcResultTypeMismatch,
+ FcResultNoId,
+ FcResultOutOfMemory) = range(5)
+FcResult = c_int
+
+FC_FAMILY = asbytes('family')
+FC_SIZE = asbytes('size')
+FC_SLANT = asbytes('slant')
+FC_WEIGHT = asbytes('weight')
+FC_FT_FACE = asbytes('ftface')
+FC_FILE = asbytes('file')
+
+FC_WEIGHT_REGULAR = 80
+FC_WEIGHT_BOLD = 200
+
+FC_SLANT_ROMAN = 0
+FC_SLANT_ITALIC = 100
+
+(FcTypeVoid,
+ FcTypeInteger,
+ FcTypeDouble,
+ FcTypeString,
+ FcTypeBool,
+ FcTypeMatrix,
+ FcTypeCharSet,
+ FcTypeFTFace,
+ FcTypeLangSet) = range(9)
+FcType = c_int
+
+(FcMatchPattern,
+ FcMatchFont) = range(2)
+FcMatchKind = c_int
+
+
+class _FcValueUnion(Union):
+ _fields_ = [
+ ('s', c_char_p),
+ ('i', c_int),
+ ('b', c_int),
+ ('d', c_double),
+ ('m', c_void_p),
+ ('c', c_void_p),
+ ('f', c_void_p),
+ ('p', c_void_p),
+ ('l', c_void_p),
+ ]
+
+
+class FcValue(Structure):
+ _fields_ = [
+ ('type', FcType),
+ ('u', _FcValueUnion)
+ ]
+
+# End of library definitions
+
+
+class FontConfig(object):
+ def __init__(self):
+ self._fontconfig = self._load_fontconfig_library()
+ self._search_cache = OrderedDict()
+ self._cache_size = 20
+
+ def dispose(self):
+ while len(self._search_cache) > 0:
+ self._search_cache.popitem().dispose()
+
+ self._fontconfig.FcFini()
+ self._fontconfig = None
+
+ def create_search_pattern(self):
+ return FontConfigSearchPattern(self._fontconfig)
+
+ def find_font(self, name, size=12, bold=False, italic=False):
+ result = self._get_from_search_cache(name, size, bold, italic)
+ if result:
+ return result
+
+ search_pattern = self.create_search_pattern()
+ search_pattern.name = name
+ search_pattern.size = size
+ search_pattern.bold = bold
+ search_pattern.italic = italic
+
+ result = search_pattern.match()
+ self._add_to_search_cache(search_pattern, result)
+ search_pattern.dispose()
+ return result
+
+ def have_font(self, name):
+ result = self.find_font(name)
+ if result:
+ # Check the name matches, fontconfig can return a default
+ if name and result.name and result.name.lower() != name.lower():
+ return False
+ return True
+ else:
+ return False
+
+ def char_index(self, ft_face, character):
+ return self._fontconfig.FcFreeTypeCharIndex(ft_face, ord(character))
+
+ def _add_to_search_cache(self, search_pattern, result_pattern):
+ self._search_cache[(search_pattern.name,
+ search_pattern.size,
+ search_pattern.bold,
+ search_pattern.italic)] = result_pattern
+ if len(self._search_cache) > self._cache_size:
+ self._search_cache.popitem(last=False)[1].dispose()
+
+ def _get_from_search_cache(self, name, size, bold, italic):
+ result = self._search_cache.get((name, size, bold, italic), None)
+
+ if result and result.is_valid:
+ return result
+ else:
+ return None
+
+ @staticmethod
+ def _load_fontconfig_library():
+ fontconfig = pyglet.lib.load_library('fontconfig')
+ fontconfig.FcInit()
+
+ fontconfig.FcPatternBuild.restype = c_void_p
+ fontconfig.FcPatternCreate.restype = c_void_p
+ fontconfig.FcFontMatch.restype = c_void_p
+ fontconfig.FcFreeTypeCharIndex.restype = c_uint
+
+ fontconfig.FcPatternAddDouble.argtypes = [c_void_p, c_char_p, c_double]
+ fontconfig.FcPatternAddInteger.argtypes = [c_void_p, c_char_p, c_int]
+ fontconfig.FcPatternAddString.argtypes = [c_void_p, c_char_p, c_char_p]
+ fontconfig.FcConfigSubstitute.argtypes = [c_void_p, c_void_p, c_int]
+ fontconfig.FcDefaultSubstitute.argtypes = [c_void_p]
+ fontconfig.FcFontMatch.argtypes = [c_void_p, c_void_p, c_void_p]
+ fontconfig.FcPatternDestroy.argtypes = [c_void_p]
+
+ fontconfig.FcPatternGetFTFace.argtypes = [c_void_p, c_char_p, c_int, c_void_p]
+ fontconfig.FcPatternGet.argtypes = [c_void_p, c_char_p, c_int, c_void_p]
+
+ return fontconfig
+
+
+class FontConfigPattern(object):
+ def __init__(self, fontconfig, pattern=None):
+ self._fontconfig = fontconfig
+ self._pattern = pattern
+
+ @property
+ def is_valid(self):
+ return self._fontconfig and self._pattern
+
+ def _create(self):
+ assert not self._pattern
+ assert self._fontconfig
+ self._pattern = self._fontconfig.FcPatternCreate()
+
+ def _destroy(self):
+ assert self._pattern
+ assert self._fontconfig
+ self._fontconfig.FcPatternDestroy(self._pattern)
+ self._pattern = None
+
+ @staticmethod
+ def _bold_to_weight(bold):
+ return FC_WEIGHT_BOLD if bold else FC_WEIGHT_REGULAR
+
+ @staticmethod
+ def _italic_to_slant(italic):
+ return FC_SLANT_ITALIC if italic else FC_SLANT_ROMAN
+
+ def _set_string(self, name, value):
+ assert self._pattern
+ assert name
+ assert self._fontconfig
+
+ if not value:
+ return
+
+ value = value.encode('utf8')
+
+ self._fontconfig.FcPatternAddString(self._pattern, name, asbytes(value))
+
+ def _set_double(self, name, value):
+ assert self._pattern
+ assert name
+ assert self._fontconfig
+
+ if not value:
+ return
+
+ self._fontconfig.FcPatternAddDouble(self._pattern, name, c_double(value))
+
+ def _set_integer(self, name, value):
+ assert self._pattern
+ assert name
+ assert self._fontconfig
+
+ if not value:
+ return
+
+ self._fontconfig.FcPatternAddInteger(self._pattern, name, c_int(value))
+
+ def _get_value(self, name):
+ assert self._pattern
+ assert name
+ assert self._fontconfig
+
+ value = FcValue()
+ result = self._fontconfig.FcPatternGet(self._pattern, name, 0, byref(value))
+ if _handle_fcresult(result):
+ return value
+ else:
+ return None
+
+ def _get_string(self, name):
+ value = self._get_value(name)
+
+ if value and value.type == FcTypeString:
+ return asstr(value.u.s)
+ else:
+ return None
+
+ def _get_face(self, name):
+ value = self._get_value(name)
+
+ if value and value.type == FcTypeFTFace:
+ return value.u.f
+ else:
+ return None
+
+ def _get_integer(self, name):
+ value = self._get_value(name)
+
+ if value and value.type == FcTypeInteger:
+ return value.u.i
+ else:
+ return None
+
+ def _get_double(self, name):
+ value = self._get_value(name)
+
+ if value and value.type == FcTypeDouble:
+ return value.u.d
+ else:
+ return None
+
+
+class FontConfigSearchPattern(FontConfigPattern):
+ def __init__(self, fontconfig):
+ super(FontConfigSearchPattern, self).__init__(fontconfig)
+
+ self.name = None
+ self.bold = False
+ self.italic = False
+ self.size = None
+
+ def match(self):
+ self._prepare_search_pattern()
+ result_pattern = self._get_match()
+
+ if result_pattern:
+ return FontConfigSearchResult(self._fontconfig, result_pattern)
+ else:
+ return None
+
+ def _prepare_search_pattern(self):
+ self._create()
+ self._set_string(FC_FAMILY, self.name)
+ self._set_double(FC_SIZE, self.size)
+ self._set_integer(FC_WEIGHT, self._bold_to_weight(self.bold))
+ self._set_integer(FC_SLANT, self._italic_to_slant(self.italic))
+
+ self._substitute_defaults()
+
+ def _substitute_defaults(self):
+ assert self._pattern
+ assert self._fontconfig
+
+ self._fontconfig.FcConfigSubstitute(None, self._pattern, FcMatchPattern)
+ self._fontconfig.FcDefaultSubstitute(self._pattern)
+
+ def _get_match(self):
+ assert self._pattern
+ assert self._fontconfig
+
+ match_result = FcResult()
+ match_pattern = self._fontconfig.FcFontMatch(0, self._pattern, byref(match_result))
+
+ if _handle_fcresult(match_result.value):
+ return match_pattern
+ else:
+ return None
+
+ def dispose(self):
+ self._destroy()
+
+
+class FontConfigSearchResult(FontConfigPattern):
+ def __init__(self, fontconfig, result_pattern):
+ super(FontConfigSearchResult, self).__init__(fontconfig, result_pattern)
+
+ @property
+ def name(self):
+ return self._get_string(FC_FAMILY)
+
+ @property
+ def size(self):
+ return self._get_double(FC_SIZE)
+
+ @property
+ def bold(self):
+ return self._get_integer(FC_WEIGHT) == FC_WEIGHT_BOLD
+
+ @property
+ def italic(self):
+ return self._get_integer(FC_SLANT) == FC_SLANT_ITALIC
+
+ @property
+ def face(self):
+ return self._get_face(FC_FT_FACE)
+
+ @property
+ def file(self):
+ return self._get_string(FC_FILE)
+
+ def dispose(self):
+ self._destroy()
+
+
+def _handle_fcresult(result):
+ if result == FcResultMatch:
+ return True
+ elif result in (FcResultNoMatch, FcResultTypeMismatch, FcResultNoId):
+ return False
+ elif result == FcResultOutOfMemory:
+ raise FontException('FontConfig ran out of memory.')
+
+
+_fontconfig_instance = None
+
+
+def get_fontconfig():
+ global _fontconfig_instance
+ if not _fontconfig_instance:
+ _fontconfig_instance = FontConfig()
+ return _fontconfig_instance
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/freetype.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/freetype.py
new file mode 100644
index 0000000..9484605
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/freetype.py
@@ -0,0 +1,361 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+from __future__ import division
+from builtins import object
+
+import ctypes
+from collections import namedtuple
+
+from pyglet.compat import asbytes, asstr
+from pyglet.font import base
+from pyglet import image
+from pyglet.font.fontconfig import get_fontconfig
+from pyglet.font.freetype_lib import *
+
+
+class FreeTypeGlyphRenderer(base.GlyphRenderer):
+ def __init__(self, font):
+ super(FreeTypeGlyphRenderer, self).__init__(font)
+ self.font = font
+
+ self._glyph_slot = None
+ self._bitmap = None
+
+ self._width = None
+ self._height = None
+ self._mode = None
+ self._pitch = None
+
+ self._baseline = None
+ self._lsb = None
+ self._advance_x = None
+
+ self._data = None
+
+ def _get_glyph(self, character):
+ assert self.font
+ assert len(character) == 1
+
+ self._glyph_slot = self.font.get_glyph_slot(character)
+ self._bitmap = self._glyph_slot.bitmap
+
+ def _get_glyph_metrics(self):
+ self._width = self._glyph_slot.bitmap.width
+ self._height = self._glyph_slot.bitmap.rows
+ self._mode = self._glyph_slot.bitmap.pixel_mode
+ self._pitch = self._glyph_slot.bitmap.pitch
+
+ self._baseline = self._height - self._glyph_slot.bitmap_top
+ self._lsb = self._glyph_slot.bitmap_left
+ self._advance_x = int(f26p6_to_float(self._glyph_slot.advance.x))
+
+ def _get_bitmap_data(self):
+ if self._mode == FT_PIXEL_MODE_MONO:
+ # BCF fonts always render to 1 bit mono, regardless of render
+ # flags. (freetype 2.3.5)
+ self._convert_mono_to_gray_bitmap()
+ elif self._mode == FT_PIXEL_MODE_GRAY:
+ # Usual case
+ assert self._glyph_slot.bitmap.num_grays == 256
+ self._data = self._glyph_slot.bitmap.buffer
+ else:
+ raise base.FontException('Unsupported render mode for this glyph')
+
+ def _convert_mono_to_gray_bitmap(self):
+ bitmap_data = cast(self._bitmap.buffer,
+ POINTER(c_ubyte * (self._pitch * self._height))).contents
+ data = (c_ubyte * (self._pitch * 8 * self._height))()
+ data_i = 0
+ for byte in bitmap_data:
+ # Data is MSB; left-most pixel in a byte has value 128.
+ data[data_i + 0] = (byte & 0x80) and 255 or 0
+ data[data_i + 1] = (byte & 0x40) and 255 or 0
+ data[data_i + 2] = (byte & 0x20) and 255 or 0
+ data[data_i + 3] = (byte & 0x10) and 255 or 0
+ data[data_i + 4] = (byte & 0x08) and 255 or 0
+ data[data_i + 5] = (byte & 0x04) and 255 or 0
+ data[data_i + 6] = (byte & 0x02) and 255 or 0
+ data[data_i + 7] = (byte & 0x01) and 255 or 0
+ data_i += 8
+ self._data = data
+ self._pitch <<= 3
+
+ def _create_glyph(self):
+ # In FT positive pitch means `down` flow, in Pyglet ImageData
+ # negative values indicate a top-to-bottom arrangement. So pitch must be inverted.
+ # Using negative pitch causes conversions, so much faster to just swap tex_coords
+ img = image.ImageData(self._width,
+ self._height,
+ 'A',
+ self._data,
+ abs(self._pitch))
+ glyph = self.font.create_glyph(img)
+ glyph.set_bearings(self._baseline, self._lsb, self._advance_x)
+ if self._pitch > 0:
+ t = list(glyph.tex_coords)
+ glyph.tex_coords = t[9:12] + t[6:9] + t[3:6] + t[:3]
+
+ return glyph
+
+ def render(self, text):
+ self._get_glyph(text[0])
+ self._get_glyph_metrics()
+ self._get_bitmap_data()
+ return self._create_glyph()
+
+
+FreeTypeFontMetrics = namedtuple('FreeTypeFontMetrics',
+ ['ascent', 'descent'])
+
+
+class MemoryFaceStore(object):
+ def __init__(self):
+ self._dict = {}
+
+ def add(self, face):
+ self._dict[face.name.lower(), face.bold, face.italic] = face
+
+ def contains(self, name):
+ lname = name and name.lower() or ''
+ return len([name for name, _, _ in self._dict.keys() if name == lname]) > 0
+
+ def get(self, name, bold, italic):
+ lname = name and name.lower() or ''
+ return self._dict.get((lname, bold, italic), None)
+
+
+class FreeTypeFont(base.Font):
+ glyph_renderer_class = FreeTypeGlyphRenderer
+
+ # Map font (name, bold, italic) to FreeTypeMemoryFace
+ _memory_faces = MemoryFaceStore()
+
+ def __init__(self, name, size, bold=False, italic=False, dpi=None):
+ super(FreeTypeFont, self).__init__()
+
+ self.name = name
+ self.size = size
+ self.bold = bold
+ self.italic = italic
+ self.dpi = dpi or 96 # as of pyglet 1.1; pyglet 1.0 had 72.
+
+ self._load_font_face()
+ self.metrics = self.face.get_font_metrics(self.size, self.dpi)
+
+ @property
+ def ascent(self):
+ return self.metrics.ascent
+
+ @property
+ def descent(self):
+ return self.metrics.descent
+
+ def get_glyph_slot(self, character):
+ glyph_index = self.face.get_character_index(character)
+ self.face.set_char_size(self.size, self.dpi)
+ return self.face.get_glyph_slot(glyph_index)
+
+ def _load_font_face(self):
+ self.face = self._memory_faces.get(self.name, self.bold, self.italic)
+ if self.face is None:
+ self._load_font_face_from_system()
+
+ def _load_font_face_from_system(self):
+ match = get_fontconfig().find_font(self.name, self.size, self.bold, self.italic)
+ if not match:
+ raise base.FontException('Could not match font "%s"' % self.name)
+ self.face = FreeTypeFace.from_fontconfig(match)
+
+ @classmethod
+ def have_font(cls, name):
+ if cls._memory_faces.contains(name):
+ return True
+ else:
+ return get_fontconfig().have_font(name)
+
+ @classmethod
+ def add_font_data(cls, data):
+ face = FreeTypeMemoryFace(data)
+ cls._memory_faces.add(face)
+
+
+class FreeTypeFace(object):
+ """FreeType typographic face object.
+
+ Keeps the reference count to the face at +1 as long as this object exists. If other objects
+ want to keep a face without a reference to this object, they should increase the reference
+ counter themselves and decrease it again when done.
+ """
+ def __init__(self, ft_face):
+ assert ft_face is not None
+ self.ft_face = ft_face
+ self._get_best_name()
+
+ @classmethod
+ def from_file(cls, file_name):
+ ft_library = ft_get_library()
+ ft_face = FT_Face()
+ FT_New_Face(ft_library,
+ asbytes(file_name),
+ 0,
+ byref(ft_face))
+ return cls(ft_face)
+
+ @classmethod
+ def from_fontconfig(cls, match):
+ if match.face is not None:
+ FT_Reference_Face(match.face)
+ return cls(match.face)
+ else:
+ if not match.file:
+ raise base.FontException('No filename for "%s"' % match.name)
+ return cls.from_file(match.file)
+
+ @property
+ def family_name(self):
+ return asstr(self.ft_face.contents.family_name)
+
+ @property
+ def style_flags(self):
+ return self.ft_face.contents.style_flags
+
+ @property
+ def bold(self):
+ return self.style_flags & FT_STYLE_FLAG_BOLD != 0
+
+ @property
+ def italic(self):
+ return self.style_flags & FT_STYLE_FLAG_ITALIC != 0
+
+ @property
+ def face_flags(self):
+ return self.ft_face.contents.face_flags
+
+ def __del__(self):
+ if self.ft_face is not None:
+ FT_Done_Face(self.ft_face)
+ self.ft_face = None
+
+ def set_char_size(self, size, dpi):
+ face_size = float_to_f26p6(size)
+ try:
+ FT_Set_Char_Size(self.ft_face,
+ 0,
+ face_size,
+ dpi,
+ dpi)
+ return True
+ except FreeTypeError as e:
+ # Error 0x17 indicates invalid pixel size, so font size cannot be changed
+ # TODO Warn the user?
+ if e.errcode == 0x17:
+ return False
+ else:
+ raise
+
+ def get_character_index(self, character):
+ return get_fontconfig().char_index(self.ft_face, character)
+
+ def get_glyph_slot(self, glyph_index):
+ FT_Load_Glyph(self.ft_face, glyph_index, FT_LOAD_RENDER)
+ return self.ft_face.contents.glyph.contents
+
+ def get_font_metrics(self, size, dpi):
+ if self.set_char_size(size, dpi):
+ metrics = self.ft_face.contents.size.contents.metrics
+ if metrics.ascender == 0 and metrics.descender == 0:
+ return self._get_font_metrics_workaround()
+ else:
+ return FreeTypeFontMetrics(ascent=int(f26p6_to_float(metrics.ascender)),
+ descent=int(f26p6_to_float(metrics.descender)))
+ else:
+ return self._get_font_metrics_workaround()
+
+ def _get_font_metrics_workaround(self):
+ # Workaround broken fonts with no metrics. Has been observed with
+ # courR12-ISO8859-1.pcf.gz: "Courier" "Regular"
+ #
+ # None of the metrics fields are filled in, so render a glyph and
+ # grab its height as the ascent, and make up an arbitrary
+ # descent.
+ i = self.get_character_index('X')
+ self.get_glyph_slot(i)
+ ascent=self.ft_face.contents.available_sizes.contents.height
+ return FreeTypeFontMetrics(ascent=ascent,
+ descent=-ascent // 4) # arbitrary.
+
+ def _get_best_name(self):
+ self.name = self.family_name
+ self._get_font_family_from_ttf
+
+ def _get_font_family_from_ttf(self):
+ # Replace Freetype's generic family name with TTF/OpenType specific
+ # name if we can find one; there are some instances where Freetype
+ # gets it wrong.
+
+ return # FIXME: This is broken
+
+ if self.face_flags & FT_FACE_FLAG_SFNT:
+ name = FT_SfntName()
+ for i in range(FT_Get_Sfnt_Name_Count(self.ft_face)):
+ try:
+ FT_Get_Sfnt_Name(self.ft_face, i, name)
+ if not (name.platform_id == TT_PLATFORM_MICROSOFT and
+ name.encoding_id == TT_MS_ID_UNICODE_CS):
+ continue
+ # name.string is not 0 terminated! use name.string_len
+ self.name = name.string.decode('utf-16be', 'ignore')
+ except:
+ continue
+
+
+class FreeTypeMemoryFace(FreeTypeFace):
+ def __init__(self, data):
+ self._copy_font_data(data)
+ super(FreeTypeMemoryFace, self).__init__(self._create_font_face())
+
+ def _copy_font_data(self, data):
+ self.font_data = (FT_Byte * len(data))()
+ ctypes.memmove(self.font_data, data, len(data))
+
+ def _create_font_face(self):
+ ft_library = ft_get_library()
+ ft_face = FT_Face()
+ FT_New_Memory_Face(ft_library,
+ self.font_data,
+ len(self.font_data),
+ 0,
+ byref(ft_face))
+ return ft_face
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/freetype_lib.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/freetype_lib.py
new file mode 100644
index 0000000..c01e0ab
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/freetype_lib.py
@@ -0,0 +1,593 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+from __future__ import print_function
+from __future__ import absolute_import
+
+from ctypes import *
+from .base import FontException
+import pyglet.lib
+
+_libfreetype = pyglet.lib.load_library('freetype')
+
+_font_data = {}
+
+def _get_function(name, argtypes, rtype):
+ try:
+ func = getattr(_libfreetype, name)
+ func.argtypes = argtypes
+ func.restype = rtype
+ return func
+ except AttributeError as e:
+ raise ImportError(e)
+
+
+FT_Byte = c_char
+FT_Bytes = POINTER(FT_Byte)
+FT_Char = c_byte
+FT_Int = c_int
+FT_UInt = c_uint
+FT_Int16 = c_int16
+FT_UInt16 = c_uint16
+FT_Int32 = c_int32
+FT_UInt32 = c_uint32
+FT_Int64 = c_int64
+FT_UInt64 = c_uint64
+FT_Short = c_short
+FT_UShort = c_ushort
+FT_Long = c_long
+FT_ULong = c_ulong
+FT_Bool = c_char
+FT_Offset = c_size_t
+# FT_PtrDist = ?
+FT_String = c_char
+FT_String_Ptr = c_char_p
+FT_Tag = FT_UInt32
+FT_Error = c_int
+FT_Fixed = c_long
+FT_Pointer = c_void_p
+FT_Pos = c_long
+
+
+class FT_Vector(Structure):
+ _fields_ = [
+ ('x', FT_Pos),
+ ('y', FT_Pos)
+ ]
+
+
+class FT_BBox(Structure):
+ _fields_ = [
+ ('xMin', FT_Pos),
+ ('yMin', FT_Pos),
+ ('xMax', FT_Pos),
+ ('yMax', FT_Pos)
+ ]
+
+
+class FT_Matrix(Structure):
+ _fields_ = [
+ ('xx', FT_Fixed),
+ ('xy', FT_Fixed),
+ ('yx', FT_Fixed),
+ ('yy', FT_Fixed)
+ ]
+
+FT_FWord = c_short
+FT_UFWord = c_ushort
+FT_F2Dot14 = c_short
+
+
+class FT_UnitVector(Structure):
+ _fields_ = [
+ ('x', FT_F2Dot14),
+ ('y', FT_F2Dot14),
+ ]
+
+FT_F26Dot6 = c_long
+
+
+class FT_Data(Structure):
+ _fields_ = [
+ ('pointer', POINTER(FT_Byte)),
+ ('length', FT_Int),
+ ]
+
+FT_Generic_Finalizer = CFUNCTYPE(None, (c_void_p))
+
+
+class FT_Generic(Structure):
+ _fields_ = [
+ ('data', c_void_p),
+ ('finalizer', FT_Generic_Finalizer)
+ ]
+
+
+class FT_Bitmap(Structure):
+ _fields_ = [
+ ('rows', c_uint),
+ ('width', c_uint),
+ ('pitch', c_int),
+ ('buffer', POINTER(c_ubyte)),
+ ('num_grays', c_short),
+ ('pixel_mode', c_ubyte),
+ ('palette_mode', c_ubyte),
+ ('palette', c_void_p),
+ ]
+
+FT_PIXEL_MODE_NONE = 0
+FT_PIXEL_MODE_MONO = 1
+FT_PIXEL_MODE_GRAY = 2
+FT_PIXEL_MODE_GRAY2 = 3
+FT_PIXEL_MODE_GRAY4 = 4
+FT_PIXEL_MODE_LCD = 5
+FT_PIXEL_MODE_LCD_V = 6
+FT_PIXEL_MODE_BGRA = 7
+
+
+class FT_LibraryRec(Structure):
+ _fields_ = [
+ ('dummy', c_int),
+ ]
+
+ def __del__(self):
+ global _library
+ try:
+ print('FT_LibraryRec.__del__')
+ FT_Done_FreeType(byref(self))
+ _library = None
+ except:
+ pass
+FT_Library = POINTER(FT_LibraryRec)
+
+
+class FT_Bitmap_Size(Structure):
+ _fields_ = [
+ ('height', c_ushort),
+ ('width', c_ushort),
+ ('size', c_long),
+ ('x_ppem', c_long),
+ ('y_ppem', c_long),
+ ]
+
+
+class FT_Glyph_Metrics(Structure):
+ _fields_ = [
+ ('width', FT_Pos),
+ ('height', FT_Pos),
+
+ ('horiBearingX', FT_Pos),
+ ('horiBearingY', FT_Pos),
+ ('horiAdvance', FT_Pos),
+
+ ('vertBearingX', FT_Pos),
+ ('vertBearingY', FT_Pos),
+ ('vertAdvance', FT_Pos),
+ ]
+
+ def dump(self):
+ for (name, type) in self._fields_:
+ print('FT_Glyph_Metrics', name, repr(getattr(self, name)))
+
+FT_Glyph_Format = c_ulong
+
+
+def FT_IMAGE_TAG(tag):
+ return (ord(tag[0]) << 24) | (ord(tag[1]) << 16) | (ord(tag[2]) << 8) | ord(tag[3])
+
+FT_GLYPH_FORMAT_NONE = 0
+FT_GLYPH_FORMAT_COMPOSITE = FT_IMAGE_TAG('comp')
+FT_GLYPH_FORMAT_BITMAP = FT_IMAGE_TAG('bits')
+FT_GLYPH_FORMAT_OUTLINE = FT_IMAGE_TAG('outl')
+FT_GLYPH_FORMAT_PLOTTER = FT_IMAGE_TAG('plot')
+
+
+class FT_Outline(Structure):
+ _fields_ = [
+ ('n_contours', c_short), # number of contours in glyph
+ ('n_points', c_short), # number of points in the glyph
+ ('points', POINTER(FT_Vector)), # the outline's points
+ ('tags', c_char_p), # the points flags
+ ('contours', POINTER(c_short)), # the contour end points
+ ('flags', c_int), # outline masks
+ ]
+
+
+FT_SubGlyph = c_void_p
+
+
+class FT_GlyphSlotRec(Structure):
+ _fields_ = [
+ ('library', FT_Library),
+ ('face', c_void_p),
+ ('next', c_void_p),
+ ('reserved', FT_UInt),
+ ('generic', FT_Generic),
+
+ ('metrics', FT_Glyph_Metrics),
+ ('linearHoriAdvance', FT_Fixed),
+ ('linearVertAdvance', FT_Fixed),
+ ('advance', FT_Vector),
+
+ ('format', FT_Glyph_Format),
+
+ ('bitmap', FT_Bitmap),
+ ('bitmap_left', FT_Int),
+ ('bitmap_top', FT_Int),
+
+ ('outline', FT_Outline),
+ ('num_subglyphs', FT_UInt),
+ ('subglyphs', FT_SubGlyph),
+
+ ('control_data', c_void_p),
+ ('control_len', c_long),
+
+ ('lsb_delta', FT_Pos),
+ ('rsb_delta', FT_Pos),
+
+ ('other', c_void_p),
+
+ ('internal', c_void_p),
+ ]
+FT_GlyphSlot = POINTER(FT_GlyphSlotRec)
+
+
+class FT_Size_Metrics(Structure):
+ _fields_ = [
+ ('x_ppem', FT_UShort), # horizontal pixels per EM
+ ('y_ppem', FT_UShort), # vertical pixels per EM
+
+ ('x_scale', FT_Fixed), # two scales used to convert font units
+ ('y_scale', FT_Fixed), # to 26.6 frac. pixel coordinates
+
+ ('ascender', FT_Pos), # ascender in 26.6 frac. pixels
+ ('descender', FT_Pos), # descender in 26.6 frac. pixels
+ ('height', FT_Pos), # text height in 26.6 frac. pixels
+ ('max_advance', FT_Pos), # max horizontal advance, in 26.6 pixels
+ ]
+
+
+class FT_SizeRec(Structure):
+ _fields_ = [
+ ('face', c_void_p),
+ ('generic', FT_Generic),
+ ('metrics', FT_Size_Metrics),
+ ('internal', c_void_p),
+ ]
+FT_Size = POINTER(FT_SizeRec)
+
+
+class FT_FaceRec(Structure):
+ _fields_ = [
+ ('num_faces', FT_Long),
+ ('face_index', FT_Long),
+
+ ('face_flags', FT_Long),
+ ('style_flags', FT_Long),
+
+ ('num_glyphs', FT_Long),
+
+ ('family_name', FT_String_Ptr),
+ ('style_name', FT_String_Ptr),
+
+ ('num_fixed_sizes', FT_Int),
+ ('available_sizes', POINTER(FT_Bitmap_Size)),
+
+ ('num_charmaps', FT_Int),
+ ('charmaps', c_void_p),
+
+ ('generic', FT_Generic),
+
+ ('bbox', FT_BBox),
+
+ ('units_per_EM', FT_UShort),
+ ('ascender', FT_Short),
+ ('descender', FT_Short),
+ ('height', FT_Short),
+
+ ('max_advance_width', FT_Short),
+ ('max_advance_height', FT_Short),
+
+ ('underline_position', FT_Short),
+ ('underline_thickness', FT_Short),
+
+ ('glyph', FT_GlyphSlot),
+ ('size', FT_Size),
+ ('charmap', c_void_p),
+
+ ('driver', c_void_p),
+ ('memory', c_void_p),
+ ('stream', c_void_p),
+
+ ('sizes_list', c_void_p),
+
+ ('autohint', FT_Generic),
+ ('extensions', c_void_p),
+ ('internal', c_void_p),
+ ]
+
+ def dump(self):
+ for (name, type) in self._fields_:
+ print('FT_FaceRec', name, repr(getattr(self, name)))
+
+ def has_kerning(self):
+ return self.face_flags & FT_FACE_FLAG_KERNING
+FT_Face = POINTER(FT_FaceRec)
+
+
+# face_flags values
+FT_FACE_FLAG_SCALABLE = 1 << 0
+FT_FACE_FLAG_FIXED_SIZES = 1 << 1
+FT_FACE_FLAG_FIXED_WIDTH = 1 << 2
+FT_FACE_FLAG_SFNT = 1 << 3
+FT_FACE_FLAG_HORIZONTAL = 1 << 4
+FT_FACE_FLAG_VERTICAL = 1 << 5
+FT_FACE_FLAG_KERNING = 1 << 6
+FT_FACE_FLAG_FAST_GLYPHS = 1 << 7
+FT_FACE_FLAG_MULTIPLE_MASTERS = 1 << 8
+FT_FACE_FLAG_GLYPH_NAMES = 1 << 9
+FT_FACE_FLAG_EXTERNAL_STREAM = 1 << 10
+FT_FACE_FLAG_HINTER = 1 << 11
+
+FT_STYLE_FLAG_ITALIC = 1
+FT_STYLE_FLAG_BOLD = 2
+
+
+(FT_RENDER_MODE_NORMAL,
+ FT_RENDER_MODE_LIGHT,
+ FT_RENDER_MODE_MONO,
+ FT_RENDER_MODE_LCD,
+ FT_RENDER_MODE_LCD_V) = range(5)
+
+
+def FT_LOAD_TARGET_(x):
+ return (x & 15) << 16
+
+FT_LOAD_TARGET_NORMAL = FT_LOAD_TARGET_(FT_RENDER_MODE_NORMAL)
+FT_LOAD_TARGET_LIGHT = FT_LOAD_TARGET_(FT_RENDER_MODE_LIGHT)
+FT_LOAD_TARGET_MONO = FT_LOAD_TARGET_(FT_RENDER_MODE_MONO)
+FT_LOAD_TARGET_LCD = FT_LOAD_TARGET_(FT_RENDER_MODE_LCD)
+FT_LOAD_TARGET_LCD_V = FT_LOAD_TARGET_(FT_RENDER_MODE_LCD_V)
+
+(FT_PIXEL_MODE_NONE,
+ FT_PIXEL_MODE_MONO,
+ FT_PIXEL_MODE_GRAY,
+ FT_PIXEL_MODE_GRAY2,
+ FT_PIXEL_MODE_GRAY4,
+ FT_PIXEL_MODE_LCD,
+ FT_PIXEL_MODE_LCD_V) = range(7)
+
+
+def f16p16_to_float(value):
+ return float(value) / (1 << 16)
+
+
+def float_to_f16p16(value):
+ return int(value * (1 << 16))
+
+
+def f26p6_to_float(value):
+ return float(value) / (1 << 6)
+
+
+def float_to_f26p6(value):
+ return int(value * (1 << 6))
+
+
+class FreeTypeError(FontException):
+ def __init__(self, message, errcode):
+ self.message = message
+ self.errcode = errcode
+
+ def __str__(self):
+ return '%s: %s (%s)'%(self.__class__.__name__, self.message,
+ self._ft_errors.get(self.errcode, 'unknown error'))
+
+ @classmethod
+ def check_and_raise_on_error(cls, errcode):
+ if errcode != 0:
+ raise cls(None, errcode)
+
+ _ft_errors = {
+ 0x00: "no error" ,
+ 0x01: "cannot open resource" ,
+ 0x02: "unknown file format" ,
+ 0x03: "broken file" ,
+ 0x04: "invalid FreeType version" ,
+ 0x05: "module version is too low" ,
+ 0x06: "invalid argument" ,
+ 0x07: "unimplemented feature" ,
+ 0x08: "broken table" ,
+ 0x09: "broken offset within table" ,
+ 0x10: "invalid glyph index" ,
+ 0x11: "invalid character code" ,
+ 0x12: "unsupported glyph image format" ,
+ 0x13: "cannot render this glyph format" ,
+ 0x14: "invalid outline" ,
+ 0x15: "invalid composite glyph" ,
+ 0x16: "too many hints" ,
+ 0x17: "invalid pixel size" ,
+ 0x20: "invalid object handle" ,
+ 0x21: "invalid library handle" ,
+ 0x22: "invalid module handle" ,
+ 0x23: "invalid face handle" ,
+ 0x24: "invalid size handle" ,
+ 0x25: "invalid glyph slot handle" ,
+ 0x26: "invalid charmap handle" ,
+ 0x27: "invalid cache manager handle" ,
+ 0x28: "invalid stream handle" ,
+ 0x30: "too many modules" ,
+ 0x31: "too many extensions" ,
+ 0x40: "out of memory" ,
+ 0x41: "unlisted object" ,
+ 0x51: "cannot open stream" ,
+ 0x52: "invalid stream seek" ,
+ 0x53: "invalid stream skip" ,
+ 0x54: "invalid stream read" ,
+ 0x55: "invalid stream operation" ,
+ 0x56: "invalid frame operation" ,
+ 0x57: "nested frame access" ,
+ 0x58: "invalid frame read" ,
+ 0x60: "raster uninitialized" ,
+ 0x61: "raster corrupted" ,
+ 0x62: "raster overflow" ,
+ 0x63: "negative height while rastering" ,
+ 0x70: "too many registered caches" ,
+ 0x80: "invalid opcode" ,
+ 0x81: "too few arguments" ,
+ 0x82: "stack overflow" ,
+ 0x83: "code overflow" ,
+ 0x84: "bad argument" ,
+ 0x85: "division by zero" ,
+ 0x86: "invalid reference" ,
+ 0x87: "found debug opcode" ,
+ 0x88: "found ENDF opcode in execution stream" ,
+ 0x89: "nested DEFS" ,
+ 0x8A: "invalid code range" ,
+ 0x8B: "execution context too long" ,
+ 0x8C: "too many function definitions" ,
+ 0x8D: "too many instruction definitions" ,
+ 0x8E: "SFNT font table missing" ,
+ 0x8F: "horizontal header (hhea, table missing" ,
+ 0x90: "locations (loca, table missing" ,
+ 0x91: "name table missing" ,
+ 0x92: "character map (cmap, table missing" ,
+ 0x93: "horizontal metrics (hmtx, table missing" ,
+ 0x94: "PostScript (post, table missing" ,
+ 0x95: "invalid horizontal metrics" ,
+ 0x96: "invalid character map (cmap, format" ,
+ 0x97: "invalid ppem value" ,
+ 0x98: "invalid vertical metrics" ,
+ 0x99: "could not find context" ,
+ 0x9A: "invalid PostScript (post, table format" ,
+ 0x9B: "invalid PostScript (post, table" ,
+ 0xA0: "opcode syntax error" ,
+ 0xA1: "argument stack underflow" ,
+ 0xA2: "ignore" ,
+ 0xB0: "`STARTFONT' field missing" ,
+ 0xB1: "`FONT' field missing" ,
+ 0xB2: "`SIZE' field missing" ,
+ 0xB3: "`CHARS' field missing" ,
+ 0xB4: "`STARTCHAR' field missing" ,
+ 0xB5: "`ENCODING' field missing" ,
+ 0xB6: "`BBX' field missing" ,
+ 0xB7: "`BBX' too big" ,
+ }
+
+
+def _get_function_with_error_handling(name, argtypes, rtype):
+ func = _get_function(name, argtypes, rtype)
+ def _error_handling(*args, **kwargs):
+ err = func(*args, **kwargs)
+ FreeTypeError.check_and_raise_on_error(err)
+ return _error_handling
+
+
+FT_LOAD_RENDER = 0x4
+
+FT_Init_FreeType = _get_function_with_error_handling('FT_Init_FreeType',
+ [POINTER(FT_Library)], FT_Error)
+FT_Done_FreeType = _get_function_with_error_handling('FT_Done_FreeType',
+ [FT_Library], FT_Error)
+
+FT_New_Face = _get_function_with_error_handling('FT_New_Face',
+ [FT_Library, c_char_p, FT_Long, POINTER(FT_Face)], FT_Error)
+FT_Done_Face = _get_function_with_error_handling('FT_Done_Face',
+ [FT_Face], FT_Error)
+FT_Reference_Face = _get_function_with_error_handling('FT_Reference_Face',
+ [FT_Face], FT_Error)
+FT_New_Memory_Face = _get_function_with_error_handling('FT_New_Memory_Face',
+ [FT_Library, POINTER(FT_Byte), FT_Long, FT_Long, POINTER(FT_Face)], FT_Error)
+
+FT_Set_Char_Size = _get_function_with_error_handling('FT_Set_Char_Size',
+ [FT_Face, FT_F26Dot6, FT_F26Dot6, FT_UInt, FT_UInt], FT_Error)
+FT_Set_Pixel_Sizes = _get_function_with_error_handling('FT_Set_Pixel_Sizes',
+ [FT_Face, FT_UInt, FT_UInt], FT_Error)
+FT_Load_Glyph = _get_function_with_error_handling('FT_Load_Glyph',
+ [FT_Face, FT_UInt, FT_Int32], FT_Error)
+FT_Get_Char_Index = _get_function_with_error_handling('FT_Get_Char_Index',
+ [FT_Face, FT_ULong], FT_Error)
+FT_Load_Char = _get_function_with_error_handling('FT_Load_Char',
+ [FT_Face, FT_ULong, FT_Int32], FT_Error)
+FT_Get_Kerning = _get_function_with_error_handling('FT_Get_Kerning',
+ [FT_Face, FT_UInt, FT_UInt, FT_UInt, POINTER(FT_Vector)], FT_Error)
+
+# SFNT interface
+
+class FT_SfntName(Structure):
+ _fields_ = [
+ ('platform_id', FT_UShort),
+ ('encoding_id', FT_UShort),
+ ('language_id', FT_UShort),
+ ('name_id', FT_UShort),
+ ('string', POINTER(FT_Byte)),
+ ('string_len', FT_UInt)
+ ]
+
+FT_Get_Sfnt_Name_Count = _get_function('FT_Get_Sfnt_Name_Count',
+ [FT_Face], FT_UInt)
+FT_Get_Sfnt_Name = _get_function_with_error_handling('FT_Get_Sfnt_Name',
+ [FT_Face, FT_UInt, POINTER(FT_SfntName)], FT_Error)
+
+TT_PLATFORM_MICROSOFT = 3
+TT_MS_ID_UNICODE_CS = 1
+TT_NAME_ID_COPYRIGHT = 0
+TT_NAME_ID_FONT_FAMILY = 1
+TT_NAME_ID_FONT_SUBFAMILY = 2
+TT_NAME_ID_UNIQUE_ID = 3
+TT_NAME_ID_FULL_NAME = 4
+TT_NAME_ID_VERSION_STRING = 5
+TT_NAME_ID_PS_NAME = 6
+TT_NAME_ID_TRADEMARK = 7
+TT_NAME_ID_MANUFACTURER = 8
+TT_NAME_ID_DESIGNER = 9
+TT_NAME_ID_DESCRIPTION = 10
+TT_NAME_ID_VENDOR_URL = 11
+TT_NAME_ID_DESIGNER_URL = 12
+TT_NAME_ID_LICENSE = 13
+TT_NAME_ID_LICENSE_URL = 14
+TT_NAME_ID_PREFERRED_FAMILY = 16
+TT_NAME_ID_PREFERRED_SUBFAMILY= 17
+TT_NAME_ID_MAC_FULL_NAME = 18
+TT_NAME_ID_CID_FINDFONT_NAME = 20
+
+_library = None
+def ft_get_library():
+ global _library
+ if not _library:
+ _library = FT_Library()
+ error = FT_Init_FreeType(byref(_library))
+ if error:
+ raise FontException(
+ 'an error occurred during library initialization', error)
+ return _library
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/quartz.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/quartz.py
new file mode 100644
index 0000000..d68da3b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/quartz.py
@@ -0,0 +1,289 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+from builtins import map
+from builtins import str
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+# TODO Tiger and later: need to set kWindowApplicationScaledAttribute for DPI
+# independence?
+
+import math
+
+from pyglet.font import base
+import pyglet.image
+
+from pyglet.libs.darwin.cocoapy import *
+
+
+class QuartzGlyphRenderer(base.GlyphRenderer):
+ def __init__(self, font):
+ super(QuartzGlyphRenderer, self).__init__(font)
+ self.font = font
+
+ def render(self, text):
+ # Using CTLineDraw seems to be the only way to make sure that the text
+ # is drawn with the specified font when that font is a graphics font loaded from
+ # memory. For whatever reason, [NSAttributedString drawAtPoint:] ignores
+ # the graphics font if it not registered with the font manager.
+ # So we just use CTLineDraw for both graphics fonts and installed fonts.
+
+ ctFont = self.font.ctFont
+
+ # Create an attributed string using text and font.
+ attributes = c_void_p(cf.CFDictionaryCreateMutable(None, 1, cf.kCFTypeDictionaryKeyCallBacks, cf.kCFTypeDictionaryValueCallBacks))
+ cf.CFDictionaryAddValue(attributes, kCTFontAttributeName, ctFont)
+ string = c_void_p(cf.CFAttributedStringCreate(None, CFSTR(text), attributes))
+
+ # Create a CTLine object to render the string.
+ line = c_void_p(ct.CTLineCreateWithAttributedString(string))
+ cf.CFRelease(string)
+ cf.CFRelease(attributes)
+
+ # Get a bounding rectangle for glyphs in string.
+ count = len(text)
+ chars = (UniChar * count)(*list(map(ord,str(text))))
+ glyphs = (CGGlyph * count)()
+ ct.CTFontGetGlyphsForCharacters(ctFont, chars, glyphs, count)
+ rect = ct.CTFontGetBoundingRectsForGlyphs(ctFont, 0, glyphs, None, count)
+
+ # Get advance for all glyphs in string.
+ advance = ct.CTFontGetAdvancesForGlyphs(ctFont, 0, glyphs, None, count)
+
+ # Set image parameters:
+ # We add 2 pixels to the bitmap width and height so that there will be a 1-pixel border
+ # around the glyph image when it is placed in the texture atlas. This prevents
+ # weird artifacts from showing up around the edges of the rendered glyph textures.
+ # We adjust the baseline and lsb of the glyph by 1 pixel accordingly.
+ width = max(int(math.ceil(rect.size.width) + 2), 1)
+ height = max(int(math.ceil(rect.size.height) + 2), 1)
+ baseline = -int(math.floor(rect.origin.y)) + 1
+ lsb = int(math.floor(rect.origin.x)) - 1
+ advance = int(round(advance))
+
+ # Create bitmap context.
+ bitsPerComponent = 8
+ bytesPerRow = 4*width
+ colorSpace = c_void_p(quartz.CGColorSpaceCreateDeviceRGB())
+ bitmap = c_void_p(quartz.CGBitmapContextCreate(
+ None,
+ width,
+ height,
+ bitsPerComponent,
+ bytesPerRow,
+ colorSpace,
+ kCGImageAlphaPremultipliedLast))
+
+ # Draw text to bitmap context.
+ quartz.CGContextSetShouldAntialias(bitmap, True)
+ quartz.CGContextSetTextPosition(bitmap, -lsb, baseline)
+ ct.CTLineDraw(line, bitmap)
+ cf.CFRelease(line)
+
+ # Create an image to get the data out.
+ imageRef = c_void_p(quartz.CGBitmapContextCreateImage(bitmap))
+
+ bytesPerRow = quartz.CGImageGetBytesPerRow(imageRef)
+ dataProvider = c_void_p(quartz.CGImageGetDataProvider(imageRef))
+ imageData = c_void_p(quartz.CGDataProviderCopyData(dataProvider))
+ buffersize = cf.CFDataGetLength(imageData)
+ buffer = (c_byte * buffersize)()
+ byteRange = CFRange(0, buffersize)
+ cf.CFDataGetBytes(imageData, byteRange, buffer)
+
+ quartz.CGImageRelease(imageRef)
+ quartz.CGDataProviderRelease(imageData)
+ cf.CFRelease(bitmap)
+ cf.CFRelease(colorSpace)
+
+ glyph_image = pyglet.image.ImageData(width, height, 'RGBA', buffer, bytesPerRow)
+
+ glyph = self.font.create_glyph(glyph_image)
+ glyph.set_bearings(baseline, lsb, advance)
+ t = list(glyph.tex_coords)
+ glyph.tex_coords = t[9:12] + t[6:9] + t[3:6] + t[:3]
+
+ return glyph
+
+
+class QuartzFont(base.Font):
+ glyph_renderer_class = QuartzGlyphRenderer
+ _loaded_CGFont_table = {}
+
+ def _lookup_font_with_family_and_traits(self, family, traits):
+ # This method searches the _loaded_CGFont_table to find a loaded
+ # font of the given family with the desired traits. If it can't find
+ # anything with the exact traits, it tries to fall back to whatever
+ # we have loaded that's close. If it can't find anything in the
+ # given family at all, it returns None.
+
+ # Check if we've loaded the font with the specified family.
+ if family not in self._loaded_CGFont_table:
+ return None
+ # Grab a dictionary of all fonts in the family, keyed by traits.
+ fonts = self._loaded_CGFont_table[family]
+ if not fonts:
+ return None
+ # Return font with desired traits if it is available.
+ if traits in fonts:
+ return fonts[traits]
+ # Otherwise try to find a font with some of the traits.
+ for (t, f) in fonts.items():
+ if traits & t:
+ return f
+ # Otherwise try to return a regular font.
+ if 0 in fonts:
+ return fonts[0]
+ # Otherwise return whatever we have.
+ return list(fonts.values())[0]
+
+
+ def _create_font_descriptor(self, family_name, traits):
+ # Create an attribute dictionary.
+ attributes = c_void_p(cf.CFDictionaryCreateMutable(None, 0, cf.kCFTypeDictionaryKeyCallBacks, cf.kCFTypeDictionaryValueCallBacks))
+ # Add family name to attributes.
+ cfname = CFSTR(family_name)
+ cf.CFDictionaryAddValue(attributes, kCTFontFamilyNameAttribute, cfname)
+ cf.CFRelease(cfname)
+ # Construct a CFNumber to represent the traits.
+ itraits = c_int32(traits)
+ symTraits = c_void_p(cf.CFNumberCreate(None, kCFNumberSInt32Type, byref(itraits)))
+ if symTraits:
+ # Construct a dictionary to hold the traits values.
+ traitsDict = c_void_p(cf.CFDictionaryCreateMutable(None, 0, cf.kCFTypeDictionaryKeyCallBacks, cf.kCFTypeDictionaryValueCallBacks))
+ if traitsDict:
+ # Add CFNumber traits to traits dictionary.
+ cf.CFDictionaryAddValue(traitsDict, kCTFontSymbolicTrait, symTraits)
+ # Add traits dictionary to attributes.
+ cf.CFDictionaryAddValue(attributes, kCTFontTraitsAttribute, traitsDict)
+ cf.CFRelease(traitsDict)
+ cf.CFRelease(symTraits)
+ # Create font descriptor with attributes.
+ descriptor = c_void_p(ct.CTFontDescriptorCreateWithAttributes(attributes))
+ cf.CFRelease(attributes)
+ return descriptor
+
+ def __init__(self, name, size, bold=False, italic=False, dpi=None):
+ super(QuartzFont, self).__init__()
+
+ if not name: name = 'Helvetica'
+
+ # I don't know what is the right thing to do here.
+ if dpi is None: dpi = 96
+ size = size * dpi / 72.0
+
+ # Construct traits value.
+ traits = 0
+ if bold: traits |= kCTFontBoldTrait
+ if italic: traits |= kCTFontItalicTrait
+
+ name = str(name)
+ # First see if we can find an appropriate font from our table of loaded fonts.
+ cgFont = self._lookup_font_with_family_and_traits(name, traits)
+ if cgFont:
+ # Use cgFont from table to create a CTFont object with the specified size.
+ self.ctFont = c_void_p(ct.CTFontCreateWithGraphicsFont(cgFont, size, None, None))
+ else:
+ # Create a font descriptor for given name and traits and use it to create font.
+ descriptor = self._create_font_descriptor(name, traits)
+ self.ctFont = c_void_p(ct.CTFontCreateWithFontDescriptor(descriptor, size, None))
+
+ cf.CFRelease(descriptor)
+ assert self.ctFont, "Couldn't load font: " + name
+
+ self.ascent = int(math.ceil(ct.CTFontGetAscent(self.ctFont)))
+ self.descent = -int(math.ceil(ct.CTFontGetDescent(self.ctFont)))
+
+ def __del__(self):
+ cf.CFRelease(self.ctFont)
+
+ @classmethod
+ def have_font(cls, name):
+ name = str(name)
+ if name in cls._loaded_CGFont_table: return True
+ # Try to create the font to see if it exists.
+ # TODO: Find a better way to check.
+ cfstring = CFSTR(name)
+ cgfont = c_void_p(quartz.CGFontCreateWithFontName(cfstring))
+ cf.CFRelease(cfstring)
+ if cgfont:
+ cf.CFRelease(cgfont)
+ return True
+ return False
+
+ @classmethod
+ def add_font_data(cls, data):
+ # Create a cgFont with the data. There doesn't seem to be a way to
+ # register a font loaded from memory such that the operating system will
+ # find it later. So instead we just store the cgFont in a table where
+ # it can be found by our __init__ method.
+ # Note that the iOS CTFontManager *is* able to register graphics fonts,
+ # however this method is missing from CTFontManager on MacOS 10.6
+ dataRef = c_void_p(cf.CFDataCreate(None, data, len(data)))
+ provider = c_void_p(quartz.CGDataProviderCreateWithCFData(dataRef))
+ cgFont = c_void_p(quartz.CGFontCreateWithDataProvider(provider))
+
+ cf.CFRelease(dataRef)
+ quartz.CGDataProviderRelease(provider)
+
+ # Create a template CTFont from the graphics font so that we can get font info.
+ ctFont = c_void_p(ct.CTFontCreateWithGraphicsFont(cgFont, 1, None, None))
+
+ # Get info about the font to use as key in our font table.
+ string = c_void_p(ct.CTFontCopyFamilyName(ctFont))
+ familyName = str(cfstring_to_string(string))
+ cf.CFRelease(string)
+
+ string = c_void_p(ct.CTFontCopyFullName(ctFont))
+ fullName = str(cfstring_to_string(string))
+ cf.CFRelease(string)
+
+ traits = ct.CTFontGetSymbolicTraits(ctFont)
+ cf.CFRelease(ctFont)
+
+ # Store font in table. We store it under both its family name and its
+ # full name, since its not always clear which one will be looked up.
+ if familyName not in cls._loaded_CGFont_table:
+ cls._loaded_CGFont_table[familyName] = {}
+ cls._loaded_CGFont_table[familyName][traits] = cgFont
+
+ if fullName not in cls._loaded_CGFont_table:
+ cls._loaded_CGFont_table[fullName] = {}
+ cls._loaded_CGFont_table[fullName][traits] = cgFont
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/text.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/text.py
new file mode 100644
index 0000000..964ba51
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/text.py
@@ -0,0 +1,558 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Deprecated text rendering
+
+This is a fairly-low level interface to text rendering. Obtain a font using
+`load`::
+
+ from pyglet import font
+ arial = font.load('Arial', 14, bold=True, italic=False)
+
+pyglet will load any system-installed fonts. You can add additional fonts
+(for example, from your program resources) using `add_file` or
+`add_directory`.
+
+Obtain a list of `Glyph` objects for a string of text using the `Font`
+object::
+
+ text = 'Hello, world!'
+ glyphs = arial.get_glyphs(text)
+
+The most efficient way to render these glyphs is with a `GlyphString`::
+
+ glyph_string = GlyphString(text, glyphs)
+ glyph_string.draw()
+
+There are also a variety of methods in both `Font` and
+`GlyphString` to facilitate word-wrapping.
+
+A convenient way to render a string of text is with a `Text`::
+
+ text = Text(font, text)
+ text.draw()
+
+See the `pyglet.font.base` module for documentation on the base classes used
+by this package.
+'''
+from __future__ import division
+from builtins import object
+
+import warnings
+
+import pyglet
+from pyglet.gl import *
+
+class GlyphString(object):
+ '''An immutable string of glyphs that can be rendered quickly.
+
+ This class is ideal for quickly rendering single or multi-line strings
+ of text that use the same font. To wrap text using a glyph string,
+ call `get_break_index` to find the optimal breakpoint for each line,
+ the repeatedly call `draw` for each breakpoint.
+
+ :deprecated: Use `pyglet.text.layout` classes.
+ '''
+
+ def __init__(self, text, glyphs, x=0, y=0):
+ '''Create a glyph string.
+
+ The `text` string is used to determine valid breakpoints; all glyphs
+ must have already been determined using
+ `pyglet.font.base.Font.get_glyphs`. The string
+ will be positioned with the baseline of the left-most glyph at the
+ given coordinates.
+
+ :Parameters:
+ `text` : str or unicode
+ String to represent.
+ `glyphs` : list of `pyglet.font.base.Glyph`
+ Glyphs representing `text`.
+ `x` : float
+ X coordinate of the left-side bearing of the left-most glyph.
+ `y` : float
+ Y coordinate of the baseline.
+
+ '''
+ warnings.warn('Use `pyglet.text.layout` classes instead', DeprecationWarning)
+
+ # Create an interleaved array in GL_T2F_V3F format and determine
+ # state changes required.
+
+ lst = []
+ texture = None
+ self.text = text
+ self.states = []
+ self.cumulative_advance = [] # for fast post-string breaking
+ state_from = 0
+ state_length = 0
+ for i, glyph in enumerate(glyphs):
+ if glyph.owner != texture:
+ if state_length:
+ self.states.append((state_from, state_length, texture))
+ texture = glyph.owner
+ state_from = i
+ state_length = 0
+ state_length += 1
+ t = glyph.tex_coords
+ lst += [t[0], t[1], t[2], 1.,
+ x + glyph.vertices[0], y + glyph.vertices[1], 0., 1.,
+ t[3], t[4], t[5], 1.,
+ x + glyph.vertices[2], y + glyph.vertices[1], 0., 1.,
+ t[6], t[7], t[8], 1.,
+ x + glyph.vertices[2], y + glyph.vertices[3], 0., 1.,
+ t[9], t[10], t[11], 1.,
+ x + glyph.vertices[0], y + glyph.vertices[3], 0., 1.]
+ x += glyph.advance
+ self.cumulative_advance.append(x)
+ self.states.append((state_from, state_length, texture))
+
+ self.array = (c_float * len(lst))(*lst)
+ self.width = x
+
+ def get_break_index(self, from_index, width):
+ '''Find a breakpoint within the text for a given width.
+
+ Returns a valid breakpoint after `from_index` so that the text
+ between `from_index` and the breakpoint fits within `width` pixels.
+
+ This method uses precomputed cumulative glyph widths to give quick
+ answer, and so is much faster than
+ `pyglet.font.base.Font.get_glyphs_for_width`.
+
+ :Parameters:
+ `from_index` : int
+ Index of text to begin at, or 0 for the beginning of the
+ string.
+ `width` : float
+ Maximum width to use.
+
+ :rtype: int
+ :return: the index of text which will be used as the breakpoint, or
+ `from_index` if there is no valid breakpoint.
+ '''
+ to_index = from_index
+ if from_index >= len(self.text):
+ return from_index
+ if from_index:
+ width += self.cumulative_advance[from_index-1]
+ for i, (c, w) in enumerate(
+ zip(self.text[from_index:],
+ self.cumulative_advance[from_index:])):
+ if c in u'\u0020\u200b':
+ to_index = i + from_index + 1
+ if c == '\n':
+ return i + from_index + 1
+ if w > width:
+ return to_index
+ return to_index
+
+ def get_subwidth(self, from_index, to_index):
+ '''Return the width of a slice of this string.
+
+ :Parameters:
+ `from_index` : int
+ The start index of the string to measure.
+ `to_index` : int
+ The end index (exclusive) of the string to measure.
+
+ :rtype: float
+ '''
+ if to_index <= from_index:
+ return 0
+ width = self.cumulative_advance[to_index-1]
+ if from_index:
+ width -= self.cumulative_advance[from_index-1]
+ return width
+
+ def draw(self, from_index=0, to_index=None):
+ '''Draw a region of the glyph string.
+
+ Assumes texture state is enabled. To enable the texture state::
+
+ from pyglet.gl import *
+ glEnable(GL_TEXTURE_2D)
+
+ :Parameters:
+ `from_index` : int
+ Start index of text to render.
+ `to_index` : int
+ End index (exclusive) of text to render.
+
+ '''
+ if from_index >= len(self.text) or \
+ from_index == to_index or \
+ not self.text:
+ return
+
+ # XXX Safe to assume all required textures will use same blend state I
+ # think. (otherwise move this into loop)
+ self.states[0][2].apply_blend_state()
+
+ if from_index:
+ glPushMatrix()
+ glTranslatef(-self.cumulative_advance[from_index-1], 0, 0)
+ if to_index is None:
+ to_index = len(self.text)
+
+ glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
+ glInterleavedArrays(GL_T4F_V4F, 0, self.array)
+ for state_from, state_length, texture in self.states:
+ if state_from + state_length < from_index:
+ continue
+ state_from = max(state_from, from_index)
+ state_length = min(state_length, to_index - state_from)
+ if state_length <= 0:
+ break
+ glBindTexture(GL_TEXTURE_2D, texture.id)
+ glDrawArrays(GL_QUADS, state_from * 4, state_length * 4)
+ glPopClientAttrib()
+
+ if from_index:
+ glPopMatrix()
+
+class _TextZGroup(pyglet.graphics.Group):
+ z = 0
+
+ def set_state(self):
+ glTranslatef(0, 0, self.z)
+
+ def unset_state(self):
+ glTranslatef(0, 0, -self.z)
+
+class Text(object):
+ '''Simple displayable text.
+
+ This is a convenience class for rendering strings of text. It takes
+ care of caching the vertices so the text can be rendered every frame with
+ little performance penalty.
+
+ Text can be word-wrapped by specifying a `width` to wrap into. If the
+ width is not specified, it gives the width of the text as laid out.
+
+ :deprecated: Use :py:class:`pyglet.text.Label`.
+ '''
+ # Alignment constants
+
+ #: Align the left edge of the text to the given X coordinate.
+ LEFT = 'left'
+ #: Align the horizontal center of the text to the given X coordinate.
+ CENTER = 'center'
+ #: Align the right edge of the text to the given X coordinate.
+ RIGHT = 'right'
+ #: Align the bottom of the descender of the final line of text with the
+ #: given Y coordinate.
+ BOTTOM = 'bottom'
+ #: Align the baseline of the first line of text with the given Y
+ #: coordinate.
+ BASELINE = 'baseline'
+ #: Align the top of the ascender of the first line of text with the given
+ #: Y coordinate.
+ TOP = 'top'
+
+ # None: no multiline
+ # 'width': multiline, wrapped to width
+ # 'multiline': multiline, no wrap
+ _wrap = None
+
+ # Internal bookkeeping for wrap only.
+ _width = None
+
+ def __init__(self, font, text='', x=0, y=0, z=0, color=(1,1,1,1),
+ width=None, halign=LEFT, valign=BASELINE):
+ '''Create displayable text.
+
+ :Parameters:
+ `font` : `Font`
+ Font to render the text in.
+ `text` : str
+ Initial string to render.
+ `x` : float
+ X coordinate of the left edge of the text.
+ `y` : float
+ Y coordinate of the baseline of the text. If the text is
+ word-wrapped, this refers to the first line of text.
+ `z` : float
+ Z coordinate of the text plane.
+ `color` : 4-tuple of float
+ Color to render the text in. Alpha values can be specified
+ in the fourth component.
+ `width` : float
+ Width to limit the rendering to. Text will be word-wrapped
+ if necessary.
+ `halign` : str
+ Alignment of the text. See `Text.halign` for details.
+ `valign` : str
+ Controls positioning of the text based off the y coordinate.
+ One of BASELINE, BOTTOM, CENTER or TOP. Defaults to BASELINE.
+ '''
+ warnings.warn('Use `pyglet.text.Label` instead', DeprecationWarning)
+
+ multiline = False
+ if width is not None:
+ self._width = width
+ self._wrap = 'width'
+ multiline = True
+ elif '\n' in text:
+ self._wrap = 'multiline'
+ multiline = True
+
+ self._group = _TextZGroup()
+ self._document = pyglet.text.decode_text(text)
+ self._layout = pyglet.text.layout.TextLayout(self._document,
+ width=width,
+ multiline=multiline,
+ wrap_lines=width is not None,
+ dpi=font.dpi,
+ group=self._group)
+
+ self._layout.begin_update()
+ if self._wrap == 'multiline':
+ self._document.set_style(0, len(text), dict(wrap=False))
+ self.font = font
+ self.color = color
+ self._x = x
+ self.y = y
+ self.z = z
+ self.width = width
+ self.halign = halign
+ self.valign = valign
+ self._update_layout_halign()
+ self._layout.end_update()
+
+ def _get_font(self):
+ return self._font
+
+ def _set_font(self, font):
+ self._font = font
+ self._layout.begin_update()
+ self._document.set_style(0, len(self._document.text), {
+ 'font_name': font.name,
+ 'font_size': font.size,
+ 'bold': font.bold,
+ 'italic': font.italic,
+ })
+ self._layout._dpi = font.dpi
+ self._layout.end_update()
+
+ font = property(_get_font, _set_font)
+
+ def _get_color(self):
+ color = self._document.get_style('color')
+ if color is None:
+ return (1., 1., 1., 1.)
+ return tuple([c/255. for c in color])
+
+ def _set_color(self, color):
+ color = [int(c * 255) for c in color]
+ self._document.set_style(0, len(self._document.text), {
+ 'color': color,
+ })
+
+ color = property(_get_color, _set_color)
+
+ def _update_layout_halign(self):
+ if self._layout.multiline:
+ # TextLayout has a different interpretation of halign that doesn't
+ # consider the width to be a special factor; here we emulate the
+ # old behaviour by fudging the layout x value.
+ if self._layout.anchor_x == 'left':
+ self._layout.x = self.x
+ elif self._layout.anchor_x == 'center':
+ self._layout.x = self.x + self._layout.width - \
+ self._layout.content_width // 2
+ elif self._layout.anchor_x == 'right':
+ self._layout.x = self.x + 2 * self._layout.width - \
+ self._layout.content_width
+ else:
+ self._layout.x = self.x
+
+ def _get_x(self):
+ """X coordinate of the text"""
+ return self._x
+
+ def _set_x(self, x):
+ self._x = x
+ self._update_layout_halign()
+
+ x = property(_get_x, _set_x)
+
+ def _get_y(self):
+ """Y coordinate of the text"""
+ return self._layout.y
+
+ def _set_y(self, y):
+ self._layout.y = y
+
+ y = property(_get_y, _set_y)
+
+ def _get_z(self):
+ return self._group.z
+
+ def _set_z(self, z):
+ self._group.z = z
+
+ z = property(_get_z, _set_z)
+
+ def _update_wrap(self):
+ if self._width is not None:
+ self._wrap = 'width'
+ elif '\n' in self.text:
+ self._wrap = 'multiline'
+
+ self._layout.begin_update()
+ if self._wrap == None:
+ self._layout.multiline = False
+ elif self._wrap == 'width':
+ self._layout.width = self._width
+ self._layout.multiline = True
+ self._document.set_style(0, len(self.text), dict(wrap=True))
+ elif self._wrap == 'multiline':
+ self._layout.multiline = True
+ self._document.set_style(0, len(self.text), dict(wrap=False))
+ self._update_layout_halign()
+ self._layout.end_update()
+
+ def _get_width(self):
+ if self._wrap == 'width':
+ return self._layout.width
+ else:
+ return self._layout.content_width
+
+ def _set_width(self, width):
+ self._width = width
+ self._layout._wrap_lines_flag = width is not None
+ self._update_wrap()
+
+ width = property(_get_width, _set_width,
+ doc='''Width of the text.
+
+ When set, this enables word-wrapping to the specified width.
+ Otherwise, the width of the text as it will be rendered can be
+ determined.
+
+ :type: float
+ ''')
+
+ def _get_height(self):
+ return self._layout.content_height
+
+ height = property(_get_height,
+ doc='''Height of the text.
+
+ This property is the ascent minus the descent of the font, unless
+ there is more than one line of word-wrapped text, in which case
+ the height takes into account the line leading. Read-only.
+
+ :type: float
+ ''')
+
+ def _get_text(self):
+ return self._document.text
+
+ def _set_text(self, text):
+ self._document.text = text
+ self._update_wrap()
+
+ text = property(_get_text, _set_text,
+ doc='''Text to render.
+
+ The glyph vertices are only recalculated as needed, so multiple
+ changes to the text can be performed with no performance penalty.
+
+ :type: str
+ ''')
+
+ def _get_halign(self):
+ return self._layout.anchor_x
+
+ def _set_halign(self, halign):
+ self._layout.anchor_x = halign
+ self._update_layout_halign()
+
+ halign = property(_get_halign, _set_halign,
+ doc='''Horizontal alignment of the text.
+
+ The text is positioned relative to `x` and `width` according to this
+ property, which must be one of the alignment constants `LEFT`,
+ `CENTER` or `RIGHT`.
+
+ :type: str
+ ''')
+
+ def _get_valign(self):
+ return self._layout.anchor_y
+
+ def _set_valign(self, valign):
+ self._layout.anchor_y = valign
+
+ valign = property(_get_valign, _set_valign,
+ doc='''Vertical alignment of the text.
+
+ The text is positioned relative to `y` according to this property,
+ which must be one of the alignment constants `BOTTOM`, `BASELINE`,
+ `CENTER` or `TOP`.
+
+ :type: str
+ ''')
+
+ def _get_leading(self):
+ return self._document.get_style('leading') or 0
+
+ def _set_leading(self, leading):
+ self._document.set_style(0, len(self._document.text), {
+ 'leading': leading,
+ })
+
+ leading = property(_get_leading, _set_leading,
+ doc='''Vertical space between adjacent lines, in pixels.
+
+ :type: int
+ ''')
+
+ def _get_line_height(self):
+ return self._font.ascent - self._font.descent + self.leading
+
+ def _set_line_height(self, line_height):
+ self.leading = line_height - (self._font.ascent - self._font.descent)
+
+ line_height = property(_get_line_height, _set_line_height,
+ doc='''Vertical distance between adjacent baselines, in pixels.
+
+ :type: int
+ ''')
+
+ def draw(self):
+ self._layout.draw()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/ttf.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/ttf.py
new file mode 100644
index 0000000..b8ec3ee
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/ttf.py
@@ -0,0 +1,640 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+# $Id$
+
+"""
+Implementation of the Truetype file format.
+
+Typical applications will not need to use this module directly; look at
+`pyglyph.font` instead.
+
+References:
+ * http://developer.apple.com/fonts/TTRefMan/RM06
+ * http://www.microsoft.com/typography/otspec
+"""
+from __future__ import division
+from builtins import zip
+from builtins import chr
+from builtins import range
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import codecs
+import os
+import mmap
+import struct
+
+class TruetypeInfo(object):
+ """Information about a single Truetype face.
+
+ The class memory-maps the font file to read the tables, so
+ it is vital that you call the `close` method to avoid large memory
+ leaks. Once closed, you cannot call any of the ``get_*`` methods.
+
+ Not all tables have been implemented yet (or likely ever will).
+ Currently only the name and metric tables are read; in particular
+ there is no glyph or hinting information.
+ """
+
+ _name_id_lookup = {
+ 'copyright': 0,
+ 'family': 1,
+ 'subfamily': 2,
+ 'identifier': 3,
+ 'name': 4,
+ 'version': 5,
+ 'postscript': 6,
+ 'trademark': 7,
+ 'manufacturer': 8,
+ 'designer': 9,
+ 'description': 10,
+ 'vendor-url': 11,
+ 'designer-url': 12,
+ 'license': 13,
+ 'license-url': 14,
+ 'preferred-family': 16,
+ 'preferred-subfamily': 17,
+ 'compatible-name': 18,
+ 'sample': 19,
+ }
+
+ _platform_id_lookup = {
+ 'unicode': 0,
+ 'macintosh': 1,
+ 'iso': 2,
+ 'microsoft': 3,
+ 'custom': 4
+ }
+
+ _microsoft_encoding_lookup = {
+ 1: 'utf_16_be',
+ 2: 'shift_jis',
+ 4: 'big5',
+ 6: 'johab',
+ 10: 'utf_16_be'
+ }
+
+ _macintosh_encoding_lookup = {
+ 0: 'mac_roman'
+ }
+
+ def __init__(self, filename):
+ """Read the given TrueType file.
+
+ :Parameters:
+ `filename`
+ The name of any Windows, OS2 or Macintosh Truetype file.
+
+ The object must be closed (see `close`) after use.
+
+ An exception will be raised if the file does not exist or cannot
+ be read.
+ """
+ if not filename: filename = ''
+ len = os.stat(filename).st_size
+ self._fileno = os.open(filename, os.O_RDONLY)
+ if hasattr(mmap, 'MAP_SHARED'):
+ self._data = mmap.mmap(self._fileno, len, mmap.MAP_SHARED,
+ mmap.PROT_READ)
+ else:
+ self._data = mmap.mmap(self._fileno, len, None, mmap.ACCESS_READ)
+
+ offsets = _read_offset_table(self._data, 0)
+ self._tables = {}
+ for table in _read_table_directory_entry.array(self._data,
+ offsets.size, offsets.num_tables):
+ self._tables[table.tag] = table
+
+ self._names = None
+ self._horizontal_metrics = None
+ self._character_advances = None
+ self._character_kernings = None
+ self._glyph_kernings = None
+ self._character_map = None
+ self._glyph_map = None
+ self._font_selection_flags = None
+
+ self.header = \
+ _read_head_table(self._data, self._tables['head'].offset)
+ self.horizontal_header = \
+ _read_horizontal_header(self._data, self._tables['hhea'].offset)
+
+ def get_font_selection_flags(self):
+ """Return the font selection flags, as defined in OS/2 table"""
+ if not self._font_selection_flags:
+ OS2_table = \
+ _read_OS2_table(self._data, self._tables['OS/2'].offset)
+ self._font_selection_flags = OS2_table.fs_selection
+ return self._font_selection_flags
+
+ def is_bold(self):
+ """Returns True iff the font describes itself as bold."""
+ return bool(self.get_font_selection_flags() & 0x20)
+
+ def is_italic(self):
+ """Returns True iff the font describes itself as italic."""
+ return bool(self.get_font_selection_flags() & 0x1)
+
+ def get_names(self):
+ """Returns a dictionary of names defined in the file.
+
+ The key of each item is a tuple of ``platform_id``, ``name_id``,
+ where each ID is the number as described in the Truetype format.
+
+ The value of each item is a tuple of
+ ``encoding_id``, ``language_id``, ``value``, where ``value`` is
+ an encoded string.
+ """
+ if self._names:
+ return self._names
+ naming_table = \
+ _read_naming_table(self._data, self._tables['name'].offset)
+ name_records = \
+ _read_name_record.array(self._data,
+ self._tables['name'].offset + naming_table.size,
+ naming_table.count)
+ storage = naming_table.string_offset + self._tables['name'].offset
+ self._names = {}
+ for record in name_records:
+ value = self._data[record.offset + storage:\
+ record.offset + storage + record.length]
+ key = record.platform_id, record.name_id
+ value = (record.encoding_id, record.language_id, value)
+ if not key in self._names:
+ self._names[key] = []
+ self._names[key].append(value)
+ return self._names
+
+ def get_name(self, name, platform=None, languages=None):
+ """Returns the value of the given name in this font.
+
+ :Parameters:
+ `name`
+ Either an integer, representing the name_id desired (see
+ font format); or a string describing it, see below for
+ valid names.
+ `platform`
+ Platform for the requested name. Can be the integer ID,
+ or a string describing it. By default, the Microsoft
+ platform is searched first, then Macintosh.
+ `languages`
+ A list of language IDs to search. The first language
+ which defines the requested name will be used. By default,
+ all English dialects are searched.
+
+ If the name is not found, ``None`` is returned. If the name
+ is found, the value will be decoded and returned as a unicode
+ string. Currently only some common encodings are supported.
+
+ Valid names to request are (supply as a string)::
+
+ 'copyright'
+ 'family'
+ 'subfamily'
+ 'identifier'
+ 'name'
+ 'version'
+ 'postscript'
+ 'trademark'
+ 'manufacturer'
+ 'designer'
+ 'description'
+ 'vendor-url'
+ 'designer-url'
+ 'license'
+ 'license-url'
+ 'preferred-family'
+ 'preferred-subfamily'
+ 'compatible-name'
+ 'sample'
+
+ Valid platforms to request are (supply as a string)::
+
+ 'unicode'
+ 'macintosh'
+ 'iso'
+ 'microsoft'
+ 'custom'
+ """
+
+ names = self.get_names()
+ if type(name) == str:
+ name = self._name_id_lookup[name]
+ if not platform:
+ for platform in ('microsoft','macintosh'):
+ value = self.get_name(name, platform, languages)
+ if value:
+ return value
+ if type(platform) == str:
+ platform = self._platform_id_lookup[platform]
+ if not (platform, name) in names:
+ return None
+
+ if platform == 3: # setup for microsoft
+ encodings = self._microsoft_encoding_lookup
+ if not languages:
+ # Default to english languages for microsoft
+ languages = (0x409,0x809,0xc09,0x1009,0x1409,0x1809)
+ elif platform == 1: # setup for macintosh
+ encodings = self.__macintosh_encoding_lookup
+ if not languages:
+ # Default to english for macintosh
+ languages = (0,)
+
+ for record in names[(platform, name)]:
+ if record[1] in languages and record[0] in encodings:
+ decoder = codecs.getdecoder(encodings[record[0]])
+ return decoder(record[2])[0]
+ return None
+
+ def get_horizontal_metrics(self):
+ """Return all horizontal metric entries in table format."""
+ if not self._horizontal_metrics:
+ ar = _read_long_hor_metric.array(self._data,
+ self._tables['hmtx'].offset,
+ self.horizontal_header.number_of_h_metrics)
+ self._horizontal_metrics = ar
+ return self._horizontal_metrics
+
+ def get_character_advances(self):
+ """Return a dictionary of character->advance.
+
+ They key of the dictionary is a unit-length unicode string,
+ and the value is a float giving the horizontal advance in
+ em.
+ """
+ if self._character_advances:
+ return self._character_advances
+ ga = self.get_glyph_advances()
+ gmap = self.get_glyph_map()
+ self._character_advances = {}
+ for i in range(len(ga)):
+ if i in gmap and not gmap[i] in self._character_advances:
+ self._character_advances[gmap[i]] = ga[i]
+ return self._character_advances
+
+ def get_glyph_advances(self):
+ """Return a dictionary of glyph->advance.
+
+ They key of the dictionary is the glyph index and the value is a float
+ giving the horizontal advance in em.
+ """
+ hm = self.get_horizontal_metrics()
+ return [float(m.advance_width) / self.header.units_per_em for m in hm]
+
+ def get_character_kernings(self):
+ """Return a dictionary of (left,right)->kerning
+
+ The key of the dictionary is a tuple of ``(left, right)``
+ where each element is a unit-length unicode string. The
+ value of the dictionary is the horizontal pairwise kerning
+ in em.
+ """
+ if not self._character_kernings:
+ gmap = self.get_glyph_map()
+ kerns = self.get_glyph_kernings()
+ self._character_kernings = {}
+ for pair, value in kerns.items():
+ lglyph, rglyph = pair
+ lchar = lglyph in gmap and gmap[lglyph] or None
+ rchar = rglyph in gmap and gmap[rglyph] or None
+ if lchar and rchar:
+ self._character_kernings[(lchar, rchar)] = value
+ return self._character_kernings
+
+ def get_glyph_kernings(self):
+ """Return a dictionary of (left,right)->kerning
+
+ The key of the dictionary is a tuple of ``(left, right)``
+ where each element is a glyph index. The value of the dictionary is
+ the horizontal pairwise kerning in em.
+ """
+ if self._glyph_kernings:
+ return self._glyph_kernings
+ header = \
+ _read_kern_header_table(self._data, self._tables['kern'].offset)
+ offset = self._tables['kern'].offset + header.size
+ kernings = {}
+ for i in range(header.n_tables):
+ header = _read_kern_subtable_header(self._data, offset)
+ if header.coverage & header.horizontal_mask \
+ and not header.coverage & header.minimum_mask \
+ and not header.coverage & header.perpendicular_mask:
+ if header.coverage & header.format_mask == 0:
+ self._add_kernings_format0(kernings, offset + header.size)
+ offset += header.length
+ self._glyph_kernings = kernings
+ return kernings
+
+ def _add_kernings_format0(self, kernings, offset):
+ header = _read_kern_subtable_format0(self._data, offset)
+ kerning_pairs = _read_kern_subtable_format0Pair.array(self._data,
+ offset + header.size, header.n_pairs)
+ for pair in kerning_pairs:
+ if (pair.left, pair.right) in kernings:
+ kernings[(pair.left, pair.right)] += pair.value \
+ / float(self.header.units_per_em)
+ else:
+ kernings[(pair.left, pair.right)] = pair.value \
+ / float(self.header.units_per_em)
+
+ def get_glyph_map(self):
+ """Calculate and return a reverse character map.
+
+ Returns a dictionary where the key is a glyph index and the
+ value is a unit-length unicode string.
+ """
+ if self._glyph_map:
+ return self._glyph_map
+ cmap = self.get_character_map()
+ self._glyph_map = {}
+ for ch, glyph in cmap.items():
+ if not glyph in self._glyph_map:
+ self._glyph_map[glyph] = ch
+ return self._glyph_map
+
+ def get_character_map(self):
+ """Return the character map.
+
+ Returns a dictionary where the key is a unit-length unicode
+ string and the value is a glyph index. Currently only
+ format 4 character maps are read.
+ """
+ if self._character_map:
+ return self._character_map
+ cmap = _read_cmap_header(self._data, self._tables['cmap'].offset)
+ records = _read_cmap_encoding_record.array(self._data,
+ self._tables['cmap'].offset + cmap.size, cmap.num_tables)
+ self._character_map = {}
+ for record in records:
+ if record.platform_id == 3 and record.encoding_id == 1:
+ # Look at Windows Unicode charmaps only
+ offset = self._tables['cmap'].offset + record.offset
+ format_header = _read_cmap_format_header(self._data, offset)
+ if format_header.format == 4:
+ self._character_map = \
+ self._get_character_map_format4(offset)
+ break
+ return self._character_map
+
+ def _get_character_map_format4(self, offset):
+ # This is absolutely, without question, the *worst* file
+ # format ever. Whoever the fuckwit is that thought this up is
+ # a fuckwit.
+ header = _read_cmap_format4Header(self._data, offset)
+ seg_count = header.seg_count_x2 // 2
+ array_size = struct.calcsize('>%dH' % seg_count)
+ end_count = self._read_array('>%dH' % seg_count,
+ offset + header.size)
+ start_count = self._read_array('>%dH' % seg_count,
+ offset + header.size + array_size + 2)
+ id_delta = self._read_array('>%dh' % seg_count,
+ offset + header.size + array_size + 2 + array_size)
+ id_range_offset_address = \
+ offset + header.size + array_size + 2 + array_size + array_size
+ id_range_offset = self._read_array('>%dH' % seg_count,
+ id_range_offset_address)
+ character_map = {}
+ for i in range(0, seg_count):
+ if id_range_offset[i] != 0:
+ if id_range_offset[i] == 65535:
+ continue # Hack around a dodgy font (babelfish.ttf)
+ for c in range(start_count[i], end_count[i] + 1):
+ addr = id_range_offset[i] + 2*(c - start_count[i]) + \
+ id_range_offset_address + 2*i
+ g = struct.unpack('>H', self._data[addr:addr+2])[0]
+ if g != 0:
+ character_map[chr(c)] = (g + id_delta[i]) % 65536
+ else:
+ for c in range(start_count[i], end_count[i] + 1):
+ g = (c + id_delta[i]) % 65536
+ if g != 0:
+ character_map[chr(c)] = g
+ return character_map
+
+ def _read_array(self, format, offset):
+ size = struct.calcsize(format)
+ return struct.unpack(format, self._data[offset:offset+size])
+
+ def close(self):
+ """Close the font file.
+
+ This is a good idea, since the entire file is memory mapped in
+ until this method is called. After closing cannot rely on the
+ ``get_*`` methods.
+ """
+
+ self._data.close()
+ os.close(self._fileno)
+
+def _read_table(*entries):
+ """ Generic table constructor used for table formats listed at
+ end of file."""
+ fmt = '>'
+ names = []
+ for entry in entries:
+ name, type = entry.split(':')
+ names.append(name)
+ fmt += type
+ class _table_class(object):
+ size = struct.calcsize(fmt)
+ def __init__(self, data, offset):
+ items = struct.unpack(fmt, data[offset:offset+self.size])
+ self.pairs = list(zip(names, items))
+ for name, value in self.pairs:
+ setattr(self, name, value)
+
+ def __repr__(self):
+ s = '{' + ', '.join(['%s = %s' % (name, value) \
+ for name, value in self.pairs]) + '}'
+ return s
+
+ @staticmethod
+ def array(data, offset, count):
+ tables = []
+ for i in range(count):
+ tables.append(_table_class(data, offset))
+ offset += _table_class.size
+ return tables
+
+ return _table_class
+
+
+# Table formats (see references)
+
+_read_offset_table = _read_table('scalertype:I',
+ 'num_tables:H',
+ 'search_range:H',
+ 'entry_selector:H',
+ 'range_shift:H')
+
+_read_table_directory_entry = _read_table('tag:4s',
+ 'check_sum:I',
+ 'offset:I',
+ 'length:I')
+_read_head_table = _read_table('version:i',
+ 'font_revision:i',
+ 'check_sum_adjustment:L',
+ 'magic_number:L',
+ 'flags:H',
+ 'units_per_em:H',
+ 'created:Q',
+ 'modified:Q',
+ 'x_min:h',
+ 'y_min:h',
+ 'x_max:h',
+ 'y_max:h',
+ 'mac_style:H',
+ 'lowest_rec_p_pEM:H',
+ 'font_direction_hint:h',
+ 'index_to_loc_format:h',
+ 'glyph_data_format:h')
+
+_read_OS2_table = _read_table('version:H',
+ 'x_avg_char_width:h',
+ 'us_weight_class:H',
+ 'us_width_class:H',
+ 'fs_type:H',
+ 'y_subscript_x_size:h',
+ 'y_subscript_y_size:h',
+ 'y_subscript_x_offset:h',
+ 'y_subscript_y_offset:h',
+ 'y_superscript_x_size:h',
+ 'y_superscript_y_size:h',
+ 'y_superscript_x_offset:h',
+ 'y_superscript_y_offset:h',
+ 'y_strikeout_size:h',
+ 'y_strikeout_position:h',
+ 's_family_class:h',
+ 'panose1:B',
+ 'panose2:B',
+ 'panose3:B',
+ 'panose4:B',
+ 'panose5:B',
+ 'panose6:B',
+ 'panose7:B',
+ 'panose8:B',
+ 'panose9:B',
+ 'panose10:B',
+ 'ul_unicode_range1:L',
+ 'ul_unicode_range2:L',
+ 'ul_unicode_range3:L',
+ 'ul_unicode_range4:L',
+ 'ach_vend_id:I',
+ 'fs_selection:H',
+ 'us_first_char_index:H',
+ 'us_last_char_index:H',
+ 's_typo_ascender:h',
+ 's_typo_descender:h',
+ 's_typo_line_gap:h',
+ 'us_win_ascent:H',
+ 'us_win_descent:H',
+ 'ul_code_page_range1:L',
+ 'ul_code_page_range2:L',
+ 'sx_height:h',
+ 's_cap_height:h',
+ 'us_default_char:H',
+ 'us_break_char:H',
+ 'us_max_context:H')
+
+_read_kern_header_table = _read_table('version_num:H',
+ 'n_tables:H')
+
+_read_kern_subtable_header = _read_table('version:H',
+ 'length:H',
+ 'coverage:H')
+_read_kern_subtable_header.horizontal_mask = 0x1
+_read_kern_subtable_header.minimum_mask = 0x2
+_read_kern_subtable_header.perpendicular_mask = 0x4
+_read_kern_subtable_header.override_mask = 0x5
+_read_kern_subtable_header.format_mask = 0xf0
+
+_read_kern_subtable_format0 = _read_table('n_pairs:H',
+ 'search_range:H',
+ 'entry_selector:H',
+ 'range_shift:H')
+_read_kern_subtable_format0Pair = _read_table('left:H',
+ 'right:H',
+ 'value:h')
+
+_read_cmap_header = _read_table('version:H',
+ 'num_tables:H')
+
+_read_cmap_encoding_record = _read_table('platform_id:H',
+ 'encoding_id:H',
+ 'offset:L')
+
+_read_cmap_format_header = _read_table('format:H',
+ 'length:H')
+_read_cmap_format4Header = _read_table('format:H',
+ 'length:H',
+ 'language:H',
+ 'seg_count_x2:H',
+ 'search_range:H',
+ 'entry_selector:H',
+ 'range_shift:H')
+
+_read_horizontal_header = _read_table('version:i',
+ 'Advance:h',
+ 'Descender:h',
+ 'LineGap:h',
+ 'advance_width_max:H',
+ 'min_left_side_bearing:h',
+ 'min_right_side_bearing:h',
+ 'x_max_extent:h',
+ 'caret_slope_rise:h',
+ 'caret_slope_run:h',
+ 'caret_offset:h',
+ 'reserved1:h',
+ 'reserved2:h',
+ 'reserved3:h',
+ 'reserved4:h',
+ 'metric_data_format:h',
+ 'number_of_h_metrics:H')
+
+_read_long_hor_metric = _read_table('advance_width:H',
+ 'lsb:h')
+
+_read_naming_table = _read_table('format:H',
+ 'count:H',
+ 'string_offset:H')
+
+_read_name_record = _read_table('platform_id:H',
+ 'encoding_id:H',
+ 'language_id:H',
+ 'name_id:H',
+ 'length:H',
+ 'offset:H')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/win32.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/win32.py
new file mode 100644
index 0000000..11e3c23
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/win32.py
@@ -0,0 +1,565 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+
+# TODO Windows Vista: need to call SetProcessDPIAware? May affect GDI+ calls
+# as well as font.
+
+from ctypes import *
+import ctypes
+import math
+
+from sys import byteorder
+import pyglet
+from pyglet.font import base
+from pyglet.font import win32query
+import pyglet.image
+from pyglet.libs.win32.constants import *
+from pyglet.libs.win32.types import *
+from pyglet.libs.win32 import _gdi32 as gdi32, _user32 as user32
+from pyglet.libs.win32 import _kernel32 as kernel32
+from pyglet.compat import asbytes
+
+_debug_font = pyglet.options['debug_font']
+
+
+def str_ucs2(text):
+ if byteorder == 'big':
+ text = text.encode('utf_16_be')
+ else:
+ text = text.encode('utf_16_le') # explicit endian avoids BOM
+ return create_string_buffer(text + '\0')
+
+_debug_dir = 'debug_font'
+def _debug_filename(base, extension):
+ import os
+ if not os.path.exists(_debug_dir):
+ os.makedirs(_debug_dir)
+ name = '%s-%%d.%%s' % os.path.join(_debug_dir, base)
+ num = 1
+ while os.path.exists(name % (num, extension)):
+ num += 1
+ return name % (num, extension)
+
+def _debug_image(image, name):
+ filename = _debug_filename(name, 'png')
+ image.save(filename)
+ _debug('Saved image %r to %s' % (image, filename))
+
+_debug_logfile = None
+def _debug(msg):
+ global _debug_logfile
+ if not _debug_logfile:
+ _debug_logfile = open(_debug_filename('log', 'txt'), 'wt')
+ _debug_logfile.write(msg + '\n')
+
+class Win32GlyphRenderer(base.GlyphRenderer):
+
+
+ def __init__(self, font):
+ self._bitmap = None
+ self._dc = None
+ self._bitmap_rect = None
+ super(Win32GlyphRenderer, self).__init__(font)
+ self.font = font
+
+ # Pessimistically round up width and height to 4 byte alignment
+ width = font.max_glyph_width
+ height = font.ascent - font.descent
+ width = (width | 0x3) + 1
+ height = (height | 0x3) + 1
+ self._create_bitmap(width, height)
+
+ gdi32.SelectObject(self._dc, self.font.hfont)
+
+ def _create_bitmap(self, width, height):
+ pass
+
+ def render(self, text):
+ raise NotImplementedError('abstract')
+
+class GDIGlyphRenderer(Win32GlyphRenderer):
+ def __del__(self):
+ try:
+ if self._dc:
+ gdi32.DeleteDC(self._dc)
+ if self._bitmap:
+ gdi32.DeleteObject(self._bitmap)
+ except:
+ pass
+
+ def render(self, text):
+ # Attempt to get ABC widths (only for TrueType)
+ abc = ABC()
+ if gdi32.GetCharABCWidthsW(self._dc,
+ ord(text), ord(text), byref(abc)):
+ width = abc.abcB
+ lsb = abc.abcA
+ advance = abc.abcA + abc.abcB + abc.abcC
+ else:
+ width_buf = c_int()
+ gdi32.GetCharWidth32W(self._dc,
+ ord(text), ord(text), byref(width_buf))
+ width = width_buf.value
+ lsb = 0
+ advance = width
+
+ # Can't get glyph-specific dimensions, use whole line-height.
+ height = self._bitmap_height
+ image = self._get_image(text, width, height, lsb)
+
+ glyph = self.font.create_glyph(image)
+ glyph.set_bearings(-self.font.descent, lsb, advance)
+
+ if _debug_font:
+ _debug('%r.render(%s)' % (self, text))
+ _debug('abc.abcA = %r' % abc.abcA)
+ _debug('abc.abcB = %r' % abc.abcB)
+ _debug('abc.abcC = %r' % abc.abcC)
+ _debug('width = %r' % width)
+ _debug('height = %r' % height)
+ _debug('lsb = %r' % lsb)
+ _debug('advance = %r' % advance)
+ _debug_image(image, 'glyph_%s' % text)
+ _debug_image(self.font.textures[0], 'tex_%s' % text)
+
+ return glyph
+
+ def _get_image(self, text, width, height, lsb):
+ # There's no such thing as a greyscale bitmap format in GDI. We can
+ # create an 8-bit palette bitmap with 256 shades of grey, but
+ # unfortunately antialiasing will not work on such a bitmap. So, we
+ # use a 32-bit bitmap and use the red channel as OpenGL's alpha.
+
+ gdi32.SelectObject(self._dc, self._bitmap)
+ gdi32.SelectObject(self._dc, self.font.hfont)
+ gdi32.SetBkColor(self._dc, 0x0)
+ gdi32.SetTextColor(self._dc, 0x00ffffff)
+ gdi32.SetBkMode(self._dc, OPAQUE)
+
+ # Draw to DC
+ user32.FillRect(self._dc, byref(self._bitmap_rect), self._black)
+ gdi32.ExtTextOutA(self._dc, -lsb, 0, 0, None, text,
+ len(text), None)
+ gdi32.GdiFlush()
+
+ # Create glyph object and copy bitmap data to texture
+ image = pyglet.image.ImageData(width, height,
+ 'AXXX', self._bitmap_data, self._bitmap_rect.right * 4)
+ return image
+
+ def _create_bitmap(self, width, height):
+ self._black = gdi32.GetStockObject(BLACK_BRUSH)
+ self._white = gdi32.GetStockObject(WHITE_BRUSH)
+
+ if self._dc:
+ gdi32.ReleaseDC(self._dc)
+ if self._bitmap:
+ gdi32.DeleteObject(self._bitmap)
+
+ pitch = width * 4
+ data = POINTER(c_byte * (height * pitch))()
+ info = BITMAPINFO()
+ info.bmiHeader.biSize = sizeof(info.bmiHeader)
+ info.bmiHeader.biWidth = width
+ info.bmiHeader.biHeight = height
+ info.bmiHeader.biPlanes = 1
+ info.bmiHeader.biBitCount = 32
+ info.bmiHeader.biCompression = BI_RGB
+
+ self._dc = gdi32.CreateCompatibleDC(None)
+ self._bitmap = gdi32.CreateDIBSection(None,
+ byref(info), DIB_RGB_COLORS, byref(data), None,
+ 0)
+ # Spookiness: the above line causes a "not enough storage" error,
+ # even though that error cannot be generated according to docs,
+ # and everything works fine anyway. Call SetLastError to clear it.
+ kernel32.SetLastError(0)
+
+ self._bitmap_data = data.contents
+ self._bitmap_rect = RECT()
+ self._bitmap_rect.left = 0
+ self._bitmap_rect.right = width
+ self._bitmap_rect.top = 0
+ self._bitmap_rect.bottom = height
+ self._bitmap_height = height
+
+ if _debug_font:
+ _debug('%r._create_dc(%d, %d)' % (self, width, height))
+ _debug('_dc = %r' % self._dc)
+ _debug('_bitmap = %r' % self._bitmap)
+ _debug('pitch = %r' % pitch)
+ _debug('info.bmiHeader.biSize = %r' % info.bmiHeader.biSize)
+
+class Win32Font(base.Font):
+ glyph_renderer_class = GDIGlyphRenderer
+
+ def __init__(self, name, size, bold=False, italic=False, dpi=None):
+ super(Win32Font, self).__init__()
+
+ self.logfont = self.get_logfont(name, size, bold, italic, dpi)
+ self.hfont = gdi32.CreateFontIndirectA(byref(self.logfont))
+
+ # Create a dummy DC for coordinate mapping
+ dc = user32.GetDC(0)
+ metrics = TEXTMETRIC()
+ gdi32.SelectObject(dc, self.hfont)
+ gdi32.GetTextMetricsA(dc, byref(metrics))
+ self.ascent = metrics.tmAscent
+ self.descent = -metrics.tmDescent
+ self.max_glyph_width = metrics.tmMaxCharWidth
+ user32.ReleaseDC(0, dc)
+
+ def __del__(self):
+ gdi32.DeleteObject(self.hfont)
+
+ @staticmethod
+ def get_logfont(name, size, bold, italic, dpi):
+ # Create a dummy DC for coordinate mapping
+ dc = user32.GetDC(0)
+ if dpi is None:
+ dpi = 96
+ logpixelsy = dpi
+
+ logfont = LOGFONT()
+ # Conversion of point size to device pixels
+ logfont.lfHeight = int(-size * logpixelsy // 72)
+ if bold:
+ logfont.lfWeight = FW_BOLD
+ else:
+ logfont.lfWeight = FW_NORMAL
+ logfont.lfItalic = italic
+ logfont.lfFaceName = asbytes(name)
+ logfont.lfQuality = ANTIALIASED_QUALITY
+ user32.ReleaseDC(0, dc)
+ return logfont
+
+ @classmethod
+ def have_font(cls, name):
+ # [ ] add support for loading raster fonts
+ return win32query.have_font(name)
+
+ @classmethod
+ def add_font_data(cls, data):
+ numfonts = c_uint32()
+ gdi32.AddFontMemResourceEx(data, len(data), 0, byref(numfonts))
+
+# --- GDI+ font rendering ---
+
+from pyglet.image.codecs.gdiplus import PixelFormat32bppARGB, gdiplus, Rect
+from pyglet.image.codecs.gdiplus import ImageLockModeRead, BitmapData
+
+DriverStringOptionsCmapLookup = 1
+DriverStringOptionsRealizedAdvance = 4
+TextRenderingHintAntiAlias = 4
+TextRenderingHintAntiAliasGridFit = 3
+
+StringFormatFlagsDirectionRightToLeft = 0x00000001
+StringFormatFlagsDirectionVertical = 0x00000002
+StringFormatFlagsNoFitBlackBox = 0x00000004
+StringFormatFlagsDisplayFormatControl = 0x00000020
+StringFormatFlagsNoFontFallback = 0x00000400
+StringFormatFlagsMeasureTrailingSpaces = 0x00000800
+StringFormatFlagsNoWrap = 0x00001000
+StringFormatFlagsLineLimit = 0x00002000
+StringFormatFlagsNoClip = 0x00004000
+
+class Rectf(ctypes.Structure):
+ _fields_ = [
+ ('x', ctypes.c_float),
+ ('y', ctypes.c_float),
+ ('width', ctypes.c_float),
+ ('height', ctypes.c_float),
+ ]
+
+class GDIPlusGlyphRenderer(Win32GlyphRenderer):
+ def __del__(self):
+ try:
+ if self._matrix:
+ res = gdiplus.GdipDeleteMatrix(self._matrix)
+ if self._brush:
+ res = gdiplus.GdipDeleteBrush(self._brush)
+ if self._graphics:
+ res = gdiplus.GdipDeleteGraphics(self._graphics)
+ if self._bitmap:
+ res = gdiplus.GdipDisposeImage(self._bitmap)
+ if self._dc:
+ res = user32.ReleaseDC(0, self._dc)
+ except:
+ pass
+
+ def _create_bitmap(self, width, height):
+ self._data = (ctypes.c_byte * (4 * width * height))()
+ self._bitmap = ctypes.c_void_p()
+ self._format = PixelFormat32bppARGB
+ gdiplus.GdipCreateBitmapFromScan0(width, height, width * 4,
+ self._format, self._data, ctypes.byref(self._bitmap))
+
+ self._graphics = ctypes.c_void_p()
+ gdiplus.GdipGetImageGraphicsContext(self._bitmap,
+ ctypes.byref(self._graphics))
+ gdiplus.GdipSetPageUnit(self._graphics, UnitPixel)
+
+ self._dc = user32.GetDC(0)
+ gdi32.SelectObject(self._dc, self.font.hfont)
+
+ gdiplus.GdipSetTextRenderingHint(self._graphics,
+ TextRenderingHintAntiAliasGridFit)
+
+
+ self._brush = ctypes.c_void_p()
+ gdiplus.GdipCreateSolidFill(0xffffffff, ctypes.byref(self._brush))
+
+
+ self._matrix = ctypes.c_void_p()
+ gdiplus.GdipCreateMatrix(ctypes.byref(self._matrix))
+
+ self._flags = (DriverStringOptionsCmapLookup |
+ DriverStringOptionsRealizedAdvance)
+
+ self._rect = Rect(0, 0, width, height)
+
+ self._bitmap_height = height
+
+ def render(self, text):
+
+ ch = ctypes.create_unicode_buffer(text)
+ len_ch = len(text)
+
+ # Layout rectangle; not clipped against so not terribly important.
+ width = 10000
+ height = self._bitmap_height
+ rect = Rectf(0, self._bitmap_height
+ - self.font.ascent + self.font.descent,
+ width, height)
+
+ # Set up GenericTypographic with 1 character measure range
+ generic = ctypes.c_void_p()
+ gdiplus.GdipStringFormatGetGenericTypographic(ctypes.byref(generic))
+ format = ctypes.c_void_p()
+ gdiplus.GdipCloneStringFormat(generic, ctypes.byref(format))
+ gdiplus.GdipDeleteStringFormat(generic)
+
+ # Measure advance
+
+ # XXX HACK HACK HACK
+ # Windows GDI+ is a filthy broken toy. No way to measure the bounding
+ # box of a string, or to obtain LSB. What a joke.
+ #
+ # For historical note, GDI cannot be used because it cannot composite
+ # into a bitmap with alpha.
+ #
+ # It looks like MS have abandoned GDI and GDI+ and are finally
+ # supporting accurate text measurement with alpha composition in .NET
+ # 2.0 (WinForms) via the TextRenderer class; this has no C interface
+ # though, so we're entirely screwed.
+ #
+ # So anyway, we first try to get the width with GdipMeasureString.
+ # Then if it's a TrueType font, we use GetCharABCWidthsW to get the
+ # correct LSB. If it's a negative LSB, we move the layoutRect `rect`
+ # to the right so that the whole glyph is rendered on the surface.
+ # For positive LSB, we let the renderer render the correct white
+ # space and we don't pass the LSB info to the Glyph.set_bearings
+
+ bbox = Rectf()
+ flags = (StringFormatFlagsMeasureTrailingSpaces |
+ StringFormatFlagsNoClip |
+ StringFormatFlagsNoFitBlackBox)
+ gdiplus.GdipSetStringFormatFlags(format, flags)
+ gdiplus.GdipMeasureString(self._graphics,
+ ch,
+ len_ch,
+ self.font._gdipfont,
+ ctypes.byref(rect),
+ format,
+ ctypes.byref(bbox),
+ None,
+ None)
+ lsb = 0
+ advance = int(math.ceil(bbox.width))
+ width = advance
+
+ # This hack bumps up the width if the font is italic;
+ # this compensates for some common fonts. It's also a stupid
+ # waste of texture memory.
+ if self.font.italic:
+ width += width // 2
+ # Do not enlarge more than the _rect width.
+ width = min(width, self._rect.Width)
+
+ # GDI functions only work for a single character so we transform
+ # grapheme \r\n into \r
+ if text == '\r\n':
+ text = '\r'
+
+ abc = ABC()
+ # Check if ttf font.
+ if gdi32.GetCharABCWidthsW(self._dc,
+ ord(text), ord(text), byref(abc)):
+
+ lsb = abc.abcA
+ if lsb < 0:
+ # Negative LSB: we shift the layout rect to the right
+ # Otherwise we will cut the left part of the glyph
+ rect.x = -lsb
+ width -= lsb
+ # XXX END HACK HACK HACK
+
+ # Draw character to bitmap
+
+ gdiplus.GdipGraphicsClear(self._graphics, 0x00000000)
+ gdiplus.GdipDrawString(self._graphics,
+ ch,
+ len_ch,
+ self.font._gdipfont,
+ ctypes.byref(rect),
+ format,
+ self._brush)
+ gdiplus.GdipFlush(self._graphics, 1)
+ gdiplus.GdipDeleteStringFormat(format)
+
+ bitmap_data = BitmapData()
+ gdiplus.GdipBitmapLockBits(self._bitmap,
+ byref(self._rect), ImageLockModeRead, self._format,
+ byref(bitmap_data))
+
+ # Create buffer for RawImage
+ buffer = create_string_buffer(
+ bitmap_data.Stride * bitmap_data.Height)
+ memmove(buffer, bitmap_data.Scan0, len(buffer))
+
+ # Unlock data
+ gdiplus.GdipBitmapUnlockBits(self._bitmap, byref(bitmap_data))
+
+ image = pyglet.image.ImageData(width, height,
+ 'BGRA', buffer, -bitmap_data.Stride)
+
+ glyph = self.font.create_glyph(image)
+ # Only pass negative LSB info
+ lsb = min(lsb, 0)
+ glyph.set_bearings(-self.font.descent, lsb, advance)
+
+ return glyph
+
+FontStyleBold = 1
+FontStyleItalic = 2
+UnitPixel = 2
+UnitPoint = 3
+
+class GDIPlusFont(Win32Font):
+ glyph_renderer_class = GDIPlusGlyphRenderer
+
+ _private_fonts = None
+
+ _default_name = 'Arial'
+
+ def __init__(self, name, size, bold=False, italic=False, dpi=None):
+ if not name:
+ name = self._default_name
+ super(GDIPlusFont, self).__init__(name, size, bold, italic, dpi)
+
+ family = ctypes.c_void_p()
+ name = ctypes.c_wchar_p(name)
+
+ # Look in private collection first:
+ if self._private_fonts:
+ gdiplus.GdipCreateFontFamilyFromName(name,
+ self._private_fonts, ctypes.byref(family))
+
+ # Then in system collection:
+ if not family:
+ gdiplus.GdipCreateFontFamilyFromName(name,
+ None, ctypes.byref(family))
+
+ # Nothing found, use default font.
+ if not family:
+ name = self._default_name
+ gdiplus.GdipCreateFontFamilyFromName(ctypes.c_wchar_p(name),
+ None, ctypes.byref(family))
+
+ if dpi is None:
+ unit = UnitPoint
+ self.dpi = 96
+ else:
+ unit = UnitPixel
+ size = (size * dpi) // 72
+ self.dpi = dpi
+
+ style = 0
+ if bold:
+ style |= FontStyleBold
+ if italic:
+ style |= FontStyleItalic
+ self._gdipfont = ctypes.c_void_p()
+ gdiplus.GdipCreateFont(family, ctypes.c_float(size),
+ style, unit, ctypes.byref(self._gdipfont))
+ gdiplus.GdipDeleteFontFamily(family)
+
+ def __del__(self):
+ super(GDIPlusFont, self).__del__()
+ result = gdiplus.GdipDeleteFont(self._gdipfont)
+
+ @classmethod
+ def add_font_data(cls, data):
+ super(GDIPlusFont, cls).add_font_data(data)
+
+ if not cls._private_fonts:
+ cls._private_fonts = ctypes.c_void_p()
+ gdiplus.GdipNewPrivateFontCollection(
+ ctypes.byref(cls._private_fonts))
+ gdiplus.GdipPrivateAddMemoryFont(cls._private_fonts, data, len(data))
+
+ @classmethod
+ def have_font(cls, name):
+ family = ctypes.c_void_p()
+
+ # Look in private collection first:
+ num_count = ctypes.c_int()
+ gdiplus.GdipGetFontCollectionFamilyCount(
+ cls._private_fonts, ctypes.byref(num_count))
+ gpfamilies = (ctypes.c_void_p * num_count.value)()
+ numFound = ctypes.c_int()
+ gdiplus.GdipGetFontCollectionFamilyList(
+ cls._private_fonts, num_count, gpfamilies, ctypes.byref(numFound))
+
+ font_name = ctypes.create_unicode_buffer(32)
+ for gpfamily in gpfamilies:
+ gdiplus.GdipGetFamilyName(gpfamily, font_name, '\0')
+ if font_name.value == name:
+ return True
+
+ # Else call parent class for system fonts
+ return super(GDIPlusFont, cls).have_font(name)
\ No newline at end of file
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/win32query.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/win32query.py
new file mode 100644
index 0000000..695ba93
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/font/win32query.py
@@ -0,0 +1,529 @@
+"""
+Query system Windows fonts with pure Python.
+
+Public domain work by anatoly techtonik
+Use MIT License if public domain doesn't make sense for you.
+
+
+
+The task: Get monospace font for an application in the order of
+preference.
+
+A problem: Font ID in Windows is its name. Windows doesn't provide
+any information about filenames they contained in. From two different
+files with the same font name you can get only one.
+
+Windows also doesn't have a clear concept of _generic font family_
+familiar from CSS specification. Here is how fontquery maps Windows
+LOGFONT properties to generic CSS font families:
+
+ serif - (LOGFONT.lfPitchAndFamily >> 4) == FF_ROMAN
+ sans-serif - (LOGFONT.lfPitchAndFamily >> 4) == FF_SWISS
+ cursive - (LOGFONT.lfPitchAndFamily >> 4) == FF_SCRIPT
+ fantasy - (LOGFONT.lfPitchAndFamily >> 4) == FF_DECORATIVE
+ monospace - (lf.lfPitchAndFamily & 0b11) == FIXED_PITCH
+
+NOTE: ATM, May 2015, the Microsoft documentation related to monospace
+is misleading due to poor wording:
+ - FF_MODERN in the description of LOGFONT structure tells
+ "Fonts with constant stroke width (monospace), with or without serifs.
+ Monospace fonts are usually modern.
+ Pica, Elite, and CourierNew are examples.
+ "
+
+ Stroke width is the 'pen width', not glyph width. It should read
+
+ "Fonts with constant stroke width, with or without serifs.
+ Monospace fonts are usually modern, but not all modern are monospace
+ "
+
+PYGLET NOTE:
+Examination of all fonts in a windows xp machine shows that all fonts
+with
+
+ fontentry.vector and fontentry.family != FF_DONTCARE
+
+are rendered fine.
+
+
+Use cases:
+ [x] get the list of all available system font names
+ [ ] get the list of all fonts for generic family
+ [ ] get the list of all fonts for specific charset
+ [ ] check if specific font is available
+
+Considerations:
+ - performance of querying all system fonts is not measured
+ - Windows doesn't allow to get filenames of the fonts, so if there
+ are two fonts with the same name, one will be missing
+
+MSDN:
+
+ If you request a font named Palatino, but no such font is available
+on the system, the font mapper will substitute a font that has similar
+attributes but a different name.
+
+ [ ] check if font chosen by the system has required family
+
+ To get the appropriate font, call EnumFontFamiliesEx with the
+desired font characteristics in the LOGFONT structure, then retrieve the
+appropriate typeface name and create the font using CreateFont or
+CreateFontIndirect.
+
+"""
+from __future__ import print_function
+from builtins import object
+DEBUG = False
+
+__all__ = ['have_font', 'font_list']
+
+__version__ = '0.3'
+__url__ = 'https://bitbucket.org/techtonik/fontquery'
+
+import sys
+PY3K = sys.version_info >= (3, 0)
+
+#-- INTRO: MAINTAIN CACHED FONTS DB --
+
+# [ ] make it Django/NDB style model definition
+class FontEntry(object):
+ """
+ Font classification.
+ Level 0:
+ - name
+ - vector (True if font is vector, False for raster fonts)
+ - format: ttf | ...
+ """
+ def __init__(self, name, vector, format, monospace, family):
+ self.name = name
+ self.vector = vector
+ self.format = format
+ self.monospace = monospace
+ self.family = family
+
+# List of FontEntry objects
+FONTDB = []
+
+
+#-- CHAPTER 1: GET ALL SYSTEM FONTS USING EnumFontFamiliesEx FROM GDI --
+
+"""
+Q: Why GDI? Why not GDI+?
+A: Wikipedia:
+
+ Because of the additional text processing and resolution independence
+capabilities in GDI+, text rendering is performed by the CPU [2] and it
+is nearly an order of magnitude slower than in hardware accelerated GDI.[3]
+Chris Jackson published some tests indicating that a piece of text
+rendering code he had written could render 99,000 glyphs per second in GDI,
+but the same code using GDI+ rendered 16,600 glyphs per second.
+"""
+
+import ctypes
+from ctypes import wintypes
+
+user32 = ctypes.windll.user32
+gdi32 = ctypes.windll.gdi32
+
+# --- define necessary data structures from wingdi.h
+
+# for calling ANSI functions of Windows API (end with A) TCHAR is
+# defined as single char, for Unicode ones (end witn W) it is WCHAR
+CHAR = ctypes.c_char # Python 2.7 compatibility
+TCHAR = CHAR
+BYTE = ctypes.c_ubyte # http://bugs.python.org/issue16376
+
+# charset codes for LOGFONT structure
+ANSI_CHARSET = 0
+ARABIC_CHARSET = 178
+BALTIC_CHARSET = 186
+CHINESEBIG5_CHARSET = 136
+DEFAULT_CHARSET = 1
+ # - charset for current system locale -
+ # means function can be called several times
+ # for the single font (for each charset)
+EASTEUROPE_CHARSET = 238
+GB2312_CHARSET = 134
+GREEK_CHARSET = 161
+HANGUL_CHARSET = 129
+HEBREW_CHARSET = 177
+JOHAB_CHARSET = 130
+MAC_CHARSET = 77
+OEM_CHARSET = 255 # OS dependent system charset
+RUSSIAN_CHARSET = 204
+SHIFTJIS_CHARSET = 128
+SYMBOL_CHARSET = 2
+THAI_CHARSET = 222
+TURKISH_CHARSET = 162
+VIETNAMESE_CHARSET = 163
+
+# build lookup dictionary to get charset name from its code
+CHARSET_NAMES = {}
+for (name, value) in locals().copy().items():
+ if name.endswith('_CHARSET'):
+ CHARSET_NAMES[value] = name
+
+# font pitch constants ('fixed pitch' means 'monospace')
+DEFAULT_PITCH = 0
+FIXED_PITCH = 1
+VARIABLE_PITCH = 2
+
+# Windows font family constants
+FF_DONTCARE = 0 # Don't care or don't know
+FF_ROMAN = 1 # with serifs, proportional
+FF_SWISS = 2 # w/out serifs, proportional
+FF_MODERN = 3 # constant stroke width
+FF_SCRIPT = 4 # handwritten
+FF_DECORATIVE = 5 # novelty
+
+
+class LOGFONT(ctypes.Structure):
+ # EnumFontFamiliesEx examines only 3 fields:
+ # - lfCharSet
+ # - lfFaceName - empty string enumerates one font in each available
+ # typeface name, valid typeface name gets all fonts
+ # with that name
+ # - lfPitchAndFamily - must be set to 0 [ ]
+ _fields_ = [
+ ('lfHeight', wintypes.LONG),
+ # value > 0 specifies the largest size of *char cell* to match
+ # char cell = char height + internal leading
+ # value = 0 makes matched use default height for search
+ # value < 0 specifies the largest size of *char height* to match
+ ('lfWidth', wintypes.LONG),
+ # average width also in *logical units*, which are pixels in
+ # default _mapping mode_ (MM_TEXT) for device
+ ('lfEscapement', wintypes.LONG),
+ # string baseline rotation in tenths of degrees
+ ('lfOrientation', wintypes.LONG),
+ # character rotation in tenths of degrees
+ ('lfWeight', wintypes.LONG),
+ # 0 through 1000 400 is normal, 700 is bold, 0 is default
+ ('lfItalic', BYTE),
+ ('lfUnderline', BYTE),
+ ('lfStrikeOut', BYTE),
+ ('lfCharSet', BYTE),
+ # ANSI_CHARSET, BALTIC_CHARSET, ... - see *_CHARSET constants above
+ ('lfOutPrecision', BYTE),
+ # many constants how the output must match height, width, pitch etc.
+ # OUT_DEFAULT_PRECIS
+ # [ ] TODO
+ ('lfClipPrecision', BYTE),
+ # how to clip characters, no useful properties, leave default value
+ # CLIP_DEFAULT_PRECIS
+ ('lfQuality', BYTE),
+ # ANTIALIASED_QUALITY
+ # CLEARTYPE_QUALITY
+ # DEFAULT_QUALITY
+ # DRAFT_QUALITY
+ # NONANTIALIASED_QUALITY
+ # PROOF_QUALITY
+ ('lfPitchAndFamily', BYTE),
+ # DEFAULT_PITCH
+ # FIXED_PITCH - authoritative for monospace
+ # VARIABLE_PITCH
+ # stacked with any of
+ # FF_DECORATIVE - novelty
+ # FF_DONTCARE - default font
+ # FF_MODERN - stroke width ('pen width') near constant
+ # FF_ROMAN - proportional (variable char width) with serifs
+ # FF_SCRIPT - handwritten
+ # FF_SWISS - proportional without serifs
+ ('lfFaceName', TCHAR*32)]
+ # typeface name of the font - null-terminated string
+
+class FONTSIGNATURE(ctypes.Structure):
+ # supported code pages and Unicode subranges for the font
+ # needed for NEWTEXTMETRICEX structure
+ _fields_ = [
+ ('sUsb', wintypes.DWORD*4), # 128-bit Unicode subset bitfield (USB)
+ ('sCsb', wintypes.DWORD*2)] # 64-bit, code-page bitfield (CPB)
+
+class NEWTEXTMETRIC(ctypes.Structure):
+ # physical font attributes for True Type fonts
+ # needed for NEWTEXTMETRICEX structure
+ _fields_ = [
+ ('tmHeight', wintypes.LONG),
+ ('tmAscent', wintypes.LONG),
+ ('tmDescent', wintypes.LONG),
+ ('tmInternalLeading', wintypes.LONG),
+ ('tmExternalLeading', wintypes.LONG),
+ ('tmAveCharWidth', wintypes.LONG),
+ ('tmMaxCharWidth', wintypes.LONG),
+ ('tmWeight', wintypes.LONG),
+ ('tmOverhang', wintypes.LONG),
+ ('tmDigitizedAspectX', wintypes.LONG),
+ ('tmDigitizedAspectY', wintypes.LONG),
+ ('mFirstChar', TCHAR),
+ ('mLastChar', TCHAR),
+ ('mDefaultChar', TCHAR),
+ ('mBreakChar', TCHAR),
+ ('tmItalic', BYTE),
+ ('tmUnderlined', BYTE),
+ ('tmStruckOut', BYTE),
+ ('tmPitchAndFamily', BYTE),
+ ('tmCharSet', BYTE),
+ ('tmFlags', wintypes.DWORD),
+ ('ntmSizeEM', wintypes.UINT),
+ ('ntmCellHeight', wintypes.UINT),
+ ('ntmAvgWidth', wintypes.UINT)]
+
+class NEWTEXTMETRICEX(ctypes.Structure):
+ # physical font attributes for True Type fonts
+ # needed for FONTENUMPROC callback function
+ _fields_ = [
+ ('ntmTm', NEWTEXTMETRIC),
+ ('ntmFontSig', FONTSIGNATURE)]
+
+
+# type for a function that is called by the system for
+# each font during execution of EnumFontFamiliesEx
+FONTENUMPROC = ctypes.WINFUNCTYPE(
+ ctypes.c_int, # return non-0 to continue enumeration, 0 to stop
+ ctypes.POINTER(LOGFONT),
+ ctypes.POINTER(NEWTEXTMETRICEX),
+ wintypes.DWORD, # font type, a combination of
+ # DEVICE_FONTTYPE
+ # RASTER_FONTTYPE
+ # TRUETYPE_FONTTYPE
+ wintypes.LPARAM
+)
+
+# When running 64 bit windows, some types are not 32 bit, so Python/ctypes guesses wrong
+gdi32.EnumFontFamiliesExA.argtypes = [
+ wintypes.HDC,
+ ctypes.POINTER(LOGFONT),
+ FONTENUMPROC,
+ wintypes.LPARAM,
+ wintypes.DWORD]
+
+
+def _enum_font_names(logfont, textmetricex, fonttype, param):
+ """callback function to be executed during EnumFontFamiliesEx
+ call for each font name. it stores names in global variable
+ """
+ global FONTDB
+
+ lf = logfont.contents
+ name = lf.lfFaceName
+ if PY3K:
+ # [ ] check this works
+ name = name.decode('utf-8')
+
+ # detect font type (vector|raster) and format (ttf)
+ # [ ] use Windows constant TRUETYPE_FONTTYPE
+ if fonttype & 4:
+ vector = True
+ format = 'ttf'
+ else:
+ vector = False
+ # [ ] research Windows raster format structure
+ format = 'unknown'
+
+ pitch = lf.lfPitchAndFamily & 0b11
+ family = lf.lfPitchAndFamily >> 4
+
+ # [ ] check FIXED_PITCH, VARIABLE_PITCH and FF_MODERN
+ # combination
+ #
+ # FP T NM 400 CHARSET: 0 DFKai-SB
+ # FP T NM 400 CHARSET: 136 DFKai-SB
+ # FP T NM 400 CHARSET: 0 @DFKai-SB
+ # FP T NM 400 CHARSET: 136 @DFKai-SB
+ # VP T M 400 CHARSET: 0 OCR A Extended
+
+ monospace = (pitch == FIXED_PITCH)
+
+ charset = lf.lfCharSet
+
+ FONTDB.append(FontEntry(name, vector, format, monospace, family))
+
+ if DEBUG:
+ info = ''
+
+ if pitch == FIXED_PITCH:
+ info += 'FP '
+ elif pitch == VARIABLE_PITCH:
+ info += 'VP '
+ else:
+ info += ' '
+
+ # [ ] check exact fonttype values meaning
+ info += '%s ' % {0:'U', 1:'R', 4:'T'}[fonttype]
+
+ if monospace:
+ info += 'M '
+ else:
+ info += 'NM '
+
+ style = [' ']*3
+ if lf.lfItalic:
+ style[0] = 'I'
+ if lf.lfUnderline:
+ style[1] = 'U'
+ if lf.lfStrikeOut:
+ style[2] = 'S'
+ info += ''.join(style)
+
+ info += ' %s' % lf.lfWeight
+
+ #if pitch == FIXED_PITCH:
+ if 1:
+ print('%s CHARSET: %3s %s' % (info, lf.lfCharSet, lf.lfFaceName))
+
+ return 1 # non-0 to continue enumeration
+enum_font_names = FONTENUMPROC(_enum_font_names)
+
+# --- /define
+
+
+# --- prepare and call EnumFontFamiliesEx
+
+def query(charset=DEFAULT_CHARSET):
+ """
+ Prepare and call EnumFontFamiliesEx.
+
+ query()
+ - return tuple with sorted list of all available system fonts
+ query(charset=ANSI_CHARSET)
+ - return tuple sorted list of system fonts supporting ANSI charset
+
+ """
+ global FONTDB
+
+ # 1. Get device context of the entire screen
+ hdc = user32.GetDC(None)
+
+ # 2. Call EnumFontFamiliesExA (ANSI version)
+
+ # 2a. Call with empty font name to query all available fonts
+ # (or fonts for the specified charset)
+ #
+ # NOTES:
+ #
+ # * there are fonts that don't support ANSI charset
+ # * for DEFAULT_CHARSET font is passed to callback function as
+ # many times as charsets it supports
+
+ # [ ] font name should be less than 32 symbols with terminating \0
+ # [ ] check double purpose - enumerate all available font names
+ # - enumerate all available charsets for a single font
+ # - other params?
+
+ logfont = LOGFONT(0, 0, 0, 0, 0, 0, 0, 0, charset,
+ 0, 0, 0, 0, b'\0')
+ FONTDB = [] # clear cached FONTDB for enum_font_names callback
+ res = gdi32.EnumFontFamiliesExA(
+ hdc, # handle to device context
+ ctypes.byref(logfont),
+ enum_font_names, # pointer to callback function
+ 0, # lParam - application-supplied data
+ 0) # dwFlags - reserved = 0
+ # res here is the last value returned by callback function
+
+ # 3. Release DC
+ user32.ReleaseDC(None, hdc)
+
+ return FONTDB
+
+
+# --- Public API ---
+
+def have_font(name, refresh=False):
+ """
+ Return True if font with specified `name` is present. The result
+ of querying system font names is cached. Set `refresh` parameter
+ to True to purge cache and reload font information.
+ """
+ if not FONTDB or refresh:
+ query()
+ if any(f.name == name for f in FONTDB):
+ return True
+ else:
+ return False
+
+def font_list(vector_only=False, monospace_only=False):
+ """Return list of system installed font names."""
+
+ if not FONTDB:
+ query()
+
+ fonts = FONTDB
+ if vector_only:
+ fonts = [f for f in fonts if f.vector]
+ if monospace_only:
+ fonts = [f for f in fonts if f.monospace]
+
+ return sorted([f.name for f in fonts])
+
+if __name__ == '__main__':
+ import sys
+ if sys.argv[1:] == ['debug']:
+ DEBUG = True
+
+ if sys.argv[1:] == ['test'] or DEBUG:
+ print('Running tests..')
+ # test have_font (Windows)
+ test_arial = have_font('Arial')
+ print('Have font "Arial"? %s' % test_arial)
+ print('Have font "missing-one"? %s' % have_font('missing-one'))
+ # test cache is not rebuilt
+ FONTDB = [FontEntry('stub', False, '', False, FF_MODERN)]
+ assert(have_font('Arial') != test_arial)
+ # test cache is rebiult
+ assert(have_font('Arial', refresh=True) == test_arial)
+ if not DEBUG:
+ sys.exit()
+
+ if sys.argv[1:] == ['vector']:
+ fonts = font_list(vector_only=True)
+ elif sys.argv[1:] == ['mono']:
+ fonts = font_list(monospace_only=True)
+ elif sys.argv[1:] == ['vector','mono']:
+ fonts = font_list(vector_only=True, monospace_only=True)
+ else:
+ fonts = font_list()
+ print('\n'.join(fonts))
+
+ if DEBUG:
+ print("Total: %s" % len(font_list()))
+
+
+
+
+#-- CHAPTER 2: WORK WITH FONT DIMENSIONS --
+#
+# Essential info about font metrics http://support.microsoft.com/kb/32667
+# And about logical units at http://www.winprog.org/tutorial/fonts.html
+
+# x. Convert desired font size from points into logical units (pixels)
+
+# By default logical for the screen units are pixels. This is defined
+# by default MM_TEXT mapping mode.
+
+# Point is ancient unit of measurement for physical size of a font.
+# 10pt is equal to 3.527mm. To make sure a char on screen has physical
+# size equal to 3.527mm, we need to know display size to calculate how
+# many pixels are in 3.527mm, and then fetch font that best matches
+# this size.
+
+# Essential info about conversion http://support.microsoft.com/kb/74299
+
+# x.1 Get pixels per inch using GetDeviceCaps() or ...
+
+
+#-- CHAPTER 3: LAYERED FONT API --
+#
+# y. Font object with several layers of info
+
+# Font object should contains normalized font information. This
+# information is split according to usage. For example, level 0 property
+# is font id - its name. Level 1 can be information about loaded font
+# characters - in pyglet it could be cached/used glyphs and video memory
+# taken by those glyphs.
+
+# [ ] (pyglet) investigate if it is possible to get video memory size
+# occupied by the font glyphs
+
+# [ ] (pyglet) investigate if it is possible to unload font from video
+# memory if its unused
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/__init__.py
new file mode 100644
index 0000000..523d6f3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/__init__.py
@@ -0,0 +1,239 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''OpenGL and GLU interface.
+
+This package imports all OpenGL, GLU and registered OpenGL extension
+functions. Functions have identical signatures to their C counterparts. For
+example::
+
+ from pyglet.gl import *
+
+ # [...omitted: set up a GL context and framebuffer]
+ glBegin(GL_QUADS)
+ glVertex3f(0, 0, 0)
+ glVertex3f(0.1, 0.2, 0.3)
+ glVertex3f(0.1, 0.2, 0.3)
+ glEnd()
+
+OpenGL is documented in full at the `OpenGL Reference Pages`_.
+
+The `OpenGL Programming Guide`_ is a popular reference manual organised by
+topic. The free online version documents only OpenGL 1.1. `Later editions`_
+cover more recent versions of the API and can be purchased from a book store.
+
+.. _OpenGL Reference Pages: http://www.opengl.org/documentation/red_book/
+.. _OpenGL Programming Guide: http://fly.cc.fer.hr/~unreal/theredbook/
+.. _Later editions: http://www.opengl.org/documentation/red_book/
+
+The following subpackages are imported into this "mega" package already (and
+so are available by importing ``pyglet.gl``):
+
+``pyglet.gl.gl``
+ OpenGL
+``pyglet.gl.glu``
+ GLU
+``pyglet.gl.gl.glext_arb``
+ ARB registered OpenGL extension functions
+
+These subpackages are also available, but are not imported into this namespace
+by default:
+
+``pyglet.gl.glext_nv``
+ nVidia OpenGL extension functions
+``pyglet.gl.agl``
+ AGL (Mac OS X OpenGL context functions)
+``pyglet.gl.glx``
+ GLX (Linux OpenGL context functions)
+``pyglet.gl.glxext_arb``
+ ARB registered GLX extension functions
+``pyglet.gl.glxext_nv``
+ nvidia GLX extension functions
+``pyglet.gl.wgl``
+ WGL (Windows OpenGL context functions)
+``pyglet.gl.wglext_arb``
+ ARB registered WGL extension functions
+``pyglet.gl.wglext_nv``
+ nvidia WGL extension functions
+
+The information modules are provided for convenience, and are documented
+below.
+'''
+from __future__ import print_function
+from __future__ import absolute_import
+from builtins import range
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+from pyglet.gl.lib import GLException
+from pyglet.gl.gl import *
+from pyglet.gl.glu import *
+from pyglet.gl.glext_arb import *
+from pyglet.gl import gl_info
+
+import sys as _sys
+_is_epydoc = hasattr(_sys, 'is_epydoc') and _sys.is_epydoc
+
+#: The active OpenGL context.
+#:
+#: You can change the current context by calling `Context.set_current`; do not
+#: modify this global.
+#:
+#: :type: `Context`
+#:
+#: .. versionadded:: 1.1
+current_context = None
+
+def get_current_context():
+ '''Return the active OpenGL context.
+
+ You can change the current context by calling `Context.set_current`.
+
+ :deprecated: Use `current_context`
+
+ :rtype: `Context`
+ :return: the context to which OpenGL commands are directed, or None
+ if there is no selected context.
+ '''
+ return current_context
+
+class ContextException(Exception):
+ pass
+
+class ConfigException(Exception):
+ pass
+
+import pyglet as _pyglet
+
+if _pyglet.options['debug_texture']:
+ _debug_texture_total = 0
+ _debug_texture_sizes = {}
+ _debug_texture = None
+
+ def _debug_texture_alloc(texture, size):
+ global _debug_texture_total
+
+ _debug_texture_sizes[texture] = size
+ _debug_texture_total += size
+
+ print('%d (+%d)' % (_debug_texture_total, size))
+
+ def _debug_texture_dealloc(texture):
+ global _debug_texture_total
+
+ size = _debug_texture_sizes[texture]
+ del _debug_texture_sizes[texture]
+ _debug_texture_total -= size
+
+ print('%d (-%d)' % (_debug_texture_total, size))
+
+ _glBindTexture = glBindTexture
+ def glBindTexture(target, texture):
+ global _debug_texture
+ _debug_texture = texture
+ return _glBindTexture(target, texture)
+
+ _glTexImage2D = glTexImage2D
+ def glTexImage2D(target, level, internalformat, width, height, border,
+ format, type, pixels):
+ try:
+ _debug_texture_dealloc(_debug_texture)
+ except KeyError:
+ pass
+
+ if internalformat in (1, GL_ALPHA, GL_INTENSITY, GL_LUMINANCE):
+ depth = 1
+ elif internalformat in (2, GL_RGB16, GL_RGBA16):
+ depth = 2
+ elif internalformat in (3, GL_RGB):
+ depth = 3
+ else:
+ depth = 4 # Pretty crap assumption
+ size = (width + 2 * border) * (height + 2 * border) * depth
+ _debug_texture_alloc(_debug_texture, size)
+
+ return _glTexImage2D(target, level, internalformat, width, height,
+ border, format, type, pixels)
+
+ _glDeleteTextures = glDeleteTextures
+ def glDeleteTextures(n, textures):
+ if not hasattr(textures, '__len__'):
+ _debug_texture_dealloc(textures.value)
+ else:
+ for i in range(n):
+ _debug_texture_dealloc(textures[i].value)
+
+ return _glDeleteTextures(n, textures)
+
+def _create_shadow_window():
+ global _shadow_window
+
+ import pyglet
+ if not pyglet.options['shadow_window'] or _is_epydoc:
+ return
+
+ from pyglet.window import Window
+ _shadow_window = Window(width=1, height=1, visible=False)
+ _shadow_window.switch_to()
+
+ from pyglet import app
+ app.windows.remove(_shadow_window)
+
+from pyglet import compat_platform
+from .base import ObjectSpace, CanvasConfig, Context
+if _is_epydoc:
+ from .base import Config
+elif compat_platform in ('win32', 'cygwin'):
+ from .win32 import Win32Config as Config
+elif compat_platform.startswith('linux'):
+ from .xlib import XlibConfig as Config
+elif compat_platform == 'darwin':
+ if _pyglet.options['darwin_cocoa']:
+ from .cocoa import CocoaConfig as Config
+ else:
+ from .carbon import CarbonConfig as Config
+del base
+
+# XXX remove
+_shadow_window = None
+
+# Import pyglet.window now if it isn't currently being imported (this creates
+# the shadow window).
+if (not _is_epydoc and
+ 'pyglet.window' not in _sys.modules and
+ _pyglet.options['shadow_window']):
+ # trickery is for circular import
+ _pyglet.gl = _sys.modules[__name__]
+ import pyglet.window
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/agl.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/agl.py
new file mode 100644
index 0000000..fb1bca1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/agl.py
@@ -0,0 +1,450 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+'''Wrapper for /System/Library/Frameworks/AGL.framework/Headers/agl.h
+
+Generated by tools/gengl.py.
+Do not modify this file.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: gengl.py 601 2007-02-04 05:36:59Z Alex.Holkner $'
+
+from ctypes import *
+from pyglet.gl.lib import link_AGL as _link_function
+
+if not _link_function:
+ raise ImportError('AGL framework is not available.')
+
+# BEGIN GENERATED CONTENT (do not edit below this line)
+
+# This content is generated by tools/gengl.py.
+# Wrapper for /System/Library/Frameworks/AGL.framework/Headers/agl.h
+
+
+AGL_VERSION_2_0 = 1 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:41
+class struct_GDevice(Structure):
+ __slots__ = [
+ ]
+struct_GDevice._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+GDevice = struct_GDevice # /System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/Quickdraw.h:1347
+GDPtr = POINTER(GDevice) # /System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/Quickdraw.h:1348
+GDHandle = POINTER(GDPtr) # /System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/Quickdraw.h:1349
+AGLDevice = GDHandle # /System/Library/Frameworks/AGL.framework/Headers/agl.h:46
+class struct_OpaqueGrafPtr(Structure):
+ __slots__ = [
+ ]
+struct_OpaqueGrafPtr._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+GrafPtr = POINTER(struct_OpaqueGrafPtr) # /System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/Quickdraw.h:1009
+CGrafPtr = GrafPtr # /System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/Quickdraw.h:1392
+AGLDrawable = CGrafPtr # /System/Library/Frameworks/AGL.framework/Headers/agl.h:51
+class struct___AGLRendererInfoRec(Structure):
+ __slots__ = [
+ ]
+struct___AGLRendererInfoRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+AGLRendererInfo = POINTER(struct___AGLRendererInfoRec) # /System/Library/Frameworks/AGL.framework/Headers/agl.h:56
+class struct___AGLPixelFormatRec(Structure):
+ __slots__ = [
+ ]
+struct___AGLPixelFormatRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+AGLPixelFormat = POINTER(struct___AGLPixelFormatRec) # /System/Library/Frameworks/AGL.framework/Headers/agl.h:57
+class struct___AGLContextRec(Structure):
+ __slots__ = [
+ ]
+struct___AGLContextRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+AGLContext = POINTER(struct___AGLContextRec) # /System/Library/Frameworks/AGL.framework/Headers/agl.h:58
+class struct___AGLPBufferRec(Structure):
+ __slots__ = [
+ ]
+struct___AGLPBufferRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+AGLPbuffer = POINTER(struct___AGLPBufferRec) # /System/Library/Frameworks/AGL.framework/Headers/agl.h:59
+AGL_NONE = 0 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:66
+AGL_ALL_RENDERERS = 1 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:67
+AGL_BUFFER_SIZE = 2 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:68
+AGL_LEVEL = 3 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:69
+AGL_RGBA = 4 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:70
+AGL_DOUBLEBUFFER = 5 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:71
+AGL_STEREO = 6 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:72
+AGL_AUX_BUFFERS = 7 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:73
+AGL_RED_SIZE = 8 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:74
+AGL_GREEN_SIZE = 9 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:75
+AGL_BLUE_SIZE = 10 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:76
+AGL_ALPHA_SIZE = 11 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:77
+AGL_DEPTH_SIZE = 12 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:78
+AGL_STENCIL_SIZE = 13 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:79
+AGL_ACCUM_RED_SIZE = 14 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:80
+AGL_ACCUM_GREEN_SIZE = 15 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:81
+AGL_ACCUM_BLUE_SIZE = 16 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:82
+AGL_ACCUM_ALPHA_SIZE = 17 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:83
+AGL_PIXEL_SIZE = 50 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:88
+AGL_MINIMUM_POLICY = 51 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:89
+AGL_MAXIMUM_POLICY = 52 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:90
+AGL_OFFSCREEN = 53 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:91
+AGL_FULLSCREEN = 54 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:92
+AGL_SAMPLE_BUFFERS_ARB = 55 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:93
+AGL_SAMPLES_ARB = 56 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:94
+AGL_AUX_DEPTH_STENCIL = 57 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:95
+AGL_COLOR_FLOAT = 58 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:96
+AGL_MULTISAMPLE = 59 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:97
+AGL_SUPERSAMPLE = 60 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:98
+AGL_SAMPLE_ALPHA = 61 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:99
+AGL_RENDERER_ID = 70 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:104
+AGL_SINGLE_RENDERER = 71 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:105
+AGL_NO_RECOVERY = 72 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:106
+AGL_ACCELERATED = 73 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:107
+AGL_CLOSEST_POLICY = 74 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:108
+AGL_ROBUST = 75 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:109
+AGL_BACKING_STORE = 76 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:110
+AGL_MP_SAFE = 78 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:111
+AGL_WINDOW = 80 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:113
+AGL_MULTISCREEN = 81 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:114
+AGL_VIRTUAL_SCREEN = 82 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:115
+AGL_COMPLIANT = 83 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:116
+AGL_PBUFFER = 90 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:118
+AGL_BUFFER_MODES = 100 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:135
+AGL_MIN_LEVEL = 101 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:136
+AGL_MAX_LEVEL = 102 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:137
+AGL_COLOR_MODES = 103 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:138
+AGL_ACCUM_MODES = 104 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:139
+AGL_DEPTH_MODES = 105 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:140
+AGL_STENCIL_MODES = 106 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:141
+AGL_MAX_AUX_BUFFERS = 107 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:142
+AGL_VIDEO_MEMORY = 120 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:143
+AGL_TEXTURE_MEMORY = 121 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:144
+AGL_RENDERER_COUNT = 128 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:145
+AGL_SWAP_RECT = 200 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:150
+AGL_BUFFER_RECT = 202 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:151
+AGL_SWAP_LIMIT = 203 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:152
+AGL_COLORMAP_TRACKING = 210 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:153
+AGL_COLORMAP_ENTRY = 212 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:154
+AGL_RASTERIZATION = 220 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:155
+AGL_SWAP_INTERVAL = 222 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:156
+AGL_STATE_VALIDATION = 230 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:157
+AGL_BUFFER_NAME = 231 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:158
+AGL_ORDER_CONTEXT_TO_FRONT = 232 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:159
+AGL_CONTEXT_SURFACE_ID = 233 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:160
+AGL_CONTEXT_DISPLAY_ID = 234 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:161
+AGL_SURFACE_ORDER = 235 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:162
+AGL_SURFACE_OPACITY = 236 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:163
+AGL_CLIP_REGION = 254 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:164
+AGL_FS_CAPTURE_SINGLE = 255 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:165
+AGL_SURFACE_BACKING_SIZE = 304 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:166
+AGL_ENABLE_SURFACE_BACKING_SIZE = 305 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:167
+AGL_SURFACE_VOLATILE = 306 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:168
+AGL_FORMAT_CACHE_SIZE = 501 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:172
+AGL_CLEAR_FORMAT_CACHE = 502 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:173
+AGL_RETAIN_RENDERERS = 503 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:174
+AGL_MONOSCOPIC_BIT = 1 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:177
+AGL_STEREOSCOPIC_BIT = 2 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:178
+AGL_SINGLEBUFFER_BIT = 4 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:179
+AGL_DOUBLEBUFFER_BIT = 8 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:180
+AGL_0_BIT = 1 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:183
+AGL_1_BIT = 2 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:184
+AGL_2_BIT = 4 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:185
+AGL_3_BIT = 8 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:186
+AGL_4_BIT = 16 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:187
+AGL_5_BIT = 32 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:188
+AGL_6_BIT = 64 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:189
+AGL_8_BIT = 128 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:190
+AGL_10_BIT = 256 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:191
+AGL_12_BIT = 512 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:192
+AGL_16_BIT = 1024 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:193
+AGL_24_BIT = 2048 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:194
+AGL_32_BIT = 4096 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:195
+AGL_48_BIT = 8192 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:196
+AGL_64_BIT = 16384 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:197
+AGL_96_BIT = 32768 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:198
+AGL_128_BIT = 65536 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:199
+AGL_RGB8_BIT = 1 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:202
+AGL_RGB8_A8_BIT = 2 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:203
+AGL_BGR233_BIT = 4 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:204
+AGL_BGR233_A8_BIT = 8 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:205
+AGL_RGB332_BIT = 16 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:206
+AGL_RGB332_A8_BIT = 32 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:207
+AGL_RGB444_BIT = 64 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:208
+AGL_ARGB4444_BIT = 128 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:209
+AGL_RGB444_A8_BIT = 256 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:210
+AGL_RGB555_BIT = 512 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:211
+AGL_ARGB1555_BIT = 1024 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:212
+AGL_RGB555_A8_BIT = 2048 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:213
+AGL_RGB565_BIT = 4096 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:214
+AGL_RGB565_A8_BIT = 8192 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:215
+AGL_RGB888_BIT = 16384 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:216
+AGL_ARGB8888_BIT = 32768 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:217
+AGL_RGB888_A8_BIT = 65536 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:218
+AGL_RGB101010_BIT = 131072 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:219
+AGL_ARGB2101010_BIT = 262144 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:220
+AGL_RGB101010_A8_BIT = 524288 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:221
+AGL_RGB121212_BIT = 1048576 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:222
+AGL_ARGB12121212_BIT = 2097152 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:223
+AGL_RGB161616_BIT = 4194304 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:224
+AGL_ARGB16161616_BIT = 8388608 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:225
+AGL_INDEX8_BIT = 536870912 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:226
+AGL_INDEX16_BIT = 1073741824 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:227
+AGL_RGBFLOAT64_BIT = 16777216 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:228
+AGL_RGBAFLOAT64_BIT = 33554432 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:229
+AGL_RGBFLOAT128_BIT = 67108864 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:230
+AGL_RGBAFLOAT128_BIT = 134217728 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:231
+AGL_RGBFLOAT256_BIT = 268435456 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:232
+AGL_RGBAFLOAT256_BIT = 536870912 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:233
+AGL_NO_ERROR = 0 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:238
+AGL_BAD_ATTRIBUTE = 10000 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:240
+AGL_BAD_PROPERTY = 10001 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:241
+AGL_BAD_PIXELFMT = 10002 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:242
+AGL_BAD_RENDINFO = 10003 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:243
+AGL_BAD_CONTEXT = 10004 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:244
+AGL_BAD_DRAWABLE = 10005 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:245
+AGL_BAD_GDEV = 10006 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:246
+AGL_BAD_STATE = 10007 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:247
+AGL_BAD_VALUE = 10008 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:248
+AGL_BAD_MATCH = 10009 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:249
+AGL_BAD_ENUM = 10010 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:250
+AGL_BAD_OFFSCREEN = 10011 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:251
+AGL_BAD_FULLSCREEN = 10012 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:252
+AGL_BAD_WINDOW = 10013 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:253
+AGL_BAD_POINTER = 10014 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:254
+AGL_BAD_MODULE = 10015 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:255
+AGL_BAD_ALLOC = 10016 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:256
+AGL_BAD_CONNECTION = 10017 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:257
+GLint = c_long # /System/Library/Frameworks/OpenGL.framework/Headers/gl.h:47
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:264
+aglChoosePixelFormat = _link_function('aglChoosePixelFormat', AGLPixelFormat, [POINTER(AGLDevice), GLint, POINTER(GLint)], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:265
+aglDestroyPixelFormat = _link_function('aglDestroyPixelFormat', None, [AGLPixelFormat], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:266
+aglNextPixelFormat = _link_function('aglNextPixelFormat', AGLPixelFormat, [AGLPixelFormat], None)
+
+GLboolean = c_ubyte # /System/Library/Frameworks/OpenGL.framework/Headers/gl.h:43
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:267
+aglDescribePixelFormat = _link_function('aglDescribePixelFormat', GLboolean, [AGLPixelFormat, GLint, POINTER(GLint)], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:268
+aglDevicesOfPixelFormat = _link_function('aglDevicesOfPixelFormat', POINTER(AGLDevice), [AGLPixelFormat, POINTER(GLint)], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:273
+aglQueryRendererInfo = _link_function('aglQueryRendererInfo', AGLRendererInfo, [POINTER(AGLDevice), GLint], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:274
+aglDestroyRendererInfo = _link_function('aglDestroyRendererInfo', None, [AGLRendererInfo], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:275
+aglNextRendererInfo = _link_function('aglNextRendererInfo', AGLRendererInfo, [AGLRendererInfo], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:276
+aglDescribeRenderer = _link_function('aglDescribeRenderer', GLboolean, [AGLRendererInfo, GLint, POINTER(GLint)], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:281
+aglCreateContext = _link_function('aglCreateContext', AGLContext, [AGLPixelFormat, AGLContext], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:282
+aglDestroyContext = _link_function('aglDestroyContext', GLboolean, [AGLContext], None)
+
+GLuint = c_ulong # /System/Library/Frameworks/OpenGL.framework/Headers/gl.h:51
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:283
+aglCopyContext = _link_function('aglCopyContext', GLboolean, [AGLContext, AGLContext, GLuint], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:284
+aglUpdateContext = _link_function('aglUpdateContext', GLboolean, [AGLContext], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:289
+aglSetCurrentContext = _link_function('aglSetCurrentContext', GLboolean, [AGLContext], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:290
+aglGetCurrentContext = _link_function('aglGetCurrentContext', AGLContext, [], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:295
+aglSetDrawable = _link_function('aglSetDrawable', GLboolean, [AGLContext, AGLDrawable], None)
+
+GLsizei = c_long # /System/Library/Frameworks/OpenGL.framework/Headers/gl.h:48
+GLvoid = None # /System/Library/Frameworks/OpenGL.framework/Headers/gl.h:56
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:296
+aglSetOffScreen = _link_function('aglSetOffScreen', GLboolean, [AGLContext, GLsizei, GLsizei, GLsizei, POINTER(GLvoid)], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:297
+aglSetFullScreen = _link_function('aglSetFullScreen', GLboolean, [AGLContext, GLsizei, GLsizei, GLsizei, GLint], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:298
+aglGetDrawable = _link_function('aglGetDrawable', AGLDrawable, [AGLContext], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:303
+aglSetVirtualScreen = _link_function('aglSetVirtualScreen', GLboolean, [AGLContext, GLint], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:304
+aglGetVirtualScreen = _link_function('aglGetVirtualScreen', GLint, [AGLContext], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:309
+aglGetVersion = _link_function('aglGetVersion', None, [POINTER(GLint), POINTER(GLint)], None)
+
+GLenum = c_ulong # /System/Library/Frameworks/OpenGL.framework/Headers/gl.h:42
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:314
+aglConfigure = _link_function('aglConfigure', GLboolean, [GLenum, GLuint], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:319
+aglSwapBuffers = _link_function('aglSwapBuffers', None, [AGLContext], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:324
+aglEnable = _link_function('aglEnable', GLboolean, [AGLContext, GLenum], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:325
+aglDisable = _link_function('aglDisable', GLboolean, [AGLContext, GLenum], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:326
+aglIsEnabled = _link_function('aglIsEnabled', GLboolean, [AGLContext, GLenum], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:327
+aglSetInteger = _link_function('aglSetInteger', GLboolean, [AGLContext, GLenum, POINTER(GLint)], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:328
+aglGetInteger = _link_function('aglGetInteger', GLboolean, [AGLContext, GLenum, POINTER(GLint)], None)
+
+Style = c_ubyte # /System/Library/Frameworks/CoreServices.framework/Headers/../Frameworks/CarbonCore.framework/Headers/MacTypes.h:524
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:333
+aglUseFont = _link_function('aglUseFont', GLboolean, [AGLContext, GLint, Style, GLint, GLint, GLint, GLint], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:338
+aglGetError = _link_function('aglGetError', GLenum, [], None)
+
+GLubyte = c_ubyte # /System/Library/Frameworks/OpenGL.framework/Headers/gl.h:49
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:339
+aglErrorString = _link_function('aglErrorString', POINTER(GLubyte), [GLenum], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:344
+aglResetLibrary = _link_function('aglResetLibrary', None, [], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:349
+aglSurfaceTexture = _link_function('aglSurfaceTexture', None, [AGLContext, GLenum, GLenum, AGLContext], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:354
+aglCreatePBuffer = _link_function('aglCreatePBuffer', GLboolean, [GLint, GLint, GLenum, GLenum, c_long, POINTER(AGLPbuffer)], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:355
+aglDestroyPBuffer = _link_function('aglDestroyPBuffer', GLboolean, [AGLPbuffer], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:356
+aglDescribePBuffer = _link_function('aglDescribePBuffer', GLboolean, [AGLPbuffer, POINTER(GLint), POINTER(GLint), POINTER(GLenum), POINTER(GLenum), POINTER(GLint)], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:357
+aglTexImagePBuffer = _link_function('aglTexImagePBuffer', GLboolean, [AGLContext, AGLPbuffer, GLint], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:362
+aglSetPBuffer = _link_function('aglSetPBuffer', GLboolean, [AGLContext, AGLPbuffer, GLint, GLint, GLint], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:363
+aglGetPBuffer = _link_function('aglGetPBuffer', GLboolean, [AGLContext, POINTER(AGLPbuffer), POINTER(GLint), POINTER(GLint), POINTER(GLint)], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:368
+aglGetCGLContext = _link_function('aglGetCGLContext', GLboolean, [AGLContext, POINTER(POINTER(None))], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:369
+aglGetCGLPixelFormat = _link_function('aglGetCGLPixelFormat', GLboolean, [AGLPixelFormat, POINTER(POINTER(None))], None)
+
+__all__ = ['AGL_VERSION_2_0', 'AGLDevice', 'AGLDrawable', 'AGLRendererInfo',
+'AGLPixelFormat', 'AGLContext', 'AGLPbuffer', 'AGL_NONE', 'AGL_ALL_RENDERERS',
+'AGL_BUFFER_SIZE', 'AGL_LEVEL', 'AGL_RGBA', 'AGL_DOUBLEBUFFER', 'AGL_STEREO',
+'AGL_AUX_BUFFERS', 'AGL_RED_SIZE', 'AGL_GREEN_SIZE', 'AGL_BLUE_SIZE',
+'AGL_ALPHA_SIZE', 'AGL_DEPTH_SIZE', 'AGL_STENCIL_SIZE', 'AGL_ACCUM_RED_SIZE',
+'AGL_ACCUM_GREEN_SIZE', 'AGL_ACCUM_BLUE_SIZE', 'AGL_ACCUM_ALPHA_SIZE',
+'AGL_PIXEL_SIZE', 'AGL_MINIMUM_POLICY', 'AGL_MAXIMUM_POLICY', 'AGL_OFFSCREEN',
+'AGL_FULLSCREEN', 'AGL_SAMPLE_BUFFERS_ARB', 'AGL_SAMPLES_ARB',
+'AGL_AUX_DEPTH_STENCIL', 'AGL_COLOR_FLOAT', 'AGL_MULTISAMPLE',
+'AGL_SUPERSAMPLE', 'AGL_SAMPLE_ALPHA', 'AGL_RENDERER_ID',
+'AGL_SINGLE_RENDERER', 'AGL_NO_RECOVERY', 'AGL_ACCELERATED',
+'AGL_CLOSEST_POLICY', 'AGL_ROBUST', 'AGL_BACKING_STORE', 'AGL_MP_SAFE',
+'AGL_WINDOW', 'AGL_MULTISCREEN', 'AGL_VIRTUAL_SCREEN', 'AGL_COMPLIANT',
+'AGL_PBUFFER', 'AGL_BUFFER_MODES', 'AGL_MIN_LEVEL', 'AGL_MAX_LEVEL',
+'AGL_COLOR_MODES', 'AGL_ACCUM_MODES', 'AGL_DEPTH_MODES', 'AGL_STENCIL_MODES',
+'AGL_MAX_AUX_BUFFERS', 'AGL_VIDEO_MEMORY', 'AGL_TEXTURE_MEMORY',
+'AGL_RENDERER_COUNT', 'AGL_SWAP_RECT', 'AGL_BUFFER_RECT', 'AGL_SWAP_LIMIT',
+'AGL_COLORMAP_TRACKING', 'AGL_COLORMAP_ENTRY', 'AGL_RASTERIZATION',
+'AGL_SWAP_INTERVAL', 'AGL_STATE_VALIDATION', 'AGL_BUFFER_NAME',
+'AGL_ORDER_CONTEXT_TO_FRONT', 'AGL_CONTEXT_SURFACE_ID',
+'AGL_CONTEXT_DISPLAY_ID', 'AGL_SURFACE_ORDER', 'AGL_SURFACE_OPACITY',
+'AGL_CLIP_REGION', 'AGL_FS_CAPTURE_SINGLE', 'AGL_SURFACE_BACKING_SIZE',
+'AGL_ENABLE_SURFACE_BACKING_SIZE', 'AGL_SURFACE_VOLATILE',
+'AGL_FORMAT_CACHE_SIZE', 'AGL_CLEAR_FORMAT_CACHE', 'AGL_RETAIN_RENDERERS',
+'AGL_MONOSCOPIC_BIT', 'AGL_STEREOSCOPIC_BIT', 'AGL_SINGLEBUFFER_BIT',
+'AGL_DOUBLEBUFFER_BIT', 'AGL_0_BIT', 'AGL_1_BIT', 'AGL_2_BIT', 'AGL_3_BIT',
+'AGL_4_BIT', 'AGL_5_BIT', 'AGL_6_BIT', 'AGL_8_BIT', 'AGL_10_BIT',
+'AGL_12_BIT', 'AGL_16_BIT', 'AGL_24_BIT', 'AGL_32_BIT', 'AGL_48_BIT',
+'AGL_64_BIT', 'AGL_96_BIT', 'AGL_128_BIT', 'AGL_RGB8_BIT', 'AGL_RGB8_A8_BIT',
+'AGL_BGR233_BIT', 'AGL_BGR233_A8_BIT', 'AGL_RGB332_BIT', 'AGL_RGB332_A8_BIT',
+'AGL_RGB444_BIT', 'AGL_ARGB4444_BIT', 'AGL_RGB444_A8_BIT', 'AGL_RGB555_BIT',
+'AGL_ARGB1555_BIT', 'AGL_RGB555_A8_BIT', 'AGL_RGB565_BIT',
+'AGL_RGB565_A8_BIT', 'AGL_RGB888_BIT', 'AGL_ARGB8888_BIT',
+'AGL_RGB888_A8_BIT', 'AGL_RGB101010_BIT', 'AGL_ARGB2101010_BIT',
+'AGL_RGB101010_A8_BIT', 'AGL_RGB121212_BIT', 'AGL_ARGB12121212_BIT',
+'AGL_RGB161616_BIT', 'AGL_ARGB16161616_BIT', 'AGL_INDEX8_BIT',
+'AGL_INDEX16_BIT', 'AGL_RGBFLOAT64_BIT', 'AGL_RGBAFLOAT64_BIT',
+'AGL_RGBFLOAT128_BIT', 'AGL_RGBAFLOAT128_BIT', 'AGL_RGBFLOAT256_BIT',
+'AGL_RGBAFLOAT256_BIT', 'AGL_NO_ERROR', 'AGL_BAD_ATTRIBUTE',
+'AGL_BAD_PROPERTY', 'AGL_BAD_PIXELFMT', 'AGL_BAD_RENDINFO', 'AGL_BAD_CONTEXT',
+'AGL_BAD_DRAWABLE', 'AGL_BAD_GDEV', 'AGL_BAD_STATE', 'AGL_BAD_VALUE',
+'AGL_BAD_MATCH', 'AGL_BAD_ENUM', 'AGL_BAD_OFFSCREEN', 'AGL_BAD_FULLSCREEN',
+'AGL_BAD_WINDOW', 'AGL_BAD_POINTER', 'AGL_BAD_MODULE', 'AGL_BAD_ALLOC',
+'AGL_BAD_CONNECTION', 'aglChoosePixelFormat', 'aglDestroyPixelFormat',
+'aglNextPixelFormat', 'aglDescribePixelFormat', 'aglDevicesOfPixelFormat',
+'aglQueryRendererInfo', 'aglDestroyRendererInfo', 'aglNextRendererInfo',
+'aglDescribeRenderer', 'aglCreateContext', 'aglDestroyContext',
+'aglCopyContext', 'aglUpdateContext', 'aglSetCurrentContext',
+'aglGetCurrentContext', 'aglSetDrawable', 'aglSetOffScreen',
+'aglSetFullScreen', 'aglGetDrawable', 'aglSetVirtualScreen',
+'aglGetVirtualScreen', 'aglGetVersion', 'aglConfigure', 'aglSwapBuffers',
+'aglEnable', 'aglDisable', 'aglIsEnabled', 'aglSetInteger', 'aglGetInteger',
+'aglUseFont', 'aglGetError', 'aglErrorString', 'aglResetLibrary',
+'aglSurfaceTexture', 'aglCreatePBuffer', 'aglDestroyPBuffer',
+'aglDescribePBuffer', 'aglTexImagePBuffer', 'aglSetPBuffer', 'aglGetPBuffer',
+'aglGetCGLContext', 'aglGetCGLPixelFormat']
+# END GENERATED CONTENT (do not edit above this line)
+
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/base.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/base.py
new file mode 100644
index 0000000..a65e7d2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/base.py
@@ -0,0 +1,388 @@
+from builtins import object
+#!/usr/bin/python
+# $Id:$
+
+from pyglet import gl, compat_platform
+from pyglet.gl import gl_info
+from pyglet.gl import glu_info
+
+class Config(object):
+ '''Graphics configuration.
+
+ A Config stores the preferences for OpenGL attributes such as the
+ number of auxilliary buffers, size of the colour and depth buffers,
+ double buffering, stencilling, multi- and super-sampling, and so on.
+
+ Different platforms support a different set of attributes, so these
+ are set with a string key and a value which is integer or boolean.
+
+ :Ivariables:
+ `double_buffer` : bool
+ Specify the presence of a back-buffer for every color buffer.
+ `stereo` : bool
+ Specify the presence of separate left and right buffer sets.
+ `buffer_size` : int
+ Total bits per sample per color buffer.
+ `aux_buffers` : int
+ The number of auxilliary color buffers.
+ `sample_buffers` : int
+ The number of multisample buffers.
+ `samples` : int
+ The number of samples per pixel, or 0 if there are no multisample
+ buffers.
+ `red_size` : int
+ Bits per sample per buffer devoted to the red component.
+ `green_size` : int
+ Bits per sample per buffer devoted to the green component.
+ `blue_size` : int
+ Bits per sample per buffer devoted to the blue component.
+ `alpha_size` : int
+ Bits per sample per buffer devoted to the alpha component.
+ `depth_size` : int
+ Bits per sample in the depth buffer.
+ `stencil_size` : int
+ Bits per sample in the stencil buffer.
+ `accum_red_size` : int
+ Bits per pixel devoted to the red component in the accumulation
+ buffer.
+ `accum_green_size` : int
+ Bits per pixel devoted to the green component in the accumulation
+ buffer.
+ `accum_blue_size` : int
+ Bits per pixel devoted to the blue component in the accumulation
+ buffer.
+ `accum_alpha_size` : int
+ Bits per pixel devoted to the alpha component in the accumulation
+ buffer.
+ '''
+
+ _attribute_names = [
+ 'double_buffer',
+ 'stereo',
+ 'buffer_size',
+ 'aux_buffers',
+ 'sample_buffers',
+ 'samples',
+ 'red_size',
+ 'green_size',
+ 'blue_size',
+ 'alpha_size',
+ 'depth_size',
+ 'stencil_size',
+ 'accum_red_size',
+ 'accum_green_size',
+ 'accum_blue_size',
+ 'accum_alpha_size',
+ 'major_version',
+ 'minor_version',
+ 'forward_compatible',
+ 'debug'
+ ]
+
+ major_version = None
+ minor_version = None
+ forward_compatible = None
+ debug = None
+
+ def __init__(self, **kwargs):
+ '''Create a template config with the given attributes.
+
+ Specify attributes as keyword arguments, for example::
+
+ template = Config(double_buffer=True)
+
+ '''
+ for name in self._attribute_names:
+ if name in kwargs:
+ setattr(self, name, kwargs[name])
+ else:
+ setattr(self, name, None)
+
+ def _requires_gl_3(self):
+ if self.major_version is not None and self.major_version >= 3:
+ return True
+ if self.forward_compatible or self.debug:
+ return True
+ return False
+
+ def get_gl_attributes(self):
+ '''Return a list of attributes set on this config.
+
+ :rtype: list of tuple ``(name, value)``
+ :return: All attributes, with unset attributes having a value of
+ ``None``.
+ '''
+ return [(name, getattr(self, name)) for name in self._attribute_names]
+
+ def match(self, canvas):
+ '''Return a list of matching complete configs for the given canvas.
+
+ .. versionadded:: 1.2
+
+ :Parameters:
+ `canvas` : `Canvas`
+ Display to host contexts created from the config.
+
+ :rtype: list of `CanvasConfig`
+ '''
+ raise NotImplementedError('abstract')
+
+ def create_context(self, share):
+ '''Create a GL context that satisifies this configuration.
+
+ :deprecated: Use `CanvasConfig.create_context`.
+
+ :Parameters:
+ `share` : `Context`
+ If not None, a context with which to share objects with.
+
+ :rtype: `Context`
+ :return: The new context.
+ '''
+ raise gl.ConfigException(
+ 'This config cannot be used to create contexts. '
+ 'Use Config.match to created a CanvasConfig')
+
+ def is_complete(self):
+ '''Determine if this config is complete and able to create a context.
+
+ Configs created directly are not complete, they can only serve
+ as templates for retrieving a supported config from the system.
+ For example, `pyglet.window.Screen.get_matching_configs` returns
+ complete configs.
+
+ :deprecated: Use ``isinstance(config, CanvasConfig)``.
+
+ :rtype: bool
+ :return: True if the config is complete and can create a context.
+ '''
+ return isinstance(self, CanvasConfig)
+
+ def __repr__(self):
+ import pprint
+ return '%s(%s)' % (self.__class__.__name__,
+ pprint.pformat(self.get_gl_attributes()))
+
+class CanvasConfig(Config):
+ '''OpenGL configuration for a particular canvas.
+
+ Use `Config.match` to obtain an instance of this class.
+
+ .. versionadded:: 1.2
+
+ :Ivariables:
+ `canvas` : `Canvas`
+ The canvas this config is valid on.
+
+ '''
+ def __init__(self, canvas, base_config):
+ self.canvas = canvas
+
+ self.major_version = base_config.major_version
+ self.minor_version = base_config.minor_version
+ self.forward_compatible = base_config.forward_compatible
+ self.debug = base_config.debug
+
+ def compatible(self, canvas):
+ raise NotImplementedError('abstract')
+
+ def create_context(self, share):
+ '''Create a GL context that satisifies this configuration.
+
+ :Parameters:
+ `share` : `Context`
+ If not None, a context with which to share objects with.
+
+ :rtype: `Context`
+ :return: The new context.
+ '''
+ raise NotImplementedError('abstract')
+
+ def is_complete(self):
+ return True
+
+
+class ObjectSpace(object):
+ def __init__(self):
+ # Textures and buffers scheduled for deletion the next time this
+ # object space is active.
+ self._doomed_textures = []
+ self._doomed_buffers = []
+
+class Context(object):
+ '''OpenGL context for drawing.
+
+ Use `CanvasConfig.create_context` to create a context.
+
+ :Ivariables:
+ `object_space` : `ObjectSpace`
+ An object which is shared between all contexts that share
+ GL objects.
+
+ '''
+
+ #: Context share behaviour indicating that objects should not be
+ #: shared with existing contexts.
+ CONTEXT_SHARE_NONE = None
+
+ #: Context share behaviour indicating that objects are shared with
+ #: the most recently created context (the default).
+ CONTEXT_SHARE_EXISTING = 1
+
+ # Used for error checking, True if currently within a glBegin/End block.
+ # Ignored if error checking is disabled.
+ _gl_begin = False
+
+ # gl_info.GLInfo instance, filled in on first set_current
+ _info = None
+
+ # List of (attr, check) for each driver/device-specific workaround that is
+ # implemented. The `attr` attribute on this context is set to the result
+ # of evaluating `check(gl_info)` the first time this context is used.
+ _workaround_checks = [
+ # GDI Generic renderer on Windows does not implement
+ # GL_UNPACK_ROW_LENGTH correctly.
+ ('_workaround_unpack_row_length',
+ lambda info: info.get_renderer() == 'GDI Generic'),
+
+ # Reportedly segfaults in text_input.py example with
+ # "ATI Radeon X1600 OpenGL Engine"
+ # glGenBuffers not exported by
+ # "ATI Radeon X1270 x86/MMX/3DNow!/SSE2"
+ # "RADEON XPRESS 200M Series x86/MMX/3DNow!/SSE2"
+ # glGenBuffers not exported by
+ # "Intel 965/963 Graphics Media Accelerator"
+ ('_workaround_vbo',
+ lambda info: (info.get_renderer().startswith('ATI Radeon X')
+ or info.get_renderer().startswith('RADEON XPRESS 200M')
+ or info.get_renderer() ==
+ 'Intel 965/963 Graphics Media Accelerator')),
+
+ # Some ATI cards on OS X start drawing from a VBO before it's written
+ # to. In these cases pyglet needs to call glFinish() to flush the
+ # pipeline after updating a buffer but before rendering.
+ ('_workaround_vbo_finish',
+ lambda info: ('ATI' in info.get_renderer() and
+ info.have_version(1, 5) and
+ compat_platform == 'darwin')),
+ ]
+
+ def __init__(self, config, context_share=None):
+ self.config = config
+ self.context_share = context_share
+ self.canvas = None
+
+ if context_share:
+ self.object_space = context_share.object_space
+ else:
+ self.object_space = ObjectSpace()
+
+ def __repr__(self):
+ return '%s()' % self.__class__.__name__
+
+ def attach(self, canvas):
+ if self.canvas is not None:
+ self.detach()
+ if not self.config.compatible(canvas):
+ raise RuntimeError('Cannot attach %r to %r' % (canvas, self))
+ self.canvas = canvas
+
+ def detach(self):
+ self.canvas = None
+
+ def set_current(self):
+ if not self.canvas:
+ raise RuntimeError('Canvas has not been attached')
+
+ # XXX not per-thread
+ gl.current_context = self
+
+ # XXX
+ gl_info.set_active_context()
+ glu_info.set_active_context()
+
+ # Implement workarounds
+ if not self._info:
+ self._info = gl_info.GLInfo()
+ self._info.set_active_context()
+ for attr, check in self._workaround_checks:
+ setattr(self, attr, check(self._info))
+
+ # Release textures and buffers on this context scheduled for deletion.
+ # Note that the garbage collector may introduce a race condition,
+ # so operate on a copy of the textures/buffers and remove the deleted
+ # items using list slicing (which is an atomic operation)
+ if self.object_space._doomed_textures:
+ textures = self.object_space._doomed_textures[:]
+ textures = (gl.GLuint * len(textures))(*textures)
+ gl.glDeleteTextures(len(textures), textures)
+ self.object_space._doomed_textures[0:len(textures)] = []
+ if self.object_space._doomed_buffers:
+ buffers = self.object_space._doomed_buffers[:]
+ buffers = (gl.GLuint * len(buffers))(*buffers)
+ gl.glDeleteBuffers(len(buffers), buffers)
+ self.object_space._doomed_buffers[0:len(buffers)] = []
+
+ def destroy(self):
+ '''Release the context.
+
+ The context will not be useable after being destroyed. Each platform
+ has its own convention for releasing the context and the buffer(s)
+ that depend on it in the correct order; this should never be called
+ by an application.
+ '''
+ self.detach()
+
+ if gl.current_context is self:
+ gl.current_context = None
+ gl_info.remove_active_context()
+
+ # Switch back to shadow context.
+ if gl._shadow_window is not None:
+ gl._shadow_window.switch_to()
+
+ def delete_texture(self, texture_id):
+ '''Safely delete a texture belonging to this context.
+
+ Usually, the texture is released immediately using
+ ``glDeleteTextures``, however if another context that does not share
+ this context's object space is currently active, the deletion will
+ be deferred until an appropriate context is activated.
+
+ :Parameters:
+ `texture_id` : int
+ The OpenGL name of the texture to delete.
+
+ '''
+ if self.object_space is gl.current_context.object_space:
+ id = gl.GLuint(texture_id)
+ gl.glDeleteTextures(1, id)
+ else:
+ self.object_space._doomed_textures.append(texture_id)
+
+ def delete_buffer(self, buffer_id):
+ '''Safely delete a buffer object belonging to this context.
+
+ This method behaves similarly to :py:func:`~pyglet.text.document.AbstractDocument.delete_texture`, though for
+ ``glDeleteBuffers`` instead of ``glDeleteTextures``.
+
+ :Parameters:
+ `buffer_id` : int
+ The OpenGL name of the buffer to delete.
+
+ .. versionadded:: 1.1
+ '''
+ if self.object_space is gl.current_context.object_space and False:
+ id = gl.GLuint(buffer_id)
+ gl.glDeleteBuffers(1, id)
+ else:
+ self.object_space._doomed_buffers.append(buffer_id)
+
+ def get_info(self):
+ '''Get the OpenGL information for this context.
+
+ .. versionadded:: 1.2
+
+ :rtype: `GLInfo`
+ '''
+ return self._info
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/carbon.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/carbon.py
new file mode 100644
index 0000000..16ef1cf
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/carbon.py
@@ -0,0 +1,203 @@
+#!/usr/bin/env python
+
+'''
+'''
+from __future__ import absolute_import
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+from .base import Config, CanvasConfig, Context
+
+from pyglet.libs.darwin import *
+from pyglet.libs.darwin import _oscheck
+from pyglet.gl import ContextException
+from pyglet.gl import gl
+from pyglet.gl import agl
+
+from pyglet.canvas.carbon import CarbonCanvas, CarbonFullScreenCanvas
+
+def _aglcheck():
+ err = agl.aglGetError()
+ if err != agl.AGL_NO_ERROR:
+ raise RuntimeError(cast(agl.aglErrorString(err), c_char_p).value)
+
+class CarbonConfig(Config):
+ def match(self, canvas):
+ # Construct array of attributes for aglChoosePixelFormat
+ attrs = []
+ for name, value in self.get_gl_attributes():
+ attr = CarbonCanvasConfig._attribute_ids.get(name, None)
+ if not attr or not value:
+ continue
+ attrs.append(attr)
+ if attr not in CarbonCanvasConfig._boolean_attributes:
+ attrs.append(int(value))
+
+ # Support for RAGE-II, which is not compliant
+ attrs.append(agl.AGL_ALL_RENDERERS)
+
+ # Force selection policy and RGBA
+ attrs.append(agl.AGL_MAXIMUM_POLICY)
+ attrs.append(agl.AGL_RGBA)
+
+ # In 10.3 and later, AGL_FULLSCREEN is specified so the window can
+ # be toggled to/from fullscreen without losing context. pyglet
+ # no longer supports earlier versions of OS X, so we always supply it.
+ attrs.append(agl.AGL_FULLSCREEN)
+
+ # Terminate the list.
+ attrs.append(agl.AGL_NONE)
+ attrib_list = (c_int * len(attrs))(*attrs)
+
+ gdevice = cast(canvas.screen.get_gdevice(), agl.GDHandle)
+ pformat = agl.aglChoosePixelFormat(gdevice, 1, attrib_list)
+ _aglcheck()
+
+ if not pformat:
+ return []
+ else:
+ return [CarbonCanvasConfig(canvas, self, pformat, self)]
+
+class CarbonCanvasConfig(CanvasConfig):
+ # Valid names for GL attributes, and their corresponding AGL constant.
+ _attribute_ids = {
+ 'double_buffer': agl.AGL_DOUBLEBUFFER,
+ 'stereo': agl.AGL_STEREO,
+ 'buffer_size': agl.AGL_BUFFER_SIZE,
+ 'sample_buffers': agl.AGL_SAMPLE_BUFFERS_ARB,
+ 'samples': agl.AGL_SAMPLES_ARB,
+ 'aux_buffers': agl.AGL_AUX_BUFFERS,
+ 'red_size': agl.AGL_RED_SIZE,
+ 'green_size': agl.AGL_GREEN_SIZE,
+ 'blue_size': agl.AGL_BLUE_SIZE,
+ 'alpha_size': agl.AGL_ALPHA_SIZE,
+ 'depth_size': agl.AGL_DEPTH_SIZE,
+ 'stencil_size': agl.AGL_STENCIL_SIZE,
+ 'accum_red_size': agl.AGL_ACCUM_RED_SIZE,
+ 'accum_green_size': agl.AGL_ACCUM_GREEN_SIZE,
+ 'accum_blue_size': agl.AGL_ACCUM_BLUE_SIZE,
+ 'accum_alpha_size': agl.AGL_ACCUM_ALPHA_SIZE,
+
+ # Not exposed by pyglet API (set internally)
+ 'all_renderers': agl.AGL_ALL_RENDERERS,
+ 'rgba': agl.AGL_RGBA,
+ 'fullscreen': agl.AGL_FULLSCREEN,
+ 'minimum_policy': agl.AGL_MINIMUM_POLICY,
+ 'maximum_policy': agl.AGL_MAXIMUM_POLICY,
+
+ # Not supported in current pyglet API
+ 'level': agl.AGL_LEVEL,
+ 'pixel_size': agl.AGL_PIXEL_SIZE, # == buffer_size
+ 'aux_depth_stencil': agl.AGL_AUX_DEPTH_STENCIL,
+ 'color_float': agl.AGL_COLOR_FLOAT,
+ 'offscreen': agl.AGL_OFFSCREEN,
+ 'sample_alpha': agl.AGL_SAMPLE_ALPHA,
+ 'multisample': agl.AGL_MULTISAMPLE,
+ 'supersample': agl.AGL_SUPERSAMPLE,
+ }
+
+ # AGL constants which do not require a value.
+ _boolean_attributes = \
+ (agl.AGL_ALL_RENDERERS,
+ agl.AGL_RGBA,
+ agl.AGL_DOUBLEBUFFER,
+ agl.AGL_STEREO,
+ agl.AGL_MINIMUM_POLICY,
+ agl.AGL_MAXIMUM_POLICY,
+ agl.AGL_OFFSCREEN,
+ agl.AGL_FULLSCREEN,
+ agl.AGL_AUX_DEPTH_STENCIL,
+ agl.AGL_COLOR_FLOAT,
+ agl.AGL_MULTISAMPLE,
+ agl.AGL_SUPERSAMPLE,
+ agl.AGL_SAMPLE_ALPHA)
+
+ def __init__(self, canvas, screen, pformat, config):
+ super(CarbonCanvasConfig, self).__init__(canvas, config)
+ self.screen = screen
+ self._pformat = pformat
+ self._attributes = {}
+
+ for name, attr in self._attribute_ids.items():
+ value = c_int()
+ result = agl.aglDescribePixelFormat(pformat, attr, byref(value))
+ if result:
+ setattr(self, name, value.value)
+
+ def create_context(self, share):
+ if share:
+ context = agl.aglCreateContext(self._pformat, share._context)
+ else:
+ context = agl.aglCreateContext(self._pformat, None)
+ _aglcheck()
+ return CarbonContext(self, context, share, self._pformat)
+
+ def compatible(self, canvas):
+ return isinstance(canvas, CarbonCanvas) or \
+ isinstance(canvas, CarbonFullScreenCanvas)
+
+class CarbonContext(Context):
+ def __init__(self, config, context, share, pixelformat):
+ super(CarbonContext, self).__init__(share)
+ self.config = config
+ self._context = context
+ self._pixelformat = pixelformat
+
+ def attach(self, canvas):
+ if self.config._requires_gl_3():
+ raise ContextException('AGL does not support OpenGL 3')
+
+ super(CarbonContext, self).attach(canvas)
+ if isinstance(canvas, CarbonFullScreenCanvas):
+ # XXX not used any more (cannot use AGL_BUFFER_RECT)
+ agl.aglEnable(self._context, agl.AGL_FS_CAPTURE_SINGLE)
+ agl.aglSetFullScreen(self._context, canvas.width, canvas.height,
+ canvas.screen._refresh_rate, 0)
+ else:
+ agl.aglSetDrawable(self._context,
+ cast(canvas.drawable, agl.AGLDrawable))
+ agl.aglSetCurrentContext(self._context)
+ if canvas.bounds is not None:
+ bounds = (gl.GLint * 4)(*canvas.bounds)
+ agl.aglSetInteger(self._context, agl.AGL_BUFFER_RECT, bounds)
+ agl.aglEnable(self._context, agl.AGL_BUFFER_RECT)
+ else:
+ agl.aglDisable(self._context, agl.AGL_BUFFER_RECT)
+ _aglcheck()
+
+ self.set_current()
+
+ def detach(self):
+ super(CarbonContext, self).detach()
+ agl.aglSetDrawable(self._context, None)
+ _aglcheck()
+
+ def set_current(self):
+ super(CarbonContext, self).set_current()
+ agl.aglSetCurrentContext(self._context)
+ _aglcheck()
+
+ def update_geometry(self):
+ agl.aglUpdateContext(self._context)
+ _aglcheck()
+
+ def destroy(self):
+ super(CarbonContext, self).destroy()
+ agl.aglDestroyContext(self._context)
+
+ def set_vsync(self, vsync=True):
+ swap = c_long(int(vsync))
+ agl.aglSetInteger(self._context, agl.AGL_SWAP_INTERVAL, byref(swap))
+ _aglcheck()
+
+ def get_vsync(self):
+ swap = c_long()
+ agl.aglGetInteger(self._context, agl.AGL_SWAP_INTERVAL, byref(swap))
+ _aglcheck()
+ return bool(swap.value)
+
+ def flip(self):
+ agl.aglSwapBuffers(self._context)
+ _aglcheck()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/cocoa.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/cocoa.py
new file mode 100644
index 0000000..4efe4a1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/cocoa.py
@@ -0,0 +1,299 @@
+#!/usr/bin/env python
+
+'''
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import platform
+
+from pyglet.gl.base import Config, CanvasConfig, Context
+
+from pyglet.gl import ContextException
+from pyglet.gl import gl
+from pyglet.gl import agl
+
+from pyglet.canvas.cocoa import CocoaCanvas
+
+from pyglet.libs.darwin.cocoapy import *
+
+NSOpenGLPixelFormat = ObjCClass('NSOpenGLPixelFormat')
+NSOpenGLContext = ObjCClass('NSOpenGLContext')
+
+# Version info, needed as OpenGL different Lion and onward
+"""Version is based on Darwin kernel, not OS-X version.
+OS-X / Darwin version history
+http://en.wikipedia.org/wiki/Darwin_(operating_system)#Release_history
+pre-release: 0.1, 0.2, 1.0, 1.1,
+kodiak: 1.2.1,
+cheetah: 1.3.1,
+puma: 1.4.1, 5.1 -> 5.5
+jaguar: 6.0.1 -> 6.8
+panther: 7.0 -> 7.9
+tiger: 8.0 -> 8.11
+leopard: 9.0 -> 9.8
+snow_leopard: 10.0 -> 10.8
+lion: 11.0 -> 11.4
+mountain_lion: 12.0 -> 12.5
+mavericks: 13.0 -> 13.4
+yosemite: 14.0 -> 14.5
+el_capitan: 15.0 -> 15.6
+sierra: 16.0 -> 16.6
+"""
+os_x_release = {
+ 'pre-release': (0,1),
+ 'kodiak': (1,2,1),
+ 'cheetah': (1,3,1),
+ 'puma': (1,4.1),
+ 'jaguar': (6,0,1),
+ 'panther': (7,),
+ 'tiger': (8,),
+ 'leopard': (9,),
+ 'snow_leopard': (10,),
+ 'lion': (11,),
+ 'mountain_lion': (12,),
+ 'mavericks': (13,),
+ 'yosemite': (14,),
+ 'el_capitan': (15,),
+ 'sierra': (16,),
+ }
+
+def os_x_version():
+ version = tuple([int(v) for v in platform.release().split('.')])
+
+ # ensure we return a tuple
+ if len(version) > 0:
+ return version
+ return (version,)
+
+_os_x_version = os_x_version()
+
+# Valid names for GL attributes and their corresponding NSOpenGL constant.
+_gl_attributes = {
+ 'double_buffer': NSOpenGLPFADoubleBuffer,
+ 'stereo': NSOpenGLPFAStereo,
+ 'buffer_size': NSOpenGLPFAColorSize,
+ 'sample_buffers': NSOpenGLPFASampleBuffers,
+ 'samples': NSOpenGLPFASamples,
+ 'aux_buffers': NSOpenGLPFAAuxBuffers,
+ 'alpha_size': NSOpenGLPFAAlphaSize,
+ 'depth_size': NSOpenGLPFADepthSize,
+ 'stencil_size': NSOpenGLPFAStencilSize,
+
+ # Not exposed by pyglet API (set internally)
+ 'all_renderers': NSOpenGLPFAAllRenderers,
+ 'fullscreen': NSOpenGLPFAFullScreen,
+ 'minimum_policy': NSOpenGLPFAMinimumPolicy,
+ 'maximum_policy': NSOpenGLPFAMaximumPolicy,
+ 'screen_mask' : NSOpenGLPFAScreenMask,
+
+ # Not supported in current pyglet API
+ 'color_float': NSOpenGLPFAColorFloat,
+ 'offscreen': NSOpenGLPFAOffScreen,
+ 'sample_alpha': NSOpenGLPFASampleAlpha,
+ 'multisample': NSOpenGLPFAMultisample,
+ 'supersample': NSOpenGLPFASupersample,
+}
+
+# NSOpenGL constants which do not require a value.
+_boolean_gl_attributes = frozenset([
+ NSOpenGLPFAAllRenderers,
+ NSOpenGLPFADoubleBuffer,
+ NSOpenGLPFAStereo,
+ NSOpenGLPFAMinimumPolicy,
+ NSOpenGLPFAMaximumPolicy,
+ NSOpenGLPFAOffScreen,
+ NSOpenGLPFAFullScreen,
+ NSOpenGLPFAColorFloat,
+ NSOpenGLPFAMultisample,
+ NSOpenGLPFASupersample,
+ NSOpenGLPFASampleAlpha,
+])
+
+# Attributes for which no NSOpenGLPixelFormatAttribute name exists.
+# We could probably compute actual values for these using
+# NSOpenGLPFAColorSize / 4 and NSOpenGLFAAccumSize / 4, but I'm not that
+# confident I know what I'm doing.
+_fake_gl_attributes = {
+ 'red_size': 0,
+ 'green_size': 0,
+ 'blue_size': 0,
+ 'accum_red_size': 0,
+ 'accum_green_size': 0,
+ 'accum_blue_size': 0,
+ 'accum_alpha_size': 0
+}
+
+class CocoaConfig(Config):
+
+ def match(self, canvas):
+ # Construct array of attributes for NSOpenGLPixelFormat
+ attrs = []
+ for name, value in self.get_gl_attributes():
+ attr = _gl_attributes.get(name)
+ if not attr or not value:
+ continue
+ attrs.append(attr)
+ if attr not in _boolean_gl_attributes:
+ attrs.append(int(value))
+
+ # Support for RAGE-II, which is not compliant.
+ attrs.append(NSOpenGLPFAAllRenderers)
+
+ # Force selection policy.
+ attrs.append(NSOpenGLPFAMaximumPolicy)
+
+ # NSOpenGLPFAFullScreen is always supplied so we can switch to and
+ # from fullscreen without losing the context. Also must supply the
+ # NSOpenGLPFAScreenMask attribute with appropriate display ID.
+ # Note that these attributes aren't necessary to render in fullscreen
+ # on Mac OS X 10.6, because there we are simply rendering into a
+ # screen sized window. See:
+ # http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_fullscreen/opengl_cgl.html%23//apple_ref/doc/uid/TP40001987-CH210-SW6
+ # Otherwise, make sure we refer to the correct Profile for OpenGL (Core or
+ # Legacy) on Lion and afterwards
+ if _os_x_version < os_x_release['snow_leopard']:
+ attrs.append(NSOpenGLPFAFullScreen)
+ attrs.append(NSOpenGLPFAScreenMask)
+ attrs.append(quartz.CGDisplayIDToOpenGLDisplayMask(quartz.CGMainDisplayID()))
+ elif _os_x_version >= os_x_release['lion']:
+ # check for opengl profile
+ # This requires OS-X Lion (Darwin 11) or higher
+ version = (
+ getattr(self, 'major_version', None),
+ getattr(self, 'minor_version', None)
+ )
+ # tell os-x we want to request a profile
+ attrs.append(NSOpenGLPFAOpenGLProfile)
+
+ # check if we're wanting core or legacy
+ # Mavericks (Darwin 13) and up are capable of the Core 4.1 profile,
+ # while Lion and up are only capable of Core 3.2
+ if version == (4, 1) and _os_x_version >= os_x_release['mavericks']:
+ attrs.append(int(NSOpenGLProfileVersion4_1Core))
+ elif version == (3, 2):
+ attrs.append(int(NSOpenGLProfileVersion3_2Core))
+ else:
+ attrs.append(int(NSOpenGLProfileVersionLegacy))
+ # Terminate the list.
+ attrs.append(0)
+
+ # Create the pixel format.
+ attrsArrayType = c_uint32 * len(attrs)
+ attrsArray = attrsArrayType(*attrs)
+ pixel_format = NSOpenGLPixelFormat.alloc().initWithAttributes_(attrsArray)
+
+ # Return the match list.
+ if pixel_format is None:
+ return []
+ else:
+ return [CocoaCanvasConfig(canvas, self, pixel_format)]
+
+
+class CocoaCanvasConfig(CanvasConfig):
+
+ def __init__(self, canvas, config, pixel_format):
+ super(CocoaCanvasConfig, self).__init__(canvas, config)
+ self._pixel_format = pixel_format
+
+ # Query values for the attributes of the pixel format, and then set the
+ # corresponding attributes of the canvas config.
+ for name, attr in _gl_attributes.items():
+ vals = c_int()
+ self._pixel_format.getValues_forAttribute_forVirtualScreen_(byref(vals), attr, 0)
+ setattr(self, name, vals.value)
+
+ # Set these attributes so that we can run pyglet.info.
+ for name, value in _fake_gl_attributes.items():
+ setattr(self, name, value)
+
+ # Update the minor/major version from profile if (Mountain)Lion
+ if _os_x_version >= os_x_release['lion']:
+ vals = c_int()
+ profile = self._pixel_format.getValues_forAttribute_forVirtualScreen_(
+ byref(vals),
+ NSOpenGLPFAOpenGLProfile,
+ 0
+ )
+
+ if profile == NSOpenGLProfileVersion4_1Core:
+ setattr(self, "major_version", 4)
+ setattr(self, "minor_version", 1)
+ elif profile == NSOpenGLProfileVersion3_2Core:
+ setattr(self, "major_version", 3)
+ setattr(self, "minor_version", 2)
+ else:
+ setattr(self, "major_version", 2)
+ setattr(self, "minor_version", 1)
+
+ def create_context(self, share):
+ # Determine the shared NSOpenGLContext.
+ if share:
+ share_context = share._nscontext
+ else:
+ share_context = None
+
+ # Create a new NSOpenGLContext.
+ nscontext = NSOpenGLContext.alloc().initWithFormat_shareContext_(
+ self._pixel_format,
+ share_context)
+
+ return CocoaContext(self, nscontext, share)
+
+ def compatible(self, canvas):
+ return isinstance(canvas, CocoaCanvas)
+
+
+class CocoaContext(Context):
+
+ def __init__(self, config, nscontext, share):
+ super(CocoaContext, self).__init__(config, share)
+ self.config = config
+ self._nscontext = nscontext
+
+ def attach(self, canvas):
+ # See if we want OpenGL 3 in a non-Lion OS
+ if _os_x_version < os_x_release['lion'] and self.config._requires_gl_3():
+ raise ContextException('OpenGL 3 not supported')
+
+ super(CocoaContext, self).attach(canvas)
+ # The NSView instance should be attached to a nondeferred window before calling
+ # setView, otherwise you get an "invalid drawable" message.
+ self._nscontext.setView_(canvas.nsview)
+ self._nscontext.view().setWantsBestResolutionOpenGLSurface_(1)
+ self.set_current()
+
+ def detach(self):
+ super(CocoaContext, self).detach()
+ self._nscontext.clearDrawable()
+
+ def set_current(self):
+ self._nscontext.makeCurrentContext()
+ super(CocoaContext, self).set_current()
+
+ def update_geometry(self):
+ # Need to call this method whenever the context drawable (an NSView)
+ # changes size or location.
+ self._nscontext.update()
+
+ def set_full_screen(self):
+ self._nscontext.makeCurrentContext()
+ self._nscontext.setFullScreen()
+
+ def destroy(self):
+ super(CocoaContext, self).destroy()
+ self._nscontext.release()
+ self._nscontext = None
+
+ def set_vsync(self, vsync=True):
+ vals = c_int(vsync)
+ self._nscontext.setValues_forParameter_(byref(vals), NSOpenGLCPSwapInterval)
+
+ def get_vsync(self):
+ vals = c_int()
+ self._nscontext.getValues_forParameter_(byref(vals), NSOpenGLCPSwapInterval)
+ return vals.value
+
+ def flip(self):
+ self._nscontext.flushBuffer()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/gl.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/gl.py
new file mode 100644
index 0000000..124e049
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/gl.py
@@ -0,0 +1,2716 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+'''Wrapper for /usr/include/GL/gl.h
+
+Generated by tools/gengl.py.
+Do not modify this file.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+from ctypes import *
+from pyglet.gl.lib import link_GL as _link_function
+from pyglet.gl.lib import c_ptrdiff_t
+
+# BEGIN GENERATED CONTENT (do not edit below this line)
+
+# This content is generated by gengl.py.
+# Wrapper for /usr/include/GL/gl.h
+
+
+GL_VERSION_1_1 = 1 # /usr/include/GL/gl.h:140
+GL_VERSION_1_2 = 1 # /usr/include/GL/gl.h:141
+GL_VERSION_1_3 = 1 # /usr/include/GL/gl.h:142
+GL_ARB_imaging = 1 # /usr/include/GL/gl.h:143
+GLenum = c_uint # /usr/include/GL/gl.h:149
+GLboolean = c_ubyte # /usr/include/GL/gl.h:150
+GLbitfield = c_uint # /usr/include/GL/gl.h:151
+GLvoid = None # /usr/include/GL/gl.h:152
+GLbyte = c_char # /usr/include/GL/gl.h:153
+GLshort = c_short # /usr/include/GL/gl.h:154
+GLint = c_int # /usr/include/GL/gl.h:155
+GLubyte = c_ubyte # /usr/include/GL/gl.h:156
+GLushort = c_ushort # /usr/include/GL/gl.h:157
+GLuint = c_uint # /usr/include/GL/gl.h:158
+GLsizei = c_int # /usr/include/GL/gl.h:159
+GLfloat = c_float # /usr/include/GL/gl.h:160
+GLclampf = c_float # /usr/include/GL/gl.h:161
+GLdouble = c_double # /usr/include/GL/gl.h:162
+GLclampd = c_double # /usr/include/GL/gl.h:163
+GL_FALSE = 0 # /usr/include/GL/gl.h:172
+GL_TRUE = 1 # /usr/include/GL/gl.h:173
+GL_BYTE = 5120 # /usr/include/GL/gl.h:176
+GL_UNSIGNED_BYTE = 5121 # /usr/include/GL/gl.h:177
+GL_SHORT = 5122 # /usr/include/GL/gl.h:178
+GL_UNSIGNED_SHORT = 5123 # /usr/include/GL/gl.h:179
+GL_INT = 5124 # /usr/include/GL/gl.h:180
+GL_UNSIGNED_INT = 5125 # /usr/include/GL/gl.h:181
+GL_FLOAT = 5126 # /usr/include/GL/gl.h:182
+GL_2_BYTES = 5127 # /usr/include/GL/gl.h:183
+GL_3_BYTES = 5128 # /usr/include/GL/gl.h:184
+GL_4_BYTES = 5129 # /usr/include/GL/gl.h:185
+GL_DOUBLE = 5130 # /usr/include/GL/gl.h:186
+GL_POINTS = 0 # /usr/include/GL/gl.h:189
+GL_LINES = 1 # /usr/include/GL/gl.h:190
+GL_LINE_LOOP = 2 # /usr/include/GL/gl.h:191
+GL_LINE_STRIP = 3 # /usr/include/GL/gl.h:192
+GL_TRIANGLES = 4 # /usr/include/GL/gl.h:193
+GL_TRIANGLE_STRIP = 5 # /usr/include/GL/gl.h:194
+GL_TRIANGLE_FAN = 6 # /usr/include/GL/gl.h:195
+GL_QUADS = 7 # /usr/include/GL/gl.h:196
+GL_QUAD_STRIP = 8 # /usr/include/GL/gl.h:197
+GL_POLYGON = 9 # /usr/include/GL/gl.h:198
+GL_VERTEX_ARRAY = 32884 # /usr/include/GL/gl.h:201
+GL_NORMAL_ARRAY = 32885 # /usr/include/GL/gl.h:202
+GL_COLOR_ARRAY = 32886 # /usr/include/GL/gl.h:203
+GL_INDEX_ARRAY = 32887 # /usr/include/GL/gl.h:204
+GL_TEXTURE_COORD_ARRAY = 32888 # /usr/include/GL/gl.h:205
+GL_EDGE_FLAG_ARRAY = 32889 # /usr/include/GL/gl.h:206
+GL_VERTEX_ARRAY_SIZE = 32890 # /usr/include/GL/gl.h:207
+GL_VERTEX_ARRAY_TYPE = 32891 # /usr/include/GL/gl.h:208
+GL_VERTEX_ARRAY_STRIDE = 32892 # /usr/include/GL/gl.h:209
+GL_NORMAL_ARRAY_TYPE = 32894 # /usr/include/GL/gl.h:210
+GL_NORMAL_ARRAY_STRIDE = 32895 # /usr/include/GL/gl.h:211
+GL_COLOR_ARRAY_SIZE = 32897 # /usr/include/GL/gl.h:212
+GL_COLOR_ARRAY_TYPE = 32898 # /usr/include/GL/gl.h:213
+GL_COLOR_ARRAY_STRIDE = 32899 # /usr/include/GL/gl.h:214
+GL_INDEX_ARRAY_TYPE = 32901 # /usr/include/GL/gl.h:215
+GL_INDEX_ARRAY_STRIDE = 32902 # /usr/include/GL/gl.h:216
+GL_TEXTURE_COORD_ARRAY_SIZE = 32904 # /usr/include/GL/gl.h:217
+GL_TEXTURE_COORD_ARRAY_TYPE = 32905 # /usr/include/GL/gl.h:218
+GL_TEXTURE_COORD_ARRAY_STRIDE = 32906 # /usr/include/GL/gl.h:219
+GL_EDGE_FLAG_ARRAY_STRIDE = 32908 # /usr/include/GL/gl.h:220
+GL_VERTEX_ARRAY_POINTER = 32910 # /usr/include/GL/gl.h:221
+GL_NORMAL_ARRAY_POINTER = 32911 # /usr/include/GL/gl.h:222
+GL_COLOR_ARRAY_POINTER = 32912 # /usr/include/GL/gl.h:223
+GL_INDEX_ARRAY_POINTER = 32913 # /usr/include/GL/gl.h:224
+GL_TEXTURE_COORD_ARRAY_POINTER = 32914 # /usr/include/GL/gl.h:225
+GL_EDGE_FLAG_ARRAY_POINTER = 32915 # /usr/include/GL/gl.h:226
+GL_V2F = 10784 # /usr/include/GL/gl.h:227
+GL_V3F = 10785 # /usr/include/GL/gl.h:228
+GL_C4UB_V2F = 10786 # /usr/include/GL/gl.h:229
+GL_C4UB_V3F = 10787 # /usr/include/GL/gl.h:230
+GL_C3F_V3F = 10788 # /usr/include/GL/gl.h:231
+GL_N3F_V3F = 10789 # /usr/include/GL/gl.h:232
+GL_C4F_N3F_V3F = 10790 # /usr/include/GL/gl.h:233
+GL_T2F_V3F = 10791 # /usr/include/GL/gl.h:234
+GL_T4F_V4F = 10792 # /usr/include/GL/gl.h:235
+GL_T2F_C4UB_V3F = 10793 # /usr/include/GL/gl.h:236
+GL_T2F_C3F_V3F = 10794 # /usr/include/GL/gl.h:237
+GL_T2F_N3F_V3F = 10795 # /usr/include/GL/gl.h:238
+GL_T2F_C4F_N3F_V3F = 10796 # /usr/include/GL/gl.h:239
+GL_T4F_C4F_N3F_V4F = 10797 # /usr/include/GL/gl.h:240
+GL_MATRIX_MODE = 2976 # /usr/include/GL/gl.h:243
+GL_MODELVIEW = 5888 # /usr/include/GL/gl.h:244
+GL_PROJECTION = 5889 # /usr/include/GL/gl.h:245
+GL_TEXTURE = 5890 # /usr/include/GL/gl.h:246
+GL_POINT_SMOOTH = 2832 # /usr/include/GL/gl.h:249
+GL_POINT_SIZE = 2833 # /usr/include/GL/gl.h:250
+GL_POINT_SIZE_GRANULARITY = 2835 # /usr/include/GL/gl.h:251
+GL_POINT_SIZE_RANGE = 2834 # /usr/include/GL/gl.h:252
+GL_LINE_SMOOTH = 2848 # /usr/include/GL/gl.h:255
+GL_LINE_STIPPLE = 2852 # /usr/include/GL/gl.h:256
+GL_LINE_STIPPLE_PATTERN = 2853 # /usr/include/GL/gl.h:257
+GL_LINE_STIPPLE_REPEAT = 2854 # /usr/include/GL/gl.h:258
+GL_LINE_WIDTH = 2849 # /usr/include/GL/gl.h:259
+GL_LINE_WIDTH_GRANULARITY = 2851 # /usr/include/GL/gl.h:260
+GL_LINE_WIDTH_RANGE = 2850 # /usr/include/GL/gl.h:261
+GL_POINT = 6912 # /usr/include/GL/gl.h:264
+GL_LINE = 6913 # /usr/include/GL/gl.h:265
+GL_FILL = 6914 # /usr/include/GL/gl.h:266
+GL_CW = 2304 # /usr/include/GL/gl.h:267
+GL_CCW = 2305 # /usr/include/GL/gl.h:268
+GL_FRONT = 1028 # /usr/include/GL/gl.h:269
+GL_BACK = 1029 # /usr/include/GL/gl.h:270
+GL_POLYGON_MODE = 2880 # /usr/include/GL/gl.h:271
+GL_POLYGON_SMOOTH = 2881 # /usr/include/GL/gl.h:272
+GL_POLYGON_STIPPLE = 2882 # /usr/include/GL/gl.h:273
+GL_EDGE_FLAG = 2883 # /usr/include/GL/gl.h:274
+GL_CULL_FACE = 2884 # /usr/include/GL/gl.h:275
+GL_CULL_FACE_MODE = 2885 # /usr/include/GL/gl.h:276
+GL_FRONT_FACE = 2886 # /usr/include/GL/gl.h:277
+GL_POLYGON_OFFSET_FACTOR = 32824 # /usr/include/GL/gl.h:278
+GL_POLYGON_OFFSET_UNITS = 10752 # /usr/include/GL/gl.h:279
+GL_POLYGON_OFFSET_POINT = 10753 # /usr/include/GL/gl.h:280
+GL_POLYGON_OFFSET_LINE = 10754 # /usr/include/GL/gl.h:281
+GL_POLYGON_OFFSET_FILL = 32823 # /usr/include/GL/gl.h:282
+GL_COMPILE = 4864 # /usr/include/GL/gl.h:285
+GL_COMPILE_AND_EXECUTE = 4865 # /usr/include/GL/gl.h:286
+GL_LIST_BASE = 2866 # /usr/include/GL/gl.h:287
+GL_LIST_INDEX = 2867 # /usr/include/GL/gl.h:288
+GL_LIST_MODE = 2864 # /usr/include/GL/gl.h:289
+GL_NEVER = 512 # /usr/include/GL/gl.h:292
+GL_LESS = 513 # /usr/include/GL/gl.h:293
+GL_EQUAL = 514 # /usr/include/GL/gl.h:294
+GL_LEQUAL = 515 # /usr/include/GL/gl.h:295
+GL_GREATER = 516 # /usr/include/GL/gl.h:296
+GL_NOTEQUAL = 517 # /usr/include/GL/gl.h:297
+GL_GEQUAL = 518 # /usr/include/GL/gl.h:298
+GL_ALWAYS = 519 # /usr/include/GL/gl.h:299
+GL_DEPTH_TEST = 2929 # /usr/include/GL/gl.h:300
+GL_DEPTH_BITS = 3414 # /usr/include/GL/gl.h:301
+GL_DEPTH_CLEAR_VALUE = 2931 # /usr/include/GL/gl.h:302
+GL_DEPTH_FUNC = 2932 # /usr/include/GL/gl.h:303
+GL_DEPTH_RANGE = 2928 # /usr/include/GL/gl.h:304
+GL_DEPTH_WRITEMASK = 2930 # /usr/include/GL/gl.h:305
+GL_DEPTH_COMPONENT = 6402 # /usr/include/GL/gl.h:306
+GL_LIGHTING = 2896 # /usr/include/GL/gl.h:309
+GL_LIGHT0 = 16384 # /usr/include/GL/gl.h:310
+GL_LIGHT1 = 16385 # /usr/include/GL/gl.h:311
+GL_LIGHT2 = 16386 # /usr/include/GL/gl.h:312
+GL_LIGHT3 = 16387 # /usr/include/GL/gl.h:313
+GL_LIGHT4 = 16388 # /usr/include/GL/gl.h:314
+GL_LIGHT5 = 16389 # /usr/include/GL/gl.h:315
+GL_LIGHT6 = 16390 # /usr/include/GL/gl.h:316
+GL_LIGHT7 = 16391 # /usr/include/GL/gl.h:317
+GL_SPOT_EXPONENT = 4613 # /usr/include/GL/gl.h:318
+GL_SPOT_CUTOFF = 4614 # /usr/include/GL/gl.h:319
+GL_CONSTANT_ATTENUATION = 4615 # /usr/include/GL/gl.h:320
+GL_LINEAR_ATTENUATION = 4616 # /usr/include/GL/gl.h:321
+GL_QUADRATIC_ATTENUATION = 4617 # /usr/include/GL/gl.h:322
+GL_AMBIENT = 4608 # /usr/include/GL/gl.h:323
+GL_DIFFUSE = 4609 # /usr/include/GL/gl.h:324
+GL_SPECULAR = 4610 # /usr/include/GL/gl.h:325
+GL_SHININESS = 5633 # /usr/include/GL/gl.h:326
+GL_EMISSION = 5632 # /usr/include/GL/gl.h:327
+GL_POSITION = 4611 # /usr/include/GL/gl.h:328
+GL_SPOT_DIRECTION = 4612 # /usr/include/GL/gl.h:329
+GL_AMBIENT_AND_DIFFUSE = 5634 # /usr/include/GL/gl.h:330
+GL_COLOR_INDEXES = 5635 # /usr/include/GL/gl.h:331
+GL_LIGHT_MODEL_TWO_SIDE = 2898 # /usr/include/GL/gl.h:332
+GL_LIGHT_MODEL_LOCAL_VIEWER = 2897 # /usr/include/GL/gl.h:333
+GL_LIGHT_MODEL_AMBIENT = 2899 # /usr/include/GL/gl.h:334
+GL_FRONT_AND_BACK = 1032 # /usr/include/GL/gl.h:335
+GL_SHADE_MODEL = 2900 # /usr/include/GL/gl.h:336
+GL_FLAT = 7424 # /usr/include/GL/gl.h:337
+GL_SMOOTH = 7425 # /usr/include/GL/gl.h:338
+GL_COLOR_MATERIAL = 2903 # /usr/include/GL/gl.h:339
+GL_COLOR_MATERIAL_FACE = 2901 # /usr/include/GL/gl.h:340
+GL_COLOR_MATERIAL_PARAMETER = 2902 # /usr/include/GL/gl.h:341
+GL_NORMALIZE = 2977 # /usr/include/GL/gl.h:342
+GL_CLIP_PLANE0 = 12288 # /usr/include/GL/gl.h:345
+GL_CLIP_PLANE1 = 12289 # /usr/include/GL/gl.h:346
+GL_CLIP_PLANE2 = 12290 # /usr/include/GL/gl.h:347
+GL_CLIP_PLANE3 = 12291 # /usr/include/GL/gl.h:348
+GL_CLIP_PLANE4 = 12292 # /usr/include/GL/gl.h:349
+GL_CLIP_PLANE5 = 12293 # /usr/include/GL/gl.h:350
+GL_ACCUM_RED_BITS = 3416 # /usr/include/GL/gl.h:353
+GL_ACCUM_GREEN_BITS = 3417 # /usr/include/GL/gl.h:354
+GL_ACCUM_BLUE_BITS = 3418 # /usr/include/GL/gl.h:355
+GL_ACCUM_ALPHA_BITS = 3419 # /usr/include/GL/gl.h:356
+GL_ACCUM_CLEAR_VALUE = 2944 # /usr/include/GL/gl.h:357
+GL_ACCUM = 256 # /usr/include/GL/gl.h:358
+GL_ADD = 260 # /usr/include/GL/gl.h:359
+GL_LOAD = 257 # /usr/include/GL/gl.h:360
+GL_MULT = 259 # /usr/include/GL/gl.h:361
+GL_RETURN = 258 # /usr/include/GL/gl.h:362
+GL_ALPHA_TEST = 3008 # /usr/include/GL/gl.h:365
+GL_ALPHA_TEST_REF = 3010 # /usr/include/GL/gl.h:366
+GL_ALPHA_TEST_FUNC = 3009 # /usr/include/GL/gl.h:367
+GL_BLEND = 3042 # /usr/include/GL/gl.h:370
+GL_BLEND_SRC = 3041 # /usr/include/GL/gl.h:371
+GL_BLEND_DST = 3040 # /usr/include/GL/gl.h:372
+GL_ZERO = 0 # /usr/include/GL/gl.h:373
+GL_ONE = 1 # /usr/include/GL/gl.h:374
+GL_SRC_COLOR = 768 # /usr/include/GL/gl.h:375
+GL_ONE_MINUS_SRC_COLOR = 769 # /usr/include/GL/gl.h:376
+GL_SRC_ALPHA = 770 # /usr/include/GL/gl.h:377
+GL_ONE_MINUS_SRC_ALPHA = 771 # /usr/include/GL/gl.h:378
+GL_DST_ALPHA = 772 # /usr/include/GL/gl.h:379
+GL_ONE_MINUS_DST_ALPHA = 773 # /usr/include/GL/gl.h:380
+GL_DST_COLOR = 774 # /usr/include/GL/gl.h:381
+GL_ONE_MINUS_DST_COLOR = 775 # /usr/include/GL/gl.h:382
+GL_SRC_ALPHA_SATURATE = 776 # /usr/include/GL/gl.h:383
+GL_FEEDBACK = 7169 # /usr/include/GL/gl.h:386
+GL_RENDER = 7168 # /usr/include/GL/gl.h:387
+GL_SELECT = 7170 # /usr/include/GL/gl.h:388
+GL_2D = 1536 # /usr/include/GL/gl.h:391
+GL_3D = 1537 # /usr/include/GL/gl.h:392
+GL_3D_COLOR = 1538 # /usr/include/GL/gl.h:393
+GL_3D_COLOR_TEXTURE = 1539 # /usr/include/GL/gl.h:394
+GL_4D_COLOR_TEXTURE = 1540 # /usr/include/GL/gl.h:395
+GL_POINT_TOKEN = 1793 # /usr/include/GL/gl.h:396
+GL_LINE_TOKEN = 1794 # /usr/include/GL/gl.h:397
+GL_LINE_RESET_TOKEN = 1799 # /usr/include/GL/gl.h:398
+GL_POLYGON_TOKEN = 1795 # /usr/include/GL/gl.h:399
+GL_BITMAP_TOKEN = 1796 # /usr/include/GL/gl.h:400
+GL_DRAW_PIXEL_TOKEN = 1797 # /usr/include/GL/gl.h:401
+GL_COPY_PIXEL_TOKEN = 1798 # /usr/include/GL/gl.h:402
+GL_PASS_THROUGH_TOKEN = 1792 # /usr/include/GL/gl.h:403
+GL_FEEDBACK_BUFFER_POINTER = 3568 # /usr/include/GL/gl.h:404
+GL_FEEDBACK_BUFFER_SIZE = 3569 # /usr/include/GL/gl.h:405
+GL_FEEDBACK_BUFFER_TYPE = 3570 # /usr/include/GL/gl.h:406
+GL_SELECTION_BUFFER_POINTER = 3571 # /usr/include/GL/gl.h:409
+GL_SELECTION_BUFFER_SIZE = 3572 # /usr/include/GL/gl.h:410
+GL_FOG = 2912 # /usr/include/GL/gl.h:413
+GL_FOG_MODE = 2917 # /usr/include/GL/gl.h:414
+GL_FOG_DENSITY = 2914 # /usr/include/GL/gl.h:415
+GL_FOG_COLOR = 2918 # /usr/include/GL/gl.h:416
+GL_FOG_INDEX = 2913 # /usr/include/GL/gl.h:417
+GL_FOG_START = 2915 # /usr/include/GL/gl.h:418
+GL_FOG_END = 2916 # /usr/include/GL/gl.h:419
+GL_LINEAR = 9729 # /usr/include/GL/gl.h:420
+GL_EXP = 2048 # /usr/include/GL/gl.h:421
+GL_EXP2 = 2049 # /usr/include/GL/gl.h:422
+GL_LOGIC_OP = 3057 # /usr/include/GL/gl.h:425
+GL_INDEX_LOGIC_OP = 3057 # /usr/include/GL/gl.h:426
+GL_COLOR_LOGIC_OP = 3058 # /usr/include/GL/gl.h:427
+GL_LOGIC_OP_MODE = 3056 # /usr/include/GL/gl.h:428
+GL_CLEAR = 5376 # /usr/include/GL/gl.h:429
+GL_SET = 5391 # /usr/include/GL/gl.h:430
+GL_COPY = 5379 # /usr/include/GL/gl.h:431
+GL_COPY_INVERTED = 5388 # /usr/include/GL/gl.h:432
+GL_NOOP = 5381 # /usr/include/GL/gl.h:433
+GL_INVERT = 5386 # /usr/include/GL/gl.h:434
+GL_AND = 5377 # /usr/include/GL/gl.h:435
+GL_NAND = 5390 # /usr/include/GL/gl.h:436
+GL_OR = 5383 # /usr/include/GL/gl.h:437
+GL_NOR = 5384 # /usr/include/GL/gl.h:438
+GL_XOR = 5382 # /usr/include/GL/gl.h:439
+GL_EQUIV = 5385 # /usr/include/GL/gl.h:440
+GL_AND_REVERSE = 5378 # /usr/include/GL/gl.h:441
+GL_AND_INVERTED = 5380 # /usr/include/GL/gl.h:442
+GL_OR_REVERSE = 5387 # /usr/include/GL/gl.h:443
+GL_OR_INVERTED = 5389 # /usr/include/GL/gl.h:444
+GL_STENCIL_BITS = 3415 # /usr/include/GL/gl.h:447
+GL_STENCIL_TEST = 2960 # /usr/include/GL/gl.h:448
+GL_STENCIL_CLEAR_VALUE = 2961 # /usr/include/GL/gl.h:449
+GL_STENCIL_FUNC = 2962 # /usr/include/GL/gl.h:450
+GL_STENCIL_VALUE_MASK = 2963 # /usr/include/GL/gl.h:451
+GL_STENCIL_FAIL = 2964 # /usr/include/GL/gl.h:452
+GL_STENCIL_PASS_DEPTH_FAIL = 2965 # /usr/include/GL/gl.h:453
+GL_STENCIL_PASS_DEPTH_PASS = 2966 # /usr/include/GL/gl.h:454
+GL_STENCIL_REF = 2967 # /usr/include/GL/gl.h:455
+GL_STENCIL_WRITEMASK = 2968 # /usr/include/GL/gl.h:456
+GL_STENCIL_INDEX = 6401 # /usr/include/GL/gl.h:457
+GL_KEEP = 7680 # /usr/include/GL/gl.h:458
+GL_REPLACE = 7681 # /usr/include/GL/gl.h:459
+GL_INCR = 7682 # /usr/include/GL/gl.h:460
+GL_DECR = 7683 # /usr/include/GL/gl.h:461
+GL_NONE = 0 # /usr/include/GL/gl.h:464
+GL_LEFT = 1030 # /usr/include/GL/gl.h:465
+GL_RIGHT = 1031 # /usr/include/GL/gl.h:466
+GL_FRONT_LEFT = 1024 # /usr/include/GL/gl.h:470
+GL_FRONT_RIGHT = 1025 # /usr/include/GL/gl.h:471
+GL_BACK_LEFT = 1026 # /usr/include/GL/gl.h:472
+GL_BACK_RIGHT = 1027 # /usr/include/GL/gl.h:473
+GL_AUX0 = 1033 # /usr/include/GL/gl.h:474
+GL_AUX1 = 1034 # /usr/include/GL/gl.h:475
+GL_AUX2 = 1035 # /usr/include/GL/gl.h:476
+GL_AUX3 = 1036 # /usr/include/GL/gl.h:477
+GL_COLOR_INDEX = 6400 # /usr/include/GL/gl.h:478
+GL_RED = 6403 # /usr/include/GL/gl.h:479
+GL_GREEN = 6404 # /usr/include/GL/gl.h:480
+GL_BLUE = 6405 # /usr/include/GL/gl.h:481
+GL_ALPHA = 6406 # /usr/include/GL/gl.h:482
+GL_LUMINANCE = 6409 # /usr/include/GL/gl.h:483
+GL_LUMINANCE_ALPHA = 6410 # /usr/include/GL/gl.h:484
+GL_ALPHA_BITS = 3413 # /usr/include/GL/gl.h:485
+GL_RED_BITS = 3410 # /usr/include/GL/gl.h:486
+GL_GREEN_BITS = 3411 # /usr/include/GL/gl.h:487
+GL_BLUE_BITS = 3412 # /usr/include/GL/gl.h:488
+GL_INDEX_BITS = 3409 # /usr/include/GL/gl.h:489
+GL_SUBPIXEL_BITS = 3408 # /usr/include/GL/gl.h:490
+GL_AUX_BUFFERS = 3072 # /usr/include/GL/gl.h:491
+GL_READ_BUFFER = 3074 # /usr/include/GL/gl.h:492
+GL_DRAW_BUFFER = 3073 # /usr/include/GL/gl.h:493
+GL_DOUBLEBUFFER = 3122 # /usr/include/GL/gl.h:494
+GL_STEREO = 3123 # /usr/include/GL/gl.h:495
+GL_BITMAP = 6656 # /usr/include/GL/gl.h:496
+GL_COLOR = 6144 # /usr/include/GL/gl.h:497
+GL_DEPTH = 6145 # /usr/include/GL/gl.h:498
+GL_STENCIL = 6146 # /usr/include/GL/gl.h:499
+GL_DITHER = 3024 # /usr/include/GL/gl.h:500
+GL_RGB = 6407 # /usr/include/GL/gl.h:501
+GL_RGBA = 6408 # /usr/include/GL/gl.h:502
+GL_MAX_LIST_NESTING = 2865 # /usr/include/GL/gl.h:505
+GL_MAX_EVAL_ORDER = 3376 # /usr/include/GL/gl.h:506
+GL_MAX_LIGHTS = 3377 # /usr/include/GL/gl.h:507
+GL_MAX_CLIP_PLANES = 3378 # /usr/include/GL/gl.h:508
+GL_MAX_TEXTURE_SIZE = 3379 # /usr/include/GL/gl.h:509
+GL_MAX_PIXEL_MAP_TABLE = 3380 # /usr/include/GL/gl.h:510
+GL_MAX_ATTRIB_STACK_DEPTH = 3381 # /usr/include/GL/gl.h:511
+GL_MAX_MODELVIEW_STACK_DEPTH = 3382 # /usr/include/GL/gl.h:512
+GL_MAX_NAME_STACK_DEPTH = 3383 # /usr/include/GL/gl.h:513
+GL_MAX_PROJECTION_STACK_DEPTH = 3384 # /usr/include/GL/gl.h:514
+GL_MAX_TEXTURE_STACK_DEPTH = 3385 # /usr/include/GL/gl.h:515
+GL_MAX_VIEWPORT_DIMS = 3386 # /usr/include/GL/gl.h:516
+GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = 3387 # /usr/include/GL/gl.h:517
+GL_ATTRIB_STACK_DEPTH = 2992 # /usr/include/GL/gl.h:520
+GL_CLIENT_ATTRIB_STACK_DEPTH = 2993 # /usr/include/GL/gl.h:521
+GL_COLOR_CLEAR_VALUE = 3106 # /usr/include/GL/gl.h:522
+GL_COLOR_WRITEMASK = 3107 # /usr/include/GL/gl.h:523
+GL_CURRENT_INDEX = 2817 # /usr/include/GL/gl.h:524
+GL_CURRENT_COLOR = 2816 # /usr/include/GL/gl.h:525
+GL_CURRENT_NORMAL = 2818 # /usr/include/GL/gl.h:526
+GL_CURRENT_RASTER_COLOR = 2820 # /usr/include/GL/gl.h:527
+GL_CURRENT_RASTER_DISTANCE = 2825 # /usr/include/GL/gl.h:528
+GL_CURRENT_RASTER_INDEX = 2821 # /usr/include/GL/gl.h:529
+GL_CURRENT_RASTER_POSITION = 2823 # /usr/include/GL/gl.h:530
+GL_CURRENT_RASTER_TEXTURE_COORDS = 2822 # /usr/include/GL/gl.h:531
+GL_CURRENT_RASTER_POSITION_VALID = 2824 # /usr/include/GL/gl.h:532
+GL_CURRENT_TEXTURE_COORDS = 2819 # /usr/include/GL/gl.h:533
+GL_INDEX_CLEAR_VALUE = 3104 # /usr/include/GL/gl.h:534
+GL_INDEX_MODE = 3120 # /usr/include/GL/gl.h:535
+GL_INDEX_WRITEMASK = 3105 # /usr/include/GL/gl.h:536
+GL_MODELVIEW_MATRIX = 2982 # /usr/include/GL/gl.h:537
+GL_MODELVIEW_STACK_DEPTH = 2979 # /usr/include/GL/gl.h:538
+GL_NAME_STACK_DEPTH = 3440 # /usr/include/GL/gl.h:539
+GL_PROJECTION_MATRIX = 2983 # /usr/include/GL/gl.h:540
+GL_PROJECTION_STACK_DEPTH = 2980 # /usr/include/GL/gl.h:541
+GL_RENDER_MODE = 3136 # /usr/include/GL/gl.h:542
+GL_RGBA_MODE = 3121 # /usr/include/GL/gl.h:543
+GL_TEXTURE_MATRIX = 2984 # /usr/include/GL/gl.h:544
+GL_TEXTURE_STACK_DEPTH = 2981 # /usr/include/GL/gl.h:545
+GL_VIEWPORT = 2978 # /usr/include/GL/gl.h:546
+GL_AUTO_NORMAL = 3456 # /usr/include/GL/gl.h:549
+GL_MAP1_COLOR_4 = 3472 # /usr/include/GL/gl.h:550
+GL_MAP1_INDEX = 3473 # /usr/include/GL/gl.h:551
+GL_MAP1_NORMAL = 3474 # /usr/include/GL/gl.h:552
+GL_MAP1_TEXTURE_COORD_1 = 3475 # /usr/include/GL/gl.h:553
+GL_MAP1_TEXTURE_COORD_2 = 3476 # /usr/include/GL/gl.h:554
+GL_MAP1_TEXTURE_COORD_3 = 3477 # /usr/include/GL/gl.h:555
+GL_MAP1_TEXTURE_COORD_4 = 3478 # /usr/include/GL/gl.h:556
+GL_MAP1_VERTEX_3 = 3479 # /usr/include/GL/gl.h:557
+GL_MAP1_VERTEX_4 = 3480 # /usr/include/GL/gl.h:558
+GL_MAP2_COLOR_4 = 3504 # /usr/include/GL/gl.h:559
+GL_MAP2_INDEX = 3505 # /usr/include/GL/gl.h:560
+GL_MAP2_NORMAL = 3506 # /usr/include/GL/gl.h:561
+GL_MAP2_TEXTURE_COORD_1 = 3507 # /usr/include/GL/gl.h:562
+GL_MAP2_TEXTURE_COORD_2 = 3508 # /usr/include/GL/gl.h:563
+GL_MAP2_TEXTURE_COORD_3 = 3509 # /usr/include/GL/gl.h:564
+GL_MAP2_TEXTURE_COORD_4 = 3510 # /usr/include/GL/gl.h:565
+GL_MAP2_VERTEX_3 = 3511 # /usr/include/GL/gl.h:566
+GL_MAP2_VERTEX_4 = 3512 # /usr/include/GL/gl.h:567
+GL_MAP1_GRID_DOMAIN = 3536 # /usr/include/GL/gl.h:568
+GL_MAP1_GRID_SEGMENTS = 3537 # /usr/include/GL/gl.h:569
+GL_MAP2_GRID_DOMAIN = 3538 # /usr/include/GL/gl.h:570
+GL_MAP2_GRID_SEGMENTS = 3539 # /usr/include/GL/gl.h:571
+GL_COEFF = 2560 # /usr/include/GL/gl.h:572
+GL_ORDER = 2561 # /usr/include/GL/gl.h:573
+GL_DOMAIN = 2562 # /usr/include/GL/gl.h:574
+GL_PERSPECTIVE_CORRECTION_HINT = 3152 # /usr/include/GL/gl.h:577
+GL_POINT_SMOOTH_HINT = 3153 # /usr/include/GL/gl.h:578
+GL_LINE_SMOOTH_HINT = 3154 # /usr/include/GL/gl.h:579
+GL_POLYGON_SMOOTH_HINT = 3155 # /usr/include/GL/gl.h:580
+GL_FOG_HINT = 3156 # /usr/include/GL/gl.h:581
+GL_DONT_CARE = 4352 # /usr/include/GL/gl.h:582
+GL_FASTEST = 4353 # /usr/include/GL/gl.h:583
+GL_NICEST = 4354 # /usr/include/GL/gl.h:584
+GL_SCISSOR_BOX = 3088 # /usr/include/GL/gl.h:587
+GL_SCISSOR_TEST = 3089 # /usr/include/GL/gl.h:588
+GL_MAP_COLOR = 3344 # /usr/include/GL/gl.h:591
+GL_MAP_STENCIL = 3345 # /usr/include/GL/gl.h:592
+GL_INDEX_SHIFT = 3346 # /usr/include/GL/gl.h:593
+GL_INDEX_OFFSET = 3347 # /usr/include/GL/gl.h:594
+GL_RED_SCALE = 3348 # /usr/include/GL/gl.h:595
+GL_RED_BIAS = 3349 # /usr/include/GL/gl.h:596
+GL_GREEN_SCALE = 3352 # /usr/include/GL/gl.h:597
+GL_GREEN_BIAS = 3353 # /usr/include/GL/gl.h:598
+GL_BLUE_SCALE = 3354 # /usr/include/GL/gl.h:599
+GL_BLUE_BIAS = 3355 # /usr/include/GL/gl.h:600
+GL_ALPHA_SCALE = 3356 # /usr/include/GL/gl.h:601
+GL_ALPHA_BIAS = 3357 # /usr/include/GL/gl.h:602
+GL_DEPTH_SCALE = 3358 # /usr/include/GL/gl.h:603
+GL_DEPTH_BIAS = 3359 # /usr/include/GL/gl.h:604
+GL_PIXEL_MAP_S_TO_S_SIZE = 3249 # /usr/include/GL/gl.h:605
+GL_PIXEL_MAP_I_TO_I_SIZE = 3248 # /usr/include/GL/gl.h:606
+GL_PIXEL_MAP_I_TO_R_SIZE = 3250 # /usr/include/GL/gl.h:607
+GL_PIXEL_MAP_I_TO_G_SIZE = 3251 # /usr/include/GL/gl.h:608
+GL_PIXEL_MAP_I_TO_B_SIZE = 3252 # /usr/include/GL/gl.h:609
+GL_PIXEL_MAP_I_TO_A_SIZE = 3253 # /usr/include/GL/gl.h:610
+GL_PIXEL_MAP_R_TO_R_SIZE = 3254 # /usr/include/GL/gl.h:611
+GL_PIXEL_MAP_G_TO_G_SIZE = 3255 # /usr/include/GL/gl.h:612
+GL_PIXEL_MAP_B_TO_B_SIZE = 3256 # /usr/include/GL/gl.h:613
+GL_PIXEL_MAP_A_TO_A_SIZE = 3257 # /usr/include/GL/gl.h:614
+GL_PIXEL_MAP_S_TO_S = 3185 # /usr/include/GL/gl.h:615
+GL_PIXEL_MAP_I_TO_I = 3184 # /usr/include/GL/gl.h:616
+GL_PIXEL_MAP_I_TO_R = 3186 # /usr/include/GL/gl.h:617
+GL_PIXEL_MAP_I_TO_G = 3187 # /usr/include/GL/gl.h:618
+GL_PIXEL_MAP_I_TO_B = 3188 # /usr/include/GL/gl.h:619
+GL_PIXEL_MAP_I_TO_A = 3189 # /usr/include/GL/gl.h:620
+GL_PIXEL_MAP_R_TO_R = 3190 # /usr/include/GL/gl.h:621
+GL_PIXEL_MAP_G_TO_G = 3191 # /usr/include/GL/gl.h:622
+GL_PIXEL_MAP_B_TO_B = 3192 # /usr/include/GL/gl.h:623
+GL_PIXEL_MAP_A_TO_A = 3193 # /usr/include/GL/gl.h:624
+GL_PACK_ALIGNMENT = 3333 # /usr/include/GL/gl.h:625
+GL_PACK_LSB_FIRST = 3329 # /usr/include/GL/gl.h:626
+GL_PACK_ROW_LENGTH = 3330 # /usr/include/GL/gl.h:627
+GL_PACK_SKIP_PIXELS = 3332 # /usr/include/GL/gl.h:628
+GL_PACK_SKIP_ROWS = 3331 # /usr/include/GL/gl.h:629
+GL_PACK_SWAP_BYTES = 3328 # /usr/include/GL/gl.h:630
+GL_UNPACK_ALIGNMENT = 3317 # /usr/include/GL/gl.h:631
+GL_UNPACK_LSB_FIRST = 3313 # /usr/include/GL/gl.h:632
+GL_UNPACK_ROW_LENGTH = 3314 # /usr/include/GL/gl.h:633
+GL_UNPACK_SKIP_PIXELS = 3316 # /usr/include/GL/gl.h:634
+GL_UNPACK_SKIP_ROWS = 3315 # /usr/include/GL/gl.h:635
+GL_UNPACK_SWAP_BYTES = 3312 # /usr/include/GL/gl.h:636
+GL_ZOOM_X = 3350 # /usr/include/GL/gl.h:637
+GL_ZOOM_Y = 3351 # /usr/include/GL/gl.h:638
+GL_TEXTURE_ENV = 8960 # /usr/include/GL/gl.h:641
+GL_TEXTURE_ENV_MODE = 8704 # /usr/include/GL/gl.h:642
+GL_TEXTURE_1D = 3552 # /usr/include/GL/gl.h:643
+GL_TEXTURE_2D = 3553 # /usr/include/GL/gl.h:644
+GL_TEXTURE_WRAP_S = 10242 # /usr/include/GL/gl.h:645
+GL_TEXTURE_WRAP_T = 10243 # /usr/include/GL/gl.h:646
+GL_TEXTURE_MAG_FILTER = 10240 # /usr/include/GL/gl.h:647
+GL_TEXTURE_MIN_FILTER = 10241 # /usr/include/GL/gl.h:648
+GL_TEXTURE_ENV_COLOR = 8705 # /usr/include/GL/gl.h:649
+GL_TEXTURE_GEN_S = 3168 # /usr/include/GL/gl.h:650
+GL_TEXTURE_GEN_T = 3169 # /usr/include/GL/gl.h:651
+GL_TEXTURE_GEN_R = 3170 # /usr/include/GL/gl.h:652
+GL_TEXTURE_GEN_Q = 3171 # /usr/include/GL/gl.h:653
+GL_TEXTURE_GEN_MODE = 9472 # /usr/include/GL/gl.h:654
+GL_TEXTURE_BORDER_COLOR = 4100 # /usr/include/GL/gl.h:655
+GL_TEXTURE_WIDTH = 4096 # /usr/include/GL/gl.h:656
+GL_TEXTURE_HEIGHT = 4097 # /usr/include/GL/gl.h:657
+GL_TEXTURE_BORDER = 4101 # /usr/include/GL/gl.h:658
+GL_TEXTURE_COMPONENTS = 4099 # /usr/include/GL/gl.h:659
+GL_TEXTURE_RED_SIZE = 32860 # /usr/include/GL/gl.h:660
+GL_TEXTURE_GREEN_SIZE = 32861 # /usr/include/GL/gl.h:661
+GL_TEXTURE_BLUE_SIZE = 32862 # /usr/include/GL/gl.h:662
+GL_TEXTURE_ALPHA_SIZE = 32863 # /usr/include/GL/gl.h:663
+GL_TEXTURE_LUMINANCE_SIZE = 32864 # /usr/include/GL/gl.h:664
+GL_TEXTURE_INTENSITY_SIZE = 32865 # /usr/include/GL/gl.h:665
+GL_NEAREST_MIPMAP_NEAREST = 9984 # /usr/include/GL/gl.h:666
+GL_NEAREST_MIPMAP_LINEAR = 9986 # /usr/include/GL/gl.h:667
+GL_LINEAR_MIPMAP_NEAREST = 9985 # /usr/include/GL/gl.h:668
+GL_LINEAR_MIPMAP_LINEAR = 9987 # /usr/include/GL/gl.h:669
+GL_OBJECT_LINEAR = 9217 # /usr/include/GL/gl.h:670
+GL_OBJECT_PLANE = 9473 # /usr/include/GL/gl.h:671
+GL_EYE_LINEAR = 9216 # /usr/include/GL/gl.h:672
+GL_EYE_PLANE = 9474 # /usr/include/GL/gl.h:673
+GL_SPHERE_MAP = 9218 # /usr/include/GL/gl.h:674
+GL_DECAL = 8449 # /usr/include/GL/gl.h:675
+GL_MODULATE = 8448 # /usr/include/GL/gl.h:676
+GL_NEAREST = 9728 # /usr/include/GL/gl.h:677
+GL_REPEAT = 10497 # /usr/include/GL/gl.h:678
+GL_CLAMP = 10496 # /usr/include/GL/gl.h:679
+GL_S = 8192 # /usr/include/GL/gl.h:680
+GL_T = 8193 # /usr/include/GL/gl.h:681
+GL_R = 8194 # /usr/include/GL/gl.h:682
+GL_Q = 8195 # /usr/include/GL/gl.h:683
+GL_VENDOR = 7936 # /usr/include/GL/gl.h:686
+GL_RENDERER = 7937 # /usr/include/GL/gl.h:687
+GL_VERSION = 7938 # /usr/include/GL/gl.h:688
+GL_EXTENSIONS = 7939 # /usr/include/GL/gl.h:689
+GL_NO_ERROR = 0 # /usr/include/GL/gl.h:692
+GL_INVALID_ENUM = 1280 # /usr/include/GL/gl.h:693
+GL_INVALID_VALUE = 1281 # /usr/include/GL/gl.h:694
+GL_INVALID_OPERATION = 1282 # /usr/include/GL/gl.h:695
+GL_STACK_OVERFLOW = 1283 # /usr/include/GL/gl.h:696
+GL_STACK_UNDERFLOW = 1284 # /usr/include/GL/gl.h:697
+GL_OUT_OF_MEMORY = 1285 # /usr/include/GL/gl.h:698
+GL_CURRENT_BIT = 1 # /usr/include/GL/gl.h:701
+GL_POINT_BIT = 2 # /usr/include/GL/gl.h:702
+GL_LINE_BIT = 4 # /usr/include/GL/gl.h:703
+GL_POLYGON_BIT = 8 # /usr/include/GL/gl.h:704
+GL_POLYGON_STIPPLE_BIT = 16 # /usr/include/GL/gl.h:705
+GL_PIXEL_MODE_BIT = 32 # /usr/include/GL/gl.h:706
+GL_LIGHTING_BIT = 64 # /usr/include/GL/gl.h:707
+GL_FOG_BIT = 128 # /usr/include/GL/gl.h:708
+GL_DEPTH_BUFFER_BIT = 256 # /usr/include/GL/gl.h:709
+GL_ACCUM_BUFFER_BIT = 512 # /usr/include/GL/gl.h:710
+GL_STENCIL_BUFFER_BIT = 1024 # /usr/include/GL/gl.h:711
+GL_VIEWPORT_BIT = 2048 # /usr/include/GL/gl.h:712
+GL_TRANSFORM_BIT = 4096 # /usr/include/GL/gl.h:713
+GL_ENABLE_BIT = 8192 # /usr/include/GL/gl.h:714
+GL_COLOR_BUFFER_BIT = 16384 # /usr/include/GL/gl.h:715
+GL_HINT_BIT = 32768 # /usr/include/GL/gl.h:716
+GL_EVAL_BIT = 65536 # /usr/include/GL/gl.h:717
+GL_LIST_BIT = 131072 # /usr/include/GL/gl.h:718
+GL_TEXTURE_BIT = 262144 # /usr/include/GL/gl.h:719
+GL_SCISSOR_BIT = 524288 # /usr/include/GL/gl.h:720
+GL_ALL_ATTRIB_BITS = 1048575 # /usr/include/GL/gl.h:721
+GL_PROXY_TEXTURE_1D = 32867 # /usr/include/GL/gl.h:725
+GL_PROXY_TEXTURE_2D = 32868 # /usr/include/GL/gl.h:726
+GL_TEXTURE_PRIORITY = 32870 # /usr/include/GL/gl.h:727
+GL_TEXTURE_RESIDENT = 32871 # /usr/include/GL/gl.h:728
+GL_TEXTURE_BINDING_1D = 32872 # /usr/include/GL/gl.h:729
+GL_TEXTURE_BINDING_2D = 32873 # /usr/include/GL/gl.h:730
+GL_TEXTURE_INTERNAL_FORMAT = 4099 # /usr/include/GL/gl.h:731
+GL_ALPHA4 = 32827 # /usr/include/GL/gl.h:732
+GL_ALPHA8 = 32828 # /usr/include/GL/gl.h:733
+GL_ALPHA12 = 32829 # /usr/include/GL/gl.h:734
+GL_ALPHA16 = 32830 # /usr/include/GL/gl.h:735
+GL_LUMINANCE4 = 32831 # /usr/include/GL/gl.h:736
+GL_LUMINANCE8 = 32832 # /usr/include/GL/gl.h:737
+GL_LUMINANCE12 = 32833 # /usr/include/GL/gl.h:738
+GL_LUMINANCE16 = 32834 # /usr/include/GL/gl.h:739
+GL_LUMINANCE4_ALPHA4 = 32835 # /usr/include/GL/gl.h:740
+GL_LUMINANCE6_ALPHA2 = 32836 # /usr/include/GL/gl.h:741
+GL_LUMINANCE8_ALPHA8 = 32837 # /usr/include/GL/gl.h:742
+GL_LUMINANCE12_ALPHA4 = 32838 # /usr/include/GL/gl.h:743
+GL_LUMINANCE12_ALPHA12 = 32839 # /usr/include/GL/gl.h:744
+GL_LUMINANCE16_ALPHA16 = 32840 # /usr/include/GL/gl.h:745
+GL_INTENSITY = 32841 # /usr/include/GL/gl.h:746
+GL_INTENSITY4 = 32842 # /usr/include/GL/gl.h:747
+GL_INTENSITY8 = 32843 # /usr/include/GL/gl.h:748
+GL_INTENSITY12 = 32844 # /usr/include/GL/gl.h:749
+GL_INTENSITY16 = 32845 # /usr/include/GL/gl.h:750
+GL_R3_G3_B2 = 10768 # /usr/include/GL/gl.h:751
+GL_RGB4 = 32847 # /usr/include/GL/gl.h:752
+GL_RGB5 = 32848 # /usr/include/GL/gl.h:753
+GL_RGB8 = 32849 # /usr/include/GL/gl.h:754
+GL_RGB10 = 32850 # /usr/include/GL/gl.h:755
+GL_RGB12 = 32851 # /usr/include/GL/gl.h:756
+GL_RGB16 = 32852 # /usr/include/GL/gl.h:757
+GL_RGBA2 = 32853 # /usr/include/GL/gl.h:758
+GL_RGBA4 = 32854 # /usr/include/GL/gl.h:759
+GL_RGB5_A1 = 32855 # /usr/include/GL/gl.h:760
+GL_RGBA8 = 32856 # /usr/include/GL/gl.h:761
+GL_RGB10_A2 = 32857 # /usr/include/GL/gl.h:762
+GL_RGBA12 = 32858 # /usr/include/GL/gl.h:763
+GL_RGBA16 = 32859 # /usr/include/GL/gl.h:764
+GL_CLIENT_PIXEL_STORE_BIT = 1 # /usr/include/GL/gl.h:765
+GL_CLIENT_VERTEX_ARRAY_BIT = 2 # /usr/include/GL/gl.h:766
+GL_ALL_CLIENT_ATTRIB_BITS = 4294967295 # /usr/include/GL/gl.h:767
+GL_CLIENT_ALL_ATTRIB_BITS = 4294967295 # /usr/include/GL/gl.h:768
+# /usr/include/GL/gl.h:776
+glClearIndex = _link_function('glClearIndex', None, [GLfloat], None)
+
+# /usr/include/GL/gl.h:778
+glClearColor = _link_function('glClearColor', None, [GLclampf, GLclampf, GLclampf, GLclampf], None)
+
+# /usr/include/GL/gl.h:780
+glClear = _link_function('glClear', None, [GLbitfield], None)
+
+# /usr/include/GL/gl.h:782
+glIndexMask = _link_function('glIndexMask', None, [GLuint], None)
+
+# /usr/include/GL/gl.h:784
+glColorMask = _link_function('glColorMask', None, [GLboolean, GLboolean, GLboolean, GLboolean], None)
+
+# /usr/include/GL/gl.h:786
+glAlphaFunc = _link_function('glAlphaFunc', None, [GLenum, GLclampf], None)
+
+# /usr/include/GL/gl.h:788
+glBlendFunc = _link_function('glBlendFunc', None, [GLenum, GLenum], None)
+
+# /usr/include/GL/gl.h:790
+glLogicOp = _link_function('glLogicOp', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:792
+glCullFace = _link_function('glCullFace', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:794
+glFrontFace = _link_function('glFrontFace', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:796
+glPointSize = _link_function('glPointSize', None, [GLfloat], None)
+
+# /usr/include/GL/gl.h:798
+glLineWidth = _link_function('glLineWidth', None, [GLfloat], None)
+
+# /usr/include/GL/gl.h:800
+glLineStipple = _link_function('glLineStipple', None, [GLint, GLushort], None)
+
+# /usr/include/GL/gl.h:802
+glPolygonMode = _link_function('glPolygonMode', None, [GLenum, GLenum], None)
+
+# /usr/include/GL/gl.h:804
+glPolygonOffset = _link_function('glPolygonOffset', None, [GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:806
+glPolygonStipple = _link_function('glPolygonStipple', None, [POINTER(GLubyte)], None)
+
+# /usr/include/GL/gl.h:808
+glGetPolygonStipple = _link_function('glGetPolygonStipple', None, [POINTER(GLubyte)], None)
+
+# /usr/include/GL/gl.h:810
+glEdgeFlag = _link_function('glEdgeFlag', None, [GLboolean], None)
+
+# /usr/include/GL/gl.h:812
+glEdgeFlagv = _link_function('glEdgeFlagv', None, [POINTER(GLboolean)], None)
+
+# /usr/include/GL/gl.h:814
+glScissor = _link_function('glScissor', None, [GLint, GLint, GLsizei, GLsizei], None)
+
+# /usr/include/GL/gl.h:816
+glClipPlane = _link_function('glClipPlane', None, [GLenum, POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:818
+glGetClipPlane = _link_function('glGetClipPlane', None, [GLenum, POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:820
+glDrawBuffer = _link_function('glDrawBuffer', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:822
+glReadBuffer = _link_function('glReadBuffer', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:824
+glEnable = _link_function('glEnable', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:826
+glDisable = _link_function('glDisable', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:828
+glIsEnabled = _link_function('glIsEnabled', GLboolean, [GLenum], None)
+
+# /usr/include/GL/gl.h:831
+glEnableClientState = _link_function('glEnableClientState', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:833
+glDisableClientState = _link_function('glDisableClientState', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:836
+glGetBooleanv = _link_function('glGetBooleanv', None, [GLenum, POINTER(GLboolean)], None)
+
+# /usr/include/GL/gl.h:838
+glGetDoublev = _link_function('glGetDoublev', None, [GLenum, POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:840
+glGetFloatv = _link_function('glGetFloatv', None, [GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:842
+glGetIntegerv = _link_function('glGetIntegerv', None, [GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:845
+glPushAttrib = _link_function('glPushAttrib', None, [GLbitfield], None)
+
+# /usr/include/GL/gl.h:847
+glPopAttrib = _link_function('glPopAttrib', None, [], None)
+
+# /usr/include/GL/gl.h:850
+glPushClientAttrib = _link_function('glPushClientAttrib', None, [GLbitfield], None)
+
+# /usr/include/GL/gl.h:852
+glPopClientAttrib = _link_function('glPopClientAttrib', None, [], None)
+
+# /usr/include/GL/gl.h:855
+glRenderMode = _link_function('glRenderMode', GLint, [GLenum], None)
+
+# /usr/include/GL/gl.h:857
+glGetError = _link_function('glGetError', GLenum, [], None)
+
+# /usr/include/GL/gl.h:859
+glGetString = _link_function('glGetString', POINTER(GLubyte), [GLenum], None)
+
+# /usr/include/GL/gl.h:861
+glFinish = _link_function('glFinish', None, [], None)
+
+# /usr/include/GL/gl.h:863
+glFlush = _link_function('glFlush', None, [], None)
+
+# /usr/include/GL/gl.h:865
+glHint = _link_function('glHint', None, [GLenum, GLenum], None)
+
+# /usr/include/GL/gl.h:872
+glClearDepth = _link_function('glClearDepth', None, [GLclampd], None)
+
+# /usr/include/GL/gl.h:874
+glDepthFunc = _link_function('glDepthFunc', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:876
+glDepthMask = _link_function('glDepthMask', None, [GLboolean], None)
+
+# /usr/include/GL/gl.h:878
+glDepthRange = _link_function('glDepthRange', None, [GLclampd, GLclampd], None)
+
+# /usr/include/GL/gl.h:885
+glClearAccum = _link_function('glClearAccum', None, [GLfloat, GLfloat, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:887
+glAccum = _link_function('glAccum', None, [GLenum, GLfloat], None)
+
+# /usr/include/GL/gl.h:894
+glMatrixMode = _link_function('glMatrixMode', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:896
+glOrtho = _link_function('glOrtho', None, [GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:900
+glFrustum = _link_function('glFrustum', None, [GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:904
+glViewport = _link_function('glViewport', None, [GLint, GLint, GLsizei, GLsizei], None)
+
+# /usr/include/GL/gl.h:907
+glPushMatrix = _link_function('glPushMatrix', None, [], None)
+
+# /usr/include/GL/gl.h:909
+glPopMatrix = _link_function('glPopMatrix', None, [], None)
+
+# /usr/include/GL/gl.h:911
+glLoadIdentity = _link_function('glLoadIdentity', None, [], None)
+
+# /usr/include/GL/gl.h:913
+glLoadMatrixd = _link_function('glLoadMatrixd', None, [POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:914
+glLoadMatrixf = _link_function('glLoadMatrixf', None, [POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:916
+glMultMatrixd = _link_function('glMultMatrixd', None, [POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:917
+glMultMatrixf = _link_function('glMultMatrixf', None, [POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:919
+glRotated = _link_function('glRotated', None, [GLdouble, GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:921
+glRotatef = _link_function('glRotatef', None, [GLfloat, GLfloat, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:924
+glScaled = _link_function('glScaled', None, [GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:925
+glScalef = _link_function('glScalef', None, [GLfloat, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:927
+glTranslated = _link_function('glTranslated', None, [GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:928
+glTranslatef = _link_function('glTranslatef', None, [GLfloat, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:935
+glIsList = _link_function('glIsList', GLboolean, [GLuint], None)
+
+# /usr/include/GL/gl.h:937
+glDeleteLists = _link_function('glDeleteLists', None, [GLuint, GLsizei], None)
+
+# /usr/include/GL/gl.h:939
+glGenLists = _link_function('glGenLists', GLuint, [GLsizei], None)
+
+# /usr/include/GL/gl.h:941
+glNewList = _link_function('glNewList', None, [GLuint, GLenum], None)
+
+# /usr/include/GL/gl.h:943
+glEndList = _link_function('glEndList', None, [], None)
+
+# /usr/include/GL/gl.h:945
+glCallList = _link_function('glCallList', None, [GLuint], None)
+
+# /usr/include/GL/gl.h:947
+glCallLists = _link_function('glCallLists', None, [GLsizei, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:950
+glListBase = _link_function('glListBase', None, [GLuint], None)
+
+# /usr/include/GL/gl.h:957
+glBegin = _link_function('glBegin', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:959
+glEnd = _link_function('glEnd', None, [], None)
+
+# /usr/include/GL/gl.h:962
+glVertex2d = _link_function('glVertex2d', None, [GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:963
+glVertex2f = _link_function('glVertex2f', None, [GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:964
+glVertex2i = _link_function('glVertex2i', None, [GLint, GLint], None)
+
+# /usr/include/GL/gl.h:965
+glVertex2s = _link_function('glVertex2s', None, [GLshort, GLshort], None)
+
+# /usr/include/GL/gl.h:967
+glVertex3d = _link_function('glVertex3d', None, [GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:968
+glVertex3f = _link_function('glVertex3f', None, [GLfloat, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:969
+glVertex3i = _link_function('glVertex3i', None, [GLint, GLint, GLint], None)
+
+# /usr/include/GL/gl.h:970
+glVertex3s = _link_function('glVertex3s', None, [GLshort, GLshort, GLshort], None)
+
+# /usr/include/GL/gl.h:972
+glVertex4d = _link_function('glVertex4d', None, [GLdouble, GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:973
+glVertex4f = _link_function('glVertex4f', None, [GLfloat, GLfloat, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:974
+glVertex4i = _link_function('glVertex4i', None, [GLint, GLint, GLint, GLint], None)
+
+# /usr/include/GL/gl.h:975
+glVertex4s = _link_function('glVertex4s', None, [GLshort, GLshort, GLshort, GLshort], None)
+
+# /usr/include/GL/gl.h:977
+glVertex2dv = _link_function('glVertex2dv', None, [POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:978
+glVertex2fv = _link_function('glVertex2fv', None, [POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:979
+glVertex2iv = _link_function('glVertex2iv', None, [POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:980
+glVertex2sv = _link_function('glVertex2sv', None, [POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:982
+glVertex3dv = _link_function('glVertex3dv', None, [POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:983
+glVertex3fv = _link_function('glVertex3fv', None, [POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:984
+glVertex3iv = _link_function('glVertex3iv', None, [POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:985
+glVertex3sv = _link_function('glVertex3sv', None, [POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:987
+glVertex4dv = _link_function('glVertex4dv', None, [POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:988
+glVertex4fv = _link_function('glVertex4fv', None, [POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:989
+glVertex4iv = _link_function('glVertex4iv', None, [POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:990
+glVertex4sv = _link_function('glVertex4sv', None, [POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:993
+glNormal3b = _link_function('glNormal3b', None, [GLbyte, GLbyte, GLbyte], None)
+
+# /usr/include/GL/gl.h:994
+glNormal3d = _link_function('glNormal3d', None, [GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:995
+glNormal3f = _link_function('glNormal3f', None, [GLfloat, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:996
+glNormal3i = _link_function('glNormal3i', None, [GLint, GLint, GLint], None)
+
+# /usr/include/GL/gl.h:997
+glNormal3s = _link_function('glNormal3s', None, [GLshort, GLshort, GLshort], None)
+
+# /usr/include/GL/gl.h:999
+glNormal3bv = _link_function('glNormal3bv', None, [POINTER(GLbyte)], None)
+
+# /usr/include/GL/gl.h:1000
+glNormal3dv = _link_function('glNormal3dv', None, [POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1001
+glNormal3fv = _link_function('glNormal3fv', None, [POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1002
+glNormal3iv = _link_function('glNormal3iv', None, [POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1003
+glNormal3sv = _link_function('glNormal3sv', None, [POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:1006
+glIndexd = _link_function('glIndexd', None, [GLdouble], None)
+
+# /usr/include/GL/gl.h:1007
+glIndexf = _link_function('glIndexf', None, [GLfloat], None)
+
+# /usr/include/GL/gl.h:1008
+glIndexi = _link_function('glIndexi', None, [GLint], None)
+
+# /usr/include/GL/gl.h:1009
+glIndexs = _link_function('glIndexs', None, [GLshort], None)
+
+# /usr/include/GL/gl.h:1010
+glIndexub = _link_function('glIndexub', None, [GLubyte], None)
+
+# /usr/include/GL/gl.h:1012
+glIndexdv = _link_function('glIndexdv', None, [POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1013
+glIndexfv = _link_function('glIndexfv', None, [POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1014
+glIndexiv = _link_function('glIndexiv', None, [POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1015
+glIndexsv = _link_function('glIndexsv', None, [POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:1016
+glIndexubv = _link_function('glIndexubv', None, [POINTER(GLubyte)], None)
+
+# /usr/include/GL/gl.h:1018
+glColor3b = _link_function('glColor3b', None, [GLbyte, GLbyte, GLbyte], None)
+
+# /usr/include/GL/gl.h:1019
+glColor3d = _link_function('glColor3d', None, [GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:1020
+glColor3f = _link_function('glColor3f', None, [GLfloat, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:1021
+glColor3i = _link_function('glColor3i', None, [GLint, GLint, GLint], None)
+
+# /usr/include/GL/gl.h:1022
+glColor3s = _link_function('glColor3s', None, [GLshort, GLshort, GLshort], None)
+
+# /usr/include/GL/gl.h:1023
+glColor3ub = _link_function('glColor3ub', None, [GLubyte, GLubyte, GLubyte], None)
+
+# /usr/include/GL/gl.h:1024
+glColor3ui = _link_function('glColor3ui', None, [GLuint, GLuint, GLuint], None)
+
+# /usr/include/GL/gl.h:1025
+glColor3us = _link_function('glColor3us', None, [GLushort, GLushort, GLushort], None)
+
+# /usr/include/GL/gl.h:1027
+glColor4b = _link_function('glColor4b', None, [GLbyte, GLbyte, GLbyte, GLbyte], None)
+
+# /usr/include/GL/gl.h:1029
+glColor4d = _link_function('glColor4d', None, [GLdouble, GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:1031
+glColor4f = _link_function('glColor4f', None, [GLfloat, GLfloat, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:1033
+glColor4i = _link_function('glColor4i', None, [GLint, GLint, GLint, GLint], None)
+
+# /usr/include/GL/gl.h:1035
+glColor4s = _link_function('glColor4s', None, [GLshort, GLshort, GLshort, GLshort], None)
+
+# /usr/include/GL/gl.h:1037
+glColor4ub = _link_function('glColor4ub', None, [GLubyte, GLubyte, GLubyte, GLubyte], None)
+
+# /usr/include/GL/gl.h:1039
+glColor4ui = _link_function('glColor4ui', None, [GLuint, GLuint, GLuint, GLuint], None)
+
+# /usr/include/GL/gl.h:1041
+glColor4us = _link_function('glColor4us', None, [GLushort, GLushort, GLushort, GLushort], None)
+
+# /usr/include/GL/gl.h:1045
+glColor3bv = _link_function('glColor3bv', None, [POINTER(GLbyte)], None)
+
+# /usr/include/GL/gl.h:1046
+glColor3dv = _link_function('glColor3dv', None, [POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1047
+glColor3fv = _link_function('glColor3fv', None, [POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1048
+glColor3iv = _link_function('glColor3iv', None, [POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1049
+glColor3sv = _link_function('glColor3sv', None, [POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:1050
+glColor3ubv = _link_function('glColor3ubv', None, [POINTER(GLubyte)], None)
+
+# /usr/include/GL/gl.h:1051
+glColor3uiv = _link_function('glColor3uiv', None, [POINTER(GLuint)], None)
+
+# /usr/include/GL/gl.h:1052
+glColor3usv = _link_function('glColor3usv', None, [POINTER(GLushort)], None)
+
+# /usr/include/GL/gl.h:1054
+glColor4bv = _link_function('glColor4bv', None, [POINTER(GLbyte)], None)
+
+# /usr/include/GL/gl.h:1055
+glColor4dv = _link_function('glColor4dv', None, [POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1056
+glColor4fv = _link_function('glColor4fv', None, [POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1057
+glColor4iv = _link_function('glColor4iv', None, [POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1058
+glColor4sv = _link_function('glColor4sv', None, [POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:1059
+glColor4ubv = _link_function('glColor4ubv', None, [POINTER(GLubyte)], None)
+
+# /usr/include/GL/gl.h:1060
+glColor4uiv = _link_function('glColor4uiv', None, [POINTER(GLuint)], None)
+
+# /usr/include/GL/gl.h:1061
+glColor4usv = _link_function('glColor4usv', None, [POINTER(GLushort)], None)
+
+# /usr/include/GL/gl.h:1064
+glTexCoord1d = _link_function('glTexCoord1d', None, [GLdouble], None)
+
+# /usr/include/GL/gl.h:1065
+glTexCoord1f = _link_function('glTexCoord1f', None, [GLfloat], None)
+
+# /usr/include/GL/gl.h:1066
+glTexCoord1i = _link_function('glTexCoord1i', None, [GLint], None)
+
+# /usr/include/GL/gl.h:1067
+glTexCoord1s = _link_function('glTexCoord1s', None, [GLshort], None)
+
+# /usr/include/GL/gl.h:1069
+glTexCoord2d = _link_function('glTexCoord2d', None, [GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:1070
+glTexCoord2f = _link_function('glTexCoord2f', None, [GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:1071
+glTexCoord2i = _link_function('glTexCoord2i', None, [GLint, GLint], None)
+
+# /usr/include/GL/gl.h:1072
+glTexCoord2s = _link_function('glTexCoord2s', None, [GLshort, GLshort], None)
+
+# /usr/include/GL/gl.h:1074
+glTexCoord3d = _link_function('glTexCoord3d', None, [GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:1075
+glTexCoord3f = _link_function('glTexCoord3f', None, [GLfloat, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:1076
+glTexCoord3i = _link_function('glTexCoord3i', None, [GLint, GLint, GLint], None)
+
+# /usr/include/GL/gl.h:1077
+glTexCoord3s = _link_function('glTexCoord3s', None, [GLshort, GLshort, GLshort], None)
+
+# /usr/include/GL/gl.h:1079
+glTexCoord4d = _link_function('glTexCoord4d', None, [GLdouble, GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:1080
+glTexCoord4f = _link_function('glTexCoord4f', None, [GLfloat, GLfloat, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:1081
+glTexCoord4i = _link_function('glTexCoord4i', None, [GLint, GLint, GLint, GLint], None)
+
+# /usr/include/GL/gl.h:1082
+glTexCoord4s = _link_function('glTexCoord4s', None, [GLshort, GLshort, GLshort, GLshort], None)
+
+# /usr/include/GL/gl.h:1084
+glTexCoord1dv = _link_function('glTexCoord1dv', None, [POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1085
+glTexCoord1fv = _link_function('glTexCoord1fv', None, [POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1086
+glTexCoord1iv = _link_function('glTexCoord1iv', None, [POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1087
+glTexCoord1sv = _link_function('glTexCoord1sv', None, [POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:1089
+glTexCoord2dv = _link_function('glTexCoord2dv', None, [POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1090
+glTexCoord2fv = _link_function('glTexCoord2fv', None, [POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1091
+glTexCoord2iv = _link_function('glTexCoord2iv', None, [POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1092
+glTexCoord2sv = _link_function('glTexCoord2sv', None, [POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:1094
+glTexCoord3dv = _link_function('glTexCoord3dv', None, [POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1095
+glTexCoord3fv = _link_function('glTexCoord3fv', None, [POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1096
+glTexCoord3iv = _link_function('glTexCoord3iv', None, [POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1097
+glTexCoord3sv = _link_function('glTexCoord3sv', None, [POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:1099
+glTexCoord4dv = _link_function('glTexCoord4dv', None, [POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1100
+glTexCoord4fv = _link_function('glTexCoord4fv', None, [POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1101
+glTexCoord4iv = _link_function('glTexCoord4iv', None, [POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1102
+glTexCoord4sv = _link_function('glTexCoord4sv', None, [POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:1105
+glRasterPos2d = _link_function('glRasterPos2d', None, [GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:1106
+glRasterPos2f = _link_function('glRasterPos2f', None, [GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:1107
+glRasterPos2i = _link_function('glRasterPos2i', None, [GLint, GLint], None)
+
+# /usr/include/GL/gl.h:1108
+glRasterPos2s = _link_function('glRasterPos2s', None, [GLshort, GLshort], None)
+
+# /usr/include/GL/gl.h:1110
+glRasterPos3d = _link_function('glRasterPos3d', None, [GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:1111
+glRasterPos3f = _link_function('glRasterPos3f', None, [GLfloat, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:1112
+glRasterPos3i = _link_function('glRasterPos3i', None, [GLint, GLint, GLint], None)
+
+# /usr/include/GL/gl.h:1113
+glRasterPos3s = _link_function('glRasterPos3s', None, [GLshort, GLshort, GLshort], None)
+
+# /usr/include/GL/gl.h:1115
+glRasterPos4d = _link_function('glRasterPos4d', None, [GLdouble, GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:1116
+glRasterPos4f = _link_function('glRasterPos4f', None, [GLfloat, GLfloat, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:1117
+glRasterPos4i = _link_function('glRasterPos4i', None, [GLint, GLint, GLint, GLint], None)
+
+# /usr/include/GL/gl.h:1118
+glRasterPos4s = _link_function('glRasterPos4s', None, [GLshort, GLshort, GLshort, GLshort], None)
+
+# /usr/include/GL/gl.h:1120
+glRasterPos2dv = _link_function('glRasterPos2dv', None, [POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1121
+glRasterPos2fv = _link_function('glRasterPos2fv', None, [POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1122
+glRasterPos2iv = _link_function('glRasterPos2iv', None, [POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1123
+glRasterPos2sv = _link_function('glRasterPos2sv', None, [POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:1125
+glRasterPos3dv = _link_function('glRasterPos3dv', None, [POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1126
+glRasterPos3fv = _link_function('glRasterPos3fv', None, [POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1127
+glRasterPos3iv = _link_function('glRasterPos3iv', None, [POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1128
+glRasterPos3sv = _link_function('glRasterPos3sv', None, [POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:1130
+glRasterPos4dv = _link_function('glRasterPos4dv', None, [POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1131
+glRasterPos4fv = _link_function('glRasterPos4fv', None, [POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1132
+glRasterPos4iv = _link_function('glRasterPos4iv', None, [POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1133
+glRasterPos4sv = _link_function('glRasterPos4sv', None, [POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:1136
+glRectd = _link_function('glRectd', None, [GLdouble, GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:1137
+glRectf = _link_function('glRectf', None, [GLfloat, GLfloat, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:1138
+glRecti = _link_function('glRecti', None, [GLint, GLint, GLint, GLint], None)
+
+# /usr/include/GL/gl.h:1139
+glRects = _link_function('glRects', None, [GLshort, GLshort, GLshort, GLshort], None)
+
+# /usr/include/GL/gl.h:1142
+glRectdv = _link_function('glRectdv', None, [POINTER(GLdouble), POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1143
+glRectfv = _link_function('glRectfv', None, [POINTER(GLfloat), POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1144
+glRectiv = _link_function('glRectiv', None, [POINTER(GLint), POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1145
+glRectsv = _link_function('glRectsv', None, [POINTER(GLshort), POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:1152
+glVertexPointer = _link_function('glVertexPointer', None, [GLint, GLenum, GLsizei, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1155
+glNormalPointer = _link_function('glNormalPointer', None, [GLenum, GLsizei, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1158
+glColorPointer = _link_function('glColorPointer', None, [GLint, GLenum, GLsizei, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1161
+glIndexPointer = _link_function('glIndexPointer', None, [GLenum, GLsizei, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1164
+glTexCoordPointer = _link_function('glTexCoordPointer', None, [GLint, GLenum, GLsizei, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1167
+glEdgeFlagPointer = _link_function('glEdgeFlagPointer', None, [GLsizei, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1169
+glGetPointerv = _link_function('glGetPointerv', None, [GLenum, POINTER(POINTER(GLvoid))], None)
+
+# /usr/include/GL/gl.h:1171
+glArrayElement = _link_function('glArrayElement', None, [GLint], None)
+
+# /usr/include/GL/gl.h:1173
+glDrawArrays = _link_function('glDrawArrays', None, [GLenum, GLint, GLsizei], None)
+
+# /usr/include/GL/gl.h:1175
+glDrawElements = _link_function('glDrawElements', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1178
+glInterleavedArrays = _link_function('glInterleavedArrays', None, [GLenum, GLsizei, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1185
+glShadeModel = _link_function('glShadeModel', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:1187
+glLightf = _link_function('glLightf', None, [GLenum, GLenum, GLfloat], None)
+
+# /usr/include/GL/gl.h:1188
+glLighti = _link_function('glLighti', None, [GLenum, GLenum, GLint], None)
+
+# /usr/include/GL/gl.h:1189
+glLightfv = _link_function('glLightfv', None, [GLenum, GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1191
+glLightiv = _link_function('glLightiv', None, [GLenum, GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1194
+glGetLightfv = _link_function('glGetLightfv', None, [GLenum, GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1196
+glGetLightiv = _link_function('glGetLightiv', None, [GLenum, GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1199
+glLightModelf = _link_function('glLightModelf', None, [GLenum, GLfloat], None)
+
+# /usr/include/GL/gl.h:1200
+glLightModeli = _link_function('glLightModeli', None, [GLenum, GLint], None)
+
+# /usr/include/GL/gl.h:1201
+glLightModelfv = _link_function('glLightModelfv', None, [GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1202
+glLightModeliv = _link_function('glLightModeliv', None, [GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1204
+glMaterialf = _link_function('glMaterialf', None, [GLenum, GLenum, GLfloat], None)
+
+# /usr/include/GL/gl.h:1205
+glMateriali = _link_function('glMateriali', None, [GLenum, GLenum, GLint], None)
+
+# /usr/include/GL/gl.h:1206
+glMaterialfv = _link_function('glMaterialfv', None, [GLenum, GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1207
+glMaterialiv = _link_function('glMaterialiv', None, [GLenum, GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1209
+glGetMaterialfv = _link_function('glGetMaterialfv', None, [GLenum, GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1210
+glGetMaterialiv = _link_function('glGetMaterialiv', None, [GLenum, GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1212
+glColorMaterial = _link_function('glColorMaterial', None, [GLenum, GLenum], None)
+
+# /usr/include/GL/gl.h:1219
+glPixelZoom = _link_function('glPixelZoom', None, [GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:1221
+glPixelStoref = _link_function('glPixelStoref', None, [GLenum, GLfloat], None)
+
+# /usr/include/GL/gl.h:1222
+glPixelStorei = _link_function('glPixelStorei', None, [GLenum, GLint], None)
+
+# /usr/include/GL/gl.h:1224
+glPixelTransferf = _link_function('glPixelTransferf', None, [GLenum, GLfloat], None)
+
+# /usr/include/GL/gl.h:1225
+glPixelTransferi = _link_function('glPixelTransferi', None, [GLenum, GLint], None)
+
+# /usr/include/GL/gl.h:1227
+glPixelMapfv = _link_function('glPixelMapfv', None, [GLenum, GLsizei, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1229
+glPixelMapuiv = _link_function('glPixelMapuiv', None, [GLenum, GLsizei, POINTER(GLuint)], None)
+
+# /usr/include/GL/gl.h:1231
+glPixelMapusv = _link_function('glPixelMapusv', None, [GLenum, GLsizei, POINTER(GLushort)], None)
+
+# /usr/include/GL/gl.h:1234
+glGetPixelMapfv = _link_function('glGetPixelMapfv', None, [GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1235
+glGetPixelMapuiv = _link_function('glGetPixelMapuiv', None, [GLenum, POINTER(GLuint)], None)
+
+# /usr/include/GL/gl.h:1236
+glGetPixelMapusv = _link_function('glGetPixelMapusv', None, [GLenum, POINTER(GLushort)], None)
+
+# /usr/include/GL/gl.h:1238
+glBitmap = _link_function('glBitmap', None, [GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat, POINTER(GLubyte)], None)
+
+# /usr/include/GL/gl.h:1243
+glReadPixels = _link_function('glReadPixels', None, [GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1248
+glDrawPixels = _link_function('glDrawPixels', None, [GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1252
+glCopyPixels = _link_function('glCopyPixels', None, [GLint, GLint, GLsizei, GLsizei, GLenum], None)
+
+# /usr/include/GL/gl.h:1260
+glStencilFunc = _link_function('glStencilFunc', None, [GLenum, GLint, GLuint], None)
+
+# /usr/include/GL/gl.h:1262
+glStencilMask = _link_function('glStencilMask', None, [GLuint], None)
+
+# /usr/include/GL/gl.h:1264
+glStencilOp = _link_function('glStencilOp', None, [GLenum, GLenum, GLenum], None)
+
+# /usr/include/GL/gl.h:1266
+glClearStencil = _link_function('glClearStencil', None, [GLint], None)
+
+# /usr/include/GL/gl.h:1274
+glTexGend = _link_function('glTexGend', None, [GLenum, GLenum, GLdouble], None)
+
+# /usr/include/GL/gl.h:1275
+glTexGenf = _link_function('glTexGenf', None, [GLenum, GLenum, GLfloat], None)
+
+# /usr/include/GL/gl.h:1276
+glTexGeni = _link_function('glTexGeni', None, [GLenum, GLenum, GLint], None)
+
+# /usr/include/GL/gl.h:1278
+glTexGendv = _link_function('glTexGendv', None, [GLenum, GLenum, POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1279
+glTexGenfv = _link_function('glTexGenfv', None, [GLenum, GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1280
+glTexGeniv = _link_function('glTexGeniv', None, [GLenum, GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1282
+glGetTexGendv = _link_function('glGetTexGendv', None, [GLenum, GLenum, POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1283
+glGetTexGenfv = _link_function('glGetTexGenfv', None, [GLenum, GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1284
+glGetTexGeniv = _link_function('glGetTexGeniv', None, [GLenum, GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1287
+glTexEnvf = _link_function('glTexEnvf', None, [GLenum, GLenum, GLfloat], None)
+
+# /usr/include/GL/gl.h:1288
+glTexEnvi = _link_function('glTexEnvi', None, [GLenum, GLenum, GLint], None)
+
+# /usr/include/GL/gl.h:1290
+glTexEnvfv = _link_function('glTexEnvfv', None, [GLenum, GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1291
+glTexEnviv = _link_function('glTexEnviv', None, [GLenum, GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1293
+glGetTexEnvfv = _link_function('glGetTexEnvfv', None, [GLenum, GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1294
+glGetTexEnviv = _link_function('glGetTexEnviv', None, [GLenum, GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1297
+glTexParameterf = _link_function('glTexParameterf', None, [GLenum, GLenum, GLfloat], None)
+
+# /usr/include/GL/gl.h:1298
+glTexParameteri = _link_function('glTexParameteri', None, [GLenum, GLenum, GLint], None)
+
+# /usr/include/GL/gl.h:1300
+glTexParameterfv = _link_function('glTexParameterfv', None, [GLenum, GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1302
+glTexParameteriv = _link_function('glTexParameteriv', None, [GLenum, GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1305
+glGetTexParameterfv = _link_function('glGetTexParameterfv', None, [GLenum, GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1307
+glGetTexParameteriv = _link_function('glGetTexParameteriv', None, [GLenum, GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1310
+glGetTexLevelParameterfv = _link_function('glGetTexLevelParameterfv', None, [GLenum, GLint, GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1312
+glGetTexLevelParameteriv = _link_function('glGetTexLevelParameteriv', None, [GLenum, GLint, GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1316
+glTexImage1D = _link_function('glTexImage1D', None, [GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1322
+glTexImage2D = _link_function('glTexImage2D', None, [GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1328
+glGetTexImage = _link_function('glGetTexImage', None, [GLenum, GLint, GLenum, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1335
+glGenTextures = _link_function('glGenTextures', None, [GLsizei, POINTER(GLuint)], None)
+
+# /usr/include/GL/gl.h:1337
+glDeleteTextures = _link_function('glDeleteTextures', None, [GLsizei, POINTER(GLuint)], None)
+
+# /usr/include/GL/gl.h:1339
+glBindTexture = _link_function('glBindTexture', None, [GLenum, GLuint], None)
+
+# /usr/include/GL/gl.h:1341
+glPrioritizeTextures = _link_function('glPrioritizeTextures', None, [GLsizei, POINTER(GLuint), POINTER(GLclampf)], None)
+
+# /usr/include/GL/gl.h:1345
+glAreTexturesResident = _link_function('glAreTexturesResident', GLboolean, [GLsizei, POINTER(GLuint), POINTER(GLboolean)], None)
+
+# /usr/include/GL/gl.h:1349
+glIsTexture = _link_function('glIsTexture', GLboolean, [GLuint], None)
+
+# /usr/include/GL/gl.h:1352
+glTexSubImage1D = _link_function('glTexSubImage1D', None, [GLenum, GLint, GLint, GLsizei, GLenum, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1358
+glTexSubImage2D = _link_function('glTexSubImage2D', None, [GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1365
+glCopyTexImage1D = _link_function('glCopyTexImage1D', None, [GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint], None)
+
+# /usr/include/GL/gl.h:1371
+glCopyTexImage2D = _link_function('glCopyTexImage2D', None, [GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint], None)
+
+# /usr/include/GL/gl.h:1378
+glCopyTexSubImage1D = _link_function('glCopyTexSubImage1D', None, [GLenum, GLint, GLint, GLint, GLint, GLsizei], None)
+
+# /usr/include/GL/gl.h:1383
+glCopyTexSubImage2D = _link_function('glCopyTexSubImage2D', None, [GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], None)
+
+# /usr/include/GL/gl.h:1393
+glMap1d = _link_function('glMap1d', None, [GLenum, GLdouble, GLdouble, GLint, GLint, POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1396
+glMap1f = _link_function('glMap1f', None, [GLenum, GLfloat, GLfloat, GLint, GLint, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1400
+glMap2d = _link_function('glMap2d', None, [GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1404
+glMap2f = _link_function('glMap2f', None, [GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1409
+glGetMapdv = _link_function('glGetMapdv', None, [GLenum, GLenum, POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1410
+glGetMapfv = _link_function('glGetMapfv', None, [GLenum, GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1411
+glGetMapiv = _link_function('glGetMapiv', None, [GLenum, GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1413
+glEvalCoord1d = _link_function('glEvalCoord1d', None, [GLdouble], None)
+
+# /usr/include/GL/gl.h:1414
+glEvalCoord1f = _link_function('glEvalCoord1f', None, [GLfloat], None)
+
+# /usr/include/GL/gl.h:1416
+glEvalCoord1dv = _link_function('glEvalCoord1dv', None, [POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1417
+glEvalCoord1fv = _link_function('glEvalCoord1fv', None, [POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1419
+glEvalCoord2d = _link_function('glEvalCoord2d', None, [GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:1420
+glEvalCoord2f = _link_function('glEvalCoord2f', None, [GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:1422
+glEvalCoord2dv = _link_function('glEvalCoord2dv', None, [POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1423
+glEvalCoord2fv = _link_function('glEvalCoord2fv', None, [POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1425
+glMapGrid1d = _link_function('glMapGrid1d', None, [GLint, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:1426
+glMapGrid1f = _link_function('glMapGrid1f', None, [GLint, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:1428
+glMapGrid2d = _link_function('glMapGrid2d', None, [GLint, GLdouble, GLdouble, GLint, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:1430
+glMapGrid2f = _link_function('glMapGrid2f', None, [GLint, GLfloat, GLfloat, GLint, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:1433
+glEvalPoint1 = _link_function('glEvalPoint1', None, [GLint], None)
+
+# /usr/include/GL/gl.h:1435
+glEvalPoint2 = _link_function('glEvalPoint2', None, [GLint, GLint], None)
+
+# /usr/include/GL/gl.h:1437
+glEvalMesh1 = _link_function('glEvalMesh1', None, [GLenum, GLint, GLint], None)
+
+# /usr/include/GL/gl.h:1439
+glEvalMesh2 = _link_function('glEvalMesh2', None, [GLenum, GLint, GLint, GLint, GLint], None)
+
+# /usr/include/GL/gl.h:1446
+glFogf = _link_function('glFogf', None, [GLenum, GLfloat], None)
+
+# /usr/include/GL/gl.h:1448
+glFogi = _link_function('glFogi', None, [GLenum, GLint], None)
+
+# /usr/include/GL/gl.h:1450
+glFogfv = _link_function('glFogfv', None, [GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1452
+glFogiv = _link_function('glFogiv', None, [GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1459
+glFeedbackBuffer = _link_function('glFeedbackBuffer', None, [GLsizei, GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1461
+glPassThrough = _link_function('glPassThrough', None, [GLfloat], None)
+
+# /usr/include/GL/gl.h:1463
+glSelectBuffer = _link_function('glSelectBuffer', None, [GLsizei, POINTER(GLuint)], None)
+
+# /usr/include/GL/gl.h:1465
+glInitNames = _link_function('glInitNames', None, [], None)
+
+# /usr/include/GL/gl.h:1467
+glLoadName = _link_function('glLoadName', None, [GLuint], None)
+
+# /usr/include/GL/gl.h:1469
+glPushName = _link_function('glPushName', None, [GLuint], None)
+
+# /usr/include/GL/gl.h:1471
+glPopName = _link_function('glPopName', None, [], None)
+
+GL_RESCALE_NORMAL = 32826 # /usr/include/GL/gl.h:1479
+GL_CLAMP_TO_EDGE = 33071 # /usr/include/GL/gl.h:1480
+GL_MAX_ELEMENTS_VERTICES = 33000 # /usr/include/GL/gl.h:1481
+GL_MAX_ELEMENTS_INDICES = 33001 # /usr/include/GL/gl.h:1482
+GL_BGR = 32992 # /usr/include/GL/gl.h:1483
+GL_BGRA = 32993 # /usr/include/GL/gl.h:1484
+GL_UNSIGNED_BYTE_3_3_2 = 32818 # /usr/include/GL/gl.h:1485
+GL_UNSIGNED_BYTE_2_3_3_REV = 33634 # /usr/include/GL/gl.h:1486
+GL_UNSIGNED_SHORT_5_6_5 = 33635 # /usr/include/GL/gl.h:1487
+GL_UNSIGNED_SHORT_5_6_5_REV = 33636 # /usr/include/GL/gl.h:1488
+GL_UNSIGNED_SHORT_4_4_4_4 = 32819 # /usr/include/GL/gl.h:1489
+GL_UNSIGNED_SHORT_4_4_4_4_REV = 33637 # /usr/include/GL/gl.h:1490
+GL_UNSIGNED_SHORT_5_5_5_1 = 32820 # /usr/include/GL/gl.h:1491
+GL_UNSIGNED_SHORT_1_5_5_5_REV = 33638 # /usr/include/GL/gl.h:1492
+GL_UNSIGNED_INT_8_8_8_8 = 32821 # /usr/include/GL/gl.h:1493
+GL_UNSIGNED_INT_8_8_8_8_REV = 33639 # /usr/include/GL/gl.h:1494
+GL_UNSIGNED_INT_10_10_10_2 = 32822 # /usr/include/GL/gl.h:1495
+GL_UNSIGNED_INT_2_10_10_10_REV = 33640 # /usr/include/GL/gl.h:1496
+GL_LIGHT_MODEL_COLOR_CONTROL = 33272 # /usr/include/GL/gl.h:1497
+GL_SINGLE_COLOR = 33273 # /usr/include/GL/gl.h:1498
+GL_SEPARATE_SPECULAR_COLOR = 33274 # /usr/include/GL/gl.h:1499
+GL_TEXTURE_MIN_LOD = 33082 # /usr/include/GL/gl.h:1500
+GL_TEXTURE_MAX_LOD = 33083 # /usr/include/GL/gl.h:1501
+GL_TEXTURE_BASE_LEVEL = 33084 # /usr/include/GL/gl.h:1502
+GL_TEXTURE_MAX_LEVEL = 33085 # /usr/include/GL/gl.h:1503
+GL_SMOOTH_POINT_SIZE_RANGE = 2834 # /usr/include/GL/gl.h:1504
+GL_SMOOTH_POINT_SIZE_GRANULARITY = 2835 # /usr/include/GL/gl.h:1505
+GL_SMOOTH_LINE_WIDTH_RANGE = 2850 # /usr/include/GL/gl.h:1506
+GL_SMOOTH_LINE_WIDTH_GRANULARITY = 2851 # /usr/include/GL/gl.h:1507
+GL_ALIASED_POINT_SIZE_RANGE = 33901 # /usr/include/GL/gl.h:1508
+GL_ALIASED_LINE_WIDTH_RANGE = 33902 # /usr/include/GL/gl.h:1509
+GL_PACK_SKIP_IMAGES = 32875 # /usr/include/GL/gl.h:1510
+GL_PACK_IMAGE_HEIGHT = 32876 # /usr/include/GL/gl.h:1511
+GL_UNPACK_SKIP_IMAGES = 32877 # /usr/include/GL/gl.h:1512
+GL_UNPACK_IMAGE_HEIGHT = 32878 # /usr/include/GL/gl.h:1513
+GL_TEXTURE_3D = 32879 # /usr/include/GL/gl.h:1514
+GL_PROXY_TEXTURE_3D = 32880 # /usr/include/GL/gl.h:1515
+GL_TEXTURE_DEPTH = 32881 # /usr/include/GL/gl.h:1516
+GL_TEXTURE_WRAP_R = 32882 # /usr/include/GL/gl.h:1517
+GL_MAX_3D_TEXTURE_SIZE = 32883 # /usr/include/GL/gl.h:1518
+GL_TEXTURE_BINDING_3D = 32874 # /usr/include/GL/gl.h:1519
+# /usr/include/GL/gl.h:1521
+glDrawRangeElements = _link_function('glDrawRangeElements', None, [GLenum, GLuint, GLuint, GLsizei, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1524
+glTexImage3D = _link_function('glTexImage3D', None, [GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1531
+glTexSubImage3D = _link_function('glTexSubImage3D', None, [GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1538
+glCopyTexSubImage3D = _link_function('glCopyTexSubImage3D', None, [GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], None)
+
+PFNGLDRAWRANGEELEMENTSPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLsizei, GLenum, POINTER(GLvoid)) # /usr/include/GL/gl.h:1544
+PFNGLTEXIMAGE3DPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)) # /usr/include/GL/gl.h:1545
+PFNGLTEXSUBIMAGE3DPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # /usr/include/GL/gl.h:1546
+PFNGLCOPYTEXSUBIMAGE3DPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) # /usr/include/GL/gl.h:1547
+GL_CONSTANT_COLOR = 32769 # /usr/include/GL/gl.h:1554
+GL_ONE_MINUS_CONSTANT_COLOR = 32770 # /usr/include/GL/gl.h:1555
+GL_CONSTANT_ALPHA = 32771 # /usr/include/GL/gl.h:1556
+GL_ONE_MINUS_CONSTANT_ALPHA = 32772 # /usr/include/GL/gl.h:1557
+GL_COLOR_TABLE = 32976 # /usr/include/GL/gl.h:1558
+GL_POST_CONVOLUTION_COLOR_TABLE = 32977 # /usr/include/GL/gl.h:1559
+GL_POST_COLOR_MATRIX_COLOR_TABLE = 32978 # /usr/include/GL/gl.h:1560
+GL_PROXY_COLOR_TABLE = 32979 # /usr/include/GL/gl.h:1561
+GL_PROXY_POST_CONVOLUTION_COLOR_TABLE = 32980 # /usr/include/GL/gl.h:1562
+GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE = 32981 # /usr/include/GL/gl.h:1563
+GL_COLOR_TABLE_SCALE = 32982 # /usr/include/GL/gl.h:1564
+GL_COLOR_TABLE_BIAS = 32983 # /usr/include/GL/gl.h:1565
+GL_COLOR_TABLE_FORMAT = 32984 # /usr/include/GL/gl.h:1566
+GL_COLOR_TABLE_WIDTH = 32985 # /usr/include/GL/gl.h:1567
+GL_COLOR_TABLE_RED_SIZE = 32986 # /usr/include/GL/gl.h:1568
+GL_COLOR_TABLE_GREEN_SIZE = 32987 # /usr/include/GL/gl.h:1569
+GL_COLOR_TABLE_BLUE_SIZE = 32988 # /usr/include/GL/gl.h:1570
+GL_COLOR_TABLE_ALPHA_SIZE = 32989 # /usr/include/GL/gl.h:1571
+GL_COLOR_TABLE_LUMINANCE_SIZE = 32990 # /usr/include/GL/gl.h:1572
+GL_COLOR_TABLE_INTENSITY_SIZE = 32991 # /usr/include/GL/gl.h:1573
+GL_CONVOLUTION_1D = 32784 # /usr/include/GL/gl.h:1574
+GL_CONVOLUTION_2D = 32785 # /usr/include/GL/gl.h:1575
+GL_SEPARABLE_2D = 32786 # /usr/include/GL/gl.h:1576
+GL_CONVOLUTION_BORDER_MODE = 32787 # /usr/include/GL/gl.h:1577
+GL_CONVOLUTION_FILTER_SCALE = 32788 # /usr/include/GL/gl.h:1578
+GL_CONVOLUTION_FILTER_BIAS = 32789 # /usr/include/GL/gl.h:1579
+GL_REDUCE = 32790 # /usr/include/GL/gl.h:1580
+GL_CONVOLUTION_FORMAT = 32791 # /usr/include/GL/gl.h:1581
+GL_CONVOLUTION_WIDTH = 32792 # /usr/include/GL/gl.h:1582
+GL_CONVOLUTION_HEIGHT = 32793 # /usr/include/GL/gl.h:1583
+GL_MAX_CONVOLUTION_WIDTH = 32794 # /usr/include/GL/gl.h:1584
+GL_MAX_CONVOLUTION_HEIGHT = 32795 # /usr/include/GL/gl.h:1585
+GL_POST_CONVOLUTION_RED_SCALE = 32796 # /usr/include/GL/gl.h:1586
+GL_POST_CONVOLUTION_GREEN_SCALE = 32797 # /usr/include/GL/gl.h:1587
+GL_POST_CONVOLUTION_BLUE_SCALE = 32798 # /usr/include/GL/gl.h:1588
+GL_POST_CONVOLUTION_ALPHA_SCALE = 32799 # /usr/include/GL/gl.h:1589
+GL_POST_CONVOLUTION_RED_BIAS = 32800 # /usr/include/GL/gl.h:1590
+GL_POST_CONVOLUTION_GREEN_BIAS = 32801 # /usr/include/GL/gl.h:1591
+GL_POST_CONVOLUTION_BLUE_BIAS = 32802 # /usr/include/GL/gl.h:1592
+GL_POST_CONVOLUTION_ALPHA_BIAS = 32803 # /usr/include/GL/gl.h:1593
+GL_CONSTANT_BORDER = 33105 # /usr/include/GL/gl.h:1594
+GL_REPLICATE_BORDER = 33107 # /usr/include/GL/gl.h:1595
+GL_CONVOLUTION_BORDER_COLOR = 33108 # /usr/include/GL/gl.h:1596
+GL_COLOR_MATRIX = 32945 # /usr/include/GL/gl.h:1597
+GL_COLOR_MATRIX_STACK_DEPTH = 32946 # /usr/include/GL/gl.h:1598
+GL_MAX_COLOR_MATRIX_STACK_DEPTH = 32947 # /usr/include/GL/gl.h:1599
+GL_POST_COLOR_MATRIX_RED_SCALE = 32948 # /usr/include/GL/gl.h:1600
+GL_POST_COLOR_MATRIX_GREEN_SCALE = 32949 # /usr/include/GL/gl.h:1601
+GL_POST_COLOR_MATRIX_BLUE_SCALE = 32950 # /usr/include/GL/gl.h:1602
+GL_POST_COLOR_MATRIX_ALPHA_SCALE = 32951 # /usr/include/GL/gl.h:1603
+GL_POST_COLOR_MATRIX_RED_BIAS = 32952 # /usr/include/GL/gl.h:1604
+GL_POST_COLOR_MATRIX_GREEN_BIAS = 32953 # /usr/include/GL/gl.h:1605
+GL_POST_COLOR_MATRIX_BLUE_BIAS = 32954 # /usr/include/GL/gl.h:1606
+GL_POST_COLOR_MATRIX_ALPHA_BIAS = 32955 # /usr/include/GL/gl.h:1607
+GL_HISTOGRAM = 32804 # /usr/include/GL/gl.h:1608
+GL_PROXY_HISTOGRAM = 32805 # /usr/include/GL/gl.h:1609
+GL_HISTOGRAM_WIDTH = 32806 # /usr/include/GL/gl.h:1610
+GL_HISTOGRAM_FORMAT = 32807 # /usr/include/GL/gl.h:1611
+GL_HISTOGRAM_RED_SIZE = 32808 # /usr/include/GL/gl.h:1612
+GL_HISTOGRAM_GREEN_SIZE = 32809 # /usr/include/GL/gl.h:1613
+GL_HISTOGRAM_BLUE_SIZE = 32810 # /usr/include/GL/gl.h:1614
+GL_HISTOGRAM_ALPHA_SIZE = 32811 # /usr/include/GL/gl.h:1615
+GL_HISTOGRAM_LUMINANCE_SIZE = 32812 # /usr/include/GL/gl.h:1616
+GL_HISTOGRAM_SINK = 32813 # /usr/include/GL/gl.h:1617
+GL_MINMAX = 32814 # /usr/include/GL/gl.h:1618
+GL_MINMAX_FORMAT = 32815 # /usr/include/GL/gl.h:1619
+GL_MINMAX_SINK = 32816 # /usr/include/GL/gl.h:1620
+GL_TABLE_TOO_LARGE = 32817 # /usr/include/GL/gl.h:1621
+GL_BLEND_EQUATION = 32777 # /usr/include/GL/gl.h:1622
+GL_MIN = 32775 # /usr/include/GL/gl.h:1623
+GL_MAX = 32776 # /usr/include/GL/gl.h:1624
+GL_FUNC_ADD = 32774 # /usr/include/GL/gl.h:1625
+GL_FUNC_SUBTRACT = 32778 # /usr/include/GL/gl.h:1626
+GL_FUNC_REVERSE_SUBTRACT = 32779 # /usr/include/GL/gl.h:1627
+GL_BLEND_COLOR = 32773 # /usr/include/GL/gl.h:1628
+# /usr/include/GL/gl.h:1631
+glColorTable = _link_function('glColorTable', None, [GLenum, GLenum, GLsizei, GLenum, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1635
+glColorSubTable = _link_function('glColorSubTable', None, [GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1640
+glColorTableParameteriv = _link_function('glColorTableParameteriv', None, [GLenum, GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1643
+glColorTableParameterfv = _link_function('glColorTableParameterfv', None, [GLenum, GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1646
+glCopyColorSubTable = _link_function('glCopyColorSubTable', None, [GLenum, GLsizei, GLint, GLint, GLsizei], None)
+
+# /usr/include/GL/gl.h:1649
+glCopyColorTable = _link_function('glCopyColorTable', None, [GLenum, GLenum, GLint, GLint, GLsizei], None)
+
+# /usr/include/GL/gl.h:1652
+glGetColorTable = _link_function('glGetColorTable', None, [GLenum, GLenum, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1655
+glGetColorTableParameterfv = _link_function('glGetColorTableParameterfv', None, [GLenum, GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1658
+glGetColorTableParameteriv = _link_function('glGetColorTableParameteriv', None, [GLenum, GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1661
+glBlendEquation = _link_function('glBlendEquation', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:1663
+glBlendColor = _link_function('glBlendColor', None, [GLclampf, GLclampf, GLclampf, GLclampf], None)
+
+# /usr/include/GL/gl.h:1666
+glHistogram = _link_function('glHistogram', None, [GLenum, GLsizei, GLenum, GLboolean], None)
+
+# /usr/include/GL/gl.h:1669
+glResetHistogram = _link_function('glResetHistogram', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:1671
+glGetHistogram = _link_function('glGetHistogram', None, [GLenum, GLboolean, GLenum, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1675
+glGetHistogramParameterfv = _link_function('glGetHistogramParameterfv', None, [GLenum, GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1678
+glGetHistogramParameteriv = _link_function('glGetHistogramParameteriv', None, [GLenum, GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1681
+glMinmax = _link_function('glMinmax', None, [GLenum, GLenum, GLboolean], None)
+
+# /usr/include/GL/gl.h:1684
+glResetMinmax = _link_function('glResetMinmax', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:1686
+glGetMinmax = _link_function('glGetMinmax', None, [GLenum, GLboolean, GLenum, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1690
+glGetMinmaxParameterfv = _link_function('glGetMinmaxParameterfv', None, [GLenum, GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1693
+glGetMinmaxParameteriv = _link_function('glGetMinmaxParameteriv', None, [GLenum, GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1696
+glConvolutionFilter1D = _link_function('glConvolutionFilter1D', None, [GLenum, GLenum, GLsizei, GLenum, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1700
+glConvolutionFilter2D = _link_function('glConvolutionFilter2D', None, [GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1704
+glConvolutionParameterf = _link_function('glConvolutionParameterf', None, [GLenum, GLenum, GLfloat], None)
+
+# /usr/include/GL/gl.h:1707
+glConvolutionParameterfv = _link_function('glConvolutionParameterfv', None, [GLenum, GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1710
+glConvolutionParameteri = _link_function('glConvolutionParameteri', None, [GLenum, GLenum, GLint], None)
+
+# /usr/include/GL/gl.h:1713
+glConvolutionParameteriv = _link_function('glConvolutionParameteriv', None, [GLenum, GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1716
+glCopyConvolutionFilter1D = _link_function('glCopyConvolutionFilter1D', None, [GLenum, GLenum, GLint, GLint, GLsizei], None)
+
+# /usr/include/GL/gl.h:1719
+glCopyConvolutionFilter2D = _link_function('glCopyConvolutionFilter2D', None, [GLenum, GLenum, GLint, GLint, GLsizei, GLsizei], None)
+
+# /usr/include/GL/gl.h:1723
+glGetConvolutionFilter = _link_function('glGetConvolutionFilter', None, [GLenum, GLenum, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1726
+glGetConvolutionParameterfv = _link_function('glGetConvolutionParameterfv', None, [GLenum, GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1729
+glGetConvolutionParameteriv = _link_function('glGetConvolutionParameteriv', None, [GLenum, GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1732
+glSeparableFilter2D = _link_function('glSeparableFilter2D', None, [GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid), POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1736
+glGetSeparableFilter = _link_function('glGetSeparableFilter', None, [GLenum, GLenum, GLenum, POINTER(GLvoid), POINTER(GLvoid), POINTER(GLvoid)], None)
+
+PFNGLBLENDCOLORPROC = CFUNCTYPE(None, GLclampf, GLclampf, GLclampf, GLclampf) # /usr/include/GL/gl.h:1739
+PFNGLBLENDEQUATIONPROC = CFUNCTYPE(None, GLenum) # /usr/include/GL/gl.h:1740
+GL_TEXTURE0 = 33984 # /usr/include/GL/gl.h:1749
+GL_TEXTURE1 = 33985 # /usr/include/GL/gl.h:1750
+GL_TEXTURE2 = 33986 # /usr/include/GL/gl.h:1751
+GL_TEXTURE3 = 33987 # /usr/include/GL/gl.h:1752
+GL_TEXTURE4 = 33988 # /usr/include/GL/gl.h:1753
+GL_TEXTURE5 = 33989 # /usr/include/GL/gl.h:1754
+GL_TEXTURE6 = 33990 # /usr/include/GL/gl.h:1755
+GL_TEXTURE7 = 33991 # /usr/include/GL/gl.h:1756
+GL_TEXTURE8 = 33992 # /usr/include/GL/gl.h:1757
+GL_TEXTURE9 = 33993 # /usr/include/GL/gl.h:1758
+GL_TEXTURE10 = 33994 # /usr/include/GL/gl.h:1759
+GL_TEXTURE11 = 33995 # /usr/include/GL/gl.h:1760
+GL_TEXTURE12 = 33996 # /usr/include/GL/gl.h:1761
+GL_TEXTURE13 = 33997 # /usr/include/GL/gl.h:1762
+GL_TEXTURE14 = 33998 # /usr/include/GL/gl.h:1763
+GL_TEXTURE15 = 33999 # /usr/include/GL/gl.h:1764
+GL_TEXTURE16 = 34000 # /usr/include/GL/gl.h:1765
+GL_TEXTURE17 = 34001 # /usr/include/GL/gl.h:1766
+GL_TEXTURE18 = 34002 # /usr/include/GL/gl.h:1767
+GL_TEXTURE19 = 34003 # /usr/include/GL/gl.h:1768
+GL_TEXTURE20 = 34004 # /usr/include/GL/gl.h:1769
+GL_TEXTURE21 = 34005 # /usr/include/GL/gl.h:1770
+GL_TEXTURE22 = 34006 # /usr/include/GL/gl.h:1771
+GL_TEXTURE23 = 34007 # /usr/include/GL/gl.h:1772
+GL_TEXTURE24 = 34008 # /usr/include/GL/gl.h:1773
+GL_TEXTURE25 = 34009 # /usr/include/GL/gl.h:1774
+GL_TEXTURE26 = 34010 # /usr/include/GL/gl.h:1775
+GL_TEXTURE27 = 34011 # /usr/include/GL/gl.h:1776
+GL_TEXTURE28 = 34012 # /usr/include/GL/gl.h:1777
+GL_TEXTURE29 = 34013 # /usr/include/GL/gl.h:1778
+GL_TEXTURE30 = 34014 # /usr/include/GL/gl.h:1779
+GL_TEXTURE31 = 34015 # /usr/include/GL/gl.h:1780
+GL_ACTIVE_TEXTURE = 34016 # /usr/include/GL/gl.h:1781
+GL_CLIENT_ACTIVE_TEXTURE = 34017 # /usr/include/GL/gl.h:1782
+GL_MAX_TEXTURE_UNITS = 34018 # /usr/include/GL/gl.h:1783
+GL_NORMAL_MAP = 34065 # /usr/include/GL/gl.h:1785
+GL_REFLECTION_MAP = 34066 # /usr/include/GL/gl.h:1786
+GL_TEXTURE_CUBE_MAP = 34067 # /usr/include/GL/gl.h:1787
+GL_TEXTURE_BINDING_CUBE_MAP = 34068 # /usr/include/GL/gl.h:1788
+GL_TEXTURE_CUBE_MAP_POSITIVE_X = 34069 # /usr/include/GL/gl.h:1789
+GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 34070 # /usr/include/GL/gl.h:1790
+GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 34071 # /usr/include/GL/gl.h:1791
+GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072 # /usr/include/GL/gl.h:1792
+GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 34073 # /usr/include/GL/gl.h:1793
+GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074 # /usr/include/GL/gl.h:1794
+GL_PROXY_TEXTURE_CUBE_MAP = 34075 # /usr/include/GL/gl.h:1795
+GL_MAX_CUBE_MAP_TEXTURE_SIZE = 34076 # /usr/include/GL/gl.h:1796
+GL_COMPRESSED_ALPHA = 34025 # /usr/include/GL/gl.h:1798
+GL_COMPRESSED_LUMINANCE = 34026 # /usr/include/GL/gl.h:1799
+GL_COMPRESSED_LUMINANCE_ALPHA = 34027 # /usr/include/GL/gl.h:1800
+GL_COMPRESSED_INTENSITY = 34028 # /usr/include/GL/gl.h:1801
+GL_COMPRESSED_RGB = 34029 # /usr/include/GL/gl.h:1802
+GL_COMPRESSED_RGBA = 34030 # /usr/include/GL/gl.h:1803
+GL_TEXTURE_COMPRESSION_HINT = 34031 # /usr/include/GL/gl.h:1804
+GL_TEXTURE_COMPRESSED_IMAGE_SIZE = 34464 # /usr/include/GL/gl.h:1805
+GL_TEXTURE_COMPRESSED = 34465 # /usr/include/GL/gl.h:1806
+GL_NUM_COMPRESSED_TEXTURE_FORMATS = 34466 # /usr/include/GL/gl.h:1807
+GL_COMPRESSED_TEXTURE_FORMATS = 34467 # /usr/include/GL/gl.h:1808
+GL_MULTISAMPLE = 32925 # /usr/include/GL/gl.h:1810
+GL_SAMPLE_ALPHA_TO_COVERAGE = 32926 # /usr/include/GL/gl.h:1811
+GL_SAMPLE_ALPHA_TO_ONE = 32927 # /usr/include/GL/gl.h:1812
+GL_SAMPLE_COVERAGE = 32928 # /usr/include/GL/gl.h:1813
+GL_SAMPLE_BUFFERS = 32936 # /usr/include/GL/gl.h:1814
+GL_SAMPLES = 32937 # /usr/include/GL/gl.h:1815
+GL_SAMPLE_COVERAGE_VALUE = 32938 # /usr/include/GL/gl.h:1816
+GL_SAMPLE_COVERAGE_INVERT = 32939 # /usr/include/GL/gl.h:1817
+GL_MULTISAMPLE_BIT = 536870912 # /usr/include/GL/gl.h:1818
+GL_TRANSPOSE_MODELVIEW_MATRIX = 34019 # /usr/include/GL/gl.h:1820
+GL_TRANSPOSE_PROJECTION_MATRIX = 34020 # /usr/include/GL/gl.h:1821
+GL_TRANSPOSE_TEXTURE_MATRIX = 34021 # /usr/include/GL/gl.h:1822
+GL_TRANSPOSE_COLOR_MATRIX = 34022 # /usr/include/GL/gl.h:1823
+GL_COMBINE = 34160 # /usr/include/GL/gl.h:1825
+GL_COMBINE_RGB = 34161 # /usr/include/GL/gl.h:1826
+GL_COMBINE_ALPHA = 34162 # /usr/include/GL/gl.h:1827
+GL_SOURCE0_RGB = 34176 # /usr/include/GL/gl.h:1828
+GL_SOURCE1_RGB = 34177 # /usr/include/GL/gl.h:1829
+GL_SOURCE2_RGB = 34178 # /usr/include/GL/gl.h:1830
+GL_SOURCE0_ALPHA = 34184 # /usr/include/GL/gl.h:1831
+GL_SOURCE1_ALPHA = 34185 # /usr/include/GL/gl.h:1832
+GL_SOURCE2_ALPHA = 34186 # /usr/include/GL/gl.h:1833
+GL_OPERAND0_RGB = 34192 # /usr/include/GL/gl.h:1834
+GL_OPERAND1_RGB = 34193 # /usr/include/GL/gl.h:1835
+GL_OPERAND2_RGB = 34194 # /usr/include/GL/gl.h:1836
+GL_OPERAND0_ALPHA = 34200 # /usr/include/GL/gl.h:1837
+GL_OPERAND1_ALPHA = 34201 # /usr/include/GL/gl.h:1838
+GL_OPERAND2_ALPHA = 34202 # /usr/include/GL/gl.h:1839
+GL_RGB_SCALE = 34163 # /usr/include/GL/gl.h:1840
+GL_ADD_SIGNED = 34164 # /usr/include/GL/gl.h:1841
+GL_INTERPOLATE = 34165 # /usr/include/GL/gl.h:1842
+GL_SUBTRACT = 34023 # /usr/include/GL/gl.h:1843
+GL_CONSTANT = 34166 # /usr/include/GL/gl.h:1844
+GL_PRIMARY_COLOR = 34167 # /usr/include/GL/gl.h:1845
+GL_PREVIOUS = 34168 # /usr/include/GL/gl.h:1846
+GL_DOT3_RGB = 34478 # /usr/include/GL/gl.h:1848
+GL_DOT3_RGBA = 34479 # /usr/include/GL/gl.h:1849
+GL_CLAMP_TO_BORDER = 33069 # /usr/include/GL/gl.h:1851
+# /usr/include/GL/gl.h:1853
+glActiveTexture = _link_function('glActiveTexture', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:1855
+glClientActiveTexture = _link_function('glClientActiveTexture', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:1857
+glCompressedTexImage1D = _link_function('glCompressedTexImage1D', None, [GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1859
+glCompressedTexImage2D = _link_function('glCompressedTexImage2D', None, [GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1861
+glCompressedTexImage3D = _link_function('glCompressedTexImage3D', None, [GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1863
+glCompressedTexSubImage1D = _link_function('glCompressedTexSubImage1D', None, [GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1865
+glCompressedTexSubImage2D = _link_function('glCompressedTexSubImage2D', None, [GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1867
+glCompressedTexSubImage3D = _link_function('glCompressedTexSubImage3D', None, [GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1869
+glGetCompressedTexImage = _link_function('glGetCompressedTexImage', None, [GLenum, GLint, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:1871
+glMultiTexCoord1d = _link_function('glMultiTexCoord1d', None, [GLenum, GLdouble], None)
+
+# /usr/include/GL/gl.h:1873
+glMultiTexCoord1dv = _link_function('glMultiTexCoord1dv', None, [GLenum, POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1875
+glMultiTexCoord1f = _link_function('glMultiTexCoord1f', None, [GLenum, GLfloat], None)
+
+# /usr/include/GL/gl.h:1877
+glMultiTexCoord1fv = _link_function('glMultiTexCoord1fv', None, [GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1879
+glMultiTexCoord1i = _link_function('glMultiTexCoord1i', None, [GLenum, GLint], None)
+
+# /usr/include/GL/gl.h:1881
+glMultiTexCoord1iv = _link_function('glMultiTexCoord1iv', None, [GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1883
+glMultiTexCoord1s = _link_function('glMultiTexCoord1s', None, [GLenum, GLshort], None)
+
+# /usr/include/GL/gl.h:1885
+glMultiTexCoord1sv = _link_function('glMultiTexCoord1sv', None, [GLenum, POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:1887
+glMultiTexCoord2d = _link_function('glMultiTexCoord2d', None, [GLenum, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:1889
+glMultiTexCoord2dv = _link_function('glMultiTexCoord2dv', None, [GLenum, POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1891
+glMultiTexCoord2f = _link_function('glMultiTexCoord2f', None, [GLenum, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:1893
+glMultiTexCoord2fv = _link_function('glMultiTexCoord2fv', None, [GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1895
+glMultiTexCoord2i = _link_function('glMultiTexCoord2i', None, [GLenum, GLint, GLint], None)
+
+# /usr/include/GL/gl.h:1897
+glMultiTexCoord2iv = _link_function('glMultiTexCoord2iv', None, [GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1899
+glMultiTexCoord2s = _link_function('glMultiTexCoord2s', None, [GLenum, GLshort, GLshort], None)
+
+# /usr/include/GL/gl.h:1901
+glMultiTexCoord2sv = _link_function('glMultiTexCoord2sv', None, [GLenum, POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:1903
+glMultiTexCoord3d = _link_function('glMultiTexCoord3d', None, [GLenum, GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:1905
+glMultiTexCoord3dv = _link_function('glMultiTexCoord3dv', None, [GLenum, POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1907
+glMultiTexCoord3f = _link_function('glMultiTexCoord3f', None, [GLenum, GLfloat, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:1909
+glMultiTexCoord3fv = _link_function('glMultiTexCoord3fv', None, [GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1911
+glMultiTexCoord3i = _link_function('glMultiTexCoord3i', None, [GLenum, GLint, GLint, GLint], None)
+
+# /usr/include/GL/gl.h:1913
+glMultiTexCoord3iv = _link_function('glMultiTexCoord3iv', None, [GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1915
+glMultiTexCoord3s = _link_function('glMultiTexCoord3s', None, [GLenum, GLshort, GLshort, GLshort], None)
+
+# /usr/include/GL/gl.h:1917
+glMultiTexCoord3sv = _link_function('glMultiTexCoord3sv', None, [GLenum, POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:1919
+glMultiTexCoord4d = _link_function('glMultiTexCoord4d', None, [GLenum, GLdouble, GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:1921
+glMultiTexCoord4dv = _link_function('glMultiTexCoord4dv', None, [GLenum, POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:1923
+glMultiTexCoord4f = _link_function('glMultiTexCoord4f', None, [GLenum, GLfloat, GLfloat, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:1925
+glMultiTexCoord4fv = _link_function('glMultiTexCoord4fv', None, [GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:1927
+glMultiTexCoord4i = _link_function('glMultiTexCoord4i', None, [GLenum, GLint, GLint, GLint, GLint], None)
+
+# /usr/include/GL/gl.h:1929
+glMultiTexCoord4iv = _link_function('glMultiTexCoord4iv', None, [GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:1931
+glMultiTexCoord4s = _link_function('glMultiTexCoord4s', None, [GLenum, GLshort, GLshort, GLshort, GLshort], None)
+
+# /usr/include/GL/gl.h:1933
+glMultiTexCoord4sv = _link_function('glMultiTexCoord4sv', None, [GLenum, POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:1936
+glLoadTransposeMatrixd = _link_function('glLoadTransposeMatrixd', None, [GLdouble * 16], None)
+
+# /usr/include/GL/gl.h:1938
+glLoadTransposeMatrixf = _link_function('glLoadTransposeMatrixf', None, [GLfloat * 16], None)
+
+# /usr/include/GL/gl.h:1940
+glMultTransposeMatrixd = _link_function('glMultTransposeMatrixd', None, [GLdouble * 16], None)
+
+# /usr/include/GL/gl.h:1942
+glMultTransposeMatrixf = _link_function('glMultTransposeMatrixf', None, [GLfloat * 16], None)
+
+# /usr/include/GL/gl.h:1944
+glSampleCoverage = _link_function('glSampleCoverage', None, [GLclampf, GLboolean], None)
+
+PFNGLACTIVETEXTUREPROC = CFUNCTYPE(None, GLenum) # /usr/include/GL/gl.h:1947
+PFNGLSAMPLECOVERAGEPROC = CFUNCTYPE(None, GLclampf, GLboolean) # /usr/include/GL/gl.h:1948
+PFNGLCOMPRESSEDTEXIMAGE3DPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # /usr/include/GL/gl.h:1949
+PFNGLCOMPRESSEDTEXIMAGE2DPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # /usr/include/GL/gl.h:1950
+PFNGLCOMPRESSEDTEXIMAGE1DPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # /usr/include/GL/gl.h:1951
+PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # /usr/include/GL/gl.h:1952
+PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # /usr/include/GL/gl.h:1953
+PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # /usr/include/GL/gl.h:1954
+PFNGLGETCOMPRESSEDTEXIMAGEPROC = CFUNCTYPE(None, GLenum, GLint, POINTER(GLvoid)) # /usr/include/GL/gl.h:1955
+GL_ARB_multitexture = 1 # /usr/include/GL/gl.h:1963
+GL_TEXTURE0_ARB = 33984 # /usr/include/GL/gl.h:1965
+GL_TEXTURE1_ARB = 33985 # /usr/include/GL/gl.h:1966
+GL_TEXTURE2_ARB = 33986 # /usr/include/GL/gl.h:1967
+GL_TEXTURE3_ARB = 33987 # /usr/include/GL/gl.h:1968
+GL_TEXTURE4_ARB = 33988 # /usr/include/GL/gl.h:1969
+GL_TEXTURE5_ARB = 33989 # /usr/include/GL/gl.h:1970
+GL_TEXTURE6_ARB = 33990 # /usr/include/GL/gl.h:1971
+GL_TEXTURE7_ARB = 33991 # /usr/include/GL/gl.h:1972
+GL_TEXTURE8_ARB = 33992 # /usr/include/GL/gl.h:1973
+GL_TEXTURE9_ARB = 33993 # /usr/include/GL/gl.h:1974
+GL_TEXTURE10_ARB = 33994 # /usr/include/GL/gl.h:1975
+GL_TEXTURE11_ARB = 33995 # /usr/include/GL/gl.h:1976
+GL_TEXTURE12_ARB = 33996 # /usr/include/GL/gl.h:1977
+GL_TEXTURE13_ARB = 33997 # /usr/include/GL/gl.h:1978
+GL_TEXTURE14_ARB = 33998 # /usr/include/GL/gl.h:1979
+GL_TEXTURE15_ARB = 33999 # /usr/include/GL/gl.h:1980
+GL_TEXTURE16_ARB = 34000 # /usr/include/GL/gl.h:1981
+GL_TEXTURE17_ARB = 34001 # /usr/include/GL/gl.h:1982
+GL_TEXTURE18_ARB = 34002 # /usr/include/GL/gl.h:1983
+GL_TEXTURE19_ARB = 34003 # /usr/include/GL/gl.h:1984
+GL_TEXTURE20_ARB = 34004 # /usr/include/GL/gl.h:1985
+GL_TEXTURE21_ARB = 34005 # /usr/include/GL/gl.h:1986
+GL_TEXTURE22_ARB = 34006 # /usr/include/GL/gl.h:1987
+GL_TEXTURE23_ARB = 34007 # /usr/include/GL/gl.h:1988
+GL_TEXTURE24_ARB = 34008 # /usr/include/GL/gl.h:1989
+GL_TEXTURE25_ARB = 34009 # /usr/include/GL/gl.h:1990
+GL_TEXTURE26_ARB = 34010 # /usr/include/GL/gl.h:1991
+GL_TEXTURE27_ARB = 34011 # /usr/include/GL/gl.h:1992
+GL_TEXTURE28_ARB = 34012 # /usr/include/GL/gl.h:1993
+GL_TEXTURE29_ARB = 34013 # /usr/include/GL/gl.h:1994
+GL_TEXTURE30_ARB = 34014 # /usr/include/GL/gl.h:1995
+GL_TEXTURE31_ARB = 34015 # /usr/include/GL/gl.h:1996
+GL_ACTIVE_TEXTURE_ARB = 34016 # /usr/include/GL/gl.h:1997
+GL_CLIENT_ACTIVE_TEXTURE_ARB = 34017 # /usr/include/GL/gl.h:1998
+GL_MAX_TEXTURE_UNITS_ARB = 34018 # /usr/include/GL/gl.h:1999
+# /usr/include/GL/gl.h:2001
+glActiveTextureARB = _link_function('glActiveTextureARB', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:2002
+glClientActiveTextureARB = _link_function('glClientActiveTextureARB', None, [GLenum], None)
+
+# /usr/include/GL/gl.h:2003
+glMultiTexCoord1dARB = _link_function('glMultiTexCoord1dARB', None, [GLenum, GLdouble], None)
+
+# /usr/include/GL/gl.h:2004
+glMultiTexCoord1dvARB = _link_function('glMultiTexCoord1dvARB', None, [GLenum, POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:2005
+glMultiTexCoord1fARB = _link_function('glMultiTexCoord1fARB', None, [GLenum, GLfloat], None)
+
+# /usr/include/GL/gl.h:2006
+glMultiTexCoord1fvARB = _link_function('glMultiTexCoord1fvARB', None, [GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:2007
+glMultiTexCoord1iARB = _link_function('glMultiTexCoord1iARB', None, [GLenum, GLint], None)
+
+# /usr/include/GL/gl.h:2008
+glMultiTexCoord1ivARB = _link_function('glMultiTexCoord1ivARB', None, [GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:2009
+glMultiTexCoord1sARB = _link_function('glMultiTexCoord1sARB', None, [GLenum, GLshort], None)
+
+# /usr/include/GL/gl.h:2010
+glMultiTexCoord1svARB = _link_function('glMultiTexCoord1svARB', None, [GLenum, POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:2011
+glMultiTexCoord2dARB = _link_function('glMultiTexCoord2dARB', None, [GLenum, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:2012
+glMultiTexCoord2dvARB = _link_function('glMultiTexCoord2dvARB', None, [GLenum, POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:2013
+glMultiTexCoord2fARB = _link_function('glMultiTexCoord2fARB', None, [GLenum, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:2014
+glMultiTexCoord2fvARB = _link_function('glMultiTexCoord2fvARB', None, [GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:2015
+glMultiTexCoord2iARB = _link_function('glMultiTexCoord2iARB', None, [GLenum, GLint, GLint], None)
+
+# /usr/include/GL/gl.h:2016
+glMultiTexCoord2ivARB = _link_function('glMultiTexCoord2ivARB', None, [GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:2017
+glMultiTexCoord2sARB = _link_function('glMultiTexCoord2sARB', None, [GLenum, GLshort, GLshort], None)
+
+# /usr/include/GL/gl.h:2018
+glMultiTexCoord2svARB = _link_function('glMultiTexCoord2svARB', None, [GLenum, POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:2019
+glMultiTexCoord3dARB = _link_function('glMultiTexCoord3dARB', None, [GLenum, GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:2020
+glMultiTexCoord3dvARB = _link_function('glMultiTexCoord3dvARB', None, [GLenum, POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:2021
+glMultiTexCoord3fARB = _link_function('glMultiTexCoord3fARB', None, [GLenum, GLfloat, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:2022
+glMultiTexCoord3fvARB = _link_function('glMultiTexCoord3fvARB', None, [GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:2023
+glMultiTexCoord3iARB = _link_function('glMultiTexCoord3iARB', None, [GLenum, GLint, GLint, GLint], None)
+
+# /usr/include/GL/gl.h:2024
+glMultiTexCoord3ivARB = _link_function('glMultiTexCoord3ivARB', None, [GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:2025
+glMultiTexCoord3sARB = _link_function('glMultiTexCoord3sARB', None, [GLenum, GLshort, GLshort, GLshort], None)
+
+# /usr/include/GL/gl.h:2026
+glMultiTexCoord3svARB = _link_function('glMultiTexCoord3svARB', None, [GLenum, POINTER(GLshort)], None)
+
+# /usr/include/GL/gl.h:2027
+glMultiTexCoord4dARB = _link_function('glMultiTexCoord4dARB', None, [GLenum, GLdouble, GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/gl.h:2028
+glMultiTexCoord4dvARB = _link_function('glMultiTexCoord4dvARB', None, [GLenum, POINTER(GLdouble)], None)
+
+# /usr/include/GL/gl.h:2029
+glMultiTexCoord4fARB = _link_function('glMultiTexCoord4fARB', None, [GLenum, GLfloat, GLfloat, GLfloat, GLfloat], None)
+
+# /usr/include/GL/gl.h:2030
+glMultiTexCoord4fvARB = _link_function('glMultiTexCoord4fvARB', None, [GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/gl.h:2031
+glMultiTexCoord4iARB = _link_function('glMultiTexCoord4iARB', None, [GLenum, GLint, GLint, GLint, GLint], None)
+
+# /usr/include/GL/gl.h:2032
+glMultiTexCoord4ivARB = _link_function('glMultiTexCoord4ivARB', None, [GLenum, POINTER(GLint)], None)
+
+# /usr/include/GL/gl.h:2033
+glMultiTexCoord4sARB = _link_function('glMultiTexCoord4sARB', None, [GLenum, GLshort, GLshort, GLshort, GLshort], None)
+
+# /usr/include/GL/gl.h:2034
+glMultiTexCoord4svARB = _link_function('glMultiTexCoord4svARB', None, [GLenum, POINTER(GLshort)], None)
+
+PFNGLACTIVETEXTUREARBPROC = CFUNCTYPE(None, GLenum) # /usr/include/GL/gl.h:2036
+PFNGLCLIENTACTIVETEXTUREARBPROC = CFUNCTYPE(None, GLenum) # /usr/include/GL/gl.h:2037
+PFNGLMULTITEXCOORD1DARBPROC = CFUNCTYPE(None, GLenum, GLdouble) # /usr/include/GL/gl.h:2038
+PFNGLMULTITEXCOORD1DVARBPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # /usr/include/GL/gl.h:2039
+PFNGLMULTITEXCOORD1FARBPROC = CFUNCTYPE(None, GLenum, GLfloat) # /usr/include/GL/gl.h:2040
+PFNGLMULTITEXCOORD1FVARBPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # /usr/include/GL/gl.h:2041
+PFNGLMULTITEXCOORD1IARBPROC = CFUNCTYPE(None, GLenum, GLint) # /usr/include/GL/gl.h:2042
+PFNGLMULTITEXCOORD1IVARBPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # /usr/include/GL/gl.h:2043
+PFNGLMULTITEXCOORD1SARBPROC = CFUNCTYPE(None, GLenum, GLshort) # /usr/include/GL/gl.h:2044
+PFNGLMULTITEXCOORD1SVARBPROC = CFUNCTYPE(None, GLenum, POINTER(GLshort)) # /usr/include/GL/gl.h:2045
+PFNGLMULTITEXCOORD2DARBPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble) # /usr/include/GL/gl.h:2046
+PFNGLMULTITEXCOORD2DVARBPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # /usr/include/GL/gl.h:2047
+PFNGLMULTITEXCOORD2FARBPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat) # /usr/include/GL/gl.h:2048
+PFNGLMULTITEXCOORD2FVARBPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # /usr/include/GL/gl.h:2049
+PFNGLMULTITEXCOORD2IARBPROC = CFUNCTYPE(None, GLenum, GLint, GLint) # /usr/include/GL/gl.h:2050
+PFNGLMULTITEXCOORD2IVARBPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # /usr/include/GL/gl.h:2051
+PFNGLMULTITEXCOORD2SARBPROC = CFUNCTYPE(None, GLenum, GLshort, GLshort) # /usr/include/GL/gl.h:2052
+PFNGLMULTITEXCOORD2SVARBPROC = CFUNCTYPE(None, GLenum, POINTER(GLshort)) # /usr/include/GL/gl.h:2053
+PFNGLMULTITEXCOORD3DARBPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble) # /usr/include/GL/gl.h:2054
+PFNGLMULTITEXCOORD3DVARBPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # /usr/include/GL/gl.h:2055
+PFNGLMULTITEXCOORD3FARBPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat, GLfloat) # /usr/include/GL/gl.h:2056
+PFNGLMULTITEXCOORD3FVARBPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # /usr/include/GL/gl.h:2057
+PFNGLMULTITEXCOORD3IARBPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint) # /usr/include/GL/gl.h:2058
+PFNGLMULTITEXCOORD3IVARBPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # /usr/include/GL/gl.h:2059
+PFNGLMULTITEXCOORD3SARBPROC = CFUNCTYPE(None, GLenum, GLshort, GLshort, GLshort) # /usr/include/GL/gl.h:2060
+PFNGLMULTITEXCOORD3SVARBPROC = CFUNCTYPE(None, GLenum, POINTER(GLshort)) # /usr/include/GL/gl.h:2061
+PFNGLMULTITEXCOORD4DARBPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble, GLdouble) # /usr/include/GL/gl.h:2062
+PFNGLMULTITEXCOORD4DVARBPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # /usr/include/GL/gl.h:2063
+PFNGLMULTITEXCOORD4FARBPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat, GLfloat, GLfloat) # /usr/include/GL/gl.h:2064
+PFNGLMULTITEXCOORD4FVARBPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # /usr/include/GL/gl.h:2065
+PFNGLMULTITEXCOORD4IARBPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLint) # /usr/include/GL/gl.h:2066
+PFNGLMULTITEXCOORD4IVARBPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # /usr/include/GL/gl.h:2067
+PFNGLMULTITEXCOORD4SARBPROC = CFUNCTYPE(None, GLenum, GLshort, GLshort, GLshort, GLshort) # /usr/include/GL/gl.h:2068
+PFNGLMULTITEXCOORD4SVARBPROC = CFUNCTYPE(None, GLenum, POINTER(GLshort)) # /usr/include/GL/gl.h:2069
+GL_MESA_shader_debug = 1 # /usr/include/GL/gl.h:2094
+GL_DEBUG_OBJECT_MESA = 34649 # /usr/include/GL/gl.h:2096
+GL_DEBUG_PRINT_MESA = 34650 # /usr/include/GL/gl.h:2097
+GL_DEBUG_ASSERT_MESA = 34651 # /usr/include/GL/gl.h:2098
+GLhandleARB = c_uint # /usr/include/GL/glext.h:5340
+# /usr/include/GL/gl.h:2100
+glCreateDebugObjectMESA = _link_function('glCreateDebugObjectMESA', GLhandleARB, [], None)
+
+# /usr/include/GL/gl.h:2101
+glClearDebugLogMESA = _link_function('glClearDebugLogMESA', None, [GLhandleARB, GLenum, GLenum], None)
+
+GLcharARB = c_char # /usr/include/GL/glext.h:5339
+# /usr/include/GL/gl.h:2102
+glGetDebugLogMESA = _link_function('glGetDebugLogMESA', None, [GLhandleARB, GLenum, GLenum, GLsizei, POINTER(GLsizei), POINTER(GLcharARB)], None)
+
+# /usr/include/GL/gl.h:2104
+glGetDebugLogLengthMESA = _link_function('glGetDebugLogLengthMESA', GLsizei, [GLhandleARB, GLenum, GLenum], None)
+
+GL_MESA_packed_depth_stencil = 1 # /usr/include/GL/gl.h:2116
+GL_DEPTH_STENCIL_MESA = 34640 # /usr/include/GL/gl.h:2118
+GL_UNSIGNED_INT_24_8_MESA = 34641 # /usr/include/GL/gl.h:2119
+GL_UNSIGNED_INT_8_24_REV_MESA = 34642 # /usr/include/GL/gl.h:2120
+GL_UNSIGNED_SHORT_15_1_MESA = 34643 # /usr/include/GL/gl.h:2121
+GL_UNSIGNED_SHORT_1_15_REV_MESA = 34644 # /usr/include/GL/gl.h:2122
+GL_MESA_program_debug = 1 # /usr/include/GL/gl.h:2128
+GL_FRAGMENT_PROGRAM_POSITION_MESA = 35760 # /usr/include/GL/gl.h:2130
+GL_FRAGMENT_PROGRAM_CALLBACK_MESA = 35761 # /usr/include/GL/gl.h:2131
+GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA = 35762 # /usr/include/GL/gl.h:2132
+GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA = 35763 # /usr/include/GL/gl.h:2133
+GL_VERTEX_PROGRAM_POSITION_MESA = 35764 # /usr/include/GL/gl.h:2134
+GL_VERTEX_PROGRAM_CALLBACK_MESA = 35765 # /usr/include/GL/gl.h:2135
+GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA = 35766 # /usr/include/GL/gl.h:2136
+GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA = 35767 # /usr/include/GL/gl.h:2137
+GLprogramcallbackMESA = CFUNCTYPE(None, GLenum, POINTER(GLvoid)) # /usr/include/GL/gl.h:2139
+# /usr/include/GL/gl.h:2141
+glProgramCallbackMESA = _link_function('glProgramCallbackMESA', None, [GLenum, GLprogramcallbackMESA, POINTER(GLvoid)], None)
+
+# /usr/include/GL/gl.h:2143
+glGetProgramRegisterfvMESA = _link_function('glGetProgramRegisterfvMESA', None, [GLenum, GLsizei, POINTER(GLubyte), POINTER(GLfloat)], None)
+
+GL_MESA_texture_array = 1 # /usr/include/GL/gl.h:2149
+GL_ATI_blend_equation_separate = 1 # /usr/include/GL/gl.h:2182
+GL_ALPHA_BLEND_EQUATION_ATI = 34877 # /usr/include/GL/gl.h:2184
+# /usr/include/GL/gl.h:2186
+glBlendEquationSeparateATI = _link_function('glBlendEquationSeparateATI', None, [GLenum, GLenum], None)
+
+PFNGLBLENDEQUATIONSEPARATEATIPROC = CFUNCTYPE(None, GLenum, GLenum) # /usr/include/GL/gl.h:2187
+GLeglImageOES = POINTER(None) # /usr/include/GL/gl.h:2194
+GL_OES_EGL_image = 1 # /usr/include/GL/gl.h:2198
+PFNGLEGLIMAGETARGETTEXTURE2DOESPROC = CFUNCTYPE(None, GLenum, GLeglImageOES) # /usr/include/GL/gl.h:2203
+PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC = CFUNCTYPE(None, GLenum, GLeglImageOES) # /usr/include/GL/gl.h:2204
+
+__all__ = ['GL_VERSION_1_1', 'GL_VERSION_1_2', 'GL_VERSION_1_3',
+'GL_ARB_imaging', 'GLenum', 'GLboolean', 'GLbitfield', 'GLvoid', 'GLbyte',
+'GLshort', 'GLint', 'GLubyte', 'GLushort', 'GLuint', 'GLsizei', 'GLfloat',
+'GLclampf', 'GLdouble', 'GLclampd', 'GL_FALSE', 'GL_TRUE', 'GL_BYTE',
+'GL_UNSIGNED_BYTE', 'GL_SHORT', 'GL_UNSIGNED_SHORT', 'GL_INT',
+'GL_UNSIGNED_INT', 'GL_FLOAT', 'GL_2_BYTES', 'GL_3_BYTES', 'GL_4_BYTES',
+'GL_DOUBLE', 'GL_POINTS', 'GL_LINES', 'GL_LINE_LOOP', 'GL_LINE_STRIP',
+'GL_TRIANGLES', 'GL_TRIANGLE_STRIP', 'GL_TRIANGLE_FAN', 'GL_QUADS',
+'GL_QUAD_STRIP', 'GL_POLYGON', 'GL_VERTEX_ARRAY', 'GL_NORMAL_ARRAY',
+'GL_COLOR_ARRAY', 'GL_INDEX_ARRAY', 'GL_TEXTURE_COORD_ARRAY',
+'GL_EDGE_FLAG_ARRAY', 'GL_VERTEX_ARRAY_SIZE', 'GL_VERTEX_ARRAY_TYPE',
+'GL_VERTEX_ARRAY_STRIDE', 'GL_NORMAL_ARRAY_TYPE', 'GL_NORMAL_ARRAY_STRIDE',
+'GL_COLOR_ARRAY_SIZE', 'GL_COLOR_ARRAY_TYPE', 'GL_COLOR_ARRAY_STRIDE',
+'GL_INDEX_ARRAY_TYPE', 'GL_INDEX_ARRAY_STRIDE', 'GL_TEXTURE_COORD_ARRAY_SIZE',
+'GL_TEXTURE_COORD_ARRAY_TYPE', 'GL_TEXTURE_COORD_ARRAY_STRIDE',
+'GL_EDGE_FLAG_ARRAY_STRIDE', 'GL_VERTEX_ARRAY_POINTER',
+'GL_NORMAL_ARRAY_POINTER', 'GL_COLOR_ARRAY_POINTER', 'GL_INDEX_ARRAY_POINTER',
+'GL_TEXTURE_COORD_ARRAY_POINTER', 'GL_EDGE_FLAG_ARRAY_POINTER', 'GL_V2F',
+'GL_V3F', 'GL_C4UB_V2F', 'GL_C4UB_V3F', 'GL_C3F_V3F', 'GL_N3F_V3F',
+'GL_C4F_N3F_V3F', 'GL_T2F_V3F', 'GL_T4F_V4F', 'GL_T2F_C4UB_V3F',
+'GL_T2F_C3F_V3F', 'GL_T2F_N3F_V3F', 'GL_T2F_C4F_N3F_V3F',
+'GL_T4F_C4F_N3F_V4F', 'GL_MATRIX_MODE', 'GL_MODELVIEW', 'GL_PROJECTION',
+'GL_TEXTURE', 'GL_POINT_SMOOTH', 'GL_POINT_SIZE', 'GL_POINT_SIZE_GRANULARITY',
+'GL_POINT_SIZE_RANGE', 'GL_LINE_SMOOTH', 'GL_LINE_STIPPLE',
+'GL_LINE_STIPPLE_PATTERN', 'GL_LINE_STIPPLE_REPEAT', 'GL_LINE_WIDTH',
+'GL_LINE_WIDTH_GRANULARITY', 'GL_LINE_WIDTH_RANGE', 'GL_POINT', 'GL_LINE',
+'GL_FILL', 'GL_CW', 'GL_CCW', 'GL_FRONT', 'GL_BACK', 'GL_POLYGON_MODE',
+'GL_POLYGON_SMOOTH', 'GL_POLYGON_STIPPLE', 'GL_EDGE_FLAG', 'GL_CULL_FACE',
+'GL_CULL_FACE_MODE', 'GL_FRONT_FACE', 'GL_POLYGON_OFFSET_FACTOR',
+'GL_POLYGON_OFFSET_UNITS', 'GL_POLYGON_OFFSET_POINT',
+'GL_POLYGON_OFFSET_LINE', 'GL_POLYGON_OFFSET_FILL', 'GL_COMPILE',
+'GL_COMPILE_AND_EXECUTE', 'GL_LIST_BASE', 'GL_LIST_INDEX', 'GL_LIST_MODE',
+'GL_NEVER', 'GL_LESS', 'GL_EQUAL', 'GL_LEQUAL', 'GL_GREATER', 'GL_NOTEQUAL',
+'GL_GEQUAL', 'GL_ALWAYS', 'GL_DEPTH_TEST', 'GL_DEPTH_BITS',
+'GL_DEPTH_CLEAR_VALUE', 'GL_DEPTH_FUNC', 'GL_DEPTH_RANGE',
+'GL_DEPTH_WRITEMASK', 'GL_DEPTH_COMPONENT', 'GL_LIGHTING', 'GL_LIGHT0',
+'GL_LIGHT1', 'GL_LIGHT2', 'GL_LIGHT3', 'GL_LIGHT4', 'GL_LIGHT5', 'GL_LIGHT6',
+'GL_LIGHT7', 'GL_SPOT_EXPONENT', 'GL_SPOT_CUTOFF', 'GL_CONSTANT_ATTENUATION',
+'GL_LINEAR_ATTENUATION', 'GL_QUADRATIC_ATTENUATION', 'GL_AMBIENT',
+'GL_DIFFUSE', 'GL_SPECULAR', 'GL_SHININESS', 'GL_EMISSION', 'GL_POSITION',
+'GL_SPOT_DIRECTION', 'GL_AMBIENT_AND_DIFFUSE', 'GL_COLOR_INDEXES',
+'GL_LIGHT_MODEL_TWO_SIDE', 'GL_LIGHT_MODEL_LOCAL_VIEWER',
+'GL_LIGHT_MODEL_AMBIENT', 'GL_FRONT_AND_BACK', 'GL_SHADE_MODEL', 'GL_FLAT',
+'GL_SMOOTH', 'GL_COLOR_MATERIAL', 'GL_COLOR_MATERIAL_FACE',
+'GL_COLOR_MATERIAL_PARAMETER', 'GL_NORMALIZE', 'GL_CLIP_PLANE0',
+'GL_CLIP_PLANE1', 'GL_CLIP_PLANE2', 'GL_CLIP_PLANE3', 'GL_CLIP_PLANE4',
+'GL_CLIP_PLANE5', 'GL_ACCUM_RED_BITS', 'GL_ACCUM_GREEN_BITS',
+'GL_ACCUM_BLUE_BITS', 'GL_ACCUM_ALPHA_BITS', 'GL_ACCUM_CLEAR_VALUE',
+'GL_ACCUM', 'GL_ADD', 'GL_LOAD', 'GL_MULT', 'GL_RETURN', 'GL_ALPHA_TEST',
+'GL_ALPHA_TEST_REF', 'GL_ALPHA_TEST_FUNC', 'GL_BLEND', 'GL_BLEND_SRC',
+'GL_BLEND_DST', 'GL_ZERO', 'GL_ONE', 'GL_SRC_COLOR', 'GL_ONE_MINUS_SRC_COLOR',
+'GL_SRC_ALPHA', 'GL_ONE_MINUS_SRC_ALPHA', 'GL_DST_ALPHA',
+'GL_ONE_MINUS_DST_ALPHA', 'GL_DST_COLOR', 'GL_ONE_MINUS_DST_COLOR',
+'GL_SRC_ALPHA_SATURATE', 'GL_FEEDBACK', 'GL_RENDER', 'GL_SELECT', 'GL_2D',
+'GL_3D', 'GL_3D_COLOR', 'GL_3D_COLOR_TEXTURE', 'GL_4D_COLOR_TEXTURE',
+'GL_POINT_TOKEN', 'GL_LINE_TOKEN', 'GL_LINE_RESET_TOKEN', 'GL_POLYGON_TOKEN',
+'GL_BITMAP_TOKEN', 'GL_DRAW_PIXEL_TOKEN', 'GL_COPY_PIXEL_TOKEN',
+'GL_PASS_THROUGH_TOKEN', 'GL_FEEDBACK_BUFFER_POINTER',
+'GL_FEEDBACK_BUFFER_SIZE', 'GL_FEEDBACK_BUFFER_TYPE',
+'GL_SELECTION_BUFFER_POINTER', 'GL_SELECTION_BUFFER_SIZE', 'GL_FOG',
+'GL_FOG_MODE', 'GL_FOG_DENSITY', 'GL_FOG_COLOR', 'GL_FOG_INDEX',
+'GL_FOG_START', 'GL_FOG_END', 'GL_LINEAR', 'GL_EXP', 'GL_EXP2', 'GL_LOGIC_OP',
+'GL_INDEX_LOGIC_OP', 'GL_COLOR_LOGIC_OP', 'GL_LOGIC_OP_MODE', 'GL_CLEAR',
+'GL_SET', 'GL_COPY', 'GL_COPY_INVERTED', 'GL_NOOP', 'GL_INVERT', 'GL_AND',
+'GL_NAND', 'GL_OR', 'GL_NOR', 'GL_XOR', 'GL_EQUIV', 'GL_AND_REVERSE',
+'GL_AND_INVERTED', 'GL_OR_REVERSE', 'GL_OR_INVERTED', 'GL_STENCIL_BITS',
+'GL_STENCIL_TEST', 'GL_STENCIL_CLEAR_VALUE', 'GL_STENCIL_FUNC',
+'GL_STENCIL_VALUE_MASK', 'GL_STENCIL_FAIL', 'GL_STENCIL_PASS_DEPTH_FAIL',
+'GL_STENCIL_PASS_DEPTH_PASS', 'GL_STENCIL_REF', 'GL_STENCIL_WRITEMASK',
+'GL_STENCIL_INDEX', 'GL_KEEP', 'GL_REPLACE', 'GL_INCR', 'GL_DECR', 'GL_NONE',
+'GL_LEFT', 'GL_RIGHT', 'GL_FRONT_LEFT', 'GL_FRONT_RIGHT', 'GL_BACK_LEFT',
+'GL_BACK_RIGHT', 'GL_AUX0', 'GL_AUX1', 'GL_AUX2', 'GL_AUX3', 'GL_COLOR_INDEX',
+'GL_RED', 'GL_GREEN', 'GL_BLUE', 'GL_ALPHA', 'GL_LUMINANCE',
+'GL_LUMINANCE_ALPHA', 'GL_ALPHA_BITS', 'GL_RED_BITS', 'GL_GREEN_BITS',
+'GL_BLUE_BITS', 'GL_INDEX_BITS', 'GL_SUBPIXEL_BITS', 'GL_AUX_BUFFERS',
+'GL_READ_BUFFER', 'GL_DRAW_BUFFER', 'GL_DOUBLEBUFFER', 'GL_STEREO',
+'GL_BITMAP', 'GL_COLOR', 'GL_DEPTH', 'GL_STENCIL', 'GL_DITHER', 'GL_RGB',
+'GL_RGBA', 'GL_MAX_LIST_NESTING', 'GL_MAX_EVAL_ORDER', 'GL_MAX_LIGHTS',
+'GL_MAX_CLIP_PLANES', 'GL_MAX_TEXTURE_SIZE', 'GL_MAX_PIXEL_MAP_TABLE',
+'GL_MAX_ATTRIB_STACK_DEPTH', 'GL_MAX_MODELVIEW_STACK_DEPTH',
+'GL_MAX_NAME_STACK_DEPTH', 'GL_MAX_PROJECTION_STACK_DEPTH',
+'GL_MAX_TEXTURE_STACK_DEPTH', 'GL_MAX_VIEWPORT_DIMS',
+'GL_MAX_CLIENT_ATTRIB_STACK_DEPTH', 'GL_ATTRIB_STACK_DEPTH',
+'GL_CLIENT_ATTRIB_STACK_DEPTH', 'GL_COLOR_CLEAR_VALUE', 'GL_COLOR_WRITEMASK',
+'GL_CURRENT_INDEX', 'GL_CURRENT_COLOR', 'GL_CURRENT_NORMAL',
+'GL_CURRENT_RASTER_COLOR', 'GL_CURRENT_RASTER_DISTANCE',
+'GL_CURRENT_RASTER_INDEX', 'GL_CURRENT_RASTER_POSITION',
+'GL_CURRENT_RASTER_TEXTURE_COORDS', 'GL_CURRENT_RASTER_POSITION_VALID',
+'GL_CURRENT_TEXTURE_COORDS', 'GL_INDEX_CLEAR_VALUE', 'GL_INDEX_MODE',
+'GL_INDEX_WRITEMASK', 'GL_MODELVIEW_MATRIX', 'GL_MODELVIEW_STACK_DEPTH',
+'GL_NAME_STACK_DEPTH', 'GL_PROJECTION_MATRIX', 'GL_PROJECTION_STACK_DEPTH',
+'GL_RENDER_MODE', 'GL_RGBA_MODE', 'GL_TEXTURE_MATRIX',
+'GL_TEXTURE_STACK_DEPTH', 'GL_VIEWPORT', 'GL_AUTO_NORMAL', 'GL_MAP1_COLOR_4',
+'GL_MAP1_INDEX', 'GL_MAP1_NORMAL', 'GL_MAP1_TEXTURE_COORD_1',
+'GL_MAP1_TEXTURE_COORD_2', 'GL_MAP1_TEXTURE_COORD_3',
+'GL_MAP1_TEXTURE_COORD_4', 'GL_MAP1_VERTEX_3', 'GL_MAP1_VERTEX_4',
+'GL_MAP2_COLOR_4', 'GL_MAP2_INDEX', 'GL_MAP2_NORMAL',
+'GL_MAP2_TEXTURE_COORD_1', 'GL_MAP2_TEXTURE_COORD_2',
+'GL_MAP2_TEXTURE_COORD_3', 'GL_MAP2_TEXTURE_COORD_4', 'GL_MAP2_VERTEX_3',
+'GL_MAP2_VERTEX_4', 'GL_MAP1_GRID_DOMAIN', 'GL_MAP1_GRID_SEGMENTS',
+'GL_MAP2_GRID_DOMAIN', 'GL_MAP2_GRID_SEGMENTS', 'GL_COEFF', 'GL_ORDER',
+'GL_DOMAIN', 'GL_PERSPECTIVE_CORRECTION_HINT', 'GL_POINT_SMOOTH_HINT',
+'GL_LINE_SMOOTH_HINT', 'GL_POLYGON_SMOOTH_HINT', 'GL_FOG_HINT',
+'GL_DONT_CARE', 'GL_FASTEST', 'GL_NICEST', 'GL_SCISSOR_BOX',
+'GL_SCISSOR_TEST', 'GL_MAP_COLOR', 'GL_MAP_STENCIL', 'GL_INDEX_SHIFT',
+'GL_INDEX_OFFSET', 'GL_RED_SCALE', 'GL_RED_BIAS', 'GL_GREEN_SCALE',
+'GL_GREEN_BIAS', 'GL_BLUE_SCALE', 'GL_BLUE_BIAS', 'GL_ALPHA_SCALE',
+'GL_ALPHA_BIAS', 'GL_DEPTH_SCALE', 'GL_DEPTH_BIAS',
+'GL_PIXEL_MAP_S_TO_S_SIZE', 'GL_PIXEL_MAP_I_TO_I_SIZE',
+'GL_PIXEL_MAP_I_TO_R_SIZE', 'GL_PIXEL_MAP_I_TO_G_SIZE',
+'GL_PIXEL_MAP_I_TO_B_SIZE', 'GL_PIXEL_MAP_I_TO_A_SIZE',
+'GL_PIXEL_MAP_R_TO_R_SIZE', 'GL_PIXEL_MAP_G_TO_G_SIZE',
+'GL_PIXEL_MAP_B_TO_B_SIZE', 'GL_PIXEL_MAP_A_TO_A_SIZE', 'GL_PIXEL_MAP_S_TO_S',
+'GL_PIXEL_MAP_I_TO_I', 'GL_PIXEL_MAP_I_TO_R', 'GL_PIXEL_MAP_I_TO_G',
+'GL_PIXEL_MAP_I_TO_B', 'GL_PIXEL_MAP_I_TO_A', 'GL_PIXEL_MAP_R_TO_R',
+'GL_PIXEL_MAP_G_TO_G', 'GL_PIXEL_MAP_B_TO_B', 'GL_PIXEL_MAP_A_TO_A',
+'GL_PACK_ALIGNMENT', 'GL_PACK_LSB_FIRST', 'GL_PACK_ROW_LENGTH',
+'GL_PACK_SKIP_PIXELS', 'GL_PACK_SKIP_ROWS', 'GL_PACK_SWAP_BYTES',
+'GL_UNPACK_ALIGNMENT', 'GL_UNPACK_LSB_FIRST', 'GL_UNPACK_ROW_LENGTH',
+'GL_UNPACK_SKIP_PIXELS', 'GL_UNPACK_SKIP_ROWS', 'GL_UNPACK_SWAP_BYTES',
+'GL_ZOOM_X', 'GL_ZOOM_Y', 'GL_TEXTURE_ENV', 'GL_TEXTURE_ENV_MODE',
+'GL_TEXTURE_1D', 'GL_TEXTURE_2D', 'GL_TEXTURE_WRAP_S', 'GL_TEXTURE_WRAP_T',
+'GL_TEXTURE_MAG_FILTER', 'GL_TEXTURE_MIN_FILTER', 'GL_TEXTURE_ENV_COLOR',
+'GL_TEXTURE_GEN_S', 'GL_TEXTURE_GEN_T', 'GL_TEXTURE_GEN_R',
+'GL_TEXTURE_GEN_Q', 'GL_TEXTURE_GEN_MODE', 'GL_TEXTURE_BORDER_COLOR',
+'GL_TEXTURE_WIDTH', 'GL_TEXTURE_HEIGHT', 'GL_TEXTURE_BORDER',
+'GL_TEXTURE_COMPONENTS', 'GL_TEXTURE_RED_SIZE', 'GL_TEXTURE_GREEN_SIZE',
+'GL_TEXTURE_BLUE_SIZE', 'GL_TEXTURE_ALPHA_SIZE', 'GL_TEXTURE_LUMINANCE_SIZE',
+'GL_TEXTURE_INTENSITY_SIZE', 'GL_NEAREST_MIPMAP_NEAREST',
+'GL_NEAREST_MIPMAP_LINEAR', 'GL_LINEAR_MIPMAP_NEAREST',
+'GL_LINEAR_MIPMAP_LINEAR', 'GL_OBJECT_LINEAR', 'GL_OBJECT_PLANE',
+'GL_EYE_LINEAR', 'GL_EYE_PLANE', 'GL_SPHERE_MAP', 'GL_DECAL', 'GL_MODULATE',
+'GL_NEAREST', 'GL_REPEAT', 'GL_CLAMP', 'GL_S', 'GL_T', 'GL_R', 'GL_Q',
+'GL_VENDOR', 'GL_RENDERER', 'GL_VERSION', 'GL_EXTENSIONS', 'GL_NO_ERROR',
+'GL_INVALID_ENUM', 'GL_INVALID_VALUE', 'GL_INVALID_OPERATION',
+'GL_STACK_OVERFLOW', 'GL_STACK_UNDERFLOW', 'GL_OUT_OF_MEMORY',
+'GL_CURRENT_BIT', 'GL_POINT_BIT', 'GL_LINE_BIT', 'GL_POLYGON_BIT',
+'GL_POLYGON_STIPPLE_BIT', 'GL_PIXEL_MODE_BIT', 'GL_LIGHTING_BIT',
+'GL_FOG_BIT', 'GL_DEPTH_BUFFER_BIT', 'GL_ACCUM_BUFFER_BIT',
+'GL_STENCIL_BUFFER_BIT', 'GL_VIEWPORT_BIT', 'GL_TRANSFORM_BIT',
+'GL_ENABLE_BIT', 'GL_COLOR_BUFFER_BIT', 'GL_HINT_BIT', 'GL_EVAL_BIT',
+'GL_LIST_BIT', 'GL_TEXTURE_BIT', 'GL_SCISSOR_BIT', 'GL_ALL_ATTRIB_BITS',
+'GL_PROXY_TEXTURE_1D', 'GL_PROXY_TEXTURE_2D', 'GL_TEXTURE_PRIORITY',
+'GL_TEXTURE_RESIDENT', 'GL_TEXTURE_BINDING_1D', 'GL_TEXTURE_BINDING_2D',
+'GL_TEXTURE_INTERNAL_FORMAT', 'GL_ALPHA4', 'GL_ALPHA8', 'GL_ALPHA12',
+'GL_ALPHA16', 'GL_LUMINANCE4', 'GL_LUMINANCE8', 'GL_LUMINANCE12',
+'GL_LUMINANCE16', 'GL_LUMINANCE4_ALPHA4', 'GL_LUMINANCE6_ALPHA2',
+'GL_LUMINANCE8_ALPHA8', 'GL_LUMINANCE12_ALPHA4', 'GL_LUMINANCE12_ALPHA12',
+'GL_LUMINANCE16_ALPHA16', 'GL_INTENSITY', 'GL_INTENSITY4', 'GL_INTENSITY8',
+'GL_INTENSITY12', 'GL_INTENSITY16', 'GL_R3_G3_B2', 'GL_RGB4', 'GL_RGB5',
+'GL_RGB8', 'GL_RGB10', 'GL_RGB12', 'GL_RGB16', 'GL_RGBA2', 'GL_RGBA4',
+'GL_RGB5_A1', 'GL_RGBA8', 'GL_RGB10_A2', 'GL_RGBA12', 'GL_RGBA16',
+'GL_CLIENT_PIXEL_STORE_BIT', 'GL_CLIENT_VERTEX_ARRAY_BIT',
+'GL_ALL_CLIENT_ATTRIB_BITS', 'GL_CLIENT_ALL_ATTRIB_BITS', 'glClearIndex',
+'glClearColor', 'glClear', 'glIndexMask', 'glColorMask', 'glAlphaFunc',
+'glBlendFunc', 'glLogicOp', 'glCullFace', 'glFrontFace', 'glPointSize',
+'glLineWidth', 'glLineStipple', 'glPolygonMode', 'glPolygonOffset',
+'glPolygonStipple', 'glGetPolygonStipple', 'glEdgeFlag', 'glEdgeFlagv',
+'glScissor', 'glClipPlane', 'glGetClipPlane', 'glDrawBuffer', 'glReadBuffer',
+'glEnable', 'glDisable', 'glIsEnabled', 'glEnableClientState',
+'glDisableClientState', 'glGetBooleanv', 'glGetDoublev', 'glGetFloatv',
+'glGetIntegerv', 'glPushAttrib', 'glPopAttrib', 'glPushClientAttrib',
+'glPopClientAttrib', 'glRenderMode', 'glGetError', 'glGetString', 'glFinish',
+'glFlush', 'glHint', 'glClearDepth', 'glDepthFunc', 'glDepthMask',
+'glDepthRange', 'glClearAccum', 'glAccum', 'glMatrixMode', 'glOrtho',
+'glFrustum', 'glViewport', 'glPushMatrix', 'glPopMatrix', 'glLoadIdentity',
+'glLoadMatrixd', 'glLoadMatrixf', 'glMultMatrixd', 'glMultMatrixf',
+'glRotated', 'glRotatef', 'glScaled', 'glScalef', 'glTranslated',
+'glTranslatef', 'glIsList', 'glDeleteLists', 'glGenLists', 'glNewList',
+'glEndList', 'glCallList', 'glCallLists', 'glListBase', 'glBegin', 'glEnd',
+'glVertex2d', 'glVertex2f', 'glVertex2i', 'glVertex2s', 'glVertex3d',
+'glVertex3f', 'glVertex3i', 'glVertex3s', 'glVertex4d', 'glVertex4f',
+'glVertex4i', 'glVertex4s', 'glVertex2dv', 'glVertex2fv', 'glVertex2iv',
+'glVertex2sv', 'glVertex3dv', 'glVertex3fv', 'glVertex3iv', 'glVertex3sv',
+'glVertex4dv', 'glVertex4fv', 'glVertex4iv', 'glVertex4sv', 'glNormal3b',
+'glNormal3d', 'glNormal3f', 'glNormal3i', 'glNormal3s', 'glNormal3bv',
+'glNormal3dv', 'glNormal3fv', 'glNormal3iv', 'glNormal3sv', 'glIndexd',
+'glIndexf', 'glIndexi', 'glIndexs', 'glIndexub', 'glIndexdv', 'glIndexfv',
+'glIndexiv', 'glIndexsv', 'glIndexubv', 'glColor3b', 'glColor3d', 'glColor3f',
+'glColor3i', 'glColor3s', 'glColor3ub', 'glColor3ui', 'glColor3us',
+'glColor4b', 'glColor4d', 'glColor4f', 'glColor4i', 'glColor4s', 'glColor4ub',
+'glColor4ui', 'glColor4us', 'glColor3bv', 'glColor3dv', 'glColor3fv',
+'glColor3iv', 'glColor3sv', 'glColor3ubv', 'glColor3uiv', 'glColor3usv',
+'glColor4bv', 'glColor4dv', 'glColor4fv', 'glColor4iv', 'glColor4sv',
+'glColor4ubv', 'glColor4uiv', 'glColor4usv', 'glTexCoord1d', 'glTexCoord1f',
+'glTexCoord1i', 'glTexCoord1s', 'glTexCoord2d', 'glTexCoord2f',
+'glTexCoord2i', 'glTexCoord2s', 'glTexCoord3d', 'glTexCoord3f',
+'glTexCoord3i', 'glTexCoord3s', 'glTexCoord4d', 'glTexCoord4f',
+'glTexCoord4i', 'glTexCoord4s', 'glTexCoord1dv', 'glTexCoord1fv',
+'glTexCoord1iv', 'glTexCoord1sv', 'glTexCoord2dv', 'glTexCoord2fv',
+'glTexCoord2iv', 'glTexCoord2sv', 'glTexCoord3dv', 'glTexCoord3fv',
+'glTexCoord3iv', 'glTexCoord3sv', 'glTexCoord4dv', 'glTexCoord4fv',
+'glTexCoord4iv', 'glTexCoord4sv', 'glRasterPos2d', 'glRasterPos2f',
+'glRasterPos2i', 'glRasterPos2s', 'glRasterPos3d', 'glRasterPos3f',
+'glRasterPos3i', 'glRasterPos3s', 'glRasterPos4d', 'glRasterPos4f',
+'glRasterPos4i', 'glRasterPos4s', 'glRasterPos2dv', 'glRasterPos2fv',
+'glRasterPos2iv', 'glRasterPos2sv', 'glRasterPos3dv', 'glRasterPos3fv',
+'glRasterPos3iv', 'glRasterPos3sv', 'glRasterPos4dv', 'glRasterPos4fv',
+'glRasterPos4iv', 'glRasterPos4sv', 'glRectd', 'glRectf', 'glRecti',
+'glRects', 'glRectdv', 'glRectfv', 'glRectiv', 'glRectsv', 'glVertexPointer',
+'glNormalPointer', 'glColorPointer', 'glIndexPointer', 'glTexCoordPointer',
+'glEdgeFlagPointer', 'glGetPointerv', 'glArrayElement', 'glDrawArrays',
+'glDrawElements', 'glInterleavedArrays', 'glShadeModel', 'glLightf',
+'glLighti', 'glLightfv', 'glLightiv', 'glGetLightfv', 'glGetLightiv',
+'glLightModelf', 'glLightModeli', 'glLightModelfv', 'glLightModeliv',
+'glMaterialf', 'glMateriali', 'glMaterialfv', 'glMaterialiv',
+'glGetMaterialfv', 'glGetMaterialiv', 'glColorMaterial', 'glPixelZoom',
+'glPixelStoref', 'glPixelStorei', 'glPixelTransferf', 'glPixelTransferi',
+'glPixelMapfv', 'glPixelMapuiv', 'glPixelMapusv', 'glGetPixelMapfv',
+'glGetPixelMapuiv', 'glGetPixelMapusv', 'glBitmap', 'glReadPixels',
+'glDrawPixels', 'glCopyPixels', 'glStencilFunc', 'glStencilMask',
+'glStencilOp', 'glClearStencil', 'glTexGend', 'glTexGenf', 'glTexGeni',
+'glTexGendv', 'glTexGenfv', 'glTexGeniv', 'glGetTexGendv', 'glGetTexGenfv',
+'glGetTexGeniv', 'glTexEnvf', 'glTexEnvi', 'glTexEnvfv', 'glTexEnviv',
+'glGetTexEnvfv', 'glGetTexEnviv', 'glTexParameterf', 'glTexParameteri',
+'glTexParameterfv', 'glTexParameteriv', 'glGetTexParameterfv',
+'glGetTexParameteriv', 'glGetTexLevelParameterfv', 'glGetTexLevelParameteriv',
+'glTexImage1D', 'glTexImage2D', 'glGetTexImage', 'glGenTextures',
+'glDeleteTextures', 'glBindTexture', 'glPrioritizeTextures',
+'glAreTexturesResident', 'glIsTexture', 'glTexSubImage1D', 'glTexSubImage2D',
+'glCopyTexImage1D', 'glCopyTexImage2D', 'glCopyTexSubImage1D',
+'glCopyTexSubImage2D', 'glMap1d', 'glMap1f', 'glMap2d', 'glMap2f',
+'glGetMapdv', 'glGetMapfv', 'glGetMapiv', 'glEvalCoord1d', 'glEvalCoord1f',
+'glEvalCoord1dv', 'glEvalCoord1fv', 'glEvalCoord2d', 'glEvalCoord2f',
+'glEvalCoord2dv', 'glEvalCoord2fv', 'glMapGrid1d', 'glMapGrid1f',
+'glMapGrid2d', 'glMapGrid2f', 'glEvalPoint1', 'glEvalPoint2', 'glEvalMesh1',
+'glEvalMesh2', 'glFogf', 'glFogi', 'glFogfv', 'glFogiv', 'glFeedbackBuffer',
+'glPassThrough', 'glSelectBuffer', 'glInitNames', 'glLoadName', 'glPushName',
+'glPopName', 'GL_RESCALE_NORMAL', 'GL_CLAMP_TO_EDGE',
+'GL_MAX_ELEMENTS_VERTICES', 'GL_MAX_ELEMENTS_INDICES', 'GL_BGR', 'GL_BGRA',
+'GL_UNSIGNED_BYTE_3_3_2', 'GL_UNSIGNED_BYTE_2_3_3_REV',
+'GL_UNSIGNED_SHORT_5_6_5', 'GL_UNSIGNED_SHORT_5_6_5_REV',
+'GL_UNSIGNED_SHORT_4_4_4_4', 'GL_UNSIGNED_SHORT_4_4_4_4_REV',
+'GL_UNSIGNED_SHORT_5_5_5_1', 'GL_UNSIGNED_SHORT_1_5_5_5_REV',
+'GL_UNSIGNED_INT_8_8_8_8', 'GL_UNSIGNED_INT_8_8_8_8_REV',
+'GL_UNSIGNED_INT_10_10_10_2', 'GL_UNSIGNED_INT_2_10_10_10_REV',
+'GL_LIGHT_MODEL_COLOR_CONTROL', 'GL_SINGLE_COLOR',
+'GL_SEPARATE_SPECULAR_COLOR', 'GL_TEXTURE_MIN_LOD', 'GL_TEXTURE_MAX_LOD',
+'GL_TEXTURE_BASE_LEVEL', 'GL_TEXTURE_MAX_LEVEL', 'GL_SMOOTH_POINT_SIZE_RANGE',
+'GL_SMOOTH_POINT_SIZE_GRANULARITY', 'GL_SMOOTH_LINE_WIDTH_RANGE',
+'GL_SMOOTH_LINE_WIDTH_GRANULARITY', 'GL_ALIASED_POINT_SIZE_RANGE',
+'GL_ALIASED_LINE_WIDTH_RANGE', 'GL_PACK_SKIP_IMAGES', 'GL_PACK_IMAGE_HEIGHT',
+'GL_UNPACK_SKIP_IMAGES', 'GL_UNPACK_IMAGE_HEIGHT', 'GL_TEXTURE_3D',
+'GL_PROXY_TEXTURE_3D', 'GL_TEXTURE_DEPTH', 'GL_TEXTURE_WRAP_R',
+'GL_MAX_3D_TEXTURE_SIZE', 'GL_TEXTURE_BINDING_3D', 'glDrawRangeElements',
+'glTexImage3D', 'glTexSubImage3D', 'glCopyTexSubImage3D',
+'PFNGLDRAWRANGEELEMENTSPROC', 'PFNGLTEXIMAGE3DPROC', 'PFNGLTEXSUBIMAGE3DPROC',
+'PFNGLCOPYTEXSUBIMAGE3DPROC', 'GL_CONSTANT_COLOR',
+'GL_ONE_MINUS_CONSTANT_COLOR', 'GL_CONSTANT_ALPHA',
+'GL_ONE_MINUS_CONSTANT_ALPHA', 'GL_COLOR_TABLE',
+'GL_POST_CONVOLUTION_COLOR_TABLE', 'GL_POST_COLOR_MATRIX_COLOR_TABLE',
+'GL_PROXY_COLOR_TABLE', 'GL_PROXY_POST_CONVOLUTION_COLOR_TABLE',
+'GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE', 'GL_COLOR_TABLE_SCALE',
+'GL_COLOR_TABLE_BIAS', 'GL_COLOR_TABLE_FORMAT', 'GL_COLOR_TABLE_WIDTH',
+'GL_COLOR_TABLE_RED_SIZE', 'GL_COLOR_TABLE_GREEN_SIZE',
+'GL_COLOR_TABLE_BLUE_SIZE', 'GL_COLOR_TABLE_ALPHA_SIZE',
+'GL_COLOR_TABLE_LUMINANCE_SIZE', 'GL_COLOR_TABLE_INTENSITY_SIZE',
+'GL_CONVOLUTION_1D', 'GL_CONVOLUTION_2D', 'GL_SEPARABLE_2D',
+'GL_CONVOLUTION_BORDER_MODE', 'GL_CONVOLUTION_FILTER_SCALE',
+'GL_CONVOLUTION_FILTER_BIAS', 'GL_REDUCE', 'GL_CONVOLUTION_FORMAT',
+'GL_CONVOLUTION_WIDTH', 'GL_CONVOLUTION_HEIGHT', 'GL_MAX_CONVOLUTION_WIDTH',
+'GL_MAX_CONVOLUTION_HEIGHT', 'GL_POST_CONVOLUTION_RED_SCALE',
+'GL_POST_CONVOLUTION_GREEN_SCALE', 'GL_POST_CONVOLUTION_BLUE_SCALE',
+'GL_POST_CONVOLUTION_ALPHA_SCALE', 'GL_POST_CONVOLUTION_RED_BIAS',
+'GL_POST_CONVOLUTION_GREEN_BIAS', 'GL_POST_CONVOLUTION_BLUE_BIAS',
+'GL_POST_CONVOLUTION_ALPHA_BIAS', 'GL_CONSTANT_BORDER', 'GL_REPLICATE_BORDER',
+'GL_CONVOLUTION_BORDER_COLOR', 'GL_COLOR_MATRIX',
+'GL_COLOR_MATRIX_STACK_DEPTH', 'GL_MAX_COLOR_MATRIX_STACK_DEPTH',
+'GL_POST_COLOR_MATRIX_RED_SCALE', 'GL_POST_COLOR_MATRIX_GREEN_SCALE',
+'GL_POST_COLOR_MATRIX_BLUE_SCALE', 'GL_POST_COLOR_MATRIX_ALPHA_SCALE',
+'GL_POST_COLOR_MATRIX_RED_BIAS', 'GL_POST_COLOR_MATRIX_GREEN_BIAS',
+'GL_POST_COLOR_MATRIX_BLUE_BIAS', 'GL_POST_COLOR_MATRIX_ALPHA_BIAS',
+'GL_HISTOGRAM', 'GL_PROXY_HISTOGRAM', 'GL_HISTOGRAM_WIDTH',
+'GL_HISTOGRAM_FORMAT', 'GL_HISTOGRAM_RED_SIZE', 'GL_HISTOGRAM_GREEN_SIZE',
+'GL_HISTOGRAM_BLUE_SIZE', 'GL_HISTOGRAM_ALPHA_SIZE',
+'GL_HISTOGRAM_LUMINANCE_SIZE', 'GL_HISTOGRAM_SINK', 'GL_MINMAX',
+'GL_MINMAX_FORMAT', 'GL_MINMAX_SINK', 'GL_TABLE_TOO_LARGE',
+'GL_BLEND_EQUATION', 'GL_MIN', 'GL_MAX', 'GL_FUNC_ADD', 'GL_FUNC_SUBTRACT',
+'GL_FUNC_REVERSE_SUBTRACT', 'GL_BLEND_COLOR', 'glColorTable',
+'glColorSubTable', 'glColorTableParameteriv', 'glColorTableParameterfv',
+'glCopyColorSubTable', 'glCopyColorTable', 'glGetColorTable',
+'glGetColorTableParameterfv', 'glGetColorTableParameteriv', 'glBlendEquation',
+'glBlendColor', 'glHistogram', 'glResetHistogram', 'glGetHistogram',
+'glGetHistogramParameterfv', 'glGetHistogramParameteriv', 'glMinmax',
+'glResetMinmax', 'glGetMinmax', 'glGetMinmaxParameterfv',
+'glGetMinmaxParameteriv', 'glConvolutionFilter1D', 'glConvolutionFilter2D',
+'glConvolutionParameterf', 'glConvolutionParameterfv',
+'glConvolutionParameteri', 'glConvolutionParameteriv',
+'glCopyConvolutionFilter1D', 'glCopyConvolutionFilter2D',
+'glGetConvolutionFilter', 'glGetConvolutionParameterfv',
+'glGetConvolutionParameteriv', 'glSeparableFilter2D', 'glGetSeparableFilter',
+'PFNGLBLENDCOLORPROC', 'PFNGLBLENDEQUATIONPROC', 'GL_TEXTURE0', 'GL_TEXTURE1',
+'GL_TEXTURE2', 'GL_TEXTURE3', 'GL_TEXTURE4', 'GL_TEXTURE5', 'GL_TEXTURE6',
+'GL_TEXTURE7', 'GL_TEXTURE8', 'GL_TEXTURE9', 'GL_TEXTURE10', 'GL_TEXTURE11',
+'GL_TEXTURE12', 'GL_TEXTURE13', 'GL_TEXTURE14', 'GL_TEXTURE15',
+'GL_TEXTURE16', 'GL_TEXTURE17', 'GL_TEXTURE18', 'GL_TEXTURE19',
+'GL_TEXTURE20', 'GL_TEXTURE21', 'GL_TEXTURE22', 'GL_TEXTURE23',
+'GL_TEXTURE24', 'GL_TEXTURE25', 'GL_TEXTURE26', 'GL_TEXTURE27',
+'GL_TEXTURE28', 'GL_TEXTURE29', 'GL_TEXTURE30', 'GL_TEXTURE31',
+'GL_ACTIVE_TEXTURE', 'GL_CLIENT_ACTIVE_TEXTURE', 'GL_MAX_TEXTURE_UNITS',
+'GL_NORMAL_MAP', 'GL_REFLECTION_MAP', 'GL_TEXTURE_CUBE_MAP',
+'GL_TEXTURE_BINDING_CUBE_MAP', 'GL_TEXTURE_CUBE_MAP_POSITIVE_X',
+'GL_TEXTURE_CUBE_MAP_NEGATIVE_X', 'GL_TEXTURE_CUBE_MAP_POSITIVE_Y',
+'GL_TEXTURE_CUBE_MAP_NEGATIVE_Y', 'GL_TEXTURE_CUBE_MAP_POSITIVE_Z',
+'GL_TEXTURE_CUBE_MAP_NEGATIVE_Z', 'GL_PROXY_TEXTURE_CUBE_MAP',
+'GL_MAX_CUBE_MAP_TEXTURE_SIZE', 'GL_COMPRESSED_ALPHA',
+'GL_COMPRESSED_LUMINANCE', 'GL_COMPRESSED_LUMINANCE_ALPHA',
+'GL_COMPRESSED_INTENSITY', 'GL_COMPRESSED_RGB', 'GL_COMPRESSED_RGBA',
+'GL_TEXTURE_COMPRESSION_HINT', 'GL_TEXTURE_COMPRESSED_IMAGE_SIZE',
+'GL_TEXTURE_COMPRESSED', 'GL_NUM_COMPRESSED_TEXTURE_FORMATS',
+'GL_COMPRESSED_TEXTURE_FORMATS', 'GL_MULTISAMPLE',
+'GL_SAMPLE_ALPHA_TO_COVERAGE', 'GL_SAMPLE_ALPHA_TO_ONE', 'GL_SAMPLE_COVERAGE',
+'GL_SAMPLE_BUFFERS', 'GL_SAMPLES', 'GL_SAMPLE_COVERAGE_VALUE',
+'GL_SAMPLE_COVERAGE_INVERT', 'GL_MULTISAMPLE_BIT',
+'GL_TRANSPOSE_MODELVIEW_MATRIX', 'GL_TRANSPOSE_PROJECTION_MATRIX',
+'GL_TRANSPOSE_TEXTURE_MATRIX', 'GL_TRANSPOSE_COLOR_MATRIX', 'GL_COMBINE',
+'GL_COMBINE_RGB', 'GL_COMBINE_ALPHA', 'GL_SOURCE0_RGB', 'GL_SOURCE1_RGB',
+'GL_SOURCE2_RGB', 'GL_SOURCE0_ALPHA', 'GL_SOURCE1_ALPHA', 'GL_SOURCE2_ALPHA',
+'GL_OPERAND0_RGB', 'GL_OPERAND1_RGB', 'GL_OPERAND2_RGB', 'GL_OPERAND0_ALPHA',
+'GL_OPERAND1_ALPHA', 'GL_OPERAND2_ALPHA', 'GL_RGB_SCALE', 'GL_ADD_SIGNED',
+'GL_INTERPOLATE', 'GL_SUBTRACT', 'GL_CONSTANT', 'GL_PRIMARY_COLOR',
+'GL_PREVIOUS', 'GL_DOT3_RGB', 'GL_DOT3_RGBA', 'GL_CLAMP_TO_BORDER',
+'glActiveTexture', 'glClientActiveTexture', 'glCompressedTexImage1D',
+'glCompressedTexImage2D', 'glCompressedTexImage3D',
+'glCompressedTexSubImage1D', 'glCompressedTexSubImage2D',
+'glCompressedTexSubImage3D', 'glGetCompressedTexImage', 'glMultiTexCoord1d',
+'glMultiTexCoord1dv', 'glMultiTexCoord1f', 'glMultiTexCoord1fv',
+'glMultiTexCoord1i', 'glMultiTexCoord1iv', 'glMultiTexCoord1s',
+'glMultiTexCoord1sv', 'glMultiTexCoord2d', 'glMultiTexCoord2dv',
+'glMultiTexCoord2f', 'glMultiTexCoord2fv', 'glMultiTexCoord2i',
+'glMultiTexCoord2iv', 'glMultiTexCoord2s', 'glMultiTexCoord2sv',
+'glMultiTexCoord3d', 'glMultiTexCoord3dv', 'glMultiTexCoord3f',
+'glMultiTexCoord3fv', 'glMultiTexCoord3i', 'glMultiTexCoord3iv',
+'glMultiTexCoord3s', 'glMultiTexCoord3sv', 'glMultiTexCoord4d',
+'glMultiTexCoord4dv', 'glMultiTexCoord4f', 'glMultiTexCoord4fv',
+'glMultiTexCoord4i', 'glMultiTexCoord4iv', 'glMultiTexCoord4s',
+'glMultiTexCoord4sv', 'glLoadTransposeMatrixd', 'glLoadTransposeMatrixf',
+'glMultTransposeMatrixd', 'glMultTransposeMatrixf', 'glSampleCoverage',
+'PFNGLACTIVETEXTUREPROC', 'PFNGLSAMPLECOVERAGEPROC',
+'PFNGLCOMPRESSEDTEXIMAGE3DPROC', 'PFNGLCOMPRESSEDTEXIMAGE2DPROC',
+'PFNGLCOMPRESSEDTEXIMAGE1DPROC', 'PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC',
+'PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC', 'PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC',
+'PFNGLGETCOMPRESSEDTEXIMAGEPROC', 'GL_ARB_multitexture', 'GL_TEXTURE0_ARB',
+'GL_TEXTURE1_ARB', 'GL_TEXTURE2_ARB', 'GL_TEXTURE3_ARB', 'GL_TEXTURE4_ARB',
+'GL_TEXTURE5_ARB', 'GL_TEXTURE6_ARB', 'GL_TEXTURE7_ARB', 'GL_TEXTURE8_ARB',
+'GL_TEXTURE9_ARB', 'GL_TEXTURE10_ARB', 'GL_TEXTURE11_ARB', 'GL_TEXTURE12_ARB',
+'GL_TEXTURE13_ARB', 'GL_TEXTURE14_ARB', 'GL_TEXTURE15_ARB',
+'GL_TEXTURE16_ARB', 'GL_TEXTURE17_ARB', 'GL_TEXTURE18_ARB',
+'GL_TEXTURE19_ARB', 'GL_TEXTURE20_ARB', 'GL_TEXTURE21_ARB',
+'GL_TEXTURE22_ARB', 'GL_TEXTURE23_ARB', 'GL_TEXTURE24_ARB',
+'GL_TEXTURE25_ARB', 'GL_TEXTURE26_ARB', 'GL_TEXTURE27_ARB',
+'GL_TEXTURE28_ARB', 'GL_TEXTURE29_ARB', 'GL_TEXTURE30_ARB',
+'GL_TEXTURE31_ARB', 'GL_ACTIVE_TEXTURE_ARB', 'GL_CLIENT_ACTIVE_TEXTURE_ARB',
+'GL_MAX_TEXTURE_UNITS_ARB', 'glActiveTextureARB', 'glClientActiveTextureARB',
+'glMultiTexCoord1dARB', 'glMultiTexCoord1dvARB', 'glMultiTexCoord1fARB',
+'glMultiTexCoord1fvARB', 'glMultiTexCoord1iARB', 'glMultiTexCoord1ivARB',
+'glMultiTexCoord1sARB', 'glMultiTexCoord1svARB', 'glMultiTexCoord2dARB',
+'glMultiTexCoord2dvARB', 'glMultiTexCoord2fARB', 'glMultiTexCoord2fvARB',
+'glMultiTexCoord2iARB', 'glMultiTexCoord2ivARB', 'glMultiTexCoord2sARB',
+'glMultiTexCoord2svARB', 'glMultiTexCoord3dARB', 'glMultiTexCoord3dvARB',
+'glMultiTexCoord3fARB', 'glMultiTexCoord3fvARB', 'glMultiTexCoord3iARB',
+'glMultiTexCoord3ivARB', 'glMultiTexCoord3sARB', 'glMultiTexCoord3svARB',
+'glMultiTexCoord4dARB', 'glMultiTexCoord4dvARB', 'glMultiTexCoord4fARB',
+'glMultiTexCoord4fvARB', 'glMultiTexCoord4iARB', 'glMultiTexCoord4ivARB',
+'glMultiTexCoord4sARB', 'glMultiTexCoord4svARB', 'PFNGLACTIVETEXTUREARBPROC',
+'PFNGLCLIENTACTIVETEXTUREARBPROC', 'PFNGLMULTITEXCOORD1DARBPROC',
+'PFNGLMULTITEXCOORD1DVARBPROC', 'PFNGLMULTITEXCOORD1FARBPROC',
+'PFNGLMULTITEXCOORD1FVARBPROC', 'PFNGLMULTITEXCOORD1IARBPROC',
+'PFNGLMULTITEXCOORD1IVARBPROC', 'PFNGLMULTITEXCOORD1SARBPROC',
+'PFNGLMULTITEXCOORD1SVARBPROC', 'PFNGLMULTITEXCOORD2DARBPROC',
+'PFNGLMULTITEXCOORD2DVARBPROC', 'PFNGLMULTITEXCOORD2FARBPROC',
+'PFNGLMULTITEXCOORD2FVARBPROC', 'PFNGLMULTITEXCOORD2IARBPROC',
+'PFNGLMULTITEXCOORD2IVARBPROC', 'PFNGLMULTITEXCOORD2SARBPROC',
+'PFNGLMULTITEXCOORD2SVARBPROC', 'PFNGLMULTITEXCOORD3DARBPROC',
+'PFNGLMULTITEXCOORD3DVARBPROC', 'PFNGLMULTITEXCOORD3FARBPROC',
+'PFNGLMULTITEXCOORD3FVARBPROC', 'PFNGLMULTITEXCOORD3IARBPROC',
+'PFNGLMULTITEXCOORD3IVARBPROC', 'PFNGLMULTITEXCOORD3SARBPROC',
+'PFNGLMULTITEXCOORD3SVARBPROC', 'PFNGLMULTITEXCOORD4DARBPROC',
+'PFNGLMULTITEXCOORD4DVARBPROC', 'PFNGLMULTITEXCOORD4FARBPROC',
+'PFNGLMULTITEXCOORD4FVARBPROC', 'PFNGLMULTITEXCOORD4IARBPROC',
+'PFNGLMULTITEXCOORD4IVARBPROC', 'PFNGLMULTITEXCOORD4SARBPROC',
+'PFNGLMULTITEXCOORD4SVARBPROC', 'GL_MESA_shader_debug',
+'GL_DEBUG_OBJECT_MESA', 'GL_DEBUG_PRINT_MESA', 'GL_DEBUG_ASSERT_MESA',
+'glCreateDebugObjectMESA', 'glClearDebugLogMESA', 'glGetDebugLogMESA',
+'glGetDebugLogLengthMESA', 'GL_MESA_packed_depth_stencil',
+'GL_DEPTH_STENCIL_MESA', 'GL_UNSIGNED_INT_24_8_MESA',
+'GL_UNSIGNED_INT_8_24_REV_MESA', 'GL_UNSIGNED_SHORT_15_1_MESA',
+'GL_UNSIGNED_SHORT_1_15_REV_MESA', 'GL_MESA_program_debug',
+'GL_FRAGMENT_PROGRAM_POSITION_MESA', 'GL_FRAGMENT_PROGRAM_CALLBACK_MESA',
+'GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA',
+'GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA', 'GL_VERTEX_PROGRAM_POSITION_MESA',
+'GL_VERTEX_PROGRAM_CALLBACK_MESA', 'GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA',
+'GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA', 'GLprogramcallbackMESA',
+'glProgramCallbackMESA', 'glGetProgramRegisterfvMESA',
+'GL_MESA_texture_array', 'GL_ATI_blend_equation_separate',
+'GL_ALPHA_BLEND_EQUATION_ATI', 'glBlendEquationSeparateATI',
+'PFNGLBLENDEQUATIONSEPARATEATIPROC', 'GLeglImageOES', 'GL_OES_EGL_image',
+'PFNGLEGLIMAGETARGETTEXTURE2DOESPROC',
+'PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC']
+# END GENERATED CONTENT (do not edit above this line)
+
+
+
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/gl_info.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/gl_info.py
new file mode 100644
index 0000000..bcb8aa6
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/gl_info.py
@@ -0,0 +1,211 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Information about version and extensions of current GL implementation.
+
+Usage::
+
+ from pyglet.gl import gl_info
+
+ if gl_info.have_extension('GL_NV_register_combiners'):
+ # ...
+
+If you are using more than one context, you can set up a separate GLInfo
+object for each context. Call `set_active_context` after switching to the
+context::
+
+ from pyglet.gl.gl_info import GLInfo
+
+ info = GLInfo()
+ info.set_active_context()
+
+ if info.have_version(2, 1):
+ # ...
+
+'''
+from builtins import range
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+from ctypes import *
+import warnings
+
+from pyglet.gl.gl import *
+from pyglet.compat import asstr
+
+class GLInfo(object):
+ '''Information interface for a single GL context.
+
+ A default instance is created automatically when the first OpenGL context
+ is created. You can use the module functions as a convenience for
+ this default instance's methods.
+
+ If you are using more than one context, you must call `set_active_context`
+ when the context is active for this `GLInfo` instance.
+ '''
+ have_context = False
+ version = '0.0.0'
+ vendor = ''
+ renderer = ''
+ extensions = set()
+
+ _have_info = False
+
+ def set_active_context(self):
+ '''Store information for the currently active context.
+
+ This method is called automatically for the default context.
+ '''
+ self.have_context = True
+ if not self._have_info:
+ self.vendor = asstr(cast(glGetString(GL_VENDOR), c_char_p).value)
+ self.renderer = asstr(cast(glGetString(GL_RENDERER),
+ c_char_p).value)
+ self.version = asstr(cast(glGetString(GL_VERSION), c_char_p).value)
+ if self.have_version(3):
+ from pyglet.gl.glext_arb import glGetStringi, GL_NUM_EXTENSIONS
+ num_extensions = GLint()
+ glGetIntegerv(GL_NUM_EXTENSIONS, num_extensions)
+ self.extensions = (asstr(cast(glGetStringi(GL_EXTENSIONS, i),
+ c_char_p).value) for i in range(num_extensions.value))
+ else:
+ self.extensions = asstr(cast(glGetString(GL_EXTENSIONS),
+ c_char_p).value).split()
+ if self.extensions:
+ self.extensions = set(self.extensions)
+ self._have_info = True
+
+ def remove_active_context(self):
+ self.have_context = False
+ self._have_info = False
+
+ def have_extension(self, extension):
+ '''Determine if an OpenGL extension is available.
+
+ :Parameters:
+ `extension` : str
+ The name of the extension to test for, including its
+ ``GL_`` prefix.
+
+ :return: True if the extension is provided by the driver.
+ :rtype: bool
+ '''
+ if not self.have_context:
+ warnings.warn('No GL context created yet.')
+ return extension in self.extensions
+
+ def get_extensions(self):
+ '''Get a list of available OpenGL extensions.
+
+ :return: a list of the available extensions.
+ :rtype: list of str
+ '''
+ if not self.have_context:
+ warnings.warn('No GL context created yet.')
+ return self.extensions
+
+ def get_version(self):
+ '''Get the current OpenGL version.
+
+ :return: the OpenGL version
+ :rtype: str
+ '''
+ if not self.have_context:
+ warnings.warn('No GL context created yet.')
+ return self.version
+
+ def have_version(self, major, minor=0, release=0):
+ '''Determine if a version of OpenGL is supported.
+
+ :Parameters:
+ `major` : int
+ The major revision number (typically 1 or 2).
+ `minor` : int
+ The minor revision number.
+ `release` : int
+ The release number.
+
+ :rtype: bool
+ :return: True if the requested or a later version is supported.
+ '''
+
+ if not self.have_context:
+ warnings.warn('No GL context created yet.')
+ if 'None' in self.version:
+ return False
+ ver = '%s.0.0' % self.version.split(' ', 1)[0]
+ imajor, iminor, irelease = [int(v) for v in ver.split('.', 3)[:3]]
+ return imajor > major or \
+ (imajor == major and iminor > minor) or \
+ (imajor == major and iminor == minor and irelease >= release)
+
+ def get_renderer(self):
+ '''Determine the renderer string of the OpenGL context.
+
+ :rtype: str
+ '''
+ if not self.have_context:
+ warnings.warn('No GL context created yet.')
+ return self.renderer
+
+ def get_vendor(self):
+ '''Determine the vendor string of the OpenGL context.
+
+ :rtype: str
+ '''
+ if not self.have_context:
+ warnings.warn('No GL context created yet.')
+ return self.vendor
+
+# Single instance useful for apps with only a single context (or all contexts
+# have same GL driver, common case).
+_gl_info = GLInfo()
+
+set_active_context = _gl_info.set_active_context
+remove_active_context = _gl_info.remove_active_context
+have_extension = _gl_info.have_extension
+get_extensions = _gl_info.get_extensions
+get_version = _gl_info.get_version
+have_version = _gl_info.have_version
+get_renderer = _gl_info.get_renderer
+get_vendor = _gl_info.get_vendor
+
+def have_context():
+ '''Determine if a default OpenGL context has been set yet.
+
+ :rtype: bool
+ '''
+ return _gl_info.have_context
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glext_arb.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glext_arb.py
new file mode 100644
index 0000000..0725ea5
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glext_arb.py
@@ -0,0 +1,16212 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+'''Wrapper for http://oss.sgi.com/projects/ogl-sample/ABI/glext.h
+
+Generated by tools/gengl.py.
+Do not modify this file.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+from ctypes import *
+from pyglet.gl.lib import link_GL as _link_function
+from pyglet.gl.lib import c_ptrdiff_t
+
+# BEGIN GENERATED CONTENT (do not edit below this line)
+
+# This content is generated by gengl.py.
+# Wrapper for http://www.opengl.org/registry/api/glext.h
+
+
+# ARB_multitexture (/usr/include/GL/gl.h:1962)
+GL_GLEXT_VERSION = 82 # GL/glext.h:34
+# VERSION_1_2 (GL/glext.h:54)
+# VERSION_1_2_DEPRECATED (GL/glext.h:93)
+GL_RESCALE_NORMAL = 32826 # GL/glext.h:94
+GL_LIGHT_MODEL_COLOR_CONTROL = 33272 # GL/glext.h:95
+GL_SINGLE_COLOR = 33273 # GL/glext.h:96
+GL_SEPARATE_SPECULAR_COLOR = 33274 # GL/glext.h:97
+GL_ALIASED_POINT_SIZE_RANGE = 33901 # GL/glext.h:98
+# ARB_imaging (GL/glext.h:101)
+# ARB_imaging_DEPRECATED (GL/glext.h:115)
+GL_CONVOLUTION_1D = 32784 # GL/glext.h:116
+GL_CONVOLUTION_2D = 32785 # GL/glext.h:117
+GL_SEPARABLE_2D = 32786 # GL/glext.h:118
+GL_CONVOLUTION_BORDER_MODE = 32787 # GL/glext.h:119
+GL_CONVOLUTION_FILTER_SCALE = 32788 # GL/glext.h:120
+GL_CONVOLUTION_FILTER_BIAS = 32789 # GL/glext.h:121
+GL_REDUCE = 32790 # GL/glext.h:122
+GL_CONVOLUTION_FORMAT = 32791 # GL/glext.h:123
+GL_CONVOLUTION_WIDTH = 32792 # GL/glext.h:124
+GL_CONVOLUTION_HEIGHT = 32793 # GL/glext.h:125
+GL_MAX_CONVOLUTION_WIDTH = 32794 # GL/glext.h:126
+GL_MAX_CONVOLUTION_HEIGHT = 32795 # GL/glext.h:127
+GL_POST_CONVOLUTION_RED_SCALE = 32796 # GL/glext.h:128
+GL_POST_CONVOLUTION_GREEN_SCALE = 32797 # GL/glext.h:129
+GL_POST_CONVOLUTION_BLUE_SCALE = 32798 # GL/glext.h:130
+GL_POST_CONVOLUTION_ALPHA_SCALE = 32799 # GL/glext.h:131
+GL_POST_CONVOLUTION_RED_BIAS = 32800 # GL/glext.h:132
+GL_POST_CONVOLUTION_GREEN_BIAS = 32801 # GL/glext.h:133
+GL_POST_CONVOLUTION_BLUE_BIAS = 32802 # GL/glext.h:134
+GL_POST_CONVOLUTION_ALPHA_BIAS = 32803 # GL/glext.h:135
+GL_HISTOGRAM = 32804 # GL/glext.h:136
+GL_PROXY_HISTOGRAM = 32805 # GL/glext.h:137
+GL_HISTOGRAM_WIDTH = 32806 # GL/glext.h:138
+GL_HISTOGRAM_FORMAT = 32807 # GL/glext.h:139
+GL_HISTOGRAM_RED_SIZE = 32808 # GL/glext.h:140
+GL_HISTOGRAM_GREEN_SIZE = 32809 # GL/glext.h:141
+GL_HISTOGRAM_BLUE_SIZE = 32810 # GL/glext.h:142
+GL_HISTOGRAM_ALPHA_SIZE = 32811 # GL/glext.h:143
+GL_HISTOGRAM_LUMINANCE_SIZE = 32812 # GL/glext.h:144
+GL_HISTOGRAM_SINK = 32813 # GL/glext.h:145
+GL_MINMAX = 32814 # GL/glext.h:146
+GL_MINMAX_FORMAT = 32815 # GL/glext.h:147
+GL_MINMAX_SINK = 32816 # GL/glext.h:148
+GL_TABLE_TOO_LARGE = 32817 # GL/glext.h:149
+GL_COLOR_MATRIX = 32945 # GL/glext.h:150
+GL_COLOR_MATRIX_STACK_DEPTH = 32946 # GL/glext.h:151
+GL_MAX_COLOR_MATRIX_STACK_DEPTH = 32947 # GL/glext.h:152
+GL_POST_COLOR_MATRIX_RED_SCALE = 32948 # GL/glext.h:153
+GL_POST_COLOR_MATRIX_GREEN_SCALE = 32949 # GL/glext.h:154
+GL_POST_COLOR_MATRIX_BLUE_SCALE = 32950 # GL/glext.h:155
+GL_POST_COLOR_MATRIX_ALPHA_SCALE = 32951 # GL/glext.h:156
+GL_POST_COLOR_MATRIX_RED_BIAS = 32952 # GL/glext.h:157
+GL_POST_COLOR_MATRIX_GREEN_BIAS = 32953 # GL/glext.h:158
+GL_POST_COLOR_MATRIX_BLUE_BIAS = 32954 # GL/glext.h:159
+GL_POST_COLOR_MATRIX_ALPHA_BIAS = 32955 # GL/glext.h:160
+GL_COLOR_TABLE = 32976 # GL/glext.h:161
+GL_POST_CONVOLUTION_COLOR_TABLE = 32977 # GL/glext.h:162
+GL_POST_COLOR_MATRIX_COLOR_TABLE = 32978 # GL/glext.h:163
+GL_PROXY_COLOR_TABLE = 32979 # GL/glext.h:164
+GL_PROXY_POST_CONVOLUTION_COLOR_TABLE = 32980 # GL/glext.h:165
+GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE = 32981 # GL/glext.h:166
+GL_COLOR_TABLE_SCALE = 32982 # GL/glext.h:167
+GL_COLOR_TABLE_BIAS = 32983 # GL/glext.h:168
+GL_COLOR_TABLE_FORMAT = 32984 # GL/glext.h:169
+GL_COLOR_TABLE_WIDTH = 32985 # GL/glext.h:170
+GL_COLOR_TABLE_RED_SIZE = 32986 # GL/glext.h:171
+GL_COLOR_TABLE_GREEN_SIZE = 32987 # GL/glext.h:172
+GL_COLOR_TABLE_BLUE_SIZE = 32988 # GL/glext.h:173
+GL_COLOR_TABLE_ALPHA_SIZE = 32989 # GL/glext.h:174
+GL_COLOR_TABLE_LUMINANCE_SIZE = 32990 # GL/glext.h:175
+GL_COLOR_TABLE_INTENSITY_SIZE = 32991 # GL/glext.h:176
+GL_CONSTANT_BORDER = 33105 # GL/glext.h:177
+GL_REPLICATE_BORDER = 33107 # GL/glext.h:178
+GL_CONVOLUTION_BORDER_COLOR = 33108 # GL/glext.h:179
+# VERSION_1_3 (GL/glext.h:182)
+# VERSION_1_3_DEPRECATED (GL/glext.h:244)
+GL_CLIENT_ACTIVE_TEXTURE = 34017 # GL/glext.h:245
+GL_MAX_TEXTURE_UNITS = 34018 # GL/glext.h:246
+GL_TRANSPOSE_MODELVIEW_MATRIX = 34019 # GL/glext.h:247
+GL_TRANSPOSE_PROJECTION_MATRIX = 34020 # GL/glext.h:248
+GL_TRANSPOSE_TEXTURE_MATRIX = 34021 # GL/glext.h:249
+GL_TRANSPOSE_COLOR_MATRIX = 34022 # GL/glext.h:250
+GL_MULTISAMPLE_BIT = 536870912 # GL/glext.h:251
+GL_NORMAL_MAP = 34065 # GL/glext.h:252
+GL_REFLECTION_MAP = 34066 # GL/glext.h:253
+GL_COMPRESSED_ALPHA = 34025 # GL/glext.h:254
+GL_COMPRESSED_LUMINANCE = 34026 # GL/glext.h:255
+GL_COMPRESSED_LUMINANCE_ALPHA = 34027 # GL/glext.h:256
+GL_COMPRESSED_INTENSITY = 34028 # GL/glext.h:257
+GL_COMBINE = 34160 # GL/glext.h:258
+GL_COMBINE_RGB = 34161 # GL/glext.h:259
+GL_COMBINE_ALPHA = 34162 # GL/glext.h:260
+GL_SOURCE0_RGB = 34176 # GL/glext.h:261
+GL_SOURCE1_RGB = 34177 # GL/glext.h:262
+GL_SOURCE2_RGB = 34178 # GL/glext.h:263
+GL_SOURCE0_ALPHA = 34184 # GL/glext.h:264
+GL_SOURCE1_ALPHA = 34185 # GL/glext.h:265
+GL_SOURCE2_ALPHA = 34186 # GL/glext.h:266
+GL_OPERAND0_RGB = 34192 # GL/glext.h:267
+GL_OPERAND1_RGB = 34193 # GL/glext.h:268
+GL_OPERAND2_RGB = 34194 # GL/glext.h:269
+GL_OPERAND0_ALPHA = 34200 # GL/glext.h:270
+GL_OPERAND1_ALPHA = 34201 # GL/glext.h:271
+GL_OPERAND2_ALPHA = 34202 # GL/glext.h:272
+GL_RGB_SCALE = 34163 # GL/glext.h:273
+GL_ADD_SIGNED = 34164 # GL/glext.h:274
+GL_INTERPOLATE = 34165 # GL/glext.h:275
+GL_SUBTRACT = 34023 # GL/glext.h:276
+GL_CONSTANT = 34166 # GL/glext.h:277
+GL_PRIMARY_COLOR = 34167 # GL/glext.h:278
+GL_PREVIOUS = 34168 # GL/glext.h:279
+GL_DOT3_RGB = 34478 # GL/glext.h:280
+GL_DOT3_RGBA = 34479 # GL/glext.h:281
+# VERSION_1_4 (GL/glext.h:284)
+GL_BLEND_DST_RGB = 32968 # GL/glext.h:285
+GL_BLEND_SRC_RGB = 32969 # GL/glext.h:286
+GL_BLEND_DST_ALPHA = 32970 # GL/glext.h:287
+GL_BLEND_SRC_ALPHA = 32971 # GL/glext.h:288
+GL_POINT_FADE_THRESHOLD_SIZE = 33064 # GL/glext.h:289
+GL_DEPTH_COMPONENT16 = 33189 # GL/glext.h:290
+GL_DEPTH_COMPONENT24 = 33190 # GL/glext.h:291
+GL_DEPTH_COMPONENT32 = 33191 # GL/glext.h:292
+GL_MIRRORED_REPEAT = 33648 # GL/glext.h:293
+GL_MAX_TEXTURE_LOD_BIAS = 34045 # GL/glext.h:294
+GL_TEXTURE_LOD_BIAS = 34049 # GL/glext.h:295
+GL_INCR_WRAP = 34055 # GL/glext.h:296
+GL_DECR_WRAP = 34056 # GL/glext.h:297
+GL_TEXTURE_DEPTH_SIZE = 34890 # GL/glext.h:298
+GL_TEXTURE_COMPARE_MODE = 34892 # GL/glext.h:299
+GL_TEXTURE_COMPARE_FUNC = 34893 # GL/glext.h:300
+# VERSION_1_4_DEPRECATED (GL/glext.h:303)
+GL_POINT_SIZE_MIN = 33062 # GL/glext.h:304
+GL_POINT_SIZE_MAX = 33063 # GL/glext.h:305
+GL_POINT_DISTANCE_ATTENUATION = 33065 # GL/glext.h:306
+GL_GENERATE_MIPMAP = 33169 # GL/glext.h:307
+GL_GENERATE_MIPMAP_HINT = 33170 # GL/glext.h:308
+GL_FOG_COORDINATE_SOURCE = 33872 # GL/glext.h:309
+GL_FOG_COORDINATE = 33873 # GL/glext.h:310
+GL_FRAGMENT_DEPTH = 33874 # GL/glext.h:311
+GL_CURRENT_FOG_COORDINATE = 33875 # GL/glext.h:312
+GL_FOG_COORDINATE_ARRAY_TYPE = 33876 # GL/glext.h:313
+GL_FOG_COORDINATE_ARRAY_STRIDE = 33877 # GL/glext.h:314
+GL_FOG_COORDINATE_ARRAY_POINTER = 33878 # GL/glext.h:315
+GL_FOG_COORDINATE_ARRAY = 33879 # GL/glext.h:316
+GL_COLOR_SUM = 33880 # GL/glext.h:317
+GL_CURRENT_SECONDARY_COLOR = 33881 # GL/glext.h:318
+GL_SECONDARY_COLOR_ARRAY_SIZE = 33882 # GL/glext.h:319
+GL_SECONDARY_COLOR_ARRAY_TYPE = 33883 # GL/glext.h:320
+GL_SECONDARY_COLOR_ARRAY_STRIDE = 33884 # GL/glext.h:321
+GL_SECONDARY_COLOR_ARRAY_POINTER = 33885 # GL/glext.h:322
+GL_SECONDARY_COLOR_ARRAY = 33886 # GL/glext.h:323
+GL_TEXTURE_FILTER_CONTROL = 34048 # GL/glext.h:324
+GL_DEPTH_TEXTURE_MODE = 34891 # GL/glext.h:325
+GL_COMPARE_R_TO_TEXTURE = 34894 # GL/glext.h:326
+# VERSION_1_5 (GL/glext.h:329)
+GL_BUFFER_SIZE = 34660 # GL/glext.h:330
+GL_BUFFER_USAGE = 34661 # GL/glext.h:331
+GL_QUERY_COUNTER_BITS = 34916 # GL/glext.h:332
+GL_CURRENT_QUERY = 34917 # GL/glext.h:333
+GL_QUERY_RESULT = 34918 # GL/glext.h:334
+GL_QUERY_RESULT_AVAILABLE = 34919 # GL/glext.h:335
+GL_ARRAY_BUFFER = 34962 # GL/glext.h:336
+GL_ELEMENT_ARRAY_BUFFER = 34963 # GL/glext.h:337
+GL_ARRAY_BUFFER_BINDING = 34964 # GL/glext.h:338
+GL_ELEMENT_ARRAY_BUFFER_BINDING = 34965 # GL/glext.h:339
+GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 34975 # GL/glext.h:340
+GL_READ_ONLY = 35000 # GL/glext.h:341
+GL_WRITE_ONLY = 35001 # GL/glext.h:342
+GL_READ_WRITE = 35002 # GL/glext.h:343
+GL_BUFFER_ACCESS = 35003 # GL/glext.h:344
+GL_BUFFER_MAPPED = 35004 # GL/glext.h:345
+GL_BUFFER_MAP_POINTER = 35005 # GL/glext.h:346
+GL_STREAM_DRAW = 35040 # GL/glext.h:347
+GL_STREAM_READ = 35041 # GL/glext.h:348
+GL_STREAM_COPY = 35042 # GL/glext.h:349
+GL_STATIC_DRAW = 35044 # GL/glext.h:350
+GL_STATIC_READ = 35045 # GL/glext.h:351
+GL_STATIC_COPY = 35046 # GL/glext.h:352
+GL_DYNAMIC_DRAW = 35048 # GL/glext.h:353
+GL_DYNAMIC_READ = 35049 # GL/glext.h:354
+GL_DYNAMIC_COPY = 35050 # GL/glext.h:355
+GL_SAMPLES_PASSED = 35092 # GL/glext.h:356
+# VERSION_1_5_DEPRECATED (GL/glext.h:359)
+GL_VERTEX_ARRAY_BUFFER_BINDING = 34966 # GL/glext.h:360
+GL_NORMAL_ARRAY_BUFFER_BINDING = 34967 # GL/glext.h:361
+GL_COLOR_ARRAY_BUFFER_BINDING = 34968 # GL/glext.h:362
+GL_INDEX_ARRAY_BUFFER_BINDING = 34969 # GL/glext.h:363
+GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = 34970 # GL/glext.h:364
+GL_EDGE_FLAG_ARRAY_BUFFER_BINDING = 34971 # GL/glext.h:365
+GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING = 34972 # GL/glext.h:366
+GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING = 34973 # GL/glext.h:367
+GL_WEIGHT_ARRAY_BUFFER_BINDING = 34974 # GL/glext.h:368
+GL_FOG_COORD_SRC = 33872 # GL/glext.h:369
+GL_FOG_COORD = 33873 # GL/glext.h:370
+GL_CURRENT_FOG_COORD = 33875 # GL/glext.h:371
+GL_FOG_COORD_ARRAY_TYPE = 33876 # GL/glext.h:372
+GL_FOG_COORD_ARRAY_STRIDE = 33877 # GL/glext.h:373
+GL_FOG_COORD_ARRAY_POINTER = 33878 # GL/glext.h:374
+GL_FOG_COORD_ARRAY = 33879 # GL/glext.h:375
+GL_FOG_COORD_ARRAY_BUFFER_BINDING = 34973 # GL/glext.h:376
+GL_SRC0_RGB = 34176 # GL/glext.h:377
+GL_SRC1_RGB = 34177 # GL/glext.h:378
+GL_SRC2_RGB = 34178 # GL/glext.h:379
+GL_SRC0_ALPHA = 34184 # GL/glext.h:380
+GL_SRC1_ALPHA = 34185 # GL/glext.h:381
+GL_SRC2_ALPHA = 34186 # GL/glext.h:382
+# VERSION_2_0 (GL/glext.h:385)
+GL_BLEND_EQUATION_RGB = 32777 # GL/glext.h:386
+GL_VERTEX_ATTRIB_ARRAY_ENABLED = 34338 # GL/glext.h:387
+GL_VERTEX_ATTRIB_ARRAY_SIZE = 34339 # GL/glext.h:388
+GL_VERTEX_ATTRIB_ARRAY_STRIDE = 34340 # GL/glext.h:389
+GL_VERTEX_ATTRIB_ARRAY_TYPE = 34341 # GL/glext.h:390
+GL_CURRENT_VERTEX_ATTRIB = 34342 # GL/glext.h:391
+GL_VERTEX_PROGRAM_POINT_SIZE = 34370 # GL/glext.h:392
+GL_VERTEX_ATTRIB_ARRAY_POINTER = 34373 # GL/glext.h:393
+GL_STENCIL_BACK_FUNC = 34816 # GL/glext.h:394
+GL_STENCIL_BACK_FAIL = 34817 # GL/glext.h:395
+GL_STENCIL_BACK_PASS_DEPTH_FAIL = 34818 # GL/glext.h:396
+GL_STENCIL_BACK_PASS_DEPTH_PASS = 34819 # GL/glext.h:397
+GL_MAX_DRAW_BUFFERS = 34852 # GL/glext.h:398
+GL_DRAW_BUFFER0 = 34853 # GL/glext.h:399
+GL_DRAW_BUFFER1 = 34854 # GL/glext.h:400
+GL_DRAW_BUFFER2 = 34855 # GL/glext.h:401
+GL_DRAW_BUFFER3 = 34856 # GL/glext.h:402
+GL_DRAW_BUFFER4 = 34857 # GL/glext.h:403
+GL_DRAW_BUFFER5 = 34858 # GL/glext.h:404
+GL_DRAW_BUFFER6 = 34859 # GL/glext.h:405
+GL_DRAW_BUFFER7 = 34860 # GL/glext.h:406
+GL_DRAW_BUFFER8 = 34861 # GL/glext.h:407
+GL_DRAW_BUFFER9 = 34862 # GL/glext.h:408
+GL_DRAW_BUFFER10 = 34863 # GL/glext.h:409
+GL_DRAW_BUFFER11 = 34864 # GL/glext.h:410
+GL_DRAW_BUFFER12 = 34865 # GL/glext.h:411
+GL_DRAW_BUFFER13 = 34866 # GL/glext.h:412
+GL_DRAW_BUFFER14 = 34867 # GL/glext.h:413
+GL_DRAW_BUFFER15 = 34868 # GL/glext.h:414
+GL_BLEND_EQUATION_ALPHA = 34877 # GL/glext.h:415
+GL_MAX_VERTEX_ATTRIBS = 34921 # GL/glext.h:416
+GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = 34922 # GL/glext.h:417
+GL_MAX_TEXTURE_IMAGE_UNITS = 34930 # GL/glext.h:418
+GL_FRAGMENT_SHADER = 35632 # GL/glext.h:419
+GL_VERTEX_SHADER = 35633 # GL/glext.h:420
+GL_MAX_FRAGMENT_UNIFORM_COMPONENTS = 35657 # GL/glext.h:421
+GL_MAX_VERTEX_UNIFORM_COMPONENTS = 35658 # GL/glext.h:422
+GL_MAX_VARYING_FLOATS = 35659 # GL/glext.h:423
+GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 35660 # GL/glext.h:424
+GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 35661 # GL/glext.h:425
+GL_SHADER_TYPE = 35663 # GL/glext.h:426
+GL_FLOAT_VEC2 = 35664 # GL/glext.h:427
+GL_FLOAT_VEC3 = 35665 # GL/glext.h:428
+GL_FLOAT_VEC4 = 35666 # GL/glext.h:429
+GL_INT_VEC2 = 35667 # GL/glext.h:430
+GL_INT_VEC3 = 35668 # GL/glext.h:431
+GL_INT_VEC4 = 35669 # GL/glext.h:432
+GL_BOOL = 35670 # GL/glext.h:433
+GL_BOOL_VEC2 = 35671 # GL/glext.h:434
+GL_BOOL_VEC3 = 35672 # GL/glext.h:435
+GL_BOOL_VEC4 = 35673 # GL/glext.h:436
+GL_FLOAT_MAT2 = 35674 # GL/glext.h:437
+GL_FLOAT_MAT3 = 35675 # GL/glext.h:438
+GL_FLOAT_MAT4 = 35676 # GL/glext.h:439
+GL_SAMPLER_1D = 35677 # GL/glext.h:440
+GL_SAMPLER_2D = 35678 # GL/glext.h:441
+GL_SAMPLER_3D = 35679 # GL/glext.h:442
+GL_SAMPLER_CUBE = 35680 # GL/glext.h:443
+GL_SAMPLER_1D_SHADOW = 35681 # GL/glext.h:444
+GL_SAMPLER_2D_SHADOW = 35682 # GL/glext.h:445
+GL_DELETE_STATUS = 35712 # GL/glext.h:446
+GL_COMPILE_STATUS = 35713 # GL/glext.h:447
+GL_LINK_STATUS = 35714 # GL/glext.h:448
+GL_VALIDATE_STATUS = 35715 # GL/glext.h:449
+GL_INFO_LOG_LENGTH = 35716 # GL/glext.h:450
+GL_ATTACHED_SHADERS = 35717 # GL/glext.h:451
+GL_ACTIVE_UNIFORMS = 35718 # GL/glext.h:452
+GL_ACTIVE_UNIFORM_MAX_LENGTH = 35719 # GL/glext.h:453
+GL_SHADER_SOURCE_LENGTH = 35720 # GL/glext.h:454
+GL_ACTIVE_ATTRIBUTES = 35721 # GL/glext.h:455
+GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 35722 # GL/glext.h:456
+GL_FRAGMENT_SHADER_DERIVATIVE_HINT = 35723 # GL/glext.h:457
+GL_SHADING_LANGUAGE_VERSION = 35724 # GL/glext.h:458
+GL_CURRENT_PROGRAM = 35725 # GL/glext.h:459
+GL_POINT_SPRITE_COORD_ORIGIN = 36000 # GL/glext.h:460
+GL_LOWER_LEFT = 36001 # GL/glext.h:461
+GL_UPPER_LEFT = 36002 # GL/glext.h:462
+GL_STENCIL_BACK_REF = 36003 # GL/glext.h:463
+GL_STENCIL_BACK_VALUE_MASK = 36004 # GL/glext.h:464
+GL_STENCIL_BACK_WRITEMASK = 36005 # GL/glext.h:465
+# VERSION_2_0_DEPRECATED (GL/glext.h:468)
+GL_VERTEX_PROGRAM_TWO_SIDE = 34371 # GL/glext.h:469
+GL_POINT_SPRITE = 34913 # GL/glext.h:470
+GL_COORD_REPLACE = 34914 # GL/glext.h:471
+GL_MAX_TEXTURE_COORDS = 34929 # GL/glext.h:472
+# VERSION_2_1 (GL/glext.h:475)
+GL_PIXEL_PACK_BUFFER = 35051 # GL/glext.h:476
+GL_PIXEL_UNPACK_BUFFER = 35052 # GL/glext.h:477
+GL_PIXEL_PACK_BUFFER_BINDING = 35053 # GL/glext.h:478
+GL_PIXEL_UNPACK_BUFFER_BINDING = 35055 # GL/glext.h:479
+GL_FLOAT_MAT2x3 = 35685 # GL/glext.h:480
+GL_FLOAT_MAT2x4 = 35686 # GL/glext.h:481
+GL_FLOAT_MAT3x2 = 35687 # GL/glext.h:482
+GL_FLOAT_MAT3x4 = 35688 # GL/glext.h:483
+GL_FLOAT_MAT4x2 = 35689 # GL/glext.h:484
+GL_FLOAT_MAT4x3 = 35690 # GL/glext.h:485
+GL_SRGB = 35904 # GL/glext.h:486
+GL_SRGB8 = 35905 # GL/glext.h:487
+GL_SRGB_ALPHA = 35906 # GL/glext.h:488
+GL_SRGB8_ALPHA8 = 35907 # GL/glext.h:489
+GL_COMPRESSED_SRGB = 35912 # GL/glext.h:490
+GL_COMPRESSED_SRGB_ALPHA = 35913 # GL/glext.h:491
+# VERSION_2_1_DEPRECATED (GL/glext.h:494)
+GL_CURRENT_RASTER_SECONDARY_COLOR = 33887 # GL/glext.h:495
+GL_SLUMINANCE_ALPHA = 35908 # GL/glext.h:496
+GL_SLUMINANCE8_ALPHA8 = 35909 # GL/glext.h:497
+GL_SLUMINANCE = 35910 # GL/glext.h:498
+GL_SLUMINANCE8 = 35911 # GL/glext.h:499
+GL_COMPRESSED_SLUMINANCE = 35914 # GL/glext.h:500
+GL_COMPRESSED_SLUMINANCE_ALPHA = 35915 # GL/glext.h:501
+# VERSION_3_0 (GL/glext.h:504)
+GL_COMPARE_REF_TO_TEXTURE = 34894 # GL/glext.h:505
+GL_CLIP_DISTANCE0 = 12288 # GL/glext.h:506
+GL_CLIP_DISTANCE1 = 12289 # GL/glext.h:507
+GL_CLIP_DISTANCE2 = 12290 # GL/glext.h:508
+GL_CLIP_DISTANCE3 = 12291 # GL/glext.h:509
+GL_CLIP_DISTANCE4 = 12292 # GL/glext.h:510
+GL_CLIP_DISTANCE5 = 12293 # GL/glext.h:511
+GL_CLIP_DISTANCE6 = 12294 # GL/glext.h:512
+GL_CLIP_DISTANCE7 = 12295 # GL/glext.h:513
+GL_MAX_CLIP_DISTANCES = 3378 # GL/glext.h:514
+GL_MAJOR_VERSION = 33307 # GL/glext.h:515
+GL_MINOR_VERSION = 33308 # GL/glext.h:516
+GL_NUM_EXTENSIONS = 33309 # GL/glext.h:517
+GL_CONTEXT_FLAGS = 33310 # GL/glext.h:518
+GL_COMPRESSED_RED = 33317 # GL/glext.h:519
+GL_COMPRESSED_RG = 33318 # GL/glext.h:520
+GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT = 1 # GL/glext.h:521
+GL_RGBA32F = 34836 # GL/glext.h:522
+GL_RGB32F = 34837 # GL/glext.h:523
+GL_RGBA16F = 34842 # GL/glext.h:524
+GL_RGB16F = 34843 # GL/glext.h:525
+GL_VERTEX_ATTRIB_ARRAY_INTEGER = 35069 # GL/glext.h:526
+GL_MAX_ARRAY_TEXTURE_LAYERS = 35071 # GL/glext.h:527
+GL_MIN_PROGRAM_TEXEL_OFFSET = 35076 # GL/glext.h:528
+GL_MAX_PROGRAM_TEXEL_OFFSET = 35077 # GL/glext.h:529
+GL_CLAMP_READ_COLOR = 35100 # GL/glext.h:530
+GL_FIXED_ONLY = 35101 # GL/glext.h:531
+GL_MAX_VARYING_COMPONENTS = 35659 # GL/glext.h:532
+GL_TEXTURE_1D_ARRAY = 35864 # GL/glext.h:533
+GL_PROXY_TEXTURE_1D_ARRAY = 35865 # GL/glext.h:534
+GL_TEXTURE_2D_ARRAY = 35866 # GL/glext.h:535
+GL_PROXY_TEXTURE_2D_ARRAY = 35867 # GL/glext.h:536
+GL_TEXTURE_BINDING_1D_ARRAY = 35868 # GL/glext.h:537
+GL_TEXTURE_BINDING_2D_ARRAY = 35869 # GL/glext.h:538
+GL_R11F_G11F_B10F = 35898 # GL/glext.h:539
+GL_UNSIGNED_INT_10F_11F_11F_REV = 35899 # GL/glext.h:540
+GL_RGB9_E5 = 35901 # GL/glext.h:541
+GL_UNSIGNED_INT_5_9_9_9_REV = 35902 # GL/glext.h:542
+GL_TEXTURE_SHARED_SIZE = 35903 # GL/glext.h:543
+GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH = 35958 # GL/glext.h:544
+GL_TRANSFORM_FEEDBACK_BUFFER_MODE = 35967 # GL/glext.h:545
+GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 35968 # GL/glext.h:546
+GL_TRANSFORM_FEEDBACK_VARYINGS = 35971 # GL/glext.h:547
+GL_TRANSFORM_FEEDBACK_BUFFER_START = 35972 # GL/glext.h:548
+GL_TRANSFORM_FEEDBACK_BUFFER_SIZE = 35973 # GL/glext.h:549
+GL_PRIMITIVES_GENERATED = 35975 # GL/glext.h:550
+GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 35976 # GL/glext.h:551
+GL_RASTERIZER_DISCARD = 35977 # GL/glext.h:552
+GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 35978 # GL/glext.h:553
+GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 35979 # GL/glext.h:554
+GL_INTERLEAVED_ATTRIBS = 35980 # GL/glext.h:555
+GL_SEPARATE_ATTRIBS = 35981 # GL/glext.h:556
+GL_TRANSFORM_FEEDBACK_BUFFER = 35982 # GL/glext.h:557
+GL_TRANSFORM_FEEDBACK_BUFFER_BINDING = 35983 # GL/glext.h:558
+GL_RGBA32UI = 36208 # GL/glext.h:559
+GL_RGB32UI = 36209 # GL/glext.h:560
+GL_RGBA16UI = 36214 # GL/glext.h:561
+GL_RGB16UI = 36215 # GL/glext.h:562
+GL_RGBA8UI = 36220 # GL/glext.h:563
+GL_RGB8UI = 36221 # GL/glext.h:564
+GL_RGBA32I = 36226 # GL/glext.h:565
+GL_RGB32I = 36227 # GL/glext.h:566
+GL_RGBA16I = 36232 # GL/glext.h:567
+GL_RGB16I = 36233 # GL/glext.h:568
+GL_RGBA8I = 36238 # GL/glext.h:569
+GL_RGB8I = 36239 # GL/glext.h:570
+GL_RED_INTEGER = 36244 # GL/glext.h:571
+GL_GREEN_INTEGER = 36245 # GL/glext.h:572
+GL_BLUE_INTEGER = 36246 # GL/glext.h:573
+GL_RGB_INTEGER = 36248 # GL/glext.h:574
+GL_RGBA_INTEGER = 36249 # GL/glext.h:575
+GL_BGR_INTEGER = 36250 # GL/glext.h:576
+GL_BGRA_INTEGER = 36251 # GL/glext.h:577
+GL_SAMPLER_1D_ARRAY = 36288 # GL/glext.h:578
+GL_SAMPLER_2D_ARRAY = 36289 # GL/glext.h:579
+GL_SAMPLER_1D_ARRAY_SHADOW = 36291 # GL/glext.h:580
+GL_SAMPLER_2D_ARRAY_SHADOW = 36292 # GL/glext.h:581
+GL_SAMPLER_CUBE_SHADOW = 36293 # GL/glext.h:582
+GL_UNSIGNED_INT_VEC2 = 36294 # GL/glext.h:583
+GL_UNSIGNED_INT_VEC3 = 36295 # GL/glext.h:584
+GL_UNSIGNED_INT_VEC4 = 36296 # GL/glext.h:585
+GL_INT_SAMPLER_1D = 36297 # GL/glext.h:586
+GL_INT_SAMPLER_2D = 36298 # GL/glext.h:587
+GL_INT_SAMPLER_3D = 36299 # GL/glext.h:588
+GL_INT_SAMPLER_CUBE = 36300 # GL/glext.h:589
+GL_INT_SAMPLER_1D_ARRAY = 36302 # GL/glext.h:590
+GL_INT_SAMPLER_2D_ARRAY = 36303 # GL/glext.h:591
+GL_UNSIGNED_INT_SAMPLER_1D = 36305 # GL/glext.h:592
+GL_UNSIGNED_INT_SAMPLER_2D = 36306 # GL/glext.h:593
+GL_UNSIGNED_INT_SAMPLER_3D = 36307 # GL/glext.h:594
+GL_UNSIGNED_INT_SAMPLER_CUBE = 36308 # GL/glext.h:595
+GL_UNSIGNED_INT_SAMPLER_1D_ARRAY = 36310 # GL/glext.h:596
+GL_UNSIGNED_INT_SAMPLER_2D_ARRAY = 36311 # GL/glext.h:597
+GL_QUERY_WAIT = 36371 # GL/glext.h:598
+GL_QUERY_NO_WAIT = 36372 # GL/glext.h:599
+GL_QUERY_BY_REGION_WAIT = 36373 # GL/glext.h:600
+GL_QUERY_BY_REGION_NO_WAIT = 36374 # GL/glext.h:601
+GL_BUFFER_ACCESS_FLAGS = 37151 # GL/glext.h:602
+GL_BUFFER_MAP_LENGTH = 37152 # GL/glext.h:603
+GL_BUFFER_MAP_OFFSET = 37153 # GL/glext.h:604
+# VERSION_3_0_DEPRECATED (GL/glext.h:731)
+GL_CLAMP_VERTEX_COLOR = 35098 # GL/glext.h:732
+GL_CLAMP_FRAGMENT_COLOR = 35099 # GL/glext.h:733
+GL_ALPHA_INTEGER = 36247 # GL/glext.h:734
+# VERSION_3_1 (GL/glext.h:740)
+GL_SAMPLER_2D_RECT = 35683 # GL/glext.h:741
+GL_SAMPLER_2D_RECT_SHADOW = 35684 # GL/glext.h:742
+GL_SAMPLER_BUFFER = 36290 # GL/glext.h:743
+GL_INT_SAMPLER_2D_RECT = 36301 # GL/glext.h:744
+GL_INT_SAMPLER_BUFFER = 36304 # GL/glext.h:745
+GL_UNSIGNED_INT_SAMPLER_2D_RECT = 36309 # GL/glext.h:746
+GL_UNSIGNED_INT_SAMPLER_BUFFER = 36312 # GL/glext.h:747
+GL_TEXTURE_BUFFER = 35882 # GL/glext.h:748
+GL_MAX_TEXTURE_BUFFER_SIZE = 35883 # GL/glext.h:749
+GL_TEXTURE_BINDING_BUFFER = 35884 # GL/glext.h:750
+GL_TEXTURE_BUFFER_DATA_STORE_BINDING = 35885 # GL/glext.h:751
+GL_TEXTURE_BUFFER_FORMAT = 35886 # GL/glext.h:752
+GL_TEXTURE_RECTANGLE = 34037 # GL/glext.h:753
+GL_TEXTURE_BINDING_RECTANGLE = 34038 # GL/glext.h:754
+GL_PROXY_TEXTURE_RECTANGLE = 34039 # GL/glext.h:755
+GL_MAX_RECTANGLE_TEXTURE_SIZE = 34040 # GL/glext.h:756
+GL_RED_SNORM = 36752 # GL/glext.h:757
+GL_RG_SNORM = 36753 # GL/glext.h:758
+GL_RGB_SNORM = 36754 # GL/glext.h:759
+GL_RGBA_SNORM = 36755 # GL/glext.h:760
+GL_R8_SNORM = 36756 # GL/glext.h:761
+GL_RG8_SNORM = 36757 # GL/glext.h:762
+GL_RGB8_SNORM = 36758 # GL/glext.h:763
+GL_RGBA8_SNORM = 36759 # GL/glext.h:764
+GL_R16_SNORM = 36760 # GL/glext.h:765
+GL_RG16_SNORM = 36761 # GL/glext.h:766
+GL_RGB16_SNORM = 36762 # GL/glext.h:767
+GL_RGBA16_SNORM = 36763 # GL/glext.h:768
+GL_SIGNED_NORMALIZED = 36764 # GL/glext.h:769
+GL_PRIMITIVE_RESTART = 36765 # GL/glext.h:770
+GL_PRIMITIVE_RESTART_INDEX = 36766 # GL/glext.h:771
+# VERSION_3_2 (GL/glext.h:809)
+GL_CONTEXT_CORE_PROFILE_BIT = 1 # GL/glext.h:810
+GL_CONTEXT_COMPATIBILITY_PROFILE_BIT = 2 # GL/glext.h:811
+GL_LINES_ADJACENCY = 10 # GL/glext.h:812
+GL_LINE_STRIP_ADJACENCY = 11 # GL/glext.h:813
+GL_TRIANGLES_ADJACENCY = 12 # GL/glext.h:814
+GL_TRIANGLE_STRIP_ADJACENCY = 13 # GL/glext.h:815
+GL_PROGRAM_POINT_SIZE = 34370 # GL/glext.h:816
+GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS = 35881 # GL/glext.h:817
+GL_FRAMEBUFFER_ATTACHMENT_LAYERED = 36263 # GL/glext.h:818
+GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = 36264 # GL/glext.h:819
+GL_GEOMETRY_SHADER = 36313 # GL/glext.h:820
+GL_GEOMETRY_VERTICES_OUT = 35094 # GL/glext.h:821
+GL_GEOMETRY_INPUT_TYPE = 35095 # GL/glext.h:822
+GL_GEOMETRY_OUTPUT_TYPE = 35096 # GL/glext.h:823
+GL_MAX_GEOMETRY_UNIFORM_COMPONENTS = 36319 # GL/glext.h:824
+GL_MAX_GEOMETRY_OUTPUT_VERTICES = 36320 # GL/glext.h:825
+GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS = 36321 # GL/glext.h:826
+GL_MAX_VERTEX_OUTPUT_COMPONENTS = 37154 # GL/glext.h:827
+GL_MAX_GEOMETRY_INPUT_COMPONENTS = 37155 # GL/glext.h:828
+GL_MAX_GEOMETRY_OUTPUT_COMPONENTS = 37156 # GL/glext.h:829
+GL_MAX_FRAGMENT_INPUT_COMPONENTS = 37157 # GL/glext.h:830
+GL_CONTEXT_PROFILE_MASK = 37158 # GL/glext.h:831
+# VERSION_3_3 (GL/glext.h:887)
+GL_VERTEX_ATTRIB_ARRAY_DIVISOR = 35070 # GL/glext.h:888
+# VERSION_4_0 (GL/glext.h:915)
+GL_SAMPLE_SHADING = 35894 # GL/glext.h:916
+GL_MIN_SAMPLE_SHADING_VALUE = 35895 # GL/glext.h:917
+GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET = 36446 # GL/glext.h:918
+GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET = 36447 # GL/glext.h:919
+GL_TEXTURE_CUBE_MAP_ARRAY = 36873 # GL/glext.h:920
+GL_TEXTURE_BINDING_CUBE_MAP_ARRAY = 36874 # GL/glext.h:921
+GL_PROXY_TEXTURE_CUBE_MAP_ARRAY = 36875 # GL/glext.h:922
+GL_SAMPLER_CUBE_MAP_ARRAY = 36876 # GL/glext.h:923
+GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW = 36877 # GL/glext.h:924
+GL_INT_SAMPLER_CUBE_MAP_ARRAY = 36878 # GL/glext.h:925
+GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY = 36879 # GL/glext.h:926
+# VERSION_4_1 (GL/glext.h:1006)
+# VERSION_4_2 (GL/glext.h:1049)
+# ARB_multitexture (GL/glext.h:1167)
+# ARB_transpose_matrix (GL/glext.h:1205)
+GL_TRANSPOSE_MODELVIEW_MATRIX_ARB = 34019 # GL/glext.h:1206
+GL_TRANSPOSE_PROJECTION_MATRIX_ARB = 34020 # GL/glext.h:1207
+GL_TRANSPOSE_TEXTURE_MATRIX_ARB = 34021 # GL/glext.h:1208
+GL_TRANSPOSE_COLOR_MATRIX_ARB = 34022 # GL/glext.h:1209
+# ARB_multisample (GL/glext.h:1212)
+GL_MULTISAMPLE_ARB = 32925 # GL/glext.h:1213
+GL_SAMPLE_ALPHA_TO_COVERAGE_ARB = 32926 # GL/glext.h:1214
+GL_SAMPLE_ALPHA_TO_ONE_ARB = 32927 # GL/glext.h:1215
+GL_SAMPLE_COVERAGE_ARB = 32928 # GL/glext.h:1216
+GL_SAMPLE_BUFFERS_ARB = 32936 # GL/glext.h:1217
+GL_SAMPLES_ARB = 32937 # GL/glext.h:1218
+GL_SAMPLE_COVERAGE_VALUE_ARB = 32938 # GL/glext.h:1219
+GL_SAMPLE_COVERAGE_INVERT_ARB = 32939 # GL/glext.h:1220
+GL_MULTISAMPLE_BIT_ARB = 536870912 # GL/glext.h:1221
+# ARB_texture_env_add (GL/glext.h:1224)
+# ARB_texture_cube_map (GL/glext.h:1227)
+GL_NORMAL_MAP_ARB = 34065 # GL/glext.h:1228
+GL_REFLECTION_MAP_ARB = 34066 # GL/glext.h:1229
+GL_TEXTURE_CUBE_MAP_ARB = 34067 # GL/glext.h:1230
+GL_TEXTURE_BINDING_CUBE_MAP_ARB = 34068 # GL/glext.h:1231
+GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = 34069 # GL/glext.h:1232
+GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = 34070 # GL/glext.h:1233
+GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = 34071 # GL/glext.h:1234
+GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = 34072 # GL/glext.h:1235
+GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = 34073 # GL/glext.h:1236
+GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = 34074 # GL/glext.h:1237
+GL_PROXY_TEXTURE_CUBE_MAP_ARB = 34075 # GL/glext.h:1238
+GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB = 34076 # GL/glext.h:1239
+# ARB_texture_compression (GL/glext.h:1242)
+GL_COMPRESSED_ALPHA_ARB = 34025 # GL/glext.h:1243
+GL_COMPRESSED_LUMINANCE_ARB = 34026 # GL/glext.h:1244
+GL_COMPRESSED_LUMINANCE_ALPHA_ARB = 34027 # GL/glext.h:1245
+GL_COMPRESSED_INTENSITY_ARB = 34028 # GL/glext.h:1246
+GL_COMPRESSED_RGB_ARB = 34029 # GL/glext.h:1247
+GL_COMPRESSED_RGBA_ARB = 34030 # GL/glext.h:1248
+GL_TEXTURE_COMPRESSION_HINT_ARB = 34031 # GL/glext.h:1249
+GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB = 34464 # GL/glext.h:1250
+GL_TEXTURE_COMPRESSED_ARB = 34465 # GL/glext.h:1251
+GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = 34466 # GL/glext.h:1252
+GL_COMPRESSED_TEXTURE_FORMATS_ARB = 34467 # GL/glext.h:1253
+# ARB_texture_border_clamp (GL/glext.h:1256)
+GL_CLAMP_TO_BORDER_ARB = 33069 # GL/glext.h:1257
+# ARB_point_parameters (GL/glext.h:1260)
+GL_POINT_SIZE_MIN_ARB = 33062 # GL/glext.h:1261
+GL_POINT_SIZE_MAX_ARB = 33063 # GL/glext.h:1262
+GL_POINT_FADE_THRESHOLD_SIZE_ARB = 33064 # GL/glext.h:1263
+GL_POINT_DISTANCE_ATTENUATION_ARB = 33065 # GL/glext.h:1264
+# ARB_vertex_blend (GL/glext.h:1267)
+GL_MAX_VERTEX_UNITS_ARB = 34468 # GL/glext.h:1268
+GL_ACTIVE_VERTEX_UNITS_ARB = 34469 # GL/glext.h:1269
+GL_WEIGHT_SUM_UNITY_ARB = 34470 # GL/glext.h:1270
+GL_VERTEX_BLEND_ARB = 34471 # GL/glext.h:1271
+GL_CURRENT_WEIGHT_ARB = 34472 # GL/glext.h:1272
+GL_WEIGHT_ARRAY_TYPE_ARB = 34473 # GL/glext.h:1273
+GL_WEIGHT_ARRAY_STRIDE_ARB = 34474 # GL/glext.h:1274
+GL_WEIGHT_ARRAY_SIZE_ARB = 34475 # GL/glext.h:1275
+GL_WEIGHT_ARRAY_POINTER_ARB = 34476 # GL/glext.h:1276
+GL_WEIGHT_ARRAY_ARB = 34477 # GL/glext.h:1277
+GL_MODELVIEW0_ARB = 5888 # GL/glext.h:1278
+GL_MODELVIEW1_ARB = 34058 # GL/glext.h:1279
+GL_MODELVIEW2_ARB = 34594 # GL/glext.h:1280
+GL_MODELVIEW3_ARB = 34595 # GL/glext.h:1281
+GL_MODELVIEW4_ARB = 34596 # GL/glext.h:1282
+GL_MODELVIEW5_ARB = 34597 # GL/glext.h:1283
+GL_MODELVIEW6_ARB = 34598 # GL/glext.h:1284
+GL_MODELVIEW7_ARB = 34599 # GL/glext.h:1285
+GL_MODELVIEW8_ARB = 34600 # GL/glext.h:1286
+GL_MODELVIEW9_ARB = 34601 # GL/glext.h:1287
+GL_MODELVIEW10_ARB = 34602 # GL/glext.h:1288
+GL_MODELVIEW11_ARB = 34603 # GL/glext.h:1289
+GL_MODELVIEW12_ARB = 34604 # GL/glext.h:1290
+GL_MODELVIEW13_ARB = 34605 # GL/glext.h:1291
+GL_MODELVIEW14_ARB = 34606 # GL/glext.h:1292
+GL_MODELVIEW15_ARB = 34607 # GL/glext.h:1293
+GL_MODELVIEW16_ARB = 34608 # GL/glext.h:1294
+GL_MODELVIEW17_ARB = 34609 # GL/glext.h:1295
+GL_MODELVIEW18_ARB = 34610 # GL/glext.h:1296
+GL_MODELVIEW19_ARB = 34611 # GL/glext.h:1297
+GL_MODELVIEW20_ARB = 34612 # GL/glext.h:1298
+GL_MODELVIEW21_ARB = 34613 # GL/glext.h:1299
+GL_MODELVIEW22_ARB = 34614 # GL/glext.h:1300
+GL_MODELVIEW23_ARB = 34615 # GL/glext.h:1301
+GL_MODELVIEW24_ARB = 34616 # GL/glext.h:1302
+GL_MODELVIEW25_ARB = 34617 # GL/glext.h:1303
+GL_MODELVIEW26_ARB = 34618 # GL/glext.h:1304
+GL_MODELVIEW27_ARB = 34619 # GL/glext.h:1305
+GL_MODELVIEW28_ARB = 34620 # GL/glext.h:1306
+GL_MODELVIEW29_ARB = 34621 # GL/glext.h:1307
+GL_MODELVIEW30_ARB = 34622 # GL/glext.h:1308
+GL_MODELVIEW31_ARB = 34623 # GL/glext.h:1309
+# ARB_matrix_palette (GL/glext.h:1312)
+GL_MATRIX_PALETTE_ARB = 34880 # GL/glext.h:1313
+GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB = 34881 # GL/glext.h:1314
+GL_MAX_PALETTE_MATRICES_ARB = 34882 # GL/glext.h:1315
+GL_CURRENT_PALETTE_MATRIX_ARB = 34883 # GL/glext.h:1316
+GL_MATRIX_INDEX_ARRAY_ARB = 34884 # GL/glext.h:1317
+GL_CURRENT_MATRIX_INDEX_ARB = 34885 # GL/glext.h:1318
+GL_MATRIX_INDEX_ARRAY_SIZE_ARB = 34886 # GL/glext.h:1319
+GL_MATRIX_INDEX_ARRAY_TYPE_ARB = 34887 # GL/glext.h:1320
+GL_MATRIX_INDEX_ARRAY_STRIDE_ARB = 34888 # GL/glext.h:1321
+GL_MATRIX_INDEX_ARRAY_POINTER_ARB = 34889 # GL/glext.h:1322
+# ARB_texture_env_combine (GL/glext.h:1325)
+GL_COMBINE_ARB = 34160 # GL/glext.h:1326
+GL_COMBINE_RGB_ARB = 34161 # GL/glext.h:1327
+GL_COMBINE_ALPHA_ARB = 34162 # GL/glext.h:1328
+GL_SOURCE0_RGB_ARB = 34176 # GL/glext.h:1329
+GL_SOURCE1_RGB_ARB = 34177 # GL/glext.h:1330
+GL_SOURCE2_RGB_ARB = 34178 # GL/glext.h:1331
+GL_SOURCE0_ALPHA_ARB = 34184 # GL/glext.h:1332
+GL_SOURCE1_ALPHA_ARB = 34185 # GL/glext.h:1333
+GL_SOURCE2_ALPHA_ARB = 34186 # GL/glext.h:1334
+GL_OPERAND0_RGB_ARB = 34192 # GL/glext.h:1335
+GL_OPERAND1_RGB_ARB = 34193 # GL/glext.h:1336
+GL_OPERAND2_RGB_ARB = 34194 # GL/glext.h:1337
+GL_OPERAND0_ALPHA_ARB = 34200 # GL/glext.h:1338
+GL_OPERAND1_ALPHA_ARB = 34201 # GL/glext.h:1339
+GL_OPERAND2_ALPHA_ARB = 34202 # GL/glext.h:1340
+GL_RGB_SCALE_ARB = 34163 # GL/glext.h:1341
+GL_ADD_SIGNED_ARB = 34164 # GL/glext.h:1342
+GL_INTERPOLATE_ARB = 34165 # GL/glext.h:1343
+GL_SUBTRACT_ARB = 34023 # GL/glext.h:1344
+GL_CONSTANT_ARB = 34166 # GL/glext.h:1345
+GL_PRIMARY_COLOR_ARB = 34167 # GL/glext.h:1346
+GL_PREVIOUS_ARB = 34168 # GL/glext.h:1347
+# ARB_texture_env_crossbar (GL/glext.h:1350)
+# ARB_texture_env_dot3 (GL/glext.h:1353)
+GL_DOT3_RGB_ARB = 34478 # GL/glext.h:1354
+GL_DOT3_RGBA_ARB = 34479 # GL/glext.h:1355
+# ARB_texture_mirrored_repeat (GL/glext.h:1358)
+GL_MIRRORED_REPEAT_ARB = 33648 # GL/glext.h:1359
+# ARB_depth_texture (GL/glext.h:1362)
+GL_DEPTH_COMPONENT16_ARB = 33189 # GL/glext.h:1363
+GL_DEPTH_COMPONENT24_ARB = 33190 # GL/glext.h:1364
+GL_DEPTH_COMPONENT32_ARB = 33191 # GL/glext.h:1365
+GL_TEXTURE_DEPTH_SIZE_ARB = 34890 # GL/glext.h:1366
+GL_DEPTH_TEXTURE_MODE_ARB = 34891 # GL/glext.h:1367
+# ARB_shadow (GL/glext.h:1370)
+GL_TEXTURE_COMPARE_MODE_ARB = 34892 # GL/glext.h:1371
+GL_TEXTURE_COMPARE_FUNC_ARB = 34893 # GL/glext.h:1372
+GL_COMPARE_R_TO_TEXTURE_ARB = 34894 # GL/glext.h:1373
+# ARB_shadow_ambient (GL/glext.h:1376)
+GL_TEXTURE_COMPARE_FAIL_VALUE_ARB = 32959 # GL/glext.h:1377
+# ARB_window_pos (GL/glext.h:1380)
+# ARB_vertex_program (GL/glext.h:1383)
+GL_COLOR_SUM_ARB = 33880 # GL/glext.h:1384
+GL_VERTEX_PROGRAM_ARB = 34336 # GL/glext.h:1385
+GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB = 34338 # GL/glext.h:1386
+GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB = 34339 # GL/glext.h:1387
+GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB = 34340 # GL/glext.h:1388
+GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB = 34341 # GL/glext.h:1389
+GL_CURRENT_VERTEX_ATTRIB_ARB = 34342 # GL/glext.h:1390
+GL_PROGRAM_LENGTH_ARB = 34343 # GL/glext.h:1391
+GL_PROGRAM_STRING_ARB = 34344 # GL/glext.h:1392
+GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB = 34350 # GL/glext.h:1393
+GL_MAX_PROGRAM_MATRICES_ARB = 34351 # GL/glext.h:1394
+GL_CURRENT_MATRIX_STACK_DEPTH_ARB = 34368 # GL/glext.h:1395
+GL_CURRENT_MATRIX_ARB = 34369 # GL/glext.h:1396
+GL_VERTEX_PROGRAM_POINT_SIZE_ARB = 34370 # GL/glext.h:1397
+GL_VERTEX_PROGRAM_TWO_SIDE_ARB = 34371 # GL/glext.h:1398
+GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB = 34373 # GL/glext.h:1399
+GL_PROGRAM_ERROR_POSITION_ARB = 34379 # GL/glext.h:1400
+GL_PROGRAM_BINDING_ARB = 34423 # GL/glext.h:1401
+GL_MAX_VERTEX_ATTRIBS_ARB = 34921 # GL/glext.h:1402
+GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB = 34922 # GL/glext.h:1403
+GL_PROGRAM_ERROR_STRING_ARB = 34932 # GL/glext.h:1404
+GL_PROGRAM_FORMAT_ASCII_ARB = 34933 # GL/glext.h:1405
+GL_PROGRAM_FORMAT_ARB = 34934 # GL/glext.h:1406
+GL_PROGRAM_INSTRUCTIONS_ARB = 34976 # GL/glext.h:1407
+GL_MAX_PROGRAM_INSTRUCTIONS_ARB = 34977 # GL/glext.h:1408
+GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB = 34978 # GL/glext.h:1409
+GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB = 34979 # GL/glext.h:1410
+GL_PROGRAM_TEMPORARIES_ARB = 34980 # GL/glext.h:1411
+GL_MAX_PROGRAM_TEMPORARIES_ARB = 34981 # GL/glext.h:1412
+GL_PROGRAM_NATIVE_TEMPORARIES_ARB = 34982 # GL/glext.h:1413
+GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB = 34983 # GL/glext.h:1414
+GL_PROGRAM_PARAMETERS_ARB = 34984 # GL/glext.h:1415
+GL_MAX_PROGRAM_PARAMETERS_ARB = 34985 # GL/glext.h:1416
+GL_PROGRAM_NATIVE_PARAMETERS_ARB = 34986 # GL/glext.h:1417
+GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB = 34987 # GL/glext.h:1418
+GL_PROGRAM_ATTRIBS_ARB = 34988 # GL/glext.h:1419
+GL_MAX_PROGRAM_ATTRIBS_ARB = 34989 # GL/glext.h:1420
+GL_PROGRAM_NATIVE_ATTRIBS_ARB = 34990 # GL/glext.h:1421
+GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB = 34991 # GL/glext.h:1422
+GL_PROGRAM_ADDRESS_REGISTERS_ARB = 34992 # GL/glext.h:1423
+GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB = 34993 # GL/glext.h:1424
+GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = 34994 # GL/glext.h:1425
+GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = 34995 # GL/glext.h:1426
+GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB = 34996 # GL/glext.h:1427
+GL_MAX_PROGRAM_ENV_PARAMETERS_ARB = 34997 # GL/glext.h:1428
+GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB = 34998 # GL/glext.h:1429
+GL_TRANSPOSE_CURRENT_MATRIX_ARB = 34999 # GL/glext.h:1430
+GL_MATRIX0_ARB = 35008 # GL/glext.h:1431
+GL_MATRIX1_ARB = 35009 # GL/glext.h:1432
+GL_MATRIX2_ARB = 35010 # GL/glext.h:1433
+GL_MATRIX3_ARB = 35011 # GL/glext.h:1434
+GL_MATRIX4_ARB = 35012 # GL/glext.h:1435
+GL_MATRIX5_ARB = 35013 # GL/glext.h:1436
+GL_MATRIX6_ARB = 35014 # GL/glext.h:1437
+GL_MATRIX7_ARB = 35015 # GL/glext.h:1438
+GL_MATRIX8_ARB = 35016 # GL/glext.h:1439
+GL_MATRIX9_ARB = 35017 # GL/glext.h:1440
+GL_MATRIX10_ARB = 35018 # GL/glext.h:1441
+GL_MATRIX11_ARB = 35019 # GL/glext.h:1442
+GL_MATRIX12_ARB = 35020 # GL/glext.h:1443
+GL_MATRIX13_ARB = 35021 # GL/glext.h:1444
+GL_MATRIX14_ARB = 35022 # GL/glext.h:1445
+GL_MATRIX15_ARB = 35023 # GL/glext.h:1446
+GL_MATRIX16_ARB = 35024 # GL/glext.h:1447
+GL_MATRIX17_ARB = 35025 # GL/glext.h:1448
+GL_MATRIX18_ARB = 35026 # GL/glext.h:1449
+GL_MATRIX19_ARB = 35027 # GL/glext.h:1450
+GL_MATRIX20_ARB = 35028 # GL/glext.h:1451
+GL_MATRIX21_ARB = 35029 # GL/glext.h:1452
+GL_MATRIX22_ARB = 35030 # GL/glext.h:1453
+GL_MATRIX23_ARB = 35031 # GL/glext.h:1454
+GL_MATRIX24_ARB = 35032 # GL/glext.h:1455
+GL_MATRIX25_ARB = 35033 # GL/glext.h:1456
+GL_MATRIX26_ARB = 35034 # GL/glext.h:1457
+GL_MATRIX27_ARB = 35035 # GL/glext.h:1458
+GL_MATRIX28_ARB = 35036 # GL/glext.h:1459
+GL_MATRIX29_ARB = 35037 # GL/glext.h:1460
+GL_MATRIX30_ARB = 35038 # GL/glext.h:1461
+GL_MATRIX31_ARB = 35039 # GL/glext.h:1462
+# ARB_fragment_program (GL/glext.h:1465)
+GL_FRAGMENT_PROGRAM_ARB = 34820 # GL/glext.h:1466
+GL_PROGRAM_ALU_INSTRUCTIONS_ARB = 34821 # GL/glext.h:1467
+GL_PROGRAM_TEX_INSTRUCTIONS_ARB = 34822 # GL/glext.h:1468
+GL_PROGRAM_TEX_INDIRECTIONS_ARB = 34823 # GL/glext.h:1469
+GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = 34824 # GL/glext.h:1470
+GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = 34825 # GL/glext.h:1471
+GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = 34826 # GL/glext.h:1472
+GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB = 34827 # GL/glext.h:1473
+GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB = 34828 # GL/glext.h:1474
+GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB = 34829 # GL/glext.h:1475
+GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = 34830 # GL/glext.h:1476
+GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = 34831 # GL/glext.h:1477
+GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = 34832 # GL/glext.h:1478
+GL_MAX_TEXTURE_COORDS_ARB = 34929 # GL/glext.h:1479
+GL_MAX_TEXTURE_IMAGE_UNITS_ARB = 34930 # GL/glext.h:1480
+# ARB_vertex_buffer_object (GL/glext.h:1483)
+GL_BUFFER_SIZE_ARB = 34660 # GL/glext.h:1484
+GL_BUFFER_USAGE_ARB = 34661 # GL/glext.h:1485
+GL_ARRAY_BUFFER_ARB = 34962 # GL/glext.h:1486
+GL_ELEMENT_ARRAY_BUFFER_ARB = 34963 # GL/glext.h:1487
+GL_ARRAY_BUFFER_BINDING_ARB = 34964 # GL/glext.h:1488
+GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB = 34965 # GL/glext.h:1489
+GL_VERTEX_ARRAY_BUFFER_BINDING_ARB = 34966 # GL/glext.h:1490
+GL_NORMAL_ARRAY_BUFFER_BINDING_ARB = 34967 # GL/glext.h:1491
+GL_COLOR_ARRAY_BUFFER_BINDING_ARB = 34968 # GL/glext.h:1492
+GL_INDEX_ARRAY_BUFFER_BINDING_ARB = 34969 # GL/glext.h:1493
+GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB = 34970 # GL/glext.h:1494
+GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB = 34971 # GL/glext.h:1495
+GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB = 34972 # GL/glext.h:1496
+GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB = 34973 # GL/glext.h:1497
+GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB = 34974 # GL/glext.h:1498
+GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB = 34975 # GL/glext.h:1499
+GL_READ_ONLY_ARB = 35000 # GL/glext.h:1500
+GL_WRITE_ONLY_ARB = 35001 # GL/glext.h:1501
+GL_READ_WRITE_ARB = 35002 # GL/glext.h:1502
+GL_BUFFER_ACCESS_ARB = 35003 # GL/glext.h:1503
+GL_BUFFER_MAPPED_ARB = 35004 # GL/glext.h:1504
+GL_BUFFER_MAP_POINTER_ARB = 35005 # GL/glext.h:1505
+GL_STREAM_DRAW_ARB = 35040 # GL/glext.h:1506
+GL_STREAM_READ_ARB = 35041 # GL/glext.h:1507
+GL_STREAM_COPY_ARB = 35042 # GL/glext.h:1508
+GL_STATIC_DRAW_ARB = 35044 # GL/glext.h:1509
+GL_STATIC_READ_ARB = 35045 # GL/glext.h:1510
+GL_STATIC_COPY_ARB = 35046 # GL/glext.h:1511
+GL_DYNAMIC_DRAW_ARB = 35048 # GL/glext.h:1512
+GL_DYNAMIC_READ_ARB = 35049 # GL/glext.h:1513
+GL_DYNAMIC_COPY_ARB = 35050 # GL/glext.h:1514
+# ARB_occlusion_query (GL/glext.h:1517)
+GL_QUERY_COUNTER_BITS_ARB = 34916 # GL/glext.h:1518
+GL_CURRENT_QUERY_ARB = 34917 # GL/glext.h:1519
+GL_QUERY_RESULT_ARB = 34918 # GL/glext.h:1520
+GL_QUERY_RESULT_AVAILABLE_ARB = 34919 # GL/glext.h:1521
+GL_SAMPLES_PASSED_ARB = 35092 # GL/glext.h:1522
+# ARB_shader_objects (GL/glext.h:1525)
+GL_PROGRAM_OBJECT_ARB = 35648 # GL/glext.h:1526
+GL_SHADER_OBJECT_ARB = 35656 # GL/glext.h:1527
+GL_OBJECT_TYPE_ARB = 35662 # GL/glext.h:1528
+GL_OBJECT_SUBTYPE_ARB = 35663 # GL/glext.h:1529
+GL_FLOAT_VEC2_ARB = 35664 # GL/glext.h:1530
+GL_FLOAT_VEC3_ARB = 35665 # GL/glext.h:1531
+GL_FLOAT_VEC4_ARB = 35666 # GL/glext.h:1532
+GL_INT_VEC2_ARB = 35667 # GL/glext.h:1533
+GL_INT_VEC3_ARB = 35668 # GL/glext.h:1534
+GL_INT_VEC4_ARB = 35669 # GL/glext.h:1535
+GL_BOOL_ARB = 35670 # GL/glext.h:1536
+GL_BOOL_VEC2_ARB = 35671 # GL/glext.h:1537
+GL_BOOL_VEC3_ARB = 35672 # GL/glext.h:1538
+GL_BOOL_VEC4_ARB = 35673 # GL/glext.h:1539
+GL_FLOAT_MAT2_ARB = 35674 # GL/glext.h:1540
+GL_FLOAT_MAT3_ARB = 35675 # GL/glext.h:1541
+GL_FLOAT_MAT4_ARB = 35676 # GL/glext.h:1542
+GL_SAMPLER_1D_ARB = 35677 # GL/glext.h:1543
+GL_SAMPLER_2D_ARB = 35678 # GL/glext.h:1544
+GL_SAMPLER_3D_ARB = 35679 # GL/glext.h:1545
+GL_SAMPLER_CUBE_ARB = 35680 # GL/glext.h:1546
+GL_SAMPLER_1D_SHADOW_ARB = 35681 # GL/glext.h:1547
+GL_SAMPLER_2D_SHADOW_ARB = 35682 # GL/glext.h:1548
+GL_SAMPLER_2D_RECT_ARB = 35683 # GL/glext.h:1549
+GL_SAMPLER_2D_RECT_SHADOW_ARB = 35684 # GL/glext.h:1550
+GL_OBJECT_DELETE_STATUS_ARB = 35712 # GL/glext.h:1551
+GL_OBJECT_COMPILE_STATUS_ARB = 35713 # GL/glext.h:1552
+GL_OBJECT_LINK_STATUS_ARB = 35714 # GL/glext.h:1553
+GL_OBJECT_VALIDATE_STATUS_ARB = 35715 # GL/glext.h:1554
+GL_OBJECT_INFO_LOG_LENGTH_ARB = 35716 # GL/glext.h:1555
+GL_OBJECT_ATTACHED_OBJECTS_ARB = 35717 # GL/glext.h:1556
+GL_OBJECT_ACTIVE_UNIFORMS_ARB = 35718 # GL/glext.h:1557
+GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB = 35719 # GL/glext.h:1558
+GL_OBJECT_SHADER_SOURCE_LENGTH_ARB = 35720 # GL/glext.h:1559
+# ARB_vertex_shader (GL/glext.h:1562)
+GL_VERTEX_SHADER_ARB = 35633 # GL/glext.h:1563
+GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB = 35658 # GL/glext.h:1564
+GL_MAX_VARYING_FLOATS_ARB = 35659 # GL/glext.h:1565
+GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB = 35660 # GL/glext.h:1566
+GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB = 35661 # GL/glext.h:1567
+GL_OBJECT_ACTIVE_ATTRIBUTES_ARB = 35721 # GL/glext.h:1568
+GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB = 35722 # GL/glext.h:1569
+# ARB_fragment_shader (GL/glext.h:1572)
+GL_FRAGMENT_SHADER_ARB = 35632 # GL/glext.h:1573
+GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB = 35657 # GL/glext.h:1574
+GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB = 35723 # GL/glext.h:1575
+# ARB_shading_language_100 (GL/glext.h:1578)
+GL_SHADING_LANGUAGE_VERSION_ARB = 35724 # GL/glext.h:1579
+# ARB_texture_non_power_of_two (GL/glext.h:1582)
+# ARB_point_sprite (GL/glext.h:1585)
+GL_POINT_SPRITE_ARB = 34913 # GL/glext.h:1586
+GL_COORD_REPLACE_ARB = 34914 # GL/glext.h:1587
+# ARB_fragment_program_shadow (GL/glext.h:1590)
+# ARB_draw_buffers (GL/glext.h:1593)
+GL_MAX_DRAW_BUFFERS_ARB = 34852 # GL/glext.h:1594
+GL_DRAW_BUFFER0_ARB = 34853 # GL/glext.h:1595
+GL_DRAW_BUFFER1_ARB = 34854 # GL/glext.h:1596
+GL_DRAW_BUFFER2_ARB = 34855 # GL/glext.h:1597
+GL_DRAW_BUFFER3_ARB = 34856 # GL/glext.h:1598
+GL_DRAW_BUFFER4_ARB = 34857 # GL/glext.h:1599
+GL_DRAW_BUFFER5_ARB = 34858 # GL/glext.h:1600
+GL_DRAW_BUFFER6_ARB = 34859 # GL/glext.h:1601
+GL_DRAW_BUFFER7_ARB = 34860 # GL/glext.h:1602
+GL_DRAW_BUFFER8_ARB = 34861 # GL/glext.h:1603
+GL_DRAW_BUFFER9_ARB = 34862 # GL/glext.h:1604
+GL_DRAW_BUFFER10_ARB = 34863 # GL/glext.h:1605
+GL_DRAW_BUFFER11_ARB = 34864 # GL/glext.h:1606
+GL_DRAW_BUFFER12_ARB = 34865 # GL/glext.h:1607
+GL_DRAW_BUFFER13_ARB = 34866 # GL/glext.h:1608
+GL_DRAW_BUFFER14_ARB = 34867 # GL/glext.h:1609
+GL_DRAW_BUFFER15_ARB = 34868 # GL/glext.h:1610
+# ARB_texture_rectangle (GL/glext.h:1613)
+GL_TEXTURE_RECTANGLE_ARB = 34037 # GL/glext.h:1614
+GL_TEXTURE_BINDING_RECTANGLE_ARB = 34038 # GL/glext.h:1615
+GL_PROXY_TEXTURE_RECTANGLE_ARB = 34039 # GL/glext.h:1616
+GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB = 34040 # GL/glext.h:1617
+# ARB_color_buffer_float (GL/glext.h:1620)
+GL_RGBA_FLOAT_MODE_ARB = 34848 # GL/glext.h:1621
+GL_CLAMP_VERTEX_COLOR_ARB = 35098 # GL/glext.h:1622
+GL_CLAMP_FRAGMENT_COLOR_ARB = 35099 # GL/glext.h:1623
+GL_CLAMP_READ_COLOR_ARB = 35100 # GL/glext.h:1624
+GL_FIXED_ONLY_ARB = 35101 # GL/glext.h:1625
+# ARB_half_float_pixel (GL/glext.h:1628)
+GL_HALF_FLOAT_ARB = 5131 # GL/glext.h:1629
+# ARB_texture_float (GL/glext.h:1632)
+GL_TEXTURE_RED_TYPE_ARB = 35856 # GL/glext.h:1633
+GL_TEXTURE_GREEN_TYPE_ARB = 35857 # GL/glext.h:1634
+GL_TEXTURE_BLUE_TYPE_ARB = 35858 # GL/glext.h:1635
+GL_TEXTURE_ALPHA_TYPE_ARB = 35859 # GL/glext.h:1636
+GL_TEXTURE_LUMINANCE_TYPE_ARB = 35860 # GL/glext.h:1637
+GL_TEXTURE_INTENSITY_TYPE_ARB = 35861 # GL/glext.h:1638
+GL_TEXTURE_DEPTH_TYPE_ARB = 35862 # GL/glext.h:1639
+GL_UNSIGNED_NORMALIZED_ARB = 35863 # GL/glext.h:1640
+GL_RGBA32F_ARB = 34836 # GL/glext.h:1641
+GL_RGB32F_ARB = 34837 # GL/glext.h:1642
+GL_ALPHA32F_ARB = 34838 # GL/glext.h:1643
+GL_INTENSITY32F_ARB = 34839 # GL/glext.h:1644
+GL_LUMINANCE32F_ARB = 34840 # GL/glext.h:1645
+GL_LUMINANCE_ALPHA32F_ARB = 34841 # GL/glext.h:1646
+GL_RGBA16F_ARB = 34842 # GL/glext.h:1647
+GL_RGB16F_ARB = 34843 # GL/glext.h:1648
+GL_ALPHA16F_ARB = 34844 # GL/glext.h:1649
+GL_INTENSITY16F_ARB = 34845 # GL/glext.h:1650
+GL_LUMINANCE16F_ARB = 34846 # GL/glext.h:1651
+GL_LUMINANCE_ALPHA16F_ARB = 34847 # GL/glext.h:1652
+# ARB_pixel_buffer_object (GL/glext.h:1655)
+GL_PIXEL_PACK_BUFFER_ARB = 35051 # GL/glext.h:1656
+GL_PIXEL_UNPACK_BUFFER_ARB = 35052 # GL/glext.h:1657
+GL_PIXEL_PACK_BUFFER_BINDING_ARB = 35053 # GL/glext.h:1658
+GL_PIXEL_UNPACK_BUFFER_BINDING_ARB = 35055 # GL/glext.h:1659
+# ARB_depth_buffer_float (GL/glext.h:1662)
+GL_DEPTH_COMPONENT32F = 36012 # GL/glext.h:1663
+GL_DEPTH32F_STENCIL8 = 36013 # GL/glext.h:1664
+GL_FLOAT_32_UNSIGNED_INT_24_8_REV = 36269 # GL/glext.h:1665
+# ARB_draw_instanced (GL/glext.h:1668)
+# ARB_framebuffer_object (GL/glext.h:1671)
+GL_INVALID_FRAMEBUFFER_OPERATION = 1286 # GL/glext.h:1672
+GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 33296 # GL/glext.h:1673
+GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 33297 # GL/glext.h:1674
+GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE = 33298 # GL/glext.h:1675
+GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 33299 # GL/glext.h:1676
+GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 33300 # GL/glext.h:1677
+GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 33301 # GL/glext.h:1678
+GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 33302 # GL/glext.h:1679
+GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 33303 # GL/glext.h:1680
+GL_FRAMEBUFFER_DEFAULT = 33304 # GL/glext.h:1681
+GL_FRAMEBUFFER_UNDEFINED = 33305 # GL/glext.h:1682
+GL_DEPTH_STENCIL_ATTACHMENT = 33306 # GL/glext.h:1683
+GL_MAX_RENDERBUFFER_SIZE = 34024 # GL/glext.h:1684
+GL_DEPTH_STENCIL = 34041 # GL/glext.h:1685
+GL_UNSIGNED_INT_24_8 = 34042 # GL/glext.h:1686
+GL_DEPTH24_STENCIL8 = 35056 # GL/glext.h:1687
+GL_TEXTURE_STENCIL_SIZE = 35057 # GL/glext.h:1688
+GL_TEXTURE_RED_TYPE = 35856 # GL/glext.h:1689
+GL_TEXTURE_GREEN_TYPE = 35857 # GL/glext.h:1690
+GL_TEXTURE_BLUE_TYPE = 35858 # GL/glext.h:1691
+GL_TEXTURE_ALPHA_TYPE = 35859 # GL/glext.h:1692
+GL_TEXTURE_DEPTH_TYPE = 35862 # GL/glext.h:1693
+GL_UNSIGNED_NORMALIZED = 35863 # GL/glext.h:1694
+GL_FRAMEBUFFER_BINDING = 36006 # GL/glext.h:1695
+GL_DRAW_FRAMEBUFFER_BINDING = 36006 # GL/glext.h:1696
+GL_RENDERBUFFER_BINDING = 36007 # GL/glext.h:1697
+GL_READ_FRAMEBUFFER = 36008 # GL/glext.h:1698
+GL_DRAW_FRAMEBUFFER = 36009 # GL/glext.h:1699
+GL_READ_FRAMEBUFFER_BINDING = 36010 # GL/glext.h:1700
+GL_RENDERBUFFER_SAMPLES = 36011 # GL/glext.h:1701
+GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 36048 # GL/glext.h:1702
+GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 36049 # GL/glext.h:1703
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 36050 # GL/glext.h:1704
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 36051 # GL/glext.h:1705
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 36052 # GL/glext.h:1706
+GL_FRAMEBUFFER_COMPLETE = 36053 # GL/glext.h:1707
+GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 36054 # GL/glext.h:1708
+GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 36055 # GL/glext.h:1709
+GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = 36059 # GL/glext.h:1710
+GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 36060 # GL/glext.h:1711
+GL_FRAMEBUFFER_UNSUPPORTED = 36061 # GL/glext.h:1712
+GL_MAX_COLOR_ATTACHMENTS = 36063 # GL/glext.h:1713
+GL_COLOR_ATTACHMENT0 = 36064 # GL/glext.h:1714
+GL_COLOR_ATTACHMENT1 = 36065 # GL/glext.h:1715
+GL_COLOR_ATTACHMENT2 = 36066 # GL/glext.h:1716
+GL_COLOR_ATTACHMENT3 = 36067 # GL/glext.h:1717
+GL_COLOR_ATTACHMENT4 = 36068 # GL/glext.h:1718
+GL_COLOR_ATTACHMENT5 = 36069 # GL/glext.h:1719
+GL_COLOR_ATTACHMENT6 = 36070 # GL/glext.h:1720
+GL_COLOR_ATTACHMENT7 = 36071 # GL/glext.h:1721
+GL_COLOR_ATTACHMENT8 = 36072 # GL/glext.h:1722
+GL_COLOR_ATTACHMENT9 = 36073 # GL/glext.h:1723
+GL_COLOR_ATTACHMENT10 = 36074 # GL/glext.h:1724
+GL_COLOR_ATTACHMENT11 = 36075 # GL/glext.h:1725
+GL_COLOR_ATTACHMENT12 = 36076 # GL/glext.h:1726
+GL_COLOR_ATTACHMENT13 = 36077 # GL/glext.h:1727
+GL_COLOR_ATTACHMENT14 = 36078 # GL/glext.h:1728
+GL_COLOR_ATTACHMENT15 = 36079 # GL/glext.h:1729
+GL_DEPTH_ATTACHMENT = 36096 # GL/glext.h:1730
+GL_STENCIL_ATTACHMENT = 36128 # GL/glext.h:1731
+GL_FRAMEBUFFER = 36160 # GL/glext.h:1732
+GL_RENDERBUFFER = 36161 # GL/glext.h:1733
+GL_RENDERBUFFER_WIDTH = 36162 # GL/glext.h:1734
+GL_RENDERBUFFER_HEIGHT = 36163 # GL/glext.h:1735
+GL_RENDERBUFFER_INTERNAL_FORMAT = 36164 # GL/glext.h:1736
+GL_STENCIL_INDEX1 = 36166 # GL/glext.h:1737
+GL_STENCIL_INDEX4 = 36167 # GL/glext.h:1738
+GL_STENCIL_INDEX8 = 36168 # GL/glext.h:1739
+GL_STENCIL_INDEX16 = 36169 # GL/glext.h:1740
+GL_RENDERBUFFER_RED_SIZE = 36176 # GL/glext.h:1741
+GL_RENDERBUFFER_GREEN_SIZE = 36177 # GL/glext.h:1742
+GL_RENDERBUFFER_BLUE_SIZE = 36178 # GL/glext.h:1743
+GL_RENDERBUFFER_ALPHA_SIZE = 36179 # GL/glext.h:1744
+GL_RENDERBUFFER_DEPTH_SIZE = 36180 # GL/glext.h:1745
+GL_RENDERBUFFER_STENCIL_SIZE = 36181 # GL/glext.h:1746
+GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 36182 # GL/glext.h:1747
+GL_MAX_SAMPLES = 36183 # GL/glext.h:1748
+# ARB_framebuffer_object_DEPRECATED (GL/glext.h:1751)
+GL_INDEX = 33314 # GL/glext.h:1752
+GL_TEXTURE_LUMINANCE_TYPE = 35860 # GL/glext.h:1753
+GL_TEXTURE_INTENSITY_TYPE = 35861 # GL/glext.h:1754
+# ARB_framebuffer_sRGB (GL/glext.h:1757)
+GL_FRAMEBUFFER_SRGB = 36281 # GL/glext.h:1758
+# ARB_geometry_shader4 (GL/glext.h:1761)
+GL_LINES_ADJACENCY_ARB = 10 # GL/glext.h:1762
+GL_LINE_STRIP_ADJACENCY_ARB = 11 # GL/glext.h:1763
+GL_TRIANGLES_ADJACENCY_ARB = 12 # GL/glext.h:1764
+GL_TRIANGLE_STRIP_ADJACENCY_ARB = 13 # GL/glext.h:1765
+GL_PROGRAM_POINT_SIZE_ARB = 34370 # GL/glext.h:1766
+GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB = 35881 # GL/glext.h:1767
+GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB = 36263 # GL/glext.h:1768
+GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB = 36264 # GL/glext.h:1769
+GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB = 36265 # GL/glext.h:1770
+GL_GEOMETRY_SHADER_ARB = 36313 # GL/glext.h:1771
+GL_GEOMETRY_VERTICES_OUT_ARB = 36314 # GL/glext.h:1772
+GL_GEOMETRY_INPUT_TYPE_ARB = 36315 # GL/glext.h:1773
+GL_GEOMETRY_OUTPUT_TYPE_ARB = 36316 # GL/glext.h:1774
+GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB = 36317 # GL/glext.h:1775
+GL_MAX_VERTEX_VARYING_COMPONENTS_ARB = 36318 # GL/glext.h:1776
+GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB = 36319 # GL/glext.h:1777
+GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB = 36320 # GL/glext.h:1778
+GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB = 36321 # GL/glext.h:1779
+# ARB_half_float_vertex (GL/glext.h:1784)
+GL_HALF_FLOAT = 5131 # GL/glext.h:1785
+# ARB_instanced_arrays (GL/glext.h:1788)
+GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB = 35070 # GL/glext.h:1789
+# ARB_map_buffer_range (GL/glext.h:1792)
+GL_MAP_READ_BIT = 1 # GL/glext.h:1793
+GL_MAP_WRITE_BIT = 2 # GL/glext.h:1794
+GL_MAP_INVALIDATE_RANGE_BIT = 4 # GL/glext.h:1795
+GL_MAP_INVALIDATE_BUFFER_BIT = 8 # GL/glext.h:1796
+GL_MAP_FLUSH_EXPLICIT_BIT = 16 # GL/glext.h:1797
+GL_MAP_UNSYNCHRONIZED_BIT = 32 # GL/glext.h:1798
+# ARB_texture_buffer_object (GL/glext.h:1801)
+GL_TEXTURE_BUFFER_ARB = 35882 # GL/glext.h:1802
+GL_MAX_TEXTURE_BUFFER_SIZE_ARB = 35883 # GL/glext.h:1803
+GL_TEXTURE_BINDING_BUFFER_ARB = 35884 # GL/glext.h:1804
+GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB = 35885 # GL/glext.h:1805
+GL_TEXTURE_BUFFER_FORMAT_ARB = 35886 # GL/glext.h:1806
+# ARB_texture_compression_rgtc (GL/glext.h:1809)
+GL_COMPRESSED_RED_RGTC1 = 36283 # GL/glext.h:1810
+GL_COMPRESSED_SIGNED_RED_RGTC1 = 36284 # GL/glext.h:1811
+GL_COMPRESSED_RG_RGTC2 = 36285 # GL/glext.h:1812
+GL_COMPRESSED_SIGNED_RG_RGTC2 = 36286 # GL/glext.h:1813
+# ARB_texture_rg (GL/glext.h:1816)
+GL_RG = 33319 # GL/glext.h:1817
+GL_RG_INTEGER = 33320 # GL/glext.h:1818
+GL_R8 = 33321 # GL/glext.h:1819
+GL_R16 = 33322 # GL/glext.h:1820
+GL_RG8 = 33323 # GL/glext.h:1821
+GL_RG16 = 33324 # GL/glext.h:1822
+GL_R16F = 33325 # GL/glext.h:1823
+GL_R32F = 33326 # GL/glext.h:1824
+GL_RG16F = 33327 # GL/glext.h:1825
+GL_RG32F = 33328 # GL/glext.h:1826
+GL_R8I = 33329 # GL/glext.h:1827
+GL_R8UI = 33330 # GL/glext.h:1828
+GL_R16I = 33331 # GL/glext.h:1829
+GL_R16UI = 33332 # GL/glext.h:1830
+GL_R32I = 33333 # GL/glext.h:1831
+GL_R32UI = 33334 # GL/glext.h:1832
+GL_RG8I = 33335 # GL/glext.h:1833
+GL_RG8UI = 33336 # GL/glext.h:1834
+GL_RG16I = 33337 # GL/glext.h:1835
+GL_RG16UI = 33338 # GL/glext.h:1836
+GL_RG32I = 33339 # GL/glext.h:1837
+GL_RG32UI = 33340 # GL/glext.h:1838
+# ARB_vertex_array_object (GL/glext.h:1841)
+GL_VERTEX_ARRAY_BINDING = 34229 # GL/glext.h:1842
+# ARB_uniform_buffer_object (GL/glext.h:1845)
+GL_UNIFORM_BUFFER = 35345 # GL/glext.h:1846
+GL_UNIFORM_BUFFER_BINDING = 35368 # GL/glext.h:1847
+GL_UNIFORM_BUFFER_START = 35369 # GL/glext.h:1848
+GL_UNIFORM_BUFFER_SIZE = 35370 # GL/glext.h:1849
+GL_MAX_VERTEX_UNIFORM_BLOCKS = 35371 # GL/glext.h:1850
+GL_MAX_GEOMETRY_UNIFORM_BLOCKS = 35372 # GL/glext.h:1851
+GL_MAX_FRAGMENT_UNIFORM_BLOCKS = 35373 # GL/glext.h:1852
+GL_MAX_COMBINED_UNIFORM_BLOCKS = 35374 # GL/glext.h:1853
+GL_MAX_UNIFORM_BUFFER_BINDINGS = 35375 # GL/glext.h:1854
+GL_MAX_UNIFORM_BLOCK_SIZE = 35376 # GL/glext.h:1855
+GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 35377 # GL/glext.h:1856
+GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS = 35378 # GL/glext.h:1857
+GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 35379 # GL/glext.h:1858
+GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT = 35380 # GL/glext.h:1859
+GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH = 35381 # GL/glext.h:1860
+GL_ACTIVE_UNIFORM_BLOCKS = 35382 # GL/glext.h:1861
+GL_UNIFORM_TYPE = 35383 # GL/glext.h:1862
+GL_UNIFORM_SIZE = 35384 # GL/glext.h:1863
+GL_UNIFORM_NAME_LENGTH = 35385 # GL/glext.h:1864
+GL_UNIFORM_BLOCK_INDEX = 35386 # GL/glext.h:1865
+GL_UNIFORM_OFFSET = 35387 # GL/glext.h:1866
+GL_UNIFORM_ARRAY_STRIDE = 35388 # GL/glext.h:1867
+GL_UNIFORM_MATRIX_STRIDE = 35389 # GL/glext.h:1868
+GL_UNIFORM_IS_ROW_MAJOR = 35390 # GL/glext.h:1869
+GL_UNIFORM_BLOCK_BINDING = 35391 # GL/glext.h:1870
+GL_UNIFORM_BLOCK_DATA_SIZE = 35392 # GL/glext.h:1871
+GL_UNIFORM_BLOCK_NAME_LENGTH = 35393 # GL/glext.h:1872
+GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS = 35394 # GL/glext.h:1873
+GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 35395 # GL/glext.h:1874
+GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 35396 # GL/glext.h:1875
+GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER = 35397 # GL/glext.h:1876
+GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 35398 # GL/glext.h:1877
+GL_INVALID_INDEX = 4294967295 # GL/glext.h:1878
+# ARB_compatibility (GL/glext.h:1881)
+# ARB_copy_buffer (GL/glext.h:1885)
+GL_COPY_READ_BUFFER_BINDING = 36662 # GL/glext.h:1886
+GL_COPY_READ_BUFFER = 36662 # GL/glext.h:1887
+GL_COPY_WRITE_BUFFER_BINDING = 36663 # GL/glext.h:1888
+GL_COPY_WRITE_BUFFER = 36663 # GL/glext.h:1889
+# ARB_shader_texture_lod (GL/glext.h:1892)
+# ARB_depth_clamp (GL/glext.h:1895)
+GL_DEPTH_CLAMP = 34383 # GL/glext.h:1896
+# ARB_draw_elements_base_vertex (GL/glext.h:1899)
+# ARB_fragment_coord_conventions (GL/glext.h:1902)
+# ARB_provoking_vertex (GL/glext.h:1905)
+GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION = 36428 # GL/glext.h:1906
+GL_FIRST_VERTEX_CONVENTION = 36429 # GL/glext.h:1907
+GL_LAST_VERTEX_CONVENTION = 36430 # GL/glext.h:1908
+GL_PROVOKING_VERTEX = 36431 # GL/glext.h:1909
+# ARB_seamless_cube_map (GL/glext.h:1912)
+GL_TEXTURE_CUBE_MAP_SEAMLESS = 34895 # GL/glext.h:1913
+# ARB_sync (GL/glext.h:1916)
+GL_MAX_SERVER_WAIT_TIMEOUT = 37137 # GL/glext.h:1917
+GL_OBJECT_TYPE = 37138 # GL/glext.h:1918
+GL_SYNC_CONDITION = 37139 # GL/glext.h:1919
+GL_SYNC_STATUS = 37140 # GL/glext.h:1920
+GL_SYNC_FLAGS = 37141 # GL/glext.h:1921
+GL_SYNC_FENCE = 37142 # GL/glext.h:1922
+GL_SYNC_GPU_COMMANDS_COMPLETE = 37143 # GL/glext.h:1923
+GL_UNSIGNALED = 37144 # GL/glext.h:1924
+GL_SIGNALED = 37145 # GL/glext.h:1925
+GL_ALREADY_SIGNALED = 37146 # GL/glext.h:1926
+GL_TIMEOUT_EXPIRED = 37147 # GL/glext.h:1927
+GL_CONDITION_SATISFIED = 37148 # GL/glext.h:1928
+GL_WAIT_FAILED = 37149 # GL/glext.h:1929
+GL_SYNC_FLUSH_COMMANDS_BIT = 1 # GL/glext.h:1930
+GL_TIMEOUT_IGNORED = 18446744073709551615 # GL/glext.h:1931
+# ARB_texture_multisample (GL/glext.h:1934)
+GL_SAMPLE_POSITION = 36432 # GL/glext.h:1935
+GL_SAMPLE_MASK = 36433 # GL/glext.h:1936
+GL_SAMPLE_MASK_VALUE = 36434 # GL/glext.h:1937
+GL_MAX_SAMPLE_MASK_WORDS = 36441 # GL/glext.h:1938
+GL_TEXTURE_2D_MULTISAMPLE = 37120 # GL/glext.h:1939
+GL_PROXY_TEXTURE_2D_MULTISAMPLE = 37121 # GL/glext.h:1940
+GL_TEXTURE_2D_MULTISAMPLE_ARRAY = 37122 # GL/glext.h:1941
+GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY = 37123 # GL/glext.h:1942
+GL_TEXTURE_BINDING_2D_MULTISAMPLE = 37124 # GL/glext.h:1943
+GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY = 37125 # GL/glext.h:1944
+GL_TEXTURE_SAMPLES = 37126 # GL/glext.h:1945
+GL_TEXTURE_FIXED_SAMPLE_LOCATIONS = 37127 # GL/glext.h:1946
+GL_SAMPLER_2D_MULTISAMPLE = 37128 # GL/glext.h:1947
+GL_INT_SAMPLER_2D_MULTISAMPLE = 37129 # GL/glext.h:1948
+GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE = 37130 # GL/glext.h:1949
+GL_SAMPLER_2D_MULTISAMPLE_ARRAY = 37131 # GL/glext.h:1950
+GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 37132 # GL/glext.h:1951
+GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 37133 # GL/glext.h:1952
+GL_MAX_COLOR_TEXTURE_SAMPLES = 37134 # GL/glext.h:1953
+GL_MAX_DEPTH_TEXTURE_SAMPLES = 37135 # GL/glext.h:1954
+GL_MAX_INTEGER_SAMPLES = 37136 # GL/glext.h:1955
+# ARB_vertex_array_bgra (GL/glext.h:1958)
+# ARB_draw_buffers_blend (GL/glext.h:1962)
+# ARB_sample_shading (GL/glext.h:1965)
+GL_SAMPLE_SHADING_ARB = 35894 # GL/glext.h:1966
+GL_MIN_SAMPLE_SHADING_VALUE_ARB = 35895 # GL/glext.h:1967
+# ARB_texture_cube_map_array (GL/glext.h:1970)
+GL_TEXTURE_CUBE_MAP_ARRAY_ARB = 36873 # GL/glext.h:1971
+GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB = 36874 # GL/glext.h:1972
+GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB = 36875 # GL/glext.h:1973
+GL_SAMPLER_CUBE_MAP_ARRAY_ARB = 36876 # GL/glext.h:1974
+GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB = 36877 # GL/glext.h:1975
+GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB = 36878 # GL/glext.h:1976
+GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB = 36879 # GL/glext.h:1977
+# ARB_texture_gather (GL/glext.h:1980)
+GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB = 36446 # GL/glext.h:1981
+GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB = 36447 # GL/glext.h:1982
+# ARB_texture_query_lod (GL/glext.h:1985)
+# ARB_shading_language_include (GL/glext.h:1988)
+GL_SHADER_INCLUDE_ARB = 36270 # GL/glext.h:1989
+GL_NAMED_STRING_LENGTH_ARB = 36329 # GL/glext.h:1990
+GL_NAMED_STRING_TYPE_ARB = 36330 # GL/glext.h:1991
+# ARB_texture_compression_bptc (GL/glext.h:1994)
+GL_COMPRESSED_RGBA_BPTC_UNORM_ARB = 36492 # GL/glext.h:1995
+GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB = 36493 # GL/glext.h:1996
+GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB = 36494 # GL/glext.h:1997
+GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB = 36495 # GL/glext.h:1998
+# ARB_blend_func_extended (GL/glext.h:2001)
+GL_SRC1_COLOR = 35065 # GL/glext.h:2002
+GL_ONE_MINUS_SRC1_COLOR = 35066 # GL/glext.h:2004
+GL_ONE_MINUS_SRC1_ALPHA = 35067 # GL/glext.h:2005
+GL_MAX_DUAL_SOURCE_DRAW_BUFFERS = 35068 # GL/glext.h:2006
+# ARB_explicit_attrib_location (GL/glext.h:2009)
+# ARB_occlusion_query2 (GL/glext.h:2012)
+GL_ANY_SAMPLES_PASSED = 35887 # GL/glext.h:2013
+# ARB_sampler_objects (GL/glext.h:2016)
+GL_SAMPLER_BINDING = 35097 # GL/glext.h:2017
+# ARB_shader_bit_encoding (GL/glext.h:2020)
+# ARB_texture_rgb10_a2ui (GL/glext.h:2023)
+GL_RGB10_A2UI = 36975 # GL/glext.h:2024
+# ARB_texture_swizzle (GL/glext.h:2027)
+GL_TEXTURE_SWIZZLE_R = 36418 # GL/glext.h:2028
+GL_TEXTURE_SWIZZLE_G = 36419 # GL/glext.h:2029
+GL_TEXTURE_SWIZZLE_B = 36420 # GL/glext.h:2030
+GL_TEXTURE_SWIZZLE_A = 36421 # GL/glext.h:2031
+GL_TEXTURE_SWIZZLE_RGBA = 36422 # GL/glext.h:2032
+# ARB_timer_query (GL/glext.h:2035)
+GL_TIME_ELAPSED = 35007 # GL/glext.h:2036
+GL_TIMESTAMP = 36392 # GL/glext.h:2037
+# ARB_vertex_type_2_10_10_10_rev (GL/glext.h:2040)
+GL_INT_2_10_10_10_REV = 36255 # GL/glext.h:2042
+# ARB_draw_indirect (GL/glext.h:2045)
+GL_DRAW_INDIRECT_BUFFER = 36671 # GL/glext.h:2046
+GL_DRAW_INDIRECT_BUFFER_BINDING = 36675 # GL/glext.h:2047
+# ARB_gpu_shader5 (GL/glext.h:2050)
+GL_GEOMETRY_SHADER_INVOCATIONS = 34943 # GL/glext.h:2051
+GL_MAX_GEOMETRY_SHADER_INVOCATIONS = 36442 # GL/glext.h:2052
+GL_MIN_FRAGMENT_INTERPOLATION_OFFSET = 36443 # GL/glext.h:2053
+GL_MAX_FRAGMENT_INTERPOLATION_OFFSET = 36444 # GL/glext.h:2054
+GL_FRAGMENT_INTERPOLATION_OFFSET_BITS = 36445 # GL/glext.h:2055
+# ARB_gpu_shader_fp64 (GL/glext.h:2059)
+GL_DOUBLE_VEC2 = 36860 # GL/glext.h:2061
+GL_DOUBLE_VEC3 = 36861 # GL/glext.h:2062
+GL_DOUBLE_VEC4 = 36862 # GL/glext.h:2063
+GL_DOUBLE_MAT2 = 36678 # GL/glext.h:2064
+GL_DOUBLE_MAT3 = 36679 # GL/glext.h:2065
+GL_DOUBLE_MAT4 = 36680 # GL/glext.h:2066
+GL_DOUBLE_MAT2x3 = 36681 # GL/glext.h:2067
+GL_DOUBLE_MAT2x4 = 36682 # GL/glext.h:2068
+GL_DOUBLE_MAT3x2 = 36683 # GL/glext.h:2069
+GL_DOUBLE_MAT3x4 = 36684 # GL/glext.h:2070
+GL_DOUBLE_MAT4x2 = 36685 # GL/glext.h:2071
+GL_DOUBLE_MAT4x3 = 36686 # GL/glext.h:2072
+# ARB_shader_subroutine (GL/glext.h:2075)
+GL_ACTIVE_SUBROUTINES = 36325 # GL/glext.h:2076
+GL_ACTIVE_SUBROUTINE_UNIFORMS = 36326 # GL/glext.h:2077
+GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS = 36423 # GL/glext.h:2078
+GL_ACTIVE_SUBROUTINE_MAX_LENGTH = 36424 # GL/glext.h:2079
+GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH = 36425 # GL/glext.h:2080
+GL_MAX_SUBROUTINES = 36327 # GL/glext.h:2081
+GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS = 36328 # GL/glext.h:2082
+GL_NUM_COMPATIBLE_SUBROUTINES = 36426 # GL/glext.h:2083
+GL_COMPATIBLE_SUBROUTINES = 36427 # GL/glext.h:2084
+# ARB_tessellation_shader (GL/glext.h:2089)
+GL_PATCHES = 14 # GL/glext.h:2090
+GL_PATCH_VERTICES = 36466 # GL/glext.h:2091
+GL_PATCH_DEFAULT_INNER_LEVEL = 36467 # GL/glext.h:2092
+GL_PATCH_DEFAULT_OUTER_LEVEL = 36468 # GL/glext.h:2093
+GL_TESS_CONTROL_OUTPUT_VERTICES = 36469 # GL/glext.h:2094
+GL_TESS_GEN_MODE = 36470 # GL/glext.h:2095
+GL_TESS_GEN_SPACING = 36471 # GL/glext.h:2096
+GL_TESS_GEN_VERTEX_ORDER = 36472 # GL/glext.h:2097
+GL_TESS_GEN_POINT_MODE = 36473 # GL/glext.h:2098
+GL_ISOLINES = 36474 # GL/glext.h:2101
+GL_FRACTIONAL_ODD = 36475 # GL/glext.h:2103
+GL_FRACTIONAL_EVEN = 36476 # GL/glext.h:2104
+GL_MAX_PATCH_VERTICES = 36477 # GL/glext.h:2107
+GL_MAX_TESS_GEN_LEVEL = 36478 # GL/glext.h:2108
+GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS = 36479 # GL/glext.h:2109
+GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS = 36480 # GL/glext.h:2110
+GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS = 36481 # GL/glext.h:2111
+GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS = 36482 # GL/glext.h:2112
+GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS = 36483 # GL/glext.h:2113
+GL_MAX_TESS_PATCH_COMPONENTS = 36484 # GL/glext.h:2114
+GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS = 36485 # GL/glext.h:2115
+GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS = 36486 # GL/glext.h:2116
+GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS = 36489 # GL/glext.h:2117
+GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS = 36490 # GL/glext.h:2118
+GL_MAX_TESS_CONTROL_INPUT_COMPONENTS = 34924 # GL/glext.h:2119
+GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS = 34925 # GL/glext.h:2120
+GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS = 36382 # GL/glext.h:2121
+GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS = 36383 # GL/glext.h:2122
+GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER = 34032 # GL/glext.h:2123
+GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER = 34033 # GL/glext.h:2124
+GL_TESS_EVALUATION_SHADER = 36487 # GL/glext.h:2125
+GL_TESS_CONTROL_SHADER = 36488 # GL/glext.h:2126
+# ARB_texture_buffer_object_rgb32 (GL/glext.h:2129)
+# ARB_transform_feedback2 (GL/glext.h:2135)
+GL_TRANSFORM_FEEDBACK = 36386 # GL/glext.h:2136
+GL_TRANSFORM_FEEDBACK_PAUSED = 36387 # GL/glext.h:2137
+GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED = 36387 # GL/glext.h:2138
+GL_TRANSFORM_FEEDBACK_ACTIVE = 36388 # GL/glext.h:2139
+GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE = 36388 # GL/glext.h:2140
+GL_TRANSFORM_FEEDBACK_BINDING = 36389 # GL/glext.h:2141
+# ARB_transform_feedback3 (GL/glext.h:2144)
+GL_MAX_TRANSFORM_FEEDBACK_BUFFERS = 36464 # GL/glext.h:2145
+GL_MAX_VERTEX_STREAMS = 36465 # GL/glext.h:2146
+# ARB_ES2_compatibility (GL/glext.h:2149)
+GL_FIXED = 5132 # GL/glext.h:2150
+GL_IMPLEMENTATION_COLOR_READ_TYPE = 35738 # GL/glext.h:2151
+GL_IMPLEMENTATION_COLOR_READ_FORMAT = 35739 # GL/glext.h:2152
+GL_LOW_FLOAT = 36336 # GL/glext.h:2153
+GL_MEDIUM_FLOAT = 36337 # GL/glext.h:2154
+GL_HIGH_FLOAT = 36338 # GL/glext.h:2155
+GL_LOW_INT = 36339 # GL/glext.h:2156
+GL_MEDIUM_INT = 36340 # GL/glext.h:2157
+GL_HIGH_INT = 36341 # GL/glext.h:2158
+GL_SHADER_COMPILER = 36346 # GL/glext.h:2159
+GL_NUM_SHADER_BINARY_FORMATS = 36345 # GL/glext.h:2160
+GL_MAX_VERTEX_UNIFORM_VECTORS = 36347 # GL/glext.h:2161
+GL_MAX_VARYING_VECTORS = 36348 # GL/glext.h:2162
+GL_MAX_FRAGMENT_UNIFORM_VECTORS = 36349 # GL/glext.h:2163
+GL_RGB565 = 36194 # GL/glext.h:2164
+# ARB_get_program_binary (GL/glext.h:2167)
+GL_PROGRAM_BINARY_RETRIEVABLE_HINT = 33367 # GL/glext.h:2168
+GL_PROGRAM_BINARY_LENGTH = 34625 # GL/glext.h:2169
+GL_NUM_PROGRAM_BINARY_FORMATS = 34814 # GL/glext.h:2170
+GL_PROGRAM_BINARY_FORMATS = 34815 # GL/glext.h:2171
+# ARB_separate_shader_objects (GL/glext.h:2174)
+GL_VERTEX_SHADER_BIT = 1 # GL/glext.h:2175
+GL_FRAGMENT_SHADER_BIT = 2 # GL/glext.h:2176
+GL_GEOMETRY_SHADER_BIT = 4 # GL/glext.h:2177
+GL_TESS_CONTROL_SHADER_BIT = 8 # GL/glext.h:2178
+GL_TESS_EVALUATION_SHADER_BIT = 16 # GL/glext.h:2179
+GL_ALL_SHADER_BITS = 4294967295 # GL/glext.h:2180
+GL_PROGRAM_SEPARABLE = 33368 # GL/glext.h:2181
+GL_ACTIVE_PROGRAM = 33369 # GL/glext.h:2182
+GL_PROGRAM_PIPELINE_BINDING = 33370 # GL/glext.h:2183
+# ARB_shader_precision (GL/glext.h:2186)
+# ARB_vertex_attrib_64bit (GL/glext.h:2189)
+# ARB_viewport_array (GL/glext.h:2205)
+GL_MAX_VIEWPORTS = 33371 # GL/glext.h:2210
+GL_VIEWPORT_SUBPIXEL_BITS = 33372 # GL/glext.h:2211
+GL_VIEWPORT_BOUNDS_RANGE = 33373 # GL/glext.h:2212
+GL_LAYER_PROVOKING_VERTEX = 33374 # GL/glext.h:2213
+GL_VIEWPORT_INDEX_PROVOKING_VERTEX = 33375 # GL/glext.h:2214
+GL_UNDEFINED_VERTEX = 33376 # GL/glext.h:2215
+# ARB_cl_event (GL/glext.h:2221)
+GL_SYNC_CL_EVENT_ARB = 33344 # GL/glext.h:2222
+GL_SYNC_CL_EVENT_COMPLETE_ARB = 33345 # GL/glext.h:2223
+# ARB_debug_output (GL/glext.h:2226)
+GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB = 33346 # GL/glext.h:2227
+GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB = 33347 # GL/glext.h:2228
+GL_DEBUG_CALLBACK_FUNCTION_ARB = 33348 # GL/glext.h:2229
+GL_DEBUG_CALLBACK_USER_PARAM_ARB = 33349 # GL/glext.h:2230
+GL_DEBUG_SOURCE_API_ARB = 33350 # GL/glext.h:2231
+GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB = 33351 # GL/glext.h:2232
+GL_DEBUG_SOURCE_SHADER_COMPILER_ARB = 33352 # GL/glext.h:2233
+GL_DEBUG_SOURCE_THIRD_PARTY_ARB = 33353 # GL/glext.h:2234
+GL_DEBUG_SOURCE_APPLICATION_ARB = 33354 # GL/glext.h:2235
+GL_DEBUG_SOURCE_OTHER_ARB = 33355 # GL/glext.h:2236
+GL_DEBUG_TYPE_ERROR_ARB = 33356 # GL/glext.h:2237
+GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB = 33357 # GL/glext.h:2238
+GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB = 33358 # GL/glext.h:2239
+GL_DEBUG_TYPE_PORTABILITY_ARB = 33359 # GL/glext.h:2240
+GL_DEBUG_TYPE_PERFORMANCE_ARB = 33360 # GL/glext.h:2241
+GL_DEBUG_TYPE_OTHER_ARB = 33361 # GL/glext.h:2242
+GL_MAX_DEBUG_MESSAGE_LENGTH_ARB = 37187 # GL/glext.h:2243
+GL_MAX_DEBUG_LOGGED_MESSAGES_ARB = 37188 # GL/glext.h:2244
+GL_DEBUG_LOGGED_MESSAGES_ARB = 37189 # GL/glext.h:2245
+GL_DEBUG_SEVERITY_HIGH_ARB = 37190 # GL/glext.h:2246
+GL_DEBUG_SEVERITY_MEDIUM_ARB = 37191 # GL/glext.h:2247
+GL_DEBUG_SEVERITY_LOW_ARB = 37192 # GL/glext.h:2248
+# ARB_robustness (GL/glext.h:2251)
+GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB = 4 # GL/glext.h:2253
+GL_LOSE_CONTEXT_ON_RESET_ARB = 33362 # GL/glext.h:2254
+GL_GUILTY_CONTEXT_RESET_ARB = 33363 # GL/glext.h:2255
+GL_INNOCENT_CONTEXT_RESET_ARB = 33364 # GL/glext.h:2256
+GL_UNKNOWN_CONTEXT_RESET_ARB = 33365 # GL/glext.h:2257
+GL_RESET_NOTIFICATION_STRATEGY_ARB = 33366 # GL/glext.h:2258
+GL_NO_RESET_NOTIFICATION_ARB = 33377 # GL/glext.h:2259
+# ARB_shader_stencil_export (GL/glext.h:2262)
+# ARB_base_instance (GL/glext.h:2265)
+# ARB_shading_language_420pack (GL/glext.h:2268)
+# ARB_transform_feedback_instanced (GL/glext.h:2271)
+# ARB_compressed_texture_pixel_storage (GL/glext.h:2274)
+GL_UNPACK_COMPRESSED_BLOCK_WIDTH = 37159 # GL/glext.h:2275
+GL_UNPACK_COMPRESSED_BLOCK_HEIGHT = 37160 # GL/glext.h:2276
+GL_UNPACK_COMPRESSED_BLOCK_DEPTH = 37161 # GL/glext.h:2277
+GL_UNPACK_COMPRESSED_BLOCK_SIZE = 37162 # GL/glext.h:2278
+GL_PACK_COMPRESSED_BLOCK_WIDTH = 37163 # GL/glext.h:2279
+GL_PACK_COMPRESSED_BLOCK_HEIGHT = 37164 # GL/glext.h:2280
+GL_PACK_COMPRESSED_BLOCK_DEPTH = 37165 # GL/glext.h:2281
+GL_PACK_COMPRESSED_BLOCK_SIZE = 37166 # GL/glext.h:2282
+# ARB_conservative_depth (GL/glext.h:2285)
+# ARB_internalformat_query (GL/glext.h:2288)
+GL_NUM_SAMPLE_COUNTS = 37760 # GL/glext.h:2289
+# ARB_map_buffer_alignment (GL/glext.h:2292)
+GL_MIN_MAP_BUFFER_ALIGNMENT = 37052 # GL/glext.h:2293
+# ARB_shader_atomic_counters (GL/glext.h:2296)
+GL_ATOMIC_COUNTER_BUFFER = 37568 # GL/glext.h:2297
+GL_ATOMIC_COUNTER_BUFFER_BINDING = 37569 # GL/glext.h:2298
+GL_ATOMIC_COUNTER_BUFFER_START = 37570 # GL/glext.h:2299
+GL_ATOMIC_COUNTER_BUFFER_SIZE = 37571 # GL/glext.h:2300
+GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE = 37572 # GL/glext.h:2301
+GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS = 37573 # GL/glext.h:2302
+GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES = 37574 # GL/glext.h:2303
+GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER = 37575 # GL/glext.h:2304
+GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER = 37576 # GL/glext.h:2305
+GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER = 37577 # GL/glext.h:2306
+GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER = 37578 # GL/glext.h:2307
+GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER = 37579 # GL/glext.h:2308
+GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS = 37580 # GL/glext.h:2309
+GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS = 37581 # GL/glext.h:2310
+GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS = 37582 # GL/glext.h:2311
+GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS = 37583 # GL/glext.h:2312
+GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS = 37584 # GL/glext.h:2313
+GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS = 37585 # GL/glext.h:2314
+GL_MAX_VERTEX_ATOMIC_COUNTERS = 37586 # GL/glext.h:2315
+GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS = 37587 # GL/glext.h:2316
+GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS = 37588 # GL/glext.h:2317
+GL_MAX_GEOMETRY_ATOMIC_COUNTERS = 37589 # GL/glext.h:2318
+GL_MAX_FRAGMENT_ATOMIC_COUNTERS = 37590 # GL/glext.h:2319
+GL_MAX_COMBINED_ATOMIC_COUNTERS = 37591 # GL/glext.h:2320
+GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE = 37592 # GL/glext.h:2321
+GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS = 37596 # GL/glext.h:2322
+GL_ACTIVE_ATOMIC_COUNTER_BUFFERS = 37593 # GL/glext.h:2323
+GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX = 37594 # GL/glext.h:2324
+GL_UNSIGNED_INT_ATOMIC_COUNTER = 37595 # GL/glext.h:2325
+# ARB_shader_image_load_store (GL/glext.h:2328)
+GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT = 1 # GL/glext.h:2329
+GL_ELEMENT_ARRAY_BARRIER_BIT = 2 # GL/glext.h:2330
+GL_UNIFORM_BARRIER_BIT = 4 # GL/glext.h:2331
+GL_TEXTURE_FETCH_BARRIER_BIT = 8 # GL/glext.h:2332
+GL_SHADER_IMAGE_ACCESS_BARRIER_BIT = 32 # GL/glext.h:2333
+GL_COMMAND_BARRIER_BIT = 64 # GL/glext.h:2334
+GL_PIXEL_BUFFER_BARRIER_BIT = 128 # GL/glext.h:2335
+GL_TEXTURE_UPDATE_BARRIER_BIT = 256 # GL/glext.h:2336
+GL_BUFFER_UPDATE_BARRIER_BIT = 512 # GL/glext.h:2337
+GL_FRAMEBUFFER_BARRIER_BIT = 1024 # GL/glext.h:2338
+GL_TRANSFORM_FEEDBACK_BARRIER_BIT = 2048 # GL/glext.h:2339
+GL_ATOMIC_COUNTER_BARRIER_BIT = 4096 # GL/glext.h:2340
+GL_ALL_BARRIER_BITS = 4294967295 # GL/glext.h:2341
+GL_MAX_IMAGE_UNITS = 36664 # GL/glext.h:2342
+GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS = 36665 # GL/glext.h:2343
+GL_IMAGE_BINDING_NAME = 36666 # GL/glext.h:2344
+GL_IMAGE_BINDING_LEVEL = 36667 # GL/glext.h:2345
+GL_IMAGE_BINDING_LAYERED = 36668 # GL/glext.h:2346
+GL_IMAGE_BINDING_LAYER = 36669 # GL/glext.h:2347
+GL_IMAGE_BINDING_ACCESS = 36670 # GL/glext.h:2348
+GL_IMAGE_1D = 36940 # GL/glext.h:2349
+GL_IMAGE_2D = 36941 # GL/glext.h:2350
+GL_IMAGE_3D = 36942 # GL/glext.h:2351
+GL_IMAGE_2D_RECT = 36943 # GL/glext.h:2352
+GL_IMAGE_CUBE = 36944 # GL/glext.h:2353
+GL_IMAGE_BUFFER = 36945 # GL/glext.h:2354
+GL_IMAGE_1D_ARRAY = 36946 # GL/glext.h:2355
+GL_IMAGE_2D_ARRAY = 36947 # GL/glext.h:2356
+GL_IMAGE_CUBE_MAP_ARRAY = 36948 # GL/glext.h:2357
+GL_IMAGE_2D_MULTISAMPLE = 36949 # GL/glext.h:2358
+GL_IMAGE_2D_MULTISAMPLE_ARRAY = 36950 # GL/glext.h:2359
+GL_INT_IMAGE_1D = 36951 # GL/glext.h:2360
+GL_INT_IMAGE_2D = 36952 # GL/glext.h:2361
+GL_INT_IMAGE_3D = 36953 # GL/glext.h:2362
+GL_INT_IMAGE_2D_RECT = 36954 # GL/glext.h:2363
+GL_INT_IMAGE_CUBE = 36955 # GL/glext.h:2364
+GL_INT_IMAGE_BUFFER = 36956 # GL/glext.h:2365
+GL_INT_IMAGE_1D_ARRAY = 36957 # GL/glext.h:2366
+GL_INT_IMAGE_2D_ARRAY = 36958 # GL/glext.h:2367
+GL_INT_IMAGE_CUBE_MAP_ARRAY = 36959 # GL/glext.h:2368
+GL_INT_IMAGE_2D_MULTISAMPLE = 36960 # GL/glext.h:2369
+GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY = 36961 # GL/glext.h:2370
+GL_UNSIGNED_INT_IMAGE_1D = 36962 # GL/glext.h:2371
+GL_UNSIGNED_INT_IMAGE_2D = 36963 # GL/glext.h:2372
+GL_UNSIGNED_INT_IMAGE_3D = 36964 # GL/glext.h:2373
+GL_UNSIGNED_INT_IMAGE_2D_RECT = 36965 # GL/glext.h:2374
+GL_UNSIGNED_INT_IMAGE_CUBE = 36966 # GL/glext.h:2375
+GL_UNSIGNED_INT_IMAGE_BUFFER = 36967 # GL/glext.h:2376
+GL_UNSIGNED_INT_IMAGE_1D_ARRAY = 36968 # GL/glext.h:2377
+GL_UNSIGNED_INT_IMAGE_2D_ARRAY = 36969 # GL/glext.h:2378
+GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY = 36970 # GL/glext.h:2379
+GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE = 36971 # GL/glext.h:2380
+GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY = 36972 # GL/glext.h:2381
+GL_MAX_IMAGE_SAMPLES = 36973 # GL/glext.h:2382
+GL_IMAGE_BINDING_FORMAT = 36974 # GL/glext.h:2383
+GL_IMAGE_FORMAT_COMPATIBILITY_TYPE = 37063 # GL/glext.h:2384
+GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE = 37064 # GL/glext.h:2385
+GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS = 37065 # GL/glext.h:2386
+GL_MAX_VERTEX_IMAGE_UNIFORMS = 37066 # GL/glext.h:2387
+GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS = 37067 # GL/glext.h:2388
+GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS = 37068 # GL/glext.h:2389
+GL_MAX_GEOMETRY_IMAGE_UNIFORMS = 37069 # GL/glext.h:2390
+GL_MAX_FRAGMENT_IMAGE_UNIFORMS = 37070 # GL/glext.h:2391
+GL_MAX_COMBINED_IMAGE_UNIFORMS = 37071 # GL/glext.h:2392
+# ARB_shading_language_packing (GL/glext.h:2395)
+# ARB_texture_storage (GL/glext.h:2398)
+GL_TEXTURE_IMMUTABLE_FORMAT = 37167 # GL/glext.h:2399
+# EXT_abgr (GL/glext.h:2402)
+GL_ABGR_EXT = 32768 # GL/glext.h:2403
+# EXT_blend_color (GL/glext.h:2406)
+GL_CONSTANT_COLOR_EXT = 32769 # GL/glext.h:2407
+GL_ONE_MINUS_CONSTANT_COLOR_EXT = 32770 # GL/glext.h:2408
+GL_CONSTANT_ALPHA_EXT = 32771 # GL/glext.h:2409
+GL_ONE_MINUS_CONSTANT_ALPHA_EXT = 32772 # GL/glext.h:2410
+GL_BLEND_COLOR_EXT = 32773 # GL/glext.h:2411
+# EXT_polygon_offset (GL/glext.h:2414)
+GL_POLYGON_OFFSET_EXT = 32823 # GL/glext.h:2415
+GL_POLYGON_OFFSET_FACTOR_EXT = 32824 # GL/glext.h:2416
+GL_POLYGON_OFFSET_BIAS_EXT = 32825 # GL/glext.h:2417
+# EXT_texture (GL/glext.h:2420)
+GL_ALPHA4_EXT = 32827 # GL/glext.h:2421
+GL_ALPHA8_EXT = 32828 # GL/glext.h:2422
+GL_ALPHA12_EXT = 32829 # GL/glext.h:2423
+GL_ALPHA16_EXT = 32830 # GL/glext.h:2424
+GL_LUMINANCE4_EXT = 32831 # GL/glext.h:2425
+GL_LUMINANCE8_EXT = 32832 # GL/glext.h:2426
+GL_LUMINANCE12_EXT = 32833 # GL/glext.h:2427
+GL_LUMINANCE16_EXT = 32834 # GL/glext.h:2428
+GL_LUMINANCE4_ALPHA4_EXT = 32835 # GL/glext.h:2429
+GL_LUMINANCE6_ALPHA2_EXT = 32836 # GL/glext.h:2430
+GL_LUMINANCE8_ALPHA8_EXT = 32837 # GL/glext.h:2431
+GL_LUMINANCE12_ALPHA4_EXT = 32838 # GL/glext.h:2432
+GL_LUMINANCE12_ALPHA12_EXT = 32839 # GL/glext.h:2433
+GL_LUMINANCE16_ALPHA16_EXT = 32840 # GL/glext.h:2434
+GL_INTENSITY_EXT = 32841 # GL/glext.h:2435
+GL_INTENSITY4_EXT = 32842 # GL/glext.h:2436
+GL_INTENSITY8_EXT = 32843 # GL/glext.h:2437
+GL_INTENSITY12_EXT = 32844 # GL/glext.h:2438
+GL_INTENSITY16_EXT = 32845 # GL/glext.h:2439
+GL_RGB2_EXT = 32846 # GL/glext.h:2440
+GL_RGB4_EXT = 32847 # GL/glext.h:2441
+GL_RGB5_EXT = 32848 # GL/glext.h:2442
+GL_RGB8_EXT = 32849 # GL/glext.h:2443
+GL_RGB10_EXT = 32850 # GL/glext.h:2444
+GL_RGB12_EXT = 32851 # GL/glext.h:2445
+GL_RGB16_EXT = 32852 # GL/glext.h:2446
+GL_RGBA2_EXT = 32853 # GL/glext.h:2447
+GL_RGBA4_EXT = 32854 # GL/glext.h:2448
+GL_RGB5_A1_EXT = 32855 # GL/glext.h:2449
+GL_RGBA8_EXT = 32856 # GL/glext.h:2450
+GL_RGB10_A2_EXT = 32857 # GL/glext.h:2451
+GL_RGBA12_EXT = 32858 # GL/glext.h:2452
+GL_RGBA16_EXT = 32859 # GL/glext.h:2453
+GL_TEXTURE_RED_SIZE_EXT = 32860 # GL/glext.h:2454
+GL_TEXTURE_GREEN_SIZE_EXT = 32861 # GL/glext.h:2455
+GL_TEXTURE_BLUE_SIZE_EXT = 32862 # GL/glext.h:2456
+GL_TEXTURE_ALPHA_SIZE_EXT = 32863 # GL/glext.h:2457
+GL_TEXTURE_LUMINANCE_SIZE_EXT = 32864 # GL/glext.h:2458
+GL_TEXTURE_INTENSITY_SIZE_EXT = 32865 # GL/glext.h:2459
+GL_REPLACE_EXT = 32866 # GL/glext.h:2460
+GL_PROXY_TEXTURE_1D_EXT = 32867 # GL/glext.h:2461
+GL_PROXY_TEXTURE_2D_EXT = 32868 # GL/glext.h:2462
+GL_TEXTURE_TOO_LARGE_EXT = 32869 # GL/glext.h:2463
+# EXT_texture3D (GL/glext.h:2466)
+GL_PACK_SKIP_IMAGES_EXT = 32875 # GL/glext.h:2467
+GL_PACK_IMAGE_HEIGHT_EXT = 32876 # GL/glext.h:2468
+GL_UNPACK_SKIP_IMAGES_EXT = 32877 # GL/glext.h:2469
+GL_UNPACK_IMAGE_HEIGHT_EXT = 32878 # GL/glext.h:2470
+GL_TEXTURE_3D_EXT = 32879 # GL/glext.h:2471
+GL_PROXY_TEXTURE_3D_EXT = 32880 # GL/glext.h:2472
+GL_TEXTURE_DEPTH_EXT = 32881 # GL/glext.h:2473
+GL_TEXTURE_WRAP_R_EXT = 32882 # GL/glext.h:2474
+GL_MAX_3D_TEXTURE_SIZE_EXT = 32883 # GL/glext.h:2475
+# SGIS_texture_filter4 (GL/glext.h:2478)
+GL_FILTER4_SGIS = 33094 # GL/glext.h:2479
+GL_TEXTURE_FILTER4_SIZE_SGIS = 33095 # GL/glext.h:2480
+# EXT_subtexture (GL/glext.h:2483)
+# EXT_copy_texture (GL/glext.h:2486)
+# EXT_histogram (GL/glext.h:2489)
+GL_HISTOGRAM_EXT = 32804 # GL/glext.h:2490
+GL_PROXY_HISTOGRAM_EXT = 32805 # GL/glext.h:2491
+GL_HISTOGRAM_WIDTH_EXT = 32806 # GL/glext.h:2492
+GL_HISTOGRAM_FORMAT_EXT = 32807 # GL/glext.h:2493
+GL_HISTOGRAM_RED_SIZE_EXT = 32808 # GL/glext.h:2494
+GL_HISTOGRAM_GREEN_SIZE_EXT = 32809 # GL/glext.h:2495
+GL_HISTOGRAM_BLUE_SIZE_EXT = 32810 # GL/glext.h:2496
+GL_HISTOGRAM_ALPHA_SIZE_EXT = 32811 # GL/glext.h:2497
+GL_HISTOGRAM_LUMINANCE_SIZE_EXT = 32812 # GL/glext.h:2498
+GL_HISTOGRAM_SINK_EXT = 32813 # GL/glext.h:2499
+GL_MINMAX_EXT = 32814 # GL/glext.h:2500
+GL_MINMAX_FORMAT_EXT = 32815 # GL/glext.h:2501
+GL_MINMAX_SINK_EXT = 32816 # GL/glext.h:2502
+GL_TABLE_TOO_LARGE_EXT = 32817 # GL/glext.h:2503
+# EXT_convolution (GL/glext.h:2506)
+GL_CONVOLUTION_1D_EXT = 32784 # GL/glext.h:2507
+GL_CONVOLUTION_2D_EXT = 32785 # GL/glext.h:2508
+GL_SEPARABLE_2D_EXT = 32786 # GL/glext.h:2509
+GL_CONVOLUTION_BORDER_MODE_EXT = 32787 # GL/glext.h:2510
+GL_CONVOLUTION_FILTER_SCALE_EXT = 32788 # GL/glext.h:2511
+GL_CONVOLUTION_FILTER_BIAS_EXT = 32789 # GL/glext.h:2512
+GL_REDUCE_EXT = 32790 # GL/glext.h:2513
+GL_CONVOLUTION_FORMAT_EXT = 32791 # GL/glext.h:2514
+GL_CONVOLUTION_WIDTH_EXT = 32792 # GL/glext.h:2515
+GL_CONVOLUTION_HEIGHT_EXT = 32793 # GL/glext.h:2516
+GL_MAX_CONVOLUTION_WIDTH_EXT = 32794 # GL/glext.h:2517
+GL_MAX_CONVOLUTION_HEIGHT_EXT = 32795 # GL/glext.h:2518
+GL_POST_CONVOLUTION_RED_SCALE_EXT = 32796 # GL/glext.h:2519
+GL_POST_CONVOLUTION_GREEN_SCALE_EXT = 32797 # GL/glext.h:2520
+GL_POST_CONVOLUTION_BLUE_SCALE_EXT = 32798 # GL/glext.h:2521
+GL_POST_CONVOLUTION_ALPHA_SCALE_EXT = 32799 # GL/glext.h:2522
+GL_POST_CONVOLUTION_RED_BIAS_EXT = 32800 # GL/glext.h:2523
+GL_POST_CONVOLUTION_GREEN_BIAS_EXT = 32801 # GL/glext.h:2524
+GL_POST_CONVOLUTION_BLUE_BIAS_EXT = 32802 # GL/glext.h:2525
+GL_POST_CONVOLUTION_ALPHA_BIAS_EXT = 32803 # GL/glext.h:2526
+# SGI_color_matrix (GL/glext.h:2529)
+GL_COLOR_MATRIX_SGI = 32945 # GL/glext.h:2530
+GL_COLOR_MATRIX_STACK_DEPTH_SGI = 32946 # GL/glext.h:2531
+GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI = 32947 # GL/glext.h:2532
+GL_POST_COLOR_MATRIX_RED_SCALE_SGI = 32948 # GL/glext.h:2533
+GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI = 32949 # GL/glext.h:2534
+GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI = 32950 # GL/glext.h:2535
+GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI = 32951 # GL/glext.h:2536
+GL_POST_COLOR_MATRIX_RED_BIAS_SGI = 32952 # GL/glext.h:2537
+GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI = 32953 # GL/glext.h:2538
+GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI = 32954 # GL/glext.h:2539
+GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI = 32955 # GL/glext.h:2540
+# SGI_color_table (GL/glext.h:2543)
+GL_COLOR_TABLE_SGI = 32976 # GL/glext.h:2544
+GL_POST_CONVOLUTION_COLOR_TABLE_SGI = 32977 # GL/glext.h:2545
+GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI = 32978 # GL/glext.h:2546
+GL_PROXY_COLOR_TABLE_SGI = 32979 # GL/glext.h:2547
+GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI = 32980 # GL/glext.h:2548
+GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI = 32981 # GL/glext.h:2549
+GL_COLOR_TABLE_SCALE_SGI = 32982 # GL/glext.h:2550
+GL_COLOR_TABLE_BIAS_SGI = 32983 # GL/glext.h:2551
+GL_COLOR_TABLE_FORMAT_SGI = 32984 # GL/glext.h:2552
+GL_COLOR_TABLE_WIDTH_SGI = 32985 # GL/glext.h:2553
+GL_COLOR_TABLE_RED_SIZE_SGI = 32986 # GL/glext.h:2554
+GL_COLOR_TABLE_GREEN_SIZE_SGI = 32987 # GL/glext.h:2555
+GL_COLOR_TABLE_BLUE_SIZE_SGI = 32988 # GL/glext.h:2556
+GL_COLOR_TABLE_ALPHA_SIZE_SGI = 32989 # GL/glext.h:2557
+GL_COLOR_TABLE_LUMINANCE_SIZE_SGI = 32990 # GL/glext.h:2558
+GL_COLOR_TABLE_INTENSITY_SIZE_SGI = 32991 # GL/glext.h:2559
+# SGIS_pixel_texture (GL/glext.h:2562)
+GL_PIXEL_TEXTURE_SGIS = 33619 # GL/glext.h:2563
+GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS = 33620 # GL/glext.h:2564
+GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS = 33621 # GL/glext.h:2565
+GL_PIXEL_GROUP_COLOR_SGIS = 33622 # GL/glext.h:2566
+# SGIX_pixel_texture (GL/glext.h:2569)
+GL_PIXEL_TEX_GEN_SGIX = 33081 # GL/glext.h:2570
+GL_PIXEL_TEX_GEN_MODE_SGIX = 33579 # GL/glext.h:2571
+# SGIS_texture4D (GL/glext.h:2574)
+GL_PACK_SKIP_VOLUMES_SGIS = 33072 # GL/glext.h:2575
+GL_PACK_IMAGE_DEPTH_SGIS = 33073 # GL/glext.h:2576
+GL_UNPACK_SKIP_VOLUMES_SGIS = 33074 # GL/glext.h:2577
+GL_UNPACK_IMAGE_DEPTH_SGIS = 33075 # GL/glext.h:2578
+GL_TEXTURE_4D_SGIS = 33076 # GL/glext.h:2579
+GL_PROXY_TEXTURE_4D_SGIS = 33077 # GL/glext.h:2580
+GL_TEXTURE_4DSIZE_SGIS = 33078 # GL/glext.h:2581
+GL_TEXTURE_WRAP_Q_SGIS = 33079 # GL/glext.h:2582
+GL_MAX_4D_TEXTURE_SIZE_SGIS = 33080 # GL/glext.h:2583
+GL_TEXTURE_4D_BINDING_SGIS = 33103 # GL/glext.h:2584
+# SGI_texture_color_table (GL/glext.h:2587)
+GL_TEXTURE_COLOR_TABLE_SGI = 32956 # GL/glext.h:2588
+GL_PROXY_TEXTURE_COLOR_TABLE_SGI = 32957 # GL/glext.h:2589
+# EXT_cmyka (GL/glext.h:2592)
+GL_CMYK_EXT = 32780 # GL/glext.h:2593
+GL_CMYKA_EXT = 32781 # GL/glext.h:2594
+GL_PACK_CMYK_HINT_EXT = 32782 # GL/glext.h:2595
+GL_UNPACK_CMYK_HINT_EXT = 32783 # GL/glext.h:2596
+# EXT_texture_object (GL/glext.h:2599)
+GL_TEXTURE_PRIORITY_EXT = 32870 # GL/glext.h:2600
+GL_TEXTURE_RESIDENT_EXT = 32871 # GL/glext.h:2601
+GL_TEXTURE_1D_BINDING_EXT = 32872 # GL/glext.h:2602
+GL_TEXTURE_2D_BINDING_EXT = 32873 # GL/glext.h:2603
+GL_TEXTURE_3D_BINDING_EXT = 32874 # GL/glext.h:2604
+# SGIS_detail_texture (GL/glext.h:2607)
+GL_DETAIL_TEXTURE_2D_SGIS = 32917 # GL/glext.h:2608
+GL_DETAIL_TEXTURE_2D_BINDING_SGIS = 32918 # GL/glext.h:2609
+GL_LINEAR_DETAIL_SGIS = 32919 # GL/glext.h:2610
+GL_LINEAR_DETAIL_ALPHA_SGIS = 32920 # GL/glext.h:2611
+GL_LINEAR_DETAIL_COLOR_SGIS = 32921 # GL/glext.h:2612
+GL_DETAIL_TEXTURE_LEVEL_SGIS = 32922 # GL/glext.h:2613
+GL_DETAIL_TEXTURE_MODE_SGIS = 32923 # GL/glext.h:2614
+GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS = 32924 # GL/glext.h:2615
+# SGIS_sharpen_texture (GL/glext.h:2618)
+GL_LINEAR_SHARPEN_SGIS = 32941 # GL/glext.h:2619
+GL_LINEAR_SHARPEN_ALPHA_SGIS = 32942 # GL/glext.h:2620
+GL_LINEAR_SHARPEN_COLOR_SGIS = 32943 # GL/glext.h:2621
+GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS = 32944 # GL/glext.h:2622
+# EXT_packed_pixels (GL/glext.h:2625)
+GL_UNSIGNED_BYTE_3_3_2_EXT = 32818 # GL/glext.h:2626
+GL_UNSIGNED_SHORT_4_4_4_4_EXT = 32819 # GL/glext.h:2627
+GL_UNSIGNED_SHORT_5_5_5_1_EXT = 32820 # GL/glext.h:2628
+GL_UNSIGNED_INT_8_8_8_8_EXT = 32821 # GL/glext.h:2629
+GL_UNSIGNED_INT_10_10_10_2_EXT = 32822 # GL/glext.h:2630
+# SGIS_texture_lod (GL/glext.h:2633)
+GL_TEXTURE_MIN_LOD_SGIS = 33082 # GL/glext.h:2634
+GL_TEXTURE_MAX_LOD_SGIS = 33083 # GL/glext.h:2635
+GL_TEXTURE_BASE_LEVEL_SGIS = 33084 # GL/glext.h:2636
+GL_TEXTURE_MAX_LEVEL_SGIS = 33085 # GL/glext.h:2637
+# SGIS_multisample (GL/glext.h:2640)
+GL_MULTISAMPLE_SGIS = 32925 # GL/glext.h:2641
+GL_SAMPLE_ALPHA_TO_MASK_SGIS = 32926 # GL/glext.h:2642
+GL_SAMPLE_ALPHA_TO_ONE_SGIS = 32927 # GL/glext.h:2643
+GL_SAMPLE_MASK_SGIS = 32928 # GL/glext.h:2644
+GL_1PASS_SGIS = 32929 # GL/glext.h:2645
+GL_2PASS_0_SGIS = 32930 # GL/glext.h:2646
+GL_2PASS_1_SGIS = 32931 # GL/glext.h:2647
+GL_4PASS_0_SGIS = 32932 # GL/glext.h:2648
+GL_4PASS_1_SGIS = 32933 # GL/glext.h:2649
+GL_4PASS_2_SGIS = 32934 # GL/glext.h:2650
+GL_4PASS_3_SGIS = 32935 # GL/glext.h:2651
+GL_SAMPLE_BUFFERS_SGIS = 32936 # GL/glext.h:2652
+GL_SAMPLES_SGIS = 32937 # GL/glext.h:2653
+GL_SAMPLE_MASK_VALUE_SGIS = 32938 # GL/glext.h:2654
+GL_SAMPLE_MASK_INVERT_SGIS = 32939 # GL/glext.h:2655
+GL_SAMPLE_PATTERN_SGIS = 32940 # GL/glext.h:2656
+# EXT_rescale_normal (GL/glext.h:2659)
+GL_RESCALE_NORMAL_EXT = 32826 # GL/glext.h:2660
+# EXT_vertex_array (GL/glext.h:2663)
+GL_VERTEX_ARRAY_EXT = 32884 # GL/glext.h:2664
+GL_NORMAL_ARRAY_EXT = 32885 # GL/glext.h:2665
+GL_COLOR_ARRAY_EXT = 32886 # GL/glext.h:2666
+GL_INDEX_ARRAY_EXT = 32887 # GL/glext.h:2667
+GL_TEXTURE_COORD_ARRAY_EXT = 32888 # GL/glext.h:2668
+GL_EDGE_FLAG_ARRAY_EXT = 32889 # GL/glext.h:2669
+GL_VERTEX_ARRAY_SIZE_EXT = 32890 # GL/glext.h:2670
+GL_VERTEX_ARRAY_TYPE_EXT = 32891 # GL/glext.h:2671
+GL_VERTEX_ARRAY_STRIDE_EXT = 32892 # GL/glext.h:2672
+GL_VERTEX_ARRAY_COUNT_EXT = 32893 # GL/glext.h:2673
+GL_NORMAL_ARRAY_TYPE_EXT = 32894 # GL/glext.h:2674
+GL_NORMAL_ARRAY_STRIDE_EXT = 32895 # GL/glext.h:2675
+GL_NORMAL_ARRAY_COUNT_EXT = 32896 # GL/glext.h:2676
+GL_COLOR_ARRAY_SIZE_EXT = 32897 # GL/glext.h:2677
+GL_COLOR_ARRAY_TYPE_EXT = 32898 # GL/glext.h:2678
+GL_COLOR_ARRAY_STRIDE_EXT = 32899 # GL/glext.h:2679
+GL_COLOR_ARRAY_COUNT_EXT = 32900 # GL/glext.h:2680
+GL_INDEX_ARRAY_TYPE_EXT = 32901 # GL/glext.h:2681
+GL_INDEX_ARRAY_STRIDE_EXT = 32902 # GL/glext.h:2682
+GL_INDEX_ARRAY_COUNT_EXT = 32903 # GL/glext.h:2683
+GL_TEXTURE_COORD_ARRAY_SIZE_EXT = 32904 # GL/glext.h:2684
+GL_TEXTURE_COORD_ARRAY_TYPE_EXT = 32905 # GL/glext.h:2685
+GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = 32906 # GL/glext.h:2686
+GL_TEXTURE_COORD_ARRAY_COUNT_EXT = 32907 # GL/glext.h:2687
+GL_EDGE_FLAG_ARRAY_STRIDE_EXT = 32908 # GL/glext.h:2688
+GL_EDGE_FLAG_ARRAY_COUNT_EXT = 32909 # GL/glext.h:2689
+GL_VERTEX_ARRAY_POINTER_EXT = 32910 # GL/glext.h:2690
+GL_NORMAL_ARRAY_POINTER_EXT = 32911 # GL/glext.h:2691
+GL_COLOR_ARRAY_POINTER_EXT = 32912 # GL/glext.h:2692
+GL_INDEX_ARRAY_POINTER_EXT = 32913 # GL/glext.h:2693
+GL_TEXTURE_COORD_ARRAY_POINTER_EXT = 32914 # GL/glext.h:2694
+GL_EDGE_FLAG_ARRAY_POINTER_EXT = 32915 # GL/glext.h:2695
+# EXT_misc_attribute (GL/glext.h:2698)
+# SGIS_generate_mipmap (GL/glext.h:2701)
+GL_GENERATE_MIPMAP_SGIS = 33169 # GL/glext.h:2702
+GL_GENERATE_MIPMAP_HINT_SGIS = 33170 # GL/glext.h:2703
+# SGIX_clipmap (GL/glext.h:2706)
+GL_LINEAR_CLIPMAP_LINEAR_SGIX = 33136 # GL/glext.h:2707
+GL_TEXTURE_CLIPMAP_CENTER_SGIX = 33137 # GL/glext.h:2708
+GL_TEXTURE_CLIPMAP_FRAME_SGIX = 33138 # GL/glext.h:2709
+GL_TEXTURE_CLIPMAP_OFFSET_SGIX = 33139 # GL/glext.h:2710
+GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX = 33140 # GL/glext.h:2711
+GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX = 33141 # GL/glext.h:2712
+GL_TEXTURE_CLIPMAP_DEPTH_SGIX = 33142 # GL/glext.h:2713
+GL_MAX_CLIPMAP_DEPTH_SGIX = 33143 # GL/glext.h:2714
+GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX = 33144 # GL/glext.h:2715
+GL_NEAREST_CLIPMAP_NEAREST_SGIX = 33869 # GL/glext.h:2716
+GL_NEAREST_CLIPMAP_LINEAR_SGIX = 33870 # GL/glext.h:2717
+GL_LINEAR_CLIPMAP_NEAREST_SGIX = 33871 # GL/glext.h:2718
+# SGIX_shadow (GL/glext.h:2721)
+GL_TEXTURE_COMPARE_SGIX = 33178 # GL/glext.h:2722
+GL_TEXTURE_COMPARE_OPERATOR_SGIX = 33179 # GL/glext.h:2723
+GL_TEXTURE_LEQUAL_R_SGIX = 33180 # GL/glext.h:2724
+GL_TEXTURE_GEQUAL_R_SGIX = 33181 # GL/glext.h:2725
+# SGIS_texture_edge_clamp (GL/glext.h:2728)
+GL_CLAMP_TO_EDGE_SGIS = 33071 # GL/glext.h:2729
+# SGIS_texture_border_clamp (GL/glext.h:2732)
+GL_CLAMP_TO_BORDER_SGIS = 33069 # GL/glext.h:2733
+# EXT_blend_minmax (GL/glext.h:2736)
+GL_FUNC_ADD_EXT = 32774 # GL/glext.h:2737
+GL_MIN_EXT = 32775 # GL/glext.h:2738
+GL_MAX_EXT = 32776 # GL/glext.h:2739
+GL_BLEND_EQUATION_EXT = 32777 # GL/glext.h:2740
+# EXT_blend_subtract (GL/glext.h:2743)
+GL_FUNC_SUBTRACT_EXT = 32778 # GL/glext.h:2744
+GL_FUNC_REVERSE_SUBTRACT_EXT = 32779 # GL/glext.h:2745
+# EXT_blend_logic_op (GL/glext.h:2748)
+# SGIX_interlace (GL/glext.h:2751)
+GL_INTERLACE_SGIX = 32916 # GL/glext.h:2752
+# SGIX_pixel_tiles (GL/glext.h:2755)
+GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX = 33086 # GL/glext.h:2756
+GL_PIXEL_TILE_CACHE_INCREMENT_SGIX = 33087 # GL/glext.h:2757
+GL_PIXEL_TILE_WIDTH_SGIX = 33088 # GL/glext.h:2758
+GL_PIXEL_TILE_HEIGHT_SGIX = 33089 # GL/glext.h:2759
+GL_PIXEL_TILE_GRID_WIDTH_SGIX = 33090 # GL/glext.h:2760
+GL_PIXEL_TILE_GRID_HEIGHT_SGIX = 33091 # GL/glext.h:2761
+GL_PIXEL_TILE_GRID_DEPTH_SGIX = 33092 # GL/glext.h:2762
+GL_PIXEL_TILE_CACHE_SIZE_SGIX = 33093 # GL/glext.h:2763
+# SGIS_texture_select (GL/glext.h:2766)
+GL_DUAL_ALPHA4_SGIS = 33040 # GL/glext.h:2767
+GL_DUAL_ALPHA8_SGIS = 33041 # GL/glext.h:2768
+GL_DUAL_ALPHA12_SGIS = 33042 # GL/glext.h:2769
+GL_DUAL_ALPHA16_SGIS = 33043 # GL/glext.h:2770
+GL_DUAL_LUMINANCE4_SGIS = 33044 # GL/glext.h:2771
+GL_DUAL_LUMINANCE8_SGIS = 33045 # GL/glext.h:2772
+GL_DUAL_LUMINANCE12_SGIS = 33046 # GL/glext.h:2773
+GL_DUAL_LUMINANCE16_SGIS = 33047 # GL/glext.h:2774
+GL_DUAL_INTENSITY4_SGIS = 33048 # GL/glext.h:2775
+GL_DUAL_INTENSITY8_SGIS = 33049 # GL/glext.h:2776
+GL_DUAL_INTENSITY12_SGIS = 33050 # GL/glext.h:2777
+GL_DUAL_INTENSITY16_SGIS = 33051 # GL/glext.h:2778
+GL_DUAL_LUMINANCE_ALPHA4_SGIS = 33052 # GL/glext.h:2779
+GL_DUAL_LUMINANCE_ALPHA8_SGIS = 33053 # GL/glext.h:2780
+GL_QUAD_ALPHA4_SGIS = 33054 # GL/glext.h:2781
+GL_QUAD_ALPHA8_SGIS = 33055 # GL/glext.h:2782
+GL_QUAD_LUMINANCE4_SGIS = 33056 # GL/glext.h:2783
+GL_QUAD_LUMINANCE8_SGIS = 33057 # GL/glext.h:2784
+GL_QUAD_INTENSITY4_SGIS = 33058 # GL/glext.h:2785
+GL_QUAD_INTENSITY8_SGIS = 33059 # GL/glext.h:2786
+GL_DUAL_TEXTURE_SELECT_SGIS = 33060 # GL/glext.h:2787
+GL_QUAD_TEXTURE_SELECT_SGIS = 33061 # GL/glext.h:2788
+# SGIX_sprite (GL/glext.h:2791)
+GL_SPRITE_SGIX = 33096 # GL/glext.h:2792
+GL_SPRITE_MODE_SGIX = 33097 # GL/glext.h:2793
+GL_SPRITE_AXIS_SGIX = 33098 # GL/glext.h:2794
+GL_SPRITE_TRANSLATION_SGIX = 33099 # GL/glext.h:2795
+GL_SPRITE_AXIAL_SGIX = 33100 # GL/glext.h:2796
+GL_SPRITE_OBJECT_ALIGNED_SGIX = 33101 # GL/glext.h:2797
+GL_SPRITE_EYE_ALIGNED_SGIX = 33102 # GL/glext.h:2798
+# SGIX_texture_multi_buffer (GL/glext.h:2801)
+GL_TEXTURE_MULTI_BUFFER_HINT_SGIX = 33070 # GL/glext.h:2802
+# EXT_point_parameters (GL/glext.h:2805)
+GL_POINT_SIZE_MIN_EXT = 33062 # GL/glext.h:2806
+GL_POINT_SIZE_MAX_EXT = 33063 # GL/glext.h:2807
+GL_POINT_FADE_THRESHOLD_SIZE_EXT = 33064 # GL/glext.h:2808
+GL_DISTANCE_ATTENUATION_EXT = 33065 # GL/glext.h:2809
+# SGIS_point_parameters (GL/glext.h:2812)
+GL_POINT_SIZE_MIN_SGIS = 33062 # GL/glext.h:2813
+GL_POINT_SIZE_MAX_SGIS = 33063 # GL/glext.h:2814
+GL_POINT_FADE_THRESHOLD_SIZE_SGIS = 33064 # GL/glext.h:2815
+GL_DISTANCE_ATTENUATION_SGIS = 33065 # GL/glext.h:2816
+# SGIX_instruments (GL/glext.h:2819)
+GL_INSTRUMENT_BUFFER_POINTER_SGIX = 33152 # GL/glext.h:2820
+GL_INSTRUMENT_MEASUREMENTS_SGIX = 33153 # GL/glext.h:2821
+# SGIX_texture_scale_bias (GL/glext.h:2824)
+GL_POST_TEXTURE_FILTER_BIAS_SGIX = 33145 # GL/glext.h:2825
+GL_POST_TEXTURE_FILTER_SCALE_SGIX = 33146 # GL/glext.h:2826
+GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX = 33147 # GL/glext.h:2827
+GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX = 33148 # GL/glext.h:2828
+# SGIX_framezoom (GL/glext.h:2831)
+GL_FRAMEZOOM_SGIX = 33163 # GL/glext.h:2832
+GL_FRAMEZOOM_FACTOR_SGIX = 33164 # GL/glext.h:2833
+GL_MAX_FRAMEZOOM_FACTOR_SGIX = 33165 # GL/glext.h:2834
+# SGIX_tag_sample_buffer (GL/glext.h:2837)
+# FfdMaskSGIX (GL/glext.h:2840)
+GL_TEXTURE_DEFORMATION_BIT_SGIX = 1 # GL/glext.h:2841
+GL_GEOMETRY_DEFORMATION_BIT_SGIX = 2 # GL/glext.h:2842
+# SGIX_polynomial_ffd (GL/glext.h:2845)
+GL_GEOMETRY_DEFORMATION_SGIX = 33172 # GL/glext.h:2846
+GL_TEXTURE_DEFORMATION_SGIX = 33173 # GL/glext.h:2847
+GL_DEFORMATIONS_MASK_SGIX = 33174 # GL/glext.h:2848
+GL_MAX_DEFORMATION_ORDER_SGIX = 33175 # GL/glext.h:2849
+# SGIX_reference_plane (GL/glext.h:2852)
+GL_REFERENCE_PLANE_SGIX = 33149 # GL/glext.h:2853
+GL_REFERENCE_PLANE_EQUATION_SGIX = 33150 # GL/glext.h:2854
+# SGIX_flush_raster (GL/glext.h:2857)
+# SGIX_depth_texture (GL/glext.h:2860)
+GL_DEPTH_COMPONENT16_SGIX = 33189 # GL/glext.h:2861
+GL_DEPTH_COMPONENT24_SGIX = 33190 # GL/glext.h:2862
+GL_DEPTH_COMPONENT32_SGIX = 33191 # GL/glext.h:2863
+# SGIS_fog_function (GL/glext.h:2866)
+GL_FOG_FUNC_SGIS = 33066 # GL/glext.h:2867
+GL_FOG_FUNC_POINTS_SGIS = 33067 # GL/glext.h:2868
+GL_MAX_FOG_FUNC_POINTS_SGIS = 33068 # GL/glext.h:2869
+# SGIX_fog_offset (GL/glext.h:2872)
+GL_FOG_OFFSET_SGIX = 33176 # GL/glext.h:2873
+GL_FOG_OFFSET_VALUE_SGIX = 33177 # GL/glext.h:2874
+# HP_image_transform (GL/glext.h:2877)
+GL_IMAGE_SCALE_X_HP = 33109 # GL/glext.h:2878
+GL_IMAGE_SCALE_Y_HP = 33110 # GL/glext.h:2879
+GL_IMAGE_TRANSLATE_X_HP = 33111 # GL/glext.h:2880
+GL_IMAGE_TRANSLATE_Y_HP = 33112 # GL/glext.h:2881
+GL_IMAGE_ROTATE_ANGLE_HP = 33113 # GL/glext.h:2882
+GL_IMAGE_ROTATE_ORIGIN_X_HP = 33114 # GL/glext.h:2883
+GL_IMAGE_ROTATE_ORIGIN_Y_HP = 33115 # GL/glext.h:2884
+GL_IMAGE_MAG_FILTER_HP = 33116 # GL/glext.h:2885
+GL_IMAGE_MIN_FILTER_HP = 33117 # GL/glext.h:2886
+GL_IMAGE_CUBIC_WEIGHT_HP = 33118 # GL/glext.h:2887
+GL_CUBIC_HP = 33119 # GL/glext.h:2888
+GL_AVERAGE_HP = 33120 # GL/glext.h:2889
+GL_IMAGE_TRANSFORM_2D_HP = 33121 # GL/glext.h:2890
+GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = 33122 # GL/glext.h:2891
+GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = 33123 # GL/glext.h:2892
+# HP_convolution_border_modes (GL/glext.h:2895)
+GL_IGNORE_BORDER_HP = 33104 # GL/glext.h:2896
+GL_CONSTANT_BORDER_HP = 33105 # GL/glext.h:2897
+GL_REPLICATE_BORDER_HP = 33107 # GL/glext.h:2898
+GL_CONVOLUTION_BORDER_COLOR_HP = 33108 # GL/glext.h:2899
+# INGR_palette_buffer (GL/glext.h:2902)
+# SGIX_texture_add_env (GL/glext.h:2905)
+GL_TEXTURE_ENV_BIAS_SGIX = 32958 # GL/glext.h:2906
+# EXT_color_subtable (GL/glext.h:2909)
+# PGI_vertex_hints (GL/glext.h:2912)
+GL_VERTEX_DATA_HINT_PGI = 107050 # GL/glext.h:2913
+GL_VERTEX_CONSISTENT_HINT_PGI = 107051 # GL/glext.h:2914
+GL_MATERIAL_SIDE_HINT_PGI = 107052 # GL/glext.h:2915
+GL_MAX_VERTEX_HINT_PGI = 107053 # GL/glext.h:2916
+GL_COLOR3_BIT_PGI = 65536 # GL/glext.h:2917
+GL_COLOR4_BIT_PGI = 131072 # GL/glext.h:2918
+GL_EDGEFLAG_BIT_PGI = 262144 # GL/glext.h:2919
+GL_INDEX_BIT_PGI = 524288 # GL/glext.h:2920
+GL_MAT_AMBIENT_BIT_PGI = 1048576 # GL/glext.h:2921
+GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI = 2097152 # GL/glext.h:2922
+GL_MAT_DIFFUSE_BIT_PGI = 4194304 # GL/glext.h:2923
+GL_MAT_EMISSION_BIT_PGI = 8388608 # GL/glext.h:2924
+GL_MAT_COLOR_INDEXES_BIT_PGI = 16777216 # GL/glext.h:2925
+GL_MAT_SHININESS_BIT_PGI = 33554432 # GL/glext.h:2926
+GL_MAT_SPECULAR_BIT_PGI = 67108864 # GL/glext.h:2927
+GL_NORMAL_BIT_PGI = 134217728 # GL/glext.h:2928
+GL_TEXCOORD1_BIT_PGI = 268435456 # GL/glext.h:2929
+GL_TEXCOORD2_BIT_PGI = 536870912 # GL/glext.h:2930
+GL_TEXCOORD3_BIT_PGI = 1073741824 # GL/glext.h:2931
+GL_TEXCOORD4_BIT_PGI = 2147483648 # GL/glext.h:2932
+GL_VERTEX23_BIT_PGI = 4 # GL/glext.h:2933
+GL_VERTEX4_BIT_PGI = 8 # GL/glext.h:2934
+# PGI_misc_hints (GL/glext.h:2937)
+GL_PREFER_DOUBLEBUFFER_HINT_PGI = 107000 # GL/glext.h:2938
+GL_CONSERVE_MEMORY_HINT_PGI = 107005 # GL/glext.h:2939
+GL_RECLAIM_MEMORY_HINT_PGI = 107006 # GL/glext.h:2940
+GL_NATIVE_GRAPHICS_HANDLE_PGI = 107010 # GL/glext.h:2941
+GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI = 107011 # GL/glext.h:2942
+GL_NATIVE_GRAPHICS_END_HINT_PGI = 107012 # GL/glext.h:2943
+GL_ALWAYS_FAST_HINT_PGI = 107020 # GL/glext.h:2944
+GL_ALWAYS_SOFT_HINT_PGI = 107021 # GL/glext.h:2945
+GL_ALLOW_DRAW_OBJ_HINT_PGI = 107022 # GL/glext.h:2946
+GL_ALLOW_DRAW_WIN_HINT_PGI = 107023 # GL/glext.h:2947
+GL_ALLOW_DRAW_FRG_HINT_PGI = 107024 # GL/glext.h:2948
+GL_ALLOW_DRAW_MEM_HINT_PGI = 107025 # GL/glext.h:2949
+GL_STRICT_DEPTHFUNC_HINT_PGI = 107030 # GL/glext.h:2950
+GL_STRICT_LIGHTING_HINT_PGI = 107031 # GL/glext.h:2951
+GL_STRICT_SCISSOR_HINT_PGI = 107032 # GL/glext.h:2952
+GL_FULL_STIPPLE_HINT_PGI = 107033 # GL/glext.h:2953
+GL_CLIP_NEAR_HINT_PGI = 107040 # GL/glext.h:2954
+GL_CLIP_FAR_HINT_PGI = 107041 # GL/glext.h:2955
+GL_WIDE_LINE_HINT_PGI = 107042 # GL/glext.h:2956
+GL_BACK_NORMALS_HINT_PGI = 107043 # GL/glext.h:2957
+# EXT_paletted_texture (GL/glext.h:2960)
+GL_COLOR_INDEX1_EXT = 32994 # GL/glext.h:2961
+GL_COLOR_INDEX2_EXT = 32995 # GL/glext.h:2962
+GL_COLOR_INDEX4_EXT = 32996 # GL/glext.h:2963
+GL_COLOR_INDEX8_EXT = 32997 # GL/glext.h:2964
+GL_COLOR_INDEX12_EXT = 32998 # GL/glext.h:2965
+GL_COLOR_INDEX16_EXT = 32999 # GL/glext.h:2966
+GL_TEXTURE_INDEX_SIZE_EXT = 33005 # GL/glext.h:2967
+# EXT_clip_volume_hint (GL/glext.h:2970)
+GL_CLIP_VOLUME_CLIPPING_HINT_EXT = 33008 # GL/glext.h:2971
+# SGIX_list_priority (GL/glext.h:2974)
+GL_LIST_PRIORITY_SGIX = 33154 # GL/glext.h:2975
+# SGIX_ir_instrument1 (GL/glext.h:2978)
+GL_IR_INSTRUMENT1_SGIX = 33151 # GL/glext.h:2979
+# SGIX_calligraphic_fragment (GL/glext.h:2982)
+GL_CALLIGRAPHIC_FRAGMENT_SGIX = 33155 # GL/glext.h:2983
+# SGIX_texture_lod_bias (GL/glext.h:2986)
+GL_TEXTURE_LOD_BIAS_S_SGIX = 33166 # GL/glext.h:2987
+GL_TEXTURE_LOD_BIAS_T_SGIX = 33167 # GL/glext.h:2988
+GL_TEXTURE_LOD_BIAS_R_SGIX = 33168 # GL/glext.h:2989
+# SGIX_shadow_ambient (GL/glext.h:2992)
+GL_SHADOW_AMBIENT_SGIX = 32959 # GL/glext.h:2993
+# EXT_index_texture (GL/glext.h:2996)
+# EXT_index_material (GL/glext.h:2999)
+GL_INDEX_MATERIAL_EXT = 33208 # GL/glext.h:3000
+GL_INDEX_MATERIAL_PARAMETER_EXT = 33209 # GL/glext.h:3001
+GL_INDEX_MATERIAL_FACE_EXT = 33210 # GL/glext.h:3002
+# EXT_index_func (GL/glext.h:3005)
+GL_INDEX_TEST_EXT = 33205 # GL/glext.h:3006
+GL_INDEX_TEST_FUNC_EXT = 33206 # GL/glext.h:3007
+GL_INDEX_TEST_REF_EXT = 33207 # GL/glext.h:3008
+# EXT_index_array_formats (GL/glext.h:3011)
+GL_IUI_V2F_EXT = 33197 # GL/glext.h:3012
+GL_IUI_V3F_EXT = 33198 # GL/glext.h:3013
+GL_IUI_N3F_V2F_EXT = 33199 # GL/glext.h:3014
+GL_IUI_N3F_V3F_EXT = 33200 # GL/glext.h:3015
+GL_T2F_IUI_V2F_EXT = 33201 # GL/glext.h:3016
+GL_T2F_IUI_V3F_EXT = 33202 # GL/glext.h:3017
+GL_T2F_IUI_N3F_V2F_EXT = 33203 # GL/glext.h:3018
+GL_T2F_IUI_N3F_V3F_EXT = 33204 # GL/glext.h:3019
+# EXT_compiled_vertex_array (GL/glext.h:3022)
+GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = 33192 # GL/glext.h:3023
+GL_ARRAY_ELEMENT_LOCK_COUNT_EXT = 33193 # GL/glext.h:3024
+# EXT_cull_vertex (GL/glext.h:3027)
+GL_CULL_VERTEX_EXT = 33194 # GL/glext.h:3028
+GL_CULL_VERTEX_EYE_POSITION_EXT = 33195 # GL/glext.h:3029
+GL_CULL_VERTEX_OBJECT_POSITION_EXT = 33196 # GL/glext.h:3030
+# SGIX_ycrcb (GL/glext.h:3033)
+GL_YCRCB_422_SGIX = 33211 # GL/glext.h:3034
+GL_YCRCB_444_SGIX = 33212 # GL/glext.h:3035
+# SGIX_fragment_lighting (GL/glext.h:3038)
+GL_FRAGMENT_LIGHTING_SGIX = 33792 # GL/glext.h:3039
+GL_FRAGMENT_COLOR_MATERIAL_SGIX = 33793 # GL/glext.h:3040
+GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX = 33794 # GL/glext.h:3041
+GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX = 33795 # GL/glext.h:3042
+GL_MAX_FRAGMENT_LIGHTS_SGIX = 33796 # GL/glext.h:3043
+GL_MAX_ACTIVE_LIGHTS_SGIX = 33797 # GL/glext.h:3044
+GL_CURRENT_RASTER_NORMAL_SGIX = 33798 # GL/glext.h:3045
+GL_LIGHT_ENV_MODE_SGIX = 33799 # GL/glext.h:3046
+GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX = 33800 # GL/glext.h:3047
+GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX = 33801 # GL/glext.h:3048
+GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX = 33802 # GL/glext.h:3049
+GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX = 33803 # GL/glext.h:3050
+GL_FRAGMENT_LIGHT0_SGIX = 33804 # GL/glext.h:3051
+GL_FRAGMENT_LIGHT1_SGIX = 33805 # GL/glext.h:3052
+GL_FRAGMENT_LIGHT2_SGIX = 33806 # GL/glext.h:3053
+GL_FRAGMENT_LIGHT3_SGIX = 33807 # GL/glext.h:3054
+GL_FRAGMENT_LIGHT4_SGIX = 33808 # GL/glext.h:3055
+GL_FRAGMENT_LIGHT5_SGIX = 33809 # GL/glext.h:3056
+GL_FRAGMENT_LIGHT6_SGIX = 33810 # GL/glext.h:3057
+GL_FRAGMENT_LIGHT7_SGIX = 33811 # GL/glext.h:3058
+# IBM_rasterpos_clip (GL/glext.h:3061)
+GL_RASTER_POSITION_UNCLIPPED_IBM = 103010 # GL/glext.h:3062
+# HP_texture_lighting (GL/glext.h:3065)
+GL_TEXTURE_LIGHTING_MODE_HP = 33127 # GL/glext.h:3066
+GL_TEXTURE_POST_SPECULAR_HP = 33128 # GL/glext.h:3067
+GL_TEXTURE_PRE_SPECULAR_HP = 33129 # GL/glext.h:3068
+# EXT_draw_range_elements (GL/glext.h:3071)
+GL_MAX_ELEMENTS_VERTICES_EXT = 33000 # GL/glext.h:3072
+GL_MAX_ELEMENTS_INDICES_EXT = 33001 # GL/glext.h:3073
+# WIN_phong_shading (GL/glext.h:3076)
+GL_PHONG_WIN = 33002 # GL/glext.h:3077
+GL_PHONG_HINT_WIN = 33003 # GL/glext.h:3078
+# WIN_specular_fog (GL/glext.h:3081)
+GL_FOG_SPECULAR_TEXTURE_WIN = 33004 # GL/glext.h:3082
+# EXT_light_texture (GL/glext.h:3085)
+GL_FRAGMENT_MATERIAL_EXT = 33609 # GL/glext.h:3086
+GL_FRAGMENT_NORMAL_EXT = 33610 # GL/glext.h:3087
+GL_FRAGMENT_COLOR_EXT = 33612 # GL/glext.h:3088
+GL_ATTENUATION_EXT = 33613 # GL/glext.h:3089
+GL_SHADOW_ATTENUATION_EXT = 33614 # GL/glext.h:3090
+GL_TEXTURE_APPLICATION_MODE_EXT = 33615 # GL/glext.h:3091
+GL_TEXTURE_LIGHT_EXT = 33616 # GL/glext.h:3092
+GL_TEXTURE_MATERIAL_FACE_EXT = 33617 # GL/glext.h:3093
+GL_TEXTURE_MATERIAL_PARAMETER_EXT = 33618 # GL/glext.h:3094
+# SGIX_blend_alpha_minmax (GL/glext.h:3098)
+GL_ALPHA_MIN_SGIX = 33568 # GL/glext.h:3099
+GL_ALPHA_MAX_SGIX = 33569 # GL/glext.h:3100
+# SGIX_impact_pixel_texture (GL/glext.h:3103)
+GL_PIXEL_TEX_GEN_Q_CEILING_SGIX = 33156 # GL/glext.h:3104
+GL_PIXEL_TEX_GEN_Q_ROUND_SGIX = 33157 # GL/glext.h:3105
+GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX = 33158 # GL/glext.h:3106
+GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX = 33159 # GL/glext.h:3107
+GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX = 33160 # GL/glext.h:3108
+GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX = 33161 # GL/glext.h:3109
+GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX = 33162 # GL/glext.h:3110
+# EXT_bgra (GL/glext.h:3113)
+GL_BGR_EXT = 32992 # GL/glext.h:3114
+GL_BGRA_EXT = 32993 # GL/glext.h:3115
+# SGIX_async (GL/glext.h:3118)
+GL_ASYNC_MARKER_SGIX = 33577 # GL/glext.h:3119
+# SGIX_async_pixel (GL/glext.h:3122)
+GL_ASYNC_TEX_IMAGE_SGIX = 33628 # GL/glext.h:3123
+GL_ASYNC_DRAW_PIXELS_SGIX = 33629 # GL/glext.h:3124
+GL_ASYNC_READ_PIXELS_SGIX = 33630 # GL/glext.h:3125
+GL_MAX_ASYNC_TEX_IMAGE_SGIX = 33631 # GL/glext.h:3126
+GL_MAX_ASYNC_DRAW_PIXELS_SGIX = 33632 # GL/glext.h:3127
+GL_MAX_ASYNC_READ_PIXELS_SGIX = 33633 # GL/glext.h:3128
+# SGIX_async_histogram (GL/glext.h:3131)
+GL_ASYNC_HISTOGRAM_SGIX = 33580 # GL/glext.h:3132
+GL_MAX_ASYNC_HISTOGRAM_SGIX = 33581 # GL/glext.h:3133
+# INTEL_texture_scissor (GL/glext.h:3136)
+# INTEL_parallel_arrays (GL/glext.h:3139)
+GL_PARALLEL_ARRAYS_INTEL = 33780 # GL/glext.h:3140
+GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL = 33781 # GL/glext.h:3141
+GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL = 33782 # GL/glext.h:3142
+GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL = 33783 # GL/glext.h:3143
+GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL = 33784 # GL/glext.h:3144
+# HP_occlusion_test (GL/glext.h:3147)
+GL_OCCLUSION_TEST_HP = 33125 # GL/glext.h:3148
+GL_OCCLUSION_TEST_RESULT_HP = 33126 # GL/glext.h:3149
+# EXT_pixel_transform (GL/glext.h:3152)
+GL_PIXEL_TRANSFORM_2D_EXT = 33584 # GL/glext.h:3153
+GL_PIXEL_MAG_FILTER_EXT = 33585 # GL/glext.h:3154
+GL_PIXEL_MIN_FILTER_EXT = 33586 # GL/glext.h:3155
+GL_PIXEL_CUBIC_WEIGHT_EXT = 33587 # GL/glext.h:3156
+GL_CUBIC_EXT = 33588 # GL/glext.h:3157
+GL_AVERAGE_EXT = 33589 # GL/glext.h:3158
+GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = 33590 # GL/glext.h:3159
+GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = 33591 # GL/glext.h:3160
+GL_PIXEL_TRANSFORM_2D_MATRIX_EXT = 33592 # GL/glext.h:3161
+# EXT_pixel_transform_color_table (GL/glext.h:3164)
+# EXT_shared_texture_palette (GL/glext.h:3167)
+GL_SHARED_TEXTURE_PALETTE_EXT = 33275 # GL/glext.h:3168
+# EXT_separate_specular_color (GL/glext.h:3171)
+GL_LIGHT_MODEL_COLOR_CONTROL_EXT = 33272 # GL/glext.h:3172
+GL_SINGLE_COLOR_EXT = 33273 # GL/glext.h:3173
+GL_SEPARATE_SPECULAR_COLOR_EXT = 33274 # GL/glext.h:3174
+# EXT_secondary_color (GL/glext.h:3177)
+GL_COLOR_SUM_EXT = 33880 # GL/glext.h:3178
+GL_CURRENT_SECONDARY_COLOR_EXT = 33881 # GL/glext.h:3179
+GL_SECONDARY_COLOR_ARRAY_SIZE_EXT = 33882 # GL/glext.h:3180
+GL_SECONDARY_COLOR_ARRAY_TYPE_EXT = 33883 # GL/glext.h:3181
+GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT = 33884 # GL/glext.h:3182
+GL_SECONDARY_COLOR_ARRAY_POINTER_EXT = 33885 # GL/glext.h:3183
+GL_SECONDARY_COLOR_ARRAY_EXT = 33886 # GL/glext.h:3184
+# EXT_texture_perturb_normal (GL/glext.h:3187)
+GL_PERTURB_EXT = 34222 # GL/glext.h:3188
+GL_TEXTURE_NORMAL_EXT = 34223 # GL/glext.h:3189
+# EXT_multi_draw_arrays (GL/glext.h:3192)
+# EXT_fog_coord (GL/glext.h:3195)
+GL_FOG_COORDINATE_SOURCE_EXT = 33872 # GL/glext.h:3196
+GL_FOG_COORDINATE_EXT = 33873 # GL/glext.h:3197
+GL_FRAGMENT_DEPTH_EXT = 33874 # GL/glext.h:3198
+GL_CURRENT_FOG_COORDINATE_EXT = 33875 # GL/glext.h:3199
+GL_FOG_COORDINATE_ARRAY_TYPE_EXT = 33876 # GL/glext.h:3200
+GL_FOG_COORDINATE_ARRAY_STRIDE_EXT = 33877 # GL/glext.h:3201
+GL_FOG_COORDINATE_ARRAY_POINTER_EXT = 33878 # GL/glext.h:3202
+GL_FOG_COORDINATE_ARRAY_EXT = 33879 # GL/glext.h:3203
+# REND_screen_coordinates (GL/glext.h:3206)
+GL_SCREEN_COORDINATES_REND = 33936 # GL/glext.h:3207
+GL_INVERTED_SCREEN_W_REND = 33937 # GL/glext.h:3208
+# EXT_coordinate_frame (GL/glext.h:3211)
+GL_TANGENT_ARRAY_EXT = 33849 # GL/glext.h:3212
+GL_BINORMAL_ARRAY_EXT = 33850 # GL/glext.h:3213
+GL_CURRENT_TANGENT_EXT = 33851 # GL/glext.h:3214
+GL_CURRENT_BINORMAL_EXT = 33852 # GL/glext.h:3215
+GL_TANGENT_ARRAY_TYPE_EXT = 33854 # GL/glext.h:3216
+GL_TANGENT_ARRAY_STRIDE_EXT = 33855 # GL/glext.h:3217
+GL_BINORMAL_ARRAY_TYPE_EXT = 33856 # GL/glext.h:3218
+GL_BINORMAL_ARRAY_STRIDE_EXT = 33857 # GL/glext.h:3219
+GL_TANGENT_ARRAY_POINTER_EXT = 33858 # GL/glext.h:3220
+GL_BINORMAL_ARRAY_POINTER_EXT = 33859 # GL/glext.h:3221
+GL_MAP1_TANGENT_EXT = 33860 # GL/glext.h:3222
+GL_MAP2_TANGENT_EXT = 33861 # GL/glext.h:3223
+GL_MAP1_BINORMAL_EXT = 33862 # GL/glext.h:3224
+GL_MAP2_BINORMAL_EXT = 33863 # GL/glext.h:3225
+# EXT_texture_env_combine (GL/glext.h:3228)
+GL_COMBINE_EXT = 34160 # GL/glext.h:3229
+GL_COMBINE_RGB_EXT = 34161 # GL/glext.h:3230
+GL_COMBINE_ALPHA_EXT = 34162 # GL/glext.h:3231
+GL_RGB_SCALE_EXT = 34163 # GL/glext.h:3232
+GL_ADD_SIGNED_EXT = 34164 # GL/glext.h:3233
+GL_INTERPOLATE_EXT = 34165 # GL/glext.h:3234
+GL_CONSTANT_EXT = 34166 # GL/glext.h:3235
+GL_PRIMARY_COLOR_EXT = 34167 # GL/glext.h:3236
+GL_PREVIOUS_EXT = 34168 # GL/glext.h:3237
+GL_SOURCE0_RGB_EXT = 34176 # GL/glext.h:3238
+GL_SOURCE1_RGB_EXT = 34177 # GL/glext.h:3239
+GL_SOURCE2_RGB_EXT = 34178 # GL/glext.h:3240
+GL_SOURCE0_ALPHA_EXT = 34184 # GL/glext.h:3241
+GL_SOURCE1_ALPHA_EXT = 34185 # GL/glext.h:3242
+GL_SOURCE2_ALPHA_EXT = 34186 # GL/glext.h:3243
+GL_OPERAND0_RGB_EXT = 34192 # GL/glext.h:3244
+GL_OPERAND1_RGB_EXT = 34193 # GL/glext.h:3245
+GL_OPERAND2_RGB_EXT = 34194 # GL/glext.h:3246
+GL_OPERAND0_ALPHA_EXT = 34200 # GL/glext.h:3247
+GL_OPERAND1_ALPHA_EXT = 34201 # GL/glext.h:3248
+GL_OPERAND2_ALPHA_EXT = 34202 # GL/glext.h:3249
+# APPLE_specular_vector (GL/glext.h:3252)
+GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE = 34224 # GL/glext.h:3253
+# APPLE_transform_hint (GL/glext.h:3256)
+GL_TRANSFORM_HINT_APPLE = 34225 # GL/glext.h:3257
+# SGIX_fog_scale (GL/glext.h:3260)
+GL_FOG_SCALE_SGIX = 33276 # GL/glext.h:3261
+GL_FOG_SCALE_VALUE_SGIX = 33277 # GL/glext.h:3262
+# SUNX_constant_data (GL/glext.h:3265)
+GL_UNPACK_CONSTANT_DATA_SUNX = 33237 # GL/glext.h:3266
+GL_TEXTURE_CONSTANT_DATA_SUNX = 33238 # GL/glext.h:3267
+# SUN_global_alpha (GL/glext.h:3270)
+GL_GLOBAL_ALPHA_SUN = 33241 # GL/glext.h:3271
+GL_GLOBAL_ALPHA_FACTOR_SUN = 33242 # GL/glext.h:3272
+# SUN_triangle_list (GL/glext.h:3275)
+GL_RESTART_SUN = 1 # GL/glext.h:3276
+GL_REPLACE_MIDDLE_SUN = 2 # GL/glext.h:3277
+GL_REPLACE_OLDEST_SUN = 3 # GL/glext.h:3278
+GL_TRIANGLE_LIST_SUN = 33239 # GL/glext.h:3279
+GL_REPLACEMENT_CODE_SUN = 33240 # GL/glext.h:3280
+GL_REPLACEMENT_CODE_ARRAY_SUN = 34240 # GL/glext.h:3281
+GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN = 34241 # GL/glext.h:3282
+GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN = 34242 # GL/glext.h:3283
+GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN = 34243 # GL/glext.h:3284
+GL_R1UI_V3F_SUN = 34244 # GL/glext.h:3285
+GL_R1UI_C4UB_V3F_SUN = 34245 # GL/glext.h:3286
+GL_R1UI_C3F_V3F_SUN = 34246 # GL/glext.h:3287
+GL_R1UI_N3F_V3F_SUN = 34247 # GL/glext.h:3288
+GL_R1UI_C4F_N3F_V3F_SUN = 34248 # GL/glext.h:3289
+GL_R1UI_T2F_V3F_SUN = 34249 # GL/glext.h:3290
+GL_R1UI_T2F_N3F_V3F_SUN = 34250 # GL/glext.h:3291
+GL_R1UI_T2F_C4F_N3F_V3F_SUN = 34251 # GL/glext.h:3292
+# SUN_vertex (GL/glext.h:3295)
+# EXT_blend_func_separate (GL/glext.h:3298)
+GL_BLEND_DST_RGB_EXT = 32968 # GL/glext.h:3299
+GL_BLEND_SRC_RGB_EXT = 32969 # GL/glext.h:3300
+GL_BLEND_DST_ALPHA_EXT = 32970 # GL/glext.h:3301
+GL_BLEND_SRC_ALPHA_EXT = 32971 # GL/glext.h:3302
+# INGR_color_clamp (GL/glext.h:3305)
+GL_RED_MIN_CLAMP_INGR = 34144 # GL/glext.h:3306
+GL_GREEN_MIN_CLAMP_INGR = 34145 # GL/glext.h:3307
+GL_BLUE_MIN_CLAMP_INGR = 34146 # GL/glext.h:3308
+GL_ALPHA_MIN_CLAMP_INGR = 34147 # GL/glext.h:3309
+GL_RED_MAX_CLAMP_INGR = 34148 # GL/glext.h:3310
+GL_GREEN_MAX_CLAMP_INGR = 34149 # GL/glext.h:3311
+GL_BLUE_MAX_CLAMP_INGR = 34150 # GL/glext.h:3312
+GL_ALPHA_MAX_CLAMP_INGR = 34151 # GL/glext.h:3313
+# INGR_interlace_read (GL/glext.h:3316)
+GL_INTERLACE_READ_INGR = 34152 # GL/glext.h:3317
+# EXT_stencil_wrap (GL/glext.h:3320)
+GL_INCR_WRAP_EXT = 34055 # GL/glext.h:3321
+GL_DECR_WRAP_EXT = 34056 # GL/glext.h:3322
+# EXT_422_pixels (GL/glext.h:3325)
+GL_422_EXT = 32972 # GL/glext.h:3326
+GL_422_REV_EXT = 32973 # GL/glext.h:3327
+GL_422_AVERAGE_EXT = 32974 # GL/glext.h:3328
+GL_422_REV_AVERAGE_EXT = 32975 # GL/glext.h:3329
+# NV_texgen_reflection (GL/glext.h:3332)
+GL_NORMAL_MAP_NV = 34065 # GL/glext.h:3333
+GL_REFLECTION_MAP_NV = 34066 # GL/glext.h:3334
+# EXT_texture_cube_map (GL/glext.h:3337)
+GL_NORMAL_MAP_EXT = 34065 # GL/glext.h:3338
+GL_REFLECTION_MAP_EXT = 34066 # GL/glext.h:3339
+GL_TEXTURE_CUBE_MAP_EXT = 34067 # GL/glext.h:3340
+GL_TEXTURE_BINDING_CUBE_MAP_EXT = 34068 # GL/glext.h:3341
+GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT = 34069 # GL/glext.h:3342
+GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT = 34070 # GL/glext.h:3343
+GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT = 34071 # GL/glext.h:3344
+GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT = 34072 # GL/glext.h:3345
+GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT = 34073 # GL/glext.h:3346
+GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT = 34074 # GL/glext.h:3347
+GL_PROXY_TEXTURE_CUBE_MAP_EXT = 34075 # GL/glext.h:3348
+GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT = 34076 # GL/glext.h:3349
+# SUN_convolution_border_modes (GL/glext.h:3352)
+GL_WRAP_BORDER_SUN = 33236 # GL/glext.h:3353
+# EXT_texture_env_add (GL/glext.h:3356)
+# EXT_texture_lod_bias (GL/glext.h:3359)
+GL_MAX_TEXTURE_LOD_BIAS_EXT = 34045 # GL/glext.h:3360
+GL_TEXTURE_FILTER_CONTROL_EXT = 34048 # GL/glext.h:3361
+GL_TEXTURE_LOD_BIAS_EXT = 34049 # GL/glext.h:3362
+# EXT_texture_filter_anisotropic (GL/glext.h:3365)
+GL_TEXTURE_MAX_ANISOTROPY_EXT = 34046 # GL/glext.h:3366
+GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = 34047 # GL/glext.h:3367
+# EXT_vertex_weighting (GL/glext.h:3370)
+GL_MODELVIEW0_STACK_DEPTH_EXT = 2979 # GL/glext.h:3371
+GL_MODELVIEW1_STACK_DEPTH_EXT = 34050 # GL/glext.h:3372
+GL_MODELVIEW0_MATRIX_EXT = 2982 # GL/glext.h:3373
+GL_MODELVIEW1_MATRIX_EXT = 34054 # GL/glext.h:3374
+GL_VERTEX_WEIGHTING_EXT = 34057 # GL/glext.h:3375
+GL_MODELVIEW0_EXT = 5888 # GL/glext.h:3376
+GL_MODELVIEW1_EXT = 34058 # GL/glext.h:3377
+GL_CURRENT_VERTEX_WEIGHT_EXT = 34059 # GL/glext.h:3378
+GL_VERTEX_WEIGHT_ARRAY_EXT = 34060 # GL/glext.h:3379
+GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT = 34061 # GL/glext.h:3380
+GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT = 34062 # GL/glext.h:3381
+GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT = 34063 # GL/glext.h:3382
+GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT = 34064 # GL/glext.h:3383
+# NV_light_max_exponent (GL/glext.h:3386)
+GL_MAX_SHININESS_NV = 34052 # GL/glext.h:3387
+GL_MAX_SPOT_EXPONENT_NV = 34053 # GL/glext.h:3388
+# NV_vertex_array_range (GL/glext.h:3391)
+GL_VERTEX_ARRAY_RANGE_NV = 34077 # GL/glext.h:3392
+GL_VERTEX_ARRAY_RANGE_LENGTH_NV = 34078 # GL/glext.h:3393
+GL_VERTEX_ARRAY_RANGE_VALID_NV = 34079 # GL/glext.h:3394
+GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV = 34080 # GL/glext.h:3395
+GL_VERTEX_ARRAY_RANGE_POINTER_NV = 34081 # GL/glext.h:3396
+# NV_register_combiners (GL/glext.h:3399)
+GL_REGISTER_COMBINERS_NV = 34082 # GL/glext.h:3400
+GL_VARIABLE_A_NV = 34083 # GL/glext.h:3401
+GL_VARIABLE_B_NV = 34084 # GL/glext.h:3402
+GL_VARIABLE_C_NV = 34085 # GL/glext.h:3403
+GL_VARIABLE_D_NV = 34086 # GL/glext.h:3404
+GL_VARIABLE_E_NV = 34087 # GL/glext.h:3405
+GL_VARIABLE_F_NV = 34088 # GL/glext.h:3406
+GL_VARIABLE_G_NV = 34089 # GL/glext.h:3407
+GL_CONSTANT_COLOR0_NV = 34090 # GL/glext.h:3408
+GL_CONSTANT_COLOR1_NV = 34091 # GL/glext.h:3409
+GL_PRIMARY_COLOR_NV = 34092 # GL/glext.h:3410
+GL_SECONDARY_COLOR_NV = 34093 # GL/glext.h:3411
+GL_SPARE0_NV = 34094 # GL/glext.h:3412
+GL_SPARE1_NV = 34095 # GL/glext.h:3413
+GL_DISCARD_NV = 34096 # GL/glext.h:3414
+GL_E_TIMES_F_NV = 34097 # GL/glext.h:3415
+GL_SPARE0_PLUS_SECONDARY_COLOR_NV = 34098 # GL/glext.h:3416
+GL_UNSIGNED_IDENTITY_NV = 34102 # GL/glext.h:3417
+GL_UNSIGNED_INVERT_NV = 34103 # GL/glext.h:3418
+GL_EXPAND_NORMAL_NV = 34104 # GL/glext.h:3419
+GL_EXPAND_NEGATE_NV = 34105 # GL/glext.h:3420
+GL_HALF_BIAS_NORMAL_NV = 34106 # GL/glext.h:3421
+GL_HALF_BIAS_NEGATE_NV = 34107 # GL/glext.h:3422
+GL_SIGNED_IDENTITY_NV = 34108 # GL/glext.h:3423
+GL_SIGNED_NEGATE_NV = 34109 # GL/glext.h:3424
+GL_SCALE_BY_TWO_NV = 34110 # GL/glext.h:3425
+GL_SCALE_BY_FOUR_NV = 34111 # GL/glext.h:3426
+GL_SCALE_BY_ONE_HALF_NV = 34112 # GL/glext.h:3427
+GL_BIAS_BY_NEGATIVE_ONE_HALF_NV = 34113 # GL/glext.h:3428
+GL_COMBINER_INPUT_NV = 34114 # GL/glext.h:3429
+GL_COMBINER_MAPPING_NV = 34115 # GL/glext.h:3430
+GL_COMBINER_COMPONENT_USAGE_NV = 34116 # GL/glext.h:3431
+GL_COMBINER_AB_DOT_PRODUCT_NV = 34117 # GL/glext.h:3432
+GL_COMBINER_CD_DOT_PRODUCT_NV = 34118 # GL/glext.h:3433
+GL_COMBINER_MUX_SUM_NV = 34119 # GL/glext.h:3434
+GL_COMBINER_SCALE_NV = 34120 # GL/glext.h:3435
+GL_COMBINER_BIAS_NV = 34121 # GL/glext.h:3436
+GL_COMBINER_AB_OUTPUT_NV = 34122 # GL/glext.h:3437
+GL_COMBINER_CD_OUTPUT_NV = 34123 # GL/glext.h:3438
+GL_COMBINER_SUM_OUTPUT_NV = 34124 # GL/glext.h:3439
+GL_MAX_GENERAL_COMBINERS_NV = 34125 # GL/glext.h:3440
+GL_NUM_GENERAL_COMBINERS_NV = 34126 # GL/glext.h:3441
+GL_COLOR_SUM_CLAMP_NV = 34127 # GL/glext.h:3442
+GL_COMBINER0_NV = 34128 # GL/glext.h:3443
+GL_COMBINER1_NV = 34129 # GL/glext.h:3444
+GL_COMBINER2_NV = 34130 # GL/glext.h:3445
+GL_COMBINER3_NV = 34131 # GL/glext.h:3446
+GL_COMBINER4_NV = 34132 # GL/glext.h:3447
+GL_COMBINER5_NV = 34133 # GL/glext.h:3448
+GL_COMBINER6_NV = 34134 # GL/glext.h:3449
+GL_COMBINER7_NV = 34135 # GL/glext.h:3450
+# NV_fog_distance (GL/glext.h:3458)
+GL_FOG_DISTANCE_MODE_NV = 34138 # GL/glext.h:3459
+GL_EYE_RADIAL_NV = 34139 # GL/glext.h:3460
+GL_EYE_PLANE_ABSOLUTE_NV = 34140 # GL/glext.h:3461
+# NV_texgen_emboss (GL/glext.h:3465)
+GL_EMBOSS_LIGHT_NV = 34141 # GL/glext.h:3466
+GL_EMBOSS_CONSTANT_NV = 34142 # GL/glext.h:3467
+GL_EMBOSS_MAP_NV = 34143 # GL/glext.h:3468
+# NV_blend_square (GL/glext.h:3471)
+# NV_texture_env_combine4 (GL/glext.h:3474)
+GL_COMBINE4_NV = 34051 # GL/glext.h:3475
+GL_SOURCE3_RGB_NV = 34179 # GL/glext.h:3476
+GL_SOURCE3_ALPHA_NV = 34187 # GL/glext.h:3477
+GL_OPERAND3_RGB_NV = 34195 # GL/glext.h:3478
+GL_OPERAND3_ALPHA_NV = 34203 # GL/glext.h:3479
+# MESA_resize_buffers (GL/glext.h:3482)
+# MESA_window_pos (GL/glext.h:3485)
+# EXT_texture_compression_s3tc (GL/glext.h:3488)
+GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 33776 # GL/glext.h:3489
+GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777 # GL/glext.h:3490
+GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778 # GL/glext.h:3491
+GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779 # GL/glext.h:3492
+# IBM_cull_vertex (GL/glext.h:3495)
+GL_CULL_VERTEX_IBM = 103050 # GL/glext.h:3496
+# IBM_multimode_draw_arrays (GL/glext.h:3499)
+# IBM_vertex_array_lists (GL/glext.h:3502)
+GL_VERTEX_ARRAY_LIST_IBM = 103070 # GL/glext.h:3503
+GL_NORMAL_ARRAY_LIST_IBM = 103071 # GL/glext.h:3504
+GL_COLOR_ARRAY_LIST_IBM = 103072 # GL/glext.h:3505
+GL_INDEX_ARRAY_LIST_IBM = 103073 # GL/glext.h:3506
+GL_TEXTURE_COORD_ARRAY_LIST_IBM = 103074 # GL/glext.h:3507
+GL_EDGE_FLAG_ARRAY_LIST_IBM = 103075 # GL/glext.h:3508
+GL_FOG_COORDINATE_ARRAY_LIST_IBM = 103076 # GL/glext.h:3509
+GL_SECONDARY_COLOR_ARRAY_LIST_IBM = 103077 # GL/glext.h:3510
+GL_VERTEX_ARRAY_LIST_STRIDE_IBM = 103080 # GL/glext.h:3511
+GL_NORMAL_ARRAY_LIST_STRIDE_IBM = 103081 # GL/glext.h:3512
+GL_COLOR_ARRAY_LIST_STRIDE_IBM = 103082 # GL/glext.h:3513
+GL_INDEX_ARRAY_LIST_STRIDE_IBM = 103083 # GL/glext.h:3514
+GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM = 103084 # GL/glext.h:3515
+GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM = 103085 # GL/glext.h:3516
+GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM = 103086 # GL/glext.h:3517
+GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM = 103087 # GL/glext.h:3518
+# SGIX_subsample (GL/glext.h:3521)
+GL_PACK_SUBSAMPLE_RATE_SGIX = 34208 # GL/glext.h:3522
+GL_UNPACK_SUBSAMPLE_RATE_SGIX = 34209 # GL/glext.h:3523
+GL_PIXEL_SUBSAMPLE_4444_SGIX = 34210 # GL/glext.h:3524
+GL_PIXEL_SUBSAMPLE_2424_SGIX = 34211 # GL/glext.h:3525
+GL_PIXEL_SUBSAMPLE_4242_SGIX = 34212 # GL/glext.h:3526
+# SGIX_ycrcb_subsample (GL/glext.h:3529)
+# SGIX_ycrcba (GL/glext.h:3532)
+GL_YCRCB_SGIX = 33560 # GL/glext.h:3533
+GL_YCRCBA_SGIX = 33561 # GL/glext.h:3534
+# SGI_depth_pass_instrument (GL/glext.h:3537)
+GL_DEPTH_PASS_INSTRUMENT_SGIX = 33552 # GL/glext.h:3538
+GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX = 33553 # GL/glext.h:3539
+GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX = 33554 # GL/glext.h:3540
+# 3DFX_texture_compression_FXT1 (GL/glext.h:3543)
+GL_COMPRESSED_RGB_FXT1_3DFX = 34480 # GL/glext.h:3544
+GL_COMPRESSED_RGBA_FXT1_3DFX = 34481 # GL/glext.h:3545
+# 3DFX_multisample (GL/glext.h:3548)
+GL_MULTISAMPLE_3DFX = 34482 # GL/glext.h:3549
+GL_SAMPLE_BUFFERS_3DFX = 34483 # GL/glext.h:3550
+GL_SAMPLES_3DFX = 34484 # GL/glext.h:3551
+GL_MULTISAMPLE_BIT_3DFX = 536870912 # GL/glext.h:3552
+# 3DFX_tbuffer (GL/glext.h:3555)
+# EXT_multisample (GL/glext.h:3558)
+GL_MULTISAMPLE_EXT = 32925 # GL/glext.h:3559
+GL_SAMPLE_ALPHA_TO_MASK_EXT = 32926 # GL/glext.h:3560
+GL_SAMPLE_ALPHA_TO_ONE_EXT = 32927 # GL/glext.h:3561
+GL_SAMPLE_MASK_EXT = 32928 # GL/glext.h:3562
+GL_1PASS_EXT = 32929 # GL/glext.h:3563
+GL_2PASS_0_EXT = 32930 # GL/glext.h:3564
+GL_2PASS_1_EXT = 32931 # GL/glext.h:3565
+GL_4PASS_0_EXT = 32932 # GL/glext.h:3566
+GL_4PASS_1_EXT = 32933 # GL/glext.h:3567
+GL_4PASS_2_EXT = 32934 # GL/glext.h:3568
+GL_4PASS_3_EXT = 32935 # GL/glext.h:3569
+GL_SAMPLE_BUFFERS_EXT = 32936 # GL/glext.h:3570
+GL_SAMPLES_EXT = 32937 # GL/glext.h:3571
+GL_SAMPLE_MASK_VALUE_EXT = 32938 # GL/glext.h:3572
+GL_SAMPLE_MASK_INVERT_EXT = 32939 # GL/glext.h:3573
+GL_SAMPLE_PATTERN_EXT = 32940 # GL/glext.h:3574
+GL_MULTISAMPLE_BIT_EXT = 536870912 # GL/glext.h:3575
+# SGIX_vertex_preclip (GL/glext.h:3578)
+GL_VERTEX_PRECLIP_SGIX = 33774 # GL/glext.h:3579
+GL_VERTEX_PRECLIP_HINT_SGIX = 33775 # GL/glext.h:3580
+# SGIX_convolution_accuracy (GL/glext.h:3583)
+GL_CONVOLUTION_HINT_SGIX = 33558 # GL/glext.h:3584
+# SGIX_resample (GL/glext.h:3587)
+GL_PACK_RESAMPLE_SGIX = 33836 # GL/glext.h:3588
+GL_UNPACK_RESAMPLE_SGIX = 33837 # GL/glext.h:3589
+GL_RESAMPLE_REPLICATE_SGIX = 33838 # GL/glext.h:3590
+GL_RESAMPLE_ZERO_FILL_SGIX = 33839 # GL/glext.h:3591
+GL_RESAMPLE_DECIMATE_SGIX = 33840 # GL/glext.h:3592
+# SGIS_point_line_texgen (GL/glext.h:3595)
+GL_EYE_DISTANCE_TO_POINT_SGIS = 33264 # GL/glext.h:3596
+GL_OBJECT_DISTANCE_TO_POINT_SGIS = 33265 # GL/glext.h:3597
+GL_EYE_DISTANCE_TO_LINE_SGIS = 33266 # GL/glext.h:3598
+GL_OBJECT_DISTANCE_TO_LINE_SGIS = 33267 # GL/glext.h:3599
+GL_EYE_POINT_SGIS = 33268 # GL/glext.h:3600
+GL_OBJECT_POINT_SGIS = 33269 # GL/glext.h:3601
+GL_EYE_LINE_SGIS = 33270 # GL/glext.h:3602
+GL_OBJECT_LINE_SGIS = 33271 # GL/glext.h:3603
+# SGIS_texture_color_mask (GL/glext.h:3606)
+GL_TEXTURE_COLOR_WRITEMASK_SGIS = 33263 # GL/glext.h:3607
+# EXT_texture_env_dot3 (GL/glext.h:3610)
+GL_DOT3_RGB_EXT = 34624 # GL/glext.h:3611
+GL_DOT3_RGBA_EXT = 34625 # GL/glext.h:3612
+# ATI_texture_mirror_once (GL/glext.h:3615)
+GL_MIRROR_CLAMP_ATI = 34626 # GL/glext.h:3616
+GL_MIRROR_CLAMP_TO_EDGE_ATI = 34627 # GL/glext.h:3617
+# NV_fence (GL/glext.h:3620)
+GL_ALL_COMPLETED_NV = 34034 # GL/glext.h:3621
+GL_FENCE_STATUS_NV = 34035 # GL/glext.h:3622
+GL_FENCE_CONDITION_NV = 34036 # GL/glext.h:3623
+# IBM_texture_mirrored_repeat (GL/glext.h:3626)
+GL_MIRRORED_REPEAT_IBM = 33648 # GL/glext.h:3627
+# NV_evaluators (GL/glext.h:3630)
+GL_EVAL_2D_NV = 34496 # GL/glext.h:3631
+GL_EVAL_TRIANGULAR_2D_NV = 34497 # GL/glext.h:3632
+GL_MAP_TESSELLATION_NV = 34498 # GL/glext.h:3633
+GL_MAP_ATTRIB_U_ORDER_NV = 34499 # GL/glext.h:3634
+GL_MAP_ATTRIB_V_ORDER_NV = 34500 # GL/glext.h:3635
+GL_EVAL_FRACTIONAL_TESSELLATION_NV = 34501 # GL/glext.h:3636
+GL_EVAL_VERTEX_ATTRIB0_NV = 34502 # GL/glext.h:3637
+GL_EVAL_VERTEX_ATTRIB1_NV = 34503 # GL/glext.h:3638
+GL_EVAL_VERTEX_ATTRIB2_NV = 34504 # GL/glext.h:3639
+GL_EVAL_VERTEX_ATTRIB3_NV = 34505 # GL/glext.h:3640
+GL_EVAL_VERTEX_ATTRIB4_NV = 34506 # GL/glext.h:3641
+GL_EVAL_VERTEX_ATTRIB5_NV = 34507 # GL/glext.h:3642
+GL_EVAL_VERTEX_ATTRIB6_NV = 34508 # GL/glext.h:3643
+GL_EVAL_VERTEX_ATTRIB7_NV = 34509 # GL/glext.h:3644
+GL_EVAL_VERTEX_ATTRIB8_NV = 34510 # GL/glext.h:3645
+GL_EVAL_VERTEX_ATTRIB9_NV = 34511 # GL/glext.h:3646
+GL_EVAL_VERTEX_ATTRIB10_NV = 34512 # GL/glext.h:3647
+GL_EVAL_VERTEX_ATTRIB11_NV = 34513 # GL/glext.h:3648
+GL_EVAL_VERTEX_ATTRIB12_NV = 34514 # GL/glext.h:3649
+GL_EVAL_VERTEX_ATTRIB13_NV = 34515 # GL/glext.h:3650
+GL_EVAL_VERTEX_ATTRIB14_NV = 34516 # GL/glext.h:3651
+GL_EVAL_VERTEX_ATTRIB15_NV = 34517 # GL/glext.h:3652
+GL_MAX_MAP_TESSELLATION_NV = 34518 # GL/glext.h:3653
+GL_MAX_RATIONAL_EVAL_ORDER_NV = 34519 # GL/glext.h:3654
+# NV_packed_depth_stencil (GL/glext.h:3657)
+GL_DEPTH_STENCIL_NV = 34041 # GL/glext.h:3658
+GL_UNSIGNED_INT_24_8_NV = 34042 # GL/glext.h:3659
+# NV_register_combiners2 (GL/glext.h:3662)
+GL_PER_STAGE_CONSTANTS_NV = 34101 # GL/glext.h:3663
+# NV_texture_compression_vtc (GL/glext.h:3666)
+# NV_texture_rectangle (GL/glext.h:3669)
+GL_TEXTURE_RECTANGLE_NV = 34037 # GL/glext.h:3670
+GL_TEXTURE_BINDING_RECTANGLE_NV = 34038 # GL/glext.h:3671
+GL_PROXY_TEXTURE_RECTANGLE_NV = 34039 # GL/glext.h:3672
+GL_MAX_RECTANGLE_TEXTURE_SIZE_NV = 34040 # GL/glext.h:3673
+# NV_texture_shader (GL/glext.h:3676)
+GL_OFFSET_TEXTURE_RECTANGLE_NV = 34380 # GL/glext.h:3677
+GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV = 34381 # GL/glext.h:3678
+GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV = 34382 # GL/glext.h:3679
+GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV = 34521 # GL/glext.h:3680
+GL_UNSIGNED_INT_S8_S8_8_8_NV = 34522 # GL/glext.h:3681
+GL_UNSIGNED_INT_8_8_S8_S8_REV_NV = 34523 # GL/glext.h:3682
+GL_DSDT_MAG_INTENSITY_NV = 34524 # GL/glext.h:3683
+GL_SHADER_CONSISTENT_NV = 34525 # GL/glext.h:3684
+GL_TEXTURE_SHADER_NV = 34526 # GL/glext.h:3685
+GL_SHADER_OPERATION_NV = 34527 # GL/glext.h:3686
+GL_CULL_MODES_NV = 34528 # GL/glext.h:3687
+GL_OFFSET_TEXTURE_MATRIX_NV = 34529 # GL/glext.h:3688
+GL_OFFSET_TEXTURE_SCALE_NV = 34530 # GL/glext.h:3689
+GL_OFFSET_TEXTURE_BIAS_NV = 34531 # GL/glext.h:3690
+GL_OFFSET_TEXTURE_2D_MATRIX_NV = 34529 # GL/glext.h:3691
+GL_OFFSET_TEXTURE_2D_SCALE_NV = 34530 # GL/glext.h:3692
+GL_OFFSET_TEXTURE_2D_BIAS_NV = 34531 # GL/glext.h:3693
+GL_PREVIOUS_TEXTURE_INPUT_NV = 34532 # GL/glext.h:3694
+GL_CONST_EYE_NV = 34533 # GL/glext.h:3695
+GL_PASS_THROUGH_NV = 34534 # GL/glext.h:3696
+GL_CULL_FRAGMENT_NV = 34535 # GL/glext.h:3697
+GL_OFFSET_TEXTURE_2D_NV = 34536 # GL/glext.h:3698
+GL_DEPENDENT_AR_TEXTURE_2D_NV = 34537 # GL/glext.h:3699
+GL_DEPENDENT_GB_TEXTURE_2D_NV = 34538 # GL/glext.h:3700
+GL_DOT_PRODUCT_NV = 34540 # GL/glext.h:3701
+GL_DOT_PRODUCT_DEPTH_REPLACE_NV = 34541 # GL/glext.h:3702
+GL_DOT_PRODUCT_TEXTURE_2D_NV = 34542 # GL/glext.h:3703
+GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV = 34544 # GL/glext.h:3704
+GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV = 34545 # GL/glext.h:3705
+GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV = 34546 # GL/glext.h:3706
+GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV = 34547 # GL/glext.h:3707
+GL_HILO_NV = 34548 # GL/glext.h:3708
+GL_DSDT_NV = 34549 # GL/glext.h:3709
+GL_DSDT_MAG_NV = 34550 # GL/glext.h:3710
+GL_DSDT_MAG_VIB_NV = 34551 # GL/glext.h:3711
+GL_HILO16_NV = 34552 # GL/glext.h:3712
+GL_SIGNED_HILO_NV = 34553 # GL/glext.h:3713
+GL_SIGNED_HILO16_NV = 34554 # GL/glext.h:3714
+GL_SIGNED_RGBA_NV = 34555 # GL/glext.h:3715
+GL_SIGNED_RGBA8_NV = 34556 # GL/glext.h:3716
+GL_SIGNED_RGB_NV = 34558 # GL/glext.h:3717
+GL_SIGNED_RGB8_NV = 34559 # GL/glext.h:3718
+GL_SIGNED_LUMINANCE_NV = 34561 # GL/glext.h:3719
+GL_SIGNED_LUMINANCE8_NV = 34562 # GL/glext.h:3720
+GL_SIGNED_LUMINANCE_ALPHA_NV = 34563 # GL/glext.h:3721
+GL_SIGNED_LUMINANCE8_ALPHA8_NV = 34564 # GL/glext.h:3722
+GL_SIGNED_ALPHA_NV = 34565 # GL/glext.h:3723
+GL_SIGNED_ALPHA8_NV = 34566 # GL/glext.h:3724
+GL_SIGNED_INTENSITY_NV = 34567 # GL/glext.h:3725
+GL_SIGNED_INTENSITY8_NV = 34568 # GL/glext.h:3726
+GL_DSDT8_NV = 34569 # GL/glext.h:3727
+GL_DSDT8_MAG8_NV = 34570 # GL/glext.h:3728
+GL_DSDT8_MAG8_INTENSITY8_NV = 34571 # GL/glext.h:3729
+GL_SIGNED_RGB_UNSIGNED_ALPHA_NV = 34572 # GL/glext.h:3730
+GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV = 34573 # GL/glext.h:3731
+GL_HI_SCALE_NV = 34574 # GL/glext.h:3732
+GL_LO_SCALE_NV = 34575 # GL/glext.h:3733
+GL_DS_SCALE_NV = 34576 # GL/glext.h:3734
+GL_DT_SCALE_NV = 34577 # GL/glext.h:3735
+GL_MAGNITUDE_SCALE_NV = 34578 # GL/glext.h:3736
+GL_VIBRANCE_SCALE_NV = 34579 # GL/glext.h:3737
+GL_HI_BIAS_NV = 34580 # GL/glext.h:3738
+GL_LO_BIAS_NV = 34581 # GL/glext.h:3739
+GL_DS_BIAS_NV = 34582 # GL/glext.h:3740
+GL_DT_BIAS_NV = 34583 # GL/glext.h:3741
+GL_MAGNITUDE_BIAS_NV = 34584 # GL/glext.h:3742
+GL_VIBRANCE_BIAS_NV = 34585 # GL/glext.h:3743
+GL_TEXTURE_BORDER_VALUES_NV = 34586 # GL/glext.h:3744
+GL_TEXTURE_HI_SIZE_NV = 34587 # GL/glext.h:3745
+GL_TEXTURE_LO_SIZE_NV = 34588 # GL/glext.h:3746
+GL_TEXTURE_DS_SIZE_NV = 34589 # GL/glext.h:3747
+GL_TEXTURE_DT_SIZE_NV = 34590 # GL/glext.h:3748
+GL_TEXTURE_MAG_SIZE_NV = 34591 # GL/glext.h:3749
+# NV_texture_shader2 (GL/glext.h:3752)
+GL_DOT_PRODUCT_TEXTURE_3D_NV = 34543 # GL/glext.h:3753
+# NV_vertex_array_range2 (GL/glext.h:3756)
+GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV = 34099 # GL/glext.h:3757
+# NV_vertex_program (GL/glext.h:3760)
+GL_VERTEX_PROGRAM_NV = 34336 # GL/glext.h:3761
+GL_VERTEX_STATE_PROGRAM_NV = 34337 # GL/glext.h:3762
+GL_ATTRIB_ARRAY_SIZE_NV = 34339 # GL/glext.h:3763
+GL_ATTRIB_ARRAY_STRIDE_NV = 34340 # GL/glext.h:3764
+GL_ATTRIB_ARRAY_TYPE_NV = 34341 # GL/glext.h:3765
+GL_CURRENT_ATTRIB_NV = 34342 # GL/glext.h:3766
+GL_PROGRAM_LENGTH_NV = 34343 # GL/glext.h:3767
+GL_PROGRAM_STRING_NV = 34344 # GL/glext.h:3768
+GL_MODELVIEW_PROJECTION_NV = 34345 # GL/glext.h:3769
+GL_IDENTITY_NV = 34346 # GL/glext.h:3770
+GL_INVERSE_NV = 34347 # GL/glext.h:3771
+GL_TRANSPOSE_NV = 34348 # GL/glext.h:3772
+GL_INVERSE_TRANSPOSE_NV = 34349 # GL/glext.h:3773
+GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV = 34350 # GL/glext.h:3774
+GL_MAX_TRACK_MATRICES_NV = 34351 # GL/glext.h:3775
+GL_MATRIX0_NV = 34352 # GL/glext.h:3776
+GL_MATRIX1_NV = 34353 # GL/glext.h:3777
+GL_MATRIX2_NV = 34354 # GL/glext.h:3778
+GL_MATRIX3_NV = 34355 # GL/glext.h:3779
+GL_MATRIX4_NV = 34356 # GL/glext.h:3780
+GL_MATRIX5_NV = 34357 # GL/glext.h:3781
+GL_MATRIX6_NV = 34358 # GL/glext.h:3782
+GL_MATRIX7_NV = 34359 # GL/glext.h:3783
+GL_CURRENT_MATRIX_STACK_DEPTH_NV = 34368 # GL/glext.h:3784
+GL_CURRENT_MATRIX_NV = 34369 # GL/glext.h:3785
+GL_VERTEX_PROGRAM_POINT_SIZE_NV = 34370 # GL/glext.h:3786
+GL_VERTEX_PROGRAM_TWO_SIDE_NV = 34371 # GL/glext.h:3787
+GL_PROGRAM_PARAMETER_NV = 34372 # GL/glext.h:3788
+GL_ATTRIB_ARRAY_POINTER_NV = 34373 # GL/glext.h:3789
+GL_PROGRAM_TARGET_NV = 34374 # GL/glext.h:3790
+GL_PROGRAM_RESIDENT_NV = 34375 # GL/glext.h:3791
+GL_TRACK_MATRIX_NV = 34376 # GL/glext.h:3792
+GL_TRACK_MATRIX_TRANSFORM_NV = 34377 # GL/glext.h:3793
+GL_VERTEX_PROGRAM_BINDING_NV = 34378 # GL/glext.h:3794
+GL_PROGRAM_ERROR_POSITION_NV = 34379 # GL/glext.h:3795
+GL_VERTEX_ATTRIB_ARRAY0_NV = 34384 # GL/glext.h:3796
+GL_VERTEX_ATTRIB_ARRAY1_NV = 34385 # GL/glext.h:3797
+GL_VERTEX_ATTRIB_ARRAY2_NV = 34386 # GL/glext.h:3798
+GL_VERTEX_ATTRIB_ARRAY3_NV = 34387 # GL/glext.h:3799
+GL_VERTEX_ATTRIB_ARRAY4_NV = 34388 # GL/glext.h:3800
+GL_VERTEX_ATTRIB_ARRAY5_NV = 34389 # GL/glext.h:3801
+GL_VERTEX_ATTRIB_ARRAY6_NV = 34390 # GL/glext.h:3802
+GL_VERTEX_ATTRIB_ARRAY7_NV = 34391 # GL/glext.h:3803
+GL_VERTEX_ATTRIB_ARRAY8_NV = 34392 # GL/glext.h:3804
+GL_VERTEX_ATTRIB_ARRAY9_NV = 34393 # GL/glext.h:3805
+GL_VERTEX_ATTRIB_ARRAY10_NV = 34394 # GL/glext.h:3806
+GL_VERTEX_ATTRIB_ARRAY11_NV = 34395 # GL/glext.h:3807
+GL_VERTEX_ATTRIB_ARRAY12_NV = 34396 # GL/glext.h:3808
+GL_VERTEX_ATTRIB_ARRAY13_NV = 34397 # GL/glext.h:3809
+GL_VERTEX_ATTRIB_ARRAY14_NV = 34398 # GL/glext.h:3810
+GL_VERTEX_ATTRIB_ARRAY15_NV = 34399 # GL/glext.h:3811
+GL_MAP1_VERTEX_ATTRIB0_4_NV = 34400 # GL/glext.h:3812
+GL_MAP1_VERTEX_ATTRIB1_4_NV = 34401 # GL/glext.h:3813
+GL_MAP1_VERTEX_ATTRIB2_4_NV = 34402 # GL/glext.h:3814
+GL_MAP1_VERTEX_ATTRIB3_4_NV = 34403 # GL/glext.h:3815
+GL_MAP1_VERTEX_ATTRIB4_4_NV = 34404 # GL/glext.h:3816
+GL_MAP1_VERTEX_ATTRIB5_4_NV = 34405 # GL/glext.h:3817
+GL_MAP1_VERTEX_ATTRIB6_4_NV = 34406 # GL/glext.h:3818
+GL_MAP1_VERTEX_ATTRIB7_4_NV = 34407 # GL/glext.h:3819
+GL_MAP1_VERTEX_ATTRIB8_4_NV = 34408 # GL/glext.h:3820
+GL_MAP1_VERTEX_ATTRIB9_4_NV = 34409 # GL/glext.h:3821
+GL_MAP1_VERTEX_ATTRIB10_4_NV = 34410 # GL/glext.h:3822
+GL_MAP1_VERTEX_ATTRIB11_4_NV = 34411 # GL/glext.h:3823
+GL_MAP1_VERTEX_ATTRIB12_4_NV = 34412 # GL/glext.h:3824
+GL_MAP1_VERTEX_ATTRIB13_4_NV = 34413 # GL/glext.h:3825
+GL_MAP1_VERTEX_ATTRIB14_4_NV = 34414 # GL/glext.h:3826
+GL_MAP1_VERTEX_ATTRIB15_4_NV = 34415 # GL/glext.h:3827
+GL_MAP2_VERTEX_ATTRIB0_4_NV = 34416 # GL/glext.h:3828
+GL_MAP2_VERTEX_ATTRIB1_4_NV = 34417 # GL/glext.h:3829
+GL_MAP2_VERTEX_ATTRIB2_4_NV = 34418 # GL/glext.h:3830
+GL_MAP2_VERTEX_ATTRIB3_4_NV = 34419 # GL/glext.h:3831
+GL_MAP2_VERTEX_ATTRIB4_4_NV = 34420 # GL/glext.h:3832
+GL_MAP2_VERTEX_ATTRIB5_4_NV = 34421 # GL/glext.h:3833
+GL_MAP2_VERTEX_ATTRIB6_4_NV = 34422 # GL/glext.h:3834
+GL_MAP2_VERTEX_ATTRIB7_4_NV = 34423 # GL/glext.h:3835
+GL_MAP2_VERTEX_ATTRIB8_4_NV = 34424 # GL/glext.h:3836
+GL_MAP2_VERTEX_ATTRIB9_4_NV = 34425 # GL/glext.h:3837
+GL_MAP2_VERTEX_ATTRIB10_4_NV = 34426 # GL/glext.h:3838
+GL_MAP2_VERTEX_ATTRIB11_4_NV = 34427 # GL/glext.h:3839
+GL_MAP2_VERTEX_ATTRIB12_4_NV = 34428 # GL/glext.h:3840
+GL_MAP2_VERTEX_ATTRIB13_4_NV = 34429 # GL/glext.h:3841
+GL_MAP2_VERTEX_ATTRIB14_4_NV = 34430 # GL/glext.h:3842
+GL_MAP2_VERTEX_ATTRIB15_4_NV = 34431 # GL/glext.h:3843
+# SGIX_texture_coordinate_clamp (GL/glext.h:3846)
+GL_TEXTURE_MAX_CLAMP_S_SGIX = 33641 # GL/glext.h:3847
+GL_TEXTURE_MAX_CLAMP_T_SGIX = 33642 # GL/glext.h:3848
+GL_TEXTURE_MAX_CLAMP_R_SGIX = 33643 # GL/glext.h:3849
+# SGIX_scalebias_hint (GL/glext.h:3852)
+GL_SCALEBIAS_HINT_SGIX = 33570 # GL/glext.h:3853
+# OML_interlace (GL/glext.h:3856)
+GL_INTERLACE_OML = 35200 # GL/glext.h:3857
+GL_INTERLACE_READ_OML = 35201 # GL/glext.h:3858
+# OML_subsample (GL/glext.h:3861)
+GL_FORMAT_SUBSAMPLE_24_24_OML = 35202 # GL/glext.h:3862
+GL_FORMAT_SUBSAMPLE_244_244_OML = 35203 # GL/glext.h:3863
+# OML_resample (GL/glext.h:3866)
+GL_PACK_RESAMPLE_OML = 35204 # GL/glext.h:3867
+GL_UNPACK_RESAMPLE_OML = 35205 # GL/glext.h:3868
+GL_RESAMPLE_REPLICATE_OML = 35206 # GL/glext.h:3869
+GL_RESAMPLE_ZERO_FILL_OML = 35207 # GL/glext.h:3870
+GL_RESAMPLE_AVERAGE_OML = 35208 # GL/glext.h:3871
+GL_RESAMPLE_DECIMATE_OML = 35209 # GL/glext.h:3872
+# NV_copy_depth_to_color (GL/glext.h:3875)
+GL_DEPTH_STENCIL_TO_RGBA_NV = 34926 # GL/glext.h:3876
+GL_DEPTH_STENCIL_TO_BGRA_NV = 34927 # GL/glext.h:3877
+# ATI_envmap_bumpmap (GL/glext.h:3880)
+GL_BUMP_ROT_MATRIX_ATI = 34677 # GL/glext.h:3881
+GL_BUMP_ROT_MATRIX_SIZE_ATI = 34678 # GL/glext.h:3882
+GL_BUMP_NUM_TEX_UNITS_ATI = 34679 # GL/glext.h:3883
+GL_BUMP_TEX_UNITS_ATI = 34680 # GL/glext.h:3884
+GL_DUDV_ATI = 34681 # GL/glext.h:3885
+GL_DU8DV8_ATI = 34682 # GL/glext.h:3886
+GL_BUMP_ENVMAP_ATI = 34683 # GL/glext.h:3887
+GL_BUMP_TARGET_ATI = 34684 # GL/glext.h:3888
+# ATI_fragment_shader (GL/glext.h:3891)
+GL_FRAGMENT_SHADER_ATI = 35104 # GL/glext.h:3892
+GL_REG_0_ATI = 35105 # GL/glext.h:3893
+GL_REG_1_ATI = 35106 # GL/glext.h:3894
+GL_REG_2_ATI = 35107 # GL/glext.h:3895
+GL_REG_3_ATI = 35108 # GL/glext.h:3896
+GL_REG_4_ATI = 35109 # GL/glext.h:3897
+GL_REG_5_ATI = 35110 # GL/glext.h:3898
+GL_REG_6_ATI = 35111 # GL/glext.h:3899
+GL_REG_7_ATI = 35112 # GL/glext.h:3900
+GL_REG_8_ATI = 35113 # GL/glext.h:3901
+GL_REG_9_ATI = 35114 # GL/glext.h:3902
+GL_REG_10_ATI = 35115 # GL/glext.h:3903
+GL_REG_11_ATI = 35116 # GL/glext.h:3904
+GL_REG_12_ATI = 35117 # GL/glext.h:3905
+GL_REG_13_ATI = 35118 # GL/glext.h:3906
+GL_REG_14_ATI = 35119 # GL/glext.h:3907
+GL_REG_15_ATI = 35120 # GL/glext.h:3908
+GL_REG_16_ATI = 35121 # GL/glext.h:3909
+GL_REG_17_ATI = 35122 # GL/glext.h:3910
+GL_REG_18_ATI = 35123 # GL/glext.h:3911
+GL_REG_19_ATI = 35124 # GL/glext.h:3912
+GL_REG_20_ATI = 35125 # GL/glext.h:3913
+GL_REG_21_ATI = 35126 # GL/glext.h:3914
+GL_REG_22_ATI = 35127 # GL/glext.h:3915
+GL_REG_23_ATI = 35128 # GL/glext.h:3916
+GL_REG_24_ATI = 35129 # GL/glext.h:3917
+GL_REG_25_ATI = 35130 # GL/glext.h:3918
+GL_REG_26_ATI = 35131 # GL/glext.h:3919
+GL_REG_27_ATI = 35132 # GL/glext.h:3920
+GL_REG_28_ATI = 35133 # GL/glext.h:3921
+GL_REG_29_ATI = 35134 # GL/glext.h:3922
+GL_REG_30_ATI = 35135 # GL/glext.h:3923
+GL_REG_31_ATI = 35136 # GL/glext.h:3924
+GL_CON_0_ATI = 35137 # GL/glext.h:3925
+GL_CON_1_ATI = 35138 # GL/glext.h:3926
+GL_CON_2_ATI = 35139 # GL/glext.h:3927
+GL_CON_3_ATI = 35140 # GL/glext.h:3928
+GL_CON_4_ATI = 35141 # GL/glext.h:3929
+GL_CON_5_ATI = 35142 # GL/glext.h:3930
+GL_CON_6_ATI = 35143 # GL/glext.h:3931
+GL_CON_7_ATI = 35144 # GL/glext.h:3932
+GL_CON_8_ATI = 35145 # GL/glext.h:3933
+GL_CON_9_ATI = 35146 # GL/glext.h:3934
+GL_CON_10_ATI = 35147 # GL/glext.h:3935
+GL_CON_11_ATI = 35148 # GL/glext.h:3936
+GL_CON_12_ATI = 35149 # GL/glext.h:3937
+GL_CON_13_ATI = 35150 # GL/glext.h:3938
+GL_CON_14_ATI = 35151 # GL/glext.h:3939
+GL_CON_15_ATI = 35152 # GL/glext.h:3940
+GL_CON_16_ATI = 35153 # GL/glext.h:3941
+GL_CON_17_ATI = 35154 # GL/glext.h:3942
+GL_CON_18_ATI = 35155 # GL/glext.h:3943
+GL_CON_19_ATI = 35156 # GL/glext.h:3944
+GL_CON_20_ATI = 35157 # GL/glext.h:3945
+GL_CON_21_ATI = 35158 # GL/glext.h:3946
+GL_CON_22_ATI = 35159 # GL/glext.h:3947
+GL_CON_23_ATI = 35160 # GL/glext.h:3948
+GL_CON_24_ATI = 35161 # GL/glext.h:3949
+GL_CON_25_ATI = 35162 # GL/glext.h:3950
+GL_CON_26_ATI = 35163 # GL/glext.h:3951
+GL_CON_27_ATI = 35164 # GL/glext.h:3952
+GL_CON_28_ATI = 35165 # GL/glext.h:3953
+GL_CON_29_ATI = 35166 # GL/glext.h:3954
+GL_CON_30_ATI = 35167 # GL/glext.h:3955
+GL_CON_31_ATI = 35168 # GL/glext.h:3956
+GL_MOV_ATI = 35169 # GL/glext.h:3957
+GL_ADD_ATI = 35171 # GL/glext.h:3958
+GL_MUL_ATI = 35172 # GL/glext.h:3959
+GL_SUB_ATI = 35173 # GL/glext.h:3960
+GL_DOT3_ATI = 35174 # GL/glext.h:3961
+GL_DOT4_ATI = 35175 # GL/glext.h:3962
+GL_MAD_ATI = 35176 # GL/glext.h:3963
+GL_LERP_ATI = 35177 # GL/glext.h:3964
+GL_CND_ATI = 35178 # GL/glext.h:3965
+GL_CND0_ATI = 35179 # GL/glext.h:3966
+GL_DOT2_ADD_ATI = 35180 # GL/glext.h:3967
+GL_SECONDARY_INTERPOLATOR_ATI = 35181 # GL/glext.h:3968
+GL_NUM_FRAGMENT_REGISTERS_ATI = 35182 # GL/glext.h:3969
+GL_NUM_FRAGMENT_CONSTANTS_ATI = 35183 # GL/glext.h:3970
+GL_NUM_PASSES_ATI = 35184 # GL/glext.h:3971
+GL_NUM_INSTRUCTIONS_PER_PASS_ATI = 35185 # GL/glext.h:3972
+GL_NUM_INSTRUCTIONS_TOTAL_ATI = 35186 # GL/glext.h:3973
+GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI = 35187 # GL/glext.h:3974
+GL_NUM_LOOPBACK_COMPONENTS_ATI = 35188 # GL/glext.h:3975
+GL_COLOR_ALPHA_PAIRING_ATI = 35189 # GL/glext.h:3976
+GL_SWIZZLE_STR_ATI = 35190 # GL/glext.h:3977
+GL_SWIZZLE_STQ_ATI = 35191 # GL/glext.h:3978
+GL_SWIZZLE_STR_DR_ATI = 35192 # GL/glext.h:3979
+GL_SWIZZLE_STQ_DQ_ATI = 35193 # GL/glext.h:3980
+GL_SWIZZLE_STRQ_ATI = 35194 # GL/glext.h:3981
+GL_SWIZZLE_STRQ_DQ_ATI = 35195 # GL/glext.h:3982
+GL_RED_BIT_ATI = 1 # GL/glext.h:3983
+GL_GREEN_BIT_ATI = 2 # GL/glext.h:3984
+GL_BLUE_BIT_ATI = 4 # GL/glext.h:3985
+GL_2X_BIT_ATI = 1 # GL/glext.h:3986
+GL_4X_BIT_ATI = 2 # GL/glext.h:3987
+GL_8X_BIT_ATI = 4 # GL/glext.h:3988
+GL_HALF_BIT_ATI = 8 # GL/glext.h:3989
+GL_QUARTER_BIT_ATI = 16 # GL/glext.h:3990
+GL_EIGHTH_BIT_ATI = 32 # GL/glext.h:3991
+GL_SATURATE_BIT_ATI = 64 # GL/glext.h:3992
+GL_COMP_BIT_ATI = 2 # GL/glext.h:3993
+GL_NEGATE_BIT_ATI = 4 # GL/glext.h:3994
+GL_BIAS_BIT_ATI = 8 # GL/glext.h:3995
+# ATI_pn_triangles (GL/glext.h:3998)
+GL_PN_TRIANGLES_ATI = 34800 # GL/glext.h:3999
+GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI = 34801 # GL/glext.h:4000
+GL_PN_TRIANGLES_POINT_MODE_ATI = 34802 # GL/glext.h:4001
+GL_PN_TRIANGLES_NORMAL_MODE_ATI = 34803 # GL/glext.h:4002
+GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI = 34804 # GL/glext.h:4003
+GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI = 34805 # GL/glext.h:4004
+GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI = 34806 # GL/glext.h:4005
+GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI = 34807 # GL/glext.h:4006
+GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI = 34808 # GL/glext.h:4007
+# ATI_vertex_array_object (GL/glext.h:4010)
+GL_STATIC_ATI = 34656 # GL/glext.h:4011
+GL_DYNAMIC_ATI = 34657 # GL/glext.h:4012
+GL_PRESERVE_ATI = 34658 # GL/glext.h:4013
+GL_DISCARD_ATI = 34659 # GL/glext.h:4014
+GL_OBJECT_BUFFER_SIZE_ATI = 34660 # GL/glext.h:4015
+GL_OBJECT_BUFFER_USAGE_ATI = 34661 # GL/glext.h:4016
+GL_ARRAY_OBJECT_BUFFER_ATI = 34662 # GL/glext.h:4017
+GL_ARRAY_OBJECT_OFFSET_ATI = 34663 # GL/glext.h:4018
+# EXT_vertex_shader (GL/glext.h:4021)
+GL_VERTEX_SHADER_EXT = 34688 # GL/glext.h:4022
+GL_VERTEX_SHADER_BINDING_EXT = 34689 # GL/glext.h:4023
+GL_OP_INDEX_EXT = 34690 # GL/glext.h:4024
+GL_OP_NEGATE_EXT = 34691 # GL/glext.h:4025
+GL_OP_DOT3_EXT = 34692 # GL/glext.h:4026
+GL_OP_DOT4_EXT = 34693 # GL/glext.h:4027
+GL_OP_MUL_EXT = 34694 # GL/glext.h:4028
+GL_OP_ADD_EXT = 34695 # GL/glext.h:4029
+GL_OP_MADD_EXT = 34696 # GL/glext.h:4030
+GL_OP_FRAC_EXT = 34697 # GL/glext.h:4031
+GL_OP_MAX_EXT = 34698 # GL/glext.h:4032
+GL_OP_MIN_EXT = 34699 # GL/glext.h:4033
+GL_OP_SET_GE_EXT = 34700 # GL/glext.h:4034
+GL_OP_SET_LT_EXT = 34701 # GL/glext.h:4035
+GL_OP_CLAMP_EXT = 34702 # GL/glext.h:4036
+GL_OP_FLOOR_EXT = 34703 # GL/glext.h:4037
+GL_OP_ROUND_EXT = 34704 # GL/glext.h:4038
+GL_OP_EXP_BASE_2_EXT = 34705 # GL/glext.h:4039
+GL_OP_LOG_BASE_2_EXT = 34706 # GL/glext.h:4040
+GL_OP_POWER_EXT = 34707 # GL/glext.h:4041
+GL_OP_RECIP_EXT = 34708 # GL/glext.h:4042
+GL_OP_RECIP_SQRT_EXT = 34709 # GL/glext.h:4043
+GL_OP_SUB_EXT = 34710 # GL/glext.h:4044
+GL_OP_CROSS_PRODUCT_EXT = 34711 # GL/glext.h:4045
+GL_OP_MULTIPLY_MATRIX_EXT = 34712 # GL/glext.h:4046
+GL_OP_MOV_EXT = 34713 # GL/glext.h:4047
+GL_OUTPUT_VERTEX_EXT = 34714 # GL/glext.h:4048
+GL_OUTPUT_COLOR0_EXT = 34715 # GL/glext.h:4049
+GL_OUTPUT_COLOR1_EXT = 34716 # GL/glext.h:4050
+GL_OUTPUT_TEXTURE_COORD0_EXT = 34717 # GL/glext.h:4051
+GL_OUTPUT_TEXTURE_COORD1_EXT = 34718 # GL/glext.h:4052
+GL_OUTPUT_TEXTURE_COORD2_EXT = 34719 # GL/glext.h:4053
+GL_OUTPUT_TEXTURE_COORD3_EXT = 34720 # GL/glext.h:4054
+GL_OUTPUT_TEXTURE_COORD4_EXT = 34721 # GL/glext.h:4055
+GL_OUTPUT_TEXTURE_COORD5_EXT = 34722 # GL/glext.h:4056
+GL_OUTPUT_TEXTURE_COORD6_EXT = 34723 # GL/glext.h:4057
+GL_OUTPUT_TEXTURE_COORD7_EXT = 34724 # GL/glext.h:4058
+GL_OUTPUT_TEXTURE_COORD8_EXT = 34725 # GL/glext.h:4059
+GL_OUTPUT_TEXTURE_COORD9_EXT = 34726 # GL/glext.h:4060
+GL_OUTPUT_TEXTURE_COORD10_EXT = 34727 # GL/glext.h:4061
+GL_OUTPUT_TEXTURE_COORD11_EXT = 34728 # GL/glext.h:4062
+GL_OUTPUT_TEXTURE_COORD12_EXT = 34729 # GL/glext.h:4063
+GL_OUTPUT_TEXTURE_COORD13_EXT = 34730 # GL/glext.h:4064
+GL_OUTPUT_TEXTURE_COORD14_EXT = 34731 # GL/glext.h:4065
+GL_OUTPUT_TEXTURE_COORD15_EXT = 34732 # GL/glext.h:4066
+GL_OUTPUT_TEXTURE_COORD16_EXT = 34733 # GL/glext.h:4067
+GL_OUTPUT_TEXTURE_COORD17_EXT = 34734 # GL/glext.h:4068
+GL_OUTPUT_TEXTURE_COORD18_EXT = 34735 # GL/glext.h:4069
+GL_OUTPUT_TEXTURE_COORD19_EXT = 34736 # GL/glext.h:4070
+GL_OUTPUT_TEXTURE_COORD20_EXT = 34737 # GL/glext.h:4071
+GL_OUTPUT_TEXTURE_COORD21_EXT = 34738 # GL/glext.h:4072
+GL_OUTPUT_TEXTURE_COORD22_EXT = 34739 # GL/glext.h:4073
+GL_OUTPUT_TEXTURE_COORD23_EXT = 34740 # GL/glext.h:4074
+GL_OUTPUT_TEXTURE_COORD24_EXT = 34741 # GL/glext.h:4075
+GL_OUTPUT_TEXTURE_COORD25_EXT = 34742 # GL/glext.h:4076
+GL_OUTPUT_TEXTURE_COORD26_EXT = 34743 # GL/glext.h:4077
+GL_OUTPUT_TEXTURE_COORD27_EXT = 34744 # GL/glext.h:4078
+GL_OUTPUT_TEXTURE_COORD28_EXT = 34745 # GL/glext.h:4079
+GL_OUTPUT_TEXTURE_COORD29_EXT = 34746 # GL/glext.h:4080
+GL_OUTPUT_TEXTURE_COORD30_EXT = 34747 # GL/glext.h:4081
+GL_OUTPUT_TEXTURE_COORD31_EXT = 34748 # GL/glext.h:4082
+GL_OUTPUT_FOG_EXT = 34749 # GL/glext.h:4083
+GL_SCALAR_EXT = 34750 # GL/glext.h:4084
+GL_VECTOR_EXT = 34751 # GL/glext.h:4085
+GL_MATRIX_EXT = 34752 # GL/glext.h:4086
+GL_VARIANT_EXT = 34753 # GL/glext.h:4087
+GL_INVARIANT_EXT = 34754 # GL/glext.h:4088
+GL_LOCAL_CONSTANT_EXT = 34755 # GL/glext.h:4089
+GL_LOCAL_EXT = 34756 # GL/glext.h:4090
+GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT = 34757 # GL/glext.h:4091
+GL_MAX_VERTEX_SHADER_VARIANTS_EXT = 34758 # GL/glext.h:4092
+GL_MAX_VERTEX_SHADER_INVARIANTS_EXT = 34759 # GL/glext.h:4093
+GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = 34760 # GL/glext.h:4094
+GL_MAX_VERTEX_SHADER_LOCALS_EXT = 34761 # GL/glext.h:4095
+GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT = 34762 # GL/glext.h:4096
+GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT = 34763 # GL/glext.h:4097
+GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = 34764 # GL/glext.h:4098
+GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT = 34765 # GL/glext.h:4099
+GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT = 34766 # GL/glext.h:4100
+GL_VERTEX_SHADER_INSTRUCTIONS_EXT = 34767 # GL/glext.h:4101
+GL_VERTEX_SHADER_VARIANTS_EXT = 34768 # GL/glext.h:4102
+GL_VERTEX_SHADER_INVARIANTS_EXT = 34769 # GL/glext.h:4103
+GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = 34770 # GL/glext.h:4104
+GL_VERTEX_SHADER_LOCALS_EXT = 34771 # GL/glext.h:4105
+GL_VERTEX_SHADER_OPTIMIZED_EXT = 34772 # GL/glext.h:4106
+GL_X_EXT = 34773 # GL/glext.h:4107
+GL_Y_EXT = 34774 # GL/glext.h:4108
+GL_Z_EXT = 34775 # GL/glext.h:4109
+GL_W_EXT = 34776 # GL/glext.h:4110
+GL_NEGATIVE_X_EXT = 34777 # GL/glext.h:4111
+GL_NEGATIVE_Y_EXT = 34778 # GL/glext.h:4112
+GL_NEGATIVE_Z_EXT = 34779 # GL/glext.h:4113
+GL_NEGATIVE_W_EXT = 34780 # GL/glext.h:4114
+GL_ZERO_EXT = 34781 # GL/glext.h:4115
+GL_ONE_EXT = 34782 # GL/glext.h:4116
+GL_NEGATIVE_ONE_EXT = 34783 # GL/glext.h:4117
+GL_NORMALIZED_RANGE_EXT = 34784 # GL/glext.h:4118
+GL_FULL_RANGE_EXT = 34785 # GL/glext.h:4119
+GL_CURRENT_VERTEX_EXT = 34786 # GL/glext.h:4120
+GL_MVP_MATRIX_EXT = 34787 # GL/glext.h:4121
+GL_VARIANT_VALUE_EXT = 34788 # GL/glext.h:4122
+GL_VARIANT_DATATYPE_EXT = 34789 # GL/glext.h:4123
+GL_VARIANT_ARRAY_STRIDE_EXT = 34790 # GL/glext.h:4124
+GL_VARIANT_ARRAY_TYPE_EXT = 34791 # GL/glext.h:4125
+GL_VARIANT_ARRAY_EXT = 34792 # GL/glext.h:4126
+GL_VARIANT_ARRAY_POINTER_EXT = 34793 # GL/glext.h:4127
+GL_INVARIANT_VALUE_EXT = 34794 # GL/glext.h:4128
+GL_INVARIANT_DATATYPE_EXT = 34795 # GL/glext.h:4129
+GL_LOCAL_CONSTANT_VALUE_EXT = 34796 # GL/glext.h:4130
+GL_LOCAL_CONSTANT_DATATYPE_EXT = 34797 # GL/glext.h:4131
+# ATI_vertex_streams (GL/glext.h:4134)
+GL_MAX_VERTEX_STREAMS_ATI = 34667 # GL/glext.h:4135
+GL_VERTEX_STREAM0_ATI = 34668 # GL/glext.h:4136
+GL_VERTEX_STREAM1_ATI = 34669 # GL/glext.h:4137
+GL_VERTEX_STREAM2_ATI = 34670 # GL/glext.h:4138
+GL_VERTEX_STREAM3_ATI = 34671 # GL/glext.h:4139
+GL_VERTEX_STREAM4_ATI = 34672 # GL/glext.h:4140
+GL_VERTEX_STREAM5_ATI = 34673 # GL/glext.h:4141
+GL_VERTEX_STREAM6_ATI = 34674 # GL/glext.h:4142
+GL_VERTEX_STREAM7_ATI = 34675 # GL/glext.h:4143
+GL_VERTEX_SOURCE_ATI = 34676 # GL/glext.h:4144
+# ATI_element_array (GL/glext.h:4147)
+GL_ELEMENT_ARRAY_ATI = 34664 # GL/glext.h:4148
+GL_ELEMENT_ARRAY_TYPE_ATI = 34665 # GL/glext.h:4149
+GL_ELEMENT_ARRAY_POINTER_ATI = 34666 # GL/glext.h:4150
+# SUN_mesh_array (GL/glext.h:4153)
+GL_QUAD_MESH_SUN = 34324 # GL/glext.h:4154
+GL_TRIANGLE_MESH_SUN = 34325 # GL/glext.h:4155
+# SUN_slice_accum (GL/glext.h:4158)
+GL_SLICE_ACCUM_SUN = 34252 # GL/glext.h:4159
+# NV_multisample_filter_hint (GL/glext.h:4162)
+GL_MULTISAMPLE_FILTER_HINT_NV = 34100 # GL/glext.h:4163
+# NV_depth_clamp (GL/glext.h:4166)
+GL_DEPTH_CLAMP_NV = 34383 # GL/glext.h:4167
+# NV_occlusion_query (GL/glext.h:4170)
+GL_PIXEL_COUNTER_BITS_NV = 34916 # GL/glext.h:4171
+GL_CURRENT_OCCLUSION_QUERY_ID_NV = 34917 # GL/glext.h:4172
+GL_PIXEL_COUNT_NV = 34918 # GL/glext.h:4173
+GL_PIXEL_COUNT_AVAILABLE_NV = 34919 # GL/glext.h:4174
+# NV_point_sprite (GL/glext.h:4177)
+GL_POINT_SPRITE_NV = 34913 # GL/glext.h:4178
+GL_COORD_REPLACE_NV = 34914 # GL/glext.h:4179
+GL_POINT_SPRITE_R_MODE_NV = 34915 # GL/glext.h:4180
+# NV_texture_shader3 (GL/glext.h:4183)
+GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV = 34896 # GL/glext.h:4184
+GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV = 34897 # GL/glext.h:4185
+GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV = 34898 # GL/glext.h:4186
+GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV = 34899 # GL/glext.h:4187
+GL_OFFSET_HILO_TEXTURE_2D_NV = 34900 # GL/glext.h:4188
+GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV = 34901 # GL/glext.h:4189
+GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV = 34902 # GL/glext.h:4190
+GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV = 34903 # GL/glext.h:4191
+GL_DEPENDENT_HILO_TEXTURE_2D_NV = 34904 # GL/glext.h:4192
+GL_DEPENDENT_RGB_TEXTURE_3D_NV = 34905 # GL/glext.h:4193
+GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV = 34906 # GL/glext.h:4194
+GL_DOT_PRODUCT_PASS_THROUGH_NV = 34907 # GL/glext.h:4195
+GL_DOT_PRODUCT_TEXTURE_1D_NV = 34908 # GL/glext.h:4196
+GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV = 34909 # GL/glext.h:4197
+GL_HILO8_NV = 34910 # GL/glext.h:4198
+GL_SIGNED_HILO8_NV = 34911 # GL/glext.h:4199
+GL_FORCE_BLUE_TO_ONE_NV = 34912 # GL/glext.h:4200
+# NV_vertex_program1_1 (GL/glext.h:4203)
+# EXT_shadow_funcs (GL/glext.h:4206)
+# EXT_stencil_two_side (GL/glext.h:4209)
+GL_STENCIL_TEST_TWO_SIDE_EXT = 35088 # GL/glext.h:4210
+GL_ACTIVE_STENCIL_FACE_EXT = 35089 # GL/glext.h:4211
+# ATI_text_fragment_shader (GL/glext.h:4214)
+GL_TEXT_FRAGMENT_SHADER_ATI = 33280 # GL/glext.h:4215
+# APPLE_client_storage (GL/glext.h:4218)
+GL_UNPACK_CLIENT_STORAGE_APPLE = 34226 # GL/glext.h:4219
+# APPLE_element_array (GL/glext.h:4222)
+GL_ELEMENT_ARRAY_APPLE = 35340 # GL/glext.h:4223
+GL_ELEMENT_ARRAY_TYPE_APPLE = 35341 # GL/glext.h:4224
+GL_ELEMENT_ARRAY_POINTER_APPLE = 35342 # GL/glext.h:4225
+# APPLE_fence (GL/glext.h:4228)
+GL_DRAW_PIXELS_APPLE = 35338 # GL/glext.h:4229
+GL_FENCE_APPLE = 35339 # GL/glext.h:4230
+# APPLE_vertex_array_object (GL/glext.h:4233)
+GL_VERTEX_ARRAY_BINDING_APPLE = 34229 # GL/glext.h:4234
+# APPLE_vertex_array_range (GL/glext.h:4237)
+GL_VERTEX_ARRAY_RANGE_APPLE = 34077 # GL/glext.h:4238
+GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE = 34078 # GL/glext.h:4239
+GL_VERTEX_ARRAY_STORAGE_HINT_APPLE = 34079 # GL/glext.h:4240
+GL_VERTEX_ARRAY_RANGE_POINTER_APPLE = 34081 # GL/glext.h:4241
+GL_STORAGE_CLIENT_APPLE = 34228 # GL/glext.h:4242
+GL_STORAGE_CACHED_APPLE = 34238 # GL/glext.h:4243
+GL_STORAGE_SHARED_APPLE = 34239 # GL/glext.h:4244
+# APPLE_ycbcr_422 (GL/glext.h:4247)
+GL_YCBCR_422_APPLE = 34233 # GL/glext.h:4248
+GL_UNSIGNED_SHORT_8_8_APPLE = 34234 # GL/glext.h:4249
+GL_UNSIGNED_SHORT_8_8_REV_APPLE = 34235 # GL/glext.h:4250
+# S3_s3tc (GL/glext.h:4253)
+GL_RGB_S3TC = 33696 # GL/glext.h:4254
+GL_RGB4_S3TC = 33697 # GL/glext.h:4255
+GL_RGBA_S3TC = 33698 # GL/glext.h:4256
+GL_RGBA4_S3TC = 33699 # GL/glext.h:4257
+# ATI_draw_buffers (GL/glext.h:4260)
+GL_MAX_DRAW_BUFFERS_ATI = 34852 # GL/glext.h:4261
+GL_DRAW_BUFFER0_ATI = 34853 # GL/glext.h:4262
+GL_DRAW_BUFFER1_ATI = 34854 # GL/glext.h:4263
+GL_DRAW_BUFFER2_ATI = 34855 # GL/glext.h:4264
+GL_DRAW_BUFFER3_ATI = 34856 # GL/glext.h:4265
+GL_DRAW_BUFFER4_ATI = 34857 # GL/glext.h:4266
+GL_DRAW_BUFFER5_ATI = 34858 # GL/glext.h:4267
+GL_DRAW_BUFFER6_ATI = 34859 # GL/glext.h:4268
+GL_DRAW_BUFFER7_ATI = 34860 # GL/glext.h:4269
+GL_DRAW_BUFFER8_ATI = 34861 # GL/glext.h:4270
+GL_DRAW_BUFFER9_ATI = 34862 # GL/glext.h:4271
+GL_DRAW_BUFFER10_ATI = 34863 # GL/glext.h:4272
+GL_DRAW_BUFFER11_ATI = 34864 # GL/glext.h:4273
+GL_DRAW_BUFFER12_ATI = 34865 # GL/glext.h:4274
+GL_DRAW_BUFFER13_ATI = 34866 # GL/glext.h:4275
+GL_DRAW_BUFFER14_ATI = 34867 # GL/glext.h:4276
+GL_DRAW_BUFFER15_ATI = 34868 # GL/glext.h:4277
+# ATI_pixel_format_float (GL/glext.h:4280)
+GL_TYPE_RGBA_FLOAT_ATI = 34848 # GL/glext.h:4281
+GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI = 34869 # GL/glext.h:4282
+# ATI_texture_env_combine3 (GL/glext.h:4285)
+GL_MODULATE_ADD_ATI = 34628 # GL/glext.h:4286
+GL_MODULATE_SIGNED_ADD_ATI = 34629 # GL/glext.h:4287
+GL_MODULATE_SUBTRACT_ATI = 34630 # GL/glext.h:4288
+# ATI_texture_float (GL/glext.h:4291)
+GL_RGBA_FLOAT32_ATI = 34836 # GL/glext.h:4292
+GL_RGB_FLOAT32_ATI = 34837 # GL/glext.h:4293
+GL_ALPHA_FLOAT32_ATI = 34838 # GL/glext.h:4294
+GL_INTENSITY_FLOAT32_ATI = 34839 # GL/glext.h:4295
+GL_LUMINANCE_FLOAT32_ATI = 34840 # GL/glext.h:4296
+GL_LUMINANCE_ALPHA_FLOAT32_ATI = 34841 # GL/glext.h:4297
+GL_RGBA_FLOAT16_ATI = 34842 # GL/glext.h:4298
+GL_RGB_FLOAT16_ATI = 34843 # GL/glext.h:4299
+GL_ALPHA_FLOAT16_ATI = 34844 # GL/glext.h:4300
+GL_INTENSITY_FLOAT16_ATI = 34845 # GL/glext.h:4301
+GL_LUMINANCE_FLOAT16_ATI = 34846 # GL/glext.h:4302
+GL_LUMINANCE_ALPHA_FLOAT16_ATI = 34847 # GL/glext.h:4303
+# NV_float_buffer (GL/glext.h:4306)
+GL_FLOAT_R_NV = 34944 # GL/glext.h:4307
+GL_FLOAT_RG_NV = 34945 # GL/glext.h:4308
+GL_FLOAT_RGB_NV = 34946 # GL/glext.h:4309
+GL_FLOAT_RGBA_NV = 34947 # GL/glext.h:4310
+GL_FLOAT_R16_NV = 34948 # GL/glext.h:4311
+GL_FLOAT_R32_NV = 34949 # GL/glext.h:4312
+GL_FLOAT_RG16_NV = 34950 # GL/glext.h:4313
+GL_FLOAT_RG32_NV = 34951 # GL/glext.h:4314
+GL_FLOAT_RGB16_NV = 34952 # GL/glext.h:4315
+GL_FLOAT_RGB32_NV = 34953 # GL/glext.h:4316
+GL_FLOAT_RGBA16_NV = 34954 # GL/glext.h:4317
+GL_FLOAT_RGBA32_NV = 34955 # GL/glext.h:4318
+GL_TEXTURE_FLOAT_COMPONENTS_NV = 34956 # GL/glext.h:4319
+GL_FLOAT_CLEAR_COLOR_VALUE_NV = 34957 # GL/glext.h:4320
+GL_FLOAT_RGBA_MODE_NV = 34958 # GL/glext.h:4321
+# NV_fragment_program (GL/glext.h:4324)
+GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV = 34920 # GL/glext.h:4325
+GL_FRAGMENT_PROGRAM_NV = 34928 # GL/glext.h:4326
+GL_MAX_TEXTURE_COORDS_NV = 34929 # GL/glext.h:4327
+GL_MAX_TEXTURE_IMAGE_UNITS_NV = 34930 # GL/glext.h:4328
+GL_FRAGMENT_PROGRAM_BINDING_NV = 34931 # GL/glext.h:4329
+GL_PROGRAM_ERROR_STRING_NV = 34932 # GL/glext.h:4330
+# NV_half_float (GL/glext.h:4333)
+GL_HALF_FLOAT_NV = 5131 # GL/glext.h:4334
+# NV_pixel_data_range (GL/glext.h:4337)
+GL_WRITE_PIXEL_DATA_RANGE_NV = 34936 # GL/glext.h:4338
+GL_READ_PIXEL_DATA_RANGE_NV = 34937 # GL/glext.h:4339
+GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV = 34938 # GL/glext.h:4340
+GL_READ_PIXEL_DATA_RANGE_LENGTH_NV = 34939 # GL/glext.h:4341
+GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV = 34940 # GL/glext.h:4342
+GL_READ_PIXEL_DATA_RANGE_POINTER_NV = 34941 # GL/glext.h:4343
+# NV_primitive_restart (GL/glext.h:4346)
+GL_PRIMITIVE_RESTART_NV = 34136 # GL/glext.h:4347
+GL_PRIMITIVE_RESTART_INDEX_NV = 34137 # GL/glext.h:4348
+# NV_texture_expand_normal (GL/glext.h:4351)
+GL_TEXTURE_UNSIGNED_REMAP_MODE_NV = 34959 # GL/glext.h:4352
+# NV_vertex_program2 (GL/glext.h:4355)
+# ATI_map_object_buffer (GL/glext.h:4358)
+# ATI_separate_stencil (GL/glext.h:4361)
+GL_STENCIL_BACK_FUNC_ATI = 34816 # GL/glext.h:4362
+GL_STENCIL_BACK_FAIL_ATI = 34817 # GL/glext.h:4363
+GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI = 34818 # GL/glext.h:4364
+GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI = 34819 # GL/glext.h:4365
+# ATI_vertex_attrib_array_object (GL/glext.h:4368)
+# OES_read_format (GL/glext.h:4371)
+GL_IMPLEMENTATION_COLOR_READ_TYPE_OES = 35738 # GL/glext.h:4372
+GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES = 35739 # GL/glext.h:4373
+# EXT_depth_bounds_test (GL/glext.h:4376)
+GL_DEPTH_BOUNDS_TEST_EXT = 34960 # GL/glext.h:4377
+GL_DEPTH_BOUNDS_EXT = 34961 # GL/glext.h:4378
+# EXT_texture_mirror_clamp (GL/glext.h:4381)
+GL_MIRROR_CLAMP_EXT = 34626 # GL/glext.h:4382
+GL_MIRROR_CLAMP_TO_EDGE_EXT = 34627 # GL/glext.h:4383
+GL_MIRROR_CLAMP_TO_BORDER_EXT = 35090 # GL/glext.h:4384
+# EXT_blend_equation_separate (GL/glext.h:4387)
+GL_BLEND_EQUATION_RGB_EXT = 32777 # GL/glext.h:4388
+GL_BLEND_EQUATION_ALPHA_EXT = 34877 # GL/glext.h:4389
+# MESA_pack_invert (GL/glext.h:4392)
+GL_PACK_INVERT_MESA = 34648 # GL/glext.h:4393
+# MESA_ycbcr_texture (GL/glext.h:4396)
+GL_UNSIGNED_SHORT_8_8_MESA = 34234 # GL/glext.h:4397
+GL_UNSIGNED_SHORT_8_8_REV_MESA = 34235 # GL/glext.h:4398
+GL_YCBCR_MESA = 34647 # GL/glext.h:4399
+# EXT_pixel_buffer_object (GL/glext.h:4402)
+GL_PIXEL_PACK_BUFFER_EXT = 35051 # GL/glext.h:4403
+GL_PIXEL_UNPACK_BUFFER_EXT = 35052 # GL/glext.h:4404
+GL_PIXEL_PACK_BUFFER_BINDING_EXT = 35053 # GL/glext.h:4405
+GL_PIXEL_UNPACK_BUFFER_BINDING_EXT = 35055 # GL/glext.h:4406
+# NV_fragment_program_option (GL/glext.h:4409)
+# NV_fragment_program2 (GL/glext.h:4412)
+GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV = 35060 # GL/glext.h:4413
+GL_MAX_PROGRAM_CALL_DEPTH_NV = 35061 # GL/glext.h:4414
+GL_MAX_PROGRAM_IF_DEPTH_NV = 35062 # GL/glext.h:4415
+GL_MAX_PROGRAM_LOOP_DEPTH_NV = 35063 # GL/glext.h:4416
+GL_MAX_PROGRAM_LOOP_COUNT_NV = 35064 # GL/glext.h:4417
+# NV_vertex_program2_option (GL/glext.h:4420)
+# NV_vertex_program3 (GL/glext.h:4425)
+# EXT_framebuffer_object (GL/glext.h:4429)
+GL_INVALID_FRAMEBUFFER_OPERATION_EXT = 1286 # GL/glext.h:4430
+GL_MAX_RENDERBUFFER_SIZE_EXT = 34024 # GL/glext.h:4431
+GL_FRAMEBUFFER_BINDING_EXT = 36006 # GL/glext.h:4432
+GL_RENDERBUFFER_BINDING_EXT = 36007 # GL/glext.h:4433
+GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT = 36048 # GL/glext.h:4434
+GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT = 36049 # GL/glext.h:4435
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT = 36050 # GL/glext.h:4436
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT = 36051 # GL/glext.h:4437
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT = 36052 # GL/glext.h:4438
+GL_FRAMEBUFFER_COMPLETE_EXT = 36053 # GL/glext.h:4439
+GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT = 36054 # GL/glext.h:4440
+GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT = 36055 # GL/glext.h:4441
+GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT = 36057 # GL/glext.h:4442
+GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT = 36058 # GL/glext.h:4443
+GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT = 36059 # GL/glext.h:4444
+GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT = 36060 # GL/glext.h:4445
+GL_FRAMEBUFFER_UNSUPPORTED_EXT = 36061 # GL/glext.h:4446
+GL_MAX_COLOR_ATTACHMENTS_EXT = 36063 # GL/glext.h:4447
+GL_COLOR_ATTACHMENT0_EXT = 36064 # GL/glext.h:4448
+GL_COLOR_ATTACHMENT1_EXT = 36065 # GL/glext.h:4449
+GL_COLOR_ATTACHMENT2_EXT = 36066 # GL/glext.h:4450
+GL_COLOR_ATTACHMENT3_EXT = 36067 # GL/glext.h:4451
+GL_COLOR_ATTACHMENT4_EXT = 36068 # GL/glext.h:4452
+GL_COLOR_ATTACHMENT5_EXT = 36069 # GL/glext.h:4453
+GL_COLOR_ATTACHMENT6_EXT = 36070 # GL/glext.h:4454
+GL_COLOR_ATTACHMENT7_EXT = 36071 # GL/glext.h:4455
+GL_COLOR_ATTACHMENT8_EXT = 36072 # GL/glext.h:4456
+GL_COLOR_ATTACHMENT9_EXT = 36073 # GL/glext.h:4457
+GL_COLOR_ATTACHMENT10_EXT = 36074 # GL/glext.h:4458
+GL_COLOR_ATTACHMENT11_EXT = 36075 # GL/glext.h:4459
+GL_COLOR_ATTACHMENT12_EXT = 36076 # GL/glext.h:4460
+GL_COLOR_ATTACHMENT13_EXT = 36077 # GL/glext.h:4461
+GL_COLOR_ATTACHMENT14_EXT = 36078 # GL/glext.h:4462
+GL_COLOR_ATTACHMENT15_EXT = 36079 # GL/glext.h:4463
+GL_DEPTH_ATTACHMENT_EXT = 36096 # GL/glext.h:4464
+GL_STENCIL_ATTACHMENT_EXT = 36128 # GL/glext.h:4465
+GL_FRAMEBUFFER_EXT = 36160 # GL/glext.h:4466
+GL_RENDERBUFFER_EXT = 36161 # GL/glext.h:4467
+GL_RENDERBUFFER_WIDTH_EXT = 36162 # GL/glext.h:4468
+GL_RENDERBUFFER_HEIGHT_EXT = 36163 # GL/glext.h:4469
+GL_RENDERBUFFER_INTERNAL_FORMAT_EXT = 36164 # GL/glext.h:4470
+GL_STENCIL_INDEX1_EXT = 36166 # GL/glext.h:4471
+GL_STENCIL_INDEX4_EXT = 36167 # GL/glext.h:4472
+GL_STENCIL_INDEX8_EXT = 36168 # GL/glext.h:4473
+GL_STENCIL_INDEX16_EXT = 36169 # GL/glext.h:4474
+GL_RENDERBUFFER_RED_SIZE_EXT = 36176 # GL/glext.h:4475
+GL_RENDERBUFFER_GREEN_SIZE_EXT = 36177 # GL/glext.h:4476
+GL_RENDERBUFFER_BLUE_SIZE_EXT = 36178 # GL/glext.h:4477
+GL_RENDERBUFFER_ALPHA_SIZE_EXT = 36179 # GL/glext.h:4478
+GL_RENDERBUFFER_DEPTH_SIZE_EXT = 36180 # GL/glext.h:4479
+GL_RENDERBUFFER_STENCIL_SIZE_EXT = 36181 # GL/glext.h:4480
+# GREMEDY_string_marker (GL/glext.h:4483)
+# EXT_packed_depth_stencil (GL/glext.h:4486)
+GL_DEPTH_STENCIL_EXT = 34041 # GL/glext.h:4487
+GL_UNSIGNED_INT_24_8_EXT = 34042 # GL/glext.h:4488
+GL_DEPTH24_STENCIL8_EXT = 35056 # GL/glext.h:4489
+GL_TEXTURE_STENCIL_SIZE_EXT = 35057 # GL/glext.h:4490
+# EXT_stencil_clear_tag (GL/glext.h:4493)
+GL_STENCIL_TAG_BITS_EXT = 35058 # GL/glext.h:4494
+GL_STENCIL_CLEAR_TAG_VALUE_EXT = 35059 # GL/glext.h:4495
+# EXT_texture_sRGB (GL/glext.h:4498)
+GL_SRGB_EXT = 35904 # GL/glext.h:4499
+GL_SRGB8_EXT = 35905 # GL/glext.h:4500
+GL_SRGB_ALPHA_EXT = 35906 # GL/glext.h:4501
+GL_SRGB8_ALPHA8_EXT = 35907 # GL/glext.h:4502
+GL_SLUMINANCE_ALPHA_EXT = 35908 # GL/glext.h:4503
+GL_SLUMINANCE8_ALPHA8_EXT = 35909 # GL/glext.h:4504
+GL_SLUMINANCE_EXT = 35910 # GL/glext.h:4505
+GL_SLUMINANCE8_EXT = 35911 # GL/glext.h:4506
+GL_COMPRESSED_SRGB_EXT = 35912 # GL/glext.h:4507
+GL_COMPRESSED_SRGB_ALPHA_EXT = 35913 # GL/glext.h:4508
+GL_COMPRESSED_SLUMINANCE_EXT = 35914 # GL/glext.h:4509
+GL_COMPRESSED_SLUMINANCE_ALPHA_EXT = 35915 # GL/glext.h:4510
+GL_COMPRESSED_SRGB_S3TC_DXT1_EXT = 35916 # GL/glext.h:4511
+GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 35917 # GL/glext.h:4512
+GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 35918 # GL/glext.h:4513
+GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 35919 # GL/glext.h:4514
+# EXT_framebuffer_blit (GL/glext.h:4517)
+GL_READ_FRAMEBUFFER_EXT = 36008 # GL/glext.h:4518
+GL_DRAW_FRAMEBUFFER_EXT = 36009 # GL/glext.h:4519
+GL_DRAW_FRAMEBUFFER_BINDING_EXT = 36006 # GL/glext.h:4520
+GL_READ_FRAMEBUFFER_BINDING_EXT = 36010 # GL/glext.h:4521
+# EXT_framebuffer_multisample (GL/glext.h:4524)
+GL_RENDERBUFFER_SAMPLES_EXT = 36011 # GL/glext.h:4525
+GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT = 36182 # GL/glext.h:4526
+GL_MAX_SAMPLES_EXT = 36183 # GL/glext.h:4527
+# MESAX_texture_stack (GL/glext.h:4530)
+GL_TEXTURE_1D_STACK_MESAX = 34649 # GL/glext.h:4531
+GL_TEXTURE_2D_STACK_MESAX = 34650 # GL/glext.h:4532
+GL_PROXY_TEXTURE_1D_STACK_MESAX = 34651 # GL/glext.h:4533
+GL_PROXY_TEXTURE_2D_STACK_MESAX = 34652 # GL/glext.h:4534
+GL_TEXTURE_1D_STACK_BINDING_MESAX = 34653 # GL/glext.h:4535
+GL_TEXTURE_2D_STACK_BINDING_MESAX = 34654 # GL/glext.h:4536
+# EXT_timer_query (GL/glext.h:4539)
+GL_TIME_ELAPSED_EXT = 35007 # GL/glext.h:4540
+# EXT_gpu_program_parameters (GL/glext.h:4543)
+# APPLE_flush_buffer_range (GL/glext.h:4546)
+GL_BUFFER_SERIALIZED_MODIFY_APPLE = 35346 # GL/glext.h:4547
+GL_BUFFER_FLUSHING_UNMAP_APPLE = 35347 # GL/glext.h:4548
+# NV_gpu_program4 (GL/glext.h:4551)
+GL_MIN_PROGRAM_TEXEL_OFFSET_NV = 35076 # GL/glext.h:4552
+GL_MAX_PROGRAM_TEXEL_OFFSET_NV = 35077 # GL/glext.h:4553
+GL_PROGRAM_ATTRIB_COMPONENTS_NV = 35078 # GL/glext.h:4554
+GL_PROGRAM_RESULT_COMPONENTS_NV = 35079 # GL/glext.h:4555
+GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV = 35080 # GL/glext.h:4556
+GL_MAX_PROGRAM_RESULT_COMPONENTS_NV = 35081 # GL/glext.h:4557
+GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV = 36261 # GL/glext.h:4558
+GL_MAX_PROGRAM_GENERIC_RESULTS_NV = 36262 # GL/glext.h:4559
+# NV_geometry_program4 (GL/glext.h:4562)
+GL_LINES_ADJACENCY_EXT = 10 # GL/glext.h:4563
+GL_LINE_STRIP_ADJACENCY_EXT = 11 # GL/glext.h:4564
+GL_TRIANGLES_ADJACENCY_EXT = 12 # GL/glext.h:4565
+GL_TRIANGLE_STRIP_ADJACENCY_EXT = 13 # GL/glext.h:4566
+GL_GEOMETRY_PROGRAM_NV = 35878 # GL/glext.h:4567
+GL_MAX_PROGRAM_OUTPUT_VERTICES_NV = 35879 # GL/glext.h:4568
+GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV = 35880 # GL/glext.h:4569
+GL_GEOMETRY_VERTICES_OUT_EXT = 36314 # GL/glext.h:4570
+GL_GEOMETRY_INPUT_TYPE_EXT = 36315 # GL/glext.h:4571
+GL_GEOMETRY_OUTPUT_TYPE_EXT = 36316 # GL/glext.h:4572
+GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT = 35881 # GL/glext.h:4573
+GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT = 36263 # GL/glext.h:4574
+GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT = 36264 # GL/glext.h:4575
+GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT = 36265 # GL/glext.h:4576
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT = 36052 # GL/glext.h:4577
+GL_PROGRAM_POINT_SIZE_EXT = 34370 # GL/glext.h:4578
+# EXT_geometry_shader4 (GL/glext.h:4581)
+GL_GEOMETRY_SHADER_EXT = 36313 # GL/glext.h:4582
+GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT = 36317 # GL/glext.h:4587
+GL_MAX_VERTEX_VARYING_COMPONENTS_EXT = 36318 # GL/glext.h:4588
+GL_MAX_VARYING_COMPONENTS_EXT = 35659 # GL/glext.h:4589
+GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT = 36319 # GL/glext.h:4590
+GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT = 36320 # GL/glext.h:4591
+GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT = 36321 # GL/glext.h:4592
+# NV_vertex_program4 (GL/glext.h:4604)
+GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV = 35069 # GL/glext.h:4605
+# EXT_gpu_shader4 (GL/glext.h:4608)
+GL_SAMPLER_1D_ARRAY_EXT = 36288 # GL/glext.h:4609
+GL_SAMPLER_2D_ARRAY_EXT = 36289 # GL/glext.h:4610
+GL_SAMPLER_BUFFER_EXT = 36290 # GL/glext.h:4611
+GL_SAMPLER_1D_ARRAY_SHADOW_EXT = 36291 # GL/glext.h:4612
+GL_SAMPLER_2D_ARRAY_SHADOW_EXT = 36292 # GL/glext.h:4613
+GL_SAMPLER_CUBE_SHADOW_EXT = 36293 # GL/glext.h:4614
+GL_UNSIGNED_INT_VEC2_EXT = 36294 # GL/glext.h:4615
+GL_UNSIGNED_INT_VEC3_EXT = 36295 # GL/glext.h:4616
+GL_UNSIGNED_INT_VEC4_EXT = 36296 # GL/glext.h:4617
+GL_INT_SAMPLER_1D_EXT = 36297 # GL/glext.h:4618
+GL_INT_SAMPLER_2D_EXT = 36298 # GL/glext.h:4619
+GL_INT_SAMPLER_3D_EXT = 36299 # GL/glext.h:4620
+GL_INT_SAMPLER_CUBE_EXT = 36300 # GL/glext.h:4621
+GL_INT_SAMPLER_2D_RECT_EXT = 36301 # GL/glext.h:4622
+GL_INT_SAMPLER_1D_ARRAY_EXT = 36302 # GL/glext.h:4623
+GL_INT_SAMPLER_2D_ARRAY_EXT = 36303 # GL/glext.h:4624
+GL_INT_SAMPLER_BUFFER_EXT = 36304 # GL/glext.h:4625
+GL_UNSIGNED_INT_SAMPLER_1D_EXT = 36305 # GL/glext.h:4626
+GL_UNSIGNED_INT_SAMPLER_2D_EXT = 36306 # GL/glext.h:4627
+GL_UNSIGNED_INT_SAMPLER_3D_EXT = 36307 # GL/glext.h:4628
+GL_UNSIGNED_INT_SAMPLER_CUBE_EXT = 36308 # GL/glext.h:4629
+GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT = 36309 # GL/glext.h:4630
+GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT = 36310 # GL/glext.h:4631
+GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT = 36311 # GL/glext.h:4632
+GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT = 36312 # GL/glext.h:4633
+# EXT_draw_instanced (GL/glext.h:4636)
+# EXT_packed_float (GL/glext.h:4639)
+GL_R11F_G11F_B10F_EXT = 35898 # GL/glext.h:4640
+GL_UNSIGNED_INT_10F_11F_11F_REV_EXT = 35899 # GL/glext.h:4641
+GL_RGBA_SIGNED_COMPONENTS_EXT = 35900 # GL/glext.h:4642
+# EXT_texture_array (GL/glext.h:4645)
+GL_TEXTURE_1D_ARRAY_EXT = 35864 # GL/glext.h:4646
+GL_PROXY_TEXTURE_1D_ARRAY_EXT = 35865 # GL/glext.h:4647
+GL_TEXTURE_2D_ARRAY_EXT = 35866 # GL/glext.h:4648
+GL_PROXY_TEXTURE_2D_ARRAY_EXT = 35867 # GL/glext.h:4649
+GL_TEXTURE_BINDING_1D_ARRAY_EXT = 35868 # GL/glext.h:4650
+GL_TEXTURE_BINDING_2D_ARRAY_EXT = 35869 # GL/glext.h:4651
+GL_MAX_ARRAY_TEXTURE_LAYERS_EXT = 35071 # GL/glext.h:4652
+GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT = 34894 # GL/glext.h:4653
+# EXT_texture_buffer_object (GL/glext.h:4657)
+GL_TEXTURE_BUFFER_EXT = 35882 # GL/glext.h:4658
+GL_MAX_TEXTURE_BUFFER_SIZE_EXT = 35883 # GL/glext.h:4659
+GL_TEXTURE_BINDING_BUFFER_EXT = 35884 # GL/glext.h:4660
+GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT = 35885 # GL/glext.h:4661
+GL_TEXTURE_BUFFER_FORMAT_EXT = 35886 # GL/glext.h:4662
+# EXT_texture_compression_latc (GL/glext.h:4665)
+GL_COMPRESSED_LUMINANCE_LATC1_EXT = 35952 # GL/glext.h:4666
+GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT = 35953 # GL/glext.h:4667
+GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT = 35954 # GL/glext.h:4668
+GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT = 35955 # GL/glext.h:4669
+# EXT_texture_compression_rgtc (GL/glext.h:4672)
+GL_COMPRESSED_RED_RGTC1_EXT = 36283 # GL/glext.h:4673
+GL_COMPRESSED_SIGNED_RED_RGTC1_EXT = 36284 # GL/glext.h:4674
+GL_COMPRESSED_RED_GREEN_RGTC2_EXT = 36285 # GL/glext.h:4675
+GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 36286 # GL/glext.h:4676
+# EXT_texture_shared_exponent (GL/glext.h:4679)
+GL_RGB9_E5_EXT = 35901 # GL/glext.h:4680
+GL_UNSIGNED_INT_5_9_9_9_REV_EXT = 35902 # GL/glext.h:4681
+GL_TEXTURE_SHARED_SIZE_EXT = 35903 # GL/glext.h:4682
+# NV_depth_buffer_float (GL/glext.h:4685)
+GL_DEPTH_COMPONENT32F_NV = 36267 # GL/glext.h:4686
+GL_DEPTH32F_STENCIL8_NV = 36268 # GL/glext.h:4687
+GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV = 36269 # GL/glext.h:4688
+GL_DEPTH_BUFFER_FLOAT_MODE_NV = 36271 # GL/glext.h:4689
+# NV_fragment_program4 (GL/glext.h:4692)
+# NV_framebuffer_multisample_coverage (GL/glext.h:4695)
+GL_RENDERBUFFER_COVERAGE_SAMPLES_NV = 36011 # GL/glext.h:4696
+GL_RENDERBUFFER_COLOR_SAMPLES_NV = 36368 # GL/glext.h:4697
+GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV = 36369 # GL/glext.h:4698
+GL_MULTISAMPLE_COVERAGE_MODES_NV = 36370 # GL/glext.h:4699
+# EXT_framebuffer_sRGB (GL/glext.h:4702)
+GL_FRAMEBUFFER_SRGB_EXT = 36281 # GL/glext.h:4703
+GL_FRAMEBUFFER_SRGB_CAPABLE_EXT = 36282 # GL/glext.h:4704
+# NV_geometry_shader4 (GL/glext.h:4707)
+# NV_parameter_buffer_object (GL/glext.h:4710)
+GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV = 36256 # GL/glext.h:4711
+GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV = 36257 # GL/glext.h:4712
+GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV = 36258 # GL/glext.h:4713
+GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV = 36259 # GL/glext.h:4714
+GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV = 36260 # GL/glext.h:4715
+# EXT_draw_buffers2 (GL/glext.h:4718)
+# NV_transform_feedback (GL/glext.h:4721)
+GL_BACK_PRIMARY_COLOR_NV = 35959 # GL/glext.h:4722
+GL_BACK_SECONDARY_COLOR_NV = 35960 # GL/glext.h:4723
+GL_TEXTURE_COORD_NV = 35961 # GL/glext.h:4724
+GL_CLIP_DISTANCE_NV = 35962 # GL/glext.h:4725
+GL_VERTEX_ID_NV = 35963 # GL/glext.h:4726
+GL_PRIMITIVE_ID_NV = 35964 # GL/glext.h:4727
+GL_GENERIC_ATTRIB_NV = 35965 # GL/glext.h:4728
+GL_TRANSFORM_FEEDBACK_ATTRIBS_NV = 35966 # GL/glext.h:4729
+GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV = 35967 # GL/glext.h:4730
+GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV = 35968 # GL/glext.h:4731
+GL_ACTIVE_VARYINGS_NV = 35969 # GL/glext.h:4732
+GL_ACTIVE_VARYING_MAX_LENGTH_NV = 35970 # GL/glext.h:4733
+GL_TRANSFORM_FEEDBACK_VARYINGS_NV = 35971 # GL/glext.h:4734
+GL_TRANSFORM_FEEDBACK_BUFFER_START_NV = 35972 # GL/glext.h:4735
+GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV = 35973 # GL/glext.h:4736
+GL_TRANSFORM_FEEDBACK_RECORD_NV = 35974 # GL/glext.h:4737
+GL_PRIMITIVES_GENERATED_NV = 35975 # GL/glext.h:4738
+GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV = 35976 # GL/glext.h:4739
+GL_RASTERIZER_DISCARD_NV = 35977 # GL/glext.h:4740
+GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_ATTRIBS_NV = 35978 # GL/glext.h:4741
+GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV = 35979 # GL/glext.h:4742
+GL_INTERLEAVED_ATTRIBS_NV = 35980 # GL/glext.h:4743
+GL_SEPARATE_ATTRIBS_NV = 35981 # GL/glext.h:4744
+GL_TRANSFORM_FEEDBACK_BUFFER_NV = 35982 # GL/glext.h:4745
+GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV = 35983 # GL/glext.h:4746
+GL_LAYER_NV = 36266 # GL/glext.h:4747
+GL_NEXT_BUFFER_NV = -2 # GL/glext.h:4748
+GL_SKIP_COMPONENTS4_NV = -3 # GL/glext.h:4749
+GL_SKIP_COMPONENTS3_NV = -4 # GL/glext.h:4750
+GL_SKIP_COMPONENTS2_NV = -5 # GL/glext.h:4751
+GL_SKIP_COMPONENTS1_NV = -6 # GL/glext.h:4752
+# EXT_bindable_uniform (GL/glext.h:4755)
+GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT = 36322 # GL/glext.h:4756
+GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT = 36323 # GL/glext.h:4757
+GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT = 36324 # GL/glext.h:4758
+GL_MAX_BINDABLE_UNIFORM_SIZE_EXT = 36333 # GL/glext.h:4759
+GL_UNIFORM_BUFFER_EXT = 36334 # GL/glext.h:4760
+GL_UNIFORM_BUFFER_BINDING_EXT = 36335 # GL/glext.h:4761
+# EXT_texture_integer (GL/glext.h:4764)
+GL_RGBA32UI_EXT = 36208 # GL/glext.h:4765
+GL_RGB32UI_EXT = 36209 # GL/glext.h:4766
+GL_ALPHA32UI_EXT = 36210 # GL/glext.h:4767
+GL_INTENSITY32UI_EXT = 36211 # GL/glext.h:4768
+GL_LUMINANCE32UI_EXT = 36212 # GL/glext.h:4769
+GL_LUMINANCE_ALPHA32UI_EXT = 36213 # GL/glext.h:4770
+GL_RGBA16UI_EXT = 36214 # GL/glext.h:4771
+GL_RGB16UI_EXT = 36215 # GL/glext.h:4772
+GL_ALPHA16UI_EXT = 36216 # GL/glext.h:4773
+GL_INTENSITY16UI_EXT = 36217 # GL/glext.h:4774
+GL_LUMINANCE16UI_EXT = 36218 # GL/glext.h:4775
+GL_LUMINANCE_ALPHA16UI_EXT = 36219 # GL/glext.h:4776
+GL_RGBA8UI_EXT = 36220 # GL/glext.h:4777
+GL_RGB8UI_EXT = 36221 # GL/glext.h:4778
+GL_ALPHA8UI_EXT = 36222 # GL/glext.h:4779
+GL_INTENSITY8UI_EXT = 36223 # GL/glext.h:4780
+GL_LUMINANCE8UI_EXT = 36224 # GL/glext.h:4781
+GL_LUMINANCE_ALPHA8UI_EXT = 36225 # GL/glext.h:4782
+GL_RGBA32I_EXT = 36226 # GL/glext.h:4783
+GL_RGB32I_EXT = 36227 # GL/glext.h:4784
+GL_ALPHA32I_EXT = 36228 # GL/glext.h:4785
+GL_INTENSITY32I_EXT = 36229 # GL/glext.h:4786
+GL_LUMINANCE32I_EXT = 36230 # GL/glext.h:4787
+GL_LUMINANCE_ALPHA32I_EXT = 36231 # GL/glext.h:4788
+GL_RGBA16I_EXT = 36232 # GL/glext.h:4789
+GL_RGB16I_EXT = 36233 # GL/glext.h:4790
+GL_ALPHA16I_EXT = 36234 # GL/glext.h:4791
+GL_INTENSITY16I_EXT = 36235 # GL/glext.h:4792
+GL_LUMINANCE16I_EXT = 36236 # GL/glext.h:4793
+GL_LUMINANCE_ALPHA16I_EXT = 36237 # GL/glext.h:4794
+GL_RGBA8I_EXT = 36238 # GL/glext.h:4795
+GL_RGB8I_EXT = 36239 # GL/glext.h:4796
+GL_ALPHA8I_EXT = 36240 # GL/glext.h:4797
+GL_INTENSITY8I_EXT = 36241 # GL/glext.h:4798
+GL_LUMINANCE8I_EXT = 36242 # GL/glext.h:4799
+GL_LUMINANCE_ALPHA8I_EXT = 36243 # GL/glext.h:4800
+GL_RED_INTEGER_EXT = 36244 # GL/glext.h:4801
+GL_GREEN_INTEGER_EXT = 36245 # GL/glext.h:4802
+GL_BLUE_INTEGER_EXT = 36246 # GL/glext.h:4803
+GL_ALPHA_INTEGER_EXT = 36247 # GL/glext.h:4804
+GL_RGB_INTEGER_EXT = 36248 # GL/glext.h:4805
+GL_RGBA_INTEGER_EXT = 36249 # GL/glext.h:4806
+GL_BGR_INTEGER_EXT = 36250 # GL/glext.h:4807
+GL_BGRA_INTEGER_EXT = 36251 # GL/glext.h:4808
+GL_LUMINANCE_INTEGER_EXT = 36252 # GL/glext.h:4809
+GL_LUMINANCE_ALPHA_INTEGER_EXT = 36253 # GL/glext.h:4810
+GL_RGBA_INTEGER_MODE_EXT = 36254 # GL/glext.h:4811
+# GREMEDY_frame_terminator (GL/glext.h:4814)
+# NV_conditional_render (GL/glext.h:4817)
+GL_QUERY_WAIT_NV = 36371 # GL/glext.h:4818
+GL_QUERY_NO_WAIT_NV = 36372 # GL/glext.h:4819
+GL_QUERY_BY_REGION_WAIT_NV = 36373 # GL/glext.h:4820
+GL_QUERY_BY_REGION_NO_WAIT_NV = 36374 # GL/glext.h:4821
+# NV_present_video (GL/glext.h:4824)
+GL_FRAME_NV = 36390 # GL/glext.h:4825
+GL_FIELDS_NV = 36391 # GL/glext.h:4826
+GL_CURRENT_TIME_NV = 36392 # GL/glext.h:4827
+GL_NUM_FILL_STREAMS_NV = 36393 # GL/glext.h:4828
+GL_PRESENT_TIME_NV = 36394 # GL/glext.h:4829
+GL_PRESENT_DURATION_NV = 36395 # GL/glext.h:4830
+# EXT_transform_feedback (GL/glext.h:4833)
+GL_TRANSFORM_FEEDBACK_BUFFER_EXT = 35982 # GL/glext.h:4834
+GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT = 35972 # GL/glext.h:4835
+GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT = 35973 # GL/glext.h:4836
+GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT = 35983 # GL/glext.h:4837
+GL_INTERLEAVED_ATTRIBS_EXT = 35980 # GL/glext.h:4838
+GL_SEPARATE_ATTRIBS_EXT = 35981 # GL/glext.h:4839
+GL_PRIMITIVES_GENERATED_EXT = 35975 # GL/glext.h:4840
+GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT = 35976 # GL/glext.h:4841
+GL_RASTERIZER_DISCARD_EXT = 35977 # GL/glext.h:4842
+GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT = 35978 # GL/glext.h:4843
+GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT = 35979 # GL/glext.h:4844
+GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT = 35968 # GL/glext.h:4845
+GL_TRANSFORM_FEEDBACK_VARYINGS_EXT = 35971 # GL/glext.h:4846
+GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT = 35967 # GL/glext.h:4847
+GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT = 35958 # GL/glext.h:4848
+# EXT_direct_state_access (GL/glext.h:4851)
+GL_PROGRAM_MATRIX_EXT = 36397 # GL/glext.h:4852
+GL_TRANSPOSE_PROGRAM_MATRIX_EXT = 36398 # GL/glext.h:4853
+GL_PROGRAM_MATRIX_STACK_DEPTH_EXT = 36399 # GL/glext.h:4854
+# EXT_vertex_array_bgra (GL/glext.h:4857)
+# EXT_texture_swizzle (GL/glext.h:4861)
+GL_TEXTURE_SWIZZLE_R_EXT = 36418 # GL/glext.h:4862
+GL_TEXTURE_SWIZZLE_G_EXT = 36419 # GL/glext.h:4863
+GL_TEXTURE_SWIZZLE_B_EXT = 36420 # GL/glext.h:4864
+GL_TEXTURE_SWIZZLE_A_EXT = 36421 # GL/glext.h:4865
+GL_TEXTURE_SWIZZLE_RGBA_EXT = 36422 # GL/glext.h:4866
+# NV_explicit_multisample (GL/glext.h:4869)
+GL_SAMPLE_POSITION_NV = 36432 # GL/glext.h:4870
+GL_SAMPLE_MASK_NV = 36433 # GL/glext.h:4871
+GL_SAMPLE_MASK_VALUE_NV = 36434 # GL/glext.h:4872
+GL_TEXTURE_BINDING_RENDERBUFFER_NV = 36435 # GL/glext.h:4873
+GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV = 36436 # GL/glext.h:4874
+GL_TEXTURE_RENDERBUFFER_NV = 36437 # GL/glext.h:4875
+GL_SAMPLER_RENDERBUFFER_NV = 36438 # GL/glext.h:4876
+GL_INT_SAMPLER_RENDERBUFFER_NV = 36439 # GL/glext.h:4877
+GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV = 36440 # GL/glext.h:4878
+GL_MAX_SAMPLE_MASK_WORDS_NV = 36441 # GL/glext.h:4879
+# NV_transform_feedback2 (GL/glext.h:4882)
+GL_TRANSFORM_FEEDBACK_NV = 36386 # GL/glext.h:4883
+GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV = 36387 # GL/glext.h:4884
+GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV = 36388 # GL/glext.h:4885
+GL_TRANSFORM_FEEDBACK_BINDING_NV = 36389 # GL/glext.h:4886
+# ATI_meminfo (GL/glext.h:4889)
+GL_VBO_FREE_MEMORY_ATI = 34811 # GL/glext.h:4890
+GL_TEXTURE_FREE_MEMORY_ATI = 34812 # GL/glext.h:4891
+GL_RENDERBUFFER_FREE_MEMORY_ATI = 34813 # GL/glext.h:4892
+# AMD_performance_monitor (GL/glext.h:4895)
+GL_COUNTER_TYPE_AMD = 35776 # GL/glext.h:4896
+GL_COUNTER_RANGE_AMD = 35777 # GL/glext.h:4897
+GL_UNSIGNED_INT64_AMD = 35778 # GL/glext.h:4898
+GL_PERCENTAGE_AMD = 35779 # GL/glext.h:4899
+GL_PERFMON_RESULT_AVAILABLE_AMD = 35780 # GL/glext.h:4900
+GL_PERFMON_RESULT_SIZE_AMD = 35781 # GL/glext.h:4901
+GL_PERFMON_RESULT_AMD = 35782 # GL/glext.h:4902
+# AMD_texture_texture4 (GL/glext.h:4905)
+# AMD_vertex_shader_tesselator (GL/glext.h:4908)
+GL_SAMPLER_BUFFER_AMD = 36865 # GL/glext.h:4909
+GL_INT_SAMPLER_BUFFER_AMD = 36866 # GL/glext.h:4910
+GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD = 36867 # GL/glext.h:4911
+GL_TESSELLATION_MODE_AMD = 36868 # GL/glext.h:4912
+GL_TESSELLATION_FACTOR_AMD = 36869 # GL/glext.h:4913
+GL_DISCRETE_AMD = 36870 # GL/glext.h:4914
+GL_CONTINUOUS_AMD = 36871 # GL/glext.h:4915
+# EXT_provoking_vertex (GL/glext.h:4918)
+GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT = 36428 # GL/glext.h:4919
+GL_FIRST_VERTEX_CONVENTION_EXT = 36429 # GL/glext.h:4920
+GL_LAST_VERTEX_CONVENTION_EXT = 36430 # GL/glext.h:4921
+GL_PROVOKING_VERTEX_EXT = 36431 # GL/glext.h:4922
+# EXT_texture_snorm (GL/glext.h:4925)
+GL_ALPHA_SNORM = 36880 # GL/glext.h:4926
+GL_LUMINANCE_SNORM = 36881 # GL/glext.h:4927
+GL_LUMINANCE_ALPHA_SNORM = 36882 # GL/glext.h:4928
+GL_INTENSITY_SNORM = 36883 # GL/glext.h:4929
+GL_ALPHA8_SNORM = 36884 # GL/glext.h:4930
+GL_LUMINANCE8_SNORM = 36885 # GL/glext.h:4931
+GL_LUMINANCE8_ALPHA8_SNORM = 36886 # GL/glext.h:4932
+GL_INTENSITY8_SNORM = 36887 # GL/glext.h:4933
+GL_ALPHA16_SNORM = 36888 # GL/glext.h:4934
+GL_LUMINANCE16_SNORM = 36889 # GL/glext.h:4935
+GL_LUMINANCE16_ALPHA16_SNORM = 36890 # GL/glext.h:4936
+GL_INTENSITY16_SNORM = 36891 # GL/glext.h:4937
+# AMD_draw_buffers_blend (GL/glext.h:4953)
+# APPLE_texture_range (GL/glext.h:4956)
+GL_TEXTURE_RANGE_LENGTH_APPLE = 34231 # GL/glext.h:4957
+GL_TEXTURE_RANGE_POINTER_APPLE = 34232 # GL/glext.h:4958
+GL_TEXTURE_STORAGE_HINT_APPLE = 34236 # GL/glext.h:4959
+GL_STORAGE_PRIVATE_APPLE = 34237 # GL/glext.h:4960
+# APPLE_float_pixels (GL/glext.h:4965)
+GL_HALF_APPLE = 5131 # GL/glext.h:4966
+GL_RGBA_FLOAT32_APPLE = 34836 # GL/glext.h:4967
+GL_RGB_FLOAT32_APPLE = 34837 # GL/glext.h:4968
+GL_ALPHA_FLOAT32_APPLE = 34838 # GL/glext.h:4969
+GL_INTENSITY_FLOAT32_APPLE = 34839 # GL/glext.h:4970
+GL_LUMINANCE_FLOAT32_APPLE = 34840 # GL/glext.h:4971
+GL_LUMINANCE_ALPHA_FLOAT32_APPLE = 34841 # GL/glext.h:4972
+GL_RGBA_FLOAT16_APPLE = 34842 # GL/glext.h:4973
+GL_RGB_FLOAT16_APPLE = 34843 # GL/glext.h:4974
+GL_ALPHA_FLOAT16_APPLE = 34844 # GL/glext.h:4975
+GL_INTENSITY_FLOAT16_APPLE = 34845 # GL/glext.h:4976
+GL_LUMINANCE_FLOAT16_APPLE = 34846 # GL/glext.h:4977
+GL_LUMINANCE_ALPHA_FLOAT16_APPLE = 34847 # GL/glext.h:4978
+GL_COLOR_FLOAT_APPLE = 35343 # GL/glext.h:4979
+# APPLE_vertex_program_evaluators (GL/glext.h:4982)
+GL_VERTEX_ATTRIB_MAP1_APPLE = 35328 # GL/glext.h:4983
+GL_VERTEX_ATTRIB_MAP2_APPLE = 35329 # GL/glext.h:4984
+GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE = 35330 # GL/glext.h:4985
+GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE = 35331 # GL/glext.h:4986
+GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE = 35332 # GL/glext.h:4987
+GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE = 35333 # GL/glext.h:4988
+GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE = 35334 # GL/glext.h:4989
+GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE = 35335 # GL/glext.h:4990
+GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE = 35336 # GL/glext.h:4991
+GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE = 35337 # GL/glext.h:4992
+# APPLE_aux_depth_stencil (GL/glext.h:4995)
+GL_AUX_DEPTH_STENCIL_APPLE = 35348 # GL/glext.h:4996
+# APPLE_object_purgeable (GL/glext.h:4999)
+GL_BUFFER_OBJECT_APPLE = 34227 # GL/glext.h:5000
+GL_RELEASED_APPLE = 35353 # GL/glext.h:5001
+GL_VOLATILE_APPLE = 35354 # GL/glext.h:5002
+GL_RETAINED_APPLE = 35355 # GL/glext.h:5003
+GL_UNDEFINED_APPLE = 35356 # GL/glext.h:5004
+GL_PURGEABLE_APPLE = 35357 # GL/glext.h:5005
+# APPLE_row_bytes (GL/glext.h:5008)
+GL_PACK_ROW_BYTES_APPLE = 35349 # GL/glext.h:5009
+GL_UNPACK_ROW_BYTES_APPLE = 35350 # GL/glext.h:5010
+# APPLE_rgb_422 (GL/glext.h:5013)
+GL_RGB_422_APPLE = 35359 # GL/glext.h:5014
+# NV_video_capture (GL/glext.h:5019)
+GL_VIDEO_BUFFER_NV = 36896 # GL/glext.h:5020
+GL_VIDEO_BUFFER_BINDING_NV = 36897 # GL/glext.h:5021
+GL_FIELD_UPPER_NV = 36898 # GL/glext.h:5022
+GL_FIELD_LOWER_NV = 36899 # GL/glext.h:5023
+GL_NUM_VIDEO_CAPTURE_STREAMS_NV = 36900 # GL/glext.h:5024
+GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV = 36901 # GL/glext.h:5025
+GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV = 36902 # GL/glext.h:5026
+GL_LAST_VIDEO_CAPTURE_STATUS_NV = 36903 # GL/glext.h:5027
+GL_VIDEO_BUFFER_PITCH_NV = 36904 # GL/glext.h:5028
+GL_VIDEO_COLOR_CONVERSION_MATRIX_NV = 36905 # GL/glext.h:5029
+GL_VIDEO_COLOR_CONVERSION_MAX_NV = 36906 # GL/glext.h:5030
+GL_VIDEO_COLOR_CONVERSION_MIN_NV = 36907 # GL/glext.h:5031
+GL_VIDEO_COLOR_CONVERSION_OFFSET_NV = 36908 # GL/glext.h:5032
+GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV = 36909 # GL/glext.h:5033
+GL_PARTIAL_SUCCESS_NV = 36910 # GL/glext.h:5034
+GL_SUCCESS_NV = 36911 # GL/glext.h:5035
+GL_FAILURE_NV = 36912 # GL/glext.h:5036
+GL_YCBYCR8_422_NV = 36913 # GL/glext.h:5037
+GL_YCBAYCR8A_4224_NV = 36914 # GL/glext.h:5038
+GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV = 36915 # GL/glext.h:5039
+GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV = 36916 # GL/glext.h:5040
+GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV = 36917 # GL/glext.h:5041
+GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV = 36918 # GL/glext.h:5042
+GL_Z4Y12Z4CB12Z4CR12_444_NV = 36919 # GL/glext.h:5043
+GL_VIDEO_CAPTURE_FRAME_WIDTH_NV = 36920 # GL/glext.h:5044
+GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV = 36921 # GL/glext.h:5045
+GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV = 36922 # GL/glext.h:5046
+GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV = 36923 # GL/glext.h:5047
+GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV = 36924 # GL/glext.h:5048
+# NV_copy_image (GL/glext.h:5051)
+# EXT_separate_shader_objects (GL/glext.h:5054)
+GL_ACTIVE_PROGRAM_EXT = 35725 # GL/glext.h:5055
+# NV_parameter_buffer_object2 (GL/glext.h:5058)
+# NV_shader_buffer_load (GL/glext.h:5061)
+GL_BUFFER_GPU_ADDRESS_NV = 36637 # GL/glext.h:5062
+GL_GPU_ADDRESS_NV = 36660 # GL/glext.h:5063
+GL_MAX_SHADER_BUFFER_ADDRESS_NV = 36661 # GL/glext.h:5064
+# NV_vertex_buffer_unified_memory (GL/glext.h:5067)
+GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV = 36638 # GL/glext.h:5068
+GL_ELEMENT_ARRAY_UNIFIED_NV = 36639 # GL/glext.h:5069
+GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV = 36640 # GL/glext.h:5070
+GL_VERTEX_ARRAY_ADDRESS_NV = 36641 # GL/glext.h:5071
+GL_NORMAL_ARRAY_ADDRESS_NV = 36642 # GL/glext.h:5072
+GL_COLOR_ARRAY_ADDRESS_NV = 36643 # GL/glext.h:5073
+GL_INDEX_ARRAY_ADDRESS_NV = 36644 # GL/glext.h:5074
+GL_TEXTURE_COORD_ARRAY_ADDRESS_NV = 36645 # GL/glext.h:5075
+GL_EDGE_FLAG_ARRAY_ADDRESS_NV = 36646 # GL/glext.h:5076
+GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV = 36647 # GL/glext.h:5077
+GL_FOG_COORD_ARRAY_ADDRESS_NV = 36648 # GL/glext.h:5078
+GL_ELEMENT_ARRAY_ADDRESS_NV = 36649 # GL/glext.h:5079
+GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV = 36650 # GL/glext.h:5080
+GL_VERTEX_ARRAY_LENGTH_NV = 36651 # GL/glext.h:5081
+GL_NORMAL_ARRAY_LENGTH_NV = 36652 # GL/glext.h:5082
+GL_COLOR_ARRAY_LENGTH_NV = 36653 # GL/glext.h:5083
+GL_INDEX_ARRAY_LENGTH_NV = 36654 # GL/glext.h:5084
+GL_TEXTURE_COORD_ARRAY_LENGTH_NV = 36655 # GL/glext.h:5085
+GL_EDGE_FLAG_ARRAY_LENGTH_NV = 36656 # GL/glext.h:5086
+GL_SECONDARY_COLOR_ARRAY_LENGTH_NV = 36657 # GL/glext.h:5087
+GL_FOG_COORD_ARRAY_LENGTH_NV = 36658 # GL/glext.h:5088
+GL_ELEMENT_ARRAY_LENGTH_NV = 36659 # GL/glext.h:5089
+GL_DRAW_INDIRECT_UNIFIED_NV = 36672 # GL/glext.h:5090
+GL_DRAW_INDIRECT_ADDRESS_NV = 36673 # GL/glext.h:5091
+GL_DRAW_INDIRECT_LENGTH_NV = 36674 # GL/glext.h:5092
+# NV_texture_barrier (GL/glext.h:5095)
+# AMD_shader_stencil_export (GL/glext.h:5098)
+# AMD_seamless_cubemap_per_texture (GL/glext.h:5101)
+# AMD_conservative_depth (GL/glext.h:5105)
+# EXT_shader_image_load_store (GL/glext.h:5108)
+GL_MAX_IMAGE_UNITS_EXT = 36664 # GL/glext.h:5109
+GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT = 36665 # GL/glext.h:5110
+GL_IMAGE_BINDING_NAME_EXT = 36666 # GL/glext.h:5111
+GL_IMAGE_BINDING_LEVEL_EXT = 36667 # GL/glext.h:5112
+GL_IMAGE_BINDING_LAYERED_EXT = 36668 # GL/glext.h:5113
+GL_IMAGE_BINDING_LAYER_EXT = 36669 # GL/glext.h:5114
+GL_IMAGE_BINDING_ACCESS_EXT = 36670 # GL/glext.h:5115
+GL_IMAGE_1D_EXT = 36940 # GL/glext.h:5116
+GL_IMAGE_2D_EXT = 36941 # GL/glext.h:5117
+GL_IMAGE_3D_EXT = 36942 # GL/glext.h:5118
+GL_IMAGE_2D_RECT_EXT = 36943 # GL/glext.h:5119
+GL_IMAGE_CUBE_EXT = 36944 # GL/glext.h:5120
+GL_IMAGE_BUFFER_EXT = 36945 # GL/glext.h:5121
+GL_IMAGE_1D_ARRAY_EXT = 36946 # GL/glext.h:5122
+GL_IMAGE_2D_ARRAY_EXT = 36947 # GL/glext.h:5123
+GL_IMAGE_CUBE_MAP_ARRAY_EXT = 36948 # GL/glext.h:5124
+GL_IMAGE_2D_MULTISAMPLE_EXT = 36949 # GL/glext.h:5125
+GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT = 36950 # GL/glext.h:5126
+GL_INT_IMAGE_1D_EXT = 36951 # GL/glext.h:5127
+GL_INT_IMAGE_2D_EXT = 36952 # GL/glext.h:5128
+GL_INT_IMAGE_3D_EXT = 36953 # GL/glext.h:5129
+GL_INT_IMAGE_2D_RECT_EXT = 36954 # GL/glext.h:5130
+GL_INT_IMAGE_CUBE_EXT = 36955 # GL/glext.h:5131
+GL_INT_IMAGE_BUFFER_EXT = 36956 # GL/glext.h:5132
+GL_INT_IMAGE_1D_ARRAY_EXT = 36957 # GL/glext.h:5133
+GL_INT_IMAGE_2D_ARRAY_EXT = 36958 # GL/glext.h:5134
+GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT = 36959 # GL/glext.h:5135
+GL_INT_IMAGE_2D_MULTISAMPLE_EXT = 36960 # GL/glext.h:5136
+GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT = 36961 # GL/glext.h:5137
+GL_UNSIGNED_INT_IMAGE_1D_EXT = 36962 # GL/glext.h:5138
+GL_UNSIGNED_INT_IMAGE_2D_EXT = 36963 # GL/glext.h:5139
+GL_UNSIGNED_INT_IMAGE_3D_EXT = 36964 # GL/glext.h:5140
+GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT = 36965 # GL/glext.h:5141
+GL_UNSIGNED_INT_IMAGE_CUBE_EXT = 36966 # GL/glext.h:5142
+GL_UNSIGNED_INT_IMAGE_BUFFER_EXT = 36967 # GL/glext.h:5143
+GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT = 36968 # GL/glext.h:5144
+GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT = 36969 # GL/glext.h:5145
+GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT = 36970 # GL/glext.h:5146
+GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT = 36971 # GL/glext.h:5147
+GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT = 36972 # GL/glext.h:5148
+GL_MAX_IMAGE_SAMPLES_EXT = 36973 # GL/glext.h:5149
+GL_IMAGE_BINDING_FORMAT_EXT = 36974 # GL/glext.h:5150
+GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT = 1 # GL/glext.h:5151
+GL_ELEMENT_ARRAY_BARRIER_BIT_EXT = 2 # GL/glext.h:5152
+GL_UNIFORM_BARRIER_BIT_EXT = 4 # GL/glext.h:5153
+GL_TEXTURE_FETCH_BARRIER_BIT_EXT = 8 # GL/glext.h:5154
+GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT = 32 # GL/glext.h:5155
+GL_COMMAND_BARRIER_BIT_EXT = 64 # GL/glext.h:5156
+GL_PIXEL_BUFFER_BARRIER_BIT_EXT = 128 # GL/glext.h:5157
+GL_TEXTURE_UPDATE_BARRIER_BIT_EXT = 256 # GL/glext.h:5158
+GL_BUFFER_UPDATE_BARRIER_BIT_EXT = 512 # GL/glext.h:5159
+GL_FRAMEBUFFER_BARRIER_BIT_EXT = 1024 # GL/glext.h:5160
+GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT = 2048 # GL/glext.h:5161
+GL_ATOMIC_COUNTER_BARRIER_BIT_EXT = 4096 # GL/glext.h:5162
+GL_ALL_BARRIER_BITS_EXT = 4294967295 # GL/glext.h:5163
+# EXT_vertex_attrib_64bit (GL/glext.h:5166)
+GL_DOUBLE_VEC2_EXT = 36860 # GL/glext.h:5168
+GL_DOUBLE_VEC3_EXT = 36861 # GL/glext.h:5169
+GL_DOUBLE_VEC4_EXT = 36862 # GL/glext.h:5170
+GL_DOUBLE_MAT2_EXT = 36678 # GL/glext.h:5171
+GL_DOUBLE_MAT3_EXT = 36679 # GL/glext.h:5172
+GL_DOUBLE_MAT4_EXT = 36680 # GL/glext.h:5173
+GL_DOUBLE_MAT2x3_EXT = 36681 # GL/glext.h:5174
+GL_DOUBLE_MAT2x4_EXT = 36682 # GL/glext.h:5175
+GL_DOUBLE_MAT3x2_EXT = 36683 # GL/glext.h:5176
+GL_DOUBLE_MAT3x4_EXT = 36684 # GL/glext.h:5177
+GL_DOUBLE_MAT4x2_EXT = 36685 # GL/glext.h:5178
+GL_DOUBLE_MAT4x3_EXT = 36686 # GL/glext.h:5179
+# NV_gpu_program5 (GL/glext.h:5182)
+GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV = 36442 # GL/glext.h:5183
+GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV = 36443 # GL/glext.h:5184
+GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV = 36444 # GL/glext.h:5185
+GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV = 36445 # GL/glext.h:5186
+GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV = 36446 # GL/glext.h:5187
+GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV = 36447 # GL/glext.h:5188
+GL_MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV = 36676 # GL/glext.h:5189
+GL_MAX_PROGRAM_SUBROUTINE_NUM_NV = 36677 # GL/glext.h:5190
+# NV_gpu_shader5 (GL/glext.h:5193)
+GL_INT64_NV = 5134 # GL/glext.h:5194
+GL_UNSIGNED_INT64_NV = 5135 # GL/glext.h:5195
+GL_INT8_NV = 36832 # GL/glext.h:5196
+GL_INT8_VEC2_NV = 36833 # GL/glext.h:5197
+GL_INT8_VEC3_NV = 36834 # GL/glext.h:5198
+GL_INT8_VEC4_NV = 36835 # GL/glext.h:5199
+GL_INT16_NV = 36836 # GL/glext.h:5200
+GL_INT16_VEC2_NV = 36837 # GL/glext.h:5201
+GL_INT16_VEC3_NV = 36838 # GL/glext.h:5202
+GL_INT16_VEC4_NV = 36839 # GL/glext.h:5203
+GL_INT64_VEC2_NV = 36841 # GL/glext.h:5204
+GL_INT64_VEC3_NV = 36842 # GL/glext.h:5205
+GL_INT64_VEC4_NV = 36843 # GL/glext.h:5206
+GL_UNSIGNED_INT8_NV = 36844 # GL/glext.h:5207
+GL_UNSIGNED_INT8_VEC2_NV = 36845 # GL/glext.h:5208
+GL_UNSIGNED_INT8_VEC3_NV = 36846 # GL/glext.h:5209
+GL_UNSIGNED_INT8_VEC4_NV = 36847 # GL/glext.h:5210
+GL_UNSIGNED_INT16_NV = 36848 # GL/glext.h:5211
+GL_UNSIGNED_INT16_VEC2_NV = 36849 # GL/glext.h:5212
+GL_UNSIGNED_INT16_VEC3_NV = 36850 # GL/glext.h:5213
+GL_UNSIGNED_INT16_VEC4_NV = 36851 # GL/glext.h:5214
+GL_UNSIGNED_INT64_VEC2_NV = 36853 # GL/glext.h:5215
+GL_UNSIGNED_INT64_VEC3_NV = 36854 # GL/glext.h:5216
+GL_UNSIGNED_INT64_VEC4_NV = 36855 # GL/glext.h:5217
+GL_FLOAT16_NV = 36856 # GL/glext.h:5218
+GL_FLOAT16_VEC2_NV = 36857 # GL/glext.h:5219
+GL_FLOAT16_VEC3_NV = 36858 # GL/glext.h:5220
+GL_FLOAT16_VEC4_NV = 36859 # GL/glext.h:5221
+# NV_shader_buffer_store (GL/glext.h:5225)
+GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV = 16 # GL/glext.h:5226
+# NV_tessellation_program5 (GL/glext.h:5231)
+GL_MAX_PROGRAM_PATCH_ATTRIBS_NV = 34520 # GL/glext.h:5232
+GL_TESS_CONTROL_PROGRAM_NV = 35102 # GL/glext.h:5233
+GL_TESS_EVALUATION_PROGRAM_NV = 35103 # GL/glext.h:5234
+GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV = 35956 # GL/glext.h:5235
+GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV = 35957 # GL/glext.h:5236
+# NV_vertex_attrib_integer_64bit (GL/glext.h:5239)
+# NV_multisample_coverage (GL/glext.h:5244)
+GL_COVERAGE_SAMPLES_NV = 32937 # GL/glext.h:5245
+GL_COLOR_SAMPLES_NV = 36384 # GL/glext.h:5246
+# AMD_name_gen_delete (GL/glext.h:5249)
+GL_DATA_BUFFER_AMD = 37201 # GL/glext.h:5250
+GL_PERFORMANCE_MONITOR_AMD = 37202 # GL/glext.h:5251
+GL_QUERY_OBJECT_AMD = 37203 # GL/glext.h:5252
+GL_VERTEX_ARRAY_OBJECT_AMD = 37204 # GL/glext.h:5253
+GL_SAMPLER_OBJECT_AMD = 37205 # GL/glext.h:5254
+# AMD_debug_output (GL/glext.h:5257)
+GL_MAX_DEBUG_LOGGED_MESSAGES_AMD = 37188 # GL/glext.h:5258
+GL_DEBUG_LOGGED_MESSAGES_AMD = 37189 # GL/glext.h:5259
+GL_DEBUG_SEVERITY_HIGH_AMD = 37190 # GL/glext.h:5260
+GL_DEBUG_SEVERITY_MEDIUM_AMD = 37191 # GL/glext.h:5261
+GL_DEBUG_SEVERITY_LOW_AMD = 37192 # GL/glext.h:5262
+GL_DEBUG_CATEGORY_API_ERROR_AMD = 37193 # GL/glext.h:5263
+GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD = 37194 # GL/glext.h:5264
+GL_DEBUG_CATEGORY_DEPRECATION_AMD = 37195 # GL/glext.h:5265
+GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD = 37196 # GL/glext.h:5266
+GL_DEBUG_CATEGORY_PERFORMANCE_AMD = 37197 # GL/glext.h:5267
+GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD = 37198 # GL/glext.h:5268
+GL_DEBUG_CATEGORY_APPLICATION_AMD = 37199 # GL/glext.h:5269
+GL_DEBUG_CATEGORY_OTHER_AMD = 37200 # GL/glext.h:5270
+# NV_vdpau_interop (GL/glext.h:5273)
+GL_SURFACE_STATE_NV = 34539 # GL/glext.h:5274
+GL_SURFACE_REGISTERED_NV = 34557 # GL/glext.h:5275
+GL_SURFACE_MAPPED_NV = 34560 # GL/glext.h:5276
+GL_WRITE_DISCARD_NV = 35006 # GL/glext.h:5277
+# AMD_transform_feedback3_lines_triangles (GL/glext.h:5280)
+# AMD_depth_clamp_separate (GL/glext.h:5283)
+GL_DEPTH_CLAMP_NEAR_AMD = 36894 # GL/glext.h:5284
+GL_DEPTH_CLAMP_FAR_AMD = 36895 # GL/glext.h:5285
+# EXT_texture_sRGB_decode (GL/glext.h:5288)
+GL_TEXTURE_SRGB_DECODE_EXT = 35400 # GL/glext.h:5289
+GL_DECODE_EXT = 35401 # GL/glext.h:5290
+GL_SKIP_DECODE_EXT = 35402 # GL/glext.h:5291
+# NV_texture_multisample (GL/glext.h:5294)
+GL_TEXTURE_COVERAGE_SAMPLES_NV = 36933 # GL/glext.h:5295
+GL_TEXTURE_COLOR_SAMPLES_NV = 36934 # GL/glext.h:5296
+# AMD_blend_minmax_factor (GL/glext.h:5299)
+GL_FACTOR_MIN_AMD = 36892 # GL/glext.h:5300
+GL_FACTOR_MAX_AMD = 36893 # GL/glext.h:5301
+# AMD_sample_positions (GL/glext.h:5304)
+GL_SUBSAMPLE_DISTANCE_AMD = 34879 # GL/glext.h:5305
+# EXT_x11_sync_object (GL/glext.h:5308)
+GL_SYNC_X11_FENCE_EXT = 37089 # GL/glext.h:5309
+# AMD_multi_draw_indirect (GL/glext.h:5312)
+# EXT_framebuffer_multisample_blit_scaled (GL/glext.h:5315)
+GL_SCALED_RESOLVE_FASTEST_EXT = 37050 # GL/glext.h:5316
+GL_SCALED_RESOLVE_NICEST_EXT = 37051 # GL/glext.h:5317
+# NV_path_rendering (GL/glext.h:5320)
+GL_PATH_FORMAT_SVG_NV = 36976 # GL/glext.h:5321
+GL_PATH_FORMAT_PS_NV = 36977 # GL/glext.h:5322
+GL_STANDARD_FONT_NAME_NV = 36978 # GL/glext.h:5323
+GL_SYSTEM_FONT_NAME_NV = 36979 # GL/glext.h:5324
+GL_FILE_NAME_NV = 36980 # GL/glext.h:5325
+GL_PATH_STROKE_WIDTH_NV = 36981 # GL/glext.h:5326
+GL_PATH_END_CAPS_NV = 36982 # GL/glext.h:5327
+GL_PATH_INITIAL_END_CAP_NV = 36983 # GL/glext.h:5328
+GL_PATH_TERMINAL_END_CAP_NV = 36984 # GL/glext.h:5329
+GL_PATH_JOIN_STYLE_NV = 36985 # GL/glext.h:5330
+GL_PATH_MITER_LIMIT_NV = 36986 # GL/glext.h:5331
+GL_PATH_DASH_CAPS_NV = 36987 # GL/glext.h:5332
+GL_PATH_INITIAL_DASH_CAP_NV = 36988 # GL/glext.h:5333
+GL_PATH_TERMINAL_DASH_CAP_NV = 36989 # GL/glext.h:5334
+GL_PATH_DASH_OFFSET_NV = 36990 # GL/glext.h:5335
+GL_PATH_CLIENT_LENGTH_NV = 36991 # GL/glext.h:5336
+GL_PATH_FILL_MODE_NV = 36992 # GL/glext.h:5337
+GL_PATH_FILL_MASK_NV = 36993 # GL/glext.h:5338
+GL_PATH_FILL_COVER_MODE_NV = 36994 # GL/glext.h:5339
+GL_PATH_STROKE_COVER_MODE_NV = 36995 # GL/glext.h:5340
+GL_PATH_STROKE_MASK_NV = 36996 # GL/glext.h:5341
+GL_PATH_SAMPLE_QUALITY_NV = 36997 # GL/glext.h:5342
+GL_PATH_STROKE_BOUND_NV = 36998 # GL/glext.h:5343
+GL_PATH_STROKE_OVERSAMPLE_COUNT_NV = 36999 # GL/glext.h:5344
+GL_COUNT_UP_NV = 37000 # GL/glext.h:5345
+GL_COUNT_DOWN_NV = 37001 # GL/glext.h:5346
+GL_PATH_OBJECT_BOUNDING_BOX_NV = 37002 # GL/glext.h:5347
+GL_CONVEX_HULL_NV = 37003 # GL/glext.h:5348
+GL_MULTI_HULLS_NV = 37004 # GL/glext.h:5349
+GL_BOUNDING_BOX_NV = 37005 # GL/glext.h:5350
+GL_TRANSLATE_X_NV = 37006 # GL/glext.h:5351
+GL_TRANSLATE_Y_NV = 37007 # GL/glext.h:5352
+GL_TRANSLATE_2D_NV = 37008 # GL/glext.h:5353
+GL_TRANSLATE_3D_NV = 37009 # GL/glext.h:5354
+GL_AFFINE_2D_NV = 37010 # GL/glext.h:5355
+GL_PROJECTIVE_2D_NV = 37011 # GL/glext.h:5356
+GL_AFFINE_3D_NV = 37012 # GL/glext.h:5357
+GL_PROJECTIVE_3D_NV = 37013 # GL/glext.h:5358
+GL_TRANSPOSE_AFFINE_2D_NV = 37014 # GL/glext.h:5359
+GL_TRANSPOSE_PROJECTIVE_2D_NV = 37015 # GL/glext.h:5360
+GL_TRANSPOSE_AFFINE_3D_NV = 37016 # GL/glext.h:5361
+GL_TRANSPOSE_PROJECTIVE_3D_NV = 37017 # GL/glext.h:5362
+GL_UTF8_NV = 37018 # GL/glext.h:5363
+GL_UTF16_NV = 37019 # GL/glext.h:5364
+GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV = 37020 # GL/glext.h:5365
+GL_PATH_COMMAND_COUNT_NV = 37021 # GL/glext.h:5366
+GL_PATH_COORD_COUNT_NV = 37022 # GL/glext.h:5367
+GL_PATH_DASH_ARRAY_COUNT_NV = 37023 # GL/glext.h:5368
+GL_PATH_COMPUTED_LENGTH_NV = 37024 # GL/glext.h:5369
+GL_PATH_FILL_BOUNDING_BOX_NV = 37025 # GL/glext.h:5370
+GL_PATH_STROKE_BOUNDING_BOX_NV = 37026 # GL/glext.h:5371
+GL_SQUARE_NV = 37027 # GL/glext.h:5372
+GL_ROUND_NV = 37028 # GL/glext.h:5373
+GL_TRIANGULAR_NV = 37029 # GL/glext.h:5374
+GL_BEVEL_NV = 37030 # GL/glext.h:5375
+GL_MITER_REVERT_NV = 37031 # GL/glext.h:5376
+GL_MITER_TRUNCATE_NV = 37032 # GL/glext.h:5377
+GL_SKIP_MISSING_GLYPH_NV = 37033 # GL/glext.h:5378
+GL_USE_MISSING_GLYPH_NV = 37034 # GL/glext.h:5379
+GL_PATH_ERROR_POSITION_NV = 37035 # GL/glext.h:5380
+GL_PATH_FOG_GEN_MODE_NV = 37036 # GL/glext.h:5381
+GL_ACCUM_ADJACENT_PAIRS_NV = 37037 # GL/glext.h:5382
+GL_ADJACENT_PAIRS_NV = 37038 # GL/glext.h:5383
+GL_FIRST_TO_REST_NV = 37039 # GL/glext.h:5384
+GL_PATH_GEN_MODE_NV = 37040 # GL/glext.h:5385
+GL_PATH_GEN_COEFF_NV = 37041 # GL/glext.h:5386
+GL_PATH_GEN_COLOR_FORMAT_NV = 37042 # GL/glext.h:5387
+GL_PATH_GEN_COMPONENTS_NV = 37043 # GL/glext.h:5388
+GL_PATH_STENCIL_FUNC_NV = 37047 # GL/glext.h:5389
+GL_PATH_STENCIL_REF_NV = 37048 # GL/glext.h:5390
+GL_PATH_STENCIL_VALUE_MASK_NV = 37049 # GL/glext.h:5391
+GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV = 37053 # GL/glext.h:5392
+GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV = 37054 # GL/glext.h:5393
+GL_PATH_COVER_DEPTH_FUNC_NV = 37055 # GL/glext.h:5394
+GL_PATH_DASH_OFFSET_RESET_NV = 37044 # GL/glext.h:5395
+GL_MOVE_TO_RESETS_NV = 37045 # GL/glext.h:5396
+GL_MOVE_TO_CONTINUES_NV = 37046 # GL/glext.h:5397
+GL_CLOSE_PATH_NV = 0 # GL/glext.h:5398
+GL_MOVE_TO_NV = 2 # GL/glext.h:5399
+GL_RELATIVE_MOVE_TO_NV = 3 # GL/glext.h:5400
+GL_LINE_TO_NV = 4 # GL/glext.h:5401
+GL_RELATIVE_LINE_TO_NV = 5 # GL/glext.h:5402
+GL_HORIZONTAL_LINE_TO_NV = 6 # GL/glext.h:5403
+GL_RELATIVE_HORIZONTAL_LINE_TO_NV = 7 # GL/glext.h:5404
+GL_VERTICAL_LINE_TO_NV = 8 # GL/glext.h:5405
+GL_RELATIVE_VERTICAL_LINE_TO_NV = 9 # GL/glext.h:5406
+GL_QUADRATIC_CURVE_TO_NV = 10 # GL/glext.h:5407
+GL_RELATIVE_QUADRATIC_CURVE_TO_NV = 11 # GL/glext.h:5408
+GL_CUBIC_CURVE_TO_NV = 12 # GL/glext.h:5409
+GL_RELATIVE_CUBIC_CURVE_TO_NV = 13 # GL/glext.h:5410
+GL_SMOOTH_QUADRATIC_CURVE_TO_NV = 14 # GL/glext.h:5411
+GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV = 15 # GL/glext.h:5412
+GL_SMOOTH_CUBIC_CURVE_TO_NV = 16 # GL/glext.h:5413
+GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV = 17 # GL/glext.h:5414
+GL_SMALL_CCW_ARC_TO_NV = 18 # GL/glext.h:5415
+GL_RELATIVE_SMALL_CCW_ARC_TO_NV = 19 # GL/glext.h:5416
+GL_SMALL_CW_ARC_TO_NV = 20 # GL/glext.h:5417
+GL_RELATIVE_SMALL_CW_ARC_TO_NV = 21 # GL/glext.h:5418
+GL_LARGE_CCW_ARC_TO_NV = 22 # GL/glext.h:5419
+GL_RELATIVE_LARGE_CCW_ARC_TO_NV = 23 # GL/glext.h:5420
+GL_LARGE_CW_ARC_TO_NV = 24 # GL/glext.h:5421
+GL_RELATIVE_LARGE_CW_ARC_TO_NV = 25 # GL/glext.h:5422
+GL_RESTART_PATH_NV = 240 # GL/glext.h:5423
+GL_DUP_FIRST_CUBIC_CURVE_TO_NV = 242 # GL/glext.h:5424
+GL_DUP_LAST_CUBIC_CURVE_TO_NV = 244 # GL/glext.h:5425
+GL_RECT_NV = 246 # GL/glext.h:5426
+GL_CIRCULAR_CCW_ARC_TO_NV = 248 # GL/glext.h:5427
+GL_CIRCULAR_CW_ARC_TO_NV = 250 # GL/glext.h:5428
+GL_CIRCULAR_TANGENT_ARC_TO_NV = 252 # GL/glext.h:5429
+GL_ARC_TO_NV = 254 # GL/glext.h:5430
+GL_RELATIVE_ARC_TO_NV = 255 # GL/glext.h:5431
+GL_BOLD_BIT_NV = 1 # GL/glext.h:5432
+GL_ITALIC_BIT_NV = 2 # GL/glext.h:5433
+GL_GLYPH_WIDTH_BIT_NV = 1 # GL/glext.h:5434
+GL_GLYPH_HEIGHT_BIT_NV = 2 # GL/glext.h:5435
+GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV = 4 # GL/glext.h:5436
+GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV = 8 # GL/glext.h:5437
+GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV = 16 # GL/glext.h:5438
+GL_GLYPH_VERTICAL_BEARING_X_BIT_NV = 32 # GL/glext.h:5439
+GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV = 64 # GL/glext.h:5440
+GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV = 128 # GL/glext.h:5441
+GL_GLYPH_HAS_KERNING_NV = 256 # GL/glext.h:5442
+GL_FONT_X_MIN_BOUNDS_NV = 65536 # GL/glext.h:5443
+GL_FONT_Y_MIN_BOUNDS_NV = 131072 # GL/glext.h:5444
+GL_FONT_X_MAX_BOUNDS_NV = 262144 # GL/glext.h:5445
+GL_FONT_Y_MAX_BOUNDS_NV = 524288 # GL/glext.h:5446
+GL_FONT_UNITS_PER_EM_NV = 1048576 # GL/glext.h:5447
+GL_FONT_ASCENDER_NV = 2097152 # GL/glext.h:5448
+GL_FONT_DESCENDER_NV = 4194304 # GL/glext.h:5449
+GL_FONT_HEIGHT_NV = 8388608 # GL/glext.h:5450
+GL_FONT_MAX_ADVANCE_WIDTH_NV = 16777216 # GL/glext.h:5451
+GL_FONT_MAX_ADVANCE_HEIGHT_NV = 33554432 # GL/glext.h:5452
+GL_FONT_UNDERLINE_POSITION_NV = 67108864 # GL/glext.h:5453
+GL_FONT_UNDERLINE_THICKNESS_NV = 134217728 # GL/glext.h:5454
+GL_FONT_HAS_KERNING_NV = 268435456 # GL/glext.h:5455
+# AMD_pinned_memory (GL/glext.h:5458)
+GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD = 37216 # GL/glext.h:5459
+# AMD_stencil_operation_extended (GL/glext.h:5462)
+GL_SET_AMD = 34634 # GL/glext.h:5463
+GL_REPLACE_VALUE_AMD = 34635 # GL/glext.h:5464
+GL_STENCIL_OP_VALUE_AMD = 34636 # GL/glext.h:5465
+GL_STENCIL_BACK_OP_VALUE_AMD = 34637 # GL/glext.h:5466
+# AMD_vertex_shader_viewport_index (GL/glext.h:5469)
+# AMD_vertex_shader_layer (GL/glext.h:5472)
+# NV_bindless_texture (GL/glext.h:5475)
+# NV_shader_atomic_float (GL/glext.h:5478)
+# AMD_query_buffer_object (GL/glext.h:5481)
+GL_QUERY_BUFFER_AMD = 37266 # GL/glext.h:5482
+GL_QUERY_BUFFER_BINDING_AMD = 37267 # GL/glext.h:5483
+GL_QUERY_RESULT_NO_WAIT_AMD = 37268 # GL/glext.h:5484
+# VERSION_2_0 (GL/glext.h:5491)
+GLchar = c_char # GL/glext.h:5493
+# VERSION_1_5 (GL/glext.h:5496)
+GLintptr = c_ptrdiff_t # GL/glext.h:5498
+GLsizeiptr = c_ptrdiff_t # GL/glext.h:5499
+# ARB_vertex_buffer_object (GL/glext.h:5502)
+GLintptrARB = c_ptrdiff_t # GL/glext.h:5504
+GLsizeiptrARB = c_ptrdiff_t # GL/glext.h:5505
+# ARB_shader_objects (GL/glext.h:5508)
+GLcharARB = c_char # GL/glext.h:5510
+GLhandleARB = c_uint # GL/glext.h:5511
+# ARB_half_float_pixel (GL/glext.h:5515)
+GLhalfARB = c_ushort # GL/glext.h:5516
+# NV_half_float (GL/glext.h:5519)
+GLhalfNV = c_ushort # GL/glext.h:5520
+# EXT_timer_query (GL/glext.h:5561)
+GLint64EXT = c_int64 # GL/glext.h:5562
+GLuint64EXT = c_uint64 # GL/glext.h:5563
+# ARB_sync (GL/glext.h:5566)
+GLint64 = c_int64 # GL/glext.h:5567
+GLuint64 = c_uint64 # GL/glext.h:5568
+class struct___GLsync(Structure):
+ __slots__ = [
+ ]
+struct___GLsync._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct___GLsync(Structure):
+ __slots__ = [
+ ]
+struct___GLsync._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+GLsync = POINTER(struct___GLsync) # GL/glext.h:5569
+# ARB_cl_event (GL/glext.h:5572)
+# ARB_debug_output (GL/glext.h:5578)
+GLenum = c_uint # /usr/include/GL/gl.h:149
+GLuint = c_uint # /usr/include/GL/gl.h:158
+GLsizei = c_int # /usr/include/GL/gl.h:159
+GLvoid = None # /usr/include/GL/gl.h:152
+GLDEBUGPROCARB = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLenum, GLsizei, POINTER(GLchar), POINTER(GLvoid)) # GL/glext.h:5579
+# AMD_debug_output (GL/glext.h:5582)
+GLDEBUGPROCAMD = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLsizei, POINTER(GLchar), POINTER(GLvoid)) # GL/glext.h:5583
+# NV_vdpau_interop (GL/glext.h:5586)
+GLvdpauSurfaceNV = GLintptr # GL/glext.h:5587
+# VERSION_1_2 (GL/glext.h:5590)
+# VERSION_1_2_DEPRECATED (GL/glext.h:5608)
+GL_VERSION_1_2_DEPRECATED = 1 # GL/glext.h:5609
+# GL/glext.h:5611
+glColorTable = _link_function('glColorTable', None, [GLenum, GLenum, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'VERSION_1_2_DEPRECATED')
+
+GLfloat = c_float # /usr/include/GL/gl.h:160
+# GL/glext.h:5612
+glColorTableParameterfv = _link_function('glColorTableParameterfv', None, [GLenum, GLenum, POINTER(GLfloat)], 'VERSION_1_2_DEPRECATED')
+
+GLint = c_int # /usr/include/GL/gl.h:155
+# GL/glext.h:5613
+glColorTableParameteriv = _link_function('glColorTableParameteriv', None, [GLenum, GLenum, POINTER(GLint)], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5614
+glCopyColorTable = _link_function('glCopyColorTable', None, [GLenum, GLenum, GLint, GLint, GLsizei], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5615
+glGetColorTable = _link_function('glGetColorTable', None, [GLenum, GLenum, GLenum, POINTER(GLvoid)], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5616
+glGetColorTableParameterfv = _link_function('glGetColorTableParameterfv', None, [GLenum, GLenum, POINTER(GLfloat)], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5617
+glGetColorTableParameteriv = _link_function('glGetColorTableParameteriv', None, [GLenum, GLenum, POINTER(GLint)], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5618
+glColorSubTable = _link_function('glColorSubTable', None, [GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5619
+glCopyColorSubTable = _link_function('glCopyColorSubTable', None, [GLenum, GLsizei, GLint, GLint, GLsizei], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5620
+glConvolutionFilter1D = _link_function('glConvolutionFilter1D', None, [GLenum, GLenum, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5621
+glConvolutionFilter2D = _link_function('glConvolutionFilter2D', None, [GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5622
+glConvolutionParameterf = _link_function('glConvolutionParameterf', None, [GLenum, GLenum, GLfloat], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5623
+glConvolutionParameterfv = _link_function('glConvolutionParameterfv', None, [GLenum, GLenum, POINTER(GLfloat)], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5624
+glConvolutionParameteri = _link_function('glConvolutionParameteri', None, [GLenum, GLenum, GLint], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5625
+glConvolutionParameteriv = _link_function('glConvolutionParameteriv', None, [GLenum, GLenum, POINTER(GLint)], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5626
+glCopyConvolutionFilter1D = _link_function('glCopyConvolutionFilter1D', None, [GLenum, GLenum, GLint, GLint, GLsizei], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5627
+glCopyConvolutionFilter2D = _link_function('glCopyConvolutionFilter2D', None, [GLenum, GLenum, GLint, GLint, GLsizei, GLsizei], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5628
+glGetConvolutionFilter = _link_function('glGetConvolutionFilter', None, [GLenum, GLenum, GLenum, POINTER(GLvoid)], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5629
+glGetConvolutionParameterfv = _link_function('glGetConvolutionParameterfv', None, [GLenum, GLenum, POINTER(GLfloat)], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5630
+glGetConvolutionParameteriv = _link_function('glGetConvolutionParameteriv', None, [GLenum, GLenum, POINTER(GLint)], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5631
+glGetSeparableFilter = _link_function('glGetSeparableFilter', None, [GLenum, GLenum, GLenum, POINTER(GLvoid), POINTER(GLvoid), POINTER(GLvoid)], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5632
+glSeparableFilter2D = _link_function('glSeparableFilter2D', None, [GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid), POINTER(GLvoid)], 'VERSION_1_2_DEPRECATED')
+
+GLboolean = c_ubyte # /usr/include/GL/gl.h:150
+# GL/glext.h:5633
+glGetHistogram = _link_function('glGetHistogram', None, [GLenum, GLboolean, GLenum, GLenum, POINTER(GLvoid)], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5634
+glGetHistogramParameterfv = _link_function('glGetHistogramParameterfv', None, [GLenum, GLenum, POINTER(GLfloat)], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5635
+glGetHistogramParameteriv = _link_function('glGetHistogramParameteriv', None, [GLenum, GLenum, POINTER(GLint)], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5636
+glGetMinmax = _link_function('glGetMinmax', None, [GLenum, GLboolean, GLenum, GLenum, POINTER(GLvoid)], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5637
+glGetMinmaxParameterfv = _link_function('glGetMinmaxParameterfv', None, [GLenum, GLenum, POINTER(GLfloat)], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5638
+glGetMinmaxParameteriv = _link_function('glGetMinmaxParameteriv', None, [GLenum, GLenum, POINTER(GLint)], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5639
+glHistogram = _link_function('glHistogram', None, [GLenum, GLsizei, GLenum, GLboolean], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5640
+glMinmax = _link_function('glMinmax', None, [GLenum, GLenum, GLboolean], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5641
+glResetHistogram = _link_function('glResetHistogram', None, [GLenum], 'VERSION_1_2_DEPRECATED')
+
+# GL/glext.h:5642
+glResetMinmax = _link_function('glResetMinmax', None, [GLenum], 'VERSION_1_2_DEPRECATED')
+
+PFNGLCOLORTABLEPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5644
+PFNGLCOLORTABLEPARAMETERFVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5645
+PFNGLCOLORTABLEPARAMETERIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5646
+PFNGLCOPYCOLORTABLEPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLsizei) # GL/glext.h:5647
+PFNGLGETCOLORTABLEPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5648
+PFNGLGETCOLORTABLEPARAMETERFVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5649
+PFNGLGETCOLORTABLEPARAMETERIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5650
+PFNGLCOLORSUBTABLEPROC = CFUNCTYPE(None, GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5651
+PFNGLCOPYCOLORSUBTABLEPROC = CFUNCTYPE(None, GLenum, GLsizei, GLint, GLint, GLsizei) # GL/glext.h:5652
+PFNGLCONVOLUTIONFILTER1DPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5653
+PFNGLCONVOLUTIONFILTER2DPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5654
+PFNGLCONVOLUTIONPARAMETERFPROC = CFUNCTYPE(None, GLenum, GLenum, GLfloat) # GL/glext.h:5655
+PFNGLCONVOLUTIONPARAMETERFVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5656
+PFNGLCONVOLUTIONPARAMETERIPROC = CFUNCTYPE(None, GLenum, GLenum, GLint) # GL/glext.h:5657
+PFNGLCONVOLUTIONPARAMETERIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5658
+PFNGLCOPYCONVOLUTIONFILTER1DPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLsizei) # GL/glext.h:5659
+PFNGLCOPYCONVOLUTIONFILTER2DPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLsizei, GLsizei) # GL/glext.h:5660
+PFNGLGETCONVOLUTIONFILTERPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5661
+PFNGLGETCONVOLUTIONPARAMETERFVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5662
+PFNGLGETCONVOLUTIONPARAMETERIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5663
+PFNGLGETSEPARABLEFILTERPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLvoid), POINTER(GLvoid), POINTER(GLvoid)) # GL/glext.h:5664
+PFNGLSEPARABLEFILTER2DPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid), POINTER(GLvoid)) # GL/glext.h:5665
+PFNGLGETHISTOGRAMPROC = CFUNCTYPE(None, GLenum, GLboolean, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5666
+PFNGLGETHISTOGRAMPARAMETERFVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5667
+PFNGLGETHISTOGRAMPARAMETERIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5668
+PFNGLGETMINMAXPROC = CFUNCTYPE(None, GLenum, GLboolean, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5669
+PFNGLGETMINMAXPARAMETERFVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5670
+PFNGLGETMINMAXPARAMETERIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5671
+PFNGLHISTOGRAMPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, GLboolean) # GL/glext.h:5672
+PFNGLMINMAXPROC = CFUNCTYPE(None, GLenum, GLenum, GLboolean) # GL/glext.h:5673
+PFNGLRESETHISTOGRAMPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:5674
+PFNGLRESETMINMAXPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:5675
+# VERSION_1_3 (GL/glext.h:5678)
+# VERSION_1_3_DEPRECATED (GL/glext.h:5702)
+GL_VERSION_1_3_DEPRECATED = 1 # GL/glext.h:5703
+# GL/glext.h:5705
+glClientActiveTexture = _link_function('glClientActiveTexture', None, [GLenum], 'VERSION_1_3_DEPRECATED')
+
+GLdouble = c_double # /usr/include/GL/gl.h:162
+# GL/glext.h:5706
+glMultiTexCoord1d = _link_function('glMultiTexCoord1d', None, [GLenum, GLdouble], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5707
+glMultiTexCoord1dv = _link_function('glMultiTexCoord1dv', None, [GLenum, POINTER(GLdouble)], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5708
+glMultiTexCoord1f = _link_function('glMultiTexCoord1f', None, [GLenum, GLfloat], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5709
+glMultiTexCoord1fv = _link_function('glMultiTexCoord1fv', None, [GLenum, POINTER(GLfloat)], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5710
+glMultiTexCoord1i = _link_function('glMultiTexCoord1i', None, [GLenum, GLint], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5711
+glMultiTexCoord1iv = _link_function('glMultiTexCoord1iv', None, [GLenum, POINTER(GLint)], 'VERSION_1_3_DEPRECATED')
+
+GLshort = c_short # /usr/include/GL/gl.h:154
+# GL/glext.h:5712
+glMultiTexCoord1s = _link_function('glMultiTexCoord1s', None, [GLenum, GLshort], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5713
+glMultiTexCoord1sv = _link_function('glMultiTexCoord1sv', None, [GLenum, POINTER(GLshort)], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5714
+glMultiTexCoord2d = _link_function('glMultiTexCoord2d', None, [GLenum, GLdouble, GLdouble], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5715
+glMultiTexCoord2dv = _link_function('glMultiTexCoord2dv', None, [GLenum, POINTER(GLdouble)], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5716
+glMultiTexCoord2f = _link_function('glMultiTexCoord2f', None, [GLenum, GLfloat, GLfloat], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5717
+glMultiTexCoord2fv = _link_function('glMultiTexCoord2fv', None, [GLenum, POINTER(GLfloat)], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5718
+glMultiTexCoord2i = _link_function('glMultiTexCoord2i', None, [GLenum, GLint, GLint], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5719
+glMultiTexCoord2iv = _link_function('glMultiTexCoord2iv', None, [GLenum, POINTER(GLint)], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5720
+glMultiTexCoord2s = _link_function('glMultiTexCoord2s', None, [GLenum, GLshort, GLshort], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5721
+glMultiTexCoord2sv = _link_function('glMultiTexCoord2sv', None, [GLenum, POINTER(GLshort)], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5722
+glMultiTexCoord3d = _link_function('glMultiTexCoord3d', None, [GLenum, GLdouble, GLdouble, GLdouble], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5723
+glMultiTexCoord3dv = _link_function('glMultiTexCoord3dv', None, [GLenum, POINTER(GLdouble)], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5724
+glMultiTexCoord3f = _link_function('glMultiTexCoord3f', None, [GLenum, GLfloat, GLfloat, GLfloat], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5725
+glMultiTexCoord3fv = _link_function('glMultiTexCoord3fv', None, [GLenum, POINTER(GLfloat)], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5726
+glMultiTexCoord3i = _link_function('glMultiTexCoord3i', None, [GLenum, GLint, GLint, GLint], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5727
+glMultiTexCoord3iv = _link_function('glMultiTexCoord3iv', None, [GLenum, POINTER(GLint)], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5728
+glMultiTexCoord3s = _link_function('glMultiTexCoord3s', None, [GLenum, GLshort, GLshort, GLshort], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5729
+glMultiTexCoord3sv = _link_function('glMultiTexCoord3sv', None, [GLenum, POINTER(GLshort)], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5730
+glMultiTexCoord4d = _link_function('glMultiTexCoord4d', None, [GLenum, GLdouble, GLdouble, GLdouble, GLdouble], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5731
+glMultiTexCoord4dv = _link_function('glMultiTexCoord4dv', None, [GLenum, POINTER(GLdouble)], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5732
+glMultiTexCoord4f = _link_function('glMultiTexCoord4f', None, [GLenum, GLfloat, GLfloat, GLfloat, GLfloat], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5733
+glMultiTexCoord4fv = _link_function('glMultiTexCoord4fv', None, [GLenum, POINTER(GLfloat)], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5734
+glMultiTexCoord4i = _link_function('glMultiTexCoord4i', None, [GLenum, GLint, GLint, GLint, GLint], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5735
+glMultiTexCoord4iv = _link_function('glMultiTexCoord4iv', None, [GLenum, POINTER(GLint)], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5736
+glMultiTexCoord4s = _link_function('glMultiTexCoord4s', None, [GLenum, GLshort, GLshort, GLshort, GLshort], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5737
+glMultiTexCoord4sv = _link_function('glMultiTexCoord4sv', None, [GLenum, POINTER(GLshort)], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5738
+glLoadTransposeMatrixf = _link_function('glLoadTransposeMatrixf', None, [POINTER(GLfloat)], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5739
+glLoadTransposeMatrixd = _link_function('glLoadTransposeMatrixd', None, [POINTER(GLdouble)], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5740
+glMultTransposeMatrixf = _link_function('glMultTransposeMatrixf', None, [POINTER(GLfloat)], 'VERSION_1_3_DEPRECATED')
+
+# GL/glext.h:5741
+glMultTransposeMatrixd = _link_function('glMultTransposeMatrixd', None, [POINTER(GLdouble)], 'VERSION_1_3_DEPRECATED')
+
+PFNGLCLIENTACTIVETEXTUREPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:5743
+PFNGLMULTITEXCOORD1DPROC = CFUNCTYPE(None, GLenum, GLdouble) # GL/glext.h:5744
+PFNGLMULTITEXCOORD1DVPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:5745
+PFNGLMULTITEXCOORD1FPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:5746
+PFNGLMULTITEXCOORD1FVPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:5747
+PFNGLMULTITEXCOORD1IPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:5748
+PFNGLMULTITEXCOORD1IVPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:5749
+PFNGLMULTITEXCOORD1SPROC = CFUNCTYPE(None, GLenum, GLshort) # GL/glext.h:5750
+PFNGLMULTITEXCOORD1SVPROC = CFUNCTYPE(None, GLenum, POINTER(GLshort)) # GL/glext.h:5751
+PFNGLMULTITEXCOORD2DPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble) # GL/glext.h:5752
+PFNGLMULTITEXCOORD2DVPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:5753
+PFNGLMULTITEXCOORD2FPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat) # GL/glext.h:5754
+PFNGLMULTITEXCOORD2FVPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:5755
+PFNGLMULTITEXCOORD2IPROC = CFUNCTYPE(None, GLenum, GLint, GLint) # GL/glext.h:5756
+PFNGLMULTITEXCOORD2IVPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:5757
+PFNGLMULTITEXCOORD2SPROC = CFUNCTYPE(None, GLenum, GLshort, GLshort) # GL/glext.h:5758
+PFNGLMULTITEXCOORD2SVPROC = CFUNCTYPE(None, GLenum, POINTER(GLshort)) # GL/glext.h:5759
+PFNGLMULTITEXCOORD3DPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble) # GL/glext.h:5760
+PFNGLMULTITEXCOORD3DVPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:5761
+PFNGLMULTITEXCOORD3FPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat, GLfloat) # GL/glext.h:5762
+PFNGLMULTITEXCOORD3FVPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:5763
+PFNGLMULTITEXCOORD3IPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint) # GL/glext.h:5764
+PFNGLMULTITEXCOORD3IVPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:5765
+PFNGLMULTITEXCOORD3SPROC = CFUNCTYPE(None, GLenum, GLshort, GLshort, GLshort) # GL/glext.h:5766
+PFNGLMULTITEXCOORD3SVPROC = CFUNCTYPE(None, GLenum, POINTER(GLshort)) # GL/glext.h:5767
+PFNGLMULTITEXCOORD4DPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:5768
+PFNGLMULTITEXCOORD4DVPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:5769
+PFNGLMULTITEXCOORD4FPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:5770
+PFNGLMULTITEXCOORD4FVPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:5771
+PFNGLMULTITEXCOORD4IPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLint) # GL/glext.h:5772
+PFNGLMULTITEXCOORD4IVPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:5773
+PFNGLMULTITEXCOORD4SPROC = CFUNCTYPE(None, GLenum, GLshort, GLshort, GLshort, GLshort) # GL/glext.h:5774
+PFNGLMULTITEXCOORD4SVPROC = CFUNCTYPE(None, GLenum, POINTER(GLshort)) # GL/glext.h:5775
+PFNGLLOADTRANSPOSEMATRIXFPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:5776
+PFNGLLOADTRANSPOSEMATRIXDPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:5777
+PFNGLMULTTRANSPOSEMATRIXFPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:5778
+PFNGLMULTTRANSPOSEMATRIXDPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:5779
+# VERSION_1_4 (GL/glext.h:5782)
+GL_VERSION_1_4 = 1 # GL/glext.h:5783
+# GL/glext.h:5785
+glBlendFuncSeparate = _link_function('glBlendFuncSeparate', None, [GLenum, GLenum, GLenum, GLenum], 'VERSION_1_4')
+
+# GL/glext.h:5786
+glMultiDrawArrays = _link_function('glMultiDrawArrays', None, [GLenum, POINTER(GLint), POINTER(GLsizei), GLsizei], 'VERSION_1_4')
+
+# GL/glext.h:5787
+glMultiDrawElements = _link_function('glMultiDrawElements', None, [GLenum, POINTER(GLsizei), GLenum, POINTER(POINTER(GLvoid)), GLsizei], 'VERSION_1_4')
+
+# GL/glext.h:5788
+glPointParameterf = _link_function('glPointParameterf', None, [GLenum, GLfloat], 'VERSION_1_4')
+
+# GL/glext.h:5789
+glPointParameterfv = _link_function('glPointParameterfv', None, [GLenum, POINTER(GLfloat)], 'VERSION_1_4')
+
+# GL/glext.h:5790
+glPointParameteri = _link_function('glPointParameteri', None, [GLenum, GLint], 'VERSION_1_4')
+
+# GL/glext.h:5791
+glPointParameteriv = _link_function('glPointParameteriv', None, [GLenum, POINTER(GLint)], 'VERSION_1_4')
+
+PFNGLBLENDFUNCSEPARATEPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:5793
+PFNGLMULTIDRAWARRAYSPROC = CFUNCTYPE(None, GLenum, POINTER(GLint), POINTER(GLsizei), GLsizei) # GL/glext.h:5794
+PFNGLMULTIDRAWELEMENTSPROC = CFUNCTYPE(None, GLenum, POINTER(GLsizei), GLenum, POINTER(POINTER(GLvoid)), GLsizei) # GL/glext.h:5795
+PFNGLPOINTPARAMETERFPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:5796
+PFNGLPOINTPARAMETERFVPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:5797
+PFNGLPOINTPARAMETERIPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:5798
+PFNGLPOINTPARAMETERIVPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:5799
+# VERSION_1_4_DEPRECATED (GL/glext.h:5802)
+GL_VERSION_1_4_DEPRECATED = 1 # GL/glext.h:5803
+# GL/glext.h:5805
+glFogCoordf = _link_function('glFogCoordf', None, [GLfloat], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5806
+glFogCoordfv = _link_function('glFogCoordfv', None, [POINTER(GLfloat)], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5807
+glFogCoordd = _link_function('glFogCoordd', None, [GLdouble], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5808
+glFogCoorddv = _link_function('glFogCoorddv', None, [POINTER(GLdouble)], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5809
+glFogCoordPointer = _link_function('glFogCoordPointer', None, [GLenum, GLsizei, POINTER(GLvoid)], 'VERSION_1_4_DEPRECATED')
+
+GLbyte = c_char # /usr/include/GL/gl.h:153
+# GL/glext.h:5810
+glSecondaryColor3b = _link_function('glSecondaryColor3b', None, [GLbyte, GLbyte, GLbyte], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5811
+glSecondaryColor3bv = _link_function('glSecondaryColor3bv', None, [POINTER(GLbyte)], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5812
+glSecondaryColor3d = _link_function('glSecondaryColor3d', None, [GLdouble, GLdouble, GLdouble], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5813
+glSecondaryColor3dv = _link_function('glSecondaryColor3dv', None, [POINTER(GLdouble)], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5814
+glSecondaryColor3f = _link_function('glSecondaryColor3f', None, [GLfloat, GLfloat, GLfloat], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5815
+glSecondaryColor3fv = _link_function('glSecondaryColor3fv', None, [POINTER(GLfloat)], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5816
+glSecondaryColor3i = _link_function('glSecondaryColor3i', None, [GLint, GLint, GLint], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5817
+glSecondaryColor3iv = _link_function('glSecondaryColor3iv', None, [POINTER(GLint)], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5818
+glSecondaryColor3s = _link_function('glSecondaryColor3s', None, [GLshort, GLshort, GLshort], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5819
+glSecondaryColor3sv = _link_function('glSecondaryColor3sv', None, [POINTER(GLshort)], 'VERSION_1_4_DEPRECATED')
+
+GLubyte = c_ubyte # /usr/include/GL/gl.h:156
+# GL/glext.h:5820
+glSecondaryColor3ub = _link_function('glSecondaryColor3ub', None, [GLubyte, GLubyte, GLubyte], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5821
+glSecondaryColor3ubv = _link_function('glSecondaryColor3ubv', None, [POINTER(GLubyte)], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5822
+glSecondaryColor3ui = _link_function('glSecondaryColor3ui', None, [GLuint, GLuint, GLuint], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5823
+glSecondaryColor3uiv = _link_function('glSecondaryColor3uiv', None, [POINTER(GLuint)], 'VERSION_1_4_DEPRECATED')
+
+GLushort = c_ushort # /usr/include/GL/gl.h:157
+# GL/glext.h:5824
+glSecondaryColor3us = _link_function('glSecondaryColor3us', None, [GLushort, GLushort, GLushort], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5825
+glSecondaryColor3usv = _link_function('glSecondaryColor3usv', None, [POINTER(GLushort)], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5826
+glSecondaryColorPointer = _link_function('glSecondaryColorPointer', None, [GLint, GLenum, GLsizei, POINTER(GLvoid)], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5827
+glWindowPos2d = _link_function('glWindowPos2d', None, [GLdouble, GLdouble], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5828
+glWindowPos2dv = _link_function('glWindowPos2dv', None, [POINTER(GLdouble)], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5829
+glWindowPos2f = _link_function('glWindowPos2f', None, [GLfloat, GLfloat], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5830
+glWindowPos2fv = _link_function('glWindowPos2fv', None, [POINTER(GLfloat)], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5831
+glWindowPos2i = _link_function('glWindowPos2i', None, [GLint, GLint], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5832
+glWindowPos2iv = _link_function('glWindowPos2iv', None, [POINTER(GLint)], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5833
+glWindowPos2s = _link_function('glWindowPos2s', None, [GLshort, GLshort], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5834
+glWindowPos2sv = _link_function('glWindowPos2sv', None, [POINTER(GLshort)], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5835
+glWindowPos3d = _link_function('glWindowPos3d', None, [GLdouble, GLdouble, GLdouble], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5836
+glWindowPos3dv = _link_function('glWindowPos3dv', None, [POINTER(GLdouble)], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5837
+glWindowPos3f = _link_function('glWindowPos3f', None, [GLfloat, GLfloat, GLfloat], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5838
+glWindowPos3fv = _link_function('glWindowPos3fv', None, [POINTER(GLfloat)], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5839
+glWindowPos3i = _link_function('glWindowPos3i', None, [GLint, GLint, GLint], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5840
+glWindowPos3iv = _link_function('glWindowPos3iv', None, [POINTER(GLint)], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5841
+glWindowPos3s = _link_function('glWindowPos3s', None, [GLshort, GLshort, GLshort], 'VERSION_1_4_DEPRECATED')
+
+# GL/glext.h:5842
+glWindowPos3sv = _link_function('glWindowPos3sv', None, [POINTER(GLshort)], 'VERSION_1_4_DEPRECATED')
+
+PFNGLFOGCOORDFPROC = CFUNCTYPE(None, GLfloat) # GL/glext.h:5844
+PFNGLFOGCOORDFVPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:5845
+PFNGLFOGCOORDDPROC = CFUNCTYPE(None, GLdouble) # GL/glext.h:5846
+PFNGLFOGCOORDDVPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:5847
+PFNGLFOGCOORDPOINTERPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:5848
+PFNGLSECONDARYCOLOR3BPROC = CFUNCTYPE(None, GLbyte, GLbyte, GLbyte) # GL/glext.h:5849
+PFNGLSECONDARYCOLOR3BVPROC = CFUNCTYPE(None, POINTER(GLbyte)) # GL/glext.h:5850
+PFNGLSECONDARYCOLOR3DPROC = CFUNCTYPE(None, GLdouble, GLdouble, GLdouble) # GL/glext.h:5851
+PFNGLSECONDARYCOLOR3DVPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:5852
+PFNGLSECONDARYCOLOR3FPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat) # GL/glext.h:5853
+PFNGLSECONDARYCOLOR3FVPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:5854
+PFNGLSECONDARYCOLOR3IPROC = CFUNCTYPE(None, GLint, GLint, GLint) # GL/glext.h:5855
+PFNGLSECONDARYCOLOR3IVPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:5856
+PFNGLSECONDARYCOLOR3SPROC = CFUNCTYPE(None, GLshort, GLshort, GLshort) # GL/glext.h:5857
+PFNGLSECONDARYCOLOR3SVPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:5858
+PFNGLSECONDARYCOLOR3UBPROC = CFUNCTYPE(None, GLubyte, GLubyte, GLubyte) # GL/glext.h:5859
+PFNGLSECONDARYCOLOR3UBVPROC = CFUNCTYPE(None, POINTER(GLubyte)) # GL/glext.h:5860
+PFNGLSECONDARYCOLOR3UIPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint) # GL/glext.h:5861
+PFNGLSECONDARYCOLOR3UIVPROC = CFUNCTYPE(None, POINTER(GLuint)) # GL/glext.h:5862
+PFNGLSECONDARYCOLOR3USPROC = CFUNCTYPE(None, GLushort, GLushort, GLushort) # GL/glext.h:5863
+PFNGLSECONDARYCOLOR3USVPROC = CFUNCTYPE(None, POINTER(GLushort)) # GL/glext.h:5864
+PFNGLSECONDARYCOLORPOINTERPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:5865
+PFNGLWINDOWPOS2DPROC = CFUNCTYPE(None, GLdouble, GLdouble) # GL/glext.h:5866
+PFNGLWINDOWPOS2DVPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:5867
+PFNGLWINDOWPOS2FPROC = CFUNCTYPE(None, GLfloat, GLfloat) # GL/glext.h:5868
+PFNGLWINDOWPOS2FVPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:5869
+PFNGLWINDOWPOS2IPROC = CFUNCTYPE(None, GLint, GLint) # GL/glext.h:5870
+PFNGLWINDOWPOS2IVPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:5871
+PFNGLWINDOWPOS2SPROC = CFUNCTYPE(None, GLshort, GLshort) # GL/glext.h:5872
+PFNGLWINDOWPOS2SVPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:5873
+PFNGLWINDOWPOS3DPROC = CFUNCTYPE(None, GLdouble, GLdouble, GLdouble) # GL/glext.h:5874
+PFNGLWINDOWPOS3DVPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:5875
+PFNGLWINDOWPOS3FPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat) # GL/glext.h:5876
+PFNGLWINDOWPOS3FVPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:5877
+PFNGLWINDOWPOS3IPROC = CFUNCTYPE(None, GLint, GLint, GLint) # GL/glext.h:5878
+PFNGLWINDOWPOS3IVPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:5879
+PFNGLWINDOWPOS3SPROC = CFUNCTYPE(None, GLshort, GLshort, GLshort) # GL/glext.h:5880
+PFNGLWINDOWPOS3SVPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:5881
+# VERSION_1_5 (GL/glext.h:5884)
+GL_VERSION_1_5 = 1 # GL/glext.h:5885
+# GL/glext.h:5887
+glGenQueries = _link_function('glGenQueries', None, [GLsizei, POINTER(GLuint)], 'VERSION_1_5')
+
+# GL/glext.h:5888
+glDeleteQueries = _link_function('glDeleteQueries', None, [GLsizei, POINTER(GLuint)], 'VERSION_1_5')
+
+# GL/glext.h:5889
+glIsQuery = _link_function('glIsQuery', GLboolean, [GLuint], 'VERSION_1_5')
+
+# GL/glext.h:5890
+glBeginQuery = _link_function('glBeginQuery', None, [GLenum, GLuint], 'VERSION_1_5')
+
+# GL/glext.h:5891
+glEndQuery = _link_function('glEndQuery', None, [GLenum], 'VERSION_1_5')
+
+# GL/glext.h:5892
+glGetQueryiv = _link_function('glGetQueryiv', None, [GLenum, GLenum, POINTER(GLint)], 'VERSION_1_5')
+
+# GL/glext.h:5893
+glGetQueryObjectiv = _link_function('glGetQueryObjectiv', None, [GLuint, GLenum, POINTER(GLint)], 'VERSION_1_5')
+
+# GL/glext.h:5894
+glGetQueryObjectuiv = _link_function('glGetQueryObjectuiv', None, [GLuint, GLenum, POINTER(GLuint)], 'VERSION_1_5')
+
+# GL/glext.h:5895
+glBindBuffer = _link_function('glBindBuffer', None, [GLenum, GLuint], 'VERSION_1_5')
+
+# GL/glext.h:5896
+glDeleteBuffers = _link_function('glDeleteBuffers', None, [GLsizei, POINTER(GLuint)], 'VERSION_1_5')
+
+# GL/glext.h:5897
+glGenBuffers = _link_function('glGenBuffers', None, [GLsizei, POINTER(GLuint)], 'VERSION_1_5')
+
+# GL/glext.h:5898
+glIsBuffer = _link_function('glIsBuffer', GLboolean, [GLuint], 'VERSION_1_5')
+
+# GL/glext.h:5899
+glBufferData = _link_function('glBufferData', None, [GLenum, GLsizeiptr, POINTER(GLvoid), GLenum], 'VERSION_1_5')
+
+# GL/glext.h:5900
+glBufferSubData = _link_function('glBufferSubData', None, [GLenum, GLintptr, GLsizeiptr, POINTER(GLvoid)], 'VERSION_1_5')
+
+# GL/glext.h:5901
+glGetBufferSubData = _link_function('glGetBufferSubData', None, [GLenum, GLintptr, GLsizeiptr, POINTER(GLvoid)], 'VERSION_1_5')
+
+# GL/glext.h:5902
+glMapBuffer = _link_function('glMapBuffer', POINTER(GLvoid), [GLenum, GLenum], 'VERSION_1_5')
+
+# GL/glext.h:5903
+glUnmapBuffer = _link_function('glUnmapBuffer', GLboolean, [GLenum], 'VERSION_1_5')
+
+# GL/glext.h:5904
+glGetBufferParameteriv = _link_function('glGetBufferParameteriv', None, [GLenum, GLenum, POINTER(GLint)], 'VERSION_1_5')
+
+# GL/glext.h:5905
+glGetBufferPointerv = _link_function('glGetBufferPointerv', None, [GLenum, GLenum, POINTER(POINTER(GLvoid))], 'VERSION_1_5')
+
+PFNGLGENQUERIESPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:5907
+PFNGLDELETEQUERIESPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:5908
+PFNGLISQUERYPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:5909
+PFNGLBEGINQUERYPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:5910
+PFNGLENDQUERYPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:5911
+PFNGLGETQUERYIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5912
+PFNGLGETQUERYOBJECTIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:5913
+PFNGLGETQUERYOBJECTUIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint)) # GL/glext.h:5914
+PFNGLBINDBUFFERPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:5915
+PFNGLDELETEBUFFERSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:5916
+PFNGLGENBUFFERSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:5917
+PFNGLISBUFFERPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:5918
+PFNGLBUFFERDATAPROC = CFUNCTYPE(None, GLenum, GLsizeiptr, POINTER(GLvoid), GLenum) # GL/glext.h:5919
+PFNGLBUFFERSUBDATAPROC = CFUNCTYPE(None, GLenum, GLintptr, GLsizeiptr, POINTER(GLvoid)) # GL/glext.h:5920
+PFNGLGETBUFFERSUBDATAPROC = CFUNCTYPE(None, GLenum, GLintptr, GLsizeiptr, POINTER(GLvoid)) # GL/glext.h:5921
+PFNGLMAPBUFFERPROC = CFUNCTYPE(POINTER(GLvoid), GLenum, GLenum) # GL/glext.h:5922
+PFNGLUNMAPBUFFERPROC = CFUNCTYPE(GLboolean, GLenum) # GL/glext.h:5923
+PFNGLGETBUFFERPARAMETERIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5924
+PFNGLGETBUFFERPOINTERVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:5925
+# VERSION_2_0 (GL/glext.h:5928)
+GL_VERSION_2_0 = 1 # GL/glext.h:5929
+# GL/glext.h:5931
+glBlendEquationSeparate = _link_function('glBlendEquationSeparate', None, [GLenum, GLenum], 'VERSION_2_0')
+
+# GL/glext.h:5932
+glDrawBuffers = _link_function('glDrawBuffers', None, [GLsizei, POINTER(GLenum)], 'VERSION_2_0')
+
+# GL/glext.h:5933
+glStencilOpSeparate = _link_function('glStencilOpSeparate', None, [GLenum, GLenum, GLenum, GLenum], 'VERSION_2_0')
+
+# GL/glext.h:5934
+glStencilFuncSeparate = _link_function('glStencilFuncSeparate', None, [GLenum, GLenum, GLint, GLuint], 'VERSION_2_0')
+
+# GL/glext.h:5935
+glStencilMaskSeparate = _link_function('glStencilMaskSeparate', None, [GLenum, GLuint], 'VERSION_2_0')
+
+# GL/glext.h:5936
+glAttachShader = _link_function('glAttachShader', None, [GLuint, GLuint], 'VERSION_2_0')
+
+# GL/glext.h:5937
+glBindAttribLocation = _link_function('glBindAttribLocation', None, [GLuint, GLuint, POINTER(GLchar)], 'VERSION_2_0')
+
+# GL/glext.h:5938
+glCompileShader = _link_function('glCompileShader', None, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:5939
+glCreateProgram = _link_function('glCreateProgram', GLuint, [], 'VERSION_2_0')
+
+# GL/glext.h:5940
+glCreateShader = _link_function('glCreateShader', GLuint, [GLenum], 'VERSION_2_0')
+
+# GL/glext.h:5941
+glDeleteProgram = _link_function('glDeleteProgram', None, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:5942
+glDeleteShader = _link_function('glDeleteShader', None, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:5943
+glDetachShader = _link_function('glDetachShader', None, [GLuint, GLuint], 'VERSION_2_0')
+
+# GL/glext.h:5944
+glDisableVertexAttribArray = _link_function('glDisableVertexAttribArray', None, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:5945
+glEnableVertexAttribArray = _link_function('glEnableVertexAttribArray', None, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:5946
+glGetActiveAttrib = _link_function('glGetActiveAttrib', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLchar)], 'VERSION_2_0')
+
+# GL/glext.h:5947
+glGetActiveUniform = _link_function('glGetActiveUniform', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLchar)], 'VERSION_2_0')
+
+# GL/glext.h:5948
+glGetAttachedShaders = _link_function('glGetAttachedShaders', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLuint)], 'VERSION_2_0')
+
+# GL/glext.h:5949
+glGetAttribLocation = _link_function('glGetAttribLocation', GLint, [GLuint, POINTER(GLchar)], 'VERSION_2_0')
+
+# GL/glext.h:5950
+glGetProgramiv = _link_function('glGetProgramiv', None, [GLuint, GLenum, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:5951
+glGetProgramInfoLog = _link_function('glGetProgramInfoLog', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], 'VERSION_2_0')
+
+# GL/glext.h:5952
+glGetShaderiv = _link_function('glGetShaderiv', None, [GLuint, GLenum, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:5953
+glGetShaderInfoLog = _link_function('glGetShaderInfoLog', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], 'VERSION_2_0')
+
+# GL/glext.h:5954
+glGetShaderSource = _link_function('glGetShaderSource', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], 'VERSION_2_0')
+
+# GL/glext.h:5955
+glGetUniformLocation = _link_function('glGetUniformLocation', GLint, [GLuint, POINTER(GLchar)], 'VERSION_2_0')
+
+# GL/glext.h:5956
+glGetUniformfv = _link_function('glGetUniformfv', None, [GLuint, GLint, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:5957
+glGetUniformiv = _link_function('glGetUniformiv', None, [GLuint, GLint, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:5958
+glGetVertexAttribdv = _link_function('glGetVertexAttribdv', None, [GLuint, GLenum, POINTER(GLdouble)], 'VERSION_2_0')
+
+# GL/glext.h:5959
+glGetVertexAttribfv = _link_function('glGetVertexAttribfv', None, [GLuint, GLenum, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:5960
+glGetVertexAttribiv = _link_function('glGetVertexAttribiv', None, [GLuint, GLenum, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:5961
+glGetVertexAttribPointerv = _link_function('glGetVertexAttribPointerv', None, [GLuint, GLenum, POINTER(POINTER(GLvoid))], 'VERSION_2_0')
+
+# GL/glext.h:5962
+glIsProgram = _link_function('glIsProgram', GLboolean, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:5963
+glIsShader = _link_function('glIsShader', GLboolean, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:5964
+glLinkProgram = _link_function('glLinkProgram', None, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:5965
+glShaderSource = _link_function('glShaderSource', None, [GLuint, GLsizei, POINTER(POINTER(GLchar)), POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:5966
+glUseProgram = _link_function('glUseProgram', None, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:5967
+glUniform1f = _link_function('glUniform1f', None, [GLint, GLfloat], 'VERSION_2_0')
+
+# GL/glext.h:5968
+glUniform2f = _link_function('glUniform2f', None, [GLint, GLfloat, GLfloat], 'VERSION_2_0')
+
+# GL/glext.h:5969
+glUniform3f = _link_function('glUniform3f', None, [GLint, GLfloat, GLfloat, GLfloat], 'VERSION_2_0')
+
+# GL/glext.h:5970
+glUniform4f = _link_function('glUniform4f', None, [GLint, GLfloat, GLfloat, GLfloat, GLfloat], 'VERSION_2_0')
+
+# GL/glext.h:5971
+glUniform1i = _link_function('glUniform1i', None, [GLint, GLint], 'VERSION_2_0')
+
+# GL/glext.h:5972
+glUniform2i = _link_function('glUniform2i', None, [GLint, GLint, GLint], 'VERSION_2_0')
+
+# GL/glext.h:5973
+glUniform3i = _link_function('glUniform3i', None, [GLint, GLint, GLint, GLint], 'VERSION_2_0')
+
+# GL/glext.h:5974
+glUniform4i = _link_function('glUniform4i', None, [GLint, GLint, GLint, GLint, GLint], 'VERSION_2_0')
+
+# GL/glext.h:5975
+glUniform1fv = _link_function('glUniform1fv', None, [GLint, GLsizei, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:5976
+glUniform2fv = _link_function('glUniform2fv', None, [GLint, GLsizei, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:5977
+glUniform3fv = _link_function('glUniform3fv', None, [GLint, GLsizei, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:5978
+glUniform4fv = _link_function('glUniform4fv', None, [GLint, GLsizei, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:5979
+glUniform1iv = _link_function('glUniform1iv', None, [GLint, GLsizei, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:5980
+glUniform2iv = _link_function('glUniform2iv', None, [GLint, GLsizei, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:5981
+glUniform3iv = _link_function('glUniform3iv', None, [GLint, GLsizei, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:5982
+glUniform4iv = _link_function('glUniform4iv', None, [GLint, GLsizei, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:5983
+glUniformMatrix2fv = _link_function('glUniformMatrix2fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:5984
+glUniformMatrix3fv = _link_function('glUniformMatrix3fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:5985
+glUniformMatrix4fv = _link_function('glUniformMatrix4fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:5986
+glValidateProgram = _link_function('glValidateProgram', None, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:5987
+glVertexAttrib1d = _link_function('glVertexAttrib1d', None, [GLuint, GLdouble], 'VERSION_2_0')
+
+# GL/glext.h:5988
+glVertexAttrib1dv = _link_function('glVertexAttrib1dv', None, [GLuint, POINTER(GLdouble)], 'VERSION_2_0')
+
+# GL/glext.h:5989
+glVertexAttrib1f = _link_function('glVertexAttrib1f', None, [GLuint, GLfloat], 'VERSION_2_0')
+
+# GL/glext.h:5990
+glVertexAttrib1fv = _link_function('glVertexAttrib1fv', None, [GLuint, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:5991
+glVertexAttrib1s = _link_function('glVertexAttrib1s', None, [GLuint, GLshort], 'VERSION_2_0')
+
+# GL/glext.h:5992
+glVertexAttrib1sv = _link_function('glVertexAttrib1sv', None, [GLuint, POINTER(GLshort)], 'VERSION_2_0')
+
+# GL/glext.h:5993
+glVertexAttrib2d = _link_function('glVertexAttrib2d', None, [GLuint, GLdouble, GLdouble], 'VERSION_2_0')
+
+# GL/glext.h:5994
+glVertexAttrib2dv = _link_function('glVertexAttrib2dv', None, [GLuint, POINTER(GLdouble)], 'VERSION_2_0')
+
+# GL/glext.h:5995
+glVertexAttrib2f = _link_function('glVertexAttrib2f', None, [GLuint, GLfloat, GLfloat], 'VERSION_2_0')
+
+# GL/glext.h:5996
+glVertexAttrib2fv = _link_function('glVertexAttrib2fv', None, [GLuint, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:5997
+glVertexAttrib2s = _link_function('glVertexAttrib2s', None, [GLuint, GLshort, GLshort], 'VERSION_2_0')
+
+# GL/glext.h:5998
+glVertexAttrib2sv = _link_function('glVertexAttrib2sv', None, [GLuint, POINTER(GLshort)], 'VERSION_2_0')
+
+# GL/glext.h:5999
+glVertexAttrib3d = _link_function('glVertexAttrib3d', None, [GLuint, GLdouble, GLdouble, GLdouble], 'VERSION_2_0')
+
+# GL/glext.h:6000
+glVertexAttrib3dv = _link_function('glVertexAttrib3dv', None, [GLuint, POINTER(GLdouble)], 'VERSION_2_0')
+
+# GL/glext.h:6001
+glVertexAttrib3f = _link_function('glVertexAttrib3f', None, [GLuint, GLfloat, GLfloat, GLfloat], 'VERSION_2_0')
+
+# GL/glext.h:6002
+glVertexAttrib3fv = _link_function('glVertexAttrib3fv', None, [GLuint, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:6003
+glVertexAttrib3s = _link_function('glVertexAttrib3s', None, [GLuint, GLshort, GLshort, GLshort], 'VERSION_2_0')
+
+# GL/glext.h:6004
+glVertexAttrib3sv = _link_function('glVertexAttrib3sv', None, [GLuint, POINTER(GLshort)], 'VERSION_2_0')
+
+# GL/glext.h:6005
+glVertexAttrib4Nbv = _link_function('glVertexAttrib4Nbv', None, [GLuint, POINTER(GLbyte)], 'VERSION_2_0')
+
+# GL/glext.h:6006
+glVertexAttrib4Niv = _link_function('glVertexAttrib4Niv', None, [GLuint, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:6007
+glVertexAttrib4Nsv = _link_function('glVertexAttrib4Nsv', None, [GLuint, POINTER(GLshort)], 'VERSION_2_0')
+
+# GL/glext.h:6008
+glVertexAttrib4Nub = _link_function('glVertexAttrib4Nub', None, [GLuint, GLubyte, GLubyte, GLubyte, GLubyte], 'VERSION_2_0')
+
+# GL/glext.h:6009
+glVertexAttrib4Nubv = _link_function('glVertexAttrib4Nubv', None, [GLuint, POINTER(GLubyte)], 'VERSION_2_0')
+
+# GL/glext.h:6010
+glVertexAttrib4Nuiv = _link_function('glVertexAttrib4Nuiv', None, [GLuint, POINTER(GLuint)], 'VERSION_2_0')
+
+# GL/glext.h:6011
+glVertexAttrib4Nusv = _link_function('glVertexAttrib4Nusv', None, [GLuint, POINTER(GLushort)], 'VERSION_2_0')
+
+# GL/glext.h:6012
+glVertexAttrib4bv = _link_function('glVertexAttrib4bv', None, [GLuint, POINTER(GLbyte)], 'VERSION_2_0')
+
+# GL/glext.h:6013
+glVertexAttrib4d = _link_function('glVertexAttrib4d', None, [GLuint, GLdouble, GLdouble, GLdouble, GLdouble], 'VERSION_2_0')
+
+# GL/glext.h:6014
+glVertexAttrib4dv = _link_function('glVertexAttrib4dv', None, [GLuint, POINTER(GLdouble)], 'VERSION_2_0')
+
+# GL/glext.h:6015
+glVertexAttrib4f = _link_function('glVertexAttrib4f', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat], 'VERSION_2_0')
+
+# GL/glext.h:6016
+glVertexAttrib4fv = _link_function('glVertexAttrib4fv', None, [GLuint, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:6017
+glVertexAttrib4iv = _link_function('glVertexAttrib4iv', None, [GLuint, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:6018
+glVertexAttrib4s = _link_function('glVertexAttrib4s', None, [GLuint, GLshort, GLshort, GLshort, GLshort], 'VERSION_2_0')
+
+# GL/glext.h:6019
+glVertexAttrib4sv = _link_function('glVertexAttrib4sv', None, [GLuint, POINTER(GLshort)], 'VERSION_2_0')
+
+# GL/glext.h:6020
+glVertexAttrib4ubv = _link_function('glVertexAttrib4ubv', None, [GLuint, POINTER(GLubyte)], 'VERSION_2_0')
+
+# GL/glext.h:6021
+glVertexAttrib4uiv = _link_function('glVertexAttrib4uiv', None, [GLuint, POINTER(GLuint)], 'VERSION_2_0')
+
+# GL/glext.h:6022
+glVertexAttrib4usv = _link_function('glVertexAttrib4usv', None, [GLuint, POINTER(GLushort)], 'VERSION_2_0')
+
+# GL/glext.h:6023
+glVertexAttribPointer = _link_function('glVertexAttribPointer', None, [GLuint, GLint, GLenum, GLboolean, GLsizei, POINTER(GLvoid)], 'VERSION_2_0')
+
+PFNGLBLENDEQUATIONSEPARATEPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:6025
+PFNGLDRAWBUFFERSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLenum)) # GL/glext.h:6026
+PFNGLSTENCILOPSEPARATEPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:6027
+PFNGLSTENCILFUNCSEPARATEPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLuint) # GL/glext.h:6028
+PFNGLSTENCILMASKSEPARATEPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:6029
+PFNGLATTACHSHADERPROC = CFUNCTYPE(None, GLuint, GLuint) # GL/glext.h:6030
+PFNGLBINDATTRIBLOCATIONPROC = CFUNCTYPE(None, GLuint, GLuint, POINTER(GLchar)) # GL/glext.h:6031
+PFNGLCOMPILESHADERPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6032
+PFNGLCREATEPROGRAMPROC = CFUNCTYPE(GLuint) # GL/glext.h:6033
+PFNGLCREATESHADERPROC = CFUNCTYPE(GLuint, GLenum) # GL/glext.h:6034
+PFNGLDELETEPROGRAMPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6035
+PFNGLDELETESHADERPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6036
+PFNGLDETACHSHADERPROC = CFUNCTYPE(None, GLuint, GLuint) # GL/glext.h:6037
+PFNGLDISABLEVERTEXATTRIBARRAYPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6038
+PFNGLENABLEVERTEXATTRIBARRAYPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6039
+PFNGLGETACTIVEATTRIBPROC = CFUNCTYPE(None, GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLchar)) # GL/glext.h:6040
+PFNGLGETACTIVEUNIFORMPROC = CFUNCTYPE(None, GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLchar)) # GL/glext.h:6041
+PFNGLGETATTACHEDSHADERSPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLuint)) # GL/glext.h:6042
+PFNGLGETATTRIBLOCATIONPROC = CFUNCTYPE(GLint, GLuint, POINTER(GLchar)) # GL/glext.h:6043
+PFNGLGETPROGRAMIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:6044
+PFNGLGETPROGRAMINFOLOGPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)) # GL/glext.h:6045
+PFNGLGETSHADERIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:6046
+PFNGLGETSHADERINFOLOGPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)) # GL/glext.h:6047
+PFNGLGETSHADERSOURCEPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)) # GL/glext.h:6048
+PFNGLGETUNIFORMLOCATIONPROC = CFUNCTYPE(GLint, GLuint, POINTER(GLchar)) # GL/glext.h:6049
+PFNGLGETUNIFORMFVPROC = CFUNCTYPE(None, GLuint, GLint, POINTER(GLfloat)) # GL/glext.h:6050
+PFNGLGETUNIFORMIVPROC = CFUNCTYPE(None, GLuint, GLint, POINTER(GLint)) # GL/glext.h:6051
+PFNGLGETVERTEXATTRIBDVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLdouble)) # GL/glext.h:6052
+PFNGLGETVERTEXATTRIBFVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:6053
+PFNGLGETVERTEXATTRIBIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:6054
+PFNGLGETVERTEXATTRIBPOINTERVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:6055
+PFNGLISPROGRAMPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:6056
+PFNGLISSHADERPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:6057
+PFNGLLINKPROGRAMPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6058
+PFNGLSHADERSOURCEPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(POINTER(GLchar)), POINTER(GLint)) # GL/glext.h:6059
+PFNGLUSEPROGRAMPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6060
+PFNGLUNIFORM1FPROC = CFUNCTYPE(None, GLint, GLfloat) # GL/glext.h:6061
+PFNGLUNIFORM2FPROC = CFUNCTYPE(None, GLint, GLfloat, GLfloat) # GL/glext.h:6062
+PFNGLUNIFORM3FPROC = CFUNCTYPE(None, GLint, GLfloat, GLfloat, GLfloat) # GL/glext.h:6063
+PFNGLUNIFORM4FPROC = CFUNCTYPE(None, GLint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6064
+PFNGLUNIFORM1IPROC = CFUNCTYPE(None, GLint, GLint) # GL/glext.h:6065
+PFNGLUNIFORM2IPROC = CFUNCTYPE(None, GLint, GLint, GLint) # GL/glext.h:6066
+PFNGLUNIFORM3IPROC = CFUNCTYPE(None, GLint, GLint, GLint, GLint) # GL/glext.h:6067
+PFNGLUNIFORM4IPROC = CFUNCTYPE(None, GLint, GLint, GLint, GLint, GLint) # GL/glext.h:6068
+PFNGLUNIFORM1FVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:6069
+PFNGLUNIFORM2FVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:6070
+PFNGLUNIFORM3FVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:6071
+PFNGLUNIFORM4FVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:6072
+PFNGLUNIFORM1IVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:6073
+PFNGLUNIFORM2IVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:6074
+PFNGLUNIFORM3IVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:6075
+PFNGLUNIFORM4IVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:6076
+PFNGLUNIFORMMATRIX2FVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:6077
+PFNGLUNIFORMMATRIX3FVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:6078
+PFNGLUNIFORMMATRIX4FVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:6079
+PFNGLVALIDATEPROGRAMPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6080
+PFNGLVERTEXATTRIB1DPROC = CFUNCTYPE(None, GLuint, GLdouble) # GL/glext.h:6081
+PFNGLVERTEXATTRIB1DVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:6082
+PFNGLVERTEXATTRIB1FPROC = CFUNCTYPE(None, GLuint, GLfloat) # GL/glext.h:6083
+PFNGLVERTEXATTRIB1FVPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:6084
+PFNGLVERTEXATTRIB1SPROC = CFUNCTYPE(None, GLuint, GLshort) # GL/glext.h:6085
+PFNGLVERTEXATTRIB1SVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:6086
+PFNGLVERTEXATTRIB2DPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble) # GL/glext.h:6087
+PFNGLVERTEXATTRIB2DVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:6088
+PFNGLVERTEXATTRIB2FPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat) # GL/glext.h:6089
+PFNGLVERTEXATTRIB2FVPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:6090
+PFNGLVERTEXATTRIB2SPROC = CFUNCTYPE(None, GLuint, GLshort, GLshort) # GL/glext.h:6091
+PFNGLVERTEXATTRIB2SVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:6092
+PFNGLVERTEXATTRIB3DPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble, GLdouble) # GL/glext.h:6093
+PFNGLVERTEXATTRIB3DVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:6094
+PFNGLVERTEXATTRIB3FPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat) # GL/glext.h:6095
+PFNGLVERTEXATTRIB3FVPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:6096
+PFNGLVERTEXATTRIB3SPROC = CFUNCTYPE(None, GLuint, GLshort, GLshort, GLshort) # GL/glext.h:6097
+PFNGLVERTEXATTRIB3SVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:6098
+PFNGLVERTEXATTRIB4NBVPROC = CFUNCTYPE(None, GLuint, POINTER(GLbyte)) # GL/glext.h:6099
+PFNGLVERTEXATTRIB4NIVPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:6100
+PFNGLVERTEXATTRIB4NSVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:6101
+PFNGLVERTEXATTRIB4NUBPROC = CFUNCTYPE(None, GLuint, GLubyte, GLubyte, GLubyte, GLubyte) # GL/glext.h:6102
+PFNGLVERTEXATTRIB4NUBVPROC = CFUNCTYPE(None, GLuint, POINTER(GLubyte)) # GL/glext.h:6103
+PFNGLVERTEXATTRIB4NUIVPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:6104
+PFNGLVERTEXATTRIB4NUSVPROC = CFUNCTYPE(None, GLuint, POINTER(GLushort)) # GL/glext.h:6105
+PFNGLVERTEXATTRIB4BVPROC = CFUNCTYPE(None, GLuint, POINTER(GLbyte)) # GL/glext.h:6106
+PFNGLVERTEXATTRIB4DPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:6107
+PFNGLVERTEXATTRIB4DVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:6108
+PFNGLVERTEXATTRIB4FPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6109
+PFNGLVERTEXATTRIB4FVPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:6110
+PFNGLVERTEXATTRIB4IVPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:6111
+PFNGLVERTEXATTRIB4SPROC = CFUNCTYPE(None, GLuint, GLshort, GLshort, GLshort, GLshort) # GL/glext.h:6112
+PFNGLVERTEXATTRIB4SVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:6113
+PFNGLVERTEXATTRIB4UBVPROC = CFUNCTYPE(None, GLuint, POINTER(GLubyte)) # GL/glext.h:6114
+PFNGLVERTEXATTRIB4UIVPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:6115
+PFNGLVERTEXATTRIB4USVPROC = CFUNCTYPE(None, GLuint, POINTER(GLushort)) # GL/glext.h:6116
+PFNGLVERTEXATTRIBPOINTERPROC = CFUNCTYPE(None, GLuint, GLint, GLenum, GLboolean, GLsizei, POINTER(GLvoid)) # GL/glext.h:6117
+# VERSION_2_1 (GL/glext.h:6120)
+GL_VERSION_2_1 = 1 # GL/glext.h:6121
+# GL/glext.h:6123
+glUniformMatrix2x3fv = _link_function('glUniformMatrix2x3fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'VERSION_2_1')
+
+# GL/glext.h:6124
+glUniformMatrix3x2fv = _link_function('glUniformMatrix3x2fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'VERSION_2_1')
+
+# GL/glext.h:6125
+glUniformMatrix2x4fv = _link_function('glUniformMatrix2x4fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'VERSION_2_1')
+
+# GL/glext.h:6126
+glUniformMatrix4x2fv = _link_function('glUniformMatrix4x2fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'VERSION_2_1')
+
+# GL/glext.h:6127
+glUniformMatrix3x4fv = _link_function('glUniformMatrix3x4fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'VERSION_2_1')
+
+# GL/glext.h:6128
+glUniformMatrix4x3fv = _link_function('glUniformMatrix4x3fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'VERSION_2_1')
+
+PFNGLUNIFORMMATRIX2X3FVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:6130
+PFNGLUNIFORMMATRIX3X2FVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:6131
+PFNGLUNIFORMMATRIX2X4FVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:6132
+PFNGLUNIFORMMATRIX4X2FVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:6133
+PFNGLUNIFORMMATRIX3X4FVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:6134
+PFNGLUNIFORMMATRIX4X3FVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:6135
+# VERSION_3_0 (GL/glext.h:6138)
+GL_VERSION_3_0 = 1 # GL/glext.h:6139
+# GL/glext.h:6145
+glColorMaski = _link_function('glColorMaski', None, [GLuint, GLboolean, GLboolean, GLboolean, GLboolean], 'VERSION_3_0')
+
+# GL/glext.h:6146
+glGetBooleani_v = _link_function('glGetBooleani_v', None, [GLenum, GLuint, POINTER(GLboolean)], 'VERSION_3_0')
+
+# GL/glext.h:6147
+glGetIntegeri_v = _link_function('glGetIntegeri_v', None, [GLenum, GLuint, POINTER(GLint)], 'VERSION_3_0')
+
+# GL/glext.h:6148
+glEnablei = _link_function('glEnablei', None, [GLenum, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:6149
+glDisablei = _link_function('glDisablei', None, [GLenum, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:6150
+glIsEnabledi = _link_function('glIsEnabledi', GLboolean, [GLenum, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:6151
+glBeginTransformFeedback = _link_function('glBeginTransformFeedback', None, [GLenum], 'VERSION_3_0')
+
+# GL/glext.h:6152
+glEndTransformFeedback = _link_function('glEndTransformFeedback', None, [], 'VERSION_3_0')
+
+# GL/glext.h:6153
+glBindBufferRange = _link_function('glBindBufferRange', None, [GLenum, GLuint, GLuint, GLintptr, GLsizeiptr], 'VERSION_3_0')
+
+# GL/glext.h:6154
+glBindBufferBase = _link_function('glBindBufferBase', None, [GLenum, GLuint, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:6155
+glTransformFeedbackVaryings = _link_function('glTransformFeedbackVaryings', None, [GLuint, GLsizei, POINTER(POINTER(GLchar)), GLenum], 'VERSION_3_0')
+
+# GL/glext.h:6156
+glGetTransformFeedbackVarying = _link_function('glGetTransformFeedbackVarying', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLsizei), POINTER(GLenum), POINTER(GLchar)], 'VERSION_3_0')
+
+# GL/glext.h:6157
+glClampColor = _link_function('glClampColor', None, [GLenum, GLenum], 'VERSION_3_0')
+
+# GL/glext.h:6158
+glBeginConditionalRender = _link_function('glBeginConditionalRender', None, [GLuint, GLenum], 'VERSION_3_0')
+
+# GL/glext.h:6159
+glEndConditionalRender = _link_function('glEndConditionalRender', None, [], 'VERSION_3_0')
+
+# GL/glext.h:6160
+glVertexAttribIPointer = _link_function('glVertexAttribIPointer', None, [GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)], 'VERSION_3_0')
+
+# GL/glext.h:6161
+glGetVertexAttribIiv = _link_function('glGetVertexAttribIiv', None, [GLuint, GLenum, POINTER(GLint)], 'VERSION_3_0')
+
+# GL/glext.h:6162
+glGetVertexAttribIuiv = _link_function('glGetVertexAttribIuiv', None, [GLuint, GLenum, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:6163
+glVertexAttribI1i = _link_function('glVertexAttribI1i', None, [GLuint, GLint], 'VERSION_3_0')
+
+# GL/glext.h:6164
+glVertexAttribI2i = _link_function('glVertexAttribI2i', None, [GLuint, GLint, GLint], 'VERSION_3_0')
+
+# GL/glext.h:6165
+glVertexAttribI3i = _link_function('glVertexAttribI3i', None, [GLuint, GLint, GLint, GLint], 'VERSION_3_0')
+
+# GL/glext.h:6166
+glVertexAttribI4i = _link_function('glVertexAttribI4i', None, [GLuint, GLint, GLint, GLint, GLint], 'VERSION_3_0')
+
+# GL/glext.h:6167
+glVertexAttribI1ui = _link_function('glVertexAttribI1ui', None, [GLuint, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:6168
+glVertexAttribI2ui = _link_function('glVertexAttribI2ui', None, [GLuint, GLuint, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:6169
+glVertexAttribI3ui = _link_function('glVertexAttribI3ui', None, [GLuint, GLuint, GLuint, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:6170
+glVertexAttribI4ui = _link_function('glVertexAttribI4ui', None, [GLuint, GLuint, GLuint, GLuint, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:6171
+glVertexAttribI1iv = _link_function('glVertexAttribI1iv', None, [GLuint, POINTER(GLint)], 'VERSION_3_0')
+
+# GL/glext.h:6172
+glVertexAttribI2iv = _link_function('glVertexAttribI2iv', None, [GLuint, POINTER(GLint)], 'VERSION_3_0')
+
+# GL/glext.h:6173
+glVertexAttribI3iv = _link_function('glVertexAttribI3iv', None, [GLuint, POINTER(GLint)], 'VERSION_3_0')
+
+# GL/glext.h:6174
+glVertexAttribI4iv = _link_function('glVertexAttribI4iv', None, [GLuint, POINTER(GLint)], 'VERSION_3_0')
+
+# GL/glext.h:6175
+glVertexAttribI1uiv = _link_function('glVertexAttribI1uiv', None, [GLuint, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:6176
+glVertexAttribI2uiv = _link_function('glVertexAttribI2uiv', None, [GLuint, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:6177
+glVertexAttribI3uiv = _link_function('glVertexAttribI3uiv', None, [GLuint, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:6178
+glVertexAttribI4uiv = _link_function('glVertexAttribI4uiv', None, [GLuint, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:6179
+glVertexAttribI4bv = _link_function('glVertexAttribI4bv', None, [GLuint, POINTER(GLbyte)], 'VERSION_3_0')
+
+# GL/glext.h:6180
+glVertexAttribI4sv = _link_function('glVertexAttribI4sv', None, [GLuint, POINTER(GLshort)], 'VERSION_3_0')
+
+# GL/glext.h:6181
+glVertexAttribI4ubv = _link_function('glVertexAttribI4ubv', None, [GLuint, POINTER(GLubyte)], 'VERSION_3_0')
+
+# GL/glext.h:6182
+glVertexAttribI4usv = _link_function('glVertexAttribI4usv', None, [GLuint, POINTER(GLushort)], 'VERSION_3_0')
+
+# GL/glext.h:6183
+glGetUniformuiv = _link_function('glGetUniformuiv', None, [GLuint, GLint, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:6184
+glBindFragDataLocation = _link_function('glBindFragDataLocation', None, [GLuint, GLuint, POINTER(GLchar)], 'VERSION_3_0')
+
+# GL/glext.h:6185
+glGetFragDataLocation = _link_function('glGetFragDataLocation', GLint, [GLuint, POINTER(GLchar)], 'VERSION_3_0')
+
+# GL/glext.h:6186
+glUniform1ui = _link_function('glUniform1ui', None, [GLint, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:6187
+glUniform2ui = _link_function('glUniform2ui', None, [GLint, GLuint, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:6188
+glUniform3ui = _link_function('glUniform3ui', None, [GLint, GLuint, GLuint, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:6189
+glUniform4ui = _link_function('glUniform4ui', None, [GLint, GLuint, GLuint, GLuint, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:6190
+glUniform1uiv = _link_function('glUniform1uiv', None, [GLint, GLsizei, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:6191
+glUniform2uiv = _link_function('glUniform2uiv', None, [GLint, GLsizei, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:6192
+glUniform3uiv = _link_function('glUniform3uiv', None, [GLint, GLsizei, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:6193
+glUniform4uiv = _link_function('glUniform4uiv', None, [GLint, GLsizei, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:6194
+glTexParameterIiv = _link_function('glTexParameterIiv', None, [GLenum, GLenum, POINTER(GLint)], 'VERSION_3_0')
+
+# GL/glext.h:6195
+glTexParameterIuiv = _link_function('glTexParameterIuiv', None, [GLenum, GLenum, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:6196
+glGetTexParameterIiv = _link_function('glGetTexParameterIiv', None, [GLenum, GLenum, POINTER(GLint)], 'VERSION_3_0')
+
+# GL/glext.h:6197
+glGetTexParameterIuiv = _link_function('glGetTexParameterIuiv', None, [GLenum, GLenum, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:6198
+glClearBufferiv = _link_function('glClearBufferiv', None, [GLenum, GLint, POINTER(GLint)], 'VERSION_3_0')
+
+# GL/glext.h:6199
+glClearBufferuiv = _link_function('glClearBufferuiv', None, [GLenum, GLint, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:6200
+glClearBufferfv = _link_function('glClearBufferfv', None, [GLenum, GLint, POINTER(GLfloat)], 'VERSION_3_0')
+
+# GL/glext.h:6201
+glClearBufferfi = _link_function('glClearBufferfi', None, [GLenum, GLint, GLfloat, GLint], 'VERSION_3_0')
+
+# GL/glext.h:6202
+glGetStringi = _link_function('glGetStringi', POINTER(GLubyte), [GLenum, GLuint], 'VERSION_3_0')
+
+PFNGLCOLORMASKIPROC = CFUNCTYPE(None, GLuint, GLboolean, GLboolean, GLboolean, GLboolean) # GL/glext.h:6204
+PFNGLGETBOOLEANI_VPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLboolean)) # GL/glext.h:6205
+PFNGLGETINTEGERI_VPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLint)) # GL/glext.h:6206
+PFNGLENABLEIPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:6207
+PFNGLDISABLEIPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:6208
+PFNGLISENABLEDIPROC = CFUNCTYPE(GLboolean, GLenum, GLuint) # GL/glext.h:6209
+PFNGLBEGINTRANSFORMFEEDBACKPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:6210
+PFNGLENDTRANSFORMFEEDBACKPROC = CFUNCTYPE(None) # GL/glext.h:6211
+PFNGLBINDBUFFERRANGEPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLintptr, GLsizeiptr) # GL/glext.h:6212
+PFNGLBINDBUFFERBASEPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint) # GL/glext.h:6213
+PFNGLTRANSFORMFEEDBACKVARYINGSPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(POINTER(GLchar)), GLenum) # GL/glext.h:6214
+PFNGLGETTRANSFORMFEEDBACKVARYINGPROC = CFUNCTYPE(None, GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLsizei), POINTER(GLenum), POINTER(GLchar)) # GL/glext.h:6215
+PFNGLCLAMPCOLORPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:6216
+PFNGLBEGINCONDITIONALRENDERPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:6217
+PFNGLENDCONDITIONALRENDERPROC = CFUNCTYPE(None) # GL/glext.h:6218
+PFNGLVERTEXATTRIBIPOINTERPROC = CFUNCTYPE(None, GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:6219
+PFNGLGETVERTEXATTRIBIIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:6220
+PFNGLGETVERTEXATTRIBIUIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint)) # GL/glext.h:6221
+PFNGLVERTEXATTRIBI1IPROC = CFUNCTYPE(None, GLuint, GLint) # GL/glext.h:6222
+PFNGLVERTEXATTRIBI2IPROC = CFUNCTYPE(None, GLuint, GLint, GLint) # GL/glext.h:6223
+PFNGLVERTEXATTRIBI3IPROC = CFUNCTYPE(None, GLuint, GLint, GLint, GLint) # GL/glext.h:6224
+PFNGLVERTEXATTRIBI4IPROC = CFUNCTYPE(None, GLuint, GLint, GLint, GLint, GLint) # GL/glext.h:6225
+PFNGLVERTEXATTRIBI1UIPROC = CFUNCTYPE(None, GLuint, GLuint) # GL/glext.h:6226
+PFNGLVERTEXATTRIBI2UIPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint) # GL/glext.h:6227
+PFNGLVERTEXATTRIBI3UIPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:6228
+PFNGLVERTEXATTRIBI4UIPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:6229
+PFNGLVERTEXATTRIBI1IVPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:6230
+PFNGLVERTEXATTRIBI2IVPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:6231
+PFNGLVERTEXATTRIBI3IVPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:6232
+PFNGLVERTEXATTRIBI4IVPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:6233
+PFNGLVERTEXATTRIBI1UIVPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:6234
+PFNGLVERTEXATTRIBI2UIVPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:6235
+PFNGLVERTEXATTRIBI3UIVPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:6236
+PFNGLVERTEXATTRIBI4UIVPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:6237
+PFNGLVERTEXATTRIBI4BVPROC = CFUNCTYPE(None, GLuint, POINTER(GLbyte)) # GL/glext.h:6238
+PFNGLVERTEXATTRIBI4SVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:6239
+PFNGLVERTEXATTRIBI4UBVPROC = CFUNCTYPE(None, GLuint, POINTER(GLubyte)) # GL/glext.h:6240
+PFNGLVERTEXATTRIBI4USVPROC = CFUNCTYPE(None, GLuint, POINTER(GLushort)) # GL/glext.h:6241
+PFNGLGETUNIFORMUIVPROC = CFUNCTYPE(None, GLuint, GLint, POINTER(GLuint)) # GL/glext.h:6242
+PFNGLBINDFRAGDATALOCATIONPROC = CFUNCTYPE(None, GLuint, GLuint, POINTER(GLchar)) # GL/glext.h:6243
+PFNGLGETFRAGDATALOCATIONPROC = CFUNCTYPE(GLint, GLuint, POINTER(GLchar)) # GL/glext.h:6244
+PFNGLUNIFORM1UIPROC = CFUNCTYPE(None, GLint, GLuint) # GL/glext.h:6245
+PFNGLUNIFORM2UIPROC = CFUNCTYPE(None, GLint, GLuint, GLuint) # GL/glext.h:6246
+PFNGLUNIFORM3UIPROC = CFUNCTYPE(None, GLint, GLuint, GLuint, GLuint) # GL/glext.h:6247
+PFNGLUNIFORM4UIPROC = CFUNCTYPE(None, GLint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:6248
+PFNGLUNIFORM1UIVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:6249
+PFNGLUNIFORM2UIVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:6250
+PFNGLUNIFORM3UIVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:6251
+PFNGLUNIFORM4UIVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:6252
+PFNGLTEXPARAMETERIIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:6253
+PFNGLTEXPARAMETERIUIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:6254
+PFNGLGETTEXPARAMETERIIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:6255
+PFNGLGETTEXPARAMETERIUIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:6256
+PFNGLCLEARBUFFERIVPROC = CFUNCTYPE(None, GLenum, GLint, POINTER(GLint)) # GL/glext.h:6257
+PFNGLCLEARBUFFERUIVPROC = CFUNCTYPE(None, GLenum, GLint, POINTER(GLuint)) # GL/glext.h:6258
+PFNGLCLEARBUFFERFVPROC = CFUNCTYPE(None, GLenum, GLint, POINTER(GLfloat)) # GL/glext.h:6259
+PFNGLCLEARBUFFERFIPROC = CFUNCTYPE(None, GLenum, GLint, GLfloat, GLint) # GL/glext.h:6260
+PFNGLGETSTRINGIPROC = CFUNCTYPE(POINTER(GLubyte), GLenum, GLuint) # GL/glext.h:6261
+# VERSION_3_1 (GL/glext.h:6264)
+GL_VERSION_3_1 = 1 # GL/glext.h:6265
+# GL/glext.h:6270
+glDrawArraysInstanced = _link_function('glDrawArraysInstanced', None, [GLenum, GLint, GLsizei, GLsizei], 'VERSION_3_1')
+
+# GL/glext.h:6271
+glDrawElementsInstanced = _link_function('glDrawElementsInstanced', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei], 'VERSION_3_1')
+
+# GL/glext.h:6272
+glTexBuffer = _link_function('glTexBuffer', None, [GLenum, GLenum, GLuint], 'VERSION_3_1')
+
+# GL/glext.h:6273
+glPrimitiveRestartIndex = _link_function('glPrimitiveRestartIndex', None, [GLuint], 'VERSION_3_1')
+
+PFNGLDRAWARRAYSINSTANCEDPROC = CFUNCTYPE(None, GLenum, GLint, GLsizei, GLsizei) # GL/glext.h:6275
+PFNGLDRAWELEMENTSINSTANCEDPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei) # GL/glext.h:6276
+PFNGLTEXBUFFERPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint) # GL/glext.h:6277
+PFNGLPRIMITIVERESTARTINDEXPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6278
+# VERSION_3_2 (GL/glext.h:6281)
+GL_VERSION_3_2 = 1 # GL/glext.h:6282
+# GL/glext.h:6289
+glGetInteger64i_v = _link_function('glGetInteger64i_v', None, [GLenum, GLuint, POINTER(GLint64)], 'VERSION_3_2')
+
+# GL/glext.h:6290
+glGetBufferParameteri64v = _link_function('glGetBufferParameteri64v', None, [GLenum, GLenum, POINTER(GLint64)], 'VERSION_3_2')
+
+# GL/glext.h:6291
+glFramebufferTexture = _link_function('glFramebufferTexture', None, [GLenum, GLenum, GLuint, GLint], 'VERSION_3_2')
+
+PFNGLGETINTEGER64I_VPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLint64)) # GL/glext.h:6293
+PFNGLGETBUFFERPARAMETERI64VPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint64)) # GL/glext.h:6294
+PFNGLFRAMEBUFFERTEXTUREPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLint) # GL/glext.h:6295
+# VERSION_3_3 (GL/glext.h:6298)
+GL_VERSION_3_3 = 1 # GL/glext.h:6299
+# GL/glext.h:6311
+glVertexAttribDivisor = _link_function('glVertexAttribDivisor', None, [GLuint, GLuint], 'VERSION_3_3')
+
+PFNGLVERTEXATTRIBDIVISORPROC = CFUNCTYPE(None, GLuint, GLuint) # GL/glext.h:6313
+# VERSION_4_0 (GL/glext.h:6316)
+GL_VERSION_4_0 = 1 # GL/glext.h:6317
+# GL/glext.h:6331
+glMinSampleShading = _link_function('glMinSampleShading', None, [GLfloat], 'VERSION_4_0')
+
+# GL/glext.h:6332
+glBlendEquationi = _link_function('glBlendEquationi', None, [GLuint, GLenum], 'VERSION_4_0')
+
+# GL/glext.h:6333
+glBlendEquationSeparatei = _link_function('glBlendEquationSeparatei', None, [GLuint, GLenum, GLenum], 'VERSION_4_0')
+
+# GL/glext.h:6334
+glBlendFunci = _link_function('glBlendFunci', None, [GLuint, GLenum, GLenum], 'VERSION_4_0')
+
+# GL/glext.h:6335
+glBlendFuncSeparatei = _link_function('glBlendFuncSeparatei', None, [GLuint, GLenum, GLenum, GLenum, GLenum], 'VERSION_4_0')
+
+PFNGLMINSAMPLESHADINGPROC = CFUNCTYPE(None, GLfloat) # GL/glext.h:6337
+PFNGLBLENDEQUATIONIPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:6338
+PFNGLBLENDEQUATIONSEPARATEIPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum) # GL/glext.h:6339
+PFNGLBLENDFUNCIPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum) # GL/glext.h:6340
+PFNGLBLENDFUNCSEPARATEIPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:6341
+# VERSION_4_1 (GL/glext.h:6344)
+GL_VERSION_4_1 = 1 # GL/glext.h:6345
+# VERSION_4_2 (GL/glext.h:6355)
+GL_VERSION_4_2 = 1 # GL/glext.h:6356
+# ARB_multitexture (GL/glext.h:6371)
+# ARB_transpose_matrix (GL/glext.h:6445)
+GL_ARB_transpose_matrix = 1 # GL/glext.h:6446
+# GL/glext.h:6448
+glLoadTransposeMatrixfARB = _link_function('glLoadTransposeMatrixfARB', None, [POINTER(GLfloat)], 'ARB_transpose_matrix')
+
+# GL/glext.h:6449
+glLoadTransposeMatrixdARB = _link_function('glLoadTransposeMatrixdARB', None, [POINTER(GLdouble)], 'ARB_transpose_matrix')
+
+# GL/glext.h:6450
+glMultTransposeMatrixfARB = _link_function('glMultTransposeMatrixfARB', None, [POINTER(GLfloat)], 'ARB_transpose_matrix')
+
+# GL/glext.h:6451
+glMultTransposeMatrixdARB = _link_function('glMultTransposeMatrixdARB', None, [POINTER(GLdouble)], 'ARB_transpose_matrix')
+
+PFNGLLOADTRANSPOSEMATRIXFARBPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:6453
+PFNGLLOADTRANSPOSEMATRIXDARBPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:6454
+PFNGLMULTTRANSPOSEMATRIXFARBPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:6455
+PFNGLMULTTRANSPOSEMATRIXDARBPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:6456
+# ARB_multisample (GL/glext.h:6459)
+GL_ARB_multisample = 1 # GL/glext.h:6460
+# GL/glext.h:6462
+glSampleCoverageARB = _link_function('glSampleCoverageARB', None, [GLfloat, GLboolean], 'ARB_multisample')
+
+PFNGLSAMPLECOVERAGEARBPROC = CFUNCTYPE(None, GLfloat, GLboolean) # GL/glext.h:6464
+# ARB_texture_env_add (GL/glext.h:6467)
+GL_ARB_texture_env_add = 1 # GL/glext.h:6468
+# ARB_texture_cube_map (GL/glext.h:6471)
+GL_ARB_texture_cube_map = 1 # GL/glext.h:6472
+# ARB_texture_compression (GL/glext.h:6475)
+GL_ARB_texture_compression = 1 # GL/glext.h:6476
+# GL/glext.h:6478
+glCompressedTexImage3DARB = _link_function('glCompressedTexImage3DARB', None, [GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)], 'ARB_texture_compression')
+
+# GL/glext.h:6479
+glCompressedTexImage2DARB = _link_function('glCompressedTexImage2DARB', None, [GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)], 'ARB_texture_compression')
+
+# GL/glext.h:6480
+glCompressedTexImage1DARB = _link_function('glCompressedTexImage1DARB', None, [GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, POINTER(GLvoid)], 'ARB_texture_compression')
+
+# GL/glext.h:6481
+glCompressedTexSubImage3DARB = _link_function('glCompressedTexSubImage3DARB', None, [GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'ARB_texture_compression')
+
+# GL/glext.h:6482
+glCompressedTexSubImage2DARB = _link_function('glCompressedTexSubImage2DARB', None, [GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'ARB_texture_compression')
+
+# GL/glext.h:6483
+glCompressedTexSubImage1DARB = _link_function('glCompressedTexSubImage1DARB', None, [GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'ARB_texture_compression')
+
+# GL/glext.h:6484
+glGetCompressedTexImageARB = _link_function('glGetCompressedTexImageARB', None, [GLenum, GLint, POINTER(GLvoid)], 'ARB_texture_compression')
+
+PFNGLCOMPRESSEDTEXIMAGE3DARBPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # GL/glext.h:6486
+PFNGLCOMPRESSEDTEXIMAGE2DARBPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # GL/glext.h:6487
+PFNGLCOMPRESSEDTEXIMAGE1DARBPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # GL/glext.h:6488
+PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:6489
+PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:6490
+PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:6491
+PFNGLGETCOMPRESSEDTEXIMAGEARBPROC = CFUNCTYPE(None, GLenum, GLint, POINTER(GLvoid)) # GL/glext.h:6492
+# ARB_texture_border_clamp (GL/glext.h:6495)
+GL_ARB_texture_border_clamp = 1 # GL/glext.h:6496
+# ARB_point_parameters (GL/glext.h:6499)
+GL_ARB_point_parameters = 1 # GL/glext.h:6500
+# GL/glext.h:6502
+glPointParameterfARB = _link_function('glPointParameterfARB', None, [GLenum, GLfloat], 'ARB_point_parameters')
+
+# GL/glext.h:6503
+glPointParameterfvARB = _link_function('glPointParameterfvARB', None, [GLenum, POINTER(GLfloat)], 'ARB_point_parameters')
+
+PFNGLPOINTPARAMETERFARBPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:6505
+PFNGLPOINTPARAMETERFVARBPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:6506
+# ARB_vertex_blend (GL/glext.h:6509)
+GL_ARB_vertex_blend = 1 # GL/glext.h:6510
+# GL/glext.h:6512
+glWeightbvARB = _link_function('glWeightbvARB', None, [GLint, POINTER(GLbyte)], 'ARB_vertex_blend')
+
+# GL/glext.h:6513
+glWeightsvARB = _link_function('glWeightsvARB', None, [GLint, POINTER(GLshort)], 'ARB_vertex_blend')
+
+# GL/glext.h:6514
+glWeightivARB = _link_function('glWeightivARB', None, [GLint, POINTER(GLint)], 'ARB_vertex_blend')
+
+# GL/glext.h:6515
+glWeightfvARB = _link_function('glWeightfvARB', None, [GLint, POINTER(GLfloat)], 'ARB_vertex_blend')
+
+# GL/glext.h:6516
+glWeightdvARB = _link_function('glWeightdvARB', None, [GLint, POINTER(GLdouble)], 'ARB_vertex_blend')
+
+# GL/glext.h:6517
+glWeightubvARB = _link_function('glWeightubvARB', None, [GLint, POINTER(GLubyte)], 'ARB_vertex_blend')
+
+# GL/glext.h:6518
+glWeightusvARB = _link_function('glWeightusvARB', None, [GLint, POINTER(GLushort)], 'ARB_vertex_blend')
+
+# GL/glext.h:6519
+glWeightuivARB = _link_function('glWeightuivARB', None, [GLint, POINTER(GLuint)], 'ARB_vertex_blend')
+
+# GL/glext.h:6520
+glWeightPointerARB = _link_function('glWeightPointerARB', None, [GLint, GLenum, GLsizei, POINTER(GLvoid)], 'ARB_vertex_blend')
+
+# GL/glext.h:6521
+glVertexBlendARB = _link_function('glVertexBlendARB', None, [GLint], 'ARB_vertex_blend')
+
+PFNGLWEIGHTBVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLbyte)) # GL/glext.h:6523
+PFNGLWEIGHTSVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLshort)) # GL/glext.h:6524
+PFNGLWEIGHTIVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLint)) # GL/glext.h:6525
+PFNGLWEIGHTFVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLfloat)) # GL/glext.h:6526
+PFNGLWEIGHTDVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLdouble)) # GL/glext.h:6527
+PFNGLWEIGHTUBVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLubyte)) # GL/glext.h:6528
+PFNGLWEIGHTUSVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLushort)) # GL/glext.h:6529
+PFNGLWEIGHTUIVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLuint)) # GL/glext.h:6530
+PFNGLWEIGHTPOINTERARBPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:6531
+PFNGLVERTEXBLENDARBPROC = CFUNCTYPE(None, GLint) # GL/glext.h:6532
+# ARB_matrix_palette (GL/glext.h:6535)
+GL_ARB_matrix_palette = 1 # GL/glext.h:6536
+# GL/glext.h:6538
+glCurrentPaletteMatrixARB = _link_function('glCurrentPaletteMatrixARB', None, [GLint], 'ARB_matrix_palette')
+
+# GL/glext.h:6539
+glMatrixIndexubvARB = _link_function('glMatrixIndexubvARB', None, [GLint, POINTER(GLubyte)], 'ARB_matrix_palette')
+
+# GL/glext.h:6540
+glMatrixIndexusvARB = _link_function('glMatrixIndexusvARB', None, [GLint, POINTER(GLushort)], 'ARB_matrix_palette')
+
+# GL/glext.h:6541
+glMatrixIndexuivARB = _link_function('glMatrixIndexuivARB', None, [GLint, POINTER(GLuint)], 'ARB_matrix_palette')
+
+# GL/glext.h:6542
+glMatrixIndexPointerARB = _link_function('glMatrixIndexPointerARB', None, [GLint, GLenum, GLsizei, POINTER(GLvoid)], 'ARB_matrix_palette')
+
+PFNGLCURRENTPALETTEMATRIXARBPROC = CFUNCTYPE(None, GLint) # GL/glext.h:6544
+PFNGLMATRIXINDEXUBVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLubyte)) # GL/glext.h:6545
+PFNGLMATRIXINDEXUSVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLushort)) # GL/glext.h:6546
+PFNGLMATRIXINDEXUIVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLuint)) # GL/glext.h:6547
+PFNGLMATRIXINDEXPOINTERARBPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:6548
+# ARB_texture_env_combine (GL/glext.h:6551)
+GL_ARB_texture_env_combine = 1 # GL/glext.h:6552
+# ARB_texture_env_crossbar (GL/glext.h:6555)
+GL_ARB_texture_env_crossbar = 1 # GL/glext.h:6556
+# ARB_texture_env_dot3 (GL/glext.h:6559)
+GL_ARB_texture_env_dot3 = 1 # GL/glext.h:6560
+# ARB_texture_mirrored_repeat (GL/glext.h:6563)
+GL_ARB_texture_mirrored_repeat = 1 # GL/glext.h:6564
+# ARB_depth_texture (GL/glext.h:6567)
+GL_ARB_depth_texture = 1 # GL/glext.h:6568
+# ARB_shadow (GL/glext.h:6571)
+GL_ARB_shadow = 1 # GL/glext.h:6572
+# ARB_shadow_ambient (GL/glext.h:6575)
+GL_ARB_shadow_ambient = 1 # GL/glext.h:6576
+# ARB_window_pos (GL/glext.h:6579)
+GL_ARB_window_pos = 1 # GL/glext.h:6580
+# GL/glext.h:6582
+glWindowPos2dARB = _link_function('glWindowPos2dARB', None, [GLdouble, GLdouble], 'ARB_window_pos')
+
+# GL/glext.h:6583
+glWindowPos2dvARB = _link_function('glWindowPos2dvARB', None, [POINTER(GLdouble)], 'ARB_window_pos')
+
+# GL/glext.h:6584
+glWindowPos2fARB = _link_function('glWindowPos2fARB', None, [GLfloat, GLfloat], 'ARB_window_pos')
+
+# GL/glext.h:6585
+glWindowPos2fvARB = _link_function('glWindowPos2fvARB', None, [POINTER(GLfloat)], 'ARB_window_pos')
+
+# GL/glext.h:6586
+glWindowPos2iARB = _link_function('glWindowPos2iARB', None, [GLint, GLint], 'ARB_window_pos')
+
+# GL/glext.h:6587
+glWindowPos2ivARB = _link_function('glWindowPos2ivARB', None, [POINTER(GLint)], 'ARB_window_pos')
+
+# GL/glext.h:6588
+glWindowPos2sARB = _link_function('glWindowPos2sARB', None, [GLshort, GLshort], 'ARB_window_pos')
+
+# GL/glext.h:6589
+glWindowPos2svARB = _link_function('glWindowPos2svARB', None, [POINTER(GLshort)], 'ARB_window_pos')
+
+# GL/glext.h:6590
+glWindowPos3dARB = _link_function('glWindowPos3dARB', None, [GLdouble, GLdouble, GLdouble], 'ARB_window_pos')
+
+# GL/glext.h:6591
+glWindowPos3dvARB = _link_function('glWindowPos3dvARB', None, [POINTER(GLdouble)], 'ARB_window_pos')
+
+# GL/glext.h:6592
+glWindowPos3fARB = _link_function('glWindowPos3fARB', None, [GLfloat, GLfloat, GLfloat], 'ARB_window_pos')
+
+# GL/glext.h:6593
+glWindowPos3fvARB = _link_function('glWindowPos3fvARB', None, [POINTER(GLfloat)], 'ARB_window_pos')
+
+# GL/glext.h:6594
+glWindowPos3iARB = _link_function('glWindowPos3iARB', None, [GLint, GLint, GLint], 'ARB_window_pos')
+
+# GL/glext.h:6595
+glWindowPos3ivARB = _link_function('glWindowPos3ivARB', None, [POINTER(GLint)], 'ARB_window_pos')
+
+# GL/glext.h:6596
+glWindowPos3sARB = _link_function('glWindowPos3sARB', None, [GLshort, GLshort, GLshort], 'ARB_window_pos')
+
+# GL/glext.h:6597
+glWindowPos3svARB = _link_function('glWindowPos3svARB', None, [POINTER(GLshort)], 'ARB_window_pos')
+
+PFNGLWINDOWPOS2DARBPROC = CFUNCTYPE(None, GLdouble, GLdouble) # GL/glext.h:6599
+PFNGLWINDOWPOS2DVARBPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:6600
+PFNGLWINDOWPOS2FARBPROC = CFUNCTYPE(None, GLfloat, GLfloat) # GL/glext.h:6601
+PFNGLWINDOWPOS2FVARBPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:6602
+PFNGLWINDOWPOS2IARBPROC = CFUNCTYPE(None, GLint, GLint) # GL/glext.h:6603
+PFNGLWINDOWPOS2IVARBPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:6604
+PFNGLWINDOWPOS2SARBPROC = CFUNCTYPE(None, GLshort, GLshort) # GL/glext.h:6605
+PFNGLWINDOWPOS2SVARBPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:6606
+PFNGLWINDOWPOS3DARBPROC = CFUNCTYPE(None, GLdouble, GLdouble, GLdouble) # GL/glext.h:6607
+PFNGLWINDOWPOS3DVARBPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:6608
+PFNGLWINDOWPOS3FARBPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat) # GL/glext.h:6609
+PFNGLWINDOWPOS3FVARBPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:6610
+PFNGLWINDOWPOS3IARBPROC = CFUNCTYPE(None, GLint, GLint, GLint) # GL/glext.h:6611
+PFNGLWINDOWPOS3IVARBPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:6612
+PFNGLWINDOWPOS3SARBPROC = CFUNCTYPE(None, GLshort, GLshort, GLshort) # GL/glext.h:6613
+PFNGLWINDOWPOS3SVARBPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:6614
+# ARB_vertex_program (GL/glext.h:6617)
+GL_ARB_vertex_program = 1 # GL/glext.h:6618
+# GL/glext.h:6620
+glVertexAttrib1dARB = _link_function('glVertexAttrib1dARB', None, [GLuint, GLdouble], 'ARB_vertex_program')
+
+# GL/glext.h:6621
+glVertexAttrib1dvARB = _link_function('glVertexAttrib1dvARB', None, [GLuint, POINTER(GLdouble)], 'ARB_vertex_program')
+
+# GL/glext.h:6622
+glVertexAttrib1fARB = _link_function('glVertexAttrib1fARB', None, [GLuint, GLfloat], 'ARB_vertex_program')
+
+# GL/glext.h:6623
+glVertexAttrib1fvARB = _link_function('glVertexAttrib1fvARB', None, [GLuint, POINTER(GLfloat)], 'ARB_vertex_program')
+
+# GL/glext.h:6624
+glVertexAttrib1sARB = _link_function('glVertexAttrib1sARB', None, [GLuint, GLshort], 'ARB_vertex_program')
+
+# GL/glext.h:6625
+glVertexAttrib1svARB = _link_function('glVertexAttrib1svARB', None, [GLuint, POINTER(GLshort)], 'ARB_vertex_program')
+
+# GL/glext.h:6626
+glVertexAttrib2dARB = _link_function('glVertexAttrib2dARB', None, [GLuint, GLdouble, GLdouble], 'ARB_vertex_program')
+
+# GL/glext.h:6627
+glVertexAttrib2dvARB = _link_function('glVertexAttrib2dvARB', None, [GLuint, POINTER(GLdouble)], 'ARB_vertex_program')
+
+# GL/glext.h:6628
+glVertexAttrib2fARB = _link_function('glVertexAttrib2fARB', None, [GLuint, GLfloat, GLfloat], 'ARB_vertex_program')
+
+# GL/glext.h:6629
+glVertexAttrib2fvARB = _link_function('glVertexAttrib2fvARB', None, [GLuint, POINTER(GLfloat)], 'ARB_vertex_program')
+
+# GL/glext.h:6630
+glVertexAttrib2sARB = _link_function('glVertexAttrib2sARB', None, [GLuint, GLshort, GLshort], 'ARB_vertex_program')
+
+# GL/glext.h:6631
+glVertexAttrib2svARB = _link_function('glVertexAttrib2svARB', None, [GLuint, POINTER(GLshort)], 'ARB_vertex_program')
+
+# GL/glext.h:6632
+glVertexAttrib3dARB = _link_function('glVertexAttrib3dARB', None, [GLuint, GLdouble, GLdouble, GLdouble], 'ARB_vertex_program')
+
+# GL/glext.h:6633
+glVertexAttrib3dvARB = _link_function('glVertexAttrib3dvARB', None, [GLuint, POINTER(GLdouble)], 'ARB_vertex_program')
+
+# GL/glext.h:6634
+glVertexAttrib3fARB = _link_function('glVertexAttrib3fARB', None, [GLuint, GLfloat, GLfloat, GLfloat], 'ARB_vertex_program')
+
+# GL/glext.h:6635
+glVertexAttrib3fvARB = _link_function('glVertexAttrib3fvARB', None, [GLuint, POINTER(GLfloat)], 'ARB_vertex_program')
+
+# GL/glext.h:6636
+glVertexAttrib3sARB = _link_function('glVertexAttrib3sARB', None, [GLuint, GLshort, GLshort, GLshort], 'ARB_vertex_program')
+
+# GL/glext.h:6637
+glVertexAttrib3svARB = _link_function('glVertexAttrib3svARB', None, [GLuint, POINTER(GLshort)], 'ARB_vertex_program')
+
+# GL/glext.h:6638
+glVertexAttrib4NbvARB = _link_function('glVertexAttrib4NbvARB', None, [GLuint, POINTER(GLbyte)], 'ARB_vertex_program')
+
+# GL/glext.h:6639
+glVertexAttrib4NivARB = _link_function('glVertexAttrib4NivARB', None, [GLuint, POINTER(GLint)], 'ARB_vertex_program')
+
+# GL/glext.h:6640
+glVertexAttrib4NsvARB = _link_function('glVertexAttrib4NsvARB', None, [GLuint, POINTER(GLshort)], 'ARB_vertex_program')
+
+# GL/glext.h:6641
+glVertexAttrib4NubARB = _link_function('glVertexAttrib4NubARB', None, [GLuint, GLubyte, GLubyte, GLubyte, GLubyte], 'ARB_vertex_program')
+
+# GL/glext.h:6642
+glVertexAttrib4NubvARB = _link_function('glVertexAttrib4NubvARB', None, [GLuint, POINTER(GLubyte)], 'ARB_vertex_program')
+
+# GL/glext.h:6643
+glVertexAttrib4NuivARB = _link_function('glVertexAttrib4NuivARB', None, [GLuint, POINTER(GLuint)], 'ARB_vertex_program')
+
+# GL/glext.h:6644
+glVertexAttrib4NusvARB = _link_function('glVertexAttrib4NusvARB', None, [GLuint, POINTER(GLushort)], 'ARB_vertex_program')
+
+# GL/glext.h:6645
+glVertexAttrib4bvARB = _link_function('glVertexAttrib4bvARB', None, [GLuint, POINTER(GLbyte)], 'ARB_vertex_program')
+
+# GL/glext.h:6646
+glVertexAttrib4dARB = _link_function('glVertexAttrib4dARB', None, [GLuint, GLdouble, GLdouble, GLdouble, GLdouble], 'ARB_vertex_program')
+
+# GL/glext.h:6647
+glVertexAttrib4dvARB = _link_function('glVertexAttrib4dvARB', None, [GLuint, POINTER(GLdouble)], 'ARB_vertex_program')
+
+# GL/glext.h:6648
+glVertexAttrib4fARB = _link_function('glVertexAttrib4fARB', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat], 'ARB_vertex_program')
+
+# GL/glext.h:6649
+glVertexAttrib4fvARB = _link_function('glVertexAttrib4fvARB', None, [GLuint, POINTER(GLfloat)], 'ARB_vertex_program')
+
+# GL/glext.h:6650
+glVertexAttrib4ivARB = _link_function('glVertexAttrib4ivARB', None, [GLuint, POINTER(GLint)], 'ARB_vertex_program')
+
+# GL/glext.h:6651
+glVertexAttrib4sARB = _link_function('glVertexAttrib4sARB', None, [GLuint, GLshort, GLshort, GLshort, GLshort], 'ARB_vertex_program')
+
+# GL/glext.h:6652
+glVertexAttrib4svARB = _link_function('glVertexAttrib4svARB', None, [GLuint, POINTER(GLshort)], 'ARB_vertex_program')
+
+# GL/glext.h:6653
+glVertexAttrib4ubvARB = _link_function('glVertexAttrib4ubvARB', None, [GLuint, POINTER(GLubyte)], 'ARB_vertex_program')
+
+# GL/glext.h:6654
+glVertexAttrib4uivARB = _link_function('glVertexAttrib4uivARB', None, [GLuint, POINTER(GLuint)], 'ARB_vertex_program')
+
+# GL/glext.h:6655
+glVertexAttrib4usvARB = _link_function('glVertexAttrib4usvARB', None, [GLuint, POINTER(GLushort)], 'ARB_vertex_program')
+
+# GL/glext.h:6656
+glVertexAttribPointerARB = _link_function('glVertexAttribPointerARB', None, [GLuint, GLint, GLenum, GLboolean, GLsizei, POINTER(GLvoid)], 'ARB_vertex_program')
+
+# GL/glext.h:6657
+glEnableVertexAttribArrayARB = _link_function('glEnableVertexAttribArrayARB', None, [GLuint], 'ARB_vertex_program')
+
+# GL/glext.h:6658
+glDisableVertexAttribArrayARB = _link_function('glDisableVertexAttribArrayARB', None, [GLuint], 'ARB_vertex_program')
+
+# GL/glext.h:6659
+glProgramStringARB = _link_function('glProgramStringARB', None, [GLenum, GLenum, GLsizei, POINTER(GLvoid)], 'ARB_vertex_program')
+
+# GL/glext.h:6660
+glBindProgramARB = _link_function('glBindProgramARB', None, [GLenum, GLuint], 'ARB_vertex_program')
+
+# GL/glext.h:6661
+glDeleteProgramsARB = _link_function('glDeleteProgramsARB', None, [GLsizei, POINTER(GLuint)], 'ARB_vertex_program')
+
+# GL/glext.h:6662
+glGenProgramsARB = _link_function('glGenProgramsARB', None, [GLsizei, POINTER(GLuint)], 'ARB_vertex_program')
+
+# GL/glext.h:6663
+glProgramEnvParameter4dARB = _link_function('glProgramEnvParameter4dARB', None, [GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble], 'ARB_vertex_program')
+
+# GL/glext.h:6664
+glProgramEnvParameter4dvARB = _link_function('glProgramEnvParameter4dvARB', None, [GLenum, GLuint, POINTER(GLdouble)], 'ARB_vertex_program')
+
+# GL/glext.h:6665
+glProgramEnvParameter4fARB = _link_function('glProgramEnvParameter4fARB', None, [GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat], 'ARB_vertex_program')
+
+# GL/glext.h:6666
+glProgramEnvParameter4fvARB = _link_function('glProgramEnvParameter4fvARB', None, [GLenum, GLuint, POINTER(GLfloat)], 'ARB_vertex_program')
+
+# GL/glext.h:6667
+glProgramLocalParameter4dARB = _link_function('glProgramLocalParameter4dARB', None, [GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble], 'ARB_vertex_program')
+
+# GL/glext.h:6668
+glProgramLocalParameter4dvARB = _link_function('glProgramLocalParameter4dvARB', None, [GLenum, GLuint, POINTER(GLdouble)], 'ARB_vertex_program')
+
+# GL/glext.h:6669
+glProgramLocalParameter4fARB = _link_function('glProgramLocalParameter4fARB', None, [GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat], 'ARB_vertex_program')
+
+# GL/glext.h:6670
+glProgramLocalParameter4fvARB = _link_function('glProgramLocalParameter4fvARB', None, [GLenum, GLuint, POINTER(GLfloat)], 'ARB_vertex_program')
+
+# GL/glext.h:6671
+glGetProgramEnvParameterdvARB = _link_function('glGetProgramEnvParameterdvARB', None, [GLenum, GLuint, POINTER(GLdouble)], 'ARB_vertex_program')
+
+# GL/glext.h:6672
+glGetProgramEnvParameterfvARB = _link_function('glGetProgramEnvParameterfvARB', None, [GLenum, GLuint, POINTER(GLfloat)], 'ARB_vertex_program')
+
+# GL/glext.h:6673
+glGetProgramLocalParameterdvARB = _link_function('glGetProgramLocalParameterdvARB', None, [GLenum, GLuint, POINTER(GLdouble)], 'ARB_vertex_program')
+
+# GL/glext.h:6674
+glGetProgramLocalParameterfvARB = _link_function('glGetProgramLocalParameterfvARB', None, [GLenum, GLuint, POINTER(GLfloat)], 'ARB_vertex_program')
+
+# GL/glext.h:6675
+glGetProgramivARB = _link_function('glGetProgramivARB', None, [GLenum, GLenum, POINTER(GLint)], 'ARB_vertex_program')
+
+# GL/glext.h:6676
+glGetProgramStringARB = _link_function('glGetProgramStringARB', None, [GLenum, GLenum, POINTER(GLvoid)], 'ARB_vertex_program')
+
+# GL/glext.h:6677
+glGetVertexAttribdvARB = _link_function('glGetVertexAttribdvARB', None, [GLuint, GLenum, POINTER(GLdouble)], 'ARB_vertex_program')
+
+# GL/glext.h:6678
+glGetVertexAttribfvARB = _link_function('glGetVertexAttribfvARB', None, [GLuint, GLenum, POINTER(GLfloat)], 'ARB_vertex_program')
+
+# GL/glext.h:6679
+glGetVertexAttribivARB = _link_function('glGetVertexAttribivARB', None, [GLuint, GLenum, POINTER(GLint)], 'ARB_vertex_program')
+
+# GL/glext.h:6680
+glGetVertexAttribPointervARB = _link_function('glGetVertexAttribPointervARB', None, [GLuint, GLenum, POINTER(POINTER(GLvoid))], 'ARB_vertex_program')
+
+# GL/glext.h:6681
+glIsProgramARB = _link_function('glIsProgramARB', GLboolean, [GLuint], 'ARB_vertex_program')
+
+PFNGLVERTEXATTRIB1DARBPROC = CFUNCTYPE(None, GLuint, GLdouble) # GL/glext.h:6683
+PFNGLVERTEXATTRIB1DVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:6684
+PFNGLVERTEXATTRIB1FARBPROC = CFUNCTYPE(None, GLuint, GLfloat) # GL/glext.h:6685
+PFNGLVERTEXATTRIB1FVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:6686
+PFNGLVERTEXATTRIB1SARBPROC = CFUNCTYPE(None, GLuint, GLshort) # GL/glext.h:6687
+PFNGLVERTEXATTRIB1SVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:6688
+PFNGLVERTEXATTRIB2DARBPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble) # GL/glext.h:6689
+PFNGLVERTEXATTRIB2DVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:6690
+PFNGLVERTEXATTRIB2FARBPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat) # GL/glext.h:6691
+PFNGLVERTEXATTRIB2FVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:6692
+PFNGLVERTEXATTRIB2SARBPROC = CFUNCTYPE(None, GLuint, GLshort, GLshort) # GL/glext.h:6693
+PFNGLVERTEXATTRIB2SVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:6694
+PFNGLVERTEXATTRIB3DARBPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble, GLdouble) # GL/glext.h:6695
+PFNGLVERTEXATTRIB3DVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:6696
+PFNGLVERTEXATTRIB3FARBPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat) # GL/glext.h:6697
+PFNGLVERTEXATTRIB3FVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:6698
+PFNGLVERTEXATTRIB3SARBPROC = CFUNCTYPE(None, GLuint, GLshort, GLshort, GLshort) # GL/glext.h:6699
+PFNGLVERTEXATTRIB3SVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:6700
+PFNGLVERTEXATTRIB4NBVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLbyte)) # GL/glext.h:6701
+PFNGLVERTEXATTRIB4NIVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:6702
+PFNGLVERTEXATTRIB4NSVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:6703
+PFNGLVERTEXATTRIB4NUBARBPROC = CFUNCTYPE(None, GLuint, GLubyte, GLubyte, GLubyte, GLubyte) # GL/glext.h:6704
+PFNGLVERTEXATTRIB4NUBVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLubyte)) # GL/glext.h:6705
+PFNGLVERTEXATTRIB4NUIVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:6706
+PFNGLVERTEXATTRIB4NUSVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLushort)) # GL/glext.h:6707
+PFNGLVERTEXATTRIB4BVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLbyte)) # GL/glext.h:6708
+PFNGLVERTEXATTRIB4DARBPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:6709
+PFNGLVERTEXATTRIB4DVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:6710
+PFNGLVERTEXATTRIB4FARBPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6711
+PFNGLVERTEXATTRIB4FVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:6712
+PFNGLVERTEXATTRIB4IVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:6713
+PFNGLVERTEXATTRIB4SARBPROC = CFUNCTYPE(None, GLuint, GLshort, GLshort, GLshort, GLshort) # GL/glext.h:6714
+PFNGLVERTEXATTRIB4SVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:6715
+PFNGLVERTEXATTRIB4UBVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLubyte)) # GL/glext.h:6716
+PFNGLVERTEXATTRIB4UIVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:6717
+PFNGLVERTEXATTRIB4USVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLushort)) # GL/glext.h:6718
+PFNGLVERTEXATTRIBPOINTERARBPROC = CFUNCTYPE(None, GLuint, GLint, GLenum, GLboolean, GLsizei, POINTER(GLvoid)) # GL/glext.h:6719
+PFNGLENABLEVERTEXATTRIBARRAYARBPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6720
+PFNGLDISABLEVERTEXATTRIBARRAYARBPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6721
+PFNGLPROGRAMSTRINGARBPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:6722
+PFNGLBINDPROGRAMARBPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:6723
+PFNGLDELETEPROGRAMSARBPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:6724
+PFNGLGENPROGRAMSARBPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:6725
+PFNGLPROGRAMENVPARAMETER4DARBPROC = CFUNCTYPE(None, GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:6726
+PFNGLPROGRAMENVPARAMETER4DVARBPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLdouble)) # GL/glext.h:6727
+PFNGLPROGRAMENVPARAMETER4FARBPROC = CFUNCTYPE(None, GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6728
+PFNGLPROGRAMENVPARAMETER4FVARBPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:6729
+PFNGLPROGRAMLOCALPARAMETER4DARBPROC = CFUNCTYPE(None, GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:6730
+PFNGLPROGRAMLOCALPARAMETER4DVARBPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLdouble)) # GL/glext.h:6731
+PFNGLPROGRAMLOCALPARAMETER4FARBPROC = CFUNCTYPE(None, GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6732
+PFNGLPROGRAMLOCALPARAMETER4FVARBPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:6733
+PFNGLGETPROGRAMENVPARAMETERDVARBPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLdouble)) # GL/glext.h:6734
+PFNGLGETPROGRAMENVPARAMETERFVARBPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:6735
+PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLdouble)) # GL/glext.h:6736
+PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:6737
+PFNGLGETPROGRAMIVARBPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:6738
+PFNGLGETPROGRAMSTRINGARBPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:6739
+PFNGLGETVERTEXATTRIBDVARBPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLdouble)) # GL/glext.h:6740
+PFNGLGETVERTEXATTRIBFVARBPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:6741
+PFNGLGETVERTEXATTRIBIVARBPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:6742
+PFNGLGETVERTEXATTRIBPOINTERVARBPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:6743
+PFNGLISPROGRAMARBPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:6744
+# ARB_fragment_program (GL/glext.h:6747)
+GL_ARB_fragment_program = 1 # GL/glext.h:6748
+# ARB_vertex_buffer_object (GL/glext.h:6752)
+GL_ARB_vertex_buffer_object = 1 # GL/glext.h:6753
+# GL/glext.h:6755
+glBindBufferARB = _link_function('glBindBufferARB', None, [GLenum, GLuint], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:6756
+glDeleteBuffersARB = _link_function('glDeleteBuffersARB', None, [GLsizei, POINTER(GLuint)], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:6757
+glGenBuffersARB = _link_function('glGenBuffersARB', None, [GLsizei, POINTER(GLuint)], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:6758
+glIsBufferARB = _link_function('glIsBufferARB', GLboolean, [GLuint], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:6759
+glBufferDataARB = _link_function('glBufferDataARB', None, [GLenum, GLsizeiptrARB, POINTER(GLvoid), GLenum], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:6760
+glBufferSubDataARB = _link_function('glBufferSubDataARB', None, [GLenum, GLintptrARB, GLsizeiptrARB, POINTER(GLvoid)], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:6761
+glGetBufferSubDataARB = _link_function('glGetBufferSubDataARB', None, [GLenum, GLintptrARB, GLsizeiptrARB, POINTER(GLvoid)], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:6762
+glMapBufferARB = _link_function('glMapBufferARB', POINTER(GLvoid), [GLenum, GLenum], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:6763
+glUnmapBufferARB = _link_function('glUnmapBufferARB', GLboolean, [GLenum], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:6764
+glGetBufferParameterivARB = _link_function('glGetBufferParameterivARB', None, [GLenum, GLenum, POINTER(GLint)], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:6765
+glGetBufferPointervARB = _link_function('glGetBufferPointervARB', None, [GLenum, GLenum, POINTER(POINTER(GLvoid))], 'ARB_vertex_buffer_object')
+
+PFNGLBINDBUFFERARBPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:6767
+PFNGLDELETEBUFFERSARBPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:6768
+PFNGLGENBUFFERSARBPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:6769
+PFNGLISBUFFERARBPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:6770
+PFNGLBUFFERDATAARBPROC = CFUNCTYPE(None, GLenum, GLsizeiptrARB, POINTER(GLvoid), GLenum) # GL/glext.h:6771
+PFNGLBUFFERSUBDATAARBPROC = CFUNCTYPE(None, GLenum, GLintptrARB, GLsizeiptrARB, POINTER(GLvoid)) # GL/glext.h:6772
+PFNGLGETBUFFERSUBDATAARBPROC = CFUNCTYPE(None, GLenum, GLintptrARB, GLsizeiptrARB, POINTER(GLvoid)) # GL/glext.h:6773
+PFNGLMAPBUFFERARBPROC = CFUNCTYPE(POINTER(GLvoid), GLenum, GLenum) # GL/glext.h:6774
+PFNGLUNMAPBUFFERARBPROC = CFUNCTYPE(GLboolean, GLenum) # GL/glext.h:6775
+PFNGLGETBUFFERPARAMETERIVARBPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:6776
+PFNGLGETBUFFERPOINTERVARBPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:6777
+# ARB_occlusion_query (GL/glext.h:6780)
+GL_ARB_occlusion_query = 1 # GL/glext.h:6781
+# GL/glext.h:6783
+glGenQueriesARB = _link_function('glGenQueriesARB', None, [GLsizei, POINTER(GLuint)], 'ARB_occlusion_query')
+
+# GL/glext.h:6784
+glDeleteQueriesARB = _link_function('glDeleteQueriesARB', None, [GLsizei, POINTER(GLuint)], 'ARB_occlusion_query')
+
+# GL/glext.h:6785
+glIsQueryARB = _link_function('glIsQueryARB', GLboolean, [GLuint], 'ARB_occlusion_query')
+
+# GL/glext.h:6786
+glBeginQueryARB = _link_function('glBeginQueryARB', None, [GLenum, GLuint], 'ARB_occlusion_query')
+
+# GL/glext.h:6787
+glEndQueryARB = _link_function('glEndQueryARB', None, [GLenum], 'ARB_occlusion_query')
+
+# GL/glext.h:6788
+glGetQueryivARB = _link_function('glGetQueryivARB', None, [GLenum, GLenum, POINTER(GLint)], 'ARB_occlusion_query')
+
+# GL/glext.h:6789
+glGetQueryObjectivARB = _link_function('glGetQueryObjectivARB', None, [GLuint, GLenum, POINTER(GLint)], 'ARB_occlusion_query')
+
+# GL/glext.h:6790
+glGetQueryObjectuivARB = _link_function('glGetQueryObjectuivARB', None, [GLuint, GLenum, POINTER(GLuint)], 'ARB_occlusion_query')
+
+PFNGLGENQUERIESARBPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:6792
+PFNGLDELETEQUERIESARBPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:6793
+PFNGLISQUERYARBPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:6794
+PFNGLBEGINQUERYARBPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:6795
+PFNGLENDQUERYARBPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:6796
+PFNGLGETQUERYIVARBPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:6797
+PFNGLGETQUERYOBJECTIVARBPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:6798
+PFNGLGETQUERYOBJECTUIVARBPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint)) # GL/glext.h:6799
+# ARB_shader_objects (GL/glext.h:6802)
+GL_ARB_shader_objects = 1 # GL/glext.h:6803
+# GL/glext.h:6805
+glDeleteObjectARB = _link_function('glDeleteObjectARB', None, [GLhandleARB], 'ARB_shader_objects')
+
+# GL/glext.h:6806
+glGetHandleARB = _link_function('glGetHandleARB', GLhandleARB, [GLenum], 'ARB_shader_objects')
+
+# GL/glext.h:6807
+glDetachObjectARB = _link_function('glDetachObjectARB', None, [GLhandleARB, GLhandleARB], 'ARB_shader_objects')
+
+# GL/glext.h:6808
+glCreateShaderObjectARB = _link_function('glCreateShaderObjectARB', GLhandleARB, [GLenum], 'ARB_shader_objects')
+
+# GL/glext.h:6809
+glShaderSourceARB = _link_function('glShaderSourceARB', None, [GLhandleARB, GLsizei, POINTER(POINTER(GLcharARB)), POINTER(GLint)], 'ARB_shader_objects')
+
+# GL/glext.h:6810
+glCompileShaderARB = _link_function('glCompileShaderARB', None, [GLhandleARB], 'ARB_shader_objects')
+
+# GL/glext.h:6811
+glCreateProgramObjectARB = _link_function('glCreateProgramObjectARB', GLhandleARB, [], 'ARB_shader_objects')
+
+# GL/glext.h:6812
+glAttachObjectARB = _link_function('glAttachObjectARB', None, [GLhandleARB, GLhandleARB], 'ARB_shader_objects')
+
+# GL/glext.h:6813
+glLinkProgramARB = _link_function('glLinkProgramARB', None, [GLhandleARB], 'ARB_shader_objects')
+
+# GL/glext.h:6814
+glUseProgramObjectARB = _link_function('glUseProgramObjectARB', None, [GLhandleARB], 'ARB_shader_objects')
+
+# GL/glext.h:6815
+glValidateProgramARB = _link_function('glValidateProgramARB', None, [GLhandleARB], 'ARB_shader_objects')
+
+# GL/glext.h:6816
+glUniform1fARB = _link_function('glUniform1fARB', None, [GLint, GLfloat], 'ARB_shader_objects')
+
+# GL/glext.h:6817
+glUniform2fARB = _link_function('glUniform2fARB', None, [GLint, GLfloat, GLfloat], 'ARB_shader_objects')
+
+# GL/glext.h:6818
+glUniform3fARB = _link_function('glUniform3fARB', None, [GLint, GLfloat, GLfloat, GLfloat], 'ARB_shader_objects')
+
+# GL/glext.h:6819
+glUniform4fARB = _link_function('glUniform4fARB', None, [GLint, GLfloat, GLfloat, GLfloat, GLfloat], 'ARB_shader_objects')
+
+# GL/glext.h:6820
+glUniform1iARB = _link_function('glUniform1iARB', None, [GLint, GLint], 'ARB_shader_objects')
+
+# GL/glext.h:6821
+glUniform2iARB = _link_function('glUniform2iARB', None, [GLint, GLint, GLint], 'ARB_shader_objects')
+
+# GL/glext.h:6822
+glUniform3iARB = _link_function('glUniform3iARB', None, [GLint, GLint, GLint, GLint], 'ARB_shader_objects')
+
+# GL/glext.h:6823
+glUniform4iARB = _link_function('glUniform4iARB', None, [GLint, GLint, GLint, GLint, GLint], 'ARB_shader_objects')
+
+# GL/glext.h:6824
+glUniform1fvARB = _link_function('glUniform1fvARB', None, [GLint, GLsizei, POINTER(GLfloat)], 'ARB_shader_objects')
+
+# GL/glext.h:6825
+glUniform2fvARB = _link_function('glUniform2fvARB', None, [GLint, GLsizei, POINTER(GLfloat)], 'ARB_shader_objects')
+
+# GL/glext.h:6826
+glUniform3fvARB = _link_function('glUniform3fvARB', None, [GLint, GLsizei, POINTER(GLfloat)], 'ARB_shader_objects')
+
+# GL/glext.h:6827
+glUniform4fvARB = _link_function('glUniform4fvARB', None, [GLint, GLsizei, POINTER(GLfloat)], 'ARB_shader_objects')
+
+# GL/glext.h:6828
+glUniform1ivARB = _link_function('glUniform1ivARB', None, [GLint, GLsizei, POINTER(GLint)], 'ARB_shader_objects')
+
+# GL/glext.h:6829
+glUniform2ivARB = _link_function('glUniform2ivARB', None, [GLint, GLsizei, POINTER(GLint)], 'ARB_shader_objects')
+
+# GL/glext.h:6830
+glUniform3ivARB = _link_function('glUniform3ivARB', None, [GLint, GLsizei, POINTER(GLint)], 'ARB_shader_objects')
+
+# GL/glext.h:6831
+glUniform4ivARB = _link_function('glUniform4ivARB', None, [GLint, GLsizei, POINTER(GLint)], 'ARB_shader_objects')
+
+# GL/glext.h:6832
+glUniformMatrix2fvARB = _link_function('glUniformMatrix2fvARB', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'ARB_shader_objects')
+
+# GL/glext.h:6833
+glUniformMatrix3fvARB = _link_function('glUniformMatrix3fvARB', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'ARB_shader_objects')
+
+# GL/glext.h:6834
+glUniformMatrix4fvARB = _link_function('glUniformMatrix4fvARB', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'ARB_shader_objects')
+
+# GL/glext.h:6835
+glGetObjectParameterfvARB = _link_function('glGetObjectParameterfvARB', None, [GLhandleARB, GLenum, POINTER(GLfloat)], 'ARB_shader_objects')
+
+# GL/glext.h:6836
+glGetObjectParameterivARB = _link_function('glGetObjectParameterivARB', None, [GLhandleARB, GLenum, POINTER(GLint)], 'ARB_shader_objects')
+
+# GL/glext.h:6837
+glGetInfoLogARB = _link_function('glGetInfoLogARB', None, [GLhandleARB, GLsizei, POINTER(GLsizei), POINTER(GLcharARB)], 'ARB_shader_objects')
+
+# GL/glext.h:6838
+glGetAttachedObjectsARB = _link_function('glGetAttachedObjectsARB', None, [GLhandleARB, GLsizei, POINTER(GLsizei), POINTER(GLhandleARB)], 'ARB_shader_objects')
+
+# GL/glext.h:6839
+glGetUniformLocationARB = _link_function('glGetUniformLocationARB', GLint, [GLhandleARB, POINTER(GLcharARB)], 'ARB_shader_objects')
+
+# GL/glext.h:6840
+glGetActiveUniformARB = _link_function('glGetActiveUniformARB', None, [GLhandleARB, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLcharARB)], 'ARB_shader_objects')
+
+# GL/glext.h:6841
+glGetUniformfvARB = _link_function('glGetUniformfvARB', None, [GLhandleARB, GLint, POINTER(GLfloat)], 'ARB_shader_objects')
+
+# GL/glext.h:6842
+glGetUniformivARB = _link_function('glGetUniformivARB', None, [GLhandleARB, GLint, POINTER(GLint)], 'ARB_shader_objects')
+
+# GL/glext.h:6843
+glGetShaderSourceARB = _link_function('glGetShaderSourceARB', None, [GLhandleARB, GLsizei, POINTER(GLsizei), POINTER(GLcharARB)], 'ARB_shader_objects')
+
+PFNGLDELETEOBJECTARBPROC = CFUNCTYPE(None, GLhandleARB) # GL/glext.h:6845
+PFNGLGETHANDLEARBPROC = CFUNCTYPE(GLhandleARB, GLenum) # GL/glext.h:6846
+PFNGLDETACHOBJECTARBPROC = CFUNCTYPE(None, GLhandleARB, GLhandleARB) # GL/glext.h:6847
+PFNGLCREATESHADEROBJECTARBPROC = CFUNCTYPE(GLhandleARB, GLenum) # GL/glext.h:6848
+PFNGLSHADERSOURCEARBPROC = CFUNCTYPE(None, GLhandleARB, GLsizei, POINTER(POINTER(GLcharARB)), POINTER(GLint)) # GL/glext.h:6849
+PFNGLCOMPILESHADERARBPROC = CFUNCTYPE(None, GLhandleARB) # GL/glext.h:6850
+PFNGLCREATEPROGRAMOBJECTARBPROC = CFUNCTYPE(GLhandleARB) # GL/glext.h:6851
+PFNGLATTACHOBJECTARBPROC = CFUNCTYPE(None, GLhandleARB, GLhandleARB) # GL/glext.h:6852
+PFNGLLINKPROGRAMARBPROC = CFUNCTYPE(None, GLhandleARB) # GL/glext.h:6853
+PFNGLUSEPROGRAMOBJECTARBPROC = CFUNCTYPE(None, GLhandleARB) # GL/glext.h:6854
+PFNGLVALIDATEPROGRAMARBPROC = CFUNCTYPE(None, GLhandleARB) # GL/glext.h:6855
+PFNGLUNIFORM1FARBPROC = CFUNCTYPE(None, GLint, GLfloat) # GL/glext.h:6856
+PFNGLUNIFORM2FARBPROC = CFUNCTYPE(None, GLint, GLfloat, GLfloat) # GL/glext.h:6857
+PFNGLUNIFORM3FARBPROC = CFUNCTYPE(None, GLint, GLfloat, GLfloat, GLfloat) # GL/glext.h:6858
+PFNGLUNIFORM4FARBPROC = CFUNCTYPE(None, GLint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6859
+PFNGLUNIFORM1IARBPROC = CFUNCTYPE(None, GLint, GLint) # GL/glext.h:6860
+PFNGLUNIFORM2IARBPROC = CFUNCTYPE(None, GLint, GLint, GLint) # GL/glext.h:6861
+PFNGLUNIFORM3IARBPROC = CFUNCTYPE(None, GLint, GLint, GLint, GLint) # GL/glext.h:6862
+PFNGLUNIFORM4IARBPROC = CFUNCTYPE(None, GLint, GLint, GLint, GLint, GLint) # GL/glext.h:6863
+PFNGLUNIFORM1FVARBPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:6864
+PFNGLUNIFORM2FVARBPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:6865
+PFNGLUNIFORM3FVARBPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:6866
+PFNGLUNIFORM4FVARBPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:6867
+PFNGLUNIFORM1IVARBPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:6868
+PFNGLUNIFORM2IVARBPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:6869
+PFNGLUNIFORM3IVARBPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:6870
+PFNGLUNIFORM4IVARBPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:6871
+PFNGLUNIFORMMATRIX2FVARBPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:6872
+PFNGLUNIFORMMATRIX3FVARBPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:6873
+PFNGLUNIFORMMATRIX4FVARBPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:6874
+PFNGLGETOBJECTPARAMETERFVARBPROC = CFUNCTYPE(None, GLhandleARB, GLenum, POINTER(GLfloat)) # GL/glext.h:6875
+PFNGLGETOBJECTPARAMETERIVARBPROC = CFUNCTYPE(None, GLhandleARB, GLenum, POINTER(GLint)) # GL/glext.h:6876
+PFNGLGETINFOLOGARBPROC = CFUNCTYPE(None, GLhandleARB, GLsizei, POINTER(GLsizei), POINTER(GLcharARB)) # GL/glext.h:6877
+PFNGLGETATTACHEDOBJECTSARBPROC = CFUNCTYPE(None, GLhandleARB, GLsizei, POINTER(GLsizei), POINTER(GLhandleARB)) # GL/glext.h:6878
+PFNGLGETUNIFORMLOCATIONARBPROC = CFUNCTYPE(GLint, GLhandleARB, POINTER(GLcharARB)) # GL/glext.h:6879
+PFNGLGETACTIVEUNIFORMARBPROC = CFUNCTYPE(None, GLhandleARB, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLcharARB)) # GL/glext.h:6880
+PFNGLGETUNIFORMFVARBPROC = CFUNCTYPE(None, GLhandleARB, GLint, POINTER(GLfloat)) # GL/glext.h:6881
+PFNGLGETUNIFORMIVARBPROC = CFUNCTYPE(None, GLhandleARB, GLint, POINTER(GLint)) # GL/glext.h:6882
+PFNGLGETSHADERSOURCEARBPROC = CFUNCTYPE(None, GLhandleARB, GLsizei, POINTER(GLsizei), POINTER(GLcharARB)) # GL/glext.h:6883
+# ARB_vertex_shader (GL/glext.h:6886)
+GL_ARB_vertex_shader = 1 # GL/glext.h:6887
+# GL/glext.h:6889
+glBindAttribLocationARB = _link_function('glBindAttribLocationARB', None, [GLhandleARB, GLuint, POINTER(GLcharARB)], 'ARB_vertex_shader')
+
+# GL/glext.h:6890
+glGetActiveAttribARB = _link_function('glGetActiveAttribARB', None, [GLhandleARB, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLcharARB)], 'ARB_vertex_shader')
+
+# GL/glext.h:6891
+glGetAttribLocationARB = _link_function('glGetAttribLocationARB', GLint, [GLhandleARB, POINTER(GLcharARB)], 'ARB_vertex_shader')
+
+PFNGLBINDATTRIBLOCATIONARBPROC = CFUNCTYPE(None, GLhandleARB, GLuint, POINTER(GLcharARB)) # GL/glext.h:6893
+PFNGLGETACTIVEATTRIBARBPROC = CFUNCTYPE(None, GLhandleARB, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLcharARB)) # GL/glext.h:6894
+PFNGLGETATTRIBLOCATIONARBPROC = CFUNCTYPE(GLint, GLhandleARB, POINTER(GLcharARB)) # GL/glext.h:6895
+# ARB_fragment_shader (GL/glext.h:6898)
+GL_ARB_fragment_shader = 1 # GL/glext.h:6899
+# ARB_shading_language_100 (GL/glext.h:6902)
+GL_ARB_shading_language_100 = 1 # GL/glext.h:6903
+# ARB_texture_non_power_of_two (GL/glext.h:6906)
+GL_ARB_texture_non_power_of_two = 1 # GL/glext.h:6907
+# ARB_point_sprite (GL/glext.h:6910)
+GL_ARB_point_sprite = 1 # GL/glext.h:6911
+# ARB_fragment_program_shadow (GL/glext.h:6914)
+GL_ARB_fragment_program_shadow = 1 # GL/glext.h:6915
+# ARB_draw_buffers (GL/glext.h:6918)
+GL_ARB_draw_buffers = 1 # GL/glext.h:6919
+# GL/glext.h:6921
+glDrawBuffersARB = _link_function('glDrawBuffersARB', None, [GLsizei, POINTER(GLenum)], 'ARB_draw_buffers')
+
+PFNGLDRAWBUFFERSARBPROC = CFUNCTYPE(None, GLsizei, POINTER(GLenum)) # GL/glext.h:6923
+# ARB_texture_rectangle (GL/glext.h:6926)
+GL_ARB_texture_rectangle = 1 # GL/glext.h:6927
+# ARB_color_buffer_float (GL/glext.h:6930)
+GL_ARB_color_buffer_float = 1 # GL/glext.h:6931
+# GL/glext.h:6933
+glClampColorARB = _link_function('glClampColorARB', None, [GLenum, GLenum], 'ARB_color_buffer_float')
+
+PFNGLCLAMPCOLORARBPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:6935
+# ARB_half_float_pixel (GL/glext.h:6938)
+GL_ARB_half_float_pixel = 1 # GL/glext.h:6939
+# ARB_texture_float (GL/glext.h:6942)
+GL_ARB_texture_float = 1 # GL/glext.h:6943
+# ARB_pixel_buffer_object (GL/glext.h:6946)
+GL_ARB_pixel_buffer_object = 1 # GL/glext.h:6947
+# ARB_depth_buffer_float (GL/glext.h:6950)
+GL_ARB_depth_buffer_float = 1 # GL/glext.h:6951
+# ARB_draw_instanced (GL/glext.h:6954)
+GL_ARB_draw_instanced = 1 # GL/glext.h:6955
+# GL/glext.h:6957
+glDrawArraysInstancedARB = _link_function('glDrawArraysInstancedARB', None, [GLenum, GLint, GLsizei, GLsizei], 'ARB_draw_instanced')
+
+# GL/glext.h:6958
+glDrawElementsInstancedARB = _link_function('glDrawElementsInstancedARB', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei], 'ARB_draw_instanced')
+
+PFNGLDRAWARRAYSINSTANCEDARBPROC = CFUNCTYPE(None, GLenum, GLint, GLsizei, GLsizei) # GL/glext.h:6960
+PFNGLDRAWELEMENTSINSTANCEDARBPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei) # GL/glext.h:6961
+# ARB_framebuffer_object (GL/glext.h:6964)
+GL_ARB_framebuffer_object = 1 # GL/glext.h:6965
+# GL/glext.h:6967
+glIsRenderbuffer = _link_function('glIsRenderbuffer', GLboolean, [GLuint], 'ARB_framebuffer_object')
+
+# GL/glext.h:6968
+glBindRenderbuffer = _link_function('glBindRenderbuffer', None, [GLenum, GLuint], 'ARB_framebuffer_object')
+
+# GL/glext.h:6969
+glDeleteRenderbuffers = _link_function('glDeleteRenderbuffers', None, [GLsizei, POINTER(GLuint)], 'ARB_framebuffer_object')
+
+# GL/glext.h:6970
+glGenRenderbuffers = _link_function('glGenRenderbuffers', None, [GLsizei, POINTER(GLuint)], 'ARB_framebuffer_object')
+
+# GL/glext.h:6971
+glRenderbufferStorage = _link_function('glRenderbufferStorage', None, [GLenum, GLenum, GLsizei, GLsizei], 'ARB_framebuffer_object')
+
+# GL/glext.h:6972
+glGetRenderbufferParameteriv = _link_function('glGetRenderbufferParameteriv', None, [GLenum, GLenum, POINTER(GLint)], 'ARB_framebuffer_object')
+
+# GL/glext.h:6973
+glIsFramebuffer = _link_function('glIsFramebuffer', GLboolean, [GLuint], 'ARB_framebuffer_object')
+
+# GL/glext.h:6974
+glBindFramebuffer = _link_function('glBindFramebuffer', None, [GLenum, GLuint], 'ARB_framebuffer_object')
+
+# GL/glext.h:6975
+glDeleteFramebuffers = _link_function('glDeleteFramebuffers', None, [GLsizei, POINTER(GLuint)], 'ARB_framebuffer_object')
+
+# GL/glext.h:6976
+glGenFramebuffers = _link_function('glGenFramebuffers', None, [GLsizei, POINTER(GLuint)], 'ARB_framebuffer_object')
+
+# GL/glext.h:6977
+glCheckFramebufferStatus = _link_function('glCheckFramebufferStatus', GLenum, [GLenum], 'ARB_framebuffer_object')
+
+# GL/glext.h:6978
+glFramebufferTexture1D = _link_function('glFramebufferTexture1D', None, [GLenum, GLenum, GLenum, GLuint, GLint], 'ARB_framebuffer_object')
+
+# GL/glext.h:6979
+glFramebufferTexture2D = _link_function('glFramebufferTexture2D', None, [GLenum, GLenum, GLenum, GLuint, GLint], 'ARB_framebuffer_object')
+
+# GL/glext.h:6980
+glFramebufferTexture3D = _link_function('glFramebufferTexture3D', None, [GLenum, GLenum, GLenum, GLuint, GLint, GLint], 'ARB_framebuffer_object')
+
+# GL/glext.h:6981
+glFramebufferRenderbuffer = _link_function('glFramebufferRenderbuffer', None, [GLenum, GLenum, GLenum, GLuint], 'ARB_framebuffer_object')
+
+# GL/glext.h:6982
+glGetFramebufferAttachmentParameteriv = _link_function('glGetFramebufferAttachmentParameteriv', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'ARB_framebuffer_object')
+
+# GL/glext.h:6983
+glGenerateMipmap = _link_function('glGenerateMipmap', None, [GLenum], 'ARB_framebuffer_object')
+
+GLbitfield = c_uint # /usr/include/GL/gl.h:151
+# GL/glext.h:6984
+glBlitFramebuffer = _link_function('glBlitFramebuffer', None, [GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum], 'ARB_framebuffer_object')
+
+# GL/glext.h:6985
+glRenderbufferStorageMultisample = _link_function('glRenderbufferStorageMultisample', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei], 'ARB_framebuffer_object')
+
+# GL/glext.h:6986
+glFramebufferTextureLayer = _link_function('glFramebufferTextureLayer', None, [GLenum, GLenum, GLuint, GLint, GLint], 'ARB_framebuffer_object')
+
+PFNGLISRENDERBUFFERPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:6988
+PFNGLBINDRENDERBUFFERPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:6989
+PFNGLDELETERENDERBUFFERSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:6990
+PFNGLGENRENDERBUFFERSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:6991
+PFNGLRENDERBUFFERSTORAGEPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, GLsizei) # GL/glext.h:6992
+PFNGLGETRENDERBUFFERPARAMETERIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:6993
+PFNGLISFRAMEBUFFERPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:6994
+PFNGLBINDFRAMEBUFFERPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:6995
+PFNGLDELETEFRAMEBUFFERSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:6996
+PFNGLGENFRAMEBUFFERSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:6997
+PFNGLCHECKFRAMEBUFFERSTATUSPROC = CFUNCTYPE(GLenum, GLenum) # GL/glext.h:6998
+PFNGLFRAMEBUFFERTEXTURE1DPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLuint, GLint) # GL/glext.h:6999
+PFNGLFRAMEBUFFERTEXTURE2DPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLuint, GLint) # GL/glext.h:7000
+PFNGLFRAMEBUFFERTEXTURE3DPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLuint, GLint, GLint) # GL/glext.h:7001
+PFNGLFRAMEBUFFERRENDERBUFFERPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLuint) # GL/glext.h:7002
+PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:7003
+PFNGLGENERATEMIPMAPPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:7004
+PFNGLBLITFRAMEBUFFERPROC = CFUNCTYPE(None, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum) # GL/glext.h:7005
+PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, GLsizei, GLsizei) # GL/glext.h:7006
+PFNGLFRAMEBUFFERTEXTURELAYERPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLint, GLint) # GL/glext.h:7007
+# ARB_framebuffer_sRGB (GL/glext.h:7010)
+GL_ARB_framebuffer_sRGB = 1 # GL/glext.h:7011
+# ARB_geometry_shader4 (GL/glext.h:7014)
+GL_ARB_geometry_shader4 = 1 # GL/glext.h:7015
+# GL/glext.h:7017
+glProgramParameteriARB = _link_function('glProgramParameteriARB', None, [GLuint, GLenum, GLint], 'ARB_geometry_shader4')
+
+# GL/glext.h:7018
+glFramebufferTextureARB = _link_function('glFramebufferTextureARB', None, [GLenum, GLenum, GLuint, GLint], 'ARB_geometry_shader4')
+
+# GL/glext.h:7019
+glFramebufferTextureLayerARB = _link_function('glFramebufferTextureLayerARB', None, [GLenum, GLenum, GLuint, GLint, GLint], 'ARB_geometry_shader4')
+
+# GL/glext.h:7020
+glFramebufferTextureFaceARB = _link_function('glFramebufferTextureFaceARB', None, [GLenum, GLenum, GLuint, GLint, GLenum], 'ARB_geometry_shader4')
+
+PFNGLPROGRAMPARAMETERIARBPROC = CFUNCTYPE(None, GLuint, GLenum, GLint) # GL/glext.h:7022
+PFNGLFRAMEBUFFERTEXTUREARBPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLint) # GL/glext.h:7023
+PFNGLFRAMEBUFFERTEXTURELAYERARBPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLint, GLint) # GL/glext.h:7024
+PFNGLFRAMEBUFFERTEXTUREFACEARBPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLint, GLenum) # GL/glext.h:7025
+# ARB_half_float_vertex (GL/glext.h:7028)
+GL_ARB_half_float_vertex = 1 # GL/glext.h:7029
+# ARB_instanced_arrays (GL/glext.h:7032)
+GL_ARB_instanced_arrays = 1 # GL/glext.h:7033
+# GL/glext.h:7035
+glVertexAttribDivisorARB = _link_function('glVertexAttribDivisorARB', None, [GLuint, GLuint], 'ARB_instanced_arrays')
+
+PFNGLVERTEXATTRIBDIVISORARBPROC = CFUNCTYPE(None, GLuint, GLuint) # GL/glext.h:7037
+# ARB_map_buffer_range (GL/glext.h:7040)
+GL_ARB_map_buffer_range = 1 # GL/glext.h:7041
+# GL/glext.h:7043
+glMapBufferRange = _link_function('glMapBufferRange', POINTER(GLvoid), [GLenum, GLintptr, GLsizeiptr, GLbitfield], 'ARB_map_buffer_range')
+
+# GL/glext.h:7044
+glFlushMappedBufferRange = _link_function('glFlushMappedBufferRange', None, [GLenum, GLintptr, GLsizeiptr], 'ARB_map_buffer_range')
+
+PFNGLMAPBUFFERRANGEPROC = CFUNCTYPE(POINTER(GLvoid), GLenum, GLintptr, GLsizeiptr, GLbitfield) # GL/glext.h:7046
+PFNGLFLUSHMAPPEDBUFFERRANGEPROC = CFUNCTYPE(None, GLenum, GLintptr, GLsizeiptr) # GL/glext.h:7047
+# ARB_texture_buffer_object (GL/glext.h:7050)
+GL_ARB_texture_buffer_object = 1 # GL/glext.h:7051
+# GL/glext.h:7053
+glTexBufferARB = _link_function('glTexBufferARB', None, [GLenum, GLenum, GLuint], 'ARB_texture_buffer_object')
+
+PFNGLTEXBUFFERARBPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint) # GL/glext.h:7055
+# ARB_texture_compression_rgtc (GL/glext.h:7058)
+GL_ARB_texture_compression_rgtc = 1 # GL/glext.h:7059
+# ARB_texture_rg (GL/glext.h:7062)
+GL_ARB_texture_rg = 1 # GL/glext.h:7063
+# ARB_vertex_array_object (GL/glext.h:7066)
+GL_ARB_vertex_array_object = 1 # GL/glext.h:7067
+# GL/glext.h:7069
+glBindVertexArray = _link_function('glBindVertexArray', None, [GLuint], 'ARB_vertex_array_object')
+
+# GL/glext.h:7070
+glDeleteVertexArrays = _link_function('glDeleteVertexArrays', None, [GLsizei, POINTER(GLuint)], 'ARB_vertex_array_object')
+
+# GL/glext.h:7071
+glGenVertexArrays = _link_function('glGenVertexArrays', None, [GLsizei, POINTER(GLuint)], 'ARB_vertex_array_object')
+
+# GL/glext.h:7072
+glIsVertexArray = _link_function('glIsVertexArray', GLboolean, [GLuint], 'ARB_vertex_array_object')
+
+PFNGLBINDVERTEXARRAYPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:7074
+PFNGLDELETEVERTEXARRAYSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:7075
+PFNGLGENVERTEXARRAYSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:7076
+PFNGLISVERTEXARRAYPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:7077
+# ARB_uniform_buffer_object (GL/glext.h:7080)
+GL_ARB_uniform_buffer_object = 1 # GL/glext.h:7081
+# GL/glext.h:7083
+glGetUniformIndices = _link_function('glGetUniformIndices', None, [GLuint, GLsizei, POINTER(POINTER(GLchar)), POINTER(GLuint)], 'ARB_uniform_buffer_object')
+
+# GL/glext.h:7084
+glGetActiveUniformsiv = _link_function('glGetActiveUniformsiv', None, [GLuint, GLsizei, POINTER(GLuint), GLenum, POINTER(GLint)], 'ARB_uniform_buffer_object')
+
+# GL/glext.h:7085
+glGetActiveUniformName = _link_function('glGetActiveUniformName', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], 'ARB_uniform_buffer_object')
+
+# GL/glext.h:7086
+glGetUniformBlockIndex = _link_function('glGetUniformBlockIndex', GLuint, [GLuint, POINTER(GLchar)], 'ARB_uniform_buffer_object')
+
+# GL/glext.h:7087
+glGetActiveUniformBlockiv = _link_function('glGetActiveUniformBlockiv', None, [GLuint, GLuint, GLenum, POINTER(GLint)], 'ARB_uniform_buffer_object')
+
+# GL/glext.h:7088
+glGetActiveUniformBlockName = _link_function('glGetActiveUniformBlockName', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], 'ARB_uniform_buffer_object')
+
+# GL/glext.h:7089
+glUniformBlockBinding = _link_function('glUniformBlockBinding', None, [GLuint, GLuint, GLuint], 'ARB_uniform_buffer_object')
+
+PFNGLGETUNIFORMINDICESPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(POINTER(GLchar)), POINTER(GLuint)) # GL/glext.h:7091
+PFNGLGETACTIVEUNIFORMSIVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLuint), GLenum, POINTER(GLint)) # GL/glext.h:7092
+PFNGLGETACTIVEUNIFORMNAMEPROC = CFUNCTYPE(None, GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)) # GL/glext.h:7093
+PFNGLGETUNIFORMBLOCKINDEXPROC = CFUNCTYPE(GLuint, GLuint, POINTER(GLchar)) # GL/glext.h:7094
+PFNGLGETACTIVEUNIFORMBLOCKIVPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:7095
+PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC = CFUNCTYPE(None, GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)) # GL/glext.h:7096
+PFNGLUNIFORMBLOCKBINDINGPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint) # GL/glext.h:7097
+# ARB_compatibility (GL/glext.h:7100)
+GL_ARB_compatibility = 1 # GL/glext.h:7101
+# ARB_copy_buffer (GL/glext.h:7104)
+GL_ARB_copy_buffer = 1 # GL/glext.h:7105
+# GL/glext.h:7107
+glCopyBufferSubData = _link_function('glCopyBufferSubData', None, [GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr], 'ARB_copy_buffer')
+
+PFNGLCOPYBUFFERSUBDATAPROC = CFUNCTYPE(None, GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr) # GL/glext.h:7109
+# ARB_shader_texture_lod (GL/glext.h:7112)
+GL_ARB_shader_texture_lod = 1 # GL/glext.h:7113
+# ARB_depth_clamp (GL/glext.h:7116)
+GL_ARB_depth_clamp = 1 # GL/glext.h:7117
+# ARB_draw_elements_base_vertex (GL/glext.h:7120)
+GL_ARB_draw_elements_base_vertex = 1 # GL/glext.h:7121
+# GL/glext.h:7123
+glDrawElementsBaseVertex = _link_function('glDrawElementsBaseVertex', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid), GLint], 'ARB_draw_elements_base_vertex')
+
+# GL/glext.h:7124
+glDrawRangeElementsBaseVertex = _link_function('glDrawRangeElementsBaseVertex', None, [GLenum, GLuint, GLuint, GLsizei, GLenum, POINTER(GLvoid), GLint], 'ARB_draw_elements_base_vertex')
+
+# GL/glext.h:7125
+glDrawElementsInstancedBaseVertex = _link_function('glDrawElementsInstancedBaseVertex', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei, GLint], 'ARB_draw_elements_base_vertex')
+
+# GL/glext.h:7126
+glMultiDrawElementsBaseVertex = _link_function('glMultiDrawElementsBaseVertex', None, [GLenum, POINTER(GLsizei), GLenum, POINTER(POINTER(GLvoid)), GLsizei, POINTER(GLint)], 'ARB_draw_elements_base_vertex')
+
+PFNGLDRAWELEMENTSBASEVERTEXPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, POINTER(GLvoid), GLint) # GL/glext.h:7128
+PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLsizei, GLenum, POINTER(GLvoid), GLint) # GL/glext.h:7129
+PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei, GLint) # GL/glext.h:7130
+PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC = CFUNCTYPE(None, GLenum, POINTER(GLsizei), GLenum, POINTER(POINTER(GLvoid)), GLsizei, POINTER(GLint)) # GL/glext.h:7131
+# ARB_fragment_coord_conventions (GL/glext.h:7134)
+GL_ARB_fragment_coord_conventions = 1 # GL/glext.h:7135
+# ARB_provoking_vertex (GL/glext.h:7138)
+GL_ARB_provoking_vertex = 1 # GL/glext.h:7139
+# GL/glext.h:7141
+glProvokingVertex = _link_function('glProvokingVertex', None, [GLenum], 'ARB_provoking_vertex')
+
+PFNGLPROVOKINGVERTEXPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:7143
+# ARB_seamless_cube_map (GL/glext.h:7146)
+GL_ARB_seamless_cube_map = 1 # GL/glext.h:7147
+# ARB_sync (GL/glext.h:7150)
+GL_ARB_sync = 1 # GL/glext.h:7151
+# GL/glext.h:7153
+glFenceSync = _link_function('glFenceSync', GLsync, [GLenum, GLbitfield], 'ARB_sync')
+
+# GL/glext.h:7154
+glIsSync = _link_function('glIsSync', GLboolean, [GLsync], 'ARB_sync')
+
+# GL/glext.h:7155
+glDeleteSync = _link_function('glDeleteSync', None, [GLsync], 'ARB_sync')
+
+# GL/glext.h:7156
+glClientWaitSync = _link_function('glClientWaitSync', GLenum, [GLsync, GLbitfield, GLuint64], 'ARB_sync')
+
+# GL/glext.h:7157
+glWaitSync = _link_function('glWaitSync', None, [GLsync, GLbitfield, GLuint64], 'ARB_sync')
+
+# GL/glext.h:7158
+glGetInteger64v = _link_function('glGetInteger64v', None, [GLenum, POINTER(GLint64)], 'ARB_sync')
+
+# GL/glext.h:7159
+glGetSynciv = _link_function('glGetSynciv', None, [GLsync, GLenum, GLsizei, POINTER(GLsizei), POINTER(GLint)], 'ARB_sync')
+
+PFNGLFENCESYNCPROC = CFUNCTYPE(GLsync, GLenum, GLbitfield) # GL/glext.h:7161
+PFNGLISSYNCPROC = CFUNCTYPE(GLboolean, GLsync) # GL/glext.h:7162
+PFNGLDELETESYNCPROC = CFUNCTYPE(None, GLsync) # GL/glext.h:7163
+PFNGLCLIENTWAITSYNCPROC = CFUNCTYPE(GLenum, GLsync, GLbitfield, GLuint64) # GL/glext.h:7164
+PFNGLWAITSYNCPROC = CFUNCTYPE(None, GLsync, GLbitfield, GLuint64) # GL/glext.h:7165
+PFNGLGETINTEGER64VPROC = CFUNCTYPE(None, GLenum, POINTER(GLint64)) # GL/glext.h:7166
+PFNGLGETSYNCIVPROC = CFUNCTYPE(None, GLsync, GLenum, GLsizei, POINTER(GLsizei), POINTER(GLint)) # GL/glext.h:7167
+# ARB_texture_multisample (GL/glext.h:7170)
+GL_ARB_texture_multisample = 1 # GL/glext.h:7171
+# GL/glext.h:7173
+glTexImage2DMultisample = _link_function('glTexImage2DMultisample', None, [GLenum, GLsizei, GLint, GLsizei, GLsizei, GLboolean], 'ARB_texture_multisample')
+
+# GL/glext.h:7174
+glTexImage3DMultisample = _link_function('glTexImage3DMultisample', None, [GLenum, GLsizei, GLint, GLsizei, GLsizei, GLsizei, GLboolean], 'ARB_texture_multisample')
+
+# GL/glext.h:7175
+glGetMultisamplefv = _link_function('glGetMultisamplefv', None, [GLenum, GLuint, POINTER(GLfloat)], 'ARB_texture_multisample')
+
+# GL/glext.h:7176
+glSampleMaski = _link_function('glSampleMaski', None, [GLuint, GLbitfield], 'ARB_texture_multisample')
+
+PFNGLTEXIMAGE2DMULTISAMPLEPROC = CFUNCTYPE(None, GLenum, GLsizei, GLint, GLsizei, GLsizei, GLboolean) # GL/glext.h:7178
+PFNGLTEXIMAGE3DMULTISAMPLEPROC = CFUNCTYPE(None, GLenum, GLsizei, GLint, GLsizei, GLsizei, GLsizei, GLboolean) # GL/glext.h:7179
+PFNGLGETMULTISAMPLEFVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:7180
+PFNGLSAMPLEMASKIPROC = CFUNCTYPE(None, GLuint, GLbitfield) # GL/glext.h:7181
+# ARB_vertex_array_bgra (GL/glext.h:7184)
+GL_ARB_vertex_array_bgra = 1 # GL/glext.h:7185
+# ARB_draw_buffers_blend (GL/glext.h:7188)
+GL_ARB_draw_buffers_blend = 1 # GL/glext.h:7189
+# GL/glext.h:7191
+glBlendEquationiARB = _link_function('glBlendEquationiARB', None, [GLuint, GLenum], 'ARB_draw_buffers_blend')
+
+# GL/glext.h:7192
+glBlendEquationSeparateiARB = _link_function('glBlendEquationSeparateiARB', None, [GLuint, GLenum, GLenum], 'ARB_draw_buffers_blend')
+
+# GL/glext.h:7193
+glBlendFunciARB = _link_function('glBlendFunciARB', None, [GLuint, GLenum, GLenum], 'ARB_draw_buffers_blend')
+
+# GL/glext.h:7194
+glBlendFuncSeparateiARB = _link_function('glBlendFuncSeparateiARB', None, [GLuint, GLenum, GLenum, GLenum, GLenum], 'ARB_draw_buffers_blend')
+
+PFNGLBLENDEQUATIONIARBPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:7196
+PFNGLBLENDEQUATIONSEPARATEIARBPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum) # GL/glext.h:7197
+PFNGLBLENDFUNCIARBPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum) # GL/glext.h:7198
+PFNGLBLENDFUNCSEPARATEIARBPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:7199
+# ARB_sample_shading (GL/glext.h:7202)
+GL_ARB_sample_shading = 1 # GL/glext.h:7203
+# GL/glext.h:7205
+glMinSampleShadingARB = _link_function('glMinSampleShadingARB', None, [GLfloat], 'ARB_sample_shading')
+
+PFNGLMINSAMPLESHADINGARBPROC = CFUNCTYPE(None, GLfloat) # GL/glext.h:7207
+# ARB_texture_cube_map_array (GL/glext.h:7210)
+GL_ARB_texture_cube_map_array = 1 # GL/glext.h:7211
+# ARB_texture_gather (GL/glext.h:7214)
+GL_ARB_texture_gather = 1 # GL/glext.h:7215
+# ARB_texture_query_lod (GL/glext.h:7218)
+GL_ARB_texture_query_lod = 1 # GL/glext.h:7219
+# ARB_shading_language_include (GL/glext.h:7222)
+GL_ARB_shading_language_include = 1 # GL/glext.h:7223
+# GL/glext.h:7225
+glNamedStringARB = _link_function('glNamedStringARB', None, [GLenum, GLint, POINTER(GLchar), GLint, POINTER(GLchar)], 'ARB_shading_language_include')
+
+# GL/glext.h:7226
+glDeleteNamedStringARB = _link_function('glDeleteNamedStringARB', None, [GLint, POINTER(GLchar)], 'ARB_shading_language_include')
+
+# GL/glext.h:7227
+glCompileShaderIncludeARB = _link_function('glCompileShaderIncludeARB', None, [GLuint, GLsizei, POINTER(POINTER(GLchar)), POINTER(GLint)], 'ARB_shading_language_include')
+
+# GL/glext.h:7228
+glIsNamedStringARB = _link_function('glIsNamedStringARB', GLboolean, [GLint, POINTER(GLchar)], 'ARB_shading_language_include')
+
+# GL/glext.h:7229
+glGetNamedStringARB = _link_function('glGetNamedStringARB', None, [GLint, POINTER(GLchar), GLsizei, POINTER(GLint), POINTER(GLchar)], 'ARB_shading_language_include')
+
+# GL/glext.h:7230
+glGetNamedStringivARB = _link_function('glGetNamedStringivARB', None, [GLint, POINTER(GLchar), GLenum, POINTER(GLint)], 'ARB_shading_language_include')
+
+PFNGLNAMEDSTRINGARBPROC = CFUNCTYPE(None, GLenum, GLint, POINTER(GLchar), GLint, POINTER(GLchar)) # GL/glext.h:7232
+PFNGLDELETENAMEDSTRINGARBPROC = CFUNCTYPE(None, GLint, POINTER(GLchar)) # GL/glext.h:7233
+PFNGLCOMPILESHADERINCLUDEARBPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(POINTER(GLchar)), POINTER(GLint)) # GL/glext.h:7234
+PFNGLISNAMEDSTRINGARBPROC = CFUNCTYPE(GLboolean, GLint, POINTER(GLchar)) # GL/glext.h:7235
+PFNGLGETNAMEDSTRINGARBPROC = CFUNCTYPE(None, GLint, POINTER(GLchar), GLsizei, POINTER(GLint), POINTER(GLchar)) # GL/glext.h:7236
+PFNGLGETNAMEDSTRINGIVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLchar), GLenum, POINTER(GLint)) # GL/glext.h:7237
+# ARB_texture_compression_bptc (GL/glext.h:7240)
+GL_ARB_texture_compression_bptc = 1 # GL/glext.h:7241
+# ARB_blend_func_extended (GL/glext.h:7244)
+GL_ARB_blend_func_extended = 1 # GL/glext.h:7245
+# GL/glext.h:7247
+glBindFragDataLocationIndexed = _link_function('glBindFragDataLocationIndexed', None, [GLuint, GLuint, GLuint, POINTER(GLchar)], 'ARB_blend_func_extended')
+
+# GL/glext.h:7248
+glGetFragDataIndex = _link_function('glGetFragDataIndex', GLint, [GLuint, POINTER(GLchar)], 'ARB_blend_func_extended')
+
+PFNGLBINDFRAGDATALOCATIONINDEXEDPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint, POINTER(GLchar)) # GL/glext.h:7250
+PFNGLGETFRAGDATAINDEXPROC = CFUNCTYPE(GLint, GLuint, POINTER(GLchar)) # GL/glext.h:7251
+# ARB_explicit_attrib_location (GL/glext.h:7254)
+GL_ARB_explicit_attrib_location = 1 # GL/glext.h:7255
+# ARB_occlusion_query2 (GL/glext.h:7258)
+GL_ARB_occlusion_query2 = 1 # GL/glext.h:7259
+# ARB_sampler_objects (GL/glext.h:7262)
+GL_ARB_sampler_objects = 1 # GL/glext.h:7263
+# GL/glext.h:7265
+glGenSamplers = _link_function('glGenSamplers', None, [GLsizei, POINTER(GLuint)], 'ARB_sampler_objects')
+
+# GL/glext.h:7266
+glDeleteSamplers = _link_function('glDeleteSamplers', None, [GLsizei, POINTER(GLuint)], 'ARB_sampler_objects')
+
+# GL/glext.h:7267
+glIsSampler = _link_function('glIsSampler', GLboolean, [GLuint], 'ARB_sampler_objects')
+
+# GL/glext.h:7268
+glBindSampler = _link_function('glBindSampler', None, [GLuint, GLuint], 'ARB_sampler_objects')
+
+# GL/glext.h:7269
+glSamplerParameteri = _link_function('glSamplerParameteri', None, [GLuint, GLenum, GLint], 'ARB_sampler_objects')
+
+# GL/glext.h:7270
+glSamplerParameteriv = _link_function('glSamplerParameteriv', None, [GLuint, GLenum, POINTER(GLint)], 'ARB_sampler_objects')
+
+# GL/glext.h:7271
+glSamplerParameterf = _link_function('glSamplerParameterf', None, [GLuint, GLenum, GLfloat], 'ARB_sampler_objects')
+
+# GL/glext.h:7272
+glSamplerParameterfv = _link_function('glSamplerParameterfv', None, [GLuint, GLenum, POINTER(GLfloat)], 'ARB_sampler_objects')
+
+# GL/glext.h:7273
+glSamplerParameterIiv = _link_function('glSamplerParameterIiv', None, [GLuint, GLenum, POINTER(GLint)], 'ARB_sampler_objects')
+
+# GL/glext.h:7274
+glSamplerParameterIuiv = _link_function('glSamplerParameterIuiv', None, [GLuint, GLenum, POINTER(GLuint)], 'ARB_sampler_objects')
+
+# GL/glext.h:7275
+glGetSamplerParameteriv = _link_function('glGetSamplerParameteriv', None, [GLuint, GLenum, POINTER(GLint)], 'ARB_sampler_objects')
+
+# GL/glext.h:7276
+glGetSamplerParameterIiv = _link_function('glGetSamplerParameterIiv', None, [GLuint, GLenum, POINTER(GLint)], 'ARB_sampler_objects')
+
+# GL/glext.h:7277
+glGetSamplerParameterfv = _link_function('glGetSamplerParameterfv', None, [GLuint, GLenum, POINTER(GLfloat)], 'ARB_sampler_objects')
+
+# GL/glext.h:7278
+glGetSamplerParameterIuiv = _link_function('glGetSamplerParameterIuiv', None, [GLuint, GLenum, POINTER(GLuint)], 'ARB_sampler_objects')
+
+PFNGLGENSAMPLERSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:7280
+PFNGLDELETESAMPLERSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:7281
+PFNGLISSAMPLERPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:7282
+PFNGLBINDSAMPLERPROC = CFUNCTYPE(None, GLuint, GLuint) # GL/glext.h:7283
+PFNGLSAMPLERPARAMETERIPROC = CFUNCTYPE(None, GLuint, GLenum, GLint) # GL/glext.h:7284
+PFNGLSAMPLERPARAMETERIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:7285
+PFNGLSAMPLERPARAMETERFPROC = CFUNCTYPE(None, GLuint, GLenum, GLfloat) # GL/glext.h:7286
+PFNGLSAMPLERPARAMETERFVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:7287
+PFNGLSAMPLERPARAMETERIIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:7288
+PFNGLSAMPLERPARAMETERIUIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint)) # GL/glext.h:7289
+PFNGLGETSAMPLERPARAMETERIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:7290
+PFNGLGETSAMPLERPARAMETERIIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:7291
+PFNGLGETSAMPLERPARAMETERFVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:7292
+PFNGLGETSAMPLERPARAMETERIUIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint)) # GL/glext.h:7293
+# ARB_shader_bit_encoding (GL/glext.h:7296)
+GL_ARB_shader_bit_encoding = 1 # GL/glext.h:7297
+# ARB_texture_rgb10_a2ui (GL/glext.h:7300)
+GL_ARB_texture_rgb10_a2ui = 1 # GL/glext.h:7301
+# ARB_texture_swizzle (GL/glext.h:7304)
+GL_ARB_texture_swizzle = 1 # GL/glext.h:7305
+# ARB_timer_query (GL/glext.h:7308)
+GL_ARB_timer_query = 1 # GL/glext.h:7309
+# GL/glext.h:7311
+glQueryCounter = _link_function('glQueryCounter', None, [GLuint, GLenum], 'ARB_timer_query')
+
+# GL/glext.h:7312
+glGetQueryObjecti64v = _link_function('glGetQueryObjecti64v', None, [GLuint, GLenum, POINTER(GLint64)], 'ARB_timer_query')
+
+# GL/glext.h:7313
+glGetQueryObjectui64v = _link_function('glGetQueryObjectui64v', None, [GLuint, GLenum, POINTER(GLuint64)], 'ARB_timer_query')
+
+PFNGLQUERYCOUNTERPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:7315
+PFNGLGETQUERYOBJECTI64VPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint64)) # GL/glext.h:7316
+PFNGLGETQUERYOBJECTUI64VPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint64)) # GL/glext.h:7317
+# ARB_vertex_type_2_10_10_10_rev (GL/glext.h:7320)
+GL_ARB_vertex_type_2_10_10_10_rev = 1 # GL/glext.h:7321
+# GL/glext.h:7323
+glVertexP2ui = _link_function('glVertexP2ui', None, [GLenum, GLuint], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7324
+glVertexP2uiv = _link_function('glVertexP2uiv', None, [GLenum, POINTER(GLuint)], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7325
+glVertexP3ui = _link_function('glVertexP3ui', None, [GLenum, GLuint], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7326
+glVertexP3uiv = _link_function('glVertexP3uiv', None, [GLenum, POINTER(GLuint)], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7327
+glVertexP4ui = _link_function('glVertexP4ui', None, [GLenum, GLuint], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7328
+glVertexP4uiv = _link_function('glVertexP4uiv', None, [GLenum, POINTER(GLuint)], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7329
+glTexCoordP1ui = _link_function('glTexCoordP1ui', None, [GLenum, GLuint], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7330
+glTexCoordP1uiv = _link_function('glTexCoordP1uiv', None, [GLenum, POINTER(GLuint)], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7331
+glTexCoordP2ui = _link_function('glTexCoordP2ui', None, [GLenum, GLuint], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7332
+glTexCoordP2uiv = _link_function('glTexCoordP2uiv', None, [GLenum, POINTER(GLuint)], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7333
+glTexCoordP3ui = _link_function('glTexCoordP3ui', None, [GLenum, GLuint], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7334
+glTexCoordP3uiv = _link_function('glTexCoordP3uiv', None, [GLenum, POINTER(GLuint)], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7335
+glTexCoordP4ui = _link_function('glTexCoordP4ui', None, [GLenum, GLuint], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7336
+glTexCoordP4uiv = _link_function('glTexCoordP4uiv', None, [GLenum, POINTER(GLuint)], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7337
+glMultiTexCoordP1ui = _link_function('glMultiTexCoordP1ui', None, [GLenum, GLenum, GLuint], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7338
+glMultiTexCoordP1uiv = _link_function('glMultiTexCoordP1uiv', None, [GLenum, GLenum, POINTER(GLuint)], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7339
+glMultiTexCoordP2ui = _link_function('glMultiTexCoordP2ui', None, [GLenum, GLenum, GLuint], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7340
+glMultiTexCoordP2uiv = _link_function('glMultiTexCoordP2uiv', None, [GLenum, GLenum, POINTER(GLuint)], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7341
+glMultiTexCoordP3ui = _link_function('glMultiTexCoordP3ui', None, [GLenum, GLenum, GLuint], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7342
+glMultiTexCoordP3uiv = _link_function('glMultiTexCoordP3uiv', None, [GLenum, GLenum, POINTER(GLuint)], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7343
+glMultiTexCoordP4ui = _link_function('glMultiTexCoordP4ui', None, [GLenum, GLenum, GLuint], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7344
+glMultiTexCoordP4uiv = _link_function('glMultiTexCoordP4uiv', None, [GLenum, GLenum, POINTER(GLuint)], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7345
+glNormalP3ui = _link_function('glNormalP3ui', None, [GLenum, GLuint], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7346
+glNormalP3uiv = _link_function('glNormalP3uiv', None, [GLenum, POINTER(GLuint)], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7347
+glColorP3ui = _link_function('glColorP3ui', None, [GLenum, GLuint], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7348
+glColorP3uiv = _link_function('glColorP3uiv', None, [GLenum, POINTER(GLuint)], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7349
+glColorP4ui = _link_function('glColorP4ui', None, [GLenum, GLuint], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7350
+glColorP4uiv = _link_function('glColorP4uiv', None, [GLenum, POINTER(GLuint)], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7351
+glSecondaryColorP3ui = _link_function('glSecondaryColorP3ui', None, [GLenum, GLuint], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7352
+glSecondaryColorP3uiv = _link_function('glSecondaryColorP3uiv', None, [GLenum, POINTER(GLuint)], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7353
+glVertexAttribP1ui = _link_function('glVertexAttribP1ui', None, [GLuint, GLenum, GLboolean, GLuint], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7354
+glVertexAttribP1uiv = _link_function('glVertexAttribP1uiv', None, [GLuint, GLenum, GLboolean, POINTER(GLuint)], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7355
+glVertexAttribP2ui = _link_function('glVertexAttribP2ui', None, [GLuint, GLenum, GLboolean, GLuint], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7356
+glVertexAttribP2uiv = _link_function('glVertexAttribP2uiv', None, [GLuint, GLenum, GLboolean, POINTER(GLuint)], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7357
+glVertexAttribP3ui = _link_function('glVertexAttribP3ui', None, [GLuint, GLenum, GLboolean, GLuint], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7358
+glVertexAttribP3uiv = _link_function('glVertexAttribP3uiv', None, [GLuint, GLenum, GLboolean, POINTER(GLuint)], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7359
+glVertexAttribP4ui = _link_function('glVertexAttribP4ui', None, [GLuint, GLenum, GLboolean, GLuint], 'ARB_vertex_type_2_10_10_10_rev')
+
+# GL/glext.h:7360
+glVertexAttribP4uiv = _link_function('glVertexAttribP4uiv', None, [GLuint, GLenum, GLboolean, POINTER(GLuint)], 'ARB_vertex_type_2_10_10_10_rev')
+
+PFNGLVERTEXP2UIPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:7362
+PFNGLVERTEXP2UIVPROC = CFUNCTYPE(None, GLenum, POINTER(GLuint)) # GL/glext.h:7363
+PFNGLVERTEXP3UIPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:7364
+PFNGLVERTEXP3UIVPROC = CFUNCTYPE(None, GLenum, POINTER(GLuint)) # GL/glext.h:7365
+PFNGLVERTEXP4UIPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:7366
+PFNGLVERTEXP4UIVPROC = CFUNCTYPE(None, GLenum, POINTER(GLuint)) # GL/glext.h:7367
+PFNGLTEXCOORDP1UIPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:7368
+PFNGLTEXCOORDP1UIVPROC = CFUNCTYPE(None, GLenum, POINTER(GLuint)) # GL/glext.h:7369
+PFNGLTEXCOORDP2UIPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:7370
+PFNGLTEXCOORDP2UIVPROC = CFUNCTYPE(None, GLenum, POINTER(GLuint)) # GL/glext.h:7371
+PFNGLTEXCOORDP3UIPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:7372
+PFNGLTEXCOORDP3UIVPROC = CFUNCTYPE(None, GLenum, POINTER(GLuint)) # GL/glext.h:7373
+PFNGLTEXCOORDP4UIPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:7374
+PFNGLTEXCOORDP4UIVPROC = CFUNCTYPE(None, GLenum, POINTER(GLuint)) # GL/glext.h:7375
+PFNGLMULTITEXCOORDP1UIPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint) # GL/glext.h:7376
+PFNGLMULTITEXCOORDP1UIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:7377
+PFNGLMULTITEXCOORDP2UIPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint) # GL/glext.h:7378
+PFNGLMULTITEXCOORDP2UIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:7379
+PFNGLMULTITEXCOORDP3UIPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint) # GL/glext.h:7380
+PFNGLMULTITEXCOORDP3UIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:7381
+PFNGLMULTITEXCOORDP4UIPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint) # GL/glext.h:7382
+PFNGLMULTITEXCOORDP4UIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:7383
+PFNGLNORMALP3UIPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:7384
+PFNGLNORMALP3UIVPROC = CFUNCTYPE(None, GLenum, POINTER(GLuint)) # GL/glext.h:7385
+PFNGLCOLORP3UIPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:7386
+PFNGLCOLORP3UIVPROC = CFUNCTYPE(None, GLenum, POINTER(GLuint)) # GL/glext.h:7387
+PFNGLCOLORP4UIPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:7388
+PFNGLCOLORP4UIVPROC = CFUNCTYPE(None, GLenum, POINTER(GLuint)) # GL/glext.h:7389
+PFNGLSECONDARYCOLORP3UIPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:7390
+PFNGLSECONDARYCOLORP3UIVPROC = CFUNCTYPE(None, GLenum, POINTER(GLuint)) # GL/glext.h:7391
+PFNGLVERTEXATTRIBP1UIPROC = CFUNCTYPE(None, GLuint, GLenum, GLboolean, GLuint) # GL/glext.h:7392
+PFNGLVERTEXATTRIBP1UIVPROC = CFUNCTYPE(None, GLuint, GLenum, GLboolean, POINTER(GLuint)) # GL/glext.h:7393
+PFNGLVERTEXATTRIBP2UIPROC = CFUNCTYPE(None, GLuint, GLenum, GLboolean, GLuint) # GL/glext.h:7394
+PFNGLVERTEXATTRIBP2UIVPROC = CFUNCTYPE(None, GLuint, GLenum, GLboolean, POINTER(GLuint)) # GL/glext.h:7395
+PFNGLVERTEXATTRIBP3UIPROC = CFUNCTYPE(None, GLuint, GLenum, GLboolean, GLuint) # GL/glext.h:7396
+PFNGLVERTEXATTRIBP3UIVPROC = CFUNCTYPE(None, GLuint, GLenum, GLboolean, POINTER(GLuint)) # GL/glext.h:7397
+PFNGLVERTEXATTRIBP4UIPROC = CFUNCTYPE(None, GLuint, GLenum, GLboolean, GLuint) # GL/glext.h:7398
+PFNGLVERTEXATTRIBP4UIVPROC = CFUNCTYPE(None, GLuint, GLenum, GLboolean, POINTER(GLuint)) # GL/glext.h:7399
+# ARB_draw_indirect (GL/glext.h:7402)
+GL_ARB_draw_indirect = 1 # GL/glext.h:7403
+# GL/glext.h:7405
+glDrawArraysIndirect = _link_function('glDrawArraysIndirect', None, [GLenum, POINTER(GLvoid)], 'ARB_draw_indirect')
+
+# GL/glext.h:7406
+glDrawElementsIndirect = _link_function('glDrawElementsIndirect', None, [GLenum, GLenum, POINTER(GLvoid)], 'ARB_draw_indirect')
+
+PFNGLDRAWARRAYSINDIRECTPROC = CFUNCTYPE(None, GLenum, POINTER(GLvoid)) # GL/glext.h:7408
+PFNGLDRAWELEMENTSINDIRECTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:7409
+# ARB_gpu_shader5 (GL/glext.h:7412)
+GL_ARB_gpu_shader5 = 1 # GL/glext.h:7413
+# ARB_gpu_shader_fp64 (GL/glext.h:7416)
+GL_ARB_gpu_shader_fp64 = 1 # GL/glext.h:7417
+# GL/glext.h:7419
+glUniform1d = _link_function('glUniform1d', None, [GLint, GLdouble], 'ARB_gpu_shader_fp64')
+
+# GL/glext.h:7420
+glUniform2d = _link_function('glUniform2d', None, [GLint, GLdouble, GLdouble], 'ARB_gpu_shader_fp64')
+
+# GL/glext.h:7421
+glUniform3d = _link_function('glUniform3d', None, [GLint, GLdouble, GLdouble, GLdouble], 'ARB_gpu_shader_fp64')
+
+# GL/glext.h:7422
+glUniform4d = _link_function('glUniform4d', None, [GLint, GLdouble, GLdouble, GLdouble, GLdouble], 'ARB_gpu_shader_fp64')
+
+# GL/glext.h:7423
+glUniform1dv = _link_function('glUniform1dv', None, [GLint, GLsizei, POINTER(GLdouble)], 'ARB_gpu_shader_fp64')
+
+# GL/glext.h:7424
+glUniform2dv = _link_function('glUniform2dv', None, [GLint, GLsizei, POINTER(GLdouble)], 'ARB_gpu_shader_fp64')
+
+# GL/glext.h:7425
+glUniform3dv = _link_function('glUniform3dv', None, [GLint, GLsizei, POINTER(GLdouble)], 'ARB_gpu_shader_fp64')
+
+# GL/glext.h:7426
+glUniform4dv = _link_function('glUniform4dv', None, [GLint, GLsizei, POINTER(GLdouble)], 'ARB_gpu_shader_fp64')
+
+# GL/glext.h:7427
+glUniformMatrix2dv = _link_function('glUniformMatrix2dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'ARB_gpu_shader_fp64')
+
+# GL/glext.h:7428
+glUniformMatrix3dv = _link_function('glUniformMatrix3dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'ARB_gpu_shader_fp64')
+
+# GL/glext.h:7429
+glUniformMatrix4dv = _link_function('glUniformMatrix4dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'ARB_gpu_shader_fp64')
+
+# GL/glext.h:7430
+glUniformMatrix2x3dv = _link_function('glUniformMatrix2x3dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'ARB_gpu_shader_fp64')
+
+# GL/glext.h:7431
+glUniformMatrix2x4dv = _link_function('glUniformMatrix2x4dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'ARB_gpu_shader_fp64')
+
+# GL/glext.h:7432
+glUniformMatrix3x2dv = _link_function('glUniformMatrix3x2dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'ARB_gpu_shader_fp64')
+
+# GL/glext.h:7433
+glUniformMatrix3x4dv = _link_function('glUniformMatrix3x4dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'ARB_gpu_shader_fp64')
+
+# GL/glext.h:7434
+glUniformMatrix4x2dv = _link_function('glUniformMatrix4x2dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'ARB_gpu_shader_fp64')
+
+# GL/glext.h:7435
+glUniformMatrix4x3dv = _link_function('glUniformMatrix4x3dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'ARB_gpu_shader_fp64')
+
+# GL/glext.h:7436
+glGetUniformdv = _link_function('glGetUniformdv', None, [GLuint, GLint, POINTER(GLdouble)], 'ARB_gpu_shader_fp64')
+
+PFNGLUNIFORM1DPROC = CFUNCTYPE(None, GLint, GLdouble) # GL/glext.h:7438
+PFNGLUNIFORM2DPROC = CFUNCTYPE(None, GLint, GLdouble, GLdouble) # GL/glext.h:7439
+PFNGLUNIFORM3DPROC = CFUNCTYPE(None, GLint, GLdouble, GLdouble, GLdouble) # GL/glext.h:7440
+PFNGLUNIFORM4DPROC = CFUNCTYPE(None, GLint, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:7441
+PFNGLUNIFORM1DVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLdouble)) # GL/glext.h:7442
+PFNGLUNIFORM2DVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLdouble)) # GL/glext.h:7443
+PFNGLUNIFORM3DVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLdouble)) # GL/glext.h:7444
+PFNGLUNIFORM4DVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLdouble)) # GL/glext.h:7445
+PFNGLUNIFORMMATRIX2DVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:7446
+PFNGLUNIFORMMATRIX3DVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:7447
+PFNGLUNIFORMMATRIX4DVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:7448
+PFNGLUNIFORMMATRIX2X3DVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:7449
+PFNGLUNIFORMMATRIX2X4DVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:7450
+PFNGLUNIFORMMATRIX3X2DVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:7451
+PFNGLUNIFORMMATRIX3X4DVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:7452
+PFNGLUNIFORMMATRIX4X2DVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:7453
+PFNGLUNIFORMMATRIX4X3DVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:7454
+PFNGLGETUNIFORMDVPROC = CFUNCTYPE(None, GLuint, GLint, POINTER(GLdouble)) # GL/glext.h:7455
+# ARB_shader_subroutine (GL/glext.h:7458)
+GL_ARB_shader_subroutine = 1 # GL/glext.h:7459
+# GL/glext.h:7461
+glGetSubroutineUniformLocation = _link_function('glGetSubroutineUniformLocation', GLint, [GLuint, GLenum, POINTER(GLchar)], 'ARB_shader_subroutine')
+
+# GL/glext.h:7462
+glGetSubroutineIndex = _link_function('glGetSubroutineIndex', GLuint, [GLuint, GLenum, POINTER(GLchar)], 'ARB_shader_subroutine')
+
+# GL/glext.h:7463
+glGetActiveSubroutineUniformiv = _link_function('glGetActiveSubroutineUniformiv', None, [GLuint, GLenum, GLuint, GLenum, POINTER(GLint)], 'ARB_shader_subroutine')
+
+# GL/glext.h:7464
+glGetActiveSubroutineUniformName = _link_function('glGetActiveSubroutineUniformName', None, [GLuint, GLenum, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], 'ARB_shader_subroutine')
+
+# GL/glext.h:7465
+glGetActiveSubroutineName = _link_function('glGetActiveSubroutineName', None, [GLuint, GLenum, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], 'ARB_shader_subroutine')
+
+# GL/glext.h:7466
+glUniformSubroutinesuiv = _link_function('glUniformSubroutinesuiv', None, [GLenum, GLsizei, POINTER(GLuint)], 'ARB_shader_subroutine')
+
+# GL/glext.h:7467
+glGetUniformSubroutineuiv = _link_function('glGetUniformSubroutineuiv', None, [GLenum, GLint, POINTER(GLuint)], 'ARB_shader_subroutine')
+
+# GL/glext.h:7468
+glGetProgramStageiv = _link_function('glGetProgramStageiv', None, [GLuint, GLenum, GLenum, POINTER(GLint)], 'ARB_shader_subroutine')
+
+PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC = CFUNCTYPE(GLint, GLuint, GLenum, POINTER(GLchar)) # GL/glext.h:7470
+PFNGLGETSUBROUTINEINDEXPROC = CFUNCTYPE(GLuint, GLuint, GLenum, POINTER(GLchar)) # GL/glext.h:7471
+PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:7472
+PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)) # GL/glext.h:7473
+PFNGLGETACTIVESUBROUTINENAMEPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)) # GL/glext.h:7474
+PFNGLUNIFORMSUBROUTINESUIVPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLuint)) # GL/glext.h:7475
+PFNGLGETUNIFORMSUBROUTINEUIVPROC = CFUNCTYPE(None, GLenum, GLint, POINTER(GLuint)) # GL/glext.h:7476
+PFNGLGETPROGRAMSTAGEIVPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:7477
+# ARB_tessellation_shader (GL/glext.h:7480)
+GL_ARB_tessellation_shader = 1 # GL/glext.h:7481
+# GL/glext.h:7483
+glPatchParameteri = _link_function('glPatchParameteri', None, [GLenum, GLint], 'ARB_tessellation_shader')
+
+# GL/glext.h:7484
+glPatchParameterfv = _link_function('glPatchParameterfv', None, [GLenum, POINTER(GLfloat)], 'ARB_tessellation_shader')
+
+PFNGLPATCHPARAMETERIPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:7486
+PFNGLPATCHPARAMETERFVPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:7487
+# ARB_texture_buffer_object_rgb32 (GL/glext.h:7490)
+GL_ARB_texture_buffer_object_rgb32 = 1 # GL/glext.h:7491
+# ARB_transform_feedback2 (GL/glext.h:7494)
+GL_ARB_transform_feedback2 = 1 # GL/glext.h:7495
+# GL/glext.h:7497
+glBindTransformFeedback = _link_function('glBindTransformFeedback', None, [GLenum, GLuint], 'ARB_transform_feedback2')
+
+# GL/glext.h:7498
+glDeleteTransformFeedbacks = _link_function('glDeleteTransformFeedbacks', None, [GLsizei, POINTER(GLuint)], 'ARB_transform_feedback2')
+
+# GL/glext.h:7499
+glGenTransformFeedbacks = _link_function('glGenTransformFeedbacks', None, [GLsizei, POINTER(GLuint)], 'ARB_transform_feedback2')
+
+# GL/glext.h:7500
+glIsTransformFeedback = _link_function('glIsTransformFeedback', GLboolean, [GLuint], 'ARB_transform_feedback2')
+
+# GL/glext.h:7501
+glPauseTransformFeedback = _link_function('glPauseTransformFeedback', None, [], 'ARB_transform_feedback2')
+
+# GL/glext.h:7502
+glResumeTransformFeedback = _link_function('glResumeTransformFeedback', None, [], 'ARB_transform_feedback2')
+
+# GL/glext.h:7503
+glDrawTransformFeedback = _link_function('glDrawTransformFeedback', None, [GLenum, GLuint], 'ARB_transform_feedback2')
+
+PFNGLBINDTRANSFORMFEEDBACKPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:7505
+PFNGLDELETETRANSFORMFEEDBACKSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:7506
+PFNGLGENTRANSFORMFEEDBACKSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:7507
+PFNGLISTRANSFORMFEEDBACKPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:7508
+PFNGLPAUSETRANSFORMFEEDBACKPROC = CFUNCTYPE(None) # GL/glext.h:7509
+PFNGLRESUMETRANSFORMFEEDBACKPROC = CFUNCTYPE(None) # GL/glext.h:7510
+PFNGLDRAWTRANSFORMFEEDBACKPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:7511
+# ARB_transform_feedback3 (GL/glext.h:7514)
+GL_ARB_transform_feedback3 = 1 # GL/glext.h:7515
+# GL/glext.h:7517
+glDrawTransformFeedbackStream = _link_function('glDrawTransformFeedbackStream', None, [GLenum, GLuint, GLuint], 'ARB_transform_feedback3')
+
+# GL/glext.h:7518
+glBeginQueryIndexed = _link_function('glBeginQueryIndexed', None, [GLenum, GLuint, GLuint], 'ARB_transform_feedback3')
+
+# GL/glext.h:7519
+glEndQueryIndexed = _link_function('glEndQueryIndexed', None, [GLenum, GLuint], 'ARB_transform_feedback3')
+
+# GL/glext.h:7520
+glGetQueryIndexediv = _link_function('glGetQueryIndexediv', None, [GLenum, GLuint, GLenum, POINTER(GLint)], 'ARB_transform_feedback3')
+
+PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint) # GL/glext.h:7522
+PFNGLBEGINQUERYINDEXEDPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint) # GL/glext.h:7523
+PFNGLENDQUERYINDEXEDPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:7524
+PFNGLGETQUERYINDEXEDIVPROC = CFUNCTYPE(None, GLenum, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:7525
+# ARB_ES2_compatibility (GL/glext.h:7528)
+GL_ARB_ES2_compatibility = 1 # GL/glext.h:7529
+# GL/glext.h:7531
+glReleaseShaderCompiler = _link_function('glReleaseShaderCompiler', None, [], 'ARB_ES2_compatibility')
+
+# GL/glext.h:7532
+glShaderBinary = _link_function('glShaderBinary', None, [GLsizei, POINTER(GLuint), GLenum, POINTER(GLvoid), GLsizei], 'ARB_ES2_compatibility')
+
+# GL/glext.h:7533
+glGetShaderPrecisionFormat = _link_function('glGetShaderPrecisionFormat', None, [GLenum, GLenum, POINTER(GLint), POINTER(GLint)], 'ARB_ES2_compatibility')
+
+# GL/glext.h:7534
+glDepthRangef = _link_function('glDepthRangef', None, [GLfloat, GLfloat], 'ARB_ES2_compatibility')
+
+# GL/glext.h:7535
+glClearDepthf = _link_function('glClearDepthf', None, [GLfloat], 'ARB_ES2_compatibility')
+
+PFNGLRELEASESHADERCOMPILERPROC = CFUNCTYPE(None) # GL/glext.h:7537
+PFNGLSHADERBINARYPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint), GLenum, POINTER(GLvoid), GLsizei) # GL/glext.h:7538
+PFNGLGETSHADERPRECISIONFORMATPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint), POINTER(GLint)) # GL/glext.h:7539
+PFNGLDEPTHRANGEFPROC = CFUNCTYPE(None, GLfloat, GLfloat) # GL/glext.h:7540
+PFNGLCLEARDEPTHFPROC = CFUNCTYPE(None, GLfloat) # GL/glext.h:7541
+# ARB_get_program_binary (GL/glext.h:7544)
+GL_ARB_get_program_binary = 1 # GL/glext.h:7545
+# GL/glext.h:7547
+glGetProgramBinary = _link_function('glGetProgramBinary', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLenum), POINTER(GLvoid)], 'ARB_get_program_binary')
+
+# GL/glext.h:7548
+glProgramBinary = _link_function('glProgramBinary', None, [GLuint, GLenum, POINTER(GLvoid), GLsizei], 'ARB_get_program_binary')
+
+# GL/glext.h:7549
+glProgramParameteri = _link_function('glProgramParameteri', None, [GLuint, GLenum, GLint], 'ARB_get_program_binary')
+
+PFNGLGETPROGRAMBINARYPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLenum), POINTER(GLvoid)) # GL/glext.h:7551
+PFNGLPROGRAMBINARYPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLvoid), GLsizei) # GL/glext.h:7552
+PFNGLPROGRAMPARAMETERIPROC = CFUNCTYPE(None, GLuint, GLenum, GLint) # GL/glext.h:7553
+# ARB_separate_shader_objects (GL/glext.h:7556)
+GL_ARB_separate_shader_objects = 1 # GL/glext.h:7557
+# GL/glext.h:7559
+glUseProgramStages = _link_function('glUseProgramStages', None, [GLuint, GLbitfield, GLuint], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7560
+glActiveShaderProgram = _link_function('glActiveShaderProgram', None, [GLuint, GLuint], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7561
+glCreateShaderProgramv = _link_function('glCreateShaderProgramv', GLuint, [GLenum, GLsizei, POINTER(POINTER(GLchar))], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7562
+glBindProgramPipeline = _link_function('glBindProgramPipeline', None, [GLuint], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7563
+glDeleteProgramPipelines = _link_function('glDeleteProgramPipelines', None, [GLsizei, POINTER(GLuint)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7564
+glGenProgramPipelines = _link_function('glGenProgramPipelines', None, [GLsizei, POINTER(GLuint)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7565
+glIsProgramPipeline = _link_function('glIsProgramPipeline', GLboolean, [GLuint], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7566
+glGetProgramPipelineiv = _link_function('glGetProgramPipelineiv', None, [GLuint, GLenum, POINTER(GLint)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7567
+glProgramUniform1i = _link_function('glProgramUniform1i', None, [GLuint, GLint, GLint], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7568
+glProgramUniform1iv = _link_function('glProgramUniform1iv', None, [GLuint, GLint, GLsizei, POINTER(GLint)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7569
+glProgramUniform1f = _link_function('glProgramUniform1f', None, [GLuint, GLint, GLfloat], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7570
+glProgramUniform1fv = _link_function('glProgramUniform1fv', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7571
+glProgramUniform1d = _link_function('glProgramUniform1d', None, [GLuint, GLint, GLdouble], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7572
+glProgramUniform1dv = _link_function('glProgramUniform1dv', None, [GLuint, GLint, GLsizei, POINTER(GLdouble)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7573
+glProgramUniform1ui = _link_function('glProgramUniform1ui', None, [GLuint, GLint, GLuint], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7574
+glProgramUniform1uiv = _link_function('glProgramUniform1uiv', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7575
+glProgramUniform2i = _link_function('glProgramUniform2i', None, [GLuint, GLint, GLint, GLint], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7576
+glProgramUniform2iv = _link_function('glProgramUniform2iv', None, [GLuint, GLint, GLsizei, POINTER(GLint)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7577
+glProgramUniform2f = _link_function('glProgramUniform2f', None, [GLuint, GLint, GLfloat, GLfloat], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7578
+glProgramUniform2fv = _link_function('glProgramUniform2fv', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7579
+glProgramUniform2d = _link_function('glProgramUniform2d', None, [GLuint, GLint, GLdouble, GLdouble], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7580
+glProgramUniform2dv = _link_function('glProgramUniform2dv', None, [GLuint, GLint, GLsizei, POINTER(GLdouble)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7581
+glProgramUniform2ui = _link_function('glProgramUniform2ui', None, [GLuint, GLint, GLuint, GLuint], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7582
+glProgramUniform2uiv = _link_function('glProgramUniform2uiv', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7583
+glProgramUniform3i = _link_function('glProgramUniform3i', None, [GLuint, GLint, GLint, GLint, GLint], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7584
+glProgramUniform3iv = _link_function('glProgramUniform3iv', None, [GLuint, GLint, GLsizei, POINTER(GLint)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7585
+glProgramUniform3f = _link_function('glProgramUniform3f', None, [GLuint, GLint, GLfloat, GLfloat, GLfloat], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7586
+glProgramUniform3fv = _link_function('glProgramUniform3fv', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7587
+glProgramUniform3d = _link_function('glProgramUniform3d', None, [GLuint, GLint, GLdouble, GLdouble, GLdouble], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7588
+glProgramUniform3dv = _link_function('glProgramUniform3dv', None, [GLuint, GLint, GLsizei, POINTER(GLdouble)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7589
+glProgramUniform3ui = _link_function('glProgramUniform3ui', None, [GLuint, GLint, GLuint, GLuint, GLuint], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7590
+glProgramUniform3uiv = _link_function('glProgramUniform3uiv', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7591
+glProgramUniform4i = _link_function('glProgramUniform4i', None, [GLuint, GLint, GLint, GLint, GLint, GLint], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7592
+glProgramUniform4iv = _link_function('glProgramUniform4iv', None, [GLuint, GLint, GLsizei, POINTER(GLint)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7593
+glProgramUniform4f = _link_function('glProgramUniform4f', None, [GLuint, GLint, GLfloat, GLfloat, GLfloat, GLfloat], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7594
+glProgramUniform4fv = _link_function('glProgramUniform4fv', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7595
+glProgramUniform4d = _link_function('glProgramUniform4d', None, [GLuint, GLint, GLdouble, GLdouble, GLdouble, GLdouble], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7596
+glProgramUniform4dv = _link_function('glProgramUniform4dv', None, [GLuint, GLint, GLsizei, POINTER(GLdouble)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7597
+glProgramUniform4ui = _link_function('glProgramUniform4ui', None, [GLuint, GLint, GLuint, GLuint, GLuint, GLuint], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7598
+glProgramUniform4uiv = _link_function('glProgramUniform4uiv', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7599
+glProgramUniformMatrix2fv = _link_function('glProgramUniformMatrix2fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7600
+glProgramUniformMatrix3fv = _link_function('glProgramUniformMatrix3fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7601
+glProgramUniformMatrix4fv = _link_function('glProgramUniformMatrix4fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7602
+glProgramUniformMatrix2dv = _link_function('glProgramUniformMatrix2dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7603
+glProgramUniformMatrix3dv = _link_function('glProgramUniformMatrix3dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7604
+glProgramUniformMatrix4dv = _link_function('glProgramUniformMatrix4dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7605
+glProgramUniformMatrix2x3fv = _link_function('glProgramUniformMatrix2x3fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7606
+glProgramUniformMatrix3x2fv = _link_function('glProgramUniformMatrix3x2fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7607
+glProgramUniformMatrix2x4fv = _link_function('glProgramUniformMatrix2x4fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7608
+glProgramUniformMatrix4x2fv = _link_function('glProgramUniformMatrix4x2fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7609
+glProgramUniformMatrix3x4fv = _link_function('glProgramUniformMatrix3x4fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7610
+glProgramUniformMatrix4x3fv = _link_function('glProgramUniformMatrix4x3fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7611
+glProgramUniformMatrix2x3dv = _link_function('glProgramUniformMatrix2x3dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7612
+glProgramUniformMatrix3x2dv = _link_function('glProgramUniformMatrix3x2dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7613
+glProgramUniformMatrix2x4dv = _link_function('glProgramUniformMatrix2x4dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7614
+glProgramUniformMatrix4x2dv = _link_function('glProgramUniformMatrix4x2dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7615
+glProgramUniformMatrix3x4dv = _link_function('glProgramUniformMatrix3x4dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7616
+glProgramUniformMatrix4x3dv = _link_function('glProgramUniformMatrix4x3dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7617
+glValidateProgramPipeline = _link_function('glValidateProgramPipeline', None, [GLuint], 'ARB_separate_shader_objects')
+
+# GL/glext.h:7618
+glGetProgramPipelineInfoLog = _link_function('glGetProgramPipelineInfoLog', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], 'ARB_separate_shader_objects')
+
+PFNGLUSEPROGRAMSTAGESPROC = CFUNCTYPE(None, GLuint, GLbitfield, GLuint) # GL/glext.h:7620
+PFNGLACTIVESHADERPROGRAMPROC = CFUNCTYPE(None, GLuint, GLuint) # GL/glext.h:7621
+PFNGLCREATESHADERPROGRAMVPROC = CFUNCTYPE(GLuint, GLenum, GLsizei, POINTER(POINTER(GLchar))) # GL/glext.h:7622
+PFNGLBINDPROGRAMPIPELINEPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:7623
+PFNGLDELETEPROGRAMPIPELINESPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:7624
+PFNGLGENPROGRAMPIPELINESPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:7625
+PFNGLISPROGRAMPIPELINEPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:7626
+PFNGLGETPROGRAMPIPELINEIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:7627
+PFNGLPROGRAMUNIFORM1IPROC = CFUNCTYPE(None, GLuint, GLint, GLint) # GL/glext.h:7628
+PFNGLPROGRAMUNIFORM1IVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:7629
+PFNGLPROGRAMUNIFORM1FPROC = CFUNCTYPE(None, GLuint, GLint, GLfloat) # GL/glext.h:7630
+PFNGLPROGRAMUNIFORM1FVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:7631
+PFNGLPROGRAMUNIFORM1DPROC = CFUNCTYPE(None, GLuint, GLint, GLdouble) # GL/glext.h:7632
+PFNGLPROGRAMUNIFORM1DVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLdouble)) # GL/glext.h:7633
+PFNGLPROGRAMUNIFORM1UIPROC = CFUNCTYPE(None, GLuint, GLint, GLuint) # GL/glext.h:7634
+PFNGLPROGRAMUNIFORM1UIVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:7635
+PFNGLPROGRAMUNIFORM2IPROC = CFUNCTYPE(None, GLuint, GLint, GLint, GLint) # GL/glext.h:7636
+PFNGLPROGRAMUNIFORM2IVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:7637
+PFNGLPROGRAMUNIFORM2FPROC = CFUNCTYPE(None, GLuint, GLint, GLfloat, GLfloat) # GL/glext.h:7638
+PFNGLPROGRAMUNIFORM2FVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:7639
+PFNGLPROGRAMUNIFORM2DPROC = CFUNCTYPE(None, GLuint, GLint, GLdouble, GLdouble) # GL/glext.h:7640
+PFNGLPROGRAMUNIFORM2DVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLdouble)) # GL/glext.h:7641
+PFNGLPROGRAMUNIFORM2UIPROC = CFUNCTYPE(None, GLuint, GLint, GLuint, GLuint) # GL/glext.h:7642
+PFNGLPROGRAMUNIFORM2UIVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:7643
+PFNGLPROGRAMUNIFORM3IPROC = CFUNCTYPE(None, GLuint, GLint, GLint, GLint, GLint) # GL/glext.h:7644
+PFNGLPROGRAMUNIFORM3IVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:7645
+PFNGLPROGRAMUNIFORM3FPROC = CFUNCTYPE(None, GLuint, GLint, GLfloat, GLfloat, GLfloat) # GL/glext.h:7646
+PFNGLPROGRAMUNIFORM3FVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:7647
+PFNGLPROGRAMUNIFORM3DPROC = CFUNCTYPE(None, GLuint, GLint, GLdouble, GLdouble, GLdouble) # GL/glext.h:7648
+PFNGLPROGRAMUNIFORM3DVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLdouble)) # GL/glext.h:7649
+PFNGLPROGRAMUNIFORM3UIPROC = CFUNCTYPE(None, GLuint, GLint, GLuint, GLuint, GLuint) # GL/glext.h:7650
+PFNGLPROGRAMUNIFORM3UIVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:7651
+PFNGLPROGRAMUNIFORM4IPROC = CFUNCTYPE(None, GLuint, GLint, GLint, GLint, GLint, GLint) # GL/glext.h:7652
+PFNGLPROGRAMUNIFORM4IVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:7653
+PFNGLPROGRAMUNIFORM4FPROC = CFUNCTYPE(None, GLuint, GLint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:7654
+PFNGLPROGRAMUNIFORM4FVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:7655
+PFNGLPROGRAMUNIFORM4DPROC = CFUNCTYPE(None, GLuint, GLint, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:7656
+PFNGLPROGRAMUNIFORM4DVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLdouble)) # GL/glext.h:7657
+PFNGLPROGRAMUNIFORM4UIPROC = CFUNCTYPE(None, GLuint, GLint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:7658
+PFNGLPROGRAMUNIFORM4UIVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:7659
+PFNGLPROGRAMUNIFORMMATRIX2FVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:7660
+PFNGLPROGRAMUNIFORMMATRIX3FVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:7661
+PFNGLPROGRAMUNIFORMMATRIX4FVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:7662
+PFNGLPROGRAMUNIFORMMATRIX2DVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:7663
+PFNGLPROGRAMUNIFORMMATRIX3DVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:7664
+PFNGLPROGRAMUNIFORMMATRIX4DVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:7665
+PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:7666
+PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:7667
+PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:7668
+PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:7669
+PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:7670
+PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:7671
+PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:7672
+PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:7673
+PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:7674
+PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:7675
+PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:7676
+PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:7677
+PFNGLVALIDATEPROGRAMPIPELINEPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:7678
+PFNGLGETPROGRAMPIPELINEINFOLOGPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)) # GL/glext.h:7679
+# ARB_vertex_attrib_64bit (GL/glext.h:7682)
+GL_ARB_vertex_attrib_64bit = 1 # GL/glext.h:7683
+# GL/glext.h:7685
+glVertexAttribL1d = _link_function('glVertexAttribL1d', None, [GLuint, GLdouble], 'ARB_vertex_attrib_64bit')
+
+# GL/glext.h:7686
+glVertexAttribL2d = _link_function('glVertexAttribL2d', None, [GLuint, GLdouble, GLdouble], 'ARB_vertex_attrib_64bit')
+
+# GL/glext.h:7687
+glVertexAttribL3d = _link_function('glVertexAttribL3d', None, [GLuint, GLdouble, GLdouble, GLdouble], 'ARB_vertex_attrib_64bit')
+
+# GL/glext.h:7688
+glVertexAttribL4d = _link_function('glVertexAttribL4d', None, [GLuint, GLdouble, GLdouble, GLdouble, GLdouble], 'ARB_vertex_attrib_64bit')
+
+# GL/glext.h:7689
+glVertexAttribL1dv = _link_function('glVertexAttribL1dv', None, [GLuint, POINTER(GLdouble)], 'ARB_vertex_attrib_64bit')
+
+# GL/glext.h:7690
+glVertexAttribL2dv = _link_function('glVertexAttribL2dv', None, [GLuint, POINTER(GLdouble)], 'ARB_vertex_attrib_64bit')
+
+# GL/glext.h:7691
+glVertexAttribL3dv = _link_function('glVertexAttribL3dv', None, [GLuint, POINTER(GLdouble)], 'ARB_vertex_attrib_64bit')
+
+# GL/glext.h:7692
+glVertexAttribL4dv = _link_function('glVertexAttribL4dv', None, [GLuint, POINTER(GLdouble)], 'ARB_vertex_attrib_64bit')
+
+# GL/glext.h:7693
+glVertexAttribLPointer = _link_function('glVertexAttribLPointer', None, [GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)], 'ARB_vertex_attrib_64bit')
+
+# GL/glext.h:7694
+glGetVertexAttribLdv = _link_function('glGetVertexAttribLdv', None, [GLuint, GLenum, POINTER(GLdouble)], 'ARB_vertex_attrib_64bit')
+
+PFNGLVERTEXATTRIBL1DPROC = CFUNCTYPE(None, GLuint, GLdouble) # GL/glext.h:7696
+PFNGLVERTEXATTRIBL2DPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble) # GL/glext.h:7697
+PFNGLVERTEXATTRIBL3DPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble, GLdouble) # GL/glext.h:7698
+PFNGLVERTEXATTRIBL4DPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:7699
+PFNGLVERTEXATTRIBL1DVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:7700
+PFNGLVERTEXATTRIBL2DVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:7701
+PFNGLVERTEXATTRIBL3DVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:7702
+PFNGLVERTEXATTRIBL4DVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:7703
+PFNGLVERTEXATTRIBLPOINTERPROC = CFUNCTYPE(None, GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:7704
+PFNGLGETVERTEXATTRIBLDVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLdouble)) # GL/glext.h:7705
+# ARB_viewport_array (GL/glext.h:7708)
+GL_ARB_viewport_array = 1 # GL/glext.h:7709
+# GL/glext.h:7711
+glViewportArrayv = _link_function('glViewportArrayv', None, [GLuint, GLsizei, POINTER(GLfloat)], 'ARB_viewport_array')
+
+# GL/glext.h:7712
+glViewportIndexedf = _link_function('glViewportIndexedf', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat], 'ARB_viewport_array')
+
+# GL/glext.h:7713
+glViewportIndexedfv = _link_function('glViewportIndexedfv', None, [GLuint, POINTER(GLfloat)], 'ARB_viewport_array')
+
+# GL/glext.h:7714
+glScissorArrayv = _link_function('glScissorArrayv', None, [GLuint, GLsizei, POINTER(GLint)], 'ARB_viewport_array')
+
+# GL/glext.h:7715
+glScissorIndexed = _link_function('glScissorIndexed', None, [GLuint, GLint, GLint, GLsizei, GLsizei], 'ARB_viewport_array')
+
+# GL/glext.h:7716
+glScissorIndexedv = _link_function('glScissorIndexedv', None, [GLuint, POINTER(GLint)], 'ARB_viewport_array')
+
+# GL/glext.h:7717
+glDepthRangeArrayv = _link_function('glDepthRangeArrayv', None, [GLuint, GLsizei, POINTER(GLdouble)], 'ARB_viewport_array')
+
+# GL/glext.h:7718
+glDepthRangeIndexed = _link_function('glDepthRangeIndexed', None, [GLuint, GLdouble, GLdouble], 'ARB_viewport_array')
+
+# GL/glext.h:7719
+glGetFloati_v = _link_function('glGetFloati_v', None, [GLenum, GLuint, POINTER(GLfloat)], 'ARB_viewport_array')
+
+# GL/glext.h:7720
+glGetDoublei_v = _link_function('glGetDoublei_v', None, [GLenum, GLuint, POINTER(GLdouble)], 'ARB_viewport_array')
+
+PFNGLVIEWPORTARRAYVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLfloat)) # GL/glext.h:7722
+PFNGLVIEWPORTINDEXEDFPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:7723
+PFNGLVIEWPORTINDEXEDFVPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:7724
+PFNGLSCISSORARRAYVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLint)) # GL/glext.h:7725
+PFNGLSCISSORINDEXEDPROC = CFUNCTYPE(None, GLuint, GLint, GLint, GLsizei, GLsizei) # GL/glext.h:7726
+PFNGLSCISSORINDEXEDVPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:7727
+PFNGLDEPTHRANGEARRAYVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLdouble)) # GL/glext.h:7728
+PFNGLDEPTHRANGEINDEXEDPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble) # GL/glext.h:7729
+PFNGLGETFLOATI_VPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:7730
+PFNGLGETDOUBLEI_VPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLdouble)) # GL/glext.h:7731
+# ARB_cl_event (GL/glext.h:7734)
+GL_ARB_cl_event = 1 # GL/glext.h:7735
+class struct__cl_context(Structure):
+ __slots__ = [
+ ]
+struct__cl_context._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__cl_event(Structure):
+ __slots__ = [
+ ]
+struct__cl_event._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+# GL/glext.h:7737
+glCreateSyncFromCLeventARB = _link_function('glCreateSyncFromCLeventARB', GLsync, [POINTER(struct__cl_context), POINTER(struct__cl_event), GLbitfield], 'ARB_cl_event')
+
+class struct__cl_context(Structure):
+ __slots__ = [
+ ]
+struct__cl_context._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__cl_event(Structure):
+ __slots__ = [
+ ]
+struct__cl_event._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__cl_context(Structure):
+ __slots__ = [
+ ]
+struct__cl_context._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__cl_event(Structure):
+ __slots__ = [
+ ]
+struct__cl_event._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+PFNGLCREATESYNCFROMCLEVENTARBPROC = CFUNCTYPE(GLsync, POINTER(struct__cl_context), POINTER(struct__cl_event), GLbitfield) # GL/glext.h:7739
+# ARB_debug_output (GL/glext.h:7742)
+GL_ARB_debug_output = 1 # GL/glext.h:7743
+# GL/glext.h:7745
+glDebugMessageControlARB = _link_function('glDebugMessageControlARB', None, [GLenum, GLenum, GLenum, GLsizei, POINTER(GLuint), GLboolean], 'ARB_debug_output')
+
+# GL/glext.h:7746
+glDebugMessageInsertARB = _link_function('glDebugMessageInsertARB', None, [GLenum, GLenum, GLuint, GLenum, GLsizei, POINTER(GLchar)], 'ARB_debug_output')
+
+# GL/glext.h:7747
+glDebugMessageCallbackARB = _link_function('glDebugMessageCallbackARB', None, [GLDEBUGPROCARB, POINTER(GLvoid)], 'ARB_debug_output')
+
+# GL/glext.h:7748
+glGetDebugMessageLogARB = _link_function('glGetDebugMessageLogARB', GLuint, [GLuint, GLsizei, POINTER(GLenum), POINTER(GLenum), POINTER(GLuint), POINTER(GLenum), POINTER(GLsizei), POINTER(GLchar)], 'ARB_debug_output')
+
+PFNGLDEBUGMESSAGECONTROLARBPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLsizei, POINTER(GLuint), GLboolean) # GL/glext.h:7750
+PFNGLDEBUGMESSAGEINSERTARBPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLenum, GLsizei, POINTER(GLchar)) # GL/glext.h:7751
+PFNGLDEBUGMESSAGECALLBACKARBPROC = CFUNCTYPE(None, GLDEBUGPROCARB, POINTER(GLvoid)) # GL/glext.h:7752
+PFNGLGETDEBUGMESSAGELOGARBPROC = CFUNCTYPE(GLuint, GLuint, GLsizei, POINTER(GLenum), POINTER(GLenum), POINTER(GLuint), POINTER(GLenum), POINTER(GLsizei), POINTER(GLchar)) # GL/glext.h:7753
+# ARB_robustness (GL/glext.h:7756)
+GL_ARB_robustness = 1 # GL/glext.h:7757
+# GL/glext.h:7759
+glGetGraphicsResetStatusARB = _link_function('glGetGraphicsResetStatusARB', GLenum, [], 'ARB_robustness')
+
+# GL/glext.h:7760
+glGetnMapdvARB = _link_function('glGetnMapdvARB', None, [GLenum, GLenum, GLsizei, POINTER(GLdouble)], 'ARB_robustness')
+
+# GL/glext.h:7761
+glGetnMapfvARB = _link_function('glGetnMapfvARB', None, [GLenum, GLenum, GLsizei, POINTER(GLfloat)], 'ARB_robustness')
+
+# GL/glext.h:7762
+glGetnMapivARB = _link_function('glGetnMapivARB', None, [GLenum, GLenum, GLsizei, POINTER(GLint)], 'ARB_robustness')
+
+# GL/glext.h:7763
+glGetnPixelMapfvARB = _link_function('glGetnPixelMapfvARB', None, [GLenum, GLsizei, POINTER(GLfloat)], 'ARB_robustness')
+
+# GL/glext.h:7764
+glGetnPixelMapuivARB = _link_function('glGetnPixelMapuivARB', None, [GLenum, GLsizei, POINTER(GLuint)], 'ARB_robustness')
+
+# GL/glext.h:7765
+glGetnPixelMapusvARB = _link_function('glGetnPixelMapusvARB', None, [GLenum, GLsizei, POINTER(GLushort)], 'ARB_robustness')
+
+# GL/glext.h:7766
+glGetnPolygonStippleARB = _link_function('glGetnPolygonStippleARB', None, [GLsizei, POINTER(GLubyte)], 'ARB_robustness')
+
+# GL/glext.h:7767
+glGetnColorTableARB = _link_function('glGetnColorTableARB', None, [GLenum, GLenum, GLenum, GLsizei, POINTER(GLvoid)], 'ARB_robustness')
+
+# GL/glext.h:7768
+glGetnConvolutionFilterARB = _link_function('glGetnConvolutionFilterARB', None, [GLenum, GLenum, GLenum, GLsizei, POINTER(GLvoid)], 'ARB_robustness')
+
+# GL/glext.h:7769
+glGetnSeparableFilterARB = _link_function('glGetnSeparableFilterARB', None, [GLenum, GLenum, GLenum, GLsizei, POINTER(GLvoid), GLsizei, POINTER(GLvoid), POINTER(GLvoid)], 'ARB_robustness')
+
+# GL/glext.h:7770
+glGetnHistogramARB = _link_function('glGetnHistogramARB', None, [GLenum, GLboolean, GLenum, GLenum, GLsizei, POINTER(GLvoid)], 'ARB_robustness')
+
+# GL/glext.h:7771
+glGetnMinmaxARB = _link_function('glGetnMinmaxARB', None, [GLenum, GLboolean, GLenum, GLenum, GLsizei, POINTER(GLvoid)], 'ARB_robustness')
+
+# GL/glext.h:7772
+glGetnTexImageARB = _link_function('glGetnTexImageARB', None, [GLenum, GLint, GLenum, GLenum, GLsizei, POINTER(GLvoid)], 'ARB_robustness')
+
+# GL/glext.h:7773
+glReadnPixelsARB = _link_function('glReadnPixelsARB', None, [GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, POINTER(GLvoid)], 'ARB_robustness')
+
+# GL/glext.h:7774
+glGetnCompressedTexImageARB = _link_function('glGetnCompressedTexImageARB', None, [GLenum, GLint, GLsizei, POINTER(GLvoid)], 'ARB_robustness')
+
+# GL/glext.h:7775
+glGetnUniformfvARB = _link_function('glGetnUniformfvARB', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], 'ARB_robustness')
+
+# GL/glext.h:7776
+glGetnUniformivARB = _link_function('glGetnUniformivARB', None, [GLuint, GLint, GLsizei, POINTER(GLint)], 'ARB_robustness')
+
+# GL/glext.h:7777
+glGetnUniformuivARB = _link_function('glGetnUniformuivARB', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], 'ARB_robustness')
+
+# GL/glext.h:7778
+glGetnUniformdvARB = _link_function('glGetnUniformdvARB', None, [GLuint, GLint, GLsizei, POINTER(GLdouble)], 'ARB_robustness')
+
+PFNGLGETGRAPHICSRESETSTATUSARBPROC = CFUNCTYPE(GLenum) # GL/glext.h:7780
+PFNGLGETNMAPDVARBPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, POINTER(GLdouble)) # GL/glext.h:7781
+PFNGLGETNMAPFVARBPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, POINTER(GLfloat)) # GL/glext.h:7782
+PFNGLGETNMAPIVARBPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, POINTER(GLint)) # GL/glext.h:7783
+PFNGLGETNPIXELMAPFVARBPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLfloat)) # GL/glext.h:7784
+PFNGLGETNPIXELMAPUIVARBPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLuint)) # GL/glext.h:7785
+PFNGLGETNPIXELMAPUSVARBPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLushort)) # GL/glext.h:7786
+PFNGLGETNPOLYGONSTIPPLEARBPROC = CFUNCTYPE(None, GLsizei, POINTER(GLubyte)) # GL/glext.h:7787
+PFNGLGETNCOLORTABLEARBPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:7788
+PFNGLGETNCONVOLUTIONFILTERARBPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:7789
+PFNGLGETNSEPARABLEFILTERARBPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLsizei, POINTER(GLvoid), GLsizei, POINTER(GLvoid), POINTER(GLvoid)) # GL/glext.h:7790
+PFNGLGETNHISTOGRAMARBPROC = CFUNCTYPE(None, GLenum, GLboolean, GLenum, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:7791
+PFNGLGETNMINMAXARBPROC = CFUNCTYPE(None, GLenum, GLboolean, GLenum, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:7792
+PFNGLGETNTEXIMAGEARBPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:7793
+PFNGLREADNPIXELSARBPROC = CFUNCTYPE(None, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:7794
+PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC = CFUNCTYPE(None, GLenum, GLint, GLsizei, POINTER(GLvoid)) # GL/glext.h:7795
+PFNGLGETNUNIFORMFVARBPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:7796
+PFNGLGETNUNIFORMIVARBPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:7797
+PFNGLGETNUNIFORMUIVARBPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:7798
+PFNGLGETNUNIFORMDVARBPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLdouble)) # GL/glext.h:7799
+# ARB_shader_stencil_export (GL/glext.h:7802)
+GL_ARB_shader_stencil_export = 1 # GL/glext.h:7803
+# ARB_base_instance (GL/glext.h:7806)
+GL_ARB_base_instance = 1 # GL/glext.h:7807
+# GL/glext.h:7809
+glDrawArraysInstancedBaseInstance = _link_function('glDrawArraysInstancedBaseInstance', None, [GLenum, GLint, GLsizei, GLsizei, GLuint], 'ARB_base_instance')
+
+# GL/glext.h:7810
+glDrawElementsInstancedBaseInstance = _link_function('glDrawElementsInstancedBaseInstance', None, [GLenum, GLsizei, GLenum, POINTER(None), GLsizei, GLuint], 'ARB_base_instance')
+
+# GL/glext.h:7811
+glDrawElementsInstancedBaseVertexBaseInstance = _link_function('glDrawElementsInstancedBaseVertexBaseInstance', None, [GLenum, GLsizei, GLenum, POINTER(None), GLsizei, GLint, GLuint], 'ARB_base_instance')
+
+PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC = CFUNCTYPE(None, GLenum, GLint, GLsizei, GLsizei, GLuint) # GL/glext.h:7813
+PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, POINTER(None), GLsizei, GLuint) # GL/glext.h:7814
+PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, POINTER(None), GLsizei, GLint, GLuint) # GL/glext.h:7815
+# ARB_shading_language_420pack (GL/glext.h:7818)
+GL_ARB_shading_language_420pack = 1 # GL/glext.h:7819
+# ARB_transform_feedback_instanced (GL/glext.h:7822)
+GL_ARB_transform_feedback_instanced = 1 # GL/glext.h:7823
+# GL/glext.h:7825
+glDrawTransformFeedbackInstanced = _link_function('glDrawTransformFeedbackInstanced', None, [GLenum, GLuint, GLsizei], 'ARB_transform_feedback_instanced')
+
+# GL/glext.h:7826
+glDrawTransformFeedbackStreamInstanced = _link_function('glDrawTransformFeedbackStreamInstanced', None, [GLenum, GLuint, GLuint, GLsizei], 'ARB_transform_feedback_instanced')
+
+PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC = CFUNCTYPE(None, GLenum, GLuint, GLsizei) # GL/glext.h:7828
+PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLsizei) # GL/glext.h:7829
+# ARB_compressed_texture_pixel_storage (GL/glext.h:7832)
+GL_ARB_compressed_texture_pixel_storage = 1 # GL/glext.h:7833
+# ARB_conservative_depth (GL/glext.h:7836)
+GL_ARB_conservative_depth = 1 # GL/glext.h:7837
+# ARB_internalformat_query (GL/glext.h:7840)
+GL_ARB_internalformat_query = 1 # GL/glext.h:7841
+# GL/glext.h:7843
+glGetInternalformativ = _link_function('glGetInternalformativ', None, [GLenum, GLenum, GLenum, GLsizei, POINTER(GLint)], 'ARB_internalformat_query')
+
+PFNGLGETINTERNALFORMATIVPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLsizei, POINTER(GLint)) # GL/glext.h:7845
+# ARB_map_buffer_alignment (GL/glext.h:7848)
+GL_ARB_map_buffer_alignment = 1 # GL/glext.h:7849
+# ARB_shader_atomic_counters (GL/glext.h:7852)
+GL_ARB_shader_atomic_counters = 1 # GL/glext.h:7853
+# GL/glext.h:7855
+glGetActiveAtomicCounterBufferiv = _link_function('glGetActiveAtomicCounterBufferiv', None, [GLuint, GLuint, GLenum, POINTER(GLint)], 'ARB_shader_atomic_counters')
+
+PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:7857
+# ARB_shader_image_load_store (GL/glext.h:7860)
+GL_ARB_shader_image_load_store = 1 # GL/glext.h:7861
+# GL/glext.h:7863
+glBindImageTexture = _link_function('glBindImageTexture', None, [GLuint, GLuint, GLint, GLboolean, GLint, GLenum, GLenum], 'ARB_shader_image_load_store')
+
+# GL/glext.h:7864
+glMemoryBarrier = _link_function('glMemoryBarrier', None, [GLbitfield], 'ARB_shader_image_load_store')
+
+PFNGLBINDIMAGETEXTUREPROC = CFUNCTYPE(None, GLuint, GLuint, GLint, GLboolean, GLint, GLenum, GLenum) # GL/glext.h:7866
+PFNGLMEMORYBARRIERPROC = CFUNCTYPE(None, GLbitfield) # GL/glext.h:7867
+# ARB_shading_language_packing (GL/glext.h:7870)
+GL_ARB_shading_language_packing = 1 # GL/glext.h:7871
+# ARB_texture_storage (GL/glext.h:7874)
+GL_ARB_texture_storage = 1 # GL/glext.h:7875
+# GL/glext.h:7877
+glTexStorage1D = _link_function('glTexStorage1D', None, [GLenum, GLsizei, GLenum, GLsizei], 'ARB_texture_storage')
+
+# GL/glext.h:7878
+glTexStorage2D = _link_function('glTexStorage2D', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei], 'ARB_texture_storage')
+
+# GL/glext.h:7879
+glTexStorage3D = _link_function('glTexStorage3D', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei], 'ARB_texture_storage')
+
+# GL/glext.h:7880
+glTextureStorage1DEXT = _link_function('glTextureStorage1DEXT', None, [GLuint, GLenum, GLsizei, GLenum, GLsizei], 'ARB_texture_storage')
+
+# GL/glext.h:7881
+glTextureStorage2DEXT = _link_function('glTextureStorage2DEXT', None, [GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei], 'ARB_texture_storage')
+
+# GL/glext.h:7882
+glTextureStorage3DEXT = _link_function('glTextureStorage3DEXT', None, [GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei], 'ARB_texture_storage')
+
+PFNGLTEXSTORAGE1DPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, GLsizei) # GL/glext.h:7884
+PFNGLTEXSTORAGE2DPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, GLsizei, GLsizei) # GL/glext.h:7885
+PFNGLTEXSTORAGE3DPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei) # GL/glext.h:7886
+PFNGLTEXTURESTORAGE1DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLsizei, GLenum, GLsizei) # GL/glext.h:7887
+PFNGLTEXTURESTORAGE2DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei) # GL/glext.h:7888
+PFNGLTEXTURESTORAGE3DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei) # GL/glext.h:7889
+# EXT_abgr (GL/glext.h:7892)
+GL_EXT_abgr = 1 # GL/glext.h:7893
+# EXT_blend_color (GL/glext.h:7896)
+GL_EXT_blend_color = 1 # GL/glext.h:7897
+# GL/glext.h:7899
+glBlendColorEXT = _link_function('glBlendColorEXT', None, [GLfloat, GLfloat, GLfloat, GLfloat], 'EXT_blend_color')
+
+PFNGLBLENDCOLOREXTPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:7901
+# EXT_polygon_offset (GL/glext.h:7904)
+GL_EXT_polygon_offset = 1 # GL/glext.h:7905
+# GL/glext.h:7907
+glPolygonOffsetEXT = _link_function('glPolygonOffsetEXT', None, [GLfloat, GLfloat], 'EXT_polygon_offset')
+
+PFNGLPOLYGONOFFSETEXTPROC = CFUNCTYPE(None, GLfloat, GLfloat) # GL/glext.h:7909
+# EXT_texture (GL/glext.h:7912)
+GL_EXT_texture = 1 # GL/glext.h:7913
+# EXT_texture3D (GL/glext.h:7916)
+GL_EXT_texture3D = 1 # GL/glext.h:7917
+# GL/glext.h:7919
+glTexImage3DEXT = _link_function('glTexImage3DEXT', None, [GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_texture3D')
+
+# GL/glext.h:7920
+glTexSubImage3DEXT = _link_function('glTexSubImage3DEXT', None, [GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_texture3D')
+
+PFNGLTEXIMAGE3DEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:7922
+PFNGLTEXSUBIMAGE3DEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:7923
+# SGIS_texture_filter4 (GL/glext.h:7926)
+GL_SGIS_texture_filter4 = 1 # GL/glext.h:7927
+# GL/glext.h:7929
+glGetTexFilterFuncSGIS = _link_function('glGetTexFilterFuncSGIS', None, [GLenum, GLenum, POINTER(GLfloat)], 'SGIS_texture_filter4')
+
+# GL/glext.h:7930
+glTexFilterFuncSGIS = _link_function('glTexFilterFuncSGIS', None, [GLenum, GLenum, GLsizei, POINTER(GLfloat)], 'SGIS_texture_filter4')
+
+PFNGLGETTEXFILTERFUNCSGISPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:7932
+PFNGLTEXFILTERFUNCSGISPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, POINTER(GLfloat)) # GL/glext.h:7933
+# EXT_subtexture (GL/glext.h:7936)
+GL_EXT_subtexture = 1 # GL/glext.h:7937
+# GL/glext.h:7939
+glTexSubImage1DEXT = _link_function('glTexSubImage1DEXT', None, [GLenum, GLint, GLint, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_subtexture')
+
+# GL/glext.h:7940
+glTexSubImage2DEXT = _link_function('glTexSubImage2DEXT', None, [GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_subtexture')
+
+PFNGLTEXSUBIMAGE1DEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:7942
+PFNGLTEXSUBIMAGE2DEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:7943
+# EXT_copy_texture (GL/glext.h:7946)
+GL_EXT_copy_texture = 1 # GL/glext.h:7947
+# GL/glext.h:7949
+glCopyTexImage1DEXT = _link_function('glCopyTexImage1DEXT', None, [GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint], 'EXT_copy_texture')
+
+# GL/glext.h:7950
+glCopyTexImage2DEXT = _link_function('glCopyTexImage2DEXT', None, [GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint], 'EXT_copy_texture')
+
+# GL/glext.h:7951
+glCopyTexSubImage1DEXT = _link_function('glCopyTexSubImage1DEXT', None, [GLenum, GLint, GLint, GLint, GLint, GLsizei], 'EXT_copy_texture')
+
+# GL/glext.h:7952
+glCopyTexSubImage2DEXT = _link_function('glCopyTexSubImage2DEXT', None, [GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], 'EXT_copy_texture')
+
+# GL/glext.h:7953
+glCopyTexSubImage3DEXT = _link_function('glCopyTexSubImage3DEXT', None, [GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], 'EXT_copy_texture')
+
+PFNGLCOPYTEXIMAGE1DEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint) # GL/glext.h:7955
+PFNGLCOPYTEXIMAGE2DEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint) # GL/glext.h:7956
+PFNGLCOPYTEXSUBIMAGE1DEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLint, GLsizei) # GL/glext.h:7957
+PFNGLCOPYTEXSUBIMAGE2DEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) # GL/glext.h:7958
+PFNGLCOPYTEXSUBIMAGE3DEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) # GL/glext.h:7959
+# EXT_histogram (GL/glext.h:7962)
+GL_EXT_histogram = 1 # GL/glext.h:7963
+# GL/glext.h:7965
+glGetHistogramEXT = _link_function('glGetHistogramEXT', None, [GLenum, GLboolean, GLenum, GLenum, POINTER(GLvoid)], 'EXT_histogram')
+
+# GL/glext.h:7966
+glGetHistogramParameterfvEXT = _link_function('glGetHistogramParameterfvEXT', None, [GLenum, GLenum, POINTER(GLfloat)], 'EXT_histogram')
+
+# GL/glext.h:7967
+glGetHistogramParameterivEXT = _link_function('glGetHistogramParameterivEXT', None, [GLenum, GLenum, POINTER(GLint)], 'EXT_histogram')
+
+# GL/glext.h:7968
+glGetMinmaxEXT = _link_function('glGetMinmaxEXT', None, [GLenum, GLboolean, GLenum, GLenum, POINTER(GLvoid)], 'EXT_histogram')
+
+# GL/glext.h:7969
+glGetMinmaxParameterfvEXT = _link_function('glGetMinmaxParameterfvEXT', None, [GLenum, GLenum, POINTER(GLfloat)], 'EXT_histogram')
+
+# GL/glext.h:7970
+glGetMinmaxParameterivEXT = _link_function('glGetMinmaxParameterivEXT', None, [GLenum, GLenum, POINTER(GLint)], 'EXT_histogram')
+
+# GL/glext.h:7971
+glHistogramEXT = _link_function('glHistogramEXT', None, [GLenum, GLsizei, GLenum, GLboolean], 'EXT_histogram')
+
+# GL/glext.h:7972
+glMinmaxEXT = _link_function('glMinmaxEXT', None, [GLenum, GLenum, GLboolean], 'EXT_histogram')
+
+# GL/glext.h:7973
+glResetHistogramEXT = _link_function('glResetHistogramEXT', None, [GLenum], 'EXT_histogram')
+
+# GL/glext.h:7974
+glResetMinmaxEXT = _link_function('glResetMinmaxEXT', None, [GLenum], 'EXT_histogram')
+
+PFNGLGETHISTOGRAMEXTPROC = CFUNCTYPE(None, GLenum, GLboolean, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:7976
+PFNGLGETHISTOGRAMPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:7977
+PFNGLGETHISTOGRAMPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:7978
+PFNGLGETMINMAXEXTPROC = CFUNCTYPE(None, GLenum, GLboolean, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:7979
+PFNGLGETMINMAXPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:7980
+PFNGLGETMINMAXPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:7981
+PFNGLHISTOGRAMEXTPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, GLboolean) # GL/glext.h:7982
+PFNGLMINMAXEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLboolean) # GL/glext.h:7983
+PFNGLRESETHISTOGRAMEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:7984
+PFNGLRESETMINMAXEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:7985
+# EXT_convolution (GL/glext.h:7988)
+GL_EXT_convolution = 1 # GL/glext.h:7989
+# GL/glext.h:7991
+glConvolutionFilter1DEXT = _link_function('glConvolutionFilter1DEXT', None, [GLenum, GLenum, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_convolution')
+
+# GL/glext.h:7992
+glConvolutionFilter2DEXT = _link_function('glConvolutionFilter2DEXT', None, [GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_convolution')
+
+# GL/glext.h:7993
+glConvolutionParameterfEXT = _link_function('glConvolutionParameterfEXT', None, [GLenum, GLenum, GLfloat], 'EXT_convolution')
+
+# GL/glext.h:7994
+glConvolutionParameterfvEXT = _link_function('glConvolutionParameterfvEXT', None, [GLenum, GLenum, POINTER(GLfloat)], 'EXT_convolution')
+
+# GL/glext.h:7995
+glConvolutionParameteriEXT = _link_function('glConvolutionParameteriEXT', None, [GLenum, GLenum, GLint], 'EXT_convolution')
+
+# GL/glext.h:7996
+glConvolutionParameterivEXT = _link_function('glConvolutionParameterivEXT', None, [GLenum, GLenum, POINTER(GLint)], 'EXT_convolution')
+
+# GL/glext.h:7997
+glCopyConvolutionFilter1DEXT = _link_function('glCopyConvolutionFilter1DEXT', None, [GLenum, GLenum, GLint, GLint, GLsizei], 'EXT_convolution')
+
+# GL/glext.h:7998
+glCopyConvolutionFilter2DEXT = _link_function('glCopyConvolutionFilter2DEXT', None, [GLenum, GLenum, GLint, GLint, GLsizei, GLsizei], 'EXT_convolution')
+
+# GL/glext.h:7999
+glGetConvolutionFilterEXT = _link_function('glGetConvolutionFilterEXT', None, [GLenum, GLenum, GLenum, POINTER(GLvoid)], 'EXT_convolution')
+
+# GL/glext.h:8000
+glGetConvolutionParameterfvEXT = _link_function('glGetConvolutionParameterfvEXT', None, [GLenum, GLenum, POINTER(GLfloat)], 'EXT_convolution')
+
+# GL/glext.h:8001
+glGetConvolutionParameterivEXT = _link_function('glGetConvolutionParameterivEXT', None, [GLenum, GLenum, POINTER(GLint)], 'EXT_convolution')
+
+# GL/glext.h:8002
+glGetSeparableFilterEXT = _link_function('glGetSeparableFilterEXT', None, [GLenum, GLenum, GLenum, POINTER(GLvoid), POINTER(GLvoid), POINTER(GLvoid)], 'EXT_convolution')
+
+# GL/glext.h:8003
+glSeparableFilter2DEXT = _link_function('glSeparableFilter2DEXT', None, [GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid), POINTER(GLvoid)], 'EXT_convolution')
+
+PFNGLCONVOLUTIONFILTER1DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8005
+PFNGLCONVOLUTIONFILTER2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8006
+PFNGLCONVOLUTIONPARAMETERFEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLfloat) # GL/glext.h:8007
+PFNGLCONVOLUTIONPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8008
+PFNGLCONVOLUTIONPARAMETERIEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint) # GL/glext.h:8009
+PFNGLCONVOLUTIONPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8010
+PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLsizei) # GL/glext.h:8011
+PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLsizei, GLsizei) # GL/glext.h:8012
+PFNGLGETCONVOLUTIONFILTEREXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8013
+PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8014
+PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8015
+PFNGLGETSEPARABLEFILTEREXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLvoid), POINTER(GLvoid), POINTER(GLvoid)) # GL/glext.h:8016
+PFNGLSEPARABLEFILTER2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid), POINTER(GLvoid)) # GL/glext.h:8017
+# SGI_color_matrix (GL/glext.h:8020)
+GL_SGI_color_matrix = 1 # GL/glext.h:8021
+# SGI_color_table (GL/glext.h:8024)
+GL_SGI_color_table = 1 # GL/glext.h:8025
+# GL/glext.h:8027
+glColorTableSGI = _link_function('glColorTableSGI', None, [GLenum, GLenum, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'SGI_color_table')
+
+# GL/glext.h:8028
+glColorTableParameterfvSGI = _link_function('glColorTableParameterfvSGI', None, [GLenum, GLenum, POINTER(GLfloat)], 'SGI_color_table')
+
+# GL/glext.h:8029
+glColorTableParameterivSGI = _link_function('glColorTableParameterivSGI', None, [GLenum, GLenum, POINTER(GLint)], 'SGI_color_table')
+
+# GL/glext.h:8030
+glCopyColorTableSGI = _link_function('glCopyColorTableSGI', None, [GLenum, GLenum, GLint, GLint, GLsizei], 'SGI_color_table')
+
+# GL/glext.h:8031
+glGetColorTableSGI = _link_function('glGetColorTableSGI', None, [GLenum, GLenum, GLenum, POINTER(GLvoid)], 'SGI_color_table')
+
+# GL/glext.h:8032
+glGetColorTableParameterfvSGI = _link_function('glGetColorTableParameterfvSGI', None, [GLenum, GLenum, POINTER(GLfloat)], 'SGI_color_table')
+
+# GL/glext.h:8033
+glGetColorTableParameterivSGI = _link_function('glGetColorTableParameterivSGI', None, [GLenum, GLenum, POINTER(GLint)], 'SGI_color_table')
+
+PFNGLCOLORTABLESGIPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8035
+PFNGLCOLORTABLEPARAMETERFVSGIPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8036
+PFNGLCOLORTABLEPARAMETERIVSGIPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8037
+PFNGLCOPYCOLORTABLESGIPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLsizei) # GL/glext.h:8038
+PFNGLGETCOLORTABLESGIPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8039
+PFNGLGETCOLORTABLEPARAMETERFVSGIPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8040
+PFNGLGETCOLORTABLEPARAMETERIVSGIPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8041
+# SGIX_pixel_texture (GL/glext.h:8044)
+GL_SGIX_pixel_texture = 1 # GL/glext.h:8045
+# GL/glext.h:8047
+glPixelTexGenSGIX = _link_function('glPixelTexGenSGIX', None, [GLenum], 'SGIX_pixel_texture')
+
+PFNGLPIXELTEXGENSGIXPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:8049
+# SGIS_pixel_texture (GL/glext.h:8052)
+GL_SGIS_pixel_texture = 1 # GL/glext.h:8053
+# GL/glext.h:8055
+glPixelTexGenParameteriSGIS = _link_function('glPixelTexGenParameteriSGIS', None, [GLenum, GLint], 'SGIS_pixel_texture')
+
+# GL/glext.h:8056
+glPixelTexGenParameterivSGIS = _link_function('glPixelTexGenParameterivSGIS', None, [GLenum, POINTER(GLint)], 'SGIS_pixel_texture')
+
+# GL/glext.h:8057
+glPixelTexGenParameterfSGIS = _link_function('glPixelTexGenParameterfSGIS', None, [GLenum, GLfloat], 'SGIS_pixel_texture')
+
+# GL/glext.h:8058
+glPixelTexGenParameterfvSGIS = _link_function('glPixelTexGenParameterfvSGIS', None, [GLenum, POINTER(GLfloat)], 'SGIS_pixel_texture')
+
+# GL/glext.h:8059
+glGetPixelTexGenParameterivSGIS = _link_function('glGetPixelTexGenParameterivSGIS', None, [GLenum, POINTER(GLint)], 'SGIS_pixel_texture')
+
+# GL/glext.h:8060
+glGetPixelTexGenParameterfvSGIS = _link_function('glGetPixelTexGenParameterfvSGIS', None, [GLenum, POINTER(GLfloat)], 'SGIS_pixel_texture')
+
+PFNGLPIXELTEXGENPARAMETERISGISPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:8062
+PFNGLPIXELTEXGENPARAMETERIVSGISPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:8063
+PFNGLPIXELTEXGENPARAMETERFSGISPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:8064
+PFNGLPIXELTEXGENPARAMETERFVSGISPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:8065
+PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:8066
+PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:8067
+# SGIS_texture4D (GL/glext.h:8070)
+GL_SGIS_texture4D = 1 # GL/glext.h:8071
+# GL/glext.h:8073
+glTexImage4DSGIS = _link_function('glTexImage4DSGIS', None, [GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], 'SGIS_texture4D')
+
+# GL/glext.h:8074
+glTexSubImage4DSGIS = _link_function('glTexSubImage4DSGIS', None, [GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'SGIS_texture4D')
+
+PFNGLTEXIMAGE4DSGISPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8076
+PFNGLTEXSUBIMAGE4DSGISPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8077
+# SGI_texture_color_table (GL/glext.h:8080)
+GL_SGI_texture_color_table = 1 # GL/glext.h:8081
+# EXT_cmyka (GL/glext.h:8084)
+GL_EXT_cmyka = 1 # GL/glext.h:8085
+# EXT_texture_object (GL/glext.h:8088)
+GL_EXT_texture_object = 1 # GL/glext.h:8089
+# GL/glext.h:8091
+glAreTexturesResidentEXT = _link_function('glAreTexturesResidentEXT', GLboolean, [GLsizei, POINTER(GLuint), POINTER(GLboolean)], 'EXT_texture_object')
+
+# GL/glext.h:8092
+glBindTextureEXT = _link_function('glBindTextureEXT', None, [GLenum, GLuint], 'EXT_texture_object')
+
+# GL/glext.h:8093
+glDeleteTexturesEXT = _link_function('glDeleteTexturesEXT', None, [GLsizei, POINTER(GLuint)], 'EXT_texture_object')
+
+# GL/glext.h:8094
+glGenTexturesEXT = _link_function('glGenTexturesEXT', None, [GLsizei, POINTER(GLuint)], 'EXT_texture_object')
+
+# GL/glext.h:8095
+glIsTextureEXT = _link_function('glIsTextureEXT', GLboolean, [GLuint], 'EXT_texture_object')
+
+GLclampf = c_float # /usr/include/GL/gl.h:161
+# GL/glext.h:8096
+glPrioritizeTexturesEXT = _link_function('glPrioritizeTexturesEXT', None, [GLsizei, POINTER(GLuint), POINTER(GLclampf)], 'EXT_texture_object')
+
+PFNGLARETEXTURESRESIDENTEXTPROC = CFUNCTYPE(GLboolean, GLsizei, POINTER(GLuint), POINTER(GLboolean)) # GL/glext.h:8098
+PFNGLBINDTEXTUREEXTPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:8099
+PFNGLDELETETEXTURESEXTPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:8100
+PFNGLGENTEXTURESEXTPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:8101
+PFNGLISTEXTUREEXTPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:8102
+PFNGLPRIORITIZETEXTURESEXTPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint), POINTER(GLclampf)) # GL/glext.h:8103
+# SGIS_detail_texture (GL/glext.h:8106)
+GL_SGIS_detail_texture = 1 # GL/glext.h:8107
+# GL/glext.h:8109
+glDetailTexFuncSGIS = _link_function('glDetailTexFuncSGIS', None, [GLenum, GLsizei, POINTER(GLfloat)], 'SGIS_detail_texture')
+
+# GL/glext.h:8110
+glGetDetailTexFuncSGIS = _link_function('glGetDetailTexFuncSGIS', None, [GLenum, POINTER(GLfloat)], 'SGIS_detail_texture')
+
+PFNGLDETAILTEXFUNCSGISPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLfloat)) # GL/glext.h:8112
+PFNGLGETDETAILTEXFUNCSGISPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:8113
+# SGIS_sharpen_texture (GL/glext.h:8116)
+GL_SGIS_sharpen_texture = 1 # GL/glext.h:8117
+# GL/glext.h:8119
+glSharpenTexFuncSGIS = _link_function('glSharpenTexFuncSGIS', None, [GLenum, GLsizei, POINTER(GLfloat)], 'SGIS_sharpen_texture')
+
+# GL/glext.h:8120
+glGetSharpenTexFuncSGIS = _link_function('glGetSharpenTexFuncSGIS', None, [GLenum, POINTER(GLfloat)], 'SGIS_sharpen_texture')
+
+PFNGLSHARPENTEXFUNCSGISPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLfloat)) # GL/glext.h:8122
+PFNGLGETSHARPENTEXFUNCSGISPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:8123
+# EXT_packed_pixels (GL/glext.h:8126)
+GL_EXT_packed_pixels = 1 # GL/glext.h:8127
+# SGIS_texture_lod (GL/glext.h:8130)
+GL_SGIS_texture_lod = 1 # GL/glext.h:8131
+# SGIS_multisample (GL/glext.h:8134)
+GL_SGIS_multisample = 1 # GL/glext.h:8135
+# GL/glext.h:8137
+glSampleMaskSGIS = _link_function('glSampleMaskSGIS', None, [GLclampf, GLboolean], 'SGIS_multisample')
+
+# GL/glext.h:8138
+glSamplePatternSGIS = _link_function('glSamplePatternSGIS', None, [GLenum], 'SGIS_multisample')
+
+PFNGLSAMPLEMASKSGISPROC = CFUNCTYPE(None, GLclampf, GLboolean) # GL/glext.h:8140
+PFNGLSAMPLEPATTERNSGISPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:8141
+# EXT_rescale_normal (GL/glext.h:8144)
+GL_EXT_rescale_normal = 1 # GL/glext.h:8145
+# EXT_vertex_array (GL/glext.h:8148)
+GL_EXT_vertex_array = 1 # GL/glext.h:8149
+# GL/glext.h:8151
+glArrayElementEXT = _link_function('glArrayElementEXT', None, [GLint], 'EXT_vertex_array')
+
+# GL/glext.h:8152
+glColorPointerEXT = _link_function('glColorPointerEXT', None, [GLint, GLenum, GLsizei, GLsizei, POINTER(GLvoid)], 'EXT_vertex_array')
+
+# GL/glext.h:8153
+glDrawArraysEXT = _link_function('glDrawArraysEXT', None, [GLenum, GLint, GLsizei], 'EXT_vertex_array')
+
+# GL/glext.h:8154
+glEdgeFlagPointerEXT = _link_function('glEdgeFlagPointerEXT', None, [GLsizei, GLsizei, POINTER(GLboolean)], 'EXT_vertex_array')
+
+# GL/glext.h:8155
+glGetPointervEXT = _link_function('glGetPointervEXT', None, [GLenum, POINTER(POINTER(GLvoid))], 'EXT_vertex_array')
+
+# GL/glext.h:8156
+glIndexPointerEXT = _link_function('glIndexPointerEXT', None, [GLenum, GLsizei, GLsizei, POINTER(GLvoid)], 'EXT_vertex_array')
+
+# GL/glext.h:8157
+glNormalPointerEXT = _link_function('glNormalPointerEXT', None, [GLenum, GLsizei, GLsizei, POINTER(GLvoid)], 'EXT_vertex_array')
+
+# GL/glext.h:8158
+glTexCoordPointerEXT = _link_function('glTexCoordPointerEXT', None, [GLint, GLenum, GLsizei, GLsizei, POINTER(GLvoid)], 'EXT_vertex_array')
+
+# GL/glext.h:8159
+glVertexPointerEXT = _link_function('glVertexPointerEXT', None, [GLint, GLenum, GLsizei, GLsizei, POINTER(GLvoid)], 'EXT_vertex_array')
+
+PFNGLARRAYELEMENTEXTPROC = CFUNCTYPE(None, GLint) # GL/glext.h:8161
+PFNGLCOLORPOINTEREXTPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei, GLsizei, POINTER(GLvoid)) # GL/glext.h:8162
+PFNGLDRAWARRAYSEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLsizei) # GL/glext.h:8163
+PFNGLEDGEFLAGPOINTEREXTPROC = CFUNCTYPE(None, GLsizei, GLsizei, POINTER(GLboolean)) # GL/glext.h:8164
+PFNGLGETPOINTERVEXTPROC = CFUNCTYPE(None, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:8165
+PFNGLINDEXPOINTEREXTPROC = CFUNCTYPE(None, GLenum, GLsizei, GLsizei, POINTER(GLvoid)) # GL/glext.h:8166
+PFNGLNORMALPOINTEREXTPROC = CFUNCTYPE(None, GLenum, GLsizei, GLsizei, POINTER(GLvoid)) # GL/glext.h:8167
+PFNGLTEXCOORDPOINTEREXTPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei, GLsizei, POINTER(GLvoid)) # GL/glext.h:8168
+PFNGLVERTEXPOINTEREXTPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei, GLsizei, POINTER(GLvoid)) # GL/glext.h:8169
+# EXT_misc_attribute (GL/glext.h:8172)
+GL_EXT_misc_attribute = 1 # GL/glext.h:8173
+# SGIS_generate_mipmap (GL/glext.h:8176)
+GL_SGIS_generate_mipmap = 1 # GL/glext.h:8177
+# SGIX_clipmap (GL/glext.h:8180)
+GL_SGIX_clipmap = 1 # GL/glext.h:8181
+# SGIX_shadow (GL/glext.h:8184)
+GL_SGIX_shadow = 1 # GL/glext.h:8185
+# SGIS_texture_edge_clamp (GL/glext.h:8188)
+GL_SGIS_texture_edge_clamp = 1 # GL/glext.h:8189
+# SGIS_texture_border_clamp (GL/glext.h:8192)
+GL_SGIS_texture_border_clamp = 1 # GL/glext.h:8193
+# EXT_blend_minmax (GL/glext.h:8196)
+GL_EXT_blend_minmax = 1 # GL/glext.h:8197
+# GL/glext.h:8199
+glBlendEquationEXT = _link_function('glBlendEquationEXT', None, [GLenum], 'EXT_blend_minmax')
+
+PFNGLBLENDEQUATIONEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:8201
+# EXT_blend_subtract (GL/glext.h:8204)
+GL_EXT_blend_subtract = 1 # GL/glext.h:8205
+# EXT_blend_logic_op (GL/glext.h:8208)
+GL_EXT_blend_logic_op = 1 # GL/glext.h:8209
+# SGIX_interlace (GL/glext.h:8212)
+GL_SGIX_interlace = 1 # GL/glext.h:8213
+# SGIX_pixel_tiles (GL/glext.h:8216)
+GL_SGIX_pixel_tiles = 1 # GL/glext.h:8217
+# SGIX_texture_select (GL/glext.h:8220)
+GL_SGIX_texture_select = 1 # GL/glext.h:8221
+# SGIX_sprite (GL/glext.h:8224)
+GL_SGIX_sprite = 1 # GL/glext.h:8225
+# GL/glext.h:8227
+glSpriteParameterfSGIX = _link_function('glSpriteParameterfSGIX', None, [GLenum, GLfloat], 'SGIX_sprite')
+
+# GL/glext.h:8228
+glSpriteParameterfvSGIX = _link_function('glSpriteParameterfvSGIX', None, [GLenum, POINTER(GLfloat)], 'SGIX_sprite')
+
+# GL/glext.h:8229
+glSpriteParameteriSGIX = _link_function('glSpriteParameteriSGIX', None, [GLenum, GLint], 'SGIX_sprite')
+
+# GL/glext.h:8230
+glSpriteParameterivSGIX = _link_function('glSpriteParameterivSGIX', None, [GLenum, POINTER(GLint)], 'SGIX_sprite')
+
+PFNGLSPRITEPARAMETERFSGIXPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:8232
+PFNGLSPRITEPARAMETERFVSGIXPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:8233
+PFNGLSPRITEPARAMETERISGIXPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:8234
+PFNGLSPRITEPARAMETERIVSGIXPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:8235
+# SGIX_texture_multi_buffer (GL/glext.h:8238)
+GL_SGIX_texture_multi_buffer = 1 # GL/glext.h:8239
+# EXT_point_parameters (GL/glext.h:8242)
+GL_EXT_point_parameters = 1 # GL/glext.h:8243
+# GL/glext.h:8245
+glPointParameterfEXT = _link_function('glPointParameterfEXT', None, [GLenum, GLfloat], 'EXT_point_parameters')
+
+# GL/glext.h:8246
+glPointParameterfvEXT = _link_function('glPointParameterfvEXT', None, [GLenum, POINTER(GLfloat)], 'EXT_point_parameters')
+
+PFNGLPOINTPARAMETERFEXTPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:8248
+PFNGLPOINTPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:8249
+# SGIS_point_parameters (GL/glext.h:8252)
+GL_SGIS_point_parameters = 1 # GL/glext.h:8253
+# GL/glext.h:8255
+glPointParameterfSGIS = _link_function('glPointParameterfSGIS', None, [GLenum, GLfloat], 'SGIS_point_parameters')
+
+# GL/glext.h:8256
+glPointParameterfvSGIS = _link_function('glPointParameterfvSGIS', None, [GLenum, POINTER(GLfloat)], 'SGIS_point_parameters')
+
+PFNGLPOINTPARAMETERFSGISPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:8258
+PFNGLPOINTPARAMETERFVSGISPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:8259
+# SGIX_instruments (GL/glext.h:8262)
+GL_SGIX_instruments = 1 # GL/glext.h:8263
+# GL/glext.h:8265
+glGetInstrumentsSGIX = _link_function('glGetInstrumentsSGIX', GLint, [], 'SGIX_instruments')
+
+# GL/glext.h:8266
+glInstrumentsBufferSGIX = _link_function('glInstrumentsBufferSGIX', None, [GLsizei, POINTER(GLint)], 'SGIX_instruments')
+
+# GL/glext.h:8267
+glPollInstrumentsSGIX = _link_function('glPollInstrumentsSGIX', GLint, [POINTER(GLint)], 'SGIX_instruments')
+
+# GL/glext.h:8268
+glReadInstrumentsSGIX = _link_function('glReadInstrumentsSGIX', None, [GLint], 'SGIX_instruments')
+
+# GL/glext.h:8269
+glStartInstrumentsSGIX = _link_function('glStartInstrumentsSGIX', None, [], 'SGIX_instruments')
+
+# GL/glext.h:8270
+glStopInstrumentsSGIX = _link_function('glStopInstrumentsSGIX', None, [GLint], 'SGIX_instruments')
+
+PFNGLGETINSTRUMENTSSGIXPROC = CFUNCTYPE(GLint) # GL/glext.h:8272
+PFNGLINSTRUMENTSBUFFERSGIXPROC = CFUNCTYPE(None, GLsizei, POINTER(GLint)) # GL/glext.h:8273
+PFNGLPOLLINSTRUMENTSSGIXPROC = CFUNCTYPE(GLint, POINTER(GLint)) # GL/glext.h:8274
+PFNGLREADINSTRUMENTSSGIXPROC = CFUNCTYPE(None, GLint) # GL/glext.h:8275
+PFNGLSTARTINSTRUMENTSSGIXPROC = CFUNCTYPE(None) # GL/glext.h:8276
+PFNGLSTOPINSTRUMENTSSGIXPROC = CFUNCTYPE(None, GLint) # GL/glext.h:8277
+# SGIX_texture_scale_bias (GL/glext.h:8280)
+GL_SGIX_texture_scale_bias = 1 # GL/glext.h:8281
+# SGIX_framezoom (GL/glext.h:8284)
+GL_SGIX_framezoom = 1 # GL/glext.h:8285
+# GL/glext.h:8287
+glFrameZoomSGIX = _link_function('glFrameZoomSGIX', None, [GLint], 'SGIX_framezoom')
+
+PFNGLFRAMEZOOMSGIXPROC = CFUNCTYPE(None, GLint) # GL/glext.h:8289
+# SGIX_tag_sample_buffer (GL/glext.h:8292)
+GL_SGIX_tag_sample_buffer = 1 # GL/glext.h:8293
+# GL/glext.h:8295
+glTagSampleBufferSGIX = _link_function('glTagSampleBufferSGIX', None, [], 'SGIX_tag_sample_buffer')
+
+PFNGLTAGSAMPLEBUFFERSGIXPROC = CFUNCTYPE(None) # GL/glext.h:8297
+# SGIX_polynomial_ffd (GL/glext.h:8300)
+GL_SGIX_polynomial_ffd = 1 # GL/glext.h:8301
+# GL/glext.h:8303
+glDeformationMap3dSGIX = _link_function('glDeformationMap3dSGIX', None, [GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, POINTER(GLdouble)], 'SGIX_polynomial_ffd')
+
+# GL/glext.h:8304
+glDeformationMap3fSGIX = _link_function('glDeformationMap3fSGIX', None, [GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, POINTER(GLfloat)], 'SGIX_polynomial_ffd')
+
+# GL/glext.h:8305
+glDeformSGIX = _link_function('glDeformSGIX', None, [GLbitfield], 'SGIX_polynomial_ffd')
+
+# GL/glext.h:8306
+glLoadIdentityDeformationMapSGIX = _link_function('glLoadIdentityDeformationMapSGIX', None, [GLbitfield], 'SGIX_polynomial_ffd')
+
+PFNGLDEFORMATIONMAP3DSGIXPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, POINTER(GLdouble)) # GL/glext.h:8308
+PFNGLDEFORMATIONMAP3FSGIXPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, POINTER(GLfloat)) # GL/glext.h:8309
+PFNGLDEFORMSGIXPROC = CFUNCTYPE(None, GLbitfield) # GL/glext.h:8310
+PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC = CFUNCTYPE(None, GLbitfield) # GL/glext.h:8311
+# SGIX_reference_plane (GL/glext.h:8314)
+GL_SGIX_reference_plane = 1 # GL/glext.h:8315
+# GL/glext.h:8317
+glReferencePlaneSGIX = _link_function('glReferencePlaneSGIX', None, [POINTER(GLdouble)], 'SGIX_reference_plane')
+
+PFNGLREFERENCEPLANESGIXPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:8319
+# SGIX_flush_raster (GL/glext.h:8322)
+GL_SGIX_flush_raster = 1 # GL/glext.h:8323
+# GL/glext.h:8325
+glFlushRasterSGIX = _link_function('glFlushRasterSGIX', None, [], 'SGIX_flush_raster')
+
+PFNGLFLUSHRASTERSGIXPROC = CFUNCTYPE(None) # GL/glext.h:8327
+# SGIX_depth_texture (GL/glext.h:8330)
+GL_SGIX_depth_texture = 1 # GL/glext.h:8331
+# SGIS_fog_function (GL/glext.h:8334)
+GL_SGIS_fog_function = 1 # GL/glext.h:8335
+# GL/glext.h:8337
+glFogFuncSGIS = _link_function('glFogFuncSGIS', None, [GLsizei, POINTER(GLfloat)], 'SGIS_fog_function')
+
+# GL/glext.h:8338
+glGetFogFuncSGIS = _link_function('glGetFogFuncSGIS', None, [POINTER(GLfloat)], 'SGIS_fog_function')
+
+PFNGLFOGFUNCSGISPROC = CFUNCTYPE(None, GLsizei, POINTER(GLfloat)) # GL/glext.h:8340
+PFNGLGETFOGFUNCSGISPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:8341
+# SGIX_fog_offset (GL/glext.h:8344)
+GL_SGIX_fog_offset = 1 # GL/glext.h:8345
+# HP_image_transform (GL/glext.h:8348)
+GL_HP_image_transform = 1 # GL/glext.h:8349
+# GL/glext.h:8351
+glImageTransformParameteriHP = _link_function('glImageTransformParameteriHP', None, [GLenum, GLenum, GLint], 'HP_image_transform')
+
+# GL/glext.h:8352
+glImageTransformParameterfHP = _link_function('glImageTransformParameterfHP', None, [GLenum, GLenum, GLfloat], 'HP_image_transform')
+
+# GL/glext.h:8353
+glImageTransformParameterivHP = _link_function('glImageTransformParameterivHP', None, [GLenum, GLenum, POINTER(GLint)], 'HP_image_transform')
+
+# GL/glext.h:8354
+glImageTransformParameterfvHP = _link_function('glImageTransformParameterfvHP', None, [GLenum, GLenum, POINTER(GLfloat)], 'HP_image_transform')
+
+# GL/glext.h:8355
+glGetImageTransformParameterivHP = _link_function('glGetImageTransformParameterivHP', None, [GLenum, GLenum, POINTER(GLint)], 'HP_image_transform')
+
+# GL/glext.h:8356
+glGetImageTransformParameterfvHP = _link_function('glGetImageTransformParameterfvHP', None, [GLenum, GLenum, POINTER(GLfloat)], 'HP_image_transform')
+
+PFNGLIMAGETRANSFORMPARAMETERIHPPROC = CFUNCTYPE(None, GLenum, GLenum, GLint) # GL/glext.h:8358
+PFNGLIMAGETRANSFORMPARAMETERFHPPROC = CFUNCTYPE(None, GLenum, GLenum, GLfloat) # GL/glext.h:8359
+PFNGLIMAGETRANSFORMPARAMETERIVHPPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8360
+PFNGLIMAGETRANSFORMPARAMETERFVHPPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8361
+PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8362
+PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8363
+# HP_convolution_border_modes (GL/glext.h:8366)
+GL_HP_convolution_border_modes = 1 # GL/glext.h:8367
+# SGIX_texture_add_env (GL/glext.h:8370)
+GL_SGIX_texture_add_env = 1 # GL/glext.h:8371
+# EXT_color_subtable (GL/glext.h:8374)
+GL_EXT_color_subtable = 1 # GL/glext.h:8375
+# GL/glext.h:8377
+glColorSubTableEXT = _link_function('glColorSubTableEXT', None, [GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_color_subtable')
+
+# GL/glext.h:8378
+glCopyColorSubTableEXT = _link_function('glCopyColorSubTableEXT', None, [GLenum, GLsizei, GLint, GLint, GLsizei], 'EXT_color_subtable')
+
+PFNGLCOLORSUBTABLEEXTPROC = CFUNCTYPE(None, GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8380
+PFNGLCOPYCOLORSUBTABLEEXTPROC = CFUNCTYPE(None, GLenum, GLsizei, GLint, GLint, GLsizei) # GL/glext.h:8381
+# PGI_vertex_hints (GL/glext.h:8384)
+GL_PGI_vertex_hints = 1 # GL/glext.h:8385
+# PGI_misc_hints (GL/glext.h:8388)
+GL_PGI_misc_hints = 1 # GL/glext.h:8389
+# GL/glext.h:8391
+glHintPGI = _link_function('glHintPGI', None, [GLenum, GLint], 'PGI_misc_hints')
+
+PFNGLHINTPGIPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:8393
+# EXT_paletted_texture (GL/glext.h:8396)
+GL_EXT_paletted_texture = 1 # GL/glext.h:8397
+# GL/glext.h:8399
+glColorTableEXT = _link_function('glColorTableEXT', None, [GLenum, GLenum, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_paletted_texture')
+
+# GL/glext.h:8400
+glGetColorTableEXT = _link_function('glGetColorTableEXT', None, [GLenum, GLenum, GLenum, POINTER(GLvoid)], 'EXT_paletted_texture')
+
+# GL/glext.h:8401
+glGetColorTableParameterivEXT = _link_function('glGetColorTableParameterivEXT', None, [GLenum, GLenum, POINTER(GLint)], 'EXT_paletted_texture')
+
+# GL/glext.h:8402
+glGetColorTableParameterfvEXT = _link_function('glGetColorTableParameterfvEXT', None, [GLenum, GLenum, POINTER(GLfloat)], 'EXT_paletted_texture')
+
+PFNGLCOLORTABLEEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8404
+PFNGLGETCOLORTABLEEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8405
+PFNGLGETCOLORTABLEPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8406
+PFNGLGETCOLORTABLEPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8407
+# EXT_clip_volume_hint (GL/glext.h:8410)
+GL_EXT_clip_volume_hint = 1 # GL/glext.h:8411
+# SGIX_list_priority (GL/glext.h:8414)
+GL_SGIX_list_priority = 1 # GL/glext.h:8415
+# GL/glext.h:8417
+glGetListParameterfvSGIX = _link_function('glGetListParameterfvSGIX', None, [GLuint, GLenum, POINTER(GLfloat)], 'SGIX_list_priority')
+
+# GL/glext.h:8418
+glGetListParameterivSGIX = _link_function('glGetListParameterivSGIX', None, [GLuint, GLenum, POINTER(GLint)], 'SGIX_list_priority')
+
+# GL/glext.h:8419
+glListParameterfSGIX = _link_function('glListParameterfSGIX', None, [GLuint, GLenum, GLfloat], 'SGIX_list_priority')
+
+# GL/glext.h:8420
+glListParameterfvSGIX = _link_function('glListParameterfvSGIX', None, [GLuint, GLenum, POINTER(GLfloat)], 'SGIX_list_priority')
+
+# GL/glext.h:8421
+glListParameteriSGIX = _link_function('glListParameteriSGIX', None, [GLuint, GLenum, GLint], 'SGIX_list_priority')
+
+# GL/glext.h:8422
+glListParameterivSGIX = _link_function('glListParameterivSGIX', None, [GLuint, GLenum, POINTER(GLint)], 'SGIX_list_priority')
+
+PFNGLGETLISTPARAMETERFVSGIXPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:8424
+PFNGLGETLISTPARAMETERIVSGIXPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:8425
+PFNGLLISTPARAMETERFSGIXPROC = CFUNCTYPE(None, GLuint, GLenum, GLfloat) # GL/glext.h:8426
+PFNGLLISTPARAMETERFVSGIXPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:8427
+PFNGLLISTPARAMETERISGIXPROC = CFUNCTYPE(None, GLuint, GLenum, GLint) # GL/glext.h:8428
+PFNGLLISTPARAMETERIVSGIXPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:8429
+# SGIX_ir_instrument1 (GL/glext.h:8432)
+GL_SGIX_ir_instrument1 = 1 # GL/glext.h:8433
+# SGIX_calligraphic_fragment (GL/glext.h:8436)
+GL_SGIX_calligraphic_fragment = 1 # GL/glext.h:8437
+# SGIX_texture_lod_bias (GL/glext.h:8440)
+GL_SGIX_texture_lod_bias = 1 # GL/glext.h:8441
+# SGIX_shadow_ambient (GL/glext.h:8444)
+GL_SGIX_shadow_ambient = 1 # GL/glext.h:8445
+# EXT_index_texture (GL/glext.h:8448)
+GL_EXT_index_texture = 1 # GL/glext.h:8449
+# EXT_index_material (GL/glext.h:8452)
+GL_EXT_index_material = 1 # GL/glext.h:8453
+# GL/glext.h:8455
+glIndexMaterialEXT = _link_function('glIndexMaterialEXT', None, [GLenum, GLenum], 'EXT_index_material')
+
+PFNGLINDEXMATERIALEXTPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:8457
+# EXT_index_func (GL/glext.h:8460)
+GL_EXT_index_func = 1 # GL/glext.h:8461
+# GL/glext.h:8463
+glIndexFuncEXT = _link_function('glIndexFuncEXT', None, [GLenum, GLclampf], 'EXT_index_func')
+
+PFNGLINDEXFUNCEXTPROC = CFUNCTYPE(None, GLenum, GLclampf) # GL/glext.h:8465
+# EXT_index_array_formats (GL/glext.h:8468)
+GL_EXT_index_array_formats = 1 # GL/glext.h:8469
+# EXT_compiled_vertex_array (GL/glext.h:8472)
+GL_EXT_compiled_vertex_array = 1 # GL/glext.h:8473
+# GL/glext.h:8475
+glLockArraysEXT = _link_function('glLockArraysEXT', None, [GLint, GLsizei], 'EXT_compiled_vertex_array')
+
+# GL/glext.h:8476
+glUnlockArraysEXT = _link_function('glUnlockArraysEXT', None, [], 'EXT_compiled_vertex_array')
+
+PFNGLLOCKARRAYSEXTPROC = CFUNCTYPE(None, GLint, GLsizei) # GL/glext.h:8478
+PFNGLUNLOCKARRAYSEXTPROC = CFUNCTYPE(None) # GL/glext.h:8479
+# EXT_cull_vertex (GL/glext.h:8482)
+GL_EXT_cull_vertex = 1 # GL/glext.h:8483
+# GL/glext.h:8485
+glCullParameterdvEXT = _link_function('glCullParameterdvEXT', None, [GLenum, POINTER(GLdouble)], 'EXT_cull_vertex')
+
+# GL/glext.h:8486
+glCullParameterfvEXT = _link_function('glCullParameterfvEXT', None, [GLenum, POINTER(GLfloat)], 'EXT_cull_vertex')
+
+PFNGLCULLPARAMETERDVEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:8488
+PFNGLCULLPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:8489
+# SGIX_ycrcb (GL/glext.h:8492)
+GL_SGIX_ycrcb = 1 # GL/glext.h:8493
+# SGIX_fragment_lighting (GL/glext.h:8496)
+GL_SGIX_fragment_lighting = 1 # GL/glext.h:8497
+# GL/glext.h:8499
+glFragmentColorMaterialSGIX = _link_function('glFragmentColorMaterialSGIX', None, [GLenum, GLenum], 'SGIX_fragment_lighting')
+
+# GL/glext.h:8500
+glFragmentLightfSGIX = _link_function('glFragmentLightfSGIX', None, [GLenum, GLenum, GLfloat], 'SGIX_fragment_lighting')
+
+# GL/glext.h:8501
+glFragmentLightfvSGIX = _link_function('glFragmentLightfvSGIX', None, [GLenum, GLenum, POINTER(GLfloat)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:8502
+glFragmentLightiSGIX = _link_function('glFragmentLightiSGIX', None, [GLenum, GLenum, GLint], 'SGIX_fragment_lighting')
+
+# GL/glext.h:8503
+glFragmentLightivSGIX = _link_function('glFragmentLightivSGIX', None, [GLenum, GLenum, POINTER(GLint)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:8504
+glFragmentLightModelfSGIX = _link_function('glFragmentLightModelfSGIX', None, [GLenum, GLfloat], 'SGIX_fragment_lighting')
+
+# GL/glext.h:8505
+glFragmentLightModelfvSGIX = _link_function('glFragmentLightModelfvSGIX', None, [GLenum, POINTER(GLfloat)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:8506
+glFragmentLightModeliSGIX = _link_function('glFragmentLightModeliSGIX', None, [GLenum, GLint], 'SGIX_fragment_lighting')
+
+# GL/glext.h:8507
+glFragmentLightModelivSGIX = _link_function('glFragmentLightModelivSGIX', None, [GLenum, POINTER(GLint)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:8508
+glFragmentMaterialfSGIX = _link_function('glFragmentMaterialfSGIX', None, [GLenum, GLenum, GLfloat], 'SGIX_fragment_lighting')
+
+# GL/glext.h:8509
+glFragmentMaterialfvSGIX = _link_function('glFragmentMaterialfvSGIX', None, [GLenum, GLenum, POINTER(GLfloat)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:8510
+glFragmentMaterialiSGIX = _link_function('glFragmentMaterialiSGIX', None, [GLenum, GLenum, GLint], 'SGIX_fragment_lighting')
+
+# GL/glext.h:8511
+glFragmentMaterialivSGIX = _link_function('glFragmentMaterialivSGIX', None, [GLenum, GLenum, POINTER(GLint)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:8512
+glGetFragmentLightfvSGIX = _link_function('glGetFragmentLightfvSGIX', None, [GLenum, GLenum, POINTER(GLfloat)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:8513
+glGetFragmentLightivSGIX = _link_function('glGetFragmentLightivSGIX', None, [GLenum, GLenum, POINTER(GLint)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:8514
+glGetFragmentMaterialfvSGIX = _link_function('glGetFragmentMaterialfvSGIX', None, [GLenum, GLenum, POINTER(GLfloat)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:8515
+glGetFragmentMaterialivSGIX = _link_function('glGetFragmentMaterialivSGIX', None, [GLenum, GLenum, POINTER(GLint)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:8516
+glLightEnviSGIX = _link_function('glLightEnviSGIX', None, [GLenum, GLint], 'SGIX_fragment_lighting')
+
+PFNGLFRAGMENTCOLORMATERIALSGIXPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:8518
+PFNGLFRAGMENTLIGHTFSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, GLfloat) # GL/glext.h:8519
+PFNGLFRAGMENTLIGHTFVSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8520
+PFNGLFRAGMENTLIGHTISGIXPROC = CFUNCTYPE(None, GLenum, GLenum, GLint) # GL/glext.h:8521
+PFNGLFRAGMENTLIGHTIVSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8522
+PFNGLFRAGMENTLIGHTMODELFSGIXPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:8523
+PFNGLFRAGMENTLIGHTMODELFVSGIXPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:8524
+PFNGLFRAGMENTLIGHTMODELISGIXPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:8525
+PFNGLFRAGMENTLIGHTMODELIVSGIXPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:8526
+PFNGLFRAGMENTMATERIALFSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, GLfloat) # GL/glext.h:8527
+PFNGLFRAGMENTMATERIALFVSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8528
+PFNGLFRAGMENTMATERIALISGIXPROC = CFUNCTYPE(None, GLenum, GLenum, GLint) # GL/glext.h:8529
+PFNGLFRAGMENTMATERIALIVSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8530
+PFNGLGETFRAGMENTLIGHTFVSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8531
+PFNGLGETFRAGMENTLIGHTIVSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8532
+PFNGLGETFRAGMENTMATERIALFVSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8533
+PFNGLGETFRAGMENTMATERIALIVSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8534
+PFNGLLIGHTENVISGIXPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:8535
+# IBM_rasterpos_clip (GL/glext.h:8538)
+GL_IBM_rasterpos_clip = 1 # GL/glext.h:8539
+# HP_texture_lighting (GL/glext.h:8542)
+GL_HP_texture_lighting = 1 # GL/glext.h:8543
+# EXT_draw_range_elements (GL/glext.h:8546)
+GL_EXT_draw_range_elements = 1 # GL/glext.h:8547
+# GL/glext.h:8549
+glDrawRangeElementsEXT = _link_function('glDrawRangeElementsEXT', None, [GLenum, GLuint, GLuint, GLsizei, GLenum, POINTER(GLvoid)], 'EXT_draw_range_elements')
+
+PFNGLDRAWRANGEELEMENTSEXTPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLsizei, GLenum, POINTER(GLvoid)) # GL/glext.h:8551
+# WIN_phong_shading (GL/glext.h:8554)
+GL_WIN_phong_shading = 1 # GL/glext.h:8555
+# WIN_specular_fog (GL/glext.h:8558)
+GL_WIN_specular_fog = 1 # GL/glext.h:8559
+# EXT_light_texture (GL/glext.h:8562)
+GL_EXT_light_texture = 1 # GL/glext.h:8563
+# GL/glext.h:8565
+glApplyTextureEXT = _link_function('glApplyTextureEXT', None, [GLenum], 'EXT_light_texture')
+
+# GL/glext.h:8566
+glTextureLightEXT = _link_function('glTextureLightEXT', None, [GLenum], 'EXT_light_texture')
+
+# GL/glext.h:8567
+glTextureMaterialEXT = _link_function('glTextureMaterialEXT', None, [GLenum, GLenum], 'EXT_light_texture')
+
+PFNGLAPPLYTEXTUREEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:8569
+PFNGLTEXTURELIGHTEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:8570
+PFNGLTEXTUREMATERIALEXTPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:8571
+# SGIX_blend_alpha_minmax (GL/glext.h:8574)
+GL_SGIX_blend_alpha_minmax = 1 # GL/glext.h:8575
+# EXT_bgra (GL/glext.h:8578)
+GL_EXT_bgra = 1 # GL/glext.h:8579
+# SGIX_async (GL/glext.h:8582)
+GL_SGIX_async = 1 # GL/glext.h:8583
+# GL/glext.h:8585
+glAsyncMarkerSGIX = _link_function('glAsyncMarkerSGIX', None, [GLuint], 'SGIX_async')
+
+# GL/glext.h:8586
+glFinishAsyncSGIX = _link_function('glFinishAsyncSGIX', GLint, [POINTER(GLuint)], 'SGIX_async')
+
+# GL/glext.h:8587
+glPollAsyncSGIX = _link_function('glPollAsyncSGIX', GLint, [POINTER(GLuint)], 'SGIX_async')
+
+# GL/glext.h:8588
+glGenAsyncMarkersSGIX = _link_function('glGenAsyncMarkersSGIX', GLuint, [GLsizei], 'SGIX_async')
+
+# GL/glext.h:8589
+glDeleteAsyncMarkersSGIX = _link_function('glDeleteAsyncMarkersSGIX', None, [GLuint, GLsizei], 'SGIX_async')
+
+# GL/glext.h:8590
+glIsAsyncMarkerSGIX = _link_function('glIsAsyncMarkerSGIX', GLboolean, [GLuint], 'SGIX_async')
+
+PFNGLASYNCMARKERSGIXPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:8592
+PFNGLFINISHASYNCSGIXPROC = CFUNCTYPE(GLint, POINTER(GLuint)) # GL/glext.h:8593
+PFNGLPOLLASYNCSGIXPROC = CFUNCTYPE(GLint, POINTER(GLuint)) # GL/glext.h:8594
+PFNGLGENASYNCMARKERSSGIXPROC = CFUNCTYPE(GLuint, GLsizei) # GL/glext.h:8595
+PFNGLDELETEASYNCMARKERSSGIXPROC = CFUNCTYPE(None, GLuint, GLsizei) # GL/glext.h:8596
+PFNGLISASYNCMARKERSGIXPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:8597
+# SGIX_async_pixel (GL/glext.h:8600)
+GL_SGIX_async_pixel = 1 # GL/glext.h:8601
+# SGIX_async_histogram (GL/glext.h:8604)
+GL_SGIX_async_histogram = 1 # GL/glext.h:8605
+# INTEL_parallel_arrays (GL/glext.h:8608)
+GL_INTEL_parallel_arrays = 1 # GL/glext.h:8609
+# GL/glext.h:8611
+glVertexPointervINTEL = _link_function('glVertexPointervINTEL', None, [GLint, GLenum, POINTER(POINTER(GLvoid))], 'INTEL_parallel_arrays')
+
+# GL/glext.h:8612
+glNormalPointervINTEL = _link_function('glNormalPointervINTEL', None, [GLenum, POINTER(POINTER(GLvoid))], 'INTEL_parallel_arrays')
+
+# GL/glext.h:8613
+glColorPointervINTEL = _link_function('glColorPointervINTEL', None, [GLint, GLenum, POINTER(POINTER(GLvoid))], 'INTEL_parallel_arrays')
+
+# GL/glext.h:8614
+glTexCoordPointervINTEL = _link_function('glTexCoordPointervINTEL', None, [GLint, GLenum, POINTER(POINTER(GLvoid))], 'INTEL_parallel_arrays')
+
+PFNGLVERTEXPOINTERVINTELPROC = CFUNCTYPE(None, GLint, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:8616
+PFNGLNORMALPOINTERVINTELPROC = CFUNCTYPE(None, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:8617
+PFNGLCOLORPOINTERVINTELPROC = CFUNCTYPE(None, GLint, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:8618
+PFNGLTEXCOORDPOINTERVINTELPROC = CFUNCTYPE(None, GLint, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:8619
+# HP_occlusion_test (GL/glext.h:8622)
+GL_HP_occlusion_test = 1 # GL/glext.h:8623
+# EXT_pixel_transform (GL/glext.h:8626)
+GL_EXT_pixel_transform = 1 # GL/glext.h:8627
+# GL/glext.h:8629
+glPixelTransformParameteriEXT = _link_function('glPixelTransformParameteriEXT', None, [GLenum, GLenum, GLint], 'EXT_pixel_transform')
+
+# GL/glext.h:8630
+glPixelTransformParameterfEXT = _link_function('glPixelTransformParameterfEXT', None, [GLenum, GLenum, GLfloat], 'EXT_pixel_transform')
+
+# GL/glext.h:8631
+glPixelTransformParameterivEXT = _link_function('glPixelTransformParameterivEXT', None, [GLenum, GLenum, POINTER(GLint)], 'EXT_pixel_transform')
+
+# GL/glext.h:8632
+glPixelTransformParameterfvEXT = _link_function('glPixelTransformParameterfvEXT', None, [GLenum, GLenum, POINTER(GLfloat)], 'EXT_pixel_transform')
+
+PFNGLPIXELTRANSFORMPARAMETERIEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint) # GL/glext.h:8634
+PFNGLPIXELTRANSFORMPARAMETERFEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLfloat) # GL/glext.h:8635
+PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8636
+PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8637
+# EXT_pixel_transform_color_table (GL/glext.h:8640)
+GL_EXT_pixel_transform_color_table = 1 # GL/glext.h:8641
+# EXT_shared_texture_palette (GL/glext.h:8644)
+GL_EXT_shared_texture_palette = 1 # GL/glext.h:8645
+# EXT_separate_specular_color (GL/glext.h:8648)
+GL_EXT_separate_specular_color = 1 # GL/glext.h:8649
+# EXT_secondary_color (GL/glext.h:8652)
+GL_EXT_secondary_color = 1 # GL/glext.h:8653
+# GL/glext.h:8655
+glSecondaryColor3bEXT = _link_function('glSecondaryColor3bEXT', None, [GLbyte, GLbyte, GLbyte], 'EXT_secondary_color')
+
+# GL/glext.h:8656
+glSecondaryColor3bvEXT = _link_function('glSecondaryColor3bvEXT', None, [POINTER(GLbyte)], 'EXT_secondary_color')
+
+# GL/glext.h:8657
+glSecondaryColor3dEXT = _link_function('glSecondaryColor3dEXT', None, [GLdouble, GLdouble, GLdouble], 'EXT_secondary_color')
+
+# GL/glext.h:8658
+glSecondaryColor3dvEXT = _link_function('glSecondaryColor3dvEXT', None, [POINTER(GLdouble)], 'EXT_secondary_color')
+
+# GL/glext.h:8659
+glSecondaryColor3fEXT = _link_function('glSecondaryColor3fEXT', None, [GLfloat, GLfloat, GLfloat], 'EXT_secondary_color')
+
+# GL/glext.h:8660
+glSecondaryColor3fvEXT = _link_function('glSecondaryColor3fvEXT', None, [POINTER(GLfloat)], 'EXT_secondary_color')
+
+# GL/glext.h:8661
+glSecondaryColor3iEXT = _link_function('glSecondaryColor3iEXT', None, [GLint, GLint, GLint], 'EXT_secondary_color')
+
+# GL/glext.h:8662
+glSecondaryColor3ivEXT = _link_function('glSecondaryColor3ivEXT', None, [POINTER(GLint)], 'EXT_secondary_color')
+
+# GL/glext.h:8663
+glSecondaryColor3sEXT = _link_function('glSecondaryColor3sEXT', None, [GLshort, GLshort, GLshort], 'EXT_secondary_color')
+
+# GL/glext.h:8664
+glSecondaryColor3svEXT = _link_function('glSecondaryColor3svEXT', None, [POINTER(GLshort)], 'EXT_secondary_color')
+
+# GL/glext.h:8665
+glSecondaryColor3ubEXT = _link_function('glSecondaryColor3ubEXT', None, [GLubyte, GLubyte, GLubyte], 'EXT_secondary_color')
+
+# GL/glext.h:8666
+glSecondaryColor3ubvEXT = _link_function('glSecondaryColor3ubvEXT', None, [POINTER(GLubyte)], 'EXT_secondary_color')
+
+# GL/glext.h:8667
+glSecondaryColor3uiEXT = _link_function('glSecondaryColor3uiEXT', None, [GLuint, GLuint, GLuint], 'EXT_secondary_color')
+
+# GL/glext.h:8668
+glSecondaryColor3uivEXT = _link_function('glSecondaryColor3uivEXT', None, [POINTER(GLuint)], 'EXT_secondary_color')
+
+# GL/glext.h:8669
+glSecondaryColor3usEXT = _link_function('glSecondaryColor3usEXT', None, [GLushort, GLushort, GLushort], 'EXT_secondary_color')
+
+# GL/glext.h:8670
+glSecondaryColor3usvEXT = _link_function('glSecondaryColor3usvEXT', None, [POINTER(GLushort)], 'EXT_secondary_color')
+
+# GL/glext.h:8671
+glSecondaryColorPointerEXT = _link_function('glSecondaryColorPointerEXT', None, [GLint, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_secondary_color')
+
+PFNGLSECONDARYCOLOR3BEXTPROC = CFUNCTYPE(None, GLbyte, GLbyte, GLbyte) # GL/glext.h:8673
+PFNGLSECONDARYCOLOR3BVEXTPROC = CFUNCTYPE(None, POINTER(GLbyte)) # GL/glext.h:8674
+PFNGLSECONDARYCOLOR3DEXTPROC = CFUNCTYPE(None, GLdouble, GLdouble, GLdouble) # GL/glext.h:8675
+PFNGLSECONDARYCOLOR3DVEXTPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:8676
+PFNGLSECONDARYCOLOR3FEXTPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat) # GL/glext.h:8677
+PFNGLSECONDARYCOLOR3FVEXTPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:8678
+PFNGLSECONDARYCOLOR3IEXTPROC = CFUNCTYPE(None, GLint, GLint, GLint) # GL/glext.h:8679
+PFNGLSECONDARYCOLOR3IVEXTPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:8680
+PFNGLSECONDARYCOLOR3SEXTPROC = CFUNCTYPE(None, GLshort, GLshort, GLshort) # GL/glext.h:8681
+PFNGLSECONDARYCOLOR3SVEXTPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:8682
+PFNGLSECONDARYCOLOR3UBEXTPROC = CFUNCTYPE(None, GLubyte, GLubyte, GLubyte) # GL/glext.h:8683
+PFNGLSECONDARYCOLOR3UBVEXTPROC = CFUNCTYPE(None, POINTER(GLubyte)) # GL/glext.h:8684
+PFNGLSECONDARYCOLOR3UIEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint) # GL/glext.h:8685
+PFNGLSECONDARYCOLOR3UIVEXTPROC = CFUNCTYPE(None, POINTER(GLuint)) # GL/glext.h:8686
+PFNGLSECONDARYCOLOR3USEXTPROC = CFUNCTYPE(None, GLushort, GLushort, GLushort) # GL/glext.h:8687
+PFNGLSECONDARYCOLOR3USVEXTPROC = CFUNCTYPE(None, POINTER(GLushort)) # GL/glext.h:8688
+PFNGLSECONDARYCOLORPOINTEREXTPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:8689
+# EXT_texture_perturb_normal (GL/glext.h:8692)
+GL_EXT_texture_perturb_normal = 1 # GL/glext.h:8693
+# GL/glext.h:8695
+glTextureNormalEXT = _link_function('glTextureNormalEXT', None, [GLenum], 'EXT_texture_perturb_normal')
+
+PFNGLTEXTURENORMALEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:8697
+# EXT_multi_draw_arrays (GL/glext.h:8700)
+GL_EXT_multi_draw_arrays = 1 # GL/glext.h:8701
+# GL/glext.h:8703
+glMultiDrawArraysEXT = _link_function('glMultiDrawArraysEXT', None, [GLenum, POINTER(GLint), POINTER(GLsizei), GLsizei], 'EXT_multi_draw_arrays')
+
+# GL/glext.h:8704
+glMultiDrawElementsEXT = _link_function('glMultiDrawElementsEXT', None, [GLenum, POINTER(GLsizei), GLenum, POINTER(POINTER(GLvoid)), GLsizei], 'EXT_multi_draw_arrays')
+
+PFNGLMULTIDRAWARRAYSEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLint), POINTER(GLsizei), GLsizei) # GL/glext.h:8706
+PFNGLMULTIDRAWELEMENTSEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLsizei), GLenum, POINTER(POINTER(GLvoid)), GLsizei) # GL/glext.h:8707
+# EXT_fog_coord (GL/glext.h:8710)
+GL_EXT_fog_coord = 1 # GL/glext.h:8711
+# GL/glext.h:8713
+glFogCoordfEXT = _link_function('glFogCoordfEXT', None, [GLfloat], 'EXT_fog_coord')
+
+# GL/glext.h:8714
+glFogCoordfvEXT = _link_function('glFogCoordfvEXT', None, [POINTER(GLfloat)], 'EXT_fog_coord')
+
+# GL/glext.h:8715
+glFogCoorddEXT = _link_function('glFogCoorddEXT', None, [GLdouble], 'EXT_fog_coord')
+
+# GL/glext.h:8716
+glFogCoorddvEXT = _link_function('glFogCoorddvEXT', None, [POINTER(GLdouble)], 'EXT_fog_coord')
+
+# GL/glext.h:8717
+glFogCoordPointerEXT = _link_function('glFogCoordPointerEXT', None, [GLenum, GLsizei, POINTER(GLvoid)], 'EXT_fog_coord')
+
+PFNGLFOGCOORDFEXTPROC = CFUNCTYPE(None, GLfloat) # GL/glext.h:8719
+PFNGLFOGCOORDFVEXTPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:8720
+PFNGLFOGCOORDDEXTPROC = CFUNCTYPE(None, GLdouble) # GL/glext.h:8721
+PFNGLFOGCOORDDVEXTPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:8722
+PFNGLFOGCOORDPOINTEREXTPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:8723
+# REND_screen_coordinates (GL/glext.h:8726)
+GL_REND_screen_coordinates = 1 # GL/glext.h:8727
+# EXT_coordinate_frame (GL/glext.h:8730)
+GL_EXT_coordinate_frame = 1 # GL/glext.h:8731
+# GL/glext.h:8733
+glTangent3bEXT = _link_function('glTangent3bEXT', None, [GLbyte, GLbyte, GLbyte], 'EXT_coordinate_frame')
+
+# GL/glext.h:8734
+glTangent3bvEXT = _link_function('glTangent3bvEXT', None, [POINTER(GLbyte)], 'EXT_coordinate_frame')
+
+# GL/glext.h:8735
+glTangent3dEXT = _link_function('glTangent3dEXT', None, [GLdouble, GLdouble, GLdouble], 'EXT_coordinate_frame')
+
+# GL/glext.h:8736
+glTangent3dvEXT = _link_function('glTangent3dvEXT', None, [POINTER(GLdouble)], 'EXT_coordinate_frame')
+
+# GL/glext.h:8737
+glTangent3fEXT = _link_function('glTangent3fEXT', None, [GLfloat, GLfloat, GLfloat], 'EXT_coordinate_frame')
+
+# GL/glext.h:8738
+glTangent3fvEXT = _link_function('glTangent3fvEXT', None, [POINTER(GLfloat)], 'EXT_coordinate_frame')
+
+# GL/glext.h:8739
+glTangent3iEXT = _link_function('glTangent3iEXT', None, [GLint, GLint, GLint], 'EXT_coordinate_frame')
+
+# GL/glext.h:8740
+glTangent3ivEXT = _link_function('glTangent3ivEXT', None, [POINTER(GLint)], 'EXT_coordinate_frame')
+
+# GL/glext.h:8741
+glTangent3sEXT = _link_function('glTangent3sEXT', None, [GLshort, GLshort, GLshort], 'EXT_coordinate_frame')
+
+# GL/glext.h:8742
+glTangent3svEXT = _link_function('glTangent3svEXT', None, [POINTER(GLshort)], 'EXT_coordinate_frame')
+
+# GL/glext.h:8743
+glBinormal3bEXT = _link_function('glBinormal3bEXT', None, [GLbyte, GLbyte, GLbyte], 'EXT_coordinate_frame')
+
+# GL/glext.h:8744
+glBinormal3bvEXT = _link_function('glBinormal3bvEXT', None, [POINTER(GLbyte)], 'EXT_coordinate_frame')
+
+# GL/glext.h:8745
+glBinormal3dEXT = _link_function('glBinormal3dEXT', None, [GLdouble, GLdouble, GLdouble], 'EXT_coordinate_frame')
+
+# GL/glext.h:8746
+glBinormal3dvEXT = _link_function('glBinormal3dvEXT', None, [POINTER(GLdouble)], 'EXT_coordinate_frame')
+
+# GL/glext.h:8747
+glBinormal3fEXT = _link_function('glBinormal3fEXT', None, [GLfloat, GLfloat, GLfloat], 'EXT_coordinate_frame')
+
+# GL/glext.h:8748
+glBinormal3fvEXT = _link_function('glBinormal3fvEXT', None, [POINTER(GLfloat)], 'EXT_coordinate_frame')
+
+# GL/glext.h:8749
+glBinormal3iEXT = _link_function('glBinormal3iEXT', None, [GLint, GLint, GLint], 'EXT_coordinate_frame')
+
+# GL/glext.h:8750
+glBinormal3ivEXT = _link_function('glBinormal3ivEXT', None, [POINTER(GLint)], 'EXT_coordinate_frame')
+
+# GL/glext.h:8751
+glBinormal3sEXT = _link_function('glBinormal3sEXT', None, [GLshort, GLshort, GLshort], 'EXT_coordinate_frame')
+
+# GL/glext.h:8752
+glBinormal3svEXT = _link_function('glBinormal3svEXT', None, [POINTER(GLshort)], 'EXT_coordinate_frame')
+
+# GL/glext.h:8753
+glTangentPointerEXT = _link_function('glTangentPointerEXT', None, [GLenum, GLsizei, POINTER(GLvoid)], 'EXT_coordinate_frame')
+
+# GL/glext.h:8754
+glBinormalPointerEXT = _link_function('glBinormalPointerEXT', None, [GLenum, GLsizei, POINTER(GLvoid)], 'EXT_coordinate_frame')
+
+PFNGLTANGENT3BEXTPROC = CFUNCTYPE(None, GLbyte, GLbyte, GLbyte) # GL/glext.h:8756
+PFNGLTANGENT3BVEXTPROC = CFUNCTYPE(None, POINTER(GLbyte)) # GL/glext.h:8757
+PFNGLTANGENT3DEXTPROC = CFUNCTYPE(None, GLdouble, GLdouble, GLdouble) # GL/glext.h:8758
+PFNGLTANGENT3DVEXTPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:8759
+PFNGLTANGENT3FEXTPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat) # GL/glext.h:8760
+PFNGLTANGENT3FVEXTPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:8761
+PFNGLTANGENT3IEXTPROC = CFUNCTYPE(None, GLint, GLint, GLint) # GL/glext.h:8762
+PFNGLTANGENT3IVEXTPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:8763
+PFNGLTANGENT3SEXTPROC = CFUNCTYPE(None, GLshort, GLshort, GLshort) # GL/glext.h:8764
+PFNGLTANGENT3SVEXTPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:8765
+PFNGLBINORMAL3BEXTPROC = CFUNCTYPE(None, GLbyte, GLbyte, GLbyte) # GL/glext.h:8766
+PFNGLBINORMAL3BVEXTPROC = CFUNCTYPE(None, POINTER(GLbyte)) # GL/glext.h:8767
+PFNGLBINORMAL3DEXTPROC = CFUNCTYPE(None, GLdouble, GLdouble, GLdouble) # GL/glext.h:8768
+PFNGLBINORMAL3DVEXTPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:8769
+PFNGLBINORMAL3FEXTPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat) # GL/glext.h:8770
+PFNGLBINORMAL3FVEXTPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:8771
+PFNGLBINORMAL3IEXTPROC = CFUNCTYPE(None, GLint, GLint, GLint) # GL/glext.h:8772
+PFNGLBINORMAL3IVEXTPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:8773
+PFNGLBINORMAL3SEXTPROC = CFUNCTYPE(None, GLshort, GLshort, GLshort) # GL/glext.h:8774
+PFNGLBINORMAL3SVEXTPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:8775
+PFNGLTANGENTPOINTEREXTPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:8776
+PFNGLBINORMALPOINTEREXTPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:8777
+# EXT_texture_env_combine (GL/glext.h:8780)
+GL_EXT_texture_env_combine = 1 # GL/glext.h:8781
+# APPLE_specular_vector (GL/glext.h:8784)
+GL_APPLE_specular_vector = 1 # GL/glext.h:8785
+# APPLE_transform_hint (GL/glext.h:8788)
+GL_APPLE_transform_hint = 1 # GL/glext.h:8789
+# SGIX_fog_scale (GL/glext.h:8792)
+GL_SGIX_fog_scale = 1 # GL/glext.h:8793
+# SUNX_constant_data (GL/glext.h:8796)
+GL_SUNX_constant_data = 1 # GL/glext.h:8797
+# GL/glext.h:8799
+glFinishTextureSUNX = _link_function('glFinishTextureSUNX', None, [], 'SUNX_constant_data')
+
+PFNGLFINISHTEXTURESUNXPROC = CFUNCTYPE(None) # GL/glext.h:8801
+# SUN_global_alpha (GL/glext.h:8804)
+GL_SUN_global_alpha = 1 # GL/glext.h:8805
+# GL/glext.h:8807
+glGlobalAlphaFactorbSUN = _link_function('glGlobalAlphaFactorbSUN', None, [GLbyte], 'SUN_global_alpha')
+
+# GL/glext.h:8808
+glGlobalAlphaFactorsSUN = _link_function('glGlobalAlphaFactorsSUN', None, [GLshort], 'SUN_global_alpha')
+
+# GL/glext.h:8809
+glGlobalAlphaFactoriSUN = _link_function('glGlobalAlphaFactoriSUN', None, [GLint], 'SUN_global_alpha')
+
+# GL/glext.h:8810
+glGlobalAlphaFactorfSUN = _link_function('glGlobalAlphaFactorfSUN', None, [GLfloat], 'SUN_global_alpha')
+
+# GL/glext.h:8811
+glGlobalAlphaFactordSUN = _link_function('glGlobalAlphaFactordSUN', None, [GLdouble], 'SUN_global_alpha')
+
+# GL/glext.h:8812
+glGlobalAlphaFactorubSUN = _link_function('glGlobalAlphaFactorubSUN', None, [GLubyte], 'SUN_global_alpha')
+
+# GL/glext.h:8813
+glGlobalAlphaFactorusSUN = _link_function('glGlobalAlphaFactorusSUN', None, [GLushort], 'SUN_global_alpha')
+
+# GL/glext.h:8814
+glGlobalAlphaFactoruiSUN = _link_function('glGlobalAlphaFactoruiSUN', None, [GLuint], 'SUN_global_alpha')
+
+PFNGLGLOBALALPHAFACTORBSUNPROC = CFUNCTYPE(None, GLbyte) # GL/glext.h:8816
+PFNGLGLOBALALPHAFACTORSSUNPROC = CFUNCTYPE(None, GLshort) # GL/glext.h:8817
+PFNGLGLOBALALPHAFACTORISUNPROC = CFUNCTYPE(None, GLint) # GL/glext.h:8818
+PFNGLGLOBALALPHAFACTORFSUNPROC = CFUNCTYPE(None, GLfloat) # GL/glext.h:8819
+PFNGLGLOBALALPHAFACTORDSUNPROC = CFUNCTYPE(None, GLdouble) # GL/glext.h:8820
+PFNGLGLOBALALPHAFACTORUBSUNPROC = CFUNCTYPE(None, GLubyte) # GL/glext.h:8821
+PFNGLGLOBALALPHAFACTORUSSUNPROC = CFUNCTYPE(None, GLushort) # GL/glext.h:8822
+PFNGLGLOBALALPHAFACTORUISUNPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:8823
+# SUN_triangle_list (GL/glext.h:8826)
+GL_SUN_triangle_list = 1 # GL/glext.h:8827
+# GL/glext.h:8829
+glReplacementCodeuiSUN = _link_function('glReplacementCodeuiSUN', None, [GLuint], 'SUN_triangle_list')
+
+# GL/glext.h:8830
+glReplacementCodeusSUN = _link_function('glReplacementCodeusSUN', None, [GLushort], 'SUN_triangle_list')
+
+# GL/glext.h:8831
+glReplacementCodeubSUN = _link_function('glReplacementCodeubSUN', None, [GLubyte], 'SUN_triangle_list')
+
+# GL/glext.h:8832
+glReplacementCodeuivSUN = _link_function('glReplacementCodeuivSUN', None, [POINTER(GLuint)], 'SUN_triangle_list')
+
+# GL/glext.h:8833
+glReplacementCodeusvSUN = _link_function('glReplacementCodeusvSUN', None, [POINTER(GLushort)], 'SUN_triangle_list')
+
+# GL/glext.h:8834
+glReplacementCodeubvSUN = _link_function('glReplacementCodeubvSUN', None, [POINTER(GLubyte)], 'SUN_triangle_list')
+
+# GL/glext.h:8835
+glReplacementCodePointerSUN = _link_function('glReplacementCodePointerSUN', None, [GLenum, GLsizei, POINTER(POINTER(GLvoid))], 'SUN_triangle_list')
+
+PFNGLREPLACEMENTCODEUISUNPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:8837
+PFNGLREPLACEMENTCODEUSSUNPROC = CFUNCTYPE(None, GLushort) # GL/glext.h:8838
+PFNGLREPLACEMENTCODEUBSUNPROC = CFUNCTYPE(None, GLubyte) # GL/glext.h:8839
+PFNGLREPLACEMENTCODEUIVSUNPROC = CFUNCTYPE(None, POINTER(GLuint)) # GL/glext.h:8840
+PFNGLREPLACEMENTCODEUSVSUNPROC = CFUNCTYPE(None, POINTER(GLushort)) # GL/glext.h:8841
+PFNGLREPLACEMENTCODEUBVSUNPROC = CFUNCTYPE(None, POINTER(GLubyte)) # GL/glext.h:8842
+PFNGLREPLACEMENTCODEPOINTERSUNPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(POINTER(GLvoid))) # GL/glext.h:8843
+# SUN_vertex (GL/glext.h:8846)
+GL_SUN_vertex = 1 # GL/glext.h:8847
+# GL/glext.h:8849
+glColor4ubVertex2fSUN = _link_function('glColor4ubVertex2fSUN', None, [GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8850
+glColor4ubVertex2fvSUN = _link_function('glColor4ubVertex2fvSUN', None, [POINTER(GLubyte), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:8851
+glColor4ubVertex3fSUN = _link_function('glColor4ubVertex3fSUN', None, [GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8852
+glColor4ubVertex3fvSUN = _link_function('glColor4ubVertex3fvSUN', None, [POINTER(GLubyte), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:8853
+glColor3fVertex3fSUN = _link_function('glColor3fVertex3fSUN', None, [GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8854
+glColor3fVertex3fvSUN = _link_function('glColor3fVertex3fvSUN', None, [POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:8855
+glNormal3fVertex3fSUN = _link_function('glNormal3fVertex3fSUN', None, [GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8856
+glNormal3fVertex3fvSUN = _link_function('glNormal3fVertex3fvSUN', None, [POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:8857
+glColor4fNormal3fVertex3fSUN = _link_function('glColor4fNormal3fVertex3fSUN', None, [GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8858
+glColor4fNormal3fVertex3fvSUN = _link_function('glColor4fNormal3fVertex3fvSUN', None, [POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:8859
+glTexCoord2fVertex3fSUN = _link_function('glTexCoord2fVertex3fSUN', None, [GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8860
+glTexCoord2fVertex3fvSUN = _link_function('glTexCoord2fVertex3fvSUN', None, [POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:8861
+glTexCoord4fVertex4fSUN = _link_function('glTexCoord4fVertex4fSUN', None, [GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8862
+glTexCoord4fVertex4fvSUN = _link_function('glTexCoord4fVertex4fvSUN', None, [POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:8863
+glTexCoord2fColor4ubVertex3fSUN = _link_function('glTexCoord2fColor4ubVertex3fSUN', None, [GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8864
+glTexCoord2fColor4ubVertex3fvSUN = _link_function('glTexCoord2fColor4ubVertex3fvSUN', None, [POINTER(GLfloat), POINTER(GLubyte), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:8865
+glTexCoord2fColor3fVertex3fSUN = _link_function('glTexCoord2fColor3fVertex3fSUN', None, [GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8866
+glTexCoord2fColor3fVertex3fvSUN = _link_function('glTexCoord2fColor3fVertex3fvSUN', None, [POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:8867
+glTexCoord2fNormal3fVertex3fSUN = _link_function('glTexCoord2fNormal3fVertex3fSUN', None, [GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8868
+glTexCoord2fNormal3fVertex3fvSUN = _link_function('glTexCoord2fNormal3fVertex3fvSUN', None, [POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:8869
+glTexCoord2fColor4fNormal3fVertex3fSUN = _link_function('glTexCoord2fColor4fNormal3fVertex3fSUN', None, [GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8870
+glTexCoord2fColor4fNormal3fVertex3fvSUN = _link_function('glTexCoord2fColor4fNormal3fVertex3fvSUN', None, [POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:8871
+glTexCoord4fColor4fNormal3fVertex4fSUN = _link_function('glTexCoord4fColor4fNormal3fVertex4fSUN', None, [GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8872
+glTexCoord4fColor4fNormal3fVertex4fvSUN = _link_function('glTexCoord4fColor4fNormal3fVertex4fvSUN', None, [POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:8873
+glReplacementCodeuiVertex3fSUN = _link_function('glReplacementCodeuiVertex3fSUN', None, [GLuint, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8874
+glReplacementCodeuiVertex3fvSUN = _link_function('glReplacementCodeuiVertex3fvSUN', None, [POINTER(GLuint), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:8875
+glReplacementCodeuiColor4ubVertex3fSUN = _link_function('glReplacementCodeuiColor4ubVertex3fSUN', None, [GLuint, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8876
+glReplacementCodeuiColor4ubVertex3fvSUN = _link_function('glReplacementCodeuiColor4ubVertex3fvSUN', None, [POINTER(GLuint), POINTER(GLubyte), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:8877
+glReplacementCodeuiColor3fVertex3fSUN = _link_function('glReplacementCodeuiColor3fVertex3fSUN', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8878
+glReplacementCodeuiColor3fVertex3fvSUN = _link_function('glReplacementCodeuiColor3fVertex3fvSUN', None, [POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:8879
+glReplacementCodeuiNormal3fVertex3fSUN = _link_function('glReplacementCodeuiNormal3fVertex3fSUN', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8880
+glReplacementCodeuiNormal3fVertex3fvSUN = _link_function('glReplacementCodeuiNormal3fVertex3fvSUN', None, [POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:8881
+glReplacementCodeuiColor4fNormal3fVertex3fSUN = _link_function('glReplacementCodeuiColor4fNormal3fVertex3fSUN', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8882
+glReplacementCodeuiColor4fNormal3fVertex3fvSUN = _link_function('glReplacementCodeuiColor4fNormal3fVertex3fvSUN', None, [POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:8883
+glReplacementCodeuiTexCoord2fVertex3fSUN = _link_function('glReplacementCodeuiTexCoord2fVertex3fSUN', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8884
+glReplacementCodeuiTexCoord2fVertex3fvSUN = _link_function('glReplacementCodeuiTexCoord2fVertex3fvSUN', None, [POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:8885
+glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN = _link_function('glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8886
+glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN = _link_function('glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN', None, [POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:8887
+glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN = _link_function('glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:8888
+glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN = _link_function('glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN', None, [POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+PFNGLCOLOR4UBVERTEX2FSUNPROC = CFUNCTYPE(None, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat) # GL/glext.h:8890
+PFNGLCOLOR4UBVERTEX2FVSUNPROC = CFUNCTYPE(None, POINTER(GLubyte), POINTER(GLfloat)) # GL/glext.h:8891
+PFNGLCOLOR4UBVERTEX3FSUNPROC = CFUNCTYPE(None, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat) # GL/glext.h:8892
+PFNGLCOLOR4UBVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLubyte), POINTER(GLfloat)) # GL/glext.h:8893
+PFNGLCOLOR3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:8894
+PFNGLCOLOR3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:8895
+PFNGLNORMAL3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:8896
+PFNGLNORMAL3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:8897
+PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:8898
+PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:8899
+PFNGLTEXCOORD2FVERTEX3FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:8900
+PFNGLTEXCOORD2FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:8901
+PFNGLTEXCOORD4FVERTEX4FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:8902
+PFNGLTEXCOORD4FVERTEX4FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:8903
+PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat) # GL/glext.h:8904
+PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLubyte), POINTER(GLfloat)) # GL/glext.h:8905
+PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:8906
+PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:8907
+PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:8908
+PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:8909
+PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:8910
+PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:8911
+PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:8912
+PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:8913
+PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat) # GL/glext.h:8914
+PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLuint), POINTER(GLfloat)) # GL/glext.h:8915
+PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC = CFUNCTYPE(None, GLuint, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat) # GL/glext.h:8916
+PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLuint), POINTER(GLubyte), POINTER(GLfloat)) # GL/glext.h:8917
+PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:8918
+PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:8919
+PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:8920
+PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:8921
+PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:8922
+PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:8923
+PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:8924
+PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:8925
+PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:8926
+PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:8927
+PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:8928
+PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:8929
+# EXT_blend_func_separate (GL/glext.h:8932)
+GL_EXT_blend_func_separate = 1 # GL/glext.h:8933
+# GL/glext.h:8935
+glBlendFuncSeparateEXT = _link_function('glBlendFuncSeparateEXT', None, [GLenum, GLenum, GLenum, GLenum], 'EXT_blend_func_separate')
+
+PFNGLBLENDFUNCSEPARATEEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:8937
+# INGR_blend_func_separate (GL/glext.h:8940)
+GL_INGR_blend_func_separate = 1 # GL/glext.h:8941
+# GL/glext.h:8943
+glBlendFuncSeparateINGR = _link_function('glBlendFuncSeparateINGR', None, [GLenum, GLenum, GLenum, GLenum], 'INGR_blend_func_separate')
+
+PFNGLBLENDFUNCSEPARATEINGRPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:8945
+# INGR_color_clamp (GL/glext.h:8948)
+GL_INGR_color_clamp = 1 # GL/glext.h:8949
+# INGR_interlace_read (GL/glext.h:8952)
+GL_INGR_interlace_read = 1 # GL/glext.h:8953
+# EXT_stencil_wrap (GL/glext.h:8956)
+GL_EXT_stencil_wrap = 1 # GL/glext.h:8957
+# EXT_422_pixels (GL/glext.h:8960)
+GL_EXT_422_pixels = 1 # GL/glext.h:8961
+# NV_texgen_reflection (GL/glext.h:8964)
+GL_NV_texgen_reflection = 1 # GL/glext.h:8965
+# SUN_convolution_border_modes (GL/glext.h:8968)
+GL_SUN_convolution_border_modes = 1 # GL/glext.h:8969
+# EXT_texture_env_add (GL/glext.h:8972)
+GL_EXT_texture_env_add = 1 # GL/glext.h:8973
+# EXT_texture_lod_bias (GL/glext.h:8976)
+GL_EXT_texture_lod_bias = 1 # GL/glext.h:8977
+# EXT_texture_filter_anisotropic (GL/glext.h:8980)
+GL_EXT_texture_filter_anisotropic = 1 # GL/glext.h:8981
+# EXT_vertex_weighting (GL/glext.h:8984)
+GL_EXT_vertex_weighting = 1 # GL/glext.h:8985
+# GL/glext.h:8987
+glVertexWeightfEXT = _link_function('glVertexWeightfEXT', None, [GLfloat], 'EXT_vertex_weighting')
+
+# GL/glext.h:8988
+glVertexWeightfvEXT = _link_function('glVertexWeightfvEXT', None, [POINTER(GLfloat)], 'EXT_vertex_weighting')
+
+# GL/glext.h:8989
+glVertexWeightPointerEXT = _link_function('glVertexWeightPointerEXT', None, [GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_vertex_weighting')
+
+PFNGLVERTEXWEIGHTFEXTPROC = CFUNCTYPE(None, GLfloat) # GL/glext.h:8991
+PFNGLVERTEXWEIGHTFVEXTPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:8992
+PFNGLVERTEXWEIGHTPOINTEREXTPROC = CFUNCTYPE(None, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:8993
+# NV_light_max_exponent (GL/glext.h:8996)
+GL_NV_light_max_exponent = 1 # GL/glext.h:8997
+# NV_vertex_array_range (GL/glext.h:9000)
+GL_NV_vertex_array_range = 1 # GL/glext.h:9001
+# GL/glext.h:9003
+glFlushVertexArrayRangeNV = _link_function('glFlushVertexArrayRangeNV', None, [], 'NV_vertex_array_range')
+
+# GL/glext.h:9004
+glVertexArrayRangeNV = _link_function('glVertexArrayRangeNV', None, [GLsizei, POINTER(GLvoid)], 'NV_vertex_array_range')
+
+PFNGLFLUSHVERTEXARRAYRANGENVPROC = CFUNCTYPE(None) # GL/glext.h:9006
+PFNGLVERTEXARRAYRANGENVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLvoid)) # GL/glext.h:9007
+# NV_register_combiners (GL/glext.h:9010)
+GL_NV_register_combiners = 1 # GL/glext.h:9011
+# GL/glext.h:9013
+glCombinerParameterfvNV = _link_function('glCombinerParameterfvNV', None, [GLenum, POINTER(GLfloat)], 'NV_register_combiners')
+
+# GL/glext.h:9014
+glCombinerParameterfNV = _link_function('glCombinerParameterfNV', None, [GLenum, GLfloat], 'NV_register_combiners')
+
+# GL/glext.h:9015
+glCombinerParameterivNV = _link_function('glCombinerParameterivNV', None, [GLenum, POINTER(GLint)], 'NV_register_combiners')
+
+# GL/glext.h:9016
+glCombinerParameteriNV = _link_function('glCombinerParameteriNV', None, [GLenum, GLint], 'NV_register_combiners')
+
+# GL/glext.h:9017
+glCombinerInputNV = _link_function('glCombinerInputNV', None, [GLenum, GLenum, GLenum, GLenum, GLenum, GLenum], 'NV_register_combiners')
+
+# GL/glext.h:9018
+glCombinerOutputNV = _link_function('glCombinerOutputNV', None, [GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean], 'NV_register_combiners')
+
+# GL/glext.h:9019
+glFinalCombinerInputNV = _link_function('glFinalCombinerInputNV', None, [GLenum, GLenum, GLenum, GLenum], 'NV_register_combiners')
+
+# GL/glext.h:9020
+glGetCombinerInputParameterfvNV = _link_function('glGetCombinerInputParameterfvNV', None, [GLenum, GLenum, GLenum, GLenum, POINTER(GLfloat)], 'NV_register_combiners')
+
+# GL/glext.h:9021
+glGetCombinerInputParameterivNV = _link_function('glGetCombinerInputParameterivNV', None, [GLenum, GLenum, GLenum, GLenum, POINTER(GLint)], 'NV_register_combiners')
+
+# GL/glext.h:9022
+glGetCombinerOutputParameterfvNV = _link_function('glGetCombinerOutputParameterfvNV', None, [GLenum, GLenum, GLenum, POINTER(GLfloat)], 'NV_register_combiners')
+
+# GL/glext.h:9023
+glGetCombinerOutputParameterivNV = _link_function('glGetCombinerOutputParameterivNV', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'NV_register_combiners')
+
+# GL/glext.h:9024
+glGetFinalCombinerInputParameterfvNV = _link_function('glGetFinalCombinerInputParameterfvNV', None, [GLenum, GLenum, POINTER(GLfloat)], 'NV_register_combiners')
+
+# GL/glext.h:9025
+glGetFinalCombinerInputParameterivNV = _link_function('glGetFinalCombinerInputParameterivNV', None, [GLenum, GLenum, POINTER(GLint)], 'NV_register_combiners')
+
+PFNGLCOMBINERPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:9027
+PFNGLCOMBINERPARAMETERFNVPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:9028
+PFNGLCOMBINERPARAMETERIVNVPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:9029
+PFNGLCOMBINERPARAMETERINVPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:9030
+PFNGLCOMBINERINPUTNVPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:9031
+PFNGLCOMBINEROUTPUTNVPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean) # GL/glext.h:9032
+PFNGLFINALCOMBINERINPUTNVPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:9033
+PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:9034
+PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:9035
+PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:9036
+PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:9037
+PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:9038
+PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:9039
+# NV_fog_distance (GL/glext.h:9042)
+GL_NV_fog_distance = 1 # GL/glext.h:9043
+# NV_texgen_emboss (GL/glext.h:9046)
+GL_NV_texgen_emboss = 1 # GL/glext.h:9047
+# NV_blend_square (GL/glext.h:9050)
+GL_NV_blend_square = 1 # GL/glext.h:9051
+# NV_texture_env_combine4 (GL/glext.h:9054)
+GL_NV_texture_env_combine4 = 1 # GL/glext.h:9055
+# MESA_resize_buffers (GL/glext.h:9058)
+GL_MESA_resize_buffers = 1 # GL/glext.h:9059
+# GL/glext.h:9061
+glResizeBuffersMESA = _link_function('glResizeBuffersMESA', None, [], 'MESA_resize_buffers')
+
+PFNGLRESIZEBUFFERSMESAPROC = CFUNCTYPE(None) # GL/glext.h:9063
+# MESA_window_pos (GL/glext.h:9066)
+GL_MESA_window_pos = 1 # GL/glext.h:9067
+# GL/glext.h:9069
+glWindowPos2dMESA = _link_function('glWindowPos2dMESA', None, [GLdouble, GLdouble], 'MESA_window_pos')
+
+# GL/glext.h:9070
+glWindowPos2dvMESA = _link_function('glWindowPos2dvMESA', None, [POINTER(GLdouble)], 'MESA_window_pos')
+
+# GL/glext.h:9071
+glWindowPos2fMESA = _link_function('glWindowPos2fMESA', None, [GLfloat, GLfloat], 'MESA_window_pos')
+
+# GL/glext.h:9072
+glWindowPos2fvMESA = _link_function('glWindowPos2fvMESA', None, [POINTER(GLfloat)], 'MESA_window_pos')
+
+# GL/glext.h:9073
+glWindowPos2iMESA = _link_function('glWindowPos2iMESA', None, [GLint, GLint], 'MESA_window_pos')
+
+# GL/glext.h:9074
+glWindowPos2ivMESA = _link_function('glWindowPos2ivMESA', None, [POINTER(GLint)], 'MESA_window_pos')
+
+# GL/glext.h:9075
+glWindowPos2sMESA = _link_function('glWindowPos2sMESA', None, [GLshort, GLshort], 'MESA_window_pos')
+
+# GL/glext.h:9076
+glWindowPos2svMESA = _link_function('glWindowPos2svMESA', None, [POINTER(GLshort)], 'MESA_window_pos')
+
+# GL/glext.h:9077
+glWindowPos3dMESA = _link_function('glWindowPos3dMESA', None, [GLdouble, GLdouble, GLdouble], 'MESA_window_pos')
+
+# GL/glext.h:9078
+glWindowPos3dvMESA = _link_function('glWindowPos3dvMESA', None, [POINTER(GLdouble)], 'MESA_window_pos')
+
+# GL/glext.h:9079
+glWindowPos3fMESA = _link_function('glWindowPos3fMESA', None, [GLfloat, GLfloat, GLfloat], 'MESA_window_pos')
+
+# GL/glext.h:9080
+glWindowPos3fvMESA = _link_function('glWindowPos3fvMESA', None, [POINTER(GLfloat)], 'MESA_window_pos')
+
+# GL/glext.h:9081
+glWindowPos3iMESA = _link_function('glWindowPos3iMESA', None, [GLint, GLint, GLint], 'MESA_window_pos')
+
+# GL/glext.h:9082
+glWindowPos3ivMESA = _link_function('glWindowPos3ivMESA', None, [POINTER(GLint)], 'MESA_window_pos')
+
+# GL/glext.h:9083
+glWindowPos3sMESA = _link_function('glWindowPos3sMESA', None, [GLshort, GLshort, GLshort], 'MESA_window_pos')
+
+# GL/glext.h:9084
+glWindowPos3svMESA = _link_function('glWindowPos3svMESA', None, [POINTER(GLshort)], 'MESA_window_pos')
+
+# GL/glext.h:9085
+glWindowPos4dMESA = _link_function('glWindowPos4dMESA', None, [GLdouble, GLdouble, GLdouble, GLdouble], 'MESA_window_pos')
+
+# GL/glext.h:9086
+glWindowPos4dvMESA = _link_function('glWindowPos4dvMESA', None, [POINTER(GLdouble)], 'MESA_window_pos')
+
+# GL/glext.h:9087
+glWindowPos4fMESA = _link_function('glWindowPos4fMESA', None, [GLfloat, GLfloat, GLfloat, GLfloat], 'MESA_window_pos')
+
+# GL/glext.h:9088
+glWindowPos4fvMESA = _link_function('glWindowPos4fvMESA', None, [POINTER(GLfloat)], 'MESA_window_pos')
+
+# GL/glext.h:9089
+glWindowPos4iMESA = _link_function('glWindowPos4iMESA', None, [GLint, GLint, GLint, GLint], 'MESA_window_pos')
+
+# GL/glext.h:9090
+glWindowPos4ivMESA = _link_function('glWindowPos4ivMESA', None, [POINTER(GLint)], 'MESA_window_pos')
+
+# GL/glext.h:9091
+glWindowPos4sMESA = _link_function('glWindowPos4sMESA', None, [GLshort, GLshort, GLshort, GLshort], 'MESA_window_pos')
+
+# GL/glext.h:9092
+glWindowPos4svMESA = _link_function('glWindowPos4svMESA', None, [POINTER(GLshort)], 'MESA_window_pos')
+
+PFNGLWINDOWPOS2DMESAPROC = CFUNCTYPE(None, GLdouble, GLdouble) # GL/glext.h:9094
+PFNGLWINDOWPOS2DVMESAPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:9095
+PFNGLWINDOWPOS2FMESAPROC = CFUNCTYPE(None, GLfloat, GLfloat) # GL/glext.h:9096
+PFNGLWINDOWPOS2FVMESAPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:9097
+PFNGLWINDOWPOS2IMESAPROC = CFUNCTYPE(None, GLint, GLint) # GL/glext.h:9098
+PFNGLWINDOWPOS2IVMESAPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:9099
+PFNGLWINDOWPOS2SMESAPROC = CFUNCTYPE(None, GLshort, GLshort) # GL/glext.h:9100
+PFNGLWINDOWPOS2SVMESAPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:9101
+PFNGLWINDOWPOS3DMESAPROC = CFUNCTYPE(None, GLdouble, GLdouble, GLdouble) # GL/glext.h:9102
+PFNGLWINDOWPOS3DVMESAPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:9103
+PFNGLWINDOWPOS3FMESAPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat) # GL/glext.h:9104
+PFNGLWINDOWPOS3FVMESAPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:9105
+PFNGLWINDOWPOS3IMESAPROC = CFUNCTYPE(None, GLint, GLint, GLint) # GL/glext.h:9106
+PFNGLWINDOWPOS3IVMESAPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:9107
+PFNGLWINDOWPOS3SMESAPROC = CFUNCTYPE(None, GLshort, GLshort, GLshort) # GL/glext.h:9108
+PFNGLWINDOWPOS3SVMESAPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:9109
+PFNGLWINDOWPOS4DMESAPROC = CFUNCTYPE(None, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:9110
+PFNGLWINDOWPOS4DVMESAPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:9111
+PFNGLWINDOWPOS4FMESAPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:9112
+PFNGLWINDOWPOS4FVMESAPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:9113
+PFNGLWINDOWPOS4IMESAPROC = CFUNCTYPE(None, GLint, GLint, GLint, GLint) # GL/glext.h:9114
+PFNGLWINDOWPOS4IVMESAPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:9115
+PFNGLWINDOWPOS4SMESAPROC = CFUNCTYPE(None, GLshort, GLshort, GLshort, GLshort) # GL/glext.h:9116
+PFNGLWINDOWPOS4SVMESAPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:9117
+# IBM_cull_vertex (GL/glext.h:9120)
+GL_IBM_cull_vertex = 1 # GL/glext.h:9121
+# IBM_multimode_draw_arrays (GL/glext.h:9124)
+GL_IBM_multimode_draw_arrays = 1 # GL/glext.h:9125
+# GL/glext.h:9127
+glMultiModeDrawArraysIBM = _link_function('glMultiModeDrawArraysIBM', None, [POINTER(GLenum), POINTER(GLint), POINTER(GLsizei), GLsizei, GLint], 'IBM_multimode_draw_arrays')
+
+# GL/glext.h:9128
+glMultiModeDrawElementsIBM = _link_function('glMultiModeDrawElementsIBM', None, [POINTER(GLenum), POINTER(GLsizei), GLenum, POINTER(POINTER(GLvoid)), GLsizei, GLint], 'IBM_multimode_draw_arrays')
+
+PFNGLMULTIMODEDRAWARRAYSIBMPROC = CFUNCTYPE(None, POINTER(GLenum), POINTER(GLint), POINTER(GLsizei), GLsizei, GLint) # GL/glext.h:9130
+PFNGLMULTIMODEDRAWELEMENTSIBMPROC = CFUNCTYPE(None, POINTER(GLenum), POINTER(GLsizei), GLenum, POINTER(POINTER(GLvoid)), GLsizei, GLint) # GL/glext.h:9131
+# IBM_vertex_array_lists (GL/glext.h:9134)
+GL_IBM_vertex_array_lists = 1 # GL/glext.h:9135
+# GL/glext.h:9137
+glColorPointerListIBM = _link_function('glColorPointerListIBM', None, [GLint, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint], 'IBM_vertex_array_lists')
+
+# GL/glext.h:9138
+glSecondaryColorPointerListIBM = _link_function('glSecondaryColorPointerListIBM', None, [GLint, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint], 'IBM_vertex_array_lists')
+
+# GL/glext.h:9139
+glEdgeFlagPointerListIBM = _link_function('glEdgeFlagPointerListIBM', None, [GLint, POINTER(POINTER(GLboolean)), GLint], 'IBM_vertex_array_lists')
+
+# GL/glext.h:9140
+glFogCoordPointerListIBM = _link_function('glFogCoordPointerListIBM', None, [GLenum, GLint, POINTER(POINTER(GLvoid)), GLint], 'IBM_vertex_array_lists')
+
+# GL/glext.h:9141
+glIndexPointerListIBM = _link_function('glIndexPointerListIBM', None, [GLenum, GLint, POINTER(POINTER(GLvoid)), GLint], 'IBM_vertex_array_lists')
+
+# GL/glext.h:9142
+glNormalPointerListIBM = _link_function('glNormalPointerListIBM', None, [GLenum, GLint, POINTER(POINTER(GLvoid)), GLint], 'IBM_vertex_array_lists')
+
+# GL/glext.h:9143
+glTexCoordPointerListIBM = _link_function('glTexCoordPointerListIBM', None, [GLint, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint], 'IBM_vertex_array_lists')
+
+# GL/glext.h:9144
+glVertexPointerListIBM = _link_function('glVertexPointerListIBM', None, [GLint, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint], 'IBM_vertex_array_lists')
+
+PFNGLCOLORPOINTERLISTIBMPROC = CFUNCTYPE(None, GLint, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint) # GL/glext.h:9146
+PFNGLSECONDARYCOLORPOINTERLISTIBMPROC = CFUNCTYPE(None, GLint, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint) # GL/glext.h:9147
+PFNGLEDGEFLAGPOINTERLISTIBMPROC = CFUNCTYPE(None, GLint, POINTER(POINTER(GLboolean)), GLint) # GL/glext.h:9148
+PFNGLFOGCOORDPOINTERLISTIBMPROC = CFUNCTYPE(None, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint) # GL/glext.h:9149
+PFNGLINDEXPOINTERLISTIBMPROC = CFUNCTYPE(None, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint) # GL/glext.h:9150
+PFNGLNORMALPOINTERLISTIBMPROC = CFUNCTYPE(None, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint) # GL/glext.h:9151
+PFNGLTEXCOORDPOINTERLISTIBMPROC = CFUNCTYPE(None, GLint, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint) # GL/glext.h:9152
+PFNGLVERTEXPOINTERLISTIBMPROC = CFUNCTYPE(None, GLint, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint) # GL/glext.h:9153
+# SGIX_subsample (GL/glext.h:9156)
+GL_SGIX_subsample = 1 # GL/glext.h:9157
+# SGIX_ycrcba (GL/glext.h:9160)
+GL_SGIX_ycrcba = 1 # GL/glext.h:9161
+# SGIX_ycrcb_subsample (GL/glext.h:9164)
+GL_SGIX_ycrcb_subsample = 1 # GL/glext.h:9165
+# SGIX_depth_pass_instrument (GL/glext.h:9168)
+GL_SGIX_depth_pass_instrument = 1 # GL/glext.h:9169
+# 3DFX_texture_compression_FXT1 (GL/glext.h:9172)
+GL_3DFX_texture_compression_FXT1 = 1 # GL/glext.h:9173
+# 3DFX_multisample (GL/glext.h:9176)
+GL_3DFX_multisample = 1 # GL/glext.h:9177
+# 3DFX_tbuffer (GL/glext.h:9180)
+GL_3DFX_tbuffer = 1 # GL/glext.h:9181
+# GL/glext.h:9183
+glTbufferMask3DFX = _link_function('glTbufferMask3DFX', None, [GLuint], '3DFX_tbuffer')
+
+PFNGLTBUFFERMASK3DFXPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:9185
+# EXT_multisample (GL/glext.h:9188)
+GL_EXT_multisample = 1 # GL/glext.h:9189
+# GL/glext.h:9191
+glSampleMaskEXT = _link_function('glSampleMaskEXT', None, [GLclampf, GLboolean], 'EXT_multisample')
+
+# GL/glext.h:9192
+glSamplePatternEXT = _link_function('glSamplePatternEXT', None, [GLenum], 'EXT_multisample')
+
+PFNGLSAMPLEMASKEXTPROC = CFUNCTYPE(None, GLclampf, GLboolean) # GL/glext.h:9194
+PFNGLSAMPLEPATTERNEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:9195
+# SGIX_vertex_preclip (GL/glext.h:9198)
+GL_SGIX_vertex_preclip = 1 # GL/glext.h:9199
+# SGIX_convolution_accuracy (GL/glext.h:9202)
+GL_SGIX_convolution_accuracy = 1 # GL/glext.h:9203
+# SGIX_resample (GL/glext.h:9206)
+GL_SGIX_resample = 1 # GL/glext.h:9207
+# SGIS_point_line_texgen (GL/glext.h:9210)
+GL_SGIS_point_line_texgen = 1 # GL/glext.h:9211
+# SGIS_texture_color_mask (GL/glext.h:9214)
+GL_SGIS_texture_color_mask = 1 # GL/glext.h:9215
+# GL/glext.h:9217
+glTextureColorMaskSGIS = _link_function('glTextureColorMaskSGIS', None, [GLboolean, GLboolean, GLboolean, GLboolean], 'SGIS_texture_color_mask')
+
+PFNGLTEXTURECOLORMASKSGISPROC = CFUNCTYPE(None, GLboolean, GLboolean, GLboolean, GLboolean) # GL/glext.h:9219
+# SGIX_igloo_interface (GL/glext.h:9222)
+GL_SGIX_igloo_interface = 1 # GL/glext.h:9223
+# GL/glext.h:9225
+glIglooInterfaceSGIX = _link_function('glIglooInterfaceSGIX', None, [GLenum, POINTER(GLvoid)], 'SGIX_igloo_interface')
+
+PFNGLIGLOOINTERFACESGIXPROC = CFUNCTYPE(None, GLenum, POINTER(GLvoid)) # GL/glext.h:9227
+# EXT_texture_env_dot3 (GL/glext.h:9230)
+GL_EXT_texture_env_dot3 = 1 # GL/glext.h:9231
+# ATI_texture_mirror_once (GL/glext.h:9234)
+GL_ATI_texture_mirror_once = 1 # GL/glext.h:9235
+# NV_fence (GL/glext.h:9238)
+GL_NV_fence = 1 # GL/glext.h:9239
+# GL/glext.h:9241
+glDeleteFencesNV = _link_function('glDeleteFencesNV', None, [GLsizei, POINTER(GLuint)], 'NV_fence')
+
+# GL/glext.h:9242
+glGenFencesNV = _link_function('glGenFencesNV', None, [GLsizei, POINTER(GLuint)], 'NV_fence')
+
+# GL/glext.h:9243
+glIsFenceNV = _link_function('glIsFenceNV', GLboolean, [GLuint], 'NV_fence')
+
+# GL/glext.h:9244
+glTestFenceNV = _link_function('glTestFenceNV', GLboolean, [GLuint], 'NV_fence')
+
+# GL/glext.h:9245
+glGetFenceivNV = _link_function('glGetFenceivNV', None, [GLuint, GLenum, POINTER(GLint)], 'NV_fence')
+
+# GL/glext.h:9246
+glFinishFenceNV = _link_function('glFinishFenceNV', None, [GLuint], 'NV_fence')
+
+# GL/glext.h:9247
+glSetFenceNV = _link_function('glSetFenceNV', None, [GLuint, GLenum], 'NV_fence')
+
+PFNGLDELETEFENCESNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:9249
+PFNGLGENFENCESNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:9250
+PFNGLISFENCENVPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:9251
+PFNGLTESTFENCENVPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:9252
+PFNGLGETFENCEIVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:9253
+PFNGLFINISHFENCENVPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:9254
+PFNGLSETFENCENVPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:9255
+# NV_evaluators (GL/glext.h:9258)
+GL_NV_evaluators = 1 # GL/glext.h:9259
+# GL/glext.h:9261
+glMapControlPointsNV = _link_function('glMapControlPointsNV', None, [GLenum, GLuint, GLenum, GLsizei, GLsizei, GLint, GLint, GLboolean, POINTER(GLvoid)], 'NV_evaluators')
+
+# GL/glext.h:9262
+glMapParameterivNV = _link_function('glMapParameterivNV', None, [GLenum, GLenum, POINTER(GLint)], 'NV_evaluators')
+
+# GL/glext.h:9263
+glMapParameterfvNV = _link_function('glMapParameterfvNV', None, [GLenum, GLenum, POINTER(GLfloat)], 'NV_evaluators')
+
+# GL/glext.h:9264
+glGetMapControlPointsNV = _link_function('glGetMapControlPointsNV', None, [GLenum, GLuint, GLenum, GLsizei, GLsizei, GLboolean, POINTER(GLvoid)], 'NV_evaluators')
+
+# GL/glext.h:9265
+glGetMapParameterivNV = _link_function('glGetMapParameterivNV', None, [GLenum, GLenum, POINTER(GLint)], 'NV_evaluators')
+
+# GL/glext.h:9266
+glGetMapParameterfvNV = _link_function('glGetMapParameterfvNV', None, [GLenum, GLenum, POINTER(GLfloat)], 'NV_evaluators')
+
+# GL/glext.h:9267
+glGetMapAttribParameterivNV = _link_function('glGetMapAttribParameterivNV', None, [GLenum, GLuint, GLenum, POINTER(GLint)], 'NV_evaluators')
+
+# GL/glext.h:9268
+glGetMapAttribParameterfvNV = _link_function('glGetMapAttribParameterfvNV', None, [GLenum, GLuint, GLenum, POINTER(GLfloat)], 'NV_evaluators')
+
+# GL/glext.h:9269
+glEvalMapsNV = _link_function('glEvalMapsNV', None, [GLenum, GLenum], 'NV_evaluators')
+
+PFNGLMAPCONTROLPOINTSNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLenum, GLsizei, GLsizei, GLint, GLint, GLboolean, POINTER(GLvoid)) # GL/glext.h:9271
+PFNGLMAPPARAMETERIVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:9272
+PFNGLMAPPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:9273
+PFNGLGETMAPCONTROLPOINTSNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLenum, GLsizei, GLsizei, GLboolean, POINTER(GLvoid)) # GL/glext.h:9274
+PFNGLGETMAPPARAMETERIVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:9275
+PFNGLGETMAPPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:9276
+PFNGLGETMAPATTRIBPARAMETERIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:9277
+PFNGLGETMAPATTRIBPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:9278
+PFNGLEVALMAPSNVPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:9279
+# NV_packed_depth_stencil (GL/glext.h:9282)
+GL_NV_packed_depth_stencil = 1 # GL/glext.h:9283
+# NV_register_combiners2 (GL/glext.h:9286)
+GL_NV_register_combiners2 = 1 # GL/glext.h:9287
+# GL/glext.h:9289
+glCombinerStageParameterfvNV = _link_function('glCombinerStageParameterfvNV', None, [GLenum, GLenum, POINTER(GLfloat)], 'NV_register_combiners2')
+
+# GL/glext.h:9290
+glGetCombinerStageParameterfvNV = _link_function('glGetCombinerStageParameterfvNV', None, [GLenum, GLenum, POINTER(GLfloat)], 'NV_register_combiners2')
+
+PFNGLCOMBINERSTAGEPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:9292
+PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:9293
+# NV_texture_compression_vtc (GL/glext.h:9296)
+GL_NV_texture_compression_vtc = 1 # GL/glext.h:9297
+# NV_texture_rectangle (GL/glext.h:9300)
+GL_NV_texture_rectangle = 1 # GL/glext.h:9301
+# NV_texture_shader (GL/glext.h:9304)
+GL_NV_texture_shader = 1 # GL/glext.h:9305
+# NV_texture_shader2 (GL/glext.h:9308)
+GL_NV_texture_shader2 = 1 # GL/glext.h:9309
+# NV_vertex_array_range2 (GL/glext.h:9312)
+GL_NV_vertex_array_range2 = 1 # GL/glext.h:9313
+# NV_vertex_program (GL/glext.h:9316)
+GL_NV_vertex_program = 1 # GL/glext.h:9317
+# GL/glext.h:9319
+glAreProgramsResidentNV = _link_function('glAreProgramsResidentNV', GLboolean, [GLsizei, POINTER(GLuint), POINTER(GLboolean)], 'NV_vertex_program')
+
+# GL/glext.h:9320
+glBindProgramNV = _link_function('glBindProgramNV', None, [GLenum, GLuint], 'NV_vertex_program')
+
+# GL/glext.h:9321
+glDeleteProgramsNV = _link_function('glDeleteProgramsNV', None, [GLsizei, POINTER(GLuint)], 'NV_vertex_program')
+
+# GL/glext.h:9322
+glExecuteProgramNV = _link_function('glExecuteProgramNV', None, [GLenum, GLuint, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:9323
+glGenProgramsNV = _link_function('glGenProgramsNV', None, [GLsizei, POINTER(GLuint)], 'NV_vertex_program')
+
+# GL/glext.h:9324
+glGetProgramParameterdvNV = _link_function('glGetProgramParameterdvNV', None, [GLenum, GLuint, GLenum, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:9325
+glGetProgramParameterfvNV = _link_function('glGetProgramParameterfvNV', None, [GLenum, GLuint, GLenum, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:9326
+glGetProgramivNV = _link_function('glGetProgramivNV', None, [GLuint, GLenum, POINTER(GLint)], 'NV_vertex_program')
+
+# GL/glext.h:9327
+glGetProgramStringNV = _link_function('glGetProgramStringNV', None, [GLuint, GLenum, POINTER(GLubyte)], 'NV_vertex_program')
+
+# GL/glext.h:9328
+glGetTrackMatrixivNV = _link_function('glGetTrackMatrixivNV', None, [GLenum, GLuint, GLenum, POINTER(GLint)], 'NV_vertex_program')
+
+# GL/glext.h:9329
+glGetVertexAttribdvNV = _link_function('glGetVertexAttribdvNV', None, [GLuint, GLenum, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:9330
+glGetVertexAttribfvNV = _link_function('glGetVertexAttribfvNV', None, [GLuint, GLenum, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:9331
+glGetVertexAttribivNV = _link_function('glGetVertexAttribivNV', None, [GLuint, GLenum, POINTER(GLint)], 'NV_vertex_program')
+
+# GL/glext.h:9332
+glGetVertexAttribPointervNV = _link_function('glGetVertexAttribPointervNV', None, [GLuint, GLenum, POINTER(POINTER(GLvoid))], 'NV_vertex_program')
+
+# GL/glext.h:9333
+glIsProgramNV = _link_function('glIsProgramNV', GLboolean, [GLuint], 'NV_vertex_program')
+
+# GL/glext.h:9334
+glLoadProgramNV = _link_function('glLoadProgramNV', None, [GLenum, GLuint, GLsizei, POINTER(GLubyte)], 'NV_vertex_program')
+
+# GL/glext.h:9335
+glProgramParameter4dNV = _link_function('glProgramParameter4dNV', None, [GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble], 'NV_vertex_program')
+
+# GL/glext.h:9336
+glProgramParameter4dvNV = _link_function('glProgramParameter4dvNV', None, [GLenum, GLuint, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:9337
+glProgramParameter4fNV = _link_function('glProgramParameter4fNV', None, [GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat], 'NV_vertex_program')
+
+# GL/glext.h:9338
+glProgramParameter4fvNV = _link_function('glProgramParameter4fvNV', None, [GLenum, GLuint, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:9339
+glProgramParameters4dvNV = _link_function('glProgramParameters4dvNV', None, [GLenum, GLuint, GLsizei, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:9340
+glProgramParameters4fvNV = _link_function('glProgramParameters4fvNV', None, [GLenum, GLuint, GLsizei, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:9341
+glRequestResidentProgramsNV = _link_function('glRequestResidentProgramsNV', None, [GLsizei, POINTER(GLuint)], 'NV_vertex_program')
+
+# GL/glext.h:9342
+glTrackMatrixNV = _link_function('glTrackMatrixNV', None, [GLenum, GLuint, GLenum, GLenum], 'NV_vertex_program')
+
+# GL/glext.h:9343
+glVertexAttribPointerNV = _link_function('glVertexAttribPointerNV', None, [GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)], 'NV_vertex_program')
+
+# GL/glext.h:9344
+glVertexAttrib1dNV = _link_function('glVertexAttrib1dNV', None, [GLuint, GLdouble], 'NV_vertex_program')
+
+# GL/glext.h:9345
+glVertexAttrib1dvNV = _link_function('glVertexAttrib1dvNV', None, [GLuint, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:9346
+glVertexAttrib1fNV = _link_function('glVertexAttrib1fNV', None, [GLuint, GLfloat], 'NV_vertex_program')
+
+# GL/glext.h:9347
+glVertexAttrib1fvNV = _link_function('glVertexAttrib1fvNV', None, [GLuint, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:9348
+glVertexAttrib1sNV = _link_function('glVertexAttrib1sNV', None, [GLuint, GLshort], 'NV_vertex_program')
+
+# GL/glext.h:9349
+glVertexAttrib1svNV = _link_function('glVertexAttrib1svNV', None, [GLuint, POINTER(GLshort)], 'NV_vertex_program')
+
+# GL/glext.h:9350
+glVertexAttrib2dNV = _link_function('glVertexAttrib2dNV', None, [GLuint, GLdouble, GLdouble], 'NV_vertex_program')
+
+# GL/glext.h:9351
+glVertexAttrib2dvNV = _link_function('glVertexAttrib2dvNV', None, [GLuint, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:9352
+glVertexAttrib2fNV = _link_function('glVertexAttrib2fNV', None, [GLuint, GLfloat, GLfloat], 'NV_vertex_program')
+
+# GL/glext.h:9353
+glVertexAttrib2fvNV = _link_function('glVertexAttrib2fvNV', None, [GLuint, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:9354
+glVertexAttrib2sNV = _link_function('glVertexAttrib2sNV', None, [GLuint, GLshort, GLshort], 'NV_vertex_program')
+
+# GL/glext.h:9355
+glVertexAttrib2svNV = _link_function('glVertexAttrib2svNV', None, [GLuint, POINTER(GLshort)], 'NV_vertex_program')
+
+# GL/glext.h:9356
+glVertexAttrib3dNV = _link_function('glVertexAttrib3dNV', None, [GLuint, GLdouble, GLdouble, GLdouble], 'NV_vertex_program')
+
+# GL/glext.h:9357
+glVertexAttrib3dvNV = _link_function('glVertexAttrib3dvNV', None, [GLuint, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:9358
+glVertexAttrib3fNV = _link_function('glVertexAttrib3fNV', None, [GLuint, GLfloat, GLfloat, GLfloat], 'NV_vertex_program')
+
+# GL/glext.h:9359
+glVertexAttrib3fvNV = _link_function('glVertexAttrib3fvNV', None, [GLuint, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:9360
+glVertexAttrib3sNV = _link_function('glVertexAttrib3sNV', None, [GLuint, GLshort, GLshort, GLshort], 'NV_vertex_program')
+
+# GL/glext.h:9361
+glVertexAttrib3svNV = _link_function('glVertexAttrib3svNV', None, [GLuint, POINTER(GLshort)], 'NV_vertex_program')
+
+# GL/glext.h:9362
+glVertexAttrib4dNV = _link_function('glVertexAttrib4dNV', None, [GLuint, GLdouble, GLdouble, GLdouble, GLdouble], 'NV_vertex_program')
+
+# GL/glext.h:9363
+glVertexAttrib4dvNV = _link_function('glVertexAttrib4dvNV', None, [GLuint, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:9364
+glVertexAttrib4fNV = _link_function('glVertexAttrib4fNV', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat], 'NV_vertex_program')
+
+# GL/glext.h:9365
+glVertexAttrib4fvNV = _link_function('glVertexAttrib4fvNV', None, [GLuint, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:9366
+glVertexAttrib4sNV = _link_function('glVertexAttrib4sNV', None, [GLuint, GLshort, GLshort, GLshort, GLshort], 'NV_vertex_program')
+
+# GL/glext.h:9367
+glVertexAttrib4svNV = _link_function('glVertexAttrib4svNV', None, [GLuint, POINTER(GLshort)], 'NV_vertex_program')
+
+# GL/glext.h:9368
+glVertexAttrib4ubNV = _link_function('glVertexAttrib4ubNV', None, [GLuint, GLubyte, GLubyte, GLubyte, GLubyte], 'NV_vertex_program')
+
+# GL/glext.h:9369
+glVertexAttrib4ubvNV = _link_function('glVertexAttrib4ubvNV', None, [GLuint, POINTER(GLubyte)], 'NV_vertex_program')
+
+# GL/glext.h:9370
+glVertexAttribs1dvNV = _link_function('glVertexAttribs1dvNV', None, [GLuint, GLsizei, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:9371
+glVertexAttribs1fvNV = _link_function('glVertexAttribs1fvNV', None, [GLuint, GLsizei, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:9372
+glVertexAttribs1svNV = _link_function('glVertexAttribs1svNV', None, [GLuint, GLsizei, POINTER(GLshort)], 'NV_vertex_program')
+
+# GL/glext.h:9373
+glVertexAttribs2dvNV = _link_function('glVertexAttribs2dvNV', None, [GLuint, GLsizei, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:9374
+glVertexAttribs2fvNV = _link_function('glVertexAttribs2fvNV', None, [GLuint, GLsizei, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:9375
+glVertexAttribs2svNV = _link_function('glVertexAttribs2svNV', None, [GLuint, GLsizei, POINTER(GLshort)], 'NV_vertex_program')
+
+# GL/glext.h:9376
+glVertexAttribs3dvNV = _link_function('glVertexAttribs3dvNV', None, [GLuint, GLsizei, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:9377
+glVertexAttribs3fvNV = _link_function('glVertexAttribs3fvNV', None, [GLuint, GLsizei, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:9378
+glVertexAttribs3svNV = _link_function('glVertexAttribs3svNV', None, [GLuint, GLsizei, POINTER(GLshort)], 'NV_vertex_program')
+
+# GL/glext.h:9379
+glVertexAttribs4dvNV = _link_function('glVertexAttribs4dvNV', None, [GLuint, GLsizei, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:9380
+glVertexAttribs4fvNV = _link_function('glVertexAttribs4fvNV', None, [GLuint, GLsizei, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:9381
+glVertexAttribs4svNV = _link_function('glVertexAttribs4svNV', None, [GLuint, GLsizei, POINTER(GLshort)], 'NV_vertex_program')
+
+# GL/glext.h:9382
+glVertexAttribs4ubvNV = _link_function('glVertexAttribs4ubvNV', None, [GLuint, GLsizei, POINTER(GLubyte)], 'NV_vertex_program')
+
+PFNGLAREPROGRAMSRESIDENTNVPROC = CFUNCTYPE(GLboolean, GLsizei, POINTER(GLuint), POINTER(GLboolean)) # GL/glext.h:9384
+PFNGLBINDPROGRAMNVPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:9385
+PFNGLDELETEPROGRAMSNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:9386
+PFNGLEXECUTEPROGRAMNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:9387
+PFNGLGENPROGRAMSNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:9388
+PFNGLGETPROGRAMPARAMETERDVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLenum, POINTER(GLdouble)) # GL/glext.h:9389
+PFNGLGETPROGRAMPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:9390
+PFNGLGETPROGRAMIVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:9391
+PFNGLGETPROGRAMSTRINGNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLubyte)) # GL/glext.h:9392
+PFNGLGETTRACKMATRIXIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:9393
+PFNGLGETVERTEXATTRIBDVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLdouble)) # GL/glext.h:9394
+PFNGLGETVERTEXATTRIBFVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:9395
+PFNGLGETVERTEXATTRIBIVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:9396
+PFNGLGETVERTEXATTRIBPOINTERVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:9397
+PFNGLISPROGRAMNVPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:9398
+PFNGLLOADPROGRAMNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLsizei, POINTER(GLubyte)) # GL/glext.h:9399
+PFNGLPROGRAMPARAMETER4DNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:9400
+PFNGLPROGRAMPARAMETER4DVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLdouble)) # GL/glext.h:9401
+PFNGLPROGRAMPARAMETER4FNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:9402
+PFNGLPROGRAMPARAMETER4FVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:9403
+PFNGLPROGRAMPARAMETERS4DVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLsizei, POINTER(GLdouble)) # GL/glext.h:9404
+PFNGLPROGRAMPARAMETERS4FVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLsizei, POINTER(GLfloat)) # GL/glext.h:9405
+PFNGLREQUESTRESIDENTPROGRAMSNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:9406
+PFNGLTRACKMATRIXNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLenum, GLenum) # GL/glext.h:9407
+PFNGLVERTEXATTRIBPOINTERNVPROC = CFUNCTYPE(None, GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:9408
+PFNGLVERTEXATTRIB1DNVPROC = CFUNCTYPE(None, GLuint, GLdouble) # GL/glext.h:9409
+PFNGLVERTEXATTRIB1DVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:9410
+PFNGLVERTEXATTRIB1FNVPROC = CFUNCTYPE(None, GLuint, GLfloat) # GL/glext.h:9411
+PFNGLVERTEXATTRIB1FVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:9412
+PFNGLVERTEXATTRIB1SNVPROC = CFUNCTYPE(None, GLuint, GLshort) # GL/glext.h:9413
+PFNGLVERTEXATTRIB1SVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:9414
+PFNGLVERTEXATTRIB2DNVPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble) # GL/glext.h:9415
+PFNGLVERTEXATTRIB2DVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:9416
+PFNGLVERTEXATTRIB2FNVPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat) # GL/glext.h:9417
+PFNGLVERTEXATTRIB2FVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:9418
+PFNGLVERTEXATTRIB2SNVPROC = CFUNCTYPE(None, GLuint, GLshort, GLshort) # GL/glext.h:9419
+PFNGLVERTEXATTRIB2SVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:9420
+PFNGLVERTEXATTRIB3DNVPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble, GLdouble) # GL/glext.h:9421
+PFNGLVERTEXATTRIB3DVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:9422
+PFNGLVERTEXATTRIB3FNVPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat) # GL/glext.h:9423
+PFNGLVERTEXATTRIB3FVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:9424
+PFNGLVERTEXATTRIB3SNVPROC = CFUNCTYPE(None, GLuint, GLshort, GLshort, GLshort) # GL/glext.h:9425
+PFNGLVERTEXATTRIB3SVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:9426
+PFNGLVERTEXATTRIB4DNVPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:9427
+PFNGLVERTEXATTRIB4DVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:9428
+PFNGLVERTEXATTRIB4FNVPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:9429
+PFNGLVERTEXATTRIB4FVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:9430
+PFNGLVERTEXATTRIB4SNVPROC = CFUNCTYPE(None, GLuint, GLshort, GLshort, GLshort, GLshort) # GL/glext.h:9431
+PFNGLVERTEXATTRIB4SVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:9432
+PFNGLVERTEXATTRIB4UBNVPROC = CFUNCTYPE(None, GLuint, GLubyte, GLubyte, GLubyte, GLubyte) # GL/glext.h:9433
+PFNGLVERTEXATTRIB4UBVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLubyte)) # GL/glext.h:9434
+PFNGLVERTEXATTRIBS1DVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLdouble)) # GL/glext.h:9435
+PFNGLVERTEXATTRIBS1FVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLfloat)) # GL/glext.h:9436
+PFNGLVERTEXATTRIBS1SVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLshort)) # GL/glext.h:9437
+PFNGLVERTEXATTRIBS2DVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLdouble)) # GL/glext.h:9438
+PFNGLVERTEXATTRIBS2FVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLfloat)) # GL/glext.h:9439
+PFNGLVERTEXATTRIBS2SVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLshort)) # GL/glext.h:9440
+PFNGLVERTEXATTRIBS3DVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLdouble)) # GL/glext.h:9441
+PFNGLVERTEXATTRIBS3FVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLfloat)) # GL/glext.h:9442
+PFNGLVERTEXATTRIBS3SVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLshort)) # GL/glext.h:9443
+PFNGLVERTEXATTRIBS4DVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLdouble)) # GL/glext.h:9444
+PFNGLVERTEXATTRIBS4FVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLfloat)) # GL/glext.h:9445
+PFNGLVERTEXATTRIBS4SVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLshort)) # GL/glext.h:9446
+PFNGLVERTEXATTRIBS4UBVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLubyte)) # GL/glext.h:9447
+# SGIX_texture_coordinate_clamp (GL/glext.h:9450)
+GL_SGIX_texture_coordinate_clamp = 1 # GL/glext.h:9451
+# SGIX_scalebias_hint (GL/glext.h:9454)
+GL_SGIX_scalebias_hint = 1 # GL/glext.h:9455
+# OML_interlace (GL/glext.h:9458)
+GL_OML_interlace = 1 # GL/glext.h:9459
+# OML_subsample (GL/glext.h:9462)
+GL_OML_subsample = 1 # GL/glext.h:9463
+# OML_resample (GL/glext.h:9466)
+GL_OML_resample = 1 # GL/glext.h:9467
+# NV_copy_depth_to_color (GL/glext.h:9470)
+GL_NV_copy_depth_to_color = 1 # GL/glext.h:9471
+# ATI_envmap_bumpmap (GL/glext.h:9474)
+GL_ATI_envmap_bumpmap = 1 # GL/glext.h:9475
+# GL/glext.h:9477
+glTexBumpParameterivATI = _link_function('glTexBumpParameterivATI', None, [GLenum, POINTER(GLint)], 'ATI_envmap_bumpmap')
+
+# GL/glext.h:9478
+glTexBumpParameterfvATI = _link_function('glTexBumpParameterfvATI', None, [GLenum, POINTER(GLfloat)], 'ATI_envmap_bumpmap')
+
+# GL/glext.h:9479
+glGetTexBumpParameterivATI = _link_function('glGetTexBumpParameterivATI', None, [GLenum, POINTER(GLint)], 'ATI_envmap_bumpmap')
+
+# GL/glext.h:9480
+glGetTexBumpParameterfvATI = _link_function('glGetTexBumpParameterfvATI', None, [GLenum, POINTER(GLfloat)], 'ATI_envmap_bumpmap')
+
+PFNGLTEXBUMPPARAMETERIVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:9482
+PFNGLTEXBUMPPARAMETERFVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:9483
+PFNGLGETTEXBUMPPARAMETERIVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:9484
+PFNGLGETTEXBUMPPARAMETERFVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:9485
+# ATI_fragment_shader (GL/glext.h:9488)
+GL_ATI_fragment_shader = 1 # GL/glext.h:9489
+# GL/glext.h:9491
+glGenFragmentShadersATI = _link_function('glGenFragmentShadersATI', GLuint, [GLuint], 'ATI_fragment_shader')
+
+# GL/glext.h:9492
+glBindFragmentShaderATI = _link_function('glBindFragmentShaderATI', None, [GLuint], 'ATI_fragment_shader')
+
+# GL/glext.h:9493
+glDeleteFragmentShaderATI = _link_function('glDeleteFragmentShaderATI', None, [GLuint], 'ATI_fragment_shader')
+
+# GL/glext.h:9494
+glBeginFragmentShaderATI = _link_function('glBeginFragmentShaderATI', None, [], 'ATI_fragment_shader')
+
+# GL/glext.h:9495
+glEndFragmentShaderATI = _link_function('glEndFragmentShaderATI', None, [], 'ATI_fragment_shader')
+
+# GL/glext.h:9496
+glPassTexCoordATI = _link_function('glPassTexCoordATI', None, [GLuint, GLuint, GLenum], 'ATI_fragment_shader')
+
+# GL/glext.h:9497
+glSampleMapATI = _link_function('glSampleMapATI', None, [GLuint, GLuint, GLenum], 'ATI_fragment_shader')
+
+# GL/glext.h:9498
+glColorFragmentOp1ATI = _link_function('glColorFragmentOp1ATI', None, [GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint], 'ATI_fragment_shader')
+
+# GL/glext.h:9499
+glColorFragmentOp2ATI = _link_function('glColorFragmentOp2ATI', None, [GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint], 'ATI_fragment_shader')
+
+# GL/glext.h:9500
+glColorFragmentOp3ATI = _link_function('glColorFragmentOp3ATI', None, [GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint], 'ATI_fragment_shader')
+
+# GL/glext.h:9501
+glAlphaFragmentOp1ATI = _link_function('glAlphaFragmentOp1ATI', None, [GLenum, GLuint, GLuint, GLuint, GLuint, GLuint], 'ATI_fragment_shader')
+
+# GL/glext.h:9502
+glAlphaFragmentOp2ATI = _link_function('glAlphaFragmentOp2ATI', None, [GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint], 'ATI_fragment_shader')
+
+# GL/glext.h:9503
+glAlphaFragmentOp3ATI = _link_function('glAlphaFragmentOp3ATI', None, [GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint], 'ATI_fragment_shader')
+
+# GL/glext.h:9504
+glSetFragmentShaderConstantATI = _link_function('glSetFragmentShaderConstantATI', None, [GLuint, POINTER(GLfloat)], 'ATI_fragment_shader')
+
+PFNGLGENFRAGMENTSHADERSATIPROC = CFUNCTYPE(GLuint, GLuint) # GL/glext.h:9506
+PFNGLBINDFRAGMENTSHADERATIPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:9507
+PFNGLDELETEFRAGMENTSHADERATIPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:9508
+PFNGLBEGINFRAGMENTSHADERATIPROC = CFUNCTYPE(None) # GL/glext.h:9509
+PFNGLENDFRAGMENTSHADERATIPROC = CFUNCTYPE(None) # GL/glext.h:9510
+PFNGLPASSTEXCOORDATIPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum) # GL/glext.h:9511
+PFNGLSAMPLEMAPATIPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum) # GL/glext.h:9512
+PFNGLCOLORFRAGMENTOP1ATIPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:9513
+PFNGLCOLORFRAGMENTOP2ATIPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:9514
+PFNGLCOLORFRAGMENTOP3ATIPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:9515
+PFNGLALPHAFRAGMENTOP1ATIPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:9516
+PFNGLALPHAFRAGMENTOP2ATIPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:9517
+PFNGLALPHAFRAGMENTOP3ATIPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:9518
+PFNGLSETFRAGMENTSHADERCONSTANTATIPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:9519
+# ATI_pn_triangles (GL/glext.h:9522)
+GL_ATI_pn_triangles = 1 # GL/glext.h:9523
+# GL/glext.h:9525
+glPNTrianglesiATI = _link_function('glPNTrianglesiATI', None, [GLenum, GLint], 'ATI_pn_triangles')
+
+# GL/glext.h:9526
+glPNTrianglesfATI = _link_function('glPNTrianglesfATI', None, [GLenum, GLfloat], 'ATI_pn_triangles')
+
+PFNGLPNTRIANGLESIATIPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:9528
+PFNGLPNTRIANGLESFATIPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:9529
+# ATI_vertex_array_object (GL/glext.h:9532)
+GL_ATI_vertex_array_object = 1 # GL/glext.h:9533
+# GL/glext.h:9535
+glNewObjectBufferATI = _link_function('glNewObjectBufferATI', GLuint, [GLsizei, POINTER(GLvoid), GLenum], 'ATI_vertex_array_object')
+
+# GL/glext.h:9536
+glIsObjectBufferATI = _link_function('glIsObjectBufferATI', GLboolean, [GLuint], 'ATI_vertex_array_object')
+
+# GL/glext.h:9537
+glUpdateObjectBufferATI = _link_function('glUpdateObjectBufferATI', None, [GLuint, GLuint, GLsizei, POINTER(GLvoid), GLenum], 'ATI_vertex_array_object')
+
+# GL/glext.h:9538
+glGetObjectBufferfvATI = _link_function('glGetObjectBufferfvATI', None, [GLuint, GLenum, POINTER(GLfloat)], 'ATI_vertex_array_object')
+
+# GL/glext.h:9539
+glGetObjectBufferivATI = _link_function('glGetObjectBufferivATI', None, [GLuint, GLenum, POINTER(GLint)], 'ATI_vertex_array_object')
+
+# GL/glext.h:9540
+glFreeObjectBufferATI = _link_function('glFreeObjectBufferATI', None, [GLuint], 'ATI_vertex_array_object')
+
+# GL/glext.h:9541
+glArrayObjectATI = _link_function('glArrayObjectATI', None, [GLenum, GLint, GLenum, GLsizei, GLuint, GLuint], 'ATI_vertex_array_object')
+
+# GL/glext.h:9542
+glGetArrayObjectfvATI = _link_function('glGetArrayObjectfvATI', None, [GLenum, GLenum, POINTER(GLfloat)], 'ATI_vertex_array_object')
+
+# GL/glext.h:9543
+glGetArrayObjectivATI = _link_function('glGetArrayObjectivATI', None, [GLenum, GLenum, POINTER(GLint)], 'ATI_vertex_array_object')
+
+# GL/glext.h:9544
+glVariantArrayObjectATI = _link_function('glVariantArrayObjectATI', None, [GLuint, GLenum, GLsizei, GLuint, GLuint], 'ATI_vertex_array_object')
+
+# GL/glext.h:9545
+glGetVariantArrayObjectfvATI = _link_function('glGetVariantArrayObjectfvATI', None, [GLuint, GLenum, POINTER(GLfloat)], 'ATI_vertex_array_object')
+
+# GL/glext.h:9546
+glGetVariantArrayObjectivATI = _link_function('glGetVariantArrayObjectivATI', None, [GLuint, GLenum, POINTER(GLint)], 'ATI_vertex_array_object')
+
+PFNGLNEWOBJECTBUFFERATIPROC = CFUNCTYPE(GLuint, GLsizei, POINTER(GLvoid), GLenum) # GL/glext.h:9548
+PFNGLISOBJECTBUFFERATIPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:9549
+PFNGLUPDATEOBJECTBUFFERATIPROC = CFUNCTYPE(None, GLuint, GLuint, GLsizei, POINTER(GLvoid), GLenum) # GL/glext.h:9550
+PFNGLGETOBJECTBUFFERFVATIPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:9551
+PFNGLGETOBJECTBUFFERIVATIPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:9552
+PFNGLFREEOBJECTBUFFERATIPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:9553
+PFNGLARRAYOBJECTATIPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLsizei, GLuint, GLuint) # GL/glext.h:9554
+PFNGLGETARRAYOBJECTFVATIPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:9555
+PFNGLGETARRAYOBJECTIVATIPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:9556
+PFNGLVARIANTARRAYOBJECTATIPROC = CFUNCTYPE(None, GLuint, GLenum, GLsizei, GLuint, GLuint) # GL/glext.h:9557
+PFNGLGETVARIANTARRAYOBJECTFVATIPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:9558
+PFNGLGETVARIANTARRAYOBJECTIVATIPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:9559
+# EXT_vertex_shader (GL/glext.h:9562)
+GL_EXT_vertex_shader = 1 # GL/glext.h:9563
+# GL/glext.h:9565
+glBeginVertexShaderEXT = _link_function('glBeginVertexShaderEXT', None, [], 'EXT_vertex_shader')
+
+# GL/glext.h:9566
+glEndVertexShaderEXT = _link_function('glEndVertexShaderEXT', None, [], 'EXT_vertex_shader')
+
+# GL/glext.h:9567
+glBindVertexShaderEXT = _link_function('glBindVertexShaderEXT', None, [GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:9568
+glGenVertexShadersEXT = _link_function('glGenVertexShadersEXT', GLuint, [GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:9569
+glDeleteVertexShaderEXT = _link_function('glDeleteVertexShaderEXT', None, [GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:9570
+glShaderOp1EXT = _link_function('glShaderOp1EXT', None, [GLenum, GLuint, GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:9571
+glShaderOp2EXT = _link_function('glShaderOp2EXT', None, [GLenum, GLuint, GLuint, GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:9572
+glShaderOp3EXT = _link_function('glShaderOp3EXT', None, [GLenum, GLuint, GLuint, GLuint, GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:9573
+glSwizzleEXT = _link_function('glSwizzleEXT', None, [GLuint, GLuint, GLenum, GLenum, GLenum, GLenum], 'EXT_vertex_shader')
+
+# GL/glext.h:9574
+glWriteMaskEXT = _link_function('glWriteMaskEXT', None, [GLuint, GLuint, GLenum, GLenum, GLenum, GLenum], 'EXT_vertex_shader')
+
+# GL/glext.h:9575
+glInsertComponentEXT = _link_function('glInsertComponentEXT', None, [GLuint, GLuint, GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:9576
+glExtractComponentEXT = _link_function('glExtractComponentEXT', None, [GLuint, GLuint, GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:9577
+glGenSymbolsEXT = _link_function('glGenSymbolsEXT', GLuint, [GLenum, GLenum, GLenum, GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:9578
+glSetInvariantEXT = _link_function('glSetInvariantEXT', None, [GLuint, GLenum, POINTER(GLvoid)], 'EXT_vertex_shader')
+
+# GL/glext.h:9579
+glSetLocalConstantEXT = _link_function('glSetLocalConstantEXT', None, [GLuint, GLenum, POINTER(GLvoid)], 'EXT_vertex_shader')
+
+# GL/glext.h:9580
+glVariantbvEXT = _link_function('glVariantbvEXT', None, [GLuint, POINTER(GLbyte)], 'EXT_vertex_shader')
+
+# GL/glext.h:9581
+glVariantsvEXT = _link_function('glVariantsvEXT', None, [GLuint, POINTER(GLshort)], 'EXT_vertex_shader')
+
+# GL/glext.h:9582
+glVariantivEXT = _link_function('glVariantivEXT', None, [GLuint, POINTER(GLint)], 'EXT_vertex_shader')
+
+# GL/glext.h:9583
+glVariantfvEXT = _link_function('glVariantfvEXT', None, [GLuint, POINTER(GLfloat)], 'EXT_vertex_shader')
+
+# GL/glext.h:9584
+glVariantdvEXT = _link_function('glVariantdvEXT', None, [GLuint, POINTER(GLdouble)], 'EXT_vertex_shader')
+
+# GL/glext.h:9585
+glVariantubvEXT = _link_function('glVariantubvEXT', None, [GLuint, POINTER(GLubyte)], 'EXT_vertex_shader')
+
+# GL/glext.h:9586
+glVariantusvEXT = _link_function('glVariantusvEXT', None, [GLuint, POINTER(GLushort)], 'EXT_vertex_shader')
+
+# GL/glext.h:9587
+glVariantuivEXT = _link_function('glVariantuivEXT', None, [GLuint, POINTER(GLuint)], 'EXT_vertex_shader')
+
+# GL/glext.h:9588
+glVariantPointerEXT = _link_function('glVariantPointerEXT', None, [GLuint, GLenum, GLuint, POINTER(GLvoid)], 'EXT_vertex_shader')
+
+# GL/glext.h:9589
+glEnableVariantClientStateEXT = _link_function('glEnableVariantClientStateEXT', None, [GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:9590
+glDisableVariantClientStateEXT = _link_function('glDisableVariantClientStateEXT', None, [GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:9591
+glBindLightParameterEXT = _link_function('glBindLightParameterEXT', GLuint, [GLenum, GLenum], 'EXT_vertex_shader')
+
+# GL/glext.h:9592
+glBindMaterialParameterEXT = _link_function('glBindMaterialParameterEXT', GLuint, [GLenum, GLenum], 'EXT_vertex_shader')
+
+# GL/glext.h:9593
+glBindTexGenParameterEXT = _link_function('glBindTexGenParameterEXT', GLuint, [GLenum, GLenum, GLenum], 'EXT_vertex_shader')
+
+# GL/glext.h:9594
+glBindTextureUnitParameterEXT = _link_function('glBindTextureUnitParameterEXT', GLuint, [GLenum, GLenum], 'EXT_vertex_shader')
+
+# GL/glext.h:9595
+glBindParameterEXT = _link_function('glBindParameterEXT', GLuint, [GLenum], 'EXT_vertex_shader')
+
+# GL/glext.h:9596
+glIsVariantEnabledEXT = _link_function('glIsVariantEnabledEXT', GLboolean, [GLuint, GLenum], 'EXT_vertex_shader')
+
+# GL/glext.h:9597
+glGetVariantBooleanvEXT = _link_function('glGetVariantBooleanvEXT', None, [GLuint, GLenum, POINTER(GLboolean)], 'EXT_vertex_shader')
+
+# GL/glext.h:9598
+glGetVariantIntegervEXT = _link_function('glGetVariantIntegervEXT', None, [GLuint, GLenum, POINTER(GLint)], 'EXT_vertex_shader')
+
+# GL/glext.h:9599
+glGetVariantFloatvEXT = _link_function('glGetVariantFloatvEXT', None, [GLuint, GLenum, POINTER(GLfloat)], 'EXT_vertex_shader')
+
+# GL/glext.h:9600
+glGetVariantPointervEXT = _link_function('glGetVariantPointervEXT', None, [GLuint, GLenum, POINTER(POINTER(GLvoid))], 'EXT_vertex_shader')
+
+# GL/glext.h:9601
+glGetInvariantBooleanvEXT = _link_function('glGetInvariantBooleanvEXT', None, [GLuint, GLenum, POINTER(GLboolean)], 'EXT_vertex_shader')
+
+# GL/glext.h:9602
+glGetInvariantIntegervEXT = _link_function('glGetInvariantIntegervEXT', None, [GLuint, GLenum, POINTER(GLint)], 'EXT_vertex_shader')
+
+# GL/glext.h:9603
+glGetInvariantFloatvEXT = _link_function('glGetInvariantFloatvEXT', None, [GLuint, GLenum, POINTER(GLfloat)], 'EXT_vertex_shader')
+
+# GL/glext.h:9604
+glGetLocalConstantBooleanvEXT = _link_function('glGetLocalConstantBooleanvEXT', None, [GLuint, GLenum, POINTER(GLboolean)], 'EXT_vertex_shader')
+
+# GL/glext.h:9605
+glGetLocalConstantIntegervEXT = _link_function('glGetLocalConstantIntegervEXT', None, [GLuint, GLenum, POINTER(GLint)], 'EXT_vertex_shader')
+
+# GL/glext.h:9606
+glGetLocalConstantFloatvEXT = _link_function('glGetLocalConstantFloatvEXT', None, [GLuint, GLenum, POINTER(GLfloat)], 'EXT_vertex_shader')
+
+PFNGLBEGINVERTEXSHADEREXTPROC = CFUNCTYPE(None) # GL/glext.h:9608
+PFNGLENDVERTEXSHADEREXTPROC = CFUNCTYPE(None) # GL/glext.h:9609
+PFNGLBINDVERTEXSHADEREXTPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:9610
+PFNGLGENVERTEXSHADERSEXTPROC = CFUNCTYPE(GLuint, GLuint) # GL/glext.h:9611
+PFNGLDELETEVERTEXSHADEREXTPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:9612
+PFNGLSHADEROP1EXTPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint) # GL/glext.h:9613
+PFNGLSHADEROP2EXTPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint) # GL/glext.h:9614
+PFNGLSHADEROP3EXTPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:9615
+PFNGLSWIZZLEEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:9616
+PFNGLWRITEMASKEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:9617
+PFNGLINSERTCOMPONENTEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint) # GL/glext.h:9618
+PFNGLEXTRACTCOMPONENTEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint) # GL/glext.h:9619
+PFNGLGENSYMBOLSEXTPROC = CFUNCTYPE(GLuint, GLenum, GLenum, GLenum, GLuint) # GL/glext.h:9620
+PFNGLSETINVARIANTEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLvoid)) # GL/glext.h:9621
+PFNGLSETLOCALCONSTANTEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLvoid)) # GL/glext.h:9622
+PFNGLVARIANTBVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLbyte)) # GL/glext.h:9623
+PFNGLVARIANTSVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:9624
+PFNGLVARIANTIVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:9625
+PFNGLVARIANTFVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:9626
+PFNGLVARIANTDVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:9627
+PFNGLVARIANTUBVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLubyte)) # GL/glext.h:9628
+PFNGLVARIANTUSVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLushort)) # GL/glext.h:9629
+PFNGLVARIANTUIVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:9630
+PFNGLVARIANTPOINTEREXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, POINTER(GLvoid)) # GL/glext.h:9631
+PFNGLENABLEVARIANTCLIENTSTATEEXTPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:9632
+PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:9633
+PFNGLBINDLIGHTPARAMETEREXTPROC = CFUNCTYPE(GLuint, GLenum, GLenum) # GL/glext.h:9634
+PFNGLBINDMATERIALPARAMETEREXTPROC = CFUNCTYPE(GLuint, GLenum, GLenum) # GL/glext.h:9635
+PFNGLBINDTEXGENPARAMETEREXTPROC = CFUNCTYPE(GLuint, GLenum, GLenum, GLenum) # GL/glext.h:9636
+PFNGLBINDTEXTUREUNITPARAMETEREXTPROC = CFUNCTYPE(GLuint, GLenum, GLenum) # GL/glext.h:9637
+PFNGLBINDPARAMETEREXTPROC = CFUNCTYPE(GLuint, GLenum) # GL/glext.h:9638
+PFNGLISVARIANTENABLEDEXTPROC = CFUNCTYPE(GLboolean, GLuint, GLenum) # GL/glext.h:9639
+PFNGLGETVARIANTBOOLEANVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLboolean)) # GL/glext.h:9640
+PFNGLGETVARIANTINTEGERVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:9641
+PFNGLGETVARIANTFLOATVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:9642
+PFNGLGETVARIANTPOINTERVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:9643
+PFNGLGETINVARIANTBOOLEANVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLboolean)) # GL/glext.h:9644
+PFNGLGETINVARIANTINTEGERVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:9645
+PFNGLGETINVARIANTFLOATVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:9646
+PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLboolean)) # GL/glext.h:9647
+PFNGLGETLOCALCONSTANTINTEGERVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:9648
+PFNGLGETLOCALCONSTANTFLOATVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:9649
+# ATI_vertex_streams (GL/glext.h:9652)
+GL_ATI_vertex_streams = 1 # GL/glext.h:9653
+# GL/glext.h:9655
+glVertexStream1sATI = _link_function('glVertexStream1sATI', None, [GLenum, GLshort], 'ATI_vertex_streams')
+
+# GL/glext.h:9656
+glVertexStream1svATI = _link_function('glVertexStream1svATI', None, [GLenum, POINTER(GLshort)], 'ATI_vertex_streams')
+
+# GL/glext.h:9657
+glVertexStream1iATI = _link_function('glVertexStream1iATI', None, [GLenum, GLint], 'ATI_vertex_streams')
+
+# GL/glext.h:9658
+glVertexStream1ivATI = _link_function('glVertexStream1ivATI', None, [GLenum, POINTER(GLint)], 'ATI_vertex_streams')
+
+# GL/glext.h:9659
+glVertexStream1fATI = _link_function('glVertexStream1fATI', None, [GLenum, GLfloat], 'ATI_vertex_streams')
+
+# GL/glext.h:9660
+glVertexStream1fvATI = _link_function('glVertexStream1fvATI', None, [GLenum, POINTER(GLfloat)], 'ATI_vertex_streams')
+
+# GL/glext.h:9661
+glVertexStream1dATI = _link_function('glVertexStream1dATI', None, [GLenum, GLdouble], 'ATI_vertex_streams')
+
+# GL/glext.h:9662
+glVertexStream1dvATI = _link_function('glVertexStream1dvATI', None, [GLenum, POINTER(GLdouble)], 'ATI_vertex_streams')
+
+# GL/glext.h:9663
+glVertexStream2sATI = _link_function('glVertexStream2sATI', None, [GLenum, GLshort, GLshort], 'ATI_vertex_streams')
+
+# GL/glext.h:9664
+glVertexStream2svATI = _link_function('glVertexStream2svATI', None, [GLenum, POINTER(GLshort)], 'ATI_vertex_streams')
+
+# GL/glext.h:9665
+glVertexStream2iATI = _link_function('glVertexStream2iATI', None, [GLenum, GLint, GLint], 'ATI_vertex_streams')
+
+# GL/glext.h:9666
+glVertexStream2ivATI = _link_function('glVertexStream2ivATI', None, [GLenum, POINTER(GLint)], 'ATI_vertex_streams')
+
+# GL/glext.h:9667
+glVertexStream2fATI = _link_function('glVertexStream2fATI', None, [GLenum, GLfloat, GLfloat], 'ATI_vertex_streams')
+
+# GL/glext.h:9668
+glVertexStream2fvATI = _link_function('glVertexStream2fvATI', None, [GLenum, POINTER(GLfloat)], 'ATI_vertex_streams')
+
+# GL/glext.h:9669
+glVertexStream2dATI = _link_function('glVertexStream2dATI', None, [GLenum, GLdouble, GLdouble], 'ATI_vertex_streams')
+
+# GL/glext.h:9670
+glVertexStream2dvATI = _link_function('glVertexStream2dvATI', None, [GLenum, POINTER(GLdouble)], 'ATI_vertex_streams')
+
+# GL/glext.h:9671
+glVertexStream3sATI = _link_function('glVertexStream3sATI', None, [GLenum, GLshort, GLshort, GLshort], 'ATI_vertex_streams')
+
+# GL/glext.h:9672
+glVertexStream3svATI = _link_function('glVertexStream3svATI', None, [GLenum, POINTER(GLshort)], 'ATI_vertex_streams')
+
+# GL/glext.h:9673
+glVertexStream3iATI = _link_function('glVertexStream3iATI', None, [GLenum, GLint, GLint, GLint], 'ATI_vertex_streams')
+
+# GL/glext.h:9674
+glVertexStream3ivATI = _link_function('glVertexStream3ivATI', None, [GLenum, POINTER(GLint)], 'ATI_vertex_streams')
+
+# GL/glext.h:9675
+glVertexStream3fATI = _link_function('glVertexStream3fATI', None, [GLenum, GLfloat, GLfloat, GLfloat], 'ATI_vertex_streams')
+
+# GL/glext.h:9676
+glVertexStream3fvATI = _link_function('glVertexStream3fvATI', None, [GLenum, POINTER(GLfloat)], 'ATI_vertex_streams')
+
+# GL/glext.h:9677
+glVertexStream3dATI = _link_function('glVertexStream3dATI', None, [GLenum, GLdouble, GLdouble, GLdouble], 'ATI_vertex_streams')
+
+# GL/glext.h:9678
+glVertexStream3dvATI = _link_function('glVertexStream3dvATI', None, [GLenum, POINTER(GLdouble)], 'ATI_vertex_streams')
+
+# GL/glext.h:9679
+glVertexStream4sATI = _link_function('glVertexStream4sATI', None, [GLenum, GLshort, GLshort, GLshort, GLshort], 'ATI_vertex_streams')
+
+# GL/glext.h:9680
+glVertexStream4svATI = _link_function('glVertexStream4svATI', None, [GLenum, POINTER(GLshort)], 'ATI_vertex_streams')
+
+# GL/glext.h:9681
+glVertexStream4iATI = _link_function('glVertexStream4iATI', None, [GLenum, GLint, GLint, GLint, GLint], 'ATI_vertex_streams')
+
+# GL/glext.h:9682
+glVertexStream4ivATI = _link_function('glVertexStream4ivATI', None, [GLenum, POINTER(GLint)], 'ATI_vertex_streams')
+
+# GL/glext.h:9683
+glVertexStream4fATI = _link_function('glVertexStream4fATI', None, [GLenum, GLfloat, GLfloat, GLfloat, GLfloat], 'ATI_vertex_streams')
+
+# GL/glext.h:9684
+glVertexStream4fvATI = _link_function('glVertexStream4fvATI', None, [GLenum, POINTER(GLfloat)], 'ATI_vertex_streams')
+
+# GL/glext.h:9685
+glVertexStream4dATI = _link_function('glVertexStream4dATI', None, [GLenum, GLdouble, GLdouble, GLdouble, GLdouble], 'ATI_vertex_streams')
+
+# GL/glext.h:9686
+glVertexStream4dvATI = _link_function('glVertexStream4dvATI', None, [GLenum, POINTER(GLdouble)], 'ATI_vertex_streams')
+
+# GL/glext.h:9687
+glNormalStream3bATI = _link_function('glNormalStream3bATI', None, [GLenum, GLbyte, GLbyte, GLbyte], 'ATI_vertex_streams')
+
+# GL/glext.h:9688
+glNormalStream3bvATI = _link_function('glNormalStream3bvATI', None, [GLenum, POINTER(GLbyte)], 'ATI_vertex_streams')
+
+# GL/glext.h:9689
+glNormalStream3sATI = _link_function('glNormalStream3sATI', None, [GLenum, GLshort, GLshort, GLshort], 'ATI_vertex_streams')
+
+# GL/glext.h:9690
+glNormalStream3svATI = _link_function('glNormalStream3svATI', None, [GLenum, POINTER(GLshort)], 'ATI_vertex_streams')
+
+# GL/glext.h:9691
+glNormalStream3iATI = _link_function('glNormalStream3iATI', None, [GLenum, GLint, GLint, GLint], 'ATI_vertex_streams')
+
+# GL/glext.h:9692
+glNormalStream3ivATI = _link_function('glNormalStream3ivATI', None, [GLenum, POINTER(GLint)], 'ATI_vertex_streams')
+
+# GL/glext.h:9693
+glNormalStream3fATI = _link_function('glNormalStream3fATI', None, [GLenum, GLfloat, GLfloat, GLfloat], 'ATI_vertex_streams')
+
+# GL/glext.h:9694
+glNormalStream3fvATI = _link_function('glNormalStream3fvATI', None, [GLenum, POINTER(GLfloat)], 'ATI_vertex_streams')
+
+# GL/glext.h:9695
+glNormalStream3dATI = _link_function('glNormalStream3dATI', None, [GLenum, GLdouble, GLdouble, GLdouble], 'ATI_vertex_streams')
+
+# GL/glext.h:9696
+glNormalStream3dvATI = _link_function('glNormalStream3dvATI', None, [GLenum, POINTER(GLdouble)], 'ATI_vertex_streams')
+
+# GL/glext.h:9697
+glClientActiveVertexStreamATI = _link_function('glClientActiveVertexStreamATI', None, [GLenum], 'ATI_vertex_streams')
+
+# GL/glext.h:9698
+glVertexBlendEnviATI = _link_function('glVertexBlendEnviATI', None, [GLenum, GLint], 'ATI_vertex_streams')
+
+# GL/glext.h:9699
+glVertexBlendEnvfATI = _link_function('glVertexBlendEnvfATI', None, [GLenum, GLfloat], 'ATI_vertex_streams')
+
+PFNGLVERTEXSTREAM1SATIPROC = CFUNCTYPE(None, GLenum, GLshort) # GL/glext.h:9701
+PFNGLVERTEXSTREAM1SVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLshort)) # GL/glext.h:9702
+PFNGLVERTEXSTREAM1IATIPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:9703
+PFNGLVERTEXSTREAM1IVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:9704
+PFNGLVERTEXSTREAM1FATIPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:9705
+PFNGLVERTEXSTREAM1FVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:9706
+PFNGLVERTEXSTREAM1DATIPROC = CFUNCTYPE(None, GLenum, GLdouble) # GL/glext.h:9707
+PFNGLVERTEXSTREAM1DVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:9708
+PFNGLVERTEXSTREAM2SATIPROC = CFUNCTYPE(None, GLenum, GLshort, GLshort) # GL/glext.h:9709
+PFNGLVERTEXSTREAM2SVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLshort)) # GL/glext.h:9710
+PFNGLVERTEXSTREAM2IATIPROC = CFUNCTYPE(None, GLenum, GLint, GLint) # GL/glext.h:9711
+PFNGLVERTEXSTREAM2IVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:9712
+PFNGLVERTEXSTREAM2FATIPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat) # GL/glext.h:9713
+PFNGLVERTEXSTREAM2FVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:9714
+PFNGLVERTEXSTREAM2DATIPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble) # GL/glext.h:9715
+PFNGLVERTEXSTREAM2DVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:9716
+PFNGLVERTEXSTREAM3SATIPROC = CFUNCTYPE(None, GLenum, GLshort, GLshort, GLshort) # GL/glext.h:9717
+PFNGLVERTEXSTREAM3SVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLshort)) # GL/glext.h:9718
+PFNGLVERTEXSTREAM3IATIPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint) # GL/glext.h:9719
+PFNGLVERTEXSTREAM3IVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:9720
+PFNGLVERTEXSTREAM3FATIPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat, GLfloat) # GL/glext.h:9721
+PFNGLVERTEXSTREAM3FVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:9722
+PFNGLVERTEXSTREAM3DATIPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble) # GL/glext.h:9723
+PFNGLVERTEXSTREAM3DVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:9724
+PFNGLVERTEXSTREAM4SATIPROC = CFUNCTYPE(None, GLenum, GLshort, GLshort, GLshort, GLshort) # GL/glext.h:9725
+PFNGLVERTEXSTREAM4SVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLshort)) # GL/glext.h:9726
+PFNGLVERTEXSTREAM4IATIPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLint) # GL/glext.h:9727
+PFNGLVERTEXSTREAM4IVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:9728
+PFNGLVERTEXSTREAM4FATIPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:9729
+PFNGLVERTEXSTREAM4FVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:9730
+PFNGLVERTEXSTREAM4DATIPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:9731
+PFNGLVERTEXSTREAM4DVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:9732
+PFNGLNORMALSTREAM3BATIPROC = CFUNCTYPE(None, GLenum, GLbyte, GLbyte, GLbyte) # GL/glext.h:9733
+PFNGLNORMALSTREAM3BVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLbyte)) # GL/glext.h:9734
+PFNGLNORMALSTREAM3SATIPROC = CFUNCTYPE(None, GLenum, GLshort, GLshort, GLshort) # GL/glext.h:9735
+PFNGLNORMALSTREAM3SVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLshort)) # GL/glext.h:9736
+PFNGLNORMALSTREAM3IATIPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint) # GL/glext.h:9737
+PFNGLNORMALSTREAM3IVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:9738
+PFNGLNORMALSTREAM3FATIPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat, GLfloat) # GL/glext.h:9739
+PFNGLNORMALSTREAM3FVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:9740
+PFNGLNORMALSTREAM3DATIPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble) # GL/glext.h:9741
+PFNGLNORMALSTREAM3DVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:9742
+PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:9743
+PFNGLVERTEXBLENDENVIATIPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:9744
+PFNGLVERTEXBLENDENVFATIPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:9745
+# ATI_element_array (GL/glext.h:9748)
+GL_ATI_element_array = 1 # GL/glext.h:9749
+# GL/glext.h:9751
+glElementPointerATI = _link_function('glElementPointerATI', None, [GLenum, POINTER(GLvoid)], 'ATI_element_array')
+
+# GL/glext.h:9752
+glDrawElementArrayATI = _link_function('glDrawElementArrayATI', None, [GLenum, GLsizei], 'ATI_element_array')
+
+# GL/glext.h:9753
+glDrawRangeElementArrayATI = _link_function('glDrawRangeElementArrayATI', None, [GLenum, GLuint, GLuint, GLsizei], 'ATI_element_array')
+
+PFNGLELEMENTPOINTERATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLvoid)) # GL/glext.h:9755
+PFNGLDRAWELEMENTARRAYATIPROC = CFUNCTYPE(None, GLenum, GLsizei) # GL/glext.h:9756
+PFNGLDRAWRANGEELEMENTARRAYATIPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLsizei) # GL/glext.h:9757
+# SUN_mesh_array (GL/glext.h:9760)
+GL_SUN_mesh_array = 1 # GL/glext.h:9761
+# GL/glext.h:9763
+glDrawMeshArraysSUN = _link_function('glDrawMeshArraysSUN', None, [GLenum, GLint, GLsizei, GLsizei], 'SUN_mesh_array')
+
+PFNGLDRAWMESHARRAYSSUNPROC = CFUNCTYPE(None, GLenum, GLint, GLsizei, GLsizei) # GL/glext.h:9765
+# SUN_slice_accum (GL/glext.h:9768)
+GL_SUN_slice_accum = 1 # GL/glext.h:9769
+# NV_multisample_filter_hint (GL/glext.h:9772)
+GL_NV_multisample_filter_hint = 1 # GL/glext.h:9773
+# NV_depth_clamp (GL/glext.h:9776)
+GL_NV_depth_clamp = 1 # GL/glext.h:9777
+# NV_occlusion_query (GL/glext.h:9780)
+GL_NV_occlusion_query = 1 # GL/glext.h:9781
+# GL/glext.h:9783
+glGenOcclusionQueriesNV = _link_function('glGenOcclusionQueriesNV', None, [GLsizei, POINTER(GLuint)], 'NV_occlusion_query')
+
+# GL/glext.h:9784
+glDeleteOcclusionQueriesNV = _link_function('glDeleteOcclusionQueriesNV', None, [GLsizei, POINTER(GLuint)], 'NV_occlusion_query')
+
+# GL/glext.h:9785
+glIsOcclusionQueryNV = _link_function('glIsOcclusionQueryNV', GLboolean, [GLuint], 'NV_occlusion_query')
+
+# GL/glext.h:9786
+glBeginOcclusionQueryNV = _link_function('glBeginOcclusionQueryNV', None, [GLuint], 'NV_occlusion_query')
+
+# GL/glext.h:9787
+glEndOcclusionQueryNV = _link_function('glEndOcclusionQueryNV', None, [], 'NV_occlusion_query')
+
+# GL/glext.h:9788
+glGetOcclusionQueryivNV = _link_function('glGetOcclusionQueryivNV', None, [GLuint, GLenum, POINTER(GLint)], 'NV_occlusion_query')
+
+# GL/glext.h:9789
+glGetOcclusionQueryuivNV = _link_function('glGetOcclusionQueryuivNV', None, [GLuint, GLenum, POINTER(GLuint)], 'NV_occlusion_query')
+
+PFNGLGENOCCLUSIONQUERIESNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:9791
+PFNGLDELETEOCCLUSIONQUERIESNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:9792
+PFNGLISOCCLUSIONQUERYNVPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:9793
+PFNGLBEGINOCCLUSIONQUERYNVPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:9794
+PFNGLENDOCCLUSIONQUERYNVPROC = CFUNCTYPE(None) # GL/glext.h:9795
+PFNGLGETOCCLUSIONQUERYIVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:9796
+PFNGLGETOCCLUSIONQUERYUIVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint)) # GL/glext.h:9797
+# NV_point_sprite (GL/glext.h:9800)
+GL_NV_point_sprite = 1 # GL/glext.h:9801
+# GL/glext.h:9803
+glPointParameteriNV = _link_function('glPointParameteriNV', None, [GLenum, GLint], 'NV_point_sprite')
+
+# GL/glext.h:9804
+glPointParameterivNV = _link_function('glPointParameterivNV', None, [GLenum, POINTER(GLint)], 'NV_point_sprite')
+
+PFNGLPOINTPARAMETERINVPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:9806
+PFNGLPOINTPARAMETERIVNVPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:9807
+# NV_texture_shader3 (GL/glext.h:9810)
+GL_NV_texture_shader3 = 1 # GL/glext.h:9811
+# NV_vertex_program1_1 (GL/glext.h:9814)
+GL_NV_vertex_program1_1 = 1 # GL/glext.h:9815
+# EXT_shadow_funcs (GL/glext.h:9818)
+GL_EXT_shadow_funcs = 1 # GL/glext.h:9819
+# EXT_stencil_two_side (GL/glext.h:9822)
+GL_EXT_stencil_two_side = 1 # GL/glext.h:9823
+# GL/glext.h:9825
+glActiveStencilFaceEXT = _link_function('glActiveStencilFaceEXT', None, [GLenum], 'EXT_stencil_two_side')
+
+PFNGLACTIVESTENCILFACEEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:9827
+# ATI_text_fragment_shader (GL/glext.h:9830)
+GL_ATI_text_fragment_shader = 1 # GL/glext.h:9831
+# APPLE_client_storage (GL/glext.h:9834)
+GL_APPLE_client_storage = 1 # GL/glext.h:9835
+# APPLE_element_array (GL/glext.h:9838)
+GL_APPLE_element_array = 1 # GL/glext.h:9839
+# GL/glext.h:9841
+glElementPointerAPPLE = _link_function('glElementPointerAPPLE', None, [GLenum, POINTER(GLvoid)], 'APPLE_element_array')
+
+# GL/glext.h:9842
+glDrawElementArrayAPPLE = _link_function('glDrawElementArrayAPPLE', None, [GLenum, GLint, GLsizei], 'APPLE_element_array')
+
+# GL/glext.h:9843
+glDrawRangeElementArrayAPPLE = _link_function('glDrawRangeElementArrayAPPLE', None, [GLenum, GLuint, GLuint, GLint, GLsizei], 'APPLE_element_array')
+
+# GL/glext.h:9844
+glMultiDrawElementArrayAPPLE = _link_function('glMultiDrawElementArrayAPPLE', None, [GLenum, POINTER(GLint), POINTER(GLsizei), GLsizei], 'APPLE_element_array')
+
+# GL/glext.h:9845
+glMultiDrawRangeElementArrayAPPLE = _link_function('glMultiDrawRangeElementArrayAPPLE', None, [GLenum, GLuint, GLuint, POINTER(GLint), POINTER(GLsizei), GLsizei], 'APPLE_element_array')
+
+PFNGLELEMENTPOINTERAPPLEPROC = CFUNCTYPE(None, GLenum, POINTER(GLvoid)) # GL/glext.h:9847
+PFNGLDRAWELEMENTARRAYAPPLEPROC = CFUNCTYPE(None, GLenum, GLint, GLsizei) # GL/glext.h:9848
+PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLint, GLsizei) # GL/glext.h:9849
+PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC = CFUNCTYPE(None, GLenum, POINTER(GLint), POINTER(GLsizei), GLsizei) # GL/glext.h:9850
+PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, POINTER(GLint), POINTER(GLsizei), GLsizei) # GL/glext.h:9851
+# APPLE_fence (GL/glext.h:9854)
+GL_APPLE_fence = 1 # GL/glext.h:9855
+# GL/glext.h:9857
+glGenFencesAPPLE = _link_function('glGenFencesAPPLE', None, [GLsizei, POINTER(GLuint)], 'APPLE_fence')
+
+# GL/glext.h:9858
+glDeleteFencesAPPLE = _link_function('glDeleteFencesAPPLE', None, [GLsizei, POINTER(GLuint)], 'APPLE_fence')
+
+# GL/glext.h:9859
+glSetFenceAPPLE = _link_function('glSetFenceAPPLE', None, [GLuint], 'APPLE_fence')
+
+# GL/glext.h:9860
+glIsFenceAPPLE = _link_function('glIsFenceAPPLE', GLboolean, [GLuint], 'APPLE_fence')
+
+# GL/glext.h:9861
+glTestFenceAPPLE = _link_function('glTestFenceAPPLE', GLboolean, [GLuint], 'APPLE_fence')
+
+# GL/glext.h:9862
+glFinishFenceAPPLE = _link_function('glFinishFenceAPPLE', None, [GLuint], 'APPLE_fence')
+
+# GL/glext.h:9863
+glTestObjectAPPLE = _link_function('glTestObjectAPPLE', GLboolean, [GLenum, GLuint], 'APPLE_fence')
+
+# GL/glext.h:9864
+glFinishObjectAPPLE = _link_function('glFinishObjectAPPLE', None, [GLenum, GLint], 'APPLE_fence')
+
+PFNGLGENFENCESAPPLEPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:9866
+PFNGLDELETEFENCESAPPLEPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:9867
+PFNGLSETFENCEAPPLEPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:9868
+PFNGLISFENCEAPPLEPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:9869
+PFNGLTESTFENCEAPPLEPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:9870
+PFNGLFINISHFENCEAPPLEPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:9871
+PFNGLTESTOBJECTAPPLEPROC = CFUNCTYPE(GLboolean, GLenum, GLuint) # GL/glext.h:9872
+PFNGLFINISHOBJECTAPPLEPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:9873
+# APPLE_vertex_array_object (GL/glext.h:9876)
+GL_APPLE_vertex_array_object = 1 # GL/glext.h:9877
+# GL/glext.h:9879
+glBindVertexArrayAPPLE = _link_function('glBindVertexArrayAPPLE', None, [GLuint], 'APPLE_vertex_array_object')
+
+# GL/glext.h:9880
+glDeleteVertexArraysAPPLE = _link_function('glDeleteVertexArraysAPPLE', None, [GLsizei, POINTER(GLuint)], 'APPLE_vertex_array_object')
+
+# GL/glext.h:9881
+glGenVertexArraysAPPLE = _link_function('glGenVertexArraysAPPLE', None, [GLsizei, POINTER(GLuint)], 'APPLE_vertex_array_object')
+
+# GL/glext.h:9882
+glIsVertexArrayAPPLE = _link_function('glIsVertexArrayAPPLE', GLboolean, [GLuint], 'APPLE_vertex_array_object')
+
+PFNGLBINDVERTEXARRAYAPPLEPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:9884
+PFNGLDELETEVERTEXARRAYSAPPLEPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:9885
+PFNGLGENVERTEXARRAYSAPPLEPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:9886
+PFNGLISVERTEXARRAYAPPLEPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:9887
+# APPLE_vertex_array_range (GL/glext.h:9890)
+GL_APPLE_vertex_array_range = 1 # GL/glext.h:9891
+# GL/glext.h:9893
+glVertexArrayRangeAPPLE = _link_function('glVertexArrayRangeAPPLE', None, [GLsizei, POINTER(GLvoid)], 'APPLE_vertex_array_range')
+
+# GL/glext.h:9894
+glFlushVertexArrayRangeAPPLE = _link_function('glFlushVertexArrayRangeAPPLE', None, [GLsizei, POINTER(GLvoid)], 'APPLE_vertex_array_range')
+
+# GL/glext.h:9895
+glVertexArrayParameteriAPPLE = _link_function('glVertexArrayParameteriAPPLE', None, [GLenum, GLint], 'APPLE_vertex_array_range')
+
+PFNGLVERTEXARRAYRANGEAPPLEPROC = CFUNCTYPE(None, GLsizei, POINTER(GLvoid)) # GL/glext.h:9897
+PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC = CFUNCTYPE(None, GLsizei, POINTER(GLvoid)) # GL/glext.h:9898
+PFNGLVERTEXARRAYPARAMETERIAPPLEPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:9899
+# APPLE_ycbcr_422 (GL/glext.h:9902)
+GL_APPLE_ycbcr_422 = 1 # GL/glext.h:9903
+# S3_s3tc (GL/glext.h:9906)
+GL_S3_s3tc = 1 # GL/glext.h:9907
+# ATI_draw_buffers (GL/glext.h:9910)
+GL_ATI_draw_buffers = 1 # GL/glext.h:9911
+# GL/glext.h:9913
+glDrawBuffersATI = _link_function('glDrawBuffersATI', None, [GLsizei, POINTER(GLenum)], 'ATI_draw_buffers')
+
+PFNGLDRAWBUFFERSATIPROC = CFUNCTYPE(None, GLsizei, POINTER(GLenum)) # GL/glext.h:9915
+# ATI_pixel_format_float (GL/glext.h:9918)
+GL_ATI_pixel_format_float = 1 # GL/glext.h:9919
+# ATI_texture_env_combine3 (GL/glext.h:9925)
+GL_ATI_texture_env_combine3 = 1 # GL/glext.h:9926
+# ATI_texture_float (GL/glext.h:9929)
+GL_ATI_texture_float = 1 # GL/glext.h:9930
+# NV_float_buffer (GL/glext.h:9933)
+GL_NV_float_buffer = 1 # GL/glext.h:9934
+# NV_fragment_program (GL/glext.h:9937)
+GL_NV_fragment_program = 1 # GL/glext.h:9938
+# GL/glext.h:9941
+glProgramNamedParameter4fNV = _link_function('glProgramNamedParameter4fNV', None, [GLuint, GLsizei, POINTER(GLubyte), GLfloat, GLfloat, GLfloat, GLfloat], 'NV_fragment_program')
+
+# GL/glext.h:9942
+glProgramNamedParameter4dNV = _link_function('glProgramNamedParameter4dNV', None, [GLuint, GLsizei, POINTER(GLubyte), GLdouble, GLdouble, GLdouble, GLdouble], 'NV_fragment_program')
+
+# GL/glext.h:9943
+glProgramNamedParameter4fvNV = _link_function('glProgramNamedParameter4fvNV', None, [GLuint, GLsizei, POINTER(GLubyte), POINTER(GLfloat)], 'NV_fragment_program')
+
+# GL/glext.h:9944
+glProgramNamedParameter4dvNV = _link_function('glProgramNamedParameter4dvNV', None, [GLuint, GLsizei, POINTER(GLubyte), POINTER(GLdouble)], 'NV_fragment_program')
+
+# GL/glext.h:9945
+glGetProgramNamedParameterfvNV = _link_function('glGetProgramNamedParameterfvNV', None, [GLuint, GLsizei, POINTER(GLubyte), POINTER(GLfloat)], 'NV_fragment_program')
+
+# GL/glext.h:9946
+glGetProgramNamedParameterdvNV = _link_function('glGetProgramNamedParameterdvNV', None, [GLuint, GLsizei, POINTER(GLubyte), POINTER(GLdouble)], 'NV_fragment_program')
+
+PFNGLPROGRAMNAMEDPARAMETER4FNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLubyte), GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:9948
+PFNGLPROGRAMNAMEDPARAMETER4DNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLubyte), GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:9949
+PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLubyte), POINTER(GLfloat)) # GL/glext.h:9950
+PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLubyte), POINTER(GLdouble)) # GL/glext.h:9951
+PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLubyte), POINTER(GLfloat)) # GL/glext.h:9952
+PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLubyte), POINTER(GLdouble)) # GL/glext.h:9953
+# NV_half_float (GL/glext.h:9956)
+GL_NV_half_float = 1 # GL/glext.h:9957
+# GL/glext.h:9959
+glVertex2hNV = _link_function('glVertex2hNV', None, [GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9960
+glVertex2hvNV = _link_function('glVertex2hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9961
+glVertex3hNV = _link_function('glVertex3hNV', None, [GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9962
+glVertex3hvNV = _link_function('glVertex3hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9963
+glVertex4hNV = _link_function('glVertex4hNV', None, [GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9964
+glVertex4hvNV = _link_function('glVertex4hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9965
+glNormal3hNV = _link_function('glNormal3hNV', None, [GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9966
+glNormal3hvNV = _link_function('glNormal3hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9967
+glColor3hNV = _link_function('glColor3hNV', None, [GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9968
+glColor3hvNV = _link_function('glColor3hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9969
+glColor4hNV = _link_function('glColor4hNV', None, [GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9970
+glColor4hvNV = _link_function('glColor4hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9971
+glTexCoord1hNV = _link_function('glTexCoord1hNV', None, [GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9972
+glTexCoord1hvNV = _link_function('glTexCoord1hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9973
+glTexCoord2hNV = _link_function('glTexCoord2hNV', None, [GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9974
+glTexCoord2hvNV = _link_function('glTexCoord2hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9975
+glTexCoord3hNV = _link_function('glTexCoord3hNV', None, [GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9976
+glTexCoord3hvNV = _link_function('glTexCoord3hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9977
+glTexCoord4hNV = _link_function('glTexCoord4hNV', None, [GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9978
+glTexCoord4hvNV = _link_function('glTexCoord4hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9979
+glMultiTexCoord1hNV = _link_function('glMultiTexCoord1hNV', None, [GLenum, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9980
+glMultiTexCoord1hvNV = _link_function('glMultiTexCoord1hvNV', None, [GLenum, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9981
+glMultiTexCoord2hNV = _link_function('glMultiTexCoord2hNV', None, [GLenum, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9982
+glMultiTexCoord2hvNV = _link_function('glMultiTexCoord2hvNV', None, [GLenum, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9983
+glMultiTexCoord3hNV = _link_function('glMultiTexCoord3hNV', None, [GLenum, GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9984
+glMultiTexCoord3hvNV = _link_function('glMultiTexCoord3hvNV', None, [GLenum, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9985
+glMultiTexCoord4hNV = _link_function('glMultiTexCoord4hNV', None, [GLenum, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9986
+glMultiTexCoord4hvNV = _link_function('glMultiTexCoord4hvNV', None, [GLenum, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9987
+glFogCoordhNV = _link_function('glFogCoordhNV', None, [GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9988
+glFogCoordhvNV = _link_function('glFogCoordhvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9989
+glSecondaryColor3hNV = _link_function('glSecondaryColor3hNV', None, [GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9990
+glSecondaryColor3hvNV = _link_function('glSecondaryColor3hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9991
+glVertexWeighthNV = _link_function('glVertexWeighthNV', None, [GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9992
+glVertexWeighthvNV = _link_function('glVertexWeighthvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9993
+glVertexAttrib1hNV = _link_function('glVertexAttrib1hNV', None, [GLuint, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9994
+glVertexAttrib1hvNV = _link_function('glVertexAttrib1hvNV', None, [GLuint, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9995
+glVertexAttrib2hNV = _link_function('glVertexAttrib2hNV', None, [GLuint, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9996
+glVertexAttrib2hvNV = _link_function('glVertexAttrib2hvNV', None, [GLuint, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9997
+glVertexAttrib3hNV = _link_function('glVertexAttrib3hNV', None, [GLuint, GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:9998
+glVertexAttrib3hvNV = _link_function('glVertexAttrib3hvNV', None, [GLuint, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:9999
+glVertexAttrib4hNV = _link_function('glVertexAttrib4hNV', None, [GLuint, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:10000
+glVertexAttrib4hvNV = _link_function('glVertexAttrib4hvNV', None, [GLuint, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:10001
+glVertexAttribs1hvNV = _link_function('glVertexAttribs1hvNV', None, [GLuint, GLsizei, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:10002
+glVertexAttribs2hvNV = _link_function('glVertexAttribs2hvNV', None, [GLuint, GLsizei, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:10003
+glVertexAttribs3hvNV = _link_function('glVertexAttribs3hvNV', None, [GLuint, GLsizei, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:10004
+glVertexAttribs4hvNV = _link_function('glVertexAttribs4hvNV', None, [GLuint, GLsizei, POINTER(GLhalfNV)], 'NV_half_float')
+
+PFNGLVERTEX2HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV) # GL/glext.h:10006
+PFNGLVERTEX2HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:10007
+PFNGLVERTEX3HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:10008
+PFNGLVERTEX3HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:10009
+PFNGLVERTEX4HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:10010
+PFNGLVERTEX4HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:10011
+PFNGLNORMAL3HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:10012
+PFNGLNORMAL3HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:10013
+PFNGLCOLOR3HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:10014
+PFNGLCOLOR3HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:10015
+PFNGLCOLOR4HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:10016
+PFNGLCOLOR4HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:10017
+PFNGLTEXCOORD1HNVPROC = CFUNCTYPE(None, GLhalfNV) # GL/glext.h:10018
+PFNGLTEXCOORD1HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:10019
+PFNGLTEXCOORD2HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV) # GL/glext.h:10020
+PFNGLTEXCOORD2HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:10021
+PFNGLTEXCOORD3HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:10022
+PFNGLTEXCOORD3HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:10023
+PFNGLTEXCOORD4HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:10024
+PFNGLTEXCOORD4HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:10025
+PFNGLMULTITEXCOORD1HNVPROC = CFUNCTYPE(None, GLenum, GLhalfNV) # GL/glext.h:10026
+PFNGLMULTITEXCOORD1HVNVPROC = CFUNCTYPE(None, GLenum, POINTER(GLhalfNV)) # GL/glext.h:10027
+PFNGLMULTITEXCOORD2HNVPROC = CFUNCTYPE(None, GLenum, GLhalfNV, GLhalfNV) # GL/glext.h:10028
+PFNGLMULTITEXCOORD2HVNVPROC = CFUNCTYPE(None, GLenum, POINTER(GLhalfNV)) # GL/glext.h:10029
+PFNGLMULTITEXCOORD3HNVPROC = CFUNCTYPE(None, GLenum, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:10030
+PFNGLMULTITEXCOORD3HVNVPROC = CFUNCTYPE(None, GLenum, POINTER(GLhalfNV)) # GL/glext.h:10031
+PFNGLMULTITEXCOORD4HNVPROC = CFUNCTYPE(None, GLenum, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:10032
+PFNGLMULTITEXCOORD4HVNVPROC = CFUNCTYPE(None, GLenum, POINTER(GLhalfNV)) # GL/glext.h:10033
+PFNGLFOGCOORDHNVPROC = CFUNCTYPE(None, GLhalfNV) # GL/glext.h:10034
+PFNGLFOGCOORDHVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:10035
+PFNGLSECONDARYCOLOR3HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:10036
+PFNGLSECONDARYCOLOR3HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:10037
+PFNGLVERTEXWEIGHTHNVPROC = CFUNCTYPE(None, GLhalfNV) # GL/glext.h:10038
+PFNGLVERTEXWEIGHTHVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:10039
+PFNGLVERTEXATTRIB1HNVPROC = CFUNCTYPE(None, GLuint, GLhalfNV) # GL/glext.h:10040
+PFNGLVERTEXATTRIB1HVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLhalfNV)) # GL/glext.h:10041
+PFNGLVERTEXATTRIB2HNVPROC = CFUNCTYPE(None, GLuint, GLhalfNV, GLhalfNV) # GL/glext.h:10042
+PFNGLVERTEXATTRIB2HVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLhalfNV)) # GL/glext.h:10043
+PFNGLVERTEXATTRIB3HNVPROC = CFUNCTYPE(None, GLuint, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:10044
+PFNGLVERTEXATTRIB3HVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLhalfNV)) # GL/glext.h:10045
+PFNGLVERTEXATTRIB4HNVPROC = CFUNCTYPE(None, GLuint, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:10046
+PFNGLVERTEXATTRIB4HVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLhalfNV)) # GL/glext.h:10047
+PFNGLVERTEXATTRIBS1HVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLhalfNV)) # GL/glext.h:10048
+PFNGLVERTEXATTRIBS2HVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLhalfNV)) # GL/glext.h:10049
+PFNGLVERTEXATTRIBS3HVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLhalfNV)) # GL/glext.h:10050
+PFNGLVERTEXATTRIBS4HVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLhalfNV)) # GL/glext.h:10051
+# NV_pixel_data_range (GL/glext.h:10054)
+GL_NV_pixel_data_range = 1 # GL/glext.h:10055
+# GL/glext.h:10057
+glPixelDataRangeNV = _link_function('glPixelDataRangeNV', None, [GLenum, GLsizei, POINTER(GLvoid)], 'NV_pixel_data_range')
+
+# GL/glext.h:10058
+glFlushPixelDataRangeNV = _link_function('glFlushPixelDataRangeNV', None, [GLenum], 'NV_pixel_data_range')
+
+PFNGLPIXELDATARANGENVPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:10060
+PFNGLFLUSHPIXELDATARANGENVPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:10061
+# NV_primitive_restart (GL/glext.h:10064)
+GL_NV_primitive_restart = 1 # GL/glext.h:10065
+# GL/glext.h:10067
+glPrimitiveRestartNV = _link_function('glPrimitiveRestartNV', None, [], 'NV_primitive_restart')
+
+# GL/glext.h:10068
+glPrimitiveRestartIndexNV = _link_function('glPrimitiveRestartIndexNV', None, [GLuint], 'NV_primitive_restart')
+
+PFNGLPRIMITIVERESTARTNVPROC = CFUNCTYPE(None) # GL/glext.h:10070
+PFNGLPRIMITIVERESTARTINDEXNVPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:10071
+# NV_texture_expand_normal (GL/glext.h:10074)
+GL_NV_texture_expand_normal = 1 # GL/glext.h:10075
+# NV_vertex_program2 (GL/glext.h:10078)
+GL_NV_vertex_program2 = 1 # GL/glext.h:10079
+# ATI_map_object_buffer (GL/glext.h:10082)
+GL_ATI_map_object_buffer = 1 # GL/glext.h:10083
+# GL/glext.h:10085
+glMapObjectBufferATI = _link_function('glMapObjectBufferATI', POINTER(GLvoid), [GLuint], 'ATI_map_object_buffer')
+
+# GL/glext.h:10086
+glUnmapObjectBufferATI = _link_function('glUnmapObjectBufferATI', None, [GLuint], 'ATI_map_object_buffer')
+
+PFNGLMAPOBJECTBUFFERATIPROC = CFUNCTYPE(POINTER(GLvoid), GLuint) # GL/glext.h:10088
+PFNGLUNMAPOBJECTBUFFERATIPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:10089
+# ATI_separate_stencil (GL/glext.h:10092)
+GL_ATI_separate_stencil = 1 # GL/glext.h:10093
+# GL/glext.h:10095
+glStencilOpSeparateATI = _link_function('glStencilOpSeparateATI', None, [GLenum, GLenum, GLenum, GLenum], 'ATI_separate_stencil')
+
+# GL/glext.h:10096
+glStencilFuncSeparateATI = _link_function('glStencilFuncSeparateATI', None, [GLenum, GLenum, GLint, GLuint], 'ATI_separate_stencil')
+
+PFNGLSTENCILOPSEPARATEATIPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:10098
+PFNGLSTENCILFUNCSEPARATEATIPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLuint) # GL/glext.h:10099
+# ATI_vertex_attrib_array_object (GL/glext.h:10102)
+GL_ATI_vertex_attrib_array_object = 1 # GL/glext.h:10103
+# GL/glext.h:10105
+glVertexAttribArrayObjectATI = _link_function('glVertexAttribArrayObjectATI', None, [GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint, GLuint], 'ATI_vertex_attrib_array_object')
+
+# GL/glext.h:10106
+glGetVertexAttribArrayObjectfvATI = _link_function('glGetVertexAttribArrayObjectfvATI', None, [GLuint, GLenum, POINTER(GLfloat)], 'ATI_vertex_attrib_array_object')
+
+# GL/glext.h:10107
+glGetVertexAttribArrayObjectivATI = _link_function('glGetVertexAttribArrayObjectivATI', None, [GLuint, GLenum, POINTER(GLint)], 'ATI_vertex_attrib_array_object')
+
+PFNGLVERTEXATTRIBARRAYOBJECTATIPROC = CFUNCTYPE(None, GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint, GLuint) # GL/glext.h:10109
+PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:10110
+PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:10111
+# OES_read_format (GL/glext.h:10114)
+GL_OES_read_format = 1 # GL/glext.h:10115
+# EXT_depth_bounds_test (GL/glext.h:10118)
+GL_EXT_depth_bounds_test = 1 # GL/glext.h:10119
+GLclampd = c_double # /usr/include/GL/gl.h:163
+# GL/glext.h:10121
+glDepthBoundsEXT = _link_function('glDepthBoundsEXT', None, [GLclampd, GLclampd], 'EXT_depth_bounds_test')
+
+PFNGLDEPTHBOUNDSEXTPROC = CFUNCTYPE(None, GLclampd, GLclampd) # GL/glext.h:10123
+# EXT_texture_mirror_clamp (GL/glext.h:10126)
+GL_EXT_texture_mirror_clamp = 1 # GL/glext.h:10127
+# EXT_blend_equation_separate (GL/glext.h:10130)
+GL_EXT_blend_equation_separate = 1 # GL/glext.h:10131
+# GL/glext.h:10133
+glBlendEquationSeparateEXT = _link_function('glBlendEquationSeparateEXT', None, [GLenum, GLenum], 'EXT_blend_equation_separate')
+
+PFNGLBLENDEQUATIONSEPARATEEXTPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:10135
+# MESA_pack_invert (GL/glext.h:10138)
+GL_MESA_pack_invert = 1 # GL/glext.h:10139
+# MESA_ycbcr_texture (GL/glext.h:10142)
+GL_MESA_ycbcr_texture = 1 # GL/glext.h:10143
+# EXT_pixel_buffer_object (GL/glext.h:10146)
+GL_EXT_pixel_buffer_object = 1 # GL/glext.h:10147
+# NV_fragment_program_option (GL/glext.h:10150)
+GL_NV_fragment_program_option = 1 # GL/glext.h:10151
+# NV_fragment_program2 (GL/glext.h:10154)
+GL_NV_fragment_program2 = 1 # GL/glext.h:10155
+# NV_vertex_program2_option (GL/glext.h:10158)
+GL_NV_vertex_program2_option = 1 # GL/glext.h:10159
+# NV_vertex_program3 (GL/glext.h:10162)
+GL_NV_vertex_program3 = 1 # GL/glext.h:10163
+# EXT_framebuffer_object (GL/glext.h:10166)
+GL_EXT_framebuffer_object = 1 # GL/glext.h:10167
+# GL/glext.h:10169
+glIsRenderbufferEXT = _link_function('glIsRenderbufferEXT', GLboolean, [GLuint], 'EXT_framebuffer_object')
+
+# GL/glext.h:10170
+glBindRenderbufferEXT = _link_function('glBindRenderbufferEXT', None, [GLenum, GLuint], 'EXT_framebuffer_object')
+
+# GL/glext.h:10171
+glDeleteRenderbuffersEXT = _link_function('glDeleteRenderbuffersEXT', None, [GLsizei, POINTER(GLuint)], 'EXT_framebuffer_object')
+
+# GL/glext.h:10172
+glGenRenderbuffersEXT = _link_function('glGenRenderbuffersEXT', None, [GLsizei, POINTER(GLuint)], 'EXT_framebuffer_object')
+
+# GL/glext.h:10173
+glRenderbufferStorageEXT = _link_function('glRenderbufferStorageEXT', None, [GLenum, GLenum, GLsizei, GLsizei], 'EXT_framebuffer_object')
+
+# GL/glext.h:10174
+glGetRenderbufferParameterivEXT = _link_function('glGetRenderbufferParameterivEXT', None, [GLenum, GLenum, POINTER(GLint)], 'EXT_framebuffer_object')
+
+# GL/glext.h:10175
+glIsFramebufferEXT = _link_function('glIsFramebufferEXT', GLboolean, [GLuint], 'EXT_framebuffer_object')
+
+# GL/glext.h:10176
+glBindFramebufferEXT = _link_function('glBindFramebufferEXT', None, [GLenum, GLuint], 'EXT_framebuffer_object')
+
+# GL/glext.h:10177
+glDeleteFramebuffersEXT = _link_function('glDeleteFramebuffersEXT', None, [GLsizei, POINTER(GLuint)], 'EXT_framebuffer_object')
+
+# GL/glext.h:10178
+glGenFramebuffersEXT = _link_function('glGenFramebuffersEXT', None, [GLsizei, POINTER(GLuint)], 'EXT_framebuffer_object')
+
+# GL/glext.h:10179
+glCheckFramebufferStatusEXT = _link_function('glCheckFramebufferStatusEXT', GLenum, [GLenum], 'EXT_framebuffer_object')
+
+# GL/glext.h:10180
+glFramebufferTexture1DEXT = _link_function('glFramebufferTexture1DEXT', None, [GLenum, GLenum, GLenum, GLuint, GLint], 'EXT_framebuffer_object')
+
+# GL/glext.h:10181
+glFramebufferTexture2DEXT = _link_function('glFramebufferTexture2DEXT', None, [GLenum, GLenum, GLenum, GLuint, GLint], 'EXT_framebuffer_object')
+
+# GL/glext.h:10182
+glFramebufferTexture3DEXT = _link_function('glFramebufferTexture3DEXT', None, [GLenum, GLenum, GLenum, GLuint, GLint, GLint], 'EXT_framebuffer_object')
+
+# GL/glext.h:10183
+glFramebufferRenderbufferEXT = _link_function('glFramebufferRenderbufferEXT', None, [GLenum, GLenum, GLenum, GLuint], 'EXT_framebuffer_object')
+
+# GL/glext.h:10184
+glGetFramebufferAttachmentParameterivEXT = _link_function('glGetFramebufferAttachmentParameterivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'EXT_framebuffer_object')
+
+# GL/glext.h:10185
+glGenerateMipmapEXT = _link_function('glGenerateMipmapEXT', None, [GLenum], 'EXT_framebuffer_object')
+
+PFNGLISRENDERBUFFEREXTPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:10187
+PFNGLBINDRENDERBUFFEREXTPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:10188
+PFNGLDELETERENDERBUFFERSEXTPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:10189
+PFNGLGENRENDERBUFFERSEXTPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:10190
+PFNGLRENDERBUFFERSTORAGEEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, GLsizei) # GL/glext.h:10191
+PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:10192
+PFNGLISFRAMEBUFFEREXTPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:10193
+PFNGLBINDFRAMEBUFFEREXTPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:10194
+PFNGLDELETEFRAMEBUFFERSEXTPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:10195
+PFNGLGENFRAMEBUFFERSEXTPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:10196
+PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC = CFUNCTYPE(GLenum, GLenum) # GL/glext.h:10197
+PFNGLFRAMEBUFFERTEXTURE1DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLuint, GLint) # GL/glext.h:10198
+PFNGLFRAMEBUFFERTEXTURE2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLuint, GLint) # GL/glext.h:10199
+PFNGLFRAMEBUFFERTEXTURE3DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLuint, GLint, GLint) # GL/glext.h:10200
+PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLuint) # GL/glext.h:10201
+PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:10202
+PFNGLGENERATEMIPMAPEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:10203
+# GREMEDY_string_marker (GL/glext.h:10206)
+GL_GREMEDY_string_marker = 1 # GL/glext.h:10207
+# GL/glext.h:10209
+glStringMarkerGREMEDY = _link_function('glStringMarkerGREMEDY', None, [GLsizei, POINTER(GLvoid)], 'GREMEDY_string_marker')
+
+PFNGLSTRINGMARKERGREMEDYPROC = CFUNCTYPE(None, GLsizei, POINTER(GLvoid)) # GL/glext.h:10211
+# EXT_packed_depth_stencil (GL/glext.h:10214)
+GL_EXT_packed_depth_stencil = 1 # GL/glext.h:10215
+# EXT_stencil_clear_tag (GL/glext.h:10218)
+GL_EXT_stencil_clear_tag = 1 # GL/glext.h:10219
+# GL/glext.h:10221
+glStencilClearTagEXT = _link_function('glStencilClearTagEXT', None, [GLsizei, GLuint], 'EXT_stencil_clear_tag')
+
+PFNGLSTENCILCLEARTAGEXTPROC = CFUNCTYPE(None, GLsizei, GLuint) # GL/glext.h:10223
+# EXT_texture_sRGB (GL/glext.h:10226)
+GL_EXT_texture_sRGB = 1 # GL/glext.h:10227
+# EXT_framebuffer_blit (GL/glext.h:10230)
+GL_EXT_framebuffer_blit = 1 # GL/glext.h:10231
+# GL/glext.h:10233
+glBlitFramebufferEXT = _link_function('glBlitFramebufferEXT', None, [GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum], 'EXT_framebuffer_blit')
+
+PFNGLBLITFRAMEBUFFEREXTPROC = CFUNCTYPE(None, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum) # GL/glext.h:10235
+# EXT_framebuffer_multisample (GL/glext.h:10238)
+GL_EXT_framebuffer_multisample = 1 # GL/glext.h:10239
+# GL/glext.h:10241
+glRenderbufferStorageMultisampleEXT = _link_function('glRenderbufferStorageMultisampleEXT', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei], 'EXT_framebuffer_multisample')
+
+PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, GLsizei, GLsizei) # GL/glext.h:10243
+# MESAX_texture_stack (GL/glext.h:10246)
+GL_MESAX_texture_stack = 1 # GL/glext.h:10247
+# EXT_timer_query (GL/glext.h:10250)
+GL_EXT_timer_query = 1 # GL/glext.h:10251
+# GL/glext.h:10253
+glGetQueryObjecti64vEXT = _link_function('glGetQueryObjecti64vEXT', None, [GLuint, GLenum, POINTER(GLint64EXT)], 'EXT_timer_query')
+
+# GL/glext.h:10254
+glGetQueryObjectui64vEXT = _link_function('glGetQueryObjectui64vEXT', None, [GLuint, GLenum, POINTER(GLuint64EXT)], 'EXT_timer_query')
+
+PFNGLGETQUERYOBJECTI64VEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint64EXT)) # GL/glext.h:10256
+PFNGLGETQUERYOBJECTUI64VEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint64EXT)) # GL/glext.h:10257
+# EXT_gpu_program_parameters (GL/glext.h:10260)
+GL_EXT_gpu_program_parameters = 1 # GL/glext.h:10261
+# GL/glext.h:10263
+glProgramEnvParameters4fvEXT = _link_function('glProgramEnvParameters4fvEXT', None, [GLenum, GLuint, GLsizei, POINTER(GLfloat)], 'EXT_gpu_program_parameters')
+
+# GL/glext.h:10264
+glProgramLocalParameters4fvEXT = _link_function('glProgramLocalParameters4fvEXT', None, [GLenum, GLuint, GLsizei, POINTER(GLfloat)], 'EXT_gpu_program_parameters')
+
+PFNGLPROGRAMENVPARAMETERS4FVEXTPROC = CFUNCTYPE(None, GLenum, GLuint, GLsizei, POINTER(GLfloat)) # GL/glext.h:10266
+PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC = CFUNCTYPE(None, GLenum, GLuint, GLsizei, POINTER(GLfloat)) # GL/glext.h:10267
+# APPLE_flush_buffer_range (GL/glext.h:10270)
+GL_APPLE_flush_buffer_range = 1 # GL/glext.h:10271
+# GL/glext.h:10273
+glBufferParameteriAPPLE = _link_function('glBufferParameteriAPPLE', None, [GLenum, GLenum, GLint], 'APPLE_flush_buffer_range')
+
+# GL/glext.h:10274
+glFlushMappedBufferRangeAPPLE = _link_function('glFlushMappedBufferRangeAPPLE', None, [GLenum, GLintptr, GLsizeiptr], 'APPLE_flush_buffer_range')
+
+PFNGLBUFFERPARAMETERIAPPLEPROC = CFUNCTYPE(None, GLenum, GLenum, GLint) # GL/glext.h:10276
+PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC = CFUNCTYPE(None, GLenum, GLintptr, GLsizeiptr) # GL/glext.h:10277
+# NV_gpu_program4 (GL/glext.h:10280)
+GL_NV_gpu_program4 = 1 # GL/glext.h:10281
+# GL/glext.h:10283
+glProgramLocalParameterI4iNV = _link_function('glProgramLocalParameterI4iNV', None, [GLenum, GLuint, GLint, GLint, GLint, GLint], 'NV_gpu_program4')
+
+# GL/glext.h:10284
+glProgramLocalParameterI4ivNV = _link_function('glProgramLocalParameterI4ivNV', None, [GLenum, GLuint, POINTER(GLint)], 'NV_gpu_program4')
+
+# GL/glext.h:10285
+glProgramLocalParametersI4ivNV = _link_function('glProgramLocalParametersI4ivNV', None, [GLenum, GLuint, GLsizei, POINTER(GLint)], 'NV_gpu_program4')
+
+# GL/glext.h:10286
+glProgramLocalParameterI4uiNV = _link_function('glProgramLocalParameterI4uiNV', None, [GLenum, GLuint, GLuint, GLuint, GLuint, GLuint], 'NV_gpu_program4')
+
+# GL/glext.h:10287
+glProgramLocalParameterI4uivNV = _link_function('glProgramLocalParameterI4uivNV', None, [GLenum, GLuint, POINTER(GLuint)], 'NV_gpu_program4')
+
+# GL/glext.h:10288
+glProgramLocalParametersI4uivNV = _link_function('glProgramLocalParametersI4uivNV', None, [GLenum, GLuint, GLsizei, POINTER(GLuint)], 'NV_gpu_program4')
+
+# GL/glext.h:10289
+glProgramEnvParameterI4iNV = _link_function('glProgramEnvParameterI4iNV', None, [GLenum, GLuint, GLint, GLint, GLint, GLint], 'NV_gpu_program4')
+
+# GL/glext.h:10290
+glProgramEnvParameterI4ivNV = _link_function('glProgramEnvParameterI4ivNV', None, [GLenum, GLuint, POINTER(GLint)], 'NV_gpu_program4')
+
+# GL/glext.h:10291
+glProgramEnvParametersI4ivNV = _link_function('glProgramEnvParametersI4ivNV', None, [GLenum, GLuint, GLsizei, POINTER(GLint)], 'NV_gpu_program4')
+
+# GL/glext.h:10292
+glProgramEnvParameterI4uiNV = _link_function('glProgramEnvParameterI4uiNV', None, [GLenum, GLuint, GLuint, GLuint, GLuint, GLuint], 'NV_gpu_program4')
+
+# GL/glext.h:10293
+glProgramEnvParameterI4uivNV = _link_function('glProgramEnvParameterI4uivNV', None, [GLenum, GLuint, POINTER(GLuint)], 'NV_gpu_program4')
+
+# GL/glext.h:10294
+glProgramEnvParametersI4uivNV = _link_function('glProgramEnvParametersI4uivNV', None, [GLenum, GLuint, GLsizei, POINTER(GLuint)], 'NV_gpu_program4')
+
+# GL/glext.h:10295
+glGetProgramLocalParameterIivNV = _link_function('glGetProgramLocalParameterIivNV', None, [GLenum, GLuint, POINTER(GLint)], 'NV_gpu_program4')
+
+# GL/glext.h:10296
+glGetProgramLocalParameterIuivNV = _link_function('glGetProgramLocalParameterIuivNV', None, [GLenum, GLuint, POINTER(GLuint)], 'NV_gpu_program4')
+
+# GL/glext.h:10297
+glGetProgramEnvParameterIivNV = _link_function('glGetProgramEnvParameterIivNV', None, [GLenum, GLuint, POINTER(GLint)], 'NV_gpu_program4')
+
+# GL/glext.h:10298
+glGetProgramEnvParameterIuivNV = _link_function('glGetProgramEnvParameterIuivNV', None, [GLenum, GLuint, POINTER(GLuint)], 'NV_gpu_program4')
+
+PFNGLPROGRAMLOCALPARAMETERI4INVPROC = CFUNCTYPE(None, GLenum, GLuint, GLint, GLint, GLint, GLint) # GL/glext.h:10300
+PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLint)) # GL/glext.h:10301
+PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLsizei, POINTER(GLint)) # GL/glext.h:10302
+PFNGLPROGRAMLOCALPARAMETERI4UINVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:10303
+PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLuint)) # GL/glext.h:10304
+PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLsizei, POINTER(GLuint)) # GL/glext.h:10305
+PFNGLPROGRAMENVPARAMETERI4INVPROC = CFUNCTYPE(None, GLenum, GLuint, GLint, GLint, GLint, GLint) # GL/glext.h:10306
+PFNGLPROGRAMENVPARAMETERI4IVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLint)) # GL/glext.h:10307
+PFNGLPROGRAMENVPARAMETERSI4IVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLsizei, POINTER(GLint)) # GL/glext.h:10308
+PFNGLPROGRAMENVPARAMETERI4UINVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:10309
+PFNGLPROGRAMENVPARAMETERI4UIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLuint)) # GL/glext.h:10310
+PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLsizei, POINTER(GLuint)) # GL/glext.h:10311
+PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLint)) # GL/glext.h:10312
+PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLuint)) # GL/glext.h:10313
+PFNGLGETPROGRAMENVPARAMETERIIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLint)) # GL/glext.h:10314
+PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLuint)) # GL/glext.h:10315
+# NV_geometry_program4 (GL/glext.h:10318)
+GL_NV_geometry_program4 = 1 # GL/glext.h:10319
+# GL/glext.h:10321
+glProgramVertexLimitNV = _link_function('glProgramVertexLimitNV', None, [GLenum, GLint], 'NV_geometry_program4')
+
+# GL/glext.h:10322
+glFramebufferTextureEXT = _link_function('glFramebufferTextureEXT', None, [GLenum, GLenum, GLuint, GLint], 'NV_geometry_program4')
+
+# GL/glext.h:10323
+glFramebufferTextureLayerEXT = _link_function('glFramebufferTextureLayerEXT', None, [GLenum, GLenum, GLuint, GLint, GLint], 'NV_geometry_program4')
+
+# GL/glext.h:10324
+glFramebufferTextureFaceEXT = _link_function('glFramebufferTextureFaceEXT', None, [GLenum, GLenum, GLuint, GLint, GLenum], 'NV_geometry_program4')
+
+PFNGLPROGRAMVERTEXLIMITNVPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:10326
+PFNGLFRAMEBUFFERTEXTUREEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLint) # GL/glext.h:10327
+PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLint, GLint) # GL/glext.h:10328
+PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLint, GLenum) # GL/glext.h:10329
+# EXT_geometry_shader4 (GL/glext.h:10332)
+GL_EXT_geometry_shader4 = 1 # GL/glext.h:10333
+# GL/glext.h:10335
+glProgramParameteriEXT = _link_function('glProgramParameteriEXT', None, [GLuint, GLenum, GLint], 'EXT_geometry_shader4')
+
+PFNGLPROGRAMPARAMETERIEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint) # GL/glext.h:10337
+# NV_vertex_program4 (GL/glext.h:10340)
+GL_NV_vertex_program4 = 1 # GL/glext.h:10341
+# GL/glext.h:10343
+glVertexAttribI1iEXT = _link_function('glVertexAttribI1iEXT', None, [GLuint, GLint], 'NV_vertex_program4')
+
+# GL/glext.h:10344
+glVertexAttribI2iEXT = _link_function('glVertexAttribI2iEXT', None, [GLuint, GLint, GLint], 'NV_vertex_program4')
+
+# GL/glext.h:10345
+glVertexAttribI3iEXT = _link_function('glVertexAttribI3iEXT', None, [GLuint, GLint, GLint, GLint], 'NV_vertex_program4')
+
+# GL/glext.h:10346
+glVertexAttribI4iEXT = _link_function('glVertexAttribI4iEXT', None, [GLuint, GLint, GLint, GLint, GLint], 'NV_vertex_program4')
+
+# GL/glext.h:10347
+glVertexAttribI1uiEXT = _link_function('glVertexAttribI1uiEXT', None, [GLuint, GLuint], 'NV_vertex_program4')
+
+# GL/glext.h:10348
+glVertexAttribI2uiEXT = _link_function('glVertexAttribI2uiEXT', None, [GLuint, GLuint, GLuint], 'NV_vertex_program4')
+
+# GL/glext.h:10349
+glVertexAttribI3uiEXT = _link_function('glVertexAttribI3uiEXT', None, [GLuint, GLuint, GLuint, GLuint], 'NV_vertex_program4')
+
+# GL/glext.h:10350
+glVertexAttribI4uiEXT = _link_function('glVertexAttribI4uiEXT', None, [GLuint, GLuint, GLuint, GLuint, GLuint], 'NV_vertex_program4')
+
+# GL/glext.h:10351
+glVertexAttribI1ivEXT = _link_function('glVertexAttribI1ivEXT', None, [GLuint, POINTER(GLint)], 'NV_vertex_program4')
+
+# GL/glext.h:10352
+glVertexAttribI2ivEXT = _link_function('glVertexAttribI2ivEXT', None, [GLuint, POINTER(GLint)], 'NV_vertex_program4')
+
+# GL/glext.h:10353
+glVertexAttribI3ivEXT = _link_function('glVertexAttribI3ivEXT', None, [GLuint, POINTER(GLint)], 'NV_vertex_program4')
+
+# GL/glext.h:10354
+glVertexAttribI4ivEXT = _link_function('glVertexAttribI4ivEXT', None, [GLuint, POINTER(GLint)], 'NV_vertex_program4')
+
+# GL/glext.h:10355
+glVertexAttribI1uivEXT = _link_function('glVertexAttribI1uivEXT', None, [GLuint, POINTER(GLuint)], 'NV_vertex_program4')
+
+# GL/glext.h:10356
+glVertexAttribI2uivEXT = _link_function('glVertexAttribI2uivEXT', None, [GLuint, POINTER(GLuint)], 'NV_vertex_program4')
+
+# GL/glext.h:10357
+glVertexAttribI3uivEXT = _link_function('glVertexAttribI3uivEXT', None, [GLuint, POINTER(GLuint)], 'NV_vertex_program4')
+
+# GL/glext.h:10358
+glVertexAttribI4uivEXT = _link_function('glVertexAttribI4uivEXT', None, [GLuint, POINTER(GLuint)], 'NV_vertex_program4')
+
+# GL/glext.h:10359
+glVertexAttribI4bvEXT = _link_function('glVertexAttribI4bvEXT', None, [GLuint, POINTER(GLbyte)], 'NV_vertex_program4')
+
+# GL/glext.h:10360
+glVertexAttribI4svEXT = _link_function('glVertexAttribI4svEXT', None, [GLuint, POINTER(GLshort)], 'NV_vertex_program4')
+
+# GL/glext.h:10361
+glVertexAttribI4ubvEXT = _link_function('glVertexAttribI4ubvEXT', None, [GLuint, POINTER(GLubyte)], 'NV_vertex_program4')
+
+# GL/glext.h:10362
+glVertexAttribI4usvEXT = _link_function('glVertexAttribI4usvEXT', None, [GLuint, POINTER(GLushort)], 'NV_vertex_program4')
+
+# GL/glext.h:10363
+glVertexAttribIPointerEXT = _link_function('glVertexAttribIPointerEXT', None, [GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)], 'NV_vertex_program4')
+
+# GL/glext.h:10364
+glGetVertexAttribIivEXT = _link_function('glGetVertexAttribIivEXT', None, [GLuint, GLenum, POINTER(GLint)], 'NV_vertex_program4')
+
+# GL/glext.h:10365
+glGetVertexAttribIuivEXT = _link_function('glGetVertexAttribIuivEXT', None, [GLuint, GLenum, POINTER(GLuint)], 'NV_vertex_program4')
+
+PFNGLVERTEXATTRIBI1IEXTPROC = CFUNCTYPE(None, GLuint, GLint) # GL/glext.h:10367
+PFNGLVERTEXATTRIBI2IEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLint) # GL/glext.h:10368
+PFNGLVERTEXATTRIBI3IEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLint, GLint) # GL/glext.h:10369
+PFNGLVERTEXATTRIBI4IEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLint, GLint, GLint) # GL/glext.h:10370
+PFNGLVERTEXATTRIBI1UIEXTPROC = CFUNCTYPE(None, GLuint, GLuint) # GL/glext.h:10371
+PFNGLVERTEXATTRIBI2UIEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint) # GL/glext.h:10372
+PFNGLVERTEXATTRIBI3UIEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:10373
+PFNGLVERTEXATTRIBI4UIEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:10374
+PFNGLVERTEXATTRIBI1IVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:10375
+PFNGLVERTEXATTRIBI2IVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:10376
+PFNGLVERTEXATTRIBI3IVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:10377
+PFNGLVERTEXATTRIBI4IVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:10378
+PFNGLVERTEXATTRIBI1UIVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:10379
+PFNGLVERTEXATTRIBI2UIVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:10380
+PFNGLVERTEXATTRIBI3UIVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:10381
+PFNGLVERTEXATTRIBI4UIVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:10382
+PFNGLVERTEXATTRIBI4BVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLbyte)) # GL/glext.h:10383
+PFNGLVERTEXATTRIBI4SVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:10384
+PFNGLVERTEXATTRIBI4UBVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLubyte)) # GL/glext.h:10385
+PFNGLVERTEXATTRIBI4USVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLushort)) # GL/glext.h:10386
+PFNGLVERTEXATTRIBIPOINTEREXTPROC = CFUNCTYPE(None, GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:10387
+PFNGLGETVERTEXATTRIBIIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:10388
+PFNGLGETVERTEXATTRIBIUIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint)) # GL/glext.h:10389
+# EXT_gpu_shader4 (GL/glext.h:10392)
+GL_EXT_gpu_shader4 = 1 # GL/glext.h:10393
+# GL/glext.h:10395
+glGetUniformuivEXT = _link_function('glGetUniformuivEXT', None, [GLuint, GLint, POINTER(GLuint)], 'EXT_gpu_shader4')
+
+# GL/glext.h:10396
+glBindFragDataLocationEXT = _link_function('glBindFragDataLocationEXT', None, [GLuint, GLuint, POINTER(GLchar)], 'EXT_gpu_shader4')
+
+# GL/glext.h:10397
+glGetFragDataLocationEXT = _link_function('glGetFragDataLocationEXT', GLint, [GLuint, POINTER(GLchar)], 'EXT_gpu_shader4')
+
+# GL/glext.h:10398
+glUniform1uiEXT = _link_function('glUniform1uiEXT', None, [GLint, GLuint], 'EXT_gpu_shader4')
+
+# GL/glext.h:10399
+glUniform2uiEXT = _link_function('glUniform2uiEXT', None, [GLint, GLuint, GLuint], 'EXT_gpu_shader4')
+
+# GL/glext.h:10400
+glUniform3uiEXT = _link_function('glUniform3uiEXT', None, [GLint, GLuint, GLuint, GLuint], 'EXT_gpu_shader4')
+
+# GL/glext.h:10401
+glUniform4uiEXT = _link_function('glUniform4uiEXT', None, [GLint, GLuint, GLuint, GLuint, GLuint], 'EXT_gpu_shader4')
+
+# GL/glext.h:10402
+glUniform1uivEXT = _link_function('glUniform1uivEXT', None, [GLint, GLsizei, POINTER(GLuint)], 'EXT_gpu_shader4')
+
+# GL/glext.h:10403
+glUniform2uivEXT = _link_function('glUniform2uivEXT', None, [GLint, GLsizei, POINTER(GLuint)], 'EXT_gpu_shader4')
+
+# GL/glext.h:10404
+glUniform3uivEXT = _link_function('glUniform3uivEXT', None, [GLint, GLsizei, POINTER(GLuint)], 'EXT_gpu_shader4')
+
+# GL/glext.h:10405
+glUniform4uivEXT = _link_function('glUniform4uivEXT', None, [GLint, GLsizei, POINTER(GLuint)], 'EXT_gpu_shader4')
+
+PFNGLGETUNIFORMUIVEXTPROC = CFUNCTYPE(None, GLuint, GLint, POINTER(GLuint)) # GL/glext.h:10407
+PFNGLBINDFRAGDATALOCATIONEXTPROC = CFUNCTYPE(None, GLuint, GLuint, POINTER(GLchar)) # GL/glext.h:10408
+PFNGLGETFRAGDATALOCATIONEXTPROC = CFUNCTYPE(GLint, GLuint, POINTER(GLchar)) # GL/glext.h:10409
+PFNGLUNIFORM1UIEXTPROC = CFUNCTYPE(None, GLint, GLuint) # GL/glext.h:10410
+PFNGLUNIFORM2UIEXTPROC = CFUNCTYPE(None, GLint, GLuint, GLuint) # GL/glext.h:10411
+PFNGLUNIFORM3UIEXTPROC = CFUNCTYPE(None, GLint, GLuint, GLuint, GLuint) # GL/glext.h:10412
+PFNGLUNIFORM4UIEXTPROC = CFUNCTYPE(None, GLint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:10413
+PFNGLUNIFORM1UIVEXTPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:10414
+PFNGLUNIFORM2UIVEXTPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:10415
+PFNGLUNIFORM3UIVEXTPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:10416
+PFNGLUNIFORM4UIVEXTPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:10417
+# EXT_draw_instanced (GL/glext.h:10420)
+GL_EXT_draw_instanced = 1 # GL/glext.h:10421
+# GL/glext.h:10423
+glDrawArraysInstancedEXT = _link_function('glDrawArraysInstancedEXT', None, [GLenum, GLint, GLsizei, GLsizei], 'EXT_draw_instanced')
+
+# GL/glext.h:10424
+glDrawElementsInstancedEXT = _link_function('glDrawElementsInstancedEXT', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei], 'EXT_draw_instanced')
+
+PFNGLDRAWARRAYSINSTANCEDEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLsizei, GLsizei) # GL/glext.h:10426
+PFNGLDRAWELEMENTSINSTANCEDEXTPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei) # GL/glext.h:10427
+# EXT_packed_float (GL/glext.h:10430)
+GL_EXT_packed_float = 1 # GL/glext.h:10431
+# EXT_texture_array (GL/glext.h:10434)
+GL_EXT_texture_array = 1 # GL/glext.h:10435
+# EXT_texture_buffer_object (GL/glext.h:10438)
+GL_EXT_texture_buffer_object = 1 # GL/glext.h:10439
+# GL/glext.h:10441
+glTexBufferEXT = _link_function('glTexBufferEXT', None, [GLenum, GLenum, GLuint], 'EXT_texture_buffer_object')
+
+PFNGLTEXBUFFEREXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint) # GL/glext.h:10443
+# EXT_texture_compression_latc (GL/glext.h:10446)
+GL_EXT_texture_compression_latc = 1 # GL/glext.h:10447
+# EXT_texture_compression_rgtc (GL/glext.h:10450)
+GL_EXT_texture_compression_rgtc = 1 # GL/glext.h:10451
+# EXT_texture_shared_exponent (GL/glext.h:10454)
+GL_EXT_texture_shared_exponent = 1 # GL/glext.h:10455
+# NV_depth_buffer_float (GL/glext.h:10458)
+GL_NV_depth_buffer_float = 1 # GL/glext.h:10459
+# GL/glext.h:10461
+glDepthRangedNV = _link_function('glDepthRangedNV', None, [GLdouble, GLdouble], 'NV_depth_buffer_float')
+
+# GL/glext.h:10462
+glClearDepthdNV = _link_function('glClearDepthdNV', None, [GLdouble], 'NV_depth_buffer_float')
+
+# GL/glext.h:10463
+glDepthBoundsdNV = _link_function('glDepthBoundsdNV', None, [GLdouble, GLdouble], 'NV_depth_buffer_float')
+
+PFNGLDEPTHRANGEDNVPROC = CFUNCTYPE(None, GLdouble, GLdouble) # GL/glext.h:10465
+PFNGLCLEARDEPTHDNVPROC = CFUNCTYPE(None, GLdouble) # GL/glext.h:10466
+PFNGLDEPTHBOUNDSDNVPROC = CFUNCTYPE(None, GLdouble, GLdouble) # GL/glext.h:10467
+# NV_fragment_program4 (GL/glext.h:10470)
+GL_NV_fragment_program4 = 1 # GL/glext.h:10471
+# NV_framebuffer_multisample_coverage (GL/glext.h:10474)
+GL_NV_framebuffer_multisample_coverage = 1 # GL/glext.h:10475
+# GL/glext.h:10477
+glRenderbufferStorageMultisampleCoverageNV = _link_function('glRenderbufferStorageMultisampleCoverageNV', None, [GLenum, GLsizei, GLsizei, GLenum, GLsizei, GLsizei], 'NV_framebuffer_multisample_coverage')
+
+PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC = CFUNCTYPE(None, GLenum, GLsizei, GLsizei, GLenum, GLsizei, GLsizei) # GL/glext.h:10479
+# EXT_framebuffer_sRGB (GL/glext.h:10482)
+GL_EXT_framebuffer_sRGB = 1 # GL/glext.h:10483
+# NV_geometry_shader4 (GL/glext.h:10486)
+GL_NV_geometry_shader4 = 1 # GL/glext.h:10487
+# NV_parameter_buffer_object (GL/glext.h:10490)
+GL_NV_parameter_buffer_object = 1 # GL/glext.h:10491
+# GL/glext.h:10493
+glProgramBufferParametersfvNV = _link_function('glProgramBufferParametersfvNV', None, [GLenum, GLuint, GLuint, GLsizei, POINTER(GLfloat)], 'NV_parameter_buffer_object')
+
+# GL/glext.h:10494
+glProgramBufferParametersIivNV = _link_function('glProgramBufferParametersIivNV', None, [GLenum, GLuint, GLuint, GLsizei, POINTER(GLint)], 'NV_parameter_buffer_object')
+
+# GL/glext.h:10495
+glProgramBufferParametersIuivNV = _link_function('glProgramBufferParametersIuivNV', None, [GLenum, GLuint, GLuint, GLsizei, POINTER(GLuint)], 'NV_parameter_buffer_object')
+
+PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLsizei, POINTER(GLfloat)) # GL/glext.h:10497
+PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLsizei, POINTER(GLint)) # GL/glext.h:10498
+PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLsizei, POINTER(GLuint)) # GL/glext.h:10499
+# EXT_draw_buffers2 (GL/glext.h:10502)
+GL_EXT_draw_buffers2 = 1 # GL/glext.h:10503
+# GL/glext.h:10505
+glColorMaskIndexedEXT = _link_function('glColorMaskIndexedEXT', None, [GLuint, GLboolean, GLboolean, GLboolean, GLboolean], 'EXT_draw_buffers2')
+
+# GL/glext.h:10506
+glGetBooleanIndexedvEXT = _link_function('glGetBooleanIndexedvEXT', None, [GLenum, GLuint, POINTER(GLboolean)], 'EXT_draw_buffers2')
+
+# GL/glext.h:10507
+glGetIntegerIndexedvEXT = _link_function('glGetIntegerIndexedvEXT', None, [GLenum, GLuint, POINTER(GLint)], 'EXT_draw_buffers2')
+
+# GL/glext.h:10508
+glEnableIndexedEXT = _link_function('glEnableIndexedEXT', None, [GLenum, GLuint], 'EXT_draw_buffers2')
+
+# GL/glext.h:10509
+glDisableIndexedEXT = _link_function('glDisableIndexedEXT', None, [GLenum, GLuint], 'EXT_draw_buffers2')
+
+# GL/glext.h:10510
+glIsEnabledIndexedEXT = _link_function('glIsEnabledIndexedEXT', GLboolean, [GLenum, GLuint], 'EXT_draw_buffers2')
+
+PFNGLCOLORMASKINDEXEDEXTPROC = CFUNCTYPE(None, GLuint, GLboolean, GLboolean, GLboolean, GLboolean) # GL/glext.h:10512
+PFNGLGETBOOLEANINDEXEDVEXTPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLboolean)) # GL/glext.h:10513
+PFNGLGETINTEGERINDEXEDVEXTPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLint)) # GL/glext.h:10514
+PFNGLENABLEINDEXEDEXTPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:10515
+PFNGLDISABLEINDEXEDEXTPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:10516
+PFNGLISENABLEDINDEXEDEXTPROC = CFUNCTYPE(GLboolean, GLenum, GLuint) # GL/glext.h:10517
+# NV_transform_feedback (GL/glext.h:10520)
+GL_NV_transform_feedback = 1 # GL/glext.h:10521
+# GL/glext.h:10523
+glBeginTransformFeedbackNV = _link_function('glBeginTransformFeedbackNV', None, [GLenum], 'NV_transform_feedback')
+
+# GL/glext.h:10524
+glEndTransformFeedbackNV = _link_function('glEndTransformFeedbackNV', None, [], 'NV_transform_feedback')
+
+# GL/glext.h:10525
+glTransformFeedbackAttribsNV = _link_function('glTransformFeedbackAttribsNV', None, [GLuint, POINTER(GLint), GLenum], 'NV_transform_feedback')
+
+# GL/glext.h:10526
+glBindBufferRangeNV = _link_function('glBindBufferRangeNV', None, [GLenum, GLuint, GLuint, GLintptr, GLsizeiptr], 'NV_transform_feedback')
+
+# GL/glext.h:10527
+glBindBufferOffsetNV = _link_function('glBindBufferOffsetNV', None, [GLenum, GLuint, GLuint, GLintptr], 'NV_transform_feedback')
+
+# GL/glext.h:10528
+glBindBufferBaseNV = _link_function('glBindBufferBaseNV', None, [GLenum, GLuint, GLuint], 'NV_transform_feedback')
+
+# GL/glext.h:10529
+glTransformFeedbackVaryingsNV = _link_function('glTransformFeedbackVaryingsNV', None, [GLuint, GLsizei, POINTER(GLint), GLenum], 'NV_transform_feedback')
+
+# GL/glext.h:10530
+glActiveVaryingNV = _link_function('glActiveVaryingNV', None, [GLuint, POINTER(GLchar)], 'NV_transform_feedback')
+
+# GL/glext.h:10531
+glGetVaryingLocationNV = _link_function('glGetVaryingLocationNV', GLint, [GLuint, POINTER(GLchar)], 'NV_transform_feedback')
+
+# GL/glext.h:10532
+glGetActiveVaryingNV = _link_function('glGetActiveVaryingNV', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLsizei), POINTER(GLenum), POINTER(GLchar)], 'NV_transform_feedback')
+
+# GL/glext.h:10533
+glGetTransformFeedbackVaryingNV = _link_function('glGetTransformFeedbackVaryingNV', None, [GLuint, GLuint, POINTER(GLint)], 'NV_transform_feedback')
+
+# GL/glext.h:10534
+glTransformFeedbackStreamAttribsNV = _link_function('glTransformFeedbackStreamAttribsNV', None, [GLsizei, POINTER(GLint), GLsizei, POINTER(GLint), GLenum], 'NV_transform_feedback')
+
+PFNGLBEGINTRANSFORMFEEDBACKNVPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:10536
+PFNGLENDTRANSFORMFEEDBACKNVPROC = CFUNCTYPE(None) # GL/glext.h:10537
+PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLint), GLenum) # GL/glext.h:10538
+PFNGLBINDBUFFERRANGENVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLintptr, GLsizeiptr) # GL/glext.h:10539
+PFNGLBINDBUFFEROFFSETNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLintptr) # GL/glext.h:10540
+PFNGLBINDBUFFERBASENVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint) # GL/glext.h:10541
+PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLint), GLenum) # GL/glext.h:10542
+PFNGLACTIVEVARYINGNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLchar)) # GL/glext.h:10543
+PFNGLGETVARYINGLOCATIONNVPROC = CFUNCTYPE(GLint, GLuint, POINTER(GLchar)) # GL/glext.h:10544
+PFNGLGETACTIVEVARYINGNVPROC = CFUNCTYPE(None, GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLsizei), POINTER(GLenum), POINTER(GLchar)) # GL/glext.h:10545
+PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC = CFUNCTYPE(None, GLuint, GLuint, POINTER(GLint)) # GL/glext.h:10546
+PFNGLTRANSFORMFEEDBACKSTREAMATTRIBSNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLint), GLsizei, POINTER(GLint), GLenum) # GL/glext.h:10547
+# EXT_bindable_uniform (GL/glext.h:10550)
+GL_EXT_bindable_uniform = 1 # GL/glext.h:10551
+# GL/glext.h:10553
+glUniformBufferEXT = _link_function('glUniformBufferEXT', None, [GLuint, GLint, GLuint], 'EXT_bindable_uniform')
+
+# GL/glext.h:10554
+glGetUniformBufferSizeEXT = _link_function('glGetUniformBufferSizeEXT', GLint, [GLuint, GLint], 'EXT_bindable_uniform')
+
+# GL/glext.h:10555
+glGetUniformOffsetEXT = _link_function('glGetUniformOffsetEXT', GLintptr, [GLuint, GLint], 'EXT_bindable_uniform')
+
+PFNGLUNIFORMBUFFEREXTPROC = CFUNCTYPE(None, GLuint, GLint, GLuint) # GL/glext.h:10557
+PFNGLGETUNIFORMBUFFERSIZEEXTPROC = CFUNCTYPE(GLint, GLuint, GLint) # GL/glext.h:10558
+PFNGLGETUNIFORMOFFSETEXTPROC = CFUNCTYPE(GLintptr, GLuint, GLint) # GL/glext.h:10559
+# EXT_texture_integer (GL/glext.h:10562)
+GL_EXT_texture_integer = 1 # GL/glext.h:10563
+# GL/glext.h:10565
+glTexParameterIivEXT = _link_function('glTexParameterIivEXT', None, [GLenum, GLenum, POINTER(GLint)], 'EXT_texture_integer')
+
+# GL/glext.h:10566
+glTexParameterIuivEXT = _link_function('glTexParameterIuivEXT', None, [GLenum, GLenum, POINTER(GLuint)], 'EXT_texture_integer')
+
+# GL/glext.h:10567
+glGetTexParameterIivEXT = _link_function('glGetTexParameterIivEXT', None, [GLenum, GLenum, POINTER(GLint)], 'EXT_texture_integer')
+
+# GL/glext.h:10568
+glGetTexParameterIuivEXT = _link_function('glGetTexParameterIuivEXT', None, [GLenum, GLenum, POINTER(GLuint)], 'EXT_texture_integer')
+
+# GL/glext.h:10569
+glClearColorIiEXT = _link_function('glClearColorIiEXT', None, [GLint, GLint, GLint, GLint], 'EXT_texture_integer')
+
+# GL/glext.h:10570
+glClearColorIuiEXT = _link_function('glClearColorIuiEXT', None, [GLuint, GLuint, GLuint, GLuint], 'EXT_texture_integer')
+
+PFNGLTEXPARAMETERIIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:10572
+PFNGLTEXPARAMETERIUIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:10573
+PFNGLGETTEXPARAMETERIIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:10574
+PFNGLGETTEXPARAMETERIUIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:10575
+PFNGLCLEARCOLORIIEXTPROC = CFUNCTYPE(None, GLint, GLint, GLint, GLint) # GL/glext.h:10576
+PFNGLCLEARCOLORIUIEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:10577
+# GREMEDY_frame_terminator (GL/glext.h:10580)
+GL_GREMEDY_frame_terminator = 1 # GL/glext.h:10581
+# GL/glext.h:10583
+glFrameTerminatorGREMEDY = _link_function('glFrameTerminatorGREMEDY', None, [], 'GREMEDY_frame_terminator')
+
+PFNGLFRAMETERMINATORGREMEDYPROC = CFUNCTYPE(None) # GL/glext.h:10585
+# NV_conditional_render (GL/glext.h:10588)
+GL_NV_conditional_render = 1 # GL/glext.h:10589
+# GL/glext.h:10591
+glBeginConditionalRenderNV = _link_function('glBeginConditionalRenderNV', None, [GLuint, GLenum], 'NV_conditional_render')
+
+# GL/glext.h:10592
+glEndConditionalRenderNV = _link_function('glEndConditionalRenderNV', None, [], 'NV_conditional_render')
+
+PFNGLBEGINCONDITIONALRENDERNVPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:10594
+PFNGLENDCONDITIONALRENDERNVPROC = CFUNCTYPE(None) # GL/glext.h:10595
+# NV_present_video (GL/glext.h:10598)
+GL_NV_present_video = 1 # GL/glext.h:10599
+# GL/glext.h:10601
+glPresentFrameKeyedNV = _link_function('glPresentFrameKeyedNV', None, [GLuint, GLuint64EXT, GLuint, GLuint, GLenum, GLenum, GLuint, GLuint, GLenum, GLuint, GLuint], 'NV_present_video')
+
+# GL/glext.h:10602
+glPresentFrameDualFillNV = _link_function('glPresentFrameDualFillNV', None, [GLuint, GLuint64EXT, GLuint, GLuint, GLenum, GLenum, GLuint, GLenum, GLuint, GLenum, GLuint, GLenum, GLuint], 'NV_present_video')
+
+# GL/glext.h:10603
+glGetVideoivNV = _link_function('glGetVideoivNV', None, [GLuint, GLenum, POINTER(GLint)], 'NV_present_video')
+
+# GL/glext.h:10604
+glGetVideouivNV = _link_function('glGetVideouivNV', None, [GLuint, GLenum, POINTER(GLuint)], 'NV_present_video')
+
+# GL/glext.h:10605
+glGetVideoi64vNV = _link_function('glGetVideoi64vNV', None, [GLuint, GLenum, POINTER(GLint64EXT)], 'NV_present_video')
+
+# GL/glext.h:10606
+glGetVideoui64vNV = _link_function('glGetVideoui64vNV', None, [GLuint, GLenum, POINTER(GLuint64EXT)], 'NV_present_video')
+
+PFNGLPRESENTFRAMEKEYEDNVPROC = CFUNCTYPE(None, GLuint, GLuint64EXT, GLuint, GLuint, GLenum, GLenum, GLuint, GLuint, GLenum, GLuint, GLuint) # GL/glext.h:10608
+PFNGLPRESENTFRAMEDUALFILLNVPROC = CFUNCTYPE(None, GLuint, GLuint64EXT, GLuint, GLuint, GLenum, GLenum, GLuint, GLenum, GLuint, GLenum, GLuint, GLenum, GLuint) # GL/glext.h:10609
+PFNGLGETVIDEOIVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:10610
+PFNGLGETVIDEOUIVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint)) # GL/glext.h:10611
+PFNGLGETVIDEOI64VNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint64EXT)) # GL/glext.h:10612
+PFNGLGETVIDEOUI64VNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint64EXT)) # GL/glext.h:10613
+# EXT_transform_feedback (GL/glext.h:10616)
+GL_EXT_transform_feedback = 1 # GL/glext.h:10617
+# GL/glext.h:10619
+glBeginTransformFeedbackEXT = _link_function('glBeginTransformFeedbackEXT', None, [GLenum], 'EXT_transform_feedback')
+
+# GL/glext.h:10620
+glEndTransformFeedbackEXT = _link_function('glEndTransformFeedbackEXT', None, [], 'EXT_transform_feedback')
+
+# GL/glext.h:10621
+glBindBufferRangeEXT = _link_function('glBindBufferRangeEXT', None, [GLenum, GLuint, GLuint, GLintptr, GLsizeiptr], 'EXT_transform_feedback')
+
+# GL/glext.h:10622
+glBindBufferOffsetEXT = _link_function('glBindBufferOffsetEXT', None, [GLenum, GLuint, GLuint, GLintptr], 'EXT_transform_feedback')
+
+# GL/glext.h:10623
+glBindBufferBaseEXT = _link_function('glBindBufferBaseEXT', None, [GLenum, GLuint, GLuint], 'EXT_transform_feedback')
+
+# GL/glext.h:10624
+glTransformFeedbackVaryingsEXT = _link_function('glTransformFeedbackVaryingsEXT', None, [GLuint, GLsizei, POINTER(POINTER(GLchar)), GLenum], 'EXT_transform_feedback')
+
+# GL/glext.h:10625
+glGetTransformFeedbackVaryingEXT = _link_function('glGetTransformFeedbackVaryingEXT', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLsizei), POINTER(GLenum), POINTER(GLchar)], 'EXT_transform_feedback')
+
+PFNGLBEGINTRANSFORMFEEDBACKEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:10627
+PFNGLENDTRANSFORMFEEDBACKEXTPROC = CFUNCTYPE(None) # GL/glext.h:10628
+PFNGLBINDBUFFERRANGEEXTPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLintptr, GLsizeiptr) # GL/glext.h:10629
+PFNGLBINDBUFFEROFFSETEXTPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLintptr) # GL/glext.h:10630
+PFNGLBINDBUFFERBASEEXTPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint) # GL/glext.h:10631
+PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(POINTER(GLchar)), GLenum) # GL/glext.h:10632
+PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLsizei), POINTER(GLenum), POINTER(GLchar)) # GL/glext.h:10633
+# EXT_direct_state_access (GL/glext.h:10636)
+GL_EXT_direct_state_access = 1 # GL/glext.h:10637
+# GL/glext.h:10639
+glClientAttribDefaultEXT = _link_function('glClientAttribDefaultEXT', None, [GLbitfield], 'EXT_direct_state_access')
+
+# GL/glext.h:10640
+glPushClientAttribDefaultEXT = _link_function('glPushClientAttribDefaultEXT', None, [GLbitfield], 'EXT_direct_state_access')
+
+# GL/glext.h:10641
+glMatrixLoadfEXT = _link_function('glMatrixLoadfEXT', None, [GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10642
+glMatrixLoaddEXT = _link_function('glMatrixLoaddEXT', None, [GLenum, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10643
+glMatrixMultfEXT = _link_function('glMatrixMultfEXT', None, [GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10644
+glMatrixMultdEXT = _link_function('glMatrixMultdEXT', None, [GLenum, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10645
+glMatrixLoadIdentityEXT = _link_function('glMatrixLoadIdentityEXT', None, [GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:10646
+glMatrixRotatefEXT = _link_function('glMatrixRotatefEXT', None, [GLenum, GLfloat, GLfloat, GLfloat, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:10647
+glMatrixRotatedEXT = _link_function('glMatrixRotatedEXT', None, [GLenum, GLdouble, GLdouble, GLdouble, GLdouble], 'EXT_direct_state_access')
+
+# GL/glext.h:10648
+glMatrixScalefEXT = _link_function('glMatrixScalefEXT', None, [GLenum, GLfloat, GLfloat, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:10649
+glMatrixScaledEXT = _link_function('glMatrixScaledEXT', None, [GLenum, GLdouble, GLdouble, GLdouble], 'EXT_direct_state_access')
+
+# GL/glext.h:10650
+glMatrixTranslatefEXT = _link_function('glMatrixTranslatefEXT', None, [GLenum, GLfloat, GLfloat, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:10651
+glMatrixTranslatedEXT = _link_function('glMatrixTranslatedEXT', None, [GLenum, GLdouble, GLdouble, GLdouble], 'EXT_direct_state_access')
+
+# GL/glext.h:10652
+glMatrixFrustumEXT = _link_function('glMatrixFrustumEXT', None, [GLenum, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble], 'EXT_direct_state_access')
+
+# GL/glext.h:10653
+glMatrixOrthoEXT = _link_function('glMatrixOrthoEXT', None, [GLenum, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble], 'EXT_direct_state_access')
+
+# GL/glext.h:10654
+glMatrixPopEXT = _link_function('glMatrixPopEXT', None, [GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:10655
+glMatrixPushEXT = _link_function('glMatrixPushEXT', None, [GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:10656
+glMatrixLoadTransposefEXT = _link_function('glMatrixLoadTransposefEXT', None, [GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10657
+glMatrixLoadTransposedEXT = _link_function('glMatrixLoadTransposedEXT', None, [GLenum, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10658
+glMatrixMultTransposefEXT = _link_function('glMatrixMultTransposefEXT', None, [GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10659
+glMatrixMultTransposedEXT = _link_function('glMatrixMultTransposedEXT', None, [GLenum, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10660
+glTextureParameterfEXT = _link_function('glTextureParameterfEXT', None, [GLuint, GLenum, GLenum, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:10661
+glTextureParameterfvEXT = _link_function('glTextureParameterfvEXT', None, [GLuint, GLenum, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10662
+glTextureParameteriEXT = _link_function('glTextureParameteriEXT', None, [GLuint, GLenum, GLenum, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:10663
+glTextureParameterivEXT = _link_function('glTextureParameterivEXT', None, [GLuint, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10664
+glTextureImage1DEXT = _link_function('glTextureImage1DEXT', None, [GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10665
+glTextureImage2DEXT = _link_function('glTextureImage2DEXT', None, [GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10666
+glTextureSubImage1DEXT = _link_function('glTextureSubImage1DEXT', None, [GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10667
+glTextureSubImage2DEXT = _link_function('glTextureSubImage2DEXT', None, [GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10668
+glCopyTextureImage1DEXT = _link_function('glCopyTextureImage1DEXT', None, [GLuint, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:10669
+glCopyTextureImage2DEXT = _link_function('glCopyTextureImage2DEXT', None, [GLuint, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:10670
+glCopyTextureSubImage1DEXT = _link_function('glCopyTextureSubImage1DEXT', None, [GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei], 'EXT_direct_state_access')
+
+# GL/glext.h:10671
+glCopyTextureSubImage2DEXT = _link_function('glCopyTextureSubImage2DEXT', None, [GLuint, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], 'EXT_direct_state_access')
+
+# GL/glext.h:10672
+glGetTextureImageEXT = _link_function('glGetTextureImageEXT', None, [GLuint, GLenum, GLint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10673
+glGetTextureParameterfvEXT = _link_function('glGetTextureParameterfvEXT', None, [GLuint, GLenum, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10674
+glGetTextureParameterivEXT = _link_function('glGetTextureParameterivEXT', None, [GLuint, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10675
+glGetTextureLevelParameterfvEXT = _link_function('glGetTextureLevelParameterfvEXT', None, [GLuint, GLenum, GLint, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10676
+glGetTextureLevelParameterivEXT = _link_function('glGetTextureLevelParameterivEXT', None, [GLuint, GLenum, GLint, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10677
+glTextureImage3DEXT = _link_function('glTextureImage3DEXT', None, [GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10678
+glTextureSubImage3DEXT = _link_function('glTextureSubImage3DEXT', None, [GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10679
+glCopyTextureSubImage3DEXT = _link_function('glCopyTextureSubImage3DEXT', None, [GLuint, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], 'EXT_direct_state_access')
+
+# GL/glext.h:10680
+glMultiTexParameterfEXT = _link_function('glMultiTexParameterfEXT', None, [GLenum, GLenum, GLenum, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:10681
+glMultiTexParameterfvEXT = _link_function('glMultiTexParameterfvEXT', None, [GLenum, GLenum, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10682
+glMultiTexParameteriEXT = _link_function('glMultiTexParameteriEXT', None, [GLenum, GLenum, GLenum, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:10683
+glMultiTexParameterivEXT = _link_function('glMultiTexParameterivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10684
+glMultiTexImage1DEXT = _link_function('glMultiTexImage1DEXT', None, [GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10685
+glMultiTexImage2DEXT = _link_function('glMultiTexImage2DEXT', None, [GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10686
+glMultiTexSubImage1DEXT = _link_function('glMultiTexSubImage1DEXT', None, [GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10687
+glMultiTexSubImage2DEXT = _link_function('glMultiTexSubImage2DEXT', None, [GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10688
+glCopyMultiTexImage1DEXT = _link_function('glCopyMultiTexImage1DEXT', None, [GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:10689
+glCopyMultiTexImage2DEXT = _link_function('glCopyMultiTexImage2DEXT', None, [GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:10690
+glCopyMultiTexSubImage1DEXT = _link_function('glCopyMultiTexSubImage1DEXT', None, [GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei], 'EXT_direct_state_access')
+
+# GL/glext.h:10691
+glCopyMultiTexSubImage2DEXT = _link_function('glCopyMultiTexSubImage2DEXT', None, [GLenum, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], 'EXT_direct_state_access')
+
+# GL/glext.h:10692
+glGetMultiTexImageEXT = _link_function('glGetMultiTexImageEXT', None, [GLenum, GLenum, GLint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10693
+glGetMultiTexParameterfvEXT = _link_function('glGetMultiTexParameterfvEXT', None, [GLenum, GLenum, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10694
+glGetMultiTexParameterivEXT = _link_function('glGetMultiTexParameterivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10695
+glGetMultiTexLevelParameterfvEXT = _link_function('glGetMultiTexLevelParameterfvEXT', None, [GLenum, GLenum, GLint, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10696
+glGetMultiTexLevelParameterivEXT = _link_function('glGetMultiTexLevelParameterivEXT', None, [GLenum, GLenum, GLint, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10697
+glMultiTexImage3DEXT = _link_function('glMultiTexImage3DEXT', None, [GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10698
+glMultiTexSubImage3DEXT = _link_function('glMultiTexSubImage3DEXT', None, [GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10699
+glCopyMultiTexSubImage3DEXT = _link_function('glCopyMultiTexSubImage3DEXT', None, [GLenum, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], 'EXT_direct_state_access')
+
+# GL/glext.h:10700
+glBindMultiTextureEXT = _link_function('glBindMultiTextureEXT', None, [GLenum, GLenum, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:10701
+glEnableClientStateIndexedEXT = _link_function('glEnableClientStateIndexedEXT', None, [GLenum, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:10702
+glDisableClientStateIndexedEXT = _link_function('glDisableClientStateIndexedEXT', None, [GLenum, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:10703
+glMultiTexCoordPointerEXT = _link_function('glMultiTexCoordPointerEXT', None, [GLenum, GLint, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10704
+glMultiTexEnvfEXT = _link_function('glMultiTexEnvfEXT', None, [GLenum, GLenum, GLenum, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:10705
+glMultiTexEnvfvEXT = _link_function('glMultiTexEnvfvEXT', None, [GLenum, GLenum, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10706
+glMultiTexEnviEXT = _link_function('glMultiTexEnviEXT', None, [GLenum, GLenum, GLenum, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:10707
+glMultiTexEnvivEXT = _link_function('glMultiTexEnvivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10708
+glMultiTexGendEXT = _link_function('glMultiTexGendEXT', None, [GLenum, GLenum, GLenum, GLdouble], 'EXT_direct_state_access')
+
+# GL/glext.h:10709
+glMultiTexGendvEXT = _link_function('glMultiTexGendvEXT', None, [GLenum, GLenum, GLenum, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10710
+glMultiTexGenfEXT = _link_function('glMultiTexGenfEXT', None, [GLenum, GLenum, GLenum, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:10711
+glMultiTexGenfvEXT = _link_function('glMultiTexGenfvEXT', None, [GLenum, GLenum, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10712
+glMultiTexGeniEXT = _link_function('glMultiTexGeniEXT', None, [GLenum, GLenum, GLenum, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:10713
+glMultiTexGenivEXT = _link_function('glMultiTexGenivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10714
+glGetMultiTexEnvfvEXT = _link_function('glGetMultiTexEnvfvEXT', None, [GLenum, GLenum, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10715
+glGetMultiTexEnvivEXT = _link_function('glGetMultiTexEnvivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10716
+glGetMultiTexGendvEXT = _link_function('glGetMultiTexGendvEXT', None, [GLenum, GLenum, GLenum, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10717
+glGetMultiTexGenfvEXT = _link_function('glGetMultiTexGenfvEXT', None, [GLenum, GLenum, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10718
+glGetMultiTexGenivEXT = _link_function('glGetMultiTexGenivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10719
+glGetFloatIndexedvEXT = _link_function('glGetFloatIndexedvEXT', None, [GLenum, GLuint, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10720
+glGetDoubleIndexedvEXT = _link_function('glGetDoubleIndexedvEXT', None, [GLenum, GLuint, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10721
+glGetPointerIndexedvEXT = _link_function('glGetPointerIndexedvEXT', None, [GLenum, GLuint, POINTER(POINTER(GLvoid))], 'EXT_direct_state_access')
+
+# GL/glext.h:10722
+glCompressedTextureImage3DEXT = _link_function('glCompressedTextureImage3DEXT', None, [GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10723
+glCompressedTextureImage2DEXT = _link_function('glCompressedTextureImage2DEXT', None, [GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10724
+glCompressedTextureImage1DEXT = _link_function('glCompressedTextureImage1DEXT', None, [GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10725
+glCompressedTextureSubImage3DEXT = _link_function('glCompressedTextureSubImage3DEXT', None, [GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10726
+glCompressedTextureSubImage2DEXT = _link_function('glCompressedTextureSubImage2DEXT', None, [GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10727
+glCompressedTextureSubImage1DEXT = _link_function('glCompressedTextureSubImage1DEXT', None, [GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10728
+glGetCompressedTextureImageEXT = _link_function('glGetCompressedTextureImageEXT', None, [GLuint, GLenum, GLint, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10729
+glCompressedMultiTexImage3DEXT = _link_function('glCompressedMultiTexImage3DEXT', None, [GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10730
+glCompressedMultiTexImage2DEXT = _link_function('glCompressedMultiTexImage2DEXT', None, [GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10731
+glCompressedMultiTexImage1DEXT = _link_function('glCompressedMultiTexImage1DEXT', None, [GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10732
+glCompressedMultiTexSubImage3DEXT = _link_function('glCompressedMultiTexSubImage3DEXT', None, [GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10733
+glCompressedMultiTexSubImage2DEXT = _link_function('glCompressedMultiTexSubImage2DEXT', None, [GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10734
+glCompressedMultiTexSubImage1DEXT = _link_function('glCompressedMultiTexSubImage1DEXT', None, [GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10735
+glGetCompressedMultiTexImageEXT = _link_function('glGetCompressedMultiTexImageEXT', None, [GLenum, GLenum, GLint, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10736
+glNamedProgramStringEXT = _link_function('glNamedProgramStringEXT', None, [GLuint, GLenum, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10737
+glNamedProgramLocalParameter4dEXT = _link_function('glNamedProgramLocalParameter4dEXT', None, [GLuint, GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble], 'EXT_direct_state_access')
+
+# GL/glext.h:10738
+glNamedProgramLocalParameter4dvEXT = _link_function('glNamedProgramLocalParameter4dvEXT', None, [GLuint, GLenum, GLuint, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10739
+glNamedProgramLocalParameter4fEXT = _link_function('glNamedProgramLocalParameter4fEXT', None, [GLuint, GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:10740
+glNamedProgramLocalParameter4fvEXT = _link_function('glNamedProgramLocalParameter4fvEXT', None, [GLuint, GLenum, GLuint, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10741
+glGetNamedProgramLocalParameterdvEXT = _link_function('glGetNamedProgramLocalParameterdvEXT', None, [GLuint, GLenum, GLuint, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10742
+glGetNamedProgramLocalParameterfvEXT = _link_function('glGetNamedProgramLocalParameterfvEXT', None, [GLuint, GLenum, GLuint, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10743
+glGetNamedProgramivEXT = _link_function('glGetNamedProgramivEXT', None, [GLuint, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10744
+glGetNamedProgramStringEXT = _link_function('glGetNamedProgramStringEXT', None, [GLuint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10745
+glNamedProgramLocalParameters4fvEXT = _link_function('glNamedProgramLocalParameters4fvEXT', None, [GLuint, GLenum, GLuint, GLsizei, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10746
+glNamedProgramLocalParameterI4iEXT = _link_function('glNamedProgramLocalParameterI4iEXT', None, [GLuint, GLenum, GLuint, GLint, GLint, GLint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:10747
+glNamedProgramLocalParameterI4ivEXT = _link_function('glNamedProgramLocalParameterI4ivEXT', None, [GLuint, GLenum, GLuint, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10748
+glNamedProgramLocalParametersI4ivEXT = _link_function('glNamedProgramLocalParametersI4ivEXT', None, [GLuint, GLenum, GLuint, GLsizei, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10749
+glNamedProgramLocalParameterI4uiEXT = _link_function('glNamedProgramLocalParameterI4uiEXT', None, [GLuint, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:10750
+glNamedProgramLocalParameterI4uivEXT = _link_function('glNamedProgramLocalParameterI4uivEXT', None, [GLuint, GLenum, GLuint, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10751
+glNamedProgramLocalParametersI4uivEXT = _link_function('glNamedProgramLocalParametersI4uivEXT', None, [GLuint, GLenum, GLuint, GLsizei, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10752
+glGetNamedProgramLocalParameterIivEXT = _link_function('glGetNamedProgramLocalParameterIivEXT', None, [GLuint, GLenum, GLuint, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10753
+glGetNamedProgramLocalParameterIuivEXT = _link_function('glGetNamedProgramLocalParameterIuivEXT', None, [GLuint, GLenum, GLuint, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10754
+glTextureParameterIivEXT = _link_function('glTextureParameterIivEXT', None, [GLuint, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10755
+glTextureParameterIuivEXT = _link_function('glTextureParameterIuivEXT', None, [GLuint, GLenum, GLenum, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10756
+glGetTextureParameterIivEXT = _link_function('glGetTextureParameterIivEXT', None, [GLuint, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10757
+glGetTextureParameterIuivEXT = _link_function('glGetTextureParameterIuivEXT', None, [GLuint, GLenum, GLenum, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10758
+glMultiTexParameterIivEXT = _link_function('glMultiTexParameterIivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10759
+glMultiTexParameterIuivEXT = _link_function('glMultiTexParameterIuivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10760
+glGetMultiTexParameterIivEXT = _link_function('glGetMultiTexParameterIivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10761
+glGetMultiTexParameterIuivEXT = _link_function('glGetMultiTexParameterIuivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10762
+glProgramUniform1fEXT = _link_function('glProgramUniform1fEXT', None, [GLuint, GLint, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:10763
+glProgramUniform2fEXT = _link_function('glProgramUniform2fEXT', None, [GLuint, GLint, GLfloat, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:10764
+glProgramUniform3fEXT = _link_function('glProgramUniform3fEXT', None, [GLuint, GLint, GLfloat, GLfloat, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:10765
+glProgramUniform4fEXT = _link_function('glProgramUniform4fEXT', None, [GLuint, GLint, GLfloat, GLfloat, GLfloat, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:10766
+glProgramUniform1iEXT = _link_function('glProgramUniform1iEXT', None, [GLuint, GLint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:10767
+glProgramUniform2iEXT = _link_function('glProgramUniform2iEXT', None, [GLuint, GLint, GLint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:10768
+glProgramUniform3iEXT = _link_function('glProgramUniform3iEXT', None, [GLuint, GLint, GLint, GLint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:10769
+glProgramUniform4iEXT = _link_function('glProgramUniform4iEXT', None, [GLuint, GLint, GLint, GLint, GLint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:10770
+glProgramUniform1fvEXT = _link_function('glProgramUniform1fvEXT', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10771
+glProgramUniform2fvEXT = _link_function('glProgramUniform2fvEXT', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10772
+glProgramUniform3fvEXT = _link_function('glProgramUniform3fvEXT', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10773
+glProgramUniform4fvEXT = _link_function('glProgramUniform4fvEXT', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10774
+glProgramUniform1ivEXT = _link_function('glProgramUniform1ivEXT', None, [GLuint, GLint, GLsizei, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10775
+glProgramUniform2ivEXT = _link_function('glProgramUniform2ivEXT', None, [GLuint, GLint, GLsizei, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10776
+glProgramUniform3ivEXT = _link_function('glProgramUniform3ivEXT', None, [GLuint, GLint, GLsizei, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10777
+glProgramUniform4ivEXT = _link_function('glProgramUniform4ivEXT', None, [GLuint, GLint, GLsizei, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10778
+glProgramUniformMatrix2fvEXT = _link_function('glProgramUniformMatrix2fvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10779
+glProgramUniformMatrix3fvEXT = _link_function('glProgramUniformMatrix3fvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10780
+glProgramUniformMatrix4fvEXT = _link_function('glProgramUniformMatrix4fvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10781
+glProgramUniformMatrix2x3fvEXT = _link_function('glProgramUniformMatrix2x3fvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10782
+glProgramUniformMatrix3x2fvEXT = _link_function('glProgramUniformMatrix3x2fvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10783
+glProgramUniformMatrix2x4fvEXT = _link_function('glProgramUniformMatrix2x4fvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10784
+glProgramUniformMatrix4x2fvEXT = _link_function('glProgramUniformMatrix4x2fvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10785
+glProgramUniformMatrix3x4fvEXT = _link_function('glProgramUniformMatrix3x4fvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10786
+glProgramUniformMatrix4x3fvEXT = _link_function('glProgramUniformMatrix4x3fvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:10787
+glProgramUniform1uiEXT = _link_function('glProgramUniform1uiEXT', None, [GLuint, GLint, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:10788
+glProgramUniform2uiEXT = _link_function('glProgramUniform2uiEXT', None, [GLuint, GLint, GLuint, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:10789
+glProgramUniform3uiEXT = _link_function('glProgramUniform3uiEXT', None, [GLuint, GLint, GLuint, GLuint, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:10790
+glProgramUniform4uiEXT = _link_function('glProgramUniform4uiEXT', None, [GLuint, GLint, GLuint, GLuint, GLuint, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:10791
+glProgramUniform1uivEXT = _link_function('glProgramUniform1uivEXT', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10792
+glProgramUniform2uivEXT = _link_function('glProgramUniform2uivEXT', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10793
+glProgramUniform3uivEXT = _link_function('glProgramUniform3uivEXT', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10794
+glProgramUniform4uivEXT = _link_function('glProgramUniform4uivEXT', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10795
+glNamedBufferDataEXT = _link_function('glNamedBufferDataEXT', None, [GLuint, GLsizeiptr, POINTER(GLvoid), GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:10796
+glNamedBufferSubDataEXT = _link_function('glNamedBufferSubDataEXT', None, [GLuint, GLintptr, GLsizeiptr, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10797
+glMapNamedBufferEXT = _link_function('glMapNamedBufferEXT', POINTER(GLvoid), [GLuint, GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:10798
+glUnmapNamedBufferEXT = _link_function('glUnmapNamedBufferEXT', GLboolean, [GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:10799
+glMapNamedBufferRangeEXT = _link_function('glMapNamedBufferRangeEXT', POINTER(GLvoid), [GLuint, GLintptr, GLsizeiptr, GLbitfield], 'EXT_direct_state_access')
+
+# GL/glext.h:10800
+glFlushMappedNamedBufferRangeEXT = _link_function('glFlushMappedNamedBufferRangeEXT', None, [GLuint, GLintptr, GLsizeiptr], 'EXT_direct_state_access')
+
+# GL/glext.h:10801
+glNamedCopyBufferSubDataEXT = _link_function('glNamedCopyBufferSubDataEXT', None, [GLuint, GLuint, GLintptr, GLintptr, GLsizeiptr], 'EXT_direct_state_access')
+
+# GL/glext.h:10802
+glGetNamedBufferParameterivEXT = _link_function('glGetNamedBufferParameterivEXT', None, [GLuint, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10803
+glGetNamedBufferPointervEXT = _link_function('glGetNamedBufferPointervEXT', None, [GLuint, GLenum, POINTER(POINTER(GLvoid))], 'EXT_direct_state_access')
+
+# GL/glext.h:10804
+glGetNamedBufferSubDataEXT = _link_function('glGetNamedBufferSubDataEXT', None, [GLuint, GLintptr, GLsizeiptr, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:10805
+glTextureBufferEXT = _link_function('glTextureBufferEXT', None, [GLuint, GLenum, GLenum, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:10806
+glMultiTexBufferEXT = _link_function('glMultiTexBufferEXT', None, [GLenum, GLenum, GLenum, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:10807
+glNamedRenderbufferStorageEXT = _link_function('glNamedRenderbufferStorageEXT', None, [GLuint, GLenum, GLsizei, GLsizei], 'EXT_direct_state_access')
+
+# GL/glext.h:10808
+glGetNamedRenderbufferParameterivEXT = _link_function('glGetNamedRenderbufferParameterivEXT', None, [GLuint, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10809
+glCheckNamedFramebufferStatusEXT = _link_function('glCheckNamedFramebufferStatusEXT', GLenum, [GLuint, GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:10810
+glNamedFramebufferTexture1DEXT = _link_function('glNamedFramebufferTexture1DEXT', None, [GLuint, GLenum, GLenum, GLuint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:10811
+glNamedFramebufferTexture2DEXT = _link_function('glNamedFramebufferTexture2DEXT', None, [GLuint, GLenum, GLenum, GLuint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:10812
+glNamedFramebufferTexture3DEXT = _link_function('glNamedFramebufferTexture3DEXT', None, [GLuint, GLenum, GLenum, GLuint, GLint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:10813
+glNamedFramebufferRenderbufferEXT = _link_function('glNamedFramebufferRenderbufferEXT', None, [GLuint, GLenum, GLenum, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:10814
+glGetNamedFramebufferAttachmentParameterivEXT = _link_function('glGetNamedFramebufferAttachmentParameterivEXT', None, [GLuint, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10815
+glGenerateTextureMipmapEXT = _link_function('glGenerateTextureMipmapEXT', None, [GLuint, GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:10816
+glGenerateMultiTexMipmapEXT = _link_function('glGenerateMultiTexMipmapEXT', None, [GLenum, GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:10817
+glFramebufferDrawBufferEXT = _link_function('glFramebufferDrawBufferEXT', None, [GLuint, GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:10818
+glFramebufferDrawBuffersEXT = _link_function('glFramebufferDrawBuffersEXT', None, [GLuint, GLsizei, POINTER(GLenum)], 'EXT_direct_state_access')
+
+# GL/glext.h:10819
+glFramebufferReadBufferEXT = _link_function('glFramebufferReadBufferEXT', None, [GLuint, GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:10820
+glGetFramebufferParameterivEXT = _link_function('glGetFramebufferParameterivEXT', None, [GLuint, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:10821
+glNamedRenderbufferStorageMultisampleEXT = _link_function('glNamedRenderbufferStorageMultisampleEXT', None, [GLuint, GLsizei, GLenum, GLsizei, GLsizei], 'EXT_direct_state_access')
+
+# GL/glext.h:10822
+glNamedRenderbufferStorageMultisampleCoverageEXT = _link_function('glNamedRenderbufferStorageMultisampleCoverageEXT', None, [GLuint, GLsizei, GLsizei, GLenum, GLsizei, GLsizei], 'EXT_direct_state_access')
+
+# GL/glext.h:10823
+glNamedFramebufferTextureEXT = _link_function('glNamedFramebufferTextureEXT', None, [GLuint, GLenum, GLuint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:10824
+glNamedFramebufferTextureLayerEXT = _link_function('glNamedFramebufferTextureLayerEXT', None, [GLuint, GLenum, GLuint, GLint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:10825
+glNamedFramebufferTextureFaceEXT = _link_function('glNamedFramebufferTextureFaceEXT', None, [GLuint, GLenum, GLuint, GLint, GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:10826
+glTextureRenderbufferEXT = _link_function('glTextureRenderbufferEXT', None, [GLuint, GLenum, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:10827
+glMultiTexRenderbufferEXT = _link_function('glMultiTexRenderbufferEXT', None, [GLenum, GLenum, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:10828
+glProgramUniform1dEXT = _link_function('glProgramUniform1dEXT', None, [GLuint, GLint, GLdouble], 'EXT_direct_state_access')
+
+# GL/glext.h:10829
+glProgramUniform2dEXT = _link_function('glProgramUniform2dEXT', None, [GLuint, GLint, GLdouble, GLdouble], 'EXT_direct_state_access')
+
+# GL/glext.h:10830
+glProgramUniform3dEXT = _link_function('glProgramUniform3dEXT', None, [GLuint, GLint, GLdouble, GLdouble, GLdouble], 'EXT_direct_state_access')
+
+# GL/glext.h:10831
+glProgramUniform4dEXT = _link_function('glProgramUniform4dEXT', None, [GLuint, GLint, GLdouble, GLdouble, GLdouble, GLdouble], 'EXT_direct_state_access')
+
+# GL/glext.h:10832
+glProgramUniform1dvEXT = _link_function('glProgramUniform1dvEXT', None, [GLuint, GLint, GLsizei, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10833
+glProgramUniform2dvEXT = _link_function('glProgramUniform2dvEXT', None, [GLuint, GLint, GLsizei, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10834
+glProgramUniform3dvEXT = _link_function('glProgramUniform3dvEXT', None, [GLuint, GLint, GLsizei, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10835
+glProgramUniform4dvEXT = _link_function('glProgramUniform4dvEXT', None, [GLuint, GLint, GLsizei, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10836
+glProgramUniformMatrix2dvEXT = _link_function('glProgramUniformMatrix2dvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10837
+glProgramUniformMatrix3dvEXT = _link_function('glProgramUniformMatrix3dvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10838
+glProgramUniformMatrix4dvEXT = _link_function('glProgramUniformMatrix4dvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10839
+glProgramUniformMatrix2x3dvEXT = _link_function('glProgramUniformMatrix2x3dvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10840
+glProgramUniformMatrix2x4dvEXT = _link_function('glProgramUniformMatrix2x4dvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10841
+glProgramUniformMatrix3x2dvEXT = _link_function('glProgramUniformMatrix3x2dvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10842
+glProgramUniformMatrix3x4dvEXT = _link_function('glProgramUniformMatrix3x4dvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10843
+glProgramUniformMatrix4x2dvEXT = _link_function('glProgramUniformMatrix4x2dvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:10844
+glProgramUniformMatrix4x3dvEXT = _link_function('glProgramUniformMatrix4x3dvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+PFNGLCLIENTATTRIBDEFAULTEXTPROC = CFUNCTYPE(None, GLbitfield) # GL/glext.h:10846
+PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC = CFUNCTYPE(None, GLbitfield) # GL/glext.h:10847
+PFNGLMATRIXLOADFEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:10848
+PFNGLMATRIXLOADDEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:10849
+PFNGLMATRIXMULTFEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:10850
+PFNGLMATRIXMULTDEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:10851
+PFNGLMATRIXLOADIDENTITYEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:10852
+PFNGLMATRIXROTATEFEXTPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:10853
+PFNGLMATRIXROTATEDEXTPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:10854
+PFNGLMATRIXSCALEFEXTPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat, GLfloat) # GL/glext.h:10855
+PFNGLMATRIXSCALEDEXTPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble) # GL/glext.h:10856
+PFNGLMATRIXTRANSLATEFEXTPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat, GLfloat) # GL/glext.h:10857
+PFNGLMATRIXTRANSLATEDEXTPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble) # GL/glext.h:10858
+PFNGLMATRIXFRUSTUMEXTPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:10859
+PFNGLMATRIXORTHOEXTPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:10860
+PFNGLMATRIXPOPEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:10861
+PFNGLMATRIXPUSHEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:10862
+PFNGLMATRIXLOADTRANSPOSEFEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:10863
+PFNGLMATRIXLOADTRANSPOSEDEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:10864
+PFNGLMATRIXMULTTRANSPOSEFEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:10865
+PFNGLMATRIXMULTTRANSPOSEDEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:10866
+PFNGLTEXTUREPARAMETERFEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLfloat) # GL/glext.h:10867
+PFNGLTEXTUREPARAMETERFVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:10868
+PFNGLTEXTUREPARAMETERIEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLint) # GL/glext.h:10869
+PFNGLTEXTUREPARAMETERIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:10870
+PFNGLTEXTUREIMAGE1DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:10871
+PFNGLTEXTUREIMAGE2DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:10872
+PFNGLTEXTURESUBIMAGE1DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:10873
+PFNGLTEXTURESUBIMAGE2DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:10874
+PFNGLCOPYTEXTUREIMAGE1DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint) # GL/glext.h:10875
+PFNGLCOPYTEXTUREIMAGE2DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint) # GL/glext.h:10876
+PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei) # GL/glext.h:10877
+PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) # GL/glext.h:10878
+PFNGLGETTEXTUREIMAGEEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:10879
+PFNGLGETTEXTUREPARAMETERFVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:10880
+PFNGLGETTEXTUREPARAMETERIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:10881
+PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, POINTER(GLfloat)) # GL/glext.h:10882
+PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, POINTER(GLint)) # GL/glext.h:10883
+PFNGLTEXTUREIMAGE3DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:10884
+PFNGLTEXTURESUBIMAGE3DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:10885
+PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) # GL/glext.h:10886
+PFNGLMULTITEXPARAMETERFEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLfloat) # GL/glext.h:10887
+PFNGLMULTITEXPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:10888
+PFNGLMULTITEXPARAMETERIEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLint) # GL/glext.h:10889
+PFNGLMULTITEXPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:10890
+PFNGLMULTITEXIMAGE1DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:10891
+PFNGLMULTITEXIMAGE2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:10892
+PFNGLMULTITEXSUBIMAGE1DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:10893
+PFNGLMULTITEXSUBIMAGE2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:10894
+PFNGLCOPYMULTITEXIMAGE1DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint) # GL/glext.h:10895
+PFNGLCOPYMULTITEXIMAGE2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint) # GL/glext.h:10896
+PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei) # GL/glext.h:10897
+PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) # GL/glext.h:10898
+PFNGLGETMULTITEXIMAGEEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:10899
+PFNGLGETMULTITEXPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:10900
+PFNGLGETMULTITEXPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:10901
+PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, POINTER(GLfloat)) # GL/glext.h:10902
+PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, POINTER(GLint)) # GL/glext.h:10903
+PFNGLMULTITEXIMAGE3DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:10904
+PFNGLMULTITEXSUBIMAGE3DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:10905
+PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) # GL/glext.h:10906
+PFNGLBINDMULTITEXTUREEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint) # GL/glext.h:10907
+PFNGLENABLECLIENTSTATEINDEXEDEXTPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:10908
+PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:10909
+PFNGLMULTITEXCOORDPOINTEREXTPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:10910
+PFNGLMULTITEXENVFEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLfloat) # GL/glext.h:10911
+PFNGLMULTITEXENVFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:10912
+PFNGLMULTITEXENVIEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLint) # GL/glext.h:10913
+PFNGLMULTITEXENVIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:10914
+PFNGLMULTITEXGENDEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLdouble) # GL/glext.h:10915
+PFNGLMULTITEXGENDVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLdouble)) # GL/glext.h:10916
+PFNGLMULTITEXGENFEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLfloat) # GL/glext.h:10917
+PFNGLMULTITEXGENFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:10918
+PFNGLMULTITEXGENIEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLint) # GL/glext.h:10919
+PFNGLMULTITEXGENIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:10920
+PFNGLGETMULTITEXENVFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:10921
+PFNGLGETMULTITEXENVIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:10922
+PFNGLGETMULTITEXGENDVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLdouble)) # GL/glext.h:10923
+PFNGLGETMULTITEXGENFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:10924
+PFNGLGETMULTITEXGENIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:10925
+PFNGLGETFLOATINDEXEDVEXTPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:10926
+PFNGLGETDOUBLEINDEXEDVEXTPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLdouble)) # GL/glext.h:10927
+PFNGLGETPOINTERINDEXEDVEXTPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(POINTER(GLvoid))) # GL/glext.h:10928
+PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # GL/glext.h:10929
+PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # GL/glext.h:10930
+PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # GL/glext.h:10931
+PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:10932
+PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:10933
+PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:10934
+PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, POINTER(GLvoid)) # GL/glext.h:10935
+PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # GL/glext.h:10936
+PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # GL/glext.h:10937
+PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # GL/glext.h:10938
+PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:10939
+PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:10940
+PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:10941
+PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, POINTER(GLvoid)) # GL/glext.h:10942
+PFNGLNAMEDPROGRAMSTRINGEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:10943
+PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:10944
+PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, POINTER(GLdouble)) # GL/glext.h:10945
+PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:10946
+PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:10947
+PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, POINTER(GLdouble)) # GL/glext.h:10948
+PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:10949
+PFNGLGETNAMEDPROGRAMIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:10950
+PFNGLGETNAMEDPROGRAMSTRINGEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:10951
+PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLsizei, POINTER(GLfloat)) # GL/glext.h:10952
+PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLint, GLint, GLint, GLint) # GL/glext.h:10953
+PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, POINTER(GLint)) # GL/glext.h:10954
+PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLsizei, POINTER(GLint)) # GL/glext.h:10955
+PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:10956
+PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, POINTER(GLuint)) # GL/glext.h:10957
+PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLsizei, POINTER(GLuint)) # GL/glext.h:10958
+PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, POINTER(GLint)) # GL/glext.h:10959
+PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, POINTER(GLuint)) # GL/glext.h:10960
+PFNGLTEXTUREPARAMETERIIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:10961
+PFNGLTEXTUREPARAMETERIUIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:10962
+PFNGLGETTEXTUREPARAMETERIIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:10963
+PFNGLGETTEXTUREPARAMETERIUIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:10964
+PFNGLMULTITEXPARAMETERIIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:10965
+PFNGLMULTITEXPARAMETERIUIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:10966
+PFNGLGETMULTITEXPARAMETERIIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:10967
+PFNGLGETMULTITEXPARAMETERIUIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:10968
+PFNGLPROGRAMUNIFORM1FEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLfloat) # GL/glext.h:10969
+PFNGLPROGRAMUNIFORM2FEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLfloat, GLfloat) # GL/glext.h:10970
+PFNGLPROGRAMUNIFORM3FEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLfloat, GLfloat, GLfloat) # GL/glext.h:10971
+PFNGLPROGRAMUNIFORM4FEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:10972
+PFNGLPROGRAMUNIFORM1IEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLint) # GL/glext.h:10973
+PFNGLPROGRAMUNIFORM2IEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLint, GLint) # GL/glext.h:10974
+PFNGLPROGRAMUNIFORM3IEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLint, GLint, GLint) # GL/glext.h:10975
+PFNGLPROGRAMUNIFORM4IEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLint, GLint, GLint, GLint) # GL/glext.h:10976
+PFNGLPROGRAMUNIFORM1FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:10977
+PFNGLPROGRAMUNIFORM2FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:10978
+PFNGLPROGRAMUNIFORM3FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:10979
+PFNGLPROGRAMUNIFORM4FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:10980
+PFNGLPROGRAMUNIFORM1IVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:10981
+PFNGLPROGRAMUNIFORM2IVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:10982
+PFNGLPROGRAMUNIFORM3IVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:10983
+PFNGLPROGRAMUNIFORM4IVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:10984
+PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:10985
+PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:10986
+PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:10987
+PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:10988
+PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:10989
+PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:10990
+PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:10991
+PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:10992
+PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:10993
+PFNGLPROGRAMUNIFORM1UIEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLuint) # GL/glext.h:10994
+PFNGLPROGRAMUNIFORM2UIEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLuint, GLuint) # GL/glext.h:10995
+PFNGLPROGRAMUNIFORM3UIEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLuint, GLuint, GLuint) # GL/glext.h:10996
+PFNGLPROGRAMUNIFORM4UIEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:10997
+PFNGLPROGRAMUNIFORM1UIVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:10998
+PFNGLPROGRAMUNIFORM2UIVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:10999
+PFNGLPROGRAMUNIFORM3UIVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:11000
+PFNGLPROGRAMUNIFORM4UIVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:11001
+PFNGLNAMEDBUFFERDATAEXTPROC = CFUNCTYPE(None, GLuint, GLsizeiptr, POINTER(GLvoid), GLenum) # GL/glext.h:11002
+PFNGLNAMEDBUFFERSUBDATAEXTPROC = CFUNCTYPE(None, GLuint, GLintptr, GLsizeiptr, POINTER(GLvoid)) # GL/glext.h:11003
+PFNGLMAPNAMEDBUFFEREXTPROC = CFUNCTYPE(POINTER(GLvoid), GLuint, GLenum) # GL/glext.h:11004
+PFNGLUNMAPNAMEDBUFFEREXTPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:11005
+PFNGLMAPNAMEDBUFFERRANGEEXTPROC = CFUNCTYPE(POINTER(GLvoid), GLuint, GLintptr, GLsizeiptr, GLbitfield) # GL/glext.h:11006
+PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC = CFUNCTYPE(None, GLuint, GLintptr, GLsizeiptr) # GL/glext.h:11007
+PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLintptr, GLintptr, GLsizeiptr) # GL/glext.h:11008
+PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:11009
+PFNGLGETNAMEDBUFFERPOINTERVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:11010
+PFNGLGETNAMEDBUFFERSUBDATAEXTPROC = CFUNCTYPE(None, GLuint, GLintptr, GLsizeiptr, POINTER(GLvoid)) # GL/glext.h:11011
+PFNGLTEXTUREBUFFEREXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLuint) # GL/glext.h:11012
+PFNGLMULTITEXBUFFEREXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLuint) # GL/glext.h:11013
+PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLsizei, GLsizei) # GL/glext.h:11014
+PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:11015
+PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC = CFUNCTYPE(GLenum, GLuint, GLenum) # GL/glext.h:11016
+PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLuint, GLint) # GL/glext.h:11017
+PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLuint, GLint) # GL/glext.h:11018
+PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLuint, GLint, GLint) # GL/glext.h:11019
+PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLuint) # GL/glext.h:11020
+PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:11021
+PFNGLGENERATETEXTUREMIPMAPEXTPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:11022
+PFNGLGENERATEMULTITEXMIPMAPEXTPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:11023
+PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:11024
+PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLenum)) # GL/glext.h:11025
+PFNGLFRAMEBUFFERREADBUFFEREXTPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:11026
+PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:11027
+PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC = CFUNCTYPE(None, GLuint, GLsizei, GLenum, GLsizei, GLsizei) # GL/glext.h:11028
+PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC = CFUNCTYPE(None, GLuint, GLsizei, GLsizei, GLenum, GLsizei, GLsizei) # GL/glext.h:11029
+PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLint) # GL/glext.h:11030
+PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLint, GLint) # GL/glext.h:11031
+PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLint, GLenum) # GL/glext.h:11032
+PFNGLTEXTURERENDERBUFFEREXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint) # GL/glext.h:11033
+PFNGLMULTITEXRENDERBUFFEREXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint) # GL/glext.h:11034
+PFNGLPROGRAMUNIFORM1DEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLdouble) # GL/glext.h:11035
+PFNGLPROGRAMUNIFORM2DEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLdouble, GLdouble) # GL/glext.h:11036
+PFNGLPROGRAMUNIFORM3DEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLdouble, GLdouble, GLdouble) # GL/glext.h:11037
+PFNGLPROGRAMUNIFORM4DEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:11038
+PFNGLPROGRAMUNIFORM1DVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLdouble)) # GL/glext.h:11039
+PFNGLPROGRAMUNIFORM2DVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLdouble)) # GL/glext.h:11040
+PFNGLPROGRAMUNIFORM3DVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLdouble)) # GL/glext.h:11041
+PFNGLPROGRAMUNIFORM4DVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLdouble)) # GL/glext.h:11042
+PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:11043
+PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:11044
+PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:11045
+PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:11046
+PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:11047
+PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:11048
+PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:11049
+PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:11050
+PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)) # GL/glext.h:11051
+# EXT_vertex_array_bgra (GL/glext.h:11054)
+GL_EXT_vertex_array_bgra = 1 # GL/glext.h:11055
+# EXT_texture_swizzle (GL/glext.h:11058)
+GL_EXT_texture_swizzle = 1 # GL/glext.h:11059
+# NV_explicit_multisample (GL/glext.h:11062)
+GL_NV_explicit_multisample = 1 # GL/glext.h:11063
+# GL/glext.h:11065
+glGetMultisamplefvNV = _link_function('glGetMultisamplefvNV', None, [GLenum, GLuint, POINTER(GLfloat)], 'NV_explicit_multisample')
+
+# GL/glext.h:11066
+glSampleMaskIndexedNV = _link_function('glSampleMaskIndexedNV', None, [GLuint, GLbitfield], 'NV_explicit_multisample')
+
+# GL/glext.h:11067
+glTexRenderbufferNV = _link_function('glTexRenderbufferNV', None, [GLenum, GLuint], 'NV_explicit_multisample')
+
+PFNGLGETMULTISAMPLEFVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:11069
+PFNGLSAMPLEMASKINDEXEDNVPROC = CFUNCTYPE(None, GLuint, GLbitfield) # GL/glext.h:11070
+PFNGLTEXRENDERBUFFERNVPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:11071
+# NV_transform_feedback2 (GL/glext.h:11074)
+GL_NV_transform_feedback2 = 1 # GL/glext.h:11075
+# GL/glext.h:11077
+glBindTransformFeedbackNV = _link_function('glBindTransformFeedbackNV', None, [GLenum, GLuint], 'NV_transform_feedback2')
+
+# GL/glext.h:11078
+glDeleteTransformFeedbacksNV = _link_function('glDeleteTransformFeedbacksNV', None, [GLsizei, POINTER(GLuint)], 'NV_transform_feedback2')
+
+# GL/glext.h:11079
+glGenTransformFeedbacksNV = _link_function('glGenTransformFeedbacksNV', None, [GLsizei, POINTER(GLuint)], 'NV_transform_feedback2')
+
+# GL/glext.h:11080
+glIsTransformFeedbackNV = _link_function('glIsTransformFeedbackNV', GLboolean, [GLuint], 'NV_transform_feedback2')
+
+# GL/glext.h:11081
+glPauseTransformFeedbackNV = _link_function('glPauseTransformFeedbackNV', None, [], 'NV_transform_feedback2')
+
+# GL/glext.h:11082
+glResumeTransformFeedbackNV = _link_function('glResumeTransformFeedbackNV', None, [], 'NV_transform_feedback2')
+
+# GL/glext.h:11083
+glDrawTransformFeedbackNV = _link_function('glDrawTransformFeedbackNV', None, [GLenum, GLuint], 'NV_transform_feedback2')
+
+PFNGLBINDTRANSFORMFEEDBACKNVPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:11085
+PFNGLDELETETRANSFORMFEEDBACKSNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:11086
+PFNGLGENTRANSFORMFEEDBACKSNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:11087
+PFNGLISTRANSFORMFEEDBACKNVPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:11088
+PFNGLPAUSETRANSFORMFEEDBACKNVPROC = CFUNCTYPE(None) # GL/glext.h:11089
+PFNGLRESUMETRANSFORMFEEDBACKNVPROC = CFUNCTYPE(None) # GL/glext.h:11090
+PFNGLDRAWTRANSFORMFEEDBACKNVPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:11091
+# ATI_meminfo (GL/glext.h:11094)
+GL_ATI_meminfo = 1 # GL/glext.h:11095
+# AMD_performance_monitor (GL/glext.h:11098)
+GL_AMD_performance_monitor = 1 # GL/glext.h:11099
+# GL/glext.h:11101
+glGetPerfMonitorGroupsAMD = _link_function('glGetPerfMonitorGroupsAMD', None, [POINTER(GLint), GLsizei, POINTER(GLuint)], 'AMD_performance_monitor')
+
+# GL/glext.h:11102
+glGetPerfMonitorCountersAMD = _link_function('glGetPerfMonitorCountersAMD', None, [GLuint, POINTER(GLint), POINTER(GLint), GLsizei, POINTER(GLuint)], 'AMD_performance_monitor')
+
+# GL/glext.h:11103
+glGetPerfMonitorGroupStringAMD = _link_function('glGetPerfMonitorGroupStringAMD', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], 'AMD_performance_monitor')
+
+# GL/glext.h:11104
+glGetPerfMonitorCounterStringAMD = _link_function('glGetPerfMonitorCounterStringAMD', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], 'AMD_performance_monitor')
+
+# GL/glext.h:11105
+glGetPerfMonitorCounterInfoAMD = _link_function('glGetPerfMonitorCounterInfoAMD', None, [GLuint, GLuint, GLenum, POINTER(GLvoid)], 'AMD_performance_monitor')
+
+# GL/glext.h:11106
+glGenPerfMonitorsAMD = _link_function('glGenPerfMonitorsAMD', None, [GLsizei, POINTER(GLuint)], 'AMD_performance_monitor')
+
+# GL/glext.h:11107
+glDeletePerfMonitorsAMD = _link_function('glDeletePerfMonitorsAMD', None, [GLsizei, POINTER(GLuint)], 'AMD_performance_monitor')
+
+# GL/glext.h:11108
+glSelectPerfMonitorCountersAMD = _link_function('glSelectPerfMonitorCountersAMD', None, [GLuint, GLboolean, GLuint, GLint, POINTER(GLuint)], 'AMD_performance_monitor')
+
+# GL/glext.h:11109
+glBeginPerfMonitorAMD = _link_function('glBeginPerfMonitorAMD', None, [GLuint], 'AMD_performance_monitor')
+
+# GL/glext.h:11110
+glEndPerfMonitorAMD = _link_function('glEndPerfMonitorAMD', None, [GLuint], 'AMD_performance_monitor')
+
+# GL/glext.h:11111
+glGetPerfMonitorCounterDataAMD = _link_function('glGetPerfMonitorCounterDataAMD', None, [GLuint, GLenum, GLsizei, POINTER(GLuint), POINTER(GLint)], 'AMD_performance_monitor')
+
+PFNGLGETPERFMONITORGROUPSAMDPROC = CFUNCTYPE(None, POINTER(GLint), GLsizei, POINTER(GLuint)) # GL/glext.h:11113
+PFNGLGETPERFMONITORCOUNTERSAMDPROC = CFUNCTYPE(None, GLuint, POINTER(GLint), POINTER(GLint), GLsizei, POINTER(GLuint)) # GL/glext.h:11114
+PFNGLGETPERFMONITORGROUPSTRINGAMDPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)) # GL/glext.h:11115
+PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC = CFUNCTYPE(None, GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)) # GL/glext.h:11116
+PFNGLGETPERFMONITORCOUNTERINFOAMDPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum, POINTER(GLvoid)) # GL/glext.h:11117
+PFNGLGENPERFMONITORSAMDPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:11118
+PFNGLDELETEPERFMONITORSAMDPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:11119
+PFNGLSELECTPERFMONITORCOUNTERSAMDPROC = CFUNCTYPE(None, GLuint, GLboolean, GLuint, GLint, POINTER(GLuint)) # GL/glext.h:11120
+PFNGLBEGINPERFMONITORAMDPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:11121
+PFNGLENDPERFMONITORAMDPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:11122
+PFNGLGETPERFMONITORCOUNTERDATAAMDPROC = CFUNCTYPE(None, GLuint, GLenum, GLsizei, POINTER(GLuint), POINTER(GLint)) # GL/glext.h:11123
+# AMD_texture_texture4 (GL/glext.h:11126)
+GL_AMD_texture_texture4 = 1 # GL/glext.h:11127
+# AMD_vertex_shader_tesselator (GL/glext.h:11130)
+GL_AMD_vertex_shader_tesselator = 1 # GL/glext.h:11131
+# GL/glext.h:11133
+glTessellationFactorAMD = _link_function('glTessellationFactorAMD', None, [GLfloat], 'AMD_vertex_shader_tesselator')
+
+# GL/glext.h:11134
+glTessellationModeAMD = _link_function('glTessellationModeAMD', None, [GLenum], 'AMD_vertex_shader_tesselator')
+
+PFNGLTESSELLATIONFACTORAMDPROC = CFUNCTYPE(None, GLfloat) # GL/glext.h:11136
+PFNGLTESSELLATIONMODEAMDPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:11137
+# EXT_provoking_vertex (GL/glext.h:11140)
+GL_EXT_provoking_vertex = 1 # GL/glext.h:11141
+# GL/glext.h:11143
+glProvokingVertexEXT = _link_function('glProvokingVertexEXT', None, [GLenum], 'EXT_provoking_vertex')
+
+PFNGLPROVOKINGVERTEXEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:11145
+# EXT_texture_snorm (GL/glext.h:11148)
+GL_EXT_texture_snorm = 1 # GL/glext.h:11149
+# AMD_draw_buffers_blend (GL/glext.h:11152)
+GL_AMD_draw_buffers_blend = 1 # GL/glext.h:11153
+# GL/glext.h:11155
+glBlendFuncIndexedAMD = _link_function('glBlendFuncIndexedAMD', None, [GLuint, GLenum, GLenum], 'AMD_draw_buffers_blend')
+
+# GL/glext.h:11156
+glBlendFuncSeparateIndexedAMD = _link_function('glBlendFuncSeparateIndexedAMD', None, [GLuint, GLenum, GLenum, GLenum, GLenum], 'AMD_draw_buffers_blend')
+
+# GL/glext.h:11157
+glBlendEquationIndexedAMD = _link_function('glBlendEquationIndexedAMD', None, [GLuint, GLenum], 'AMD_draw_buffers_blend')
+
+# GL/glext.h:11158
+glBlendEquationSeparateIndexedAMD = _link_function('glBlendEquationSeparateIndexedAMD', None, [GLuint, GLenum, GLenum], 'AMD_draw_buffers_blend')
+
+PFNGLBLENDFUNCINDEXEDAMDPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum) # GL/glext.h:11160
+PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:11161
+PFNGLBLENDEQUATIONINDEXEDAMDPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:11162
+PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum) # GL/glext.h:11163
+# APPLE_texture_range (GL/glext.h:11166)
+GL_APPLE_texture_range = 1 # GL/glext.h:11167
+# GL/glext.h:11169
+glTextureRangeAPPLE = _link_function('glTextureRangeAPPLE', None, [GLenum, GLsizei, POINTER(GLvoid)], 'APPLE_texture_range')
+
+# GL/glext.h:11170
+glGetTexParameterPointervAPPLE = _link_function('glGetTexParameterPointervAPPLE', None, [GLenum, GLenum, POINTER(POINTER(GLvoid))], 'APPLE_texture_range')
+
+PFNGLTEXTURERANGEAPPLEPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:11172
+PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:11173
+# APPLE_float_pixels (GL/glext.h:11176)
+GL_APPLE_float_pixels = 1 # GL/glext.h:11177
+# APPLE_vertex_program_evaluators (GL/glext.h:11180)
+GL_APPLE_vertex_program_evaluators = 1 # GL/glext.h:11181
+# GL/glext.h:11183
+glEnableVertexAttribAPPLE = _link_function('glEnableVertexAttribAPPLE', None, [GLuint, GLenum], 'APPLE_vertex_program_evaluators')
+
+# GL/glext.h:11184
+glDisableVertexAttribAPPLE = _link_function('glDisableVertexAttribAPPLE', None, [GLuint, GLenum], 'APPLE_vertex_program_evaluators')
+
+# GL/glext.h:11185
+glIsVertexAttribEnabledAPPLE = _link_function('glIsVertexAttribEnabledAPPLE', GLboolean, [GLuint, GLenum], 'APPLE_vertex_program_evaluators')
+
+# GL/glext.h:11186
+glMapVertexAttrib1dAPPLE = _link_function('glMapVertexAttrib1dAPPLE', None, [GLuint, GLuint, GLdouble, GLdouble, GLint, GLint, POINTER(GLdouble)], 'APPLE_vertex_program_evaluators')
+
+# GL/glext.h:11187
+glMapVertexAttrib1fAPPLE = _link_function('glMapVertexAttrib1fAPPLE', None, [GLuint, GLuint, GLfloat, GLfloat, GLint, GLint, POINTER(GLfloat)], 'APPLE_vertex_program_evaluators')
+
+# GL/glext.h:11188
+glMapVertexAttrib2dAPPLE = _link_function('glMapVertexAttrib2dAPPLE', None, [GLuint, GLuint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, POINTER(GLdouble)], 'APPLE_vertex_program_evaluators')
+
+# GL/glext.h:11189
+glMapVertexAttrib2fAPPLE = _link_function('glMapVertexAttrib2fAPPLE', None, [GLuint, GLuint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, POINTER(GLfloat)], 'APPLE_vertex_program_evaluators')
+
+PFNGLENABLEVERTEXATTRIBAPPLEPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:11191
+PFNGLDISABLEVERTEXATTRIBAPPLEPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:11192
+PFNGLISVERTEXATTRIBENABLEDAPPLEPROC = CFUNCTYPE(GLboolean, GLuint, GLenum) # GL/glext.h:11193
+PFNGLMAPVERTEXATTRIB1DAPPLEPROC = CFUNCTYPE(None, GLuint, GLuint, GLdouble, GLdouble, GLint, GLint, POINTER(GLdouble)) # GL/glext.h:11194
+PFNGLMAPVERTEXATTRIB1FAPPLEPROC = CFUNCTYPE(None, GLuint, GLuint, GLfloat, GLfloat, GLint, GLint, POINTER(GLfloat)) # GL/glext.h:11195
+PFNGLMAPVERTEXATTRIB2DAPPLEPROC = CFUNCTYPE(None, GLuint, GLuint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, POINTER(GLdouble)) # GL/glext.h:11196
+PFNGLMAPVERTEXATTRIB2FAPPLEPROC = CFUNCTYPE(None, GLuint, GLuint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, POINTER(GLfloat)) # GL/glext.h:11197
+# APPLE_aux_depth_stencil (GL/glext.h:11200)
+GL_APPLE_aux_depth_stencil = 1 # GL/glext.h:11201
+# APPLE_object_purgeable (GL/glext.h:11204)
+GL_APPLE_object_purgeable = 1 # GL/glext.h:11205
+# GL/glext.h:11207
+glObjectPurgeableAPPLE = _link_function('glObjectPurgeableAPPLE', GLenum, [GLenum, GLuint, GLenum], 'APPLE_object_purgeable')
+
+# GL/glext.h:11208
+glObjectUnpurgeableAPPLE = _link_function('glObjectUnpurgeableAPPLE', GLenum, [GLenum, GLuint, GLenum], 'APPLE_object_purgeable')
+
+# GL/glext.h:11209
+glGetObjectParameterivAPPLE = _link_function('glGetObjectParameterivAPPLE', None, [GLenum, GLuint, GLenum, POINTER(GLint)], 'APPLE_object_purgeable')
+
+PFNGLOBJECTPURGEABLEAPPLEPROC = CFUNCTYPE(GLenum, GLenum, GLuint, GLenum) # GL/glext.h:11211
+PFNGLOBJECTUNPURGEABLEAPPLEPROC = CFUNCTYPE(GLenum, GLenum, GLuint, GLenum) # GL/glext.h:11212
+PFNGLGETOBJECTPARAMETERIVAPPLEPROC = CFUNCTYPE(None, GLenum, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:11213
+# APPLE_row_bytes (GL/glext.h:11216)
+GL_APPLE_row_bytes = 1 # GL/glext.h:11217
+# APPLE_rgb_422 (GL/glext.h:11220)
+GL_APPLE_rgb_422 = 1 # GL/glext.h:11221
+# NV_video_capture (GL/glext.h:11224)
+GL_NV_video_capture = 1 # GL/glext.h:11225
+# GL/glext.h:11227
+glBeginVideoCaptureNV = _link_function('glBeginVideoCaptureNV', None, [GLuint], 'NV_video_capture')
+
+# GL/glext.h:11228
+glBindVideoCaptureStreamBufferNV = _link_function('glBindVideoCaptureStreamBufferNV', None, [GLuint, GLuint, GLenum, GLintptrARB], 'NV_video_capture')
+
+# GL/glext.h:11229
+glBindVideoCaptureStreamTextureNV = _link_function('glBindVideoCaptureStreamTextureNV', None, [GLuint, GLuint, GLenum, GLenum, GLuint], 'NV_video_capture')
+
+# GL/glext.h:11230
+glEndVideoCaptureNV = _link_function('glEndVideoCaptureNV', None, [GLuint], 'NV_video_capture')
+
+# GL/glext.h:11231
+glGetVideoCaptureivNV = _link_function('glGetVideoCaptureivNV', None, [GLuint, GLenum, POINTER(GLint)], 'NV_video_capture')
+
+# GL/glext.h:11232
+glGetVideoCaptureStreamivNV = _link_function('glGetVideoCaptureStreamivNV', None, [GLuint, GLuint, GLenum, POINTER(GLint)], 'NV_video_capture')
+
+# GL/glext.h:11233
+glGetVideoCaptureStreamfvNV = _link_function('glGetVideoCaptureStreamfvNV', None, [GLuint, GLuint, GLenum, POINTER(GLfloat)], 'NV_video_capture')
+
+# GL/glext.h:11234
+glGetVideoCaptureStreamdvNV = _link_function('glGetVideoCaptureStreamdvNV', None, [GLuint, GLuint, GLenum, POINTER(GLdouble)], 'NV_video_capture')
+
+# GL/glext.h:11235
+glVideoCaptureNV = _link_function('glVideoCaptureNV', GLenum, [GLuint, POINTER(GLuint), POINTER(GLuint64EXT)], 'NV_video_capture')
+
+# GL/glext.h:11236
+glVideoCaptureStreamParameterivNV = _link_function('glVideoCaptureStreamParameterivNV', None, [GLuint, GLuint, GLenum, POINTER(GLint)], 'NV_video_capture')
+
+# GL/glext.h:11237
+glVideoCaptureStreamParameterfvNV = _link_function('glVideoCaptureStreamParameterfvNV', None, [GLuint, GLuint, GLenum, POINTER(GLfloat)], 'NV_video_capture')
+
+# GL/glext.h:11238
+glVideoCaptureStreamParameterdvNV = _link_function('glVideoCaptureStreamParameterdvNV', None, [GLuint, GLuint, GLenum, POINTER(GLdouble)], 'NV_video_capture')
+
+PFNGLBEGINVIDEOCAPTURENVPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:11240
+PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum, GLintptrARB) # GL/glext.h:11241
+PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum, GLenum, GLuint) # GL/glext.h:11242
+PFNGLENDVIDEOCAPTURENVPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:11243
+PFNGLGETVIDEOCAPTUREIVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:11244
+PFNGLGETVIDEOCAPTURESTREAMIVNVPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:11245
+PFNGLGETVIDEOCAPTURESTREAMFVNVPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:11246
+PFNGLGETVIDEOCAPTURESTREAMDVNVPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum, POINTER(GLdouble)) # GL/glext.h:11247
+PFNGLVIDEOCAPTURENVPROC = CFUNCTYPE(GLenum, GLuint, POINTER(GLuint), POINTER(GLuint64EXT)) # GL/glext.h:11248
+PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:11249
+PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:11250
+PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum, POINTER(GLdouble)) # GL/glext.h:11251
+# NV_copy_image (GL/glext.h:11254)
+GL_NV_copy_image = 1 # GL/glext.h:11255
+# GL/glext.h:11257
+glCopyImageSubDataNV = _link_function('glCopyImageSubDataNV', None, [GLuint, GLenum, GLint, GLint, GLint, GLint, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei], 'NV_copy_image')
+
+PFNGLCOPYIMAGESUBDATANVPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLint, GLint, GLint, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei) # GL/glext.h:11259
+# EXT_separate_shader_objects (GL/glext.h:11262)
+GL_EXT_separate_shader_objects = 1 # GL/glext.h:11263
+# GL/glext.h:11265
+glUseShaderProgramEXT = _link_function('glUseShaderProgramEXT', None, [GLenum, GLuint], 'EXT_separate_shader_objects')
+
+# GL/glext.h:11266
+glActiveProgramEXT = _link_function('glActiveProgramEXT', None, [GLuint], 'EXT_separate_shader_objects')
+
+# GL/glext.h:11267
+glCreateShaderProgramEXT = _link_function('glCreateShaderProgramEXT', GLuint, [GLenum, POINTER(GLchar)], 'EXT_separate_shader_objects')
+
+PFNGLUSESHADERPROGRAMEXTPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:11269
+PFNGLACTIVEPROGRAMEXTPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:11270
+PFNGLCREATESHADERPROGRAMEXTPROC = CFUNCTYPE(GLuint, GLenum, POINTER(GLchar)) # GL/glext.h:11271
+# NV_parameter_buffer_object2 (GL/glext.h:11274)
+GL_NV_parameter_buffer_object2 = 1 # GL/glext.h:11275
+# NV_shader_buffer_load (GL/glext.h:11278)
+GL_NV_shader_buffer_load = 1 # GL/glext.h:11279
+# GL/glext.h:11281
+glMakeBufferResidentNV = _link_function('glMakeBufferResidentNV', None, [GLenum, GLenum], 'NV_shader_buffer_load')
+
+# GL/glext.h:11282
+glMakeBufferNonResidentNV = _link_function('glMakeBufferNonResidentNV', None, [GLenum], 'NV_shader_buffer_load')
+
+# GL/glext.h:11283
+glIsBufferResidentNV = _link_function('glIsBufferResidentNV', GLboolean, [GLenum], 'NV_shader_buffer_load')
+
+# GL/glext.h:11284
+glMakeNamedBufferResidentNV = _link_function('glMakeNamedBufferResidentNV', None, [GLuint, GLenum], 'NV_shader_buffer_load')
+
+# GL/glext.h:11285
+glMakeNamedBufferNonResidentNV = _link_function('glMakeNamedBufferNonResidentNV', None, [GLuint], 'NV_shader_buffer_load')
+
+# GL/glext.h:11286
+glIsNamedBufferResidentNV = _link_function('glIsNamedBufferResidentNV', GLboolean, [GLuint], 'NV_shader_buffer_load')
+
+# GL/glext.h:11287
+glGetBufferParameterui64vNV = _link_function('glGetBufferParameterui64vNV', None, [GLenum, GLenum, POINTER(GLuint64EXT)], 'NV_shader_buffer_load')
+
+# GL/glext.h:11288
+glGetNamedBufferParameterui64vNV = _link_function('glGetNamedBufferParameterui64vNV', None, [GLuint, GLenum, POINTER(GLuint64EXT)], 'NV_shader_buffer_load')
+
+# GL/glext.h:11289
+glGetIntegerui64vNV = _link_function('glGetIntegerui64vNV', None, [GLenum, POINTER(GLuint64EXT)], 'NV_shader_buffer_load')
+
+# GL/glext.h:11290
+glUniformui64NV = _link_function('glUniformui64NV', None, [GLint, GLuint64EXT], 'NV_shader_buffer_load')
+
+# GL/glext.h:11291
+glUniformui64vNV = _link_function('glUniformui64vNV', None, [GLint, GLsizei, POINTER(GLuint64EXT)], 'NV_shader_buffer_load')
+
+# GL/glext.h:11292
+glGetUniformui64vNV = _link_function('glGetUniformui64vNV', None, [GLuint, GLint, POINTER(GLuint64EXT)], 'NV_shader_buffer_load')
+
+# GL/glext.h:11293
+glProgramUniformui64NV = _link_function('glProgramUniformui64NV', None, [GLuint, GLint, GLuint64EXT], 'NV_shader_buffer_load')
+
+# GL/glext.h:11294
+glProgramUniformui64vNV = _link_function('glProgramUniformui64vNV', None, [GLuint, GLint, GLsizei, POINTER(GLuint64EXT)], 'NV_shader_buffer_load')
+
+PFNGLMAKEBUFFERRESIDENTNVPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:11296
+PFNGLMAKEBUFFERNONRESIDENTNVPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:11297
+PFNGLISBUFFERRESIDENTNVPROC = CFUNCTYPE(GLboolean, GLenum) # GL/glext.h:11298
+PFNGLMAKENAMEDBUFFERRESIDENTNVPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:11299
+PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:11300
+PFNGLISNAMEDBUFFERRESIDENTNVPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:11301
+PFNGLGETBUFFERPARAMETERUI64VNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLuint64EXT)) # GL/glext.h:11302
+PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint64EXT)) # GL/glext.h:11303
+PFNGLGETINTEGERUI64VNVPROC = CFUNCTYPE(None, GLenum, POINTER(GLuint64EXT)) # GL/glext.h:11304
+PFNGLUNIFORMUI64NVPROC = CFUNCTYPE(None, GLint, GLuint64EXT) # GL/glext.h:11305
+PFNGLUNIFORMUI64VNVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint64EXT)) # GL/glext.h:11306
+PFNGLGETUNIFORMUI64VNVPROC = CFUNCTYPE(None, GLuint, GLint, POINTER(GLuint64EXT)) # GL/glext.h:11307
+PFNGLPROGRAMUNIFORMUI64NVPROC = CFUNCTYPE(None, GLuint, GLint, GLuint64EXT) # GL/glext.h:11308
+PFNGLPROGRAMUNIFORMUI64VNVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint64EXT)) # GL/glext.h:11309
+# NV_vertex_buffer_unified_memory (GL/glext.h:11312)
+GL_NV_vertex_buffer_unified_memory = 1 # GL/glext.h:11313
+# GL/glext.h:11315
+glBufferAddressRangeNV = _link_function('glBufferAddressRangeNV', None, [GLenum, GLuint, GLuint64EXT, GLsizeiptr], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:11316
+glVertexFormatNV = _link_function('glVertexFormatNV', None, [GLint, GLenum, GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:11317
+glNormalFormatNV = _link_function('glNormalFormatNV', None, [GLenum, GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:11318
+glColorFormatNV = _link_function('glColorFormatNV', None, [GLint, GLenum, GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:11319
+glIndexFormatNV = _link_function('glIndexFormatNV', None, [GLenum, GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:11320
+glTexCoordFormatNV = _link_function('glTexCoordFormatNV', None, [GLint, GLenum, GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:11321
+glEdgeFlagFormatNV = _link_function('glEdgeFlagFormatNV', None, [GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:11322
+glSecondaryColorFormatNV = _link_function('glSecondaryColorFormatNV', None, [GLint, GLenum, GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:11323
+glFogCoordFormatNV = _link_function('glFogCoordFormatNV', None, [GLenum, GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:11324
+glVertexAttribFormatNV = _link_function('glVertexAttribFormatNV', None, [GLuint, GLint, GLenum, GLboolean, GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:11325
+glVertexAttribIFormatNV = _link_function('glVertexAttribIFormatNV', None, [GLuint, GLint, GLenum, GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:11326
+glGetIntegerui64i_vNV = _link_function('glGetIntegerui64i_vNV', None, [GLenum, GLuint, POINTER(GLuint64EXT)], 'NV_vertex_buffer_unified_memory')
+
+PFNGLBUFFERADDRESSRANGENVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint64EXT, GLsizeiptr) # GL/glext.h:11328
+PFNGLVERTEXFORMATNVPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei) # GL/glext.h:11329
+PFNGLNORMALFORMATNVPROC = CFUNCTYPE(None, GLenum, GLsizei) # GL/glext.h:11330
+PFNGLCOLORFORMATNVPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei) # GL/glext.h:11331
+PFNGLINDEXFORMATNVPROC = CFUNCTYPE(None, GLenum, GLsizei) # GL/glext.h:11332
+PFNGLTEXCOORDFORMATNVPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei) # GL/glext.h:11333
+PFNGLEDGEFLAGFORMATNVPROC = CFUNCTYPE(None, GLsizei) # GL/glext.h:11334
+PFNGLSECONDARYCOLORFORMATNVPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei) # GL/glext.h:11335
+PFNGLFOGCOORDFORMATNVPROC = CFUNCTYPE(None, GLenum, GLsizei) # GL/glext.h:11336
+PFNGLVERTEXATTRIBFORMATNVPROC = CFUNCTYPE(None, GLuint, GLint, GLenum, GLboolean, GLsizei) # GL/glext.h:11337
+PFNGLVERTEXATTRIBIFORMATNVPROC = CFUNCTYPE(None, GLuint, GLint, GLenum, GLsizei) # GL/glext.h:11338
+PFNGLGETINTEGERUI64I_VNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLuint64EXT)) # GL/glext.h:11339
+# NV_texture_barrier (GL/glext.h:11342)
+GL_NV_texture_barrier = 1 # GL/glext.h:11343
+# GL/glext.h:11345
+glTextureBarrierNV = _link_function('glTextureBarrierNV', None, [], 'NV_texture_barrier')
+
+PFNGLTEXTUREBARRIERNVPROC = CFUNCTYPE(None) # GL/glext.h:11347
+# AMD_shader_stencil_export (GL/glext.h:11350)
+GL_AMD_shader_stencil_export = 1 # GL/glext.h:11351
+# AMD_seamless_cubemap_per_texture (GL/glext.h:11354)
+GL_AMD_seamless_cubemap_per_texture = 1 # GL/glext.h:11355
+# AMD_conservative_depth (GL/glext.h:11358)
+GL_AMD_conservative_depth = 1 # GL/glext.h:11359
+# EXT_shader_image_load_store (GL/glext.h:11362)
+GL_EXT_shader_image_load_store = 1 # GL/glext.h:11363
+# GL/glext.h:11365
+glBindImageTextureEXT = _link_function('glBindImageTextureEXT', None, [GLuint, GLuint, GLint, GLboolean, GLint, GLenum, GLint], 'EXT_shader_image_load_store')
+
+# GL/glext.h:11366
+glMemoryBarrierEXT = _link_function('glMemoryBarrierEXT', None, [GLbitfield], 'EXT_shader_image_load_store')
+
+PFNGLBINDIMAGETEXTUREEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLint, GLboolean, GLint, GLenum, GLint) # GL/glext.h:11368
+PFNGLMEMORYBARRIEREXTPROC = CFUNCTYPE(None, GLbitfield) # GL/glext.h:11369
+# EXT_vertex_attrib_64bit (GL/glext.h:11372)
+GL_EXT_vertex_attrib_64bit = 1 # GL/glext.h:11373
+# GL/glext.h:11375
+glVertexAttribL1dEXT = _link_function('glVertexAttribL1dEXT', None, [GLuint, GLdouble], 'EXT_vertex_attrib_64bit')
+
+# GL/glext.h:11376
+glVertexAttribL2dEXT = _link_function('glVertexAttribL2dEXT', None, [GLuint, GLdouble, GLdouble], 'EXT_vertex_attrib_64bit')
+
+# GL/glext.h:11377
+glVertexAttribL3dEXT = _link_function('glVertexAttribL3dEXT', None, [GLuint, GLdouble, GLdouble, GLdouble], 'EXT_vertex_attrib_64bit')
+
+# GL/glext.h:11378
+glVertexAttribL4dEXT = _link_function('glVertexAttribL4dEXT', None, [GLuint, GLdouble, GLdouble, GLdouble, GLdouble], 'EXT_vertex_attrib_64bit')
+
+# GL/glext.h:11379
+glVertexAttribL1dvEXT = _link_function('glVertexAttribL1dvEXT', None, [GLuint, POINTER(GLdouble)], 'EXT_vertex_attrib_64bit')
+
+# GL/glext.h:11380
+glVertexAttribL2dvEXT = _link_function('glVertexAttribL2dvEXT', None, [GLuint, POINTER(GLdouble)], 'EXT_vertex_attrib_64bit')
+
+# GL/glext.h:11381
+glVertexAttribL3dvEXT = _link_function('glVertexAttribL3dvEXT', None, [GLuint, POINTER(GLdouble)], 'EXT_vertex_attrib_64bit')
+
+# GL/glext.h:11382
+glVertexAttribL4dvEXT = _link_function('glVertexAttribL4dvEXT', None, [GLuint, POINTER(GLdouble)], 'EXT_vertex_attrib_64bit')
+
+# GL/glext.h:11383
+glVertexAttribLPointerEXT = _link_function('glVertexAttribLPointerEXT', None, [GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_vertex_attrib_64bit')
+
+# GL/glext.h:11384
+glGetVertexAttribLdvEXT = _link_function('glGetVertexAttribLdvEXT', None, [GLuint, GLenum, POINTER(GLdouble)], 'EXT_vertex_attrib_64bit')
+
+# GL/glext.h:11385
+glVertexArrayVertexAttribLOffsetEXT = _link_function('glVertexArrayVertexAttribLOffsetEXT', None, [GLuint, GLuint, GLuint, GLint, GLenum, GLsizei, GLintptr], 'EXT_vertex_attrib_64bit')
+
+PFNGLVERTEXATTRIBL1DEXTPROC = CFUNCTYPE(None, GLuint, GLdouble) # GL/glext.h:11387
+PFNGLVERTEXATTRIBL2DEXTPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble) # GL/glext.h:11388
+PFNGLVERTEXATTRIBL3DEXTPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble, GLdouble) # GL/glext.h:11389
+PFNGLVERTEXATTRIBL4DEXTPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:11390
+PFNGLVERTEXATTRIBL1DVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:11391
+PFNGLVERTEXATTRIBL2DVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:11392
+PFNGLVERTEXATTRIBL3DVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:11393
+PFNGLVERTEXATTRIBL4DVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:11394
+PFNGLVERTEXATTRIBLPOINTEREXTPROC = CFUNCTYPE(None, GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:11395
+PFNGLGETVERTEXATTRIBLDVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLdouble)) # GL/glext.h:11396
+PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint, GLint, GLenum, GLsizei, GLintptr) # GL/glext.h:11397
+# NV_gpu_program5 (GL/glext.h:11400)
+GL_NV_gpu_program5 = 1 # GL/glext.h:11401
+# GL/glext.h:11403
+glProgramSubroutineParametersuivNV = _link_function('glProgramSubroutineParametersuivNV', None, [GLenum, GLsizei, POINTER(GLuint)], 'NV_gpu_program5')
+
+# GL/glext.h:11404
+glGetProgramSubroutineParameteruivNV = _link_function('glGetProgramSubroutineParameteruivNV', None, [GLenum, GLuint, POINTER(GLuint)], 'NV_gpu_program5')
+
+PFNGLPROGRAMSUBROUTINEPARAMETERSUIVNVPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLuint)) # GL/glext.h:11406
+PFNGLGETPROGRAMSUBROUTINEPARAMETERUIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLuint)) # GL/glext.h:11407
+# NV_gpu_shader5 (GL/glext.h:11410)
+GL_NV_gpu_shader5 = 1 # GL/glext.h:11411
+# GL/glext.h:11413
+glUniform1i64NV = _link_function('glUniform1i64NV', None, [GLint, GLint64EXT], 'NV_gpu_shader5')
+
+# GL/glext.h:11414
+glUniform2i64NV = _link_function('glUniform2i64NV', None, [GLint, GLint64EXT, GLint64EXT], 'NV_gpu_shader5')
+
+# GL/glext.h:11415
+glUniform3i64NV = _link_function('glUniform3i64NV', None, [GLint, GLint64EXT, GLint64EXT, GLint64EXT], 'NV_gpu_shader5')
+
+# GL/glext.h:11416
+glUniform4i64NV = _link_function('glUniform4i64NV', None, [GLint, GLint64EXT, GLint64EXT, GLint64EXT, GLint64EXT], 'NV_gpu_shader5')
+
+# GL/glext.h:11417
+glUniform1i64vNV = _link_function('glUniform1i64vNV', None, [GLint, GLsizei, POINTER(GLint64EXT)], 'NV_gpu_shader5')
+
+# GL/glext.h:11418
+glUniform2i64vNV = _link_function('glUniform2i64vNV', None, [GLint, GLsizei, POINTER(GLint64EXT)], 'NV_gpu_shader5')
+
+# GL/glext.h:11419
+glUniform3i64vNV = _link_function('glUniform3i64vNV', None, [GLint, GLsizei, POINTER(GLint64EXT)], 'NV_gpu_shader5')
+
+# GL/glext.h:11420
+glUniform4i64vNV = _link_function('glUniform4i64vNV', None, [GLint, GLsizei, POINTER(GLint64EXT)], 'NV_gpu_shader5')
+
+# GL/glext.h:11421
+glUniform1ui64NV = _link_function('glUniform1ui64NV', None, [GLint, GLuint64EXT], 'NV_gpu_shader5')
+
+# GL/glext.h:11422
+glUniform2ui64NV = _link_function('glUniform2ui64NV', None, [GLint, GLuint64EXT, GLuint64EXT], 'NV_gpu_shader5')
+
+# GL/glext.h:11423
+glUniform3ui64NV = _link_function('glUniform3ui64NV', None, [GLint, GLuint64EXT, GLuint64EXT, GLuint64EXT], 'NV_gpu_shader5')
+
+# GL/glext.h:11424
+glUniform4ui64NV = _link_function('glUniform4ui64NV', None, [GLint, GLuint64EXT, GLuint64EXT, GLuint64EXT, GLuint64EXT], 'NV_gpu_shader5')
+
+# GL/glext.h:11425
+glUniform1ui64vNV = _link_function('glUniform1ui64vNV', None, [GLint, GLsizei, POINTER(GLuint64EXT)], 'NV_gpu_shader5')
+
+# GL/glext.h:11426
+glUniform2ui64vNV = _link_function('glUniform2ui64vNV', None, [GLint, GLsizei, POINTER(GLuint64EXT)], 'NV_gpu_shader5')
+
+# GL/glext.h:11427
+glUniform3ui64vNV = _link_function('glUniform3ui64vNV', None, [GLint, GLsizei, POINTER(GLuint64EXT)], 'NV_gpu_shader5')
+
+# GL/glext.h:11428
+glUniform4ui64vNV = _link_function('glUniform4ui64vNV', None, [GLint, GLsizei, POINTER(GLuint64EXT)], 'NV_gpu_shader5')
+
+# GL/glext.h:11429
+glGetUniformi64vNV = _link_function('glGetUniformi64vNV', None, [GLuint, GLint, POINTER(GLint64EXT)], 'NV_gpu_shader5')
+
+# GL/glext.h:11430
+glProgramUniform1i64NV = _link_function('glProgramUniform1i64NV', None, [GLuint, GLint, GLint64EXT], 'NV_gpu_shader5')
+
+# GL/glext.h:11431
+glProgramUniform2i64NV = _link_function('glProgramUniform2i64NV', None, [GLuint, GLint, GLint64EXT, GLint64EXT], 'NV_gpu_shader5')
+
+# GL/glext.h:11432
+glProgramUniform3i64NV = _link_function('glProgramUniform3i64NV', None, [GLuint, GLint, GLint64EXT, GLint64EXT, GLint64EXT], 'NV_gpu_shader5')
+
+# GL/glext.h:11433
+glProgramUniform4i64NV = _link_function('glProgramUniform4i64NV', None, [GLuint, GLint, GLint64EXT, GLint64EXT, GLint64EXT, GLint64EXT], 'NV_gpu_shader5')
+
+# GL/glext.h:11434
+glProgramUniform1i64vNV = _link_function('glProgramUniform1i64vNV', None, [GLuint, GLint, GLsizei, POINTER(GLint64EXT)], 'NV_gpu_shader5')
+
+# GL/glext.h:11435
+glProgramUniform2i64vNV = _link_function('glProgramUniform2i64vNV', None, [GLuint, GLint, GLsizei, POINTER(GLint64EXT)], 'NV_gpu_shader5')
+
+# GL/glext.h:11436
+glProgramUniform3i64vNV = _link_function('glProgramUniform3i64vNV', None, [GLuint, GLint, GLsizei, POINTER(GLint64EXT)], 'NV_gpu_shader5')
+
+# GL/glext.h:11437
+glProgramUniform4i64vNV = _link_function('glProgramUniform4i64vNV', None, [GLuint, GLint, GLsizei, POINTER(GLint64EXT)], 'NV_gpu_shader5')
+
+# GL/glext.h:11438
+glProgramUniform1ui64NV = _link_function('glProgramUniform1ui64NV', None, [GLuint, GLint, GLuint64EXT], 'NV_gpu_shader5')
+
+# GL/glext.h:11439
+glProgramUniform2ui64NV = _link_function('glProgramUniform2ui64NV', None, [GLuint, GLint, GLuint64EXT, GLuint64EXT], 'NV_gpu_shader5')
+
+# GL/glext.h:11440
+glProgramUniform3ui64NV = _link_function('glProgramUniform3ui64NV', None, [GLuint, GLint, GLuint64EXT, GLuint64EXT, GLuint64EXT], 'NV_gpu_shader5')
+
+# GL/glext.h:11441
+glProgramUniform4ui64NV = _link_function('glProgramUniform4ui64NV', None, [GLuint, GLint, GLuint64EXT, GLuint64EXT, GLuint64EXT, GLuint64EXT], 'NV_gpu_shader5')
+
+# GL/glext.h:11442
+glProgramUniform1ui64vNV = _link_function('glProgramUniform1ui64vNV', None, [GLuint, GLint, GLsizei, POINTER(GLuint64EXT)], 'NV_gpu_shader5')
+
+# GL/glext.h:11443
+glProgramUniform2ui64vNV = _link_function('glProgramUniform2ui64vNV', None, [GLuint, GLint, GLsizei, POINTER(GLuint64EXT)], 'NV_gpu_shader5')
+
+# GL/glext.h:11444
+glProgramUniform3ui64vNV = _link_function('glProgramUniform3ui64vNV', None, [GLuint, GLint, GLsizei, POINTER(GLuint64EXT)], 'NV_gpu_shader5')
+
+# GL/glext.h:11445
+glProgramUniform4ui64vNV = _link_function('glProgramUniform4ui64vNV', None, [GLuint, GLint, GLsizei, POINTER(GLuint64EXT)], 'NV_gpu_shader5')
+
+PFNGLUNIFORM1I64NVPROC = CFUNCTYPE(None, GLint, GLint64EXT) # GL/glext.h:11447
+PFNGLUNIFORM2I64NVPROC = CFUNCTYPE(None, GLint, GLint64EXT, GLint64EXT) # GL/glext.h:11448
+PFNGLUNIFORM3I64NVPROC = CFUNCTYPE(None, GLint, GLint64EXT, GLint64EXT, GLint64EXT) # GL/glext.h:11449
+PFNGLUNIFORM4I64NVPROC = CFUNCTYPE(None, GLint, GLint64EXT, GLint64EXT, GLint64EXT, GLint64EXT) # GL/glext.h:11450
+PFNGLUNIFORM1I64VNVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint64EXT)) # GL/glext.h:11451
+PFNGLUNIFORM2I64VNVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint64EXT)) # GL/glext.h:11452
+PFNGLUNIFORM3I64VNVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint64EXT)) # GL/glext.h:11453
+PFNGLUNIFORM4I64VNVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint64EXT)) # GL/glext.h:11454
+PFNGLUNIFORM1UI64NVPROC = CFUNCTYPE(None, GLint, GLuint64EXT) # GL/glext.h:11455
+PFNGLUNIFORM2UI64NVPROC = CFUNCTYPE(None, GLint, GLuint64EXT, GLuint64EXT) # GL/glext.h:11456
+PFNGLUNIFORM3UI64NVPROC = CFUNCTYPE(None, GLint, GLuint64EXT, GLuint64EXT, GLuint64EXT) # GL/glext.h:11457
+PFNGLUNIFORM4UI64NVPROC = CFUNCTYPE(None, GLint, GLuint64EXT, GLuint64EXT, GLuint64EXT, GLuint64EXT) # GL/glext.h:11458
+PFNGLUNIFORM1UI64VNVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint64EXT)) # GL/glext.h:11459
+PFNGLUNIFORM2UI64VNVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint64EXT)) # GL/glext.h:11460
+PFNGLUNIFORM3UI64VNVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint64EXT)) # GL/glext.h:11461
+PFNGLUNIFORM4UI64VNVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint64EXT)) # GL/glext.h:11462
+PFNGLGETUNIFORMI64VNVPROC = CFUNCTYPE(None, GLuint, GLint, POINTER(GLint64EXT)) # GL/glext.h:11463
+PFNGLPROGRAMUNIFORM1I64NVPROC = CFUNCTYPE(None, GLuint, GLint, GLint64EXT) # GL/glext.h:11464
+PFNGLPROGRAMUNIFORM2I64NVPROC = CFUNCTYPE(None, GLuint, GLint, GLint64EXT, GLint64EXT) # GL/glext.h:11465
+PFNGLPROGRAMUNIFORM3I64NVPROC = CFUNCTYPE(None, GLuint, GLint, GLint64EXT, GLint64EXT, GLint64EXT) # GL/glext.h:11466
+PFNGLPROGRAMUNIFORM4I64NVPROC = CFUNCTYPE(None, GLuint, GLint, GLint64EXT, GLint64EXT, GLint64EXT, GLint64EXT) # GL/glext.h:11467
+PFNGLPROGRAMUNIFORM1I64VNVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLint64EXT)) # GL/glext.h:11468
+PFNGLPROGRAMUNIFORM2I64VNVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLint64EXT)) # GL/glext.h:11469
+PFNGLPROGRAMUNIFORM3I64VNVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLint64EXT)) # GL/glext.h:11470
+PFNGLPROGRAMUNIFORM4I64VNVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLint64EXT)) # GL/glext.h:11471
+PFNGLPROGRAMUNIFORM1UI64NVPROC = CFUNCTYPE(None, GLuint, GLint, GLuint64EXT) # GL/glext.h:11472
+PFNGLPROGRAMUNIFORM2UI64NVPROC = CFUNCTYPE(None, GLuint, GLint, GLuint64EXT, GLuint64EXT) # GL/glext.h:11473
+PFNGLPROGRAMUNIFORM3UI64NVPROC = CFUNCTYPE(None, GLuint, GLint, GLuint64EXT, GLuint64EXT, GLuint64EXT) # GL/glext.h:11474
+PFNGLPROGRAMUNIFORM4UI64NVPROC = CFUNCTYPE(None, GLuint, GLint, GLuint64EXT, GLuint64EXT, GLuint64EXT, GLuint64EXT) # GL/glext.h:11475
+PFNGLPROGRAMUNIFORM1UI64VNVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint64EXT)) # GL/glext.h:11476
+PFNGLPROGRAMUNIFORM2UI64VNVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint64EXT)) # GL/glext.h:11477
+PFNGLPROGRAMUNIFORM3UI64VNVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint64EXT)) # GL/glext.h:11478
+PFNGLPROGRAMUNIFORM4UI64VNVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint64EXT)) # GL/glext.h:11479
+# NV_shader_buffer_store (GL/glext.h:11482)
+GL_NV_shader_buffer_store = 1 # GL/glext.h:11483
+# NV_tessellation_program5 (GL/glext.h:11486)
+GL_NV_tessellation_program5 = 1 # GL/glext.h:11487
+# NV_vertex_attrib_integer_64bit (GL/glext.h:11490)
+GL_NV_vertex_attrib_integer_64bit = 1 # GL/glext.h:11491
+# GL/glext.h:11493
+glVertexAttribL1i64NV = _link_function('glVertexAttribL1i64NV', None, [GLuint, GLint64EXT], 'NV_vertex_attrib_integer_64bit')
+
+# GL/glext.h:11494
+glVertexAttribL2i64NV = _link_function('glVertexAttribL2i64NV', None, [GLuint, GLint64EXT, GLint64EXT], 'NV_vertex_attrib_integer_64bit')
+
+# GL/glext.h:11495
+glVertexAttribL3i64NV = _link_function('glVertexAttribL3i64NV', None, [GLuint, GLint64EXT, GLint64EXT, GLint64EXT], 'NV_vertex_attrib_integer_64bit')
+
+# GL/glext.h:11496
+glVertexAttribL4i64NV = _link_function('glVertexAttribL4i64NV', None, [GLuint, GLint64EXT, GLint64EXT, GLint64EXT, GLint64EXT], 'NV_vertex_attrib_integer_64bit')
+
+# GL/glext.h:11497
+glVertexAttribL1i64vNV = _link_function('glVertexAttribL1i64vNV', None, [GLuint, POINTER(GLint64EXT)], 'NV_vertex_attrib_integer_64bit')
+
+# GL/glext.h:11498
+glVertexAttribL2i64vNV = _link_function('glVertexAttribL2i64vNV', None, [GLuint, POINTER(GLint64EXT)], 'NV_vertex_attrib_integer_64bit')
+
+# GL/glext.h:11499
+glVertexAttribL3i64vNV = _link_function('glVertexAttribL3i64vNV', None, [GLuint, POINTER(GLint64EXT)], 'NV_vertex_attrib_integer_64bit')
+
+# GL/glext.h:11500
+glVertexAttribL4i64vNV = _link_function('glVertexAttribL4i64vNV', None, [GLuint, POINTER(GLint64EXT)], 'NV_vertex_attrib_integer_64bit')
+
+# GL/glext.h:11501
+glVertexAttribL1ui64NV = _link_function('glVertexAttribL1ui64NV', None, [GLuint, GLuint64EXT], 'NV_vertex_attrib_integer_64bit')
+
+# GL/glext.h:11502
+glVertexAttribL2ui64NV = _link_function('glVertexAttribL2ui64NV', None, [GLuint, GLuint64EXT, GLuint64EXT], 'NV_vertex_attrib_integer_64bit')
+
+# GL/glext.h:11503
+glVertexAttribL3ui64NV = _link_function('glVertexAttribL3ui64NV', None, [GLuint, GLuint64EXT, GLuint64EXT, GLuint64EXT], 'NV_vertex_attrib_integer_64bit')
+
+# GL/glext.h:11504
+glVertexAttribL4ui64NV = _link_function('glVertexAttribL4ui64NV', None, [GLuint, GLuint64EXT, GLuint64EXT, GLuint64EXT, GLuint64EXT], 'NV_vertex_attrib_integer_64bit')
+
+# GL/glext.h:11505
+glVertexAttribL1ui64vNV = _link_function('glVertexAttribL1ui64vNV', None, [GLuint, POINTER(GLuint64EXT)], 'NV_vertex_attrib_integer_64bit')
+
+# GL/glext.h:11506
+glVertexAttribL2ui64vNV = _link_function('glVertexAttribL2ui64vNV', None, [GLuint, POINTER(GLuint64EXT)], 'NV_vertex_attrib_integer_64bit')
+
+# GL/glext.h:11507
+glVertexAttribL3ui64vNV = _link_function('glVertexAttribL3ui64vNV', None, [GLuint, POINTER(GLuint64EXT)], 'NV_vertex_attrib_integer_64bit')
+
+# GL/glext.h:11508
+glVertexAttribL4ui64vNV = _link_function('glVertexAttribL4ui64vNV', None, [GLuint, POINTER(GLuint64EXT)], 'NV_vertex_attrib_integer_64bit')
+
+# GL/glext.h:11509
+glGetVertexAttribLi64vNV = _link_function('glGetVertexAttribLi64vNV', None, [GLuint, GLenum, POINTER(GLint64EXT)], 'NV_vertex_attrib_integer_64bit')
+
+# GL/glext.h:11510
+glGetVertexAttribLui64vNV = _link_function('glGetVertexAttribLui64vNV', None, [GLuint, GLenum, POINTER(GLuint64EXT)], 'NV_vertex_attrib_integer_64bit')
+
+# GL/glext.h:11511
+glVertexAttribLFormatNV = _link_function('glVertexAttribLFormatNV', None, [GLuint, GLint, GLenum, GLsizei], 'NV_vertex_attrib_integer_64bit')
+
+PFNGLVERTEXATTRIBL1I64NVPROC = CFUNCTYPE(None, GLuint, GLint64EXT) # GL/glext.h:11513
+PFNGLVERTEXATTRIBL2I64NVPROC = CFUNCTYPE(None, GLuint, GLint64EXT, GLint64EXT) # GL/glext.h:11514
+PFNGLVERTEXATTRIBL3I64NVPROC = CFUNCTYPE(None, GLuint, GLint64EXT, GLint64EXT, GLint64EXT) # GL/glext.h:11515
+PFNGLVERTEXATTRIBL4I64NVPROC = CFUNCTYPE(None, GLuint, GLint64EXT, GLint64EXT, GLint64EXT, GLint64EXT) # GL/glext.h:11516
+PFNGLVERTEXATTRIBL1I64VNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLint64EXT)) # GL/glext.h:11517
+PFNGLVERTEXATTRIBL2I64VNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLint64EXT)) # GL/glext.h:11518
+PFNGLVERTEXATTRIBL3I64VNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLint64EXT)) # GL/glext.h:11519
+PFNGLVERTEXATTRIBL4I64VNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLint64EXT)) # GL/glext.h:11520
+PFNGLVERTEXATTRIBL1UI64NVPROC = CFUNCTYPE(None, GLuint, GLuint64EXT) # GL/glext.h:11521
+PFNGLVERTEXATTRIBL2UI64NVPROC = CFUNCTYPE(None, GLuint, GLuint64EXT, GLuint64EXT) # GL/glext.h:11522
+PFNGLVERTEXATTRIBL3UI64NVPROC = CFUNCTYPE(None, GLuint, GLuint64EXT, GLuint64EXT, GLuint64EXT) # GL/glext.h:11523
+PFNGLVERTEXATTRIBL4UI64NVPROC = CFUNCTYPE(None, GLuint, GLuint64EXT, GLuint64EXT, GLuint64EXT, GLuint64EXT) # GL/glext.h:11524
+PFNGLVERTEXATTRIBL1UI64VNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint64EXT)) # GL/glext.h:11525
+PFNGLVERTEXATTRIBL2UI64VNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint64EXT)) # GL/glext.h:11526
+PFNGLVERTEXATTRIBL3UI64VNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint64EXT)) # GL/glext.h:11527
+PFNGLVERTEXATTRIBL4UI64VNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint64EXT)) # GL/glext.h:11528
+PFNGLGETVERTEXATTRIBLI64VNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint64EXT)) # GL/glext.h:11529
+PFNGLGETVERTEXATTRIBLUI64VNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint64EXT)) # GL/glext.h:11530
+PFNGLVERTEXATTRIBLFORMATNVPROC = CFUNCTYPE(None, GLuint, GLint, GLenum, GLsizei) # GL/glext.h:11531
+# NV_multisample_coverage (GL/glext.h:11534)
+GL_NV_multisample_coverage = 1 # GL/glext.h:11535
+# AMD_name_gen_delete (GL/glext.h:11538)
+GL_AMD_name_gen_delete = 1 # GL/glext.h:11539
+# GL/glext.h:11541
+glGenNamesAMD = _link_function('glGenNamesAMD', None, [GLenum, GLuint, POINTER(GLuint)], 'AMD_name_gen_delete')
+
+# GL/glext.h:11542
+glDeleteNamesAMD = _link_function('glDeleteNamesAMD', None, [GLenum, GLuint, POINTER(GLuint)], 'AMD_name_gen_delete')
+
+# GL/glext.h:11543
+glIsNameAMD = _link_function('glIsNameAMD', GLboolean, [GLenum, GLuint], 'AMD_name_gen_delete')
+
+PFNGLGENNAMESAMDPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLuint)) # GL/glext.h:11545
+PFNGLDELETENAMESAMDPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLuint)) # GL/glext.h:11546
+PFNGLISNAMEAMDPROC = CFUNCTYPE(GLboolean, GLenum, GLuint) # GL/glext.h:11547
+# AMD_debug_output (GL/glext.h:11550)
+GL_AMD_debug_output = 1 # GL/glext.h:11551
+# GL/glext.h:11553
+glDebugMessageEnableAMD = _link_function('glDebugMessageEnableAMD', None, [GLenum, GLenum, GLsizei, POINTER(GLuint), GLboolean], 'AMD_debug_output')
+
+# GL/glext.h:11554
+glDebugMessageInsertAMD = _link_function('glDebugMessageInsertAMD', None, [GLenum, GLenum, GLuint, GLsizei, POINTER(GLchar)], 'AMD_debug_output')
+
+# GL/glext.h:11555
+glDebugMessageCallbackAMD = _link_function('glDebugMessageCallbackAMD', None, [GLDEBUGPROCAMD, POINTER(GLvoid)], 'AMD_debug_output')
+
+# GL/glext.h:11556
+glGetDebugMessageLogAMD = _link_function('glGetDebugMessageLogAMD', GLuint, [GLuint, GLsizei, POINTER(GLenum), POINTER(GLuint), POINTER(GLuint), POINTER(GLsizei), POINTER(GLchar)], 'AMD_debug_output')
+
+PFNGLDEBUGMESSAGEENABLEAMDPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, POINTER(GLuint), GLboolean) # GL/glext.h:11558
+PFNGLDEBUGMESSAGEINSERTAMDPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLsizei, POINTER(GLchar)) # GL/glext.h:11559
+PFNGLDEBUGMESSAGECALLBACKAMDPROC = CFUNCTYPE(None, GLDEBUGPROCAMD, POINTER(GLvoid)) # GL/glext.h:11560
+PFNGLGETDEBUGMESSAGELOGAMDPROC = CFUNCTYPE(GLuint, GLuint, GLsizei, POINTER(GLenum), POINTER(GLuint), POINTER(GLuint), POINTER(GLsizei), POINTER(GLchar)) # GL/glext.h:11561
+# NV_vdpau_interop (GL/glext.h:11564)
+GL_NV_vdpau_interop = 1 # GL/glext.h:11565
+# GL/glext.h:11567
+glVDPAUInitNV = _link_function('glVDPAUInitNV', None, [POINTER(GLvoid), POINTER(GLvoid)], 'NV_vdpau_interop')
+
+# GL/glext.h:11568
+glVDPAUFiniNV = _link_function('glVDPAUFiniNV', None, [], 'NV_vdpau_interop')
+
+# GL/glext.h:11569
+glVDPAURegisterVideoSurfaceNV = _link_function('glVDPAURegisterVideoSurfaceNV', GLvdpauSurfaceNV, [POINTER(GLvoid), GLenum, GLsizei, POINTER(GLuint)], 'NV_vdpau_interop')
+
+# GL/glext.h:11570
+glVDPAURegisterOutputSurfaceNV = _link_function('glVDPAURegisterOutputSurfaceNV', GLvdpauSurfaceNV, [POINTER(GLvoid), GLenum, GLsizei, POINTER(GLuint)], 'NV_vdpau_interop')
+
+# GL/glext.h:11571
+glVDPAUIsSurfaceNV = _link_function('glVDPAUIsSurfaceNV', None, [GLvdpauSurfaceNV], 'NV_vdpau_interop')
+
+# GL/glext.h:11572
+glVDPAUUnregisterSurfaceNV = _link_function('glVDPAUUnregisterSurfaceNV', None, [GLvdpauSurfaceNV], 'NV_vdpau_interop')
+
+# GL/glext.h:11573
+glVDPAUGetSurfaceivNV = _link_function('glVDPAUGetSurfaceivNV', None, [GLvdpauSurfaceNV, GLenum, GLsizei, POINTER(GLsizei), POINTER(GLint)], 'NV_vdpau_interop')
+
+# GL/glext.h:11574
+glVDPAUSurfaceAccessNV = _link_function('glVDPAUSurfaceAccessNV', None, [GLvdpauSurfaceNV, GLenum], 'NV_vdpau_interop')
+
+# GL/glext.h:11575
+glVDPAUMapSurfacesNV = _link_function('glVDPAUMapSurfacesNV', None, [GLsizei, POINTER(GLvdpauSurfaceNV)], 'NV_vdpau_interop')
+
+# GL/glext.h:11576
+glVDPAUUnmapSurfacesNV = _link_function('glVDPAUUnmapSurfacesNV', None, [GLsizei, POINTER(GLvdpauSurfaceNV)], 'NV_vdpau_interop')
+
+PFNGLVDPAUINITNVPROC = CFUNCTYPE(None, POINTER(GLvoid), POINTER(GLvoid)) # GL/glext.h:11578
+PFNGLVDPAUFININVPROC = CFUNCTYPE(None) # GL/glext.h:11579
+PFNGLVDPAUREGISTERVIDEOSURFACENVPROC = CFUNCTYPE(GLvdpauSurfaceNV, POINTER(GLvoid), GLenum, GLsizei, POINTER(GLuint)) # GL/glext.h:11580
+PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC = CFUNCTYPE(GLvdpauSurfaceNV, POINTER(GLvoid), GLenum, GLsizei, POINTER(GLuint)) # GL/glext.h:11581
+PFNGLVDPAUISSURFACENVPROC = CFUNCTYPE(None, GLvdpauSurfaceNV) # GL/glext.h:11582
+PFNGLVDPAUUNREGISTERSURFACENVPROC = CFUNCTYPE(None, GLvdpauSurfaceNV) # GL/glext.h:11583
+PFNGLVDPAUGETSURFACEIVNVPROC = CFUNCTYPE(None, GLvdpauSurfaceNV, GLenum, GLsizei, POINTER(GLsizei), POINTER(GLint)) # GL/glext.h:11584
+PFNGLVDPAUSURFACEACCESSNVPROC = CFUNCTYPE(None, GLvdpauSurfaceNV, GLenum) # GL/glext.h:11585
+PFNGLVDPAUMAPSURFACESNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLvdpauSurfaceNV)) # GL/glext.h:11586
+PFNGLVDPAUUNMAPSURFACESNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLvdpauSurfaceNV)) # GL/glext.h:11587
+# AMD_transform_feedback3_lines_triangles (GL/glext.h:11590)
+GL_AMD_transform_feedback3_lines_triangles = 1 # GL/glext.h:11591
+# AMD_depth_clamp_separate (GL/glext.h:11594)
+GL_AMD_depth_clamp_separate = 1 # GL/glext.h:11595
+# EXT_texture_sRGB_decode (GL/glext.h:11598)
+GL_EXT_texture_sRGB_decode = 1 # GL/glext.h:11599
+# NV_texture_multisample (GL/glext.h:11602)
+GL_NV_texture_multisample = 1 # GL/glext.h:11603
+# GL/glext.h:11605
+glTexImage2DMultisampleCoverageNV = _link_function('glTexImage2DMultisampleCoverageNV', None, [GLenum, GLsizei, GLsizei, GLint, GLsizei, GLsizei, GLboolean], 'NV_texture_multisample')
+
+# GL/glext.h:11606
+glTexImage3DMultisampleCoverageNV = _link_function('glTexImage3DMultisampleCoverageNV', None, [GLenum, GLsizei, GLsizei, GLint, GLsizei, GLsizei, GLsizei, GLboolean], 'NV_texture_multisample')
+
+# GL/glext.h:11607
+glTextureImage2DMultisampleNV = _link_function('glTextureImage2DMultisampleNV', None, [GLuint, GLenum, GLsizei, GLint, GLsizei, GLsizei, GLboolean], 'NV_texture_multisample')
+
+# GL/glext.h:11608
+glTextureImage3DMultisampleNV = _link_function('glTextureImage3DMultisampleNV', None, [GLuint, GLenum, GLsizei, GLint, GLsizei, GLsizei, GLsizei, GLboolean], 'NV_texture_multisample')
+
+# GL/glext.h:11609
+glTextureImage2DMultisampleCoverageNV = _link_function('glTextureImage2DMultisampleCoverageNV', None, [GLuint, GLenum, GLsizei, GLsizei, GLint, GLsizei, GLsizei, GLboolean], 'NV_texture_multisample')
+
+# GL/glext.h:11610
+glTextureImage3DMultisampleCoverageNV = _link_function('glTextureImage3DMultisampleCoverageNV', None, [GLuint, GLenum, GLsizei, GLsizei, GLint, GLsizei, GLsizei, GLsizei, GLboolean], 'NV_texture_multisample')
+
+PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC = CFUNCTYPE(None, GLenum, GLsizei, GLsizei, GLint, GLsizei, GLsizei, GLboolean) # GL/glext.h:11612
+PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC = CFUNCTYPE(None, GLenum, GLsizei, GLsizei, GLint, GLsizei, GLsizei, GLsizei, GLboolean) # GL/glext.h:11613
+PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC = CFUNCTYPE(None, GLuint, GLenum, GLsizei, GLint, GLsizei, GLsizei, GLboolean) # GL/glext.h:11614
+PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC = CFUNCTYPE(None, GLuint, GLenum, GLsizei, GLint, GLsizei, GLsizei, GLsizei, GLboolean) # GL/glext.h:11615
+PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC = CFUNCTYPE(None, GLuint, GLenum, GLsizei, GLsizei, GLint, GLsizei, GLsizei, GLboolean) # GL/glext.h:11616
+PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC = CFUNCTYPE(None, GLuint, GLenum, GLsizei, GLsizei, GLint, GLsizei, GLsizei, GLsizei, GLboolean) # GL/glext.h:11617
+# AMD_blend_minmax_factor (GL/glext.h:11620)
+GL_AMD_blend_minmax_factor = 1 # GL/glext.h:11621
+# AMD_sample_positions (GL/glext.h:11624)
+GL_AMD_sample_positions = 1 # GL/glext.h:11625
+# GL/glext.h:11627
+glSetMultisamplefvAMD = _link_function('glSetMultisamplefvAMD', None, [GLenum, GLuint, POINTER(GLfloat)], 'AMD_sample_positions')
+
+PFNGLSETMULTISAMPLEFVAMDPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:11629
+# EXT_x11_sync_object (GL/glext.h:11632)
+GL_EXT_x11_sync_object = 1 # GL/glext.h:11633
+# GL/glext.h:11635
+glImportSyncEXT = _link_function('glImportSyncEXT', GLsync, [GLenum, GLintptr, GLbitfield], 'EXT_x11_sync_object')
+
+PFNGLIMPORTSYNCEXTPROC = CFUNCTYPE(GLsync, GLenum, GLintptr, GLbitfield) # GL/glext.h:11637
+# AMD_multi_draw_indirect (GL/glext.h:11640)
+GL_AMD_multi_draw_indirect = 1 # GL/glext.h:11641
+# GL/glext.h:11643
+glMultiDrawArraysIndirectAMD = _link_function('glMultiDrawArraysIndirectAMD', None, [GLenum, POINTER(GLvoid), GLsizei, GLsizei], 'AMD_multi_draw_indirect')
+
+# GL/glext.h:11644
+glMultiDrawElementsIndirectAMD = _link_function('glMultiDrawElementsIndirectAMD', None, [GLenum, GLenum, POINTER(GLvoid), GLsizei, GLsizei], 'AMD_multi_draw_indirect')
+
+PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC = CFUNCTYPE(None, GLenum, POINTER(GLvoid), GLsizei, GLsizei) # GL/glext.h:11646
+PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLvoid), GLsizei, GLsizei) # GL/glext.h:11647
+# EXT_framebuffer_multisample_blit_scaled (GL/glext.h:11650)
+GL_EXT_framebuffer_multisample_blit_scaled = 1 # GL/glext.h:11651
+# NV_path_rendering (GL/glext.h:11654)
+GL_NV_path_rendering = 1 # GL/glext.h:11655
+# GL/glext.h:11657
+glGenPathsNV = _link_function('glGenPathsNV', GLuint, [GLsizei], 'NV_path_rendering')
+
+# GL/glext.h:11658
+glDeletePathsNV = _link_function('glDeletePathsNV', None, [GLuint, GLsizei], 'NV_path_rendering')
+
+# GL/glext.h:11659
+glIsPathNV = _link_function('glIsPathNV', GLboolean, [GLuint], 'NV_path_rendering')
+
+# GL/glext.h:11660
+glPathCommandsNV = _link_function('glPathCommandsNV', None, [GLuint, GLsizei, POINTER(GLubyte), GLsizei, GLenum, POINTER(GLvoid)], 'NV_path_rendering')
+
+# GL/glext.h:11661
+glPathCoordsNV = _link_function('glPathCoordsNV', None, [GLuint, GLsizei, GLenum, POINTER(GLvoid)], 'NV_path_rendering')
+
+# GL/glext.h:11662
+glPathSubCommandsNV = _link_function('glPathSubCommandsNV', None, [GLuint, GLsizei, GLsizei, GLsizei, POINTER(GLubyte), GLsizei, GLenum, POINTER(GLvoid)], 'NV_path_rendering')
+
+# GL/glext.h:11663
+glPathSubCoordsNV = _link_function('glPathSubCoordsNV', None, [GLuint, GLsizei, GLsizei, GLenum, POINTER(GLvoid)], 'NV_path_rendering')
+
+# GL/glext.h:11664
+glPathStringNV = _link_function('glPathStringNV', None, [GLuint, GLenum, GLsizei, POINTER(GLvoid)], 'NV_path_rendering')
+
+# GL/glext.h:11665
+glPathGlyphsNV = _link_function('glPathGlyphsNV', None, [GLuint, GLenum, POINTER(GLvoid), GLbitfield, GLsizei, GLenum, POINTER(GLvoid), GLenum, GLuint, GLfloat], 'NV_path_rendering')
+
+# GL/glext.h:11666
+glPathGlyphRangeNV = _link_function('glPathGlyphRangeNV', None, [GLuint, GLenum, POINTER(GLvoid), GLbitfield, GLuint, GLsizei, GLenum, GLuint, GLfloat], 'NV_path_rendering')
+
+# GL/glext.h:11667
+glWeightPathsNV = _link_function('glWeightPathsNV', None, [GLuint, GLsizei, POINTER(GLuint), POINTER(GLfloat)], 'NV_path_rendering')
+
+# GL/glext.h:11668
+glCopyPathNV = _link_function('glCopyPathNV', None, [GLuint, GLuint], 'NV_path_rendering')
+
+# GL/glext.h:11669
+glInterpolatePathsNV = _link_function('glInterpolatePathsNV', None, [GLuint, GLuint, GLuint, GLfloat], 'NV_path_rendering')
+
+# GL/glext.h:11670
+glTransformPathNV = _link_function('glTransformPathNV', None, [GLuint, GLuint, GLenum, POINTER(GLfloat)], 'NV_path_rendering')
+
+# GL/glext.h:11671
+glPathParameterivNV = _link_function('glPathParameterivNV', None, [GLuint, GLenum, POINTER(GLint)], 'NV_path_rendering')
+
+# GL/glext.h:11672
+glPathParameteriNV = _link_function('glPathParameteriNV', None, [GLuint, GLenum, GLint], 'NV_path_rendering')
+
+# GL/glext.h:11673
+glPathParameterfvNV = _link_function('glPathParameterfvNV', None, [GLuint, GLenum, POINTER(GLfloat)], 'NV_path_rendering')
+
+# GL/glext.h:11674
+glPathParameterfNV = _link_function('glPathParameterfNV', None, [GLuint, GLenum, GLfloat], 'NV_path_rendering')
+
+# GL/glext.h:11675
+glPathDashArrayNV = _link_function('glPathDashArrayNV', None, [GLuint, GLsizei, POINTER(GLfloat)], 'NV_path_rendering')
+
+# GL/glext.h:11676
+glPathStencilFuncNV = _link_function('glPathStencilFuncNV', None, [GLenum, GLint, GLuint], 'NV_path_rendering')
+
+# GL/glext.h:11677
+glPathStencilDepthOffsetNV = _link_function('glPathStencilDepthOffsetNV', None, [GLfloat, GLfloat], 'NV_path_rendering')
+
+# GL/glext.h:11678
+glStencilFillPathNV = _link_function('glStencilFillPathNV', None, [GLuint, GLenum, GLuint], 'NV_path_rendering')
+
+# GL/glext.h:11679
+glStencilStrokePathNV = _link_function('glStencilStrokePathNV', None, [GLuint, GLint, GLuint], 'NV_path_rendering')
+
+# GL/glext.h:11680
+glStencilFillPathInstancedNV = _link_function('glStencilFillPathInstancedNV', None, [GLsizei, GLenum, POINTER(GLvoid), GLuint, GLenum, GLuint, GLenum, POINTER(GLfloat)], 'NV_path_rendering')
+
+# GL/glext.h:11681
+glStencilStrokePathInstancedNV = _link_function('glStencilStrokePathInstancedNV', None, [GLsizei, GLenum, POINTER(GLvoid), GLuint, GLint, GLuint, GLenum, POINTER(GLfloat)], 'NV_path_rendering')
+
+# GL/glext.h:11682
+glPathCoverDepthFuncNV = _link_function('glPathCoverDepthFuncNV', None, [GLenum], 'NV_path_rendering')
+
+# GL/glext.h:11683
+glPathColorGenNV = _link_function('glPathColorGenNV', None, [GLenum, GLenum, GLenum, POINTER(GLfloat)], 'NV_path_rendering')
+
+# GL/glext.h:11684
+glPathTexGenNV = _link_function('glPathTexGenNV', None, [GLenum, GLenum, GLint, POINTER(GLfloat)], 'NV_path_rendering')
+
+# GL/glext.h:11685
+glPathFogGenNV = _link_function('glPathFogGenNV', None, [GLenum], 'NV_path_rendering')
+
+# GL/glext.h:11686
+glCoverFillPathNV = _link_function('glCoverFillPathNV', None, [GLuint, GLenum], 'NV_path_rendering')
+
+# GL/glext.h:11687
+glCoverStrokePathNV = _link_function('glCoverStrokePathNV', None, [GLuint, GLenum], 'NV_path_rendering')
+
+# GL/glext.h:11688
+glCoverFillPathInstancedNV = _link_function('glCoverFillPathInstancedNV', None, [GLsizei, GLenum, POINTER(GLvoid), GLuint, GLenum, GLenum, POINTER(GLfloat)], 'NV_path_rendering')
+
+# GL/glext.h:11689
+glCoverStrokePathInstancedNV = _link_function('glCoverStrokePathInstancedNV', None, [GLsizei, GLenum, POINTER(GLvoid), GLuint, GLenum, GLenum, POINTER(GLfloat)], 'NV_path_rendering')
+
+# GL/glext.h:11690
+glGetPathParameterivNV = _link_function('glGetPathParameterivNV', None, [GLuint, GLenum, POINTER(GLint)], 'NV_path_rendering')
+
+# GL/glext.h:11691
+glGetPathParameterfvNV = _link_function('glGetPathParameterfvNV', None, [GLuint, GLenum, POINTER(GLfloat)], 'NV_path_rendering')
+
+# GL/glext.h:11692
+glGetPathCommandsNV = _link_function('glGetPathCommandsNV', None, [GLuint, POINTER(GLubyte)], 'NV_path_rendering')
+
+# GL/glext.h:11693
+glGetPathCoordsNV = _link_function('glGetPathCoordsNV', None, [GLuint, POINTER(GLfloat)], 'NV_path_rendering')
+
+# GL/glext.h:11694
+glGetPathDashArrayNV = _link_function('glGetPathDashArrayNV', None, [GLuint, POINTER(GLfloat)], 'NV_path_rendering')
+
+# GL/glext.h:11695
+glGetPathMetricsNV = _link_function('glGetPathMetricsNV', None, [GLbitfield, GLsizei, GLenum, POINTER(GLvoid), GLuint, GLsizei, POINTER(GLfloat)], 'NV_path_rendering')
+
+# GL/glext.h:11696
+glGetPathMetricRangeNV = _link_function('glGetPathMetricRangeNV', None, [GLbitfield, GLuint, GLsizei, GLsizei, POINTER(GLfloat)], 'NV_path_rendering')
+
+# GL/glext.h:11697
+glGetPathSpacingNV = _link_function('glGetPathSpacingNV', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid), GLuint, GLfloat, GLfloat, GLenum, POINTER(GLfloat)], 'NV_path_rendering')
+
+# GL/glext.h:11698
+glGetPathColorGenivNV = _link_function('glGetPathColorGenivNV', None, [GLenum, GLenum, POINTER(GLint)], 'NV_path_rendering')
+
+# GL/glext.h:11699
+glGetPathColorGenfvNV = _link_function('glGetPathColorGenfvNV', None, [GLenum, GLenum, POINTER(GLfloat)], 'NV_path_rendering')
+
+# GL/glext.h:11700
+glGetPathTexGenivNV = _link_function('glGetPathTexGenivNV', None, [GLenum, GLenum, POINTER(GLint)], 'NV_path_rendering')
+
+# GL/glext.h:11701
+glGetPathTexGenfvNV = _link_function('glGetPathTexGenfvNV', None, [GLenum, GLenum, POINTER(GLfloat)], 'NV_path_rendering')
+
+# GL/glext.h:11702
+glIsPointInFillPathNV = _link_function('glIsPointInFillPathNV', GLboolean, [GLuint, GLuint, GLfloat, GLfloat], 'NV_path_rendering')
+
+# GL/glext.h:11703
+glIsPointInStrokePathNV = _link_function('glIsPointInStrokePathNV', GLboolean, [GLuint, GLfloat, GLfloat], 'NV_path_rendering')
+
+# GL/glext.h:11704
+glGetPathLengthNV = _link_function('glGetPathLengthNV', GLfloat, [GLuint, GLsizei, GLsizei], 'NV_path_rendering')
+
+# GL/glext.h:11705
+glPointAlongPathNV = _link_function('glPointAlongPathNV', GLboolean, [GLuint, GLsizei, GLsizei, GLfloat, POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)], 'NV_path_rendering')
+
+PFNGLGENPATHSNVPROC = CFUNCTYPE(GLuint, GLsizei) # GL/glext.h:11707
+PFNGLDELETEPATHSNVPROC = CFUNCTYPE(None, GLuint, GLsizei) # GL/glext.h:11708
+PFNGLISPATHNVPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:11709
+PFNGLPATHCOMMANDSNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLubyte), GLsizei, GLenum, POINTER(GLvoid)) # GL/glext.h:11710
+PFNGLPATHCOORDSNVPROC = CFUNCTYPE(None, GLuint, GLsizei, GLenum, POINTER(GLvoid)) # GL/glext.h:11711
+PFNGLPATHSUBCOMMANDSNVPROC = CFUNCTYPE(None, GLuint, GLsizei, GLsizei, GLsizei, POINTER(GLubyte), GLsizei, GLenum, POINTER(GLvoid)) # GL/glext.h:11712
+PFNGLPATHSUBCOORDSNVPROC = CFUNCTYPE(None, GLuint, GLsizei, GLsizei, GLenum, POINTER(GLvoid)) # GL/glext.h:11713
+PFNGLPATHSTRINGNVPROC = CFUNCTYPE(None, GLuint, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:11714
+PFNGLPATHGLYPHSNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLvoid), GLbitfield, GLsizei, GLenum, POINTER(GLvoid), GLenum, GLuint, GLfloat) # GL/glext.h:11715
+PFNGLPATHGLYPHRANGENVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLvoid), GLbitfield, GLuint, GLsizei, GLenum, GLuint, GLfloat) # GL/glext.h:11716
+PFNGLWEIGHTPATHSNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLuint), POINTER(GLfloat)) # GL/glext.h:11717
+PFNGLCOPYPATHNVPROC = CFUNCTYPE(None, GLuint, GLuint) # GL/glext.h:11718
+PFNGLINTERPOLATEPATHSNVPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint, GLfloat) # GL/glext.h:11719
+PFNGLTRANSFORMPATHNVPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:11720
+PFNGLPATHPARAMETERIVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:11721
+PFNGLPATHPARAMETERINVPROC = CFUNCTYPE(None, GLuint, GLenum, GLint) # GL/glext.h:11722
+PFNGLPATHPARAMETERFVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:11723
+PFNGLPATHPARAMETERFNVPROC = CFUNCTYPE(None, GLuint, GLenum, GLfloat) # GL/glext.h:11724
+PFNGLPATHDASHARRAYNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLfloat)) # GL/glext.h:11725
+PFNGLPATHSTENCILFUNCNVPROC = CFUNCTYPE(None, GLenum, GLint, GLuint) # GL/glext.h:11726
+PFNGLPATHSTENCILDEPTHOFFSETNVPROC = CFUNCTYPE(None, GLfloat, GLfloat) # GL/glext.h:11727
+PFNGLSTENCILFILLPATHNVPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint) # GL/glext.h:11728
+PFNGLSTENCILSTROKEPATHNVPROC = CFUNCTYPE(None, GLuint, GLint, GLuint) # GL/glext.h:11729
+PFNGLSTENCILFILLPATHINSTANCEDNVPROC = CFUNCTYPE(None, GLsizei, GLenum, POINTER(GLvoid), GLuint, GLenum, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:11730
+PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC = CFUNCTYPE(None, GLsizei, GLenum, POINTER(GLvoid), GLuint, GLint, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:11731
+PFNGLPATHCOVERDEPTHFUNCNVPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:11732
+PFNGLPATHCOLORGENNVPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:11733
+PFNGLPATHTEXGENNVPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, POINTER(GLfloat)) # GL/glext.h:11734
+PFNGLPATHFOGGENNVPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:11735
+PFNGLCOVERFILLPATHNVPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:11736
+PFNGLCOVERSTROKEPATHNVPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:11737
+PFNGLCOVERFILLPATHINSTANCEDNVPROC = CFUNCTYPE(None, GLsizei, GLenum, POINTER(GLvoid), GLuint, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:11738
+PFNGLCOVERSTROKEPATHINSTANCEDNVPROC = CFUNCTYPE(None, GLsizei, GLenum, POINTER(GLvoid), GLuint, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:11739
+PFNGLGETPATHPARAMETERIVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:11740
+PFNGLGETPATHPARAMETERFVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:11741
+PFNGLGETPATHCOMMANDSNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLubyte)) # GL/glext.h:11742
+PFNGLGETPATHCOORDSNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:11743
+PFNGLGETPATHDASHARRAYNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:11744
+PFNGLGETPATHMETRICSNVPROC = CFUNCTYPE(None, GLbitfield, GLsizei, GLenum, POINTER(GLvoid), GLuint, GLsizei, POINTER(GLfloat)) # GL/glext.h:11745
+PFNGLGETPATHMETRICRANGENVPROC = CFUNCTYPE(None, GLbitfield, GLuint, GLsizei, GLsizei, POINTER(GLfloat)) # GL/glext.h:11746
+PFNGLGETPATHSPACINGNVPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, POINTER(GLvoid), GLuint, GLfloat, GLfloat, GLenum, POINTER(GLfloat)) # GL/glext.h:11747
+PFNGLGETPATHCOLORGENIVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:11748
+PFNGLGETPATHCOLORGENFVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:11749
+PFNGLGETPATHTEXGENIVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:11750
+PFNGLGETPATHTEXGENFVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:11751
+PFNGLISPOINTINFILLPATHNVPROC = CFUNCTYPE(GLboolean, GLuint, GLuint, GLfloat, GLfloat) # GL/glext.h:11752
+PFNGLISPOINTINSTROKEPATHNVPROC = CFUNCTYPE(GLboolean, GLuint, GLfloat, GLfloat) # GL/glext.h:11753
+PFNGLGETPATHLENGTHNVPROC = CFUNCTYPE(GLfloat, GLuint, GLsizei, GLsizei) # GL/glext.h:11754
+PFNGLPOINTALONGPATHNVPROC = CFUNCTYPE(GLboolean, GLuint, GLsizei, GLsizei, GLfloat, POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:11755
+# AMD_pinned_memory (GL/glext.h:11758)
+GL_AMD_pinned_memory = 1 # GL/glext.h:11759
+# AMD_stencil_operation_extended (GL/glext.h:11762)
+GL_AMD_stencil_operation_extended = 1 # GL/glext.h:11763
+# GL/glext.h:11765
+glStencilOpValueAMD = _link_function('glStencilOpValueAMD', None, [GLenum, GLuint], 'AMD_stencil_operation_extended')
+
+PFNGLSTENCILOPVALUEAMDPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:11767
+# AMD_vertex_shader_viewport_index (GL/glext.h:11770)
+GL_AMD_vertex_shader_viewport_index = 1 # GL/glext.h:11771
+# AMD_vertex_shader_layer (GL/glext.h:11774)
+GL_AMD_vertex_shader_layer = 1 # GL/glext.h:11775
+# NV_bindless_texture (GL/glext.h:11778)
+GL_NV_bindless_texture = 1 # GL/glext.h:11779
+# GL/glext.h:11781
+glGetTextureHandleNV = _link_function('glGetTextureHandleNV', GLuint64, [GLuint], 'NV_bindless_texture')
+
+# GL/glext.h:11782
+glGetTextureSamplerHandleNV = _link_function('glGetTextureSamplerHandleNV', GLuint64, [GLuint, GLuint], 'NV_bindless_texture')
+
+# GL/glext.h:11783
+glMakeTextureHandleResidentNV = _link_function('glMakeTextureHandleResidentNV', None, [GLuint64], 'NV_bindless_texture')
+
+# GL/glext.h:11784
+glMakeTextureHandleNonResidentNV = _link_function('glMakeTextureHandleNonResidentNV', None, [GLuint64], 'NV_bindless_texture')
+
+# GL/glext.h:11785
+glGetImageHandleNV = _link_function('glGetImageHandleNV', GLuint64, [GLuint, GLint, GLboolean, GLint, GLenum], 'NV_bindless_texture')
+
+# GL/glext.h:11786
+glMakeImageHandleResidentNV = _link_function('glMakeImageHandleResidentNV', None, [GLuint64, GLenum], 'NV_bindless_texture')
+
+# GL/glext.h:11787
+glMakeImageHandleNonResidentNV = _link_function('glMakeImageHandleNonResidentNV', None, [GLuint64], 'NV_bindless_texture')
+
+# GL/glext.h:11788
+glUniformHandleui64NV = _link_function('glUniformHandleui64NV', None, [GLint, GLuint64], 'NV_bindless_texture')
+
+# GL/glext.h:11789
+glUniformHandleui64vNV = _link_function('glUniformHandleui64vNV', None, [GLint, GLsizei, POINTER(GLuint64)], 'NV_bindless_texture')
+
+# GL/glext.h:11790
+glProgramUniformHandleui64NV = _link_function('glProgramUniformHandleui64NV', None, [GLuint, GLint, GLuint64], 'NV_bindless_texture')
+
+# GL/glext.h:11791
+glProgramUniformHandleui64vNV = _link_function('glProgramUniformHandleui64vNV', None, [GLuint, GLint, GLsizei, POINTER(GLuint64)], 'NV_bindless_texture')
+
+# GL/glext.h:11792
+glIsTextureHandleResidentNV = _link_function('glIsTextureHandleResidentNV', GLboolean, [GLuint64], 'NV_bindless_texture')
+
+# GL/glext.h:11793
+glIsImageHandleResidentNV = _link_function('glIsImageHandleResidentNV', GLboolean, [GLuint64], 'NV_bindless_texture')
+
+PFNGLGETTEXTUREHANDLENVPROC = CFUNCTYPE(GLuint64, GLuint) # GL/glext.h:11795
+PFNGLGETTEXTURESAMPLERHANDLENVPROC = CFUNCTYPE(GLuint64, GLuint, GLuint) # GL/glext.h:11796
+PFNGLMAKETEXTUREHANDLERESIDENTNVPROC = CFUNCTYPE(None, GLuint64) # GL/glext.h:11797
+PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC = CFUNCTYPE(None, GLuint64) # GL/glext.h:11798
+PFNGLGETIMAGEHANDLENVPROC = CFUNCTYPE(GLuint64, GLuint, GLint, GLboolean, GLint, GLenum) # GL/glext.h:11799
+PFNGLMAKEIMAGEHANDLERESIDENTNVPROC = CFUNCTYPE(None, GLuint64, GLenum) # GL/glext.h:11800
+PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC = CFUNCTYPE(None, GLuint64) # GL/glext.h:11801
+PFNGLUNIFORMHANDLEUI64NVPROC = CFUNCTYPE(None, GLint, GLuint64) # GL/glext.h:11802
+PFNGLUNIFORMHANDLEUI64VNVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint64)) # GL/glext.h:11803
+PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC = CFUNCTYPE(None, GLuint, GLint, GLuint64) # GL/glext.h:11804
+PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint64)) # GL/glext.h:11805
+PFNGLISTEXTUREHANDLERESIDENTNVPROC = CFUNCTYPE(GLboolean, GLuint64) # GL/glext.h:11806
+PFNGLISIMAGEHANDLERESIDENTNVPROC = CFUNCTYPE(GLboolean, GLuint64) # GL/glext.h:11807
+# NV_shader_atomic_float (GL/glext.h:11810)
+GL_NV_shader_atomic_float = 1 # GL/glext.h:11811
+# AMD_query_buffer_object (GL/glext.h:11814)
+GL_AMD_query_buffer_object = 1 # GL/glext.h:11815
+# MESA_shader_debug (/usr/include/GL/gl.h:2093)
+# MESA_packed_depth_stencil (/usr/include/GL/gl.h:2115)
+# MESA_program_debug (/usr/include/GL/gl.h:2127)
+# MESA_texture_array (/usr/include/GL/gl.h:2148)
+# EXT_texture_array (/usr/include/GL/gl.h:2153)
+# ATI_blend_equation_separate (/usr/include/GL/gl.h:2181)
+# OES_EGL_image (/usr/include/GL/gl.h:2193)
+# OES_EGL_image (/usr/include/GL/gl.h:2197)
+
+__all__ = ['GL_GLEXT_VERSION', 'GL_RESCALE_NORMAL',
+'GL_LIGHT_MODEL_COLOR_CONTROL', 'GL_SINGLE_COLOR',
+'GL_SEPARATE_SPECULAR_COLOR', 'GL_ALIASED_POINT_SIZE_RANGE',
+'GL_CONVOLUTION_1D', 'GL_CONVOLUTION_2D', 'GL_SEPARABLE_2D',
+'GL_CONVOLUTION_BORDER_MODE', 'GL_CONVOLUTION_FILTER_SCALE',
+'GL_CONVOLUTION_FILTER_BIAS', 'GL_REDUCE', 'GL_CONVOLUTION_FORMAT',
+'GL_CONVOLUTION_WIDTH', 'GL_CONVOLUTION_HEIGHT', 'GL_MAX_CONVOLUTION_WIDTH',
+'GL_MAX_CONVOLUTION_HEIGHT', 'GL_POST_CONVOLUTION_RED_SCALE',
+'GL_POST_CONVOLUTION_GREEN_SCALE', 'GL_POST_CONVOLUTION_BLUE_SCALE',
+'GL_POST_CONVOLUTION_ALPHA_SCALE', 'GL_POST_CONVOLUTION_RED_BIAS',
+'GL_POST_CONVOLUTION_GREEN_BIAS', 'GL_POST_CONVOLUTION_BLUE_BIAS',
+'GL_POST_CONVOLUTION_ALPHA_BIAS', 'GL_HISTOGRAM', 'GL_PROXY_HISTOGRAM',
+'GL_HISTOGRAM_WIDTH', 'GL_HISTOGRAM_FORMAT', 'GL_HISTOGRAM_RED_SIZE',
+'GL_HISTOGRAM_GREEN_SIZE', 'GL_HISTOGRAM_BLUE_SIZE',
+'GL_HISTOGRAM_ALPHA_SIZE', 'GL_HISTOGRAM_LUMINANCE_SIZE', 'GL_HISTOGRAM_SINK',
+'GL_MINMAX', 'GL_MINMAX_FORMAT', 'GL_MINMAX_SINK', 'GL_TABLE_TOO_LARGE',
+'GL_COLOR_MATRIX', 'GL_COLOR_MATRIX_STACK_DEPTH',
+'GL_MAX_COLOR_MATRIX_STACK_DEPTH', 'GL_POST_COLOR_MATRIX_RED_SCALE',
+'GL_POST_COLOR_MATRIX_GREEN_SCALE', 'GL_POST_COLOR_MATRIX_BLUE_SCALE',
+'GL_POST_COLOR_MATRIX_ALPHA_SCALE', 'GL_POST_COLOR_MATRIX_RED_BIAS',
+'GL_POST_COLOR_MATRIX_GREEN_BIAS', 'GL_POST_COLOR_MATRIX_BLUE_BIAS',
+'GL_POST_COLOR_MATRIX_ALPHA_BIAS', 'GL_COLOR_TABLE',
+'GL_POST_CONVOLUTION_COLOR_TABLE', 'GL_POST_COLOR_MATRIX_COLOR_TABLE',
+'GL_PROXY_COLOR_TABLE', 'GL_PROXY_POST_CONVOLUTION_COLOR_TABLE',
+'GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE', 'GL_COLOR_TABLE_SCALE',
+'GL_COLOR_TABLE_BIAS', 'GL_COLOR_TABLE_FORMAT', 'GL_COLOR_TABLE_WIDTH',
+'GL_COLOR_TABLE_RED_SIZE', 'GL_COLOR_TABLE_GREEN_SIZE',
+'GL_COLOR_TABLE_BLUE_SIZE', 'GL_COLOR_TABLE_ALPHA_SIZE',
+'GL_COLOR_TABLE_LUMINANCE_SIZE', 'GL_COLOR_TABLE_INTENSITY_SIZE',
+'GL_CONSTANT_BORDER', 'GL_REPLICATE_BORDER', 'GL_CONVOLUTION_BORDER_COLOR',
+'GL_CLIENT_ACTIVE_TEXTURE', 'GL_MAX_TEXTURE_UNITS',
+'GL_TRANSPOSE_MODELVIEW_MATRIX', 'GL_TRANSPOSE_PROJECTION_MATRIX',
+'GL_TRANSPOSE_TEXTURE_MATRIX', 'GL_TRANSPOSE_COLOR_MATRIX',
+'GL_MULTISAMPLE_BIT', 'GL_NORMAL_MAP', 'GL_REFLECTION_MAP',
+'GL_COMPRESSED_ALPHA', 'GL_COMPRESSED_LUMINANCE',
+'GL_COMPRESSED_LUMINANCE_ALPHA', 'GL_COMPRESSED_INTENSITY', 'GL_COMBINE',
+'GL_COMBINE_RGB', 'GL_COMBINE_ALPHA', 'GL_SOURCE0_RGB', 'GL_SOURCE1_RGB',
+'GL_SOURCE2_RGB', 'GL_SOURCE0_ALPHA', 'GL_SOURCE1_ALPHA', 'GL_SOURCE2_ALPHA',
+'GL_OPERAND0_RGB', 'GL_OPERAND1_RGB', 'GL_OPERAND2_RGB', 'GL_OPERAND0_ALPHA',
+'GL_OPERAND1_ALPHA', 'GL_OPERAND2_ALPHA', 'GL_RGB_SCALE', 'GL_ADD_SIGNED',
+'GL_INTERPOLATE', 'GL_SUBTRACT', 'GL_CONSTANT', 'GL_PRIMARY_COLOR',
+'GL_PREVIOUS', 'GL_DOT3_RGB', 'GL_DOT3_RGBA', 'GL_BLEND_DST_RGB',
+'GL_BLEND_SRC_RGB', 'GL_BLEND_DST_ALPHA', 'GL_BLEND_SRC_ALPHA',
+'GL_POINT_FADE_THRESHOLD_SIZE', 'GL_DEPTH_COMPONENT16',
+'GL_DEPTH_COMPONENT24', 'GL_DEPTH_COMPONENT32', 'GL_MIRRORED_REPEAT',
+'GL_MAX_TEXTURE_LOD_BIAS', 'GL_TEXTURE_LOD_BIAS', 'GL_INCR_WRAP',
+'GL_DECR_WRAP', 'GL_TEXTURE_DEPTH_SIZE', 'GL_TEXTURE_COMPARE_MODE',
+'GL_TEXTURE_COMPARE_FUNC', 'GL_POINT_SIZE_MIN', 'GL_POINT_SIZE_MAX',
+'GL_POINT_DISTANCE_ATTENUATION', 'GL_GENERATE_MIPMAP',
+'GL_GENERATE_MIPMAP_HINT', 'GL_FOG_COORDINATE_SOURCE', 'GL_FOG_COORDINATE',
+'GL_FRAGMENT_DEPTH', 'GL_CURRENT_FOG_COORDINATE',
+'GL_FOG_COORDINATE_ARRAY_TYPE', 'GL_FOG_COORDINATE_ARRAY_STRIDE',
+'GL_FOG_COORDINATE_ARRAY_POINTER', 'GL_FOG_COORDINATE_ARRAY', 'GL_COLOR_SUM',
+'GL_CURRENT_SECONDARY_COLOR', 'GL_SECONDARY_COLOR_ARRAY_SIZE',
+'GL_SECONDARY_COLOR_ARRAY_TYPE', 'GL_SECONDARY_COLOR_ARRAY_STRIDE',
+'GL_SECONDARY_COLOR_ARRAY_POINTER', 'GL_SECONDARY_COLOR_ARRAY',
+'GL_TEXTURE_FILTER_CONTROL', 'GL_DEPTH_TEXTURE_MODE',
+'GL_COMPARE_R_TO_TEXTURE', 'GL_BUFFER_SIZE', 'GL_BUFFER_USAGE',
+'GL_QUERY_COUNTER_BITS', 'GL_CURRENT_QUERY', 'GL_QUERY_RESULT',
+'GL_QUERY_RESULT_AVAILABLE', 'GL_ARRAY_BUFFER', 'GL_ELEMENT_ARRAY_BUFFER',
+'GL_ARRAY_BUFFER_BINDING', 'GL_ELEMENT_ARRAY_BUFFER_BINDING',
+'GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING', 'GL_READ_ONLY', 'GL_WRITE_ONLY',
+'GL_READ_WRITE', 'GL_BUFFER_ACCESS', 'GL_BUFFER_MAPPED',
+'GL_BUFFER_MAP_POINTER', 'GL_STREAM_DRAW', 'GL_STREAM_READ', 'GL_STREAM_COPY',
+'GL_STATIC_DRAW', 'GL_STATIC_READ', 'GL_STATIC_COPY', 'GL_DYNAMIC_DRAW',
+'GL_DYNAMIC_READ', 'GL_DYNAMIC_COPY', 'GL_SAMPLES_PASSED',
+'GL_VERTEX_ARRAY_BUFFER_BINDING', 'GL_NORMAL_ARRAY_BUFFER_BINDING',
+'GL_COLOR_ARRAY_BUFFER_BINDING', 'GL_INDEX_ARRAY_BUFFER_BINDING',
+'GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING', 'GL_EDGE_FLAG_ARRAY_BUFFER_BINDING',
+'GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING',
+'GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING', 'GL_WEIGHT_ARRAY_BUFFER_BINDING',
+'GL_FOG_COORD_SRC', 'GL_FOG_COORD', 'GL_CURRENT_FOG_COORD',
+'GL_FOG_COORD_ARRAY_TYPE', 'GL_FOG_COORD_ARRAY_STRIDE',
+'GL_FOG_COORD_ARRAY_POINTER', 'GL_FOG_COORD_ARRAY',
+'GL_FOG_COORD_ARRAY_BUFFER_BINDING', 'GL_SRC0_RGB', 'GL_SRC1_RGB',
+'GL_SRC2_RGB', 'GL_SRC0_ALPHA', 'GL_SRC1_ALPHA', 'GL_SRC2_ALPHA',
+'GL_BLEND_EQUATION_RGB', 'GL_VERTEX_ATTRIB_ARRAY_ENABLED',
+'GL_VERTEX_ATTRIB_ARRAY_SIZE', 'GL_VERTEX_ATTRIB_ARRAY_STRIDE',
+'GL_VERTEX_ATTRIB_ARRAY_TYPE', 'GL_CURRENT_VERTEX_ATTRIB',
+'GL_VERTEX_PROGRAM_POINT_SIZE', 'GL_VERTEX_ATTRIB_ARRAY_POINTER',
+'GL_STENCIL_BACK_FUNC', 'GL_STENCIL_BACK_FAIL',
+'GL_STENCIL_BACK_PASS_DEPTH_FAIL', 'GL_STENCIL_BACK_PASS_DEPTH_PASS',
+'GL_MAX_DRAW_BUFFERS', 'GL_DRAW_BUFFER0', 'GL_DRAW_BUFFER1',
+'GL_DRAW_BUFFER2', 'GL_DRAW_BUFFER3', 'GL_DRAW_BUFFER4', 'GL_DRAW_BUFFER5',
+'GL_DRAW_BUFFER6', 'GL_DRAW_BUFFER7', 'GL_DRAW_BUFFER8', 'GL_DRAW_BUFFER9',
+'GL_DRAW_BUFFER10', 'GL_DRAW_BUFFER11', 'GL_DRAW_BUFFER12',
+'GL_DRAW_BUFFER13', 'GL_DRAW_BUFFER14', 'GL_DRAW_BUFFER15',
+'GL_BLEND_EQUATION_ALPHA', 'GL_MAX_VERTEX_ATTRIBS',
+'GL_VERTEX_ATTRIB_ARRAY_NORMALIZED', 'GL_MAX_TEXTURE_IMAGE_UNITS',
+'GL_FRAGMENT_SHADER', 'GL_VERTEX_SHADER',
+'GL_MAX_FRAGMENT_UNIFORM_COMPONENTS', 'GL_MAX_VERTEX_UNIFORM_COMPONENTS',
+'GL_MAX_VARYING_FLOATS', 'GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS',
+'GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS', 'GL_SHADER_TYPE', 'GL_FLOAT_VEC2',
+'GL_FLOAT_VEC3', 'GL_FLOAT_VEC4', 'GL_INT_VEC2', 'GL_INT_VEC3', 'GL_INT_VEC4',
+'GL_BOOL', 'GL_BOOL_VEC2', 'GL_BOOL_VEC3', 'GL_BOOL_VEC4', 'GL_FLOAT_MAT2',
+'GL_FLOAT_MAT3', 'GL_FLOAT_MAT4', 'GL_SAMPLER_1D', 'GL_SAMPLER_2D',
+'GL_SAMPLER_3D', 'GL_SAMPLER_CUBE', 'GL_SAMPLER_1D_SHADOW',
+'GL_SAMPLER_2D_SHADOW', 'GL_DELETE_STATUS', 'GL_COMPILE_STATUS',
+'GL_LINK_STATUS', 'GL_VALIDATE_STATUS', 'GL_INFO_LOG_LENGTH',
+'GL_ATTACHED_SHADERS', 'GL_ACTIVE_UNIFORMS', 'GL_ACTIVE_UNIFORM_MAX_LENGTH',
+'GL_SHADER_SOURCE_LENGTH', 'GL_ACTIVE_ATTRIBUTES',
+'GL_ACTIVE_ATTRIBUTE_MAX_LENGTH', 'GL_FRAGMENT_SHADER_DERIVATIVE_HINT',
+'GL_SHADING_LANGUAGE_VERSION', 'GL_CURRENT_PROGRAM',
+'GL_POINT_SPRITE_COORD_ORIGIN', 'GL_LOWER_LEFT', 'GL_UPPER_LEFT',
+'GL_STENCIL_BACK_REF', 'GL_STENCIL_BACK_VALUE_MASK',
+'GL_STENCIL_BACK_WRITEMASK', 'GL_VERTEX_PROGRAM_TWO_SIDE', 'GL_POINT_SPRITE',
+'GL_COORD_REPLACE', 'GL_MAX_TEXTURE_COORDS', 'GL_PIXEL_PACK_BUFFER',
+'GL_PIXEL_UNPACK_BUFFER', 'GL_PIXEL_PACK_BUFFER_BINDING',
+'GL_PIXEL_UNPACK_BUFFER_BINDING', 'GL_FLOAT_MAT2x3', 'GL_FLOAT_MAT2x4',
+'GL_FLOAT_MAT3x2', 'GL_FLOAT_MAT3x4', 'GL_FLOAT_MAT4x2', 'GL_FLOAT_MAT4x3',
+'GL_SRGB', 'GL_SRGB8', 'GL_SRGB_ALPHA', 'GL_SRGB8_ALPHA8',
+'GL_COMPRESSED_SRGB', 'GL_COMPRESSED_SRGB_ALPHA',
+'GL_CURRENT_RASTER_SECONDARY_COLOR', 'GL_SLUMINANCE_ALPHA',
+'GL_SLUMINANCE8_ALPHA8', 'GL_SLUMINANCE', 'GL_SLUMINANCE8',
+'GL_COMPRESSED_SLUMINANCE', 'GL_COMPRESSED_SLUMINANCE_ALPHA',
+'GL_COMPARE_REF_TO_TEXTURE', 'GL_CLIP_DISTANCE0', 'GL_CLIP_DISTANCE1',
+'GL_CLIP_DISTANCE2', 'GL_CLIP_DISTANCE3', 'GL_CLIP_DISTANCE4',
+'GL_CLIP_DISTANCE5', 'GL_CLIP_DISTANCE6', 'GL_CLIP_DISTANCE7',
+'GL_MAX_CLIP_DISTANCES', 'GL_MAJOR_VERSION', 'GL_MINOR_VERSION',
+'GL_NUM_EXTENSIONS', 'GL_CONTEXT_FLAGS', 'GL_COMPRESSED_RED',
+'GL_COMPRESSED_RG', 'GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT', 'GL_RGBA32F',
+'GL_RGB32F', 'GL_RGBA16F', 'GL_RGB16F', 'GL_VERTEX_ATTRIB_ARRAY_INTEGER',
+'GL_MAX_ARRAY_TEXTURE_LAYERS', 'GL_MIN_PROGRAM_TEXEL_OFFSET',
+'GL_MAX_PROGRAM_TEXEL_OFFSET', 'GL_CLAMP_READ_COLOR', 'GL_FIXED_ONLY',
+'GL_MAX_VARYING_COMPONENTS', 'GL_TEXTURE_1D_ARRAY',
+'GL_PROXY_TEXTURE_1D_ARRAY', 'GL_TEXTURE_2D_ARRAY',
+'GL_PROXY_TEXTURE_2D_ARRAY', 'GL_TEXTURE_BINDING_1D_ARRAY',
+'GL_TEXTURE_BINDING_2D_ARRAY', 'GL_R11F_G11F_B10F',
+'GL_UNSIGNED_INT_10F_11F_11F_REV', 'GL_RGB9_E5',
+'GL_UNSIGNED_INT_5_9_9_9_REV', 'GL_TEXTURE_SHARED_SIZE',
+'GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH',
+'GL_TRANSFORM_FEEDBACK_BUFFER_MODE',
+'GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS',
+'GL_TRANSFORM_FEEDBACK_VARYINGS', 'GL_TRANSFORM_FEEDBACK_BUFFER_START',
+'GL_TRANSFORM_FEEDBACK_BUFFER_SIZE', 'GL_PRIMITIVES_GENERATED',
+'GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN', 'GL_RASTERIZER_DISCARD',
+'GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS',
+'GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS', 'GL_INTERLEAVED_ATTRIBS',
+'GL_SEPARATE_ATTRIBS', 'GL_TRANSFORM_FEEDBACK_BUFFER',
+'GL_TRANSFORM_FEEDBACK_BUFFER_BINDING', 'GL_RGBA32UI', 'GL_RGB32UI',
+'GL_RGBA16UI', 'GL_RGB16UI', 'GL_RGBA8UI', 'GL_RGB8UI', 'GL_RGBA32I',
+'GL_RGB32I', 'GL_RGBA16I', 'GL_RGB16I', 'GL_RGBA8I', 'GL_RGB8I',
+'GL_RED_INTEGER', 'GL_GREEN_INTEGER', 'GL_BLUE_INTEGER', 'GL_RGB_INTEGER',
+'GL_RGBA_INTEGER', 'GL_BGR_INTEGER', 'GL_BGRA_INTEGER', 'GL_SAMPLER_1D_ARRAY',
+'GL_SAMPLER_2D_ARRAY', 'GL_SAMPLER_1D_ARRAY_SHADOW',
+'GL_SAMPLER_2D_ARRAY_SHADOW', 'GL_SAMPLER_CUBE_SHADOW',
+'GL_UNSIGNED_INT_VEC2', 'GL_UNSIGNED_INT_VEC3', 'GL_UNSIGNED_INT_VEC4',
+'GL_INT_SAMPLER_1D', 'GL_INT_SAMPLER_2D', 'GL_INT_SAMPLER_3D',
+'GL_INT_SAMPLER_CUBE', 'GL_INT_SAMPLER_1D_ARRAY', 'GL_INT_SAMPLER_2D_ARRAY',
+'GL_UNSIGNED_INT_SAMPLER_1D', 'GL_UNSIGNED_INT_SAMPLER_2D',
+'GL_UNSIGNED_INT_SAMPLER_3D', 'GL_UNSIGNED_INT_SAMPLER_CUBE',
+'GL_UNSIGNED_INT_SAMPLER_1D_ARRAY', 'GL_UNSIGNED_INT_SAMPLER_2D_ARRAY',
+'GL_QUERY_WAIT', 'GL_QUERY_NO_WAIT', 'GL_QUERY_BY_REGION_WAIT',
+'GL_QUERY_BY_REGION_NO_WAIT', 'GL_BUFFER_ACCESS_FLAGS',
+'GL_BUFFER_MAP_LENGTH', 'GL_BUFFER_MAP_OFFSET', 'GL_CLAMP_VERTEX_COLOR',
+'GL_CLAMP_FRAGMENT_COLOR', 'GL_ALPHA_INTEGER', 'GL_SAMPLER_2D_RECT',
+'GL_SAMPLER_2D_RECT_SHADOW', 'GL_SAMPLER_BUFFER', 'GL_INT_SAMPLER_2D_RECT',
+'GL_INT_SAMPLER_BUFFER', 'GL_UNSIGNED_INT_SAMPLER_2D_RECT',
+'GL_UNSIGNED_INT_SAMPLER_BUFFER', 'GL_TEXTURE_BUFFER',
+'GL_MAX_TEXTURE_BUFFER_SIZE', 'GL_TEXTURE_BINDING_BUFFER',
+'GL_TEXTURE_BUFFER_DATA_STORE_BINDING', 'GL_TEXTURE_BUFFER_FORMAT',
+'GL_TEXTURE_RECTANGLE', 'GL_TEXTURE_BINDING_RECTANGLE',
+'GL_PROXY_TEXTURE_RECTANGLE', 'GL_MAX_RECTANGLE_TEXTURE_SIZE', 'GL_RED_SNORM',
+'GL_RG_SNORM', 'GL_RGB_SNORM', 'GL_RGBA_SNORM', 'GL_R8_SNORM', 'GL_RG8_SNORM',
+'GL_RGB8_SNORM', 'GL_RGBA8_SNORM', 'GL_R16_SNORM', 'GL_RG16_SNORM',
+'GL_RGB16_SNORM', 'GL_RGBA16_SNORM', 'GL_SIGNED_NORMALIZED',
+'GL_PRIMITIVE_RESTART', 'GL_PRIMITIVE_RESTART_INDEX',
+'GL_CONTEXT_CORE_PROFILE_BIT', 'GL_CONTEXT_COMPATIBILITY_PROFILE_BIT',
+'GL_LINES_ADJACENCY', 'GL_LINE_STRIP_ADJACENCY', 'GL_TRIANGLES_ADJACENCY',
+'GL_TRIANGLE_STRIP_ADJACENCY', 'GL_PROGRAM_POINT_SIZE',
+'GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS', 'GL_FRAMEBUFFER_ATTACHMENT_LAYERED',
+'GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS', 'GL_GEOMETRY_SHADER',
+'GL_GEOMETRY_VERTICES_OUT', 'GL_GEOMETRY_INPUT_TYPE',
+'GL_GEOMETRY_OUTPUT_TYPE', 'GL_MAX_GEOMETRY_UNIFORM_COMPONENTS',
+'GL_MAX_GEOMETRY_OUTPUT_VERTICES', 'GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS',
+'GL_MAX_VERTEX_OUTPUT_COMPONENTS', 'GL_MAX_GEOMETRY_INPUT_COMPONENTS',
+'GL_MAX_GEOMETRY_OUTPUT_COMPONENTS', 'GL_MAX_FRAGMENT_INPUT_COMPONENTS',
+'GL_CONTEXT_PROFILE_MASK', 'GL_VERTEX_ATTRIB_ARRAY_DIVISOR',
+'GL_SAMPLE_SHADING', 'GL_MIN_SAMPLE_SHADING_VALUE',
+'GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET',
+'GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET', 'GL_TEXTURE_CUBE_MAP_ARRAY',
+'GL_TEXTURE_BINDING_CUBE_MAP_ARRAY', 'GL_PROXY_TEXTURE_CUBE_MAP_ARRAY',
+'GL_SAMPLER_CUBE_MAP_ARRAY', 'GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW',
+'GL_INT_SAMPLER_CUBE_MAP_ARRAY', 'GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY',
+'GL_TRANSPOSE_MODELVIEW_MATRIX_ARB', 'GL_TRANSPOSE_PROJECTION_MATRIX_ARB',
+'GL_TRANSPOSE_TEXTURE_MATRIX_ARB', 'GL_TRANSPOSE_COLOR_MATRIX_ARB',
+'GL_MULTISAMPLE_ARB', 'GL_SAMPLE_ALPHA_TO_COVERAGE_ARB',
+'GL_SAMPLE_ALPHA_TO_ONE_ARB', 'GL_SAMPLE_COVERAGE_ARB',
+'GL_SAMPLE_BUFFERS_ARB', 'GL_SAMPLES_ARB', 'GL_SAMPLE_COVERAGE_VALUE_ARB',
+'GL_SAMPLE_COVERAGE_INVERT_ARB', 'GL_MULTISAMPLE_BIT_ARB',
+'GL_NORMAL_MAP_ARB', 'GL_REFLECTION_MAP_ARB', 'GL_TEXTURE_CUBE_MAP_ARB',
+'GL_TEXTURE_BINDING_CUBE_MAP_ARB', 'GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB',
+'GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB', 'GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB',
+'GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB', 'GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB',
+'GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB', 'GL_PROXY_TEXTURE_CUBE_MAP_ARB',
+'GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB', 'GL_COMPRESSED_ALPHA_ARB',
+'GL_COMPRESSED_LUMINANCE_ARB', 'GL_COMPRESSED_LUMINANCE_ALPHA_ARB',
+'GL_COMPRESSED_INTENSITY_ARB', 'GL_COMPRESSED_RGB_ARB',
+'GL_COMPRESSED_RGBA_ARB', 'GL_TEXTURE_COMPRESSION_HINT_ARB',
+'GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB', 'GL_TEXTURE_COMPRESSED_ARB',
+'GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB', 'GL_COMPRESSED_TEXTURE_FORMATS_ARB',
+'GL_CLAMP_TO_BORDER_ARB', 'GL_POINT_SIZE_MIN_ARB', 'GL_POINT_SIZE_MAX_ARB',
+'GL_POINT_FADE_THRESHOLD_SIZE_ARB', 'GL_POINT_DISTANCE_ATTENUATION_ARB',
+'GL_MAX_VERTEX_UNITS_ARB', 'GL_ACTIVE_VERTEX_UNITS_ARB',
+'GL_WEIGHT_SUM_UNITY_ARB', 'GL_VERTEX_BLEND_ARB', 'GL_CURRENT_WEIGHT_ARB',
+'GL_WEIGHT_ARRAY_TYPE_ARB', 'GL_WEIGHT_ARRAY_STRIDE_ARB',
+'GL_WEIGHT_ARRAY_SIZE_ARB', 'GL_WEIGHT_ARRAY_POINTER_ARB',
+'GL_WEIGHT_ARRAY_ARB', 'GL_MODELVIEW0_ARB', 'GL_MODELVIEW1_ARB',
+'GL_MODELVIEW2_ARB', 'GL_MODELVIEW3_ARB', 'GL_MODELVIEW4_ARB',
+'GL_MODELVIEW5_ARB', 'GL_MODELVIEW6_ARB', 'GL_MODELVIEW7_ARB',
+'GL_MODELVIEW8_ARB', 'GL_MODELVIEW9_ARB', 'GL_MODELVIEW10_ARB',
+'GL_MODELVIEW11_ARB', 'GL_MODELVIEW12_ARB', 'GL_MODELVIEW13_ARB',
+'GL_MODELVIEW14_ARB', 'GL_MODELVIEW15_ARB', 'GL_MODELVIEW16_ARB',
+'GL_MODELVIEW17_ARB', 'GL_MODELVIEW18_ARB', 'GL_MODELVIEW19_ARB',
+'GL_MODELVIEW20_ARB', 'GL_MODELVIEW21_ARB', 'GL_MODELVIEW22_ARB',
+'GL_MODELVIEW23_ARB', 'GL_MODELVIEW24_ARB', 'GL_MODELVIEW25_ARB',
+'GL_MODELVIEW26_ARB', 'GL_MODELVIEW27_ARB', 'GL_MODELVIEW28_ARB',
+'GL_MODELVIEW29_ARB', 'GL_MODELVIEW30_ARB', 'GL_MODELVIEW31_ARB',
+'GL_MATRIX_PALETTE_ARB', 'GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB',
+'GL_MAX_PALETTE_MATRICES_ARB', 'GL_CURRENT_PALETTE_MATRIX_ARB',
+'GL_MATRIX_INDEX_ARRAY_ARB', 'GL_CURRENT_MATRIX_INDEX_ARB',
+'GL_MATRIX_INDEX_ARRAY_SIZE_ARB', 'GL_MATRIX_INDEX_ARRAY_TYPE_ARB',
+'GL_MATRIX_INDEX_ARRAY_STRIDE_ARB', 'GL_MATRIX_INDEX_ARRAY_POINTER_ARB',
+'GL_COMBINE_ARB', 'GL_COMBINE_RGB_ARB', 'GL_COMBINE_ALPHA_ARB',
+'GL_SOURCE0_RGB_ARB', 'GL_SOURCE1_RGB_ARB', 'GL_SOURCE2_RGB_ARB',
+'GL_SOURCE0_ALPHA_ARB', 'GL_SOURCE1_ALPHA_ARB', 'GL_SOURCE2_ALPHA_ARB',
+'GL_OPERAND0_RGB_ARB', 'GL_OPERAND1_RGB_ARB', 'GL_OPERAND2_RGB_ARB',
+'GL_OPERAND0_ALPHA_ARB', 'GL_OPERAND1_ALPHA_ARB', 'GL_OPERAND2_ALPHA_ARB',
+'GL_RGB_SCALE_ARB', 'GL_ADD_SIGNED_ARB', 'GL_INTERPOLATE_ARB',
+'GL_SUBTRACT_ARB', 'GL_CONSTANT_ARB', 'GL_PRIMARY_COLOR_ARB',
+'GL_PREVIOUS_ARB', 'GL_DOT3_RGB_ARB', 'GL_DOT3_RGBA_ARB',
+'GL_MIRRORED_REPEAT_ARB', 'GL_DEPTH_COMPONENT16_ARB',
+'GL_DEPTH_COMPONENT24_ARB', 'GL_DEPTH_COMPONENT32_ARB',
+'GL_TEXTURE_DEPTH_SIZE_ARB', 'GL_DEPTH_TEXTURE_MODE_ARB',
+'GL_TEXTURE_COMPARE_MODE_ARB', 'GL_TEXTURE_COMPARE_FUNC_ARB',
+'GL_COMPARE_R_TO_TEXTURE_ARB', 'GL_TEXTURE_COMPARE_FAIL_VALUE_ARB',
+'GL_COLOR_SUM_ARB', 'GL_VERTEX_PROGRAM_ARB',
+'GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB', 'GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB',
+'GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB', 'GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB',
+'GL_CURRENT_VERTEX_ATTRIB_ARB', 'GL_PROGRAM_LENGTH_ARB',
+'GL_PROGRAM_STRING_ARB', 'GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB',
+'GL_MAX_PROGRAM_MATRICES_ARB', 'GL_CURRENT_MATRIX_STACK_DEPTH_ARB',
+'GL_CURRENT_MATRIX_ARB', 'GL_VERTEX_PROGRAM_POINT_SIZE_ARB',
+'GL_VERTEX_PROGRAM_TWO_SIDE_ARB', 'GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB',
+'GL_PROGRAM_ERROR_POSITION_ARB', 'GL_PROGRAM_BINDING_ARB',
+'GL_MAX_VERTEX_ATTRIBS_ARB', 'GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB',
+'GL_PROGRAM_ERROR_STRING_ARB', 'GL_PROGRAM_FORMAT_ASCII_ARB',
+'GL_PROGRAM_FORMAT_ARB', 'GL_PROGRAM_INSTRUCTIONS_ARB',
+'GL_MAX_PROGRAM_INSTRUCTIONS_ARB', 'GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB',
+'GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB', 'GL_PROGRAM_TEMPORARIES_ARB',
+'GL_MAX_PROGRAM_TEMPORARIES_ARB', 'GL_PROGRAM_NATIVE_TEMPORARIES_ARB',
+'GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB', 'GL_PROGRAM_PARAMETERS_ARB',
+'GL_MAX_PROGRAM_PARAMETERS_ARB', 'GL_PROGRAM_NATIVE_PARAMETERS_ARB',
+'GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB', 'GL_PROGRAM_ATTRIBS_ARB',
+'GL_MAX_PROGRAM_ATTRIBS_ARB', 'GL_PROGRAM_NATIVE_ATTRIBS_ARB',
+'GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB', 'GL_PROGRAM_ADDRESS_REGISTERS_ARB',
+'GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB',
+'GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB',
+'GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB',
+'GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB', 'GL_MAX_PROGRAM_ENV_PARAMETERS_ARB',
+'GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB', 'GL_TRANSPOSE_CURRENT_MATRIX_ARB',
+'GL_MATRIX0_ARB', 'GL_MATRIX1_ARB', 'GL_MATRIX2_ARB', 'GL_MATRIX3_ARB',
+'GL_MATRIX4_ARB', 'GL_MATRIX5_ARB', 'GL_MATRIX6_ARB', 'GL_MATRIX7_ARB',
+'GL_MATRIX8_ARB', 'GL_MATRIX9_ARB', 'GL_MATRIX10_ARB', 'GL_MATRIX11_ARB',
+'GL_MATRIX12_ARB', 'GL_MATRIX13_ARB', 'GL_MATRIX14_ARB', 'GL_MATRIX15_ARB',
+'GL_MATRIX16_ARB', 'GL_MATRIX17_ARB', 'GL_MATRIX18_ARB', 'GL_MATRIX19_ARB',
+'GL_MATRIX20_ARB', 'GL_MATRIX21_ARB', 'GL_MATRIX22_ARB', 'GL_MATRIX23_ARB',
+'GL_MATRIX24_ARB', 'GL_MATRIX25_ARB', 'GL_MATRIX26_ARB', 'GL_MATRIX27_ARB',
+'GL_MATRIX28_ARB', 'GL_MATRIX29_ARB', 'GL_MATRIX30_ARB', 'GL_MATRIX31_ARB',
+'GL_FRAGMENT_PROGRAM_ARB', 'GL_PROGRAM_ALU_INSTRUCTIONS_ARB',
+'GL_PROGRAM_TEX_INSTRUCTIONS_ARB', 'GL_PROGRAM_TEX_INDIRECTIONS_ARB',
+'GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB',
+'GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB',
+'GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB',
+'GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB', 'GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB',
+'GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB',
+'GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB',
+'GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB',
+'GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB', 'GL_MAX_TEXTURE_COORDS_ARB',
+'GL_MAX_TEXTURE_IMAGE_UNITS_ARB', 'GL_BUFFER_SIZE_ARB', 'GL_BUFFER_USAGE_ARB',
+'GL_ARRAY_BUFFER_ARB', 'GL_ELEMENT_ARRAY_BUFFER_ARB',
+'GL_ARRAY_BUFFER_BINDING_ARB', 'GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB',
+'GL_VERTEX_ARRAY_BUFFER_BINDING_ARB', 'GL_NORMAL_ARRAY_BUFFER_BINDING_ARB',
+'GL_COLOR_ARRAY_BUFFER_BINDING_ARB', 'GL_INDEX_ARRAY_BUFFER_BINDING_ARB',
+'GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB',
+'GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB',
+'GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB',
+'GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB',
+'GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB',
+'GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB', 'GL_READ_ONLY_ARB',
+'GL_WRITE_ONLY_ARB', 'GL_READ_WRITE_ARB', 'GL_BUFFER_ACCESS_ARB',
+'GL_BUFFER_MAPPED_ARB', 'GL_BUFFER_MAP_POINTER_ARB', 'GL_STREAM_DRAW_ARB',
+'GL_STREAM_READ_ARB', 'GL_STREAM_COPY_ARB', 'GL_STATIC_DRAW_ARB',
+'GL_STATIC_READ_ARB', 'GL_STATIC_COPY_ARB', 'GL_DYNAMIC_DRAW_ARB',
+'GL_DYNAMIC_READ_ARB', 'GL_DYNAMIC_COPY_ARB', 'GL_QUERY_COUNTER_BITS_ARB',
+'GL_CURRENT_QUERY_ARB', 'GL_QUERY_RESULT_ARB',
+'GL_QUERY_RESULT_AVAILABLE_ARB', 'GL_SAMPLES_PASSED_ARB',
+'GL_PROGRAM_OBJECT_ARB', 'GL_SHADER_OBJECT_ARB', 'GL_OBJECT_TYPE_ARB',
+'GL_OBJECT_SUBTYPE_ARB', 'GL_FLOAT_VEC2_ARB', 'GL_FLOAT_VEC3_ARB',
+'GL_FLOAT_VEC4_ARB', 'GL_INT_VEC2_ARB', 'GL_INT_VEC3_ARB', 'GL_INT_VEC4_ARB',
+'GL_BOOL_ARB', 'GL_BOOL_VEC2_ARB', 'GL_BOOL_VEC3_ARB', 'GL_BOOL_VEC4_ARB',
+'GL_FLOAT_MAT2_ARB', 'GL_FLOAT_MAT3_ARB', 'GL_FLOAT_MAT4_ARB',
+'GL_SAMPLER_1D_ARB', 'GL_SAMPLER_2D_ARB', 'GL_SAMPLER_3D_ARB',
+'GL_SAMPLER_CUBE_ARB', 'GL_SAMPLER_1D_SHADOW_ARB', 'GL_SAMPLER_2D_SHADOW_ARB',
+'GL_SAMPLER_2D_RECT_ARB', 'GL_SAMPLER_2D_RECT_SHADOW_ARB',
+'GL_OBJECT_DELETE_STATUS_ARB', 'GL_OBJECT_COMPILE_STATUS_ARB',
+'GL_OBJECT_LINK_STATUS_ARB', 'GL_OBJECT_VALIDATE_STATUS_ARB',
+'GL_OBJECT_INFO_LOG_LENGTH_ARB', 'GL_OBJECT_ATTACHED_OBJECTS_ARB',
+'GL_OBJECT_ACTIVE_UNIFORMS_ARB', 'GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB',
+'GL_OBJECT_SHADER_SOURCE_LENGTH_ARB', 'GL_VERTEX_SHADER_ARB',
+'GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB', 'GL_MAX_VARYING_FLOATS_ARB',
+'GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB',
+'GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB', 'GL_OBJECT_ACTIVE_ATTRIBUTES_ARB',
+'GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB', 'GL_FRAGMENT_SHADER_ARB',
+'GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB',
+'GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB', 'GL_SHADING_LANGUAGE_VERSION_ARB',
+'GL_POINT_SPRITE_ARB', 'GL_COORD_REPLACE_ARB', 'GL_MAX_DRAW_BUFFERS_ARB',
+'GL_DRAW_BUFFER0_ARB', 'GL_DRAW_BUFFER1_ARB', 'GL_DRAW_BUFFER2_ARB',
+'GL_DRAW_BUFFER3_ARB', 'GL_DRAW_BUFFER4_ARB', 'GL_DRAW_BUFFER5_ARB',
+'GL_DRAW_BUFFER6_ARB', 'GL_DRAW_BUFFER7_ARB', 'GL_DRAW_BUFFER8_ARB',
+'GL_DRAW_BUFFER9_ARB', 'GL_DRAW_BUFFER10_ARB', 'GL_DRAW_BUFFER11_ARB',
+'GL_DRAW_BUFFER12_ARB', 'GL_DRAW_BUFFER13_ARB', 'GL_DRAW_BUFFER14_ARB',
+'GL_DRAW_BUFFER15_ARB', 'GL_TEXTURE_RECTANGLE_ARB',
+'GL_TEXTURE_BINDING_RECTANGLE_ARB', 'GL_PROXY_TEXTURE_RECTANGLE_ARB',
+'GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB', 'GL_RGBA_FLOAT_MODE_ARB',
+'GL_CLAMP_VERTEX_COLOR_ARB', 'GL_CLAMP_FRAGMENT_COLOR_ARB',
+'GL_CLAMP_READ_COLOR_ARB', 'GL_FIXED_ONLY_ARB', 'GL_HALF_FLOAT_ARB',
+'GL_TEXTURE_RED_TYPE_ARB', 'GL_TEXTURE_GREEN_TYPE_ARB',
+'GL_TEXTURE_BLUE_TYPE_ARB', 'GL_TEXTURE_ALPHA_TYPE_ARB',
+'GL_TEXTURE_LUMINANCE_TYPE_ARB', 'GL_TEXTURE_INTENSITY_TYPE_ARB',
+'GL_TEXTURE_DEPTH_TYPE_ARB', 'GL_UNSIGNED_NORMALIZED_ARB', 'GL_RGBA32F_ARB',
+'GL_RGB32F_ARB', 'GL_ALPHA32F_ARB', 'GL_INTENSITY32F_ARB',
+'GL_LUMINANCE32F_ARB', 'GL_LUMINANCE_ALPHA32F_ARB', 'GL_RGBA16F_ARB',
+'GL_RGB16F_ARB', 'GL_ALPHA16F_ARB', 'GL_INTENSITY16F_ARB',
+'GL_LUMINANCE16F_ARB', 'GL_LUMINANCE_ALPHA16F_ARB',
+'GL_PIXEL_PACK_BUFFER_ARB', 'GL_PIXEL_UNPACK_BUFFER_ARB',
+'GL_PIXEL_PACK_BUFFER_BINDING_ARB', 'GL_PIXEL_UNPACK_BUFFER_BINDING_ARB',
+'GL_DEPTH_COMPONENT32F', 'GL_DEPTH32F_STENCIL8',
+'GL_FLOAT_32_UNSIGNED_INT_24_8_REV', 'GL_INVALID_FRAMEBUFFER_OPERATION',
+'GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING',
+'GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE',
+'GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE', 'GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE',
+'GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE', 'GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE',
+'GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE',
+'GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE', 'GL_FRAMEBUFFER_DEFAULT',
+'GL_FRAMEBUFFER_UNDEFINED', 'GL_DEPTH_STENCIL_ATTACHMENT',
+'GL_MAX_RENDERBUFFER_SIZE', 'GL_DEPTH_STENCIL', 'GL_UNSIGNED_INT_24_8',
+'GL_DEPTH24_STENCIL8', 'GL_TEXTURE_STENCIL_SIZE', 'GL_TEXTURE_RED_TYPE',
+'GL_TEXTURE_GREEN_TYPE', 'GL_TEXTURE_BLUE_TYPE', 'GL_TEXTURE_ALPHA_TYPE',
+'GL_TEXTURE_DEPTH_TYPE', 'GL_UNSIGNED_NORMALIZED', 'GL_FRAMEBUFFER_BINDING',
+'GL_DRAW_FRAMEBUFFER_BINDING', 'GL_RENDERBUFFER_BINDING',
+'GL_READ_FRAMEBUFFER', 'GL_DRAW_FRAMEBUFFER', 'GL_READ_FRAMEBUFFER_BINDING',
+'GL_RENDERBUFFER_SAMPLES', 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE',
+'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME',
+'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL',
+'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE',
+'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER', 'GL_FRAMEBUFFER_COMPLETE',
+'GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT',
+'GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT',
+'GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER',
+'GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER', 'GL_FRAMEBUFFER_UNSUPPORTED',
+'GL_MAX_COLOR_ATTACHMENTS', 'GL_COLOR_ATTACHMENT0', 'GL_COLOR_ATTACHMENT1',
+'GL_COLOR_ATTACHMENT2', 'GL_COLOR_ATTACHMENT3', 'GL_COLOR_ATTACHMENT4',
+'GL_COLOR_ATTACHMENT5', 'GL_COLOR_ATTACHMENT6', 'GL_COLOR_ATTACHMENT7',
+'GL_COLOR_ATTACHMENT8', 'GL_COLOR_ATTACHMENT9', 'GL_COLOR_ATTACHMENT10',
+'GL_COLOR_ATTACHMENT11', 'GL_COLOR_ATTACHMENT12', 'GL_COLOR_ATTACHMENT13',
+'GL_COLOR_ATTACHMENT14', 'GL_COLOR_ATTACHMENT15', 'GL_DEPTH_ATTACHMENT',
+'GL_STENCIL_ATTACHMENT', 'GL_FRAMEBUFFER', 'GL_RENDERBUFFER',
+'GL_RENDERBUFFER_WIDTH', 'GL_RENDERBUFFER_HEIGHT',
+'GL_RENDERBUFFER_INTERNAL_FORMAT', 'GL_STENCIL_INDEX1', 'GL_STENCIL_INDEX4',
+'GL_STENCIL_INDEX8', 'GL_STENCIL_INDEX16', 'GL_RENDERBUFFER_RED_SIZE',
+'GL_RENDERBUFFER_GREEN_SIZE', 'GL_RENDERBUFFER_BLUE_SIZE',
+'GL_RENDERBUFFER_ALPHA_SIZE', 'GL_RENDERBUFFER_DEPTH_SIZE',
+'GL_RENDERBUFFER_STENCIL_SIZE', 'GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE',
+'GL_MAX_SAMPLES', 'GL_INDEX', 'GL_TEXTURE_LUMINANCE_TYPE',
+'GL_TEXTURE_INTENSITY_TYPE', 'GL_FRAMEBUFFER_SRGB', 'GL_LINES_ADJACENCY_ARB',
+'GL_LINE_STRIP_ADJACENCY_ARB', 'GL_TRIANGLES_ADJACENCY_ARB',
+'GL_TRIANGLE_STRIP_ADJACENCY_ARB', 'GL_PROGRAM_POINT_SIZE_ARB',
+'GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB',
+'GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB',
+'GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB',
+'GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB', 'GL_GEOMETRY_SHADER_ARB',
+'GL_GEOMETRY_VERTICES_OUT_ARB', 'GL_GEOMETRY_INPUT_TYPE_ARB',
+'GL_GEOMETRY_OUTPUT_TYPE_ARB', 'GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB',
+'GL_MAX_VERTEX_VARYING_COMPONENTS_ARB',
+'GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB',
+'GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB',
+'GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB', 'GL_HALF_FLOAT',
+'GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB', 'GL_MAP_READ_BIT', 'GL_MAP_WRITE_BIT',
+'GL_MAP_INVALIDATE_RANGE_BIT', 'GL_MAP_INVALIDATE_BUFFER_BIT',
+'GL_MAP_FLUSH_EXPLICIT_BIT', 'GL_MAP_UNSYNCHRONIZED_BIT',
+'GL_TEXTURE_BUFFER_ARB', 'GL_MAX_TEXTURE_BUFFER_SIZE_ARB',
+'GL_TEXTURE_BINDING_BUFFER_ARB', 'GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB',
+'GL_TEXTURE_BUFFER_FORMAT_ARB', 'GL_COMPRESSED_RED_RGTC1',
+'GL_COMPRESSED_SIGNED_RED_RGTC1', 'GL_COMPRESSED_RG_RGTC2',
+'GL_COMPRESSED_SIGNED_RG_RGTC2', 'GL_RG', 'GL_RG_INTEGER', 'GL_R8', 'GL_R16',
+'GL_RG8', 'GL_RG16', 'GL_R16F', 'GL_R32F', 'GL_RG16F', 'GL_RG32F', 'GL_R8I',
+'GL_R8UI', 'GL_R16I', 'GL_R16UI', 'GL_R32I', 'GL_R32UI', 'GL_RG8I',
+'GL_RG8UI', 'GL_RG16I', 'GL_RG16UI', 'GL_RG32I', 'GL_RG32UI',
+'GL_VERTEX_ARRAY_BINDING', 'GL_UNIFORM_BUFFER', 'GL_UNIFORM_BUFFER_BINDING',
+'GL_UNIFORM_BUFFER_START', 'GL_UNIFORM_BUFFER_SIZE',
+'GL_MAX_VERTEX_UNIFORM_BLOCKS', 'GL_MAX_GEOMETRY_UNIFORM_BLOCKS',
+'GL_MAX_FRAGMENT_UNIFORM_BLOCKS', 'GL_MAX_COMBINED_UNIFORM_BLOCKS',
+'GL_MAX_UNIFORM_BUFFER_BINDINGS', 'GL_MAX_UNIFORM_BLOCK_SIZE',
+'GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS',
+'GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS',
+'GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS',
+'GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT',
+'GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH', 'GL_ACTIVE_UNIFORM_BLOCKS',
+'GL_UNIFORM_TYPE', 'GL_UNIFORM_SIZE', 'GL_UNIFORM_NAME_LENGTH',
+'GL_UNIFORM_BLOCK_INDEX', 'GL_UNIFORM_OFFSET', 'GL_UNIFORM_ARRAY_STRIDE',
+'GL_UNIFORM_MATRIX_STRIDE', 'GL_UNIFORM_IS_ROW_MAJOR',
+'GL_UNIFORM_BLOCK_BINDING', 'GL_UNIFORM_BLOCK_DATA_SIZE',
+'GL_UNIFORM_BLOCK_NAME_LENGTH', 'GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS',
+'GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES',
+'GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER',
+'GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER',
+'GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER', 'GL_INVALID_INDEX',
+'GL_COPY_READ_BUFFER_BINDING', 'GL_COPY_READ_BUFFER',
+'GL_COPY_WRITE_BUFFER_BINDING', 'GL_COPY_WRITE_BUFFER', 'GL_DEPTH_CLAMP',
+'GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION', 'GL_FIRST_VERTEX_CONVENTION',
+'GL_LAST_VERTEX_CONVENTION', 'GL_PROVOKING_VERTEX',
+'GL_TEXTURE_CUBE_MAP_SEAMLESS', 'GL_MAX_SERVER_WAIT_TIMEOUT',
+'GL_OBJECT_TYPE', 'GL_SYNC_CONDITION', 'GL_SYNC_STATUS', 'GL_SYNC_FLAGS',
+'GL_SYNC_FENCE', 'GL_SYNC_GPU_COMMANDS_COMPLETE', 'GL_UNSIGNALED',
+'GL_SIGNALED', 'GL_ALREADY_SIGNALED', 'GL_TIMEOUT_EXPIRED',
+'GL_CONDITION_SATISFIED', 'GL_WAIT_FAILED', 'GL_SYNC_FLUSH_COMMANDS_BIT',
+'GL_TIMEOUT_IGNORED', 'GL_SAMPLE_POSITION', 'GL_SAMPLE_MASK',
+'GL_SAMPLE_MASK_VALUE', 'GL_MAX_SAMPLE_MASK_WORDS',
+'GL_TEXTURE_2D_MULTISAMPLE', 'GL_PROXY_TEXTURE_2D_MULTISAMPLE',
+'GL_TEXTURE_2D_MULTISAMPLE_ARRAY', 'GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY',
+'GL_TEXTURE_BINDING_2D_MULTISAMPLE',
+'GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY', 'GL_TEXTURE_SAMPLES',
+'GL_TEXTURE_FIXED_SAMPLE_LOCATIONS', 'GL_SAMPLER_2D_MULTISAMPLE',
+'GL_INT_SAMPLER_2D_MULTISAMPLE', 'GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE',
+'GL_SAMPLER_2D_MULTISAMPLE_ARRAY', 'GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY',
+'GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY',
+'GL_MAX_COLOR_TEXTURE_SAMPLES', 'GL_MAX_DEPTH_TEXTURE_SAMPLES',
+'GL_MAX_INTEGER_SAMPLES', 'GL_SAMPLE_SHADING_ARB',
+'GL_MIN_SAMPLE_SHADING_VALUE_ARB', 'GL_TEXTURE_CUBE_MAP_ARRAY_ARB',
+'GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB',
+'GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB', 'GL_SAMPLER_CUBE_MAP_ARRAY_ARB',
+'GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB', 'GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB',
+'GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB',
+'GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB',
+'GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB', 'GL_SHADER_INCLUDE_ARB',
+'GL_NAMED_STRING_LENGTH_ARB', 'GL_NAMED_STRING_TYPE_ARB',
+'GL_COMPRESSED_RGBA_BPTC_UNORM_ARB',
+'GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB',
+'GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB',
+'GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB', 'GL_SRC1_COLOR',
+'GL_ONE_MINUS_SRC1_COLOR', 'GL_ONE_MINUS_SRC1_ALPHA',
+'GL_MAX_DUAL_SOURCE_DRAW_BUFFERS', 'GL_ANY_SAMPLES_PASSED',
+'GL_SAMPLER_BINDING', 'GL_RGB10_A2UI', 'GL_TEXTURE_SWIZZLE_R',
+'GL_TEXTURE_SWIZZLE_G', 'GL_TEXTURE_SWIZZLE_B', 'GL_TEXTURE_SWIZZLE_A',
+'GL_TEXTURE_SWIZZLE_RGBA', 'GL_TIME_ELAPSED', 'GL_TIMESTAMP',
+'GL_INT_2_10_10_10_REV', 'GL_DRAW_INDIRECT_BUFFER',
+'GL_DRAW_INDIRECT_BUFFER_BINDING', 'GL_GEOMETRY_SHADER_INVOCATIONS',
+'GL_MAX_GEOMETRY_SHADER_INVOCATIONS', 'GL_MIN_FRAGMENT_INTERPOLATION_OFFSET',
+'GL_MAX_FRAGMENT_INTERPOLATION_OFFSET',
+'GL_FRAGMENT_INTERPOLATION_OFFSET_BITS', 'GL_DOUBLE_VEC2', 'GL_DOUBLE_VEC3',
+'GL_DOUBLE_VEC4', 'GL_DOUBLE_MAT2', 'GL_DOUBLE_MAT3', 'GL_DOUBLE_MAT4',
+'GL_DOUBLE_MAT2x3', 'GL_DOUBLE_MAT2x4', 'GL_DOUBLE_MAT3x2',
+'GL_DOUBLE_MAT3x4', 'GL_DOUBLE_MAT4x2', 'GL_DOUBLE_MAT4x3',
+'GL_ACTIVE_SUBROUTINES', 'GL_ACTIVE_SUBROUTINE_UNIFORMS',
+'GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS', 'GL_ACTIVE_SUBROUTINE_MAX_LENGTH',
+'GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH', 'GL_MAX_SUBROUTINES',
+'GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS', 'GL_NUM_COMPATIBLE_SUBROUTINES',
+'GL_COMPATIBLE_SUBROUTINES', 'GL_PATCHES', 'GL_PATCH_VERTICES',
+'GL_PATCH_DEFAULT_INNER_LEVEL', 'GL_PATCH_DEFAULT_OUTER_LEVEL',
+'GL_TESS_CONTROL_OUTPUT_VERTICES', 'GL_TESS_GEN_MODE', 'GL_TESS_GEN_SPACING',
+'GL_TESS_GEN_VERTEX_ORDER', 'GL_TESS_GEN_POINT_MODE', 'GL_ISOLINES',
+'GL_FRACTIONAL_ODD', 'GL_FRACTIONAL_EVEN', 'GL_MAX_PATCH_VERTICES',
+'GL_MAX_TESS_GEN_LEVEL', 'GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS',
+'GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS',
+'GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS',
+'GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS',
+'GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS', 'GL_MAX_TESS_PATCH_COMPONENTS',
+'GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS',
+'GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS',
+'GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS', 'GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS',
+'GL_MAX_TESS_CONTROL_INPUT_COMPONENTS',
+'GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS',
+'GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS',
+'GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS',
+'GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER',
+'GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER',
+'GL_TESS_EVALUATION_SHADER', 'GL_TESS_CONTROL_SHADER',
+'GL_TRANSFORM_FEEDBACK', 'GL_TRANSFORM_FEEDBACK_PAUSED',
+'GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED', 'GL_TRANSFORM_FEEDBACK_ACTIVE',
+'GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE', 'GL_TRANSFORM_FEEDBACK_BINDING',
+'GL_MAX_TRANSFORM_FEEDBACK_BUFFERS', 'GL_MAX_VERTEX_STREAMS', 'GL_FIXED',
+'GL_IMPLEMENTATION_COLOR_READ_TYPE', 'GL_IMPLEMENTATION_COLOR_READ_FORMAT',
+'GL_LOW_FLOAT', 'GL_MEDIUM_FLOAT', 'GL_HIGH_FLOAT', 'GL_LOW_INT',
+'GL_MEDIUM_INT', 'GL_HIGH_INT', 'GL_SHADER_COMPILER',
+'GL_NUM_SHADER_BINARY_FORMATS', 'GL_MAX_VERTEX_UNIFORM_VECTORS',
+'GL_MAX_VARYING_VECTORS', 'GL_MAX_FRAGMENT_UNIFORM_VECTORS', 'GL_RGB565',
+'GL_PROGRAM_BINARY_RETRIEVABLE_HINT', 'GL_PROGRAM_BINARY_LENGTH',
+'GL_NUM_PROGRAM_BINARY_FORMATS', 'GL_PROGRAM_BINARY_FORMATS',
+'GL_VERTEX_SHADER_BIT', 'GL_FRAGMENT_SHADER_BIT', 'GL_GEOMETRY_SHADER_BIT',
+'GL_TESS_CONTROL_SHADER_BIT', 'GL_TESS_EVALUATION_SHADER_BIT',
+'GL_ALL_SHADER_BITS', 'GL_PROGRAM_SEPARABLE', 'GL_ACTIVE_PROGRAM',
+'GL_PROGRAM_PIPELINE_BINDING', 'GL_MAX_VIEWPORTS',
+'GL_VIEWPORT_SUBPIXEL_BITS', 'GL_VIEWPORT_BOUNDS_RANGE',
+'GL_LAYER_PROVOKING_VERTEX', 'GL_VIEWPORT_INDEX_PROVOKING_VERTEX',
+'GL_UNDEFINED_VERTEX', 'GL_SYNC_CL_EVENT_ARB',
+'GL_SYNC_CL_EVENT_COMPLETE_ARB', 'GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB',
+'GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB', 'GL_DEBUG_CALLBACK_FUNCTION_ARB',
+'GL_DEBUG_CALLBACK_USER_PARAM_ARB', 'GL_DEBUG_SOURCE_API_ARB',
+'GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB', 'GL_DEBUG_SOURCE_SHADER_COMPILER_ARB',
+'GL_DEBUG_SOURCE_THIRD_PARTY_ARB', 'GL_DEBUG_SOURCE_APPLICATION_ARB',
+'GL_DEBUG_SOURCE_OTHER_ARB', 'GL_DEBUG_TYPE_ERROR_ARB',
+'GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB',
+'GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB', 'GL_DEBUG_TYPE_PORTABILITY_ARB',
+'GL_DEBUG_TYPE_PERFORMANCE_ARB', 'GL_DEBUG_TYPE_OTHER_ARB',
+'GL_MAX_DEBUG_MESSAGE_LENGTH_ARB', 'GL_MAX_DEBUG_LOGGED_MESSAGES_ARB',
+'GL_DEBUG_LOGGED_MESSAGES_ARB', 'GL_DEBUG_SEVERITY_HIGH_ARB',
+'GL_DEBUG_SEVERITY_MEDIUM_ARB', 'GL_DEBUG_SEVERITY_LOW_ARB',
+'GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB', 'GL_LOSE_CONTEXT_ON_RESET_ARB',
+'GL_GUILTY_CONTEXT_RESET_ARB', 'GL_INNOCENT_CONTEXT_RESET_ARB',
+'GL_UNKNOWN_CONTEXT_RESET_ARB', 'GL_RESET_NOTIFICATION_STRATEGY_ARB',
+'GL_NO_RESET_NOTIFICATION_ARB', 'GL_UNPACK_COMPRESSED_BLOCK_WIDTH',
+'GL_UNPACK_COMPRESSED_BLOCK_HEIGHT', 'GL_UNPACK_COMPRESSED_BLOCK_DEPTH',
+'GL_UNPACK_COMPRESSED_BLOCK_SIZE', 'GL_PACK_COMPRESSED_BLOCK_WIDTH',
+'GL_PACK_COMPRESSED_BLOCK_HEIGHT', 'GL_PACK_COMPRESSED_BLOCK_DEPTH',
+'GL_PACK_COMPRESSED_BLOCK_SIZE', 'GL_NUM_SAMPLE_COUNTS',
+'GL_MIN_MAP_BUFFER_ALIGNMENT', 'GL_ATOMIC_COUNTER_BUFFER',
+'GL_ATOMIC_COUNTER_BUFFER_BINDING', 'GL_ATOMIC_COUNTER_BUFFER_START',
+'GL_ATOMIC_COUNTER_BUFFER_SIZE', 'GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE',
+'GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS',
+'GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES',
+'GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER',
+'GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER',
+'GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER',
+'GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER',
+'GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER',
+'GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS',
+'GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS',
+'GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS',
+'GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS',
+'GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS',
+'GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS', 'GL_MAX_VERTEX_ATOMIC_COUNTERS',
+'GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS',
+'GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS', 'GL_MAX_GEOMETRY_ATOMIC_COUNTERS',
+'GL_MAX_FRAGMENT_ATOMIC_COUNTERS', 'GL_MAX_COMBINED_ATOMIC_COUNTERS',
+'GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE', 'GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS',
+'GL_ACTIVE_ATOMIC_COUNTER_BUFFERS', 'GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX',
+'GL_UNSIGNED_INT_ATOMIC_COUNTER', 'GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT',
+'GL_ELEMENT_ARRAY_BARRIER_BIT', 'GL_UNIFORM_BARRIER_BIT',
+'GL_TEXTURE_FETCH_BARRIER_BIT', 'GL_SHADER_IMAGE_ACCESS_BARRIER_BIT',
+'GL_COMMAND_BARRIER_BIT', 'GL_PIXEL_BUFFER_BARRIER_BIT',
+'GL_TEXTURE_UPDATE_BARRIER_BIT', 'GL_BUFFER_UPDATE_BARRIER_BIT',
+'GL_FRAMEBUFFER_BARRIER_BIT', 'GL_TRANSFORM_FEEDBACK_BARRIER_BIT',
+'GL_ATOMIC_COUNTER_BARRIER_BIT', 'GL_ALL_BARRIER_BITS', 'GL_MAX_IMAGE_UNITS',
+'GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS', 'GL_IMAGE_BINDING_NAME',
+'GL_IMAGE_BINDING_LEVEL', 'GL_IMAGE_BINDING_LAYERED',
+'GL_IMAGE_BINDING_LAYER', 'GL_IMAGE_BINDING_ACCESS', 'GL_IMAGE_1D',
+'GL_IMAGE_2D', 'GL_IMAGE_3D', 'GL_IMAGE_2D_RECT', 'GL_IMAGE_CUBE',
+'GL_IMAGE_BUFFER', 'GL_IMAGE_1D_ARRAY', 'GL_IMAGE_2D_ARRAY',
+'GL_IMAGE_CUBE_MAP_ARRAY', 'GL_IMAGE_2D_MULTISAMPLE',
+'GL_IMAGE_2D_MULTISAMPLE_ARRAY', 'GL_INT_IMAGE_1D', 'GL_INT_IMAGE_2D',
+'GL_INT_IMAGE_3D', 'GL_INT_IMAGE_2D_RECT', 'GL_INT_IMAGE_CUBE',
+'GL_INT_IMAGE_BUFFER', 'GL_INT_IMAGE_1D_ARRAY', 'GL_INT_IMAGE_2D_ARRAY',
+'GL_INT_IMAGE_CUBE_MAP_ARRAY', 'GL_INT_IMAGE_2D_MULTISAMPLE',
+'GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY', 'GL_UNSIGNED_INT_IMAGE_1D',
+'GL_UNSIGNED_INT_IMAGE_2D', 'GL_UNSIGNED_INT_IMAGE_3D',
+'GL_UNSIGNED_INT_IMAGE_2D_RECT', 'GL_UNSIGNED_INT_IMAGE_CUBE',
+'GL_UNSIGNED_INT_IMAGE_BUFFER', 'GL_UNSIGNED_INT_IMAGE_1D_ARRAY',
+'GL_UNSIGNED_INT_IMAGE_2D_ARRAY', 'GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY',
+'GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE',
+'GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY', 'GL_MAX_IMAGE_SAMPLES',
+'GL_IMAGE_BINDING_FORMAT', 'GL_IMAGE_FORMAT_COMPATIBILITY_TYPE',
+'GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE',
+'GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS', 'GL_MAX_VERTEX_IMAGE_UNIFORMS',
+'GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS', 'GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS',
+'GL_MAX_GEOMETRY_IMAGE_UNIFORMS', 'GL_MAX_FRAGMENT_IMAGE_UNIFORMS',
+'GL_MAX_COMBINED_IMAGE_UNIFORMS', 'GL_TEXTURE_IMMUTABLE_FORMAT',
+'GL_ABGR_EXT', 'GL_CONSTANT_COLOR_EXT', 'GL_ONE_MINUS_CONSTANT_COLOR_EXT',
+'GL_CONSTANT_ALPHA_EXT', 'GL_ONE_MINUS_CONSTANT_ALPHA_EXT',
+'GL_BLEND_COLOR_EXT', 'GL_POLYGON_OFFSET_EXT', 'GL_POLYGON_OFFSET_FACTOR_EXT',
+'GL_POLYGON_OFFSET_BIAS_EXT', 'GL_ALPHA4_EXT', 'GL_ALPHA8_EXT',
+'GL_ALPHA12_EXT', 'GL_ALPHA16_EXT', 'GL_LUMINANCE4_EXT', 'GL_LUMINANCE8_EXT',
+'GL_LUMINANCE12_EXT', 'GL_LUMINANCE16_EXT', 'GL_LUMINANCE4_ALPHA4_EXT',
+'GL_LUMINANCE6_ALPHA2_EXT', 'GL_LUMINANCE8_ALPHA8_EXT',
+'GL_LUMINANCE12_ALPHA4_EXT', 'GL_LUMINANCE12_ALPHA12_EXT',
+'GL_LUMINANCE16_ALPHA16_EXT', 'GL_INTENSITY_EXT', 'GL_INTENSITY4_EXT',
+'GL_INTENSITY8_EXT', 'GL_INTENSITY12_EXT', 'GL_INTENSITY16_EXT',
+'GL_RGB2_EXT', 'GL_RGB4_EXT', 'GL_RGB5_EXT', 'GL_RGB8_EXT', 'GL_RGB10_EXT',
+'GL_RGB12_EXT', 'GL_RGB16_EXT', 'GL_RGBA2_EXT', 'GL_RGBA4_EXT',
+'GL_RGB5_A1_EXT', 'GL_RGBA8_EXT', 'GL_RGB10_A2_EXT', 'GL_RGBA12_EXT',
+'GL_RGBA16_EXT', 'GL_TEXTURE_RED_SIZE_EXT', 'GL_TEXTURE_GREEN_SIZE_EXT',
+'GL_TEXTURE_BLUE_SIZE_EXT', 'GL_TEXTURE_ALPHA_SIZE_EXT',
+'GL_TEXTURE_LUMINANCE_SIZE_EXT', 'GL_TEXTURE_INTENSITY_SIZE_EXT',
+'GL_REPLACE_EXT', 'GL_PROXY_TEXTURE_1D_EXT', 'GL_PROXY_TEXTURE_2D_EXT',
+'GL_TEXTURE_TOO_LARGE_EXT', 'GL_PACK_SKIP_IMAGES_EXT',
+'GL_PACK_IMAGE_HEIGHT_EXT', 'GL_UNPACK_SKIP_IMAGES_EXT',
+'GL_UNPACK_IMAGE_HEIGHT_EXT', 'GL_TEXTURE_3D_EXT', 'GL_PROXY_TEXTURE_3D_EXT',
+'GL_TEXTURE_DEPTH_EXT', 'GL_TEXTURE_WRAP_R_EXT', 'GL_MAX_3D_TEXTURE_SIZE_EXT',
+'GL_FILTER4_SGIS', 'GL_TEXTURE_FILTER4_SIZE_SGIS', 'GL_HISTOGRAM_EXT',
+'GL_PROXY_HISTOGRAM_EXT', 'GL_HISTOGRAM_WIDTH_EXT', 'GL_HISTOGRAM_FORMAT_EXT',
+'GL_HISTOGRAM_RED_SIZE_EXT', 'GL_HISTOGRAM_GREEN_SIZE_EXT',
+'GL_HISTOGRAM_BLUE_SIZE_EXT', 'GL_HISTOGRAM_ALPHA_SIZE_EXT',
+'GL_HISTOGRAM_LUMINANCE_SIZE_EXT', 'GL_HISTOGRAM_SINK_EXT', 'GL_MINMAX_EXT',
+'GL_MINMAX_FORMAT_EXT', 'GL_MINMAX_SINK_EXT', 'GL_TABLE_TOO_LARGE_EXT',
+'GL_CONVOLUTION_1D_EXT', 'GL_CONVOLUTION_2D_EXT', 'GL_SEPARABLE_2D_EXT',
+'GL_CONVOLUTION_BORDER_MODE_EXT', 'GL_CONVOLUTION_FILTER_SCALE_EXT',
+'GL_CONVOLUTION_FILTER_BIAS_EXT', 'GL_REDUCE_EXT',
+'GL_CONVOLUTION_FORMAT_EXT', 'GL_CONVOLUTION_WIDTH_EXT',
+'GL_CONVOLUTION_HEIGHT_EXT', 'GL_MAX_CONVOLUTION_WIDTH_EXT',
+'GL_MAX_CONVOLUTION_HEIGHT_EXT', 'GL_POST_CONVOLUTION_RED_SCALE_EXT',
+'GL_POST_CONVOLUTION_GREEN_SCALE_EXT', 'GL_POST_CONVOLUTION_BLUE_SCALE_EXT',
+'GL_POST_CONVOLUTION_ALPHA_SCALE_EXT', 'GL_POST_CONVOLUTION_RED_BIAS_EXT',
+'GL_POST_CONVOLUTION_GREEN_BIAS_EXT', 'GL_POST_CONVOLUTION_BLUE_BIAS_EXT',
+'GL_POST_CONVOLUTION_ALPHA_BIAS_EXT', 'GL_COLOR_MATRIX_SGI',
+'GL_COLOR_MATRIX_STACK_DEPTH_SGI', 'GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI',
+'GL_POST_COLOR_MATRIX_RED_SCALE_SGI', 'GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI',
+'GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI', 'GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI',
+'GL_POST_COLOR_MATRIX_RED_BIAS_SGI', 'GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI',
+'GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI', 'GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI',
+'GL_COLOR_TABLE_SGI', 'GL_POST_CONVOLUTION_COLOR_TABLE_SGI',
+'GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI', 'GL_PROXY_COLOR_TABLE_SGI',
+'GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI',
+'GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI', 'GL_COLOR_TABLE_SCALE_SGI',
+'GL_COLOR_TABLE_BIAS_SGI', 'GL_COLOR_TABLE_FORMAT_SGI',
+'GL_COLOR_TABLE_WIDTH_SGI', 'GL_COLOR_TABLE_RED_SIZE_SGI',
+'GL_COLOR_TABLE_GREEN_SIZE_SGI', 'GL_COLOR_TABLE_BLUE_SIZE_SGI',
+'GL_COLOR_TABLE_ALPHA_SIZE_SGI', 'GL_COLOR_TABLE_LUMINANCE_SIZE_SGI',
+'GL_COLOR_TABLE_INTENSITY_SIZE_SGI', 'GL_PIXEL_TEXTURE_SGIS',
+'GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS', 'GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS',
+'GL_PIXEL_GROUP_COLOR_SGIS', 'GL_PIXEL_TEX_GEN_SGIX',
+'GL_PIXEL_TEX_GEN_MODE_SGIX', 'GL_PACK_SKIP_VOLUMES_SGIS',
+'GL_PACK_IMAGE_DEPTH_SGIS', 'GL_UNPACK_SKIP_VOLUMES_SGIS',
+'GL_UNPACK_IMAGE_DEPTH_SGIS', 'GL_TEXTURE_4D_SGIS',
+'GL_PROXY_TEXTURE_4D_SGIS', 'GL_TEXTURE_4DSIZE_SGIS',
+'GL_TEXTURE_WRAP_Q_SGIS', 'GL_MAX_4D_TEXTURE_SIZE_SGIS',
+'GL_TEXTURE_4D_BINDING_SGIS', 'GL_TEXTURE_COLOR_TABLE_SGI',
+'GL_PROXY_TEXTURE_COLOR_TABLE_SGI', 'GL_CMYK_EXT', 'GL_CMYKA_EXT',
+'GL_PACK_CMYK_HINT_EXT', 'GL_UNPACK_CMYK_HINT_EXT', 'GL_TEXTURE_PRIORITY_EXT',
+'GL_TEXTURE_RESIDENT_EXT', 'GL_TEXTURE_1D_BINDING_EXT',
+'GL_TEXTURE_2D_BINDING_EXT', 'GL_TEXTURE_3D_BINDING_EXT',
+'GL_DETAIL_TEXTURE_2D_SGIS', 'GL_DETAIL_TEXTURE_2D_BINDING_SGIS',
+'GL_LINEAR_DETAIL_SGIS', 'GL_LINEAR_DETAIL_ALPHA_SGIS',
+'GL_LINEAR_DETAIL_COLOR_SGIS', 'GL_DETAIL_TEXTURE_LEVEL_SGIS',
+'GL_DETAIL_TEXTURE_MODE_SGIS', 'GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS',
+'GL_LINEAR_SHARPEN_SGIS', 'GL_LINEAR_SHARPEN_ALPHA_SGIS',
+'GL_LINEAR_SHARPEN_COLOR_SGIS', 'GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS',
+'GL_UNSIGNED_BYTE_3_3_2_EXT', 'GL_UNSIGNED_SHORT_4_4_4_4_EXT',
+'GL_UNSIGNED_SHORT_5_5_5_1_EXT', 'GL_UNSIGNED_INT_8_8_8_8_EXT',
+'GL_UNSIGNED_INT_10_10_10_2_EXT', 'GL_TEXTURE_MIN_LOD_SGIS',
+'GL_TEXTURE_MAX_LOD_SGIS', 'GL_TEXTURE_BASE_LEVEL_SGIS',
+'GL_TEXTURE_MAX_LEVEL_SGIS', 'GL_MULTISAMPLE_SGIS',
+'GL_SAMPLE_ALPHA_TO_MASK_SGIS', 'GL_SAMPLE_ALPHA_TO_ONE_SGIS',
+'GL_SAMPLE_MASK_SGIS', 'GL_1PASS_SGIS', 'GL_2PASS_0_SGIS', 'GL_2PASS_1_SGIS',
+'GL_4PASS_0_SGIS', 'GL_4PASS_1_SGIS', 'GL_4PASS_2_SGIS', 'GL_4PASS_3_SGIS',
+'GL_SAMPLE_BUFFERS_SGIS', 'GL_SAMPLES_SGIS', 'GL_SAMPLE_MASK_VALUE_SGIS',
+'GL_SAMPLE_MASK_INVERT_SGIS', 'GL_SAMPLE_PATTERN_SGIS',
+'GL_RESCALE_NORMAL_EXT', 'GL_VERTEX_ARRAY_EXT', 'GL_NORMAL_ARRAY_EXT',
+'GL_COLOR_ARRAY_EXT', 'GL_INDEX_ARRAY_EXT', 'GL_TEXTURE_COORD_ARRAY_EXT',
+'GL_EDGE_FLAG_ARRAY_EXT', 'GL_VERTEX_ARRAY_SIZE_EXT',
+'GL_VERTEX_ARRAY_TYPE_EXT', 'GL_VERTEX_ARRAY_STRIDE_EXT',
+'GL_VERTEX_ARRAY_COUNT_EXT', 'GL_NORMAL_ARRAY_TYPE_EXT',
+'GL_NORMAL_ARRAY_STRIDE_EXT', 'GL_NORMAL_ARRAY_COUNT_EXT',
+'GL_COLOR_ARRAY_SIZE_EXT', 'GL_COLOR_ARRAY_TYPE_EXT',
+'GL_COLOR_ARRAY_STRIDE_EXT', 'GL_COLOR_ARRAY_COUNT_EXT',
+'GL_INDEX_ARRAY_TYPE_EXT', 'GL_INDEX_ARRAY_STRIDE_EXT',
+'GL_INDEX_ARRAY_COUNT_EXT', 'GL_TEXTURE_COORD_ARRAY_SIZE_EXT',
+'GL_TEXTURE_COORD_ARRAY_TYPE_EXT', 'GL_TEXTURE_COORD_ARRAY_STRIDE_EXT',
+'GL_TEXTURE_COORD_ARRAY_COUNT_EXT', 'GL_EDGE_FLAG_ARRAY_STRIDE_EXT',
+'GL_EDGE_FLAG_ARRAY_COUNT_EXT', 'GL_VERTEX_ARRAY_POINTER_EXT',
+'GL_NORMAL_ARRAY_POINTER_EXT', 'GL_COLOR_ARRAY_POINTER_EXT',
+'GL_INDEX_ARRAY_POINTER_EXT', 'GL_TEXTURE_COORD_ARRAY_POINTER_EXT',
+'GL_EDGE_FLAG_ARRAY_POINTER_EXT', 'GL_GENERATE_MIPMAP_SGIS',
+'GL_GENERATE_MIPMAP_HINT_SGIS', 'GL_LINEAR_CLIPMAP_LINEAR_SGIX',
+'GL_TEXTURE_CLIPMAP_CENTER_SGIX', 'GL_TEXTURE_CLIPMAP_FRAME_SGIX',
+'GL_TEXTURE_CLIPMAP_OFFSET_SGIX', 'GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX',
+'GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX', 'GL_TEXTURE_CLIPMAP_DEPTH_SGIX',
+'GL_MAX_CLIPMAP_DEPTH_SGIX', 'GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX',
+'GL_NEAREST_CLIPMAP_NEAREST_SGIX', 'GL_NEAREST_CLIPMAP_LINEAR_SGIX',
+'GL_LINEAR_CLIPMAP_NEAREST_SGIX', 'GL_TEXTURE_COMPARE_SGIX',
+'GL_TEXTURE_COMPARE_OPERATOR_SGIX', 'GL_TEXTURE_LEQUAL_R_SGIX',
+'GL_TEXTURE_GEQUAL_R_SGIX', 'GL_CLAMP_TO_EDGE_SGIS',
+'GL_CLAMP_TO_BORDER_SGIS', 'GL_FUNC_ADD_EXT', 'GL_MIN_EXT', 'GL_MAX_EXT',
+'GL_BLEND_EQUATION_EXT', 'GL_FUNC_SUBTRACT_EXT',
+'GL_FUNC_REVERSE_SUBTRACT_EXT', 'GL_INTERLACE_SGIX',
+'GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX', 'GL_PIXEL_TILE_CACHE_INCREMENT_SGIX',
+'GL_PIXEL_TILE_WIDTH_SGIX', 'GL_PIXEL_TILE_HEIGHT_SGIX',
+'GL_PIXEL_TILE_GRID_WIDTH_SGIX', 'GL_PIXEL_TILE_GRID_HEIGHT_SGIX',
+'GL_PIXEL_TILE_GRID_DEPTH_SGIX', 'GL_PIXEL_TILE_CACHE_SIZE_SGIX',
+'GL_DUAL_ALPHA4_SGIS', 'GL_DUAL_ALPHA8_SGIS', 'GL_DUAL_ALPHA12_SGIS',
+'GL_DUAL_ALPHA16_SGIS', 'GL_DUAL_LUMINANCE4_SGIS', 'GL_DUAL_LUMINANCE8_SGIS',
+'GL_DUAL_LUMINANCE12_SGIS', 'GL_DUAL_LUMINANCE16_SGIS',
+'GL_DUAL_INTENSITY4_SGIS', 'GL_DUAL_INTENSITY8_SGIS',
+'GL_DUAL_INTENSITY12_SGIS', 'GL_DUAL_INTENSITY16_SGIS',
+'GL_DUAL_LUMINANCE_ALPHA4_SGIS', 'GL_DUAL_LUMINANCE_ALPHA8_SGIS',
+'GL_QUAD_ALPHA4_SGIS', 'GL_QUAD_ALPHA8_SGIS', 'GL_QUAD_LUMINANCE4_SGIS',
+'GL_QUAD_LUMINANCE8_SGIS', 'GL_QUAD_INTENSITY4_SGIS',
+'GL_QUAD_INTENSITY8_SGIS', 'GL_DUAL_TEXTURE_SELECT_SGIS',
+'GL_QUAD_TEXTURE_SELECT_SGIS', 'GL_SPRITE_SGIX', 'GL_SPRITE_MODE_SGIX',
+'GL_SPRITE_AXIS_SGIX', 'GL_SPRITE_TRANSLATION_SGIX', 'GL_SPRITE_AXIAL_SGIX',
+'GL_SPRITE_OBJECT_ALIGNED_SGIX', 'GL_SPRITE_EYE_ALIGNED_SGIX',
+'GL_TEXTURE_MULTI_BUFFER_HINT_SGIX', 'GL_POINT_SIZE_MIN_EXT',
+'GL_POINT_SIZE_MAX_EXT', 'GL_POINT_FADE_THRESHOLD_SIZE_EXT',
+'GL_DISTANCE_ATTENUATION_EXT', 'GL_POINT_SIZE_MIN_SGIS',
+'GL_POINT_SIZE_MAX_SGIS', 'GL_POINT_FADE_THRESHOLD_SIZE_SGIS',
+'GL_DISTANCE_ATTENUATION_SGIS', 'GL_INSTRUMENT_BUFFER_POINTER_SGIX',
+'GL_INSTRUMENT_MEASUREMENTS_SGIX', 'GL_POST_TEXTURE_FILTER_BIAS_SGIX',
+'GL_POST_TEXTURE_FILTER_SCALE_SGIX', 'GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX',
+'GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX', 'GL_FRAMEZOOM_SGIX',
+'GL_FRAMEZOOM_FACTOR_SGIX', 'GL_MAX_FRAMEZOOM_FACTOR_SGIX',
+'GL_TEXTURE_DEFORMATION_BIT_SGIX', 'GL_GEOMETRY_DEFORMATION_BIT_SGIX',
+'GL_GEOMETRY_DEFORMATION_SGIX', 'GL_TEXTURE_DEFORMATION_SGIX',
+'GL_DEFORMATIONS_MASK_SGIX', 'GL_MAX_DEFORMATION_ORDER_SGIX',
+'GL_REFERENCE_PLANE_SGIX', 'GL_REFERENCE_PLANE_EQUATION_SGIX',
+'GL_DEPTH_COMPONENT16_SGIX', 'GL_DEPTH_COMPONENT24_SGIX',
+'GL_DEPTH_COMPONENT32_SGIX', 'GL_FOG_FUNC_SGIS', 'GL_FOG_FUNC_POINTS_SGIS',
+'GL_MAX_FOG_FUNC_POINTS_SGIS', 'GL_FOG_OFFSET_SGIX',
+'GL_FOG_OFFSET_VALUE_SGIX', 'GL_IMAGE_SCALE_X_HP', 'GL_IMAGE_SCALE_Y_HP',
+'GL_IMAGE_TRANSLATE_X_HP', 'GL_IMAGE_TRANSLATE_Y_HP',
+'GL_IMAGE_ROTATE_ANGLE_HP', 'GL_IMAGE_ROTATE_ORIGIN_X_HP',
+'GL_IMAGE_ROTATE_ORIGIN_Y_HP', 'GL_IMAGE_MAG_FILTER_HP',
+'GL_IMAGE_MIN_FILTER_HP', 'GL_IMAGE_CUBIC_WEIGHT_HP', 'GL_CUBIC_HP',
+'GL_AVERAGE_HP', 'GL_IMAGE_TRANSFORM_2D_HP',
+'GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP',
+'GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP', 'GL_IGNORE_BORDER_HP',
+'GL_CONSTANT_BORDER_HP', 'GL_REPLICATE_BORDER_HP',
+'GL_CONVOLUTION_BORDER_COLOR_HP', 'GL_TEXTURE_ENV_BIAS_SGIX',
+'GL_VERTEX_DATA_HINT_PGI', 'GL_VERTEX_CONSISTENT_HINT_PGI',
+'GL_MATERIAL_SIDE_HINT_PGI', 'GL_MAX_VERTEX_HINT_PGI', 'GL_COLOR3_BIT_PGI',
+'GL_COLOR4_BIT_PGI', 'GL_EDGEFLAG_BIT_PGI', 'GL_INDEX_BIT_PGI',
+'GL_MAT_AMBIENT_BIT_PGI', 'GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI',
+'GL_MAT_DIFFUSE_BIT_PGI', 'GL_MAT_EMISSION_BIT_PGI',
+'GL_MAT_COLOR_INDEXES_BIT_PGI', 'GL_MAT_SHININESS_BIT_PGI',
+'GL_MAT_SPECULAR_BIT_PGI', 'GL_NORMAL_BIT_PGI', 'GL_TEXCOORD1_BIT_PGI',
+'GL_TEXCOORD2_BIT_PGI', 'GL_TEXCOORD3_BIT_PGI', 'GL_TEXCOORD4_BIT_PGI',
+'GL_VERTEX23_BIT_PGI', 'GL_VERTEX4_BIT_PGI',
+'GL_PREFER_DOUBLEBUFFER_HINT_PGI', 'GL_CONSERVE_MEMORY_HINT_PGI',
+'GL_RECLAIM_MEMORY_HINT_PGI', 'GL_NATIVE_GRAPHICS_HANDLE_PGI',
+'GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI', 'GL_NATIVE_GRAPHICS_END_HINT_PGI',
+'GL_ALWAYS_FAST_HINT_PGI', 'GL_ALWAYS_SOFT_HINT_PGI',
+'GL_ALLOW_DRAW_OBJ_HINT_PGI', 'GL_ALLOW_DRAW_WIN_HINT_PGI',
+'GL_ALLOW_DRAW_FRG_HINT_PGI', 'GL_ALLOW_DRAW_MEM_HINT_PGI',
+'GL_STRICT_DEPTHFUNC_HINT_PGI', 'GL_STRICT_LIGHTING_HINT_PGI',
+'GL_STRICT_SCISSOR_HINT_PGI', 'GL_FULL_STIPPLE_HINT_PGI',
+'GL_CLIP_NEAR_HINT_PGI', 'GL_CLIP_FAR_HINT_PGI', 'GL_WIDE_LINE_HINT_PGI',
+'GL_BACK_NORMALS_HINT_PGI', 'GL_COLOR_INDEX1_EXT', 'GL_COLOR_INDEX2_EXT',
+'GL_COLOR_INDEX4_EXT', 'GL_COLOR_INDEX8_EXT', 'GL_COLOR_INDEX12_EXT',
+'GL_COLOR_INDEX16_EXT', 'GL_TEXTURE_INDEX_SIZE_EXT',
+'GL_CLIP_VOLUME_CLIPPING_HINT_EXT', 'GL_LIST_PRIORITY_SGIX',
+'GL_IR_INSTRUMENT1_SGIX', 'GL_CALLIGRAPHIC_FRAGMENT_SGIX',
+'GL_TEXTURE_LOD_BIAS_S_SGIX', 'GL_TEXTURE_LOD_BIAS_T_SGIX',
+'GL_TEXTURE_LOD_BIAS_R_SGIX', 'GL_SHADOW_AMBIENT_SGIX',
+'GL_INDEX_MATERIAL_EXT', 'GL_INDEX_MATERIAL_PARAMETER_EXT',
+'GL_INDEX_MATERIAL_FACE_EXT', 'GL_INDEX_TEST_EXT', 'GL_INDEX_TEST_FUNC_EXT',
+'GL_INDEX_TEST_REF_EXT', 'GL_IUI_V2F_EXT', 'GL_IUI_V3F_EXT',
+'GL_IUI_N3F_V2F_EXT', 'GL_IUI_N3F_V3F_EXT', 'GL_T2F_IUI_V2F_EXT',
+'GL_T2F_IUI_V3F_EXT', 'GL_T2F_IUI_N3F_V2F_EXT', 'GL_T2F_IUI_N3F_V3F_EXT',
+'GL_ARRAY_ELEMENT_LOCK_FIRST_EXT', 'GL_ARRAY_ELEMENT_LOCK_COUNT_EXT',
+'GL_CULL_VERTEX_EXT', 'GL_CULL_VERTEX_EYE_POSITION_EXT',
+'GL_CULL_VERTEX_OBJECT_POSITION_EXT', 'GL_YCRCB_422_SGIX',
+'GL_YCRCB_444_SGIX', 'GL_FRAGMENT_LIGHTING_SGIX',
+'GL_FRAGMENT_COLOR_MATERIAL_SGIX', 'GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX',
+'GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX', 'GL_MAX_FRAGMENT_LIGHTS_SGIX',
+'GL_MAX_ACTIVE_LIGHTS_SGIX', 'GL_CURRENT_RASTER_NORMAL_SGIX',
+'GL_LIGHT_ENV_MODE_SGIX', 'GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX',
+'GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX',
+'GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX',
+'GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX',
+'GL_FRAGMENT_LIGHT0_SGIX', 'GL_FRAGMENT_LIGHT1_SGIX',
+'GL_FRAGMENT_LIGHT2_SGIX', 'GL_FRAGMENT_LIGHT3_SGIX',
+'GL_FRAGMENT_LIGHT4_SGIX', 'GL_FRAGMENT_LIGHT5_SGIX',
+'GL_FRAGMENT_LIGHT6_SGIX', 'GL_FRAGMENT_LIGHT7_SGIX',
+'GL_RASTER_POSITION_UNCLIPPED_IBM', 'GL_TEXTURE_LIGHTING_MODE_HP',
+'GL_TEXTURE_POST_SPECULAR_HP', 'GL_TEXTURE_PRE_SPECULAR_HP',
+'GL_MAX_ELEMENTS_VERTICES_EXT', 'GL_MAX_ELEMENTS_INDICES_EXT', 'GL_PHONG_WIN',
+'GL_PHONG_HINT_WIN', 'GL_FOG_SPECULAR_TEXTURE_WIN',
+'GL_FRAGMENT_MATERIAL_EXT', 'GL_FRAGMENT_NORMAL_EXT', 'GL_FRAGMENT_COLOR_EXT',
+'GL_ATTENUATION_EXT', 'GL_SHADOW_ATTENUATION_EXT',
+'GL_TEXTURE_APPLICATION_MODE_EXT', 'GL_TEXTURE_LIGHT_EXT',
+'GL_TEXTURE_MATERIAL_FACE_EXT', 'GL_TEXTURE_MATERIAL_PARAMETER_EXT',
+'GL_ALPHA_MIN_SGIX', 'GL_ALPHA_MAX_SGIX', 'GL_PIXEL_TEX_GEN_Q_CEILING_SGIX',
+'GL_PIXEL_TEX_GEN_Q_ROUND_SGIX', 'GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX',
+'GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX',
+'GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX', 'GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX',
+'GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX', 'GL_BGR_EXT', 'GL_BGRA_EXT',
+'GL_ASYNC_MARKER_SGIX', 'GL_ASYNC_TEX_IMAGE_SGIX',
+'GL_ASYNC_DRAW_PIXELS_SGIX', 'GL_ASYNC_READ_PIXELS_SGIX',
+'GL_MAX_ASYNC_TEX_IMAGE_SGIX', 'GL_MAX_ASYNC_DRAW_PIXELS_SGIX',
+'GL_MAX_ASYNC_READ_PIXELS_SGIX', 'GL_ASYNC_HISTOGRAM_SGIX',
+'GL_MAX_ASYNC_HISTOGRAM_SGIX', 'GL_PARALLEL_ARRAYS_INTEL',
+'GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL',
+'GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL',
+'GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL',
+'GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL', 'GL_OCCLUSION_TEST_HP',
+'GL_OCCLUSION_TEST_RESULT_HP', 'GL_PIXEL_TRANSFORM_2D_EXT',
+'GL_PIXEL_MAG_FILTER_EXT', 'GL_PIXEL_MIN_FILTER_EXT',
+'GL_PIXEL_CUBIC_WEIGHT_EXT', 'GL_CUBIC_EXT', 'GL_AVERAGE_EXT',
+'GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT',
+'GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT',
+'GL_PIXEL_TRANSFORM_2D_MATRIX_EXT', 'GL_SHARED_TEXTURE_PALETTE_EXT',
+'GL_LIGHT_MODEL_COLOR_CONTROL_EXT', 'GL_SINGLE_COLOR_EXT',
+'GL_SEPARATE_SPECULAR_COLOR_EXT', 'GL_COLOR_SUM_EXT',
+'GL_CURRENT_SECONDARY_COLOR_EXT', 'GL_SECONDARY_COLOR_ARRAY_SIZE_EXT',
+'GL_SECONDARY_COLOR_ARRAY_TYPE_EXT', 'GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT',
+'GL_SECONDARY_COLOR_ARRAY_POINTER_EXT', 'GL_SECONDARY_COLOR_ARRAY_EXT',
+'GL_PERTURB_EXT', 'GL_TEXTURE_NORMAL_EXT', 'GL_FOG_COORDINATE_SOURCE_EXT',
+'GL_FOG_COORDINATE_EXT', 'GL_FRAGMENT_DEPTH_EXT',
+'GL_CURRENT_FOG_COORDINATE_EXT', 'GL_FOG_COORDINATE_ARRAY_TYPE_EXT',
+'GL_FOG_COORDINATE_ARRAY_STRIDE_EXT', 'GL_FOG_COORDINATE_ARRAY_POINTER_EXT',
+'GL_FOG_COORDINATE_ARRAY_EXT', 'GL_SCREEN_COORDINATES_REND',
+'GL_INVERTED_SCREEN_W_REND', 'GL_TANGENT_ARRAY_EXT', 'GL_BINORMAL_ARRAY_EXT',
+'GL_CURRENT_TANGENT_EXT', 'GL_CURRENT_BINORMAL_EXT',
+'GL_TANGENT_ARRAY_TYPE_EXT', 'GL_TANGENT_ARRAY_STRIDE_EXT',
+'GL_BINORMAL_ARRAY_TYPE_EXT', 'GL_BINORMAL_ARRAY_STRIDE_EXT',
+'GL_TANGENT_ARRAY_POINTER_EXT', 'GL_BINORMAL_ARRAY_POINTER_EXT',
+'GL_MAP1_TANGENT_EXT', 'GL_MAP2_TANGENT_EXT', 'GL_MAP1_BINORMAL_EXT',
+'GL_MAP2_BINORMAL_EXT', 'GL_COMBINE_EXT', 'GL_COMBINE_RGB_EXT',
+'GL_COMBINE_ALPHA_EXT', 'GL_RGB_SCALE_EXT', 'GL_ADD_SIGNED_EXT',
+'GL_INTERPOLATE_EXT', 'GL_CONSTANT_EXT', 'GL_PRIMARY_COLOR_EXT',
+'GL_PREVIOUS_EXT', 'GL_SOURCE0_RGB_EXT', 'GL_SOURCE1_RGB_EXT',
+'GL_SOURCE2_RGB_EXT', 'GL_SOURCE0_ALPHA_EXT', 'GL_SOURCE1_ALPHA_EXT',
+'GL_SOURCE2_ALPHA_EXT', 'GL_OPERAND0_RGB_EXT', 'GL_OPERAND1_RGB_EXT',
+'GL_OPERAND2_RGB_EXT', 'GL_OPERAND0_ALPHA_EXT', 'GL_OPERAND1_ALPHA_EXT',
+'GL_OPERAND2_ALPHA_EXT', 'GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE',
+'GL_TRANSFORM_HINT_APPLE', 'GL_FOG_SCALE_SGIX', 'GL_FOG_SCALE_VALUE_SGIX',
+'GL_UNPACK_CONSTANT_DATA_SUNX', 'GL_TEXTURE_CONSTANT_DATA_SUNX',
+'GL_GLOBAL_ALPHA_SUN', 'GL_GLOBAL_ALPHA_FACTOR_SUN', 'GL_RESTART_SUN',
+'GL_REPLACE_MIDDLE_SUN', 'GL_REPLACE_OLDEST_SUN', 'GL_TRIANGLE_LIST_SUN',
+'GL_REPLACEMENT_CODE_SUN', 'GL_REPLACEMENT_CODE_ARRAY_SUN',
+'GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN', 'GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN',
+'GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN', 'GL_R1UI_V3F_SUN',
+'GL_R1UI_C4UB_V3F_SUN', 'GL_R1UI_C3F_V3F_SUN', 'GL_R1UI_N3F_V3F_SUN',
+'GL_R1UI_C4F_N3F_V3F_SUN', 'GL_R1UI_T2F_V3F_SUN', 'GL_R1UI_T2F_N3F_V3F_SUN',
+'GL_R1UI_T2F_C4F_N3F_V3F_SUN', 'GL_BLEND_DST_RGB_EXT', 'GL_BLEND_SRC_RGB_EXT',
+'GL_BLEND_DST_ALPHA_EXT', 'GL_BLEND_SRC_ALPHA_EXT', 'GL_RED_MIN_CLAMP_INGR',
+'GL_GREEN_MIN_CLAMP_INGR', 'GL_BLUE_MIN_CLAMP_INGR',
+'GL_ALPHA_MIN_CLAMP_INGR', 'GL_RED_MAX_CLAMP_INGR', 'GL_GREEN_MAX_CLAMP_INGR',
+'GL_BLUE_MAX_CLAMP_INGR', 'GL_ALPHA_MAX_CLAMP_INGR', 'GL_INTERLACE_READ_INGR',
+'GL_INCR_WRAP_EXT', 'GL_DECR_WRAP_EXT', 'GL_422_EXT', 'GL_422_REV_EXT',
+'GL_422_AVERAGE_EXT', 'GL_422_REV_AVERAGE_EXT', 'GL_NORMAL_MAP_NV',
+'GL_REFLECTION_MAP_NV', 'GL_NORMAL_MAP_EXT', 'GL_REFLECTION_MAP_EXT',
+'GL_TEXTURE_CUBE_MAP_EXT', 'GL_TEXTURE_BINDING_CUBE_MAP_EXT',
+'GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT', 'GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT',
+'GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT', 'GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT',
+'GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT', 'GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT',
+'GL_PROXY_TEXTURE_CUBE_MAP_EXT', 'GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT',
+'GL_WRAP_BORDER_SUN', 'GL_MAX_TEXTURE_LOD_BIAS_EXT',
+'GL_TEXTURE_FILTER_CONTROL_EXT', 'GL_TEXTURE_LOD_BIAS_EXT',
+'GL_TEXTURE_MAX_ANISOTROPY_EXT', 'GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT',
+'GL_MODELVIEW0_STACK_DEPTH_EXT', 'GL_MODELVIEW1_STACK_DEPTH_EXT',
+'GL_MODELVIEW0_MATRIX_EXT', 'GL_MODELVIEW1_MATRIX_EXT',
+'GL_VERTEX_WEIGHTING_EXT', 'GL_MODELVIEW0_EXT', 'GL_MODELVIEW1_EXT',
+'GL_CURRENT_VERTEX_WEIGHT_EXT', 'GL_VERTEX_WEIGHT_ARRAY_EXT',
+'GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT', 'GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT',
+'GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT', 'GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT',
+'GL_MAX_SHININESS_NV', 'GL_MAX_SPOT_EXPONENT_NV', 'GL_VERTEX_ARRAY_RANGE_NV',
+'GL_VERTEX_ARRAY_RANGE_LENGTH_NV', 'GL_VERTEX_ARRAY_RANGE_VALID_NV',
+'GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV', 'GL_VERTEX_ARRAY_RANGE_POINTER_NV',
+'GL_REGISTER_COMBINERS_NV', 'GL_VARIABLE_A_NV', 'GL_VARIABLE_B_NV',
+'GL_VARIABLE_C_NV', 'GL_VARIABLE_D_NV', 'GL_VARIABLE_E_NV',
+'GL_VARIABLE_F_NV', 'GL_VARIABLE_G_NV', 'GL_CONSTANT_COLOR0_NV',
+'GL_CONSTANT_COLOR1_NV', 'GL_PRIMARY_COLOR_NV', 'GL_SECONDARY_COLOR_NV',
+'GL_SPARE0_NV', 'GL_SPARE1_NV', 'GL_DISCARD_NV', 'GL_E_TIMES_F_NV',
+'GL_SPARE0_PLUS_SECONDARY_COLOR_NV', 'GL_UNSIGNED_IDENTITY_NV',
+'GL_UNSIGNED_INVERT_NV', 'GL_EXPAND_NORMAL_NV', 'GL_EXPAND_NEGATE_NV',
+'GL_HALF_BIAS_NORMAL_NV', 'GL_HALF_BIAS_NEGATE_NV', 'GL_SIGNED_IDENTITY_NV',
+'GL_SIGNED_NEGATE_NV', 'GL_SCALE_BY_TWO_NV', 'GL_SCALE_BY_FOUR_NV',
+'GL_SCALE_BY_ONE_HALF_NV', 'GL_BIAS_BY_NEGATIVE_ONE_HALF_NV',
+'GL_COMBINER_INPUT_NV', 'GL_COMBINER_MAPPING_NV',
+'GL_COMBINER_COMPONENT_USAGE_NV', 'GL_COMBINER_AB_DOT_PRODUCT_NV',
+'GL_COMBINER_CD_DOT_PRODUCT_NV', 'GL_COMBINER_MUX_SUM_NV',
+'GL_COMBINER_SCALE_NV', 'GL_COMBINER_BIAS_NV', 'GL_COMBINER_AB_OUTPUT_NV',
+'GL_COMBINER_CD_OUTPUT_NV', 'GL_COMBINER_SUM_OUTPUT_NV',
+'GL_MAX_GENERAL_COMBINERS_NV', 'GL_NUM_GENERAL_COMBINERS_NV',
+'GL_COLOR_SUM_CLAMP_NV', 'GL_COMBINER0_NV', 'GL_COMBINER1_NV',
+'GL_COMBINER2_NV', 'GL_COMBINER3_NV', 'GL_COMBINER4_NV', 'GL_COMBINER5_NV',
+'GL_COMBINER6_NV', 'GL_COMBINER7_NV', 'GL_FOG_DISTANCE_MODE_NV',
+'GL_EYE_RADIAL_NV', 'GL_EYE_PLANE_ABSOLUTE_NV', 'GL_EMBOSS_LIGHT_NV',
+'GL_EMBOSS_CONSTANT_NV', 'GL_EMBOSS_MAP_NV', 'GL_COMBINE4_NV',
+'GL_SOURCE3_RGB_NV', 'GL_SOURCE3_ALPHA_NV', 'GL_OPERAND3_RGB_NV',
+'GL_OPERAND3_ALPHA_NV', 'GL_COMPRESSED_RGB_S3TC_DXT1_EXT',
+'GL_COMPRESSED_RGBA_S3TC_DXT1_EXT', 'GL_COMPRESSED_RGBA_S3TC_DXT3_EXT',
+'GL_COMPRESSED_RGBA_S3TC_DXT5_EXT', 'GL_CULL_VERTEX_IBM',
+'GL_VERTEX_ARRAY_LIST_IBM', 'GL_NORMAL_ARRAY_LIST_IBM',
+'GL_COLOR_ARRAY_LIST_IBM', 'GL_INDEX_ARRAY_LIST_IBM',
+'GL_TEXTURE_COORD_ARRAY_LIST_IBM', 'GL_EDGE_FLAG_ARRAY_LIST_IBM',
+'GL_FOG_COORDINATE_ARRAY_LIST_IBM', 'GL_SECONDARY_COLOR_ARRAY_LIST_IBM',
+'GL_VERTEX_ARRAY_LIST_STRIDE_IBM', 'GL_NORMAL_ARRAY_LIST_STRIDE_IBM',
+'GL_COLOR_ARRAY_LIST_STRIDE_IBM', 'GL_INDEX_ARRAY_LIST_STRIDE_IBM',
+'GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM',
+'GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM',
+'GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM',
+'GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM', 'GL_PACK_SUBSAMPLE_RATE_SGIX',
+'GL_UNPACK_SUBSAMPLE_RATE_SGIX', 'GL_PIXEL_SUBSAMPLE_4444_SGIX',
+'GL_PIXEL_SUBSAMPLE_2424_SGIX', 'GL_PIXEL_SUBSAMPLE_4242_SGIX',
+'GL_YCRCB_SGIX', 'GL_YCRCBA_SGIX', 'GL_DEPTH_PASS_INSTRUMENT_SGIX',
+'GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX', 'GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX',
+'GL_COMPRESSED_RGB_FXT1_3DFX', 'GL_COMPRESSED_RGBA_FXT1_3DFX',
+'GL_MULTISAMPLE_3DFX', 'GL_SAMPLE_BUFFERS_3DFX', 'GL_SAMPLES_3DFX',
+'GL_MULTISAMPLE_BIT_3DFX', 'GL_MULTISAMPLE_EXT',
+'GL_SAMPLE_ALPHA_TO_MASK_EXT', 'GL_SAMPLE_ALPHA_TO_ONE_EXT',
+'GL_SAMPLE_MASK_EXT', 'GL_1PASS_EXT', 'GL_2PASS_0_EXT', 'GL_2PASS_1_EXT',
+'GL_4PASS_0_EXT', 'GL_4PASS_1_EXT', 'GL_4PASS_2_EXT', 'GL_4PASS_3_EXT',
+'GL_SAMPLE_BUFFERS_EXT', 'GL_SAMPLES_EXT', 'GL_SAMPLE_MASK_VALUE_EXT',
+'GL_SAMPLE_MASK_INVERT_EXT', 'GL_SAMPLE_PATTERN_EXT',
+'GL_MULTISAMPLE_BIT_EXT', 'GL_VERTEX_PRECLIP_SGIX',
+'GL_VERTEX_PRECLIP_HINT_SGIX', 'GL_CONVOLUTION_HINT_SGIX',
+'GL_PACK_RESAMPLE_SGIX', 'GL_UNPACK_RESAMPLE_SGIX',
+'GL_RESAMPLE_REPLICATE_SGIX', 'GL_RESAMPLE_ZERO_FILL_SGIX',
+'GL_RESAMPLE_DECIMATE_SGIX', 'GL_EYE_DISTANCE_TO_POINT_SGIS',
+'GL_OBJECT_DISTANCE_TO_POINT_SGIS', 'GL_EYE_DISTANCE_TO_LINE_SGIS',
+'GL_OBJECT_DISTANCE_TO_LINE_SGIS', 'GL_EYE_POINT_SGIS',
+'GL_OBJECT_POINT_SGIS', 'GL_EYE_LINE_SGIS', 'GL_OBJECT_LINE_SGIS',
+'GL_TEXTURE_COLOR_WRITEMASK_SGIS', 'GL_DOT3_RGB_EXT', 'GL_DOT3_RGBA_EXT',
+'GL_MIRROR_CLAMP_ATI', 'GL_MIRROR_CLAMP_TO_EDGE_ATI', 'GL_ALL_COMPLETED_NV',
+'GL_FENCE_STATUS_NV', 'GL_FENCE_CONDITION_NV', 'GL_MIRRORED_REPEAT_IBM',
+'GL_EVAL_2D_NV', 'GL_EVAL_TRIANGULAR_2D_NV', 'GL_MAP_TESSELLATION_NV',
+'GL_MAP_ATTRIB_U_ORDER_NV', 'GL_MAP_ATTRIB_V_ORDER_NV',
+'GL_EVAL_FRACTIONAL_TESSELLATION_NV', 'GL_EVAL_VERTEX_ATTRIB0_NV',
+'GL_EVAL_VERTEX_ATTRIB1_NV', 'GL_EVAL_VERTEX_ATTRIB2_NV',
+'GL_EVAL_VERTEX_ATTRIB3_NV', 'GL_EVAL_VERTEX_ATTRIB4_NV',
+'GL_EVAL_VERTEX_ATTRIB5_NV', 'GL_EVAL_VERTEX_ATTRIB6_NV',
+'GL_EVAL_VERTEX_ATTRIB7_NV', 'GL_EVAL_VERTEX_ATTRIB8_NV',
+'GL_EVAL_VERTEX_ATTRIB9_NV', 'GL_EVAL_VERTEX_ATTRIB10_NV',
+'GL_EVAL_VERTEX_ATTRIB11_NV', 'GL_EVAL_VERTEX_ATTRIB12_NV',
+'GL_EVAL_VERTEX_ATTRIB13_NV', 'GL_EVAL_VERTEX_ATTRIB14_NV',
+'GL_EVAL_VERTEX_ATTRIB15_NV', 'GL_MAX_MAP_TESSELLATION_NV',
+'GL_MAX_RATIONAL_EVAL_ORDER_NV', 'GL_DEPTH_STENCIL_NV',
+'GL_UNSIGNED_INT_24_8_NV', 'GL_PER_STAGE_CONSTANTS_NV',
+'GL_TEXTURE_RECTANGLE_NV', 'GL_TEXTURE_BINDING_RECTANGLE_NV',
+'GL_PROXY_TEXTURE_RECTANGLE_NV', 'GL_MAX_RECTANGLE_TEXTURE_SIZE_NV',
+'GL_OFFSET_TEXTURE_RECTANGLE_NV', 'GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV',
+'GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV',
+'GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV', 'GL_UNSIGNED_INT_S8_S8_8_8_NV',
+'GL_UNSIGNED_INT_8_8_S8_S8_REV_NV', 'GL_DSDT_MAG_INTENSITY_NV',
+'GL_SHADER_CONSISTENT_NV', 'GL_TEXTURE_SHADER_NV', 'GL_SHADER_OPERATION_NV',
+'GL_CULL_MODES_NV', 'GL_OFFSET_TEXTURE_MATRIX_NV',
+'GL_OFFSET_TEXTURE_SCALE_NV', 'GL_OFFSET_TEXTURE_BIAS_NV',
+'GL_OFFSET_TEXTURE_2D_MATRIX_NV', 'GL_OFFSET_TEXTURE_2D_SCALE_NV',
+'GL_OFFSET_TEXTURE_2D_BIAS_NV', 'GL_PREVIOUS_TEXTURE_INPUT_NV',
+'GL_CONST_EYE_NV', 'GL_PASS_THROUGH_NV', 'GL_CULL_FRAGMENT_NV',
+'GL_OFFSET_TEXTURE_2D_NV', 'GL_DEPENDENT_AR_TEXTURE_2D_NV',
+'GL_DEPENDENT_GB_TEXTURE_2D_NV', 'GL_DOT_PRODUCT_NV',
+'GL_DOT_PRODUCT_DEPTH_REPLACE_NV', 'GL_DOT_PRODUCT_TEXTURE_2D_NV',
+'GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV', 'GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV',
+'GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV',
+'GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV', 'GL_HILO_NV', 'GL_DSDT_NV',
+'GL_DSDT_MAG_NV', 'GL_DSDT_MAG_VIB_NV', 'GL_HILO16_NV', 'GL_SIGNED_HILO_NV',
+'GL_SIGNED_HILO16_NV', 'GL_SIGNED_RGBA_NV', 'GL_SIGNED_RGBA8_NV',
+'GL_SIGNED_RGB_NV', 'GL_SIGNED_RGB8_NV', 'GL_SIGNED_LUMINANCE_NV',
+'GL_SIGNED_LUMINANCE8_NV', 'GL_SIGNED_LUMINANCE_ALPHA_NV',
+'GL_SIGNED_LUMINANCE8_ALPHA8_NV', 'GL_SIGNED_ALPHA_NV', 'GL_SIGNED_ALPHA8_NV',
+'GL_SIGNED_INTENSITY_NV', 'GL_SIGNED_INTENSITY8_NV', 'GL_DSDT8_NV',
+'GL_DSDT8_MAG8_NV', 'GL_DSDT8_MAG8_INTENSITY8_NV',
+'GL_SIGNED_RGB_UNSIGNED_ALPHA_NV', 'GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV',
+'GL_HI_SCALE_NV', 'GL_LO_SCALE_NV', 'GL_DS_SCALE_NV', 'GL_DT_SCALE_NV',
+'GL_MAGNITUDE_SCALE_NV', 'GL_VIBRANCE_SCALE_NV', 'GL_HI_BIAS_NV',
+'GL_LO_BIAS_NV', 'GL_DS_BIAS_NV', 'GL_DT_BIAS_NV', 'GL_MAGNITUDE_BIAS_NV',
+'GL_VIBRANCE_BIAS_NV', 'GL_TEXTURE_BORDER_VALUES_NV', 'GL_TEXTURE_HI_SIZE_NV',
+'GL_TEXTURE_LO_SIZE_NV', 'GL_TEXTURE_DS_SIZE_NV', 'GL_TEXTURE_DT_SIZE_NV',
+'GL_TEXTURE_MAG_SIZE_NV', 'GL_DOT_PRODUCT_TEXTURE_3D_NV',
+'GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV', 'GL_VERTEX_PROGRAM_NV',
+'GL_VERTEX_STATE_PROGRAM_NV', 'GL_ATTRIB_ARRAY_SIZE_NV',
+'GL_ATTRIB_ARRAY_STRIDE_NV', 'GL_ATTRIB_ARRAY_TYPE_NV',
+'GL_CURRENT_ATTRIB_NV', 'GL_PROGRAM_LENGTH_NV', 'GL_PROGRAM_STRING_NV',
+'GL_MODELVIEW_PROJECTION_NV', 'GL_IDENTITY_NV', 'GL_INVERSE_NV',
+'GL_TRANSPOSE_NV', 'GL_INVERSE_TRANSPOSE_NV',
+'GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV', 'GL_MAX_TRACK_MATRICES_NV',
+'GL_MATRIX0_NV', 'GL_MATRIX1_NV', 'GL_MATRIX2_NV', 'GL_MATRIX3_NV',
+'GL_MATRIX4_NV', 'GL_MATRIX5_NV', 'GL_MATRIX6_NV', 'GL_MATRIX7_NV',
+'GL_CURRENT_MATRIX_STACK_DEPTH_NV', 'GL_CURRENT_MATRIX_NV',
+'GL_VERTEX_PROGRAM_POINT_SIZE_NV', 'GL_VERTEX_PROGRAM_TWO_SIDE_NV',
+'GL_PROGRAM_PARAMETER_NV', 'GL_ATTRIB_ARRAY_POINTER_NV',
+'GL_PROGRAM_TARGET_NV', 'GL_PROGRAM_RESIDENT_NV', 'GL_TRACK_MATRIX_NV',
+'GL_TRACK_MATRIX_TRANSFORM_NV', 'GL_VERTEX_PROGRAM_BINDING_NV',
+'GL_PROGRAM_ERROR_POSITION_NV', 'GL_VERTEX_ATTRIB_ARRAY0_NV',
+'GL_VERTEX_ATTRIB_ARRAY1_NV', 'GL_VERTEX_ATTRIB_ARRAY2_NV',
+'GL_VERTEX_ATTRIB_ARRAY3_NV', 'GL_VERTEX_ATTRIB_ARRAY4_NV',
+'GL_VERTEX_ATTRIB_ARRAY5_NV', 'GL_VERTEX_ATTRIB_ARRAY6_NV',
+'GL_VERTEX_ATTRIB_ARRAY7_NV', 'GL_VERTEX_ATTRIB_ARRAY8_NV',
+'GL_VERTEX_ATTRIB_ARRAY9_NV', 'GL_VERTEX_ATTRIB_ARRAY10_NV',
+'GL_VERTEX_ATTRIB_ARRAY11_NV', 'GL_VERTEX_ATTRIB_ARRAY12_NV',
+'GL_VERTEX_ATTRIB_ARRAY13_NV', 'GL_VERTEX_ATTRIB_ARRAY14_NV',
+'GL_VERTEX_ATTRIB_ARRAY15_NV', 'GL_MAP1_VERTEX_ATTRIB0_4_NV',
+'GL_MAP1_VERTEX_ATTRIB1_4_NV', 'GL_MAP1_VERTEX_ATTRIB2_4_NV',
+'GL_MAP1_VERTEX_ATTRIB3_4_NV', 'GL_MAP1_VERTEX_ATTRIB4_4_NV',
+'GL_MAP1_VERTEX_ATTRIB5_4_NV', 'GL_MAP1_VERTEX_ATTRIB6_4_NV',
+'GL_MAP1_VERTEX_ATTRIB7_4_NV', 'GL_MAP1_VERTEX_ATTRIB8_4_NV',
+'GL_MAP1_VERTEX_ATTRIB9_4_NV', 'GL_MAP1_VERTEX_ATTRIB10_4_NV',
+'GL_MAP1_VERTEX_ATTRIB11_4_NV', 'GL_MAP1_VERTEX_ATTRIB12_4_NV',
+'GL_MAP1_VERTEX_ATTRIB13_4_NV', 'GL_MAP1_VERTEX_ATTRIB14_4_NV',
+'GL_MAP1_VERTEX_ATTRIB15_4_NV', 'GL_MAP2_VERTEX_ATTRIB0_4_NV',
+'GL_MAP2_VERTEX_ATTRIB1_4_NV', 'GL_MAP2_VERTEX_ATTRIB2_4_NV',
+'GL_MAP2_VERTEX_ATTRIB3_4_NV', 'GL_MAP2_VERTEX_ATTRIB4_4_NV',
+'GL_MAP2_VERTEX_ATTRIB5_4_NV', 'GL_MAP2_VERTEX_ATTRIB6_4_NV',
+'GL_MAP2_VERTEX_ATTRIB7_4_NV', 'GL_MAP2_VERTEX_ATTRIB8_4_NV',
+'GL_MAP2_VERTEX_ATTRIB9_4_NV', 'GL_MAP2_VERTEX_ATTRIB10_4_NV',
+'GL_MAP2_VERTEX_ATTRIB11_4_NV', 'GL_MAP2_VERTEX_ATTRIB12_4_NV',
+'GL_MAP2_VERTEX_ATTRIB13_4_NV', 'GL_MAP2_VERTEX_ATTRIB14_4_NV',
+'GL_MAP2_VERTEX_ATTRIB15_4_NV', 'GL_TEXTURE_MAX_CLAMP_S_SGIX',
+'GL_TEXTURE_MAX_CLAMP_T_SGIX', 'GL_TEXTURE_MAX_CLAMP_R_SGIX',
+'GL_SCALEBIAS_HINT_SGIX', 'GL_INTERLACE_OML', 'GL_INTERLACE_READ_OML',
+'GL_FORMAT_SUBSAMPLE_24_24_OML', 'GL_FORMAT_SUBSAMPLE_244_244_OML',
+'GL_PACK_RESAMPLE_OML', 'GL_UNPACK_RESAMPLE_OML', 'GL_RESAMPLE_REPLICATE_OML',
+'GL_RESAMPLE_ZERO_FILL_OML', 'GL_RESAMPLE_AVERAGE_OML',
+'GL_RESAMPLE_DECIMATE_OML', 'GL_DEPTH_STENCIL_TO_RGBA_NV',
+'GL_DEPTH_STENCIL_TO_BGRA_NV', 'GL_BUMP_ROT_MATRIX_ATI',
+'GL_BUMP_ROT_MATRIX_SIZE_ATI', 'GL_BUMP_NUM_TEX_UNITS_ATI',
+'GL_BUMP_TEX_UNITS_ATI', 'GL_DUDV_ATI', 'GL_DU8DV8_ATI', 'GL_BUMP_ENVMAP_ATI',
+'GL_BUMP_TARGET_ATI', 'GL_FRAGMENT_SHADER_ATI', 'GL_REG_0_ATI',
+'GL_REG_1_ATI', 'GL_REG_2_ATI', 'GL_REG_3_ATI', 'GL_REG_4_ATI',
+'GL_REG_5_ATI', 'GL_REG_6_ATI', 'GL_REG_7_ATI', 'GL_REG_8_ATI',
+'GL_REG_9_ATI', 'GL_REG_10_ATI', 'GL_REG_11_ATI', 'GL_REG_12_ATI',
+'GL_REG_13_ATI', 'GL_REG_14_ATI', 'GL_REG_15_ATI', 'GL_REG_16_ATI',
+'GL_REG_17_ATI', 'GL_REG_18_ATI', 'GL_REG_19_ATI', 'GL_REG_20_ATI',
+'GL_REG_21_ATI', 'GL_REG_22_ATI', 'GL_REG_23_ATI', 'GL_REG_24_ATI',
+'GL_REG_25_ATI', 'GL_REG_26_ATI', 'GL_REG_27_ATI', 'GL_REG_28_ATI',
+'GL_REG_29_ATI', 'GL_REG_30_ATI', 'GL_REG_31_ATI', 'GL_CON_0_ATI',
+'GL_CON_1_ATI', 'GL_CON_2_ATI', 'GL_CON_3_ATI', 'GL_CON_4_ATI',
+'GL_CON_5_ATI', 'GL_CON_6_ATI', 'GL_CON_7_ATI', 'GL_CON_8_ATI',
+'GL_CON_9_ATI', 'GL_CON_10_ATI', 'GL_CON_11_ATI', 'GL_CON_12_ATI',
+'GL_CON_13_ATI', 'GL_CON_14_ATI', 'GL_CON_15_ATI', 'GL_CON_16_ATI',
+'GL_CON_17_ATI', 'GL_CON_18_ATI', 'GL_CON_19_ATI', 'GL_CON_20_ATI',
+'GL_CON_21_ATI', 'GL_CON_22_ATI', 'GL_CON_23_ATI', 'GL_CON_24_ATI',
+'GL_CON_25_ATI', 'GL_CON_26_ATI', 'GL_CON_27_ATI', 'GL_CON_28_ATI',
+'GL_CON_29_ATI', 'GL_CON_30_ATI', 'GL_CON_31_ATI', 'GL_MOV_ATI', 'GL_ADD_ATI',
+'GL_MUL_ATI', 'GL_SUB_ATI', 'GL_DOT3_ATI', 'GL_DOT4_ATI', 'GL_MAD_ATI',
+'GL_LERP_ATI', 'GL_CND_ATI', 'GL_CND0_ATI', 'GL_DOT2_ADD_ATI',
+'GL_SECONDARY_INTERPOLATOR_ATI', 'GL_NUM_FRAGMENT_REGISTERS_ATI',
+'GL_NUM_FRAGMENT_CONSTANTS_ATI', 'GL_NUM_PASSES_ATI',
+'GL_NUM_INSTRUCTIONS_PER_PASS_ATI', 'GL_NUM_INSTRUCTIONS_TOTAL_ATI',
+'GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI', 'GL_NUM_LOOPBACK_COMPONENTS_ATI',
+'GL_COLOR_ALPHA_PAIRING_ATI', 'GL_SWIZZLE_STR_ATI', 'GL_SWIZZLE_STQ_ATI',
+'GL_SWIZZLE_STR_DR_ATI', 'GL_SWIZZLE_STQ_DQ_ATI', 'GL_SWIZZLE_STRQ_ATI',
+'GL_SWIZZLE_STRQ_DQ_ATI', 'GL_RED_BIT_ATI', 'GL_GREEN_BIT_ATI',
+'GL_BLUE_BIT_ATI', 'GL_2X_BIT_ATI', 'GL_4X_BIT_ATI', 'GL_8X_BIT_ATI',
+'GL_HALF_BIT_ATI', 'GL_QUARTER_BIT_ATI', 'GL_EIGHTH_BIT_ATI',
+'GL_SATURATE_BIT_ATI', 'GL_COMP_BIT_ATI', 'GL_NEGATE_BIT_ATI',
+'GL_BIAS_BIT_ATI', 'GL_PN_TRIANGLES_ATI',
+'GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI', 'GL_PN_TRIANGLES_POINT_MODE_ATI',
+'GL_PN_TRIANGLES_NORMAL_MODE_ATI', 'GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI',
+'GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI',
+'GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI',
+'GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI',
+'GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI', 'GL_STATIC_ATI',
+'GL_DYNAMIC_ATI', 'GL_PRESERVE_ATI', 'GL_DISCARD_ATI',
+'GL_OBJECT_BUFFER_SIZE_ATI', 'GL_OBJECT_BUFFER_USAGE_ATI',
+'GL_ARRAY_OBJECT_BUFFER_ATI', 'GL_ARRAY_OBJECT_OFFSET_ATI',
+'GL_VERTEX_SHADER_EXT', 'GL_VERTEX_SHADER_BINDING_EXT', 'GL_OP_INDEX_EXT',
+'GL_OP_NEGATE_EXT', 'GL_OP_DOT3_EXT', 'GL_OP_DOT4_EXT', 'GL_OP_MUL_EXT',
+'GL_OP_ADD_EXT', 'GL_OP_MADD_EXT', 'GL_OP_FRAC_EXT', 'GL_OP_MAX_EXT',
+'GL_OP_MIN_EXT', 'GL_OP_SET_GE_EXT', 'GL_OP_SET_LT_EXT', 'GL_OP_CLAMP_EXT',
+'GL_OP_FLOOR_EXT', 'GL_OP_ROUND_EXT', 'GL_OP_EXP_BASE_2_EXT',
+'GL_OP_LOG_BASE_2_EXT', 'GL_OP_POWER_EXT', 'GL_OP_RECIP_EXT',
+'GL_OP_RECIP_SQRT_EXT', 'GL_OP_SUB_EXT', 'GL_OP_CROSS_PRODUCT_EXT',
+'GL_OP_MULTIPLY_MATRIX_EXT', 'GL_OP_MOV_EXT', 'GL_OUTPUT_VERTEX_EXT',
+'GL_OUTPUT_COLOR0_EXT', 'GL_OUTPUT_COLOR1_EXT',
+'GL_OUTPUT_TEXTURE_COORD0_EXT', 'GL_OUTPUT_TEXTURE_COORD1_EXT',
+'GL_OUTPUT_TEXTURE_COORD2_EXT', 'GL_OUTPUT_TEXTURE_COORD3_EXT',
+'GL_OUTPUT_TEXTURE_COORD4_EXT', 'GL_OUTPUT_TEXTURE_COORD5_EXT',
+'GL_OUTPUT_TEXTURE_COORD6_EXT', 'GL_OUTPUT_TEXTURE_COORD7_EXT',
+'GL_OUTPUT_TEXTURE_COORD8_EXT', 'GL_OUTPUT_TEXTURE_COORD9_EXT',
+'GL_OUTPUT_TEXTURE_COORD10_EXT', 'GL_OUTPUT_TEXTURE_COORD11_EXT',
+'GL_OUTPUT_TEXTURE_COORD12_EXT', 'GL_OUTPUT_TEXTURE_COORD13_EXT',
+'GL_OUTPUT_TEXTURE_COORD14_EXT', 'GL_OUTPUT_TEXTURE_COORD15_EXT',
+'GL_OUTPUT_TEXTURE_COORD16_EXT', 'GL_OUTPUT_TEXTURE_COORD17_EXT',
+'GL_OUTPUT_TEXTURE_COORD18_EXT', 'GL_OUTPUT_TEXTURE_COORD19_EXT',
+'GL_OUTPUT_TEXTURE_COORD20_EXT', 'GL_OUTPUT_TEXTURE_COORD21_EXT',
+'GL_OUTPUT_TEXTURE_COORD22_EXT', 'GL_OUTPUT_TEXTURE_COORD23_EXT',
+'GL_OUTPUT_TEXTURE_COORD24_EXT', 'GL_OUTPUT_TEXTURE_COORD25_EXT',
+'GL_OUTPUT_TEXTURE_COORD26_EXT', 'GL_OUTPUT_TEXTURE_COORD27_EXT',
+'GL_OUTPUT_TEXTURE_COORD28_EXT', 'GL_OUTPUT_TEXTURE_COORD29_EXT',
+'GL_OUTPUT_TEXTURE_COORD30_EXT', 'GL_OUTPUT_TEXTURE_COORD31_EXT',
+'GL_OUTPUT_FOG_EXT', 'GL_SCALAR_EXT', 'GL_VECTOR_EXT', 'GL_MATRIX_EXT',
+'GL_VARIANT_EXT', 'GL_INVARIANT_EXT', 'GL_LOCAL_CONSTANT_EXT', 'GL_LOCAL_EXT',
+'GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT', 'GL_MAX_VERTEX_SHADER_VARIANTS_EXT',
+'GL_MAX_VERTEX_SHADER_INVARIANTS_EXT',
+'GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT', 'GL_MAX_VERTEX_SHADER_LOCALS_EXT',
+'GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT',
+'GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT',
+'GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT',
+'GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT',
+'GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT',
+'GL_VERTEX_SHADER_INSTRUCTIONS_EXT', 'GL_VERTEX_SHADER_VARIANTS_EXT',
+'GL_VERTEX_SHADER_INVARIANTS_EXT', 'GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT',
+'GL_VERTEX_SHADER_LOCALS_EXT', 'GL_VERTEX_SHADER_OPTIMIZED_EXT', 'GL_X_EXT',
+'GL_Y_EXT', 'GL_Z_EXT', 'GL_W_EXT', 'GL_NEGATIVE_X_EXT', 'GL_NEGATIVE_Y_EXT',
+'GL_NEGATIVE_Z_EXT', 'GL_NEGATIVE_W_EXT', 'GL_ZERO_EXT', 'GL_ONE_EXT',
+'GL_NEGATIVE_ONE_EXT', 'GL_NORMALIZED_RANGE_EXT', 'GL_FULL_RANGE_EXT',
+'GL_CURRENT_VERTEX_EXT', 'GL_MVP_MATRIX_EXT', 'GL_VARIANT_VALUE_EXT',
+'GL_VARIANT_DATATYPE_EXT', 'GL_VARIANT_ARRAY_STRIDE_EXT',
+'GL_VARIANT_ARRAY_TYPE_EXT', 'GL_VARIANT_ARRAY_EXT',
+'GL_VARIANT_ARRAY_POINTER_EXT', 'GL_INVARIANT_VALUE_EXT',
+'GL_INVARIANT_DATATYPE_EXT', 'GL_LOCAL_CONSTANT_VALUE_EXT',
+'GL_LOCAL_CONSTANT_DATATYPE_EXT', 'GL_MAX_VERTEX_STREAMS_ATI',
+'GL_VERTEX_STREAM0_ATI', 'GL_VERTEX_STREAM1_ATI', 'GL_VERTEX_STREAM2_ATI',
+'GL_VERTEX_STREAM3_ATI', 'GL_VERTEX_STREAM4_ATI', 'GL_VERTEX_STREAM5_ATI',
+'GL_VERTEX_STREAM6_ATI', 'GL_VERTEX_STREAM7_ATI', 'GL_VERTEX_SOURCE_ATI',
+'GL_ELEMENT_ARRAY_ATI', 'GL_ELEMENT_ARRAY_TYPE_ATI',
+'GL_ELEMENT_ARRAY_POINTER_ATI', 'GL_QUAD_MESH_SUN', 'GL_TRIANGLE_MESH_SUN',
+'GL_SLICE_ACCUM_SUN', 'GL_MULTISAMPLE_FILTER_HINT_NV', 'GL_DEPTH_CLAMP_NV',
+'GL_PIXEL_COUNTER_BITS_NV', 'GL_CURRENT_OCCLUSION_QUERY_ID_NV',
+'GL_PIXEL_COUNT_NV', 'GL_PIXEL_COUNT_AVAILABLE_NV', 'GL_POINT_SPRITE_NV',
+'GL_COORD_REPLACE_NV', 'GL_POINT_SPRITE_R_MODE_NV',
+'GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV',
+'GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV',
+'GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV',
+'GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV',
+'GL_OFFSET_HILO_TEXTURE_2D_NV', 'GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV',
+'GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV',
+'GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV',
+'GL_DEPENDENT_HILO_TEXTURE_2D_NV', 'GL_DEPENDENT_RGB_TEXTURE_3D_NV',
+'GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV', 'GL_DOT_PRODUCT_PASS_THROUGH_NV',
+'GL_DOT_PRODUCT_TEXTURE_1D_NV', 'GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV',
+'GL_HILO8_NV', 'GL_SIGNED_HILO8_NV', 'GL_FORCE_BLUE_TO_ONE_NV',
+'GL_STENCIL_TEST_TWO_SIDE_EXT', 'GL_ACTIVE_STENCIL_FACE_EXT',
+'GL_TEXT_FRAGMENT_SHADER_ATI', 'GL_UNPACK_CLIENT_STORAGE_APPLE',
+'GL_ELEMENT_ARRAY_APPLE', 'GL_ELEMENT_ARRAY_TYPE_APPLE',
+'GL_ELEMENT_ARRAY_POINTER_APPLE', 'GL_DRAW_PIXELS_APPLE', 'GL_FENCE_APPLE',
+'GL_VERTEX_ARRAY_BINDING_APPLE', 'GL_VERTEX_ARRAY_RANGE_APPLE',
+'GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE', 'GL_VERTEX_ARRAY_STORAGE_HINT_APPLE',
+'GL_VERTEX_ARRAY_RANGE_POINTER_APPLE', 'GL_STORAGE_CLIENT_APPLE',
+'GL_STORAGE_CACHED_APPLE', 'GL_STORAGE_SHARED_APPLE', 'GL_YCBCR_422_APPLE',
+'GL_UNSIGNED_SHORT_8_8_APPLE', 'GL_UNSIGNED_SHORT_8_8_REV_APPLE',
+'GL_RGB_S3TC', 'GL_RGB4_S3TC', 'GL_RGBA_S3TC', 'GL_RGBA4_S3TC',
+'GL_MAX_DRAW_BUFFERS_ATI', 'GL_DRAW_BUFFER0_ATI', 'GL_DRAW_BUFFER1_ATI',
+'GL_DRAW_BUFFER2_ATI', 'GL_DRAW_BUFFER3_ATI', 'GL_DRAW_BUFFER4_ATI',
+'GL_DRAW_BUFFER5_ATI', 'GL_DRAW_BUFFER6_ATI', 'GL_DRAW_BUFFER7_ATI',
+'GL_DRAW_BUFFER8_ATI', 'GL_DRAW_BUFFER9_ATI', 'GL_DRAW_BUFFER10_ATI',
+'GL_DRAW_BUFFER11_ATI', 'GL_DRAW_BUFFER12_ATI', 'GL_DRAW_BUFFER13_ATI',
+'GL_DRAW_BUFFER14_ATI', 'GL_DRAW_BUFFER15_ATI', 'GL_TYPE_RGBA_FLOAT_ATI',
+'GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI', 'GL_MODULATE_ADD_ATI',
+'GL_MODULATE_SIGNED_ADD_ATI', 'GL_MODULATE_SUBTRACT_ATI',
+'GL_RGBA_FLOAT32_ATI', 'GL_RGB_FLOAT32_ATI', 'GL_ALPHA_FLOAT32_ATI',
+'GL_INTENSITY_FLOAT32_ATI', 'GL_LUMINANCE_FLOAT32_ATI',
+'GL_LUMINANCE_ALPHA_FLOAT32_ATI', 'GL_RGBA_FLOAT16_ATI', 'GL_RGB_FLOAT16_ATI',
+'GL_ALPHA_FLOAT16_ATI', 'GL_INTENSITY_FLOAT16_ATI',
+'GL_LUMINANCE_FLOAT16_ATI', 'GL_LUMINANCE_ALPHA_FLOAT16_ATI', 'GL_FLOAT_R_NV',
+'GL_FLOAT_RG_NV', 'GL_FLOAT_RGB_NV', 'GL_FLOAT_RGBA_NV', 'GL_FLOAT_R16_NV',
+'GL_FLOAT_R32_NV', 'GL_FLOAT_RG16_NV', 'GL_FLOAT_RG32_NV',
+'GL_FLOAT_RGB16_NV', 'GL_FLOAT_RGB32_NV', 'GL_FLOAT_RGBA16_NV',
+'GL_FLOAT_RGBA32_NV', 'GL_TEXTURE_FLOAT_COMPONENTS_NV',
+'GL_FLOAT_CLEAR_COLOR_VALUE_NV', 'GL_FLOAT_RGBA_MODE_NV',
+'GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV', 'GL_FRAGMENT_PROGRAM_NV',
+'GL_MAX_TEXTURE_COORDS_NV', 'GL_MAX_TEXTURE_IMAGE_UNITS_NV',
+'GL_FRAGMENT_PROGRAM_BINDING_NV', 'GL_PROGRAM_ERROR_STRING_NV',
+'GL_HALF_FLOAT_NV', 'GL_WRITE_PIXEL_DATA_RANGE_NV',
+'GL_READ_PIXEL_DATA_RANGE_NV', 'GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV',
+'GL_READ_PIXEL_DATA_RANGE_LENGTH_NV', 'GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV',
+'GL_READ_PIXEL_DATA_RANGE_POINTER_NV', 'GL_PRIMITIVE_RESTART_NV',
+'GL_PRIMITIVE_RESTART_INDEX_NV', 'GL_TEXTURE_UNSIGNED_REMAP_MODE_NV',
+'GL_STENCIL_BACK_FUNC_ATI', 'GL_STENCIL_BACK_FAIL_ATI',
+'GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI', 'GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI',
+'GL_IMPLEMENTATION_COLOR_READ_TYPE_OES',
+'GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES', 'GL_DEPTH_BOUNDS_TEST_EXT',
+'GL_DEPTH_BOUNDS_EXT', 'GL_MIRROR_CLAMP_EXT', 'GL_MIRROR_CLAMP_TO_EDGE_EXT',
+'GL_MIRROR_CLAMP_TO_BORDER_EXT', 'GL_BLEND_EQUATION_RGB_EXT',
+'GL_BLEND_EQUATION_ALPHA_EXT', 'GL_PACK_INVERT_MESA',
+'GL_UNSIGNED_SHORT_8_8_MESA', 'GL_UNSIGNED_SHORT_8_8_REV_MESA',
+'GL_YCBCR_MESA', 'GL_PIXEL_PACK_BUFFER_EXT', 'GL_PIXEL_UNPACK_BUFFER_EXT',
+'GL_PIXEL_PACK_BUFFER_BINDING_EXT', 'GL_PIXEL_UNPACK_BUFFER_BINDING_EXT',
+'GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV', 'GL_MAX_PROGRAM_CALL_DEPTH_NV',
+'GL_MAX_PROGRAM_IF_DEPTH_NV', 'GL_MAX_PROGRAM_LOOP_DEPTH_NV',
+'GL_MAX_PROGRAM_LOOP_COUNT_NV', 'GL_INVALID_FRAMEBUFFER_OPERATION_EXT',
+'GL_MAX_RENDERBUFFER_SIZE_EXT', 'GL_FRAMEBUFFER_BINDING_EXT',
+'GL_RENDERBUFFER_BINDING_EXT', 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT',
+'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT',
+'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT',
+'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT',
+'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT',
+'GL_FRAMEBUFFER_COMPLETE_EXT', 'GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT',
+'GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT',
+'GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT',
+'GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT',
+'GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT',
+'GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT', 'GL_FRAMEBUFFER_UNSUPPORTED_EXT',
+'GL_MAX_COLOR_ATTACHMENTS_EXT', 'GL_COLOR_ATTACHMENT0_EXT',
+'GL_COLOR_ATTACHMENT1_EXT', 'GL_COLOR_ATTACHMENT2_EXT',
+'GL_COLOR_ATTACHMENT3_EXT', 'GL_COLOR_ATTACHMENT4_EXT',
+'GL_COLOR_ATTACHMENT5_EXT', 'GL_COLOR_ATTACHMENT6_EXT',
+'GL_COLOR_ATTACHMENT7_EXT', 'GL_COLOR_ATTACHMENT8_EXT',
+'GL_COLOR_ATTACHMENT9_EXT', 'GL_COLOR_ATTACHMENT10_EXT',
+'GL_COLOR_ATTACHMENT11_EXT', 'GL_COLOR_ATTACHMENT12_EXT',
+'GL_COLOR_ATTACHMENT13_EXT', 'GL_COLOR_ATTACHMENT14_EXT',
+'GL_COLOR_ATTACHMENT15_EXT', 'GL_DEPTH_ATTACHMENT_EXT',
+'GL_STENCIL_ATTACHMENT_EXT', 'GL_FRAMEBUFFER_EXT', 'GL_RENDERBUFFER_EXT',
+'GL_RENDERBUFFER_WIDTH_EXT', 'GL_RENDERBUFFER_HEIGHT_EXT',
+'GL_RENDERBUFFER_INTERNAL_FORMAT_EXT', 'GL_STENCIL_INDEX1_EXT',
+'GL_STENCIL_INDEX4_EXT', 'GL_STENCIL_INDEX8_EXT', 'GL_STENCIL_INDEX16_EXT',
+'GL_RENDERBUFFER_RED_SIZE_EXT', 'GL_RENDERBUFFER_GREEN_SIZE_EXT',
+'GL_RENDERBUFFER_BLUE_SIZE_EXT', 'GL_RENDERBUFFER_ALPHA_SIZE_EXT',
+'GL_RENDERBUFFER_DEPTH_SIZE_EXT', 'GL_RENDERBUFFER_STENCIL_SIZE_EXT',
+'GL_DEPTH_STENCIL_EXT', 'GL_UNSIGNED_INT_24_8_EXT', 'GL_DEPTH24_STENCIL8_EXT',
+'GL_TEXTURE_STENCIL_SIZE_EXT', 'GL_STENCIL_TAG_BITS_EXT',
+'GL_STENCIL_CLEAR_TAG_VALUE_EXT', 'GL_SRGB_EXT', 'GL_SRGB8_EXT',
+'GL_SRGB_ALPHA_EXT', 'GL_SRGB8_ALPHA8_EXT', 'GL_SLUMINANCE_ALPHA_EXT',
+'GL_SLUMINANCE8_ALPHA8_EXT', 'GL_SLUMINANCE_EXT', 'GL_SLUMINANCE8_EXT',
+'GL_COMPRESSED_SRGB_EXT', 'GL_COMPRESSED_SRGB_ALPHA_EXT',
+'GL_COMPRESSED_SLUMINANCE_EXT', 'GL_COMPRESSED_SLUMINANCE_ALPHA_EXT',
+'GL_COMPRESSED_SRGB_S3TC_DXT1_EXT', 'GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT',
+'GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT',
+'GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT', 'GL_READ_FRAMEBUFFER_EXT',
+'GL_DRAW_FRAMEBUFFER_EXT', 'GL_DRAW_FRAMEBUFFER_BINDING_EXT',
+'GL_READ_FRAMEBUFFER_BINDING_EXT', 'GL_RENDERBUFFER_SAMPLES_EXT',
+'GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT', 'GL_MAX_SAMPLES_EXT',
+'GL_TEXTURE_1D_STACK_MESAX', 'GL_TEXTURE_2D_STACK_MESAX',
+'GL_PROXY_TEXTURE_1D_STACK_MESAX', 'GL_PROXY_TEXTURE_2D_STACK_MESAX',
+'GL_TEXTURE_1D_STACK_BINDING_MESAX', 'GL_TEXTURE_2D_STACK_BINDING_MESAX',
+'GL_TIME_ELAPSED_EXT', 'GL_BUFFER_SERIALIZED_MODIFY_APPLE',
+'GL_BUFFER_FLUSHING_UNMAP_APPLE', 'GL_MIN_PROGRAM_TEXEL_OFFSET_NV',
+'GL_MAX_PROGRAM_TEXEL_OFFSET_NV', 'GL_PROGRAM_ATTRIB_COMPONENTS_NV',
+'GL_PROGRAM_RESULT_COMPONENTS_NV', 'GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV',
+'GL_MAX_PROGRAM_RESULT_COMPONENTS_NV', 'GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV',
+'GL_MAX_PROGRAM_GENERIC_RESULTS_NV', 'GL_LINES_ADJACENCY_EXT',
+'GL_LINE_STRIP_ADJACENCY_EXT', 'GL_TRIANGLES_ADJACENCY_EXT',
+'GL_TRIANGLE_STRIP_ADJACENCY_EXT', 'GL_GEOMETRY_PROGRAM_NV',
+'GL_MAX_PROGRAM_OUTPUT_VERTICES_NV',
+'GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV', 'GL_GEOMETRY_VERTICES_OUT_EXT',
+'GL_GEOMETRY_INPUT_TYPE_EXT', 'GL_GEOMETRY_OUTPUT_TYPE_EXT',
+'GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT',
+'GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT',
+'GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT',
+'GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT',
+'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT', 'GL_PROGRAM_POINT_SIZE_EXT',
+'GL_GEOMETRY_SHADER_EXT', 'GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT',
+'GL_MAX_VERTEX_VARYING_COMPONENTS_EXT', 'GL_MAX_VARYING_COMPONENTS_EXT',
+'GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT',
+'GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT',
+'GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT',
+'GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV', 'GL_SAMPLER_1D_ARRAY_EXT',
+'GL_SAMPLER_2D_ARRAY_EXT', 'GL_SAMPLER_BUFFER_EXT',
+'GL_SAMPLER_1D_ARRAY_SHADOW_EXT', 'GL_SAMPLER_2D_ARRAY_SHADOW_EXT',
+'GL_SAMPLER_CUBE_SHADOW_EXT', 'GL_UNSIGNED_INT_VEC2_EXT',
+'GL_UNSIGNED_INT_VEC3_EXT', 'GL_UNSIGNED_INT_VEC4_EXT',
+'GL_INT_SAMPLER_1D_EXT', 'GL_INT_SAMPLER_2D_EXT', 'GL_INT_SAMPLER_3D_EXT',
+'GL_INT_SAMPLER_CUBE_EXT', 'GL_INT_SAMPLER_2D_RECT_EXT',
+'GL_INT_SAMPLER_1D_ARRAY_EXT', 'GL_INT_SAMPLER_2D_ARRAY_EXT',
+'GL_INT_SAMPLER_BUFFER_EXT', 'GL_UNSIGNED_INT_SAMPLER_1D_EXT',
+'GL_UNSIGNED_INT_SAMPLER_2D_EXT', 'GL_UNSIGNED_INT_SAMPLER_3D_EXT',
+'GL_UNSIGNED_INT_SAMPLER_CUBE_EXT', 'GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT',
+'GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT',
+'GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT', 'GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT',
+'GL_R11F_G11F_B10F_EXT', 'GL_UNSIGNED_INT_10F_11F_11F_REV_EXT',
+'GL_RGBA_SIGNED_COMPONENTS_EXT', 'GL_TEXTURE_1D_ARRAY_EXT',
+'GL_PROXY_TEXTURE_1D_ARRAY_EXT', 'GL_TEXTURE_2D_ARRAY_EXT',
+'GL_PROXY_TEXTURE_2D_ARRAY_EXT', 'GL_TEXTURE_BINDING_1D_ARRAY_EXT',
+'GL_TEXTURE_BINDING_2D_ARRAY_EXT', 'GL_MAX_ARRAY_TEXTURE_LAYERS_EXT',
+'GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT', 'GL_TEXTURE_BUFFER_EXT',
+'GL_MAX_TEXTURE_BUFFER_SIZE_EXT', 'GL_TEXTURE_BINDING_BUFFER_EXT',
+'GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT', 'GL_TEXTURE_BUFFER_FORMAT_EXT',
+'GL_COMPRESSED_LUMINANCE_LATC1_EXT',
+'GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT',
+'GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT',
+'GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT',
+'GL_COMPRESSED_RED_RGTC1_EXT', 'GL_COMPRESSED_SIGNED_RED_RGTC1_EXT',
+'GL_COMPRESSED_RED_GREEN_RGTC2_EXT',
+'GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT', 'GL_RGB9_E5_EXT',
+'GL_UNSIGNED_INT_5_9_9_9_REV_EXT', 'GL_TEXTURE_SHARED_SIZE_EXT',
+'GL_DEPTH_COMPONENT32F_NV', 'GL_DEPTH32F_STENCIL8_NV',
+'GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV', 'GL_DEPTH_BUFFER_FLOAT_MODE_NV',
+'GL_RENDERBUFFER_COVERAGE_SAMPLES_NV', 'GL_RENDERBUFFER_COLOR_SAMPLES_NV',
+'GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV', 'GL_MULTISAMPLE_COVERAGE_MODES_NV',
+'GL_FRAMEBUFFER_SRGB_EXT', 'GL_FRAMEBUFFER_SRGB_CAPABLE_EXT',
+'GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV',
+'GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV',
+'GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV',
+'GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV',
+'GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV', 'GL_BACK_PRIMARY_COLOR_NV',
+'GL_BACK_SECONDARY_COLOR_NV', 'GL_TEXTURE_COORD_NV', 'GL_CLIP_DISTANCE_NV',
+'GL_VERTEX_ID_NV', 'GL_PRIMITIVE_ID_NV', 'GL_GENERIC_ATTRIB_NV',
+'GL_TRANSFORM_FEEDBACK_ATTRIBS_NV', 'GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV',
+'GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV', 'GL_ACTIVE_VARYINGS_NV',
+'GL_ACTIVE_VARYING_MAX_LENGTH_NV', 'GL_TRANSFORM_FEEDBACK_VARYINGS_NV',
+'GL_TRANSFORM_FEEDBACK_BUFFER_START_NV',
+'GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV', 'GL_TRANSFORM_FEEDBACK_RECORD_NV',
+'GL_PRIMITIVES_GENERATED_NV', 'GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV',
+'GL_RASTERIZER_DISCARD_NV',
+'GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_ATTRIBS_NV',
+'GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV', 'GL_INTERLEAVED_ATTRIBS_NV',
+'GL_SEPARATE_ATTRIBS_NV', 'GL_TRANSFORM_FEEDBACK_BUFFER_NV',
+'GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV', 'GL_LAYER_NV', 'GL_NEXT_BUFFER_NV',
+'GL_SKIP_COMPONENTS4_NV', 'GL_SKIP_COMPONENTS3_NV', 'GL_SKIP_COMPONENTS2_NV',
+'GL_SKIP_COMPONENTS1_NV', 'GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT',
+'GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT',
+'GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT', 'GL_MAX_BINDABLE_UNIFORM_SIZE_EXT',
+'GL_UNIFORM_BUFFER_EXT', 'GL_UNIFORM_BUFFER_BINDING_EXT', 'GL_RGBA32UI_EXT',
+'GL_RGB32UI_EXT', 'GL_ALPHA32UI_EXT', 'GL_INTENSITY32UI_EXT',
+'GL_LUMINANCE32UI_EXT', 'GL_LUMINANCE_ALPHA32UI_EXT', 'GL_RGBA16UI_EXT',
+'GL_RGB16UI_EXT', 'GL_ALPHA16UI_EXT', 'GL_INTENSITY16UI_EXT',
+'GL_LUMINANCE16UI_EXT', 'GL_LUMINANCE_ALPHA16UI_EXT', 'GL_RGBA8UI_EXT',
+'GL_RGB8UI_EXT', 'GL_ALPHA8UI_EXT', 'GL_INTENSITY8UI_EXT',
+'GL_LUMINANCE8UI_EXT', 'GL_LUMINANCE_ALPHA8UI_EXT', 'GL_RGBA32I_EXT',
+'GL_RGB32I_EXT', 'GL_ALPHA32I_EXT', 'GL_INTENSITY32I_EXT',
+'GL_LUMINANCE32I_EXT', 'GL_LUMINANCE_ALPHA32I_EXT', 'GL_RGBA16I_EXT',
+'GL_RGB16I_EXT', 'GL_ALPHA16I_EXT', 'GL_INTENSITY16I_EXT',
+'GL_LUMINANCE16I_EXT', 'GL_LUMINANCE_ALPHA16I_EXT', 'GL_RGBA8I_EXT',
+'GL_RGB8I_EXT', 'GL_ALPHA8I_EXT', 'GL_INTENSITY8I_EXT', 'GL_LUMINANCE8I_EXT',
+'GL_LUMINANCE_ALPHA8I_EXT', 'GL_RED_INTEGER_EXT', 'GL_GREEN_INTEGER_EXT',
+'GL_BLUE_INTEGER_EXT', 'GL_ALPHA_INTEGER_EXT', 'GL_RGB_INTEGER_EXT',
+'GL_RGBA_INTEGER_EXT', 'GL_BGR_INTEGER_EXT', 'GL_BGRA_INTEGER_EXT',
+'GL_LUMINANCE_INTEGER_EXT', 'GL_LUMINANCE_ALPHA_INTEGER_EXT',
+'GL_RGBA_INTEGER_MODE_EXT', 'GL_QUERY_WAIT_NV', 'GL_QUERY_NO_WAIT_NV',
+'GL_QUERY_BY_REGION_WAIT_NV', 'GL_QUERY_BY_REGION_NO_WAIT_NV', 'GL_FRAME_NV',
+'GL_FIELDS_NV', 'GL_CURRENT_TIME_NV', 'GL_NUM_FILL_STREAMS_NV',
+'GL_PRESENT_TIME_NV', 'GL_PRESENT_DURATION_NV',
+'GL_TRANSFORM_FEEDBACK_BUFFER_EXT', 'GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT',
+'GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT',
+'GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT', 'GL_INTERLEAVED_ATTRIBS_EXT',
+'GL_SEPARATE_ATTRIBS_EXT', 'GL_PRIMITIVES_GENERATED_EXT',
+'GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT', 'GL_RASTERIZER_DISCARD_EXT',
+'GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT',
+'GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT',
+'GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT',
+'GL_TRANSFORM_FEEDBACK_VARYINGS_EXT', 'GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT',
+'GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT', 'GL_PROGRAM_MATRIX_EXT',
+'GL_TRANSPOSE_PROGRAM_MATRIX_EXT', 'GL_PROGRAM_MATRIX_STACK_DEPTH_EXT',
+'GL_TEXTURE_SWIZZLE_R_EXT', 'GL_TEXTURE_SWIZZLE_G_EXT',
+'GL_TEXTURE_SWIZZLE_B_EXT', 'GL_TEXTURE_SWIZZLE_A_EXT',
+'GL_TEXTURE_SWIZZLE_RGBA_EXT', 'GL_SAMPLE_POSITION_NV', 'GL_SAMPLE_MASK_NV',
+'GL_SAMPLE_MASK_VALUE_NV', 'GL_TEXTURE_BINDING_RENDERBUFFER_NV',
+'GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV', 'GL_TEXTURE_RENDERBUFFER_NV',
+'GL_SAMPLER_RENDERBUFFER_NV', 'GL_INT_SAMPLER_RENDERBUFFER_NV',
+'GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV', 'GL_MAX_SAMPLE_MASK_WORDS_NV',
+'GL_TRANSFORM_FEEDBACK_NV', 'GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV',
+'GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV', 'GL_TRANSFORM_FEEDBACK_BINDING_NV',
+'GL_VBO_FREE_MEMORY_ATI', 'GL_TEXTURE_FREE_MEMORY_ATI',
+'GL_RENDERBUFFER_FREE_MEMORY_ATI', 'GL_COUNTER_TYPE_AMD',
+'GL_COUNTER_RANGE_AMD', 'GL_UNSIGNED_INT64_AMD', 'GL_PERCENTAGE_AMD',
+'GL_PERFMON_RESULT_AVAILABLE_AMD', 'GL_PERFMON_RESULT_SIZE_AMD',
+'GL_PERFMON_RESULT_AMD', 'GL_SAMPLER_BUFFER_AMD', 'GL_INT_SAMPLER_BUFFER_AMD',
+'GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD', 'GL_TESSELLATION_MODE_AMD',
+'GL_TESSELLATION_FACTOR_AMD', 'GL_DISCRETE_AMD', 'GL_CONTINUOUS_AMD',
+'GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT',
+'GL_FIRST_VERTEX_CONVENTION_EXT', 'GL_LAST_VERTEX_CONVENTION_EXT',
+'GL_PROVOKING_VERTEX_EXT', 'GL_ALPHA_SNORM', 'GL_LUMINANCE_SNORM',
+'GL_LUMINANCE_ALPHA_SNORM', 'GL_INTENSITY_SNORM', 'GL_ALPHA8_SNORM',
+'GL_LUMINANCE8_SNORM', 'GL_LUMINANCE8_ALPHA8_SNORM', 'GL_INTENSITY8_SNORM',
+'GL_ALPHA16_SNORM', 'GL_LUMINANCE16_SNORM', 'GL_LUMINANCE16_ALPHA16_SNORM',
+'GL_INTENSITY16_SNORM', 'GL_TEXTURE_RANGE_LENGTH_APPLE',
+'GL_TEXTURE_RANGE_POINTER_APPLE', 'GL_TEXTURE_STORAGE_HINT_APPLE',
+'GL_STORAGE_PRIVATE_APPLE', 'GL_HALF_APPLE', 'GL_RGBA_FLOAT32_APPLE',
+'GL_RGB_FLOAT32_APPLE', 'GL_ALPHA_FLOAT32_APPLE',
+'GL_INTENSITY_FLOAT32_APPLE', 'GL_LUMINANCE_FLOAT32_APPLE',
+'GL_LUMINANCE_ALPHA_FLOAT32_APPLE', 'GL_RGBA_FLOAT16_APPLE',
+'GL_RGB_FLOAT16_APPLE', 'GL_ALPHA_FLOAT16_APPLE',
+'GL_INTENSITY_FLOAT16_APPLE', 'GL_LUMINANCE_FLOAT16_APPLE',
+'GL_LUMINANCE_ALPHA_FLOAT16_APPLE', 'GL_COLOR_FLOAT_APPLE',
+'GL_VERTEX_ATTRIB_MAP1_APPLE', 'GL_VERTEX_ATTRIB_MAP2_APPLE',
+'GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE', 'GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE',
+'GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE', 'GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE',
+'GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE', 'GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE',
+'GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE', 'GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE',
+'GL_AUX_DEPTH_STENCIL_APPLE', 'GL_BUFFER_OBJECT_APPLE', 'GL_RELEASED_APPLE',
+'GL_VOLATILE_APPLE', 'GL_RETAINED_APPLE', 'GL_UNDEFINED_APPLE',
+'GL_PURGEABLE_APPLE', 'GL_PACK_ROW_BYTES_APPLE', 'GL_UNPACK_ROW_BYTES_APPLE',
+'GL_RGB_422_APPLE', 'GL_VIDEO_BUFFER_NV', 'GL_VIDEO_BUFFER_BINDING_NV',
+'GL_FIELD_UPPER_NV', 'GL_FIELD_LOWER_NV', 'GL_NUM_VIDEO_CAPTURE_STREAMS_NV',
+'GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV',
+'GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV', 'GL_LAST_VIDEO_CAPTURE_STATUS_NV',
+'GL_VIDEO_BUFFER_PITCH_NV', 'GL_VIDEO_COLOR_CONVERSION_MATRIX_NV',
+'GL_VIDEO_COLOR_CONVERSION_MAX_NV', 'GL_VIDEO_COLOR_CONVERSION_MIN_NV',
+'GL_VIDEO_COLOR_CONVERSION_OFFSET_NV', 'GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV',
+'GL_PARTIAL_SUCCESS_NV', 'GL_SUCCESS_NV', 'GL_FAILURE_NV',
+'GL_YCBYCR8_422_NV', 'GL_YCBAYCR8A_4224_NV',
+'GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV',
+'GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV',
+'GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV',
+'GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV', 'GL_Z4Y12Z4CB12Z4CR12_444_NV',
+'GL_VIDEO_CAPTURE_FRAME_WIDTH_NV', 'GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV',
+'GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV',
+'GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV',
+'GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV', 'GL_ACTIVE_PROGRAM_EXT',
+'GL_BUFFER_GPU_ADDRESS_NV', 'GL_GPU_ADDRESS_NV',
+'GL_MAX_SHADER_BUFFER_ADDRESS_NV', 'GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV',
+'GL_ELEMENT_ARRAY_UNIFIED_NV', 'GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV',
+'GL_VERTEX_ARRAY_ADDRESS_NV', 'GL_NORMAL_ARRAY_ADDRESS_NV',
+'GL_COLOR_ARRAY_ADDRESS_NV', 'GL_INDEX_ARRAY_ADDRESS_NV',
+'GL_TEXTURE_COORD_ARRAY_ADDRESS_NV', 'GL_EDGE_FLAG_ARRAY_ADDRESS_NV',
+'GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV', 'GL_FOG_COORD_ARRAY_ADDRESS_NV',
+'GL_ELEMENT_ARRAY_ADDRESS_NV', 'GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV',
+'GL_VERTEX_ARRAY_LENGTH_NV', 'GL_NORMAL_ARRAY_LENGTH_NV',
+'GL_COLOR_ARRAY_LENGTH_NV', 'GL_INDEX_ARRAY_LENGTH_NV',
+'GL_TEXTURE_COORD_ARRAY_LENGTH_NV', 'GL_EDGE_FLAG_ARRAY_LENGTH_NV',
+'GL_SECONDARY_COLOR_ARRAY_LENGTH_NV', 'GL_FOG_COORD_ARRAY_LENGTH_NV',
+'GL_ELEMENT_ARRAY_LENGTH_NV', 'GL_DRAW_INDIRECT_UNIFIED_NV',
+'GL_DRAW_INDIRECT_ADDRESS_NV', 'GL_DRAW_INDIRECT_LENGTH_NV',
+'GL_MAX_IMAGE_UNITS_EXT',
+'GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT',
+'GL_IMAGE_BINDING_NAME_EXT', 'GL_IMAGE_BINDING_LEVEL_EXT',
+'GL_IMAGE_BINDING_LAYERED_EXT', 'GL_IMAGE_BINDING_LAYER_EXT',
+'GL_IMAGE_BINDING_ACCESS_EXT', 'GL_IMAGE_1D_EXT', 'GL_IMAGE_2D_EXT',
+'GL_IMAGE_3D_EXT', 'GL_IMAGE_2D_RECT_EXT', 'GL_IMAGE_CUBE_EXT',
+'GL_IMAGE_BUFFER_EXT', 'GL_IMAGE_1D_ARRAY_EXT', 'GL_IMAGE_2D_ARRAY_EXT',
+'GL_IMAGE_CUBE_MAP_ARRAY_EXT', 'GL_IMAGE_2D_MULTISAMPLE_EXT',
+'GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT', 'GL_INT_IMAGE_1D_EXT',
+'GL_INT_IMAGE_2D_EXT', 'GL_INT_IMAGE_3D_EXT', 'GL_INT_IMAGE_2D_RECT_EXT',
+'GL_INT_IMAGE_CUBE_EXT', 'GL_INT_IMAGE_BUFFER_EXT',
+'GL_INT_IMAGE_1D_ARRAY_EXT', 'GL_INT_IMAGE_2D_ARRAY_EXT',
+'GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT', 'GL_INT_IMAGE_2D_MULTISAMPLE_EXT',
+'GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT', 'GL_UNSIGNED_INT_IMAGE_1D_EXT',
+'GL_UNSIGNED_INT_IMAGE_2D_EXT', 'GL_UNSIGNED_INT_IMAGE_3D_EXT',
+'GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT', 'GL_UNSIGNED_INT_IMAGE_CUBE_EXT',
+'GL_UNSIGNED_INT_IMAGE_BUFFER_EXT', 'GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT',
+'GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT',
+'GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT',
+'GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT',
+'GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT', 'GL_MAX_IMAGE_SAMPLES_EXT',
+'GL_IMAGE_BINDING_FORMAT_EXT', 'GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT',
+'GL_ELEMENT_ARRAY_BARRIER_BIT_EXT', 'GL_UNIFORM_BARRIER_BIT_EXT',
+'GL_TEXTURE_FETCH_BARRIER_BIT_EXT', 'GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT',
+'GL_COMMAND_BARRIER_BIT_EXT', 'GL_PIXEL_BUFFER_BARRIER_BIT_EXT',
+'GL_TEXTURE_UPDATE_BARRIER_BIT_EXT', 'GL_BUFFER_UPDATE_BARRIER_BIT_EXT',
+'GL_FRAMEBUFFER_BARRIER_BIT_EXT', 'GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT',
+'GL_ATOMIC_COUNTER_BARRIER_BIT_EXT', 'GL_ALL_BARRIER_BITS_EXT',
+'GL_DOUBLE_VEC2_EXT', 'GL_DOUBLE_VEC3_EXT', 'GL_DOUBLE_VEC4_EXT',
+'GL_DOUBLE_MAT2_EXT', 'GL_DOUBLE_MAT3_EXT', 'GL_DOUBLE_MAT4_EXT',
+'GL_DOUBLE_MAT2x3_EXT', 'GL_DOUBLE_MAT2x4_EXT', 'GL_DOUBLE_MAT3x2_EXT',
+'GL_DOUBLE_MAT3x4_EXT', 'GL_DOUBLE_MAT4x2_EXT', 'GL_DOUBLE_MAT4x3_EXT',
+'GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV',
+'GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV',
+'GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV',
+'GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV',
+'GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV',
+'GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV',
+'GL_MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV', 'GL_MAX_PROGRAM_SUBROUTINE_NUM_NV',
+'GL_INT64_NV', 'GL_UNSIGNED_INT64_NV', 'GL_INT8_NV', 'GL_INT8_VEC2_NV',
+'GL_INT8_VEC3_NV', 'GL_INT8_VEC4_NV', 'GL_INT16_NV', 'GL_INT16_VEC2_NV',
+'GL_INT16_VEC3_NV', 'GL_INT16_VEC4_NV', 'GL_INT64_VEC2_NV',
+'GL_INT64_VEC3_NV', 'GL_INT64_VEC4_NV', 'GL_UNSIGNED_INT8_NV',
+'GL_UNSIGNED_INT8_VEC2_NV', 'GL_UNSIGNED_INT8_VEC3_NV',
+'GL_UNSIGNED_INT8_VEC4_NV', 'GL_UNSIGNED_INT16_NV',
+'GL_UNSIGNED_INT16_VEC2_NV', 'GL_UNSIGNED_INT16_VEC3_NV',
+'GL_UNSIGNED_INT16_VEC4_NV', 'GL_UNSIGNED_INT64_VEC2_NV',
+'GL_UNSIGNED_INT64_VEC3_NV', 'GL_UNSIGNED_INT64_VEC4_NV', 'GL_FLOAT16_NV',
+'GL_FLOAT16_VEC2_NV', 'GL_FLOAT16_VEC3_NV', 'GL_FLOAT16_VEC4_NV',
+'GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV', 'GL_MAX_PROGRAM_PATCH_ATTRIBS_NV',
+'GL_TESS_CONTROL_PROGRAM_NV', 'GL_TESS_EVALUATION_PROGRAM_NV',
+'GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV',
+'GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV', 'GL_COVERAGE_SAMPLES_NV',
+'GL_COLOR_SAMPLES_NV', 'GL_DATA_BUFFER_AMD', 'GL_PERFORMANCE_MONITOR_AMD',
+'GL_QUERY_OBJECT_AMD', 'GL_VERTEX_ARRAY_OBJECT_AMD', 'GL_SAMPLER_OBJECT_AMD',
+'GL_MAX_DEBUG_LOGGED_MESSAGES_AMD', 'GL_DEBUG_LOGGED_MESSAGES_AMD',
+'GL_DEBUG_SEVERITY_HIGH_AMD', 'GL_DEBUG_SEVERITY_MEDIUM_AMD',
+'GL_DEBUG_SEVERITY_LOW_AMD', 'GL_DEBUG_CATEGORY_API_ERROR_AMD',
+'GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD', 'GL_DEBUG_CATEGORY_DEPRECATION_AMD',
+'GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD',
+'GL_DEBUG_CATEGORY_PERFORMANCE_AMD', 'GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD',
+'GL_DEBUG_CATEGORY_APPLICATION_AMD', 'GL_DEBUG_CATEGORY_OTHER_AMD',
+'GL_SURFACE_STATE_NV', 'GL_SURFACE_REGISTERED_NV', 'GL_SURFACE_MAPPED_NV',
+'GL_WRITE_DISCARD_NV', 'GL_DEPTH_CLAMP_NEAR_AMD', 'GL_DEPTH_CLAMP_FAR_AMD',
+'GL_TEXTURE_SRGB_DECODE_EXT', 'GL_DECODE_EXT', 'GL_SKIP_DECODE_EXT',
+'GL_TEXTURE_COVERAGE_SAMPLES_NV', 'GL_TEXTURE_COLOR_SAMPLES_NV',
+'GL_FACTOR_MIN_AMD', 'GL_FACTOR_MAX_AMD', 'GL_SUBSAMPLE_DISTANCE_AMD',
+'GL_SYNC_X11_FENCE_EXT', 'GL_SCALED_RESOLVE_FASTEST_EXT',
+'GL_SCALED_RESOLVE_NICEST_EXT', 'GL_PATH_FORMAT_SVG_NV',
+'GL_PATH_FORMAT_PS_NV', 'GL_STANDARD_FONT_NAME_NV', 'GL_SYSTEM_FONT_NAME_NV',
+'GL_FILE_NAME_NV', 'GL_PATH_STROKE_WIDTH_NV', 'GL_PATH_END_CAPS_NV',
+'GL_PATH_INITIAL_END_CAP_NV', 'GL_PATH_TERMINAL_END_CAP_NV',
+'GL_PATH_JOIN_STYLE_NV', 'GL_PATH_MITER_LIMIT_NV', 'GL_PATH_DASH_CAPS_NV',
+'GL_PATH_INITIAL_DASH_CAP_NV', 'GL_PATH_TERMINAL_DASH_CAP_NV',
+'GL_PATH_DASH_OFFSET_NV', 'GL_PATH_CLIENT_LENGTH_NV', 'GL_PATH_FILL_MODE_NV',
+'GL_PATH_FILL_MASK_NV', 'GL_PATH_FILL_COVER_MODE_NV',
+'GL_PATH_STROKE_COVER_MODE_NV', 'GL_PATH_STROKE_MASK_NV',
+'GL_PATH_SAMPLE_QUALITY_NV', 'GL_PATH_STROKE_BOUND_NV',
+'GL_PATH_STROKE_OVERSAMPLE_COUNT_NV', 'GL_COUNT_UP_NV', 'GL_COUNT_DOWN_NV',
+'GL_PATH_OBJECT_BOUNDING_BOX_NV', 'GL_CONVEX_HULL_NV', 'GL_MULTI_HULLS_NV',
+'GL_BOUNDING_BOX_NV', 'GL_TRANSLATE_X_NV', 'GL_TRANSLATE_Y_NV',
+'GL_TRANSLATE_2D_NV', 'GL_TRANSLATE_3D_NV', 'GL_AFFINE_2D_NV',
+'GL_PROJECTIVE_2D_NV', 'GL_AFFINE_3D_NV', 'GL_PROJECTIVE_3D_NV',
+'GL_TRANSPOSE_AFFINE_2D_NV', 'GL_TRANSPOSE_PROJECTIVE_2D_NV',
+'GL_TRANSPOSE_AFFINE_3D_NV', 'GL_TRANSPOSE_PROJECTIVE_3D_NV', 'GL_UTF8_NV',
+'GL_UTF16_NV', 'GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV',
+'GL_PATH_COMMAND_COUNT_NV', 'GL_PATH_COORD_COUNT_NV',
+'GL_PATH_DASH_ARRAY_COUNT_NV', 'GL_PATH_COMPUTED_LENGTH_NV',
+'GL_PATH_FILL_BOUNDING_BOX_NV', 'GL_PATH_STROKE_BOUNDING_BOX_NV',
+'GL_SQUARE_NV', 'GL_ROUND_NV', 'GL_TRIANGULAR_NV', 'GL_BEVEL_NV',
+'GL_MITER_REVERT_NV', 'GL_MITER_TRUNCATE_NV', 'GL_SKIP_MISSING_GLYPH_NV',
+'GL_USE_MISSING_GLYPH_NV', 'GL_PATH_ERROR_POSITION_NV',
+'GL_PATH_FOG_GEN_MODE_NV', 'GL_ACCUM_ADJACENT_PAIRS_NV',
+'GL_ADJACENT_PAIRS_NV', 'GL_FIRST_TO_REST_NV', 'GL_PATH_GEN_MODE_NV',
+'GL_PATH_GEN_COEFF_NV', 'GL_PATH_GEN_COLOR_FORMAT_NV',
+'GL_PATH_GEN_COMPONENTS_NV', 'GL_PATH_STENCIL_FUNC_NV',
+'GL_PATH_STENCIL_REF_NV', 'GL_PATH_STENCIL_VALUE_MASK_NV',
+'GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV',
+'GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV', 'GL_PATH_COVER_DEPTH_FUNC_NV',
+'GL_PATH_DASH_OFFSET_RESET_NV', 'GL_MOVE_TO_RESETS_NV',
+'GL_MOVE_TO_CONTINUES_NV', 'GL_CLOSE_PATH_NV', 'GL_MOVE_TO_NV',
+'GL_RELATIVE_MOVE_TO_NV', 'GL_LINE_TO_NV', 'GL_RELATIVE_LINE_TO_NV',
+'GL_HORIZONTAL_LINE_TO_NV', 'GL_RELATIVE_HORIZONTAL_LINE_TO_NV',
+'GL_VERTICAL_LINE_TO_NV', 'GL_RELATIVE_VERTICAL_LINE_TO_NV',
+'GL_QUADRATIC_CURVE_TO_NV', 'GL_RELATIVE_QUADRATIC_CURVE_TO_NV',
+'GL_CUBIC_CURVE_TO_NV', 'GL_RELATIVE_CUBIC_CURVE_TO_NV',
+'GL_SMOOTH_QUADRATIC_CURVE_TO_NV', 'GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV',
+'GL_SMOOTH_CUBIC_CURVE_TO_NV', 'GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV',
+'GL_SMALL_CCW_ARC_TO_NV', 'GL_RELATIVE_SMALL_CCW_ARC_TO_NV',
+'GL_SMALL_CW_ARC_TO_NV', 'GL_RELATIVE_SMALL_CW_ARC_TO_NV',
+'GL_LARGE_CCW_ARC_TO_NV', 'GL_RELATIVE_LARGE_CCW_ARC_TO_NV',
+'GL_LARGE_CW_ARC_TO_NV', 'GL_RELATIVE_LARGE_CW_ARC_TO_NV',
+'GL_RESTART_PATH_NV', 'GL_DUP_FIRST_CUBIC_CURVE_TO_NV',
+'GL_DUP_LAST_CUBIC_CURVE_TO_NV', 'GL_RECT_NV', 'GL_CIRCULAR_CCW_ARC_TO_NV',
+'GL_CIRCULAR_CW_ARC_TO_NV', 'GL_CIRCULAR_TANGENT_ARC_TO_NV', 'GL_ARC_TO_NV',
+'GL_RELATIVE_ARC_TO_NV', 'GL_BOLD_BIT_NV', 'GL_ITALIC_BIT_NV',
+'GL_GLYPH_WIDTH_BIT_NV', 'GL_GLYPH_HEIGHT_BIT_NV',
+'GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV',
+'GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV',
+'GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV',
+'GL_GLYPH_VERTICAL_BEARING_X_BIT_NV', 'GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV',
+'GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV', 'GL_GLYPH_HAS_KERNING_NV',
+'GL_FONT_X_MIN_BOUNDS_NV', 'GL_FONT_Y_MIN_BOUNDS_NV',
+'GL_FONT_X_MAX_BOUNDS_NV', 'GL_FONT_Y_MAX_BOUNDS_NV',
+'GL_FONT_UNITS_PER_EM_NV', 'GL_FONT_ASCENDER_NV', 'GL_FONT_DESCENDER_NV',
+'GL_FONT_HEIGHT_NV', 'GL_FONT_MAX_ADVANCE_WIDTH_NV',
+'GL_FONT_MAX_ADVANCE_HEIGHT_NV', 'GL_FONT_UNDERLINE_POSITION_NV',
+'GL_FONT_UNDERLINE_THICKNESS_NV', 'GL_FONT_HAS_KERNING_NV',
+'GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD', 'GL_SET_AMD', 'GL_REPLACE_VALUE_AMD',
+'GL_STENCIL_OP_VALUE_AMD', 'GL_STENCIL_BACK_OP_VALUE_AMD',
+'GL_QUERY_BUFFER_AMD', 'GL_QUERY_BUFFER_BINDING_AMD',
+'GL_QUERY_RESULT_NO_WAIT_AMD', 'GLchar', 'GLintptr', 'GLsizeiptr',
+'GLintptrARB', 'GLsizeiptrARB', 'GLcharARB', 'GLhandleARB', 'GLhalfARB',
+'GLhalfNV', 'GLint64EXT', 'GLuint64EXT', 'GLint64', 'GLuint64', 'GLsync',
+'GLDEBUGPROCARB', 'GLDEBUGPROCAMD', 'GLvdpauSurfaceNV',
+'GL_VERSION_1_2_DEPRECATED', 'glColorTable', 'glColorTableParameterfv',
+'glColorTableParameteriv', 'glCopyColorTable', 'glGetColorTable',
+'glGetColorTableParameterfv', 'glGetColorTableParameteriv', 'glColorSubTable',
+'glCopyColorSubTable', 'glConvolutionFilter1D', 'glConvolutionFilter2D',
+'glConvolutionParameterf', 'glConvolutionParameterfv',
+'glConvolutionParameteri', 'glConvolutionParameteriv',
+'glCopyConvolutionFilter1D', 'glCopyConvolutionFilter2D',
+'glGetConvolutionFilter', 'glGetConvolutionParameterfv',
+'glGetConvolutionParameteriv', 'glGetSeparableFilter', 'glSeparableFilter2D',
+'glGetHistogram', 'glGetHistogramParameterfv', 'glGetHistogramParameteriv',
+'glGetMinmax', 'glGetMinmaxParameterfv', 'glGetMinmaxParameteriv',
+'glHistogram', 'glMinmax', 'glResetHistogram', 'glResetMinmax',
+'PFNGLCOLORTABLEPROC', 'PFNGLCOLORTABLEPARAMETERFVPROC',
+'PFNGLCOLORTABLEPARAMETERIVPROC', 'PFNGLCOPYCOLORTABLEPROC',
+'PFNGLGETCOLORTABLEPROC', 'PFNGLGETCOLORTABLEPARAMETERFVPROC',
+'PFNGLGETCOLORTABLEPARAMETERIVPROC', 'PFNGLCOLORSUBTABLEPROC',
+'PFNGLCOPYCOLORSUBTABLEPROC', 'PFNGLCONVOLUTIONFILTER1DPROC',
+'PFNGLCONVOLUTIONFILTER2DPROC', 'PFNGLCONVOLUTIONPARAMETERFPROC',
+'PFNGLCONVOLUTIONPARAMETERFVPROC', 'PFNGLCONVOLUTIONPARAMETERIPROC',
+'PFNGLCONVOLUTIONPARAMETERIVPROC', 'PFNGLCOPYCONVOLUTIONFILTER1DPROC',
+'PFNGLCOPYCONVOLUTIONFILTER2DPROC', 'PFNGLGETCONVOLUTIONFILTERPROC',
+'PFNGLGETCONVOLUTIONPARAMETERFVPROC', 'PFNGLGETCONVOLUTIONPARAMETERIVPROC',
+'PFNGLGETSEPARABLEFILTERPROC', 'PFNGLSEPARABLEFILTER2DPROC',
+'PFNGLGETHISTOGRAMPROC', 'PFNGLGETHISTOGRAMPARAMETERFVPROC',
+'PFNGLGETHISTOGRAMPARAMETERIVPROC', 'PFNGLGETMINMAXPROC',
+'PFNGLGETMINMAXPARAMETERFVPROC', 'PFNGLGETMINMAXPARAMETERIVPROC',
+'PFNGLHISTOGRAMPROC', 'PFNGLMINMAXPROC', 'PFNGLRESETHISTOGRAMPROC',
+'PFNGLRESETMINMAXPROC', 'GL_VERSION_1_3_DEPRECATED', 'glClientActiveTexture',
+'glMultiTexCoord1d', 'glMultiTexCoord1dv', 'glMultiTexCoord1f',
+'glMultiTexCoord1fv', 'glMultiTexCoord1i', 'glMultiTexCoord1iv',
+'glMultiTexCoord1s', 'glMultiTexCoord1sv', 'glMultiTexCoord2d',
+'glMultiTexCoord2dv', 'glMultiTexCoord2f', 'glMultiTexCoord2fv',
+'glMultiTexCoord2i', 'glMultiTexCoord2iv', 'glMultiTexCoord2s',
+'glMultiTexCoord2sv', 'glMultiTexCoord3d', 'glMultiTexCoord3dv',
+'glMultiTexCoord3f', 'glMultiTexCoord3fv', 'glMultiTexCoord3i',
+'glMultiTexCoord3iv', 'glMultiTexCoord3s', 'glMultiTexCoord3sv',
+'glMultiTexCoord4d', 'glMultiTexCoord4dv', 'glMultiTexCoord4f',
+'glMultiTexCoord4fv', 'glMultiTexCoord4i', 'glMultiTexCoord4iv',
+'glMultiTexCoord4s', 'glMultiTexCoord4sv', 'glLoadTransposeMatrixf',
+'glLoadTransposeMatrixd', 'glMultTransposeMatrixf', 'glMultTransposeMatrixd',
+'PFNGLCLIENTACTIVETEXTUREPROC', 'PFNGLMULTITEXCOORD1DPROC',
+'PFNGLMULTITEXCOORD1DVPROC', 'PFNGLMULTITEXCOORD1FPROC',
+'PFNGLMULTITEXCOORD1FVPROC', 'PFNGLMULTITEXCOORD1IPROC',
+'PFNGLMULTITEXCOORD1IVPROC', 'PFNGLMULTITEXCOORD1SPROC',
+'PFNGLMULTITEXCOORD1SVPROC', 'PFNGLMULTITEXCOORD2DPROC',
+'PFNGLMULTITEXCOORD2DVPROC', 'PFNGLMULTITEXCOORD2FPROC',
+'PFNGLMULTITEXCOORD2FVPROC', 'PFNGLMULTITEXCOORD2IPROC',
+'PFNGLMULTITEXCOORD2IVPROC', 'PFNGLMULTITEXCOORD2SPROC',
+'PFNGLMULTITEXCOORD2SVPROC', 'PFNGLMULTITEXCOORD3DPROC',
+'PFNGLMULTITEXCOORD3DVPROC', 'PFNGLMULTITEXCOORD3FPROC',
+'PFNGLMULTITEXCOORD3FVPROC', 'PFNGLMULTITEXCOORD3IPROC',
+'PFNGLMULTITEXCOORD3IVPROC', 'PFNGLMULTITEXCOORD3SPROC',
+'PFNGLMULTITEXCOORD3SVPROC', 'PFNGLMULTITEXCOORD4DPROC',
+'PFNGLMULTITEXCOORD4DVPROC', 'PFNGLMULTITEXCOORD4FPROC',
+'PFNGLMULTITEXCOORD4FVPROC', 'PFNGLMULTITEXCOORD4IPROC',
+'PFNGLMULTITEXCOORD4IVPROC', 'PFNGLMULTITEXCOORD4SPROC',
+'PFNGLMULTITEXCOORD4SVPROC', 'PFNGLLOADTRANSPOSEMATRIXFPROC',
+'PFNGLLOADTRANSPOSEMATRIXDPROC', 'PFNGLMULTTRANSPOSEMATRIXFPROC',
+'PFNGLMULTTRANSPOSEMATRIXDPROC', 'GL_VERSION_1_4', 'glBlendFuncSeparate',
+'glMultiDrawArrays', 'glMultiDrawElements', 'glPointParameterf',
+'glPointParameterfv', 'glPointParameteri', 'glPointParameteriv',
+'PFNGLBLENDFUNCSEPARATEPROC', 'PFNGLMULTIDRAWARRAYSPROC',
+'PFNGLMULTIDRAWELEMENTSPROC', 'PFNGLPOINTPARAMETERFPROC',
+'PFNGLPOINTPARAMETERFVPROC', 'PFNGLPOINTPARAMETERIPROC',
+'PFNGLPOINTPARAMETERIVPROC', 'GL_VERSION_1_4_DEPRECATED', 'glFogCoordf',
+'glFogCoordfv', 'glFogCoordd', 'glFogCoorddv', 'glFogCoordPointer',
+'glSecondaryColor3b', 'glSecondaryColor3bv', 'glSecondaryColor3d',
+'glSecondaryColor3dv', 'glSecondaryColor3f', 'glSecondaryColor3fv',
+'glSecondaryColor3i', 'glSecondaryColor3iv', 'glSecondaryColor3s',
+'glSecondaryColor3sv', 'glSecondaryColor3ub', 'glSecondaryColor3ubv',
+'glSecondaryColor3ui', 'glSecondaryColor3uiv', 'glSecondaryColor3us',
+'glSecondaryColor3usv', 'glSecondaryColorPointer', 'glWindowPos2d',
+'glWindowPos2dv', 'glWindowPos2f', 'glWindowPos2fv', 'glWindowPos2i',
+'glWindowPos2iv', 'glWindowPos2s', 'glWindowPos2sv', 'glWindowPos3d',
+'glWindowPos3dv', 'glWindowPos3f', 'glWindowPos3fv', 'glWindowPos3i',
+'glWindowPos3iv', 'glWindowPos3s', 'glWindowPos3sv', 'PFNGLFOGCOORDFPROC',
+'PFNGLFOGCOORDFVPROC', 'PFNGLFOGCOORDDPROC', 'PFNGLFOGCOORDDVPROC',
+'PFNGLFOGCOORDPOINTERPROC', 'PFNGLSECONDARYCOLOR3BPROC',
+'PFNGLSECONDARYCOLOR3BVPROC', 'PFNGLSECONDARYCOLOR3DPROC',
+'PFNGLSECONDARYCOLOR3DVPROC', 'PFNGLSECONDARYCOLOR3FPROC',
+'PFNGLSECONDARYCOLOR3FVPROC', 'PFNGLSECONDARYCOLOR3IPROC',
+'PFNGLSECONDARYCOLOR3IVPROC', 'PFNGLSECONDARYCOLOR3SPROC',
+'PFNGLSECONDARYCOLOR3SVPROC', 'PFNGLSECONDARYCOLOR3UBPROC',
+'PFNGLSECONDARYCOLOR3UBVPROC', 'PFNGLSECONDARYCOLOR3UIPROC',
+'PFNGLSECONDARYCOLOR3UIVPROC', 'PFNGLSECONDARYCOLOR3USPROC',
+'PFNGLSECONDARYCOLOR3USVPROC', 'PFNGLSECONDARYCOLORPOINTERPROC',
+'PFNGLWINDOWPOS2DPROC', 'PFNGLWINDOWPOS2DVPROC', 'PFNGLWINDOWPOS2FPROC',
+'PFNGLWINDOWPOS2FVPROC', 'PFNGLWINDOWPOS2IPROC', 'PFNGLWINDOWPOS2IVPROC',
+'PFNGLWINDOWPOS2SPROC', 'PFNGLWINDOWPOS2SVPROC', 'PFNGLWINDOWPOS3DPROC',
+'PFNGLWINDOWPOS3DVPROC', 'PFNGLWINDOWPOS3FPROC', 'PFNGLWINDOWPOS3FVPROC',
+'PFNGLWINDOWPOS3IPROC', 'PFNGLWINDOWPOS3IVPROC', 'PFNGLWINDOWPOS3SPROC',
+'PFNGLWINDOWPOS3SVPROC', 'GL_VERSION_1_5', 'glGenQueries', 'glDeleteQueries',
+'glIsQuery', 'glBeginQuery', 'glEndQuery', 'glGetQueryiv',
+'glGetQueryObjectiv', 'glGetQueryObjectuiv', 'glBindBuffer',
+'glDeleteBuffers', 'glGenBuffers', 'glIsBuffer', 'glBufferData',
+'glBufferSubData', 'glGetBufferSubData', 'glMapBuffer', 'glUnmapBuffer',
+'glGetBufferParameteriv', 'glGetBufferPointerv', 'PFNGLGENQUERIESPROC',
+'PFNGLDELETEQUERIESPROC', 'PFNGLISQUERYPROC', 'PFNGLBEGINQUERYPROC',
+'PFNGLENDQUERYPROC', 'PFNGLGETQUERYIVPROC', 'PFNGLGETQUERYOBJECTIVPROC',
+'PFNGLGETQUERYOBJECTUIVPROC', 'PFNGLBINDBUFFERPROC', 'PFNGLDELETEBUFFERSPROC',
+'PFNGLGENBUFFERSPROC', 'PFNGLISBUFFERPROC', 'PFNGLBUFFERDATAPROC',
+'PFNGLBUFFERSUBDATAPROC', 'PFNGLGETBUFFERSUBDATAPROC', 'PFNGLMAPBUFFERPROC',
+'PFNGLUNMAPBUFFERPROC', 'PFNGLGETBUFFERPARAMETERIVPROC',
+'PFNGLGETBUFFERPOINTERVPROC', 'GL_VERSION_2_0', 'glBlendEquationSeparate',
+'glDrawBuffers', 'glStencilOpSeparate', 'glStencilFuncSeparate',
+'glStencilMaskSeparate', 'glAttachShader', 'glBindAttribLocation',
+'glCompileShader', 'glCreateProgram', 'glCreateShader', 'glDeleteProgram',
+'glDeleteShader', 'glDetachShader', 'glDisableVertexAttribArray',
+'glEnableVertexAttribArray', 'glGetActiveAttrib', 'glGetActiveUniform',
+'glGetAttachedShaders', 'glGetAttribLocation', 'glGetProgramiv',
+'glGetProgramInfoLog', 'glGetShaderiv', 'glGetShaderInfoLog',
+'glGetShaderSource', 'glGetUniformLocation', 'glGetUniformfv',
+'glGetUniformiv', 'glGetVertexAttribdv', 'glGetVertexAttribfv',
+'glGetVertexAttribiv', 'glGetVertexAttribPointerv', 'glIsProgram',
+'glIsShader', 'glLinkProgram', 'glShaderSource', 'glUseProgram',
+'glUniform1f', 'glUniform2f', 'glUniform3f', 'glUniform4f', 'glUniform1i',
+'glUniform2i', 'glUniform3i', 'glUniform4i', 'glUniform1fv', 'glUniform2fv',
+'glUniform3fv', 'glUniform4fv', 'glUniform1iv', 'glUniform2iv',
+'glUniform3iv', 'glUniform4iv', 'glUniformMatrix2fv', 'glUniformMatrix3fv',
+'glUniformMatrix4fv', 'glValidateProgram', 'glVertexAttrib1d',
+'glVertexAttrib1dv', 'glVertexAttrib1f', 'glVertexAttrib1fv',
+'glVertexAttrib1s', 'glVertexAttrib1sv', 'glVertexAttrib2d',
+'glVertexAttrib2dv', 'glVertexAttrib2f', 'glVertexAttrib2fv',
+'glVertexAttrib2s', 'glVertexAttrib2sv', 'glVertexAttrib3d',
+'glVertexAttrib3dv', 'glVertexAttrib3f', 'glVertexAttrib3fv',
+'glVertexAttrib3s', 'glVertexAttrib3sv', 'glVertexAttrib4Nbv',
+'glVertexAttrib4Niv', 'glVertexAttrib4Nsv', 'glVertexAttrib4Nub',
+'glVertexAttrib4Nubv', 'glVertexAttrib4Nuiv', 'glVertexAttrib4Nusv',
+'glVertexAttrib4bv', 'glVertexAttrib4d', 'glVertexAttrib4dv',
+'glVertexAttrib4f', 'glVertexAttrib4fv', 'glVertexAttrib4iv',
+'glVertexAttrib4s', 'glVertexAttrib4sv', 'glVertexAttrib4ubv',
+'glVertexAttrib4uiv', 'glVertexAttrib4usv', 'glVertexAttribPointer',
+'PFNGLBLENDEQUATIONSEPARATEPROC', 'PFNGLDRAWBUFFERSPROC',
+'PFNGLSTENCILOPSEPARATEPROC', 'PFNGLSTENCILFUNCSEPARATEPROC',
+'PFNGLSTENCILMASKSEPARATEPROC', 'PFNGLATTACHSHADERPROC',
+'PFNGLBINDATTRIBLOCATIONPROC', 'PFNGLCOMPILESHADERPROC',
+'PFNGLCREATEPROGRAMPROC', 'PFNGLCREATESHADERPROC', 'PFNGLDELETEPROGRAMPROC',
+'PFNGLDELETESHADERPROC', 'PFNGLDETACHSHADERPROC',
+'PFNGLDISABLEVERTEXATTRIBARRAYPROC', 'PFNGLENABLEVERTEXATTRIBARRAYPROC',
+'PFNGLGETACTIVEATTRIBPROC', 'PFNGLGETACTIVEUNIFORMPROC',
+'PFNGLGETATTACHEDSHADERSPROC', 'PFNGLGETATTRIBLOCATIONPROC',
+'PFNGLGETPROGRAMIVPROC', 'PFNGLGETPROGRAMINFOLOGPROC', 'PFNGLGETSHADERIVPROC',
+'PFNGLGETSHADERINFOLOGPROC', 'PFNGLGETSHADERSOURCEPROC',
+'PFNGLGETUNIFORMLOCATIONPROC', 'PFNGLGETUNIFORMFVPROC',
+'PFNGLGETUNIFORMIVPROC', 'PFNGLGETVERTEXATTRIBDVPROC',
+'PFNGLGETVERTEXATTRIBFVPROC', 'PFNGLGETVERTEXATTRIBIVPROC',
+'PFNGLGETVERTEXATTRIBPOINTERVPROC', 'PFNGLISPROGRAMPROC', 'PFNGLISSHADERPROC',
+'PFNGLLINKPROGRAMPROC', 'PFNGLSHADERSOURCEPROC', 'PFNGLUSEPROGRAMPROC',
+'PFNGLUNIFORM1FPROC', 'PFNGLUNIFORM2FPROC', 'PFNGLUNIFORM3FPROC',
+'PFNGLUNIFORM4FPROC', 'PFNGLUNIFORM1IPROC', 'PFNGLUNIFORM2IPROC',
+'PFNGLUNIFORM3IPROC', 'PFNGLUNIFORM4IPROC', 'PFNGLUNIFORM1FVPROC',
+'PFNGLUNIFORM2FVPROC', 'PFNGLUNIFORM3FVPROC', 'PFNGLUNIFORM4FVPROC',
+'PFNGLUNIFORM1IVPROC', 'PFNGLUNIFORM2IVPROC', 'PFNGLUNIFORM3IVPROC',
+'PFNGLUNIFORM4IVPROC', 'PFNGLUNIFORMMATRIX2FVPROC',
+'PFNGLUNIFORMMATRIX3FVPROC', 'PFNGLUNIFORMMATRIX4FVPROC',
+'PFNGLVALIDATEPROGRAMPROC', 'PFNGLVERTEXATTRIB1DPROC',
+'PFNGLVERTEXATTRIB1DVPROC', 'PFNGLVERTEXATTRIB1FPROC',
+'PFNGLVERTEXATTRIB1FVPROC', 'PFNGLVERTEXATTRIB1SPROC',
+'PFNGLVERTEXATTRIB1SVPROC', 'PFNGLVERTEXATTRIB2DPROC',
+'PFNGLVERTEXATTRIB2DVPROC', 'PFNGLVERTEXATTRIB2FPROC',
+'PFNGLVERTEXATTRIB2FVPROC', 'PFNGLVERTEXATTRIB2SPROC',
+'PFNGLVERTEXATTRIB2SVPROC', 'PFNGLVERTEXATTRIB3DPROC',
+'PFNGLVERTEXATTRIB3DVPROC', 'PFNGLVERTEXATTRIB3FPROC',
+'PFNGLVERTEXATTRIB3FVPROC', 'PFNGLVERTEXATTRIB3SPROC',
+'PFNGLVERTEXATTRIB3SVPROC', 'PFNGLVERTEXATTRIB4NBVPROC',
+'PFNGLVERTEXATTRIB4NIVPROC', 'PFNGLVERTEXATTRIB4NSVPROC',
+'PFNGLVERTEXATTRIB4NUBPROC', 'PFNGLVERTEXATTRIB4NUBVPROC',
+'PFNGLVERTEXATTRIB4NUIVPROC', 'PFNGLVERTEXATTRIB4NUSVPROC',
+'PFNGLVERTEXATTRIB4BVPROC', 'PFNGLVERTEXATTRIB4DPROC',
+'PFNGLVERTEXATTRIB4DVPROC', 'PFNGLVERTEXATTRIB4FPROC',
+'PFNGLVERTEXATTRIB4FVPROC', 'PFNGLVERTEXATTRIB4IVPROC',
+'PFNGLVERTEXATTRIB4SPROC', 'PFNGLVERTEXATTRIB4SVPROC',
+'PFNGLVERTEXATTRIB4UBVPROC', 'PFNGLVERTEXATTRIB4UIVPROC',
+'PFNGLVERTEXATTRIB4USVPROC', 'PFNGLVERTEXATTRIBPOINTERPROC', 'GL_VERSION_2_1',
+'glUniformMatrix2x3fv', 'glUniformMatrix3x2fv', 'glUniformMatrix2x4fv',
+'glUniformMatrix4x2fv', 'glUniformMatrix3x4fv', 'glUniformMatrix4x3fv',
+'PFNGLUNIFORMMATRIX2X3FVPROC', 'PFNGLUNIFORMMATRIX3X2FVPROC',
+'PFNGLUNIFORMMATRIX2X4FVPROC', 'PFNGLUNIFORMMATRIX4X2FVPROC',
+'PFNGLUNIFORMMATRIX3X4FVPROC', 'PFNGLUNIFORMMATRIX4X3FVPROC',
+'GL_VERSION_3_0', 'glColorMaski', 'glGetBooleani_v', 'glGetIntegeri_v',
+'glEnablei', 'glDisablei', 'glIsEnabledi', 'glBeginTransformFeedback',
+'glEndTransformFeedback', 'glBindBufferRange', 'glBindBufferBase',
+'glTransformFeedbackVaryings', 'glGetTransformFeedbackVarying',
+'glClampColor', 'glBeginConditionalRender', 'glEndConditionalRender',
+'glVertexAttribIPointer', 'glGetVertexAttribIiv', 'glGetVertexAttribIuiv',
+'glVertexAttribI1i', 'glVertexAttribI2i', 'glVertexAttribI3i',
+'glVertexAttribI4i', 'glVertexAttribI1ui', 'glVertexAttribI2ui',
+'glVertexAttribI3ui', 'glVertexAttribI4ui', 'glVertexAttribI1iv',
+'glVertexAttribI2iv', 'glVertexAttribI3iv', 'glVertexAttribI4iv',
+'glVertexAttribI1uiv', 'glVertexAttribI2uiv', 'glVertexAttribI3uiv',
+'glVertexAttribI4uiv', 'glVertexAttribI4bv', 'glVertexAttribI4sv',
+'glVertexAttribI4ubv', 'glVertexAttribI4usv', 'glGetUniformuiv',
+'glBindFragDataLocation', 'glGetFragDataLocation', 'glUniform1ui',
+'glUniform2ui', 'glUniform3ui', 'glUniform4ui', 'glUniform1uiv',
+'glUniform2uiv', 'glUniform3uiv', 'glUniform4uiv', 'glTexParameterIiv',
+'glTexParameterIuiv', 'glGetTexParameterIiv', 'glGetTexParameterIuiv',
+'glClearBufferiv', 'glClearBufferuiv', 'glClearBufferfv', 'glClearBufferfi',
+'glGetStringi', 'PFNGLCOLORMASKIPROC', 'PFNGLGETBOOLEANI_VPROC',
+'PFNGLGETINTEGERI_VPROC', 'PFNGLENABLEIPROC', 'PFNGLDISABLEIPROC',
+'PFNGLISENABLEDIPROC', 'PFNGLBEGINTRANSFORMFEEDBACKPROC',
+'PFNGLENDTRANSFORMFEEDBACKPROC', 'PFNGLBINDBUFFERRANGEPROC',
+'PFNGLBINDBUFFERBASEPROC', 'PFNGLTRANSFORMFEEDBACKVARYINGSPROC',
+'PFNGLGETTRANSFORMFEEDBACKVARYINGPROC', 'PFNGLCLAMPCOLORPROC',
+'PFNGLBEGINCONDITIONALRENDERPROC', 'PFNGLENDCONDITIONALRENDERPROC',
+'PFNGLVERTEXATTRIBIPOINTERPROC', 'PFNGLGETVERTEXATTRIBIIVPROC',
+'PFNGLGETVERTEXATTRIBIUIVPROC', 'PFNGLVERTEXATTRIBI1IPROC',
+'PFNGLVERTEXATTRIBI2IPROC', 'PFNGLVERTEXATTRIBI3IPROC',
+'PFNGLVERTEXATTRIBI4IPROC', 'PFNGLVERTEXATTRIBI1UIPROC',
+'PFNGLVERTEXATTRIBI2UIPROC', 'PFNGLVERTEXATTRIBI3UIPROC',
+'PFNGLVERTEXATTRIBI4UIPROC', 'PFNGLVERTEXATTRIBI1IVPROC',
+'PFNGLVERTEXATTRIBI2IVPROC', 'PFNGLVERTEXATTRIBI3IVPROC',
+'PFNGLVERTEXATTRIBI4IVPROC', 'PFNGLVERTEXATTRIBI1UIVPROC',
+'PFNGLVERTEXATTRIBI2UIVPROC', 'PFNGLVERTEXATTRIBI3UIVPROC',
+'PFNGLVERTEXATTRIBI4UIVPROC', 'PFNGLVERTEXATTRIBI4BVPROC',
+'PFNGLVERTEXATTRIBI4SVPROC', 'PFNGLVERTEXATTRIBI4UBVPROC',
+'PFNGLVERTEXATTRIBI4USVPROC', 'PFNGLGETUNIFORMUIVPROC',
+'PFNGLBINDFRAGDATALOCATIONPROC', 'PFNGLGETFRAGDATALOCATIONPROC',
+'PFNGLUNIFORM1UIPROC', 'PFNGLUNIFORM2UIPROC', 'PFNGLUNIFORM3UIPROC',
+'PFNGLUNIFORM4UIPROC', 'PFNGLUNIFORM1UIVPROC', 'PFNGLUNIFORM2UIVPROC',
+'PFNGLUNIFORM3UIVPROC', 'PFNGLUNIFORM4UIVPROC', 'PFNGLTEXPARAMETERIIVPROC',
+'PFNGLTEXPARAMETERIUIVPROC', 'PFNGLGETTEXPARAMETERIIVPROC',
+'PFNGLGETTEXPARAMETERIUIVPROC', 'PFNGLCLEARBUFFERIVPROC',
+'PFNGLCLEARBUFFERUIVPROC', 'PFNGLCLEARBUFFERFVPROC', 'PFNGLCLEARBUFFERFIPROC',
+'PFNGLGETSTRINGIPROC', 'GL_VERSION_3_1', 'glDrawArraysInstanced',
+'glDrawElementsInstanced', 'glTexBuffer', 'glPrimitiveRestartIndex',
+'PFNGLDRAWARRAYSINSTANCEDPROC', 'PFNGLDRAWELEMENTSINSTANCEDPROC',
+'PFNGLTEXBUFFERPROC', 'PFNGLPRIMITIVERESTARTINDEXPROC', 'GL_VERSION_3_2',
+'glGetInteger64i_v', 'glGetBufferParameteri64v', 'glFramebufferTexture',
+'PFNGLGETINTEGER64I_VPROC', 'PFNGLGETBUFFERPARAMETERI64VPROC',
+'PFNGLFRAMEBUFFERTEXTUREPROC', 'GL_VERSION_3_3', 'glVertexAttribDivisor',
+'PFNGLVERTEXATTRIBDIVISORPROC', 'GL_VERSION_4_0', 'glMinSampleShading',
+'glBlendEquationi', 'glBlendEquationSeparatei', 'glBlendFunci',
+'glBlendFuncSeparatei', 'PFNGLMINSAMPLESHADINGPROC',
+'PFNGLBLENDEQUATIONIPROC', 'PFNGLBLENDEQUATIONSEPARATEIPROC',
+'PFNGLBLENDFUNCIPROC', 'PFNGLBLENDFUNCSEPARATEIPROC', 'GL_VERSION_4_1',
+'GL_VERSION_4_2', 'GL_ARB_transpose_matrix', 'glLoadTransposeMatrixfARB',
+'glLoadTransposeMatrixdARB', 'glMultTransposeMatrixfARB',
+'glMultTransposeMatrixdARB', 'PFNGLLOADTRANSPOSEMATRIXFARBPROC',
+'PFNGLLOADTRANSPOSEMATRIXDARBPROC', 'PFNGLMULTTRANSPOSEMATRIXFARBPROC',
+'PFNGLMULTTRANSPOSEMATRIXDARBPROC', 'GL_ARB_multisample',
+'glSampleCoverageARB', 'PFNGLSAMPLECOVERAGEARBPROC', 'GL_ARB_texture_env_add',
+'GL_ARB_texture_cube_map', 'GL_ARB_texture_compression',
+'glCompressedTexImage3DARB', 'glCompressedTexImage2DARB',
+'glCompressedTexImage1DARB', 'glCompressedTexSubImage3DARB',
+'glCompressedTexSubImage2DARB', 'glCompressedTexSubImage1DARB',
+'glGetCompressedTexImageARB', 'PFNGLCOMPRESSEDTEXIMAGE3DARBPROC',
+'PFNGLCOMPRESSEDTEXIMAGE2DARBPROC', 'PFNGLCOMPRESSEDTEXIMAGE1DARBPROC',
+'PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC', 'PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC',
+'PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC', 'PFNGLGETCOMPRESSEDTEXIMAGEARBPROC',
+'GL_ARB_texture_border_clamp', 'GL_ARB_point_parameters',
+'glPointParameterfARB', 'glPointParameterfvARB',
+'PFNGLPOINTPARAMETERFARBPROC', 'PFNGLPOINTPARAMETERFVARBPROC',
+'GL_ARB_vertex_blend', 'glWeightbvARB', 'glWeightsvARB', 'glWeightivARB',
+'glWeightfvARB', 'glWeightdvARB', 'glWeightubvARB', 'glWeightusvARB',
+'glWeightuivARB', 'glWeightPointerARB', 'glVertexBlendARB',
+'PFNGLWEIGHTBVARBPROC', 'PFNGLWEIGHTSVARBPROC', 'PFNGLWEIGHTIVARBPROC',
+'PFNGLWEIGHTFVARBPROC', 'PFNGLWEIGHTDVARBPROC', 'PFNGLWEIGHTUBVARBPROC',
+'PFNGLWEIGHTUSVARBPROC', 'PFNGLWEIGHTUIVARBPROC', 'PFNGLWEIGHTPOINTERARBPROC',
+'PFNGLVERTEXBLENDARBPROC', 'GL_ARB_matrix_palette',
+'glCurrentPaletteMatrixARB', 'glMatrixIndexubvARB', 'glMatrixIndexusvARB',
+'glMatrixIndexuivARB', 'glMatrixIndexPointerARB',
+'PFNGLCURRENTPALETTEMATRIXARBPROC', 'PFNGLMATRIXINDEXUBVARBPROC',
+'PFNGLMATRIXINDEXUSVARBPROC', 'PFNGLMATRIXINDEXUIVARBPROC',
+'PFNGLMATRIXINDEXPOINTERARBPROC', 'GL_ARB_texture_env_combine',
+'GL_ARB_texture_env_crossbar', 'GL_ARB_texture_env_dot3',
+'GL_ARB_texture_mirrored_repeat', 'GL_ARB_depth_texture', 'GL_ARB_shadow',
+'GL_ARB_shadow_ambient', 'GL_ARB_window_pos', 'glWindowPos2dARB',
+'glWindowPos2dvARB', 'glWindowPos2fARB', 'glWindowPos2fvARB',
+'glWindowPos2iARB', 'glWindowPos2ivARB', 'glWindowPos2sARB',
+'glWindowPos2svARB', 'glWindowPos3dARB', 'glWindowPos3dvARB',
+'glWindowPos3fARB', 'glWindowPos3fvARB', 'glWindowPos3iARB',
+'glWindowPos3ivARB', 'glWindowPos3sARB', 'glWindowPos3svARB',
+'PFNGLWINDOWPOS2DARBPROC', 'PFNGLWINDOWPOS2DVARBPROC',
+'PFNGLWINDOWPOS2FARBPROC', 'PFNGLWINDOWPOS2FVARBPROC',
+'PFNGLWINDOWPOS2IARBPROC', 'PFNGLWINDOWPOS2IVARBPROC',
+'PFNGLWINDOWPOS2SARBPROC', 'PFNGLWINDOWPOS2SVARBPROC',
+'PFNGLWINDOWPOS3DARBPROC', 'PFNGLWINDOWPOS3DVARBPROC',
+'PFNGLWINDOWPOS3FARBPROC', 'PFNGLWINDOWPOS3FVARBPROC',
+'PFNGLWINDOWPOS3IARBPROC', 'PFNGLWINDOWPOS3IVARBPROC',
+'PFNGLWINDOWPOS3SARBPROC', 'PFNGLWINDOWPOS3SVARBPROC',
+'GL_ARB_vertex_program', 'glVertexAttrib1dARB', 'glVertexAttrib1dvARB',
+'glVertexAttrib1fARB', 'glVertexAttrib1fvARB', 'glVertexAttrib1sARB',
+'glVertexAttrib1svARB', 'glVertexAttrib2dARB', 'glVertexAttrib2dvARB',
+'glVertexAttrib2fARB', 'glVertexAttrib2fvARB', 'glVertexAttrib2sARB',
+'glVertexAttrib2svARB', 'glVertexAttrib3dARB', 'glVertexAttrib3dvARB',
+'glVertexAttrib3fARB', 'glVertexAttrib3fvARB', 'glVertexAttrib3sARB',
+'glVertexAttrib3svARB', 'glVertexAttrib4NbvARB', 'glVertexAttrib4NivARB',
+'glVertexAttrib4NsvARB', 'glVertexAttrib4NubARB', 'glVertexAttrib4NubvARB',
+'glVertexAttrib4NuivARB', 'glVertexAttrib4NusvARB', 'glVertexAttrib4bvARB',
+'glVertexAttrib4dARB', 'glVertexAttrib4dvARB', 'glVertexAttrib4fARB',
+'glVertexAttrib4fvARB', 'glVertexAttrib4ivARB', 'glVertexAttrib4sARB',
+'glVertexAttrib4svARB', 'glVertexAttrib4ubvARB', 'glVertexAttrib4uivARB',
+'glVertexAttrib4usvARB', 'glVertexAttribPointerARB',
+'glEnableVertexAttribArrayARB', 'glDisableVertexAttribArrayARB',
+'glProgramStringARB', 'glBindProgramARB', 'glDeleteProgramsARB',
+'glGenProgramsARB', 'glProgramEnvParameter4dARB',
+'glProgramEnvParameter4dvARB', 'glProgramEnvParameter4fARB',
+'glProgramEnvParameter4fvARB', 'glProgramLocalParameter4dARB',
+'glProgramLocalParameter4dvARB', 'glProgramLocalParameter4fARB',
+'glProgramLocalParameter4fvARB', 'glGetProgramEnvParameterdvARB',
+'glGetProgramEnvParameterfvARB', 'glGetProgramLocalParameterdvARB',
+'glGetProgramLocalParameterfvARB', 'glGetProgramivARB',
+'glGetProgramStringARB', 'glGetVertexAttribdvARB', 'glGetVertexAttribfvARB',
+'glGetVertexAttribivARB', 'glGetVertexAttribPointervARB', 'glIsProgramARB',
+'PFNGLVERTEXATTRIB1DARBPROC', 'PFNGLVERTEXATTRIB1DVARBPROC',
+'PFNGLVERTEXATTRIB1FARBPROC', 'PFNGLVERTEXATTRIB1FVARBPROC',
+'PFNGLVERTEXATTRIB1SARBPROC', 'PFNGLVERTEXATTRIB1SVARBPROC',
+'PFNGLVERTEXATTRIB2DARBPROC', 'PFNGLVERTEXATTRIB2DVARBPROC',
+'PFNGLVERTEXATTRIB2FARBPROC', 'PFNGLVERTEXATTRIB2FVARBPROC',
+'PFNGLVERTEXATTRIB2SARBPROC', 'PFNGLVERTEXATTRIB2SVARBPROC',
+'PFNGLVERTEXATTRIB3DARBPROC', 'PFNGLVERTEXATTRIB3DVARBPROC',
+'PFNGLVERTEXATTRIB3FARBPROC', 'PFNGLVERTEXATTRIB3FVARBPROC',
+'PFNGLVERTEXATTRIB3SARBPROC', 'PFNGLVERTEXATTRIB3SVARBPROC',
+'PFNGLVERTEXATTRIB4NBVARBPROC', 'PFNGLVERTEXATTRIB4NIVARBPROC',
+'PFNGLVERTEXATTRIB4NSVARBPROC', 'PFNGLVERTEXATTRIB4NUBARBPROC',
+'PFNGLVERTEXATTRIB4NUBVARBPROC', 'PFNGLVERTEXATTRIB4NUIVARBPROC',
+'PFNGLVERTEXATTRIB4NUSVARBPROC', 'PFNGLVERTEXATTRIB4BVARBPROC',
+'PFNGLVERTEXATTRIB4DARBPROC', 'PFNGLVERTEXATTRIB4DVARBPROC',
+'PFNGLVERTEXATTRIB4FARBPROC', 'PFNGLVERTEXATTRIB4FVARBPROC',
+'PFNGLVERTEXATTRIB4IVARBPROC', 'PFNGLVERTEXATTRIB4SARBPROC',
+'PFNGLVERTEXATTRIB4SVARBPROC', 'PFNGLVERTEXATTRIB4UBVARBPROC',
+'PFNGLVERTEXATTRIB4UIVARBPROC', 'PFNGLVERTEXATTRIB4USVARBPROC',
+'PFNGLVERTEXATTRIBPOINTERARBPROC', 'PFNGLENABLEVERTEXATTRIBARRAYARBPROC',
+'PFNGLDISABLEVERTEXATTRIBARRAYARBPROC', 'PFNGLPROGRAMSTRINGARBPROC',
+'PFNGLBINDPROGRAMARBPROC', 'PFNGLDELETEPROGRAMSARBPROC',
+'PFNGLGENPROGRAMSARBPROC', 'PFNGLPROGRAMENVPARAMETER4DARBPROC',
+'PFNGLPROGRAMENVPARAMETER4DVARBPROC', 'PFNGLPROGRAMENVPARAMETER4FARBPROC',
+'PFNGLPROGRAMENVPARAMETER4FVARBPROC', 'PFNGLPROGRAMLOCALPARAMETER4DARBPROC',
+'PFNGLPROGRAMLOCALPARAMETER4DVARBPROC', 'PFNGLPROGRAMLOCALPARAMETER4FARBPROC',
+'PFNGLPROGRAMLOCALPARAMETER4FVARBPROC',
+'PFNGLGETPROGRAMENVPARAMETERDVARBPROC',
+'PFNGLGETPROGRAMENVPARAMETERFVARBPROC',
+'PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC',
+'PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC', 'PFNGLGETPROGRAMIVARBPROC',
+'PFNGLGETPROGRAMSTRINGARBPROC', 'PFNGLGETVERTEXATTRIBDVARBPROC',
+'PFNGLGETVERTEXATTRIBFVARBPROC', 'PFNGLGETVERTEXATTRIBIVARBPROC',
+'PFNGLGETVERTEXATTRIBPOINTERVARBPROC', 'PFNGLISPROGRAMARBPROC',
+'GL_ARB_fragment_program', 'GL_ARB_vertex_buffer_object', 'glBindBufferARB',
+'glDeleteBuffersARB', 'glGenBuffersARB', 'glIsBufferARB', 'glBufferDataARB',
+'glBufferSubDataARB', 'glGetBufferSubDataARB', 'glMapBufferARB',
+'glUnmapBufferARB', 'glGetBufferParameterivARB', 'glGetBufferPointervARB',
+'PFNGLBINDBUFFERARBPROC', 'PFNGLDELETEBUFFERSARBPROC',
+'PFNGLGENBUFFERSARBPROC', 'PFNGLISBUFFERARBPROC', 'PFNGLBUFFERDATAARBPROC',
+'PFNGLBUFFERSUBDATAARBPROC', 'PFNGLGETBUFFERSUBDATAARBPROC',
+'PFNGLMAPBUFFERARBPROC', 'PFNGLUNMAPBUFFERARBPROC',
+'PFNGLGETBUFFERPARAMETERIVARBPROC', 'PFNGLGETBUFFERPOINTERVARBPROC',
+'GL_ARB_occlusion_query', 'glGenQueriesARB', 'glDeleteQueriesARB',
+'glIsQueryARB', 'glBeginQueryARB', 'glEndQueryARB', 'glGetQueryivARB',
+'glGetQueryObjectivARB', 'glGetQueryObjectuivARB', 'PFNGLGENQUERIESARBPROC',
+'PFNGLDELETEQUERIESARBPROC', 'PFNGLISQUERYARBPROC', 'PFNGLBEGINQUERYARBPROC',
+'PFNGLENDQUERYARBPROC', 'PFNGLGETQUERYIVARBPROC',
+'PFNGLGETQUERYOBJECTIVARBPROC', 'PFNGLGETQUERYOBJECTUIVARBPROC',
+'GL_ARB_shader_objects', 'glDeleteObjectARB', 'glGetHandleARB',
+'glDetachObjectARB', 'glCreateShaderObjectARB', 'glShaderSourceARB',
+'glCompileShaderARB', 'glCreateProgramObjectARB', 'glAttachObjectARB',
+'glLinkProgramARB', 'glUseProgramObjectARB', 'glValidateProgramARB',
+'glUniform1fARB', 'glUniform2fARB', 'glUniform3fARB', 'glUniform4fARB',
+'glUniform1iARB', 'glUniform2iARB', 'glUniform3iARB', 'glUniform4iARB',
+'glUniform1fvARB', 'glUniform2fvARB', 'glUniform3fvARB', 'glUniform4fvARB',
+'glUniform1ivARB', 'glUniform2ivARB', 'glUniform3ivARB', 'glUniform4ivARB',
+'glUniformMatrix2fvARB', 'glUniformMatrix3fvARB', 'glUniformMatrix4fvARB',
+'glGetObjectParameterfvARB', 'glGetObjectParameterivARB', 'glGetInfoLogARB',
+'glGetAttachedObjectsARB', 'glGetUniformLocationARB', 'glGetActiveUniformARB',
+'glGetUniformfvARB', 'glGetUniformivARB', 'glGetShaderSourceARB',
+'PFNGLDELETEOBJECTARBPROC', 'PFNGLGETHANDLEARBPROC',
+'PFNGLDETACHOBJECTARBPROC', 'PFNGLCREATESHADEROBJECTARBPROC',
+'PFNGLSHADERSOURCEARBPROC', 'PFNGLCOMPILESHADERARBPROC',
+'PFNGLCREATEPROGRAMOBJECTARBPROC', 'PFNGLATTACHOBJECTARBPROC',
+'PFNGLLINKPROGRAMARBPROC', 'PFNGLUSEPROGRAMOBJECTARBPROC',
+'PFNGLVALIDATEPROGRAMARBPROC', 'PFNGLUNIFORM1FARBPROC',
+'PFNGLUNIFORM2FARBPROC', 'PFNGLUNIFORM3FARBPROC', 'PFNGLUNIFORM4FARBPROC',
+'PFNGLUNIFORM1IARBPROC', 'PFNGLUNIFORM2IARBPROC', 'PFNGLUNIFORM3IARBPROC',
+'PFNGLUNIFORM4IARBPROC', 'PFNGLUNIFORM1FVARBPROC', 'PFNGLUNIFORM2FVARBPROC',
+'PFNGLUNIFORM3FVARBPROC', 'PFNGLUNIFORM4FVARBPROC', 'PFNGLUNIFORM1IVARBPROC',
+'PFNGLUNIFORM2IVARBPROC', 'PFNGLUNIFORM3IVARBPROC', 'PFNGLUNIFORM4IVARBPROC',
+'PFNGLUNIFORMMATRIX2FVARBPROC', 'PFNGLUNIFORMMATRIX3FVARBPROC',
+'PFNGLUNIFORMMATRIX4FVARBPROC', 'PFNGLGETOBJECTPARAMETERFVARBPROC',
+'PFNGLGETOBJECTPARAMETERIVARBPROC', 'PFNGLGETINFOLOGARBPROC',
+'PFNGLGETATTACHEDOBJECTSARBPROC', 'PFNGLGETUNIFORMLOCATIONARBPROC',
+'PFNGLGETACTIVEUNIFORMARBPROC', 'PFNGLGETUNIFORMFVARBPROC',
+'PFNGLGETUNIFORMIVARBPROC', 'PFNGLGETSHADERSOURCEARBPROC',
+'GL_ARB_vertex_shader', 'glBindAttribLocationARB', 'glGetActiveAttribARB',
+'glGetAttribLocationARB', 'PFNGLBINDATTRIBLOCATIONARBPROC',
+'PFNGLGETACTIVEATTRIBARBPROC', 'PFNGLGETATTRIBLOCATIONARBPROC',
+'GL_ARB_fragment_shader', 'GL_ARB_shading_language_100',
+'GL_ARB_texture_non_power_of_two', 'GL_ARB_point_sprite',
+'GL_ARB_fragment_program_shadow', 'GL_ARB_draw_buffers', 'glDrawBuffersARB',
+'PFNGLDRAWBUFFERSARBPROC', 'GL_ARB_texture_rectangle',
+'GL_ARB_color_buffer_float', 'glClampColorARB', 'PFNGLCLAMPCOLORARBPROC',
+'GL_ARB_half_float_pixel', 'GL_ARB_texture_float',
+'GL_ARB_pixel_buffer_object', 'GL_ARB_depth_buffer_float',
+'GL_ARB_draw_instanced', 'glDrawArraysInstancedARB',
+'glDrawElementsInstancedARB', 'PFNGLDRAWARRAYSINSTANCEDARBPROC',
+'PFNGLDRAWELEMENTSINSTANCEDARBPROC', 'GL_ARB_framebuffer_object',
+'glIsRenderbuffer', 'glBindRenderbuffer', 'glDeleteRenderbuffers',
+'glGenRenderbuffers', 'glRenderbufferStorage', 'glGetRenderbufferParameteriv',
+'glIsFramebuffer', 'glBindFramebuffer', 'glDeleteFramebuffers',
+'glGenFramebuffers', 'glCheckFramebufferStatus', 'glFramebufferTexture1D',
+'glFramebufferTexture2D', 'glFramebufferTexture3D',
+'glFramebufferRenderbuffer', 'glGetFramebufferAttachmentParameteriv',
+'glGenerateMipmap', 'glBlitFramebuffer', 'glRenderbufferStorageMultisample',
+'glFramebufferTextureLayer', 'PFNGLISRENDERBUFFERPROC',
+'PFNGLBINDRENDERBUFFERPROC', 'PFNGLDELETERENDERBUFFERSPROC',
+'PFNGLGENRENDERBUFFERSPROC', 'PFNGLRENDERBUFFERSTORAGEPROC',
+'PFNGLGETRENDERBUFFERPARAMETERIVPROC', 'PFNGLISFRAMEBUFFERPROC',
+'PFNGLBINDFRAMEBUFFERPROC', 'PFNGLDELETEFRAMEBUFFERSPROC',
+'PFNGLGENFRAMEBUFFERSPROC', 'PFNGLCHECKFRAMEBUFFERSTATUSPROC',
+'PFNGLFRAMEBUFFERTEXTURE1DPROC', 'PFNGLFRAMEBUFFERTEXTURE2DPROC',
+'PFNGLFRAMEBUFFERTEXTURE3DPROC', 'PFNGLFRAMEBUFFERRENDERBUFFERPROC',
+'PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC', 'PFNGLGENERATEMIPMAPPROC',
+'PFNGLBLITFRAMEBUFFERPROC', 'PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC',
+'PFNGLFRAMEBUFFERTEXTURELAYERPROC', 'GL_ARB_framebuffer_sRGB',
+'GL_ARB_geometry_shader4', 'glProgramParameteriARB',
+'glFramebufferTextureARB', 'glFramebufferTextureLayerARB',
+'glFramebufferTextureFaceARB', 'PFNGLPROGRAMPARAMETERIARBPROC',
+'PFNGLFRAMEBUFFERTEXTUREARBPROC', 'PFNGLFRAMEBUFFERTEXTURELAYERARBPROC',
+'PFNGLFRAMEBUFFERTEXTUREFACEARBPROC', 'GL_ARB_half_float_vertex',
+'GL_ARB_instanced_arrays', 'glVertexAttribDivisorARB',
+'PFNGLVERTEXATTRIBDIVISORARBPROC', 'GL_ARB_map_buffer_range',
+'glMapBufferRange', 'glFlushMappedBufferRange', 'PFNGLMAPBUFFERRANGEPROC',
+'PFNGLFLUSHMAPPEDBUFFERRANGEPROC', 'GL_ARB_texture_buffer_object',
+'glTexBufferARB', 'PFNGLTEXBUFFERARBPROC', 'GL_ARB_texture_compression_rgtc',
+'GL_ARB_texture_rg', 'GL_ARB_vertex_array_object', 'glBindVertexArray',
+'glDeleteVertexArrays', 'glGenVertexArrays', 'glIsVertexArray',
+'PFNGLBINDVERTEXARRAYPROC', 'PFNGLDELETEVERTEXARRAYSPROC',
+'PFNGLGENVERTEXARRAYSPROC', 'PFNGLISVERTEXARRAYPROC',
+'GL_ARB_uniform_buffer_object', 'glGetUniformIndices',
+'glGetActiveUniformsiv', 'glGetActiveUniformName', 'glGetUniformBlockIndex',
+'glGetActiveUniformBlockiv', 'glGetActiveUniformBlockName',
+'glUniformBlockBinding', 'PFNGLGETUNIFORMINDICESPROC',
+'PFNGLGETACTIVEUNIFORMSIVPROC', 'PFNGLGETACTIVEUNIFORMNAMEPROC',
+'PFNGLGETUNIFORMBLOCKINDEXPROC', 'PFNGLGETACTIVEUNIFORMBLOCKIVPROC',
+'PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC', 'PFNGLUNIFORMBLOCKBINDINGPROC',
+'GL_ARB_compatibility', 'GL_ARB_copy_buffer', 'glCopyBufferSubData',
+'PFNGLCOPYBUFFERSUBDATAPROC', 'GL_ARB_shader_texture_lod',
+'GL_ARB_depth_clamp', 'GL_ARB_draw_elements_base_vertex',
+'glDrawElementsBaseVertex', 'glDrawRangeElementsBaseVertex',
+'glDrawElementsInstancedBaseVertex', 'glMultiDrawElementsBaseVertex',
+'PFNGLDRAWELEMENTSBASEVERTEXPROC', 'PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC',
+'PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC',
+'PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC', 'GL_ARB_fragment_coord_conventions',
+'GL_ARB_provoking_vertex', 'glProvokingVertex', 'PFNGLPROVOKINGVERTEXPROC',
+'GL_ARB_seamless_cube_map', 'GL_ARB_sync', 'glFenceSync', 'glIsSync',
+'glDeleteSync', 'glClientWaitSync', 'glWaitSync', 'glGetInteger64v',
+'glGetSynciv', 'PFNGLFENCESYNCPROC', 'PFNGLISSYNCPROC', 'PFNGLDELETESYNCPROC',
+'PFNGLCLIENTWAITSYNCPROC', 'PFNGLWAITSYNCPROC', 'PFNGLGETINTEGER64VPROC',
+'PFNGLGETSYNCIVPROC', 'GL_ARB_texture_multisample', 'glTexImage2DMultisample',
+'glTexImage3DMultisample', 'glGetMultisamplefv', 'glSampleMaski',
+'PFNGLTEXIMAGE2DMULTISAMPLEPROC', 'PFNGLTEXIMAGE3DMULTISAMPLEPROC',
+'PFNGLGETMULTISAMPLEFVPROC', 'PFNGLSAMPLEMASKIPROC',
+'GL_ARB_vertex_array_bgra', 'GL_ARB_draw_buffers_blend',
+'glBlendEquationiARB', 'glBlendEquationSeparateiARB', 'glBlendFunciARB',
+'glBlendFuncSeparateiARB', 'PFNGLBLENDEQUATIONIARBPROC',
+'PFNGLBLENDEQUATIONSEPARATEIARBPROC', 'PFNGLBLENDFUNCIARBPROC',
+'PFNGLBLENDFUNCSEPARATEIARBPROC', 'GL_ARB_sample_shading',
+'glMinSampleShadingARB', 'PFNGLMINSAMPLESHADINGARBPROC',
+'GL_ARB_texture_cube_map_array', 'GL_ARB_texture_gather',
+'GL_ARB_texture_query_lod', 'GL_ARB_shading_language_include',
+'glNamedStringARB', 'glDeleteNamedStringARB', 'glCompileShaderIncludeARB',
+'glIsNamedStringARB', 'glGetNamedStringARB', 'glGetNamedStringivARB',
+'PFNGLNAMEDSTRINGARBPROC', 'PFNGLDELETENAMEDSTRINGARBPROC',
+'PFNGLCOMPILESHADERINCLUDEARBPROC', 'PFNGLISNAMEDSTRINGARBPROC',
+'PFNGLGETNAMEDSTRINGARBPROC', 'PFNGLGETNAMEDSTRINGIVARBPROC',
+'GL_ARB_texture_compression_bptc', 'GL_ARB_blend_func_extended',
+'glBindFragDataLocationIndexed', 'glGetFragDataIndex',
+'PFNGLBINDFRAGDATALOCATIONINDEXEDPROC', 'PFNGLGETFRAGDATAINDEXPROC',
+'GL_ARB_explicit_attrib_location', 'GL_ARB_occlusion_query2',
+'GL_ARB_sampler_objects', 'glGenSamplers', 'glDeleteSamplers', 'glIsSampler',
+'glBindSampler', 'glSamplerParameteri', 'glSamplerParameteriv',
+'glSamplerParameterf', 'glSamplerParameterfv', 'glSamplerParameterIiv',
+'glSamplerParameterIuiv', 'glGetSamplerParameteriv',
+'glGetSamplerParameterIiv', 'glGetSamplerParameterfv',
+'glGetSamplerParameterIuiv', 'PFNGLGENSAMPLERSPROC',
+'PFNGLDELETESAMPLERSPROC', 'PFNGLISSAMPLERPROC', 'PFNGLBINDSAMPLERPROC',
+'PFNGLSAMPLERPARAMETERIPROC', 'PFNGLSAMPLERPARAMETERIVPROC',
+'PFNGLSAMPLERPARAMETERFPROC', 'PFNGLSAMPLERPARAMETERFVPROC',
+'PFNGLSAMPLERPARAMETERIIVPROC', 'PFNGLSAMPLERPARAMETERIUIVPROC',
+'PFNGLGETSAMPLERPARAMETERIVPROC', 'PFNGLGETSAMPLERPARAMETERIIVPROC',
+'PFNGLGETSAMPLERPARAMETERFVPROC', 'PFNGLGETSAMPLERPARAMETERIUIVPROC',
+'GL_ARB_shader_bit_encoding', 'GL_ARB_texture_rgb10_a2ui',
+'GL_ARB_texture_swizzle', 'GL_ARB_timer_query', 'glQueryCounter',
+'glGetQueryObjecti64v', 'glGetQueryObjectui64v', 'PFNGLQUERYCOUNTERPROC',
+'PFNGLGETQUERYOBJECTI64VPROC', 'PFNGLGETQUERYOBJECTUI64VPROC',
+'GL_ARB_vertex_type_2_10_10_10_rev', 'glVertexP2ui', 'glVertexP2uiv',
+'glVertexP3ui', 'glVertexP3uiv', 'glVertexP4ui', 'glVertexP4uiv',
+'glTexCoordP1ui', 'glTexCoordP1uiv', 'glTexCoordP2ui', 'glTexCoordP2uiv',
+'glTexCoordP3ui', 'glTexCoordP3uiv', 'glTexCoordP4ui', 'glTexCoordP4uiv',
+'glMultiTexCoordP1ui', 'glMultiTexCoordP1uiv', 'glMultiTexCoordP2ui',
+'glMultiTexCoordP2uiv', 'glMultiTexCoordP3ui', 'glMultiTexCoordP3uiv',
+'glMultiTexCoordP4ui', 'glMultiTexCoordP4uiv', 'glNormalP3ui',
+'glNormalP3uiv', 'glColorP3ui', 'glColorP3uiv', 'glColorP4ui', 'glColorP4uiv',
+'glSecondaryColorP3ui', 'glSecondaryColorP3uiv', 'glVertexAttribP1ui',
+'glVertexAttribP1uiv', 'glVertexAttribP2ui', 'glVertexAttribP2uiv',
+'glVertexAttribP3ui', 'glVertexAttribP3uiv', 'glVertexAttribP4ui',
+'glVertexAttribP4uiv', 'PFNGLVERTEXP2UIPROC', 'PFNGLVERTEXP2UIVPROC',
+'PFNGLVERTEXP3UIPROC', 'PFNGLVERTEXP3UIVPROC', 'PFNGLVERTEXP4UIPROC',
+'PFNGLVERTEXP4UIVPROC', 'PFNGLTEXCOORDP1UIPROC', 'PFNGLTEXCOORDP1UIVPROC',
+'PFNGLTEXCOORDP2UIPROC', 'PFNGLTEXCOORDP2UIVPROC', 'PFNGLTEXCOORDP3UIPROC',
+'PFNGLTEXCOORDP3UIVPROC', 'PFNGLTEXCOORDP4UIPROC', 'PFNGLTEXCOORDP4UIVPROC',
+'PFNGLMULTITEXCOORDP1UIPROC', 'PFNGLMULTITEXCOORDP1UIVPROC',
+'PFNGLMULTITEXCOORDP2UIPROC', 'PFNGLMULTITEXCOORDP2UIVPROC',
+'PFNGLMULTITEXCOORDP3UIPROC', 'PFNGLMULTITEXCOORDP3UIVPROC',
+'PFNGLMULTITEXCOORDP4UIPROC', 'PFNGLMULTITEXCOORDP4UIVPROC',
+'PFNGLNORMALP3UIPROC', 'PFNGLNORMALP3UIVPROC', 'PFNGLCOLORP3UIPROC',
+'PFNGLCOLORP3UIVPROC', 'PFNGLCOLORP4UIPROC', 'PFNGLCOLORP4UIVPROC',
+'PFNGLSECONDARYCOLORP3UIPROC', 'PFNGLSECONDARYCOLORP3UIVPROC',
+'PFNGLVERTEXATTRIBP1UIPROC', 'PFNGLVERTEXATTRIBP1UIVPROC',
+'PFNGLVERTEXATTRIBP2UIPROC', 'PFNGLVERTEXATTRIBP2UIVPROC',
+'PFNGLVERTEXATTRIBP3UIPROC', 'PFNGLVERTEXATTRIBP3UIVPROC',
+'PFNGLVERTEXATTRIBP4UIPROC', 'PFNGLVERTEXATTRIBP4UIVPROC',
+'GL_ARB_draw_indirect', 'glDrawArraysIndirect', 'glDrawElementsIndirect',
+'PFNGLDRAWARRAYSINDIRECTPROC', 'PFNGLDRAWELEMENTSINDIRECTPROC',
+'GL_ARB_gpu_shader5', 'GL_ARB_gpu_shader_fp64', 'glUniform1d', 'glUniform2d',
+'glUniform3d', 'glUniform4d', 'glUniform1dv', 'glUniform2dv', 'glUniform3dv',
+'glUniform4dv', 'glUniformMatrix2dv', 'glUniformMatrix3dv',
+'glUniformMatrix4dv', 'glUniformMatrix2x3dv', 'glUniformMatrix2x4dv',
+'glUniformMatrix3x2dv', 'glUniformMatrix3x4dv', 'glUniformMatrix4x2dv',
+'glUniformMatrix4x3dv', 'glGetUniformdv', 'PFNGLUNIFORM1DPROC',
+'PFNGLUNIFORM2DPROC', 'PFNGLUNIFORM3DPROC', 'PFNGLUNIFORM4DPROC',
+'PFNGLUNIFORM1DVPROC', 'PFNGLUNIFORM2DVPROC', 'PFNGLUNIFORM3DVPROC',
+'PFNGLUNIFORM4DVPROC', 'PFNGLUNIFORMMATRIX2DVPROC',
+'PFNGLUNIFORMMATRIX3DVPROC', 'PFNGLUNIFORMMATRIX4DVPROC',
+'PFNGLUNIFORMMATRIX2X3DVPROC', 'PFNGLUNIFORMMATRIX2X4DVPROC',
+'PFNGLUNIFORMMATRIX3X2DVPROC', 'PFNGLUNIFORMMATRIX3X4DVPROC',
+'PFNGLUNIFORMMATRIX4X2DVPROC', 'PFNGLUNIFORMMATRIX4X3DVPROC',
+'PFNGLGETUNIFORMDVPROC', 'GL_ARB_shader_subroutine',
+'glGetSubroutineUniformLocation', 'glGetSubroutineIndex',
+'glGetActiveSubroutineUniformiv', 'glGetActiveSubroutineUniformName',
+'glGetActiveSubroutineName', 'glUniformSubroutinesuiv',
+'glGetUniformSubroutineuiv', 'glGetProgramStageiv',
+'PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC', 'PFNGLGETSUBROUTINEINDEXPROC',
+'PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC',
+'PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC', 'PFNGLGETACTIVESUBROUTINENAMEPROC',
+'PFNGLUNIFORMSUBROUTINESUIVPROC', 'PFNGLGETUNIFORMSUBROUTINEUIVPROC',
+'PFNGLGETPROGRAMSTAGEIVPROC', 'GL_ARB_tessellation_shader',
+'glPatchParameteri', 'glPatchParameterfv', 'PFNGLPATCHPARAMETERIPROC',
+'PFNGLPATCHPARAMETERFVPROC', 'GL_ARB_texture_buffer_object_rgb32',
+'GL_ARB_transform_feedback2', 'glBindTransformFeedback',
+'glDeleteTransformFeedbacks', 'glGenTransformFeedbacks',
+'glIsTransformFeedback', 'glPauseTransformFeedback',
+'glResumeTransformFeedback', 'glDrawTransformFeedback',
+'PFNGLBINDTRANSFORMFEEDBACKPROC', 'PFNGLDELETETRANSFORMFEEDBACKSPROC',
+'PFNGLGENTRANSFORMFEEDBACKSPROC', 'PFNGLISTRANSFORMFEEDBACKPROC',
+'PFNGLPAUSETRANSFORMFEEDBACKPROC', 'PFNGLRESUMETRANSFORMFEEDBACKPROC',
+'PFNGLDRAWTRANSFORMFEEDBACKPROC', 'GL_ARB_transform_feedback3',
+'glDrawTransformFeedbackStream', 'glBeginQueryIndexed', 'glEndQueryIndexed',
+'glGetQueryIndexediv', 'PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC',
+'PFNGLBEGINQUERYINDEXEDPROC', 'PFNGLENDQUERYINDEXEDPROC',
+'PFNGLGETQUERYINDEXEDIVPROC', 'GL_ARB_ES2_compatibility',
+'glReleaseShaderCompiler', 'glShaderBinary', 'glGetShaderPrecisionFormat',
+'glDepthRangef', 'glClearDepthf', 'PFNGLRELEASESHADERCOMPILERPROC',
+'PFNGLSHADERBINARYPROC', 'PFNGLGETSHADERPRECISIONFORMATPROC',
+'PFNGLDEPTHRANGEFPROC', 'PFNGLCLEARDEPTHFPROC', 'GL_ARB_get_program_binary',
+'glGetProgramBinary', 'glProgramBinary', 'glProgramParameteri',
+'PFNGLGETPROGRAMBINARYPROC', 'PFNGLPROGRAMBINARYPROC',
+'PFNGLPROGRAMPARAMETERIPROC', 'GL_ARB_separate_shader_objects',
+'glUseProgramStages', 'glActiveShaderProgram', 'glCreateShaderProgramv',
+'glBindProgramPipeline', 'glDeleteProgramPipelines', 'glGenProgramPipelines',
+'glIsProgramPipeline', 'glGetProgramPipelineiv', 'glProgramUniform1i',
+'glProgramUniform1iv', 'glProgramUniform1f', 'glProgramUniform1fv',
+'glProgramUniform1d', 'glProgramUniform1dv', 'glProgramUniform1ui',
+'glProgramUniform1uiv', 'glProgramUniform2i', 'glProgramUniform2iv',
+'glProgramUniform2f', 'glProgramUniform2fv', 'glProgramUniform2d',
+'glProgramUniform2dv', 'glProgramUniform2ui', 'glProgramUniform2uiv',
+'glProgramUniform3i', 'glProgramUniform3iv', 'glProgramUniform3f',
+'glProgramUniform3fv', 'glProgramUniform3d', 'glProgramUniform3dv',
+'glProgramUniform3ui', 'glProgramUniform3uiv', 'glProgramUniform4i',
+'glProgramUniform4iv', 'glProgramUniform4f', 'glProgramUniform4fv',
+'glProgramUniform4d', 'glProgramUniform4dv', 'glProgramUniform4ui',
+'glProgramUniform4uiv', 'glProgramUniformMatrix2fv',
+'glProgramUniformMatrix3fv', 'glProgramUniformMatrix4fv',
+'glProgramUniformMatrix2dv', 'glProgramUniformMatrix3dv',
+'glProgramUniformMatrix4dv', 'glProgramUniformMatrix2x3fv',
+'glProgramUniformMatrix3x2fv', 'glProgramUniformMatrix2x4fv',
+'glProgramUniformMatrix4x2fv', 'glProgramUniformMatrix3x4fv',
+'glProgramUniformMatrix4x3fv', 'glProgramUniformMatrix2x3dv',
+'glProgramUniformMatrix3x2dv', 'glProgramUniformMatrix2x4dv',
+'glProgramUniformMatrix4x2dv', 'glProgramUniformMatrix3x4dv',
+'glProgramUniformMatrix4x3dv', 'glValidateProgramPipeline',
+'glGetProgramPipelineInfoLog', 'PFNGLUSEPROGRAMSTAGESPROC',
+'PFNGLACTIVESHADERPROGRAMPROC', 'PFNGLCREATESHADERPROGRAMVPROC',
+'PFNGLBINDPROGRAMPIPELINEPROC', 'PFNGLDELETEPROGRAMPIPELINESPROC',
+'PFNGLGENPROGRAMPIPELINESPROC', 'PFNGLISPROGRAMPIPELINEPROC',
+'PFNGLGETPROGRAMPIPELINEIVPROC', 'PFNGLPROGRAMUNIFORM1IPROC',
+'PFNGLPROGRAMUNIFORM1IVPROC', 'PFNGLPROGRAMUNIFORM1FPROC',
+'PFNGLPROGRAMUNIFORM1FVPROC', 'PFNGLPROGRAMUNIFORM1DPROC',
+'PFNGLPROGRAMUNIFORM1DVPROC', 'PFNGLPROGRAMUNIFORM1UIPROC',
+'PFNGLPROGRAMUNIFORM1UIVPROC', 'PFNGLPROGRAMUNIFORM2IPROC',
+'PFNGLPROGRAMUNIFORM2IVPROC', 'PFNGLPROGRAMUNIFORM2FPROC',
+'PFNGLPROGRAMUNIFORM2FVPROC', 'PFNGLPROGRAMUNIFORM2DPROC',
+'PFNGLPROGRAMUNIFORM2DVPROC', 'PFNGLPROGRAMUNIFORM2UIPROC',
+'PFNGLPROGRAMUNIFORM2UIVPROC', 'PFNGLPROGRAMUNIFORM3IPROC',
+'PFNGLPROGRAMUNIFORM3IVPROC', 'PFNGLPROGRAMUNIFORM3FPROC',
+'PFNGLPROGRAMUNIFORM3FVPROC', 'PFNGLPROGRAMUNIFORM3DPROC',
+'PFNGLPROGRAMUNIFORM3DVPROC', 'PFNGLPROGRAMUNIFORM3UIPROC',
+'PFNGLPROGRAMUNIFORM3UIVPROC', 'PFNGLPROGRAMUNIFORM4IPROC',
+'PFNGLPROGRAMUNIFORM4IVPROC', 'PFNGLPROGRAMUNIFORM4FPROC',
+'PFNGLPROGRAMUNIFORM4FVPROC', 'PFNGLPROGRAMUNIFORM4DPROC',
+'PFNGLPROGRAMUNIFORM4DVPROC', 'PFNGLPROGRAMUNIFORM4UIPROC',
+'PFNGLPROGRAMUNIFORM4UIVPROC', 'PFNGLPROGRAMUNIFORMMATRIX2FVPROC',
+'PFNGLPROGRAMUNIFORMMATRIX3FVPROC', 'PFNGLPROGRAMUNIFORMMATRIX4FVPROC',
+'PFNGLPROGRAMUNIFORMMATRIX2DVPROC', 'PFNGLPROGRAMUNIFORMMATRIX3DVPROC',
+'PFNGLPROGRAMUNIFORMMATRIX4DVPROC', 'PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC',
+'PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC', 'PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC',
+'PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC', 'PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC',
+'PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC', 'PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC',
+'PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC', 'PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC',
+'PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC', 'PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC',
+'PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC', 'PFNGLVALIDATEPROGRAMPIPELINEPROC',
+'PFNGLGETPROGRAMPIPELINEINFOLOGPROC', 'GL_ARB_vertex_attrib_64bit',
+'glVertexAttribL1d', 'glVertexAttribL2d', 'glVertexAttribL3d',
+'glVertexAttribL4d', 'glVertexAttribL1dv', 'glVertexAttribL2dv',
+'glVertexAttribL3dv', 'glVertexAttribL4dv', 'glVertexAttribLPointer',
+'glGetVertexAttribLdv', 'PFNGLVERTEXATTRIBL1DPROC',
+'PFNGLVERTEXATTRIBL2DPROC', 'PFNGLVERTEXATTRIBL3DPROC',
+'PFNGLVERTEXATTRIBL4DPROC', 'PFNGLVERTEXATTRIBL1DVPROC',
+'PFNGLVERTEXATTRIBL2DVPROC', 'PFNGLVERTEXATTRIBL3DVPROC',
+'PFNGLVERTEXATTRIBL4DVPROC', 'PFNGLVERTEXATTRIBLPOINTERPROC',
+'PFNGLGETVERTEXATTRIBLDVPROC', 'GL_ARB_viewport_array', 'glViewportArrayv',
+'glViewportIndexedf', 'glViewportIndexedfv', 'glScissorArrayv',
+'glScissorIndexed', 'glScissorIndexedv', 'glDepthRangeArrayv',
+'glDepthRangeIndexed', 'glGetFloati_v', 'glGetDoublei_v',
+'PFNGLVIEWPORTARRAYVPROC', 'PFNGLVIEWPORTINDEXEDFPROC',
+'PFNGLVIEWPORTINDEXEDFVPROC', 'PFNGLSCISSORARRAYVPROC',
+'PFNGLSCISSORINDEXEDPROC', 'PFNGLSCISSORINDEXEDVPROC',
+'PFNGLDEPTHRANGEARRAYVPROC', 'PFNGLDEPTHRANGEINDEXEDPROC',
+'PFNGLGETFLOATI_VPROC', 'PFNGLGETDOUBLEI_VPROC', 'GL_ARB_cl_event',
+'glCreateSyncFromCLeventARB', 'PFNGLCREATESYNCFROMCLEVENTARBPROC',
+'GL_ARB_debug_output', 'glDebugMessageControlARB', 'glDebugMessageInsertARB',
+'glDebugMessageCallbackARB', 'glGetDebugMessageLogARB',
+'PFNGLDEBUGMESSAGECONTROLARBPROC', 'PFNGLDEBUGMESSAGEINSERTARBPROC',
+'PFNGLDEBUGMESSAGECALLBACKARBPROC', 'PFNGLGETDEBUGMESSAGELOGARBPROC',
+'GL_ARB_robustness', 'glGetGraphicsResetStatusARB', 'glGetnMapdvARB',
+'glGetnMapfvARB', 'glGetnMapivARB', 'glGetnPixelMapfvARB',
+'glGetnPixelMapuivARB', 'glGetnPixelMapusvARB', 'glGetnPolygonStippleARB',
+'glGetnColorTableARB', 'glGetnConvolutionFilterARB',
+'glGetnSeparableFilterARB', 'glGetnHistogramARB', 'glGetnMinmaxARB',
+'glGetnTexImageARB', 'glReadnPixelsARB', 'glGetnCompressedTexImageARB',
+'glGetnUniformfvARB', 'glGetnUniformivARB', 'glGetnUniformuivARB',
+'glGetnUniformdvARB', 'PFNGLGETGRAPHICSRESETSTATUSARBPROC',
+'PFNGLGETNMAPDVARBPROC', 'PFNGLGETNMAPFVARBPROC', 'PFNGLGETNMAPIVARBPROC',
+'PFNGLGETNPIXELMAPFVARBPROC', 'PFNGLGETNPIXELMAPUIVARBPROC',
+'PFNGLGETNPIXELMAPUSVARBPROC', 'PFNGLGETNPOLYGONSTIPPLEARBPROC',
+'PFNGLGETNCOLORTABLEARBPROC', 'PFNGLGETNCONVOLUTIONFILTERARBPROC',
+'PFNGLGETNSEPARABLEFILTERARBPROC', 'PFNGLGETNHISTOGRAMARBPROC',
+'PFNGLGETNMINMAXARBPROC', 'PFNGLGETNTEXIMAGEARBPROC',
+'PFNGLREADNPIXELSARBPROC', 'PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC',
+'PFNGLGETNUNIFORMFVARBPROC', 'PFNGLGETNUNIFORMIVARBPROC',
+'PFNGLGETNUNIFORMUIVARBPROC', 'PFNGLGETNUNIFORMDVARBPROC',
+'GL_ARB_shader_stencil_export', 'GL_ARB_base_instance',
+'glDrawArraysInstancedBaseInstance', 'glDrawElementsInstancedBaseInstance',
+'glDrawElementsInstancedBaseVertexBaseInstance',
+'PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC',
+'PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC',
+'PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC',
+'GL_ARB_shading_language_420pack', 'GL_ARB_transform_feedback_instanced',
+'glDrawTransformFeedbackInstanced', 'glDrawTransformFeedbackStreamInstanced',
+'PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC',
+'PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC',
+'GL_ARB_compressed_texture_pixel_storage', 'GL_ARB_conservative_depth',
+'GL_ARB_internalformat_query', 'glGetInternalformativ',
+'PFNGLGETINTERNALFORMATIVPROC', 'GL_ARB_map_buffer_alignment',
+'GL_ARB_shader_atomic_counters', 'glGetActiveAtomicCounterBufferiv',
+'PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC', 'GL_ARB_shader_image_load_store',
+'glBindImageTexture', 'glMemoryBarrier', 'PFNGLBINDIMAGETEXTUREPROC',
+'PFNGLMEMORYBARRIERPROC', 'GL_ARB_shading_language_packing',
+'GL_ARB_texture_storage', 'glTexStorage1D', 'glTexStorage2D',
+'glTexStorage3D', 'glTextureStorage1DEXT', 'glTextureStorage2DEXT',
+'glTextureStorage3DEXT', 'PFNGLTEXSTORAGE1DPROC', 'PFNGLTEXSTORAGE2DPROC',
+'PFNGLTEXSTORAGE3DPROC', 'PFNGLTEXTURESTORAGE1DEXTPROC',
+'PFNGLTEXTURESTORAGE2DEXTPROC', 'PFNGLTEXTURESTORAGE3DEXTPROC', 'GL_EXT_abgr',
+'GL_EXT_blend_color', 'glBlendColorEXT', 'PFNGLBLENDCOLOREXTPROC',
+'GL_EXT_polygon_offset', 'glPolygonOffsetEXT', 'PFNGLPOLYGONOFFSETEXTPROC',
+'GL_EXT_texture', 'GL_EXT_texture3D', 'glTexImage3DEXT', 'glTexSubImage3DEXT',
+'PFNGLTEXIMAGE3DEXTPROC', 'PFNGLTEXSUBIMAGE3DEXTPROC',
+'GL_SGIS_texture_filter4', 'glGetTexFilterFuncSGIS', 'glTexFilterFuncSGIS',
+'PFNGLGETTEXFILTERFUNCSGISPROC', 'PFNGLTEXFILTERFUNCSGISPROC',
+'GL_EXT_subtexture', 'glTexSubImage1DEXT', 'glTexSubImage2DEXT',
+'PFNGLTEXSUBIMAGE1DEXTPROC', 'PFNGLTEXSUBIMAGE2DEXTPROC',
+'GL_EXT_copy_texture', 'glCopyTexImage1DEXT', 'glCopyTexImage2DEXT',
+'glCopyTexSubImage1DEXT', 'glCopyTexSubImage2DEXT', 'glCopyTexSubImage3DEXT',
+'PFNGLCOPYTEXIMAGE1DEXTPROC', 'PFNGLCOPYTEXIMAGE2DEXTPROC',
+'PFNGLCOPYTEXSUBIMAGE1DEXTPROC', 'PFNGLCOPYTEXSUBIMAGE2DEXTPROC',
+'PFNGLCOPYTEXSUBIMAGE3DEXTPROC', 'GL_EXT_histogram', 'glGetHistogramEXT',
+'glGetHistogramParameterfvEXT', 'glGetHistogramParameterivEXT',
+'glGetMinmaxEXT', 'glGetMinmaxParameterfvEXT', 'glGetMinmaxParameterivEXT',
+'glHistogramEXT', 'glMinmaxEXT', 'glResetHistogramEXT', 'glResetMinmaxEXT',
+'PFNGLGETHISTOGRAMEXTPROC', 'PFNGLGETHISTOGRAMPARAMETERFVEXTPROC',
+'PFNGLGETHISTOGRAMPARAMETERIVEXTPROC', 'PFNGLGETMINMAXEXTPROC',
+'PFNGLGETMINMAXPARAMETERFVEXTPROC', 'PFNGLGETMINMAXPARAMETERIVEXTPROC',
+'PFNGLHISTOGRAMEXTPROC', 'PFNGLMINMAXEXTPROC', 'PFNGLRESETHISTOGRAMEXTPROC',
+'PFNGLRESETMINMAXEXTPROC', 'GL_EXT_convolution', 'glConvolutionFilter1DEXT',
+'glConvolutionFilter2DEXT', 'glConvolutionParameterfEXT',
+'glConvolutionParameterfvEXT', 'glConvolutionParameteriEXT',
+'glConvolutionParameterivEXT', 'glCopyConvolutionFilter1DEXT',
+'glCopyConvolutionFilter2DEXT', 'glGetConvolutionFilterEXT',
+'glGetConvolutionParameterfvEXT', 'glGetConvolutionParameterivEXT',
+'glGetSeparableFilterEXT', 'glSeparableFilter2DEXT',
+'PFNGLCONVOLUTIONFILTER1DEXTPROC', 'PFNGLCONVOLUTIONFILTER2DEXTPROC',
+'PFNGLCONVOLUTIONPARAMETERFEXTPROC', 'PFNGLCONVOLUTIONPARAMETERFVEXTPROC',
+'PFNGLCONVOLUTIONPARAMETERIEXTPROC', 'PFNGLCONVOLUTIONPARAMETERIVEXTPROC',
+'PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC', 'PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC',
+'PFNGLGETCONVOLUTIONFILTEREXTPROC', 'PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC',
+'PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC', 'PFNGLGETSEPARABLEFILTEREXTPROC',
+'PFNGLSEPARABLEFILTER2DEXTPROC', 'GL_SGI_color_matrix', 'GL_SGI_color_table',
+'glColorTableSGI', 'glColorTableParameterfvSGI', 'glColorTableParameterivSGI',
+'glCopyColorTableSGI', 'glGetColorTableSGI', 'glGetColorTableParameterfvSGI',
+'glGetColorTableParameterivSGI', 'PFNGLCOLORTABLESGIPROC',
+'PFNGLCOLORTABLEPARAMETERFVSGIPROC', 'PFNGLCOLORTABLEPARAMETERIVSGIPROC',
+'PFNGLCOPYCOLORTABLESGIPROC', 'PFNGLGETCOLORTABLESGIPROC',
+'PFNGLGETCOLORTABLEPARAMETERFVSGIPROC',
+'PFNGLGETCOLORTABLEPARAMETERIVSGIPROC', 'GL_SGIX_pixel_texture',
+'glPixelTexGenSGIX', 'PFNGLPIXELTEXGENSGIXPROC', 'GL_SGIS_pixel_texture',
+'glPixelTexGenParameteriSGIS', 'glPixelTexGenParameterivSGIS',
+'glPixelTexGenParameterfSGIS', 'glPixelTexGenParameterfvSGIS',
+'glGetPixelTexGenParameterivSGIS', 'glGetPixelTexGenParameterfvSGIS',
+'PFNGLPIXELTEXGENPARAMETERISGISPROC', 'PFNGLPIXELTEXGENPARAMETERIVSGISPROC',
+'PFNGLPIXELTEXGENPARAMETERFSGISPROC', 'PFNGLPIXELTEXGENPARAMETERFVSGISPROC',
+'PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC',
+'PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC', 'GL_SGIS_texture4D',
+'glTexImage4DSGIS', 'glTexSubImage4DSGIS', 'PFNGLTEXIMAGE4DSGISPROC',
+'PFNGLTEXSUBIMAGE4DSGISPROC', 'GL_SGI_texture_color_table', 'GL_EXT_cmyka',
+'GL_EXT_texture_object', 'glAreTexturesResidentEXT', 'glBindTextureEXT',
+'glDeleteTexturesEXT', 'glGenTexturesEXT', 'glIsTextureEXT',
+'glPrioritizeTexturesEXT', 'PFNGLARETEXTURESRESIDENTEXTPROC',
+'PFNGLBINDTEXTUREEXTPROC', 'PFNGLDELETETEXTURESEXTPROC',
+'PFNGLGENTEXTURESEXTPROC', 'PFNGLISTEXTUREEXTPROC',
+'PFNGLPRIORITIZETEXTURESEXTPROC', 'GL_SGIS_detail_texture',
+'glDetailTexFuncSGIS', 'glGetDetailTexFuncSGIS', 'PFNGLDETAILTEXFUNCSGISPROC',
+'PFNGLGETDETAILTEXFUNCSGISPROC', 'GL_SGIS_sharpen_texture',
+'glSharpenTexFuncSGIS', 'glGetSharpenTexFuncSGIS',
+'PFNGLSHARPENTEXFUNCSGISPROC', 'PFNGLGETSHARPENTEXFUNCSGISPROC',
+'GL_EXT_packed_pixels', 'GL_SGIS_texture_lod', 'GL_SGIS_multisample',
+'glSampleMaskSGIS', 'glSamplePatternSGIS', 'PFNGLSAMPLEMASKSGISPROC',
+'PFNGLSAMPLEPATTERNSGISPROC', 'GL_EXT_rescale_normal', 'GL_EXT_vertex_array',
+'glArrayElementEXT', 'glColorPointerEXT', 'glDrawArraysEXT',
+'glEdgeFlagPointerEXT', 'glGetPointervEXT', 'glIndexPointerEXT',
+'glNormalPointerEXT', 'glTexCoordPointerEXT', 'glVertexPointerEXT',
+'PFNGLARRAYELEMENTEXTPROC', 'PFNGLCOLORPOINTEREXTPROC',
+'PFNGLDRAWARRAYSEXTPROC', 'PFNGLEDGEFLAGPOINTEREXTPROC',
+'PFNGLGETPOINTERVEXTPROC', 'PFNGLINDEXPOINTEREXTPROC',
+'PFNGLNORMALPOINTEREXTPROC', 'PFNGLTEXCOORDPOINTEREXTPROC',
+'PFNGLVERTEXPOINTEREXTPROC', 'GL_EXT_misc_attribute',
+'GL_SGIS_generate_mipmap', 'GL_SGIX_clipmap', 'GL_SGIX_shadow',
+'GL_SGIS_texture_edge_clamp', 'GL_SGIS_texture_border_clamp',
+'GL_EXT_blend_minmax', 'glBlendEquationEXT', 'PFNGLBLENDEQUATIONEXTPROC',
+'GL_EXT_blend_subtract', 'GL_EXT_blend_logic_op', 'GL_SGIX_interlace',
+'GL_SGIX_pixel_tiles', 'GL_SGIX_texture_select', 'GL_SGIX_sprite',
+'glSpriteParameterfSGIX', 'glSpriteParameterfvSGIX', 'glSpriteParameteriSGIX',
+'glSpriteParameterivSGIX', 'PFNGLSPRITEPARAMETERFSGIXPROC',
+'PFNGLSPRITEPARAMETERFVSGIXPROC', 'PFNGLSPRITEPARAMETERISGIXPROC',
+'PFNGLSPRITEPARAMETERIVSGIXPROC', 'GL_SGIX_texture_multi_buffer',
+'GL_EXT_point_parameters', 'glPointParameterfEXT', 'glPointParameterfvEXT',
+'PFNGLPOINTPARAMETERFEXTPROC', 'PFNGLPOINTPARAMETERFVEXTPROC',
+'GL_SGIS_point_parameters', 'glPointParameterfSGIS', 'glPointParameterfvSGIS',
+'PFNGLPOINTPARAMETERFSGISPROC', 'PFNGLPOINTPARAMETERFVSGISPROC',
+'GL_SGIX_instruments', 'glGetInstrumentsSGIX', 'glInstrumentsBufferSGIX',
+'glPollInstrumentsSGIX', 'glReadInstrumentsSGIX', 'glStartInstrumentsSGIX',
+'glStopInstrumentsSGIX', 'PFNGLGETINSTRUMENTSSGIXPROC',
+'PFNGLINSTRUMENTSBUFFERSGIXPROC', 'PFNGLPOLLINSTRUMENTSSGIXPROC',
+'PFNGLREADINSTRUMENTSSGIXPROC', 'PFNGLSTARTINSTRUMENTSSGIXPROC',
+'PFNGLSTOPINSTRUMENTSSGIXPROC', 'GL_SGIX_texture_scale_bias',
+'GL_SGIX_framezoom', 'glFrameZoomSGIX', 'PFNGLFRAMEZOOMSGIXPROC',
+'GL_SGIX_tag_sample_buffer', 'glTagSampleBufferSGIX',
+'PFNGLTAGSAMPLEBUFFERSGIXPROC', 'GL_SGIX_polynomial_ffd',
+'glDeformationMap3dSGIX', 'glDeformationMap3fSGIX', 'glDeformSGIX',
+'glLoadIdentityDeformationMapSGIX', 'PFNGLDEFORMATIONMAP3DSGIXPROC',
+'PFNGLDEFORMATIONMAP3FSGIXPROC', 'PFNGLDEFORMSGIXPROC',
+'PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC', 'GL_SGIX_reference_plane',
+'glReferencePlaneSGIX', 'PFNGLREFERENCEPLANESGIXPROC', 'GL_SGIX_flush_raster',
+'glFlushRasterSGIX', 'PFNGLFLUSHRASTERSGIXPROC', 'GL_SGIX_depth_texture',
+'GL_SGIS_fog_function', 'glFogFuncSGIS', 'glGetFogFuncSGIS',
+'PFNGLFOGFUNCSGISPROC', 'PFNGLGETFOGFUNCSGISPROC', 'GL_SGIX_fog_offset',
+'GL_HP_image_transform', 'glImageTransformParameteriHP',
+'glImageTransformParameterfHP', 'glImageTransformParameterivHP',
+'glImageTransformParameterfvHP', 'glGetImageTransformParameterivHP',
+'glGetImageTransformParameterfvHP', 'PFNGLIMAGETRANSFORMPARAMETERIHPPROC',
+'PFNGLIMAGETRANSFORMPARAMETERFHPPROC', 'PFNGLIMAGETRANSFORMPARAMETERIVHPPROC',
+'PFNGLIMAGETRANSFORMPARAMETERFVHPPROC',
+'PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC',
+'PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC', 'GL_HP_convolution_border_modes',
+'GL_SGIX_texture_add_env', 'GL_EXT_color_subtable', 'glColorSubTableEXT',
+'glCopyColorSubTableEXT', 'PFNGLCOLORSUBTABLEEXTPROC',
+'PFNGLCOPYCOLORSUBTABLEEXTPROC', 'GL_PGI_vertex_hints', 'GL_PGI_misc_hints',
+'glHintPGI', 'PFNGLHINTPGIPROC', 'GL_EXT_paletted_texture', 'glColorTableEXT',
+'glGetColorTableEXT', 'glGetColorTableParameterivEXT',
+'glGetColorTableParameterfvEXT', 'PFNGLCOLORTABLEEXTPROC',
+'PFNGLGETCOLORTABLEEXTPROC', 'PFNGLGETCOLORTABLEPARAMETERIVEXTPROC',
+'PFNGLGETCOLORTABLEPARAMETERFVEXTPROC', 'GL_EXT_clip_volume_hint',
+'GL_SGIX_list_priority', 'glGetListParameterfvSGIX',
+'glGetListParameterivSGIX', 'glListParameterfSGIX', 'glListParameterfvSGIX',
+'glListParameteriSGIX', 'glListParameterivSGIX',
+'PFNGLGETLISTPARAMETERFVSGIXPROC', 'PFNGLGETLISTPARAMETERIVSGIXPROC',
+'PFNGLLISTPARAMETERFSGIXPROC', 'PFNGLLISTPARAMETERFVSGIXPROC',
+'PFNGLLISTPARAMETERISGIXPROC', 'PFNGLLISTPARAMETERIVSGIXPROC',
+'GL_SGIX_ir_instrument1', 'GL_SGIX_calligraphic_fragment',
+'GL_SGIX_texture_lod_bias', 'GL_SGIX_shadow_ambient', 'GL_EXT_index_texture',
+'GL_EXT_index_material', 'glIndexMaterialEXT', 'PFNGLINDEXMATERIALEXTPROC',
+'GL_EXT_index_func', 'glIndexFuncEXT', 'PFNGLINDEXFUNCEXTPROC',
+'GL_EXT_index_array_formats', 'GL_EXT_compiled_vertex_array',
+'glLockArraysEXT', 'glUnlockArraysEXT', 'PFNGLLOCKARRAYSEXTPROC',
+'PFNGLUNLOCKARRAYSEXTPROC', 'GL_EXT_cull_vertex', 'glCullParameterdvEXT',
+'glCullParameterfvEXT', 'PFNGLCULLPARAMETERDVEXTPROC',
+'PFNGLCULLPARAMETERFVEXTPROC', 'GL_SGIX_ycrcb', 'GL_SGIX_fragment_lighting',
+'glFragmentColorMaterialSGIX', 'glFragmentLightfSGIX',
+'glFragmentLightfvSGIX', 'glFragmentLightiSGIX', 'glFragmentLightivSGIX',
+'glFragmentLightModelfSGIX', 'glFragmentLightModelfvSGIX',
+'glFragmentLightModeliSGIX', 'glFragmentLightModelivSGIX',
+'glFragmentMaterialfSGIX', 'glFragmentMaterialfvSGIX',
+'glFragmentMaterialiSGIX', 'glFragmentMaterialivSGIX',
+'glGetFragmentLightfvSGIX', 'glGetFragmentLightivSGIX',
+'glGetFragmentMaterialfvSGIX', 'glGetFragmentMaterialivSGIX',
+'glLightEnviSGIX', 'PFNGLFRAGMENTCOLORMATERIALSGIXPROC',
+'PFNGLFRAGMENTLIGHTFSGIXPROC', 'PFNGLFRAGMENTLIGHTFVSGIXPROC',
+'PFNGLFRAGMENTLIGHTISGIXPROC', 'PFNGLFRAGMENTLIGHTIVSGIXPROC',
+'PFNGLFRAGMENTLIGHTMODELFSGIXPROC', 'PFNGLFRAGMENTLIGHTMODELFVSGIXPROC',
+'PFNGLFRAGMENTLIGHTMODELISGIXPROC', 'PFNGLFRAGMENTLIGHTMODELIVSGIXPROC',
+'PFNGLFRAGMENTMATERIALFSGIXPROC', 'PFNGLFRAGMENTMATERIALFVSGIXPROC',
+'PFNGLFRAGMENTMATERIALISGIXPROC', 'PFNGLFRAGMENTMATERIALIVSGIXPROC',
+'PFNGLGETFRAGMENTLIGHTFVSGIXPROC', 'PFNGLGETFRAGMENTLIGHTIVSGIXPROC',
+'PFNGLGETFRAGMENTMATERIALFVSGIXPROC', 'PFNGLGETFRAGMENTMATERIALIVSGIXPROC',
+'PFNGLLIGHTENVISGIXPROC', 'GL_IBM_rasterpos_clip', 'GL_HP_texture_lighting',
+'GL_EXT_draw_range_elements', 'glDrawRangeElementsEXT',
+'PFNGLDRAWRANGEELEMENTSEXTPROC', 'GL_WIN_phong_shading',
+'GL_WIN_specular_fog', 'GL_EXT_light_texture', 'glApplyTextureEXT',
+'glTextureLightEXT', 'glTextureMaterialEXT', 'PFNGLAPPLYTEXTUREEXTPROC',
+'PFNGLTEXTURELIGHTEXTPROC', 'PFNGLTEXTUREMATERIALEXTPROC',
+'GL_SGIX_blend_alpha_minmax', 'GL_EXT_bgra', 'GL_SGIX_async',
+'glAsyncMarkerSGIX', 'glFinishAsyncSGIX', 'glPollAsyncSGIX',
+'glGenAsyncMarkersSGIX', 'glDeleteAsyncMarkersSGIX', 'glIsAsyncMarkerSGIX',
+'PFNGLASYNCMARKERSGIXPROC', 'PFNGLFINISHASYNCSGIXPROC',
+'PFNGLPOLLASYNCSGIXPROC', 'PFNGLGENASYNCMARKERSSGIXPROC',
+'PFNGLDELETEASYNCMARKERSSGIXPROC', 'PFNGLISASYNCMARKERSGIXPROC',
+'GL_SGIX_async_pixel', 'GL_SGIX_async_histogram', 'GL_INTEL_parallel_arrays',
+'glVertexPointervINTEL', 'glNormalPointervINTEL', 'glColorPointervINTEL',
+'glTexCoordPointervINTEL', 'PFNGLVERTEXPOINTERVINTELPROC',
+'PFNGLNORMALPOINTERVINTELPROC', 'PFNGLCOLORPOINTERVINTELPROC',
+'PFNGLTEXCOORDPOINTERVINTELPROC', 'GL_HP_occlusion_test',
+'GL_EXT_pixel_transform', 'glPixelTransformParameteriEXT',
+'glPixelTransformParameterfEXT', 'glPixelTransformParameterivEXT',
+'glPixelTransformParameterfvEXT', 'PFNGLPIXELTRANSFORMPARAMETERIEXTPROC',
+'PFNGLPIXELTRANSFORMPARAMETERFEXTPROC',
+'PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC',
+'PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC', 'GL_EXT_pixel_transform_color_table',
+'GL_EXT_shared_texture_palette', 'GL_EXT_separate_specular_color',
+'GL_EXT_secondary_color', 'glSecondaryColor3bEXT', 'glSecondaryColor3bvEXT',
+'glSecondaryColor3dEXT', 'glSecondaryColor3dvEXT', 'glSecondaryColor3fEXT',
+'glSecondaryColor3fvEXT', 'glSecondaryColor3iEXT', 'glSecondaryColor3ivEXT',
+'glSecondaryColor3sEXT', 'glSecondaryColor3svEXT', 'glSecondaryColor3ubEXT',
+'glSecondaryColor3ubvEXT', 'glSecondaryColor3uiEXT',
+'glSecondaryColor3uivEXT', 'glSecondaryColor3usEXT',
+'glSecondaryColor3usvEXT', 'glSecondaryColorPointerEXT',
+'PFNGLSECONDARYCOLOR3BEXTPROC', 'PFNGLSECONDARYCOLOR3BVEXTPROC',
+'PFNGLSECONDARYCOLOR3DEXTPROC', 'PFNGLSECONDARYCOLOR3DVEXTPROC',
+'PFNGLSECONDARYCOLOR3FEXTPROC', 'PFNGLSECONDARYCOLOR3FVEXTPROC',
+'PFNGLSECONDARYCOLOR3IEXTPROC', 'PFNGLSECONDARYCOLOR3IVEXTPROC',
+'PFNGLSECONDARYCOLOR3SEXTPROC', 'PFNGLSECONDARYCOLOR3SVEXTPROC',
+'PFNGLSECONDARYCOLOR3UBEXTPROC', 'PFNGLSECONDARYCOLOR3UBVEXTPROC',
+'PFNGLSECONDARYCOLOR3UIEXTPROC', 'PFNGLSECONDARYCOLOR3UIVEXTPROC',
+'PFNGLSECONDARYCOLOR3USEXTPROC', 'PFNGLSECONDARYCOLOR3USVEXTPROC',
+'PFNGLSECONDARYCOLORPOINTEREXTPROC', 'GL_EXT_texture_perturb_normal',
+'glTextureNormalEXT', 'PFNGLTEXTURENORMALEXTPROC', 'GL_EXT_multi_draw_arrays',
+'glMultiDrawArraysEXT', 'glMultiDrawElementsEXT',
+'PFNGLMULTIDRAWARRAYSEXTPROC', 'PFNGLMULTIDRAWELEMENTSEXTPROC',
+'GL_EXT_fog_coord', 'glFogCoordfEXT', 'glFogCoordfvEXT', 'glFogCoorddEXT',
+'glFogCoorddvEXT', 'glFogCoordPointerEXT', 'PFNGLFOGCOORDFEXTPROC',
+'PFNGLFOGCOORDFVEXTPROC', 'PFNGLFOGCOORDDEXTPROC', 'PFNGLFOGCOORDDVEXTPROC',
+'PFNGLFOGCOORDPOINTEREXTPROC', 'GL_REND_screen_coordinates',
+'GL_EXT_coordinate_frame', 'glTangent3bEXT', 'glTangent3bvEXT',
+'glTangent3dEXT', 'glTangent3dvEXT', 'glTangent3fEXT', 'glTangent3fvEXT',
+'glTangent3iEXT', 'glTangent3ivEXT', 'glTangent3sEXT', 'glTangent3svEXT',
+'glBinormal3bEXT', 'glBinormal3bvEXT', 'glBinormal3dEXT', 'glBinormal3dvEXT',
+'glBinormal3fEXT', 'glBinormal3fvEXT', 'glBinormal3iEXT', 'glBinormal3ivEXT',
+'glBinormal3sEXT', 'glBinormal3svEXT', 'glTangentPointerEXT',
+'glBinormalPointerEXT', 'PFNGLTANGENT3BEXTPROC', 'PFNGLTANGENT3BVEXTPROC',
+'PFNGLTANGENT3DEXTPROC', 'PFNGLTANGENT3DVEXTPROC', 'PFNGLTANGENT3FEXTPROC',
+'PFNGLTANGENT3FVEXTPROC', 'PFNGLTANGENT3IEXTPROC', 'PFNGLTANGENT3IVEXTPROC',
+'PFNGLTANGENT3SEXTPROC', 'PFNGLTANGENT3SVEXTPROC', 'PFNGLBINORMAL3BEXTPROC',
+'PFNGLBINORMAL3BVEXTPROC', 'PFNGLBINORMAL3DEXTPROC',
+'PFNGLBINORMAL3DVEXTPROC', 'PFNGLBINORMAL3FEXTPROC',
+'PFNGLBINORMAL3FVEXTPROC', 'PFNGLBINORMAL3IEXTPROC',
+'PFNGLBINORMAL3IVEXTPROC', 'PFNGLBINORMAL3SEXTPROC',
+'PFNGLBINORMAL3SVEXTPROC', 'PFNGLTANGENTPOINTEREXTPROC',
+'PFNGLBINORMALPOINTEREXTPROC', 'GL_EXT_texture_env_combine',
+'GL_APPLE_specular_vector', 'GL_APPLE_transform_hint', 'GL_SGIX_fog_scale',
+'GL_SUNX_constant_data', 'glFinishTextureSUNX', 'PFNGLFINISHTEXTURESUNXPROC',
+'GL_SUN_global_alpha', 'glGlobalAlphaFactorbSUN', 'glGlobalAlphaFactorsSUN',
+'glGlobalAlphaFactoriSUN', 'glGlobalAlphaFactorfSUN',
+'glGlobalAlphaFactordSUN', 'glGlobalAlphaFactorubSUN',
+'glGlobalAlphaFactorusSUN', 'glGlobalAlphaFactoruiSUN',
+'PFNGLGLOBALALPHAFACTORBSUNPROC', 'PFNGLGLOBALALPHAFACTORSSUNPROC',
+'PFNGLGLOBALALPHAFACTORISUNPROC', 'PFNGLGLOBALALPHAFACTORFSUNPROC',
+'PFNGLGLOBALALPHAFACTORDSUNPROC', 'PFNGLGLOBALALPHAFACTORUBSUNPROC',
+'PFNGLGLOBALALPHAFACTORUSSUNPROC', 'PFNGLGLOBALALPHAFACTORUISUNPROC',
+'GL_SUN_triangle_list', 'glReplacementCodeuiSUN', 'glReplacementCodeusSUN',
+'glReplacementCodeubSUN', 'glReplacementCodeuivSUN',
+'glReplacementCodeusvSUN', 'glReplacementCodeubvSUN',
+'glReplacementCodePointerSUN', 'PFNGLREPLACEMENTCODEUISUNPROC',
+'PFNGLREPLACEMENTCODEUSSUNPROC', 'PFNGLREPLACEMENTCODEUBSUNPROC',
+'PFNGLREPLACEMENTCODEUIVSUNPROC', 'PFNGLREPLACEMENTCODEUSVSUNPROC',
+'PFNGLREPLACEMENTCODEUBVSUNPROC', 'PFNGLREPLACEMENTCODEPOINTERSUNPROC',
+'GL_SUN_vertex', 'glColor4ubVertex2fSUN', 'glColor4ubVertex2fvSUN',
+'glColor4ubVertex3fSUN', 'glColor4ubVertex3fvSUN', 'glColor3fVertex3fSUN',
+'glColor3fVertex3fvSUN', 'glNormal3fVertex3fSUN', 'glNormal3fVertex3fvSUN',
+'glColor4fNormal3fVertex3fSUN', 'glColor4fNormal3fVertex3fvSUN',
+'glTexCoord2fVertex3fSUN', 'glTexCoord2fVertex3fvSUN',
+'glTexCoord4fVertex4fSUN', 'glTexCoord4fVertex4fvSUN',
+'glTexCoord2fColor4ubVertex3fSUN', 'glTexCoord2fColor4ubVertex3fvSUN',
+'glTexCoord2fColor3fVertex3fSUN', 'glTexCoord2fColor3fVertex3fvSUN',
+'glTexCoord2fNormal3fVertex3fSUN', 'glTexCoord2fNormal3fVertex3fvSUN',
+'glTexCoord2fColor4fNormal3fVertex3fSUN',
+'glTexCoord2fColor4fNormal3fVertex3fvSUN',
+'glTexCoord4fColor4fNormal3fVertex4fSUN',
+'glTexCoord4fColor4fNormal3fVertex4fvSUN', 'glReplacementCodeuiVertex3fSUN',
+'glReplacementCodeuiVertex3fvSUN', 'glReplacementCodeuiColor4ubVertex3fSUN',
+'glReplacementCodeuiColor4ubVertex3fvSUN',
+'glReplacementCodeuiColor3fVertex3fSUN',
+'glReplacementCodeuiColor3fVertex3fvSUN',
+'glReplacementCodeuiNormal3fVertex3fSUN',
+'glReplacementCodeuiNormal3fVertex3fvSUN',
+'glReplacementCodeuiColor4fNormal3fVertex3fSUN',
+'glReplacementCodeuiColor4fNormal3fVertex3fvSUN',
+'glReplacementCodeuiTexCoord2fVertex3fSUN',
+'glReplacementCodeuiTexCoord2fVertex3fvSUN',
+'glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN',
+'glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN',
+'glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN',
+'glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN',
+'PFNGLCOLOR4UBVERTEX2FSUNPROC', 'PFNGLCOLOR4UBVERTEX2FVSUNPROC',
+'PFNGLCOLOR4UBVERTEX3FSUNPROC', 'PFNGLCOLOR4UBVERTEX3FVSUNPROC',
+'PFNGLCOLOR3FVERTEX3FSUNPROC', 'PFNGLCOLOR3FVERTEX3FVSUNPROC',
+'PFNGLNORMAL3FVERTEX3FSUNPROC', 'PFNGLNORMAL3FVERTEX3FVSUNPROC',
+'PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC', 'PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC',
+'PFNGLTEXCOORD2FVERTEX3FSUNPROC', 'PFNGLTEXCOORD2FVERTEX3FVSUNPROC',
+'PFNGLTEXCOORD4FVERTEX4FSUNPROC', 'PFNGLTEXCOORD4FVERTEX4FVSUNPROC',
+'PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC',
+'PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC',
+'PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC',
+'PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC',
+'PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC',
+'PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC',
+'PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC',
+'PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC',
+'PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC',
+'PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC',
+'PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC',
+'PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC',
+'PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC',
+'PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC',
+'PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC',
+'PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC',
+'PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC',
+'PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC',
+'PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC',
+'PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC',
+'PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC',
+'PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC',
+'PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC',
+'PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC',
+'PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC',
+'PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC',
+'GL_EXT_blend_func_separate', 'glBlendFuncSeparateEXT',
+'PFNGLBLENDFUNCSEPARATEEXTPROC', 'GL_INGR_blend_func_separate',
+'glBlendFuncSeparateINGR', 'PFNGLBLENDFUNCSEPARATEINGRPROC',
+'GL_INGR_color_clamp', 'GL_INGR_interlace_read', 'GL_EXT_stencil_wrap',
+'GL_EXT_422_pixels', 'GL_NV_texgen_reflection',
+'GL_SUN_convolution_border_modes', 'GL_EXT_texture_env_add',
+'GL_EXT_texture_lod_bias', 'GL_EXT_texture_filter_anisotropic',
+'GL_EXT_vertex_weighting', 'glVertexWeightfEXT', 'glVertexWeightfvEXT',
+'glVertexWeightPointerEXT', 'PFNGLVERTEXWEIGHTFEXTPROC',
+'PFNGLVERTEXWEIGHTFVEXTPROC', 'PFNGLVERTEXWEIGHTPOINTEREXTPROC',
+'GL_NV_light_max_exponent', 'GL_NV_vertex_array_range',
+'glFlushVertexArrayRangeNV', 'glVertexArrayRangeNV',
+'PFNGLFLUSHVERTEXARRAYRANGENVPROC', 'PFNGLVERTEXARRAYRANGENVPROC',
+'GL_NV_register_combiners', 'glCombinerParameterfvNV',
+'glCombinerParameterfNV', 'glCombinerParameterivNV', 'glCombinerParameteriNV',
+'glCombinerInputNV', 'glCombinerOutputNV', 'glFinalCombinerInputNV',
+'glGetCombinerInputParameterfvNV', 'glGetCombinerInputParameterivNV',
+'glGetCombinerOutputParameterfvNV', 'glGetCombinerOutputParameterivNV',
+'glGetFinalCombinerInputParameterfvNV',
+'glGetFinalCombinerInputParameterivNV', 'PFNGLCOMBINERPARAMETERFVNVPROC',
+'PFNGLCOMBINERPARAMETERFNVPROC', 'PFNGLCOMBINERPARAMETERIVNVPROC',
+'PFNGLCOMBINERPARAMETERINVPROC', 'PFNGLCOMBINERINPUTNVPROC',
+'PFNGLCOMBINEROUTPUTNVPROC', 'PFNGLFINALCOMBINERINPUTNVPROC',
+'PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC',
+'PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC',
+'PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC',
+'PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC',
+'PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC',
+'PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC', 'GL_NV_fog_distance',
+'GL_NV_texgen_emboss', 'GL_NV_blend_square', 'GL_NV_texture_env_combine4',
+'GL_MESA_resize_buffers', 'glResizeBuffersMESA', 'PFNGLRESIZEBUFFERSMESAPROC',
+'GL_MESA_window_pos', 'glWindowPos2dMESA', 'glWindowPos2dvMESA',
+'glWindowPos2fMESA', 'glWindowPos2fvMESA', 'glWindowPos2iMESA',
+'glWindowPos2ivMESA', 'glWindowPos2sMESA', 'glWindowPos2svMESA',
+'glWindowPos3dMESA', 'glWindowPos3dvMESA', 'glWindowPos3fMESA',
+'glWindowPos3fvMESA', 'glWindowPos3iMESA', 'glWindowPos3ivMESA',
+'glWindowPos3sMESA', 'glWindowPos3svMESA', 'glWindowPos4dMESA',
+'glWindowPos4dvMESA', 'glWindowPos4fMESA', 'glWindowPos4fvMESA',
+'glWindowPos4iMESA', 'glWindowPos4ivMESA', 'glWindowPos4sMESA',
+'glWindowPos4svMESA', 'PFNGLWINDOWPOS2DMESAPROC', 'PFNGLWINDOWPOS2DVMESAPROC',
+'PFNGLWINDOWPOS2FMESAPROC', 'PFNGLWINDOWPOS2FVMESAPROC',
+'PFNGLWINDOWPOS2IMESAPROC', 'PFNGLWINDOWPOS2IVMESAPROC',
+'PFNGLWINDOWPOS2SMESAPROC', 'PFNGLWINDOWPOS2SVMESAPROC',
+'PFNGLWINDOWPOS3DMESAPROC', 'PFNGLWINDOWPOS3DVMESAPROC',
+'PFNGLWINDOWPOS3FMESAPROC', 'PFNGLWINDOWPOS3FVMESAPROC',
+'PFNGLWINDOWPOS3IMESAPROC', 'PFNGLWINDOWPOS3IVMESAPROC',
+'PFNGLWINDOWPOS3SMESAPROC', 'PFNGLWINDOWPOS3SVMESAPROC',
+'PFNGLWINDOWPOS4DMESAPROC', 'PFNGLWINDOWPOS4DVMESAPROC',
+'PFNGLWINDOWPOS4FMESAPROC', 'PFNGLWINDOWPOS4FVMESAPROC',
+'PFNGLWINDOWPOS4IMESAPROC', 'PFNGLWINDOWPOS4IVMESAPROC',
+'PFNGLWINDOWPOS4SMESAPROC', 'PFNGLWINDOWPOS4SVMESAPROC', 'GL_IBM_cull_vertex',
+'GL_IBM_multimode_draw_arrays', 'glMultiModeDrawArraysIBM',
+'glMultiModeDrawElementsIBM', 'PFNGLMULTIMODEDRAWARRAYSIBMPROC',
+'PFNGLMULTIMODEDRAWELEMENTSIBMPROC', 'GL_IBM_vertex_array_lists',
+'glColorPointerListIBM', 'glSecondaryColorPointerListIBM',
+'glEdgeFlagPointerListIBM', 'glFogCoordPointerListIBM',
+'glIndexPointerListIBM', 'glNormalPointerListIBM', 'glTexCoordPointerListIBM',
+'glVertexPointerListIBM', 'PFNGLCOLORPOINTERLISTIBMPROC',
+'PFNGLSECONDARYCOLORPOINTERLISTIBMPROC', 'PFNGLEDGEFLAGPOINTERLISTIBMPROC',
+'PFNGLFOGCOORDPOINTERLISTIBMPROC', 'PFNGLINDEXPOINTERLISTIBMPROC',
+'PFNGLNORMALPOINTERLISTIBMPROC', 'PFNGLTEXCOORDPOINTERLISTIBMPROC',
+'PFNGLVERTEXPOINTERLISTIBMPROC', 'GL_SGIX_subsample', 'GL_SGIX_ycrcba',
+'GL_SGIX_ycrcb_subsample', 'GL_SGIX_depth_pass_instrument',
+'GL_3DFX_texture_compression_FXT1', 'GL_3DFX_multisample', 'GL_3DFX_tbuffer',
+'glTbufferMask3DFX', 'PFNGLTBUFFERMASK3DFXPROC', 'GL_EXT_multisample',
+'glSampleMaskEXT', 'glSamplePatternEXT', 'PFNGLSAMPLEMASKEXTPROC',
+'PFNGLSAMPLEPATTERNEXTPROC', 'GL_SGIX_vertex_preclip',
+'GL_SGIX_convolution_accuracy', 'GL_SGIX_resample',
+'GL_SGIS_point_line_texgen', 'GL_SGIS_texture_color_mask',
+'glTextureColorMaskSGIS', 'PFNGLTEXTURECOLORMASKSGISPROC',
+'GL_SGIX_igloo_interface', 'glIglooInterfaceSGIX',
+'PFNGLIGLOOINTERFACESGIXPROC', 'GL_EXT_texture_env_dot3',
+'GL_ATI_texture_mirror_once', 'GL_NV_fence', 'glDeleteFencesNV',
+'glGenFencesNV', 'glIsFenceNV', 'glTestFenceNV', 'glGetFenceivNV',
+'glFinishFenceNV', 'glSetFenceNV', 'PFNGLDELETEFENCESNVPROC',
+'PFNGLGENFENCESNVPROC', 'PFNGLISFENCENVPROC', 'PFNGLTESTFENCENVPROC',
+'PFNGLGETFENCEIVNVPROC', 'PFNGLFINISHFENCENVPROC', 'PFNGLSETFENCENVPROC',
+'GL_NV_evaluators', 'glMapControlPointsNV', 'glMapParameterivNV',
+'glMapParameterfvNV', 'glGetMapControlPointsNV', 'glGetMapParameterivNV',
+'glGetMapParameterfvNV', 'glGetMapAttribParameterivNV',
+'glGetMapAttribParameterfvNV', 'glEvalMapsNV', 'PFNGLMAPCONTROLPOINTSNVPROC',
+'PFNGLMAPPARAMETERIVNVPROC', 'PFNGLMAPPARAMETERFVNVPROC',
+'PFNGLGETMAPCONTROLPOINTSNVPROC', 'PFNGLGETMAPPARAMETERIVNVPROC',
+'PFNGLGETMAPPARAMETERFVNVPROC', 'PFNGLGETMAPATTRIBPARAMETERIVNVPROC',
+'PFNGLGETMAPATTRIBPARAMETERFVNVPROC', 'PFNGLEVALMAPSNVPROC',
+'GL_NV_packed_depth_stencil', 'GL_NV_register_combiners2',
+'glCombinerStageParameterfvNV', 'glGetCombinerStageParameterfvNV',
+'PFNGLCOMBINERSTAGEPARAMETERFVNVPROC',
+'PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC', 'GL_NV_texture_compression_vtc',
+'GL_NV_texture_rectangle', 'GL_NV_texture_shader', 'GL_NV_texture_shader2',
+'GL_NV_vertex_array_range2', 'GL_NV_vertex_program',
+'glAreProgramsResidentNV', 'glBindProgramNV', 'glDeleteProgramsNV',
+'glExecuteProgramNV', 'glGenProgramsNV', 'glGetProgramParameterdvNV',
+'glGetProgramParameterfvNV', 'glGetProgramivNV', 'glGetProgramStringNV',
+'glGetTrackMatrixivNV', 'glGetVertexAttribdvNV', 'glGetVertexAttribfvNV',
+'glGetVertexAttribivNV', 'glGetVertexAttribPointervNV', 'glIsProgramNV',
+'glLoadProgramNV', 'glProgramParameter4dNV', 'glProgramParameter4dvNV',
+'glProgramParameter4fNV', 'glProgramParameter4fvNV',
+'glProgramParameters4dvNV', 'glProgramParameters4fvNV',
+'glRequestResidentProgramsNV', 'glTrackMatrixNV', 'glVertexAttribPointerNV',
+'glVertexAttrib1dNV', 'glVertexAttrib1dvNV', 'glVertexAttrib1fNV',
+'glVertexAttrib1fvNV', 'glVertexAttrib1sNV', 'glVertexAttrib1svNV',
+'glVertexAttrib2dNV', 'glVertexAttrib2dvNV', 'glVertexAttrib2fNV',
+'glVertexAttrib2fvNV', 'glVertexAttrib2sNV', 'glVertexAttrib2svNV',
+'glVertexAttrib3dNV', 'glVertexAttrib3dvNV', 'glVertexAttrib3fNV',
+'glVertexAttrib3fvNV', 'glVertexAttrib3sNV', 'glVertexAttrib3svNV',
+'glVertexAttrib4dNV', 'glVertexAttrib4dvNV', 'glVertexAttrib4fNV',
+'glVertexAttrib4fvNV', 'glVertexAttrib4sNV', 'glVertexAttrib4svNV',
+'glVertexAttrib4ubNV', 'glVertexAttrib4ubvNV', 'glVertexAttribs1dvNV',
+'glVertexAttribs1fvNV', 'glVertexAttribs1svNV', 'glVertexAttribs2dvNV',
+'glVertexAttribs2fvNV', 'glVertexAttribs2svNV', 'glVertexAttribs3dvNV',
+'glVertexAttribs3fvNV', 'glVertexAttribs3svNV', 'glVertexAttribs4dvNV',
+'glVertexAttribs4fvNV', 'glVertexAttribs4svNV', 'glVertexAttribs4ubvNV',
+'PFNGLAREPROGRAMSRESIDENTNVPROC', 'PFNGLBINDPROGRAMNVPROC',
+'PFNGLDELETEPROGRAMSNVPROC', 'PFNGLEXECUTEPROGRAMNVPROC',
+'PFNGLGENPROGRAMSNVPROC', 'PFNGLGETPROGRAMPARAMETERDVNVPROC',
+'PFNGLGETPROGRAMPARAMETERFVNVPROC', 'PFNGLGETPROGRAMIVNVPROC',
+'PFNGLGETPROGRAMSTRINGNVPROC', 'PFNGLGETTRACKMATRIXIVNVPROC',
+'PFNGLGETVERTEXATTRIBDVNVPROC', 'PFNGLGETVERTEXATTRIBFVNVPROC',
+'PFNGLGETVERTEXATTRIBIVNVPROC', 'PFNGLGETVERTEXATTRIBPOINTERVNVPROC',
+'PFNGLISPROGRAMNVPROC', 'PFNGLLOADPROGRAMNVPROC',
+'PFNGLPROGRAMPARAMETER4DNVPROC', 'PFNGLPROGRAMPARAMETER4DVNVPROC',
+'PFNGLPROGRAMPARAMETER4FNVPROC', 'PFNGLPROGRAMPARAMETER4FVNVPROC',
+'PFNGLPROGRAMPARAMETERS4DVNVPROC', 'PFNGLPROGRAMPARAMETERS4FVNVPROC',
+'PFNGLREQUESTRESIDENTPROGRAMSNVPROC', 'PFNGLTRACKMATRIXNVPROC',
+'PFNGLVERTEXATTRIBPOINTERNVPROC', 'PFNGLVERTEXATTRIB1DNVPROC',
+'PFNGLVERTEXATTRIB1DVNVPROC', 'PFNGLVERTEXATTRIB1FNVPROC',
+'PFNGLVERTEXATTRIB1FVNVPROC', 'PFNGLVERTEXATTRIB1SNVPROC',
+'PFNGLVERTEXATTRIB1SVNVPROC', 'PFNGLVERTEXATTRIB2DNVPROC',
+'PFNGLVERTEXATTRIB2DVNVPROC', 'PFNGLVERTEXATTRIB2FNVPROC',
+'PFNGLVERTEXATTRIB2FVNVPROC', 'PFNGLVERTEXATTRIB2SNVPROC',
+'PFNGLVERTEXATTRIB2SVNVPROC', 'PFNGLVERTEXATTRIB3DNVPROC',
+'PFNGLVERTEXATTRIB3DVNVPROC', 'PFNGLVERTEXATTRIB3FNVPROC',
+'PFNGLVERTEXATTRIB3FVNVPROC', 'PFNGLVERTEXATTRIB3SNVPROC',
+'PFNGLVERTEXATTRIB3SVNVPROC', 'PFNGLVERTEXATTRIB4DNVPROC',
+'PFNGLVERTEXATTRIB4DVNVPROC', 'PFNGLVERTEXATTRIB4FNVPROC',
+'PFNGLVERTEXATTRIB4FVNVPROC', 'PFNGLVERTEXATTRIB4SNVPROC',
+'PFNGLVERTEXATTRIB4SVNVPROC', 'PFNGLVERTEXATTRIB4UBNVPROC',
+'PFNGLVERTEXATTRIB4UBVNVPROC', 'PFNGLVERTEXATTRIBS1DVNVPROC',
+'PFNGLVERTEXATTRIBS1FVNVPROC', 'PFNGLVERTEXATTRIBS1SVNVPROC',
+'PFNGLVERTEXATTRIBS2DVNVPROC', 'PFNGLVERTEXATTRIBS2FVNVPROC',
+'PFNGLVERTEXATTRIBS2SVNVPROC', 'PFNGLVERTEXATTRIBS3DVNVPROC',
+'PFNGLVERTEXATTRIBS3FVNVPROC', 'PFNGLVERTEXATTRIBS3SVNVPROC',
+'PFNGLVERTEXATTRIBS4DVNVPROC', 'PFNGLVERTEXATTRIBS4FVNVPROC',
+'PFNGLVERTEXATTRIBS4SVNVPROC', 'PFNGLVERTEXATTRIBS4UBVNVPROC',
+'GL_SGIX_texture_coordinate_clamp', 'GL_SGIX_scalebias_hint',
+'GL_OML_interlace', 'GL_OML_subsample', 'GL_OML_resample',
+'GL_NV_copy_depth_to_color', 'GL_ATI_envmap_bumpmap',
+'glTexBumpParameterivATI', 'glTexBumpParameterfvATI',
+'glGetTexBumpParameterivATI', 'glGetTexBumpParameterfvATI',
+'PFNGLTEXBUMPPARAMETERIVATIPROC', 'PFNGLTEXBUMPPARAMETERFVATIPROC',
+'PFNGLGETTEXBUMPPARAMETERIVATIPROC', 'PFNGLGETTEXBUMPPARAMETERFVATIPROC',
+'GL_ATI_fragment_shader', 'glGenFragmentShadersATI',
+'glBindFragmentShaderATI', 'glDeleteFragmentShaderATI',
+'glBeginFragmentShaderATI', 'glEndFragmentShaderATI', 'glPassTexCoordATI',
+'glSampleMapATI', 'glColorFragmentOp1ATI', 'glColorFragmentOp2ATI',
+'glColorFragmentOp3ATI', 'glAlphaFragmentOp1ATI', 'glAlphaFragmentOp2ATI',
+'glAlphaFragmentOp3ATI', 'glSetFragmentShaderConstantATI',
+'PFNGLGENFRAGMENTSHADERSATIPROC', 'PFNGLBINDFRAGMENTSHADERATIPROC',
+'PFNGLDELETEFRAGMENTSHADERATIPROC', 'PFNGLBEGINFRAGMENTSHADERATIPROC',
+'PFNGLENDFRAGMENTSHADERATIPROC', 'PFNGLPASSTEXCOORDATIPROC',
+'PFNGLSAMPLEMAPATIPROC', 'PFNGLCOLORFRAGMENTOP1ATIPROC',
+'PFNGLCOLORFRAGMENTOP2ATIPROC', 'PFNGLCOLORFRAGMENTOP3ATIPROC',
+'PFNGLALPHAFRAGMENTOP1ATIPROC', 'PFNGLALPHAFRAGMENTOP2ATIPROC',
+'PFNGLALPHAFRAGMENTOP3ATIPROC', 'PFNGLSETFRAGMENTSHADERCONSTANTATIPROC',
+'GL_ATI_pn_triangles', 'glPNTrianglesiATI', 'glPNTrianglesfATI',
+'PFNGLPNTRIANGLESIATIPROC', 'PFNGLPNTRIANGLESFATIPROC',
+'GL_ATI_vertex_array_object', 'glNewObjectBufferATI', 'glIsObjectBufferATI',
+'glUpdateObjectBufferATI', 'glGetObjectBufferfvATI', 'glGetObjectBufferivATI',
+'glFreeObjectBufferATI', 'glArrayObjectATI', 'glGetArrayObjectfvATI',
+'glGetArrayObjectivATI', 'glVariantArrayObjectATI',
+'glGetVariantArrayObjectfvATI', 'glGetVariantArrayObjectivATI',
+'PFNGLNEWOBJECTBUFFERATIPROC', 'PFNGLISOBJECTBUFFERATIPROC',
+'PFNGLUPDATEOBJECTBUFFERATIPROC', 'PFNGLGETOBJECTBUFFERFVATIPROC',
+'PFNGLGETOBJECTBUFFERIVATIPROC', 'PFNGLFREEOBJECTBUFFERATIPROC',
+'PFNGLARRAYOBJECTATIPROC', 'PFNGLGETARRAYOBJECTFVATIPROC',
+'PFNGLGETARRAYOBJECTIVATIPROC', 'PFNGLVARIANTARRAYOBJECTATIPROC',
+'PFNGLGETVARIANTARRAYOBJECTFVATIPROC', 'PFNGLGETVARIANTARRAYOBJECTIVATIPROC',
+'GL_EXT_vertex_shader', 'glBeginVertexShaderEXT', 'glEndVertexShaderEXT',
+'glBindVertexShaderEXT', 'glGenVertexShadersEXT', 'glDeleteVertexShaderEXT',
+'glShaderOp1EXT', 'glShaderOp2EXT', 'glShaderOp3EXT', 'glSwizzleEXT',
+'glWriteMaskEXT', 'glInsertComponentEXT', 'glExtractComponentEXT',
+'glGenSymbolsEXT', 'glSetInvariantEXT', 'glSetLocalConstantEXT',
+'glVariantbvEXT', 'glVariantsvEXT', 'glVariantivEXT', 'glVariantfvEXT',
+'glVariantdvEXT', 'glVariantubvEXT', 'glVariantusvEXT', 'glVariantuivEXT',
+'glVariantPointerEXT', 'glEnableVariantClientStateEXT',
+'glDisableVariantClientStateEXT', 'glBindLightParameterEXT',
+'glBindMaterialParameterEXT', 'glBindTexGenParameterEXT',
+'glBindTextureUnitParameterEXT', 'glBindParameterEXT',
+'glIsVariantEnabledEXT', 'glGetVariantBooleanvEXT', 'glGetVariantIntegervEXT',
+'glGetVariantFloatvEXT', 'glGetVariantPointervEXT',
+'glGetInvariantBooleanvEXT', 'glGetInvariantIntegervEXT',
+'glGetInvariantFloatvEXT', 'glGetLocalConstantBooleanvEXT',
+'glGetLocalConstantIntegervEXT', 'glGetLocalConstantFloatvEXT',
+'PFNGLBEGINVERTEXSHADEREXTPROC', 'PFNGLENDVERTEXSHADEREXTPROC',
+'PFNGLBINDVERTEXSHADEREXTPROC', 'PFNGLGENVERTEXSHADERSEXTPROC',
+'PFNGLDELETEVERTEXSHADEREXTPROC', 'PFNGLSHADEROP1EXTPROC',
+'PFNGLSHADEROP2EXTPROC', 'PFNGLSHADEROP3EXTPROC', 'PFNGLSWIZZLEEXTPROC',
+'PFNGLWRITEMASKEXTPROC', 'PFNGLINSERTCOMPONENTEXTPROC',
+'PFNGLEXTRACTCOMPONENTEXTPROC', 'PFNGLGENSYMBOLSEXTPROC',
+'PFNGLSETINVARIANTEXTPROC', 'PFNGLSETLOCALCONSTANTEXTPROC',
+'PFNGLVARIANTBVEXTPROC', 'PFNGLVARIANTSVEXTPROC', 'PFNGLVARIANTIVEXTPROC',
+'PFNGLVARIANTFVEXTPROC', 'PFNGLVARIANTDVEXTPROC', 'PFNGLVARIANTUBVEXTPROC',
+'PFNGLVARIANTUSVEXTPROC', 'PFNGLVARIANTUIVEXTPROC',
+'PFNGLVARIANTPOINTEREXTPROC', 'PFNGLENABLEVARIANTCLIENTSTATEEXTPROC',
+'PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC', 'PFNGLBINDLIGHTPARAMETEREXTPROC',
+'PFNGLBINDMATERIALPARAMETEREXTPROC', 'PFNGLBINDTEXGENPARAMETEREXTPROC',
+'PFNGLBINDTEXTUREUNITPARAMETEREXTPROC', 'PFNGLBINDPARAMETEREXTPROC',
+'PFNGLISVARIANTENABLEDEXTPROC', 'PFNGLGETVARIANTBOOLEANVEXTPROC',
+'PFNGLGETVARIANTINTEGERVEXTPROC', 'PFNGLGETVARIANTFLOATVEXTPROC',
+'PFNGLGETVARIANTPOINTERVEXTPROC', 'PFNGLGETINVARIANTBOOLEANVEXTPROC',
+'PFNGLGETINVARIANTINTEGERVEXTPROC', 'PFNGLGETINVARIANTFLOATVEXTPROC',
+'PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC',
+'PFNGLGETLOCALCONSTANTINTEGERVEXTPROC', 'PFNGLGETLOCALCONSTANTFLOATVEXTPROC',
+'GL_ATI_vertex_streams', 'glVertexStream1sATI', 'glVertexStream1svATI',
+'glVertexStream1iATI', 'glVertexStream1ivATI', 'glVertexStream1fATI',
+'glVertexStream1fvATI', 'glVertexStream1dATI', 'glVertexStream1dvATI',
+'glVertexStream2sATI', 'glVertexStream2svATI', 'glVertexStream2iATI',
+'glVertexStream2ivATI', 'glVertexStream2fATI', 'glVertexStream2fvATI',
+'glVertexStream2dATI', 'glVertexStream2dvATI', 'glVertexStream3sATI',
+'glVertexStream3svATI', 'glVertexStream3iATI', 'glVertexStream3ivATI',
+'glVertexStream3fATI', 'glVertexStream3fvATI', 'glVertexStream3dATI',
+'glVertexStream3dvATI', 'glVertexStream4sATI', 'glVertexStream4svATI',
+'glVertexStream4iATI', 'glVertexStream4ivATI', 'glVertexStream4fATI',
+'glVertexStream4fvATI', 'glVertexStream4dATI', 'glVertexStream4dvATI',
+'glNormalStream3bATI', 'glNormalStream3bvATI', 'glNormalStream3sATI',
+'glNormalStream3svATI', 'glNormalStream3iATI', 'glNormalStream3ivATI',
+'glNormalStream3fATI', 'glNormalStream3fvATI', 'glNormalStream3dATI',
+'glNormalStream3dvATI', 'glClientActiveVertexStreamATI',
+'glVertexBlendEnviATI', 'glVertexBlendEnvfATI', 'PFNGLVERTEXSTREAM1SATIPROC',
+'PFNGLVERTEXSTREAM1SVATIPROC', 'PFNGLVERTEXSTREAM1IATIPROC',
+'PFNGLVERTEXSTREAM1IVATIPROC', 'PFNGLVERTEXSTREAM1FATIPROC',
+'PFNGLVERTEXSTREAM1FVATIPROC', 'PFNGLVERTEXSTREAM1DATIPROC',
+'PFNGLVERTEXSTREAM1DVATIPROC', 'PFNGLVERTEXSTREAM2SATIPROC',
+'PFNGLVERTEXSTREAM2SVATIPROC', 'PFNGLVERTEXSTREAM2IATIPROC',
+'PFNGLVERTEXSTREAM2IVATIPROC', 'PFNGLVERTEXSTREAM2FATIPROC',
+'PFNGLVERTEXSTREAM2FVATIPROC', 'PFNGLVERTEXSTREAM2DATIPROC',
+'PFNGLVERTEXSTREAM2DVATIPROC', 'PFNGLVERTEXSTREAM3SATIPROC',
+'PFNGLVERTEXSTREAM3SVATIPROC', 'PFNGLVERTEXSTREAM3IATIPROC',
+'PFNGLVERTEXSTREAM3IVATIPROC', 'PFNGLVERTEXSTREAM3FATIPROC',
+'PFNGLVERTEXSTREAM3FVATIPROC', 'PFNGLVERTEXSTREAM3DATIPROC',
+'PFNGLVERTEXSTREAM3DVATIPROC', 'PFNGLVERTEXSTREAM4SATIPROC',
+'PFNGLVERTEXSTREAM4SVATIPROC', 'PFNGLVERTEXSTREAM4IATIPROC',
+'PFNGLVERTEXSTREAM4IVATIPROC', 'PFNGLVERTEXSTREAM4FATIPROC',
+'PFNGLVERTEXSTREAM4FVATIPROC', 'PFNGLVERTEXSTREAM4DATIPROC',
+'PFNGLVERTEXSTREAM4DVATIPROC', 'PFNGLNORMALSTREAM3BATIPROC',
+'PFNGLNORMALSTREAM3BVATIPROC', 'PFNGLNORMALSTREAM3SATIPROC',
+'PFNGLNORMALSTREAM3SVATIPROC', 'PFNGLNORMALSTREAM3IATIPROC',
+'PFNGLNORMALSTREAM3IVATIPROC', 'PFNGLNORMALSTREAM3FATIPROC',
+'PFNGLNORMALSTREAM3FVATIPROC', 'PFNGLNORMALSTREAM3DATIPROC',
+'PFNGLNORMALSTREAM3DVATIPROC', 'PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC',
+'PFNGLVERTEXBLENDENVIATIPROC', 'PFNGLVERTEXBLENDENVFATIPROC',
+'GL_ATI_element_array', 'glElementPointerATI', 'glDrawElementArrayATI',
+'glDrawRangeElementArrayATI', 'PFNGLELEMENTPOINTERATIPROC',
+'PFNGLDRAWELEMENTARRAYATIPROC', 'PFNGLDRAWRANGEELEMENTARRAYATIPROC',
+'GL_SUN_mesh_array', 'glDrawMeshArraysSUN', 'PFNGLDRAWMESHARRAYSSUNPROC',
+'GL_SUN_slice_accum', 'GL_NV_multisample_filter_hint', 'GL_NV_depth_clamp',
+'GL_NV_occlusion_query', 'glGenOcclusionQueriesNV',
+'glDeleteOcclusionQueriesNV', 'glIsOcclusionQueryNV',
+'glBeginOcclusionQueryNV', 'glEndOcclusionQueryNV', 'glGetOcclusionQueryivNV',
+'glGetOcclusionQueryuivNV', 'PFNGLGENOCCLUSIONQUERIESNVPROC',
+'PFNGLDELETEOCCLUSIONQUERIESNVPROC', 'PFNGLISOCCLUSIONQUERYNVPROC',
+'PFNGLBEGINOCCLUSIONQUERYNVPROC', 'PFNGLENDOCCLUSIONQUERYNVPROC',
+'PFNGLGETOCCLUSIONQUERYIVNVPROC', 'PFNGLGETOCCLUSIONQUERYUIVNVPROC',
+'GL_NV_point_sprite', 'glPointParameteriNV', 'glPointParameterivNV',
+'PFNGLPOINTPARAMETERINVPROC', 'PFNGLPOINTPARAMETERIVNVPROC',
+'GL_NV_texture_shader3', 'GL_NV_vertex_program1_1', 'GL_EXT_shadow_funcs',
+'GL_EXT_stencil_two_side', 'glActiveStencilFaceEXT',
+'PFNGLACTIVESTENCILFACEEXTPROC', 'GL_ATI_text_fragment_shader',
+'GL_APPLE_client_storage', 'GL_APPLE_element_array', 'glElementPointerAPPLE',
+'glDrawElementArrayAPPLE', 'glDrawRangeElementArrayAPPLE',
+'glMultiDrawElementArrayAPPLE', 'glMultiDrawRangeElementArrayAPPLE',
+'PFNGLELEMENTPOINTERAPPLEPROC', 'PFNGLDRAWELEMENTARRAYAPPLEPROC',
+'PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC', 'PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC',
+'PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC', 'GL_APPLE_fence',
+'glGenFencesAPPLE', 'glDeleteFencesAPPLE', 'glSetFenceAPPLE',
+'glIsFenceAPPLE', 'glTestFenceAPPLE', 'glFinishFenceAPPLE',
+'glTestObjectAPPLE', 'glFinishObjectAPPLE', 'PFNGLGENFENCESAPPLEPROC',
+'PFNGLDELETEFENCESAPPLEPROC', 'PFNGLSETFENCEAPPLEPROC',
+'PFNGLISFENCEAPPLEPROC', 'PFNGLTESTFENCEAPPLEPROC',
+'PFNGLFINISHFENCEAPPLEPROC', 'PFNGLTESTOBJECTAPPLEPROC',
+'PFNGLFINISHOBJECTAPPLEPROC', 'GL_APPLE_vertex_array_object',
+'glBindVertexArrayAPPLE', 'glDeleteVertexArraysAPPLE',
+'glGenVertexArraysAPPLE', 'glIsVertexArrayAPPLE',
+'PFNGLBINDVERTEXARRAYAPPLEPROC', 'PFNGLDELETEVERTEXARRAYSAPPLEPROC',
+'PFNGLGENVERTEXARRAYSAPPLEPROC', 'PFNGLISVERTEXARRAYAPPLEPROC',
+'GL_APPLE_vertex_array_range', 'glVertexArrayRangeAPPLE',
+'glFlushVertexArrayRangeAPPLE', 'glVertexArrayParameteriAPPLE',
+'PFNGLVERTEXARRAYRANGEAPPLEPROC', 'PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC',
+'PFNGLVERTEXARRAYPARAMETERIAPPLEPROC', 'GL_APPLE_ycbcr_422', 'GL_S3_s3tc',
+'GL_ATI_draw_buffers', 'glDrawBuffersATI', 'PFNGLDRAWBUFFERSATIPROC',
+'GL_ATI_pixel_format_float', 'GL_ATI_texture_env_combine3',
+'GL_ATI_texture_float', 'GL_NV_float_buffer', 'GL_NV_fragment_program',
+'glProgramNamedParameter4fNV', 'glProgramNamedParameter4dNV',
+'glProgramNamedParameter4fvNV', 'glProgramNamedParameter4dvNV',
+'glGetProgramNamedParameterfvNV', 'glGetProgramNamedParameterdvNV',
+'PFNGLPROGRAMNAMEDPARAMETER4FNVPROC', 'PFNGLPROGRAMNAMEDPARAMETER4DNVPROC',
+'PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC', 'PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC',
+'PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC',
+'PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC', 'GL_NV_half_float', 'glVertex2hNV',
+'glVertex2hvNV', 'glVertex3hNV', 'glVertex3hvNV', 'glVertex4hNV',
+'glVertex4hvNV', 'glNormal3hNV', 'glNormal3hvNV', 'glColor3hNV',
+'glColor3hvNV', 'glColor4hNV', 'glColor4hvNV', 'glTexCoord1hNV',
+'glTexCoord1hvNV', 'glTexCoord2hNV', 'glTexCoord2hvNV', 'glTexCoord3hNV',
+'glTexCoord3hvNV', 'glTexCoord4hNV', 'glTexCoord4hvNV', 'glMultiTexCoord1hNV',
+'glMultiTexCoord1hvNV', 'glMultiTexCoord2hNV', 'glMultiTexCoord2hvNV',
+'glMultiTexCoord3hNV', 'glMultiTexCoord3hvNV', 'glMultiTexCoord4hNV',
+'glMultiTexCoord4hvNV', 'glFogCoordhNV', 'glFogCoordhvNV',
+'glSecondaryColor3hNV', 'glSecondaryColor3hvNV', 'glVertexWeighthNV',
+'glVertexWeighthvNV', 'glVertexAttrib1hNV', 'glVertexAttrib1hvNV',
+'glVertexAttrib2hNV', 'glVertexAttrib2hvNV', 'glVertexAttrib3hNV',
+'glVertexAttrib3hvNV', 'glVertexAttrib4hNV', 'glVertexAttrib4hvNV',
+'glVertexAttribs1hvNV', 'glVertexAttribs2hvNV', 'glVertexAttribs3hvNV',
+'glVertexAttribs4hvNV', 'PFNGLVERTEX2HNVPROC', 'PFNGLVERTEX2HVNVPROC',
+'PFNGLVERTEX3HNVPROC', 'PFNGLVERTEX3HVNVPROC', 'PFNGLVERTEX4HNVPROC',
+'PFNGLVERTEX4HVNVPROC', 'PFNGLNORMAL3HNVPROC', 'PFNGLNORMAL3HVNVPROC',
+'PFNGLCOLOR3HNVPROC', 'PFNGLCOLOR3HVNVPROC', 'PFNGLCOLOR4HNVPROC',
+'PFNGLCOLOR4HVNVPROC', 'PFNGLTEXCOORD1HNVPROC', 'PFNGLTEXCOORD1HVNVPROC',
+'PFNGLTEXCOORD2HNVPROC', 'PFNGLTEXCOORD2HVNVPROC', 'PFNGLTEXCOORD3HNVPROC',
+'PFNGLTEXCOORD3HVNVPROC', 'PFNGLTEXCOORD4HNVPROC', 'PFNGLTEXCOORD4HVNVPROC',
+'PFNGLMULTITEXCOORD1HNVPROC', 'PFNGLMULTITEXCOORD1HVNVPROC',
+'PFNGLMULTITEXCOORD2HNVPROC', 'PFNGLMULTITEXCOORD2HVNVPROC',
+'PFNGLMULTITEXCOORD3HNVPROC', 'PFNGLMULTITEXCOORD3HVNVPROC',
+'PFNGLMULTITEXCOORD4HNVPROC', 'PFNGLMULTITEXCOORD4HVNVPROC',
+'PFNGLFOGCOORDHNVPROC', 'PFNGLFOGCOORDHVNVPROC',
+'PFNGLSECONDARYCOLOR3HNVPROC', 'PFNGLSECONDARYCOLOR3HVNVPROC',
+'PFNGLVERTEXWEIGHTHNVPROC', 'PFNGLVERTEXWEIGHTHVNVPROC',
+'PFNGLVERTEXATTRIB1HNVPROC', 'PFNGLVERTEXATTRIB1HVNVPROC',
+'PFNGLVERTEXATTRIB2HNVPROC', 'PFNGLVERTEXATTRIB2HVNVPROC',
+'PFNGLVERTEXATTRIB3HNVPROC', 'PFNGLVERTEXATTRIB3HVNVPROC',
+'PFNGLVERTEXATTRIB4HNVPROC', 'PFNGLVERTEXATTRIB4HVNVPROC',
+'PFNGLVERTEXATTRIBS1HVNVPROC', 'PFNGLVERTEXATTRIBS2HVNVPROC',
+'PFNGLVERTEXATTRIBS3HVNVPROC', 'PFNGLVERTEXATTRIBS4HVNVPROC',
+'GL_NV_pixel_data_range', 'glPixelDataRangeNV', 'glFlushPixelDataRangeNV',
+'PFNGLPIXELDATARANGENVPROC', 'PFNGLFLUSHPIXELDATARANGENVPROC',
+'GL_NV_primitive_restart', 'glPrimitiveRestartNV',
+'glPrimitiveRestartIndexNV', 'PFNGLPRIMITIVERESTARTNVPROC',
+'PFNGLPRIMITIVERESTARTINDEXNVPROC', 'GL_NV_texture_expand_normal',
+'GL_NV_vertex_program2', 'GL_ATI_map_object_buffer', 'glMapObjectBufferATI',
+'glUnmapObjectBufferATI', 'PFNGLMAPOBJECTBUFFERATIPROC',
+'PFNGLUNMAPOBJECTBUFFERATIPROC', 'GL_ATI_separate_stencil',
+'glStencilOpSeparateATI', 'glStencilFuncSeparateATI',
+'PFNGLSTENCILOPSEPARATEATIPROC', 'PFNGLSTENCILFUNCSEPARATEATIPROC',
+'GL_ATI_vertex_attrib_array_object', 'glVertexAttribArrayObjectATI',
+'glGetVertexAttribArrayObjectfvATI', 'glGetVertexAttribArrayObjectivATI',
+'PFNGLVERTEXATTRIBARRAYOBJECTATIPROC',
+'PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC',
+'PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC', 'GL_OES_read_format',
+'GL_EXT_depth_bounds_test', 'glDepthBoundsEXT', 'PFNGLDEPTHBOUNDSEXTPROC',
+'GL_EXT_texture_mirror_clamp', 'GL_EXT_blend_equation_separate',
+'glBlendEquationSeparateEXT', 'PFNGLBLENDEQUATIONSEPARATEEXTPROC',
+'GL_MESA_pack_invert', 'GL_MESA_ycbcr_texture', 'GL_EXT_pixel_buffer_object',
+'GL_NV_fragment_program_option', 'GL_NV_fragment_program2',
+'GL_NV_vertex_program2_option', 'GL_NV_vertex_program3',
+'GL_EXT_framebuffer_object', 'glIsRenderbufferEXT', 'glBindRenderbufferEXT',
+'glDeleteRenderbuffersEXT', 'glGenRenderbuffersEXT',
+'glRenderbufferStorageEXT', 'glGetRenderbufferParameterivEXT',
+'glIsFramebufferEXT', 'glBindFramebufferEXT', 'glDeleteFramebuffersEXT',
+'glGenFramebuffersEXT', 'glCheckFramebufferStatusEXT',
+'glFramebufferTexture1DEXT', 'glFramebufferTexture2DEXT',
+'glFramebufferTexture3DEXT', 'glFramebufferRenderbufferEXT',
+'glGetFramebufferAttachmentParameterivEXT', 'glGenerateMipmapEXT',
+'PFNGLISRENDERBUFFEREXTPROC', 'PFNGLBINDRENDERBUFFEREXTPROC',
+'PFNGLDELETERENDERBUFFERSEXTPROC', 'PFNGLGENRENDERBUFFERSEXTPROC',
+'PFNGLRENDERBUFFERSTORAGEEXTPROC', 'PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC',
+'PFNGLISFRAMEBUFFEREXTPROC', 'PFNGLBINDFRAMEBUFFEREXTPROC',
+'PFNGLDELETEFRAMEBUFFERSEXTPROC', 'PFNGLGENFRAMEBUFFERSEXTPROC',
+'PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC', 'PFNGLFRAMEBUFFERTEXTURE1DEXTPROC',
+'PFNGLFRAMEBUFFERTEXTURE2DEXTPROC', 'PFNGLFRAMEBUFFERTEXTURE3DEXTPROC',
+'PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC',
+'PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC',
+'PFNGLGENERATEMIPMAPEXTPROC', 'GL_GREMEDY_string_marker',
+'glStringMarkerGREMEDY', 'PFNGLSTRINGMARKERGREMEDYPROC',
+'GL_EXT_packed_depth_stencil', 'GL_EXT_stencil_clear_tag',
+'glStencilClearTagEXT', 'PFNGLSTENCILCLEARTAGEXTPROC', 'GL_EXT_texture_sRGB',
+'GL_EXT_framebuffer_blit', 'glBlitFramebufferEXT',
+'PFNGLBLITFRAMEBUFFEREXTPROC', 'GL_EXT_framebuffer_multisample',
+'glRenderbufferStorageMultisampleEXT',
+'PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC', 'GL_MESAX_texture_stack',
+'GL_EXT_timer_query', 'glGetQueryObjecti64vEXT', 'glGetQueryObjectui64vEXT',
+'PFNGLGETQUERYOBJECTI64VEXTPROC', 'PFNGLGETQUERYOBJECTUI64VEXTPROC',
+'GL_EXT_gpu_program_parameters', 'glProgramEnvParameters4fvEXT',
+'glProgramLocalParameters4fvEXT', 'PFNGLPROGRAMENVPARAMETERS4FVEXTPROC',
+'PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC', 'GL_APPLE_flush_buffer_range',
+'glBufferParameteriAPPLE', 'glFlushMappedBufferRangeAPPLE',
+'PFNGLBUFFERPARAMETERIAPPLEPROC', 'PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC',
+'GL_NV_gpu_program4', 'glProgramLocalParameterI4iNV',
+'glProgramLocalParameterI4ivNV', 'glProgramLocalParametersI4ivNV',
+'glProgramLocalParameterI4uiNV', 'glProgramLocalParameterI4uivNV',
+'glProgramLocalParametersI4uivNV', 'glProgramEnvParameterI4iNV',
+'glProgramEnvParameterI4ivNV', 'glProgramEnvParametersI4ivNV',
+'glProgramEnvParameterI4uiNV', 'glProgramEnvParameterI4uivNV',
+'glProgramEnvParametersI4uivNV', 'glGetProgramLocalParameterIivNV',
+'glGetProgramLocalParameterIuivNV', 'glGetProgramEnvParameterIivNV',
+'glGetProgramEnvParameterIuivNV', 'PFNGLPROGRAMLOCALPARAMETERI4INVPROC',
+'PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC',
+'PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC',
+'PFNGLPROGRAMLOCALPARAMETERI4UINVPROC',
+'PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC',
+'PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC', 'PFNGLPROGRAMENVPARAMETERI4INVPROC',
+'PFNGLPROGRAMENVPARAMETERI4IVNVPROC', 'PFNGLPROGRAMENVPARAMETERSI4IVNVPROC',
+'PFNGLPROGRAMENVPARAMETERI4UINVPROC', 'PFNGLPROGRAMENVPARAMETERI4UIVNVPROC',
+'PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC',
+'PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC',
+'PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC',
+'PFNGLGETPROGRAMENVPARAMETERIIVNVPROC',
+'PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC', 'GL_NV_geometry_program4',
+'glProgramVertexLimitNV', 'glFramebufferTextureEXT',
+'glFramebufferTextureLayerEXT', 'glFramebufferTextureFaceEXT',
+'PFNGLPROGRAMVERTEXLIMITNVPROC', 'PFNGLFRAMEBUFFERTEXTUREEXTPROC',
+'PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC', 'PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC',
+'GL_EXT_geometry_shader4', 'glProgramParameteriEXT',
+'PFNGLPROGRAMPARAMETERIEXTPROC', 'GL_NV_vertex_program4',
+'glVertexAttribI1iEXT', 'glVertexAttribI2iEXT', 'glVertexAttribI3iEXT',
+'glVertexAttribI4iEXT', 'glVertexAttribI1uiEXT', 'glVertexAttribI2uiEXT',
+'glVertexAttribI3uiEXT', 'glVertexAttribI4uiEXT', 'glVertexAttribI1ivEXT',
+'glVertexAttribI2ivEXT', 'glVertexAttribI3ivEXT', 'glVertexAttribI4ivEXT',
+'glVertexAttribI1uivEXT', 'glVertexAttribI2uivEXT', 'glVertexAttribI3uivEXT',
+'glVertexAttribI4uivEXT', 'glVertexAttribI4bvEXT', 'glVertexAttribI4svEXT',
+'glVertexAttribI4ubvEXT', 'glVertexAttribI4usvEXT',
+'glVertexAttribIPointerEXT', 'glGetVertexAttribIivEXT',
+'glGetVertexAttribIuivEXT', 'PFNGLVERTEXATTRIBI1IEXTPROC',
+'PFNGLVERTEXATTRIBI2IEXTPROC', 'PFNGLVERTEXATTRIBI3IEXTPROC',
+'PFNGLVERTEXATTRIBI4IEXTPROC', 'PFNGLVERTEXATTRIBI1UIEXTPROC',
+'PFNGLVERTEXATTRIBI2UIEXTPROC', 'PFNGLVERTEXATTRIBI3UIEXTPROC',
+'PFNGLVERTEXATTRIBI4UIEXTPROC', 'PFNGLVERTEXATTRIBI1IVEXTPROC',
+'PFNGLVERTEXATTRIBI2IVEXTPROC', 'PFNGLVERTEXATTRIBI3IVEXTPROC',
+'PFNGLVERTEXATTRIBI4IVEXTPROC', 'PFNGLVERTEXATTRIBI1UIVEXTPROC',
+'PFNGLVERTEXATTRIBI2UIVEXTPROC', 'PFNGLVERTEXATTRIBI3UIVEXTPROC',
+'PFNGLVERTEXATTRIBI4UIVEXTPROC', 'PFNGLVERTEXATTRIBI4BVEXTPROC',
+'PFNGLVERTEXATTRIBI4SVEXTPROC', 'PFNGLVERTEXATTRIBI4UBVEXTPROC',
+'PFNGLVERTEXATTRIBI4USVEXTPROC', 'PFNGLVERTEXATTRIBIPOINTEREXTPROC',
+'PFNGLGETVERTEXATTRIBIIVEXTPROC', 'PFNGLGETVERTEXATTRIBIUIVEXTPROC',
+'GL_EXT_gpu_shader4', 'glGetUniformuivEXT', 'glBindFragDataLocationEXT',
+'glGetFragDataLocationEXT', 'glUniform1uiEXT', 'glUniform2uiEXT',
+'glUniform3uiEXT', 'glUniform4uiEXT', 'glUniform1uivEXT', 'glUniform2uivEXT',
+'glUniform3uivEXT', 'glUniform4uivEXT', 'PFNGLGETUNIFORMUIVEXTPROC',
+'PFNGLBINDFRAGDATALOCATIONEXTPROC', 'PFNGLGETFRAGDATALOCATIONEXTPROC',
+'PFNGLUNIFORM1UIEXTPROC', 'PFNGLUNIFORM2UIEXTPROC', 'PFNGLUNIFORM3UIEXTPROC',
+'PFNGLUNIFORM4UIEXTPROC', 'PFNGLUNIFORM1UIVEXTPROC',
+'PFNGLUNIFORM2UIVEXTPROC', 'PFNGLUNIFORM3UIVEXTPROC',
+'PFNGLUNIFORM4UIVEXTPROC', 'GL_EXT_draw_instanced',
+'glDrawArraysInstancedEXT', 'glDrawElementsInstancedEXT',
+'PFNGLDRAWARRAYSINSTANCEDEXTPROC', 'PFNGLDRAWELEMENTSINSTANCEDEXTPROC',
+'GL_EXT_packed_float', 'GL_EXT_texture_array', 'GL_EXT_texture_buffer_object',
+'glTexBufferEXT', 'PFNGLTEXBUFFEREXTPROC', 'GL_EXT_texture_compression_latc',
+'GL_EXT_texture_compression_rgtc', 'GL_EXT_texture_shared_exponent',
+'GL_NV_depth_buffer_float', 'glDepthRangedNV', 'glClearDepthdNV',
+'glDepthBoundsdNV', 'PFNGLDEPTHRANGEDNVPROC', 'PFNGLCLEARDEPTHDNVPROC',
+'PFNGLDEPTHBOUNDSDNVPROC', 'GL_NV_fragment_program4',
+'GL_NV_framebuffer_multisample_coverage',
+'glRenderbufferStorageMultisampleCoverageNV',
+'PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC',
+'GL_EXT_framebuffer_sRGB', 'GL_NV_geometry_shader4',
+'GL_NV_parameter_buffer_object', 'glProgramBufferParametersfvNV',
+'glProgramBufferParametersIivNV', 'glProgramBufferParametersIuivNV',
+'PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC',
+'PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC',
+'PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC', 'GL_EXT_draw_buffers2',
+'glColorMaskIndexedEXT', 'glGetBooleanIndexedvEXT', 'glGetIntegerIndexedvEXT',
+'glEnableIndexedEXT', 'glDisableIndexedEXT', 'glIsEnabledIndexedEXT',
+'PFNGLCOLORMASKINDEXEDEXTPROC', 'PFNGLGETBOOLEANINDEXEDVEXTPROC',
+'PFNGLGETINTEGERINDEXEDVEXTPROC', 'PFNGLENABLEINDEXEDEXTPROC',
+'PFNGLDISABLEINDEXEDEXTPROC', 'PFNGLISENABLEDINDEXEDEXTPROC',
+'GL_NV_transform_feedback', 'glBeginTransformFeedbackNV',
+'glEndTransformFeedbackNV', 'glTransformFeedbackAttribsNV',
+'glBindBufferRangeNV', 'glBindBufferOffsetNV', 'glBindBufferBaseNV',
+'glTransformFeedbackVaryingsNV', 'glActiveVaryingNV',
+'glGetVaryingLocationNV', 'glGetActiveVaryingNV',
+'glGetTransformFeedbackVaryingNV', 'glTransformFeedbackStreamAttribsNV',
+'PFNGLBEGINTRANSFORMFEEDBACKNVPROC', 'PFNGLENDTRANSFORMFEEDBACKNVPROC',
+'PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC', 'PFNGLBINDBUFFERRANGENVPROC',
+'PFNGLBINDBUFFEROFFSETNVPROC', 'PFNGLBINDBUFFERBASENVPROC',
+'PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC', 'PFNGLACTIVEVARYINGNVPROC',
+'PFNGLGETVARYINGLOCATIONNVPROC', 'PFNGLGETACTIVEVARYINGNVPROC',
+'PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC',
+'PFNGLTRANSFORMFEEDBACKSTREAMATTRIBSNVPROC', 'GL_EXT_bindable_uniform',
+'glUniformBufferEXT', 'glGetUniformBufferSizeEXT', 'glGetUniformOffsetEXT',
+'PFNGLUNIFORMBUFFEREXTPROC', 'PFNGLGETUNIFORMBUFFERSIZEEXTPROC',
+'PFNGLGETUNIFORMOFFSETEXTPROC', 'GL_EXT_texture_integer',
+'glTexParameterIivEXT', 'glTexParameterIuivEXT', 'glGetTexParameterIivEXT',
+'glGetTexParameterIuivEXT', 'glClearColorIiEXT', 'glClearColorIuiEXT',
+'PFNGLTEXPARAMETERIIVEXTPROC', 'PFNGLTEXPARAMETERIUIVEXTPROC',
+'PFNGLGETTEXPARAMETERIIVEXTPROC', 'PFNGLGETTEXPARAMETERIUIVEXTPROC',
+'PFNGLCLEARCOLORIIEXTPROC', 'PFNGLCLEARCOLORIUIEXTPROC',
+'GL_GREMEDY_frame_terminator', 'glFrameTerminatorGREMEDY',
+'PFNGLFRAMETERMINATORGREMEDYPROC', 'GL_NV_conditional_render',
+'glBeginConditionalRenderNV', 'glEndConditionalRenderNV',
+'PFNGLBEGINCONDITIONALRENDERNVPROC', 'PFNGLENDCONDITIONALRENDERNVPROC',
+'GL_NV_present_video', 'glPresentFrameKeyedNV', 'glPresentFrameDualFillNV',
+'glGetVideoivNV', 'glGetVideouivNV', 'glGetVideoi64vNV', 'glGetVideoui64vNV',
+'PFNGLPRESENTFRAMEKEYEDNVPROC', 'PFNGLPRESENTFRAMEDUALFILLNVPROC',
+'PFNGLGETVIDEOIVNVPROC', 'PFNGLGETVIDEOUIVNVPROC', 'PFNGLGETVIDEOI64VNVPROC',
+'PFNGLGETVIDEOUI64VNVPROC', 'GL_EXT_transform_feedback',
+'glBeginTransformFeedbackEXT', 'glEndTransformFeedbackEXT',
+'glBindBufferRangeEXT', 'glBindBufferOffsetEXT', 'glBindBufferBaseEXT',
+'glTransformFeedbackVaryingsEXT', 'glGetTransformFeedbackVaryingEXT',
+'PFNGLBEGINTRANSFORMFEEDBACKEXTPROC', 'PFNGLENDTRANSFORMFEEDBACKEXTPROC',
+'PFNGLBINDBUFFERRANGEEXTPROC', 'PFNGLBINDBUFFEROFFSETEXTPROC',
+'PFNGLBINDBUFFERBASEEXTPROC', 'PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC',
+'PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC', 'GL_EXT_direct_state_access',
+'glClientAttribDefaultEXT', 'glPushClientAttribDefaultEXT',
+'glMatrixLoadfEXT', 'glMatrixLoaddEXT', 'glMatrixMultfEXT',
+'glMatrixMultdEXT', 'glMatrixLoadIdentityEXT', 'glMatrixRotatefEXT',
+'glMatrixRotatedEXT', 'glMatrixScalefEXT', 'glMatrixScaledEXT',
+'glMatrixTranslatefEXT', 'glMatrixTranslatedEXT', 'glMatrixFrustumEXT',
+'glMatrixOrthoEXT', 'glMatrixPopEXT', 'glMatrixPushEXT',
+'glMatrixLoadTransposefEXT', 'glMatrixLoadTransposedEXT',
+'glMatrixMultTransposefEXT', 'glMatrixMultTransposedEXT',
+'glTextureParameterfEXT', 'glTextureParameterfvEXT', 'glTextureParameteriEXT',
+'glTextureParameterivEXT', 'glTextureImage1DEXT', 'glTextureImage2DEXT',
+'glTextureSubImage1DEXT', 'glTextureSubImage2DEXT', 'glCopyTextureImage1DEXT',
+'glCopyTextureImage2DEXT', 'glCopyTextureSubImage1DEXT',
+'glCopyTextureSubImage2DEXT', 'glGetTextureImageEXT',
+'glGetTextureParameterfvEXT', 'glGetTextureParameterivEXT',
+'glGetTextureLevelParameterfvEXT', 'glGetTextureLevelParameterivEXT',
+'glTextureImage3DEXT', 'glTextureSubImage3DEXT', 'glCopyTextureSubImage3DEXT',
+'glMultiTexParameterfEXT', 'glMultiTexParameterfvEXT',
+'glMultiTexParameteriEXT', 'glMultiTexParameterivEXT', 'glMultiTexImage1DEXT',
+'glMultiTexImage2DEXT', 'glMultiTexSubImage1DEXT', 'glMultiTexSubImage2DEXT',
+'glCopyMultiTexImage1DEXT', 'glCopyMultiTexImage2DEXT',
+'glCopyMultiTexSubImage1DEXT', 'glCopyMultiTexSubImage2DEXT',
+'glGetMultiTexImageEXT', 'glGetMultiTexParameterfvEXT',
+'glGetMultiTexParameterivEXT', 'glGetMultiTexLevelParameterfvEXT',
+'glGetMultiTexLevelParameterivEXT', 'glMultiTexImage3DEXT',
+'glMultiTexSubImage3DEXT', 'glCopyMultiTexSubImage3DEXT',
+'glBindMultiTextureEXT', 'glEnableClientStateIndexedEXT',
+'glDisableClientStateIndexedEXT', 'glMultiTexCoordPointerEXT',
+'glMultiTexEnvfEXT', 'glMultiTexEnvfvEXT', 'glMultiTexEnviEXT',
+'glMultiTexEnvivEXT', 'glMultiTexGendEXT', 'glMultiTexGendvEXT',
+'glMultiTexGenfEXT', 'glMultiTexGenfvEXT', 'glMultiTexGeniEXT',
+'glMultiTexGenivEXT', 'glGetMultiTexEnvfvEXT', 'glGetMultiTexEnvivEXT',
+'glGetMultiTexGendvEXT', 'glGetMultiTexGenfvEXT', 'glGetMultiTexGenivEXT',
+'glGetFloatIndexedvEXT', 'glGetDoubleIndexedvEXT', 'glGetPointerIndexedvEXT',
+'glCompressedTextureImage3DEXT', 'glCompressedTextureImage2DEXT',
+'glCompressedTextureImage1DEXT', 'glCompressedTextureSubImage3DEXT',
+'glCompressedTextureSubImage2DEXT', 'glCompressedTextureSubImage1DEXT',
+'glGetCompressedTextureImageEXT', 'glCompressedMultiTexImage3DEXT',
+'glCompressedMultiTexImage2DEXT', 'glCompressedMultiTexImage1DEXT',
+'glCompressedMultiTexSubImage3DEXT', 'glCompressedMultiTexSubImage2DEXT',
+'glCompressedMultiTexSubImage1DEXT', 'glGetCompressedMultiTexImageEXT',
+'glNamedProgramStringEXT', 'glNamedProgramLocalParameter4dEXT',
+'glNamedProgramLocalParameter4dvEXT', 'glNamedProgramLocalParameter4fEXT',
+'glNamedProgramLocalParameter4fvEXT', 'glGetNamedProgramLocalParameterdvEXT',
+'glGetNamedProgramLocalParameterfvEXT', 'glGetNamedProgramivEXT',
+'glGetNamedProgramStringEXT', 'glNamedProgramLocalParameters4fvEXT',
+'glNamedProgramLocalParameterI4iEXT', 'glNamedProgramLocalParameterI4ivEXT',
+'glNamedProgramLocalParametersI4ivEXT', 'glNamedProgramLocalParameterI4uiEXT',
+'glNamedProgramLocalParameterI4uivEXT',
+'glNamedProgramLocalParametersI4uivEXT',
+'glGetNamedProgramLocalParameterIivEXT',
+'glGetNamedProgramLocalParameterIuivEXT', 'glTextureParameterIivEXT',
+'glTextureParameterIuivEXT', 'glGetTextureParameterIivEXT',
+'glGetTextureParameterIuivEXT', 'glMultiTexParameterIivEXT',
+'glMultiTexParameterIuivEXT', 'glGetMultiTexParameterIivEXT',
+'glGetMultiTexParameterIuivEXT', 'glProgramUniform1fEXT',
+'glProgramUniform2fEXT', 'glProgramUniform3fEXT', 'glProgramUniform4fEXT',
+'glProgramUniform1iEXT', 'glProgramUniform2iEXT', 'glProgramUniform3iEXT',
+'glProgramUniform4iEXT', 'glProgramUniform1fvEXT', 'glProgramUniform2fvEXT',
+'glProgramUniform3fvEXT', 'glProgramUniform4fvEXT', 'glProgramUniform1ivEXT',
+'glProgramUniform2ivEXT', 'glProgramUniform3ivEXT', 'glProgramUniform4ivEXT',
+'glProgramUniformMatrix2fvEXT', 'glProgramUniformMatrix3fvEXT',
+'glProgramUniformMatrix4fvEXT', 'glProgramUniformMatrix2x3fvEXT',
+'glProgramUniformMatrix3x2fvEXT', 'glProgramUniformMatrix2x4fvEXT',
+'glProgramUniformMatrix4x2fvEXT', 'glProgramUniformMatrix3x4fvEXT',
+'glProgramUniformMatrix4x3fvEXT', 'glProgramUniform1uiEXT',
+'glProgramUniform2uiEXT', 'glProgramUniform3uiEXT', 'glProgramUniform4uiEXT',
+'glProgramUniform1uivEXT', 'glProgramUniform2uivEXT',
+'glProgramUniform3uivEXT', 'glProgramUniform4uivEXT', 'glNamedBufferDataEXT',
+'glNamedBufferSubDataEXT', 'glMapNamedBufferEXT', 'glUnmapNamedBufferEXT',
+'glMapNamedBufferRangeEXT', 'glFlushMappedNamedBufferRangeEXT',
+'glNamedCopyBufferSubDataEXT', 'glGetNamedBufferParameterivEXT',
+'glGetNamedBufferPointervEXT', 'glGetNamedBufferSubDataEXT',
+'glTextureBufferEXT', 'glMultiTexBufferEXT', 'glNamedRenderbufferStorageEXT',
+'glGetNamedRenderbufferParameterivEXT', 'glCheckNamedFramebufferStatusEXT',
+'glNamedFramebufferTexture1DEXT', 'glNamedFramebufferTexture2DEXT',
+'glNamedFramebufferTexture3DEXT', 'glNamedFramebufferRenderbufferEXT',
+'glGetNamedFramebufferAttachmentParameterivEXT', 'glGenerateTextureMipmapEXT',
+'glGenerateMultiTexMipmapEXT', 'glFramebufferDrawBufferEXT',
+'glFramebufferDrawBuffersEXT', 'glFramebufferReadBufferEXT',
+'glGetFramebufferParameterivEXT', 'glNamedRenderbufferStorageMultisampleEXT',
+'glNamedRenderbufferStorageMultisampleCoverageEXT',
+'glNamedFramebufferTextureEXT', 'glNamedFramebufferTextureLayerEXT',
+'glNamedFramebufferTextureFaceEXT', 'glTextureRenderbufferEXT',
+'glMultiTexRenderbufferEXT', 'glProgramUniform1dEXT', 'glProgramUniform2dEXT',
+'glProgramUniform3dEXT', 'glProgramUniform4dEXT', 'glProgramUniform1dvEXT',
+'glProgramUniform2dvEXT', 'glProgramUniform3dvEXT', 'glProgramUniform4dvEXT',
+'glProgramUniformMatrix2dvEXT', 'glProgramUniformMatrix3dvEXT',
+'glProgramUniformMatrix4dvEXT', 'glProgramUniformMatrix2x3dvEXT',
+'glProgramUniformMatrix2x4dvEXT', 'glProgramUniformMatrix3x2dvEXT',
+'glProgramUniformMatrix3x4dvEXT', 'glProgramUniformMatrix4x2dvEXT',
+'glProgramUniformMatrix4x3dvEXT', 'PFNGLCLIENTATTRIBDEFAULTEXTPROC',
+'PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC', 'PFNGLMATRIXLOADFEXTPROC',
+'PFNGLMATRIXLOADDEXTPROC', 'PFNGLMATRIXMULTFEXTPROC',
+'PFNGLMATRIXMULTDEXTPROC', 'PFNGLMATRIXLOADIDENTITYEXTPROC',
+'PFNGLMATRIXROTATEFEXTPROC', 'PFNGLMATRIXROTATEDEXTPROC',
+'PFNGLMATRIXSCALEFEXTPROC', 'PFNGLMATRIXSCALEDEXTPROC',
+'PFNGLMATRIXTRANSLATEFEXTPROC', 'PFNGLMATRIXTRANSLATEDEXTPROC',
+'PFNGLMATRIXFRUSTUMEXTPROC', 'PFNGLMATRIXORTHOEXTPROC',
+'PFNGLMATRIXPOPEXTPROC', 'PFNGLMATRIXPUSHEXTPROC',
+'PFNGLMATRIXLOADTRANSPOSEFEXTPROC', 'PFNGLMATRIXLOADTRANSPOSEDEXTPROC',
+'PFNGLMATRIXMULTTRANSPOSEFEXTPROC', 'PFNGLMATRIXMULTTRANSPOSEDEXTPROC',
+'PFNGLTEXTUREPARAMETERFEXTPROC', 'PFNGLTEXTUREPARAMETERFVEXTPROC',
+'PFNGLTEXTUREPARAMETERIEXTPROC', 'PFNGLTEXTUREPARAMETERIVEXTPROC',
+'PFNGLTEXTUREIMAGE1DEXTPROC', 'PFNGLTEXTUREIMAGE2DEXTPROC',
+'PFNGLTEXTURESUBIMAGE1DEXTPROC', 'PFNGLTEXTURESUBIMAGE2DEXTPROC',
+'PFNGLCOPYTEXTUREIMAGE1DEXTPROC', 'PFNGLCOPYTEXTUREIMAGE2DEXTPROC',
+'PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC', 'PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC',
+'PFNGLGETTEXTUREIMAGEEXTPROC', 'PFNGLGETTEXTUREPARAMETERFVEXTPROC',
+'PFNGLGETTEXTUREPARAMETERIVEXTPROC', 'PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC',
+'PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC', 'PFNGLTEXTUREIMAGE3DEXTPROC',
+'PFNGLTEXTURESUBIMAGE3DEXTPROC', 'PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC',
+'PFNGLMULTITEXPARAMETERFEXTPROC', 'PFNGLMULTITEXPARAMETERFVEXTPROC',
+'PFNGLMULTITEXPARAMETERIEXTPROC', 'PFNGLMULTITEXPARAMETERIVEXTPROC',
+'PFNGLMULTITEXIMAGE1DEXTPROC', 'PFNGLMULTITEXIMAGE2DEXTPROC',
+'PFNGLMULTITEXSUBIMAGE1DEXTPROC', 'PFNGLMULTITEXSUBIMAGE2DEXTPROC',
+'PFNGLCOPYMULTITEXIMAGE1DEXTPROC', 'PFNGLCOPYMULTITEXIMAGE2DEXTPROC',
+'PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC', 'PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC',
+'PFNGLGETMULTITEXIMAGEEXTPROC', 'PFNGLGETMULTITEXPARAMETERFVEXTPROC',
+'PFNGLGETMULTITEXPARAMETERIVEXTPROC',
+'PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC',
+'PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC', 'PFNGLMULTITEXIMAGE3DEXTPROC',
+'PFNGLMULTITEXSUBIMAGE3DEXTPROC', 'PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC',
+'PFNGLBINDMULTITEXTUREEXTPROC', 'PFNGLENABLECLIENTSTATEINDEXEDEXTPROC',
+'PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC', 'PFNGLMULTITEXCOORDPOINTEREXTPROC',
+'PFNGLMULTITEXENVFEXTPROC', 'PFNGLMULTITEXENVFVEXTPROC',
+'PFNGLMULTITEXENVIEXTPROC', 'PFNGLMULTITEXENVIVEXTPROC',
+'PFNGLMULTITEXGENDEXTPROC', 'PFNGLMULTITEXGENDVEXTPROC',
+'PFNGLMULTITEXGENFEXTPROC', 'PFNGLMULTITEXGENFVEXTPROC',
+'PFNGLMULTITEXGENIEXTPROC', 'PFNGLMULTITEXGENIVEXTPROC',
+'PFNGLGETMULTITEXENVFVEXTPROC', 'PFNGLGETMULTITEXENVIVEXTPROC',
+'PFNGLGETMULTITEXGENDVEXTPROC', 'PFNGLGETMULTITEXGENFVEXTPROC',
+'PFNGLGETMULTITEXGENIVEXTPROC', 'PFNGLGETFLOATINDEXEDVEXTPROC',
+'PFNGLGETDOUBLEINDEXEDVEXTPROC', 'PFNGLGETPOINTERINDEXEDVEXTPROC',
+'PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC',
+'PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC',
+'PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC',
+'PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC',
+'PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC',
+'PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC',
+'PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC',
+'PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC',
+'PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC',
+'PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC',
+'PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC',
+'PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC',
+'PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC',
+'PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC', 'PFNGLNAMEDPROGRAMSTRINGEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC',
+'PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC',
+'PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC',
+'PFNGLGETNAMEDPROGRAMIVEXTPROC', 'PFNGLGETNAMEDPROGRAMSTRINGEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC',
+'PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC',
+'PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC',
+'PFNGLTEXTUREPARAMETERIIVEXTPROC', 'PFNGLTEXTUREPARAMETERIUIVEXTPROC',
+'PFNGLGETTEXTUREPARAMETERIIVEXTPROC', 'PFNGLGETTEXTUREPARAMETERIUIVEXTPROC',
+'PFNGLMULTITEXPARAMETERIIVEXTPROC', 'PFNGLMULTITEXPARAMETERIUIVEXTPROC',
+'PFNGLGETMULTITEXPARAMETERIIVEXTPROC', 'PFNGLGETMULTITEXPARAMETERIUIVEXTPROC',
+'PFNGLPROGRAMUNIFORM1FEXTPROC', 'PFNGLPROGRAMUNIFORM2FEXTPROC',
+'PFNGLPROGRAMUNIFORM3FEXTPROC', 'PFNGLPROGRAMUNIFORM4FEXTPROC',
+'PFNGLPROGRAMUNIFORM1IEXTPROC', 'PFNGLPROGRAMUNIFORM2IEXTPROC',
+'PFNGLPROGRAMUNIFORM3IEXTPROC', 'PFNGLPROGRAMUNIFORM4IEXTPROC',
+'PFNGLPROGRAMUNIFORM1FVEXTPROC', 'PFNGLPROGRAMUNIFORM2FVEXTPROC',
+'PFNGLPROGRAMUNIFORM3FVEXTPROC', 'PFNGLPROGRAMUNIFORM4FVEXTPROC',
+'PFNGLPROGRAMUNIFORM1IVEXTPROC', 'PFNGLPROGRAMUNIFORM2IVEXTPROC',
+'PFNGLPROGRAMUNIFORM3IVEXTPROC', 'PFNGLPROGRAMUNIFORM4IVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC', 'PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC', 'PFNGLPROGRAMUNIFORM1UIEXTPROC',
+'PFNGLPROGRAMUNIFORM2UIEXTPROC', 'PFNGLPROGRAMUNIFORM3UIEXTPROC',
+'PFNGLPROGRAMUNIFORM4UIEXTPROC', 'PFNGLPROGRAMUNIFORM1UIVEXTPROC',
+'PFNGLPROGRAMUNIFORM2UIVEXTPROC', 'PFNGLPROGRAMUNIFORM3UIVEXTPROC',
+'PFNGLPROGRAMUNIFORM4UIVEXTPROC', 'PFNGLNAMEDBUFFERDATAEXTPROC',
+'PFNGLNAMEDBUFFERSUBDATAEXTPROC', 'PFNGLMAPNAMEDBUFFEREXTPROC',
+'PFNGLUNMAPNAMEDBUFFEREXTPROC', 'PFNGLMAPNAMEDBUFFERRANGEEXTPROC',
+'PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC',
+'PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC', 'PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC',
+'PFNGLGETNAMEDBUFFERPOINTERVEXTPROC', 'PFNGLGETNAMEDBUFFERSUBDATAEXTPROC',
+'PFNGLTEXTUREBUFFEREXTPROC', 'PFNGLMULTITEXBUFFEREXTPROC',
+'PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC',
+'PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC',
+'PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC',
+'PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC',
+'PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC',
+'PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC',
+'PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC',
+'PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC',
+'PFNGLGENERATETEXTUREMIPMAPEXTPROC', 'PFNGLGENERATEMULTITEXMIPMAPEXTPROC',
+'PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC', 'PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC',
+'PFNGLFRAMEBUFFERREADBUFFEREXTPROC', 'PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC',
+'PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC',
+'PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC',
+'PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC',
+'PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC',
+'PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC', 'PFNGLTEXTURERENDERBUFFEREXTPROC',
+'PFNGLMULTITEXRENDERBUFFEREXTPROC', 'PFNGLPROGRAMUNIFORM1DEXTPROC',
+'PFNGLPROGRAMUNIFORM2DEXTPROC', 'PFNGLPROGRAMUNIFORM3DEXTPROC',
+'PFNGLPROGRAMUNIFORM4DEXTPROC', 'PFNGLPROGRAMUNIFORM1DVEXTPROC',
+'PFNGLPROGRAMUNIFORM2DVEXTPROC', 'PFNGLPROGRAMUNIFORM3DVEXTPROC',
+'PFNGLPROGRAMUNIFORM4DVEXTPROC', 'PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC', 'PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC', 'GL_EXT_vertex_array_bgra',
+'GL_EXT_texture_swizzle', 'GL_NV_explicit_multisample',
+'glGetMultisamplefvNV', 'glSampleMaskIndexedNV', 'glTexRenderbufferNV',
+'PFNGLGETMULTISAMPLEFVNVPROC', 'PFNGLSAMPLEMASKINDEXEDNVPROC',
+'PFNGLTEXRENDERBUFFERNVPROC', 'GL_NV_transform_feedback2',
+'glBindTransformFeedbackNV', 'glDeleteTransformFeedbacksNV',
+'glGenTransformFeedbacksNV', 'glIsTransformFeedbackNV',
+'glPauseTransformFeedbackNV', 'glResumeTransformFeedbackNV',
+'glDrawTransformFeedbackNV', 'PFNGLBINDTRANSFORMFEEDBACKNVPROC',
+'PFNGLDELETETRANSFORMFEEDBACKSNVPROC', 'PFNGLGENTRANSFORMFEEDBACKSNVPROC',
+'PFNGLISTRANSFORMFEEDBACKNVPROC', 'PFNGLPAUSETRANSFORMFEEDBACKNVPROC',
+'PFNGLRESUMETRANSFORMFEEDBACKNVPROC', 'PFNGLDRAWTRANSFORMFEEDBACKNVPROC',
+'GL_ATI_meminfo', 'GL_AMD_performance_monitor', 'glGetPerfMonitorGroupsAMD',
+'glGetPerfMonitorCountersAMD', 'glGetPerfMonitorGroupStringAMD',
+'glGetPerfMonitorCounterStringAMD', 'glGetPerfMonitorCounterInfoAMD',
+'glGenPerfMonitorsAMD', 'glDeletePerfMonitorsAMD',
+'glSelectPerfMonitorCountersAMD', 'glBeginPerfMonitorAMD',
+'glEndPerfMonitorAMD', 'glGetPerfMonitorCounterDataAMD',
+'PFNGLGETPERFMONITORGROUPSAMDPROC', 'PFNGLGETPERFMONITORCOUNTERSAMDPROC',
+'PFNGLGETPERFMONITORGROUPSTRINGAMDPROC',
+'PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC',
+'PFNGLGETPERFMONITORCOUNTERINFOAMDPROC', 'PFNGLGENPERFMONITORSAMDPROC',
+'PFNGLDELETEPERFMONITORSAMDPROC', 'PFNGLSELECTPERFMONITORCOUNTERSAMDPROC',
+'PFNGLBEGINPERFMONITORAMDPROC', 'PFNGLENDPERFMONITORAMDPROC',
+'PFNGLGETPERFMONITORCOUNTERDATAAMDPROC', 'GL_AMD_texture_texture4',
+'GL_AMD_vertex_shader_tesselator', 'glTessellationFactorAMD',
+'glTessellationModeAMD', 'PFNGLTESSELLATIONFACTORAMDPROC',
+'PFNGLTESSELLATIONMODEAMDPROC', 'GL_EXT_provoking_vertex',
+'glProvokingVertexEXT', 'PFNGLPROVOKINGVERTEXEXTPROC', 'GL_EXT_texture_snorm',
+'GL_AMD_draw_buffers_blend', 'glBlendFuncIndexedAMD',
+'glBlendFuncSeparateIndexedAMD', 'glBlendEquationIndexedAMD',
+'glBlendEquationSeparateIndexedAMD', 'PFNGLBLENDFUNCINDEXEDAMDPROC',
+'PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC', 'PFNGLBLENDEQUATIONINDEXEDAMDPROC',
+'PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC', 'GL_APPLE_texture_range',
+'glTextureRangeAPPLE', 'glGetTexParameterPointervAPPLE',
+'PFNGLTEXTURERANGEAPPLEPROC', 'PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC',
+'GL_APPLE_float_pixels', 'GL_APPLE_vertex_program_evaluators',
+'glEnableVertexAttribAPPLE', 'glDisableVertexAttribAPPLE',
+'glIsVertexAttribEnabledAPPLE', 'glMapVertexAttrib1dAPPLE',
+'glMapVertexAttrib1fAPPLE', 'glMapVertexAttrib2dAPPLE',
+'glMapVertexAttrib2fAPPLE', 'PFNGLENABLEVERTEXATTRIBAPPLEPROC',
+'PFNGLDISABLEVERTEXATTRIBAPPLEPROC', 'PFNGLISVERTEXATTRIBENABLEDAPPLEPROC',
+'PFNGLMAPVERTEXATTRIB1DAPPLEPROC', 'PFNGLMAPVERTEXATTRIB1FAPPLEPROC',
+'PFNGLMAPVERTEXATTRIB2DAPPLEPROC', 'PFNGLMAPVERTEXATTRIB2FAPPLEPROC',
+'GL_APPLE_aux_depth_stencil', 'GL_APPLE_object_purgeable',
+'glObjectPurgeableAPPLE', 'glObjectUnpurgeableAPPLE',
+'glGetObjectParameterivAPPLE', 'PFNGLOBJECTPURGEABLEAPPLEPROC',
+'PFNGLOBJECTUNPURGEABLEAPPLEPROC', 'PFNGLGETOBJECTPARAMETERIVAPPLEPROC',
+'GL_APPLE_row_bytes', 'GL_APPLE_rgb_422', 'GL_NV_video_capture',
+'glBeginVideoCaptureNV', 'glBindVideoCaptureStreamBufferNV',
+'glBindVideoCaptureStreamTextureNV', 'glEndVideoCaptureNV',
+'glGetVideoCaptureivNV', 'glGetVideoCaptureStreamivNV',
+'glGetVideoCaptureStreamfvNV', 'glGetVideoCaptureStreamdvNV',
+'glVideoCaptureNV', 'glVideoCaptureStreamParameterivNV',
+'glVideoCaptureStreamParameterfvNV', 'glVideoCaptureStreamParameterdvNV',
+'PFNGLBEGINVIDEOCAPTURENVPROC', 'PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC',
+'PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC', 'PFNGLENDVIDEOCAPTURENVPROC',
+'PFNGLGETVIDEOCAPTUREIVNVPROC', 'PFNGLGETVIDEOCAPTURESTREAMIVNVPROC',
+'PFNGLGETVIDEOCAPTURESTREAMFVNVPROC', 'PFNGLGETVIDEOCAPTURESTREAMDVNVPROC',
+'PFNGLVIDEOCAPTURENVPROC', 'PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC',
+'PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC',
+'PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC', 'GL_NV_copy_image',
+'glCopyImageSubDataNV', 'PFNGLCOPYIMAGESUBDATANVPROC',
+'GL_EXT_separate_shader_objects', 'glUseShaderProgramEXT',
+'glActiveProgramEXT', 'glCreateShaderProgramEXT',
+'PFNGLUSESHADERPROGRAMEXTPROC', 'PFNGLACTIVEPROGRAMEXTPROC',
+'PFNGLCREATESHADERPROGRAMEXTPROC', 'GL_NV_parameter_buffer_object2',
+'GL_NV_shader_buffer_load', 'glMakeBufferResidentNV',
+'glMakeBufferNonResidentNV', 'glIsBufferResidentNV',
+'glMakeNamedBufferResidentNV', 'glMakeNamedBufferNonResidentNV',
+'glIsNamedBufferResidentNV', 'glGetBufferParameterui64vNV',
+'glGetNamedBufferParameterui64vNV', 'glGetIntegerui64vNV', 'glUniformui64NV',
+'glUniformui64vNV', 'glGetUniformui64vNV', 'glProgramUniformui64NV',
+'glProgramUniformui64vNV', 'PFNGLMAKEBUFFERRESIDENTNVPROC',
+'PFNGLMAKEBUFFERNONRESIDENTNVPROC', 'PFNGLISBUFFERRESIDENTNVPROC',
+'PFNGLMAKENAMEDBUFFERRESIDENTNVPROC', 'PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC',
+'PFNGLISNAMEDBUFFERRESIDENTNVPROC', 'PFNGLGETBUFFERPARAMETERUI64VNVPROC',
+'PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC', 'PFNGLGETINTEGERUI64VNVPROC',
+'PFNGLUNIFORMUI64NVPROC', 'PFNGLUNIFORMUI64VNVPROC',
+'PFNGLGETUNIFORMUI64VNVPROC', 'PFNGLPROGRAMUNIFORMUI64NVPROC',
+'PFNGLPROGRAMUNIFORMUI64VNVPROC', 'GL_NV_vertex_buffer_unified_memory',
+'glBufferAddressRangeNV', 'glVertexFormatNV', 'glNormalFormatNV',
+'glColorFormatNV', 'glIndexFormatNV', 'glTexCoordFormatNV',
+'glEdgeFlagFormatNV', 'glSecondaryColorFormatNV', 'glFogCoordFormatNV',
+'glVertexAttribFormatNV', 'glVertexAttribIFormatNV', 'glGetIntegerui64i_vNV',
+'PFNGLBUFFERADDRESSRANGENVPROC', 'PFNGLVERTEXFORMATNVPROC',
+'PFNGLNORMALFORMATNVPROC', 'PFNGLCOLORFORMATNVPROC', 'PFNGLINDEXFORMATNVPROC',
+'PFNGLTEXCOORDFORMATNVPROC', 'PFNGLEDGEFLAGFORMATNVPROC',
+'PFNGLSECONDARYCOLORFORMATNVPROC', 'PFNGLFOGCOORDFORMATNVPROC',
+'PFNGLVERTEXATTRIBFORMATNVPROC', 'PFNGLVERTEXATTRIBIFORMATNVPROC',
+'PFNGLGETINTEGERUI64I_VNVPROC', 'GL_NV_texture_barrier', 'glTextureBarrierNV',
+'PFNGLTEXTUREBARRIERNVPROC', 'GL_AMD_shader_stencil_export',
+'GL_AMD_seamless_cubemap_per_texture', 'GL_AMD_conservative_depth',
+'GL_EXT_shader_image_load_store', 'glBindImageTextureEXT',
+'glMemoryBarrierEXT', 'PFNGLBINDIMAGETEXTUREEXTPROC',
+'PFNGLMEMORYBARRIEREXTPROC', 'GL_EXT_vertex_attrib_64bit',
+'glVertexAttribL1dEXT', 'glVertexAttribL2dEXT', 'glVertexAttribL3dEXT',
+'glVertexAttribL4dEXT', 'glVertexAttribL1dvEXT', 'glVertexAttribL2dvEXT',
+'glVertexAttribL3dvEXT', 'glVertexAttribL4dvEXT', 'glVertexAttribLPointerEXT',
+'glGetVertexAttribLdvEXT', 'glVertexArrayVertexAttribLOffsetEXT',
+'PFNGLVERTEXATTRIBL1DEXTPROC', 'PFNGLVERTEXATTRIBL2DEXTPROC',
+'PFNGLVERTEXATTRIBL3DEXTPROC', 'PFNGLVERTEXATTRIBL4DEXTPROC',
+'PFNGLVERTEXATTRIBL1DVEXTPROC', 'PFNGLVERTEXATTRIBL2DVEXTPROC',
+'PFNGLVERTEXATTRIBL3DVEXTPROC', 'PFNGLVERTEXATTRIBL4DVEXTPROC',
+'PFNGLVERTEXATTRIBLPOINTEREXTPROC', 'PFNGLGETVERTEXATTRIBLDVEXTPROC',
+'PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC', 'GL_NV_gpu_program5',
+'glProgramSubroutineParametersuivNV', 'glGetProgramSubroutineParameteruivNV',
+'PFNGLPROGRAMSUBROUTINEPARAMETERSUIVNVPROC',
+'PFNGLGETPROGRAMSUBROUTINEPARAMETERUIVNVPROC', 'GL_NV_gpu_shader5',
+'glUniform1i64NV', 'glUniform2i64NV', 'glUniform3i64NV', 'glUniform4i64NV',
+'glUniform1i64vNV', 'glUniform2i64vNV', 'glUniform3i64vNV',
+'glUniform4i64vNV', 'glUniform1ui64NV', 'glUniform2ui64NV',
+'glUniform3ui64NV', 'glUniform4ui64NV', 'glUniform1ui64vNV',
+'glUniform2ui64vNV', 'glUniform3ui64vNV', 'glUniform4ui64vNV',
+'glGetUniformi64vNV', 'glProgramUniform1i64NV', 'glProgramUniform2i64NV',
+'glProgramUniform3i64NV', 'glProgramUniform4i64NV', 'glProgramUniform1i64vNV',
+'glProgramUniform2i64vNV', 'glProgramUniform3i64vNV',
+'glProgramUniform4i64vNV', 'glProgramUniform1ui64NV',
+'glProgramUniform2ui64NV', 'glProgramUniform3ui64NV',
+'glProgramUniform4ui64NV', 'glProgramUniform1ui64vNV',
+'glProgramUniform2ui64vNV', 'glProgramUniform3ui64vNV',
+'glProgramUniform4ui64vNV', 'PFNGLUNIFORM1I64NVPROC',
+'PFNGLUNIFORM2I64NVPROC', 'PFNGLUNIFORM3I64NVPROC', 'PFNGLUNIFORM4I64NVPROC',
+'PFNGLUNIFORM1I64VNVPROC', 'PFNGLUNIFORM2I64VNVPROC',
+'PFNGLUNIFORM3I64VNVPROC', 'PFNGLUNIFORM4I64VNVPROC',
+'PFNGLUNIFORM1UI64NVPROC', 'PFNGLUNIFORM2UI64NVPROC',
+'PFNGLUNIFORM3UI64NVPROC', 'PFNGLUNIFORM4UI64NVPROC',
+'PFNGLUNIFORM1UI64VNVPROC', 'PFNGLUNIFORM2UI64VNVPROC',
+'PFNGLUNIFORM3UI64VNVPROC', 'PFNGLUNIFORM4UI64VNVPROC',
+'PFNGLGETUNIFORMI64VNVPROC', 'PFNGLPROGRAMUNIFORM1I64NVPROC',
+'PFNGLPROGRAMUNIFORM2I64NVPROC', 'PFNGLPROGRAMUNIFORM3I64NVPROC',
+'PFNGLPROGRAMUNIFORM4I64NVPROC', 'PFNGLPROGRAMUNIFORM1I64VNVPROC',
+'PFNGLPROGRAMUNIFORM2I64VNVPROC', 'PFNGLPROGRAMUNIFORM3I64VNVPROC',
+'PFNGLPROGRAMUNIFORM4I64VNVPROC', 'PFNGLPROGRAMUNIFORM1UI64NVPROC',
+'PFNGLPROGRAMUNIFORM2UI64NVPROC', 'PFNGLPROGRAMUNIFORM3UI64NVPROC',
+'PFNGLPROGRAMUNIFORM4UI64NVPROC', 'PFNGLPROGRAMUNIFORM1UI64VNVPROC',
+'PFNGLPROGRAMUNIFORM2UI64VNVPROC', 'PFNGLPROGRAMUNIFORM3UI64VNVPROC',
+'PFNGLPROGRAMUNIFORM4UI64VNVPROC', 'GL_NV_shader_buffer_store',
+'GL_NV_tessellation_program5', 'GL_NV_vertex_attrib_integer_64bit',
+'glVertexAttribL1i64NV', 'glVertexAttribL2i64NV', 'glVertexAttribL3i64NV',
+'glVertexAttribL4i64NV', 'glVertexAttribL1i64vNV', 'glVertexAttribL2i64vNV',
+'glVertexAttribL3i64vNV', 'glVertexAttribL4i64vNV', 'glVertexAttribL1ui64NV',
+'glVertexAttribL2ui64NV', 'glVertexAttribL3ui64NV', 'glVertexAttribL4ui64NV',
+'glVertexAttribL1ui64vNV', 'glVertexAttribL2ui64vNV',
+'glVertexAttribL3ui64vNV', 'glVertexAttribL4ui64vNV',
+'glGetVertexAttribLi64vNV', 'glGetVertexAttribLui64vNV',
+'glVertexAttribLFormatNV', 'PFNGLVERTEXATTRIBL1I64NVPROC',
+'PFNGLVERTEXATTRIBL2I64NVPROC', 'PFNGLVERTEXATTRIBL3I64NVPROC',
+'PFNGLVERTEXATTRIBL4I64NVPROC', 'PFNGLVERTEXATTRIBL1I64VNVPROC',
+'PFNGLVERTEXATTRIBL2I64VNVPROC', 'PFNGLVERTEXATTRIBL3I64VNVPROC',
+'PFNGLVERTEXATTRIBL4I64VNVPROC', 'PFNGLVERTEXATTRIBL1UI64NVPROC',
+'PFNGLVERTEXATTRIBL2UI64NVPROC', 'PFNGLVERTEXATTRIBL3UI64NVPROC',
+'PFNGLVERTEXATTRIBL4UI64NVPROC', 'PFNGLVERTEXATTRIBL1UI64VNVPROC',
+'PFNGLVERTEXATTRIBL2UI64VNVPROC', 'PFNGLVERTEXATTRIBL3UI64VNVPROC',
+'PFNGLVERTEXATTRIBL4UI64VNVPROC', 'PFNGLGETVERTEXATTRIBLI64VNVPROC',
+'PFNGLGETVERTEXATTRIBLUI64VNVPROC', 'PFNGLVERTEXATTRIBLFORMATNVPROC',
+'GL_NV_multisample_coverage', 'GL_AMD_name_gen_delete', 'glGenNamesAMD',
+'glDeleteNamesAMD', 'glIsNameAMD', 'PFNGLGENNAMESAMDPROC',
+'PFNGLDELETENAMESAMDPROC', 'PFNGLISNAMEAMDPROC', 'GL_AMD_debug_output',
+'glDebugMessageEnableAMD', 'glDebugMessageInsertAMD',
+'glDebugMessageCallbackAMD', 'glGetDebugMessageLogAMD',
+'PFNGLDEBUGMESSAGEENABLEAMDPROC', 'PFNGLDEBUGMESSAGEINSERTAMDPROC',
+'PFNGLDEBUGMESSAGECALLBACKAMDPROC', 'PFNGLGETDEBUGMESSAGELOGAMDPROC',
+'GL_NV_vdpau_interop', 'glVDPAUInitNV', 'glVDPAUFiniNV',
+'glVDPAURegisterVideoSurfaceNV', 'glVDPAURegisterOutputSurfaceNV',
+'glVDPAUIsSurfaceNV', 'glVDPAUUnregisterSurfaceNV', 'glVDPAUGetSurfaceivNV',
+'glVDPAUSurfaceAccessNV', 'glVDPAUMapSurfacesNV', 'glVDPAUUnmapSurfacesNV',
+'PFNGLVDPAUINITNVPROC', 'PFNGLVDPAUFININVPROC',
+'PFNGLVDPAUREGISTERVIDEOSURFACENVPROC',
+'PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC', 'PFNGLVDPAUISSURFACENVPROC',
+'PFNGLVDPAUUNREGISTERSURFACENVPROC', 'PFNGLVDPAUGETSURFACEIVNVPROC',
+'PFNGLVDPAUSURFACEACCESSNVPROC', 'PFNGLVDPAUMAPSURFACESNVPROC',
+'PFNGLVDPAUUNMAPSURFACESNVPROC', 'GL_AMD_transform_feedback3_lines_triangles',
+'GL_AMD_depth_clamp_separate', 'GL_EXT_texture_sRGB_decode',
+'GL_NV_texture_multisample', 'glTexImage2DMultisampleCoverageNV',
+'glTexImage3DMultisampleCoverageNV', 'glTextureImage2DMultisampleNV',
+'glTextureImage3DMultisampleNV', 'glTextureImage2DMultisampleCoverageNV',
+'glTextureImage3DMultisampleCoverageNV',
+'PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC',
+'PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC',
+'PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC',
+'PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC',
+'PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC',
+'PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC', 'GL_AMD_blend_minmax_factor',
+'GL_AMD_sample_positions', 'glSetMultisamplefvAMD',
+'PFNGLSETMULTISAMPLEFVAMDPROC', 'GL_EXT_x11_sync_object', 'glImportSyncEXT',
+'PFNGLIMPORTSYNCEXTPROC', 'GL_AMD_multi_draw_indirect',
+'glMultiDrawArraysIndirectAMD', 'glMultiDrawElementsIndirectAMD',
+'PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC',
+'PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC',
+'GL_EXT_framebuffer_multisample_blit_scaled', 'GL_NV_path_rendering',
+'glGenPathsNV', 'glDeletePathsNV', 'glIsPathNV', 'glPathCommandsNV',
+'glPathCoordsNV', 'glPathSubCommandsNV', 'glPathSubCoordsNV',
+'glPathStringNV', 'glPathGlyphsNV', 'glPathGlyphRangeNV', 'glWeightPathsNV',
+'glCopyPathNV', 'glInterpolatePathsNV', 'glTransformPathNV',
+'glPathParameterivNV', 'glPathParameteriNV', 'glPathParameterfvNV',
+'glPathParameterfNV', 'glPathDashArrayNV', 'glPathStencilFuncNV',
+'glPathStencilDepthOffsetNV', 'glStencilFillPathNV', 'glStencilStrokePathNV',
+'glStencilFillPathInstancedNV', 'glStencilStrokePathInstancedNV',
+'glPathCoverDepthFuncNV', 'glPathColorGenNV', 'glPathTexGenNV',
+'glPathFogGenNV', 'glCoverFillPathNV', 'glCoverStrokePathNV',
+'glCoverFillPathInstancedNV', 'glCoverStrokePathInstancedNV',
+'glGetPathParameterivNV', 'glGetPathParameterfvNV', 'glGetPathCommandsNV',
+'glGetPathCoordsNV', 'glGetPathDashArrayNV', 'glGetPathMetricsNV',
+'glGetPathMetricRangeNV', 'glGetPathSpacingNV', 'glGetPathColorGenivNV',
+'glGetPathColorGenfvNV', 'glGetPathTexGenivNV', 'glGetPathTexGenfvNV',
+'glIsPointInFillPathNV', 'glIsPointInStrokePathNV', 'glGetPathLengthNV',
+'glPointAlongPathNV', 'PFNGLGENPATHSNVPROC', 'PFNGLDELETEPATHSNVPROC',
+'PFNGLISPATHNVPROC', 'PFNGLPATHCOMMANDSNVPROC', 'PFNGLPATHCOORDSNVPROC',
+'PFNGLPATHSUBCOMMANDSNVPROC', 'PFNGLPATHSUBCOORDSNVPROC',
+'PFNGLPATHSTRINGNVPROC', 'PFNGLPATHGLYPHSNVPROC', 'PFNGLPATHGLYPHRANGENVPROC',
+'PFNGLWEIGHTPATHSNVPROC', 'PFNGLCOPYPATHNVPROC',
+'PFNGLINTERPOLATEPATHSNVPROC', 'PFNGLTRANSFORMPATHNVPROC',
+'PFNGLPATHPARAMETERIVNVPROC', 'PFNGLPATHPARAMETERINVPROC',
+'PFNGLPATHPARAMETERFVNVPROC', 'PFNGLPATHPARAMETERFNVPROC',
+'PFNGLPATHDASHARRAYNVPROC', 'PFNGLPATHSTENCILFUNCNVPROC',
+'PFNGLPATHSTENCILDEPTHOFFSETNVPROC', 'PFNGLSTENCILFILLPATHNVPROC',
+'PFNGLSTENCILSTROKEPATHNVPROC', 'PFNGLSTENCILFILLPATHINSTANCEDNVPROC',
+'PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC', 'PFNGLPATHCOVERDEPTHFUNCNVPROC',
+'PFNGLPATHCOLORGENNVPROC', 'PFNGLPATHTEXGENNVPROC', 'PFNGLPATHFOGGENNVPROC',
+'PFNGLCOVERFILLPATHNVPROC', 'PFNGLCOVERSTROKEPATHNVPROC',
+'PFNGLCOVERFILLPATHINSTANCEDNVPROC', 'PFNGLCOVERSTROKEPATHINSTANCEDNVPROC',
+'PFNGLGETPATHPARAMETERIVNVPROC', 'PFNGLGETPATHPARAMETERFVNVPROC',
+'PFNGLGETPATHCOMMANDSNVPROC', 'PFNGLGETPATHCOORDSNVPROC',
+'PFNGLGETPATHDASHARRAYNVPROC', 'PFNGLGETPATHMETRICSNVPROC',
+'PFNGLGETPATHMETRICRANGENVPROC', 'PFNGLGETPATHSPACINGNVPROC',
+'PFNGLGETPATHCOLORGENIVNVPROC', 'PFNGLGETPATHCOLORGENFVNVPROC',
+'PFNGLGETPATHTEXGENIVNVPROC', 'PFNGLGETPATHTEXGENFVNVPROC',
+'PFNGLISPOINTINFILLPATHNVPROC', 'PFNGLISPOINTINSTROKEPATHNVPROC',
+'PFNGLGETPATHLENGTHNVPROC', 'PFNGLPOINTALONGPATHNVPROC',
+'GL_AMD_pinned_memory', 'GL_AMD_stencil_operation_extended',
+'glStencilOpValueAMD', 'PFNGLSTENCILOPVALUEAMDPROC',
+'GL_AMD_vertex_shader_viewport_index', 'GL_AMD_vertex_shader_layer',
+'GL_NV_bindless_texture', 'glGetTextureHandleNV',
+'glGetTextureSamplerHandleNV', 'glMakeTextureHandleResidentNV',
+'glMakeTextureHandleNonResidentNV', 'glGetImageHandleNV',
+'glMakeImageHandleResidentNV', 'glMakeImageHandleNonResidentNV',
+'glUniformHandleui64NV', 'glUniformHandleui64vNV',
+'glProgramUniformHandleui64NV', 'glProgramUniformHandleui64vNV',
+'glIsTextureHandleResidentNV', 'glIsImageHandleResidentNV',
+'PFNGLGETTEXTUREHANDLENVPROC', 'PFNGLGETTEXTURESAMPLERHANDLENVPROC',
+'PFNGLMAKETEXTUREHANDLERESIDENTNVPROC',
+'PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC', 'PFNGLGETIMAGEHANDLENVPROC',
+'PFNGLMAKEIMAGEHANDLERESIDENTNVPROC', 'PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC',
+'PFNGLUNIFORMHANDLEUI64NVPROC', 'PFNGLUNIFORMHANDLEUI64VNVPROC',
+'PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC', 'PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC',
+'PFNGLISTEXTUREHANDLERESIDENTNVPROC', 'PFNGLISIMAGEHANDLERESIDENTNVPROC',
+'GL_NV_shader_atomic_float', 'GL_AMD_query_buffer_object']
+# END GENERATED CONTENT (do not edit above this line)
+
+
+
+
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glext_nv.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glext_nv.py
new file mode 100644
index 0000000..d41e87a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glext_nv.py
@@ -0,0 +1,11523 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+'''Wrapper for http://developer.download.nvidia.com/opengl/includes/glext.h
+
+Generated by tools/gengl.py.
+Do not modify this file.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+from ctypes import *
+from pyglet.gl.lib import link_GL as _link_function
+from pyglet.gl.lib import c_ptrdiff_t
+
+# BEGIN GENERATED CONTENT (do not edit below this line)
+
+# This content is generated by gengl.py.
+# Wrapper for http://developer.download.nvidia.com/opengl/includes/glext.h
+
+
+# ARB_multitexture (/usr/include/GL/gl.h:1962)
+GL_GLEXT_VERSION = 44 # GL/glext.h:74
+# VERSION_1_2 (GL/glext.h:76)
+# ARB_imaging (GL/glext.h:120)
+# VERSION_1_3 (GL/glext.h:198)
+# VERSION_1_4 (GL/glext.h:297)
+GL_BLEND_DST_RGB = 32968 # GL/glext.h:298
+GL_BLEND_SRC_RGB = 32969 # GL/glext.h:299
+GL_BLEND_DST_ALPHA = 32970 # GL/glext.h:300
+GL_BLEND_SRC_ALPHA = 32971 # GL/glext.h:301
+GL_POINT_SIZE_MIN = 33062 # GL/glext.h:302
+GL_POINT_SIZE_MAX = 33063 # GL/glext.h:303
+GL_POINT_FADE_THRESHOLD_SIZE = 33064 # GL/glext.h:304
+GL_POINT_DISTANCE_ATTENUATION = 33065 # GL/glext.h:305
+GL_GENERATE_MIPMAP = 33169 # GL/glext.h:306
+GL_GENERATE_MIPMAP_HINT = 33170 # GL/glext.h:307
+GL_DEPTH_COMPONENT16 = 33189 # GL/glext.h:308
+GL_DEPTH_COMPONENT24 = 33190 # GL/glext.h:309
+GL_DEPTH_COMPONENT32 = 33191 # GL/glext.h:310
+GL_MIRRORED_REPEAT = 33648 # GL/glext.h:311
+GL_FOG_COORDINATE_SOURCE = 33872 # GL/glext.h:312
+GL_FOG_COORDINATE = 33873 # GL/glext.h:313
+GL_FRAGMENT_DEPTH = 33874 # GL/glext.h:314
+GL_CURRENT_FOG_COORDINATE = 33875 # GL/glext.h:315
+GL_FOG_COORDINATE_ARRAY_TYPE = 33876 # GL/glext.h:316
+GL_FOG_COORDINATE_ARRAY_STRIDE = 33877 # GL/glext.h:317
+GL_FOG_COORDINATE_ARRAY_POINTER = 33878 # GL/glext.h:318
+GL_FOG_COORDINATE_ARRAY = 33879 # GL/glext.h:319
+GL_COLOR_SUM = 33880 # GL/glext.h:320
+GL_CURRENT_SECONDARY_COLOR = 33881 # GL/glext.h:321
+GL_SECONDARY_COLOR_ARRAY_SIZE = 33882 # GL/glext.h:322
+GL_SECONDARY_COLOR_ARRAY_TYPE = 33883 # GL/glext.h:323
+GL_SECONDARY_COLOR_ARRAY_STRIDE = 33884 # GL/glext.h:324
+GL_SECONDARY_COLOR_ARRAY_POINTER = 33885 # GL/glext.h:325
+GL_SECONDARY_COLOR_ARRAY = 33886 # GL/glext.h:326
+GL_MAX_TEXTURE_LOD_BIAS = 34045 # GL/glext.h:327
+GL_TEXTURE_FILTER_CONTROL = 34048 # GL/glext.h:328
+GL_TEXTURE_LOD_BIAS = 34049 # GL/glext.h:329
+GL_INCR_WRAP = 34055 # GL/glext.h:330
+GL_DECR_WRAP = 34056 # GL/glext.h:331
+GL_TEXTURE_DEPTH_SIZE = 34890 # GL/glext.h:332
+GL_DEPTH_TEXTURE_MODE = 34891 # GL/glext.h:333
+GL_TEXTURE_COMPARE_MODE = 34892 # GL/glext.h:334
+GL_TEXTURE_COMPARE_FUNC = 34893 # GL/glext.h:335
+GL_COMPARE_R_TO_TEXTURE = 34894 # GL/glext.h:336
+# VERSION_1_5 (GL/glext.h:339)
+GL_BUFFER_SIZE = 34660 # GL/glext.h:340
+GL_BUFFER_USAGE = 34661 # GL/glext.h:341
+GL_QUERY_COUNTER_BITS = 34916 # GL/glext.h:342
+GL_CURRENT_QUERY = 34917 # GL/glext.h:343
+GL_QUERY_RESULT = 34918 # GL/glext.h:344
+GL_QUERY_RESULT_AVAILABLE = 34919 # GL/glext.h:345
+GL_ARRAY_BUFFER = 34962 # GL/glext.h:346
+GL_ELEMENT_ARRAY_BUFFER = 34963 # GL/glext.h:347
+GL_ARRAY_BUFFER_BINDING = 34964 # GL/glext.h:348
+GL_ELEMENT_ARRAY_BUFFER_BINDING = 34965 # GL/glext.h:349
+GL_VERTEX_ARRAY_BUFFER_BINDING = 34966 # GL/glext.h:350
+GL_NORMAL_ARRAY_BUFFER_BINDING = 34967 # GL/glext.h:351
+GL_COLOR_ARRAY_BUFFER_BINDING = 34968 # GL/glext.h:352
+GL_INDEX_ARRAY_BUFFER_BINDING = 34969 # GL/glext.h:353
+GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = 34970 # GL/glext.h:354
+GL_EDGE_FLAG_ARRAY_BUFFER_BINDING = 34971 # GL/glext.h:355
+GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING = 34972 # GL/glext.h:356
+GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING = 34973 # GL/glext.h:357
+GL_WEIGHT_ARRAY_BUFFER_BINDING = 34974 # GL/glext.h:358
+GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 34975 # GL/glext.h:359
+GL_READ_ONLY = 35000 # GL/glext.h:360
+GL_WRITE_ONLY = 35001 # GL/glext.h:361
+GL_READ_WRITE = 35002 # GL/glext.h:362
+GL_BUFFER_ACCESS = 35003 # GL/glext.h:363
+GL_BUFFER_MAPPED = 35004 # GL/glext.h:364
+GL_BUFFER_MAP_POINTER = 35005 # GL/glext.h:365
+GL_STREAM_DRAW = 35040 # GL/glext.h:366
+GL_STREAM_READ = 35041 # GL/glext.h:367
+GL_STREAM_COPY = 35042 # GL/glext.h:368
+GL_STATIC_DRAW = 35044 # GL/glext.h:369
+GL_STATIC_READ = 35045 # GL/glext.h:370
+GL_STATIC_COPY = 35046 # GL/glext.h:371
+GL_DYNAMIC_DRAW = 35048 # GL/glext.h:372
+GL_DYNAMIC_READ = 35049 # GL/glext.h:373
+GL_DYNAMIC_COPY = 35050 # GL/glext.h:374
+GL_SAMPLES_PASSED = 35092 # GL/glext.h:375
+GL_FOG_COORD_SRC = 33872 # GL/glext.h:376
+GL_FOG_COORD = 33873 # GL/glext.h:377
+GL_CURRENT_FOG_COORD = 33875 # GL/glext.h:378
+GL_FOG_COORD_ARRAY_TYPE = 33876 # GL/glext.h:379
+GL_FOG_COORD_ARRAY_STRIDE = 33877 # GL/glext.h:380
+GL_FOG_COORD_ARRAY_POINTER = 33878 # GL/glext.h:381
+GL_FOG_COORD_ARRAY = 33879 # GL/glext.h:382
+GL_FOG_COORD_ARRAY_BUFFER_BINDING = 34973 # GL/glext.h:383
+GL_SRC0_RGB = 34176 # GL/glext.h:384
+GL_SRC1_RGB = 34177 # GL/glext.h:385
+GL_SRC2_RGB = 34178 # GL/glext.h:386
+GL_SRC0_ALPHA = 34184 # GL/glext.h:387
+GL_SRC1_ALPHA = 34185 # GL/glext.h:388
+GL_SRC2_ALPHA = 34186 # GL/glext.h:389
+# VERSION_2_0 (GL/glext.h:392)
+GL_BLEND_EQUATION_RGB = 32777 # GL/glext.h:393
+GL_VERTEX_ATTRIB_ARRAY_ENABLED = 34338 # GL/glext.h:394
+GL_VERTEX_ATTRIB_ARRAY_SIZE = 34339 # GL/glext.h:395
+GL_VERTEX_ATTRIB_ARRAY_STRIDE = 34340 # GL/glext.h:396
+GL_VERTEX_ATTRIB_ARRAY_TYPE = 34341 # GL/glext.h:397
+GL_CURRENT_VERTEX_ATTRIB = 34342 # GL/glext.h:398
+GL_VERTEX_PROGRAM_POINT_SIZE = 34370 # GL/glext.h:399
+GL_VERTEX_PROGRAM_TWO_SIDE = 34371 # GL/glext.h:400
+GL_VERTEX_ATTRIB_ARRAY_POINTER = 34373 # GL/glext.h:401
+GL_STENCIL_BACK_FUNC = 34816 # GL/glext.h:402
+GL_STENCIL_BACK_FAIL = 34817 # GL/glext.h:403
+GL_STENCIL_BACK_PASS_DEPTH_FAIL = 34818 # GL/glext.h:404
+GL_STENCIL_BACK_PASS_DEPTH_PASS = 34819 # GL/glext.h:405
+GL_MAX_DRAW_BUFFERS = 34852 # GL/glext.h:406
+GL_DRAW_BUFFER0 = 34853 # GL/glext.h:407
+GL_DRAW_BUFFER1 = 34854 # GL/glext.h:408
+GL_DRAW_BUFFER2 = 34855 # GL/glext.h:409
+GL_DRAW_BUFFER3 = 34856 # GL/glext.h:410
+GL_DRAW_BUFFER4 = 34857 # GL/glext.h:411
+GL_DRAW_BUFFER5 = 34858 # GL/glext.h:412
+GL_DRAW_BUFFER6 = 34859 # GL/glext.h:413
+GL_DRAW_BUFFER7 = 34860 # GL/glext.h:414
+GL_DRAW_BUFFER8 = 34861 # GL/glext.h:415
+GL_DRAW_BUFFER9 = 34862 # GL/glext.h:416
+GL_DRAW_BUFFER10 = 34863 # GL/glext.h:417
+GL_DRAW_BUFFER11 = 34864 # GL/glext.h:418
+GL_DRAW_BUFFER12 = 34865 # GL/glext.h:419
+GL_DRAW_BUFFER13 = 34866 # GL/glext.h:420
+GL_DRAW_BUFFER14 = 34867 # GL/glext.h:421
+GL_DRAW_BUFFER15 = 34868 # GL/glext.h:422
+GL_BLEND_EQUATION_ALPHA = 34877 # GL/glext.h:423
+GL_POINT_SPRITE = 34913 # GL/glext.h:424
+GL_COORD_REPLACE = 34914 # GL/glext.h:425
+GL_MAX_VERTEX_ATTRIBS = 34921 # GL/glext.h:426
+GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = 34922 # GL/glext.h:427
+GL_MAX_TEXTURE_COORDS = 34929 # GL/glext.h:428
+GL_MAX_TEXTURE_IMAGE_UNITS = 34930 # GL/glext.h:429
+GL_FRAGMENT_SHADER = 35632 # GL/glext.h:430
+GL_VERTEX_SHADER = 35633 # GL/glext.h:431
+GL_MAX_FRAGMENT_UNIFORM_COMPONENTS = 35657 # GL/glext.h:432
+GL_MAX_VERTEX_UNIFORM_COMPONENTS = 35658 # GL/glext.h:433
+GL_MAX_VARYING_FLOATS = 35659 # GL/glext.h:434
+GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 35660 # GL/glext.h:435
+GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 35661 # GL/glext.h:436
+GL_SHADER_TYPE = 35663 # GL/glext.h:437
+GL_FLOAT_VEC2 = 35664 # GL/glext.h:438
+GL_FLOAT_VEC3 = 35665 # GL/glext.h:439
+GL_FLOAT_VEC4 = 35666 # GL/glext.h:440
+GL_INT_VEC2 = 35667 # GL/glext.h:441
+GL_INT_VEC3 = 35668 # GL/glext.h:442
+GL_INT_VEC4 = 35669 # GL/glext.h:443
+GL_BOOL = 35670 # GL/glext.h:444
+GL_BOOL_VEC2 = 35671 # GL/glext.h:445
+GL_BOOL_VEC3 = 35672 # GL/glext.h:446
+GL_BOOL_VEC4 = 35673 # GL/glext.h:447
+GL_FLOAT_MAT2 = 35674 # GL/glext.h:448
+GL_FLOAT_MAT3 = 35675 # GL/glext.h:449
+GL_FLOAT_MAT4 = 35676 # GL/glext.h:450
+GL_SAMPLER_1D = 35677 # GL/glext.h:451
+GL_SAMPLER_2D = 35678 # GL/glext.h:452
+GL_SAMPLER_3D = 35679 # GL/glext.h:453
+GL_SAMPLER_CUBE = 35680 # GL/glext.h:454
+GL_SAMPLER_1D_SHADOW = 35681 # GL/glext.h:455
+GL_SAMPLER_2D_SHADOW = 35682 # GL/glext.h:456
+GL_DELETE_STATUS = 35712 # GL/glext.h:457
+GL_COMPILE_STATUS = 35713 # GL/glext.h:458
+GL_LINK_STATUS = 35714 # GL/glext.h:459
+GL_VALIDATE_STATUS = 35715 # GL/glext.h:460
+GL_INFO_LOG_LENGTH = 35716 # GL/glext.h:461
+GL_ATTACHED_SHADERS = 35717 # GL/glext.h:462
+GL_ACTIVE_UNIFORMS = 35718 # GL/glext.h:463
+GL_ACTIVE_UNIFORM_MAX_LENGTH = 35719 # GL/glext.h:464
+GL_SHADER_SOURCE_LENGTH = 35720 # GL/glext.h:465
+GL_ACTIVE_ATTRIBUTES = 35721 # GL/glext.h:466
+GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 35722 # GL/glext.h:467
+GL_FRAGMENT_SHADER_DERIVATIVE_HINT = 35723 # GL/glext.h:468
+GL_SHADING_LANGUAGE_VERSION = 35724 # GL/glext.h:469
+GL_CURRENT_PROGRAM = 35725 # GL/glext.h:470
+GL_POINT_SPRITE_COORD_ORIGIN = 36000 # GL/glext.h:471
+GL_LOWER_LEFT = 36001 # GL/glext.h:472
+GL_UPPER_LEFT = 36002 # GL/glext.h:473
+GL_STENCIL_BACK_REF = 36003 # GL/glext.h:474
+GL_STENCIL_BACK_VALUE_MASK = 36004 # GL/glext.h:475
+GL_STENCIL_BACK_WRITEMASK = 36005 # GL/glext.h:476
+# VERSION_2_1 (GL/glext.h:479)
+GL_PIXEL_PACK_BUFFER = 35051 # GL/glext.h:480
+GL_PIXEL_UNPACK_BUFFER = 35052 # GL/glext.h:481
+GL_PIXEL_PACK_BUFFER_BINDING = 35053 # GL/glext.h:482
+GL_PIXEL_UNPACK_BUFFER_BINDING = 35055 # GL/glext.h:483
+GL_SRGB = 35904 # GL/glext.h:484
+GL_SRGB8 = 35905 # GL/glext.h:485
+GL_SRGB_ALPHA = 35906 # GL/glext.h:486
+GL_SRGB8_ALPHA8 = 35907 # GL/glext.h:487
+GL_SLUMINANCE_ALPHA = 35908 # GL/glext.h:488
+GL_SLUMINANCE8_ALPHA8 = 35909 # GL/glext.h:489
+GL_SLUMINANCE = 35910 # GL/glext.h:490
+GL_SLUMINANCE8 = 35911 # GL/glext.h:491
+GL_COMPRESSED_SRGB = 35912 # GL/glext.h:492
+GL_COMPRESSED_SRGB_ALPHA = 35913 # GL/glext.h:493
+GL_COMPRESSED_SLUMINANCE = 35914 # GL/glext.h:494
+GL_COMPRESSED_SLUMINANCE_ALPHA = 35915 # GL/glext.h:495
+GL_FLOAT_MAT2x3 = 35685 # GL/glext.h:496
+GL_FLOAT_MAT2x4 = 35686 # GL/glext.h:497
+GL_FLOAT_MAT3x2 = 35687 # GL/glext.h:498
+GL_FLOAT_MAT3x4 = 35688 # GL/glext.h:499
+GL_FLOAT_MAT4x2 = 35689 # GL/glext.h:500
+GL_FLOAT_MAT4x3 = 35690 # GL/glext.h:501
+GL_CURRENT_RASTER_SECONDARY_COLOR = 33887 # GL/glext.h:502
+# VERSION_3_0 (GL/glext.h:505)
+GL_CLIP_DISTANCE0 = 12288 # GL/glext.h:507
+GL_CLIP_DISTANCE1 = 12289 # GL/glext.h:508
+GL_CLIP_DISTANCE2 = 12290 # GL/glext.h:509
+GL_CLIP_DISTANCE3 = 12291 # GL/glext.h:510
+GL_CLIP_DISTANCE4 = 12292 # GL/glext.h:511
+GL_CLIP_DISTANCE5 = 12293 # GL/glext.h:512
+GL_MAX_CLIP_DISTANCES = 3378 # GL/glext.h:513
+GL_MAJOR_VERSION = 33307 # GL/glext.h:514
+GL_MINOR_VERSION = 33308 # GL/glext.h:515
+GL_NUM_EXTENSIONS = 33309 # GL/glext.h:516
+GL_CONTEXT_FLAGS = 33310 # GL/glext.h:517
+GL_DEPTH_BUFFER = 33315 # GL/glext.h:518
+GL_STENCIL_BUFFER = 33316 # GL/glext.h:519
+GL_COMPRESSED_RED = 33317 # GL/glext.h:520
+GL_COMPRESSED_RG = 33318 # GL/glext.h:521
+GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT = 1 # GL/glext.h:522
+GL_RGBA32F = 34836 # GL/glext.h:523
+GL_RGB32F = 34837 # GL/glext.h:524
+GL_RGBA16F = 34842 # GL/glext.h:525
+GL_RGB16F = 34843 # GL/glext.h:526
+GL_VERTEX_ATTRIB_ARRAY_INTEGER = 35069 # GL/glext.h:527
+GL_MAX_ARRAY_TEXTURE_LAYERS = 35071 # GL/glext.h:528
+GL_MIN_PROGRAM_TEXEL_OFFSET = 35076 # GL/glext.h:529
+GL_MAX_PROGRAM_TEXEL_OFFSET = 35077 # GL/glext.h:530
+GL_CLAMP_VERTEX_COLOR = 35098 # GL/glext.h:531
+GL_CLAMP_FRAGMENT_COLOR = 35099 # GL/glext.h:532
+GL_CLAMP_READ_COLOR = 35100 # GL/glext.h:533
+GL_FIXED_ONLY = 35101 # GL/glext.h:534
+GL_MAX_VARYING_COMPONENTS = 35659 # GL/glext.h:535
+GL_TEXTURE_RED_TYPE = 35856 # GL/glext.h:536
+GL_TEXTURE_GREEN_TYPE = 35857 # GL/glext.h:537
+GL_TEXTURE_BLUE_TYPE = 35858 # GL/glext.h:538
+GL_TEXTURE_ALPHA_TYPE = 35859 # GL/glext.h:539
+GL_TEXTURE_LUMINANCE_TYPE = 35860 # GL/glext.h:540
+GL_TEXTURE_INTENSITY_TYPE = 35861 # GL/glext.h:541
+GL_TEXTURE_DEPTH_TYPE = 35862 # GL/glext.h:542
+GL_UNSIGNED_NORMALIZED = 35863 # GL/glext.h:543
+GL_TEXTURE_1D_ARRAY = 35864 # GL/glext.h:544
+GL_PROXY_TEXTURE_1D_ARRAY = 35865 # GL/glext.h:545
+GL_TEXTURE_2D_ARRAY = 35866 # GL/glext.h:546
+GL_PROXY_TEXTURE_2D_ARRAY = 35867 # GL/glext.h:547
+GL_TEXTURE_BINDING_1D_ARRAY = 35868 # GL/glext.h:548
+GL_TEXTURE_BINDING_2D_ARRAY = 35869 # GL/glext.h:549
+GL_R11F_G11F_B10F = 35898 # GL/glext.h:550
+GL_UNSIGNED_INT_10F_11F_11F_REV = 35899 # GL/glext.h:551
+GL_RGB9_E5 = 35901 # GL/glext.h:552
+GL_UNSIGNED_INT_5_9_9_9_REV = 35902 # GL/glext.h:553
+GL_TEXTURE_SHARED_SIZE = 35903 # GL/glext.h:554
+GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH = 35958 # GL/glext.h:555
+GL_TRANSFORM_FEEDBACK_BUFFER_MODE = 35967 # GL/glext.h:556
+GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 35968 # GL/glext.h:557
+GL_TRANSFORM_FEEDBACK_VARYINGS = 35971 # GL/glext.h:558
+GL_TRANSFORM_FEEDBACK_BUFFER_START = 35972 # GL/glext.h:559
+GL_TRANSFORM_FEEDBACK_BUFFER_SIZE = 35973 # GL/glext.h:560
+GL_PRIMITIVES_GENERATED = 35975 # GL/glext.h:561
+GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 35976 # GL/glext.h:562
+GL_RASTERIZER_DISCARD = 35977 # GL/glext.h:563
+GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 35978 # GL/glext.h:564
+GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 35979 # GL/glext.h:565
+GL_INTERLEAVED_ATTRIBS = 35980 # GL/glext.h:566
+GL_SEPARATE_ATTRIBS = 35981 # GL/glext.h:567
+GL_TRANSFORM_FEEDBACK_BUFFER = 35982 # GL/glext.h:568
+GL_TRANSFORM_FEEDBACK_BUFFER_BINDING = 35983 # GL/glext.h:569
+GL_RGBA32UI = 36208 # GL/glext.h:570
+GL_RGB32UI = 36209 # GL/glext.h:571
+GL_RGBA16UI = 36214 # GL/glext.h:572
+GL_RGB16UI = 36215 # GL/glext.h:573
+GL_RGBA8UI = 36220 # GL/glext.h:574
+GL_RGB8UI = 36221 # GL/glext.h:575
+GL_RGBA32I = 36226 # GL/glext.h:576
+GL_RGB32I = 36227 # GL/glext.h:577
+GL_RGBA16I = 36232 # GL/glext.h:578
+GL_RGB16I = 36233 # GL/glext.h:579
+GL_RGBA8I = 36238 # GL/glext.h:580
+GL_RGB8I = 36239 # GL/glext.h:581
+GL_RED_INTEGER = 36244 # GL/glext.h:582
+GL_GREEN_INTEGER = 36245 # GL/glext.h:583
+GL_BLUE_INTEGER = 36246 # GL/glext.h:584
+GL_ALPHA_INTEGER = 36247 # GL/glext.h:585
+GL_RGB_INTEGER = 36248 # GL/glext.h:586
+GL_RGBA_INTEGER = 36249 # GL/glext.h:587
+GL_BGR_INTEGER = 36250 # GL/glext.h:588
+GL_BGRA_INTEGER = 36251 # GL/glext.h:589
+GL_SAMPLER_1D_ARRAY = 36288 # GL/glext.h:590
+GL_SAMPLER_2D_ARRAY = 36289 # GL/glext.h:591
+GL_SAMPLER_1D_ARRAY_SHADOW = 36291 # GL/glext.h:592
+GL_SAMPLER_2D_ARRAY_SHADOW = 36292 # GL/glext.h:593
+GL_SAMPLER_CUBE_SHADOW = 36293 # GL/glext.h:594
+GL_UNSIGNED_INT_VEC2 = 36294 # GL/glext.h:595
+GL_UNSIGNED_INT_VEC3 = 36295 # GL/glext.h:596
+GL_UNSIGNED_INT_VEC4 = 36296 # GL/glext.h:597
+GL_INT_SAMPLER_1D = 36297 # GL/glext.h:598
+GL_INT_SAMPLER_2D = 36298 # GL/glext.h:599
+GL_INT_SAMPLER_3D = 36299 # GL/glext.h:600
+GL_INT_SAMPLER_CUBE = 36300 # GL/glext.h:601
+GL_INT_SAMPLER_1D_ARRAY = 36302 # GL/glext.h:602
+GL_INT_SAMPLER_2D_ARRAY = 36303 # GL/glext.h:603
+GL_UNSIGNED_INT_SAMPLER_1D = 36305 # GL/glext.h:604
+GL_UNSIGNED_INT_SAMPLER_2D = 36306 # GL/glext.h:605
+GL_UNSIGNED_INT_SAMPLER_3D = 36307 # GL/glext.h:606
+GL_UNSIGNED_INT_SAMPLER_CUBE = 36308 # GL/glext.h:607
+GL_UNSIGNED_INT_SAMPLER_1D_ARRAY = 36310 # GL/glext.h:608
+GL_UNSIGNED_INT_SAMPLER_2D_ARRAY = 36311 # GL/glext.h:609
+GL_QUERY_WAIT = 36371 # GL/glext.h:610
+GL_QUERY_NO_WAIT = 36372 # GL/glext.h:611
+GL_QUERY_BY_REGION_WAIT = 36373 # GL/glext.h:612
+GL_QUERY_BY_REGION_NO_WAIT = 36374 # GL/glext.h:613
+# ARB_multitexture (GL/glext.h:742)
+# ARB_transpose_matrix (GL/glext.h:780)
+GL_TRANSPOSE_MODELVIEW_MATRIX_ARB = 34019 # GL/glext.h:781
+GL_TRANSPOSE_PROJECTION_MATRIX_ARB = 34020 # GL/glext.h:782
+GL_TRANSPOSE_TEXTURE_MATRIX_ARB = 34021 # GL/glext.h:783
+GL_TRANSPOSE_COLOR_MATRIX_ARB = 34022 # GL/glext.h:784
+# ARB_multisample (GL/glext.h:787)
+GL_MULTISAMPLE_ARB = 32925 # GL/glext.h:788
+GL_SAMPLE_ALPHA_TO_COVERAGE_ARB = 32926 # GL/glext.h:789
+GL_SAMPLE_ALPHA_TO_ONE_ARB = 32927 # GL/glext.h:790
+GL_SAMPLE_COVERAGE_ARB = 32928 # GL/glext.h:791
+GL_SAMPLE_BUFFERS_ARB = 32936 # GL/glext.h:792
+GL_SAMPLES_ARB = 32937 # GL/glext.h:793
+GL_SAMPLE_COVERAGE_VALUE_ARB = 32938 # GL/glext.h:794
+GL_SAMPLE_COVERAGE_INVERT_ARB = 32939 # GL/glext.h:795
+GL_MULTISAMPLE_BIT_ARB = 536870912 # GL/glext.h:796
+# ARB_texture_env_add (GL/glext.h:799)
+# ARB_texture_cube_map (GL/glext.h:802)
+GL_NORMAL_MAP_ARB = 34065 # GL/glext.h:803
+GL_REFLECTION_MAP_ARB = 34066 # GL/glext.h:804
+GL_TEXTURE_CUBE_MAP_ARB = 34067 # GL/glext.h:805
+GL_TEXTURE_BINDING_CUBE_MAP_ARB = 34068 # GL/glext.h:806
+GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = 34069 # GL/glext.h:807
+GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = 34070 # GL/glext.h:808
+GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = 34071 # GL/glext.h:809
+GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = 34072 # GL/glext.h:810
+GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = 34073 # GL/glext.h:811
+GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = 34074 # GL/glext.h:812
+GL_PROXY_TEXTURE_CUBE_MAP_ARB = 34075 # GL/glext.h:813
+GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB = 34076 # GL/glext.h:814
+# ARB_texture_compression (GL/glext.h:817)
+GL_COMPRESSED_ALPHA_ARB = 34025 # GL/glext.h:818
+GL_COMPRESSED_LUMINANCE_ARB = 34026 # GL/glext.h:819
+GL_COMPRESSED_LUMINANCE_ALPHA_ARB = 34027 # GL/glext.h:820
+GL_COMPRESSED_INTENSITY_ARB = 34028 # GL/glext.h:821
+GL_COMPRESSED_RGB_ARB = 34029 # GL/glext.h:822
+GL_COMPRESSED_RGBA_ARB = 34030 # GL/glext.h:823
+GL_TEXTURE_COMPRESSION_HINT_ARB = 34031 # GL/glext.h:824
+GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB = 34464 # GL/glext.h:825
+GL_TEXTURE_COMPRESSED_ARB = 34465 # GL/glext.h:826
+GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = 34466 # GL/glext.h:827
+GL_COMPRESSED_TEXTURE_FORMATS_ARB = 34467 # GL/glext.h:828
+# ARB_texture_border_clamp (GL/glext.h:831)
+GL_CLAMP_TO_BORDER_ARB = 33069 # GL/glext.h:832
+# ARB_point_parameters (GL/glext.h:835)
+GL_POINT_SIZE_MIN_ARB = 33062 # GL/glext.h:836
+GL_POINT_SIZE_MAX_ARB = 33063 # GL/glext.h:837
+GL_POINT_FADE_THRESHOLD_SIZE_ARB = 33064 # GL/glext.h:838
+GL_POINT_DISTANCE_ATTENUATION_ARB = 33065 # GL/glext.h:839
+# ARB_vertex_blend (GL/glext.h:842)
+GL_MAX_VERTEX_UNITS_ARB = 34468 # GL/glext.h:843
+GL_ACTIVE_VERTEX_UNITS_ARB = 34469 # GL/glext.h:844
+GL_WEIGHT_SUM_UNITY_ARB = 34470 # GL/glext.h:845
+GL_VERTEX_BLEND_ARB = 34471 # GL/glext.h:846
+GL_CURRENT_WEIGHT_ARB = 34472 # GL/glext.h:847
+GL_WEIGHT_ARRAY_TYPE_ARB = 34473 # GL/glext.h:848
+GL_WEIGHT_ARRAY_STRIDE_ARB = 34474 # GL/glext.h:849
+GL_WEIGHT_ARRAY_SIZE_ARB = 34475 # GL/glext.h:850
+GL_WEIGHT_ARRAY_POINTER_ARB = 34476 # GL/glext.h:851
+GL_WEIGHT_ARRAY_ARB = 34477 # GL/glext.h:852
+GL_MODELVIEW0_ARB = 5888 # GL/glext.h:853
+GL_MODELVIEW1_ARB = 34058 # GL/glext.h:854
+GL_MODELVIEW2_ARB = 34594 # GL/glext.h:855
+GL_MODELVIEW3_ARB = 34595 # GL/glext.h:856
+GL_MODELVIEW4_ARB = 34596 # GL/glext.h:857
+GL_MODELVIEW5_ARB = 34597 # GL/glext.h:858
+GL_MODELVIEW6_ARB = 34598 # GL/glext.h:859
+GL_MODELVIEW7_ARB = 34599 # GL/glext.h:860
+GL_MODELVIEW8_ARB = 34600 # GL/glext.h:861
+GL_MODELVIEW9_ARB = 34601 # GL/glext.h:862
+GL_MODELVIEW10_ARB = 34602 # GL/glext.h:863
+GL_MODELVIEW11_ARB = 34603 # GL/glext.h:864
+GL_MODELVIEW12_ARB = 34604 # GL/glext.h:865
+GL_MODELVIEW13_ARB = 34605 # GL/glext.h:866
+GL_MODELVIEW14_ARB = 34606 # GL/glext.h:867
+GL_MODELVIEW15_ARB = 34607 # GL/glext.h:868
+GL_MODELVIEW16_ARB = 34608 # GL/glext.h:869
+GL_MODELVIEW17_ARB = 34609 # GL/glext.h:870
+GL_MODELVIEW18_ARB = 34610 # GL/glext.h:871
+GL_MODELVIEW19_ARB = 34611 # GL/glext.h:872
+GL_MODELVIEW20_ARB = 34612 # GL/glext.h:873
+GL_MODELVIEW21_ARB = 34613 # GL/glext.h:874
+GL_MODELVIEW22_ARB = 34614 # GL/glext.h:875
+GL_MODELVIEW23_ARB = 34615 # GL/glext.h:876
+GL_MODELVIEW24_ARB = 34616 # GL/glext.h:877
+GL_MODELVIEW25_ARB = 34617 # GL/glext.h:878
+GL_MODELVIEW26_ARB = 34618 # GL/glext.h:879
+GL_MODELVIEW27_ARB = 34619 # GL/glext.h:880
+GL_MODELVIEW28_ARB = 34620 # GL/glext.h:881
+GL_MODELVIEW29_ARB = 34621 # GL/glext.h:882
+GL_MODELVIEW30_ARB = 34622 # GL/glext.h:883
+GL_MODELVIEW31_ARB = 34623 # GL/glext.h:884
+# ARB_matrix_palette (GL/glext.h:887)
+GL_MATRIX_PALETTE_ARB = 34880 # GL/glext.h:888
+GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB = 34881 # GL/glext.h:889
+GL_MAX_PALETTE_MATRICES_ARB = 34882 # GL/glext.h:890
+GL_CURRENT_PALETTE_MATRIX_ARB = 34883 # GL/glext.h:891
+GL_MATRIX_INDEX_ARRAY_ARB = 34884 # GL/glext.h:892
+GL_CURRENT_MATRIX_INDEX_ARB = 34885 # GL/glext.h:893
+GL_MATRIX_INDEX_ARRAY_SIZE_ARB = 34886 # GL/glext.h:894
+GL_MATRIX_INDEX_ARRAY_TYPE_ARB = 34887 # GL/glext.h:895
+GL_MATRIX_INDEX_ARRAY_STRIDE_ARB = 34888 # GL/glext.h:896
+GL_MATRIX_INDEX_ARRAY_POINTER_ARB = 34889 # GL/glext.h:897
+# ARB_texture_env_combine (GL/glext.h:900)
+GL_COMBINE_ARB = 34160 # GL/glext.h:901
+GL_COMBINE_RGB_ARB = 34161 # GL/glext.h:902
+GL_COMBINE_ALPHA_ARB = 34162 # GL/glext.h:903
+GL_SOURCE0_RGB_ARB = 34176 # GL/glext.h:904
+GL_SOURCE1_RGB_ARB = 34177 # GL/glext.h:905
+GL_SOURCE2_RGB_ARB = 34178 # GL/glext.h:906
+GL_SOURCE0_ALPHA_ARB = 34184 # GL/glext.h:907
+GL_SOURCE1_ALPHA_ARB = 34185 # GL/glext.h:908
+GL_SOURCE2_ALPHA_ARB = 34186 # GL/glext.h:909
+GL_OPERAND0_RGB_ARB = 34192 # GL/glext.h:910
+GL_OPERAND1_RGB_ARB = 34193 # GL/glext.h:911
+GL_OPERAND2_RGB_ARB = 34194 # GL/glext.h:912
+GL_OPERAND0_ALPHA_ARB = 34200 # GL/glext.h:913
+GL_OPERAND1_ALPHA_ARB = 34201 # GL/glext.h:914
+GL_OPERAND2_ALPHA_ARB = 34202 # GL/glext.h:915
+GL_RGB_SCALE_ARB = 34163 # GL/glext.h:916
+GL_ADD_SIGNED_ARB = 34164 # GL/glext.h:917
+GL_INTERPOLATE_ARB = 34165 # GL/glext.h:918
+GL_SUBTRACT_ARB = 34023 # GL/glext.h:919
+GL_CONSTANT_ARB = 34166 # GL/glext.h:920
+GL_PRIMARY_COLOR_ARB = 34167 # GL/glext.h:921
+GL_PREVIOUS_ARB = 34168 # GL/glext.h:922
+# ARB_texture_env_crossbar (GL/glext.h:925)
+# ARB_texture_env_dot3 (GL/glext.h:928)
+GL_DOT3_RGB_ARB = 34478 # GL/glext.h:929
+GL_DOT3_RGBA_ARB = 34479 # GL/glext.h:930
+# ARB_texture_mirrored_repeat (GL/glext.h:933)
+GL_MIRRORED_REPEAT_ARB = 33648 # GL/glext.h:934
+# ARB_depth_texture (GL/glext.h:937)
+GL_DEPTH_COMPONENT16_ARB = 33189 # GL/glext.h:938
+GL_DEPTH_COMPONENT24_ARB = 33190 # GL/glext.h:939
+GL_DEPTH_COMPONENT32_ARB = 33191 # GL/glext.h:940
+GL_TEXTURE_DEPTH_SIZE_ARB = 34890 # GL/glext.h:941
+GL_DEPTH_TEXTURE_MODE_ARB = 34891 # GL/glext.h:942
+# ARB_shadow (GL/glext.h:945)
+GL_TEXTURE_COMPARE_MODE_ARB = 34892 # GL/glext.h:946
+GL_TEXTURE_COMPARE_FUNC_ARB = 34893 # GL/glext.h:947
+GL_COMPARE_R_TO_TEXTURE_ARB = 34894 # GL/glext.h:948
+# ARB_shadow_ambient (GL/glext.h:951)
+GL_TEXTURE_COMPARE_FAIL_VALUE_ARB = 32959 # GL/glext.h:952
+# ARB_window_pos (GL/glext.h:955)
+# ARB_vertex_program (GL/glext.h:958)
+GL_COLOR_SUM_ARB = 33880 # GL/glext.h:959
+GL_VERTEX_PROGRAM_ARB = 34336 # GL/glext.h:960
+GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB = 34338 # GL/glext.h:961
+GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB = 34339 # GL/glext.h:962
+GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB = 34340 # GL/glext.h:963
+GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB = 34341 # GL/glext.h:964
+GL_CURRENT_VERTEX_ATTRIB_ARB = 34342 # GL/glext.h:965
+GL_PROGRAM_LENGTH_ARB = 34343 # GL/glext.h:966
+GL_PROGRAM_STRING_ARB = 34344 # GL/glext.h:967
+GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB = 34350 # GL/glext.h:968
+GL_MAX_PROGRAM_MATRICES_ARB = 34351 # GL/glext.h:969
+GL_CURRENT_MATRIX_STACK_DEPTH_ARB = 34368 # GL/glext.h:970
+GL_CURRENT_MATRIX_ARB = 34369 # GL/glext.h:971
+GL_VERTEX_PROGRAM_POINT_SIZE_ARB = 34370 # GL/glext.h:972
+GL_VERTEX_PROGRAM_TWO_SIDE_ARB = 34371 # GL/glext.h:973
+GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB = 34373 # GL/glext.h:974
+GL_PROGRAM_ERROR_POSITION_ARB = 34379 # GL/glext.h:975
+GL_PROGRAM_BINDING_ARB = 34423 # GL/glext.h:976
+GL_MAX_VERTEX_ATTRIBS_ARB = 34921 # GL/glext.h:977
+GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB = 34922 # GL/glext.h:978
+GL_PROGRAM_ERROR_STRING_ARB = 34932 # GL/glext.h:979
+GL_PROGRAM_FORMAT_ASCII_ARB = 34933 # GL/glext.h:980
+GL_PROGRAM_FORMAT_ARB = 34934 # GL/glext.h:981
+GL_PROGRAM_INSTRUCTIONS_ARB = 34976 # GL/glext.h:982
+GL_MAX_PROGRAM_INSTRUCTIONS_ARB = 34977 # GL/glext.h:983
+GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB = 34978 # GL/glext.h:984
+GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB = 34979 # GL/glext.h:985
+GL_PROGRAM_TEMPORARIES_ARB = 34980 # GL/glext.h:986
+GL_MAX_PROGRAM_TEMPORARIES_ARB = 34981 # GL/glext.h:987
+GL_PROGRAM_NATIVE_TEMPORARIES_ARB = 34982 # GL/glext.h:988
+GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB = 34983 # GL/glext.h:989
+GL_PROGRAM_PARAMETERS_ARB = 34984 # GL/glext.h:990
+GL_MAX_PROGRAM_PARAMETERS_ARB = 34985 # GL/glext.h:991
+GL_PROGRAM_NATIVE_PARAMETERS_ARB = 34986 # GL/glext.h:992
+GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB = 34987 # GL/glext.h:993
+GL_PROGRAM_ATTRIBS_ARB = 34988 # GL/glext.h:994
+GL_MAX_PROGRAM_ATTRIBS_ARB = 34989 # GL/glext.h:995
+GL_PROGRAM_NATIVE_ATTRIBS_ARB = 34990 # GL/glext.h:996
+GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB = 34991 # GL/glext.h:997
+GL_PROGRAM_ADDRESS_REGISTERS_ARB = 34992 # GL/glext.h:998
+GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB = 34993 # GL/glext.h:999
+GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = 34994 # GL/glext.h:1000
+GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = 34995 # GL/glext.h:1001
+GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB = 34996 # GL/glext.h:1002
+GL_MAX_PROGRAM_ENV_PARAMETERS_ARB = 34997 # GL/glext.h:1003
+GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB = 34998 # GL/glext.h:1004
+GL_TRANSPOSE_CURRENT_MATRIX_ARB = 34999 # GL/glext.h:1005
+GL_MATRIX0_ARB = 35008 # GL/glext.h:1006
+GL_MATRIX1_ARB = 35009 # GL/glext.h:1007
+GL_MATRIX2_ARB = 35010 # GL/glext.h:1008
+GL_MATRIX3_ARB = 35011 # GL/glext.h:1009
+GL_MATRIX4_ARB = 35012 # GL/glext.h:1010
+GL_MATRIX5_ARB = 35013 # GL/glext.h:1011
+GL_MATRIX6_ARB = 35014 # GL/glext.h:1012
+GL_MATRIX7_ARB = 35015 # GL/glext.h:1013
+GL_MATRIX8_ARB = 35016 # GL/glext.h:1014
+GL_MATRIX9_ARB = 35017 # GL/glext.h:1015
+GL_MATRIX10_ARB = 35018 # GL/glext.h:1016
+GL_MATRIX11_ARB = 35019 # GL/glext.h:1017
+GL_MATRIX12_ARB = 35020 # GL/glext.h:1018
+GL_MATRIX13_ARB = 35021 # GL/glext.h:1019
+GL_MATRIX14_ARB = 35022 # GL/glext.h:1020
+GL_MATRIX15_ARB = 35023 # GL/glext.h:1021
+GL_MATRIX16_ARB = 35024 # GL/glext.h:1022
+GL_MATRIX17_ARB = 35025 # GL/glext.h:1023
+GL_MATRIX18_ARB = 35026 # GL/glext.h:1024
+GL_MATRIX19_ARB = 35027 # GL/glext.h:1025
+GL_MATRIX20_ARB = 35028 # GL/glext.h:1026
+GL_MATRIX21_ARB = 35029 # GL/glext.h:1027
+GL_MATRIX22_ARB = 35030 # GL/glext.h:1028
+GL_MATRIX23_ARB = 35031 # GL/glext.h:1029
+GL_MATRIX24_ARB = 35032 # GL/glext.h:1030
+GL_MATRIX25_ARB = 35033 # GL/glext.h:1031
+GL_MATRIX26_ARB = 35034 # GL/glext.h:1032
+GL_MATRIX27_ARB = 35035 # GL/glext.h:1033
+GL_MATRIX28_ARB = 35036 # GL/glext.h:1034
+GL_MATRIX29_ARB = 35037 # GL/glext.h:1035
+GL_MATRIX30_ARB = 35038 # GL/glext.h:1036
+GL_MATRIX31_ARB = 35039 # GL/glext.h:1037
+# ARB_fragment_program (GL/glext.h:1040)
+GL_FRAGMENT_PROGRAM_ARB = 34820 # GL/glext.h:1041
+GL_PROGRAM_ALU_INSTRUCTIONS_ARB = 34821 # GL/glext.h:1042
+GL_PROGRAM_TEX_INSTRUCTIONS_ARB = 34822 # GL/glext.h:1043
+GL_PROGRAM_TEX_INDIRECTIONS_ARB = 34823 # GL/glext.h:1044
+GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = 34824 # GL/glext.h:1045
+GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = 34825 # GL/glext.h:1046
+GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = 34826 # GL/glext.h:1047
+GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB = 34827 # GL/glext.h:1048
+GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB = 34828 # GL/glext.h:1049
+GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB = 34829 # GL/glext.h:1050
+GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = 34830 # GL/glext.h:1051
+GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = 34831 # GL/glext.h:1052
+GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = 34832 # GL/glext.h:1053
+GL_MAX_TEXTURE_COORDS_ARB = 34929 # GL/glext.h:1054
+GL_MAX_TEXTURE_IMAGE_UNITS_ARB = 34930 # GL/glext.h:1055
+# ARB_vertex_buffer_object (GL/glext.h:1058)
+GL_BUFFER_SIZE_ARB = 34660 # GL/glext.h:1059
+GL_BUFFER_USAGE_ARB = 34661 # GL/glext.h:1060
+GL_ARRAY_BUFFER_ARB = 34962 # GL/glext.h:1061
+GL_ELEMENT_ARRAY_BUFFER_ARB = 34963 # GL/glext.h:1062
+GL_ARRAY_BUFFER_BINDING_ARB = 34964 # GL/glext.h:1063
+GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB = 34965 # GL/glext.h:1064
+GL_VERTEX_ARRAY_BUFFER_BINDING_ARB = 34966 # GL/glext.h:1065
+GL_NORMAL_ARRAY_BUFFER_BINDING_ARB = 34967 # GL/glext.h:1066
+GL_COLOR_ARRAY_BUFFER_BINDING_ARB = 34968 # GL/glext.h:1067
+GL_INDEX_ARRAY_BUFFER_BINDING_ARB = 34969 # GL/glext.h:1068
+GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB = 34970 # GL/glext.h:1069
+GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB = 34971 # GL/glext.h:1070
+GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB = 34972 # GL/glext.h:1071
+GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB = 34973 # GL/glext.h:1072
+GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB = 34974 # GL/glext.h:1073
+GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB = 34975 # GL/glext.h:1074
+GL_READ_ONLY_ARB = 35000 # GL/glext.h:1075
+GL_WRITE_ONLY_ARB = 35001 # GL/glext.h:1076
+GL_READ_WRITE_ARB = 35002 # GL/glext.h:1077
+GL_BUFFER_ACCESS_ARB = 35003 # GL/glext.h:1078
+GL_BUFFER_MAPPED_ARB = 35004 # GL/glext.h:1079
+GL_BUFFER_MAP_POINTER_ARB = 35005 # GL/glext.h:1080
+GL_STREAM_DRAW_ARB = 35040 # GL/glext.h:1081
+GL_STREAM_READ_ARB = 35041 # GL/glext.h:1082
+GL_STREAM_COPY_ARB = 35042 # GL/glext.h:1083
+GL_STATIC_DRAW_ARB = 35044 # GL/glext.h:1084
+GL_STATIC_READ_ARB = 35045 # GL/glext.h:1085
+GL_STATIC_COPY_ARB = 35046 # GL/glext.h:1086
+GL_DYNAMIC_DRAW_ARB = 35048 # GL/glext.h:1087
+GL_DYNAMIC_READ_ARB = 35049 # GL/glext.h:1088
+GL_DYNAMIC_COPY_ARB = 35050 # GL/glext.h:1089
+# ARB_occlusion_query (GL/glext.h:1092)
+GL_QUERY_COUNTER_BITS_ARB = 34916 # GL/glext.h:1093
+GL_CURRENT_QUERY_ARB = 34917 # GL/glext.h:1094
+GL_QUERY_RESULT_ARB = 34918 # GL/glext.h:1095
+GL_QUERY_RESULT_AVAILABLE_ARB = 34919 # GL/glext.h:1096
+GL_SAMPLES_PASSED_ARB = 35092 # GL/glext.h:1097
+# ARB_shader_objects (GL/glext.h:1100)
+GL_PROGRAM_OBJECT_ARB = 35648 # GL/glext.h:1101
+GL_SHADER_OBJECT_ARB = 35656 # GL/glext.h:1102
+GL_OBJECT_TYPE_ARB = 35662 # GL/glext.h:1103
+GL_OBJECT_SUBTYPE_ARB = 35663 # GL/glext.h:1104
+GL_FLOAT_VEC2_ARB = 35664 # GL/glext.h:1105
+GL_FLOAT_VEC3_ARB = 35665 # GL/glext.h:1106
+GL_FLOAT_VEC4_ARB = 35666 # GL/glext.h:1107
+GL_INT_VEC2_ARB = 35667 # GL/glext.h:1108
+GL_INT_VEC3_ARB = 35668 # GL/glext.h:1109
+GL_INT_VEC4_ARB = 35669 # GL/glext.h:1110
+GL_BOOL_ARB = 35670 # GL/glext.h:1111
+GL_BOOL_VEC2_ARB = 35671 # GL/glext.h:1112
+GL_BOOL_VEC3_ARB = 35672 # GL/glext.h:1113
+GL_BOOL_VEC4_ARB = 35673 # GL/glext.h:1114
+GL_FLOAT_MAT2_ARB = 35674 # GL/glext.h:1115
+GL_FLOAT_MAT3_ARB = 35675 # GL/glext.h:1116
+GL_FLOAT_MAT4_ARB = 35676 # GL/glext.h:1117
+GL_SAMPLER_1D_ARB = 35677 # GL/glext.h:1118
+GL_SAMPLER_2D_ARB = 35678 # GL/glext.h:1119
+GL_SAMPLER_3D_ARB = 35679 # GL/glext.h:1120
+GL_SAMPLER_CUBE_ARB = 35680 # GL/glext.h:1121
+GL_SAMPLER_1D_SHADOW_ARB = 35681 # GL/glext.h:1122
+GL_SAMPLER_2D_SHADOW_ARB = 35682 # GL/glext.h:1123
+GL_SAMPLER_2D_RECT_ARB = 35683 # GL/glext.h:1124
+GL_SAMPLER_2D_RECT_SHADOW_ARB = 35684 # GL/glext.h:1125
+GL_OBJECT_DELETE_STATUS_ARB = 35712 # GL/glext.h:1126
+GL_OBJECT_COMPILE_STATUS_ARB = 35713 # GL/glext.h:1127
+GL_OBJECT_LINK_STATUS_ARB = 35714 # GL/glext.h:1128
+GL_OBJECT_VALIDATE_STATUS_ARB = 35715 # GL/glext.h:1129
+GL_OBJECT_INFO_LOG_LENGTH_ARB = 35716 # GL/glext.h:1130
+GL_OBJECT_ATTACHED_OBJECTS_ARB = 35717 # GL/glext.h:1131
+GL_OBJECT_ACTIVE_UNIFORMS_ARB = 35718 # GL/glext.h:1132
+GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB = 35719 # GL/glext.h:1133
+GL_OBJECT_SHADER_SOURCE_LENGTH_ARB = 35720 # GL/glext.h:1134
+# ARB_vertex_shader (GL/glext.h:1137)
+GL_VERTEX_SHADER_ARB = 35633 # GL/glext.h:1138
+GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB = 35658 # GL/glext.h:1139
+GL_MAX_VARYING_FLOATS_ARB = 35659 # GL/glext.h:1140
+GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB = 35660 # GL/glext.h:1141
+GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB = 35661 # GL/glext.h:1142
+GL_OBJECT_ACTIVE_ATTRIBUTES_ARB = 35721 # GL/glext.h:1143
+GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB = 35722 # GL/glext.h:1144
+# ARB_fragment_shader (GL/glext.h:1147)
+GL_FRAGMENT_SHADER_ARB = 35632 # GL/glext.h:1148
+GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB = 35657 # GL/glext.h:1149
+GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB = 35723 # GL/glext.h:1150
+# ARB_shading_language_100 (GL/glext.h:1153)
+GL_SHADING_LANGUAGE_VERSION_ARB = 35724 # GL/glext.h:1154
+# ARB_texture_non_power_of_two (GL/glext.h:1157)
+# ARB_point_sprite (GL/glext.h:1160)
+GL_POINT_SPRITE_ARB = 34913 # GL/glext.h:1161
+GL_COORD_REPLACE_ARB = 34914 # GL/glext.h:1162
+# ARB_fragment_program_shadow (GL/glext.h:1165)
+# ARB_draw_buffers (GL/glext.h:1168)
+GL_MAX_DRAW_BUFFERS_ARB = 34852 # GL/glext.h:1169
+GL_DRAW_BUFFER0_ARB = 34853 # GL/glext.h:1170
+GL_DRAW_BUFFER1_ARB = 34854 # GL/glext.h:1171
+GL_DRAW_BUFFER2_ARB = 34855 # GL/glext.h:1172
+GL_DRAW_BUFFER3_ARB = 34856 # GL/glext.h:1173
+GL_DRAW_BUFFER4_ARB = 34857 # GL/glext.h:1174
+GL_DRAW_BUFFER5_ARB = 34858 # GL/glext.h:1175
+GL_DRAW_BUFFER6_ARB = 34859 # GL/glext.h:1176
+GL_DRAW_BUFFER7_ARB = 34860 # GL/glext.h:1177
+GL_DRAW_BUFFER8_ARB = 34861 # GL/glext.h:1178
+GL_DRAW_BUFFER9_ARB = 34862 # GL/glext.h:1179
+GL_DRAW_BUFFER10_ARB = 34863 # GL/glext.h:1180
+GL_DRAW_BUFFER11_ARB = 34864 # GL/glext.h:1181
+GL_DRAW_BUFFER12_ARB = 34865 # GL/glext.h:1182
+GL_DRAW_BUFFER13_ARB = 34866 # GL/glext.h:1183
+GL_DRAW_BUFFER14_ARB = 34867 # GL/glext.h:1184
+GL_DRAW_BUFFER15_ARB = 34868 # GL/glext.h:1185
+# ARB_texture_rectangle (GL/glext.h:1188)
+GL_TEXTURE_RECTANGLE_ARB = 34037 # GL/glext.h:1189
+GL_TEXTURE_BINDING_RECTANGLE_ARB = 34038 # GL/glext.h:1190
+GL_PROXY_TEXTURE_RECTANGLE_ARB = 34039 # GL/glext.h:1191
+GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB = 34040 # GL/glext.h:1192
+# ARB_color_buffer_float (GL/glext.h:1195)
+GL_RGBA_FLOAT_MODE_ARB = 34848 # GL/glext.h:1196
+GL_CLAMP_VERTEX_COLOR_ARB = 35098 # GL/glext.h:1197
+GL_CLAMP_FRAGMENT_COLOR_ARB = 35099 # GL/glext.h:1198
+GL_CLAMP_READ_COLOR_ARB = 35100 # GL/glext.h:1199
+GL_FIXED_ONLY_ARB = 35101 # GL/glext.h:1200
+# ARB_half_float_pixel (GL/glext.h:1203)
+GL_HALF_FLOAT_ARB = 5131 # GL/glext.h:1204
+# ARB_texture_float (GL/glext.h:1207)
+GL_TEXTURE_RED_TYPE_ARB = 35856 # GL/glext.h:1208
+GL_TEXTURE_GREEN_TYPE_ARB = 35857 # GL/glext.h:1209
+GL_TEXTURE_BLUE_TYPE_ARB = 35858 # GL/glext.h:1210
+GL_TEXTURE_ALPHA_TYPE_ARB = 35859 # GL/glext.h:1211
+GL_TEXTURE_LUMINANCE_TYPE_ARB = 35860 # GL/glext.h:1212
+GL_TEXTURE_INTENSITY_TYPE_ARB = 35861 # GL/glext.h:1213
+GL_TEXTURE_DEPTH_TYPE_ARB = 35862 # GL/glext.h:1214
+GL_UNSIGNED_NORMALIZED_ARB = 35863 # GL/glext.h:1215
+GL_RGBA32F_ARB = 34836 # GL/glext.h:1216
+GL_RGB32F_ARB = 34837 # GL/glext.h:1217
+GL_ALPHA32F_ARB = 34838 # GL/glext.h:1218
+GL_INTENSITY32F_ARB = 34839 # GL/glext.h:1219
+GL_LUMINANCE32F_ARB = 34840 # GL/glext.h:1220
+GL_LUMINANCE_ALPHA32F_ARB = 34841 # GL/glext.h:1221
+GL_RGBA16F_ARB = 34842 # GL/glext.h:1222
+GL_RGB16F_ARB = 34843 # GL/glext.h:1223
+GL_ALPHA16F_ARB = 34844 # GL/glext.h:1224
+GL_INTENSITY16F_ARB = 34845 # GL/glext.h:1225
+GL_LUMINANCE16F_ARB = 34846 # GL/glext.h:1226
+GL_LUMINANCE_ALPHA16F_ARB = 34847 # GL/glext.h:1227
+# ARB_pixel_buffer_object (GL/glext.h:1230)
+GL_PIXEL_PACK_BUFFER_ARB = 35051 # GL/glext.h:1231
+GL_PIXEL_UNPACK_BUFFER_ARB = 35052 # GL/glext.h:1232
+GL_PIXEL_PACK_BUFFER_BINDING_ARB = 35053 # GL/glext.h:1233
+GL_PIXEL_UNPACK_BUFFER_BINDING_ARB = 35055 # GL/glext.h:1234
+# ARB_depth_buffer_float (GL/glext.h:1237)
+GL_DEPTH_COMPONENT32F = 36012 # GL/glext.h:1238
+GL_DEPTH32F_STENCIL8 = 36013 # GL/glext.h:1239
+GL_FLOAT_32_UNSIGNED_INT_24_8_REV = 36269 # GL/glext.h:1240
+# ARB_draw_instanced (GL/glext.h:1243)
+# ARB_framebuffer_object (GL/glext.h:1246)
+GL_INVALID_FRAMEBUFFER_OPERATION = 1286 # GL/glext.h:1247
+GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 33296 # GL/glext.h:1248
+GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 33297 # GL/glext.h:1249
+GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE = 33298 # GL/glext.h:1250
+GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 33299 # GL/glext.h:1251
+GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 33300 # GL/glext.h:1252
+GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 33301 # GL/glext.h:1253
+GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 33302 # GL/glext.h:1254
+GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 33303 # GL/glext.h:1255
+GL_FRAMEBUFFER_DEFAULT = 33304 # GL/glext.h:1256
+GL_FRAMEBUFFER_UNDEFINED = 33305 # GL/glext.h:1257
+GL_DEPTH_STENCIL_ATTACHMENT = 33306 # GL/glext.h:1258
+GL_INDEX = 33314 # GL/glext.h:1259
+GL_MAX_RENDERBUFFER_SIZE = 34024 # GL/glext.h:1260
+GL_DEPTH_STENCIL = 34041 # GL/glext.h:1261
+GL_UNSIGNED_INT_24_8 = 34042 # GL/glext.h:1262
+GL_DEPTH24_STENCIL8 = 35056 # GL/glext.h:1263
+GL_TEXTURE_STENCIL_SIZE = 35057 # GL/glext.h:1264
+GL_FRAMEBUFFER_BINDING = 36006 # GL/glext.h:1265
+GL_DRAW_FRAMEBUFFER_BINDING = 36006 # GL/glext.h:1266
+GL_RENDERBUFFER_BINDING = 36007 # GL/glext.h:1267
+GL_READ_FRAMEBUFFER = 36008 # GL/glext.h:1268
+GL_DRAW_FRAMEBUFFER = 36009 # GL/glext.h:1269
+GL_READ_FRAMEBUFFER_BINDING = 36010 # GL/glext.h:1270
+GL_RENDERBUFFER_SAMPLES = 36011 # GL/glext.h:1271
+GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 36048 # GL/glext.h:1272
+GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 36049 # GL/glext.h:1273
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 36050 # GL/glext.h:1274
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 36051 # GL/glext.h:1275
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 36052 # GL/glext.h:1276
+GL_FRAMEBUFFER_COMPLETE = 36053 # GL/glext.h:1277
+GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 36054 # GL/glext.h:1278
+GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 36055 # GL/glext.h:1279
+GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = 36059 # GL/glext.h:1280
+GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 36060 # GL/glext.h:1281
+GL_FRAMEBUFFER_UNSUPPORTED = 36061 # GL/glext.h:1282
+GL_MAX_COLOR_ATTACHMENTS = 36063 # GL/glext.h:1283
+GL_COLOR_ATTACHMENT0 = 36064 # GL/glext.h:1284
+GL_COLOR_ATTACHMENT1 = 36065 # GL/glext.h:1285
+GL_COLOR_ATTACHMENT2 = 36066 # GL/glext.h:1286
+GL_COLOR_ATTACHMENT3 = 36067 # GL/glext.h:1287
+GL_COLOR_ATTACHMENT4 = 36068 # GL/glext.h:1288
+GL_COLOR_ATTACHMENT5 = 36069 # GL/glext.h:1289
+GL_COLOR_ATTACHMENT6 = 36070 # GL/glext.h:1290
+GL_COLOR_ATTACHMENT7 = 36071 # GL/glext.h:1291
+GL_COLOR_ATTACHMENT8 = 36072 # GL/glext.h:1292
+GL_COLOR_ATTACHMENT9 = 36073 # GL/glext.h:1293
+GL_COLOR_ATTACHMENT10 = 36074 # GL/glext.h:1294
+GL_COLOR_ATTACHMENT11 = 36075 # GL/glext.h:1295
+GL_COLOR_ATTACHMENT12 = 36076 # GL/glext.h:1296
+GL_COLOR_ATTACHMENT13 = 36077 # GL/glext.h:1297
+GL_COLOR_ATTACHMENT14 = 36078 # GL/glext.h:1298
+GL_COLOR_ATTACHMENT15 = 36079 # GL/glext.h:1299
+GL_DEPTH_ATTACHMENT = 36096 # GL/glext.h:1300
+GL_STENCIL_ATTACHMENT = 36128 # GL/glext.h:1301
+GL_FRAMEBUFFER = 36160 # GL/glext.h:1302
+GL_RENDERBUFFER = 36161 # GL/glext.h:1303
+GL_RENDERBUFFER_WIDTH = 36162 # GL/glext.h:1304
+GL_RENDERBUFFER_HEIGHT = 36163 # GL/glext.h:1305
+GL_RENDERBUFFER_INTERNAL_FORMAT = 36164 # GL/glext.h:1306
+GL_STENCIL_INDEX1 = 36166 # GL/glext.h:1307
+GL_STENCIL_INDEX4 = 36167 # GL/glext.h:1308
+GL_STENCIL_INDEX8 = 36168 # GL/glext.h:1309
+GL_STENCIL_INDEX16 = 36169 # GL/glext.h:1310
+GL_RENDERBUFFER_RED_SIZE = 36176 # GL/glext.h:1311
+GL_RENDERBUFFER_GREEN_SIZE = 36177 # GL/glext.h:1312
+GL_RENDERBUFFER_BLUE_SIZE = 36178 # GL/glext.h:1313
+GL_RENDERBUFFER_ALPHA_SIZE = 36179 # GL/glext.h:1314
+GL_RENDERBUFFER_DEPTH_SIZE = 36180 # GL/glext.h:1315
+GL_RENDERBUFFER_STENCIL_SIZE = 36181 # GL/glext.h:1316
+GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 36182 # GL/glext.h:1317
+GL_MAX_SAMPLES = 36183 # GL/glext.h:1318
+# ARB_framebuffer_sRGB (GL/glext.h:1321)
+GL_FRAMEBUFFER_SRGB = 36281 # GL/glext.h:1322
+# ARB_geometry_shader4 (GL/glext.h:1325)
+GL_LINES_ADJACENCY_ARB = 10 # GL/glext.h:1326
+GL_LINE_STRIP_ADJACENCY_ARB = 11 # GL/glext.h:1327
+GL_TRIANGLES_ADJACENCY_ARB = 12 # GL/glext.h:1328
+GL_TRIANGLE_STRIP_ADJACENCY_ARB = 13 # GL/glext.h:1329
+GL_PROGRAM_POINT_SIZE_ARB = 34370 # GL/glext.h:1330
+GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB = 35881 # GL/glext.h:1331
+GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB = 36263 # GL/glext.h:1332
+GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB = 36264 # GL/glext.h:1333
+GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB = 36265 # GL/glext.h:1334
+GL_GEOMETRY_SHADER_ARB = 36313 # GL/glext.h:1335
+GL_GEOMETRY_VERTICES_OUT_ARB = 36314 # GL/glext.h:1336
+GL_GEOMETRY_INPUT_TYPE_ARB = 36315 # GL/glext.h:1337
+GL_GEOMETRY_OUTPUT_TYPE_ARB = 36316 # GL/glext.h:1338
+GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB = 36317 # GL/glext.h:1339
+GL_MAX_VERTEX_VARYING_COMPONENTS_ARB = 36318 # GL/glext.h:1340
+GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB = 36319 # GL/glext.h:1341
+GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB = 36320 # GL/glext.h:1342
+GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB = 36321 # GL/glext.h:1343
+# ARB_half_float_vertex (GL/glext.h:1348)
+GL_HALF_FLOAT = 5131 # GL/glext.h:1349
+# ARB_instanced_arrays (GL/glext.h:1352)
+# ARB_map_buffer_range (GL/glext.h:1355)
+GL_MAP_READ_BIT = 1 # GL/glext.h:1356
+GL_MAP_WRITE_BIT = 2 # GL/glext.h:1357
+GL_MAP_INVALIDATE_RANGE_BIT = 4 # GL/glext.h:1358
+GL_MAP_INVALIDATE_BUFFER_BIT = 8 # GL/glext.h:1359
+GL_MAP_FLUSH_EXPLICIT_BIT = 16 # GL/glext.h:1360
+GL_MAP_UNSYNCHRONIZED_BIT = 32 # GL/glext.h:1361
+# ARB_texture_buffer_object (GL/glext.h:1364)
+GL_TEXTURE_BUFFER_ARB = 35882 # GL/glext.h:1365
+GL_MAX_TEXTURE_BUFFER_SIZE_ARB = 35883 # GL/glext.h:1366
+GL_TEXTURE_BINDING_BUFFER_ARB = 35884 # GL/glext.h:1367
+GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB = 35885 # GL/glext.h:1368
+GL_TEXTURE_BUFFER_FORMAT_ARB = 35886 # GL/glext.h:1369
+# ARB_texture_compression_rgtc (GL/glext.h:1372)
+GL_COMPRESSED_RED_RGTC1 = 36283 # GL/glext.h:1373
+GL_COMPRESSED_SIGNED_RED_RGTC1 = 36284 # GL/glext.h:1374
+GL_COMPRESSED_RG_RGTC2 = 36285 # GL/glext.h:1375
+GL_COMPRESSED_SIGNED_RG_RGTC2 = 36286 # GL/glext.h:1376
+# ARB_texture_rg (GL/glext.h:1379)
+GL_RG = 33319 # GL/glext.h:1380
+GL_RG_INTEGER = 33320 # GL/glext.h:1381
+GL_R8 = 33321 # GL/glext.h:1382
+GL_R16 = 33322 # GL/glext.h:1383
+GL_RG8 = 33323 # GL/glext.h:1384
+GL_RG16 = 33324 # GL/glext.h:1385
+GL_R16F = 33325 # GL/glext.h:1386
+GL_R32F = 33326 # GL/glext.h:1387
+GL_RG16F = 33327 # GL/glext.h:1388
+GL_RG32F = 33328 # GL/glext.h:1389
+GL_R8I = 33329 # GL/glext.h:1390
+GL_R8UI = 33330 # GL/glext.h:1391
+GL_R16I = 33331 # GL/glext.h:1392
+GL_R16UI = 33332 # GL/glext.h:1393
+GL_R32I = 33333 # GL/glext.h:1394
+GL_R32UI = 33334 # GL/glext.h:1395
+GL_RG8I = 33335 # GL/glext.h:1396
+GL_RG8UI = 33336 # GL/glext.h:1397
+GL_RG16I = 33337 # GL/glext.h:1398
+GL_RG16UI = 33338 # GL/glext.h:1399
+GL_RG32I = 33339 # GL/glext.h:1400
+GL_RG32UI = 33340 # GL/glext.h:1401
+# ARB_vertex_array_object (GL/glext.h:1404)
+GL_VERTEX_ARRAY_BINDING = 34229 # GL/glext.h:1405
+# EXT_abgr (GL/glext.h:1408)
+GL_ABGR_EXT = 32768 # GL/glext.h:1409
+# EXT_blend_color (GL/glext.h:1412)
+GL_CONSTANT_COLOR_EXT = 32769 # GL/glext.h:1413
+GL_ONE_MINUS_CONSTANT_COLOR_EXT = 32770 # GL/glext.h:1414
+GL_CONSTANT_ALPHA_EXT = 32771 # GL/glext.h:1415
+GL_ONE_MINUS_CONSTANT_ALPHA_EXT = 32772 # GL/glext.h:1416
+GL_BLEND_COLOR_EXT = 32773 # GL/glext.h:1417
+# EXT_polygon_offset (GL/glext.h:1420)
+GL_POLYGON_OFFSET_EXT = 32823 # GL/glext.h:1421
+GL_POLYGON_OFFSET_FACTOR_EXT = 32824 # GL/glext.h:1422
+GL_POLYGON_OFFSET_BIAS_EXT = 32825 # GL/glext.h:1423
+# EXT_texture (GL/glext.h:1426)
+GL_ALPHA4_EXT = 32827 # GL/glext.h:1427
+GL_ALPHA8_EXT = 32828 # GL/glext.h:1428
+GL_ALPHA12_EXT = 32829 # GL/glext.h:1429
+GL_ALPHA16_EXT = 32830 # GL/glext.h:1430
+GL_LUMINANCE4_EXT = 32831 # GL/glext.h:1431
+GL_LUMINANCE8_EXT = 32832 # GL/glext.h:1432
+GL_LUMINANCE12_EXT = 32833 # GL/glext.h:1433
+GL_LUMINANCE16_EXT = 32834 # GL/glext.h:1434
+GL_LUMINANCE4_ALPHA4_EXT = 32835 # GL/glext.h:1435
+GL_LUMINANCE6_ALPHA2_EXT = 32836 # GL/glext.h:1436
+GL_LUMINANCE8_ALPHA8_EXT = 32837 # GL/glext.h:1437
+GL_LUMINANCE12_ALPHA4_EXT = 32838 # GL/glext.h:1438
+GL_LUMINANCE12_ALPHA12_EXT = 32839 # GL/glext.h:1439
+GL_LUMINANCE16_ALPHA16_EXT = 32840 # GL/glext.h:1440
+GL_INTENSITY_EXT = 32841 # GL/glext.h:1441
+GL_INTENSITY4_EXT = 32842 # GL/glext.h:1442
+GL_INTENSITY8_EXT = 32843 # GL/glext.h:1443
+GL_INTENSITY12_EXT = 32844 # GL/glext.h:1444
+GL_INTENSITY16_EXT = 32845 # GL/glext.h:1445
+GL_RGB2_EXT = 32846 # GL/glext.h:1446
+GL_RGB4_EXT = 32847 # GL/glext.h:1447
+GL_RGB5_EXT = 32848 # GL/glext.h:1448
+GL_RGB8_EXT = 32849 # GL/glext.h:1449
+GL_RGB10_EXT = 32850 # GL/glext.h:1450
+GL_RGB12_EXT = 32851 # GL/glext.h:1451
+GL_RGB16_EXT = 32852 # GL/glext.h:1452
+GL_RGBA2_EXT = 32853 # GL/glext.h:1453
+GL_RGBA4_EXT = 32854 # GL/glext.h:1454
+GL_RGB5_A1_EXT = 32855 # GL/glext.h:1455
+GL_RGBA8_EXT = 32856 # GL/glext.h:1456
+GL_RGB10_A2_EXT = 32857 # GL/glext.h:1457
+GL_RGBA12_EXT = 32858 # GL/glext.h:1458
+GL_RGBA16_EXT = 32859 # GL/glext.h:1459
+GL_TEXTURE_RED_SIZE_EXT = 32860 # GL/glext.h:1460
+GL_TEXTURE_GREEN_SIZE_EXT = 32861 # GL/glext.h:1461
+GL_TEXTURE_BLUE_SIZE_EXT = 32862 # GL/glext.h:1462
+GL_TEXTURE_ALPHA_SIZE_EXT = 32863 # GL/glext.h:1463
+GL_TEXTURE_LUMINANCE_SIZE_EXT = 32864 # GL/glext.h:1464
+GL_TEXTURE_INTENSITY_SIZE_EXT = 32865 # GL/glext.h:1465
+GL_REPLACE_EXT = 32866 # GL/glext.h:1466
+GL_PROXY_TEXTURE_1D_EXT = 32867 # GL/glext.h:1467
+GL_PROXY_TEXTURE_2D_EXT = 32868 # GL/glext.h:1468
+GL_TEXTURE_TOO_LARGE_EXT = 32869 # GL/glext.h:1469
+# EXT_texture3D (GL/glext.h:1472)
+GL_PACK_SKIP_IMAGES_EXT = 32875 # GL/glext.h:1473
+GL_PACK_IMAGE_HEIGHT_EXT = 32876 # GL/glext.h:1474
+GL_UNPACK_SKIP_IMAGES_EXT = 32877 # GL/glext.h:1475
+GL_UNPACK_IMAGE_HEIGHT_EXT = 32878 # GL/glext.h:1476
+GL_TEXTURE_3D_EXT = 32879 # GL/glext.h:1477
+GL_PROXY_TEXTURE_3D_EXT = 32880 # GL/glext.h:1478
+GL_TEXTURE_DEPTH_EXT = 32881 # GL/glext.h:1479
+GL_TEXTURE_WRAP_R_EXT = 32882 # GL/glext.h:1480
+GL_MAX_3D_TEXTURE_SIZE_EXT = 32883 # GL/glext.h:1481
+# SGIS_texture_filter4 (GL/glext.h:1484)
+GL_FILTER4_SGIS = 33094 # GL/glext.h:1485
+GL_TEXTURE_FILTER4_SIZE_SGIS = 33095 # GL/glext.h:1486
+# EXT_subtexture (GL/glext.h:1489)
+# EXT_copy_texture (GL/glext.h:1492)
+# EXT_histogram (GL/glext.h:1495)
+GL_HISTOGRAM_EXT = 32804 # GL/glext.h:1496
+GL_PROXY_HISTOGRAM_EXT = 32805 # GL/glext.h:1497
+GL_HISTOGRAM_WIDTH_EXT = 32806 # GL/glext.h:1498
+GL_HISTOGRAM_FORMAT_EXT = 32807 # GL/glext.h:1499
+GL_HISTOGRAM_RED_SIZE_EXT = 32808 # GL/glext.h:1500
+GL_HISTOGRAM_GREEN_SIZE_EXT = 32809 # GL/glext.h:1501
+GL_HISTOGRAM_BLUE_SIZE_EXT = 32810 # GL/glext.h:1502
+GL_HISTOGRAM_ALPHA_SIZE_EXT = 32811 # GL/glext.h:1503
+GL_HISTOGRAM_LUMINANCE_SIZE_EXT = 32812 # GL/glext.h:1504
+GL_HISTOGRAM_SINK_EXT = 32813 # GL/glext.h:1505
+GL_MINMAX_EXT = 32814 # GL/glext.h:1506
+GL_MINMAX_FORMAT_EXT = 32815 # GL/glext.h:1507
+GL_MINMAX_SINK_EXT = 32816 # GL/glext.h:1508
+GL_TABLE_TOO_LARGE_EXT = 32817 # GL/glext.h:1509
+# EXT_convolution (GL/glext.h:1512)
+GL_CONVOLUTION_1D_EXT = 32784 # GL/glext.h:1513
+GL_CONVOLUTION_2D_EXT = 32785 # GL/glext.h:1514
+GL_SEPARABLE_2D_EXT = 32786 # GL/glext.h:1515
+GL_CONVOLUTION_BORDER_MODE_EXT = 32787 # GL/glext.h:1516
+GL_CONVOLUTION_FILTER_SCALE_EXT = 32788 # GL/glext.h:1517
+GL_CONVOLUTION_FILTER_BIAS_EXT = 32789 # GL/glext.h:1518
+GL_REDUCE_EXT = 32790 # GL/glext.h:1519
+GL_CONVOLUTION_FORMAT_EXT = 32791 # GL/glext.h:1520
+GL_CONVOLUTION_WIDTH_EXT = 32792 # GL/glext.h:1521
+GL_CONVOLUTION_HEIGHT_EXT = 32793 # GL/glext.h:1522
+GL_MAX_CONVOLUTION_WIDTH_EXT = 32794 # GL/glext.h:1523
+GL_MAX_CONVOLUTION_HEIGHT_EXT = 32795 # GL/glext.h:1524
+GL_POST_CONVOLUTION_RED_SCALE_EXT = 32796 # GL/glext.h:1525
+GL_POST_CONVOLUTION_GREEN_SCALE_EXT = 32797 # GL/glext.h:1526
+GL_POST_CONVOLUTION_BLUE_SCALE_EXT = 32798 # GL/glext.h:1527
+GL_POST_CONVOLUTION_ALPHA_SCALE_EXT = 32799 # GL/glext.h:1528
+GL_POST_CONVOLUTION_RED_BIAS_EXT = 32800 # GL/glext.h:1529
+GL_POST_CONVOLUTION_GREEN_BIAS_EXT = 32801 # GL/glext.h:1530
+GL_POST_CONVOLUTION_BLUE_BIAS_EXT = 32802 # GL/glext.h:1531
+GL_POST_CONVOLUTION_ALPHA_BIAS_EXT = 32803 # GL/glext.h:1532
+# SGI_color_matrix (GL/glext.h:1535)
+GL_COLOR_MATRIX_SGI = 32945 # GL/glext.h:1536
+GL_COLOR_MATRIX_STACK_DEPTH_SGI = 32946 # GL/glext.h:1537
+GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI = 32947 # GL/glext.h:1538
+GL_POST_COLOR_MATRIX_RED_SCALE_SGI = 32948 # GL/glext.h:1539
+GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI = 32949 # GL/glext.h:1540
+GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI = 32950 # GL/glext.h:1541
+GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI = 32951 # GL/glext.h:1542
+GL_POST_COLOR_MATRIX_RED_BIAS_SGI = 32952 # GL/glext.h:1543
+GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI = 32953 # GL/glext.h:1544
+GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI = 32954 # GL/glext.h:1545
+GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI = 32955 # GL/glext.h:1546
+# SGI_color_table (GL/glext.h:1549)
+GL_COLOR_TABLE_SGI = 32976 # GL/glext.h:1550
+GL_POST_CONVOLUTION_COLOR_TABLE_SGI = 32977 # GL/glext.h:1551
+GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI = 32978 # GL/glext.h:1552
+GL_PROXY_COLOR_TABLE_SGI = 32979 # GL/glext.h:1553
+GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI = 32980 # GL/glext.h:1554
+GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI = 32981 # GL/glext.h:1555
+GL_COLOR_TABLE_SCALE_SGI = 32982 # GL/glext.h:1556
+GL_COLOR_TABLE_BIAS_SGI = 32983 # GL/glext.h:1557
+GL_COLOR_TABLE_FORMAT_SGI = 32984 # GL/glext.h:1558
+GL_COLOR_TABLE_WIDTH_SGI = 32985 # GL/glext.h:1559
+GL_COLOR_TABLE_RED_SIZE_SGI = 32986 # GL/glext.h:1560
+GL_COLOR_TABLE_GREEN_SIZE_SGI = 32987 # GL/glext.h:1561
+GL_COLOR_TABLE_BLUE_SIZE_SGI = 32988 # GL/glext.h:1562
+GL_COLOR_TABLE_ALPHA_SIZE_SGI = 32989 # GL/glext.h:1563
+GL_COLOR_TABLE_LUMINANCE_SIZE_SGI = 32990 # GL/glext.h:1564
+GL_COLOR_TABLE_INTENSITY_SIZE_SGI = 32991 # GL/glext.h:1565
+# SGIS_pixel_texture (GL/glext.h:1568)
+GL_PIXEL_TEXTURE_SGIS = 33619 # GL/glext.h:1569
+GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS = 33620 # GL/glext.h:1570
+GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS = 33621 # GL/glext.h:1571
+GL_PIXEL_GROUP_COLOR_SGIS = 33622 # GL/glext.h:1572
+# SGIX_pixel_texture (GL/glext.h:1575)
+GL_PIXEL_TEX_GEN_SGIX = 33081 # GL/glext.h:1576
+GL_PIXEL_TEX_GEN_MODE_SGIX = 33579 # GL/glext.h:1577
+# SGIS_texture4D (GL/glext.h:1580)
+GL_PACK_SKIP_VOLUMES_SGIS = 33072 # GL/glext.h:1581
+GL_PACK_IMAGE_DEPTH_SGIS = 33073 # GL/glext.h:1582
+GL_UNPACK_SKIP_VOLUMES_SGIS = 33074 # GL/glext.h:1583
+GL_UNPACK_IMAGE_DEPTH_SGIS = 33075 # GL/glext.h:1584
+GL_TEXTURE_4D_SGIS = 33076 # GL/glext.h:1585
+GL_PROXY_TEXTURE_4D_SGIS = 33077 # GL/glext.h:1586
+GL_TEXTURE_4DSIZE_SGIS = 33078 # GL/glext.h:1587
+GL_TEXTURE_WRAP_Q_SGIS = 33079 # GL/glext.h:1588
+GL_MAX_4D_TEXTURE_SIZE_SGIS = 33080 # GL/glext.h:1589
+GL_TEXTURE_4D_BINDING_SGIS = 33103 # GL/glext.h:1590
+# SGI_texture_color_table (GL/glext.h:1593)
+GL_TEXTURE_COLOR_TABLE_SGI = 32956 # GL/glext.h:1594
+GL_PROXY_TEXTURE_COLOR_TABLE_SGI = 32957 # GL/glext.h:1595
+# EXT_cmyka (GL/glext.h:1598)
+GL_CMYK_EXT = 32780 # GL/glext.h:1599
+GL_CMYKA_EXT = 32781 # GL/glext.h:1600
+GL_PACK_CMYK_HINT_EXT = 32782 # GL/glext.h:1601
+GL_UNPACK_CMYK_HINT_EXT = 32783 # GL/glext.h:1602
+# EXT_texture_object (GL/glext.h:1605)
+GL_TEXTURE_PRIORITY_EXT = 32870 # GL/glext.h:1606
+GL_TEXTURE_RESIDENT_EXT = 32871 # GL/glext.h:1607
+GL_TEXTURE_1D_BINDING_EXT = 32872 # GL/glext.h:1608
+GL_TEXTURE_2D_BINDING_EXT = 32873 # GL/glext.h:1609
+GL_TEXTURE_3D_BINDING_EXT = 32874 # GL/glext.h:1610
+# SGIS_detail_texture (GL/glext.h:1613)
+GL_DETAIL_TEXTURE_2D_SGIS = 32917 # GL/glext.h:1614
+GL_DETAIL_TEXTURE_2D_BINDING_SGIS = 32918 # GL/glext.h:1615
+GL_LINEAR_DETAIL_SGIS = 32919 # GL/glext.h:1616
+GL_LINEAR_DETAIL_ALPHA_SGIS = 32920 # GL/glext.h:1617
+GL_LINEAR_DETAIL_COLOR_SGIS = 32921 # GL/glext.h:1618
+GL_DETAIL_TEXTURE_LEVEL_SGIS = 32922 # GL/glext.h:1619
+GL_DETAIL_TEXTURE_MODE_SGIS = 32923 # GL/glext.h:1620
+GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS = 32924 # GL/glext.h:1621
+# SGIS_sharpen_texture (GL/glext.h:1624)
+GL_LINEAR_SHARPEN_SGIS = 32941 # GL/glext.h:1625
+GL_LINEAR_SHARPEN_ALPHA_SGIS = 32942 # GL/glext.h:1626
+GL_LINEAR_SHARPEN_COLOR_SGIS = 32943 # GL/glext.h:1627
+GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS = 32944 # GL/glext.h:1628
+# EXT_packed_pixels (GL/glext.h:1631)
+GL_UNSIGNED_BYTE_3_3_2_EXT = 32818 # GL/glext.h:1632
+GL_UNSIGNED_SHORT_4_4_4_4_EXT = 32819 # GL/glext.h:1633
+GL_UNSIGNED_SHORT_5_5_5_1_EXT = 32820 # GL/glext.h:1634
+GL_UNSIGNED_INT_8_8_8_8_EXT = 32821 # GL/glext.h:1635
+GL_UNSIGNED_INT_10_10_10_2_EXT = 32822 # GL/glext.h:1636
+# SGIS_texture_lod (GL/glext.h:1639)
+GL_TEXTURE_MIN_LOD_SGIS = 33082 # GL/glext.h:1640
+GL_TEXTURE_MAX_LOD_SGIS = 33083 # GL/glext.h:1641
+GL_TEXTURE_BASE_LEVEL_SGIS = 33084 # GL/glext.h:1642
+GL_TEXTURE_MAX_LEVEL_SGIS = 33085 # GL/glext.h:1643
+# SGIS_multisample (GL/glext.h:1646)
+GL_MULTISAMPLE_SGIS = 32925 # GL/glext.h:1647
+GL_SAMPLE_ALPHA_TO_MASK_SGIS = 32926 # GL/glext.h:1648
+GL_SAMPLE_ALPHA_TO_ONE_SGIS = 32927 # GL/glext.h:1649
+GL_SAMPLE_MASK_SGIS = 32928 # GL/glext.h:1650
+GL_1PASS_SGIS = 32929 # GL/glext.h:1651
+GL_2PASS_0_SGIS = 32930 # GL/glext.h:1652
+GL_2PASS_1_SGIS = 32931 # GL/glext.h:1653
+GL_4PASS_0_SGIS = 32932 # GL/glext.h:1654
+GL_4PASS_1_SGIS = 32933 # GL/glext.h:1655
+GL_4PASS_2_SGIS = 32934 # GL/glext.h:1656
+GL_4PASS_3_SGIS = 32935 # GL/glext.h:1657
+GL_SAMPLE_BUFFERS_SGIS = 32936 # GL/glext.h:1658
+GL_SAMPLES_SGIS = 32937 # GL/glext.h:1659
+GL_SAMPLE_MASK_VALUE_SGIS = 32938 # GL/glext.h:1660
+GL_SAMPLE_MASK_INVERT_SGIS = 32939 # GL/glext.h:1661
+GL_SAMPLE_PATTERN_SGIS = 32940 # GL/glext.h:1662
+# EXT_rescale_normal (GL/glext.h:1665)
+GL_RESCALE_NORMAL_EXT = 32826 # GL/glext.h:1666
+# EXT_vertex_array (GL/glext.h:1669)
+GL_VERTEX_ARRAY_EXT = 32884 # GL/glext.h:1670
+GL_NORMAL_ARRAY_EXT = 32885 # GL/glext.h:1671
+GL_COLOR_ARRAY_EXT = 32886 # GL/glext.h:1672
+GL_INDEX_ARRAY_EXT = 32887 # GL/glext.h:1673
+GL_TEXTURE_COORD_ARRAY_EXT = 32888 # GL/glext.h:1674
+GL_EDGE_FLAG_ARRAY_EXT = 32889 # GL/glext.h:1675
+GL_VERTEX_ARRAY_SIZE_EXT = 32890 # GL/glext.h:1676
+GL_VERTEX_ARRAY_TYPE_EXT = 32891 # GL/glext.h:1677
+GL_VERTEX_ARRAY_STRIDE_EXT = 32892 # GL/glext.h:1678
+GL_VERTEX_ARRAY_COUNT_EXT = 32893 # GL/glext.h:1679
+GL_NORMAL_ARRAY_TYPE_EXT = 32894 # GL/glext.h:1680
+GL_NORMAL_ARRAY_STRIDE_EXT = 32895 # GL/glext.h:1681
+GL_NORMAL_ARRAY_COUNT_EXT = 32896 # GL/glext.h:1682
+GL_COLOR_ARRAY_SIZE_EXT = 32897 # GL/glext.h:1683
+GL_COLOR_ARRAY_TYPE_EXT = 32898 # GL/glext.h:1684
+GL_COLOR_ARRAY_STRIDE_EXT = 32899 # GL/glext.h:1685
+GL_COLOR_ARRAY_COUNT_EXT = 32900 # GL/glext.h:1686
+GL_INDEX_ARRAY_TYPE_EXT = 32901 # GL/glext.h:1687
+GL_INDEX_ARRAY_STRIDE_EXT = 32902 # GL/glext.h:1688
+GL_INDEX_ARRAY_COUNT_EXT = 32903 # GL/glext.h:1689
+GL_TEXTURE_COORD_ARRAY_SIZE_EXT = 32904 # GL/glext.h:1690
+GL_TEXTURE_COORD_ARRAY_TYPE_EXT = 32905 # GL/glext.h:1691
+GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = 32906 # GL/glext.h:1692
+GL_TEXTURE_COORD_ARRAY_COUNT_EXT = 32907 # GL/glext.h:1693
+GL_EDGE_FLAG_ARRAY_STRIDE_EXT = 32908 # GL/glext.h:1694
+GL_EDGE_FLAG_ARRAY_COUNT_EXT = 32909 # GL/glext.h:1695
+GL_VERTEX_ARRAY_POINTER_EXT = 32910 # GL/glext.h:1696
+GL_NORMAL_ARRAY_POINTER_EXT = 32911 # GL/glext.h:1697
+GL_COLOR_ARRAY_POINTER_EXT = 32912 # GL/glext.h:1698
+GL_INDEX_ARRAY_POINTER_EXT = 32913 # GL/glext.h:1699
+GL_TEXTURE_COORD_ARRAY_POINTER_EXT = 32914 # GL/glext.h:1700
+GL_EDGE_FLAG_ARRAY_POINTER_EXT = 32915 # GL/glext.h:1701
+# EXT_misc_attribute (GL/glext.h:1704)
+# SGIS_generate_mipmap (GL/glext.h:1707)
+GL_GENERATE_MIPMAP_SGIS = 33169 # GL/glext.h:1708
+GL_GENERATE_MIPMAP_HINT_SGIS = 33170 # GL/glext.h:1709
+# SGIX_clipmap (GL/glext.h:1712)
+GL_LINEAR_CLIPMAP_LINEAR_SGIX = 33136 # GL/glext.h:1713
+GL_TEXTURE_CLIPMAP_CENTER_SGIX = 33137 # GL/glext.h:1714
+GL_TEXTURE_CLIPMAP_FRAME_SGIX = 33138 # GL/glext.h:1715
+GL_TEXTURE_CLIPMAP_OFFSET_SGIX = 33139 # GL/glext.h:1716
+GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX = 33140 # GL/glext.h:1717
+GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX = 33141 # GL/glext.h:1718
+GL_TEXTURE_CLIPMAP_DEPTH_SGIX = 33142 # GL/glext.h:1719
+GL_MAX_CLIPMAP_DEPTH_SGIX = 33143 # GL/glext.h:1720
+GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX = 33144 # GL/glext.h:1721
+GL_NEAREST_CLIPMAP_NEAREST_SGIX = 33869 # GL/glext.h:1722
+GL_NEAREST_CLIPMAP_LINEAR_SGIX = 33870 # GL/glext.h:1723
+GL_LINEAR_CLIPMAP_NEAREST_SGIX = 33871 # GL/glext.h:1724
+# SGIX_shadow (GL/glext.h:1727)
+GL_TEXTURE_COMPARE_SGIX = 33178 # GL/glext.h:1728
+GL_TEXTURE_COMPARE_OPERATOR_SGIX = 33179 # GL/glext.h:1729
+GL_TEXTURE_LEQUAL_R_SGIX = 33180 # GL/glext.h:1730
+GL_TEXTURE_GEQUAL_R_SGIX = 33181 # GL/glext.h:1731
+# SGIS_texture_edge_clamp (GL/glext.h:1734)
+GL_CLAMP_TO_EDGE_SGIS = 33071 # GL/glext.h:1735
+# SGIS_texture_border_clamp (GL/glext.h:1738)
+GL_CLAMP_TO_BORDER_SGIS = 33069 # GL/glext.h:1739
+# EXT_blend_minmax (GL/glext.h:1742)
+GL_FUNC_ADD_EXT = 32774 # GL/glext.h:1743
+GL_MIN_EXT = 32775 # GL/glext.h:1744
+GL_MAX_EXT = 32776 # GL/glext.h:1745
+GL_BLEND_EQUATION_EXT = 32777 # GL/glext.h:1746
+# EXT_blend_subtract (GL/glext.h:1749)
+GL_FUNC_SUBTRACT_EXT = 32778 # GL/glext.h:1750
+GL_FUNC_REVERSE_SUBTRACT_EXT = 32779 # GL/glext.h:1751
+# EXT_blend_logic_op (GL/glext.h:1754)
+# SGIX_interlace (GL/glext.h:1757)
+GL_INTERLACE_SGIX = 32916 # GL/glext.h:1758
+# SGIX_pixel_tiles (GL/glext.h:1761)
+GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX = 33086 # GL/glext.h:1762
+GL_PIXEL_TILE_CACHE_INCREMENT_SGIX = 33087 # GL/glext.h:1763
+GL_PIXEL_TILE_WIDTH_SGIX = 33088 # GL/glext.h:1764
+GL_PIXEL_TILE_HEIGHT_SGIX = 33089 # GL/glext.h:1765
+GL_PIXEL_TILE_GRID_WIDTH_SGIX = 33090 # GL/glext.h:1766
+GL_PIXEL_TILE_GRID_HEIGHT_SGIX = 33091 # GL/glext.h:1767
+GL_PIXEL_TILE_GRID_DEPTH_SGIX = 33092 # GL/glext.h:1768
+GL_PIXEL_TILE_CACHE_SIZE_SGIX = 33093 # GL/glext.h:1769
+# SGIS_texture_select (GL/glext.h:1772)
+GL_DUAL_ALPHA4_SGIS = 33040 # GL/glext.h:1773
+GL_DUAL_ALPHA8_SGIS = 33041 # GL/glext.h:1774
+GL_DUAL_ALPHA12_SGIS = 33042 # GL/glext.h:1775
+GL_DUAL_ALPHA16_SGIS = 33043 # GL/glext.h:1776
+GL_DUAL_LUMINANCE4_SGIS = 33044 # GL/glext.h:1777
+GL_DUAL_LUMINANCE8_SGIS = 33045 # GL/glext.h:1778
+GL_DUAL_LUMINANCE12_SGIS = 33046 # GL/glext.h:1779
+GL_DUAL_LUMINANCE16_SGIS = 33047 # GL/glext.h:1780
+GL_DUAL_INTENSITY4_SGIS = 33048 # GL/glext.h:1781
+GL_DUAL_INTENSITY8_SGIS = 33049 # GL/glext.h:1782
+GL_DUAL_INTENSITY12_SGIS = 33050 # GL/glext.h:1783
+GL_DUAL_INTENSITY16_SGIS = 33051 # GL/glext.h:1784
+GL_DUAL_LUMINANCE_ALPHA4_SGIS = 33052 # GL/glext.h:1785
+GL_DUAL_LUMINANCE_ALPHA8_SGIS = 33053 # GL/glext.h:1786
+GL_QUAD_ALPHA4_SGIS = 33054 # GL/glext.h:1787
+GL_QUAD_ALPHA8_SGIS = 33055 # GL/glext.h:1788
+GL_QUAD_LUMINANCE4_SGIS = 33056 # GL/glext.h:1789
+GL_QUAD_LUMINANCE8_SGIS = 33057 # GL/glext.h:1790
+GL_QUAD_INTENSITY4_SGIS = 33058 # GL/glext.h:1791
+GL_QUAD_INTENSITY8_SGIS = 33059 # GL/glext.h:1792
+GL_DUAL_TEXTURE_SELECT_SGIS = 33060 # GL/glext.h:1793
+GL_QUAD_TEXTURE_SELECT_SGIS = 33061 # GL/glext.h:1794
+# SGIX_sprite (GL/glext.h:1797)
+GL_SPRITE_SGIX = 33096 # GL/glext.h:1798
+GL_SPRITE_MODE_SGIX = 33097 # GL/glext.h:1799
+GL_SPRITE_AXIS_SGIX = 33098 # GL/glext.h:1800
+GL_SPRITE_TRANSLATION_SGIX = 33099 # GL/glext.h:1801
+GL_SPRITE_AXIAL_SGIX = 33100 # GL/glext.h:1802
+GL_SPRITE_OBJECT_ALIGNED_SGIX = 33101 # GL/glext.h:1803
+GL_SPRITE_EYE_ALIGNED_SGIX = 33102 # GL/glext.h:1804
+# SGIX_texture_multi_buffer (GL/glext.h:1807)
+GL_TEXTURE_MULTI_BUFFER_HINT_SGIX = 33070 # GL/glext.h:1808
+# EXT_point_parameters (GL/glext.h:1811)
+GL_POINT_SIZE_MIN_EXT = 33062 # GL/glext.h:1812
+GL_POINT_SIZE_MAX_EXT = 33063 # GL/glext.h:1813
+GL_POINT_FADE_THRESHOLD_SIZE_EXT = 33064 # GL/glext.h:1814
+GL_DISTANCE_ATTENUATION_EXT = 33065 # GL/glext.h:1815
+# SGIS_point_parameters (GL/glext.h:1818)
+GL_POINT_SIZE_MIN_SGIS = 33062 # GL/glext.h:1819
+GL_POINT_SIZE_MAX_SGIS = 33063 # GL/glext.h:1820
+GL_POINT_FADE_THRESHOLD_SIZE_SGIS = 33064 # GL/glext.h:1821
+GL_DISTANCE_ATTENUATION_SGIS = 33065 # GL/glext.h:1822
+# SGIX_instruments (GL/glext.h:1825)
+GL_INSTRUMENT_BUFFER_POINTER_SGIX = 33152 # GL/glext.h:1826
+GL_INSTRUMENT_MEASUREMENTS_SGIX = 33153 # GL/glext.h:1827
+# SGIX_texture_scale_bias (GL/glext.h:1830)
+GL_POST_TEXTURE_FILTER_BIAS_SGIX = 33145 # GL/glext.h:1831
+GL_POST_TEXTURE_FILTER_SCALE_SGIX = 33146 # GL/glext.h:1832
+GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX = 33147 # GL/glext.h:1833
+GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX = 33148 # GL/glext.h:1834
+# SGIX_framezoom (GL/glext.h:1837)
+GL_FRAMEZOOM_SGIX = 33163 # GL/glext.h:1838
+GL_FRAMEZOOM_FACTOR_SGIX = 33164 # GL/glext.h:1839
+GL_MAX_FRAMEZOOM_FACTOR_SGIX = 33165 # GL/glext.h:1840
+# SGIX_tag_sample_buffer (GL/glext.h:1843)
+# FfdMaskSGIX (GL/glext.h:1846)
+GL_TEXTURE_DEFORMATION_BIT_SGIX = 1 # GL/glext.h:1847
+GL_GEOMETRY_DEFORMATION_BIT_SGIX = 2 # GL/glext.h:1848
+# SGIX_polynomial_ffd (GL/glext.h:1851)
+GL_GEOMETRY_DEFORMATION_SGIX = 33172 # GL/glext.h:1852
+GL_TEXTURE_DEFORMATION_SGIX = 33173 # GL/glext.h:1853
+GL_DEFORMATIONS_MASK_SGIX = 33174 # GL/glext.h:1854
+GL_MAX_DEFORMATION_ORDER_SGIX = 33175 # GL/glext.h:1855
+# SGIX_reference_plane (GL/glext.h:1858)
+GL_REFERENCE_PLANE_SGIX = 33149 # GL/glext.h:1859
+GL_REFERENCE_PLANE_EQUATION_SGIX = 33150 # GL/glext.h:1860
+# SGIX_flush_raster (GL/glext.h:1863)
+# SGIX_depth_texture (GL/glext.h:1866)
+GL_DEPTH_COMPONENT16_SGIX = 33189 # GL/glext.h:1867
+GL_DEPTH_COMPONENT24_SGIX = 33190 # GL/glext.h:1868
+GL_DEPTH_COMPONENT32_SGIX = 33191 # GL/glext.h:1869
+# SGIS_fog_function (GL/glext.h:1872)
+GL_FOG_FUNC_SGIS = 33066 # GL/glext.h:1873
+GL_FOG_FUNC_POINTS_SGIS = 33067 # GL/glext.h:1874
+GL_MAX_FOG_FUNC_POINTS_SGIS = 33068 # GL/glext.h:1875
+# SGIX_fog_offset (GL/glext.h:1878)
+GL_FOG_OFFSET_SGIX = 33176 # GL/glext.h:1879
+GL_FOG_OFFSET_VALUE_SGIX = 33177 # GL/glext.h:1880
+# HP_image_transform (GL/glext.h:1883)
+GL_IMAGE_SCALE_X_HP = 33109 # GL/glext.h:1884
+GL_IMAGE_SCALE_Y_HP = 33110 # GL/glext.h:1885
+GL_IMAGE_TRANSLATE_X_HP = 33111 # GL/glext.h:1886
+GL_IMAGE_TRANSLATE_Y_HP = 33112 # GL/glext.h:1887
+GL_IMAGE_ROTATE_ANGLE_HP = 33113 # GL/glext.h:1888
+GL_IMAGE_ROTATE_ORIGIN_X_HP = 33114 # GL/glext.h:1889
+GL_IMAGE_ROTATE_ORIGIN_Y_HP = 33115 # GL/glext.h:1890
+GL_IMAGE_MAG_FILTER_HP = 33116 # GL/glext.h:1891
+GL_IMAGE_MIN_FILTER_HP = 33117 # GL/glext.h:1892
+GL_IMAGE_CUBIC_WEIGHT_HP = 33118 # GL/glext.h:1893
+GL_CUBIC_HP = 33119 # GL/glext.h:1894
+GL_AVERAGE_HP = 33120 # GL/glext.h:1895
+GL_IMAGE_TRANSFORM_2D_HP = 33121 # GL/glext.h:1896
+GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = 33122 # GL/glext.h:1897
+GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = 33123 # GL/glext.h:1898
+# HP_convolution_border_modes (GL/glext.h:1901)
+GL_IGNORE_BORDER_HP = 33104 # GL/glext.h:1902
+GL_CONSTANT_BORDER_HP = 33105 # GL/glext.h:1903
+GL_REPLICATE_BORDER_HP = 33107 # GL/glext.h:1904
+GL_CONVOLUTION_BORDER_COLOR_HP = 33108 # GL/glext.h:1905
+# INGR_palette_buffer (GL/glext.h:1908)
+# SGIX_texture_add_env (GL/glext.h:1911)
+GL_TEXTURE_ENV_BIAS_SGIX = 32958 # GL/glext.h:1912
+# EXT_color_subtable (GL/glext.h:1915)
+# PGI_vertex_hints (GL/glext.h:1918)
+GL_VERTEX_DATA_HINT_PGI = 107050 # GL/glext.h:1919
+GL_VERTEX_CONSISTENT_HINT_PGI = 107051 # GL/glext.h:1920
+GL_MATERIAL_SIDE_HINT_PGI = 107052 # GL/glext.h:1921
+GL_MAX_VERTEX_HINT_PGI = 107053 # GL/glext.h:1922
+GL_COLOR3_BIT_PGI = 65536 # GL/glext.h:1923
+GL_COLOR4_BIT_PGI = 131072 # GL/glext.h:1924
+GL_EDGEFLAG_BIT_PGI = 262144 # GL/glext.h:1925
+GL_INDEX_BIT_PGI = 524288 # GL/glext.h:1926
+GL_MAT_AMBIENT_BIT_PGI = 1048576 # GL/glext.h:1927
+GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI = 2097152 # GL/glext.h:1928
+GL_MAT_DIFFUSE_BIT_PGI = 4194304 # GL/glext.h:1929
+GL_MAT_EMISSION_BIT_PGI = 8388608 # GL/glext.h:1930
+GL_MAT_COLOR_INDEXES_BIT_PGI = 16777216 # GL/glext.h:1931
+GL_MAT_SHININESS_BIT_PGI = 33554432 # GL/glext.h:1932
+GL_MAT_SPECULAR_BIT_PGI = 67108864 # GL/glext.h:1933
+GL_NORMAL_BIT_PGI = 134217728 # GL/glext.h:1934
+GL_TEXCOORD1_BIT_PGI = 268435456 # GL/glext.h:1935
+GL_TEXCOORD2_BIT_PGI = 536870912 # GL/glext.h:1936
+GL_TEXCOORD3_BIT_PGI = 1073741824 # GL/glext.h:1937
+GL_TEXCOORD4_BIT_PGI = 2147483648 # GL/glext.h:1938
+GL_VERTEX23_BIT_PGI = 4 # GL/glext.h:1939
+GL_VERTEX4_BIT_PGI = 8 # GL/glext.h:1940
+# PGI_misc_hints (GL/glext.h:1943)
+GL_PREFER_DOUBLEBUFFER_HINT_PGI = 107000 # GL/glext.h:1944
+GL_CONSERVE_MEMORY_HINT_PGI = 107005 # GL/glext.h:1945
+GL_RECLAIM_MEMORY_HINT_PGI = 107006 # GL/glext.h:1946
+GL_NATIVE_GRAPHICS_HANDLE_PGI = 107010 # GL/glext.h:1947
+GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI = 107011 # GL/glext.h:1948
+GL_NATIVE_GRAPHICS_END_HINT_PGI = 107012 # GL/glext.h:1949
+GL_ALWAYS_FAST_HINT_PGI = 107020 # GL/glext.h:1950
+GL_ALWAYS_SOFT_HINT_PGI = 107021 # GL/glext.h:1951
+GL_ALLOW_DRAW_OBJ_HINT_PGI = 107022 # GL/glext.h:1952
+GL_ALLOW_DRAW_WIN_HINT_PGI = 107023 # GL/glext.h:1953
+GL_ALLOW_DRAW_FRG_HINT_PGI = 107024 # GL/glext.h:1954
+GL_ALLOW_DRAW_MEM_HINT_PGI = 107025 # GL/glext.h:1955
+GL_STRICT_DEPTHFUNC_HINT_PGI = 107030 # GL/glext.h:1956
+GL_STRICT_LIGHTING_HINT_PGI = 107031 # GL/glext.h:1957
+GL_STRICT_SCISSOR_HINT_PGI = 107032 # GL/glext.h:1958
+GL_FULL_STIPPLE_HINT_PGI = 107033 # GL/glext.h:1959
+GL_CLIP_NEAR_HINT_PGI = 107040 # GL/glext.h:1960
+GL_CLIP_FAR_HINT_PGI = 107041 # GL/glext.h:1961
+GL_WIDE_LINE_HINT_PGI = 107042 # GL/glext.h:1962
+GL_BACK_NORMALS_HINT_PGI = 107043 # GL/glext.h:1963
+# EXT_paletted_texture (GL/glext.h:1966)
+GL_COLOR_INDEX1_EXT = 32994 # GL/glext.h:1967
+GL_COLOR_INDEX2_EXT = 32995 # GL/glext.h:1968
+GL_COLOR_INDEX4_EXT = 32996 # GL/glext.h:1969
+GL_COLOR_INDEX8_EXT = 32997 # GL/glext.h:1970
+GL_COLOR_INDEX12_EXT = 32998 # GL/glext.h:1971
+GL_COLOR_INDEX16_EXT = 32999 # GL/glext.h:1972
+GL_TEXTURE_INDEX_SIZE_EXT = 33005 # GL/glext.h:1973
+# EXT_clip_volume_hint (GL/glext.h:1976)
+GL_CLIP_VOLUME_CLIPPING_HINT_EXT = 33008 # GL/glext.h:1977
+# SGIX_list_priority (GL/glext.h:1980)
+GL_LIST_PRIORITY_SGIX = 33154 # GL/glext.h:1981
+# SGIX_ir_instrument1 (GL/glext.h:1984)
+GL_IR_INSTRUMENT1_SGIX = 33151 # GL/glext.h:1985
+# SGIX_calligraphic_fragment (GL/glext.h:1988)
+GL_CALLIGRAPHIC_FRAGMENT_SGIX = 33155 # GL/glext.h:1989
+# SGIX_texture_lod_bias (GL/glext.h:1992)
+GL_TEXTURE_LOD_BIAS_S_SGIX = 33166 # GL/glext.h:1993
+GL_TEXTURE_LOD_BIAS_T_SGIX = 33167 # GL/glext.h:1994
+GL_TEXTURE_LOD_BIAS_R_SGIX = 33168 # GL/glext.h:1995
+# SGIX_shadow_ambient (GL/glext.h:1998)
+GL_SHADOW_AMBIENT_SGIX = 32959 # GL/glext.h:1999
+# EXT_index_texture (GL/glext.h:2002)
+# EXT_index_material (GL/glext.h:2005)
+GL_INDEX_MATERIAL_EXT = 33208 # GL/glext.h:2006
+GL_INDEX_MATERIAL_PARAMETER_EXT = 33209 # GL/glext.h:2007
+GL_INDEX_MATERIAL_FACE_EXT = 33210 # GL/glext.h:2008
+# EXT_index_func (GL/glext.h:2011)
+GL_INDEX_TEST_EXT = 33205 # GL/glext.h:2012
+GL_INDEX_TEST_FUNC_EXT = 33206 # GL/glext.h:2013
+GL_INDEX_TEST_REF_EXT = 33207 # GL/glext.h:2014
+# EXT_index_array_formats (GL/glext.h:2017)
+GL_IUI_V2F_EXT = 33197 # GL/glext.h:2018
+GL_IUI_V3F_EXT = 33198 # GL/glext.h:2019
+GL_IUI_N3F_V2F_EXT = 33199 # GL/glext.h:2020
+GL_IUI_N3F_V3F_EXT = 33200 # GL/glext.h:2021
+GL_T2F_IUI_V2F_EXT = 33201 # GL/glext.h:2022
+GL_T2F_IUI_V3F_EXT = 33202 # GL/glext.h:2023
+GL_T2F_IUI_N3F_V2F_EXT = 33203 # GL/glext.h:2024
+GL_T2F_IUI_N3F_V3F_EXT = 33204 # GL/glext.h:2025
+# EXT_compiled_vertex_array (GL/glext.h:2028)
+GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = 33192 # GL/glext.h:2029
+GL_ARRAY_ELEMENT_LOCK_COUNT_EXT = 33193 # GL/glext.h:2030
+# EXT_cull_vertex (GL/glext.h:2033)
+GL_CULL_VERTEX_EXT = 33194 # GL/glext.h:2034
+GL_CULL_VERTEX_EYE_POSITION_EXT = 33195 # GL/glext.h:2035
+GL_CULL_VERTEX_OBJECT_POSITION_EXT = 33196 # GL/glext.h:2036
+# SGIX_ycrcb (GL/glext.h:2039)
+GL_YCRCB_422_SGIX = 33211 # GL/glext.h:2040
+GL_YCRCB_444_SGIX = 33212 # GL/glext.h:2041
+# SGIX_fragment_lighting (GL/glext.h:2044)
+GL_FRAGMENT_LIGHTING_SGIX = 33792 # GL/glext.h:2045
+GL_FRAGMENT_COLOR_MATERIAL_SGIX = 33793 # GL/glext.h:2046
+GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX = 33794 # GL/glext.h:2047
+GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX = 33795 # GL/glext.h:2048
+GL_MAX_FRAGMENT_LIGHTS_SGIX = 33796 # GL/glext.h:2049
+GL_MAX_ACTIVE_LIGHTS_SGIX = 33797 # GL/glext.h:2050
+GL_CURRENT_RASTER_NORMAL_SGIX = 33798 # GL/glext.h:2051
+GL_LIGHT_ENV_MODE_SGIX = 33799 # GL/glext.h:2052
+GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX = 33800 # GL/glext.h:2053
+GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX = 33801 # GL/glext.h:2054
+GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX = 33802 # GL/glext.h:2055
+GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX = 33803 # GL/glext.h:2056
+GL_FRAGMENT_LIGHT0_SGIX = 33804 # GL/glext.h:2057
+GL_FRAGMENT_LIGHT1_SGIX = 33805 # GL/glext.h:2058
+GL_FRAGMENT_LIGHT2_SGIX = 33806 # GL/glext.h:2059
+GL_FRAGMENT_LIGHT3_SGIX = 33807 # GL/glext.h:2060
+GL_FRAGMENT_LIGHT4_SGIX = 33808 # GL/glext.h:2061
+GL_FRAGMENT_LIGHT5_SGIX = 33809 # GL/glext.h:2062
+GL_FRAGMENT_LIGHT6_SGIX = 33810 # GL/glext.h:2063
+GL_FRAGMENT_LIGHT7_SGIX = 33811 # GL/glext.h:2064
+# IBM_rasterpos_clip (GL/glext.h:2067)
+GL_RASTER_POSITION_UNCLIPPED_IBM = 103010 # GL/glext.h:2068
+# HP_texture_lighting (GL/glext.h:2071)
+GL_TEXTURE_LIGHTING_MODE_HP = 33127 # GL/glext.h:2072
+GL_TEXTURE_POST_SPECULAR_HP = 33128 # GL/glext.h:2073
+GL_TEXTURE_PRE_SPECULAR_HP = 33129 # GL/glext.h:2074
+# EXT_draw_range_elements (GL/glext.h:2077)
+GL_MAX_ELEMENTS_VERTICES_EXT = 33000 # GL/glext.h:2078
+GL_MAX_ELEMENTS_INDICES_EXT = 33001 # GL/glext.h:2079
+# WIN_phong_shading (GL/glext.h:2082)
+GL_PHONG_WIN = 33002 # GL/glext.h:2083
+GL_PHONG_HINT_WIN = 33003 # GL/glext.h:2084
+# WIN_specular_fog (GL/glext.h:2087)
+GL_FOG_SPECULAR_TEXTURE_WIN = 33004 # GL/glext.h:2088
+# EXT_light_texture (GL/glext.h:2091)
+GL_FRAGMENT_MATERIAL_EXT = 33609 # GL/glext.h:2092
+GL_FRAGMENT_NORMAL_EXT = 33610 # GL/glext.h:2093
+GL_FRAGMENT_COLOR_EXT = 33612 # GL/glext.h:2094
+GL_ATTENUATION_EXT = 33613 # GL/glext.h:2095
+GL_SHADOW_ATTENUATION_EXT = 33614 # GL/glext.h:2096
+GL_TEXTURE_APPLICATION_MODE_EXT = 33615 # GL/glext.h:2097
+GL_TEXTURE_LIGHT_EXT = 33616 # GL/glext.h:2098
+GL_TEXTURE_MATERIAL_FACE_EXT = 33617 # GL/glext.h:2099
+GL_TEXTURE_MATERIAL_PARAMETER_EXT = 33618 # GL/glext.h:2100
+# SGIX_blend_alpha_minmax (GL/glext.h:2104)
+GL_ALPHA_MIN_SGIX = 33568 # GL/glext.h:2105
+GL_ALPHA_MAX_SGIX = 33569 # GL/glext.h:2106
+# SGIX_impact_pixel_texture (GL/glext.h:2109)
+GL_PIXEL_TEX_GEN_Q_CEILING_SGIX = 33156 # GL/glext.h:2110
+GL_PIXEL_TEX_GEN_Q_ROUND_SGIX = 33157 # GL/glext.h:2111
+GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX = 33158 # GL/glext.h:2112
+GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX = 33159 # GL/glext.h:2113
+GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX = 33160 # GL/glext.h:2114
+GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX = 33161 # GL/glext.h:2115
+GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX = 33162 # GL/glext.h:2116
+# EXT_bgra (GL/glext.h:2119)
+GL_BGR_EXT = 32992 # GL/glext.h:2120
+GL_BGRA_EXT = 32993 # GL/glext.h:2121
+# SGIX_async (GL/glext.h:2124)
+GL_ASYNC_MARKER_SGIX = 33577 # GL/glext.h:2125
+# SGIX_async_pixel (GL/glext.h:2128)
+GL_ASYNC_TEX_IMAGE_SGIX = 33628 # GL/glext.h:2129
+GL_ASYNC_DRAW_PIXELS_SGIX = 33629 # GL/glext.h:2130
+GL_ASYNC_READ_PIXELS_SGIX = 33630 # GL/glext.h:2131
+GL_MAX_ASYNC_TEX_IMAGE_SGIX = 33631 # GL/glext.h:2132
+GL_MAX_ASYNC_DRAW_PIXELS_SGIX = 33632 # GL/glext.h:2133
+GL_MAX_ASYNC_READ_PIXELS_SGIX = 33633 # GL/glext.h:2134
+# SGIX_async_histogram (GL/glext.h:2137)
+GL_ASYNC_HISTOGRAM_SGIX = 33580 # GL/glext.h:2138
+GL_MAX_ASYNC_HISTOGRAM_SGIX = 33581 # GL/glext.h:2139
+# INTEL_texture_scissor (GL/glext.h:2142)
+# INTEL_parallel_arrays (GL/glext.h:2145)
+GL_PARALLEL_ARRAYS_INTEL = 33780 # GL/glext.h:2146
+GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL = 33781 # GL/glext.h:2147
+GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL = 33782 # GL/glext.h:2148
+GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL = 33783 # GL/glext.h:2149
+GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL = 33784 # GL/glext.h:2150
+# HP_occlusion_test (GL/glext.h:2153)
+GL_OCCLUSION_TEST_HP = 33125 # GL/glext.h:2154
+GL_OCCLUSION_TEST_RESULT_HP = 33126 # GL/glext.h:2155
+# EXT_pixel_transform (GL/glext.h:2158)
+GL_PIXEL_TRANSFORM_2D_EXT = 33584 # GL/glext.h:2159
+GL_PIXEL_MAG_FILTER_EXT = 33585 # GL/glext.h:2160
+GL_PIXEL_MIN_FILTER_EXT = 33586 # GL/glext.h:2161
+GL_PIXEL_CUBIC_WEIGHT_EXT = 33587 # GL/glext.h:2162
+GL_CUBIC_EXT = 33588 # GL/glext.h:2163
+GL_AVERAGE_EXT = 33589 # GL/glext.h:2164
+GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = 33590 # GL/glext.h:2165
+GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = 33591 # GL/glext.h:2166
+GL_PIXEL_TRANSFORM_2D_MATRIX_EXT = 33592 # GL/glext.h:2167
+# EXT_pixel_transform_color_table (GL/glext.h:2170)
+# EXT_shared_texture_palette (GL/glext.h:2173)
+GL_SHARED_TEXTURE_PALETTE_EXT = 33275 # GL/glext.h:2174
+# EXT_separate_specular_color (GL/glext.h:2177)
+GL_LIGHT_MODEL_COLOR_CONTROL_EXT = 33272 # GL/glext.h:2178
+GL_SINGLE_COLOR_EXT = 33273 # GL/glext.h:2179
+GL_SEPARATE_SPECULAR_COLOR_EXT = 33274 # GL/glext.h:2180
+# EXT_secondary_color (GL/glext.h:2183)
+GL_COLOR_SUM_EXT = 33880 # GL/glext.h:2184
+GL_CURRENT_SECONDARY_COLOR_EXT = 33881 # GL/glext.h:2185
+GL_SECONDARY_COLOR_ARRAY_SIZE_EXT = 33882 # GL/glext.h:2186
+GL_SECONDARY_COLOR_ARRAY_TYPE_EXT = 33883 # GL/glext.h:2187
+GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT = 33884 # GL/glext.h:2188
+GL_SECONDARY_COLOR_ARRAY_POINTER_EXT = 33885 # GL/glext.h:2189
+GL_SECONDARY_COLOR_ARRAY_EXT = 33886 # GL/glext.h:2190
+# EXT_texture_perturb_normal (GL/glext.h:2193)
+GL_PERTURB_EXT = 34222 # GL/glext.h:2194
+GL_TEXTURE_NORMAL_EXT = 34223 # GL/glext.h:2195
+# EXT_multi_draw_arrays (GL/glext.h:2198)
+# EXT_fog_coord (GL/glext.h:2201)
+GL_FOG_COORDINATE_SOURCE_EXT = 33872 # GL/glext.h:2202
+GL_FOG_COORDINATE_EXT = 33873 # GL/glext.h:2203
+GL_FRAGMENT_DEPTH_EXT = 33874 # GL/glext.h:2204
+GL_CURRENT_FOG_COORDINATE_EXT = 33875 # GL/glext.h:2205
+GL_FOG_COORDINATE_ARRAY_TYPE_EXT = 33876 # GL/glext.h:2206
+GL_FOG_COORDINATE_ARRAY_STRIDE_EXT = 33877 # GL/glext.h:2207
+GL_FOG_COORDINATE_ARRAY_POINTER_EXT = 33878 # GL/glext.h:2208
+GL_FOG_COORDINATE_ARRAY_EXT = 33879 # GL/glext.h:2209
+# REND_screen_coordinates (GL/glext.h:2212)
+GL_SCREEN_COORDINATES_REND = 33936 # GL/glext.h:2213
+GL_INVERTED_SCREEN_W_REND = 33937 # GL/glext.h:2214
+# EXT_coordinate_frame (GL/glext.h:2217)
+GL_TANGENT_ARRAY_EXT = 33849 # GL/glext.h:2218
+GL_BINORMAL_ARRAY_EXT = 33850 # GL/glext.h:2219
+GL_CURRENT_TANGENT_EXT = 33851 # GL/glext.h:2220
+GL_CURRENT_BINORMAL_EXT = 33852 # GL/glext.h:2221
+GL_TANGENT_ARRAY_TYPE_EXT = 33854 # GL/glext.h:2222
+GL_TANGENT_ARRAY_STRIDE_EXT = 33855 # GL/glext.h:2223
+GL_BINORMAL_ARRAY_TYPE_EXT = 33856 # GL/glext.h:2224
+GL_BINORMAL_ARRAY_STRIDE_EXT = 33857 # GL/glext.h:2225
+GL_TANGENT_ARRAY_POINTER_EXT = 33858 # GL/glext.h:2226
+GL_BINORMAL_ARRAY_POINTER_EXT = 33859 # GL/glext.h:2227
+GL_MAP1_TANGENT_EXT = 33860 # GL/glext.h:2228
+GL_MAP2_TANGENT_EXT = 33861 # GL/glext.h:2229
+GL_MAP1_BINORMAL_EXT = 33862 # GL/glext.h:2230
+GL_MAP2_BINORMAL_EXT = 33863 # GL/glext.h:2231
+# EXT_texture_env_combine (GL/glext.h:2234)
+GL_COMBINE_EXT = 34160 # GL/glext.h:2235
+GL_COMBINE_RGB_EXT = 34161 # GL/glext.h:2236
+GL_COMBINE_ALPHA_EXT = 34162 # GL/glext.h:2237
+GL_RGB_SCALE_EXT = 34163 # GL/glext.h:2238
+GL_ADD_SIGNED_EXT = 34164 # GL/glext.h:2239
+GL_INTERPOLATE_EXT = 34165 # GL/glext.h:2240
+GL_CONSTANT_EXT = 34166 # GL/glext.h:2241
+GL_PRIMARY_COLOR_EXT = 34167 # GL/glext.h:2242
+GL_PREVIOUS_EXT = 34168 # GL/glext.h:2243
+GL_SOURCE0_RGB_EXT = 34176 # GL/glext.h:2244
+GL_SOURCE1_RGB_EXT = 34177 # GL/glext.h:2245
+GL_SOURCE2_RGB_EXT = 34178 # GL/glext.h:2246
+GL_SOURCE0_ALPHA_EXT = 34184 # GL/glext.h:2247
+GL_SOURCE1_ALPHA_EXT = 34185 # GL/glext.h:2248
+GL_SOURCE2_ALPHA_EXT = 34186 # GL/glext.h:2249
+GL_OPERAND0_RGB_EXT = 34192 # GL/glext.h:2250
+GL_OPERAND1_RGB_EXT = 34193 # GL/glext.h:2251
+GL_OPERAND2_RGB_EXT = 34194 # GL/glext.h:2252
+GL_OPERAND0_ALPHA_EXT = 34200 # GL/glext.h:2253
+GL_OPERAND1_ALPHA_EXT = 34201 # GL/glext.h:2254
+GL_OPERAND2_ALPHA_EXT = 34202 # GL/glext.h:2255
+# APPLE_specular_vector (GL/glext.h:2258)
+GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE = 34224 # GL/glext.h:2259
+# APPLE_transform_hint (GL/glext.h:2262)
+GL_TRANSFORM_HINT_APPLE = 34225 # GL/glext.h:2263
+# SGIX_fog_scale (GL/glext.h:2266)
+GL_FOG_SCALE_SGIX = 33276 # GL/glext.h:2267
+GL_FOG_SCALE_VALUE_SGIX = 33277 # GL/glext.h:2268
+# SUNX_constant_data (GL/glext.h:2271)
+GL_UNPACK_CONSTANT_DATA_SUNX = 33237 # GL/glext.h:2272
+GL_TEXTURE_CONSTANT_DATA_SUNX = 33238 # GL/glext.h:2273
+# SUN_global_alpha (GL/glext.h:2276)
+GL_GLOBAL_ALPHA_SUN = 33241 # GL/glext.h:2277
+GL_GLOBAL_ALPHA_FACTOR_SUN = 33242 # GL/glext.h:2278
+# SUN_triangle_list (GL/glext.h:2281)
+GL_RESTART_SUN = 1 # GL/glext.h:2282
+GL_REPLACE_MIDDLE_SUN = 2 # GL/glext.h:2283
+GL_REPLACE_OLDEST_SUN = 3 # GL/glext.h:2284
+GL_TRIANGLE_LIST_SUN = 33239 # GL/glext.h:2285
+GL_REPLACEMENT_CODE_SUN = 33240 # GL/glext.h:2286
+GL_REPLACEMENT_CODE_ARRAY_SUN = 34240 # GL/glext.h:2287
+GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN = 34241 # GL/glext.h:2288
+GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN = 34242 # GL/glext.h:2289
+GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN = 34243 # GL/glext.h:2290
+GL_R1UI_V3F_SUN = 34244 # GL/glext.h:2291
+GL_R1UI_C4UB_V3F_SUN = 34245 # GL/glext.h:2292
+GL_R1UI_C3F_V3F_SUN = 34246 # GL/glext.h:2293
+GL_R1UI_N3F_V3F_SUN = 34247 # GL/glext.h:2294
+GL_R1UI_C4F_N3F_V3F_SUN = 34248 # GL/glext.h:2295
+GL_R1UI_T2F_V3F_SUN = 34249 # GL/glext.h:2296
+GL_R1UI_T2F_N3F_V3F_SUN = 34250 # GL/glext.h:2297
+GL_R1UI_T2F_C4F_N3F_V3F_SUN = 34251 # GL/glext.h:2298
+# SUN_vertex (GL/glext.h:2301)
+# EXT_blend_func_separate (GL/glext.h:2304)
+GL_BLEND_DST_RGB_EXT = 32968 # GL/glext.h:2305
+GL_BLEND_SRC_RGB_EXT = 32969 # GL/glext.h:2306
+GL_BLEND_DST_ALPHA_EXT = 32970 # GL/glext.h:2307
+GL_BLEND_SRC_ALPHA_EXT = 32971 # GL/glext.h:2308
+# INGR_color_clamp (GL/glext.h:2311)
+GL_RED_MIN_CLAMP_INGR = 34144 # GL/glext.h:2312
+GL_GREEN_MIN_CLAMP_INGR = 34145 # GL/glext.h:2313
+GL_BLUE_MIN_CLAMP_INGR = 34146 # GL/glext.h:2314
+GL_ALPHA_MIN_CLAMP_INGR = 34147 # GL/glext.h:2315
+GL_RED_MAX_CLAMP_INGR = 34148 # GL/glext.h:2316
+GL_GREEN_MAX_CLAMP_INGR = 34149 # GL/glext.h:2317
+GL_BLUE_MAX_CLAMP_INGR = 34150 # GL/glext.h:2318
+GL_ALPHA_MAX_CLAMP_INGR = 34151 # GL/glext.h:2319
+# INGR_interlace_read (GL/glext.h:2322)
+GL_INTERLACE_READ_INGR = 34152 # GL/glext.h:2323
+# EXT_stencil_wrap (GL/glext.h:2326)
+GL_INCR_WRAP_EXT = 34055 # GL/glext.h:2327
+GL_DECR_WRAP_EXT = 34056 # GL/glext.h:2328
+# EXT_422_pixels (GL/glext.h:2331)
+GL_422_EXT = 32972 # GL/glext.h:2332
+GL_422_REV_EXT = 32973 # GL/glext.h:2333
+GL_422_AVERAGE_EXT = 32974 # GL/glext.h:2334
+GL_422_REV_AVERAGE_EXT = 32975 # GL/glext.h:2335
+# NV_texgen_reflection (GL/glext.h:2338)
+GL_NORMAL_MAP_NV = 34065 # GL/glext.h:2339
+GL_REFLECTION_MAP_NV = 34066 # GL/glext.h:2340
+# EXT_texture_cube_map (GL/glext.h:2343)
+GL_NORMAL_MAP_EXT = 34065 # GL/glext.h:2344
+GL_REFLECTION_MAP_EXT = 34066 # GL/glext.h:2345
+GL_TEXTURE_CUBE_MAP_EXT = 34067 # GL/glext.h:2346
+GL_TEXTURE_BINDING_CUBE_MAP_EXT = 34068 # GL/glext.h:2347
+GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT = 34069 # GL/glext.h:2348
+GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT = 34070 # GL/glext.h:2349
+GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT = 34071 # GL/glext.h:2350
+GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT = 34072 # GL/glext.h:2351
+GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT = 34073 # GL/glext.h:2352
+GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT = 34074 # GL/glext.h:2353
+GL_PROXY_TEXTURE_CUBE_MAP_EXT = 34075 # GL/glext.h:2354
+GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT = 34076 # GL/glext.h:2355
+# SUN_convolution_border_modes (GL/glext.h:2358)
+GL_WRAP_BORDER_SUN = 33236 # GL/glext.h:2359
+# EXT_texture_env_add (GL/glext.h:2362)
+# EXT_texture_lod_bias (GL/glext.h:2365)
+GL_MAX_TEXTURE_LOD_BIAS_EXT = 34045 # GL/glext.h:2366
+GL_TEXTURE_FILTER_CONTROL_EXT = 34048 # GL/glext.h:2367
+GL_TEXTURE_LOD_BIAS_EXT = 34049 # GL/glext.h:2368
+# EXT_texture_filter_anisotropic (GL/glext.h:2371)
+GL_TEXTURE_MAX_ANISOTROPY_EXT = 34046 # GL/glext.h:2372
+GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = 34047 # GL/glext.h:2373
+# EXT_vertex_weighting (GL/glext.h:2376)
+GL_MODELVIEW0_STACK_DEPTH_EXT = 2979 # GL/glext.h:2377
+GL_MODELVIEW1_STACK_DEPTH_EXT = 34050 # GL/glext.h:2378
+GL_MODELVIEW0_MATRIX_EXT = 2982 # GL/glext.h:2379
+GL_MODELVIEW1_MATRIX_EXT = 34054 # GL/glext.h:2380
+GL_VERTEX_WEIGHTING_EXT = 34057 # GL/glext.h:2381
+GL_MODELVIEW0_EXT = 5888 # GL/glext.h:2382
+GL_MODELVIEW1_EXT = 34058 # GL/glext.h:2383
+GL_CURRENT_VERTEX_WEIGHT_EXT = 34059 # GL/glext.h:2384
+GL_VERTEX_WEIGHT_ARRAY_EXT = 34060 # GL/glext.h:2385
+GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT = 34061 # GL/glext.h:2386
+GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT = 34062 # GL/glext.h:2387
+GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT = 34063 # GL/glext.h:2388
+GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT = 34064 # GL/glext.h:2389
+# NV_light_max_exponent (GL/glext.h:2392)
+GL_MAX_SHININESS_NV = 34052 # GL/glext.h:2393
+GL_MAX_SPOT_EXPONENT_NV = 34053 # GL/glext.h:2394
+# NV_vertex_array_range (GL/glext.h:2397)
+GL_VERTEX_ARRAY_RANGE_NV = 34077 # GL/glext.h:2398
+GL_VERTEX_ARRAY_RANGE_LENGTH_NV = 34078 # GL/glext.h:2399
+GL_VERTEX_ARRAY_RANGE_VALID_NV = 34079 # GL/glext.h:2400
+GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV = 34080 # GL/glext.h:2401
+GL_VERTEX_ARRAY_RANGE_POINTER_NV = 34081 # GL/glext.h:2402
+# NV_register_combiners (GL/glext.h:2405)
+GL_REGISTER_COMBINERS_NV = 34082 # GL/glext.h:2406
+GL_VARIABLE_A_NV = 34083 # GL/glext.h:2407
+GL_VARIABLE_B_NV = 34084 # GL/glext.h:2408
+GL_VARIABLE_C_NV = 34085 # GL/glext.h:2409
+GL_VARIABLE_D_NV = 34086 # GL/glext.h:2410
+GL_VARIABLE_E_NV = 34087 # GL/glext.h:2411
+GL_VARIABLE_F_NV = 34088 # GL/glext.h:2412
+GL_VARIABLE_G_NV = 34089 # GL/glext.h:2413
+GL_CONSTANT_COLOR0_NV = 34090 # GL/glext.h:2414
+GL_CONSTANT_COLOR1_NV = 34091 # GL/glext.h:2415
+GL_PRIMARY_COLOR_NV = 34092 # GL/glext.h:2416
+GL_SECONDARY_COLOR_NV = 34093 # GL/glext.h:2417
+GL_SPARE0_NV = 34094 # GL/glext.h:2418
+GL_SPARE1_NV = 34095 # GL/glext.h:2419
+GL_DISCARD_NV = 34096 # GL/glext.h:2420
+GL_E_TIMES_F_NV = 34097 # GL/glext.h:2421
+GL_SPARE0_PLUS_SECONDARY_COLOR_NV = 34098 # GL/glext.h:2422
+GL_UNSIGNED_IDENTITY_NV = 34102 # GL/glext.h:2423
+GL_UNSIGNED_INVERT_NV = 34103 # GL/glext.h:2424
+GL_EXPAND_NORMAL_NV = 34104 # GL/glext.h:2425
+GL_EXPAND_NEGATE_NV = 34105 # GL/glext.h:2426
+GL_HALF_BIAS_NORMAL_NV = 34106 # GL/glext.h:2427
+GL_HALF_BIAS_NEGATE_NV = 34107 # GL/glext.h:2428
+GL_SIGNED_IDENTITY_NV = 34108 # GL/glext.h:2429
+GL_SIGNED_NEGATE_NV = 34109 # GL/glext.h:2430
+GL_SCALE_BY_TWO_NV = 34110 # GL/glext.h:2431
+GL_SCALE_BY_FOUR_NV = 34111 # GL/glext.h:2432
+GL_SCALE_BY_ONE_HALF_NV = 34112 # GL/glext.h:2433
+GL_BIAS_BY_NEGATIVE_ONE_HALF_NV = 34113 # GL/glext.h:2434
+GL_COMBINER_INPUT_NV = 34114 # GL/glext.h:2435
+GL_COMBINER_MAPPING_NV = 34115 # GL/glext.h:2436
+GL_COMBINER_COMPONENT_USAGE_NV = 34116 # GL/glext.h:2437
+GL_COMBINER_AB_DOT_PRODUCT_NV = 34117 # GL/glext.h:2438
+GL_COMBINER_CD_DOT_PRODUCT_NV = 34118 # GL/glext.h:2439
+GL_COMBINER_MUX_SUM_NV = 34119 # GL/glext.h:2440
+GL_COMBINER_SCALE_NV = 34120 # GL/glext.h:2441
+GL_COMBINER_BIAS_NV = 34121 # GL/glext.h:2442
+GL_COMBINER_AB_OUTPUT_NV = 34122 # GL/glext.h:2443
+GL_COMBINER_CD_OUTPUT_NV = 34123 # GL/glext.h:2444
+GL_COMBINER_SUM_OUTPUT_NV = 34124 # GL/glext.h:2445
+GL_MAX_GENERAL_COMBINERS_NV = 34125 # GL/glext.h:2446
+GL_NUM_GENERAL_COMBINERS_NV = 34126 # GL/glext.h:2447
+GL_COLOR_SUM_CLAMP_NV = 34127 # GL/glext.h:2448
+GL_COMBINER0_NV = 34128 # GL/glext.h:2449
+GL_COMBINER1_NV = 34129 # GL/glext.h:2450
+GL_COMBINER2_NV = 34130 # GL/glext.h:2451
+GL_COMBINER3_NV = 34131 # GL/glext.h:2452
+GL_COMBINER4_NV = 34132 # GL/glext.h:2453
+GL_COMBINER5_NV = 34133 # GL/glext.h:2454
+GL_COMBINER6_NV = 34134 # GL/glext.h:2455
+GL_COMBINER7_NV = 34135 # GL/glext.h:2456
+# NV_fog_distance (GL/glext.h:2464)
+GL_FOG_DISTANCE_MODE_NV = 34138 # GL/glext.h:2465
+GL_EYE_RADIAL_NV = 34139 # GL/glext.h:2466
+GL_EYE_PLANE_ABSOLUTE_NV = 34140 # GL/glext.h:2467
+# NV_texgen_emboss (GL/glext.h:2471)
+GL_EMBOSS_LIGHT_NV = 34141 # GL/glext.h:2472
+GL_EMBOSS_CONSTANT_NV = 34142 # GL/glext.h:2473
+GL_EMBOSS_MAP_NV = 34143 # GL/glext.h:2474
+# NV_blend_square (GL/glext.h:2477)
+# NV_texture_env_combine4 (GL/glext.h:2480)
+GL_COMBINE4_NV = 34051 # GL/glext.h:2481
+GL_SOURCE3_RGB_NV = 34179 # GL/glext.h:2482
+GL_SOURCE3_ALPHA_NV = 34187 # GL/glext.h:2483
+GL_OPERAND3_RGB_NV = 34195 # GL/glext.h:2484
+GL_OPERAND3_ALPHA_NV = 34203 # GL/glext.h:2485
+# MESA_resize_buffers (GL/glext.h:2488)
+# MESA_window_pos (GL/glext.h:2491)
+# EXT_texture_compression_s3tc (GL/glext.h:2494)
+GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 33776 # GL/glext.h:2495
+GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777 # GL/glext.h:2496
+GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778 # GL/glext.h:2497
+GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779 # GL/glext.h:2498
+# IBM_cull_vertex (GL/glext.h:2501)
+GL_CULL_VERTEX_IBM = 103050 # GL/glext.h:2502
+# IBM_multimode_draw_arrays (GL/glext.h:2505)
+# IBM_vertex_array_lists (GL/glext.h:2508)
+GL_VERTEX_ARRAY_LIST_IBM = 103070 # GL/glext.h:2509
+GL_NORMAL_ARRAY_LIST_IBM = 103071 # GL/glext.h:2510
+GL_COLOR_ARRAY_LIST_IBM = 103072 # GL/glext.h:2511
+GL_INDEX_ARRAY_LIST_IBM = 103073 # GL/glext.h:2512
+GL_TEXTURE_COORD_ARRAY_LIST_IBM = 103074 # GL/glext.h:2513
+GL_EDGE_FLAG_ARRAY_LIST_IBM = 103075 # GL/glext.h:2514
+GL_FOG_COORDINATE_ARRAY_LIST_IBM = 103076 # GL/glext.h:2515
+GL_SECONDARY_COLOR_ARRAY_LIST_IBM = 103077 # GL/glext.h:2516
+GL_VERTEX_ARRAY_LIST_STRIDE_IBM = 103080 # GL/glext.h:2517
+GL_NORMAL_ARRAY_LIST_STRIDE_IBM = 103081 # GL/glext.h:2518
+GL_COLOR_ARRAY_LIST_STRIDE_IBM = 103082 # GL/glext.h:2519
+GL_INDEX_ARRAY_LIST_STRIDE_IBM = 103083 # GL/glext.h:2520
+GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM = 103084 # GL/glext.h:2521
+GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM = 103085 # GL/glext.h:2522
+GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM = 103086 # GL/glext.h:2523
+GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM = 103087 # GL/glext.h:2524
+# SGIX_subsample (GL/glext.h:2527)
+GL_PACK_SUBSAMPLE_RATE_SGIX = 34208 # GL/glext.h:2528
+GL_UNPACK_SUBSAMPLE_RATE_SGIX = 34209 # GL/glext.h:2529
+GL_PIXEL_SUBSAMPLE_4444_SGIX = 34210 # GL/glext.h:2530
+GL_PIXEL_SUBSAMPLE_2424_SGIX = 34211 # GL/glext.h:2531
+GL_PIXEL_SUBSAMPLE_4242_SGIX = 34212 # GL/glext.h:2532
+# SGIX_ycrcb_subsample (GL/glext.h:2535)
+# SGIX_ycrcba (GL/glext.h:2538)
+GL_YCRCB_SGIX = 33560 # GL/glext.h:2539
+GL_YCRCBA_SGIX = 33561 # GL/glext.h:2540
+# SGI_depth_pass_instrument (GL/glext.h:2543)
+GL_DEPTH_PASS_INSTRUMENT_SGIX = 33552 # GL/glext.h:2544
+GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX = 33553 # GL/glext.h:2545
+GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX = 33554 # GL/glext.h:2546
+# 3DFX_texture_compression_FXT1 (GL/glext.h:2549)
+GL_COMPRESSED_RGB_FXT1_3DFX = 34480 # GL/glext.h:2550
+GL_COMPRESSED_RGBA_FXT1_3DFX = 34481 # GL/glext.h:2551
+# 3DFX_multisample (GL/glext.h:2554)
+GL_MULTISAMPLE_3DFX = 34482 # GL/glext.h:2555
+GL_SAMPLE_BUFFERS_3DFX = 34483 # GL/glext.h:2556
+GL_SAMPLES_3DFX = 34484 # GL/glext.h:2557
+GL_MULTISAMPLE_BIT_3DFX = 536870912 # GL/glext.h:2558
+# 3DFX_tbuffer (GL/glext.h:2561)
+# EXT_multisample (GL/glext.h:2564)
+GL_MULTISAMPLE_EXT = 32925 # GL/glext.h:2565
+GL_SAMPLE_ALPHA_TO_MASK_EXT = 32926 # GL/glext.h:2566
+GL_SAMPLE_ALPHA_TO_ONE_EXT = 32927 # GL/glext.h:2567
+GL_SAMPLE_MASK_EXT = 32928 # GL/glext.h:2568
+GL_1PASS_EXT = 32929 # GL/glext.h:2569
+GL_2PASS_0_EXT = 32930 # GL/glext.h:2570
+GL_2PASS_1_EXT = 32931 # GL/glext.h:2571
+GL_4PASS_0_EXT = 32932 # GL/glext.h:2572
+GL_4PASS_1_EXT = 32933 # GL/glext.h:2573
+GL_4PASS_2_EXT = 32934 # GL/glext.h:2574
+GL_4PASS_3_EXT = 32935 # GL/glext.h:2575
+GL_SAMPLE_BUFFERS_EXT = 32936 # GL/glext.h:2576
+GL_SAMPLES_EXT = 32937 # GL/glext.h:2577
+GL_SAMPLE_MASK_VALUE_EXT = 32938 # GL/glext.h:2578
+GL_SAMPLE_MASK_INVERT_EXT = 32939 # GL/glext.h:2579
+GL_SAMPLE_PATTERN_EXT = 32940 # GL/glext.h:2580
+GL_MULTISAMPLE_BIT_EXT = 536870912 # GL/glext.h:2581
+# SGIX_vertex_preclip (GL/glext.h:2584)
+GL_VERTEX_PRECLIP_SGIX = 33774 # GL/glext.h:2585
+GL_VERTEX_PRECLIP_HINT_SGIX = 33775 # GL/glext.h:2586
+# SGIX_convolution_accuracy (GL/glext.h:2589)
+GL_CONVOLUTION_HINT_SGIX = 33558 # GL/glext.h:2590
+# SGIX_resample (GL/glext.h:2593)
+GL_PACK_RESAMPLE_SGIX = 33836 # GL/glext.h:2594
+GL_UNPACK_RESAMPLE_SGIX = 33837 # GL/glext.h:2595
+GL_RESAMPLE_REPLICATE_SGIX = 33838 # GL/glext.h:2596
+GL_RESAMPLE_ZERO_FILL_SGIX = 33839 # GL/glext.h:2597
+GL_RESAMPLE_DECIMATE_SGIX = 33840 # GL/glext.h:2598
+# SGIS_point_line_texgen (GL/glext.h:2601)
+GL_EYE_DISTANCE_TO_POINT_SGIS = 33264 # GL/glext.h:2602
+GL_OBJECT_DISTANCE_TO_POINT_SGIS = 33265 # GL/glext.h:2603
+GL_EYE_DISTANCE_TO_LINE_SGIS = 33266 # GL/glext.h:2604
+GL_OBJECT_DISTANCE_TO_LINE_SGIS = 33267 # GL/glext.h:2605
+GL_EYE_POINT_SGIS = 33268 # GL/glext.h:2606
+GL_OBJECT_POINT_SGIS = 33269 # GL/glext.h:2607
+GL_EYE_LINE_SGIS = 33270 # GL/glext.h:2608
+GL_OBJECT_LINE_SGIS = 33271 # GL/glext.h:2609
+# SGIS_texture_color_mask (GL/glext.h:2612)
+GL_TEXTURE_COLOR_WRITEMASK_SGIS = 33263 # GL/glext.h:2613
+# EXT_texture_env_dot3 (GL/glext.h:2616)
+GL_DOT3_RGB_EXT = 34624 # GL/glext.h:2617
+GL_DOT3_RGBA_EXT = 34625 # GL/glext.h:2618
+# ATI_texture_mirror_once (GL/glext.h:2621)
+GL_MIRROR_CLAMP_ATI = 34626 # GL/glext.h:2622
+GL_MIRROR_CLAMP_TO_EDGE_ATI = 34627 # GL/glext.h:2623
+# NV_fence (GL/glext.h:2626)
+GL_ALL_COMPLETED_NV = 34034 # GL/glext.h:2627
+GL_FENCE_STATUS_NV = 34035 # GL/glext.h:2628
+GL_FENCE_CONDITION_NV = 34036 # GL/glext.h:2629
+# IBM_texture_mirrored_repeat (GL/glext.h:2632)
+GL_MIRRORED_REPEAT_IBM = 33648 # GL/glext.h:2633
+# NV_evaluators (GL/glext.h:2636)
+GL_EVAL_2D_NV = 34496 # GL/glext.h:2637
+GL_EVAL_TRIANGULAR_2D_NV = 34497 # GL/glext.h:2638
+GL_MAP_TESSELLATION_NV = 34498 # GL/glext.h:2639
+GL_MAP_ATTRIB_U_ORDER_NV = 34499 # GL/glext.h:2640
+GL_MAP_ATTRIB_V_ORDER_NV = 34500 # GL/glext.h:2641
+GL_EVAL_FRACTIONAL_TESSELLATION_NV = 34501 # GL/glext.h:2642
+GL_EVAL_VERTEX_ATTRIB0_NV = 34502 # GL/glext.h:2643
+GL_EVAL_VERTEX_ATTRIB1_NV = 34503 # GL/glext.h:2644
+GL_EVAL_VERTEX_ATTRIB2_NV = 34504 # GL/glext.h:2645
+GL_EVAL_VERTEX_ATTRIB3_NV = 34505 # GL/glext.h:2646
+GL_EVAL_VERTEX_ATTRIB4_NV = 34506 # GL/glext.h:2647
+GL_EVAL_VERTEX_ATTRIB5_NV = 34507 # GL/glext.h:2648
+GL_EVAL_VERTEX_ATTRIB6_NV = 34508 # GL/glext.h:2649
+GL_EVAL_VERTEX_ATTRIB7_NV = 34509 # GL/glext.h:2650
+GL_EVAL_VERTEX_ATTRIB8_NV = 34510 # GL/glext.h:2651
+GL_EVAL_VERTEX_ATTRIB9_NV = 34511 # GL/glext.h:2652
+GL_EVAL_VERTEX_ATTRIB10_NV = 34512 # GL/glext.h:2653
+GL_EVAL_VERTEX_ATTRIB11_NV = 34513 # GL/glext.h:2654
+GL_EVAL_VERTEX_ATTRIB12_NV = 34514 # GL/glext.h:2655
+GL_EVAL_VERTEX_ATTRIB13_NV = 34515 # GL/glext.h:2656
+GL_EVAL_VERTEX_ATTRIB14_NV = 34516 # GL/glext.h:2657
+GL_EVAL_VERTEX_ATTRIB15_NV = 34517 # GL/glext.h:2658
+GL_MAX_MAP_TESSELLATION_NV = 34518 # GL/glext.h:2659
+GL_MAX_RATIONAL_EVAL_ORDER_NV = 34519 # GL/glext.h:2660
+# NV_packed_depth_stencil (GL/glext.h:2663)
+GL_DEPTH_STENCIL_NV = 34041 # GL/glext.h:2664
+GL_UNSIGNED_INT_24_8_NV = 34042 # GL/glext.h:2665
+# EXT_packed_depth_stencil (GL/glext.h:2668)
+GL_DEPTH_STENCIL_EXT = 34041 # GL/glext.h:2669
+GL_DEPTH24_STENCIL8_EXT = 35056 # GL/glext.h:2670
+GL_TEXTURE_STENCIL_SIZE_EXT = 35057 # GL/glext.h:2671
+GL_UNSIGNED_INT_24_8_EXT = 34042 # GL/glext.h:2672
+# NV_register_combiners2 (GL/glext.h:2675)
+GL_PER_STAGE_CONSTANTS_NV = 34101 # GL/glext.h:2676
+# NV_texture_compression_vtc (GL/glext.h:2679)
+# NV_texture_rectangle (GL/glext.h:2682)
+GL_TEXTURE_RECTANGLE_NV = 34037 # GL/glext.h:2683
+GL_TEXTURE_BINDING_RECTANGLE_NV = 34038 # GL/glext.h:2684
+GL_PROXY_TEXTURE_RECTANGLE_NV = 34039 # GL/glext.h:2685
+GL_MAX_RECTANGLE_TEXTURE_SIZE_NV = 34040 # GL/glext.h:2686
+# NV_texture_shader (GL/glext.h:2689)
+GL_OFFSET_TEXTURE_RECTANGLE_NV = 34380 # GL/glext.h:2690
+GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV = 34381 # GL/glext.h:2691
+GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV = 34382 # GL/glext.h:2692
+GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV = 34521 # GL/glext.h:2693
+GL_UNSIGNED_INT_S8_S8_8_8_NV = 34522 # GL/glext.h:2694
+GL_UNSIGNED_INT_8_8_S8_S8_REV_NV = 34523 # GL/glext.h:2695
+GL_DSDT_MAG_INTENSITY_NV = 34524 # GL/glext.h:2696
+GL_SHADER_CONSISTENT_NV = 34525 # GL/glext.h:2697
+GL_TEXTURE_SHADER_NV = 34526 # GL/glext.h:2698
+GL_SHADER_OPERATION_NV = 34527 # GL/glext.h:2699
+GL_CULL_MODES_NV = 34528 # GL/glext.h:2700
+GL_OFFSET_TEXTURE_MATRIX_NV = 34529 # GL/glext.h:2701
+GL_OFFSET_TEXTURE_SCALE_NV = 34530 # GL/glext.h:2702
+GL_OFFSET_TEXTURE_BIAS_NV = 34531 # GL/glext.h:2703
+GL_OFFSET_TEXTURE_2D_MATRIX_NV = 34529 # GL/glext.h:2704
+GL_OFFSET_TEXTURE_2D_SCALE_NV = 34530 # GL/glext.h:2705
+GL_OFFSET_TEXTURE_2D_BIAS_NV = 34531 # GL/glext.h:2706
+GL_PREVIOUS_TEXTURE_INPUT_NV = 34532 # GL/glext.h:2707
+GL_CONST_EYE_NV = 34533 # GL/glext.h:2708
+GL_PASS_THROUGH_NV = 34534 # GL/glext.h:2709
+GL_CULL_FRAGMENT_NV = 34535 # GL/glext.h:2710
+GL_OFFSET_TEXTURE_2D_NV = 34536 # GL/glext.h:2711
+GL_DEPENDENT_AR_TEXTURE_2D_NV = 34537 # GL/glext.h:2712
+GL_DEPENDENT_GB_TEXTURE_2D_NV = 34538 # GL/glext.h:2713
+GL_DOT_PRODUCT_NV = 34540 # GL/glext.h:2714
+GL_DOT_PRODUCT_DEPTH_REPLACE_NV = 34541 # GL/glext.h:2715
+GL_DOT_PRODUCT_TEXTURE_2D_NV = 34542 # GL/glext.h:2716
+GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV = 34544 # GL/glext.h:2717
+GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV = 34545 # GL/glext.h:2718
+GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV = 34546 # GL/glext.h:2719
+GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV = 34547 # GL/glext.h:2720
+GL_HILO_NV = 34548 # GL/glext.h:2721
+GL_DSDT_NV = 34549 # GL/glext.h:2722
+GL_DSDT_MAG_NV = 34550 # GL/glext.h:2723
+GL_DSDT_MAG_VIB_NV = 34551 # GL/glext.h:2724
+GL_HILO16_NV = 34552 # GL/glext.h:2725
+GL_SIGNED_HILO_NV = 34553 # GL/glext.h:2726
+GL_SIGNED_HILO16_NV = 34554 # GL/glext.h:2727
+GL_SIGNED_RGBA_NV = 34555 # GL/glext.h:2728
+GL_SIGNED_RGBA8_NV = 34556 # GL/glext.h:2729
+GL_SIGNED_RGB_NV = 34558 # GL/glext.h:2730
+GL_SIGNED_RGB8_NV = 34559 # GL/glext.h:2731
+GL_SIGNED_LUMINANCE_NV = 34561 # GL/glext.h:2732
+GL_SIGNED_LUMINANCE8_NV = 34562 # GL/glext.h:2733
+GL_SIGNED_LUMINANCE_ALPHA_NV = 34563 # GL/glext.h:2734
+GL_SIGNED_LUMINANCE8_ALPHA8_NV = 34564 # GL/glext.h:2735
+GL_SIGNED_ALPHA_NV = 34565 # GL/glext.h:2736
+GL_SIGNED_ALPHA8_NV = 34566 # GL/glext.h:2737
+GL_SIGNED_INTENSITY_NV = 34567 # GL/glext.h:2738
+GL_SIGNED_INTENSITY8_NV = 34568 # GL/glext.h:2739
+GL_DSDT8_NV = 34569 # GL/glext.h:2740
+GL_DSDT8_MAG8_NV = 34570 # GL/glext.h:2741
+GL_DSDT8_MAG8_INTENSITY8_NV = 34571 # GL/glext.h:2742
+GL_SIGNED_RGB_UNSIGNED_ALPHA_NV = 34572 # GL/glext.h:2743
+GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV = 34573 # GL/glext.h:2744
+GL_HI_SCALE_NV = 34574 # GL/glext.h:2745
+GL_LO_SCALE_NV = 34575 # GL/glext.h:2746
+GL_DS_SCALE_NV = 34576 # GL/glext.h:2747
+GL_DT_SCALE_NV = 34577 # GL/glext.h:2748
+GL_MAGNITUDE_SCALE_NV = 34578 # GL/glext.h:2749
+GL_VIBRANCE_SCALE_NV = 34579 # GL/glext.h:2750
+GL_HI_BIAS_NV = 34580 # GL/glext.h:2751
+GL_LO_BIAS_NV = 34581 # GL/glext.h:2752
+GL_DS_BIAS_NV = 34582 # GL/glext.h:2753
+GL_DT_BIAS_NV = 34583 # GL/glext.h:2754
+GL_MAGNITUDE_BIAS_NV = 34584 # GL/glext.h:2755
+GL_VIBRANCE_BIAS_NV = 34585 # GL/glext.h:2756
+GL_TEXTURE_BORDER_VALUES_NV = 34586 # GL/glext.h:2757
+GL_TEXTURE_HI_SIZE_NV = 34587 # GL/glext.h:2758
+GL_TEXTURE_LO_SIZE_NV = 34588 # GL/glext.h:2759
+GL_TEXTURE_DS_SIZE_NV = 34589 # GL/glext.h:2760
+GL_TEXTURE_DT_SIZE_NV = 34590 # GL/glext.h:2761
+GL_TEXTURE_MAG_SIZE_NV = 34591 # GL/glext.h:2762
+# NV_texture_shader2 (GL/glext.h:2765)
+GL_DOT_PRODUCT_TEXTURE_3D_NV = 34543 # GL/glext.h:2766
+# NV_vertex_array_range2 (GL/glext.h:2769)
+GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV = 34099 # GL/glext.h:2770
+# NV_vertex_program (GL/glext.h:2773)
+GL_VERTEX_PROGRAM_NV = 34336 # GL/glext.h:2774
+GL_VERTEX_STATE_PROGRAM_NV = 34337 # GL/glext.h:2775
+GL_ATTRIB_ARRAY_SIZE_NV = 34339 # GL/glext.h:2776
+GL_ATTRIB_ARRAY_STRIDE_NV = 34340 # GL/glext.h:2777
+GL_ATTRIB_ARRAY_TYPE_NV = 34341 # GL/glext.h:2778
+GL_CURRENT_ATTRIB_NV = 34342 # GL/glext.h:2779
+GL_PROGRAM_LENGTH_NV = 34343 # GL/glext.h:2780
+GL_PROGRAM_STRING_NV = 34344 # GL/glext.h:2781
+GL_MODELVIEW_PROJECTION_NV = 34345 # GL/glext.h:2782
+GL_IDENTITY_NV = 34346 # GL/glext.h:2783
+GL_INVERSE_NV = 34347 # GL/glext.h:2784
+GL_TRANSPOSE_NV = 34348 # GL/glext.h:2785
+GL_INVERSE_TRANSPOSE_NV = 34349 # GL/glext.h:2786
+GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV = 34350 # GL/glext.h:2787
+GL_MAX_TRACK_MATRICES_NV = 34351 # GL/glext.h:2788
+GL_MATRIX0_NV = 34352 # GL/glext.h:2789
+GL_MATRIX1_NV = 34353 # GL/glext.h:2790
+GL_MATRIX2_NV = 34354 # GL/glext.h:2791
+GL_MATRIX3_NV = 34355 # GL/glext.h:2792
+GL_MATRIX4_NV = 34356 # GL/glext.h:2793
+GL_MATRIX5_NV = 34357 # GL/glext.h:2794
+GL_MATRIX6_NV = 34358 # GL/glext.h:2795
+GL_MATRIX7_NV = 34359 # GL/glext.h:2796
+GL_CURRENT_MATRIX_STACK_DEPTH_NV = 34368 # GL/glext.h:2797
+GL_CURRENT_MATRIX_NV = 34369 # GL/glext.h:2798
+GL_VERTEX_PROGRAM_POINT_SIZE_NV = 34370 # GL/glext.h:2799
+GL_VERTEX_PROGRAM_TWO_SIDE_NV = 34371 # GL/glext.h:2800
+GL_PROGRAM_PARAMETER_NV = 34372 # GL/glext.h:2801
+GL_ATTRIB_ARRAY_POINTER_NV = 34373 # GL/glext.h:2802
+GL_PROGRAM_TARGET_NV = 34374 # GL/glext.h:2803
+GL_PROGRAM_RESIDENT_NV = 34375 # GL/glext.h:2804
+GL_TRACK_MATRIX_NV = 34376 # GL/glext.h:2805
+GL_TRACK_MATRIX_TRANSFORM_NV = 34377 # GL/glext.h:2806
+GL_VERTEX_PROGRAM_BINDING_NV = 34378 # GL/glext.h:2807
+GL_PROGRAM_ERROR_POSITION_NV = 34379 # GL/glext.h:2808
+GL_VERTEX_ATTRIB_ARRAY0_NV = 34384 # GL/glext.h:2809
+GL_VERTEX_ATTRIB_ARRAY1_NV = 34385 # GL/glext.h:2810
+GL_VERTEX_ATTRIB_ARRAY2_NV = 34386 # GL/glext.h:2811
+GL_VERTEX_ATTRIB_ARRAY3_NV = 34387 # GL/glext.h:2812
+GL_VERTEX_ATTRIB_ARRAY4_NV = 34388 # GL/glext.h:2813
+GL_VERTEX_ATTRIB_ARRAY5_NV = 34389 # GL/glext.h:2814
+GL_VERTEX_ATTRIB_ARRAY6_NV = 34390 # GL/glext.h:2815
+GL_VERTEX_ATTRIB_ARRAY7_NV = 34391 # GL/glext.h:2816
+GL_VERTEX_ATTRIB_ARRAY8_NV = 34392 # GL/glext.h:2817
+GL_VERTEX_ATTRIB_ARRAY9_NV = 34393 # GL/glext.h:2818
+GL_VERTEX_ATTRIB_ARRAY10_NV = 34394 # GL/glext.h:2819
+GL_VERTEX_ATTRIB_ARRAY11_NV = 34395 # GL/glext.h:2820
+GL_VERTEX_ATTRIB_ARRAY12_NV = 34396 # GL/glext.h:2821
+GL_VERTEX_ATTRIB_ARRAY13_NV = 34397 # GL/glext.h:2822
+GL_VERTEX_ATTRIB_ARRAY14_NV = 34398 # GL/glext.h:2823
+GL_VERTEX_ATTRIB_ARRAY15_NV = 34399 # GL/glext.h:2824
+GL_MAP1_VERTEX_ATTRIB0_4_NV = 34400 # GL/glext.h:2825
+GL_MAP1_VERTEX_ATTRIB1_4_NV = 34401 # GL/glext.h:2826
+GL_MAP1_VERTEX_ATTRIB2_4_NV = 34402 # GL/glext.h:2827
+GL_MAP1_VERTEX_ATTRIB3_4_NV = 34403 # GL/glext.h:2828
+GL_MAP1_VERTEX_ATTRIB4_4_NV = 34404 # GL/glext.h:2829
+GL_MAP1_VERTEX_ATTRIB5_4_NV = 34405 # GL/glext.h:2830
+GL_MAP1_VERTEX_ATTRIB6_4_NV = 34406 # GL/glext.h:2831
+GL_MAP1_VERTEX_ATTRIB7_4_NV = 34407 # GL/glext.h:2832
+GL_MAP1_VERTEX_ATTRIB8_4_NV = 34408 # GL/glext.h:2833
+GL_MAP1_VERTEX_ATTRIB9_4_NV = 34409 # GL/glext.h:2834
+GL_MAP1_VERTEX_ATTRIB10_4_NV = 34410 # GL/glext.h:2835
+GL_MAP1_VERTEX_ATTRIB11_4_NV = 34411 # GL/glext.h:2836
+GL_MAP1_VERTEX_ATTRIB12_4_NV = 34412 # GL/glext.h:2837
+GL_MAP1_VERTEX_ATTRIB13_4_NV = 34413 # GL/glext.h:2838
+GL_MAP1_VERTEX_ATTRIB14_4_NV = 34414 # GL/glext.h:2839
+GL_MAP1_VERTEX_ATTRIB15_4_NV = 34415 # GL/glext.h:2840
+GL_MAP2_VERTEX_ATTRIB0_4_NV = 34416 # GL/glext.h:2841
+GL_MAP2_VERTEX_ATTRIB1_4_NV = 34417 # GL/glext.h:2842
+GL_MAP2_VERTEX_ATTRIB2_4_NV = 34418 # GL/glext.h:2843
+GL_MAP2_VERTEX_ATTRIB3_4_NV = 34419 # GL/glext.h:2844
+GL_MAP2_VERTEX_ATTRIB4_4_NV = 34420 # GL/glext.h:2845
+GL_MAP2_VERTEX_ATTRIB5_4_NV = 34421 # GL/glext.h:2846
+GL_MAP2_VERTEX_ATTRIB6_4_NV = 34422 # GL/glext.h:2847
+GL_MAP2_VERTEX_ATTRIB7_4_NV = 34423 # GL/glext.h:2848
+GL_MAP2_VERTEX_ATTRIB8_4_NV = 34424 # GL/glext.h:2849
+GL_MAP2_VERTEX_ATTRIB9_4_NV = 34425 # GL/glext.h:2850
+GL_MAP2_VERTEX_ATTRIB10_4_NV = 34426 # GL/glext.h:2851
+GL_MAP2_VERTEX_ATTRIB11_4_NV = 34427 # GL/glext.h:2852
+GL_MAP2_VERTEX_ATTRIB12_4_NV = 34428 # GL/glext.h:2853
+GL_MAP2_VERTEX_ATTRIB13_4_NV = 34429 # GL/glext.h:2854
+GL_MAP2_VERTEX_ATTRIB14_4_NV = 34430 # GL/glext.h:2855
+GL_MAP2_VERTEX_ATTRIB15_4_NV = 34431 # GL/glext.h:2856
+# SGIX_texture_coordinate_clamp (GL/glext.h:2859)
+GL_TEXTURE_MAX_CLAMP_S_SGIX = 33641 # GL/glext.h:2860
+GL_TEXTURE_MAX_CLAMP_T_SGIX = 33642 # GL/glext.h:2861
+GL_TEXTURE_MAX_CLAMP_R_SGIX = 33643 # GL/glext.h:2862
+# SGIX_scalebias_hint (GL/glext.h:2865)
+GL_SCALEBIAS_HINT_SGIX = 33570 # GL/glext.h:2866
+# OML_interlace (GL/glext.h:2869)
+GL_INTERLACE_OML = 35200 # GL/glext.h:2870
+GL_INTERLACE_READ_OML = 35201 # GL/glext.h:2871
+# OML_subsample (GL/glext.h:2874)
+GL_FORMAT_SUBSAMPLE_24_24_OML = 35202 # GL/glext.h:2875
+GL_FORMAT_SUBSAMPLE_244_244_OML = 35203 # GL/glext.h:2876
+# OML_resample (GL/glext.h:2879)
+GL_PACK_RESAMPLE_OML = 35204 # GL/glext.h:2880
+GL_UNPACK_RESAMPLE_OML = 35205 # GL/glext.h:2881
+GL_RESAMPLE_REPLICATE_OML = 35206 # GL/glext.h:2882
+GL_RESAMPLE_ZERO_FILL_OML = 35207 # GL/glext.h:2883
+GL_RESAMPLE_AVERAGE_OML = 35208 # GL/glext.h:2884
+GL_RESAMPLE_DECIMATE_OML = 35209 # GL/glext.h:2885
+# NV_copy_depth_to_color (GL/glext.h:2888)
+GL_DEPTH_STENCIL_TO_RGBA_NV = 34926 # GL/glext.h:2889
+GL_DEPTH_STENCIL_TO_BGRA_NV = 34927 # GL/glext.h:2890
+# ATI_envmap_bumpmap (GL/glext.h:2893)
+GL_BUMP_ROT_MATRIX_ATI = 34677 # GL/glext.h:2894
+GL_BUMP_ROT_MATRIX_SIZE_ATI = 34678 # GL/glext.h:2895
+GL_BUMP_NUM_TEX_UNITS_ATI = 34679 # GL/glext.h:2896
+GL_BUMP_TEX_UNITS_ATI = 34680 # GL/glext.h:2897
+GL_DUDV_ATI = 34681 # GL/glext.h:2898
+GL_DU8DV8_ATI = 34682 # GL/glext.h:2899
+GL_BUMP_ENVMAP_ATI = 34683 # GL/glext.h:2900
+GL_BUMP_TARGET_ATI = 34684 # GL/glext.h:2901
+# ATI_fragment_shader (GL/glext.h:2904)
+GL_FRAGMENT_SHADER_ATI = 35104 # GL/glext.h:2905
+GL_REG_0_ATI = 35105 # GL/glext.h:2906
+GL_REG_1_ATI = 35106 # GL/glext.h:2907
+GL_REG_2_ATI = 35107 # GL/glext.h:2908
+GL_REG_3_ATI = 35108 # GL/glext.h:2909
+GL_REG_4_ATI = 35109 # GL/glext.h:2910
+GL_REG_5_ATI = 35110 # GL/glext.h:2911
+GL_REG_6_ATI = 35111 # GL/glext.h:2912
+GL_REG_7_ATI = 35112 # GL/glext.h:2913
+GL_REG_8_ATI = 35113 # GL/glext.h:2914
+GL_REG_9_ATI = 35114 # GL/glext.h:2915
+GL_REG_10_ATI = 35115 # GL/glext.h:2916
+GL_REG_11_ATI = 35116 # GL/glext.h:2917
+GL_REG_12_ATI = 35117 # GL/glext.h:2918
+GL_REG_13_ATI = 35118 # GL/glext.h:2919
+GL_REG_14_ATI = 35119 # GL/glext.h:2920
+GL_REG_15_ATI = 35120 # GL/glext.h:2921
+GL_REG_16_ATI = 35121 # GL/glext.h:2922
+GL_REG_17_ATI = 35122 # GL/glext.h:2923
+GL_REG_18_ATI = 35123 # GL/glext.h:2924
+GL_REG_19_ATI = 35124 # GL/glext.h:2925
+GL_REG_20_ATI = 35125 # GL/glext.h:2926
+GL_REG_21_ATI = 35126 # GL/glext.h:2927
+GL_REG_22_ATI = 35127 # GL/glext.h:2928
+GL_REG_23_ATI = 35128 # GL/glext.h:2929
+GL_REG_24_ATI = 35129 # GL/glext.h:2930
+GL_REG_25_ATI = 35130 # GL/glext.h:2931
+GL_REG_26_ATI = 35131 # GL/glext.h:2932
+GL_REG_27_ATI = 35132 # GL/glext.h:2933
+GL_REG_28_ATI = 35133 # GL/glext.h:2934
+GL_REG_29_ATI = 35134 # GL/glext.h:2935
+GL_REG_30_ATI = 35135 # GL/glext.h:2936
+GL_REG_31_ATI = 35136 # GL/glext.h:2937
+GL_CON_0_ATI = 35137 # GL/glext.h:2938
+GL_CON_1_ATI = 35138 # GL/glext.h:2939
+GL_CON_2_ATI = 35139 # GL/glext.h:2940
+GL_CON_3_ATI = 35140 # GL/glext.h:2941
+GL_CON_4_ATI = 35141 # GL/glext.h:2942
+GL_CON_5_ATI = 35142 # GL/glext.h:2943
+GL_CON_6_ATI = 35143 # GL/glext.h:2944
+GL_CON_7_ATI = 35144 # GL/glext.h:2945
+GL_CON_8_ATI = 35145 # GL/glext.h:2946
+GL_CON_9_ATI = 35146 # GL/glext.h:2947
+GL_CON_10_ATI = 35147 # GL/glext.h:2948
+GL_CON_11_ATI = 35148 # GL/glext.h:2949
+GL_CON_12_ATI = 35149 # GL/glext.h:2950
+GL_CON_13_ATI = 35150 # GL/glext.h:2951
+GL_CON_14_ATI = 35151 # GL/glext.h:2952
+GL_CON_15_ATI = 35152 # GL/glext.h:2953
+GL_CON_16_ATI = 35153 # GL/glext.h:2954
+GL_CON_17_ATI = 35154 # GL/glext.h:2955
+GL_CON_18_ATI = 35155 # GL/glext.h:2956
+GL_CON_19_ATI = 35156 # GL/glext.h:2957
+GL_CON_20_ATI = 35157 # GL/glext.h:2958
+GL_CON_21_ATI = 35158 # GL/glext.h:2959
+GL_CON_22_ATI = 35159 # GL/glext.h:2960
+GL_CON_23_ATI = 35160 # GL/glext.h:2961
+GL_CON_24_ATI = 35161 # GL/glext.h:2962
+GL_CON_25_ATI = 35162 # GL/glext.h:2963
+GL_CON_26_ATI = 35163 # GL/glext.h:2964
+GL_CON_27_ATI = 35164 # GL/glext.h:2965
+GL_CON_28_ATI = 35165 # GL/glext.h:2966
+GL_CON_29_ATI = 35166 # GL/glext.h:2967
+GL_CON_30_ATI = 35167 # GL/glext.h:2968
+GL_CON_31_ATI = 35168 # GL/glext.h:2969
+GL_MOV_ATI = 35169 # GL/glext.h:2970
+GL_ADD_ATI = 35171 # GL/glext.h:2971
+GL_MUL_ATI = 35172 # GL/glext.h:2972
+GL_SUB_ATI = 35173 # GL/glext.h:2973
+GL_DOT3_ATI = 35174 # GL/glext.h:2974
+GL_DOT4_ATI = 35175 # GL/glext.h:2975
+GL_MAD_ATI = 35176 # GL/glext.h:2976
+GL_LERP_ATI = 35177 # GL/glext.h:2977
+GL_CND_ATI = 35178 # GL/glext.h:2978
+GL_CND0_ATI = 35179 # GL/glext.h:2979
+GL_DOT2_ADD_ATI = 35180 # GL/glext.h:2980
+GL_SECONDARY_INTERPOLATOR_ATI = 35181 # GL/glext.h:2981
+GL_NUM_FRAGMENT_REGISTERS_ATI = 35182 # GL/glext.h:2982
+GL_NUM_FRAGMENT_CONSTANTS_ATI = 35183 # GL/glext.h:2983
+GL_NUM_PASSES_ATI = 35184 # GL/glext.h:2984
+GL_NUM_INSTRUCTIONS_PER_PASS_ATI = 35185 # GL/glext.h:2985
+GL_NUM_INSTRUCTIONS_TOTAL_ATI = 35186 # GL/glext.h:2986
+GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI = 35187 # GL/glext.h:2987
+GL_NUM_LOOPBACK_COMPONENTS_ATI = 35188 # GL/glext.h:2988
+GL_COLOR_ALPHA_PAIRING_ATI = 35189 # GL/glext.h:2989
+GL_SWIZZLE_STR_ATI = 35190 # GL/glext.h:2990
+GL_SWIZZLE_STQ_ATI = 35191 # GL/glext.h:2991
+GL_SWIZZLE_STR_DR_ATI = 35192 # GL/glext.h:2992
+GL_SWIZZLE_STQ_DQ_ATI = 35193 # GL/glext.h:2993
+GL_SWIZZLE_STRQ_ATI = 35194 # GL/glext.h:2994
+GL_SWIZZLE_STRQ_DQ_ATI = 35195 # GL/glext.h:2995
+GL_RED_BIT_ATI = 1 # GL/glext.h:2996
+GL_GREEN_BIT_ATI = 2 # GL/glext.h:2997
+GL_BLUE_BIT_ATI = 4 # GL/glext.h:2998
+GL_2X_BIT_ATI = 1 # GL/glext.h:2999
+GL_4X_BIT_ATI = 2 # GL/glext.h:3000
+GL_8X_BIT_ATI = 4 # GL/glext.h:3001
+GL_HALF_BIT_ATI = 8 # GL/glext.h:3002
+GL_QUARTER_BIT_ATI = 16 # GL/glext.h:3003
+GL_EIGHTH_BIT_ATI = 32 # GL/glext.h:3004
+GL_SATURATE_BIT_ATI = 64 # GL/glext.h:3005
+GL_COMP_BIT_ATI = 2 # GL/glext.h:3006
+GL_NEGATE_BIT_ATI = 4 # GL/glext.h:3007
+GL_BIAS_BIT_ATI = 8 # GL/glext.h:3008
+# ATI_pn_triangles (GL/glext.h:3011)
+GL_PN_TRIANGLES_ATI = 34800 # GL/glext.h:3012
+GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI = 34801 # GL/glext.h:3013
+GL_PN_TRIANGLES_POINT_MODE_ATI = 34802 # GL/glext.h:3014
+GL_PN_TRIANGLES_NORMAL_MODE_ATI = 34803 # GL/glext.h:3015
+GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI = 34804 # GL/glext.h:3016
+GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI = 34805 # GL/glext.h:3017
+GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI = 34806 # GL/glext.h:3018
+GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI = 34807 # GL/glext.h:3019
+GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI = 34808 # GL/glext.h:3020
+# ATI_vertex_array_object (GL/glext.h:3023)
+GL_STATIC_ATI = 34656 # GL/glext.h:3024
+GL_DYNAMIC_ATI = 34657 # GL/glext.h:3025
+GL_PRESERVE_ATI = 34658 # GL/glext.h:3026
+GL_DISCARD_ATI = 34659 # GL/glext.h:3027
+GL_OBJECT_BUFFER_SIZE_ATI = 34660 # GL/glext.h:3028
+GL_OBJECT_BUFFER_USAGE_ATI = 34661 # GL/glext.h:3029
+GL_ARRAY_OBJECT_BUFFER_ATI = 34662 # GL/glext.h:3030
+GL_ARRAY_OBJECT_OFFSET_ATI = 34663 # GL/glext.h:3031
+# EXT_vertex_shader (GL/glext.h:3034)
+GL_VERTEX_SHADER_EXT = 34688 # GL/glext.h:3035
+GL_VERTEX_SHADER_BINDING_EXT = 34689 # GL/glext.h:3036
+GL_OP_INDEX_EXT = 34690 # GL/glext.h:3037
+GL_OP_NEGATE_EXT = 34691 # GL/glext.h:3038
+GL_OP_DOT3_EXT = 34692 # GL/glext.h:3039
+GL_OP_DOT4_EXT = 34693 # GL/glext.h:3040
+GL_OP_MUL_EXT = 34694 # GL/glext.h:3041
+GL_OP_ADD_EXT = 34695 # GL/glext.h:3042
+GL_OP_MADD_EXT = 34696 # GL/glext.h:3043
+GL_OP_FRAC_EXT = 34697 # GL/glext.h:3044
+GL_OP_MAX_EXT = 34698 # GL/glext.h:3045
+GL_OP_MIN_EXT = 34699 # GL/glext.h:3046
+GL_OP_SET_GE_EXT = 34700 # GL/glext.h:3047
+GL_OP_SET_LT_EXT = 34701 # GL/glext.h:3048
+GL_OP_CLAMP_EXT = 34702 # GL/glext.h:3049
+GL_OP_FLOOR_EXT = 34703 # GL/glext.h:3050
+GL_OP_ROUND_EXT = 34704 # GL/glext.h:3051
+GL_OP_EXP_BASE_2_EXT = 34705 # GL/glext.h:3052
+GL_OP_LOG_BASE_2_EXT = 34706 # GL/glext.h:3053
+GL_OP_POWER_EXT = 34707 # GL/glext.h:3054
+GL_OP_RECIP_EXT = 34708 # GL/glext.h:3055
+GL_OP_RECIP_SQRT_EXT = 34709 # GL/glext.h:3056
+GL_OP_SUB_EXT = 34710 # GL/glext.h:3057
+GL_OP_CROSS_PRODUCT_EXT = 34711 # GL/glext.h:3058
+GL_OP_MULTIPLY_MATRIX_EXT = 34712 # GL/glext.h:3059
+GL_OP_MOV_EXT = 34713 # GL/glext.h:3060
+GL_OUTPUT_VERTEX_EXT = 34714 # GL/glext.h:3061
+GL_OUTPUT_COLOR0_EXT = 34715 # GL/glext.h:3062
+GL_OUTPUT_COLOR1_EXT = 34716 # GL/glext.h:3063
+GL_OUTPUT_TEXTURE_COORD0_EXT = 34717 # GL/glext.h:3064
+GL_OUTPUT_TEXTURE_COORD1_EXT = 34718 # GL/glext.h:3065
+GL_OUTPUT_TEXTURE_COORD2_EXT = 34719 # GL/glext.h:3066
+GL_OUTPUT_TEXTURE_COORD3_EXT = 34720 # GL/glext.h:3067
+GL_OUTPUT_TEXTURE_COORD4_EXT = 34721 # GL/glext.h:3068
+GL_OUTPUT_TEXTURE_COORD5_EXT = 34722 # GL/glext.h:3069
+GL_OUTPUT_TEXTURE_COORD6_EXT = 34723 # GL/glext.h:3070
+GL_OUTPUT_TEXTURE_COORD7_EXT = 34724 # GL/glext.h:3071
+GL_OUTPUT_TEXTURE_COORD8_EXT = 34725 # GL/glext.h:3072
+GL_OUTPUT_TEXTURE_COORD9_EXT = 34726 # GL/glext.h:3073
+GL_OUTPUT_TEXTURE_COORD10_EXT = 34727 # GL/glext.h:3074
+GL_OUTPUT_TEXTURE_COORD11_EXT = 34728 # GL/glext.h:3075
+GL_OUTPUT_TEXTURE_COORD12_EXT = 34729 # GL/glext.h:3076
+GL_OUTPUT_TEXTURE_COORD13_EXT = 34730 # GL/glext.h:3077
+GL_OUTPUT_TEXTURE_COORD14_EXT = 34731 # GL/glext.h:3078
+GL_OUTPUT_TEXTURE_COORD15_EXT = 34732 # GL/glext.h:3079
+GL_OUTPUT_TEXTURE_COORD16_EXT = 34733 # GL/glext.h:3080
+GL_OUTPUT_TEXTURE_COORD17_EXT = 34734 # GL/glext.h:3081
+GL_OUTPUT_TEXTURE_COORD18_EXT = 34735 # GL/glext.h:3082
+GL_OUTPUT_TEXTURE_COORD19_EXT = 34736 # GL/glext.h:3083
+GL_OUTPUT_TEXTURE_COORD20_EXT = 34737 # GL/glext.h:3084
+GL_OUTPUT_TEXTURE_COORD21_EXT = 34738 # GL/glext.h:3085
+GL_OUTPUT_TEXTURE_COORD22_EXT = 34739 # GL/glext.h:3086
+GL_OUTPUT_TEXTURE_COORD23_EXT = 34740 # GL/glext.h:3087
+GL_OUTPUT_TEXTURE_COORD24_EXT = 34741 # GL/glext.h:3088
+GL_OUTPUT_TEXTURE_COORD25_EXT = 34742 # GL/glext.h:3089
+GL_OUTPUT_TEXTURE_COORD26_EXT = 34743 # GL/glext.h:3090
+GL_OUTPUT_TEXTURE_COORD27_EXT = 34744 # GL/glext.h:3091
+GL_OUTPUT_TEXTURE_COORD28_EXT = 34745 # GL/glext.h:3092
+GL_OUTPUT_TEXTURE_COORD29_EXT = 34746 # GL/glext.h:3093
+GL_OUTPUT_TEXTURE_COORD30_EXT = 34747 # GL/glext.h:3094
+GL_OUTPUT_TEXTURE_COORD31_EXT = 34748 # GL/glext.h:3095
+GL_OUTPUT_FOG_EXT = 34749 # GL/glext.h:3096
+GL_SCALAR_EXT = 34750 # GL/glext.h:3097
+GL_VECTOR_EXT = 34751 # GL/glext.h:3098
+GL_MATRIX_EXT = 34752 # GL/glext.h:3099
+GL_VARIANT_EXT = 34753 # GL/glext.h:3100
+GL_INVARIANT_EXT = 34754 # GL/glext.h:3101
+GL_LOCAL_CONSTANT_EXT = 34755 # GL/glext.h:3102
+GL_LOCAL_EXT = 34756 # GL/glext.h:3103
+GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT = 34757 # GL/glext.h:3104
+GL_MAX_VERTEX_SHADER_VARIANTS_EXT = 34758 # GL/glext.h:3105
+GL_MAX_VERTEX_SHADER_INVARIANTS_EXT = 34759 # GL/glext.h:3106
+GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = 34760 # GL/glext.h:3107
+GL_MAX_VERTEX_SHADER_LOCALS_EXT = 34761 # GL/glext.h:3108
+GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT = 34762 # GL/glext.h:3109
+GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT = 34763 # GL/glext.h:3110
+GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = 34764 # GL/glext.h:3111
+GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT = 34765 # GL/glext.h:3112
+GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT = 34766 # GL/glext.h:3113
+GL_VERTEX_SHADER_INSTRUCTIONS_EXT = 34767 # GL/glext.h:3114
+GL_VERTEX_SHADER_VARIANTS_EXT = 34768 # GL/glext.h:3115
+GL_VERTEX_SHADER_INVARIANTS_EXT = 34769 # GL/glext.h:3116
+GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = 34770 # GL/glext.h:3117
+GL_VERTEX_SHADER_LOCALS_EXT = 34771 # GL/glext.h:3118
+GL_VERTEX_SHADER_OPTIMIZED_EXT = 34772 # GL/glext.h:3119
+GL_X_EXT = 34773 # GL/glext.h:3120
+GL_Y_EXT = 34774 # GL/glext.h:3121
+GL_Z_EXT = 34775 # GL/glext.h:3122
+GL_W_EXT = 34776 # GL/glext.h:3123
+GL_NEGATIVE_X_EXT = 34777 # GL/glext.h:3124
+GL_NEGATIVE_Y_EXT = 34778 # GL/glext.h:3125
+GL_NEGATIVE_Z_EXT = 34779 # GL/glext.h:3126
+GL_NEGATIVE_W_EXT = 34780 # GL/glext.h:3127
+GL_ZERO_EXT = 34781 # GL/glext.h:3128
+GL_ONE_EXT = 34782 # GL/glext.h:3129
+GL_NEGATIVE_ONE_EXT = 34783 # GL/glext.h:3130
+GL_NORMALIZED_RANGE_EXT = 34784 # GL/glext.h:3131
+GL_FULL_RANGE_EXT = 34785 # GL/glext.h:3132
+GL_CURRENT_VERTEX_EXT = 34786 # GL/glext.h:3133
+GL_MVP_MATRIX_EXT = 34787 # GL/glext.h:3134
+GL_VARIANT_VALUE_EXT = 34788 # GL/glext.h:3135
+GL_VARIANT_DATATYPE_EXT = 34789 # GL/glext.h:3136
+GL_VARIANT_ARRAY_STRIDE_EXT = 34790 # GL/glext.h:3137
+GL_VARIANT_ARRAY_TYPE_EXT = 34791 # GL/glext.h:3138
+GL_VARIANT_ARRAY_EXT = 34792 # GL/glext.h:3139
+GL_VARIANT_ARRAY_POINTER_EXT = 34793 # GL/glext.h:3140
+GL_INVARIANT_VALUE_EXT = 34794 # GL/glext.h:3141
+GL_INVARIANT_DATATYPE_EXT = 34795 # GL/glext.h:3142
+GL_LOCAL_CONSTANT_VALUE_EXT = 34796 # GL/glext.h:3143
+GL_LOCAL_CONSTANT_DATATYPE_EXT = 34797 # GL/glext.h:3144
+# ATI_vertex_streams (GL/glext.h:3147)
+GL_MAX_VERTEX_STREAMS_ATI = 34667 # GL/glext.h:3148
+GL_VERTEX_STREAM0_ATI = 34668 # GL/glext.h:3149
+GL_VERTEX_STREAM1_ATI = 34669 # GL/glext.h:3150
+GL_VERTEX_STREAM2_ATI = 34670 # GL/glext.h:3151
+GL_VERTEX_STREAM3_ATI = 34671 # GL/glext.h:3152
+GL_VERTEX_STREAM4_ATI = 34672 # GL/glext.h:3153
+GL_VERTEX_STREAM5_ATI = 34673 # GL/glext.h:3154
+GL_VERTEX_STREAM6_ATI = 34674 # GL/glext.h:3155
+GL_VERTEX_STREAM7_ATI = 34675 # GL/glext.h:3156
+GL_VERTEX_SOURCE_ATI = 34676 # GL/glext.h:3157
+# ATI_element_array (GL/glext.h:3160)
+GL_ELEMENT_ARRAY_ATI = 34664 # GL/glext.h:3161
+GL_ELEMENT_ARRAY_TYPE_ATI = 34665 # GL/glext.h:3162
+GL_ELEMENT_ARRAY_POINTER_ATI = 34666 # GL/glext.h:3163
+# SUN_mesh_array (GL/glext.h:3166)
+GL_QUAD_MESH_SUN = 34324 # GL/glext.h:3167
+GL_TRIANGLE_MESH_SUN = 34325 # GL/glext.h:3168
+# SUN_slice_accum (GL/glext.h:3171)
+GL_SLICE_ACCUM_SUN = 34252 # GL/glext.h:3172
+# NV_multisample_filter_hint (GL/glext.h:3175)
+GL_MULTISAMPLE_FILTER_HINT_NV = 34100 # GL/glext.h:3176
+# NV_depth_clamp (GL/glext.h:3179)
+GL_DEPTH_CLAMP_NV = 34383 # GL/glext.h:3180
+# NV_occlusion_query (GL/glext.h:3183)
+GL_PIXEL_COUNTER_BITS_NV = 34916 # GL/glext.h:3184
+GL_CURRENT_OCCLUSION_QUERY_ID_NV = 34917 # GL/glext.h:3185
+GL_PIXEL_COUNT_NV = 34918 # GL/glext.h:3186
+GL_PIXEL_COUNT_AVAILABLE_NV = 34919 # GL/glext.h:3187
+# NV_point_sprite (GL/glext.h:3190)
+GL_POINT_SPRITE_NV = 34913 # GL/glext.h:3191
+GL_COORD_REPLACE_NV = 34914 # GL/glext.h:3192
+GL_POINT_SPRITE_R_MODE_NV = 34915 # GL/glext.h:3193
+# NV_texture_shader3 (GL/glext.h:3196)
+GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV = 34896 # GL/glext.h:3197
+GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV = 34897 # GL/glext.h:3198
+GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV = 34898 # GL/glext.h:3199
+GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV = 34899 # GL/glext.h:3200
+GL_OFFSET_HILO_TEXTURE_2D_NV = 34900 # GL/glext.h:3201
+GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV = 34901 # GL/glext.h:3202
+GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV = 34902 # GL/glext.h:3203
+GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV = 34903 # GL/glext.h:3204
+GL_DEPENDENT_HILO_TEXTURE_2D_NV = 34904 # GL/glext.h:3205
+GL_DEPENDENT_RGB_TEXTURE_3D_NV = 34905 # GL/glext.h:3206
+GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV = 34906 # GL/glext.h:3207
+GL_DOT_PRODUCT_PASS_THROUGH_NV = 34907 # GL/glext.h:3208
+GL_DOT_PRODUCT_TEXTURE_1D_NV = 34908 # GL/glext.h:3209
+GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV = 34909 # GL/glext.h:3210
+GL_HILO8_NV = 34910 # GL/glext.h:3211
+GL_SIGNED_HILO8_NV = 34911 # GL/glext.h:3212
+GL_FORCE_BLUE_TO_ONE_NV = 34912 # GL/glext.h:3213
+# NV_vertex_program1_1 (GL/glext.h:3216)
+# EXT_shadow_funcs (GL/glext.h:3219)
+# EXT_stencil_two_side (GL/glext.h:3222)
+GL_STENCIL_TEST_TWO_SIDE_EXT = 35088 # GL/glext.h:3223
+GL_ACTIVE_STENCIL_FACE_EXT = 35089 # GL/glext.h:3224
+# ATI_text_fragment_shader (GL/glext.h:3227)
+GL_TEXT_FRAGMENT_SHADER_ATI = 33280 # GL/glext.h:3228
+# APPLE_client_storage (GL/glext.h:3231)
+GL_UNPACK_CLIENT_STORAGE_APPLE = 34226 # GL/glext.h:3232
+# APPLE_element_array (GL/glext.h:3235)
+GL_ELEMENT_ARRAY_APPLE = 34664 # GL/glext.h:3236
+GL_ELEMENT_ARRAY_TYPE_APPLE = 34665 # GL/glext.h:3237
+GL_ELEMENT_ARRAY_POINTER_APPLE = 34666 # GL/glext.h:3238
+# APPLE_fence (GL/glext.h:3241)
+GL_DRAW_PIXELS_APPLE = 35338 # GL/glext.h:3242
+GL_FENCE_APPLE = 35339 # GL/glext.h:3243
+# APPLE_vertex_array_object (GL/glext.h:3246)
+GL_VERTEX_ARRAY_BINDING_APPLE = 34229 # GL/glext.h:3247
+# APPLE_vertex_array_range (GL/glext.h:3250)
+GL_VERTEX_ARRAY_RANGE_APPLE = 34077 # GL/glext.h:3251
+GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE = 34078 # GL/glext.h:3252
+GL_VERTEX_ARRAY_STORAGE_HINT_APPLE = 34079 # GL/glext.h:3253
+GL_VERTEX_ARRAY_RANGE_POINTER_APPLE = 34081 # GL/glext.h:3254
+GL_STORAGE_CACHED_APPLE = 34238 # GL/glext.h:3255
+GL_STORAGE_SHARED_APPLE = 34239 # GL/glext.h:3256
+# APPLE_ycbcr_422 (GL/glext.h:3259)
+GL_YCBCR_422_APPLE = 34233 # GL/glext.h:3260
+GL_UNSIGNED_SHORT_8_8_APPLE = 34234 # GL/glext.h:3261
+GL_UNSIGNED_SHORT_8_8_REV_APPLE = 34235 # GL/glext.h:3262
+# S3_s3tc (GL/glext.h:3265)
+GL_RGB_S3TC = 33696 # GL/glext.h:3266
+GL_RGB4_S3TC = 33697 # GL/glext.h:3267
+GL_RGBA_S3TC = 33698 # GL/glext.h:3268
+GL_RGBA4_S3TC = 33699 # GL/glext.h:3269
+# ATI_draw_buffers (GL/glext.h:3272)
+GL_MAX_DRAW_BUFFERS_ATI = 34852 # GL/glext.h:3273
+GL_DRAW_BUFFER0_ATI = 34853 # GL/glext.h:3274
+GL_DRAW_BUFFER1_ATI = 34854 # GL/glext.h:3275
+GL_DRAW_BUFFER2_ATI = 34855 # GL/glext.h:3276
+GL_DRAW_BUFFER3_ATI = 34856 # GL/glext.h:3277
+GL_DRAW_BUFFER4_ATI = 34857 # GL/glext.h:3278
+GL_DRAW_BUFFER5_ATI = 34858 # GL/glext.h:3279
+GL_DRAW_BUFFER6_ATI = 34859 # GL/glext.h:3280
+GL_DRAW_BUFFER7_ATI = 34860 # GL/glext.h:3281
+GL_DRAW_BUFFER8_ATI = 34861 # GL/glext.h:3282
+GL_DRAW_BUFFER9_ATI = 34862 # GL/glext.h:3283
+GL_DRAW_BUFFER10_ATI = 34863 # GL/glext.h:3284
+GL_DRAW_BUFFER11_ATI = 34864 # GL/glext.h:3285
+GL_DRAW_BUFFER12_ATI = 34865 # GL/glext.h:3286
+GL_DRAW_BUFFER13_ATI = 34866 # GL/glext.h:3287
+GL_DRAW_BUFFER14_ATI = 34867 # GL/glext.h:3288
+GL_DRAW_BUFFER15_ATI = 34868 # GL/glext.h:3289
+# ATI_pixel_format_float (GL/glext.h:3292)
+GL_TYPE_RGBA_FLOAT_ATI = 34848 # GL/glext.h:3293
+GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI = 34869 # GL/glext.h:3294
+# ATI_texture_env_combine3 (GL/glext.h:3297)
+GL_MODULATE_ADD_ATI = 34628 # GL/glext.h:3298
+GL_MODULATE_SIGNED_ADD_ATI = 34629 # GL/glext.h:3299
+GL_MODULATE_SUBTRACT_ATI = 34630 # GL/glext.h:3300
+# ATI_texture_float (GL/glext.h:3303)
+GL_RGBA_FLOAT32_ATI = 34836 # GL/glext.h:3304
+GL_RGB_FLOAT32_ATI = 34837 # GL/glext.h:3305
+GL_ALPHA_FLOAT32_ATI = 34838 # GL/glext.h:3306
+GL_INTENSITY_FLOAT32_ATI = 34839 # GL/glext.h:3307
+GL_LUMINANCE_FLOAT32_ATI = 34840 # GL/glext.h:3308
+GL_LUMINANCE_ALPHA_FLOAT32_ATI = 34841 # GL/glext.h:3309
+GL_RGBA_FLOAT16_ATI = 34842 # GL/glext.h:3310
+GL_RGB_FLOAT16_ATI = 34843 # GL/glext.h:3311
+GL_ALPHA_FLOAT16_ATI = 34844 # GL/glext.h:3312
+GL_INTENSITY_FLOAT16_ATI = 34845 # GL/glext.h:3313
+GL_LUMINANCE_FLOAT16_ATI = 34846 # GL/glext.h:3314
+GL_LUMINANCE_ALPHA_FLOAT16_ATI = 34847 # GL/glext.h:3315
+# NV_float_buffer (GL/glext.h:3318)
+GL_FLOAT_R_NV = 34944 # GL/glext.h:3319
+GL_FLOAT_RG_NV = 34945 # GL/glext.h:3320
+GL_FLOAT_RGB_NV = 34946 # GL/glext.h:3321
+GL_FLOAT_RGBA_NV = 34947 # GL/glext.h:3322
+GL_FLOAT_R16_NV = 34948 # GL/glext.h:3323
+GL_FLOAT_R32_NV = 34949 # GL/glext.h:3324
+GL_FLOAT_RG16_NV = 34950 # GL/glext.h:3325
+GL_FLOAT_RG32_NV = 34951 # GL/glext.h:3326
+GL_FLOAT_RGB16_NV = 34952 # GL/glext.h:3327
+GL_FLOAT_RGB32_NV = 34953 # GL/glext.h:3328
+GL_FLOAT_RGBA16_NV = 34954 # GL/glext.h:3329
+GL_FLOAT_RGBA32_NV = 34955 # GL/glext.h:3330
+GL_TEXTURE_FLOAT_COMPONENTS_NV = 34956 # GL/glext.h:3331
+GL_FLOAT_CLEAR_COLOR_VALUE_NV = 34957 # GL/glext.h:3332
+GL_FLOAT_RGBA_MODE_NV = 34958 # GL/glext.h:3333
+# NV_fragment_program (GL/glext.h:3336)
+GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV = 34920 # GL/glext.h:3337
+GL_FRAGMENT_PROGRAM_NV = 34928 # GL/glext.h:3338
+GL_MAX_TEXTURE_COORDS_NV = 34929 # GL/glext.h:3339
+GL_MAX_TEXTURE_IMAGE_UNITS_NV = 34930 # GL/glext.h:3340
+GL_FRAGMENT_PROGRAM_BINDING_NV = 34931 # GL/glext.h:3341
+GL_PROGRAM_ERROR_STRING_NV = 34932 # GL/glext.h:3342
+# NV_half_float (GL/glext.h:3345)
+GL_HALF_FLOAT_NV = 5131 # GL/glext.h:3346
+# NV_pixel_data_range (GL/glext.h:3349)
+GL_WRITE_PIXEL_DATA_RANGE_NV = 34936 # GL/glext.h:3350
+GL_READ_PIXEL_DATA_RANGE_NV = 34937 # GL/glext.h:3351
+GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV = 34938 # GL/glext.h:3352
+GL_READ_PIXEL_DATA_RANGE_LENGTH_NV = 34939 # GL/glext.h:3353
+GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV = 34940 # GL/glext.h:3354
+GL_READ_PIXEL_DATA_RANGE_POINTER_NV = 34941 # GL/glext.h:3355
+# NV_primitive_restart (GL/glext.h:3358)
+GL_PRIMITIVE_RESTART_NV = 34136 # GL/glext.h:3359
+GL_PRIMITIVE_RESTART_INDEX_NV = 34137 # GL/glext.h:3360
+# NV_texture_expand_normal (GL/glext.h:3363)
+GL_TEXTURE_UNSIGNED_REMAP_MODE_NV = 34959 # GL/glext.h:3364
+# NV_vertex_program2 (GL/glext.h:3367)
+# ATI_map_object_buffer (GL/glext.h:3370)
+# ATI_separate_stencil (GL/glext.h:3373)
+GL_STENCIL_BACK_FUNC_ATI = 34816 # GL/glext.h:3374
+GL_STENCIL_BACK_FAIL_ATI = 34817 # GL/glext.h:3375
+GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI = 34818 # GL/glext.h:3376
+GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI = 34819 # GL/glext.h:3377
+# ATI_vertex_attrib_array_object (GL/glext.h:3380)
+# OES_read_format (GL/glext.h:3383)
+GL_IMPLEMENTATION_COLOR_READ_TYPE_OES = 35738 # GL/glext.h:3384
+GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES = 35739 # GL/glext.h:3385
+# EXT_depth_bounds_test (GL/glext.h:3388)
+GL_DEPTH_BOUNDS_TEST_EXT = 34960 # GL/glext.h:3389
+GL_DEPTH_BOUNDS_EXT = 34961 # GL/glext.h:3390
+# EXT_texture_mirror_clamp (GL/glext.h:3393)
+GL_MIRROR_CLAMP_EXT = 34626 # GL/glext.h:3394
+GL_MIRROR_CLAMP_TO_EDGE_EXT = 34627 # GL/glext.h:3395
+GL_MIRROR_CLAMP_TO_BORDER_EXT = 35090 # GL/glext.h:3396
+# EXT_blend_equation_separate (GL/glext.h:3399)
+GL_BLEND_EQUATION_RGB_EXT = 32777 # GL/glext.h:3400
+GL_BLEND_EQUATION_ALPHA_EXT = 34877 # GL/glext.h:3401
+# MESA_pack_invert (GL/glext.h:3404)
+GL_PACK_INVERT_MESA = 34648 # GL/glext.h:3405
+# MESA_ycbcr_texture (GL/glext.h:3408)
+GL_UNSIGNED_SHORT_8_8_MESA = 34234 # GL/glext.h:3409
+GL_UNSIGNED_SHORT_8_8_REV_MESA = 34235 # GL/glext.h:3410
+GL_YCBCR_MESA = 34647 # GL/glext.h:3411
+# EXT_pixel_buffer_object (GL/glext.h:3414)
+GL_PIXEL_PACK_BUFFER_EXT = 35051 # GL/glext.h:3415
+GL_PIXEL_UNPACK_BUFFER_EXT = 35052 # GL/glext.h:3416
+GL_PIXEL_PACK_BUFFER_BINDING_EXT = 35053 # GL/glext.h:3417
+GL_PIXEL_UNPACK_BUFFER_BINDING_EXT = 35055 # GL/glext.h:3418
+# NV_fragment_program_option (GL/glext.h:3421)
+# NV_fragment_program2 (GL/glext.h:3424)
+GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV = 35060 # GL/glext.h:3425
+GL_MAX_PROGRAM_CALL_DEPTH_NV = 35061 # GL/glext.h:3426
+GL_MAX_PROGRAM_IF_DEPTH_NV = 35062 # GL/glext.h:3427
+GL_MAX_PROGRAM_LOOP_DEPTH_NV = 35063 # GL/glext.h:3428
+GL_MAX_PROGRAM_LOOP_COUNT_NV = 35064 # GL/glext.h:3429
+# NV_vertex_program2_option (GL/glext.h:3432)
+# NV_vertex_program3 (GL/glext.h:3437)
+# EXT_framebuffer_object (GL/glext.h:3441)
+GL_INVALID_FRAMEBUFFER_OPERATION_EXT = 1286 # GL/glext.h:3442
+GL_MAX_RENDERBUFFER_SIZE_EXT = 34024 # GL/glext.h:3443
+GL_FRAMEBUFFER_BINDING_EXT = 36006 # GL/glext.h:3444
+GL_RENDERBUFFER_BINDING_EXT = 36007 # GL/glext.h:3445
+GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT = 36048 # GL/glext.h:3446
+GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT = 36049 # GL/glext.h:3447
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT = 36050 # GL/glext.h:3448
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT = 36051 # GL/glext.h:3449
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT = 36052 # GL/glext.h:3450
+GL_FRAMEBUFFER_COMPLETE_EXT = 36053 # GL/glext.h:3451
+GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT = 36054 # GL/glext.h:3452
+GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT = 36055 # GL/glext.h:3453
+GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT = 36056 # GL/glext.h:3454
+GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT = 36057 # GL/glext.h:3455
+GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT = 36058 # GL/glext.h:3456
+GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT = 36059 # GL/glext.h:3457
+GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT = 36060 # GL/glext.h:3458
+GL_FRAMEBUFFER_UNSUPPORTED_EXT = 36061 # GL/glext.h:3459
+GL_MAX_COLOR_ATTACHMENTS_EXT = 36063 # GL/glext.h:3460
+GL_COLOR_ATTACHMENT0_EXT = 36064 # GL/glext.h:3461
+GL_COLOR_ATTACHMENT1_EXT = 36065 # GL/glext.h:3462
+GL_COLOR_ATTACHMENT2_EXT = 36066 # GL/glext.h:3463
+GL_COLOR_ATTACHMENT3_EXT = 36067 # GL/glext.h:3464
+GL_COLOR_ATTACHMENT4_EXT = 36068 # GL/glext.h:3465
+GL_COLOR_ATTACHMENT5_EXT = 36069 # GL/glext.h:3466
+GL_COLOR_ATTACHMENT6_EXT = 36070 # GL/glext.h:3467
+GL_COLOR_ATTACHMENT7_EXT = 36071 # GL/glext.h:3468
+GL_COLOR_ATTACHMENT8_EXT = 36072 # GL/glext.h:3469
+GL_COLOR_ATTACHMENT9_EXT = 36073 # GL/glext.h:3470
+GL_COLOR_ATTACHMENT10_EXT = 36074 # GL/glext.h:3471
+GL_COLOR_ATTACHMENT11_EXT = 36075 # GL/glext.h:3472
+GL_COLOR_ATTACHMENT12_EXT = 36076 # GL/glext.h:3473
+GL_COLOR_ATTACHMENT13_EXT = 36077 # GL/glext.h:3474
+GL_COLOR_ATTACHMENT14_EXT = 36078 # GL/glext.h:3475
+GL_COLOR_ATTACHMENT15_EXT = 36079 # GL/glext.h:3476
+GL_DEPTH_ATTACHMENT_EXT = 36096 # GL/glext.h:3477
+GL_STENCIL_ATTACHMENT_EXT = 36128 # GL/glext.h:3478
+GL_FRAMEBUFFER_EXT = 36160 # GL/glext.h:3479
+GL_RENDERBUFFER_EXT = 36161 # GL/glext.h:3480
+GL_RENDERBUFFER_WIDTH_EXT = 36162 # GL/glext.h:3481
+GL_RENDERBUFFER_HEIGHT_EXT = 36163 # GL/glext.h:3482
+GL_RENDERBUFFER_INTERNAL_FORMAT_EXT = 36164 # GL/glext.h:3483
+GL_STENCIL_INDEX_EXT = 36165 # GL/glext.h:3484
+GL_STENCIL_INDEX1_EXT = 36166 # GL/glext.h:3485
+GL_STENCIL_INDEX4_EXT = 36167 # GL/glext.h:3486
+GL_STENCIL_INDEX8_EXT = 36168 # GL/glext.h:3487
+GL_STENCIL_INDEX16_EXT = 36169 # GL/glext.h:3488
+GL_RENDERBUFFER_RED_SIZE_EXT = 36176 # GL/glext.h:3489
+GL_RENDERBUFFER_GREEN_SIZE_EXT = 36177 # GL/glext.h:3490
+GL_RENDERBUFFER_BLUE_SIZE_EXT = 36178 # GL/glext.h:3491
+GL_RENDERBUFFER_ALPHA_SIZE_EXT = 36179 # GL/glext.h:3492
+GL_RENDERBUFFER_DEPTH_SIZE_EXT = 36180 # GL/glext.h:3493
+GL_RENDERBUFFER_STENCIL_SIZE_EXT = 36181 # GL/glext.h:3494
+# GREMEDY_string_marker (GL/glext.h:3497)
+# EXT_Cg_shader (GL/glext.h:3500)
+GL_CG_VERTEX_SHADER_EXT = 35086 # GL/glext.h:3501
+GL_CG_FRAGMENT_SHADER_EXT = 35087 # GL/glext.h:3502
+# EXT_timer_query (GL/glext.h:3505)
+GL_TIME_ELAPSED_EXT = 35007 # GL/glext.h:3506
+# EXT_texture_buffer_object (GL/glext.h:3509)
+GL_TEXTURE_BUFFER_EXT = 35882 # GL/glext.h:3510
+GL_MAX_TEXTURE_BUFFER_SIZE_EXT = 35883 # GL/glext.h:3511
+GL_TEXTURE_BINDING_BUFFER_EXT = 35884 # GL/glext.h:3512
+GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT = 35885 # GL/glext.h:3513
+GL_TEXTURE_BUFFER_FORMAT_EXT = 35886 # GL/glext.h:3514
+# EXT_gpu_shader4 (GL/glext.h:3517)
+GL_SAMPLER_1D_ARRAY_EXT = 36288 # GL/glext.h:3518
+GL_SAMPLER_2D_ARRAY_EXT = 36289 # GL/glext.h:3519
+GL_SAMPLER_BUFFER_EXT = 36290 # GL/glext.h:3520
+GL_SAMPLER_1D_ARRAY_SHADOW_EXT = 36291 # GL/glext.h:3521
+GL_SAMPLER_2D_ARRAY_SHADOW_EXT = 36292 # GL/glext.h:3522
+GL_SAMPLER_CUBE_SHADOW_EXT = 36293 # GL/glext.h:3523
+GL_UNSIGNED_INT_VEC2_EXT = 36294 # GL/glext.h:3524
+GL_UNSIGNED_INT_VEC3_EXT = 36295 # GL/glext.h:3525
+GL_UNSIGNED_INT_VEC4_EXT = 36296 # GL/glext.h:3526
+GL_INT_SAMPLER_1D_EXT = 36297 # GL/glext.h:3527
+GL_INT_SAMPLER_2D_EXT = 36298 # GL/glext.h:3528
+GL_INT_SAMPLER_3D_EXT = 36299 # GL/glext.h:3529
+GL_INT_SAMPLER_CUBE_EXT = 36300 # GL/glext.h:3530
+GL_INT_SAMPLER_2D_RECT_EXT = 36301 # GL/glext.h:3531
+GL_INT_SAMPLER_1D_ARRAY_EXT = 36302 # GL/glext.h:3532
+GL_INT_SAMPLER_2D_ARRAY_EXT = 36303 # GL/glext.h:3533
+GL_INT_SAMPLER_BUFFER_EXT = 36304 # GL/glext.h:3534
+GL_UNSIGNED_INT_SAMPLER_1D_EXT = 36305 # GL/glext.h:3535
+GL_UNSIGNED_INT_SAMPLER_2D_EXT = 36306 # GL/glext.h:3536
+GL_UNSIGNED_INT_SAMPLER_3D_EXT = 36307 # GL/glext.h:3537
+GL_UNSIGNED_INT_SAMPLER_CUBE_EXT = 36308 # GL/glext.h:3538
+GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT = 36309 # GL/glext.h:3539
+GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT = 36310 # GL/glext.h:3540
+GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT = 36311 # GL/glext.h:3541
+GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT = 36312 # GL/glext.h:3542
+GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT = 35069 # GL/glext.h:3543
+# EXT_geometry_shader4 (GL/glext.h:3546)
+GL_GEOMETRY_SHADER_EXT = 36313 # GL/glext.h:3547
+GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT = 36317 # GL/glext.h:3548
+GL_MAX_VERTEX_VARYING_COMPONENTS_EXT = 36318 # GL/glext.h:3549
+GL_MAX_VARYING_COMPONENTS_EXT = 35659 # GL/glext.h:3550
+GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT = 36319 # GL/glext.h:3551
+GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT = 36320 # GL/glext.h:3552
+GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT = 36321 # GL/glext.h:3553
+GL_GEOMETRY_VERTICES_OUT_EXT = 36314 # GL/glext.h:3554
+GL_GEOMETRY_INPUT_TYPE_EXT = 36315 # GL/glext.h:3555
+GL_GEOMETRY_OUTPUT_TYPE_EXT = 36316 # GL/glext.h:3556
+GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT = 35881 # GL/glext.h:3557
+GL_LINES_ADJACENCY_EXT = 10 # GL/glext.h:3558
+GL_LINE_STRIP_ADJACENCY_EXT = 11 # GL/glext.h:3559
+GL_TRIANGLES_ADJACENCY_EXT = 12 # GL/glext.h:3560
+GL_TRIANGLE_STRIP_ADJACENCY_EXT = 13 # GL/glext.h:3561
+GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT = 36263 # GL/glext.h:3562
+GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT = 36264 # GL/glext.h:3563
+GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT = 36265 # GL/glext.h:3564
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT = 36052 # GL/glext.h:3565
+GL_PROGRAM_POINT_SIZE_EXT = 34370 # GL/glext.h:3566
+# EXT_bindable_uniform (GL/glext.h:3569)
+GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT = 36322 # GL/glext.h:3570
+GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT = 36323 # GL/glext.h:3571
+GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT = 36324 # GL/glext.h:3572
+GL_MAX_BINDABLE_UNIFORM_SIZE_EXT = 36333 # GL/glext.h:3573
+GL_UNIFORM_BUFFER_EXT = 36334 # GL/glext.h:3574
+GL_UNIFORM_BUFFER_BINDING_EXT = 36335 # GL/glext.h:3575
+# EXT_framebuffer_sRGB (GL/glext.h:3578)
+GL_FRAMEBUFFER_SRGB_EXT = 36281 # GL/glext.h:3579
+GL_FRAMEBUFFER_SRGB_CAPABLE_EXT = 36282 # GL/glext.h:3580
+# EXT_texture_shared_exponent (GL/glext.h:3583)
+GL_RGB9_E5_EXT = 35901 # GL/glext.h:3584
+GL_UNSIGNED_INT_5_9_9_9_REV_EXT = 35902 # GL/glext.h:3585
+GL_TEXTURE_SHARED_SIZE_EXT = 35903 # GL/glext.h:3586
+# EXT_packed_float (GL/glext.h:3589)
+GL_R11F_G11F_B10F_EXT = 35898 # GL/glext.h:3590
+GL_UNSIGNED_INT_10F_11F_11F_REV_EXT = 35899 # GL/glext.h:3591
+GL_RGBA_SIGNED_COMPONENTS_EXT = 35900 # GL/glext.h:3592
+# EXT_texture_array (GL/glext.h:3595)
+GL_TEXTURE_1D_ARRAY_EXT = 35864 # GL/glext.h:3596
+GL_PROXY_TEXTURE_1D_ARRAY_EXT = 35865 # GL/glext.h:3597
+GL_TEXTURE_2D_ARRAY_EXT = 35866 # GL/glext.h:3598
+GL_PROXY_TEXTURE_2D_ARRAY_EXT = 35867 # GL/glext.h:3599
+GL_TEXTURE_BINDING_1D_ARRAY_EXT = 35868 # GL/glext.h:3600
+GL_TEXTURE_BINDING_2D_ARRAY_EXT = 35869 # GL/glext.h:3601
+GL_MAX_ARRAY_TEXTURE_LAYERS_EXT = 35071 # GL/glext.h:3602
+GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT = 34894 # GL/glext.h:3603
+# EXT_texture_integer (GL/glext.h:3607)
+GL_RGBA32UI_EXT = 36208 # GL/glext.h:3608
+GL_RGB32UI_EXT = 36209 # GL/glext.h:3609
+GL_ALPHA32UI_EXT = 36210 # GL/glext.h:3610
+GL_INTENSITY32UI_EXT = 36211 # GL/glext.h:3611
+GL_LUMINANCE32UI_EXT = 36212 # GL/glext.h:3612
+GL_LUMINANCE_ALPHA32UI_EXT = 36213 # GL/glext.h:3613
+GL_RGBA16UI_EXT = 36214 # GL/glext.h:3614
+GL_RGB16UI_EXT = 36215 # GL/glext.h:3615
+GL_ALPHA16UI_EXT = 36216 # GL/glext.h:3616
+GL_INTENSITY16UI_EXT = 36217 # GL/glext.h:3617
+GL_LUMINANCE16UI_EXT = 36218 # GL/glext.h:3618
+GL_LUMINANCE_ALPHA16UI_EXT = 36219 # GL/glext.h:3619
+GL_RGBA8UI_EXT = 36220 # GL/glext.h:3620
+GL_RGB8UI_EXT = 36221 # GL/glext.h:3621
+GL_ALPHA8UI_EXT = 36222 # GL/glext.h:3622
+GL_INTENSITY8UI_EXT = 36223 # GL/glext.h:3623
+GL_LUMINANCE8UI_EXT = 36224 # GL/glext.h:3624
+GL_LUMINANCE_ALPHA8UI_EXT = 36225 # GL/glext.h:3625
+GL_RGBA32I_EXT = 36226 # GL/glext.h:3626
+GL_RGB32I_EXT = 36227 # GL/glext.h:3627
+GL_ALPHA32I_EXT = 36228 # GL/glext.h:3628
+GL_INTENSITY32I_EXT = 36229 # GL/glext.h:3629
+GL_LUMINANCE32I_EXT = 36230 # GL/glext.h:3630
+GL_LUMINANCE_ALPHA32I_EXT = 36231 # GL/glext.h:3631
+GL_RGBA16I_EXT = 36232 # GL/glext.h:3632
+GL_RGB16I_EXT = 36233 # GL/glext.h:3633
+GL_ALPHA16I_EXT = 36234 # GL/glext.h:3634
+GL_INTENSITY16I_EXT = 36235 # GL/glext.h:3635
+GL_LUMINANCE16I_EXT = 36236 # GL/glext.h:3636
+GL_LUMINANCE_ALPHA16I_EXT = 36237 # GL/glext.h:3637
+GL_RGBA8I_EXT = 36238 # GL/glext.h:3638
+GL_RGB8I_EXT = 36239 # GL/glext.h:3639
+GL_ALPHA8I_EXT = 36240 # GL/glext.h:3640
+GL_INTENSITY8I_EXT = 36241 # GL/glext.h:3641
+GL_LUMINANCE8I_EXT = 36242 # GL/glext.h:3642
+GL_LUMINANCE_ALPHA8I_EXT = 36243 # GL/glext.h:3643
+GL_RED_INTEGER_EXT = 36244 # GL/glext.h:3644
+GL_GREEN_INTEGER_EXT = 36245 # GL/glext.h:3645
+GL_BLUE_INTEGER_EXT = 36246 # GL/glext.h:3646
+GL_ALPHA_INTEGER_EXT = 36247 # GL/glext.h:3647
+GL_RGB_INTEGER_EXT = 36248 # GL/glext.h:3648
+GL_RGBA_INTEGER_EXT = 36249 # GL/glext.h:3649
+GL_BGR_INTEGER_EXT = 36250 # GL/glext.h:3650
+GL_BGRA_INTEGER_EXT = 36251 # GL/glext.h:3651
+GL_LUMINANCE_INTEGER_EXT = 36252 # GL/glext.h:3652
+GL_LUMINANCE_ALPHA_INTEGER_EXT = 36253 # GL/glext.h:3653
+GL_RGBA_INTEGER_MODE_EXT = 36254 # GL/glext.h:3654
+# NV_depth_buffer_float (GL/glext.h:3657)
+GL_DEPTH_COMPONENT32F_NV = 36267 # GL/glext.h:3658
+GL_DEPTH32F_STENCIL8_NV = 36268 # GL/glext.h:3659
+GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV = 36269 # GL/glext.h:3660
+GL_DEPTH_BUFFER_FLOAT_MODE_NV = 36271 # GL/glext.h:3661
+# EXT_texture_compression_latc (GL/glext.h:3664)
+GL_COMPRESSED_LUMINANCE_LATC1_EXT = 35952 # GL/glext.h:3665
+GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT = 35953 # GL/glext.h:3666
+GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT = 35954 # GL/glext.h:3667
+GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT = 35955 # GL/glext.h:3668
+# NV_transform_feedback (GL/glext.h:3671)
+GL_BACK_PRIMARY_COLOR_NV = 35959 # GL/glext.h:3672
+GL_BACK_SECONDARY_COLOR_NV = 35960 # GL/glext.h:3673
+GL_TEXTURE_COORD_NV = 35961 # GL/glext.h:3674
+GL_CLIP_DISTANCE_NV = 35962 # GL/glext.h:3675
+GL_VERTEX_ID_NV = 35963 # GL/glext.h:3676
+GL_PRIMITIVE_ID_NV = 35964 # GL/glext.h:3677
+GL_GENERIC_ATTRIB_NV = 35965 # GL/glext.h:3678
+GL_TRANSFORM_FEEDBACK_ATTRIBS_NV = 35966 # GL/glext.h:3679
+GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV = 35967 # GL/glext.h:3680
+GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV = 35968 # GL/glext.h:3681
+GL_ACTIVE_VARYINGS_NV = 35969 # GL/glext.h:3682
+GL_ACTIVE_VARYING_MAX_LENGTH_NV = 35970 # GL/glext.h:3683
+GL_TRANSFORM_FEEDBACK_VARYINGS_NV = 35971 # GL/glext.h:3684
+GL_TRANSFORM_FEEDBACK_BUFFER_START_NV = 35972 # GL/glext.h:3685
+GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV = 35973 # GL/glext.h:3686
+GL_TRANSFORM_FEEDBACK_RECORD_NV = 35974 # GL/glext.h:3687
+GL_PRIMITIVES_GENERATED_NV = 35975 # GL/glext.h:3688
+GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV = 35976 # GL/glext.h:3689
+GL_RASTERIZER_DISCARD_NV = 35977 # GL/glext.h:3690
+GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_ATTRIBS_NV = 35978 # GL/glext.h:3691
+GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV = 35979 # GL/glext.h:3692
+GL_INTERLEAVED_ATTRIBS_NV = 35980 # GL/glext.h:3693
+GL_SEPARATE_ATTRIBS_NV = 35981 # GL/glext.h:3694
+GL_TRANSFORM_FEEDBACK_BUFFER_NV = 35982 # GL/glext.h:3695
+GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV = 35983 # GL/glext.h:3696
+# NV_geometry_program4 (GL/glext.h:3699)
+GL_GEOMETRY_PROGRAM_NV = 35878 # GL/glext.h:3700
+GL_MAX_PROGRAM_OUTPUT_VERTICES_NV = 35879 # GL/glext.h:3701
+GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV = 35880 # GL/glext.h:3702
+# NV_gpu_program4 (GL/glext.h:3705)
+GL_MIN_PROGRAM_TEXEL_OFFSET_NV = 35076 # GL/glext.h:3706
+GL_MAX_PROGRAM_TEXEL_OFFSET_NV = 35077 # GL/glext.h:3707
+GL_PROGRAM_ATTRIB_COMPONENTS_NV = 35078 # GL/glext.h:3708
+GL_PROGRAM_RESULT_COMPONENTS_NV = 35079 # GL/glext.h:3709
+GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV = 35080 # GL/glext.h:3710
+GL_MAX_PROGRAM_RESULT_COMPONENTS_NV = 35081 # GL/glext.h:3711
+GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV = 36261 # GL/glext.h:3712
+GL_MAX_PROGRAM_GENERIC_RESULTS_NV = 36262 # GL/glext.h:3713
+GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV = 36256 # GL/glext.h:3717
+GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV = 36257 # GL/glext.h:3718
+GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV = 36258 # GL/glext.h:3719
+GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV = 36259 # GL/glext.h:3720
+GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV = 36260 # GL/glext.h:3721
+# NV_framebuffer_multisample_coverage (GL/glext.h:3724)
+GL_RENDERBUFFER_COVERAGE_SAMPLES_NV = 36011 # GL/glext.h:3725
+GL_RENDERBUFFER_COLOR_SAMPLES_NV = 36368 # GL/glext.h:3726
+GL_MAX_RENDERBUFFER_COVERAGE_SAMPLES_NV = 36183 # GL/glext.h:3727
+GL_MAX_RENDERBUFFER_COLOR_SAMPLES_NV = 36369 # GL/glext.h:3728
+GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV = 36370 # GL/glext.h:3729
+GL_MULTISAMPLE_COVERAGE_MODES_NV = 36371 # GL/glext.h:3730
+# EXT_framebuffer_multisample (GL/glext.h:3733)
+GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT = 36182 # GL/glext.h:3734
+GL_MAX_SAMPLES_EXT = 36183 # GL/glext.h:3735
+GL_RENDERBUFFER_SAMPLES_EXT = 36011 # GL/glext.h:3736
+# EXT_framebuffer_blit (GL/glext.h:3739)
+GL_READ_FRAMEBUFFER_EXT = 36008 # GL/glext.h:3740
+GL_DRAW_FRAMEBUFFER_EXT = 36009 # GL/glext.h:3741
+GL_DRAW_FRAMEBUFFER_BINDING_EXT = 36006 # GL/glext.h:3742
+GL_READ_FRAMEBUFFER_BINDING_EXT = 36010 # GL/glext.h:3743
+# EXT_texture_compression_rgtc (GL/glext.h:3746)
+GL_COMPRESSED_RED_RGTC1_EXT = 36283 # GL/glext.h:3747
+GL_COMPRESSED_SIGNED_RED_RGTC1_EXT = 36284 # GL/glext.h:3748
+GL_COMPRESSED_RED_GREEN_RGTC2_EXT = 36285 # GL/glext.h:3749
+GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 36286 # GL/glext.h:3750
+# NV_present_video (GL/glext.h:3753)
+GL_FRAME_NV = 36390 # GL/glext.h:3754
+GL_FIELDS_NV = 36391 # GL/glext.h:3755
+GL_CURRENT_TIME_NV = 36392 # GL/glext.h:3756
+GL_NUM_FILL_STREAMS_NV = 36393 # GL/glext.h:3757
+GL_PRESENT_TIME_NV = 36394 # GL/glext.h:3758
+GL_PRESENT_DURATION_NV = 36395 # GL/glext.h:3759
+# NV_conditional_render (GL/glext.h:3762)
+GL_QUERY_WAIT_NV = 36371 # GL/glext.h:3763
+GL_QUERY_NO_WAIT_NV = 36372 # GL/glext.h:3764
+GL_QUERY_BY_REGION_WAIT_NV = 36373 # GL/glext.h:3765
+GL_QUERY_BY_REGION_NO_WAIT_NV = 36374 # GL/glext.h:3766
+# EXT_transform_feedback (GL/glext.h:3769)
+GL_TRANSFORM_FEEDBACK_BUFFER_EXT = 35982 # GL/glext.h:3770
+GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT = 35972 # GL/glext.h:3771
+GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT = 35973 # GL/glext.h:3772
+GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT = 35983 # GL/glext.h:3773
+GL_INTERLEAVED_ATTRIBS_EXT = 35980 # GL/glext.h:3774
+GL_SEPARATE_ATTRIBS_EXT = 35981 # GL/glext.h:3775
+GL_PRIMITIVES_GENERATED_EXT = 35975 # GL/glext.h:3776
+GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT = 35976 # GL/glext.h:3777
+GL_RASTERIZER_DISCARD_EXT = 35977 # GL/glext.h:3778
+GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT = 35978 # GL/glext.h:3779
+GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT = 35979 # GL/glext.h:3780
+GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT = 35968 # GL/glext.h:3781
+GL_TRANSFORM_FEEDBACK_VARYINGS_EXT = 35971 # GL/glext.h:3782
+GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT = 35967 # GL/glext.h:3783
+GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT = 35958 # GL/glext.h:3784
+# EXT_direct_state_access (GL/glext.h:3787)
+GL_PROGRAM_MATRIX_EXT = 36397 # GL/glext.h:3788
+GL_TRANSPOSE_PROGRAM_MATRIX_EXT = 36398 # GL/glext.h:3789
+GL_PROGRAM_MATRIX_STACK_DEPTH_EXT = 36399 # GL/glext.h:3790
+# EXT_vertex_array_bgra (GL/glext.h:3793)
+# EXT_texture_swizzle (GL/glext.h:3797)
+GL_TEXTURE_SWIZZLE_R_EXT = 36418 # GL/glext.h:3798
+GL_TEXTURE_SWIZZLE_G_EXT = 36419 # GL/glext.h:3799
+GL_TEXTURE_SWIZZLE_B_EXT = 36420 # GL/glext.h:3800
+GL_TEXTURE_SWIZZLE_A_EXT = 36421 # GL/glext.h:3801
+GL_TEXTURE_SWIZZLE_RGBA_EXT = 36422 # GL/glext.h:3802
+# NV_explicit_multisample (GL/glext.h:3805)
+GL_SAMPLE_POSITION_NV = 36432 # GL/glext.h:3806
+GL_SAMPLE_MASK_NV = 36433 # GL/glext.h:3807
+GL_SAMPLE_MASK_VALUE_NV = 36434 # GL/glext.h:3808
+GL_TEXTURE_BINDING_RENDERBUFFER_NV = 36435 # GL/glext.h:3809
+GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV = 36436 # GL/glext.h:3810
+GL_MAX_SAMPLE_MASK_WORDS_NV = 36441 # GL/glext.h:3811
+GL_TEXTURE_RENDERBUFFER_NV = 36437 # GL/glext.h:3812
+GL_SAMPLER_RENDERBUFFER_NV = 36438 # GL/glext.h:3813
+GL_INT_SAMPLER_RENDERBUFFER_NV = 36439 # GL/glext.h:3814
+GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV = 36440 # GL/glext.h:3815
+# NV_transform_feedback2 (GL/glext.h:3818)
+GL_TRANSFORM_FEEDBACK_NV = 36386 # GL/glext.h:3819
+GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV = 36387 # GL/glext.h:3820
+GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV = 36388 # GL/glext.h:3821
+GL_TRANSFORM_FEEDBACK_BINDING_NV = 36389 # GL/glext.h:3822
+# NV_vertex_buffer_unified_memory (GL/glext.h:3825)
+GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV = 36638 # GL/glext.h:3826
+GL_ELEMENT_ARRAY_UNIFIED_NV = 36639 # GL/glext.h:3827
+GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV = 36640 # GL/glext.h:3828
+GL_VERTEX_ARRAY_ADDRESS_NV = 36641 # GL/glext.h:3829
+GL_NORMAL_ARRAY_ADDRESS_NV = 36642 # GL/glext.h:3830
+GL_COLOR_ARRAY_ADDRESS_NV = 36643 # GL/glext.h:3831
+GL_INDEX_ARRAY_ADDRESS_NV = 36644 # GL/glext.h:3832
+GL_TEXTURE_COORD_ARRAY_ADDRESS_NV = 36645 # GL/glext.h:3833
+GL_EDGE_FLAG_ARRAY_ADDRESS_NV = 36646 # GL/glext.h:3834
+GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV = 36647 # GL/glext.h:3835
+GL_FOG_COORD_ARRAY_ADDRESS_NV = 36648 # GL/glext.h:3836
+GL_ELEMENT_ARRAY_ADDRESS_NV = 36649 # GL/glext.h:3837
+GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV = 36650 # GL/glext.h:3838
+GL_VERTEX_ARRAY_LENGTH_NV = 36651 # GL/glext.h:3839
+GL_NORMAL_ARRAY_LENGTH_NV = 36652 # GL/glext.h:3840
+GL_COLOR_ARRAY_LENGTH_NV = 36653 # GL/glext.h:3841
+GL_INDEX_ARRAY_LENGTH_NV = 36654 # GL/glext.h:3842
+GL_TEXTURE_COORD_ARRAY_LENGTH_NV = 36655 # GL/glext.h:3843
+GL_EDGE_FLAG_ARRAY_LENGTH_NV = 36656 # GL/glext.h:3844
+GL_SECONDARY_COLOR_ARRAY_LENGTH_NV = 36657 # GL/glext.h:3845
+GL_FOG_COORD_ARRAY_LENGTH_NV = 36658 # GL/glext.h:3846
+GL_ELEMENT_ARRAY_LENGTH_NV = 36659 # GL/glext.h:3847
+# NV_shader_buffer_load (GL/glext.h:3850)
+GL_BUFFER_GPU_ADDRESS_NV = 36637 # GL/glext.h:3851
+GL_GPU_ADDRESS_NV = 36660 # GL/glext.h:3852
+GL_MAX_SHADER_BUFFER_ADDRESS_NV = 36661 # GL/glext.h:3853
+# VERSION_2_0 (GL/glext.h:3859)
+GLchar = c_char # GL/glext.h:3861
+# VERSION_1_5 (GL/glext.h:3864)
+GLintptr = c_ptrdiff_t # GL/glext.h:3866
+GLsizeiptr = c_ptrdiff_t # GL/glext.h:3867
+# ARB_vertex_buffer_object (GL/glext.h:3870)
+GLintptrARB = c_ptrdiff_t # GL/glext.h:3872
+GLsizeiptrARB = c_ptrdiff_t # GL/glext.h:3873
+# ARB_shader_objects (GL/glext.h:3876)
+GLcharARB = c_char # GL/glext.h:3878
+GLhandleARB = c_uint # GL/glext.h:3879
+# ARB_half_float_pixel (GL/glext.h:3883)
+GLhalfARB = c_ushort # GL/glext.h:3884
+# NV_half_float (GL/glext.h:3887)
+GLhalfNV = c_ushort # GL/glext.h:3888
+# EXT_timer_query (GL/glext.h:3891)
+GLint64EXT = c_longlong # GL/glext.h:3892
+GLuint64EXT = c_ulonglong # GL/glext.h:3893
+# VERSION_1_2 (GL/glext.h:3896)
+# VERSION_1_3 (GL/glext.h:3978)
+# VERSION_1_4 (GL/glext.h:4076)
+GL_VERSION_1_4 = 1 # GL/glext.h:4077
+GLenum = c_uint # /usr/include/GL/gl.h:149
+# GL/glext.h:4079
+glBlendFuncSeparate = _link_function('glBlendFuncSeparate', None, [GLenum, GLenum, GLenum, GLenum], 'VERSION_1_4')
+
+GLfloat = c_float # /usr/include/GL/gl.h:160
+# GL/glext.h:4080
+glFogCoordf = _link_function('glFogCoordf', None, [GLfloat], 'VERSION_1_4')
+
+# GL/glext.h:4081
+glFogCoordfv = _link_function('glFogCoordfv', None, [POINTER(GLfloat)], 'VERSION_1_4')
+
+GLdouble = c_double # /usr/include/GL/gl.h:162
+# GL/glext.h:4082
+glFogCoordd = _link_function('glFogCoordd', None, [GLdouble], 'VERSION_1_4')
+
+# GL/glext.h:4083
+glFogCoorddv = _link_function('glFogCoorddv', None, [POINTER(GLdouble)], 'VERSION_1_4')
+
+GLsizei = c_int # /usr/include/GL/gl.h:159
+GLvoid = None # /usr/include/GL/gl.h:152
+# GL/glext.h:4084
+glFogCoordPointer = _link_function('glFogCoordPointer', None, [GLenum, GLsizei, POINTER(GLvoid)], 'VERSION_1_4')
+
+GLint = c_int # /usr/include/GL/gl.h:155
+# GL/glext.h:4085
+glMultiDrawArrays = _link_function('glMultiDrawArrays', None, [GLenum, POINTER(GLint), POINTER(GLsizei), GLsizei], 'VERSION_1_4')
+
+# GL/glext.h:4086
+glMultiDrawElements = _link_function('glMultiDrawElements', None, [GLenum, POINTER(GLsizei), GLenum, POINTER(POINTER(GLvoid)), GLsizei], 'VERSION_1_4')
+
+# GL/glext.h:4087
+glPointParameterf = _link_function('glPointParameterf', None, [GLenum, GLfloat], 'VERSION_1_4')
+
+# GL/glext.h:4088
+glPointParameterfv = _link_function('glPointParameterfv', None, [GLenum, POINTER(GLfloat)], 'VERSION_1_4')
+
+# GL/glext.h:4089
+glPointParameteri = _link_function('glPointParameteri', None, [GLenum, GLint], 'VERSION_1_4')
+
+# GL/glext.h:4090
+glPointParameteriv = _link_function('glPointParameteriv', None, [GLenum, POINTER(GLint)], 'VERSION_1_4')
+
+GLbyte = c_char # /usr/include/GL/gl.h:153
+# GL/glext.h:4091
+glSecondaryColor3b = _link_function('glSecondaryColor3b', None, [GLbyte, GLbyte, GLbyte], 'VERSION_1_4')
+
+# GL/glext.h:4092
+glSecondaryColor3bv = _link_function('glSecondaryColor3bv', None, [POINTER(GLbyte)], 'VERSION_1_4')
+
+# GL/glext.h:4093
+glSecondaryColor3d = _link_function('glSecondaryColor3d', None, [GLdouble, GLdouble, GLdouble], 'VERSION_1_4')
+
+# GL/glext.h:4094
+glSecondaryColor3dv = _link_function('glSecondaryColor3dv', None, [POINTER(GLdouble)], 'VERSION_1_4')
+
+# GL/glext.h:4095
+glSecondaryColor3f = _link_function('glSecondaryColor3f', None, [GLfloat, GLfloat, GLfloat], 'VERSION_1_4')
+
+# GL/glext.h:4096
+glSecondaryColor3fv = _link_function('glSecondaryColor3fv', None, [POINTER(GLfloat)], 'VERSION_1_4')
+
+# GL/glext.h:4097
+glSecondaryColor3i = _link_function('glSecondaryColor3i', None, [GLint, GLint, GLint], 'VERSION_1_4')
+
+# GL/glext.h:4098
+glSecondaryColor3iv = _link_function('glSecondaryColor3iv', None, [POINTER(GLint)], 'VERSION_1_4')
+
+GLshort = c_short # /usr/include/GL/gl.h:154
+# GL/glext.h:4099
+glSecondaryColor3s = _link_function('glSecondaryColor3s', None, [GLshort, GLshort, GLshort], 'VERSION_1_4')
+
+# GL/glext.h:4100
+glSecondaryColor3sv = _link_function('glSecondaryColor3sv', None, [POINTER(GLshort)], 'VERSION_1_4')
+
+GLubyte = c_ubyte # /usr/include/GL/gl.h:156
+# GL/glext.h:4101
+glSecondaryColor3ub = _link_function('glSecondaryColor3ub', None, [GLubyte, GLubyte, GLubyte], 'VERSION_1_4')
+
+# GL/glext.h:4102
+glSecondaryColor3ubv = _link_function('glSecondaryColor3ubv', None, [POINTER(GLubyte)], 'VERSION_1_4')
+
+GLuint = c_uint # /usr/include/GL/gl.h:158
+# GL/glext.h:4103
+glSecondaryColor3ui = _link_function('glSecondaryColor3ui', None, [GLuint, GLuint, GLuint], 'VERSION_1_4')
+
+# GL/glext.h:4104
+glSecondaryColor3uiv = _link_function('glSecondaryColor3uiv', None, [POINTER(GLuint)], 'VERSION_1_4')
+
+GLushort = c_ushort # /usr/include/GL/gl.h:157
+# GL/glext.h:4105
+glSecondaryColor3us = _link_function('glSecondaryColor3us', None, [GLushort, GLushort, GLushort], 'VERSION_1_4')
+
+# GL/glext.h:4106
+glSecondaryColor3usv = _link_function('glSecondaryColor3usv', None, [POINTER(GLushort)], 'VERSION_1_4')
+
+# GL/glext.h:4107
+glSecondaryColorPointer = _link_function('glSecondaryColorPointer', None, [GLint, GLenum, GLsizei, POINTER(GLvoid)], 'VERSION_1_4')
+
+# GL/glext.h:4108
+glWindowPos2d = _link_function('glWindowPos2d', None, [GLdouble, GLdouble], 'VERSION_1_4')
+
+# GL/glext.h:4109
+glWindowPos2dv = _link_function('glWindowPos2dv', None, [POINTER(GLdouble)], 'VERSION_1_4')
+
+# GL/glext.h:4110
+glWindowPos2f = _link_function('glWindowPos2f', None, [GLfloat, GLfloat], 'VERSION_1_4')
+
+# GL/glext.h:4111
+glWindowPos2fv = _link_function('glWindowPos2fv', None, [POINTER(GLfloat)], 'VERSION_1_4')
+
+# GL/glext.h:4112
+glWindowPos2i = _link_function('glWindowPos2i', None, [GLint, GLint], 'VERSION_1_4')
+
+# GL/glext.h:4113
+glWindowPos2iv = _link_function('glWindowPos2iv', None, [POINTER(GLint)], 'VERSION_1_4')
+
+# GL/glext.h:4114
+glWindowPos2s = _link_function('glWindowPos2s', None, [GLshort, GLshort], 'VERSION_1_4')
+
+# GL/glext.h:4115
+glWindowPos2sv = _link_function('glWindowPos2sv', None, [POINTER(GLshort)], 'VERSION_1_4')
+
+# GL/glext.h:4116
+glWindowPos3d = _link_function('glWindowPos3d', None, [GLdouble, GLdouble, GLdouble], 'VERSION_1_4')
+
+# GL/glext.h:4117
+glWindowPos3dv = _link_function('glWindowPos3dv', None, [POINTER(GLdouble)], 'VERSION_1_4')
+
+# GL/glext.h:4118
+glWindowPos3f = _link_function('glWindowPos3f', None, [GLfloat, GLfloat, GLfloat], 'VERSION_1_4')
+
+# GL/glext.h:4119
+glWindowPos3fv = _link_function('glWindowPos3fv', None, [POINTER(GLfloat)], 'VERSION_1_4')
+
+# GL/glext.h:4120
+glWindowPos3i = _link_function('glWindowPos3i', None, [GLint, GLint, GLint], 'VERSION_1_4')
+
+# GL/glext.h:4121
+glWindowPos3iv = _link_function('glWindowPos3iv', None, [POINTER(GLint)], 'VERSION_1_4')
+
+# GL/glext.h:4122
+glWindowPos3s = _link_function('glWindowPos3s', None, [GLshort, GLshort, GLshort], 'VERSION_1_4')
+
+# GL/glext.h:4123
+glWindowPos3sv = _link_function('glWindowPos3sv', None, [POINTER(GLshort)], 'VERSION_1_4')
+
+PFNGLBLENDFUNCSEPARATEPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:4125
+PFNGLFOGCOORDFPROC = CFUNCTYPE(None, GLfloat) # GL/glext.h:4126
+PFNGLFOGCOORDFVPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:4127
+PFNGLFOGCOORDDPROC = CFUNCTYPE(None, GLdouble) # GL/glext.h:4128
+PFNGLFOGCOORDDVPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:4129
+PFNGLFOGCOORDPOINTERPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:4130
+PFNGLMULTIDRAWARRAYSPROC = CFUNCTYPE(None, GLenum, POINTER(GLint), POINTER(GLsizei), GLsizei) # GL/glext.h:4131
+PFNGLMULTIDRAWELEMENTSPROC = CFUNCTYPE(None, GLenum, POINTER(GLsizei), GLenum, POINTER(POINTER(GLvoid)), GLsizei) # GL/glext.h:4132
+PFNGLPOINTPARAMETERFPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:4133
+PFNGLPOINTPARAMETERFVPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:4134
+PFNGLPOINTPARAMETERIPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:4135
+PFNGLPOINTPARAMETERIVPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:4136
+PFNGLSECONDARYCOLOR3BPROC = CFUNCTYPE(None, GLbyte, GLbyte, GLbyte) # GL/glext.h:4137
+PFNGLSECONDARYCOLOR3BVPROC = CFUNCTYPE(None, POINTER(GLbyte)) # GL/glext.h:4138
+PFNGLSECONDARYCOLOR3DPROC = CFUNCTYPE(None, GLdouble, GLdouble, GLdouble) # GL/glext.h:4139
+PFNGLSECONDARYCOLOR3DVPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:4140
+PFNGLSECONDARYCOLOR3FPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat) # GL/glext.h:4141
+PFNGLSECONDARYCOLOR3FVPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:4142
+PFNGLSECONDARYCOLOR3IPROC = CFUNCTYPE(None, GLint, GLint, GLint) # GL/glext.h:4143
+PFNGLSECONDARYCOLOR3IVPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:4144
+PFNGLSECONDARYCOLOR3SPROC = CFUNCTYPE(None, GLshort, GLshort, GLshort) # GL/glext.h:4145
+PFNGLSECONDARYCOLOR3SVPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:4146
+PFNGLSECONDARYCOLOR3UBPROC = CFUNCTYPE(None, GLubyte, GLubyte, GLubyte) # GL/glext.h:4147
+PFNGLSECONDARYCOLOR3UBVPROC = CFUNCTYPE(None, POINTER(GLubyte)) # GL/glext.h:4148
+PFNGLSECONDARYCOLOR3UIPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint) # GL/glext.h:4149
+PFNGLSECONDARYCOLOR3UIVPROC = CFUNCTYPE(None, POINTER(GLuint)) # GL/glext.h:4150
+PFNGLSECONDARYCOLOR3USPROC = CFUNCTYPE(None, GLushort, GLushort, GLushort) # GL/glext.h:4151
+PFNGLSECONDARYCOLOR3USVPROC = CFUNCTYPE(None, POINTER(GLushort)) # GL/glext.h:4152
+PFNGLSECONDARYCOLORPOINTERPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:4153
+PFNGLWINDOWPOS2DPROC = CFUNCTYPE(None, GLdouble, GLdouble) # GL/glext.h:4154
+PFNGLWINDOWPOS2DVPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:4155
+PFNGLWINDOWPOS2FPROC = CFUNCTYPE(None, GLfloat, GLfloat) # GL/glext.h:4156
+PFNGLWINDOWPOS2FVPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:4157
+PFNGLWINDOWPOS2IPROC = CFUNCTYPE(None, GLint, GLint) # GL/glext.h:4158
+PFNGLWINDOWPOS2IVPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:4159
+PFNGLWINDOWPOS2SPROC = CFUNCTYPE(None, GLshort, GLshort) # GL/glext.h:4160
+PFNGLWINDOWPOS2SVPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:4161
+PFNGLWINDOWPOS3DPROC = CFUNCTYPE(None, GLdouble, GLdouble, GLdouble) # GL/glext.h:4162
+PFNGLWINDOWPOS3DVPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:4163
+PFNGLWINDOWPOS3FPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat) # GL/glext.h:4164
+PFNGLWINDOWPOS3FVPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:4165
+PFNGLWINDOWPOS3IPROC = CFUNCTYPE(None, GLint, GLint, GLint) # GL/glext.h:4166
+PFNGLWINDOWPOS3IVPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:4167
+PFNGLWINDOWPOS3SPROC = CFUNCTYPE(None, GLshort, GLshort, GLshort) # GL/glext.h:4168
+PFNGLWINDOWPOS3SVPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:4169
+# VERSION_1_5 (GL/glext.h:4172)
+GL_VERSION_1_5 = 1 # GL/glext.h:4173
+# GL/glext.h:4175
+glGenQueries = _link_function('glGenQueries', None, [GLsizei, POINTER(GLuint)], 'VERSION_1_5')
+
+# GL/glext.h:4176
+glDeleteQueries = _link_function('glDeleteQueries', None, [GLsizei, POINTER(GLuint)], 'VERSION_1_5')
+
+GLboolean = c_ubyte # /usr/include/GL/gl.h:150
+# GL/glext.h:4177
+glIsQuery = _link_function('glIsQuery', GLboolean, [GLuint], 'VERSION_1_5')
+
+# GL/glext.h:4178
+glBeginQuery = _link_function('glBeginQuery', None, [GLenum, GLuint], 'VERSION_1_5')
+
+# GL/glext.h:4179
+glEndQuery = _link_function('glEndQuery', None, [GLenum], 'VERSION_1_5')
+
+# GL/glext.h:4180
+glGetQueryiv = _link_function('glGetQueryiv', None, [GLenum, GLenum, POINTER(GLint)], 'VERSION_1_5')
+
+# GL/glext.h:4181
+glGetQueryObjectiv = _link_function('glGetQueryObjectiv', None, [GLuint, GLenum, POINTER(GLint)], 'VERSION_1_5')
+
+# GL/glext.h:4182
+glGetQueryObjectuiv = _link_function('glGetQueryObjectuiv', None, [GLuint, GLenum, POINTER(GLuint)], 'VERSION_1_5')
+
+# GL/glext.h:4183
+glBindBuffer = _link_function('glBindBuffer', None, [GLenum, GLuint], 'VERSION_1_5')
+
+# GL/glext.h:4184
+glDeleteBuffers = _link_function('glDeleteBuffers', None, [GLsizei, POINTER(GLuint)], 'VERSION_1_5')
+
+# GL/glext.h:4185
+glGenBuffers = _link_function('glGenBuffers', None, [GLsizei, POINTER(GLuint)], 'VERSION_1_5')
+
+# GL/glext.h:4186
+glIsBuffer = _link_function('glIsBuffer', GLboolean, [GLuint], 'VERSION_1_5')
+
+# GL/glext.h:4187
+glBufferData = _link_function('glBufferData', None, [GLenum, GLsizeiptr, POINTER(GLvoid), GLenum], 'VERSION_1_5')
+
+# GL/glext.h:4188
+glBufferSubData = _link_function('glBufferSubData', None, [GLenum, GLintptr, GLsizeiptr, POINTER(GLvoid)], 'VERSION_1_5')
+
+# GL/glext.h:4189
+glGetBufferSubData = _link_function('glGetBufferSubData', None, [GLenum, GLintptr, GLsizeiptr, POINTER(GLvoid)], 'VERSION_1_5')
+
+# GL/glext.h:4190
+glMapBuffer = _link_function('glMapBuffer', POINTER(GLvoid), [GLenum, GLenum], 'VERSION_1_5')
+
+# GL/glext.h:4191
+glUnmapBuffer = _link_function('glUnmapBuffer', GLboolean, [GLenum], 'VERSION_1_5')
+
+# GL/glext.h:4192
+glGetBufferParameteriv = _link_function('glGetBufferParameteriv', None, [GLenum, GLenum, POINTER(GLint)], 'VERSION_1_5')
+
+# GL/glext.h:4193
+glGetBufferPointerv = _link_function('glGetBufferPointerv', None, [GLenum, GLenum, POINTER(POINTER(GLvoid))], 'VERSION_1_5')
+
+PFNGLGENQUERIESPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:4195
+PFNGLDELETEQUERIESPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:4196
+PFNGLISQUERYPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:4197
+PFNGLBEGINQUERYPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:4198
+PFNGLENDQUERYPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:4199
+PFNGLGETQUERYIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:4200
+PFNGLGETQUERYOBJECTIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:4201
+PFNGLGETQUERYOBJECTUIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint)) # GL/glext.h:4202
+PFNGLBINDBUFFERPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:4203
+PFNGLDELETEBUFFERSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:4204
+PFNGLGENBUFFERSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:4205
+PFNGLISBUFFERPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:4206
+PFNGLBUFFERDATAPROC = CFUNCTYPE(None, GLenum, GLsizeiptr, POINTER(GLvoid), GLenum) # GL/glext.h:4207
+PFNGLBUFFERSUBDATAPROC = CFUNCTYPE(None, GLenum, GLintptr, GLsizeiptr, POINTER(GLvoid)) # GL/glext.h:4208
+PFNGLGETBUFFERSUBDATAPROC = CFUNCTYPE(None, GLenum, GLintptr, GLsizeiptr, POINTER(GLvoid)) # GL/glext.h:4209
+PFNGLMAPBUFFERPROC = CFUNCTYPE(POINTER(GLvoid), GLenum, GLenum) # GL/glext.h:4210
+PFNGLUNMAPBUFFERPROC = CFUNCTYPE(GLboolean, GLenum) # GL/glext.h:4211
+PFNGLGETBUFFERPARAMETERIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:4212
+PFNGLGETBUFFERPOINTERVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:4213
+# VERSION_2_0 (GL/glext.h:4216)
+GL_VERSION_2_0 = 1 # GL/glext.h:4217
+# GL/glext.h:4219
+glBlendEquationSeparate = _link_function('glBlendEquationSeparate', None, [GLenum, GLenum], 'VERSION_2_0')
+
+# GL/glext.h:4220
+glDrawBuffers = _link_function('glDrawBuffers', None, [GLsizei, POINTER(GLenum)], 'VERSION_2_0')
+
+# GL/glext.h:4221
+glStencilOpSeparate = _link_function('glStencilOpSeparate', None, [GLenum, GLenum, GLenum, GLenum], 'VERSION_2_0')
+
+# GL/glext.h:4222
+glStencilFuncSeparate = _link_function('glStencilFuncSeparate', None, [GLenum, GLenum, GLint, GLuint], 'VERSION_2_0')
+
+# GL/glext.h:4223
+glStencilMaskSeparate = _link_function('glStencilMaskSeparate', None, [GLenum, GLuint], 'VERSION_2_0')
+
+# GL/glext.h:4224
+glAttachShader = _link_function('glAttachShader', None, [GLuint, GLuint], 'VERSION_2_0')
+
+# GL/glext.h:4225
+glBindAttribLocation = _link_function('glBindAttribLocation', None, [GLuint, GLuint, POINTER(GLchar)], 'VERSION_2_0')
+
+# GL/glext.h:4226
+glCompileShader = _link_function('glCompileShader', None, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:4227
+glCreateProgram = _link_function('glCreateProgram', GLuint, [], 'VERSION_2_0')
+
+# GL/glext.h:4228
+glCreateShader = _link_function('glCreateShader', GLuint, [GLenum], 'VERSION_2_0')
+
+# GL/glext.h:4229
+glDeleteProgram = _link_function('glDeleteProgram', None, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:4230
+glDeleteShader = _link_function('glDeleteShader', None, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:4231
+glDetachShader = _link_function('glDetachShader', None, [GLuint, GLuint], 'VERSION_2_0')
+
+# GL/glext.h:4232
+glDisableVertexAttribArray = _link_function('glDisableVertexAttribArray', None, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:4233
+glEnableVertexAttribArray = _link_function('glEnableVertexAttribArray', None, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:4234
+glGetActiveAttrib = _link_function('glGetActiveAttrib', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLchar)], 'VERSION_2_0')
+
+# GL/glext.h:4235
+glGetActiveUniform = _link_function('glGetActiveUniform', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLchar)], 'VERSION_2_0')
+
+# GL/glext.h:4236
+glGetAttachedShaders = _link_function('glGetAttachedShaders', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLuint)], 'VERSION_2_0')
+
+# GL/glext.h:4237
+glGetAttribLocation = _link_function('glGetAttribLocation', GLint, [GLuint, POINTER(GLchar)], 'VERSION_2_0')
+
+# GL/glext.h:4238
+glGetProgramiv = _link_function('glGetProgramiv', None, [GLuint, GLenum, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:4239
+glGetProgramInfoLog = _link_function('glGetProgramInfoLog', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], 'VERSION_2_0')
+
+# GL/glext.h:4240
+glGetShaderiv = _link_function('glGetShaderiv', None, [GLuint, GLenum, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:4241
+glGetShaderInfoLog = _link_function('glGetShaderInfoLog', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], 'VERSION_2_0')
+
+# GL/glext.h:4242
+glGetShaderSource = _link_function('glGetShaderSource', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], 'VERSION_2_0')
+
+# GL/glext.h:4243
+glGetUniformLocation = _link_function('glGetUniformLocation', GLint, [GLuint, POINTER(GLchar)], 'VERSION_2_0')
+
+# GL/glext.h:4244
+glGetUniformfv = _link_function('glGetUniformfv', None, [GLuint, GLint, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:4245
+glGetUniformiv = _link_function('glGetUniformiv', None, [GLuint, GLint, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:4246
+glGetVertexAttribdv = _link_function('glGetVertexAttribdv', None, [GLuint, GLenum, POINTER(GLdouble)], 'VERSION_2_0')
+
+# GL/glext.h:4247
+glGetVertexAttribfv = _link_function('glGetVertexAttribfv', None, [GLuint, GLenum, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:4248
+glGetVertexAttribiv = _link_function('glGetVertexAttribiv', None, [GLuint, GLenum, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:4249
+glGetVertexAttribPointerv = _link_function('glGetVertexAttribPointerv', None, [GLuint, GLenum, POINTER(POINTER(GLvoid))], 'VERSION_2_0')
+
+# GL/glext.h:4250
+glIsProgram = _link_function('glIsProgram', GLboolean, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:4251
+glIsShader = _link_function('glIsShader', GLboolean, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:4252
+glLinkProgram = _link_function('glLinkProgram', None, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:4253
+glShaderSource = _link_function('glShaderSource', None, [GLuint, GLsizei, POINTER(POINTER(GLchar)), POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:4254
+glUseProgram = _link_function('glUseProgram', None, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:4255
+glUniform1f = _link_function('glUniform1f', None, [GLint, GLfloat], 'VERSION_2_0')
+
+# GL/glext.h:4256
+glUniform2f = _link_function('glUniform2f', None, [GLint, GLfloat, GLfloat], 'VERSION_2_0')
+
+# GL/glext.h:4257
+glUniform3f = _link_function('glUniform3f', None, [GLint, GLfloat, GLfloat, GLfloat], 'VERSION_2_0')
+
+# GL/glext.h:4258
+glUniform4f = _link_function('glUniform4f', None, [GLint, GLfloat, GLfloat, GLfloat, GLfloat], 'VERSION_2_0')
+
+# GL/glext.h:4259
+glUniform1i = _link_function('glUniform1i', None, [GLint, GLint], 'VERSION_2_0')
+
+# GL/glext.h:4260
+glUniform2i = _link_function('glUniform2i', None, [GLint, GLint, GLint], 'VERSION_2_0')
+
+# GL/glext.h:4261
+glUniform3i = _link_function('glUniform3i', None, [GLint, GLint, GLint, GLint], 'VERSION_2_0')
+
+# GL/glext.h:4262
+glUniform4i = _link_function('glUniform4i', None, [GLint, GLint, GLint, GLint, GLint], 'VERSION_2_0')
+
+# GL/glext.h:4263
+glUniform1fv = _link_function('glUniform1fv', None, [GLint, GLsizei, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:4264
+glUniform2fv = _link_function('glUniform2fv', None, [GLint, GLsizei, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:4265
+glUniform3fv = _link_function('glUniform3fv', None, [GLint, GLsizei, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:4266
+glUniform4fv = _link_function('glUniform4fv', None, [GLint, GLsizei, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:4267
+glUniform1iv = _link_function('glUniform1iv', None, [GLint, GLsizei, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:4268
+glUniform2iv = _link_function('glUniform2iv', None, [GLint, GLsizei, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:4269
+glUniform3iv = _link_function('glUniform3iv', None, [GLint, GLsizei, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:4270
+glUniform4iv = _link_function('glUniform4iv', None, [GLint, GLsizei, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:4271
+glUniformMatrix2fv = _link_function('glUniformMatrix2fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:4272
+glUniformMatrix3fv = _link_function('glUniformMatrix3fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:4273
+glUniformMatrix4fv = _link_function('glUniformMatrix4fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:4274
+glValidateProgram = _link_function('glValidateProgram', None, [GLuint], 'VERSION_2_0')
+
+# GL/glext.h:4275
+glVertexAttrib1d = _link_function('glVertexAttrib1d', None, [GLuint, GLdouble], 'VERSION_2_0')
+
+# GL/glext.h:4276
+glVertexAttrib1dv = _link_function('glVertexAttrib1dv', None, [GLuint, POINTER(GLdouble)], 'VERSION_2_0')
+
+# GL/glext.h:4277
+glVertexAttrib1f = _link_function('glVertexAttrib1f', None, [GLuint, GLfloat], 'VERSION_2_0')
+
+# GL/glext.h:4278
+glVertexAttrib1fv = _link_function('glVertexAttrib1fv', None, [GLuint, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:4279
+glVertexAttrib1s = _link_function('glVertexAttrib1s', None, [GLuint, GLshort], 'VERSION_2_0')
+
+# GL/glext.h:4280
+glVertexAttrib1sv = _link_function('glVertexAttrib1sv', None, [GLuint, POINTER(GLshort)], 'VERSION_2_0')
+
+# GL/glext.h:4281
+glVertexAttrib2d = _link_function('glVertexAttrib2d', None, [GLuint, GLdouble, GLdouble], 'VERSION_2_0')
+
+# GL/glext.h:4282
+glVertexAttrib2dv = _link_function('glVertexAttrib2dv', None, [GLuint, POINTER(GLdouble)], 'VERSION_2_0')
+
+# GL/glext.h:4283
+glVertexAttrib2f = _link_function('glVertexAttrib2f', None, [GLuint, GLfloat, GLfloat], 'VERSION_2_0')
+
+# GL/glext.h:4284
+glVertexAttrib2fv = _link_function('glVertexAttrib2fv', None, [GLuint, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:4285
+glVertexAttrib2s = _link_function('glVertexAttrib2s', None, [GLuint, GLshort, GLshort], 'VERSION_2_0')
+
+# GL/glext.h:4286
+glVertexAttrib2sv = _link_function('glVertexAttrib2sv', None, [GLuint, POINTER(GLshort)], 'VERSION_2_0')
+
+# GL/glext.h:4287
+glVertexAttrib3d = _link_function('glVertexAttrib3d', None, [GLuint, GLdouble, GLdouble, GLdouble], 'VERSION_2_0')
+
+# GL/glext.h:4288
+glVertexAttrib3dv = _link_function('glVertexAttrib3dv', None, [GLuint, POINTER(GLdouble)], 'VERSION_2_0')
+
+# GL/glext.h:4289
+glVertexAttrib3f = _link_function('glVertexAttrib3f', None, [GLuint, GLfloat, GLfloat, GLfloat], 'VERSION_2_0')
+
+# GL/glext.h:4290
+glVertexAttrib3fv = _link_function('glVertexAttrib3fv', None, [GLuint, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:4291
+glVertexAttrib3s = _link_function('glVertexAttrib3s', None, [GLuint, GLshort, GLshort, GLshort], 'VERSION_2_0')
+
+# GL/glext.h:4292
+glVertexAttrib3sv = _link_function('glVertexAttrib3sv', None, [GLuint, POINTER(GLshort)], 'VERSION_2_0')
+
+# GL/glext.h:4293
+glVertexAttrib4Nbv = _link_function('glVertexAttrib4Nbv', None, [GLuint, POINTER(GLbyte)], 'VERSION_2_0')
+
+# GL/glext.h:4294
+glVertexAttrib4Niv = _link_function('glVertexAttrib4Niv', None, [GLuint, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:4295
+glVertexAttrib4Nsv = _link_function('glVertexAttrib4Nsv', None, [GLuint, POINTER(GLshort)], 'VERSION_2_0')
+
+# GL/glext.h:4296
+glVertexAttrib4Nub = _link_function('glVertexAttrib4Nub', None, [GLuint, GLubyte, GLubyte, GLubyte, GLubyte], 'VERSION_2_0')
+
+# GL/glext.h:4297
+glVertexAttrib4Nubv = _link_function('glVertexAttrib4Nubv', None, [GLuint, POINTER(GLubyte)], 'VERSION_2_0')
+
+# GL/glext.h:4298
+glVertexAttrib4Nuiv = _link_function('glVertexAttrib4Nuiv', None, [GLuint, POINTER(GLuint)], 'VERSION_2_0')
+
+# GL/glext.h:4299
+glVertexAttrib4Nusv = _link_function('glVertexAttrib4Nusv', None, [GLuint, POINTER(GLushort)], 'VERSION_2_0')
+
+# GL/glext.h:4300
+glVertexAttrib4bv = _link_function('glVertexAttrib4bv', None, [GLuint, POINTER(GLbyte)], 'VERSION_2_0')
+
+# GL/glext.h:4301
+glVertexAttrib4d = _link_function('glVertexAttrib4d', None, [GLuint, GLdouble, GLdouble, GLdouble, GLdouble], 'VERSION_2_0')
+
+# GL/glext.h:4302
+glVertexAttrib4dv = _link_function('glVertexAttrib4dv', None, [GLuint, POINTER(GLdouble)], 'VERSION_2_0')
+
+# GL/glext.h:4303
+glVertexAttrib4f = _link_function('glVertexAttrib4f', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat], 'VERSION_2_0')
+
+# GL/glext.h:4304
+glVertexAttrib4fv = _link_function('glVertexAttrib4fv', None, [GLuint, POINTER(GLfloat)], 'VERSION_2_0')
+
+# GL/glext.h:4305
+glVertexAttrib4iv = _link_function('glVertexAttrib4iv', None, [GLuint, POINTER(GLint)], 'VERSION_2_0')
+
+# GL/glext.h:4306
+glVertexAttrib4s = _link_function('glVertexAttrib4s', None, [GLuint, GLshort, GLshort, GLshort, GLshort], 'VERSION_2_0')
+
+# GL/glext.h:4307
+glVertexAttrib4sv = _link_function('glVertexAttrib4sv', None, [GLuint, POINTER(GLshort)], 'VERSION_2_0')
+
+# GL/glext.h:4308
+glVertexAttrib4ubv = _link_function('glVertexAttrib4ubv', None, [GLuint, POINTER(GLubyte)], 'VERSION_2_0')
+
+# GL/glext.h:4309
+glVertexAttrib4uiv = _link_function('glVertexAttrib4uiv', None, [GLuint, POINTER(GLuint)], 'VERSION_2_0')
+
+# GL/glext.h:4310
+glVertexAttrib4usv = _link_function('glVertexAttrib4usv', None, [GLuint, POINTER(GLushort)], 'VERSION_2_0')
+
+# GL/glext.h:4311
+glVertexAttribPointer = _link_function('glVertexAttribPointer', None, [GLuint, GLint, GLenum, GLboolean, GLsizei, POINTER(GLvoid)], 'VERSION_2_0')
+
+PFNGLBLENDEQUATIONSEPARATEPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:4313
+PFNGLDRAWBUFFERSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLenum)) # GL/glext.h:4314
+PFNGLSTENCILOPSEPARATEPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:4315
+PFNGLSTENCILFUNCSEPARATEPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLuint) # GL/glext.h:4316
+PFNGLSTENCILMASKSEPARATEPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:4317
+PFNGLATTACHSHADERPROC = CFUNCTYPE(None, GLuint, GLuint) # GL/glext.h:4318
+PFNGLBINDATTRIBLOCATIONPROC = CFUNCTYPE(None, GLuint, GLuint, POINTER(GLchar)) # GL/glext.h:4319
+PFNGLCOMPILESHADERPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:4320
+PFNGLCREATEPROGRAMPROC = CFUNCTYPE(GLuint) # GL/glext.h:4321
+PFNGLCREATESHADERPROC = CFUNCTYPE(GLuint, GLenum) # GL/glext.h:4322
+PFNGLDELETEPROGRAMPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:4323
+PFNGLDELETESHADERPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:4324
+PFNGLDETACHSHADERPROC = CFUNCTYPE(None, GLuint, GLuint) # GL/glext.h:4325
+PFNGLDISABLEVERTEXATTRIBARRAYPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:4326
+PFNGLENABLEVERTEXATTRIBARRAYPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:4327
+PFNGLGETACTIVEATTRIBPROC = CFUNCTYPE(None, GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLchar)) # GL/glext.h:4328
+PFNGLGETACTIVEUNIFORMPROC = CFUNCTYPE(None, GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLchar)) # GL/glext.h:4329
+PFNGLGETATTACHEDSHADERSPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLuint)) # GL/glext.h:4330
+PFNGLGETATTRIBLOCATIONPROC = CFUNCTYPE(GLint, GLuint, POINTER(GLchar)) # GL/glext.h:4331
+PFNGLGETPROGRAMIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:4332
+PFNGLGETPROGRAMINFOLOGPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)) # GL/glext.h:4333
+PFNGLGETSHADERIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:4334
+PFNGLGETSHADERINFOLOGPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)) # GL/glext.h:4335
+PFNGLGETSHADERSOURCEPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)) # GL/glext.h:4336
+PFNGLGETUNIFORMLOCATIONPROC = CFUNCTYPE(GLint, GLuint, POINTER(GLchar)) # GL/glext.h:4337
+PFNGLGETUNIFORMFVPROC = CFUNCTYPE(None, GLuint, GLint, POINTER(GLfloat)) # GL/glext.h:4338
+PFNGLGETUNIFORMIVPROC = CFUNCTYPE(None, GLuint, GLint, POINTER(GLint)) # GL/glext.h:4339
+PFNGLGETVERTEXATTRIBDVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLdouble)) # GL/glext.h:4340
+PFNGLGETVERTEXATTRIBFVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:4341
+PFNGLGETVERTEXATTRIBIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:4342
+PFNGLGETVERTEXATTRIBPOINTERVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:4343
+PFNGLISPROGRAMPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:4344
+PFNGLISSHADERPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:4345
+PFNGLLINKPROGRAMPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:4346
+PFNGLSHADERSOURCEPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(POINTER(GLchar)), POINTER(GLint)) # GL/glext.h:4347
+PFNGLUSEPROGRAMPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:4348
+PFNGLUNIFORM1FPROC = CFUNCTYPE(None, GLint, GLfloat) # GL/glext.h:4349
+PFNGLUNIFORM2FPROC = CFUNCTYPE(None, GLint, GLfloat, GLfloat) # GL/glext.h:4350
+PFNGLUNIFORM3FPROC = CFUNCTYPE(None, GLint, GLfloat, GLfloat, GLfloat) # GL/glext.h:4351
+PFNGLUNIFORM4FPROC = CFUNCTYPE(None, GLint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:4352
+PFNGLUNIFORM1IPROC = CFUNCTYPE(None, GLint, GLint) # GL/glext.h:4353
+PFNGLUNIFORM2IPROC = CFUNCTYPE(None, GLint, GLint, GLint) # GL/glext.h:4354
+PFNGLUNIFORM3IPROC = CFUNCTYPE(None, GLint, GLint, GLint, GLint) # GL/glext.h:4355
+PFNGLUNIFORM4IPROC = CFUNCTYPE(None, GLint, GLint, GLint, GLint, GLint) # GL/glext.h:4356
+PFNGLUNIFORM1FVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:4357
+PFNGLUNIFORM2FVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:4358
+PFNGLUNIFORM3FVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:4359
+PFNGLUNIFORM4FVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:4360
+PFNGLUNIFORM1IVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:4361
+PFNGLUNIFORM2IVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:4362
+PFNGLUNIFORM3IVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:4363
+PFNGLUNIFORM4IVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:4364
+PFNGLUNIFORMMATRIX2FVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:4365
+PFNGLUNIFORMMATRIX3FVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:4366
+PFNGLUNIFORMMATRIX4FVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:4367
+PFNGLVALIDATEPROGRAMPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:4368
+PFNGLVERTEXATTRIB1DPROC = CFUNCTYPE(None, GLuint, GLdouble) # GL/glext.h:4369
+PFNGLVERTEXATTRIB1DVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:4370
+PFNGLVERTEXATTRIB1FPROC = CFUNCTYPE(None, GLuint, GLfloat) # GL/glext.h:4371
+PFNGLVERTEXATTRIB1FVPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:4372
+PFNGLVERTEXATTRIB1SPROC = CFUNCTYPE(None, GLuint, GLshort) # GL/glext.h:4373
+PFNGLVERTEXATTRIB1SVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:4374
+PFNGLVERTEXATTRIB2DPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble) # GL/glext.h:4375
+PFNGLVERTEXATTRIB2DVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:4376
+PFNGLVERTEXATTRIB2FPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat) # GL/glext.h:4377
+PFNGLVERTEXATTRIB2FVPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:4378
+PFNGLVERTEXATTRIB2SPROC = CFUNCTYPE(None, GLuint, GLshort, GLshort) # GL/glext.h:4379
+PFNGLVERTEXATTRIB2SVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:4380
+PFNGLVERTEXATTRIB3DPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble, GLdouble) # GL/glext.h:4381
+PFNGLVERTEXATTRIB3DVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:4382
+PFNGLVERTEXATTRIB3FPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat) # GL/glext.h:4383
+PFNGLVERTEXATTRIB3FVPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:4384
+PFNGLVERTEXATTRIB3SPROC = CFUNCTYPE(None, GLuint, GLshort, GLshort, GLshort) # GL/glext.h:4385
+PFNGLVERTEXATTRIB3SVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:4386
+PFNGLVERTEXATTRIB4NBVPROC = CFUNCTYPE(None, GLuint, POINTER(GLbyte)) # GL/glext.h:4387
+PFNGLVERTEXATTRIB4NIVPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:4388
+PFNGLVERTEXATTRIB4NSVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:4389
+PFNGLVERTEXATTRIB4NUBPROC = CFUNCTYPE(None, GLuint, GLubyte, GLubyte, GLubyte, GLubyte) # GL/glext.h:4390
+PFNGLVERTEXATTRIB4NUBVPROC = CFUNCTYPE(None, GLuint, POINTER(GLubyte)) # GL/glext.h:4391
+PFNGLVERTEXATTRIB4NUIVPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:4392
+PFNGLVERTEXATTRIB4NUSVPROC = CFUNCTYPE(None, GLuint, POINTER(GLushort)) # GL/glext.h:4393
+PFNGLVERTEXATTRIB4BVPROC = CFUNCTYPE(None, GLuint, POINTER(GLbyte)) # GL/glext.h:4394
+PFNGLVERTEXATTRIB4DPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:4395
+PFNGLVERTEXATTRIB4DVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:4396
+PFNGLVERTEXATTRIB4FPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:4397
+PFNGLVERTEXATTRIB4FVPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:4398
+PFNGLVERTEXATTRIB4IVPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:4399
+PFNGLVERTEXATTRIB4SPROC = CFUNCTYPE(None, GLuint, GLshort, GLshort, GLshort, GLshort) # GL/glext.h:4400
+PFNGLVERTEXATTRIB4SVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:4401
+PFNGLVERTEXATTRIB4UBVPROC = CFUNCTYPE(None, GLuint, POINTER(GLubyte)) # GL/glext.h:4402
+PFNGLVERTEXATTRIB4UIVPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:4403
+PFNGLVERTEXATTRIB4USVPROC = CFUNCTYPE(None, GLuint, POINTER(GLushort)) # GL/glext.h:4404
+PFNGLVERTEXATTRIBPOINTERPROC = CFUNCTYPE(None, GLuint, GLint, GLenum, GLboolean, GLsizei, POINTER(GLvoid)) # GL/glext.h:4405
+# VERSION_2_1 (GL/glext.h:4408)
+GL_VERSION_2_1 = 1 # GL/glext.h:4409
+# GL/glext.h:4411
+glUniformMatrix2x3fv = _link_function('glUniformMatrix2x3fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'VERSION_2_1')
+
+# GL/glext.h:4412
+glUniformMatrix3x2fv = _link_function('glUniformMatrix3x2fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'VERSION_2_1')
+
+# GL/glext.h:4413
+glUniformMatrix2x4fv = _link_function('glUniformMatrix2x4fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'VERSION_2_1')
+
+# GL/glext.h:4414
+glUniformMatrix4x2fv = _link_function('glUniformMatrix4x2fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'VERSION_2_1')
+
+# GL/glext.h:4415
+glUniformMatrix3x4fv = _link_function('glUniformMatrix3x4fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'VERSION_2_1')
+
+# GL/glext.h:4416
+glUniformMatrix4x3fv = _link_function('glUniformMatrix4x3fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'VERSION_2_1')
+
+PFNGLUNIFORMMATRIX2X3FVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:4418
+PFNGLUNIFORMMATRIX3X2FVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:4419
+PFNGLUNIFORMMATRIX2X4FVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:4420
+PFNGLUNIFORMMATRIX4X2FVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:4421
+PFNGLUNIFORMMATRIX3X4FVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:4422
+PFNGLUNIFORMMATRIX4X3FVPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:4423
+# VERSION_3_0 (GL/glext.h:4426)
+GL_VERSION_3_0 = 1 # GL/glext.h:4427
+# GL/glext.h:4433
+glColorMaski = _link_function('glColorMaski', None, [GLuint, GLboolean, GLboolean, GLboolean, GLboolean], 'VERSION_3_0')
+
+# GL/glext.h:4434
+glGetBooleani_v = _link_function('glGetBooleani_v', None, [GLenum, GLuint, POINTER(GLboolean)], 'VERSION_3_0')
+
+# GL/glext.h:4435
+glGetIntegeri_v = _link_function('glGetIntegeri_v', None, [GLenum, GLuint, POINTER(GLint)], 'VERSION_3_0')
+
+# GL/glext.h:4436
+glEnablei = _link_function('glEnablei', None, [GLenum, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:4437
+glDisablei = _link_function('glDisablei', None, [GLenum, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:4438
+glIsEnabledi = _link_function('glIsEnabledi', GLboolean, [GLenum, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:4439
+glBeginTransformFeedback = _link_function('glBeginTransformFeedback', None, [GLenum], 'VERSION_3_0')
+
+# GL/glext.h:4440
+glEndTransformFeedback = _link_function('glEndTransformFeedback', None, [], 'VERSION_3_0')
+
+# GL/glext.h:4441
+glBindBufferRange = _link_function('glBindBufferRange', None, [GLenum, GLuint, GLuint, GLintptr, GLsizeiptr], 'VERSION_3_0')
+
+# GL/glext.h:4442
+glBindBufferBase = _link_function('glBindBufferBase', None, [GLenum, GLuint, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:4443
+glTransformFeedbackVaryings = _link_function('glTransformFeedbackVaryings', None, [GLuint, GLsizei, POINTER(POINTER(GLchar)), GLenum], 'VERSION_3_0')
+
+# GL/glext.h:4444
+glGetTransformFeedbackVarying = _link_function('glGetTransformFeedbackVarying', None, [GLuint, GLuint, POINTER(GLint)], 'VERSION_3_0')
+
+# GL/glext.h:4445
+glClampColor = _link_function('glClampColor', None, [GLenum, GLenum], 'VERSION_3_0')
+
+# GL/glext.h:4446
+glBeginConditionalRender = _link_function('glBeginConditionalRender', None, [GLuint, GLenum], 'VERSION_3_0')
+
+# GL/glext.h:4447
+glEndConditionalRender = _link_function('glEndConditionalRender', None, [], 'VERSION_3_0')
+
+# GL/glext.h:4448
+glVertexAttribI1i = _link_function('glVertexAttribI1i', None, [GLuint, GLint], 'VERSION_3_0')
+
+# GL/glext.h:4449
+glVertexAttribI2i = _link_function('glVertexAttribI2i', None, [GLuint, GLint, GLint], 'VERSION_3_0')
+
+# GL/glext.h:4450
+glVertexAttribI3i = _link_function('glVertexAttribI3i', None, [GLuint, GLint, GLint, GLint], 'VERSION_3_0')
+
+# GL/glext.h:4451
+glVertexAttribI4i = _link_function('glVertexAttribI4i', None, [GLuint, GLint, GLint, GLint, GLint], 'VERSION_3_0')
+
+# GL/glext.h:4452
+glVertexAttribI1ui = _link_function('glVertexAttribI1ui', None, [GLuint, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:4453
+glVertexAttribI2ui = _link_function('glVertexAttribI2ui', None, [GLuint, GLuint, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:4454
+glVertexAttribI3ui = _link_function('glVertexAttribI3ui', None, [GLuint, GLuint, GLuint, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:4455
+glVertexAttribI4ui = _link_function('glVertexAttribI4ui', None, [GLuint, GLuint, GLuint, GLuint, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:4456
+glVertexAttribI1iv = _link_function('glVertexAttribI1iv', None, [GLuint, POINTER(GLint)], 'VERSION_3_0')
+
+# GL/glext.h:4457
+glVertexAttribI2iv = _link_function('glVertexAttribI2iv', None, [GLuint, POINTER(GLint)], 'VERSION_3_0')
+
+# GL/glext.h:4458
+glVertexAttribI3iv = _link_function('glVertexAttribI3iv', None, [GLuint, POINTER(GLint)], 'VERSION_3_0')
+
+# GL/glext.h:4459
+glVertexAttribI4iv = _link_function('glVertexAttribI4iv', None, [GLuint, POINTER(GLint)], 'VERSION_3_0')
+
+# GL/glext.h:4460
+glVertexAttribI1uiv = _link_function('glVertexAttribI1uiv', None, [GLuint, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:4461
+glVertexAttribI2uiv = _link_function('glVertexAttribI2uiv', None, [GLuint, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:4462
+glVertexAttribI3uiv = _link_function('glVertexAttribI3uiv', None, [GLuint, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:4463
+glVertexAttribI4uiv = _link_function('glVertexAttribI4uiv', None, [GLuint, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:4464
+glVertexAttribI4bv = _link_function('glVertexAttribI4bv', None, [GLuint, POINTER(GLbyte)], 'VERSION_3_0')
+
+# GL/glext.h:4465
+glVertexAttribI4sv = _link_function('glVertexAttribI4sv', None, [GLuint, POINTER(GLshort)], 'VERSION_3_0')
+
+# GL/glext.h:4466
+glVertexAttribI4ubv = _link_function('glVertexAttribI4ubv', None, [GLuint, POINTER(GLubyte)], 'VERSION_3_0')
+
+# GL/glext.h:4467
+glVertexAttribI4usv = _link_function('glVertexAttribI4usv', None, [GLuint, POINTER(GLushort)], 'VERSION_3_0')
+
+# GL/glext.h:4468
+glVertexAttribIPointer = _link_function('glVertexAttribIPointer', None, [GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)], 'VERSION_3_0')
+
+# GL/glext.h:4469
+glGetVertexAttribIiv = _link_function('glGetVertexAttribIiv', None, [GLuint, GLenum, POINTER(GLint)], 'VERSION_3_0')
+
+# GL/glext.h:4470
+glGetVertexAttribIuiv = _link_function('glGetVertexAttribIuiv', None, [GLuint, GLenum, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:4471
+glGetUniformuiv = _link_function('glGetUniformuiv', None, [GLuint, GLint, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:4472
+glBindFragDataLocation = _link_function('glBindFragDataLocation', None, [GLuint, GLuint, POINTER(GLchar)], 'VERSION_3_0')
+
+# GL/glext.h:4473
+glGetFragDataLocation = _link_function('glGetFragDataLocation', GLint, [GLuint, POINTER(GLchar)], 'VERSION_3_0')
+
+# GL/glext.h:4474
+glUniform1ui = _link_function('glUniform1ui', None, [GLint, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:4475
+glUniform2ui = _link_function('glUniform2ui', None, [GLint, GLuint, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:4476
+glUniform3ui = _link_function('glUniform3ui', None, [GLint, GLuint, GLuint, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:4477
+glUniform4ui = _link_function('glUniform4ui', None, [GLint, GLuint, GLuint, GLuint, GLuint], 'VERSION_3_0')
+
+# GL/glext.h:4478
+glUniform1uiv = _link_function('glUniform1uiv', None, [GLint, GLsizei, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:4479
+glUniform2uiv = _link_function('glUniform2uiv', None, [GLint, GLsizei, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:4480
+glUniform3uiv = _link_function('glUniform3uiv', None, [GLint, GLsizei, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:4481
+glUniform4uiv = _link_function('glUniform4uiv', None, [GLint, GLsizei, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:4482
+glTexParameterIiv = _link_function('glTexParameterIiv', None, [GLenum, GLenum, POINTER(GLint)], 'VERSION_3_0')
+
+# GL/glext.h:4483
+glTexParameterIuiv = _link_function('glTexParameterIuiv', None, [GLenum, GLenum, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:4484
+glGetTexParameterIiv = _link_function('glGetTexParameterIiv', None, [GLenum, GLenum, POINTER(GLint)], 'VERSION_3_0')
+
+# GL/glext.h:4485
+glGetTexParameterIuiv = _link_function('glGetTexParameterIuiv', None, [GLenum, GLenum, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:4486
+glClearBufferiv = _link_function('glClearBufferiv', None, [GLenum, GLint, POINTER(GLint)], 'VERSION_3_0')
+
+# GL/glext.h:4487
+glClearBufferuiv = _link_function('glClearBufferuiv', None, [GLenum, GLint, POINTER(GLuint)], 'VERSION_3_0')
+
+# GL/glext.h:4488
+glClearBufferfv = _link_function('glClearBufferfv', None, [GLenum, GLint, POINTER(GLfloat)], 'VERSION_3_0')
+
+# GL/glext.h:4489
+glClearBufferfi = _link_function('glClearBufferfi', None, [GLenum, GLint, GLfloat, GLint], 'VERSION_3_0')
+
+# GL/glext.h:4490
+glGetStringi = _link_function('glGetStringi', POINTER(GLubyte), [GLenum, GLuint], 'VERSION_3_0')
+
+PFNGLCOLORMASKIPROC = CFUNCTYPE(None, GLuint, GLboolean, GLboolean, GLboolean, GLboolean) # GL/glext.h:4492
+PFNGLGETBOOLEANI_VPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLboolean)) # GL/glext.h:4493
+PFNGLGETINTEGERI_VPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLint)) # GL/glext.h:4494
+PFNGLENABLEIPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:4495
+PFNGLDISABLEIPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:4496
+PFNGLISENABLEDIPROC = CFUNCTYPE(GLboolean, GLenum, GLuint) # GL/glext.h:4497
+PFNGLBEGINTRANSFORMFEEDBACKPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:4498
+PFNGLENDTRANSFORMFEEDBACKPROC = CFUNCTYPE(None) # GL/glext.h:4499
+PFNGLBINDBUFFERRANGEPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLintptr, GLsizeiptr) # GL/glext.h:4500
+PFNGLBINDBUFFERBASEPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint) # GL/glext.h:4501
+PFNGLTRANSFORMFEEDBACKVARYINGSPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLint), GLenum) # GL/glext.h:4502
+PFNGLGETTRANSFORMFEEDBACKVARYINGPROC = CFUNCTYPE(None, GLuint, GLuint, POINTER(GLint)) # GL/glext.h:4503
+PFNGLCLAMPCOLORPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:4504
+PFNGLBEGINCONDITIONALRENDERPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:4505
+PFNGLENDCONDITIONALRENDERPROC = CFUNCTYPE(None) # GL/glext.h:4506
+PFNGLVERTEXATTRIBI1IPROC = CFUNCTYPE(None, GLuint, GLint) # GL/glext.h:4507
+PFNGLVERTEXATTRIBI2IPROC = CFUNCTYPE(None, GLuint, GLint, GLint) # GL/glext.h:4508
+PFNGLVERTEXATTRIBI3IPROC = CFUNCTYPE(None, GLuint, GLint, GLint, GLint) # GL/glext.h:4509
+PFNGLVERTEXATTRIBI4IPROC = CFUNCTYPE(None, GLuint, GLint, GLint, GLint, GLint) # GL/glext.h:4510
+PFNGLVERTEXATTRIBI1UIPROC = CFUNCTYPE(None, GLuint, GLuint) # GL/glext.h:4511
+PFNGLVERTEXATTRIBI2UIPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint) # GL/glext.h:4512
+PFNGLVERTEXATTRIBI3UIPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:4513
+PFNGLVERTEXATTRIBI4UIPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:4514
+PFNGLVERTEXATTRIBI1IVPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:4515
+PFNGLVERTEXATTRIBI2IVPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:4516
+PFNGLVERTEXATTRIBI3IVPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:4517
+PFNGLVERTEXATTRIBI4IVPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:4518
+PFNGLVERTEXATTRIBI1UIVPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:4519
+PFNGLVERTEXATTRIBI2UIVPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:4520
+PFNGLVERTEXATTRIBI3UIVPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:4521
+PFNGLVERTEXATTRIBI4UIVPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:4522
+PFNGLVERTEXATTRIBI4BVPROC = CFUNCTYPE(None, GLuint, POINTER(GLbyte)) # GL/glext.h:4523
+PFNGLVERTEXATTRIBI4SVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:4524
+PFNGLVERTEXATTRIBI4UBVPROC = CFUNCTYPE(None, GLuint, POINTER(GLubyte)) # GL/glext.h:4525
+PFNGLVERTEXATTRIBI4USVPROC = CFUNCTYPE(None, GLuint, POINTER(GLushort)) # GL/glext.h:4526
+PFNGLVERTEXATTRIBIPOINTERPROC = CFUNCTYPE(None, GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:4527
+PFNGLGETVERTEXATTRIBIIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:4528
+PFNGLGETVERTEXATTRIBIUIVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint)) # GL/glext.h:4529
+PFNGLGETUNIFORMUIVPROC = CFUNCTYPE(None, GLuint, GLint, POINTER(GLuint)) # GL/glext.h:4530
+PFNGLBINDFRAGDATALOCATIONPROC = CFUNCTYPE(None, GLuint, GLuint, POINTER(GLchar)) # GL/glext.h:4531
+PFNGLGETFRAGDATALOCATIONPROC = CFUNCTYPE(GLint, GLuint, POINTER(GLchar)) # GL/glext.h:4532
+PFNGLUNIFORM1UIPROC = CFUNCTYPE(None, GLint, GLuint) # GL/glext.h:4533
+PFNGLUNIFORM2UIPROC = CFUNCTYPE(None, GLint, GLuint, GLuint) # GL/glext.h:4534
+PFNGLUNIFORM3UIPROC = CFUNCTYPE(None, GLint, GLuint, GLuint, GLuint) # GL/glext.h:4535
+PFNGLUNIFORM4UIPROC = CFUNCTYPE(None, GLint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:4536
+PFNGLUNIFORM1UIVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:4537
+PFNGLUNIFORM2UIVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:4538
+PFNGLUNIFORM3UIVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:4539
+PFNGLUNIFORM4UIVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:4540
+PFNGLTEXPARAMETERIIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:4541
+PFNGLTEXPARAMETERIUIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:4542
+PFNGLGETTEXPARAMETERIIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:4543
+PFNGLGETTEXPARAMETERIUIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:4544
+PFNGLCLEARBUFFERIVPROC = CFUNCTYPE(None, GLenum, GLint, POINTER(GLint)) # GL/glext.h:4545
+PFNGLCLEARBUFFERUIVPROC = CFUNCTYPE(None, GLenum, GLint, POINTER(GLuint)) # GL/glext.h:4546
+PFNGLCLEARBUFFERFVPROC = CFUNCTYPE(None, GLenum, GLint, POINTER(GLfloat)) # GL/glext.h:4547
+PFNGLCLEARBUFFERFIPROC = CFUNCTYPE(None, GLenum, GLint, GLfloat, GLint) # GL/glext.h:4548
+PFNGLGETSTRINGIPROC = CFUNCTYPE(POINTER(GLubyte), GLenum, GLuint) # GL/glext.h:4549
+# ARB_multitexture (GL/glext.h:4552)
+# ARB_transpose_matrix (GL/glext.h:4626)
+GL_ARB_transpose_matrix = 1 # GL/glext.h:4627
+# GL/glext.h:4629
+glLoadTransposeMatrixfARB = _link_function('glLoadTransposeMatrixfARB', None, [POINTER(GLfloat)], 'ARB_transpose_matrix')
+
+# GL/glext.h:4630
+glLoadTransposeMatrixdARB = _link_function('glLoadTransposeMatrixdARB', None, [POINTER(GLdouble)], 'ARB_transpose_matrix')
+
+# GL/glext.h:4631
+glMultTransposeMatrixfARB = _link_function('glMultTransposeMatrixfARB', None, [POINTER(GLfloat)], 'ARB_transpose_matrix')
+
+# GL/glext.h:4632
+glMultTransposeMatrixdARB = _link_function('glMultTransposeMatrixdARB', None, [POINTER(GLdouble)], 'ARB_transpose_matrix')
+
+PFNGLLOADTRANSPOSEMATRIXFARBPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:4634
+PFNGLLOADTRANSPOSEMATRIXDARBPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:4635
+PFNGLMULTTRANSPOSEMATRIXFARBPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:4636
+PFNGLMULTTRANSPOSEMATRIXDARBPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:4637
+# ARB_multisample (GL/glext.h:4640)
+GL_ARB_multisample = 1 # GL/glext.h:4641
+GLclampf = c_float # /usr/include/GL/gl.h:161
+# GL/glext.h:4643
+glSampleCoverageARB = _link_function('glSampleCoverageARB', None, [GLclampf, GLboolean], 'ARB_multisample')
+
+PFNGLSAMPLECOVERAGEARBPROC = CFUNCTYPE(None, GLclampf, GLboolean) # GL/glext.h:4645
+# ARB_texture_env_add (GL/glext.h:4648)
+GL_ARB_texture_env_add = 1 # GL/glext.h:4649
+# ARB_texture_cube_map (GL/glext.h:4652)
+GL_ARB_texture_cube_map = 1 # GL/glext.h:4653
+# ARB_texture_compression (GL/glext.h:4656)
+GL_ARB_texture_compression = 1 # GL/glext.h:4657
+# GL/glext.h:4659
+glCompressedTexImage3DARB = _link_function('glCompressedTexImage3DARB', None, [GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)], 'ARB_texture_compression')
+
+# GL/glext.h:4660
+glCompressedTexImage2DARB = _link_function('glCompressedTexImage2DARB', None, [GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)], 'ARB_texture_compression')
+
+# GL/glext.h:4661
+glCompressedTexImage1DARB = _link_function('glCompressedTexImage1DARB', None, [GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, POINTER(GLvoid)], 'ARB_texture_compression')
+
+# GL/glext.h:4662
+glCompressedTexSubImage3DARB = _link_function('glCompressedTexSubImage3DARB', None, [GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'ARB_texture_compression')
+
+# GL/glext.h:4663
+glCompressedTexSubImage2DARB = _link_function('glCompressedTexSubImage2DARB', None, [GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'ARB_texture_compression')
+
+# GL/glext.h:4664
+glCompressedTexSubImage1DARB = _link_function('glCompressedTexSubImage1DARB', None, [GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'ARB_texture_compression')
+
+# GL/glext.h:4665
+glGetCompressedTexImageARB = _link_function('glGetCompressedTexImageARB', None, [GLenum, GLint, POINTER(GLvoid)], 'ARB_texture_compression')
+
+PFNGLCOMPRESSEDTEXIMAGE3DARBPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # GL/glext.h:4667
+PFNGLCOMPRESSEDTEXIMAGE2DARBPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # GL/glext.h:4668
+PFNGLCOMPRESSEDTEXIMAGE1DARBPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # GL/glext.h:4669
+PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:4670
+PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:4671
+PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:4672
+PFNGLGETCOMPRESSEDTEXIMAGEARBPROC = CFUNCTYPE(None, GLenum, GLint, POINTER(GLvoid)) # GL/glext.h:4673
+# ARB_texture_border_clamp (GL/glext.h:4676)
+GL_ARB_texture_border_clamp = 1 # GL/glext.h:4677
+# ARB_point_parameters (GL/glext.h:4680)
+GL_ARB_point_parameters = 1 # GL/glext.h:4681
+# GL/glext.h:4683
+glPointParameterfARB = _link_function('glPointParameterfARB', None, [GLenum, GLfloat], 'ARB_point_parameters')
+
+# GL/glext.h:4684
+glPointParameterfvARB = _link_function('glPointParameterfvARB', None, [GLenum, POINTER(GLfloat)], 'ARB_point_parameters')
+
+PFNGLPOINTPARAMETERFARBPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:4686
+PFNGLPOINTPARAMETERFVARBPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:4687
+# ARB_vertex_blend (GL/glext.h:4690)
+GL_ARB_vertex_blend = 1 # GL/glext.h:4691
+# GL/glext.h:4693
+glWeightbvARB = _link_function('glWeightbvARB', None, [GLint, POINTER(GLbyte)], 'ARB_vertex_blend')
+
+# GL/glext.h:4694
+glWeightsvARB = _link_function('glWeightsvARB', None, [GLint, POINTER(GLshort)], 'ARB_vertex_blend')
+
+# GL/glext.h:4695
+glWeightivARB = _link_function('glWeightivARB', None, [GLint, POINTER(GLint)], 'ARB_vertex_blend')
+
+# GL/glext.h:4696
+glWeightfvARB = _link_function('glWeightfvARB', None, [GLint, POINTER(GLfloat)], 'ARB_vertex_blend')
+
+# GL/glext.h:4697
+glWeightdvARB = _link_function('glWeightdvARB', None, [GLint, POINTER(GLdouble)], 'ARB_vertex_blend')
+
+# GL/glext.h:4698
+glWeightubvARB = _link_function('glWeightubvARB', None, [GLint, POINTER(GLubyte)], 'ARB_vertex_blend')
+
+# GL/glext.h:4699
+glWeightusvARB = _link_function('glWeightusvARB', None, [GLint, POINTER(GLushort)], 'ARB_vertex_blend')
+
+# GL/glext.h:4700
+glWeightuivARB = _link_function('glWeightuivARB', None, [GLint, POINTER(GLuint)], 'ARB_vertex_blend')
+
+# GL/glext.h:4701
+glWeightPointerARB = _link_function('glWeightPointerARB', None, [GLint, GLenum, GLsizei, POINTER(GLvoid)], 'ARB_vertex_blend')
+
+# GL/glext.h:4702
+glVertexBlendARB = _link_function('glVertexBlendARB', None, [GLint], 'ARB_vertex_blend')
+
+PFNGLWEIGHTBVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLbyte)) # GL/glext.h:4704
+PFNGLWEIGHTSVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLshort)) # GL/glext.h:4705
+PFNGLWEIGHTIVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLint)) # GL/glext.h:4706
+PFNGLWEIGHTFVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLfloat)) # GL/glext.h:4707
+PFNGLWEIGHTDVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLdouble)) # GL/glext.h:4708
+PFNGLWEIGHTUBVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLubyte)) # GL/glext.h:4709
+PFNGLWEIGHTUSVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLushort)) # GL/glext.h:4710
+PFNGLWEIGHTUIVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLuint)) # GL/glext.h:4711
+PFNGLWEIGHTPOINTERARBPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:4712
+PFNGLVERTEXBLENDARBPROC = CFUNCTYPE(None, GLint) # GL/glext.h:4713
+# ARB_matrix_palette (GL/glext.h:4716)
+GL_ARB_matrix_palette = 1 # GL/glext.h:4717
+# GL/glext.h:4719
+glCurrentPaletteMatrixARB = _link_function('glCurrentPaletteMatrixARB', None, [GLint], 'ARB_matrix_palette')
+
+# GL/glext.h:4720
+glMatrixIndexubvARB = _link_function('glMatrixIndexubvARB', None, [GLint, POINTER(GLubyte)], 'ARB_matrix_palette')
+
+# GL/glext.h:4721
+glMatrixIndexusvARB = _link_function('glMatrixIndexusvARB', None, [GLint, POINTER(GLushort)], 'ARB_matrix_palette')
+
+# GL/glext.h:4722
+glMatrixIndexuivARB = _link_function('glMatrixIndexuivARB', None, [GLint, POINTER(GLuint)], 'ARB_matrix_palette')
+
+# GL/glext.h:4723
+glMatrixIndexPointerARB = _link_function('glMatrixIndexPointerARB', None, [GLint, GLenum, GLsizei, POINTER(GLvoid)], 'ARB_matrix_palette')
+
+PFNGLCURRENTPALETTEMATRIXARBPROC = CFUNCTYPE(None, GLint) # GL/glext.h:4725
+PFNGLMATRIXINDEXUBVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLubyte)) # GL/glext.h:4726
+PFNGLMATRIXINDEXUSVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLushort)) # GL/glext.h:4727
+PFNGLMATRIXINDEXUIVARBPROC = CFUNCTYPE(None, GLint, POINTER(GLuint)) # GL/glext.h:4728
+PFNGLMATRIXINDEXPOINTERARBPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:4729
+# ARB_texture_env_combine (GL/glext.h:4732)
+GL_ARB_texture_env_combine = 1 # GL/glext.h:4733
+# ARB_texture_env_crossbar (GL/glext.h:4736)
+GL_ARB_texture_env_crossbar = 1 # GL/glext.h:4737
+# ARB_texture_env_dot3 (GL/glext.h:4740)
+GL_ARB_texture_env_dot3 = 1 # GL/glext.h:4741
+# ARB_texture_mirrored_repeat (GL/glext.h:4744)
+GL_ARB_texture_mirrored_repeat = 1 # GL/glext.h:4745
+# ARB_depth_texture (GL/glext.h:4748)
+GL_ARB_depth_texture = 1 # GL/glext.h:4749
+# ARB_shadow (GL/glext.h:4752)
+GL_ARB_shadow = 1 # GL/glext.h:4753
+# ARB_shadow_ambient (GL/glext.h:4756)
+GL_ARB_shadow_ambient = 1 # GL/glext.h:4757
+# ARB_window_pos (GL/glext.h:4760)
+GL_ARB_window_pos = 1 # GL/glext.h:4761
+# GL/glext.h:4763
+glWindowPos2dARB = _link_function('glWindowPos2dARB', None, [GLdouble, GLdouble], 'ARB_window_pos')
+
+# GL/glext.h:4764
+glWindowPos2dvARB = _link_function('glWindowPos2dvARB', None, [POINTER(GLdouble)], 'ARB_window_pos')
+
+# GL/glext.h:4765
+glWindowPos2fARB = _link_function('glWindowPos2fARB', None, [GLfloat, GLfloat], 'ARB_window_pos')
+
+# GL/glext.h:4766
+glWindowPos2fvARB = _link_function('glWindowPos2fvARB', None, [POINTER(GLfloat)], 'ARB_window_pos')
+
+# GL/glext.h:4767
+glWindowPos2iARB = _link_function('glWindowPos2iARB', None, [GLint, GLint], 'ARB_window_pos')
+
+# GL/glext.h:4768
+glWindowPos2ivARB = _link_function('glWindowPos2ivARB', None, [POINTER(GLint)], 'ARB_window_pos')
+
+# GL/glext.h:4769
+glWindowPos2sARB = _link_function('glWindowPos2sARB', None, [GLshort, GLshort], 'ARB_window_pos')
+
+# GL/glext.h:4770
+glWindowPos2svARB = _link_function('glWindowPos2svARB', None, [POINTER(GLshort)], 'ARB_window_pos')
+
+# GL/glext.h:4771
+glWindowPos3dARB = _link_function('glWindowPos3dARB', None, [GLdouble, GLdouble, GLdouble], 'ARB_window_pos')
+
+# GL/glext.h:4772
+glWindowPos3dvARB = _link_function('glWindowPos3dvARB', None, [POINTER(GLdouble)], 'ARB_window_pos')
+
+# GL/glext.h:4773
+glWindowPos3fARB = _link_function('glWindowPos3fARB', None, [GLfloat, GLfloat, GLfloat], 'ARB_window_pos')
+
+# GL/glext.h:4774
+glWindowPos3fvARB = _link_function('glWindowPos3fvARB', None, [POINTER(GLfloat)], 'ARB_window_pos')
+
+# GL/glext.h:4775
+glWindowPos3iARB = _link_function('glWindowPos3iARB', None, [GLint, GLint, GLint], 'ARB_window_pos')
+
+# GL/glext.h:4776
+glWindowPos3ivARB = _link_function('glWindowPos3ivARB', None, [POINTER(GLint)], 'ARB_window_pos')
+
+# GL/glext.h:4777
+glWindowPos3sARB = _link_function('glWindowPos3sARB', None, [GLshort, GLshort, GLshort], 'ARB_window_pos')
+
+# GL/glext.h:4778
+glWindowPos3svARB = _link_function('glWindowPos3svARB', None, [POINTER(GLshort)], 'ARB_window_pos')
+
+PFNGLWINDOWPOS2DARBPROC = CFUNCTYPE(None, GLdouble, GLdouble) # GL/glext.h:4780
+PFNGLWINDOWPOS2DVARBPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:4781
+PFNGLWINDOWPOS2FARBPROC = CFUNCTYPE(None, GLfloat, GLfloat) # GL/glext.h:4782
+PFNGLWINDOWPOS2FVARBPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:4783
+PFNGLWINDOWPOS2IARBPROC = CFUNCTYPE(None, GLint, GLint) # GL/glext.h:4784
+PFNGLWINDOWPOS2IVARBPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:4785
+PFNGLWINDOWPOS2SARBPROC = CFUNCTYPE(None, GLshort, GLshort) # GL/glext.h:4786
+PFNGLWINDOWPOS2SVARBPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:4787
+PFNGLWINDOWPOS3DARBPROC = CFUNCTYPE(None, GLdouble, GLdouble, GLdouble) # GL/glext.h:4788
+PFNGLWINDOWPOS3DVARBPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:4789
+PFNGLWINDOWPOS3FARBPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat) # GL/glext.h:4790
+PFNGLWINDOWPOS3FVARBPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:4791
+PFNGLWINDOWPOS3IARBPROC = CFUNCTYPE(None, GLint, GLint, GLint) # GL/glext.h:4792
+PFNGLWINDOWPOS3IVARBPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:4793
+PFNGLWINDOWPOS3SARBPROC = CFUNCTYPE(None, GLshort, GLshort, GLshort) # GL/glext.h:4794
+PFNGLWINDOWPOS3SVARBPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:4795
+# ARB_vertex_program (GL/glext.h:4798)
+GL_ARB_vertex_program = 1 # GL/glext.h:4799
+# GL/glext.h:4801
+glVertexAttrib1dARB = _link_function('glVertexAttrib1dARB', None, [GLuint, GLdouble], 'ARB_vertex_program')
+
+# GL/glext.h:4802
+glVertexAttrib1dvARB = _link_function('glVertexAttrib1dvARB', None, [GLuint, POINTER(GLdouble)], 'ARB_vertex_program')
+
+# GL/glext.h:4803
+glVertexAttrib1fARB = _link_function('glVertexAttrib1fARB', None, [GLuint, GLfloat], 'ARB_vertex_program')
+
+# GL/glext.h:4804
+glVertexAttrib1fvARB = _link_function('glVertexAttrib1fvARB', None, [GLuint, POINTER(GLfloat)], 'ARB_vertex_program')
+
+# GL/glext.h:4805
+glVertexAttrib1sARB = _link_function('glVertexAttrib1sARB', None, [GLuint, GLshort], 'ARB_vertex_program')
+
+# GL/glext.h:4806
+glVertexAttrib1svARB = _link_function('glVertexAttrib1svARB', None, [GLuint, POINTER(GLshort)], 'ARB_vertex_program')
+
+# GL/glext.h:4807
+glVertexAttrib2dARB = _link_function('glVertexAttrib2dARB', None, [GLuint, GLdouble, GLdouble], 'ARB_vertex_program')
+
+# GL/glext.h:4808
+glVertexAttrib2dvARB = _link_function('glVertexAttrib2dvARB', None, [GLuint, POINTER(GLdouble)], 'ARB_vertex_program')
+
+# GL/glext.h:4809
+glVertexAttrib2fARB = _link_function('glVertexAttrib2fARB', None, [GLuint, GLfloat, GLfloat], 'ARB_vertex_program')
+
+# GL/glext.h:4810
+glVertexAttrib2fvARB = _link_function('glVertexAttrib2fvARB', None, [GLuint, POINTER(GLfloat)], 'ARB_vertex_program')
+
+# GL/glext.h:4811
+glVertexAttrib2sARB = _link_function('glVertexAttrib2sARB', None, [GLuint, GLshort, GLshort], 'ARB_vertex_program')
+
+# GL/glext.h:4812
+glVertexAttrib2svARB = _link_function('glVertexAttrib2svARB', None, [GLuint, POINTER(GLshort)], 'ARB_vertex_program')
+
+# GL/glext.h:4813
+glVertexAttrib3dARB = _link_function('glVertexAttrib3dARB', None, [GLuint, GLdouble, GLdouble, GLdouble], 'ARB_vertex_program')
+
+# GL/glext.h:4814
+glVertexAttrib3dvARB = _link_function('glVertexAttrib3dvARB', None, [GLuint, POINTER(GLdouble)], 'ARB_vertex_program')
+
+# GL/glext.h:4815
+glVertexAttrib3fARB = _link_function('glVertexAttrib3fARB', None, [GLuint, GLfloat, GLfloat, GLfloat], 'ARB_vertex_program')
+
+# GL/glext.h:4816
+glVertexAttrib3fvARB = _link_function('glVertexAttrib3fvARB', None, [GLuint, POINTER(GLfloat)], 'ARB_vertex_program')
+
+# GL/glext.h:4817
+glVertexAttrib3sARB = _link_function('glVertexAttrib3sARB', None, [GLuint, GLshort, GLshort, GLshort], 'ARB_vertex_program')
+
+# GL/glext.h:4818
+glVertexAttrib3svARB = _link_function('glVertexAttrib3svARB', None, [GLuint, POINTER(GLshort)], 'ARB_vertex_program')
+
+# GL/glext.h:4819
+glVertexAttrib4NbvARB = _link_function('glVertexAttrib4NbvARB', None, [GLuint, POINTER(GLbyte)], 'ARB_vertex_program')
+
+# GL/glext.h:4820
+glVertexAttrib4NivARB = _link_function('glVertexAttrib4NivARB', None, [GLuint, POINTER(GLint)], 'ARB_vertex_program')
+
+# GL/glext.h:4821
+glVertexAttrib4NsvARB = _link_function('glVertexAttrib4NsvARB', None, [GLuint, POINTER(GLshort)], 'ARB_vertex_program')
+
+# GL/glext.h:4822
+glVertexAttrib4NubARB = _link_function('glVertexAttrib4NubARB', None, [GLuint, GLubyte, GLubyte, GLubyte, GLubyte], 'ARB_vertex_program')
+
+# GL/glext.h:4823
+glVertexAttrib4NubvARB = _link_function('glVertexAttrib4NubvARB', None, [GLuint, POINTER(GLubyte)], 'ARB_vertex_program')
+
+# GL/glext.h:4824
+glVertexAttrib4NuivARB = _link_function('glVertexAttrib4NuivARB', None, [GLuint, POINTER(GLuint)], 'ARB_vertex_program')
+
+# GL/glext.h:4825
+glVertexAttrib4NusvARB = _link_function('glVertexAttrib4NusvARB', None, [GLuint, POINTER(GLushort)], 'ARB_vertex_program')
+
+# GL/glext.h:4826
+glVertexAttrib4bvARB = _link_function('glVertexAttrib4bvARB', None, [GLuint, POINTER(GLbyte)], 'ARB_vertex_program')
+
+# GL/glext.h:4827
+glVertexAttrib4dARB = _link_function('glVertexAttrib4dARB', None, [GLuint, GLdouble, GLdouble, GLdouble, GLdouble], 'ARB_vertex_program')
+
+# GL/glext.h:4828
+glVertexAttrib4dvARB = _link_function('glVertexAttrib4dvARB', None, [GLuint, POINTER(GLdouble)], 'ARB_vertex_program')
+
+# GL/glext.h:4829
+glVertexAttrib4fARB = _link_function('glVertexAttrib4fARB', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat], 'ARB_vertex_program')
+
+# GL/glext.h:4830
+glVertexAttrib4fvARB = _link_function('glVertexAttrib4fvARB', None, [GLuint, POINTER(GLfloat)], 'ARB_vertex_program')
+
+# GL/glext.h:4831
+glVertexAttrib4ivARB = _link_function('glVertexAttrib4ivARB', None, [GLuint, POINTER(GLint)], 'ARB_vertex_program')
+
+# GL/glext.h:4832
+glVertexAttrib4sARB = _link_function('glVertexAttrib4sARB', None, [GLuint, GLshort, GLshort, GLshort, GLshort], 'ARB_vertex_program')
+
+# GL/glext.h:4833
+glVertexAttrib4svARB = _link_function('glVertexAttrib4svARB', None, [GLuint, POINTER(GLshort)], 'ARB_vertex_program')
+
+# GL/glext.h:4834
+glVertexAttrib4ubvARB = _link_function('glVertexAttrib4ubvARB', None, [GLuint, POINTER(GLubyte)], 'ARB_vertex_program')
+
+# GL/glext.h:4835
+glVertexAttrib4uivARB = _link_function('glVertexAttrib4uivARB', None, [GLuint, POINTER(GLuint)], 'ARB_vertex_program')
+
+# GL/glext.h:4836
+glVertexAttrib4usvARB = _link_function('glVertexAttrib4usvARB', None, [GLuint, POINTER(GLushort)], 'ARB_vertex_program')
+
+# GL/glext.h:4837
+glVertexAttribPointerARB = _link_function('glVertexAttribPointerARB', None, [GLuint, GLint, GLenum, GLboolean, GLsizei, POINTER(GLvoid)], 'ARB_vertex_program')
+
+# GL/glext.h:4838
+glEnableVertexAttribArrayARB = _link_function('glEnableVertexAttribArrayARB', None, [GLuint], 'ARB_vertex_program')
+
+# GL/glext.h:4839
+glDisableVertexAttribArrayARB = _link_function('glDisableVertexAttribArrayARB', None, [GLuint], 'ARB_vertex_program')
+
+# GL/glext.h:4840
+glProgramStringARB = _link_function('glProgramStringARB', None, [GLenum, GLenum, GLsizei, POINTER(GLvoid)], 'ARB_vertex_program')
+
+# GL/glext.h:4841
+glBindProgramARB = _link_function('glBindProgramARB', None, [GLenum, GLuint], 'ARB_vertex_program')
+
+# GL/glext.h:4842
+glDeleteProgramsARB = _link_function('glDeleteProgramsARB', None, [GLsizei, POINTER(GLuint)], 'ARB_vertex_program')
+
+# GL/glext.h:4843
+glGenProgramsARB = _link_function('glGenProgramsARB', None, [GLsizei, POINTER(GLuint)], 'ARB_vertex_program')
+
+# GL/glext.h:4844
+glProgramEnvParameter4dARB = _link_function('glProgramEnvParameter4dARB', None, [GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble], 'ARB_vertex_program')
+
+# GL/glext.h:4845
+glProgramEnvParameter4dvARB = _link_function('glProgramEnvParameter4dvARB', None, [GLenum, GLuint, POINTER(GLdouble)], 'ARB_vertex_program')
+
+# GL/glext.h:4846
+glProgramEnvParameter4fARB = _link_function('glProgramEnvParameter4fARB', None, [GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat], 'ARB_vertex_program')
+
+# GL/glext.h:4847
+glProgramEnvParameter4fvARB = _link_function('glProgramEnvParameter4fvARB', None, [GLenum, GLuint, POINTER(GLfloat)], 'ARB_vertex_program')
+
+# GL/glext.h:4848
+glProgramLocalParameter4dARB = _link_function('glProgramLocalParameter4dARB', None, [GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble], 'ARB_vertex_program')
+
+# GL/glext.h:4849
+glProgramLocalParameter4dvARB = _link_function('glProgramLocalParameter4dvARB', None, [GLenum, GLuint, POINTER(GLdouble)], 'ARB_vertex_program')
+
+# GL/glext.h:4850
+glProgramLocalParameter4fARB = _link_function('glProgramLocalParameter4fARB', None, [GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat], 'ARB_vertex_program')
+
+# GL/glext.h:4851
+glProgramLocalParameter4fvARB = _link_function('glProgramLocalParameter4fvARB', None, [GLenum, GLuint, POINTER(GLfloat)], 'ARB_vertex_program')
+
+# GL/glext.h:4852
+glGetProgramEnvParameterdvARB = _link_function('glGetProgramEnvParameterdvARB', None, [GLenum, GLuint, POINTER(GLdouble)], 'ARB_vertex_program')
+
+# GL/glext.h:4853
+glGetProgramEnvParameterfvARB = _link_function('glGetProgramEnvParameterfvARB', None, [GLenum, GLuint, POINTER(GLfloat)], 'ARB_vertex_program')
+
+# GL/glext.h:4854
+glGetProgramLocalParameterdvARB = _link_function('glGetProgramLocalParameterdvARB', None, [GLenum, GLuint, POINTER(GLdouble)], 'ARB_vertex_program')
+
+# GL/glext.h:4855
+glGetProgramLocalParameterfvARB = _link_function('glGetProgramLocalParameterfvARB', None, [GLenum, GLuint, POINTER(GLfloat)], 'ARB_vertex_program')
+
+# GL/glext.h:4856
+glGetProgramivARB = _link_function('glGetProgramivARB', None, [GLenum, GLenum, POINTER(GLint)], 'ARB_vertex_program')
+
+# GL/glext.h:4857
+glGetProgramStringARB = _link_function('glGetProgramStringARB', None, [GLenum, GLenum, POINTER(GLvoid)], 'ARB_vertex_program')
+
+# GL/glext.h:4858
+glGetVertexAttribdvARB = _link_function('glGetVertexAttribdvARB', None, [GLuint, GLenum, POINTER(GLdouble)], 'ARB_vertex_program')
+
+# GL/glext.h:4859
+glGetVertexAttribfvARB = _link_function('glGetVertexAttribfvARB', None, [GLuint, GLenum, POINTER(GLfloat)], 'ARB_vertex_program')
+
+# GL/glext.h:4860
+glGetVertexAttribivARB = _link_function('glGetVertexAttribivARB', None, [GLuint, GLenum, POINTER(GLint)], 'ARB_vertex_program')
+
+# GL/glext.h:4861
+glGetVertexAttribPointervARB = _link_function('glGetVertexAttribPointervARB', None, [GLuint, GLenum, POINTER(POINTER(GLvoid))], 'ARB_vertex_program')
+
+# GL/glext.h:4862
+glIsProgramARB = _link_function('glIsProgramARB', GLboolean, [GLuint], 'ARB_vertex_program')
+
+PFNGLVERTEXATTRIB1DARBPROC = CFUNCTYPE(None, GLuint, GLdouble) # GL/glext.h:4864
+PFNGLVERTEXATTRIB1DVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:4865
+PFNGLVERTEXATTRIB1FARBPROC = CFUNCTYPE(None, GLuint, GLfloat) # GL/glext.h:4866
+PFNGLVERTEXATTRIB1FVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:4867
+PFNGLVERTEXATTRIB1SARBPROC = CFUNCTYPE(None, GLuint, GLshort) # GL/glext.h:4868
+PFNGLVERTEXATTRIB1SVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:4869
+PFNGLVERTEXATTRIB2DARBPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble) # GL/glext.h:4870
+PFNGLVERTEXATTRIB2DVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:4871
+PFNGLVERTEXATTRIB2FARBPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat) # GL/glext.h:4872
+PFNGLVERTEXATTRIB2FVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:4873
+PFNGLVERTEXATTRIB2SARBPROC = CFUNCTYPE(None, GLuint, GLshort, GLshort) # GL/glext.h:4874
+PFNGLVERTEXATTRIB2SVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:4875
+PFNGLVERTEXATTRIB3DARBPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble, GLdouble) # GL/glext.h:4876
+PFNGLVERTEXATTRIB3DVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:4877
+PFNGLVERTEXATTRIB3FARBPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat) # GL/glext.h:4878
+PFNGLVERTEXATTRIB3FVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:4879
+PFNGLVERTEXATTRIB3SARBPROC = CFUNCTYPE(None, GLuint, GLshort, GLshort, GLshort) # GL/glext.h:4880
+PFNGLVERTEXATTRIB3SVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:4881
+PFNGLVERTEXATTRIB4NBVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLbyte)) # GL/glext.h:4882
+PFNGLVERTEXATTRIB4NIVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:4883
+PFNGLVERTEXATTRIB4NSVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:4884
+PFNGLVERTEXATTRIB4NUBARBPROC = CFUNCTYPE(None, GLuint, GLubyte, GLubyte, GLubyte, GLubyte) # GL/glext.h:4885
+PFNGLVERTEXATTRIB4NUBVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLubyte)) # GL/glext.h:4886
+PFNGLVERTEXATTRIB4NUIVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:4887
+PFNGLVERTEXATTRIB4NUSVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLushort)) # GL/glext.h:4888
+PFNGLVERTEXATTRIB4BVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLbyte)) # GL/glext.h:4889
+PFNGLVERTEXATTRIB4DARBPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:4890
+PFNGLVERTEXATTRIB4DVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:4891
+PFNGLVERTEXATTRIB4FARBPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:4892
+PFNGLVERTEXATTRIB4FVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:4893
+PFNGLVERTEXATTRIB4IVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:4894
+PFNGLVERTEXATTRIB4SARBPROC = CFUNCTYPE(None, GLuint, GLshort, GLshort, GLshort, GLshort) # GL/glext.h:4895
+PFNGLVERTEXATTRIB4SVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:4896
+PFNGLVERTEXATTRIB4UBVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLubyte)) # GL/glext.h:4897
+PFNGLVERTEXATTRIB4UIVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:4898
+PFNGLVERTEXATTRIB4USVARBPROC = CFUNCTYPE(None, GLuint, POINTER(GLushort)) # GL/glext.h:4899
+PFNGLVERTEXATTRIBPOINTERARBPROC = CFUNCTYPE(None, GLuint, GLint, GLenum, GLboolean, GLsizei, POINTER(GLvoid)) # GL/glext.h:4900
+PFNGLENABLEVERTEXATTRIBARRAYARBPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:4901
+PFNGLDISABLEVERTEXATTRIBARRAYARBPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:4902
+PFNGLPROGRAMSTRINGARBPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:4903
+PFNGLBINDPROGRAMARBPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:4904
+PFNGLDELETEPROGRAMSARBPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:4905
+PFNGLGENPROGRAMSARBPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:4906
+PFNGLPROGRAMENVPARAMETER4DARBPROC = CFUNCTYPE(None, GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:4907
+PFNGLPROGRAMENVPARAMETER4DVARBPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLdouble)) # GL/glext.h:4908
+PFNGLPROGRAMENVPARAMETER4FARBPROC = CFUNCTYPE(None, GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:4909
+PFNGLPROGRAMENVPARAMETER4FVARBPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:4910
+PFNGLPROGRAMLOCALPARAMETER4DARBPROC = CFUNCTYPE(None, GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:4911
+PFNGLPROGRAMLOCALPARAMETER4DVARBPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLdouble)) # GL/glext.h:4912
+PFNGLPROGRAMLOCALPARAMETER4FARBPROC = CFUNCTYPE(None, GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:4913
+PFNGLPROGRAMLOCALPARAMETER4FVARBPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:4914
+PFNGLGETPROGRAMENVPARAMETERDVARBPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLdouble)) # GL/glext.h:4915
+PFNGLGETPROGRAMENVPARAMETERFVARBPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:4916
+PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLdouble)) # GL/glext.h:4917
+PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:4918
+PFNGLGETPROGRAMIVARBPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:4919
+PFNGLGETPROGRAMSTRINGARBPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:4920
+PFNGLGETVERTEXATTRIBDVARBPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLdouble)) # GL/glext.h:4921
+PFNGLGETVERTEXATTRIBFVARBPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:4922
+PFNGLGETVERTEXATTRIBIVARBPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:4923
+PFNGLGETVERTEXATTRIBPOINTERVARBPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:4924
+PFNGLISPROGRAMARBPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:4925
+# ARB_fragment_program (GL/glext.h:4928)
+GL_ARB_fragment_program = 1 # GL/glext.h:4929
+# ARB_vertex_buffer_object (GL/glext.h:4933)
+GL_ARB_vertex_buffer_object = 1 # GL/glext.h:4934
+# GL/glext.h:4936
+glBindBufferARB = _link_function('glBindBufferARB', None, [GLenum, GLuint], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:4937
+glDeleteBuffersARB = _link_function('glDeleteBuffersARB', None, [GLsizei, POINTER(GLuint)], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:4938
+glGenBuffersARB = _link_function('glGenBuffersARB', None, [GLsizei, POINTER(GLuint)], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:4939
+glIsBufferARB = _link_function('glIsBufferARB', GLboolean, [GLuint], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:4940
+glBufferDataARB = _link_function('glBufferDataARB', None, [GLenum, GLsizeiptrARB, POINTER(GLvoid), GLenum], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:4941
+glBufferSubDataARB = _link_function('glBufferSubDataARB', None, [GLenum, GLintptrARB, GLsizeiptrARB, POINTER(GLvoid)], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:4942
+glGetBufferSubDataARB = _link_function('glGetBufferSubDataARB', None, [GLenum, GLintptrARB, GLsizeiptrARB, POINTER(GLvoid)], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:4943
+glMapBufferARB = _link_function('glMapBufferARB', POINTER(GLvoid), [GLenum, GLenum], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:4944
+glUnmapBufferARB = _link_function('glUnmapBufferARB', GLboolean, [GLenum], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:4945
+glGetBufferParameterivARB = _link_function('glGetBufferParameterivARB', None, [GLenum, GLenum, POINTER(GLint)], 'ARB_vertex_buffer_object')
+
+# GL/glext.h:4946
+glGetBufferPointervARB = _link_function('glGetBufferPointervARB', None, [GLenum, GLenum, POINTER(POINTER(GLvoid))], 'ARB_vertex_buffer_object')
+
+PFNGLBINDBUFFERARBPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:4948
+PFNGLDELETEBUFFERSARBPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:4949
+PFNGLGENBUFFERSARBPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:4950
+PFNGLISBUFFERARBPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:4951
+PFNGLBUFFERDATAARBPROC = CFUNCTYPE(None, GLenum, GLsizeiptrARB, POINTER(GLvoid), GLenum) # GL/glext.h:4952
+PFNGLBUFFERSUBDATAARBPROC = CFUNCTYPE(None, GLenum, GLintptrARB, GLsizeiptrARB, POINTER(GLvoid)) # GL/glext.h:4953
+PFNGLGETBUFFERSUBDATAARBPROC = CFUNCTYPE(None, GLenum, GLintptrARB, GLsizeiptrARB, POINTER(GLvoid)) # GL/glext.h:4954
+PFNGLMAPBUFFERARBPROC = CFUNCTYPE(POINTER(GLvoid), GLenum, GLenum) # GL/glext.h:4955
+PFNGLUNMAPBUFFERARBPROC = CFUNCTYPE(GLboolean, GLenum) # GL/glext.h:4956
+PFNGLGETBUFFERPARAMETERIVARBPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:4957
+PFNGLGETBUFFERPOINTERVARBPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:4958
+# ARB_occlusion_query (GL/glext.h:4961)
+GL_ARB_occlusion_query = 1 # GL/glext.h:4962
+# GL/glext.h:4964
+glGenQueriesARB = _link_function('glGenQueriesARB', None, [GLsizei, POINTER(GLuint)], 'ARB_occlusion_query')
+
+# GL/glext.h:4965
+glDeleteQueriesARB = _link_function('glDeleteQueriesARB', None, [GLsizei, POINTER(GLuint)], 'ARB_occlusion_query')
+
+# GL/glext.h:4966
+glIsQueryARB = _link_function('glIsQueryARB', GLboolean, [GLuint], 'ARB_occlusion_query')
+
+# GL/glext.h:4967
+glBeginQueryARB = _link_function('glBeginQueryARB', None, [GLenum, GLuint], 'ARB_occlusion_query')
+
+# GL/glext.h:4968
+glEndQueryARB = _link_function('glEndQueryARB', None, [GLenum], 'ARB_occlusion_query')
+
+# GL/glext.h:4969
+glGetQueryivARB = _link_function('glGetQueryivARB', None, [GLenum, GLenum, POINTER(GLint)], 'ARB_occlusion_query')
+
+# GL/glext.h:4970
+glGetQueryObjectivARB = _link_function('glGetQueryObjectivARB', None, [GLuint, GLenum, POINTER(GLint)], 'ARB_occlusion_query')
+
+# GL/glext.h:4971
+glGetQueryObjectuivARB = _link_function('glGetQueryObjectuivARB', None, [GLuint, GLenum, POINTER(GLuint)], 'ARB_occlusion_query')
+
+PFNGLGENQUERIESARBPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:4973
+PFNGLDELETEQUERIESARBPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:4974
+PFNGLISQUERYARBPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:4975
+PFNGLBEGINQUERYARBPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:4976
+PFNGLENDQUERYARBPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:4977
+PFNGLGETQUERYIVARBPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:4978
+PFNGLGETQUERYOBJECTIVARBPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:4979
+PFNGLGETQUERYOBJECTUIVARBPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint)) # GL/glext.h:4980
+# ARB_shader_objects (GL/glext.h:4983)
+GL_ARB_shader_objects = 1 # GL/glext.h:4984
+# GL/glext.h:4986
+glDeleteObjectARB = _link_function('glDeleteObjectARB', None, [GLhandleARB], 'ARB_shader_objects')
+
+# GL/glext.h:4987
+glGetHandleARB = _link_function('glGetHandleARB', GLhandleARB, [GLenum], 'ARB_shader_objects')
+
+# GL/glext.h:4988
+glDetachObjectARB = _link_function('glDetachObjectARB', None, [GLhandleARB, GLhandleARB], 'ARB_shader_objects')
+
+# GL/glext.h:4989
+glCreateShaderObjectARB = _link_function('glCreateShaderObjectARB', GLhandleARB, [GLenum], 'ARB_shader_objects')
+
+# GL/glext.h:4990
+glShaderSourceARB = _link_function('glShaderSourceARB', None, [GLhandleARB, GLsizei, POINTER(POINTER(GLcharARB)), POINTER(GLint)], 'ARB_shader_objects')
+
+# GL/glext.h:4991
+glCompileShaderARB = _link_function('glCompileShaderARB', None, [GLhandleARB], 'ARB_shader_objects')
+
+# GL/glext.h:4992
+glCreateProgramObjectARB = _link_function('glCreateProgramObjectARB', GLhandleARB, [], 'ARB_shader_objects')
+
+# GL/glext.h:4993
+glAttachObjectARB = _link_function('glAttachObjectARB', None, [GLhandleARB, GLhandleARB], 'ARB_shader_objects')
+
+# GL/glext.h:4994
+glLinkProgramARB = _link_function('glLinkProgramARB', None, [GLhandleARB], 'ARB_shader_objects')
+
+# GL/glext.h:4995
+glUseProgramObjectARB = _link_function('glUseProgramObjectARB', None, [GLhandleARB], 'ARB_shader_objects')
+
+# GL/glext.h:4996
+glValidateProgramARB = _link_function('glValidateProgramARB', None, [GLhandleARB], 'ARB_shader_objects')
+
+# GL/glext.h:4997
+glUniform1fARB = _link_function('glUniform1fARB', None, [GLint, GLfloat], 'ARB_shader_objects')
+
+# GL/glext.h:4998
+glUniform2fARB = _link_function('glUniform2fARB', None, [GLint, GLfloat, GLfloat], 'ARB_shader_objects')
+
+# GL/glext.h:4999
+glUniform3fARB = _link_function('glUniform3fARB', None, [GLint, GLfloat, GLfloat, GLfloat], 'ARB_shader_objects')
+
+# GL/glext.h:5000
+glUniform4fARB = _link_function('glUniform4fARB', None, [GLint, GLfloat, GLfloat, GLfloat, GLfloat], 'ARB_shader_objects')
+
+# GL/glext.h:5001
+glUniform1iARB = _link_function('glUniform1iARB', None, [GLint, GLint], 'ARB_shader_objects')
+
+# GL/glext.h:5002
+glUniform2iARB = _link_function('glUniform2iARB', None, [GLint, GLint, GLint], 'ARB_shader_objects')
+
+# GL/glext.h:5003
+glUniform3iARB = _link_function('glUniform3iARB', None, [GLint, GLint, GLint, GLint], 'ARB_shader_objects')
+
+# GL/glext.h:5004
+glUniform4iARB = _link_function('glUniform4iARB', None, [GLint, GLint, GLint, GLint, GLint], 'ARB_shader_objects')
+
+# GL/glext.h:5005
+glUniform1fvARB = _link_function('glUniform1fvARB', None, [GLint, GLsizei, POINTER(GLfloat)], 'ARB_shader_objects')
+
+# GL/glext.h:5006
+glUniform2fvARB = _link_function('glUniform2fvARB', None, [GLint, GLsizei, POINTER(GLfloat)], 'ARB_shader_objects')
+
+# GL/glext.h:5007
+glUniform3fvARB = _link_function('glUniform3fvARB', None, [GLint, GLsizei, POINTER(GLfloat)], 'ARB_shader_objects')
+
+# GL/glext.h:5008
+glUniform4fvARB = _link_function('glUniform4fvARB', None, [GLint, GLsizei, POINTER(GLfloat)], 'ARB_shader_objects')
+
+# GL/glext.h:5009
+glUniform1ivARB = _link_function('glUniform1ivARB', None, [GLint, GLsizei, POINTER(GLint)], 'ARB_shader_objects')
+
+# GL/glext.h:5010
+glUniform2ivARB = _link_function('glUniform2ivARB', None, [GLint, GLsizei, POINTER(GLint)], 'ARB_shader_objects')
+
+# GL/glext.h:5011
+glUniform3ivARB = _link_function('glUniform3ivARB', None, [GLint, GLsizei, POINTER(GLint)], 'ARB_shader_objects')
+
+# GL/glext.h:5012
+glUniform4ivARB = _link_function('glUniform4ivARB', None, [GLint, GLsizei, POINTER(GLint)], 'ARB_shader_objects')
+
+# GL/glext.h:5013
+glUniformMatrix2fvARB = _link_function('glUniformMatrix2fvARB', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'ARB_shader_objects')
+
+# GL/glext.h:5014
+glUniformMatrix3fvARB = _link_function('glUniformMatrix3fvARB', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'ARB_shader_objects')
+
+# GL/glext.h:5015
+glUniformMatrix4fvARB = _link_function('glUniformMatrix4fvARB', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'ARB_shader_objects')
+
+# GL/glext.h:5016
+glGetObjectParameterfvARB = _link_function('glGetObjectParameterfvARB', None, [GLhandleARB, GLenum, POINTER(GLfloat)], 'ARB_shader_objects')
+
+# GL/glext.h:5017
+glGetObjectParameterivARB = _link_function('glGetObjectParameterivARB', None, [GLhandleARB, GLenum, POINTER(GLint)], 'ARB_shader_objects')
+
+# GL/glext.h:5018
+glGetInfoLogARB = _link_function('glGetInfoLogARB', None, [GLhandleARB, GLsizei, POINTER(GLsizei), POINTER(GLcharARB)], 'ARB_shader_objects')
+
+# GL/glext.h:5019
+glGetAttachedObjectsARB = _link_function('glGetAttachedObjectsARB', None, [GLhandleARB, GLsizei, POINTER(GLsizei), POINTER(GLhandleARB)], 'ARB_shader_objects')
+
+# GL/glext.h:5020
+glGetUniformLocationARB = _link_function('glGetUniformLocationARB', GLint, [GLhandleARB, POINTER(GLcharARB)], 'ARB_shader_objects')
+
+# GL/glext.h:5021
+glGetActiveUniformARB = _link_function('glGetActiveUniformARB', None, [GLhandleARB, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLcharARB)], 'ARB_shader_objects')
+
+# GL/glext.h:5022
+glGetUniformfvARB = _link_function('glGetUniformfvARB', None, [GLhandleARB, GLint, POINTER(GLfloat)], 'ARB_shader_objects')
+
+# GL/glext.h:5023
+glGetUniformivARB = _link_function('glGetUniformivARB', None, [GLhandleARB, GLint, POINTER(GLint)], 'ARB_shader_objects')
+
+# GL/glext.h:5024
+glGetShaderSourceARB = _link_function('glGetShaderSourceARB', None, [GLhandleARB, GLsizei, POINTER(GLsizei), POINTER(GLcharARB)], 'ARB_shader_objects')
+
+PFNGLDELETEOBJECTARBPROC = CFUNCTYPE(None, GLhandleARB) # GL/glext.h:5026
+PFNGLGETHANDLEARBPROC = CFUNCTYPE(GLhandleARB, GLenum) # GL/glext.h:5027
+PFNGLDETACHOBJECTARBPROC = CFUNCTYPE(None, GLhandleARB, GLhandleARB) # GL/glext.h:5028
+PFNGLCREATESHADEROBJECTARBPROC = CFUNCTYPE(GLhandleARB, GLenum) # GL/glext.h:5029
+PFNGLSHADERSOURCEARBPROC = CFUNCTYPE(None, GLhandleARB, GLsizei, POINTER(POINTER(GLcharARB)), POINTER(GLint)) # GL/glext.h:5030
+PFNGLCOMPILESHADERARBPROC = CFUNCTYPE(None, GLhandleARB) # GL/glext.h:5031
+PFNGLCREATEPROGRAMOBJECTARBPROC = CFUNCTYPE(GLhandleARB) # GL/glext.h:5032
+PFNGLATTACHOBJECTARBPROC = CFUNCTYPE(None, GLhandleARB, GLhandleARB) # GL/glext.h:5033
+PFNGLLINKPROGRAMARBPROC = CFUNCTYPE(None, GLhandleARB) # GL/glext.h:5034
+PFNGLUSEPROGRAMOBJECTARBPROC = CFUNCTYPE(None, GLhandleARB) # GL/glext.h:5035
+PFNGLVALIDATEPROGRAMARBPROC = CFUNCTYPE(None, GLhandleARB) # GL/glext.h:5036
+PFNGLUNIFORM1FARBPROC = CFUNCTYPE(None, GLint, GLfloat) # GL/glext.h:5037
+PFNGLUNIFORM2FARBPROC = CFUNCTYPE(None, GLint, GLfloat, GLfloat) # GL/glext.h:5038
+PFNGLUNIFORM3FARBPROC = CFUNCTYPE(None, GLint, GLfloat, GLfloat, GLfloat) # GL/glext.h:5039
+PFNGLUNIFORM4FARBPROC = CFUNCTYPE(None, GLint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:5040
+PFNGLUNIFORM1IARBPROC = CFUNCTYPE(None, GLint, GLint) # GL/glext.h:5041
+PFNGLUNIFORM2IARBPROC = CFUNCTYPE(None, GLint, GLint, GLint) # GL/glext.h:5042
+PFNGLUNIFORM3IARBPROC = CFUNCTYPE(None, GLint, GLint, GLint, GLint) # GL/glext.h:5043
+PFNGLUNIFORM4IARBPROC = CFUNCTYPE(None, GLint, GLint, GLint, GLint, GLint) # GL/glext.h:5044
+PFNGLUNIFORM1FVARBPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:5045
+PFNGLUNIFORM2FVARBPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:5046
+PFNGLUNIFORM3FVARBPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:5047
+PFNGLUNIFORM4FVARBPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:5048
+PFNGLUNIFORM1IVARBPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:5049
+PFNGLUNIFORM2IVARBPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:5050
+PFNGLUNIFORM3IVARBPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:5051
+PFNGLUNIFORM4IVARBPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:5052
+PFNGLUNIFORMMATRIX2FVARBPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:5053
+PFNGLUNIFORMMATRIX3FVARBPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:5054
+PFNGLUNIFORMMATRIX4FVARBPROC = CFUNCTYPE(None, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:5055
+PFNGLGETOBJECTPARAMETERFVARBPROC = CFUNCTYPE(None, GLhandleARB, GLenum, POINTER(GLfloat)) # GL/glext.h:5056
+PFNGLGETOBJECTPARAMETERIVARBPROC = CFUNCTYPE(None, GLhandleARB, GLenum, POINTER(GLint)) # GL/glext.h:5057
+PFNGLGETINFOLOGARBPROC = CFUNCTYPE(None, GLhandleARB, GLsizei, POINTER(GLsizei), POINTER(GLcharARB)) # GL/glext.h:5058
+PFNGLGETATTACHEDOBJECTSARBPROC = CFUNCTYPE(None, GLhandleARB, GLsizei, POINTER(GLsizei), POINTER(GLhandleARB)) # GL/glext.h:5059
+PFNGLGETUNIFORMLOCATIONARBPROC = CFUNCTYPE(GLint, GLhandleARB, POINTER(GLcharARB)) # GL/glext.h:5060
+PFNGLGETACTIVEUNIFORMARBPROC = CFUNCTYPE(None, GLhandleARB, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLcharARB)) # GL/glext.h:5061
+PFNGLGETUNIFORMFVARBPROC = CFUNCTYPE(None, GLhandleARB, GLint, POINTER(GLfloat)) # GL/glext.h:5062
+PFNGLGETUNIFORMIVARBPROC = CFUNCTYPE(None, GLhandleARB, GLint, POINTER(GLint)) # GL/glext.h:5063
+PFNGLGETSHADERSOURCEARBPROC = CFUNCTYPE(None, GLhandleARB, GLsizei, POINTER(GLsizei), POINTER(GLcharARB)) # GL/glext.h:5064
+# ARB_vertex_shader (GL/glext.h:5067)
+GL_ARB_vertex_shader = 1 # GL/glext.h:5068
+# GL/glext.h:5070
+glBindAttribLocationARB = _link_function('glBindAttribLocationARB', None, [GLhandleARB, GLuint, POINTER(GLcharARB)], 'ARB_vertex_shader')
+
+# GL/glext.h:5071
+glGetActiveAttribARB = _link_function('glGetActiveAttribARB', None, [GLhandleARB, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLcharARB)], 'ARB_vertex_shader')
+
+# GL/glext.h:5072
+glGetAttribLocationARB = _link_function('glGetAttribLocationARB', GLint, [GLhandleARB, POINTER(GLcharARB)], 'ARB_vertex_shader')
+
+PFNGLBINDATTRIBLOCATIONARBPROC = CFUNCTYPE(None, GLhandleARB, GLuint, POINTER(GLcharARB)) # GL/glext.h:5074
+PFNGLGETACTIVEATTRIBARBPROC = CFUNCTYPE(None, GLhandleARB, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLcharARB)) # GL/glext.h:5075
+PFNGLGETATTRIBLOCATIONARBPROC = CFUNCTYPE(GLint, GLhandleARB, POINTER(GLcharARB)) # GL/glext.h:5076
+# ARB_fragment_shader (GL/glext.h:5079)
+GL_ARB_fragment_shader = 1 # GL/glext.h:5080
+# ARB_shading_language_100 (GL/glext.h:5083)
+GL_ARB_shading_language_100 = 1 # GL/glext.h:5084
+# ARB_texture_non_power_of_two (GL/glext.h:5087)
+GL_ARB_texture_non_power_of_two = 1 # GL/glext.h:5088
+# ARB_point_sprite (GL/glext.h:5091)
+GL_ARB_point_sprite = 1 # GL/glext.h:5092
+# ARB_fragment_program_shadow (GL/glext.h:5095)
+GL_ARB_fragment_program_shadow = 1 # GL/glext.h:5096
+# ARB_draw_buffers (GL/glext.h:5099)
+GL_ARB_draw_buffers = 1 # GL/glext.h:5100
+# GL/glext.h:5102
+glDrawBuffersARB = _link_function('glDrawBuffersARB', None, [GLsizei, POINTER(GLenum)], 'ARB_draw_buffers')
+
+PFNGLDRAWBUFFERSARBPROC = CFUNCTYPE(None, GLsizei, POINTER(GLenum)) # GL/glext.h:5104
+# ARB_texture_rectangle (GL/glext.h:5107)
+GL_ARB_texture_rectangle = 1 # GL/glext.h:5108
+# ARB_color_buffer_float (GL/glext.h:5111)
+GL_ARB_color_buffer_float = 1 # GL/glext.h:5112
+# GL/glext.h:5114
+glClampColorARB = _link_function('glClampColorARB', None, [GLenum, GLenum], 'ARB_color_buffer_float')
+
+PFNGLCLAMPCOLORARBPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:5116
+# ARB_half_float_pixel (GL/glext.h:5119)
+GL_ARB_half_float_pixel = 1 # GL/glext.h:5120
+# ARB_texture_float (GL/glext.h:5123)
+GL_ARB_texture_float = 1 # GL/glext.h:5124
+# ARB_pixel_buffer_object (GL/glext.h:5127)
+GL_ARB_pixel_buffer_object = 1 # GL/glext.h:5128
+# ARB_depth_buffer_float (GL/glext.h:5131)
+GL_ARB_depth_buffer_float = 1 # GL/glext.h:5132
+# ARB_draw_instanced (GL/glext.h:5135)
+GL_ARB_draw_instanced = 1 # GL/glext.h:5136
+# GL/glext.h:5138
+glDrawArraysInstancedARB = _link_function('glDrawArraysInstancedARB', None, [GLenum, GLint, GLsizei, GLsizei], 'ARB_draw_instanced')
+
+# GL/glext.h:5139
+glDrawElementsInstancedARB = _link_function('glDrawElementsInstancedARB', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei], 'ARB_draw_instanced')
+
+PFNGLDRAWARRAYSINSTANCEDARBPROC = CFUNCTYPE(None, GLenum, GLint, GLsizei, GLsizei) # GL/glext.h:5141
+PFNGLDRAWELEMENTSINSTANCEDARBPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei) # GL/glext.h:5142
+# ARB_framebuffer_object (GL/glext.h:5145)
+GL_ARB_framebuffer_object = 1 # GL/glext.h:5146
+# GL/glext.h:5148
+glIsRenderbuffer = _link_function('glIsRenderbuffer', GLboolean, [GLuint], 'ARB_framebuffer_object')
+
+# GL/glext.h:5149
+glBindRenderbuffer = _link_function('glBindRenderbuffer', None, [GLenum, GLuint], 'ARB_framebuffer_object')
+
+# GL/glext.h:5150
+glDeleteRenderbuffers = _link_function('glDeleteRenderbuffers', None, [GLsizei, POINTER(GLuint)], 'ARB_framebuffer_object')
+
+# GL/glext.h:5151
+glGenRenderbuffers = _link_function('glGenRenderbuffers', None, [GLsizei, POINTER(GLuint)], 'ARB_framebuffer_object')
+
+# GL/glext.h:5152
+glRenderbufferStorage = _link_function('glRenderbufferStorage', None, [GLenum, GLenum, GLsizei, GLsizei], 'ARB_framebuffer_object')
+
+# GL/glext.h:5153
+glGetRenderbufferParameteriv = _link_function('glGetRenderbufferParameteriv', None, [GLenum, GLenum, POINTER(GLint)], 'ARB_framebuffer_object')
+
+# GL/glext.h:5154
+glIsFramebuffer = _link_function('glIsFramebuffer', GLboolean, [GLuint], 'ARB_framebuffer_object')
+
+# GL/glext.h:5155
+glBindFramebuffer = _link_function('glBindFramebuffer', None, [GLenum, GLuint], 'ARB_framebuffer_object')
+
+# GL/glext.h:5156
+glDeleteFramebuffers = _link_function('glDeleteFramebuffers', None, [GLsizei, POINTER(GLuint)], 'ARB_framebuffer_object')
+
+# GL/glext.h:5157
+glGenFramebuffers = _link_function('glGenFramebuffers', None, [GLsizei, POINTER(GLuint)], 'ARB_framebuffer_object')
+
+# GL/glext.h:5158
+glCheckFramebufferStatus = _link_function('glCheckFramebufferStatus', GLenum, [GLenum], 'ARB_framebuffer_object')
+
+# GL/glext.h:5159
+glFramebufferTexture1D = _link_function('glFramebufferTexture1D', None, [GLenum, GLenum, GLenum, GLuint, GLint], 'ARB_framebuffer_object')
+
+# GL/glext.h:5160
+glFramebufferTexture2D = _link_function('glFramebufferTexture2D', None, [GLenum, GLenum, GLenum, GLuint, GLint], 'ARB_framebuffer_object')
+
+# GL/glext.h:5161
+glFramebufferTexture3D = _link_function('glFramebufferTexture3D', None, [GLenum, GLenum, GLenum, GLuint, GLint, GLint], 'ARB_framebuffer_object')
+
+# GL/glext.h:5162
+glFramebufferRenderbuffer = _link_function('glFramebufferRenderbuffer', None, [GLenum, GLenum, GLenum, GLuint], 'ARB_framebuffer_object')
+
+# GL/glext.h:5163
+glGetFramebufferAttachmentParameteriv = _link_function('glGetFramebufferAttachmentParameteriv', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'ARB_framebuffer_object')
+
+# GL/glext.h:5164
+glGenerateMipmap = _link_function('glGenerateMipmap', None, [GLenum], 'ARB_framebuffer_object')
+
+GLbitfield = c_uint # /usr/include/GL/gl.h:151
+# GL/glext.h:5165
+glBlitFramebuffer = _link_function('glBlitFramebuffer', None, [GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum], 'ARB_framebuffer_object')
+
+# GL/glext.h:5166
+glRenderbufferStorageMultisample = _link_function('glRenderbufferStorageMultisample', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei], 'ARB_framebuffer_object')
+
+# GL/glext.h:5167
+glFramebufferTextureLayer = _link_function('glFramebufferTextureLayer', None, [GLenum, GLenum, GLuint, GLint, GLint], 'ARB_framebuffer_object')
+
+PFNGLISRENDERBUFFERPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:5169
+PFNGLBINDRENDERBUFFERPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:5170
+PFNGLDELETERENDERBUFFERSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:5171
+PFNGLGENRENDERBUFFERSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:5172
+PFNGLRENDERBUFFERSTORAGEPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, GLsizei) # GL/glext.h:5173
+PFNGLGETRENDERBUFFERPARAMETERIVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5174
+PFNGLISFRAMEBUFFERPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:5175
+PFNGLBINDFRAMEBUFFERPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:5176
+PFNGLDELETEFRAMEBUFFERSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:5177
+PFNGLGENFRAMEBUFFERSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:5178
+PFNGLCHECKFRAMEBUFFERSTATUSPROC = CFUNCTYPE(GLenum, GLenum) # GL/glext.h:5179
+PFNGLFRAMEBUFFERTEXTURE1DPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLuint, GLint) # GL/glext.h:5180
+PFNGLFRAMEBUFFERTEXTURE2DPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLuint, GLint) # GL/glext.h:5181
+PFNGLFRAMEBUFFERTEXTURE3DPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLuint, GLint, GLint) # GL/glext.h:5182
+PFNGLFRAMEBUFFERRENDERBUFFERPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLuint) # GL/glext.h:5183
+PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5184
+PFNGLGENERATEMIPMAPPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:5185
+PFNGLBLITFRAMEBUFFERPROC = CFUNCTYPE(None, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum) # GL/glext.h:5186
+PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, GLsizei, GLsizei) # GL/glext.h:5187
+PFNGLFRAMEBUFFERTEXTURELAYERPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLint, GLint) # GL/glext.h:5188
+# ARB_framebuffer_sRGB (GL/glext.h:5191)
+GL_ARB_framebuffer_sRGB = 1 # GL/glext.h:5192
+# ARB_geometry_shader4 (GL/glext.h:5195)
+GL_ARB_geometry_shader4 = 1 # GL/glext.h:5196
+# GL/glext.h:5198
+glProgramParameteriARB = _link_function('glProgramParameteriARB', None, [GLuint, GLenum, GLint], 'ARB_geometry_shader4')
+
+# GL/glext.h:5199
+glFramebufferTextureARB = _link_function('glFramebufferTextureARB', None, [GLenum, GLenum, GLuint, GLint], 'ARB_geometry_shader4')
+
+# GL/glext.h:5200
+glFramebufferTextureLayerARB = _link_function('glFramebufferTextureLayerARB', None, [GLenum, GLenum, GLuint, GLint, GLint], 'ARB_geometry_shader4')
+
+# GL/glext.h:5201
+glFramebufferTextureFaceARB = _link_function('glFramebufferTextureFaceARB', None, [GLenum, GLenum, GLuint, GLint, GLenum], 'ARB_geometry_shader4')
+
+PFNGLPROGRAMPARAMETERIARBPROC = CFUNCTYPE(None, GLuint, GLenum, GLint) # GL/glext.h:5203
+PFNGLFRAMEBUFFERTEXTUREARBPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLint) # GL/glext.h:5204
+PFNGLFRAMEBUFFERTEXTURELAYERARBPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLint, GLint) # GL/glext.h:5205
+PFNGLFRAMEBUFFERTEXTUREFACEARBPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLint, GLenum) # GL/glext.h:5206
+# ARB_half_float_vertex (GL/glext.h:5209)
+GL_ARB_half_float_vertex = 1 # GL/glext.h:5210
+# ARB_instanced_arrays (GL/glext.h:5213)
+GL_ARB_instanced_arrays = 1 # GL/glext.h:5214
+# GL/glext.h:5216
+glVertexAttribDivisorARB = _link_function('glVertexAttribDivisorARB', None, [GLuint, GLuint], 'ARB_instanced_arrays')
+
+PFNGLVERTEXATTRIBDIVISORARBPROC = CFUNCTYPE(None, GLuint, GLuint) # GL/glext.h:5218
+# ARB_map_buffer_range (GL/glext.h:5221)
+GL_ARB_map_buffer_range = 1 # GL/glext.h:5222
+# GL/glext.h:5224
+glMapBufferRange = _link_function('glMapBufferRange', None, [GLenum, GLintptr, GLsizeiptr, GLbitfield], 'ARB_map_buffer_range')
+
+# GL/glext.h:5225
+glFlushMappedBufferRange = _link_function('glFlushMappedBufferRange', None, [GLenum, GLintptr, GLsizeiptr], 'ARB_map_buffer_range')
+
+PFNGLMAPBUFFERRANGEPROC = CFUNCTYPE(None, GLenum, GLintptr, GLsizeiptr, GLbitfield) # GL/glext.h:5227
+PFNGLFLUSHMAPPEDBUFFERRANGEPROC = CFUNCTYPE(None, GLenum, GLintptr, GLsizeiptr) # GL/glext.h:5228
+# ARB_texture_buffer_object (GL/glext.h:5231)
+GL_ARB_texture_buffer_object = 1 # GL/glext.h:5232
+# GL/glext.h:5234
+glTexBufferARB = _link_function('glTexBufferARB', None, [GLenum, GLenum, GLuint], 'ARB_texture_buffer_object')
+
+PFNGLTEXBUFFERARBPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint) # GL/glext.h:5236
+# ARB_texture_compression_rgtc (GL/glext.h:5239)
+GL_ARB_texture_compression_rgtc = 1 # GL/glext.h:5240
+# ARB_texture_rg (GL/glext.h:5243)
+GL_ARB_texture_rg = 1 # GL/glext.h:5244
+# ARB_vertex_array_object (GL/glext.h:5247)
+GL_ARB_vertex_array_object = 1 # GL/glext.h:5248
+# GL/glext.h:5250
+glBindVertexArray = _link_function('glBindVertexArray', None, [GLuint], 'ARB_vertex_array_object')
+
+# GL/glext.h:5251
+glDeleteVertexArrays = _link_function('glDeleteVertexArrays', None, [GLsizei, POINTER(GLuint)], 'ARB_vertex_array_object')
+
+# GL/glext.h:5252
+glGenVertexArrays = _link_function('glGenVertexArrays', None, [GLsizei, POINTER(GLuint)], 'ARB_vertex_array_object')
+
+# GL/glext.h:5253
+glIsVertexArray = _link_function('glIsVertexArray', GLboolean, [GLuint], 'ARB_vertex_array_object')
+
+PFNGLBINDVERTEXARRAYPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:5255
+PFNGLDELETEVERTEXARRAYSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:5256
+PFNGLGENVERTEXARRAYSPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:5257
+PFNGLISVERTEXARRAYPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:5258
+# EXT_abgr (GL/glext.h:5261)
+GL_EXT_abgr = 1 # GL/glext.h:5262
+# EXT_blend_color (GL/glext.h:5265)
+GL_EXT_blend_color = 1 # GL/glext.h:5266
+# GL/glext.h:5268
+glBlendColorEXT = _link_function('glBlendColorEXT', None, [GLclampf, GLclampf, GLclampf, GLclampf], 'EXT_blend_color')
+
+PFNGLBLENDCOLOREXTPROC = CFUNCTYPE(None, GLclampf, GLclampf, GLclampf, GLclampf) # GL/glext.h:5270
+# EXT_polygon_offset (GL/glext.h:5273)
+GL_EXT_polygon_offset = 1 # GL/glext.h:5274
+# GL/glext.h:5276
+glPolygonOffsetEXT = _link_function('glPolygonOffsetEXT', None, [GLfloat, GLfloat], 'EXT_polygon_offset')
+
+PFNGLPOLYGONOFFSETEXTPROC = CFUNCTYPE(None, GLfloat, GLfloat) # GL/glext.h:5278
+# EXT_texture (GL/glext.h:5281)
+GL_EXT_texture = 1 # GL/glext.h:5282
+# EXT_texture3D (GL/glext.h:5285)
+GL_EXT_texture3D = 1 # GL/glext.h:5286
+# GL/glext.h:5288
+glTexImage3DEXT = _link_function('glTexImage3DEXT', None, [GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_texture3D')
+
+# GL/glext.h:5289
+glTexSubImage3DEXT = _link_function('glTexSubImage3DEXT', None, [GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_texture3D')
+
+PFNGLTEXIMAGE3DEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5291
+PFNGLTEXSUBIMAGE3DEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5292
+# SGIS_texture_filter4 (GL/glext.h:5295)
+GL_SGIS_texture_filter4 = 1 # GL/glext.h:5296
+# GL/glext.h:5298
+glGetTexFilterFuncSGIS = _link_function('glGetTexFilterFuncSGIS', None, [GLenum, GLenum, POINTER(GLfloat)], 'SGIS_texture_filter4')
+
+# GL/glext.h:5299
+glTexFilterFuncSGIS = _link_function('glTexFilterFuncSGIS', None, [GLenum, GLenum, GLsizei, POINTER(GLfloat)], 'SGIS_texture_filter4')
+
+PFNGLGETTEXFILTERFUNCSGISPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5301
+PFNGLTEXFILTERFUNCSGISPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, POINTER(GLfloat)) # GL/glext.h:5302
+# EXT_subtexture (GL/glext.h:5305)
+GL_EXT_subtexture = 1 # GL/glext.h:5306
+# GL/glext.h:5308
+glTexSubImage1DEXT = _link_function('glTexSubImage1DEXT', None, [GLenum, GLint, GLint, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_subtexture')
+
+# GL/glext.h:5309
+glTexSubImage2DEXT = _link_function('glTexSubImage2DEXT', None, [GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_subtexture')
+
+PFNGLTEXSUBIMAGE1DEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5311
+PFNGLTEXSUBIMAGE2DEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5312
+# EXT_copy_texture (GL/glext.h:5315)
+GL_EXT_copy_texture = 1 # GL/glext.h:5316
+# GL/glext.h:5318
+glCopyTexImage1DEXT = _link_function('glCopyTexImage1DEXT', None, [GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint], 'EXT_copy_texture')
+
+# GL/glext.h:5319
+glCopyTexImage2DEXT = _link_function('glCopyTexImage2DEXT', None, [GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint], 'EXT_copy_texture')
+
+# GL/glext.h:5320
+glCopyTexSubImage1DEXT = _link_function('glCopyTexSubImage1DEXT', None, [GLenum, GLint, GLint, GLint, GLint, GLsizei], 'EXT_copy_texture')
+
+# GL/glext.h:5321
+glCopyTexSubImage2DEXT = _link_function('glCopyTexSubImage2DEXT', None, [GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], 'EXT_copy_texture')
+
+# GL/glext.h:5322
+glCopyTexSubImage3DEXT = _link_function('glCopyTexSubImage3DEXT', None, [GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], 'EXT_copy_texture')
+
+PFNGLCOPYTEXIMAGE1DEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint) # GL/glext.h:5324
+PFNGLCOPYTEXIMAGE2DEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint) # GL/glext.h:5325
+PFNGLCOPYTEXSUBIMAGE1DEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLint, GLsizei) # GL/glext.h:5326
+PFNGLCOPYTEXSUBIMAGE2DEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) # GL/glext.h:5327
+PFNGLCOPYTEXSUBIMAGE3DEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) # GL/glext.h:5328
+# EXT_histogram (GL/glext.h:5331)
+GL_EXT_histogram = 1 # GL/glext.h:5332
+# GL/glext.h:5334
+glGetHistogramEXT = _link_function('glGetHistogramEXT', None, [GLenum, GLboolean, GLenum, GLenum, POINTER(GLvoid)], 'EXT_histogram')
+
+# GL/glext.h:5335
+glGetHistogramParameterfvEXT = _link_function('glGetHistogramParameterfvEXT', None, [GLenum, GLenum, POINTER(GLfloat)], 'EXT_histogram')
+
+# GL/glext.h:5336
+glGetHistogramParameterivEXT = _link_function('glGetHistogramParameterivEXT', None, [GLenum, GLenum, POINTER(GLint)], 'EXT_histogram')
+
+# GL/glext.h:5337
+glGetMinmaxEXT = _link_function('glGetMinmaxEXT', None, [GLenum, GLboolean, GLenum, GLenum, POINTER(GLvoid)], 'EXT_histogram')
+
+# GL/glext.h:5338
+glGetMinmaxParameterfvEXT = _link_function('glGetMinmaxParameterfvEXT', None, [GLenum, GLenum, POINTER(GLfloat)], 'EXT_histogram')
+
+# GL/glext.h:5339
+glGetMinmaxParameterivEXT = _link_function('glGetMinmaxParameterivEXT', None, [GLenum, GLenum, POINTER(GLint)], 'EXT_histogram')
+
+# GL/glext.h:5340
+glHistogramEXT = _link_function('glHistogramEXT', None, [GLenum, GLsizei, GLenum, GLboolean], 'EXT_histogram')
+
+# GL/glext.h:5341
+glMinmaxEXT = _link_function('glMinmaxEXT', None, [GLenum, GLenum, GLboolean], 'EXT_histogram')
+
+# GL/glext.h:5342
+glResetHistogramEXT = _link_function('glResetHistogramEXT', None, [GLenum], 'EXT_histogram')
+
+# GL/glext.h:5343
+glResetMinmaxEXT = _link_function('glResetMinmaxEXT', None, [GLenum], 'EXT_histogram')
+
+PFNGLGETHISTOGRAMEXTPROC = CFUNCTYPE(None, GLenum, GLboolean, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5345
+PFNGLGETHISTOGRAMPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5346
+PFNGLGETHISTOGRAMPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5347
+PFNGLGETMINMAXEXTPROC = CFUNCTYPE(None, GLenum, GLboolean, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5348
+PFNGLGETMINMAXPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5349
+PFNGLGETMINMAXPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5350
+PFNGLHISTOGRAMEXTPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, GLboolean) # GL/glext.h:5351
+PFNGLMINMAXEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLboolean) # GL/glext.h:5352
+PFNGLRESETHISTOGRAMEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:5353
+PFNGLRESETMINMAXEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:5354
+# EXT_convolution (GL/glext.h:5357)
+GL_EXT_convolution = 1 # GL/glext.h:5358
+# GL/glext.h:5360
+glConvolutionFilter1DEXT = _link_function('glConvolutionFilter1DEXT', None, [GLenum, GLenum, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_convolution')
+
+# GL/glext.h:5361
+glConvolutionFilter2DEXT = _link_function('glConvolutionFilter2DEXT', None, [GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_convolution')
+
+# GL/glext.h:5362
+glConvolutionParameterfEXT = _link_function('glConvolutionParameterfEXT', None, [GLenum, GLenum, GLfloat], 'EXT_convolution')
+
+# GL/glext.h:5363
+glConvolutionParameterfvEXT = _link_function('glConvolutionParameterfvEXT', None, [GLenum, GLenum, POINTER(GLfloat)], 'EXT_convolution')
+
+# GL/glext.h:5364
+glConvolutionParameteriEXT = _link_function('glConvolutionParameteriEXT', None, [GLenum, GLenum, GLint], 'EXT_convolution')
+
+# GL/glext.h:5365
+glConvolutionParameterivEXT = _link_function('glConvolutionParameterivEXT', None, [GLenum, GLenum, POINTER(GLint)], 'EXT_convolution')
+
+# GL/glext.h:5366
+glCopyConvolutionFilter1DEXT = _link_function('glCopyConvolutionFilter1DEXT', None, [GLenum, GLenum, GLint, GLint, GLsizei], 'EXT_convolution')
+
+# GL/glext.h:5367
+glCopyConvolutionFilter2DEXT = _link_function('glCopyConvolutionFilter2DEXT', None, [GLenum, GLenum, GLint, GLint, GLsizei, GLsizei], 'EXT_convolution')
+
+# GL/glext.h:5368
+glGetConvolutionFilterEXT = _link_function('glGetConvolutionFilterEXT', None, [GLenum, GLenum, GLenum, POINTER(GLvoid)], 'EXT_convolution')
+
+# GL/glext.h:5369
+glGetConvolutionParameterfvEXT = _link_function('glGetConvolutionParameterfvEXT', None, [GLenum, GLenum, POINTER(GLfloat)], 'EXT_convolution')
+
+# GL/glext.h:5370
+glGetConvolutionParameterivEXT = _link_function('glGetConvolutionParameterivEXT', None, [GLenum, GLenum, POINTER(GLint)], 'EXT_convolution')
+
+# GL/glext.h:5371
+glGetSeparableFilterEXT = _link_function('glGetSeparableFilterEXT', None, [GLenum, GLenum, GLenum, POINTER(GLvoid), POINTER(GLvoid), POINTER(GLvoid)], 'EXT_convolution')
+
+# GL/glext.h:5372
+glSeparableFilter2DEXT = _link_function('glSeparableFilter2DEXT', None, [GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid), POINTER(GLvoid)], 'EXT_convolution')
+
+PFNGLCONVOLUTIONFILTER1DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5374
+PFNGLCONVOLUTIONFILTER2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5375
+PFNGLCONVOLUTIONPARAMETERFEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLfloat) # GL/glext.h:5376
+PFNGLCONVOLUTIONPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5377
+PFNGLCONVOLUTIONPARAMETERIEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint) # GL/glext.h:5378
+PFNGLCONVOLUTIONPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5379
+PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLsizei) # GL/glext.h:5380
+PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLsizei, GLsizei) # GL/glext.h:5381
+PFNGLGETCONVOLUTIONFILTEREXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5382
+PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5383
+PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5384
+PFNGLGETSEPARABLEFILTEREXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLvoid), POINTER(GLvoid), POINTER(GLvoid)) # GL/glext.h:5385
+PFNGLSEPARABLEFILTER2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid), POINTER(GLvoid)) # GL/glext.h:5386
+# EXT_color_matrix (GL/glext.h:5389)
+GL_EXT_color_matrix = 1 # GL/glext.h:5390
+# SGI_color_table (GL/glext.h:5393)
+GL_SGI_color_table = 1 # GL/glext.h:5394
+# GL/glext.h:5396
+glColorTableSGI = _link_function('glColorTableSGI', None, [GLenum, GLenum, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'SGI_color_table')
+
+# GL/glext.h:5397
+glColorTableParameterfvSGI = _link_function('glColorTableParameterfvSGI', None, [GLenum, GLenum, POINTER(GLfloat)], 'SGI_color_table')
+
+# GL/glext.h:5398
+glColorTableParameterivSGI = _link_function('glColorTableParameterivSGI', None, [GLenum, GLenum, POINTER(GLint)], 'SGI_color_table')
+
+# GL/glext.h:5399
+glCopyColorTableSGI = _link_function('glCopyColorTableSGI', None, [GLenum, GLenum, GLint, GLint, GLsizei], 'SGI_color_table')
+
+# GL/glext.h:5400
+glGetColorTableSGI = _link_function('glGetColorTableSGI', None, [GLenum, GLenum, GLenum, POINTER(GLvoid)], 'SGI_color_table')
+
+# GL/glext.h:5401
+glGetColorTableParameterfvSGI = _link_function('glGetColorTableParameterfvSGI', None, [GLenum, GLenum, POINTER(GLfloat)], 'SGI_color_table')
+
+# GL/glext.h:5402
+glGetColorTableParameterivSGI = _link_function('glGetColorTableParameterivSGI', None, [GLenum, GLenum, POINTER(GLint)], 'SGI_color_table')
+
+PFNGLCOLORTABLESGIPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5404
+PFNGLCOLORTABLEPARAMETERFVSGIPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5405
+PFNGLCOLORTABLEPARAMETERIVSGIPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5406
+PFNGLCOPYCOLORTABLESGIPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLsizei) # GL/glext.h:5407
+PFNGLGETCOLORTABLESGIPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5408
+PFNGLGETCOLORTABLEPARAMETERFVSGIPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5409
+PFNGLGETCOLORTABLEPARAMETERIVSGIPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5410
+# SGIX_pixel_texture (GL/glext.h:5413)
+GL_SGIX_pixel_texture = 1 # GL/glext.h:5414
+# GL/glext.h:5416
+glPixelTexGenSGIX = _link_function('glPixelTexGenSGIX', None, [GLenum], 'SGIX_pixel_texture')
+
+PFNGLPIXELTEXGENSGIXPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:5418
+# SGIS_pixel_texture (GL/glext.h:5421)
+GL_SGIS_pixel_texture = 1 # GL/glext.h:5422
+# GL/glext.h:5424
+glPixelTexGenParameteriSGIS = _link_function('glPixelTexGenParameteriSGIS', None, [GLenum, GLint], 'SGIS_pixel_texture')
+
+# GL/glext.h:5425
+glPixelTexGenParameterivSGIS = _link_function('glPixelTexGenParameterivSGIS', None, [GLenum, POINTER(GLint)], 'SGIS_pixel_texture')
+
+# GL/glext.h:5426
+glPixelTexGenParameterfSGIS = _link_function('glPixelTexGenParameterfSGIS', None, [GLenum, GLfloat], 'SGIS_pixel_texture')
+
+# GL/glext.h:5427
+glPixelTexGenParameterfvSGIS = _link_function('glPixelTexGenParameterfvSGIS', None, [GLenum, POINTER(GLfloat)], 'SGIS_pixel_texture')
+
+# GL/glext.h:5428
+glGetPixelTexGenParameterivSGIS = _link_function('glGetPixelTexGenParameterivSGIS', None, [GLenum, POINTER(GLint)], 'SGIS_pixel_texture')
+
+# GL/glext.h:5429
+glGetPixelTexGenParameterfvSGIS = _link_function('glGetPixelTexGenParameterfvSGIS', None, [GLenum, POINTER(GLfloat)], 'SGIS_pixel_texture')
+
+PFNGLPIXELTEXGENPARAMETERISGISPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:5431
+PFNGLPIXELTEXGENPARAMETERIVSGISPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:5432
+PFNGLPIXELTEXGENPARAMETERFSGISPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:5433
+PFNGLPIXELTEXGENPARAMETERFVSGISPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:5434
+PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:5435
+PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:5436
+# SGIS_texture4D (GL/glext.h:5439)
+GL_SGIS_texture4D = 1 # GL/glext.h:5440
+# GL/glext.h:5442
+glTexImage4DSGIS = _link_function('glTexImage4DSGIS', None, [GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], 'SGIS_texture4D')
+
+# GL/glext.h:5443
+glTexSubImage4DSGIS = _link_function('glTexSubImage4DSGIS', None, [GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'SGIS_texture4D')
+
+PFNGLTEXIMAGE4DSGISPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5445
+PFNGLTEXSUBIMAGE4DSGISPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5446
+# SGI_texture_color_table (GL/glext.h:5449)
+GL_SGI_texture_color_table = 1 # GL/glext.h:5450
+# EXT_cmyka (GL/glext.h:5453)
+GL_EXT_cmyka = 1 # GL/glext.h:5454
+# EXT_texture_object (GL/glext.h:5457)
+GL_EXT_texture_object = 1 # GL/glext.h:5458
+# GL/glext.h:5460
+glAreTexturesResidentEXT = _link_function('glAreTexturesResidentEXT', GLboolean, [GLsizei, POINTER(GLuint), POINTER(GLboolean)], 'EXT_texture_object')
+
+# GL/glext.h:5461
+glBindTextureEXT = _link_function('glBindTextureEXT', None, [GLenum, GLuint], 'EXT_texture_object')
+
+# GL/glext.h:5462
+glDeleteTexturesEXT = _link_function('glDeleteTexturesEXT', None, [GLsizei, POINTER(GLuint)], 'EXT_texture_object')
+
+# GL/glext.h:5463
+glGenTexturesEXT = _link_function('glGenTexturesEXT', None, [GLsizei, POINTER(GLuint)], 'EXT_texture_object')
+
+# GL/glext.h:5464
+glIsTextureEXT = _link_function('glIsTextureEXT', GLboolean, [GLuint], 'EXT_texture_object')
+
+# GL/glext.h:5465
+glPrioritizeTexturesEXT = _link_function('glPrioritizeTexturesEXT', None, [GLsizei, POINTER(GLuint), POINTER(GLclampf)], 'EXT_texture_object')
+
+PFNGLARETEXTURESRESIDENTEXTPROC = CFUNCTYPE(GLboolean, GLsizei, POINTER(GLuint), POINTER(GLboolean)) # GL/glext.h:5467
+PFNGLBINDTEXTUREEXTPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:5468
+PFNGLDELETETEXTURESEXTPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:5469
+PFNGLGENTEXTURESEXTPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:5470
+PFNGLISTEXTUREEXTPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:5471
+PFNGLPRIORITIZETEXTURESEXTPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint), POINTER(GLclampf)) # GL/glext.h:5472
+# SGIS_detail_texture (GL/glext.h:5475)
+GL_SGIS_detail_texture = 1 # GL/glext.h:5476
+# GL/glext.h:5478
+glDetailTexFuncSGIS = _link_function('glDetailTexFuncSGIS', None, [GLenum, GLsizei, POINTER(GLfloat)], 'SGIS_detail_texture')
+
+# GL/glext.h:5479
+glGetDetailTexFuncSGIS = _link_function('glGetDetailTexFuncSGIS', None, [GLenum, POINTER(GLfloat)], 'SGIS_detail_texture')
+
+PFNGLDETAILTEXFUNCSGISPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLfloat)) # GL/glext.h:5481
+PFNGLGETDETAILTEXFUNCSGISPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:5482
+# SGIS_sharpen_texture (GL/glext.h:5485)
+GL_SGIS_sharpen_texture = 1 # GL/glext.h:5486
+# GL/glext.h:5488
+glSharpenTexFuncSGIS = _link_function('glSharpenTexFuncSGIS', None, [GLenum, GLsizei, POINTER(GLfloat)], 'SGIS_sharpen_texture')
+
+# GL/glext.h:5489
+glGetSharpenTexFuncSGIS = _link_function('glGetSharpenTexFuncSGIS', None, [GLenum, POINTER(GLfloat)], 'SGIS_sharpen_texture')
+
+PFNGLSHARPENTEXFUNCSGISPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLfloat)) # GL/glext.h:5491
+PFNGLGETSHARPENTEXFUNCSGISPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:5492
+# EXT_packed_pixels (GL/glext.h:5495)
+GL_EXT_packed_pixels = 1 # GL/glext.h:5496
+# SGIS_texture_lod (GL/glext.h:5499)
+GL_SGIS_texture_lod = 1 # GL/glext.h:5500
+# SGIS_multisample (GL/glext.h:5503)
+GL_SGIS_multisample = 1 # GL/glext.h:5504
+# GL/glext.h:5506
+glSampleMaskSGIS = _link_function('glSampleMaskSGIS', None, [GLclampf, GLboolean], 'SGIS_multisample')
+
+# GL/glext.h:5507
+glSamplePatternSGIS = _link_function('glSamplePatternSGIS', None, [GLenum], 'SGIS_multisample')
+
+PFNGLSAMPLEMASKSGISPROC = CFUNCTYPE(None, GLclampf, GLboolean) # GL/glext.h:5509
+PFNGLSAMPLEPATTERNSGISPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:5510
+# EXT_rescale_normal (GL/glext.h:5513)
+GL_EXT_rescale_normal = 1 # GL/glext.h:5514
+# EXT_vertex_array (GL/glext.h:5517)
+GL_EXT_vertex_array = 1 # GL/glext.h:5518
+# GL/glext.h:5520
+glArrayElementEXT = _link_function('glArrayElementEXT', None, [GLint], 'EXT_vertex_array')
+
+# GL/glext.h:5521
+glColorPointerEXT = _link_function('glColorPointerEXT', None, [GLint, GLenum, GLsizei, GLsizei, POINTER(GLvoid)], 'EXT_vertex_array')
+
+# GL/glext.h:5522
+glDrawArraysEXT = _link_function('glDrawArraysEXT', None, [GLenum, GLint, GLsizei], 'EXT_vertex_array')
+
+# GL/glext.h:5523
+glEdgeFlagPointerEXT = _link_function('glEdgeFlagPointerEXT', None, [GLsizei, GLsizei, POINTER(GLboolean)], 'EXT_vertex_array')
+
+# GL/glext.h:5524
+glGetPointervEXT = _link_function('glGetPointervEXT', None, [GLenum, POINTER(POINTER(GLvoid))], 'EXT_vertex_array')
+
+# GL/glext.h:5525
+glIndexPointerEXT = _link_function('glIndexPointerEXT', None, [GLenum, GLsizei, GLsizei, POINTER(GLvoid)], 'EXT_vertex_array')
+
+# GL/glext.h:5526
+glNormalPointerEXT = _link_function('glNormalPointerEXT', None, [GLenum, GLsizei, GLsizei, POINTER(GLvoid)], 'EXT_vertex_array')
+
+# GL/glext.h:5527
+glTexCoordPointerEXT = _link_function('glTexCoordPointerEXT', None, [GLint, GLenum, GLsizei, GLsizei, POINTER(GLvoid)], 'EXT_vertex_array')
+
+# GL/glext.h:5528
+glVertexPointerEXT = _link_function('glVertexPointerEXT', None, [GLint, GLenum, GLsizei, GLsizei, POINTER(GLvoid)], 'EXT_vertex_array')
+
+PFNGLARRAYELEMENTEXTPROC = CFUNCTYPE(None, GLint) # GL/glext.h:5530
+PFNGLCOLORPOINTEREXTPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei, GLsizei, POINTER(GLvoid)) # GL/glext.h:5531
+PFNGLDRAWARRAYSEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLsizei) # GL/glext.h:5532
+PFNGLEDGEFLAGPOINTEREXTPROC = CFUNCTYPE(None, GLsizei, GLsizei, POINTER(GLboolean)) # GL/glext.h:5533
+PFNGLGETPOINTERVEXTPROC = CFUNCTYPE(None, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:5534
+PFNGLINDEXPOINTEREXTPROC = CFUNCTYPE(None, GLenum, GLsizei, GLsizei, POINTER(GLvoid)) # GL/glext.h:5535
+PFNGLNORMALPOINTEREXTPROC = CFUNCTYPE(None, GLenum, GLsizei, GLsizei, POINTER(GLvoid)) # GL/glext.h:5536
+PFNGLTEXCOORDPOINTEREXTPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei, GLsizei, POINTER(GLvoid)) # GL/glext.h:5537
+PFNGLVERTEXPOINTEREXTPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei, GLsizei, POINTER(GLvoid)) # GL/glext.h:5538
+# EXT_misc_attribute (GL/glext.h:5541)
+GL_EXT_misc_attribute = 1 # GL/glext.h:5542
+# SGIS_generate_mipmap (GL/glext.h:5545)
+GL_SGIS_generate_mipmap = 1 # GL/glext.h:5546
+# SGIX_clipmap (GL/glext.h:5549)
+GL_SGIX_clipmap = 1 # GL/glext.h:5550
+# SGIX_shadow (GL/glext.h:5553)
+GL_SGIX_shadow = 1 # GL/glext.h:5554
+# SGIS_texture_edge_clamp (GL/glext.h:5557)
+GL_SGIS_texture_edge_clamp = 1 # GL/glext.h:5558
+# SGIS_texture_border_clamp (GL/glext.h:5561)
+GL_SGIS_texture_border_clamp = 1 # GL/glext.h:5562
+# EXT_blend_minmax (GL/glext.h:5565)
+GL_EXT_blend_minmax = 1 # GL/glext.h:5566
+# GL/glext.h:5568
+glBlendEquationEXT = _link_function('glBlendEquationEXT', None, [GLenum], 'EXT_blend_minmax')
+
+PFNGLBLENDEQUATIONEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:5570
+# EXT_blend_subtract (GL/glext.h:5573)
+GL_EXT_blend_subtract = 1 # GL/glext.h:5574
+# EXT_blend_logic_op (GL/glext.h:5577)
+GL_EXT_blend_logic_op = 1 # GL/glext.h:5578
+# SGIX_interlace (GL/glext.h:5581)
+GL_SGIX_interlace = 1 # GL/glext.h:5582
+# SGIX_pixel_tiles (GL/glext.h:5585)
+GL_SGIX_pixel_tiles = 1 # GL/glext.h:5586
+# SGIX_texture_select (GL/glext.h:5589)
+GL_SGIX_texture_select = 1 # GL/glext.h:5590
+# SGIX_sprite (GL/glext.h:5593)
+GL_SGIX_sprite = 1 # GL/glext.h:5594
+# GL/glext.h:5596
+glSpriteParameterfSGIX = _link_function('glSpriteParameterfSGIX', None, [GLenum, GLfloat], 'SGIX_sprite')
+
+# GL/glext.h:5597
+glSpriteParameterfvSGIX = _link_function('glSpriteParameterfvSGIX', None, [GLenum, POINTER(GLfloat)], 'SGIX_sprite')
+
+# GL/glext.h:5598
+glSpriteParameteriSGIX = _link_function('glSpriteParameteriSGIX', None, [GLenum, GLint], 'SGIX_sprite')
+
+# GL/glext.h:5599
+glSpriteParameterivSGIX = _link_function('glSpriteParameterivSGIX', None, [GLenum, POINTER(GLint)], 'SGIX_sprite')
+
+PFNGLSPRITEPARAMETERFSGIXPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:5601
+PFNGLSPRITEPARAMETERFVSGIXPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:5602
+PFNGLSPRITEPARAMETERISGIXPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:5603
+PFNGLSPRITEPARAMETERIVSGIXPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:5604
+# SGIX_texture_multi_buffer (GL/glext.h:5607)
+GL_SGIX_texture_multi_buffer = 1 # GL/glext.h:5608
+# EXT_point_parameters (GL/glext.h:5611)
+GL_EXT_point_parameters = 1 # GL/glext.h:5612
+# GL/glext.h:5614
+glPointParameterfEXT = _link_function('glPointParameterfEXT', None, [GLenum, GLfloat], 'EXT_point_parameters')
+
+# GL/glext.h:5615
+glPointParameterfvEXT = _link_function('glPointParameterfvEXT', None, [GLenum, POINTER(GLfloat)], 'EXT_point_parameters')
+
+PFNGLPOINTPARAMETERFEXTPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:5617
+PFNGLPOINTPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:5618
+# SGIS_point_parameters (GL/glext.h:5621)
+GL_SGIS_point_parameters = 1 # GL/glext.h:5622
+# GL/glext.h:5624
+glPointParameterfSGIS = _link_function('glPointParameterfSGIS', None, [GLenum, GLfloat], 'SGIS_point_parameters')
+
+# GL/glext.h:5625
+glPointParameterfvSGIS = _link_function('glPointParameterfvSGIS', None, [GLenum, POINTER(GLfloat)], 'SGIS_point_parameters')
+
+PFNGLPOINTPARAMETERFSGISPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:5627
+PFNGLPOINTPARAMETERFVSGISPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:5628
+# SGIX_instruments (GL/glext.h:5631)
+GL_SGIX_instruments = 1 # GL/glext.h:5632
+# GL/glext.h:5634
+glGetInstrumentsSGIX = _link_function('glGetInstrumentsSGIX', GLint, [], 'SGIX_instruments')
+
+# GL/glext.h:5635
+glInstrumentsBufferSGIX = _link_function('glInstrumentsBufferSGIX', None, [GLsizei, POINTER(GLint)], 'SGIX_instruments')
+
+# GL/glext.h:5636
+glPollInstrumentsSGIX = _link_function('glPollInstrumentsSGIX', GLint, [POINTER(GLint)], 'SGIX_instruments')
+
+# GL/glext.h:5637
+glReadInstrumentsSGIX = _link_function('glReadInstrumentsSGIX', None, [GLint], 'SGIX_instruments')
+
+# GL/glext.h:5638
+glStartInstrumentsSGIX = _link_function('glStartInstrumentsSGIX', None, [], 'SGIX_instruments')
+
+# GL/glext.h:5639
+glStopInstrumentsSGIX = _link_function('glStopInstrumentsSGIX', None, [GLint], 'SGIX_instruments')
+
+PFNGLGETINSTRUMENTSSGIXPROC = CFUNCTYPE(GLint) # GL/glext.h:5641
+PFNGLINSTRUMENTSBUFFERSGIXPROC = CFUNCTYPE(None, GLsizei, POINTER(GLint)) # GL/glext.h:5642
+PFNGLPOLLINSTRUMENTSSGIXPROC = CFUNCTYPE(GLint, POINTER(GLint)) # GL/glext.h:5643
+PFNGLREADINSTRUMENTSSGIXPROC = CFUNCTYPE(None, GLint) # GL/glext.h:5644
+PFNGLSTARTINSTRUMENTSSGIXPROC = CFUNCTYPE(None) # GL/glext.h:5645
+PFNGLSTOPINSTRUMENTSSGIXPROC = CFUNCTYPE(None, GLint) # GL/glext.h:5646
+# SGIX_texture_scale_bias (GL/glext.h:5649)
+GL_SGIX_texture_scale_bias = 1 # GL/glext.h:5650
+# SGIX_framezoom (GL/glext.h:5653)
+GL_SGIX_framezoom = 1 # GL/glext.h:5654
+# GL/glext.h:5656
+glFrameZoomSGIX = _link_function('glFrameZoomSGIX', None, [GLint], 'SGIX_framezoom')
+
+PFNGLFRAMEZOOMSGIXPROC = CFUNCTYPE(None, GLint) # GL/glext.h:5658
+# SGIX_tag_sample_buffer (GL/glext.h:5661)
+GL_SGIX_tag_sample_buffer = 1 # GL/glext.h:5662
+# GL/glext.h:5664
+glTagSampleBufferSGIX = _link_function('glTagSampleBufferSGIX', None, [], 'SGIX_tag_sample_buffer')
+
+PFNGLTAGSAMPLEBUFFERSGIXPROC = CFUNCTYPE(None) # GL/glext.h:5666
+# SGIX_polynomial_ffd (GL/glext.h:5669)
+GL_SGIX_polynomial_ffd = 1 # GL/glext.h:5670
+# GL/glext.h:5672
+glDeformationMap3dSGIX = _link_function('glDeformationMap3dSGIX', None, [GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, POINTER(GLdouble)], 'SGIX_polynomial_ffd')
+
+# GL/glext.h:5673
+glDeformationMap3fSGIX = _link_function('glDeformationMap3fSGIX', None, [GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, POINTER(GLfloat)], 'SGIX_polynomial_ffd')
+
+# GL/glext.h:5674
+glDeformSGIX = _link_function('glDeformSGIX', None, [GLbitfield], 'SGIX_polynomial_ffd')
+
+# GL/glext.h:5675
+glLoadIdentityDeformationMapSGIX = _link_function('glLoadIdentityDeformationMapSGIX', None, [GLbitfield], 'SGIX_polynomial_ffd')
+
+PFNGLDEFORMATIONMAP3DSGIXPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, POINTER(GLdouble)) # GL/glext.h:5677
+PFNGLDEFORMATIONMAP3FSGIXPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, POINTER(GLfloat)) # GL/glext.h:5678
+PFNGLDEFORMSGIXPROC = CFUNCTYPE(None, GLbitfield) # GL/glext.h:5679
+PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC = CFUNCTYPE(None, GLbitfield) # GL/glext.h:5680
+# SGIX_reference_plane (GL/glext.h:5683)
+GL_SGIX_reference_plane = 1 # GL/glext.h:5684
+# GL/glext.h:5686
+glReferencePlaneSGIX = _link_function('glReferencePlaneSGIX', None, [POINTER(GLdouble)], 'SGIX_reference_plane')
+
+PFNGLREFERENCEPLANESGIXPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:5688
+# SGIX_flush_raster (GL/glext.h:5691)
+GL_SGIX_flush_raster = 1 # GL/glext.h:5692
+# GL/glext.h:5694
+glFlushRasterSGIX = _link_function('glFlushRasterSGIX', None, [], 'SGIX_flush_raster')
+
+PFNGLFLUSHRASTERSGIXPROC = CFUNCTYPE(None) # GL/glext.h:5696
+# SGIX_depth_texture (GL/glext.h:5699)
+GL_SGIX_depth_texture = 1 # GL/glext.h:5700
+# SGIS_fog_function (GL/glext.h:5703)
+GL_SGIS_fog_function = 1 # GL/glext.h:5704
+# GL/glext.h:5706
+glFogFuncSGIS = _link_function('glFogFuncSGIS', None, [GLsizei, POINTER(GLfloat)], 'SGIS_fog_function')
+
+# GL/glext.h:5707
+glGetFogFuncSGIS = _link_function('glGetFogFuncSGIS', None, [POINTER(GLfloat)], 'SGIS_fog_function')
+
+PFNGLFOGFUNCSGISPROC = CFUNCTYPE(None, GLsizei, POINTER(GLfloat)) # GL/glext.h:5709
+PFNGLGETFOGFUNCSGISPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:5710
+# SGIX_fog_offset (GL/glext.h:5713)
+GL_SGIX_fog_offset = 1 # GL/glext.h:5714
+# HP_image_transform (GL/glext.h:5717)
+GL_HP_image_transform = 1 # GL/glext.h:5718
+# GL/glext.h:5720
+glImageTransformParameteriHP = _link_function('glImageTransformParameteriHP', None, [GLenum, GLenum, GLint], 'HP_image_transform')
+
+# GL/glext.h:5721
+glImageTransformParameterfHP = _link_function('glImageTransformParameterfHP', None, [GLenum, GLenum, GLfloat], 'HP_image_transform')
+
+# GL/glext.h:5722
+glImageTransformParameterivHP = _link_function('glImageTransformParameterivHP', None, [GLenum, GLenum, POINTER(GLint)], 'HP_image_transform')
+
+# GL/glext.h:5723
+glImageTransformParameterfvHP = _link_function('glImageTransformParameterfvHP', None, [GLenum, GLenum, POINTER(GLfloat)], 'HP_image_transform')
+
+# GL/glext.h:5724
+glGetImageTransformParameterivHP = _link_function('glGetImageTransformParameterivHP', None, [GLenum, GLenum, POINTER(GLint)], 'HP_image_transform')
+
+# GL/glext.h:5725
+glGetImageTransformParameterfvHP = _link_function('glGetImageTransformParameterfvHP', None, [GLenum, GLenum, POINTER(GLfloat)], 'HP_image_transform')
+
+PFNGLIMAGETRANSFORMPARAMETERIHPPROC = CFUNCTYPE(None, GLenum, GLenum, GLint) # GL/glext.h:5727
+PFNGLIMAGETRANSFORMPARAMETERFHPPROC = CFUNCTYPE(None, GLenum, GLenum, GLfloat) # GL/glext.h:5728
+PFNGLIMAGETRANSFORMPARAMETERIVHPPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5729
+PFNGLIMAGETRANSFORMPARAMETERFVHPPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5730
+PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5731
+PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5732
+# HP_convolution_border_modes (GL/glext.h:5735)
+GL_HP_convolution_border_modes = 1 # GL/glext.h:5736
+# SGIX_texture_add_env (GL/glext.h:5739)
+GL_SGIX_texture_add_env = 1 # GL/glext.h:5740
+# EXT_color_subtable (GL/glext.h:5743)
+GL_EXT_color_subtable = 1 # GL/glext.h:5744
+# GL/glext.h:5746
+glColorSubTableEXT = _link_function('glColorSubTableEXT', None, [GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_color_subtable')
+
+# GL/glext.h:5747
+glCopyColorSubTableEXT = _link_function('glCopyColorSubTableEXT', None, [GLenum, GLsizei, GLint, GLint, GLsizei], 'EXT_color_subtable')
+
+PFNGLCOLORSUBTABLEEXTPROC = CFUNCTYPE(None, GLenum, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5749
+PFNGLCOPYCOLORSUBTABLEEXTPROC = CFUNCTYPE(None, GLenum, GLsizei, GLint, GLint, GLsizei) # GL/glext.h:5750
+# PGI_vertex_hints (GL/glext.h:5753)
+GL_PGI_vertex_hints = 1 # GL/glext.h:5754
+# PGI_misc_hints (GL/glext.h:5757)
+GL_PGI_misc_hints = 1 # GL/glext.h:5758
+# GL/glext.h:5760
+glHintPGI = _link_function('glHintPGI', None, [GLenum, GLint], 'PGI_misc_hints')
+
+PFNGLHINTPGIPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:5762
+# EXT_paletted_texture (GL/glext.h:5765)
+GL_EXT_paletted_texture = 1 # GL/glext.h:5766
+# GL/glext.h:5768
+glColorTableEXT = _link_function('glColorTableEXT', None, [GLenum, GLenum, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_paletted_texture')
+
+# GL/glext.h:5769
+glGetColorTableEXT = _link_function('glGetColorTableEXT', None, [GLenum, GLenum, GLenum, POINTER(GLvoid)], 'EXT_paletted_texture')
+
+# GL/glext.h:5770
+glGetColorTableParameterivEXT = _link_function('glGetColorTableParameterivEXT', None, [GLenum, GLenum, POINTER(GLint)], 'EXT_paletted_texture')
+
+# GL/glext.h:5771
+glGetColorTableParameterfvEXT = _link_function('glGetColorTableParameterfvEXT', None, [GLenum, GLenum, POINTER(GLfloat)], 'EXT_paletted_texture')
+
+PFNGLCOLORTABLEEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5773
+PFNGLGETCOLORTABLEEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:5774
+PFNGLGETCOLORTABLEPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5775
+PFNGLGETCOLORTABLEPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5776
+# EXT_clip_volume_hint (GL/glext.h:5779)
+GL_EXT_clip_volume_hint = 1 # GL/glext.h:5780
+# SGIX_list_priority (GL/glext.h:5783)
+GL_SGIX_list_priority = 1 # GL/glext.h:5784
+# GL/glext.h:5786
+glGetListParameterfvSGIX = _link_function('glGetListParameterfvSGIX', None, [GLuint, GLenum, POINTER(GLfloat)], 'SGIX_list_priority')
+
+# GL/glext.h:5787
+glGetListParameterivSGIX = _link_function('glGetListParameterivSGIX', None, [GLuint, GLenum, POINTER(GLint)], 'SGIX_list_priority')
+
+# GL/glext.h:5788
+glListParameterfSGIX = _link_function('glListParameterfSGIX', None, [GLuint, GLenum, GLfloat], 'SGIX_list_priority')
+
+# GL/glext.h:5789
+glListParameterfvSGIX = _link_function('glListParameterfvSGIX', None, [GLuint, GLenum, POINTER(GLfloat)], 'SGIX_list_priority')
+
+# GL/glext.h:5790
+glListParameteriSGIX = _link_function('glListParameteriSGIX', None, [GLuint, GLenum, GLint], 'SGIX_list_priority')
+
+# GL/glext.h:5791
+glListParameterivSGIX = _link_function('glListParameterivSGIX', None, [GLuint, GLenum, POINTER(GLint)], 'SGIX_list_priority')
+
+PFNGLGETLISTPARAMETERFVSGIXPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:5793
+PFNGLGETLISTPARAMETERIVSGIXPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:5794
+PFNGLLISTPARAMETERFSGIXPROC = CFUNCTYPE(None, GLuint, GLenum, GLfloat) # GL/glext.h:5795
+PFNGLLISTPARAMETERFVSGIXPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:5796
+PFNGLLISTPARAMETERISGIXPROC = CFUNCTYPE(None, GLuint, GLenum, GLint) # GL/glext.h:5797
+PFNGLLISTPARAMETERIVSGIXPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:5798
+# SGIX_ir_instrument1 (GL/glext.h:5801)
+GL_SGIX_ir_instrument1 = 1 # GL/glext.h:5802
+# SGIX_calligraphic_fragment (GL/glext.h:5805)
+GL_SGIX_calligraphic_fragment = 1 # GL/glext.h:5806
+# SGIX_texture_lod_bias (GL/glext.h:5809)
+GL_SGIX_texture_lod_bias = 1 # GL/glext.h:5810
+# SGIX_shadow_ambient (GL/glext.h:5813)
+GL_SGIX_shadow_ambient = 1 # GL/glext.h:5814
+# EXT_index_texture (GL/glext.h:5817)
+GL_EXT_index_texture = 1 # GL/glext.h:5818
+# EXT_index_material (GL/glext.h:5821)
+GL_EXT_index_material = 1 # GL/glext.h:5822
+# GL/glext.h:5824
+glIndexMaterialEXT = _link_function('glIndexMaterialEXT', None, [GLenum, GLenum], 'EXT_index_material')
+
+PFNGLINDEXMATERIALEXTPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:5826
+# EXT_index_func (GL/glext.h:5829)
+GL_EXT_index_func = 1 # GL/glext.h:5830
+# GL/glext.h:5832
+glIndexFuncEXT = _link_function('glIndexFuncEXT', None, [GLenum, GLclampf], 'EXT_index_func')
+
+PFNGLINDEXFUNCEXTPROC = CFUNCTYPE(None, GLenum, GLclampf) # GL/glext.h:5834
+# EXT_index_array_formats (GL/glext.h:5837)
+GL_EXT_index_array_formats = 1 # GL/glext.h:5838
+# EXT_compiled_vertex_array (GL/glext.h:5841)
+GL_EXT_compiled_vertex_array = 1 # GL/glext.h:5842
+# GL/glext.h:5844
+glLockArraysEXT = _link_function('glLockArraysEXT', None, [GLint, GLsizei], 'EXT_compiled_vertex_array')
+
+# GL/glext.h:5845
+glUnlockArraysEXT = _link_function('glUnlockArraysEXT', None, [], 'EXT_compiled_vertex_array')
+
+PFNGLLOCKARRAYSEXTPROC = CFUNCTYPE(None, GLint, GLsizei) # GL/glext.h:5847
+PFNGLUNLOCKARRAYSEXTPROC = CFUNCTYPE(None) # GL/glext.h:5848
+# EXT_cull_vertex (GL/glext.h:5851)
+GL_EXT_cull_vertex = 1 # GL/glext.h:5852
+# GL/glext.h:5854
+glCullParameterdvEXT = _link_function('glCullParameterdvEXT', None, [GLenum, POINTER(GLdouble)], 'EXT_cull_vertex')
+
+# GL/glext.h:5855
+glCullParameterfvEXT = _link_function('glCullParameterfvEXT', None, [GLenum, POINTER(GLfloat)], 'EXT_cull_vertex')
+
+PFNGLCULLPARAMETERDVEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:5857
+PFNGLCULLPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:5858
+# SGIX_ycrcb (GL/glext.h:5861)
+GL_SGIX_ycrcb = 1 # GL/glext.h:5862
+# SGIX_fragment_lighting (GL/glext.h:5865)
+GL_SGIX_fragment_lighting = 1 # GL/glext.h:5866
+# GL/glext.h:5868
+glFragmentColorMaterialSGIX = _link_function('glFragmentColorMaterialSGIX', None, [GLenum, GLenum], 'SGIX_fragment_lighting')
+
+# GL/glext.h:5869
+glFragmentLightfSGIX = _link_function('glFragmentLightfSGIX', None, [GLenum, GLenum, GLfloat], 'SGIX_fragment_lighting')
+
+# GL/glext.h:5870
+glFragmentLightfvSGIX = _link_function('glFragmentLightfvSGIX', None, [GLenum, GLenum, POINTER(GLfloat)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:5871
+glFragmentLightiSGIX = _link_function('glFragmentLightiSGIX', None, [GLenum, GLenum, GLint], 'SGIX_fragment_lighting')
+
+# GL/glext.h:5872
+glFragmentLightivSGIX = _link_function('glFragmentLightivSGIX', None, [GLenum, GLenum, POINTER(GLint)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:5873
+glFragmentLightModelfSGIX = _link_function('glFragmentLightModelfSGIX', None, [GLenum, GLfloat], 'SGIX_fragment_lighting')
+
+# GL/glext.h:5874
+glFragmentLightModelfvSGIX = _link_function('glFragmentLightModelfvSGIX', None, [GLenum, POINTER(GLfloat)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:5875
+glFragmentLightModeliSGIX = _link_function('glFragmentLightModeliSGIX', None, [GLenum, GLint], 'SGIX_fragment_lighting')
+
+# GL/glext.h:5876
+glFragmentLightModelivSGIX = _link_function('glFragmentLightModelivSGIX', None, [GLenum, POINTER(GLint)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:5877
+glFragmentMaterialfSGIX = _link_function('glFragmentMaterialfSGIX', None, [GLenum, GLenum, GLfloat], 'SGIX_fragment_lighting')
+
+# GL/glext.h:5878
+glFragmentMaterialfvSGIX = _link_function('glFragmentMaterialfvSGIX', None, [GLenum, GLenum, POINTER(GLfloat)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:5879
+glFragmentMaterialiSGIX = _link_function('glFragmentMaterialiSGIX', None, [GLenum, GLenum, GLint], 'SGIX_fragment_lighting')
+
+# GL/glext.h:5880
+glFragmentMaterialivSGIX = _link_function('glFragmentMaterialivSGIX', None, [GLenum, GLenum, POINTER(GLint)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:5881
+glGetFragmentLightfvSGIX = _link_function('glGetFragmentLightfvSGIX', None, [GLenum, GLenum, POINTER(GLfloat)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:5882
+glGetFragmentLightivSGIX = _link_function('glGetFragmentLightivSGIX', None, [GLenum, GLenum, POINTER(GLint)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:5883
+glGetFragmentMaterialfvSGIX = _link_function('glGetFragmentMaterialfvSGIX', None, [GLenum, GLenum, POINTER(GLfloat)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:5884
+glGetFragmentMaterialivSGIX = _link_function('glGetFragmentMaterialivSGIX', None, [GLenum, GLenum, POINTER(GLint)], 'SGIX_fragment_lighting')
+
+# GL/glext.h:5885
+glLightEnviSGIX = _link_function('glLightEnviSGIX', None, [GLenum, GLint], 'SGIX_fragment_lighting')
+
+PFNGLFRAGMENTCOLORMATERIALSGIXPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:5887
+PFNGLFRAGMENTLIGHTFSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, GLfloat) # GL/glext.h:5888
+PFNGLFRAGMENTLIGHTFVSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5889
+PFNGLFRAGMENTLIGHTISGIXPROC = CFUNCTYPE(None, GLenum, GLenum, GLint) # GL/glext.h:5890
+PFNGLFRAGMENTLIGHTIVSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5891
+PFNGLFRAGMENTLIGHTMODELFSGIXPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:5892
+PFNGLFRAGMENTLIGHTMODELFVSGIXPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:5893
+PFNGLFRAGMENTLIGHTMODELISGIXPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:5894
+PFNGLFRAGMENTLIGHTMODELIVSGIXPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:5895
+PFNGLFRAGMENTMATERIALFSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, GLfloat) # GL/glext.h:5896
+PFNGLFRAGMENTMATERIALFVSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5897
+PFNGLFRAGMENTMATERIALISGIXPROC = CFUNCTYPE(None, GLenum, GLenum, GLint) # GL/glext.h:5898
+PFNGLFRAGMENTMATERIALIVSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5899
+PFNGLGETFRAGMENTLIGHTFVSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5900
+PFNGLGETFRAGMENTLIGHTIVSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5901
+PFNGLGETFRAGMENTMATERIALFVSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:5902
+PFNGLGETFRAGMENTMATERIALIVSGIXPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:5903
+PFNGLLIGHTENVISGIXPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:5904
+# IBM_rasterpos_clip (GL/glext.h:5907)
+GL_IBM_rasterpos_clip = 1 # GL/glext.h:5908
+# HP_texture_lighting (GL/glext.h:5911)
+GL_HP_texture_lighting = 1 # GL/glext.h:5912
+# EXT_draw_range_elements (GL/glext.h:5915)
+GL_EXT_draw_range_elements = 1 # GL/glext.h:5916
+# GL/glext.h:5918
+glDrawRangeElementsEXT = _link_function('glDrawRangeElementsEXT', None, [GLenum, GLuint, GLuint, GLsizei, GLenum, POINTER(GLvoid)], 'EXT_draw_range_elements')
+
+PFNGLDRAWRANGEELEMENTSEXTPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLsizei, GLenum, POINTER(GLvoid)) # GL/glext.h:5920
+# WIN_phong_shading (GL/glext.h:5923)
+GL_WIN_phong_shading = 1 # GL/glext.h:5924
+# WIN_specular_fog (GL/glext.h:5927)
+GL_WIN_specular_fog = 1 # GL/glext.h:5928
+# EXT_light_texture (GL/glext.h:5931)
+GL_EXT_light_texture = 1 # GL/glext.h:5932
+# GL/glext.h:5934
+glApplyTextureEXT = _link_function('glApplyTextureEXT', None, [GLenum], 'EXT_light_texture')
+
+# GL/glext.h:5935
+glTextureLightEXT = _link_function('glTextureLightEXT', None, [GLenum], 'EXT_light_texture')
+
+# GL/glext.h:5936
+glTextureMaterialEXT = _link_function('glTextureMaterialEXT', None, [GLenum, GLenum], 'EXT_light_texture')
+
+PFNGLAPPLYTEXTUREEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:5938
+PFNGLTEXTURELIGHTEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:5939
+PFNGLTEXTUREMATERIALEXTPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:5940
+# SGIX_blend_alpha_minmax (GL/glext.h:5943)
+GL_SGIX_blend_alpha_minmax = 1 # GL/glext.h:5944
+# EXT_bgra (GL/glext.h:5947)
+GL_EXT_bgra = 1 # GL/glext.h:5948
+# SGIX_async (GL/glext.h:5951)
+GL_SGIX_async = 1 # GL/glext.h:5952
+# GL/glext.h:5954
+glAsyncMarkerSGIX = _link_function('glAsyncMarkerSGIX', None, [GLuint], 'SGIX_async')
+
+# GL/glext.h:5955
+glFinishAsyncSGIX = _link_function('glFinishAsyncSGIX', GLint, [POINTER(GLuint)], 'SGIX_async')
+
+# GL/glext.h:5956
+glPollAsyncSGIX = _link_function('glPollAsyncSGIX', GLint, [POINTER(GLuint)], 'SGIX_async')
+
+# GL/glext.h:5957
+glGenAsyncMarkersSGIX = _link_function('glGenAsyncMarkersSGIX', GLuint, [GLsizei], 'SGIX_async')
+
+# GL/glext.h:5958
+glDeleteAsyncMarkersSGIX = _link_function('glDeleteAsyncMarkersSGIX', None, [GLuint, GLsizei], 'SGIX_async')
+
+# GL/glext.h:5959
+glIsAsyncMarkerSGIX = _link_function('glIsAsyncMarkerSGIX', GLboolean, [GLuint], 'SGIX_async')
+
+PFNGLASYNCMARKERSGIXPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:5961
+PFNGLFINISHASYNCSGIXPROC = CFUNCTYPE(GLint, POINTER(GLuint)) # GL/glext.h:5962
+PFNGLPOLLASYNCSGIXPROC = CFUNCTYPE(GLint, POINTER(GLuint)) # GL/glext.h:5963
+PFNGLGENASYNCMARKERSSGIXPROC = CFUNCTYPE(GLuint, GLsizei) # GL/glext.h:5964
+PFNGLDELETEASYNCMARKERSSGIXPROC = CFUNCTYPE(None, GLuint, GLsizei) # GL/glext.h:5965
+PFNGLISASYNCMARKERSGIXPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:5966
+# SGIX_async_pixel (GL/glext.h:5969)
+GL_SGIX_async_pixel = 1 # GL/glext.h:5970
+# SGIX_async_histogram (GL/glext.h:5973)
+GL_SGIX_async_histogram = 1 # GL/glext.h:5974
+# INTEL_parallel_arrays (GL/glext.h:5977)
+GL_INTEL_parallel_arrays = 1 # GL/glext.h:5978
+# GL/glext.h:5980
+glVertexPointervINTEL = _link_function('glVertexPointervINTEL', None, [GLint, GLenum, POINTER(POINTER(GLvoid))], 'INTEL_parallel_arrays')
+
+# GL/glext.h:5981
+glNormalPointervINTEL = _link_function('glNormalPointervINTEL', None, [GLenum, POINTER(POINTER(GLvoid))], 'INTEL_parallel_arrays')
+
+# GL/glext.h:5982
+glColorPointervINTEL = _link_function('glColorPointervINTEL', None, [GLint, GLenum, POINTER(POINTER(GLvoid))], 'INTEL_parallel_arrays')
+
+# GL/glext.h:5983
+glTexCoordPointervINTEL = _link_function('glTexCoordPointervINTEL', None, [GLint, GLenum, POINTER(POINTER(GLvoid))], 'INTEL_parallel_arrays')
+
+PFNGLVERTEXPOINTERVINTELPROC = CFUNCTYPE(None, GLint, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:5985
+PFNGLNORMALPOINTERVINTELPROC = CFUNCTYPE(None, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:5986
+PFNGLCOLORPOINTERVINTELPROC = CFUNCTYPE(None, GLint, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:5987
+PFNGLTEXCOORDPOINTERVINTELPROC = CFUNCTYPE(None, GLint, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:5988
+# HP_occlusion_test (GL/glext.h:5991)
+GL_HP_occlusion_test = 1 # GL/glext.h:5992
+# EXT_pixel_transform (GL/glext.h:5995)
+GL_EXT_pixel_transform = 1 # GL/glext.h:5996
+# GL/glext.h:5998
+glPixelTransformParameteriEXT = _link_function('glPixelTransformParameteriEXT', None, [GLenum, GLenum, GLint], 'EXT_pixel_transform')
+
+# GL/glext.h:5999
+glPixelTransformParameterfEXT = _link_function('glPixelTransformParameterfEXT', None, [GLenum, GLenum, GLfloat], 'EXT_pixel_transform')
+
+# GL/glext.h:6000
+glPixelTransformParameterivEXT = _link_function('glPixelTransformParameterivEXT', None, [GLenum, GLenum, POINTER(GLint)], 'EXT_pixel_transform')
+
+# GL/glext.h:6001
+glPixelTransformParameterfvEXT = _link_function('glPixelTransformParameterfvEXT', None, [GLenum, GLenum, POINTER(GLfloat)], 'EXT_pixel_transform')
+
+PFNGLPIXELTRANSFORMPARAMETERIEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint) # GL/glext.h:6003
+PFNGLPIXELTRANSFORMPARAMETERFEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLfloat) # GL/glext.h:6004
+PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:6005
+PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:6006
+# EXT_pixel_transform_color_table (GL/glext.h:6009)
+GL_EXT_pixel_transform_color_table = 1 # GL/glext.h:6010
+# EXT_shared_texture_palette (GL/glext.h:6013)
+GL_EXT_shared_texture_palette = 1 # GL/glext.h:6014
+# EXT_separate_specular_color (GL/glext.h:6017)
+GL_EXT_separate_specular_color = 1 # GL/glext.h:6018
+# EXT_secondary_color (GL/glext.h:6021)
+GL_EXT_secondary_color = 1 # GL/glext.h:6022
+# GL/glext.h:6024
+glSecondaryColor3bEXT = _link_function('glSecondaryColor3bEXT', None, [GLbyte, GLbyte, GLbyte], 'EXT_secondary_color')
+
+# GL/glext.h:6025
+glSecondaryColor3bvEXT = _link_function('glSecondaryColor3bvEXT', None, [POINTER(GLbyte)], 'EXT_secondary_color')
+
+# GL/glext.h:6026
+glSecondaryColor3dEXT = _link_function('glSecondaryColor3dEXT', None, [GLdouble, GLdouble, GLdouble], 'EXT_secondary_color')
+
+# GL/glext.h:6027
+glSecondaryColor3dvEXT = _link_function('glSecondaryColor3dvEXT', None, [POINTER(GLdouble)], 'EXT_secondary_color')
+
+# GL/glext.h:6028
+glSecondaryColor3fEXT = _link_function('glSecondaryColor3fEXT', None, [GLfloat, GLfloat, GLfloat], 'EXT_secondary_color')
+
+# GL/glext.h:6029
+glSecondaryColor3fvEXT = _link_function('glSecondaryColor3fvEXT', None, [POINTER(GLfloat)], 'EXT_secondary_color')
+
+# GL/glext.h:6030
+glSecondaryColor3iEXT = _link_function('glSecondaryColor3iEXT', None, [GLint, GLint, GLint], 'EXT_secondary_color')
+
+# GL/glext.h:6031
+glSecondaryColor3ivEXT = _link_function('glSecondaryColor3ivEXT', None, [POINTER(GLint)], 'EXT_secondary_color')
+
+# GL/glext.h:6032
+glSecondaryColor3sEXT = _link_function('glSecondaryColor3sEXT', None, [GLshort, GLshort, GLshort], 'EXT_secondary_color')
+
+# GL/glext.h:6033
+glSecondaryColor3svEXT = _link_function('glSecondaryColor3svEXT', None, [POINTER(GLshort)], 'EXT_secondary_color')
+
+# GL/glext.h:6034
+glSecondaryColor3ubEXT = _link_function('glSecondaryColor3ubEXT', None, [GLubyte, GLubyte, GLubyte], 'EXT_secondary_color')
+
+# GL/glext.h:6035
+glSecondaryColor3ubvEXT = _link_function('glSecondaryColor3ubvEXT', None, [POINTER(GLubyte)], 'EXT_secondary_color')
+
+# GL/glext.h:6036
+glSecondaryColor3uiEXT = _link_function('glSecondaryColor3uiEXT', None, [GLuint, GLuint, GLuint], 'EXT_secondary_color')
+
+# GL/glext.h:6037
+glSecondaryColor3uivEXT = _link_function('glSecondaryColor3uivEXT', None, [POINTER(GLuint)], 'EXT_secondary_color')
+
+# GL/glext.h:6038
+glSecondaryColor3usEXT = _link_function('glSecondaryColor3usEXT', None, [GLushort, GLushort, GLushort], 'EXT_secondary_color')
+
+# GL/glext.h:6039
+glSecondaryColor3usvEXT = _link_function('glSecondaryColor3usvEXT', None, [POINTER(GLushort)], 'EXT_secondary_color')
+
+# GL/glext.h:6040
+glSecondaryColorPointerEXT = _link_function('glSecondaryColorPointerEXT', None, [GLint, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_secondary_color')
+
+PFNGLSECONDARYCOLOR3BEXTPROC = CFUNCTYPE(None, GLbyte, GLbyte, GLbyte) # GL/glext.h:6042
+PFNGLSECONDARYCOLOR3BVEXTPROC = CFUNCTYPE(None, POINTER(GLbyte)) # GL/glext.h:6043
+PFNGLSECONDARYCOLOR3DEXTPROC = CFUNCTYPE(None, GLdouble, GLdouble, GLdouble) # GL/glext.h:6044
+PFNGLSECONDARYCOLOR3DVEXTPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:6045
+PFNGLSECONDARYCOLOR3FEXTPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat) # GL/glext.h:6046
+PFNGLSECONDARYCOLOR3FVEXTPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:6047
+PFNGLSECONDARYCOLOR3IEXTPROC = CFUNCTYPE(None, GLint, GLint, GLint) # GL/glext.h:6048
+PFNGLSECONDARYCOLOR3IVEXTPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:6049
+PFNGLSECONDARYCOLOR3SEXTPROC = CFUNCTYPE(None, GLshort, GLshort, GLshort) # GL/glext.h:6050
+PFNGLSECONDARYCOLOR3SVEXTPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:6051
+PFNGLSECONDARYCOLOR3UBEXTPROC = CFUNCTYPE(None, GLubyte, GLubyte, GLubyte) # GL/glext.h:6052
+PFNGLSECONDARYCOLOR3UBVEXTPROC = CFUNCTYPE(None, POINTER(GLubyte)) # GL/glext.h:6053
+PFNGLSECONDARYCOLOR3UIEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint) # GL/glext.h:6054
+PFNGLSECONDARYCOLOR3UIVEXTPROC = CFUNCTYPE(None, POINTER(GLuint)) # GL/glext.h:6055
+PFNGLSECONDARYCOLOR3USEXTPROC = CFUNCTYPE(None, GLushort, GLushort, GLushort) # GL/glext.h:6056
+PFNGLSECONDARYCOLOR3USVEXTPROC = CFUNCTYPE(None, POINTER(GLushort)) # GL/glext.h:6057
+PFNGLSECONDARYCOLORPOINTEREXTPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:6058
+# EXT_texture_perturb_normal (GL/glext.h:6061)
+GL_EXT_texture_perturb_normal = 1 # GL/glext.h:6062
+# GL/glext.h:6064
+glTextureNormalEXT = _link_function('glTextureNormalEXT', None, [GLenum], 'EXT_texture_perturb_normal')
+
+PFNGLTEXTURENORMALEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:6066
+# EXT_multi_draw_arrays (GL/glext.h:6069)
+GL_EXT_multi_draw_arrays = 1 # GL/glext.h:6070
+# GL/glext.h:6072
+glMultiDrawArraysEXT = _link_function('glMultiDrawArraysEXT', None, [GLenum, POINTER(GLint), POINTER(GLsizei), GLsizei], 'EXT_multi_draw_arrays')
+
+# GL/glext.h:6073
+glMultiDrawElementsEXT = _link_function('glMultiDrawElementsEXT', None, [GLenum, POINTER(GLsizei), GLenum, POINTER(POINTER(GLvoid)), GLsizei], 'EXT_multi_draw_arrays')
+
+PFNGLMULTIDRAWARRAYSEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLint), POINTER(GLsizei), GLsizei) # GL/glext.h:6075
+PFNGLMULTIDRAWELEMENTSEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLsizei), GLenum, POINTER(POINTER(GLvoid)), GLsizei) # GL/glext.h:6076
+# EXT_fog_coord (GL/glext.h:6079)
+GL_EXT_fog_coord = 1 # GL/glext.h:6080
+# GL/glext.h:6082
+glFogCoordfEXT = _link_function('glFogCoordfEXT', None, [GLfloat], 'EXT_fog_coord')
+
+# GL/glext.h:6083
+glFogCoordfvEXT = _link_function('glFogCoordfvEXT', None, [POINTER(GLfloat)], 'EXT_fog_coord')
+
+# GL/glext.h:6084
+glFogCoorddEXT = _link_function('glFogCoorddEXT', None, [GLdouble], 'EXT_fog_coord')
+
+# GL/glext.h:6085
+glFogCoorddvEXT = _link_function('glFogCoorddvEXT', None, [POINTER(GLdouble)], 'EXT_fog_coord')
+
+# GL/glext.h:6086
+glFogCoordPointerEXT = _link_function('glFogCoordPointerEXT', None, [GLenum, GLsizei, POINTER(GLvoid)], 'EXT_fog_coord')
+
+PFNGLFOGCOORDFEXTPROC = CFUNCTYPE(None, GLfloat) # GL/glext.h:6088
+PFNGLFOGCOORDFVEXTPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:6089
+PFNGLFOGCOORDDEXTPROC = CFUNCTYPE(None, GLdouble) # GL/glext.h:6090
+PFNGLFOGCOORDDVEXTPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:6091
+PFNGLFOGCOORDPOINTEREXTPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:6092
+# REND_screen_coordinates (GL/glext.h:6095)
+GL_REND_screen_coordinates = 1 # GL/glext.h:6096
+# EXT_coordinate_frame (GL/glext.h:6099)
+GL_EXT_coordinate_frame = 1 # GL/glext.h:6100
+# GL/glext.h:6102
+glTangent3bEXT = _link_function('glTangent3bEXT', None, [GLbyte, GLbyte, GLbyte], 'EXT_coordinate_frame')
+
+# GL/glext.h:6103
+glTangent3bvEXT = _link_function('glTangent3bvEXT', None, [POINTER(GLbyte)], 'EXT_coordinate_frame')
+
+# GL/glext.h:6104
+glTangent3dEXT = _link_function('glTangent3dEXT', None, [GLdouble, GLdouble, GLdouble], 'EXT_coordinate_frame')
+
+# GL/glext.h:6105
+glTangent3dvEXT = _link_function('glTangent3dvEXT', None, [POINTER(GLdouble)], 'EXT_coordinate_frame')
+
+# GL/glext.h:6106
+glTangent3fEXT = _link_function('glTangent3fEXT', None, [GLfloat, GLfloat, GLfloat], 'EXT_coordinate_frame')
+
+# GL/glext.h:6107
+glTangent3fvEXT = _link_function('glTangent3fvEXT', None, [POINTER(GLfloat)], 'EXT_coordinate_frame')
+
+# GL/glext.h:6108
+glTangent3iEXT = _link_function('glTangent3iEXT', None, [GLint, GLint, GLint], 'EXT_coordinate_frame')
+
+# GL/glext.h:6109
+glTangent3ivEXT = _link_function('glTangent3ivEXT', None, [POINTER(GLint)], 'EXT_coordinate_frame')
+
+# GL/glext.h:6110
+glTangent3sEXT = _link_function('glTangent3sEXT', None, [GLshort, GLshort, GLshort], 'EXT_coordinate_frame')
+
+# GL/glext.h:6111
+glTangent3svEXT = _link_function('glTangent3svEXT', None, [POINTER(GLshort)], 'EXT_coordinate_frame')
+
+# GL/glext.h:6112
+glBinormal3bEXT = _link_function('glBinormal3bEXT', None, [GLbyte, GLbyte, GLbyte], 'EXT_coordinate_frame')
+
+# GL/glext.h:6113
+glBinormal3bvEXT = _link_function('glBinormal3bvEXT', None, [POINTER(GLbyte)], 'EXT_coordinate_frame')
+
+# GL/glext.h:6114
+glBinormal3dEXT = _link_function('glBinormal3dEXT', None, [GLdouble, GLdouble, GLdouble], 'EXT_coordinate_frame')
+
+# GL/glext.h:6115
+glBinormal3dvEXT = _link_function('glBinormal3dvEXT', None, [POINTER(GLdouble)], 'EXT_coordinate_frame')
+
+# GL/glext.h:6116
+glBinormal3fEXT = _link_function('glBinormal3fEXT', None, [GLfloat, GLfloat, GLfloat], 'EXT_coordinate_frame')
+
+# GL/glext.h:6117
+glBinormal3fvEXT = _link_function('glBinormal3fvEXT', None, [POINTER(GLfloat)], 'EXT_coordinate_frame')
+
+# GL/glext.h:6118
+glBinormal3iEXT = _link_function('glBinormal3iEXT', None, [GLint, GLint, GLint], 'EXT_coordinate_frame')
+
+# GL/glext.h:6119
+glBinormal3ivEXT = _link_function('glBinormal3ivEXT', None, [POINTER(GLint)], 'EXT_coordinate_frame')
+
+# GL/glext.h:6120
+glBinormal3sEXT = _link_function('glBinormal3sEXT', None, [GLshort, GLshort, GLshort], 'EXT_coordinate_frame')
+
+# GL/glext.h:6121
+glBinormal3svEXT = _link_function('glBinormal3svEXT', None, [POINTER(GLshort)], 'EXT_coordinate_frame')
+
+# GL/glext.h:6122
+glTangentPointerEXT = _link_function('glTangentPointerEXT', None, [GLenum, GLsizei, POINTER(GLvoid)], 'EXT_coordinate_frame')
+
+# GL/glext.h:6123
+glBinormalPointerEXT = _link_function('glBinormalPointerEXT', None, [GLenum, GLsizei, POINTER(GLvoid)], 'EXT_coordinate_frame')
+
+PFNGLTANGENT3BEXTPROC = CFUNCTYPE(None, GLbyte, GLbyte, GLbyte) # GL/glext.h:6125
+PFNGLTANGENT3BVEXTPROC = CFUNCTYPE(None, POINTER(GLbyte)) # GL/glext.h:6126
+PFNGLTANGENT3DEXTPROC = CFUNCTYPE(None, GLdouble, GLdouble, GLdouble) # GL/glext.h:6127
+PFNGLTANGENT3DVEXTPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:6128
+PFNGLTANGENT3FEXTPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat) # GL/glext.h:6129
+PFNGLTANGENT3FVEXTPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:6130
+PFNGLTANGENT3IEXTPROC = CFUNCTYPE(None, GLint, GLint, GLint) # GL/glext.h:6131
+PFNGLTANGENT3IVEXTPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:6132
+PFNGLTANGENT3SEXTPROC = CFUNCTYPE(None, GLshort, GLshort, GLshort) # GL/glext.h:6133
+PFNGLTANGENT3SVEXTPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:6134
+PFNGLBINORMAL3BEXTPROC = CFUNCTYPE(None, GLbyte, GLbyte, GLbyte) # GL/glext.h:6135
+PFNGLBINORMAL3BVEXTPROC = CFUNCTYPE(None, POINTER(GLbyte)) # GL/glext.h:6136
+PFNGLBINORMAL3DEXTPROC = CFUNCTYPE(None, GLdouble, GLdouble, GLdouble) # GL/glext.h:6137
+PFNGLBINORMAL3DVEXTPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:6138
+PFNGLBINORMAL3FEXTPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat) # GL/glext.h:6139
+PFNGLBINORMAL3FVEXTPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:6140
+PFNGLBINORMAL3IEXTPROC = CFUNCTYPE(None, GLint, GLint, GLint) # GL/glext.h:6141
+PFNGLBINORMAL3IVEXTPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:6142
+PFNGLBINORMAL3SEXTPROC = CFUNCTYPE(None, GLshort, GLshort, GLshort) # GL/glext.h:6143
+PFNGLBINORMAL3SVEXTPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:6144
+PFNGLTANGENTPOINTEREXTPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:6145
+PFNGLBINORMALPOINTEREXTPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:6146
+# EXT_texture_env_combine (GL/glext.h:6149)
+GL_EXT_texture_env_combine = 1 # GL/glext.h:6150
+# APPLE_specular_vector (GL/glext.h:6153)
+GL_APPLE_specular_vector = 1 # GL/glext.h:6154
+# APPLE_transform_hint (GL/glext.h:6157)
+GL_APPLE_transform_hint = 1 # GL/glext.h:6158
+# SGIX_fog_scale (GL/glext.h:6161)
+GL_SGIX_fog_scale = 1 # GL/glext.h:6162
+# SUNX_constant_data (GL/glext.h:6165)
+GL_SUNX_constant_data = 1 # GL/glext.h:6166
+# GL/glext.h:6168
+glFinishTextureSUNX = _link_function('glFinishTextureSUNX', None, [], 'SUNX_constant_data')
+
+PFNGLFINISHTEXTURESUNXPROC = CFUNCTYPE(None) # GL/glext.h:6170
+# SUN_global_alpha (GL/glext.h:6173)
+GL_SUN_global_alpha = 1 # GL/glext.h:6174
+# GL/glext.h:6176
+glGlobalAlphaFactorbSUN = _link_function('glGlobalAlphaFactorbSUN', None, [GLbyte], 'SUN_global_alpha')
+
+# GL/glext.h:6177
+glGlobalAlphaFactorsSUN = _link_function('glGlobalAlphaFactorsSUN', None, [GLshort], 'SUN_global_alpha')
+
+# GL/glext.h:6178
+glGlobalAlphaFactoriSUN = _link_function('glGlobalAlphaFactoriSUN', None, [GLint], 'SUN_global_alpha')
+
+# GL/glext.h:6179
+glGlobalAlphaFactorfSUN = _link_function('glGlobalAlphaFactorfSUN', None, [GLfloat], 'SUN_global_alpha')
+
+# GL/glext.h:6180
+glGlobalAlphaFactordSUN = _link_function('glGlobalAlphaFactordSUN', None, [GLdouble], 'SUN_global_alpha')
+
+# GL/glext.h:6181
+glGlobalAlphaFactorubSUN = _link_function('glGlobalAlphaFactorubSUN', None, [GLubyte], 'SUN_global_alpha')
+
+# GL/glext.h:6182
+glGlobalAlphaFactorusSUN = _link_function('glGlobalAlphaFactorusSUN', None, [GLushort], 'SUN_global_alpha')
+
+# GL/glext.h:6183
+glGlobalAlphaFactoruiSUN = _link_function('glGlobalAlphaFactoruiSUN', None, [GLuint], 'SUN_global_alpha')
+
+PFNGLGLOBALALPHAFACTORBSUNPROC = CFUNCTYPE(None, GLbyte) # GL/glext.h:6185
+PFNGLGLOBALALPHAFACTORSSUNPROC = CFUNCTYPE(None, GLshort) # GL/glext.h:6186
+PFNGLGLOBALALPHAFACTORISUNPROC = CFUNCTYPE(None, GLint) # GL/glext.h:6187
+PFNGLGLOBALALPHAFACTORFSUNPROC = CFUNCTYPE(None, GLfloat) # GL/glext.h:6188
+PFNGLGLOBALALPHAFACTORDSUNPROC = CFUNCTYPE(None, GLdouble) # GL/glext.h:6189
+PFNGLGLOBALALPHAFACTORUBSUNPROC = CFUNCTYPE(None, GLubyte) # GL/glext.h:6190
+PFNGLGLOBALALPHAFACTORUSSUNPROC = CFUNCTYPE(None, GLushort) # GL/glext.h:6191
+PFNGLGLOBALALPHAFACTORUISUNPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6192
+# SUN_triangle_list (GL/glext.h:6195)
+GL_SUN_triangle_list = 1 # GL/glext.h:6196
+# GL/glext.h:6198
+glReplacementCodeuiSUN = _link_function('glReplacementCodeuiSUN', None, [GLuint], 'SUN_triangle_list')
+
+# GL/glext.h:6199
+glReplacementCodeusSUN = _link_function('glReplacementCodeusSUN', None, [GLushort], 'SUN_triangle_list')
+
+# GL/glext.h:6200
+glReplacementCodeubSUN = _link_function('glReplacementCodeubSUN', None, [GLubyte], 'SUN_triangle_list')
+
+# GL/glext.h:6201
+glReplacementCodeuivSUN = _link_function('glReplacementCodeuivSUN', None, [POINTER(GLuint)], 'SUN_triangle_list')
+
+# GL/glext.h:6202
+glReplacementCodeusvSUN = _link_function('glReplacementCodeusvSUN', None, [POINTER(GLushort)], 'SUN_triangle_list')
+
+# GL/glext.h:6203
+glReplacementCodeubvSUN = _link_function('glReplacementCodeubvSUN', None, [POINTER(GLubyte)], 'SUN_triangle_list')
+
+# GL/glext.h:6204
+glReplacementCodePointerSUN = _link_function('glReplacementCodePointerSUN', None, [GLenum, GLsizei, POINTER(POINTER(GLvoid))], 'SUN_triangle_list')
+
+PFNGLREPLACEMENTCODEUISUNPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6206
+PFNGLREPLACEMENTCODEUSSUNPROC = CFUNCTYPE(None, GLushort) # GL/glext.h:6207
+PFNGLREPLACEMENTCODEUBSUNPROC = CFUNCTYPE(None, GLubyte) # GL/glext.h:6208
+PFNGLREPLACEMENTCODEUIVSUNPROC = CFUNCTYPE(None, POINTER(GLuint)) # GL/glext.h:6209
+PFNGLREPLACEMENTCODEUSVSUNPROC = CFUNCTYPE(None, POINTER(GLushort)) # GL/glext.h:6210
+PFNGLREPLACEMENTCODEUBVSUNPROC = CFUNCTYPE(None, POINTER(GLubyte)) # GL/glext.h:6211
+PFNGLREPLACEMENTCODEPOINTERSUNPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(POINTER(GLvoid))) # GL/glext.h:6212
+# SUN_vertex (GL/glext.h:6215)
+GL_SUN_vertex = 1 # GL/glext.h:6216
+# GL/glext.h:6218
+glColor4ubVertex2fSUN = _link_function('glColor4ubVertex2fSUN', None, [GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6219
+glColor4ubVertex2fvSUN = _link_function('glColor4ubVertex2fvSUN', None, [POINTER(GLubyte), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:6220
+glColor4ubVertex3fSUN = _link_function('glColor4ubVertex3fSUN', None, [GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6221
+glColor4ubVertex3fvSUN = _link_function('glColor4ubVertex3fvSUN', None, [POINTER(GLubyte), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:6222
+glColor3fVertex3fSUN = _link_function('glColor3fVertex3fSUN', None, [GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6223
+glColor3fVertex3fvSUN = _link_function('glColor3fVertex3fvSUN', None, [POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:6224
+glNormal3fVertex3fSUN = _link_function('glNormal3fVertex3fSUN', None, [GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6225
+glNormal3fVertex3fvSUN = _link_function('glNormal3fVertex3fvSUN', None, [POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:6226
+glColor4fNormal3fVertex3fSUN = _link_function('glColor4fNormal3fVertex3fSUN', None, [GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6227
+glColor4fNormal3fVertex3fvSUN = _link_function('glColor4fNormal3fVertex3fvSUN', None, [POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:6228
+glTexCoord2fVertex3fSUN = _link_function('glTexCoord2fVertex3fSUN', None, [GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6229
+glTexCoord2fVertex3fvSUN = _link_function('glTexCoord2fVertex3fvSUN', None, [POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:6230
+glTexCoord4fVertex4fSUN = _link_function('glTexCoord4fVertex4fSUN', None, [GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6231
+glTexCoord4fVertex4fvSUN = _link_function('glTexCoord4fVertex4fvSUN', None, [POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:6232
+glTexCoord2fColor4ubVertex3fSUN = _link_function('glTexCoord2fColor4ubVertex3fSUN', None, [GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6233
+glTexCoord2fColor4ubVertex3fvSUN = _link_function('glTexCoord2fColor4ubVertex3fvSUN', None, [POINTER(GLfloat), POINTER(GLubyte), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:6234
+glTexCoord2fColor3fVertex3fSUN = _link_function('glTexCoord2fColor3fVertex3fSUN', None, [GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6235
+glTexCoord2fColor3fVertex3fvSUN = _link_function('glTexCoord2fColor3fVertex3fvSUN', None, [POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:6236
+glTexCoord2fNormal3fVertex3fSUN = _link_function('glTexCoord2fNormal3fVertex3fSUN', None, [GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6237
+glTexCoord2fNormal3fVertex3fvSUN = _link_function('glTexCoord2fNormal3fVertex3fvSUN', None, [POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:6238
+glTexCoord2fColor4fNormal3fVertex3fSUN = _link_function('glTexCoord2fColor4fNormal3fVertex3fSUN', None, [GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6239
+glTexCoord2fColor4fNormal3fVertex3fvSUN = _link_function('glTexCoord2fColor4fNormal3fVertex3fvSUN', None, [POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:6240
+glTexCoord4fColor4fNormal3fVertex4fSUN = _link_function('glTexCoord4fColor4fNormal3fVertex4fSUN', None, [GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6241
+glTexCoord4fColor4fNormal3fVertex4fvSUN = _link_function('glTexCoord4fColor4fNormal3fVertex4fvSUN', None, [POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:6242
+glReplacementCodeuiVertex3fSUN = _link_function('glReplacementCodeuiVertex3fSUN', None, [GLuint, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6243
+glReplacementCodeuiVertex3fvSUN = _link_function('glReplacementCodeuiVertex3fvSUN', None, [POINTER(GLuint), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:6244
+glReplacementCodeuiColor4ubVertex3fSUN = _link_function('glReplacementCodeuiColor4ubVertex3fSUN', None, [GLuint, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6245
+glReplacementCodeuiColor4ubVertex3fvSUN = _link_function('glReplacementCodeuiColor4ubVertex3fvSUN', None, [POINTER(GLuint), POINTER(GLubyte), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:6246
+glReplacementCodeuiColor3fVertex3fSUN = _link_function('glReplacementCodeuiColor3fVertex3fSUN', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6247
+glReplacementCodeuiColor3fVertex3fvSUN = _link_function('glReplacementCodeuiColor3fVertex3fvSUN', None, [POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:6248
+glReplacementCodeuiNormal3fVertex3fSUN = _link_function('glReplacementCodeuiNormal3fVertex3fSUN', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6249
+glReplacementCodeuiNormal3fVertex3fvSUN = _link_function('glReplacementCodeuiNormal3fVertex3fvSUN', None, [POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:6250
+glReplacementCodeuiColor4fNormal3fVertex3fSUN = _link_function('glReplacementCodeuiColor4fNormal3fVertex3fSUN', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6251
+glReplacementCodeuiColor4fNormal3fVertex3fvSUN = _link_function('glReplacementCodeuiColor4fNormal3fVertex3fvSUN', None, [POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:6252
+glReplacementCodeuiTexCoord2fVertex3fSUN = _link_function('glReplacementCodeuiTexCoord2fVertex3fSUN', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6253
+glReplacementCodeuiTexCoord2fVertex3fvSUN = _link_function('glReplacementCodeuiTexCoord2fVertex3fvSUN', None, [POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:6254
+glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN = _link_function('glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6255
+glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN = _link_function('glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN', None, [POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+# GL/glext.h:6256
+glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN = _link_function('glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat], 'SUN_vertex')
+
+# GL/glext.h:6257
+glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN = _link_function('glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN', None, [POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)], 'SUN_vertex')
+
+PFNGLCOLOR4UBVERTEX2FSUNPROC = CFUNCTYPE(None, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat) # GL/glext.h:6259
+PFNGLCOLOR4UBVERTEX2FVSUNPROC = CFUNCTYPE(None, POINTER(GLubyte), POINTER(GLfloat)) # GL/glext.h:6260
+PFNGLCOLOR4UBVERTEX3FSUNPROC = CFUNCTYPE(None, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat) # GL/glext.h:6261
+PFNGLCOLOR4UBVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLubyte), POINTER(GLfloat)) # GL/glext.h:6262
+PFNGLCOLOR3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6263
+PFNGLCOLOR3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:6264
+PFNGLNORMAL3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6265
+PFNGLNORMAL3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:6266
+PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6267
+PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:6268
+PFNGLTEXCOORD2FVERTEX3FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6269
+PFNGLTEXCOORD2FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:6270
+PFNGLTEXCOORD4FVERTEX4FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6271
+PFNGLTEXCOORD4FVERTEX4FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:6272
+PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat) # GL/glext.h:6273
+PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLubyte), POINTER(GLfloat)) # GL/glext.h:6274
+PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6275
+PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:6276
+PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6277
+PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:6278
+PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6279
+PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:6280
+PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6281
+PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC = CFUNCTYPE(None, POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:6282
+PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat) # GL/glext.h:6283
+PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLuint), POINTER(GLfloat)) # GL/glext.h:6284
+PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC = CFUNCTYPE(None, GLuint, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat) # GL/glext.h:6285
+PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLuint), POINTER(GLubyte), POINTER(GLfloat)) # GL/glext.h:6286
+PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6287
+PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:6288
+PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6289
+PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:6290
+PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6291
+PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:6292
+PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6293
+PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:6294
+PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6295
+PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:6296
+PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6297
+PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC = CFUNCTYPE(None, POINTER(GLuint), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLfloat)) # GL/glext.h:6298
+# EXT_blend_func_separate (GL/glext.h:6301)
+GL_EXT_blend_func_separate = 1 # GL/glext.h:6302
+# GL/glext.h:6304
+glBlendFuncSeparateEXT = _link_function('glBlendFuncSeparateEXT', None, [GLenum, GLenum, GLenum, GLenum], 'EXT_blend_func_separate')
+
+PFNGLBLENDFUNCSEPARATEEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:6306
+# INGR_blend_func_separate (GL/glext.h:6309)
+GL_INGR_blend_func_separate = 1 # GL/glext.h:6310
+# GL/glext.h:6312
+glBlendFuncSeparateINGR = _link_function('glBlendFuncSeparateINGR', None, [GLenum, GLenum, GLenum, GLenum], 'INGR_blend_func_separate')
+
+PFNGLBLENDFUNCSEPARATEINGRPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:6314
+# INGR_color_clamp (GL/glext.h:6317)
+GL_INGR_color_clamp = 1 # GL/glext.h:6318
+# INGR_interlace_read (GL/glext.h:6321)
+GL_INGR_interlace_read = 1 # GL/glext.h:6322
+# EXT_stencil_wrap (GL/glext.h:6325)
+GL_EXT_stencil_wrap = 1 # GL/glext.h:6326
+# EXT_422_pixels (GL/glext.h:6329)
+GL_EXT_422_pixels = 1 # GL/glext.h:6330
+# NV_texgen_reflection (GL/glext.h:6333)
+GL_NV_texgen_reflection = 1 # GL/glext.h:6334
+# SUN_convolution_border_modes (GL/glext.h:6337)
+GL_SUN_convolution_border_modes = 1 # GL/glext.h:6338
+# EXT_texture_env_add (GL/glext.h:6341)
+GL_EXT_texture_env_add = 1 # GL/glext.h:6342
+# EXT_texture_lod_bias (GL/glext.h:6345)
+GL_EXT_texture_lod_bias = 1 # GL/glext.h:6346
+# EXT_texture_filter_anisotropic (GL/glext.h:6349)
+GL_EXT_texture_filter_anisotropic = 1 # GL/glext.h:6350
+# EXT_vertex_weighting (GL/glext.h:6353)
+GL_EXT_vertex_weighting = 1 # GL/glext.h:6354
+# GL/glext.h:6356
+glVertexWeightfEXT = _link_function('glVertexWeightfEXT', None, [GLfloat], 'EXT_vertex_weighting')
+
+# GL/glext.h:6357
+glVertexWeightfvEXT = _link_function('glVertexWeightfvEXT', None, [POINTER(GLfloat)], 'EXT_vertex_weighting')
+
+# GL/glext.h:6358
+glVertexWeightPointerEXT = _link_function('glVertexWeightPointerEXT', None, [GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_vertex_weighting')
+
+PFNGLVERTEXWEIGHTFEXTPROC = CFUNCTYPE(None, GLfloat) # GL/glext.h:6360
+PFNGLVERTEXWEIGHTFVEXTPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:6361
+PFNGLVERTEXWEIGHTPOINTEREXTPROC = CFUNCTYPE(None, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:6362
+# NV_light_max_exponent (GL/glext.h:6365)
+GL_NV_light_max_exponent = 1 # GL/glext.h:6366
+# NV_vertex_array_range (GL/glext.h:6369)
+GL_NV_vertex_array_range = 1 # GL/glext.h:6370
+# GL/glext.h:6372
+glFlushVertexArrayRangeNV = _link_function('glFlushVertexArrayRangeNV', None, [], 'NV_vertex_array_range')
+
+# GL/glext.h:6373
+glVertexArrayRangeNV = _link_function('glVertexArrayRangeNV', None, [GLsizei, POINTER(GLvoid)], 'NV_vertex_array_range')
+
+PFNGLFLUSHVERTEXARRAYRANGENVPROC = CFUNCTYPE(None) # GL/glext.h:6375
+PFNGLVERTEXARRAYRANGENVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLvoid)) # GL/glext.h:6376
+# NV_register_combiners (GL/glext.h:6379)
+GL_NV_register_combiners = 1 # GL/glext.h:6380
+# GL/glext.h:6382
+glCombinerParameterfvNV = _link_function('glCombinerParameterfvNV', None, [GLenum, POINTER(GLfloat)], 'NV_register_combiners')
+
+# GL/glext.h:6383
+glCombinerParameterfNV = _link_function('glCombinerParameterfNV', None, [GLenum, GLfloat], 'NV_register_combiners')
+
+# GL/glext.h:6384
+glCombinerParameterivNV = _link_function('glCombinerParameterivNV', None, [GLenum, POINTER(GLint)], 'NV_register_combiners')
+
+# GL/glext.h:6385
+glCombinerParameteriNV = _link_function('glCombinerParameteriNV', None, [GLenum, GLint], 'NV_register_combiners')
+
+# GL/glext.h:6386
+glCombinerInputNV = _link_function('glCombinerInputNV', None, [GLenum, GLenum, GLenum, GLenum, GLenum, GLenum], 'NV_register_combiners')
+
+# GL/glext.h:6387
+glCombinerOutputNV = _link_function('glCombinerOutputNV', None, [GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean], 'NV_register_combiners')
+
+# GL/glext.h:6388
+glFinalCombinerInputNV = _link_function('glFinalCombinerInputNV', None, [GLenum, GLenum, GLenum, GLenum], 'NV_register_combiners')
+
+# GL/glext.h:6389
+glGetCombinerInputParameterfvNV = _link_function('glGetCombinerInputParameterfvNV', None, [GLenum, GLenum, GLenum, GLenum, POINTER(GLfloat)], 'NV_register_combiners')
+
+# GL/glext.h:6390
+glGetCombinerInputParameterivNV = _link_function('glGetCombinerInputParameterivNV', None, [GLenum, GLenum, GLenum, GLenum, POINTER(GLint)], 'NV_register_combiners')
+
+# GL/glext.h:6391
+glGetCombinerOutputParameterfvNV = _link_function('glGetCombinerOutputParameterfvNV', None, [GLenum, GLenum, GLenum, POINTER(GLfloat)], 'NV_register_combiners')
+
+# GL/glext.h:6392
+glGetCombinerOutputParameterivNV = _link_function('glGetCombinerOutputParameterivNV', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'NV_register_combiners')
+
+# GL/glext.h:6393
+glGetFinalCombinerInputParameterfvNV = _link_function('glGetFinalCombinerInputParameterfvNV', None, [GLenum, GLenum, POINTER(GLfloat)], 'NV_register_combiners')
+
+# GL/glext.h:6394
+glGetFinalCombinerInputParameterivNV = _link_function('glGetFinalCombinerInputParameterivNV', None, [GLenum, GLenum, POINTER(GLint)], 'NV_register_combiners')
+
+PFNGLCOMBINERPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:6396
+PFNGLCOMBINERPARAMETERFNVPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:6397
+PFNGLCOMBINERPARAMETERIVNVPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:6398
+PFNGLCOMBINERPARAMETERINVPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:6399
+PFNGLCOMBINERINPUTNVPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:6400
+PFNGLCOMBINEROUTPUTNVPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean) # GL/glext.h:6401
+PFNGLFINALCOMBINERINPUTNVPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:6402
+PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:6403
+PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:6404
+PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:6405
+PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:6406
+PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:6407
+PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:6408
+# NV_fog_distance (GL/glext.h:6411)
+GL_NV_fog_distance = 1 # GL/glext.h:6412
+# NV_texgen_emboss (GL/glext.h:6415)
+GL_NV_texgen_emboss = 1 # GL/glext.h:6416
+# NV_blend_square (GL/glext.h:6419)
+GL_NV_blend_square = 1 # GL/glext.h:6420
+# NV_texture_env_combine4 (GL/glext.h:6423)
+GL_NV_texture_env_combine4 = 1 # GL/glext.h:6424
+# MESA_resize_buffers (GL/glext.h:6427)
+GL_MESA_resize_buffers = 1 # GL/glext.h:6428
+# GL/glext.h:6430
+glResizeBuffersMESA = _link_function('glResizeBuffersMESA', None, [], 'MESA_resize_buffers')
+
+PFNGLRESIZEBUFFERSMESAPROC = CFUNCTYPE(None) # GL/glext.h:6432
+# MESA_window_pos (GL/glext.h:6435)
+GL_MESA_window_pos = 1 # GL/glext.h:6436
+# GL/glext.h:6438
+glWindowPos2dMESA = _link_function('glWindowPos2dMESA', None, [GLdouble, GLdouble], 'MESA_window_pos')
+
+# GL/glext.h:6439
+glWindowPos2dvMESA = _link_function('glWindowPos2dvMESA', None, [POINTER(GLdouble)], 'MESA_window_pos')
+
+# GL/glext.h:6440
+glWindowPos2fMESA = _link_function('glWindowPos2fMESA', None, [GLfloat, GLfloat], 'MESA_window_pos')
+
+# GL/glext.h:6441
+glWindowPos2fvMESA = _link_function('glWindowPos2fvMESA', None, [POINTER(GLfloat)], 'MESA_window_pos')
+
+# GL/glext.h:6442
+glWindowPos2iMESA = _link_function('glWindowPos2iMESA', None, [GLint, GLint], 'MESA_window_pos')
+
+# GL/glext.h:6443
+glWindowPos2ivMESA = _link_function('glWindowPos2ivMESA', None, [POINTER(GLint)], 'MESA_window_pos')
+
+# GL/glext.h:6444
+glWindowPos2sMESA = _link_function('glWindowPos2sMESA', None, [GLshort, GLshort], 'MESA_window_pos')
+
+# GL/glext.h:6445
+glWindowPos2svMESA = _link_function('glWindowPos2svMESA', None, [POINTER(GLshort)], 'MESA_window_pos')
+
+# GL/glext.h:6446
+glWindowPos3dMESA = _link_function('glWindowPos3dMESA', None, [GLdouble, GLdouble, GLdouble], 'MESA_window_pos')
+
+# GL/glext.h:6447
+glWindowPos3dvMESA = _link_function('glWindowPos3dvMESA', None, [POINTER(GLdouble)], 'MESA_window_pos')
+
+# GL/glext.h:6448
+glWindowPos3fMESA = _link_function('glWindowPos3fMESA', None, [GLfloat, GLfloat, GLfloat], 'MESA_window_pos')
+
+# GL/glext.h:6449
+glWindowPos3fvMESA = _link_function('glWindowPos3fvMESA', None, [POINTER(GLfloat)], 'MESA_window_pos')
+
+# GL/glext.h:6450
+glWindowPos3iMESA = _link_function('glWindowPos3iMESA', None, [GLint, GLint, GLint], 'MESA_window_pos')
+
+# GL/glext.h:6451
+glWindowPos3ivMESA = _link_function('glWindowPos3ivMESA', None, [POINTER(GLint)], 'MESA_window_pos')
+
+# GL/glext.h:6452
+glWindowPos3sMESA = _link_function('glWindowPos3sMESA', None, [GLshort, GLshort, GLshort], 'MESA_window_pos')
+
+# GL/glext.h:6453
+glWindowPos3svMESA = _link_function('glWindowPos3svMESA', None, [POINTER(GLshort)], 'MESA_window_pos')
+
+# GL/glext.h:6454
+glWindowPos4dMESA = _link_function('glWindowPos4dMESA', None, [GLdouble, GLdouble, GLdouble, GLdouble], 'MESA_window_pos')
+
+# GL/glext.h:6455
+glWindowPos4dvMESA = _link_function('glWindowPos4dvMESA', None, [POINTER(GLdouble)], 'MESA_window_pos')
+
+# GL/glext.h:6456
+glWindowPos4fMESA = _link_function('glWindowPos4fMESA', None, [GLfloat, GLfloat, GLfloat, GLfloat], 'MESA_window_pos')
+
+# GL/glext.h:6457
+glWindowPos4fvMESA = _link_function('glWindowPos4fvMESA', None, [POINTER(GLfloat)], 'MESA_window_pos')
+
+# GL/glext.h:6458
+glWindowPos4iMESA = _link_function('glWindowPos4iMESA', None, [GLint, GLint, GLint, GLint], 'MESA_window_pos')
+
+# GL/glext.h:6459
+glWindowPos4ivMESA = _link_function('glWindowPos4ivMESA', None, [POINTER(GLint)], 'MESA_window_pos')
+
+# GL/glext.h:6460
+glWindowPos4sMESA = _link_function('glWindowPos4sMESA', None, [GLshort, GLshort, GLshort, GLshort], 'MESA_window_pos')
+
+# GL/glext.h:6461
+glWindowPos4svMESA = _link_function('glWindowPos4svMESA', None, [POINTER(GLshort)], 'MESA_window_pos')
+
+PFNGLWINDOWPOS2DMESAPROC = CFUNCTYPE(None, GLdouble, GLdouble) # GL/glext.h:6463
+PFNGLWINDOWPOS2DVMESAPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:6464
+PFNGLWINDOWPOS2FMESAPROC = CFUNCTYPE(None, GLfloat, GLfloat) # GL/glext.h:6465
+PFNGLWINDOWPOS2FVMESAPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:6466
+PFNGLWINDOWPOS2IMESAPROC = CFUNCTYPE(None, GLint, GLint) # GL/glext.h:6467
+PFNGLWINDOWPOS2IVMESAPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:6468
+PFNGLWINDOWPOS2SMESAPROC = CFUNCTYPE(None, GLshort, GLshort) # GL/glext.h:6469
+PFNGLWINDOWPOS2SVMESAPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:6470
+PFNGLWINDOWPOS3DMESAPROC = CFUNCTYPE(None, GLdouble, GLdouble, GLdouble) # GL/glext.h:6471
+PFNGLWINDOWPOS3DVMESAPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:6472
+PFNGLWINDOWPOS3FMESAPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat) # GL/glext.h:6473
+PFNGLWINDOWPOS3FVMESAPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:6474
+PFNGLWINDOWPOS3IMESAPROC = CFUNCTYPE(None, GLint, GLint, GLint) # GL/glext.h:6475
+PFNGLWINDOWPOS3IVMESAPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:6476
+PFNGLWINDOWPOS3SMESAPROC = CFUNCTYPE(None, GLshort, GLshort, GLshort) # GL/glext.h:6477
+PFNGLWINDOWPOS3SVMESAPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:6478
+PFNGLWINDOWPOS4DMESAPROC = CFUNCTYPE(None, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:6479
+PFNGLWINDOWPOS4DVMESAPROC = CFUNCTYPE(None, POINTER(GLdouble)) # GL/glext.h:6480
+PFNGLWINDOWPOS4FMESAPROC = CFUNCTYPE(None, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6481
+PFNGLWINDOWPOS4FVMESAPROC = CFUNCTYPE(None, POINTER(GLfloat)) # GL/glext.h:6482
+PFNGLWINDOWPOS4IMESAPROC = CFUNCTYPE(None, GLint, GLint, GLint, GLint) # GL/glext.h:6483
+PFNGLWINDOWPOS4IVMESAPROC = CFUNCTYPE(None, POINTER(GLint)) # GL/glext.h:6484
+PFNGLWINDOWPOS4SMESAPROC = CFUNCTYPE(None, GLshort, GLshort, GLshort, GLshort) # GL/glext.h:6485
+PFNGLWINDOWPOS4SVMESAPROC = CFUNCTYPE(None, POINTER(GLshort)) # GL/glext.h:6486
+# EXT_texture_compression_s3tc (GL/glext.h:6489)
+GL_EXT_texture_compression_s3tc = 1 # GL/glext.h:6490
+# IBM_cull_vertex (GL/glext.h:6493)
+GL_IBM_cull_vertex = 1 # GL/glext.h:6494
+# IBM_multimode_draw_arrays (GL/glext.h:6497)
+GL_IBM_multimode_draw_arrays = 1 # GL/glext.h:6498
+# GL/glext.h:6500
+glMultiModeDrawArraysIBM = _link_function('glMultiModeDrawArraysIBM', None, [POINTER(GLenum), POINTER(GLint), POINTER(GLsizei), GLsizei, GLint], 'IBM_multimode_draw_arrays')
+
+# GL/glext.h:6501
+glMultiModeDrawElementsIBM = _link_function('glMultiModeDrawElementsIBM', None, [POINTER(GLenum), POINTER(GLsizei), GLenum, POINTER(POINTER(GLvoid)), GLsizei, GLint], 'IBM_multimode_draw_arrays')
+
+PFNGLMULTIMODEDRAWARRAYSIBMPROC = CFUNCTYPE(None, POINTER(GLenum), POINTER(GLint), POINTER(GLsizei), GLsizei, GLint) # GL/glext.h:6503
+PFNGLMULTIMODEDRAWELEMENTSIBMPROC = CFUNCTYPE(None, POINTER(GLenum), POINTER(GLsizei), GLenum, POINTER(POINTER(GLvoid)), GLsizei, GLint) # GL/glext.h:6504
+# IBM_vertex_array_lists (GL/glext.h:6507)
+GL_IBM_vertex_array_lists = 1 # GL/glext.h:6508
+# GL/glext.h:6510
+glColorPointerListIBM = _link_function('glColorPointerListIBM', None, [GLint, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint], 'IBM_vertex_array_lists')
+
+# GL/glext.h:6511
+glSecondaryColorPointerListIBM = _link_function('glSecondaryColorPointerListIBM', None, [GLint, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint], 'IBM_vertex_array_lists')
+
+# GL/glext.h:6512
+glEdgeFlagPointerListIBM = _link_function('glEdgeFlagPointerListIBM', None, [GLint, POINTER(POINTER(GLboolean)), GLint], 'IBM_vertex_array_lists')
+
+# GL/glext.h:6513
+glFogCoordPointerListIBM = _link_function('glFogCoordPointerListIBM', None, [GLenum, GLint, POINTER(POINTER(GLvoid)), GLint], 'IBM_vertex_array_lists')
+
+# GL/glext.h:6514
+glIndexPointerListIBM = _link_function('glIndexPointerListIBM', None, [GLenum, GLint, POINTER(POINTER(GLvoid)), GLint], 'IBM_vertex_array_lists')
+
+# GL/glext.h:6515
+glNormalPointerListIBM = _link_function('glNormalPointerListIBM', None, [GLenum, GLint, POINTER(POINTER(GLvoid)), GLint], 'IBM_vertex_array_lists')
+
+# GL/glext.h:6516
+glTexCoordPointerListIBM = _link_function('glTexCoordPointerListIBM', None, [GLint, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint], 'IBM_vertex_array_lists')
+
+# GL/glext.h:6517
+glVertexPointerListIBM = _link_function('glVertexPointerListIBM', None, [GLint, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint], 'IBM_vertex_array_lists')
+
+PFNGLCOLORPOINTERLISTIBMPROC = CFUNCTYPE(None, GLint, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint) # GL/glext.h:6519
+PFNGLSECONDARYCOLORPOINTERLISTIBMPROC = CFUNCTYPE(None, GLint, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint) # GL/glext.h:6520
+PFNGLEDGEFLAGPOINTERLISTIBMPROC = CFUNCTYPE(None, GLint, POINTER(POINTER(GLboolean)), GLint) # GL/glext.h:6521
+PFNGLFOGCOORDPOINTERLISTIBMPROC = CFUNCTYPE(None, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint) # GL/glext.h:6522
+PFNGLINDEXPOINTERLISTIBMPROC = CFUNCTYPE(None, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint) # GL/glext.h:6523
+PFNGLNORMALPOINTERLISTIBMPROC = CFUNCTYPE(None, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint) # GL/glext.h:6524
+PFNGLTEXCOORDPOINTERLISTIBMPROC = CFUNCTYPE(None, GLint, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint) # GL/glext.h:6525
+PFNGLVERTEXPOINTERLISTIBMPROC = CFUNCTYPE(None, GLint, GLenum, GLint, POINTER(POINTER(GLvoid)), GLint) # GL/glext.h:6526
+# SGIX_subsample (GL/glext.h:6529)
+GL_SGIX_subsample = 1 # GL/glext.h:6530
+# SGIX_ycrcba (GL/glext.h:6533)
+GL_SGIX_ycrcba = 1 # GL/glext.h:6534
+# SGIX_ycrcb_subsample (GL/glext.h:6537)
+GL_SGIX_ycrcb_subsample = 1 # GL/glext.h:6538
+# SGIX_depth_pass_instrument (GL/glext.h:6541)
+GL_SGIX_depth_pass_instrument = 1 # GL/glext.h:6542
+# 3DFX_texture_compression_FXT1 (GL/glext.h:6545)
+GL_3DFX_texture_compression_FXT1 = 1 # GL/glext.h:6546
+# 3DFX_multisample (GL/glext.h:6549)
+GL_3DFX_multisample = 1 # GL/glext.h:6550
+# 3DFX_tbuffer (GL/glext.h:6553)
+GL_3DFX_tbuffer = 1 # GL/glext.h:6554
+# GL/glext.h:6556
+glTbufferMask3DFX = _link_function('glTbufferMask3DFX', None, [GLuint], '3DFX_tbuffer')
+
+PFNGLTBUFFERMASK3DFXPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6558
+# EXT_multisample (GL/glext.h:6561)
+GL_EXT_multisample = 1 # GL/glext.h:6562
+# GL/glext.h:6564
+glSampleMaskEXT = _link_function('glSampleMaskEXT', None, [GLclampf, GLboolean], 'EXT_multisample')
+
+# GL/glext.h:6565
+glSamplePatternEXT = _link_function('glSamplePatternEXT', None, [GLenum], 'EXT_multisample')
+
+PFNGLSAMPLEMASKEXTPROC = CFUNCTYPE(None, GLclampf, GLboolean) # GL/glext.h:6567
+PFNGLSAMPLEPATTERNEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:6568
+# SGIX_vertex_preclip (GL/glext.h:6571)
+GL_SGIX_vertex_preclip = 1 # GL/glext.h:6572
+# SGIX_convolution_accuracy (GL/glext.h:6575)
+GL_SGIX_convolution_accuracy = 1 # GL/glext.h:6576
+# SGIX_resample (GL/glext.h:6579)
+GL_SGIX_resample = 1 # GL/glext.h:6580
+# SGIS_point_line_texgen (GL/glext.h:6583)
+GL_SGIS_point_line_texgen = 1 # GL/glext.h:6584
+# SGIS_texture_color_mask (GL/glext.h:6587)
+GL_SGIS_texture_color_mask = 1 # GL/glext.h:6588
+# GL/glext.h:6590
+glTextureColorMaskSGIS = _link_function('glTextureColorMaskSGIS', None, [GLboolean, GLboolean, GLboolean, GLboolean], 'SGIS_texture_color_mask')
+
+PFNGLTEXTURECOLORMASKSGISPROC = CFUNCTYPE(None, GLboolean, GLboolean, GLboolean, GLboolean) # GL/glext.h:6592
+# SGIX_igloo_interface (GL/glext.h:6595)
+GL_SGIX_igloo_interface = 1 # GL/glext.h:6596
+# GL/glext.h:6598
+glIglooInterfaceSGIX = _link_function('glIglooInterfaceSGIX', None, [GLenum, POINTER(GLvoid)], 'SGIX_igloo_interface')
+
+PFNGLIGLOOINTERFACESGIXPROC = CFUNCTYPE(None, GLenum, POINTER(GLvoid)) # GL/glext.h:6600
+# EXT_texture_env_dot3 (GL/glext.h:6603)
+GL_EXT_texture_env_dot3 = 1 # GL/glext.h:6604
+# ATI_texture_mirror_once (GL/glext.h:6607)
+GL_ATI_texture_mirror_once = 1 # GL/glext.h:6608
+# NV_fence (GL/glext.h:6611)
+GL_NV_fence = 1 # GL/glext.h:6612
+# GL/glext.h:6614
+glDeleteFencesNV = _link_function('glDeleteFencesNV', None, [GLsizei, POINTER(GLuint)], 'NV_fence')
+
+# GL/glext.h:6615
+glGenFencesNV = _link_function('glGenFencesNV', None, [GLsizei, POINTER(GLuint)], 'NV_fence')
+
+# GL/glext.h:6616
+glIsFenceNV = _link_function('glIsFenceNV', GLboolean, [GLuint], 'NV_fence')
+
+# GL/glext.h:6617
+glTestFenceNV = _link_function('glTestFenceNV', GLboolean, [GLuint], 'NV_fence')
+
+# GL/glext.h:6618
+glGetFenceivNV = _link_function('glGetFenceivNV', None, [GLuint, GLenum, POINTER(GLint)], 'NV_fence')
+
+# GL/glext.h:6619
+glFinishFenceNV = _link_function('glFinishFenceNV', None, [GLuint], 'NV_fence')
+
+# GL/glext.h:6620
+glSetFenceNV = _link_function('glSetFenceNV', None, [GLuint, GLenum], 'NV_fence')
+
+PFNGLDELETEFENCESNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:6622
+PFNGLGENFENCESNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:6623
+PFNGLISFENCENVPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:6624
+PFNGLTESTFENCENVPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:6625
+PFNGLGETFENCEIVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:6626
+PFNGLFINISHFENCENVPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6627
+PFNGLSETFENCENVPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:6628
+# NV_evaluators (GL/glext.h:6631)
+GL_NV_evaluators = 1 # GL/glext.h:6632
+# GL/glext.h:6634
+glMapControlPointsNV = _link_function('glMapControlPointsNV', None, [GLenum, GLuint, GLenum, GLsizei, GLsizei, GLint, GLint, GLboolean, POINTER(GLvoid)], 'NV_evaluators')
+
+# GL/glext.h:6635
+glMapParameterivNV = _link_function('glMapParameterivNV', None, [GLenum, GLenum, POINTER(GLint)], 'NV_evaluators')
+
+# GL/glext.h:6636
+glMapParameterfvNV = _link_function('glMapParameterfvNV', None, [GLenum, GLenum, POINTER(GLfloat)], 'NV_evaluators')
+
+# GL/glext.h:6637
+glGetMapControlPointsNV = _link_function('glGetMapControlPointsNV', None, [GLenum, GLuint, GLenum, GLsizei, GLsizei, GLboolean, POINTER(GLvoid)], 'NV_evaluators')
+
+# GL/glext.h:6638
+glGetMapParameterivNV = _link_function('glGetMapParameterivNV', None, [GLenum, GLenum, POINTER(GLint)], 'NV_evaluators')
+
+# GL/glext.h:6639
+glGetMapParameterfvNV = _link_function('glGetMapParameterfvNV', None, [GLenum, GLenum, POINTER(GLfloat)], 'NV_evaluators')
+
+# GL/glext.h:6640
+glGetMapAttribParameterivNV = _link_function('glGetMapAttribParameterivNV', None, [GLenum, GLuint, GLenum, POINTER(GLint)], 'NV_evaluators')
+
+# GL/glext.h:6641
+glGetMapAttribParameterfvNV = _link_function('glGetMapAttribParameterfvNV', None, [GLenum, GLuint, GLenum, POINTER(GLfloat)], 'NV_evaluators')
+
+# GL/glext.h:6642
+glEvalMapsNV = _link_function('glEvalMapsNV', None, [GLenum, GLenum], 'NV_evaluators')
+
+PFNGLMAPCONTROLPOINTSNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLenum, GLsizei, GLsizei, GLint, GLint, GLboolean, POINTER(GLvoid)) # GL/glext.h:6644
+PFNGLMAPPARAMETERIVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:6645
+PFNGLMAPPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:6646
+PFNGLGETMAPCONTROLPOINTSNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLenum, GLsizei, GLsizei, GLboolean, POINTER(GLvoid)) # GL/glext.h:6647
+PFNGLGETMAPPARAMETERIVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:6648
+PFNGLGETMAPPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:6649
+PFNGLGETMAPATTRIBPARAMETERIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:6650
+PFNGLGETMAPATTRIBPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:6651
+PFNGLEVALMAPSNVPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:6652
+# NV_packed_depth_stencil (GL/glext.h:6655)
+GL_NV_packed_depth_stencil = 1 # GL/glext.h:6656
+# EXT_packed_depth_stencil (GL/glext.h:6659)
+GL_EXT_packed_depth_stencil = 1 # GL/glext.h:6660
+# NV_register_combiners2 (GL/glext.h:6663)
+GL_NV_register_combiners2 = 1 # GL/glext.h:6664
+# GL/glext.h:6666
+glCombinerStageParameterfvNV = _link_function('glCombinerStageParameterfvNV', None, [GLenum, GLenum, POINTER(GLfloat)], 'NV_register_combiners2')
+
+# GL/glext.h:6667
+glGetCombinerStageParameterfvNV = _link_function('glGetCombinerStageParameterfvNV', None, [GLenum, GLenum, POINTER(GLfloat)], 'NV_register_combiners2')
+
+PFNGLCOMBINERSTAGEPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:6669
+PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:6670
+# NV_texture_compression_vtc (GL/glext.h:6673)
+GL_NV_texture_compression_vtc = 1 # GL/glext.h:6674
+# NV_texture_rectangle (GL/glext.h:6677)
+GL_NV_texture_rectangle = 1 # GL/glext.h:6678
+# NV_texture_shader (GL/glext.h:6681)
+GL_NV_texture_shader = 1 # GL/glext.h:6682
+# NV_texture_shader2 (GL/glext.h:6685)
+GL_NV_texture_shader2 = 1 # GL/glext.h:6686
+# NV_vertex_array_range2 (GL/glext.h:6689)
+GL_NV_vertex_array_range2 = 1 # GL/glext.h:6690
+# NV_vertex_program (GL/glext.h:6693)
+GL_NV_vertex_program = 1 # GL/glext.h:6694
+# GL/glext.h:6696
+glAreProgramsResidentNV = _link_function('glAreProgramsResidentNV', GLboolean, [GLsizei, POINTER(GLuint), POINTER(GLboolean)], 'NV_vertex_program')
+
+# GL/glext.h:6697
+glBindProgramNV = _link_function('glBindProgramNV', None, [GLenum, GLuint], 'NV_vertex_program')
+
+# GL/glext.h:6698
+glDeleteProgramsNV = _link_function('glDeleteProgramsNV', None, [GLsizei, POINTER(GLuint)], 'NV_vertex_program')
+
+# GL/glext.h:6699
+glExecuteProgramNV = _link_function('glExecuteProgramNV', None, [GLenum, GLuint, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:6700
+glGenProgramsNV = _link_function('glGenProgramsNV', None, [GLsizei, POINTER(GLuint)], 'NV_vertex_program')
+
+# GL/glext.h:6701
+glGetProgramParameterdvNV = _link_function('glGetProgramParameterdvNV', None, [GLenum, GLuint, GLenum, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:6702
+glGetProgramParameterfvNV = _link_function('glGetProgramParameterfvNV', None, [GLenum, GLuint, GLenum, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:6703
+glGetProgramivNV = _link_function('glGetProgramivNV', None, [GLuint, GLenum, POINTER(GLint)], 'NV_vertex_program')
+
+# GL/glext.h:6704
+glGetProgramStringNV = _link_function('glGetProgramStringNV', None, [GLuint, GLenum, POINTER(GLubyte)], 'NV_vertex_program')
+
+# GL/glext.h:6705
+glGetTrackMatrixivNV = _link_function('glGetTrackMatrixivNV', None, [GLenum, GLuint, GLenum, POINTER(GLint)], 'NV_vertex_program')
+
+# GL/glext.h:6706
+glGetVertexAttribdvNV = _link_function('glGetVertexAttribdvNV', None, [GLuint, GLenum, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:6707
+glGetVertexAttribfvNV = _link_function('glGetVertexAttribfvNV', None, [GLuint, GLenum, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:6708
+glGetVertexAttribivNV = _link_function('glGetVertexAttribivNV', None, [GLuint, GLenum, POINTER(GLint)], 'NV_vertex_program')
+
+# GL/glext.h:6709
+glGetVertexAttribPointervNV = _link_function('glGetVertexAttribPointervNV', None, [GLuint, GLenum, POINTER(POINTER(GLvoid))], 'NV_vertex_program')
+
+# GL/glext.h:6710
+glIsProgramNV = _link_function('glIsProgramNV', GLboolean, [GLuint], 'NV_vertex_program')
+
+# GL/glext.h:6711
+glLoadProgramNV = _link_function('glLoadProgramNV', None, [GLenum, GLuint, GLsizei, POINTER(GLubyte)], 'NV_vertex_program')
+
+# GL/glext.h:6712
+glProgramParameter4dNV = _link_function('glProgramParameter4dNV', None, [GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble], 'NV_vertex_program')
+
+# GL/glext.h:6713
+glProgramParameter4dvNV = _link_function('glProgramParameter4dvNV', None, [GLenum, GLuint, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:6714
+glProgramParameter4fNV = _link_function('glProgramParameter4fNV', None, [GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat], 'NV_vertex_program')
+
+# GL/glext.h:6715
+glProgramParameter4fvNV = _link_function('glProgramParameter4fvNV', None, [GLenum, GLuint, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:6716
+glProgramParameters4dvNV = _link_function('glProgramParameters4dvNV', None, [GLenum, GLuint, GLuint, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:6717
+glProgramParameters4fvNV = _link_function('glProgramParameters4fvNV', None, [GLenum, GLuint, GLuint, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:6718
+glRequestResidentProgramsNV = _link_function('glRequestResidentProgramsNV', None, [GLsizei, POINTER(GLuint)], 'NV_vertex_program')
+
+# GL/glext.h:6719
+glTrackMatrixNV = _link_function('glTrackMatrixNV', None, [GLenum, GLuint, GLenum, GLenum], 'NV_vertex_program')
+
+# GL/glext.h:6720
+glVertexAttribPointerNV = _link_function('glVertexAttribPointerNV', None, [GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)], 'NV_vertex_program')
+
+# GL/glext.h:6721
+glVertexAttrib1dNV = _link_function('glVertexAttrib1dNV', None, [GLuint, GLdouble], 'NV_vertex_program')
+
+# GL/glext.h:6722
+glVertexAttrib1dvNV = _link_function('glVertexAttrib1dvNV', None, [GLuint, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:6723
+glVertexAttrib1fNV = _link_function('glVertexAttrib1fNV', None, [GLuint, GLfloat], 'NV_vertex_program')
+
+# GL/glext.h:6724
+glVertexAttrib1fvNV = _link_function('glVertexAttrib1fvNV', None, [GLuint, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:6725
+glVertexAttrib1sNV = _link_function('glVertexAttrib1sNV', None, [GLuint, GLshort], 'NV_vertex_program')
+
+# GL/glext.h:6726
+glVertexAttrib1svNV = _link_function('glVertexAttrib1svNV', None, [GLuint, POINTER(GLshort)], 'NV_vertex_program')
+
+# GL/glext.h:6727
+glVertexAttrib2dNV = _link_function('glVertexAttrib2dNV', None, [GLuint, GLdouble, GLdouble], 'NV_vertex_program')
+
+# GL/glext.h:6728
+glVertexAttrib2dvNV = _link_function('glVertexAttrib2dvNV', None, [GLuint, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:6729
+glVertexAttrib2fNV = _link_function('glVertexAttrib2fNV', None, [GLuint, GLfloat, GLfloat], 'NV_vertex_program')
+
+# GL/glext.h:6730
+glVertexAttrib2fvNV = _link_function('glVertexAttrib2fvNV', None, [GLuint, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:6731
+glVertexAttrib2sNV = _link_function('glVertexAttrib2sNV', None, [GLuint, GLshort, GLshort], 'NV_vertex_program')
+
+# GL/glext.h:6732
+glVertexAttrib2svNV = _link_function('glVertexAttrib2svNV', None, [GLuint, POINTER(GLshort)], 'NV_vertex_program')
+
+# GL/glext.h:6733
+glVertexAttrib3dNV = _link_function('glVertexAttrib3dNV', None, [GLuint, GLdouble, GLdouble, GLdouble], 'NV_vertex_program')
+
+# GL/glext.h:6734
+glVertexAttrib3dvNV = _link_function('glVertexAttrib3dvNV', None, [GLuint, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:6735
+glVertexAttrib3fNV = _link_function('glVertexAttrib3fNV', None, [GLuint, GLfloat, GLfloat, GLfloat], 'NV_vertex_program')
+
+# GL/glext.h:6736
+glVertexAttrib3fvNV = _link_function('glVertexAttrib3fvNV', None, [GLuint, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:6737
+glVertexAttrib3sNV = _link_function('glVertexAttrib3sNV', None, [GLuint, GLshort, GLshort, GLshort], 'NV_vertex_program')
+
+# GL/glext.h:6738
+glVertexAttrib3svNV = _link_function('glVertexAttrib3svNV', None, [GLuint, POINTER(GLshort)], 'NV_vertex_program')
+
+# GL/glext.h:6739
+glVertexAttrib4dNV = _link_function('glVertexAttrib4dNV', None, [GLuint, GLdouble, GLdouble, GLdouble, GLdouble], 'NV_vertex_program')
+
+# GL/glext.h:6740
+glVertexAttrib4dvNV = _link_function('glVertexAttrib4dvNV', None, [GLuint, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:6741
+glVertexAttrib4fNV = _link_function('glVertexAttrib4fNV', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat], 'NV_vertex_program')
+
+# GL/glext.h:6742
+glVertexAttrib4fvNV = _link_function('glVertexAttrib4fvNV', None, [GLuint, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:6743
+glVertexAttrib4sNV = _link_function('glVertexAttrib4sNV', None, [GLuint, GLshort, GLshort, GLshort, GLshort], 'NV_vertex_program')
+
+# GL/glext.h:6744
+glVertexAttrib4svNV = _link_function('glVertexAttrib4svNV', None, [GLuint, POINTER(GLshort)], 'NV_vertex_program')
+
+# GL/glext.h:6745
+glVertexAttrib4ubNV = _link_function('glVertexAttrib4ubNV', None, [GLuint, GLubyte, GLubyte, GLubyte, GLubyte], 'NV_vertex_program')
+
+# GL/glext.h:6746
+glVertexAttrib4ubvNV = _link_function('glVertexAttrib4ubvNV', None, [GLuint, POINTER(GLubyte)], 'NV_vertex_program')
+
+# GL/glext.h:6747
+glVertexAttribs1dvNV = _link_function('glVertexAttribs1dvNV', None, [GLuint, GLsizei, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:6748
+glVertexAttribs1fvNV = _link_function('glVertexAttribs1fvNV', None, [GLuint, GLsizei, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:6749
+glVertexAttribs1svNV = _link_function('glVertexAttribs1svNV', None, [GLuint, GLsizei, POINTER(GLshort)], 'NV_vertex_program')
+
+# GL/glext.h:6750
+glVertexAttribs2dvNV = _link_function('glVertexAttribs2dvNV', None, [GLuint, GLsizei, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:6751
+glVertexAttribs2fvNV = _link_function('glVertexAttribs2fvNV', None, [GLuint, GLsizei, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:6752
+glVertexAttribs2svNV = _link_function('glVertexAttribs2svNV', None, [GLuint, GLsizei, POINTER(GLshort)], 'NV_vertex_program')
+
+# GL/glext.h:6753
+glVertexAttribs3dvNV = _link_function('glVertexAttribs3dvNV', None, [GLuint, GLsizei, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:6754
+glVertexAttribs3fvNV = _link_function('glVertexAttribs3fvNV', None, [GLuint, GLsizei, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:6755
+glVertexAttribs3svNV = _link_function('glVertexAttribs3svNV', None, [GLuint, GLsizei, POINTER(GLshort)], 'NV_vertex_program')
+
+# GL/glext.h:6756
+glVertexAttribs4dvNV = _link_function('glVertexAttribs4dvNV', None, [GLuint, GLsizei, POINTER(GLdouble)], 'NV_vertex_program')
+
+# GL/glext.h:6757
+glVertexAttribs4fvNV = _link_function('glVertexAttribs4fvNV', None, [GLuint, GLsizei, POINTER(GLfloat)], 'NV_vertex_program')
+
+# GL/glext.h:6758
+glVertexAttribs4svNV = _link_function('glVertexAttribs4svNV', None, [GLuint, GLsizei, POINTER(GLshort)], 'NV_vertex_program')
+
+# GL/glext.h:6759
+glVertexAttribs4ubvNV = _link_function('glVertexAttribs4ubvNV', None, [GLuint, GLsizei, POINTER(GLubyte)], 'NV_vertex_program')
+
+PFNGLAREPROGRAMSRESIDENTNVPROC = CFUNCTYPE(GLboolean, GLsizei, POINTER(GLuint), POINTER(GLboolean)) # GL/glext.h:6761
+PFNGLBINDPROGRAMNVPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:6762
+PFNGLDELETEPROGRAMSNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:6763
+PFNGLEXECUTEPROGRAMNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:6764
+PFNGLGENPROGRAMSNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:6765
+PFNGLGETPROGRAMPARAMETERDVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLenum, POINTER(GLdouble)) # GL/glext.h:6766
+PFNGLGETPROGRAMPARAMETERFVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:6767
+PFNGLGETPROGRAMIVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:6768
+PFNGLGETPROGRAMSTRINGNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLubyte)) # GL/glext.h:6769
+PFNGLGETTRACKMATRIXIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:6770
+PFNGLGETVERTEXATTRIBDVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLdouble)) # GL/glext.h:6771
+PFNGLGETVERTEXATTRIBFVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:6772
+PFNGLGETVERTEXATTRIBIVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:6773
+PFNGLGETVERTEXATTRIBPOINTERVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:6774
+PFNGLISPROGRAMNVPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:6775
+PFNGLLOADPROGRAMNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLsizei, POINTER(GLubyte)) # GL/glext.h:6776
+PFNGLPROGRAMPARAMETER4DNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:6777
+PFNGLPROGRAMPARAMETER4DVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLdouble)) # GL/glext.h:6778
+PFNGLPROGRAMPARAMETER4FNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6779
+PFNGLPROGRAMPARAMETER4FVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:6780
+PFNGLPROGRAMPARAMETERS4DVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, POINTER(GLdouble)) # GL/glext.h:6781
+PFNGLPROGRAMPARAMETERS4FVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, POINTER(GLfloat)) # GL/glext.h:6782
+PFNGLREQUESTRESIDENTPROGRAMSNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:6783
+PFNGLTRACKMATRIXNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLenum, GLenum) # GL/glext.h:6784
+PFNGLVERTEXATTRIBPOINTERNVPROC = CFUNCTYPE(None, GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:6785
+PFNGLVERTEXATTRIB1DNVPROC = CFUNCTYPE(None, GLuint, GLdouble) # GL/glext.h:6786
+PFNGLVERTEXATTRIB1DVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:6787
+PFNGLVERTEXATTRIB1FNVPROC = CFUNCTYPE(None, GLuint, GLfloat) # GL/glext.h:6788
+PFNGLVERTEXATTRIB1FVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:6789
+PFNGLVERTEXATTRIB1SNVPROC = CFUNCTYPE(None, GLuint, GLshort) # GL/glext.h:6790
+PFNGLVERTEXATTRIB1SVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:6791
+PFNGLVERTEXATTRIB2DNVPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble) # GL/glext.h:6792
+PFNGLVERTEXATTRIB2DVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:6793
+PFNGLVERTEXATTRIB2FNVPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat) # GL/glext.h:6794
+PFNGLVERTEXATTRIB2FVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:6795
+PFNGLVERTEXATTRIB2SNVPROC = CFUNCTYPE(None, GLuint, GLshort, GLshort) # GL/glext.h:6796
+PFNGLVERTEXATTRIB2SVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:6797
+PFNGLVERTEXATTRIB3DNVPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble, GLdouble) # GL/glext.h:6798
+PFNGLVERTEXATTRIB3DVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:6799
+PFNGLVERTEXATTRIB3FNVPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat) # GL/glext.h:6800
+PFNGLVERTEXATTRIB3FVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:6801
+PFNGLVERTEXATTRIB3SNVPROC = CFUNCTYPE(None, GLuint, GLshort, GLshort, GLshort) # GL/glext.h:6802
+PFNGLVERTEXATTRIB3SVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:6803
+PFNGLVERTEXATTRIB4DNVPROC = CFUNCTYPE(None, GLuint, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:6804
+PFNGLVERTEXATTRIB4DVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:6805
+PFNGLVERTEXATTRIB4FNVPROC = CFUNCTYPE(None, GLuint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:6806
+PFNGLVERTEXATTRIB4FVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:6807
+PFNGLVERTEXATTRIB4SNVPROC = CFUNCTYPE(None, GLuint, GLshort, GLshort, GLshort, GLshort) # GL/glext.h:6808
+PFNGLVERTEXATTRIB4SVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:6809
+PFNGLVERTEXATTRIB4UBNVPROC = CFUNCTYPE(None, GLuint, GLubyte, GLubyte, GLubyte, GLubyte) # GL/glext.h:6810
+PFNGLVERTEXATTRIB4UBVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLubyte)) # GL/glext.h:6811
+PFNGLVERTEXATTRIBS1DVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLdouble)) # GL/glext.h:6812
+PFNGLVERTEXATTRIBS1FVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLfloat)) # GL/glext.h:6813
+PFNGLVERTEXATTRIBS1SVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLshort)) # GL/glext.h:6814
+PFNGLVERTEXATTRIBS2DVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLdouble)) # GL/glext.h:6815
+PFNGLVERTEXATTRIBS2FVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLfloat)) # GL/glext.h:6816
+PFNGLVERTEXATTRIBS2SVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLshort)) # GL/glext.h:6817
+PFNGLVERTEXATTRIBS3DVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLdouble)) # GL/glext.h:6818
+PFNGLVERTEXATTRIBS3FVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLfloat)) # GL/glext.h:6819
+PFNGLVERTEXATTRIBS3SVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLshort)) # GL/glext.h:6820
+PFNGLVERTEXATTRIBS4DVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLdouble)) # GL/glext.h:6821
+PFNGLVERTEXATTRIBS4FVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLfloat)) # GL/glext.h:6822
+PFNGLVERTEXATTRIBS4SVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLshort)) # GL/glext.h:6823
+PFNGLVERTEXATTRIBS4UBVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLubyte)) # GL/glext.h:6824
+# SGIX_texture_coordinate_clamp (GL/glext.h:6827)
+GL_SGIX_texture_coordinate_clamp = 1 # GL/glext.h:6828
+# SGIX_scalebias_hint (GL/glext.h:6831)
+GL_SGIX_scalebias_hint = 1 # GL/glext.h:6832
+# OML_interlace (GL/glext.h:6835)
+GL_OML_interlace = 1 # GL/glext.h:6836
+# OML_subsample (GL/glext.h:6839)
+GL_OML_subsample = 1 # GL/glext.h:6840
+# OML_resample (GL/glext.h:6843)
+GL_OML_resample = 1 # GL/glext.h:6844
+# NV_copy_depth_to_color (GL/glext.h:6847)
+GL_NV_copy_depth_to_color = 1 # GL/glext.h:6848
+# ATI_envmap_bumpmap (GL/glext.h:6851)
+GL_ATI_envmap_bumpmap = 1 # GL/glext.h:6852
+# GL/glext.h:6854
+glTexBumpParameterivATI = _link_function('glTexBumpParameterivATI', None, [GLenum, POINTER(GLint)], 'ATI_envmap_bumpmap')
+
+# GL/glext.h:6855
+glTexBumpParameterfvATI = _link_function('glTexBumpParameterfvATI', None, [GLenum, POINTER(GLfloat)], 'ATI_envmap_bumpmap')
+
+# GL/glext.h:6856
+glGetTexBumpParameterivATI = _link_function('glGetTexBumpParameterivATI', None, [GLenum, POINTER(GLint)], 'ATI_envmap_bumpmap')
+
+# GL/glext.h:6857
+glGetTexBumpParameterfvATI = _link_function('glGetTexBumpParameterfvATI', None, [GLenum, POINTER(GLfloat)], 'ATI_envmap_bumpmap')
+
+PFNGLTEXBUMPPARAMETERIVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:6859
+PFNGLTEXBUMPPARAMETERFVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:6860
+PFNGLGETTEXBUMPPARAMETERIVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:6861
+PFNGLGETTEXBUMPPARAMETERFVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:6862
+# ATI_fragment_shader (GL/glext.h:6865)
+GL_ATI_fragment_shader = 1 # GL/glext.h:6866
+# GL/glext.h:6868
+glGenFragmentShadersATI = _link_function('glGenFragmentShadersATI', GLuint, [GLuint], 'ATI_fragment_shader')
+
+# GL/glext.h:6869
+glBindFragmentShaderATI = _link_function('glBindFragmentShaderATI', None, [GLuint], 'ATI_fragment_shader')
+
+# GL/glext.h:6870
+glDeleteFragmentShaderATI = _link_function('glDeleteFragmentShaderATI', None, [GLuint], 'ATI_fragment_shader')
+
+# GL/glext.h:6871
+glBeginFragmentShaderATI = _link_function('glBeginFragmentShaderATI', None, [], 'ATI_fragment_shader')
+
+# GL/glext.h:6872
+glEndFragmentShaderATI = _link_function('glEndFragmentShaderATI', None, [], 'ATI_fragment_shader')
+
+# GL/glext.h:6873
+glPassTexCoordATI = _link_function('glPassTexCoordATI', None, [GLuint, GLuint, GLenum], 'ATI_fragment_shader')
+
+# GL/glext.h:6874
+glSampleMapATI = _link_function('glSampleMapATI', None, [GLuint, GLuint, GLenum], 'ATI_fragment_shader')
+
+# GL/glext.h:6875
+glColorFragmentOp1ATI = _link_function('glColorFragmentOp1ATI', None, [GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint], 'ATI_fragment_shader')
+
+# GL/glext.h:6876
+glColorFragmentOp2ATI = _link_function('glColorFragmentOp2ATI', None, [GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint], 'ATI_fragment_shader')
+
+# GL/glext.h:6877
+glColorFragmentOp3ATI = _link_function('glColorFragmentOp3ATI', None, [GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint], 'ATI_fragment_shader')
+
+# GL/glext.h:6878
+glAlphaFragmentOp1ATI = _link_function('glAlphaFragmentOp1ATI', None, [GLenum, GLuint, GLuint, GLuint, GLuint, GLuint], 'ATI_fragment_shader')
+
+# GL/glext.h:6879
+glAlphaFragmentOp2ATI = _link_function('glAlphaFragmentOp2ATI', None, [GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint], 'ATI_fragment_shader')
+
+# GL/glext.h:6880
+glAlphaFragmentOp3ATI = _link_function('glAlphaFragmentOp3ATI', None, [GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint], 'ATI_fragment_shader')
+
+# GL/glext.h:6881
+glSetFragmentShaderConstantATI = _link_function('glSetFragmentShaderConstantATI', None, [GLuint, POINTER(GLfloat)], 'ATI_fragment_shader')
+
+PFNGLGENFRAGMENTSHADERSATIPROC = CFUNCTYPE(GLuint, GLuint) # GL/glext.h:6883
+PFNGLBINDFRAGMENTSHADERATIPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6884
+PFNGLDELETEFRAGMENTSHADERATIPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6885
+PFNGLBEGINFRAGMENTSHADERATIPROC = CFUNCTYPE(None) # GL/glext.h:6886
+PFNGLENDFRAGMENTSHADERATIPROC = CFUNCTYPE(None) # GL/glext.h:6887
+PFNGLPASSTEXCOORDATIPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum) # GL/glext.h:6888
+PFNGLSAMPLEMAPATIPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum) # GL/glext.h:6889
+PFNGLCOLORFRAGMENTOP1ATIPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:6890
+PFNGLCOLORFRAGMENTOP2ATIPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:6891
+PFNGLCOLORFRAGMENTOP3ATIPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:6892
+PFNGLALPHAFRAGMENTOP1ATIPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:6893
+PFNGLALPHAFRAGMENTOP2ATIPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:6894
+PFNGLALPHAFRAGMENTOP3ATIPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:6895
+PFNGLSETFRAGMENTSHADERCONSTANTATIPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:6896
+# ATI_pn_triangles (GL/glext.h:6899)
+GL_ATI_pn_triangles = 1 # GL/glext.h:6900
+# GL/glext.h:6902
+glPNTrianglesiATI = _link_function('glPNTrianglesiATI', None, [GLenum, GLint], 'ATI_pn_triangles')
+
+# GL/glext.h:6903
+glPNTrianglesfATI = _link_function('glPNTrianglesfATI', None, [GLenum, GLfloat], 'ATI_pn_triangles')
+
+PFNGLPNTRIANGLESIATIPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:6905
+PFNGLPNTRIANGLESFATIPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:6906
+# ATI_vertex_array_object (GL/glext.h:6909)
+GL_ATI_vertex_array_object = 1 # GL/glext.h:6910
+# GL/glext.h:6912
+glNewObjectBufferATI = _link_function('glNewObjectBufferATI', GLuint, [GLsizei, POINTER(GLvoid), GLenum], 'ATI_vertex_array_object')
+
+# GL/glext.h:6913
+glIsObjectBufferATI = _link_function('glIsObjectBufferATI', GLboolean, [GLuint], 'ATI_vertex_array_object')
+
+# GL/glext.h:6914
+glUpdateObjectBufferATI = _link_function('glUpdateObjectBufferATI', None, [GLuint, GLuint, GLsizei, POINTER(GLvoid), GLenum], 'ATI_vertex_array_object')
+
+# GL/glext.h:6915
+glGetObjectBufferfvATI = _link_function('glGetObjectBufferfvATI', None, [GLuint, GLenum, POINTER(GLfloat)], 'ATI_vertex_array_object')
+
+# GL/glext.h:6916
+glGetObjectBufferivATI = _link_function('glGetObjectBufferivATI', None, [GLuint, GLenum, POINTER(GLint)], 'ATI_vertex_array_object')
+
+# GL/glext.h:6917
+glFreeObjectBufferATI = _link_function('glFreeObjectBufferATI', None, [GLuint], 'ATI_vertex_array_object')
+
+# GL/glext.h:6918
+glArrayObjectATI = _link_function('glArrayObjectATI', None, [GLenum, GLint, GLenum, GLsizei, GLuint, GLuint], 'ATI_vertex_array_object')
+
+# GL/glext.h:6919
+glGetArrayObjectfvATI = _link_function('glGetArrayObjectfvATI', None, [GLenum, GLenum, POINTER(GLfloat)], 'ATI_vertex_array_object')
+
+# GL/glext.h:6920
+glGetArrayObjectivATI = _link_function('glGetArrayObjectivATI', None, [GLenum, GLenum, POINTER(GLint)], 'ATI_vertex_array_object')
+
+# GL/glext.h:6921
+glVariantArrayObjectATI = _link_function('glVariantArrayObjectATI', None, [GLuint, GLenum, GLsizei, GLuint, GLuint], 'ATI_vertex_array_object')
+
+# GL/glext.h:6922
+glGetVariantArrayObjectfvATI = _link_function('glGetVariantArrayObjectfvATI', None, [GLuint, GLenum, POINTER(GLfloat)], 'ATI_vertex_array_object')
+
+# GL/glext.h:6923
+glGetVariantArrayObjectivATI = _link_function('glGetVariantArrayObjectivATI', None, [GLuint, GLenum, POINTER(GLint)], 'ATI_vertex_array_object')
+
+PFNGLNEWOBJECTBUFFERATIPROC = CFUNCTYPE(GLuint, GLsizei, POINTER(GLvoid), GLenum) # GL/glext.h:6925
+PFNGLISOBJECTBUFFERATIPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:6926
+PFNGLUPDATEOBJECTBUFFERATIPROC = CFUNCTYPE(None, GLuint, GLuint, GLsizei, POINTER(GLvoid), GLenum) # GL/glext.h:6927
+PFNGLGETOBJECTBUFFERFVATIPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:6928
+PFNGLGETOBJECTBUFFERIVATIPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:6929
+PFNGLFREEOBJECTBUFFERATIPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6930
+PFNGLARRAYOBJECTATIPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLsizei, GLuint, GLuint) # GL/glext.h:6931
+PFNGLGETARRAYOBJECTFVATIPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:6932
+PFNGLGETARRAYOBJECTIVATIPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:6933
+PFNGLVARIANTARRAYOBJECTATIPROC = CFUNCTYPE(None, GLuint, GLenum, GLsizei, GLuint, GLuint) # GL/glext.h:6934
+PFNGLGETVARIANTARRAYOBJECTFVATIPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:6935
+PFNGLGETVARIANTARRAYOBJECTIVATIPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:6936
+# EXT_vertex_shader (GL/glext.h:6939)
+GL_EXT_vertex_shader = 1 # GL/glext.h:6940
+# GL/glext.h:6942
+glBeginVertexShaderEXT = _link_function('glBeginVertexShaderEXT', None, [], 'EXT_vertex_shader')
+
+# GL/glext.h:6943
+glEndVertexShaderEXT = _link_function('glEndVertexShaderEXT', None, [], 'EXT_vertex_shader')
+
+# GL/glext.h:6944
+glBindVertexShaderEXT = _link_function('glBindVertexShaderEXT', None, [GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:6945
+glGenVertexShadersEXT = _link_function('glGenVertexShadersEXT', GLuint, [GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:6946
+glDeleteVertexShaderEXT = _link_function('glDeleteVertexShaderEXT', None, [GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:6947
+glShaderOp1EXT = _link_function('glShaderOp1EXT', None, [GLenum, GLuint, GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:6948
+glShaderOp2EXT = _link_function('glShaderOp2EXT', None, [GLenum, GLuint, GLuint, GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:6949
+glShaderOp3EXT = _link_function('glShaderOp3EXT', None, [GLenum, GLuint, GLuint, GLuint, GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:6950
+glSwizzleEXT = _link_function('glSwizzleEXT', None, [GLuint, GLuint, GLenum, GLenum, GLenum, GLenum], 'EXT_vertex_shader')
+
+# GL/glext.h:6951
+glWriteMaskEXT = _link_function('glWriteMaskEXT', None, [GLuint, GLuint, GLenum, GLenum, GLenum, GLenum], 'EXT_vertex_shader')
+
+# GL/glext.h:6952
+glInsertComponentEXT = _link_function('glInsertComponentEXT', None, [GLuint, GLuint, GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:6953
+glExtractComponentEXT = _link_function('glExtractComponentEXT', None, [GLuint, GLuint, GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:6954
+glGenSymbolsEXT = _link_function('glGenSymbolsEXT', GLuint, [GLenum, GLenum, GLenum, GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:6955
+glSetInvariantEXT = _link_function('glSetInvariantEXT', None, [GLuint, GLenum, POINTER(GLvoid)], 'EXT_vertex_shader')
+
+# GL/glext.h:6956
+glSetLocalConstantEXT = _link_function('glSetLocalConstantEXT', None, [GLuint, GLenum, POINTER(GLvoid)], 'EXT_vertex_shader')
+
+# GL/glext.h:6957
+glVariantbvEXT = _link_function('glVariantbvEXT', None, [GLuint, POINTER(GLbyte)], 'EXT_vertex_shader')
+
+# GL/glext.h:6958
+glVariantsvEXT = _link_function('glVariantsvEXT', None, [GLuint, POINTER(GLshort)], 'EXT_vertex_shader')
+
+# GL/glext.h:6959
+glVariantivEXT = _link_function('glVariantivEXT', None, [GLuint, POINTER(GLint)], 'EXT_vertex_shader')
+
+# GL/glext.h:6960
+glVariantfvEXT = _link_function('glVariantfvEXT', None, [GLuint, POINTER(GLfloat)], 'EXT_vertex_shader')
+
+# GL/glext.h:6961
+glVariantdvEXT = _link_function('glVariantdvEXT', None, [GLuint, POINTER(GLdouble)], 'EXT_vertex_shader')
+
+# GL/glext.h:6962
+glVariantubvEXT = _link_function('glVariantubvEXT', None, [GLuint, POINTER(GLubyte)], 'EXT_vertex_shader')
+
+# GL/glext.h:6963
+glVariantusvEXT = _link_function('glVariantusvEXT', None, [GLuint, POINTER(GLushort)], 'EXT_vertex_shader')
+
+# GL/glext.h:6964
+glVariantuivEXT = _link_function('glVariantuivEXT', None, [GLuint, POINTER(GLuint)], 'EXT_vertex_shader')
+
+# GL/glext.h:6965
+glVariantPointerEXT = _link_function('glVariantPointerEXT', None, [GLuint, GLenum, GLuint, POINTER(GLvoid)], 'EXT_vertex_shader')
+
+# GL/glext.h:6966
+glEnableVariantClientStateEXT = _link_function('glEnableVariantClientStateEXT', None, [GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:6967
+glDisableVariantClientStateEXT = _link_function('glDisableVariantClientStateEXT', None, [GLuint], 'EXT_vertex_shader')
+
+# GL/glext.h:6968
+glBindLightParameterEXT = _link_function('glBindLightParameterEXT', GLuint, [GLenum, GLenum], 'EXT_vertex_shader')
+
+# GL/glext.h:6969
+glBindMaterialParameterEXT = _link_function('glBindMaterialParameterEXT', GLuint, [GLenum, GLenum], 'EXT_vertex_shader')
+
+# GL/glext.h:6970
+glBindTexGenParameterEXT = _link_function('glBindTexGenParameterEXT', GLuint, [GLenum, GLenum, GLenum], 'EXT_vertex_shader')
+
+# GL/glext.h:6971
+glBindTextureUnitParameterEXT = _link_function('glBindTextureUnitParameterEXT', GLuint, [GLenum, GLenum], 'EXT_vertex_shader')
+
+# GL/glext.h:6972
+glBindParameterEXT = _link_function('glBindParameterEXT', GLuint, [GLenum], 'EXT_vertex_shader')
+
+# GL/glext.h:6973
+glIsVariantEnabledEXT = _link_function('glIsVariantEnabledEXT', GLboolean, [GLuint, GLenum], 'EXT_vertex_shader')
+
+# GL/glext.h:6974
+glGetVariantBooleanvEXT = _link_function('glGetVariantBooleanvEXT', None, [GLuint, GLenum, POINTER(GLboolean)], 'EXT_vertex_shader')
+
+# GL/glext.h:6975
+glGetVariantIntegervEXT = _link_function('glGetVariantIntegervEXT', None, [GLuint, GLenum, POINTER(GLint)], 'EXT_vertex_shader')
+
+# GL/glext.h:6976
+glGetVariantFloatvEXT = _link_function('glGetVariantFloatvEXT', None, [GLuint, GLenum, POINTER(GLfloat)], 'EXT_vertex_shader')
+
+# GL/glext.h:6977
+glGetVariantPointervEXT = _link_function('glGetVariantPointervEXT', None, [GLuint, GLenum, POINTER(POINTER(GLvoid))], 'EXT_vertex_shader')
+
+# GL/glext.h:6978
+glGetInvariantBooleanvEXT = _link_function('glGetInvariantBooleanvEXT', None, [GLuint, GLenum, POINTER(GLboolean)], 'EXT_vertex_shader')
+
+# GL/glext.h:6979
+glGetInvariantIntegervEXT = _link_function('glGetInvariantIntegervEXT', None, [GLuint, GLenum, POINTER(GLint)], 'EXT_vertex_shader')
+
+# GL/glext.h:6980
+glGetInvariantFloatvEXT = _link_function('glGetInvariantFloatvEXT', None, [GLuint, GLenum, POINTER(GLfloat)], 'EXT_vertex_shader')
+
+# GL/glext.h:6981
+glGetLocalConstantBooleanvEXT = _link_function('glGetLocalConstantBooleanvEXT', None, [GLuint, GLenum, POINTER(GLboolean)], 'EXT_vertex_shader')
+
+# GL/glext.h:6982
+glGetLocalConstantIntegervEXT = _link_function('glGetLocalConstantIntegervEXT', None, [GLuint, GLenum, POINTER(GLint)], 'EXT_vertex_shader')
+
+# GL/glext.h:6983
+glGetLocalConstantFloatvEXT = _link_function('glGetLocalConstantFloatvEXT', None, [GLuint, GLenum, POINTER(GLfloat)], 'EXT_vertex_shader')
+
+PFNGLBEGINVERTEXSHADEREXTPROC = CFUNCTYPE(None) # GL/glext.h:6985
+PFNGLENDVERTEXSHADEREXTPROC = CFUNCTYPE(None) # GL/glext.h:6986
+PFNGLBINDVERTEXSHADEREXTPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6987
+PFNGLGENVERTEXSHADERSEXTPROC = CFUNCTYPE(GLuint, GLuint) # GL/glext.h:6988
+PFNGLDELETEVERTEXSHADEREXTPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:6989
+PFNGLSHADEROP1EXTPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint) # GL/glext.h:6990
+PFNGLSHADEROP2EXTPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint) # GL/glext.h:6991
+PFNGLSHADEROP3EXTPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:6992
+PFNGLSWIZZLEEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:6993
+PFNGLWRITEMASKEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:6994
+PFNGLINSERTCOMPONENTEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint) # GL/glext.h:6995
+PFNGLEXTRACTCOMPONENTEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint) # GL/glext.h:6996
+PFNGLGENSYMBOLSEXTPROC = CFUNCTYPE(GLuint, GLenum, GLenum, GLenum, GLuint) # GL/glext.h:6997
+PFNGLSETINVARIANTEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLvoid)) # GL/glext.h:6998
+PFNGLSETLOCALCONSTANTEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLvoid)) # GL/glext.h:6999
+PFNGLVARIANTBVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLbyte)) # GL/glext.h:7000
+PFNGLVARIANTSVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:7001
+PFNGLVARIANTIVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:7002
+PFNGLVARIANTFVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLfloat)) # GL/glext.h:7003
+PFNGLVARIANTDVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLdouble)) # GL/glext.h:7004
+PFNGLVARIANTUBVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLubyte)) # GL/glext.h:7005
+PFNGLVARIANTUSVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLushort)) # GL/glext.h:7006
+PFNGLVARIANTUIVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:7007
+PFNGLVARIANTPOINTEREXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, POINTER(GLvoid)) # GL/glext.h:7008
+PFNGLENABLEVARIANTCLIENTSTATEEXTPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:7009
+PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:7010
+PFNGLBINDLIGHTPARAMETEREXTPROC = CFUNCTYPE(GLuint, GLenum, GLenum) # GL/glext.h:7011
+PFNGLBINDMATERIALPARAMETEREXTPROC = CFUNCTYPE(GLuint, GLenum, GLenum) # GL/glext.h:7012
+PFNGLBINDTEXGENPARAMETEREXTPROC = CFUNCTYPE(GLuint, GLenum, GLenum, GLenum) # GL/glext.h:7013
+PFNGLBINDTEXTUREUNITPARAMETEREXTPROC = CFUNCTYPE(GLuint, GLenum, GLenum) # GL/glext.h:7014
+PFNGLBINDPARAMETEREXTPROC = CFUNCTYPE(GLuint, GLenum) # GL/glext.h:7015
+PFNGLISVARIANTENABLEDEXTPROC = CFUNCTYPE(GLboolean, GLuint, GLenum) # GL/glext.h:7016
+PFNGLGETVARIANTBOOLEANVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLboolean)) # GL/glext.h:7017
+PFNGLGETVARIANTINTEGERVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:7018
+PFNGLGETVARIANTFLOATVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:7019
+PFNGLGETVARIANTPOINTERVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:7020
+PFNGLGETINVARIANTBOOLEANVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLboolean)) # GL/glext.h:7021
+PFNGLGETINVARIANTINTEGERVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:7022
+PFNGLGETINVARIANTFLOATVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:7023
+PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLboolean)) # GL/glext.h:7024
+PFNGLGETLOCALCONSTANTINTEGERVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:7025
+PFNGLGETLOCALCONSTANTFLOATVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:7026
+# ATI_vertex_streams (GL/glext.h:7029)
+GL_ATI_vertex_streams = 1 # GL/glext.h:7030
+# GL/glext.h:7032
+glVertexStream1sATI = _link_function('glVertexStream1sATI', None, [GLenum, GLshort], 'ATI_vertex_streams')
+
+# GL/glext.h:7033
+glVertexStream1svATI = _link_function('glVertexStream1svATI', None, [GLenum, POINTER(GLshort)], 'ATI_vertex_streams')
+
+# GL/glext.h:7034
+glVertexStream1iATI = _link_function('glVertexStream1iATI', None, [GLenum, GLint], 'ATI_vertex_streams')
+
+# GL/glext.h:7035
+glVertexStream1ivATI = _link_function('glVertexStream1ivATI', None, [GLenum, POINTER(GLint)], 'ATI_vertex_streams')
+
+# GL/glext.h:7036
+glVertexStream1fATI = _link_function('glVertexStream1fATI', None, [GLenum, GLfloat], 'ATI_vertex_streams')
+
+# GL/glext.h:7037
+glVertexStream1fvATI = _link_function('glVertexStream1fvATI', None, [GLenum, POINTER(GLfloat)], 'ATI_vertex_streams')
+
+# GL/glext.h:7038
+glVertexStream1dATI = _link_function('glVertexStream1dATI', None, [GLenum, GLdouble], 'ATI_vertex_streams')
+
+# GL/glext.h:7039
+glVertexStream1dvATI = _link_function('glVertexStream1dvATI', None, [GLenum, POINTER(GLdouble)], 'ATI_vertex_streams')
+
+# GL/glext.h:7040
+glVertexStream2sATI = _link_function('glVertexStream2sATI', None, [GLenum, GLshort, GLshort], 'ATI_vertex_streams')
+
+# GL/glext.h:7041
+glVertexStream2svATI = _link_function('glVertexStream2svATI', None, [GLenum, POINTER(GLshort)], 'ATI_vertex_streams')
+
+# GL/glext.h:7042
+glVertexStream2iATI = _link_function('glVertexStream2iATI', None, [GLenum, GLint, GLint], 'ATI_vertex_streams')
+
+# GL/glext.h:7043
+glVertexStream2ivATI = _link_function('glVertexStream2ivATI', None, [GLenum, POINTER(GLint)], 'ATI_vertex_streams')
+
+# GL/glext.h:7044
+glVertexStream2fATI = _link_function('glVertexStream2fATI', None, [GLenum, GLfloat, GLfloat], 'ATI_vertex_streams')
+
+# GL/glext.h:7045
+glVertexStream2fvATI = _link_function('glVertexStream2fvATI', None, [GLenum, POINTER(GLfloat)], 'ATI_vertex_streams')
+
+# GL/glext.h:7046
+glVertexStream2dATI = _link_function('glVertexStream2dATI', None, [GLenum, GLdouble, GLdouble], 'ATI_vertex_streams')
+
+# GL/glext.h:7047
+glVertexStream2dvATI = _link_function('glVertexStream2dvATI', None, [GLenum, POINTER(GLdouble)], 'ATI_vertex_streams')
+
+# GL/glext.h:7048
+glVertexStream3sATI = _link_function('glVertexStream3sATI', None, [GLenum, GLshort, GLshort, GLshort], 'ATI_vertex_streams')
+
+# GL/glext.h:7049
+glVertexStream3svATI = _link_function('glVertexStream3svATI', None, [GLenum, POINTER(GLshort)], 'ATI_vertex_streams')
+
+# GL/glext.h:7050
+glVertexStream3iATI = _link_function('glVertexStream3iATI', None, [GLenum, GLint, GLint, GLint], 'ATI_vertex_streams')
+
+# GL/glext.h:7051
+glVertexStream3ivATI = _link_function('glVertexStream3ivATI', None, [GLenum, POINTER(GLint)], 'ATI_vertex_streams')
+
+# GL/glext.h:7052
+glVertexStream3fATI = _link_function('glVertexStream3fATI', None, [GLenum, GLfloat, GLfloat, GLfloat], 'ATI_vertex_streams')
+
+# GL/glext.h:7053
+glVertexStream3fvATI = _link_function('glVertexStream3fvATI', None, [GLenum, POINTER(GLfloat)], 'ATI_vertex_streams')
+
+# GL/glext.h:7054
+glVertexStream3dATI = _link_function('glVertexStream3dATI', None, [GLenum, GLdouble, GLdouble, GLdouble], 'ATI_vertex_streams')
+
+# GL/glext.h:7055
+glVertexStream3dvATI = _link_function('glVertexStream3dvATI', None, [GLenum, POINTER(GLdouble)], 'ATI_vertex_streams')
+
+# GL/glext.h:7056
+glVertexStream4sATI = _link_function('glVertexStream4sATI', None, [GLenum, GLshort, GLshort, GLshort, GLshort], 'ATI_vertex_streams')
+
+# GL/glext.h:7057
+glVertexStream4svATI = _link_function('glVertexStream4svATI', None, [GLenum, POINTER(GLshort)], 'ATI_vertex_streams')
+
+# GL/glext.h:7058
+glVertexStream4iATI = _link_function('glVertexStream4iATI', None, [GLenum, GLint, GLint, GLint, GLint], 'ATI_vertex_streams')
+
+# GL/glext.h:7059
+glVertexStream4ivATI = _link_function('glVertexStream4ivATI', None, [GLenum, POINTER(GLint)], 'ATI_vertex_streams')
+
+# GL/glext.h:7060
+glVertexStream4fATI = _link_function('glVertexStream4fATI', None, [GLenum, GLfloat, GLfloat, GLfloat, GLfloat], 'ATI_vertex_streams')
+
+# GL/glext.h:7061
+glVertexStream4fvATI = _link_function('glVertexStream4fvATI', None, [GLenum, POINTER(GLfloat)], 'ATI_vertex_streams')
+
+# GL/glext.h:7062
+glVertexStream4dATI = _link_function('glVertexStream4dATI', None, [GLenum, GLdouble, GLdouble, GLdouble, GLdouble], 'ATI_vertex_streams')
+
+# GL/glext.h:7063
+glVertexStream4dvATI = _link_function('glVertexStream4dvATI', None, [GLenum, POINTER(GLdouble)], 'ATI_vertex_streams')
+
+# GL/glext.h:7064
+glNormalStream3bATI = _link_function('glNormalStream3bATI', None, [GLenum, GLbyte, GLbyte, GLbyte], 'ATI_vertex_streams')
+
+# GL/glext.h:7065
+glNormalStream3bvATI = _link_function('glNormalStream3bvATI', None, [GLenum, POINTER(GLbyte)], 'ATI_vertex_streams')
+
+# GL/glext.h:7066
+glNormalStream3sATI = _link_function('glNormalStream3sATI', None, [GLenum, GLshort, GLshort, GLshort], 'ATI_vertex_streams')
+
+# GL/glext.h:7067
+glNormalStream3svATI = _link_function('glNormalStream3svATI', None, [GLenum, POINTER(GLshort)], 'ATI_vertex_streams')
+
+# GL/glext.h:7068
+glNormalStream3iATI = _link_function('glNormalStream3iATI', None, [GLenum, GLint, GLint, GLint], 'ATI_vertex_streams')
+
+# GL/glext.h:7069
+glNormalStream3ivATI = _link_function('glNormalStream3ivATI', None, [GLenum, POINTER(GLint)], 'ATI_vertex_streams')
+
+# GL/glext.h:7070
+glNormalStream3fATI = _link_function('glNormalStream3fATI', None, [GLenum, GLfloat, GLfloat, GLfloat], 'ATI_vertex_streams')
+
+# GL/glext.h:7071
+glNormalStream3fvATI = _link_function('glNormalStream3fvATI', None, [GLenum, POINTER(GLfloat)], 'ATI_vertex_streams')
+
+# GL/glext.h:7072
+glNormalStream3dATI = _link_function('glNormalStream3dATI', None, [GLenum, GLdouble, GLdouble, GLdouble], 'ATI_vertex_streams')
+
+# GL/glext.h:7073
+glNormalStream3dvATI = _link_function('glNormalStream3dvATI', None, [GLenum, POINTER(GLdouble)], 'ATI_vertex_streams')
+
+# GL/glext.h:7074
+glClientActiveVertexStreamATI = _link_function('glClientActiveVertexStreamATI', None, [GLenum], 'ATI_vertex_streams')
+
+# GL/glext.h:7075
+glVertexBlendEnviATI = _link_function('glVertexBlendEnviATI', None, [GLenum, GLint], 'ATI_vertex_streams')
+
+# GL/glext.h:7076
+glVertexBlendEnvfATI = _link_function('glVertexBlendEnvfATI', None, [GLenum, GLfloat], 'ATI_vertex_streams')
+
+PFNGLVERTEXSTREAM1SATIPROC = CFUNCTYPE(None, GLenum, GLshort) # GL/glext.h:7078
+PFNGLVERTEXSTREAM1SVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLshort)) # GL/glext.h:7079
+PFNGLVERTEXSTREAM1IATIPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:7080
+PFNGLVERTEXSTREAM1IVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:7081
+PFNGLVERTEXSTREAM1FATIPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:7082
+PFNGLVERTEXSTREAM1FVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:7083
+PFNGLVERTEXSTREAM1DATIPROC = CFUNCTYPE(None, GLenum, GLdouble) # GL/glext.h:7084
+PFNGLVERTEXSTREAM1DVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:7085
+PFNGLVERTEXSTREAM2SATIPROC = CFUNCTYPE(None, GLenum, GLshort, GLshort) # GL/glext.h:7086
+PFNGLVERTEXSTREAM2SVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLshort)) # GL/glext.h:7087
+PFNGLVERTEXSTREAM2IATIPROC = CFUNCTYPE(None, GLenum, GLint, GLint) # GL/glext.h:7088
+PFNGLVERTEXSTREAM2IVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:7089
+PFNGLVERTEXSTREAM2FATIPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat) # GL/glext.h:7090
+PFNGLVERTEXSTREAM2FVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:7091
+PFNGLVERTEXSTREAM2DATIPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble) # GL/glext.h:7092
+PFNGLVERTEXSTREAM2DVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:7093
+PFNGLVERTEXSTREAM3SATIPROC = CFUNCTYPE(None, GLenum, GLshort, GLshort, GLshort) # GL/glext.h:7094
+PFNGLVERTEXSTREAM3SVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLshort)) # GL/glext.h:7095
+PFNGLVERTEXSTREAM3IATIPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint) # GL/glext.h:7096
+PFNGLVERTEXSTREAM3IVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:7097
+PFNGLVERTEXSTREAM3FATIPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat, GLfloat) # GL/glext.h:7098
+PFNGLVERTEXSTREAM3FVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:7099
+PFNGLVERTEXSTREAM3DATIPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble) # GL/glext.h:7100
+PFNGLVERTEXSTREAM3DVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:7101
+PFNGLVERTEXSTREAM4SATIPROC = CFUNCTYPE(None, GLenum, GLshort, GLshort, GLshort, GLshort) # GL/glext.h:7102
+PFNGLVERTEXSTREAM4SVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLshort)) # GL/glext.h:7103
+PFNGLVERTEXSTREAM4IATIPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint, GLint) # GL/glext.h:7104
+PFNGLVERTEXSTREAM4IVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:7105
+PFNGLVERTEXSTREAM4FATIPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:7106
+PFNGLVERTEXSTREAM4FVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:7107
+PFNGLVERTEXSTREAM4DATIPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:7108
+PFNGLVERTEXSTREAM4DVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:7109
+PFNGLNORMALSTREAM3BATIPROC = CFUNCTYPE(None, GLenum, GLbyte, GLbyte, GLbyte) # GL/glext.h:7110
+PFNGLNORMALSTREAM3BVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLbyte)) # GL/glext.h:7111
+PFNGLNORMALSTREAM3SATIPROC = CFUNCTYPE(None, GLenum, GLshort, GLshort, GLshort) # GL/glext.h:7112
+PFNGLNORMALSTREAM3SVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLshort)) # GL/glext.h:7113
+PFNGLNORMALSTREAM3IATIPROC = CFUNCTYPE(None, GLenum, GLint, GLint, GLint) # GL/glext.h:7114
+PFNGLNORMALSTREAM3IVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:7115
+PFNGLNORMALSTREAM3FATIPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat, GLfloat) # GL/glext.h:7116
+PFNGLNORMALSTREAM3FVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:7117
+PFNGLNORMALSTREAM3DATIPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble) # GL/glext.h:7118
+PFNGLNORMALSTREAM3DVATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:7119
+PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:7120
+PFNGLVERTEXBLENDENVIATIPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:7121
+PFNGLVERTEXBLENDENVFATIPROC = CFUNCTYPE(None, GLenum, GLfloat) # GL/glext.h:7122
+# ATI_element_array (GL/glext.h:7125)
+GL_ATI_element_array = 1 # GL/glext.h:7126
+# GL/glext.h:7128
+glElementPointerATI = _link_function('glElementPointerATI', None, [GLenum, POINTER(GLvoid)], 'ATI_element_array')
+
+# GL/glext.h:7129
+glDrawElementArrayATI = _link_function('glDrawElementArrayATI', None, [GLenum, GLsizei], 'ATI_element_array')
+
+# GL/glext.h:7130
+glDrawRangeElementArrayATI = _link_function('glDrawRangeElementArrayATI', None, [GLenum, GLuint, GLuint, GLsizei], 'ATI_element_array')
+
+PFNGLELEMENTPOINTERATIPROC = CFUNCTYPE(None, GLenum, POINTER(GLvoid)) # GL/glext.h:7132
+PFNGLDRAWELEMENTARRAYATIPROC = CFUNCTYPE(None, GLenum, GLsizei) # GL/glext.h:7133
+PFNGLDRAWRANGEELEMENTARRAYATIPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLsizei) # GL/glext.h:7134
+# SUN_mesh_array (GL/glext.h:7137)
+GL_SUN_mesh_array = 1 # GL/glext.h:7138
+# GL/glext.h:7140
+glDrawMeshArraysSUN = _link_function('glDrawMeshArraysSUN', None, [GLenum, GLint, GLsizei, GLsizei], 'SUN_mesh_array')
+
+PFNGLDRAWMESHARRAYSSUNPROC = CFUNCTYPE(None, GLenum, GLint, GLsizei, GLsizei) # GL/glext.h:7142
+# SUN_slice_accum (GL/glext.h:7145)
+GL_SUN_slice_accum = 1 # GL/glext.h:7146
+# NV_multisample_filter_hint (GL/glext.h:7149)
+GL_NV_multisample_filter_hint = 1 # GL/glext.h:7150
+# NV_depth_clamp (GL/glext.h:7153)
+GL_NV_depth_clamp = 1 # GL/glext.h:7154
+# NV_occlusion_query (GL/glext.h:7157)
+GL_NV_occlusion_query = 1 # GL/glext.h:7158
+# GL/glext.h:7160
+glGenOcclusionQueriesNV = _link_function('glGenOcclusionQueriesNV', None, [GLsizei, POINTER(GLuint)], 'NV_occlusion_query')
+
+# GL/glext.h:7161
+glDeleteOcclusionQueriesNV = _link_function('glDeleteOcclusionQueriesNV', None, [GLsizei, POINTER(GLuint)], 'NV_occlusion_query')
+
+# GL/glext.h:7162
+glIsOcclusionQueryNV = _link_function('glIsOcclusionQueryNV', GLboolean, [GLuint], 'NV_occlusion_query')
+
+# GL/glext.h:7163
+glBeginOcclusionQueryNV = _link_function('glBeginOcclusionQueryNV', None, [GLuint], 'NV_occlusion_query')
+
+# GL/glext.h:7164
+glEndOcclusionQueryNV = _link_function('glEndOcclusionQueryNV', None, [], 'NV_occlusion_query')
+
+# GL/glext.h:7165
+glGetOcclusionQueryivNV = _link_function('glGetOcclusionQueryivNV', None, [GLuint, GLenum, POINTER(GLint)], 'NV_occlusion_query')
+
+# GL/glext.h:7166
+glGetOcclusionQueryuivNV = _link_function('glGetOcclusionQueryuivNV', None, [GLuint, GLenum, POINTER(GLuint)], 'NV_occlusion_query')
+
+PFNGLGENOCCLUSIONQUERIESNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:7168
+PFNGLDELETEOCCLUSIONQUERIESNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:7169
+PFNGLISOCCLUSIONQUERYNVPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:7170
+PFNGLBEGINOCCLUSIONQUERYNVPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:7171
+PFNGLENDOCCLUSIONQUERYNVPROC = CFUNCTYPE(None) # GL/glext.h:7172
+PFNGLGETOCCLUSIONQUERYIVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:7173
+PFNGLGETOCCLUSIONQUERYUIVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint)) # GL/glext.h:7174
+# NV_point_sprite (GL/glext.h:7177)
+GL_NV_point_sprite = 1 # GL/glext.h:7178
+# GL/glext.h:7180
+glPointParameteriNV = _link_function('glPointParameteriNV', None, [GLenum, GLint], 'NV_point_sprite')
+
+# GL/glext.h:7181
+glPointParameterivNV = _link_function('glPointParameterivNV', None, [GLenum, POINTER(GLint)], 'NV_point_sprite')
+
+PFNGLPOINTPARAMETERINVPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:7183
+PFNGLPOINTPARAMETERIVNVPROC = CFUNCTYPE(None, GLenum, POINTER(GLint)) # GL/glext.h:7184
+# NV_texture_shader3 (GL/glext.h:7187)
+GL_NV_texture_shader3 = 1 # GL/glext.h:7188
+# NV_vertex_program1_1 (GL/glext.h:7191)
+GL_NV_vertex_program1_1 = 1 # GL/glext.h:7192
+# EXT_shadow_funcs (GL/glext.h:7195)
+GL_EXT_shadow_funcs = 1 # GL/glext.h:7196
+# EXT_stencil_two_side (GL/glext.h:7199)
+GL_EXT_stencil_two_side = 1 # GL/glext.h:7200
+# GL/glext.h:7202
+glActiveStencilFaceEXT = _link_function('glActiveStencilFaceEXT', None, [GLenum], 'EXT_stencil_two_side')
+
+PFNGLACTIVESTENCILFACEEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:7204
+# ATI_text_fragment_shader (GL/glext.h:7207)
+GL_ATI_text_fragment_shader = 1 # GL/glext.h:7208
+# APPLE_client_storage (GL/glext.h:7211)
+GL_APPLE_client_storage = 1 # GL/glext.h:7212
+# APPLE_element_array (GL/glext.h:7215)
+GL_APPLE_element_array = 1 # GL/glext.h:7216
+# GL/glext.h:7218
+glElementPointerAPPLE = _link_function('glElementPointerAPPLE', None, [GLenum, POINTER(GLvoid)], 'APPLE_element_array')
+
+# GL/glext.h:7219
+glDrawElementArrayAPPLE = _link_function('glDrawElementArrayAPPLE', None, [GLenum, GLint, GLsizei], 'APPLE_element_array')
+
+# GL/glext.h:7220
+glDrawRangeElementArrayAPPLE = _link_function('glDrawRangeElementArrayAPPLE', None, [GLenum, GLuint, GLuint, GLint, GLsizei], 'APPLE_element_array')
+
+# GL/glext.h:7221
+glMultiDrawElementArrayAPPLE = _link_function('glMultiDrawElementArrayAPPLE', None, [GLenum, POINTER(GLint), POINTER(GLsizei), GLsizei], 'APPLE_element_array')
+
+# GL/glext.h:7222
+glMultiDrawRangeElementArrayAPPLE = _link_function('glMultiDrawRangeElementArrayAPPLE', None, [GLenum, GLuint, GLuint, POINTER(GLint), POINTER(GLsizei), GLsizei], 'APPLE_element_array')
+
+PFNGLELEMENTPOINTERAPPLEPROC = CFUNCTYPE(None, GLenum, POINTER(GLvoid)) # GL/glext.h:7224
+PFNGLDRAWELEMENTARRAYAPPLEPROC = CFUNCTYPE(None, GLenum, GLint, GLsizei) # GL/glext.h:7225
+PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLint, GLsizei) # GL/glext.h:7226
+PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC = CFUNCTYPE(None, GLenum, POINTER(GLint), POINTER(GLsizei), GLsizei) # GL/glext.h:7227
+PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, POINTER(GLint), POINTER(GLsizei), GLsizei) # GL/glext.h:7228
+# APPLE_fence (GL/glext.h:7231)
+GL_APPLE_fence = 1 # GL/glext.h:7232
+# GL/glext.h:7234
+glGenFencesAPPLE = _link_function('glGenFencesAPPLE', None, [GLsizei, POINTER(GLuint)], 'APPLE_fence')
+
+# GL/glext.h:7235
+glDeleteFencesAPPLE = _link_function('glDeleteFencesAPPLE', None, [GLsizei, POINTER(GLuint)], 'APPLE_fence')
+
+# GL/glext.h:7236
+glSetFenceAPPLE = _link_function('glSetFenceAPPLE', None, [GLuint], 'APPLE_fence')
+
+# GL/glext.h:7237
+glIsFenceAPPLE = _link_function('glIsFenceAPPLE', GLboolean, [GLuint], 'APPLE_fence')
+
+# GL/glext.h:7238
+glTestFenceAPPLE = _link_function('glTestFenceAPPLE', GLboolean, [GLuint], 'APPLE_fence')
+
+# GL/glext.h:7239
+glFinishFenceAPPLE = _link_function('glFinishFenceAPPLE', None, [GLuint], 'APPLE_fence')
+
+# GL/glext.h:7240
+glTestObjectAPPLE = _link_function('glTestObjectAPPLE', GLboolean, [GLenum, GLuint], 'APPLE_fence')
+
+# GL/glext.h:7241
+glFinishObjectAPPLE = _link_function('glFinishObjectAPPLE', None, [GLenum, GLint], 'APPLE_fence')
+
+PFNGLGENFENCESAPPLEPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:7243
+PFNGLDELETEFENCESAPPLEPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:7244
+PFNGLSETFENCEAPPLEPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:7245
+PFNGLISFENCEAPPLEPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:7246
+PFNGLTESTFENCEAPPLEPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:7247
+PFNGLFINISHFENCEAPPLEPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:7248
+PFNGLTESTOBJECTAPPLEPROC = CFUNCTYPE(GLboolean, GLenum, GLuint) # GL/glext.h:7249
+PFNGLFINISHOBJECTAPPLEPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:7250
+# APPLE_vertex_array_object (GL/glext.h:7253)
+GL_APPLE_vertex_array_object = 1 # GL/glext.h:7254
+# GL/glext.h:7256
+glBindVertexArrayAPPLE = _link_function('glBindVertexArrayAPPLE', None, [GLuint], 'APPLE_vertex_array_object')
+
+# GL/glext.h:7257
+glDeleteVertexArraysAPPLE = _link_function('glDeleteVertexArraysAPPLE', None, [GLsizei, POINTER(GLuint)], 'APPLE_vertex_array_object')
+
+# GL/glext.h:7258
+glGenVertexArraysAPPLE = _link_function('glGenVertexArraysAPPLE', None, [GLsizei, POINTER(GLuint)], 'APPLE_vertex_array_object')
+
+# GL/glext.h:7259
+glIsVertexArrayAPPLE = _link_function('glIsVertexArrayAPPLE', GLboolean, [GLuint], 'APPLE_vertex_array_object')
+
+PFNGLBINDVERTEXARRAYAPPLEPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:7261
+PFNGLDELETEVERTEXARRAYSAPPLEPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:7262
+PFNGLGENVERTEXARRAYSAPPLEPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:7263
+PFNGLISVERTEXARRAYAPPLEPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:7264
+# APPLE_vertex_array_range (GL/glext.h:7267)
+GL_APPLE_vertex_array_range = 1 # GL/glext.h:7268
+# GL/glext.h:7270
+glVertexArrayRangeAPPLE = _link_function('glVertexArrayRangeAPPLE', None, [GLsizei, POINTER(GLvoid)], 'APPLE_vertex_array_range')
+
+# GL/glext.h:7271
+glFlushVertexArrayRangeAPPLE = _link_function('glFlushVertexArrayRangeAPPLE', None, [GLsizei, POINTER(GLvoid)], 'APPLE_vertex_array_range')
+
+# GL/glext.h:7272
+glVertexArrayParameteriAPPLE = _link_function('glVertexArrayParameteriAPPLE', None, [GLenum, GLint], 'APPLE_vertex_array_range')
+
+PFNGLVERTEXARRAYRANGEAPPLEPROC = CFUNCTYPE(None, GLsizei, POINTER(GLvoid)) # GL/glext.h:7274
+PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC = CFUNCTYPE(None, GLsizei, POINTER(GLvoid)) # GL/glext.h:7275
+PFNGLVERTEXARRAYPARAMETERIAPPLEPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:7276
+# APPLE_ycbcr_422 (GL/glext.h:7279)
+GL_APPLE_ycbcr_422 = 1 # GL/glext.h:7280
+# S3_s3tc (GL/glext.h:7283)
+GL_S3_s3tc = 1 # GL/glext.h:7284
+# ATI_draw_buffers (GL/glext.h:7287)
+GL_ATI_draw_buffers = 1 # GL/glext.h:7288
+# GL/glext.h:7290
+glDrawBuffersATI = _link_function('glDrawBuffersATI', None, [GLsizei, POINTER(GLenum)], 'ATI_draw_buffers')
+
+PFNGLDRAWBUFFERSATIPROC = CFUNCTYPE(None, GLsizei, POINTER(GLenum)) # GL/glext.h:7292
+# ATI_pixel_format_float (GL/glext.h:7295)
+GL_ATI_pixel_format_float = 1 # GL/glext.h:7296
+# ATI_texture_env_combine3 (GL/glext.h:7302)
+GL_ATI_texture_env_combine3 = 1 # GL/glext.h:7303
+# ATI_texture_float (GL/glext.h:7306)
+GL_ATI_texture_float = 1 # GL/glext.h:7307
+# NV_float_buffer (GL/glext.h:7310)
+GL_NV_float_buffer = 1 # GL/glext.h:7311
+# NV_fragment_program (GL/glext.h:7314)
+GL_NV_fragment_program = 1 # GL/glext.h:7315
+# GL/glext.h:7318
+glProgramNamedParameter4fNV = _link_function('glProgramNamedParameter4fNV', None, [GLuint, GLsizei, POINTER(GLubyte), GLfloat, GLfloat, GLfloat, GLfloat], 'NV_fragment_program')
+
+# GL/glext.h:7319
+glProgramNamedParameter4dNV = _link_function('glProgramNamedParameter4dNV', None, [GLuint, GLsizei, POINTER(GLubyte), GLdouble, GLdouble, GLdouble, GLdouble], 'NV_fragment_program')
+
+# GL/glext.h:7320
+glProgramNamedParameter4fvNV = _link_function('glProgramNamedParameter4fvNV', None, [GLuint, GLsizei, POINTER(GLubyte), POINTER(GLfloat)], 'NV_fragment_program')
+
+# GL/glext.h:7321
+glProgramNamedParameter4dvNV = _link_function('glProgramNamedParameter4dvNV', None, [GLuint, GLsizei, POINTER(GLubyte), POINTER(GLdouble)], 'NV_fragment_program')
+
+# GL/glext.h:7322
+glGetProgramNamedParameterfvNV = _link_function('glGetProgramNamedParameterfvNV', None, [GLuint, GLsizei, POINTER(GLubyte), POINTER(GLfloat)], 'NV_fragment_program')
+
+# GL/glext.h:7323
+glGetProgramNamedParameterdvNV = _link_function('glGetProgramNamedParameterdvNV', None, [GLuint, GLsizei, POINTER(GLubyte), POINTER(GLdouble)], 'NV_fragment_program')
+
+PFNGLPROGRAMNAMEDPARAMETER4FNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLubyte), GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:7325
+PFNGLPROGRAMNAMEDPARAMETER4DNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLubyte), GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:7326
+PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLubyte), POINTER(GLfloat)) # GL/glext.h:7327
+PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLubyte), POINTER(GLdouble)) # GL/glext.h:7328
+PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLubyte), POINTER(GLfloat)) # GL/glext.h:7329
+PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLubyte), POINTER(GLdouble)) # GL/glext.h:7330
+# NV_half_float (GL/glext.h:7333)
+GL_NV_half_float = 1 # GL/glext.h:7334
+# GL/glext.h:7336
+glVertex2hNV = _link_function('glVertex2hNV', None, [GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7337
+glVertex2hvNV = _link_function('glVertex2hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7338
+glVertex3hNV = _link_function('glVertex3hNV', None, [GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7339
+glVertex3hvNV = _link_function('glVertex3hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7340
+glVertex4hNV = _link_function('glVertex4hNV', None, [GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7341
+glVertex4hvNV = _link_function('glVertex4hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7342
+glNormal3hNV = _link_function('glNormal3hNV', None, [GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7343
+glNormal3hvNV = _link_function('glNormal3hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7344
+glColor3hNV = _link_function('glColor3hNV', None, [GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7345
+glColor3hvNV = _link_function('glColor3hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7346
+glColor4hNV = _link_function('glColor4hNV', None, [GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7347
+glColor4hvNV = _link_function('glColor4hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7348
+glTexCoord1hNV = _link_function('glTexCoord1hNV', None, [GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7349
+glTexCoord1hvNV = _link_function('glTexCoord1hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7350
+glTexCoord2hNV = _link_function('glTexCoord2hNV', None, [GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7351
+glTexCoord2hvNV = _link_function('glTexCoord2hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7352
+glTexCoord3hNV = _link_function('glTexCoord3hNV', None, [GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7353
+glTexCoord3hvNV = _link_function('glTexCoord3hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7354
+glTexCoord4hNV = _link_function('glTexCoord4hNV', None, [GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7355
+glTexCoord4hvNV = _link_function('glTexCoord4hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7356
+glMultiTexCoord1hNV = _link_function('glMultiTexCoord1hNV', None, [GLenum, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7357
+glMultiTexCoord1hvNV = _link_function('glMultiTexCoord1hvNV', None, [GLenum, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7358
+glMultiTexCoord2hNV = _link_function('glMultiTexCoord2hNV', None, [GLenum, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7359
+glMultiTexCoord2hvNV = _link_function('glMultiTexCoord2hvNV', None, [GLenum, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7360
+glMultiTexCoord3hNV = _link_function('glMultiTexCoord3hNV', None, [GLenum, GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7361
+glMultiTexCoord3hvNV = _link_function('glMultiTexCoord3hvNV', None, [GLenum, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7362
+glMultiTexCoord4hNV = _link_function('glMultiTexCoord4hNV', None, [GLenum, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7363
+glMultiTexCoord4hvNV = _link_function('glMultiTexCoord4hvNV', None, [GLenum, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7364
+glFogCoordhNV = _link_function('glFogCoordhNV', None, [GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7365
+glFogCoordhvNV = _link_function('glFogCoordhvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7366
+glSecondaryColor3hNV = _link_function('glSecondaryColor3hNV', None, [GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7367
+glSecondaryColor3hvNV = _link_function('glSecondaryColor3hvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7368
+glVertexWeighthNV = _link_function('glVertexWeighthNV', None, [GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7369
+glVertexWeighthvNV = _link_function('glVertexWeighthvNV', None, [POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7370
+glVertexAttrib1hNV = _link_function('glVertexAttrib1hNV', None, [GLuint, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7371
+glVertexAttrib1hvNV = _link_function('glVertexAttrib1hvNV', None, [GLuint, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7372
+glVertexAttrib2hNV = _link_function('glVertexAttrib2hNV', None, [GLuint, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7373
+glVertexAttrib2hvNV = _link_function('glVertexAttrib2hvNV', None, [GLuint, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7374
+glVertexAttrib3hNV = _link_function('glVertexAttrib3hNV', None, [GLuint, GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7375
+glVertexAttrib3hvNV = _link_function('glVertexAttrib3hvNV', None, [GLuint, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7376
+glVertexAttrib4hNV = _link_function('glVertexAttrib4hNV', None, [GLuint, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV], 'NV_half_float')
+
+# GL/glext.h:7377
+glVertexAttrib4hvNV = _link_function('glVertexAttrib4hvNV', None, [GLuint, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7378
+glVertexAttribs1hvNV = _link_function('glVertexAttribs1hvNV', None, [GLuint, GLsizei, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7379
+glVertexAttribs2hvNV = _link_function('glVertexAttribs2hvNV', None, [GLuint, GLsizei, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7380
+glVertexAttribs3hvNV = _link_function('glVertexAttribs3hvNV', None, [GLuint, GLsizei, POINTER(GLhalfNV)], 'NV_half_float')
+
+# GL/glext.h:7381
+glVertexAttribs4hvNV = _link_function('glVertexAttribs4hvNV', None, [GLuint, GLsizei, POINTER(GLhalfNV)], 'NV_half_float')
+
+PFNGLVERTEX2HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV) # GL/glext.h:7383
+PFNGLVERTEX2HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:7384
+PFNGLVERTEX3HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:7385
+PFNGLVERTEX3HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:7386
+PFNGLVERTEX4HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:7387
+PFNGLVERTEX4HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:7388
+PFNGLNORMAL3HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:7389
+PFNGLNORMAL3HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:7390
+PFNGLCOLOR3HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:7391
+PFNGLCOLOR3HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:7392
+PFNGLCOLOR4HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:7393
+PFNGLCOLOR4HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:7394
+PFNGLTEXCOORD1HNVPROC = CFUNCTYPE(None, GLhalfNV) # GL/glext.h:7395
+PFNGLTEXCOORD1HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:7396
+PFNGLTEXCOORD2HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV) # GL/glext.h:7397
+PFNGLTEXCOORD2HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:7398
+PFNGLTEXCOORD3HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:7399
+PFNGLTEXCOORD3HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:7400
+PFNGLTEXCOORD4HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:7401
+PFNGLTEXCOORD4HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:7402
+PFNGLMULTITEXCOORD1HNVPROC = CFUNCTYPE(None, GLenum, GLhalfNV) # GL/glext.h:7403
+PFNGLMULTITEXCOORD1HVNVPROC = CFUNCTYPE(None, GLenum, POINTER(GLhalfNV)) # GL/glext.h:7404
+PFNGLMULTITEXCOORD2HNVPROC = CFUNCTYPE(None, GLenum, GLhalfNV, GLhalfNV) # GL/glext.h:7405
+PFNGLMULTITEXCOORD2HVNVPROC = CFUNCTYPE(None, GLenum, POINTER(GLhalfNV)) # GL/glext.h:7406
+PFNGLMULTITEXCOORD3HNVPROC = CFUNCTYPE(None, GLenum, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:7407
+PFNGLMULTITEXCOORD3HVNVPROC = CFUNCTYPE(None, GLenum, POINTER(GLhalfNV)) # GL/glext.h:7408
+PFNGLMULTITEXCOORD4HNVPROC = CFUNCTYPE(None, GLenum, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:7409
+PFNGLMULTITEXCOORD4HVNVPROC = CFUNCTYPE(None, GLenum, POINTER(GLhalfNV)) # GL/glext.h:7410
+PFNGLFOGCOORDHNVPROC = CFUNCTYPE(None, GLhalfNV) # GL/glext.h:7411
+PFNGLFOGCOORDHVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:7412
+PFNGLSECONDARYCOLOR3HNVPROC = CFUNCTYPE(None, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:7413
+PFNGLSECONDARYCOLOR3HVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:7414
+PFNGLVERTEXWEIGHTHNVPROC = CFUNCTYPE(None, GLhalfNV) # GL/glext.h:7415
+PFNGLVERTEXWEIGHTHVNVPROC = CFUNCTYPE(None, POINTER(GLhalfNV)) # GL/glext.h:7416
+PFNGLVERTEXATTRIB1HNVPROC = CFUNCTYPE(None, GLuint, GLhalfNV) # GL/glext.h:7417
+PFNGLVERTEXATTRIB1HVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLhalfNV)) # GL/glext.h:7418
+PFNGLVERTEXATTRIB2HNVPROC = CFUNCTYPE(None, GLuint, GLhalfNV, GLhalfNV) # GL/glext.h:7419
+PFNGLVERTEXATTRIB2HVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLhalfNV)) # GL/glext.h:7420
+PFNGLVERTEXATTRIB3HNVPROC = CFUNCTYPE(None, GLuint, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:7421
+PFNGLVERTEXATTRIB3HVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLhalfNV)) # GL/glext.h:7422
+PFNGLVERTEXATTRIB4HNVPROC = CFUNCTYPE(None, GLuint, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV) # GL/glext.h:7423
+PFNGLVERTEXATTRIB4HVNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLhalfNV)) # GL/glext.h:7424
+PFNGLVERTEXATTRIBS1HVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLhalfNV)) # GL/glext.h:7425
+PFNGLVERTEXATTRIBS2HVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLhalfNV)) # GL/glext.h:7426
+PFNGLVERTEXATTRIBS3HVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLhalfNV)) # GL/glext.h:7427
+PFNGLVERTEXATTRIBS4HVNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLhalfNV)) # GL/glext.h:7428
+# NV_pixel_data_range (GL/glext.h:7431)
+GL_NV_pixel_data_range = 1 # GL/glext.h:7432
+# GL/glext.h:7434
+glPixelDataRangeNV = _link_function('glPixelDataRangeNV', None, [GLenum, GLsizei, POINTER(GLvoid)], 'NV_pixel_data_range')
+
+# GL/glext.h:7435
+glFlushPixelDataRangeNV = _link_function('glFlushPixelDataRangeNV', None, [GLenum], 'NV_pixel_data_range')
+
+PFNGLPIXELDATARANGENVPROC = CFUNCTYPE(None, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:7437
+PFNGLFLUSHPIXELDATARANGENVPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:7438
+# NV_primitive_restart (GL/glext.h:7441)
+GL_NV_primitive_restart = 1 # GL/glext.h:7442
+# GL/glext.h:7444
+glPrimitiveRestartNV = _link_function('glPrimitiveRestartNV', None, [], 'NV_primitive_restart')
+
+# GL/glext.h:7445
+glPrimitiveRestartIndexNV = _link_function('glPrimitiveRestartIndexNV', None, [GLuint], 'NV_primitive_restart')
+
+PFNGLPRIMITIVERESTARTNVPROC = CFUNCTYPE(None) # GL/glext.h:7447
+PFNGLPRIMITIVERESTARTINDEXNVPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:7448
+# NV_texture_expand_normal (GL/glext.h:7451)
+GL_NV_texture_expand_normal = 1 # GL/glext.h:7452
+# NV_vertex_program2 (GL/glext.h:7455)
+GL_NV_vertex_program2 = 1 # GL/glext.h:7456
+# ATI_map_object_buffer (GL/glext.h:7459)
+GL_ATI_map_object_buffer = 1 # GL/glext.h:7460
+# GL/glext.h:7462
+glMapObjectBufferATI = _link_function('glMapObjectBufferATI', POINTER(GLvoid), [GLuint], 'ATI_map_object_buffer')
+
+# GL/glext.h:7463
+glUnmapObjectBufferATI = _link_function('glUnmapObjectBufferATI', None, [GLuint], 'ATI_map_object_buffer')
+
+PFNGLMAPOBJECTBUFFERATIPROC = CFUNCTYPE(POINTER(GLvoid), GLuint) # GL/glext.h:7465
+PFNGLUNMAPOBJECTBUFFERATIPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:7466
+# ATI_separate_stencil (GL/glext.h:7469)
+GL_ATI_separate_stencil = 1 # GL/glext.h:7470
+# GL/glext.h:7472
+glStencilOpSeparateATI = _link_function('glStencilOpSeparateATI', None, [GLenum, GLenum, GLenum, GLenum], 'ATI_separate_stencil')
+
+# GL/glext.h:7473
+glStencilFuncSeparateATI = _link_function('glStencilFuncSeparateATI', None, [GLenum, GLenum, GLint, GLuint], 'ATI_separate_stencil')
+
+PFNGLSTENCILOPSEPARATEATIPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLenum) # GL/glext.h:7475
+PFNGLSTENCILFUNCSEPARATEATIPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLuint) # GL/glext.h:7476
+# ATI_vertex_attrib_array_object (GL/glext.h:7479)
+GL_ATI_vertex_attrib_array_object = 1 # GL/glext.h:7480
+# GL/glext.h:7482
+glVertexAttribArrayObjectATI = _link_function('glVertexAttribArrayObjectATI', None, [GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint, GLuint], 'ATI_vertex_attrib_array_object')
+
+# GL/glext.h:7483
+glGetVertexAttribArrayObjectfvATI = _link_function('glGetVertexAttribArrayObjectfvATI', None, [GLuint, GLenum, POINTER(GLfloat)], 'ATI_vertex_attrib_array_object')
+
+# GL/glext.h:7484
+glGetVertexAttribArrayObjectivATI = _link_function('glGetVertexAttribArrayObjectivATI', None, [GLuint, GLenum, POINTER(GLint)], 'ATI_vertex_attrib_array_object')
+
+PFNGLVERTEXATTRIBARRAYOBJECTATIPROC = CFUNCTYPE(None, GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint, GLuint) # GL/glext.h:7486
+PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLfloat)) # GL/glext.h:7487
+PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:7488
+# OES_read_format (GL/glext.h:7491)
+GL_OES_read_format = 1 # GL/glext.h:7492
+# EXT_depth_bounds_test (GL/glext.h:7495)
+GL_EXT_depth_bounds_test = 1 # GL/glext.h:7496
+GLclampd = c_double # /usr/include/GL/gl.h:163
+# GL/glext.h:7498
+glDepthBoundsEXT = _link_function('glDepthBoundsEXT', None, [GLclampd, GLclampd], 'EXT_depth_bounds_test')
+
+PFNGLDEPTHBOUNDSEXTPROC = CFUNCTYPE(None, GLclampd, GLclampd) # GL/glext.h:7500
+# EXT_texture_mirror_clamp (GL/glext.h:7503)
+GL_EXT_texture_mirror_clamp = 1 # GL/glext.h:7504
+# EXT_blend_equation_separate (GL/glext.h:7507)
+GL_EXT_blend_equation_separate = 1 # GL/glext.h:7508
+# GL/glext.h:7510
+glBlendEquationSeparateEXT = _link_function('glBlendEquationSeparateEXT', None, [GLenum, GLenum], 'EXT_blend_equation_separate')
+
+PFNGLBLENDEQUATIONSEPARATEEXTPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:7512
+# MESA_pack_invert (GL/glext.h:7515)
+GL_MESA_pack_invert = 1 # GL/glext.h:7516
+# MESA_ycbcr_texture (GL/glext.h:7519)
+GL_MESA_ycbcr_texture = 1 # GL/glext.h:7520
+# EXT_pixel_buffer_object (GL/glext.h:7523)
+GL_EXT_pixel_buffer_object = 1 # GL/glext.h:7524
+# NV_fragment_program_option (GL/glext.h:7527)
+GL_NV_fragment_program_option = 1 # GL/glext.h:7528
+# NV_fragment_program2 (GL/glext.h:7531)
+GL_NV_fragment_program2 = 1 # GL/glext.h:7532
+# NV_vertex_program2_option (GL/glext.h:7535)
+GL_NV_vertex_program2_option = 1 # GL/glext.h:7536
+# NV_vertex_program3 (GL/glext.h:7539)
+GL_NV_vertex_program3 = 1 # GL/glext.h:7540
+# EXT_framebuffer_object (GL/glext.h:7543)
+GL_EXT_framebuffer_object = 1 # GL/glext.h:7544
+# GL/glext.h:7546
+glIsRenderbufferEXT = _link_function('glIsRenderbufferEXT', GLboolean, [GLuint], 'EXT_framebuffer_object')
+
+# GL/glext.h:7547
+glBindRenderbufferEXT = _link_function('glBindRenderbufferEXT', None, [GLenum, GLuint], 'EXT_framebuffer_object')
+
+# GL/glext.h:7548
+glDeleteRenderbuffersEXT = _link_function('glDeleteRenderbuffersEXT', None, [GLsizei, POINTER(GLuint)], 'EXT_framebuffer_object')
+
+# GL/glext.h:7549
+glGenRenderbuffersEXT = _link_function('glGenRenderbuffersEXT', None, [GLsizei, POINTER(GLuint)], 'EXT_framebuffer_object')
+
+# GL/glext.h:7550
+glRenderbufferStorageEXT = _link_function('glRenderbufferStorageEXT', None, [GLenum, GLenum, GLsizei, GLsizei], 'EXT_framebuffer_object')
+
+# GL/glext.h:7551
+glGetRenderbufferParameterivEXT = _link_function('glGetRenderbufferParameterivEXT', None, [GLenum, GLenum, POINTER(GLint)], 'EXT_framebuffer_object')
+
+# GL/glext.h:7552
+glIsFramebufferEXT = _link_function('glIsFramebufferEXT', GLboolean, [GLuint], 'EXT_framebuffer_object')
+
+# GL/glext.h:7553
+glBindFramebufferEXT = _link_function('glBindFramebufferEXT', None, [GLenum, GLuint], 'EXT_framebuffer_object')
+
+# GL/glext.h:7554
+glDeleteFramebuffersEXT = _link_function('glDeleteFramebuffersEXT', None, [GLsizei, POINTER(GLuint)], 'EXT_framebuffer_object')
+
+# GL/glext.h:7555
+glGenFramebuffersEXT = _link_function('glGenFramebuffersEXT', None, [GLsizei, POINTER(GLuint)], 'EXT_framebuffer_object')
+
+# GL/glext.h:7556
+glCheckFramebufferStatusEXT = _link_function('glCheckFramebufferStatusEXT', GLenum, [GLenum], 'EXT_framebuffer_object')
+
+# GL/glext.h:7557
+glFramebufferTexture1DEXT = _link_function('glFramebufferTexture1DEXT', None, [GLenum, GLenum, GLenum, GLuint, GLint], 'EXT_framebuffer_object')
+
+# GL/glext.h:7558
+glFramebufferTexture2DEXT = _link_function('glFramebufferTexture2DEXT', None, [GLenum, GLenum, GLenum, GLuint, GLint], 'EXT_framebuffer_object')
+
+# GL/glext.h:7559
+glFramebufferTexture3DEXT = _link_function('glFramebufferTexture3DEXT', None, [GLenum, GLenum, GLenum, GLuint, GLint, GLint], 'EXT_framebuffer_object')
+
+# GL/glext.h:7560
+glFramebufferRenderbufferEXT = _link_function('glFramebufferRenderbufferEXT', None, [GLenum, GLenum, GLenum, GLuint], 'EXT_framebuffer_object')
+
+# GL/glext.h:7561
+glGetFramebufferAttachmentParameterivEXT = _link_function('glGetFramebufferAttachmentParameterivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'EXT_framebuffer_object')
+
+# GL/glext.h:7562
+glGenerateMipmapEXT = _link_function('glGenerateMipmapEXT', None, [GLenum], 'EXT_framebuffer_object')
+
+PFNGLISRENDERBUFFEREXTPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:7564
+PFNGLBINDRENDERBUFFEREXTPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:7565
+PFNGLDELETERENDERBUFFERSEXTPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:7566
+PFNGLGENRENDERBUFFERSEXTPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:7567
+PFNGLRENDERBUFFERSTORAGEEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLsizei, GLsizei) # GL/glext.h:7568
+PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:7569
+PFNGLISFRAMEBUFFEREXTPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:7570
+PFNGLBINDFRAMEBUFFEREXTPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:7571
+PFNGLDELETEFRAMEBUFFERSEXTPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:7572
+PFNGLGENFRAMEBUFFERSEXTPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:7573
+PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC = CFUNCTYPE(GLenum, GLenum) # GL/glext.h:7574
+PFNGLFRAMEBUFFERTEXTURE1DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLuint, GLint) # GL/glext.h:7575
+PFNGLFRAMEBUFFERTEXTURE2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLuint, GLint) # GL/glext.h:7576
+PFNGLFRAMEBUFFERTEXTURE3DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLuint, GLint, GLint) # GL/glext.h:7577
+PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLuint) # GL/glext.h:7578
+PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:7579
+PFNGLGENERATEMIPMAPEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:7580
+# GREMEDY_string_marker (GL/glext.h:7583)
+GL_GREMEDY_string_marker = 1 # GL/glext.h:7584
+# GL/glext.h:7586
+glStringMarkerGREMEDY = _link_function('glStringMarkerGREMEDY', None, [GLsizei, POINTER(GLvoid)], 'GREMEDY_string_marker')
+
+PFNGLSTRINGMARKERGREMEDYPROC = CFUNCTYPE(None, GLsizei, POINTER(GLvoid)) # GL/glext.h:7588
+# EXT_Cg_shader (GL/glext.h:7591)
+GL_EXT_Cg_shader = 1 # GL/glext.h:7592
+# EXT_timer_query (GL/glext.h:7595)
+GL_EXT_timer_query = 1 # GL/glext.h:7596
+# GL/glext.h:7598
+glGetQueryObjecti64vEXT = _link_function('glGetQueryObjecti64vEXT', None, [GLuint, GLenum, POINTER(GLint64EXT)], 'EXT_timer_query')
+
+# GL/glext.h:7599
+glGetQueryObjectui64vEXT = _link_function('glGetQueryObjectui64vEXT', None, [GLuint, GLenum, POINTER(GLuint64EXT)], 'EXT_timer_query')
+
+PFNGLGETQUERYOBJECTI64VEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint64EXT)) # GL/glext.h:7601
+PFNGLGETQUERYOBJECTUI64VEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint64EXT)) # GL/glext.h:7602
+# EXT_texture_buffer_object (GL/glext.h:7605)
+GL_EXT_texture_buffer_object = 1 # GL/glext.h:7606
+# GL/glext.h:7608
+glTexBufferEXT = _link_function('glTexBufferEXT', None, [GLenum, GLenum, GLuint], 'EXT_texture_buffer_object')
+
+PFNGLTEXBUFFEREXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint) # GL/glext.h:7610
+# NV_transform_feedback (GL/glext.h:7613)
+GL_NV_transform_feedback = 1 # GL/glext.h:7614
+# GL/glext.h:7616
+glBeginTransformFeedbackNV = _link_function('glBeginTransformFeedbackNV', None, [GLenum], 'NV_transform_feedback')
+
+# GL/glext.h:7617
+glEndTransformFeedbackNV = _link_function('glEndTransformFeedbackNV', None, [], 'NV_transform_feedback')
+
+# GL/glext.h:7618
+glTransformFeedbackAttribsNV = _link_function('glTransformFeedbackAttribsNV', None, [GLuint, POINTER(GLint), GLenum], 'NV_transform_feedback')
+
+# GL/glext.h:7619
+glBindBufferRangeNV = _link_function('glBindBufferRangeNV', None, [GLenum, GLuint, GLuint, GLintptr, GLsizeiptr], 'NV_transform_feedback')
+
+# GL/glext.h:7620
+glBindBufferOffsetNV = _link_function('glBindBufferOffsetNV', None, [GLenum, GLuint, GLuint, GLintptr], 'NV_transform_feedback')
+
+# GL/glext.h:7621
+glBindBufferBaseNV = _link_function('glBindBufferBaseNV', None, [GLenum, GLuint, GLuint], 'NV_transform_feedback')
+
+# GL/glext.h:7622
+glTransformFeedbackVaryingsNV = _link_function('glTransformFeedbackVaryingsNV', None, [GLuint, GLsizei, POINTER(GLint), GLenum], 'NV_transform_feedback')
+
+# GL/glext.h:7623
+glActiveVaryingNV = _link_function('glActiveVaryingNV', None, [GLuint, POINTER(GLchar)], 'NV_transform_feedback')
+
+# GL/glext.h:7624
+glGetVaryingLocationNV = _link_function('glGetVaryingLocationNV', GLint, [GLuint, POINTER(GLchar)], 'NV_transform_feedback')
+
+# GL/glext.h:7625
+glGetActiveVaryingNV = _link_function('glGetActiveVaryingNV', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLsizei), POINTER(GLenum), POINTER(GLchar)], 'NV_transform_feedback')
+
+# GL/glext.h:7626
+glGetTransformFeedbackVaryingNV = _link_function('glGetTransformFeedbackVaryingNV', None, [GLuint, GLuint, POINTER(GLint)], 'NV_transform_feedback')
+
+PFNGLBEGINTRANSFORMFEEDBACKNVPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:7628
+PFNGLENDTRANSFORMFEEDBACKNVPROC = CFUNCTYPE(None) # GL/glext.h:7629
+PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLint), GLenum) # GL/glext.h:7630
+PFNGLBINDBUFFERRANGENVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLintptr, GLsizeiptr) # GL/glext.h:7631
+PFNGLBINDBUFFEROFFSETNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLintptr) # GL/glext.h:7632
+PFNGLBINDBUFFERBASENVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint) # GL/glext.h:7633
+PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLint), GLenum) # GL/glext.h:7634
+PFNGLACTIVEVARYINGNVPROC = CFUNCTYPE(None, GLuint, POINTER(GLchar)) # GL/glext.h:7635
+PFNGLGETVARYINGLOCATIONNVPROC = CFUNCTYPE(GLint, GLuint, POINTER(GLchar)) # GL/glext.h:7636
+PFNGLGETACTIVEVARYINGNVPROC = CFUNCTYPE(None, GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLsizei), POINTER(GLenum), POINTER(GLchar)) # GL/glext.h:7637
+PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC = CFUNCTYPE(None, GLuint, GLuint, POINTER(GLint)) # GL/glext.h:7638
+# NV_depth_buffer_float (GL/glext.h:7642)
+GL_NV_depth_buffer_float = 1 # GL/glext.h:7643
+# GL/glext.h:7645
+glDepthRangedNV = _link_function('glDepthRangedNV', None, [GLdouble, GLdouble], 'NV_depth_buffer_float')
+
+# GL/glext.h:7646
+glClearDepthdNV = _link_function('glClearDepthdNV', None, [GLdouble], 'NV_depth_buffer_float')
+
+# GL/glext.h:7647
+glDepthBoundsdNV = _link_function('glDepthBoundsdNV', None, [GLdouble, GLdouble], 'NV_depth_buffer_float')
+
+PFNGLDEPTHRANGEDNVPROC = CFUNCTYPE(None, GLdouble, GLdouble) # GL/glext.h:7649
+PFNGLCLEARDEPTHDNVPROC = CFUNCTYPE(None, GLdouble) # GL/glext.h:7650
+PFNGLDEPTHBOUNDSDNVPROC = CFUNCTYPE(None, GLdouble, GLdouble) # GL/glext.h:7651
+# EXT_texture_compression_latc (GL/glext.h:7654)
+GL_EXT_texture_compression_latc = 1 # GL/glext.h:7655
+# EXT_framebuffer_sRGB (GL/glext.h:7658)
+GL_EXT_framebuffer_sRGB = 1 # GL/glext.h:7659
+# EXT_texture_shared_exponent (GL/glext.h:7662)
+GL_EXT_texture_shared_exponent = 1 # GL/glext.h:7663
+# EXT_packed_float (GL/glext.h:7666)
+GL_EXT_packed_float = 1 # GL/glext.h:7667
+# EXT_texture_array (GL/glext.h:7670)
+GL_EXT_texture_array = 1 # GL/glext.h:7671
+# EXT_draw_buffers2 (GL/glext.h:7674)
+GL_EXT_draw_buffers2 = 1 # GL/glext.h:7675
+# GL/glext.h:7677
+glColorMaskIndexedEXT = _link_function('glColorMaskIndexedEXT', None, [GLuint, GLboolean, GLboolean, GLboolean, GLboolean], 'EXT_draw_buffers2')
+
+# GL/glext.h:7678
+glGetBooleanIndexedvEXT = _link_function('glGetBooleanIndexedvEXT', None, [GLenum, GLuint, POINTER(GLboolean)], 'EXT_draw_buffers2')
+
+# GL/glext.h:7679
+glGetIntegerIndexedvEXT = _link_function('glGetIntegerIndexedvEXT', None, [GLenum, GLuint, POINTER(GLint)], 'EXT_draw_buffers2')
+
+# GL/glext.h:7680
+glEnableIndexedEXT = _link_function('glEnableIndexedEXT', None, [GLenum, GLuint], 'EXT_draw_buffers2')
+
+# GL/glext.h:7681
+glDisableIndexedEXT = _link_function('glDisableIndexedEXT', None, [GLenum, GLuint], 'EXT_draw_buffers2')
+
+# GL/glext.h:7682
+glIsEnabledIndexedEXT = _link_function('glIsEnabledIndexedEXT', GLboolean, [GLenum, GLuint], 'EXT_draw_buffers2')
+
+PFNGLCOLORMASKINDEXEDEXTPROC = CFUNCTYPE(None, GLuint, GLboolean, GLboolean, GLboolean, GLboolean) # GL/glext.h:7684
+PFNGLGETBOOLEANINDEXEDVEXTPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLboolean)) # GL/glext.h:7685
+PFNGLGETINTEGERINDEXEDVEXTPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLint)) # GL/glext.h:7686
+PFNGLENABLEINDEXEDEXTPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:7687
+PFNGLDISABLEINDEXEDEXTPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:7688
+PFNGLISENABLEDINDEXEDEXTPROC = CFUNCTYPE(GLboolean, GLenum, GLuint) # GL/glext.h:7689
+# EXT_texture_integer (GL/glext.h:7692)
+GL_EXT_texture_integer = 1 # GL/glext.h:7693
+# GL/glext.h:7695
+glTexParameterIivEXT = _link_function('glTexParameterIivEXT', None, [GLenum, GLenum, POINTER(GLint)], 'EXT_texture_integer')
+
+# GL/glext.h:7696
+glTexParameterIuivEXT = _link_function('glTexParameterIuivEXT', None, [GLenum, GLenum, POINTER(GLuint)], 'EXT_texture_integer')
+
+# GL/glext.h:7697
+glGetTexParameterIivEXT = _link_function('glGetTexParameterIivEXT', None, [GLenum, GLenum, POINTER(GLint)], 'EXT_texture_integer')
+
+# GL/glext.h:7698
+glGetTexParameterIuivEXT = _link_function('glGetTexParameterIuivEXT', None, [GLenum, GLenum, POINTER(GLuint)], 'EXT_texture_integer')
+
+# GL/glext.h:7699
+glClearColorIiEXT = _link_function('glClearColorIiEXT', None, [GLint, GLint, GLint, GLint], 'EXT_texture_integer')
+
+# GL/glext.h:7700
+glClearColorIuiEXT = _link_function('glClearColorIuiEXT', None, [GLuint, GLuint, GLuint, GLuint], 'EXT_texture_integer')
+
+PFNGLTEXPARAMETERIIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:7702
+PFNGLTEXPARAMETERIUIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:7703
+PFNGLGETTEXPARAMETERIIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:7704
+PFNGLGETTEXPARAMETERIUIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:7705
+PFNGLCLEARCOLORIIEXTPROC = CFUNCTYPE(None, GLint, GLint, GLint, GLint) # GL/glext.h:7706
+PFNGLCLEARCOLORIUIEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:7707
+# EXT_bindable_uniform (GL/glext.h:7710)
+GL_EXT_bindable_uniform = 1 # GL/glext.h:7711
+# GL/glext.h:7713
+glUniformBufferEXT = _link_function('glUniformBufferEXT', None, [GLuint, GLint, GLuint], 'EXT_bindable_uniform')
+
+# GL/glext.h:7714
+glGetUniformBufferSizeEXT = _link_function('glGetUniformBufferSizeEXT', GLint, [GLuint, GLint], 'EXT_bindable_uniform')
+
+# GL/glext.h:7715
+glGetUniformOffsetEXT = _link_function('glGetUniformOffsetEXT', GLintptr, [GLuint, GLint], 'EXT_bindable_uniform')
+
+PFNGLUNIFORMBUFFEREXTPROC = CFUNCTYPE(None, GLuint, GLint, GLuint) # GL/glext.h:7717
+PFNGLGETUNIFORMBUFFERSIZEEXTPROC = CFUNCTYPE(GLint, GLuint, GLint) # GL/glext.h:7718
+PFNGLGETUNIFORMOFFSETEXTPROC = CFUNCTYPE(GLintptr, GLuint, GLint) # GL/glext.h:7719
+# EXT_gpu_shader4 (GL/glext.h:7722)
+GL_EXT_gpu_shader4 = 1 # GL/glext.h:7723
+# GL/glext.h:7725
+glGetUniformuivEXT = _link_function('glGetUniformuivEXT', None, [GLuint, GLint, POINTER(GLuint)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7726
+glBindFragDataLocationEXT = _link_function('glBindFragDataLocationEXT', None, [GLuint, GLuint, POINTER(GLchar)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7727
+glGetFragDataLocationEXT = _link_function('glGetFragDataLocationEXT', GLint, [GLuint, POINTER(GLchar)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7728
+glUniform1uiEXT = _link_function('glUniform1uiEXT', None, [GLint, GLuint], 'EXT_gpu_shader4')
+
+# GL/glext.h:7729
+glUniform2uiEXT = _link_function('glUniform2uiEXT', None, [GLint, GLuint, GLuint], 'EXT_gpu_shader4')
+
+# GL/glext.h:7730
+glUniform3uiEXT = _link_function('glUniform3uiEXT', None, [GLint, GLuint, GLuint, GLuint], 'EXT_gpu_shader4')
+
+# GL/glext.h:7731
+glUniform4uiEXT = _link_function('glUniform4uiEXT', None, [GLint, GLuint, GLuint, GLuint, GLuint], 'EXT_gpu_shader4')
+
+# GL/glext.h:7732
+glUniform1uivEXT = _link_function('glUniform1uivEXT', None, [GLint, GLsizei, POINTER(GLuint)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7733
+glUniform2uivEXT = _link_function('glUniform2uivEXT', None, [GLint, GLsizei, POINTER(GLuint)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7734
+glUniform3uivEXT = _link_function('glUniform3uivEXT', None, [GLint, GLsizei, POINTER(GLuint)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7735
+glUniform4uivEXT = _link_function('glUniform4uivEXT', None, [GLint, GLsizei, POINTER(GLuint)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7736
+glVertexAttribI1iEXT = _link_function('glVertexAttribI1iEXT', None, [GLuint, GLint], 'EXT_gpu_shader4')
+
+# GL/glext.h:7737
+glVertexAttribI2iEXT = _link_function('glVertexAttribI2iEXT', None, [GLuint, GLint, GLint], 'EXT_gpu_shader4')
+
+# GL/glext.h:7738
+glVertexAttribI3iEXT = _link_function('glVertexAttribI3iEXT', None, [GLuint, GLint, GLint, GLint], 'EXT_gpu_shader4')
+
+# GL/glext.h:7739
+glVertexAttribI4iEXT = _link_function('glVertexAttribI4iEXT', None, [GLuint, GLint, GLint, GLint, GLint], 'EXT_gpu_shader4')
+
+# GL/glext.h:7740
+glVertexAttribI1uiEXT = _link_function('glVertexAttribI1uiEXT', None, [GLuint, GLuint], 'EXT_gpu_shader4')
+
+# GL/glext.h:7741
+glVertexAttribI2uiEXT = _link_function('glVertexAttribI2uiEXT', None, [GLuint, GLuint, GLuint], 'EXT_gpu_shader4')
+
+# GL/glext.h:7742
+glVertexAttribI3uiEXT = _link_function('glVertexAttribI3uiEXT', None, [GLuint, GLuint, GLuint, GLuint], 'EXT_gpu_shader4')
+
+# GL/glext.h:7743
+glVertexAttribI4uiEXT = _link_function('glVertexAttribI4uiEXT', None, [GLuint, GLuint, GLuint, GLuint, GLuint], 'EXT_gpu_shader4')
+
+# GL/glext.h:7744
+glVertexAttribI1ivEXT = _link_function('glVertexAttribI1ivEXT', None, [GLuint, POINTER(GLint)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7745
+glVertexAttribI2ivEXT = _link_function('glVertexAttribI2ivEXT', None, [GLuint, POINTER(GLint)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7746
+glVertexAttribI3ivEXT = _link_function('glVertexAttribI3ivEXT', None, [GLuint, POINTER(GLint)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7747
+glVertexAttribI4ivEXT = _link_function('glVertexAttribI4ivEXT', None, [GLuint, POINTER(GLint)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7748
+glVertexAttribI1uivEXT = _link_function('glVertexAttribI1uivEXT', None, [GLuint, POINTER(GLuint)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7749
+glVertexAttribI2uivEXT = _link_function('glVertexAttribI2uivEXT', None, [GLuint, POINTER(GLuint)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7750
+glVertexAttribI3uivEXT = _link_function('glVertexAttribI3uivEXT', None, [GLuint, POINTER(GLuint)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7751
+glVertexAttribI4uivEXT = _link_function('glVertexAttribI4uivEXT', None, [GLuint, POINTER(GLuint)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7752
+glVertexAttribI4bvEXT = _link_function('glVertexAttribI4bvEXT', None, [GLuint, POINTER(GLbyte)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7753
+glVertexAttribI4svEXT = _link_function('glVertexAttribI4svEXT', None, [GLuint, POINTER(GLshort)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7754
+glVertexAttribI4ubvEXT = _link_function('glVertexAttribI4ubvEXT', None, [GLuint, POINTER(GLubyte)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7755
+glVertexAttribI4usvEXT = _link_function('glVertexAttribI4usvEXT', None, [GLuint, POINTER(GLushort)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7756
+glVertexAttribIPointerEXT = _link_function('glVertexAttribIPointerEXT', None, [GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7757
+glGetVertexAttribIivEXT = _link_function('glGetVertexAttribIivEXT', None, [GLuint, GLenum, POINTER(GLint)], 'EXT_gpu_shader4')
+
+# GL/glext.h:7758
+glGetVertexAttribIuivEXT = _link_function('glGetVertexAttribIuivEXT', None, [GLuint, GLenum, POINTER(GLuint)], 'EXT_gpu_shader4')
+
+PFNGLGETUNIFORMUIVEXTPROC = CFUNCTYPE(None, GLuint, GLint, POINTER(GLuint)) # GL/glext.h:7760
+PFNGLBINDFRAGDATALOCATIONEXTPROC = CFUNCTYPE(None, GLuint, GLuint, POINTER(GLchar)) # GL/glext.h:7761
+PFNGLGETFRAGDATALOCATIONEXTPROC = CFUNCTYPE(GLint, GLuint, POINTER(GLchar)) # GL/glext.h:7762
+PFNGLUNIFORM1UIEXTPROC = CFUNCTYPE(None, GLint, GLuint) # GL/glext.h:7763
+PFNGLUNIFORM2UIEXTPROC = CFUNCTYPE(None, GLint, GLuint, GLuint) # GL/glext.h:7764
+PFNGLUNIFORM3UIEXTPROC = CFUNCTYPE(None, GLint, GLuint, GLuint, GLuint) # GL/glext.h:7765
+PFNGLUNIFORM4UIEXTPROC = CFUNCTYPE(None, GLint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:7766
+PFNGLUNIFORM1UIVEXTPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:7767
+PFNGLUNIFORM2UIVEXTPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:7768
+PFNGLUNIFORM3UIVEXTPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:7769
+PFNGLUNIFORM4UIVEXTPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:7770
+PFNGLVERTEXATTRIBI1IEXTPROC = CFUNCTYPE(None, GLuint, GLint) # GL/glext.h:7771
+PFNGLVERTEXATTRIBI2IEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLint) # GL/glext.h:7772
+PFNGLVERTEXATTRIBI3IEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLint, GLint) # GL/glext.h:7773
+PFNGLVERTEXATTRIBI4IEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLint, GLint, GLint) # GL/glext.h:7774
+PFNGLVERTEXATTRIBI1UIEXTPROC = CFUNCTYPE(None, GLuint, GLuint) # GL/glext.h:7775
+PFNGLVERTEXATTRIBI2UIEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint) # GL/glext.h:7776
+PFNGLVERTEXATTRIBI3UIEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:7777
+PFNGLVERTEXATTRIBI4UIEXTPROC = CFUNCTYPE(None, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:7778
+PFNGLVERTEXATTRIBI1IVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:7779
+PFNGLVERTEXATTRIBI2IVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:7780
+PFNGLVERTEXATTRIBI3IVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:7781
+PFNGLVERTEXATTRIBI4IVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLint)) # GL/glext.h:7782
+PFNGLVERTEXATTRIBI1UIVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:7783
+PFNGLVERTEXATTRIBI2UIVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:7784
+PFNGLVERTEXATTRIBI3UIVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:7785
+PFNGLVERTEXATTRIBI4UIVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLuint)) # GL/glext.h:7786
+PFNGLVERTEXATTRIBI4BVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLbyte)) # GL/glext.h:7787
+PFNGLVERTEXATTRIBI4SVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLshort)) # GL/glext.h:7788
+PFNGLVERTEXATTRIBI4UBVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLubyte)) # GL/glext.h:7789
+PFNGLVERTEXATTRIBI4USVEXTPROC = CFUNCTYPE(None, GLuint, POINTER(GLushort)) # GL/glext.h:7790
+PFNGLVERTEXATTRIBIPOINTEREXTPROC = CFUNCTYPE(None, GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:7791
+PFNGLGETVERTEXATTRIBIIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:7792
+PFNGLGETVERTEXATTRIBIUIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint)) # GL/glext.h:7793
+# EXT_geometry_shader4 (GL/glext.h:7797)
+GL_EXT_geometry_shader4 = 1 # GL/glext.h:7798
+# GL/glext.h:7800
+glProgramParameteriEXT = _link_function('glProgramParameteriEXT', None, [GLuint, GLenum, GLint], 'EXT_geometry_shader4')
+
+# GL/glext.h:7801
+glFramebufferTextureEXT = _link_function('glFramebufferTextureEXT', None, [GLenum, GLenum, GLuint, GLint], 'EXT_geometry_shader4')
+
+# GL/glext.h:7802
+glFramebufferTextureLayerEXT = _link_function('glFramebufferTextureLayerEXT', None, [GLenum, GLenum, GLuint, GLint, GLint], 'EXT_geometry_shader4')
+
+# GL/glext.h:7803
+glFramebufferTextureFaceEXT = _link_function('glFramebufferTextureFaceEXT', None, [GLenum, GLenum, GLuint, GLint, GLenum], 'EXT_geometry_shader4')
+
+PFNGLPROGRAMPARAMETERIEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint) # GL/glext.h:7805
+PFNGLFRAMEBUFFERTEXTUREEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLint) # GL/glext.h:7806
+PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLint, GLint) # GL/glext.h:7807
+PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLint, GLenum) # GL/glext.h:7808
+# NV_geometry_program4 (GL/glext.h:7811)
+GL_NV_geometry_program4 = 1 # GL/glext.h:7812
+# GL/glext.h:7814
+glProgramVertexLimitNV = _link_function('glProgramVertexLimitNV', None, [GLenum, GLint], 'NV_geometry_program4')
+
+PFNGLPROGRAMVERTEXLIMITNVPROC = CFUNCTYPE(None, GLenum, GLint) # GL/glext.h:7816
+# NV_gpu_program4 (GL/glext.h:7819)
+GL_NV_gpu_program4 = 1 # GL/glext.h:7820
+# GL/glext.h:7822
+glProgramLocalParameterI4iNV = _link_function('glProgramLocalParameterI4iNV', None, [GLenum, GLuint, GLint, GLint, GLint, GLint], 'NV_gpu_program4')
+
+# GL/glext.h:7823
+glProgramLocalParameterI4ivNV = _link_function('glProgramLocalParameterI4ivNV', None, [GLenum, GLuint, POINTER(GLint)], 'NV_gpu_program4')
+
+# GL/glext.h:7824
+glProgramLocalParametersI4ivNV = _link_function('glProgramLocalParametersI4ivNV', None, [GLenum, GLuint, GLsizei, POINTER(GLint)], 'NV_gpu_program4')
+
+# GL/glext.h:7825
+glProgramLocalParameterI4uiNV = _link_function('glProgramLocalParameterI4uiNV', None, [GLenum, GLuint, GLuint, GLuint, GLuint, GLuint], 'NV_gpu_program4')
+
+# GL/glext.h:7826
+glProgramLocalParameterI4uivNV = _link_function('glProgramLocalParameterI4uivNV', None, [GLenum, GLuint, POINTER(GLuint)], 'NV_gpu_program4')
+
+# GL/glext.h:7827
+glProgramLocalParametersI4uivNV = _link_function('glProgramLocalParametersI4uivNV', None, [GLenum, GLuint, GLsizei, POINTER(GLuint)], 'NV_gpu_program4')
+
+# GL/glext.h:7828
+glProgramEnvParameterI4iNV = _link_function('glProgramEnvParameterI4iNV', None, [GLenum, GLuint, GLint, GLint, GLint, GLint], 'NV_gpu_program4')
+
+# GL/glext.h:7829
+glProgramEnvParameterI4ivNV = _link_function('glProgramEnvParameterI4ivNV', None, [GLenum, GLuint, POINTER(GLint)], 'NV_gpu_program4')
+
+# GL/glext.h:7830
+glProgramEnvParametersI4ivNV = _link_function('glProgramEnvParametersI4ivNV', None, [GLenum, GLuint, GLsizei, POINTER(GLint)], 'NV_gpu_program4')
+
+# GL/glext.h:7831
+glProgramEnvParameterI4uiNV = _link_function('glProgramEnvParameterI4uiNV', None, [GLenum, GLuint, GLuint, GLuint, GLuint, GLuint], 'NV_gpu_program4')
+
+# GL/glext.h:7832
+glProgramEnvParameterI4uivNV = _link_function('glProgramEnvParameterI4uivNV', None, [GLenum, GLuint, POINTER(GLuint)], 'NV_gpu_program4')
+
+# GL/glext.h:7833
+glProgramEnvParametersI4uivNV = _link_function('glProgramEnvParametersI4uivNV', None, [GLenum, GLuint, GLsizei, POINTER(GLuint)], 'NV_gpu_program4')
+
+# GL/glext.h:7834
+glGetProgramLocalParameterIivNV = _link_function('glGetProgramLocalParameterIivNV', None, [GLenum, GLuint, POINTER(GLint)], 'NV_gpu_program4')
+
+# GL/glext.h:7835
+glGetProgramLocalParameterIuivNV = _link_function('glGetProgramLocalParameterIuivNV', None, [GLenum, GLuint, POINTER(GLuint)], 'NV_gpu_program4')
+
+# GL/glext.h:7836
+glGetProgramEnvParameterIivNV = _link_function('glGetProgramEnvParameterIivNV', None, [GLenum, GLuint, POINTER(GLint)], 'NV_gpu_program4')
+
+# GL/glext.h:7837
+glGetProgramEnvParameterIuivNV = _link_function('glGetProgramEnvParameterIuivNV', None, [GLenum, GLuint, POINTER(GLuint)], 'NV_gpu_program4')
+
+PFNGLPROGRAMLOCALPARAMETERI4INVPROC = CFUNCTYPE(None, GLenum, GLuint, GLint, GLint, GLint, GLint) # GL/glext.h:7839
+PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLint)) # GL/glext.h:7840
+PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLsizei, POINTER(GLint)) # GL/glext.h:7841
+PFNGLPROGRAMLOCALPARAMETERI4UINVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:7842
+PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLuint)) # GL/glext.h:7843
+PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLsizei, POINTER(GLuint)) # GL/glext.h:7844
+PFNGLPROGRAMENVPARAMETERI4INVPROC = CFUNCTYPE(None, GLenum, GLuint, GLint, GLint, GLint, GLint) # GL/glext.h:7845
+PFNGLPROGRAMENVPARAMETERI4IVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLint)) # GL/glext.h:7846
+PFNGLPROGRAMENVPARAMETERSI4IVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLsizei, POINTER(GLint)) # GL/glext.h:7847
+PFNGLPROGRAMENVPARAMETERI4UINVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:7848
+PFNGLPROGRAMENVPARAMETERI4UIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLuint)) # GL/glext.h:7849
+PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLsizei, POINTER(GLuint)) # GL/glext.h:7850
+PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLint)) # GL/glext.h:7851
+PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLuint)) # GL/glext.h:7852
+PFNGLGETPROGRAMENVPARAMETERIIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLint)) # GL/glext.h:7853
+PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLuint)) # GL/glext.h:7854
+# NV_parameter_buffer_object (GL/glext.h:7857)
+GL_NV_parameter_buffer_object = 1 # GL/glext.h:7858
+# GL/glext.h:7860
+glProgramBufferParametersfvNV = _link_function('glProgramBufferParametersfvNV', None, [GLenum, GLuint, GLuint, GLsizei, POINTER(GLfloat)], 'NV_parameter_buffer_object')
+
+# GL/glext.h:7861
+glProgramBufferParametersIivNV = _link_function('glProgramBufferParametersIivNV', None, [GLenum, GLuint, GLuint, GLsizei, POINTER(GLint)], 'NV_parameter_buffer_object')
+
+# GL/glext.h:7862
+glProgramBufferParametersIuivNV = _link_function('glProgramBufferParametersIuivNV', None, [GLenum, GLuint, GLuint, GLsizei, POINTER(GLuint)], 'NV_parameter_buffer_object')
+
+PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLsizei, POINTER(GLfloat)) # GL/glext.h:7864
+PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLsizei, POINTER(GLint)) # GL/glext.h:7865
+PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLsizei, POINTER(GLuint)) # GL/glext.h:7866
+# EXT_framebuffer_multisample (GL/glext.h:7869)
+GL_EXT_framebuffer_multisample = 1 # GL/glext.h:7870
+# GL/glext.h:7872
+glRenderbufferStorageMultisampleEXT = _link_function('glRenderbufferStorageMultisampleEXT', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei], 'EXT_framebuffer_multisample')
+
+PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, GLsizei, GLsizei) # GL/glext.h:7874
+# NV_framebuffer_multisample_coverage (GL/glext.h:7877)
+GL_NV_framebuffer_multisample_coverage = 1 # GL/glext.h:7878
+# GL/glext.h:7880
+glRenderbufferStorageMultisampleCoverageNV = _link_function('glRenderbufferStorageMultisampleCoverageNV', None, [GLenum, GLsizei, GLsizei, GLenum, GLsizei, GLsizei], 'NV_framebuffer_multisample_coverage')
+
+PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC = CFUNCTYPE(None, GLenum, GLsizei, GLsizei, GLenum, GLsizei, GLsizei) # GL/glext.h:7882
+# EXT_framebuffer_blit (GL/glext.h:7885)
+GL_EXT_framebuffer_blit = 1 # GL/glext.h:7886
+# GL/glext.h:7888
+glBlitFramebufferEXT = _link_function('glBlitFramebufferEXT', None, [GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum], 'EXT_framebuffer_blit')
+
+PFNGLBLITFRAMEBUFFEREXTPROC = CFUNCTYPE(None, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum) # GL/glext.h:7890
+# EXT_draw_instanced (GL/glext.h:7893)
+GL_EXT_draw_instanced = 1 # GL/glext.h:7894
+# GL/glext.h:7896
+glDrawArraysInstancedEXT = _link_function('glDrawArraysInstancedEXT', None, [GLenum, GLint, GLsizei, GLsizei], 'EXT_draw_instanced')
+
+# GL/glext.h:7897
+glDrawElementsInstancedEXT = _link_function('glDrawElementsInstancedEXT', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei], 'EXT_draw_instanced')
+
+PFNGLDRAWARRAYSINSTANCEDEXTPROC = CFUNCTYPE(None, GLenum, GLint, GLsizei, GLsizei) # GL/glext.h:7899
+PFNGLDRAWELEMENTSINSTANCEDEXTPROC = CFUNCTYPE(None, GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei) # GL/glext.h:7900
+# EXT_texture_compression_rgtc (GL/glext.h:7903)
+GL_EXT_texture_compression_rgtc = 1 # GL/glext.h:7904
+# NV_present_video (GL/glext.h:7907)
+GL_NV_present_video = 1 # GL/glext.h:7908
+# GL/glext.h:7910
+glPresentFrameKeyedNV = _link_function('glPresentFrameKeyedNV', None, [GLuint, GLuint64EXT, GLuint, GLuint, GLenum, GLenum, GLuint, GLuint, GLenum, GLuint, GLuint], 'NV_present_video')
+
+# GL/glext.h:7917
+glPresentFrameDualFillNV = _link_function('glPresentFrameDualFillNV', None, [GLuint, GLuint64EXT, GLuint, GLuint, GLenum, GLenum, GLuint, GLenum, GLuint, GLenum, GLuint, GLenum, GLuint], 'NV_present_video')
+
+# GL/glext.h:7926
+glGetVideoivNV = _link_function('glGetVideoivNV', None, [GLuint, GLenum, POINTER(GLint)], 'NV_present_video')
+
+# GL/glext.h:7927
+glGetVideouivNV = _link_function('glGetVideouivNV', None, [GLuint, GLenum, POINTER(GLuint)], 'NV_present_video')
+
+# GL/glext.h:7928
+glGetVideoi64vNV = _link_function('glGetVideoi64vNV', None, [GLuint, GLenum, POINTER(GLint64EXT)], 'NV_present_video')
+
+# GL/glext.h:7929
+glGetVideoui64vNV = _link_function('glGetVideoui64vNV', None, [GLuint, GLenum, POINTER(GLuint64EXT)], 'NV_present_video')
+
+PFNGLPRESENTFRAMEKEYEDNVPROC = CFUNCTYPE(None, GLuint, GLuint64EXT, GLuint, GLuint, GLenum, GLenum, GLuint, GLuint, GLenum, GLuint, GLuint) # GL/glext.h:7931
+PFNGLPRESENTFRAMEDUALFILLNVPROC = CFUNCTYPE(None, GLuint, GLuint64EXT, GLuint, GLuint, GLenum, GLenum, GLuint, GLenum, GLuint, GLenum, GLuint, GLenum, GLuint) # GL/glext.h:7938
+PFNGLGETVIDEOIVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:7947
+PFNGLGETVIDEOUIVNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint)) # GL/glext.h:7948
+PFNGLGETVIDEOI64VNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint64EXT)) # GL/glext.h:7949
+PFNGLGETVIDEOUI64VNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint64EXT)) # GL/glext.h:7950
+# NV_conditional_render (GL/glext.h:7953)
+GL_NV_conditional_render = 1 # GL/glext.h:7954
+# GL/glext.h:7956
+glBeginConditionalRenderNV = _link_function('glBeginConditionalRenderNV', None, [GLuint, GLenum], 'NV_conditional_render')
+
+# GL/glext.h:7957
+glEndConditionalRenderNV = _link_function('glEndConditionalRenderNV', None, [], 'NV_conditional_render')
+
+PFNGLBEGINCONDITIONALRENDERNVPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:7959
+PFNGLENDCONDITIONALRENDERNVPROC = CFUNCTYPE(None) # GL/glext.h:7960
+# EXT_transform_feedback (GL/glext.h:7963)
+GL_EXT_transform_feedback = 1 # GL/glext.h:7964
+# GL/glext.h:7966
+glBeginTransformFeedbackEXT = _link_function('glBeginTransformFeedbackEXT', None, [GLenum], 'EXT_transform_feedback')
+
+# GL/glext.h:7967
+glEndTransformFeedbackEXT = _link_function('glEndTransformFeedbackEXT', None, [], 'EXT_transform_feedback')
+
+# GL/glext.h:7968
+glBindBufferRangeEXT = _link_function('glBindBufferRangeEXT', None, [GLenum, GLuint, GLuint, GLintptr, GLsizeiptr], 'EXT_transform_feedback')
+
+# GL/glext.h:7969
+glBindBufferOffsetEXT = _link_function('glBindBufferOffsetEXT', None, [GLenum, GLuint, GLuint, GLintptr], 'EXT_transform_feedback')
+
+# GL/glext.h:7970
+glBindBufferBaseEXT = _link_function('glBindBufferBaseEXT', None, [GLenum, GLuint, GLuint], 'EXT_transform_feedback')
+
+# GL/glext.h:7971
+glTransformFeedbackVaryingsEXT = _link_function('glTransformFeedbackVaryingsEXT', None, [GLuint, GLsizei, POINTER(POINTER(GLchar)), GLenum], 'EXT_transform_feedback')
+
+# GL/glext.h:7972
+glGetTransformFeedbackVaryingEXT = _link_function('glGetTransformFeedbackVaryingEXT', None, [GLuint, GLuint, POINTER(GLint)], 'EXT_transform_feedback')
+
+PFNGLBEGINTRANSFORMFEEDBACKEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:7974
+PFNGLENDTRANSFORMFEEDBACKEXTPROC = CFUNCTYPE(None) # GL/glext.h:7975
+PFNGLBINDBUFFERRANGEEXTPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLintptr, GLsizeiptr) # GL/glext.h:7976
+PFNGLBINDBUFFEROFFSETEXTPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, GLintptr) # GL/glext.h:7977
+PFNGLBINDBUFFERBASEEXTPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint) # GL/glext.h:7978
+PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLint), GLenum) # GL/glext.h:7979
+PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC = CFUNCTYPE(None, GLuint, GLuint, POINTER(GLint)) # GL/glext.h:7980
+# EXT_direct_state_access (GL/glext.h:7983)
+GL_EXT_direct_state_access = 1 # GL/glext.h:7984
+# GL/glext.h:7986
+glClientAttribDefaultEXT = _link_function('glClientAttribDefaultEXT', None, [GLbitfield], 'EXT_direct_state_access')
+
+# GL/glext.h:7987
+glPushClientAttribDefaultEXT = _link_function('glPushClientAttribDefaultEXT', None, [GLbitfield], 'EXT_direct_state_access')
+
+# GL/glext.h:7988
+glMatrixLoadfEXT = _link_function('glMatrixLoadfEXT', None, [GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:7989
+glMatrixLoaddEXT = _link_function('glMatrixLoaddEXT', None, [GLenum, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:7990
+glMatrixMultfEXT = _link_function('glMatrixMultfEXT', None, [GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:7991
+glMatrixMultdEXT = _link_function('glMatrixMultdEXT', None, [GLenum, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:7992
+glMatrixLoadIdentityEXT = _link_function('glMatrixLoadIdentityEXT', None, [GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:7993
+glMatrixRotatefEXT = _link_function('glMatrixRotatefEXT', None, [GLenum, GLfloat, GLfloat, GLfloat, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:7994
+glMatrixRotatedEXT = _link_function('glMatrixRotatedEXT', None, [GLenum, GLdouble, GLdouble, GLdouble, GLdouble], 'EXT_direct_state_access')
+
+# GL/glext.h:7995
+glMatrixScalefEXT = _link_function('glMatrixScalefEXT', None, [GLenum, GLfloat, GLfloat, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:7996
+glMatrixScaledEXT = _link_function('glMatrixScaledEXT', None, [GLenum, GLdouble, GLdouble, GLdouble], 'EXT_direct_state_access')
+
+# GL/glext.h:7997
+glMatrixTranslatefEXT = _link_function('glMatrixTranslatefEXT', None, [GLenum, GLfloat, GLfloat, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:7998
+glMatrixTranslatedEXT = _link_function('glMatrixTranslatedEXT', None, [GLenum, GLdouble, GLdouble, GLdouble], 'EXT_direct_state_access')
+
+# GL/glext.h:7999
+glMatrixFrustumEXT = _link_function('glMatrixFrustumEXT', None, [GLenum, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble], 'EXT_direct_state_access')
+
+# GL/glext.h:8000
+glMatrixOrthoEXT = _link_function('glMatrixOrthoEXT', None, [GLenum, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble], 'EXT_direct_state_access')
+
+# GL/glext.h:8001
+glMatrixPopEXT = _link_function('glMatrixPopEXT', None, [GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:8002
+glMatrixPushEXT = _link_function('glMatrixPushEXT', None, [GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:8003
+glMatrixLoadTransposefEXT = _link_function('glMatrixLoadTransposefEXT', None, [GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8004
+glMatrixLoadTransposedEXT = _link_function('glMatrixLoadTransposedEXT', None, [GLenum, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:8005
+glMatrixMultTransposefEXT = _link_function('glMatrixMultTransposefEXT', None, [GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8006
+glMatrixMultTransposedEXT = _link_function('glMatrixMultTransposedEXT', None, [GLenum, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:8007
+glTextureParameterfEXT = _link_function('glTextureParameterfEXT', None, [GLuint, GLenum, GLenum, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:8008
+glTextureParameterfvEXT = _link_function('glTextureParameterfvEXT', None, [GLuint, GLenum, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8009
+glTextureParameteriEXT = _link_function('glTextureParameteriEXT', None, [GLuint, GLenum, GLenum, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:8010
+glTextureParameterivEXT = _link_function('glTextureParameterivEXT', None, [GLuint, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8011
+glTextureImage1DEXT = _link_function('glTextureImage1DEXT', None, [GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8012
+glTextureImage2DEXT = _link_function('glTextureImage2DEXT', None, [GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8013
+glTextureSubImage1DEXT = _link_function('glTextureSubImage1DEXT', None, [GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8014
+glTextureSubImage2DEXT = _link_function('glTextureSubImage2DEXT', None, [GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8015
+glCopyTextureImage1DEXT = _link_function('glCopyTextureImage1DEXT', None, [GLuint, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:8016
+glCopyTextureImage2DEXT = _link_function('glCopyTextureImage2DEXT', None, [GLuint, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:8017
+glCopyTextureSubImage1DEXT = _link_function('glCopyTextureSubImage1DEXT', None, [GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei], 'EXT_direct_state_access')
+
+# GL/glext.h:8018
+glCopyTextureSubImage2DEXT = _link_function('glCopyTextureSubImage2DEXT', None, [GLuint, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], 'EXT_direct_state_access')
+
+# GL/glext.h:8019
+glGetTextureImageEXT = _link_function('glGetTextureImageEXT', None, [GLuint, GLenum, GLint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8020
+glGetTextureParameterfvEXT = _link_function('glGetTextureParameterfvEXT', None, [GLuint, GLenum, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8021
+glGetTextureParameterivEXT = _link_function('glGetTextureParameterivEXT', None, [GLuint, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8022
+glGetTextureLevelParameterfvEXT = _link_function('glGetTextureLevelParameterfvEXT', None, [GLuint, GLenum, GLint, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8023
+glGetTextureLevelParameterivEXT = _link_function('glGetTextureLevelParameterivEXT', None, [GLuint, GLenum, GLint, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8024
+glTextureImage3DEXT = _link_function('glTextureImage3DEXT', None, [GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8025
+glTextureSubImage3DEXT = _link_function('glTextureSubImage3DEXT', None, [GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8026
+glCopyTextureSubImage3DEXT = _link_function('glCopyTextureSubImage3DEXT', None, [GLuint, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], 'EXT_direct_state_access')
+
+# GL/glext.h:8027
+glMultiTexParameterfEXT = _link_function('glMultiTexParameterfEXT', None, [GLenum, GLenum, GLenum, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:8028
+glMultiTexParameterfvEXT = _link_function('glMultiTexParameterfvEXT', None, [GLenum, GLenum, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8029
+glMultiTexParameteriEXT = _link_function('glMultiTexParameteriEXT', None, [GLenum, GLenum, GLenum, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:8030
+glMultiTexParameterivEXT = _link_function('glMultiTexParameterivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8031
+glMultiTexImage1DEXT = _link_function('glMultiTexImage1DEXT', None, [GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8032
+glMultiTexImage2DEXT = _link_function('glMultiTexImage2DEXT', None, [GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8033
+glMultiTexSubImage1DEXT = _link_function('glMultiTexSubImage1DEXT', None, [GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8034
+glMultiTexSubImage2DEXT = _link_function('glMultiTexSubImage2DEXT', None, [GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8035
+glCopyMultiTexImage1DEXT = _link_function('glCopyMultiTexImage1DEXT', None, [GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:8036
+glCopyMultiTexImage2DEXT = _link_function('glCopyMultiTexImage2DEXT', None, [GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:8037
+glCopyMultiTexSubImage1DEXT = _link_function('glCopyMultiTexSubImage1DEXT', None, [GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei], 'EXT_direct_state_access')
+
+# GL/glext.h:8038
+glCopyMultiTexSubImage2DEXT = _link_function('glCopyMultiTexSubImage2DEXT', None, [GLenum, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], 'EXT_direct_state_access')
+
+# GL/glext.h:8039
+glGetMultiTexImageEXT = _link_function('glGetMultiTexImageEXT', None, [GLenum, GLenum, GLint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8040
+glGetMultiTexParameterfvEXT = _link_function('glGetMultiTexParameterfvEXT', None, [GLenum, GLenum, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8041
+glGetMultiTexParameterivEXT = _link_function('glGetMultiTexParameterivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8042
+glGetMultiTexLevelParameterfvEXT = _link_function('glGetMultiTexLevelParameterfvEXT', None, [GLenum, GLenum, GLint, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8043
+glGetMultiTexLevelParameterivEXT = _link_function('glGetMultiTexLevelParameterivEXT', None, [GLenum, GLenum, GLint, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8044
+glMultiTexImage3DEXT = _link_function('glMultiTexImage3DEXT', None, [GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8045
+glMultiTexSubImage3DEXT = _link_function('glMultiTexSubImage3DEXT', None, [GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8046
+glCopyMultiTexSubImage3DEXT = _link_function('glCopyMultiTexSubImage3DEXT', None, [GLenum, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], 'EXT_direct_state_access')
+
+# GL/glext.h:8047
+glBindMultiTextureEXT = _link_function('glBindMultiTextureEXT', None, [GLenum, GLenum, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:8048
+glEnableClientStateIndexedEXT = _link_function('glEnableClientStateIndexedEXT', None, [GLenum, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:8049
+glDisableClientStateIndexedEXT = _link_function('glDisableClientStateIndexedEXT', None, [GLenum, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:8050
+glMultiTexCoordPointerEXT = _link_function('glMultiTexCoordPointerEXT', None, [GLenum, GLint, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8051
+glMultiTexEnvfEXT = _link_function('glMultiTexEnvfEXT', None, [GLenum, GLenum, GLenum, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:8052
+glMultiTexEnvfvEXT = _link_function('glMultiTexEnvfvEXT', None, [GLenum, GLenum, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8053
+glMultiTexEnviEXT = _link_function('glMultiTexEnviEXT', None, [GLenum, GLenum, GLenum, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:8054
+glMultiTexEnvivEXT = _link_function('glMultiTexEnvivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8055
+glMultiTexGendEXT = _link_function('glMultiTexGendEXT', None, [GLenum, GLenum, GLenum, GLdouble], 'EXT_direct_state_access')
+
+# GL/glext.h:8056
+glMultiTexGendvEXT = _link_function('glMultiTexGendvEXT', None, [GLenum, GLenum, GLenum, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:8057
+glMultiTexGenfEXT = _link_function('glMultiTexGenfEXT', None, [GLenum, GLenum, GLenum, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:8058
+glMultiTexGenfvEXT = _link_function('glMultiTexGenfvEXT', None, [GLenum, GLenum, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8059
+glMultiTexGeniEXT = _link_function('glMultiTexGeniEXT', None, [GLenum, GLenum, GLenum, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:8060
+glMultiTexGenivEXT = _link_function('glMultiTexGenivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8061
+glGetMultiTexEnvfvEXT = _link_function('glGetMultiTexEnvfvEXT', None, [GLenum, GLenum, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8062
+glGetMultiTexEnvivEXT = _link_function('glGetMultiTexEnvivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8063
+glGetMultiTexGendvEXT = _link_function('glGetMultiTexGendvEXT', None, [GLenum, GLenum, GLenum, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:8064
+glGetMultiTexGenfvEXT = _link_function('glGetMultiTexGenfvEXT', None, [GLenum, GLenum, GLenum, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8065
+glGetMultiTexGenivEXT = _link_function('glGetMultiTexGenivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8066
+glGetFloatIndexedvEXT = _link_function('glGetFloatIndexedvEXT', None, [GLenum, GLuint, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8067
+glGetDoubleIndexedvEXT = _link_function('glGetDoubleIndexedvEXT', None, [GLenum, GLuint, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:8068
+glGetPointerIndexedvEXT = _link_function('glGetPointerIndexedvEXT', None, [GLenum, GLuint, POINTER(POINTER(GLvoid))], 'EXT_direct_state_access')
+
+# GL/glext.h:8069
+glCompressedTextureImage3DEXT = _link_function('glCompressedTextureImage3DEXT', None, [GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8070
+glCompressedTextureImage2DEXT = _link_function('glCompressedTextureImage2DEXT', None, [GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8071
+glCompressedTextureImage1DEXT = _link_function('glCompressedTextureImage1DEXT', None, [GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8072
+glCompressedTextureSubImage3DEXT = _link_function('glCompressedTextureSubImage3DEXT', None, [GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8073
+glCompressedTextureSubImage2DEXT = _link_function('glCompressedTextureSubImage2DEXT', None, [GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8074
+glCompressedTextureSubImage1DEXT = _link_function('glCompressedTextureSubImage1DEXT', None, [GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8075
+glGetCompressedTextureImageEXT = _link_function('glGetCompressedTextureImageEXT', None, [GLuint, GLenum, GLint, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8076
+glCompressedMultiTexImage3DEXT = _link_function('glCompressedMultiTexImage3DEXT', None, [GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8077
+glCompressedMultiTexImage2DEXT = _link_function('glCompressedMultiTexImage2DEXT', None, [GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8078
+glCompressedMultiTexImage1DEXT = _link_function('glCompressedMultiTexImage1DEXT', None, [GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8079
+glCompressedMultiTexSubImage3DEXT = _link_function('glCompressedMultiTexSubImage3DEXT', None, [GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8080
+glCompressedMultiTexSubImage2DEXT = _link_function('glCompressedMultiTexSubImage2DEXT', None, [GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8081
+glCompressedMultiTexSubImage1DEXT = _link_function('glCompressedMultiTexSubImage1DEXT', None, [GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8082
+glGetCompressedMultiTexImageEXT = _link_function('glGetCompressedMultiTexImageEXT', None, [GLenum, GLenum, GLint, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8083
+glNamedProgramStringEXT = _link_function('glNamedProgramStringEXT', None, [GLuint, GLenum, GLenum, GLsizei, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8084
+glNamedProgramLocalParameter4dEXT = _link_function('glNamedProgramLocalParameter4dEXT', None, [GLuint, GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble], 'EXT_direct_state_access')
+
+# GL/glext.h:8085
+glNamedProgramLocalParameter4dvEXT = _link_function('glNamedProgramLocalParameter4dvEXT', None, [GLuint, GLenum, GLuint, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:8086
+glNamedProgramLocalParameter4fEXT = _link_function('glNamedProgramLocalParameter4fEXT', None, [GLuint, GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:8087
+glNamedProgramLocalParameter4fvEXT = _link_function('glNamedProgramLocalParameter4fvEXT', None, [GLuint, GLenum, GLuint, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8088
+glGetNamedProgramLocalParameterdvEXT = _link_function('glGetNamedProgramLocalParameterdvEXT', None, [GLuint, GLenum, GLuint, POINTER(GLdouble)], 'EXT_direct_state_access')
+
+# GL/glext.h:8089
+glGetNamedProgramLocalParameterfvEXT = _link_function('glGetNamedProgramLocalParameterfvEXT', None, [GLuint, GLenum, GLuint, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8090
+glGetNamedProgramivEXT = _link_function('glGetNamedProgramivEXT', None, [GLuint, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8091
+glGetNamedProgramStringEXT = _link_function('glGetNamedProgramStringEXT', None, [GLuint, GLenum, GLenum, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8092
+glNamedProgramLocalParameters4fvEXT = _link_function('glNamedProgramLocalParameters4fvEXT', None, [GLuint, GLenum, GLuint, GLsizei, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8093
+glNamedProgramLocalParameterI4iEXT = _link_function('glNamedProgramLocalParameterI4iEXT', None, [GLuint, GLenum, GLuint, GLint, GLint, GLint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:8094
+glNamedProgramLocalParameterI4ivEXT = _link_function('glNamedProgramLocalParameterI4ivEXT', None, [GLuint, GLenum, GLuint, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8095
+glNamedProgramLocalParametersI4ivEXT = _link_function('glNamedProgramLocalParametersI4ivEXT', None, [GLuint, GLenum, GLuint, GLsizei, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8096
+glNamedProgramLocalParameterI4uiEXT = _link_function('glNamedProgramLocalParameterI4uiEXT', None, [GLuint, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:8097
+glNamedProgramLocalParameterI4uivEXT = _link_function('glNamedProgramLocalParameterI4uivEXT', None, [GLuint, GLenum, GLuint, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8098
+glNamedProgramLocalParametersI4uivEXT = _link_function('glNamedProgramLocalParametersI4uivEXT', None, [GLuint, GLenum, GLuint, GLsizei, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8099
+glGetNamedProgramLocalParameterIivEXT = _link_function('glGetNamedProgramLocalParameterIivEXT', None, [GLuint, GLenum, GLuint, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8100
+glGetNamedProgramLocalParameterIuivEXT = _link_function('glGetNamedProgramLocalParameterIuivEXT', None, [GLuint, GLenum, GLuint, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8101
+glTextureParameterIivEXT = _link_function('glTextureParameterIivEXT', None, [GLuint, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8102
+glTextureParameterIuivEXT = _link_function('glTextureParameterIuivEXT', None, [GLuint, GLenum, GLenum, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8103
+glGetTextureParameterIivEXT = _link_function('glGetTextureParameterIivEXT', None, [GLuint, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8104
+glGetTextureParameterIuivEXT = _link_function('glGetTextureParameterIuivEXT', None, [GLuint, GLenum, GLenum, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8105
+glMultiTexParameterIivEXT = _link_function('glMultiTexParameterIivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8106
+glMultiTexParameterIuivEXT = _link_function('glMultiTexParameterIuivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8107
+glGetMultiTexParameterIivEXT = _link_function('glGetMultiTexParameterIivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8108
+glGetMultiTexParameterIuivEXT = _link_function('glGetMultiTexParameterIuivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8109
+glProgramUniform1fEXT = _link_function('glProgramUniform1fEXT', None, [GLuint, GLint, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:8110
+glProgramUniform2fEXT = _link_function('glProgramUniform2fEXT', None, [GLuint, GLint, GLfloat, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:8111
+glProgramUniform3fEXT = _link_function('glProgramUniform3fEXT', None, [GLuint, GLint, GLfloat, GLfloat, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:8112
+glProgramUniform4fEXT = _link_function('glProgramUniform4fEXT', None, [GLuint, GLint, GLfloat, GLfloat, GLfloat, GLfloat], 'EXT_direct_state_access')
+
+# GL/glext.h:8113
+glProgramUniform1iEXT = _link_function('glProgramUniform1iEXT', None, [GLuint, GLint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:8114
+glProgramUniform2iEXT = _link_function('glProgramUniform2iEXT', None, [GLuint, GLint, GLint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:8115
+glProgramUniform3iEXT = _link_function('glProgramUniform3iEXT', None, [GLuint, GLint, GLint, GLint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:8116
+glProgramUniform4iEXT = _link_function('glProgramUniform4iEXT', None, [GLuint, GLint, GLint, GLint, GLint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:8117
+glProgramUniform1fvEXT = _link_function('glProgramUniform1fvEXT', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8118
+glProgramUniform2fvEXT = _link_function('glProgramUniform2fvEXT', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8119
+glProgramUniform3fvEXT = _link_function('glProgramUniform3fvEXT', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8120
+glProgramUniform4fvEXT = _link_function('glProgramUniform4fvEXT', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8121
+glProgramUniform1ivEXT = _link_function('glProgramUniform1ivEXT', None, [GLuint, GLint, GLsizei, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8122
+glProgramUniform2ivEXT = _link_function('glProgramUniform2ivEXT', None, [GLuint, GLint, GLsizei, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8123
+glProgramUniform3ivEXT = _link_function('glProgramUniform3ivEXT', None, [GLuint, GLint, GLsizei, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8124
+glProgramUniform4ivEXT = _link_function('glProgramUniform4ivEXT', None, [GLuint, GLint, GLsizei, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8125
+glProgramUniformMatrix2fvEXT = _link_function('glProgramUniformMatrix2fvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8126
+glProgramUniformMatrix3fvEXT = _link_function('glProgramUniformMatrix3fvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8127
+glProgramUniformMatrix4fvEXT = _link_function('glProgramUniformMatrix4fvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8128
+glProgramUniformMatrix2x3fvEXT = _link_function('glProgramUniformMatrix2x3fvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8129
+glProgramUniformMatrix3x2fvEXT = _link_function('glProgramUniformMatrix3x2fvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8130
+glProgramUniformMatrix2x4fvEXT = _link_function('glProgramUniformMatrix2x4fvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8131
+glProgramUniformMatrix4x2fvEXT = _link_function('glProgramUniformMatrix4x2fvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8132
+glProgramUniformMatrix3x4fvEXT = _link_function('glProgramUniformMatrix3x4fvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8133
+glProgramUniformMatrix4x3fvEXT = _link_function('glProgramUniformMatrix4x3fvEXT', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], 'EXT_direct_state_access')
+
+# GL/glext.h:8134
+glProgramUniform1uiEXT = _link_function('glProgramUniform1uiEXT', None, [GLuint, GLint, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:8135
+glProgramUniform2uiEXT = _link_function('glProgramUniform2uiEXT', None, [GLuint, GLint, GLuint, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:8136
+glProgramUniform3uiEXT = _link_function('glProgramUniform3uiEXT', None, [GLuint, GLint, GLuint, GLuint, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:8137
+glProgramUniform4uiEXT = _link_function('glProgramUniform4uiEXT', None, [GLuint, GLint, GLuint, GLuint, GLuint, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:8138
+glProgramUniform1uivEXT = _link_function('glProgramUniform1uivEXT', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8139
+glProgramUniform2uivEXT = _link_function('glProgramUniform2uivEXT', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8140
+glProgramUniform3uivEXT = _link_function('glProgramUniform3uivEXT', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8141
+glProgramUniform4uivEXT = _link_function('glProgramUniform4uivEXT', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8142
+glNamedBufferDataEXT = _link_function('glNamedBufferDataEXT', None, [GLuint, GLsizeiptr, POINTER(GLvoid), GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:8143
+glNamedBufferSubDataEXT = _link_function('glNamedBufferSubDataEXT', None, [GLuint, GLintptr, GLsizeiptr, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8144
+glMapNamedBufferEXT = _link_function('glMapNamedBufferEXT', POINTER(GLvoid), [GLuint, GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:8145
+glUnmapNamedBufferEXT = _link_function('glUnmapNamedBufferEXT', GLboolean, [GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:8146
+glGetNamedBufferParameterivEXT = _link_function('glGetNamedBufferParameterivEXT', None, [GLuint, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8147
+glGetNamedBufferPointervEXT = _link_function('glGetNamedBufferPointervEXT', None, [GLuint, GLenum, POINTER(POINTER(GLvoid))], 'EXT_direct_state_access')
+
+# GL/glext.h:8148
+glGetNamedBufferSubDataEXT = _link_function('glGetNamedBufferSubDataEXT', None, [GLuint, GLintptr, GLsizeiptr, POINTER(GLvoid)], 'EXT_direct_state_access')
+
+# GL/glext.h:8149
+glTextureBufferEXT = _link_function('glTextureBufferEXT', None, [GLuint, GLenum, GLenum, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:8150
+glMultiTexBufferEXT = _link_function('glMultiTexBufferEXT', None, [GLenum, GLenum, GLenum, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:8151
+glNamedRenderbufferStorageEXT = _link_function('glNamedRenderbufferStorageEXT', None, [GLuint, GLenum, GLsizei, GLsizei], 'EXT_direct_state_access')
+
+# GL/glext.h:8152
+glGetNamedRenderbufferParameterivEXT = _link_function('glGetNamedRenderbufferParameterivEXT', None, [GLuint, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8153
+glCheckNamedFramebufferStatusEXT = _link_function('glCheckNamedFramebufferStatusEXT', GLenum, [GLuint, GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:8154
+glNamedFramebufferTexture1DEXT = _link_function('glNamedFramebufferTexture1DEXT', None, [GLuint, GLenum, GLenum, GLuint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:8155
+glNamedFramebufferTexture2DEXT = _link_function('glNamedFramebufferTexture2DEXT', None, [GLuint, GLenum, GLenum, GLuint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:8156
+glNamedFramebufferTexture3DEXT = _link_function('glNamedFramebufferTexture3DEXT', None, [GLuint, GLenum, GLenum, GLuint, GLint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:8157
+glNamedFramebufferRenderbufferEXT = _link_function('glNamedFramebufferRenderbufferEXT', None, [GLuint, GLenum, GLenum, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:8158
+glGetNamedFramebufferAttachmentParameterivEXT = _link_function('glGetNamedFramebufferAttachmentParameterivEXT', None, [GLuint, GLenum, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8159
+glGenerateTextureMipmapEXT = _link_function('glGenerateTextureMipmapEXT', None, [GLuint, GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:8160
+glGenerateMultiTexMipmapEXT = _link_function('glGenerateMultiTexMipmapEXT', None, [GLenum, GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:8161
+glFramebufferDrawBufferEXT = _link_function('glFramebufferDrawBufferEXT', None, [GLuint, GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:8162
+glFramebufferDrawBuffersEXT = _link_function('glFramebufferDrawBuffersEXT', None, [GLuint, GLsizei, POINTER(GLenum)], 'EXT_direct_state_access')
+
+# GL/glext.h:8163
+glFramebufferReadBufferEXT = _link_function('glFramebufferReadBufferEXT', None, [GLuint, GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:8164
+glGetFramebufferParameterivEXT = _link_function('glGetFramebufferParameterivEXT', None, [GLuint, GLenum, POINTER(GLint)], 'EXT_direct_state_access')
+
+# GL/glext.h:8165
+glNamedRenderbufferStorageMultisampleEXT = _link_function('glNamedRenderbufferStorageMultisampleEXT', None, [GLuint, GLsizei, GLenum, GLsizei, GLsizei], 'EXT_direct_state_access')
+
+# GL/glext.h:8166
+glNamedRenderbufferStorageMultisampleCoverageEXT = _link_function('glNamedRenderbufferStorageMultisampleCoverageEXT', None, [GLuint, GLsizei, GLsizei, GLenum, GLsizei, GLsizei], 'EXT_direct_state_access')
+
+# GL/glext.h:8167
+glNamedFramebufferTextureEXT = _link_function('glNamedFramebufferTextureEXT', None, [GLuint, GLenum, GLuint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:8168
+glNamedFramebufferTextureLayerEXT = _link_function('glNamedFramebufferTextureLayerEXT', None, [GLuint, GLenum, GLuint, GLint, GLint], 'EXT_direct_state_access')
+
+# GL/glext.h:8169
+glNamedFramebufferTextureFaceEXT = _link_function('glNamedFramebufferTextureFaceEXT', None, [GLuint, GLenum, GLuint, GLint, GLenum], 'EXT_direct_state_access')
+
+# GL/glext.h:8170
+glTextureRenderbufferEXT = _link_function('glTextureRenderbufferEXT', None, [GLuint, GLenum, GLuint], 'EXT_direct_state_access')
+
+# GL/glext.h:8171
+glMultiTexRenderbufferEXT = _link_function('glMultiTexRenderbufferEXT', None, [GLenum, GLenum, GLuint], 'EXT_direct_state_access')
+
+PFNGLCLIENTATTRIBDEFAULTEXTPROC = CFUNCTYPE(None, GLbitfield) # GL/glext.h:8173
+PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC = CFUNCTYPE(None, GLbitfield) # GL/glext.h:8174
+PFNGLMATRIXLOADFEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:8175
+PFNGLMATRIXLOADDEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:8176
+PFNGLMATRIXMULTFEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:8177
+PFNGLMATRIXMULTDEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:8178
+PFNGLMATRIXLOADIDENTITYEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:8179
+PFNGLMATRIXROTATEFEXTPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:8180
+PFNGLMATRIXROTATEDEXTPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:8181
+PFNGLMATRIXSCALEFEXTPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat, GLfloat) # GL/glext.h:8182
+PFNGLMATRIXSCALEDEXTPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble) # GL/glext.h:8183
+PFNGLMATRIXTRANSLATEFEXTPROC = CFUNCTYPE(None, GLenum, GLfloat, GLfloat, GLfloat) # GL/glext.h:8184
+PFNGLMATRIXTRANSLATEDEXTPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble) # GL/glext.h:8185
+PFNGLMATRIXFRUSTUMEXTPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:8186
+PFNGLMATRIXORTHOEXTPROC = CFUNCTYPE(None, GLenum, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:8187
+PFNGLMATRIXPOPEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:8188
+PFNGLMATRIXPUSHEXTPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:8189
+PFNGLMATRIXLOADTRANSPOSEFEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:8190
+PFNGLMATRIXLOADTRANSPOSEDEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:8191
+PFNGLMATRIXMULTTRANSPOSEFEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLfloat)) # GL/glext.h:8192
+PFNGLMATRIXMULTTRANSPOSEDEXTPROC = CFUNCTYPE(None, GLenum, POINTER(GLdouble)) # GL/glext.h:8193
+PFNGLTEXTUREPARAMETERFEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLfloat) # GL/glext.h:8194
+PFNGLTEXTUREPARAMETERFVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8195
+PFNGLTEXTUREPARAMETERIEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLint) # GL/glext.h:8196
+PFNGLTEXTUREPARAMETERIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8197
+PFNGLTEXTUREIMAGE1DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8198
+PFNGLTEXTUREIMAGE2DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8199
+PFNGLTEXTURESUBIMAGE1DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8200
+PFNGLTEXTURESUBIMAGE2DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8201
+PFNGLCOPYTEXTUREIMAGE1DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint) # GL/glext.h:8202
+PFNGLCOPYTEXTUREIMAGE2DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint) # GL/glext.h:8203
+PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei) # GL/glext.h:8204
+PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) # GL/glext.h:8205
+PFNGLGETTEXTUREIMAGEEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8206
+PFNGLGETTEXTUREPARAMETERFVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8207
+PFNGLGETTEXTUREPARAMETERIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8208
+PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, POINTER(GLfloat)) # GL/glext.h:8209
+PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, POINTER(GLint)) # GL/glext.h:8210
+PFNGLTEXTUREIMAGE3DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8211
+PFNGLTEXTURESUBIMAGE3DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8212
+PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) # GL/glext.h:8213
+PFNGLMULTITEXPARAMETERFEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLfloat) # GL/glext.h:8214
+PFNGLMULTITEXPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8215
+PFNGLMULTITEXPARAMETERIEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLint) # GL/glext.h:8216
+PFNGLMULTITEXPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8217
+PFNGLMULTITEXIMAGE1DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8218
+PFNGLMULTITEXIMAGE2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8219
+PFNGLMULTITEXSUBIMAGE1DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8220
+PFNGLMULTITEXSUBIMAGE2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8221
+PFNGLCOPYMULTITEXIMAGE1DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint) # GL/glext.h:8222
+PFNGLCOPYMULTITEXIMAGE2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint) # GL/glext.h:8223
+PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei) # GL/glext.h:8224
+PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) # GL/glext.h:8225
+PFNGLGETMULTITEXIMAGEEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8226
+PFNGLGETMULTITEXPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8227
+PFNGLGETMULTITEXPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8228
+PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, POINTER(GLfloat)) # GL/glext.h:8229
+PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, POINTER(GLint)) # GL/glext.h:8230
+PFNGLMULTITEXIMAGE3DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8231
+PFNGLMULTITEXSUBIMAGE3DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8232
+PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) # GL/glext.h:8233
+PFNGLBINDMULTITEXTUREEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint) # GL/glext.h:8234
+PFNGLENABLECLIENTSTATEINDEXEDEXTPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:8235
+PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:8236
+PFNGLMULTITEXCOORDPOINTEREXTPROC = CFUNCTYPE(None, GLenum, GLint, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:8237
+PFNGLMULTITEXENVFEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLfloat) # GL/glext.h:8238
+PFNGLMULTITEXENVFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8239
+PFNGLMULTITEXENVIEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLint) # GL/glext.h:8240
+PFNGLMULTITEXENVIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8241
+PFNGLMULTITEXGENDEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLdouble) # GL/glext.h:8242
+PFNGLMULTITEXGENDVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLdouble)) # GL/glext.h:8243
+PFNGLMULTITEXGENFEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLfloat) # GL/glext.h:8244
+PFNGLMULTITEXGENFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8245
+PFNGLMULTITEXGENIEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLint) # GL/glext.h:8246
+PFNGLMULTITEXGENIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8247
+PFNGLGETMULTITEXENVFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8248
+PFNGLGETMULTITEXENVIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8249
+PFNGLGETMULTITEXGENDVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLdouble)) # GL/glext.h:8250
+PFNGLGETMULTITEXGENFVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLfloat)) # GL/glext.h:8251
+PFNGLGETMULTITEXGENIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8252
+PFNGLGETFLOATINDEXEDVEXTPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:8253
+PFNGLGETDOUBLEINDEXEDVEXTPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLdouble)) # GL/glext.h:8254
+PFNGLGETPOINTERINDEXEDVEXTPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(POINTER(GLvoid))) # GL/glext.h:8255
+PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # GL/glext.h:8256
+PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # GL/glext.h:8257
+PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # GL/glext.h:8258
+PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:8259
+PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:8260
+PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:8261
+PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLint, POINTER(GLvoid)) # GL/glext.h:8262
+PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # GL/glext.h:8263
+PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # GL/glext.h:8264
+PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, POINTER(GLvoid)) # GL/glext.h:8265
+PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:8266
+PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:8267
+PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:8268
+PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLint, POINTER(GLvoid)) # GL/glext.h:8269
+PFNGLNAMEDPROGRAMSTRINGEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLsizei, POINTER(GLvoid)) # GL/glext.h:8270
+PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble) # GL/glext.h:8271
+PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, POINTER(GLdouble)) # GL/glext.h:8272
+PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:8273
+PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:8274
+PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, POINTER(GLdouble)) # GL/glext.h:8275
+PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:8276
+PFNGLGETNAMEDPROGRAMIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8277
+PFNGLGETNAMEDPROGRAMSTRINGEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLvoid)) # GL/glext.h:8278
+PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLsizei, POINTER(GLfloat)) # GL/glext.h:8279
+PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLint, GLint, GLint, GLint) # GL/glext.h:8280
+PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, POINTER(GLint)) # GL/glext.h:8281
+PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLsizei, POINTER(GLint)) # GL/glext.h:8282
+PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:8283
+PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, POINTER(GLuint)) # GL/glext.h:8284
+PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLsizei, POINTER(GLuint)) # GL/glext.h:8285
+PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, POINTER(GLint)) # GL/glext.h:8286
+PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, POINTER(GLuint)) # GL/glext.h:8287
+PFNGLTEXTUREPARAMETERIIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8288
+PFNGLTEXTUREPARAMETERIUIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:8289
+PFNGLGETTEXTUREPARAMETERIIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8290
+PFNGLGETTEXTUREPARAMETERIUIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:8291
+PFNGLMULTITEXPARAMETERIIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8292
+PFNGLMULTITEXPARAMETERIUIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:8293
+PFNGLGETMULTITEXPARAMETERIIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8294
+PFNGLGETMULTITEXPARAMETERIUIVEXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, POINTER(GLuint)) # GL/glext.h:8295
+PFNGLPROGRAMUNIFORM1FEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLfloat) # GL/glext.h:8296
+PFNGLPROGRAMUNIFORM2FEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLfloat, GLfloat) # GL/glext.h:8297
+PFNGLPROGRAMUNIFORM3FEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLfloat, GLfloat, GLfloat) # GL/glext.h:8298
+PFNGLPROGRAMUNIFORM4FEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLfloat, GLfloat, GLfloat, GLfloat) # GL/glext.h:8299
+PFNGLPROGRAMUNIFORM1IEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLint) # GL/glext.h:8300
+PFNGLPROGRAMUNIFORM2IEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLint, GLint) # GL/glext.h:8301
+PFNGLPROGRAMUNIFORM3IEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLint, GLint, GLint) # GL/glext.h:8302
+PFNGLPROGRAMUNIFORM4IEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLint, GLint, GLint, GLint) # GL/glext.h:8303
+PFNGLPROGRAMUNIFORM1FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:8304
+PFNGLPROGRAMUNIFORM2FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:8305
+PFNGLPROGRAMUNIFORM3FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:8306
+PFNGLPROGRAMUNIFORM4FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLfloat)) # GL/glext.h:8307
+PFNGLPROGRAMUNIFORM1IVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:8308
+PFNGLPROGRAMUNIFORM2IVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:8309
+PFNGLPROGRAMUNIFORM3IVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:8310
+PFNGLPROGRAMUNIFORM4IVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLint)) # GL/glext.h:8311
+PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:8312
+PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:8313
+PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:8314
+PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:8315
+PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:8316
+PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:8317
+PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:8318
+PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:8319
+PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)) # GL/glext.h:8320
+PFNGLPROGRAMUNIFORM1UIEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLuint) # GL/glext.h:8321
+PFNGLPROGRAMUNIFORM2UIEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLuint, GLuint) # GL/glext.h:8322
+PFNGLPROGRAMUNIFORM3UIEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLuint, GLuint, GLuint) # GL/glext.h:8323
+PFNGLPROGRAMUNIFORM4UIEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLuint, GLuint, GLuint, GLuint) # GL/glext.h:8324
+PFNGLPROGRAMUNIFORM1UIVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:8325
+PFNGLPROGRAMUNIFORM2UIVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:8326
+PFNGLPROGRAMUNIFORM3UIVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:8327
+PFNGLPROGRAMUNIFORM4UIVEXTPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint)) # GL/glext.h:8328
+PFNGLNAMEDBUFFERDATAEXTPROC = CFUNCTYPE(None, GLuint, GLsizeiptr, POINTER(GLvoid), GLenum) # GL/glext.h:8329
+PFNGLNAMEDBUFFERSUBDATAEXTPROC = CFUNCTYPE(None, GLuint, GLintptr, GLsizeiptr, POINTER(GLvoid)) # GL/glext.h:8330
+PFNGLMAPNAMEDBUFFEREXTPROC = CFUNCTYPE(POINTER(GLvoid), GLuint, GLenum) # GL/glext.h:8331
+PFNGLUNMAPNAMEDBUFFEREXTPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:8332
+PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:8333
+PFNGLGETNAMEDBUFFERPOINTERVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(POINTER(GLvoid))) # GL/glext.h:8334
+PFNGLGETNAMEDBUFFERSUBDATAEXTPROC = CFUNCTYPE(None, GLuint, GLintptr, GLsizeiptr, POINTER(GLvoid)) # GL/glext.h:8335
+PFNGLTEXTUREBUFFEREXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLuint) # GL/glext.h:8336
+PFNGLMULTITEXBUFFEREXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLenum, GLuint) # GL/glext.h:8337
+PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLsizei, GLsizei) # GL/glext.h:8338
+PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:8339
+PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC = CFUNCTYPE(GLenum, GLuint, GLenum) # GL/glext.h:8340
+PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLuint, GLint) # GL/glext.h:8341
+PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLuint, GLint) # GL/glext.h:8342
+PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLuint, GLint, GLint) # GL/glext.h:8343
+PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, GLuint) # GL/glext.h:8344
+PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLenum, POINTER(GLint)) # GL/glext.h:8345
+PFNGLGENERATETEXTUREMIPMAPEXTPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:8346
+PFNGLGENERATEMULTITEXMIPMAPEXTPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:8347
+PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:8348
+PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC = CFUNCTYPE(None, GLuint, GLsizei, POINTER(GLenum)) # GL/glext.h:8349
+PFNGLFRAMEBUFFERREADBUFFEREXTPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:8350
+PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLint)) # GL/glext.h:8351
+PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC = CFUNCTYPE(None, GLuint, GLsizei, GLenum, GLsizei, GLsizei) # GL/glext.h:8352
+PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC = CFUNCTYPE(None, GLuint, GLsizei, GLsizei, GLenum, GLsizei, GLsizei) # GL/glext.h:8353
+PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLint) # GL/glext.h:8354
+PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLint, GLint) # GL/glext.h:8355
+PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint, GLint, GLenum) # GL/glext.h:8356
+PFNGLTEXTURERENDERBUFFEREXTPROC = CFUNCTYPE(None, GLuint, GLenum, GLuint) # GL/glext.h:8357
+PFNGLMULTITEXRENDERBUFFEREXTPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint) # GL/glext.h:8358
+# EXT_vertex_array_bgra (GL/glext.h:8361)
+GL_EXT_vertex_array_bgra = 1 # GL/glext.h:8362
+# EXT_texture_swizzle (GL/glext.h:8365)
+GL_EXT_texture_swizzle = 1 # GL/glext.h:8366
+# NV_explicit_multisample (GL/glext.h:8369)
+GL_NV_explicit_multisample = 1 # GL/glext.h:8370
+# GL/glext.h:8372
+glGetMultisamplefvNV = _link_function('glGetMultisamplefvNV', None, [GLenum, GLuint, POINTER(GLfloat)], 'NV_explicit_multisample')
+
+# GL/glext.h:8373
+glSampleMaskIndexedNV = _link_function('glSampleMaskIndexedNV', None, [GLuint, GLbitfield], 'NV_explicit_multisample')
+
+# GL/glext.h:8374
+glTexRenderbufferNV = _link_function('glTexRenderbufferNV', None, [GLenum, GLuint], 'NV_explicit_multisample')
+
+PFNGLGETMULTISAMPLEFVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:8376
+PFNGLSAMPLEMASKINDEXEDNVPROC = CFUNCTYPE(None, GLuint, GLbitfield) # GL/glext.h:8377
+PFNGLTEXRENDERBUFFERNVPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:8378
+# NV_transform_feedback2 (GL/glext.h:8381)
+GL_NV_transform_feedback2 = 1 # GL/glext.h:8382
+# GL/glext.h:8384
+glBindTransformFeedbackNV = _link_function('glBindTransformFeedbackNV', None, [GLenum, GLuint], 'NV_transform_feedback2')
+
+# GL/glext.h:8385
+glDeleteTransformFeedbacksNV = _link_function('glDeleteTransformFeedbacksNV', None, [GLsizei, POINTER(GLuint)], 'NV_transform_feedback2')
+
+# GL/glext.h:8386
+glGenTransformFeedbacksNV = _link_function('glGenTransformFeedbacksNV', None, [GLsizei, POINTER(GLuint)], 'NV_transform_feedback2')
+
+# GL/glext.h:8387
+glIsTransformFeedbackNV = _link_function('glIsTransformFeedbackNV', GLboolean, [GLuint], 'NV_transform_feedback2')
+
+# GL/glext.h:8388
+glPauseTransformFeedbackNV = _link_function('glPauseTransformFeedbackNV', None, [], 'NV_transform_feedback2')
+
+# GL/glext.h:8389
+glResumeTransformFeedbackNV = _link_function('glResumeTransformFeedbackNV', None, [], 'NV_transform_feedback2')
+
+# GL/glext.h:8390
+glDrawTransformFeedbackNV = _link_function('glDrawTransformFeedbackNV', None, [GLenum, GLuint], 'NV_transform_feedback2')
+
+PFNGLBINDTRANSFORMFEEDBACKNVPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:8392
+PFNGLDELETETRANSFORMFEEDBACKSNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:8393
+PFNGLGENTRANSFORMFEEDBACKSNVPROC = CFUNCTYPE(None, GLsizei, POINTER(GLuint)) # GL/glext.h:8394
+PFNGLISTRANSFORMFEEDBACKNVPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:8395
+PFNGLPAUSETRANSFORMFEEDBACKNVPROC = CFUNCTYPE(None) # GL/glext.h:8396
+PFNGLRESUMETRANSFORMFEEDBACKNVPROC = CFUNCTYPE(None) # GL/glext.h:8397
+PFNGLDRAWTRANSFORMFEEDBACKNVPROC = CFUNCTYPE(None, GLenum, GLuint) # GL/glext.h:8398
+# NV_vertex_buffer_unified_memory (GL/glext.h:8401)
+GL_NV_vertex_buffer_unified_memory = 1 # GL/glext.h:8402
+# GL/glext.h:8404
+glBufferAddressRangeNV = _link_function('glBufferAddressRangeNV', None, [GLenum, GLuint, GLuint64EXT, GLsizeiptr], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:8405
+glVertexFormatNV = _link_function('glVertexFormatNV', None, [GLint, GLenum, GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:8406
+glNormalFormatNV = _link_function('glNormalFormatNV', None, [GLenum, GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:8407
+glColorFormatNV = _link_function('glColorFormatNV', None, [GLint, GLenum, GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:8408
+glIndexFormatNV = _link_function('glIndexFormatNV', None, [GLenum, GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:8409
+glTexCoordFormatNV = _link_function('glTexCoordFormatNV', None, [GLint, GLenum, GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:8410
+glEdgeFlagFormatNV = _link_function('glEdgeFlagFormatNV', None, [GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:8411
+glSecondaryColorFormatNV = _link_function('glSecondaryColorFormatNV', None, [GLint, GLenum, GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:8412
+glFogCoordFormatNV = _link_function('glFogCoordFormatNV', None, [GLenum, GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:8413
+glVertexAttribFormatNV = _link_function('glVertexAttribFormatNV', None, [GLuint, GLint, GLenum, GLboolean, GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:8414
+glVertexAttribIFormatNV = _link_function('glVertexAttribIFormatNV', None, [GLuint, GLint, GLenum, GLsizei], 'NV_vertex_buffer_unified_memory')
+
+# GL/glext.h:8415
+glGetIntegerui64i_vNV = _link_function('glGetIntegerui64i_vNV', None, [GLenum, GLuint, POINTER(GLuint64EXT)], 'NV_vertex_buffer_unified_memory')
+
+PFNGLBUFFERADDRESSRANGENVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint64EXT, GLsizeiptr) # GL/glext.h:8417
+PFNGLVERTEXFORMATNVPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei) # GL/glext.h:8418
+PFNGLNORMALFORMATNVPROC = CFUNCTYPE(None, GLenum, GLsizei) # GL/glext.h:8419
+PFNGLCOLORFORMATNVPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei) # GL/glext.h:8420
+PFNGLINDEXFORMATNVPROC = CFUNCTYPE(None, GLenum, GLsizei) # GL/glext.h:8421
+PFNGLTEXCOORDFORMATNVPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei) # GL/glext.h:8422
+PFNGLEDGEFLAGFORMATNVPROC = CFUNCTYPE(None, GLsizei) # GL/glext.h:8423
+PFNGLSECONDARYCOLORFORMATNVPROC = CFUNCTYPE(None, GLint, GLenum, GLsizei) # GL/glext.h:8424
+PFNGLFOGCOORDFORMATNVPROC = CFUNCTYPE(None, GLenum, GLsizei) # GL/glext.h:8425
+PFNGLVERTEXATTRIBFORMATNVPROC = CFUNCTYPE(None, GLuint, GLint, GLenum, GLboolean, GLsizei) # GL/glext.h:8426
+PFNGLVERTEXATTRIBIFORMATNVPROC = CFUNCTYPE(None, GLuint, GLint, GLenum, GLsizei) # GL/glext.h:8427
+PFNGLGETINTEGERUI64I_VNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLuint64EXT)) # GL/glext.h:8428
+# NV_shader_buffer_load (GL/glext.h:8432)
+GL_NV_shader_buffer_load = 1 # GL/glext.h:8433
+# GL/glext.h:8435
+glGetBufferParameterui64vNV = _link_function('glGetBufferParameterui64vNV', None, [GLenum, GLenum, POINTER(GLuint64EXT)], 'NV_shader_buffer_load')
+
+# GL/glext.h:8436
+glGetIntegerui64vNV = _link_function('glGetIntegerui64vNV', None, [GLenum, POINTER(GLuint64EXT)], 'NV_shader_buffer_load')
+
+# GL/glext.h:8437
+glGetNamedBufferParameterui64vNV = _link_function('glGetNamedBufferParameterui64vNV', None, [GLuint, GLenum, POINTER(GLuint64EXT)], 'NV_shader_buffer_load')
+
+# GL/glext.h:8438
+glIsBufferResidentNV = _link_function('glIsBufferResidentNV', GLboolean, [GLenum], 'NV_shader_buffer_load')
+
+# GL/glext.h:8439
+glIsNamedBufferResidentNV = _link_function('glIsNamedBufferResidentNV', GLboolean, [GLuint], 'NV_shader_buffer_load')
+
+# GL/glext.h:8440
+glMakeBufferNonResidentNV = _link_function('glMakeBufferNonResidentNV', None, [GLenum], 'NV_shader_buffer_load')
+
+# GL/glext.h:8441
+glMakeBufferResidentNV = _link_function('glMakeBufferResidentNV', None, [GLenum, GLenum], 'NV_shader_buffer_load')
+
+# GL/glext.h:8442
+glMakeNamedBufferNonResidentNV = _link_function('glMakeNamedBufferNonResidentNV', None, [GLuint], 'NV_shader_buffer_load')
+
+# GL/glext.h:8443
+glMakeNamedBufferResidentNV = _link_function('glMakeNamedBufferResidentNV', None, [GLuint, GLenum], 'NV_shader_buffer_load')
+
+# GL/glext.h:8444
+glUniformui64NV = _link_function('glUniformui64NV', None, [GLint, GLuint64EXT], 'NV_shader_buffer_load')
+
+# GL/glext.h:8445
+glUniformui64vNV = _link_function('glUniformui64vNV', None, [GLint, GLsizei, POINTER(GLuint64EXT)], 'NV_shader_buffer_load')
+
+# GL/glext.h:8446
+glGetUniformui64vNV = _link_function('glGetUniformui64vNV', None, [GLuint, GLint, POINTER(GLuint64EXT)], 'NV_shader_buffer_load')
+
+# GL/glext.h:8447
+glProgramUniformui64NV = _link_function('glProgramUniformui64NV', None, [GLuint, GLint, GLuint64EXT], 'NV_shader_buffer_load')
+
+# GL/glext.h:8448
+glProgramUniformui64vNV = _link_function('glProgramUniformui64vNV', None, [GLuint, GLint, GLsizei, POINTER(GLuint64EXT)], 'NV_shader_buffer_load')
+
+PFNGLGETBUFFERPARAMETERUI64VNVPROC = CFUNCTYPE(None, GLenum, GLenum, POINTER(GLuint64EXT)) # GL/glext.h:8450
+PFNGLGETINTEGERUI64VNVPROC = CFUNCTYPE(None, GLenum, POINTER(GLuint64EXT)) # GL/glext.h:8451
+PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC = CFUNCTYPE(None, GLuint, GLenum, POINTER(GLuint64EXT)) # GL/glext.h:8452
+PFNGLISBUFFERRESIDENTNVPROC = CFUNCTYPE(GLboolean, GLenum) # GL/glext.h:8453
+PFNGLISNAMEDBUFFERRESIDENTNVPROC = CFUNCTYPE(GLboolean, GLuint) # GL/glext.h:8454
+PFNGLMAKEBUFFERNONRESIDENTNVPROC = CFUNCTYPE(None, GLenum) # GL/glext.h:8455
+PFNGLMAKEBUFFERRESIDENTNVPROC = CFUNCTYPE(None, GLenum, GLenum) # GL/glext.h:8456
+PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC = CFUNCTYPE(None, GLuint) # GL/glext.h:8457
+PFNGLMAKENAMEDBUFFERRESIDENTNVPROC = CFUNCTYPE(None, GLuint, GLenum) # GL/glext.h:8458
+PFNGLUNIFORMUI64NVPROC = CFUNCTYPE(None, GLint, GLuint64EXT) # GL/glext.h:8459
+PFNGLUNIFORMUI64VNVPROC = CFUNCTYPE(None, GLint, GLsizei, POINTER(GLuint64EXT)) # GL/glext.h:8460
+PFNGLGETUNIFORMUI64VNVPROC = CFUNCTYPE(None, GLuint, GLint, POINTER(GLuint64EXT)) # GL/glext.h:8461
+PFNGLPROGRAMUNIFORMUI64NVPROC = CFUNCTYPE(None, GLuint, GLint, GLuint64EXT) # GL/glext.h:8462
+PFNGLPROGRAMUNIFORMUI64VNVPROC = CFUNCTYPE(None, GLuint, GLint, GLsizei, POINTER(GLuint64EXT)) # GL/glext.h:8463
+# MESA_shader_debug (/usr/include/GL/gl.h:2093)
+# MESA_packed_depth_stencil (/usr/include/GL/gl.h:2115)
+# MESA_program_debug (/usr/include/GL/gl.h:2127)
+# MESA_texture_array (/usr/include/GL/gl.h:2148)
+# EXT_texture_array (/usr/include/GL/gl.h:2153)
+# ATI_blend_equation_separate (/usr/include/GL/gl.h:2181)
+# OES_EGL_image (/usr/include/GL/gl.h:2193)
+# OES_EGL_image (/usr/include/GL/gl.h:2197)
+
+__all__ = ['GL_GLEXT_VERSION', 'GL_BLEND_DST_RGB', 'GL_BLEND_SRC_RGB',
+'GL_BLEND_DST_ALPHA', 'GL_BLEND_SRC_ALPHA', 'GL_POINT_SIZE_MIN',
+'GL_POINT_SIZE_MAX', 'GL_POINT_FADE_THRESHOLD_SIZE',
+'GL_POINT_DISTANCE_ATTENUATION', 'GL_GENERATE_MIPMAP',
+'GL_GENERATE_MIPMAP_HINT', 'GL_DEPTH_COMPONENT16', 'GL_DEPTH_COMPONENT24',
+'GL_DEPTH_COMPONENT32', 'GL_MIRRORED_REPEAT', 'GL_FOG_COORDINATE_SOURCE',
+'GL_FOG_COORDINATE', 'GL_FRAGMENT_DEPTH', 'GL_CURRENT_FOG_COORDINATE',
+'GL_FOG_COORDINATE_ARRAY_TYPE', 'GL_FOG_COORDINATE_ARRAY_STRIDE',
+'GL_FOG_COORDINATE_ARRAY_POINTER', 'GL_FOG_COORDINATE_ARRAY', 'GL_COLOR_SUM',
+'GL_CURRENT_SECONDARY_COLOR', 'GL_SECONDARY_COLOR_ARRAY_SIZE',
+'GL_SECONDARY_COLOR_ARRAY_TYPE', 'GL_SECONDARY_COLOR_ARRAY_STRIDE',
+'GL_SECONDARY_COLOR_ARRAY_POINTER', 'GL_SECONDARY_COLOR_ARRAY',
+'GL_MAX_TEXTURE_LOD_BIAS', 'GL_TEXTURE_FILTER_CONTROL', 'GL_TEXTURE_LOD_BIAS',
+'GL_INCR_WRAP', 'GL_DECR_WRAP', 'GL_TEXTURE_DEPTH_SIZE',
+'GL_DEPTH_TEXTURE_MODE', 'GL_TEXTURE_COMPARE_MODE', 'GL_TEXTURE_COMPARE_FUNC',
+'GL_COMPARE_R_TO_TEXTURE', 'GL_BUFFER_SIZE', 'GL_BUFFER_USAGE',
+'GL_QUERY_COUNTER_BITS', 'GL_CURRENT_QUERY', 'GL_QUERY_RESULT',
+'GL_QUERY_RESULT_AVAILABLE', 'GL_ARRAY_BUFFER', 'GL_ELEMENT_ARRAY_BUFFER',
+'GL_ARRAY_BUFFER_BINDING', 'GL_ELEMENT_ARRAY_BUFFER_BINDING',
+'GL_VERTEX_ARRAY_BUFFER_BINDING', 'GL_NORMAL_ARRAY_BUFFER_BINDING',
+'GL_COLOR_ARRAY_BUFFER_BINDING', 'GL_INDEX_ARRAY_BUFFER_BINDING',
+'GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING', 'GL_EDGE_FLAG_ARRAY_BUFFER_BINDING',
+'GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING',
+'GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING', 'GL_WEIGHT_ARRAY_BUFFER_BINDING',
+'GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING', 'GL_READ_ONLY', 'GL_WRITE_ONLY',
+'GL_READ_WRITE', 'GL_BUFFER_ACCESS', 'GL_BUFFER_MAPPED',
+'GL_BUFFER_MAP_POINTER', 'GL_STREAM_DRAW', 'GL_STREAM_READ', 'GL_STREAM_COPY',
+'GL_STATIC_DRAW', 'GL_STATIC_READ', 'GL_STATIC_COPY', 'GL_DYNAMIC_DRAW',
+'GL_DYNAMIC_READ', 'GL_DYNAMIC_COPY', 'GL_SAMPLES_PASSED', 'GL_FOG_COORD_SRC',
+'GL_FOG_COORD', 'GL_CURRENT_FOG_COORD', 'GL_FOG_COORD_ARRAY_TYPE',
+'GL_FOG_COORD_ARRAY_STRIDE', 'GL_FOG_COORD_ARRAY_POINTER',
+'GL_FOG_COORD_ARRAY', 'GL_FOG_COORD_ARRAY_BUFFER_BINDING', 'GL_SRC0_RGB',
+'GL_SRC1_RGB', 'GL_SRC2_RGB', 'GL_SRC0_ALPHA', 'GL_SRC1_ALPHA',
+'GL_SRC2_ALPHA', 'GL_BLEND_EQUATION_RGB', 'GL_VERTEX_ATTRIB_ARRAY_ENABLED',
+'GL_VERTEX_ATTRIB_ARRAY_SIZE', 'GL_VERTEX_ATTRIB_ARRAY_STRIDE',
+'GL_VERTEX_ATTRIB_ARRAY_TYPE', 'GL_CURRENT_VERTEX_ATTRIB',
+'GL_VERTEX_PROGRAM_POINT_SIZE', 'GL_VERTEX_PROGRAM_TWO_SIDE',
+'GL_VERTEX_ATTRIB_ARRAY_POINTER', 'GL_STENCIL_BACK_FUNC',
+'GL_STENCIL_BACK_FAIL', 'GL_STENCIL_BACK_PASS_DEPTH_FAIL',
+'GL_STENCIL_BACK_PASS_DEPTH_PASS', 'GL_MAX_DRAW_BUFFERS', 'GL_DRAW_BUFFER0',
+'GL_DRAW_BUFFER1', 'GL_DRAW_BUFFER2', 'GL_DRAW_BUFFER3', 'GL_DRAW_BUFFER4',
+'GL_DRAW_BUFFER5', 'GL_DRAW_BUFFER6', 'GL_DRAW_BUFFER7', 'GL_DRAW_BUFFER8',
+'GL_DRAW_BUFFER9', 'GL_DRAW_BUFFER10', 'GL_DRAW_BUFFER11', 'GL_DRAW_BUFFER12',
+'GL_DRAW_BUFFER13', 'GL_DRAW_BUFFER14', 'GL_DRAW_BUFFER15',
+'GL_BLEND_EQUATION_ALPHA', 'GL_POINT_SPRITE', 'GL_COORD_REPLACE',
+'GL_MAX_VERTEX_ATTRIBS', 'GL_VERTEX_ATTRIB_ARRAY_NORMALIZED',
+'GL_MAX_TEXTURE_COORDS', 'GL_MAX_TEXTURE_IMAGE_UNITS', 'GL_FRAGMENT_SHADER',
+'GL_VERTEX_SHADER', 'GL_MAX_FRAGMENT_UNIFORM_COMPONENTS',
+'GL_MAX_VERTEX_UNIFORM_COMPONENTS', 'GL_MAX_VARYING_FLOATS',
+'GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS', 'GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS',
+'GL_SHADER_TYPE', 'GL_FLOAT_VEC2', 'GL_FLOAT_VEC3', 'GL_FLOAT_VEC4',
+'GL_INT_VEC2', 'GL_INT_VEC3', 'GL_INT_VEC4', 'GL_BOOL', 'GL_BOOL_VEC2',
+'GL_BOOL_VEC3', 'GL_BOOL_VEC4', 'GL_FLOAT_MAT2', 'GL_FLOAT_MAT3',
+'GL_FLOAT_MAT4', 'GL_SAMPLER_1D', 'GL_SAMPLER_2D', 'GL_SAMPLER_3D',
+'GL_SAMPLER_CUBE', 'GL_SAMPLER_1D_SHADOW', 'GL_SAMPLER_2D_SHADOW',
+'GL_DELETE_STATUS', 'GL_COMPILE_STATUS', 'GL_LINK_STATUS',
+'GL_VALIDATE_STATUS', 'GL_INFO_LOG_LENGTH', 'GL_ATTACHED_SHADERS',
+'GL_ACTIVE_UNIFORMS', 'GL_ACTIVE_UNIFORM_MAX_LENGTH',
+'GL_SHADER_SOURCE_LENGTH', 'GL_ACTIVE_ATTRIBUTES',
+'GL_ACTIVE_ATTRIBUTE_MAX_LENGTH', 'GL_FRAGMENT_SHADER_DERIVATIVE_HINT',
+'GL_SHADING_LANGUAGE_VERSION', 'GL_CURRENT_PROGRAM',
+'GL_POINT_SPRITE_COORD_ORIGIN', 'GL_LOWER_LEFT', 'GL_UPPER_LEFT',
+'GL_STENCIL_BACK_REF', 'GL_STENCIL_BACK_VALUE_MASK',
+'GL_STENCIL_BACK_WRITEMASK', 'GL_PIXEL_PACK_BUFFER', 'GL_PIXEL_UNPACK_BUFFER',
+'GL_PIXEL_PACK_BUFFER_BINDING', 'GL_PIXEL_UNPACK_BUFFER_BINDING', 'GL_SRGB',
+'GL_SRGB8', 'GL_SRGB_ALPHA', 'GL_SRGB8_ALPHA8', 'GL_SLUMINANCE_ALPHA',
+'GL_SLUMINANCE8_ALPHA8', 'GL_SLUMINANCE', 'GL_SLUMINANCE8',
+'GL_COMPRESSED_SRGB', 'GL_COMPRESSED_SRGB_ALPHA', 'GL_COMPRESSED_SLUMINANCE',
+'GL_COMPRESSED_SLUMINANCE_ALPHA', 'GL_FLOAT_MAT2x3', 'GL_FLOAT_MAT2x4',
+'GL_FLOAT_MAT3x2', 'GL_FLOAT_MAT3x4', 'GL_FLOAT_MAT4x2', 'GL_FLOAT_MAT4x3',
+'GL_CURRENT_RASTER_SECONDARY_COLOR', 'GL_CLIP_DISTANCE0', 'GL_CLIP_DISTANCE1',
+'GL_CLIP_DISTANCE2', 'GL_CLIP_DISTANCE3', 'GL_CLIP_DISTANCE4',
+'GL_CLIP_DISTANCE5', 'GL_MAX_CLIP_DISTANCES', 'GL_MAJOR_VERSION',
+'GL_MINOR_VERSION', 'GL_NUM_EXTENSIONS', 'GL_CONTEXT_FLAGS',
+'GL_DEPTH_BUFFER', 'GL_STENCIL_BUFFER', 'GL_COMPRESSED_RED',
+'GL_COMPRESSED_RG', 'GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT', 'GL_RGBA32F',
+'GL_RGB32F', 'GL_RGBA16F', 'GL_RGB16F', 'GL_VERTEX_ATTRIB_ARRAY_INTEGER',
+'GL_MAX_ARRAY_TEXTURE_LAYERS', 'GL_MIN_PROGRAM_TEXEL_OFFSET',
+'GL_MAX_PROGRAM_TEXEL_OFFSET', 'GL_CLAMP_VERTEX_COLOR',
+'GL_CLAMP_FRAGMENT_COLOR', 'GL_CLAMP_READ_COLOR', 'GL_FIXED_ONLY',
+'GL_MAX_VARYING_COMPONENTS', 'GL_TEXTURE_RED_TYPE', 'GL_TEXTURE_GREEN_TYPE',
+'GL_TEXTURE_BLUE_TYPE', 'GL_TEXTURE_ALPHA_TYPE', 'GL_TEXTURE_LUMINANCE_TYPE',
+'GL_TEXTURE_INTENSITY_TYPE', 'GL_TEXTURE_DEPTH_TYPE',
+'GL_UNSIGNED_NORMALIZED', 'GL_TEXTURE_1D_ARRAY', 'GL_PROXY_TEXTURE_1D_ARRAY',
+'GL_TEXTURE_2D_ARRAY', 'GL_PROXY_TEXTURE_2D_ARRAY',
+'GL_TEXTURE_BINDING_1D_ARRAY', 'GL_TEXTURE_BINDING_2D_ARRAY',
+'GL_R11F_G11F_B10F', 'GL_UNSIGNED_INT_10F_11F_11F_REV', 'GL_RGB9_E5',
+'GL_UNSIGNED_INT_5_9_9_9_REV', 'GL_TEXTURE_SHARED_SIZE',
+'GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH',
+'GL_TRANSFORM_FEEDBACK_BUFFER_MODE',
+'GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS',
+'GL_TRANSFORM_FEEDBACK_VARYINGS', 'GL_TRANSFORM_FEEDBACK_BUFFER_START',
+'GL_TRANSFORM_FEEDBACK_BUFFER_SIZE', 'GL_PRIMITIVES_GENERATED',
+'GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN', 'GL_RASTERIZER_DISCARD',
+'GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS',
+'GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS', 'GL_INTERLEAVED_ATTRIBS',
+'GL_SEPARATE_ATTRIBS', 'GL_TRANSFORM_FEEDBACK_BUFFER',
+'GL_TRANSFORM_FEEDBACK_BUFFER_BINDING', 'GL_RGBA32UI', 'GL_RGB32UI',
+'GL_RGBA16UI', 'GL_RGB16UI', 'GL_RGBA8UI', 'GL_RGB8UI', 'GL_RGBA32I',
+'GL_RGB32I', 'GL_RGBA16I', 'GL_RGB16I', 'GL_RGBA8I', 'GL_RGB8I',
+'GL_RED_INTEGER', 'GL_GREEN_INTEGER', 'GL_BLUE_INTEGER', 'GL_ALPHA_INTEGER',
+'GL_RGB_INTEGER', 'GL_RGBA_INTEGER', 'GL_BGR_INTEGER', 'GL_BGRA_INTEGER',
+'GL_SAMPLER_1D_ARRAY', 'GL_SAMPLER_2D_ARRAY', 'GL_SAMPLER_1D_ARRAY_SHADOW',
+'GL_SAMPLER_2D_ARRAY_SHADOW', 'GL_SAMPLER_CUBE_SHADOW',
+'GL_UNSIGNED_INT_VEC2', 'GL_UNSIGNED_INT_VEC3', 'GL_UNSIGNED_INT_VEC4',
+'GL_INT_SAMPLER_1D', 'GL_INT_SAMPLER_2D', 'GL_INT_SAMPLER_3D',
+'GL_INT_SAMPLER_CUBE', 'GL_INT_SAMPLER_1D_ARRAY', 'GL_INT_SAMPLER_2D_ARRAY',
+'GL_UNSIGNED_INT_SAMPLER_1D', 'GL_UNSIGNED_INT_SAMPLER_2D',
+'GL_UNSIGNED_INT_SAMPLER_3D', 'GL_UNSIGNED_INT_SAMPLER_CUBE',
+'GL_UNSIGNED_INT_SAMPLER_1D_ARRAY', 'GL_UNSIGNED_INT_SAMPLER_2D_ARRAY',
+'GL_QUERY_WAIT', 'GL_QUERY_NO_WAIT', 'GL_QUERY_BY_REGION_WAIT',
+'GL_QUERY_BY_REGION_NO_WAIT', 'GL_TRANSPOSE_MODELVIEW_MATRIX_ARB',
+'GL_TRANSPOSE_PROJECTION_MATRIX_ARB', 'GL_TRANSPOSE_TEXTURE_MATRIX_ARB',
+'GL_TRANSPOSE_COLOR_MATRIX_ARB', 'GL_MULTISAMPLE_ARB',
+'GL_SAMPLE_ALPHA_TO_COVERAGE_ARB', 'GL_SAMPLE_ALPHA_TO_ONE_ARB',
+'GL_SAMPLE_COVERAGE_ARB', 'GL_SAMPLE_BUFFERS_ARB', 'GL_SAMPLES_ARB',
+'GL_SAMPLE_COVERAGE_VALUE_ARB', 'GL_SAMPLE_COVERAGE_INVERT_ARB',
+'GL_MULTISAMPLE_BIT_ARB', 'GL_NORMAL_MAP_ARB', 'GL_REFLECTION_MAP_ARB',
+'GL_TEXTURE_CUBE_MAP_ARB', 'GL_TEXTURE_BINDING_CUBE_MAP_ARB',
+'GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB', 'GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB',
+'GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB', 'GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB',
+'GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB', 'GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB',
+'GL_PROXY_TEXTURE_CUBE_MAP_ARB', 'GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB',
+'GL_COMPRESSED_ALPHA_ARB', 'GL_COMPRESSED_LUMINANCE_ARB',
+'GL_COMPRESSED_LUMINANCE_ALPHA_ARB', 'GL_COMPRESSED_INTENSITY_ARB',
+'GL_COMPRESSED_RGB_ARB', 'GL_COMPRESSED_RGBA_ARB',
+'GL_TEXTURE_COMPRESSION_HINT_ARB', 'GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB',
+'GL_TEXTURE_COMPRESSED_ARB', 'GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB',
+'GL_COMPRESSED_TEXTURE_FORMATS_ARB', 'GL_CLAMP_TO_BORDER_ARB',
+'GL_POINT_SIZE_MIN_ARB', 'GL_POINT_SIZE_MAX_ARB',
+'GL_POINT_FADE_THRESHOLD_SIZE_ARB', 'GL_POINT_DISTANCE_ATTENUATION_ARB',
+'GL_MAX_VERTEX_UNITS_ARB', 'GL_ACTIVE_VERTEX_UNITS_ARB',
+'GL_WEIGHT_SUM_UNITY_ARB', 'GL_VERTEX_BLEND_ARB', 'GL_CURRENT_WEIGHT_ARB',
+'GL_WEIGHT_ARRAY_TYPE_ARB', 'GL_WEIGHT_ARRAY_STRIDE_ARB',
+'GL_WEIGHT_ARRAY_SIZE_ARB', 'GL_WEIGHT_ARRAY_POINTER_ARB',
+'GL_WEIGHT_ARRAY_ARB', 'GL_MODELVIEW0_ARB', 'GL_MODELVIEW1_ARB',
+'GL_MODELVIEW2_ARB', 'GL_MODELVIEW3_ARB', 'GL_MODELVIEW4_ARB',
+'GL_MODELVIEW5_ARB', 'GL_MODELVIEW6_ARB', 'GL_MODELVIEW7_ARB',
+'GL_MODELVIEW8_ARB', 'GL_MODELVIEW9_ARB', 'GL_MODELVIEW10_ARB',
+'GL_MODELVIEW11_ARB', 'GL_MODELVIEW12_ARB', 'GL_MODELVIEW13_ARB',
+'GL_MODELVIEW14_ARB', 'GL_MODELVIEW15_ARB', 'GL_MODELVIEW16_ARB',
+'GL_MODELVIEW17_ARB', 'GL_MODELVIEW18_ARB', 'GL_MODELVIEW19_ARB',
+'GL_MODELVIEW20_ARB', 'GL_MODELVIEW21_ARB', 'GL_MODELVIEW22_ARB',
+'GL_MODELVIEW23_ARB', 'GL_MODELVIEW24_ARB', 'GL_MODELVIEW25_ARB',
+'GL_MODELVIEW26_ARB', 'GL_MODELVIEW27_ARB', 'GL_MODELVIEW28_ARB',
+'GL_MODELVIEW29_ARB', 'GL_MODELVIEW30_ARB', 'GL_MODELVIEW31_ARB',
+'GL_MATRIX_PALETTE_ARB', 'GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB',
+'GL_MAX_PALETTE_MATRICES_ARB', 'GL_CURRENT_PALETTE_MATRIX_ARB',
+'GL_MATRIX_INDEX_ARRAY_ARB', 'GL_CURRENT_MATRIX_INDEX_ARB',
+'GL_MATRIX_INDEX_ARRAY_SIZE_ARB', 'GL_MATRIX_INDEX_ARRAY_TYPE_ARB',
+'GL_MATRIX_INDEX_ARRAY_STRIDE_ARB', 'GL_MATRIX_INDEX_ARRAY_POINTER_ARB',
+'GL_COMBINE_ARB', 'GL_COMBINE_RGB_ARB', 'GL_COMBINE_ALPHA_ARB',
+'GL_SOURCE0_RGB_ARB', 'GL_SOURCE1_RGB_ARB', 'GL_SOURCE2_RGB_ARB',
+'GL_SOURCE0_ALPHA_ARB', 'GL_SOURCE1_ALPHA_ARB', 'GL_SOURCE2_ALPHA_ARB',
+'GL_OPERAND0_RGB_ARB', 'GL_OPERAND1_RGB_ARB', 'GL_OPERAND2_RGB_ARB',
+'GL_OPERAND0_ALPHA_ARB', 'GL_OPERAND1_ALPHA_ARB', 'GL_OPERAND2_ALPHA_ARB',
+'GL_RGB_SCALE_ARB', 'GL_ADD_SIGNED_ARB', 'GL_INTERPOLATE_ARB',
+'GL_SUBTRACT_ARB', 'GL_CONSTANT_ARB', 'GL_PRIMARY_COLOR_ARB',
+'GL_PREVIOUS_ARB', 'GL_DOT3_RGB_ARB', 'GL_DOT3_RGBA_ARB',
+'GL_MIRRORED_REPEAT_ARB', 'GL_DEPTH_COMPONENT16_ARB',
+'GL_DEPTH_COMPONENT24_ARB', 'GL_DEPTH_COMPONENT32_ARB',
+'GL_TEXTURE_DEPTH_SIZE_ARB', 'GL_DEPTH_TEXTURE_MODE_ARB',
+'GL_TEXTURE_COMPARE_MODE_ARB', 'GL_TEXTURE_COMPARE_FUNC_ARB',
+'GL_COMPARE_R_TO_TEXTURE_ARB', 'GL_TEXTURE_COMPARE_FAIL_VALUE_ARB',
+'GL_COLOR_SUM_ARB', 'GL_VERTEX_PROGRAM_ARB',
+'GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB', 'GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB',
+'GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB', 'GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB',
+'GL_CURRENT_VERTEX_ATTRIB_ARB', 'GL_PROGRAM_LENGTH_ARB',
+'GL_PROGRAM_STRING_ARB', 'GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB',
+'GL_MAX_PROGRAM_MATRICES_ARB', 'GL_CURRENT_MATRIX_STACK_DEPTH_ARB',
+'GL_CURRENT_MATRIX_ARB', 'GL_VERTEX_PROGRAM_POINT_SIZE_ARB',
+'GL_VERTEX_PROGRAM_TWO_SIDE_ARB', 'GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB',
+'GL_PROGRAM_ERROR_POSITION_ARB', 'GL_PROGRAM_BINDING_ARB',
+'GL_MAX_VERTEX_ATTRIBS_ARB', 'GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB',
+'GL_PROGRAM_ERROR_STRING_ARB', 'GL_PROGRAM_FORMAT_ASCII_ARB',
+'GL_PROGRAM_FORMAT_ARB', 'GL_PROGRAM_INSTRUCTIONS_ARB',
+'GL_MAX_PROGRAM_INSTRUCTIONS_ARB', 'GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB',
+'GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB', 'GL_PROGRAM_TEMPORARIES_ARB',
+'GL_MAX_PROGRAM_TEMPORARIES_ARB', 'GL_PROGRAM_NATIVE_TEMPORARIES_ARB',
+'GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB', 'GL_PROGRAM_PARAMETERS_ARB',
+'GL_MAX_PROGRAM_PARAMETERS_ARB', 'GL_PROGRAM_NATIVE_PARAMETERS_ARB',
+'GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB', 'GL_PROGRAM_ATTRIBS_ARB',
+'GL_MAX_PROGRAM_ATTRIBS_ARB', 'GL_PROGRAM_NATIVE_ATTRIBS_ARB',
+'GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB', 'GL_PROGRAM_ADDRESS_REGISTERS_ARB',
+'GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB',
+'GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB',
+'GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB',
+'GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB', 'GL_MAX_PROGRAM_ENV_PARAMETERS_ARB',
+'GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB', 'GL_TRANSPOSE_CURRENT_MATRIX_ARB',
+'GL_MATRIX0_ARB', 'GL_MATRIX1_ARB', 'GL_MATRIX2_ARB', 'GL_MATRIX3_ARB',
+'GL_MATRIX4_ARB', 'GL_MATRIX5_ARB', 'GL_MATRIX6_ARB', 'GL_MATRIX7_ARB',
+'GL_MATRIX8_ARB', 'GL_MATRIX9_ARB', 'GL_MATRIX10_ARB', 'GL_MATRIX11_ARB',
+'GL_MATRIX12_ARB', 'GL_MATRIX13_ARB', 'GL_MATRIX14_ARB', 'GL_MATRIX15_ARB',
+'GL_MATRIX16_ARB', 'GL_MATRIX17_ARB', 'GL_MATRIX18_ARB', 'GL_MATRIX19_ARB',
+'GL_MATRIX20_ARB', 'GL_MATRIX21_ARB', 'GL_MATRIX22_ARB', 'GL_MATRIX23_ARB',
+'GL_MATRIX24_ARB', 'GL_MATRIX25_ARB', 'GL_MATRIX26_ARB', 'GL_MATRIX27_ARB',
+'GL_MATRIX28_ARB', 'GL_MATRIX29_ARB', 'GL_MATRIX30_ARB', 'GL_MATRIX31_ARB',
+'GL_FRAGMENT_PROGRAM_ARB', 'GL_PROGRAM_ALU_INSTRUCTIONS_ARB',
+'GL_PROGRAM_TEX_INSTRUCTIONS_ARB', 'GL_PROGRAM_TEX_INDIRECTIONS_ARB',
+'GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB',
+'GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB',
+'GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB',
+'GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB', 'GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB',
+'GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB',
+'GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB',
+'GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB',
+'GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB', 'GL_MAX_TEXTURE_COORDS_ARB',
+'GL_MAX_TEXTURE_IMAGE_UNITS_ARB', 'GL_BUFFER_SIZE_ARB', 'GL_BUFFER_USAGE_ARB',
+'GL_ARRAY_BUFFER_ARB', 'GL_ELEMENT_ARRAY_BUFFER_ARB',
+'GL_ARRAY_BUFFER_BINDING_ARB', 'GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB',
+'GL_VERTEX_ARRAY_BUFFER_BINDING_ARB', 'GL_NORMAL_ARRAY_BUFFER_BINDING_ARB',
+'GL_COLOR_ARRAY_BUFFER_BINDING_ARB', 'GL_INDEX_ARRAY_BUFFER_BINDING_ARB',
+'GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB',
+'GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB',
+'GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB',
+'GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB',
+'GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB',
+'GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB', 'GL_READ_ONLY_ARB',
+'GL_WRITE_ONLY_ARB', 'GL_READ_WRITE_ARB', 'GL_BUFFER_ACCESS_ARB',
+'GL_BUFFER_MAPPED_ARB', 'GL_BUFFER_MAP_POINTER_ARB', 'GL_STREAM_DRAW_ARB',
+'GL_STREAM_READ_ARB', 'GL_STREAM_COPY_ARB', 'GL_STATIC_DRAW_ARB',
+'GL_STATIC_READ_ARB', 'GL_STATIC_COPY_ARB', 'GL_DYNAMIC_DRAW_ARB',
+'GL_DYNAMIC_READ_ARB', 'GL_DYNAMIC_COPY_ARB', 'GL_QUERY_COUNTER_BITS_ARB',
+'GL_CURRENT_QUERY_ARB', 'GL_QUERY_RESULT_ARB',
+'GL_QUERY_RESULT_AVAILABLE_ARB', 'GL_SAMPLES_PASSED_ARB',
+'GL_PROGRAM_OBJECT_ARB', 'GL_SHADER_OBJECT_ARB', 'GL_OBJECT_TYPE_ARB',
+'GL_OBJECT_SUBTYPE_ARB', 'GL_FLOAT_VEC2_ARB', 'GL_FLOAT_VEC3_ARB',
+'GL_FLOAT_VEC4_ARB', 'GL_INT_VEC2_ARB', 'GL_INT_VEC3_ARB', 'GL_INT_VEC4_ARB',
+'GL_BOOL_ARB', 'GL_BOOL_VEC2_ARB', 'GL_BOOL_VEC3_ARB', 'GL_BOOL_VEC4_ARB',
+'GL_FLOAT_MAT2_ARB', 'GL_FLOAT_MAT3_ARB', 'GL_FLOAT_MAT4_ARB',
+'GL_SAMPLER_1D_ARB', 'GL_SAMPLER_2D_ARB', 'GL_SAMPLER_3D_ARB',
+'GL_SAMPLER_CUBE_ARB', 'GL_SAMPLER_1D_SHADOW_ARB', 'GL_SAMPLER_2D_SHADOW_ARB',
+'GL_SAMPLER_2D_RECT_ARB', 'GL_SAMPLER_2D_RECT_SHADOW_ARB',
+'GL_OBJECT_DELETE_STATUS_ARB', 'GL_OBJECT_COMPILE_STATUS_ARB',
+'GL_OBJECT_LINK_STATUS_ARB', 'GL_OBJECT_VALIDATE_STATUS_ARB',
+'GL_OBJECT_INFO_LOG_LENGTH_ARB', 'GL_OBJECT_ATTACHED_OBJECTS_ARB',
+'GL_OBJECT_ACTIVE_UNIFORMS_ARB', 'GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB',
+'GL_OBJECT_SHADER_SOURCE_LENGTH_ARB', 'GL_VERTEX_SHADER_ARB',
+'GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB', 'GL_MAX_VARYING_FLOATS_ARB',
+'GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB',
+'GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB', 'GL_OBJECT_ACTIVE_ATTRIBUTES_ARB',
+'GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB', 'GL_FRAGMENT_SHADER_ARB',
+'GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB',
+'GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB', 'GL_SHADING_LANGUAGE_VERSION_ARB',
+'GL_POINT_SPRITE_ARB', 'GL_COORD_REPLACE_ARB', 'GL_MAX_DRAW_BUFFERS_ARB',
+'GL_DRAW_BUFFER0_ARB', 'GL_DRAW_BUFFER1_ARB', 'GL_DRAW_BUFFER2_ARB',
+'GL_DRAW_BUFFER3_ARB', 'GL_DRAW_BUFFER4_ARB', 'GL_DRAW_BUFFER5_ARB',
+'GL_DRAW_BUFFER6_ARB', 'GL_DRAW_BUFFER7_ARB', 'GL_DRAW_BUFFER8_ARB',
+'GL_DRAW_BUFFER9_ARB', 'GL_DRAW_BUFFER10_ARB', 'GL_DRAW_BUFFER11_ARB',
+'GL_DRAW_BUFFER12_ARB', 'GL_DRAW_BUFFER13_ARB', 'GL_DRAW_BUFFER14_ARB',
+'GL_DRAW_BUFFER15_ARB', 'GL_TEXTURE_RECTANGLE_ARB',
+'GL_TEXTURE_BINDING_RECTANGLE_ARB', 'GL_PROXY_TEXTURE_RECTANGLE_ARB',
+'GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB', 'GL_RGBA_FLOAT_MODE_ARB',
+'GL_CLAMP_VERTEX_COLOR_ARB', 'GL_CLAMP_FRAGMENT_COLOR_ARB',
+'GL_CLAMP_READ_COLOR_ARB', 'GL_FIXED_ONLY_ARB', 'GL_HALF_FLOAT_ARB',
+'GL_TEXTURE_RED_TYPE_ARB', 'GL_TEXTURE_GREEN_TYPE_ARB',
+'GL_TEXTURE_BLUE_TYPE_ARB', 'GL_TEXTURE_ALPHA_TYPE_ARB',
+'GL_TEXTURE_LUMINANCE_TYPE_ARB', 'GL_TEXTURE_INTENSITY_TYPE_ARB',
+'GL_TEXTURE_DEPTH_TYPE_ARB', 'GL_UNSIGNED_NORMALIZED_ARB', 'GL_RGBA32F_ARB',
+'GL_RGB32F_ARB', 'GL_ALPHA32F_ARB', 'GL_INTENSITY32F_ARB',
+'GL_LUMINANCE32F_ARB', 'GL_LUMINANCE_ALPHA32F_ARB', 'GL_RGBA16F_ARB',
+'GL_RGB16F_ARB', 'GL_ALPHA16F_ARB', 'GL_INTENSITY16F_ARB',
+'GL_LUMINANCE16F_ARB', 'GL_LUMINANCE_ALPHA16F_ARB',
+'GL_PIXEL_PACK_BUFFER_ARB', 'GL_PIXEL_UNPACK_BUFFER_ARB',
+'GL_PIXEL_PACK_BUFFER_BINDING_ARB', 'GL_PIXEL_UNPACK_BUFFER_BINDING_ARB',
+'GL_DEPTH_COMPONENT32F', 'GL_DEPTH32F_STENCIL8',
+'GL_FLOAT_32_UNSIGNED_INT_24_8_REV', 'GL_INVALID_FRAMEBUFFER_OPERATION',
+'GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING',
+'GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE',
+'GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE', 'GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE',
+'GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE', 'GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE',
+'GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE',
+'GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE', 'GL_FRAMEBUFFER_DEFAULT',
+'GL_FRAMEBUFFER_UNDEFINED', 'GL_DEPTH_STENCIL_ATTACHMENT', 'GL_INDEX',
+'GL_MAX_RENDERBUFFER_SIZE', 'GL_DEPTH_STENCIL', 'GL_UNSIGNED_INT_24_8',
+'GL_DEPTH24_STENCIL8', 'GL_TEXTURE_STENCIL_SIZE', 'GL_FRAMEBUFFER_BINDING',
+'GL_DRAW_FRAMEBUFFER_BINDING', 'GL_RENDERBUFFER_BINDING',
+'GL_READ_FRAMEBUFFER', 'GL_DRAW_FRAMEBUFFER', 'GL_READ_FRAMEBUFFER_BINDING',
+'GL_RENDERBUFFER_SAMPLES', 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE',
+'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME',
+'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL',
+'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE',
+'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER', 'GL_FRAMEBUFFER_COMPLETE',
+'GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT',
+'GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT',
+'GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER',
+'GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER', 'GL_FRAMEBUFFER_UNSUPPORTED',
+'GL_MAX_COLOR_ATTACHMENTS', 'GL_COLOR_ATTACHMENT0', 'GL_COLOR_ATTACHMENT1',
+'GL_COLOR_ATTACHMENT2', 'GL_COLOR_ATTACHMENT3', 'GL_COLOR_ATTACHMENT4',
+'GL_COLOR_ATTACHMENT5', 'GL_COLOR_ATTACHMENT6', 'GL_COLOR_ATTACHMENT7',
+'GL_COLOR_ATTACHMENT8', 'GL_COLOR_ATTACHMENT9', 'GL_COLOR_ATTACHMENT10',
+'GL_COLOR_ATTACHMENT11', 'GL_COLOR_ATTACHMENT12', 'GL_COLOR_ATTACHMENT13',
+'GL_COLOR_ATTACHMENT14', 'GL_COLOR_ATTACHMENT15', 'GL_DEPTH_ATTACHMENT',
+'GL_STENCIL_ATTACHMENT', 'GL_FRAMEBUFFER', 'GL_RENDERBUFFER',
+'GL_RENDERBUFFER_WIDTH', 'GL_RENDERBUFFER_HEIGHT',
+'GL_RENDERBUFFER_INTERNAL_FORMAT', 'GL_STENCIL_INDEX1', 'GL_STENCIL_INDEX4',
+'GL_STENCIL_INDEX8', 'GL_STENCIL_INDEX16', 'GL_RENDERBUFFER_RED_SIZE',
+'GL_RENDERBUFFER_GREEN_SIZE', 'GL_RENDERBUFFER_BLUE_SIZE',
+'GL_RENDERBUFFER_ALPHA_SIZE', 'GL_RENDERBUFFER_DEPTH_SIZE',
+'GL_RENDERBUFFER_STENCIL_SIZE', 'GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE',
+'GL_MAX_SAMPLES', 'GL_FRAMEBUFFER_SRGB', 'GL_LINES_ADJACENCY_ARB',
+'GL_LINE_STRIP_ADJACENCY_ARB', 'GL_TRIANGLES_ADJACENCY_ARB',
+'GL_TRIANGLE_STRIP_ADJACENCY_ARB', 'GL_PROGRAM_POINT_SIZE_ARB',
+'GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB',
+'GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB',
+'GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB',
+'GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB', 'GL_GEOMETRY_SHADER_ARB',
+'GL_GEOMETRY_VERTICES_OUT_ARB', 'GL_GEOMETRY_INPUT_TYPE_ARB',
+'GL_GEOMETRY_OUTPUT_TYPE_ARB', 'GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB',
+'GL_MAX_VERTEX_VARYING_COMPONENTS_ARB',
+'GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB',
+'GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB',
+'GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB', 'GL_HALF_FLOAT',
+'GL_MAP_READ_BIT', 'GL_MAP_WRITE_BIT', 'GL_MAP_INVALIDATE_RANGE_BIT',
+'GL_MAP_INVALIDATE_BUFFER_BIT', 'GL_MAP_FLUSH_EXPLICIT_BIT',
+'GL_MAP_UNSYNCHRONIZED_BIT', 'GL_TEXTURE_BUFFER_ARB',
+'GL_MAX_TEXTURE_BUFFER_SIZE_ARB', 'GL_TEXTURE_BINDING_BUFFER_ARB',
+'GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB', 'GL_TEXTURE_BUFFER_FORMAT_ARB',
+'GL_COMPRESSED_RED_RGTC1', 'GL_COMPRESSED_SIGNED_RED_RGTC1',
+'GL_COMPRESSED_RG_RGTC2', 'GL_COMPRESSED_SIGNED_RG_RGTC2', 'GL_RG',
+'GL_RG_INTEGER', 'GL_R8', 'GL_R16', 'GL_RG8', 'GL_RG16', 'GL_R16F', 'GL_R32F',
+'GL_RG16F', 'GL_RG32F', 'GL_R8I', 'GL_R8UI', 'GL_R16I', 'GL_R16UI', 'GL_R32I',
+'GL_R32UI', 'GL_RG8I', 'GL_RG8UI', 'GL_RG16I', 'GL_RG16UI', 'GL_RG32I',
+'GL_RG32UI', 'GL_VERTEX_ARRAY_BINDING', 'GL_ABGR_EXT',
+'GL_CONSTANT_COLOR_EXT', 'GL_ONE_MINUS_CONSTANT_COLOR_EXT',
+'GL_CONSTANT_ALPHA_EXT', 'GL_ONE_MINUS_CONSTANT_ALPHA_EXT',
+'GL_BLEND_COLOR_EXT', 'GL_POLYGON_OFFSET_EXT', 'GL_POLYGON_OFFSET_FACTOR_EXT',
+'GL_POLYGON_OFFSET_BIAS_EXT', 'GL_ALPHA4_EXT', 'GL_ALPHA8_EXT',
+'GL_ALPHA12_EXT', 'GL_ALPHA16_EXT', 'GL_LUMINANCE4_EXT', 'GL_LUMINANCE8_EXT',
+'GL_LUMINANCE12_EXT', 'GL_LUMINANCE16_EXT', 'GL_LUMINANCE4_ALPHA4_EXT',
+'GL_LUMINANCE6_ALPHA2_EXT', 'GL_LUMINANCE8_ALPHA8_EXT',
+'GL_LUMINANCE12_ALPHA4_EXT', 'GL_LUMINANCE12_ALPHA12_EXT',
+'GL_LUMINANCE16_ALPHA16_EXT', 'GL_INTENSITY_EXT', 'GL_INTENSITY4_EXT',
+'GL_INTENSITY8_EXT', 'GL_INTENSITY12_EXT', 'GL_INTENSITY16_EXT',
+'GL_RGB2_EXT', 'GL_RGB4_EXT', 'GL_RGB5_EXT', 'GL_RGB8_EXT', 'GL_RGB10_EXT',
+'GL_RGB12_EXT', 'GL_RGB16_EXT', 'GL_RGBA2_EXT', 'GL_RGBA4_EXT',
+'GL_RGB5_A1_EXT', 'GL_RGBA8_EXT', 'GL_RGB10_A2_EXT', 'GL_RGBA12_EXT',
+'GL_RGBA16_EXT', 'GL_TEXTURE_RED_SIZE_EXT', 'GL_TEXTURE_GREEN_SIZE_EXT',
+'GL_TEXTURE_BLUE_SIZE_EXT', 'GL_TEXTURE_ALPHA_SIZE_EXT',
+'GL_TEXTURE_LUMINANCE_SIZE_EXT', 'GL_TEXTURE_INTENSITY_SIZE_EXT',
+'GL_REPLACE_EXT', 'GL_PROXY_TEXTURE_1D_EXT', 'GL_PROXY_TEXTURE_2D_EXT',
+'GL_TEXTURE_TOO_LARGE_EXT', 'GL_PACK_SKIP_IMAGES_EXT',
+'GL_PACK_IMAGE_HEIGHT_EXT', 'GL_UNPACK_SKIP_IMAGES_EXT',
+'GL_UNPACK_IMAGE_HEIGHT_EXT', 'GL_TEXTURE_3D_EXT', 'GL_PROXY_TEXTURE_3D_EXT',
+'GL_TEXTURE_DEPTH_EXT', 'GL_TEXTURE_WRAP_R_EXT', 'GL_MAX_3D_TEXTURE_SIZE_EXT',
+'GL_FILTER4_SGIS', 'GL_TEXTURE_FILTER4_SIZE_SGIS', 'GL_HISTOGRAM_EXT',
+'GL_PROXY_HISTOGRAM_EXT', 'GL_HISTOGRAM_WIDTH_EXT', 'GL_HISTOGRAM_FORMAT_EXT',
+'GL_HISTOGRAM_RED_SIZE_EXT', 'GL_HISTOGRAM_GREEN_SIZE_EXT',
+'GL_HISTOGRAM_BLUE_SIZE_EXT', 'GL_HISTOGRAM_ALPHA_SIZE_EXT',
+'GL_HISTOGRAM_LUMINANCE_SIZE_EXT', 'GL_HISTOGRAM_SINK_EXT', 'GL_MINMAX_EXT',
+'GL_MINMAX_FORMAT_EXT', 'GL_MINMAX_SINK_EXT', 'GL_TABLE_TOO_LARGE_EXT',
+'GL_CONVOLUTION_1D_EXT', 'GL_CONVOLUTION_2D_EXT', 'GL_SEPARABLE_2D_EXT',
+'GL_CONVOLUTION_BORDER_MODE_EXT', 'GL_CONVOLUTION_FILTER_SCALE_EXT',
+'GL_CONVOLUTION_FILTER_BIAS_EXT', 'GL_REDUCE_EXT',
+'GL_CONVOLUTION_FORMAT_EXT', 'GL_CONVOLUTION_WIDTH_EXT',
+'GL_CONVOLUTION_HEIGHT_EXT', 'GL_MAX_CONVOLUTION_WIDTH_EXT',
+'GL_MAX_CONVOLUTION_HEIGHT_EXT', 'GL_POST_CONVOLUTION_RED_SCALE_EXT',
+'GL_POST_CONVOLUTION_GREEN_SCALE_EXT', 'GL_POST_CONVOLUTION_BLUE_SCALE_EXT',
+'GL_POST_CONVOLUTION_ALPHA_SCALE_EXT', 'GL_POST_CONVOLUTION_RED_BIAS_EXT',
+'GL_POST_CONVOLUTION_GREEN_BIAS_EXT', 'GL_POST_CONVOLUTION_BLUE_BIAS_EXT',
+'GL_POST_CONVOLUTION_ALPHA_BIAS_EXT', 'GL_COLOR_MATRIX_SGI',
+'GL_COLOR_MATRIX_STACK_DEPTH_SGI', 'GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI',
+'GL_POST_COLOR_MATRIX_RED_SCALE_SGI', 'GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI',
+'GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI', 'GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI',
+'GL_POST_COLOR_MATRIX_RED_BIAS_SGI', 'GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI',
+'GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI', 'GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI',
+'GL_COLOR_TABLE_SGI', 'GL_POST_CONVOLUTION_COLOR_TABLE_SGI',
+'GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI', 'GL_PROXY_COLOR_TABLE_SGI',
+'GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI',
+'GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI', 'GL_COLOR_TABLE_SCALE_SGI',
+'GL_COLOR_TABLE_BIAS_SGI', 'GL_COLOR_TABLE_FORMAT_SGI',
+'GL_COLOR_TABLE_WIDTH_SGI', 'GL_COLOR_TABLE_RED_SIZE_SGI',
+'GL_COLOR_TABLE_GREEN_SIZE_SGI', 'GL_COLOR_TABLE_BLUE_SIZE_SGI',
+'GL_COLOR_TABLE_ALPHA_SIZE_SGI', 'GL_COLOR_TABLE_LUMINANCE_SIZE_SGI',
+'GL_COLOR_TABLE_INTENSITY_SIZE_SGI', 'GL_PIXEL_TEXTURE_SGIS',
+'GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS', 'GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS',
+'GL_PIXEL_GROUP_COLOR_SGIS', 'GL_PIXEL_TEX_GEN_SGIX',
+'GL_PIXEL_TEX_GEN_MODE_SGIX', 'GL_PACK_SKIP_VOLUMES_SGIS',
+'GL_PACK_IMAGE_DEPTH_SGIS', 'GL_UNPACK_SKIP_VOLUMES_SGIS',
+'GL_UNPACK_IMAGE_DEPTH_SGIS', 'GL_TEXTURE_4D_SGIS',
+'GL_PROXY_TEXTURE_4D_SGIS', 'GL_TEXTURE_4DSIZE_SGIS',
+'GL_TEXTURE_WRAP_Q_SGIS', 'GL_MAX_4D_TEXTURE_SIZE_SGIS',
+'GL_TEXTURE_4D_BINDING_SGIS', 'GL_TEXTURE_COLOR_TABLE_SGI',
+'GL_PROXY_TEXTURE_COLOR_TABLE_SGI', 'GL_CMYK_EXT', 'GL_CMYKA_EXT',
+'GL_PACK_CMYK_HINT_EXT', 'GL_UNPACK_CMYK_HINT_EXT', 'GL_TEXTURE_PRIORITY_EXT',
+'GL_TEXTURE_RESIDENT_EXT', 'GL_TEXTURE_1D_BINDING_EXT',
+'GL_TEXTURE_2D_BINDING_EXT', 'GL_TEXTURE_3D_BINDING_EXT',
+'GL_DETAIL_TEXTURE_2D_SGIS', 'GL_DETAIL_TEXTURE_2D_BINDING_SGIS',
+'GL_LINEAR_DETAIL_SGIS', 'GL_LINEAR_DETAIL_ALPHA_SGIS',
+'GL_LINEAR_DETAIL_COLOR_SGIS', 'GL_DETAIL_TEXTURE_LEVEL_SGIS',
+'GL_DETAIL_TEXTURE_MODE_SGIS', 'GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS',
+'GL_LINEAR_SHARPEN_SGIS', 'GL_LINEAR_SHARPEN_ALPHA_SGIS',
+'GL_LINEAR_SHARPEN_COLOR_SGIS', 'GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS',
+'GL_UNSIGNED_BYTE_3_3_2_EXT', 'GL_UNSIGNED_SHORT_4_4_4_4_EXT',
+'GL_UNSIGNED_SHORT_5_5_5_1_EXT', 'GL_UNSIGNED_INT_8_8_8_8_EXT',
+'GL_UNSIGNED_INT_10_10_10_2_EXT', 'GL_TEXTURE_MIN_LOD_SGIS',
+'GL_TEXTURE_MAX_LOD_SGIS', 'GL_TEXTURE_BASE_LEVEL_SGIS',
+'GL_TEXTURE_MAX_LEVEL_SGIS', 'GL_MULTISAMPLE_SGIS',
+'GL_SAMPLE_ALPHA_TO_MASK_SGIS', 'GL_SAMPLE_ALPHA_TO_ONE_SGIS',
+'GL_SAMPLE_MASK_SGIS', 'GL_1PASS_SGIS', 'GL_2PASS_0_SGIS', 'GL_2PASS_1_SGIS',
+'GL_4PASS_0_SGIS', 'GL_4PASS_1_SGIS', 'GL_4PASS_2_SGIS', 'GL_4PASS_3_SGIS',
+'GL_SAMPLE_BUFFERS_SGIS', 'GL_SAMPLES_SGIS', 'GL_SAMPLE_MASK_VALUE_SGIS',
+'GL_SAMPLE_MASK_INVERT_SGIS', 'GL_SAMPLE_PATTERN_SGIS',
+'GL_RESCALE_NORMAL_EXT', 'GL_VERTEX_ARRAY_EXT', 'GL_NORMAL_ARRAY_EXT',
+'GL_COLOR_ARRAY_EXT', 'GL_INDEX_ARRAY_EXT', 'GL_TEXTURE_COORD_ARRAY_EXT',
+'GL_EDGE_FLAG_ARRAY_EXT', 'GL_VERTEX_ARRAY_SIZE_EXT',
+'GL_VERTEX_ARRAY_TYPE_EXT', 'GL_VERTEX_ARRAY_STRIDE_EXT',
+'GL_VERTEX_ARRAY_COUNT_EXT', 'GL_NORMAL_ARRAY_TYPE_EXT',
+'GL_NORMAL_ARRAY_STRIDE_EXT', 'GL_NORMAL_ARRAY_COUNT_EXT',
+'GL_COLOR_ARRAY_SIZE_EXT', 'GL_COLOR_ARRAY_TYPE_EXT',
+'GL_COLOR_ARRAY_STRIDE_EXT', 'GL_COLOR_ARRAY_COUNT_EXT',
+'GL_INDEX_ARRAY_TYPE_EXT', 'GL_INDEX_ARRAY_STRIDE_EXT',
+'GL_INDEX_ARRAY_COUNT_EXT', 'GL_TEXTURE_COORD_ARRAY_SIZE_EXT',
+'GL_TEXTURE_COORD_ARRAY_TYPE_EXT', 'GL_TEXTURE_COORD_ARRAY_STRIDE_EXT',
+'GL_TEXTURE_COORD_ARRAY_COUNT_EXT', 'GL_EDGE_FLAG_ARRAY_STRIDE_EXT',
+'GL_EDGE_FLAG_ARRAY_COUNT_EXT', 'GL_VERTEX_ARRAY_POINTER_EXT',
+'GL_NORMAL_ARRAY_POINTER_EXT', 'GL_COLOR_ARRAY_POINTER_EXT',
+'GL_INDEX_ARRAY_POINTER_EXT', 'GL_TEXTURE_COORD_ARRAY_POINTER_EXT',
+'GL_EDGE_FLAG_ARRAY_POINTER_EXT', 'GL_GENERATE_MIPMAP_SGIS',
+'GL_GENERATE_MIPMAP_HINT_SGIS', 'GL_LINEAR_CLIPMAP_LINEAR_SGIX',
+'GL_TEXTURE_CLIPMAP_CENTER_SGIX', 'GL_TEXTURE_CLIPMAP_FRAME_SGIX',
+'GL_TEXTURE_CLIPMAP_OFFSET_SGIX', 'GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX',
+'GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX', 'GL_TEXTURE_CLIPMAP_DEPTH_SGIX',
+'GL_MAX_CLIPMAP_DEPTH_SGIX', 'GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX',
+'GL_NEAREST_CLIPMAP_NEAREST_SGIX', 'GL_NEAREST_CLIPMAP_LINEAR_SGIX',
+'GL_LINEAR_CLIPMAP_NEAREST_SGIX', 'GL_TEXTURE_COMPARE_SGIX',
+'GL_TEXTURE_COMPARE_OPERATOR_SGIX', 'GL_TEXTURE_LEQUAL_R_SGIX',
+'GL_TEXTURE_GEQUAL_R_SGIX', 'GL_CLAMP_TO_EDGE_SGIS',
+'GL_CLAMP_TO_BORDER_SGIS', 'GL_FUNC_ADD_EXT', 'GL_MIN_EXT', 'GL_MAX_EXT',
+'GL_BLEND_EQUATION_EXT', 'GL_FUNC_SUBTRACT_EXT',
+'GL_FUNC_REVERSE_SUBTRACT_EXT', 'GL_INTERLACE_SGIX',
+'GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX', 'GL_PIXEL_TILE_CACHE_INCREMENT_SGIX',
+'GL_PIXEL_TILE_WIDTH_SGIX', 'GL_PIXEL_TILE_HEIGHT_SGIX',
+'GL_PIXEL_TILE_GRID_WIDTH_SGIX', 'GL_PIXEL_TILE_GRID_HEIGHT_SGIX',
+'GL_PIXEL_TILE_GRID_DEPTH_SGIX', 'GL_PIXEL_TILE_CACHE_SIZE_SGIX',
+'GL_DUAL_ALPHA4_SGIS', 'GL_DUAL_ALPHA8_SGIS', 'GL_DUAL_ALPHA12_SGIS',
+'GL_DUAL_ALPHA16_SGIS', 'GL_DUAL_LUMINANCE4_SGIS', 'GL_DUAL_LUMINANCE8_SGIS',
+'GL_DUAL_LUMINANCE12_SGIS', 'GL_DUAL_LUMINANCE16_SGIS',
+'GL_DUAL_INTENSITY4_SGIS', 'GL_DUAL_INTENSITY8_SGIS',
+'GL_DUAL_INTENSITY12_SGIS', 'GL_DUAL_INTENSITY16_SGIS',
+'GL_DUAL_LUMINANCE_ALPHA4_SGIS', 'GL_DUAL_LUMINANCE_ALPHA8_SGIS',
+'GL_QUAD_ALPHA4_SGIS', 'GL_QUAD_ALPHA8_SGIS', 'GL_QUAD_LUMINANCE4_SGIS',
+'GL_QUAD_LUMINANCE8_SGIS', 'GL_QUAD_INTENSITY4_SGIS',
+'GL_QUAD_INTENSITY8_SGIS', 'GL_DUAL_TEXTURE_SELECT_SGIS',
+'GL_QUAD_TEXTURE_SELECT_SGIS', 'GL_SPRITE_SGIX', 'GL_SPRITE_MODE_SGIX',
+'GL_SPRITE_AXIS_SGIX', 'GL_SPRITE_TRANSLATION_SGIX', 'GL_SPRITE_AXIAL_SGIX',
+'GL_SPRITE_OBJECT_ALIGNED_SGIX', 'GL_SPRITE_EYE_ALIGNED_SGIX',
+'GL_TEXTURE_MULTI_BUFFER_HINT_SGIX', 'GL_POINT_SIZE_MIN_EXT',
+'GL_POINT_SIZE_MAX_EXT', 'GL_POINT_FADE_THRESHOLD_SIZE_EXT',
+'GL_DISTANCE_ATTENUATION_EXT', 'GL_POINT_SIZE_MIN_SGIS',
+'GL_POINT_SIZE_MAX_SGIS', 'GL_POINT_FADE_THRESHOLD_SIZE_SGIS',
+'GL_DISTANCE_ATTENUATION_SGIS', 'GL_INSTRUMENT_BUFFER_POINTER_SGIX',
+'GL_INSTRUMENT_MEASUREMENTS_SGIX', 'GL_POST_TEXTURE_FILTER_BIAS_SGIX',
+'GL_POST_TEXTURE_FILTER_SCALE_SGIX', 'GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX',
+'GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX', 'GL_FRAMEZOOM_SGIX',
+'GL_FRAMEZOOM_FACTOR_SGIX', 'GL_MAX_FRAMEZOOM_FACTOR_SGIX',
+'GL_TEXTURE_DEFORMATION_BIT_SGIX', 'GL_GEOMETRY_DEFORMATION_BIT_SGIX',
+'GL_GEOMETRY_DEFORMATION_SGIX', 'GL_TEXTURE_DEFORMATION_SGIX',
+'GL_DEFORMATIONS_MASK_SGIX', 'GL_MAX_DEFORMATION_ORDER_SGIX',
+'GL_REFERENCE_PLANE_SGIX', 'GL_REFERENCE_PLANE_EQUATION_SGIX',
+'GL_DEPTH_COMPONENT16_SGIX', 'GL_DEPTH_COMPONENT24_SGIX',
+'GL_DEPTH_COMPONENT32_SGIX', 'GL_FOG_FUNC_SGIS', 'GL_FOG_FUNC_POINTS_SGIS',
+'GL_MAX_FOG_FUNC_POINTS_SGIS', 'GL_FOG_OFFSET_SGIX',
+'GL_FOG_OFFSET_VALUE_SGIX', 'GL_IMAGE_SCALE_X_HP', 'GL_IMAGE_SCALE_Y_HP',
+'GL_IMAGE_TRANSLATE_X_HP', 'GL_IMAGE_TRANSLATE_Y_HP',
+'GL_IMAGE_ROTATE_ANGLE_HP', 'GL_IMAGE_ROTATE_ORIGIN_X_HP',
+'GL_IMAGE_ROTATE_ORIGIN_Y_HP', 'GL_IMAGE_MAG_FILTER_HP',
+'GL_IMAGE_MIN_FILTER_HP', 'GL_IMAGE_CUBIC_WEIGHT_HP', 'GL_CUBIC_HP',
+'GL_AVERAGE_HP', 'GL_IMAGE_TRANSFORM_2D_HP',
+'GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP',
+'GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP', 'GL_IGNORE_BORDER_HP',
+'GL_CONSTANT_BORDER_HP', 'GL_REPLICATE_BORDER_HP',
+'GL_CONVOLUTION_BORDER_COLOR_HP', 'GL_TEXTURE_ENV_BIAS_SGIX',
+'GL_VERTEX_DATA_HINT_PGI', 'GL_VERTEX_CONSISTENT_HINT_PGI',
+'GL_MATERIAL_SIDE_HINT_PGI', 'GL_MAX_VERTEX_HINT_PGI', 'GL_COLOR3_BIT_PGI',
+'GL_COLOR4_BIT_PGI', 'GL_EDGEFLAG_BIT_PGI', 'GL_INDEX_BIT_PGI',
+'GL_MAT_AMBIENT_BIT_PGI', 'GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI',
+'GL_MAT_DIFFUSE_BIT_PGI', 'GL_MAT_EMISSION_BIT_PGI',
+'GL_MAT_COLOR_INDEXES_BIT_PGI', 'GL_MAT_SHININESS_BIT_PGI',
+'GL_MAT_SPECULAR_BIT_PGI', 'GL_NORMAL_BIT_PGI', 'GL_TEXCOORD1_BIT_PGI',
+'GL_TEXCOORD2_BIT_PGI', 'GL_TEXCOORD3_BIT_PGI', 'GL_TEXCOORD4_BIT_PGI',
+'GL_VERTEX23_BIT_PGI', 'GL_VERTEX4_BIT_PGI',
+'GL_PREFER_DOUBLEBUFFER_HINT_PGI', 'GL_CONSERVE_MEMORY_HINT_PGI',
+'GL_RECLAIM_MEMORY_HINT_PGI', 'GL_NATIVE_GRAPHICS_HANDLE_PGI',
+'GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI', 'GL_NATIVE_GRAPHICS_END_HINT_PGI',
+'GL_ALWAYS_FAST_HINT_PGI', 'GL_ALWAYS_SOFT_HINT_PGI',
+'GL_ALLOW_DRAW_OBJ_HINT_PGI', 'GL_ALLOW_DRAW_WIN_HINT_PGI',
+'GL_ALLOW_DRAW_FRG_HINT_PGI', 'GL_ALLOW_DRAW_MEM_HINT_PGI',
+'GL_STRICT_DEPTHFUNC_HINT_PGI', 'GL_STRICT_LIGHTING_HINT_PGI',
+'GL_STRICT_SCISSOR_HINT_PGI', 'GL_FULL_STIPPLE_HINT_PGI',
+'GL_CLIP_NEAR_HINT_PGI', 'GL_CLIP_FAR_HINT_PGI', 'GL_WIDE_LINE_HINT_PGI',
+'GL_BACK_NORMALS_HINT_PGI', 'GL_COLOR_INDEX1_EXT', 'GL_COLOR_INDEX2_EXT',
+'GL_COLOR_INDEX4_EXT', 'GL_COLOR_INDEX8_EXT', 'GL_COLOR_INDEX12_EXT',
+'GL_COLOR_INDEX16_EXT', 'GL_TEXTURE_INDEX_SIZE_EXT',
+'GL_CLIP_VOLUME_CLIPPING_HINT_EXT', 'GL_LIST_PRIORITY_SGIX',
+'GL_IR_INSTRUMENT1_SGIX', 'GL_CALLIGRAPHIC_FRAGMENT_SGIX',
+'GL_TEXTURE_LOD_BIAS_S_SGIX', 'GL_TEXTURE_LOD_BIAS_T_SGIX',
+'GL_TEXTURE_LOD_BIAS_R_SGIX', 'GL_SHADOW_AMBIENT_SGIX',
+'GL_INDEX_MATERIAL_EXT', 'GL_INDEX_MATERIAL_PARAMETER_EXT',
+'GL_INDEX_MATERIAL_FACE_EXT', 'GL_INDEX_TEST_EXT', 'GL_INDEX_TEST_FUNC_EXT',
+'GL_INDEX_TEST_REF_EXT', 'GL_IUI_V2F_EXT', 'GL_IUI_V3F_EXT',
+'GL_IUI_N3F_V2F_EXT', 'GL_IUI_N3F_V3F_EXT', 'GL_T2F_IUI_V2F_EXT',
+'GL_T2F_IUI_V3F_EXT', 'GL_T2F_IUI_N3F_V2F_EXT', 'GL_T2F_IUI_N3F_V3F_EXT',
+'GL_ARRAY_ELEMENT_LOCK_FIRST_EXT', 'GL_ARRAY_ELEMENT_LOCK_COUNT_EXT',
+'GL_CULL_VERTEX_EXT', 'GL_CULL_VERTEX_EYE_POSITION_EXT',
+'GL_CULL_VERTEX_OBJECT_POSITION_EXT', 'GL_YCRCB_422_SGIX',
+'GL_YCRCB_444_SGIX', 'GL_FRAGMENT_LIGHTING_SGIX',
+'GL_FRAGMENT_COLOR_MATERIAL_SGIX', 'GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX',
+'GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX', 'GL_MAX_FRAGMENT_LIGHTS_SGIX',
+'GL_MAX_ACTIVE_LIGHTS_SGIX', 'GL_CURRENT_RASTER_NORMAL_SGIX',
+'GL_LIGHT_ENV_MODE_SGIX', 'GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX',
+'GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX',
+'GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX',
+'GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX',
+'GL_FRAGMENT_LIGHT0_SGIX', 'GL_FRAGMENT_LIGHT1_SGIX',
+'GL_FRAGMENT_LIGHT2_SGIX', 'GL_FRAGMENT_LIGHT3_SGIX',
+'GL_FRAGMENT_LIGHT4_SGIX', 'GL_FRAGMENT_LIGHT5_SGIX',
+'GL_FRAGMENT_LIGHT6_SGIX', 'GL_FRAGMENT_LIGHT7_SGIX',
+'GL_RASTER_POSITION_UNCLIPPED_IBM', 'GL_TEXTURE_LIGHTING_MODE_HP',
+'GL_TEXTURE_POST_SPECULAR_HP', 'GL_TEXTURE_PRE_SPECULAR_HP',
+'GL_MAX_ELEMENTS_VERTICES_EXT', 'GL_MAX_ELEMENTS_INDICES_EXT', 'GL_PHONG_WIN',
+'GL_PHONG_HINT_WIN', 'GL_FOG_SPECULAR_TEXTURE_WIN',
+'GL_FRAGMENT_MATERIAL_EXT', 'GL_FRAGMENT_NORMAL_EXT', 'GL_FRAGMENT_COLOR_EXT',
+'GL_ATTENUATION_EXT', 'GL_SHADOW_ATTENUATION_EXT',
+'GL_TEXTURE_APPLICATION_MODE_EXT', 'GL_TEXTURE_LIGHT_EXT',
+'GL_TEXTURE_MATERIAL_FACE_EXT', 'GL_TEXTURE_MATERIAL_PARAMETER_EXT',
+'GL_ALPHA_MIN_SGIX', 'GL_ALPHA_MAX_SGIX', 'GL_PIXEL_TEX_GEN_Q_CEILING_SGIX',
+'GL_PIXEL_TEX_GEN_Q_ROUND_SGIX', 'GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX',
+'GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX',
+'GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX', 'GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX',
+'GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX', 'GL_BGR_EXT', 'GL_BGRA_EXT',
+'GL_ASYNC_MARKER_SGIX', 'GL_ASYNC_TEX_IMAGE_SGIX',
+'GL_ASYNC_DRAW_PIXELS_SGIX', 'GL_ASYNC_READ_PIXELS_SGIX',
+'GL_MAX_ASYNC_TEX_IMAGE_SGIX', 'GL_MAX_ASYNC_DRAW_PIXELS_SGIX',
+'GL_MAX_ASYNC_READ_PIXELS_SGIX', 'GL_ASYNC_HISTOGRAM_SGIX',
+'GL_MAX_ASYNC_HISTOGRAM_SGIX', 'GL_PARALLEL_ARRAYS_INTEL',
+'GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL',
+'GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL',
+'GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL',
+'GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL', 'GL_OCCLUSION_TEST_HP',
+'GL_OCCLUSION_TEST_RESULT_HP', 'GL_PIXEL_TRANSFORM_2D_EXT',
+'GL_PIXEL_MAG_FILTER_EXT', 'GL_PIXEL_MIN_FILTER_EXT',
+'GL_PIXEL_CUBIC_WEIGHT_EXT', 'GL_CUBIC_EXT', 'GL_AVERAGE_EXT',
+'GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT',
+'GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT',
+'GL_PIXEL_TRANSFORM_2D_MATRIX_EXT', 'GL_SHARED_TEXTURE_PALETTE_EXT',
+'GL_LIGHT_MODEL_COLOR_CONTROL_EXT', 'GL_SINGLE_COLOR_EXT',
+'GL_SEPARATE_SPECULAR_COLOR_EXT', 'GL_COLOR_SUM_EXT',
+'GL_CURRENT_SECONDARY_COLOR_EXT', 'GL_SECONDARY_COLOR_ARRAY_SIZE_EXT',
+'GL_SECONDARY_COLOR_ARRAY_TYPE_EXT', 'GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT',
+'GL_SECONDARY_COLOR_ARRAY_POINTER_EXT', 'GL_SECONDARY_COLOR_ARRAY_EXT',
+'GL_PERTURB_EXT', 'GL_TEXTURE_NORMAL_EXT', 'GL_FOG_COORDINATE_SOURCE_EXT',
+'GL_FOG_COORDINATE_EXT', 'GL_FRAGMENT_DEPTH_EXT',
+'GL_CURRENT_FOG_COORDINATE_EXT', 'GL_FOG_COORDINATE_ARRAY_TYPE_EXT',
+'GL_FOG_COORDINATE_ARRAY_STRIDE_EXT', 'GL_FOG_COORDINATE_ARRAY_POINTER_EXT',
+'GL_FOG_COORDINATE_ARRAY_EXT', 'GL_SCREEN_COORDINATES_REND',
+'GL_INVERTED_SCREEN_W_REND', 'GL_TANGENT_ARRAY_EXT', 'GL_BINORMAL_ARRAY_EXT',
+'GL_CURRENT_TANGENT_EXT', 'GL_CURRENT_BINORMAL_EXT',
+'GL_TANGENT_ARRAY_TYPE_EXT', 'GL_TANGENT_ARRAY_STRIDE_EXT',
+'GL_BINORMAL_ARRAY_TYPE_EXT', 'GL_BINORMAL_ARRAY_STRIDE_EXT',
+'GL_TANGENT_ARRAY_POINTER_EXT', 'GL_BINORMAL_ARRAY_POINTER_EXT',
+'GL_MAP1_TANGENT_EXT', 'GL_MAP2_TANGENT_EXT', 'GL_MAP1_BINORMAL_EXT',
+'GL_MAP2_BINORMAL_EXT', 'GL_COMBINE_EXT', 'GL_COMBINE_RGB_EXT',
+'GL_COMBINE_ALPHA_EXT', 'GL_RGB_SCALE_EXT', 'GL_ADD_SIGNED_EXT',
+'GL_INTERPOLATE_EXT', 'GL_CONSTANT_EXT', 'GL_PRIMARY_COLOR_EXT',
+'GL_PREVIOUS_EXT', 'GL_SOURCE0_RGB_EXT', 'GL_SOURCE1_RGB_EXT',
+'GL_SOURCE2_RGB_EXT', 'GL_SOURCE0_ALPHA_EXT', 'GL_SOURCE1_ALPHA_EXT',
+'GL_SOURCE2_ALPHA_EXT', 'GL_OPERAND0_RGB_EXT', 'GL_OPERAND1_RGB_EXT',
+'GL_OPERAND2_RGB_EXT', 'GL_OPERAND0_ALPHA_EXT', 'GL_OPERAND1_ALPHA_EXT',
+'GL_OPERAND2_ALPHA_EXT', 'GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE',
+'GL_TRANSFORM_HINT_APPLE', 'GL_FOG_SCALE_SGIX', 'GL_FOG_SCALE_VALUE_SGIX',
+'GL_UNPACK_CONSTANT_DATA_SUNX', 'GL_TEXTURE_CONSTANT_DATA_SUNX',
+'GL_GLOBAL_ALPHA_SUN', 'GL_GLOBAL_ALPHA_FACTOR_SUN', 'GL_RESTART_SUN',
+'GL_REPLACE_MIDDLE_SUN', 'GL_REPLACE_OLDEST_SUN', 'GL_TRIANGLE_LIST_SUN',
+'GL_REPLACEMENT_CODE_SUN', 'GL_REPLACEMENT_CODE_ARRAY_SUN',
+'GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN', 'GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN',
+'GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN', 'GL_R1UI_V3F_SUN',
+'GL_R1UI_C4UB_V3F_SUN', 'GL_R1UI_C3F_V3F_SUN', 'GL_R1UI_N3F_V3F_SUN',
+'GL_R1UI_C4F_N3F_V3F_SUN', 'GL_R1UI_T2F_V3F_SUN', 'GL_R1UI_T2F_N3F_V3F_SUN',
+'GL_R1UI_T2F_C4F_N3F_V3F_SUN', 'GL_BLEND_DST_RGB_EXT', 'GL_BLEND_SRC_RGB_EXT',
+'GL_BLEND_DST_ALPHA_EXT', 'GL_BLEND_SRC_ALPHA_EXT', 'GL_RED_MIN_CLAMP_INGR',
+'GL_GREEN_MIN_CLAMP_INGR', 'GL_BLUE_MIN_CLAMP_INGR',
+'GL_ALPHA_MIN_CLAMP_INGR', 'GL_RED_MAX_CLAMP_INGR', 'GL_GREEN_MAX_CLAMP_INGR',
+'GL_BLUE_MAX_CLAMP_INGR', 'GL_ALPHA_MAX_CLAMP_INGR', 'GL_INTERLACE_READ_INGR',
+'GL_INCR_WRAP_EXT', 'GL_DECR_WRAP_EXT', 'GL_422_EXT', 'GL_422_REV_EXT',
+'GL_422_AVERAGE_EXT', 'GL_422_REV_AVERAGE_EXT', 'GL_NORMAL_MAP_NV',
+'GL_REFLECTION_MAP_NV', 'GL_NORMAL_MAP_EXT', 'GL_REFLECTION_MAP_EXT',
+'GL_TEXTURE_CUBE_MAP_EXT', 'GL_TEXTURE_BINDING_CUBE_MAP_EXT',
+'GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT', 'GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT',
+'GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT', 'GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT',
+'GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT', 'GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT',
+'GL_PROXY_TEXTURE_CUBE_MAP_EXT', 'GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT',
+'GL_WRAP_BORDER_SUN', 'GL_MAX_TEXTURE_LOD_BIAS_EXT',
+'GL_TEXTURE_FILTER_CONTROL_EXT', 'GL_TEXTURE_LOD_BIAS_EXT',
+'GL_TEXTURE_MAX_ANISOTROPY_EXT', 'GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT',
+'GL_MODELVIEW0_STACK_DEPTH_EXT', 'GL_MODELVIEW1_STACK_DEPTH_EXT',
+'GL_MODELVIEW0_MATRIX_EXT', 'GL_MODELVIEW1_MATRIX_EXT',
+'GL_VERTEX_WEIGHTING_EXT', 'GL_MODELVIEW0_EXT', 'GL_MODELVIEW1_EXT',
+'GL_CURRENT_VERTEX_WEIGHT_EXT', 'GL_VERTEX_WEIGHT_ARRAY_EXT',
+'GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT', 'GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT',
+'GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT', 'GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT',
+'GL_MAX_SHININESS_NV', 'GL_MAX_SPOT_EXPONENT_NV', 'GL_VERTEX_ARRAY_RANGE_NV',
+'GL_VERTEX_ARRAY_RANGE_LENGTH_NV', 'GL_VERTEX_ARRAY_RANGE_VALID_NV',
+'GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV', 'GL_VERTEX_ARRAY_RANGE_POINTER_NV',
+'GL_REGISTER_COMBINERS_NV', 'GL_VARIABLE_A_NV', 'GL_VARIABLE_B_NV',
+'GL_VARIABLE_C_NV', 'GL_VARIABLE_D_NV', 'GL_VARIABLE_E_NV',
+'GL_VARIABLE_F_NV', 'GL_VARIABLE_G_NV', 'GL_CONSTANT_COLOR0_NV',
+'GL_CONSTANT_COLOR1_NV', 'GL_PRIMARY_COLOR_NV', 'GL_SECONDARY_COLOR_NV',
+'GL_SPARE0_NV', 'GL_SPARE1_NV', 'GL_DISCARD_NV', 'GL_E_TIMES_F_NV',
+'GL_SPARE0_PLUS_SECONDARY_COLOR_NV', 'GL_UNSIGNED_IDENTITY_NV',
+'GL_UNSIGNED_INVERT_NV', 'GL_EXPAND_NORMAL_NV', 'GL_EXPAND_NEGATE_NV',
+'GL_HALF_BIAS_NORMAL_NV', 'GL_HALF_BIAS_NEGATE_NV', 'GL_SIGNED_IDENTITY_NV',
+'GL_SIGNED_NEGATE_NV', 'GL_SCALE_BY_TWO_NV', 'GL_SCALE_BY_FOUR_NV',
+'GL_SCALE_BY_ONE_HALF_NV', 'GL_BIAS_BY_NEGATIVE_ONE_HALF_NV',
+'GL_COMBINER_INPUT_NV', 'GL_COMBINER_MAPPING_NV',
+'GL_COMBINER_COMPONENT_USAGE_NV', 'GL_COMBINER_AB_DOT_PRODUCT_NV',
+'GL_COMBINER_CD_DOT_PRODUCT_NV', 'GL_COMBINER_MUX_SUM_NV',
+'GL_COMBINER_SCALE_NV', 'GL_COMBINER_BIAS_NV', 'GL_COMBINER_AB_OUTPUT_NV',
+'GL_COMBINER_CD_OUTPUT_NV', 'GL_COMBINER_SUM_OUTPUT_NV',
+'GL_MAX_GENERAL_COMBINERS_NV', 'GL_NUM_GENERAL_COMBINERS_NV',
+'GL_COLOR_SUM_CLAMP_NV', 'GL_COMBINER0_NV', 'GL_COMBINER1_NV',
+'GL_COMBINER2_NV', 'GL_COMBINER3_NV', 'GL_COMBINER4_NV', 'GL_COMBINER5_NV',
+'GL_COMBINER6_NV', 'GL_COMBINER7_NV', 'GL_FOG_DISTANCE_MODE_NV',
+'GL_EYE_RADIAL_NV', 'GL_EYE_PLANE_ABSOLUTE_NV', 'GL_EMBOSS_LIGHT_NV',
+'GL_EMBOSS_CONSTANT_NV', 'GL_EMBOSS_MAP_NV', 'GL_COMBINE4_NV',
+'GL_SOURCE3_RGB_NV', 'GL_SOURCE3_ALPHA_NV', 'GL_OPERAND3_RGB_NV',
+'GL_OPERAND3_ALPHA_NV', 'GL_COMPRESSED_RGB_S3TC_DXT1_EXT',
+'GL_COMPRESSED_RGBA_S3TC_DXT1_EXT', 'GL_COMPRESSED_RGBA_S3TC_DXT3_EXT',
+'GL_COMPRESSED_RGBA_S3TC_DXT5_EXT', 'GL_CULL_VERTEX_IBM',
+'GL_VERTEX_ARRAY_LIST_IBM', 'GL_NORMAL_ARRAY_LIST_IBM',
+'GL_COLOR_ARRAY_LIST_IBM', 'GL_INDEX_ARRAY_LIST_IBM',
+'GL_TEXTURE_COORD_ARRAY_LIST_IBM', 'GL_EDGE_FLAG_ARRAY_LIST_IBM',
+'GL_FOG_COORDINATE_ARRAY_LIST_IBM', 'GL_SECONDARY_COLOR_ARRAY_LIST_IBM',
+'GL_VERTEX_ARRAY_LIST_STRIDE_IBM', 'GL_NORMAL_ARRAY_LIST_STRIDE_IBM',
+'GL_COLOR_ARRAY_LIST_STRIDE_IBM', 'GL_INDEX_ARRAY_LIST_STRIDE_IBM',
+'GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM',
+'GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM',
+'GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM',
+'GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM', 'GL_PACK_SUBSAMPLE_RATE_SGIX',
+'GL_UNPACK_SUBSAMPLE_RATE_SGIX', 'GL_PIXEL_SUBSAMPLE_4444_SGIX',
+'GL_PIXEL_SUBSAMPLE_2424_SGIX', 'GL_PIXEL_SUBSAMPLE_4242_SGIX',
+'GL_YCRCB_SGIX', 'GL_YCRCBA_SGIX', 'GL_DEPTH_PASS_INSTRUMENT_SGIX',
+'GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX', 'GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX',
+'GL_COMPRESSED_RGB_FXT1_3DFX', 'GL_COMPRESSED_RGBA_FXT1_3DFX',
+'GL_MULTISAMPLE_3DFX', 'GL_SAMPLE_BUFFERS_3DFX', 'GL_SAMPLES_3DFX',
+'GL_MULTISAMPLE_BIT_3DFX', 'GL_MULTISAMPLE_EXT',
+'GL_SAMPLE_ALPHA_TO_MASK_EXT', 'GL_SAMPLE_ALPHA_TO_ONE_EXT',
+'GL_SAMPLE_MASK_EXT', 'GL_1PASS_EXT', 'GL_2PASS_0_EXT', 'GL_2PASS_1_EXT',
+'GL_4PASS_0_EXT', 'GL_4PASS_1_EXT', 'GL_4PASS_2_EXT', 'GL_4PASS_3_EXT',
+'GL_SAMPLE_BUFFERS_EXT', 'GL_SAMPLES_EXT', 'GL_SAMPLE_MASK_VALUE_EXT',
+'GL_SAMPLE_MASK_INVERT_EXT', 'GL_SAMPLE_PATTERN_EXT',
+'GL_MULTISAMPLE_BIT_EXT', 'GL_VERTEX_PRECLIP_SGIX',
+'GL_VERTEX_PRECLIP_HINT_SGIX', 'GL_CONVOLUTION_HINT_SGIX',
+'GL_PACK_RESAMPLE_SGIX', 'GL_UNPACK_RESAMPLE_SGIX',
+'GL_RESAMPLE_REPLICATE_SGIX', 'GL_RESAMPLE_ZERO_FILL_SGIX',
+'GL_RESAMPLE_DECIMATE_SGIX', 'GL_EYE_DISTANCE_TO_POINT_SGIS',
+'GL_OBJECT_DISTANCE_TO_POINT_SGIS', 'GL_EYE_DISTANCE_TO_LINE_SGIS',
+'GL_OBJECT_DISTANCE_TO_LINE_SGIS', 'GL_EYE_POINT_SGIS',
+'GL_OBJECT_POINT_SGIS', 'GL_EYE_LINE_SGIS', 'GL_OBJECT_LINE_SGIS',
+'GL_TEXTURE_COLOR_WRITEMASK_SGIS', 'GL_DOT3_RGB_EXT', 'GL_DOT3_RGBA_EXT',
+'GL_MIRROR_CLAMP_ATI', 'GL_MIRROR_CLAMP_TO_EDGE_ATI', 'GL_ALL_COMPLETED_NV',
+'GL_FENCE_STATUS_NV', 'GL_FENCE_CONDITION_NV', 'GL_MIRRORED_REPEAT_IBM',
+'GL_EVAL_2D_NV', 'GL_EVAL_TRIANGULAR_2D_NV', 'GL_MAP_TESSELLATION_NV',
+'GL_MAP_ATTRIB_U_ORDER_NV', 'GL_MAP_ATTRIB_V_ORDER_NV',
+'GL_EVAL_FRACTIONAL_TESSELLATION_NV', 'GL_EVAL_VERTEX_ATTRIB0_NV',
+'GL_EVAL_VERTEX_ATTRIB1_NV', 'GL_EVAL_VERTEX_ATTRIB2_NV',
+'GL_EVAL_VERTEX_ATTRIB3_NV', 'GL_EVAL_VERTEX_ATTRIB4_NV',
+'GL_EVAL_VERTEX_ATTRIB5_NV', 'GL_EVAL_VERTEX_ATTRIB6_NV',
+'GL_EVAL_VERTEX_ATTRIB7_NV', 'GL_EVAL_VERTEX_ATTRIB8_NV',
+'GL_EVAL_VERTEX_ATTRIB9_NV', 'GL_EVAL_VERTEX_ATTRIB10_NV',
+'GL_EVAL_VERTEX_ATTRIB11_NV', 'GL_EVAL_VERTEX_ATTRIB12_NV',
+'GL_EVAL_VERTEX_ATTRIB13_NV', 'GL_EVAL_VERTEX_ATTRIB14_NV',
+'GL_EVAL_VERTEX_ATTRIB15_NV', 'GL_MAX_MAP_TESSELLATION_NV',
+'GL_MAX_RATIONAL_EVAL_ORDER_NV', 'GL_DEPTH_STENCIL_NV',
+'GL_UNSIGNED_INT_24_8_NV', 'GL_DEPTH_STENCIL_EXT', 'GL_DEPTH24_STENCIL8_EXT',
+'GL_TEXTURE_STENCIL_SIZE_EXT', 'GL_UNSIGNED_INT_24_8_EXT',
+'GL_PER_STAGE_CONSTANTS_NV', 'GL_TEXTURE_RECTANGLE_NV',
+'GL_TEXTURE_BINDING_RECTANGLE_NV', 'GL_PROXY_TEXTURE_RECTANGLE_NV',
+'GL_MAX_RECTANGLE_TEXTURE_SIZE_NV', 'GL_OFFSET_TEXTURE_RECTANGLE_NV',
+'GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV', 'GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV',
+'GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV', 'GL_UNSIGNED_INT_S8_S8_8_8_NV',
+'GL_UNSIGNED_INT_8_8_S8_S8_REV_NV', 'GL_DSDT_MAG_INTENSITY_NV',
+'GL_SHADER_CONSISTENT_NV', 'GL_TEXTURE_SHADER_NV', 'GL_SHADER_OPERATION_NV',
+'GL_CULL_MODES_NV', 'GL_OFFSET_TEXTURE_MATRIX_NV',
+'GL_OFFSET_TEXTURE_SCALE_NV', 'GL_OFFSET_TEXTURE_BIAS_NV',
+'GL_OFFSET_TEXTURE_2D_MATRIX_NV', 'GL_OFFSET_TEXTURE_2D_SCALE_NV',
+'GL_OFFSET_TEXTURE_2D_BIAS_NV', 'GL_PREVIOUS_TEXTURE_INPUT_NV',
+'GL_CONST_EYE_NV', 'GL_PASS_THROUGH_NV', 'GL_CULL_FRAGMENT_NV',
+'GL_OFFSET_TEXTURE_2D_NV', 'GL_DEPENDENT_AR_TEXTURE_2D_NV',
+'GL_DEPENDENT_GB_TEXTURE_2D_NV', 'GL_DOT_PRODUCT_NV',
+'GL_DOT_PRODUCT_DEPTH_REPLACE_NV', 'GL_DOT_PRODUCT_TEXTURE_2D_NV',
+'GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV', 'GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV',
+'GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV',
+'GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV', 'GL_HILO_NV', 'GL_DSDT_NV',
+'GL_DSDT_MAG_NV', 'GL_DSDT_MAG_VIB_NV', 'GL_HILO16_NV', 'GL_SIGNED_HILO_NV',
+'GL_SIGNED_HILO16_NV', 'GL_SIGNED_RGBA_NV', 'GL_SIGNED_RGBA8_NV',
+'GL_SIGNED_RGB_NV', 'GL_SIGNED_RGB8_NV', 'GL_SIGNED_LUMINANCE_NV',
+'GL_SIGNED_LUMINANCE8_NV', 'GL_SIGNED_LUMINANCE_ALPHA_NV',
+'GL_SIGNED_LUMINANCE8_ALPHA8_NV', 'GL_SIGNED_ALPHA_NV', 'GL_SIGNED_ALPHA8_NV',
+'GL_SIGNED_INTENSITY_NV', 'GL_SIGNED_INTENSITY8_NV', 'GL_DSDT8_NV',
+'GL_DSDT8_MAG8_NV', 'GL_DSDT8_MAG8_INTENSITY8_NV',
+'GL_SIGNED_RGB_UNSIGNED_ALPHA_NV', 'GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV',
+'GL_HI_SCALE_NV', 'GL_LO_SCALE_NV', 'GL_DS_SCALE_NV', 'GL_DT_SCALE_NV',
+'GL_MAGNITUDE_SCALE_NV', 'GL_VIBRANCE_SCALE_NV', 'GL_HI_BIAS_NV',
+'GL_LO_BIAS_NV', 'GL_DS_BIAS_NV', 'GL_DT_BIAS_NV', 'GL_MAGNITUDE_BIAS_NV',
+'GL_VIBRANCE_BIAS_NV', 'GL_TEXTURE_BORDER_VALUES_NV', 'GL_TEXTURE_HI_SIZE_NV',
+'GL_TEXTURE_LO_SIZE_NV', 'GL_TEXTURE_DS_SIZE_NV', 'GL_TEXTURE_DT_SIZE_NV',
+'GL_TEXTURE_MAG_SIZE_NV', 'GL_DOT_PRODUCT_TEXTURE_3D_NV',
+'GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV', 'GL_VERTEX_PROGRAM_NV',
+'GL_VERTEX_STATE_PROGRAM_NV', 'GL_ATTRIB_ARRAY_SIZE_NV',
+'GL_ATTRIB_ARRAY_STRIDE_NV', 'GL_ATTRIB_ARRAY_TYPE_NV',
+'GL_CURRENT_ATTRIB_NV', 'GL_PROGRAM_LENGTH_NV', 'GL_PROGRAM_STRING_NV',
+'GL_MODELVIEW_PROJECTION_NV', 'GL_IDENTITY_NV', 'GL_INVERSE_NV',
+'GL_TRANSPOSE_NV', 'GL_INVERSE_TRANSPOSE_NV',
+'GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV', 'GL_MAX_TRACK_MATRICES_NV',
+'GL_MATRIX0_NV', 'GL_MATRIX1_NV', 'GL_MATRIX2_NV', 'GL_MATRIX3_NV',
+'GL_MATRIX4_NV', 'GL_MATRIX5_NV', 'GL_MATRIX6_NV', 'GL_MATRIX7_NV',
+'GL_CURRENT_MATRIX_STACK_DEPTH_NV', 'GL_CURRENT_MATRIX_NV',
+'GL_VERTEX_PROGRAM_POINT_SIZE_NV', 'GL_VERTEX_PROGRAM_TWO_SIDE_NV',
+'GL_PROGRAM_PARAMETER_NV', 'GL_ATTRIB_ARRAY_POINTER_NV',
+'GL_PROGRAM_TARGET_NV', 'GL_PROGRAM_RESIDENT_NV', 'GL_TRACK_MATRIX_NV',
+'GL_TRACK_MATRIX_TRANSFORM_NV', 'GL_VERTEX_PROGRAM_BINDING_NV',
+'GL_PROGRAM_ERROR_POSITION_NV', 'GL_VERTEX_ATTRIB_ARRAY0_NV',
+'GL_VERTEX_ATTRIB_ARRAY1_NV', 'GL_VERTEX_ATTRIB_ARRAY2_NV',
+'GL_VERTEX_ATTRIB_ARRAY3_NV', 'GL_VERTEX_ATTRIB_ARRAY4_NV',
+'GL_VERTEX_ATTRIB_ARRAY5_NV', 'GL_VERTEX_ATTRIB_ARRAY6_NV',
+'GL_VERTEX_ATTRIB_ARRAY7_NV', 'GL_VERTEX_ATTRIB_ARRAY8_NV',
+'GL_VERTEX_ATTRIB_ARRAY9_NV', 'GL_VERTEX_ATTRIB_ARRAY10_NV',
+'GL_VERTEX_ATTRIB_ARRAY11_NV', 'GL_VERTEX_ATTRIB_ARRAY12_NV',
+'GL_VERTEX_ATTRIB_ARRAY13_NV', 'GL_VERTEX_ATTRIB_ARRAY14_NV',
+'GL_VERTEX_ATTRIB_ARRAY15_NV', 'GL_MAP1_VERTEX_ATTRIB0_4_NV',
+'GL_MAP1_VERTEX_ATTRIB1_4_NV', 'GL_MAP1_VERTEX_ATTRIB2_4_NV',
+'GL_MAP1_VERTEX_ATTRIB3_4_NV', 'GL_MAP1_VERTEX_ATTRIB4_4_NV',
+'GL_MAP1_VERTEX_ATTRIB5_4_NV', 'GL_MAP1_VERTEX_ATTRIB6_4_NV',
+'GL_MAP1_VERTEX_ATTRIB7_4_NV', 'GL_MAP1_VERTEX_ATTRIB8_4_NV',
+'GL_MAP1_VERTEX_ATTRIB9_4_NV', 'GL_MAP1_VERTEX_ATTRIB10_4_NV',
+'GL_MAP1_VERTEX_ATTRIB11_4_NV', 'GL_MAP1_VERTEX_ATTRIB12_4_NV',
+'GL_MAP1_VERTEX_ATTRIB13_4_NV', 'GL_MAP1_VERTEX_ATTRIB14_4_NV',
+'GL_MAP1_VERTEX_ATTRIB15_4_NV', 'GL_MAP2_VERTEX_ATTRIB0_4_NV',
+'GL_MAP2_VERTEX_ATTRIB1_4_NV', 'GL_MAP2_VERTEX_ATTRIB2_4_NV',
+'GL_MAP2_VERTEX_ATTRIB3_4_NV', 'GL_MAP2_VERTEX_ATTRIB4_4_NV',
+'GL_MAP2_VERTEX_ATTRIB5_4_NV', 'GL_MAP2_VERTEX_ATTRIB6_4_NV',
+'GL_MAP2_VERTEX_ATTRIB7_4_NV', 'GL_MAP2_VERTEX_ATTRIB8_4_NV',
+'GL_MAP2_VERTEX_ATTRIB9_4_NV', 'GL_MAP2_VERTEX_ATTRIB10_4_NV',
+'GL_MAP2_VERTEX_ATTRIB11_4_NV', 'GL_MAP2_VERTEX_ATTRIB12_4_NV',
+'GL_MAP2_VERTEX_ATTRIB13_4_NV', 'GL_MAP2_VERTEX_ATTRIB14_4_NV',
+'GL_MAP2_VERTEX_ATTRIB15_4_NV', 'GL_TEXTURE_MAX_CLAMP_S_SGIX',
+'GL_TEXTURE_MAX_CLAMP_T_SGIX', 'GL_TEXTURE_MAX_CLAMP_R_SGIX',
+'GL_SCALEBIAS_HINT_SGIX', 'GL_INTERLACE_OML', 'GL_INTERLACE_READ_OML',
+'GL_FORMAT_SUBSAMPLE_24_24_OML', 'GL_FORMAT_SUBSAMPLE_244_244_OML',
+'GL_PACK_RESAMPLE_OML', 'GL_UNPACK_RESAMPLE_OML', 'GL_RESAMPLE_REPLICATE_OML',
+'GL_RESAMPLE_ZERO_FILL_OML', 'GL_RESAMPLE_AVERAGE_OML',
+'GL_RESAMPLE_DECIMATE_OML', 'GL_DEPTH_STENCIL_TO_RGBA_NV',
+'GL_DEPTH_STENCIL_TO_BGRA_NV', 'GL_BUMP_ROT_MATRIX_ATI',
+'GL_BUMP_ROT_MATRIX_SIZE_ATI', 'GL_BUMP_NUM_TEX_UNITS_ATI',
+'GL_BUMP_TEX_UNITS_ATI', 'GL_DUDV_ATI', 'GL_DU8DV8_ATI', 'GL_BUMP_ENVMAP_ATI',
+'GL_BUMP_TARGET_ATI', 'GL_FRAGMENT_SHADER_ATI', 'GL_REG_0_ATI',
+'GL_REG_1_ATI', 'GL_REG_2_ATI', 'GL_REG_3_ATI', 'GL_REG_4_ATI',
+'GL_REG_5_ATI', 'GL_REG_6_ATI', 'GL_REG_7_ATI', 'GL_REG_8_ATI',
+'GL_REG_9_ATI', 'GL_REG_10_ATI', 'GL_REG_11_ATI', 'GL_REG_12_ATI',
+'GL_REG_13_ATI', 'GL_REG_14_ATI', 'GL_REG_15_ATI', 'GL_REG_16_ATI',
+'GL_REG_17_ATI', 'GL_REG_18_ATI', 'GL_REG_19_ATI', 'GL_REG_20_ATI',
+'GL_REG_21_ATI', 'GL_REG_22_ATI', 'GL_REG_23_ATI', 'GL_REG_24_ATI',
+'GL_REG_25_ATI', 'GL_REG_26_ATI', 'GL_REG_27_ATI', 'GL_REG_28_ATI',
+'GL_REG_29_ATI', 'GL_REG_30_ATI', 'GL_REG_31_ATI', 'GL_CON_0_ATI',
+'GL_CON_1_ATI', 'GL_CON_2_ATI', 'GL_CON_3_ATI', 'GL_CON_4_ATI',
+'GL_CON_5_ATI', 'GL_CON_6_ATI', 'GL_CON_7_ATI', 'GL_CON_8_ATI',
+'GL_CON_9_ATI', 'GL_CON_10_ATI', 'GL_CON_11_ATI', 'GL_CON_12_ATI',
+'GL_CON_13_ATI', 'GL_CON_14_ATI', 'GL_CON_15_ATI', 'GL_CON_16_ATI',
+'GL_CON_17_ATI', 'GL_CON_18_ATI', 'GL_CON_19_ATI', 'GL_CON_20_ATI',
+'GL_CON_21_ATI', 'GL_CON_22_ATI', 'GL_CON_23_ATI', 'GL_CON_24_ATI',
+'GL_CON_25_ATI', 'GL_CON_26_ATI', 'GL_CON_27_ATI', 'GL_CON_28_ATI',
+'GL_CON_29_ATI', 'GL_CON_30_ATI', 'GL_CON_31_ATI', 'GL_MOV_ATI', 'GL_ADD_ATI',
+'GL_MUL_ATI', 'GL_SUB_ATI', 'GL_DOT3_ATI', 'GL_DOT4_ATI', 'GL_MAD_ATI',
+'GL_LERP_ATI', 'GL_CND_ATI', 'GL_CND0_ATI', 'GL_DOT2_ADD_ATI',
+'GL_SECONDARY_INTERPOLATOR_ATI', 'GL_NUM_FRAGMENT_REGISTERS_ATI',
+'GL_NUM_FRAGMENT_CONSTANTS_ATI', 'GL_NUM_PASSES_ATI',
+'GL_NUM_INSTRUCTIONS_PER_PASS_ATI', 'GL_NUM_INSTRUCTIONS_TOTAL_ATI',
+'GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI', 'GL_NUM_LOOPBACK_COMPONENTS_ATI',
+'GL_COLOR_ALPHA_PAIRING_ATI', 'GL_SWIZZLE_STR_ATI', 'GL_SWIZZLE_STQ_ATI',
+'GL_SWIZZLE_STR_DR_ATI', 'GL_SWIZZLE_STQ_DQ_ATI', 'GL_SWIZZLE_STRQ_ATI',
+'GL_SWIZZLE_STRQ_DQ_ATI', 'GL_RED_BIT_ATI', 'GL_GREEN_BIT_ATI',
+'GL_BLUE_BIT_ATI', 'GL_2X_BIT_ATI', 'GL_4X_BIT_ATI', 'GL_8X_BIT_ATI',
+'GL_HALF_BIT_ATI', 'GL_QUARTER_BIT_ATI', 'GL_EIGHTH_BIT_ATI',
+'GL_SATURATE_BIT_ATI', 'GL_COMP_BIT_ATI', 'GL_NEGATE_BIT_ATI',
+'GL_BIAS_BIT_ATI', 'GL_PN_TRIANGLES_ATI',
+'GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI', 'GL_PN_TRIANGLES_POINT_MODE_ATI',
+'GL_PN_TRIANGLES_NORMAL_MODE_ATI', 'GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI',
+'GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI',
+'GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI',
+'GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI',
+'GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI', 'GL_STATIC_ATI',
+'GL_DYNAMIC_ATI', 'GL_PRESERVE_ATI', 'GL_DISCARD_ATI',
+'GL_OBJECT_BUFFER_SIZE_ATI', 'GL_OBJECT_BUFFER_USAGE_ATI',
+'GL_ARRAY_OBJECT_BUFFER_ATI', 'GL_ARRAY_OBJECT_OFFSET_ATI',
+'GL_VERTEX_SHADER_EXT', 'GL_VERTEX_SHADER_BINDING_EXT', 'GL_OP_INDEX_EXT',
+'GL_OP_NEGATE_EXT', 'GL_OP_DOT3_EXT', 'GL_OP_DOT4_EXT', 'GL_OP_MUL_EXT',
+'GL_OP_ADD_EXT', 'GL_OP_MADD_EXT', 'GL_OP_FRAC_EXT', 'GL_OP_MAX_EXT',
+'GL_OP_MIN_EXT', 'GL_OP_SET_GE_EXT', 'GL_OP_SET_LT_EXT', 'GL_OP_CLAMP_EXT',
+'GL_OP_FLOOR_EXT', 'GL_OP_ROUND_EXT', 'GL_OP_EXP_BASE_2_EXT',
+'GL_OP_LOG_BASE_2_EXT', 'GL_OP_POWER_EXT', 'GL_OP_RECIP_EXT',
+'GL_OP_RECIP_SQRT_EXT', 'GL_OP_SUB_EXT', 'GL_OP_CROSS_PRODUCT_EXT',
+'GL_OP_MULTIPLY_MATRIX_EXT', 'GL_OP_MOV_EXT', 'GL_OUTPUT_VERTEX_EXT',
+'GL_OUTPUT_COLOR0_EXT', 'GL_OUTPUT_COLOR1_EXT',
+'GL_OUTPUT_TEXTURE_COORD0_EXT', 'GL_OUTPUT_TEXTURE_COORD1_EXT',
+'GL_OUTPUT_TEXTURE_COORD2_EXT', 'GL_OUTPUT_TEXTURE_COORD3_EXT',
+'GL_OUTPUT_TEXTURE_COORD4_EXT', 'GL_OUTPUT_TEXTURE_COORD5_EXT',
+'GL_OUTPUT_TEXTURE_COORD6_EXT', 'GL_OUTPUT_TEXTURE_COORD7_EXT',
+'GL_OUTPUT_TEXTURE_COORD8_EXT', 'GL_OUTPUT_TEXTURE_COORD9_EXT',
+'GL_OUTPUT_TEXTURE_COORD10_EXT', 'GL_OUTPUT_TEXTURE_COORD11_EXT',
+'GL_OUTPUT_TEXTURE_COORD12_EXT', 'GL_OUTPUT_TEXTURE_COORD13_EXT',
+'GL_OUTPUT_TEXTURE_COORD14_EXT', 'GL_OUTPUT_TEXTURE_COORD15_EXT',
+'GL_OUTPUT_TEXTURE_COORD16_EXT', 'GL_OUTPUT_TEXTURE_COORD17_EXT',
+'GL_OUTPUT_TEXTURE_COORD18_EXT', 'GL_OUTPUT_TEXTURE_COORD19_EXT',
+'GL_OUTPUT_TEXTURE_COORD20_EXT', 'GL_OUTPUT_TEXTURE_COORD21_EXT',
+'GL_OUTPUT_TEXTURE_COORD22_EXT', 'GL_OUTPUT_TEXTURE_COORD23_EXT',
+'GL_OUTPUT_TEXTURE_COORD24_EXT', 'GL_OUTPUT_TEXTURE_COORD25_EXT',
+'GL_OUTPUT_TEXTURE_COORD26_EXT', 'GL_OUTPUT_TEXTURE_COORD27_EXT',
+'GL_OUTPUT_TEXTURE_COORD28_EXT', 'GL_OUTPUT_TEXTURE_COORD29_EXT',
+'GL_OUTPUT_TEXTURE_COORD30_EXT', 'GL_OUTPUT_TEXTURE_COORD31_EXT',
+'GL_OUTPUT_FOG_EXT', 'GL_SCALAR_EXT', 'GL_VECTOR_EXT', 'GL_MATRIX_EXT',
+'GL_VARIANT_EXT', 'GL_INVARIANT_EXT', 'GL_LOCAL_CONSTANT_EXT', 'GL_LOCAL_EXT',
+'GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT', 'GL_MAX_VERTEX_SHADER_VARIANTS_EXT',
+'GL_MAX_VERTEX_SHADER_INVARIANTS_EXT',
+'GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT', 'GL_MAX_VERTEX_SHADER_LOCALS_EXT',
+'GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT',
+'GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT',
+'GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT',
+'GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT',
+'GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT',
+'GL_VERTEX_SHADER_INSTRUCTIONS_EXT', 'GL_VERTEX_SHADER_VARIANTS_EXT',
+'GL_VERTEX_SHADER_INVARIANTS_EXT', 'GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT',
+'GL_VERTEX_SHADER_LOCALS_EXT', 'GL_VERTEX_SHADER_OPTIMIZED_EXT', 'GL_X_EXT',
+'GL_Y_EXT', 'GL_Z_EXT', 'GL_W_EXT', 'GL_NEGATIVE_X_EXT', 'GL_NEGATIVE_Y_EXT',
+'GL_NEGATIVE_Z_EXT', 'GL_NEGATIVE_W_EXT', 'GL_ZERO_EXT', 'GL_ONE_EXT',
+'GL_NEGATIVE_ONE_EXT', 'GL_NORMALIZED_RANGE_EXT', 'GL_FULL_RANGE_EXT',
+'GL_CURRENT_VERTEX_EXT', 'GL_MVP_MATRIX_EXT', 'GL_VARIANT_VALUE_EXT',
+'GL_VARIANT_DATATYPE_EXT', 'GL_VARIANT_ARRAY_STRIDE_EXT',
+'GL_VARIANT_ARRAY_TYPE_EXT', 'GL_VARIANT_ARRAY_EXT',
+'GL_VARIANT_ARRAY_POINTER_EXT', 'GL_INVARIANT_VALUE_EXT',
+'GL_INVARIANT_DATATYPE_EXT', 'GL_LOCAL_CONSTANT_VALUE_EXT',
+'GL_LOCAL_CONSTANT_DATATYPE_EXT', 'GL_MAX_VERTEX_STREAMS_ATI',
+'GL_VERTEX_STREAM0_ATI', 'GL_VERTEX_STREAM1_ATI', 'GL_VERTEX_STREAM2_ATI',
+'GL_VERTEX_STREAM3_ATI', 'GL_VERTEX_STREAM4_ATI', 'GL_VERTEX_STREAM5_ATI',
+'GL_VERTEX_STREAM6_ATI', 'GL_VERTEX_STREAM7_ATI', 'GL_VERTEX_SOURCE_ATI',
+'GL_ELEMENT_ARRAY_ATI', 'GL_ELEMENT_ARRAY_TYPE_ATI',
+'GL_ELEMENT_ARRAY_POINTER_ATI', 'GL_QUAD_MESH_SUN', 'GL_TRIANGLE_MESH_SUN',
+'GL_SLICE_ACCUM_SUN', 'GL_MULTISAMPLE_FILTER_HINT_NV', 'GL_DEPTH_CLAMP_NV',
+'GL_PIXEL_COUNTER_BITS_NV', 'GL_CURRENT_OCCLUSION_QUERY_ID_NV',
+'GL_PIXEL_COUNT_NV', 'GL_PIXEL_COUNT_AVAILABLE_NV', 'GL_POINT_SPRITE_NV',
+'GL_COORD_REPLACE_NV', 'GL_POINT_SPRITE_R_MODE_NV',
+'GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV',
+'GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV',
+'GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV',
+'GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV',
+'GL_OFFSET_HILO_TEXTURE_2D_NV', 'GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV',
+'GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV',
+'GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV',
+'GL_DEPENDENT_HILO_TEXTURE_2D_NV', 'GL_DEPENDENT_RGB_TEXTURE_3D_NV',
+'GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV', 'GL_DOT_PRODUCT_PASS_THROUGH_NV',
+'GL_DOT_PRODUCT_TEXTURE_1D_NV', 'GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV',
+'GL_HILO8_NV', 'GL_SIGNED_HILO8_NV', 'GL_FORCE_BLUE_TO_ONE_NV',
+'GL_STENCIL_TEST_TWO_SIDE_EXT', 'GL_ACTIVE_STENCIL_FACE_EXT',
+'GL_TEXT_FRAGMENT_SHADER_ATI', 'GL_UNPACK_CLIENT_STORAGE_APPLE',
+'GL_ELEMENT_ARRAY_APPLE', 'GL_ELEMENT_ARRAY_TYPE_APPLE',
+'GL_ELEMENT_ARRAY_POINTER_APPLE', 'GL_DRAW_PIXELS_APPLE', 'GL_FENCE_APPLE',
+'GL_VERTEX_ARRAY_BINDING_APPLE', 'GL_VERTEX_ARRAY_RANGE_APPLE',
+'GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE', 'GL_VERTEX_ARRAY_STORAGE_HINT_APPLE',
+'GL_VERTEX_ARRAY_RANGE_POINTER_APPLE', 'GL_STORAGE_CACHED_APPLE',
+'GL_STORAGE_SHARED_APPLE', 'GL_YCBCR_422_APPLE',
+'GL_UNSIGNED_SHORT_8_8_APPLE', 'GL_UNSIGNED_SHORT_8_8_REV_APPLE',
+'GL_RGB_S3TC', 'GL_RGB4_S3TC', 'GL_RGBA_S3TC', 'GL_RGBA4_S3TC',
+'GL_MAX_DRAW_BUFFERS_ATI', 'GL_DRAW_BUFFER0_ATI', 'GL_DRAW_BUFFER1_ATI',
+'GL_DRAW_BUFFER2_ATI', 'GL_DRAW_BUFFER3_ATI', 'GL_DRAW_BUFFER4_ATI',
+'GL_DRAW_BUFFER5_ATI', 'GL_DRAW_BUFFER6_ATI', 'GL_DRAW_BUFFER7_ATI',
+'GL_DRAW_BUFFER8_ATI', 'GL_DRAW_BUFFER9_ATI', 'GL_DRAW_BUFFER10_ATI',
+'GL_DRAW_BUFFER11_ATI', 'GL_DRAW_BUFFER12_ATI', 'GL_DRAW_BUFFER13_ATI',
+'GL_DRAW_BUFFER14_ATI', 'GL_DRAW_BUFFER15_ATI', 'GL_TYPE_RGBA_FLOAT_ATI',
+'GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI', 'GL_MODULATE_ADD_ATI',
+'GL_MODULATE_SIGNED_ADD_ATI', 'GL_MODULATE_SUBTRACT_ATI',
+'GL_RGBA_FLOAT32_ATI', 'GL_RGB_FLOAT32_ATI', 'GL_ALPHA_FLOAT32_ATI',
+'GL_INTENSITY_FLOAT32_ATI', 'GL_LUMINANCE_FLOAT32_ATI',
+'GL_LUMINANCE_ALPHA_FLOAT32_ATI', 'GL_RGBA_FLOAT16_ATI', 'GL_RGB_FLOAT16_ATI',
+'GL_ALPHA_FLOAT16_ATI', 'GL_INTENSITY_FLOAT16_ATI',
+'GL_LUMINANCE_FLOAT16_ATI', 'GL_LUMINANCE_ALPHA_FLOAT16_ATI', 'GL_FLOAT_R_NV',
+'GL_FLOAT_RG_NV', 'GL_FLOAT_RGB_NV', 'GL_FLOAT_RGBA_NV', 'GL_FLOAT_R16_NV',
+'GL_FLOAT_R32_NV', 'GL_FLOAT_RG16_NV', 'GL_FLOAT_RG32_NV',
+'GL_FLOAT_RGB16_NV', 'GL_FLOAT_RGB32_NV', 'GL_FLOAT_RGBA16_NV',
+'GL_FLOAT_RGBA32_NV', 'GL_TEXTURE_FLOAT_COMPONENTS_NV',
+'GL_FLOAT_CLEAR_COLOR_VALUE_NV', 'GL_FLOAT_RGBA_MODE_NV',
+'GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV', 'GL_FRAGMENT_PROGRAM_NV',
+'GL_MAX_TEXTURE_COORDS_NV', 'GL_MAX_TEXTURE_IMAGE_UNITS_NV',
+'GL_FRAGMENT_PROGRAM_BINDING_NV', 'GL_PROGRAM_ERROR_STRING_NV',
+'GL_HALF_FLOAT_NV', 'GL_WRITE_PIXEL_DATA_RANGE_NV',
+'GL_READ_PIXEL_DATA_RANGE_NV', 'GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV',
+'GL_READ_PIXEL_DATA_RANGE_LENGTH_NV', 'GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV',
+'GL_READ_PIXEL_DATA_RANGE_POINTER_NV', 'GL_PRIMITIVE_RESTART_NV',
+'GL_PRIMITIVE_RESTART_INDEX_NV', 'GL_TEXTURE_UNSIGNED_REMAP_MODE_NV',
+'GL_STENCIL_BACK_FUNC_ATI', 'GL_STENCIL_BACK_FAIL_ATI',
+'GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI', 'GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI',
+'GL_IMPLEMENTATION_COLOR_READ_TYPE_OES',
+'GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES', 'GL_DEPTH_BOUNDS_TEST_EXT',
+'GL_DEPTH_BOUNDS_EXT', 'GL_MIRROR_CLAMP_EXT', 'GL_MIRROR_CLAMP_TO_EDGE_EXT',
+'GL_MIRROR_CLAMP_TO_BORDER_EXT', 'GL_BLEND_EQUATION_RGB_EXT',
+'GL_BLEND_EQUATION_ALPHA_EXT', 'GL_PACK_INVERT_MESA',
+'GL_UNSIGNED_SHORT_8_8_MESA', 'GL_UNSIGNED_SHORT_8_8_REV_MESA',
+'GL_YCBCR_MESA', 'GL_PIXEL_PACK_BUFFER_EXT', 'GL_PIXEL_UNPACK_BUFFER_EXT',
+'GL_PIXEL_PACK_BUFFER_BINDING_EXT', 'GL_PIXEL_UNPACK_BUFFER_BINDING_EXT',
+'GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV', 'GL_MAX_PROGRAM_CALL_DEPTH_NV',
+'GL_MAX_PROGRAM_IF_DEPTH_NV', 'GL_MAX_PROGRAM_LOOP_DEPTH_NV',
+'GL_MAX_PROGRAM_LOOP_COUNT_NV', 'GL_INVALID_FRAMEBUFFER_OPERATION_EXT',
+'GL_MAX_RENDERBUFFER_SIZE_EXT', 'GL_FRAMEBUFFER_BINDING_EXT',
+'GL_RENDERBUFFER_BINDING_EXT', 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT',
+'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT',
+'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT',
+'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT',
+'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT',
+'GL_FRAMEBUFFER_COMPLETE_EXT', 'GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT',
+'GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT',
+'GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT',
+'GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT',
+'GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT',
+'GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT',
+'GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT', 'GL_FRAMEBUFFER_UNSUPPORTED_EXT',
+'GL_MAX_COLOR_ATTACHMENTS_EXT', 'GL_COLOR_ATTACHMENT0_EXT',
+'GL_COLOR_ATTACHMENT1_EXT', 'GL_COLOR_ATTACHMENT2_EXT',
+'GL_COLOR_ATTACHMENT3_EXT', 'GL_COLOR_ATTACHMENT4_EXT',
+'GL_COLOR_ATTACHMENT5_EXT', 'GL_COLOR_ATTACHMENT6_EXT',
+'GL_COLOR_ATTACHMENT7_EXT', 'GL_COLOR_ATTACHMENT8_EXT',
+'GL_COLOR_ATTACHMENT9_EXT', 'GL_COLOR_ATTACHMENT10_EXT',
+'GL_COLOR_ATTACHMENT11_EXT', 'GL_COLOR_ATTACHMENT12_EXT',
+'GL_COLOR_ATTACHMENT13_EXT', 'GL_COLOR_ATTACHMENT14_EXT',
+'GL_COLOR_ATTACHMENT15_EXT', 'GL_DEPTH_ATTACHMENT_EXT',
+'GL_STENCIL_ATTACHMENT_EXT', 'GL_FRAMEBUFFER_EXT', 'GL_RENDERBUFFER_EXT',
+'GL_RENDERBUFFER_WIDTH_EXT', 'GL_RENDERBUFFER_HEIGHT_EXT',
+'GL_RENDERBUFFER_INTERNAL_FORMAT_EXT', 'GL_STENCIL_INDEX_EXT',
+'GL_STENCIL_INDEX1_EXT', 'GL_STENCIL_INDEX4_EXT', 'GL_STENCIL_INDEX8_EXT',
+'GL_STENCIL_INDEX16_EXT', 'GL_RENDERBUFFER_RED_SIZE_EXT',
+'GL_RENDERBUFFER_GREEN_SIZE_EXT', 'GL_RENDERBUFFER_BLUE_SIZE_EXT',
+'GL_RENDERBUFFER_ALPHA_SIZE_EXT', 'GL_RENDERBUFFER_DEPTH_SIZE_EXT',
+'GL_RENDERBUFFER_STENCIL_SIZE_EXT', 'GL_CG_VERTEX_SHADER_EXT',
+'GL_CG_FRAGMENT_SHADER_EXT', 'GL_TIME_ELAPSED_EXT', 'GL_TEXTURE_BUFFER_EXT',
+'GL_MAX_TEXTURE_BUFFER_SIZE_EXT', 'GL_TEXTURE_BINDING_BUFFER_EXT',
+'GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT', 'GL_TEXTURE_BUFFER_FORMAT_EXT',
+'GL_SAMPLER_1D_ARRAY_EXT', 'GL_SAMPLER_2D_ARRAY_EXT', 'GL_SAMPLER_BUFFER_EXT',
+'GL_SAMPLER_1D_ARRAY_SHADOW_EXT', 'GL_SAMPLER_2D_ARRAY_SHADOW_EXT',
+'GL_SAMPLER_CUBE_SHADOW_EXT', 'GL_UNSIGNED_INT_VEC2_EXT',
+'GL_UNSIGNED_INT_VEC3_EXT', 'GL_UNSIGNED_INT_VEC4_EXT',
+'GL_INT_SAMPLER_1D_EXT', 'GL_INT_SAMPLER_2D_EXT', 'GL_INT_SAMPLER_3D_EXT',
+'GL_INT_SAMPLER_CUBE_EXT', 'GL_INT_SAMPLER_2D_RECT_EXT',
+'GL_INT_SAMPLER_1D_ARRAY_EXT', 'GL_INT_SAMPLER_2D_ARRAY_EXT',
+'GL_INT_SAMPLER_BUFFER_EXT', 'GL_UNSIGNED_INT_SAMPLER_1D_EXT',
+'GL_UNSIGNED_INT_SAMPLER_2D_EXT', 'GL_UNSIGNED_INT_SAMPLER_3D_EXT',
+'GL_UNSIGNED_INT_SAMPLER_CUBE_EXT', 'GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT',
+'GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT',
+'GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT', 'GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT',
+'GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT', 'GL_GEOMETRY_SHADER_EXT',
+'GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT',
+'GL_MAX_VERTEX_VARYING_COMPONENTS_EXT', 'GL_MAX_VARYING_COMPONENTS_EXT',
+'GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT',
+'GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT',
+'GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT', 'GL_GEOMETRY_VERTICES_OUT_EXT',
+'GL_GEOMETRY_INPUT_TYPE_EXT', 'GL_GEOMETRY_OUTPUT_TYPE_EXT',
+'GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT', 'GL_LINES_ADJACENCY_EXT',
+'GL_LINE_STRIP_ADJACENCY_EXT', 'GL_TRIANGLES_ADJACENCY_EXT',
+'GL_TRIANGLE_STRIP_ADJACENCY_EXT', 'GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT',
+'GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT',
+'GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT',
+'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT', 'GL_PROGRAM_POINT_SIZE_EXT',
+'GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT',
+'GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT',
+'GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT', 'GL_MAX_BINDABLE_UNIFORM_SIZE_EXT',
+'GL_UNIFORM_BUFFER_EXT', 'GL_UNIFORM_BUFFER_BINDING_EXT',
+'GL_FRAMEBUFFER_SRGB_EXT', 'GL_FRAMEBUFFER_SRGB_CAPABLE_EXT',
+'GL_RGB9_E5_EXT', 'GL_UNSIGNED_INT_5_9_9_9_REV_EXT',
+'GL_TEXTURE_SHARED_SIZE_EXT', 'GL_R11F_G11F_B10F_EXT',
+'GL_UNSIGNED_INT_10F_11F_11F_REV_EXT', 'GL_RGBA_SIGNED_COMPONENTS_EXT',
+'GL_TEXTURE_1D_ARRAY_EXT', 'GL_PROXY_TEXTURE_1D_ARRAY_EXT',
+'GL_TEXTURE_2D_ARRAY_EXT', 'GL_PROXY_TEXTURE_2D_ARRAY_EXT',
+'GL_TEXTURE_BINDING_1D_ARRAY_EXT', 'GL_TEXTURE_BINDING_2D_ARRAY_EXT',
+'GL_MAX_ARRAY_TEXTURE_LAYERS_EXT', 'GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT',
+'GL_RGBA32UI_EXT', 'GL_RGB32UI_EXT', 'GL_ALPHA32UI_EXT',
+'GL_INTENSITY32UI_EXT', 'GL_LUMINANCE32UI_EXT', 'GL_LUMINANCE_ALPHA32UI_EXT',
+'GL_RGBA16UI_EXT', 'GL_RGB16UI_EXT', 'GL_ALPHA16UI_EXT',
+'GL_INTENSITY16UI_EXT', 'GL_LUMINANCE16UI_EXT', 'GL_LUMINANCE_ALPHA16UI_EXT',
+'GL_RGBA8UI_EXT', 'GL_RGB8UI_EXT', 'GL_ALPHA8UI_EXT', 'GL_INTENSITY8UI_EXT',
+'GL_LUMINANCE8UI_EXT', 'GL_LUMINANCE_ALPHA8UI_EXT', 'GL_RGBA32I_EXT',
+'GL_RGB32I_EXT', 'GL_ALPHA32I_EXT', 'GL_INTENSITY32I_EXT',
+'GL_LUMINANCE32I_EXT', 'GL_LUMINANCE_ALPHA32I_EXT', 'GL_RGBA16I_EXT',
+'GL_RGB16I_EXT', 'GL_ALPHA16I_EXT', 'GL_INTENSITY16I_EXT',
+'GL_LUMINANCE16I_EXT', 'GL_LUMINANCE_ALPHA16I_EXT', 'GL_RGBA8I_EXT',
+'GL_RGB8I_EXT', 'GL_ALPHA8I_EXT', 'GL_INTENSITY8I_EXT', 'GL_LUMINANCE8I_EXT',
+'GL_LUMINANCE_ALPHA8I_EXT', 'GL_RED_INTEGER_EXT', 'GL_GREEN_INTEGER_EXT',
+'GL_BLUE_INTEGER_EXT', 'GL_ALPHA_INTEGER_EXT', 'GL_RGB_INTEGER_EXT',
+'GL_RGBA_INTEGER_EXT', 'GL_BGR_INTEGER_EXT', 'GL_BGRA_INTEGER_EXT',
+'GL_LUMINANCE_INTEGER_EXT', 'GL_LUMINANCE_ALPHA_INTEGER_EXT',
+'GL_RGBA_INTEGER_MODE_EXT', 'GL_DEPTH_COMPONENT32F_NV',
+'GL_DEPTH32F_STENCIL8_NV', 'GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV',
+'GL_DEPTH_BUFFER_FLOAT_MODE_NV', 'GL_COMPRESSED_LUMINANCE_LATC1_EXT',
+'GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT',
+'GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT',
+'GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT', 'GL_BACK_PRIMARY_COLOR_NV',
+'GL_BACK_SECONDARY_COLOR_NV', 'GL_TEXTURE_COORD_NV', 'GL_CLIP_DISTANCE_NV',
+'GL_VERTEX_ID_NV', 'GL_PRIMITIVE_ID_NV', 'GL_GENERIC_ATTRIB_NV',
+'GL_TRANSFORM_FEEDBACK_ATTRIBS_NV', 'GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV',
+'GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV', 'GL_ACTIVE_VARYINGS_NV',
+'GL_ACTIVE_VARYING_MAX_LENGTH_NV', 'GL_TRANSFORM_FEEDBACK_VARYINGS_NV',
+'GL_TRANSFORM_FEEDBACK_BUFFER_START_NV',
+'GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV', 'GL_TRANSFORM_FEEDBACK_RECORD_NV',
+'GL_PRIMITIVES_GENERATED_NV', 'GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV',
+'GL_RASTERIZER_DISCARD_NV',
+'GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_ATTRIBS_NV',
+'GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV', 'GL_INTERLEAVED_ATTRIBS_NV',
+'GL_SEPARATE_ATTRIBS_NV', 'GL_TRANSFORM_FEEDBACK_BUFFER_NV',
+'GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV', 'GL_GEOMETRY_PROGRAM_NV',
+'GL_MAX_PROGRAM_OUTPUT_VERTICES_NV',
+'GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV', 'GL_MIN_PROGRAM_TEXEL_OFFSET_NV',
+'GL_MAX_PROGRAM_TEXEL_OFFSET_NV', 'GL_PROGRAM_ATTRIB_COMPONENTS_NV',
+'GL_PROGRAM_RESULT_COMPONENTS_NV', 'GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV',
+'GL_MAX_PROGRAM_RESULT_COMPONENTS_NV', 'GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV',
+'GL_MAX_PROGRAM_GENERIC_RESULTS_NV',
+'GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV',
+'GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV',
+'GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV',
+'GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV',
+'GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV',
+'GL_RENDERBUFFER_COVERAGE_SAMPLES_NV', 'GL_RENDERBUFFER_COLOR_SAMPLES_NV',
+'GL_MAX_RENDERBUFFER_COVERAGE_SAMPLES_NV',
+'GL_MAX_RENDERBUFFER_COLOR_SAMPLES_NV',
+'GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV', 'GL_MULTISAMPLE_COVERAGE_MODES_NV',
+'GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT', 'GL_MAX_SAMPLES_EXT',
+'GL_RENDERBUFFER_SAMPLES_EXT', 'GL_READ_FRAMEBUFFER_EXT',
+'GL_DRAW_FRAMEBUFFER_EXT', 'GL_DRAW_FRAMEBUFFER_BINDING_EXT',
+'GL_READ_FRAMEBUFFER_BINDING_EXT', 'GL_COMPRESSED_RED_RGTC1_EXT',
+'GL_COMPRESSED_SIGNED_RED_RGTC1_EXT', 'GL_COMPRESSED_RED_GREEN_RGTC2_EXT',
+'GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT', 'GL_FRAME_NV', 'GL_FIELDS_NV',
+'GL_CURRENT_TIME_NV', 'GL_NUM_FILL_STREAMS_NV', 'GL_PRESENT_TIME_NV',
+'GL_PRESENT_DURATION_NV', 'GL_QUERY_WAIT_NV', 'GL_QUERY_NO_WAIT_NV',
+'GL_QUERY_BY_REGION_WAIT_NV', 'GL_QUERY_BY_REGION_NO_WAIT_NV',
+'GL_TRANSFORM_FEEDBACK_BUFFER_EXT', 'GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT',
+'GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT',
+'GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT', 'GL_INTERLEAVED_ATTRIBS_EXT',
+'GL_SEPARATE_ATTRIBS_EXT', 'GL_PRIMITIVES_GENERATED_EXT',
+'GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT', 'GL_RASTERIZER_DISCARD_EXT',
+'GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT',
+'GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT',
+'GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT',
+'GL_TRANSFORM_FEEDBACK_VARYINGS_EXT', 'GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT',
+'GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT', 'GL_PROGRAM_MATRIX_EXT',
+'GL_TRANSPOSE_PROGRAM_MATRIX_EXT', 'GL_PROGRAM_MATRIX_STACK_DEPTH_EXT',
+'GL_TEXTURE_SWIZZLE_R_EXT', 'GL_TEXTURE_SWIZZLE_G_EXT',
+'GL_TEXTURE_SWIZZLE_B_EXT', 'GL_TEXTURE_SWIZZLE_A_EXT',
+'GL_TEXTURE_SWIZZLE_RGBA_EXT', 'GL_SAMPLE_POSITION_NV', 'GL_SAMPLE_MASK_NV',
+'GL_SAMPLE_MASK_VALUE_NV', 'GL_TEXTURE_BINDING_RENDERBUFFER_NV',
+'GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV',
+'GL_MAX_SAMPLE_MASK_WORDS_NV', 'GL_TEXTURE_RENDERBUFFER_NV',
+'GL_SAMPLER_RENDERBUFFER_NV', 'GL_INT_SAMPLER_RENDERBUFFER_NV',
+'GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV', 'GL_TRANSFORM_FEEDBACK_NV',
+'GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV',
+'GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV', 'GL_TRANSFORM_FEEDBACK_BINDING_NV',
+'GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV', 'GL_ELEMENT_ARRAY_UNIFIED_NV',
+'GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV', 'GL_VERTEX_ARRAY_ADDRESS_NV',
+'GL_NORMAL_ARRAY_ADDRESS_NV', 'GL_COLOR_ARRAY_ADDRESS_NV',
+'GL_INDEX_ARRAY_ADDRESS_NV', 'GL_TEXTURE_COORD_ARRAY_ADDRESS_NV',
+'GL_EDGE_FLAG_ARRAY_ADDRESS_NV', 'GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV',
+'GL_FOG_COORD_ARRAY_ADDRESS_NV', 'GL_ELEMENT_ARRAY_ADDRESS_NV',
+'GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV', 'GL_VERTEX_ARRAY_LENGTH_NV',
+'GL_NORMAL_ARRAY_LENGTH_NV', 'GL_COLOR_ARRAY_LENGTH_NV',
+'GL_INDEX_ARRAY_LENGTH_NV', 'GL_TEXTURE_COORD_ARRAY_LENGTH_NV',
+'GL_EDGE_FLAG_ARRAY_LENGTH_NV', 'GL_SECONDARY_COLOR_ARRAY_LENGTH_NV',
+'GL_FOG_COORD_ARRAY_LENGTH_NV', 'GL_ELEMENT_ARRAY_LENGTH_NV',
+'GL_BUFFER_GPU_ADDRESS_NV', 'GL_GPU_ADDRESS_NV',
+'GL_MAX_SHADER_BUFFER_ADDRESS_NV', 'GLchar', 'GLintptr', 'GLsizeiptr',
+'GLintptrARB', 'GLsizeiptrARB', 'GLcharARB', 'GLhandleARB', 'GLhalfARB',
+'GLhalfNV', 'GLint64EXT', 'GLuint64EXT', 'GL_VERSION_1_4',
+'glBlendFuncSeparate', 'glFogCoordf', 'glFogCoordfv', 'glFogCoordd',
+'glFogCoorddv', 'glFogCoordPointer', 'glMultiDrawArrays',
+'glMultiDrawElements', 'glPointParameterf', 'glPointParameterfv',
+'glPointParameteri', 'glPointParameteriv', 'glSecondaryColor3b',
+'glSecondaryColor3bv', 'glSecondaryColor3d', 'glSecondaryColor3dv',
+'glSecondaryColor3f', 'glSecondaryColor3fv', 'glSecondaryColor3i',
+'glSecondaryColor3iv', 'glSecondaryColor3s', 'glSecondaryColor3sv',
+'glSecondaryColor3ub', 'glSecondaryColor3ubv', 'glSecondaryColor3ui',
+'glSecondaryColor3uiv', 'glSecondaryColor3us', 'glSecondaryColor3usv',
+'glSecondaryColorPointer', 'glWindowPos2d', 'glWindowPos2dv', 'glWindowPos2f',
+'glWindowPos2fv', 'glWindowPos2i', 'glWindowPos2iv', 'glWindowPos2s',
+'glWindowPos2sv', 'glWindowPos3d', 'glWindowPos3dv', 'glWindowPos3f',
+'glWindowPos3fv', 'glWindowPos3i', 'glWindowPos3iv', 'glWindowPos3s',
+'glWindowPos3sv', 'PFNGLBLENDFUNCSEPARATEPROC', 'PFNGLFOGCOORDFPROC',
+'PFNGLFOGCOORDFVPROC', 'PFNGLFOGCOORDDPROC', 'PFNGLFOGCOORDDVPROC',
+'PFNGLFOGCOORDPOINTERPROC', 'PFNGLMULTIDRAWARRAYSPROC',
+'PFNGLMULTIDRAWELEMENTSPROC', 'PFNGLPOINTPARAMETERFPROC',
+'PFNGLPOINTPARAMETERFVPROC', 'PFNGLPOINTPARAMETERIPROC',
+'PFNGLPOINTPARAMETERIVPROC', 'PFNGLSECONDARYCOLOR3BPROC',
+'PFNGLSECONDARYCOLOR3BVPROC', 'PFNGLSECONDARYCOLOR3DPROC',
+'PFNGLSECONDARYCOLOR3DVPROC', 'PFNGLSECONDARYCOLOR3FPROC',
+'PFNGLSECONDARYCOLOR3FVPROC', 'PFNGLSECONDARYCOLOR3IPROC',
+'PFNGLSECONDARYCOLOR3IVPROC', 'PFNGLSECONDARYCOLOR3SPROC',
+'PFNGLSECONDARYCOLOR3SVPROC', 'PFNGLSECONDARYCOLOR3UBPROC',
+'PFNGLSECONDARYCOLOR3UBVPROC', 'PFNGLSECONDARYCOLOR3UIPROC',
+'PFNGLSECONDARYCOLOR3UIVPROC', 'PFNGLSECONDARYCOLOR3USPROC',
+'PFNGLSECONDARYCOLOR3USVPROC', 'PFNGLSECONDARYCOLORPOINTERPROC',
+'PFNGLWINDOWPOS2DPROC', 'PFNGLWINDOWPOS2DVPROC', 'PFNGLWINDOWPOS2FPROC',
+'PFNGLWINDOWPOS2FVPROC', 'PFNGLWINDOWPOS2IPROC', 'PFNGLWINDOWPOS2IVPROC',
+'PFNGLWINDOWPOS2SPROC', 'PFNGLWINDOWPOS2SVPROC', 'PFNGLWINDOWPOS3DPROC',
+'PFNGLWINDOWPOS3DVPROC', 'PFNGLWINDOWPOS3FPROC', 'PFNGLWINDOWPOS3FVPROC',
+'PFNGLWINDOWPOS3IPROC', 'PFNGLWINDOWPOS3IVPROC', 'PFNGLWINDOWPOS3SPROC',
+'PFNGLWINDOWPOS3SVPROC', 'GL_VERSION_1_5', 'glGenQueries', 'glDeleteQueries',
+'glIsQuery', 'glBeginQuery', 'glEndQuery', 'glGetQueryiv',
+'glGetQueryObjectiv', 'glGetQueryObjectuiv', 'glBindBuffer',
+'glDeleteBuffers', 'glGenBuffers', 'glIsBuffer', 'glBufferData',
+'glBufferSubData', 'glGetBufferSubData', 'glMapBuffer', 'glUnmapBuffer',
+'glGetBufferParameteriv', 'glGetBufferPointerv', 'PFNGLGENQUERIESPROC',
+'PFNGLDELETEQUERIESPROC', 'PFNGLISQUERYPROC', 'PFNGLBEGINQUERYPROC',
+'PFNGLENDQUERYPROC', 'PFNGLGETQUERYIVPROC', 'PFNGLGETQUERYOBJECTIVPROC',
+'PFNGLGETQUERYOBJECTUIVPROC', 'PFNGLBINDBUFFERPROC', 'PFNGLDELETEBUFFERSPROC',
+'PFNGLGENBUFFERSPROC', 'PFNGLISBUFFERPROC', 'PFNGLBUFFERDATAPROC',
+'PFNGLBUFFERSUBDATAPROC', 'PFNGLGETBUFFERSUBDATAPROC', 'PFNGLMAPBUFFERPROC',
+'PFNGLUNMAPBUFFERPROC', 'PFNGLGETBUFFERPARAMETERIVPROC',
+'PFNGLGETBUFFERPOINTERVPROC', 'GL_VERSION_2_0', 'glBlendEquationSeparate',
+'glDrawBuffers', 'glStencilOpSeparate', 'glStencilFuncSeparate',
+'glStencilMaskSeparate', 'glAttachShader', 'glBindAttribLocation',
+'glCompileShader', 'glCreateProgram', 'glCreateShader', 'glDeleteProgram',
+'glDeleteShader', 'glDetachShader', 'glDisableVertexAttribArray',
+'glEnableVertexAttribArray', 'glGetActiveAttrib', 'glGetActiveUniform',
+'glGetAttachedShaders', 'glGetAttribLocation', 'glGetProgramiv',
+'glGetProgramInfoLog', 'glGetShaderiv', 'glGetShaderInfoLog',
+'glGetShaderSource', 'glGetUniformLocation', 'glGetUniformfv',
+'glGetUniformiv', 'glGetVertexAttribdv', 'glGetVertexAttribfv',
+'glGetVertexAttribiv', 'glGetVertexAttribPointerv', 'glIsProgram',
+'glIsShader', 'glLinkProgram', 'glShaderSource', 'glUseProgram',
+'glUniform1f', 'glUniform2f', 'glUniform3f', 'glUniform4f', 'glUniform1i',
+'glUniform2i', 'glUniform3i', 'glUniform4i', 'glUniform1fv', 'glUniform2fv',
+'glUniform3fv', 'glUniform4fv', 'glUniform1iv', 'glUniform2iv',
+'glUniform3iv', 'glUniform4iv', 'glUniformMatrix2fv', 'glUniformMatrix3fv',
+'glUniformMatrix4fv', 'glValidateProgram', 'glVertexAttrib1d',
+'glVertexAttrib1dv', 'glVertexAttrib1f', 'glVertexAttrib1fv',
+'glVertexAttrib1s', 'glVertexAttrib1sv', 'glVertexAttrib2d',
+'glVertexAttrib2dv', 'glVertexAttrib2f', 'glVertexAttrib2fv',
+'glVertexAttrib2s', 'glVertexAttrib2sv', 'glVertexAttrib3d',
+'glVertexAttrib3dv', 'glVertexAttrib3f', 'glVertexAttrib3fv',
+'glVertexAttrib3s', 'glVertexAttrib3sv', 'glVertexAttrib4Nbv',
+'glVertexAttrib4Niv', 'glVertexAttrib4Nsv', 'glVertexAttrib4Nub',
+'glVertexAttrib4Nubv', 'glVertexAttrib4Nuiv', 'glVertexAttrib4Nusv',
+'glVertexAttrib4bv', 'glVertexAttrib4d', 'glVertexAttrib4dv',
+'glVertexAttrib4f', 'glVertexAttrib4fv', 'glVertexAttrib4iv',
+'glVertexAttrib4s', 'glVertexAttrib4sv', 'glVertexAttrib4ubv',
+'glVertexAttrib4uiv', 'glVertexAttrib4usv', 'glVertexAttribPointer',
+'PFNGLBLENDEQUATIONSEPARATEPROC', 'PFNGLDRAWBUFFERSPROC',
+'PFNGLSTENCILOPSEPARATEPROC', 'PFNGLSTENCILFUNCSEPARATEPROC',
+'PFNGLSTENCILMASKSEPARATEPROC', 'PFNGLATTACHSHADERPROC',
+'PFNGLBINDATTRIBLOCATIONPROC', 'PFNGLCOMPILESHADERPROC',
+'PFNGLCREATEPROGRAMPROC', 'PFNGLCREATESHADERPROC', 'PFNGLDELETEPROGRAMPROC',
+'PFNGLDELETESHADERPROC', 'PFNGLDETACHSHADERPROC',
+'PFNGLDISABLEVERTEXATTRIBARRAYPROC', 'PFNGLENABLEVERTEXATTRIBARRAYPROC',
+'PFNGLGETACTIVEATTRIBPROC', 'PFNGLGETACTIVEUNIFORMPROC',
+'PFNGLGETATTACHEDSHADERSPROC', 'PFNGLGETATTRIBLOCATIONPROC',
+'PFNGLGETPROGRAMIVPROC', 'PFNGLGETPROGRAMINFOLOGPROC', 'PFNGLGETSHADERIVPROC',
+'PFNGLGETSHADERINFOLOGPROC', 'PFNGLGETSHADERSOURCEPROC',
+'PFNGLGETUNIFORMLOCATIONPROC', 'PFNGLGETUNIFORMFVPROC',
+'PFNGLGETUNIFORMIVPROC', 'PFNGLGETVERTEXATTRIBDVPROC',
+'PFNGLGETVERTEXATTRIBFVPROC', 'PFNGLGETVERTEXATTRIBIVPROC',
+'PFNGLGETVERTEXATTRIBPOINTERVPROC', 'PFNGLISPROGRAMPROC', 'PFNGLISSHADERPROC',
+'PFNGLLINKPROGRAMPROC', 'PFNGLSHADERSOURCEPROC', 'PFNGLUSEPROGRAMPROC',
+'PFNGLUNIFORM1FPROC', 'PFNGLUNIFORM2FPROC', 'PFNGLUNIFORM3FPROC',
+'PFNGLUNIFORM4FPROC', 'PFNGLUNIFORM1IPROC', 'PFNGLUNIFORM2IPROC',
+'PFNGLUNIFORM3IPROC', 'PFNGLUNIFORM4IPROC', 'PFNGLUNIFORM1FVPROC',
+'PFNGLUNIFORM2FVPROC', 'PFNGLUNIFORM3FVPROC', 'PFNGLUNIFORM4FVPROC',
+'PFNGLUNIFORM1IVPROC', 'PFNGLUNIFORM2IVPROC', 'PFNGLUNIFORM3IVPROC',
+'PFNGLUNIFORM4IVPROC', 'PFNGLUNIFORMMATRIX2FVPROC',
+'PFNGLUNIFORMMATRIX3FVPROC', 'PFNGLUNIFORMMATRIX4FVPROC',
+'PFNGLVALIDATEPROGRAMPROC', 'PFNGLVERTEXATTRIB1DPROC',
+'PFNGLVERTEXATTRIB1DVPROC', 'PFNGLVERTEXATTRIB1FPROC',
+'PFNGLVERTEXATTRIB1FVPROC', 'PFNGLVERTEXATTRIB1SPROC',
+'PFNGLVERTEXATTRIB1SVPROC', 'PFNGLVERTEXATTRIB2DPROC',
+'PFNGLVERTEXATTRIB2DVPROC', 'PFNGLVERTEXATTRIB2FPROC',
+'PFNGLVERTEXATTRIB2FVPROC', 'PFNGLVERTEXATTRIB2SPROC',
+'PFNGLVERTEXATTRIB2SVPROC', 'PFNGLVERTEXATTRIB3DPROC',
+'PFNGLVERTEXATTRIB3DVPROC', 'PFNGLVERTEXATTRIB3FPROC',
+'PFNGLVERTEXATTRIB3FVPROC', 'PFNGLVERTEXATTRIB3SPROC',
+'PFNGLVERTEXATTRIB3SVPROC', 'PFNGLVERTEXATTRIB4NBVPROC',
+'PFNGLVERTEXATTRIB4NIVPROC', 'PFNGLVERTEXATTRIB4NSVPROC',
+'PFNGLVERTEXATTRIB4NUBPROC', 'PFNGLVERTEXATTRIB4NUBVPROC',
+'PFNGLVERTEXATTRIB4NUIVPROC', 'PFNGLVERTEXATTRIB4NUSVPROC',
+'PFNGLVERTEXATTRIB4BVPROC', 'PFNGLVERTEXATTRIB4DPROC',
+'PFNGLVERTEXATTRIB4DVPROC', 'PFNGLVERTEXATTRIB4FPROC',
+'PFNGLVERTEXATTRIB4FVPROC', 'PFNGLVERTEXATTRIB4IVPROC',
+'PFNGLVERTEXATTRIB4SPROC', 'PFNGLVERTEXATTRIB4SVPROC',
+'PFNGLVERTEXATTRIB4UBVPROC', 'PFNGLVERTEXATTRIB4UIVPROC',
+'PFNGLVERTEXATTRIB4USVPROC', 'PFNGLVERTEXATTRIBPOINTERPROC', 'GL_VERSION_2_1',
+'glUniformMatrix2x3fv', 'glUniformMatrix3x2fv', 'glUniformMatrix2x4fv',
+'glUniformMatrix4x2fv', 'glUniformMatrix3x4fv', 'glUniformMatrix4x3fv',
+'PFNGLUNIFORMMATRIX2X3FVPROC', 'PFNGLUNIFORMMATRIX3X2FVPROC',
+'PFNGLUNIFORMMATRIX2X4FVPROC', 'PFNGLUNIFORMMATRIX4X2FVPROC',
+'PFNGLUNIFORMMATRIX3X4FVPROC', 'PFNGLUNIFORMMATRIX4X3FVPROC',
+'GL_VERSION_3_0', 'glColorMaski', 'glGetBooleani_v', 'glGetIntegeri_v',
+'glEnablei', 'glDisablei', 'glIsEnabledi', 'glBeginTransformFeedback',
+'glEndTransformFeedback', 'glBindBufferRange', 'glBindBufferBase',
+'glTransformFeedbackVaryings', 'glGetTransformFeedbackVarying',
+'glClampColor', 'glBeginConditionalRender', 'glEndConditionalRender',
+'glVertexAttribI1i', 'glVertexAttribI2i', 'glVertexAttribI3i',
+'glVertexAttribI4i', 'glVertexAttribI1ui', 'glVertexAttribI2ui',
+'glVertexAttribI3ui', 'glVertexAttribI4ui', 'glVertexAttribI1iv',
+'glVertexAttribI2iv', 'glVertexAttribI3iv', 'glVertexAttribI4iv',
+'glVertexAttribI1uiv', 'glVertexAttribI2uiv', 'glVertexAttribI3uiv',
+'glVertexAttribI4uiv', 'glVertexAttribI4bv', 'glVertexAttribI4sv',
+'glVertexAttribI4ubv', 'glVertexAttribI4usv', 'glVertexAttribIPointer',
+'glGetVertexAttribIiv', 'glGetVertexAttribIuiv', 'glGetUniformuiv',
+'glBindFragDataLocation', 'glGetFragDataLocation', 'glUniform1ui',
+'glUniform2ui', 'glUniform3ui', 'glUniform4ui', 'glUniform1uiv',
+'glUniform2uiv', 'glUniform3uiv', 'glUniform4uiv', 'glTexParameterIiv',
+'glTexParameterIuiv', 'glGetTexParameterIiv', 'glGetTexParameterIuiv',
+'glClearBufferiv', 'glClearBufferuiv', 'glClearBufferfv', 'glClearBufferfi',
+'glGetStringi', 'PFNGLCOLORMASKIPROC', 'PFNGLGETBOOLEANI_VPROC',
+'PFNGLGETINTEGERI_VPROC', 'PFNGLENABLEIPROC', 'PFNGLDISABLEIPROC',
+'PFNGLISENABLEDIPROC', 'PFNGLBEGINTRANSFORMFEEDBACKPROC',
+'PFNGLENDTRANSFORMFEEDBACKPROC', 'PFNGLBINDBUFFERRANGEPROC',
+'PFNGLBINDBUFFERBASEPROC', 'PFNGLTRANSFORMFEEDBACKVARYINGSPROC',
+'PFNGLGETTRANSFORMFEEDBACKVARYINGPROC', 'PFNGLCLAMPCOLORPROC',
+'PFNGLBEGINCONDITIONALRENDERPROC', 'PFNGLENDCONDITIONALRENDERPROC',
+'PFNGLVERTEXATTRIBI1IPROC', 'PFNGLVERTEXATTRIBI2IPROC',
+'PFNGLVERTEXATTRIBI3IPROC', 'PFNGLVERTEXATTRIBI4IPROC',
+'PFNGLVERTEXATTRIBI1UIPROC', 'PFNGLVERTEXATTRIBI2UIPROC',
+'PFNGLVERTEXATTRIBI3UIPROC', 'PFNGLVERTEXATTRIBI4UIPROC',
+'PFNGLVERTEXATTRIBI1IVPROC', 'PFNGLVERTEXATTRIBI2IVPROC',
+'PFNGLVERTEXATTRIBI3IVPROC', 'PFNGLVERTEXATTRIBI4IVPROC',
+'PFNGLVERTEXATTRIBI1UIVPROC', 'PFNGLVERTEXATTRIBI2UIVPROC',
+'PFNGLVERTEXATTRIBI3UIVPROC', 'PFNGLVERTEXATTRIBI4UIVPROC',
+'PFNGLVERTEXATTRIBI4BVPROC', 'PFNGLVERTEXATTRIBI4SVPROC',
+'PFNGLVERTEXATTRIBI4UBVPROC', 'PFNGLVERTEXATTRIBI4USVPROC',
+'PFNGLVERTEXATTRIBIPOINTERPROC', 'PFNGLGETVERTEXATTRIBIIVPROC',
+'PFNGLGETVERTEXATTRIBIUIVPROC', 'PFNGLGETUNIFORMUIVPROC',
+'PFNGLBINDFRAGDATALOCATIONPROC', 'PFNGLGETFRAGDATALOCATIONPROC',
+'PFNGLUNIFORM1UIPROC', 'PFNGLUNIFORM2UIPROC', 'PFNGLUNIFORM3UIPROC',
+'PFNGLUNIFORM4UIPROC', 'PFNGLUNIFORM1UIVPROC', 'PFNGLUNIFORM2UIVPROC',
+'PFNGLUNIFORM3UIVPROC', 'PFNGLUNIFORM4UIVPROC', 'PFNGLTEXPARAMETERIIVPROC',
+'PFNGLTEXPARAMETERIUIVPROC', 'PFNGLGETTEXPARAMETERIIVPROC',
+'PFNGLGETTEXPARAMETERIUIVPROC', 'PFNGLCLEARBUFFERIVPROC',
+'PFNGLCLEARBUFFERUIVPROC', 'PFNGLCLEARBUFFERFVPROC', 'PFNGLCLEARBUFFERFIPROC',
+'PFNGLGETSTRINGIPROC', 'GL_ARB_transpose_matrix', 'glLoadTransposeMatrixfARB',
+'glLoadTransposeMatrixdARB', 'glMultTransposeMatrixfARB',
+'glMultTransposeMatrixdARB', 'PFNGLLOADTRANSPOSEMATRIXFARBPROC',
+'PFNGLLOADTRANSPOSEMATRIXDARBPROC', 'PFNGLMULTTRANSPOSEMATRIXFARBPROC',
+'PFNGLMULTTRANSPOSEMATRIXDARBPROC', 'GL_ARB_multisample',
+'glSampleCoverageARB', 'PFNGLSAMPLECOVERAGEARBPROC', 'GL_ARB_texture_env_add',
+'GL_ARB_texture_cube_map', 'GL_ARB_texture_compression',
+'glCompressedTexImage3DARB', 'glCompressedTexImage2DARB',
+'glCompressedTexImage1DARB', 'glCompressedTexSubImage3DARB',
+'glCompressedTexSubImage2DARB', 'glCompressedTexSubImage1DARB',
+'glGetCompressedTexImageARB', 'PFNGLCOMPRESSEDTEXIMAGE3DARBPROC',
+'PFNGLCOMPRESSEDTEXIMAGE2DARBPROC', 'PFNGLCOMPRESSEDTEXIMAGE1DARBPROC',
+'PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC', 'PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC',
+'PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC', 'PFNGLGETCOMPRESSEDTEXIMAGEARBPROC',
+'GL_ARB_texture_border_clamp', 'GL_ARB_point_parameters',
+'glPointParameterfARB', 'glPointParameterfvARB',
+'PFNGLPOINTPARAMETERFARBPROC', 'PFNGLPOINTPARAMETERFVARBPROC',
+'GL_ARB_vertex_blend', 'glWeightbvARB', 'glWeightsvARB', 'glWeightivARB',
+'glWeightfvARB', 'glWeightdvARB', 'glWeightubvARB', 'glWeightusvARB',
+'glWeightuivARB', 'glWeightPointerARB', 'glVertexBlendARB',
+'PFNGLWEIGHTBVARBPROC', 'PFNGLWEIGHTSVARBPROC', 'PFNGLWEIGHTIVARBPROC',
+'PFNGLWEIGHTFVARBPROC', 'PFNGLWEIGHTDVARBPROC', 'PFNGLWEIGHTUBVARBPROC',
+'PFNGLWEIGHTUSVARBPROC', 'PFNGLWEIGHTUIVARBPROC', 'PFNGLWEIGHTPOINTERARBPROC',
+'PFNGLVERTEXBLENDARBPROC', 'GL_ARB_matrix_palette',
+'glCurrentPaletteMatrixARB', 'glMatrixIndexubvARB', 'glMatrixIndexusvARB',
+'glMatrixIndexuivARB', 'glMatrixIndexPointerARB',
+'PFNGLCURRENTPALETTEMATRIXARBPROC', 'PFNGLMATRIXINDEXUBVARBPROC',
+'PFNGLMATRIXINDEXUSVARBPROC', 'PFNGLMATRIXINDEXUIVARBPROC',
+'PFNGLMATRIXINDEXPOINTERARBPROC', 'GL_ARB_texture_env_combine',
+'GL_ARB_texture_env_crossbar', 'GL_ARB_texture_env_dot3',
+'GL_ARB_texture_mirrored_repeat', 'GL_ARB_depth_texture', 'GL_ARB_shadow',
+'GL_ARB_shadow_ambient', 'GL_ARB_window_pos', 'glWindowPos2dARB',
+'glWindowPos2dvARB', 'glWindowPos2fARB', 'glWindowPos2fvARB',
+'glWindowPos2iARB', 'glWindowPos2ivARB', 'glWindowPos2sARB',
+'glWindowPos2svARB', 'glWindowPos3dARB', 'glWindowPos3dvARB',
+'glWindowPos3fARB', 'glWindowPos3fvARB', 'glWindowPos3iARB',
+'glWindowPos3ivARB', 'glWindowPos3sARB', 'glWindowPos3svARB',
+'PFNGLWINDOWPOS2DARBPROC', 'PFNGLWINDOWPOS2DVARBPROC',
+'PFNGLWINDOWPOS2FARBPROC', 'PFNGLWINDOWPOS2FVARBPROC',
+'PFNGLWINDOWPOS2IARBPROC', 'PFNGLWINDOWPOS2IVARBPROC',
+'PFNGLWINDOWPOS2SARBPROC', 'PFNGLWINDOWPOS2SVARBPROC',
+'PFNGLWINDOWPOS3DARBPROC', 'PFNGLWINDOWPOS3DVARBPROC',
+'PFNGLWINDOWPOS3FARBPROC', 'PFNGLWINDOWPOS3FVARBPROC',
+'PFNGLWINDOWPOS3IARBPROC', 'PFNGLWINDOWPOS3IVARBPROC',
+'PFNGLWINDOWPOS3SARBPROC', 'PFNGLWINDOWPOS3SVARBPROC',
+'GL_ARB_vertex_program', 'glVertexAttrib1dARB', 'glVertexAttrib1dvARB',
+'glVertexAttrib1fARB', 'glVertexAttrib1fvARB', 'glVertexAttrib1sARB',
+'glVertexAttrib1svARB', 'glVertexAttrib2dARB', 'glVertexAttrib2dvARB',
+'glVertexAttrib2fARB', 'glVertexAttrib2fvARB', 'glVertexAttrib2sARB',
+'glVertexAttrib2svARB', 'glVertexAttrib3dARB', 'glVertexAttrib3dvARB',
+'glVertexAttrib3fARB', 'glVertexAttrib3fvARB', 'glVertexAttrib3sARB',
+'glVertexAttrib3svARB', 'glVertexAttrib4NbvARB', 'glVertexAttrib4NivARB',
+'glVertexAttrib4NsvARB', 'glVertexAttrib4NubARB', 'glVertexAttrib4NubvARB',
+'glVertexAttrib4NuivARB', 'glVertexAttrib4NusvARB', 'glVertexAttrib4bvARB',
+'glVertexAttrib4dARB', 'glVertexAttrib4dvARB', 'glVertexAttrib4fARB',
+'glVertexAttrib4fvARB', 'glVertexAttrib4ivARB', 'glVertexAttrib4sARB',
+'glVertexAttrib4svARB', 'glVertexAttrib4ubvARB', 'glVertexAttrib4uivARB',
+'glVertexAttrib4usvARB', 'glVertexAttribPointerARB',
+'glEnableVertexAttribArrayARB', 'glDisableVertexAttribArrayARB',
+'glProgramStringARB', 'glBindProgramARB', 'glDeleteProgramsARB',
+'glGenProgramsARB', 'glProgramEnvParameter4dARB',
+'glProgramEnvParameter4dvARB', 'glProgramEnvParameter4fARB',
+'glProgramEnvParameter4fvARB', 'glProgramLocalParameter4dARB',
+'glProgramLocalParameter4dvARB', 'glProgramLocalParameter4fARB',
+'glProgramLocalParameter4fvARB', 'glGetProgramEnvParameterdvARB',
+'glGetProgramEnvParameterfvARB', 'glGetProgramLocalParameterdvARB',
+'glGetProgramLocalParameterfvARB', 'glGetProgramivARB',
+'glGetProgramStringARB', 'glGetVertexAttribdvARB', 'glGetVertexAttribfvARB',
+'glGetVertexAttribivARB', 'glGetVertexAttribPointervARB', 'glIsProgramARB',
+'PFNGLVERTEXATTRIB1DARBPROC', 'PFNGLVERTEXATTRIB1DVARBPROC',
+'PFNGLVERTEXATTRIB1FARBPROC', 'PFNGLVERTEXATTRIB1FVARBPROC',
+'PFNGLVERTEXATTRIB1SARBPROC', 'PFNGLVERTEXATTRIB1SVARBPROC',
+'PFNGLVERTEXATTRIB2DARBPROC', 'PFNGLVERTEXATTRIB2DVARBPROC',
+'PFNGLVERTEXATTRIB2FARBPROC', 'PFNGLVERTEXATTRIB2FVARBPROC',
+'PFNGLVERTEXATTRIB2SARBPROC', 'PFNGLVERTEXATTRIB2SVARBPROC',
+'PFNGLVERTEXATTRIB3DARBPROC', 'PFNGLVERTEXATTRIB3DVARBPROC',
+'PFNGLVERTEXATTRIB3FARBPROC', 'PFNGLVERTEXATTRIB3FVARBPROC',
+'PFNGLVERTEXATTRIB3SARBPROC', 'PFNGLVERTEXATTRIB3SVARBPROC',
+'PFNGLVERTEXATTRIB4NBVARBPROC', 'PFNGLVERTEXATTRIB4NIVARBPROC',
+'PFNGLVERTEXATTRIB4NSVARBPROC', 'PFNGLVERTEXATTRIB4NUBARBPROC',
+'PFNGLVERTEXATTRIB4NUBVARBPROC', 'PFNGLVERTEXATTRIB4NUIVARBPROC',
+'PFNGLVERTEXATTRIB4NUSVARBPROC', 'PFNGLVERTEXATTRIB4BVARBPROC',
+'PFNGLVERTEXATTRIB4DARBPROC', 'PFNGLVERTEXATTRIB4DVARBPROC',
+'PFNGLVERTEXATTRIB4FARBPROC', 'PFNGLVERTEXATTRIB4FVARBPROC',
+'PFNGLVERTEXATTRIB4IVARBPROC', 'PFNGLVERTEXATTRIB4SARBPROC',
+'PFNGLVERTEXATTRIB4SVARBPROC', 'PFNGLVERTEXATTRIB4UBVARBPROC',
+'PFNGLVERTEXATTRIB4UIVARBPROC', 'PFNGLVERTEXATTRIB4USVARBPROC',
+'PFNGLVERTEXATTRIBPOINTERARBPROC', 'PFNGLENABLEVERTEXATTRIBARRAYARBPROC',
+'PFNGLDISABLEVERTEXATTRIBARRAYARBPROC', 'PFNGLPROGRAMSTRINGARBPROC',
+'PFNGLBINDPROGRAMARBPROC', 'PFNGLDELETEPROGRAMSARBPROC',
+'PFNGLGENPROGRAMSARBPROC', 'PFNGLPROGRAMENVPARAMETER4DARBPROC',
+'PFNGLPROGRAMENVPARAMETER4DVARBPROC', 'PFNGLPROGRAMENVPARAMETER4FARBPROC',
+'PFNGLPROGRAMENVPARAMETER4FVARBPROC', 'PFNGLPROGRAMLOCALPARAMETER4DARBPROC',
+'PFNGLPROGRAMLOCALPARAMETER4DVARBPROC', 'PFNGLPROGRAMLOCALPARAMETER4FARBPROC',
+'PFNGLPROGRAMLOCALPARAMETER4FVARBPROC',
+'PFNGLGETPROGRAMENVPARAMETERDVARBPROC',
+'PFNGLGETPROGRAMENVPARAMETERFVARBPROC',
+'PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC',
+'PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC', 'PFNGLGETPROGRAMIVARBPROC',
+'PFNGLGETPROGRAMSTRINGARBPROC', 'PFNGLGETVERTEXATTRIBDVARBPROC',
+'PFNGLGETVERTEXATTRIBFVARBPROC', 'PFNGLGETVERTEXATTRIBIVARBPROC',
+'PFNGLGETVERTEXATTRIBPOINTERVARBPROC', 'PFNGLISPROGRAMARBPROC',
+'GL_ARB_fragment_program', 'GL_ARB_vertex_buffer_object', 'glBindBufferARB',
+'glDeleteBuffersARB', 'glGenBuffersARB', 'glIsBufferARB', 'glBufferDataARB',
+'glBufferSubDataARB', 'glGetBufferSubDataARB', 'glMapBufferARB',
+'glUnmapBufferARB', 'glGetBufferParameterivARB', 'glGetBufferPointervARB',
+'PFNGLBINDBUFFERARBPROC', 'PFNGLDELETEBUFFERSARBPROC',
+'PFNGLGENBUFFERSARBPROC', 'PFNGLISBUFFERARBPROC', 'PFNGLBUFFERDATAARBPROC',
+'PFNGLBUFFERSUBDATAARBPROC', 'PFNGLGETBUFFERSUBDATAARBPROC',
+'PFNGLMAPBUFFERARBPROC', 'PFNGLUNMAPBUFFERARBPROC',
+'PFNGLGETBUFFERPARAMETERIVARBPROC', 'PFNGLGETBUFFERPOINTERVARBPROC',
+'GL_ARB_occlusion_query', 'glGenQueriesARB', 'glDeleteQueriesARB',
+'glIsQueryARB', 'glBeginQueryARB', 'glEndQueryARB', 'glGetQueryivARB',
+'glGetQueryObjectivARB', 'glGetQueryObjectuivARB', 'PFNGLGENQUERIESARBPROC',
+'PFNGLDELETEQUERIESARBPROC', 'PFNGLISQUERYARBPROC', 'PFNGLBEGINQUERYARBPROC',
+'PFNGLENDQUERYARBPROC', 'PFNGLGETQUERYIVARBPROC',
+'PFNGLGETQUERYOBJECTIVARBPROC', 'PFNGLGETQUERYOBJECTUIVARBPROC',
+'GL_ARB_shader_objects', 'glDeleteObjectARB', 'glGetHandleARB',
+'glDetachObjectARB', 'glCreateShaderObjectARB', 'glShaderSourceARB',
+'glCompileShaderARB', 'glCreateProgramObjectARB', 'glAttachObjectARB',
+'glLinkProgramARB', 'glUseProgramObjectARB', 'glValidateProgramARB',
+'glUniform1fARB', 'glUniform2fARB', 'glUniform3fARB', 'glUniform4fARB',
+'glUniform1iARB', 'glUniform2iARB', 'glUniform3iARB', 'glUniform4iARB',
+'glUniform1fvARB', 'glUniform2fvARB', 'glUniform3fvARB', 'glUniform4fvARB',
+'glUniform1ivARB', 'glUniform2ivARB', 'glUniform3ivARB', 'glUniform4ivARB',
+'glUniformMatrix2fvARB', 'glUniformMatrix3fvARB', 'glUniformMatrix4fvARB',
+'glGetObjectParameterfvARB', 'glGetObjectParameterivARB', 'glGetInfoLogARB',
+'glGetAttachedObjectsARB', 'glGetUniformLocationARB', 'glGetActiveUniformARB',
+'glGetUniformfvARB', 'glGetUniformivARB', 'glGetShaderSourceARB',
+'PFNGLDELETEOBJECTARBPROC', 'PFNGLGETHANDLEARBPROC',
+'PFNGLDETACHOBJECTARBPROC', 'PFNGLCREATESHADEROBJECTARBPROC',
+'PFNGLSHADERSOURCEARBPROC', 'PFNGLCOMPILESHADERARBPROC',
+'PFNGLCREATEPROGRAMOBJECTARBPROC', 'PFNGLATTACHOBJECTARBPROC',
+'PFNGLLINKPROGRAMARBPROC', 'PFNGLUSEPROGRAMOBJECTARBPROC',
+'PFNGLVALIDATEPROGRAMARBPROC', 'PFNGLUNIFORM1FARBPROC',
+'PFNGLUNIFORM2FARBPROC', 'PFNGLUNIFORM3FARBPROC', 'PFNGLUNIFORM4FARBPROC',
+'PFNGLUNIFORM1IARBPROC', 'PFNGLUNIFORM2IARBPROC', 'PFNGLUNIFORM3IARBPROC',
+'PFNGLUNIFORM4IARBPROC', 'PFNGLUNIFORM1FVARBPROC', 'PFNGLUNIFORM2FVARBPROC',
+'PFNGLUNIFORM3FVARBPROC', 'PFNGLUNIFORM4FVARBPROC', 'PFNGLUNIFORM1IVARBPROC',
+'PFNGLUNIFORM2IVARBPROC', 'PFNGLUNIFORM3IVARBPROC', 'PFNGLUNIFORM4IVARBPROC',
+'PFNGLUNIFORMMATRIX2FVARBPROC', 'PFNGLUNIFORMMATRIX3FVARBPROC',
+'PFNGLUNIFORMMATRIX4FVARBPROC', 'PFNGLGETOBJECTPARAMETERFVARBPROC',
+'PFNGLGETOBJECTPARAMETERIVARBPROC', 'PFNGLGETINFOLOGARBPROC',
+'PFNGLGETATTACHEDOBJECTSARBPROC', 'PFNGLGETUNIFORMLOCATIONARBPROC',
+'PFNGLGETACTIVEUNIFORMARBPROC', 'PFNGLGETUNIFORMFVARBPROC',
+'PFNGLGETUNIFORMIVARBPROC', 'PFNGLGETSHADERSOURCEARBPROC',
+'GL_ARB_vertex_shader', 'glBindAttribLocationARB', 'glGetActiveAttribARB',
+'glGetAttribLocationARB', 'PFNGLBINDATTRIBLOCATIONARBPROC',
+'PFNGLGETACTIVEATTRIBARBPROC', 'PFNGLGETATTRIBLOCATIONARBPROC',
+'GL_ARB_fragment_shader', 'GL_ARB_shading_language_100',
+'GL_ARB_texture_non_power_of_two', 'GL_ARB_point_sprite',
+'GL_ARB_fragment_program_shadow', 'GL_ARB_draw_buffers', 'glDrawBuffersARB',
+'PFNGLDRAWBUFFERSARBPROC', 'GL_ARB_texture_rectangle',
+'GL_ARB_color_buffer_float', 'glClampColorARB', 'PFNGLCLAMPCOLORARBPROC',
+'GL_ARB_half_float_pixel', 'GL_ARB_texture_float',
+'GL_ARB_pixel_buffer_object', 'GL_ARB_depth_buffer_float',
+'GL_ARB_draw_instanced', 'glDrawArraysInstancedARB',
+'glDrawElementsInstancedARB', 'PFNGLDRAWARRAYSINSTANCEDARBPROC',
+'PFNGLDRAWELEMENTSINSTANCEDARBPROC', 'GL_ARB_framebuffer_object',
+'glIsRenderbuffer', 'glBindRenderbuffer', 'glDeleteRenderbuffers',
+'glGenRenderbuffers', 'glRenderbufferStorage', 'glGetRenderbufferParameteriv',
+'glIsFramebuffer', 'glBindFramebuffer', 'glDeleteFramebuffers',
+'glGenFramebuffers', 'glCheckFramebufferStatus', 'glFramebufferTexture1D',
+'glFramebufferTexture2D', 'glFramebufferTexture3D',
+'glFramebufferRenderbuffer', 'glGetFramebufferAttachmentParameteriv',
+'glGenerateMipmap', 'glBlitFramebuffer', 'glRenderbufferStorageMultisample',
+'glFramebufferTextureLayer', 'PFNGLISRENDERBUFFERPROC',
+'PFNGLBINDRENDERBUFFERPROC', 'PFNGLDELETERENDERBUFFERSPROC',
+'PFNGLGENRENDERBUFFERSPROC', 'PFNGLRENDERBUFFERSTORAGEPROC',
+'PFNGLGETRENDERBUFFERPARAMETERIVPROC', 'PFNGLISFRAMEBUFFERPROC',
+'PFNGLBINDFRAMEBUFFERPROC', 'PFNGLDELETEFRAMEBUFFERSPROC',
+'PFNGLGENFRAMEBUFFERSPROC', 'PFNGLCHECKFRAMEBUFFERSTATUSPROC',
+'PFNGLFRAMEBUFFERTEXTURE1DPROC', 'PFNGLFRAMEBUFFERTEXTURE2DPROC',
+'PFNGLFRAMEBUFFERTEXTURE3DPROC', 'PFNGLFRAMEBUFFERRENDERBUFFERPROC',
+'PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC', 'PFNGLGENERATEMIPMAPPROC',
+'PFNGLBLITFRAMEBUFFERPROC', 'PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC',
+'PFNGLFRAMEBUFFERTEXTURELAYERPROC', 'GL_ARB_framebuffer_sRGB',
+'GL_ARB_geometry_shader4', 'glProgramParameteriARB',
+'glFramebufferTextureARB', 'glFramebufferTextureLayerARB',
+'glFramebufferTextureFaceARB', 'PFNGLPROGRAMPARAMETERIARBPROC',
+'PFNGLFRAMEBUFFERTEXTUREARBPROC', 'PFNGLFRAMEBUFFERTEXTURELAYERARBPROC',
+'PFNGLFRAMEBUFFERTEXTUREFACEARBPROC', 'GL_ARB_half_float_vertex',
+'GL_ARB_instanced_arrays', 'glVertexAttribDivisorARB',
+'PFNGLVERTEXATTRIBDIVISORARBPROC', 'GL_ARB_map_buffer_range',
+'glMapBufferRange', 'glFlushMappedBufferRange', 'PFNGLMAPBUFFERRANGEPROC',
+'PFNGLFLUSHMAPPEDBUFFERRANGEPROC', 'GL_ARB_texture_buffer_object',
+'glTexBufferARB', 'PFNGLTEXBUFFERARBPROC', 'GL_ARB_texture_compression_rgtc',
+'GL_ARB_texture_rg', 'GL_ARB_vertex_array_object', 'glBindVertexArray',
+'glDeleteVertexArrays', 'glGenVertexArrays', 'glIsVertexArray',
+'PFNGLBINDVERTEXARRAYPROC', 'PFNGLDELETEVERTEXARRAYSPROC',
+'PFNGLGENVERTEXARRAYSPROC', 'PFNGLISVERTEXARRAYPROC', 'GL_EXT_abgr',
+'GL_EXT_blend_color', 'glBlendColorEXT', 'PFNGLBLENDCOLOREXTPROC',
+'GL_EXT_polygon_offset', 'glPolygonOffsetEXT', 'PFNGLPOLYGONOFFSETEXTPROC',
+'GL_EXT_texture', 'GL_EXT_texture3D', 'glTexImage3DEXT', 'glTexSubImage3DEXT',
+'PFNGLTEXIMAGE3DEXTPROC', 'PFNGLTEXSUBIMAGE3DEXTPROC',
+'GL_SGIS_texture_filter4', 'glGetTexFilterFuncSGIS', 'glTexFilterFuncSGIS',
+'PFNGLGETTEXFILTERFUNCSGISPROC', 'PFNGLTEXFILTERFUNCSGISPROC',
+'GL_EXT_subtexture', 'glTexSubImage1DEXT', 'glTexSubImage2DEXT',
+'PFNGLTEXSUBIMAGE1DEXTPROC', 'PFNGLTEXSUBIMAGE2DEXTPROC',
+'GL_EXT_copy_texture', 'glCopyTexImage1DEXT', 'glCopyTexImage2DEXT',
+'glCopyTexSubImage1DEXT', 'glCopyTexSubImage2DEXT', 'glCopyTexSubImage3DEXT',
+'PFNGLCOPYTEXIMAGE1DEXTPROC', 'PFNGLCOPYTEXIMAGE2DEXTPROC',
+'PFNGLCOPYTEXSUBIMAGE1DEXTPROC', 'PFNGLCOPYTEXSUBIMAGE2DEXTPROC',
+'PFNGLCOPYTEXSUBIMAGE3DEXTPROC', 'GL_EXT_histogram', 'glGetHistogramEXT',
+'glGetHistogramParameterfvEXT', 'glGetHistogramParameterivEXT',
+'glGetMinmaxEXT', 'glGetMinmaxParameterfvEXT', 'glGetMinmaxParameterivEXT',
+'glHistogramEXT', 'glMinmaxEXT', 'glResetHistogramEXT', 'glResetMinmaxEXT',
+'PFNGLGETHISTOGRAMEXTPROC', 'PFNGLGETHISTOGRAMPARAMETERFVEXTPROC',
+'PFNGLGETHISTOGRAMPARAMETERIVEXTPROC', 'PFNGLGETMINMAXEXTPROC',
+'PFNGLGETMINMAXPARAMETERFVEXTPROC', 'PFNGLGETMINMAXPARAMETERIVEXTPROC',
+'PFNGLHISTOGRAMEXTPROC', 'PFNGLMINMAXEXTPROC', 'PFNGLRESETHISTOGRAMEXTPROC',
+'PFNGLRESETMINMAXEXTPROC', 'GL_EXT_convolution', 'glConvolutionFilter1DEXT',
+'glConvolutionFilter2DEXT', 'glConvolutionParameterfEXT',
+'glConvolutionParameterfvEXT', 'glConvolutionParameteriEXT',
+'glConvolutionParameterivEXT', 'glCopyConvolutionFilter1DEXT',
+'glCopyConvolutionFilter2DEXT', 'glGetConvolutionFilterEXT',
+'glGetConvolutionParameterfvEXT', 'glGetConvolutionParameterivEXT',
+'glGetSeparableFilterEXT', 'glSeparableFilter2DEXT',
+'PFNGLCONVOLUTIONFILTER1DEXTPROC', 'PFNGLCONVOLUTIONFILTER2DEXTPROC',
+'PFNGLCONVOLUTIONPARAMETERFEXTPROC', 'PFNGLCONVOLUTIONPARAMETERFVEXTPROC',
+'PFNGLCONVOLUTIONPARAMETERIEXTPROC', 'PFNGLCONVOLUTIONPARAMETERIVEXTPROC',
+'PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC', 'PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC',
+'PFNGLGETCONVOLUTIONFILTEREXTPROC', 'PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC',
+'PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC', 'PFNGLGETSEPARABLEFILTEREXTPROC',
+'PFNGLSEPARABLEFILTER2DEXTPROC', 'GL_EXT_color_matrix', 'GL_SGI_color_table',
+'glColorTableSGI', 'glColorTableParameterfvSGI', 'glColorTableParameterivSGI',
+'glCopyColorTableSGI', 'glGetColorTableSGI', 'glGetColorTableParameterfvSGI',
+'glGetColorTableParameterivSGI', 'PFNGLCOLORTABLESGIPROC',
+'PFNGLCOLORTABLEPARAMETERFVSGIPROC', 'PFNGLCOLORTABLEPARAMETERIVSGIPROC',
+'PFNGLCOPYCOLORTABLESGIPROC', 'PFNGLGETCOLORTABLESGIPROC',
+'PFNGLGETCOLORTABLEPARAMETERFVSGIPROC',
+'PFNGLGETCOLORTABLEPARAMETERIVSGIPROC', 'GL_SGIX_pixel_texture',
+'glPixelTexGenSGIX', 'PFNGLPIXELTEXGENSGIXPROC', 'GL_SGIS_pixel_texture',
+'glPixelTexGenParameteriSGIS', 'glPixelTexGenParameterivSGIS',
+'glPixelTexGenParameterfSGIS', 'glPixelTexGenParameterfvSGIS',
+'glGetPixelTexGenParameterivSGIS', 'glGetPixelTexGenParameterfvSGIS',
+'PFNGLPIXELTEXGENPARAMETERISGISPROC', 'PFNGLPIXELTEXGENPARAMETERIVSGISPROC',
+'PFNGLPIXELTEXGENPARAMETERFSGISPROC', 'PFNGLPIXELTEXGENPARAMETERFVSGISPROC',
+'PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC',
+'PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC', 'GL_SGIS_texture4D',
+'glTexImage4DSGIS', 'glTexSubImage4DSGIS', 'PFNGLTEXIMAGE4DSGISPROC',
+'PFNGLTEXSUBIMAGE4DSGISPROC', 'GL_SGI_texture_color_table', 'GL_EXT_cmyka',
+'GL_EXT_texture_object', 'glAreTexturesResidentEXT', 'glBindTextureEXT',
+'glDeleteTexturesEXT', 'glGenTexturesEXT', 'glIsTextureEXT',
+'glPrioritizeTexturesEXT', 'PFNGLARETEXTURESRESIDENTEXTPROC',
+'PFNGLBINDTEXTUREEXTPROC', 'PFNGLDELETETEXTURESEXTPROC',
+'PFNGLGENTEXTURESEXTPROC', 'PFNGLISTEXTUREEXTPROC',
+'PFNGLPRIORITIZETEXTURESEXTPROC', 'GL_SGIS_detail_texture',
+'glDetailTexFuncSGIS', 'glGetDetailTexFuncSGIS', 'PFNGLDETAILTEXFUNCSGISPROC',
+'PFNGLGETDETAILTEXFUNCSGISPROC', 'GL_SGIS_sharpen_texture',
+'glSharpenTexFuncSGIS', 'glGetSharpenTexFuncSGIS',
+'PFNGLSHARPENTEXFUNCSGISPROC', 'PFNGLGETSHARPENTEXFUNCSGISPROC',
+'GL_EXT_packed_pixels', 'GL_SGIS_texture_lod', 'GL_SGIS_multisample',
+'glSampleMaskSGIS', 'glSamplePatternSGIS', 'PFNGLSAMPLEMASKSGISPROC',
+'PFNGLSAMPLEPATTERNSGISPROC', 'GL_EXT_rescale_normal', 'GL_EXT_vertex_array',
+'glArrayElementEXT', 'glColorPointerEXT', 'glDrawArraysEXT',
+'glEdgeFlagPointerEXT', 'glGetPointervEXT', 'glIndexPointerEXT',
+'glNormalPointerEXT', 'glTexCoordPointerEXT', 'glVertexPointerEXT',
+'PFNGLARRAYELEMENTEXTPROC', 'PFNGLCOLORPOINTEREXTPROC',
+'PFNGLDRAWARRAYSEXTPROC', 'PFNGLEDGEFLAGPOINTEREXTPROC',
+'PFNGLGETPOINTERVEXTPROC', 'PFNGLINDEXPOINTEREXTPROC',
+'PFNGLNORMALPOINTEREXTPROC', 'PFNGLTEXCOORDPOINTEREXTPROC',
+'PFNGLVERTEXPOINTEREXTPROC', 'GL_EXT_misc_attribute',
+'GL_SGIS_generate_mipmap', 'GL_SGIX_clipmap', 'GL_SGIX_shadow',
+'GL_SGIS_texture_edge_clamp', 'GL_SGIS_texture_border_clamp',
+'GL_EXT_blend_minmax', 'glBlendEquationEXT', 'PFNGLBLENDEQUATIONEXTPROC',
+'GL_EXT_blend_subtract', 'GL_EXT_blend_logic_op', 'GL_SGIX_interlace',
+'GL_SGIX_pixel_tiles', 'GL_SGIX_texture_select', 'GL_SGIX_sprite',
+'glSpriteParameterfSGIX', 'glSpriteParameterfvSGIX', 'glSpriteParameteriSGIX',
+'glSpriteParameterivSGIX', 'PFNGLSPRITEPARAMETERFSGIXPROC',
+'PFNGLSPRITEPARAMETERFVSGIXPROC', 'PFNGLSPRITEPARAMETERISGIXPROC',
+'PFNGLSPRITEPARAMETERIVSGIXPROC', 'GL_SGIX_texture_multi_buffer',
+'GL_EXT_point_parameters', 'glPointParameterfEXT', 'glPointParameterfvEXT',
+'PFNGLPOINTPARAMETERFEXTPROC', 'PFNGLPOINTPARAMETERFVEXTPROC',
+'GL_SGIS_point_parameters', 'glPointParameterfSGIS', 'glPointParameterfvSGIS',
+'PFNGLPOINTPARAMETERFSGISPROC', 'PFNGLPOINTPARAMETERFVSGISPROC',
+'GL_SGIX_instruments', 'glGetInstrumentsSGIX', 'glInstrumentsBufferSGIX',
+'glPollInstrumentsSGIX', 'glReadInstrumentsSGIX', 'glStartInstrumentsSGIX',
+'glStopInstrumentsSGIX', 'PFNGLGETINSTRUMENTSSGIXPROC',
+'PFNGLINSTRUMENTSBUFFERSGIXPROC', 'PFNGLPOLLINSTRUMENTSSGIXPROC',
+'PFNGLREADINSTRUMENTSSGIXPROC', 'PFNGLSTARTINSTRUMENTSSGIXPROC',
+'PFNGLSTOPINSTRUMENTSSGIXPROC', 'GL_SGIX_texture_scale_bias',
+'GL_SGIX_framezoom', 'glFrameZoomSGIX', 'PFNGLFRAMEZOOMSGIXPROC',
+'GL_SGIX_tag_sample_buffer', 'glTagSampleBufferSGIX',
+'PFNGLTAGSAMPLEBUFFERSGIXPROC', 'GL_SGIX_polynomial_ffd',
+'glDeformationMap3dSGIX', 'glDeformationMap3fSGIX', 'glDeformSGIX',
+'glLoadIdentityDeformationMapSGIX', 'PFNGLDEFORMATIONMAP3DSGIXPROC',
+'PFNGLDEFORMATIONMAP3FSGIXPROC', 'PFNGLDEFORMSGIXPROC',
+'PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC', 'GL_SGIX_reference_plane',
+'glReferencePlaneSGIX', 'PFNGLREFERENCEPLANESGIXPROC', 'GL_SGIX_flush_raster',
+'glFlushRasterSGIX', 'PFNGLFLUSHRASTERSGIXPROC', 'GL_SGIX_depth_texture',
+'GL_SGIS_fog_function', 'glFogFuncSGIS', 'glGetFogFuncSGIS',
+'PFNGLFOGFUNCSGISPROC', 'PFNGLGETFOGFUNCSGISPROC', 'GL_SGIX_fog_offset',
+'GL_HP_image_transform', 'glImageTransformParameteriHP',
+'glImageTransformParameterfHP', 'glImageTransformParameterivHP',
+'glImageTransformParameterfvHP', 'glGetImageTransformParameterivHP',
+'glGetImageTransformParameterfvHP', 'PFNGLIMAGETRANSFORMPARAMETERIHPPROC',
+'PFNGLIMAGETRANSFORMPARAMETERFHPPROC', 'PFNGLIMAGETRANSFORMPARAMETERIVHPPROC',
+'PFNGLIMAGETRANSFORMPARAMETERFVHPPROC',
+'PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC',
+'PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC', 'GL_HP_convolution_border_modes',
+'GL_SGIX_texture_add_env', 'GL_EXT_color_subtable', 'glColorSubTableEXT',
+'glCopyColorSubTableEXT', 'PFNGLCOLORSUBTABLEEXTPROC',
+'PFNGLCOPYCOLORSUBTABLEEXTPROC', 'GL_PGI_vertex_hints', 'GL_PGI_misc_hints',
+'glHintPGI', 'PFNGLHINTPGIPROC', 'GL_EXT_paletted_texture', 'glColorTableEXT',
+'glGetColorTableEXT', 'glGetColorTableParameterivEXT',
+'glGetColorTableParameterfvEXT', 'PFNGLCOLORTABLEEXTPROC',
+'PFNGLGETCOLORTABLEEXTPROC', 'PFNGLGETCOLORTABLEPARAMETERIVEXTPROC',
+'PFNGLGETCOLORTABLEPARAMETERFVEXTPROC', 'GL_EXT_clip_volume_hint',
+'GL_SGIX_list_priority', 'glGetListParameterfvSGIX',
+'glGetListParameterivSGIX', 'glListParameterfSGIX', 'glListParameterfvSGIX',
+'glListParameteriSGIX', 'glListParameterivSGIX',
+'PFNGLGETLISTPARAMETERFVSGIXPROC', 'PFNGLGETLISTPARAMETERIVSGIXPROC',
+'PFNGLLISTPARAMETERFSGIXPROC', 'PFNGLLISTPARAMETERFVSGIXPROC',
+'PFNGLLISTPARAMETERISGIXPROC', 'PFNGLLISTPARAMETERIVSGIXPROC',
+'GL_SGIX_ir_instrument1', 'GL_SGIX_calligraphic_fragment',
+'GL_SGIX_texture_lod_bias', 'GL_SGIX_shadow_ambient', 'GL_EXT_index_texture',
+'GL_EXT_index_material', 'glIndexMaterialEXT', 'PFNGLINDEXMATERIALEXTPROC',
+'GL_EXT_index_func', 'glIndexFuncEXT', 'PFNGLINDEXFUNCEXTPROC',
+'GL_EXT_index_array_formats', 'GL_EXT_compiled_vertex_array',
+'glLockArraysEXT', 'glUnlockArraysEXT', 'PFNGLLOCKARRAYSEXTPROC',
+'PFNGLUNLOCKARRAYSEXTPROC', 'GL_EXT_cull_vertex', 'glCullParameterdvEXT',
+'glCullParameterfvEXT', 'PFNGLCULLPARAMETERDVEXTPROC',
+'PFNGLCULLPARAMETERFVEXTPROC', 'GL_SGIX_ycrcb', 'GL_SGIX_fragment_lighting',
+'glFragmentColorMaterialSGIX', 'glFragmentLightfSGIX',
+'glFragmentLightfvSGIX', 'glFragmentLightiSGIX', 'glFragmentLightivSGIX',
+'glFragmentLightModelfSGIX', 'glFragmentLightModelfvSGIX',
+'glFragmentLightModeliSGIX', 'glFragmentLightModelivSGIX',
+'glFragmentMaterialfSGIX', 'glFragmentMaterialfvSGIX',
+'glFragmentMaterialiSGIX', 'glFragmentMaterialivSGIX',
+'glGetFragmentLightfvSGIX', 'glGetFragmentLightivSGIX',
+'glGetFragmentMaterialfvSGIX', 'glGetFragmentMaterialivSGIX',
+'glLightEnviSGIX', 'PFNGLFRAGMENTCOLORMATERIALSGIXPROC',
+'PFNGLFRAGMENTLIGHTFSGIXPROC', 'PFNGLFRAGMENTLIGHTFVSGIXPROC',
+'PFNGLFRAGMENTLIGHTISGIXPROC', 'PFNGLFRAGMENTLIGHTIVSGIXPROC',
+'PFNGLFRAGMENTLIGHTMODELFSGIXPROC', 'PFNGLFRAGMENTLIGHTMODELFVSGIXPROC',
+'PFNGLFRAGMENTLIGHTMODELISGIXPROC', 'PFNGLFRAGMENTLIGHTMODELIVSGIXPROC',
+'PFNGLFRAGMENTMATERIALFSGIXPROC', 'PFNGLFRAGMENTMATERIALFVSGIXPROC',
+'PFNGLFRAGMENTMATERIALISGIXPROC', 'PFNGLFRAGMENTMATERIALIVSGIXPROC',
+'PFNGLGETFRAGMENTLIGHTFVSGIXPROC', 'PFNGLGETFRAGMENTLIGHTIVSGIXPROC',
+'PFNGLGETFRAGMENTMATERIALFVSGIXPROC', 'PFNGLGETFRAGMENTMATERIALIVSGIXPROC',
+'PFNGLLIGHTENVISGIXPROC', 'GL_IBM_rasterpos_clip', 'GL_HP_texture_lighting',
+'GL_EXT_draw_range_elements', 'glDrawRangeElementsEXT',
+'PFNGLDRAWRANGEELEMENTSEXTPROC', 'GL_WIN_phong_shading',
+'GL_WIN_specular_fog', 'GL_EXT_light_texture', 'glApplyTextureEXT',
+'glTextureLightEXT', 'glTextureMaterialEXT', 'PFNGLAPPLYTEXTUREEXTPROC',
+'PFNGLTEXTURELIGHTEXTPROC', 'PFNGLTEXTUREMATERIALEXTPROC',
+'GL_SGIX_blend_alpha_minmax', 'GL_EXT_bgra', 'GL_SGIX_async',
+'glAsyncMarkerSGIX', 'glFinishAsyncSGIX', 'glPollAsyncSGIX',
+'glGenAsyncMarkersSGIX', 'glDeleteAsyncMarkersSGIX', 'glIsAsyncMarkerSGIX',
+'PFNGLASYNCMARKERSGIXPROC', 'PFNGLFINISHASYNCSGIXPROC',
+'PFNGLPOLLASYNCSGIXPROC', 'PFNGLGENASYNCMARKERSSGIXPROC',
+'PFNGLDELETEASYNCMARKERSSGIXPROC', 'PFNGLISASYNCMARKERSGIXPROC',
+'GL_SGIX_async_pixel', 'GL_SGIX_async_histogram', 'GL_INTEL_parallel_arrays',
+'glVertexPointervINTEL', 'glNormalPointervINTEL', 'glColorPointervINTEL',
+'glTexCoordPointervINTEL', 'PFNGLVERTEXPOINTERVINTELPROC',
+'PFNGLNORMALPOINTERVINTELPROC', 'PFNGLCOLORPOINTERVINTELPROC',
+'PFNGLTEXCOORDPOINTERVINTELPROC', 'GL_HP_occlusion_test',
+'GL_EXT_pixel_transform', 'glPixelTransformParameteriEXT',
+'glPixelTransformParameterfEXT', 'glPixelTransformParameterivEXT',
+'glPixelTransformParameterfvEXT', 'PFNGLPIXELTRANSFORMPARAMETERIEXTPROC',
+'PFNGLPIXELTRANSFORMPARAMETERFEXTPROC',
+'PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC',
+'PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC', 'GL_EXT_pixel_transform_color_table',
+'GL_EXT_shared_texture_palette', 'GL_EXT_separate_specular_color',
+'GL_EXT_secondary_color', 'glSecondaryColor3bEXT', 'glSecondaryColor3bvEXT',
+'glSecondaryColor3dEXT', 'glSecondaryColor3dvEXT', 'glSecondaryColor3fEXT',
+'glSecondaryColor3fvEXT', 'glSecondaryColor3iEXT', 'glSecondaryColor3ivEXT',
+'glSecondaryColor3sEXT', 'glSecondaryColor3svEXT', 'glSecondaryColor3ubEXT',
+'glSecondaryColor3ubvEXT', 'glSecondaryColor3uiEXT',
+'glSecondaryColor3uivEXT', 'glSecondaryColor3usEXT',
+'glSecondaryColor3usvEXT', 'glSecondaryColorPointerEXT',
+'PFNGLSECONDARYCOLOR3BEXTPROC', 'PFNGLSECONDARYCOLOR3BVEXTPROC',
+'PFNGLSECONDARYCOLOR3DEXTPROC', 'PFNGLSECONDARYCOLOR3DVEXTPROC',
+'PFNGLSECONDARYCOLOR3FEXTPROC', 'PFNGLSECONDARYCOLOR3FVEXTPROC',
+'PFNGLSECONDARYCOLOR3IEXTPROC', 'PFNGLSECONDARYCOLOR3IVEXTPROC',
+'PFNGLSECONDARYCOLOR3SEXTPROC', 'PFNGLSECONDARYCOLOR3SVEXTPROC',
+'PFNGLSECONDARYCOLOR3UBEXTPROC', 'PFNGLSECONDARYCOLOR3UBVEXTPROC',
+'PFNGLSECONDARYCOLOR3UIEXTPROC', 'PFNGLSECONDARYCOLOR3UIVEXTPROC',
+'PFNGLSECONDARYCOLOR3USEXTPROC', 'PFNGLSECONDARYCOLOR3USVEXTPROC',
+'PFNGLSECONDARYCOLORPOINTEREXTPROC', 'GL_EXT_texture_perturb_normal',
+'glTextureNormalEXT', 'PFNGLTEXTURENORMALEXTPROC', 'GL_EXT_multi_draw_arrays',
+'glMultiDrawArraysEXT', 'glMultiDrawElementsEXT',
+'PFNGLMULTIDRAWARRAYSEXTPROC', 'PFNGLMULTIDRAWELEMENTSEXTPROC',
+'GL_EXT_fog_coord', 'glFogCoordfEXT', 'glFogCoordfvEXT', 'glFogCoorddEXT',
+'glFogCoorddvEXT', 'glFogCoordPointerEXT', 'PFNGLFOGCOORDFEXTPROC',
+'PFNGLFOGCOORDFVEXTPROC', 'PFNGLFOGCOORDDEXTPROC', 'PFNGLFOGCOORDDVEXTPROC',
+'PFNGLFOGCOORDPOINTEREXTPROC', 'GL_REND_screen_coordinates',
+'GL_EXT_coordinate_frame', 'glTangent3bEXT', 'glTangent3bvEXT',
+'glTangent3dEXT', 'glTangent3dvEXT', 'glTangent3fEXT', 'glTangent3fvEXT',
+'glTangent3iEXT', 'glTangent3ivEXT', 'glTangent3sEXT', 'glTangent3svEXT',
+'glBinormal3bEXT', 'glBinormal3bvEXT', 'glBinormal3dEXT', 'glBinormal3dvEXT',
+'glBinormal3fEXT', 'glBinormal3fvEXT', 'glBinormal3iEXT', 'glBinormal3ivEXT',
+'glBinormal3sEXT', 'glBinormal3svEXT', 'glTangentPointerEXT',
+'glBinormalPointerEXT', 'PFNGLTANGENT3BEXTPROC', 'PFNGLTANGENT3BVEXTPROC',
+'PFNGLTANGENT3DEXTPROC', 'PFNGLTANGENT3DVEXTPROC', 'PFNGLTANGENT3FEXTPROC',
+'PFNGLTANGENT3FVEXTPROC', 'PFNGLTANGENT3IEXTPROC', 'PFNGLTANGENT3IVEXTPROC',
+'PFNGLTANGENT3SEXTPROC', 'PFNGLTANGENT3SVEXTPROC', 'PFNGLBINORMAL3BEXTPROC',
+'PFNGLBINORMAL3BVEXTPROC', 'PFNGLBINORMAL3DEXTPROC',
+'PFNGLBINORMAL3DVEXTPROC', 'PFNGLBINORMAL3FEXTPROC',
+'PFNGLBINORMAL3FVEXTPROC', 'PFNGLBINORMAL3IEXTPROC',
+'PFNGLBINORMAL3IVEXTPROC', 'PFNGLBINORMAL3SEXTPROC',
+'PFNGLBINORMAL3SVEXTPROC', 'PFNGLTANGENTPOINTEREXTPROC',
+'PFNGLBINORMALPOINTEREXTPROC', 'GL_EXT_texture_env_combine',
+'GL_APPLE_specular_vector', 'GL_APPLE_transform_hint', 'GL_SGIX_fog_scale',
+'GL_SUNX_constant_data', 'glFinishTextureSUNX', 'PFNGLFINISHTEXTURESUNXPROC',
+'GL_SUN_global_alpha', 'glGlobalAlphaFactorbSUN', 'glGlobalAlphaFactorsSUN',
+'glGlobalAlphaFactoriSUN', 'glGlobalAlphaFactorfSUN',
+'glGlobalAlphaFactordSUN', 'glGlobalAlphaFactorubSUN',
+'glGlobalAlphaFactorusSUN', 'glGlobalAlphaFactoruiSUN',
+'PFNGLGLOBALALPHAFACTORBSUNPROC', 'PFNGLGLOBALALPHAFACTORSSUNPROC',
+'PFNGLGLOBALALPHAFACTORISUNPROC', 'PFNGLGLOBALALPHAFACTORFSUNPROC',
+'PFNGLGLOBALALPHAFACTORDSUNPROC', 'PFNGLGLOBALALPHAFACTORUBSUNPROC',
+'PFNGLGLOBALALPHAFACTORUSSUNPROC', 'PFNGLGLOBALALPHAFACTORUISUNPROC',
+'GL_SUN_triangle_list', 'glReplacementCodeuiSUN', 'glReplacementCodeusSUN',
+'glReplacementCodeubSUN', 'glReplacementCodeuivSUN',
+'glReplacementCodeusvSUN', 'glReplacementCodeubvSUN',
+'glReplacementCodePointerSUN', 'PFNGLREPLACEMENTCODEUISUNPROC',
+'PFNGLREPLACEMENTCODEUSSUNPROC', 'PFNGLREPLACEMENTCODEUBSUNPROC',
+'PFNGLREPLACEMENTCODEUIVSUNPROC', 'PFNGLREPLACEMENTCODEUSVSUNPROC',
+'PFNGLREPLACEMENTCODEUBVSUNPROC', 'PFNGLREPLACEMENTCODEPOINTERSUNPROC',
+'GL_SUN_vertex', 'glColor4ubVertex2fSUN', 'glColor4ubVertex2fvSUN',
+'glColor4ubVertex3fSUN', 'glColor4ubVertex3fvSUN', 'glColor3fVertex3fSUN',
+'glColor3fVertex3fvSUN', 'glNormal3fVertex3fSUN', 'glNormal3fVertex3fvSUN',
+'glColor4fNormal3fVertex3fSUN', 'glColor4fNormal3fVertex3fvSUN',
+'glTexCoord2fVertex3fSUN', 'glTexCoord2fVertex3fvSUN',
+'glTexCoord4fVertex4fSUN', 'glTexCoord4fVertex4fvSUN',
+'glTexCoord2fColor4ubVertex3fSUN', 'glTexCoord2fColor4ubVertex3fvSUN',
+'glTexCoord2fColor3fVertex3fSUN', 'glTexCoord2fColor3fVertex3fvSUN',
+'glTexCoord2fNormal3fVertex3fSUN', 'glTexCoord2fNormal3fVertex3fvSUN',
+'glTexCoord2fColor4fNormal3fVertex3fSUN',
+'glTexCoord2fColor4fNormal3fVertex3fvSUN',
+'glTexCoord4fColor4fNormal3fVertex4fSUN',
+'glTexCoord4fColor4fNormal3fVertex4fvSUN', 'glReplacementCodeuiVertex3fSUN',
+'glReplacementCodeuiVertex3fvSUN', 'glReplacementCodeuiColor4ubVertex3fSUN',
+'glReplacementCodeuiColor4ubVertex3fvSUN',
+'glReplacementCodeuiColor3fVertex3fSUN',
+'glReplacementCodeuiColor3fVertex3fvSUN',
+'glReplacementCodeuiNormal3fVertex3fSUN',
+'glReplacementCodeuiNormal3fVertex3fvSUN',
+'glReplacementCodeuiColor4fNormal3fVertex3fSUN',
+'glReplacementCodeuiColor4fNormal3fVertex3fvSUN',
+'glReplacementCodeuiTexCoord2fVertex3fSUN',
+'glReplacementCodeuiTexCoord2fVertex3fvSUN',
+'glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN',
+'glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN',
+'glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN',
+'glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN',
+'PFNGLCOLOR4UBVERTEX2FSUNPROC', 'PFNGLCOLOR4UBVERTEX2FVSUNPROC',
+'PFNGLCOLOR4UBVERTEX3FSUNPROC', 'PFNGLCOLOR4UBVERTEX3FVSUNPROC',
+'PFNGLCOLOR3FVERTEX3FSUNPROC', 'PFNGLCOLOR3FVERTEX3FVSUNPROC',
+'PFNGLNORMAL3FVERTEX3FSUNPROC', 'PFNGLNORMAL3FVERTEX3FVSUNPROC',
+'PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC', 'PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC',
+'PFNGLTEXCOORD2FVERTEX3FSUNPROC', 'PFNGLTEXCOORD2FVERTEX3FVSUNPROC',
+'PFNGLTEXCOORD4FVERTEX4FSUNPROC', 'PFNGLTEXCOORD4FVERTEX4FVSUNPROC',
+'PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC',
+'PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC',
+'PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC',
+'PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC',
+'PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC',
+'PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC',
+'PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC',
+'PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC',
+'PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC',
+'PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC',
+'PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC',
+'PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC',
+'PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC',
+'PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC',
+'PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC',
+'PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC',
+'PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC',
+'PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC',
+'PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC',
+'PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC',
+'PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC',
+'PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC',
+'PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC',
+'PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC',
+'PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC',
+'PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC',
+'GL_EXT_blend_func_separate', 'glBlendFuncSeparateEXT',
+'PFNGLBLENDFUNCSEPARATEEXTPROC', 'GL_INGR_blend_func_separate',
+'glBlendFuncSeparateINGR', 'PFNGLBLENDFUNCSEPARATEINGRPROC',
+'GL_INGR_color_clamp', 'GL_INGR_interlace_read', 'GL_EXT_stencil_wrap',
+'GL_EXT_422_pixels', 'GL_NV_texgen_reflection',
+'GL_SUN_convolution_border_modes', 'GL_EXT_texture_env_add',
+'GL_EXT_texture_lod_bias', 'GL_EXT_texture_filter_anisotropic',
+'GL_EXT_vertex_weighting', 'glVertexWeightfEXT', 'glVertexWeightfvEXT',
+'glVertexWeightPointerEXT', 'PFNGLVERTEXWEIGHTFEXTPROC',
+'PFNGLVERTEXWEIGHTFVEXTPROC', 'PFNGLVERTEXWEIGHTPOINTEREXTPROC',
+'GL_NV_light_max_exponent', 'GL_NV_vertex_array_range',
+'glFlushVertexArrayRangeNV', 'glVertexArrayRangeNV',
+'PFNGLFLUSHVERTEXARRAYRANGENVPROC', 'PFNGLVERTEXARRAYRANGENVPROC',
+'GL_NV_register_combiners', 'glCombinerParameterfvNV',
+'glCombinerParameterfNV', 'glCombinerParameterivNV', 'glCombinerParameteriNV',
+'glCombinerInputNV', 'glCombinerOutputNV', 'glFinalCombinerInputNV',
+'glGetCombinerInputParameterfvNV', 'glGetCombinerInputParameterivNV',
+'glGetCombinerOutputParameterfvNV', 'glGetCombinerOutputParameterivNV',
+'glGetFinalCombinerInputParameterfvNV',
+'glGetFinalCombinerInputParameterivNV', 'PFNGLCOMBINERPARAMETERFVNVPROC',
+'PFNGLCOMBINERPARAMETERFNVPROC', 'PFNGLCOMBINERPARAMETERIVNVPROC',
+'PFNGLCOMBINERPARAMETERINVPROC', 'PFNGLCOMBINERINPUTNVPROC',
+'PFNGLCOMBINEROUTPUTNVPROC', 'PFNGLFINALCOMBINERINPUTNVPROC',
+'PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC',
+'PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC',
+'PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC',
+'PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC',
+'PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC',
+'PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC', 'GL_NV_fog_distance',
+'GL_NV_texgen_emboss', 'GL_NV_blend_square', 'GL_NV_texture_env_combine4',
+'GL_MESA_resize_buffers', 'glResizeBuffersMESA', 'PFNGLRESIZEBUFFERSMESAPROC',
+'GL_MESA_window_pos', 'glWindowPos2dMESA', 'glWindowPos2dvMESA',
+'glWindowPos2fMESA', 'glWindowPos2fvMESA', 'glWindowPos2iMESA',
+'glWindowPos2ivMESA', 'glWindowPos2sMESA', 'glWindowPos2svMESA',
+'glWindowPos3dMESA', 'glWindowPos3dvMESA', 'glWindowPos3fMESA',
+'glWindowPos3fvMESA', 'glWindowPos3iMESA', 'glWindowPos3ivMESA',
+'glWindowPos3sMESA', 'glWindowPos3svMESA', 'glWindowPos4dMESA',
+'glWindowPos4dvMESA', 'glWindowPos4fMESA', 'glWindowPos4fvMESA',
+'glWindowPos4iMESA', 'glWindowPos4ivMESA', 'glWindowPos4sMESA',
+'glWindowPos4svMESA', 'PFNGLWINDOWPOS2DMESAPROC', 'PFNGLWINDOWPOS2DVMESAPROC',
+'PFNGLWINDOWPOS2FMESAPROC', 'PFNGLWINDOWPOS2FVMESAPROC',
+'PFNGLWINDOWPOS2IMESAPROC', 'PFNGLWINDOWPOS2IVMESAPROC',
+'PFNGLWINDOWPOS2SMESAPROC', 'PFNGLWINDOWPOS2SVMESAPROC',
+'PFNGLWINDOWPOS3DMESAPROC', 'PFNGLWINDOWPOS3DVMESAPROC',
+'PFNGLWINDOWPOS3FMESAPROC', 'PFNGLWINDOWPOS3FVMESAPROC',
+'PFNGLWINDOWPOS3IMESAPROC', 'PFNGLWINDOWPOS3IVMESAPROC',
+'PFNGLWINDOWPOS3SMESAPROC', 'PFNGLWINDOWPOS3SVMESAPROC',
+'PFNGLWINDOWPOS4DMESAPROC', 'PFNGLWINDOWPOS4DVMESAPROC',
+'PFNGLWINDOWPOS4FMESAPROC', 'PFNGLWINDOWPOS4FVMESAPROC',
+'PFNGLWINDOWPOS4IMESAPROC', 'PFNGLWINDOWPOS4IVMESAPROC',
+'PFNGLWINDOWPOS4SMESAPROC', 'PFNGLWINDOWPOS4SVMESAPROC',
+'GL_EXT_texture_compression_s3tc', 'GL_IBM_cull_vertex',
+'GL_IBM_multimode_draw_arrays', 'glMultiModeDrawArraysIBM',
+'glMultiModeDrawElementsIBM', 'PFNGLMULTIMODEDRAWARRAYSIBMPROC',
+'PFNGLMULTIMODEDRAWELEMENTSIBMPROC', 'GL_IBM_vertex_array_lists',
+'glColorPointerListIBM', 'glSecondaryColorPointerListIBM',
+'glEdgeFlagPointerListIBM', 'glFogCoordPointerListIBM',
+'glIndexPointerListIBM', 'glNormalPointerListIBM', 'glTexCoordPointerListIBM',
+'glVertexPointerListIBM', 'PFNGLCOLORPOINTERLISTIBMPROC',
+'PFNGLSECONDARYCOLORPOINTERLISTIBMPROC', 'PFNGLEDGEFLAGPOINTERLISTIBMPROC',
+'PFNGLFOGCOORDPOINTERLISTIBMPROC', 'PFNGLINDEXPOINTERLISTIBMPROC',
+'PFNGLNORMALPOINTERLISTIBMPROC', 'PFNGLTEXCOORDPOINTERLISTIBMPROC',
+'PFNGLVERTEXPOINTERLISTIBMPROC', 'GL_SGIX_subsample', 'GL_SGIX_ycrcba',
+'GL_SGIX_ycrcb_subsample', 'GL_SGIX_depth_pass_instrument',
+'GL_3DFX_texture_compression_FXT1', 'GL_3DFX_multisample', 'GL_3DFX_tbuffer',
+'glTbufferMask3DFX', 'PFNGLTBUFFERMASK3DFXPROC', 'GL_EXT_multisample',
+'glSampleMaskEXT', 'glSamplePatternEXT', 'PFNGLSAMPLEMASKEXTPROC',
+'PFNGLSAMPLEPATTERNEXTPROC', 'GL_SGIX_vertex_preclip',
+'GL_SGIX_convolution_accuracy', 'GL_SGIX_resample',
+'GL_SGIS_point_line_texgen', 'GL_SGIS_texture_color_mask',
+'glTextureColorMaskSGIS', 'PFNGLTEXTURECOLORMASKSGISPROC',
+'GL_SGIX_igloo_interface', 'glIglooInterfaceSGIX',
+'PFNGLIGLOOINTERFACESGIXPROC', 'GL_EXT_texture_env_dot3',
+'GL_ATI_texture_mirror_once', 'GL_NV_fence', 'glDeleteFencesNV',
+'glGenFencesNV', 'glIsFenceNV', 'glTestFenceNV', 'glGetFenceivNV',
+'glFinishFenceNV', 'glSetFenceNV', 'PFNGLDELETEFENCESNVPROC',
+'PFNGLGENFENCESNVPROC', 'PFNGLISFENCENVPROC', 'PFNGLTESTFENCENVPROC',
+'PFNGLGETFENCEIVNVPROC', 'PFNGLFINISHFENCENVPROC', 'PFNGLSETFENCENVPROC',
+'GL_NV_evaluators', 'glMapControlPointsNV', 'glMapParameterivNV',
+'glMapParameterfvNV', 'glGetMapControlPointsNV', 'glGetMapParameterivNV',
+'glGetMapParameterfvNV', 'glGetMapAttribParameterivNV',
+'glGetMapAttribParameterfvNV', 'glEvalMapsNV', 'PFNGLMAPCONTROLPOINTSNVPROC',
+'PFNGLMAPPARAMETERIVNVPROC', 'PFNGLMAPPARAMETERFVNVPROC',
+'PFNGLGETMAPCONTROLPOINTSNVPROC', 'PFNGLGETMAPPARAMETERIVNVPROC',
+'PFNGLGETMAPPARAMETERFVNVPROC', 'PFNGLGETMAPATTRIBPARAMETERIVNVPROC',
+'PFNGLGETMAPATTRIBPARAMETERFVNVPROC', 'PFNGLEVALMAPSNVPROC',
+'GL_NV_packed_depth_stencil', 'GL_EXT_packed_depth_stencil',
+'GL_NV_register_combiners2', 'glCombinerStageParameterfvNV',
+'glGetCombinerStageParameterfvNV', 'PFNGLCOMBINERSTAGEPARAMETERFVNVPROC',
+'PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC', 'GL_NV_texture_compression_vtc',
+'GL_NV_texture_rectangle', 'GL_NV_texture_shader', 'GL_NV_texture_shader2',
+'GL_NV_vertex_array_range2', 'GL_NV_vertex_program',
+'glAreProgramsResidentNV', 'glBindProgramNV', 'glDeleteProgramsNV',
+'glExecuteProgramNV', 'glGenProgramsNV', 'glGetProgramParameterdvNV',
+'glGetProgramParameterfvNV', 'glGetProgramivNV', 'glGetProgramStringNV',
+'glGetTrackMatrixivNV', 'glGetVertexAttribdvNV', 'glGetVertexAttribfvNV',
+'glGetVertexAttribivNV', 'glGetVertexAttribPointervNV', 'glIsProgramNV',
+'glLoadProgramNV', 'glProgramParameter4dNV', 'glProgramParameter4dvNV',
+'glProgramParameter4fNV', 'glProgramParameter4fvNV',
+'glProgramParameters4dvNV', 'glProgramParameters4fvNV',
+'glRequestResidentProgramsNV', 'glTrackMatrixNV', 'glVertexAttribPointerNV',
+'glVertexAttrib1dNV', 'glVertexAttrib1dvNV', 'glVertexAttrib1fNV',
+'glVertexAttrib1fvNV', 'glVertexAttrib1sNV', 'glVertexAttrib1svNV',
+'glVertexAttrib2dNV', 'glVertexAttrib2dvNV', 'glVertexAttrib2fNV',
+'glVertexAttrib2fvNV', 'glVertexAttrib2sNV', 'glVertexAttrib2svNV',
+'glVertexAttrib3dNV', 'glVertexAttrib3dvNV', 'glVertexAttrib3fNV',
+'glVertexAttrib3fvNV', 'glVertexAttrib3sNV', 'glVertexAttrib3svNV',
+'glVertexAttrib4dNV', 'glVertexAttrib4dvNV', 'glVertexAttrib4fNV',
+'glVertexAttrib4fvNV', 'glVertexAttrib4sNV', 'glVertexAttrib4svNV',
+'glVertexAttrib4ubNV', 'glVertexAttrib4ubvNV', 'glVertexAttribs1dvNV',
+'glVertexAttribs1fvNV', 'glVertexAttribs1svNV', 'glVertexAttribs2dvNV',
+'glVertexAttribs2fvNV', 'glVertexAttribs2svNV', 'glVertexAttribs3dvNV',
+'glVertexAttribs3fvNV', 'glVertexAttribs3svNV', 'glVertexAttribs4dvNV',
+'glVertexAttribs4fvNV', 'glVertexAttribs4svNV', 'glVertexAttribs4ubvNV',
+'PFNGLAREPROGRAMSRESIDENTNVPROC', 'PFNGLBINDPROGRAMNVPROC',
+'PFNGLDELETEPROGRAMSNVPROC', 'PFNGLEXECUTEPROGRAMNVPROC',
+'PFNGLGENPROGRAMSNVPROC', 'PFNGLGETPROGRAMPARAMETERDVNVPROC',
+'PFNGLGETPROGRAMPARAMETERFVNVPROC', 'PFNGLGETPROGRAMIVNVPROC',
+'PFNGLGETPROGRAMSTRINGNVPROC', 'PFNGLGETTRACKMATRIXIVNVPROC',
+'PFNGLGETVERTEXATTRIBDVNVPROC', 'PFNGLGETVERTEXATTRIBFVNVPROC',
+'PFNGLGETVERTEXATTRIBIVNVPROC', 'PFNGLGETVERTEXATTRIBPOINTERVNVPROC',
+'PFNGLISPROGRAMNVPROC', 'PFNGLLOADPROGRAMNVPROC',
+'PFNGLPROGRAMPARAMETER4DNVPROC', 'PFNGLPROGRAMPARAMETER4DVNVPROC',
+'PFNGLPROGRAMPARAMETER4FNVPROC', 'PFNGLPROGRAMPARAMETER4FVNVPROC',
+'PFNGLPROGRAMPARAMETERS4DVNVPROC', 'PFNGLPROGRAMPARAMETERS4FVNVPROC',
+'PFNGLREQUESTRESIDENTPROGRAMSNVPROC', 'PFNGLTRACKMATRIXNVPROC',
+'PFNGLVERTEXATTRIBPOINTERNVPROC', 'PFNGLVERTEXATTRIB1DNVPROC',
+'PFNGLVERTEXATTRIB1DVNVPROC', 'PFNGLVERTEXATTRIB1FNVPROC',
+'PFNGLVERTEXATTRIB1FVNVPROC', 'PFNGLVERTEXATTRIB1SNVPROC',
+'PFNGLVERTEXATTRIB1SVNVPROC', 'PFNGLVERTEXATTRIB2DNVPROC',
+'PFNGLVERTEXATTRIB2DVNVPROC', 'PFNGLVERTEXATTRIB2FNVPROC',
+'PFNGLVERTEXATTRIB2FVNVPROC', 'PFNGLVERTEXATTRIB2SNVPROC',
+'PFNGLVERTEXATTRIB2SVNVPROC', 'PFNGLVERTEXATTRIB3DNVPROC',
+'PFNGLVERTEXATTRIB3DVNVPROC', 'PFNGLVERTEXATTRIB3FNVPROC',
+'PFNGLVERTEXATTRIB3FVNVPROC', 'PFNGLVERTEXATTRIB3SNVPROC',
+'PFNGLVERTEXATTRIB3SVNVPROC', 'PFNGLVERTEXATTRIB4DNVPROC',
+'PFNGLVERTEXATTRIB4DVNVPROC', 'PFNGLVERTEXATTRIB4FNVPROC',
+'PFNGLVERTEXATTRIB4FVNVPROC', 'PFNGLVERTEXATTRIB4SNVPROC',
+'PFNGLVERTEXATTRIB4SVNVPROC', 'PFNGLVERTEXATTRIB4UBNVPROC',
+'PFNGLVERTEXATTRIB4UBVNVPROC', 'PFNGLVERTEXATTRIBS1DVNVPROC',
+'PFNGLVERTEXATTRIBS1FVNVPROC', 'PFNGLVERTEXATTRIBS1SVNVPROC',
+'PFNGLVERTEXATTRIBS2DVNVPROC', 'PFNGLVERTEXATTRIBS2FVNVPROC',
+'PFNGLVERTEXATTRIBS2SVNVPROC', 'PFNGLVERTEXATTRIBS3DVNVPROC',
+'PFNGLVERTEXATTRIBS3FVNVPROC', 'PFNGLVERTEXATTRIBS3SVNVPROC',
+'PFNGLVERTEXATTRIBS4DVNVPROC', 'PFNGLVERTEXATTRIBS4FVNVPROC',
+'PFNGLVERTEXATTRIBS4SVNVPROC', 'PFNGLVERTEXATTRIBS4UBVNVPROC',
+'GL_SGIX_texture_coordinate_clamp', 'GL_SGIX_scalebias_hint',
+'GL_OML_interlace', 'GL_OML_subsample', 'GL_OML_resample',
+'GL_NV_copy_depth_to_color', 'GL_ATI_envmap_bumpmap',
+'glTexBumpParameterivATI', 'glTexBumpParameterfvATI',
+'glGetTexBumpParameterivATI', 'glGetTexBumpParameterfvATI',
+'PFNGLTEXBUMPPARAMETERIVATIPROC', 'PFNGLTEXBUMPPARAMETERFVATIPROC',
+'PFNGLGETTEXBUMPPARAMETERIVATIPROC', 'PFNGLGETTEXBUMPPARAMETERFVATIPROC',
+'GL_ATI_fragment_shader', 'glGenFragmentShadersATI',
+'glBindFragmentShaderATI', 'glDeleteFragmentShaderATI',
+'glBeginFragmentShaderATI', 'glEndFragmentShaderATI', 'glPassTexCoordATI',
+'glSampleMapATI', 'glColorFragmentOp1ATI', 'glColorFragmentOp2ATI',
+'glColorFragmentOp3ATI', 'glAlphaFragmentOp1ATI', 'glAlphaFragmentOp2ATI',
+'glAlphaFragmentOp3ATI', 'glSetFragmentShaderConstantATI',
+'PFNGLGENFRAGMENTSHADERSATIPROC', 'PFNGLBINDFRAGMENTSHADERATIPROC',
+'PFNGLDELETEFRAGMENTSHADERATIPROC', 'PFNGLBEGINFRAGMENTSHADERATIPROC',
+'PFNGLENDFRAGMENTSHADERATIPROC', 'PFNGLPASSTEXCOORDATIPROC',
+'PFNGLSAMPLEMAPATIPROC', 'PFNGLCOLORFRAGMENTOP1ATIPROC',
+'PFNGLCOLORFRAGMENTOP2ATIPROC', 'PFNGLCOLORFRAGMENTOP3ATIPROC',
+'PFNGLALPHAFRAGMENTOP1ATIPROC', 'PFNGLALPHAFRAGMENTOP2ATIPROC',
+'PFNGLALPHAFRAGMENTOP3ATIPROC', 'PFNGLSETFRAGMENTSHADERCONSTANTATIPROC',
+'GL_ATI_pn_triangles', 'glPNTrianglesiATI', 'glPNTrianglesfATI',
+'PFNGLPNTRIANGLESIATIPROC', 'PFNGLPNTRIANGLESFATIPROC',
+'GL_ATI_vertex_array_object', 'glNewObjectBufferATI', 'glIsObjectBufferATI',
+'glUpdateObjectBufferATI', 'glGetObjectBufferfvATI', 'glGetObjectBufferivATI',
+'glFreeObjectBufferATI', 'glArrayObjectATI', 'glGetArrayObjectfvATI',
+'glGetArrayObjectivATI', 'glVariantArrayObjectATI',
+'glGetVariantArrayObjectfvATI', 'glGetVariantArrayObjectivATI',
+'PFNGLNEWOBJECTBUFFERATIPROC', 'PFNGLISOBJECTBUFFERATIPROC',
+'PFNGLUPDATEOBJECTBUFFERATIPROC', 'PFNGLGETOBJECTBUFFERFVATIPROC',
+'PFNGLGETOBJECTBUFFERIVATIPROC', 'PFNGLFREEOBJECTBUFFERATIPROC',
+'PFNGLARRAYOBJECTATIPROC', 'PFNGLGETARRAYOBJECTFVATIPROC',
+'PFNGLGETARRAYOBJECTIVATIPROC', 'PFNGLVARIANTARRAYOBJECTATIPROC',
+'PFNGLGETVARIANTARRAYOBJECTFVATIPROC', 'PFNGLGETVARIANTARRAYOBJECTIVATIPROC',
+'GL_EXT_vertex_shader', 'glBeginVertexShaderEXT', 'glEndVertexShaderEXT',
+'glBindVertexShaderEXT', 'glGenVertexShadersEXT', 'glDeleteVertexShaderEXT',
+'glShaderOp1EXT', 'glShaderOp2EXT', 'glShaderOp3EXT', 'glSwizzleEXT',
+'glWriteMaskEXT', 'glInsertComponentEXT', 'glExtractComponentEXT',
+'glGenSymbolsEXT', 'glSetInvariantEXT', 'glSetLocalConstantEXT',
+'glVariantbvEXT', 'glVariantsvEXT', 'glVariantivEXT', 'glVariantfvEXT',
+'glVariantdvEXT', 'glVariantubvEXT', 'glVariantusvEXT', 'glVariantuivEXT',
+'glVariantPointerEXT', 'glEnableVariantClientStateEXT',
+'glDisableVariantClientStateEXT', 'glBindLightParameterEXT',
+'glBindMaterialParameterEXT', 'glBindTexGenParameterEXT',
+'glBindTextureUnitParameterEXT', 'glBindParameterEXT',
+'glIsVariantEnabledEXT', 'glGetVariantBooleanvEXT', 'glGetVariantIntegervEXT',
+'glGetVariantFloatvEXT', 'glGetVariantPointervEXT',
+'glGetInvariantBooleanvEXT', 'glGetInvariantIntegervEXT',
+'glGetInvariantFloatvEXT', 'glGetLocalConstantBooleanvEXT',
+'glGetLocalConstantIntegervEXT', 'glGetLocalConstantFloatvEXT',
+'PFNGLBEGINVERTEXSHADEREXTPROC', 'PFNGLENDVERTEXSHADEREXTPROC',
+'PFNGLBINDVERTEXSHADEREXTPROC', 'PFNGLGENVERTEXSHADERSEXTPROC',
+'PFNGLDELETEVERTEXSHADEREXTPROC', 'PFNGLSHADEROP1EXTPROC',
+'PFNGLSHADEROP2EXTPROC', 'PFNGLSHADEROP3EXTPROC', 'PFNGLSWIZZLEEXTPROC',
+'PFNGLWRITEMASKEXTPROC', 'PFNGLINSERTCOMPONENTEXTPROC',
+'PFNGLEXTRACTCOMPONENTEXTPROC', 'PFNGLGENSYMBOLSEXTPROC',
+'PFNGLSETINVARIANTEXTPROC', 'PFNGLSETLOCALCONSTANTEXTPROC',
+'PFNGLVARIANTBVEXTPROC', 'PFNGLVARIANTSVEXTPROC', 'PFNGLVARIANTIVEXTPROC',
+'PFNGLVARIANTFVEXTPROC', 'PFNGLVARIANTDVEXTPROC', 'PFNGLVARIANTUBVEXTPROC',
+'PFNGLVARIANTUSVEXTPROC', 'PFNGLVARIANTUIVEXTPROC',
+'PFNGLVARIANTPOINTEREXTPROC', 'PFNGLENABLEVARIANTCLIENTSTATEEXTPROC',
+'PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC', 'PFNGLBINDLIGHTPARAMETEREXTPROC',
+'PFNGLBINDMATERIALPARAMETEREXTPROC', 'PFNGLBINDTEXGENPARAMETEREXTPROC',
+'PFNGLBINDTEXTUREUNITPARAMETEREXTPROC', 'PFNGLBINDPARAMETEREXTPROC',
+'PFNGLISVARIANTENABLEDEXTPROC', 'PFNGLGETVARIANTBOOLEANVEXTPROC',
+'PFNGLGETVARIANTINTEGERVEXTPROC', 'PFNGLGETVARIANTFLOATVEXTPROC',
+'PFNGLGETVARIANTPOINTERVEXTPROC', 'PFNGLGETINVARIANTBOOLEANVEXTPROC',
+'PFNGLGETINVARIANTINTEGERVEXTPROC', 'PFNGLGETINVARIANTFLOATVEXTPROC',
+'PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC',
+'PFNGLGETLOCALCONSTANTINTEGERVEXTPROC', 'PFNGLGETLOCALCONSTANTFLOATVEXTPROC',
+'GL_ATI_vertex_streams', 'glVertexStream1sATI', 'glVertexStream1svATI',
+'glVertexStream1iATI', 'glVertexStream1ivATI', 'glVertexStream1fATI',
+'glVertexStream1fvATI', 'glVertexStream1dATI', 'glVertexStream1dvATI',
+'glVertexStream2sATI', 'glVertexStream2svATI', 'glVertexStream2iATI',
+'glVertexStream2ivATI', 'glVertexStream2fATI', 'glVertexStream2fvATI',
+'glVertexStream2dATI', 'glVertexStream2dvATI', 'glVertexStream3sATI',
+'glVertexStream3svATI', 'glVertexStream3iATI', 'glVertexStream3ivATI',
+'glVertexStream3fATI', 'glVertexStream3fvATI', 'glVertexStream3dATI',
+'glVertexStream3dvATI', 'glVertexStream4sATI', 'glVertexStream4svATI',
+'glVertexStream4iATI', 'glVertexStream4ivATI', 'glVertexStream4fATI',
+'glVertexStream4fvATI', 'glVertexStream4dATI', 'glVertexStream4dvATI',
+'glNormalStream3bATI', 'glNormalStream3bvATI', 'glNormalStream3sATI',
+'glNormalStream3svATI', 'glNormalStream3iATI', 'glNormalStream3ivATI',
+'glNormalStream3fATI', 'glNormalStream3fvATI', 'glNormalStream3dATI',
+'glNormalStream3dvATI', 'glClientActiveVertexStreamATI',
+'glVertexBlendEnviATI', 'glVertexBlendEnvfATI', 'PFNGLVERTEXSTREAM1SATIPROC',
+'PFNGLVERTEXSTREAM1SVATIPROC', 'PFNGLVERTEXSTREAM1IATIPROC',
+'PFNGLVERTEXSTREAM1IVATIPROC', 'PFNGLVERTEXSTREAM1FATIPROC',
+'PFNGLVERTEXSTREAM1FVATIPROC', 'PFNGLVERTEXSTREAM1DATIPROC',
+'PFNGLVERTEXSTREAM1DVATIPROC', 'PFNGLVERTEXSTREAM2SATIPROC',
+'PFNGLVERTEXSTREAM2SVATIPROC', 'PFNGLVERTEXSTREAM2IATIPROC',
+'PFNGLVERTEXSTREAM2IVATIPROC', 'PFNGLVERTEXSTREAM2FATIPROC',
+'PFNGLVERTEXSTREAM2FVATIPROC', 'PFNGLVERTEXSTREAM2DATIPROC',
+'PFNGLVERTEXSTREAM2DVATIPROC', 'PFNGLVERTEXSTREAM3SATIPROC',
+'PFNGLVERTEXSTREAM3SVATIPROC', 'PFNGLVERTEXSTREAM3IATIPROC',
+'PFNGLVERTEXSTREAM3IVATIPROC', 'PFNGLVERTEXSTREAM3FATIPROC',
+'PFNGLVERTEXSTREAM3FVATIPROC', 'PFNGLVERTEXSTREAM3DATIPROC',
+'PFNGLVERTEXSTREAM3DVATIPROC', 'PFNGLVERTEXSTREAM4SATIPROC',
+'PFNGLVERTEXSTREAM4SVATIPROC', 'PFNGLVERTEXSTREAM4IATIPROC',
+'PFNGLVERTEXSTREAM4IVATIPROC', 'PFNGLVERTEXSTREAM4FATIPROC',
+'PFNGLVERTEXSTREAM4FVATIPROC', 'PFNGLVERTEXSTREAM4DATIPROC',
+'PFNGLVERTEXSTREAM4DVATIPROC', 'PFNGLNORMALSTREAM3BATIPROC',
+'PFNGLNORMALSTREAM3BVATIPROC', 'PFNGLNORMALSTREAM3SATIPROC',
+'PFNGLNORMALSTREAM3SVATIPROC', 'PFNGLNORMALSTREAM3IATIPROC',
+'PFNGLNORMALSTREAM3IVATIPROC', 'PFNGLNORMALSTREAM3FATIPROC',
+'PFNGLNORMALSTREAM3FVATIPROC', 'PFNGLNORMALSTREAM3DATIPROC',
+'PFNGLNORMALSTREAM3DVATIPROC', 'PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC',
+'PFNGLVERTEXBLENDENVIATIPROC', 'PFNGLVERTEXBLENDENVFATIPROC',
+'GL_ATI_element_array', 'glElementPointerATI', 'glDrawElementArrayATI',
+'glDrawRangeElementArrayATI', 'PFNGLELEMENTPOINTERATIPROC',
+'PFNGLDRAWELEMENTARRAYATIPROC', 'PFNGLDRAWRANGEELEMENTARRAYATIPROC',
+'GL_SUN_mesh_array', 'glDrawMeshArraysSUN', 'PFNGLDRAWMESHARRAYSSUNPROC',
+'GL_SUN_slice_accum', 'GL_NV_multisample_filter_hint', 'GL_NV_depth_clamp',
+'GL_NV_occlusion_query', 'glGenOcclusionQueriesNV',
+'glDeleteOcclusionQueriesNV', 'glIsOcclusionQueryNV',
+'glBeginOcclusionQueryNV', 'glEndOcclusionQueryNV', 'glGetOcclusionQueryivNV',
+'glGetOcclusionQueryuivNV', 'PFNGLGENOCCLUSIONQUERIESNVPROC',
+'PFNGLDELETEOCCLUSIONQUERIESNVPROC', 'PFNGLISOCCLUSIONQUERYNVPROC',
+'PFNGLBEGINOCCLUSIONQUERYNVPROC', 'PFNGLENDOCCLUSIONQUERYNVPROC',
+'PFNGLGETOCCLUSIONQUERYIVNVPROC', 'PFNGLGETOCCLUSIONQUERYUIVNVPROC',
+'GL_NV_point_sprite', 'glPointParameteriNV', 'glPointParameterivNV',
+'PFNGLPOINTPARAMETERINVPROC', 'PFNGLPOINTPARAMETERIVNVPROC',
+'GL_NV_texture_shader3', 'GL_NV_vertex_program1_1', 'GL_EXT_shadow_funcs',
+'GL_EXT_stencil_two_side', 'glActiveStencilFaceEXT',
+'PFNGLACTIVESTENCILFACEEXTPROC', 'GL_ATI_text_fragment_shader',
+'GL_APPLE_client_storage', 'GL_APPLE_element_array', 'glElementPointerAPPLE',
+'glDrawElementArrayAPPLE', 'glDrawRangeElementArrayAPPLE',
+'glMultiDrawElementArrayAPPLE', 'glMultiDrawRangeElementArrayAPPLE',
+'PFNGLELEMENTPOINTERAPPLEPROC', 'PFNGLDRAWELEMENTARRAYAPPLEPROC',
+'PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC', 'PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC',
+'PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC', 'GL_APPLE_fence',
+'glGenFencesAPPLE', 'glDeleteFencesAPPLE', 'glSetFenceAPPLE',
+'glIsFenceAPPLE', 'glTestFenceAPPLE', 'glFinishFenceAPPLE',
+'glTestObjectAPPLE', 'glFinishObjectAPPLE', 'PFNGLGENFENCESAPPLEPROC',
+'PFNGLDELETEFENCESAPPLEPROC', 'PFNGLSETFENCEAPPLEPROC',
+'PFNGLISFENCEAPPLEPROC', 'PFNGLTESTFENCEAPPLEPROC',
+'PFNGLFINISHFENCEAPPLEPROC', 'PFNGLTESTOBJECTAPPLEPROC',
+'PFNGLFINISHOBJECTAPPLEPROC', 'GL_APPLE_vertex_array_object',
+'glBindVertexArrayAPPLE', 'glDeleteVertexArraysAPPLE',
+'glGenVertexArraysAPPLE', 'glIsVertexArrayAPPLE',
+'PFNGLBINDVERTEXARRAYAPPLEPROC', 'PFNGLDELETEVERTEXARRAYSAPPLEPROC',
+'PFNGLGENVERTEXARRAYSAPPLEPROC', 'PFNGLISVERTEXARRAYAPPLEPROC',
+'GL_APPLE_vertex_array_range', 'glVertexArrayRangeAPPLE',
+'glFlushVertexArrayRangeAPPLE', 'glVertexArrayParameteriAPPLE',
+'PFNGLVERTEXARRAYRANGEAPPLEPROC', 'PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC',
+'PFNGLVERTEXARRAYPARAMETERIAPPLEPROC', 'GL_APPLE_ycbcr_422', 'GL_S3_s3tc',
+'GL_ATI_draw_buffers', 'glDrawBuffersATI', 'PFNGLDRAWBUFFERSATIPROC',
+'GL_ATI_pixel_format_float', 'GL_ATI_texture_env_combine3',
+'GL_ATI_texture_float', 'GL_NV_float_buffer', 'GL_NV_fragment_program',
+'glProgramNamedParameter4fNV', 'glProgramNamedParameter4dNV',
+'glProgramNamedParameter4fvNV', 'glProgramNamedParameter4dvNV',
+'glGetProgramNamedParameterfvNV', 'glGetProgramNamedParameterdvNV',
+'PFNGLPROGRAMNAMEDPARAMETER4FNVPROC', 'PFNGLPROGRAMNAMEDPARAMETER4DNVPROC',
+'PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC', 'PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC',
+'PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC',
+'PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC', 'GL_NV_half_float', 'glVertex2hNV',
+'glVertex2hvNV', 'glVertex3hNV', 'glVertex3hvNV', 'glVertex4hNV',
+'glVertex4hvNV', 'glNormal3hNV', 'glNormal3hvNV', 'glColor3hNV',
+'glColor3hvNV', 'glColor4hNV', 'glColor4hvNV', 'glTexCoord1hNV',
+'glTexCoord1hvNV', 'glTexCoord2hNV', 'glTexCoord2hvNV', 'glTexCoord3hNV',
+'glTexCoord3hvNV', 'glTexCoord4hNV', 'glTexCoord4hvNV', 'glMultiTexCoord1hNV',
+'glMultiTexCoord1hvNV', 'glMultiTexCoord2hNV', 'glMultiTexCoord2hvNV',
+'glMultiTexCoord3hNV', 'glMultiTexCoord3hvNV', 'glMultiTexCoord4hNV',
+'glMultiTexCoord4hvNV', 'glFogCoordhNV', 'glFogCoordhvNV',
+'glSecondaryColor3hNV', 'glSecondaryColor3hvNV', 'glVertexWeighthNV',
+'glVertexWeighthvNV', 'glVertexAttrib1hNV', 'glVertexAttrib1hvNV',
+'glVertexAttrib2hNV', 'glVertexAttrib2hvNV', 'glVertexAttrib3hNV',
+'glVertexAttrib3hvNV', 'glVertexAttrib4hNV', 'glVertexAttrib4hvNV',
+'glVertexAttribs1hvNV', 'glVertexAttribs2hvNV', 'glVertexAttribs3hvNV',
+'glVertexAttribs4hvNV', 'PFNGLVERTEX2HNVPROC', 'PFNGLVERTEX2HVNVPROC',
+'PFNGLVERTEX3HNVPROC', 'PFNGLVERTEX3HVNVPROC', 'PFNGLVERTEX4HNVPROC',
+'PFNGLVERTEX4HVNVPROC', 'PFNGLNORMAL3HNVPROC', 'PFNGLNORMAL3HVNVPROC',
+'PFNGLCOLOR3HNVPROC', 'PFNGLCOLOR3HVNVPROC', 'PFNGLCOLOR4HNVPROC',
+'PFNGLCOLOR4HVNVPROC', 'PFNGLTEXCOORD1HNVPROC', 'PFNGLTEXCOORD1HVNVPROC',
+'PFNGLTEXCOORD2HNVPROC', 'PFNGLTEXCOORD2HVNVPROC', 'PFNGLTEXCOORD3HNVPROC',
+'PFNGLTEXCOORD3HVNVPROC', 'PFNGLTEXCOORD4HNVPROC', 'PFNGLTEXCOORD4HVNVPROC',
+'PFNGLMULTITEXCOORD1HNVPROC', 'PFNGLMULTITEXCOORD1HVNVPROC',
+'PFNGLMULTITEXCOORD2HNVPROC', 'PFNGLMULTITEXCOORD2HVNVPROC',
+'PFNGLMULTITEXCOORD3HNVPROC', 'PFNGLMULTITEXCOORD3HVNVPROC',
+'PFNGLMULTITEXCOORD4HNVPROC', 'PFNGLMULTITEXCOORD4HVNVPROC',
+'PFNGLFOGCOORDHNVPROC', 'PFNGLFOGCOORDHVNVPROC',
+'PFNGLSECONDARYCOLOR3HNVPROC', 'PFNGLSECONDARYCOLOR3HVNVPROC',
+'PFNGLVERTEXWEIGHTHNVPROC', 'PFNGLVERTEXWEIGHTHVNVPROC',
+'PFNGLVERTEXATTRIB1HNVPROC', 'PFNGLVERTEXATTRIB1HVNVPROC',
+'PFNGLVERTEXATTRIB2HNVPROC', 'PFNGLVERTEXATTRIB2HVNVPROC',
+'PFNGLVERTEXATTRIB3HNVPROC', 'PFNGLVERTEXATTRIB3HVNVPROC',
+'PFNGLVERTEXATTRIB4HNVPROC', 'PFNGLVERTEXATTRIB4HVNVPROC',
+'PFNGLVERTEXATTRIBS1HVNVPROC', 'PFNGLVERTEXATTRIBS2HVNVPROC',
+'PFNGLVERTEXATTRIBS3HVNVPROC', 'PFNGLVERTEXATTRIBS4HVNVPROC',
+'GL_NV_pixel_data_range', 'glPixelDataRangeNV', 'glFlushPixelDataRangeNV',
+'PFNGLPIXELDATARANGENVPROC', 'PFNGLFLUSHPIXELDATARANGENVPROC',
+'GL_NV_primitive_restart', 'glPrimitiveRestartNV',
+'glPrimitiveRestartIndexNV', 'PFNGLPRIMITIVERESTARTNVPROC',
+'PFNGLPRIMITIVERESTARTINDEXNVPROC', 'GL_NV_texture_expand_normal',
+'GL_NV_vertex_program2', 'GL_ATI_map_object_buffer', 'glMapObjectBufferATI',
+'glUnmapObjectBufferATI', 'PFNGLMAPOBJECTBUFFERATIPROC',
+'PFNGLUNMAPOBJECTBUFFERATIPROC', 'GL_ATI_separate_stencil',
+'glStencilOpSeparateATI', 'glStencilFuncSeparateATI',
+'PFNGLSTENCILOPSEPARATEATIPROC', 'PFNGLSTENCILFUNCSEPARATEATIPROC',
+'GL_ATI_vertex_attrib_array_object', 'glVertexAttribArrayObjectATI',
+'glGetVertexAttribArrayObjectfvATI', 'glGetVertexAttribArrayObjectivATI',
+'PFNGLVERTEXATTRIBARRAYOBJECTATIPROC',
+'PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC',
+'PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC', 'GL_OES_read_format',
+'GL_EXT_depth_bounds_test', 'glDepthBoundsEXT', 'PFNGLDEPTHBOUNDSEXTPROC',
+'GL_EXT_texture_mirror_clamp', 'GL_EXT_blend_equation_separate',
+'glBlendEquationSeparateEXT', 'PFNGLBLENDEQUATIONSEPARATEEXTPROC',
+'GL_MESA_pack_invert', 'GL_MESA_ycbcr_texture', 'GL_EXT_pixel_buffer_object',
+'GL_NV_fragment_program_option', 'GL_NV_fragment_program2',
+'GL_NV_vertex_program2_option', 'GL_NV_vertex_program3',
+'GL_EXT_framebuffer_object', 'glIsRenderbufferEXT', 'glBindRenderbufferEXT',
+'glDeleteRenderbuffersEXT', 'glGenRenderbuffersEXT',
+'glRenderbufferStorageEXT', 'glGetRenderbufferParameterivEXT',
+'glIsFramebufferEXT', 'glBindFramebufferEXT', 'glDeleteFramebuffersEXT',
+'glGenFramebuffersEXT', 'glCheckFramebufferStatusEXT',
+'glFramebufferTexture1DEXT', 'glFramebufferTexture2DEXT',
+'glFramebufferTexture3DEXT', 'glFramebufferRenderbufferEXT',
+'glGetFramebufferAttachmentParameterivEXT', 'glGenerateMipmapEXT',
+'PFNGLISRENDERBUFFEREXTPROC', 'PFNGLBINDRENDERBUFFEREXTPROC',
+'PFNGLDELETERENDERBUFFERSEXTPROC', 'PFNGLGENRENDERBUFFERSEXTPROC',
+'PFNGLRENDERBUFFERSTORAGEEXTPROC', 'PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC',
+'PFNGLISFRAMEBUFFEREXTPROC', 'PFNGLBINDFRAMEBUFFEREXTPROC',
+'PFNGLDELETEFRAMEBUFFERSEXTPROC', 'PFNGLGENFRAMEBUFFERSEXTPROC',
+'PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC', 'PFNGLFRAMEBUFFERTEXTURE1DEXTPROC',
+'PFNGLFRAMEBUFFERTEXTURE2DEXTPROC', 'PFNGLFRAMEBUFFERTEXTURE3DEXTPROC',
+'PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC',
+'PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC',
+'PFNGLGENERATEMIPMAPEXTPROC', 'GL_GREMEDY_string_marker',
+'glStringMarkerGREMEDY', 'PFNGLSTRINGMARKERGREMEDYPROC', 'GL_EXT_Cg_shader',
+'GL_EXT_timer_query', 'glGetQueryObjecti64vEXT', 'glGetQueryObjectui64vEXT',
+'PFNGLGETQUERYOBJECTI64VEXTPROC', 'PFNGLGETQUERYOBJECTUI64VEXTPROC',
+'GL_EXT_texture_buffer_object', 'glTexBufferEXT', 'PFNGLTEXBUFFEREXTPROC',
+'GL_NV_transform_feedback', 'glBeginTransformFeedbackNV',
+'glEndTransformFeedbackNV', 'glTransformFeedbackAttribsNV',
+'glBindBufferRangeNV', 'glBindBufferOffsetNV', 'glBindBufferBaseNV',
+'glTransformFeedbackVaryingsNV', 'glActiveVaryingNV',
+'glGetVaryingLocationNV', 'glGetActiveVaryingNV',
+'glGetTransformFeedbackVaryingNV', 'PFNGLBEGINTRANSFORMFEEDBACKNVPROC',
+'PFNGLENDTRANSFORMFEEDBACKNVPROC', 'PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC',
+'PFNGLBINDBUFFERRANGENVPROC', 'PFNGLBINDBUFFEROFFSETNVPROC',
+'PFNGLBINDBUFFERBASENVPROC', 'PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC',
+'PFNGLACTIVEVARYINGNVPROC', 'PFNGLGETVARYINGLOCATIONNVPROC',
+'PFNGLGETACTIVEVARYINGNVPROC', 'PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC',
+'GL_NV_depth_buffer_float', 'glDepthRangedNV', 'glClearDepthdNV',
+'glDepthBoundsdNV', 'PFNGLDEPTHRANGEDNVPROC', 'PFNGLCLEARDEPTHDNVPROC',
+'PFNGLDEPTHBOUNDSDNVPROC', 'GL_EXT_texture_compression_latc',
+'GL_EXT_framebuffer_sRGB', 'GL_EXT_texture_shared_exponent',
+'GL_EXT_packed_float', 'GL_EXT_texture_array', 'GL_EXT_draw_buffers2',
+'glColorMaskIndexedEXT', 'glGetBooleanIndexedvEXT', 'glGetIntegerIndexedvEXT',
+'glEnableIndexedEXT', 'glDisableIndexedEXT', 'glIsEnabledIndexedEXT',
+'PFNGLCOLORMASKINDEXEDEXTPROC', 'PFNGLGETBOOLEANINDEXEDVEXTPROC',
+'PFNGLGETINTEGERINDEXEDVEXTPROC', 'PFNGLENABLEINDEXEDEXTPROC',
+'PFNGLDISABLEINDEXEDEXTPROC', 'PFNGLISENABLEDINDEXEDEXTPROC',
+'GL_EXT_texture_integer', 'glTexParameterIivEXT', 'glTexParameterIuivEXT',
+'glGetTexParameterIivEXT', 'glGetTexParameterIuivEXT', 'glClearColorIiEXT',
+'glClearColorIuiEXT', 'PFNGLTEXPARAMETERIIVEXTPROC',
+'PFNGLTEXPARAMETERIUIVEXTPROC', 'PFNGLGETTEXPARAMETERIIVEXTPROC',
+'PFNGLGETTEXPARAMETERIUIVEXTPROC', 'PFNGLCLEARCOLORIIEXTPROC',
+'PFNGLCLEARCOLORIUIEXTPROC', 'GL_EXT_bindable_uniform', 'glUniformBufferEXT',
+'glGetUniformBufferSizeEXT', 'glGetUniformOffsetEXT',
+'PFNGLUNIFORMBUFFEREXTPROC', 'PFNGLGETUNIFORMBUFFERSIZEEXTPROC',
+'PFNGLGETUNIFORMOFFSETEXTPROC', 'GL_EXT_gpu_shader4', 'glGetUniformuivEXT',
+'glBindFragDataLocationEXT', 'glGetFragDataLocationEXT', 'glUniform1uiEXT',
+'glUniform2uiEXT', 'glUniform3uiEXT', 'glUniform4uiEXT', 'glUniform1uivEXT',
+'glUniform2uivEXT', 'glUniform3uivEXT', 'glUniform4uivEXT',
+'glVertexAttribI1iEXT', 'glVertexAttribI2iEXT', 'glVertexAttribI3iEXT',
+'glVertexAttribI4iEXT', 'glVertexAttribI1uiEXT', 'glVertexAttribI2uiEXT',
+'glVertexAttribI3uiEXT', 'glVertexAttribI4uiEXT', 'glVertexAttribI1ivEXT',
+'glVertexAttribI2ivEXT', 'glVertexAttribI3ivEXT', 'glVertexAttribI4ivEXT',
+'glVertexAttribI1uivEXT', 'glVertexAttribI2uivEXT', 'glVertexAttribI3uivEXT',
+'glVertexAttribI4uivEXT', 'glVertexAttribI4bvEXT', 'glVertexAttribI4svEXT',
+'glVertexAttribI4ubvEXT', 'glVertexAttribI4usvEXT',
+'glVertexAttribIPointerEXT', 'glGetVertexAttribIivEXT',
+'glGetVertexAttribIuivEXT', 'PFNGLGETUNIFORMUIVEXTPROC',
+'PFNGLBINDFRAGDATALOCATIONEXTPROC', 'PFNGLGETFRAGDATALOCATIONEXTPROC',
+'PFNGLUNIFORM1UIEXTPROC', 'PFNGLUNIFORM2UIEXTPROC', 'PFNGLUNIFORM3UIEXTPROC',
+'PFNGLUNIFORM4UIEXTPROC', 'PFNGLUNIFORM1UIVEXTPROC',
+'PFNGLUNIFORM2UIVEXTPROC', 'PFNGLUNIFORM3UIVEXTPROC',
+'PFNGLUNIFORM4UIVEXTPROC', 'PFNGLVERTEXATTRIBI1IEXTPROC',
+'PFNGLVERTEXATTRIBI2IEXTPROC', 'PFNGLVERTEXATTRIBI3IEXTPROC',
+'PFNGLVERTEXATTRIBI4IEXTPROC', 'PFNGLVERTEXATTRIBI1UIEXTPROC',
+'PFNGLVERTEXATTRIBI2UIEXTPROC', 'PFNGLVERTEXATTRIBI3UIEXTPROC',
+'PFNGLVERTEXATTRIBI4UIEXTPROC', 'PFNGLVERTEXATTRIBI1IVEXTPROC',
+'PFNGLVERTEXATTRIBI2IVEXTPROC', 'PFNGLVERTEXATTRIBI3IVEXTPROC',
+'PFNGLVERTEXATTRIBI4IVEXTPROC', 'PFNGLVERTEXATTRIBI1UIVEXTPROC',
+'PFNGLVERTEXATTRIBI2UIVEXTPROC', 'PFNGLVERTEXATTRIBI3UIVEXTPROC',
+'PFNGLVERTEXATTRIBI4UIVEXTPROC', 'PFNGLVERTEXATTRIBI4BVEXTPROC',
+'PFNGLVERTEXATTRIBI4SVEXTPROC', 'PFNGLVERTEXATTRIBI4UBVEXTPROC',
+'PFNGLVERTEXATTRIBI4USVEXTPROC', 'PFNGLVERTEXATTRIBIPOINTEREXTPROC',
+'PFNGLGETVERTEXATTRIBIIVEXTPROC', 'PFNGLGETVERTEXATTRIBIUIVEXTPROC',
+'GL_EXT_geometry_shader4', 'glProgramParameteriEXT',
+'glFramebufferTextureEXT', 'glFramebufferTextureLayerEXT',
+'glFramebufferTextureFaceEXT', 'PFNGLPROGRAMPARAMETERIEXTPROC',
+'PFNGLFRAMEBUFFERTEXTUREEXTPROC', 'PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC',
+'PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC', 'GL_NV_geometry_program4',
+'glProgramVertexLimitNV', 'PFNGLPROGRAMVERTEXLIMITNVPROC',
+'GL_NV_gpu_program4', 'glProgramLocalParameterI4iNV',
+'glProgramLocalParameterI4ivNV', 'glProgramLocalParametersI4ivNV',
+'glProgramLocalParameterI4uiNV', 'glProgramLocalParameterI4uivNV',
+'glProgramLocalParametersI4uivNV', 'glProgramEnvParameterI4iNV',
+'glProgramEnvParameterI4ivNV', 'glProgramEnvParametersI4ivNV',
+'glProgramEnvParameterI4uiNV', 'glProgramEnvParameterI4uivNV',
+'glProgramEnvParametersI4uivNV', 'glGetProgramLocalParameterIivNV',
+'glGetProgramLocalParameterIuivNV', 'glGetProgramEnvParameterIivNV',
+'glGetProgramEnvParameterIuivNV', 'PFNGLPROGRAMLOCALPARAMETERI4INVPROC',
+'PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC',
+'PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC',
+'PFNGLPROGRAMLOCALPARAMETERI4UINVPROC',
+'PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC',
+'PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC', 'PFNGLPROGRAMENVPARAMETERI4INVPROC',
+'PFNGLPROGRAMENVPARAMETERI4IVNVPROC', 'PFNGLPROGRAMENVPARAMETERSI4IVNVPROC',
+'PFNGLPROGRAMENVPARAMETERI4UINVPROC', 'PFNGLPROGRAMENVPARAMETERI4UIVNVPROC',
+'PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC',
+'PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC',
+'PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC',
+'PFNGLGETPROGRAMENVPARAMETERIIVNVPROC',
+'PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC', 'GL_NV_parameter_buffer_object',
+'glProgramBufferParametersfvNV', 'glProgramBufferParametersIivNV',
+'glProgramBufferParametersIuivNV', 'PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC',
+'PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC',
+'PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC', 'GL_EXT_framebuffer_multisample',
+'glRenderbufferStorageMultisampleEXT',
+'PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC',
+'GL_NV_framebuffer_multisample_coverage',
+'glRenderbufferStorageMultisampleCoverageNV',
+'PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC',
+'GL_EXT_framebuffer_blit', 'glBlitFramebufferEXT',
+'PFNGLBLITFRAMEBUFFEREXTPROC', 'GL_EXT_draw_instanced',
+'glDrawArraysInstancedEXT', 'glDrawElementsInstancedEXT',
+'PFNGLDRAWARRAYSINSTANCEDEXTPROC', 'PFNGLDRAWELEMENTSINSTANCEDEXTPROC',
+'GL_EXT_texture_compression_rgtc', 'GL_NV_present_video',
+'glPresentFrameKeyedNV', 'glPresentFrameDualFillNV', 'glGetVideoivNV',
+'glGetVideouivNV', 'glGetVideoi64vNV', 'glGetVideoui64vNV',
+'PFNGLPRESENTFRAMEKEYEDNVPROC', 'PFNGLPRESENTFRAMEDUALFILLNVPROC',
+'PFNGLGETVIDEOIVNVPROC', 'PFNGLGETVIDEOUIVNVPROC', 'PFNGLGETVIDEOI64VNVPROC',
+'PFNGLGETVIDEOUI64VNVPROC', 'GL_NV_conditional_render',
+'glBeginConditionalRenderNV', 'glEndConditionalRenderNV',
+'PFNGLBEGINCONDITIONALRENDERNVPROC', 'PFNGLENDCONDITIONALRENDERNVPROC',
+'GL_EXT_transform_feedback', 'glBeginTransformFeedbackEXT',
+'glEndTransformFeedbackEXT', 'glBindBufferRangeEXT', 'glBindBufferOffsetEXT',
+'glBindBufferBaseEXT', 'glTransformFeedbackVaryingsEXT',
+'glGetTransformFeedbackVaryingEXT', 'PFNGLBEGINTRANSFORMFEEDBACKEXTPROC',
+'PFNGLENDTRANSFORMFEEDBACKEXTPROC', 'PFNGLBINDBUFFERRANGEEXTPROC',
+'PFNGLBINDBUFFEROFFSETEXTPROC', 'PFNGLBINDBUFFERBASEEXTPROC',
+'PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC',
+'PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC', 'GL_EXT_direct_state_access',
+'glClientAttribDefaultEXT', 'glPushClientAttribDefaultEXT',
+'glMatrixLoadfEXT', 'glMatrixLoaddEXT', 'glMatrixMultfEXT',
+'glMatrixMultdEXT', 'glMatrixLoadIdentityEXT', 'glMatrixRotatefEXT',
+'glMatrixRotatedEXT', 'glMatrixScalefEXT', 'glMatrixScaledEXT',
+'glMatrixTranslatefEXT', 'glMatrixTranslatedEXT', 'glMatrixFrustumEXT',
+'glMatrixOrthoEXT', 'glMatrixPopEXT', 'glMatrixPushEXT',
+'glMatrixLoadTransposefEXT', 'glMatrixLoadTransposedEXT',
+'glMatrixMultTransposefEXT', 'glMatrixMultTransposedEXT',
+'glTextureParameterfEXT', 'glTextureParameterfvEXT', 'glTextureParameteriEXT',
+'glTextureParameterivEXT', 'glTextureImage1DEXT', 'glTextureImage2DEXT',
+'glTextureSubImage1DEXT', 'glTextureSubImage2DEXT', 'glCopyTextureImage1DEXT',
+'glCopyTextureImage2DEXT', 'glCopyTextureSubImage1DEXT',
+'glCopyTextureSubImage2DEXT', 'glGetTextureImageEXT',
+'glGetTextureParameterfvEXT', 'glGetTextureParameterivEXT',
+'glGetTextureLevelParameterfvEXT', 'glGetTextureLevelParameterivEXT',
+'glTextureImage3DEXT', 'glTextureSubImage3DEXT', 'glCopyTextureSubImage3DEXT',
+'glMultiTexParameterfEXT', 'glMultiTexParameterfvEXT',
+'glMultiTexParameteriEXT', 'glMultiTexParameterivEXT', 'glMultiTexImage1DEXT',
+'glMultiTexImage2DEXT', 'glMultiTexSubImage1DEXT', 'glMultiTexSubImage2DEXT',
+'glCopyMultiTexImage1DEXT', 'glCopyMultiTexImage2DEXT',
+'glCopyMultiTexSubImage1DEXT', 'glCopyMultiTexSubImage2DEXT',
+'glGetMultiTexImageEXT', 'glGetMultiTexParameterfvEXT',
+'glGetMultiTexParameterivEXT', 'glGetMultiTexLevelParameterfvEXT',
+'glGetMultiTexLevelParameterivEXT', 'glMultiTexImage3DEXT',
+'glMultiTexSubImage3DEXT', 'glCopyMultiTexSubImage3DEXT',
+'glBindMultiTextureEXT', 'glEnableClientStateIndexedEXT',
+'glDisableClientStateIndexedEXT', 'glMultiTexCoordPointerEXT',
+'glMultiTexEnvfEXT', 'glMultiTexEnvfvEXT', 'glMultiTexEnviEXT',
+'glMultiTexEnvivEXT', 'glMultiTexGendEXT', 'glMultiTexGendvEXT',
+'glMultiTexGenfEXT', 'glMultiTexGenfvEXT', 'glMultiTexGeniEXT',
+'glMultiTexGenivEXT', 'glGetMultiTexEnvfvEXT', 'glGetMultiTexEnvivEXT',
+'glGetMultiTexGendvEXT', 'glGetMultiTexGenfvEXT', 'glGetMultiTexGenivEXT',
+'glGetFloatIndexedvEXT', 'glGetDoubleIndexedvEXT', 'glGetPointerIndexedvEXT',
+'glCompressedTextureImage3DEXT', 'glCompressedTextureImage2DEXT',
+'glCompressedTextureImage1DEXT', 'glCompressedTextureSubImage3DEXT',
+'glCompressedTextureSubImage2DEXT', 'glCompressedTextureSubImage1DEXT',
+'glGetCompressedTextureImageEXT', 'glCompressedMultiTexImage3DEXT',
+'glCompressedMultiTexImage2DEXT', 'glCompressedMultiTexImage1DEXT',
+'glCompressedMultiTexSubImage3DEXT', 'glCompressedMultiTexSubImage2DEXT',
+'glCompressedMultiTexSubImage1DEXT', 'glGetCompressedMultiTexImageEXT',
+'glNamedProgramStringEXT', 'glNamedProgramLocalParameter4dEXT',
+'glNamedProgramLocalParameter4dvEXT', 'glNamedProgramLocalParameter4fEXT',
+'glNamedProgramLocalParameter4fvEXT', 'glGetNamedProgramLocalParameterdvEXT',
+'glGetNamedProgramLocalParameterfvEXT', 'glGetNamedProgramivEXT',
+'glGetNamedProgramStringEXT', 'glNamedProgramLocalParameters4fvEXT',
+'glNamedProgramLocalParameterI4iEXT', 'glNamedProgramLocalParameterI4ivEXT',
+'glNamedProgramLocalParametersI4ivEXT', 'glNamedProgramLocalParameterI4uiEXT',
+'glNamedProgramLocalParameterI4uivEXT',
+'glNamedProgramLocalParametersI4uivEXT',
+'glGetNamedProgramLocalParameterIivEXT',
+'glGetNamedProgramLocalParameterIuivEXT', 'glTextureParameterIivEXT',
+'glTextureParameterIuivEXT', 'glGetTextureParameterIivEXT',
+'glGetTextureParameterIuivEXT', 'glMultiTexParameterIivEXT',
+'glMultiTexParameterIuivEXT', 'glGetMultiTexParameterIivEXT',
+'glGetMultiTexParameterIuivEXT', 'glProgramUniform1fEXT',
+'glProgramUniform2fEXT', 'glProgramUniform3fEXT', 'glProgramUniform4fEXT',
+'glProgramUniform1iEXT', 'glProgramUniform2iEXT', 'glProgramUniform3iEXT',
+'glProgramUniform4iEXT', 'glProgramUniform1fvEXT', 'glProgramUniform2fvEXT',
+'glProgramUniform3fvEXT', 'glProgramUniform4fvEXT', 'glProgramUniform1ivEXT',
+'glProgramUniform2ivEXT', 'glProgramUniform3ivEXT', 'glProgramUniform4ivEXT',
+'glProgramUniformMatrix2fvEXT', 'glProgramUniformMatrix3fvEXT',
+'glProgramUniformMatrix4fvEXT', 'glProgramUniformMatrix2x3fvEXT',
+'glProgramUniformMatrix3x2fvEXT', 'glProgramUniformMatrix2x4fvEXT',
+'glProgramUniformMatrix4x2fvEXT', 'glProgramUniformMatrix3x4fvEXT',
+'glProgramUniformMatrix4x3fvEXT', 'glProgramUniform1uiEXT',
+'glProgramUniform2uiEXT', 'glProgramUniform3uiEXT', 'glProgramUniform4uiEXT',
+'glProgramUniform1uivEXT', 'glProgramUniform2uivEXT',
+'glProgramUniform3uivEXT', 'glProgramUniform4uivEXT', 'glNamedBufferDataEXT',
+'glNamedBufferSubDataEXT', 'glMapNamedBufferEXT', 'glUnmapNamedBufferEXT',
+'glGetNamedBufferParameterivEXT', 'glGetNamedBufferPointervEXT',
+'glGetNamedBufferSubDataEXT', 'glTextureBufferEXT', 'glMultiTexBufferEXT',
+'glNamedRenderbufferStorageEXT', 'glGetNamedRenderbufferParameterivEXT',
+'glCheckNamedFramebufferStatusEXT', 'glNamedFramebufferTexture1DEXT',
+'glNamedFramebufferTexture2DEXT', 'glNamedFramebufferTexture3DEXT',
+'glNamedFramebufferRenderbufferEXT',
+'glGetNamedFramebufferAttachmentParameterivEXT', 'glGenerateTextureMipmapEXT',
+'glGenerateMultiTexMipmapEXT', 'glFramebufferDrawBufferEXT',
+'glFramebufferDrawBuffersEXT', 'glFramebufferReadBufferEXT',
+'glGetFramebufferParameterivEXT', 'glNamedRenderbufferStorageMultisampleEXT',
+'glNamedRenderbufferStorageMultisampleCoverageEXT',
+'glNamedFramebufferTextureEXT', 'glNamedFramebufferTextureLayerEXT',
+'glNamedFramebufferTextureFaceEXT', 'glTextureRenderbufferEXT',
+'glMultiTexRenderbufferEXT', 'PFNGLCLIENTATTRIBDEFAULTEXTPROC',
+'PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC', 'PFNGLMATRIXLOADFEXTPROC',
+'PFNGLMATRIXLOADDEXTPROC', 'PFNGLMATRIXMULTFEXTPROC',
+'PFNGLMATRIXMULTDEXTPROC', 'PFNGLMATRIXLOADIDENTITYEXTPROC',
+'PFNGLMATRIXROTATEFEXTPROC', 'PFNGLMATRIXROTATEDEXTPROC',
+'PFNGLMATRIXSCALEFEXTPROC', 'PFNGLMATRIXSCALEDEXTPROC',
+'PFNGLMATRIXTRANSLATEFEXTPROC', 'PFNGLMATRIXTRANSLATEDEXTPROC',
+'PFNGLMATRIXFRUSTUMEXTPROC', 'PFNGLMATRIXORTHOEXTPROC',
+'PFNGLMATRIXPOPEXTPROC', 'PFNGLMATRIXPUSHEXTPROC',
+'PFNGLMATRIXLOADTRANSPOSEFEXTPROC', 'PFNGLMATRIXLOADTRANSPOSEDEXTPROC',
+'PFNGLMATRIXMULTTRANSPOSEFEXTPROC', 'PFNGLMATRIXMULTTRANSPOSEDEXTPROC',
+'PFNGLTEXTUREPARAMETERFEXTPROC', 'PFNGLTEXTUREPARAMETERFVEXTPROC',
+'PFNGLTEXTUREPARAMETERIEXTPROC', 'PFNGLTEXTUREPARAMETERIVEXTPROC',
+'PFNGLTEXTUREIMAGE1DEXTPROC', 'PFNGLTEXTUREIMAGE2DEXTPROC',
+'PFNGLTEXTURESUBIMAGE1DEXTPROC', 'PFNGLTEXTURESUBIMAGE2DEXTPROC',
+'PFNGLCOPYTEXTUREIMAGE1DEXTPROC', 'PFNGLCOPYTEXTUREIMAGE2DEXTPROC',
+'PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC', 'PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC',
+'PFNGLGETTEXTUREIMAGEEXTPROC', 'PFNGLGETTEXTUREPARAMETERFVEXTPROC',
+'PFNGLGETTEXTUREPARAMETERIVEXTPROC', 'PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC',
+'PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC', 'PFNGLTEXTUREIMAGE3DEXTPROC',
+'PFNGLTEXTURESUBIMAGE3DEXTPROC', 'PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC',
+'PFNGLMULTITEXPARAMETERFEXTPROC', 'PFNGLMULTITEXPARAMETERFVEXTPROC',
+'PFNGLMULTITEXPARAMETERIEXTPROC', 'PFNGLMULTITEXPARAMETERIVEXTPROC',
+'PFNGLMULTITEXIMAGE1DEXTPROC', 'PFNGLMULTITEXIMAGE2DEXTPROC',
+'PFNGLMULTITEXSUBIMAGE1DEXTPROC', 'PFNGLMULTITEXSUBIMAGE2DEXTPROC',
+'PFNGLCOPYMULTITEXIMAGE1DEXTPROC', 'PFNGLCOPYMULTITEXIMAGE2DEXTPROC',
+'PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC', 'PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC',
+'PFNGLGETMULTITEXIMAGEEXTPROC', 'PFNGLGETMULTITEXPARAMETERFVEXTPROC',
+'PFNGLGETMULTITEXPARAMETERIVEXTPROC',
+'PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC',
+'PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC', 'PFNGLMULTITEXIMAGE3DEXTPROC',
+'PFNGLMULTITEXSUBIMAGE3DEXTPROC', 'PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC',
+'PFNGLBINDMULTITEXTUREEXTPROC', 'PFNGLENABLECLIENTSTATEINDEXEDEXTPROC',
+'PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC', 'PFNGLMULTITEXCOORDPOINTEREXTPROC',
+'PFNGLMULTITEXENVFEXTPROC', 'PFNGLMULTITEXENVFVEXTPROC',
+'PFNGLMULTITEXENVIEXTPROC', 'PFNGLMULTITEXENVIVEXTPROC',
+'PFNGLMULTITEXGENDEXTPROC', 'PFNGLMULTITEXGENDVEXTPROC',
+'PFNGLMULTITEXGENFEXTPROC', 'PFNGLMULTITEXGENFVEXTPROC',
+'PFNGLMULTITEXGENIEXTPROC', 'PFNGLMULTITEXGENIVEXTPROC',
+'PFNGLGETMULTITEXENVFVEXTPROC', 'PFNGLGETMULTITEXENVIVEXTPROC',
+'PFNGLGETMULTITEXGENDVEXTPROC', 'PFNGLGETMULTITEXGENFVEXTPROC',
+'PFNGLGETMULTITEXGENIVEXTPROC', 'PFNGLGETFLOATINDEXEDVEXTPROC',
+'PFNGLGETDOUBLEINDEXEDVEXTPROC', 'PFNGLGETPOINTERINDEXEDVEXTPROC',
+'PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC',
+'PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC',
+'PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC',
+'PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC',
+'PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC',
+'PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC',
+'PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC',
+'PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC',
+'PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC',
+'PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC',
+'PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC',
+'PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC',
+'PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC',
+'PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC', 'PFNGLNAMEDPROGRAMSTRINGEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC',
+'PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC',
+'PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC',
+'PFNGLGETNAMEDPROGRAMIVEXTPROC', 'PFNGLGETNAMEDPROGRAMSTRINGEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC',
+'PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC',
+'PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC',
+'PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC',
+'PFNGLTEXTUREPARAMETERIIVEXTPROC', 'PFNGLTEXTUREPARAMETERIUIVEXTPROC',
+'PFNGLGETTEXTUREPARAMETERIIVEXTPROC', 'PFNGLGETTEXTUREPARAMETERIUIVEXTPROC',
+'PFNGLMULTITEXPARAMETERIIVEXTPROC', 'PFNGLMULTITEXPARAMETERIUIVEXTPROC',
+'PFNGLGETMULTITEXPARAMETERIIVEXTPROC', 'PFNGLGETMULTITEXPARAMETERIUIVEXTPROC',
+'PFNGLPROGRAMUNIFORM1FEXTPROC', 'PFNGLPROGRAMUNIFORM2FEXTPROC',
+'PFNGLPROGRAMUNIFORM3FEXTPROC', 'PFNGLPROGRAMUNIFORM4FEXTPROC',
+'PFNGLPROGRAMUNIFORM1IEXTPROC', 'PFNGLPROGRAMUNIFORM2IEXTPROC',
+'PFNGLPROGRAMUNIFORM3IEXTPROC', 'PFNGLPROGRAMUNIFORM4IEXTPROC',
+'PFNGLPROGRAMUNIFORM1FVEXTPROC', 'PFNGLPROGRAMUNIFORM2FVEXTPROC',
+'PFNGLPROGRAMUNIFORM3FVEXTPROC', 'PFNGLPROGRAMUNIFORM4FVEXTPROC',
+'PFNGLPROGRAMUNIFORM1IVEXTPROC', 'PFNGLPROGRAMUNIFORM2IVEXTPROC',
+'PFNGLPROGRAMUNIFORM3IVEXTPROC', 'PFNGLPROGRAMUNIFORM4IVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC', 'PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC',
+'PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC', 'PFNGLPROGRAMUNIFORM1UIEXTPROC',
+'PFNGLPROGRAMUNIFORM2UIEXTPROC', 'PFNGLPROGRAMUNIFORM3UIEXTPROC',
+'PFNGLPROGRAMUNIFORM4UIEXTPROC', 'PFNGLPROGRAMUNIFORM1UIVEXTPROC',
+'PFNGLPROGRAMUNIFORM2UIVEXTPROC', 'PFNGLPROGRAMUNIFORM3UIVEXTPROC',
+'PFNGLPROGRAMUNIFORM4UIVEXTPROC', 'PFNGLNAMEDBUFFERDATAEXTPROC',
+'PFNGLNAMEDBUFFERSUBDATAEXTPROC', 'PFNGLMAPNAMEDBUFFEREXTPROC',
+'PFNGLUNMAPNAMEDBUFFEREXTPROC', 'PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC',
+'PFNGLGETNAMEDBUFFERPOINTERVEXTPROC', 'PFNGLGETNAMEDBUFFERSUBDATAEXTPROC',
+'PFNGLTEXTUREBUFFEREXTPROC', 'PFNGLMULTITEXBUFFEREXTPROC',
+'PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC',
+'PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC',
+'PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC',
+'PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC',
+'PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC',
+'PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC',
+'PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC',
+'PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC',
+'PFNGLGENERATETEXTUREMIPMAPEXTPROC', 'PFNGLGENERATEMULTITEXMIPMAPEXTPROC',
+'PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC', 'PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC',
+'PFNGLFRAMEBUFFERREADBUFFEREXTPROC', 'PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC',
+'PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC',
+'PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC',
+'PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC',
+'PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC',
+'PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC', 'PFNGLTEXTURERENDERBUFFEREXTPROC',
+'PFNGLMULTITEXRENDERBUFFEREXTPROC', 'GL_EXT_vertex_array_bgra',
+'GL_EXT_texture_swizzle', 'GL_NV_explicit_multisample',
+'glGetMultisamplefvNV', 'glSampleMaskIndexedNV', 'glTexRenderbufferNV',
+'PFNGLGETMULTISAMPLEFVNVPROC', 'PFNGLSAMPLEMASKINDEXEDNVPROC',
+'PFNGLTEXRENDERBUFFERNVPROC', 'GL_NV_transform_feedback2',
+'glBindTransformFeedbackNV', 'glDeleteTransformFeedbacksNV',
+'glGenTransformFeedbacksNV', 'glIsTransformFeedbackNV',
+'glPauseTransformFeedbackNV', 'glResumeTransformFeedbackNV',
+'glDrawTransformFeedbackNV', 'PFNGLBINDTRANSFORMFEEDBACKNVPROC',
+'PFNGLDELETETRANSFORMFEEDBACKSNVPROC', 'PFNGLGENTRANSFORMFEEDBACKSNVPROC',
+'PFNGLISTRANSFORMFEEDBACKNVPROC', 'PFNGLPAUSETRANSFORMFEEDBACKNVPROC',
+'PFNGLRESUMETRANSFORMFEEDBACKNVPROC', 'PFNGLDRAWTRANSFORMFEEDBACKNVPROC',
+'GL_NV_vertex_buffer_unified_memory', 'glBufferAddressRangeNV',
+'glVertexFormatNV', 'glNormalFormatNV', 'glColorFormatNV', 'glIndexFormatNV',
+'glTexCoordFormatNV', 'glEdgeFlagFormatNV', 'glSecondaryColorFormatNV',
+'glFogCoordFormatNV', 'glVertexAttribFormatNV', 'glVertexAttribIFormatNV',
+'glGetIntegerui64i_vNV', 'PFNGLBUFFERADDRESSRANGENVPROC',
+'PFNGLVERTEXFORMATNVPROC', 'PFNGLNORMALFORMATNVPROC',
+'PFNGLCOLORFORMATNVPROC', 'PFNGLINDEXFORMATNVPROC',
+'PFNGLTEXCOORDFORMATNVPROC', 'PFNGLEDGEFLAGFORMATNVPROC',
+'PFNGLSECONDARYCOLORFORMATNVPROC', 'PFNGLFOGCOORDFORMATNVPROC',
+'PFNGLVERTEXATTRIBFORMATNVPROC', 'PFNGLVERTEXATTRIBIFORMATNVPROC',
+'PFNGLGETINTEGERUI64I_VNVPROC', 'GL_NV_shader_buffer_load',
+'glGetBufferParameterui64vNV', 'glGetIntegerui64vNV',
+'glGetNamedBufferParameterui64vNV', 'glIsBufferResidentNV',
+'glIsNamedBufferResidentNV', 'glMakeBufferNonResidentNV',
+'glMakeBufferResidentNV', 'glMakeNamedBufferNonResidentNV',
+'glMakeNamedBufferResidentNV', 'glUniformui64NV', 'glUniformui64vNV',
+'glGetUniformui64vNV', 'glProgramUniformui64NV', 'glProgramUniformui64vNV',
+'PFNGLGETBUFFERPARAMETERUI64VNVPROC', 'PFNGLGETINTEGERUI64VNVPROC',
+'PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC', 'PFNGLISBUFFERRESIDENTNVPROC',
+'PFNGLISNAMEDBUFFERRESIDENTNVPROC', 'PFNGLMAKEBUFFERNONRESIDENTNVPROC',
+'PFNGLMAKEBUFFERRESIDENTNVPROC', 'PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC',
+'PFNGLMAKENAMEDBUFFERRESIDENTNVPROC', 'PFNGLUNIFORMUI64NVPROC',
+'PFNGLUNIFORMUI64VNVPROC', 'PFNGLGETUNIFORMUI64VNVPROC',
+'PFNGLPROGRAMUNIFORMUI64NVPROC', 'PFNGLPROGRAMUNIFORMUI64VNVPROC']
+# END GENERATED CONTENT (do not edit above this line)
+
+
+
+
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glu.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glu.py
new file mode 100644
index 0000000..c9e2c06
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glu.py
@@ -0,0 +1,516 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+'''Wrapper for /usr/include/GL/glu.h
+
+Generated by tools/gengl.py.
+Do not modify this file.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+from ctypes import *
+from pyglet.gl.lib import link_GLU as _link_function
+from pyglet.gl.lib import c_ptrdiff_t
+
+# BEGIN GENERATED CONTENT (do not edit below this line)
+
+# This content is generated by tools/gengl.py.
+# Wrapper for /usr/include/GL/glu.h
+
+
+GLU_EXT_object_space_tess = 1 # /usr/include/GL/glu.h:71
+GLU_EXT_nurbs_tessellator = 1 # /usr/include/GL/glu.h:72
+GLU_FALSE = 0 # /usr/include/GL/glu.h:75
+GLU_TRUE = 1 # /usr/include/GL/glu.h:76
+GLU_VERSION_1_1 = 1 # /usr/include/GL/glu.h:79
+GLU_VERSION_1_2 = 1 # /usr/include/GL/glu.h:80
+GLU_VERSION_1_3 = 1 # /usr/include/GL/glu.h:81
+GLU_VERSION = 100800 # /usr/include/GL/glu.h:84
+GLU_EXTENSIONS = 100801 # /usr/include/GL/glu.h:85
+GLU_INVALID_ENUM = 100900 # /usr/include/GL/glu.h:88
+GLU_INVALID_VALUE = 100901 # /usr/include/GL/glu.h:89
+GLU_OUT_OF_MEMORY = 100902 # /usr/include/GL/glu.h:90
+GLU_INCOMPATIBLE_GL_VERSION = 100903 # /usr/include/GL/glu.h:91
+GLU_INVALID_OPERATION = 100904 # /usr/include/GL/glu.h:92
+GLU_OUTLINE_POLYGON = 100240 # /usr/include/GL/glu.h:96
+GLU_OUTLINE_PATCH = 100241 # /usr/include/GL/glu.h:97
+GLU_NURBS_ERROR = 100103 # /usr/include/GL/glu.h:100
+GLU_ERROR = 100103 # /usr/include/GL/glu.h:101
+GLU_NURBS_BEGIN = 100164 # /usr/include/GL/glu.h:102
+GLU_NURBS_BEGIN_EXT = 100164 # /usr/include/GL/glu.h:103
+GLU_NURBS_VERTEX = 100165 # /usr/include/GL/glu.h:104
+GLU_NURBS_VERTEX_EXT = 100165 # /usr/include/GL/glu.h:105
+GLU_NURBS_NORMAL = 100166 # /usr/include/GL/glu.h:106
+GLU_NURBS_NORMAL_EXT = 100166 # /usr/include/GL/glu.h:107
+GLU_NURBS_COLOR = 100167 # /usr/include/GL/glu.h:108
+GLU_NURBS_COLOR_EXT = 100167 # /usr/include/GL/glu.h:109
+GLU_NURBS_TEXTURE_COORD = 100168 # /usr/include/GL/glu.h:110
+GLU_NURBS_TEX_COORD_EXT = 100168 # /usr/include/GL/glu.h:111
+GLU_NURBS_END = 100169 # /usr/include/GL/glu.h:112
+GLU_NURBS_END_EXT = 100169 # /usr/include/GL/glu.h:113
+GLU_NURBS_BEGIN_DATA = 100170 # /usr/include/GL/glu.h:114
+GLU_NURBS_BEGIN_DATA_EXT = 100170 # /usr/include/GL/glu.h:115
+GLU_NURBS_VERTEX_DATA = 100171 # /usr/include/GL/glu.h:116
+GLU_NURBS_VERTEX_DATA_EXT = 100171 # /usr/include/GL/glu.h:117
+GLU_NURBS_NORMAL_DATA = 100172 # /usr/include/GL/glu.h:118
+GLU_NURBS_NORMAL_DATA_EXT = 100172 # /usr/include/GL/glu.h:119
+GLU_NURBS_COLOR_DATA = 100173 # /usr/include/GL/glu.h:120
+GLU_NURBS_COLOR_DATA_EXT = 100173 # /usr/include/GL/glu.h:121
+GLU_NURBS_TEXTURE_COORD_DATA = 100174 # /usr/include/GL/glu.h:122
+GLU_NURBS_TEX_COORD_DATA_EXT = 100174 # /usr/include/GL/glu.h:123
+GLU_NURBS_END_DATA = 100175 # /usr/include/GL/glu.h:124
+GLU_NURBS_END_DATA_EXT = 100175 # /usr/include/GL/glu.h:125
+GLU_NURBS_ERROR1 = 100251 # /usr/include/GL/glu.h:128
+GLU_NURBS_ERROR2 = 100252 # /usr/include/GL/glu.h:129
+GLU_NURBS_ERROR3 = 100253 # /usr/include/GL/glu.h:130
+GLU_NURBS_ERROR4 = 100254 # /usr/include/GL/glu.h:131
+GLU_NURBS_ERROR5 = 100255 # /usr/include/GL/glu.h:132
+GLU_NURBS_ERROR6 = 100256 # /usr/include/GL/glu.h:133
+GLU_NURBS_ERROR7 = 100257 # /usr/include/GL/glu.h:134
+GLU_NURBS_ERROR8 = 100258 # /usr/include/GL/glu.h:135
+GLU_NURBS_ERROR9 = 100259 # /usr/include/GL/glu.h:136
+GLU_NURBS_ERROR10 = 100260 # /usr/include/GL/glu.h:137
+GLU_NURBS_ERROR11 = 100261 # /usr/include/GL/glu.h:138
+GLU_NURBS_ERROR12 = 100262 # /usr/include/GL/glu.h:139
+GLU_NURBS_ERROR13 = 100263 # /usr/include/GL/glu.h:140
+GLU_NURBS_ERROR14 = 100264 # /usr/include/GL/glu.h:141
+GLU_NURBS_ERROR15 = 100265 # /usr/include/GL/glu.h:142
+GLU_NURBS_ERROR16 = 100266 # /usr/include/GL/glu.h:143
+GLU_NURBS_ERROR17 = 100267 # /usr/include/GL/glu.h:144
+GLU_NURBS_ERROR18 = 100268 # /usr/include/GL/glu.h:145
+GLU_NURBS_ERROR19 = 100269 # /usr/include/GL/glu.h:146
+GLU_NURBS_ERROR20 = 100270 # /usr/include/GL/glu.h:147
+GLU_NURBS_ERROR21 = 100271 # /usr/include/GL/glu.h:148
+GLU_NURBS_ERROR22 = 100272 # /usr/include/GL/glu.h:149
+GLU_NURBS_ERROR23 = 100273 # /usr/include/GL/glu.h:150
+GLU_NURBS_ERROR24 = 100274 # /usr/include/GL/glu.h:151
+GLU_NURBS_ERROR25 = 100275 # /usr/include/GL/glu.h:152
+GLU_NURBS_ERROR26 = 100276 # /usr/include/GL/glu.h:153
+GLU_NURBS_ERROR27 = 100277 # /usr/include/GL/glu.h:154
+GLU_NURBS_ERROR28 = 100278 # /usr/include/GL/glu.h:155
+GLU_NURBS_ERROR29 = 100279 # /usr/include/GL/glu.h:156
+GLU_NURBS_ERROR30 = 100280 # /usr/include/GL/glu.h:157
+GLU_NURBS_ERROR31 = 100281 # /usr/include/GL/glu.h:158
+GLU_NURBS_ERROR32 = 100282 # /usr/include/GL/glu.h:159
+GLU_NURBS_ERROR33 = 100283 # /usr/include/GL/glu.h:160
+GLU_NURBS_ERROR34 = 100284 # /usr/include/GL/glu.h:161
+GLU_NURBS_ERROR35 = 100285 # /usr/include/GL/glu.h:162
+GLU_NURBS_ERROR36 = 100286 # /usr/include/GL/glu.h:163
+GLU_NURBS_ERROR37 = 100287 # /usr/include/GL/glu.h:164
+GLU_AUTO_LOAD_MATRIX = 100200 # /usr/include/GL/glu.h:167
+GLU_CULLING = 100201 # /usr/include/GL/glu.h:168
+GLU_SAMPLING_TOLERANCE = 100203 # /usr/include/GL/glu.h:169
+GLU_DISPLAY_MODE = 100204 # /usr/include/GL/glu.h:170
+GLU_PARAMETRIC_TOLERANCE = 100202 # /usr/include/GL/glu.h:171
+GLU_SAMPLING_METHOD = 100205 # /usr/include/GL/glu.h:172
+GLU_U_STEP = 100206 # /usr/include/GL/glu.h:173
+GLU_V_STEP = 100207 # /usr/include/GL/glu.h:174
+GLU_NURBS_MODE = 100160 # /usr/include/GL/glu.h:175
+GLU_NURBS_MODE_EXT = 100160 # /usr/include/GL/glu.h:176
+GLU_NURBS_TESSELLATOR = 100161 # /usr/include/GL/glu.h:177
+GLU_NURBS_TESSELLATOR_EXT = 100161 # /usr/include/GL/glu.h:178
+GLU_NURBS_RENDERER = 100162 # /usr/include/GL/glu.h:179
+GLU_NURBS_RENDERER_EXT = 100162 # /usr/include/GL/glu.h:180
+GLU_OBJECT_PARAMETRIC_ERROR = 100208 # /usr/include/GL/glu.h:183
+GLU_OBJECT_PARAMETRIC_ERROR_EXT = 100208 # /usr/include/GL/glu.h:184
+GLU_OBJECT_PATH_LENGTH = 100209 # /usr/include/GL/glu.h:185
+GLU_OBJECT_PATH_LENGTH_EXT = 100209 # /usr/include/GL/glu.h:186
+GLU_PATH_LENGTH = 100215 # /usr/include/GL/glu.h:187
+GLU_PARAMETRIC_ERROR = 100216 # /usr/include/GL/glu.h:188
+GLU_DOMAIN_DISTANCE = 100217 # /usr/include/GL/glu.h:189
+GLU_MAP1_TRIM_2 = 100210 # /usr/include/GL/glu.h:192
+GLU_MAP1_TRIM_3 = 100211 # /usr/include/GL/glu.h:193
+GLU_POINT = 100010 # /usr/include/GL/glu.h:196
+GLU_LINE = 100011 # /usr/include/GL/glu.h:197
+GLU_FILL = 100012 # /usr/include/GL/glu.h:198
+GLU_SILHOUETTE = 100013 # /usr/include/GL/glu.h:199
+GLU_SMOOTH = 100000 # /usr/include/GL/glu.h:205
+GLU_FLAT = 100001 # /usr/include/GL/glu.h:206
+GLU_NONE = 100002 # /usr/include/GL/glu.h:207
+GLU_OUTSIDE = 100020 # /usr/include/GL/glu.h:210
+GLU_INSIDE = 100021 # /usr/include/GL/glu.h:211
+GLU_TESS_BEGIN = 100100 # /usr/include/GL/glu.h:214
+GLU_BEGIN = 100100 # /usr/include/GL/glu.h:215
+GLU_TESS_VERTEX = 100101 # /usr/include/GL/glu.h:216
+GLU_VERTEX = 100101 # /usr/include/GL/glu.h:217
+GLU_TESS_END = 100102 # /usr/include/GL/glu.h:218
+GLU_END = 100102 # /usr/include/GL/glu.h:219
+GLU_TESS_ERROR = 100103 # /usr/include/GL/glu.h:220
+GLU_TESS_EDGE_FLAG = 100104 # /usr/include/GL/glu.h:221
+GLU_EDGE_FLAG = 100104 # /usr/include/GL/glu.h:222
+GLU_TESS_COMBINE = 100105 # /usr/include/GL/glu.h:223
+GLU_TESS_BEGIN_DATA = 100106 # /usr/include/GL/glu.h:224
+GLU_TESS_VERTEX_DATA = 100107 # /usr/include/GL/glu.h:225
+GLU_TESS_END_DATA = 100108 # /usr/include/GL/glu.h:226
+GLU_TESS_ERROR_DATA = 100109 # /usr/include/GL/glu.h:227
+GLU_TESS_EDGE_FLAG_DATA = 100110 # /usr/include/GL/glu.h:228
+GLU_TESS_COMBINE_DATA = 100111 # /usr/include/GL/glu.h:229
+GLU_CW = 100120 # /usr/include/GL/glu.h:232
+GLU_CCW = 100121 # /usr/include/GL/glu.h:233
+GLU_INTERIOR = 100122 # /usr/include/GL/glu.h:234
+GLU_EXTERIOR = 100123 # /usr/include/GL/glu.h:235
+GLU_UNKNOWN = 100124 # /usr/include/GL/glu.h:236
+GLU_TESS_WINDING_RULE = 100140 # /usr/include/GL/glu.h:239
+GLU_TESS_BOUNDARY_ONLY = 100141 # /usr/include/GL/glu.h:240
+GLU_TESS_TOLERANCE = 100142 # /usr/include/GL/glu.h:241
+GLU_TESS_ERROR1 = 100151 # /usr/include/GL/glu.h:244
+GLU_TESS_ERROR2 = 100152 # /usr/include/GL/glu.h:245
+GLU_TESS_ERROR3 = 100153 # /usr/include/GL/glu.h:246
+GLU_TESS_ERROR4 = 100154 # /usr/include/GL/glu.h:247
+GLU_TESS_ERROR5 = 100155 # /usr/include/GL/glu.h:248
+GLU_TESS_ERROR6 = 100156 # /usr/include/GL/glu.h:249
+GLU_TESS_ERROR7 = 100157 # /usr/include/GL/glu.h:250
+GLU_TESS_ERROR8 = 100158 # /usr/include/GL/glu.h:251
+GLU_TESS_MISSING_BEGIN_POLYGON = 100151 # /usr/include/GL/glu.h:252
+GLU_TESS_MISSING_BEGIN_CONTOUR = 100152 # /usr/include/GL/glu.h:253
+GLU_TESS_MISSING_END_POLYGON = 100153 # /usr/include/GL/glu.h:254
+GLU_TESS_MISSING_END_CONTOUR = 100154 # /usr/include/GL/glu.h:255
+GLU_TESS_COORD_TOO_LARGE = 100155 # /usr/include/GL/glu.h:256
+GLU_TESS_NEED_COMBINE_CALLBACK = 100156 # /usr/include/GL/glu.h:257
+GLU_TESS_WINDING_ODD = 100130 # /usr/include/GL/glu.h:260
+GLU_TESS_WINDING_NONZERO = 100131 # /usr/include/GL/glu.h:261
+GLU_TESS_WINDING_POSITIVE = 100132 # /usr/include/GL/glu.h:262
+GLU_TESS_WINDING_NEGATIVE = 100133 # /usr/include/GL/glu.h:263
+GLU_TESS_WINDING_ABS_GEQ_TWO = 100134 # /usr/include/GL/glu.h:264
+class struct_GLUnurbs(Structure):
+ __slots__ = [
+ ]
+struct_GLUnurbs._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_GLUnurbs(Structure):
+ __slots__ = [
+ ]
+struct_GLUnurbs._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+GLUnurbs = struct_GLUnurbs # /usr/include/GL/glu.h:274
+class struct_GLUquadric(Structure):
+ __slots__ = [
+ ]
+struct_GLUquadric._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_GLUquadric(Structure):
+ __slots__ = [
+ ]
+struct_GLUquadric._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+GLUquadric = struct_GLUquadric # /usr/include/GL/glu.h:275
+class struct_GLUtesselator(Structure):
+ __slots__ = [
+ ]
+struct_GLUtesselator._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_GLUtesselator(Structure):
+ __slots__ = [
+ ]
+struct_GLUtesselator._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+GLUtesselator = struct_GLUtesselator # /usr/include/GL/glu.h:276
+GLUnurbsObj = GLUnurbs # /usr/include/GL/glu.h:279
+GLUquadricObj = GLUquadric # /usr/include/GL/glu.h:280
+GLUtesselatorObj = GLUtesselator # /usr/include/GL/glu.h:281
+GLUtriangulatorObj = GLUtesselator # /usr/include/GL/glu.h:282
+GLU_TESS_MAX_COORD = 9.9999999999999998e+149 # /usr/include/GL/glu.h:284
+_GLUfuncptr = CFUNCTYPE(None) # /usr/include/GL/glu.h:287
+# /usr/include/GL/glu.h:289
+gluBeginCurve = _link_function('gluBeginCurve', None, [POINTER(GLUnurbs)], None)
+
+# /usr/include/GL/glu.h:290
+gluBeginPolygon = _link_function('gluBeginPolygon', None, [POINTER(GLUtesselator)], None)
+
+# /usr/include/GL/glu.h:291
+gluBeginSurface = _link_function('gluBeginSurface', None, [POINTER(GLUnurbs)], None)
+
+# /usr/include/GL/glu.h:292
+gluBeginTrim = _link_function('gluBeginTrim', None, [POINTER(GLUnurbs)], None)
+
+GLint = c_int # /usr/include/GL/gl.h:159
+GLenum = c_uint # /usr/include/GL/gl.h:153
+GLsizei = c_int # /usr/include/GL/gl.h:163
+# /usr/include/GL/glu.h:293
+gluBuild1DMipmapLevels = _link_function('gluBuild1DMipmapLevels', GLint, [GLenum, GLint, GLsizei, GLenum, GLenum, GLint, GLint, GLint, POINTER(None)], None)
+
+# /usr/include/GL/glu.h:294
+gluBuild1DMipmaps = _link_function('gluBuild1DMipmaps', GLint, [GLenum, GLint, GLsizei, GLenum, GLenum, POINTER(None)], None)
+
+# /usr/include/GL/glu.h:295
+gluBuild2DMipmapLevels = _link_function('gluBuild2DMipmapLevels', GLint, [GLenum, GLint, GLsizei, GLsizei, GLenum, GLenum, GLint, GLint, GLint, POINTER(None)], None)
+
+# /usr/include/GL/glu.h:296
+gluBuild2DMipmaps = _link_function('gluBuild2DMipmaps', GLint, [GLenum, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(None)], None)
+
+# /usr/include/GL/glu.h:297
+gluBuild3DMipmapLevels = _link_function('gluBuild3DMipmapLevels', GLint, [GLenum, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLint, GLint, GLint, POINTER(None)], None)
+
+# /usr/include/GL/glu.h:298
+gluBuild3DMipmaps = _link_function('gluBuild3DMipmaps', GLint, [GLenum, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(None)], None)
+
+GLboolean = c_ubyte # /usr/include/GL/gl.h:154
+GLubyte = c_ubyte # /usr/include/GL/gl.h:160
+# /usr/include/GL/glu.h:299
+gluCheckExtension = _link_function('gluCheckExtension', GLboolean, [POINTER(GLubyte), POINTER(GLubyte)], None)
+
+GLdouble = c_double # /usr/include/GL/gl.h:166
+# /usr/include/GL/glu.h:300
+gluCylinder = _link_function('gluCylinder', None, [POINTER(GLUquadric), GLdouble, GLdouble, GLdouble, GLint, GLint], None)
+
+# /usr/include/GL/glu.h:301
+gluDeleteNurbsRenderer = _link_function('gluDeleteNurbsRenderer', None, [POINTER(GLUnurbs)], None)
+
+# /usr/include/GL/glu.h:302
+gluDeleteQuadric = _link_function('gluDeleteQuadric', None, [POINTER(GLUquadric)], None)
+
+# /usr/include/GL/glu.h:303
+gluDeleteTess = _link_function('gluDeleteTess', None, [POINTER(GLUtesselator)], None)
+
+# /usr/include/GL/glu.h:304
+gluDisk = _link_function('gluDisk', None, [POINTER(GLUquadric), GLdouble, GLdouble, GLint, GLint], None)
+
+# /usr/include/GL/glu.h:305
+gluEndCurve = _link_function('gluEndCurve', None, [POINTER(GLUnurbs)], None)
+
+# /usr/include/GL/glu.h:306
+gluEndPolygon = _link_function('gluEndPolygon', None, [POINTER(GLUtesselator)], None)
+
+# /usr/include/GL/glu.h:307
+gluEndSurface = _link_function('gluEndSurface', None, [POINTER(GLUnurbs)], None)
+
+# /usr/include/GL/glu.h:308
+gluEndTrim = _link_function('gluEndTrim', None, [POINTER(GLUnurbs)], None)
+
+# /usr/include/GL/glu.h:309
+gluErrorString = _link_function('gluErrorString', POINTER(GLubyte), [GLenum], None)
+
+GLfloat = c_float # /usr/include/GL/gl.h:164
+# /usr/include/GL/glu.h:310
+gluGetNurbsProperty = _link_function('gluGetNurbsProperty', None, [POINTER(GLUnurbs), GLenum, POINTER(GLfloat)], None)
+
+# /usr/include/GL/glu.h:311
+gluGetString = _link_function('gluGetString', POINTER(GLubyte), [GLenum], None)
+
+# /usr/include/GL/glu.h:312
+gluGetTessProperty = _link_function('gluGetTessProperty', None, [POINTER(GLUtesselator), GLenum, POINTER(GLdouble)], None)
+
+# /usr/include/GL/glu.h:313
+gluLoadSamplingMatrices = _link_function('gluLoadSamplingMatrices', None, [POINTER(GLUnurbs), POINTER(GLfloat), POINTER(GLfloat), POINTER(GLint)], None)
+
+# /usr/include/GL/glu.h:314
+gluLookAt = _link_function('gluLookAt', None, [GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/glu.h:315
+gluNewNurbsRenderer = _link_function('gluNewNurbsRenderer', POINTER(GLUnurbs), [], None)
+
+# /usr/include/GL/glu.h:316
+gluNewQuadric = _link_function('gluNewQuadric', POINTER(GLUquadric), [], None)
+
+# /usr/include/GL/glu.h:317
+gluNewTess = _link_function('gluNewTess', POINTER(GLUtesselator), [], None)
+
+# /usr/include/GL/glu.h:318
+gluNextContour = _link_function('gluNextContour', None, [POINTER(GLUtesselator), GLenum], None)
+
+# /usr/include/GL/glu.h:319
+gluNurbsCallback = _link_function('gluNurbsCallback', None, [POINTER(GLUnurbs), GLenum, _GLUfuncptr], None)
+
+GLvoid = None # /usr/include/GL/gl.h:156
+# /usr/include/GL/glu.h:320
+gluNurbsCallbackData = _link_function('gluNurbsCallbackData', None, [POINTER(GLUnurbs), POINTER(GLvoid)], None)
+
+# /usr/include/GL/glu.h:321
+gluNurbsCallbackDataEXT = _link_function('gluNurbsCallbackDataEXT', None, [POINTER(GLUnurbs), POINTER(GLvoid)], None)
+
+# /usr/include/GL/glu.h:322
+gluNurbsCurve = _link_function('gluNurbsCurve', None, [POINTER(GLUnurbs), GLint, POINTER(GLfloat), GLint, POINTER(GLfloat), GLint, GLenum], None)
+
+# /usr/include/GL/glu.h:323
+gluNurbsProperty = _link_function('gluNurbsProperty', None, [POINTER(GLUnurbs), GLenum, GLfloat], None)
+
+# /usr/include/GL/glu.h:324
+gluNurbsSurface = _link_function('gluNurbsSurface', None, [POINTER(GLUnurbs), GLint, POINTER(GLfloat), GLint, POINTER(GLfloat), GLint, GLint, POINTER(GLfloat), GLint, GLint, GLenum], None)
+
+# /usr/include/GL/glu.h:325
+gluOrtho2D = _link_function('gluOrtho2D', None, [GLdouble, GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/glu.h:326
+gluPartialDisk = _link_function('gluPartialDisk', None, [POINTER(GLUquadric), GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble], None)
+
+# /usr/include/GL/glu.h:327
+gluPerspective = _link_function('gluPerspective', None, [GLdouble, GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/glu.h:328
+gluPickMatrix = _link_function('gluPickMatrix', None, [GLdouble, GLdouble, GLdouble, GLdouble, POINTER(GLint)], None)
+
+# /usr/include/GL/glu.h:329
+gluProject = _link_function('gluProject', GLint, [GLdouble, GLdouble, GLdouble, POINTER(GLdouble), POINTER(GLdouble), POINTER(GLint), POINTER(GLdouble), POINTER(GLdouble), POINTER(GLdouble)], None)
+
+# /usr/include/GL/glu.h:330
+gluPwlCurve = _link_function('gluPwlCurve', None, [POINTER(GLUnurbs), GLint, POINTER(GLfloat), GLint, GLenum], None)
+
+# /usr/include/GL/glu.h:331
+gluQuadricCallback = _link_function('gluQuadricCallback', None, [POINTER(GLUquadric), GLenum, _GLUfuncptr], None)
+
+# /usr/include/GL/glu.h:332
+gluQuadricDrawStyle = _link_function('gluQuadricDrawStyle', None, [POINTER(GLUquadric), GLenum], None)
+
+# /usr/include/GL/glu.h:333
+gluQuadricNormals = _link_function('gluQuadricNormals', None, [POINTER(GLUquadric), GLenum], None)
+
+# /usr/include/GL/glu.h:334
+gluQuadricOrientation = _link_function('gluQuadricOrientation', None, [POINTER(GLUquadric), GLenum], None)
+
+# /usr/include/GL/glu.h:335
+gluQuadricTexture = _link_function('gluQuadricTexture', None, [POINTER(GLUquadric), GLboolean], None)
+
+# /usr/include/GL/glu.h:336
+gluScaleImage = _link_function('gluScaleImage', GLint, [GLenum, GLsizei, GLsizei, GLenum, POINTER(None), GLsizei, GLsizei, GLenum, POINTER(GLvoid)], None)
+
+# /usr/include/GL/glu.h:337
+gluSphere = _link_function('gluSphere', None, [POINTER(GLUquadric), GLdouble, GLint, GLint], None)
+
+# /usr/include/GL/glu.h:338
+gluTessBeginContour = _link_function('gluTessBeginContour', None, [POINTER(GLUtesselator)], None)
+
+# /usr/include/GL/glu.h:339
+gluTessBeginPolygon = _link_function('gluTessBeginPolygon', None, [POINTER(GLUtesselator), POINTER(GLvoid)], None)
+
+# /usr/include/GL/glu.h:340
+gluTessCallback = _link_function('gluTessCallback', None, [POINTER(GLUtesselator), GLenum, _GLUfuncptr], None)
+
+# /usr/include/GL/glu.h:341
+gluTessEndContour = _link_function('gluTessEndContour', None, [POINTER(GLUtesselator)], None)
+
+# /usr/include/GL/glu.h:342
+gluTessEndPolygon = _link_function('gluTessEndPolygon', None, [POINTER(GLUtesselator)], None)
+
+# /usr/include/GL/glu.h:343
+gluTessNormal = _link_function('gluTessNormal', None, [POINTER(GLUtesselator), GLdouble, GLdouble, GLdouble], None)
+
+# /usr/include/GL/glu.h:344
+gluTessProperty = _link_function('gluTessProperty', None, [POINTER(GLUtesselator), GLenum, GLdouble], None)
+
+# /usr/include/GL/glu.h:345
+gluTessVertex = _link_function('gluTessVertex', None, [POINTER(GLUtesselator), POINTER(GLdouble), POINTER(GLvoid)], None)
+
+# /usr/include/GL/glu.h:346
+gluUnProject = _link_function('gluUnProject', GLint, [GLdouble, GLdouble, GLdouble, POINTER(GLdouble), POINTER(GLdouble), POINTER(GLint), POINTER(GLdouble), POINTER(GLdouble), POINTER(GLdouble)], None)
+
+# /usr/include/GL/glu.h:347
+gluUnProject4 = _link_function('gluUnProject4', GLint, [GLdouble, GLdouble, GLdouble, GLdouble, POINTER(GLdouble), POINTER(GLdouble), POINTER(GLint), GLdouble, GLdouble, POINTER(GLdouble), POINTER(GLdouble), POINTER(GLdouble), POINTER(GLdouble)], None)
+
+
+__all__ = ['GLU_EXT_object_space_tess', 'GLU_EXT_nurbs_tessellator',
+'GLU_FALSE', 'GLU_TRUE', 'GLU_VERSION_1_1', 'GLU_VERSION_1_2',
+'GLU_VERSION_1_3', 'GLU_VERSION', 'GLU_EXTENSIONS', 'GLU_INVALID_ENUM',
+'GLU_INVALID_VALUE', 'GLU_OUT_OF_MEMORY', 'GLU_INCOMPATIBLE_GL_VERSION',
+'GLU_INVALID_OPERATION', 'GLU_OUTLINE_POLYGON', 'GLU_OUTLINE_PATCH',
+'GLU_NURBS_ERROR', 'GLU_ERROR', 'GLU_NURBS_BEGIN', 'GLU_NURBS_BEGIN_EXT',
+'GLU_NURBS_VERTEX', 'GLU_NURBS_VERTEX_EXT', 'GLU_NURBS_NORMAL',
+'GLU_NURBS_NORMAL_EXT', 'GLU_NURBS_COLOR', 'GLU_NURBS_COLOR_EXT',
+'GLU_NURBS_TEXTURE_COORD', 'GLU_NURBS_TEX_COORD_EXT', 'GLU_NURBS_END',
+'GLU_NURBS_END_EXT', 'GLU_NURBS_BEGIN_DATA', 'GLU_NURBS_BEGIN_DATA_EXT',
+'GLU_NURBS_VERTEX_DATA', 'GLU_NURBS_VERTEX_DATA_EXT', 'GLU_NURBS_NORMAL_DATA',
+'GLU_NURBS_NORMAL_DATA_EXT', 'GLU_NURBS_COLOR_DATA',
+'GLU_NURBS_COLOR_DATA_EXT', 'GLU_NURBS_TEXTURE_COORD_DATA',
+'GLU_NURBS_TEX_COORD_DATA_EXT', 'GLU_NURBS_END_DATA',
+'GLU_NURBS_END_DATA_EXT', 'GLU_NURBS_ERROR1', 'GLU_NURBS_ERROR2',
+'GLU_NURBS_ERROR3', 'GLU_NURBS_ERROR4', 'GLU_NURBS_ERROR5',
+'GLU_NURBS_ERROR6', 'GLU_NURBS_ERROR7', 'GLU_NURBS_ERROR8',
+'GLU_NURBS_ERROR9', 'GLU_NURBS_ERROR10', 'GLU_NURBS_ERROR11',
+'GLU_NURBS_ERROR12', 'GLU_NURBS_ERROR13', 'GLU_NURBS_ERROR14',
+'GLU_NURBS_ERROR15', 'GLU_NURBS_ERROR16', 'GLU_NURBS_ERROR17',
+'GLU_NURBS_ERROR18', 'GLU_NURBS_ERROR19', 'GLU_NURBS_ERROR20',
+'GLU_NURBS_ERROR21', 'GLU_NURBS_ERROR22', 'GLU_NURBS_ERROR23',
+'GLU_NURBS_ERROR24', 'GLU_NURBS_ERROR25', 'GLU_NURBS_ERROR26',
+'GLU_NURBS_ERROR27', 'GLU_NURBS_ERROR28', 'GLU_NURBS_ERROR29',
+'GLU_NURBS_ERROR30', 'GLU_NURBS_ERROR31', 'GLU_NURBS_ERROR32',
+'GLU_NURBS_ERROR33', 'GLU_NURBS_ERROR34', 'GLU_NURBS_ERROR35',
+'GLU_NURBS_ERROR36', 'GLU_NURBS_ERROR37', 'GLU_AUTO_LOAD_MATRIX',
+'GLU_CULLING', 'GLU_SAMPLING_TOLERANCE', 'GLU_DISPLAY_MODE',
+'GLU_PARAMETRIC_TOLERANCE', 'GLU_SAMPLING_METHOD', 'GLU_U_STEP', 'GLU_V_STEP',
+'GLU_NURBS_MODE', 'GLU_NURBS_MODE_EXT', 'GLU_NURBS_TESSELLATOR',
+'GLU_NURBS_TESSELLATOR_EXT', 'GLU_NURBS_RENDERER', 'GLU_NURBS_RENDERER_EXT',
+'GLU_OBJECT_PARAMETRIC_ERROR', 'GLU_OBJECT_PARAMETRIC_ERROR_EXT',
+'GLU_OBJECT_PATH_LENGTH', 'GLU_OBJECT_PATH_LENGTH_EXT', 'GLU_PATH_LENGTH',
+'GLU_PARAMETRIC_ERROR', 'GLU_DOMAIN_DISTANCE', 'GLU_MAP1_TRIM_2',
+'GLU_MAP1_TRIM_3', 'GLU_POINT', 'GLU_LINE', 'GLU_FILL', 'GLU_SILHOUETTE',
+'GLU_SMOOTH', 'GLU_FLAT', 'GLU_NONE', 'GLU_OUTSIDE', 'GLU_INSIDE',
+'GLU_TESS_BEGIN', 'GLU_BEGIN', 'GLU_TESS_VERTEX', 'GLU_VERTEX',
+'GLU_TESS_END', 'GLU_END', 'GLU_TESS_ERROR', 'GLU_TESS_EDGE_FLAG',
+'GLU_EDGE_FLAG', 'GLU_TESS_COMBINE', 'GLU_TESS_BEGIN_DATA',
+'GLU_TESS_VERTEX_DATA', 'GLU_TESS_END_DATA', 'GLU_TESS_ERROR_DATA',
+'GLU_TESS_EDGE_FLAG_DATA', 'GLU_TESS_COMBINE_DATA', 'GLU_CW', 'GLU_CCW',
+'GLU_INTERIOR', 'GLU_EXTERIOR', 'GLU_UNKNOWN', 'GLU_TESS_WINDING_RULE',
+'GLU_TESS_BOUNDARY_ONLY', 'GLU_TESS_TOLERANCE', 'GLU_TESS_ERROR1',
+'GLU_TESS_ERROR2', 'GLU_TESS_ERROR3', 'GLU_TESS_ERROR4', 'GLU_TESS_ERROR5',
+'GLU_TESS_ERROR6', 'GLU_TESS_ERROR7', 'GLU_TESS_ERROR8',
+'GLU_TESS_MISSING_BEGIN_POLYGON', 'GLU_TESS_MISSING_BEGIN_CONTOUR',
+'GLU_TESS_MISSING_END_POLYGON', 'GLU_TESS_MISSING_END_CONTOUR',
+'GLU_TESS_COORD_TOO_LARGE', 'GLU_TESS_NEED_COMBINE_CALLBACK',
+'GLU_TESS_WINDING_ODD', 'GLU_TESS_WINDING_NONZERO',
+'GLU_TESS_WINDING_POSITIVE', 'GLU_TESS_WINDING_NEGATIVE',
+'GLU_TESS_WINDING_ABS_GEQ_TWO', 'GLUnurbs', 'GLUquadric', 'GLUtesselator',
+'GLUnurbsObj', 'GLUquadricObj', 'GLUtesselatorObj', 'GLUtriangulatorObj',
+'GLU_TESS_MAX_COORD', '_GLUfuncptr', 'gluBeginCurve', 'gluBeginPolygon',
+'gluBeginSurface', 'gluBeginTrim', 'gluBuild1DMipmapLevels',
+'gluBuild1DMipmaps', 'gluBuild2DMipmapLevels', 'gluBuild2DMipmaps',
+'gluBuild3DMipmapLevels', 'gluBuild3DMipmaps', 'gluCheckExtension',
+'gluCylinder', 'gluDeleteNurbsRenderer', 'gluDeleteQuadric', 'gluDeleteTess',
+'gluDisk', 'gluEndCurve', 'gluEndPolygon', 'gluEndSurface', 'gluEndTrim',
+'gluErrorString', 'gluGetNurbsProperty', 'gluGetString', 'gluGetTessProperty',
+'gluLoadSamplingMatrices', 'gluLookAt', 'gluNewNurbsRenderer',
+'gluNewQuadric', 'gluNewTess', 'gluNextContour', 'gluNurbsCallback',
+'gluNurbsCallbackData', 'gluNurbsCallbackDataEXT', 'gluNurbsCurve',
+'gluNurbsProperty', 'gluNurbsSurface', 'gluOrtho2D', 'gluPartialDisk',
+'gluPerspective', 'gluPickMatrix', 'gluProject', 'gluPwlCurve',
+'gluQuadricCallback', 'gluQuadricDrawStyle', 'gluQuadricNormals',
+'gluQuadricOrientation', 'gluQuadricTexture', 'gluScaleImage', 'gluSphere',
+'gluTessBeginContour', 'gluTessBeginPolygon', 'gluTessCallback',
+'gluTessEndContour', 'gluTessEndPolygon', 'gluTessNormal', 'gluTessProperty',
+'gluTessVertex', 'gluUnProject', 'gluUnProject4']
+# END GENERATED CONTENT (do not edit above this line)
+
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glu_info.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glu_info.py
new file mode 100644
index 0000000..8b14913
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glu_info.py
@@ -0,0 +1,162 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Information about version and extensions of current GLU implementation.
+
+Usage::
+
+ from pyglet.gl import glu_info
+
+ if glu_info.have_extension('GLU_EXT_nurbs_tessellator'):
+ # ...
+
+If multiple contexts are in use you can use a separate GLUInfo object for each
+context. Call `set_active_context` after switching to the desired context for
+each GLUInfo::
+
+ from pyglet.gl.glu_info import GLUInfo
+
+ info = GLUInfo()
+ info.set_active_context()
+ if info.have_version(1, 3):
+ # ...
+
+Note that GLUInfo only returns meaningful information if a context has been
+created.
+'''
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+from ctypes import *
+import warnings
+
+from pyglet.gl.glu import *
+from pyglet.compat import asstr
+
+class GLUInfo(object):
+ '''Information interface for the GLU library.
+
+ A default instance is created automatically when the first OpenGL context
+ is created. You can use the module functions as a convenience for
+ this default instance's methods.
+
+ If you are using more than one context, you must call `set_active_context`
+ when the context is active for this `GLUInfo` instance.
+ '''
+ have_context = False
+ version = '0.0.0'
+ extensions = []
+
+ _have_info = False
+
+ def set_active_context(self):
+ '''Store information for the currently active context.
+
+ This method is called automatically for the default context.
+ '''
+ self.have_context = True
+ if not self._have_info:
+ self.extensions = \
+ asstr(cast(gluGetString(GLU_EXTENSIONS), c_char_p).value).split()
+ self.version = asstr(cast(gluGetString(GLU_VERSION), c_char_p).value)
+ self._have_info = True
+
+ def have_version(self, major, minor=0, release=0):
+ '''Determine if a version of GLU is supported.
+
+ :Parameters:
+ `major` : int
+ The major revision number (typically 1).
+ `minor` : int
+ The minor revision number.
+ `release` : int
+ The release number.
+
+ :rtype: bool
+ :return: True if the requested or a later version is supported.
+ '''
+ if not self.have_context:
+ warnings.warn('No GL context created yet.')
+ ver = '%s.0.0' % self.version.split(' ', 1)[0]
+ imajor, iminor, irelease = [int(v) for v in ver.split('.', 3)[:3]]
+ return imajor > major or \
+ (imajor == major and iminor > minor) or \
+ (imajor == major and iminor == minor and irelease >= release)
+
+ def get_version(self):
+ '''Get the current GLU version.
+
+ :return: the GLU version
+ :rtype: str
+ '''
+ if not self.have_context:
+ warnings.warn('No GL context created yet.')
+ return self.version
+
+ def have_extension(self, extension):
+ '''Determine if a GLU extension is available.
+
+ :Parameters:
+ `extension` : str
+ The name of the extension to test for, including its
+ ``GLU_`` prefix.
+
+ :return: True if the extension is provided by the implementation.
+ :rtype: bool
+ '''
+ if not self.have_context:
+ warnings.warn('No GL context created yet.')
+ return extension in self.extensions
+
+ def get_extensions(self):
+ '''Get a list of available GLU extensions.
+
+ :return: a list of the available extensions.
+ :rtype: list of str
+ '''
+ if not self.have_context:
+ warnings.warn('No GL context created yet.')
+ return self.extensions
+
+# Single instance useful for apps with only a single context (or all contexts
+# have same GLU driver, common case).
+_glu_info = GLUInfo()
+
+set_active_context = _glu_info.set_active_context
+have_version = _glu_info.have_version
+get_version = _glu_info.get_version
+have_extension = _glu_info.have_extension
+get_extensions = _glu_info.get_extensions
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glx.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glx.py
new file mode 100644
index 0000000..9ef4552
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glx.py
@@ -0,0 +1,624 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+'''Wrapper for /usr/include/GL/glx.h
+
+Do not modify generated portions of this file.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+from ctypes import *
+from pyglet.gl.lib import link_GLX as _link_function
+from pyglet.gl.lib import c_ptrdiff_t, c_void
+
+if not _link_function:
+ raise ImportError('libGL.so is not available.')
+
+# BEGIN GENERATED CONTENT (do not edit below this line)
+
+# This content is generated by tools/gengl.py.
+# Wrapper for /usr/include/GL/glx.h
+
+import pyglet.libs.x11.xlib
+
+# H (/usr/include/GL/glx.h:26)
+GLX_VERSION_1_1 = 1 # /usr/include/GL/glx.h:58
+GLX_VERSION_1_2 = 1 # /usr/include/GL/glx.h:59
+GLX_VERSION_1_3 = 1 # /usr/include/GL/glx.h:60
+GLX_VERSION_1_4 = 1 # /usr/include/GL/glx.h:61
+GLX_USE_GL = 1 # /usr/include/GL/glx.h:70
+GLX_BUFFER_SIZE = 2 # /usr/include/GL/glx.h:71
+GLX_LEVEL = 3 # /usr/include/GL/glx.h:72
+GLX_RGBA = 4 # /usr/include/GL/glx.h:73
+GLX_DOUBLEBUFFER = 5 # /usr/include/GL/glx.h:74
+GLX_STEREO = 6 # /usr/include/GL/glx.h:75
+GLX_AUX_BUFFERS = 7 # /usr/include/GL/glx.h:76
+GLX_RED_SIZE = 8 # /usr/include/GL/glx.h:77
+GLX_GREEN_SIZE = 9 # /usr/include/GL/glx.h:78
+GLX_BLUE_SIZE = 10 # /usr/include/GL/glx.h:79
+GLX_ALPHA_SIZE = 11 # /usr/include/GL/glx.h:80
+GLX_DEPTH_SIZE = 12 # /usr/include/GL/glx.h:81
+GLX_STENCIL_SIZE = 13 # /usr/include/GL/glx.h:82
+GLX_ACCUM_RED_SIZE = 14 # /usr/include/GL/glx.h:83
+GLX_ACCUM_GREEN_SIZE = 15 # /usr/include/GL/glx.h:84
+GLX_ACCUM_BLUE_SIZE = 16 # /usr/include/GL/glx.h:85
+GLX_ACCUM_ALPHA_SIZE = 17 # /usr/include/GL/glx.h:86
+GLX_BAD_SCREEN = 1 # /usr/include/GL/glx.h:92
+GLX_BAD_ATTRIBUTE = 2 # /usr/include/GL/glx.h:93
+GLX_NO_EXTENSION = 3 # /usr/include/GL/glx.h:94
+GLX_BAD_VISUAL = 4 # /usr/include/GL/glx.h:95
+GLX_BAD_CONTEXT = 5 # /usr/include/GL/glx.h:96
+GLX_BAD_VALUE = 6 # /usr/include/GL/glx.h:97
+GLX_BAD_ENUM = 7 # /usr/include/GL/glx.h:98
+GLX_VENDOR = 1 # /usr/include/GL/glx.h:104
+GLX_VERSION = 2 # /usr/include/GL/glx.h:105
+GLX_EXTENSIONS = 3 # /usr/include/GL/glx.h:106
+GLX_CONFIG_CAVEAT = 32 # /usr/include/GL/glx.h:112
+GLX_DONT_CARE = 4294967295 # /usr/include/GL/glx.h:113
+GLX_X_VISUAL_TYPE = 34 # /usr/include/GL/glx.h:114
+GLX_TRANSPARENT_TYPE = 35 # /usr/include/GL/glx.h:115
+GLX_TRANSPARENT_INDEX_VALUE = 36 # /usr/include/GL/glx.h:116
+GLX_TRANSPARENT_RED_VALUE = 37 # /usr/include/GL/glx.h:117
+GLX_TRANSPARENT_GREEN_VALUE = 38 # /usr/include/GL/glx.h:118
+GLX_TRANSPARENT_BLUE_VALUE = 39 # /usr/include/GL/glx.h:119
+GLX_TRANSPARENT_ALPHA_VALUE = 40 # /usr/include/GL/glx.h:120
+GLX_WINDOW_BIT = 1 # /usr/include/GL/glx.h:121
+GLX_PIXMAP_BIT = 2 # /usr/include/GL/glx.h:122
+GLX_PBUFFER_BIT = 4 # /usr/include/GL/glx.h:123
+GLX_AUX_BUFFERS_BIT = 16 # /usr/include/GL/glx.h:124
+GLX_FRONT_LEFT_BUFFER_BIT = 1 # /usr/include/GL/glx.h:125
+GLX_FRONT_RIGHT_BUFFER_BIT = 2 # /usr/include/GL/glx.h:126
+GLX_BACK_LEFT_BUFFER_BIT = 4 # /usr/include/GL/glx.h:127
+GLX_BACK_RIGHT_BUFFER_BIT = 8 # /usr/include/GL/glx.h:128
+GLX_DEPTH_BUFFER_BIT = 32 # /usr/include/GL/glx.h:129
+GLX_STENCIL_BUFFER_BIT = 64 # /usr/include/GL/glx.h:130
+GLX_ACCUM_BUFFER_BIT = 128 # /usr/include/GL/glx.h:131
+GLX_NONE = 32768 # /usr/include/GL/glx.h:132
+GLX_SLOW_CONFIG = 32769 # /usr/include/GL/glx.h:133
+GLX_TRUE_COLOR = 32770 # /usr/include/GL/glx.h:134
+GLX_DIRECT_COLOR = 32771 # /usr/include/GL/glx.h:135
+GLX_PSEUDO_COLOR = 32772 # /usr/include/GL/glx.h:136
+GLX_STATIC_COLOR = 32773 # /usr/include/GL/glx.h:137
+GLX_GRAY_SCALE = 32774 # /usr/include/GL/glx.h:138
+GLX_STATIC_GRAY = 32775 # /usr/include/GL/glx.h:139
+GLX_TRANSPARENT_RGB = 32776 # /usr/include/GL/glx.h:140
+GLX_TRANSPARENT_INDEX = 32777 # /usr/include/GL/glx.h:141
+GLX_VISUAL_ID = 32779 # /usr/include/GL/glx.h:142
+GLX_SCREEN = 32780 # /usr/include/GL/glx.h:143
+GLX_NON_CONFORMANT_CONFIG = 32781 # /usr/include/GL/glx.h:144
+GLX_DRAWABLE_TYPE = 32784 # /usr/include/GL/glx.h:145
+GLX_RENDER_TYPE = 32785 # /usr/include/GL/glx.h:146
+GLX_X_RENDERABLE = 32786 # /usr/include/GL/glx.h:147
+GLX_FBCONFIG_ID = 32787 # /usr/include/GL/glx.h:148
+GLX_RGBA_TYPE = 32788 # /usr/include/GL/glx.h:149
+GLX_COLOR_INDEX_TYPE = 32789 # /usr/include/GL/glx.h:150
+GLX_MAX_PBUFFER_WIDTH = 32790 # /usr/include/GL/glx.h:151
+GLX_MAX_PBUFFER_HEIGHT = 32791 # /usr/include/GL/glx.h:152
+GLX_MAX_PBUFFER_PIXELS = 32792 # /usr/include/GL/glx.h:153
+GLX_PRESERVED_CONTENTS = 32795 # /usr/include/GL/glx.h:154
+GLX_LARGEST_PBUFFER = 32796 # /usr/include/GL/glx.h:155
+GLX_WIDTH = 32797 # /usr/include/GL/glx.h:156
+GLX_HEIGHT = 32798 # /usr/include/GL/glx.h:157
+GLX_EVENT_MASK = 32799 # /usr/include/GL/glx.h:158
+GLX_DAMAGED = 32800 # /usr/include/GL/glx.h:159
+GLX_SAVED = 32801 # /usr/include/GL/glx.h:160
+GLX_WINDOW = 32802 # /usr/include/GL/glx.h:161
+GLX_PBUFFER = 32803 # /usr/include/GL/glx.h:162
+GLX_PBUFFER_HEIGHT = 32832 # /usr/include/GL/glx.h:163
+GLX_PBUFFER_WIDTH = 32833 # /usr/include/GL/glx.h:164
+GLX_RGBA_BIT = 1 # /usr/include/GL/glx.h:165
+GLX_COLOR_INDEX_BIT = 2 # /usr/include/GL/glx.h:166
+GLX_PBUFFER_CLOBBER_MASK = 134217728 # /usr/include/GL/glx.h:167
+GLX_SAMPLE_BUFFERS = 100000 # /usr/include/GL/glx.h:173
+GLX_SAMPLES = 100001 # /usr/include/GL/glx.h:174
+class struct___GLXcontextRec(Structure):
+ __slots__ = [
+ ]
+struct___GLXcontextRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct___GLXcontextRec(Structure):
+ __slots__ = [
+ ]
+struct___GLXcontextRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+GLXContext = POINTER(struct___GLXcontextRec) # /usr/include/GL/glx.h:178
+XID = pyglet.libs.x11.xlib.XID
+GLXPixmap = XID # /usr/include/GL/glx.h:179
+GLXDrawable = XID # /usr/include/GL/glx.h:180
+class struct___GLXFBConfigRec(Structure):
+ __slots__ = [
+ ]
+struct___GLXFBConfigRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct___GLXFBConfigRec(Structure):
+ __slots__ = [
+ ]
+struct___GLXFBConfigRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+GLXFBConfig = POINTER(struct___GLXFBConfigRec) # /usr/include/GL/glx.h:182
+GLXFBConfigID = XID # /usr/include/GL/glx.h:183
+GLXContextID = XID # /usr/include/GL/glx.h:184
+GLXWindow = XID # /usr/include/GL/glx.h:185
+GLXPbuffer = XID # /usr/include/GL/glx.h:186
+XVisualInfo = pyglet.libs.x11.xlib.XVisualInfo
+Display = pyglet.libs.x11.xlib.Display
+# /usr/include/GL/glx.h:190
+glXChooseVisual = _link_function('glXChooseVisual', POINTER(XVisualInfo), [POINTER(Display), c_int, POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:193
+glXCreateContext = _link_function('glXCreateContext', GLXContext, [POINTER(Display), POINTER(XVisualInfo), GLXContext, c_int], 'H')
+
+# /usr/include/GL/glx.h:196
+glXDestroyContext = _link_function('glXDestroyContext', None, [POINTER(Display), GLXContext], 'H')
+
+# /usr/include/GL/glx.h:198
+glXMakeCurrent = _link_function('glXMakeCurrent', c_int, [POINTER(Display), GLXDrawable, GLXContext], 'H')
+
+# /usr/include/GL/glx.h:201
+glXCopyContext = _link_function('glXCopyContext', None, [POINTER(Display), GLXContext, GLXContext, c_ulong], 'H')
+
+# /usr/include/GL/glx.h:204
+glXSwapBuffers = _link_function('glXSwapBuffers', None, [POINTER(Display), GLXDrawable], 'H')
+
+Pixmap = pyglet.libs.x11.xlib.Pixmap
+# /usr/include/GL/glx.h:206
+glXCreateGLXPixmap = _link_function('glXCreateGLXPixmap', GLXPixmap, [POINTER(Display), POINTER(XVisualInfo), Pixmap], 'H')
+
+# /usr/include/GL/glx.h:209
+glXDestroyGLXPixmap = _link_function('glXDestroyGLXPixmap', None, [POINTER(Display), GLXPixmap], 'H')
+
+# /usr/include/GL/glx.h:211
+glXQueryExtension = _link_function('glXQueryExtension', c_int, [POINTER(Display), POINTER(c_int), POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:213
+glXQueryVersion = _link_function('glXQueryVersion', c_int, [POINTER(Display), POINTER(c_int), POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:215
+glXIsDirect = _link_function('glXIsDirect', c_int, [POINTER(Display), GLXContext], 'H')
+
+# /usr/include/GL/glx.h:217
+glXGetConfig = _link_function('glXGetConfig', c_int, [POINTER(Display), POINTER(XVisualInfo), c_int, POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:220
+glXGetCurrentContext = _link_function('glXGetCurrentContext', GLXContext, [], 'H')
+
+# /usr/include/GL/glx.h:222
+glXGetCurrentDrawable = _link_function('glXGetCurrentDrawable', GLXDrawable, [], 'H')
+
+# /usr/include/GL/glx.h:224
+glXWaitGL = _link_function('glXWaitGL', None, [], 'H')
+
+# /usr/include/GL/glx.h:226
+glXWaitX = _link_function('glXWaitX', None, [], 'H')
+
+Font = pyglet.libs.x11.xlib.Font
+# /usr/include/GL/glx.h:228
+glXUseXFont = _link_function('glXUseXFont', None, [Font, c_int, c_int, c_int], 'H')
+
+# /usr/include/GL/glx.h:233
+glXQueryExtensionsString = _link_function('glXQueryExtensionsString', c_char_p, [POINTER(Display), c_int], 'H')
+
+# /usr/include/GL/glx.h:235
+glXQueryServerString = _link_function('glXQueryServerString', c_char_p, [POINTER(Display), c_int, c_int], 'H')
+
+# /usr/include/GL/glx.h:237
+glXGetClientString = _link_function('glXGetClientString', c_char_p, [POINTER(Display), c_int], 'H')
+
+# /usr/include/GL/glx.h:241
+glXGetCurrentDisplay = _link_function('glXGetCurrentDisplay', POINTER(Display), [], 'H')
+
+# /usr/include/GL/glx.h:245
+glXChooseFBConfig = _link_function('glXChooseFBConfig', POINTER(GLXFBConfig), [POINTER(Display), c_int, POINTER(c_int), POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:248
+glXGetFBConfigAttrib = _link_function('glXGetFBConfigAttrib', c_int, [POINTER(Display), GLXFBConfig, c_int, POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:251
+glXGetFBConfigs = _link_function('glXGetFBConfigs', POINTER(GLXFBConfig), [POINTER(Display), c_int, POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:254
+glXGetVisualFromFBConfig = _link_function('glXGetVisualFromFBConfig', POINTER(XVisualInfo), [POINTER(Display), GLXFBConfig], 'H')
+
+Window = pyglet.libs.x11.xlib.Window
+# /usr/include/GL/glx.h:257
+glXCreateWindow = _link_function('glXCreateWindow', GLXWindow, [POINTER(Display), GLXFBConfig, Window, POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:260
+glXDestroyWindow = _link_function('glXDestroyWindow', None, [POINTER(Display), GLXWindow], 'H')
+
+# /usr/include/GL/glx.h:262
+glXCreatePixmap = _link_function('glXCreatePixmap', GLXPixmap, [POINTER(Display), GLXFBConfig, Pixmap, POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:265
+glXDestroyPixmap = _link_function('glXDestroyPixmap', None, [POINTER(Display), GLXPixmap], 'H')
+
+# /usr/include/GL/glx.h:267
+glXCreatePbuffer = _link_function('glXCreatePbuffer', GLXPbuffer, [POINTER(Display), GLXFBConfig, POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:270
+glXDestroyPbuffer = _link_function('glXDestroyPbuffer', None, [POINTER(Display), GLXPbuffer], 'H')
+
+# /usr/include/GL/glx.h:272
+glXQueryDrawable = _link_function('glXQueryDrawable', None, [POINTER(Display), GLXDrawable, c_int, POINTER(c_uint)], 'H')
+
+# /usr/include/GL/glx.h:275
+glXCreateNewContext = _link_function('glXCreateNewContext', GLXContext, [POINTER(Display), GLXFBConfig, c_int, GLXContext, c_int], 'H')
+
+# /usr/include/GL/glx.h:279
+glXMakeContextCurrent = _link_function('glXMakeContextCurrent', c_int, [POINTER(Display), GLXDrawable, GLXDrawable, GLXContext], 'H')
+
+# /usr/include/GL/glx.h:282
+glXGetCurrentReadDrawable = _link_function('glXGetCurrentReadDrawable', GLXDrawable, [], 'H')
+
+# /usr/include/GL/glx.h:284
+glXQueryContext = _link_function('glXQueryContext', c_int, [POINTER(Display), GLXContext, c_int, POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:287
+glXSelectEvent = _link_function('glXSelectEvent', None, [POINTER(Display), GLXDrawable, c_ulong], 'H')
+
+# /usr/include/GL/glx.h:290
+glXGetSelectedEvent = _link_function('glXGetSelectedEvent', None, [POINTER(Display), GLXDrawable, POINTER(c_ulong)], 'H')
+
+PFNGLXGETFBCONFIGSPROC = CFUNCTYPE(POINTER(GLXFBConfig), POINTER(Display), c_int, POINTER(c_int)) # /usr/include/GL/glx.h:294
+PFNGLXCHOOSEFBCONFIGPROC = CFUNCTYPE(POINTER(GLXFBConfig), POINTER(Display), c_int, POINTER(c_int), POINTER(c_int)) # /usr/include/GL/glx.h:295
+PFNGLXGETFBCONFIGATTRIBPROC = CFUNCTYPE(c_int, POINTER(Display), GLXFBConfig, c_int, POINTER(c_int)) # /usr/include/GL/glx.h:296
+PFNGLXGETVISUALFROMFBCONFIGPROC = CFUNCTYPE(POINTER(XVisualInfo), POINTER(Display), GLXFBConfig) # /usr/include/GL/glx.h:297
+PFNGLXCREATEWINDOWPROC = CFUNCTYPE(GLXWindow, POINTER(Display), GLXFBConfig, Window, POINTER(c_int)) # /usr/include/GL/glx.h:298
+PFNGLXDESTROYWINDOWPROC = CFUNCTYPE(None, POINTER(Display), GLXWindow) # /usr/include/GL/glx.h:299
+PFNGLXCREATEPIXMAPPROC = CFUNCTYPE(GLXPixmap, POINTER(Display), GLXFBConfig, Pixmap, POINTER(c_int)) # /usr/include/GL/glx.h:300
+PFNGLXDESTROYPIXMAPPROC = CFUNCTYPE(None, POINTER(Display), GLXPixmap) # /usr/include/GL/glx.h:301
+PFNGLXCREATEPBUFFERPROC = CFUNCTYPE(GLXPbuffer, POINTER(Display), GLXFBConfig, POINTER(c_int)) # /usr/include/GL/glx.h:302
+PFNGLXDESTROYPBUFFERPROC = CFUNCTYPE(None, POINTER(Display), GLXPbuffer) # /usr/include/GL/glx.h:303
+PFNGLXQUERYDRAWABLEPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_int, POINTER(c_uint)) # /usr/include/GL/glx.h:304
+PFNGLXCREATENEWCONTEXTPROC = CFUNCTYPE(GLXContext, POINTER(Display), GLXFBConfig, c_int, GLXContext, c_int) # /usr/include/GL/glx.h:305
+PFNGLXMAKECONTEXTCURRENTPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, GLXDrawable, GLXContext) # /usr/include/GL/glx.h:306
+PFNGLXGETCURRENTREADDRAWABLEPROC = CFUNCTYPE(GLXDrawable) # /usr/include/GL/glx.h:307
+PFNGLXGETCURRENTDISPLAYPROC = CFUNCTYPE(POINTER(Display)) # /usr/include/GL/glx.h:308
+PFNGLXQUERYCONTEXTPROC = CFUNCTYPE(c_int, POINTER(Display), GLXContext, c_int, POINTER(c_int)) # /usr/include/GL/glx.h:309
+PFNGLXSELECTEVENTPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_ulong) # /usr/include/GL/glx.h:310
+PFNGLXGETSELECTEDEVENTPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, POINTER(c_ulong)) # /usr/include/GL/glx.h:311
+# ARB_get_proc_address (/usr/include/GL/glx.h:317)
+GLX_ARB_get_proc_address = 1 # /usr/include/GL/glx.h:318
+__GLXextFuncPtr = CFUNCTYPE(None) # /usr/include/GL/glx.h:320
+GLubyte = c_ubyte # /usr/include/GL/gl.h:160
+# /usr/include/GL/glx.h:321
+glXGetProcAddressARB = _link_function('glXGetProcAddressARB', __GLXextFuncPtr, [POINTER(GLubyte)], 'ARB_get_proc_address')
+
+# /usr/include/GL/glx.h:328
+glXGetProcAddress = _link_function('glXGetProcAddress', POINTER(CFUNCTYPE(None)), [POINTER(GLubyte)], 'ARB_get_proc_address')
+
+PFNGLXGETPROCADDRESSPROC = CFUNCTYPE(__GLXextFuncPtr, POINTER(GLubyte)) # /usr/include/GL/glx.h:331
+# GLXEXT_LEGACY (/usr/include/GL/glx.h:334)
+# VERSION_1_3 (/usr/include/GL/glxext.h:55)
+# VERSION_1_4 (/usr/include/GL/glxext.h:114)
+# ARB_get_proc_address (/usr/include/GL/glxext.h:119)
+# ARB_multisample (/usr/include/GL/glxext.h:122)
+# ARB_fbconfig_float (/usr/include/GL/glxext.h:127)
+# ARB_create_context (/usr/include/GL/glxext.h:132)
+# ARB_create_context_profile (/usr/include/GL/glxext.h:140)
+# SGIS_multisample (/usr/include/GL/glxext.h:146)
+# EXT_visual_info (/usr/include/GL/glxext.h:151)
+# SGI_swap_control (/usr/include/GL/glxext.h:170)
+# SGI_video_sync (/usr/include/GL/glxext.h:173)
+# SGI_make_current_read (/usr/include/GL/glxext.h:176)
+# SGIX_video_source (/usr/include/GL/glxext.h:179)
+# EXT_visual_rating (/usr/include/GL/glxext.h:182)
+# EXT_import_context (/usr/include/GL/glxext.h:189)
+# SGIX_fbconfig (/usr/include/GL/glxext.h:195)
+# SGIX_pbuffer (/usr/include/GL/glxext.h:209)
+# SGI_cushion (/usr/include/GL/glxext.h:237)
+# SGIX_video_resize (/usr/include/GL/glxext.h:240)
+# SGIX_dmbuffer (/usr/include/GL/glxext.h:245)
+# SGIX_swap_group (/usr/include/GL/glxext.h:249)
+# SGIX_swap_barrier (/usr/include/GL/glxext.h:252)
+# SGIS_blended_overlay (/usr/include/GL/glxext.h:255)
+# SGIS_shared_multisample (/usr/include/GL/glxext.h:259)
+# SUN_get_transparent_index (/usr/include/GL/glxext.h:264)
+# 3DFX_multisample (/usr/include/GL/glxext.h:267)
+# MESA_copy_sub_buffer (/usr/include/GL/glxext.h:272)
+# MESA_pixmap_colormap (/usr/include/GL/glxext.h:275)
+# MESA_release_buffers (/usr/include/GL/glxext.h:278)
+# MESA_set_3dfx_mode (/usr/include/GL/glxext.h:281)
+# SGIX_visual_select_group (/usr/include/GL/glxext.h:286)
+# OML_swap_method (/usr/include/GL/glxext.h:290)
+# OML_sync_control (/usr/include/GL/glxext.h:297)
+# NV_float_buffer (/usr/include/GL/glxext.h:300)
+# SGIX_hyperpipe (/usr/include/GL/glxext.h:304)
+# MESA_agp_offset (/usr/include/GL/glxext.h:317)
+# EXT_fbconfig_packed_float (/usr/include/GL/glxext.h:320)
+# EXT_framebuffer_sRGB (/usr/include/GL/glxext.h:325)
+# EXT_texture_from_pixmap (/usr/include/GL/glxext.h:329)
+# NV_present_video (/usr/include/GL/glxext.h:365)
+# NV_video_out (/usr/include/GL/glxext.h:369)
+# NV_swap_group (/usr/include/GL/glxext.h:382)
+# NV_video_capture (/usr/include/GL/glxext.h:385)
+# EXT_swap_control (/usr/include/GL/glxext.h:391)
+# NV_copy_image (/usr/include/GL/glxext.h:396)
+# ARB_get_proc_address (/usr/include/GL/glxext.h:402)
+# SGIX_video_source (/usr/include/GL/glxext.h:406)
+# SGIX_fbconfig (/usr/include/GL/glxext.h:410)
+# SGIX_pbuffer (/usr/include/GL/glxext.h:415)
+# NV_video_output (/usr/include/GL/glxext.h:432)
+# NV_video_capture (/usr/include/GL/glxext.h:436)
+# VERSION_1_3 (/usr/include/GL/glxext.h:477)
+# VERSION_1_4 (/usr/include/GL/glxext.h:519)
+# ARB_get_proc_address (/usr/include/GL/glxext.h:527)
+# ARB_multisample (/usr/include/GL/glxext.h:535)
+# ARB_fbconfig_float (/usr/include/GL/glxext.h:539)
+# ARB_create_context (/usr/include/GL/glxext.h:543)
+# ARB_create_context_profile (/usr/include/GL/glxext.h:551)
+# SGIS_multisample (/usr/include/GL/glxext.h:555)
+# EXT_visual_info (/usr/include/GL/glxext.h:559)
+# SGI_swap_control (/usr/include/GL/glxext.h:563)
+# SGI_video_sync (/usr/include/GL/glxext.h:571)
+# SGI_make_current_read (/usr/include/GL/glxext.h:581)
+# SGIX_video_source (/usr/include/GL/glxext.h:591)
+# EXT_visual_rating (/usr/include/GL/glxext.h:603)
+# EXT_import_context (/usr/include/GL/glxext.h:607)
+# SGIX_fbconfig (/usr/include/GL/glxext.h:623)
+# SGIX_pbuffer (/usr/include/GL/glxext.h:641)
+# SGI_cushion (/usr/include/GL/glxext.h:657)
+# SGIX_video_resize (/usr/include/GL/glxext.h:665)
+# SGIX_dmbuffer (/usr/include/GL/glxext.h:681)
+# SGIX_swap_group (/usr/include/GL/glxext.h:691)
+# SGIX_swap_barrier (/usr/include/GL/glxext.h:699)
+# SUN_get_transparent_index (/usr/include/GL/glxext.h:709)
+# MESA_copy_sub_buffer (/usr/include/GL/glxext.h:717)
+# MESA_pixmap_colormap (/usr/include/GL/glxext.h:725)
+# MESA_release_buffers (/usr/include/GL/glxext.h:733)
+# MESA_set_3dfx_mode (/usr/include/GL/glxext.h:741)
+# SGIX_visual_select_group (/usr/include/GL/glxext.h:749)
+# OML_swap_method (/usr/include/GL/glxext.h:753)
+# OML_sync_control (/usr/include/GL/glxext.h:757)
+# NV_float_buffer (/usr/include/GL/glxext.h:773)
+# SGIX_hyperpipe (/usr/include/GL/glxext.h:777)
+# MESA_agp_offset (/usr/include/GL/glxext.h:824)
+# EXT_fbconfig_packed_float (/usr/include/GL/glxext.h:832)
+# EXT_framebuffer_sRGB (/usr/include/GL/glxext.h:836)
+# EXT_texture_from_pixmap (/usr/include/GL/glxext.h:840)
+# NV_present_video (/usr/include/GL/glxext.h:850)
+# NV_video_output (/usr/include/GL/glxext.h:860)
+# NV_swap_group (/usr/include/GL/glxext.h:878)
+# NV_video_capture (/usr/include/GL/glxext.h:896)
+# EXT_swap_control (/usr/include/GL/glxext.h:912)
+# NV_copy_image (/usr/include/GL/glxext.h:920)
+# NV_vertex_array_range (/usr/include/GL/glx.h:349)
+GLsizei = c_int # /usr/include/GL/gl.h:163
+GLfloat = c_float # /usr/include/GL/gl.h:164
+# /usr/include/GL/glx.h:352
+glXAllocateMemoryNV = _link_function('glXAllocateMemoryNV', POINTER(c_void), [GLsizei, GLfloat, GLfloat, GLfloat], 'NV_vertex_array_range')
+
+GLvoid = None # /usr/include/GL/gl.h:156
+# /usr/include/GL/glx.h:353
+glXFreeMemoryNV = _link_function('glXFreeMemoryNV', None, [POINTER(GLvoid)], 'NV_vertex_array_range')
+
+PFNGLXALLOCATEMEMORYNVPROC = CFUNCTYPE(POINTER(c_void), GLsizei, GLfloat, GLfloat, GLfloat) # /usr/include/GL/glx.h:354
+PFNGLXFREEMEMORYNVPROC = CFUNCTYPE(None, POINTER(GLvoid)) # /usr/include/GL/glx.h:355
+# MESA_allocate_memory (/usr/include/GL/glx.h:363)
+GLX_MESA_allocate_memory = 1 # /usr/include/GL/glx.h:364
+# /usr/include/GL/glx.h:366
+glXAllocateMemoryMESA = _link_function('glXAllocateMemoryMESA', POINTER(c_void), [POINTER(Display), c_int, c_size_t, c_float, c_float, c_float], 'MESA_allocate_memory')
+
+# /usr/include/GL/glx.h:367
+glXFreeMemoryMESA = _link_function('glXFreeMemoryMESA', None, [POINTER(Display), c_int, POINTER(None)], 'MESA_allocate_memory')
+
+GLuint = c_uint # /usr/include/GL/gl.h:162
+# /usr/include/GL/glx.h:368
+glXGetMemoryOffsetMESA = _link_function('glXGetMemoryOffsetMESA', GLuint, [POINTER(Display), c_int, POINTER(None)], 'MESA_allocate_memory')
+
+PFNGLXALLOCATEMEMORYMESAPROC = CFUNCTYPE(POINTER(c_void), POINTER(Display), c_int, c_size_t, c_float, c_float, c_float) # /usr/include/GL/glx.h:369
+PFNGLXFREEMEMORYMESAPROC = CFUNCTYPE(None, POINTER(Display), c_int, POINTER(None)) # /usr/include/GL/glx.h:370
+PFNGLXGETMEMORYOFFSETMESAPROC = CFUNCTYPE(GLuint, POINTER(Display), c_int, POINTER(None)) # /usr/include/GL/glx.h:371
+# ARB_render_texture (/usr/include/GL/glx.h:380)
+GLX_ARB_render_texture = 1 # /usr/include/GL/glx.h:381
+# /usr/include/GL/glx.h:383
+glXBindTexImageARB = _link_function('glXBindTexImageARB', c_int, [POINTER(Display), GLXPbuffer, c_int], 'ARB_render_texture')
+
+# /usr/include/GL/glx.h:384
+glXReleaseTexImageARB = _link_function('glXReleaseTexImageARB', c_int, [POINTER(Display), GLXPbuffer, c_int], 'ARB_render_texture')
+
+# /usr/include/GL/glx.h:385
+glXDrawableAttribARB = _link_function('glXDrawableAttribARB', c_int, [POINTER(Display), GLXDrawable, POINTER(c_int)], 'ARB_render_texture')
+
+# NV_float_buffer (/usr/include/GL/glx.h:393)
+# MESA_swap_frame_usage (/usr/include/GL/glx.h:405)
+GLX_MESA_swap_frame_usage = 1 # /usr/include/GL/glx.h:406
+# /usr/include/GL/glx.h:408
+glXGetFrameUsageMESA = _link_function('glXGetFrameUsageMESA', c_int, [POINTER(Display), GLXDrawable, POINTER(c_float)], 'MESA_swap_frame_usage')
+
+# /usr/include/GL/glx.h:409
+glXBeginFrameTrackingMESA = _link_function('glXBeginFrameTrackingMESA', c_int, [POINTER(Display), GLXDrawable], 'MESA_swap_frame_usage')
+
+# /usr/include/GL/glx.h:410
+glXEndFrameTrackingMESA = _link_function('glXEndFrameTrackingMESA', c_int, [POINTER(Display), GLXDrawable], 'MESA_swap_frame_usage')
+
+# /usr/include/GL/glx.h:411
+glXQueryFrameTrackingMESA = _link_function('glXQueryFrameTrackingMESA', c_int, [POINTER(Display), GLXDrawable, POINTER(c_int64), POINTER(c_int64), POINTER(c_float)], 'MESA_swap_frame_usage')
+
+PFNGLXGETFRAMEUSAGEMESAPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, POINTER(c_float)) # /usr/include/GL/glx.h:413
+PFNGLXBEGINFRAMETRACKINGMESAPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable) # /usr/include/GL/glx.h:414
+PFNGLXENDFRAMETRACKINGMESAPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable) # /usr/include/GL/glx.h:415
+PFNGLXQUERYFRAMETRACKINGMESAPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, POINTER(c_int64), POINTER(c_int64), POINTER(c_float)) # /usr/include/GL/glx.h:416
+# MESA_swap_control (/usr/include/GL/glx.h:425)
+GLX_MESA_swap_control = 1 # /usr/include/GL/glx.h:426
+# /usr/include/GL/glx.h:428
+glXSwapIntervalMESA = _link_function('glXSwapIntervalMESA', c_int, [c_uint], 'MESA_swap_control')
+
+# /usr/include/GL/glx.h:429
+glXGetSwapIntervalMESA = _link_function('glXGetSwapIntervalMESA', c_int, [], 'MESA_swap_control')
+
+PFNGLXSWAPINTERVALMESAPROC = CFUNCTYPE(c_int, c_uint) # /usr/include/GL/glx.h:431
+PFNGLXGETSWAPINTERVALMESAPROC = CFUNCTYPE(c_int) # /usr/include/GL/glx.h:432
+# EXT_texture_from_pixmap (/usr/include/GL/glx.h:442)
+class struct_anon_111(Structure):
+ __slots__ = [
+ 'event_type',
+ 'draw_type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'drawable',
+ 'buffer_mask',
+ 'aux_buffer',
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'count',
+ ]
+struct_anon_111._fields_ = [
+ ('event_type', c_int),
+ ('draw_type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('drawable', GLXDrawable),
+ ('buffer_mask', c_uint),
+ ('aux_buffer', c_uint),
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('count', c_int),
+]
+
+GLXPbufferClobberEvent = struct_anon_111 # /usr/include/GL/glx.h:508
+class struct___GLXEvent(Union):
+ __slots__ = [
+ 'glxpbufferclobber',
+ 'pad',
+ ]
+struct___GLXEvent._fields_ = [
+ ('glxpbufferclobber', GLXPbufferClobberEvent),
+ ('pad', c_long * 24),
+]
+
+GLXEvent = struct___GLXEvent # /usr/include/GL/glx.h:513
+
+__all__ = ['GLX_VERSION_1_1', 'GLX_VERSION_1_2', 'GLX_VERSION_1_3',
+'GLX_VERSION_1_4', 'GLX_USE_GL', 'GLX_BUFFER_SIZE', 'GLX_LEVEL', 'GLX_RGBA',
+'GLX_DOUBLEBUFFER', 'GLX_STEREO', 'GLX_AUX_BUFFERS', 'GLX_RED_SIZE',
+'GLX_GREEN_SIZE', 'GLX_BLUE_SIZE', 'GLX_ALPHA_SIZE', 'GLX_DEPTH_SIZE',
+'GLX_STENCIL_SIZE', 'GLX_ACCUM_RED_SIZE', 'GLX_ACCUM_GREEN_SIZE',
+'GLX_ACCUM_BLUE_SIZE', 'GLX_ACCUM_ALPHA_SIZE', 'GLX_BAD_SCREEN',
+'GLX_BAD_ATTRIBUTE', 'GLX_NO_EXTENSION', 'GLX_BAD_VISUAL', 'GLX_BAD_CONTEXT',
+'GLX_BAD_VALUE', 'GLX_BAD_ENUM', 'GLX_VENDOR', 'GLX_VERSION',
+'GLX_EXTENSIONS', 'GLX_CONFIG_CAVEAT', 'GLX_DONT_CARE', 'GLX_X_VISUAL_TYPE',
+'GLX_TRANSPARENT_TYPE', 'GLX_TRANSPARENT_INDEX_VALUE',
+'GLX_TRANSPARENT_RED_VALUE', 'GLX_TRANSPARENT_GREEN_VALUE',
+'GLX_TRANSPARENT_BLUE_VALUE', 'GLX_TRANSPARENT_ALPHA_VALUE', 'GLX_WINDOW_BIT',
+'GLX_PIXMAP_BIT', 'GLX_PBUFFER_BIT', 'GLX_AUX_BUFFERS_BIT',
+'GLX_FRONT_LEFT_BUFFER_BIT', 'GLX_FRONT_RIGHT_BUFFER_BIT',
+'GLX_BACK_LEFT_BUFFER_BIT', 'GLX_BACK_RIGHT_BUFFER_BIT',
+'GLX_DEPTH_BUFFER_BIT', 'GLX_STENCIL_BUFFER_BIT', 'GLX_ACCUM_BUFFER_BIT',
+'GLX_NONE', 'GLX_SLOW_CONFIG', 'GLX_TRUE_COLOR', 'GLX_DIRECT_COLOR',
+'GLX_PSEUDO_COLOR', 'GLX_STATIC_COLOR', 'GLX_GRAY_SCALE', 'GLX_STATIC_GRAY',
+'GLX_TRANSPARENT_RGB', 'GLX_TRANSPARENT_INDEX', 'GLX_VISUAL_ID', 'GLX_SCREEN',
+'GLX_NON_CONFORMANT_CONFIG', 'GLX_DRAWABLE_TYPE', 'GLX_RENDER_TYPE',
+'GLX_X_RENDERABLE', 'GLX_FBCONFIG_ID', 'GLX_RGBA_TYPE',
+'GLX_COLOR_INDEX_TYPE', 'GLX_MAX_PBUFFER_WIDTH', 'GLX_MAX_PBUFFER_HEIGHT',
+'GLX_MAX_PBUFFER_PIXELS', 'GLX_PRESERVED_CONTENTS', 'GLX_LARGEST_PBUFFER',
+'GLX_WIDTH', 'GLX_HEIGHT', 'GLX_EVENT_MASK', 'GLX_DAMAGED', 'GLX_SAVED',
+'GLX_WINDOW', 'GLX_PBUFFER', 'GLX_PBUFFER_HEIGHT', 'GLX_PBUFFER_WIDTH',
+'GLX_RGBA_BIT', 'GLX_COLOR_INDEX_BIT', 'GLX_PBUFFER_CLOBBER_MASK',
+'GLX_SAMPLE_BUFFERS', 'GLX_SAMPLES', 'GLXContext', 'GLXPixmap', 'GLXDrawable',
+'GLXFBConfig', 'GLXFBConfigID', 'GLXContextID', 'GLXWindow', 'GLXPbuffer',
+'glXChooseVisual', 'glXCreateContext', 'glXDestroyContext', 'glXMakeCurrent',
+'glXCopyContext', 'glXSwapBuffers', 'glXCreateGLXPixmap',
+'glXDestroyGLXPixmap', 'glXQueryExtension', 'glXQueryVersion', 'glXIsDirect',
+'glXGetConfig', 'glXGetCurrentContext', 'glXGetCurrentDrawable', 'glXWaitGL',
+'glXWaitX', 'glXUseXFont', 'glXQueryExtensionsString', 'glXQueryServerString',
+'glXGetClientString', 'glXGetCurrentDisplay', 'glXChooseFBConfig',
+'glXGetFBConfigAttrib', 'glXGetFBConfigs', 'glXGetVisualFromFBConfig',
+'glXCreateWindow', 'glXDestroyWindow', 'glXCreatePixmap', 'glXDestroyPixmap',
+'glXCreatePbuffer', 'glXDestroyPbuffer', 'glXQueryDrawable',
+'glXCreateNewContext', 'glXMakeContextCurrent', 'glXGetCurrentReadDrawable',
+'glXQueryContext', 'glXSelectEvent', 'glXGetSelectedEvent',
+'PFNGLXGETFBCONFIGSPROC', 'PFNGLXCHOOSEFBCONFIGPROC',
+'PFNGLXGETFBCONFIGATTRIBPROC', 'PFNGLXGETVISUALFROMFBCONFIGPROC',
+'PFNGLXCREATEWINDOWPROC', 'PFNGLXDESTROYWINDOWPROC', 'PFNGLXCREATEPIXMAPPROC',
+'PFNGLXDESTROYPIXMAPPROC', 'PFNGLXCREATEPBUFFERPROC',
+'PFNGLXDESTROYPBUFFERPROC', 'PFNGLXQUERYDRAWABLEPROC',
+'PFNGLXCREATENEWCONTEXTPROC', 'PFNGLXMAKECONTEXTCURRENTPROC',
+'PFNGLXGETCURRENTREADDRAWABLEPROC', 'PFNGLXGETCURRENTDISPLAYPROC',
+'PFNGLXQUERYCONTEXTPROC', 'PFNGLXSELECTEVENTPROC',
+'PFNGLXGETSELECTEDEVENTPROC', 'GLX_ARB_get_proc_address', '__GLXextFuncPtr',
+'glXGetProcAddressARB', 'glXGetProcAddress', 'PFNGLXGETPROCADDRESSPROC',
+'glXAllocateMemoryNV', 'glXFreeMemoryNV', 'PFNGLXALLOCATEMEMORYNVPROC',
+'PFNGLXFREEMEMORYNVPROC', 'GLX_MESA_allocate_memory', 'glXAllocateMemoryMESA',
+'glXFreeMemoryMESA', 'glXGetMemoryOffsetMESA', 'PFNGLXALLOCATEMEMORYMESAPROC',
+'PFNGLXFREEMEMORYMESAPROC', 'PFNGLXGETMEMORYOFFSETMESAPROC',
+'GLX_ARB_render_texture', 'glXBindTexImageARB', 'glXReleaseTexImageARB',
+'glXDrawableAttribARB', 'GLX_MESA_swap_frame_usage', 'glXGetFrameUsageMESA',
+'glXBeginFrameTrackingMESA', 'glXEndFrameTrackingMESA',
+'glXQueryFrameTrackingMESA', 'PFNGLXGETFRAMEUSAGEMESAPROC',
+'PFNGLXBEGINFRAMETRACKINGMESAPROC', 'PFNGLXENDFRAMETRACKINGMESAPROC',
+'PFNGLXQUERYFRAMETRACKINGMESAPROC', 'GLX_MESA_swap_control',
+'glXSwapIntervalMESA', 'glXGetSwapIntervalMESA', 'PFNGLXSWAPINTERVALMESAPROC',
+'PFNGLXGETSWAPINTERVALMESAPROC', 'GLXPbufferClobberEvent', 'GLXEvent']
+# END GENERATED CONTENT (do not edit above this line)
+
+# From glxproto.h
+GLXBadContext = 0
+GLXBadContextState = 1
+GLXBadDrawable = 2
+GLXBadPixmap = 3
+GLXBadContextTag = 4
+GLXBadCurrentWindow = 5
+GLXBadRenderRequest = 6
+GLXBadLargeRequest = 7
+GLXUnsupportedPrivateRequest = 8
+GLXBadFBConfig = 9
+GLXBadPbuffer = 10
+GLXBadCurrentDrawable = 11
+GLXBadWindow = 12
+
+__all__ += ['GLXBadContext', 'GLXBadContextState', 'GLXBadDrawable',
+'GLXBadPixmap', 'GLXBadContextTag', 'GLXBadCurrentWindow',
+'GLXBadRenderRequest', 'GLXBadLargeRequest', 'GLXUnsupportedPrivateRequest',
+'GLXBadFBConfig', 'GLXBadPbuffer', 'GLXBadCurrentDrawable', 'GLXBadWindow']
+
+
+
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glx_info.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glx_info.py
new file mode 100644
index 0000000..d35bdd4
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glx_info.py
@@ -0,0 +1,148 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Information about version and extensions of current GLX implementation.
+
+Usage::
+
+ from pyglet.gl import glx_info
+
+ if glx_info.have_extension('GLX_NV_float_buffer'):
+ # ...
+
+Or, if using more than one display::
+
+ from pyglet.gl.glx_info import GLXInfo
+
+ info = GLXInfo(window._display)
+ if info.get_server_vendor() == 'ATI':
+ # ...
+
+'''
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+from ctypes import *
+
+from pyglet.gl.glx import *
+from pyglet.compat import asstr
+
+class GLXInfoException(Exception):
+ pass
+
+class GLXInfo(object):
+ def __init__(self, display=None):
+ # Set default display if not set
+ if display and not _glx_info.display:
+ _glx_info.set_display(display)
+
+ self.display = display
+
+ def set_display(self, display):
+ self.display = display
+
+ def check_display(self):
+ if not self.display:
+ raise GLXInfoException('No X11 display has been set yet.')
+
+ def have_version(self, major, minor=0):
+ self.check_display()
+ if not glXQueryExtension(self.display, None, None):
+ raise GLXInfoException('pyglet requires an X server with GLX')
+
+ server_version = self.get_server_version().split()[0]
+ client_version = self.get_client_version().split()[0]
+
+ server = [int(i) for i in server_version.split('.')]
+ client = [int(i) for i in client_version.split('.')]
+ return (tuple(server) >= (major, minor) and
+ tuple(client) >= (major, minor))
+
+ def get_server_vendor(self):
+ self.check_display()
+ return asstr(glXQueryServerString(self.display, 0, GLX_VENDOR))
+
+ def get_server_version(self):
+ # glXQueryServerString was introduced in GLX 1.1, so we need to use the
+ # 1.0 function here which queries the server implementation for its
+ # version.
+ self.check_display()
+ major = c_int()
+ minor = c_int()
+ if not glXQueryVersion(self.display, byref(major), byref(minor)):
+ raise GLXInfoException('Could not determine GLX server version')
+ return '%s.%s'%(major.value, minor.value)
+
+ def get_server_extensions(self):
+ self.check_display()
+ return asstr(glXQueryServerString(self.display, 0, GLX_EXTENSIONS)).split()
+
+ def get_client_vendor(self):
+ self.check_display()
+ return asstr(glXGetClientString(self.display, GLX_VENDOR))
+
+ def get_client_version(self):
+ self.check_display()
+ return asstr(glXGetClientString(self.display, GLX_VERSION))
+
+ def get_client_extensions(self):
+ self.check_display()
+ return asstr(glXGetClientString(self.display, GLX_EXTENSIONS)).split()
+
+ def get_extensions(self):
+ self.check_display()
+ return asstr(glXQueryExtensionsString(self.display, 0)).split()
+
+ def have_extension(self, extension):
+ self.check_display()
+ if not self.have_version(1, 1):
+ return False
+ return extension in self.get_extensions()
+
+# Single instance suitable for apps that use only a single display.
+_glx_info = GLXInfo()
+
+set_display = _glx_info.set_display
+check_display = _glx_info.check_display
+have_version = _glx_info.have_version
+get_server_vendor = _glx_info.get_server_vendor
+get_server_version = _glx_info.get_server_version
+get_server_extensions = _glx_info.get_server_extensions
+get_client_vendor = _glx_info.get_client_vendor
+get_client_version = _glx_info.get_client_version
+get_client_extensions = _glx_info.get_client_extensions
+get_extensions = _glx_info.get_extensions
+have_extension = _glx_info.have_extension
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glxext_arb.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glxext_arb.py
new file mode 100644
index 0000000..a34c607
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glxext_arb.py
@@ -0,0 +1,990 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+'''Wrapper for http://oss.sgi.com/projects/ogl-sample/ABI/glxext.h
+
+Generated by tools/gengl.py.
+Do not modify this file.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import ctypes
+from ctypes import *
+from pyglet.gl.lib import link_GLX as _link_function
+from pyglet.gl.lib import c_ptrdiff_t
+
+if not hasattr(ctypes, 'c_int64'):
+ # XXX TODO completely wrong, but at least can import.
+ # Can c_longlong still be used?
+ c_int64 = c_long
+ c_uint64 = c_ulong
+
+# BEGIN GENERATED CONTENT (do not edit below this line)
+
+# This content is generated by tools/gengl.py.
+# Wrapper for http://www.opengl.org/registry/api/glxext.h
+
+import pyglet.libs.x11.xlib
+import pyglet.gl.glx
+
+# H (/usr/include/GL/glx.h:26)
+# ARB_get_proc_address (/usr/include/GL/glx.h:317)
+# GLXEXT_LEGACY (/usr/include/GL/glx.h:334)
+GLX_GLXEXT_VERSION = 32 # GL/glxext.h:53
+# VERSION_1_3 (GL/glxext.h:55)
+# VERSION_1_4 (GL/glxext.h:114)
+# ARB_get_proc_address (GL/glxext.h:119)
+# ARB_multisample (GL/glxext.h:122)
+GLX_SAMPLE_BUFFERS_ARB = 100000 # GL/glxext.h:123
+GLX_SAMPLES_ARB = 100001 # GL/glxext.h:124
+# ARB_vertex_buffer_object (GL/glxext.h:127)
+GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB = 8341 # GL/glxext.h:128
+# ARB_fbconfig_float (GL/glxext.h:131)
+GLX_RGBA_FLOAT_TYPE_ARB = 8377 # GL/glxext.h:132
+GLX_RGBA_FLOAT_BIT_ARB = 4 # GL/glxext.h:133
+# ARB_framebuffer_sRGB (GL/glxext.h:136)
+GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB = 8370 # GL/glxext.h:137
+# ARB_create_context (GL/glxext.h:140)
+GLX_CONTEXT_DEBUG_BIT_ARB = 1 # GL/glxext.h:141
+GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 2 # GL/glxext.h:142
+GLX_CONTEXT_MAJOR_VERSION_ARB = 8337 # GL/glxext.h:143
+GLX_CONTEXT_MINOR_VERSION_ARB = 8338 # GL/glxext.h:144
+GLX_CONTEXT_FLAGS_ARB = 8340 # GL/glxext.h:145
+# ARB_create_context_profile (GL/glxext.h:148)
+GLX_CONTEXT_CORE_PROFILE_BIT_ARB = 1 # GL/glxext.h:149
+GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 2 # GL/glxext.h:150
+GLX_CONTEXT_PROFILE_MASK_ARB = 37158 # GL/glxext.h:151
+# ARB_create_context_robustness (GL/glxext.h:154)
+GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB = 4 # GL/glxext.h:155
+GLX_LOSE_CONTEXT_ON_RESET_ARB = 33362 # GL/glxext.h:156
+GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB = 33366 # GL/glxext.h:157
+GLX_NO_RESET_NOTIFICATION_ARB = 33377 # GL/glxext.h:158
+# SGIS_multisample (GL/glxext.h:161)
+GLX_SAMPLE_BUFFERS_SGIS = 100000 # GL/glxext.h:162
+GLX_SAMPLES_SGIS = 100001 # GL/glxext.h:163
+# EXT_visual_info (GL/glxext.h:166)
+GLX_X_VISUAL_TYPE_EXT = 34 # GL/glxext.h:167
+GLX_TRANSPARENT_TYPE_EXT = 35 # GL/glxext.h:168
+GLX_TRANSPARENT_INDEX_VALUE_EXT = 36 # GL/glxext.h:169
+GLX_TRANSPARENT_RED_VALUE_EXT = 37 # GL/glxext.h:170
+GLX_TRANSPARENT_GREEN_VALUE_EXT = 38 # GL/glxext.h:171
+GLX_TRANSPARENT_BLUE_VALUE_EXT = 39 # GL/glxext.h:172
+GLX_TRANSPARENT_ALPHA_VALUE_EXT = 40 # GL/glxext.h:173
+GLX_NONE_EXT = 32768 # GL/glxext.h:174
+GLX_TRUE_COLOR_EXT = 32770 # GL/glxext.h:175
+GLX_DIRECT_COLOR_EXT = 32771 # GL/glxext.h:176
+GLX_PSEUDO_COLOR_EXT = 32772 # GL/glxext.h:177
+GLX_STATIC_COLOR_EXT = 32773 # GL/glxext.h:178
+GLX_GRAY_SCALE_EXT = 32774 # GL/glxext.h:179
+GLX_STATIC_GRAY_EXT = 32775 # GL/glxext.h:180
+GLX_TRANSPARENT_RGB_EXT = 32776 # GL/glxext.h:181
+GLX_TRANSPARENT_INDEX_EXT = 32777 # GL/glxext.h:182
+# SGI_swap_control (GL/glxext.h:185)
+# SGI_video_sync (GL/glxext.h:188)
+# SGI_make_current_read (GL/glxext.h:191)
+# SGIX_video_source (GL/glxext.h:194)
+# EXT_visual_rating (GL/glxext.h:197)
+GLX_VISUAL_CAVEAT_EXT = 32 # GL/glxext.h:198
+GLX_SLOW_VISUAL_EXT = 32769 # GL/glxext.h:199
+GLX_NON_CONFORMANT_VISUAL_EXT = 32781 # GL/glxext.h:200
+# EXT_import_context (GL/glxext.h:204)
+GLX_SHARE_CONTEXT_EXT = 32778 # GL/glxext.h:205
+GLX_VISUAL_ID_EXT = 32779 # GL/glxext.h:206
+GLX_SCREEN_EXT = 32780 # GL/glxext.h:207
+# SGIX_fbconfig (GL/glxext.h:210)
+GLX_WINDOW_BIT_SGIX = 1 # GL/glxext.h:211
+GLX_PIXMAP_BIT_SGIX = 2 # GL/glxext.h:212
+GLX_RGBA_BIT_SGIX = 1 # GL/glxext.h:213
+GLX_COLOR_INDEX_BIT_SGIX = 2 # GL/glxext.h:214
+GLX_DRAWABLE_TYPE_SGIX = 32784 # GL/glxext.h:215
+GLX_RENDER_TYPE_SGIX = 32785 # GL/glxext.h:216
+GLX_X_RENDERABLE_SGIX = 32786 # GL/glxext.h:217
+GLX_FBCONFIG_ID_SGIX = 32787 # GL/glxext.h:218
+GLX_RGBA_TYPE_SGIX = 32788 # GL/glxext.h:219
+GLX_COLOR_INDEX_TYPE_SGIX = 32789 # GL/glxext.h:220
+# SGIX_pbuffer (GL/glxext.h:224)
+GLX_PBUFFER_BIT_SGIX = 4 # GL/glxext.h:225
+GLX_BUFFER_CLOBBER_MASK_SGIX = 134217728 # GL/glxext.h:226
+GLX_FRONT_LEFT_BUFFER_BIT_SGIX = 1 # GL/glxext.h:227
+GLX_FRONT_RIGHT_BUFFER_BIT_SGIX = 2 # GL/glxext.h:228
+GLX_BACK_LEFT_BUFFER_BIT_SGIX = 4 # GL/glxext.h:229
+GLX_BACK_RIGHT_BUFFER_BIT_SGIX = 8 # GL/glxext.h:230
+GLX_AUX_BUFFERS_BIT_SGIX = 16 # GL/glxext.h:231
+GLX_DEPTH_BUFFER_BIT_SGIX = 32 # GL/glxext.h:232
+GLX_STENCIL_BUFFER_BIT_SGIX = 64 # GL/glxext.h:233
+GLX_ACCUM_BUFFER_BIT_SGIX = 128 # GL/glxext.h:234
+GLX_SAMPLE_BUFFERS_BIT_SGIX = 256 # GL/glxext.h:235
+GLX_MAX_PBUFFER_WIDTH_SGIX = 32790 # GL/glxext.h:236
+GLX_MAX_PBUFFER_HEIGHT_SGIX = 32791 # GL/glxext.h:237
+GLX_MAX_PBUFFER_PIXELS_SGIX = 32792 # GL/glxext.h:238
+GLX_OPTIMAL_PBUFFER_WIDTH_SGIX = 32793 # GL/glxext.h:239
+GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX = 32794 # GL/glxext.h:240
+GLX_PRESERVED_CONTENTS_SGIX = 32795 # GL/glxext.h:241
+GLX_LARGEST_PBUFFER_SGIX = 32796 # GL/glxext.h:242
+GLX_WIDTH_SGIX = 32797 # GL/glxext.h:243
+GLX_HEIGHT_SGIX = 32798 # GL/glxext.h:244
+GLX_EVENT_MASK_SGIX = 32799 # GL/glxext.h:245
+GLX_DAMAGED_SGIX = 32800 # GL/glxext.h:246
+GLX_SAVED_SGIX = 32801 # GL/glxext.h:247
+GLX_WINDOW_SGIX = 32802 # GL/glxext.h:248
+GLX_PBUFFER_SGIX = 32803 # GL/glxext.h:249
+# SGI_cushion (GL/glxext.h:252)
+# SGIX_video_resize (GL/glxext.h:255)
+GLX_SYNC_FRAME_SGIX = 0 # GL/glxext.h:256
+GLX_SYNC_SWAP_SGIX = 1 # GL/glxext.h:257
+# SGIX_dmbuffer (GL/glxext.h:260)
+GLX_DIGITAL_MEDIA_PBUFFER_SGIX = 32804 # GL/glxext.h:261
+# SGIX_swap_group (GL/glxext.h:264)
+# SGIX_swap_barrier (GL/glxext.h:267)
+# SGIS_blended_overlay (GL/glxext.h:270)
+GLX_BLENDED_RGBA_SGIS = 32805 # GL/glxext.h:271
+# SGIS_shared_multisample (GL/glxext.h:274)
+GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS = 32806 # GL/glxext.h:275
+GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS = 32807 # GL/glxext.h:276
+# SUN_get_transparent_index (GL/glxext.h:279)
+# 3DFX_multisample (GL/glxext.h:282)
+GLX_SAMPLE_BUFFERS_3DFX = 32848 # GL/glxext.h:283
+GLX_SAMPLES_3DFX = 32849 # GL/glxext.h:284
+# MESA_copy_sub_buffer (GL/glxext.h:287)
+# MESA_pixmap_colormap (GL/glxext.h:290)
+# MESA_release_buffers (GL/glxext.h:293)
+# MESA_set_3dfx_mode (GL/glxext.h:296)
+GLX_3DFX_WINDOW_MODE_MESA = 1 # GL/glxext.h:297
+GLX_3DFX_FULLSCREEN_MODE_MESA = 2 # GL/glxext.h:298
+# SGIX_visual_select_group (GL/glxext.h:301)
+GLX_VISUAL_SELECT_GROUP_SGIX = 32808 # GL/glxext.h:302
+# OML_swap_method (GL/glxext.h:305)
+GLX_SWAP_METHOD_OML = 32864 # GL/glxext.h:306
+GLX_SWAP_EXCHANGE_OML = 32865 # GL/glxext.h:307
+GLX_SWAP_COPY_OML = 32866 # GL/glxext.h:308
+GLX_SWAP_UNDEFINED_OML = 32867 # GL/glxext.h:309
+# OML_sync_control (GL/glxext.h:312)
+# NV_float_buffer (GL/glxext.h:315)
+GLX_FLOAT_COMPONENTS_NV = 8368 # GL/glxext.h:316
+# SGIX_hyperpipe (GL/glxext.h:319)
+GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX = 80 # GL/glxext.h:320
+GLX_BAD_HYPERPIPE_CONFIG_SGIX = 91 # GL/glxext.h:321
+GLX_BAD_HYPERPIPE_SGIX = 92 # GL/glxext.h:322
+GLX_HYPERPIPE_DISPLAY_PIPE_SGIX = 1 # GL/glxext.h:323
+GLX_HYPERPIPE_RENDER_PIPE_SGIX = 2 # GL/glxext.h:324
+GLX_PIPE_RECT_SGIX = 1 # GL/glxext.h:325
+GLX_PIPE_RECT_LIMITS_SGIX = 2 # GL/glxext.h:326
+GLX_HYPERPIPE_STEREO_SGIX = 3 # GL/glxext.h:327
+GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX = 4 # GL/glxext.h:328
+GLX_HYPERPIPE_ID_SGIX = 32816 # GL/glxext.h:329
+# MESA_agp_offset (GL/glxext.h:332)
+# EXT_fbconfig_packed_float (GL/glxext.h:335)
+GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT = 8369 # GL/glxext.h:336
+GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT = 8 # GL/glxext.h:337
+# EXT_framebuffer_sRGB (GL/glxext.h:340)
+GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT = 8370 # GL/glxext.h:341
+# EXT_texture_from_pixmap (GL/glxext.h:344)
+GLX_TEXTURE_1D_BIT_EXT = 1 # GL/glxext.h:345
+GLX_TEXTURE_2D_BIT_EXT = 2 # GL/glxext.h:346
+GLX_TEXTURE_RECTANGLE_BIT_EXT = 4 # GL/glxext.h:347
+GLX_BIND_TO_TEXTURE_RGB_EXT = 8400 # GL/glxext.h:348
+GLX_BIND_TO_TEXTURE_RGBA_EXT = 8401 # GL/glxext.h:349
+GLX_BIND_TO_MIPMAP_TEXTURE_EXT = 8402 # GL/glxext.h:350
+GLX_BIND_TO_TEXTURE_TARGETS_EXT = 8403 # GL/glxext.h:351
+GLX_Y_INVERTED_EXT = 8404 # GL/glxext.h:352
+GLX_TEXTURE_FORMAT_EXT = 8405 # GL/glxext.h:353
+GLX_TEXTURE_TARGET_EXT = 8406 # GL/glxext.h:354
+GLX_MIPMAP_TEXTURE_EXT = 8407 # GL/glxext.h:355
+GLX_TEXTURE_FORMAT_NONE_EXT = 8408 # GL/glxext.h:356
+GLX_TEXTURE_FORMAT_RGB_EXT = 8409 # GL/glxext.h:357
+GLX_TEXTURE_FORMAT_RGBA_EXT = 8410 # GL/glxext.h:358
+GLX_TEXTURE_1D_EXT = 8411 # GL/glxext.h:359
+GLX_TEXTURE_2D_EXT = 8412 # GL/glxext.h:360
+GLX_TEXTURE_RECTANGLE_EXT = 8413 # GL/glxext.h:361
+GLX_FRONT_LEFT_EXT = 8414 # GL/glxext.h:362
+GLX_FRONT_RIGHT_EXT = 8415 # GL/glxext.h:363
+GLX_BACK_LEFT_EXT = 8416 # GL/glxext.h:364
+GLX_BACK_RIGHT_EXT = 8417 # GL/glxext.h:365
+GLX_FRONT_EXT = 8414 # GL/glxext.h:366
+GLX_BACK_EXT = 8416 # GL/glxext.h:367
+GLX_AUX0_EXT = 8418 # GL/glxext.h:368
+GLX_AUX1_EXT = 8419 # GL/glxext.h:369
+GLX_AUX2_EXT = 8420 # GL/glxext.h:370
+GLX_AUX3_EXT = 8421 # GL/glxext.h:371
+GLX_AUX4_EXT = 8422 # GL/glxext.h:372
+GLX_AUX5_EXT = 8423 # GL/glxext.h:373
+GLX_AUX6_EXT = 8424 # GL/glxext.h:374
+GLX_AUX7_EXT = 8425 # GL/glxext.h:375
+GLX_AUX8_EXT = 8426 # GL/glxext.h:376
+GLX_AUX9_EXT = 8427 # GL/glxext.h:377
+# NV_present_video (GL/glxext.h:380)
+GLX_NUM_VIDEO_SLOTS_NV = 8432 # GL/glxext.h:381
+# NV_video_out (GL/glxext.h:384)
+GLX_VIDEO_OUT_COLOR_NV = 8387 # GL/glxext.h:385
+GLX_VIDEO_OUT_ALPHA_NV = 8388 # GL/glxext.h:386
+GLX_VIDEO_OUT_DEPTH_NV = 8389 # GL/glxext.h:387
+GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV = 8390 # GL/glxext.h:388
+GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV = 8391 # GL/glxext.h:389
+GLX_VIDEO_OUT_FRAME_NV = 8392 # GL/glxext.h:390
+GLX_VIDEO_OUT_FIELD_1_NV = 8393 # GL/glxext.h:391
+GLX_VIDEO_OUT_FIELD_2_NV = 8394 # GL/glxext.h:392
+GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV = 8395 # GL/glxext.h:393
+GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV = 8396 # GL/glxext.h:394
+# NV_swap_group (GL/glxext.h:397)
+# NV_video_capture (GL/glxext.h:400)
+GLX_DEVICE_ID_NV = 8397 # GL/glxext.h:401
+GLX_UNIQUE_ID_NV = 8398 # GL/glxext.h:402
+GLX_NUM_VIDEO_CAPTURE_SLOTS_NV = 8399 # GL/glxext.h:403
+# EXT_swap_control (GL/glxext.h:406)
+GLX_SWAP_INTERVAL_EXT = 8433 # GL/glxext.h:407
+GLX_MAX_SWAP_INTERVAL_EXT = 8434 # GL/glxext.h:408
+# NV_copy_image (GL/glxext.h:411)
+# INTEL_swap_event (GL/glxext.h:414)
+GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK = 67108864 # GL/glxext.h:415
+GLX_EXCHANGE_COMPLETE_INTEL = 33152 # GL/glxext.h:416
+GLX_COPY_COMPLETE_INTEL = 33153 # GL/glxext.h:417
+GLX_FLIP_COMPLETE_INTEL = 33154 # GL/glxext.h:418
+# NV_multisample_coverage (GL/glxext.h:421)
+GLX_COVERAGE_SAMPLES_NV = 100001 # GL/glxext.h:422
+GLX_COLOR_SAMPLES_NV = 8371 # GL/glxext.h:423
+# AMD_gpu_association (GL/glxext.h:426)
+GLX_GPU_VENDOR_AMD = 7936 # GL/glxext.h:427
+GLX_GPU_RENDERER_STRING_AMD = 7937 # GL/glxext.h:428
+GLX_GPU_OPENGL_VERSION_STRING_AMD = 7938 # GL/glxext.h:429
+GLX_GPU_FASTEST_TARGET_GPUS_AMD = 8610 # GL/glxext.h:430
+GLX_GPU_RAM_AMD = 8611 # GL/glxext.h:431
+GLX_GPU_CLOCK_AMD = 8612 # GL/glxext.h:432
+GLX_GPU_NUM_PIPES_AMD = 8613 # GL/glxext.h:433
+GLX_GPU_NUM_SIMD_AMD = 8614 # GL/glxext.h:434
+GLX_GPU_NUM_RB_AMD = 8615 # GL/glxext.h:435
+GLX_GPU_NUM_SPI_AMD = 8616 # GL/glxext.h:436
+# EXT_create_context_es2_profile (GL/glxext.h:439)
+GLX_CONTEXT_ES2_PROFILE_BIT_EXT = 4 # GL/glxext.h:440
+# ARB_get_proc_address (GL/glxext.h:446)
+# SGIX_video_source (GL/glxext.h:450)
+XID = pyglet.libs.x11.xlib.XID
+GLXVideoSourceSGIX = XID # GL/glxext.h:451
+# SGIX_fbconfig (GL/glxext.h:454)
+GLXFBConfigIDSGIX = XID # GL/glxext.h:455
+class struct___GLXFBConfigRec(Structure):
+ __slots__ = [
+ ]
+struct___GLXFBConfigRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct___GLXFBConfigRec(Structure):
+ __slots__ = [
+ ]
+struct___GLXFBConfigRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+GLXFBConfigSGIX = POINTER(struct___GLXFBConfigRec) # GL/glxext.h:456
+# SGIX_pbuffer (GL/glxext.h:459)
+GLXPbufferSGIX = XID # GL/glxext.h:460
+class struct_anon_106(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'drawable',
+ 'event_type',
+ 'draw_type',
+ 'mask',
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'count',
+ ]
+Display = pyglet.libs.x11.xlib.Display
+GLXDrawable = pyglet.gl.glx.GLXDrawable
+struct_anon_106._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('drawable', GLXDrawable),
+ ('event_type', c_int),
+ ('draw_type', c_int),
+ ('mask', c_uint),
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('count', c_int),
+]
+
+GLXBufferClobberEventSGIX = struct_anon_106 # GL/glxext.h:473
+# NV_video_output (GL/glxext.h:476)
+GLXVideoDeviceNV = c_uint # GL/glxext.h:477
+# NV_video_capture (GL/glxext.h:480)
+GLXVideoCaptureDeviceNV = XID # GL/glxext.h:481
+# VERSION_1_3 (GL/glxext.h:521)
+# VERSION_1_4 (GL/glxext.h:563)
+# ARB_get_proc_address (GL/glxext.h:571)
+# ARB_multisample (GL/glxext.h:579)
+GLX_ARB_multisample = 1 # GL/glxext.h:580
+# ARB_fbconfig_float (GL/glxext.h:583)
+GLX_ARB_fbconfig_float = 1 # GL/glxext.h:584
+# ARB_framebuffer_sRGB (GL/glxext.h:587)
+GLX_ARB_framebuffer_sRGB = 1 # GL/glxext.h:588
+# ARB_create_context (GL/glxext.h:591)
+GLX_ARB_create_context = 1 # GL/glxext.h:592
+GLXContext = pyglet.gl.glx.GLXContext
+GLXFBConfig = pyglet.gl.glx.GLXFBConfig
+# GL/glxext.h:594
+glXCreateContextAttribsARB = _link_function('glXCreateContextAttribsARB', GLXContext, [POINTER(Display), GLXFBConfig, GLXContext, c_int, POINTER(c_int)], 'ARB_create_context')
+
+PFNGLXCREATECONTEXTATTRIBSARBPROC = CFUNCTYPE(GLXContext, POINTER(Display), GLXFBConfig, GLXContext, c_int, POINTER(c_int)) # GL/glxext.h:596
+# ARB_create_context_profile (GL/glxext.h:599)
+GLX_ARB_create_context_profile = 1 # GL/glxext.h:600
+# ARB_create_context_robustness (GL/glxext.h:603)
+GLX_ARB_create_context_robustness = 1 # GL/glxext.h:604
+# SGIS_multisample (GL/glxext.h:607)
+GLX_SGIS_multisample = 1 # GL/glxext.h:608
+# EXT_visual_info (GL/glxext.h:611)
+GLX_EXT_visual_info = 1 # GL/glxext.h:612
+# SGI_swap_control (GL/glxext.h:615)
+GLX_SGI_swap_control = 1 # GL/glxext.h:616
+# GL/glxext.h:618
+glXSwapIntervalSGI = _link_function('glXSwapIntervalSGI', c_int, [c_int], 'SGI_swap_control')
+
+PFNGLXSWAPINTERVALSGIPROC = CFUNCTYPE(c_int, c_int) # GL/glxext.h:620
+# SGI_video_sync (GL/glxext.h:623)
+GLX_SGI_video_sync = 1 # GL/glxext.h:624
+# GL/glxext.h:626
+glXGetVideoSyncSGI = _link_function('glXGetVideoSyncSGI', c_int, [POINTER(c_uint)], 'SGI_video_sync')
+
+# GL/glxext.h:627
+glXWaitVideoSyncSGI = _link_function('glXWaitVideoSyncSGI', c_int, [c_int, c_int, POINTER(c_uint)], 'SGI_video_sync')
+
+PFNGLXGETVIDEOSYNCSGIPROC = CFUNCTYPE(c_int, POINTER(c_uint)) # GL/glxext.h:629
+PFNGLXWAITVIDEOSYNCSGIPROC = CFUNCTYPE(c_int, c_int, c_int, POINTER(c_uint)) # GL/glxext.h:630
+# SGI_make_current_read (GL/glxext.h:633)
+GLX_SGI_make_current_read = 1 # GL/glxext.h:634
+# GL/glxext.h:636
+glXMakeCurrentReadSGI = _link_function('glXMakeCurrentReadSGI', c_int, [POINTER(Display), GLXDrawable, GLXDrawable, GLXContext], 'SGI_make_current_read')
+
+# GL/glxext.h:637
+glXGetCurrentReadDrawableSGI = _link_function('glXGetCurrentReadDrawableSGI', GLXDrawable, [], 'SGI_make_current_read')
+
+PFNGLXMAKECURRENTREADSGIPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, GLXDrawable, GLXContext) # GL/glxext.h:639
+PFNGLXGETCURRENTREADDRAWABLESGIPROC = CFUNCTYPE(GLXDrawable) # GL/glxext.h:640
+# SGIX_video_source (GL/glxext.h:643)
+GLX_SGIX_video_source = 1 # GL/glxext.h:644
+# EXT_visual_rating (GL/glxext.h:655)
+GLX_EXT_visual_rating = 1 # GL/glxext.h:656
+# EXT_import_context (GL/glxext.h:659)
+GLX_EXT_import_context = 1 # GL/glxext.h:660
+# GL/glxext.h:662
+glXGetCurrentDisplayEXT = _link_function('glXGetCurrentDisplayEXT', POINTER(Display), [], 'EXT_import_context')
+
+# GL/glxext.h:663
+glXQueryContextInfoEXT = _link_function('glXQueryContextInfoEXT', c_int, [POINTER(Display), GLXContext, c_int, POINTER(c_int)], 'EXT_import_context')
+
+GLXContextID = pyglet.gl.glx.GLXContextID
+# GL/glxext.h:664
+glXGetContextIDEXT = _link_function('glXGetContextIDEXT', GLXContextID, [GLXContext], 'EXT_import_context')
+
+# GL/glxext.h:665
+glXImportContextEXT = _link_function('glXImportContextEXT', GLXContext, [POINTER(Display), GLXContextID], 'EXT_import_context')
+
+# GL/glxext.h:666
+glXFreeContextEXT = _link_function('glXFreeContextEXT', None, [POINTER(Display), GLXContext], 'EXT_import_context')
+
+PFNGLXGETCURRENTDISPLAYEXTPROC = CFUNCTYPE(POINTER(Display)) # GL/glxext.h:668
+PFNGLXQUERYCONTEXTINFOEXTPROC = CFUNCTYPE(c_int, POINTER(Display), GLXContext, c_int, POINTER(c_int)) # GL/glxext.h:669
+PFNGLXGETCONTEXTIDEXTPROC = CFUNCTYPE(GLXContextID, GLXContext) # GL/glxext.h:670
+PFNGLXIMPORTCONTEXTEXTPROC = CFUNCTYPE(GLXContext, POINTER(Display), GLXContextID) # GL/glxext.h:671
+PFNGLXFREECONTEXTEXTPROC = CFUNCTYPE(None, POINTER(Display), GLXContext) # GL/glxext.h:672
+# SGIX_fbconfig (GL/glxext.h:675)
+GLX_SGIX_fbconfig = 1 # GL/glxext.h:676
+# GL/glxext.h:678
+glXGetFBConfigAttribSGIX = _link_function('glXGetFBConfigAttribSGIX', c_int, [POINTER(Display), GLXFBConfigSGIX, c_int, POINTER(c_int)], 'SGIX_fbconfig')
+
+# GL/glxext.h:679
+glXChooseFBConfigSGIX = _link_function('glXChooseFBConfigSGIX', POINTER(GLXFBConfigSGIX), [POINTER(Display), c_int, POINTER(c_int), POINTER(c_int)], 'SGIX_fbconfig')
+
+GLXPixmap = pyglet.gl.glx.GLXPixmap
+Pixmap = pyglet.libs.x11.xlib.Pixmap
+# GL/glxext.h:680
+glXCreateGLXPixmapWithConfigSGIX = _link_function('glXCreateGLXPixmapWithConfigSGIX', GLXPixmap, [POINTER(Display), GLXFBConfigSGIX, Pixmap], 'SGIX_fbconfig')
+
+# GL/glxext.h:681
+glXCreateContextWithConfigSGIX = _link_function('glXCreateContextWithConfigSGIX', GLXContext, [POINTER(Display), GLXFBConfigSGIX, c_int, GLXContext, c_int], 'SGIX_fbconfig')
+
+XVisualInfo = pyglet.libs.x11.xlib.XVisualInfo
+# GL/glxext.h:682
+glXGetVisualFromFBConfigSGIX = _link_function('glXGetVisualFromFBConfigSGIX', POINTER(XVisualInfo), [POINTER(Display), GLXFBConfigSGIX], 'SGIX_fbconfig')
+
+# GL/glxext.h:683
+glXGetFBConfigFromVisualSGIX = _link_function('glXGetFBConfigFromVisualSGIX', GLXFBConfigSGIX, [POINTER(Display), POINTER(XVisualInfo)], 'SGIX_fbconfig')
+
+PFNGLXGETFBCONFIGATTRIBSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), GLXFBConfigSGIX, c_int, POINTER(c_int)) # GL/glxext.h:685
+PFNGLXCHOOSEFBCONFIGSGIXPROC = CFUNCTYPE(POINTER(GLXFBConfigSGIX), POINTER(Display), c_int, POINTER(c_int), POINTER(c_int)) # GL/glxext.h:686
+PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC = CFUNCTYPE(GLXPixmap, POINTER(Display), GLXFBConfigSGIX, Pixmap) # GL/glxext.h:687
+PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC = CFUNCTYPE(GLXContext, POINTER(Display), GLXFBConfigSGIX, c_int, GLXContext, c_int) # GL/glxext.h:688
+PFNGLXGETVISUALFROMFBCONFIGSGIXPROC = CFUNCTYPE(POINTER(XVisualInfo), POINTER(Display), GLXFBConfigSGIX) # GL/glxext.h:689
+PFNGLXGETFBCONFIGFROMVISUALSGIXPROC = CFUNCTYPE(GLXFBConfigSGIX, POINTER(Display), POINTER(XVisualInfo)) # GL/glxext.h:690
+# SGIX_pbuffer (GL/glxext.h:693)
+GLX_SGIX_pbuffer = 1 # GL/glxext.h:694
+# GL/glxext.h:696
+glXCreateGLXPbufferSGIX = _link_function('glXCreateGLXPbufferSGIX', GLXPbufferSGIX, [POINTER(Display), GLXFBConfigSGIX, c_uint, c_uint, POINTER(c_int)], 'SGIX_pbuffer')
+
+# GL/glxext.h:697
+glXDestroyGLXPbufferSGIX = _link_function('glXDestroyGLXPbufferSGIX', None, [POINTER(Display), GLXPbufferSGIX], 'SGIX_pbuffer')
+
+# GL/glxext.h:698
+glXQueryGLXPbufferSGIX = _link_function('glXQueryGLXPbufferSGIX', c_int, [POINTER(Display), GLXPbufferSGIX, c_int, POINTER(c_uint)], 'SGIX_pbuffer')
+
+# GL/glxext.h:699
+glXSelectEventSGIX = _link_function('glXSelectEventSGIX', None, [POINTER(Display), GLXDrawable, c_ulong], 'SGIX_pbuffer')
+
+# GL/glxext.h:700
+glXGetSelectedEventSGIX = _link_function('glXGetSelectedEventSGIX', None, [POINTER(Display), GLXDrawable, POINTER(c_ulong)], 'SGIX_pbuffer')
+
+PFNGLXCREATEGLXPBUFFERSGIXPROC = CFUNCTYPE(GLXPbufferSGIX, POINTER(Display), GLXFBConfigSGIX, c_uint, c_uint, POINTER(c_int)) # GL/glxext.h:702
+PFNGLXDESTROYGLXPBUFFERSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXPbufferSGIX) # GL/glxext.h:703
+PFNGLXQUERYGLXPBUFFERSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), GLXPbufferSGIX, c_int, POINTER(c_uint)) # GL/glxext.h:704
+PFNGLXSELECTEVENTSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_ulong) # GL/glxext.h:705
+PFNGLXGETSELECTEDEVENTSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, POINTER(c_ulong)) # GL/glxext.h:706
+# SGI_cushion (GL/glxext.h:709)
+GLX_SGI_cushion = 1 # GL/glxext.h:710
+Window = pyglet.libs.x11.xlib.Window
+# GL/glxext.h:712
+glXCushionSGI = _link_function('glXCushionSGI', None, [POINTER(Display), Window, c_float], 'SGI_cushion')
+
+PFNGLXCUSHIONSGIPROC = CFUNCTYPE(None, POINTER(Display), Window, c_float) # GL/glxext.h:714
+# SGIX_video_resize (GL/glxext.h:717)
+GLX_SGIX_video_resize = 1 # GL/glxext.h:718
+# GL/glxext.h:720
+glXBindChannelToWindowSGIX = _link_function('glXBindChannelToWindowSGIX', c_int, [POINTER(Display), c_int, c_int, Window], 'SGIX_video_resize')
+
+# GL/glxext.h:721
+glXChannelRectSGIX = _link_function('glXChannelRectSGIX', c_int, [POINTER(Display), c_int, c_int, c_int, c_int, c_int, c_int], 'SGIX_video_resize')
+
+# GL/glxext.h:722
+glXQueryChannelRectSGIX = _link_function('glXQueryChannelRectSGIX', c_int, [POINTER(Display), c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)], 'SGIX_video_resize')
+
+# GL/glxext.h:723
+glXQueryChannelDeltasSGIX = _link_function('glXQueryChannelDeltasSGIX', c_int, [POINTER(Display), c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)], 'SGIX_video_resize')
+
+GLenum = c_uint # /usr/include/GL/gl.h:153
+# GL/glxext.h:724
+glXChannelRectSyncSGIX = _link_function('glXChannelRectSyncSGIX', c_int, [POINTER(Display), c_int, c_int, GLenum], 'SGIX_video_resize')
+
+PFNGLXBINDCHANNELTOWINDOWSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, Window) # GL/glxext.h:726
+PFNGLXCHANNELRECTSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, c_int, c_int, c_int, c_int) # GL/glxext.h:727
+PFNGLXQUERYCHANNELRECTSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)) # GL/glxext.h:728
+PFNGLXQUERYCHANNELDELTASSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)) # GL/glxext.h:729
+PFNGLXCHANNELRECTSYNCSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, GLenum) # GL/glxext.h:730
+# SGIX_dmbuffer (GL/glxext.h:733)
+GLX_SGIX_dmbuffer = 1 # GL/glxext.h:734
+# SGIX_swap_group (GL/glxext.h:743)
+GLX_SGIX_swap_group = 1 # GL/glxext.h:744
+# GL/glxext.h:746
+glXJoinSwapGroupSGIX = _link_function('glXJoinSwapGroupSGIX', None, [POINTER(Display), GLXDrawable, GLXDrawable], 'SGIX_swap_group')
+
+PFNGLXJOINSWAPGROUPSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, GLXDrawable) # GL/glxext.h:748
+# SGIX_swap_barrier (GL/glxext.h:751)
+GLX_SGIX_swap_barrier = 1 # GL/glxext.h:752
+# GL/glxext.h:754
+glXBindSwapBarrierSGIX = _link_function('glXBindSwapBarrierSGIX', None, [POINTER(Display), GLXDrawable, c_int], 'SGIX_swap_barrier')
+
+# GL/glxext.h:755
+glXQueryMaxSwapBarriersSGIX = _link_function('glXQueryMaxSwapBarriersSGIX', c_int, [POINTER(Display), c_int, POINTER(c_int)], 'SGIX_swap_barrier')
+
+PFNGLXBINDSWAPBARRIERSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_int) # GL/glxext.h:757
+PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, POINTER(c_int)) # GL/glxext.h:758
+# SUN_get_transparent_index (GL/glxext.h:761)
+GLX_SUN_get_transparent_index = 1 # GL/glxext.h:762
+# GL/glxext.h:764
+glXGetTransparentIndexSUN = _link_function('glXGetTransparentIndexSUN', c_int, [POINTER(Display), Window, Window, POINTER(c_long)], 'SUN_get_transparent_index')
+
+PFNGLXGETTRANSPARENTINDEXSUNPROC = CFUNCTYPE(c_int, POINTER(Display), Window, Window, POINTER(c_long)) # GL/glxext.h:766
+# MESA_copy_sub_buffer (GL/glxext.h:769)
+GLX_MESA_copy_sub_buffer = 1 # GL/glxext.h:770
+# GL/glxext.h:772
+glXCopySubBufferMESA = _link_function('glXCopySubBufferMESA', None, [POINTER(Display), GLXDrawable, c_int, c_int, c_int, c_int], 'MESA_copy_sub_buffer')
+
+PFNGLXCOPYSUBBUFFERMESAPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_int, c_int, c_int, c_int) # GL/glxext.h:774
+# MESA_pixmap_colormap (GL/glxext.h:777)
+GLX_MESA_pixmap_colormap = 1 # GL/glxext.h:778
+Colormap = pyglet.libs.x11.xlib.Colormap
+# GL/glxext.h:780
+glXCreateGLXPixmapMESA = _link_function('glXCreateGLXPixmapMESA', GLXPixmap, [POINTER(Display), POINTER(XVisualInfo), Pixmap, Colormap], 'MESA_pixmap_colormap')
+
+PFNGLXCREATEGLXPIXMAPMESAPROC = CFUNCTYPE(GLXPixmap, POINTER(Display), POINTER(XVisualInfo), Pixmap, Colormap) # GL/glxext.h:782
+# MESA_release_buffers (GL/glxext.h:785)
+GLX_MESA_release_buffers = 1 # GL/glxext.h:786
+# GL/glxext.h:788
+glXReleaseBuffersMESA = _link_function('glXReleaseBuffersMESA', c_int, [POINTER(Display), GLXDrawable], 'MESA_release_buffers')
+
+PFNGLXRELEASEBUFFERSMESAPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable) # GL/glxext.h:790
+# MESA_set_3dfx_mode (GL/glxext.h:793)
+GLX_MESA_set_3dfx_mode = 1 # GL/glxext.h:794
+# GL/glxext.h:796
+glXSet3DfxModeMESA = _link_function('glXSet3DfxModeMESA', c_int, [c_int], 'MESA_set_3dfx_mode')
+
+PFNGLXSET3DFXMODEMESAPROC = CFUNCTYPE(c_int, c_int) # GL/glxext.h:798
+# SGIX_visual_select_group (GL/glxext.h:801)
+GLX_SGIX_visual_select_group = 1 # GL/glxext.h:802
+# OML_swap_method (GL/glxext.h:805)
+GLX_OML_swap_method = 1 # GL/glxext.h:806
+# OML_sync_control (GL/glxext.h:809)
+GLX_OML_sync_control = 1 # GL/glxext.h:810
+# GL/glxext.h:812
+glXGetSyncValuesOML = _link_function('glXGetSyncValuesOML', c_int, [POINTER(Display), GLXDrawable, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)], 'OML_sync_control')
+
+# GL/glxext.h:813
+glXGetMscRateOML = _link_function('glXGetMscRateOML', c_int, [POINTER(Display), GLXDrawable, POINTER(c_int32), POINTER(c_int32)], 'OML_sync_control')
+
+# GL/glxext.h:814
+glXSwapBuffersMscOML = _link_function('glXSwapBuffersMscOML', c_int64, [POINTER(Display), GLXDrawable, c_int64, c_int64, c_int64], 'OML_sync_control')
+
+# GL/glxext.h:815
+glXWaitForMscOML = _link_function('glXWaitForMscOML', c_int, [POINTER(Display), GLXDrawable, c_int64, c_int64, c_int64, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)], 'OML_sync_control')
+
+# GL/glxext.h:816
+glXWaitForSbcOML = _link_function('glXWaitForSbcOML', c_int, [POINTER(Display), GLXDrawable, c_int64, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)], 'OML_sync_control')
+
+PFNGLXGETSYNCVALUESOMLPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)) # GL/glxext.h:818
+PFNGLXGETMSCRATEOMLPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, POINTER(c_int32), POINTER(c_int32)) # GL/glxext.h:819
+PFNGLXSWAPBUFFERSMSCOMLPROC = CFUNCTYPE(c_int64, POINTER(Display), GLXDrawable, c_int64, c_int64, c_int64) # GL/glxext.h:820
+PFNGLXWAITFORMSCOMLPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, c_int64, c_int64, c_int64, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)) # GL/glxext.h:821
+PFNGLXWAITFORSBCOMLPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, c_int64, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)) # GL/glxext.h:822
+# NV_float_buffer (GL/glxext.h:825)
+GLX_NV_float_buffer = 1 # GL/glxext.h:826
+# SGIX_hyperpipe (GL/glxext.h:829)
+GLX_SGIX_hyperpipe = 1 # GL/glxext.h:830
+class struct_anon_107(Structure):
+ __slots__ = [
+ 'pipeName',
+ 'networkId',
+ ]
+struct_anon_107._fields_ = [
+ ('pipeName', c_char * 80),
+ ('networkId', c_int),
+]
+
+GLXHyperpipeNetworkSGIX = struct_anon_107 # GL/glxext.h:835
+class struct_anon_108(Structure):
+ __slots__ = [
+ 'pipeName',
+ 'channel',
+ 'participationType',
+ 'timeSlice',
+ ]
+struct_anon_108._fields_ = [
+ ('pipeName', c_char * 80),
+ ('channel', c_int),
+ ('participationType', c_uint),
+ ('timeSlice', c_int),
+]
+
+GLXHyperpipeConfigSGIX = struct_anon_108 # GL/glxext.h:843
+class struct_anon_109(Structure):
+ __slots__ = [
+ 'pipeName',
+ 'srcXOrigin',
+ 'srcYOrigin',
+ 'srcWidth',
+ 'srcHeight',
+ 'destXOrigin',
+ 'destYOrigin',
+ 'destWidth',
+ 'destHeight',
+ ]
+struct_anon_109._fields_ = [
+ ('pipeName', c_char * 80),
+ ('srcXOrigin', c_int),
+ ('srcYOrigin', c_int),
+ ('srcWidth', c_int),
+ ('srcHeight', c_int),
+ ('destXOrigin', c_int),
+ ('destYOrigin', c_int),
+ ('destWidth', c_int),
+ ('destHeight', c_int),
+]
+
+GLXPipeRect = struct_anon_109 # GL/glxext.h:849
+class struct_anon_110(Structure):
+ __slots__ = [
+ 'pipeName',
+ 'XOrigin',
+ 'YOrigin',
+ 'maxHeight',
+ 'maxWidth',
+ ]
+struct_anon_110._fields_ = [
+ ('pipeName', c_char * 80),
+ ('XOrigin', c_int),
+ ('YOrigin', c_int),
+ ('maxHeight', c_int),
+ ('maxWidth', c_int),
+]
+
+GLXPipeRectLimits = struct_anon_110 # GL/glxext.h:854
+# GL/glxext.h:857
+glXQueryHyperpipeNetworkSGIX = _link_function('glXQueryHyperpipeNetworkSGIX', POINTER(GLXHyperpipeNetworkSGIX), [POINTER(Display), POINTER(c_int)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:858
+glXHyperpipeConfigSGIX = _link_function('glXHyperpipeConfigSGIX', c_int, [POINTER(Display), c_int, c_int, POINTER(GLXHyperpipeConfigSGIX), POINTER(c_int)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:859
+glXQueryHyperpipeConfigSGIX = _link_function('glXQueryHyperpipeConfigSGIX', POINTER(GLXHyperpipeConfigSGIX), [POINTER(Display), c_int, POINTER(c_int)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:860
+glXDestroyHyperpipeConfigSGIX = _link_function('glXDestroyHyperpipeConfigSGIX', c_int, [POINTER(Display), c_int], 'SGIX_hyperpipe')
+
+# GL/glxext.h:861
+glXBindHyperpipeSGIX = _link_function('glXBindHyperpipeSGIX', c_int, [POINTER(Display), c_int], 'SGIX_hyperpipe')
+
+# GL/glxext.h:862
+glXQueryHyperpipeBestAttribSGIX = _link_function('glXQueryHyperpipeBestAttribSGIX', c_int, [POINTER(Display), c_int, c_int, c_int, POINTER(None), POINTER(None)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:863
+glXHyperpipeAttribSGIX = _link_function('glXHyperpipeAttribSGIX', c_int, [POINTER(Display), c_int, c_int, c_int, POINTER(None)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:864
+glXQueryHyperpipeAttribSGIX = _link_function('glXQueryHyperpipeAttribSGIX', c_int, [POINTER(Display), c_int, c_int, c_int, POINTER(None)], 'SGIX_hyperpipe')
+
+PFNGLXQUERYHYPERPIPENETWORKSGIXPROC = CFUNCTYPE(POINTER(GLXHyperpipeNetworkSGIX), POINTER(Display), POINTER(c_int)) # GL/glxext.h:866
+PFNGLXHYPERPIPECONFIGSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, POINTER(GLXHyperpipeConfigSGIX), POINTER(c_int)) # GL/glxext.h:867
+PFNGLXQUERYHYPERPIPECONFIGSGIXPROC = CFUNCTYPE(POINTER(GLXHyperpipeConfigSGIX), POINTER(Display), c_int, POINTER(c_int)) # GL/glxext.h:868
+PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int) # GL/glxext.h:869
+PFNGLXBINDHYPERPIPESGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int) # GL/glxext.h:870
+PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, c_int, POINTER(None), POINTER(None)) # GL/glxext.h:871
+PFNGLXHYPERPIPEATTRIBSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, c_int, POINTER(None)) # GL/glxext.h:872
+PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, c_int, POINTER(None)) # GL/glxext.h:873
+# MESA_agp_offset (GL/glxext.h:876)
+GLX_MESA_agp_offset = 1 # GL/glxext.h:877
+# GL/glxext.h:879
+glXGetAGPOffsetMESA = _link_function('glXGetAGPOffsetMESA', c_uint, [POINTER(None)], 'MESA_agp_offset')
+
+PFNGLXGETAGPOFFSETMESAPROC = CFUNCTYPE(c_uint, POINTER(None)) # GL/glxext.h:881
+# EXT_fbconfig_packed_float (GL/glxext.h:884)
+GLX_EXT_fbconfig_packed_float = 1 # GL/glxext.h:885
+# EXT_framebuffer_sRGB (GL/glxext.h:888)
+GLX_EXT_framebuffer_sRGB = 1 # GL/glxext.h:889
+# EXT_texture_from_pixmap (GL/glxext.h:892)
+GLX_EXT_texture_from_pixmap = 1 # GL/glxext.h:893
+# GL/glxext.h:895
+glXBindTexImageEXT = _link_function('glXBindTexImageEXT', None, [POINTER(Display), GLXDrawable, c_int, POINTER(c_int)], 'EXT_texture_from_pixmap')
+
+# GL/glxext.h:896
+glXReleaseTexImageEXT = _link_function('glXReleaseTexImageEXT', None, [POINTER(Display), GLXDrawable, c_int], 'EXT_texture_from_pixmap')
+
+PFNGLXBINDTEXIMAGEEXTPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_int, POINTER(c_int)) # GL/glxext.h:898
+PFNGLXRELEASETEXIMAGEEXTPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_int) # GL/glxext.h:899
+# NV_present_video (GL/glxext.h:902)
+GLX_NV_present_video = 1 # GL/glxext.h:903
+# GL/glxext.h:905
+glXEnumerateVideoDevicesNV = _link_function('glXEnumerateVideoDevicesNV', POINTER(c_uint), [POINTER(Display), c_int, POINTER(c_int)], 'NV_present_video')
+
+# GL/glxext.h:906
+glXBindVideoDeviceNV = _link_function('glXBindVideoDeviceNV', c_int, [POINTER(Display), c_uint, c_uint, POINTER(c_int)], 'NV_present_video')
+
+PFNGLXENUMERATEVIDEODEVICESNVPROC = CFUNCTYPE(POINTER(c_uint), POINTER(Display), c_int, POINTER(c_int)) # GL/glxext.h:908
+PFNGLXBINDVIDEODEVICENVPROC = CFUNCTYPE(c_int, POINTER(Display), c_uint, c_uint, POINTER(c_int)) # GL/glxext.h:909
+# NV_video_output (GL/glxext.h:912)
+GLX_NV_video_output = 1 # GL/glxext.h:913
+# GL/glxext.h:915
+glXGetVideoDeviceNV = _link_function('glXGetVideoDeviceNV', c_int, [POINTER(Display), c_int, c_int, POINTER(GLXVideoDeviceNV)], 'NV_video_output')
+
+# GL/glxext.h:916
+glXReleaseVideoDeviceNV = _link_function('glXReleaseVideoDeviceNV', c_int, [POINTER(Display), c_int, GLXVideoDeviceNV], 'NV_video_output')
+
+GLXPbuffer = pyglet.gl.glx.GLXPbuffer
+# GL/glxext.h:917
+glXBindVideoImageNV = _link_function('glXBindVideoImageNV', c_int, [POINTER(Display), GLXVideoDeviceNV, GLXPbuffer, c_int], 'NV_video_output')
+
+# GL/glxext.h:918
+glXReleaseVideoImageNV = _link_function('glXReleaseVideoImageNV', c_int, [POINTER(Display), GLXPbuffer], 'NV_video_output')
+
+GLboolean = c_ubyte # /usr/include/GL/gl.h:154
+# GL/glxext.h:919
+glXSendPbufferToVideoNV = _link_function('glXSendPbufferToVideoNV', c_int, [POINTER(Display), GLXPbuffer, c_int, POINTER(c_ulong), GLboolean], 'NV_video_output')
+
+# GL/glxext.h:920
+glXGetVideoInfoNV = _link_function('glXGetVideoInfoNV', c_int, [POINTER(Display), c_int, GLXVideoDeviceNV, POINTER(c_ulong), POINTER(c_ulong)], 'NV_video_output')
+
+PFNGLXGETVIDEODEVICENVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, POINTER(GLXVideoDeviceNV)) # GL/glxext.h:922
+PFNGLXRELEASEVIDEODEVICENVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, GLXVideoDeviceNV) # GL/glxext.h:923
+PFNGLXBINDVIDEOIMAGENVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXVideoDeviceNV, GLXPbuffer, c_int) # GL/glxext.h:924
+PFNGLXRELEASEVIDEOIMAGENVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXPbuffer) # GL/glxext.h:925
+PFNGLXSENDPBUFFERTOVIDEONVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXPbuffer, c_int, POINTER(c_ulong), GLboolean) # GL/glxext.h:926
+PFNGLXGETVIDEOINFONVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, GLXVideoDeviceNV, POINTER(c_ulong), POINTER(c_ulong)) # GL/glxext.h:927
+# NV_swap_group (GL/glxext.h:930)
+GLX_NV_swap_group = 1 # GL/glxext.h:931
+GLuint = c_uint # /usr/include/GL/gl.h:162
+# GL/glxext.h:933
+glXJoinSwapGroupNV = _link_function('glXJoinSwapGroupNV', c_int, [POINTER(Display), GLXDrawable, GLuint], 'NV_swap_group')
+
+# GL/glxext.h:934
+glXBindSwapBarrierNV = _link_function('glXBindSwapBarrierNV', c_int, [POINTER(Display), GLuint, GLuint], 'NV_swap_group')
+
+# GL/glxext.h:935
+glXQuerySwapGroupNV = _link_function('glXQuerySwapGroupNV', c_int, [POINTER(Display), GLXDrawable, POINTER(GLuint), POINTER(GLuint)], 'NV_swap_group')
+
+# GL/glxext.h:936
+glXQueryMaxSwapGroupsNV = _link_function('glXQueryMaxSwapGroupsNV', c_int, [POINTER(Display), c_int, POINTER(GLuint), POINTER(GLuint)], 'NV_swap_group')
+
+# GL/glxext.h:937
+glXQueryFrameCountNV = _link_function('glXQueryFrameCountNV', c_int, [POINTER(Display), c_int, POINTER(GLuint)], 'NV_swap_group')
+
+# GL/glxext.h:938
+glXResetFrameCountNV = _link_function('glXResetFrameCountNV', c_int, [POINTER(Display), c_int], 'NV_swap_group')
+
+PFNGLXJOINSWAPGROUPNVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, GLuint) # GL/glxext.h:940
+PFNGLXBINDSWAPBARRIERNVPROC = CFUNCTYPE(c_int, POINTER(Display), GLuint, GLuint) # GL/glxext.h:941
+PFNGLXQUERYSWAPGROUPNVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, POINTER(GLuint), POINTER(GLuint)) # GL/glxext.h:942
+PFNGLXQUERYMAXSWAPGROUPSNVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, POINTER(GLuint), POINTER(GLuint)) # GL/glxext.h:943
+PFNGLXQUERYFRAMECOUNTNVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, POINTER(GLuint)) # GL/glxext.h:944
+PFNGLXRESETFRAMECOUNTNVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int) # GL/glxext.h:945
+# NV_video_capture (GL/glxext.h:948)
+GLX_NV_video_capture = 1 # GL/glxext.h:949
+# GL/glxext.h:951
+glXBindVideoCaptureDeviceNV = _link_function('glXBindVideoCaptureDeviceNV', c_int, [POINTER(Display), c_uint, GLXVideoCaptureDeviceNV], 'NV_video_capture')
+
+# GL/glxext.h:952
+glXEnumerateVideoCaptureDevicesNV = _link_function('glXEnumerateVideoCaptureDevicesNV', POINTER(GLXVideoCaptureDeviceNV), [POINTER(Display), c_int, POINTER(c_int)], 'NV_video_capture')
+
+# GL/glxext.h:953
+glXLockVideoCaptureDeviceNV = _link_function('glXLockVideoCaptureDeviceNV', None, [POINTER(Display), GLXVideoCaptureDeviceNV], 'NV_video_capture')
+
+# GL/glxext.h:954
+glXQueryVideoCaptureDeviceNV = _link_function('glXQueryVideoCaptureDeviceNV', c_int, [POINTER(Display), GLXVideoCaptureDeviceNV, c_int, POINTER(c_int)], 'NV_video_capture')
+
+# GL/glxext.h:955
+glXReleaseVideoCaptureDeviceNV = _link_function('glXReleaseVideoCaptureDeviceNV', None, [POINTER(Display), GLXVideoCaptureDeviceNV], 'NV_video_capture')
+
+PFNGLXBINDVIDEOCAPTUREDEVICENVPROC = CFUNCTYPE(c_int, POINTER(Display), c_uint, GLXVideoCaptureDeviceNV) # GL/glxext.h:957
+PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC = CFUNCTYPE(POINTER(GLXVideoCaptureDeviceNV), POINTER(Display), c_int, POINTER(c_int)) # GL/glxext.h:958
+PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC = CFUNCTYPE(None, POINTER(Display), GLXVideoCaptureDeviceNV) # GL/glxext.h:959
+PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXVideoCaptureDeviceNV, c_int, POINTER(c_int)) # GL/glxext.h:960
+PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC = CFUNCTYPE(None, POINTER(Display), GLXVideoCaptureDeviceNV) # GL/glxext.h:961
+# EXT_swap_control (GL/glxext.h:964)
+GLX_EXT_swap_control = 1 # GL/glxext.h:965
+# GL/glxext.h:967
+glXSwapIntervalEXT = _link_function('glXSwapIntervalEXT', c_int, [POINTER(Display), GLXDrawable, c_int], 'EXT_swap_control')
+
+PFNGLXSWAPINTERVALEXTPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, c_int) # GL/glxext.h:969
+# NV_copy_image (GL/glxext.h:972)
+GLX_NV_copy_image = 1 # GL/glxext.h:973
+GLint = c_int # /usr/include/GL/gl.h:159
+GLsizei = c_int # /usr/include/GL/gl.h:163
+# GL/glxext.h:975
+glXCopyImageSubDataNV = _link_function('glXCopyImageSubDataNV', None, [POINTER(Display), GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei], 'NV_copy_image')
+
+PFNGLXCOPYIMAGESUBDATANVPROC = CFUNCTYPE(None, POINTER(Display), GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei) # GL/glxext.h:977
+# INTEL_swap_event (GL/glxext.h:980)
+GLX_INTEL_swap_event = 1 # GL/glxext.h:981
+# NV_multisample_coverage (GL/glxext.h:984)
+GLX_NV_multisample_coverage = 1 # GL/glxext.h:985
+# NV_vertex_array_range (/usr/include/GL/glx.h:349)
+# MESA_allocate_memory (/usr/include/GL/glx.h:363)
+# ARB_render_texture (/usr/include/GL/glx.h:380)
+# NV_float_buffer (/usr/include/GL/glx.h:393)
+# MESA_swap_frame_usage (/usr/include/GL/glx.h:405)
+# MESA_swap_control (/usr/include/GL/glx.h:425)
+# EXT_texture_from_pixmap (/usr/include/GL/glx.h:442)
+
+__all__ = ['GLX_GLXEXT_VERSION', 'GLX_SAMPLE_BUFFERS_ARB', 'GLX_SAMPLES_ARB',
+'GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB', 'GLX_RGBA_FLOAT_TYPE_ARB',
+'GLX_RGBA_FLOAT_BIT_ARB', 'GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB',
+'GLX_CONTEXT_DEBUG_BIT_ARB', 'GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB',
+'GLX_CONTEXT_MAJOR_VERSION_ARB', 'GLX_CONTEXT_MINOR_VERSION_ARB',
+'GLX_CONTEXT_FLAGS_ARB', 'GLX_CONTEXT_CORE_PROFILE_BIT_ARB',
+'GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB', 'GLX_CONTEXT_PROFILE_MASK_ARB',
+'GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB', 'GLX_LOSE_CONTEXT_ON_RESET_ARB',
+'GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB',
+'GLX_NO_RESET_NOTIFICATION_ARB', 'GLX_SAMPLE_BUFFERS_SGIS',
+'GLX_SAMPLES_SGIS', 'GLX_X_VISUAL_TYPE_EXT', 'GLX_TRANSPARENT_TYPE_EXT',
+'GLX_TRANSPARENT_INDEX_VALUE_EXT', 'GLX_TRANSPARENT_RED_VALUE_EXT',
+'GLX_TRANSPARENT_GREEN_VALUE_EXT', 'GLX_TRANSPARENT_BLUE_VALUE_EXT',
+'GLX_TRANSPARENT_ALPHA_VALUE_EXT', 'GLX_NONE_EXT', 'GLX_TRUE_COLOR_EXT',
+'GLX_DIRECT_COLOR_EXT', 'GLX_PSEUDO_COLOR_EXT', 'GLX_STATIC_COLOR_EXT',
+'GLX_GRAY_SCALE_EXT', 'GLX_STATIC_GRAY_EXT', 'GLX_TRANSPARENT_RGB_EXT',
+'GLX_TRANSPARENT_INDEX_EXT', 'GLX_VISUAL_CAVEAT_EXT', 'GLX_SLOW_VISUAL_EXT',
+'GLX_NON_CONFORMANT_VISUAL_EXT', 'GLX_SHARE_CONTEXT_EXT', 'GLX_VISUAL_ID_EXT',
+'GLX_SCREEN_EXT', 'GLX_WINDOW_BIT_SGIX', 'GLX_PIXMAP_BIT_SGIX',
+'GLX_RGBA_BIT_SGIX', 'GLX_COLOR_INDEX_BIT_SGIX', 'GLX_DRAWABLE_TYPE_SGIX',
+'GLX_RENDER_TYPE_SGIX', 'GLX_X_RENDERABLE_SGIX', 'GLX_FBCONFIG_ID_SGIX',
+'GLX_RGBA_TYPE_SGIX', 'GLX_COLOR_INDEX_TYPE_SGIX', 'GLX_PBUFFER_BIT_SGIX',
+'GLX_BUFFER_CLOBBER_MASK_SGIX', 'GLX_FRONT_LEFT_BUFFER_BIT_SGIX',
+'GLX_FRONT_RIGHT_BUFFER_BIT_SGIX', 'GLX_BACK_LEFT_BUFFER_BIT_SGIX',
+'GLX_BACK_RIGHT_BUFFER_BIT_SGIX', 'GLX_AUX_BUFFERS_BIT_SGIX',
+'GLX_DEPTH_BUFFER_BIT_SGIX', 'GLX_STENCIL_BUFFER_BIT_SGIX',
+'GLX_ACCUM_BUFFER_BIT_SGIX', 'GLX_SAMPLE_BUFFERS_BIT_SGIX',
+'GLX_MAX_PBUFFER_WIDTH_SGIX', 'GLX_MAX_PBUFFER_HEIGHT_SGIX',
+'GLX_MAX_PBUFFER_PIXELS_SGIX', 'GLX_OPTIMAL_PBUFFER_WIDTH_SGIX',
+'GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX', 'GLX_PRESERVED_CONTENTS_SGIX',
+'GLX_LARGEST_PBUFFER_SGIX', 'GLX_WIDTH_SGIX', 'GLX_HEIGHT_SGIX',
+'GLX_EVENT_MASK_SGIX', 'GLX_DAMAGED_SGIX', 'GLX_SAVED_SGIX',
+'GLX_WINDOW_SGIX', 'GLX_PBUFFER_SGIX', 'GLX_SYNC_FRAME_SGIX',
+'GLX_SYNC_SWAP_SGIX', 'GLX_DIGITAL_MEDIA_PBUFFER_SGIX',
+'GLX_BLENDED_RGBA_SGIS', 'GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS',
+'GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS', 'GLX_SAMPLE_BUFFERS_3DFX',
+'GLX_SAMPLES_3DFX', 'GLX_3DFX_WINDOW_MODE_MESA',
+'GLX_3DFX_FULLSCREEN_MODE_MESA', 'GLX_VISUAL_SELECT_GROUP_SGIX',
+'GLX_SWAP_METHOD_OML', 'GLX_SWAP_EXCHANGE_OML', 'GLX_SWAP_COPY_OML',
+'GLX_SWAP_UNDEFINED_OML', 'GLX_FLOAT_COMPONENTS_NV',
+'GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX', 'GLX_BAD_HYPERPIPE_CONFIG_SGIX',
+'GLX_BAD_HYPERPIPE_SGIX', 'GLX_HYPERPIPE_DISPLAY_PIPE_SGIX',
+'GLX_HYPERPIPE_RENDER_PIPE_SGIX', 'GLX_PIPE_RECT_SGIX',
+'GLX_PIPE_RECT_LIMITS_SGIX', 'GLX_HYPERPIPE_STEREO_SGIX',
+'GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX', 'GLX_HYPERPIPE_ID_SGIX',
+'GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT', 'GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT',
+'GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT', 'GLX_TEXTURE_1D_BIT_EXT',
+'GLX_TEXTURE_2D_BIT_EXT', 'GLX_TEXTURE_RECTANGLE_BIT_EXT',
+'GLX_BIND_TO_TEXTURE_RGB_EXT', 'GLX_BIND_TO_TEXTURE_RGBA_EXT',
+'GLX_BIND_TO_MIPMAP_TEXTURE_EXT', 'GLX_BIND_TO_TEXTURE_TARGETS_EXT',
+'GLX_Y_INVERTED_EXT', 'GLX_TEXTURE_FORMAT_EXT', 'GLX_TEXTURE_TARGET_EXT',
+'GLX_MIPMAP_TEXTURE_EXT', 'GLX_TEXTURE_FORMAT_NONE_EXT',
+'GLX_TEXTURE_FORMAT_RGB_EXT', 'GLX_TEXTURE_FORMAT_RGBA_EXT',
+'GLX_TEXTURE_1D_EXT', 'GLX_TEXTURE_2D_EXT', 'GLX_TEXTURE_RECTANGLE_EXT',
+'GLX_FRONT_LEFT_EXT', 'GLX_FRONT_RIGHT_EXT', 'GLX_BACK_LEFT_EXT',
+'GLX_BACK_RIGHT_EXT', 'GLX_FRONT_EXT', 'GLX_BACK_EXT', 'GLX_AUX0_EXT',
+'GLX_AUX1_EXT', 'GLX_AUX2_EXT', 'GLX_AUX3_EXT', 'GLX_AUX4_EXT',
+'GLX_AUX5_EXT', 'GLX_AUX6_EXT', 'GLX_AUX7_EXT', 'GLX_AUX8_EXT',
+'GLX_AUX9_EXT', 'GLX_NUM_VIDEO_SLOTS_NV', 'GLX_VIDEO_OUT_COLOR_NV',
+'GLX_VIDEO_OUT_ALPHA_NV', 'GLX_VIDEO_OUT_DEPTH_NV',
+'GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV', 'GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV',
+'GLX_VIDEO_OUT_FRAME_NV', 'GLX_VIDEO_OUT_FIELD_1_NV',
+'GLX_VIDEO_OUT_FIELD_2_NV', 'GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV',
+'GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV', 'GLX_DEVICE_ID_NV', 'GLX_UNIQUE_ID_NV',
+'GLX_NUM_VIDEO_CAPTURE_SLOTS_NV', 'GLX_SWAP_INTERVAL_EXT',
+'GLX_MAX_SWAP_INTERVAL_EXT', 'GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK',
+'GLX_EXCHANGE_COMPLETE_INTEL', 'GLX_COPY_COMPLETE_INTEL',
+'GLX_FLIP_COMPLETE_INTEL', 'GLX_COVERAGE_SAMPLES_NV', 'GLX_COLOR_SAMPLES_NV',
+'GLX_GPU_VENDOR_AMD', 'GLX_GPU_RENDERER_STRING_AMD',
+'GLX_GPU_OPENGL_VERSION_STRING_AMD', 'GLX_GPU_FASTEST_TARGET_GPUS_AMD',
+'GLX_GPU_RAM_AMD', 'GLX_GPU_CLOCK_AMD', 'GLX_GPU_NUM_PIPES_AMD',
+'GLX_GPU_NUM_SIMD_AMD', 'GLX_GPU_NUM_RB_AMD', 'GLX_GPU_NUM_SPI_AMD',
+'GLX_CONTEXT_ES2_PROFILE_BIT_EXT', 'GLXVideoSourceSGIX', 'GLXFBConfigIDSGIX',
+'GLXFBConfigSGIX', 'GLXPbufferSGIX', 'GLXBufferClobberEventSGIX',
+'GLXVideoDeviceNV', 'GLXVideoCaptureDeviceNV', 'GLX_ARB_multisample',
+'GLX_ARB_fbconfig_float', 'GLX_ARB_framebuffer_sRGB',
+'GLX_ARB_create_context', 'glXCreateContextAttribsARB',
+'PFNGLXCREATECONTEXTATTRIBSARBPROC', 'GLX_ARB_create_context_profile',
+'GLX_ARB_create_context_robustness', 'GLX_SGIS_multisample',
+'GLX_EXT_visual_info', 'GLX_SGI_swap_control', 'glXSwapIntervalSGI',
+'PFNGLXSWAPINTERVALSGIPROC', 'GLX_SGI_video_sync', 'glXGetVideoSyncSGI',
+'glXWaitVideoSyncSGI', 'PFNGLXGETVIDEOSYNCSGIPROC',
+'PFNGLXWAITVIDEOSYNCSGIPROC', 'GLX_SGI_make_current_read',
+'glXMakeCurrentReadSGI', 'glXGetCurrentReadDrawableSGI',
+'PFNGLXMAKECURRENTREADSGIPROC', 'PFNGLXGETCURRENTREADDRAWABLESGIPROC',
+'GLX_SGIX_video_source', 'GLX_EXT_visual_rating', 'GLX_EXT_import_context',
+'glXGetCurrentDisplayEXT', 'glXQueryContextInfoEXT', 'glXGetContextIDEXT',
+'glXImportContextEXT', 'glXFreeContextEXT', 'PFNGLXGETCURRENTDISPLAYEXTPROC',
+'PFNGLXQUERYCONTEXTINFOEXTPROC', 'PFNGLXGETCONTEXTIDEXTPROC',
+'PFNGLXIMPORTCONTEXTEXTPROC', 'PFNGLXFREECONTEXTEXTPROC', 'GLX_SGIX_fbconfig',
+'glXGetFBConfigAttribSGIX', 'glXChooseFBConfigSGIX',
+'glXCreateGLXPixmapWithConfigSGIX', 'glXCreateContextWithConfigSGIX',
+'glXGetVisualFromFBConfigSGIX', 'glXGetFBConfigFromVisualSGIX',
+'PFNGLXGETFBCONFIGATTRIBSGIXPROC', 'PFNGLXCHOOSEFBCONFIGSGIXPROC',
+'PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC',
+'PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC',
+'PFNGLXGETVISUALFROMFBCONFIGSGIXPROC', 'PFNGLXGETFBCONFIGFROMVISUALSGIXPROC',
+'GLX_SGIX_pbuffer', 'glXCreateGLXPbufferSGIX', 'glXDestroyGLXPbufferSGIX',
+'glXQueryGLXPbufferSGIX', 'glXSelectEventSGIX', 'glXGetSelectedEventSGIX',
+'PFNGLXCREATEGLXPBUFFERSGIXPROC', 'PFNGLXDESTROYGLXPBUFFERSGIXPROC',
+'PFNGLXQUERYGLXPBUFFERSGIXPROC', 'PFNGLXSELECTEVENTSGIXPROC',
+'PFNGLXGETSELECTEDEVENTSGIXPROC', 'GLX_SGI_cushion', 'glXCushionSGI',
+'PFNGLXCUSHIONSGIPROC', 'GLX_SGIX_video_resize', 'glXBindChannelToWindowSGIX',
+'glXChannelRectSGIX', 'glXQueryChannelRectSGIX', 'glXQueryChannelDeltasSGIX',
+'glXChannelRectSyncSGIX', 'PFNGLXBINDCHANNELTOWINDOWSGIXPROC',
+'PFNGLXCHANNELRECTSGIXPROC', 'PFNGLXQUERYCHANNELRECTSGIXPROC',
+'PFNGLXQUERYCHANNELDELTASSGIXPROC', 'PFNGLXCHANNELRECTSYNCSGIXPROC',
+'GLX_SGIX_dmbuffer', 'GLX_SGIX_swap_group', 'glXJoinSwapGroupSGIX',
+'PFNGLXJOINSWAPGROUPSGIXPROC', 'GLX_SGIX_swap_barrier',
+'glXBindSwapBarrierSGIX', 'glXQueryMaxSwapBarriersSGIX',
+'PFNGLXBINDSWAPBARRIERSGIXPROC', 'PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC',
+'GLX_SUN_get_transparent_index', 'glXGetTransparentIndexSUN',
+'PFNGLXGETTRANSPARENTINDEXSUNPROC', 'GLX_MESA_copy_sub_buffer',
+'glXCopySubBufferMESA', 'PFNGLXCOPYSUBBUFFERMESAPROC',
+'GLX_MESA_pixmap_colormap', 'glXCreateGLXPixmapMESA',
+'PFNGLXCREATEGLXPIXMAPMESAPROC', 'GLX_MESA_release_buffers',
+'glXReleaseBuffersMESA', 'PFNGLXRELEASEBUFFERSMESAPROC',
+'GLX_MESA_set_3dfx_mode', 'glXSet3DfxModeMESA', 'PFNGLXSET3DFXMODEMESAPROC',
+'GLX_SGIX_visual_select_group', 'GLX_OML_swap_method', 'GLX_OML_sync_control',
+'glXGetSyncValuesOML', 'glXGetMscRateOML', 'glXSwapBuffersMscOML',
+'glXWaitForMscOML', 'glXWaitForSbcOML', 'PFNGLXGETSYNCVALUESOMLPROC',
+'PFNGLXGETMSCRATEOMLPROC', 'PFNGLXSWAPBUFFERSMSCOMLPROC',
+'PFNGLXWAITFORMSCOMLPROC', 'PFNGLXWAITFORSBCOMLPROC', 'GLX_NV_float_buffer',
+'GLX_SGIX_hyperpipe', 'GLXHyperpipeNetworkSGIX', 'GLXHyperpipeConfigSGIX',
+'GLXPipeRect', 'GLXPipeRectLimits', 'glXQueryHyperpipeNetworkSGIX',
+'glXHyperpipeConfigSGIX', 'glXQueryHyperpipeConfigSGIX',
+'glXDestroyHyperpipeConfigSGIX', 'glXBindHyperpipeSGIX',
+'glXQueryHyperpipeBestAttribSGIX', 'glXHyperpipeAttribSGIX',
+'glXQueryHyperpipeAttribSGIX', 'PFNGLXQUERYHYPERPIPENETWORKSGIXPROC',
+'PFNGLXHYPERPIPECONFIGSGIXPROC', 'PFNGLXQUERYHYPERPIPECONFIGSGIXPROC',
+'PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC', 'PFNGLXBINDHYPERPIPESGIXPROC',
+'PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC', 'PFNGLXHYPERPIPEATTRIBSGIXPROC',
+'PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC', 'GLX_MESA_agp_offset',
+'glXGetAGPOffsetMESA', 'PFNGLXGETAGPOFFSETMESAPROC',
+'GLX_EXT_fbconfig_packed_float', 'GLX_EXT_framebuffer_sRGB',
+'GLX_EXT_texture_from_pixmap', 'glXBindTexImageEXT', 'glXReleaseTexImageEXT',
+'PFNGLXBINDTEXIMAGEEXTPROC', 'PFNGLXRELEASETEXIMAGEEXTPROC',
+'GLX_NV_present_video', 'glXEnumerateVideoDevicesNV', 'glXBindVideoDeviceNV',
+'PFNGLXENUMERATEVIDEODEVICESNVPROC', 'PFNGLXBINDVIDEODEVICENVPROC',
+'GLX_NV_video_output', 'glXGetVideoDeviceNV', 'glXReleaseVideoDeviceNV',
+'glXBindVideoImageNV', 'glXReleaseVideoImageNV', 'glXSendPbufferToVideoNV',
+'glXGetVideoInfoNV', 'PFNGLXGETVIDEODEVICENVPROC',
+'PFNGLXRELEASEVIDEODEVICENVPROC', 'PFNGLXBINDVIDEOIMAGENVPROC',
+'PFNGLXRELEASEVIDEOIMAGENVPROC', 'PFNGLXSENDPBUFFERTOVIDEONVPROC',
+'PFNGLXGETVIDEOINFONVPROC', 'GLX_NV_swap_group', 'glXJoinSwapGroupNV',
+'glXBindSwapBarrierNV', 'glXQuerySwapGroupNV', 'glXQueryMaxSwapGroupsNV',
+'glXQueryFrameCountNV', 'glXResetFrameCountNV', 'PFNGLXJOINSWAPGROUPNVPROC',
+'PFNGLXBINDSWAPBARRIERNVPROC', 'PFNGLXQUERYSWAPGROUPNVPROC',
+'PFNGLXQUERYMAXSWAPGROUPSNVPROC', 'PFNGLXQUERYFRAMECOUNTNVPROC',
+'PFNGLXRESETFRAMECOUNTNVPROC', 'GLX_NV_video_capture',
+'glXBindVideoCaptureDeviceNV', 'glXEnumerateVideoCaptureDevicesNV',
+'glXLockVideoCaptureDeviceNV', 'glXQueryVideoCaptureDeviceNV',
+'glXReleaseVideoCaptureDeviceNV', 'PFNGLXBINDVIDEOCAPTUREDEVICENVPROC',
+'PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC',
+'PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC', 'PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC',
+'PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC', 'GLX_EXT_swap_control',
+'glXSwapIntervalEXT', 'PFNGLXSWAPINTERVALEXTPROC', 'GLX_NV_copy_image',
+'glXCopyImageSubDataNV', 'PFNGLXCOPYIMAGESUBDATANVPROC',
+'GLX_INTEL_swap_event', 'GLX_NV_multisample_coverage']
+# END GENERATED CONTENT (do not edit above this line)
+
+
+
+
+
+
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glxext_mesa.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glxext_mesa.py
new file mode 100644
index 0000000..b16160a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glxext_mesa.py
@@ -0,0 +1,45 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+'''This file is currently hand-coded; I don't have a MESA header file to build
+off.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import ctypes
+from ctypes import *
+from pyglet.gl.lib import link_GLX as _link_function
+
+glXSwapIntervalMESA = _link_function('glXSwapIntervalMESA', c_int, [c_int], 'MESA_swap_control')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glxext_nv.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glxext_nv.py
new file mode 100644
index 0000000..c11309d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/glxext_nv.py
@@ -0,0 +1,835 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+'''Wrapper for http://developer.download.nvidia.com/opengl/includes/glxext.h
+
+Generated by tools/gengl.py.
+Do not modify this file.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+from ctypes import *
+from pyglet.gl.lib import link_GLX as _link_function
+from pyglet.gl.lib import c_ptrdiff_t
+# BEGIN GENERATED CONTENT (do not edit below this line)
+
+# This content is generated by tools/gengl.py.
+# Wrapper for http://developer.download.nvidia.com/opengl/includes/glxext.h
+
+import pyglet.libs.x11.xlib
+import pyglet.gl.glx
+
+# H (/usr/include/GL/glx.h:26)
+# ARB_get_proc_address (/usr/include/GL/glx.h:317)
+# GLXEXT_LEGACY (/usr/include/GL/glx.h:334)
+GLX_GLXEXT_VERSION = 10 # GL/glxext.h:57
+# ARB_get_proc_address (GL/glxext.h:59)
+# ARB_multisample (GL/glxext.h:62)
+GLX_SAMPLE_BUFFERS_ARB = 100000 # GL/glxext.h:63
+GLX_SAMPLES_ARB = 100001 # GL/glxext.h:64
+# ARB_fbconfig_float (GL/glxext.h:67)
+GLX_RGBA_FLOAT_TYPE_ARB = 8377 # GL/glxext.h:68
+GLX_RGBA_FLOAT_BIT_ARB = 4 # GL/glxext.h:69
+# SGIS_multisample (GL/glxext.h:72)
+GLX_SAMPLE_BUFFERS_SGIS = 100000 # GL/glxext.h:73
+GLX_SAMPLES_SGIS = 100001 # GL/glxext.h:74
+# EXT_visual_info (GL/glxext.h:77)
+GLX_X_VISUAL_TYPE_EXT = 34 # GL/glxext.h:78
+GLX_TRANSPARENT_TYPE_EXT = 35 # GL/glxext.h:79
+GLX_TRANSPARENT_INDEX_VALUE_EXT = 36 # GL/glxext.h:80
+GLX_TRANSPARENT_RED_VALUE_EXT = 37 # GL/glxext.h:81
+GLX_TRANSPARENT_GREEN_VALUE_EXT = 38 # GL/glxext.h:82
+GLX_TRANSPARENT_BLUE_VALUE_EXT = 39 # GL/glxext.h:83
+GLX_TRANSPARENT_ALPHA_VALUE_EXT = 40 # GL/glxext.h:84
+GLX_NONE_EXT = 32768 # GL/glxext.h:85
+GLX_TRUE_COLOR_EXT = 32770 # GL/glxext.h:86
+GLX_DIRECT_COLOR_EXT = 32771 # GL/glxext.h:87
+GLX_PSEUDO_COLOR_EXT = 32772 # GL/glxext.h:88
+GLX_STATIC_COLOR_EXT = 32773 # GL/glxext.h:89
+GLX_GRAY_SCALE_EXT = 32774 # GL/glxext.h:90
+GLX_STATIC_GRAY_EXT = 32775 # GL/glxext.h:91
+GLX_TRANSPARENT_RGB_EXT = 32776 # GL/glxext.h:92
+GLX_TRANSPARENT_INDEX_EXT = 32777 # GL/glxext.h:93
+# SGI_swap_control (GL/glxext.h:96)
+# SGI_video_sync (GL/glxext.h:99)
+# SGI_make_current_read (GL/glxext.h:102)
+# SGIX_video_source (GL/glxext.h:105)
+# EXT_visual_rating (GL/glxext.h:108)
+GLX_VISUAL_CAVEAT_EXT = 32 # GL/glxext.h:109
+GLX_SLOW_VISUAL_EXT = 32769 # GL/glxext.h:110
+GLX_NON_CONFORMANT_VISUAL_EXT = 32781 # GL/glxext.h:111
+# EXT_import_context (GL/glxext.h:115)
+GLX_SHARE_CONTEXT_EXT = 32778 # GL/glxext.h:116
+GLX_VISUAL_ID_EXT = 32779 # GL/glxext.h:117
+GLX_SCREEN_EXT = 32780 # GL/glxext.h:118
+# SGIX_fbconfig (GL/glxext.h:121)
+GLX_WINDOW_BIT_SGIX = 1 # GL/glxext.h:122
+GLX_PIXMAP_BIT_SGIX = 2 # GL/glxext.h:123
+GLX_RGBA_BIT_SGIX = 1 # GL/glxext.h:124
+GLX_COLOR_INDEX_BIT_SGIX = 2 # GL/glxext.h:125
+GLX_DRAWABLE_TYPE_SGIX = 32784 # GL/glxext.h:126
+GLX_RENDER_TYPE_SGIX = 32785 # GL/glxext.h:127
+GLX_X_RENDERABLE_SGIX = 32786 # GL/glxext.h:128
+GLX_FBCONFIG_ID_SGIX = 32787 # GL/glxext.h:129
+GLX_RGBA_TYPE_SGIX = 32788 # GL/glxext.h:130
+GLX_COLOR_INDEX_TYPE_SGIX = 32789 # GL/glxext.h:131
+# SGIX_pbuffer (GL/glxext.h:135)
+GLX_PBUFFER_BIT_SGIX = 4 # GL/glxext.h:136
+GLX_BUFFER_CLOBBER_MASK_SGIX = 134217728 # GL/glxext.h:137
+GLX_FRONT_LEFT_BUFFER_BIT_SGIX = 1 # GL/glxext.h:138
+GLX_FRONT_RIGHT_BUFFER_BIT_SGIX = 2 # GL/glxext.h:139
+GLX_BACK_LEFT_BUFFER_BIT_SGIX = 4 # GL/glxext.h:140
+GLX_BACK_RIGHT_BUFFER_BIT_SGIX = 8 # GL/glxext.h:141
+GLX_AUX_BUFFERS_BIT_SGIX = 16 # GL/glxext.h:142
+GLX_DEPTH_BUFFER_BIT_SGIX = 32 # GL/glxext.h:143
+GLX_STENCIL_BUFFER_BIT_SGIX = 64 # GL/glxext.h:144
+GLX_ACCUM_BUFFER_BIT_SGIX = 128 # GL/glxext.h:145
+GLX_SAMPLE_BUFFERS_BIT_SGIX = 256 # GL/glxext.h:146
+GLX_MAX_PBUFFER_WIDTH_SGIX = 32790 # GL/glxext.h:147
+GLX_MAX_PBUFFER_HEIGHT_SGIX = 32791 # GL/glxext.h:148
+GLX_MAX_PBUFFER_PIXELS_SGIX = 32792 # GL/glxext.h:149
+GLX_OPTIMAL_PBUFFER_WIDTH_SGIX = 32793 # GL/glxext.h:150
+GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX = 32794 # GL/glxext.h:151
+GLX_PRESERVED_CONTENTS_SGIX = 32795 # GL/glxext.h:152
+GLX_LARGEST_PBUFFER_SGIX = 32796 # GL/glxext.h:153
+GLX_WIDTH_SGIX = 32797 # GL/glxext.h:154
+GLX_HEIGHT_SGIX = 32798 # GL/glxext.h:155
+GLX_EVENT_MASK_SGIX = 32799 # GL/glxext.h:156
+GLX_DAMAGED_SGIX = 32800 # GL/glxext.h:157
+GLX_SAVED_SGIX = 32801 # GL/glxext.h:158
+GLX_WINDOW_SGIX = 32802 # GL/glxext.h:159
+GLX_PBUFFER_SGIX = 32803 # GL/glxext.h:160
+# SGI_cushion (GL/glxext.h:163)
+# SGIX_video_resize (GL/glxext.h:166)
+GLX_SYNC_FRAME_SGIX = 0 # GL/glxext.h:167
+GLX_SYNC_SWAP_SGIX = 1 # GL/glxext.h:168
+# SGIX_dmbuffer (GL/glxext.h:171)
+GLX_DIGITAL_MEDIA_PBUFFER_SGIX = 32804 # GL/glxext.h:172
+# SGIX_swap_group (GL/glxext.h:175)
+# SGIX_swap_barrier (GL/glxext.h:178)
+# SGIS_blended_overlay (GL/glxext.h:181)
+GLX_BLENDED_RGBA_SGIS = 32805 # GL/glxext.h:182
+# SGIS_shared_multisample (GL/glxext.h:185)
+GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS = 32806 # GL/glxext.h:186
+GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS = 32807 # GL/glxext.h:187
+# SUN_get_transparent_index (GL/glxext.h:190)
+# 3DFX_multisample (GL/glxext.h:193)
+GLX_SAMPLE_BUFFERS_3DFX = 32848 # GL/glxext.h:194
+GLX_SAMPLES_3DFX = 32849 # GL/glxext.h:195
+# MESA_copy_sub_buffer (GL/glxext.h:198)
+# MESA_pixmap_colormap (GL/glxext.h:201)
+# MESA_release_buffers (GL/glxext.h:204)
+# MESA_set_3dfx_mode (GL/glxext.h:207)
+GLX_3DFX_WINDOW_MODE_MESA = 1 # GL/glxext.h:208
+GLX_3DFX_FULLSCREEN_MODE_MESA = 2 # GL/glxext.h:209
+# SGIX_visual_select_group (GL/glxext.h:212)
+GLX_VISUAL_SELECT_GROUP_SGIX = 32808 # GL/glxext.h:213
+# OML_swap_method (GL/glxext.h:216)
+GLX_SWAP_METHOD_OML = 32864 # GL/glxext.h:217
+GLX_SWAP_EXCHANGE_OML = 32865 # GL/glxext.h:218
+GLX_SWAP_COPY_OML = 32866 # GL/glxext.h:219
+GLX_SWAP_UNDEFINED_OML = 32867 # GL/glxext.h:220
+# OML_sync_control (GL/glxext.h:223)
+# NV_float_buffer (GL/glxext.h:226)
+GLX_FLOAT_COMPONENTS_NV = 8368 # GL/glxext.h:227
+# SGIX_hyperpipe (GL/glxext.h:230)
+GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX = 80 # GL/glxext.h:231
+GLX_BAD_HYPERPIPE_CONFIG_SGIX = 91 # GL/glxext.h:232
+GLX_BAD_HYPERPIPE_SGIX = 92 # GL/glxext.h:233
+GLX_HYPERPIPE_DISPLAY_PIPE_SGIX = 1 # GL/glxext.h:234
+GLX_HYPERPIPE_RENDER_PIPE_SGIX = 2 # GL/glxext.h:235
+GLX_PIPE_RECT_SGIX = 1 # GL/glxext.h:236
+GLX_PIPE_RECT_LIMITS_SGIX = 2 # GL/glxext.h:237
+GLX_HYPERPIPE_STEREO_SGIX = 3 # GL/glxext.h:238
+GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX = 4 # GL/glxext.h:239
+GLX_HYPERPIPE_ID_SGIX = 32816 # GL/glxext.h:240
+# MESA_agp_offset (GL/glxext.h:243)
+# ARB_get_proc_address (GL/glxext.h:249)
+# SGIX_video_source (GL/glxext.h:256)
+XID = pyglet.libs.x11.xlib.XID
+GLXVideoSourceSGIX = XID # GL/glxext.h:257
+# SGIX_fbconfig (GL/glxext.h:260)
+GLXFBConfigIDSGIX = XID # GL/glxext.h:261
+class struct___GLXFBConfigRec(Structure):
+ __slots__ = [
+ ]
+struct___GLXFBConfigRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct___GLXFBConfigRec(Structure):
+ __slots__ = [
+ ]
+struct___GLXFBConfigRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+GLXFBConfigSGIX = POINTER(struct___GLXFBConfigRec) # GL/glxext.h:262
+# SGIX_pbuffer (GL/glxext.h:265)
+GLXPbufferSGIX = XID # GL/glxext.h:266
+class struct_anon_106(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'drawable',
+ 'event_type',
+ 'draw_type',
+ 'mask',
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'count',
+ ]
+Display = pyglet.libs.x11.xlib.Display
+GLXDrawable = pyglet.gl.glx.GLXDrawable
+struct_anon_106._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('drawable', GLXDrawable),
+ ('event_type', c_int),
+ ('draw_type', c_int),
+ ('mask', c_uint),
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('count', c_int),
+]
+
+GLXBufferClobberEventSGIX = struct_anon_106 # GL/glxext.h:279
+# NV_swap_group (GL/glxext.h:282)
+# NV_video_out (GL/glxext.h:285)
+GLXVideoDeviceNV = c_uint # GL/glxext.h:290
+GLX_VIDEO_OUT_COLOR_NV = 8387 # GL/glxext.h:293
+GLX_VIDEO_OUT_ALPHA_NV = 8388 # GL/glxext.h:294
+GLX_VIDEO_OUT_DEPTH_NV = 8389 # GL/glxext.h:295
+GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV = 8390 # GL/glxext.h:296
+GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV = 8391 # GL/glxext.h:297
+GLX_VIDEO_OUT_FRAME_NV = 8392 # GL/glxext.h:300
+GLX_VIDEO_OUT_FIELD_1_NV = 8393 # GL/glxext.h:301
+GLX_VIDEO_OUT_FIELD_2_NV = 8394 # GL/glxext.h:302
+# EXT_texture_from_pixmap (GL/glxext.h:305)
+GLX_BIND_TO_TEXTURE_RGB_EXT = 8400 # GL/glxext.h:307
+GLX_BIND_TO_TEXTURE_RGBA_EXT = 8401 # GL/glxext.h:308
+GLX_BIND_TO_MIPMAP_TEXTURE_EXT = 8402 # GL/glxext.h:309
+GLX_BIND_TO_TEXTURE_TARGETS_EXT = 8403 # GL/glxext.h:310
+GLX_Y_INVERTED_EXT = 8404 # GL/glxext.h:311
+GLX_TEXTURE_FORMAT_EXT = 8405 # GL/glxext.h:314
+GLX_TEXTURE_TARGET_EXT = 8406 # GL/glxext.h:315
+GLX_MIPMAP_TEXTURE_EXT = 8407 # GL/glxext.h:316
+GLX_TEXTURE_FORMAT_NONE_EXT = 8408 # GL/glxext.h:319
+GLX_TEXTURE_FORMAT_RGB_EXT = 8409 # GL/glxext.h:320
+GLX_TEXTURE_FORMAT_RGBA_EXT = 8410 # GL/glxext.h:321
+GLX_TEXTURE_1D_BIT_EXT = 1 # GL/glxext.h:324
+GLX_TEXTURE_2D_BIT_EXT = 2 # GL/glxext.h:325
+GLX_TEXTURE_RECTANGLE_BIT_EXT = 4 # GL/glxext.h:326
+GLX_TEXTURE_1D_EXT = 8411 # GL/glxext.h:329
+GLX_TEXTURE_2D_EXT = 8412 # GL/glxext.h:330
+GLX_TEXTURE_RECTANGLE_EXT = 8413 # GL/glxext.h:331
+GLX_FRONT_LEFT_EXT = 8414 # GL/glxext.h:337
+GLX_FRONT_RIGHT_EXT = 8415 # GL/glxext.h:338
+GLX_BACK_LEFT_EXT = 8416 # GL/glxext.h:339
+GLX_BACK_RIGHT_EXT = 8417 # GL/glxext.h:340
+GLX_FRONT_EXT = 8414 # GL/glxext.h:341
+GLX_BACK_EXT = 8416 # GL/glxext.h:342
+GLX_AUX0_EXT = 8418 # GL/glxext.h:343
+GLX_AUX1_EXT = 8419 # GL/glxext.h:344
+GLX_AUX2_EXT = 8420 # GL/glxext.h:345
+GLX_AUX3_EXT = 8421 # GL/glxext.h:346
+GLX_AUX4_EXT = 8422 # GL/glxext.h:347
+GLX_AUX5_EXT = 8423 # GL/glxext.h:348
+GLX_AUX6_EXT = 8424 # GL/glxext.h:349
+GLX_AUX7_EXT = 8425 # GL/glxext.h:350
+GLX_AUX8_EXT = 8426 # GL/glxext.h:351
+GLX_AUX9_EXT = 8427 # GL/glxext.h:352
+# ARB_get_proc_address (GL/glxext.h:373)
+# ARB_multisample (GL/glxext.h:377)
+GLX_ARB_multisample = 1 # GL/glxext.h:378
+# ARB_fbconfig_float (GL/glxext.h:381)
+GLX_ARB_fbconfig_float = 1 # GL/glxext.h:382
+# SGIS_multisample (GL/glxext.h:385)
+GLX_SGIS_multisample = 1 # GL/glxext.h:386
+# EXT_visual_info (GL/glxext.h:389)
+GLX_EXT_visual_info = 1 # GL/glxext.h:390
+# SGI_swap_control (GL/glxext.h:393)
+GLX_SGI_swap_control = 1 # GL/glxext.h:394
+# GL/glxext.h:396
+glXSwapIntervalSGI = _link_function('glXSwapIntervalSGI', c_int, [c_int], 'SGI_swap_control')
+
+PFNGLXSWAPINTERVALSGIPROC = CFUNCTYPE(c_int, c_int) # GL/glxext.h:398
+# SGI_video_sync (GL/glxext.h:401)
+GLX_SGI_video_sync = 1 # GL/glxext.h:402
+# GL/glxext.h:404
+glXGetVideoSyncSGI = _link_function('glXGetVideoSyncSGI', c_int, [POINTER(c_uint)], 'SGI_video_sync')
+
+# GL/glxext.h:405
+glXWaitVideoSyncSGI = _link_function('glXWaitVideoSyncSGI', c_int, [c_int, c_int, POINTER(c_uint)], 'SGI_video_sync')
+
+# GL/glxext.h:406
+glXGetRefreshRateSGI = _link_function('glXGetRefreshRateSGI', c_int, [POINTER(c_uint)], 'SGI_video_sync')
+
+PFNGLXGETVIDEOSYNCSGIPROC = CFUNCTYPE(c_int, POINTER(c_uint)) # GL/glxext.h:408
+PFNGLXWAITVIDEOSYNCSGIPROC = CFUNCTYPE(c_int, c_int, c_int, POINTER(c_uint)) # GL/glxext.h:409
+PFNGLXGETREFRESHRATESGIPROC = CFUNCTYPE(c_int, POINTER(c_uint)) # GL/glxext.h:410
+# SGI_make_current_read (GL/glxext.h:413)
+GLX_SGI_make_current_read = 1 # GL/glxext.h:414
+GLXContext = pyglet.gl.glx.GLXContext
+# GL/glxext.h:416
+glXMakeCurrentReadSGI = _link_function('glXMakeCurrentReadSGI', c_int, [POINTER(Display), GLXDrawable, GLXDrawable, GLXContext], 'SGI_make_current_read')
+
+# GL/glxext.h:417
+glXGetCurrentReadDrawableSGI = _link_function('glXGetCurrentReadDrawableSGI', GLXDrawable, [], 'SGI_make_current_read')
+
+PFNGLXMAKECURRENTREADSGIPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, GLXDrawable, GLXContext) # GL/glxext.h:419
+PFNGLXGETCURRENTREADDRAWABLESGIPROC = CFUNCTYPE(GLXDrawable) # GL/glxext.h:420
+# SGIX_video_source (GL/glxext.h:423)
+GLX_SGIX_video_source = 1 # GL/glxext.h:424
+# EXT_visual_rating (GL/glxext.h:435)
+GLX_EXT_visual_rating = 1 # GL/glxext.h:436
+# EXT_import_context (GL/glxext.h:439)
+GLX_EXT_import_context = 1 # GL/glxext.h:440
+# GL/glxext.h:442
+glXGetCurrentDisplayEXT = _link_function('glXGetCurrentDisplayEXT', POINTER(Display), [], 'EXT_import_context')
+
+# GL/glxext.h:443
+glXQueryContextInfoEXT = _link_function('glXQueryContextInfoEXT', c_int, [POINTER(Display), GLXContext, c_int, POINTER(c_int)], 'EXT_import_context')
+
+GLXContextID = pyglet.gl.glx.GLXContextID
+# GL/glxext.h:444
+glXGetContextIDEXT = _link_function('glXGetContextIDEXT', GLXContextID, [GLXContext], 'EXT_import_context')
+
+# GL/glxext.h:445
+glXImportContextEXT = _link_function('glXImportContextEXT', GLXContext, [POINTER(Display), GLXContextID], 'EXT_import_context')
+
+# GL/glxext.h:446
+glXFreeContextEXT = _link_function('glXFreeContextEXT', None, [POINTER(Display), GLXContext], 'EXT_import_context')
+
+PFNGLXGETCURRENTDISPLAYEXTPROC = CFUNCTYPE(POINTER(Display)) # GL/glxext.h:448
+PFNGLXQUERYCONTEXTINFOEXTPROC = CFUNCTYPE(c_int, POINTER(Display), GLXContext, c_int, POINTER(c_int)) # GL/glxext.h:449
+PFNGLXGETCONTEXTIDEXTPROC = CFUNCTYPE(GLXContextID, GLXContext) # GL/glxext.h:450
+PFNGLXIMPORTCONTEXTEXTPROC = CFUNCTYPE(GLXContext, POINTER(Display), GLXContextID) # GL/glxext.h:451
+PFNGLXFREECONTEXTEXTPROC = CFUNCTYPE(None, POINTER(Display), GLXContext) # GL/glxext.h:452
+# SGIX_fbconfig (GL/glxext.h:455)
+GLX_SGIX_fbconfig = 1 # GL/glxext.h:456
+# GL/glxext.h:458
+glXGetFBConfigAttribSGIX = _link_function('glXGetFBConfigAttribSGIX', c_int, [POINTER(Display), GLXFBConfigSGIX, c_int, POINTER(c_int)], 'SGIX_fbconfig')
+
+# GL/glxext.h:459
+glXChooseFBConfigSGIX = _link_function('glXChooseFBConfigSGIX', POINTER(GLXFBConfigSGIX), [POINTER(Display), c_int, POINTER(c_int), POINTER(c_int)], 'SGIX_fbconfig')
+
+GLXPixmap = pyglet.gl.glx.GLXPixmap
+Pixmap = pyglet.libs.x11.xlib.Pixmap
+# GL/glxext.h:460
+glXCreateGLXPixmapWithConfigSGIX = _link_function('glXCreateGLXPixmapWithConfigSGIX', GLXPixmap, [POINTER(Display), GLXFBConfigSGIX, Pixmap], 'SGIX_fbconfig')
+
+# GL/glxext.h:461
+glXCreateContextWithConfigSGIX = _link_function('glXCreateContextWithConfigSGIX', GLXContext, [POINTER(Display), GLXFBConfigSGIX, c_int, GLXContext, c_int], 'SGIX_fbconfig')
+
+XVisualInfo = pyglet.libs.x11.xlib.XVisualInfo
+# GL/glxext.h:462
+glXGetVisualFromFBConfigSGIX = _link_function('glXGetVisualFromFBConfigSGIX', POINTER(XVisualInfo), [POINTER(Display), GLXFBConfigSGIX], 'SGIX_fbconfig')
+
+# GL/glxext.h:463
+glXGetFBConfigFromVisualSGIX = _link_function('glXGetFBConfigFromVisualSGIX', GLXFBConfigSGIX, [POINTER(Display), POINTER(XVisualInfo)], 'SGIX_fbconfig')
+
+PFNGLXGETFBCONFIGATTRIBSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), GLXFBConfigSGIX, c_int, POINTER(c_int)) # GL/glxext.h:465
+PFNGLXCHOOSEFBCONFIGSGIXPROC = CFUNCTYPE(POINTER(GLXFBConfigSGIX), POINTER(Display), c_int, POINTER(c_int), POINTER(c_int)) # GL/glxext.h:466
+PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC = CFUNCTYPE(GLXPixmap, POINTER(Display), GLXFBConfigSGIX, Pixmap) # GL/glxext.h:467
+PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC = CFUNCTYPE(GLXContext, POINTER(Display), GLXFBConfigSGIX, c_int, GLXContext, c_int) # GL/glxext.h:468
+PFNGLXGETVISUALFROMFBCONFIGSGIXPROC = CFUNCTYPE(POINTER(XVisualInfo), POINTER(Display), GLXFBConfigSGIX) # GL/glxext.h:469
+PFNGLXGETFBCONFIGFROMVISUALSGIXPROC = CFUNCTYPE(GLXFBConfigSGIX, POINTER(Display), POINTER(XVisualInfo)) # GL/glxext.h:470
+# SGIX_pbuffer (GL/glxext.h:473)
+GLX_SGIX_pbuffer = 1 # GL/glxext.h:474
+# GL/glxext.h:476
+glXCreateGLXPbufferSGIX = _link_function('glXCreateGLXPbufferSGIX', GLXPbufferSGIX, [POINTER(Display), GLXFBConfigSGIX, c_uint, c_uint, POINTER(c_int)], 'SGIX_pbuffer')
+
+# GL/glxext.h:477
+glXDestroyGLXPbufferSGIX = _link_function('glXDestroyGLXPbufferSGIX', None, [POINTER(Display), GLXPbufferSGIX], 'SGIX_pbuffer')
+
+# GL/glxext.h:478
+glXQueryGLXPbufferSGIX = _link_function('glXQueryGLXPbufferSGIX', c_int, [POINTER(Display), GLXPbufferSGIX, c_int, POINTER(c_uint)], 'SGIX_pbuffer')
+
+# GL/glxext.h:479
+glXSelectEventSGIX = _link_function('glXSelectEventSGIX', None, [POINTER(Display), GLXDrawable, c_ulong], 'SGIX_pbuffer')
+
+# GL/glxext.h:480
+glXGetSelectedEventSGIX = _link_function('glXGetSelectedEventSGIX', None, [POINTER(Display), GLXDrawable, POINTER(c_ulong)], 'SGIX_pbuffer')
+
+PFNGLXCREATEGLXPBUFFERSGIXPROC = CFUNCTYPE(GLXPbufferSGIX, POINTER(Display), GLXFBConfigSGIX, c_uint, c_uint, POINTER(c_int)) # GL/glxext.h:482
+PFNGLXDESTROYGLXPBUFFERSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXPbufferSGIX) # GL/glxext.h:483
+PFNGLXQUERYGLXPBUFFERSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), GLXPbufferSGIX, c_int, POINTER(c_uint)) # GL/glxext.h:484
+PFNGLXSELECTEVENTSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_ulong) # GL/glxext.h:485
+PFNGLXGETSELECTEDEVENTSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, POINTER(c_ulong)) # GL/glxext.h:486
+# SGI_cushion (GL/glxext.h:489)
+GLX_SGI_cushion = 1 # GL/glxext.h:490
+Window = pyglet.libs.x11.xlib.Window
+# GL/glxext.h:492
+glXCushionSGI = _link_function('glXCushionSGI', None, [POINTER(Display), Window, c_float], 'SGI_cushion')
+
+PFNGLXCUSHIONSGIPROC = CFUNCTYPE(None, POINTER(Display), Window, c_float) # GL/glxext.h:494
+# SGIX_video_resize (GL/glxext.h:497)
+GLX_SGIX_video_resize = 1 # GL/glxext.h:498
+# GL/glxext.h:500
+glXBindChannelToWindowSGIX = _link_function('glXBindChannelToWindowSGIX', c_int, [POINTER(Display), c_int, c_int, Window], 'SGIX_video_resize')
+
+# GL/glxext.h:501
+glXChannelRectSGIX = _link_function('glXChannelRectSGIX', c_int, [POINTER(Display), c_int, c_int, c_int, c_int, c_int, c_int], 'SGIX_video_resize')
+
+# GL/glxext.h:502
+glXQueryChannelRectSGIX = _link_function('glXQueryChannelRectSGIX', c_int, [POINTER(Display), c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)], 'SGIX_video_resize')
+
+# GL/glxext.h:503
+glXQueryChannelDeltasSGIX = _link_function('glXQueryChannelDeltasSGIX', c_int, [POINTER(Display), c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)], 'SGIX_video_resize')
+
+GLenum = c_uint # /usr/include/GL/gl.h:153
+# GL/glxext.h:504
+glXChannelRectSyncSGIX = _link_function('glXChannelRectSyncSGIX', c_int, [POINTER(Display), c_int, c_int, GLenum], 'SGIX_video_resize')
+
+PFNGLXBINDCHANNELTOWINDOWSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, Window) # GL/glxext.h:506
+PFNGLXCHANNELRECTSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, c_int, c_int, c_int, c_int) # GL/glxext.h:507
+PFNGLXQUERYCHANNELRECTSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)) # GL/glxext.h:508
+PFNGLXQUERYCHANNELDELTASSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)) # GL/glxext.h:509
+PFNGLXCHANNELRECTSYNCSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, GLenum) # GL/glxext.h:510
+# SGIX_dmbuffer (GL/glxext.h:513)
+GLX_SGIX_dmbuffer = 1 # GL/glxext.h:514
+# SGIX_swap_group (GL/glxext.h:523)
+GLX_SGIX_swap_group = 1 # GL/glxext.h:524
+# GL/glxext.h:526
+glXJoinSwapGroupSGIX = _link_function('glXJoinSwapGroupSGIX', None, [POINTER(Display), GLXDrawable, GLXDrawable], 'SGIX_swap_group')
+
+PFNGLXJOINSWAPGROUPSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, GLXDrawable) # GL/glxext.h:528
+# SGIX_swap_barrier (GL/glxext.h:531)
+GLX_SGIX_swap_barrier = 1 # GL/glxext.h:532
+# GL/glxext.h:534
+glXBindSwapBarrierSGIX = _link_function('glXBindSwapBarrierSGIX', None, [POINTER(Display), GLXDrawable, c_int], 'SGIX_swap_barrier')
+
+# GL/glxext.h:535
+glXQueryMaxSwapBarriersSGIX = _link_function('glXQueryMaxSwapBarriersSGIX', c_int, [POINTER(Display), c_int, POINTER(c_int)], 'SGIX_swap_barrier')
+
+PFNGLXBINDSWAPBARRIERSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_int) # GL/glxext.h:537
+PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, POINTER(c_int)) # GL/glxext.h:538
+# SUN_get_transparent_index (GL/glxext.h:541)
+GLX_SUN_get_transparent_index = 1 # GL/glxext.h:542
+# GL/glxext.h:544
+glXGetTransparentIndexSUN = _link_function('glXGetTransparentIndexSUN', c_int, [POINTER(Display), Window, Window, POINTER(c_long)], 'SUN_get_transparent_index')
+
+PFNGLXGETTRANSPARENTINDEXSUNPROC = CFUNCTYPE(c_int, POINTER(Display), Window, Window, POINTER(c_long)) # GL/glxext.h:546
+# MESA_copy_sub_buffer (GL/glxext.h:549)
+GLX_MESA_copy_sub_buffer = 1 # GL/glxext.h:550
+# GL/glxext.h:552
+glXCopySubBufferMESA = _link_function('glXCopySubBufferMESA', None, [POINTER(Display), GLXDrawable, c_int, c_int, c_int, c_int], 'MESA_copy_sub_buffer')
+
+PFNGLXCOPYSUBBUFFERMESAPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_int, c_int, c_int, c_int) # GL/glxext.h:554
+# MESA_pixmap_colormap (GL/glxext.h:557)
+GLX_MESA_pixmap_colormap = 1 # GL/glxext.h:558
+Colormap = pyglet.libs.x11.xlib.Colormap
+# GL/glxext.h:560
+glXCreateGLXPixmapMESA = _link_function('glXCreateGLXPixmapMESA', GLXPixmap, [POINTER(Display), POINTER(XVisualInfo), Pixmap, Colormap], 'MESA_pixmap_colormap')
+
+PFNGLXCREATEGLXPIXMAPMESAPROC = CFUNCTYPE(GLXPixmap, POINTER(Display), POINTER(XVisualInfo), Pixmap, Colormap) # GL/glxext.h:562
+# MESA_release_buffers (GL/glxext.h:565)
+GLX_MESA_release_buffers = 1 # GL/glxext.h:566
+# GL/glxext.h:568
+glXReleaseBuffersMESA = _link_function('glXReleaseBuffersMESA', c_int, [POINTER(Display), GLXDrawable], 'MESA_release_buffers')
+
+PFNGLXRELEASEBUFFERSMESAPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable) # GL/glxext.h:570
+# MESA_set_3dfx_mode (GL/glxext.h:573)
+GLX_MESA_set_3dfx_mode = 1 # GL/glxext.h:574
+# GL/glxext.h:576
+glXSet3DfxModeMESA = _link_function('glXSet3DfxModeMESA', c_int, [c_int], 'MESA_set_3dfx_mode')
+
+PFNGLXSET3DFXMODEMESAPROC = CFUNCTYPE(c_int, c_int) # GL/glxext.h:578
+# SGIX_visual_select_group (GL/glxext.h:581)
+GLX_SGIX_visual_select_group = 1 # GL/glxext.h:582
+# OML_swap_method (GL/glxext.h:585)
+GLX_OML_swap_method = 1 # GL/glxext.h:586
+# OML_sync_control (GL/glxext.h:589)
+GLX_OML_sync_control = 1 # GL/glxext.h:590
+# GL/glxext.h:592
+glXGetSyncValuesOML = _link_function('glXGetSyncValuesOML', c_int, [POINTER(Display), GLXDrawable, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)], 'OML_sync_control')
+
+# GL/glxext.h:593
+glXGetMscRateOML = _link_function('glXGetMscRateOML', c_int, [POINTER(Display), GLXDrawable, POINTER(c_int32), POINTER(c_int32)], 'OML_sync_control')
+
+# GL/glxext.h:594
+glXSwapBuffersMscOML = _link_function('glXSwapBuffersMscOML', c_int64, [POINTER(Display), GLXDrawable, c_int64, c_int64, c_int64], 'OML_sync_control')
+
+# GL/glxext.h:595
+glXWaitForMscOML = _link_function('glXWaitForMscOML', c_int, [POINTER(Display), GLXDrawable, c_int64, c_int64, c_int64, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)], 'OML_sync_control')
+
+# GL/glxext.h:596
+glXWaitForSbcOML = _link_function('glXWaitForSbcOML', c_int, [POINTER(Display), GLXDrawable, c_int64, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)], 'OML_sync_control')
+
+PFNGLXGETSYNCVALUESOMLPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)) # GL/glxext.h:598
+PFNGLXGETMSCRATEOMLPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, POINTER(c_int32), POINTER(c_int32)) # GL/glxext.h:599
+PFNGLXSWAPBUFFERSMSCOMLPROC = CFUNCTYPE(c_int64, POINTER(Display), GLXDrawable, c_int64, c_int64, c_int64) # GL/glxext.h:600
+PFNGLXWAITFORMSCOMLPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, c_int64, c_int64, c_int64, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)) # GL/glxext.h:601
+PFNGLXWAITFORSBCOMLPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, c_int64, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)) # GL/glxext.h:602
+# NV_float_buffer (GL/glxext.h:605)
+GLX_NV_float_buffer = 1 # GL/glxext.h:606
+# SGIX_hyperpipe (GL/glxext.h:609)
+GLX_SGIX_hyperpipe = 1 # GL/glxext.h:610
+class struct_anon_107(Structure):
+ __slots__ = [
+ 'pipeName',
+ 'networkId',
+ ]
+struct_anon_107._fields_ = [
+ ('pipeName', c_char * 80),
+ ('networkId', c_int),
+]
+
+GLXHyperpipeNetworkSGIX = struct_anon_107 # GL/glxext.h:615
+class struct_anon_108(Structure):
+ __slots__ = [
+ 'pipeName',
+ 'channel',
+ 'participationType',
+ 'timeSlice',
+ ]
+struct_anon_108._fields_ = [
+ ('pipeName', c_char * 80),
+ ('channel', c_int),
+ ('participationType', c_uint),
+ ('timeSlice', c_int),
+]
+
+GLXHyperpipeConfigSGIX = struct_anon_108 # GL/glxext.h:623
+class struct_anon_109(Structure):
+ __slots__ = [
+ 'pipeName',
+ 'srcXOrigin',
+ 'srcYOrigin',
+ 'srcWidth',
+ 'srcHeight',
+ 'destXOrigin',
+ 'destYOrigin',
+ 'destWidth',
+ 'destHeight',
+ ]
+struct_anon_109._fields_ = [
+ ('pipeName', c_char * 80),
+ ('srcXOrigin', c_int),
+ ('srcYOrigin', c_int),
+ ('srcWidth', c_int),
+ ('srcHeight', c_int),
+ ('destXOrigin', c_int),
+ ('destYOrigin', c_int),
+ ('destWidth', c_int),
+ ('destHeight', c_int),
+]
+
+GLXPipeRect = struct_anon_109 # GL/glxext.h:629
+class struct_anon_110(Structure):
+ __slots__ = [
+ 'pipeName',
+ 'XOrigin',
+ 'YOrigin',
+ 'maxHeight',
+ 'maxWidth',
+ ]
+struct_anon_110._fields_ = [
+ ('pipeName', c_char * 80),
+ ('XOrigin', c_int),
+ ('YOrigin', c_int),
+ ('maxHeight', c_int),
+ ('maxWidth', c_int),
+]
+
+GLXPipeRectLimits = struct_anon_110 # GL/glxext.h:634
+# GL/glxext.h:637
+glXQueryHyperpipeNetworkSGIX = _link_function('glXQueryHyperpipeNetworkSGIX', POINTER(GLXHyperpipeNetworkSGIX), [POINTER(Display), POINTER(c_int)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:638
+glXHyperpipeConfigSGIX = _link_function('glXHyperpipeConfigSGIX', c_int, [POINTER(Display), c_int, c_int, POINTER(GLXHyperpipeConfigSGIX), POINTER(c_int)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:639
+glXQueryHyperpipeConfigSGIX = _link_function('glXQueryHyperpipeConfigSGIX', POINTER(GLXHyperpipeConfigSGIX), [POINTER(Display), c_int, POINTER(c_int)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:640
+glXDestroyHyperpipeConfigSGIX = _link_function('glXDestroyHyperpipeConfigSGIX', c_int, [POINTER(Display), c_int], 'SGIX_hyperpipe')
+
+# GL/glxext.h:641
+glXBindHyperpipeSGIX = _link_function('glXBindHyperpipeSGIX', c_int, [POINTER(Display), c_int], 'SGIX_hyperpipe')
+
+# GL/glxext.h:642
+glXQueryHyperpipeBestAttribSGIX = _link_function('glXQueryHyperpipeBestAttribSGIX', c_int, [POINTER(Display), c_int, c_int, c_int, POINTER(None), POINTER(None)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:643
+glXHyperpipeAttribSGIX = _link_function('glXHyperpipeAttribSGIX', c_int, [POINTER(Display), c_int, c_int, c_int, POINTER(None)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:644
+glXQueryHyperpipeAttribSGIX = _link_function('glXQueryHyperpipeAttribSGIX', c_int, [POINTER(Display), c_int, c_int, c_int, POINTER(None)], 'SGIX_hyperpipe')
+
+PFNGLXQUERYHYPERPIPENETWORKSGIXPROC = CFUNCTYPE(POINTER(GLXHyperpipeNetworkSGIX), POINTER(Display), POINTER(c_int)) # GL/glxext.h:646
+PFNGLXHYPERPIPECONFIGSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, POINTER(GLXHyperpipeConfigSGIX), POINTER(c_int)) # GL/glxext.h:647
+PFNGLXQUERYHYPERPIPECONFIGSGIXPROC = CFUNCTYPE(POINTER(GLXHyperpipeConfigSGIX), POINTER(Display), c_int, POINTER(c_int)) # GL/glxext.h:648
+PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int) # GL/glxext.h:649
+PFNGLXBINDHYPERPIPESGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int) # GL/glxext.h:650
+PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, c_int, POINTER(None), POINTER(None)) # GL/glxext.h:651
+PFNGLXHYPERPIPEATTRIBSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, c_int, POINTER(None)) # GL/glxext.h:652
+PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, c_int, POINTER(None)) # GL/glxext.h:653
+# MESA_agp_offset (GL/glxext.h:656)
+GLX_MESA_agp_offset = 1 # GL/glxext.h:657
+# GL/glxext.h:659
+glXGetAGPOffsetMESA = _link_function('glXGetAGPOffsetMESA', c_uint, [POINTER(None)], 'MESA_agp_offset')
+
+PFNGLXGETAGPOFFSETMESAPROC = CFUNCTYPE(c_uint, POINTER(None)) # GL/glxext.h:661
+# NV_vertex_array_range (GL/glxext.h:667)
+GLX_NV_vertex_array_range = 1 # GL/glxext.h:668
+GLsizei = pyglet.gl.glx.GLsizei
+GLfloat = pyglet.gl.glx.GLfloat
+# GL/glxext.h:670
+glXAllocateMemoryNV = _link_function('glXAllocateMemoryNV', POINTER(c_void), [GLsizei, GLfloat, GLfloat, GLfloat], 'NV_vertex_array_range')
+
+GLvoid = pyglet.gl.glx.GLvoid
+# GL/glxext.h:673
+glXFreeMemoryNV = _link_function('glXFreeMemoryNV', None, [POINTER(GLvoid)], 'NV_vertex_array_range')
+
+PFNGLXALLOCATEMEMORYNVPROC = pyglet.gl.glx.PFNGLXALLOCATEMEMORYNVPROC
+PFNGLXFREEMEMORYNVPROC = pyglet.gl.glx.PFNGLXFREEMEMORYNVPROC
+# NV_swap_group (GL/glxext.h:683)
+GLX_NV_swap_group = 1 # GL/glxext.h:684
+GLuint = pyglet.gl.glx.GLuint
+# GL/glxext.h:686
+glXJoinSwapGroupNV = _link_function('glXJoinSwapGroupNV', c_int, [POINTER(Display), GLXDrawable, GLuint], 'NV_swap_group')
+
+# GL/glxext.h:689
+glXBindSwapBarrierNV = _link_function('glXBindSwapBarrierNV', c_int, [POINTER(Display), GLuint, GLuint], 'NV_swap_group')
+
+# GL/glxext.h:691
+glXQuerySwapGroupNV = _link_function('glXQuerySwapGroupNV', c_int, [POINTER(Display), GLXDrawable, POINTER(GLuint), POINTER(GLuint)], 'NV_swap_group')
+
+# GL/glxext.h:694
+glXQueryMaxSwapGroupsNV = _link_function('glXQueryMaxSwapGroupsNV', c_int, [POINTER(Display), c_int, POINTER(GLuint), POINTER(GLuint)], 'NV_swap_group')
+
+# GL/glxext.h:697
+glXQueryFrameCountNV = _link_function('glXQueryFrameCountNV', c_int, [POINTER(Display), c_int, POINTER(GLuint)], 'NV_swap_group')
+
+# GL/glxext.h:699
+glXResetFrameCountNV = _link_function('glXResetFrameCountNV', c_int, [POINTER(Display), c_int], 'NV_swap_group')
+
+PFNGLXJOINSWAPGROUPNVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, GLuint) # GL/glxext.h:701
+PFNGLXBINDSWAPBARRIERNVPROC = CFUNCTYPE(c_int, POINTER(Display), GLuint, GLuint) # GL/glxext.h:705
+PFNGLXQUERYSWAPGROUPNVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, POINTER(GLuint), POINTER(GLuint)) # GL/glxext.h:709
+PFNGLXQUERYMAXSWAPGROUPSNVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, POINTER(GLuint), POINTER(GLuint)) # GL/glxext.h:714
+PFNGLXQUERYFRAMECOUNTNVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, POINTER(GLuint)) # GL/glxext.h:719
+PFNGLXRESETFRAMECOUNTNVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int) # GL/glxext.h:723
+# NV_video_out (GL/glxext.h:726)
+GLX_NV_video_out = 1 # GL/glxext.h:727
+# GL/glxext.h:729
+glXGetVideoDeviceNV = _link_function('glXGetVideoDeviceNV', c_int, [POINTER(Display), c_int, c_int, POINTER(GLXVideoDeviceNV)], 'NV_video_out')
+
+# GL/glxext.h:732
+glXReleaseVideoDeviceNV = _link_function('glXReleaseVideoDeviceNV', c_int, [POINTER(Display), c_int, GLXVideoDeviceNV], 'NV_video_out')
+
+GLXPbuffer = pyglet.gl.glx.GLXPbuffer
+# GL/glxext.h:735
+glXBindVideoImageNV = _link_function('glXBindVideoImageNV', c_int, [POINTER(Display), GLXVideoDeviceNV, GLXPbuffer, c_int], 'NV_video_out')
+
+# GL/glxext.h:738
+glXReleaseVideoImageNV = _link_function('glXReleaseVideoImageNV', c_int, [POINTER(Display), GLXPbuffer], 'NV_video_out')
+
+GLboolean = c_ubyte # /usr/include/GL/gl.h:154
+# GL/glxext.h:740
+glXSendPbufferToVideoNV = _link_function('glXSendPbufferToVideoNV', c_int, [POINTER(Display), GLXPbuffer, c_int, POINTER(c_ulong), GLboolean], 'NV_video_out')
+
+# GL/glxext.h:745
+glXGetVideoInfoNV = _link_function('glXGetVideoInfoNV', c_int, [POINTER(Display), c_int, GLXVideoDeviceNV, POINTER(c_ulong), POINTER(c_ulong)], 'NV_video_out')
+
+PFNGLXGETVIDEODEVICENVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, POINTER(GLXVideoDeviceNV)) # GL/glxext.h:750
+PFNGLXRELEASEVIDEODEVICENVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, GLXVideoDeviceNV) # GL/glxext.h:755
+PFNGLXBINDVIDEOIMAGENVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXVideoDeviceNV, GLXPbuffer, c_int) # GL/glxext.h:759
+PFNGLXRELEASEVIDEOIMAGENVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXPbuffer) # GL/glxext.h:764
+PFNGLXSENDPBUFFERTOVIDEONVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXPbuffer, c_int, POINTER(c_ulong), GLboolean) # GL/glxext.h:767
+PFNGLXGETVIDEOINFONVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, GLXVideoDeviceNV, POINTER(c_ulong), POINTER(c_ulong)) # GL/glxext.h:773
+# EXT_texture_from_pixmap (GL/glxext.h:779)
+# GL/glxext.h:782
+glXBindTexImageEXT = _link_function('glXBindTexImageEXT', None, [POINTER(Display), GLXDrawable, c_int, POINTER(c_int)], 'EXT_texture_from_pixmap')
+
+# GL/glxext.h:784
+glXReleaseTextImageEXT = _link_function('glXReleaseTextImageEXT', None, [POINTER(Display), GLXDrawable, c_int], 'EXT_texture_from_pixmap')
+
+PFNGLXBINDTEXIMAGEEXTPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_int, POINTER(c_int)) # GL/glxext.h:787
+PFNGLXRELEASETEXIMAGEEXTPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_int) # GL/glxext.h:791
+# NV_vertex_array_range (/usr/include/GL/glx.h:349)
+# MESA_allocate_memory (/usr/include/GL/glx.h:363)
+# ARB_render_texture (/usr/include/GL/glx.h:380)
+# NV_float_buffer (/usr/include/GL/glx.h:393)
+# MESA_swap_frame_usage (/usr/include/GL/glx.h:405)
+# MESA_swap_control (/usr/include/GL/glx.h:425)
+# EXT_texture_from_pixmap (/usr/include/GL/glx.h:442)
+
+__all__ = ['GLX_GLXEXT_VERSION', 'GLX_SAMPLE_BUFFERS_ARB', 'GLX_SAMPLES_ARB',
+'GLX_RGBA_FLOAT_TYPE_ARB', 'GLX_RGBA_FLOAT_BIT_ARB',
+'GLX_SAMPLE_BUFFERS_SGIS', 'GLX_SAMPLES_SGIS', 'GLX_X_VISUAL_TYPE_EXT',
+'GLX_TRANSPARENT_TYPE_EXT', 'GLX_TRANSPARENT_INDEX_VALUE_EXT',
+'GLX_TRANSPARENT_RED_VALUE_EXT', 'GLX_TRANSPARENT_GREEN_VALUE_EXT',
+'GLX_TRANSPARENT_BLUE_VALUE_EXT', 'GLX_TRANSPARENT_ALPHA_VALUE_EXT',
+'GLX_NONE_EXT', 'GLX_TRUE_COLOR_EXT', 'GLX_DIRECT_COLOR_EXT',
+'GLX_PSEUDO_COLOR_EXT', 'GLX_STATIC_COLOR_EXT', 'GLX_GRAY_SCALE_EXT',
+'GLX_STATIC_GRAY_EXT', 'GLX_TRANSPARENT_RGB_EXT', 'GLX_TRANSPARENT_INDEX_EXT',
+'GLX_VISUAL_CAVEAT_EXT', 'GLX_SLOW_VISUAL_EXT',
+'GLX_NON_CONFORMANT_VISUAL_EXT', 'GLX_SHARE_CONTEXT_EXT', 'GLX_VISUAL_ID_EXT',
+'GLX_SCREEN_EXT', 'GLX_WINDOW_BIT_SGIX', 'GLX_PIXMAP_BIT_SGIX',
+'GLX_RGBA_BIT_SGIX', 'GLX_COLOR_INDEX_BIT_SGIX', 'GLX_DRAWABLE_TYPE_SGIX',
+'GLX_RENDER_TYPE_SGIX', 'GLX_X_RENDERABLE_SGIX', 'GLX_FBCONFIG_ID_SGIX',
+'GLX_RGBA_TYPE_SGIX', 'GLX_COLOR_INDEX_TYPE_SGIX', 'GLX_PBUFFER_BIT_SGIX',
+'GLX_BUFFER_CLOBBER_MASK_SGIX', 'GLX_FRONT_LEFT_BUFFER_BIT_SGIX',
+'GLX_FRONT_RIGHT_BUFFER_BIT_SGIX', 'GLX_BACK_LEFT_BUFFER_BIT_SGIX',
+'GLX_BACK_RIGHT_BUFFER_BIT_SGIX', 'GLX_AUX_BUFFERS_BIT_SGIX',
+'GLX_DEPTH_BUFFER_BIT_SGIX', 'GLX_STENCIL_BUFFER_BIT_SGIX',
+'GLX_ACCUM_BUFFER_BIT_SGIX', 'GLX_SAMPLE_BUFFERS_BIT_SGIX',
+'GLX_MAX_PBUFFER_WIDTH_SGIX', 'GLX_MAX_PBUFFER_HEIGHT_SGIX',
+'GLX_MAX_PBUFFER_PIXELS_SGIX', 'GLX_OPTIMAL_PBUFFER_WIDTH_SGIX',
+'GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX', 'GLX_PRESERVED_CONTENTS_SGIX',
+'GLX_LARGEST_PBUFFER_SGIX', 'GLX_WIDTH_SGIX', 'GLX_HEIGHT_SGIX',
+'GLX_EVENT_MASK_SGIX', 'GLX_DAMAGED_SGIX', 'GLX_SAVED_SGIX',
+'GLX_WINDOW_SGIX', 'GLX_PBUFFER_SGIX', 'GLX_SYNC_FRAME_SGIX',
+'GLX_SYNC_SWAP_SGIX', 'GLX_DIGITAL_MEDIA_PBUFFER_SGIX',
+'GLX_BLENDED_RGBA_SGIS', 'GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS',
+'GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS', 'GLX_SAMPLE_BUFFERS_3DFX',
+'GLX_SAMPLES_3DFX', 'GLX_3DFX_WINDOW_MODE_MESA',
+'GLX_3DFX_FULLSCREEN_MODE_MESA', 'GLX_VISUAL_SELECT_GROUP_SGIX',
+'GLX_SWAP_METHOD_OML', 'GLX_SWAP_EXCHANGE_OML', 'GLX_SWAP_COPY_OML',
+'GLX_SWAP_UNDEFINED_OML', 'GLX_FLOAT_COMPONENTS_NV',
+'GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX', 'GLX_BAD_HYPERPIPE_CONFIG_SGIX',
+'GLX_BAD_HYPERPIPE_SGIX', 'GLX_HYPERPIPE_DISPLAY_PIPE_SGIX',
+'GLX_HYPERPIPE_RENDER_PIPE_SGIX', 'GLX_PIPE_RECT_SGIX',
+'GLX_PIPE_RECT_LIMITS_SGIX', 'GLX_HYPERPIPE_STEREO_SGIX',
+'GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX', 'GLX_HYPERPIPE_ID_SGIX',
+'GLXVideoSourceSGIX', 'GLXFBConfigIDSGIX', 'GLXFBConfigSGIX',
+'GLXPbufferSGIX', 'GLXBufferClobberEventSGIX', 'GLXVideoDeviceNV',
+'GLX_VIDEO_OUT_COLOR_NV', 'GLX_VIDEO_OUT_ALPHA_NV', 'GLX_VIDEO_OUT_DEPTH_NV',
+'GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV', 'GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV',
+'GLX_VIDEO_OUT_FRAME_NV', 'GLX_VIDEO_OUT_FIELD_1_NV',
+'GLX_VIDEO_OUT_FIELD_2_NV', 'GLX_BIND_TO_TEXTURE_RGB_EXT',
+'GLX_BIND_TO_TEXTURE_RGBA_EXT', 'GLX_BIND_TO_MIPMAP_TEXTURE_EXT',
+'GLX_BIND_TO_TEXTURE_TARGETS_EXT', 'GLX_Y_INVERTED_EXT',
+'GLX_TEXTURE_FORMAT_EXT', 'GLX_TEXTURE_TARGET_EXT', 'GLX_MIPMAP_TEXTURE_EXT',
+'GLX_TEXTURE_FORMAT_NONE_EXT', 'GLX_TEXTURE_FORMAT_RGB_EXT',
+'GLX_TEXTURE_FORMAT_RGBA_EXT', 'GLX_TEXTURE_1D_BIT_EXT',
+'GLX_TEXTURE_2D_BIT_EXT', 'GLX_TEXTURE_RECTANGLE_BIT_EXT',
+'GLX_TEXTURE_1D_EXT', 'GLX_TEXTURE_2D_EXT', 'GLX_TEXTURE_RECTANGLE_EXT',
+'GLX_FRONT_LEFT_EXT', 'GLX_FRONT_RIGHT_EXT', 'GLX_BACK_LEFT_EXT',
+'GLX_BACK_RIGHT_EXT', 'GLX_FRONT_EXT', 'GLX_BACK_EXT', 'GLX_AUX0_EXT',
+'GLX_AUX1_EXT', 'GLX_AUX2_EXT', 'GLX_AUX3_EXT', 'GLX_AUX4_EXT',
+'GLX_AUX5_EXT', 'GLX_AUX6_EXT', 'GLX_AUX7_EXT', 'GLX_AUX8_EXT',
+'GLX_AUX9_EXT', 'GLX_ARB_multisample', 'GLX_ARB_fbconfig_float',
+'GLX_SGIS_multisample', 'GLX_EXT_visual_info', 'GLX_SGI_swap_control',
+'glXSwapIntervalSGI', 'PFNGLXSWAPINTERVALSGIPROC', 'GLX_SGI_video_sync',
+'glXGetVideoSyncSGI', 'glXWaitVideoSyncSGI', 'glXGetRefreshRateSGI',
+'PFNGLXGETVIDEOSYNCSGIPROC', 'PFNGLXWAITVIDEOSYNCSGIPROC',
+'PFNGLXGETREFRESHRATESGIPROC', 'GLX_SGI_make_current_read',
+'glXMakeCurrentReadSGI', 'glXGetCurrentReadDrawableSGI',
+'PFNGLXMAKECURRENTREADSGIPROC', 'PFNGLXGETCURRENTREADDRAWABLESGIPROC',
+'GLX_SGIX_video_source', 'GLX_EXT_visual_rating', 'GLX_EXT_import_context',
+'glXGetCurrentDisplayEXT', 'glXQueryContextInfoEXT', 'glXGetContextIDEXT',
+'glXImportContextEXT', 'glXFreeContextEXT', 'PFNGLXGETCURRENTDISPLAYEXTPROC',
+'PFNGLXQUERYCONTEXTINFOEXTPROC', 'PFNGLXGETCONTEXTIDEXTPROC',
+'PFNGLXIMPORTCONTEXTEXTPROC', 'PFNGLXFREECONTEXTEXTPROC', 'GLX_SGIX_fbconfig',
+'glXGetFBConfigAttribSGIX', 'glXChooseFBConfigSGIX',
+'glXCreateGLXPixmapWithConfigSGIX', 'glXCreateContextWithConfigSGIX',
+'glXGetVisualFromFBConfigSGIX', 'glXGetFBConfigFromVisualSGIX',
+'PFNGLXGETFBCONFIGATTRIBSGIXPROC', 'PFNGLXCHOOSEFBCONFIGSGIXPROC',
+'PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC',
+'PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC',
+'PFNGLXGETVISUALFROMFBCONFIGSGIXPROC', 'PFNGLXGETFBCONFIGFROMVISUALSGIXPROC',
+'GLX_SGIX_pbuffer', 'glXCreateGLXPbufferSGIX', 'glXDestroyGLXPbufferSGIX',
+'glXQueryGLXPbufferSGIX', 'glXSelectEventSGIX', 'glXGetSelectedEventSGIX',
+'PFNGLXCREATEGLXPBUFFERSGIXPROC', 'PFNGLXDESTROYGLXPBUFFERSGIXPROC',
+'PFNGLXQUERYGLXPBUFFERSGIXPROC', 'PFNGLXSELECTEVENTSGIXPROC',
+'PFNGLXGETSELECTEDEVENTSGIXPROC', 'GLX_SGI_cushion', 'glXCushionSGI',
+'PFNGLXCUSHIONSGIPROC', 'GLX_SGIX_video_resize', 'glXBindChannelToWindowSGIX',
+'glXChannelRectSGIX', 'glXQueryChannelRectSGIX', 'glXQueryChannelDeltasSGIX',
+'glXChannelRectSyncSGIX', 'PFNGLXBINDCHANNELTOWINDOWSGIXPROC',
+'PFNGLXCHANNELRECTSGIXPROC', 'PFNGLXQUERYCHANNELRECTSGIXPROC',
+'PFNGLXQUERYCHANNELDELTASSGIXPROC', 'PFNGLXCHANNELRECTSYNCSGIXPROC',
+'GLX_SGIX_dmbuffer', 'GLX_SGIX_swap_group', 'glXJoinSwapGroupSGIX',
+'PFNGLXJOINSWAPGROUPSGIXPROC', 'GLX_SGIX_swap_barrier',
+'glXBindSwapBarrierSGIX', 'glXQueryMaxSwapBarriersSGIX',
+'PFNGLXBINDSWAPBARRIERSGIXPROC', 'PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC',
+'GLX_SUN_get_transparent_index', 'glXGetTransparentIndexSUN',
+'PFNGLXGETTRANSPARENTINDEXSUNPROC', 'GLX_MESA_copy_sub_buffer',
+'glXCopySubBufferMESA', 'PFNGLXCOPYSUBBUFFERMESAPROC',
+'GLX_MESA_pixmap_colormap', 'glXCreateGLXPixmapMESA',
+'PFNGLXCREATEGLXPIXMAPMESAPROC', 'GLX_MESA_release_buffers',
+'glXReleaseBuffersMESA', 'PFNGLXRELEASEBUFFERSMESAPROC',
+'GLX_MESA_set_3dfx_mode', 'glXSet3DfxModeMESA', 'PFNGLXSET3DFXMODEMESAPROC',
+'GLX_SGIX_visual_select_group', 'GLX_OML_swap_method', 'GLX_OML_sync_control',
+'glXGetSyncValuesOML', 'glXGetMscRateOML', 'glXSwapBuffersMscOML',
+'glXWaitForMscOML', 'glXWaitForSbcOML', 'PFNGLXGETSYNCVALUESOMLPROC',
+'PFNGLXGETMSCRATEOMLPROC', 'PFNGLXSWAPBUFFERSMSCOMLPROC',
+'PFNGLXWAITFORMSCOMLPROC', 'PFNGLXWAITFORSBCOMLPROC', 'GLX_NV_float_buffer',
+'GLX_SGIX_hyperpipe', 'GLXHyperpipeNetworkSGIX', 'GLXHyperpipeConfigSGIX',
+'GLXPipeRect', 'GLXPipeRectLimits', 'glXQueryHyperpipeNetworkSGIX',
+'glXHyperpipeConfigSGIX', 'glXQueryHyperpipeConfigSGIX',
+'glXDestroyHyperpipeConfigSGIX', 'glXBindHyperpipeSGIX',
+'glXQueryHyperpipeBestAttribSGIX', 'glXHyperpipeAttribSGIX',
+'glXQueryHyperpipeAttribSGIX', 'PFNGLXQUERYHYPERPIPENETWORKSGIXPROC',
+'PFNGLXHYPERPIPECONFIGSGIXPROC', 'PFNGLXQUERYHYPERPIPECONFIGSGIXPROC',
+'PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC', 'PFNGLXBINDHYPERPIPESGIXPROC',
+'PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC', 'PFNGLXHYPERPIPEATTRIBSGIXPROC',
+'PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC', 'GLX_MESA_agp_offset',
+'glXGetAGPOffsetMESA', 'PFNGLXGETAGPOFFSETMESAPROC',
+'GLX_NV_vertex_array_range', 'glXAllocateMemoryNV', 'glXFreeMemoryNV',
+'PFNGLXALLOCATEMEMORYNVPROC', 'PFNGLXFREEMEMORYNVPROC', 'GLX_NV_swap_group',
+'glXJoinSwapGroupNV', 'glXBindSwapBarrierNV', 'glXQuerySwapGroupNV',
+'glXQueryMaxSwapGroupsNV', 'glXQueryFrameCountNV', 'glXResetFrameCountNV',
+'PFNGLXJOINSWAPGROUPNVPROC', 'PFNGLXBINDSWAPBARRIERNVPROC',
+'PFNGLXQUERYSWAPGROUPNVPROC', 'PFNGLXQUERYMAXSWAPGROUPSNVPROC',
+'PFNGLXQUERYFRAMECOUNTNVPROC', 'PFNGLXRESETFRAMECOUNTNVPROC',
+'GLX_NV_video_out', 'glXGetVideoDeviceNV', 'glXReleaseVideoDeviceNV',
+'glXBindVideoImageNV', 'glXReleaseVideoImageNV', 'glXSendPbufferToVideoNV',
+'glXGetVideoInfoNV', 'PFNGLXGETVIDEODEVICENVPROC',
+'PFNGLXRELEASEVIDEODEVICENVPROC', 'PFNGLXBINDVIDEOIMAGENVPROC',
+'PFNGLXRELEASEVIDEOIMAGENVPROC', 'PFNGLXSENDPBUFFERTOVIDEONVPROC',
+'PFNGLXGETVIDEOINFONVPROC', 'glXBindTexImageEXT', 'glXReleaseTextImageEXT',
+'PFNGLXBINDTEXIMAGEEXTPROC', 'PFNGLXRELEASETEXIMAGEEXTPROC']
+# END GENERATED CONTENT (do not edit above this line)
+
+
+
+
+
+
+
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/lib.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/lib.py
new file mode 100644
index 0000000..8e56210
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/lib.py
@@ -0,0 +1,144 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+from __future__ import print_function
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import ctypes
+
+import pyglet
+
+__all__ = ['link_GL', 'link_GLU', 'link_AGL', 'link_GLX', 'link_WGL']
+
+_debug_gl = pyglet.options['debug_gl']
+_debug_gl_trace = pyglet.options['debug_gl_trace']
+_debug_gl_trace_args = pyglet.options['debug_gl_trace_args']
+
+class MissingFunctionException(Exception):
+ def __init__(self, name, requires=None, suggestions=None):
+ msg = '%s is not exported by the available OpenGL driver.' % name
+ if requires:
+ msg += ' %s is required for this functionality.' % requires
+ if suggestions:
+ msg += ' Consider alternative(s) %s.' % ', '.join(suggestions)
+ Exception.__init__(self, msg)
+
+def missing_function(name, requires=None, suggestions=None):
+ def MissingFunction(*args, **kwargs):
+ raise MissingFunctionException(name, requires, suggestions)
+ return MissingFunction
+
+_int_types = (ctypes.c_int16, ctypes.c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (ctypes.c_int64,)
+for t in _int_types:
+ if ctypes.sizeof(t) == ctypes.sizeof(ctypes.c_size_t):
+ c_ptrdiff_t = t
+
+class c_void(ctypes.Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', ctypes.c_int)]
+
+class GLException(Exception):
+ pass
+
+def errcheck(result, func, arguments):
+ if _debug_gl_trace:
+ try:
+ name = func.__name__
+ except AttributeError:
+ name = repr(func)
+ if _debug_gl_trace_args:
+ trace_args = ', '.join([repr(arg)[:20] for arg in arguments])
+ print('%s(%s)' % (name, trace_args))
+ else:
+ print(name)
+
+ from pyglet import gl
+ context = gl.current_context
+ if not context:
+ raise GLException('No GL context; create a Window first')
+ if not context._gl_begin:
+ error = gl.glGetError()
+ if error:
+ msg = ctypes.cast(gl.gluErrorString(error), ctypes.c_char_p).value
+ raise GLException(msg)
+ return result
+
+def errcheck_glbegin(result, func, arguments):
+ from pyglet import gl
+ context = gl.current_context
+ if not context:
+ raise GLException('No GL context; create a Window first')
+ context._gl_begin = True
+ return result
+
+def errcheck_glend(result, func, arguments):
+ from pyglet import gl
+ context = gl.current_context
+ if not context:
+ raise GLException('No GL context; create a Window first')
+ context._gl_begin = False
+ return errcheck(result, func, arguments)
+
+def decorate_function(func, name):
+ if _debug_gl:
+ if name == 'glBegin':
+ func.errcheck = errcheck_glbegin
+ elif name == 'glEnd':
+ func.errcheck = errcheck_glend
+ elif name not in ('glGetError', 'gluErrorString') and \
+ name[:3] not in ('glX', 'agl', 'wgl'):
+ func.errcheck = errcheck
+
+link_AGL = None
+link_GLX = None
+link_WGL = None
+
+if pyglet.compat_platform in ('win32', 'cygwin'):
+ from pyglet.gl.lib_wgl import link_GL, link_GLU, link_WGL
+elif pyglet.compat_platform == 'darwin':
+ from pyglet.gl.lib_agl import link_GL, link_GLU, link_AGL
+else:
+ from pyglet.gl.lib_glx import link_GL, link_GLU, link_GLX
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/lib_agl.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/lib_agl.py
new file mode 100644
index 0000000..ad2424f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/lib_agl.py
@@ -0,0 +1,74 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+from ctypes import *
+
+import pyglet.lib
+from pyglet.gl.lib import missing_function, decorate_function
+
+__all__ = ['link_GL', 'link_GLU', 'link_AGL']
+
+gl_lib = pyglet.lib.load_library(
+ framework='/System/Library/Frameworks/OpenGL.framework')
+agl_lib = pyglet.lib.load_library(
+ framework='/System/Library/Frameworks/AGL.framework')
+
+def link_GL(name, restype, argtypes, requires=None, suggestions=None):
+ try:
+ func = getattr(gl_lib, name)
+ func.restype = restype
+ func.argtypes = argtypes
+ decorate_function(func, name)
+ return func
+ except AttributeError:
+ return missing_function(name, requires, suggestions)
+
+link_GLU = link_GL
+
+def link_AGL(name, restype, argtypes, requires=None, suggestions=None):
+ try:
+ func = getattr(agl_lib, name)
+ func.restype = restype
+ func.argtypes = argtypes
+ decorate_function(func, name)
+ return func
+ except AttributeError:
+ return missing_function(name, requires, suggestions)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/lib_glx.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/lib_glx.py
new file mode 100644
index 0000000..85f8c87
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/lib_glx.py
@@ -0,0 +1,94 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+from ctypes import *
+
+import pyglet.lib
+from pyglet.gl.lib import missing_function, decorate_function
+
+from pyglet.compat import asbytes
+
+__all__ = ['link_GL', 'link_GLU', 'link_GLX']
+
+gl_lib = pyglet.lib.load_library('GL')
+glu_lib = pyglet.lib.load_library('GLU')
+
+# Look for glXGetProcAddressARB extension, use it as fallback (for
+# ATI fglrx and DRI drivers).
+try:
+ glXGetProcAddressARB = getattr(gl_lib, 'glXGetProcAddressARB')
+ glXGetProcAddressARB.restype = POINTER(CFUNCTYPE(None))
+ glXGetProcAddressARB.argtypes = [POINTER(c_ubyte)]
+ _have_getprocaddress = True
+except AttributeError:
+ _have_getprocaddress = False
+
+def link_GL(name, restype, argtypes, requires=None, suggestions=None):
+ try:
+ func = getattr(gl_lib, name)
+ func.restype = restype
+ func.argtypes = argtypes
+ decorate_function(func, name)
+ return func
+ except AttributeError:
+ if _have_getprocaddress:
+ # Fallback if implemented but not in ABI
+ bname = cast(pointer(create_string_buffer(asbytes(name))), POINTER(c_ubyte))
+ addr = glXGetProcAddressARB(bname)
+ if addr:
+ ftype = CFUNCTYPE(*((restype,) + tuple(argtypes)))
+ func = cast(addr, ftype)
+ decorate_function(func, name)
+ return func
+
+ return missing_function(name, requires, suggestions)
+
+link_GLX = link_GL
+
+def link_GLU(name, restype, argtypes, requires=None, suggestions=None):
+ try:
+ func = getattr(glu_lib, name)
+ func.restype = restype
+ func.argtypes = argtypes
+ decorate_function(func, name)
+ return func
+ except AttributeError:
+ return missing_function(name, requires, suggestions)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/lib_wgl.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/lib_wgl.py
new file mode 100644
index 0000000..dd0649e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/lib_wgl.py
@@ -0,0 +1,164 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: lib_glx.py 597 2007-02-03 16:13:07Z Alex.Holkner $'
+
+import ctypes
+from ctypes import *
+
+import pyglet
+from pyglet.gl.lib import missing_function, decorate_function
+from pyglet.compat import asbytes
+
+__all__ = ['link_GL', 'link_GLU', 'link_WGL']
+
+_debug_trace = pyglet.options['debug_trace']
+
+gl_lib = ctypes.windll.opengl32
+glu_lib = ctypes.windll.glu32
+wgl_lib = gl_lib
+
+if _debug_trace:
+ from pyglet.lib import _TraceLibrary
+ gl_lib = _TraceLibrary(gl_lib)
+ glu_lib = _TraceLibrary(glu_lib)
+ wgl_lib = _TraceLibrary(wgl_lib)
+
+try:
+ wglGetProcAddress = wgl_lib.wglGetProcAddress
+ wglGetProcAddress.restype = CFUNCTYPE(POINTER(c_int))
+ wglGetProcAddress.argtypes = [c_char_p]
+ _have_get_proc_address = True
+except AttributeError:
+ _have_get_proc_address = False
+
+class_slots = ['name', 'requires', 'suggestions', 'ftype','func']
+
+def makeWGLFunction(func):
+ class WGLFunction(object):
+ __slots__ = class_slots
+ __call__ = func
+
+ return WGLFunction
+
+class WGLFunctionProxy(object):
+ __slots__ = class_slots
+
+ def __init__(self, name, ftype, requires, suggestions):
+ assert _have_get_proc_address
+ self.name = name
+ self.ftype = ftype
+ self.requires = requires
+ self.suggestions = suggestions
+ self.func = None
+
+ def __call__(self, *args, **kwargs):
+ from pyglet.gl import current_context
+ if not current_context:
+ raise Exception(
+ 'Call to function "%s" before GL context created' % self.name)
+ address = wglGetProcAddress(asbytes(self.name))
+ if cast(address, POINTER(c_int)): # check cast because address is func
+ self.func = cast(address, self.ftype)
+ decorate_function(self.func, self.name)
+ else:
+ self.func = missing_function(
+ self.name, self.requires, self.suggestions)
+
+ self.__class__ = makeWGLFunction(self.func)
+
+ return self.func(*args, **kwargs)
+
+def link_GL(name, restype, argtypes, requires=None, suggestions=None):
+ try:
+ func = getattr(gl_lib, name)
+ func.restype = restype
+ func.argtypes = argtypes
+ decorate_function(func, name)
+ return func
+ except AttributeError:
+ # Not in opengl32.dll. Try and get a pointer from WGL.
+ try:
+ fargs = (restype,) + tuple(argtypes)
+ ftype = ctypes.WINFUNCTYPE(*fargs)
+ if _have_get_proc_address:
+ from pyglet.gl import gl_info
+ if gl_info.have_context():
+ address = wglGetProcAddress(name)
+ if address:
+ func = cast(address, ftype)
+ decorate_function(func, name)
+ return func
+ else:
+ # Insert proxy until we have a context
+ return WGLFunctionProxy(name, ftype, requires, suggestions)
+ except:
+ pass
+
+ return missing_function(name, requires, suggestions)
+
+def link_GLU(name, restype, argtypes, requires=None, suggestions=None):
+ try:
+ func = getattr(glu_lib, name)
+ func.restype = restype
+ func.argtypes = argtypes
+ decorate_function(func, name)
+ return func
+ except AttributeError:
+ # Not in glu32.dll. Try and get a pointer from WGL.
+ try:
+ fargs = (restype,) + tuple(argtypes)
+ ftype = ctypes.WINFUNCTYPE(*fargs)
+ if _have_get_proc_address:
+ from pyglet.gl import gl_info
+ if gl_info.have_context():
+ address = wglGetProcAddress(name)
+ if address:
+ func = cast(address, ftype)
+ decorate_function(func, name)
+ return func
+ else:
+ # Insert proxy until we have a context
+ return WGLFunctionProxy(name, ftype, requires, suggestions)
+ except:
+ pass
+
+ return missing_function(name, requires, suggestions)
+
+link_WGL = link_GL
\ No newline at end of file
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/wgl.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/wgl.py
new file mode 100644
index 0000000..5140d7d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/wgl.py
@@ -0,0 +1,374 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+'''Wrapper for C:\cygwin\home\Alex\pyglet\tools\wgl.h
+
+Generated by tools/gengl.py.
+Do not modify this file.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: gengl.py 601 2007-02-04 05:36:59Z Alex.Holkner $'
+
+from ctypes import *
+from pyglet.gl.lib import link_WGL as _link_function
+from pyglet.gl.lib import c_ptrdiff_t
+
+if not _link_function:
+ raise ImportError('opengl32.dll is not available.')
+
+# BEGIN GENERATED CONTENT (do not edit below this line)
+
+# This content is generated by tools/gengl.py.
+# Wrapper for C:\cygwin\home\Alex\pyglet\tools\wgl.h
+
+
+CONST = 0 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:14
+GLenum = c_uint # C:\cygwin\home\Alex\pyglet\tools\wgl.h:17
+GLboolean = c_ubyte # C:\cygwin\home\Alex\pyglet\tools\wgl.h:18
+GLbitfield = c_uint # C:\cygwin\home\Alex\pyglet\tools\wgl.h:19
+GLbyte = c_char # C:\cygwin\home\Alex\pyglet\tools\wgl.h:20
+GLshort = c_short # C:\cygwin\home\Alex\pyglet\tools\wgl.h:21
+GLint = c_int # C:\cygwin\home\Alex\pyglet\tools\wgl.h:22
+GLsizei = c_int # C:\cygwin\home\Alex\pyglet\tools\wgl.h:23
+GLubyte = c_ubyte # C:\cygwin\home\Alex\pyglet\tools\wgl.h:24
+GLushort = c_ushort # C:\cygwin\home\Alex\pyglet\tools\wgl.h:25
+GLuint = c_uint # C:\cygwin\home\Alex\pyglet\tools\wgl.h:26
+GLfloat = c_float # C:\cygwin\home\Alex\pyglet\tools\wgl.h:27
+GLclampf = c_float # C:\cygwin\home\Alex\pyglet\tools\wgl.h:28
+GLdouble = c_double # C:\cygwin\home\Alex\pyglet\tools\wgl.h:29
+GLclampd = c_double # C:\cygwin\home\Alex\pyglet\tools\wgl.h:30
+GLvoid = None # C:\cygwin\home\Alex\pyglet\tools\wgl.h:31
+INT8 = c_char # C:\cygwin\home\Alex\pyglet\tools\wgl.h:33
+PINT8 = c_char_p # C:\cygwin\home\Alex\pyglet\tools\wgl.h:33
+INT16 = c_short # C:\cygwin\home\Alex\pyglet\tools\wgl.h:34
+PINT16 = POINTER(c_short) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:34
+INT32 = c_int # C:\cygwin\home\Alex\pyglet\tools\wgl.h:35
+PINT32 = POINTER(c_int) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:35
+UINT8 = c_ubyte # C:\cygwin\home\Alex\pyglet\tools\wgl.h:36
+PUINT8 = POINTER(c_ubyte) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:36
+UINT16 = c_ushort # C:\cygwin\home\Alex\pyglet\tools\wgl.h:37
+PUINT16 = POINTER(c_ushort) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:37
+UINT32 = c_uint # C:\cygwin\home\Alex\pyglet\tools\wgl.h:38
+PUINT32 = POINTER(c_uint) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:38
+LONG32 = c_int # C:\cygwin\home\Alex\pyglet\tools\wgl.h:39
+PLONG32 = POINTER(c_int) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:39
+ULONG32 = c_uint # C:\cygwin\home\Alex\pyglet\tools\wgl.h:40
+PULONG32 = POINTER(c_uint) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:40
+DWORD32 = c_uint # C:\cygwin\home\Alex\pyglet\tools\wgl.h:41
+PDWORD32 = POINTER(c_uint) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:41
+INT64 = c_longlong # C:\cygwin\home\Alex\pyglet\tools\wgl.h:42
+PINT64 = POINTER(c_longlong) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:42
+UINT64 = c_ulonglong # C:\cygwin\home\Alex\pyglet\tools\wgl.h:43
+PUINT64 = POINTER(c_ulonglong) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:43
+VOID = None # C:\cygwin\home\Alex\pyglet\tools\wgl.h:45
+LPVOID = POINTER(None) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:45
+LPCSTR = c_char_p # C:\cygwin\home\Alex\pyglet\tools\wgl.h:46
+CHAR = c_char # C:\cygwin\home\Alex\pyglet\tools\wgl.h:47
+BYTE = c_ubyte # C:\cygwin\home\Alex\pyglet\tools\wgl.h:48
+WORD = c_ushort # C:\cygwin\home\Alex\pyglet\tools\wgl.h:49
+USHORT = c_ushort # C:\cygwin\home\Alex\pyglet\tools\wgl.h:49
+UINT = c_uint # C:\cygwin\home\Alex\pyglet\tools\wgl.h:50
+INT = c_int # C:\cygwin\home\Alex\pyglet\tools\wgl.h:51
+INT_PTR = POINTER(c_int) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:51
+BOOL = c_long # C:\cygwin\home\Alex\pyglet\tools\wgl.h:52
+LONG = c_long # C:\cygwin\home\Alex\pyglet\tools\wgl.h:53
+DWORD = c_ulong # C:\cygwin\home\Alex\pyglet\tools\wgl.h:54
+FLOAT = c_float # C:\cygwin\home\Alex\pyglet\tools\wgl.h:55
+COLORREF = DWORD # C:\cygwin\home\Alex\pyglet\tools\wgl.h:56
+LPCOLORREF = POINTER(DWORD) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:56
+HANDLE = POINTER(None) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:58
+HGLRC = HANDLE # C:\cygwin\home\Alex\pyglet\tools\wgl.h:60
+HDC = HANDLE # C:\cygwin\home\Alex\pyglet\tools\wgl.h:61
+PROC = CFUNCTYPE(INT_PTR) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:63
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:65
+wglCopyContext = _link_function('wglCopyContext', BOOL, [HGLRC, HGLRC, UINT], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:66
+wglCreateContext = _link_function('wglCreateContext', HGLRC, [HDC], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:67
+wglCreateLayerContext = _link_function('wglCreateLayerContext', HGLRC, [HDC, c_int], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:68
+wglDeleteContext = _link_function('wglDeleteContext', BOOL, [HGLRC], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:69
+wglGetCurrentContext = _link_function('wglGetCurrentContext', HGLRC, [], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:70
+wglGetCurrentDC = _link_function('wglGetCurrentDC', HDC, [], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:71
+wglGetProcAddress = _link_function('wglGetProcAddress', PROC, [LPCSTR], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:72
+wglMakeCurrent = _link_function('wglMakeCurrent', BOOL, [HDC, HGLRC], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:73
+wglShareLists = _link_function('wglShareLists', BOOL, [HGLRC, HGLRC], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:74
+wglUseFontBitmapsA = _link_function('wglUseFontBitmapsA', BOOL, [HDC, DWORD, DWORD, DWORD], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:75
+wglUseFontBitmapsW = _link_function('wglUseFontBitmapsW', BOOL, [HDC, DWORD, DWORD, DWORD], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:76
+SwapBuffers = _link_function('SwapBuffers', BOOL, [HDC], None)
+
+class struct__POINTFLOAT(Structure):
+ __slots__ = [
+ 'x',
+ 'y',
+ ]
+struct__POINTFLOAT._fields_ = [
+ ('x', FLOAT),
+ ('y', FLOAT),
+]
+
+POINTFLOAT = struct__POINTFLOAT # C:\cygwin\home\Alex\pyglet\tools\wgl.h:81
+PPOINTFLOAT = POINTER(struct__POINTFLOAT) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:81
+class struct__GLYPHMETRICSFLOAT(Structure):
+ __slots__ = [
+ 'gmfBlackBoxX',
+ 'gmfBlackBoxY',
+ 'gmfptGlyphOrigin',
+ 'gmfCellIncX',
+ 'gmfCellIncY',
+ ]
+struct__GLYPHMETRICSFLOAT._fields_ = [
+ ('gmfBlackBoxX', FLOAT),
+ ('gmfBlackBoxY', FLOAT),
+ ('gmfptGlyphOrigin', POINTFLOAT),
+ ('gmfCellIncX', FLOAT),
+ ('gmfCellIncY', FLOAT),
+]
+
+GLYPHMETRICSFLOAT = struct__GLYPHMETRICSFLOAT # C:\cygwin\home\Alex\pyglet\tools\wgl.h:89
+PGLYPHMETRICSFLOAT = POINTER(struct__GLYPHMETRICSFLOAT) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:89
+LPGLYPHMETRICSFLOAT = POINTER(struct__GLYPHMETRICSFLOAT) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:89
+WGL_FONT_LINES = 0 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:91
+WGL_FONT_POLYGONS = 1 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:92
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:93
+wglUseFontOutlinesA = _link_function('wglUseFontOutlinesA', BOOL, [HDC, DWORD, DWORD, DWORD, FLOAT, FLOAT, c_int, LPGLYPHMETRICSFLOAT], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:95
+wglUseFontOutlinesW = _link_function('wglUseFontOutlinesW', BOOL, [HDC, DWORD, DWORD, DWORD, FLOAT, FLOAT, c_int, LPGLYPHMETRICSFLOAT], None)
+
+class struct_tagLAYERPLANEDESCRIPTOR(Structure):
+ __slots__ = [
+ 'nSize',
+ 'nVersion',
+ 'dwFlags',
+ 'iPixelType',
+ 'cColorBits',
+ 'cRedBits',
+ 'cRedShift',
+ 'cGreenBits',
+ 'cGreenShift',
+ 'cBlueBits',
+ 'cBlueShift',
+ 'cAlphaBits',
+ 'cAlphaShift',
+ 'cAccumBits',
+ 'cAccumRedBits',
+ 'cAccumGreenBits',
+ 'cAccumBlueBits',
+ 'cAccumAlphaBits',
+ 'cDepthBits',
+ 'cStencilBits',
+ 'cAuxBuffers',
+ 'iLayerPlane',
+ 'bReserved',
+ 'crTransparent',
+ ]
+struct_tagLAYERPLANEDESCRIPTOR._fields_ = [
+ ('nSize', WORD),
+ ('nVersion', WORD),
+ ('dwFlags', DWORD),
+ ('iPixelType', BYTE),
+ ('cColorBits', BYTE),
+ ('cRedBits', BYTE),
+ ('cRedShift', BYTE),
+ ('cGreenBits', BYTE),
+ ('cGreenShift', BYTE),
+ ('cBlueBits', BYTE),
+ ('cBlueShift', BYTE),
+ ('cAlphaBits', BYTE),
+ ('cAlphaShift', BYTE),
+ ('cAccumBits', BYTE),
+ ('cAccumRedBits', BYTE),
+ ('cAccumGreenBits', BYTE),
+ ('cAccumBlueBits', BYTE),
+ ('cAccumAlphaBits', BYTE),
+ ('cDepthBits', BYTE),
+ ('cStencilBits', BYTE),
+ ('cAuxBuffers', BYTE),
+ ('iLayerPlane', BYTE),
+ ('bReserved', BYTE),
+ ('crTransparent', COLORREF),
+]
+
+LAYERPLANEDESCRIPTOR = struct_tagLAYERPLANEDESCRIPTOR # C:\cygwin\home\Alex\pyglet\tools\wgl.h:125
+PLAYERPLANEDESCRIPTOR = POINTER(struct_tagLAYERPLANEDESCRIPTOR) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:125
+LPLAYERPLANEDESCRIPTOR = POINTER(struct_tagLAYERPLANEDESCRIPTOR) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:125
+LPD_DOUBLEBUFFER = 1 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:128
+LPD_STEREO = 2 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:129
+LPD_SUPPORT_GDI = 16 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:130
+LPD_SUPPORT_OPENGL = 32 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:131
+LPD_SHARE_DEPTH = 64 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:132
+LPD_SHARE_STENCIL = 128 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:133
+LPD_SHARE_ACCUM = 256 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:134
+LPD_SWAP_EXCHANGE = 512 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:135
+LPD_SWAP_COPY = 1024 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:136
+LPD_TRANSPARENT = 4096 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:137
+LPD_TYPE_RGBA = 0 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:139
+LPD_TYPE_COLORINDEX = 1 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:140
+WGL_SWAP_MAIN_PLANE = 1 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:143
+WGL_SWAP_OVERLAY1 = 2 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:144
+WGL_SWAP_OVERLAY2 = 4 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:145
+WGL_SWAP_OVERLAY3 = 8 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:146
+WGL_SWAP_OVERLAY4 = 16 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:147
+WGL_SWAP_OVERLAY5 = 32 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:148
+WGL_SWAP_OVERLAY6 = 64 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:149
+WGL_SWAP_OVERLAY7 = 128 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:150
+WGL_SWAP_OVERLAY8 = 256 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:151
+WGL_SWAP_OVERLAY9 = 512 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:152
+WGL_SWAP_OVERLAY10 = 1024 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:153
+WGL_SWAP_OVERLAY11 = 2048 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:154
+WGL_SWAP_OVERLAY12 = 4096 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:155
+WGL_SWAP_OVERLAY13 = 8192 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:156
+WGL_SWAP_OVERLAY14 = 16384 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:157
+WGL_SWAP_OVERLAY15 = 32768 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:158
+WGL_SWAP_UNDERLAY1 = 65536 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:159
+WGL_SWAP_UNDERLAY2 = 131072 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:160
+WGL_SWAP_UNDERLAY3 = 262144 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:161
+WGL_SWAP_UNDERLAY4 = 524288 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:162
+WGL_SWAP_UNDERLAY5 = 1048576 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:163
+WGL_SWAP_UNDERLAY6 = 2097152 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:164
+WGL_SWAP_UNDERLAY7 = 4194304 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:165
+WGL_SWAP_UNDERLAY8 = 8388608 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:166
+WGL_SWAP_UNDERLAY9 = 16777216 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:167
+WGL_SWAP_UNDERLAY10 = 33554432 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:168
+WGL_SWAP_UNDERLAY11 = 67108864 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:169
+WGL_SWAP_UNDERLAY12 = 134217728 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:170
+WGL_SWAP_UNDERLAY13 = 268435456 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:171
+WGL_SWAP_UNDERLAY14 = 536870912 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:172
+WGL_SWAP_UNDERLAY15 = 1073741824 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:173
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:175
+wglDescribeLayerPlane = _link_function('wglDescribeLayerPlane', BOOL, [HDC, c_int, c_int, UINT, LPLAYERPLANEDESCRIPTOR], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:177
+wglSetLayerPaletteEntries = _link_function('wglSetLayerPaletteEntries', c_int, [HDC, c_int, c_int, c_int, POINTER(COLORREF)], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:179
+wglGetLayerPaletteEntries = _link_function('wglGetLayerPaletteEntries', c_int, [HDC, c_int, c_int, c_int, POINTER(COLORREF)], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:181
+wglRealizeLayerPalette = _link_function('wglRealizeLayerPalette', BOOL, [HDC, c_int, BOOL], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:182
+wglSwapLayerBuffers = _link_function('wglSwapLayerBuffers', BOOL, [HDC, UINT], None)
+
+class struct__WGLSWAP(Structure):
+ __slots__ = [
+ 'hdc',
+ 'uiFlags',
+ ]
+struct__WGLSWAP._fields_ = [
+ ('hdc', HDC),
+ ('uiFlags', UINT),
+]
+
+WGLSWAP = struct__WGLSWAP # C:\cygwin\home\Alex\pyglet\tools\wgl.h:188
+PWGLSWAP = POINTER(struct__WGLSWAP) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:188
+LPWGLSWAP = POINTER(struct__WGLSWAP) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:188
+WGL_SWAPMULTIPLE_MAX = 16 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:190
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:192
+wglSwapMultipleBuffers = _link_function('wglSwapMultipleBuffers', DWORD, [UINT, POINTER(WGLSWAP)], None)
+
+class struct_tagRECT(Structure):
+ __slots__ = [
+ 'left',
+ 'top',
+ 'right',
+ 'bottom',
+ ]
+struct_tagRECT._fields_ = [
+ ('left', LONG),
+ ('top', LONG),
+ ('right', LONG),
+ ('bottom', LONG),
+]
+
+RECT = struct_tagRECT # C:\cygwin\home\Alex\pyglet\tools\wgl.h:200
+PRECT = POINTER(struct_tagRECT) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:200
+NPRECT = POINTER(struct_tagRECT) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:200
+LPRECT = POINTER(struct_tagRECT) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:200
+
+__all__ = ['CONST', 'GLenum', 'GLboolean', 'GLbitfield', 'GLbyte', 'GLshort',
+'GLint', 'GLsizei', 'GLubyte', 'GLushort', 'GLuint', 'GLfloat', 'GLclampf',
+'GLdouble', 'GLclampd', 'GLvoid', 'INT8', 'PINT8', 'INT16', 'PINT16', 'INT32',
+'PINT32', 'UINT8', 'PUINT8', 'UINT16', 'PUINT16', 'UINT32', 'PUINT32',
+'LONG32', 'PLONG32', 'ULONG32', 'PULONG32', 'DWORD32', 'PDWORD32', 'INT64',
+'PINT64', 'UINT64', 'PUINT64', 'VOID', 'LPVOID', 'LPCSTR', 'CHAR', 'BYTE',
+'WORD', 'USHORT', 'UINT', 'INT', 'INT_PTR', 'BOOL', 'LONG', 'DWORD', 'FLOAT',
+'COLORREF', 'LPCOLORREF', 'HANDLE', 'HGLRC', 'HDC', 'PROC', 'wglCopyContext',
+'wglCreateContext', 'wglCreateLayerContext', 'wglDeleteContext',
+'wglGetCurrentContext', 'wglGetCurrentDC', 'wglGetProcAddress',
+'wglMakeCurrent', 'wglShareLists', 'wglUseFontBitmapsA', 'wglUseFontBitmapsW',
+'SwapBuffers', 'POINTFLOAT', 'PPOINTFLOAT', 'GLYPHMETRICSFLOAT',
+'PGLYPHMETRICSFLOAT', 'LPGLYPHMETRICSFLOAT', 'WGL_FONT_LINES',
+'WGL_FONT_POLYGONS', 'wglUseFontOutlinesA', 'wglUseFontOutlinesW',
+'LAYERPLANEDESCRIPTOR', 'PLAYERPLANEDESCRIPTOR', 'LPLAYERPLANEDESCRIPTOR',
+'LPD_DOUBLEBUFFER', 'LPD_STEREO', 'LPD_SUPPORT_GDI', 'LPD_SUPPORT_OPENGL',
+'LPD_SHARE_DEPTH', 'LPD_SHARE_STENCIL', 'LPD_SHARE_ACCUM',
+'LPD_SWAP_EXCHANGE', 'LPD_SWAP_COPY', 'LPD_TRANSPARENT', 'LPD_TYPE_RGBA',
+'LPD_TYPE_COLORINDEX', 'WGL_SWAP_MAIN_PLANE', 'WGL_SWAP_OVERLAY1',
+'WGL_SWAP_OVERLAY2', 'WGL_SWAP_OVERLAY3', 'WGL_SWAP_OVERLAY4',
+'WGL_SWAP_OVERLAY5', 'WGL_SWAP_OVERLAY6', 'WGL_SWAP_OVERLAY7',
+'WGL_SWAP_OVERLAY8', 'WGL_SWAP_OVERLAY9', 'WGL_SWAP_OVERLAY10',
+'WGL_SWAP_OVERLAY11', 'WGL_SWAP_OVERLAY12', 'WGL_SWAP_OVERLAY13',
+'WGL_SWAP_OVERLAY14', 'WGL_SWAP_OVERLAY15', 'WGL_SWAP_UNDERLAY1',
+'WGL_SWAP_UNDERLAY2', 'WGL_SWAP_UNDERLAY3', 'WGL_SWAP_UNDERLAY4',
+'WGL_SWAP_UNDERLAY5', 'WGL_SWAP_UNDERLAY6', 'WGL_SWAP_UNDERLAY7',
+'WGL_SWAP_UNDERLAY8', 'WGL_SWAP_UNDERLAY9', 'WGL_SWAP_UNDERLAY10',
+'WGL_SWAP_UNDERLAY11', 'WGL_SWAP_UNDERLAY12', 'WGL_SWAP_UNDERLAY13',
+'WGL_SWAP_UNDERLAY14', 'WGL_SWAP_UNDERLAY15', 'wglDescribeLayerPlane',
+'wglSetLayerPaletteEntries', 'wglGetLayerPaletteEntries',
+'wglRealizeLayerPalette', 'wglSwapLayerBuffers', 'WGLSWAP', 'PWGLSWAP',
+'LPWGLSWAP', 'WGL_SWAPMULTIPLE_MAX', 'wglSwapMultipleBuffers', 'RECT',
+'PRECT', 'NPRECT', 'LPRECT']
+# END GENERATED CONTENT (do not edit above this line)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/wgl_info.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/wgl_info.py
new file mode 100644
index 0000000..ddb7333
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/wgl_info.py
@@ -0,0 +1,73 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Cached information about version and extensions of current WGL
+implementation.
+'''
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: glx_info.py 615 2007-02-07 13:17:05Z Alex.Holkner $'
+
+from ctypes import *
+import warnings
+
+from pyglet.gl.lib import MissingFunctionException
+from pyglet.gl.gl import *
+from pyglet.gl import gl_info
+from pyglet.gl.wgl import *
+from pyglet.gl.wglext_arb import *
+from pyglet.compat import asstr
+
+class WGLInfoException(Exception):
+ pass
+
+class WGLInfo(object):
+ def get_extensions(self):
+ if not gl_info.have_context():
+ warnings.warn("Can't query WGL until a context is created.")
+ return []
+
+ try:
+ return asstr(wglGetExtensionsStringEXT()).split()
+ except MissingFunctionException:
+ return asstr(cast(glGetString(GL_EXTENSIONS), c_char_p).value).split()
+
+ def have_extension(self, extension):
+ return extension in self.get_extensions()
+
+_wgl_info = WGLInfo()
+
+get_extensions = _wgl_info.get_extensions
+have_extension = _wgl_info.have_extension
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/wglext_arb.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/wglext_arb.py
new file mode 100644
index 0000000..5571221
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/wglext_arb.py
@@ -0,0 +1,1025 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+'''Wrapper for http://oss.sgi.com/projects/ogl-sample/ABI/wglext.h
+
+Generated by tools/gengl.py.
+Do not modify this file.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: gengl.py 601 2007-02-04 05:36:59Z Alex.Holkner $'
+
+from ctypes import *
+from pyglet.gl.lib import link_WGL as _link_function
+from pyglet.gl.lib import c_ptrdiff_t, c_void
+
+
+
+# BEGIN GENERATED CONTENT (do not edit below this line)
+
+# This content is generated by tools/gengl.py.
+# Wrapper for http://www.opengl.org/registry/api/wglext.h
+
+
+# H (C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:7)
+# H (C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:7)
+WIN32_LEAN_AND_MEAN = 1 # http://www.opengl.org/registry/api/wglext.h:34
+WGL_WGLEXT_VERSION = 11 # http://www.opengl.org/registry/api/wglext.h:53
+# ARB_buffer_region (http://www.opengl.org/registry/api/wglext.h:55)
+WGL_FRONT_COLOR_BUFFER_BIT_ARB = 1 # http://www.opengl.org/registry/api/wglext.h:56
+WGL_BACK_COLOR_BUFFER_BIT_ARB = 2 # http://www.opengl.org/registry/api/wglext.h:57
+WGL_DEPTH_BUFFER_BIT_ARB = 4 # http://www.opengl.org/registry/api/wglext.h:58
+WGL_STENCIL_BUFFER_BIT_ARB = 8 # http://www.opengl.org/registry/api/wglext.h:59
+# ARB_multisample (http://www.opengl.org/registry/api/wglext.h:62)
+WGL_SAMPLE_BUFFERS_ARB = 8257 # http://www.opengl.org/registry/api/wglext.h:63
+WGL_SAMPLES_ARB = 8258 # http://www.opengl.org/registry/api/wglext.h:64
+# ARB_extensions_string (http://www.opengl.org/registry/api/wglext.h:67)
+# ARB_pixel_format (http://www.opengl.org/registry/api/wglext.h:70)
+WGL_NUMBER_PIXEL_FORMATS_ARB = 8192 # http://www.opengl.org/registry/api/wglext.h:71
+WGL_DRAW_TO_WINDOW_ARB = 8193 # http://www.opengl.org/registry/api/wglext.h:72
+WGL_DRAW_TO_BITMAP_ARB = 8194 # http://www.opengl.org/registry/api/wglext.h:73
+WGL_ACCELERATION_ARB = 8195 # http://www.opengl.org/registry/api/wglext.h:74
+WGL_NEED_PALETTE_ARB = 8196 # http://www.opengl.org/registry/api/wglext.h:75
+WGL_NEED_SYSTEM_PALETTE_ARB = 8197 # http://www.opengl.org/registry/api/wglext.h:76
+WGL_SWAP_LAYER_BUFFERS_ARB = 8198 # http://www.opengl.org/registry/api/wglext.h:77
+WGL_SWAP_METHOD_ARB = 8199 # http://www.opengl.org/registry/api/wglext.h:78
+WGL_NUMBER_OVERLAYS_ARB = 8200 # http://www.opengl.org/registry/api/wglext.h:79
+WGL_NUMBER_UNDERLAYS_ARB = 8201 # http://www.opengl.org/registry/api/wglext.h:80
+WGL_TRANSPARENT_ARB = 8202 # http://www.opengl.org/registry/api/wglext.h:81
+WGL_TRANSPARENT_RED_VALUE_ARB = 8247 # http://www.opengl.org/registry/api/wglext.h:82
+WGL_TRANSPARENT_GREEN_VALUE_ARB = 8248 # http://www.opengl.org/registry/api/wglext.h:83
+WGL_TRANSPARENT_BLUE_VALUE_ARB = 8249 # http://www.opengl.org/registry/api/wglext.h:84
+WGL_TRANSPARENT_ALPHA_VALUE_ARB = 8250 # http://www.opengl.org/registry/api/wglext.h:85
+WGL_TRANSPARENT_INDEX_VALUE_ARB = 8251 # http://www.opengl.org/registry/api/wglext.h:86
+WGL_SHARE_DEPTH_ARB = 8204 # http://www.opengl.org/registry/api/wglext.h:87
+WGL_SHARE_STENCIL_ARB = 8205 # http://www.opengl.org/registry/api/wglext.h:88
+WGL_SHARE_ACCUM_ARB = 8206 # http://www.opengl.org/registry/api/wglext.h:89
+WGL_SUPPORT_GDI_ARB = 8207 # http://www.opengl.org/registry/api/wglext.h:90
+WGL_SUPPORT_OPENGL_ARB = 8208 # http://www.opengl.org/registry/api/wglext.h:91
+WGL_DOUBLE_BUFFER_ARB = 8209 # http://www.opengl.org/registry/api/wglext.h:92
+WGL_STEREO_ARB = 8210 # http://www.opengl.org/registry/api/wglext.h:93
+WGL_PIXEL_TYPE_ARB = 8211 # http://www.opengl.org/registry/api/wglext.h:94
+WGL_COLOR_BITS_ARB = 8212 # http://www.opengl.org/registry/api/wglext.h:95
+WGL_RED_BITS_ARB = 8213 # http://www.opengl.org/registry/api/wglext.h:96
+WGL_RED_SHIFT_ARB = 8214 # http://www.opengl.org/registry/api/wglext.h:97
+WGL_GREEN_BITS_ARB = 8215 # http://www.opengl.org/registry/api/wglext.h:98
+WGL_GREEN_SHIFT_ARB = 8216 # http://www.opengl.org/registry/api/wglext.h:99
+WGL_BLUE_BITS_ARB = 8217 # http://www.opengl.org/registry/api/wglext.h:100
+WGL_BLUE_SHIFT_ARB = 8218 # http://www.opengl.org/registry/api/wglext.h:101
+WGL_ALPHA_BITS_ARB = 8219 # http://www.opengl.org/registry/api/wglext.h:102
+WGL_ALPHA_SHIFT_ARB = 8220 # http://www.opengl.org/registry/api/wglext.h:103
+WGL_ACCUM_BITS_ARB = 8221 # http://www.opengl.org/registry/api/wglext.h:104
+WGL_ACCUM_RED_BITS_ARB = 8222 # http://www.opengl.org/registry/api/wglext.h:105
+WGL_ACCUM_GREEN_BITS_ARB = 8223 # http://www.opengl.org/registry/api/wglext.h:106
+WGL_ACCUM_BLUE_BITS_ARB = 8224 # http://www.opengl.org/registry/api/wglext.h:107
+WGL_ACCUM_ALPHA_BITS_ARB = 8225 # http://www.opengl.org/registry/api/wglext.h:108
+WGL_DEPTH_BITS_ARB = 8226 # http://www.opengl.org/registry/api/wglext.h:109
+WGL_STENCIL_BITS_ARB = 8227 # http://www.opengl.org/registry/api/wglext.h:110
+WGL_AUX_BUFFERS_ARB = 8228 # http://www.opengl.org/registry/api/wglext.h:111
+WGL_NO_ACCELERATION_ARB = 8229 # http://www.opengl.org/registry/api/wglext.h:112
+WGL_GENERIC_ACCELERATION_ARB = 8230 # http://www.opengl.org/registry/api/wglext.h:113
+WGL_FULL_ACCELERATION_ARB = 8231 # http://www.opengl.org/registry/api/wglext.h:114
+WGL_SWAP_EXCHANGE_ARB = 8232 # http://www.opengl.org/registry/api/wglext.h:115
+WGL_SWAP_COPY_ARB = 8233 # http://www.opengl.org/registry/api/wglext.h:116
+WGL_SWAP_UNDEFINED_ARB = 8234 # http://www.opengl.org/registry/api/wglext.h:117
+WGL_TYPE_RGBA_ARB = 8235 # http://www.opengl.org/registry/api/wglext.h:118
+WGL_TYPE_COLORINDEX_ARB = 8236 # http://www.opengl.org/registry/api/wglext.h:119
+# ARB_make_current_read (http://www.opengl.org/registry/api/wglext.h:122)
+ERROR_INVALID_PIXEL_TYPE_ARB = 8259 # http://www.opengl.org/registry/api/wglext.h:123
+ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB = 8276 # http://www.opengl.org/registry/api/wglext.h:124
+# ARB_pbuffer (http://www.opengl.org/registry/api/wglext.h:127)
+WGL_DRAW_TO_PBUFFER_ARB = 8237 # http://www.opengl.org/registry/api/wglext.h:128
+WGL_MAX_PBUFFER_PIXELS_ARB = 8238 # http://www.opengl.org/registry/api/wglext.h:129
+WGL_MAX_PBUFFER_WIDTH_ARB = 8239 # http://www.opengl.org/registry/api/wglext.h:130
+WGL_MAX_PBUFFER_HEIGHT_ARB = 8240 # http://www.opengl.org/registry/api/wglext.h:131
+WGL_PBUFFER_LARGEST_ARB = 8243 # http://www.opengl.org/registry/api/wglext.h:132
+WGL_PBUFFER_WIDTH_ARB = 8244 # http://www.opengl.org/registry/api/wglext.h:133
+WGL_PBUFFER_HEIGHT_ARB = 8245 # http://www.opengl.org/registry/api/wglext.h:134
+WGL_PBUFFER_LOST_ARB = 8246 # http://www.opengl.org/registry/api/wglext.h:135
+# ARB_render_texture (http://www.opengl.org/registry/api/wglext.h:138)
+WGL_BIND_TO_TEXTURE_RGB_ARB = 8304 # http://www.opengl.org/registry/api/wglext.h:139
+WGL_BIND_TO_TEXTURE_RGBA_ARB = 8305 # http://www.opengl.org/registry/api/wglext.h:140
+WGL_TEXTURE_FORMAT_ARB = 8306 # http://www.opengl.org/registry/api/wglext.h:141
+WGL_TEXTURE_TARGET_ARB = 8307 # http://www.opengl.org/registry/api/wglext.h:142
+WGL_MIPMAP_TEXTURE_ARB = 8308 # http://www.opengl.org/registry/api/wglext.h:143
+WGL_TEXTURE_RGB_ARB = 8309 # http://www.opengl.org/registry/api/wglext.h:144
+WGL_TEXTURE_RGBA_ARB = 8310 # http://www.opengl.org/registry/api/wglext.h:145
+WGL_NO_TEXTURE_ARB = 8311 # http://www.opengl.org/registry/api/wglext.h:146
+WGL_TEXTURE_CUBE_MAP_ARB = 8312 # http://www.opengl.org/registry/api/wglext.h:147
+WGL_TEXTURE_1D_ARB = 8313 # http://www.opengl.org/registry/api/wglext.h:148
+WGL_TEXTURE_2D_ARB = 8314 # http://www.opengl.org/registry/api/wglext.h:149
+WGL_MIPMAP_LEVEL_ARB = 8315 # http://www.opengl.org/registry/api/wglext.h:150
+WGL_CUBE_MAP_FACE_ARB = 8316 # http://www.opengl.org/registry/api/wglext.h:151
+WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = 8317 # http://www.opengl.org/registry/api/wglext.h:152
+WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = 8318 # http://www.opengl.org/registry/api/wglext.h:153
+WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = 8319 # http://www.opengl.org/registry/api/wglext.h:154
+WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = 8320 # http://www.opengl.org/registry/api/wglext.h:155
+WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = 8321 # http://www.opengl.org/registry/api/wglext.h:156
+WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = 8322 # http://www.opengl.org/registry/api/wglext.h:157
+WGL_FRONT_LEFT_ARB = 8323 # http://www.opengl.org/registry/api/wglext.h:158
+WGL_FRONT_RIGHT_ARB = 8324 # http://www.opengl.org/registry/api/wglext.h:159
+WGL_BACK_LEFT_ARB = 8325 # http://www.opengl.org/registry/api/wglext.h:160
+WGL_BACK_RIGHT_ARB = 8326 # http://www.opengl.org/registry/api/wglext.h:161
+WGL_AUX0_ARB = 8327 # http://www.opengl.org/registry/api/wglext.h:162
+WGL_AUX1_ARB = 8328 # http://www.opengl.org/registry/api/wglext.h:163
+WGL_AUX2_ARB = 8329 # http://www.opengl.org/registry/api/wglext.h:164
+WGL_AUX3_ARB = 8330 # http://www.opengl.org/registry/api/wglext.h:165
+WGL_AUX4_ARB = 8331 # http://www.opengl.org/registry/api/wglext.h:166
+WGL_AUX5_ARB = 8332 # http://www.opengl.org/registry/api/wglext.h:167
+WGL_AUX6_ARB = 8333 # http://www.opengl.org/registry/api/wglext.h:168
+WGL_AUX7_ARB = 8334 # http://www.opengl.org/registry/api/wglext.h:169
+WGL_AUX8_ARB = 8335 # http://www.opengl.org/registry/api/wglext.h:170
+WGL_AUX9_ARB = 8336 # http://www.opengl.org/registry/api/wglext.h:171
+# ARB_pixel_format_float (http://www.opengl.org/registry/api/wglext.h:174)
+WGL_TYPE_RGBA_FLOAT_ARB = 8608 # http://www.opengl.org/registry/api/wglext.h:175
+# ARB_create_context (http://www.opengl.org/registry/api/wglext.h:178)
+WGL_CONTEXT_DEBUG_BIT_ARB = 1 # http://www.opengl.org/registry/api/wglext.h:179
+WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 2 # http://www.opengl.org/registry/api/wglext.h:180
+WGL_CONTEXT_MAJOR_VERSION_ARB = 8337 # http://www.opengl.org/registry/api/wglext.h:181
+WGL_CONTEXT_MINOR_VERSION_ARB = 8338 # http://www.opengl.org/registry/api/wglext.h:182
+WGL_CONTEXT_LAYER_PLANE_ARB = 8339 # http://www.opengl.org/registry/api/wglext.h:183
+WGL_CONTEXT_FLAGS_ARB = 8340 # http://www.opengl.org/registry/api/wglext.h:184
+ERROR_INVALID_VERSION_ARB = 8341 # http://www.opengl.org/registry/api/wglext.h:185
+# EXT_make_current_read (http://www.opengl.org/registry/api/wglext.h:188)
+ERROR_INVALID_PIXEL_TYPE_EXT = 8259 # http://www.opengl.org/registry/api/wglext.h:189
+# EXT_pixel_format (http://www.opengl.org/registry/api/wglext.h:192)
+WGL_NUMBER_PIXEL_FORMATS_EXT = 8192 # http://www.opengl.org/registry/api/wglext.h:193
+WGL_DRAW_TO_WINDOW_EXT = 8193 # http://www.opengl.org/registry/api/wglext.h:194
+WGL_DRAW_TO_BITMAP_EXT = 8194 # http://www.opengl.org/registry/api/wglext.h:195
+WGL_ACCELERATION_EXT = 8195 # http://www.opengl.org/registry/api/wglext.h:196
+WGL_NEED_PALETTE_EXT = 8196 # http://www.opengl.org/registry/api/wglext.h:197
+WGL_NEED_SYSTEM_PALETTE_EXT = 8197 # http://www.opengl.org/registry/api/wglext.h:198
+WGL_SWAP_LAYER_BUFFERS_EXT = 8198 # http://www.opengl.org/registry/api/wglext.h:199
+WGL_SWAP_METHOD_EXT = 8199 # http://www.opengl.org/registry/api/wglext.h:200
+WGL_NUMBER_OVERLAYS_EXT = 8200 # http://www.opengl.org/registry/api/wglext.h:201
+WGL_NUMBER_UNDERLAYS_EXT = 8201 # http://www.opengl.org/registry/api/wglext.h:202
+WGL_TRANSPARENT_EXT = 8202 # http://www.opengl.org/registry/api/wglext.h:203
+WGL_TRANSPARENT_VALUE_EXT = 8203 # http://www.opengl.org/registry/api/wglext.h:204
+WGL_SHARE_DEPTH_EXT = 8204 # http://www.opengl.org/registry/api/wglext.h:205
+WGL_SHARE_STENCIL_EXT = 8205 # http://www.opengl.org/registry/api/wglext.h:206
+WGL_SHARE_ACCUM_EXT = 8206 # http://www.opengl.org/registry/api/wglext.h:207
+WGL_SUPPORT_GDI_EXT = 8207 # http://www.opengl.org/registry/api/wglext.h:208
+WGL_SUPPORT_OPENGL_EXT = 8208 # http://www.opengl.org/registry/api/wglext.h:209
+WGL_DOUBLE_BUFFER_EXT = 8209 # http://www.opengl.org/registry/api/wglext.h:210
+WGL_STEREO_EXT = 8210 # http://www.opengl.org/registry/api/wglext.h:211
+WGL_PIXEL_TYPE_EXT = 8211 # http://www.opengl.org/registry/api/wglext.h:212
+WGL_COLOR_BITS_EXT = 8212 # http://www.opengl.org/registry/api/wglext.h:213
+WGL_RED_BITS_EXT = 8213 # http://www.opengl.org/registry/api/wglext.h:214
+WGL_RED_SHIFT_EXT = 8214 # http://www.opengl.org/registry/api/wglext.h:215
+WGL_GREEN_BITS_EXT = 8215 # http://www.opengl.org/registry/api/wglext.h:216
+WGL_GREEN_SHIFT_EXT = 8216 # http://www.opengl.org/registry/api/wglext.h:217
+WGL_BLUE_BITS_EXT = 8217 # http://www.opengl.org/registry/api/wglext.h:218
+WGL_BLUE_SHIFT_EXT = 8218 # http://www.opengl.org/registry/api/wglext.h:219
+WGL_ALPHA_BITS_EXT = 8219 # http://www.opengl.org/registry/api/wglext.h:220
+WGL_ALPHA_SHIFT_EXT = 8220 # http://www.opengl.org/registry/api/wglext.h:221
+WGL_ACCUM_BITS_EXT = 8221 # http://www.opengl.org/registry/api/wglext.h:222
+WGL_ACCUM_RED_BITS_EXT = 8222 # http://www.opengl.org/registry/api/wglext.h:223
+WGL_ACCUM_GREEN_BITS_EXT = 8223 # http://www.opengl.org/registry/api/wglext.h:224
+WGL_ACCUM_BLUE_BITS_EXT = 8224 # http://www.opengl.org/registry/api/wglext.h:225
+WGL_ACCUM_ALPHA_BITS_EXT = 8225 # http://www.opengl.org/registry/api/wglext.h:226
+WGL_DEPTH_BITS_EXT = 8226 # http://www.opengl.org/registry/api/wglext.h:227
+WGL_STENCIL_BITS_EXT = 8227 # http://www.opengl.org/registry/api/wglext.h:228
+WGL_AUX_BUFFERS_EXT = 8228 # http://www.opengl.org/registry/api/wglext.h:229
+WGL_NO_ACCELERATION_EXT = 8229 # http://www.opengl.org/registry/api/wglext.h:230
+WGL_GENERIC_ACCELERATION_EXT = 8230 # http://www.opengl.org/registry/api/wglext.h:231
+WGL_FULL_ACCELERATION_EXT = 8231 # http://www.opengl.org/registry/api/wglext.h:232
+WGL_SWAP_EXCHANGE_EXT = 8232 # http://www.opengl.org/registry/api/wglext.h:233
+WGL_SWAP_COPY_EXT = 8233 # http://www.opengl.org/registry/api/wglext.h:234
+WGL_SWAP_UNDEFINED_EXT = 8234 # http://www.opengl.org/registry/api/wglext.h:235
+WGL_TYPE_RGBA_EXT = 8235 # http://www.opengl.org/registry/api/wglext.h:236
+WGL_TYPE_COLORINDEX_EXT = 8236 # http://www.opengl.org/registry/api/wglext.h:237
+# EXT_pbuffer (http://www.opengl.org/registry/api/wglext.h:240)
+WGL_DRAW_TO_PBUFFER_EXT = 8237 # http://www.opengl.org/registry/api/wglext.h:241
+WGL_MAX_PBUFFER_PIXELS_EXT = 8238 # http://www.opengl.org/registry/api/wglext.h:242
+WGL_MAX_PBUFFER_WIDTH_EXT = 8239 # http://www.opengl.org/registry/api/wglext.h:243
+WGL_MAX_PBUFFER_HEIGHT_EXT = 8240 # http://www.opengl.org/registry/api/wglext.h:244
+WGL_OPTIMAL_PBUFFER_WIDTH_EXT = 8241 # http://www.opengl.org/registry/api/wglext.h:245
+WGL_OPTIMAL_PBUFFER_HEIGHT_EXT = 8242 # http://www.opengl.org/registry/api/wglext.h:246
+WGL_PBUFFER_LARGEST_EXT = 8243 # http://www.opengl.org/registry/api/wglext.h:247
+WGL_PBUFFER_WIDTH_EXT = 8244 # http://www.opengl.org/registry/api/wglext.h:248
+WGL_PBUFFER_HEIGHT_EXT = 8245 # http://www.opengl.org/registry/api/wglext.h:249
+# EXT_depth_float (http://www.opengl.org/registry/api/wglext.h:252)
+WGL_DEPTH_FLOAT_EXT = 8256 # http://www.opengl.org/registry/api/wglext.h:253
+# 3DFX_multisample (http://www.opengl.org/registry/api/wglext.h:256)
+WGL_SAMPLE_BUFFERS_3DFX = 8288 # http://www.opengl.org/registry/api/wglext.h:257
+WGL_SAMPLES_3DFX = 8289 # http://www.opengl.org/registry/api/wglext.h:258
+# EXT_multisample (http://www.opengl.org/registry/api/wglext.h:261)
+WGL_SAMPLE_BUFFERS_EXT = 8257 # http://www.opengl.org/registry/api/wglext.h:262
+WGL_SAMPLES_EXT = 8258 # http://www.opengl.org/registry/api/wglext.h:263
+# I3D_digital_video_control (http://www.opengl.org/registry/api/wglext.h:266)
+WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D = 8272 # http://www.opengl.org/registry/api/wglext.h:267
+WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D = 8273 # http://www.opengl.org/registry/api/wglext.h:268
+WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D = 8274 # http://www.opengl.org/registry/api/wglext.h:269
+WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D = 8275 # http://www.opengl.org/registry/api/wglext.h:270
+# I3D_gamma (http://www.opengl.org/registry/api/wglext.h:273)
+WGL_GAMMA_TABLE_SIZE_I3D = 8270 # http://www.opengl.org/registry/api/wglext.h:274
+WGL_GAMMA_EXCLUDE_DESKTOP_I3D = 8271 # http://www.opengl.org/registry/api/wglext.h:275
+# I3D_genlock (http://www.opengl.org/registry/api/wglext.h:278)
+WGL_GENLOCK_SOURCE_MULTIVIEW_I3D = 8260 # http://www.opengl.org/registry/api/wglext.h:279
+WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D = 8261 # http://www.opengl.org/registry/api/wglext.h:280
+WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D = 8262 # http://www.opengl.org/registry/api/wglext.h:281
+WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D = 8263 # http://www.opengl.org/registry/api/wglext.h:282
+WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D = 8264 # http://www.opengl.org/registry/api/wglext.h:283
+WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D = 8265 # http://www.opengl.org/registry/api/wglext.h:284
+WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D = 8266 # http://www.opengl.org/registry/api/wglext.h:285
+WGL_GENLOCK_SOURCE_EDGE_RISING_I3D = 8267 # http://www.opengl.org/registry/api/wglext.h:286
+WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D = 8268 # http://www.opengl.org/registry/api/wglext.h:287
+# I3D_image_buffer (http://www.opengl.org/registry/api/wglext.h:290)
+WGL_IMAGE_BUFFER_MIN_ACCESS_I3D = 1 # http://www.opengl.org/registry/api/wglext.h:291
+WGL_IMAGE_BUFFER_LOCK_I3D = 2 # http://www.opengl.org/registry/api/wglext.h:292
+# I3D_swap_frame_lock (http://www.opengl.org/registry/api/wglext.h:295)
+# NV_render_depth_texture (http://www.opengl.org/registry/api/wglext.h:298)
+WGL_BIND_TO_TEXTURE_DEPTH_NV = 8355 # http://www.opengl.org/registry/api/wglext.h:299
+WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV = 8356 # http://www.opengl.org/registry/api/wglext.h:300
+WGL_DEPTH_TEXTURE_FORMAT_NV = 8357 # http://www.opengl.org/registry/api/wglext.h:301
+WGL_TEXTURE_DEPTH_COMPONENT_NV = 8358 # http://www.opengl.org/registry/api/wglext.h:302
+WGL_DEPTH_COMPONENT_NV = 8359 # http://www.opengl.org/registry/api/wglext.h:303
+# NV_render_texture_rectangle (http://www.opengl.org/registry/api/wglext.h:306)
+WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV = 8352 # http://www.opengl.org/registry/api/wglext.h:307
+WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV = 8353 # http://www.opengl.org/registry/api/wglext.h:308
+WGL_TEXTURE_RECTANGLE_NV = 8354 # http://www.opengl.org/registry/api/wglext.h:309
+# ATI_pixel_format_float (http://www.opengl.org/registry/api/wglext.h:312)
+WGL_TYPE_RGBA_FLOAT_ATI = 8608 # http://www.opengl.org/registry/api/wglext.h:313
+# NV_float_buffer (http://www.opengl.org/registry/api/wglext.h:316)
+WGL_FLOAT_COMPONENTS_NV = 8368 # http://www.opengl.org/registry/api/wglext.h:317
+WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV = 8369 # http://www.opengl.org/registry/api/wglext.h:318
+WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV = 8370 # http://www.opengl.org/registry/api/wglext.h:319
+WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV = 8371 # http://www.opengl.org/registry/api/wglext.h:320
+WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV = 8372 # http://www.opengl.org/registry/api/wglext.h:321
+WGL_TEXTURE_FLOAT_R_NV = 8373 # http://www.opengl.org/registry/api/wglext.h:322
+WGL_TEXTURE_FLOAT_RG_NV = 8374 # http://www.opengl.org/registry/api/wglext.h:323
+WGL_TEXTURE_FLOAT_RGB_NV = 8375 # http://www.opengl.org/registry/api/wglext.h:324
+WGL_TEXTURE_FLOAT_RGBA_NV = 8376 # http://www.opengl.org/registry/api/wglext.h:325
+# 3DL_stereo_control (http://www.opengl.org/registry/api/wglext.h:328)
+WGL_STEREO_EMITTER_ENABLE_3DL = 8277 # http://www.opengl.org/registry/api/wglext.h:329
+WGL_STEREO_EMITTER_DISABLE_3DL = 8278 # http://www.opengl.org/registry/api/wglext.h:330
+WGL_STEREO_POLARITY_NORMAL_3DL = 8279 # http://www.opengl.org/registry/api/wglext.h:331
+WGL_STEREO_POLARITY_INVERT_3DL = 8280 # http://www.opengl.org/registry/api/wglext.h:332
+# EXT_pixel_format_packed_float (http://www.opengl.org/registry/api/wglext.h:335)
+WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT = 8360 # http://www.opengl.org/registry/api/wglext.h:336
+# EXT_framebuffer_sRGB (http://www.opengl.org/registry/api/wglext.h:339)
+WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT = 8361 # http://www.opengl.org/registry/api/wglext.h:340
+# NV_present_video (http://www.opengl.org/registry/api/wglext.h:343)
+WGL_NUM_VIDEO_SLOTS_NV = 8432 # http://www.opengl.org/registry/api/wglext.h:344
+# NV_video_out (http://www.opengl.org/registry/api/wglext.h:347)
+WGL_BIND_TO_VIDEO_RGB_NV = 8384 # http://www.opengl.org/registry/api/wglext.h:348
+WGL_BIND_TO_VIDEO_RGBA_NV = 8385 # http://www.opengl.org/registry/api/wglext.h:349
+WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV = 8386 # http://www.opengl.org/registry/api/wglext.h:350
+WGL_VIDEO_OUT_COLOR_NV = 8387 # http://www.opengl.org/registry/api/wglext.h:351
+WGL_VIDEO_OUT_ALPHA_NV = 8388 # http://www.opengl.org/registry/api/wglext.h:352
+WGL_VIDEO_OUT_DEPTH_NV = 8389 # http://www.opengl.org/registry/api/wglext.h:353
+WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV = 8390 # http://www.opengl.org/registry/api/wglext.h:354
+WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV = 8391 # http://www.opengl.org/registry/api/wglext.h:355
+WGL_VIDEO_OUT_FRAME = 8392 # http://www.opengl.org/registry/api/wglext.h:356
+WGL_VIDEO_OUT_FIELD_1 = 8393 # http://www.opengl.org/registry/api/wglext.h:357
+WGL_VIDEO_OUT_FIELD_2 = 8394 # http://www.opengl.org/registry/api/wglext.h:358
+WGL_VIDEO_OUT_STACKED_FIELDS_1_2 = 8395 # http://www.opengl.org/registry/api/wglext.h:359
+WGL_VIDEO_OUT_STACKED_FIELDS_2_1 = 8396 # http://www.opengl.org/registry/api/wglext.h:360
+# NV_swap_group (http://www.opengl.org/registry/api/wglext.h:363)
+# NV_gpu_affinity (http://www.opengl.org/registry/api/wglext.h:366)
+WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV = 8400 # http://www.opengl.org/registry/api/wglext.h:367
+WGL_ERROR_MISSING_AFFINITY_MASK_NV = 8401 # http://www.opengl.org/registry/api/wglext.h:368
+# ARB_pbuffer (http://www.opengl.org/registry/api/wglext.h:374)
+HANDLE = POINTER(None) # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:58
+HPBUFFERARB = HANDLE # http://www.opengl.org/registry/api/wglext.h:375
+# EXT_pbuffer (http://www.opengl.org/registry/api/wglext.h:377)
+HPBUFFEREXT = HANDLE # http://www.opengl.org/registry/api/wglext.h:378
+# NV_present_video (http://www.opengl.org/registry/api/wglext.h:380)
+HVIDEOOUTPUTDEVICENV = HANDLE # http://www.opengl.org/registry/api/wglext.h:381
+# NV_video_out (http://www.opengl.org/registry/api/wglext.h:383)
+HPVIDEODEV = HANDLE # http://www.opengl.org/registry/api/wglext.h:384
+# NV_gpu_affinity (http://www.opengl.org/registry/api/wglext.h:386)
+HPGPUNV = HANDLE # http://www.opengl.org/registry/api/wglext.h:387
+HGPUNV = HANDLE # http://www.opengl.org/registry/api/wglext.h:388
+class struct__GPU_DEVICE(Structure):
+ __slots__ = [
+ 'cb',
+ 'DeviceName',
+ 'DeviceString',
+ 'Flags',
+ 'rcVirtualScreen',
+ ]
+DWORD = c_ulong # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:54
+CHAR = c_char # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:47
+class struct_tagRECT(Structure):
+ __slots__ = [
+ 'left',
+ 'top',
+ 'right',
+ 'bottom',
+ ]
+LONG = c_long # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:53
+struct_tagRECT._fields_ = [
+ ('left', LONG),
+ ('top', LONG),
+ ('right', LONG),
+ ('bottom', LONG),
+]
+
+RECT = struct_tagRECT # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:200
+struct__GPU_DEVICE._fields_ = [
+ ('cb', DWORD),
+ ('DeviceName', CHAR * 32),
+ ('DeviceString', CHAR * 128),
+ ('Flags', DWORD),
+ ('rcVirtualScreen', RECT),
+]
+
+GPU_DEVICE = struct__GPU_DEVICE # http://www.opengl.org/registry/api/wglext.h:396
+PGPU_DEVICE = POINTER(struct__GPU_DEVICE) # http://www.opengl.org/registry/api/wglext.h:396
+# ARB_buffer_region (http://www.opengl.org/registry/api/wglext.h:399)
+WGL_ARB_buffer_region = 1 # http://www.opengl.org/registry/api/wglext.h:400
+HDC = HANDLE # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:61
+UINT = c_uint # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:50
+# http://www.opengl.org/registry/api/wglext.h:402
+wglCreateBufferRegionARB = _link_function('wglCreateBufferRegionARB', HANDLE, [HDC, c_int, UINT], 'ARB_buffer_region')
+
+VOID = None # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:45
+# http://www.opengl.org/registry/api/wglext.h:403
+wglDeleteBufferRegionARB = _link_function('wglDeleteBufferRegionARB', VOID, [HANDLE], 'ARB_buffer_region')
+
+BOOL = c_long # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:52
+# http://www.opengl.org/registry/api/wglext.h:404
+wglSaveBufferRegionARB = _link_function('wglSaveBufferRegionARB', BOOL, [HANDLE, c_int, c_int, c_int, c_int], 'ARB_buffer_region')
+
+# http://www.opengl.org/registry/api/wglext.h:405
+wglRestoreBufferRegionARB = _link_function('wglRestoreBufferRegionARB', BOOL, [HANDLE, c_int, c_int, c_int, c_int, c_int, c_int], 'ARB_buffer_region')
+
+PFNWGLCREATEBUFFERREGIONARBPROC = CFUNCTYPE(HANDLE, HDC, c_int, UINT) # http://www.opengl.org/registry/api/wglext.h:407
+PFNWGLDELETEBUFFERREGIONARBPROC = CFUNCTYPE(VOID, HANDLE) # http://www.opengl.org/registry/api/wglext.h:408
+PFNWGLSAVEBUFFERREGIONARBPROC = CFUNCTYPE(BOOL, HANDLE, c_int, c_int, c_int, c_int) # http://www.opengl.org/registry/api/wglext.h:409
+PFNWGLRESTOREBUFFERREGIONARBPROC = CFUNCTYPE(BOOL, HANDLE, c_int, c_int, c_int, c_int, c_int, c_int) # http://www.opengl.org/registry/api/wglext.h:410
+# ARB_multisample (http://www.opengl.org/registry/api/wglext.h:413)
+WGL_ARB_multisample = 1 # http://www.opengl.org/registry/api/wglext.h:414
+# ARB_extensions_string (http://www.opengl.org/registry/api/wglext.h:417)
+WGL_ARB_extensions_string = 1 # http://www.opengl.org/registry/api/wglext.h:418
+# http://www.opengl.org/registry/api/wglext.h:420
+wglGetExtensionsStringARB = _link_function('wglGetExtensionsStringARB', c_char_p, [HDC], 'ARB_extensions_string')
+
+PFNWGLGETEXTENSIONSSTRINGARBPROC = CFUNCTYPE(c_char_p, HDC) # http://www.opengl.org/registry/api/wglext.h:422
+# ARB_pixel_format (http://www.opengl.org/registry/api/wglext.h:425)
+WGL_ARB_pixel_format = 1 # http://www.opengl.org/registry/api/wglext.h:426
+# http://www.opengl.org/registry/api/wglext.h:428
+wglGetPixelFormatAttribivARB = _link_function('wglGetPixelFormatAttribivARB', BOOL, [HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(c_int)], 'ARB_pixel_format')
+
+FLOAT = c_float # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:55
+# http://www.opengl.org/registry/api/wglext.h:429
+wglGetPixelFormatAttribfvARB = _link_function('wglGetPixelFormatAttribfvARB', BOOL, [HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(FLOAT)], 'ARB_pixel_format')
+
+# http://www.opengl.org/registry/api/wglext.h:430
+wglChoosePixelFormatARB = _link_function('wglChoosePixelFormatARB', BOOL, [HDC, POINTER(c_int), POINTER(FLOAT), UINT, POINTER(c_int), POINTER(UINT)], 'ARB_pixel_format')
+
+PFNWGLGETPIXELFORMATATTRIBIVARBPROC = CFUNCTYPE(BOOL, HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:432
+PFNWGLGETPIXELFORMATATTRIBFVARBPROC = CFUNCTYPE(BOOL, HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(FLOAT)) # http://www.opengl.org/registry/api/wglext.h:433
+PFNWGLCHOOSEPIXELFORMATARBPROC = CFUNCTYPE(BOOL, HDC, POINTER(c_int), POINTER(FLOAT), UINT, POINTER(c_int), POINTER(UINT)) # http://www.opengl.org/registry/api/wglext.h:434
+# ARB_make_current_read (http://www.opengl.org/registry/api/wglext.h:437)
+WGL_ARB_make_current_read = 1 # http://www.opengl.org/registry/api/wglext.h:438
+HGLRC = HANDLE # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:60
+# http://www.opengl.org/registry/api/wglext.h:440
+wglMakeContextCurrentARB = _link_function('wglMakeContextCurrentARB', BOOL, [HDC, HDC, HGLRC], 'ARB_make_current_read')
+
+# http://www.opengl.org/registry/api/wglext.h:441
+wglGetCurrentReadDCARB = _link_function('wglGetCurrentReadDCARB', HDC, [], 'ARB_make_current_read')
+
+PFNWGLMAKECONTEXTCURRENTARBPROC = CFUNCTYPE(BOOL, HDC, HDC, HGLRC) # http://www.opengl.org/registry/api/wglext.h:443
+PFNWGLGETCURRENTREADDCARBPROC = CFUNCTYPE(HDC) # http://www.opengl.org/registry/api/wglext.h:444
+# ARB_pbuffer (http://www.opengl.org/registry/api/wglext.h:447)
+WGL_ARB_pbuffer = 1 # http://www.opengl.org/registry/api/wglext.h:448
+# http://www.opengl.org/registry/api/wglext.h:450
+wglCreatePbufferARB = _link_function('wglCreatePbufferARB', HPBUFFERARB, [HDC, c_int, c_int, c_int, POINTER(c_int)], 'ARB_pbuffer')
+
+# http://www.opengl.org/registry/api/wglext.h:451
+wglGetPbufferDCARB = _link_function('wglGetPbufferDCARB', HDC, [HPBUFFERARB], 'ARB_pbuffer')
+
+# http://www.opengl.org/registry/api/wglext.h:452
+wglReleasePbufferDCARB = _link_function('wglReleasePbufferDCARB', c_int, [HPBUFFERARB, HDC], 'ARB_pbuffer')
+
+# http://www.opengl.org/registry/api/wglext.h:453
+wglDestroyPbufferARB = _link_function('wglDestroyPbufferARB', BOOL, [HPBUFFERARB], 'ARB_pbuffer')
+
+# http://www.opengl.org/registry/api/wglext.h:454
+wglQueryPbufferARB = _link_function('wglQueryPbufferARB', BOOL, [HPBUFFERARB, c_int, POINTER(c_int)], 'ARB_pbuffer')
+
+PFNWGLCREATEPBUFFERARBPROC = CFUNCTYPE(HPBUFFERARB, HDC, c_int, c_int, c_int, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:456
+PFNWGLGETPBUFFERDCARBPROC = CFUNCTYPE(HDC, HPBUFFERARB) # http://www.opengl.org/registry/api/wglext.h:457
+PFNWGLRELEASEPBUFFERDCARBPROC = CFUNCTYPE(c_int, HPBUFFERARB, HDC) # http://www.opengl.org/registry/api/wglext.h:458
+PFNWGLDESTROYPBUFFERARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB) # http://www.opengl.org/registry/api/wglext.h:459
+PFNWGLQUERYPBUFFERARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB, c_int, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:460
+# ARB_render_texture (http://www.opengl.org/registry/api/wglext.h:463)
+WGL_ARB_render_texture = 1 # http://www.opengl.org/registry/api/wglext.h:464
+# http://www.opengl.org/registry/api/wglext.h:466
+wglBindTexImageARB = _link_function('wglBindTexImageARB', BOOL, [HPBUFFERARB, c_int], 'ARB_render_texture')
+
+# http://www.opengl.org/registry/api/wglext.h:467
+wglReleaseTexImageARB = _link_function('wglReleaseTexImageARB', BOOL, [HPBUFFERARB, c_int], 'ARB_render_texture')
+
+# http://www.opengl.org/registry/api/wglext.h:468
+wglSetPbufferAttribARB = _link_function('wglSetPbufferAttribARB', BOOL, [HPBUFFERARB, POINTER(c_int)], 'ARB_render_texture')
+
+PFNWGLBINDTEXIMAGEARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB, c_int) # http://www.opengl.org/registry/api/wglext.h:470
+PFNWGLRELEASETEXIMAGEARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB, c_int) # http://www.opengl.org/registry/api/wglext.h:471
+PFNWGLSETPBUFFERATTRIBARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:472
+# ARB_pixel_format_float (http://www.opengl.org/registry/api/wglext.h:475)
+WGL_ARB_pixel_format_float = 1 # http://www.opengl.org/registry/api/wglext.h:476
+# ARB_create_context (http://www.opengl.org/registry/api/wglext.h:479)
+WGL_ARB_create_context = 1 # http://www.opengl.org/registry/api/wglext.h:480
+# http://www.opengl.org/registry/api/wglext.h:482
+wglCreateContextAttribsARB = _link_function('wglCreateContextAttribsARB', HGLRC, [HDC, HGLRC, POINTER(c_int)], 'ARB_create_context')
+
+PFNWGLCREATECONTEXTATTRIBSARBPROC = CFUNCTYPE(HGLRC, HDC, HGLRC, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:484
+# EXT_display_color_table (http://www.opengl.org/registry/api/wglext.h:487)
+WGL_EXT_display_color_table = 1 # http://www.opengl.org/registry/api/wglext.h:488
+GLboolean = c_ubyte # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:18
+GLushort = c_ushort # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:25
+# http://www.opengl.org/registry/api/wglext.h:490
+wglCreateDisplayColorTableEXT = _link_function('wglCreateDisplayColorTableEXT', GLboolean, [GLushort], 'EXT_display_color_table')
+
+GLuint = c_uint # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:26
+# http://www.opengl.org/registry/api/wglext.h:491
+wglLoadDisplayColorTableEXT = _link_function('wglLoadDisplayColorTableEXT', GLboolean, [POINTER(GLushort), GLuint], 'EXT_display_color_table')
+
+# http://www.opengl.org/registry/api/wglext.h:492
+wglBindDisplayColorTableEXT = _link_function('wglBindDisplayColorTableEXT', GLboolean, [GLushort], 'EXT_display_color_table')
+
+# http://www.opengl.org/registry/api/wglext.h:493
+wglDestroyDisplayColorTableEXT = _link_function('wglDestroyDisplayColorTableEXT', VOID, [GLushort], 'EXT_display_color_table')
+
+PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC = CFUNCTYPE(GLboolean, GLushort) # http://www.opengl.org/registry/api/wglext.h:495
+PFNWGLLOADDISPLAYCOLORTABLEEXTPROC = CFUNCTYPE(GLboolean, POINTER(GLushort), GLuint) # http://www.opengl.org/registry/api/wglext.h:496
+PFNWGLBINDDISPLAYCOLORTABLEEXTPROC = CFUNCTYPE(GLboolean, GLushort) # http://www.opengl.org/registry/api/wglext.h:497
+PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC = CFUNCTYPE(VOID, GLushort) # http://www.opengl.org/registry/api/wglext.h:498
+# EXT_extensions_string (http://www.opengl.org/registry/api/wglext.h:501)
+WGL_EXT_extensions_string = 1 # http://www.opengl.org/registry/api/wglext.h:502
+# http://www.opengl.org/registry/api/wglext.h:504
+wglGetExtensionsStringEXT = _link_function('wglGetExtensionsStringEXT', c_char_p, [], 'EXT_extensions_string')
+
+PFNWGLGETEXTENSIONSSTRINGEXTPROC = CFUNCTYPE(c_char_p) # http://www.opengl.org/registry/api/wglext.h:506
+# EXT_make_current_read (http://www.opengl.org/registry/api/wglext.h:509)
+WGL_EXT_make_current_read = 1 # http://www.opengl.org/registry/api/wglext.h:510
+# http://www.opengl.org/registry/api/wglext.h:512
+wglMakeContextCurrentEXT = _link_function('wglMakeContextCurrentEXT', BOOL, [HDC, HDC, HGLRC], 'EXT_make_current_read')
+
+# http://www.opengl.org/registry/api/wglext.h:513
+wglGetCurrentReadDCEXT = _link_function('wglGetCurrentReadDCEXT', HDC, [], 'EXT_make_current_read')
+
+PFNWGLMAKECONTEXTCURRENTEXTPROC = CFUNCTYPE(BOOL, HDC, HDC, HGLRC) # http://www.opengl.org/registry/api/wglext.h:515
+PFNWGLGETCURRENTREADDCEXTPROC = CFUNCTYPE(HDC) # http://www.opengl.org/registry/api/wglext.h:516
+# EXT_pbuffer (http://www.opengl.org/registry/api/wglext.h:519)
+WGL_EXT_pbuffer = 1 # http://www.opengl.org/registry/api/wglext.h:520
+# http://www.opengl.org/registry/api/wglext.h:522
+wglCreatePbufferEXT = _link_function('wglCreatePbufferEXT', HPBUFFEREXT, [HDC, c_int, c_int, c_int, POINTER(c_int)], 'EXT_pbuffer')
+
+# http://www.opengl.org/registry/api/wglext.h:523
+wglGetPbufferDCEXT = _link_function('wglGetPbufferDCEXT', HDC, [HPBUFFEREXT], 'EXT_pbuffer')
+
+# http://www.opengl.org/registry/api/wglext.h:524
+wglReleasePbufferDCEXT = _link_function('wglReleasePbufferDCEXT', c_int, [HPBUFFEREXT, HDC], 'EXT_pbuffer')
+
+# http://www.opengl.org/registry/api/wglext.h:525
+wglDestroyPbufferEXT = _link_function('wglDestroyPbufferEXT', BOOL, [HPBUFFEREXT], 'EXT_pbuffer')
+
+# http://www.opengl.org/registry/api/wglext.h:526
+wglQueryPbufferEXT = _link_function('wglQueryPbufferEXT', BOOL, [HPBUFFEREXT, c_int, POINTER(c_int)], 'EXT_pbuffer')
+
+PFNWGLCREATEPBUFFEREXTPROC = CFUNCTYPE(HPBUFFEREXT, HDC, c_int, c_int, c_int, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:528
+PFNWGLGETPBUFFERDCEXTPROC = CFUNCTYPE(HDC, HPBUFFEREXT) # http://www.opengl.org/registry/api/wglext.h:529
+PFNWGLRELEASEPBUFFERDCEXTPROC = CFUNCTYPE(c_int, HPBUFFEREXT, HDC) # http://www.opengl.org/registry/api/wglext.h:530
+PFNWGLDESTROYPBUFFEREXTPROC = CFUNCTYPE(BOOL, HPBUFFEREXT) # http://www.opengl.org/registry/api/wglext.h:531
+PFNWGLQUERYPBUFFEREXTPROC = CFUNCTYPE(BOOL, HPBUFFEREXT, c_int, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:532
+# EXT_pixel_format (http://www.opengl.org/registry/api/wglext.h:535)
+WGL_EXT_pixel_format = 1 # http://www.opengl.org/registry/api/wglext.h:536
+# http://www.opengl.org/registry/api/wglext.h:538
+wglGetPixelFormatAttribivEXT = _link_function('wglGetPixelFormatAttribivEXT', BOOL, [HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(c_int)], 'EXT_pixel_format')
+
+# http://www.opengl.org/registry/api/wglext.h:539
+wglGetPixelFormatAttribfvEXT = _link_function('wglGetPixelFormatAttribfvEXT', BOOL, [HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(FLOAT)], 'EXT_pixel_format')
+
+# http://www.opengl.org/registry/api/wglext.h:540
+wglChoosePixelFormatEXT = _link_function('wglChoosePixelFormatEXT', BOOL, [HDC, POINTER(c_int), POINTER(FLOAT), UINT, POINTER(c_int), POINTER(UINT)], 'EXT_pixel_format')
+
+PFNWGLGETPIXELFORMATATTRIBIVEXTPROC = CFUNCTYPE(BOOL, HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:542
+PFNWGLGETPIXELFORMATATTRIBFVEXTPROC = CFUNCTYPE(BOOL, HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(FLOAT)) # http://www.opengl.org/registry/api/wglext.h:543
+PFNWGLCHOOSEPIXELFORMATEXTPROC = CFUNCTYPE(BOOL, HDC, POINTER(c_int), POINTER(FLOAT), UINT, POINTER(c_int), POINTER(UINT)) # http://www.opengl.org/registry/api/wglext.h:544
+# EXT_swap_control (http://www.opengl.org/registry/api/wglext.h:547)
+WGL_EXT_swap_control = 1 # http://www.opengl.org/registry/api/wglext.h:548
+# http://www.opengl.org/registry/api/wglext.h:550
+wglSwapIntervalEXT = _link_function('wglSwapIntervalEXT', BOOL, [c_int], 'EXT_swap_control')
+
+# http://www.opengl.org/registry/api/wglext.h:551
+wglGetSwapIntervalEXT = _link_function('wglGetSwapIntervalEXT', c_int, [], 'EXT_swap_control')
+
+PFNWGLSWAPINTERVALEXTPROC = CFUNCTYPE(BOOL, c_int) # http://www.opengl.org/registry/api/wglext.h:553
+PFNWGLGETSWAPINTERVALEXTPROC = CFUNCTYPE(c_int) # http://www.opengl.org/registry/api/wglext.h:554
+# EXT_depth_float (http://www.opengl.org/registry/api/wglext.h:557)
+WGL_EXT_depth_float = 1 # http://www.opengl.org/registry/api/wglext.h:558
+# NV_vertex_array_range (http://www.opengl.org/registry/api/wglext.h:561)
+WGL_NV_vertex_array_range = 1 # http://www.opengl.org/registry/api/wglext.h:562
+GLsizei = c_int # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:23
+GLfloat = c_float # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:27
+# http://www.opengl.org/registry/api/wglext.h:564
+wglAllocateMemoryNV = _link_function('wglAllocateMemoryNV', POINTER(c_void), [GLsizei, GLfloat, GLfloat, GLfloat], 'NV_vertex_array_range')
+
+# http://www.opengl.org/registry/api/wglext.h:565
+wglFreeMemoryNV = _link_function('wglFreeMemoryNV', None, [POINTER(None)], 'NV_vertex_array_range')
+
+PFNWGLALLOCATEMEMORYNVPROC = CFUNCTYPE(POINTER(c_void), GLsizei, GLfloat, GLfloat, GLfloat) # http://www.opengl.org/registry/api/wglext.h:567
+PFNWGLFREEMEMORYNVPROC = CFUNCTYPE(None, POINTER(None)) # http://www.opengl.org/registry/api/wglext.h:568
+# 3DFX_multisample (http://www.opengl.org/registry/api/wglext.h:571)
+WGL_3DFX_multisample = 1 # http://www.opengl.org/registry/api/wglext.h:572
+# EXT_multisample (http://www.opengl.org/registry/api/wglext.h:575)
+WGL_EXT_multisample = 1 # http://www.opengl.org/registry/api/wglext.h:576
+# OML_sync_control (http://www.opengl.org/registry/api/wglext.h:579)
+WGL_OML_sync_control = 1 # http://www.opengl.org/registry/api/wglext.h:580
+INT64 = c_longlong # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:42
+# http://www.opengl.org/registry/api/wglext.h:582
+wglGetSyncValuesOML = _link_function('wglGetSyncValuesOML', BOOL, [HDC, POINTER(INT64), POINTER(INT64), POINTER(INT64)], 'OML_sync_control')
+
+INT32 = c_int # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:35
+# http://www.opengl.org/registry/api/wglext.h:583
+wglGetMscRateOML = _link_function('wglGetMscRateOML', BOOL, [HDC, POINTER(INT32), POINTER(INT32)], 'OML_sync_control')
+
+# http://www.opengl.org/registry/api/wglext.h:584
+wglSwapBuffersMscOML = _link_function('wglSwapBuffersMscOML', INT64, [HDC, INT64, INT64, INT64], 'OML_sync_control')
+
+# http://www.opengl.org/registry/api/wglext.h:585
+wglSwapLayerBuffersMscOML = _link_function('wglSwapLayerBuffersMscOML', INT64, [HDC, c_int, INT64, INT64, INT64], 'OML_sync_control')
+
+# http://www.opengl.org/registry/api/wglext.h:586
+wglWaitForMscOML = _link_function('wglWaitForMscOML', BOOL, [HDC, INT64, INT64, INT64, POINTER(INT64), POINTER(INT64), POINTER(INT64)], 'OML_sync_control')
+
+# http://www.opengl.org/registry/api/wglext.h:587
+wglWaitForSbcOML = _link_function('wglWaitForSbcOML', BOOL, [HDC, INT64, POINTER(INT64), POINTER(INT64), POINTER(INT64)], 'OML_sync_control')
+
+PFNWGLGETSYNCVALUESOMLPROC = CFUNCTYPE(BOOL, HDC, POINTER(INT64), POINTER(INT64), POINTER(INT64)) # http://www.opengl.org/registry/api/wglext.h:589
+PFNWGLGETMSCRATEOMLPROC = CFUNCTYPE(BOOL, HDC, POINTER(INT32), POINTER(INT32)) # http://www.opengl.org/registry/api/wglext.h:590
+PFNWGLSWAPBUFFERSMSCOMLPROC = CFUNCTYPE(INT64, HDC, INT64, INT64, INT64) # http://www.opengl.org/registry/api/wglext.h:591
+PFNWGLSWAPLAYERBUFFERSMSCOMLPROC = CFUNCTYPE(INT64, HDC, c_int, INT64, INT64, INT64) # http://www.opengl.org/registry/api/wglext.h:592
+PFNWGLWAITFORMSCOMLPROC = CFUNCTYPE(BOOL, HDC, INT64, INT64, INT64, POINTER(INT64), POINTER(INT64), POINTER(INT64)) # http://www.opengl.org/registry/api/wglext.h:593
+PFNWGLWAITFORSBCOMLPROC = CFUNCTYPE(BOOL, HDC, INT64, POINTER(INT64), POINTER(INT64), POINTER(INT64)) # http://www.opengl.org/registry/api/wglext.h:594
+# I3D_digital_video_control (http://www.opengl.org/registry/api/wglext.h:597)
+WGL_I3D_digital_video_control = 1 # http://www.opengl.org/registry/api/wglext.h:598
+# http://www.opengl.org/registry/api/wglext.h:600
+wglGetDigitalVideoParametersI3D = _link_function('wglGetDigitalVideoParametersI3D', BOOL, [HDC, c_int, POINTER(c_int)], 'I3D_digital_video_control')
+
+# http://www.opengl.org/registry/api/wglext.h:601
+wglSetDigitalVideoParametersI3D = _link_function('wglSetDigitalVideoParametersI3D', BOOL, [HDC, c_int, POINTER(c_int)], 'I3D_digital_video_control')
+
+PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:603
+PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:604
+# I3D_gamma (http://www.opengl.org/registry/api/wglext.h:607)
+WGL_I3D_gamma = 1 # http://www.opengl.org/registry/api/wglext.h:608
+# http://www.opengl.org/registry/api/wglext.h:610
+wglGetGammaTableParametersI3D = _link_function('wglGetGammaTableParametersI3D', BOOL, [HDC, c_int, POINTER(c_int)], 'I3D_gamma')
+
+# http://www.opengl.org/registry/api/wglext.h:611
+wglSetGammaTableParametersI3D = _link_function('wglSetGammaTableParametersI3D', BOOL, [HDC, c_int, POINTER(c_int)], 'I3D_gamma')
+
+USHORT = c_ushort # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:49
+# http://www.opengl.org/registry/api/wglext.h:612
+wglGetGammaTableI3D = _link_function('wglGetGammaTableI3D', BOOL, [HDC, c_int, POINTER(USHORT), POINTER(USHORT), POINTER(USHORT)], 'I3D_gamma')
+
+# http://www.opengl.org/registry/api/wglext.h:613
+wglSetGammaTableI3D = _link_function('wglSetGammaTableI3D', BOOL, [HDC, c_int, POINTER(USHORT), POINTER(USHORT), POINTER(USHORT)], 'I3D_gamma')
+
+PFNWGLGETGAMMATABLEPARAMETERSI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:615
+PFNWGLSETGAMMATABLEPARAMETERSI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:616
+PFNWGLGETGAMMATABLEI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(USHORT), POINTER(USHORT), POINTER(USHORT)) # http://www.opengl.org/registry/api/wglext.h:617
+PFNWGLSETGAMMATABLEI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(USHORT), POINTER(USHORT), POINTER(USHORT)) # http://www.opengl.org/registry/api/wglext.h:618
+# I3D_genlock (http://www.opengl.org/registry/api/wglext.h:621)
+WGL_I3D_genlock = 1 # http://www.opengl.org/registry/api/wglext.h:622
+# http://www.opengl.org/registry/api/wglext.h:624
+wglEnableGenlockI3D = _link_function('wglEnableGenlockI3D', BOOL, [HDC], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:625
+wglDisableGenlockI3D = _link_function('wglDisableGenlockI3D', BOOL, [HDC], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:626
+wglIsEnabledGenlockI3D = _link_function('wglIsEnabledGenlockI3D', BOOL, [HDC, POINTER(BOOL)], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:627
+wglGenlockSourceI3D = _link_function('wglGenlockSourceI3D', BOOL, [HDC, UINT], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:628
+wglGetGenlockSourceI3D = _link_function('wglGetGenlockSourceI3D', BOOL, [HDC, POINTER(UINT)], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:629
+wglGenlockSourceEdgeI3D = _link_function('wglGenlockSourceEdgeI3D', BOOL, [HDC, UINT], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:630
+wglGetGenlockSourceEdgeI3D = _link_function('wglGetGenlockSourceEdgeI3D', BOOL, [HDC, POINTER(UINT)], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:631
+wglGenlockSampleRateI3D = _link_function('wglGenlockSampleRateI3D', BOOL, [HDC, UINT], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:632
+wglGetGenlockSampleRateI3D = _link_function('wglGetGenlockSampleRateI3D', BOOL, [HDC, POINTER(UINT)], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:633
+wglGenlockSourceDelayI3D = _link_function('wglGenlockSourceDelayI3D', BOOL, [HDC, UINT], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:634
+wglGetGenlockSourceDelayI3D = _link_function('wglGetGenlockSourceDelayI3D', BOOL, [HDC, POINTER(UINT)], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:635
+wglQueryGenlockMaxSourceDelayI3D = _link_function('wglQueryGenlockMaxSourceDelayI3D', BOOL, [HDC, POINTER(UINT), POINTER(UINT)], 'I3D_genlock')
+
+PFNWGLENABLEGENLOCKI3DPROC = CFUNCTYPE(BOOL, HDC) # http://www.opengl.org/registry/api/wglext.h:637
+PFNWGLDISABLEGENLOCKI3DPROC = CFUNCTYPE(BOOL, HDC) # http://www.opengl.org/registry/api/wglext.h:638
+PFNWGLISENABLEDGENLOCKI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(BOOL)) # http://www.opengl.org/registry/api/wglext.h:639
+PFNWGLGENLOCKSOURCEI3DPROC = CFUNCTYPE(BOOL, HDC, UINT) # http://www.opengl.org/registry/api/wglext.h:640
+PFNWGLGETGENLOCKSOURCEI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT)) # http://www.opengl.org/registry/api/wglext.h:641
+PFNWGLGENLOCKSOURCEEDGEI3DPROC = CFUNCTYPE(BOOL, HDC, UINT) # http://www.opengl.org/registry/api/wglext.h:642
+PFNWGLGETGENLOCKSOURCEEDGEI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT)) # http://www.opengl.org/registry/api/wglext.h:643
+PFNWGLGENLOCKSAMPLERATEI3DPROC = CFUNCTYPE(BOOL, HDC, UINT) # http://www.opengl.org/registry/api/wglext.h:644
+PFNWGLGETGENLOCKSAMPLERATEI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT)) # http://www.opengl.org/registry/api/wglext.h:645
+PFNWGLGENLOCKSOURCEDELAYI3DPROC = CFUNCTYPE(BOOL, HDC, UINT) # http://www.opengl.org/registry/api/wglext.h:646
+PFNWGLGETGENLOCKSOURCEDELAYI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT)) # http://www.opengl.org/registry/api/wglext.h:647
+PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT), POINTER(UINT)) # http://www.opengl.org/registry/api/wglext.h:648
+# I3D_image_buffer (http://www.opengl.org/registry/api/wglext.h:651)
+WGL_I3D_image_buffer = 1 # http://www.opengl.org/registry/api/wglext.h:652
+LPVOID = POINTER(None) # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:45
+# http://www.opengl.org/registry/api/wglext.h:654
+wglCreateImageBufferI3D = _link_function('wglCreateImageBufferI3D', LPVOID, [HDC, DWORD, UINT], 'I3D_image_buffer')
+
+# http://www.opengl.org/registry/api/wglext.h:655
+wglDestroyImageBufferI3D = _link_function('wglDestroyImageBufferI3D', BOOL, [HDC, LPVOID], 'I3D_image_buffer')
+
+# http://www.opengl.org/registry/api/wglext.h:656
+wglAssociateImageBufferEventsI3D = _link_function('wglAssociateImageBufferEventsI3D', BOOL, [HDC, POINTER(HANDLE), POINTER(LPVOID), POINTER(DWORD), UINT], 'I3D_image_buffer')
+
+# http://www.opengl.org/registry/api/wglext.h:657
+wglReleaseImageBufferEventsI3D = _link_function('wglReleaseImageBufferEventsI3D', BOOL, [HDC, POINTER(LPVOID), UINT], 'I3D_image_buffer')
+
+PFNWGLCREATEIMAGEBUFFERI3DPROC = CFUNCTYPE(LPVOID, HDC, DWORD, UINT) # http://www.opengl.org/registry/api/wglext.h:659
+PFNWGLDESTROYIMAGEBUFFERI3DPROC = CFUNCTYPE(BOOL, HDC, LPVOID) # http://www.opengl.org/registry/api/wglext.h:660
+PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(HANDLE), POINTER(LPVOID), POINTER(DWORD), UINT) # http://www.opengl.org/registry/api/wglext.h:661
+PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(LPVOID), UINT) # http://www.opengl.org/registry/api/wglext.h:662
+# I3D_swap_frame_lock (http://www.opengl.org/registry/api/wglext.h:665)
+WGL_I3D_swap_frame_lock = 1 # http://www.opengl.org/registry/api/wglext.h:666
+# http://www.opengl.org/registry/api/wglext.h:668
+wglEnableFrameLockI3D = _link_function('wglEnableFrameLockI3D', BOOL, [], 'I3D_swap_frame_lock')
+
+# http://www.opengl.org/registry/api/wglext.h:669
+wglDisableFrameLockI3D = _link_function('wglDisableFrameLockI3D', BOOL, [], 'I3D_swap_frame_lock')
+
+# http://www.opengl.org/registry/api/wglext.h:670
+wglIsEnabledFrameLockI3D = _link_function('wglIsEnabledFrameLockI3D', BOOL, [POINTER(BOOL)], 'I3D_swap_frame_lock')
+
+# http://www.opengl.org/registry/api/wglext.h:671
+wglQueryFrameLockMasterI3D = _link_function('wglQueryFrameLockMasterI3D', BOOL, [POINTER(BOOL)], 'I3D_swap_frame_lock')
+
+PFNWGLENABLEFRAMELOCKI3DPROC = CFUNCTYPE(BOOL) # http://www.opengl.org/registry/api/wglext.h:673
+PFNWGLDISABLEFRAMELOCKI3DPROC = CFUNCTYPE(BOOL) # http://www.opengl.org/registry/api/wglext.h:674
+PFNWGLISENABLEDFRAMELOCKI3DPROC = CFUNCTYPE(BOOL, POINTER(BOOL)) # http://www.opengl.org/registry/api/wglext.h:675
+PFNWGLQUERYFRAMELOCKMASTERI3DPROC = CFUNCTYPE(BOOL, POINTER(BOOL)) # http://www.opengl.org/registry/api/wglext.h:676
+# I3D_swap_frame_usage (http://www.opengl.org/registry/api/wglext.h:679)
+WGL_I3D_swap_frame_usage = 1 # http://www.opengl.org/registry/api/wglext.h:680
+# http://www.opengl.org/registry/api/wglext.h:682
+wglGetFrameUsageI3D = _link_function('wglGetFrameUsageI3D', BOOL, [POINTER(c_float)], 'I3D_swap_frame_usage')
+
+# http://www.opengl.org/registry/api/wglext.h:683
+wglBeginFrameTrackingI3D = _link_function('wglBeginFrameTrackingI3D', BOOL, [], 'I3D_swap_frame_usage')
+
+# http://www.opengl.org/registry/api/wglext.h:684
+wglEndFrameTrackingI3D = _link_function('wglEndFrameTrackingI3D', BOOL, [], 'I3D_swap_frame_usage')
+
+# http://www.opengl.org/registry/api/wglext.h:685
+wglQueryFrameTrackingI3D = _link_function('wglQueryFrameTrackingI3D', BOOL, [POINTER(DWORD), POINTER(DWORD), POINTER(c_float)], 'I3D_swap_frame_usage')
+
+PFNWGLGETFRAMEUSAGEI3DPROC = CFUNCTYPE(BOOL, POINTER(c_float)) # http://www.opengl.org/registry/api/wglext.h:687
+PFNWGLBEGINFRAMETRACKINGI3DPROC = CFUNCTYPE(BOOL) # http://www.opengl.org/registry/api/wglext.h:688
+PFNWGLENDFRAMETRACKINGI3DPROC = CFUNCTYPE(BOOL) # http://www.opengl.org/registry/api/wglext.h:689
+PFNWGLQUERYFRAMETRACKINGI3DPROC = CFUNCTYPE(BOOL, POINTER(DWORD), POINTER(DWORD), POINTER(c_float)) # http://www.opengl.org/registry/api/wglext.h:690
+# ATI_pixel_format_float (http://www.opengl.org/registry/api/wglext.h:693)
+WGL_ATI_pixel_format_float = 1 # http://www.opengl.org/registry/api/wglext.h:694
+# NV_float_buffer (http://www.opengl.org/registry/api/wglext.h:697)
+WGL_NV_float_buffer = 1 # http://www.opengl.org/registry/api/wglext.h:698
+# EXT_pixel_format_packed_float (http://www.opengl.org/registry/api/wglext.h:701)
+WGL_EXT_pixel_format_packed_float = 1 # http://www.opengl.org/registry/api/wglext.h:702
+# EXT_framebuffer_sRGB (http://www.opengl.org/registry/api/wglext.h:705)
+WGL_EXT_framebuffer_sRGB = 1 # http://www.opengl.org/registry/api/wglext.h:706
+# NV_present_video (http://www.opengl.org/registry/api/wglext.h:709)
+WGL_NV_present_video = 1 # http://www.opengl.org/registry/api/wglext.h:710
+# http://www.opengl.org/registry/api/wglext.h:712
+wglEnumerateVideoDevicesNV = _link_function('wglEnumerateVideoDevicesNV', c_int, [HDC, POINTER(HVIDEOOUTPUTDEVICENV)], 'NV_present_video')
+
+# http://www.opengl.org/registry/api/wglext.h:713
+wglBindVideoDeviceNV = _link_function('wglBindVideoDeviceNV', BOOL, [HDC, c_uint, HVIDEOOUTPUTDEVICENV, POINTER(c_int)], 'NV_present_video')
+
+# http://www.opengl.org/registry/api/wglext.h:714
+wglQueryCurrentContextNV = _link_function('wglQueryCurrentContextNV', BOOL, [c_int, POINTER(c_int)], 'NV_present_video')
+
+PFNWGLENUMERATEVIDEODEVICESNVPROC = CFUNCTYPE(c_int, HDC, POINTER(HVIDEOOUTPUTDEVICENV)) # http://www.opengl.org/registry/api/wglext.h:716
+PFNWGLBINDVIDEODEVICENVPROC = CFUNCTYPE(BOOL, HDC, c_uint, HVIDEOOUTPUTDEVICENV, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:717
+PFNWGLQUERYCURRENTCONTEXTNVPROC = CFUNCTYPE(BOOL, c_int, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:718
+# NV_video_out (http://www.opengl.org/registry/api/wglext.h:721)
+WGL_NV_video_out = 1 # http://www.opengl.org/registry/api/wglext.h:722
+# http://www.opengl.org/registry/api/wglext.h:724
+wglGetVideoDeviceNV = _link_function('wglGetVideoDeviceNV', BOOL, [HDC, c_int, POINTER(HPVIDEODEV)], 'NV_video_out')
+
+# http://www.opengl.org/registry/api/wglext.h:725
+wglReleaseVideoDeviceNV = _link_function('wglReleaseVideoDeviceNV', BOOL, [HPVIDEODEV], 'NV_video_out')
+
+# http://www.opengl.org/registry/api/wglext.h:726
+wglBindVideoImageNV = _link_function('wglBindVideoImageNV', BOOL, [HPVIDEODEV, HPBUFFERARB, c_int], 'NV_video_out')
+
+# http://www.opengl.org/registry/api/wglext.h:727
+wglReleaseVideoImageNV = _link_function('wglReleaseVideoImageNV', BOOL, [HPBUFFERARB, c_int], 'NV_video_out')
+
+# http://www.opengl.org/registry/api/wglext.h:728
+wglSendPbufferToVideoNV = _link_function('wglSendPbufferToVideoNV', BOOL, [HPBUFFERARB, c_int, POINTER(c_ulong), BOOL], 'NV_video_out')
+
+# http://www.opengl.org/registry/api/wglext.h:729
+wglGetVideoInfoNV = _link_function('wglGetVideoInfoNV', BOOL, [HPVIDEODEV, POINTER(c_ulong), POINTER(c_ulong)], 'NV_video_out')
+
+PFNWGLGETVIDEODEVICENVPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(HPVIDEODEV)) # http://www.opengl.org/registry/api/wglext.h:731
+PFNWGLRELEASEVIDEODEVICENVPROC = CFUNCTYPE(BOOL, HPVIDEODEV) # http://www.opengl.org/registry/api/wglext.h:732
+PFNWGLBINDVIDEOIMAGENVPROC = CFUNCTYPE(BOOL, HPVIDEODEV, HPBUFFERARB, c_int) # http://www.opengl.org/registry/api/wglext.h:733
+PFNWGLRELEASEVIDEOIMAGENVPROC = CFUNCTYPE(BOOL, HPBUFFERARB, c_int) # http://www.opengl.org/registry/api/wglext.h:734
+PFNWGLSENDPBUFFERTOVIDEONVPROC = CFUNCTYPE(BOOL, HPBUFFERARB, c_int, POINTER(c_ulong), BOOL) # http://www.opengl.org/registry/api/wglext.h:735
+PFNWGLGETVIDEOINFONVPROC = CFUNCTYPE(BOOL, HPVIDEODEV, POINTER(c_ulong), POINTER(c_ulong)) # http://www.opengl.org/registry/api/wglext.h:736
+# NV_swap_group (http://www.opengl.org/registry/api/wglext.h:739)
+WGL_NV_swap_group = 1 # http://www.opengl.org/registry/api/wglext.h:740
+# http://www.opengl.org/registry/api/wglext.h:742
+wglJoinSwapGroupNV = _link_function('wglJoinSwapGroupNV', BOOL, [HDC, GLuint], 'NV_swap_group')
+
+# http://www.opengl.org/registry/api/wglext.h:743
+wglBindSwapBarrierNV = _link_function('wglBindSwapBarrierNV', BOOL, [GLuint, GLuint], 'NV_swap_group')
+
+# http://www.opengl.org/registry/api/wglext.h:744
+wglQuerySwapGroupNV = _link_function('wglQuerySwapGroupNV', BOOL, [HDC, POINTER(GLuint), POINTER(GLuint)], 'NV_swap_group')
+
+# http://www.opengl.org/registry/api/wglext.h:745
+wglQueryMaxSwapGroupsNV = _link_function('wglQueryMaxSwapGroupsNV', BOOL, [HDC, POINTER(GLuint), POINTER(GLuint)], 'NV_swap_group')
+
+# http://www.opengl.org/registry/api/wglext.h:746
+wglQueryFrameCountNV = _link_function('wglQueryFrameCountNV', BOOL, [HDC, POINTER(GLuint)], 'NV_swap_group')
+
+# http://www.opengl.org/registry/api/wglext.h:747
+wglResetFrameCountNV = _link_function('wglResetFrameCountNV', BOOL, [HDC], 'NV_swap_group')
+
+PFNWGLJOINSWAPGROUPNVPROC = CFUNCTYPE(BOOL, HDC, GLuint) # http://www.opengl.org/registry/api/wglext.h:749
+PFNWGLBINDSWAPBARRIERNVPROC = CFUNCTYPE(BOOL, GLuint, GLuint) # http://www.opengl.org/registry/api/wglext.h:750
+PFNWGLQUERYSWAPGROUPNVPROC = CFUNCTYPE(BOOL, HDC, POINTER(GLuint), POINTER(GLuint)) # http://www.opengl.org/registry/api/wglext.h:751
+PFNWGLQUERYMAXSWAPGROUPSNVPROC = CFUNCTYPE(BOOL, HDC, POINTER(GLuint), POINTER(GLuint)) # http://www.opengl.org/registry/api/wglext.h:752
+PFNWGLQUERYFRAMECOUNTNVPROC = CFUNCTYPE(BOOL, HDC, POINTER(GLuint)) # http://www.opengl.org/registry/api/wglext.h:753
+PFNWGLRESETFRAMECOUNTNVPROC = CFUNCTYPE(BOOL, HDC) # http://www.opengl.org/registry/api/wglext.h:754
+# NV_gpu_affinity (http://www.opengl.org/registry/api/wglext.h:757)
+WGL_NV_gpu_affinity = 1 # http://www.opengl.org/registry/api/wglext.h:758
+# http://www.opengl.org/registry/api/wglext.h:760
+wglEnumGpusNV = _link_function('wglEnumGpusNV', BOOL, [UINT, POINTER(HGPUNV)], 'NV_gpu_affinity')
+
+# http://www.opengl.org/registry/api/wglext.h:761
+wglEnumGpuDevicesNV = _link_function('wglEnumGpuDevicesNV', BOOL, [HGPUNV, UINT, PGPU_DEVICE], 'NV_gpu_affinity')
+
+# http://www.opengl.org/registry/api/wglext.h:762
+wglCreateAffinityDCNV = _link_function('wglCreateAffinityDCNV', HDC, [POINTER(HGPUNV)], 'NV_gpu_affinity')
+
+# http://www.opengl.org/registry/api/wglext.h:763
+wglEnumGpusFromAffinityDCNV = _link_function('wglEnumGpusFromAffinityDCNV', BOOL, [HDC, UINT, POINTER(HGPUNV)], 'NV_gpu_affinity')
+
+# http://www.opengl.org/registry/api/wglext.h:764
+wglDeleteDCNV = _link_function('wglDeleteDCNV', BOOL, [HDC], 'NV_gpu_affinity')
+
+PFNWGLENUMGPUSNVPROC = CFUNCTYPE(BOOL, UINT, POINTER(HGPUNV)) # http://www.opengl.org/registry/api/wglext.h:766
+PFNWGLENUMGPUDEVICESNVPROC = CFUNCTYPE(BOOL, HGPUNV, UINT, PGPU_DEVICE) # http://www.opengl.org/registry/api/wglext.h:767
+PFNWGLCREATEAFFINITYDCNVPROC = CFUNCTYPE(HDC, POINTER(HGPUNV)) # http://www.opengl.org/registry/api/wglext.h:768
+PFNWGLENUMGPUSFROMAFFINITYDCNVPROC = CFUNCTYPE(BOOL, HDC, UINT, POINTER(HGPUNV)) # http://www.opengl.org/registry/api/wglext.h:769
+PFNWGLDELETEDCNVPROC = CFUNCTYPE(BOOL, HDC) # http://www.opengl.org/registry/api/wglext.h:770
+
+__all__ = ['WIN32_LEAN_AND_MEAN', 'WGL_WGLEXT_VERSION',
+'WGL_FRONT_COLOR_BUFFER_BIT_ARB', 'WGL_BACK_COLOR_BUFFER_BIT_ARB',
+'WGL_DEPTH_BUFFER_BIT_ARB', 'WGL_STENCIL_BUFFER_BIT_ARB',
+'WGL_SAMPLE_BUFFERS_ARB', 'WGL_SAMPLES_ARB', 'WGL_NUMBER_PIXEL_FORMATS_ARB',
+'WGL_DRAW_TO_WINDOW_ARB', 'WGL_DRAW_TO_BITMAP_ARB', 'WGL_ACCELERATION_ARB',
+'WGL_NEED_PALETTE_ARB', 'WGL_NEED_SYSTEM_PALETTE_ARB',
+'WGL_SWAP_LAYER_BUFFERS_ARB', 'WGL_SWAP_METHOD_ARB',
+'WGL_NUMBER_OVERLAYS_ARB', 'WGL_NUMBER_UNDERLAYS_ARB', 'WGL_TRANSPARENT_ARB',
+'WGL_TRANSPARENT_RED_VALUE_ARB', 'WGL_TRANSPARENT_GREEN_VALUE_ARB',
+'WGL_TRANSPARENT_BLUE_VALUE_ARB', 'WGL_TRANSPARENT_ALPHA_VALUE_ARB',
+'WGL_TRANSPARENT_INDEX_VALUE_ARB', 'WGL_SHARE_DEPTH_ARB',
+'WGL_SHARE_STENCIL_ARB', 'WGL_SHARE_ACCUM_ARB', 'WGL_SUPPORT_GDI_ARB',
+'WGL_SUPPORT_OPENGL_ARB', 'WGL_DOUBLE_BUFFER_ARB', 'WGL_STEREO_ARB',
+'WGL_PIXEL_TYPE_ARB', 'WGL_COLOR_BITS_ARB', 'WGL_RED_BITS_ARB',
+'WGL_RED_SHIFT_ARB', 'WGL_GREEN_BITS_ARB', 'WGL_GREEN_SHIFT_ARB',
+'WGL_BLUE_BITS_ARB', 'WGL_BLUE_SHIFT_ARB', 'WGL_ALPHA_BITS_ARB',
+'WGL_ALPHA_SHIFT_ARB', 'WGL_ACCUM_BITS_ARB', 'WGL_ACCUM_RED_BITS_ARB',
+'WGL_ACCUM_GREEN_BITS_ARB', 'WGL_ACCUM_BLUE_BITS_ARB',
+'WGL_ACCUM_ALPHA_BITS_ARB', 'WGL_DEPTH_BITS_ARB', 'WGL_STENCIL_BITS_ARB',
+'WGL_AUX_BUFFERS_ARB', 'WGL_NO_ACCELERATION_ARB',
+'WGL_GENERIC_ACCELERATION_ARB', 'WGL_FULL_ACCELERATION_ARB',
+'WGL_SWAP_EXCHANGE_ARB', 'WGL_SWAP_COPY_ARB', 'WGL_SWAP_UNDEFINED_ARB',
+'WGL_TYPE_RGBA_ARB', 'WGL_TYPE_COLORINDEX_ARB',
+'ERROR_INVALID_PIXEL_TYPE_ARB', 'ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB',
+'WGL_DRAW_TO_PBUFFER_ARB', 'WGL_MAX_PBUFFER_PIXELS_ARB',
+'WGL_MAX_PBUFFER_WIDTH_ARB', 'WGL_MAX_PBUFFER_HEIGHT_ARB',
+'WGL_PBUFFER_LARGEST_ARB', 'WGL_PBUFFER_WIDTH_ARB', 'WGL_PBUFFER_HEIGHT_ARB',
+'WGL_PBUFFER_LOST_ARB', 'WGL_BIND_TO_TEXTURE_RGB_ARB',
+'WGL_BIND_TO_TEXTURE_RGBA_ARB', 'WGL_TEXTURE_FORMAT_ARB',
+'WGL_TEXTURE_TARGET_ARB', 'WGL_MIPMAP_TEXTURE_ARB', 'WGL_TEXTURE_RGB_ARB',
+'WGL_TEXTURE_RGBA_ARB', 'WGL_NO_TEXTURE_ARB', 'WGL_TEXTURE_CUBE_MAP_ARB',
+'WGL_TEXTURE_1D_ARB', 'WGL_TEXTURE_2D_ARB', 'WGL_MIPMAP_LEVEL_ARB',
+'WGL_CUBE_MAP_FACE_ARB', 'WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB',
+'WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB', 'WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB',
+'WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB', 'WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB',
+'WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB', 'WGL_FRONT_LEFT_ARB',
+'WGL_FRONT_RIGHT_ARB', 'WGL_BACK_LEFT_ARB', 'WGL_BACK_RIGHT_ARB',
+'WGL_AUX0_ARB', 'WGL_AUX1_ARB', 'WGL_AUX2_ARB', 'WGL_AUX3_ARB',
+'WGL_AUX4_ARB', 'WGL_AUX5_ARB', 'WGL_AUX6_ARB', 'WGL_AUX7_ARB',
+'WGL_AUX8_ARB', 'WGL_AUX9_ARB', 'WGL_TYPE_RGBA_FLOAT_ARB',
+'WGL_CONTEXT_DEBUG_BIT_ARB', 'WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB',
+'WGL_CONTEXT_MAJOR_VERSION_ARB', 'WGL_CONTEXT_MINOR_VERSION_ARB',
+'WGL_CONTEXT_LAYER_PLANE_ARB', 'WGL_CONTEXT_FLAGS_ARB',
+'ERROR_INVALID_VERSION_ARB', 'ERROR_INVALID_PIXEL_TYPE_EXT',
+'WGL_NUMBER_PIXEL_FORMATS_EXT', 'WGL_DRAW_TO_WINDOW_EXT',
+'WGL_DRAW_TO_BITMAP_EXT', 'WGL_ACCELERATION_EXT', 'WGL_NEED_PALETTE_EXT',
+'WGL_NEED_SYSTEM_PALETTE_EXT', 'WGL_SWAP_LAYER_BUFFERS_EXT',
+'WGL_SWAP_METHOD_EXT', 'WGL_NUMBER_OVERLAYS_EXT', 'WGL_NUMBER_UNDERLAYS_EXT',
+'WGL_TRANSPARENT_EXT', 'WGL_TRANSPARENT_VALUE_EXT', 'WGL_SHARE_DEPTH_EXT',
+'WGL_SHARE_STENCIL_EXT', 'WGL_SHARE_ACCUM_EXT', 'WGL_SUPPORT_GDI_EXT',
+'WGL_SUPPORT_OPENGL_EXT', 'WGL_DOUBLE_BUFFER_EXT', 'WGL_STEREO_EXT',
+'WGL_PIXEL_TYPE_EXT', 'WGL_COLOR_BITS_EXT', 'WGL_RED_BITS_EXT',
+'WGL_RED_SHIFT_EXT', 'WGL_GREEN_BITS_EXT', 'WGL_GREEN_SHIFT_EXT',
+'WGL_BLUE_BITS_EXT', 'WGL_BLUE_SHIFT_EXT', 'WGL_ALPHA_BITS_EXT',
+'WGL_ALPHA_SHIFT_EXT', 'WGL_ACCUM_BITS_EXT', 'WGL_ACCUM_RED_BITS_EXT',
+'WGL_ACCUM_GREEN_BITS_EXT', 'WGL_ACCUM_BLUE_BITS_EXT',
+'WGL_ACCUM_ALPHA_BITS_EXT', 'WGL_DEPTH_BITS_EXT', 'WGL_STENCIL_BITS_EXT',
+'WGL_AUX_BUFFERS_EXT', 'WGL_NO_ACCELERATION_EXT',
+'WGL_GENERIC_ACCELERATION_EXT', 'WGL_FULL_ACCELERATION_EXT',
+'WGL_SWAP_EXCHANGE_EXT', 'WGL_SWAP_COPY_EXT', 'WGL_SWAP_UNDEFINED_EXT',
+'WGL_TYPE_RGBA_EXT', 'WGL_TYPE_COLORINDEX_EXT', 'WGL_DRAW_TO_PBUFFER_EXT',
+'WGL_MAX_PBUFFER_PIXELS_EXT', 'WGL_MAX_PBUFFER_WIDTH_EXT',
+'WGL_MAX_PBUFFER_HEIGHT_EXT', 'WGL_OPTIMAL_PBUFFER_WIDTH_EXT',
+'WGL_OPTIMAL_PBUFFER_HEIGHT_EXT', 'WGL_PBUFFER_LARGEST_EXT',
+'WGL_PBUFFER_WIDTH_EXT', 'WGL_PBUFFER_HEIGHT_EXT', 'WGL_DEPTH_FLOAT_EXT',
+'WGL_SAMPLE_BUFFERS_3DFX', 'WGL_SAMPLES_3DFX', 'WGL_SAMPLE_BUFFERS_EXT',
+'WGL_SAMPLES_EXT', 'WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D',
+'WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D',
+'WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D',
+'WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D', 'WGL_GAMMA_TABLE_SIZE_I3D',
+'WGL_GAMMA_EXCLUDE_DESKTOP_I3D', 'WGL_GENLOCK_SOURCE_MULTIVIEW_I3D',
+'WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D', 'WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D',
+'WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D', 'WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D',
+'WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D', 'WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D',
+'WGL_GENLOCK_SOURCE_EDGE_RISING_I3D', 'WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D',
+'WGL_IMAGE_BUFFER_MIN_ACCESS_I3D', 'WGL_IMAGE_BUFFER_LOCK_I3D',
+'WGL_BIND_TO_TEXTURE_DEPTH_NV', 'WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV',
+'WGL_DEPTH_TEXTURE_FORMAT_NV', 'WGL_TEXTURE_DEPTH_COMPONENT_NV',
+'WGL_DEPTH_COMPONENT_NV', 'WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV', 'WGL_TEXTURE_RECTANGLE_NV',
+'WGL_TYPE_RGBA_FLOAT_ATI', 'WGL_FLOAT_COMPONENTS_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV', 'WGL_TEXTURE_FLOAT_R_NV',
+'WGL_TEXTURE_FLOAT_RG_NV', 'WGL_TEXTURE_FLOAT_RGB_NV',
+'WGL_TEXTURE_FLOAT_RGBA_NV', 'WGL_STEREO_EMITTER_ENABLE_3DL',
+'WGL_STEREO_EMITTER_DISABLE_3DL', 'WGL_STEREO_POLARITY_NORMAL_3DL',
+'WGL_STEREO_POLARITY_INVERT_3DL', 'WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT',
+'WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT', 'WGL_NUM_VIDEO_SLOTS_NV',
+'WGL_BIND_TO_VIDEO_RGB_NV', 'WGL_BIND_TO_VIDEO_RGBA_NV',
+'WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV', 'WGL_VIDEO_OUT_COLOR_NV',
+'WGL_VIDEO_OUT_ALPHA_NV', 'WGL_VIDEO_OUT_DEPTH_NV',
+'WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV', 'WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV',
+'WGL_VIDEO_OUT_FRAME', 'WGL_VIDEO_OUT_FIELD_1', 'WGL_VIDEO_OUT_FIELD_2',
+'WGL_VIDEO_OUT_STACKED_FIELDS_1_2', 'WGL_VIDEO_OUT_STACKED_FIELDS_2_1',
+'WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV',
+'WGL_ERROR_MISSING_AFFINITY_MASK_NV', 'HPBUFFERARB', 'HPBUFFEREXT',
+'HVIDEOOUTPUTDEVICENV', 'HPVIDEODEV', 'HPGPUNV', 'HGPUNV', 'GPU_DEVICE',
+'PGPU_DEVICE', 'WGL_ARB_buffer_region', 'wglCreateBufferRegionARB',
+'wglDeleteBufferRegionARB', 'wglSaveBufferRegionARB',
+'wglRestoreBufferRegionARB', 'PFNWGLCREATEBUFFERREGIONARBPROC',
+'PFNWGLDELETEBUFFERREGIONARBPROC', 'PFNWGLSAVEBUFFERREGIONARBPROC',
+'PFNWGLRESTOREBUFFERREGIONARBPROC', 'WGL_ARB_multisample',
+'WGL_ARB_extensions_string', 'wglGetExtensionsStringARB',
+'PFNWGLGETEXTENSIONSSTRINGARBPROC', 'WGL_ARB_pixel_format',
+'wglGetPixelFormatAttribivARB', 'wglGetPixelFormatAttribfvARB',
+'wglChoosePixelFormatARB', 'PFNWGLGETPIXELFORMATATTRIBIVARBPROC',
+'PFNWGLGETPIXELFORMATATTRIBFVARBPROC', 'PFNWGLCHOOSEPIXELFORMATARBPROC',
+'WGL_ARB_make_current_read', 'wglMakeContextCurrentARB',
+'wglGetCurrentReadDCARB', 'PFNWGLMAKECONTEXTCURRENTARBPROC',
+'PFNWGLGETCURRENTREADDCARBPROC', 'WGL_ARB_pbuffer', 'wglCreatePbufferARB',
+'wglGetPbufferDCARB', 'wglReleasePbufferDCARB', 'wglDestroyPbufferARB',
+'wglQueryPbufferARB', 'PFNWGLCREATEPBUFFERARBPROC',
+'PFNWGLGETPBUFFERDCARBPROC', 'PFNWGLRELEASEPBUFFERDCARBPROC',
+'PFNWGLDESTROYPBUFFERARBPROC', 'PFNWGLQUERYPBUFFERARBPROC',
+'WGL_ARB_render_texture', 'wglBindTexImageARB', 'wglReleaseTexImageARB',
+'wglSetPbufferAttribARB', 'PFNWGLBINDTEXIMAGEARBPROC',
+'PFNWGLRELEASETEXIMAGEARBPROC', 'PFNWGLSETPBUFFERATTRIBARBPROC',
+'WGL_ARB_pixel_format_float', 'WGL_ARB_create_context',
+'wglCreateContextAttribsARB', 'PFNWGLCREATECONTEXTATTRIBSARBPROC',
+'WGL_EXT_display_color_table', 'wglCreateDisplayColorTableEXT',
+'wglLoadDisplayColorTableEXT', 'wglBindDisplayColorTableEXT',
+'wglDestroyDisplayColorTableEXT', 'PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC',
+'PFNWGLLOADDISPLAYCOLORTABLEEXTPROC', 'PFNWGLBINDDISPLAYCOLORTABLEEXTPROC',
+'PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC', 'WGL_EXT_extensions_string',
+'wglGetExtensionsStringEXT', 'PFNWGLGETEXTENSIONSSTRINGEXTPROC',
+'WGL_EXT_make_current_read', 'wglMakeContextCurrentEXT',
+'wglGetCurrentReadDCEXT', 'PFNWGLMAKECONTEXTCURRENTEXTPROC',
+'PFNWGLGETCURRENTREADDCEXTPROC', 'WGL_EXT_pbuffer', 'wglCreatePbufferEXT',
+'wglGetPbufferDCEXT', 'wglReleasePbufferDCEXT', 'wglDestroyPbufferEXT',
+'wglQueryPbufferEXT', 'PFNWGLCREATEPBUFFEREXTPROC',
+'PFNWGLGETPBUFFERDCEXTPROC', 'PFNWGLRELEASEPBUFFERDCEXTPROC',
+'PFNWGLDESTROYPBUFFEREXTPROC', 'PFNWGLQUERYPBUFFEREXTPROC',
+'WGL_EXT_pixel_format', 'wglGetPixelFormatAttribivEXT',
+'wglGetPixelFormatAttribfvEXT', 'wglChoosePixelFormatEXT',
+'PFNWGLGETPIXELFORMATATTRIBIVEXTPROC', 'PFNWGLGETPIXELFORMATATTRIBFVEXTPROC',
+'PFNWGLCHOOSEPIXELFORMATEXTPROC', 'WGL_EXT_swap_control',
+'wglSwapIntervalEXT', 'wglGetSwapIntervalEXT', 'PFNWGLSWAPINTERVALEXTPROC',
+'PFNWGLGETSWAPINTERVALEXTPROC', 'WGL_EXT_depth_float',
+'WGL_NV_vertex_array_range', 'wglAllocateMemoryNV', 'wglFreeMemoryNV',
+'PFNWGLALLOCATEMEMORYNVPROC', 'PFNWGLFREEMEMORYNVPROC',
+'WGL_3DFX_multisample', 'WGL_EXT_multisample', 'WGL_OML_sync_control',
+'wglGetSyncValuesOML', 'wglGetMscRateOML', 'wglSwapBuffersMscOML',
+'wglSwapLayerBuffersMscOML', 'wglWaitForMscOML', 'wglWaitForSbcOML',
+'PFNWGLGETSYNCVALUESOMLPROC', 'PFNWGLGETMSCRATEOMLPROC',
+'PFNWGLSWAPBUFFERSMSCOMLPROC', 'PFNWGLSWAPLAYERBUFFERSMSCOMLPROC',
+'PFNWGLWAITFORMSCOMLPROC', 'PFNWGLWAITFORSBCOMLPROC',
+'WGL_I3D_digital_video_control', 'wglGetDigitalVideoParametersI3D',
+'wglSetDigitalVideoParametersI3D', 'PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC',
+'PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC', 'WGL_I3D_gamma',
+'wglGetGammaTableParametersI3D', 'wglSetGammaTableParametersI3D',
+'wglGetGammaTableI3D', 'wglSetGammaTableI3D',
+'PFNWGLGETGAMMATABLEPARAMETERSI3DPROC',
+'PFNWGLSETGAMMATABLEPARAMETERSI3DPROC', 'PFNWGLGETGAMMATABLEI3DPROC',
+'PFNWGLSETGAMMATABLEI3DPROC', 'WGL_I3D_genlock', 'wglEnableGenlockI3D',
+'wglDisableGenlockI3D', 'wglIsEnabledGenlockI3D', 'wglGenlockSourceI3D',
+'wglGetGenlockSourceI3D', 'wglGenlockSourceEdgeI3D',
+'wglGetGenlockSourceEdgeI3D', 'wglGenlockSampleRateI3D',
+'wglGetGenlockSampleRateI3D', 'wglGenlockSourceDelayI3D',
+'wglGetGenlockSourceDelayI3D', 'wglQueryGenlockMaxSourceDelayI3D',
+'PFNWGLENABLEGENLOCKI3DPROC', 'PFNWGLDISABLEGENLOCKI3DPROC',
+'PFNWGLISENABLEDGENLOCKI3DPROC', 'PFNWGLGENLOCKSOURCEI3DPROC',
+'PFNWGLGETGENLOCKSOURCEI3DPROC', 'PFNWGLGENLOCKSOURCEEDGEI3DPROC',
+'PFNWGLGETGENLOCKSOURCEEDGEI3DPROC', 'PFNWGLGENLOCKSAMPLERATEI3DPROC',
+'PFNWGLGETGENLOCKSAMPLERATEI3DPROC', 'PFNWGLGENLOCKSOURCEDELAYI3DPROC',
+'PFNWGLGETGENLOCKSOURCEDELAYI3DPROC',
+'PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC', 'WGL_I3D_image_buffer',
+'wglCreateImageBufferI3D', 'wglDestroyImageBufferI3D',
+'wglAssociateImageBufferEventsI3D', 'wglReleaseImageBufferEventsI3D',
+'PFNWGLCREATEIMAGEBUFFERI3DPROC', 'PFNWGLDESTROYIMAGEBUFFERI3DPROC',
+'PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC',
+'PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC', 'WGL_I3D_swap_frame_lock',
+'wglEnableFrameLockI3D', 'wglDisableFrameLockI3D', 'wglIsEnabledFrameLockI3D',
+'wglQueryFrameLockMasterI3D', 'PFNWGLENABLEFRAMELOCKI3DPROC',
+'PFNWGLDISABLEFRAMELOCKI3DPROC', 'PFNWGLISENABLEDFRAMELOCKI3DPROC',
+'PFNWGLQUERYFRAMELOCKMASTERI3DPROC', 'WGL_I3D_swap_frame_usage',
+'wglGetFrameUsageI3D', 'wglBeginFrameTrackingI3D', 'wglEndFrameTrackingI3D',
+'wglQueryFrameTrackingI3D', 'PFNWGLGETFRAMEUSAGEI3DPROC',
+'PFNWGLBEGINFRAMETRACKINGI3DPROC', 'PFNWGLENDFRAMETRACKINGI3DPROC',
+'PFNWGLQUERYFRAMETRACKINGI3DPROC', 'WGL_ATI_pixel_format_float',
+'WGL_NV_float_buffer', 'WGL_EXT_pixel_format_packed_float',
+'WGL_EXT_framebuffer_sRGB', 'WGL_NV_present_video',
+'wglEnumerateVideoDevicesNV', 'wglBindVideoDeviceNV',
+'wglQueryCurrentContextNV', 'PFNWGLENUMERATEVIDEODEVICESNVPROC',
+'PFNWGLBINDVIDEODEVICENVPROC', 'PFNWGLQUERYCURRENTCONTEXTNVPROC',
+'WGL_NV_video_out', 'wglGetVideoDeviceNV', 'wglReleaseVideoDeviceNV',
+'wglBindVideoImageNV', 'wglReleaseVideoImageNV', 'wglSendPbufferToVideoNV',
+'wglGetVideoInfoNV', 'PFNWGLGETVIDEODEVICENVPROC',
+'PFNWGLRELEASEVIDEODEVICENVPROC', 'PFNWGLBINDVIDEOIMAGENVPROC',
+'PFNWGLRELEASEVIDEOIMAGENVPROC', 'PFNWGLSENDPBUFFERTOVIDEONVPROC',
+'PFNWGLGETVIDEOINFONVPROC', 'WGL_NV_swap_group', 'wglJoinSwapGroupNV',
+'wglBindSwapBarrierNV', 'wglQuerySwapGroupNV', 'wglQueryMaxSwapGroupsNV',
+'wglQueryFrameCountNV', 'wglResetFrameCountNV', 'PFNWGLJOINSWAPGROUPNVPROC',
+'PFNWGLBINDSWAPBARRIERNVPROC', 'PFNWGLQUERYSWAPGROUPNVPROC',
+'PFNWGLQUERYMAXSWAPGROUPSNVPROC', 'PFNWGLQUERYFRAMECOUNTNVPROC',
+'PFNWGLRESETFRAMECOUNTNVPROC', 'WGL_NV_gpu_affinity', 'wglEnumGpusNV',
+'wglEnumGpuDevicesNV', 'wglCreateAffinityDCNV', 'wglEnumGpusFromAffinityDCNV',
+'wglDeleteDCNV', 'PFNWGLENUMGPUSNVPROC', 'PFNWGLENUMGPUDEVICESNVPROC',
+'PFNWGLCREATEAFFINITYDCNVPROC', 'PFNWGLENUMGPUSFROMAFFINITYDCNVPROC',
+'PFNWGLDELETEDCNVPROC']
+# END GENERATED CONTENT (do not edit above this line)
+
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/wglext_nv.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/wglext_nv.py
new file mode 100644
index 0000000..a3e90ac
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/wglext_nv.py
@@ -0,0 +1,909 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+'''Wrapper for http://developer.download.nvidia.com/opengl/includes/wglext.h
+
+Generated by tools/gengl.py.
+Do not modify this file.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: gengl.py 601 2007-02-04 05:36:59Z Alex.Holkner $'
+
+from ctypes import *
+from pyglet.gl.lib import link_WGL as _link_function
+from pyglet.gl.lib import c_ptrdiff_t, c_void
+
+# BEGIN GENERATED CONTENT (do not edit below this line)
+
+# This content is generated by tools/gengl.py.
+# Wrapper for http://developer.download.nvidia.com/opengl/includes/wglext.h
+
+
+# H (C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:7)
+# H (C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:7)
+WIN32_LEAN_AND_MEAN = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:40
+WGL_WGLEXT_VERSION = 6 # http://developer.download.nvidia.com/opengl/includes/wglext.h:60
+# ARB_buffer_region (http://developer.download.nvidia.com/opengl/includes/wglext.h:62)
+WGL_FRONT_COLOR_BUFFER_BIT_ARB = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:63
+WGL_BACK_COLOR_BUFFER_BIT_ARB = 2 # http://developer.download.nvidia.com/opengl/includes/wglext.h:64
+WGL_DEPTH_BUFFER_BIT_ARB = 4 # http://developer.download.nvidia.com/opengl/includes/wglext.h:65
+WGL_STENCIL_BUFFER_BIT_ARB = 8 # http://developer.download.nvidia.com/opengl/includes/wglext.h:66
+# ARB_multisample (http://developer.download.nvidia.com/opengl/includes/wglext.h:69)
+WGL_SAMPLE_BUFFERS_ARB = 8257 # http://developer.download.nvidia.com/opengl/includes/wglext.h:70
+WGL_SAMPLES_ARB = 8258 # http://developer.download.nvidia.com/opengl/includes/wglext.h:71
+# ARB_extensions_string (http://developer.download.nvidia.com/opengl/includes/wglext.h:74)
+# ARB_pixel_format (http://developer.download.nvidia.com/opengl/includes/wglext.h:77)
+WGL_NUMBER_PIXEL_FORMATS_ARB = 8192 # http://developer.download.nvidia.com/opengl/includes/wglext.h:78
+WGL_DRAW_TO_WINDOW_ARB = 8193 # http://developer.download.nvidia.com/opengl/includes/wglext.h:79
+WGL_DRAW_TO_BITMAP_ARB = 8194 # http://developer.download.nvidia.com/opengl/includes/wglext.h:80
+WGL_ACCELERATION_ARB = 8195 # http://developer.download.nvidia.com/opengl/includes/wglext.h:81
+WGL_NEED_PALETTE_ARB = 8196 # http://developer.download.nvidia.com/opengl/includes/wglext.h:82
+WGL_NEED_SYSTEM_PALETTE_ARB = 8197 # http://developer.download.nvidia.com/opengl/includes/wglext.h:83
+WGL_SWAP_LAYER_BUFFERS_ARB = 8198 # http://developer.download.nvidia.com/opengl/includes/wglext.h:84
+WGL_SWAP_METHOD_ARB = 8199 # http://developer.download.nvidia.com/opengl/includes/wglext.h:85
+WGL_NUMBER_OVERLAYS_ARB = 8200 # http://developer.download.nvidia.com/opengl/includes/wglext.h:86
+WGL_NUMBER_UNDERLAYS_ARB = 8201 # http://developer.download.nvidia.com/opengl/includes/wglext.h:87
+WGL_TRANSPARENT_ARB = 8202 # http://developer.download.nvidia.com/opengl/includes/wglext.h:88
+WGL_TRANSPARENT_RED_VALUE_ARB = 8247 # http://developer.download.nvidia.com/opengl/includes/wglext.h:89
+WGL_TRANSPARENT_GREEN_VALUE_ARB = 8248 # http://developer.download.nvidia.com/opengl/includes/wglext.h:90
+WGL_TRANSPARENT_BLUE_VALUE_ARB = 8249 # http://developer.download.nvidia.com/opengl/includes/wglext.h:91
+WGL_TRANSPARENT_ALPHA_VALUE_ARB = 8250 # http://developer.download.nvidia.com/opengl/includes/wglext.h:92
+WGL_TRANSPARENT_INDEX_VALUE_ARB = 8251 # http://developer.download.nvidia.com/opengl/includes/wglext.h:93
+WGL_SHARE_DEPTH_ARB = 8204 # http://developer.download.nvidia.com/opengl/includes/wglext.h:94
+WGL_SHARE_STENCIL_ARB = 8205 # http://developer.download.nvidia.com/opengl/includes/wglext.h:95
+WGL_SHARE_ACCUM_ARB = 8206 # http://developer.download.nvidia.com/opengl/includes/wglext.h:96
+WGL_SUPPORT_GDI_ARB = 8207 # http://developer.download.nvidia.com/opengl/includes/wglext.h:97
+WGL_SUPPORT_OPENGL_ARB = 8208 # http://developer.download.nvidia.com/opengl/includes/wglext.h:98
+WGL_DOUBLE_BUFFER_ARB = 8209 # http://developer.download.nvidia.com/opengl/includes/wglext.h:99
+WGL_STEREO_ARB = 8210 # http://developer.download.nvidia.com/opengl/includes/wglext.h:100
+WGL_PIXEL_TYPE_ARB = 8211 # http://developer.download.nvidia.com/opengl/includes/wglext.h:101
+WGL_COLOR_BITS_ARB = 8212 # http://developer.download.nvidia.com/opengl/includes/wglext.h:102
+WGL_RED_BITS_ARB = 8213 # http://developer.download.nvidia.com/opengl/includes/wglext.h:103
+WGL_RED_SHIFT_ARB = 8214 # http://developer.download.nvidia.com/opengl/includes/wglext.h:104
+WGL_GREEN_BITS_ARB = 8215 # http://developer.download.nvidia.com/opengl/includes/wglext.h:105
+WGL_GREEN_SHIFT_ARB = 8216 # http://developer.download.nvidia.com/opengl/includes/wglext.h:106
+WGL_BLUE_BITS_ARB = 8217 # http://developer.download.nvidia.com/opengl/includes/wglext.h:107
+WGL_BLUE_SHIFT_ARB = 8218 # http://developer.download.nvidia.com/opengl/includes/wglext.h:108
+WGL_ALPHA_BITS_ARB = 8219 # http://developer.download.nvidia.com/opengl/includes/wglext.h:109
+WGL_ALPHA_SHIFT_ARB = 8220 # http://developer.download.nvidia.com/opengl/includes/wglext.h:110
+WGL_ACCUM_BITS_ARB = 8221 # http://developer.download.nvidia.com/opengl/includes/wglext.h:111
+WGL_ACCUM_RED_BITS_ARB = 8222 # http://developer.download.nvidia.com/opengl/includes/wglext.h:112
+WGL_ACCUM_GREEN_BITS_ARB = 8223 # http://developer.download.nvidia.com/opengl/includes/wglext.h:113
+WGL_ACCUM_BLUE_BITS_ARB = 8224 # http://developer.download.nvidia.com/opengl/includes/wglext.h:114
+WGL_ACCUM_ALPHA_BITS_ARB = 8225 # http://developer.download.nvidia.com/opengl/includes/wglext.h:115
+WGL_DEPTH_BITS_ARB = 8226 # http://developer.download.nvidia.com/opengl/includes/wglext.h:116
+WGL_STENCIL_BITS_ARB = 8227 # http://developer.download.nvidia.com/opengl/includes/wglext.h:117
+WGL_AUX_BUFFERS_ARB = 8228 # http://developer.download.nvidia.com/opengl/includes/wglext.h:118
+WGL_NO_ACCELERATION_ARB = 8229 # http://developer.download.nvidia.com/opengl/includes/wglext.h:119
+WGL_GENERIC_ACCELERATION_ARB = 8230 # http://developer.download.nvidia.com/opengl/includes/wglext.h:120
+WGL_FULL_ACCELERATION_ARB = 8231 # http://developer.download.nvidia.com/opengl/includes/wglext.h:121
+WGL_SWAP_EXCHANGE_ARB = 8232 # http://developer.download.nvidia.com/opengl/includes/wglext.h:122
+WGL_SWAP_COPY_ARB = 8233 # http://developer.download.nvidia.com/opengl/includes/wglext.h:123
+WGL_SWAP_UNDEFINED_ARB = 8234 # http://developer.download.nvidia.com/opengl/includes/wglext.h:124
+WGL_TYPE_RGBA_ARB = 8235 # http://developer.download.nvidia.com/opengl/includes/wglext.h:125
+WGL_TYPE_COLORINDEX_ARB = 8236 # http://developer.download.nvidia.com/opengl/includes/wglext.h:126
+# ARB_make_current_read (http://developer.download.nvidia.com/opengl/includes/wglext.h:129)
+ERROR_INVALID_PIXEL_TYPE_ARB = 8259 # http://developer.download.nvidia.com/opengl/includes/wglext.h:130
+ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB = 8276 # http://developer.download.nvidia.com/opengl/includes/wglext.h:131
+# ARB_pbuffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:134)
+WGL_DRAW_TO_PBUFFER_ARB = 8237 # http://developer.download.nvidia.com/opengl/includes/wglext.h:135
+WGL_MAX_PBUFFER_PIXELS_ARB = 8238 # http://developer.download.nvidia.com/opengl/includes/wglext.h:136
+WGL_MAX_PBUFFER_WIDTH_ARB = 8239 # http://developer.download.nvidia.com/opengl/includes/wglext.h:137
+WGL_MAX_PBUFFER_HEIGHT_ARB = 8240 # http://developer.download.nvidia.com/opengl/includes/wglext.h:138
+WGL_PBUFFER_LARGEST_ARB = 8243 # http://developer.download.nvidia.com/opengl/includes/wglext.h:139
+WGL_PBUFFER_WIDTH_ARB = 8244 # http://developer.download.nvidia.com/opengl/includes/wglext.h:140
+WGL_PBUFFER_HEIGHT_ARB = 8245 # http://developer.download.nvidia.com/opengl/includes/wglext.h:141
+WGL_PBUFFER_LOST_ARB = 8246 # http://developer.download.nvidia.com/opengl/includes/wglext.h:142
+# ARB_render_texture (http://developer.download.nvidia.com/opengl/includes/wglext.h:145)
+WGL_BIND_TO_TEXTURE_RGB_ARB = 8304 # http://developer.download.nvidia.com/opengl/includes/wglext.h:146
+WGL_BIND_TO_TEXTURE_RGBA_ARB = 8305 # http://developer.download.nvidia.com/opengl/includes/wglext.h:147
+WGL_TEXTURE_FORMAT_ARB = 8306 # http://developer.download.nvidia.com/opengl/includes/wglext.h:148
+WGL_TEXTURE_TARGET_ARB = 8307 # http://developer.download.nvidia.com/opengl/includes/wglext.h:149
+WGL_MIPMAP_TEXTURE_ARB = 8308 # http://developer.download.nvidia.com/opengl/includes/wglext.h:150
+WGL_TEXTURE_RGB_ARB = 8309 # http://developer.download.nvidia.com/opengl/includes/wglext.h:151
+WGL_TEXTURE_RGBA_ARB = 8310 # http://developer.download.nvidia.com/opengl/includes/wglext.h:152
+WGL_NO_TEXTURE_ARB = 8311 # http://developer.download.nvidia.com/opengl/includes/wglext.h:153
+WGL_TEXTURE_CUBE_MAP_ARB = 8312 # http://developer.download.nvidia.com/opengl/includes/wglext.h:154
+WGL_TEXTURE_1D_ARB = 8313 # http://developer.download.nvidia.com/opengl/includes/wglext.h:155
+WGL_TEXTURE_2D_ARB = 8314 # http://developer.download.nvidia.com/opengl/includes/wglext.h:156
+WGL_MIPMAP_LEVEL_ARB = 8315 # http://developer.download.nvidia.com/opengl/includes/wglext.h:157
+WGL_CUBE_MAP_FACE_ARB = 8316 # http://developer.download.nvidia.com/opengl/includes/wglext.h:158
+WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = 8317 # http://developer.download.nvidia.com/opengl/includes/wglext.h:159
+WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = 8318 # http://developer.download.nvidia.com/opengl/includes/wglext.h:160
+WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = 8319 # http://developer.download.nvidia.com/opengl/includes/wglext.h:161
+WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = 8320 # http://developer.download.nvidia.com/opengl/includes/wglext.h:162
+WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = 8321 # http://developer.download.nvidia.com/opengl/includes/wglext.h:163
+WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = 8322 # http://developer.download.nvidia.com/opengl/includes/wglext.h:164
+WGL_FRONT_LEFT_ARB = 8323 # http://developer.download.nvidia.com/opengl/includes/wglext.h:165
+WGL_FRONT_RIGHT_ARB = 8324 # http://developer.download.nvidia.com/opengl/includes/wglext.h:166
+WGL_BACK_LEFT_ARB = 8325 # http://developer.download.nvidia.com/opengl/includes/wglext.h:167
+WGL_BACK_RIGHT_ARB = 8326 # http://developer.download.nvidia.com/opengl/includes/wglext.h:168
+WGL_AUX0_ARB = 8327 # http://developer.download.nvidia.com/opengl/includes/wglext.h:169
+WGL_AUX1_ARB = 8328 # http://developer.download.nvidia.com/opengl/includes/wglext.h:170
+WGL_AUX2_ARB = 8329 # http://developer.download.nvidia.com/opengl/includes/wglext.h:171
+WGL_AUX3_ARB = 8330 # http://developer.download.nvidia.com/opengl/includes/wglext.h:172
+WGL_AUX4_ARB = 8331 # http://developer.download.nvidia.com/opengl/includes/wglext.h:173
+WGL_AUX5_ARB = 8332 # http://developer.download.nvidia.com/opengl/includes/wglext.h:174
+WGL_AUX6_ARB = 8333 # http://developer.download.nvidia.com/opengl/includes/wglext.h:175
+WGL_AUX7_ARB = 8334 # http://developer.download.nvidia.com/opengl/includes/wglext.h:176
+WGL_AUX8_ARB = 8335 # http://developer.download.nvidia.com/opengl/includes/wglext.h:177
+WGL_AUX9_ARB = 8336 # http://developer.download.nvidia.com/opengl/includes/wglext.h:178
+# ARB_pixel_format_float (http://developer.download.nvidia.com/opengl/includes/wglext.h:181)
+WGL_TYPE_RGBA_FLOAT_ARB = 8608 # http://developer.download.nvidia.com/opengl/includes/wglext.h:182
+# EXT_make_current_read (http://developer.download.nvidia.com/opengl/includes/wglext.h:185)
+ERROR_INVALID_PIXEL_TYPE_EXT = 8259 # http://developer.download.nvidia.com/opengl/includes/wglext.h:186
+# EXT_pixel_format (http://developer.download.nvidia.com/opengl/includes/wglext.h:189)
+WGL_NUMBER_PIXEL_FORMATS_EXT = 8192 # http://developer.download.nvidia.com/opengl/includes/wglext.h:190
+WGL_DRAW_TO_WINDOW_EXT = 8193 # http://developer.download.nvidia.com/opengl/includes/wglext.h:191
+WGL_DRAW_TO_BITMAP_EXT = 8194 # http://developer.download.nvidia.com/opengl/includes/wglext.h:192
+WGL_ACCELERATION_EXT = 8195 # http://developer.download.nvidia.com/opengl/includes/wglext.h:193
+WGL_NEED_PALETTE_EXT = 8196 # http://developer.download.nvidia.com/opengl/includes/wglext.h:194
+WGL_NEED_SYSTEM_PALETTE_EXT = 8197 # http://developer.download.nvidia.com/opengl/includes/wglext.h:195
+WGL_SWAP_LAYER_BUFFERS_EXT = 8198 # http://developer.download.nvidia.com/opengl/includes/wglext.h:196
+WGL_SWAP_METHOD_EXT = 8199 # http://developer.download.nvidia.com/opengl/includes/wglext.h:197
+WGL_NUMBER_OVERLAYS_EXT = 8200 # http://developer.download.nvidia.com/opengl/includes/wglext.h:198
+WGL_NUMBER_UNDERLAYS_EXT = 8201 # http://developer.download.nvidia.com/opengl/includes/wglext.h:199
+WGL_TRANSPARENT_EXT = 8202 # http://developer.download.nvidia.com/opengl/includes/wglext.h:200
+WGL_TRANSPARENT_VALUE_EXT = 8203 # http://developer.download.nvidia.com/opengl/includes/wglext.h:201
+WGL_SHARE_DEPTH_EXT = 8204 # http://developer.download.nvidia.com/opengl/includes/wglext.h:202
+WGL_SHARE_STENCIL_EXT = 8205 # http://developer.download.nvidia.com/opengl/includes/wglext.h:203
+WGL_SHARE_ACCUM_EXT = 8206 # http://developer.download.nvidia.com/opengl/includes/wglext.h:204
+WGL_SUPPORT_GDI_EXT = 8207 # http://developer.download.nvidia.com/opengl/includes/wglext.h:205
+WGL_SUPPORT_OPENGL_EXT = 8208 # http://developer.download.nvidia.com/opengl/includes/wglext.h:206
+WGL_DOUBLE_BUFFER_EXT = 8209 # http://developer.download.nvidia.com/opengl/includes/wglext.h:207
+WGL_STEREO_EXT = 8210 # http://developer.download.nvidia.com/opengl/includes/wglext.h:208
+WGL_PIXEL_TYPE_EXT = 8211 # http://developer.download.nvidia.com/opengl/includes/wglext.h:209
+WGL_COLOR_BITS_EXT = 8212 # http://developer.download.nvidia.com/opengl/includes/wglext.h:210
+WGL_RED_BITS_EXT = 8213 # http://developer.download.nvidia.com/opengl/includes/wglext.h:211
+WGL_RED_SHIFT_EXT = 8214 # http://developer.download.nvidia.com/opengl/includes/wglext.h:212
+WGL_GREEN_BITS_EXT = 8215 # http://developer.download.nvidia.com/opengl/includes/wglext.h:213
+WGL_GREEN_SHIFT_EXT = 8216 # http://developer.download.nvidia.com/opengl/includes/wglext.h:214
+WGL_BLUE_BITS_EXT = 8217 # http://developer.download.nvidia.com/opengl/includes/wglext.h:215
+WGL_BLUE_SHIFT_EXT = 8218 # http://developer.download.nvidia.com/opengl/includes/wglext.h:216
+WGL_ALPHA_BITS_EXT = 8219 # http://developer.download.nvidia.com/opengl/includes/wglext.h:217
+WGL_ALPHA_SHIFT_EXT = 8220 # http://developer.download.nvidia.com/opengl/includes/wglext.h:218
+WGL_ACCUM_BITS_EXT = 8221 # http://developer.download.nvidia.com/opengl/includes/wglext.h:219
+WGL_ACCUM_RED_BITS_EXT = 8222 # http://developer.download.nvidia.com/opengl/includes/wglext.h:220
+WGL_ACCUM_GREEN_BITS_EXT = 8223 # http://developer.download.nvidia.com/opengl/includes/wglext.h:221
+WGL_ACCUM_BLUE_BITS_EXT = 8224 # http://developer.download.nvidia.com/opengl/includes/wglext.h:222
+WGL_ACCUM_ALPHA_BITS_EXT = 8225 # http://developer.download.nvidia.com/opengl/includes/wglext.h:223
+WGL_DEPTH_BITS_EXT = 8226 # http://developer.download.nvidia.com/opengl/includes/wglext.h:224
+WGL_STENCIL_BITS_EXT = 8227 # http://developer.download.nvidia.com/opengl/includes/wglext.h:225
+WGL_AUX_BUFFERS_EXT = 8228 # http://developer.download.nvidia.com/opengl/includes/wglext.h:226
+WGL_NO_ACCELERATION_EXT = 8229 # http://developer.download.nvidia.com/opengl/includes/wglext.h:227
+WGL_GENERIC_ACCELERATION_EXT = 8230 # http://developer.download.nvidia.com/opengl/includes/wglext.h:228
+WGL_FULL_ACCELERATION_EXT = 8231 # http://developer.download.nvidia.com/opengl/includes/wglext.h:229
+WGL_SWAP_EXCHANGE_EXT = 8232 # http://developer.download.nvidia.com/opengl/includes/wglext.h:230
+WGL_SWAP_COPY_EXT = 8233 # http://developer.download.nvidia.com/opengl/includes/wglext.h:231
+WGL_SWAP_UNDEFINED_EXT = 8234 # http://developer.download.nvidia.com/opengl/includes/wglext.h:232
+WGL_TYPE_RGBA_EXT = 8235 # http://developer.download.nvidia.com/opengl/includes/wglext.h:233
+WGL_TYPE_COLORINDEX_EXT = 8236 # http://developer.download.nvidia.com/opengl/includes/wglext.h:234
+# EXT_pbuffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:237)
+WGL_DRAW_TO_PBUFFER_EXT = 8237 # http://developer.download.nvidia.com/opengl/includes/wglext.h:238
+WGL_MAX_PBUFFER_PIXELS_EXT = 8238 # http://developer.download.nvidia.com/opengl/includes/wglext.h:239
+WGL_MAX_PBUFFER_WIDTH_EXT = 8239 # http://developer.download.nvidia.com/opengl/includes/wglext.h:240
+WGL_MAX_PBUFFER_HEIGHT_EXT = 8240 # http://developer.download.nvidia.com/opengl/includes/wglext.h:241
+WGL_OPTIMAL_PBUFFER_WIDTH_EXT = 8241 # http://developer.download.nvidia.com/opengl/includes/wglext.h:242
+WGL_OPTIMAL_PBUFFER_HEIGHT_EXT = 8242 # http://developer.download.nvidia.com/opengl/includes/wglext.h:243
+WGL_PBUFFER_LARGEST_EXT = 8243 # http://developer.download.nvidia.com/opengl/includes/wglext.h:244
+WGL_PBUFFER_WIDTH_EXT = 8244 # http://developer.download.nvidia.com/opengl/includes/wglext.h:245
+WGL_PBUFFER_HEIGHT_EXT = 8245 # http://developer.download.nvidia.com/opengl/includes/wglext.h:246
+# EXT_depth_float (http://developer.download.nvidia.com/opengl/includes/wglext.h:249)
+WGL_DEPTH_FLOAT_EXT = 8256 # http://developer.download.nvidia.com/opengl/includes/wglext.h:250
+# 3DFX_multisample (http://developer.download.nvidia.com/opengl/includes/wglext.h:253)
+WGL_SAMPLE_BUFFERS_3DFX = 8288 # http://developer.download.nvidia.com/opengl/includes/wglext.h:254
+WGL_SAMPLES_3DFX = 8289 # http://developer.download.nvidia.com/opengl/includes/wglext.h:255
+# EXT_multisample (http://developer.download.nvidia.com/opengl/includes/wglext.h:258)
+WGL_SAMPLE_BUFFERS_EXT = 8257 # http://developer.download.nvidia.com/opengl/includes/wglext.h:259
+WGL_SAMPLES_EXT = 8258 # http://developer.download.nvidia.com/opengl/includes/wglext.h:260
+# I3D_digital_video_control (http://developer.download.nvidia.com/opengl/includes/wglext.h:263)
+WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D = 8272 # http://developer.download.nvidia.com/opengl/includes/wglext.h:264
+WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D = 8273 # http://developer.download.nvidia.com/opengl/includes/wglext.h:265
+WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D = 8274 # http://developer.download.nvidia.com/opengl/includes/wglext.h:266
+WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D = 8275 # http://developer.download.nvidia.com/opengl/includes/wglext.h:267
+# I3D_gamma (http://developer.download.nvidia.com/opengl/includes/wglext.h:270)
+WGL_GAMMA_TABLE_SIZE_I3D = 8270 # http://developer.download.nvidia.com/opengl/includes/wglext.h:271
+WGL_GAMMA_EXCLUDE_DESKTOP_I3D = 8271 # http://developer.download.nvidia.com/opengl/includes/wglext.h:272
+# I3D_genlock (http://developer.download.nvidia.com/opengl/includes/wglext.h:275)
+WGL_GENLOCK_SOURCE_MULTIVIEW_I3D = 8260 # http://developer.download.nvidia.com/opengl/includes/wglext.h:276
+WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D = 8261 # http://developer.download.nvidia.com/opengl/includes/wglext.h:277
+WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D = 8262 # http://developer.download.nvidia.com/opengl/includes/wglext.h:278
+WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D = 8263 # http://developer.download.nvidia.com/opengl/includes/wglext.h:279
+WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D = 8264 # http://developer.download.nvidia.com/opengl/includes/wglext.h:280
+WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D = 8265 # http://developer.download.nvidia.com/opengl/includes/wglext.h:281
+WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D = 8266 # http://developer.download.nvidia.com/opengl/includes/wglext.h:282
+WGL_GENLOCK_SOURCE_EDGE_RISING_I3D = 8267 # http://developer.download.nvidia.com/opengl/includes/wglext.h:283
+WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D = 8268 # http://developer.download.nvidia.com/opengl/includes/wglext.h:284
+# I3D_image_buffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:287)
+WGL_IMAGE_BUFFER_MIN_ACCESS_I3D = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:288
+WGL_IMAGE_BUFFER_LOCK_I3D = 2 # http://developer.download.nvidia.com/opengl/includes/wglext.h:289
+# I3D_swap_frame_lock (http://developer.download.nvidia.com/opengl/includes/wglext.h:292)
+# NV_render_depth_texture (http://developer.download.nvidia.com/opengl/includes/wglext.h:295)
+WGL_BIND_TO_TEXTURE_DEPTH_NV = 8355 # http://developer.download.nvidia.com/opengl/includes/wglext.h:296
+WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV = 8356 # http://developer.download.nvidia.com/opengl/includes/wglext.h:297
+WGL_DEPTH_TEXTURE_FORMAT_NV = 8357 # http://developer.download.nvidia.com/opengl/includes/wglext.h:298
+WGL_TEXTURE_DEPTH_COMPONENT_NV = 8358 # http://developer.download.nvidia.com/opengl/includes/wglext.h:299
+WGL_DEPTH_COMPONENT_NV = 8359 # http://developer.download.nvidia.com/opengl/includes/wglext.h:300
+# NV_render_texture_rectangle (http://developer.download.nvidia.com/opengl/includes/wglext.h:303)
+WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV = 8352 # http://developer.download.nvidia.com/opengl/includes/wglext.h:304
+WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV = 8353 # http://developer.download.nvidia.com/opengl/includes/wglext.h:305
+WGL_TEXTURE_RECTANGLE_NV = 8354 # http://developer.download.nvidia.com/opengl/includes/wglext.h:306
+# ATI_pixel_format_float (http://developer.download.nvidia.com/opengl/includes/wglext.h:309)
+WGL_TYPE_RGBA_FLOAT_ATI = 8608 # http://developer.download.nvidia.com/opengl/includes/wglext.h:310
+WGL_RGBA_FLOAT_MODE_ATI = 34848 # http://developer.download.nvidia.com/opengl/includes/wglext.h:311
+WGL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI = 34869 # http://developer.download.nvidia.com/opengl/includes/wglext.h:312
+# NV_float_buffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:315)
+WGL_FLOAT_COMPONENTS_NV = 8368 # http://developer.download.nvidia.com/opengl/includes/wglext.h:316
+WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV = 8369 # http://developer.download.nvidia.com/opengl/includes/wglext.h:317
+WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV = 8370 # http://developer.download.nvidia.com/opengl/includes/wglext.h:318
+WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV = 8371 # http://developer.download.nvidia.com/opengl/includes/wglext.h:319
+WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV = 8372 # http://developer.download.nvidia.com/opengl/includes/wglext.h:320
+WGL_TEXTURE_FLOAT_R_NV = 8373 # http://developer.download.nvidia.com/opengl/includes/wglext.h:321
+WGL_TEXTURE_FLOAT_RG_NV = 8374 # http://developer.download.nvidia.com/opengl/includes/wglext.h:322
+WGL_TEXTURE_FLOAT_RGB_NV = 8375 # http://developer.download.nvidia.com/opengl/includes/wglext.h:323
+WGL_TEXTURE_FLOAT_RGBA_NV = 8376 # http://developer.download.nvidia.com/opengl/includes/wglext.h:324
+# NV_swap_group (http://developer.download.nvidia.com/opengl/includes/wglext.h:327)
+# NV_gpu_affinity (http://developer.download.nvidia.com/opengl/includes/wglext.h:330)
+WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV = 8400 # http://developer.download.nvidia.com/opengl/includes/wglext.h:331
+WGL_ERROR_MISSING_AFFINITY_MASK_NV = 8401 # http://developer.download.nvidia.com/opengl/includes/wglext.h:332
+# ARB_pbuffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:338)
+HANDLE = POINTER(None) # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:58
+HPBUFFERARB = HANDLE # http://developer.download.nvidia.com/opengl/includes/wglext.h:339
+# EXT_pbuffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:341)
+HPBUFFEREXT = HANDLE # http://developer.download.nvidia.com/opengl/includes/wglext.h:342
+# NV_gpu_affinity (http://developer.download.nvidia.com/opengl/includes/wglext.h:345)
+HGPUNV = HANDLE # http://developer.download.nvidia.com/opengl/includes/wglext.h:346
+class struct__GPU_DEVICE(Structure):
+ __slots__ = [
+ 'cb',
+ 'DeviceName',
+ 'DeviceString',
+ 'Flags',
+ 'rcVirtualScreen',
+ ]
+DWORD = c_ulong # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:54
+CHAR = c_char # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:47
+class struct_tagRECT(Structure):
+ __slots__ = [
+ 'left',
+ 'top',
+ 'right',
+ 'bottom',
+ ]
+LONG = c_long # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:53
+struct_tagRECT._fields_ = [
+ ('left', LONG),
+ ('top', LONG),
+ ('right', LONG),
+ ('bottom', LONG),
+]
+
+RECT = struct_tagRECT # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:200
+struct__GPU_DEVICE._fields_ = [
+ ('cb', DWORD),
+ ('DeviceName', CHAR * 32),
+ ('DeviceString', CHAR * 128),
+ ('Flags', DWORD),
+ ('rcVirtualScreen', RECT),
+]
+
+GPU_DEVICE = struct__GPU_DEVICE # http://developer.download.nvidia.com/opengl/includes/wglext.h:353
+PGPU_DEVICE = POINTER(struct__GPU_DEVICE) # http://developer.download.nvidia.com/opengl/includes/wglext.h:353
+# ARB_buffer_region (http://developer.download.nvidia.com/opengl/includes/wglext.h:356)
+WGL_ARB_buffer_region = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:357
+HDC = HANDLE # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:61
+UINT = c_uint # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:50
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:359
+wglCreateBufferRegionARB = _link_function('wglCreateBufferRegionARB', HANDLE, [HDC, c_int, UINT], 'ARB_buffer_region')
+
+VOID = None # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:45
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:360
+wglDeleteBufferRegionARB = _link_function('wglDeleteBufferRegionARB', VOID, [HANDLE], 'ARB_buffer_region')
+
+BOOL = c_long # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:52
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:361
+wglSaveBufferRegionARB = _link_function('wglSaveBufferRegionARB', BOOL, [HANDLE, c_int, c_int, c_int, c_int], 'ARB_buffer_region')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:362
+wglRestoreBufferRegionARB = _link_function('wglRestoreBufferRegionARB', BOOL, [HANDLE, c_int, c_int, c_int, c_int, c_int, c_int], 'ARB_buffer_region')
+
+PFNWGLCREATEBUFFERREGIONARBPROC = CFUNCTYPE(HANDLE, HDC, c_int, UINT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:364
+PFNWGLDELETEBUFFERREGIONARBPROC = CFUNCTYPE(VOID, HANDLE) # http://developer.download.nvidia.com/opengl/includes/wglext.h:365
+PFNWGLSAVEBUFFERREGIONARBPROC = CFUNCTYPE(BOOL, HANDLE, c_int, c_int, c_int, c_int) # http://developer.download.nvidia.com/opengl/includes/wglext.h:366
+PFNWGLRESTOREBUFFERREGIONARBPROC = CFUNCTYPE(BOOL, HANDLE, c_int, c_int, c_int, c_int, c_int, c_int) # http://developer.download.nvidia.com/opengl/includes/wglext.h:367
+# ARB_multisample (http://developer.download.nvidia.com/opengl/includes/wglext.h:370)
+WGL_ARB_multisample = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:371
+# ARB_extensions_string (http://developer.download.nvidia.com/opengl/includes/wglext.h:374)
+WGL_ARB_extensions_string = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:375
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:377
+wglGetExtensionsStringARB = _link_function('wglGetExtensionsStringARB', c_char_p, [HDC], 'ARB_extensions_string')
+
+PFNWGLGETEXTENSIONSSTRINGARBPROC = CFUNCTYPE(c_char_p, HDC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:379
+# ARB_pixel_format (http://developer.download.nvidia.com/opengl/includes/wglext.h:382)
+WGL_ARB_pixel_format = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:383
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:385
+wglGetPixelFormatAttribivARB = _link_function('wglGetPixelFormatAttribivARB', BOOL, [HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(c_int)], 'ARB_pixel_format')
+
+FLOAT = c_float # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:55
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:386
+wglGetPixelFormatAttribfvARB = _link_function('wglGetPixelFormatAttribfvARB', BOOL, [HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(FLOAT)], 'ARB_pixel_format')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:387
+wglChoosePixelFormatARB = _link_function('wglChoosePixelFormatARB', BOOL, [HDC, POINTER(c_int), POINTER(FLOAT), UINT, POINTER(c_int), POINTER(UINT)], 'ARB_pixel_format')
+
+PFNWGLGETPIXELFORMATATTRIBIVARBPROC = CFUNCTYPE(BOOL, HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:389
+PFNWGLGETPIXELFORMATATTRIBFVARBPROC = CFUNCTYPE(BOOL, HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(FLOAT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:390
+PFNWGLCHOOSEPIXELFORMATARBPROC = CFUNCTYPE(BOOL, HDC, POINTER(c_int), POINTER(FLOAT), UINT, POINTER(c_int), POINTER(UINT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:391
+# ARB_make_current_read (http://developer.download.nvidia.com/opengl/includes/wglext.h:394)
+WGL_ARB_make_current_read = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:395
+HGLRC = HANDLE # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:60
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:397
+wglMakeContextCurrentARB = _link_function('wglMakeContextCurrentARB', BOOL, [HDC, HDC, HGLRC], 'ARB_make_current_read')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:398
+wglGetCurrentReadDCARB = _link_function('wglGetCurrentReadDCARB', HDC, [], 'ARB_make_current_read')
+
+PFNWGLMAKECONTEXTCURRENTARBPROC = CFUNCTYPE(BOOL, HDC, HDC, HGLRC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:400
+PFNWGLGETCURRENTREADDCARBPROC = CFUNCTYPE(HDC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:401
+# ARB_pbuffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:404)
+WGL_ARB_pbuffer = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:405
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:407
+wglCreatePbufferARB = _link_function('wglCreatePbufferARB', HPBUFFERARB, [HDC, c_int, c_int, c_int, POINTER(c_int)], 'ARB_pbuffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:408
+wglGetPbufferDCARB = _link_function('wglGetPbufferDCARB', HDC, [HPBUFFERARB], 'ARB_pbuffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:409
+wglReleasePbufferDCARB = _link_function('wglReleasePbufferDCARB', c_int, [HPBUFFERARB, HDC], 'ARB_pbuffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:410
+wglDestroyPbufferARB = _link_function('wglDestroyPbufferARB', BOOL, [HPBUFFERARB], 'ARB_pbuffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:411
+wglQueryPbufferARB = _link_function('wglQueryPbufferARB', BOOL, [HPBUFFERARB, c_int, POINTER(c_int)], 'ARB_pbuffer')
+
+PFNWGLCREATEPBUFFERARBPROC = CFUNCTYPE(HPBUFFERARB, HDC, c_int, c_int, c_int, POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:413
+PFNWGLGETPBUFFERDCARBPROC = CFUNCTYPE(HDC, HPBUFFERARB) # http://developer.download.nvidia.com/opengl/includes/wglext.h:414
+PFNWGLRELEASEPBUFFERDCARBPROC = CFUNCTYPE(c_int, HPBUFFERARB, HDC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:415
+PFNWGLDESTROYPBUFFERARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB) # http://developer.download.nvidia.com/opengl/includes/wglext.h:416
+PFNWGLQUERYPBUFFERARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB, c_int, POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:417
+# ARB_render_texture (http://developer.download.nvidia.com/opengl/includes/wglext.h:420)
+WGL_ARB_render_texture = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:421
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:423
+wglBindTexImageARB = _link_function('wglBindTexImageARB', BOOL, [HPBUFFERARB, c_int], 'ARB_render_texture')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:424
+wglReleaseTexImageARB = _link_function('wglReleaseTexImageARB', BOOL, [HPBUFFERARB, c_int], 'ARB_render_texture')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:425
+wglSetPbufferAttribARB = _link_function('wglSetPbufferAttribARB', BOOL, [HPBUFFERARB, POINTER(c_int)], 'ARB_render_texture')
+
+PFNWGLBINDTEXIMAGEARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB, c_int) # http://developer.download.nvidia.com/opengl/includes/wglext.h:427
+PFNWGLRELEASETEXIMAGEARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB, c_int) # http://developer.download.nvidia.com/opengl/includes/wglext.h:428
+PFNWGLSETPBUFFERATTRIBARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB, POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:429
+# ARB_pixel_format_float (http://developer.download.nvidia.com/opengl/includes/wglext.h:432)
+WGL_ARB_pixel_format_float = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:433
+# EXT_display_color_table (http://developer.download.nvidia.com/opengl/includes/wglext.h:436)
+WGL_EXT_display_color_table = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:437
+GLboolean = c_ubyte # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:18
+GLushort = c_ushort # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:25
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:439
+wglCreateDisplayColorTableEXT = _link_function('wglCreateDisplayColorTableEXT', GLboolean, [GLushort], 'EXT_display_color_table')
+
+GLuint = c_uint # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:26
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:440
+wglLoadDisplayColorTableEXT = _link_function('wglLoadDisplayColorTableEXT', GLboolean, [POINTER(GLushort), GLuint], 'EXT_display_color_table')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:441
+wglBindDisplayColorTableEXT = _link_function('wglBindDisplayColorTableEXT', GLboolean, [GLushort], 'EXT_display_color_table')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:442
+wglDestroyDisplayColorTableEXT = _link_function('wglDestroyDisplayColorTableEXT', VOID, [GLushort], 'EXT_display_color_table')
+
+PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC = CFUNCTYPE(GLboolean, GLushort) # http://developer.download.nvidia.com/opengl/includes/wglext.h:444
+PFNWGLLOADDISPLAYCOLORTABLEEXTPROC = CFUNCTYPE(GLboolean, POINTER(GLushort), GLuint) # http://developer.download.nvidia.com/opengl/includes/wglext.h:445
+PFNWGLBINDDISPLAYCOLORTABLEEXTPROC = CFUNCTYPE(GLboolean, GLushort) # http://developer.download.nvidia.com/opengl/includes/wglext.h:446
+PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC = CFUNCTYPE(VOID, GLushort) # http://developer.download.nvidia.com/opengl/includes/wglext.h:447
+# EXT_extensions_string (http://developer.download.nvidia.com/opengl/includes/wglext.h:450)
+WGL_EXT_extensions_string = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:451
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:453
+wglGetExtensionsStringEXT = _link_function('wglGetExtensionsStringEXT', c_char_p, [], 'EXT_extensions_string')
+
+PFNWGLGETEXTENSIONSSTRINGEXTPROC = CFUNCTYPE(c_char_p) # http://developer.download.nvidia.com/opengl/includes/wglext.h:455
+# EXT_make_current_read (http://developer.download.nvidia.com/opengl/includes/wglext.h:458)
+WGL_EXT_make_current_read = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:459
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:461
+wglMakeContextCurrentEXT = _link_function('wglMakeContextCurrentEXT', BOOL, [HDC, HDC, HGLRC], 'EXT_make_current_read')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:462
+wglGetCurrentReadDCEXT = _link_function('wglGetCurrentReadDCEXT', HDC, [], 'EXT_make_current_read')
+
+PFNWGLMAKECONTEXTCURRENTEXTPROC = CFUNCTYPE(BOOL, HDC, HDC, HGLRC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:464
+PFNWGLGETCURRENTREADDCEXTPROC = CFUNCTYPE(HDC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:465
+# EXT_pbuffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:468)
+WGL_EXT_pbuffer = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:469
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:471
+wglCreatePbufferEXT = _link_function('wglCreatePbufferEXT', HPBUFFEREXT, [HDC, c_int, c_int, c_int, POINTER(c_int)], 'EXT_pbuffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:472
+wglGetPbufferDCEXT = _link_function('wglGetPbufferDCEXT', HDC, [HPBUFFEREXT], 'EXT_pbuffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:473
+wglReleasePbufferDCEXT = _link_function('wglReleasePbufferDCEXT', c_int, [HPBUFFEREXT, HDC], 'EXT_pbuffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:474
+wglDestroyPbufferEXT = _link_function('wglDestroyPbufferEXT', BOOL, [HPBUFFEREXT], 'EXT_pbuffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:475
+wglQueryPbufferEXT = _link_function('wglQueryPbufferEXT', BOOL, [HPBUFFEREXT, c_int, POINTER(c_int)], 'EXT_pbuffer')
+
+PFNWGLCREATEPBUFFEREXTPROC = CFUNCTYPE(HPBUFFEREXT, HDC, c_int, c_int, c_int, POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:477
+PFNWGLGETPBUFFERDCEXTPROC = CFUNCTYPE(HDC, HPBUFFEREXT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:478
+PFNWGLRELEASEPBUFFERDCEXTPROC = CFUNCTYPE(c_int, HPBUFFEREXT, HDC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:479
+PFNWGLDESTROYPBUFFEREXTPROC = CFUNCTYPE(BOOL, HPBUFFEREXT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:480
+PFNWGLQUERYPBUFFEREXTPROC = CFUNCTYPE(BOOL, HPBUFFEREXT, c_int, POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:481
+# EXT_pixel_format (http://developer.download.nvidia.com/opengl/includes/wglext.h:484)
+WGL_EXT_pixel_format = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:485
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:487
+wglGetPixelFormatAttribivEXT = _link_function('wglGetPixelFormatAttribivEXT', BOOL, [HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(c_int)], 'EXT_pixel_format')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:488
+wglGetPixelFormatAttribfvEXT = _link_function('wglGetPixelFormatAttribfvEXT', BOOL, [HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(FLOAT)], 'EXT_pixel_format')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:489
+wglChoosePixelFormatEXT = _link_function('wglChoosePixelFormatEXT', BOOL, [HDC, POINTER(c_int), POINTER(FLOAT), UINT, POINTER(c_int), POINTER(UINT)], 'EXT_pixel_format')
+
+PFNWGLGETPIXELFORMATATTRIBIVEXTPROC = CFUNCTYPE(BOOL, HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:491
+PFNWGLGETPIXELFORMATATTRIBFVEXTPROC = CFUNCTYPE(BOOL, HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(FLOAT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:492
+PFNWGLCHOOSEPIXELFORMATEXTPROC = CFUNCTYPE(BOOL, HDC, POINTER(c_int), POINTER(FLOAT), UINT, POINTER(c_int), POINTER(UINT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:493
+# EXT_swap_control (http://developer.download.nvidia.com/opengl/includes/wglext.h:496)
+WGL_EXT_swap_control = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:497
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:499
+wglSwapIntervalEXT = _link_function('wglSwapIntervalEXT', BOOL, [c_int], 'EXT_swap_control')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:500
+wglGetSwapIntervalEXT = _link_function('wglGetSwapIntervalEXT', c_int, [], 'EXT_swap_control')
+
+PFNWGLSWAPINTERVALEXTPROC = CFUNCTYPE(BOOL, c_int) # http://developer.download.nvidia.com/opengl/includes/wglext.h:502
+PFNWGLGETSWAPINTERVALEXTPROC = CFUNCTYPE(c_int) # http://developer.download.nvidia.com/opengl/includes/wglext.h:503
+# EXT_depth_float (http://developer.download.nvidia.com/opengl/includes/wglext.h:506)
+WGL_EXT_depth_float = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:507
+# NV_vertex_array_range (http://developer.download.nvidia.com/opengl/includes/wglext.h:510)
+WGL_NV_vertex_array_range = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:511
+GLsizei = c_int # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:23
+GLfloat = c_float # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:27
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:513
+wglAllocateMemoryNV = _link_function('wglAllocateMemoryNV', POINTER(c_void), [GLsizei, GLfloat, GLfloat, GLfloat], 'NV_vertex_array_range')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:514
+wglFreeMemoryNV = _link_function('wglFreeMemoryNV', None, [POINTER(None)], 'NV_vertex_array_range')
+
+PFNWGLALLOCATEMEMORYNVPROC = CFUNCTYPE(POINTER(c_void), GLsizei, GLfloat, GLfloat, GLfloat) # http://developer.download.nvidia.com/opengl/includes/wglext.h:516
+PFNWGLFREEMEMORYNVPROC = CFUNCTYPE(None, POINTER(None)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:517
+# 3DFX_multisample (http://developer.download.nvidia.com/opengl/includes/wglext.h:520)
+WGL_3DFX_multisample = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:521
+# EXT_multisample (http://developer.download.nvidia.com/opengl/includes/wglext.h:524)
+WGL_EXT_multisample = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:525
+# OML_sync_control (http://developer.download.nvidia.com/opengl/includes/wglext.h:528)
+WGL_OML_sync_control = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:529
+INT64 = c_longlong # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:42
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:531
+wglGetSyncValuesOML = _link_function('wglGetSyncValuesOML', BOOL, [HDC, POINTER(INT64), POINTER(INT64), POINTER(INT64)], 'OML_sync_control')
+
+INT32 = c_int # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:35
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:532
+wglGetMscRateOML = _link_function('wglGetMscRateOML', BOOL, [HDC, POINTER(INT32), POINTER(INT32)], 'OML_sync_control')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:533
+wglSwapBuffersMscOML = _link_function('wglSwapBuffersMscOML', INT64, [HDC, INT64, INT64, INT64], 'OML_sync_control')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:534
+wglSwapLayerBuffersMscOML = _link_function('wglSwapLayerBuffersMscOML', INT64, [HDC, c_int, INT64, INT64, INT64], 'OML_sync_control')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:535
+wglWaitForMscOML = _link_function('wglWaitForMscOML', BOOL, [HDC, INT64, INT64, INT64, POINTER(INT64), POINTER(INT64), POINTER(INT64)], 'OML_sync_control')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:536
+wglWaitForSbcOML = _link_function('wglWaitForSbcOML', BOOL, [HDC, INT64, POINTER(INT64), POINTER(INT64), POINTER(INT64)], 'OML_sync_control')
+
+PFNWGLGETSYNCVALUESOMLPROC = CFUNCTYPE(BOOL, HDC, POINTER(INT64), POINTER(INT64), POINTER(INT64)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:538
+PFNWGLGETMSCRATEOMLPROC = CFUNCTYPE(BOOL, HDC, POINTER(INT32), POINTER(INT32)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:539
+PFNWGLSWAPBUFFERSMSCOMLPROC = CFUNCTYPE(INT64, HDC, INT64, INT64, INT64) # http://developer.download.nvidia.com/opengl/includes/wglext.h:540
+PFNWGLSWAPLAYERBUFFERSMSCOMLPROC = CFUNCTYPE(INT64, HDC, c_int, INT64, INT64, INT64) # http://developer.download.nvidia.com/opengl/includes/wglext.h:541
+PFNWGLWAITFORMSCOMLPROC = CFUNCTYPE(BOOL, HDC, INT64, INT64, INT64, POINTER(INT64), POINTER(INT64), POINTER(INT64)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:542
+PFNWGLWAITFORSBCOMLPROC = CFUNCTYPE(BOOL, HDC, INT64, POINTER(INT64), POINTER(INT64), POINTER(INT64)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:543
+# I3D_digital_video_control (http://developer.download.nvidia.com/opengl/includes/wglext.h:546)
+WGL_I3D_digital_video_control = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:547
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:549
+wglGetDigitalVideoParametersI3D = _link_function('wglGetDigitalVideoParametersI3D', BOOL, [HDC, c_int, POINTER(c_int)], 'I3D_digital_video_control')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:550
+wglSetDigitalVideoParametersI3D = _link_function('wglSetDigitalVideoParametersI3D', BOOL, [HDC, c_int, POINTER(c_int)], 'I3D_digital_video_control')
+
+PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:552
+PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:553
+# I3D_gamma (http://developer.download.nvidia.com/opengl/includes/wglext.h:556)
+WGL_I3D_gamma = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:557
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:559
+wglGetGammaTableParametersI3D = _link_function('wglGetGammaTableParametersI3D', BOOL, [HDC, c_int, POINTER(c_int)], 'I3D_gamma')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:560
+wglSetGammaTableParametersI3D = _link_function('wglSetGammaTableParametersI3D', BOOL, [HDC, c_int, POINTER(c_int)], 'I3D_gamma')
+
+USHORT = c_ushort # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:49
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:561
+wglGetGammaTableI3D = _link_function('wglGetGammaTableI3D', BOOL, [HDC, c_int, POINTER(USHORT), POINTER(USHORT), POINTER(USHORT)], 'I3D_gamma')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:562
+wglSetGammaTableI3D = _link_function('wglSetGammaTableI3D', BOOL, [HDC, c_int, POINTER(USHORT), POINTER(USHORT), POINTER(USHORT)], 'I3D_gamma')
+
+PFNWGLGETGAMMATABLEPARAMETERSI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:564
+PFNWGLSETGAMMATABLEPARAMETERSI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:565
+PFNWGLGETGAMMATABLEI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(USHORT), POINTER(USHORT), POINTER(USHORT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:566
+PFNWGLSETGAMMATABLEI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(USHORT), POINTER(USHORT), POINTER(USHORT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:567
+# I3D_genlock (http://developer.download.nvidia.com/opengl/includes/wglext.h:570)
+WGL_I3D_genlock = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:571
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:573
+wglEnableGenlockI3D = _link_function('wglEnableGenlockI3D', BOOL, [HDC], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:574
+wglDisableGenlockI3D = _link_function('wglDisableGenlockI3D', BOOL, [HDC], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:575
+wglIsEnabledGenlockI3D = _link_function('wglIsEnabledGenlockI3D', BOOL, [HDC, POINTER(BOOL)], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:576
+wglGenlockSourceI3D = _link_function('wglGenlockSourceI3D', BOOL, [HDC, UINT], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:577
+wglGetGenlockSourceI3D = _link_function('wglGetGenlockSourceI3D', BOOL, [HDC, POINTER(UINT)], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:578
+wglGenlockSourceEdgeI3D = _link_function('wglGenlockSourceEdgeI3D', BOOL, [HDC, UINT], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:579
+wglGetGenlockSourceEdgeI3D = _link_function('wglGetGenlockSourceEdgeI3D', BOOL, [HDC, POINTER(UINT)], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:580
+wglGenlockSampleRateI3D = _link_function('wglGenlockSampleRateI3D', BOOL, [HDC, UINT], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:581
+wglGetGenlockSampleRateI3D = _link_function('wglGetGenlockSampleRateI3D', BOOL, [HDC, POINTER(UINT)], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:582
+wglGenlockSourceDelayI3D = _link_function('wglGenlockSourceDelayI3D', BOOL, [HDC, UINT], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:583
+wglGetGenlockSourceDelayI3D = _link_function('wglGetGenlockSourceDelayI3D', BOOL, [HDC, POINTER(UINT)], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:584
+wglQueryGenlockMaxSourceDelayI3D = _link_function('wglQueryGenlockMaxSourceDelayI3D', BOOL, [HDC, POINTER(UINT), POINTER(UINT)], 'I3D_genlock')
+
+PFNWGLENABLEGENLOCKI3DPROC = CFUNCTYPE(BOOL, HDC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:586
+PFNWGLDISABLEGENLOCKI3DPROC = CFUNCTYPE(BOOL, HDC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:587
+PFNWGLISENABLEDGENLOCKI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(BOOL)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:588
+PFNWGLGENLOCKSOURCEI3DPROC = CFUNCTYPE(BOOL, HDC, UINT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:589
+PFNWGLGETGENLOCKSOURCEI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:590
+PFNWGLGENLOCKSOURCEEDGEI3DPROC = CFUNCTYPE(BOOL, HDC, UINT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:591
+PFNWGLGETGENLOCKSOURCEEDGEI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:592
+PFNWGLGENLOCKSAMPLERATEI3DPROC = CFUNCTYPE(BOOL, HDC, UINT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:593
+PFNWGLGETGENLOCKSAMPLERATEI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:594
+PFNWGLGENLOCKSOURCEDELAYI3DPROC = CFUNCTYPE(BOOL, HDC, UINT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:595
+PFNWGLGETGENLOCKSOURCEDELAYI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:596
+PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT), POINTER(UINT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:597
+# I3D_image_buffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:600)
+WGL_I3D_image_buffer = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:601
+LPVOID = POINTER(None) # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:45
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:603
+wglCreateImageBufferI3D = _link_function('wglCreateImageBufferI3D', LPVOID, [HDC, DWORD, UINT], 'I3D_image_buffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:604
+wglDestroyImageBufferI3D = _link_function('wglDestroyImageBufferI3D', BOOL, [HDC, LPVOID], 'I3D_image_buffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:605
+wglAssociateImageBufferEventsI3D = _link_function('wglAssociateImageBufferEventsI3D', BOOL, [HDC, POINTER(HANDLE), POINTER(LPVOID), POINTER(DWORD), UINT], 'I3D_image_buffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:606
+wglReleaseImageBufferEventsI3D = _link_function('wglReleaseImageBufferEventsI3D', BOOL, [HDC, POINTER(LPVOID), UINT], 'I3D_image_buffer')
+
+PFNWGLCREATEIMAGEBUFFERI3DPROC = CFUNCTYPE(LPVOID, HDC, DWORD, UINT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:608
+PFNWGLDESTROYIMAGEBUFFERI3DPROC = CFUNCTYPE(BOOL, HDC, LPVOID) # http://developer.download.nvidia.com/opengl/includes/wglext.h:609
+PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(HANDLE), POINTER(LPVOID), POINTER(DWORD), UINT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:610
+PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(LPVOID), UINT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:611
+# I3D_swap_frame_lock (http://developer.download.nvidia.com/opengl/includes/wglext.h:614)
+WGL_I3D_swap_frame_lock = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:615
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:617
+wglEnableFrameLockI3D = _link_function('wglEnableFrameLockI3D', BOOL, [], 'I3D_swap_frame_lock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:618
+wglDisableFrameLockI3D = _link_function('wglDisableFrameLockI3D', BOOL, [], 'I3D_swap_frame_lock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:619
+wglIsEnabledFrameLockI3D = _link_function('wglIsEnabledFrameLockI3D', BOOL, [POINTER(BOOL)], 'I3D_swap_frame_lock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:620
+wglQueryFrameLockMasterI3D = _link_function('wglQueryFrameLockMasterI3D', BOOL, [POINTER(BOOL)], 'I3D_swap_frame_lock')
+
+PFNWGLENABLEFRAMELOCKI3DPROC = CFUNCTYPE(BOOL) # http://developer.download.nvidia.com/opengl/includes/wglext.h:622
+PFNWGLDISABLEFRAMELOCKI3DPROC = CFUNCTYPE(BOOL) # http://developer.download.nvidia.com/opengl/includes/wglext.h:623
+PFNWGLISENABLEDFRAMELOCKI3DPROC = CFUNCTYPE(BOOL, POINTER(BOOL)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:624
+PFNWGLQUERYFRAMELOCKMASTERI3DPROC = CFUNCTYPE(BOOL, POINTER(BOOL)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:625
+# I3D_swap_frame_usage (http://developer.download.nvidia.com/opengl/includes/wglext.h:628)
+WGL_I3D_swap_frame_usage = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:629
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:631
+wglGetFrameUsageI3D = _link_function('wglGetFrameUsageI3D', BOOL, [POINTER(c_float)], 'I3D_swap_frame_usage')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:632
+wglBeginFrameTrackingI3D = _link_function('wglBeginFrameTrackingI3D', BOOL, [], 'I3D_swap_frame_usage')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:633
+wglEndFrameTrackingI3D = _link_function('wglEndFrameTrackingI3D', BOOL, [], 'I3D_swap_frame_usage')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:634
+wglQueryFrameTrackingI3D = _link_function('wglQueryFrameTrackingI3D', BOOL, [POINTER(DWORD), POINTER(DWORD), POINTER(c_float)], 'I3D_swap_frame_usage')
+
+PFNWGLGETFRAMEUSAGEI3DPROC = CFUNCTYPE(BOOL, POINTER(c_float)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:636
+PFNWGLBEGINFRAMETRACKINGI3DPROC = CFUNCTYPE(BOOL) # http://developer.download.nvidia.com/opengl/includes/wglext.h:637
+PFNWGLENDFRAMETRACKINGI3DPROC = CFUNCTYPE(BOOL) # http://developer.download.nvidia.com/opengl/includes/wglext.h:638
+PFNWGLQUERYFRAMETRACKINGI3DPROC = CFUNCTYPE(BOOL, POINTER(DWORD), POINTER(DWORD), POINTER(c_float)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:639
+# ATI_pixel_format_float (http://developer.download.nvidia.com/opengl/includes/wglext.h:642)
+WGL_ATI_pixel_format_float = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:643
+# NV_render_depth_texture (http://developer.download.nvidia.com/opengl/includes/wglext.h:646)
+WGL_NV_render_depth_texture = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:647
+# NV_render_texture_rectangle (http://developer.download.nvidia.com/opengl/includes/wglext.h:650)
+WGL_NV_render_texture_rectangle = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:651
+# NV_float_buffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:654)
+WGL_NV_float_buffer = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:655
+# NV_swap_group (http://developer.download.nvidia.com/opengl/includes/wglext.h:658)
+WGL_NV_swap_group = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:659
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:661
+wglJoinSwapGroupNV = _link_function('wglJoinSwapGroupNV', BOOL, [HDC, GLuint], 'NV_swap_group')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:662
+wglBindSwapBarrierNV = _link_function('wglBindSwapBarrierNV', BOOL, [GLuint, GLuint], 'NV_swap_group')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:663
+wglQuerySwapGroupNV = _link_function('wglQuerySwapGroupNV', BOOL, [HDC, POINTER(GLuint), POINTER(GLuint)], 'NV_swap_group')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:664
+wglQueryMaxSwapGroupsNV = _link_function('wglQueryMaxSwapGroupsNV', BOOL, [HDC, POINTER(GLuint), POINTER(GLuint)], 'NV_swap_group')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:665
+wglQueryFrameCountNV = _link_function('wglQueryFrameCountNV', BOOL, [HDC, POINTER(GLuint)], 'NV_swap_group')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:666
+wglResetFrameCountNV = _link_function('wglResetFrameCountNV', BOOL, [HDC], 'NV_swap_group')
+
+PFNWGLJOINSWAPGROUPNVPROC = CFUNCTYPE(BOOL, HDC, GLuint) # http://developer.download.nvidia.com/opengl/includes/wglext.h:668
+PFNWGLBINDSWAPBARRIERNVPROC = CFUNCTYPE(BOOL, GLuint, GLuint) # http://developer.download.nvidia.com/opengl/includes/wglext.h:669
+PFNWGLQUERYSWAPGROUPNVPROC = CFUNCTYPE(BOOL, HDC, POINTER(GLuint), POINTER(GLuint)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:670
+PFNWGLQUERYMAXSWAPGROUPSNVPROC = CFUNCTYPE(BOOL, HDC, POINTER(GLuint), POINTER(GLuint)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:671
+PFNWGLQUERYFRAMECOUNTNVPROC = CFUNCTYPE(BOOL, HDC, POINTER(GLuint)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:672
+PFNWGLRESETFRAMECOUNTNVPROC = CFUNCTYPE(BOOL, HDC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:673
+# NV_gpu_affinity (http://developer.download.nvidia.com/opengl/includes/wglext.h:676)
+WGL_NV_gpu_affinity = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:677
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:679
+wglEnumGpusNV = _link_function('wglEnumGpusNV', BOOL, [UINT, POINTER(HGPUNV)], 'NV_gpu_affinity')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:680
+wglEnumGpuDevicesNV = _link_function('wglEnumGpuDevicesNV', BOOL, [HGPUNV, UINT, PGPU_DEVICE], 'NV_gpu_affinity')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:681
+wglCreateAffinityDCNV = _link_function('wglCreateAffinityDCNV', HDC, [POINTER(HGPUNV)], 'NV_gpu_affinity')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:682
+wglEnumGpusFromAffinityDCNV = _link_function('wglEnumGpusFromAffinityDCNV', BOOL, [HDC, UINT, POINTER(HGPUNV)], 'NV_gpu_affinity')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:683
+wglDeleteDCNV = _link_function('wglDeleteDCNV', BOOL, [HDC], 'NV_gpu_affinity')
+
+
+__all__ = ['WIN32_LEAN_AND_MEAN', 'WGL_WGLEXT_VERSION',
+'WGL_FRONT_COLOR_BUFFER_BIT_ARB', 'WGL_BACK_COLOR_BUFFER_BIT_ARB',
+'WGL_DEPTH_BUFFER_BIT_ARB', 'WGL_STENCIL_BUFFER_BIT_ARB',
+'WGL_SAMPLE_BUFFERS_ARB', 'WGL_SAMPLES_ARB', 'WGL_NUMBER_PIXEL_FORMATS_ARB',
+'WGL_DRAW_TO_WINDOW_ARB', 'WGL_DRAW_TO_BITMAP_ARB', 'WGL_ACCELERATION_ARB',
+'WGL_NEED_PALETTE_ARB', 'WGL_NEED_SYSTEM_PALETTE_ARB',
+'WGL_SWAP_LAYER_BUFFERS_ARB', 'WGL_SWAP_METHOD_ARB',
+'WGL_NUMBER_OVERLAYS_ARB', 'WGL_NUMBER_UNDERLAYS_ARB', 'WGL_TRANSPARENT_ARB',
+'WGL_TRANSPARENT_RED_VALUE_ARB', 'WGL_TRANSPARENT_GREEN_VALUE_ARB',
+'WGL_TRANSPARENT_BLUE_VALUE_ARB', 'WGL_TRANSPARENT_ALPHA_VALUE_ARB',
+'WGL_TRANSPARENT_INDEX_VALUE_ARB', 'WGL_SHARE_DEPTH_ARB',
+'WGL_SHARE_STENCIL_ARB', 'WGL_SHARE_ACCUM_ARB', 'WGL_SUPPORT_GDI_ARB',
+'WGL_SUPPORT_OPENGL_ARB', 'WGL_DOUBLE_BUFFER_ARB', 'WGL_STEREO_ARB',
+'WGL_PIXEL_TYPE_ARB', 'WGL_COLOR_BITS_ARB', 'WGL_RED_BITS_ARB',
+'WGL_RED_SHIFT_ARB', 'WGL_GREEN_BITS_ARB', 'WGL_GREEN_SHIFT_ARB',
+'WGL_BLUE_BITS_ARB', 'WGL_BLUE_SHIFT_ARB', 'WGL_ALPHA_BITS_ARB',
+'WGL_ALPHA_SHIFT_ARB', 'WGL_ACCUM_BITS_ARB', 'WGL_ACCUM_RED_BITS_ARB',
+'WGL_ACCUM_GREEN_BITS_ARB', 'WGL_ACCUM_BLUE_BITS_ARB',
+'WGL_ACCUM_ALPHA_BITS_ARB', 'WGL_DEPTH_BITS_ARB', 'WGL_STENCIL_BITS_ARB',
+'WGL_AUX_BUFFERS_ARB', 'WGL_NO_ACCELERATION_ARB',
+'WGL_GENERIC_ACCELERATION_ARB', 'WGL_FULL_ACCELERATION_ARB',
+'WGL_SWAP_EXCHANGE_ARB', 'WGL_SWAP_COPY_ARB', 'WGL_SWAP_UNDEFINED_ARB',
+'WGL_TYPE_RGBA_ARB', 'WGL_TYPE_COLORINDEX_ARB',
+'ERROR_INVALID_PIXEL_TYPE_ARB', 'ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB',
+'WGL_DRAW_TO_PBUFFER_ARB', 'WGL_MAX_PBUFFER_PIXELS_ARB',
+'WGL_MAX_PBUFFER_WIDTH_ARB', 'WGL_MAX_PBUFFER_HEIGHT_ARB',
+'WGL_PBUFFER_LARGEST_ARB', 'WGL_PBUFFER_WIDTH_ARB', 'WGL_PBUFFER_HEIGHT_ARB',
+'WGL_PBUFFER_LOST_ARB', 'WGL_BIND_TO_TEXTURE_RGB_ARB',
+'WGL_BIND_TO_TEXTURE_RGBA_ARB', 'WGL_TEXTURE_FORMAT_ARB',
+'WGL_TEXTURE_TARGET_ARB', 'WGL_MIPMAP_TEXTURE_ARB', 'WGL_TEXTURE_RGB_ARB',
+'WGL_TEXTURE_RGBA_ARB', 'WGL_NO_TEXTURE_ARB', 'WGL_TEXTURE_CUBE_MAP_ARB',
+'WGL_TEXTURE_1D_ARB', 'WGL_TEXTURE_2D_ARB', 'WGL_MIPMAP_LEVEL_ARB',
+'WGL_CUBE_MAP_FACE_ARB', 'WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB',
+'WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB', 'WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB',
+'WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB', 'WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB',
+'WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB', 'WGL_FRONT_LEFT_ARB',
+'WGL_FRONT_RIGHT_ARB', 'WGL_BACK_LEFT_ARB', 'WGL_BACK_RIGHT_ARB',
+'WGL_AUX0_ARB', 'WGL_AUX1_ARB', 'WGL_AUX2_ARB', 'WGL_AUX3_ARB',
+'WGL_AUX4_ARB', 'WGL_AUX5_ARB', 'WGL_AUX6_ARB', 'WGL_AUX7_ARB',
+'WGL_AUX8_ARB', 'WGL_AUX9_ARB', 'WGL_TYPE_RGBA_FLOAT_ARB',
+'ERROR_INVALID_PIXEL_TYPE_EXT', 'WGL_NUMBER_PIXEL_FORMATS_EXT',
+'WGL_DRAW_TO_WINDOW_EXT', 'WGL_DRAW_TO_BITMAP_EXT', 'WGL_ACCELERATION_EXT',
+'WGL_NEED_PALETTE_EXT', 'WGL_NEED_SYSTEM_PALETTE_EXT',
+'WGL_SWAP_LAYER_BUFFERS_EXT', 'WGL_SWAP_METHOD_EXT',
+'WGL_NUMBER_OVERLAYS_EXT', 'WGL_NUMBER_UNDERLAYS_EXT', 'WGL_TRANSPARENT_EXT',
+'WGL_TRANSPARENT_VALUE_EXT', 'WGL_SHARE_DEPTH_EXT', 'WGL_SHARE_STENCIL_EXT',
+'WGL_SHARE_ACCUM_EXT', 'WGL_SUPPORT_GDI_EXT', 'WGL_SUPPORT_OPENGL_EXT',
+'WGL_DOUBLE_BUFFER_EXT', 'WGL_STEREO_EXT', 'WGL_PIXEL_TYPE_EXT',
+'WGL_COLOR_BITS_EXT', 'WGL_RED_BITS_EXT', 'WGL_RED_SHIFT_EXT',
+'WGL_GREEN_BITS_EXT', 'WGL_GREEN_SHIFT_EXT', 'WGL_BLUE_BITS_EXT',
+'WGL_BLUE_SHIFT_EXT', 'WGL_ALPHA_BITS_EXT', 'WGL_ALPHA_SHIFT_EXT',
+'WGL_ACCUM_BITS_EXT', 'WGL_ACCUM_RED_BITS_EXT', 'WGL_ACCUM_GREEN_BITS_EXT',
+'WGL_ACCUM_BLUE_BITS_EXT', 'WGL_ACCUM_ALPHA_BITS_EXT', 'WGL_DEPTH_BITS_EXT',
+'WGL_STENCIL_BITS_EXT', 'WGL_AUX_BUFFERS_EXT', 'WGL_NO_ACCELERATION_EXT',
+'WGL_GENERIC_ACCELERATION_EXT', 'WGL_FULL_ACCELERATION_EXT',
+'WGL_SWAP_EXCHANGE_EXT', 'WGL_SWAP_COPY_EXT', 'WGL_SWAP_UNDEFINED_EXT',
+'WGL_TYPE_RGBA_EXT', 'WGL_TYPE_COLORINDEX_EXT', 'WGL_DRAW_TO_PBUFFER_EXT',
+'WGL_MAX_PBUFFER_PIXELS_EXT', 'WGL_MAX_PBUFFER_WIDTH_EXT',
+'WGL_MAX_PBUFFER_HEIGHT_EXT', 'WGL_OPTIMAL_PBUFFER_WIDTH_EXT',
+'WGL_OPTIMAL_PBUFFER_HEIGHT_EXT', 'WGL_PBUFFER_LARGEST_EXT',
+'WGL_PBUFFER_WIDTH_EXT', 'WGL_PBUFFER_HEIGHT_EXT', 'WGL_DEPTH_FLOAT_EXT',
+'WGL_SAMPLE_BUFFERS_3DFX', 'WGL_SAMPLES_3DFX', 'WGL_SAMPLE_BUFFERS_EXT',
+'WGL_SAMPLES_EXT', 'WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D',
+'WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D',
+'WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D',
+'WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D', 'WGL_GAMMA_TABLE_SIZE_I3D',
+'WGL_GAMMA_EXCLUDE_DESKTOP_I3D', 'WGL_GENLOCK_SOURCE_MULTIVIEW_I3D',
+'WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D', 'WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D',
+'WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D', 'WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D',
+'WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D', 'WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D',
+'WGL_GENLOCK_SOURCE_EDGE_RISING_I3D', 'WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D',
+'WGL_IMAGE_BUFFER_MIN_ACCESS_I3D', 'WGL_IMAGE_BUFFER_LOCK_I3D',
+'WGL_BIND_TO_TEXTURE_DEPTH_NV', 'WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV',
+'WGL_DEPTH_TEXTURE_FORMAT_NV', 'WGL_TEXTURE_DEPTH_COMPONENT_NV',
+'WGL_DEPTH_COMPONENT_NV', 'WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV', 'WGL_TEXTURE_RECTANGLE_NV',
+'WGL_TYPE_RGBA_FLOAT_ATI', 'WGL_RGBA_FLOAT_MODE_ATI',
+'WGL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI', 'WGL_FLOAT_COMPONENTS_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV', 'WGL_TEXTURE_FLOAT_R_NV',
+'WGL_TEXTURE_FLOAT_RG_NV', 'WGL_TEXTURE_FLOAT_RGB_NV',
+'WGL_TEXTURE_FLOAT_RGBA_NV', 'WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV',
+'WGL_ERROR_MISSING_AFFINITY_MASK_NV', 'HPBUFFERARB', 'HPBUFFEREXT', 'HGPUNV',
+'GPU_DEVICE', 'PGPU_DEVICE', 'WGL_ARB_buffer_region',
+'wglCreateBufferRegionARB', 'wglDeleteBufferRegionARB',
+'wglSaveBufferRegionARB', 'wglRestoreBufferRegionARB',
+'PFNWGLCREATEBUFFERREGIONARBPROC', 'PFNWGLDELETEBUFFERREGIONARBPROC',
+'PFNWGLSAVEBUFFERREGIONARBPROC', 'PFNWGLRESTOREBUFFERREGIONARBPROC',
+'WGL_ARB_multisample', 'WGL_ARB_extensions_string',
+'wglGetExtensionsStringARB', 'PFNWGLGETEXTENSIONSSTRINGARBPROC',
+'WGL_ARB_pixel_format', 'wglGetPixelFormatAttribivARB',
+'wglGetPixelFormatAttribfvARB', 'wglChoosePixelFormatARB',
+'PFNWGLGETPIXELFORMATATTRIBIVARBPROC', 'PFNWGLGETPIXELFORMATATTRIBFVARBPROC',
+'PFNWGLCHOOSEPIXELFORMATARBPROC', 'WGL_ARB_make_current_read',
+'wglMakeContextCurrentARB', 'wglGetCurrentReadDCARB',
+'PFNWGLMAKECONTEXTCURRENTARBPROC', 'PFNWGLGETCURRENTREADDCARBPROC',
+'WGL_ARB_pbuffer', 'wglCreatePbufferARB', 'wglGetPbufferDCARB',
+'wglReleasePbufferDCARB', 'wglDestroyPbufferARB', 'wglQueryPbufferARB',
+'PFNWGLCREATEPBUFFERARBPROC', 'PFNWGLGETPBUFFERDCARBPROC',
+'PFNWGLRELEASEPBUFFERDCARBPROC', 'PFNWGLDESTROYPBUFFERARBPROC',
+'PFNWGLQUERYPBUFFERARBPROC', 'WGL_ARB_render_texture', 'wglBindTexImageARB',
+'wglReleaseTexImageARB', 'wglSetPbufferAttribARB',
+'PFNWGLBINDTEXIMAGEARBPROC', 'PFNWGLRELEASETEXIMAGEARBPROC',
+'PFNWGLSETPBUFFERATTRIBARBPROC', 'WGL_ARB_pixel_format_float',
+'WGL_EXT_display_color_table', 'wglCreateDisplayColorTableEXT',
+'wglLoadDisplayColorTableEXT', 'wglBindDisplayColorTableEXT',
+'wglDestroyDisplayColorTableEXT', 'PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC',
+'PFNWGLLOADDISPLAYCOLORTABLEEXTPROC', 'PFNWGLBINDDISPLAYCOLORTABLEEXTPROC',
+'PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC', 'WGL_EXT_extensions_string',
+'wglGetExtensionsStringEXT', 'PFNWGLGETEXTENSIONSSTRINGEXTPROC',
+'WGL_EXT_make_current_read', 'wglMakeContextCurrentEXT',
+'wglGetCurrentReadDCEXT', 'PFNWGLMAKECONTEXTCURRENTEXTPROC',
+'PFNWGLGETCURRENTREADDCEXTPROC', 'WGL_EXT_pbuffer', 'wglCreatePbufferEXT',
+'wglGetPbufferDCEXT', 'wglReleasePbufferDCEXT', 'wglDestroyPbufferEXT',
+'wglQueryPbufferEXT', 'PFNWGLCREATEPBUFFEREXTPROC',
+'PFNWGLGETPBUFFERDCEXTPROC', 'PFNWGLRELEASEPBUFFERDCEXTPROC',
+'PFNWGLDESTROYPBUFFEREXTPROC', 'PFNWGLQUERYPBUFFEREXTPROC',
+'WGL_EXT_pixel_format', 'wglGetPixelFormatAttribivEXT',
+'wglGetPixelFormatAttribfvEXT', 'wglChoosePixelFormatEXT',
+'PFNWGLGETPIXELFORMATATTRIBIVEXTPROC', 'PFNWGLGETPIXELFORMATATTRIBFVEXTPROC',
+'PFNWGLCHOOSEPIXELFORMATEXTPROC', 'WGL_EXT_swap_control',
+'wglSwapIntervalEXT', 'wglGetSwapIntervalEXT', 'PFNWGLSWAPINTERVALEXTPROC',
+'PFNWGLGETSWAPINTERVALEXTPROC', 'WGL_EXT_depth_float',
+'WGL_NV_vertex_array_range', 'wglAllocateMemoryNV', 'wglFreeMemoryNV',
+'PFNWGLALLOCATEMEMORYNVPROC', 'PFNWGLFREEMEMORYNVPROC',
+'WGL_3DFX_multisample', 'WGL_EXT_multisample', 'WGL_OML_sync_control',
+'wglGetSyncValuesOML', 'wglGetMscRateOML', 'wglSwapBuffersMscOML',
+'wglSwapLayerBuffersMscOML', 'wglWaitForMscOML', 'wglWaitForSbcOML',
+'PFNWGLGETSYNCVALUESOMLPROC', 'PFNWGLGETMSCRATEOMLPROC',
+'PFNWGLSWAPBUFFERSMSCOMLPROC', 'PFNWGLSWAPLAYERBUFFERSMSCOMLPROC',
+'PFNWGLWAITFORMSCOMLPROC', 'PFNWGLWAITFORSBCOMLPROC',
+'WGL_I3D_digital_video_control', 'wglGetDigitalVideoParametersI3D',
+'wglSetDigitalVideoParametersI3D', 'PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC',
+'PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC', 'WGL_I3D_gamma',
+'wglGetGammaTableParametersI3D', 'wglSetGammaTableParametersI3D',
+'wglGetGammaTableI3D', 'wglSetGammaTableI3D',
+'PFNWGLGETGAMMATABLEPARAMETERSI3DPROC',
+'PFNWGLSETGAMMATABLEPARAMETERSI3DPROC', 'PFNWGLGETGAMMATABLEI3DPROC',
+'PFNWGLSETGAMMATABLEI3DPROC', 'WGL_I3D_genlock', 'wglEnableGenlockI3D',
+'wglDisableGenlockI3D', 'wglIsEnabledGenlockI3D', 'wglGenlockSourceI3D',
+'wglGetGenlockSourceI3D', 'wglGenlockSourceEdgeI3D',
+'wglGetGenlockSourceEdgeI3D', 'wglGenlockSampleRateI3D',
+'wglGetGenlockSampleRateI3D', 'wglGenlockSourceDelayI3D',
+'wglGetGenlockSourceDelayI3D', 'wglQueryGenlockMaxSourceDelayI3D',
+'PFNWGLENABLEGENLOCKI3DPROC', 'PFNWGLDISABLEGENLOCKI3DPROC',
+'PFNWGLISENABLEDGENLOCKI3DPROC', 'PFNWGLGENLOCKSOURCEI3DPROC',
+'PFNWGLGETGENLOCKSOURCEI3DPROC', 'PFNWGLGENLOCKSOURCEEDGEI3DPROC',
+'PFNWGLGETGENLOCKSOURCEEDGEI3DPROC', 'PFNWGLGENLOCKSAMPLERATEI3DPROC',
+'PFNWGLGETGENLOCKSAMPLERATEI3DPROC', 'PFNWGLGENLOCKSOURCEDELAYI3DPROC',
+'PFNWGLGETGENLOCKSOURCEDELAYI3DPROC',
+'PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC', 'WGL_I3D_image_buffer',
+'wglCreateImageBufferI3D', 'wglDestroyImageBufferI3D',
+'wglAssociateImageBufferEventsI3D', 'wglReleaseImageBufferEventsI3D',
+'PFNWGLCREATEIMAGEBUFFERI3DPROC', 'PFNWGLDESTROYIMAGEBUFFERI3DPROC',
+'PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC',
+'PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC', 'WGL_I3D_swap_frame_lock',
+'wglEnableFrameLockI3D', 'wglDisableFrameLockI3D', 'wglIsEnabledFrameLockI3D',
+'wglQueryFrameLockMasterI3D', 'PFNWGLENABLEFRAMELOCKI3DPROC',
+'PFNWGLDISABLEFRAMELOCKI3DPROC', 'PFNWGLISENABLEDFRAMELOCKI3DPROC',
+'PFNWGLQUERYFRAMELOCKMASTERI3DPROC', 'WGL_I3D_swap_frame_usage',
+'wglGetFrameUsageI3D', 'wglBeginFrameTrackingI3D', 'wglEndFrameTrackingI3D',
+'wglQueryFrameTrackingI3D', 'PFNWGLGETFRAMEUSAGEI3DPROC',
+'PFNWGLBEGINFRAMETRACKINGI3DPROC', 'PFNWGLENDFRAMETRACKINGI3DPROC',
+'PFNWGLQUERYFRAMETRACKINGI3DPROC', 'WGL_ATI_pixel_format_float',
+'WGL_NV_render_depth_texture', 'WGL_NV_render_texture_rectangle',
+'WGL_NV_float_buffer', 'WGL_NV_swap_group', 'wglJoinSwapGroupNV',
+'wglBindSwapBarrierNV', 'wglQuerySwapGroupNV', 'wglQueryMaxSwapGroupsNV',
+'wglQueryFrameCountNV', 'wglResetFrameCountNV', 'PFNWGLJOINSWAPGROUPNVPROC',
+'PFNWGLBINDSWAPBARRIERNVPROC', 'PFNWGLQUERYSWAPGROUPNVPROC',
+'PFNWGLQUERYMAXSWAPGROUPSNVPROC', 'PFNWGLQUERYFRAMECOUNTNVPROC',
+'PFNWGLRESETFRAMECOUNTNVPROC', 'WGL_NV_gpu_affinity', 'wglEnumGpusNV',
+'wglEnumGpuDevicesNV', 'wglCreateAffinityDCNV', 'wglEnumGpusFromAffinityDCNV',
+'wglDeleteDCNV']
+# END GENERATED CONTENT (do not edit above this line)
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/win32.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/win32.py
new file mode 100644
index 0000000..8e31fce
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/win32.py
@@ -0,0 +1,267 @@
+#!/usr/bin/python
+# $Id:$
+
+from __future__ import absolute_import
+from builtins import zip
+from pyglet.canvas.win32 import Win32Canvas
+from .base import Config, CanvasConfig, Context
+
+from pyglet import gl
+from pyglet.gl import gl_info
+from pyglet.gl import wgl
+from pyglet.gl import wglext_arb
+from pyglet.gl import wgl_info
+
+from pyglet.libs.win32 import _user32, _kernel32, _gdi32
+from pyglet.libs.win32.constants import *
+from pyglet.libs.win32.types import *
+
+class Win32Config(Config):
+ def match(self, canvas):
+ if not isinstance(canvas, Win32Canvas):
+ raise RuntimeError('Canvas must be instance of Win32Canvas')
+
+ # Use ARB API if available
+ if (gl_info.have_context() and
+ wgl_info.have_extension('WGL_ARB_pixel_format')):
+ return self._get_arb_pixel_format_matching_configs(canvas)
+ else:
+ return self._get_pixel_format_descriptor_matching_configs(canvas)
+
+ def _get_pixel_format_descriptor_matching_configs(self, canvas):
+ '''Get matching configs using standard PIXELFORMATDESCRIPTOR
+ technique.'''
+ pfd = PIXELFORMATDESCRIPTOR()
+ pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR)
+ pfd.nVersion = 1
+ pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL
+
+ if self.double_buffer:
+ pfd.dwFlags |= PFD_DOUBLEBUFFER
+ else:
+ pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE
+
+ if self.stereo:
+ pfd.dwFlags |= PFD_STEREO
+ else:
+ pfd.dwFlags |= PFD_STEREO_DONTCARE
+
+ '''Not supported in pyglet API
+ if attributes.get('swap_copy', False):
+ pfd.dwFlags |= PFD_SWAP_COPY
+ if attributes.get('swap_exchange', False):
+ pfd.dwFlags |= PFD_SWAP_EXCHANGE
+ '''
+
+ if not self.depth_size:
+ pfd.dwFlags |= PFD_DEPTH_DONTCARE
+
+ pfd.iPixelType = PFD_TYPE_RGBA
+ pfd.cColorBits = self.buffer_size or 0
+ pfd.cRedBits = self.red_size or 0
+ pfd.cGreenBits = self.green_size or 0
+ pfd.cBlueBits = self.blue_size or 0
+ pfd.cAlphaBits = self.alpha_size or 0
+ pfd.cAccumRedBits = self.accum_red_size or 0
+ pfd.cAccumGreenBits = self.accum_green_size or 0
+ pfd.cAccumBlueBits = self.accum_blue_size or 0
+ pfd.cAccumAlphaBits = self.accum_alpha_size or 0
+ pfd.cDepthBits = self.depth_size or 0
+ pfd.cStencilBits = self.stencil_size or 0
+ pfd.cAuxBuffers = self.aux_buffers or 0
+
+ pf = _gdi32.ChoosePixelFormat(canvas.hdc, byref(pfd))
+ if pf:
+ return [Win32CanvasConfig(canvas, pf, self)]
+ else:
+ return []
+
+ def _get_arb_pixel_format_matching_configs(self, canvas):
+ '''Get configs using the WGL_ARB_pixel_format extension.
+ This method assumes a (dummy) GL context is already created.'''
+
+ # Check for required extensions
+ if self.sample_buffers or self.samples:
+ if not gl_info.have_extension('GL_ARB_multisample'):
+ return []
+
+ # Construct array of attributes
+ attrs = []
+ for name, value in self.get_gl_attributes():
+ attr = Win32CanvasConfigARB.attribute_ids.get(name, None)
+ if attr and value is not None:
+ attrs.extend([attr, int(value)])
+ attrs.append(0)
+ attrs = (c_int * len(attrs))(*attrs)
+
+ pformats = (c_int * 16)()
+ nformats = c_uint(16)
+ wglext_arb.wglChoosePixelFormatARB(canvas.hdc, attrs, None,
+ nformats, pformats, nformats)
+
+ formats = [Win32CanvasConfigARB(canvas, pf, self) \
+ for pf in pformats[:nformats.value]]
+ return formats
+
+class Win32CanvasConfig(CanvasConfig):
+ def __init__(self, canvas, pf, config):
+ super(Win32CanvasConfig, self).__init__(canvas, config)
+ self._pf = pf
+ self._pfd = PIXELFORMATDESCRIPTOR()
+ _gdi32.DescribePixelFormat(canvas.hdc,
+ self._pf, sizeof(PIXELFORMATDESCRIPTOR), byref(self._pfd))
+
+ self.double_buffer = bool(self._pfd.dwFlags & PFD_DOUBLEBUFFER)
+ self.sample_buffers = 0
+ self.samples = 0
+ self.stereo = bool(self._pfd.dwFlags & PFD_STEREO)
+ self.buffer_size = self._pfd.cColorBits
+ self.red_size = self._pfd.cRedBits
+ self.green_size = self._pfd.cGreenBits
+ self.blue_size = self._pfd.cBlueBits
+ self.alpha_size = self._pfd.cAlphaBits
+ self.accum_red_size = self._pfd.cAccumRedBits
+ self.accum_green_size = self._pfd.cAccumGreenBits
+ self.accum_blue_size = self._pfd.cAccumBlueBits
+ self.accum_alpha_size = self._pfd.cAccumAlphaBits
+ self.depth_size = self._pfd.cDepthBits
+ self.stencil_size = self._pfd.cStencilBits
+ self.aux_buffers = self._pfd.cAuxBuffers
+
+ def compatible(self, canvas):
+ # TODO more careful checking
+ return isinstance(canvas, Win32Canvas)
+
+ def create_context(self, share):
+ return Win32Context(self, share)
+
+ def _set_pixel_format(self, canvas):
+ _gdi32.SetPixelFormat(canvas.hdc, self._pf, byref(self._pfd))
+
+class Win32CanvasConfigARB(CanvasConfig):
+ attribute_ids = {
+ 'double_buffer': wglext_arb.WGL_DOUBLE_BUFFER_ARB,
+ 'stereo': wglext_arb.WGL_STEREO_ARB,
+ 'buffer_size': wglext_arb.WGL_COLOR_BITS_ARB,
+ 'aux_buffers': wglext_arb.WGL_AUX_BUFFERS_ARB,
+ 'sample_buffers': wglext_arb.WGL_SAMPLE_BUFFERS_ARB,
+ 'samples': wglext_arb.WGL_SAMPLES_ARB,
+ 'red_size': wglext_arb.WGL_RED_BITS_ARB,
+ 'green_size': wglext_arb.WGL_GREEN_BITS_ARB,
+ 'blue_size': wglext_arb.WGL_BLUE_BITS_ARB,
+ 'alpha_size': wglext_arb.WGL_ALPHA_BITS_ARB,
+ 'depth_size': wglext_arb.WGL_DEPTH_BITS_ARB,
+ 'stencil_size': wglext_arb.WGL_STENCIL_BITS_ARB,
+ 'accum_red_size': wglext_arb.WGL_ACCUM_RED_BITS_ARB,
+ 'accum_green_size': wglext_arb.WGL_ACCUM_GREEN_BITS_ARB,
+ 'accum_blue_size': wglext_arb.WGL_ACCUM_BLUE_BITS_ARB,
+ 'accum_alpha_size': wglext_arb.WGL_ACCUM_ALPHA_BITS_ARB,
+ }
+ def __init__(self, canvas, pf, config):
+ super(Win32CanvasConfigARB, self).__init__(canvas, config)
+ self._pf = pf
+
+ names = list(self.attribute_ids.keys())
+ attrs = list(self.attribute_ids.values())
+ attrs = (c_int * len(attrs))(*attrs)
+ values = (c_int * len(attrs))()
+
+ result = wglext_arb.wglGetPixelFormatAttribivARB(canvas.hdc,
+ pf, 0, len(attrs), attrs, values)
+
+ for name, value in zip(names, values):
+ setattr(self, name, value)
+
+ def compatible(self, canvas):
+ # TODO more careful checking
+ return isinstance(canvas, Win32Canvas)
+
+ def create_context(self, share):
+ # Workaround for issue on certain Intel cards/drivers.
+ # TODO: Find out if there is a way to query for this problem
+ if wgl_info.have_extension('WGL_ARB_create_context') and gl_info.get_vendor() != 'Intel':
+ return Win32ARBContext(self, share)
+ else:
+ return Win32Context(self, share)
+
+ def _set_pixel_format(self, canvas):
+ _gdi32.SetPixelFormat(canvas.hdc, self._pf, None)
+
+class Win32Context(Context):
+ def __init__(self, config, share):
+ super(Win32Context, self).__init__(config, share)
+ self._context = None
+
+ def attach(self, canvas):
+ super(Win32Context, self).attach(canvas)
+
+ if not self._context:
+ if self.config._requires_gl_3():
+ raise gl.ContextException(
+ 'Require WGL_ARB_create_context extension to create ' +
+ 'OpenGL 3 contexts.')
+
+ self.config._set_pixel_format(canvas)
+ self._context = wgl.wglCreateContext(canvas.hdc)
+
+ share = self.context_share
+ if share:
+ if not share.canvas:
+ raise RuntimeError('Share context has no canvas.')
+ if not wgl.wglShareLists(share._context, self._context):
+ raise gl.ContextException('Unable to share contexts')
+
+ def set_current(self):
+ if self._context is not None:
+ wgl.wglMakeCurrent(self.canvas.hdc, self._context)
+ super(Win32Context, self).set_current()
+
+ def detach(self):
+ if self.canvas:
+ wgl.wglDeleteContext(self._context)
+ self._context = None
+ super(Win32Context, self).detach()
+
+ def flip(self):
+ wgl.wglSwapLayerBuffers(self.canvas.hdc, wgl.WGL_SWAP_MAIN_PLANE)
+
+ def get_vsync(self):
+ if wgl_info.have_extension('WGL_EXT_swap_control'):
+ return bool(wglext_arb.wglGetSwapIntervalEXT())
+
+ def set_vsync(self, vsync):
+ if wgl_info.have_extension('WGL_EXT_swap_control'):
+ wglext_arb.wglSwapIntervalEXT(int(vsync))
+
+class Win32ARBContext(Win32Context):
+ def __init__(self, config, share):
+ super(Win32ARBContext, self).__init__(config, share)
+
+ def attach(self, canvas):
+ share = self.context_share
+ if share:
+ if not share.canvas:
+ raise RuntimeError('Share context has no canvas.')
+ share = share._context
+
+ attribs = []
+ if self.config.major_version is not None:
+ attribs.extend([wglext_arb.WGL_CONTEXT_MAJOR_VERSION_ARB,
+ self.config.major_version])
+ if self.config.minor_version is not None:
+ attribs.extend([wglext_arb.WGL_CONTEXT_MINOR_VERSION_ARB,
+ self.config.minor_version])
+ flags = 0
+ if self.config.forward_compatible:
+ flags |= wglext_arb.WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB
+ if self.config.debug:
+ flags |= wglext_arb.WGL_DEBUG_BIT_ARB
+ if flags:
+ attribs.extend([wglext_arb.WGL_CONTEXT_FLAGS_ARB, flags])
+ attribs.append(0)
+ attribs = (c_int * len(attribs))(*attribs)
+
+ self.config._set_pixel_format(canvas)
+ self._context = wglext_arb.wglCreateContextAttribsARB(canvas.hdc,
+ share, attribs)
+ super(Win32ARBContext, self).attach(canvas)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/xlib.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/xlib.py
new file mode 100644
index 0000000..7d4b0cd
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/gl/xlib.py
@@ -0,0 +1,388 @@
+#!/usr/bin/env python
+
+'''
+'''
+from __future__ import absolute_import
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+from ctypes import *
+
+from pyglet.canvas.xlib import XlibCanvas
+from .base import Config, CanvasConfig, Context
+
+from pyglet import gl
+from pyglet.gl import glx
+from pyglet.gl import glxext_arb
+from pyglet.gl import glx_info
+from pyglet.gl import glxext_mesa
+
+
+class XlibConfig(Config):
+ def match(self, canvas):
+ if not isinstance(canvas, XlibCanvas):
+ raise RuntimeError('Canvas must be an instance of XlibCanvas')
+
+ x_display = canvas.display._display
+ x_screen = canvas.display.x_screen
+
+ info = glx_info.GLXInfo(x_display)
+ have_13 = info.have_version(1, 3)
+ if have_13:
+ config_class = XlibCanvasConfig13
+ else:
+ if 'ATI' in info.get_client_vendor():
+ config_class = XlibCanvasConfig10ATI
+ else:
+ config_class = XlibCanvasConfig10
+
+ # Construct array of attributes
+ attrs = []
+ for name, value in self.get_gl_attributes():
+ attr = config_class.attribute_ids.get(name, None)
+ if attr and value is not None:
+ attrs.extend([attr, int(value)])
+
+ if have_13:
+ attrs.extend([glx.GLX_X_RENDERABLE, True])
+ else:
+ attrs.extend([glx.GLX_RGBA, True])
+
+ if len(attrs):
+ attrs.extend([0, 0])
+ attrib_list = (c_int * len(attrs))(*attrs)
+ else:
+ attrib_list = None
+
+ if have_13:
+ elements = c_int()
+ configs = glx.glXChooseFBConfig(x_display, x_screen,
+ attrib_list, byref(elements))
+ if not configs:
+ return []
+
+ configs = cast(configs,
+ POINTER(glx.GLXFBConfig * elements.value)).contents
+
+ result = [config_class(canvas, info, c, self) for c in configs]
+
+ # Can't free array until all XlibGLConfig13's are GC'd. Too much
+ # hassle, live with leak. XXX
+ # xlib.XFree(configs)
+
+ return result
+ else:
+ try:
+ return [config_class(canvas, info, attrib_list, self)]
+ except gl.ContextException:
+ return []
+
+
+class BaseXlibCanvasConfig(CanvasConfig):
+ # Common code shared between GLX 1.0 and GLX 1.3 configs.
+
+ attribute_ids = {
+ 'buffer_size': glx.GLX_BUFFER_SIZE,
+ 'level': glx.GLX_LEVEL, # Not supported
+ 'double_buffer': glx.GLX_DOUBLEBUFFER,
+ 'stereo': glx.GLX_STEREO,
+ 'aux_buffers': glx.GLX_AUX_BUFFERS,
+ 'red_size': glx.GLX_RED_SIZE,
+ 'green_size': glx.GLX_GREEN_SIZE,
+ 'blue_size': glx.GLX_BLUE_SIZE,
+ 'alpha_size': glx.GLX_ALPHA_SIZE,
+ 'depth_size': glx.GLX_DEPTH_SIZE,
+ 'stencil_size': glx.GLX_STENCIL_SIZE,
+ 'accum_red_size': glx.GLX_ACCUM_RED_SIZE,
+ 'accum_green_size': glx.GLX_ACCUM_GREEN_SIZE,
+ 'accum_blue_size': glx.GLX_ACCUM_BLUE_SIZE,
+ 'accum_alpha_size': glx.GLX_ACCUM_ALPHA_SIZE,
+ }
+
+ def __init__(self, canvas, glx_info, config):
+ super(BaseXlibCanvasConfig, self).__init__(canvas, config)
+ self.glx_info = glx_info
+
+ def compatible(self, canvas):
+ # TODO check more
+ return isinstance(canvas, XlibCanvas)
+
+ def _create_glx_context(self, share):
+ raise NotImplementedError('abstract')
+
+ def is_complete(self):
+ return True
+
+ def get_visual_info(self):
+ raise NotImplementedError('abstract')
+
+
+class XlibCanvasConfig10(BaseXlibCanvasConfig):
+ def __init__(self, canvas, glx_info, attrib_list, config):
+ super(XlibCanvasConfig10, self).__init__(canvas, glx_info, config)
+ x_display = canvas.display._display
+ x_screen = canvas.display.x_screen
+
+ self._visual_info = glx.glXChooseVisual(
+ x_display, x_screen, attrib_list)
+ if not self._visual_info:
+ raise gl.ContextException('No conforming visual exists')
+
+ for name, attr in self.attribute_ids.items():
+ value = c_int()
+ result = glx.glXGetConfig(
+ x_display, self._visual_info, attr, byref(value))
+ if result >= 0:
+ setattr(self, name, value.value)
+ self.sample_buffers = 0
+ self.samples = 0
+
+ def get_visual_info(self):
+ return self._visual_info.contents
+
+ def create_context(self, share):
+ return XlibContext10(self, share)
+
+
+class XlibCanvasConfig10ATI(XlibCanvasConfig10):
+ attribute_ids = BaseXlibCanvasConfig.attribute_ids.copy()
+ del attribute_ids['stereo']
+ stereo = False
+
+
+class XlibCanvasConfig13(BaseXlibCanvasConfig):
+ attribute_ids = BaseXlibCanvasConfig.attribute_ids.copy()
+ attribute_ids.update({
+ 'sample_buffers': glx.GLX_SAMPLE_BUFFERS,
+ 'samples': glx.GLX_SAMPLES,
+
+ # Not supported in current pyglet API:
+ 'render_type': glx.GLX_RENDER_TYPE,
+ 'config_caveat': glx.GLX_CONFIG_CAVEAT,
+ 'transparent_type': glx.GLX_TRANSPARENT_TYPE,
+ 'transparent_index_value': glx.GLX_TRANSPARENT_INDEX_VALUE,
+ 'transparent_red_value': glx.GLX_TRANSPARENT_RED_VALUE,
+ 'transparent_green_value': glx.GLX_TRANSPARENT_GREEN_VALUE,
+ 'transparent_blue_value': glx.GLX_TRANSPARENT_BLUE_VALUE,
+ 'transparent_alpha_value': glx.GLX_TRANSPARENT_ALPHA_VALUE,
+
+ # Used internally
+ 'x_renderable': glx.GLX_X_RENDERABLE,
+ })
+
+ def __init__(self, canvas, glx_info, fbconfig, config):
+ super(XlibCanvasConfig13, self).__init__(canvas, glx_info, config)
+ x_display = canvas.display._display
+
+ self._fbconfig = fbconfig
+ for name, attr in self.attribute_ids.items():
+ value = c_int()
+ result = glx.glXGetFBConfigAttrib(
+ x_display, self._fbconfig, attr, byref(value))
+ if result >= 0:
+ setattr(self, name, value.value)
+
+ def get_visual_info(self):
+ return glx.glXGetVisualFromFBConfig(self.canvas.display._display, self._fbconfig).contents
+
+ def create_context(self, share):
+ if self.glx_info.have_extension('GLX_ARB_create_context'):
+ return XlibContextARB(self, share)
+ else:
+ return XlibContext13(self, share)
+
+
+class BaseXlibContext(Context):
+ def __init__(self, config, share):
+ super(BaseXlibContext, self).__init__(config, share)
+
+ self.x_display = config.canvas.display._display
+
+ self.glx_context = self._create_glx_context(share)
+ if not self.glx_context:
+ # TODO: Check Xlib error generated
+ raise gl.ContextException('Could not create GL context')
+
+ self._have_SGI_video_sync = config.glx_info.have_extension('GLX_SGI_video_sync')
+ self._have_SGI_swap_control = config.glx_info.have_extension('GLX_SGI_swap_control')
+ self._have_MESA_swap_control = config.glx_info.have_extension('GLX_MESA_swap_control')
+
+ # In order of preference:
+ # 1. GLX_MESA_swap_control (more likely to work where video_sync will
+ # not)
+ # 2. GLX_SGI_video_sync (does not work on Intel 945GM, but that has
+ # MESA)
+ # 3. GLX_SGI_swap_control (cannot be disabled once enabled).
+ self._use_video_sync = (self._have_SGI_video_sync and not self._have_MESA_swap_control)
+
+ # XXX mandate that vsync defaults on across all platforms.
+ self._vsync = True
+
+ def is_direct(self):
+ return glx.glXIsDirect(self.x_display, self.glx_context)
+
+ def set_vsync(self, vsync=True):
+ self._vsync = vsync
+ interval = vsync and 1 or 0
+ if not self._use_video_sync and self._have_MESA_swap_control:
+ glxext_mesa.glXSwapIntervalMESA(interval)
+ elif self._have_SGI_swap_control:
+ glxext_arb.glXSwapIntervalSGI(interval)
+
+ def get_vsync(self):
+ return self._vsync
+
+ def _wait_vsync(self):
+ if self._vsync and self._have_SGI_video_sync and self._use_video_sync:
+ count = c_uint()
+ glxext_arb.glXGetVideoSyncSGI(byref(count))
+ glxext_arb.glXWaitVideoSyncSGI(2, (count.value + 1) % 2, byref(count))
+
+
+class XlibContext10(BaseXlibContext):
+ def __init__(self, config, share):
+ super(XlibContext10, self).__init__(config, share)
+
+ def _create_glx_context(self, share):
+ if self.config._requires_gl_3():
+ raise gl.ContextException(
+ 'Require GLX_ARB_create_context extension to create ' +
+ 'OpenGL 3 contexts.')
+
+ if share:
+ share_context = share.glx_context
+ else:
+ share_context = None
+
+ return glx.glXCreateContext(self.config.canvas.display._display,
+ self.config._visual_info, share_context, True)
+
+ def attach(self, canvas):
+ super(XlibContext10, self).attach(canvas)
+
+ self.set_current()
+
+ def set_current(self):
+ glx.glXMakeCurrent(self.x_display, self.canvas.x_window,
+ self.glx_context)
+ super(XlibContext10, self).set_current()
+
+ def detach(self):
+ if not self.canvas:
+ return
+
+ self.set_current()
+ gl.glFlush()
+ glx.glXMakeCurrent(self.x_display, 0, None)
+ super(XlibContext10, self).detach()
+
+ def destroy(self):
+ super(XlibContext10, self).destroy()
+
+ glx.glXDestroyContext(self.x_display, self.glx_context)
+ self.glx_context = None
+
+ def flip(self):
+ if not self.canvas:
+ return
+
+ if self._vsync:
+ self._wait_vsync()
+ glx.glXSwapBuffers(self.x_display, self.canvas.x_window)
+
+
+class XlibContext13(BaseXlibContext):
+ def __init__(self, config, share):
+ super(XlibContext13, self).__init__(config, share)
+ self.glx_window = None
+
+ def _create_glx_context(self, share):
+ if self.config._requires_gl_3():
+ raise gl.ContextException(
+ 'Require GLX_ARB_create_context extension to create ' +
+ 'OpenGL 3 contexts.')
+
+ if share:
+ share_context = share.glx_context
+ else:
+ share_context = None
+
+ return glx.glXCreateNewContext(self.config.canvas.display._display,
+ self.config._fbconfig, glx.GLX_RGBA_TYPE, share_context,
+ True)
+
+ def attach(self, canvas):
+ if canvas is self.canvas: # XXX do this for carbon too?
+ return
+
+ super(XlibContext13, self).attach(canvas)
+
+ self.glx_window = glx.glXCreateWindow(
+ self.x_display, self.config._fbconfig, canvas.x_window, None)
+ self.set_current()
+
+ def set_current(self):
+ glx.glXMakeContextCurrent(
+ self.x_display, self.glx_window, self.glx_window, self.glx_context)
+ super(XlibContext13, self).set_current()
+
+ def detach(self):
+ if not self.canvas:
+ return
+
+ self.set_current()
+ gl.glFlush() # needs to be in try/except?
+
+ super(XlibContext13, self).detach()
+
+ glx.glXMakeContextCurrent(self.x_display, 0, 0, None)
+ if self.glx_window:
+ glx.glXDestroyWindow(self.x_display, self.glx_window)
+ self.glx_window = None
+
+ def destroy(self):
+ super(XlibContext13, self).destroy()
+ if self.glx_window:
+ glx.glXDestroyWindow(self.config.display._display, self.glx_window)
+ self.glx_window = None
+ if self.glx_context:
+ glx.glXDestroyContext(self.x_display, self.glx_context)
+ self.glx_context = None
+
+ def flip(self):
+ if not self.glx_window:
+ return
+
+ if self._vsync:
+ self._wait_vsync()
+ glx.glXSwapBuffers(self.x_display, self.glx_window)
+
+
+class XlibContextARB(XlibContext13):
+ def _create_glx_context(self, share):
+ if share:
+ share_context = share.glx_context
+ else:
+ share_context = None
+
+ attribs = []
+ if self.config.major_version is not None:
+ attribs.extend([glxext_arb.GLX_CONTEXT_MAJOR_VERSION_ARB,
+ self.config.major_version])
+ if self.config.minor_version is not None:
+ attribs.extend([glxext_arb.GLX_CONTEXT_MINOR_VERSION_ARB,
+ self.config.minor_version])
+ flags = 0
+ if self.config.forward_compatible:
+ flags |= glxext_arb.GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB
+ if self.config.debug:
+ flags |= glxext_arb.GLX_CONTEXT_DEBUG_BIT_ARB
+ if flags:
+ attribs.extend([glxext_arb.GLX_CONTEXT_FLAGS_ARB, flags])
+ attribs.append(0)
+ attribs = (c_int * len(attribs))(*attribs)
+
+ return glxext_arb.glXCreateContextAttribsARB(
+ self.config.canvas.display._display,
+ self.config._fbconfig, share_context, True, attribs)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/graphics/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/graphics/__init__.py
new file mode 100644
index 0000000..448d882
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/graphics/__init__.py
@@ -0,0 +1,746 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+# $Id:$
+
+'''Low-level graphics rendering.
+
+This module provides an efficient low-level abstraction over OpenGL. It gives
+very good performance for rendering OpenGL primitives; far better than the
+typical immediate-mode usage and, on modern graphics cards, better than using
+display lists in many cases. The module is used internally by other areas of
+pyglet.
+
+See the :ref:`programming-guide-graphics` for details on how to use this graphics API.
+
+Batches and groups
+==================
+
+Without even needing to understand the details on how to draw primitives with
+the graphics API, developers can make use of :py:class:`~pyglet.graphics.Batch` and :py:class:`~pyglet.graphics.Group`
+objects to improve performance of sprite and text rendering.
+
+The :py:class:`~pyglet.sprite.Sprite`, :py:func:`~pyglet.text.Label` and :py:func:`~pyglet.text.layout.TextLayout` classes all accept a ``batch`` and
+``group`` parameter in their constructors. A batch manages a set of objects
+that will be drawn all at once, and a group describes the manner in which an
+object is drawn.
+
+The following example creates a batch, adds two sprites to the batch, and then
+draws the entire batch::
+
+ batch = pyglet.graphics.Batch()
+ car = pyglet.sprite.Sprite(car_image, batch=batch)
+ boat = pyglet.sprite.Sprite(boat_image, batch=batch)
+
+ def on_draw()
+ batch.draw()
+
+Drawing a complete batch is much faster than drawing the items in the batch
+individually, especially when those items belong to a common group.
+
+Groups describe the OpenGL state required for an item. This is for the most
+part managed by the sprite and text classes, however you can also use groups
+to ensure items are drawn in a particular order. For example, the following
+example adds a background sprite which is guaranteed to be drawn before the
+car and the boat::
+
+ batch = pyglet.graphics.Batch()
+ background = pyglet.graphics.OrderedGroup(0)
+ foreground = pyglet.graphics.OrderedGroup(1)
+
+ background = pyglet.sprite.Sprite(background_image,
+ batch=batch, group=background)
+ car = pyglet.sprite.Sprite(car_image, batch=batch, group=foreground)
+ boat = pyglet.sprite.Sprite(boat_image, batch=batch, group=foreground)
+
+ def on_draw()
+ batch.draw()
+
+It's preferable to manage sprites and text objects within as few batches as
+possible. If the drawing of sprites or text objects need to be interleaved
+with other drawing that does not use the graphics API, multiple batches will
+be required.
+
+Data item parameters
+====================
+
+Many of the functions and methods in this module accept any number of ``data``
+parameters as their final parameters. In the documentation these are notated
+as ``*data`` in the formal parameter list.
+
+A data parameter describes a vertex attribute format and an optional sequence
+to initialise that attribute. Examples of common attribute formats are:
+
+``"v3f"``
+ Vertex position, specified as three floats.
+``"c4B"``
+ Vertex color, specified as four unsigned bytes.
+``"t2f"``
+ Texture coordinate, specified as two floats.
+
+See `pyglet.graphics.vertexattribute` for the complete syntax of the vertex
+format string.
+
+When no initial data is to be given, the data item is just the format string.
+For example, the following creates a 2 element vertex list with position and
+color attributes::
+
+ vertex_list = pyglet.graphics.vertex_list(2, 'v2f', 'c4B')
+
+When initial data is required, wrap the format string and the initial data in
+a tuple, for example::
+
+ vertex_list = pyglet.graphics.vertex_list(2,
+ ('v2f', (0.0, 1.0, 1.0, 0.0)),
+ ('c4B', (255, 255, 255, 255) * 2))
+
+Drawing modes
+=============
+
+Methods in this module that accept a ``mode`` parameter will accept any value
+in the OpenGL drawing mode enumeration: ``GL_POINTS``, ``GL_LINE_STRIP``,
+``GL_LINE_LOOP``, ``GL_LINES``, ``GL_TRIANGLE_STRIP``, ``GL_TRIANGLE_FAN``,
+``GL_TRIANGLES``, ``GL_QUAD_STRIP``, ``GL_QUADS``, and ``GL_POLYGON``.
+
+::
+
+ pyglet.graphics.draw(1, GL_POINTS, ('v2i',(10,20)))
+
+However, because of the way the graphics API renders multiple primitives with
+shared state, ``GL_POLYGON``, ``GL_LINE_LOOP`` and ``GL_TRIANGLE_FAN`` cannot
+be used --- the results are undefined.
+
+When using ``GL_LINE_STRIP``, ``GL_TRIANGLE_STRIP`` or ``GL_QUAD_STRIP`` care
+must be taken to insert degenerate vertices at the beginning and end of each
+vertex list. For example, given the vertex list::
+
+ A, B, C, D
+
+the correct vertex list to provide the vertex list is::
+
+ A, A, B, C, D, D
+
+Alternatively, the ``NV_primitive_restart`` extension can be used if it is
+present. This also permits use of ``GL_POLYGON``, ``GL_LINE_LOOP`` and
+``GL_TRIANGLE_FAN``. Unfortunately the extension is not provided by older
+video drivers, and requires indexed vertex lists.
+
+.. versionadded:: 1.1
+'''
+from __future__ import print_function
+from builtins import zip
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import ctypes
+
+import pyglet
+from pyglet.gl import *
+from pyglet import gl
+from pyglet.graphics import vertexbuffer, vertexattribute, vertexdomain
+
+_debug_graphics_batch = pyglet.options['debug_graphics_batch']
+
+def draw(size, mode, *data):
+ '''Draw a primitive immediately.
+
+ :Parameters:
+ `size` : int
+ Number of vertices given
+ `mode` : gl primitive type
+ OpenGL drawing mode, e.g. ``GL_TRIANGLES``,
+ avoiding quotes.
+ `data` : data items
+ Attribute formats and data. See the module summary for
+ details.
+
+ '''
+ glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
+
+ buffers = []
+ for format, array in data:
+ attribute = vertexattribute.create_attribute(format)
+ assert size == len(array) // attribute.count, \
+ 'Data for %s is incorrect length' % format
+ buffer = vertexbuffer.create_mappable_buffer(
+ size * attribute.stride, vbo=False)
+
+ attribute.set_region(buffer, 0, size, array)
+ attribute.enable()
+ attribute.set_pointer(buffer.ptr)
+ buffers.append(buffer)
+
+ glDrawArrays(mode, 0, size)
+ glFlush()
+
+ glPopClientAttrib()
+
+def draw_indexed(size, mode, indices, *data):
+ '''Draw a primitive with indexed vertices immediately.
+
+ :Parameters:
+ `size` : int
+ Number of vertices given
+ `mode` : int
+ OpenGL drawing mode, e.g. ``GL_TRIANGLES``
+ `indices` : sequence of int
+ Sequence of integers giving indices into the vertex list.
+ `data` : data items
+ Attribute formats and data. See the module summary for details.
+
+ '''
+ glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
+
+ buffers = []
+ for format, array in data:
+ attribute = vertexattribute.create_attribute(format)
+ assert size == len(array) // attribute.count, \
+ 'Data for %s is incorrect length' % format
+ buffer = vertexbuffer.create_mappable_buffer(
+ size * attribute.stride, vbo=False)
+
+ attribute.set_region(buffer, 0, size, array)
+ attribute.enable()
+ attribute.set_pointer(buffer.ptr)
+ buffers.append(buffer)
+
+ if size <= 0xff:
+ index_type = GL_UNSIGNED_BYTE
+ index_c_type = ctypes.c_ubyte
+ elif size <= 0xffff:
+ index_type = GL_UNSIGNED_SHORT
+ index_c_type = ctypes.c_ushort
+ else:
+ index_type = GL_UNSIGNED_INT
+ index_c_type = ctypes.c_uint
+
+ index_array = (index_c_type * len(indices))(*indices)
+ glDrawElements(mode, len(indices), index_type, index_array)
+ glFlush()
+
+ glPopClientAttrib()
+
+def _parse_data(data):
+ '''Given a list of data items, returns (formats, initial_arrays).'''
+ assert data, 'No attribute formats given'
+
+ # Return tuple (formats, initial_arrays).
+ formats = []
+ initial_arrays = []
+ for i, format in enumerate(data):
+ if isinstance(format, tuple):
+ format, array = format
+ initial_arrays.append((i, array))
+ formats.append(format)
+ formats = tuple(formats)
+ return formats, initial_arrays
+
+def _get_default_batch():
+ shared_object_space = gl.current_context.object_space
+ try:
+ return shared_object_space.pyglet_graphics_default_batch
+ except AttributeError:
+ shared_object_space.pyglet_graphics_default_batch = Batch()
+ return shared_object_space.pyglet_graphics_default_batch
+
+def vertex_list(count, *data):
+ '''Create a :py:class:`~pyglet.graphics.vertexdomain.VertexList` not associated with a batch, group or mode.
+
+ :Parameters:
+ `count` : int
+ The number of vertices in the list.
+ `data` : data items
+ Attribute formats and initial data for the vertex list. See the
+ module summary for details.
+
+ :rtype: :py:class:`~pyglet.graphics.vertexdomain.VertexList`
+ '''
+ # Note that mode=0 because the default batch is never drawn: vertex lists
+ # returned from this function are drawn directly by the app.
+ return _get_default_batch().add(count, 0, None, *data)
+
+def vertex_list_indexed(count, indices, *data):
+ '''Create an `IndexedVertexList` not associated with a batch, group or mode.
+
+ :Parameters:
+ `count` : int
+ The number of vertices in the list.
+ `indices` : sequence
+ Sequence of integers giving indices into the vertex list.
+ `data` : data items
+ Attribute formats and initial data for the vertex list. See the
+ module summary for details.
+
+ :rtype: `IndexedVertexList`
+ '''
+ # Note that mode=0 because the default batch is never drawn: vertex lists
+ # returned from this function are drawn directly by the app.
+ return _get_default_batch().add_indexed(count, 0, None, indices, *data)
+
+class Batch(object):
+ '''Manage a collection of vertex lists for batched rendering.
+
+ Vertex lists are added to a :py:class:`~pyglet.graphics.Batch` using the `add` and `add_indexed`
+ methods. An optional group can be specified along with the vertex list,
+ which gives the OpenGL state required for its rendering. Vertex lists
+ with shared mode and group are allocated into adjacent areas of memory and
+ sent to the graphics card in a single operation.
+
+ Call `VertexList.delete` to remove a vertex list from the batch.
+ '''
+ def __init__(self):
+ '''Create a graphics batch.'''
+ # Mapping to find domain.
+ # group -> (attributes, mode, indexed) -> domain
+ self.group_map = {}
+
+ # Mapping of group to list of children.
+ self.group_children = {}
+
+ # List of top-level groups
+ self.top_groups = []
+
+ self._draw_list = []
+ self._draw_list_dirty = False
+
+ def invalidate(self):
+ '''Force the batch to update the draw list.
+
+ This method can be used to force the batch to re-compute the draw list
+ when the ordering of groups has changed.
+
+ .. versionadded:: 1.2
+ '''
+ self._draw_list_dirty = True
+
+ def add(self, count, mode, group, *data):
+ '''Add a vertex list to the batch.
+
+ :Parameters:
+ `count` : int
+ The number of vertices in the list.
+ `mode` : int
+ OpenGL drawing mode enumeration; for example, one of
+ ``GL_POINTS``, ``GL_LINES``, ``GL_TRIANGLES``, etc.
+ See the module summary for additional information.
+ `group` : `~pyglet.graphics.Group`
+ Group of the vertex list, or ``None`` if no group is required.
+ `data` : data items
+ Attribute formats and initial data for the vertex list. See
+ the module summary for details.
+
+ :rtype: :py:class:`~pyglet.graphics.vertexdomain.VertexList`
+ '''
+ formats, initial_arrays = _parse_data(data)
+ domain = self._get_domain(False, mode, group, formats)
+
+ # Create vertex list and initialize
+ vlist = domain.create(count)
+ for i, array in initial_arrays:
+ vlist._set_attribute_data(i, array)
+
+ return vlist
+
+ def add_indexed(self, count, mode, group, indices, *data):
+ '''Add an indexed vertex list to the batch.
+
+ :Parameters:
+ `count` : int
+ The number of vertices in the list.
+ `mode` : int
+ OpenGL drawing mode enumeration; for example, one of
+ ``GL_POINTS``, ``GL_LINES``, ``GL_TRIANGLES``, etc.
+ See the module summary for additional information.
+ `group` : `~pyglet.graphics.Group`
+ Group of the vertex list, or ``None`` if no group is required.
+ `indices` : sequence
+ Sequence of integers giving indices into the vertex list.
+ `data` : data items
+ Attribute formats and initial data for the vertex list. See
+ the module summary for details.
+
+ :rtype: `IndexedVertexList`
+ '''
+ formats, initial_arrays = _parse_data(data)
+ domain = self._get_domain(True, mode, group, formats)
+
+ # Create vertex list and initialize
+ vlist = domain.create(count, len(indices))
+ start = vlist.start
+ vlist._set_index_data([i + start for i in indices])
+ for i, array in initial_arrays:
+ vlist._set_attribute_data(i, array)
+
+ return vlist
+
+ def migrate(self, vertex_list, mode, group, batch):
+ '''Migrate a vertex list to another batch and/or group.
+
+ `vertex_list` and `mode` together identify the vertex list to migrate.
+ `group` and `batch` are new owners of the vertex list after migration.
+
+ The results are undefined if `mode` is not correct or if `vertex_list`
+ does not belong to this batch (they are not checked and will not
+ necessarily throw an exception immediately).
+
+ `batch` can remain unchanged if only a group change is desired.
+
+ :Parameters:
+ `vertex_list` : `~pyglet.graphics.vertexdomain.VertexList`
+ A vertex list currently belonging to this batch.
+ `mode` : int
+ The current GL drawing mode of the vertex list.
+ `group` : `~pyglet.graphics.Group`
+ The new group to migrate to.
+ `batch` : `~pyglet.graphics.Batch`
+ The batch to migrate to (or the current batch).
+
+ '''
+ formats = vertex_list.domain.__formats
+ if isinstance(vertex_list, vertexdomain.IndexedVertexList):
+ domain = batch._get_domain(True, mode, group, formats)
+ else:
+ domain = batch._get_domain(False, mode, group, formats)
+ vertex_list.migrate(domain)
+
+ def _get_domain(self, indexed, mode, group, formats):
+ if group is None:
+ group = null_group
+
+ # Batch group
+ if group not in self.group_map:
+ self._add_group(group)
+
+ domain_map = self.group_map[group]
+
+ # Find domain given formats, indices and mode
+ key = (formats, mode, indexed)
+ try:
+ domain = domain_map[key]
+ except KeyError:
+ # Create domain
+ if indexed:
+ domain = vertexdomain.create_indexed_domain(*formats)
+ else:
+ domain = vertexdomain.create_domain(*formats)
+ domain.__formats = formats
+ domain_map[key] = domain
+ self._draw_list_dirty = True
+
+ return domain
+
+ def _add_group(self, group):
+ self.group_map[group] = {}
+ if group.parent is None:
+ self.top_groups.append(group)
+ else:
+ if group.parent not in self.group_map:
+ self._add_group(group.parent)
+ if group.parent not in self.group_children:
+ self.group_children[group.parent] = []
+ self.group_children[group.parent].append(group)
+ self._draw_list_dirty = True
+
+ def _update_draw_list(self):
+ '''Visit group tree in preorder and create a list of bound methods
+ to call.
+ '''
+
+ def visit(group):
+ draw_list = []
+
+ # Draw domains using this group
+ domain_map = self.group_map[group]
+ for (formats, mode, indexed), domain in list(domain_map.items()):
+ # Remove unused domains from batch
+ if domain._is_empty():
+ del domain_map[(formats, mode, indexed)]
+ continue
+ draw_list.append(
+ (lambda d, m: lambda: d.draw(m))(domain, mode))
+
+ # Sort and visit child groups of this group
+ children = self.group_children.get(group)
+ if children:
+ children.sort()
+ for child in list(children):
+ draw_list.extend(visit(child))
+
+ if children or domain_map:
+ return [group.set_state] + draw_list + [group.unset_state]
+ else:
+ # Remove unused group from batch
+ del self.group_map[group]
+ if group.parent:
+ self.group_children[group.parent].remove(group)
+ try:
+ del self.group_children[group]
+ except KeyError:
+ pass
+ try:
+ self.top_groups.remove(group)
+ except ValueError:
+ pass
+ return []
+
+ self._draw_list = []
+
+ self.top_groups.sort()
+ for group in list(self.top_groups):
+ self._draw_list.extend(visit(group))
+
+ self._draw_list_dirty = False
+
+ if _debug_graphics_batch:
+ self._dump_draw_list()
+
+ def _dump_draw_list(self):
+ def dump(group, indent=''):
+ print(indent, 'Begin group', group)
+ domain_map = self.group_map[group]
+ for _, domain in domain_map.items():
+ print(indent, ' ', domain)
+ for start, size in zip(*domain.allocator.get_allocated_regions()):
+ print(indent, ' ', 'Region %d size %d:' % (start, size))
+ for key, attribute in domain.attribute_names.items():
+ print(indent, ' ', end=' ')
+ try:
+ region = attribute.get_region(attribute.buffer,
+ start, size)
+ print(key, region.array[:])
+ except:
+ print(key, '(unmappable)')
+ for child in self.group_children.get(group, ()):
+ dump(child, indent + ' ')
+ print(indent, 'End group', group)
+
+ print('Draw list for %r:' % self)
+ for group in self.top_groups:
+ dump(group)
+
+ def draw(self):
+ '''Draw the batch.
+ '''
+ if self._draw_list_dirty:
+ self._update_draw_list()
+
+ for func in self._draw_list:
+ func()
+
+ def draw_subset(self, vertex_lists):
+ '''Draw only some vertex lists in the batch.
+
+ The use of this method is highly discouraged, as it is quite
+ inefficient. Usually an application can be redesigned so that batches
+ can always be drawn in their entirety, using `draw`.
+
+ The given vertex lists must belong to this batch; behaviour is
+ undefined if this condition is not met.
+
+ :Parameters:
+ `vertex_lists` : sequence of `VertexList` or `IndexedVertexList`
+ Vertex lists to draw.
+
+ '''
+ # Horrendously inefficient.
+ def visit(group):
+ group.set_state()
+
+ # Draw domains using this group
+ domain_map = self.group_map[group]
+ for (_, mode, _), domain in domain_map.items():
+ for alist in vertex_lists:
+ if alist.domain is domain:
+ alist.draw(mode)
+
+ # Sort and visit child groups of this group
+ children = self.group_children.get(group)
+ if children:
+ children.sort()
+ for child in children:
+ visit(child)
+
+ group.unset_state()
+
+ self.top_groups.sort()
+ for group in self.top_groups:
+ visit(group)
+
+class Group(object):
+ '''Group of common OpenGL state.
+
+ Before a vertex list is rendered, its group's OpenGL state is set; as are
+ that state's ancestors' states. This can be defined arbitrarily on
+ subclasses; the default state change has no effect, and groups vertex
+ lists only in the order in which they are drawn.
+ '''
+ def __init__(self, parent=None):
+ '''Create a group.
+
+ :Parameters:
+ `parent` : `~pyglet.graphics.Group`
+ Group to contain this group; its state will be set before this
+ state's.
+
+ '''
+ self.parent = parent
+
+ def __lt__(self, other):
+ return hash(self) < hash(other)
+
+ def set_state(self):
+ '''Apply the OpenGL state change.
+
+ The default implementation does nothing.'''
+ pass
+
+ def unset_state(self):
+ '''Repeal the OpenGL state change.
+
+ The default implementation does nothing.'''
+ pass
+
+ def set_state_recursive(self):
+ '''Set this group and its ancestry.
+
+ Call this method if you are using a group in isolation: the
+ parent groups will be called in top-down order, with this class's
+ `set` being called last.
+ '''
+ if self.parent:
+ self.parent.set_state_recursive()
+ self.set_state()
+
+ def unset_state_recursive(self):
+ '''Unset this group and its ancestry.
+
+ The inverse of `set_state_recursive`.
+ '''
+ self.unset_state()
+ if self.parent:
+ self.parent.unset_state_recursive()
+
+class NullGroup(Group):
+ '''The default group class used when ``None`` is given to a batch.
+
+ This implementation has no effect.
+ '''
+ pass
+
+#: The default group.
+#:
+#: :type: :py:class:`~pyglet.graphics.Group`
+null_group = NullGroup()
+
+class TextureGroup(Group):
+ '''A group that enables and binds a texture.
+
+ Texture groups are equal if their textures' targets and names are equal.
+ '''
+ # Don't use this, create your own group classes that are more specific.
+ # This is just an example.
+ def __init__(self, texture, parent=None):
+ '''Create a texture group.
+
+ :Parameters:
+ `texture` : `~pyglet.image.Texture`
+ Texture to bind.
+ `parent` : `~pyglet.graphics.Group`
+ Parent group.
+
+ '''
+ super(TextureGroup, self).__init__(parent)
+ self.texture = texture
+
+ def set_state(self):
+ glEnable(self.texture.target)
+ glBindTexture(self.texture.target, self.texture.id)
+
+ def unset_state(self):
+ glDisable(self.texture.target)
+
+ def __hash__(self):
+ return hash((self.texture.target, self.texture.id, self.parent))
+
+ def __eq__(self, other):
+ return (self.__class__ is other.__class__ and
+ self.texture.target == other.texture.target and
+ self.texture.id == other.texture.id and
+ self.parent == other.parent)
+
+ def __repr__(self):
+ return '%s(id=%d)' % (self.__class__.__name__, self.texture.id)
+
+class OrderedGroup(Group):
+ '''A group with partial order.
+
+ Ordered groups with a common parent are rendered in ascending order of
+ their ``order`` field. This is a useful way to render multiple layers of
+ a scene within a single batch.
+ '''
+ # This can be useful as a top-level group, or as a superclass for other
+ # groups that need to be ordered.
+ #
+ # As a top-level group it's useful because graphics can be composited in a
+ # known order even if they don't know about each other or share any known
+ # group.
+ def __init__(self, order, parent=None):
+ '''Create an ordered group.
+
+ :Parameters:
+ `order` : int
+ Order of this group.
+ `parent` : `~pyglet.graphics.Group`
+ Parent of this group.
+
+ '''
+ super(OrderedGroup, self).__init__(parent)
+ self.order = order
+
+ def __lt__(self, other):
+ if isinstance(other, OrderedGroup):
+ return self.order < other.order
+ return super(OrderedGroup, self).__lt__(other)
+
+ def __eq__(self, other):
+ return (self.__class__ is other.__class__ and
+ self.order == other.order and
+ self.parent == other.parent)
+
+ def __hash__(self):
+ return hash((self.order, self.parent))
+
+ def __repr__(self):
+ return '%s(%d)' % (self.__class__.__name__, self.order)
\ No newline at end of file
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/graphics/allocation.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/graphics/allocation.py
new file mode 100644
index 0000000..4216be6
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/graphics/allocation.py
@@ -0,0 +1,409 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+# $Id:$
+
+'''Memory allocation algorithm for vertex arrays and buffers.
+
+The region allocator is used to allocate vertex indices within a vertex
+domain's multiple buffers. ("Buffer" refers to any abstract buffer presented
+by :py:mod:`pyglet.graphics.vertexbuffer`.
+
+The allocator will at times request more space from the buffers. The current
+policy is to double the buffer size when there is not enough room to fulfil an
+allocation. The buffer is never resized smaller.
+
+The allocator maintains references to free space only; it is the caller's
+responsibility to maintain the allocated regions.
+'''
+from __future__ import print_function
+from __future__ import division
+from builtins import str
+from builtins import zip
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+# Common cases:
+# -regions will be the same size (instances of same object, e.g. sprites)
+# -regions will not usually be resized (only exception is text)
+# -alignment of 4 vertices (glyphs, sprites, images, ...)
+#
+# Optimise for:
+# -keeping regions adjacent, reduce the number of entries in glMultiDrawArrays
+# -finding large blocks of allocated regions quickly (for drawing)
+# -finding block of unallocated space is the _uncommon_ case!
+#
+# Decisions:
+# -don't over-allocate regions to any alignment -- this would require more
+# work in finding the allocated spaces (for drawing) and would result in
+# more entries in glMultiDrawArrays
+# -don't move blocks when they truncate themselves. try not to allocate the
+# space they freed too soon (they will likely need grow back into it later,
+# and growing will usually require a reallocation).
+# -allocator does not track individual allocated regions. Trusts caller
+# to provide accurate (start, size) tuple, which completely describes
+# a region from the allocator's point of view.
+# -this means that compacting is probably not feasible, or would be hideously
+# expensive
+
+class AllocatorMemoryException(Exception):
+ '''The buffer is not large enough to fulfil an allocation.
+
+ Raised by `Allocator` methods when the operation failed due to lack of
+ buffer space. The buffer should be increased to at least
+ requested_capacity and then the operation retried (guaranteed to
+ pass second time).
+ '''
+
+ def __init__(self, requested_capacity):
+ self.requested_capacity = requested_capacity
+
+class Allocator(object):
+ '''Buffer space allocation implementation.'''
+ def __init__(self, capacity):
+ '''Create an allocator for a buffer of the specified capacity.
+
+ :Parameters:
+ `capacity` : int
+ Maximum size of the buffer.
+
+ '''
+ self.capacity = capacity
+
+ # Allocated blocks. Start index and size in parallel lists.
+ #
+ # # = allocated, - = free
+ #
+ # 0 3 5 15 20 24 40
+ # |###--##########-----####----------------------|
+ #
+ # starts = [0, 5, 20]
+ # sizes = [3, 10, 4]
+ #
+ # To calculate free blocks:
+ # for i in range(0, len(starts)):
+ # free_start[i] = starts[i] + sizes[i]
+ # free_size[i] = starts[i+1] - free_start[i]
+ # free_size[i+1] = self.capacity - free_start[-1]
+
+ self.starts = []
+ self.sizes = []
+
+ def set_capacity(self, size):
+ '''Resize the maximum buffer size.
+
+ The capaity cannot be reduced.
+
+ :Parameters:
+ `size` : int
+ New maximum size of the buffer.
+
+ '''
+ assert size > self.capacity
+ self.capacity = size
+
+ def alloc(self, size):
+ '''Allocate memory in the buffer.
+
+ Raises `AllocatorMemoryException` if the allocation cannot be
+ fulfilled.
+
+ :Parameters:
+ `size` : int
+ Size of region to allocate.
+
+ :rtype: int
+ :return: Starting index of the allocated region.
+ '''
+ assert size >= 0
+
+ if size == 0:
+ return 0
+
+ # return start
+ # or raise AllocatorMemoryException
+
+ if not self.starts:
+ if size <= self.capacity:
+ self.starts.append(0)
+ self.sizes.append(size)
+ return 0
+ else:
+ raise AllocatorMemoryException(size)
+
+ # Allocate in a free space
+ free_start = self.starts[0] + self.sizes[0]
+ for i, (alloc_start, alloc_size) in \
+ enumerate(zip(self.starts[1:], self.sizes[1:])):
+ # Danger!
+ # i is actually index - 1 because of slicing above...
+ # starts[i] points to the block before this free space
+ # starts[i+1] points to the block after this free space, and is
+ # always valid.
+ free_size = alloc_start - free_start
+ if free_size == size:
+ # Merge previous block with this one (removing this free space)
+ self.sizes[i] += free_size + alloc_size
+ del self.starts[i+1]
+ del self.sizes[i+1]
+ return free_start
+ elif free_size > size:
+ # Increase size of previous block to intrude into this free
+ # space.
+ self.sizes[i] += size
+ return free_start
+ free_start = alloc_start + alloc_size
+
+ # Allocate at end of capacity
+ free_size = self.capacity - free_start
+ if free_size >= size:
+ self.sizes[-1] += size
+ return free_start
+
+ raise AllocatorMemoryException(self.capacity + size - free_size)
+
+ def realloc(self, start, size, new_size):
+ '''Reallocate a region of the buffer.
+
+ This is more efficient than separate `dealloc` and `alloc` calls, as
+ the region can often be resized in-place.
+
+ Raises `AllocatorMemoryException` if the allocation cannot be
+ fulfilled.
+
+ :Parameters:
+ `start` : int
+ Current starting index of the region.
+ `size` : int
+ Current size of the region.
+ `new_size` : int
+ New size of the region.
+
+ '''
+ assert size >= 0 and new_size >= 0
+
+ if new_size == 0:
+ if size != 0:
+ self.dealloc(start, size)
+ return 0
+ elif size == 0:
+ return self.alloc(new_size)
+
+ # return start
+ # or raise AllocatorMemoryException
+
+ # Truncation is the same as deallocating the tail cruft
+ if new_size < size:
+ self.dealloc(start + new_size, size - new_size)
+ return start
+
+ # Find which block it lives in
+ for i, (alloc_start, alloc_size) in \
+ enumerate(zip(*(self.starts, self.sizes))):
+ p = start - alloc_start
+ if p >= 0 and size <= alloc_size - p:
+ break
+ if not (p >= 0 and size <= alloc_size - p):
+ print(list(zip(self.starts, self.sizes)))
+ print(start, size, new_size)
+ print(p, alloc_start, alloc_size)
+ assert p >= 0 and size <= alloc_size - p, 'Region not allocated'
+
+ if size == alloc_size - p:
+ # Region is at end of block. Find how much free space is after
+ # it.
+ is_final_block = i == len(self.starts) - 1
+ if not is_final_block:
+ free_size = self.starts[i + 1] - (start + size)
+ else:
+ free_size = self.capacity - (start + size)
+
+ # TODO If region is an entire block being an island in free space,
+ # can possibly extend in both directions.
+
+ if free_size == new_size - size and not is_final_block:
+ # Merge block with next (region is expanded in place to
+ # exactly fill the free space)
+ self.sizes[i] += free_size + self.sizes[i + 1]
+ del self.starts[i + 1]
+ del self.sizes[i + 1]
+ return start
+ elif free_size > new_size - size:
+ # Expand region in place
+ self.sizes[i] += new_size - size
+ return start
+
+ # The block must be repositioned. Dealloc then alloc.
+
+ # But don't do this! If alloc fails, we've already silently dealloc'd
+ # the original block.
+ # self.dealloc(start, size)
+ # return self.alloc(new_size)
+
+ # It must be alloc'd first. We're not missing an optimisation
+ # here, because if freeing the block would've allowed for the block to
+ # be placed in the resulting free space, one of the above in-place
+ # checks would've found it.
+ result = self.alloc(new_size)
+ self.dealloc(start, size)
+ return result
+
+ def dealloc(self, start, size):
+ '''Free a region of the buffer.
+
+ :Parameters:
+ `start` : int
+ Starting index of the region.
+ `size` : int
+ Size of the region.
+
+ '''
+ assert size >= 0
+
+ if size == 0:
+ return
+
+ assert self.starts
+
+ # Find which block needs to be split
+ for i, (alloc_start, alloc_size) in \
+ enumerate(zip(*(self.starts, self.sizes))):
+ p = start - alloc_start
+ if p >= 0 and size <= alloc_size - p:
+ break
+
+ # Assert we left via the break
+ assert p >= 0 and size <= alloc_size - p, 'Region not allocated'
+
+ if p == 0 and size == alloc_size:
+ # Remove entire block
+ del self.starts[i]
+ del self.sizes[i]
+ elif p == 0:
+ # Truncate beginning of block
+ self.starts[i] += size
+ self.sizes[i] -= size
+ elif size == alloc_size - p:
+ # Truncate end of block
+ self.sizes[i] -= size
+ else:
+ # Reduce size of left side, insert block at right side
+ # $ = dealloc'd block, # = alloc'd region from same block
+ #
+ # <------8------>
+ # <-5-><-6-><-7->
+ # 1 2 3 4
+ # #####$$$$$#####
+ #
+ # 1 = alloc_start
+ # 2 = start
+ # 3 = start + size
+ # 4 = alloc_start + alloc_size
+ # 5 = start - alloc_start = p
+ # 6 = size
+ # 7 = {8} - ({5} + {6}) = alloc_size - (p + size)
+ # 8 = alloc_size
+ #
+ self.sizes[i] = p
+ self.starts.insert(i + 1, start + size)
+ self.sizes.insert(i + 1, alloc_size - (p + size))
+
+ def get_allocated_regions(self):
+ '''Get a list of (aggregate) allocated regions.
+
+ The result of this method is ``(starts, sizes)``, where ``starts`` is
+ a list of starting indices of the regions and ``sizes`` their
+ corresponding lengths.
+
+ :rtype: (list, list)
+ '''
+ # return (starts, sizes); len(starts) == len(sizes)
+ return (self.starts, self.sizes)
+
+ def get_fragmented_free_size(self):
+ '''Returns the amount of space unused, not including the final
+ free block.
+
+ :rtype: int
+ '''
+ if not self.starts:
+ return 0
+
+ # Variation of search for free block.
+ total_free = 0
+ free_start = self.starts[0] + self.sizes[0]
+ for i, (alloc_start, alloc_size) in \
+ enumerate(zip(self.starts[1:], self.sizes[1:])):
+ total_free += alloc_start - free_start
+ free_start = alloc_start + alloc_size
+
+ return total_free
+
+ def get_free_size(self):
+ '''Return the amount of space unused.
+
+ :rtype: int
+ '''
+ if not self.starts:
+ return self.capacity
+
+ free_end = self.capacity - (self.starts[-1] + self.sizes[-1])
+ return self.get_fragmented_free_size() + free_end
+
+ def get_usage(self):
+ '''Return fraction of capacity currently allocated.
+
+ :rtype: float
+ '''
+ return 1. - self.get_free_size() / float(self.capacity)
+
+ def get_fragmentation(self):
+ '''Return fraction of free space that is not expandable.
+
+ :rtype: float
+ '''
+ free_size = self.get_free_size()
+ if free_size == 0:
+ return 0.
+ return self.get_fragmented_free_size() / float(self.get_free_size())
+
+ def _is_empty(self):
+ return not self.starts
+
+ def __str__(self):
+ return 'allocs=' + repr(list(zip(self.starts, self.sizes)))
+
+ def __repr__(self):
+ return '<%s %s>' % (self.__class__.__name__, str(self))
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/graphics/vertexattribute.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/graphics/vertexattribute.py
new file mode 100644
index 0000000..afdd9a8
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/graphics/vertexattribute.py
@@ -0,0 +1,539 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+# $Id:$
+
+'''Access byte arrays as arrays of vertex attributes.
+
+Use :py:func:`create_attribute` to create an attribute accessor given a
+simple format string. Alternatively, the classes may be constructed directly.
+
+Attribute format strings
+========================
+
+An attribute format string specifies the format of a vertex attribute. Format
+strings are accepted by the :py:func:`create_attribute` function as well as most
+methods in the :py:mod:`pyglet.graphics` module.
+
+Format strings have the following (BNF) syntax::
+
+ attribute ::= ( name | index 'g' 'n'? | texture 't' ) count type
+
+``name`` describes the vertex attribute, and is one of the following
+constants for the predefined attributes:
+
+``c``
+ Vertex color
+``e``
+ Edge flag
+``f``
+ Fog coordinate
+``n``
+ Normal vector
+``s``
+ Secondary color
+``t``
+ Texture coordinate
+``v``
+ Vertex coordinate
+
+You can alternatively create a generic indexed vertex attribute by
+specifying its index in decimal followed by the constant ``g``. For
+example, ``0g`` specifies the generic vertex attribute with index 0.
+If the optional constant ``n`` is present after the ``g``, the
+attribute is normalised to the range ``[0, 1]`` or ``[-1, 1]`` within
+the range of the data type.
+
+Texture coordinates for multiple texture units can be specified with the
+texture number before the constant 't'. For example, ``1t`` gives the
+texture coordinate attribute for texture unit 1.
+
+``count`` gives the number of data components in the attribute. For
+example, a 3D vertex position has a count of 3. Some attributes
+constrain the possible counts that can be used; for example, a normal
+vector must have a count of 3.
+
+``type`` gives the data type of each component of the attribute. The
+following types can be used:
+
+``b``
+ ``GLbyte``
+``B``
+ ``GLubyte``
+``s``
+ ``GLshort``
+``S``
+ ``GLushort``
+``i``
+ ``GLint``
+``I``
+ ``GLuint``
+``f``
+ ``GLfloat``
+``d``
+ ``GLdouble``
+
+Some attributes constrain the possible data types; for example,
+normal vectors must use one of the signed data types. The use of
+some data types, while not illegal, may have severe performance
+concerns. For example, the use of ``GLdouble`` is discouraged,
+and colours should be specified with ``GLubyte``.
+
+Whitespace is prohibited within the format string.
+
+Some examples follow:
+
+``v3f``
+ 3-float vertex position
+``c4b``
+ 4-byte colour
+``1eb``
+ Edge flag
+``0g3f``
+ 3-float generic vertex attribute 0
+``1gn1i``
+ Integer generic vertex attribute 1, normalized to [-1, 1]
+``2gn4B``
+ 4-byte generic vertex attribute 2, normalized to [0, 1] (because
+ the type is unsigned)
+``3t2f``
+ 2-float texture coordinate for texture unit 3.
+
+'''
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import ctypes
+import re
+
+from pyglet.gl import *
+from pyglet.graphics import vertexbuffer
+
+_c_types = {
+ GL_BYTE: ctypes.c_byte,
+ GL_UNSIGNED_BYTE: ctypes.c_ubyte,
+ GL_SHORT: ctypes.c_short,
+ GL_UNSIGNED_SHORT: ctypes.c_ushort,
+ GL_INT: ctypes.c_int,
+ GL_UNSIGNED_INT: ctypes.c_uint,
+ GL_FLOAT: ctypes.c_float,
+ GL_DOUBLE: ctypes.c_double,
+}
+
+_gl_types = {
+ 'b': GL_BYTE,
+ 'B': GL_UNSIGNED_BYTE,
+ 's': GL_SHORT,
+ 'S': GL_UNSIGNED_SHORT,
+ 'i': GL_INT,
+ 'I': GL_UNSIGNED_INT,
+ 'f': GL_FLOAT,
+ 'd': GL_DOUBLE,
+}
+
+_attribute_format_re = re.compile(r'''
+ (?P
+ [cefnstv] |
+ (?P[0-9]+) g (?Pn?) |
+ (?P[0-9]+) t)
+ (?P[1234])
+ (?P[bBsSiIfd])
+''', re.VERBOSE)
+
+_attribute_cache = {}
+
+def _align(v, align):
+ return ((v - 1) & ~(align - 1)) + align
+
+def interleave_attributes(attributes):
+ '''Interleave attribute offsets.
+
+ Adjusts the offsets and strides of the given attributes so that
+ they are interleaved. Alignment constraints are respected.
+
+ :Parameters:
+ `attributes` : sequence of `AbstractAttribute`
+ Attributes to interleave in-place.
+
+ '''
+ stride = 0
+ max_size = 0
+ for attribute in attributes:
+ stride = _align(stride, attribute.align)
+ attribute.offset = stride
+ stride += attribute.size
+ max_size = max(max_size, attribute.size)
+ stride = _align(stride, max_size)
+ for attribute in attributes:
+ attribute.stride = stride
+
+def serialize_attributes(count, attributes):
+ '''Serialize attribute offsets.
+
+ Adjust the offsets of the given attributes so that they are
+ packed serially against each other for `count` vertices.
+
+ :Parameters:
+ `count` : int
+ Number of vertices.
+ `attributes` : sequence of `AbstractAttribute`
+ Attributes to serialize in-place.
+
+ '''
+ offset = 0
+ for attribute in attributes:
+ offset = _align(offset, attribute.align)
+ attribute.offset = offset
+ offset += count * attribute.stride
+
+def create_attribute(format):
+ '''Create a vertex attribute description from a format string.
+
+ The initial stride and offset of the attribute will be 0.
+
+ :Parameters:
+ `format` : str
+ Attribute format string. See the module summary for details.
+
+ :rtype: `AbstractAttribute`
+ '''
+ try:
+ cls, args = _attribute_cache[format]
+ return cls(*args)
+ except KeyError:
+ pass
+
+ match = _attribute_format_re.match(format)
+ assert match, 'Invalid attribute format %r' % format
+ count = int(match.group('count'))
+ gl_type = _gl_types[match.group('type')]
+ generic_index = match.group('generic_index')
+ texcoord_texture = match.group('texcoord_texture')
+ if generic_index:
+ normalized = match.group('generic_normalized')
+ attr_class = GenericAttribute
+ args = int(generic_index), normalized, count, gl_type
+ elif texcoord_texture:
+ attr_class = MultiTexCoordAttribute
+ args = int(texcoord_texture), count, gl_type
+ else:
+ name = match.group('name')
+ attr_class = _attribute_classes[name]
+ if attr_class._fixed_count:
+ assert count == attr_class._fixed_count, \
+ 'Attributes named "%s" must have count of %d' % (
+ name, attr_class._fixed_count)
+ args = (gl_type,)
+ else:
+ args = (count, gl_type)
+
+ _attribute_cache[format] = attr_class, args
+ return attr_class(*args)
+
+class AbstractAttribute(object):
+ '''Abstract accessor for an attribute in a mapped buffer.
+ '''
+
+ _fixed_count = None
+
+ def __init__(self, count, gl_type):
+ '''Create the attribute accessor.
+
+ :Parameters:
+ `count` : int
+ Number of components in the attribute.
+ `gl_type` : int
+ OpenGL type enumerant; for example, ``GL_FLOAT``
+
+ '''
+ assert count in (1, 2, 3, 4), 'Component count out of range'
+ self.gl_type = gl_type
+ self.c_type = _c_types[gl_type]
+ self.count = count
+ self.align = ctypes.sizeof(self.c_type)
+ self.size = count * self.align
+ self.stride = self.size
+ self.offset = 0
+
+ def enable(self):
+ '''Enable the attribute using ``glEnableClientState``.'''
+ raise NotImplementedError('abstract')
+
+ def set_pointer(self, offset):
+ '''Setup this attribute to point to the currently bound buffer at
+ the given offset.
+
+ ``offset`` should be based on the currently bound buffer's ``ptr``
+ member.
+
+ :Parameters:
+ `offset` : int
+ Pointer offset to the currently bound buffer for this
+ attribute.
+
+ '''
+ raise NotImplementedError('abstract')
+
+ def get_region(self, buffer, start, count):
+ '''Map a buffer region using this attribute as an accessor.
+
+ The returned region can be modified as if the buffer was a contiguous
+ array of this attribute (though it may actually be interleaved or
+ otherwise non-contiguous).
+
+ The returned region consists of a contiguous array of component
+ data elements. For example, if this attribute uses 3 floats per
+ vertex, and the `count` parameter is 4, the number of floats mapped
+ will be ``3 * 4 = 12``.
+
+ :Parameters:
+ `buffer` : `AbstractMappable`
+ The buffer to map.
+ `start` : int
+ Offset of the first vertex to map.
+ `count` : int
+ Number of vertices to map
+
+ :rtype: `AbstractBufferRegion`
+ '''
+ byte_start = self.stride * start
+ byte_size = self.stride * count
+ array_count = self.count * count
+ if self.stride == self.size or not array_count:
+ # non-interleaved
+ ptr_type = ctypes.POINTER(self.c_type * array_count)
+ return buffer.get_region(byte_start, byte_size, ptr_type)
+ else:
+ # interleaved
+ byte_start += self.offset
+ byte_size -= self.offset
+ elem_stride = self.stride // ctypes.sizeof(self.c_type)
+ elem_offset = self.offset // ctypes.sizeof(self.c_type)
+ ptr_type = ctypes.POINTER(
+ self.c_type * (count * elem_stride - elem_offset))
+ region = buffer.get_region(byte_start, byte_size, ptr_type)
+ return vertexbuffer.IndirectArrayRegion(
+ region, array_count, self.count, elem_stride)
+
+ def set_region(self, buffer, start, count, data):
+ '''Set the data over a region of the buffer.
+
+ :Parameters:
+ `buffer` : AbstractMappable`
+ The buffer to modify.
+ `start` : int
+ Offset of the first vertex to set.
+ `count` : int
+ Number of vertices to set.
+ `data` : sequence
+ Sequence of data components.
+
+ '''
+ if self.stride == self.size:
+ # non-interleaved
+ byte_start = self.stride * start
+ byte_size = self.stride * count
+ array_count = self.count * count
+ data = (self.c_type * array_count)(*data)
+ buffer.set_data_region(data, byte_start, byte_size)
+ else:
+ # interleaved
+ region = self.get_region(buffer, start, count)
+ region[:] = data
+
+class ColorAttribute(AbstractAttribute):
+ '''Color vertex attribute.'''
+
+ plural = 'colors'
+
+ def __init__(self, count, gl_type):
+ assert count in (3, 4), 'Color attributes must have count of 3 or 4'
+ super(ColorAttribute, self).__init__(count, gl_type)
+
+ def enable(self):
+ glEnableClientState(GL_COLOR_ARRAY)
+
+ def set_pointer(self, pointer):
+ glColorPointer(self.count, self.gl_type, self.stride,
+ self.offset + pointer)
+
+class EdgeFlagAttribute(AbstractAttribute):
+ '''Edge flag attribute.'''
+
+ plural = 'edge_flags'
+ _fixed_count = 1
+
+ def __init__(self, gl_type):
+ assert gl_type in (GL_BYTE, GL_UNSIGNED_BYTE, GL_BOOL), \
+ 'Edge flag attribute must have boolean type'
+ super(EdgeFlagAttribute, self).__init__(1, gl_type)
+
+ def enable(self):
+ glEnableClientState(GL_EDGE_FLAG_ARRAY)
+
+ def set_pointer(self, pointer):
+ glEdgeFlagPointer(self.stride, self.offset + pointer)
+
+class FogCoordAttribute(AbstractAttribute):
+ '''Fog coordinate attribute.'''
+
+ plural = 'fog_coords'
+
+ def __init__(self, count, gl_type):
+ super(FogCoordAttribute, self).__init__(count, gl_type)
+
+ def enable(self):
+ glEnableClientState(GL_FOG_COORD_ARRAY)
+
+ def set_pointer(self, pointer):
+ glFogCoordPointer(self.count, self.gl_type, self.stride,
+ self.offset + pointer)
+
+class NormalAttribute(AbstractAttribute):
+ '''Normal vector attribute.'''
+
+ plural = 'normals'
+ _fixed_count = 3
+
+ def __init__(self, gl_type):
+ assert gl_type in (GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT, GL_DOUBLE), \
+ 'Normal attribute must have signed type'
+ super(NormalAttribute, self).__init__(3, gl_type)
+
+ def enable(self):
+ glEnableClientState(GL_NORMAL_ARRAY)
+
+ def set_pointer(self, pointer):
+ glNormalPointer(self.gl_type, self.stride, self.offset + pointer)
+
+class SecondaryColorAttribute(AbstractAttribute):
+ '''Secondary color attribute.'''
+
+ plural = 'secondary_colors'
+ _fixed_count = 3
+
+ def __init__(self, gl_type):
+ super(SecondaryColorAttribute, self).__init__(3, gl_type)
+
+ def enable(self):
+ glEnableClientState(GL_SECONDARY_COLOR_ARRAY)
+
+ def set_pointer(self, pointer):
+ glSecondaryColorPointer(3, self.gl_type, self.stride,
+ self.offset + pointer)
+
+class TexCoordAttribute(AbstractAttribute):
+ '''Texture coordinate attribute.'''
+
+ plural = 'tex_coords'
+
+ def __init__(self, count, gl_type):
+ assert gl_type in (GL_SHORT, GL_INT, GL_INT, GL_FLOAT, GL_DOUBLE), \
+ 'Texture coord attribute must have non-byte signed type'
+ super(TexCoordAttribute, self).__init__(count, gl_type)
+
+ def enable(self):
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY)
+
+ def set_pointer(self, pointer):
+ glTexCoordPointer(self.count, self.gl_type, self.stride,
+ self.offset + pointer)
+
+ def convert_to_multi_tex_coord_attribute(self):
+ '''Changes the class of the attribute to `MultiTexCoordAttribute`.
+ '''
+ self.__class__ = MultiTexCoordAttribute
+ self.texture = 0
+
+class MultiTexCoordAttribute(AbstractAttribute):
+ '''Texture coordinate attribute.'''
+
+ def __init__(self, texture, count, gl_type):
+ assert gl_type in (GL_SHORT, GL_INT, GL_INT, GL_FLOAT, GL_DOUBLE), \
+ 'Texture coord attribute must have non-byte signed type'
+ self.texture = texture
+ super(MultiTexCoordAttribute, self).__init__(count, gl_type)
+
+ def enable(self):
+ glClientActiveTexture(GL_TEXTURE0 + self.texture)
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY)
+
+ def set_pointer(self, pointer):
+ glTexCoordPointer(self.count, self.gl_type, self.stride,
+ self.offset + pointer)
+
+class VertexAttribute(AbstractAttribute):
+ '''Vertex coordinate attribute.'''
+
+ plural = 'vertices'
+
+ def __init__(self, count, gl_type):
+ assert count > 1, \
+ 'Vertex attribute must have count of 2, 3 or 4'
+ assert gl_type in (GL_SHORT, GL_INT, GL_INT, GL_FLOAT, GL_DOUBLE), \
+ 'Vertex attribute must have signed type larger than byte'
+ super(VertexAttribute, self).__init__(count, gl_type)
+
+ def enable(self):
+ glEnableClientState(GL_VERTEX_ARRAY)
+
+ def set_pointer(self, pointer):
+ glVertexPointer(self.count, self.gl_type, self.stride,
+ self.offset + pointer)
+
+class GenericAttribute(AbstractAttribute):
+ '''Generic vertex attribute, used by shader programs.'''
+
+ def __init__(self, index, normalized, count, gl_type):
+ self.normalized = bool(normalized)
+ self.index = index
+ super(GenericAttribute, self).__init__(count, gl_type)
+
+ def enable(self):
+ glEnableVertexAttribArray(self.index)
+
+ def set_pointer(self, pointer):
+ glVertexAttribPointer(self.index, self.count, self.gl_type,
+ self.normalized, self.stride,
+ self.offset + pointer)
+_attribute_classes = {
+ 'c': ColorAttribute,
+ 'e': EdgeFlagAttribute,
+ 'f': FogCoordAttribute,
+ 'n': NormalAttribute,
+ 's': SecondaryColorAttribute,
+ 't': TexCoordAttribute,
+ 'v': VertexAttribute,
+}
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/graphics/vertexbuffer.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/graphics/vertexbuffer.py
new file mode 100644
index 0000000..a2e5ff0
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/graphics/vertexbuffer.py
@@ -0,0 +1,604 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+# $Id:$
+
+'''Byte abstractions of Vertex Buffer Objects and vertex arrays.
+
+Use :py:func:`create_buffer` or :py:func:`create_mappable_buffer` to create a
+Vertex Buffer Object, or a vertex array if VBOs are not supported by the
+current context.
+
+Buffers can optionally be created "mappable" (incorporating the
+:py:class:`AbstractMappable` mix-in). In this case the buffer provides a
+:py:meth:`~AbstractMappable.get_region` method which provides the most
+efficient path for updating partial data within the buffer.
+'''
+from builtins import range
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import ctypes
+import sys
+
+import pyglet
+from pyglet.gl import *
+
+_enable_vbo = pyglet.options['graphics_vbo']
+
+# Enable workaround permanently if any VBO is created on a context that has
+# this workaround. (On systems with multiple contexts where one is
+# unaffected, the workaround will be enabled unconditionally on all of the
+# contexts anyway. This is completely unlikely anyway).
+_workaround_vbo_finish = False
+
+def create_buffer(size,
+ target=GL_ARRAY_BUFFER,
+ usage=GL_DYNAMIC_DRAW,
+ vbo=True):
+ '''Create a buffer of vertex data.
+
+ :Parameters:
+ `size` : int
+ Size of the buffer, in bytes
+ `target` : int
+ OpenGL target buffer
+ `usage` : int
+ OpenGL usage constant
+ `vbo` : bool
+ True if a `VertexBufferObject` should be created if the driver
+ supports it; otherwise only a `VertexArray` is created.
+
+ :rtype: `AbstractBuffer`
+ '''
+ from pyglet import gl
+ if (vbo and
+ gl_info.have_version(1, 5) and
+ _enable_vbo and
+ not gl.current_context._workaround_vbo):
+ return VertexBufferObject(size, target, usage)
+ else:
+ return VertexArray(size)
+
+def create_mappable_buffer(size,
+ target=GL_ARRAY_BUFFER,
+ usage=GL_DYNAMIC_DRAW,
+ vbo=True):
+ '''Create a mappable buffer of vertex data.
+
+ :Parameters:
+ `size` : int
+ Size of the buffer, in bytes
+ `target` : int
+ OpenGL target buffer
+ `usage` : int
+ OpenGL usage constant
+ `vbo` : bool
+ True if a :py:class:`VertexBufferObject` should be created if the driver
+ supports it; otherwise only a :py:class:`VertexArray` is created.
+
+ :rtype: :py:class:`AbstractBuffer` with :py:class:`AbstractMappable`
+ '''
+ from pyglet import gl
+ if (vbo and
+ gl_info.have_version(1, 5) and
+ _enable_vbo and
+ not gl.current_context._workaround_vbo):
+ return MappableVertexBufferObject(size, target, usage)
+ else:
+ return VertexArray(size)
+
+class AbstractBuffer(object):
+ '''Abstract buffer of byte data.
+
+ :Ivariables:
+ `size` : int
+ Size of buffer, in bytes
+ `ptr` : int
+ Memory offset of the buffer, as used by the ``glVertexPointer``
+ family of functions
+ `target` : int
+ OpenGL buffer target, for example ``GL_ARRAY_BUFFER``
+ `usage` : int
+ OpenGL buffer usage, for example ``GL_DYNAMIC_DRAW``
+
+ '''
+
+ ptr = 0
+ size = 0
+
+ def bind(self):
+ '''Bind this buffer to its OpenGL target.'''
+ raise NotImplementedError('abstract')
+
+ def unbind(self):
+ '''Reset the buffer's OpenGL target.'''
+ raise NotImplementedError('abstract')
+
+ def set_data(self, data):
+ '''Set the entire contents of the buffer.
+
+ :Parameters:
+ `data` : sequence of int or ctypes pointer
+ The byte array to set.
+
+ '''
+ raise NotImplementedError('abstract')
+
+ def set_data_region(self, data, start, length):
+ '''Set part of the buffer contents.
+
+ :Parameters:
+ `data` : sequence of int or ctypes pointer
+ The byte array of data to set
+ `start` : int
+ Offset to start replacing data
+ `length` : int
+ Length of region to replace
+
+ '''
+ raise NotImplementedError('abstract')
+
+ def map(self, invalidate=False):
+ '''Map the entire buffer into system memory.
+
+ The mapped region must be subsequently unmapped with `unmap` before
+ performing any other operations on the buffer.
+
+ :Parameters:
+ `invalidate` : bool
+ If True, the initial contents of the mapped block need not
+ reflect the actual contents of the buffer.
+
+ :rtype: ``POINTER(ctypes.c_ubyte)``
+ :return: Pointer to the mapped block in memory
+ '''
+ raise NotImplementedError('abstract')
+
+ def unmap(self):
+ '''Unmap a previously mapped memory block.'''
+ raise NotImplementedError('abstract')
+
+ def resize(self, size):
+ '''Resize the buffer to a new size.
+
+ :Parameters:
+ `size` : int
+ New size of the buffer, in bytes
+
+ '''
+
+ def delete(self):
+ '''Delete this buffer, reducing system resource usage.'''
+ raise NotImplementedError('abstract')
+
+class AbstractMappable(object):
+ def get_region(self, start, size, ptr_type):
+ '''Map a region of the buffer into a ctypes array of the desired
+ type. This region does not need to be unmapped, but will become
+ invalid if the buffer is resized.
+
+ Note that although a pointer type is required, an array is mapped.
+ For example::
+
+ get_region(0, ctypes.sizeof(c_int) * 20, ctypes.POINTER(c_int * 20))
+
+ will map bytes 0 to 80 of the buffer to an array of 20 ints.
+
+ Changes to the array may not be recognised until the region's
+ :py:meth:`AbstractBufferRegion.invalidate` method is called.
+
+ :Parameters:
+ `start` : int
+ Offset into the buffer to map from, in bytes
+ `size` : int
+ Size of the buffer region to map, in bytes
+ `ptr_type` : ctypes pointer type
+ Pointer type describing the array format to create
+
+ :rtype: :py:class:`AbstractBufferRegion`
+ '''
+ raise NotImplementedError('abstract')
+
+class VertexArray(AbstractBuffer, AbstractMappable):
+ '''A ctypes implementation of a vertex array.
+
+ Many of the methods on this class are effectively no-op's, such as
+ :py:meth:`bind`, :py:meth:`unbind`, :py:meth:`map`, :py:meth:`unmap` and
+ :py:meth:`delete`; they exist in order to present
+ a consistent interface with :py:class:`VertexBufferObject`.
+
+ This buffer type is also mappable, and so :py:meth:`get_region` can be used.
+ '''
+
+ def __init__(self, size):
+ self.size = size
+
+ self.array = (ctypes.c_byte * size)()
+ self.ptr = ctypes.cast(self.array, ctypes.c_void_p).value
+
+ def bind(self):
+ pass
+
+ def unbind(self):
+ pass
+
+ def set_data(self, data):
+ ctypes.memmove(self.ptr, data, self.size)
+
+ def set_data_region(self, data, start, length):
+ ctypes.memmove(self.ptr + start, data, length)
+
+ def map(self, invalidate=False):
+ return self.array
+
+ def unmap(self):
+ pass
+
+ def get_region(self, start, size, ptr_type):
+ array = ctypes.cast(self.ptr + start, ptr_type).contents
+ return VertexArrayRegion(array)
+
+ def delete(self):
+ pass
+
+ def resize(self, size):
+ array = (ctypes.c_byte * size)()
+ ctypes.memmove(array, self.array, min(size, self.size))
+ self.size = size
+ self.array = array
+ self.ptr = ctypes.cast(self.array, ctypes.c_void_p).value
+
+
+class VertexBufferObject(AbstractBuffer):
+ '''Lightweight representation of an OpenGL VBO.
+
+ The data in the buffer is not replicated in any system memory (unless it
+ is done so by the video driver). While this can improve memory usage and
+ possibly performance, updates to the buffer are relatively slow.
+
+ This class does not implement :py:class:`AbstractMappable`, and so has no
+ :py:meth:`~AbstractMappable.get_region` method. See
+ :py:class:`MappableVertexBufferObject` for a VBO class
+ that does implement :py:meth:`~AbstractMappable.get_region`.
+ '''
+
+ def __init__(self, size, target, usage):
+ self.size = size
+ self.target = target
+ self.usage = usage
+ self._context = pyglet.gl.current_context
+
+ id = GLuint()
+ glGenBuffers(1, id)
+ self.id = id.value
+ glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
+ glBindBuffer(target, self.id)
+ glBufferData(target, self.size, None, self.usage)
+ glPopClientAttrib()
+
+ global _workaround_vbo_finish
+ if pyglet.gl.current_context._workaround_vbo_finish:
+ _workaround_vbo_finish = True
+
+ def bind(self):
+ glBindBuffer(self.target, self.id)
+
+ def unbind(self):
+ glBindBuffer(self.target, 0)
+
+ def set_data(self, data):
+ glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
+ glBindBuffer(self.target, self.id)
+ glBufferData(self.target, self.size, data, self.usage)
+ glPopClientAttrib()
+
+ def set_data_region(self, data, start, length):
+ glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
+ glBindBuffer(self.target, self.id)
+ glBufferSubData(self.target, start, length, data)
+ glPopClientAttrib()
+
+ def map(self, invalidate=False):
+ glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
+ glBindBuffer(self.target, self.id)
+ if invalidate:
+ glBufferData(self.target, self.size, None, self.usage)
+ ptr = ctypes.cast(glMapBuffer(self.target, GL_WRITE_ONLY),
+ ctypes.POINTER(ctypes.c_byte * self.size)).contents
+ glPopClientAttrib()
+ return ptr
+
+ def unmap(self):
+ glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
+ glUnmapBuffer(self.target)
+ glPopClientAttrib()
+
+ def __del__(self):
+ try:
+ if self.id is not None:
+ self._context.delete_buffer(self.id)
+ except:
+ pass
+
+ def delete(self):
+ id = GLuint(self.id)
+ glDeleteBuffers(1, id)
+ self.id = None
+
+ def resize(self, size):
+ # Map, create a copy, then reinitialize.
+ temp = (ctypes.c_byte * size)()
+
+ glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
+ glBindBuffer(self.target, self.id)
+ data = glMapBuffer(self.target, GL_READ_ONLY)
+ ctypes.memmove(temp, data, min(size, self.size))
+ glUnmapBuffer(self.target)
+
+ self.size = size
+ glBufferData(self.target, self.size, temp, self.usage)
+ glPopClientAttrib()
+
+class MappableVertexBufferObject(VertexBufferObject, AbstractMappable):
+ '''A VBO with system-memory backed store.
+
+ Updates to the data via :py:meth:`set_data`, :py:meth:`set_data_region` and
+ :py:meth:`map` will be held in local memory until :py:meth:`bind` is
+ called. The advantage is that fewer OpenGL calls are needed, increasing
+ performance.
+
+ There may also be less performance penalty for resizing this buffer.
+
+ Updates to data via :py:meth:`map` are committed immediately.
+ '''
+ def __init__(self, size, target, usage):
+ super(MappableVertexBufferObject, self).__init__(size, target, usage)
+ self.data = (ctypes.c_byte * size)()
+ self.data_ptr = ctypes.cast(self.data, ctypes.c_void_p).value
+ self._dirty_min = sys.maxsize
+ self._dirty_max = 0
+
+ def bind(self):
+ # Commit pending data
+ super(MappableVertexBufferObject, self).bind()
+ size = self._dirty_max - self._dirty_min
+ if size > 0:
+ if size == self.size:
+ glBufferData(self.target, self.size, self.data, self.usage)
+ else:
+ glBufferSubData(self.target, self._dirty_min, size,
+ self.data_ptr + self._dirty_min)
+ self._dirty_min = sys.maxsize
+ self._dirty_max = 0
+
+ def set_data(self, data):
+ super(MappableVertexBufferObject, self).set_data(data)
+ ctypes.memmove(self.data, data, self.size)
+ self._dirty_min = 0
+ self._dirty_max = self.size
+
+ def set_data_region(self, data, start, length):
+ ctypes.memmove(self.data_ptr + start, data, length)
+ self._dirty_min = min(start, self._dirty_min)
+ self._dirty_max = max(start + length, self._dirty_max)
+
+ def map(self, invalidate=False):
+ self._dirty_min = 0
+ self._dirty_max = self.size
+ return self.data
+
+ def unmap(self):
+ pass
+
+ def get_region(self, start, size, ptr_type):
+ array = ctypes.cast(self.data_ptr + start, ptr_type).contents
+ return VertexBufferObjectRegion(self, start, start + size, array)
+
+ def resize(self, size):
+ data = (ctypes.c_byte * size)()
+ ctypes.memmove(data, self.data, min(size, self.size))
+ self.data = data
+ self.data_ptr = ctypes.cast(self.data, ctypes.c_void_p).value
+
+ self.size = size
+ glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
+ glBindBuffer(self.target, self.id)
+ glBufferData(self.target, self.size, self.data, self.usage)
+ glPopClientAttrib()
+
+ self._dirty_min = sys.maxsize
+ self._dirty_max = 0
+
+class AbstractBufferRegion(object):
+ '''A mapped region of a buffer.
+
+ Buffer regions are obtained using :py:meth:`~AbstractMappable.get_region`.
+
+ :Ivariables:
+ `array` : ctypes array
+ Array of data, of the type and count requested by
+ :py:meth:`~AbstractMappable.get_region`.
+
+ '''
+ def invalidate(self):
+ '''Mark this region as changed.
+
+ The buffer may not be updated with the latest contents of the
+ array until this method is called. (However, it may not be updated
+ until the next time the buffer is used, for efficiency).
+ '''
+ pass
+
+class VertexBufferObjectRegion(AbstractBufferRegion):
+ '''A mapped region of a VBO.'''
+ def __init__(self, buffer, start, end, array):
+ self.buffer = buffer
+ self.start = start
+ self.end = end
+ self.array = array
+
+ def invalidate(self):
+ buffer = self.buffer
+ buffer._dirty_min = min(buffer._dirty_min, self.start)
+ buffer._dirty_max = max(buffer._dirty_max, self.end)
+
+class VertexArrayRegion(AbstractBufferRegion):
+ '''A mapped region of a vertex array.
+
+ The :py:meth:`~AbstractBufferRegion.invalidate` method is a no-op but is
+ provided in order to present a consistent interface with
+ :py:meth:`VertexBufferObjectRegion`.
+ '''
+ def __init__(self, array):
+ self.array = array
+
+class IndirectArrayRegion(AbstractBufferRegion):
+ '''A mapped region in which data elements are not necessarily contiguous.
+
+ This region class is used to wrap buffer regions in which the data
+ must be accessed with some stride. For example, in an interleaved buffer
+ this region can be used to access a single interleaved component as if the
+ data was contiguous.
+ '''
+ def __init__(self, region, size, component_count, component_stride):
+ '''Wrap a buffer region.
+
+ Use the `component_count` and `component_stride` parameters to specify
+ the data layout of the encapsulated region. For example, if RGBA
+ data is to be accessed as if it were packed RGB, ``component_count``
+ would be set to 3 and ``component_stride`` to 4. If the region
+ contains 10 RGBA tuples, the ``size`` parameter is ``3 * 10 = 30``.
+
+ :Parameters:
+ `region` : `AbstractBufferRegion`
+ The region with interleaved data
+ `size` : int
+ The number of elements that this region will provide access to.
+ `component_count` : int
+ The number of elements that are contiguous before some must
+ be skipped.
+ `component_stride` : int
+ The number of elements of interleaved data separating
+ the contiguous sections.
+
+ '''
+ self.region = region
+ self.size = size
+ self.count = component_count
+ self.stride = component_stride
+ self.array = self
+
+ def __repr__(self):
+ return 'IndirectArrayRegion(size=%d, count=%d, stride=%d)' % (
+ self.size, self.count, self.stride)
+
+ def __getitem__(self, index):
+ count = self.count
+ if not isinstance(index, slice):
+ elem = index // count
+ j = index % count
+ return self.region.array[elem * self.stride + j]
+
+ start = index.start or 0
+ stop = index.stop
+ step = index.step or 1
+ if start < 0:
+ start = self.size + start
+ if stop is None:
+ stop = self.size
+ elif stop < 0:
+ stop = self.size + stop
+
+ assert step == 1 or step % count == 0, \
+ 'Step must be multiple of component count'
+
+ data_start = (start // count) * self.stride + start % count
+ data_stop = (stop // count) * self.stride + stop % count
+ data_step = step * self.stride
+
+ # TODO stepped getitem is probably wrong, see setitem for correct.
+ value_step = step * count
+
+ # ctypes does not support stepped slicing, so do the work in a list
+ # and copy it back.
+ data = self.region.array[:]
+ value = [0] * ((stop - start) // step)
+ stride = self.stride
+ for i in range(count):
+ value[i::value_step] = \
+ data[data_start + i:data_stop + i:data_step]
+ return value
+
+ def __setitem__(self, index, value):
+ count = self.count
+ if not isinstance(index, slice):
+ elem = index // count
+ j = index % count
+ self.region.array[elem * self.stride + j] = value
+ return
+
+ start = index.start or 0
+ stop = index.stop
+ step = index.step or 1
+ if start < 0:
+ start = self.size + start
+ if stop is None:
+ stop = self.size
+ elif stop < 0:
+ stop = self.size + stop
+
+ assert step == 1 or step % count == 0, \
+ 'Step must be multiple of component count'
+
+ data_start = (start // count) * self.stride + start % count
+ data_stop = (stop // count) * self.stride + stop % count
+
+ # ctypes does not support stepped slicing, so do the work in a list
+ # and copy it back.
+ data = self.region.array[:]
+ if step == 1:
+ data_step = self.stride
+ value_step = count
+ for i in range(count):
+ data[data_start + i:data_stop + i:data_step] = \
+ value[i::value_step]
+ else:
+ data_step = (step // count) * self.stride
+ data[data_start:data_stop:data_step] = value
+ self.region.array[:] = data
+
+ def invalidate(self):
+ self.region.invalidate()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/graphics/vertexdomain.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/graphics/vertexdomain.py
new file mode 100644
index 0000000..fef9ff1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/graphics/vertexdomain.py
@@ -0,0 +1,880 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+# $Id:$
+
+'''Manage related vertex attributes within a single vertex domain.
+
+A vertex "domain" consists of a set of attribute descriptions that together
+describe the layout of one or more vertex buffers which are used together to
+specify the vertices in a primitive. Additionally, the domain manages the
+buffers used to store the data and will resize them as necessary to accommodate
+new vertices.
+
+Domains can optionally be indexed, in which case they also manage a buffer
+containing vertex indices. This buffer is grown separately and has no size
+relation to the attribute buffers.
+
+Applications can create vertices (and optionally, indices) within a domain
+with the :py:meth:`VertexDomain.create` method. This returns a
+:py:class:`VertexList` representing the list of vertices created. The vertex
+attribute data within the group can be modified, and the changes will be made
+to the underlying buffers automatically.
+
+The entire domain can be efficiently drawn in one step with the
+:py:meth:`VertexDomain.draw` method, assuming all the vertices comprise
+primitives of the same OpenGL primitive mode.
+'''
+from builtins import zip
+from builtins import range
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import ctypes
+import re
+
+from pyglet.gl import *
+from pyglet.graphics import allocation, vertexattribute, vertexbuffer
+
+_usage_format_re = re.compile(r'''
+ (?P[^/]*)
+ (/ (?P static|dynamic|stream|none))?
+''', re.VERBOSE)
+
+_gl_usages = {
+ 'static': GL_STATIC_DRAW,
+ 'dynamic': GL_DYNAMIC_DRAW,
+ 'stream': GL_STREAM_DRAW,
+ 'none': GL_STREAM_DRAW_ARB, # Force no VBO
+}
+
+def _nearest_pow2(v):
+ # From http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
+ # Credit: Sean Anderson
+ v -= 1
+ v |= v >> 1
+ v |= v >> 2
+ v |= v >> 4
+ v |= v >> 8
+ v |= v >> 16
+ return v + 1
+
+def create_attribute_usage(format):
+ '''Create an attribute and usage pair from a format string. The
+ format string is as documented in `pyglet.graphics.vertexattribute`, with
+ the addition of an optional usage component::
+
+ usage ::= attribute ( '/' ('static' | 'dynamic' | 'stream' | 'none') )?
+
+ If the usage is not given it defaults to 'dynamic'. The usage corresponds
+ to the OpenGL VBO usage hint, and for ``static`` also indicates a
+ preference for interleaved arrays. If ``none`` is specified a buffer
+ object is not created, and vertex data is stored in system memory.
+
+ Some examples:
+
+ ``v3f/stream``
+ 3D vertex position using floats, for stream usage
+ ``c4b/static``
+ 4-byte color attribute, for static usage
+
+ :return: attribute, usage
+ '''
+ match = _usage_format_re.match(format)
+ attribute_format = match.group('attribute')
+ attribute = vertexattribute.create_attribute(attribute_format)
+ usage = match.group('usage')
+ if usage:
+ vbo = not usage == 'none'
+ usage = _gl_usages[usage]
+ else:
+ usage = GL_DYNAMIC_DRAW
+ vbo = True
+
+ return (attribute, usage, vbo)
+
+def create_domain(*attribute_usage_formats):
+ '''Create a vertex domain covering the given attribute usage formats.
+ See documentation for :py:func:`create_attribute_usage` and
+ :py:func:`pyglet.graphics.vertexattribute.create_attribute` for the grammar
+ of these format strings.
+
+ :rtype: :py:class:`VertexDomain`
+ '''
+ attribute_usages = [create_attribute_usage(f) \
+ for f in attribute_usage_formats]
+ return VertexDomain(attribute_usages)
+
+def create_indexed_domain(*attribute_usage_formats):
+ '''Create an indexed vertex domain covering the given attribute usage
+ formats. See documentation for :py:class:`create_attribute_usage` and
+ :py:func:`pyglet.graphics.vertexattribute.create_attribute` for the grammar
+ of these format strings.
+
+ :rtype: :py:class:`VertexDomain`
+ '''
+ attribute_usages = [create_attribute_usage(f) \
+ for f in attribute_usage_formats]
+ return IndexedVertexDomain(attribute_usages)
+
+class VertexDomain(object):
+ '''Management of a set of vertex lists.
+
+ Construction of a vertex domain is usually done with the
+ :py:func:`create_domain` function.
+ '''
+ _version = 0
+ _initial_count = 16
+
+ def __init__(self, attribute_usages):
+ self.allocator = allocation.Allocator(self._initial_count)
+
+ # If there are any MultiTexCoord attributes, then a TexCoord attribute
+ # must be converted.
+ have_multi_texcoord = False
+ for attribute, _, _ in attribute_usages:
+ if isinstance(attribute, vertexattribute.MultiTexCoordAttribute):
+ have_multi_texcoord = True
+ break
+
+ static_attributes = []
+ attributes = []
+ self.buffer_attributes = [] # list of (buffer, attributes)
+ for attribute, usage, vbo in attribute_usages:
+ if (have_multi_texcoord and
+ isinstance(attribute, vertexattribute.TexCoordAttribute)):
+ attribute.convert_to_multi_tex_coord_attribute()
+
+ if usage == GL_STATIC_DRAW:
+ # Group attributes for interleaved buffer
+ static_attributes.append(attribute)
+ attributes.append(attribute)
+ else:
+ # Create non-interleaved buffer
+ attributes.append(attribute)
+ attribute.buffer = vertexbuffer.create_mappable_buffer(
+ attribute.stride * self.allocator.capacity,
+ usage=usage, vbo=vbo)
+ attribute.buffer.element_size = attribute.stride
+ attribute.buffer.attributes = (attribute,)
+ self.buffer_attributes.append(
+ (attribute.buffer, (attribute,)))
+
+ # Create buffer for interleaved data
+ if static_attributes:
+ vertexattribute.interleave_attributes(static_attributes)
+ stride = static_attributes[0].stride
+ buffer = vertexbuffer.create_mappable_buffer(
+ stride * self.allocator.capacity, usage=GL_STATIC_DRAW)
+ buffer.element_size = stride
+ self.buffer_attributes.append(
+ (buffer, static_attributes))
+
+ attributes.extend(static_attributes)
+ for attribute in static_attributes:
+ attribute.buffer = buffer
+
+ # Create named attributes for each attribute
+ self.attributes = attributes
+ self.attribute_names = {}
+ for attribute in attributes:
+ if isinstance(attribute, vertexattribute.GenericAttribute):
+ index = attribute.index
+ # TODO create a name and use it (e.g. 'generic3')
+ # XXX this won't migrate; not documented.
+ if 'generic' not in self.attribute_names:
+ self.attribute_names['generic'] = {}
+ assert index not in self.attribute_names['generic'], \
+ 'More than one generic attribute with index %d' % index
+ self.attribute_names['generic'][index] = attribute
+ elif isinstance(attribute, vertexattribute.MultiTexCoordAttribute):
+ # XXX this won't migrate; not documented.
+ texture = attribute.texture
+ if 'multi_tex_coords' not in self.attribute_names:
+ self.attribute_names['multi_tex_coords'] = []
+ assert texture not in self.attribute_names['multi_tex_coords'],\
+ 'More than one multi_tex_coord attribute for texture %d' % \
+ texture
+ self.attribute_names['multi_tex_coords'].insert(texture,attribute)
+ else:
+ name = attribute.plural
+ assert name not in self.attributes, \
+ 'More than one "%s" attribute given' % name
+ self.attribute_names[name] = attribute
+
+ def __del__(self):
+ # Break circular refs that Python GC seems to miss even when forced
+ # collection.
+ for attribute in self.attributes:
+ try:
+ del attribute.buffer
+ except AttributeError:
+ pass
+
+ def _safe_alloc(self, count):
+ '''Allocate vertices, resizing the buffers if necessary.'''
+ try:
+ return self.allocator.alloc(count)
+ except allocation.AllocatorMemoryException as e:
+ capacity = _nearest_pow2(e.requested_capacity)
+ self._version += 1
+ for buffer, _ in self.buffer_attributes:
+ buffer.resize(capacity * buffer.element_size)
+ self.allocator.set_capacity(capacity)
+ return self.allocator.alloc(count)
+
+ def _safe_realloc(self, start, count, new_count):
+ '''Reallocate vertices, resizing the buffers if necessary.'''
+ try:
+ return self.allocator.realloc(start, count, new_count)
+ except allocation.AllocatorMemoryException as e:
+ capacity = _nearest_pow2(e.requested_capacity)
+ self._version += 1
+ for buffer, _ in self.buffer_attributes:
+ buffer.resize(capacity * buffer.element_size)
+ self.allocator.set_capacity(capacity)
+ return self.allocator.realloc(start, count, new_count)
+
+ def create(self, count):
+ '''Create a :py:class:`VertexList` in this domain.
+
+ :Parameters:
+ `count` : int
+ Number of vertices to create.
+
+ :rtype: :py:class:`VertexList`
+ '''
+ start = self._safe_alloc(count)
+ return VertexList(self, start, count)
+
+ def draw(self, mode, vertex_list=None):
+ '''Draw vertices in the domain.
+
+ If `vertex_list` is not specified, all vertices in the domain are
+ drawn. This is the most efficient way to render primitives.
+
+ If `vertex_list` specifies a :py:class:`VertexList`, only primitives in
+ that list will be drawn.
+
+ :Parameters:
+ `mode` : int
+ OpenGL drawing mode, e.g. ``GL_POINTS``, ``GL_LINES``, etc.
+ `vertex_list` : `~pyglet.graphics.vertexdomain.VertexList`
+ Vertex list to draw, or ``None`` for all lists in this domain.
+
+ '''
+ glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
+ for buffer, attributes in self.buffer_attributes:
+ buffer.bind()
+ for attribute in attributes:
+ attribute.enable()
+ attribute.set_pointer(attribute.buffer.ptr)
+ if vertexbuffer._workaround_vbo_finish:
+ glFinish()
+
+ if vertex_list is not None:
+ glDrawArrays(mode, vertex_list.start, vertex_list.count)
+ else:
+ starts, sizes = self.allocator.get_allocated_regions()
+ primcount = len(starts)
+ if primcount == 0:
+ pass
+ elif primcount == 1:
+ # Common case
+ glDrawArrays(mode, starts[0], sizes[0])
+ elif gl_info.have_version(1, 4):
+ starts = (GLint * primcount)(*starts)
+ sizes = (GLsizei * primcount)(*sizes)
+ glMultiDrawArrays(mode, starts, sizes, primcount)
+ else:
+ for start, size in zip(starts, sizes):
+ glDrawArrays(mode, start, size)
+
+ for buffer, _ in self.buffer_attributes:
+ buffer.unbind()
+ glPopClientAttrib()
+
+ def _is_empty(self):
+ return not self.allocator.starts
+
+ def __repr__(self):
+ return '<%s@%x %s>' % (self.__class__.__name__, id(self),
+ self.allocator)
+
+class VertexList(object):
+ '''A list of vertices within a :py:class:`VertexDomain`. Use
+ :py:meth:`VertexDomain.create` to construct this list.
+ '''
+
+ def __init__(self, domain, start, count):
+ # TODO make private
+ self.domain = domain
+ self.start = start
+ self.count = count
+
+ def get_size(self):
+ '''Get the number of vertices in the list.
+
+ :rtype: int
+ '''
+ return self.count
+
+ def get_domain(self):
+ '''Get the domain this vertex list belongs to.
+
+ :rtype: :py:class:`VertexDomain`
+ '''
+ return self.domain
+
+ def draw(self, mode):
+ '''Draw this vertex list in the given OpenGL mode.
+
+ :Parameters:
+ `mode` : int
+ OpenGL drawing mode, e.g. ``GL_POINTS``, ``GL_LINES``, etc.
+
+ '''
+ self.domain.draw(mode, self)
+
+ def resize(self, count):
+ '''Resize this group.
+
+ :Parameters:
+ `count` : int
+ New number of vertices in the list.
+
+ '''
+ new_start = self.domain._safe_realloc(self.start, self.count, count)
+ if new_start != self.start:
+ # Copy contents to new location
+ for attribute in self.domain.attributes:
+ old = attribute.get_region(attribute.buffer,
+ self.start, self.count)
+ new = attribute.get_region(attribute.buffer,
+ new_start, self.count)
+ new.array[:] = old.array[:]
+ new.invalidate()
+ self.start = new_start
+ self.count = count
+
+ self._colors_cache_version = None
+ self._fog_coords_cache_version = None
+ self._edge_flags_cache_version = None
+ self._normals_cache_version = None
+ self._secondary_colors_cache_version = None
+ self._tex_coords_cache_version = None
+ self._vertices_cache_version = None
+
+ def delete(self):
+ '''Delete this group.'''
+ self.domain.allocator.dealloc(self.start, self.count)
+
+ def migrate(self, domain):
+ '''Move this group from its current domain and add to the specified
+ one. Attributes on domains must match. (In practice, used to change
+ parent state of some vertices).
+
+ :Parameters:
+ `domain` : `VertexDomain`
+ Domain to migrate this vertex list to.
+
+ '''
+ assert list(domain.attribute_names.keys()) == \
+ list(self.domain.attribute_names.keys()), 'Domain attributes must match.'
+
+ new_start = domain._safe_alloc(self.count)
+ for key, old_attribute in self.domain.attribute_names.items():
+ old = old_attribute.get_region(old_attribute.buffer,
+ self.start, self.count)
+ new_attribute = domain.attribute_names[key]
+ new = new_attribute.get_region(new_attribute.buffer,
+ new_start, self.count)
+ new.array[:] = old.array[:]
+ new.invalidate()
+
+ self.domain.allocator.dealloc(self.start, self.count)
+ self.domain = domain
+ self.start = new_start
+
+ self._colors_cache_version = None
+ self._fog_coords_cache_version = None
+ self._edge_flags_cache_version = None
+ self._normals_cache_version = None
+ self._secondary_colors_cache_version = None
+ self._tex_coords_cache_version = None
+ self._vertices_cache_version = None
+
+ def _set_attribute_data(self, i, data):
+ attribute = self.domain.attributes[i]
+ # TODO without region
+ region = attribute.get_region(attribute.buffer, self.start, self.count)
+ region.array[:] = data
+ region.invalidate()
+
+ # ---
+
+ def _get_colors(self):
+ if (self._colors_cache_version != self.domain._version):
+ domain = self.domain
+ attribute = domain.attribute_names['colors']
+ self._colors_cache = attribute.get_region(
+ attribute.buffer, self.start, self.count)
+ self._colors_cache_version = domain._version
+
+ region = self._colors_cache
+ region.invalidate()
+ return region.array
+
+ def _set_colors(self, data):
+ self._get_colors()[:] = data
+
+ _colors_cache = None
+ _colors_cache_version = None
+ colors = property(_get_colors, _set_colors,
+ doc='''Array of color data.''')
+
+ # ---
+
+ def _get_fog_coords(self):
+ if (self._fog_coords_cache_version != self.domain._version):
+ domain = self.domain
+ attribute = domain.attribute_names['fog_coords']
+ self._fog_coords_cache = attribute.get_region(
+ attribute.buffer, self.start, self.count)
+ self._fog_coords_cache_version = domain._version
+
+ region = self._fog_coords_cache
+ region.invalidate()
+ return region.array
+
+ def _set_fog_coords(self, data):
+ self._get_fog_coords()[:] = data
+
+ _fog_coords_cache = None
+ _fog_coords_cache_version = None
+ fog_coords = property(_get_fog_coords, _set_fog_coords,
+ doc='''Array of fog coordinate data.''')
+
+ # ---
+
+ def _get_edge_flags(self):
+ if (self._edge_flags_cache_version != self.domain._version):
+ domain = self.domain
+ attribute = domain.attribute_names['edge_flags']
+ self._edge_flags_cache = attribute.get_region(
+ attribute.buffer, self.start, self.count)
+ self._edge_flags_cache_version = domain._version
+
+ region = self._edge_flags_cache
+ region.invalidate()
+ return region.array
+
+ def _set_edge_flags(self, data):
+ self._get_edge_flags()[:] = data
+
+ _edge_flags_cache = None
+ _edge_flags_cache_version = None
+ edge_flags = property(_get_edge_flags, _set_edge_flags,
+ doc='''Array of edge flag data.''')
+
+ # ---
+
+ def _get_normals(self):
+ if (self._normals_cache_version != self.domain._version):
+ domain = self.domain
+ attribute = domain.attribute_names['normals']
+ self._normals_cache = attribute.get_region(
+ attribute.buffer, self.start, self.count)
+ self._normals_cache_version = domain._version
+
+ region = self._normals_cache
+ region.invalidate()
+ return region.array
+
+ def _set_normals(self, data):
+ self._get_normals()[:] = data
+
+ _normals_cache = None
+ _normals_cache_version = None
+ normals = property(_get_normals, _set_normals,
+ doc='''Array of normal vector data.''')
+
+ # ---
+
+ def _get_secondary_colors(self):
+ if (self._secondary_colors_cache_version != self.domain._version):
+ domain = self.domain
+ attribute = domain.attribute_names['secondary_colors']
+ self._secondary_colors_cache = attribute.get_region(
+ attribute.buffer, self.start, self.count)
+ self._secondary_colors_cache_version = domain._version
+
+ region = self._secondary_colors_cache
+ region.invalidate()
+ return region.array
+
+ def _set_secondary_colors(self, data):
+ self._get_secondary_colors()[:] = data
+
+ _secondary_colors_cache = None
+ _secondary_colors_cache_version = None
+ secondary_colors = property(_get_secondary_colors, _set_secondary_colors,
+ doc='''Array of secondary color data.''')
+
+ # ---
+
+ _tex_coords_cache = None
+ _tex_coords_cache_version = None
+
+ def _get_tex_coords(self):
+ if 'multi_tex_coords' not in self.domain.attribute_names:
+ if (self._tex_coords_cache_version != self.domain._version):
+ domain = self.domain
+ attribute = domain.attribute_names['tex_coords']
+ self._tex_coords_cache = attribute.get_region(
+ attribute.buffer, self.start, self.count)
+ self._tex_coords_cache_version = domain._version
+
+ region = self._tex_coords_cache
+ region.invalidate()
+ return region.array
+ else:
+ return None
+
+ def _set_tex_coords(self, data):
+ if self._get_tex_coords() != None:
+ self._get_tex_coords()[:] = data
+
+ tex_coords = property(_get_tex_coords, _set_tex_coords,
+ doc='''Array of texture coordinate data.''')
+
+ # ---
+
+ def _get_multi_tex_coords(self):
+ if 'tex_coords' not in self.domain.attribute_names:
+ if (self._tex_coords_cache_version != self.domain._version):
+ domain = self.domain
+ attribute = domain.attribute_names['multi_tex_coords']
+ self._tex_coords_cache = []
+ for a in attribute:
+ self._tex_coords_cache.append(a.get_region(
+ a.buffer, self.start, self.count))
+ self._tex_coords_cache_version = domain._version
+
+ region = self._tex_coords_cache
+ array = []
+ for a in region:
+ a.invalidate()
+ array.append(a.array)
+ return array
+ else:
+ return None
+
+ def _set_multi_tex_coords(self, data):
+ if self._get_multi_tex_coords() != None:
+ for a in range(0, len(self._tex_coords_cache),1):
+ if a > len(data):
+ break
+ elif data[a] != None:
+ self._tex_coords_cache[a].array[:] = data[a]
+
+ multi_tex_coords = property(_get_multi_tex_coords, _set_multi_tex_coords,
+ doc='''Multi-array texture coordinate data.''')
+
+ # ---
+
+ _vertices_cache = None
+ _vertices_cache_version = None
+
+ def _get_vertices(self):
+ if (self._vertices_cache_version != self.domain._version):
+ domain = self.domain
+ attribute = domain.attribute_names['vertices']
+ self._vertices_cache = attribute.get_region(
+ attribute.buffer, self.start, self.count)
+ self._vertices_cache_version = domain._version
+
+ region = self._vertices_cache
+ region.invalidate()
+ return region.array
+
+ def _set_vertices(self, data):
+ self._get_vertices()[:] = data
+
+ vertices = property(_get_vertices, _set_vertices,
+ doc='''Array of vertex coordinate data.''')
+
+class IndexedVertexDomain(VertexDomain):
+ '''Management of a set of indexed vertex lists.
+
+ Construction of an indexed vertex domain is usually done with the
+ `create_indexed_domain` function.
+ '''
+ _initial_index_count = 16
+
+ def __init__(self, attribute_usages, index_gl_type=GL_UNSIGNED_INT):
+ super(IndexedVertexDomain, self).__init__(attribute_usages)
+
+ self.index_allocator = allocation.Allocator(self._initial_index_count)
+
+ self.index_gl_type = index_gl_type
+ self.index_c_type = vertexattribute._c_types[index_gl_type]
+ self.index_element_size = ctypes.sizeof(self.index_c_type)
+ self.index_buffer = vertexbuffer.create_mappable_buffer(
+ self.index_allocator.capacity * self.index_element_size,
+ target=GL_ELEMENT_ARRAY_BUFFER)
+
+ def _safe_index_alloc(self, count):
+ '''Allocate indices, resizing the buffers if necessary.'''
+ try:
+ return self.index_allocator.alloc(count)
+ except allocation.AllocatorMemoryException as e:
+ capacity = _nearest_pow2(e.requested_capacity)
+ self._version += 1
+ self.index_buffer.resize(capacity * self.index_element_size)
+ self.index_allocator.set_capacity(capacity)
+ return self.index_allocator.alloc(count)
+
+ def _safe_index_realloc(self, start, count, new_count):
+ '''Reallocate indices, resizing the buffers if necessary.'''
+ try:
+ return self.index_allocator.realloc(start, count, new_count)
+ except allocation.AllocatorMemoryException as e:
+ capacity = _nearest_pow2(e.requested_capacity)
+ self._version += 1
+ self.index_buffer.resize(capacity * self.index_element_size)
+ self.index_allocator.set_capacity(capacity)
+ return self.index_allocator.realloc(start, count, new_count)
+
+ def create(self, count, index_count):
+ '''Create an :py:class:`IndexedVertexList` in this domain.
+
+ :Parameters:
+ `count` : int
+ Number of vertices to create
+ `index_count`
+ Number of indices to create
+
+ '''
+ start = self._safe_alloc(count)
+ index_start = self._safe_index_alloc(index_count)
+ return IndexedVertexList(self, start, count, index_start, index_count)
+
+ def get_index_region(self, start, count):
+ '''Get a region of the index buffer.
+
+ :Parameters:
+ `start` : int
+ Start of the region to map.
+ `count` : int
+ Number of indices to map.
+
+ :rtype: Array of int
+ '''
+ byte_start = self.index_element_size * start
+ byte_count = self.index_element_size * count
+ ptr_type = ctypes.POINTER(self.index_c_type * count)
+ return self.index_buffer.get_region(byte_start, byte_count, ptr_type)
+
+ def draw(self, mode, vertex_list=None):
+ '''Draw vertices in the domain.
+
+ If `vertex_list` is not specified, all vertices in the domain are
+ drawn. This is the most efficient way to render primitives.
+
+ If `vertex_list` specifies a :py:class:`VertexList`, only primitives in
+ that list will be drawn.
+
+ :Parameters:
+ `mode` : int
+ OpenGL drawing mode, e.g. ``GL_POINTS``, ``GL_LINES``, etc.
+ `vertex_list` : `IndexedVertexList`
+ Vertex list to draw, or ``None`` for all lists in this domain.
+
+ '''
+ glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
+ for buffer, attributes in self.buffer_attributes:
+ buffer.bind()
+ for attribute in attributes:
+ attribute.enable()
+ attribute.set_pointer(attribute.buffer.ptr)
+ self.index_buffer.bind()
+ if vertexbuffer._workaround_vbo_finish:
+ glFinish()
+
+ if vertex_list is not None:
+ glDrawElements(mode, vertex_list.index_count, self.index_gl_type,
+ self.index_buffer.ptr +
+ vertex_list.index_start * self.index_element_size)
+ else:
+ starts, sizes = self.index_allocator.get_allocated_regions()
+ primcount = len(starts)
+ if primcount == 0:
+ pass
+ elif primcount == 1:
+ # Common case
+ glDrawElements(mode, sizes[0], self.index_gl_type,
+ self.index_buffer.ptr + starts[0])
+ elif gl_info.have_version(1, 4):
+ starts = [s * self.index_element_size + self.index_buffer.ptr for s in starts]
+ starts = ctypes.cast((GLuint * primcount)(*starts), ctypes.POINTER(ctypes.c_void_p))
+ sizes = (GLsizei * primcount)(*sizes)
+ glMultiDrawElements(mode, sizes, GL_UNSIGNED_INT, starts,
+ primcount)
+ else:
+ for start, size in zip(starts, sizes):
+ glDrawElements(mode, size, self.index_gl_type,
+ self.index_buffer.ptr +
+ start * self.index_element_size)
+
+ self.index_buffer.unbind()
+ for buffer, _ in self.buffer_attributes:
+ buffer.unbind()
+ glPopClientAttrib()
+
+class IndexedVertexList(VertexList):
+ '''A list of vertices within an :py:class:`IndexedVertexDomain` that are
+ indexed. Use :py:meth:`IndexedVertexDomain.create` to construct this list.
+ '''
+ def __init__(self, domain, start, count, index_start, index_count):
+ super(IndexedVertexList, self).__init__(domain, start, count)
+
+ self.index_start = index_start
+ self.index_count = index_count
+
+ def draw(self, mode):
+ self.domain.draw(mode, self)
+
+ def resize(self, count, index_count):
+ '''Resize this group.
+
+ :Parameters:
+ `count` : int
+ New number of vertices in the list.
+ `index_count` : int
+ New number of indices in the list.
+
+ '''
+ old_start = self.start
+ super(IndexedVertexList, self).resize(count)
+
+ # Change indices (because vertices moved)
+ if old_start != self.start:
+ diff = self.start - old_start
+ self.indices[:] = [i + diff for i in self.indices]
+
+ # Resize indices
+ new_start = self.domain._safe_index_realloc(
+ self.index_start, self.index_count, index_count)
+ if new_start != self.index_start:
+ old = self.domain.get_index_region(
+ self.index_start, self.index_count)
+ new = self.domain.get_index_region(
+ self.index_start, self.index_count)
+ new.array[:] = old.array[:]
+ new.invalidate()
+ self.index_start = new_start
+ self.index_count = index_count
+ self._indices_cache_version = None
+
+ def delete(self):
+ '''Delete this group.'''
+ super(IndexedVertexList, self).delete()
+ self.domain.index_allocator.dealloc(self.index_start, self.index_count)
+
+ def migrate(self, domain):
+ '''Move this group from its current indexed domain and add to the
+ specified one. Attributes on domains must match. (In practice, used
+ to change parent state of some vertices).
+
+ :Parameters:
+ `domain` : `IndexedVertexDomain`
+ Indexed domain to migrate this vertex list to.
+
+ '''
+ old_start = self.start
+ old_domain = self.domain
+ super(IndexedVertexList, self).migrate(domain)
+
+ # Note: this code renumber the indices of the *original* domain
+ # because the vertices are in a new position in the new domain
+ if old_start != self.start:
+ diff = self.start - old_start
+ region = old_domain.get_index_region(self.index_start,
+ self.index_count)
+ old_indices = region.array
+ old_indices[:] = [i + diff for i in old_indices]
+ region.invalidate()
+
+ # copy indices to new domain
+ old = old_domain.get_index_region(self.index_start, self.index_count)
+ # must delloc before calling safe_index_alloc or else problems when same
+ # batch is migrated to because index_start changes after dealloc
+ old_domain.index_allocator.dealloc(self.index_start, self.index_count)
+ new_start = self.domain._safe_index_alloc(self.index_count)
+ new = self.domain.get_index_region(new_start, self.index_count)
+ new.array[:] = old.array[:]
+ new.invalidate()
+
+ self.index_start = new_start
+ self._indices_cache_version = None
+
+ def _set_index_data(self, data):
+ # TODO without region
+ region = self.domain.get_index_region(
+ self.index_start, self.index_count)
+ region.array[:] = data
+ region.invalidate()
+
+ # ---
+
+ def _get_indices(self):
+ if self._indices_cache_version != self.domain._version:
+ domain = self.domain
+ self._indices_cache = domain.get_index_region(
+ self.index_start, self.index_count)
+ self._indices_cache_version = domain._version
+
+ region = self._indices_cache
+ region.invalidate()
+ return region.array
+
+ def _set_indices(self, data):
+ self._get_indices()[:] = data
+
+ _indices_cache = None
+ _indices_cache_version = None
+ indices = property(_get_indices, _set_indices,
+ doc='''Array of index data.''')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/__init__.py
new file mode 100644
index 0000000..9e1ab60
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/__init__.py
@@ -0,0 +1,2646 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+"""Image load, capture and high-level texture functions.
+
+Only basic functionality is described here; for full reference see the
+accompanying documentation.
+
+To load an image::
+
+ from pyglet import image
+ pic = image.load('picture.png')
+
+The supported image file types include PNG, BMP, GIF, JPG, and many more,
+somewhat depending on the operating system. To load an image from a file-like
+object instead of a filename::
+
+ pic = image.load('hint.jpg', file=fileobj)
+
+The hint helps the module locate an appropriate decoder to use based on the
+file extension. It is optional.
+
+Once loaded, images can be used directly by most other modules of pyglet. All
+images have a width and height you can access::
+
+ width, height = pic.width, pic.height
+
+You can extract a region of an image (this keeps the original image intact;
+the memory is shared efficiently)::
+
+ subimage = pic.get_region(x, y, width, height)
+
+Remember that y-coordinates are always increasing upwards.
+
+Drawing images
+--------------
+
+To draw an image at some point on the screen::
+
+ pic.blit(x, y, z)
+
+This assumes an appropriate view transform and projection have been applied.
+
+Some images have an intrinsic "anchor point": this is the point which will be
+aligned to the ``x`` and ``y`` coordinates when the image is drawn. By
+default the anchor point is the lower-left corner of the image. You can use
+the anchor point to center an image at a given point, for example::
+
+ pic.anchor_x = pic.width // 2
+ pic.anchor_y = pic.height // 2
+ pic.blit(x, y, z)
+
+Texture access
+--------------
+
+If you are using OpenGL directly, you can access the image as a texture::
+
+ texture = pic.get_texture()
+
+(This is the most efficient way to obtain a texture; some images are
+immediately loaded as textures, whereas others go through an intermediate
+form). To use a texture with pyglet.gl::
+
+ from pyglet.gl import *
+ glEnable(texture.target) # typically target is GL_TEXTURE_2D
+ glBindTexture(texture.target, texture.id)
+ # ... draw with the texture
+
+Pixel access
+------------
+
+To access raw pixel data of an image::
+
+ rawimage = pic.get_image_data()
+
+(If the image has just been loaded this will be a very quick operation;
+however if the image is a texture a relatively expensive readback operation
+will occur). The pixels can be accessed as a string::
+
+ format = 'RGBA'
+ pitch = rawimage.width * len(format)
+ pixels = rawimage.get_data(format, pitch)
+
+"format" strings consist of characters that give the byte order of each color
+component. For example, if rawimage.format is 'RGBA', there are four color
+components: red, green, blue and alpha, in that order. Other common format
+strings are 'RGB', 'LA' (luminance, alpha) and 'I' (intensity).
+
+The "pitch" of an image is the number of bytes in a row (this may validly be
+more than the number required to make up the width of the image, it is common
+to see this for word alignment). If "pitch" is negative the rows of the image
+are ordered from top to bottom, otherwise they are ordered from bottom to top.
+
+Retrieving data with the format and pitch given in `ImageData.format` and
+`ImageData.pitch` avoids the need for data conversion (assuming you can make
+use of the data in this arbitrary format).
+
+"""
+
+from __future__ import division
+from builtins import bytes
+from builtins import zip
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+from io import open
+import re
+import warnings
+import weakref
+
+from ctypes import *
+
+from pyglet.gl import *
+from pyglet.gl import gl_info
+from pyglet.window import *
+
+from pyglet.image import atlas
+from pyglet.image import codecs as _codecs
+from pyglet.compat import asbytes, bytes_type, BytesIO
+
+
+class ImageException(Exception):
+ pass
+
+
+def load(filename, file=None, decoder=None):
+ """Load an image from a file.
+
+ :note: You can make no assumptions about the return type; usually it will
+ be ImageData or CompressedImageData, but decoders are free to return
+ any subclass of AbstractImage.
+
+ :Parameters:
+ `filename` : str
+ Used to guess the image format, and to load the file if `file` is
+ unspecified.
+ `file` : file-like object or None
+ Source of image data in any supported format.
+ `decoder` : ImageDecoder or None
+ If unspecified, all decoders that are registered for the filename
+ extension are tried. If none succeed, the exception from the
+ first decoder is raised.
+
+ :rtype: AbstractImage
+ """
+
+ if not file:
+ file = open(filename, 'rb')
+ opened_file = file
+ else:
+ opened_file = None
+
+ if not hasattr(file, 'seek'):
+ file = BytesIO(file.read())
+
+ try:
+ if decoder:
+ return decoder.decode(file, filename)
+ else:
+ first_exception = None
+ for decoder in _codecs.get_decoders(filename):
+ try:
+ image = decoder.decode(file, filename)
+ return image
+ except _codecs.ImageDecodeException as e:
+ if (not first_exception or
+ first_exception.exception_priority < e.exception_priority):
+ first_exception = e
+ file.seek(0)
+
+ if not first_exception:
+ raise _codecs.ImageDecodeException('No image decoders are available')
+ raise first_exception
+ finally:
+ if opened_file:
+ opened_file.close()
+
+
+def create(width, height, pattern=None):
+ """Create an image optionally filled with the given pattern.
+
+ :note: You can make no assumptions about the return type; usually it will
+ be ImageData or CompressedImageData, but patterns are free to return
+ any subclass of AbstractImage.
+
+ :Parameters:
+ `width` : int
+ Width of image to create
+ `height` : int
+ Height of image to create
+ `pattern` : ImagePattern or None
+ Pattern to fill image with. If unspecified, the image will
+ initially be transparent.
+
+ :rtype: AbstractImage
+ """
+ if not pattern:
+ pattern = SolidColorImagePattern()
+ return pattern.create_image(width, height)
+
+
+def color_as_bytes(color):
+ if sys.version.startswith('2'):
+ return '%c%c%c%c' % color
+ else:
+ if len(color) != 4:
+ raise TypeError("color is expected to have 4 components")
+ return bytes(color)
+
+
+class ImagePattern(object):
+ """Abstract image creation class."""
+
+ def create_image(self, width, height):
+ """Create an image of the given size.
+
+ :Parameters:
+ `width` : int
+ Width of image to create
+ `height` : int
+ Height of image to create
+
+ :rtype: AbstractImage
+ """
+ raise NotImplementedError('abstract')
+
+
+class SolidColorImagePattern(ImagePattern):
+ """Creates an image filled with a solid color."""
+
+ def __init__(self, color=(0, 0, 0, 0)):
+ """Create a solid image pattern with the given color.
+
+ :Parameters:
+ `color` : (int, int, int, int)
+ 4-tuple of ints in range [0,255] giving RGBA components of
+ color to fill with.
+
+ """
+ self.color = color_as_bytes(color)
+
+ def create_image(self, width, height):
+ data = self.color * width * height
+ return ImageData(width, height, 'RGBA', data)
+
+
+class CheckerImagePattern(ImagePattern):
+ """Create an image with a tileable checker image.
+ """
+
+ def __init__(self, color1=(150, 150, 150, 255), color2=(200, 200, 200, 255)):
+ """Initialise with the given colors.
+
+ :Parameters:
+ `color1` : (int, int, int, int)
+ 4-tuple of ints in range [0,255] giving RGBA components of
+ color to fill with. This color appears in the top-left and
+ bottom-right corners of the image.
+ `color2` : (int, int, int, int)
+ 4-tuple of ints in range [0,255] giving RGBA components of
+ color to fill with. This color appears in the top-right and
+ bottom-left corners of the image.
+
+ """
+ self.color1 = color_as_bytes(color1)
+ self.color2 = color_as_bytes(color2)
+
+ def create_image(self, width, height):
+ hw = width // 2
+ hh = height // 2
+ row1 = self.color1 * hw + self.color2 * hw
+ row2 = self.color2 * hw + self.color1 * hw
+ data = row1 * hh + row2 * hh
+ return ImageData(width, height, 'RGBA', data)
+
+
+class AbstractImage(object):
+ """Abstract class representing an image.
+
+ :Ivariables:
+ `width` : int
+ Width of image
+ `height` : int
+ Height of image
+ `anchor_x` : int
+ X coordinate of anchor, relative to left edge of image data
+ `anchor_y` : int
+ Y coordinate of anchor, relative to bottom edge of image data
+ """
+ anchor_x = 0
+ anchor_y = 0
+
+ _is_rectangle = False
+
+ def __init__(self, width, height):
+ self.width = width
+ self.height = height
+
+ def __repr__(self):
+ return '<%s %dx%d>' % (self.__class__.__name__, self.width, self.height)
+
+ def get_image_data(self):
+ """Get an ImageData view of this image.
+
+ Changes to the returned instance may or may not be reflected in this
+ image.
+
+ :rtype: :py:class:`~pyglet.image.ImageData`
+
+ .. versionadded:: 1.1
+ """
+ raise ImageException('Cannot retrieve image data for %r' % self)
+
+ @property
+ def image_data(self):
+ """An :py:class:`~pyglet.image.ImageData` view of this image.
+
+ Changes to the returned instance may or may not be reflected in this
+ image. Read-only.
+
+ :deprecated: Use :py:meth:`~pyglet.image.ImageData.get_image_data`.
+
+ :type: :py:class:`~pyglet.image.ImageData`
+ """
+ return self.get_image_data()
+
+ def get_texture(self, rectangle=False, force_rectangle=False):
+ """A :py:class:`~pyglet.image.Texture` view of this image.
+
+ By default, textures are created with dimensions that are powers of
+ two. Smaller images will return a :py:class:`~pyglet.image.TextureRegion` that covers just
+ the image portion of the larger texture. This restriction is required
+ on older video cards, and for compressed textures, or where texture
+ repeat modes will be used, or where mipmapping is desired.
+
+ If the `rectangle` parameter is ``True``, this restriction is ignored
+ and a texture the size of the image may be created if the driver
+ supports the ``GL_ARB_texture_rectangle`` or
+ ``GL_NV_texture_rectangle`` extensions. If the extensions are not
+ present, the image already is a texture, or the image has power 2
+ dimensions, the `rectangle` parameter is ignored.
+
+ Examine `Texture.target` to determine if the returned texture is a
+ rectangle (``GL_TEXTURE_RECTANGLE_ARB`` or
+ ``GL_TEXTURE_RECTANGLE_NV``) or not (``GL_TEXTURE_2D``).
+
+ If the `force_rectangle` parameter is ``True``, one of these
+ extensions must be present, and the returned texture always
+ has target ``GL_TEXTURE_RECTANGLE_ARB`` or ``GL_TEXTURE_RECTANGLE_NV``.
+
+ Changes to the returned instance may or may not be reflected in this
+ image.
+
+ :Parameters:
+ `rectangle` : bool
+ True if the texture can be created as a rectangle.
+ `force_rectangle` : bool
+ True if the texture must be created as a rectangle.
+
+ .. versionadded:: 1.1.4.
+ :rtype: :py:class:`~pyglet.image.Texture`
+
+ .. versionadded:: 1.1
+ """
+ raise ImageException('Cannot retrieve texture for %r' % self)
+
+ @property
+ def texture(self):
+ """Get a :py:class:`~pyglet.image.Texture` view of this image.
+
+ Changes to the returned instance may or may not be reflected in this
+ image.
+
+ :deprecated: Use :py:meth:`~pyglet.image.AbstractImage.get_texture`.
+
+ :type: :py:class:`~pyglet.image.Texture`
+ """
+ return self.get_texture()
+
+ def get_mipmapped_texture(self):
+ """Retrieve a :py:class:`~pyglet.image.Texture` instance with all mipmap levels filled in.
+
+ Requires that image dimensions be powers of 2.
+
+ :rtype: :py:class:`~pyglet.image.Texture`
+
+ .. versionadded:: 1.1
+ """
+ raise ImageException('Cannot retrieve mipmapped texture for %r' % self)
+
+ @property
+ def mipmapped_texture(self):
+ """A Texture view of this image.
+
+ The returned Texture will have mipmaps filled in for all levels.
+ Requires that image dimensions be powers of 2. Read-only.
+
+ :deprecated: Use `get_mipmapped_texture`.
+
+ :type: :py:class:`~pyglet.image.Texture`
+ """
+ return self.get_mipmapped_texture()
+
+ def get_region(self, x, y, width, height):
+ """Retrieve a rectangular region of this image.
+
+ :Parameters:
+ `x` : int
+ Left edge of region.
+ `y` : int
+ Bottom edge of region.
+ `width` : int
+ Width of region.
+ `height` : int
+ Height of region.
+
+ :rtype: AbstractImage
+ """
+ raise ImageException('Cannot get region for %r' % self)
+
+ def save(self, filename=None, file=None, encoder=None):
+ """Save this image to a file.
+
+ :Parameters:
+ `filename` : str
+ Used to set the image file format, and to open the output file
+ if `file` is unspecified.
+ `file` : file-like object or None
+ File to write image data to.
+ `encoder` : ImageEncoder or None
+ If unspecified, all encoders matching the filename extension
+ are tried. If all fail, the exception from the first one
+ attempted is raised.
+
+ """
+ if not file:
+ file = open(filename, 'wb')
+
+ if encoder:
+ encoder.encode(self, file, filename)
+ else:
+ first_exception = None
+ for encoder in _codecs.get_encoders(filename):
+ try:
+ encoder.encode(self, file, filename)
+ return
+ except _codecs.ImageEncodeException as e:
+ first_exception = first_exception or e
+ file.seek(0)
+
+ if not first_exception:
+ raise _codecs.ImageEncodeException(
+ 'No image encoders are available')
+ raise first_exception
+
+ def blit(self, x, y, z=0):
+ """Draw this image to the active framebuffers.
+
+ The image will be drawn with the lower-left corner at
+ (``x -`` `anchor_x`, ``y -`` `anchor_y`, ``z``).
+ """
+ raise ImageException('Cannot blit %r.' % self)
+
+ def blit_into(self, source, x, y, z):
+ """Draw `source` on this image.
+
+ `source` will be copied into this image such that its anchor point
+ is aligned with the `x` and `y` parameters. If this image is a 3D
+ texture, the `z` coordinate gives the image slice to copy into.
+
+ Note that if `source` is larger than this image (or the positioning
+ would cause the copy to go out of bounds) then you must pass a
+ region of `source` to this method, typically using get_region().
+ """
+ raise ImageException('Cannot blit images onto %r.' % self)
+
+ def blit_to_texture(self, target, level, x, y, z=0):
+ """Draw this image on the currently bound texture at `target`.
+
+ This image is copied into the texture such that this image's anchor
+ point is aligned with the given `x` and `y` coordinates of the
+ destination texture. If the currently bound texture is a 3D texture,
+ the `z` coordinate gives the image slice to blit into.
+ """
+ raise ImageException('Cannot blit %r to a texture.' % self)
+
+
+class AbstractImageSequence(object):
+ """Abstract sequence of images.
+
+ The sequence is useful for storing image animations or slices of a volume.
+ For efficient access, use the `texture_sequence` member. The class
+ also implements the sequence interface (`__len__`, `__getitem__`,
+ `__setitem__`).
+ """
+
+ def get_texture_sequence(self):
+ """Get a TextureSequence.
+
+ :rtype: `TextureSequence`
+
+ .. versionadded:: 1.1
+ """
+ raise NotImplementedError('abstract')
+
+ @property
+ def texture_sequence(self):
+ """Access this image sequence as a texture sequence.
+
+ :deprecated: Use `get_texture_sequence`
+
+ :type: `TextureSequence`
+ """
+ return self.get_texture_sequence()
+
+ def get_animation(self, period, loop=True):
+ """Create an animation over this image sequence for the given constant
+ framerate.
+
+ :Parameters
+ `period` : float
+ Number of seconds to display each frame.
+ `loop` : bool
+ If True, the animation will loop continuously.
+
+ :rtype: :py:class:`~pyglet.image.Animation`
+
+ .. versionadded:: 1.1
+ """
+ return Animation.from_image_sequence(self, period, loop)
+
+ def __getitem__(self, slice):
+ """Retrieve a (list of) image.
+
+ :rtype: AbstractImage
+ """
+ raise NotImplementedError('abstract')
+
+ def __setitem__(self, slice, image):
+ """Replace one or more images in the sequence.
+
+ :Parameters:
+ `image` : `~pyglet.image.AbstractImage`
+ The replacement image. The actual instance may not be used,
+ depending on this implementation.
+
+ """
+ raise NotImplementedError('abstract')
+
+ def __len__(self):
+ raise NotImplementedError('abstract')
+
+ def __iter__(self):
+ """Iterate over the images in sequence.
+
+ :rtype: Iterator
+
+ .. versionadded:: 1.1
+ """
+ raise NotImplementedError('abstract')
+
+
+class TextureSequence(AbstractImageSequence):
+ """Interface for a sequence of textures.
+
+ Typical implementations store multiple :py:class:`~pyglet.image.TextureRegion` s within one
+ :py:class:`~pyglet.image.Texture` so as to minimise state changes.
+ """
+
+ def get_texture_sequence(self):
+ return self
+
+
+class UniformTextureSequence(TextureSequence):
+ """Interface for a sequence of textures, each with the same dimensions.
+
+ :Ivariables:
+ `item_width` : int
+ Width of each texture in the sequence.
+ `item_height` : int
+ Height of each texture in the sequence.
+
+ """
+
+ def _get_item_width(self):
+ raise NotImplementedError('abstract')
+
+ def _get_item_height(self):
+ raise NotImplementedError('abstract')
+
+ @property
+ def item_width(self):
+ return self._get_item_width()
+
+ @property
+ def item_height(self):
+ return self._get_item_height()
+
+
+class ImageData(AbstractImage):
+ """An image represented as a string of unsigned bytes.
+
+ :Ivariables:
+ `data` : str
+ Pixel data, encoded according to `format` and `pitch`.
+ `format` : str
+ The format string to use when reading or writing `data`.
+ `pitch` : int
+ Number of bytes per row. Negative values indicate a top-to-bottom
+ arrangement.
+
+ Setting the `format` and `pitch` instance variables and reading `data` is
+ deprecated; use `get_data` and `set_data` in new applications. (Reading
+ `format` and `pitch` to obtain the current encoding is not deprecated).
+ """
+
+ _swap1_pattern = re.compile(asbytes('(.)'), re.DOTALL)
+ _swap2_pattern = re.compile(asbytes('(.)(.)'), re.DOTALL)
+ _swap3_pattern = re.compile(asbytes('(.)(.)(.)'), re.DOTALL)
+ _swap4_pattern = re.compile(asbytes('(.)(.)(.)(.)'), re.DOTALL)
+
+ _current_texture = None
+ _current_mipmap_texture = None
+
+ def __init__(self, width, height, format, data, pitch=None):
+ """Initialise image data.
+
+ :Parameters:
+ `width` : int
+ Width of image data
+ `height` : int
+ Height of image data
+ `format` : str
+ A valid format string, such as 'RGB', 'RGBA', 'ARGB', etc.
+ `data` : sequence
+ String or array/list of bytes giving the decoded data.
+ `pitch` : int or None
+ If specified, the number of bytes per row. Negative values
+ indicate a top-to-bottom arrangement. Defaults to
+ ``width * len(format)``.
+
+ """
+ super(ImageData, self).__init__(width, height)
+
+ self._current_format = self._desired_format = format.upper()
+ self._current_data = data
+ if not pitch:
+ pitch = width * len(format)
+ self._current_pitch = self.pitch = pitch
+ self.mipmap_images = []
+
+ def __getstate__(self):
+ return {
+ 'width': self.width,
+ 'height': self.height,
+ '_current_data': self.get_data(self._current_format, self._current_pitch),
+ '_current_format': self._current_format,
+ '_desired_format': self._desired_format,
+ '_current_pitch': self._current_pitch,
+ 'pitch': self.pitch,
+ 'mipmap_images': self.mipmap_images
+ }
+
+ def get_image_data(self):
+ return self
+
+ def _set_format(self, fmt):
+ self._desired_format = fmt.upper()
+ self._current_texture = None
+
+ @property
+ def format(self):
+ """Format string of the data. Read-write.
+
+ :type: str
+ """
+ return self._desired_format
+
+ @format.setter
+ def format(self, fmt):
+ self._set_format(fmt)
+
+ def _get_data(self):
+ if self._current_pitch != self.pitch or \
+ self._current_format != self.format:
+ self._current_data = self._convert(self.format, self.pitch)
+ self._current_format = self.format
+ self._current_pitch = self.pitch
+
+ self._ensure_string_data()
+ return self._current_data
+
+ def _set_data(self, data):
+ self._current_data = data
+ self._current_format = self.format
+ self._current_pitch = self.pitch
+ self._current_texture = None
+ self._current_mipmapped_texture = None
+
+ @property
+ def data(self):
+ """The byte data of the image. Read-write.
+
+ :deprecated: Use `get_data` and `set_data`.
+
+ :type: sequence of bytes, or str
+ """
+ return self._get_data()
+
+ @data.setter
+ def data(self, data):
+ self._set_data(data)
+
+ def get_data(self, format, pitch):
+ """Get the byte data of the image.
+
+ :Parameters:
+ `format` : str
+ Format string of the return data.
+ `pitch` : int
+ Number of bytes per row. Negative values indicate a
+ top-to-bottom arrangement.
+
+ .. versionadded:: 1.1
+
+ :rtype: sequence of bytes, or str
+ """
+ if format == self._current_format and pitch == self._current_pitch:
+ return self._current_data
+ return self._convert(format, pitch)
+
+ def set_data(self, format, pitch, data):
+ """Set the byte data of the image.
+
+ :Parameters:
+ `format` : str
+ Format string of the return data.
+ `pitch` : int
+ Number of bytes per row. Negative values indicate a
+ top-to-bottom arrangement.
+ `data` : str or sequence of bytes
+ Image data.
+
+ .. versionadded:: 1.1
+ """
+ self._current_format = format
+ self._current_pitch = pitch
+ self._current_data = data
+ self._current_texture = None
+ self._current_mipmapped_texture = None
+
+ def set_mipmap_image(self, level, image):
+ """Set a mipmap image for a particular level.
+
+ The mipmap image will be applied to textures obtained via
+ `get_mipmapped_texture`.
+
+ :Parameters:
+ `level` : int
+ Mipmap level to set image at, must be >= 1.
+ `image` : AbstractImage
+ Image to set. Must have correct dimensions for that mipmap
+ level (i.e., width >> level, height >> level)
+ """
+
+ if level == 0:
+ raise ImageException(
+ 'Cannot set mipmap image at level 0 (it is this image)')
+
+ if not _is_pow2(self.width) or not _is_pow2(self.height):
+ raise ImageException(
+ 'Image dimensions must be powers of 2 to use mipmaps.')
+
+ # Check dimensions of mipmap
+ width, height = self.width, self.height
+ for i in range(level):
+ width >>= 1
+ height >>= 1
+ if width != image.width or height != image.height:
+ raise ImageException(
+ 'Mipmap image has wrong dimensions for level %d' % level)
+
+ # Extend mipmap_images list to required level
+ self.mipmap_images += [None] * (level - len(self.mipmap_images))
+ self.mipmap_images[level - 1] = image
+
+ def create_texture(self, cls, rectangle=False, force_rectangle=False):
+ """Create a texture containing this image.
+
+ If the image's dimensions are not powers of 2, a TextureRegion of
+ a larger Texture will be returned that matches the dimensions of this
+ image.
+
+ :Parameters:
+ `cls` : class (subclass of Texture)
+ Class to construct.
+ `rectangle` : bool
+ ``True`` if a rectangle can be created; see
+ `AbstractImage.get_texture`.
+
+ .. versionadded:: 1.1
+ `force_rectangle` : bool
+ ``True`` if a rectangle must be created; see
+ `AbstractImage.get_texture`.
+
+ .. versionadded:: 1.1.4
+
+ :rtype: cls or cls.region_class
+ """
+ internalformat = self._get_internalformat(self.format)
+ texture = cls.create(self.width, self.height, internalformat,
+ rectangle, force_rectangle)
+ if self.anchor_x or self.anchor_y:
+ texture.anchor_x = self.anchor_x
+ texture.anchor_y = self.anchor_y
+
+ self.blit_to_texture(texture.target, texture.level,
+ self.anchor_x, self.anchor_y, 0, None)
+
+ return texture
+
+ def get_texture(self, rectangle=False, force_rectangle=False):
+ if (not self._current_texture or
+ (not self._current_texture._is_rectangle and force_rectangle)):
+ self._current_texture = self.create_texture(Texture,
+ rectangle,
+ force_rectangle)
+ return self._current_texture
+
+ def get_mipmapped_texture(self):
+ """Return a Texture with mipmaps.
+
+ If :py:class:`~pyglet.image.set_mipmap_Image` has been called with at least one image, the set
+ of images defined will be used. Otherwise, mipmaps will be
+ automatically generated.
+
+ The texture dimensions must be powers of 2 to use mipmaps.
+
+ :rtype: :py:class:`~pyglet.image.Texture`
+
+ .. versionadded:: 1.1
+ """
+ if self._current_mipmap_texture:
+ return self._current_mipmap_texture
+
+ if not _is_pow2(self.width) or not _is_pow2(self.height):
+ raise ImageException(
+ 'Image dimensions must be powers of 2 to use mipmaps.')
+
+ texture = Texture.create_for_size(GL_TEXTURE_2D, self.width, self.height)
+ if self.anchor_x or self.anchor_y:
+ texture.anchor_x = self.anchor_x
+ texture.anchor_y = self.anchor_y
+
+ internalformat = self._get_internalformat(self.format)
+
+ glBindTexture(texture.target, texture.id)
+ glTexParameteri(texture.target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR)
+
+ if self.mipmap_images:
+ self.blit_to_texture(texture.target, texture.level,
+ self.anchor_x, self.anchor_y, 0, internalformat)
+ level = 0
+ for image in self.mipmap_images:
+ level += 1
+ if image:
+ image.blit_to_texture(texture.target, level,
+ self.anchor_x, self.anchor_y, 0, internalformat)
+ # TODO: should set base and max mipmap level if some mipmaps
+ # are missing.
+ elif gl_info.have_version(1, 4):
+ glTexParameteri(texture.target, GL_GENERATE_MIPMAP, GL_TRUE)
+ self.blit_to_texture(texture.target, texture.level,
+ self.anchor_x, self.anchor_y, 0, internalformat)
+ else:
+ raise NotImplementedError('TODO: gluBuild2DMipmaps')
+
+ self._current_mipmap_texture = texture
+ return texture
+
+ def get_region(self, x, y, width, height):
+ """Retrieve a rectangular region of this image data.
+
+ :Parameters:
+ `x` : int
+ Left edge of region.
+ `y` : int
+ Bottom edge of region.
+ `width` : int
+ Width of region.
+ `height` : int
+ Height of region.
+
+ :rtype: ImageDataRegion
+ """
+ return ImageDataRegion(x, y, width, height, self)
+
+ def blit(self, x, y, z=0, width=None, height=None):
+ self.get_texture().blit(x, y, z, width, height)
+
+ def blit_to_texture(self, target, level, x, y, z, internalformat=None):
+ """Draw this image to to the currently bound texture at `target`.
+
+ This image's anchor point will be aligned to the given `x` and `y`
+ coordinates. If the currently bound texture is a 3D texture, the `z`
+ parameter gives the image slice to blit into.
+
+ If `internalformat` is specified, glTexImage is used to initialise
+ the texture; otherwise, glTexSubImage is used to update a region.
+ """
+ x -= self.anchor_x
+ y -= self.anchor_y
+
+ data_format = self.format
+ data_pitch = abs(self._current_pitch)
+
+ # Determine pixel format from format string
+ matrix = None
+ format, type = self._get_gl_format_and_type(data_format)
+ if format is None:
+ if (len(data_format) in (3, 4) and
+ gl_info.have_extension('GL_ARB_imaging')):
+ # Construct a color matrix to convert to GL_RGBA
+ def component_column(component):
+ try:
+ pos = 'RGBA'.index(component)
+ return [0] * pos + [1] + [0] * (3 - pos)
+ except ValueError:
+ return [0, 0, 0, 0]
+
+ # pad to avoid index exceptions
+ lookup_format = data_format + 'XXX'
+ matrix = (component_column(lookup_format[0]) +
+ component_column(lookup_format[1]) +
+ component_column(lookup_format[2]) +
+ component_column(lookup_format[3]))
+ format = {
+ 3: GL_RGB,
+ 4: GL_RGBA}.get(len(data_format))
+ type = GL_UNSIGNED_BYTE
+
+ glMatrixMode(GL_COLOR)
+ glPushMatrix()
+ glLoadMatrixf((GLfloat * 16)(*matrix))
+ else:
+ # Need to convert data to a standard form
+ data_format = {
+ 1: 'L',
+ 2: 'LA',
+ 3: 'RGB',
+ 4: 'RGBA'}.get(len(data_format))
+ format, type = self._get_gl_format_and_type(data_format)
+
+ # Workaround: don't use GL_UNPACK_ROW_LENGTH
+ if gl.current_context._workaround_unpack_row_length:
+ data_pitch = self.width * len(data_format)
+
+ # Get data in required format (hopefully will be the same format it's
+ # already in, unless that's an obscure format, upside-down or the
+ # driver is old).
+ data = self._convert(data_format, data_pitch)
+
+ if data_pitch & 0x1:
+ alignment = 1
+ elif data_pitch & 0x2:
+ alignment = 2
+ else:
+ alignment = 4
+ row_length = data_pitch // len(data_format)
+ glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT)
+ glPixelStorei(GL_UNPACK_ALIGNMENT, alignment)
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, row_length)
+ self._apply_region_unpack()
+
+ if target == GL_TEXTURE_3D:
+ assert not internalformat
+ glTexSubImage3D(target, level,
+ x, y, z,
+ self.width, self.height, 1,
+ format, type,
+ data)
+ elif internalformat:
+ glTexImage2D(target, level,
+ internalformat,
+ self.width, self.height,
+ 0,
+ format, type,
+ data)
+ else:
+ glTexSubImage2D(target, level,
+ x, y,
+ self.width, self.height,
+ format, type,
+ data)
+ glPopClientAttrib()
+
+ if matrix:
+ glPopMatrix()
+ glMatrixMode(GL_MODELVIEW)
+
+ # Flush image upload before data get GC'd.
+ glFlush()
+
+ def _apply_region_unpack(self):
+ pass
+
+ def _convert(self, format, pitch):
+ """Return data in the desired format; does not alter this instance's
+ current format or pitch.
+ """
+ if format == self._current_format and pitch == self._current_pitch:
+ if type(self._current_data) is str:
+ return asbytes(self._current_data)
+ return self._current_data
+
+ self._ensure_string_data()
+ data = self._current_data
+ current_pitch = self._current_pitch
+ current_format = self._current_format
+ sign_pitch = current_pitch // abs(current_pitch)
+ if format != self._current_format:
+ # Create replacement string, e.g. r'\4\1\2\3' to convert RGBA to
+ # ARGB
+ repl = asbytes('')
+ for c in format:
+ try:
+ idx = current_format.index(c) + 1
+ except ValueError:
+ idx = 1
+ repl += asbytes(r'\%d' % idx)
+
+ if len(current_format) == 1:
+ swap_pattern = self._swap1_pattern
+ elif len(current_format) == 2:
+ swap_pattern = self._swap2_pattern
+ elif len(current_format) == 3:
+ swap_pattern = self._swap3_pattern
+ elif len(current_format) == 4:
+ swap_pattern = self._swap4_pattern
+ else:
+ raise ImageException(
+ 'Current image format is wider than 32 bits.')
+
+ packed_pitch = self.width * len(current_format)
+ if abs(self._current_pitch) != packed_pitch:
+ # Pitch is wider than pixel data, need to go row-by-row.
+ rows = re.findall(
+ asbytes('.') * abs(self._current_pitch), data, re.DOTALL)
+ rows = [swap_pattern.sub(repl, r[:packed_pitch]) for r in rows]
+ data = asbytes('').join(rows)
+ else:
+ # Rows are tightly packed, apply regex over whole image.
+ data = swap_pattern.sub(repl, data)
+
+ # After conversion, rows will always be tightly packed
+ current_pitch = sign_pitch * (len(format) * self.width)
+
+ if pitch != current_pitch:
+ diff = abs(current_pitch) - abs(pitch)
+ if diff > 0:
+ # New pitch is shorter than old pitch, chop bytes off each row
+ pattern = re.compile(
+ asbytes('(%s)%s' % ('.' * abs(pitch), '.' * diff)), re.DOTALL)
+ data = pattern.sub(asbytes(r'\1'), data)
+ elif diff < 0:
+ # New pitch is longer than old pitch, add '0' bytes to each row
+ pattern = re.compile(
+ asbytes('(%s)' % ('.' * abs(current_pitch))), re.DOTALL)
+ pad = '.' * -diff
+ data = pattern.sub(asbytes(r'\1%s' % pad), data)
+
+ if current_pitch * pitch < 0:
+ # Pitch differs in sign, swap row order
+ rows = re.findall(asbytes('.') * abs(pitch), data, re.DOTALL)
+ rows.reverse()
+ data = asbytes('').join(rows)
+
+ return asbytes(data)
+
+ def _ensure_string_data(self):
+ if type(self._current_data) is not bytes_type:
+ buf = create_string_buffer(len(self._current_data))
+ memmove(buf, self._current_data, len(self._current_data))
+ self._current_data = buf.raw
+
+ def _get_gl_format_and_type(self, format):
+ if format == 'I':
+ return GL_LUMINANCE, GL_UNSIGNED_BYTE
+ elif format == 'L':
+ return GL_LUMINANCE, GL_UNSIGNED_BYTE
+ elif format == 'LA':
+ return GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE
+ elif format == 'R':
+ return GL_RED, GL_UNSIGNED_BYTE
+ elif format == 'G':
+ return GL_GREEN, GL_UNSIGNED_BYTE
+ elif format == 'B':
+ return GL_BLUE, GL_UNSIGNED_BYTE
+ elif format == 'A':
+ return GL_ALPHA, GL_UNSIGNED_BYTE
+ elif format == 'RGB':
+ return GL_RGB, GL_UNSIGNED_BYTE
+ elif format == 'RGBA':
+ return GL_RGBA, GL_UNSIGNED_BYTE
+ elif (format == 'ARGB' and
+ gl_info.have_extension('GL_EXT_bgra') and
+ gl_info.have_extension('GL_APPLE_packed_pixels')):
+ return GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV
+ elif (format == 'ABGR' and
+ gl_info.have_extension('GL_EXT_abgr')):
+ return GL_ABGR_EXT, GL_UNSIGNED_BYTE
+ elif (format == 'BGR' and
+ gl_info.have_extension('GL_EXT_bgra')):
+ return GL_BGR, GL_UNSIGNED_BYTE
+ elif (format == 'BGRA' and
+ gl_info.have_extension('GL_EXT_bgra')):
+ return GL_BGRA, GL_UNSIGNED_BYTE
+
+ return None, None
+
+ def _get_internalformat(self, format):
+ if len(format) == 4:
+ return GL_RGBA
+ elif len(format) == 3:
+ return GL_RGB
+ elif len(format) == 2:
+ return GL_LUMINANCE_ALPHA
+ elif format == 'A':
+ return GL_ALPHA
+ elif format == 'L':
+ return GL_LUMINANCE
+ elif format == 'I':
+ return GL_INTENSITY
+ return GL_RGBA
+
+
+class ImageDataRegion(ImageData):
+ def __init__(self, x, y, width, height, image_data):
+ super(ImageDataRegion, self).__init__(width, height,
+ image_data._current_format, image_data._current_data,
+ image_data._current_pitch)
+ self.x = x
+ self.y = y
+
+ def __getstate__(self):
+ return {
+ 'width': self.width,
+ 'height': self.height,
+ '_current_data':
+ self.get_data(self._current_format, self._current_pitch),
+ '_current_format': self._current_format,
+ '_desired_format': self._desired_format,
+ '_current_pitch': self._current_pitch,
+ 'pitch': self.pitch,
+ 'mipmap_images': self.mipmap_images,
+ 'x': self.x,
+ 'y': self.y
+ }
+
+ def _get_data(self):
+ # Crop the data first
+ x1 = len(self._current_format) * self.x
+ x2 = len(self._current_format) * (self.x + self.width)
+
+ self._ensure_string_data()
+ data = self._convert(self._current_format, abs(self._current_pitch))
+ rows = re.findall(b'.' * abs(self._current_pitch), data, re.DOTALL)
+ rows = [row[x1:x2] for row in rows[self.y:self.y + self.height]]
+ self._current_data = b''.join(rows)
+ self._current_pitch = self.width * len(self._current_format)
+ self._current_texture = None
+ self.x = 0
+ self.y = 0
+
+ return super(ImageDataRegion, self)._get_data()
+
+ def _set_data(self, data):
+ self.x = 0
+ self.y = 0
+ super(ImageDataRegion, self)._set_data(data)
+
+ @property
+ def data(self):
+ return self._get_data()
+
+ @data.setter
+ def data(self, data):
+ self._set_data(data)
+
+ def get_data(self, format, pitch):
+ x1 = len(self._current_format) * self.x
+ x2 = len(self._current_format) * (self.x + self.width)
+
+ self._ensure_string_data()
+ data = self._convert(self._current_format, abs(self._current_pitch))
+ rows = re.findall(asbytes('.') * abs(self._current_pitch), data,
+ re.DOTALL)
+ rows = [row[x1:x2] for row in rows[self.y:self.y + self.height]]
+ self._current_data = asbytes('').join(rows)
+ self._current_pitch = self.width * len(self._current_format)
+ self._current_texture = None
+ self.x = 0
+ self.y = 0
+
+ return super(ImageDataRegion, self).get_data(format, pitch)
+
+ def _apply_region_unpack(self):
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, self.x)
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, self.y)
+
+ def _ensure_string_data(self):
+ super(ImageDataRegion, self)._ensure_string_data()
+
+ def get_region(self, x, y, width, height):
+ x += self.x
+ y += self.y
+ return super(ImageDataRegion, self).get_region(x, y, width, height)
+
+
+class CompressedImageData(AbstractImage):
+ """Image representing some compressed data suitable for direct uploading
+ to driver.
+ """
+
+ _current_texture = None
+ _current_mipmapped_texture = None
+
+ def __init__(self, width, height, gl_format, data,
+ extension=None, decoder=None):
+ """Construct a CompressedImageData with the given compressed data.
+
+ :Parameters:
+ `width` : int
+ Width of image
+ `height` : int
+ Height of image
+ `gl_format` : int
+ GL constant giving format of compressed data; for example,
+ ``GL_COMPRESSED_RGBA_S3TC_DXT5_EXT``.
+ `data` : sequence
+ String or array/list of bytes giving compressed image data.
+ `extension` : str or None
+ If specified, gives the name of a GL extension to check for
+ before creating a texture.
+ `decoder` : function(data, width, height) -> AbstractImage
+ A function to decode the compressed data, to be used if the
+ required extension is not present.
+
+ """
+ if not _is_pow2(width) or not _is_pow2(height):
+ raise ImageException('Dimensions of %r must be powers of 2' % self)
+
+ super(CompressedImageData, self).__init__(width, height)
+ self.data = data
+ self.gl_format = gl_format
+ self.extension = extension
+ self.decoder = decoder
+ self.mipmap_data = []
+
+ def set_mipmap_data(self, level, data):
+ """Set data for a mipmap level.
+
+ Supplied data gives a compressed image for the given mipmap level.
+ The image must be of the correct dimensions for the level
+ (i.e., width >> level, height >> level); but this is not checked. If
+ any mipmap levels are specified, they are used; otherwise, mipmaps for
+ `mipmapped_texture` are generated automatically.
+
+ :Parameters:
+ `level` : int
+ Level of mipmap image to set.
+ `data` : sequence
+ String or array/list of bytes giving compressed image data.
+ Data must be in same format as specified in constructor.
+
+ """
+ # Extend mipmap_data list to required level
+ self.mipmap_data += [None] * (level - len(self.mipmap_data))
+ self.mipmap_data[level - 1] = data
+
+ def _have_extension(self):
+ return self.extension is None or gl_info.have_extension(self.extension)
+
+ def _verify_driver_supported(self):
+ """Assert that the extension required for this image data is
+ supported.
+
+ Raises `ImageException` if not.
+ """
+
+ if not self._have_extension():
+ raise ImageException('%s is required to decode %r' % \
+ (self.extension, self))
+
+ def get_texture(self, rectangle=False, force_rectangle=False):
+ if force_rectangle:
+ raise ImageException(
+ 'Compressed texture rectangles not supported')
+
+ if self._current_texture:
+ return self._current_texture
+
+ texture = Texture.create_for_size(
+ GL_TEXTURE_2D, self.width, self.height)
+ if self.anchor_x or self.anchor_y:
+ texture.anchor_x = self.anchor_x
+ texture.anchor_y = self.anchor_y
+
+ glBindTexture(texture.target, texture.id)
+ glTexParameteri(texture.target, GL_TEXTURE_MIN_FILTER, texture.min_filter)
+ glTexParameteri(texture.target, GL_TEXTURE_MAG_FILTER, texture.mag_filter)
+
+ if self._have_extension():
+ glCompressedTexImage2DARB(texture.target, texture.level,
+ self.gl_format,
+ self.width, self.height, 0,
+ len(self.data), self.data)
+ else:
+ image = self.decoder(self.data, self.width, self.height)
+ texture = image.get_texture()
+ assert texture.width == self.width
+ assert texture.height == self.height
+
+ glFlush()
+ self._current_texture = texture
+ return texture
+
+ def get_mipmapped_texture(self):
+ if self._current_mipmap_texture:
+ return self._current_mipmap_texture
+
+ if not self._have_extension():
+ # TODO mip-mapped software decoded compressed textures. For now,
+ # just return a non-mipmapped texture.
+ return self.get_texture()
+
+ texture = Texture.create_for_size(
+ GL_TEXTURE_2D, self.width, self.height)
+ if self.anchor_x or self.anchor_y:
+ texture.anchor_x = self.anchor_x
+ texture.anchor_y = self.anchor_y
+
+ glBindTexture(texture.target, texture.id)
+
+ glTexParameteri(texture.target, GL_TEXTURE_MIN_FILTER,
+ GL_LINEAR_MIPMAP_LINEAR)
+
+ if not self.mipmap_data:
+ if not gl_info.have_version(1, 4):
+ raise ImageException(
+ 'Require GL 1.4 to generate mipmaps for compressed textures')
+ glTexParameteri(texture.target, GL_GENERATE_MIPMAP, GL_TRUE)
+
+ glCompressedTexImage2DARB(texture.target, texture.level,
+ self.gl_format,
+ self.width, self.height, 0,
+ len(self.data), self.data)
+
+ width, height = self.width, self.height
+ level = 0
+ for data in self.mipmap_data:
+ width >>= 1
+ height >>= 1
+ level += 1
+ glCompressedTexImage2DARB(texture.target, level,
+ self.gl_format,
+ width, height, 0,
+ len(data), data)
+
+ glFlush()
+
+ self._current_mipmap_texture = texture
+ return texture
+
+ def blit_to_texture(self, target, level, x, y, z):
+ self._verify_driver_supported()
+
+ if target == GL_TEXTURE_3D:
+ glCompressedTexSubImage3DARB(target, level,
+ x - self.anchor_x, y - self.anchor_y, z,
+ self.width, self.height, 1,
+ self.gl_format,
+ len(self.data), self.data)
+ else:
+ glCompressedTexSubImage2DARB(target, level,
+ x - self.anchor_x, y - self.anchor_y,
+ self.width, self.height,
+ self.gl_format,
+ len(self.data), self.data)
+
+
+def _nearest_pow2(v):
+ # From http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
+ # Credit: Sean Anderson
+ v -= 1
+ v |= v >> 1
+ v |= v >> 2
+ v |= v >> 4
+ v |= v >> 8
+ v |= v >> 16
+ return v + 1
+
+
+def _is_pow2(v):
+ # http://graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2
+ return (v & (v - 1)) == 0
+
+
+class Texture(AbstractImage):
+ """An image loaded into video memory that can be efficiently drawn
+ to the framebuffer.
+
+ Typically you will get an instance of Texture by accessing the `texture`
+ member of any other AbstractImage.
+
+ :Ivariables:
+ `region_class` : class (subclass of TextureRegion)
+ Class to use when constructing regions of this texture.
+ `tex_coords` : tuple
+ 12-tuple of float, named (u1, v1, r1, u2, v2, r2, ...). u, v, r
+ give the 3D texture coordinates for vertices 1-4. The vertices
+ are specified in the order bottom-left, bottom-right, top-right
+ and top-left.
+ `target` : int
+ The GL texture target (e.g., ``GL_TEXTURE_2D``).
+ `level` : int
+ The mipmap level of this texture.
+
+ """
+
+ region_class = None # Set to TextureRegion after it's defined
+ tex_coords = (0., 0., 0., 1., 0., 0., 1., 1., 0., 0., 1., 0.)
+ tex_coords_order = (0, 1, 2, 3)
+ level = 0
+ images = 1
+ x = y = z = 0
+
+ def __init__(self, width, height, target, id):
+ super(Texture, self).__init__(width, height)
+ self.target = target
+ self.id = id
+ self._context = gl.current_context
+
+ def delete(self):
+ """Delete the texture from video memory.
+
+ :deprecated: Textures are automatically released during object
+ finalization.
+ """
+ warnings.warn(
+ 'Texture.delete() is deprecated; textures are '
+ 'released through GC now')
+ self._context.delete_texture(self.id)
+ self.id = 0
+
+ def __del__(self):
+ try:
+ self._context.delete_texture(self.id)
+ except:
+ pass
+
+ @classmethod
+ def create(cls, width, height, internalformat=GL_RGBA,
+ rectangle=False, force_rectangle=False, min_filter=GL_LINEAR, mag_filter=GL_LINEAR):
+ """Create an empty Texture.
+
+ If `rectangle` is ``False`` or the appropriate driver extensions are
+ not available, a larger texture than requested will be created, and
+ a :py:class:`~pyglet.image.TextureRegion` corresponding to the requested size will be
+ returned.
+
+ :Parameters:
+ `width` : int
+ Width of the texture.
+ `height` : int
+ Height of the texture.
+ `internalformat` : int
+ GL constant giving the internal format of the texture; for
+ example, ``GL_RGBA``.
+ `rectangle` : bool
+ ``True`` if a rectangular texture is permitted. See
+ `AbstractImage.get_texture`.
+ `force_rectangle` : bool
+ ``True`` if a rectangular texture is required. See
+ `AbstractImage.get_texture`.
+
+ .. versionadded:: 1.1.4.
+ `min_filter` : int
+ The minifaction filter used for this texture, commonly ``GL_LINEAR`` or ``GL_NEAREST``
+ `mag_filter` : int
+ The magnification filter used for this texture, commonly ``GL_LINEAR`` or ``GL_NEAREST``
+
+ :rtype: :py:class:`~pyglet.image.Texture`
+
+ .. versionadded:: 1.1
+ """
+ target = GL_TEXTURE_2D
+ if rectangle or force_rectangle:
+ if not force_rectangle and _is_pow2(width) and _is_pow2(height):
+ rectangle = False
+ elif gl_info.have_extension('GL_ARB_texture_rectangle'):
+ target = GL_TEXTURE_RECTANGLE_ARB
+ rectangle = True
+ elif gl_info.have_extension('GL_NV_texture_rectangle'):
+ target = GL_TEXTURE_RECTANGLE_NV
+ rectangle = True
+ else:
+ rectangle = False
+
+ if force_rectangle and not rectangle:
+ raise ImageException('Texture rectangle extensions not available')
+
+ if rectangle:
+ texture_width = width
+ texture_height = height
+ else:
+ texture_width = _nearest_pow2(width)
+ texture_height = _nearest_pow2(height)
+
+ id = GLuint()
+ glGenTextures(1, byref(id))
+ glBindTexture(target, id.value)
+ glTexParameteri(target, GL_TEXTURE_MIN_FILTER, min_filter)
+ glTexParameteri(target, GL_TEXTURE_MAG_FILTER, mag_filter)
+
+ blank = (GLubyte * (texture_width * texture_height * 4))()
+ glTexImage2D(target, 0,
+ internalformat,
+ texture_width, texture_height,
+ 0,
+ GL_RGBA, GL_UNSIGNED_BYTE,
+ blank)
+
+ texture = cls(texture_width, texture_height, target, id.value)
+ texture.min_filter = min_filter
+ texture.mag_filter = mag_filter
+ if rectangle:
+ texture._is_rectangle = True
+ texture.tex_coords = (0., 0., 0.,
+ width, 0., 0.,
+ width, height, 0.,
+ 0., height, 0.)
+
+ glFlush()
+
+ if texture_width == width and texture_height == height:
+ return texture
+
+ return texture.get_region(0, 0, width, height)
+
+ @classmethod
+ def create_for_size(cls, target, min_width, min_height,
+ internalformat=None, min_filter=GL_LINEAR, mag_filter=GL_LINEAR):
+ """Create a Texture with dimensions at least min_width, min_height.
+ On return, the texture will be bound.
+
+ :Parameters:
+ `target` : int
+ GL constant giving texture target to use, typically
+ ``GL_TEXTURE_2D``.
+ `min_width` : int
+ Minimum width of texture (may be increased to create a power
+ of 2).
+ `min_height` : int
+ Minimum height of texture (may be increased to create a power
+ of 2).
+ `internalformat` : int
+ GL constant giving internal format of texture; for example,
+ ``GL_RGBA``. If unspecified, the texture will not be
+ initialised (only the texture name will be created on the
+ instance). If specified, the image will be initialised
+ to this format with zero'd data.
+ `min_filter` : int
+ The minifaction filter used for this texture, commonly ``GL_LINEAR`` or ``GL_NEAREST``
+ `mag_filter` : int
+ The magnification filter used for this texture, commonly ``GL_LINEAR`` or ``GL_NEAREST``
+
+ :rtype: :py:class:`~pyglet.image.Texture`
+ """
+ if target not in (GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_RECTANGLE_ARB):
+ width = _nearest_pow2(min_width)
+ height = _nearest_pow2(min_height)
+ tex_coords = cls.tex_coords
+ else:
+ width = min_width
+ height = min_height
+ tex_coords = (0., 0., 0.,
+ width, 0., 0.,
+ width, height, 0.,
+ 0., height, 0.)
+ id = GLuint()
+ glGenTextures(1, byref(id))
+ glBindTexture(target, id.value)
+ glTexParameteri(target, GL_TEXTURE_MIN_FILTER, min_filter)
+ glTexParameteri(target, GL_TEXTURE_MAG_FILTER, mag_filter)
+
+ if internalformat is not None:
+ blank = (GLubyte * (width * height * 4))()
+ glTexImage2D(target, 0,
+ internalformat,
+ width, height,
+ 0,
+ GL_RGBA, GL_UNSIGNED_BYTE,
+ blank)
+ glFlush()
+
+ texture = cls(width, height, target, id.value)
+ texture.min_filter = min_filter
+ texture.mag_filter = mag_filter
+ texture.tex_coords = tex_coords
+ return texture
+
+ def get_image_data(self, z=0):
+ """Get the image data of this texture.
+
+ Changes to the returned instance will not be reflected in this
+ texture.
+
+ :Parameters:
+ `z` : int
+ For 3D textures, the image slice to retrieve.
+
+ :rtype: :py:class:`~pyglet.image.ImageData`
+ """
+ glBindTexture(self.target, self.id)
+
+ # Always extract complete RGBA data. Could check internalformat
+ # to only extract used channels. XXX
+ format = 'RGBA'
+ gl_format = GL_RGBA
+
+ glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT)
+ glPixelStorei(GL_PACK_ALIGNMENT, 1)
+ buffer = \
+ (GLubyte * (self.width * self.height * self.images * len(format)))()
+ glGetTexImage(self.target, self.level,
+ gl_format, GL_UNSIGNED_BYTE, buffer)
+ glPopClientAttrib()
+
+ data = ImageData(self.width, self.height, format, buffer)
+ if self.images > 1:
+ data = data.get_region(0, z * self.height, self.width, self.height)
+ return data
+
+ @property
+ def image_data(self):
+ """An ImageData view of this texture.
+
+ Changes to the returned instance will not be reflected in this
+ texture. If the texture is a 3D texture, the first image will be
+ returned. See also :py:meth:`~pyglet.image.ImageData.get_image_data`. Read-only.
+
+ :deprecated: Use :py:meth:`~pyglet.image.ImageData.get_image_data`.
+
+ :type: :py:class:`~pyglet.image.ImageData`
+ """
+ return self.get_image_data()
+
+ def get_texture(self, rectangle=False, force_rectangle=False):
+ if force_rectangle and not self._is_rectangle:
+ raise ImageException('Texture is not a rectangle.')
+ return self
+
+ # no implementation of blit_to_texture yet (could use aux buffer)
+
+ def blit(self, x, y, z=0, width=None, height=None):
+ t = self.tex_coords
+ x1 = x - self.anchor_x
+ y1 = y - self.anchor_y
+ x2 = x1 + (width is None and self.width or width)
+ y2 = y1 + (height is None and self.height or height)
+ array = (GLfloat * 32)(
+ t[0], t[1], t[2], 1.,
+ x1, y1, z, 1.,
+ t[3], t[4], t[5], 1.,
+ x2, y1, z, 1.,
+ t[6], t[7], t[8], 1.,
+ x2, y2, z, 1.,
+ t[9], t[10], t[11], 1.,
+ x1, y2, z, 1.)
+
+ glPushAttrib(GL_ENABLE_BIT)
+ glEnable(self.target)
+ glBindTexture(self.target, self.id)
+ glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
+ glInterleavedArrays(GL_T4F_V4F, 0, array)
+ glDrawArrays(GL_QUADS, 0, 4)
+ glPopClientAttrib()
+ glPopAttrib()
+
+ def blit_into(self, source, x, y, z):
+ glBindTexture(self.target, self.id)
+ source.blit_to_texture(self.target, self.level, x, y, z)
+
+ def get_region(self, x, y, width, height):
+ return self.region_class(x, y, 0, width, height, self)
+
+ def get_transform(self, flip_x=False, flip_y=False, rotate=0):
+ """Create a copy of this image applying a simple transformation.
+
+ The transformation is applied to the texture coordinates only;
+ :py:meth:`~pyglet.image.ImageData.get_image_data` will return the untransformed data. The
+ transformation is applied around the anchor point.
+
+ :Parameters:
+ `flip_x` : bool
+ If True, the returned image will be flipped horizontally.
+ `flip_y` : bool
+ If True, the returned image will be flipped vertically.
+ `rotate` : int
+ Degrees of clockwise rotation of the returned image. Only
+ 90-degree increments are supported.
+
+ :rtype: :py:class:`~pyglet.image.TextureRegion`
+ """
+ transform = self.get_region(0, 0, self.width, self.height)
+ bl, br, tr, tl = 0, 1, 2, 3
+ transform.anchor_x = self.anchor_x
+ transform.anchor_y = self.anchor_y
+ if flip_x:
+ bl, br, tl, tr = br, bl, tr, tl
+ transform.anchor_x = self.width - self.anchor_x
+ if flip_y:
+ bl, br, tl, tr = tl, tr, bl, br
+ transform.anchor_y = self.height - self.anchor_y
+ rotate %= 360
+ if rotate < 0:
+ rotate += 360
+ if rotate == 0:
+ pass
+ elif rotate == 90:
+ bl, br, tr, tl = br, tr, tl, bl
+ transform.anchor_x, transform.anchor_y = \
+ transform.anchor_y, \
+ transform.width - transform.anchor_x
+ elif rotate == 180:
+ bl, br, tr, tl = tr, tl, bl, br
+ transform.anchor_x = transform.width - transform.anchor_x
+ transform.anchor_y = transform.height - transform.anchor_y
+ elif rotate == 270:
+ bl, br, tr, tl = tl, bl, br, tr
+ transform.anchor_x, transform.anchor_y = \
+ transform.height - transform.anchor_y, \
+ transform.anchor_x
+ else:
+ assert False, 'Only 90 degree rotations are supported.'
+ if rotate in (90, 270):
+ transform.width, transform.height = \
+ transform.height, transform.width
+ transform._set_tex_coords_order(bl, br, tr, tl)
+ return transform
+
+ def _set_tex_coords_order(self, bl, br, tr, tl):
+ tex_coords = (self.tex_coords[:3],
+ self.tex_coords[3:6],
+ self.tex_coords[6:9],
+ self.tex_coords[9:])
+ self.tex_coords = \
+ tex_coords[bl] + tex_coords[br] + tex_coords[tr] + tex_coords[tl]
+
+ order = self.tex_coords_order
+ self.tex_coords_order = \
+ (order[bl], order[br], order[tr], order[tl])
+
+
+class TextureRegion(Texture):
+ """A rectangular region of a texture, presented as if it were
+ a separate texture.
+ """
+
+ def __init__(self, x, y, z, width, height, owner):
+ super(TextureRegion, self).__init__(
+ width, height, owner.target, owner.id)
+
+ self.x = x
+ self.y = y
+ self.z = z
+ self.owner = owner
+ owner_u1 = owner.tex_coords[0]
+ owner_v1 = owner.tex_coords[1]
+ owner_u2 = owner.tex_coords[3]
+ owner_v2 = owner.tex_coords[7]
+ scale_u = owner_u2 - owner_u1
+ scale_v = owner_v2 - owner_v1
+ u1 = x / owner.width * scale_u + owner_u1
+ v1 = y / owner.height * scale_v + owner_v1
+ u2 = (x + width) / owner.width * scale_u + owner_u1
+ v2 = (y + height) / owner.height * scale_v + owner_v1
+ r = z / owner.images + owner.tex_coords[2]
+ self.tex_coords = (u1, v1, r, u2, v1, r, u2, v2, r, u1, v2, r)
+
+ def get_image_data(self):
+ image_data = self.owner.get_image_data(self.z)
+ return image_data.get_region(self.x, self.y, self.width, self.height)
+
+ def get_region(self, x, y, width, height):
+ x += self.x
+ y += self.y
+ region = self.region_class(x, y, self.z, width, height, self.owner)
+ region._set_tex_coords_order(*self.tex_coords_order)
+ return region
+
+ def blit_into(self, source, x, y, z):
+ self.owner.blit_into(source, x + self.x, y + self.y, z + self.z)
+
+ def __del__(self):
+ # only the owner Texture should handle deletion
+ pass
+
+
+Texture.region_class = TextureRegion
+
+
+class Texture3D(Texture, UniformTextureSequence):
+ """A texture with more than one image slice.
+
+ Use `create_for_images` or `create_for_image_grid` classmethod to
+ construct.
+ """
+ item_width = 0
+ item_height = 0
+ items = ()
+
+ @classmethod
+ def create_for_images(cls, images, internalformat=GL_RGBA):
+ item_width = images[0].width
+ item_height = images[0].height
+ for image in images:
+ if image.width != item_width or image.height != item_height:
+ raise ImageException('Images do not have same dimensions.')
+
+ depth = len(images)
+ if not gl_info.have_version(2, 0):
+ depth = _nearest_pow2(depth)
+
+ texture = cls.create_for_size(GL_TEXTURE_3D, item_width, item_height)
+ if images[0].anchor_x or images[0].anchor_y:
+ texture.anchor_x = images[0].anchor_x
+ texture.anchor_y = images[0].anchor_y
+
+ texture.images = depth
+
+ blank = (GLubyte * (texture.width * texture.height * texture.images))()
+ glBindTexture(texture.target, texture.id)
+ glTexImage3D(texture.target, texture.level,
+ internalformat,
+ texture.width, texture.height, texture.images, 0,
+ GL_ALPHA, GL_UNSIGNED_BYTE,
+ blank)
+
+ items = []
+ for i, image in enumerate(images):
+ item = cls.region_class(0, 0, i, item_width, item_height, texture)
+ items.append(item)
+ image.blit_to_texture(texture.target, texture.level,
+ image.anchor_x, image.anchor_y, i)
+
+ glFlush()
+
+ texture.items = items
+ texture.item_width = item_width
+ texture.item_height = item_height
+ return texture
+
+ @classmethod
+ def create_for_image_grid(cls, grid, internalformat=GL_RGBA):
+ return cls.create_for_images(grid[:], internalformat)
+
+ def __len__(self):
+ return len(self.items)
+
+ def __getitem__(self, index):
+ return self.items[index]
+
+ def __setitem__(self, index, value):
+ if type(index) is slice:
+ for item, image in zip(self[index], value):
+ image.blit_to_texture(self.target, self.level,
+ image.anchor_x, image.anchor_y, item.z)
+ else:
+ value.blit_to_texture(self.target, self.level,
+ value.anchor_x, value.anchor_y, self[index].z)
+
+ def __iter__(self):
+ return iter(self.items)
+
+
+class TileableTexture(Texture):
+ """A texture that can be tiled efficiently.
+
+ Use :py:class:`~pyglet.image.create_for_Image` classmethod to construct.
+ """
+
+ def __init__(self, width, height, target, id):
+ if not _is_pow2(width) or not _is_pow2(height):
+ raise ImageException(
+ 'TileableTexture requires dimensions that are powers of 2')
+ super(TileableTexture, self).__init__(width, height, target, id)
+
+ def get_region(self, x, y, width, height):
+ raise ImageException('Cannot get region of %r' % self)
+
+ def blit_tiled(self, x, y, z, width, height):
+ """Blit this texture tiled over the given area.
+
+ The image will be tiled with the bottom-left corner of the destination
+ rectangle aligned with the anchor point of this texture.
+ """
+ u1 = self.anchor_x / self.width
+ v1 = self.anchor_y / self.height
+ u2 = u1 + width / self.width
+ v2 = v1 + height / self.height
+ w, h = width, height
+ t = self.tex_coords
+ array = (GLfloat * 32)(
+ u1, v1, t[2], 1.,
+ x, y, z, 1.,
+ u2, v1, t[5], 1.,
+ x + w, y, z, 1.,
+ u2, v2, t[8], 1.,
+ x + w, y + h, z, 1.,
+ u1, v2, t[11], 1.,
+ x, y + h, z, 1.)
+
+ glPushAttrib(GL_ENABLE_BIT)
+ glEnable(self.target)
+ glBindTexture(self.target, self.id)
+ glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
+ glInterleavedArrays(GL_T4F_V4F, 0, array)
+ glDrawArrays(GL_QUADS, 0, 4)
+ glPopClientAttrib()
+ glPopAttrib()
+
+ @classmethod
+ def create_for_image(cls, image):
+ if not _is_pow2(image.width) or not _is_pow2(image.height):
+ # Potentially unnecessary conversion if a GL format exists.
+ image = image.get_image_data()
+ texture_width = _nearest_pow2(image.width)
+ texture_height = _nearest_pow2(image.height)
+ newdata = c_buffer(texture_width * texture_height * 4)
+ gluScaleImage(GL_RGBA,
+ image.width, image.height,
+ GL_UNSIGNED_BYTE,
+ image.get_data('RGBA', image.width * 4),
+ texture_width,
+ texture_height,
+ GL_UNSIGNED_BYTE,
+ newdata)
+ image = ImageData(texture_width, texture_height, 'RGBA',
+ newdata)
+
+ image = image.get_image_data()
+ return image.create_texture(cls)
+
+
+class DepthTexture(Texture):
+ """A texture with depth samples (typically 24-bit)."""
+
+ def blit_into(self, source, x, y, z):
+ glBindTexture(self.target, self.id)
+ source.blit_to_texture(self.level, x, y, z)
+
+
+class BufferManager(object):
+ """Manages the set of framebuffers for a context.
+
+ Use :py:func:`~pyglet.image.get_buffer_manager` to obtain the instance of this class for the
+ current context.
+ """
+
+ def __init__(self):
+ self.color_buffer = None
+ self.depth_buffer = None
+
+ aux_buffers = GLint()
+ glGetIntegerv(GL_AUX_BUFFERS, byref(aux_buffers))
+ self.free_aux_buffers = [GL_AUX0,
+ GL_AUX1,
+ GL_AUX2,
+ GL_AUX3][:aux_buffers.value]
+
+ stencil_bits = GLint()
+ glGetIntegerv(GL_STENCIL_BITS, byref(stencil_bits))
+ self.free_stencil_bits = list(range(stencil_bits.value))
+
+ self.refs = []
+
+ def get_viewport(self):
+ """Get the current OpenGL viewport dimensions.
+
+ :rtype: 4-tuple of float.
+ :return: Left, top, right and bottom dimensions.
+ """
+ viewport = (GLint * 4)()
+ glGetIntegerv(GL_VIEWPORT, viewport)
+ return viewport
+
+ def get_color_buffer(self):
+ """Get the color buffer.
+
+ :rtype: :py:class:`~pyglet.image.ColorBufferImage`
+ """
+ viewport = self.get_viewport()
+ viewport_width = viewport[2]
+ viewport_height = viewport[3]
+ if (not self.color_buffer or
+ viewport_width != self.color_buffer.width or
+ viewport_height != self.color_buffer.height):
+ self.color_buffer = ColorBufferImage(*viewport)
+ return self.color_buffer
+
+ def get_aux_buffer(self):
+ """Get a free auxiliary buffer.
+
+ If not aux buffers are available, `ImageException` is raised. Buffers
+ are released when they are garbage collected.
+
+ :rtype: :py:class:`~pyglet.image.ColorBufferImage`
+ """
+ if not self.free_aux_buffers:
+ raise ImageException('No free aux buffer is available.')
+
+ gl_buffer = self.free_aux_buffers.pop(0)
+ viewport = self.get_viewport()
+ buffer = ColorBufferImage(*viewport)
+ buffer.gl_buffer = gl_buffer
+
+ def release_buffer(ref, self=self):
+ self.free_aux_buffers.insert(0, gl_buffer)
+
+ self.refs.append(weakref.ref(buffer, release_buffer))
+
+ return buffer
+
+ def get_depth_buffer(self):
+ """Get the depth buffer.
+
+ :rtype: :py:class:`~pyglet.image.DepthBufferImage`
+ """
+ viewport = self.get_viewport()
+ viewport_width = viewport[2]
+ viewport_height = viewport[3]
+ if (not self.depth_buffer or
+ viewport_width != self.depth_buffer.width or
+ viewport_height != self.depth_buffer.height):
+ self.depth_buffer = DepthBufferImage(*viewport)
+ return self.depth_buffer
+
+ def get_buffer_mask(self):
+ """Get a free bitmask buffer.
+
+ A bitmask buffer is a buffer referencing a single bit in the stencil
+ buffer. If no bits are free, `ImageException` is raised. Bits are
+ released when the bitmask buffer is garbage collected.
+
+ :rtype: :py:class:`~pyglet.image.BufferImageMask`
+ """
+ if not self.free_stencil_bits:
+ raise ImageException('No free stencil bits are available.')
+
+ stencil_bit = self.free_stencil_bits.pop(0)
+ x, y, width, height = self.get_viewport()
+ buffer = BufferImageMask(x, y, width, height)
+ buffer.stencil_bit = stencil_bit
+
+ def release_buffer(ref, self=self):
+ self.free_stencil_bits.insert(0, stencil_bit)
+
+ self.refs.append(weakref.ref(buffer, release_buffer))
+
+ return buffer
+
+
+def get_buffer_manager():
+ """Get the buffer manager for the current OpenGL context.
+
+ :rtype: :py:class:`~pyglet.image.BufferManager`
+ """
+ context = gl.current_context
+ if not hasattr(context, 'image_buffer_manager'):
+ context.image_buffer_manager = BufferManager()
+ return context.image_buffer_manager
+
+
+# XXX BufferImage could be generalised to support EXT_framebuffer_object's
+# renderbuffer.
+class BufferImage(AbstractImage):
+ """An abstract framebuffer.
+ """
+ #: The OpenGL read and write target for this buffer.
+ gl_buffer = GL_BACK
+
+ #: The OpenGL format constant for image data.
+ gl_format = 0
+
+ #: The format string used for image data.
+ format = ''
+
+ owner = None
+
+ # TODO: enable methods
+
+ def __init__(self, x, y, width, height):
+ self.x = x
+ self.y = y
+ self.width = width
+ self.height = height
+
+ def get_image_data(self):
+ buffer = (GLubyte * (len(self.format) * self.width * self.height))()
+
+ x = self.x
+ y = self.y
+ if self.owner:
+ x += self.owner.x
+ y += self.owner.y
+
+ glReadBuffer(self.gl_buffer)
+ glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT)
+ glPixelStorei(GL_PACK_ALIGNMENT, 1)
+ glReadPixels(x, y, self.width, self.height,
+ self.gl_format, GL_UNSIGNED_BYTE, buffer)
+ glPopClientAttrib()
+
+ return ImageData(self.width, self.height, self.format, buffer)
+
+ def get_region(self, x, y, width, height):
+ if self.owner:
+ return self.owner.get_region(x + self.x, y + self.y, width, height)
+
+ region = self.__class__(x + self.x, y + self.y, width, height)
+ region.gl_buffer = self.gl_buffer
+ region.owner = self
+ return region
+
+
+class ColorBufferImage(BufferImage):
+ """A color framebuffer.
+
+ This class is used to wrap both the primary color buffer (i.e., the back
+ buffer) or any one of the auxiliary buffers.
+ """
+ gl_format = GL_RGBA
+ format = 'RGBA'
+
+ def get_texture(self, rectangle=False, force_rectangle=False):
+ texture = Texture.create(self.width, self.height, GL_RGBA,
+ rectangle, force_rectangle)
+ self.blit_to_texture(texture.target, texture.level,
+ self.anchor_x, self.anchor_y, 0)
+ return texture
+
+ def blit_to_texture(self, target, level, x, y, z):
+ glReadBuffer(self.gl_buffer)
+ glCopyTexSubImage2D(target, level,
+ x - self.anchor_x, y - self.anchor_y,
+ self.x, self.y, self.width, self.height)
+
+
+class DepthBufferImage(BufferImage):
+ """The depth buffer.
+ """
+ gl_format = GL_DEPTH_COMPONENT
+ format = 'L'
+
+ def get_texture(self, rectangle=False, force_rectangle=False):
+ assert rectangle == False and force_rectangle == False, \
+ 'Depth textures cannot be rectangular'
+ if not _is_pow2(self.width) or not _is_pow2(self.height):
+ raise ImageException(
+ 'Depth texture requires that buffer dimensions be powers of 2')
+
+ texture = DepthTexture.create_for_size(GL_TEXTURE_2D,
+ self.width, self.height)
+ if self.anchor_x or self.anchor_y:
+ texture.anchor_x = self.anchor_x
+ texture.anchor_y = self.anchor_y
+
+ glReadBuffer(self.gl_buffer)
+ glCopyTexImage2D(texture.target, 0,
+ GL_DEPTH_COMPONENT,
+ self.x, self.y, self.width, self.height,
+ 0)
+ return texture
+
+ def blit_to_texture(self, target, level, x, y, z):
+ glReadBuffer(self.gl_buffer)
+ glCopyTexSubImage2D(target, level,
+ x - self.anchor_x, y - self.anchor_y,
+ self.x, self.y, self.width, self.height)
+
+
+class BufferImageMask(BufferImage):
+ """A single bit of the stencil buffer.
+ """
+ gl_format = GL_STENCIL_INDEX
+ format = 'L'
+
+ # TODO mask methods
+
+
+class ImageGrid(AbstractImage, AbstractImageSequence):
+ """An imaginary grid placed over an image allowing easy access to
+ regular regions of that image.
+
+ The grid can be accessed either as a complete image, or as a sequence
+ of images. The most useful applications are to access the grid
+ as a :py:class:`~pyglet.image.TextureGrid`::
+
+ image_grid = ImageGrid(...)
+ texture_grid = image_grid.get_texture_sequence()
+
+ or as a :py:class:`~pyglet.image.Texture3D`::
+
+ image_grid = ImageGrid(...)
+ texture_3d = Texture3D.create_for_image_grid(image_grid)
+
+ """
+ _items = ()
+ _texture_grid = None
+
+ def __init__(self, image, rows, columns,
+ item_width=None, item_height=None,
+ row_padding=0, column_padding=0):
+ """Construct a grid for the given image.
+
+ You can specify parameters for the grid, for example setting
+ the padding between cells. Grids are always aligned to the
+ bottom-left corner of the image.
+
+ :Parameters:
+ `image` : AbstractImage
+ Image over which to construct the grid.
+ `rows` : int
+ Number of rows in the grid.
+ `columns` : int
+ Number of columns in the grid.
+ `item_width` : int
+ Width of each column. If unspecified, is calculated such
+ that the entire image width is used.
+ `item_height` : int
+ Height of each row. If unspecified, is calculated such that
+ the entire image height is used.
+ `row_padding` : int
+ Pixels separating adjacent rows. The padding is only
+ inserted between rows, not at the edges of the grid.
+ `column_padding` : int
+ Pixels separating adjacent columns. The padding is only
+ inserted between columns, not at the edges of the grid.
+ """
+ super(ImageGrid, self).__init__(image.width, image.height)
+
+ if item_width is None:
+ item_width = \
+ (image.width - column_padding * (columns - 1)) // columns
+ if item_height is None:
+ item_height = \
+ (image.height - row_padding * (rows - 1)) // rows
+ self.image = image
+ self.rows = rows
+ self.columns = columns
+ self.item_width = item_width
+ self.item_height = item_height
+ self.row_padding = row_padding
+ self.column_padding = column_padding
+
+ def get_texture(self, rectangle=False, force_rectangle=False):
+ return self.image.get_texture(rectangle, force_rectangle)
+
+ def get_image_data(self):
+ return self.image.get_image_data()
+
+ def get_texture_sequence(self):
+ if not self._texture_grid:
+ self._texture_grid = TextureGrid(self)
+ return self._texture_grid
+
+ def __len__(self):
+ return self.rows * self.columns
+
+ def _update_items(self):
+ if not self._items:
+ self._items = []
+ y = 0
+ for row in range(self.rows):
+ x = 0
+ for col in range(self.columns):
+ self._items.append(self.image.get_region(
+ x, y, self.item_width, self.item_height))
+ x += self.item_width + self.column_padding
+ y += self.item_height + self.row_padding
+
+ def __getitem__(self, index):
+ self._update_items()
+ if type(index) is tuple:
+ row, column = index
+ assert row >= 0 and column >= 0 and row < self.rows and column < self.columns
+ return self._items[row * self.columns + column]
+ else:
+ return self._items[index]
+
+ def __iter__(self):
+ self._update_items()
+ return iter(self._items)
+
+
+class TextureGrid(TextureRegion, UniformTextureSequence):
+ """A texture containing a regular grid of texture regions.
+
+ To construct, create an :py:class:`~pyglet.image.ImageGrid` first::
+
+ image_grid = ImageGrid(...)
+ texture_grid = TextureGrid(image_grid)
+
+ The texture grid can be accessed as a single texture, or as a sequence
+ of :py:class:`~pyglet.image.TextureRegion`. When accessing as a sequence, you can specify
+ integer indexes, in which the images are arranged in rows from the
+ bottom-left to the top-right::
+
+ # assume the texture_grid is 3x3:
+ current_texture = texture_grid[3] # get the middle-left image
+
+ You can also specify tuples in the sequence methods, which are addressed
+ as ``row, column``::
+
+ # equivalent to the previous example:
+ current_texture = texture_grid[1, 0]
+
+ When using tuples in a slice, the returned sequence is over the
+ rectangular region defined by the slice::
+
+ # returns center, center-right, center-top, top-right images in that
+ # order:
+ images = texture_grid[(1,1):]
+ # equivalent to
+ images = texture_grid[(1,1):(3,3)]
+
+ """
+ items = ()
+ rows = 1
+ columns = 1
+ item_width = 0
+ item_height = 0
+
+ def __init__(self, grid):
+ image = grid.get_texture()
+ if isinstance(image, TextureRegion):
+ owner = image.owner
+ else:
+ owner = image
+
+ super(TextureGrid, self).__init__(
+ image.x, image.y, image.z, image.width, image.height, owner)
+
+ items = []
+ y = 0
+ for row in range(grid.rows):
+ x = 0
+ for col in range(grid.columns):
+ items.append(
+ self.get_region(x, y, grid.item_width, grid.item_height))
+ x += grid.item_width + grid.column_padding
+ y += grid.item_height + grid.row_padding
+
+ self.items = items
+ self.rows = grid.rows
+ self.columns = grid.columns
+ self.item_width = grid.item_width
+ self.item_height = grid.item_height
+
+ def get(self, row, column):
+ return self[(row, column)]
+
+ def __getitem__(self, index):
+ if type(index) is slice:
+ if type(index.start) is not tuple and \
+ type(index.stop) is not tuple:
+ return self.items[index]
+ else:
+ row1 = 0
+ col1 = 0
+ row2 = self.rows
+ col2 = self.columns
+ if type(index.start) is tuple:
+ row1, col1 = index.start
+ elif type(index.start) is int:
+ row1 = index.start // self.columns
+ col1 = index.start % self.columns
+ assert row1 >= 0 and col1 >= 0 and row1 < self.rows and col1 < self.columns
+
+ if type(index.stop) is tuple:
+ row2, col2 = index.stop
+ elif type(index.stop) is int:
+ row2 = index.stop // self.columns
+ col2 = index.stop % self.columns
+ assert row2 >= 0 and col2 >= 0 and row2 <= self.rows and col2 <= self.columns
+
+ result = []
+ i = row1 * self.columns
+ for row in range(row1, row2):
+ result += self.items[i + col1:i + col2]
+ i += self.columns
+ return result
+ else:
+ if type(index) is tuple:
+ row, column = index
+ assert row >= 0 and column >= 0 and row < self.rows and column < self.columns
+ return self.items[row * self.columns + column]
+ elif type(index) is int:
+ return self.items[index]
+
+ def __setitem__(self, index, value):
+ if type(index) is slice:
+ for region, image in zip(self[index], value):
+ if image.width != self.item_width or image.height != self.item_height:
+ raise ImageException('Image has incorrect dimensions')
+ image.blit_into(region, image.anchor_x, image.anchor_y, 0)
+ else:
+ image = value
+ if image.width != self.item_width or image.height != self.item_height:
+ raise ImageException('Image has incorrect dimensions')
+ image.blit_into(self[index], image.anchor_x, image.anchor_y, 0)
+
+ def __len__(self):
+ return len(self.items)
+
+ def __iter__(self):
+ return iter(self.items)
+
+
+# --------------------------------------------------------------------------
+# Animation stuff here. Vote on if this should be in pyglet.image.animation
+# or just leave it tacked on here.
+
+# TODO:
+# conversion Animation -> media.Source
+# move to another module?
+# pyglet.animation?
+# pyglet.image.animation?
+
+def load_animation(filename, file=None, decoder=None):
+ """Load an animation from a file.
+
+ Currently, the only supported format is GIF.
+
+ :Parameters:
+ `filename` : str
+ Used to guess the animation format, and to load the file if `file`
+ is unspecified.
+ `file` : file-like object or None
+ File object containing the animation stream.
+ `decoder` : ImageDecoder or None
+ If unspecified, all decoders that are registered for the filename
+ extension are tried. If none succeed, the exception from the
+ first decoder is raised.
+
+ :rtype: Animation
+ """
+ if not file:
+ file = open(filename, 'rb')
+ if not hasattr(file, 'seek'):
+ file = BytesIO(file.read())
+
+ if decoder:
+ return decoder.decode(file, filename)
+ else:
+ first_exception = None
+ for decoder in _codecs.get_animation_decoders(filename):
+ try:
+ image = decoder.decode_animation(file, filename)
+ return image
+ except _codecs.ImageDecodeException as e:
+ first_exception = first_exception or e
+ file.seek(0)
+
+ if not first_exception:
+ raise _codecs.ImageDecodeException('No image decoders are available')
+ raise first_exception
+
+
+class Animation(object):
+ """Sequence of images with timing information.
+
+ If no frames of the animation have a duration of ``None``, the animation
+ loops continuously; otherwise the animation stops at the first frame with
+ duration of ``None``.
+
+ :Ivariables:
+ `frames` : list of `~pyglet.image.AnimationFrame`
+ The frames that make up the animation.
+
+ """
+
+ def __init__(self, frames):
+ """Create an animation directly from a list of frames.
+
+ :Parameters:
+ `frames` : list of `~pyglet.image.AnimationFrame`
+ The frames that make up the animation.
+
+ """
+ assert len(frames)
+ self.frames = frames
+
+ def add_to_texture_bin(self, bin):
+ """Add the images of the animation to a :py:class:`~pyglet.image.atlas.TextureBin`.
+
+ The animation frames are modified in-place to refer to the texture bin
+ regions.
+
+ :Parameters:
+ `bin` : `~pyglet.image.atlas.TextureBin`
+ Texture bin to upload animation frames into.
+
+ """
+ for frame in self.frames:
+ frame.image = bin.add(frame.image)
+
+ def get_transform(self, flip_x=False, flip_y=False, rotate=0):
+ """Create a copy of this animation applying a simple transformation.
+
+ The transformation is applied around the image's anchor point of
+ each frame. The texture data is shared between the original animation
+ and the transformed animation.
+
+ :Parameters:
+ `flip_x` : bool
+ If True, the returned animation will be flipped horizontally.
+ `flip_y` : bool
+ If True, the returned animation will be flipped vertically.
+ `rotate` : int
+ Degrees of clockwise rotation of the returned animation. Only
+ 90-degree increments are supported.
+
+ :rtype: :py:class:`~pyglet.image.Animation`
+ """
+ frames = [AnimationFrame(frame.image.get_texture().get_transform(flip_x, flip_y, rotate),
+ frame.duration) for frame in self.frames]
+ return Animation(frames)
+
+ def get_duration(self):
+ """Get the total duration of the animation in seconds.
+
+ :rtype: float
+ """
+ return sum([frame.duration for frame in self.frames if frame.duration is not None])
+
+ def get_max_width(self):
+ """Get the maximum image frame width.
+
+ This method is useful for determining texture space requirements: due
+ to the use of ``anchor_x`` the actual required playback area may be
+ larger.
+
+ :rtype: int
+ """
+ return max([frame.image.width for frame in self.frames])
+
+ def get_max_height(self):
+ """Get the maximum image frame height.
+
+ This method is useful for determining texture space requirements: due
+ to the use of ``anchor_y`` the actual required playback area may be
+ larger.
+
+ :rtype: int
+ """
+ return max([frame.image.height for frame in self.frames])
+
+ @classmethod
+ def from_image_sequence(cls, sequence, period, loop=True):
+ """Create an animation from a list of images and a constant framerate.
+
+ :Parameters:
+ `sequence` : list of `~pyglet.image.AbstractImage`
+ Images that make up the animation, in sequence.
+ `period` : float
+ Number of seconds to display each image.
+ `loop` : bool
+ If True, the animation will loop continuously.
+
+ :rtype: :py:class:`~pyglet.image.Animation`
+ """
+ frames = [AnimationFrame(image, period) for image in sequence]
+ if not loop:
+ frames[-1].duration = None
+ return cls(frames)
+
+
+class AnimationFrame(object):
+ """A single frame of an animation.
+ """
+
+ def __init__(self, image, duration):
+ """Create an animation frame from an image.
+
+ :Parameters:
+ `image` : `~pyglet.image.AbstractImage`
+ The image of this frame.
+ `duration` : float
+ Number of seconds to display the frame, or ``None`` if it is
+ the last frame in the animation.
+
+ """
+ self.image = image
+ self.duration = duration
+
+ def __repr__(self):
+ return 'AnimationFrame(%r, %r)' % (self.image, self.duration)
+
+
+# Initialise default codecs
+_codecs.add_default_image_codecs()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/atlas.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/atlas.py
new file mode 100644
index 0000000..04209dc
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/atlas.py
@@ -0,0 +1,281 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+"""Group multiple small images into larger textures.
+
+This module is used by :py:mod:`pyglet.resource` to efficiently pack small
+images into larger textures. :py:class:`~pyglet.image.atlas.TextureAtlas` maintains one texture;
+:py:class:`TextureBin` manages a collection of atlases of a given size.
+
+Example usage::
+
+ # Load images from disk
+ car_image = pyglet.image.load('car.png')
+ boat_image = pyglet.image.load('boat.png')
+
+ # Pack these images into one or more textures
+ bin = TextureBin()
+ car_texture = bin.add(car_image)
+ boat_texture = bin.add(boat_image)
+
+The result of :py:meth:`TextureBin.add` is a :py:class:`TextureRegion`
+containing the image. Once added, an image cannot be removed from a bin (or an
+atlas); nor can a list of images be obtained from a given bin or atlas -- it is
+the application's responsibility to keep track of the regions returned by the
+``add`` methods.
+
+.. versionadded:: 1.1
+"""
+from __future__ import division
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+from ctypes import c_int
+
+import pyglet
+
+
+def get_max_texture_size():
+ """Query the maximum texture size available"""
+ size = c_int()
+ pyglet.gl.glGetIntegerv(pyglet.gl.GL_MAX_TEXTURE_SIZE, size)
+ return size.value
+
+
+class AllocatorException(Exception):
+ """The allocator does not have sufficient free space for the requested
+ image size."""
+ pass
+
+
+class _Strip(object):
+ def __init__(self, y, max_height):
+ self.x = 0
+ self.y = y
+ self.max_height = max_height
+ self.y2 = y
+
+ def add(self, width, height):
+ assert width > 0 and height > 0
+ assert height <= self.max_height
+
+ x, y = self.x, self.y
+ self.x += width
+ self.y2 = max(self.y + height, self.y2)
+ return x, y
+
+ def compact(self):
+ self.max_height = self.y2 - self.y
+
+
+class Allocator(object):
+ """Rectangular area allocation algorithm.
+
+ Initialise with a given ``width`` and ``height``, then repeatedly
+ call `alloc` to retrieve free regions of the area and protect that
+ area from future allocations.
+
+ `Allocator` uses a fairly simple strips-based algorithm. It performs best
+ when rectangles are allocated in decreasing height order.
+ """
+ def __init__(self, width, height):
+ """Create an `Allocator` of the given size.
+
+ :Parameters:
+ `width` : int
+ Width of the allocation region.
+ `height` : int
+ Height of the allocation region.
+
+ """
+ assert width > 0 and height > 0
+ self.width = width
+ self.height = height
+ self.strips = [_Strip(0, height)]
+ self.used_area = 0
+
+ def alloc(self, width, height):
+ """Get a free area in the allocator of the given size.
+
+ After calling `alloc`, the requested area will no longer be used.
+ If there is not enough room to fit the given area `AllocatorException`
+ is raised.
+
+ :Parameters:
+ `width` : int
+ Width of the area to allocate.
+ `height` : int
+ Height of the area to allocate.
+
+ :rtype: int, int
+ :return: The X and Y coordinates of the bottom-left corner of the
+ allocated region.
+ """
+ for strip in self.strips:
+ if self.width - strip.x >= width and strip.max_height >= height:
+ self.used_area += width * height
+ return strip.add(width, height)
+
+ if self.width >= width and self.height - strip.y2 >= height:
+ self.used_area += width * height
+ strip.compact()
+ newstrip = _Strip(strip.y2, self.height - strip.y2)
+ self.strips.append(newstrip)
+ return newstrip.add(width, height)
+
+ raise AllocatorException('No more space in %r for box %dx%d' % (
+ self, width, height))
+
+ def get_usage(self):
+ """Get the fraction of area already allocated.
+
+ This method is useful for debugging and profiling only.
+
+ :rtype: float
+ """
+ return self.used_area / float(self.width * self.height)
+
+ def get_fragmentation(self):
+ """Get the fraction of area that's unlikely to ever be used, based on
+ current allocation behaviour.
+
+ This method is useful for debugging and profiling only.
+
+ :rtype: float
+ """
+ # The total unused area in each compacted strip is summed.
+ if not self.strips:
+ return 0.
+ possible_area = self.strips[-1].y2 * self.width
+ return 1.0 - self.used_area / float(possible_area)
+
+
+class TextureAtlas(object):
+ """Collection of images within a texture."""
+ def __init__(self, width=2048, height=2048):
+ """Create a texture atlas of the given size.
+
+ :Parameters:
+ `width` : int
+ Width of the underlying texture.
+ `height` : int
+ Height of the underlying texture.
+
+ """
+ max_texture_size = get_max_texture_size()
+ width = min(width, max_texture_size)
+ height = min(height, max_texture_size)
+
+ self.texture = pyglet.image.Texture.create(
+ width, height, pyglet.gl.GL_RGBA, rectangle=True)
+ self.allocator = Allocator(width, height)
+
+ def add(self, img):
+ """Add an image to the atlas.
+
+ This method will fail if the given image cannot be transferred
+ directly to a texture (for example, if it is another texture).
+ :py:class:`~pyglet.image.ImageData` is the usual image type for this method.
+
+ `AllocatorException` will be raised if there is no room in the atlas
+ for the image.
+
+ :Parameters:
+ `img` : `~pyglet.image.AbstractImage`
+ The image to add.
+
+ :rtype: :py:class:`~pyglet.image.TextureRegion`
+ :return: The region of the atlas containing the newly added image.
+ """
+ x, y = self.allocator.alloc(img.width, img.height)
+ self.texture.blit_into(img, x, y, 0)
+ region = self.texture.get_region(x, y, img.width, img.height)
+ return region
+
+
+class TextureBin(object):
+ """Collection of texture atlases.
+
+ :py:class:`~pyglet.image.atlas.TextureBin` maintains a collection of texture atlases, and creates new
+ ones as necessary to accommodate images added to the bin.
+ """
+ def __init__(self, texture_width=2048, texture_height=2048):
+ """Create a texture bin for holding atlases of the given size.
+
+ :Parameters:
+ `texture_width` : int
+ Width of texture atlases to create.
+ `texture_height` : int
+ Height of texture atlases to create.
+
+ """
+ max_texture_size = get_max_texture_size()
+ texture_width = min(texture_width, max_texture_size)
+ texture_height = min(texture_height, max_texture_size)
+
+ self.atlases = []
+ self.texture_width = texture_width
+ self.texture_height = texture_height
+
+ def add(self, img):
+ """Add an image into this texture bin.
+
+ This method calls `TextureAtlas.add` for the first atlas that has room
+ for the image.
+
+ `AllocatorException` is raised if the image exceeds the dimensions of
+ ``texture_width`` and ``texture_height``.
+
+ :Parameters:
+ `img` : `~pyglet.image.AbstractImage`
+ The image to add.
+
+ :rtype: :py:class:`~pyglet.image.TextureRegion`
+ :return: The region of an atlas containing the newly added image.
+ """
+ for atlas in list(self.atlases):
+ try:
+ return atlas.add(img)
+ except AllocatorException:
+ # Remove atlases that are no longer useful (this is so their
+ # textures can later be freed if the images inside them get
+ # collected).
+ if img.width < 64 and img.height < 64:
+ self.atlases.remove(atlas)
+
+ atlas = TextureAtlas(self.texture_width, self.texture_height)
+ self.atlases.append(atlas)
+ return atlas.add(img)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/__init__.py
new file mode 100644
index 0000000..88d9ef9
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/__init__.py
@@ -0,0 +1,243 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Collection of image encoders and decoders.
+
+Modules must subclass ImageDecoder and ImageEncoder for each method of
+decoding/encoding they support.
+
+Modules must also implement the two functions::
+
+ def get_decoders():
+ # Return a list of ImageDecoder instances or []
+ return []
+
+ def get_encoders():
+ # Return a list of ImageEncoder instances or []
+ return []
+
+'''
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import os.path
+from pyglet import compat_platform
+
+_decoders = [] # List of registered ImageDecoders
+_decoder_extensions = {} # Map str -> list of matching ImageDecoders
+_decoder_animation_extensions = {}
+ # Map str -> list of matching ImageDecoders
+_encoders = [] # List of registered ImageEncoders
+_encoder_extensions = {} # Map str -> list of matching ImageEncoders
+
+class ImageDecodeException(Exception):
+ exception_priority = 10
+
+class ImageEncodeException(Exception):
+ pass
+
+class ImageDecoder(object):
+ def get_file_extensions(self):
+ '''Return a list of accepted file extensions, e.g. ['.png', '.bmp']
+ Lower-case only.
+ '''
+ return []
+
+ def get_animation_file_extensions(self):
+ '''Return a list of accepted file extensions, e.g. ['.gif', '.flc']
+ Lower-case only.
+ '''
+ return []
+
+ def decode(self, file, filename):
+ '''Decode the given file object and return an instance of `Image`.
+ Throws ImageDecodeException if there is an error. filename
+ can be a file type hint.
+ '''
+ raise NotImplementedError()
+
+ def decode_animation(self, file, filename):
+ '''Decode the given file object and return an instance of :py:class:`~pyglet.image.Animation`.
+ Throws ImageDecodeException if there is an error. filename
+ can be a file type hint.
+ '''
+ raise ImageDecodeException('This decoder cannot decode animations.')
+
+class ImageEncoder(object):
+ def get_file_extensions(self):
+ '''Return a list of accepted file extensions, e.g. ['.png', '.bmp']
+ Lower-case only.
+ '''
+ return []
+
+ def encode(self, image, file, filename, options={}):
+ '''Encode the given image to the given file. filename
+ provides a hint to the file format desired. options are
+ encoder-specific, and unknown options should be ignored or
+ issue warnings.
+ '''
+ raise NotImplementedError()
+
+def get_encoders(filename=None):
+ '''Get an ordered list of encoders to attempt. filename can be used
+ as a hint for the filetype.
+ '''
+ encoders = []
+ if filename:
+ extension = os.path.splitext(filename)[1].lower()
+ encoders += _encoder_extensions.get(extension, [])
+ encoders += [e for e in _encoders if e not in encoders]
+ return encoders
+
+def get_decoders(filename=None):
+ '''Get an ordered list of decoders to attempt. filename can be used
+ as a hint for the filetype.
+ '''
+ decoders = []
+ if filename:
+ extension = os.path.splitext(filename)[1].lower()
+ decoders += _decoder_extensions.get(extension, [])
+ decoders += [e for e in _decoders if e not in decoders]
+ return decoders
+
+def get_animation_decoders(filename=None):
+ '''Get an ordered list of decoders to attempt. filename can be used
+ as a hint for the filetype.
+ '''
+ decoders = []
+ if filename:
+ extension = os.path.splitext(filename)[1].lower()
+ decoders += _decoder_animation_extensions.get(extension, [])
+ decoders += [e for e in _decoders if e not in decoders]
+ return decoders
+
+def add_decoders(module):
+ '''Add a decoder module. The module must define `get_decoders`. Once
+ added, the appropriate decoders defined in the codec will be returned by
+ pyglet.image.codecs.get_decoders.
+ '''
+ for decoder in module.get_decoders():
+ _decoders.append(decoder)
+ for extension in decoder.get_file_extensions():
+ if extension not in _decoder_extensions:
+ _decoder_extensions[extension] = []
+ _decoder_extensions[extension].append(decoder)
+ for extension in decoder.get_animation_file_extensions():
+ if extension not in _decoder_animation_extensions:
+ _decoder_animation_extensions[extension] = []
+ _decoder_animation_extensions[extension].append(decoder)
+
+def add_encoders(module):
+ '''Add an encoder module. The module must define `get_encoders`. Once
+ added, the appropriate encoders defined in the codec will be returned by
+ pyglet.image.codecs.get_encoders.
+ '''
+ for encoder in module.get_encoders():
+ _encoders.append(encoder)
+ for extension in encoder.get_file_extensions():
+ if extension not in _encoder_extensions:
+ _encoder_extensions[extension] = []
+ _encoder_extensions[extension].append(encoder)
+
+def add_default_image_codecs():
+ # Add the codecs we know about. These should be listed in order of
+ # preference. This is called automatically by pyglet.image.
+
+ # Compressed texture in DDS format
+ try:
+ from pyglet.image.codecs import dds
+ add_encoders(dds)
+ add_decoders(dds)
+ except ImportError:
+ pass
+
+ # Mac OS X default: Quicktime for Carbon, Quartz for Cocoa.
+ # TODO: Make ctypes Quartz the default for both Carbon & Cocoa.
+ if compat_platform == 'darwin':
+ try:
+ from pyglet import options as pyglet_options
+ if pyglet_options['darwin_cocoa']:
+ import pyglet.image.codecs.quartz
+ add_encoders(quartz)
+ add_decoders(quartz)
+ else:
+ import pyglet.image.codecs.quicktime
+ add_encoders(quicktime)
+ add_decoders(quicktime)
+ except ImportError:
+ pass
+
+ # Windows XP default: GDI+
+ if compat_platform in ('win32', 'cygwin'):
+ try:
+ import pyglet.image.codecs.gdiplus
+ add_encoders(gdiplus)
+ add_decoders(gdiplus)
+ except ImportError:
+ pass
+
+ # Linux default: GdkPixbuf 2.0
+ if compat_platform.startswith('linux'):
+ try:
+ import pyglet.image.codecs.gdkpixbuf2
+ add_encoders(gdkpixbuf2)
+ add_decoders(gdkpixbuf2)
+ except ImportError:
+ pass
+
+ # Fallback: PIL
+ try:
+ import pyglet.image.codecs.pil
+ add_encoders(pil)
+ add_decoders(pil)
+ except ImportError:
+ pass
+
+ # Fallback: PNG loader (slow)
+ try:
+ import pyglet.image.codecs.png
+ add_encoders(png)
+ add_decoders(png)
+ except ImportError:
+ pass
+
+ # Fallback: BMP loader (slow)
+ try:
+ import pyglet.image.codecs.bmp
+ add_encoders(bmp)
+ add_decoders(bmp)
+ except ImportError:
+ pass
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/bmp.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/bmp.py
new file mode 100644
index 0000000..d2130db
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/bmp.py
@@ -0,0 +1,360 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Decoder for BMP files.
+
+Currently supports version 3 and 4 bitmaps with BI_RGB and BI_BITFIELDS
+encoding. Alpha channel is supported for 32-bit BI_RGB only.
+'''
+from builtins import range
+
+# Official docs are at
+# http://msdn2.microsoft.com/en-us/library/ms532311.aspx
+#
+# But some details including alignment and bit/byte order are omitted; see
+# http://www.fileformat.info/format/bmp/egff.htm
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import ctypes
+
+from pyglet.image import ImageData
+from pyglet.image.codecs import ImageDecoder, ImageDecodeException
+
+BYTE = ctypes.c_ubyte
+WORD = ctypes.c_uint16
+DWORD = ctypes.c_uint32
+LONG = ctypes.c_int32
+FXPT2DOT30 = ctypes.c_uint32
+
+BI_RGB = 0
+BI_RLE8 = 1
+BI_RLE4 = 2
+BI_BITFIELDS = 3
+
+class BITMAPFILEHEADER(ctypes.LittleEndianStructure):
+ _pack_ = 1
+ _fields_ = [
+ ('bfType', WORD),
+ ('bfSize', DWORD),
+ ('bfReserved1', WORD),
+ ('bfReserved2', WORD),
+ ('bfOffBits', DWORD)
+ ]
+
+class BITMAPINFOHEADER(ctypes.LittleEndianStructure):
+ _pack_ = 1
+ _fields_ = [
+ ('biSize', DWORD),
+ ('biWidth', LONG),
+ ('biHeight', LONG),
+ ('biPlanes', WORD),
+ ('biBitCount', WORD),
+ ('biCompression', DWORD),
+ ('biSizeImage', DWORD),
+ ('biXPelsPerMeter', LONG),
+ ('biYPelsPerMeter', LONG),
+ ('biClrUsed', DWORD),
+ ('biClrImportant', DWORD)
+ ]
+
+CIEXYZTRIPLE = FXPT2DOT30 * 9
+
+class BITMAPV4HEADER(ctypes.LittleEndianStructure):
+ _pack_ = 1
+ _fields_ = [
+ ('biSize', DWORD),
+ ('biWidth', LONG),
+ ('biHeight', LONG),
+ ('biPlanes', WORD),
+ ('biBitCount', WORD),
+ ('biCompression', DWORD),
+ ('biSizeImage', DWORD),
+ ('biXPelsPerMeter', LONG),
+ ('biYPelsPerMeter', LONG),
+ ('biClrUsed', DWORD),
+ ('biClrImportant', DWORD),
+ ('bV4RedMask', DWORD),
+ ('bV4GreenMask', DWORD),
+ ('bV4BlueMask', DWORD),
+ ('bV4AlphaMask', DWORD),
+ ('bV4CSType', DWORD),
+ ('bV4Endpoints', CIEXYZTRIPLE),
+ ('bV4GammaRed', DWORD),
+ ('bV4GammaGreen', DWORD),
+ ('bV4GammaBlue', DWORD),
+ ]
+
+class RGBFields(ctypes.LittleEndianStructure):
+ _pack_ = 1
+ _fields_ = [
+ ('red', DWORD),
+ ('green', DWORD),
+ ('blue', DWORD),
+ ]
+
+
+class RGBQUAD(ctypes.LittleEndianStructure):
+ _pack_ = 1
+ _fields_ = [
+ ('rgbBlue', BYTE),
+ ('rgbGreen', BYTE),
+ ('rgbRed', BYTE),
+ ('rgbReserved', BYTE)
+ ]
+
+ def __repr__(self):
+ return '<%d, %d, %d>' % (self.rgbRed, self.rgbGreen, self.rgbBlue)
+
+def ptr_add(ptr, offset):
+ address = ctypes.addressof(ptr.contents) + offset
+ return ctypes.pointer(type(ptr.contents).from_address(address))
+
+def to_ctypes(buffer, offset, type):
+ if offset + ctypes.sizeof(type) > len(buffer):
+ raise ImageDecodeException('BMP file is truncated')
+ ptr = ptr_add(ctypes.pointer(buffer), offset)
+ return ctypes.cast(ptr, ctypes.POINTER(type)).contents
+
+class BMPImageDecoder(ImageDecoder):
+ def get_file_extensions(self):
+ return ['.bmp']
+
+ def decode(self, file, filename):
+ if not file:
+ file = open(filename, 'rb')
+ bytes = file.read()
+ buffer = ctypes.c_buffer(bytes)
+
+ if bytes[:2] != b'BM':
+ raise ImageDecodeException(
+ 'Not a Windows bitmap file: %r' % (filename or file))
+
+ file_header = to_ctypes(buffer, 0, BITMAPFILEHEADER)
+ bits_offset = file_header.bfOffBits
+ info_header_offset = ctypes.sizeof(BITMAPFILEHEADER)
+ info_header = to_ctypes(buffer, info_header_offset, BITMAPINFOHEADER)
+ palette_offset = info_header_offset + info_header.biSize
+
+ if info_header.biSize < ctypes.sizeof(BITMAPINFOHEADER):
+ raise ImageDecodeException(
+ 'Unsupported BMP type: %r' % (filename or file))
+
+ width = info_header.biWidth
+ height = info_header.biHeight
+ if width <= 0 or info_header.biPlanes != 1:
+ raise ImageDecodeException(
+ 'BMP file has corrupt parameters: %r' % (filename or file))
+ pitch_sign = height < 0 and -1 or 1
+ height = abs(height)
+
+ compression = info_header.biCompression
+ if compression not in (BI_RGB, BI_BITFIELDS):
+ raise ImageDecodeException(
+ 'Unsupported compression: %r' % (filename or file))
+
+ clr_used = 0
+ bitcount = info_header.biBitCount
+ if bitcount == 1:
+ pitch = (width + 7) // 8
+ bits_type = ctypes.c_ubyte
+ decoder = decode_1bit
+ elif bitcount == 4:
+ pitch = (width + 1) // 2
+ bits_type = ctypes.c_ubyte
+ decoder = decode_4bit
+ elif bitcount == 8:
+ bits_type = ctypes.c_ubyte
+ pitch = width
+ decoder = decode_8bit
+ elif bitcount == 16:
+ pitch = width * 2
+ bits_type = ctypes.c_uint16
+ decoder = decode_bitfields
+ elif bitcount == 24:
+ pitch = width * 3
+ bits_type = ctypes.c_ubyte
+ decoder = decode_24bit
+ elif bitcount == 32:
+ pitch = width * 4
+ if compression == BI_RGB:
+ decoder = decode_32bit_rgb
+ bits_type = ctypes.c_ubyte
+ elif compression == BI_BITFIELDS:
+ decoder = decode_bitfields
+ bits_type = ctypes.c_uint32
+ else:
+ raise ImageDecodeException(
+ 'Unsupported compression: %r' % (filename or file))
+ else:
+ raise ImageDecodeException(
+ 'Unsupported bit count %d: %r' % (bitcount, filename or file))
+
+ pitch = (pitch + 3) & ~3
+ packed_width = pitch // ctypes.sizeof(bits_type)
+
+ if bitcount < 16 and compression == BI_RGB:
+ clr_used = info_header.biClrUsed or (1 << bitcount)
+ palette = to_ctypes(buffer, palette_offset, RGBQUAD * clr_used)
+ bits = to_ctypes(buffer, bits_offset,
+ bits_type * packed_width * height)
+ return decoder(bits, palette, width, height, pitch, pitch_sign)
+ elif bitcount >= 16 and compression == BI_RGB:
+ bits = to_ctypes(buffer, bits_offset,
+ bits_type * (packed_width * height))
+ return decoder(bits, None, width, height, pitch, pitch_sign)
+ elif compression == BI_BITFIELDS:
+ if info_header.biSize >= ctypes.sizeof(BITMAPV4HEADER):
+ info_header = to_ctypes(buffer, info_header_offset,
+ BITMAPV4HEADER)
+ r_mask = info_header.bV4RedMask
+ g_mask = info_header.bV4GreenMask
+ b_mask = info_header.bV4BlueMask
+ else:
+ fields_offset = info_header_offset + \
+ ctypes.sizeof(BITMAPINFOHEADER)
+ fields = to_ctypes(buffer, fields_offset, RGBFields)
+ r_mask = fields.red
+ g_mask = fields.green
+ b_mask = fields.blue
+ class _BitsArray(ctypes.LittleEndianStructure):
+ _pack_ = 1
+ _fields_ = [
+ ('data', bits_type * packed_width * height),
+ ]
+ bits = to_ctypes(buffer, bits_offset, _BitsArray).data
+ return decoder(bits, r_mask, g_mask, b_mask,
+ width, height, pitch, pitch_sign)
+
+def decode_1bit(bits, palette, width, height, pitch, pitch_sign):
+ rgb_pitch = (((pitch << 3) + 7) & ~0x7) * 3
+ buffer = (ctypes.c_ubyte * (height * rgb_pitch))()
+ i = 0
+ for row in bits:
+ for packed in row:
+ for _ in range(8):
+ rgb = palette[(packed & 0x80) >> 7]
+ buffer[i] = rgb.rgbRed
+ buffer[i + 1] = rgb.rgbGreen
+ buffer[i + 2] = rgb.rgbBlue
+ i += 3
+ packed <<= 1
+
+ return ImageData(width, height, 'RGB', buffer, pitch_sign * rgb_pitch)
+
+def decode_4bit(bits, palette, width, height, pitch, pitch_sign):
+ rgb_pitch = (((pitch << 1) + 1) & ~0x1) * 3
+ buffer = (ctypes.c_ubyte * (height * rgb_pitch))()
+ i = 0
+ for row in bits:
+ for packed in row:
+ for index in ((packed & 0xf0) >> 4, packed & 0xf):
+ rgb = palette[index]
+ buffer[i] = rgb.rgbRed
+ buffer[i + 1] = rgb.rgbGreen
+ buffer[i + 2] = rgb.rgbBlue
+ i += 3
+
+ return ImageData(width, height, 'RGB', buffer, pitch_sign * rgb_pitch)
+
+def decode_8bit(bits, palette, width, height, pitch, pitch_sign):
+ rgb_pitch = pitch * 3
+ buffer = (ctypes.c_ubyte * (height * rgb_pitch))()
+ i = 0
+ for row in bits:
+ for index in row:
+ rgb = palette[index]
+ buffer[i] = rgb.rgbRed
+ buffer[i + 1] = rgb.rgbGreen
+ buffer[i + 2] = rgb.rgbBlue
+ i += 3
+
+ return ImageData(width, height, 'RGB', buffer, pitch_sign * rgb_pitch)
+
+
+def decode_24bit(bits, palette, width, height, pitch, pitch_sign):
+ buffer = (ctypes.c_ubyte * (height * pitch))()
+ ctypes.memmove(buffer, bits, len(buffer))
+ return ImageData(width, height, 'BGR', buffer, pitch_sign * pitch)
+
+def decode_32bit_rgb(bits, palette, width, height, pitch, pitch_sign):
+ buffer = (ctypes.c_ubyte * (height * pitch))()
+ ctypes.memmove(buffer, bits, len(buffer))
+ return ImageData(width, height, 'BGRA', buffer, pitch_sign * pitch)
+
+def get_shift(mask):
+ if not mask:
+ return 0
+
+ # Shift down
+ shift = 0
+ while not (1 << shift) & mask:
+ shift += 1
+
+ # Shift up
+ shift_up = 0
+ while (mask >> shift) >> shift_up:
+ shift_up += 1
+
+ s = shift - (8 - shift_up)
+ if s < 0:
+ return 0, -s
+ else:
+ return s, 0
+
+def decode_bitfields(bits, r_mask, g_mask, b_mask,
+ width, height, pitch, pitch_sign):
+ r_shift1, r_shift2 = get_shift(r_mask)
+ g_shift1, g_shift2 = get_shift(g_mask)
+ b_shift1, b_shift2 = get_shift(b_mask)
+
+ rgb_pitch = 3 * len(bits[0])
+ buffer = (ctypes.c_ubyte * (height * rgb_pitch))()
+
+ i = 0
+ for row in bits:
+ for packed in row:
+ buffer[i] = (packed & r_mask) >> r_shift1 << r_shift2
+ buffer[i+1] = (packed & g_mask) >> g_shift1 << g_shift2
+ buffer[i+2] = (packed & b_mask) >> b_shift1 << b_shift2
+ i += 3
+
+ return ImageData(width, height, 'RGB', buffer, pitch_sign * rgb_pitch)
+
+def get_decoders():
+ return [BMPImageDecoder()]
+
+def get_encoders():
+ return []
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/dds.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/dds.py
new file mode 100644
index 0000000..d01624e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/dds.py
@@ -0,0 +1,234 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''DDS texture loader.
+
+Reference: http://msdn2.microsoft.com/en-us/library/bb172993.aspx
+'''
+
+from __future__ import division
+from __future__ import print_function
+from builtins import range
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+from ctypes import *
+import struct
+
+from pyglet.gl import *
+from pyglet.image import CompressedImageData
+from pyglet.image import codecs
+from pyglet.image.codecs import s3tc
+from pyglet.compat import izip_longest as compat_izip_longest
+
+class DDSException(codecs.ImageDecodeException):
+ exception_priority = 0
+
+# dwFlags of DDSURFACEDESC2
+DDSD_CAPS = 0x00000001
+DDSD_HEIGHT = 0x00000002
+DDSD_WIDTH = 0x00000004
+DDSD_PITCH = 0x00000008
+DDSD_PIXELFORMAT = 0x00001000
+DDSD_MIPMAPCOUNT = 0x00020000
+DDSD_LINEARSIZE = 0x00080000
+DDSD_DEPTH = 0x00800000
+
+# ddpfPixelFormat of DDSURFACEDESC2
+DDPF_ALPHAPIXELS = 0x00000001
+DDPF_FOURCC = 0x00000004
+DDPF_RGB = 0x00000040
+
+# dwCaps1 of DDSCAPS2
+DDSCAPS_COMPLEX = 0x00000008
+DDSCAPS_TEXTURE = 0x00001000
+DDSCAPS_MIPMAP = 0x00400000
+
+# dwCaps2 of DDSCAPS2
+DDSCAPS2_CUBEMAP = 0x00000200
+DDSCAPS2_CUBEMAP_POSITIVEX = 0x00000400
+DDSCAPS2_CUBEMAP_NEGATIVEX = 0x00000800
+DDSCAPS2_CUBEMAP_POSITIVEY = 0x00001000
+DDSCAPS2_CUBEMAP_NEGATIVEY = 0x00002000
+DDSCAPS2_CUBEMAP_POSITIVEZ = 0x00004000
+DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x00008000
+DDSCAPS2_VOLUME = 0x00200000
+
+class _filestruct(object):
+ def __init__(self, data):
+ if len(data) < self.get_size():
+ raise DDSException('Not a DDS file')
+ items = struct.unpack(self.get_format(), data)
+ for field, value in compat_izip_longest(self._fields,
+ items,
+ fillvalue=None):
+ setattr(self, field[0], value)
+
+ def __repr__(self):
+ name = self.__class__.__name__
+ return '%s(%s)' % \
+ (name, (', \n%s' % (' ' * (len(name) + 1))).join( \
+ ['%s = %s' % (field[0], repr(getattr(self, field[0]))) \
+ for field in self._fields]))
+
+ @classmethod
+ def get_format(cls):
+ return '<' + ''.join([f[1] for f in cls._fields])
+
+ @classmethod
+ def get_size(cls):
+ return struct.calcsize(cls.get_format())
+
+class DDSURFACEDESC2(_filestruct):
+ _fields = [
+ ('dwMagic', '4s'),
+ ('dwSize', 'I'),
+ ('dwFlags', 'I'),
+ ('dwHeight', 'I'),
+ ('dwWidth', 'I'),
+ ('dwPitchOrLinearSize', 'I'),
+ ('dwDepth', 'I'),
+ ('dwMipMapCount', 'I'),
+ ('dwReserved1', '44s'),
+ ('ddpfPixelFormat', '32s'),
+ ('dwCaps1', 'I'),
+ ('dwCaps2', 'I'),
+ ('dwCapsReserved', '8s'),
+ ('dwReserved2', 'I')
+ ]
+
+ def __init__(self, data):
+ super(DDSURFACEDESC2, self).__init__(data)
+ self.ddpfPixelFormat = DDPIXELFORMAT(self.ddpfPixelFormat)
+
+
+class DDPIXELFORMAT(_filestruct):
+ _fields = [
+ ('dwSize', 'I'),
+ ('dwFlags', 'I'),
+ ('dwFourCC', '4s'),
+ ('dwRGBBitCount', 'I'),
+ ('dwRBitMask', 'I'),
+ ('dwGBitMask', 'I'),
+ ('dwBBitMask', 'I'),
+ ('dwRGBAlphaBitMask', 'I')
+ ]
+
+_compression_formats = {
+ (b'DXT1', False): (GL_COMPRESSED_RGB_S3TC_DXT1_EXT, s3tc.decode_dxt1_rgb),
+ (b'DXT1', True): (GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, s3tc.decode_dxt1_rgba),
+ (b'DXT3', False): (GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, s3tc.decode_dxt3),
+ (b'DXT3', True): (GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, s3tc.decode_dxt3),
+ (b'DXT5', False): (GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, s3tc.decode_dxt5),
+ (b'DXT5', True): (GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, s3tc.decode_dxt5),
+}
+
+def _check_error():
+ e = glGetError()
+ if e != 0:
+ print('GL error %d' % e)
+
+class DDSImageDecoder(codecs.ImageDecoder):
+ def get_file_extensions(self):
+ return ['.dds']
+
+ def decode(self, file, filename):
+ header = file.read(DDSURFACEDESC2.get_size())
+ desc = DDSURFACEDESC2(header)
+ if desc.dwMagic != b'DDS ' or desc.dwSize != 124:
+ raise DDSException('Invalid DDS file (incorrect header).')
+
+ width = desc.dwWidth
+ height = desc.dwHeight
+ mipmaps = 1
+
+ if desc.dwFlags & DDSD_DEPTH:
+ raise DDSException('Volume DDS files unsupported')
+
+ if desc.dwFlags & DDSD_MIPMAPCOUNT:
+ mipmaps = desc.dwMipMapCount
+
+ if desc.ddpfPixelFormat.dwSize != 32:
+ raise DDSException('Invalid DDS file (incorrect pixel format).')
+
+ if desc.dwCaps2 & DDSCAPS2_CUBEMAP:
+ raise DDSException('Cubemap DDS files unsupported')
+
+ if not desc.ddpfPixelFormat.dwFlags & DDPF_FOURCC:
+ raise DDSException('Uncompressed DDS textures not supported.')
+
+ has_alpha = desc.ddpfPixelFormat.dwRGBAlphaBitMask != 0
+
+ selector = (desc.ddpfPixelFormat.dwFourCC, has_alpha)
+ if selector not in _compression_formats:
+ raise DDSException('Unsupported texture compression %s' % \
+ desc.ddpfPixelFormat.dwFourCC)
+
+ dformat, decoder = _compression_formats[selector]
+ if dformat == GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ block_size = 8
+ else:
+ block_size = 16
+
+ datas = []
+ w, h = width, height
+ for i in range(mipmaps):
+ if not w and not h:
+ break
+ if not w:
+ w = 1
+ if not h:
+ h = 1
+ size = ((w + 3) // 4) * ((h + 3) // 4) * block_size
+ data = file.read(size)
+ datas.append(data)
+ w >>= 1
+ h >>= 1
+
+ image = CompressedImageData(width, height, dformat, datas[0],
+ 'GL_EXT_texture_compression_s3tc', decoder)
+ level = 0
+ for data in datas[1:]:
+ level += 1
+ image.set_mipmap_data(level, data)
+
+ return image
+
+def get_decoders():
+ return [DDSImageDecoder()]
+
+def get_encoders():
+ return []
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/gdiplus.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/gdiplus.py
new file mode 100644
index 0000000..24967b2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/gdiplus.py
@@ -0,0 +1,348 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+from __future__ import division
+from builtins import range
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: pil.py 163 2006-11-13 04:15:46Z Alex.Holkner $'
+
+from ctypes import *
+
+from pyglet.com import IUnknown
+from pyglet.gl import *
+from pyglet.image import *
+from pyglet.image.codecs import *
+from pyglet.libs.win32.constants import *
+from pyglet.libs.win32.types import *
+from pyglet.libs.win32 import _kernel32 as kernel32
+
+
+ole32 = windll.ole32
+gdiplus = windll.gdiplus
+
+LPSTREAM = c_void_p
+REAL = c_float
+
+PixelFormat1bppIndexed = 196865
+PixelFormat4bppIndexed = 197634
+PixelFormat8bppIndexed = 198659
+PixelFormat16bppGrayScale = 1052676
+PixelFormat16bppRGB555 = 135173
+PixelFormat16bppRGB565 = 135174
+PixelFormat16bppARGB1555 = 397319
+PixelFormat24bppRGB = 137224
+PixelFormat32bppRGB = 139273
+PixelFormat32bppARGB = 2498570
+PixelFormat32bppPARGB = 925707
+PixelFormat48bppRGB = 1060876
+PixelFormat64bppARGB = 3424269
+PixelFormat64bppPARGB = 29622286
+PixelFormatMax = 15
+
+ImageLockModeRead = 1
+ImageLockModeWrite = 2
+ImageLockModeUserInputBuf = 4
+
+class GdiplusStartupInput(Structure):
+ _fields_ = [
+ ('GdiplusVersion', c_uint32),
+ ('DebugEventCallback', c_void_p),
+ ('SuppressBackgroundThread', BOOL),
+ ('SuppressExternalCodecs', BOOL)
+ ]
+
+class GdiplusStartupOutput(Structure):
+ _fields = [
+ ('NotificationHookProc', c_void_p),
+ ('NotificationUnhookProc', c_void_p)
+ ]
+
+class BitmapData(Structure):
+ _fields_ = [
+ ('Width', c_uint),
+ ('Height', c_uint),
+ ('Stride', c_int),
+ ('PixelFormat', c_int),
+ ('Scan0', POINTER(c_byte)),
+ ('Reserved', POINTER(c_uint))
+ ]
+
+class Rect(Structure):
+ _fields_ = [
+ ('X', c_int),
+ ('Y', c_int),
+ ('Width', c_int),
+ ('Height', c_int)
+ ]
+
+PropertyTagFrameDelay = 0x5100
+
+class PropertyItem(Structure):
+ _fields_ = [
+ ('id', c_uint),
+ ('length', c_ulong),
+ ('type', c_short),
+ ('value', c_void_p)
+ ]
+
+INT_PTR = POINTER(INT)
+UINT_PTR = POINTER(UINT)
+
+ole32.CreateStreamOnHGlobal.argtypes = [HGLOBAL, BOOL, LPSTREAM]
+
+gdiplus.GdipBitmapLockBits.restype = c_int
+gdiplus.GdipBitmapLockBits.argtypes = [c_void_p, c_void_p, UINT, c_int, c_void_p]
+gdiplus.GdipBitmapUnlockBits.restype = c_int
+gdiplus.GdipBitmapUnlockBits.argtypes = [c_void_p, c_void_p]
+gdiplus.GdipCloneStringFormat.restype = c_int
+gdiplus.GdipCloneStringFormat.argtypes = [c_void_p, c_void_p]
+gdiplus.GdipCreateBitmapFromScan0.restype = c_int
+gdiplus.GdipCreateBitmapFromScan0.argtypes = [c_int, c_int, c_int, c_int, POINTER(BYTE), c_void_p]
+gdiplus.GdipCreateBitmapFromStream.restype = c_int
+gdiplus.GdipCreateBitmapFromStream.argtypes = [c_void_p, c_void_p]
+gdiplus.GdipCreateFont.restype = c_int
+gdiplus.GdipCreateFont.argtypes = [c_void_p, REAL, INT, c_int, c_void_p]
+gdiplus.GdipCreateFontFamilyFromName.restype = c_int
+gdiplus.GdipCreateFontFamilyFromName.argtypes = [c_wchar_p, c_void_p, c_void_p]
+gdiplus.GdipCreateMatrix.restype = None
+gdiplus.GdipCreateMatrix.argtypes = [c_void_p]
+gdiplus.GdipCreateSolidFill.restype = c_int
+gdiplus.GdipCreateSolidFill.argtypes = [c_int, c_void_p] # ARGB
+gdiplus.GdipDisposeImage.restype = c_int
+gdiplus.GdipDisposeImage.argtypes = [c_void_p]
+gdiplus.GdipDrawString.restype = c_int
+gdiplus.GdipDrawString.argtypes = [c_void_p, c_wchar_p, c_int, c_void_p, c_void_p, c_void_p, c_void_p]
+gdiplus.GdipGetFamilyName.restype = c_int
+gdiplus.GdipGetFamilyName.argtypes = [c_void_p, c_wchar_p, c_wchar]
+gdiplus.GdipFlush.restype = c_int
+gdiplus.GdipFlush.argtypes = [c_void_p, c_int]
+gdiplus.GdipGetFontCollectionFamilyCount.restype = c_int
+gdiplus.GdipGetFontCollectionFamilyCount.argtypes = [c_void_p, INT_PTR]
+gdiplus.GdipGetFontCollectionFamilyList.restype = c_int
+gdiplus.GdipGetFontCollectionFamilyList.argtypes = [c_void_p, INT, c_void_p, INT_PTR]
+gdiplus.GdipGetImageDimension.restype = c_int
+gdiplus.GdipGetImageDimension.argtypes = [c_void_p, POINTER(REAL), POINTER(REAL)]
+gdiplus.GdipGetImageGraphicsContext.restype = c_int
+gdiplus.GdipGetImageGraphicsContext.argtypes = [c_void_p, c_void_p]
+gdiplus.GdipGetImagePixelFormat.restype = c_int
+gdiplus.GdipGetImagePixelFormat.argtypes = [c_void_p, c_void_p]
+gdiplus.GdipGetPropertyItem.restype = c_int
+gdiplus.GdipGetPropertyItem.argtypes = [c_void_p, c_uint, c_uint, c_void_p]
+gdiplus.GdipGetPropertyItemSize.restype = c_int
+gdiplus.GdipGetPropertyItemSize.argtypes = [c_void_p, c_uint, UINT_PTR]
+gdiplus.GdipGraphicsClear.restype = c_int
+gdiplus.GdipGraphicsClear.argtypes = [c_void_p, c_int] # ARGB
+gdiplus.GdipImageGetFrameCount.restype = c_int
+gdiplus.GdipImageGetFrameCount.argtypes = [c_void_p, c_void_p, UINT_PTR]
+gdiplus.GdipImageGetFrameDimensionsCount.restype = c_int
+gdiplus.GdipImageGetFrameDimensionsCount.argtypes = [c_void_p, UINT_PTR]
+gdiplus.GdipImageGetFrameDimensionsList.restype = c_int
+gdiplus.GdipImageGetFrameDimensionsList.argtypes = [c_void_p, c_void_p, UINT]
+gdiplus.GdipImageSelectActiveFrame.restype = c_int
+gdiplus.GdipImageSelectActiveFrame.argtypes = [c_void_p, c_void_p, UINT]
+gdiplus.GdipMeasureString.restype = c_int
+gdiplus.GdipMeasureString.argtypes = [c_void_p, c_wchar_p, c_int, c_void_p, c_void_p, c_void_p, c_void_p, INT_PTR, INT_PTR]
+gdiplus.GdipNewPrivateFontCollection.restype = c_int
+gdiplus.GdipNewPrivateFontCollection.argtypes = [c_void_p]
+gdiplus.GdipPrivateAddMemoryFont.restype = c_int
+gdiplus.GdipPrivateAddMemoryFont.argtypes = [c_void_p, c_void_p, c_int]
+gdiplus.GdipSetPageUnit.restype = c_int
+gdiplus.GdipSetPageUnit.argtypes = [c_void_p, c_int]
+gdiplus.GdipSetStringFormatFlags.restype = c_int
+gdiplus.GdipSetStringFormatFlags.argtypes = [c_void_p, c_int]
+gdiplus.GdipSetTextRenderingHint.restype = c_int
+gdiplus.GdipSetTextRenderingHint.argtypes = [c_void_p, c_int]
+gdiplus.GdipStringFormatGetGenericTypographic.restype = c_int
+gdiplus.GdipStringFormatGetGenericTypographic.argtypes = [c_void_p]
+gdiplus.GdiplusShutdown.restype = None
+gdiplus.GdiplusShutdown.argtypes = [POINTER(ULONG)]
+gdiplus.GdiplusStartup.restype = c_int
+gdiplus.GdiplusStartup.argtypes = [c_void_p, c_void_p, c_void_p]
+
+
+class GDIPlusDecoder(ImageDecoder):
+ def get_file_extensions(self):
+ return ['.bmp', '.gif', '.jpg', '.jpeg', '.exif', '.png', '.tif',
+ '.tiff']
+
+ def get_animation_file_extensions(self):
+ # TIFF also supported as a multi-page image; but that's not really an
+ # animation, is it?
+ return ['.gif']
+
+ def _load_bitmap(self, file, filename):
+ data = file.read()
+
+ # Create a HGLOBAL with image data
+ hglob = kernel32.GlobalAlloc(GMEM_MOVEABLE, len(data))
+ ptr = kernel32.GlobalLock(hglob)
+ memmove(ptr, data, len(data))
+ kernel32.GlobalUnlock(hglob)
+
+ # Create IStream for the HGLOBAL
+ self.stream = IUnknown()
+ ole32.CreateStreamOnHGlobal(hglob, True, byref(self.stream))
+
+ # Load image from stream
+ bitmap = c_void_p()
+ status = gdiplus.GdipCreateBitmapFromStream(self.stream, byref(bitmap))
+ if status != 0:
+ self.stream.Release()
+ raise ImageDecodeException(
+ 'GDI+ cannot load %r' % (filename or file))
+
+ return bitmap
+
+ def _get_image(self, bitmap):
+ # Get size of image (Bitmap subclasses Image)
+ width = REAL()
+ height = REAL()
+ gdiplus.GdipGetImageDimension(bitmap, byref(width), byref(height))
+ width = int(width.value)
+ height = int(height.value)
+
+ # Get image pixel format
+ pf = c_int()
+ gdiplus.GdipGetImagePixelFormat(bitmap, byref(pf))
+ pf = pf.value
+
+ # Reverse from what's documented because of Intel little-endianness.
+ format = 'BGRA'
+ if pf == PixelFormat24bppRGB:
+ format = 'BGR'
+ elif pf == PixelFormat32bppRGB:
+ pass
+ elif pf == PixelFormat32bppARGB:
+ pass
+ elif pf in (PixelFormat16bppARGB1555, PixelFormat32bppPARGB,
+ PixelFormat64bppARGB, PixelFormat64bppPARGB):
+ pf = PixelFormat32bppARGB
+ else:
+ format = 'BGR'
+ pf = PixelFormat24bppRGB
+
+ # Lock pixel data in best format
+ rect = Rect()
+ rect.X = 0
+ rect.Y = 0
+ rect.Width = width
+ rect.Height = height
+ bitmap_data = BitmapData()
+ gdiplus.GdipBitmapLockBits(bitmap,
+ byref(rect), ImageLockModeRead, pf, byref(bitmap_data))
+
+ # Create buffer for RawImage
+ buffer = create_string_buffer(bitmap_data.Stride * height)
+ memmove(buffer, bitmap_data.Scan0, len(buffer))
+
+ # Unlock data
+ gdiplus.GdipBitmapUnlockBits(bitmap, byref(bitmap_data))
+
+ return ImageData(width, height, format, buffer, -bitmap_data.Stride)
+
+ def _delete_bitmap(self, bitmap):
+ # Release image and stream
+ gdiplus.GdipDisposeImage(bitmap)
+ self.stream.Release()
+
+ def decode(self, file, filename):
+ bitmap = self._load_bitmap(file, filename)
+ image = self._get_image(bitmap)
+ self._delete_bitmap(bitmap)
+ return image
+
+ def decode_animation(self, file, filename):
+ bitmap = self._load_bitmap(file, filename)
+
+ dimension_count = c_uint()
+ gdiplus.GdipImageGetFrameDimensionsCount(bitmap, byref(dimension_count))
+ if dimension_count.value < 1:
+ self._delete_bitmap(bitmap)
+ raise ImageDecodeException('Image has no frame dimensions')
+
+ # XXX Make sure this dimension is time?
+ dimensions = (c_void_p * dimension_count.value)()
+ gdiplus.GdipImageGetFrameDimensionsList(bitmap, dimensions,
+ dimension_count.value)
+
+ frame_count = c_uint()
+ gdiplus.GdipImageGetFrameCount(bitmap, dimensions, byref(frame_count))
+
+ prop_id = PropertyTagFrameDelay
+ prop_size = c_uint()
+ gdiplus.GdipGetPropertyItemSize(bitmap, prop_id, byref(prop_size))
+
+ prop_buffer = c_buffer(prop_size.value)
+ prop_item = cast(prop_buffer, POINTER(PropertyItem)).contents
+ gdiplus.GdipGetPropertyItem(bitmap, prop_id, prop_size.value,
+ prop_buffer)
+
+ n_delays = prop_item.length // sizeof(c_long)
+ delays = cast(prop_item.value, POINTER(c_long * n_delays)).contents
+
+ frames = []
+
+ for i in range(frame_count.value):
+ gdiplus.GdipImageSelectActiveFrame(bitmap, dimensions, i)
+ image = self._get_image(bitmap)
+
+ delay = delays[i]
+ if delay <= 1:
+ delay = 10
+ frames.append(AnimationFrame(image, delay/100.))
+
+ self._delete_bitmap(bitmap)
+
+ return Animation(frames)
+
+def get_decoders():
+ return [GDIPlusDecoder()]
+
+def get_encoders():
+ return []
+
+def init():
+ token = c_ulong()
+ startup_in = GdiplusStartupInput()
+ startup_in.GdiplusVersion = 1
+ startup_out = GdiplusStartupOutput()
+ gdiplus.GdiplusStartup(byref(token), byref(startup_in), byref(startup_out))
+
+ # Shutdown later?
+ # gdiplus.GdiplusShutdown(token)
+
+init()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/gdkpixbuf2.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/gdkpixbuf2.py
new file mode 100644
index 0000000..590f44f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/gdkpixbuf2.py
@@ -0,0 +1,329 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+from builtins import object
+from ctypes import *
+
+from pyglet.gl import *
+from pyglet.image import *
+from pyglet.image.codecs import *
+from pyglet.image.codecs import gif
+
+import pyglet.lib
+import pyglet.window
+
+gdk = pyglet.lib.load_library('gdk-x11-2.0')
+gdkpixbuf = pyglet.lib.load_library('gdk_pixbuf-2.0')
+
+GdkPixbufLoader = c_void_p
+GdkPixbuf = c_void_p
+guchar = c_char
+gdkpixbuf.gdk_pixbuf_loader_new.restype = POINTER(GdkPixbufLoader)
+gdkpixbuf.gdk_pixbuf_loader_get_pixbuf.restype = POINTER(GdkPixbuf)
+gdkpixbuf.gdk_pixbuf_get_pixels.restype = POINTER(guchar)
+gdkpixbuf.gdk_pixbuf_loader_get_animation.restype = POINTER(c_void_p)
+gdkpixbuf.gdk_pixbuf_animation_get_iter.restype = POINTER(c_void_p)
+gdkpixbuf.gdk_pixbuf_animation_iter_get_pixbuf.restype = POINTER(GdkPixbuf)
+
+
+class GTimeVal(Structure):
+ _fields_ = [
+ ('tv_sec', c_long),
+ ('tv_usec', c_long)
+ ]
+
+
+GQuark = c_uint32
+gint = c_int
+gchar = c_char
+
+
+class GError(Structure):
+ _fields_ = [
+ ('domain', GQuark),
+ ('code', gint),
+ ('message', POINTER(gchar))
+ ]
+
+gerror_ptr = POINTER(GError)
+
+def _gerror_to_string(error):
+ """
+ Convert a GError to a string.
+ `error` should be a valid pointer to a GError struct.
+ """
+ return 'GdkPixBuf Error: domain[{}], code[{}]: {}'.format(error.contents.domain,
+ error.contents.code,
+ error.contents.message)
+
+
+class GdkPixBufLoader(object):
+ """
+ Wrapper around GdkPixBufLoader object.
+ """
+ def __init__(self, file_, filename):
+ self.closed = False
+ self._file = file_
+ self._filename = filename
+ self._loader = gdkpixbuf.gdk_pixbuf_loader_new()
+ if self._loader is None:
+ raise ImageDecodeException('Unable to instantiate gdk pixbuf loader')
+ self._load_file()
+
+ def __del__(self):
+ if self._loader is not None:
+ if not self.closed:
+ self._cancel_load()
+ gdk.g_object_unref(self._loader)
+
+ def _load_file(self):
+ assert self._file is not None
+ self._file.seek(0)
+ data = self._file.read()
+ self.write(data)
+
+ def _finish_load(self):
+ assert not self.closed
+ error = gerror_ptr()
+ all_data_passed = gdkpixbuf.gdk_pixbuf_loader_close(self._loader, byref(error))
+ self.closed = True
+ if not all_data_passed:
+ raise ImageDecodeException(_gerror_to_string(error))
+
+ def _cancel_load(self):
+ assert not self.closed
+ gdkpixbuf.gdk_pixbuf_loader_close(self._loader, None)
+ self.closed = True
+
+ def write(self, data):
+ assert not self.closed, 'Cannot write after closing loader'
+ error = gerror_ptr()
+ if not gdkpixbuf.gdk_pixbuf_loader_write(self._loader, data, len(data), byref(error)):
+ raise ImageDecodeException(_gerror_to_string(error))
+
+ def get_pixbuf(self):
+ self._finish_load()
+ pixbuf = gdkpixbuf.gdk_pixbuf_loader_get_pixbuf(self._loader)
+ if pixbuf is None:
+ raise ImageDecodeException('Failed to get pixbuf from loader')
+ return GdkPixBuf(self, pixbuf)
+
+ def get_animation(self):
+ self._finish_load()
+ anim = gdkpixbuf.gdk_pixbuf_loader_get_animation(self._loader)
+ if anim is None:
+ raise ImageDecodeException('Failed to get animation from loader')
+ gif_delays = self._get_gif_delays()
+ return GdkPixBufAnimation(self, anim, gif_delays)
+
+ def _get_gif_delays(self):
+ # GDK pixbuf animations will loop indefinitely if looping is enabled for the
+ # gif, so get number of frames and delays from gif metadata
+ assert self._file is not None
+ self._file.seek(0)
+ gif_stream = gif.read(self._file)
+ return [image.delay for image in gif_stream.images]
+
+
+class GdkPixBuf(object):
+ """
+ Wrapper around GdkPixBuf object.
+ """
+ def __init__(self, loader, pixbuf):
+ # Keep reference to loader alive
+ self._loader = loader
+ self._pixbuf = pixbuf
+ gdk.g_object_ref(pixbuf)
+
+ def __del__(self):
+ if self._pixbuf is not None:
+ gdk.g_object_unref(self._pixbuf)
+
+ def load_next(self):
+ return self._pixbuf is not None
+
+ @property
+ def width(self):
+ assert self._pixbuf is not None
+ return gdkpixbuf.gdk_pixbuf_get_width(self._pixbuf)
+
+ @property
+ def height(self):
+ assert self._pixbuf is not None
+ return gdkpixbuf.gdk_pixbuf_get_height(self._pixbuf)
+
+ @property
+ def channels(self):
+ assert self._pixbuf is not None
+ return gdkpixbuf.gdk_pixbuf_get_n_channels(self._pixbuf)
+
+ @property
+ def rowstride(self):
+ assert self._pixbuf is not None
+ return gdkpixbuf.gdk_pixbuf_get_rowstride(self._pixbuf)
+
+ @property
+ def has_alpha(self):
+ assert self._pixbuf is not None
+ return gdkpixbuf.gdk_pixbuf_get_has_alpha(self._pixbuf) == 1
+
+ def get_pixels(self):
+ pixels = gdkpixbuf.gdk_pixbuf_get_pixels(self._pixbuf)
+ assert pixels is not None
+ buf = (c_ubyte * (self.rowstride * self.height))()
+ memmove(buf, pixels, self.rowstride * (self.height - 1) + self.width * self.channels)
+ return buf
+
+ def to_image(self):
+ if self.width < 1 or self.height < 1 or self.channels < 1 or self.rowstride < 1:
+ return None
+
+ pixels = self.get_pixels()
+
+ # Determine appropriate GL type
+ if self.channels == 3:
+ format = 'RGB'
+ else:
+ format = 'RGBA'
+
+ return ImageData(self.width, self.height, format, pixels, -self.rowstride)
+
+
+class GdkPixBufAnimation(object):
+ """
+ Wrapper for a GdkPixBufIter for an animation.
+ """
+ def __init__(self, loader, anim, gif_delays):
+ self._loader = loader
+ self._anim = anim
+ self._gif_delays = gif_delays
+ gdk.g_object_ref(anim)
+
+ def __del__(self):
+ if self._anim is not None:
+ gdk.g_object_unref(self._anim)
+
+ def __iter__(self):
+ time = GTimeVal(0, 0)
+ anim_iter = gdkpixbuf.gdk_pixbuf_animation_get_iter(self._anim, byref(time))
+ return GdkPixBufAnimationIterator(self._loader, anim_iter, time, self._gif_delays)
+
+ def to_animation(self):
+ return Animation(list(self))
+
+
+class GdkPixBufAnimationIterator(object):
+ def __init__(self, loader, anim_iter, start_time, gif_delays):
+ self._iter = anim_iter
+ self._first = True
+ self._time = start_time
+ self._loader = loader
+ self._gif_delays = gif_delays
+ self.delay_time = None
+
+ def __del__(self):
+ if self._iter is not None:
+ gdk.g_object_unref(self._iter)
+ # The pixbuf returned by the iter is owned by the iter, so no need to destroy that one
+
+ def __iter__(self):
+ return self
+
+ def __next__(self):
+ self._advance()
+ frame = self.get_frame()
+ if frame is None:
+ raise StopIteration
+ return frame
+
+ def _advance(self):
+ if not self._gif_delays:
+ raise StopIteration
+ self.delay_time = self._gif_delays.pop(0)
+
+ if self._first:
+ self._first = False
+ else:
+ if self.gdk_delay_time == -1:
+ raise StopIteration
+ else:
+ gdk_delay = self.gdk_delay_time * 1000 # milliseconds to microseconds
+ us = self._time.tv_usec + gdk_delay
+ self._time.tv_sec += us // 1000000
+ self._time.tv_usec = us % 1000000
+ gdkpixbuf.gdk_pixbuf_animation_iter_advance(self._iter, byref(self._time))
+
+ def get_frame(self):
+ pixbuf = gdkpixbuf.gdk_pixbuf_animation_iter_get_pixbuf(self._iter)
+ if pixbuf is None:
+ return None
+ image = GdkPixBuf(self._loader, pixbuf).to_image()
+ return AnimationFrame(image, self.delay_time)
+
+ @property
+ def gdk_delay_time(self):
+ assert self._iter is not None
+ return gdkpixbuf.gdk_pixbuf_animation_iter_get_delay_time(self._iter)
+
+
+class GdkPixbuf2ImageDecoder(ImageDecoder):
+ def get_file_extensions(self):
+ return ['.png', '.xpm', '.jpg', '.jpeg', '.tif', '.tiff', '.pnm',
+ '.ras', '.bmp', '.gif']
+
+ def get_animation_file_extensions(self):
+ return ['.gif', '.ani']
+
+ def decode(self, file, filename):
+ loader = GdkPixBufLoader(file, filename)
+ return loader.get_pixbuf().to_image()
+
+ def decode_animation(self, file, filename):
+ loader = GdkPixBufLoader(file, filename)
+ return loader.get_animation().to_animation()
+
+
+def get_decoders():
+ return [GdkPixbuf2ImageDecoder()]
+
+
+def get_encoders():
+ return []
+
+
+def init():
+ gdk.g_type_init()
+
+init()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/gif.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/gif.py
new file mode 100644
index 0000000..f8734ff
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/gif.py
@@ -0,0 +1,172 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Read GIF control data.
+
+http://www.w3.org/Graphics/GIF/spec-gif89a.txt
+'''
+from __future__ import print_function
+from __future__ import division
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import struct
+
+from pyglet.image.codecs import ImageDecodeException
+
+class GIFStream(object):
+ def __init__(self):
+ self.images = []
+
+class GIFImage(object):
+ delay = None
+
+class GraphicsScope(object):
+ delay = None
+
+# Appendix A.
+LABEL_EXTENSION_INTRODUCER = 0x21
+LABEL_GRAPHIC_CONTROL_EXTENSION = 0xf9
+LABEL_IMAGE_DESCRIPTOR = 0x2c
+LABEL_TRAILER = 0x3b
+
+def unpack(format, file):
+ size = struct.calcsize(format)
+ data = file.read(size)
+ if len(data) < size:
+ raise ImageDecodeException('Unexpected EOF')
+ return struct.unpack(format, data)
+
+def read_byte(file):
+ data = file.read(1)
+ if not len(data):
+ raise ImageDecodeException('Unexpected EOF')
+ return ord(data)
+
+def read(file):
+ '''Read a GIF file stream.
+
+ :rtype: GIFStream
+ '''
+ # 17. Header
+ signature = file.read(3)
+ version = file.read(3)
+ if signature != b'GIF':
+ raise ImageDecodeException('Not a GIF stream')
+
+ stream = GIFStream()
+
+ # 18. Logical screen descriptor
+ (logical_screen_width,
+ logical_screen_height,
+ fields,
+ background_color_index,
+ pixel_aspect_ratio) = unpack('HHBBB', file)
+ global_color_table_flag = fields & 0x80
+ global_color_table_size = fields & 0x7
+
+ # 19. Global color table
+ if global_color_table_flag:
+ global_color_table = file.read(6 << global_color_table_size)
+
+ # *
+ graphics_scope = GraphicsScope()
+ block_type = read_byte(file)
+
+ while block_type != LABEL_TRAILER:
+ if block_type == LABEL_IMAGE_DESCRIPTOR:
+ read_table_based_image(file, stream, graphics_scope)
+ graphics_scope = GraphicsScope()
+ elif block_type == LABEL_EXTENSION_INTRODUCER:
+ extension_block_type = read_byte(file)
+ if extension_block_type == LABEL_GRAPHIC_CONTROL_EXTENSION:
+ read_graphic_control_extension(file, stream, graphics_scope)
+ else:
+ skip_data_sub_blocks(file)
+ else:
+ # Skip bytes until a valid start character is found
+ print(block_type)
+ pass
+ block_type = read_byte(file)
+
+ return stream
+
+def skip_data_sub_blocks(file):
+ # 15. Data sub-blocks
+ block_size = read_byte(file)
+ while block_size != 0:
+ data = file.read(block_size)
+ block_size = read_byte(file)
+
+def read_table_based_image(file, stream, graphics_scope):
+ gif_image = GIFImage()
+ stream.images.append(gif_image)
+ gif_image.delay = graphics_scope.delay
+
+ # 20. Image descriptor
+ (image_left_position,
+ image_top_position,
+ image_width,
+ image_height,
+ fields) = unpack('HHHHB', file)
+
+ local_color_table_flag = fields & 0x80
+ local_color_table_size = fields & 0x7
+
+ # 21. Local color table
+ if local_color_table_flag:
+ local_color_table = file.read(6 << local_color_table_size)
+
+ # 22. Table based image data
+ lzw_code_size = file.read(1)
+ skip_data_sub_blocks(file)
+
+def read_graphic_control_extension(file, stream, graphics_scope):
+ # 23. Graphic control extension
+ (block_size,
+ fields,
+ delay_time,
+ transparent_color_index,
+ terminator) = unpack('BBHBB', file)
+ if block_size != 4:
+ raise ImageDecodeException('Incorrect block size')
+
+ if delay_time:
+ # Follow Firefox/Mac behaviour: use 100ms delay for any delay
+ # less than 10ms.
+ if delay_time <= 1:
+ delay_time = 10
+ graphics_scope.delay = float(delay_time) / 100
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/pil.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/pil.py
new file mode 100644
index 0000000..db8daff
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/pil.py
@@ -0,0 +1,123 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+
+from __future__ import absolute_import
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import os.path
+
+from pyglet.gl import *
+from pyglet.image import *
+from pyglet.image.codecs import *
+
+try:
+ import Image
+except ImportError:
+ from PIL import Image
+
+class PILImageDecoder(ImageDecoder):
+ def get_file_extensions(self):
+ # Only most common ones shown here
+ return ['.bmp', '.cur', '.gif', '.ico', '.jpg', '.jpeg', '.pcx', '.png',
+ '.tga', '.tif', '.tiff', '.xbm', '.xpm']
+
+ def decode(self, file, filename):
+ try:
+ image = Image.open(file)
+ except Exception as e:
+ raise ImageDecodeException(
+ 'PIL cannot read %r: %s' % (filename or file, e))
+
+ try:
+ image = image.transpose(Image.FLIP_TOP_BOTTOM)
+ except Exception as e:
+ raise ImageDecodeException(
+ 'PIL failed to transpose %r: %s' % (filename or file, e))
+
+ # Convert bitmap and palette images to component
+ if image.mode in ('1', 'P'):
+ image = image.convert()
+
+ if image.mode not in ('L', 'LA', 'RGB', 'RGBA'):
+ raise ImageDecodeException('Unsupported mode "%s"' % image.mode)
+ type = GL_UNSIGNED_BYTE
+ width, height = image.size
+
+ # tostring is deprecated, replaced by tobytes in Pillow (PIL fork)
+ # (1.1.7) PIL still uses it
+ image_data_fn = getattr(image, "tobytes", getattr(image, "tostring"))
+ return ImageData(width, height, image.mode, image_data_fn())
+
+class PILImageEncoder(ImageEncoder):
+ def get_file_extensions(self):
+ # Most common only
+ return ['.bmp', '.eps', '.gif', '.jpg', '.jpeg',
+ '.pcx', '.png', '.ppm', '.tiff', '.xbm']
+
+ def encode(self, image, file, filename):
+ # File format is guessed from filename extension, otherwise defaults
+ # to PNG.
+ pil_format = (filename and os.path.splitext(filename)[1][1:]) or 'png'
+
+ if pil_format.lower() == 'jpg':
+ pil_format = 'JPEG'
+
+ image = image.get_image_data()
+ format = image.format
+ if format != 'RGB':
+ # Only save in RGB or RGBA formats.
+ format = 'RGBA'
+ pitch = -(image.width * len(format))
+
+ # fromstring is deprecated, replaced by frombytes in Pillow (PIL fork)
+ # (1.1.7) PIL still uses it
+ image_from_fn = getattr(Image, "frombytes", getattr(Image, "fromstring"))
+ pil_image = image_from_fn(
+ format, (image.width, image.height), image.get_data(format, pitch))
+
+ try:
+ pil_image.save(file, pil_format)
+ except Exception as e:
+ raise ImageEncodeException(e)
+
+def get_decoders():
+ return [PILImageDecoder()]
+
+def get_encoders():
+ return [PILImageEncoder()]
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/png.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/png.py
new file mode 100644
index 0000000..70edafc
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/png.py
@@ -0,0 +1,114 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Encoder and decoder for PNG files, using PyPNG (png.py).
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import array
+import itertools
+
+from pyglet.gl import *
+from pyglet.image import *
+from pyglet.image.codecs import *
+
+import pyglet.extlibs.png as pypng
+
+
+class PNGImageDecoder(ImageDecoder):
+ def get_file_extensions(self):
+ return ['.png']
+
+ def decode(self, file, filename):
+ try:
+ reader = pypng.Reader(file=file)
+ width, height, pixels, metadata = reader.asDirect()
+ except Exception as e:
+ raise ImageDecodeException(
+ 'PyPNG cannot read %r: %s' % (filename or file, e))
+
+ if metadata['greyscale']:
+ if metadata['alpha']:
+ format = 'LA'
+ else:
+ format = 'L'
+ else:
+ if metadata['alpha']:
+ format = 'RGBA'
+ else:
+ format = 'RGB'
+ pitch = len(format) * width
+
+ pixels = array.array('BH'[metadata['bitdepth']>8], itertools.chain(*pixels))
+ return ImageData(width, height, format, pixels.tostring(), -pitch)
+
+class PNGImageEncoder(ImageEncoder):
+ def get_file_extensions(self):
+ return ['.png']
+
+ def encode(self, image, file, filename):
+ image = image.get_image_data()
+
+ has_alpha = 'A' in image.format
+ greyscale = len(image.format) < 3
+ if has_alpha:
+ if greyscale:
+ image.format = 'LA'
+ else:
+ image.format = 'RGBA'
+ else:
+ if greyscale:
+ image.format = 'L'
+ else:
+ image.format = 'RGB'
+
+ image.pitch = -(image.width * len(image.format))
+
+ writer = pypng.Writer(
+ image.width, image.height,
+ bytes_per_sample=1,
+ greyscale=greyscale,
+ alpha=has_alpha)
+
+ data = array.array('B')
+ data.fromstring(image.data)
+ writer.write_array(file, data)
+
+def get_decoders():
+ return [PNGImageDecoder()]
+
+def get_encoders():
+ return [PNGImageEncoder()]
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/quartz.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/quartz.py
new file mode 100644
index 0000000..4435bde
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/quartz.py
@@ -0,0 +1,140 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+from builtins import range
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+from pyglet.image import ImageData, Animation, AnimationFrame
+from pyglet.image.codecs import *
+
+from pyglet.libs.darwin.cocoapy import *
+
+
+class QuartzImageDecoder(ImageDecoder):
+ def get_file_extensions(self):
+ # Quartz can actually decode many more formats, but these are the most common.
+ return [ '.bmp', '.cur', '.gif', '.ico', '.jp2', '.jpg', '.jpeg',
+ '.pcx', '.png', '.tga', '.tif', '.tiff', '.xbm', '.xpm' ]
+
+ def get_animation_file_extensions(self):
+ return ['.gif']
+
+ def _get_pyglet_ImageData_from_source_at_index(self, sourceRef, index):
+ imageRef = c_void_p(quartz.CGImageSourceCreateImageAtIndex(sourceRef, index, None))
+
+ # Regardless of the internal format of the image (L, LA, RGB, RGBA, etc)
+ # we just automatically convert everything to an RGBA format.
+ format = 'RGBA'
+ rgbColorSpace = c_void_p(quartz.CGColorSpaceCreateDeviceRGB())
+ bitsPerComponent = 8
+ width = quartz.CGImageGetWidth(imageRef)
+ height = quartz.CGImageGetHeight(imageRef)
+ bytesPerRow = 4 * width
+
+ # Create a buffer to store the RGBA formatted data.
+ bufferSize = height * bytesPerRow
+ buffer = (c_ubyte * bufferSize)()
+
+ # Create a bitmap context for the RGBA formatted data.
+ # Note that premultiplied alpha is required:
+ # http://developer.apple.com/library/mac/#qa/qa1037/_index.html
+ bitmap = c_void_p(quartz.CGBitmapContextCreate(buffer,
+ width, height,
+ bitsPerComponent,
+ bytesPerRow,
+ rgbColorSpace,
+ kCGImageAlphaPremultipliedLast))
+
+ # Write the image data into the bitmap.
+ quartz.CGContextDrawImage(bitmap, NSMakeRect(0,0,width,height), imageRef)
+
+ quartz.CGImageRelease(imageRef)
+ quartz.CGContextRelease(bitmap)
+ quartz.CGColorSpaceRelease(rgbColorSpace)
+
+ pitch = bytesPerRow
+ return ImageData(width, height, format, buffer, -pitch)
+
+ def decode(self, file, filename):
+ file_bytes = file.read()
+ data = c_void_p(cf.CFDataCreate(None, file_bytes, len(file_bytes)))
+ # Second argument is an options dictionary. It might be a good idea to provide
+ # a value for kCGImageSourceTypeIdentifierHint here using filename extension.
+ sourceRef = c_void_p(quartz.CGImageSourceCreateWithData(data, None))
+ image = self._get_pyglet_ImageData_from_source_at_index(sourceRef, 0)
+
+ cf.CFRelease(data)
+ cf.CFRelease(sourceRef)
+
+ return image
+
+ def decode_animation(self, file, filename):
+ # If file is not an animated GIF, it will be loaded as a single-frame animation.
+ file_bytes = file.read()
+ data = c_void_p(cf.CFDataCreate(None, file_bytes, len(file_bytes)))
+ sourceRef = c_void_p(quartz.CGImageSourceCreateWithData(data, None))
+
+ # Get number of frames in the animation.
+ count = quartz.CGImageSourceGetCount(sourceRef)
+
+ frames = []
+
+ for index in range(count):
+ # Try to determine frame duration from GIF properties dictionary.
+ duration = 0.1 # default duration if none found
+ props = c_void_p(quartz.CGImageSourceCopyPropertiesAtIndex(sourceRef, index, None))
+ if cf.CFDictionaryContainsKey(props, kCGImagePropertyGIFDictionary):
+ gif_props = c_void_p(cf.CFDictionaryGetValue(props, kCGImagePropertyGIFDictionary))
+ if cf.CFDictionaryContainsKey(gif_props, kCGImagePropertyGIFDelayTime):
+ duration = cfnumber_to_number(c_void_p(cf.CFDictionaryGetValue(gif_props, kCGImagePropertyGIFDelayTime)))
+
+ cf.CFRelease(props)
+ image = self._get_pyglet_ImageData_from_source_at_index(sourceRef, index)
+ frames.append( AnimationFrame(image, duration) )
+
+ cf.CFRelease(data)
+ cf.CFRelease(sourceRef)
+
+ return Animation(frames)
+
+
+def get_decoders():
+ return [ QuartzImageDecoder() ]
+
+def get_encoders():
+ return []
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/quicktime.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/quicktime.py
new file mode 100644
index 0000000..2c63bed
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/quicktime.py
@@ -0,0 +1,297 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+from __future__ import division
+from builtins import chr
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: pil.py 163 2006-11-13 04:15:46Z Alex.Holkner $'
+
+import sys
+
+from ctypes import *
+
+from pyglet.gl import *
+from pyglet.image import *
+from pyglet.image.codecs import *
+
+from pyglet.window.carbon import carbon, quicktime, _oscheck
+from pyglet.libs.darwin.constants import _name
+from pyglet.libs.darwin.types import *
+
+Handle = POINTER(POINTER(c_byte))
+
+GWorldPtr = c_void_p
+carbon.NewHandle.restype = Handle
+HandleDataHandlerSubType = _name('hndl')
+PointerDataHandlerSubType = _name('ptr ')
+kDataHCanRead = 1
+kDataRefExtensionFileName = _name('fnam')
+kDataRefExtensionMIMEType = _name('mime')
+ComponentInstance = c_void_p
+
+k1MonochromePixelFormat = 0x00000001
+k2IndexedPixelFormat = 0x00000002
+k4IndexedPixelFormat = 0x00000004
+k8IndexedPixelFormat = 0x00000008
+k16BE555PixelFormat = 0x00000010
+k24RGBPixelFormat = 0x00000018
+k32ARGBPixelFormat = 0x00000020
+k32BGRAPixelFormat = _name('BGRA')
+k1IndexedGrayPixelFormat = 0x00000021
+k2IndexedGrayPixelFormat = 0x00000022
+k4IndexedGrayPixelFormat = 0x00000024
+k8IndexedGrayPixelFormat = 0x00000028
+kNativeEndianPixMap = 1 << 8
+
+kGraphicsImporterDontDoGammaCorrection = 1 << 0
+kGraphicsImporterDontUseColorMatching = 1 << 3
+
+newMovieActive = 1
+noErr = 0
+movieTrackMediaType = 1 << 0
+movieTrackCharacteristic = 1 << 1
+movieTrackEnabledOnly = 1 << 2
+VisualMediaCharacteristic = _name('eyes')
+nextTimeMediaSample = 1
+
+class PointerDataRefRecord(Structure):
+ _fields_ = [
+ ('data', c_void_p),
+ ('dataLength', c_long)
+ ]
+
+def Str255(value):
+ return create_string_buffer(chr(len(value)) + value)
+
+class QuickTimeImageDecoder(ImageDecoder):
+ def get_file_extensions(self):
+ # Only most common ones shown here
+ return ['.bmp', '.cur', '.gif', '.ico', '.jpg', '.jpeg', '.pcx', '.png',
+ '.tga', '.tif', '.tiff', '.xbm', '.xpm']
+
+ def get_animation_file_extensions(self):
+ return ['.gif']
+
+ def _get_data_ref(self, file, filename):
+ self._data_hold = data = create_string_buffer(file.read())
+
+ dataref = carbon.NewHandle(sizeof(PointerDataRefRecord))
+ datarec = cast(dataref,
+ POINTER(POINTER(PointerDataRefRecord))).contents.contents
+ datarec.data = addressof(data)
+ datarec.dataLength = len(data)
+
+ self._data_handler_holder = data_handler = ComponentInstance()
+ r = quicktime.OpenADataHandler(dataref, PointerDataHandlerSubType,
+ None, 0, None, kDataHCanRead, byref(data_handler))
+ _oscheck(r)
+
+ extension_handle = Handle()
+
+ self._filename_hold = filename = Str255(filename)
+ r = carbon.PtrToHand(filename, byref(extension_handle), len(filename))
+ r = quicktime.DataHSetDataRefExtension(data_handler, extension_handle,
+ kDataRefExtensionFileName)
+ _oscheck(r)
+ quicktime.DisposeHandle(extension_handle)
+
+ quicktime.DisposeHandle(dataref)
+
+ dataref = c_void_p()
+ r = quicktime.DataHGetDataRef(data_handler, byref(dataref))
+ _oscheck(r)
+
+ quicktime.CloseComponent(data_handler)
+
+ return dataref
+
+ def _get_formats(self):
+ # TODO choose 24 bit where appropriate.
+ if sys.byteorder == 'big':
+ format = 'ARGB'
+ qtformat = k32ARGBPixelFormat
+ else:
+ format = 'BGRA'
+ qtformat = k32BGRAPixelFormat
+ return format, qtformat
+
+ def decode(self, file, filename):
+ dataref = self._get_data_ref(file, filename)
+ importer = ComponentInstance()
+ quicktime.GetGraphicsImporterForDataRef(dataref,
+ PointerDataHandlerSubType, byref(importer))
+
+ if not importer:
+ raise ImageDecodeException(filename or file)
+
+ rect = Rect()
+ quicktime.GraphicsImportGetNaturalBounds(importer, byref(rect))
+ width = rect.right
+ height = rect.bottom
+
+ format, qtformat = self._get_formats()
+
+ buffer = (c_byte * (width * height * len(format)))()
+ world = GWorldPtr()
+ quicktime.QTNewGWorldFromPtr(byref(world), qtformat,
+ byref(rect), c_void_p(), c_void_p(), 0, buffer,
+ len(format) * width)
+
+ flags = (kGraphicsImporterDontUseColorMatching |
+ kGraphicsImporterDontDoGammaCorrection)
+ quicktime.GraphicsImportSetFlags(importer, flags)
+ quicktime.GraphicsImportSetGWorld(importer, world, c_void_p())
+
+ result = quicktime.GraphicsImportDraw(importer)
+ quicktime.DisposeGWorld(world)
+ quicktime.CloseComponent(importer)
+
+ if result != 0:
+ raise ImageDecodeException(filename or file)
+
+ pitch = len(format) * width
+
+ return ImageData(width, height, format, buffer, -pitch)
+
+ def decode_animation(self, file, filename):
+ # TODO: Stop playing chicken with the GC
+ # TODO: Cleanup in errors
+
+ quicktime.EnterMovies()
+
+ data_ref = self._get_data_ref(file, filename)
+ if not data_ref:
+ raise ImageDecodeException(filename or file)
+
+ movie = c_void_p()
+ id = c_short()
+ result = quicktime.NewMovieFromDataRef(byref(movie),
+ newMovieActive,
+ 0,
+ data_ref,
+ PointerDataHandlerSubType)
+
+ if not movie:
+ #_oscheck(result)
+ raise ImageDecodeException(filename or file)
+ quicktime.GoToBeginningOfMovie(movie)
+
+ time_scale = float(quicktime.GetMovieTimeScale(movie))
+
+ format, qtformat = self._get_formats()
+
+ # Get movie width and height
+ rect = Rect()
+ quicktime.GetMovieBox(movie, byref(rect))
+ width = rect.right
+ height = rect.bottom
+ pitch = len(format) * width
+
+ # Set gworld
+ buffer = (c_byte * (width * height * len(format)))()
+ world = GWorldPtr()
+ quicktime.QTNewGWorldFromPtr(byref(world), qtformat,
+ byref(rect), c_void_p(), c_void_p(), 0, buffer,
+ len(format) * width)
+ quicktime.SetGWorld(world, 0)
+ quicktime.SetMovieGWorld(movie, world, 0)
+
+ visual = quicktime.GetMovieIndTrackType(movie, 1,
+ VisualMediaCharacteristic,
+ movieTrackCharacteristic)
+ if not visual:
+ raise ImageDecodeException('No video track')
+
+ time = 0
+
+ interesting_time = c_int()
+ quicktime.GetTrackNextInterestingTime(
+ visual,
+ nextTimeMediaSample,
+ time,
+ 1,
+ byref(interesting_time),
+ None)
+ duration = interesting_time.value / time_scale
+
+ frames = []
+
+ while time >= 0:
+ result = quicktime.GetMoviesError()
+ if result == noErr:
+ # force redraw
+ result = quicktime.UpdateMovie(movie)
+ if result == noErr:
+ # process movie
+ quicktime.MoviesTask(movie, 0)
+ result = quicktime.GetMoviesError()
+ _oscheck(result)
+
+ buffer_copy = (c_byte * len(buffer))()
+ memmove(buffer_copy, buffer, len(buffer))
+ image = ImageData(width, height, format, buffer_copy, -pitch)
+ frames.append(AnimationFrame(image, duration))
+
+ interesting_time = c_int()
+ duration = c_int()
+ quicktime.GetTrackNextInterestingTime(
+ visual,
+ nextTimeMediaSample,
+ time,
+ 1,
+ byref(interesting_time),
+ byref(duration))
+
+ quicktime.SetMovieTimeValue(movie, interesting_time)
+ time = interesting_time.value
+ duration = duration.value / time_scale
+ if duration <= 0.01:
+ duration = 0.1
+
+ quicktime.DisposeMovie(movie)
+ carbon.DisposeHandle(data_ref)
+
+ quicktime.ExitMovies()
+
+ return Animation(frames)
+
+def get_decoders():
+ return [QuickTimeImageDecoder()]
+
+def get_encoders():
+ return []
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/s3tc.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/s3tc.py
new file mode 100644
index 0000000..cbe33e1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/image/codecs/s3tc.py
@@ -0,0 +1,389 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+# $Id:$
+
+'''Software decoder for S3TC compressed texture (i.e., DDS).
+
+http://oss.sgi.com/projects/ogl-sample/registry/EXT/texture_compression_s3tc.txt
+'''
+from __future__ import division
+from builtins import range
+
+import ctypes
+import re
+
+from pyglet.gl import *
+from pyglet.gl import gl_info
+from pyglet.image import AbstractImage, Texture
+
+split_8byte = re.compile('.' * 8, flags=re.DOTALL)
+split_16byte = re.compile('.' * 16, flags=re.DOTALL)
+
+class PackedImageData(AbstractImage):
+ _current_texture = None
+
+ def __init__(self, width, height, format, packed_format, data):
+ super(PackedImageData, self).__init__(width, height)
+ self.format = format
+ self.packed_format = packed_format
+ self.data = data
+
+ def unpack(self):
+ if self.packed_format == GL_UNSIGNED_SHORT_5_6_5:
+ # Unpack to GL_RGB. Assume self.data is already 16-bit
+ i = 0
+ out = (ctypes.c_ubyte * (self.width * self.height * 3))()
+ for c in self.data:
+ out[i+2] = (c & 0x1f) << 3
+ out[i+1] = (c & 0x7e0) >> 3
+ out[i] = (c & 0xf800) >> 8
+ i += 3
+ self.data = out
+ self.packed_format = GL_UNSIGNED_BYTE
+
+ def _get_texture(self):
+ if self._current_texture:
+ return self._current_texture
+
+ texture = Texture.create_for_size(
+ GL_TEXTURE_2D, self.width, self.height)
+ glBindTexture(texture.target, texture.id)
+ glTexParameteri(texture.target, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
+
+ if not gl_info.have_version(1, 2) or True:
+ self.unpack()
+
+ glTexImage2D(texture.target, texture.level,
+ self.format, self.width, self.height, 0,
+ self.format, self.packed_format, self.data)
+
+ self._current_texture = texture
+ return texture
+
+ texture = property(_get_texture)
+
+ def get_texture(self, rectangle=False, force_rectangle=False):
+ '''The parameters 'rectangle' and 'force_rectangle' are ignored.
+ See the documentation of the method 'AbstractImage.get_texture' for
+ a more detailed documentation of the method. '''
+ return self._get_texture()
+
+def decode_dxt1_rgb(data, width, height):
+ # Decode to 16-bit RGB UNSIGNED_SHORT_5_6_5
+ out = (ctypes.c_uint16 * (width * height))()
+
+ # Read 8 bytes at a time
+ image_offset = 0
+ for c0_lo, c0_hi, c1_lo, c1_hi, b0, b1, b2, b3 in split_8byte.findall(data):
+ color0 = ord(c0_lo) | ord(c0_hi) << 8
+ color1 = ord(c1_lo) | ord(c1_hi) << 8
+ bits = ord(b0) | ord(b1) << 8 | ord(b2) << 16 | ord(b3) << 24
+
+ r0 = color0 & 0x1f
+ g0 = (color0 & 0x7e0) >> 5
+ b0 = (color0 & 0xf800) >> 11
+ r1 = color1 & 0x1f
+ g1 = (color1 & 0x7e0) >> 5
+ b1 = (color1 & 0xf800) >> 11
+
+ # i is the dest ptr for this block
+ i = image_offset
+ for y in range(4):
+ for x in range(4):
+ code = bits & 0x3
+
+ if code == 0:
+ out[i] = color0
+ elif code == 1:
+ out[i] = color1
+ elif code == 3 and color0 <= color1:
+ out[i] = 0
+ else:
+ if code == 2 and color0 > color1:
+ r = (2 * r0 + r1) // 3
+ g = (2 * g0 + g1) // 3
+ b = (2 * b0 + b1) // 3
+ elif code == 3 and color0 > color1:
+ r = (r0 + 2 * r1) // 3
+ g = (g0 + 2 * g1) // 3
+ b = (b0 + 2 * b1) // 3
+ else:
+ assert code == 2 and color0 <= color1
+ r = (r0 + r1) // 2
+ g = (g0 + g1) // 2
+ b = (b0 + b1) // 2
+ out[i] = r | g << 5 | b << 11
+
+ bits >>= 2
+ i += 1
+ i += width - 4
+
+ # Move dest ptr to next 4x4 block
+ advance_row = (image_offset + 4) % width == 0
+ image_offset += width * 3 * advance_row + 4
+
+ return PackedImageData(width, height,
+ GL_RGB, GL_UNSIGNED_SHORT_5_6_5, out)
+
+def decode_dxt1_rgba(data, width, height):
+ # Decode to GL_RGBA
+ out = (ctypes.c_ubyte * (width * height * 4))()
+ pitch = width << 2
+
+ # Read 8 bytes at a time
+ image_offset = 0
+ for c0_lo, c0_hi, c1_lo, c1_hi, b0, b1, b2, b3 in split_8byte.findall(data):
+ color0 = ord(c0_lo) | ord(c0_hi) << 8
+ color1 = ord(c1_lo) | ord(c1_hi) << 8
+ bits = ord(b0) | ord(b1) << 8 | ord(b2) << 16 | ord(b3) << 24
+
+ r0 = color0 & 0x1f
+ g0 = (color0 & 0x7e0) >> 5
+ b0 = (color0 & 0xf800) >> 11
+ r1 = color1 & 0x1f
+ g1 = (color1 & 0x7e0) >> 5
+ b1 = (color1 & 0xf800) >> 11
+
+ # i is the dest ptr for this block
+ i = image_offset
+ for y in range(4):
+ for x in range(4):
+ code = bits & 0x3
+ a = 255
+
+ if code == 0:
+ r, g, b = r0, g0, b0
+ elif code == 1:
+ r, g, b = r1, g1, b1
+ elif code == 3 and color0 <= color1:
+ r = g = b = a = 0
+ else:
+ if code == 2 and color0 > color1:
+ r = (2 * r0 + r1) // 3
+ g = (2 * g0 + g1) // 3
+ b = (2 * b0 + b1) // 3
+ elif code == 3 and color0 > color1:
+ r = (r0 + 2 * r1) // 3
+ g = (g0 + 2 * g1) // 3
+ b = (b0 + 2 * b1) // 3
+ else:
+ assert code == 2 and color0 <= color1
+ r = (r0 + r1) // 2
+ g = (g0 + g1) // 2
+ b = (b0 + b1) // 2
+
+ out[i] = b << 3
+ out[i+1] = g << 2
+ out[i+2] = r << 3
+ out[i+3] = a << 4
+
+ bits >>= 2
+ i += 4
+ i += pitch - 16
+
+ # Move dest ptr to next 4x4 block
+ advance_row = (image_offset + 16) % pitch == 0
+ image_offset += pitch * 3 * advance_row + 16
+
+ return PackedImageData(width, height, GL_RGBA, GL_UNSIGNED_BYTE, out)
+
+
+def decode_dxt3(data, width, height):
+ # Decode to GL_RGBA
+ out = (ctypes.c_ubyte * (width * height * 4))()
+ pitch = width << 2
+
+ # Read 16 bytes at a time
+ image_offset = 0
+ for (a0, a1, a2, a3, a4, a5, a6, a7,
+ c0_lo, c0_hi, c1_lo, c1_hi,
+ b0, b1, b2, b3) in split_16byte.findall(data):
+ color0 = ord(c0_lo) | ord(c0_hi) << 8
+ color1 = ord(c1_lo) | ord(c1_hi) << 8
+ bits = ord(b0) | ord(b1) << 8 | ord(b2) << 16 | ord(b3) << 24
+ alpha = ord(a0) | ord(a1) << 8 | ord(a2) << 16 | ord(a3) << 24 | \
+ ord(a4) << 32 | ord(a5) << 40 | ord(a6) << 48 | ord(a7) << 56
+
+ r0 = color0 & 0x1f
+ g0 = (color0 & 0x7e0) >> 5
+ b0 = (color0 & 0xf800) >> 11
+ r1 = color1 & 0x1f
+ g1 = (color1 & 0x7e0) >> 5
+ b1 = (color1 & 0xf800) >> 11
+
+ # i is the dest ptr for this block
+ i = image_offset
+ for y in range(4):
+ for x in range(4):
+ code = bits & 0x3
+ a = alpha & 0xf
+
+ if code == 0:
+ r, g, b = r0, g0, b0
+ elif code == 1:
+ r, g, b = r1, g1, b1
+ elif code == 3 and color0 <= color1:
+ r = g = b = 0
+ else:
+ if code == 2 and color0 > color1:
+ r = (2 * r0 + r1) // 3
+ g = (2 * g0 + g1) // 3
+ b = (2 * b0 + b1) // 3
+ elif code == 3 and color0 > color1:
+ r = (r0 + 2 * r1) // 3
+ g = (g0 + 2 * g1) // 3
+ b = (b0 + 2 * b1) // 3
+ else:
+ assert code == 2 and color0 <= color1
+ r = (r0 + r1) // 2
+ g = (g0 + g1) // 2
+ b = (b0 + b1) // 2
+
+ out[i] = b << 3
+ out[i+1] = g << 2
+ out[i+2] = r << 3
+ out[i+3] = a << 4
+
+ bits >>= 2
+ alpha >>= 4
+ i += 4
+ i += pitch - 16
+
+ # Move dest ptr to next 4x4 block
+ advance_row = (image_offset + 16) % pitch == 0
+ image_offset += pitch * 3 * advance_row + 16
+
+ return PackedImageData(width, height, GL_RGBA, GL_UNSIGNED_BYTE, out)
+
+def decode_dxt5(data, width, height):
+ # Decode to GL_RGBA
+ out = (ctypes.c_ubyte * (width * height * 4))()
+ pitch = width << 2
+
+ # Read 16 bytes at a time
+ image_offset = 0
+ for (alpha0, alpha1, ab0, ab1, ab2, ab3, ab4, ab5,
+ c0_lo, c0_hi, c1_lo, c1_hi,
+ b0, b1, b2, b3) in split_16byte.findall(data):
+ color0 = ord(c0_lo) | ord(c0_hi) << 8
+ color1 = ord(c1_lo) | ord(c1_hi) << 8
+ alpha0 = ord(alpha0)
+ alpha1 = ord(alpha1)
+ bits = ord(b0) | ord(b1) << 8 | ord(b2) << 16 | ord(b3) << 24
+ abits = ord(ab0) | ord(ab1) << 8 | ord(ab2) << 16 | ord(ab3) << 24 | \
+ ord(ab4) << 32 | ord(ab5) << 40
+
+ r0 = color0 & 0x1f
+ g0 = (color0 & 0x7e0) >> 5
+ b0 = (color0 & 0xf800) >> 11
+ r1 = color1 & 0x1f
+ g1 = (color1 & 0x7e0) >> 5
+ b1 = (color1 & 0xf800) >> 11
+
+ # i is the dest ptr for this block
+ i = image_offset
+ for y in range(4):
+ for x in range(4):
+ code = bits & 0x3
+ acode = abits & 0x7
+
+ if code == 0:
+ r, g, b = r0, g0, b0
+ elif code == 1:
+ r, g, b = r1, g1, b1
+ elif code == 3 and color0 <= color1:
+ r = g = b = 0
+ else:
+ if code == 2 and color0 > color1:
+ r = (2 * r0 + r1) // 3
+ g = (2 * g0 + g1) // 3
+ b = (2 * b0 + b1) // 3
+ elif code == 3 and color0 > color1:
+ r = (r0 + 2 * r1) // 3
+ g = (g0 + 2 * g1) // 3
+ b = (b0 + 2 * b1) // 3
+ else:
+ assert code == 2 and color0 <= color1
+ r = (r0 + r1) / 2
+ g = (g0 + g1) / 2
+ b = (b0 + b1) / 2
+
+ if acode == 0:
+ a = alpha0
+ elif acode == 1:
+ a = alpha1
+ elif alpha0 > alpha1:
+ if acode == 2:
+ a = (6 * alpha0 + 1 * alpha1) // 7
+ elif acode == 3:
+ a = (5 * alpha0 + 2 * alpha1) // 7
+ elif acode == 4:
+ a = (4 * alpha0 + 3 * alpha1) // 7
+ elif acode == 5:
+ a = (3 * alpha0 + 4 * alpha1) // 7
+ elif acode == 6:
+ a = (2 * alpha0 + 5 * alpha1) // 7
+ else:
+ assert acode == 7
+ a = (1 * alpha0 + 6 * alpha1) // 7
+ else:
+ if acode == 2:
+ a = (4 * alpha0 + 1 * alpha1) // 5
+ elif acode == 3:
+ a = (3 * alpha0 + 2 * alpha1) // 5
+ elif acode == 4:
+ a = (2 * alpha0 + 3 * alpha1) // 5
+ elif acode == 5:
+ a = (1 * alpha0 + 4 * alpha1) // 5
+ elif acode == 6:
+ a = 0
+ else:
+ assert acode == 7
+ a = 255
+
+ out[i] = b << 3
+ out[i+1] = g << 2
+ out[i+2] = r << 3
+ out[i+3] = a
+
+ bits >>= 2
+ abits >>= 3
+ i += 4
+ i += pitch - 16
+
+ # Move dest ptr to next 4x4 block
+ advance_row = (image_offset + 16) % pitch == 0
+ image_offset += pitch * 3 * advance_row + 16
+
+ return PackedImageData(width, height, GL_RGBA, GL_UNSIGNED_BYTE, out)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/info.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/info.py
new file mode 100644
index 0000000..6169f32
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/info.py
@@ -0,0 +1,225 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Get environment information useful for debugging.
+
+Intended usage is to create a file for bug reports, e.g.::
+
+ python -m pyglet.info > info.txt
+
+'''
+from __future__ import print_function
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+_first_heading = True
+def _heading(heading):
+ global _first_heading
+ if not _first_heading:
+ print()
+ else:
+ _first_heading = False
+ print(heading)
+ print('-' * 78)
+
+def dump_python():
+ '''Dump Python version and environment to stdout.'''
+ import os
+ import sys
+ print('sys.version:', sys.version)
+ print('sys.platform:', sys.platform)
+ print('sys.maxint:', sys.maxsize)
+ if sys.platform == 'darwin':
+ try:
+ from objc import __version__ as pyobjc_version
+ print('objc.__version__:', pyobjc_version)
+ except:
+ print('PyObjC not available')
+ print('os.getcwd():', os.getcwd())
+ for key, value in os.environ.items():
+ if key.startswith('PYGLET_'):
+ print("os.environ['%s']: %s" % (key, value))
+
+def dump_pyglet():
+ '''Dump pyglet version and options.'''
+ import pyglet
+ print('pyglet.version:', pyglet.version)
+ print('pyglet.compat_platform:', pyglet.compat_platform)
+ print('pyglet.__file__:', pyglet.__file__)
+ for key, value in pyglet.options.items():
+ print("pyglet.options['%s'] = %r" % (key, value))
+
+def dump_window():
+ '''Dump display, window, screen and default config info.'''
+ import pyglet.window
+ platform = pyglet.window.get_platform()
+ print('platform:', repr(platform))
+ display = platform.get_default_display()
+ print('display:', repr(display))
+ screens = display.get_screens()
+ for i, screen in enumerate(screens):
+ print('screens[%d]: %r' % (i, screen))
+ window = pyglet.window.Window(visible=False)
+ for key, value in window.config.get_gl_attributes():
+ print("config['%s'] = %r" % (key, value))
+ print('context:', repr(window.context))
+
+ _heading('window.context._info')
+ dump_gl(window.context)
+ window.close()
+
+def dump_gl(context=None):
+ '''Dump GL info.'''
+ if context is not None:
+ info = context.get_info()
+ else:
+ from pyglet.gl import gl_info as info
+ print('gl_info.get_version():', info.get_version())
+ print('gl_info.get_vendor():', info.get_vendor())
+ print('gl_info.get_renderer():', info.get_renderer())
+ print('gl_info.get_extensions():')
+ extensions = list(info.get_extensions())
+ extensions.sort()
+ for name in extensions:
+ print(' ', name)
+
+def dump_glu():
+ '''Dump GLU info.'''
+ from pyglet.gl import glu_info
+ print('glu_info.get_version():', glu_info.get_version())
+ print('glu_info.get_extensions():')
+ extensions = list(glu_info.get_extensions())
+ extensions.sort()
+ for name in extensions:
+ print(' ', name)
+
+def dump_glx():
+ '''Dump GLX info.'''
+ try:
+ from pyglet.gl import glx_info
+ except:
+ print('GLX not available.')
+ return
+ import pyglet
+ window = pyglet.window.Window(visible=False)
+ print('context.is_direct():', window.context.is_direct())
+ window.close()
+
+ if not glx_info.have_version(1, 1):
+ print('Version: < 1.1')
+ else:
+ print('glx_info.get_server_vendor():', glx_info.get_server_vendor())
+ print('glx_info.get_server_version():', glx_info.get_server_version())
+ print('glx_info.get_server_extensions():')
+ for name in glx_info.get_server_extensions():
+ print(' ', name)
+ print('glx_info.get_client_vendor():', glx_info.get_client_vendor())
+ print('glx_info.get_client_version():', glx_info.get_client_version())
+ print('glx_info.get_client_extensions():')
+ for name in glx_info.get_client_extensions():
+ print(' ', name)
+ print('glx_info.get_extensions():')
+ for name in glx_info.get_extensions():
+ print(' ', name)
+
+def dump_media():
+ '''Dump pyglet.media info.'''
+ import pyglet.media
+ print('audio driver:', pyglet.media.get_audio_driver())
+
+def dump_avbin():
+ '''Dump AVbin info.'''
+ try:
+ import pyglet.media.avbin
+ print('Library:', pyglet.media.avbin.av)
+ print('AVbin version:', pyglet.media.avbin.av.avbin_get_version())
+ print('FFmpeg revision:', \
+ pyglet.media.avbin.av.avbin_get_ffmpeg_revision())
+ except:
+ print('AVbin not available.')
+
+def dump_al():
+ '''Dump OpenAL info.'''
+ try:
+ from pyglet.media.drivers import openal
+ except:
+ print('OpenAL not available.')
+ return
+ print('Library:', openal.lib_openal._lib)
+
+ driver = openal.create_audio_driver()
+ print('Version: {}.{}'.format(*driver.get_version()))
+ print('Extensions:')
+ for extension in driver.get_extensions():
+ print(' ', extension)
+
+def dump_wintab():
+ '''Dump WinTab info.'''
+ try:
+ from pyglet.input import wintab
+ except:
+ print('WinTab not available.')
+ return
+
+ interface_name = wintab.get_interface_name()
+ impl_version = wintab.get_implementation_version()
+ spec_version = wintab.get_spec_version()
+
+ print('WinTab: %s %d.%d (Spec %d.%d)' % (interface_name,
+ impl_version >> 8, impl_version & 0xff,
+ spec_version >> 8, spec_version & 0xff))
+
+def _try_dump(heading, func):
+ _heading(heading)
+ try:
+ func()
+ except:
+ import traceback
+ traceback.print_exc()
+
+def dump():
+ '''Dump all information to stdout.'''
+ _try_dump('Python', dump_python)
+ _try_dump('pyglet', dump_pyglet)
+ _try_dump('pyglet.window', dump_window)
+ _try_dump('pyglet.gl.glu_info', dump_glu)
+ _try_dump('pyglet.gl.glx_info', dump_glx)
+ _try_dump('pyglet.media', dump_media)
+ _try_dump('pyglet.media.avbin', dump_avbin)
+ _try_dump('pyglet.media.drivers.openal', dump_al)
+ _try_dump('pyglet.input.wintab', dump_wintab)
+
+if __name__ == '__main__':
+ dump()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/__init__.py
new file mode 100644
index 0000000..cb23ecf
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/__init__.py
@@ -0,0 +1,181 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+"""Joystick, tablet and USB HID device support.
+
+This module provides a unified interface to almost any input device, besides
+the regular mouse and keyboard support provided by
+:py:class:`~pyglet.window.Window`. At the lowest
+level, :py:func:`get_devices` can be used to retrieve a list of all supported
+devices, including joysticks, tablets, space controllers, wheels, pedals, remote
+controls, keyboards and mice. The set of returned devices varies greatly
+depending on the operating system (and, of course, what's plugged in).
+
+At this level pyglet does not try to interpret *what* a particular device is,
+merely what controls it provides. A :py:class:`Control` can be either a button,
+whose value is either ``True`` or ``False``, or a relative or absolute-valued
+axis, whose value is a float. Sometimes the name of a control can be provided
+(for example, ``x``, representing the horizontal axis of a joystick), but often
+not. In these cases the device API may still be useful -- the user will have
+to be asked to press each button in turn or move each axis separately to
+identify them.
+
+Higher-level interfaces are provided for joysticks, tablets and the Apple
+remote control. These devices can usually be identified by pyglet positively,
+and a base level of functionality for each one provided through a common
+interface.
+
+To use an input device:
+
+1. Call :py:func:`get_devices`, :py:func:`get_apple_remote` or
+ :py:func:`get_joysticks`
+ to retrieve and identify the device.
+2. For low-level devices (retrieved by :py:func:`get_devices`), query the
+ devices list of controls and determine which ones you are interested in. For
+ high-level interfaces the set of controls is provided by the interface.
+3. Optionally attach event handlers to controls on the device.
+4. Call :py:meth:`Device.open` to begin receiving events on the device. You can
+ begin querying the control values after this time; they will be updated
+ asynchronously.
+5. Call :py:meth:`Device.close` when you are finished with the device (not
+ needed if your application quits at this time).
+
+To use a tablet, follow the procedure above using :py:func:`get_tablets`, but
+note that no control list is available; instead, calling :py:meth:`Tablet.open`
+returns a :py:class:`TabletCanvas` onto which you should set your event
+handlers.
+
+.. versionadded:: 1.2
+
+"""
+from __future__ import absolute_import
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import sys
+
+from .base import Device, Control, RelativeAxis, AbsoluteAxis, Button
+from .base import Joystick, AppleRemote, Tablet
+from .base import DeviceException, DeviceOpenException, DeviceExclusiveException
+
+_is_epydoc = hasattr(sys, 'is_epydoc') and sys.is_epydoc
+
+
+def get_apple_remote(display=None):
+ """Get the Apple remote control device.
+
+ The Apple remote is the small white 6-button remote control that
+ accompanies most recent Apple desktops and laptops. The remote can only
+ be used with Mac OS X.
+
+ :Parameters:
+ display : `~pyglet.canvas.Display`
+ Currently ignored.
+
+ :rtype: AppleRemote
+ :return: The remote device, or `None` if the computer does not support it.
+ """
+ return None
+
+if _is_epydoc:
+ def get_devices(display=None):
+ """Get a list of all attached input devices.
+
+ :Parameters:
+ display : `~pyglet.canvas.Display`
+ The display device to query for input devices. Ignored on Mac
+ OS X and Windows. On Linux, defaults to the default display
+ device.
+
+ :rtype: list of :py:class:`Device`
+ """
+
+ def get_joysticks(display=None):
+ """Get a list of attached joysticks.
+
+ :Parameters:
+ display : `~pyglet.canvas.Display`
+ The display device to query for input devices. Ignored on Mac
+ OS X and Windows. On Linux, defaults to the default display
+ device.
+
+ :rtype: list of :py:class:`Joystick`
+ """
+
+ def get_tablets(display=None):
+ """Get a list of tablets.
+
+ This function may return a valid tablet device even if one is not
+ attached (for example, it is not possible on Mac OS X to determine if
+ a tablet device is connected). Despite returning a list of tablets,
+ pyglet does not currently support multiple tablets, and the behaviour
+ is undefined if more than one is attached.
+
+ :Parameters:
+ display : `~pyglet.canvas.Display`
+ The display device to query for input devices. Ignored on Mac
+ OS X and Windows. On Linux, defaults to the default display
+ device.
+
+ :rtype: list of :py:class:`Tablet`
+ """
+
+else:
+ def get_tablets(display=None):
+ return []
+
+ from pyglet import compat_platform
+
+ if compat_platform.startswith('linux'):
+ from .x11_xinput import get_devices as xinput_get_devices
+ from .x11_xinput_tablet import get_tablets
+ from .evdev import get_devices as evdev_get_devices
+ from .evdev import get_joysticks
+ def get_devices(display=None):
+ return (evdev_get_devices(display) +
+ xinput_get_devices(display))
+ elif compat_platform in ('cygwin', 'win32'):
+ from .directinput import get_devices, get_joysticks
+ try:
+ from .wintab import get_tablets
+ except:
+ pass
+ elif compat_platform == 'darwin':
+ from pyglet import options as pyglet_options
+ if pyglet_options['darwin_cocoa']:
+ from .darwin_hid import get_devices, get_joysticks, get_apple_remote
+ else:
+ from .carbon_hid import get_devices, get_joysticks, get_apple_remote
+ from .carbon_tablet import get_tablets
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/base.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/base.py
new file mode 100644
index 0000000..4033270
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/base.py
@@ -0,0 +1,750 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+"""Interface classes for `pyglet.input`.
+
+.. versionadded:: 1.2
+"""
+from __future__ import division
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import sys
+from pyglet.event import EventDispatcher
+
+_is_epydoc = hasattr(sys, 'is_epydoc') and sys.is_epydoc
+
+
+class DeviceException(Exception):
+ pass
+
+
+class DeviceOpenException(DeviceException):
+ pass
+
+
+class DeviceExclusiveException(DeviceException):
+ pass
+
+
+class Device(object):
+ """Input device.
+
+ :Ivariables:
+ display : `pyglet.canvas.Display`
+ Display this device is connected to.
+ name : str
+ Name of the device, as described by the device firmware.
+ manufacturer : str
+ Name of the device manufacturer, or ``None`` if the information is
+ not available.
+ """
+
+ def __init__(self, display, name):
+ self.display = display
+ self.name = name
+ self.manufacturer = None
+
+ # TODO: make private
+ self.is_open = False
+
+ def open(self, window=None, exclusive=False):
+ """Open the device to begin receiving input from it.
+
+ :Parameters:
+ `window` : Window
+ Optional window to associate with the device. The behaviour
+ of this parameter is device and operating system dependant.
+ It can usually be omitted for most devices.
+ `exclusive` : bool
+ If ``True`` the device will be opened exclusively so that no
+ other application can use it. The method will raise
+ `DeviceExclusiveException` if the device cannot be opened this
+ way (for example, because another application has already
+ opened it).
+ """
+
+ if self.is_open:
+ raise DeviceOpenException('Device is already open.')
+
+ self.is_open = True
+
+ def close(self):
+ """Close the device. """
+ self.is_open = False
+
+ def get_controls(self):
+ """Get a list of controls provided by the device.
+
+ :rtype: list of `Control`
+ """
+ raise NotImplementedError('abstract')
+
+ def __repr__(self):
+ return '%s(name=%s)' % (self.__class__.__name__, self.name)
+
+
+class Control(EventDispatcher):
+ """Single value input provided by a device.
+
+ A control's value can be queried when the device is open. Event handlers
+ can be attached to the control to be called when the value changes.
+
+ The `min` and `max` properties are provided as advertised by the
+ device; in some cases the control's value will be outside this range.
+
+ :Ivariables:
+ `name` : str
+ Name of the control, or ``None`` if unknown
+ `raw_name` : str
+ Unmodified name of the control, as presented by the operating
+ system; or ``None`` if unknown.
+ `inverted` : bool
+ If ``True``, the value reported is actually inverted from what the
+ device reported; usually this is to provide consistency across
+ operating systems.
+ """
+
+ def __init__(self, name, raw_name=None):
+ self.name = name
+ self.raw_name = raw_name
+ self.inverted = False
+ self._value = None
+
+ @property
+ def value(self):
+ """Current value of the control.
+
+ The range of the value is device-dependent; for absolute controls
+ the range is given by ``min`` and ``max`` (however the value may exceed
+ this range); for relative controls the range is undefined.
+
+ :type: float
+ """
+ return self._value
+
+ @value.setter
+ def value(self, newvalue):
+ if newvalue == self._value:
+ return
+ self._value = newvalue
+ self.dispatch_event('on_change', newvalue)
+
+ def __repr__(self):
+ if self.name:
+ return '%s(name=%s, raw_name=%s)' % (
+ self.__class__.__name__, self.name, self.raw_name)
+ else:
+ return '%s(raw_name=%s)' % (self.__class__.__name__, self.raw_name)
+
+ if _is_epydoc:
+ def on_change(self, value):
+ """The value changed.
+
+ :Parameters:
+ `value` : float
+ Current value of the control.
+
+ :event:
+ """
+
+Control.register_event_type('on_change')
+
+
+class RelativeAxis(Control):
+ """An axis whose value represents a relative change from the previous
+ value.
+ """
+
+ #: Name of the horizontal axis control
+ X = 'x'
+ #: Name of the vertical axis control
+ Y = 'y'
+ #: Name of the Z axis control.
+ Z = 'z'
+ #: Name of the rotational-X axis control
+ RX = 'rx'
+ #: Name of the rotational-Y axis control
+ RY = 'ry'
+ #: Name of the rotational-Z axis control
+ RZ = 'rz'
+ #: Name of the scroll wheel control
+ WHEEL = 'wheel'
+
+ @property
+ def value(self):
+ return self._value
+
+ @value.setter
+ def value(self, newvalue):
+ self._value = newvalue
+ self.dispatch_event('on_change', newvalue)
+
+
+class AbsoluteAxis(Control):
+ """An axis whose value represents a physical measurement from the device.
+
+ The value is advertised to range over ``min`` and ``max``.
+
+ :Ivariables:
+ `min` : float
+ Minimum advertised value.
+ `max` : float
+ Maximum advertised value.
+ """
+
+ #: Name of the horizontal axis control
+ X = 'x'
+ #: Name of the vertical axis control
+ Y = 'y'
+ #: Name of the Z axis control.
+ Z = 'z'
+ #: Name of the rotational-X axis control
+ RX = 'rx'
+ #: Name of the rotational-Y axis control
+ RY = 'ry'
+ #: Name of the rotational-Z axis control
+ RZ = 'rz'
+ #: Name of the hat (POV) control, when a single control enumerates all of
+ #: the hat's positions.
+ HAT = 'hat'
+ #: Name of the hat's (POV's) horizontal control, when the hat position is
+ #: described by two orthogonal controls.
+ HAT_X = 'hat_x'
+ #: Name of the hat's (POV's) vertical control, when the hat position is
+ #: described by two orthogonal controls.
+ HAT_Y = 'hat_y'
+
+ def __init__(self, name, min, max, raw_name=None):
+ super(AbsoluteAxis, self).__init__(name, raw_name)
+
+ self.min = min
+ self.max = max
+
+
+class Button(Control):
+ """A control whose value is boolean. """
+
+ @property
+ def value(self):
+ return bool(self._value)
+
+ @value.setter
+ def value(self, newvalue):
+ if newvalue == self._value:
+ return
+ self._value = newvalue
+ self.dispatch_event('on_change', bool(newvalue))
+ if newvalue:
+ self.dispatch_event('on_press')
+ else:
+ self.dispatch_event('on_release')
+
+ if _is_epydoc:
+ def on_press(self):
+ """The button was pressed.
+
+ :event:
+ """
+
+ def on_release(self):
+ """The button was released.
+
+ :event:
+ """
+
+Button.register_event_type('on_press')
+Button.register_event_type('on_release')
+
+
+class Joystick(EventDispatcher):
+ """High-level interface for joystick-like devices. This includes analogue
+ and digital joysticks, gamepads, game controllers, and possibly even
+ steering wheels and other input devices. There is unfortunately no way to
+ distinguish between these different device types.
+
+ To use a joystick, first call `open`, then in your game loop examine
+ the values of `x`, `y`, and so on. These values are normalized to the
+ range [-1.0, 1.0].
+
+ To receive events when the value of an axis changes, attach an
+ on_joyaxis_motion event handler to the joystick. The :py:class:`~pyglet.input.Joystick` instance,
+ axis name, and current value are passed as parameters to this event.
+
+ To handle button events, you should attach on_joybutton_press and
+ on_joy_button_release event handlers to the joystick. Both the :py:class:`~pyglet.input.Joystick`
+ instance and the index of the changed button are passed as parameters to
+ these events.
+
+ Alternately, you may attach event handlers to each individual button in
+ `button_controls` to receive on_press or on_release events.
+
+ To use the hat switch, attach an on_joyhat_motion event handler to the
+ joystick. The handler will be called with both the hat_x and hat_y values
+ whenever the value of the hat switch changes.
+
+ The device name can be queried to get the name of the joystick.
+
+ :Ivariables:
+ `device` : `Device`
+ The underlying device used by this joystick interface.
+ `x` : float
+ Current X (horizontal) value ranging from -1.0 (left) to 1.0
+ (right).
+ `y` : float
+ Current y (vertical) value ranging from -1.0 (top) to 1.0
+ (bottom).
+ `z` : float
+ Current Z value ranging from -1.0 to 1.0. On joysticks the Z
+ value is usually the throttle control. On game controllers the Z
+ value is usually the secondary thumb vertical axis.
+ `rx` : float
+ Current rotational X value ranging from -1.0 to 1.0.
+ `ry` : float
+ Current rotational Y value ranging from -1.0 to 1.0.
+ `rz` : float
+ Current rotational Z value ranging from -1.0 to 1.0. On joysticks
+ the RZ value is usually the twist of the stick. On game
+ controllers the RZ value is usually the secondary thumb horizontal
+ axis.
+ `hat_x` : int
+ Current hat (POV) horizontal position; one of -1 (left), 0
+ (centered) or 1 (right).
+ `hat_y` : int
+ Current hat (POV) vertical position; one of -1 (bottom), 0
+ (centered) or 1 (top).
+ `buttons` : list of bool
+ List of boolean values representing current states of the buttons.
+ These are in order, so that button 1 has value at ``buttons[0]``,
+ and so on.
+ `x_control` : `AbsoluteAxis`
+ Underlying control for `x` value, or ``None`` if not available.
+ `y_control` : `AbsoluteAxis`
+ Underlying control for `y` value, or ``None`` if not available.
+ `z_control` : `AbsoluteAxis`
+ Underlying control for `z` value, or ``None`` if not available.
+ `rx_control` : `AbsoluteAxis`
+ Underlying control for `rx` value, or ``None`` if not available.
+ `ry_control` : `AbsoluteAxis`
+ Underlying control for `ry` value, or ``None`` if not available.
+ `rz_control` : `AbsoluteAxis`
+ Underlying control for `rz` value, or ``None`` if not available.
+ `hat_x_control` : `AbsoluteAxis`
+ Underlying control for `hat_x` value, or ``None`` if not available.
+ `hat_y_control` : `AbsoluteAxis`
+ Underlying control for `hat_y` value, or ``None`` if not available.
+ `button_controls` : list of `Button`
+ Underlying controls for `buttons` values.
+ """
+
+ def __init__(self, device):
+ self.device = device
+
+ self.x = 0
+ self.y = 0
+ self.z = 0
+ self.rx = 0
+ self.ry = 0
+ self.rz = 0
+ self.hat_x = 0
+ self.hat_y = 0
+ self.buttons = []
+
+ self.x_control = None
+ self.y_control = None
+ self.z_control = None
+ self.rx_control = None
+ self.ry_control = None
+ self.rz_control = None
+ self.hat_x_control = None
+ self.hat_y_control = None
+ self.button_controls = []
+
+ def add_axis(control):
+ name = control.name
+ scale = 2.0 / (control.max - control.min)
+ bias = -1.0 - control.min * scale
+ if control.inverted:
+ scale = -scale
+ bias = -bias
+ setattr(self, name + '_control', control)
+
+ @control.event
+ def on_change(value):
+ normalized_value = value * scale + bias
+ setattr(self, name, normalized_value)
+ self.dispatch_event('on_joyaxis_motion', self, name, normalized_value)
+
+ def add_button(control):
+ i = len(self.buttons)
+ self.buttons.append(False)
+ self.button_controls.append(control)
+
+ @control.event
+ def on_change(value):
+ self.buttons[i] = value
+
+ @control.event
+ def on_press():
+ self.dispatch_event('on_joybutton_press', self, i)
+
+ @control.event
+ def on_release():
+ self.dispatch_event('on_joybutton_release', self, i)
+
+ def add_hat(control):
+ # 8-directional hat encoded as a single control (Windows/Mac)
+ self.hat_x_control = control
+ self.hat_y_control = control
+
+ @control.event
+ def on_change(value):
+ if value & 0xffff == 0xffff:
+ self.hat_x = self.hat_y = 0
+ else:
+ if control.max > 8: # DirectInput: scale value
+ value //= 0xfff
+ if 0 <= value < 8:
+ self.hat_x, self.hat_y = (( 0, 1),
+ ( 1, 1),
+ ( 1, 0),
+ ( 1, -1),
+ ( 0, -1),
+ (-1, -1),
+ (-1, 0),
+ (-1, 1))[value]
+ else:
+ # Out of range
+ self.hat_x = self.hat_y = 0
+ self.dispatch_event('on_joyhat_motion', self, self.hat_x, self.hat_y)
+
+ for control in device.get_controls():
+ if isinstance(control, AbsoluteAxis):
+ if control.name in ('x', 'y', 'z', 'rx', 'ry', 'rz', 'hat_x', 'hat_y'):
+ add_axis(control)
+ elif control.name == 'hat':
+ add_hat(control)
+ elif isinstance(control, Button):
+ add_button(control)
+
+ def open(self, window=None, exclusive=False):
+ """Open the joystick device. See `Device.open`. """
+ self.device.open(window, exclusive)
+
+ def close(self):
+ """Close the joystick device. See `Device.close`. """
+ self.device.close()
+
+ def on_joyaxis_motion(self, joystick, axis, value):
+ """The value of a joystick axis changed.
+
+ :Parameters:
+ `joystick` : `Joystick`
+ The joystick device whose axis changed.
+ `axis` : string
+ The name of the axis that changed.
+ `value` : float
+ The current value of the axis, normalized to [-1, 1].
+ """
+
+ def on_joybutton_press(self, joystick, button):
+ """A button on the joystick was pressed.
+
+ :Parameters:
+ `joystick` : `Joystick`
+ The joystick device whose button was pressed.
+ `button` : int
+ The index (in `button_controls`) of the button that was pressed.
+ """
+
+ def on_joybutton_release(self, joystick, button):
+ """A button on the joystick was released.
+
+ :Parameters:
+ `joystick` : `Joystick`
+ The joystick device whose button was released.
+ `button` : int
+ The index (in `button_controls`) of the button that was released.
+ """
+
+ def on_joyhat_motion(self, joystick, hat_x, hat_y):
+ """The value of the joystick hat switch changed.
+
+ :Parameters:
+ `joystick` : `Joystick`
+ The joystick device whose hat control changed.
+ `hat_x` : int
+ Current hat (POV) horizontal position; one of -1 (left), 0
+ (centered) or 1 (right).
+ `hat_y` : int
+ Current hat (POV) vertical position; one of -1 (bottom), 0
+ (centered) or 1 (top).
+ """
+
+Joystick.register_event_type('on_joyaxis_motion')
+Joystick.register_event_type('on_joybutton_press')
+Joystick.register_event_type('on_joybutton_release')
+Joystick.register_event_type('on_joyhat_motion')
+
+
+class AppleRemote(EventDispatcher):
+ """High-level interface for Apple remote control.
+
+ This interface provides access to the 6 button controls on the remote.
+ Pressing and holding certain buttons on the remote is interpreted as
+ a separate control.
+
+ :Ivariables:
+ `device` : `Device`
+ The underlying device used by this interface.
+ `left_control` : `Button`
+ Button control for the left (prev) button.
+ `left_hold_control` : `Button`
+ Button control for holding the left button (rewind).
+ `right_control` : `Button`
+ Button control for the right (next) button.
+ `right_hold_control` : `Button`
+ Button control for holding the right button (fast forward).
+ `up_control` : `Button`
+ Button control for the up (volume increase) button.
+ `down_control` : `Button`
+ Button control for the down (volume decrease) button.
+ `select_control` : `Button`
+ Button control for the select (play/pause) button.
+ `select_hold_control` : `Button`
+ Button control for holding the select button.
+ `menu_control` : `Button`
+ Button control for the menu button.
+ `menu_hold_control` : `Button`
+ Button control for holding the menu button.
+ """
+
+ def __init__(self, device):
+ def add_button(control):
+ setattr(self, control.name + '_control', control)
+
+ @control.event
+ def on_press():
+ self.dispatch_event('on_button_press', control.name)
+
+ @control.event
+ def on_release():
+ self.dispatch_event('on_button_release', control.name)
+
+ self.device = device
+ for control in device.get_controls():
+ if control.name in ('left', 'left_hold', 'right', 'right_hold', 'up', 'down',
+ 'menu', 'select', 'menu_hold', 'select_hold'):
+ add_button(control)
+
+ def open(self, window=None, exclusive=False):
+ """Open the device. See `Device.open`. """
+ self.device.open(window, exclusive)
+
+ def close(self):
+ """Close the device. See `Device.close`. """
+ self.device.close()
+
+ def on_button_press(self, button):
+ """A button on the remote was pressed.
+
+ Only the 'up' and 'down' buttons will generate an event when the
+ button is first pressed. All other buttons on the remote will wait
+ until the button is released and then send both the press and release
+ events at the same time.
+
+ :Parameters:
+ `button` : unicode
+ The name of the button that was pressed. The valid names are
+ 'up', 'down', 'left', 'right', 'left_hold', 'right_hold',
+ 'menu', 'menu_hold', 'select', and 'select_hold'
+
+ :event:
+ """
+
+ def on_button_release(self, button):
+ """A button on the remote was released.
+
+ The 'select_hold' and 'menu_hold' button release events are sent
+ immediately after the corresponding press events regardless of
+ whether or not the user has released the button.
+
+ :Parameters:
+ `button` : unicode
+ The name of the button that was released. The valid names are
+ 'up', 'down', 'left', 'right', 'left_hold', 'right_hold',
+ 'menu', 'menu_hold', 'select', and 'select_hold'
+
+ :event:
+ """
+
+AppleRemote.register_event_type('on_button_press')
+AppleRemote.register_event_type('on_button_release')
+
+
+class Tablet(object):
+ """High-level interface to tablet devices.
+
+ Unlike other devices, tablets must be opened for a specific window,
+ and cannot be opened exclusively. The `open` method returns a
+ `TabletCanvas` object, which supports the events provided by the tablet.
+
+ Currently only one tablet device can be used, though it can be opened on
+ multiple windows. If more than one tablet is connected, the behaviour is
+ undefined.
+ """
+
+ def open(self, window):
+ """Open a tablet device for a window.
+
+ :Parameters:
+ `window` : `Window`
+ The window on which the tablet will be used.
+
+ :rtype: `TabletCanvas`
+ """
+ raise NotImplementedError('abstract')
+
+
+class TabletCanvas(EventDispatcher):
+ """Event dispatcher for tablets.
+
+ Use `Tablet.open` to obtain this object for a particular tablet device and
+ window. Events may be generated even if the tablet stylus is outside of
+ the window; this is operating-system dependent.
+
+ The events each provide the `TabletCursor` that was used to generate the
+ event; for example, to distinguish between a stylus and an eraser. Only
+ one cursor can be used at a time, otherwise the results are undefined.
+
+ :Ivariables:
+ `window` : Window
+ The window on which this tablet was opened.
+ """
+ # OS X: Active window receives tablet events only when cursor is in window
+ # Windows: Active window receives all tablet events
+ #
+ # Note that this means enter/leave pairs are not always consistent (normal
+ # usage).
+
+ def __init__(self, window):
+ self.window = window
+
+ def close(self):
+ """Close the tablet device for this window.
+ """
+ raise NotImplementedError('abstract')
+
+ if _is_epydoc:
+ def on_enter(self, cursor):
+ """A cursor entered the proximity of the window. The cursor may
+ be hovering above the tablet surface, but outside of the window
+ bounds, or it may have entered the window bounds.
+
+ Note that you cannot rely on `on_enter` and `on_leave` events to
+ be generated in pairs; some events may be lost if the cursor was
+ out of the window bounds at the time.
+
+ :Parameters:
+ `cursor` : `TabletCursor`
+ The cursor that entered proximity.
+
+ :event:
+ """
+
+ def on_leave(self, cursor):
+ """A cursor left the proximity of the window. The cursor may have
+ moved too high above the tablet surface to be detected, or it may
+ have left the bounds of the window.
+
+ Note that you cannot rely on `on_enter` and `on_leave` events to
+ be generated in pairs; some events may be lost if the cursor was
+ out of the window bounds at the time.
+
+ :Parameters:
+ `cursor` : `TabletCursor`
+ The cursor that left proximity.
+
+ :event:
+ """
+
+ def on_motion(self, cursor, x, y, pressure):
+ """The cursor moved on the tablet surface.
+
+ If `pressure` is 0, then the cursor is actually hovering above the
+ tablet surface, not in contact.
+
+ :Parameters:
+ `cursor` : `TabletCursor`
+ The cursor that moved.
+ `x` : int
+ The X position of the cursor, in window coordinates.
+ `y` : int
+ The Y position of the cursor, in window coordinates.
+ `pressure` : float
+ The pressure applied to the cursor, in range 0.0 (no
+ pressure) to 1.0 (full pressure).
+ `tilt_x` : float
+ Currently undefined.
+ `tilt_y` : float
+ Currently undefined.
+
+ :event:
+ """
+
+TabletCanvas.register_event_type('on_enter')
+TabletCanvas.register_event_type('on_leave')
+TabletCanvas.register_event_type('on_motion')
+
+
+class TabletCursor(object):
+ """A distinct cursor used on a tablet.
+
+ Most tablets support at least a *stylus* and an *erasor* cursor; this
+ object is used to distinguish them when tablet events are generated.
+
+ :Ivariables:
+ `name` : str
+ Name of the cursor.
+ """
+
+ # TODO well-defined names for stylus and eraser.
+
+ def __init__(self, name):
+ self.name = name
+
+ def __repr__(self):
+ return '%s(%s)' % (self.__class__.__name__, self.name)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/carbon_hid.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/carbon_hid.py
new file mode 100644
index 0000000..5868b0a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/carbon_hid.py
@@ -0,0 +1,521 @@
+#!/usr/bin/env python
+
+'''
+'''
+from __future__ import print_function
+from __future__ import absolute_import
+from builtins import range
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import ctypes
+
+import pyglet
+from pyglet.libs.darwin import carbon, _oscheck, create_cfstring
+from pyglet.libs.darwin.constants import *
+
+from .base import Device, Control, AbsoluteAxis, RelativeAxis, Button
+from .base import Joystick, AppleRemote
+from .base import DeviceExclusiveException
+
+# non-broken c_void_p
+void_p = ctypes.POINTER(ctypes.c_int)
+
+class CFUUIDBytes(ctypes.Structure):
+ _fields_ = [('byte%d' % i, ctypes.c_uint8) for i in range(16)]
+
+mach_port_t = void_p
+io_iterator_t = void_p
+kern_return_t = ctypes.c_int
+IOReturn = ctypes.c_uint
+CFDictionaryRef = void_p
+CFMutableDictionaryRef = void_p
+CFArrayRef = void_p
+CFStringRef = void_p
+CFUUIDRef = ctypes.POINTER(CFUUIDBytes)
+AbsoluteTime = ctypes.c_double
+HRESULT = ctypes.c_int
+REFIID = CFUUIDBytes
+
+IOHIDElementType = ctypes.c_int
+kIOHIDElementTypeInput_Misc = 1
+kIOHIDElementTypeInput_Button = 2
+kIOHIDElementTypeInput_Axis = 3
+kIOHIDElementTypeInput_ScanCodes = 4
+kIOHIDElementTypeOutput = 129
+kIOHIDElementTypeFeature = 257
+kIOHIDElementTypeCollection = 513
+
+IOHIDElementCookie = ctypes.c_void_p
+
+# Full list in IOHIDUsageTables.h
+kHIDPage_GenericDesktop = 0x01
+kHIDUsage_GD_Joystick = 0x04
+kHIDUsage_GD_GamePad = 0x05
+kHIDUsage_GD_Keyboard = 0x06
+kHIDUsage_GD_Keypad = 0x07
+kHIDUsage_GD_MultiAxisController = 0x08
+
+kHIDUsage_GD_SystemAppMenu = 0x86
+kHIDUsage_GD_SystemMenu = 0x89
+kHIDUsage_GD_SystemMenuRight = 0x8A
+kHIDUsage_GD_SystemMenuLeft = 0x8B
+kHIDUsage_GD_SystemMenuUp = 0x8C
+kHIDUsage_GD_SystemMenuDown = 0x8D
+
+kHIDPage_Consumer = 0x0C
+kHIDUsage_Csmr_Menu = 0x40
+kHIDUsage_Csmr_FastForward = 0xB3
+kHIDUsage_Csmr_Rewind = 0xB4
+
+MACH_PORT_NULL = 0
+kIOHIDDeviceKey = "IOHIDDevice"
+kIOServicePlane = "IOService"
+kIOHIDProductIDKey = "ProductID"
+kCFNumberIntType = 9
+
+kIOHIDOptionsTypeSeizeDevice = 1
+
+kIOReturnExclusiveAccess = 0xe00002c5
+
+carbon.CFUUIDGetConstantUUIDWithBytes.restype = CFUUIDRef
+kIOHIDDeviceUserClientTypeID = carbon.CFUUIDGetConstantUUIDWithBytes(None,
+ 0xFA, 0x12, 0xFA, 0x38, 0x6F, 0x1A, 0x11, 0xD4,
+ 0xBA, 0x0C, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5)
+kIOCFPlugInInterfaceID = carbon.CFUUIDGetConstantUUIDWithBytes(None,
+ 0xC2, 0x44, 0xE8, 0x58, 0x10, 0x9C, 0x11, 0xD4,
+ 0x91, 0xD4, 0x00, 0x50, 0xE4, 0xC6, 0x42, 0x6F)
+kIOHIDDeviceInterfaceID = carbon.CFUUIDGetConstantUUIDWithBytes(None,
+ 0x78, 0xBD, 0x42, 0x0C, 0x6F, 0x14, 0x11, 0xD4,
+ 0x94, 0x74, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5)
+
+IOHIDCallbackFunction = ctypes.CFUNCTYPE(None,
+ void_p, IOReturn, ctypes.c_void_p, ctypes.c_void_p)
+CFRunLoopSourceRef = ctypes.c_void_p
+
+class IOHIDEventStruct(ctypes.Structure):
+ _fields_ = (
+ ('type', IOHIDElementType),
+ ('elementCookie', IOHIDElementCookie),
+ ('value', ctypes.c_int32),
+ ('timestamp', AbsoluteTime),
+ ('longValueSize', ctypes.c_uint32),
+ ('longValue', ctypes.c_void_p)
+ )
+
+Self = ctypes.c_void_p
+
+class IUnknown(ctypes.Structure):
+ _fields_ = (
+ ('_reserved', ctypes.c_void_p),
+ ('QueryInterface',
+ ctypes.CFUNCTYPE(HRESULT, Self, REFIID, ctypes.c_void_p)),
+ ('AddRef',
+ ctypes.CFUNCTYPE(ctypes.c_ulong, Self)),
+ ('Release',
+ ctypes.CFUNCTYPE(ctypes.c_ulong, Self)),
+ )
+
+# Most of these function prototypes are not filled in yet because I haven't
+# bothered.
+class IOHIDQueueInterface(ctypes.Structure):
+ _fields_ = IUnknown._fields_ + (
+ ('createAsyncEventSource', ctypes.CFUNCTYPE(IOReturn,
+ Self, ctypes.POINTER(CFRunLoopSourceRef))),
+ ('getAsyncEventSource', ctypes.c_void_p),
+ ('createAsyncPort', ctypes.c_void_p),
+ ('getAsyncPort', ctypes.c_void_p),
+ ('create', ctypes.CFUNCTYPE(IOReturn,
+ Self, ctypes.c_uint32, ctypes.c_uint32)),
+ ('dispose', ctypes.CFUNCTYPE(IOReturn,
+ Self)),
+ ('addElement', ctypes.CFUNCTYPE(IOReturn,
+ Self, IOHIDElementCookie)),
+ ('removeElement', ctypes.c_void_p),
+ ('hasElement', ctypes.c_void_p),
+ ('start', ctypes.CFUNCTYPE(IOReturn,
+ Self)),
+ ('stop', ctypes.CFUNCTYPE(IOReturn,
+ Self)),
+ ('getNextEvent', ctypes.CFUNCTYPE(IOReturn,
+ Self, ctypes.POINTER(IOHIDEventStruct), AbsoluteTime,
+ ctypes.c_uint32)),
+ ('setEventCallout', ctypes.CFUNCTYPE(IOReturn,
+ Self, IOHIDCallbackFunction, ctypes.c_void_p, ctypes.c_void_p)),
+ ('getEventCallout', ctypes.c_void_p),
+ )
+
+class IOHIDDeviceInterface(ctypes.Structure):
+ _fields_ = IUnknown._fields_ + (
+ ('createAsyncEventSource', ctypes.c_void_p),
+ ('getAsyncEventSource', ctypes.c_void_p),
+ ('createAsyncPort', ctypes.c_void_p),
+ ('getAsyncPort', ctypes.c_void_p),
+ ('open', ctypes.CFUNCTYPE(IOReturn,
+ Self, ctypes.c_uint32)),
+ ('close', ctypes.CFUNCTYPE(IOReturn,
+ Self)),
+ ('setRemovalCallback', ctypes.c_void_p),
+ ('getElementValue', ctypes.CFUNCTYPE(IOReturn,
+ Self, IOHIDElementCookie, ctypes.POINTER(IOHIDEventStruct))),
+ ('setElementValue', ctypes.c_void_p),
+ ('queryElementValue', ctypes.c_void_p),
+ ('startAllQueues', ctypes.c_void_p),
+ ('stopAllQueues', ctypes.c_void_p),
+ ('allocQueue', ctypes.CFUNCTYPE(
+ ctypes.POINTER(ctypes.POINTER(IOHIDQueueInterface)),
+ Self)),
+ ('allocOutputTransaction', ctypes.c_void_p),
+ # 1.2.1 (10.2.3)
+ ('setReport', ctypes.c_void_p),
+ ('getReport', ctypes.c_void_p),
+ # 1.2.2 (10.3)
+ ('copyMatchingElements', ctypes.CFUNCTYPE(IOReturn,
+ Self, CFDictionaryRef, ctypes.POINTER(CFArrayRef))),
+ ('setInterruptReportHandlerCallback', ctypes.c_void_p),
+ )
+
+def get_master_port():
+ master_port = mach_port_t()
+ _oscheck(
+ carbon.IOMasterPort(MACH_PORT_NULL, ctypes.byref(master_port))
+ )
+ return master_port
+
+def get_matching_dictionary():
+ carbon.IOServiceMatching.restype = CFMutableDictionaryRef
+ matching_dictionary = carbon.IOServiceMatching(kIOHIDDeviceKey)
+ return matching_dictionary
+
+def get_matching_services(master_port, matching_dictionary):
+ # Consumes reference to matching_dictionary
+ iterator = io_iterator_t()
+ _oscheck(
+ carbon.IOServiceGetMatchingServices(master_port,
+ matching_dictionary,
+ ctypes.byref(iterator))
+ )
+ services = []
+ while carbon.IOIteratorIsValid(iterator):
+ service = carbon.IOIteratorNext(iterator)
+ if not service:
+ break
+ services.append(service)
+ carbon.IOObjectRelease(iterator)
+ return services
+
+def cfstring_to_string(value_string):
+ value_length = carbon.CFStringGetLength(value_string)
+ buffer_length = carbon.CFStringGetMaximumSizeForEncoding(
+ value_length, kCFStringEncodingUTF8)
+ buffer = ctypes.c_buffer(buffer_length + 1)
+ result = carbon.CFStringGetCString(value_string,
+ buffer,
+ len(buffer),
+ kCFStringEncodingUTF8)
+ if not result:
+ return
+ return buffer.value
+
+def cfnumber_to_int(value):
+ result = ctypes.c_int()
+ carbon.CFNumberGetValue(value, kCFNumberIntType, ctypes.byref(result))
+ return result.value
+
+def cfboolean_to_bool(value):
+ return bool(carbon.CFBooleanGetValue(value))
+
+def cfvalue_to_value(value):
+ if not value:
+ return None
+ value_type = carbon.CFGetTypeID(value)
+ if value_type == carbon.CFStringGetTypeID():
+ return cfstring_to_string(value)
+ elif value_type == carbon.CFNumberGetTypeID():
+ return cfnumber_to_int(value)
+ elif value_type == carbon.CFBooleanGetTypeID():
+ return cfboolean_to_bool(value)
+ else:
+ return None
+
+def get_property_value(properties, key):
+ key_string = create_cfstring(key)
+ value = ctypes.c_void_p()
+ present = carbon.CFDictionaryGetValueIfPresent(properties,
+ key_string,
+ ctypes.byref(value))
+ carbon.CFRelease(key_string)
+ if not present:
+ return None
+
+ return value
+
+def get_property(properties, key):
+ return cfvalue_to_value(get_property_value(properties, key))
+
+def dump_properties(properties):
+ def func(key, value, context):
+ print('%s = %s' % (cfstring_to_string(key), cfvalue_to_value(value)))
+ CFDictionaryApplierFunction = ctypes.CFUNCTYPE(None,
+ ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)
+ carbon.CFDictionaryApplyFunction(properties,
+ CFDictionaryApplierFunction(func), None)
+
+class DarwinHIDDevice(Device):
+ '''
+ :IVariables:
+ `name` : str
+ `manufacturer` : str
+
+ '''
+ def __init__(self, display, generic_device):
+ super(DarwinHIDDevice, self).__init__(display, name=None)
+
+ self._device = self._get_device_interface(generic_device)
+
+ properties = CFMutableDictionaryRef()
+ _oscheck(
+ carbon.IORegistryEntryCreateCFProperties(generic_device,
+ ctypes.byref(properties),
+ None, 0)
+ )
+
+ self.name = get_property(properties, "Product")
+ self.manufacturer = get_property(properties, "Manufacturer")
+ self.usage_page = get_property(properties, 'PrimaryUsagePage')
+ self.usage = get_property(properties, 'PrimaryUsage')
+
+ carbon.CFRelease(properties)
+
+ self._controls = self._init_controls()
+
+ self._open = False
+ self._queue = None
+ self._queue_depth = 8 # Number of events queue can buffer
+
+
+ def _get_device_interface(self, generic_device):
+ plug_in_interface = \
+ ctypes.POINTER(ctypes.POINTER(IUnknown))()
+ score = ctypes.c_int32()
+ _oscheck(
+ carbon.IOCreatePlugInInterfaceForService(
+ generic_device,
+ kIOHIDDeviceUserClientTypeID,
+ kIOCFPlugInInterfaceID,
+ ctypes.byref(plug_in_interface),
+ ctypes.byref(score))
+ )
+
+ carbon.CFUUIDGetUUIDBytes.restype = CFUUIDBytes
+ hid_device_interface = \
+ ctypes.POINTER(ctypes.POINTER(IOHIDDeviceInterface))()
+ _oscheck(
+ plug_in_interface.contents.contents.QueryInterface(
+ plug_in_interface,
+ carbon.CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID),
+ ctypes.byref(hid_device_interface))
+ )
+
+ plug_in_interface.contents.contents.Release(plug_in_interface)
+
+ return hid_device_interface
+
+ def _init_controls(self):
+ elements_array = CFArrayRef()
+ _oscheck(
+ self._device.contents.contents.copyMatchingElements(self._device,
+ None, ctypes.byref(elements_array))
+ )
+
+ self._control_cookies = {}
+ controls = []
+ n_elements = carbon.CFArrayGetCount(elements_array)
+ for i in range(n_elements):
+ properties = carbon.CFArrayGetValueAtIndex(elements_array, i)
+ control = _create_control(properties)
+ if control:
+ controls.append(control)
+ self._control_cookies[control._cookie] = control
+
+ carbon.CFRelease(elements_array)
+
+ return controls
+
+ def open(self, window=None, exclusive=False):
+ super(DarwinHIDDevice, self).open(window, exclusive)
+
+ flags = 0
+ if exclusive:
+ flags |= kIOHIDOptionsTypeSeizeDevice
+ result = self._device.contents.contents.open(self._device, flags)
+ if result == 0:
+ self._open = True
+ elif result == kIOReturnExclusiveAccess:
+ raise DeviceExclusiveException()
+
+ # Create event queue
+ self._queue = self._device.contents.contents.allocQueue(self._device)
+ _oscheck(
+ self._queue.contents.contents.create(self._queue,
+ 0, self._queue_depth)
+ )
+ # Add all controls into queue
+ for control in self._controls:
+ r = self._queue.contents.contents.addElement(self._queue,
+ control._cookie, 0)
+ if r != 0:
+ print('error adding %r' % control)
+
+ self._event_source = CFRunLoopSourceRef()
+ self._queue_callback_func = IOHIDCallbackFunction(self._queue_callback)
+
+ _oscheck(
+ self._queue.contents.contents.createAsyncEventSource(self._queue,
+ ctypes.byref(self._event_source))
+ )
+
+ _oscheck(
+ self._queue.contents.contents.setEventCallout(self._queue,
+ self._queue_callback_func, None, None)
+ )
+
+ event_loop = pyglet.app.platform_event_loop._event_loop
+ carbon.GetCFRunLoopFromEventLoop.restype = void_p
+ run_loop = carbon.GetCFRunLoopFromEventLoop(event_loop)
+ kCFRunLoopDefaultMode = \
+ CFStringRef.in_dll(carbon, 'kCFRunLoopDefaultMode')
+ carbon.CFRunLoopAddSource(run_loop,
+ self._event_source,
+ kCFRunLoopDefaultMode)
+
+ _oscheck(
+ self._queue.contents.contents.start(self._queue)
+ )
+
+ def close(self):
+ super(DarwinHIDDevice, self).close()
+
+ if not self._open:
+ return
+
+
+ _oscheck(
+ self._queue.contents.contents.stop(self._queue)
+ )
+ _oscheck(
+ self._queue.contents.contents.dispose(self._queue)
+ )
+ self._queue.contents.contents.Release(self._queue)
+ self._queue = None
+ _oscheck(
+ self._device.contents.contents.close(self._device)
+ )
+ self._open = False
+
+ def get_controls(self):
+ return self._controls
+
+ def _queue_callback(self, target, result, refcon, sender):
+ if not self._open:
+ return
+
+ event = IOHIDEventStruct()
+ r = self._queue.contents.contents.getNextEvent(self._queue,
+ ctypes.byref(event), 0, 0)
+ while r == 0:
+ try:
+ control = self._control_cookies[event.elementCookie]
+ control.value = event.value
+ except KeyError:
+ pass
+
+ r = self._queue.contents.contents.getNextEvent(self._queue,
+ ctypes.byref(event), 0, 0)
+
+_axis_names = {
+ (0x01, 0x30): 'x',
+ (0x01, 0x31): 'y',
+ (0x01, 0x32): 'z',
+ (0x01, 0x33): 'rx',
+ (0x01, 0x34): 'ry',
+ (0x01, 0x35): 'rz',
+ (0x01, 0x38): 'wheel',
+ (0x01, 0x39): 'hat',
+}
+
+_button_names = {
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemAppMenu): 'menu',
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemMenu): 'select',
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemMenuRight): 'right',
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemMenuLeft): 'left',
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemMenuUp): 'up',
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemMenuDown): 'down',
+ (kHIDPage_Consumer, kHIDUsage_Csmr_FastForward): 'right_hold',
+ (kHIDPage_Consumer, kHIDUsage_Csmr_Rewind): 'left_hold',
+ (kHIDPage_Consumer, kHIDUsage_Csmr_Menu): 'menu_hold',
+ (0xff01, 0x23): 'select_hold',
+}
+
+def _create_control(properties):
+ type = get_property(properties, 'Type')
+ if type not in (kIOHIDElementTypeInput_Misc,
+ kIOHIDElementTypeInput_Axis,
+ kIOHIDElementTypeInput_Button):
+ return
+
+ cookie = get_property(properties, 'ElementCookie')
+ usage_page = get_property(properties, 'UsagePage')
+ usage = get_property(properties, 'Usage')
+ raw_name = get_property(properties, 'Name')
+ if not raw_name:
+ raw_name = '%d:%d' % (usage_page, usage)
+
+ if type in (kIOHIDElementTypeInput_Misc, kIOHIDElementTypeInput_Axis):
+ name = _axis_names.get((usage_page, usage))
+ relative = get_property(properties, 'IsRelative')
+ if relative:
+ control = RelativeAxis(name, raw_name)
+ else:
+ min = get_property(properties, 'Min')
+ max = get_property(properties, 'Max')
+ control = AbsoluteAxis(name, min, max, raw_name)
+ elif type == kIOHIDElementTypeInput_Button:
+ name = _button_names.get((usage_page, usage))
+ control = Button(name, raw_name)
+ else:
+ return
+
+ control._cookie = cookie
+ return control
+
+def _create_joystick(device):
+ # Ignore desktop devices that are not joysticks, gamepads or m-a controllers
+ if device.usage_page == kHIDPage_GenericDesktop and \
+ device.usage not in (kHIDUsage_GD_Joystick,
+ kHIDUsage_GD_GamePad,
+ kHIDUsage_GD_MultiAxisController):
+ return
+
+ # Anything else is interesting enough to be a joystick?
+ return Joystick(device)
+
+def get_devices(display=None):
+ services = get_matching_services(get_master_port(),
+ get_matching_dictionary())
+
+ return [DarwinHIDDevice(display, service) for service in services]
+
+def get_joysticks(display=None):
+ return [joystick
+ for joystick
+ in [_create_joystick(device)
+ for device
+ in get_devices(display)]
+ if joystick is not None]
+
+def get_apple_remote(display=None):
+ for device in get_devices(display):
+ if device.name == 'Apple IR':
+ return AppleRemote(device)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/carbon_tablet.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/carbon_tablet.py
new file mode 100644
index 0000000..45d9f81
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/carbon_tablet.py
@@ -0,0 +1,127 @@
+#!/usr/bin/env python
+
+'''
+'''
+from __future__ import division
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import ctypes
+
+import pyglet
+from pyglet.input.base import Tablet, TabletCanvas, TabletCursor
+from pyglet.window.carbon import CarbonEventHandler
+from pyglet.libs.darwin import *
+from pyglet.libs.darwin import _oscheck
+
+class CarbonTablet(Tablet):
+ name = 'OS X System Tablet'
+
+ def open(self, window):
+ return CarbonTabletCanvas(window)
+
+_carbon_tablet = CarbonTablet()
+
+class CarbonTabletCanvas(TabletCanvas):
+ def __init__(self, window):
+ super(CarbonTabletCanvas, self).__init__(window)
+
+ for funcname in dir(self):
+ func = getattr(self, funcname)
+ if hasattr(func, '_platform_event'):
+ window._install_event_handler(func)
+
+ self._cursors = {}
+ self._cursor = None
+
+ def close(self):
+ # XXX TODO remove event handlers.
+ pass
+
+ def _get_cursor(self, proximity_rec):
+ key = (proximity_rec.vendorID,
+ proximity_rec.tabletID,
+ proximity_rec.pointerID,
+ proximity_rec.deviceID,
+ proximity_rec.systemTabletID,
+ proximity_rec.vendorPointerType,
+ proximity_rec.pointerSerialNumber,
+ proximity_rec.uniqueID,
+ proximity_rec.pointerType)
+
+ if key in self._cursors:
+ cursor = self._cursors[key]
+ else:
+ self._cursors[key] = cursor = \
+ CarbonTabletCursor(proximity_rec.pointerType)
+
+ self._cursor = cursor
+ return cursor
+
+ @CarbonEventHandler(kEventClassTablet, kEventTabletProximity)
+ @CarbonEventHandler(kEventClassTablet, kEventTabletPoint)
+ @CarbonEventHandler(kEventClassMouse, kEventMouseDragged)
+ @CarbonEventHandler(kEventClassMouse, kEventMouseDown)
+ @CarbonEventHandler(kEventClassMouse, kEventMouseUp)
+ @CarbonEventHandler(kEventClassMouse, kEventMouseMoved)
+ def _tablet_event(self, next_handler, ev, data):
+ '''Process tablet event and return True if some event was processed.
+ Return True if no tablet event found.
+ '''
+ event_type = ctypes.c_uint32()
+ r = carbon.GetEventParameter(ev, kEventParamTabletEventType,
+ typeUInt32, None,
+ ctypes.sizeof(event_type), None,
+ ctypes.byref(event_type))
+ if r != noErr:
+ return False
+
+ if event_type.value == kEventTabletProximity:
+ proximity_rec = TabletProximityRec()
+ _oscheck(
+ carbon.GetEventParameter(ev, kEventParamTabletProximityRec,
+ typeTabletProximityRec, None,
+ ctypes.sizeof(proximity_rec), None,
+ ctypes.byref(proximity_rec))
+ )
+ cursor = self._get_cursor(proximity_rec)
+ if proximity_rec.enterProximity:
+ self.dispatch_event('on_enter', cursor)
+ else:
+ self.dispatch_event('on_leave', cursor)
+ elif event_type.value == kEventTabletPoint:
+ point_rec = TabletPointRec()
+ _oscheck(
+ carbon.GetEventParameter(ev, kEventParamTabletPointRec,
+ typeTabletPointRec, None,
+ ctypes.sizeof(point_rec), None,
+ ctypes.byref(point_rec))
+ )
+ #x = point_rec.absX
+ #y = point_rec.absY
+ x, y = self.window._get_mouse_position(ev)
+ pressure = point_rec.pressure / float(0xffff)
+ #point_rec.tiltX,
+ #point_rec.tiltY,
+ #point_rec.rotation,
+ #point_rec.tangentialPressure,
+ self.dispatch_event('on_motion', self._cursor, x, y, pressure,
+ 0., 0.)
+
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+class CarbonTabletCursor(TabletCursor):
+ def __init__(self, cursor_type):
+ # First approximation based on my results from a Wacom consumer
+ # tablet
+ if cursor_type == 1:
+ name = 'Stylus'
+ elif cursor_type == 3:
+ name = 'Eraser'
+ super(CarbonTabletCursor, self).__init__(name)
+
+
+def get_tablets(display=None):
+ return [_carbon_tablet]
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/darwin_hid.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/darwin_hid.py
new file mode 100644
index 0000000..dfc3da0
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/darwin_hid.py
@@ -0,0 +1,603 @@
+from __future__ import print_function
+from __future__ import absolute_import
+from builtins import object
+# Uses the HID API introduced in Mac OS X version 10.5
+# http://developer.apple.com/library/mac/#technotes/tn2007/tn2187.html
+
+import sys
+__LP64__ = (sys.maxsize > 2**32)
+
+from pyglet.libs.darwin.cocoapy import *
+
+# Load iokit framework
+iokit = cdll.LoadLibrary(util.find_library('IOKit'))
+
+# IOKit constants from
+# /System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDKeys.h
+kIOHIDOptionsTypeNone = 0x00
+kIOHIDOptionsTypeSeizeDevice = 0x01
+
+kIOHIDElementTypeInput_Misc = 1
+kIOHIDElementTypeInput_Button = 2
+kIOHIDElementTypeInput_Axis = 3
+kIOHIDElementTypeInput_ScanCodes = 4
+kIOHIDElementTypeOutput = 129
+kIOHIDElementTypeFeature = 257
+kIOHIDElementTypeCollection = 513
+
+# /System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDUsageTables.h
+kHIDPage_GenericDesktop = 0x01
+kHIDPage_Consumer = 0x0C
+kHIDUsage_GD_SystemSleep = 0x82
+kHIDUsage_GD_SystemWakeUp = 0x83
+kHIDUsage_GD_SystemAppMenu = 0x86
+kHIDUsage_GD_SystemMenu = 0x89
+kHIDUsage_GD_SystemMenuRight = 0x8A
+kHIDUsage_GD_SystemMenuLeft = 0x8B
+kHIDUsage_GD_SystemMenuUp = 0x8C
+kHIDUsage_GD_SystemMenuDown = 0x8D
+kHIDUsage_Csmr_Menu = 0x40
+kHIDUsage_Csmr_FastForward = 0xB3
+kHIDUsage_Csmr_Rewind = 0xB4
+kHIDUsage_Csmr_Eject = 0xB8
+kHIDUsage_Csmr_Mute = 0xE2
+kHIDUsage_Csmr_VolumeIncrement = 0xE9
+kHIDUsage_Csmr_VolumeDecrement = 0xEA
+
+IOReturn = c_int # IOReturn.h
+IOOptionBits = c_uint32 # IOTypes.h
+
+# IOHIDKeys.h
+IOHIDElementType = c_int
+IOHIDElementCollectionType = c_int
+if __LP64__:
+ IOHIDElementCookie = c_uint32
+else:
+ IOHIDElementCookie = c_void_p
+
+iokit.IOHIDDeviceClose.restype = IOReturn
+iokit.IOHIDDeviceClose.argtypes = [c_void_p, IOOptionBits]
+
+iokit.IOHIDDeviceConformsTo.restype = c_ubyte
+iokit.IOHIDDeviceConformsTo.argtypes = [c_void_p, c_uint32, c_uint32]
+
+iokit.IOHIDDeviceCopyMatchingElements.restype = c_void_p
+iokit.IOHIDDeviceCopyMatchingElements.argtypes = [c_void_p, c_void_p, IOOptionBits]
+
+iokit.IOHIDDeviceGetProperty.restype = c_void_p
+iokit.IOHIDDeviceGetProperty.argtypes = [c_void_p, c_void_p]
+
+iokit.IOHIDDeviceGetTypeID.restype = CFTypeID
+iokit.IOHIDDeviceGetTypeID.argtypes = []
+
+iokit.IOHIDDeviceGetValue.restype = IOReturn
+iokit.IOHIDDeviceGetValue.argtypes = [c_void_p, c_void_p, c_void_p]
+
+iokit.IOHIDDeviceOpen.restype = IOReturn
+iokit.IOHIDDeviceOpen.argtypes = [c_void_p, IOOptionBits]
+
+iokit.IOHIDDeviceRegisterInputValueCallback.restype = None
+iokit.IOHIDDeviceRegisterInputValueCallback.argtypes = [c_void_p, c_void_p, c_void_p]
+
+iokit.IOHIDDeviceRegisterRemovalCallback.restype = None
+iokit.IOHIDDeviceRegisterRemovalCallback.argtypes = [c_void_p, c_void_p, c_void_p]
+
+iokit.IOHIDDeviceScheduleWithRunLoop.restype = None
+iokit.IOHIDDeviceScheduleWithRunLoop.argtypes = [c_void_p, c_void_p, c_void_p]
+
+iokit.IOHIDDeviceUnscheduleFromRunLoop.restype = None
+iokit.IOHIDDeviceUnscheduleFromRunLoop.argtypes = [c_void_p, c_void_p, c_void_p]
+
+iokit.IOHIDElementGetCollectionType.restype = IOHIDElementCollectionType
+iokit.IOHIDElementGetCollectionType.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetCookie.restype = IOHIDElementCookie
+iokit.IOHIDElementGetCookie.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetLogicalMax.restype = CFIndex
+iokit.IOHIDElementGetLogicalMax.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetLogicalMin.restype = CFIndex
+iokit.IOHIDElementGetLogicalMin.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetName.restype = c_void_p
+iokit.IOHIDElementGetName.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetPhysicalMax.restype = CFIndex
+iokit.IOHIDElementGetPhysicalMax.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetPhysicalMin.restype = CFIndex
+iokit.IOHIDElementGetPhysicalMin.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetReportCount.restype = c_uint32
+iokit.IOHIDElementGetReportCount.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetReportID.restype = c_uint32
+iokit.IOHIDElementGetReportID.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetReportSize.restype = c_uint32
+iokit.IOHIDElementGetReportSize.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetType.restype = IOHIDElementType
+iokit.IOHIDElementGetType.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetTypeID.restype = CFTypeID
+iokit.IOHIDElementGetTypeID.argtypes = []
+
+iokit.IOHIDElementGetUnit.restype = c_uint32
+iokit.IOHIDElementGetUnit.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetUnitExponent.restype = c_uint32
+iokit.IOHIDElementGetUnitExponent.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetUsage.restype = c_uint32
+iokit.IOHIDElementGetUsage.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetUsagePage.restype = c_uint32
+iokit.IOHIDElementGetUsagePage.argtypes = [c_void_p]
+
+iokit.IOHIDElementHasNullState.restype = c_bool
+iokit.IOHIDElementHasNullState.argtypes = [c_void_p]
+
+iokit.IOHIDElementHasPreferredState.restype = c_bool
+iokit.IOHIDElementHasPreferredState.argtypes = [c_void_p]
+
+iokit.IOHIDElementIsArray.restype = c_bool
+iokit.IOHIDElementIsArray.argtypes = [c_void_p]
+
+iokit.IOHIDElementIsNonLinear.restype = c_bool
+iokit.IOHIDElementIsNonLinear.argtypes = [c_void_p]
+
+iokit.IOHIDElementIsRelative.restype = c_bool
+iokit.IOHIDElementIsRelative.argtypes = [c_void_p]
+
+iokit.IOHIDElementIsVirtual.restype = c_bool
+iokit.IOHIDElementIsVirtual.argtypes = [c_void_p]
+
+iokit.IOHIDElementIsWrapping.restype = c_bool
+iokit.IOHIDElementIsWrapping.argtypes = [c_void_p]
+
+iokit.IOHIDManagerCreate.restype = c_void_p
+iokit.IOHIDManagerCreate.argtypes = [CFAllocatorRef, IOOptionBits]
+
+iokit.IOHIDManagerCopyDevices.restype = c_void_p
+iokit.IOHIDManagerCopyDevices.argtypes = [c_void_p]
+
+iokit.IOHIDManagerGetTypeID.restype = CFTypeID
+iokit.IOHIDManagerGetTypeID.argtypes = []
+
+iokit.IOHIDManagerRegisterDeviceMatchingCallback.restype = None
+iokit.IOHIDManagerRegisterDeviceMatchingCallback.argtypes = [c_void_p, c_void_p, c_void_p]
+
+iokit.IOHIDManagerScheduleWithRunLoop.restype = c_void_p
+iokit.IOHIDManagerScheduleWithRunLoop.argtypes = [c_void_p, c_void_p, c_void_p]
+
+iokit.IOHIDManagerSetDeviceMatching.restype = None
+iokit.IOHIDManagerSetDeviceMatching.argtypes = [c_void_p, c_void_p]
+
+iokit.IOHIDValueGetElement.restype = c_void_p
+iokit.IOHIDValueGetElement.argtypes = [c_void_p]
+
+iokit.IOHIDValueGetIntegerValue.restype = CFIndex
+iokit.IOHIDValueGetIntegerValue.argtypes = [c_void_p]
+
+iokit.IOHIDValueGetLength.restype = CFIndex
+iokit.IOHIDValueGetLength.argtypes = [c_void_p]
+
+iokit.IOHIDValueGetTimeStamp.restype = c_uint64
+iokit.IOHIDValueGetTimeStamp.argtypes = [c_void_p]
+
+iokit.IOHIDValueGetTypeID.restype = CFTypeID
+iokit.IOHIDValueGetTypeID.argtypes = []
+
+# Callback function types
+HIDManagerCallback = CFUNCTYPE(None, c_void_p, c_int, c_void_p, c_void_p)
+HIDDeviceCallback = CFUNCTYPE(None, c_void_p, c_int, c_void_p)
+HIDDeviceValueCallback = CFUNCTYPE(None, c_void_p, c_int, c_void_p, c_void_p)
+
+######################################################################
+# HID Class Wrappers
+
+# Lookup tables cache python objects for the devices and elements so that
+# we can avoid creating multiple wrapper objects for the same device.
+_device_lookup = {} # IOHIDDeviceRef to python HIDDevice object
+_element_lookup = {} # IOHIDElementRef to python HIDDeviceElement object
+
+class HIDValue(object):
+ def __init__(self, valueRef):
+ # Check that this is a valid IOHIDValue.
+ assert(valueRef)
+ assert(cf.CFGetTypeID(valueRef) == iokit.IOHIDValueGetTypeID())
+ self.valueRef = valueRef
+ self.timestamp = iokit.IOHIDValueGetTimeStamp(valueRef)
+ self.length = iokit.IOHIDValueGetLength(valueRef)
+ if self.length <= 4:
+ self.intvalue = iokit.IOHIDValueGetIntegerValue(valueRef)
+ else:
+ # Values may be byte data rather than integers.
+ # e.g. the PS3 controller has a 39-byte HIDValue element.
+ # We currently do not try to handle these cases.
+ self.intvalue = None
+ elementRef = c_void_p(iokit.IOHIDValueGetElement(valueRef))
+ self.element = HIDDeviceElement.get_element(elementRef)
+
+class HIDDevice(object):
+ @classmethod
+ def get_device(cls, deviceRef):
+ # deviceRef is a c_void_p pointing to an IOHIDDeviceRef
+ if deviceRef.value in _device_lookup:
+ return _device_lookup[deviceRef.value]
+ else:
+ device = HIDDevice(deviceRef)
+ return device
+
+ def __init__(self, deviceRef):
+ # Check that we've got a valid IOHIDDevice.
+ assert(deviceRef)
+ assert(cf.CFGetTypeID(deviceRef) == iokit.IOHIDDeviceGetTypeID())
+ _device_lookup[deviceRef.value] = self
+ self.deviceRef = deviceRef
+ # Set attributes from device properties.
+ self.transport = self.get_property("Transport")
+ self.vendorID = self.get_property("VendorID")
+ self.vendorIDSource = self.get_property("VendorIDSource")
+ self.productID = self.get_property("ProductID")
+ self.versionNumber = self.get_property("VersionNumber")
+ self.manufacturer = self.get_property("Manufacturer")
+ self.product = self.get_property("Product")
+ self.serialNumber = self.get_property("SerialNumber") # always returns None; apple bug?
+ self.locationID = self.get_property("LocationID")
+ self.primaryUsage = self.get_property("PrimaryUsage")
+ self.primaryUsagePage = self.get_property("PrimaryUsagePage")
+ # Populate self.elements with our device elements.
+ self.get_elements()
+ # Set up callback functions.
+ self.value_observers = set()
+ self.removal_observers = set()
+ self.register_removal_callback()
+ self.register_input_value_callback()
+
+ def dump_info(self):
+ for x in ('manufacturer', 'product', 'transport', 'vendorID', 'vendorIDSource', 'productID',
+ 'versionNumber', 'serialNumber', 'locationID', 'primaryUsage', 'primaryUsagePage'):
+ value = getattr(self, x)
+ print(x + ":", value)
+
+ def unique_identifier(self):
+ # Since we can't rely on the serial number, create our own identifier.
+ # Can use this to find devices when they are plugged back in.
+ return (self.manufacturer, self.product, self.vendorID, self.productID,
+ self.versionNumber, self.primaryUsage, self.primaryUsagePage)
+
+ def get_property(self, name):
+ cfname = CFSTR(name)
+ cfvalue = c_void_p(iokit.IOHIDDeviceGetProperty(self.deviceRef, cfname))
+ cf.CFRelease(cfname)
+ return cftype_to_value(cfvalue)
+
+ def open(self, exclusive_mode=False):
+ if exclusive_mode: options = kIOHIDOptionsTypeSeizeDevice
+ else: options = kIOHIDOptionsTypeNone
+ return bool(iokit.IOHIDDeviceOpen(self.deviceRef, options))
+
+ def close(self):
+ return bool(iokit.IOHIDDeviceClose(self.deviceRef, kIOHIDOptionsTypeNone))
+
+ def schedule_with_run_loop(self):
+ iokit.IOHIDDeviceScheduleWithRunLoop(
+ self.deviceRef,
+ c_void_p(cf.CFRunLoopGetCurrent()),
+ kCFRunLoopDefaultMode)
+
+ def unschedule_from_run_loop(self):
+ iokit.IOHIDDeviceUnscheduleFromRunLoop(
+ self.deviceRef,
+ c_void_p(cf.CFRunLoopGetCurrent()),
+ kCFRunLoopDefaultMode)
+
+ def get_elements(self):
+ cfarray = c_void_p(iokit.IOHIDDeviceCopyMatchingElements(self.deviceRef, None, 0))
+ self.elements = cfarray_to_list(cfarray)
+ cf.CFRelease(cfarray)
+
+ # Page and usage IDs are from the HID usage tables located at
+ # http://www.usb.org/developers/devclass_docs/Hut1_12.pdf
+ def conforms_to(self, page, usage):
+ return bool(iokit.IOHIDDeviceConformsTo(self.deviceRef, page, usage))
+ def is_pointer(self): return self.conforms_to(0x01, 0x01)
+ def is_mouse(self): return self.conforms_to(0x01, 0x02)
+ def is_joystick(self): return self.conforms_to(0x01, 0x04)
+ def is_gamepad(self): return self.conforms_to(0x01, 0x05)
+ def is_keyboard(self): return self.conforms_to(0x01, 0x06)
+ def is_keypad(self): return self.conforms_to(0x01, 0x07)
+ def is_multi_axis(self): return self.conforms_to(0x01, 0x08)
+
+ def py_removal_callback(self, context, result, sender):
+ self = _device_lookup[sender] # avoid wonky python context issues
+ # Dispatch removal message to all observers.
+ for x in self.removal_observers:
+ if hasattr(x, 'device_removed'):
+ x.device_removed(self)
+ # Remove self from device lookup table.
+ del _device_lookup[sender]
+ # Remove device elements from lookup table.
+ for key, value in _element_lookup.items():
+ if value in self.elements:
+ del _element_lookup[key]
+
+ def register_removal_callback(self):
+ self.removal_callback = HIDDeviceCallback(self.py_removal_callback)
+ iokit.IOHIDDeviceRegisterRemovalCallback(
+ self.deviceRef,
+ self.removal_callback,
+ None)
+
+ def add_removal_observer(self, observer):
+ self.removal_observers.add(observer)
+
+ def py_value_callback(self, context, result, sender, value):
+ v = HIDValue(c_void_p(value))
+ # Dispatch value changed message to all observers.
+ for x in self.value_observers:
+ if hasattr(x, 'device_value_changed'):
+ x.device_value_changed(self, v)
+
+ def register_input_value_callback(self):
+ self.value_callback = HIDDeviceValueCallback(self.py_value_callback)
+ iokit.IOHIDDeviceRegisterInputValueCallback(
+ self.deviceRef,
+ self.value_callback,
+ None)
+
+ def add_value_observer(self, observer):
+ self.value_observers.add(observer)
+
+ def get_value(self, element):
+ # If the device is not open, then returns None
+ valueRef = c_void_p()
+ iokit.IOHIDDeviceGetValue(self.deviceRef, element.elementRef, byref(valueRef))
+ if valueRef:
+ return HIDValue(valueRef)
+ else:
+ return None
+
+
+class HIDDeviceElement(object):
+ @classmethod
+ def get_element(cls, elementRef):
+ # elementRef is a c_void_p pointing to an IOHIDDeviceElementRef
+ if elementRef.value in _element_lookup:
+ return _element_lookup[elementRef.value]
+ else:
+ element = HIDDeviceElement(elementRef)
+ return element
+
+ def __init__(self, elementRef):
+ # Check that we've been passed a valid IOHIDElement.
+ assert(elementRef)
+ assert(cf.CFGetTypeID(elementRef) == iokit.IOHIDElementGetTypeID())
+ _element_lookup[elementRef.value] = self
+ self.elementRef = elementRef
+ # Set element properties as attributes.
+ self.cookie = iokit.IOHIDElementGetCookie(elementRef)
+ self.type = iokit.IOHIDElementGetType(elementRef)
+ if self.type == kIOHIDElementTypeCollection:
+ self.collectionType = iokit.IOHIDElementGetCollectionType(elementRef)
+ else:
+ self.collectionType = None
+ self.usagePage = iokit.IOHIDElementGetUsagePage(elementRef)
+ self.usage = iokit.IOHIDElementGetUsage(elementRef)
+ self.isVirtual = bool(iokit.IOHIDElementIsVirtual(elementRef))
+ self.isRelative = bool(iokit.IOHIDElementIsRelative(elementRef))
+ self.isWrapping = bool(iokit.IOHIDElementIsWrapping(elementRef))
+ self.isArray = bool(iokit.IOHIDElementIsArray(elementRef))
+ self.isNonLinear = bool(iokit.IOHIDElementIsNonLinear(elementRef))
+ self.hasPreferredState = bool(iokit.IOHIDElementHasPreferredState(elementRef))
+ self.hasNullState = bool(iokit.IOHIDElementHasNullState(elementRef))
+ self.name = cftype_to_value(iokit.IOHIDElementGetName(elementRef))
+ self.reportID = iokit.IOHIDElementGetReportID(elementRef)
+ self.reportSize = iokit.IOHIDElementGetReportSize(elementRef)
+ self.reportCount = iokit.IOHIDElementGetReportCount(elementRef)
+ self.unit = iokit.IOHIDElementGetUnit(elementRef)
+ self.unitExponent = iokit.IOHIDElementGetUnitExponent(elementRef)
+ self.logicalMin = iokit.IOHIDElementGetLogicalMin(elementRef)
+ self.logicalMax = iokit.IOHIDElementGetLogicalMax(elementRef)
+ self.physicalMin = iokit.IOHIDElementGetPhysicalMin(elementRef)
+ self.physicalMax = iokit.IOHIDElementGetPhysicalMax(elementRef)
+
+
+class HIDManager(object):
+ def __init__(self):
+ # Create the HID Manager.
+ self.managerRef = c_void_p(iokit.IOHIDManagerCreate(None, kIOHIDOptionsTypeNone))
+ assert(self.managerRef)
+ assert cf.CFGetTypeID(self.managerRef) == iokit.IOHIDManagerGetTypeID()
+ self.schedule_with_run_loop()
+ self.matching_observers = set()
+ self.register_matching_callback()
+ self.get_devices()
+
+ def get_devices(self):
+ # Tell manager that we are willing to match *any* device.
+ # (Alternatively, we could restrict by device usage, or usage page.)
+ iokit.IOHIDManagerSetDeviceMatching(self.managerRef, None)
+ # Copy the device set and convert it to python.
+ cfset = c_void_p(iokit.IOHIDManagerCopyDevices(self.managerRef))
+ self.devices = cfset_to_set(cfset)
+ cf.CFRelease(cfset)
+
+ def open(self):
+ iokit.IOHIDManagerOpen(self.managerRef, kIOHIDOptionsTypeNone)
+
+ def close(self):
+ iokit.IOHIDManagerClose(self.managerRef, kIOHIDOptionsTypeNone)
+
+ def schedule_with_run_loop(self):
+ iokit.IOHIDManagerScheduleWithRunLoop(
+ self.managerRef,
+ c_void_p(cf.CFRunLoopGetCurrent()),
+ kCFRunLoopDefaultMode)
+
+ def unschedule_from_run_loop(self):
+ iokit.IOHIDManagerUnscheduleFromRunLoop(
+ self.managerRef,
+ c_void_p(cf.CFRunLoopGetCurrent()),
+ kCFRunLoopDefaultMode)
+
+ def py_matching_callback(self, context, result, sender, device):
+ d = HIDDevice.get_device(c_void_p(device))
+ if d not in self.devices:
+ self.devices.add(d)
+ for x in self.matching_observers:
+ if hasattr(x, 'device_discovered'):
+ x.device_discovered(d)
+
+ def register_matching_callback(self):
+ self.matching_callback = HIDManagerCallback(self.py_matching_callback)
+ iokit.IOHIDManagerRegisterDeviceMatchingCallback(
+ self.managerRef,
+ self.matching_callback,
+ None)
+
+######################################################################
+
+# Add conversion methods for IOHIDDevices and IOHIDDeviceElements
+# to the list of known types used by cftype_to_value.
+known_cftypes[iokit.IOHIDDeviceGetTypeID()] = HIDDevice.get_device
+known_cftypes[iokit.IOHIDElementGetTypeID()] = HIDDeviceElement.get_element
+
+
+######################################################################
+# Pyglet interface to HID
+
+from .base import Device, Control, AbsoluteAxis, RelativeAxis, Button
+from .base import Joystick, AppleRemote
+from .base import DeviceExclusiveException
+
+_axis_names = {
+ (0x01, 0x30): 'x',
+ (0x01, 0x31): 'y',
+ (0x01, 0x32): 'z',
+ (0x01, 0x33): 'rx',
+ (0x01, 0x34): 'ry',
+ (0x01, 0x35): 'rz',
+ (0x01, 0x38): 'wheel',
+ (0x01, 0x39): 'hat',
+}
+
+_button_names = {
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemSleep): 'sleep',
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemWakeUp): 'wakeup',
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemAppMenu): 'menu',
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemMenu): 'select',
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemMenuRight): 'right',
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemMenuLeft): 'left',
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemMenuUp): 'up',
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemMenuDown): 'down',
+ (kHIDPage_Consumer, kHIDUsage_Csmr_FastForward): 'right_hold',
+ (kHIDPage_Consumer, kHIDUsage_Csmr_Rewind): 'left_hold',
+ (kHIDPage_Consumer, kHIDUsage_Csmr_Menu): 'menu_hold',
+ (0xff01, 0x23): 'select_hold',
+ (kHIDPage_Consumer, kHIDUsage_Csmr_Eject): 'eject',
+ (kHIDPage_Consumer, kHIDUsage_Csmr_Mute): 'mute',
+ (kHIDPage_Consumer, kHIDUsage_Csmr_VolumeIncrement): 'volume_up',
+ (kHIDPage_Consumer, kHIDUsage_Csmr_VolumeDecrement): 'volume_down'
+}
+
+class PygletDevice(Device):
+ def __init__(self, display, device, manager):
+ super(PygletDevice, self).__init__(display, device.product)
+ self.device = device
+ self.device_identifier = self.device.unique_identifier()
+ self.device.add_value_observer(self)
+ self.device.add_removal_observer(self)
+ manager.matching_observers.add(self)
+ self._create_controls()
+ self._is_open = False
+ self._is_exclusive = False
+
+ def open(self, window=None, exclusive=False):
+ super(PygletDevice, self).open(window, exclusive)
+ self.device.open(exclusive)
+ self.device.schedule_with_run_loop()
+ self._is_open = True
+ self._is_exclusive = exclusive
+ self._set_initial_control_values()
+
+ def close(self):
+ super(PygletDevice, self).close()
+ self.device.close()
+ self._is_open = False
+
+ def get_controls(self):
+ return list(self._controls.values())
+
+ def device_removed(self, hid_device):
+ # Called by device when it is unplugged.
+ # Set device to None, but Keep self._controls around
+ # in case device is plugged back in.
+ self.device = None
+
+ def device_discovered(self, hid_device):
+ # Called by HID manager when new device is found.
+ # If our device was disconnected, reconnect when it is plugged back in.
+ if not self.device and self.device_identifier == hid_device.unique_identifier():
+ self.device = hid_device
+ self.device.add_value_observer(self)
+ self.device.add_removal_observer(self)
+ # Don't need to recreate controls since this is same device.
+ # They are indexed by cookie, which is constant.
+ if self._is_open:
+ self.device.open(self._is_exclusive)
+ self.device.schedule_with_run_loop()
+
+ def device_value_changed(self, hid_device, hid_value):
+ # Called by device when input value changes.
+ control = self._controls[hid_value.element.cookie]
+ control.value = hid_value.intvalue
+
+ def _create_controls(self):
+ self._controls = {}
+ for element in self.device.elements:
+ raw_name = element.name or '0x%x:%x' % (element.usagePage, element.usage)
+ if element.type in (kIOHIDElementTypeInput_Misc, kIOHIDElementTypeInput_Axis):
+ name = _axis_names.get((element.usagePage, element.usage))
+ if element.isRelative:
+ control = RelativeAxis(name, raw_name)
+ else:
+ control = AbsoluteAxis(name, element.logicalMin, element.logicalMax, raw_name)
+ elif element.type == kIOHIDElementTypeInput_Button:
+ name = _button_names.get((element.usagePage, element.usage))
+ control = Button(name, raw_name)
+ else:
+ continue
+
+ control._cookie = element.cookie
+
+ self._controls[control._cookie] = control
+
+ def _set_initial_control_values(self):
+ # Must be called AFTER the device has been opened.
+ for element in self.device.elements:
+ if element.cookie in self._controls:
+ control = self._controls[element.cookie]
+ hid_value = self.device.get_value(element)
+ if hid_value:
+ control.value = hid_value.intvalue
+
+######################################################################
+
+_manager = HIDManager()
+
+def get_devices(display=None):
+ return [ PygletDevice(display, device, _manager) for device in _manager.devices ]
+
+def get_joysticks(display=None):
+ return [ Joystick(PygletDevice(display, device, _manager)) for device in _manager.devices
+ if device.is_joystick() or device.is_gamepad() or device.is_multi_axis() ]
+
+def get_apple_remote(display=None):
+ for device in _manager.devices:
+ if device.product == 'Apple IR':
+ return AppleRemote(PygletDevice(display, device, _manager))
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/directinput.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/directinput.py
new file mode 100644
index 0000000..88cd14e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/directinput.py
@@ -0,0 +1,209 @@
+from builtins import zip
+#!/usr/bin/python
+# $Id:$
+
+import ctypes
+
+import pyglet
+from pyglet.input import base
+from pyglet.libs import win32
+from pyglet.libs.win32 import dinput
+from pyglet.libs.win32 import _kernel32
+
+# These instance names are not defined anywhere, obtained by experiment. The
+# GUID names (which seem to be ideally what are needed) are wrong/missing for
+# most of my devices.
+
+_abs_instance_names = {
+ 0: 'x',
+ 1: 'y',
+ 2: 'z',
+ 3: 'rx',
+ 4: 'ry',
+ 5: 'rz',
+}
+
+_rel_instance_names = {
+ 0: 'x',
+ 1: 'y',
+ 2: 'wheel',
+}
+
+_btn_instance_names = {}
+
+def _create_control(object_instance):
+ raw_name = object_instance.tszName
+ type = object_instance.dwType
+ instance = dinput.DIDFT_GETINSTANCE(type)
+
+ if type & dinput.DIDFT_ABSAXIS:
+ name = _abs_instance_names.get(instance)
+ control = base.AbsoluteAxis(name, 0, 0xffff, raw_name)
+ elif type & dinput.DIDFT_RELAXIS:
+ name = _rel_instance_names.get(instance)
+ control = base.RelativeAxis(name, raw_name)
+ elif type & dinput.DIDFT_BUTTON:
+ name = _btn_instance_names.get(instance)
+ control = base.Button(name, raw_name)
+ elif type & dinput.DIDFT_POV:
+ control = base.AbsoluteAxis(base.AbsoluteAxis.HAT,
+ 0, 0xffffffff, raw_name)
+ else:
+ return
+
+ control._type = object_instance.dwType
+ return control
+
+class DirectInputDevice(base.Device):
+ def __init__(self, display, device, device_instance):
+ name = device_instance.tszInstanceName
+ super(DirectInputDevice, self).__init__(display, name)
+
+ self._type = device_instance.dwDevType & 0xff
+ self._subtype = device_instance.dwDevType & 0xff00
+
+ self._device = device
+ self._init_controls()
+ self._set_format()
+
+ def _init_controls(self):
+ self.controls = []
+ self._device.EnumObjects(
+ dinput.LPDIENUMDEVICEOBJECTSCALLBACK(self._object_enum),
+ None, dinput.DIDFT_ALL)
+
+ def _object_enum(self, object_instance, arg):
+ control = _create_control(object_instance.contents)
+ if control:
+ self.controls.append(control)
+ return dinput.DIENUM_CONTINUE
+
+ def _set_format(self):
+ if not self.controls:
+ return
+
+ object_formats = (dinput.DIOBJECTDATAFORMAT * len(self.controls))()
+ offset = 0
+ for object_format, control in zip(object_formats, self.controls):
+ object_format.dwOfs = offset
+ object_format.dwType = control._type
+ offset += 4
+
+ format = dinput.DIDATAFORMAT()
+ format.dwSize = ctypes.sizeof(format)
+ format.dwObjSize = ctypes.sizeof(dinput.DIOBJECTDATAFORMAT)
+ format.dwFlags = 0
+ format.dwDataSize = offset
+ format.dwNumObjs = len(object_formats)
+ format.rgodf = ctypes.cast(ctypes.pointer(object_formats),
+ dinput.LPDIOBJECTDATAFORMAT)
+ self._device.SetDataFormat(format)
+
+ prop = dinput.DIPROPDWORD()
+ prop.diph.dwSize = ctypes.sizeof(prop)
+ prop.diph.dwHeaderSize = ctypes.sizeof(prop.diph)
+ prop.diph.dwObj = 0
+ prop.diph.dwHow = dinput.DIPH_DEVICE
+ prop.dwData = 64 * ctypes.sizeof(dinput.DIDATAFORMAT)
+ self._device.SetProperty(dinput.DIPROP_BUFFERSIZE,
+ ctypes.byref(prop.diph))
+
+ def open(self, window=None, exclusive=False):
+ if not self.controls:
+ return
+
+ if window is None:
+ # Pick any open window, or the shadow window if no windows
+ # have been created yet.
+ window = pyglet.gl._shadow_window
+ for window in pyglet.app.windows:
+ break
+
+ flags = dinput.DISCL_BACKGROUND
+ if exclusive:
+ flags |= dinput.DISCL_EXCLUSIVE
+ else:
+ flags |= dinput.DISCL_NONEXCLUSIVE
+
+ self._wait_object = _kernel32.CreateEventW(None, False, False, None)
+ self._device.SetEventNotification(self._wait_object)
+ pyglet.app.platform_event_loop.add_wait_object(self._wait_object,
+ self._dispatch_events)
+
+ self._device.SetCooperativeLevel(window._hwnd, flags)
+ self._device.Acquire()
+
+ def close(self):
+ if not self.controls:
+ return
+
+ pyglet.app.platform_event_loop.remove_wait_object(self._wait_object)
+
+ self._device.Unacquire()
+ self._device.SetEventNotification(None)
+
+ _kernel32.CloseHandle(self._wait_object)
+
+ def get_controls(self):
+ return self.controls
+
+ def _dispatch_events(self):
+ if not self.controls:
+ return
+
+ events = (dinput.DIDEVICEOBJECTDATA * 64)()
+ n_events = win32.DWORD(len(events))
+ self._device.GetDeviceData(ctypes.sizeof(dinput.DIDEVICEOBJECTDATA),
+ ctypes.cast(ctypes.pointer(events),
+ dinput.LPDIDEVICEOBJECTDATA),
+ ctypes.byref(n_events),
+ 0)
+ for event in events[:n_events.value]:
+ index = event.dwOfs // 4
+ self.controls[index].value = event.dwData
+
+_i_dinput = None
+
+def _init_directinput():
+ global _i_dinput
+ if _i_dinput:
+ return
+
+ _i_dinput = dinput.IDirectInput8()
+ module = _kernel32.GetModuleHandleW(None)
+ dinput.DirectInput8Create(module, dinput.DIRECTINPUT_VERSION,
+ dinput.IID_IDirectInput8W,
+ ctypes.byref(_i_dinput), None)
+
+def get_devices(display=None):
+ _init_directinput()
+ _devices = []
+
+ def _device_enum(device_instance, arg):
+ device = dinput.IDirectInputDevice8()
+ _i_dinput.CreateDevice(device_instance.contents.guidInstance,
+ ctypes.byref(device),
+ None)
+ _devices.append(DirectInputDevice(display,
+ device, device_instance.contents))
+
+ return dinput.DIENUM_CONTINUE
+
+ _i_dinput.EnumDevices(dinput.DI8DEVCLASS_ALL,
+ dinput.LPDIENUMDEVICESCALLBACK(_device_enum),
+ None, dinput.DIEDFL_ATTACHEDONLY)
+ return _devices
+
+def _create_joystick(device):
+ if device._type in (dinput.DI8DEVTYPE_JOYSTICK,
+ dinput.DI8DEVTYPE_1STPERSON,
+ dinput.DI8DEVTYPE_GAMEPAD):
+ return base.Joystick(device)
+
+def get_joysticks(display=None):
+ return [joystick
+ for joystick
+ in [_create_joystick(device)
+ for device
+ in get_devices(display)]
+ if joystick is not None]
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/evdev.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/evdev.py
new file mode 100644
index 0000000..e489800
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/evdev.py
@@ -0,0 +1,333 @@
+#!/usr/bin/env python
+
+'''
+'''
+from __future__ import absolute_import
+from builtins import hex
+from builtins import range
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import ctypes
+import errno
+import os
+
+import pyglet
+from pyglet.app.xlib import XlibSelectDevice
+from .base import Device, Control, RelativeAxis, AbsoluteAxis, Button, Joystick
+from .base import DeviceOpenException
+from .evdev_constants import *
+
+
+c = pyglet.lib.load_library('c')
+
+_IOC_NRBITS = 8
+_IOC_TYPEBITS = 8
+_IOC_SIZEBITS = 14
+_IOC_DIRBITS = 2
+
+_IOC_NRMASK = ((1 << _IOC_NRBITS)-1)
+_IOC_TYPEMASK = ((1 << _IOC_TYPEBITS)-1)
+_IOC_SIZEMASK = ((1 << _IOC_SIZEBITS)-1)
+_IOC_DIRMASK = ((1 << _IOC_DIRBITS)-1)
+
+_IOC_NRSHIFT = 0
+_IOC_TYPESHIFT = (_IOC_NRSHIFT+_IOC_NRBITS)
+_IOC_SIZESHIFT = (_IOC_TYPESHIFT+_IOC_TYPEBITS)
+_IOC_DIRSHIFT = (_IOC_SIZESHIFT+_IOC_SIZEBITS)
+
+_IOC_NONE = 0
+_IOC_WRITE = 1
+_IOC_READ = 2
+
+def _IOC(dir, type, nr, size):
+ return ((dir << _IOC_DIRSHIFT) |
+ (type << _IOC_TYPESHIFT) |
+ (nr << _IOC_NRSHIFT) |
+ (size << _IOC_SIZESHIFT))
+
+def _IOR(type, nr, struct):
+ request = _IOC(_IOC_READ, ord(type), nr, ctypes.sizeof(struct))
+ def f(fileno):
+ buffer = struct()
+ if c.ioctl(fileno, request, ctypes.byref(buffer)) < 0:
+ err = ctypes.c_int.in_dll(c, 'errno').value
+ raise OSError(err, errno.errorcode[err])
+ return buffer
+ return f
+
+def _IOR_len(type, nr):
+ def f(fileno, buffer):
+ request = _IOC(_IOC_READ, ord(type), nr, ctypes.sizeof(buffer))
+ if c.ioctl(fileno, request, ctypes.byref(buffer)) < 0:
+ err = ctypes.c_int.in_dll(c, 'errno').value
+ raise OSError(err, errno.errorcode[err])
+ return buffer
+ return f
+
+def _IOR_str(type, nr):
+ g = _IOR_len(type, nr)
+ def f(fileno, len=256):
+ return g(fileno, ctypes.create_string_buffer(len)).value
+ return f
+
+time_t = ctypes.c_long
+suseconds_t = ctypes.c_long
+
+class timeval(ctypes.Structure):
+ _fields_ = (
+ ('tv_sec', time_t),
+ ('tv_usec', suseconds_t)
+ )
+
+class input_event(ctypes.Structure):
+ _fields_ = (
+ ('time', timeval),
+ ('type', ctypes.c_uint16),
+ ('code', ctypes.c_uint16),
+ ('value', ctypes.c_int32)
+ )
+
+class input_id(ctypes.Structure):
+ _fields_ = (
+ ('bustype', ctypes.c_uint16),
+ ('vendor', ctypes.c_uint16),
+ ('product', ctypes.c_uint16),
+ ('version', ctypes.c_uint16),
+ )
+
+class input_absinfo(ctypes.Structure):
+ _fields_ = (
+ ('value', ctypes.c_int32),
+ ('minimum', ctypes.c_int32),
+ ('maximum', ctypes.c_int32),
+ ('fuzz', ctypes.c_int32),
+ ('flat', ctypes.c_int32),
+ )
+
+EVIOCGVERSION = _IOR('E', 0x01, ctypes.c_int)
+EVIOCGID = _IOR('E', 0x02, input_id)
+EVIOCGNAME = _IOR_str('E', 0x06)
+EVIOCGPHYS = _IOR_str('E', 0x07)
+EVIOCGUNIQ = _IOR_str('E', 0x08)
+def EVIOCGBIT(fileno, ev, buffer):
+ return _IOR_len('E', 0x20 + ev)(fileno, buffer)
+def EVIOCGABS(fileno, abs):
+ buffer = input_absinfo()
+ return _IOR_len('E', 0x40 + abs)(fileno, buffer)
+
+def get_set_bits(bytes):
+ bits = set()
+ j = 0
+ for byte in bytes:
+ for i in range(8):
+ if byte & 1:
+ bits.add(j + i)
+ byte >>= 1
+ j += 8
+ return bits
+
+_abs_names = {
+ ABS_X: AbsoluteAxis.X,
+ ABS_Y: AbsoluteAxis.Y,
+ ABS_Z: AbsoluteAxis.Z,
+ ABS_RX: AbsoluteAxis.RX,
+ ABS_RY: AbsoluteAxis.RY,
+ ABS_RZ: AbsoluteAxis.RZ,
+ ABS_HAT0X: AbsoluteAxis.HAT_X,
+ ABS_HAT0Y: AbsoluteAxis.HAT_Y,
+}
+
+_rel_names = {
+ REL_X: RelativeAxis.X,
+ REL_Y: RelativeAxis.Y,
+ REL_Z: RelativeAxis.Z,
+ REL_RX: RelativeAxis.RX,
+ REL_RY: RelativeAxis.RY,
+ REL_RZ: RelativeAxis.RZ,
+ REL_WHEEL: RelativeAxis.WHEEL,
+}
+def _create_control(fileno, event_type, event_code):
+ if event_type == EV_ABS:
+ raw_name = abs_raw_names.get(event_code, 'EV_ABS(%x)' % event_code)
+ name = _abs_names.get(event_code)
+ absinfo = EVIOCGABS(fileno, event_code)
+ value = absinfo.value
+ min = absinfo.minimum
+ max = absinfo.maximum
+ control = AbsoluteAxis(name, min, max, raw_name)
+ control.value = value
+
+ if name == 'hat_y':
+ control.inverted = True
+ elif event_type == EV_REL:
+ raw_name = rel_raw_names.get(event_code, 'EV_REL(%x)' % event_code)
+ name = _rel_names.get(event_code)
+ # TODO min/max?
+ control = RelativeAxis(name, raw_name)
+ elif event_type == EV_KEY:
+ raw_name = key_raw_names.get(event_code, 'EV_KEY(%x)' % event_code)
+ name = None
+ control = Button(name, raw_name)
+ else:
+ value = min = max = 0 # TODO
+ return None
+ control._event_type = event_type
+ control._event_code = event_code
+ return control
+
+def _create_joystick(device):
+ # Look for something with an ABS X and ABS Y axis, and a joystick 0 button
+ have_x = False
+ have_y = False
+ have_button = False
+ for control in device.controls:
+ if control._event_type == EV_ABS and control._event_code == ABS_X:
+ have_x = True
+ elif control._event_type == EV_ABS and control._event_code == ABS_Y:
+ have_y = True
+ elif control._event_type == EV_KEY and \
+ control._event_code in (BTN_JOYSTICK, BTN_GAMEPAD):
+ have_button = True
+ if not (have_x and have_y and have_button):
+ return
+
+ return Joystick(device)
+
+event_types = {
+ EV_KEY: KEY_MAX,
+ EV_REL: REL_MAX,
+ EV_ABS: ABS_MAX,
+ EV_MSC: MSC_MAX,
+ EV_LED: LED_MAX,
+ EV_SND: SND_MAX,
+}
+
+class EvdevDevice(XlibSelectDevice, Device):
+ _fileno = None
+
+ def __init__(self, display, filename):
+ self._filename = filename
+
+ fileno = os.open(filename, os.O_RDONLY)
+ #event_version = EVIOCGVERSION(fileno).value
+
+ id = EVIOCGID(fileno)
+ self.id_bustype = id.bustype
+ self.id_vendor = hex(id.vendor)
+ self.id_product = hex(id.product)
+ self.id_version = id.version
+
+ name = EVIOCGNAME(fileno)
+ try:
+ name = name.decode('utf-8')
+ except UnicodeDecodeError:
+ try:
+ name = name.decode('latin-1')
+ except UnicodeDecodeError:
+ pass
+
+ try:
+ self.phys = EVIOCGPHYS(fileno)
+ except OSError:
+ self.phys = ''
+ try:
+ self.uniq = EVIOCGUNIQ(fileno)
+ except OSError:
+ self.uniq = ''
+
+ self.controls = []
+ self.control_map = {}
+
+ event_types_bits = (ctypes.c_byte * 4)()
+ EVIOCGBIT(fileno, 0, event_types_bits)
+ for event_type in get_set_bits(event_types_bits):
+ if event_type not in event_types:
+ continue
+ max_code = event_types[event_type]
+ nbytes = max_code // 8 + 1
+ event_codes_bits = (ctypes.c_byte * nbytes)()
+ EVIOCGBIT(fileno, event_type, event_codes_bits)
+ for event_code in get_set_bits(event_codes_bits):
+ control = _create_control(fileno, event_type, event_code)
+ if control:
+ self.control_map[(event_type, event_code)] = control
+ self.controls.append(control)
+
+ os.close(fileno)
+
+ super(EvdevDevice, self).__init__(display, name)
+
+ def open(self, window=None, exclusive=False):
+ super(EvdevDevice, self).open(window, exclusive)
+
+ try:
+ self._fileno = os.open(self._filename, os.O_RDONLY | os.O_NONBLOCK)
+ except OSError as e:
+ raise DeviceOpenException(e)
+
+ pyglet.app.platform_event_loop._select_devices.add(self)
+
+ def close(self):
+ super(EvdevDevice, self).close()
+
+ if not self._fileno:
+ return
+
+ pyglet.app.platform_event_loop._select_devices.remove(self)
+ os.close(self._fileno)
+ self._fileno = None
+
+ def get_controls(self):
+ return self.controls
+
+ # XlibSelectDevice interface
+
+ def fileno(self):
+ return self._fileno
+
+ def poll(self):
+ # TODO
+ return False
+
+ def select(self):
+ if not self._fileno:
+ return
+
+ events = (input_event * 64)()
+ bytes = c.read(self._fileno, events, ctypes.sizeof(events))
+ if bytes < 0:
+ return
+
+ n_events = bytes // ctypes.sizeof(input_event)
+ for event in events[:n_events]:
+ try:
+ control = self.control_map[(event.type, event.code)]
+ control.value = event.value
+ except KeyError:
+ pass
+
+_devices = {}
+def get_devices(display=None):
+ base = '/dev/input'
+ for filename in os.listdir(base):
+ if filename.startswith('event'):
+ path = os.path.join(base, filename)
+ if path in _devices:
+ continue
+
+ try:
+ _devices[path] = EvdevDevice(display, path)
+ except OSError:
+ pass
+
+ return list(_devices.values())
+
+def get_joysticks(display=None):
+ return [joystick
+ for joystick
+ in [_create_joystick(device)
+ for device
+ in get_devices(display)]
+ if joystick is not None]
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/evdev_constants.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/evdev_constants.py
new file mode 100644
index 0000000..812b90d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/evdev_constants.py
@@ -0,0 +1,582 @@
+#!/usr/bin/env python
+
+"""Event constants from /usr/include/linux/input.h """
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+
+EV_SYN = 0x00
+EV_KEY = 0x01
+EV_REL = 0x02
+EV_ABS = 0x03
+EV_MSC = 0x04
+EV_LED = 0x11
+EV_SND = 0x12
+EV_REP = 0x14
+EV_FF = 0x15
+EV_PWR = 0x16
+EV_FF_STATUS = 0x17
+EV_MAX = 0x1f
+
+# Synchronization events.
+
+SYN_REPORT = 0
+SYN_CONFIG = 1
+
+# Keys and buttons
+
+KEY_RESERVED = 0
+KEY_ESC = 1
+KEY_1 = 2
+KEY_2 = 3
+KEY_3 = 4
+KEY_4 = 5
+KEY_5 = 6
+KEY_6 = 7
+KEY_7 = 8
+KEY_8 = 9
+KEY_9 = 10
+KEY_0 = 11
+KEY_MINUS = 12
+KEY_EQUAL = 13
+KEY_BACKSPACE = 14
+KEY_TAB = 15
+KEY_Q = 16
+KEY_W = 17
+KEY_E = 18
+KEY_R = 19
+KEY_T = 20
+KEY_Y = 21
+KEY_U = 22
+KEY_I = 23
+KEY_O = 24
+KEY_P = 25
+KEY_LEFTBRACE = 26
+KEY_RIGHTBRACE = 27
+KEY_ENTER = 28
+KEY_LEFTCTRL = 29
+KEY_A = 30
+KEY_S = 31
+KEY_D = 32
+KEY_F = 33
+KEY_G = 34
+KEY_H = 35
+KEY_J = 36
+KEY_K = 37
+KEY_L = 38
+KEY_SEMICOLON = 39
+KEY_APOSTROPHE = 40
+KEY_GRAVE = 41
+KEY_LEFTSHIFT = 42
+KEY_BACKSLASH = 43
+KEY_Z = 44
+KEY_X = 45
+KEY_C = 46
+KEY_V = 47
+KEY_B = 48
+KEY_N = 49
+KEY_M = 50
+KEY_COMMA = 51
+KEY_DOT = 52
+KEY_SLASH = 53
+KEY_RIGHTSHIFT = 54
+KEY_KPASTERISK = 55
+KEY_LEFTALT = 56
+KEY_SPACE = 57
+KEY_CAPSLOCK = 58
+KEY_F1 = 59
+KEY_F2 = 60
+KEY_F3 = 61
+KEY_F4 = 62
+KEY_F5 = 63
+KEY_F6 = 64
+KEY_F7 = 65
+KEY_F8 = 66
+KEY_F9 = 67
+KEY_F10 = 68
+KEY_NUMLOCK = 69
+KEY_SCROLLLOCK = 70
+KEY_KP7 = 71
+KEY_KP8 = 72
+KEY_KP9 = 73
+KEY_KPMINUS = 74
+KEY_KP4 = 75
+KEY_KP5 = 76
+KEY_KP6 = 77
+KEY_KPPLUS = 78
+KEY_KP1 = 79
+KEY_KP2 = 80
+KEY_KP3 = 81
+KEY_KP0 = 82
+KEY_KPDOT = 83
+
+KEY_ZENKAKUHANKAKU = 85
+KEY_102ND = 86
+KEY_F11 = 87
+KEY_F12 = 88
+KEY_RO = 89
+KEY_KATAKANA = 90
+KEY_HIRAGANA = 91
+KEY_HENKAN = 92
+KEY_KATAKANAHIRAGANA = 93
+KEY_MUHENKAN = 94
+KEY_KPJPCOMMA = 95
+KEY_KPENTER = 96
+KEY_RIGHTCTRL = 97
+KEY_KPSLASH = 98
+KEY_SYSRQ = 99
+KEY_RIGHTALT = 100
+KEY_LINEFEED = 101
+KEY_HOME = 102
+KEY_UP = 103
+KEY_PAGEUP = 104
+KEY_LEFT = 105
+KEY_RIGHT = 106
+KEY_END = 107
+KEY_DOWN = 108
+KEY_PAGEDOWN = 109
+KEY_INSERT = 110
+KEY_DELETE = 111
+KEY_MACRO = 112
+KEY_MUTE = 113
+KEY_VOLUMEDOWN = 114
+KEY_VOLUMEUP = 115
+KEY_POWER = 116
+KEY_KPEQUAL = 117
+KEY_KPPLUSMINUS = 118
+KEY_PAUSE = 119
+
+KEY_KPCOMMA = 121
+KEY_HANGUEL = 122
+KEY_HANJA = 123
+KEY_YEN = 124
+KEY_LEFTMETA = 125
+KEY_RIGHTMETA = 126
+KEY_COMPOSE = 127
+
+KEY_STOP = 128
+KEY_AGAIN = 129
+KEY_PROPS = 130
+KEY_UNDO = 131
+KEY_FRONT = 132
+KEY_COPY = 133
+KEY_OPEN = 134
+KEY_PASTE = 135
+KEY_FIND = 136
+KEY_CUT = 137
+KEY_HELP = 138
+KEY_MENU = 139
+KEY_CALC = 140
+KEY_SETUP = 141
+KEY_SLEEP = 142
+KEY_WAKEUP = 143
+KEY_FILE = 144
+KEY_SENDFILE = 145
+KEY_DELETEFILE = 146
+KEY_XFER = 147
+KEY_PROG1 = 148
+KEY_PROG2 = 149
+KEY_WWW = 150
+KEY_MSDOS = 151
+KEY_COFFEE = 152
+KEY_DIRECTION = 153
+KEY_CYCLEWINDOWS = 154
+KEY_MAIL = 155
+KEY_BOOKMARKS = 156
+KEY_COMPUTER = 157
+KEY_BACK = 158
+KEY_FORWARD = 159
+KEY_CLOSECD = 160
+KEY_EJECTCD = 161
+KEY_EJECTCLOSECD = 162
+KEY_NEXTSONG = 163
+KEY_PLAYPAUSE = 164
+KEY_PREVIOUSSONG = 165
+KEY_STOPCD = 166
+KEY_RECORD = 167
+KEY_REWIND = 168
+KEY_PHONE = 169
+KEY_ISO = 170
+KEY_CONFIG = 171
+KEY_HOMEPAGE = 172
+KEY_REFRESH = 173
+KEY_EXIT = 174
+KEY_MOVE = 175
+KEY_EDIT = 176
+KEY_SCROLLUP = 177
+KEY_SCROLLDOWN = 178
+KEY_KPLEFTPAREN = 179
+KEY_KPRIGHTPAREN = 180
+
+KEY_F13 = 183
+KEY_F14 = 184
+KEY_F15 = 185
+KEY_F16 = 186
+KEY_F17 = 187
+KEY_F18 = 188
+KEY_F19 = 189
+KEY_F20 = 190
+KEY_F21 = 191
+KEY_F22 = 192
+KEY_F23 = 193
+KEY_F24 = 194
+
+KEY_PLAYCD = 200
+KEY_PAUSECD = 201
+KEY_PROG3 = 202
+KEY_PROG4 = 203
+KEY_SUSPEND = 205
+KEY_CLOSE = 206
+KEY_PLAY = 207
+KEY_FASTFORWARD = 208
+KEY_BASSBOOST = 209
+KEY_PRINT = 210
+KEY_HP = 211
+KEY_CAMERA = 212
+KEY_SOUND = 213
+KEY_QUESTION = 214
+KEY_EMAIL = 215
+KEY_CHAT = 216
+KEY_SEARCH = 217
+KEY_CONNECT = 218
+KEY_FINANCE = 219
+KEY_SPORT = 220
+KEY_SHOP = 221
+KEY_ALTERASE = 222
+KEY_CANCEL = 223
+KEY_BRIGHTNESSDOWN = 224
+KEY_BRIGHTNESSUP = 225
+KEY_MEDIA = 226
+
+KEY_UNKNOWN = 240
+
+BTN_MISC = 0x100
+BTN_0 = 0x100
+BTN_1 = 0x101
+BTN_2 = 0x102
+BTN_3 = 0x103
+BTN_4 = 0x104
+BTN_5 = 0x105
+BTN_6 = 0x106
+BTN_7 = 0x107
+BTN_8 = 0x108
+BTN_9 = 0x109
+
+BTN_MOUSE = 0x110
+BTN_LEFT = 0x110
+BTN_RIGHT = 0x111
+BTN_MIDDLE = 0x112
+BTN_SIDE = 0x113
+BTN_EXTRA = 0x114
+BTN_FORWARD = 0x115
+BTN_BACK = 0x116
+BTN_TASK = 0x117
+
+BTN_JOYSTICK = 0x120
+BTN_TRIGGER = 0x120
+BTN_THUMB = 0x121
+BTN_THUMB2 = 0x122
+BTN_TOP = 0x123
+BTN_TOP2 = 0x124
+BTN_PINKIE = 0x125
+BTN_BASE = 0x126
+BTN_BASE2 = 0x127
+BTN_BASE3 = 0x128
+BTN_BASE4 = 0x129
+BTN_BASE5 = 0x12a
+BTN_BASE6 = 0x12b
+BTN_DEAD = 0x12f
+
+BTN_GAMEPAD = 0x130
+BTN_A = 0x130
+BTN_B = 0x131
+BTN_C = 0x132
+BTN_X = 0x133
+BTN_Y = 0x134
+BTN_Z = 0x135
+BTN_TL = 0x136
+BTN_TR = 0x137
+BTN_TL2 = 0x138
+BTN_TR2 = 0x139
+BTN_SELECT = 0x13a
+BTN_START = 0x13b
+BTN_MODE = 0x13c
+BTN_THUMBL = 0x13d
+BTN_THUMBR = 0x13e
+
+BTN_DIGI = 0x140
+BTN_TOOL_PEN = 0x140
+BTN_TOOL_RUBBER = 0x141
+BTN_TOOL_BRUSH = 0x142
+BTN_TOOL_PENCIL = 0x143
+BTN_TOOL_AIRBRUSH = 0x144
+BTN_TOOL_FINGER = 0x145
+BTN_TOOL_MOUSE = 0x146
+BTN_TOOL_LENS = 0x147
+BTN_TOUCH = 0x14a
+BTN_STYLUS = 0x14b
+BTN_STYLUS2 = 0x14c
+BTN_TOOL_DOUBLETAP = 0x14d
+BTN_TOOL_TRIPLETAP = 0x14e
+
+BTN_WHEEL = 0x150
+BTN_GEAR_DOWN = 0x150
+BTN_GEAR_UP = 0x151
+
+KEY_OK = 0x160
+KEY_SELECT = 0x161
+KEY_GOTO = 0x162
+KEY_CLEAR = 0x163
+KEY_POWER2 = 0x164
+KEY_OPTION = 0x165
+KEY_INFO = 0x166
+KEY_TIME = 0x167
+KEY_VENDOR = 0x168
+KEY_ARCHIVE = 0x169
+KEY_PROGRAM = 0x16a
+KEY_CHANNEL = 0x16b
+KEY_FAVORITES = 0x16c
+KEY_EPG = 0x16d
+KEY_PVR = 0x16e
+KEY_MHP = 0x16f
+KEY_LANGUAGE = 0x170
+KEY_TITLE = 0x171
+KEY_SUBTITLE = 0x172
+KEY_ANGLE = 0x173
+KEY_ZOOM = 0x174
+KEY_MODE = 0x175
+KEY_KEYBOARD = 0x176
+KEY_SCREEN = 0x177
+KEY_PC = 0x178
+KEY_TV = 0x179
+KEY_TV2 = 0x17a
+KEY_VCR = 0x17b
+KEY_VCR2 = 0x17c
+KEY_SAT = 0x17d
+KEY_SAT2 = 0x17e
+KEY_CD = 0x17f
+KEY_TAPE = 0x180
+KEY_RADIO = 0x181
+KEY_TUNER = 0x182
+KEY_PLAYER = 0x183
+KEY_TEXT = 0x184
+KEY_DVD = 0x185
+KEY_AUX = 0x186
+KEY_MP3 = 0x187
+KEY_AUDIO = 0x188
+KEY_VIDEO = 0x189
+KEY_DIRECTORY = 0x18a
+KEY_LIST = 0x18b
+KEY_MEMO = 0x18c
+KEY_CALENDAR = 0x18d
+KEY_RED = 0x18e
+KEY_GREEN = 0x18f
+KEY_YELLOW = 0x190
+KEY_BLUE = 0x191
+KEY_CHANNELUP = 0x192
+KEY_CHANNELDOWN = 0x193
+KEY_FIRST = 0x194
+KEY_LAST = 0x195
+KEY_AB = 0x196
+KEY_NEXT = 0x197
+KEY_RESTART = 0x198
+KEY_SLOW = 0x199
+KEY_SHUFFLE = 0x19a
+KEY_BREAK = 0x19b
+KEY_PREVIOUS = 0x19c
+KEY_DIGITS = 0x19d
+KEY_TEEN = 0x19e
+KEY_TWEN = 0x19f
+
+KEY_DEL_EOL = 0x1c0
+KEY_DEL_EOS = 0x1c1
+KEY_INS_LINE = 0x1c2
+KEY_DEL_LINE = 0x1c3
+
+KEY_FN = 0x1d0
+KEY_FN_ESC = 0x1d1
+KEY_FN_F1 = 0x1d2
+KEY_FN_F2 = 0x1d3
+KEY_FN_F3 = 0x1d4
+KEY_FN_F4 = 0x1d5
+KEY_FN_F5 = 0x1d6
+KEY_FN_F6 = 0x1d7
+KEY_FN_F7 = 0x1d8
+KEY_FN_F8 = 0x1d9
+KEY_FN_F9 = 0x1da
+KEY_FN_F10 = 0x1db
+KEY_FN_F11 = 0x1dc
+KEY_FN_F12 = 0x1dd
+KEY_FN_1 = 0x1de
+KEY_FN_2 = 0x1df
+KEY_FN_D = 0x1e0
+KEY_FN_E = 0x1e1
+KEY_FN_F = 0x1e2
+KEY_FN_S = 0x1e3
+KEY_FN_B = 0x1e4
+
+BTN_TRIGGER_HAPPY = 0x2c0 # These HAPPY constants are used
+BTN_TRIGGER_HAPPY1 = 0x2c0 # by some recent joysticks for
+BTN_TRIGGER_HAPPY2 = 0x2c1 # directional pads or buttons.
+BTN_TRIGGER_HAPPY3 = 0x2c2
+BTN_TRIGGER_HAPPY4 = 0x2c3
+BTN_TRIGGER_HAPPY5 = 0x2c4
+BTN_TRIGGER_HAPPY6 = 0x2c5
+BTN_TRIGGER_HAPPY7 = 0x2c6
+BTN_TRIGGER_HAPPY8 = 0x2c7
+BTN_TRIGGER_HAPPY9 = 0x2c8
+BTN_TRIGGER_HAPPY10 = 0x2c9
+BTN_TRIGGER_HAPPY11 = 0x2ca
+BTN_TRIGGER_HAPPY12 = 0x2cb
+BTN_TRIGGER_HAPPY13 = 0x2cc
+BTN_TRIGGER_HAPPY14 = 0x2cd
+BTN_TRIGGER_HAPPY15 = 0x2ce
+BTN_TRIGGER_HAPPY16 = 0x2cf
+BTN_TRIGGER_HAPPY17 = 0x2d0
+BTN_TRIGGER_HAPPY18 = 0x2d1
+BTN_TRIGGER_HAPPY19 = 0x2d2
+BTN_TRIGGER_HAPPY20 = 0x2d3
+BTN_TRIGGER_HAPPY21 = 0x2d4
+BTN_TRIGGER_HAPPY22 = 0x2d5
+BTN_TRIGGER_HAPPY23 = 0x2d6
+BTN_TRIGGER_HAPPY24 = 0x2d7
+BTN_TRIGGER_HAPPY25 = 0x2d8
+BTN_TRIGGER_HAPPY26 = 0x2d9
+BTN_TRIGGER_HAPPY27 = 0x2da
+BTN_TRIGGER_HAPPY28 = 0x2db
+BTN_TRIGGER_HAPPY29 = 0x2dc
+BTN_TRIGGER_HAPPY30 = 0x2dd
+BTN_TRIGGER_HAPPY31 = 0x2de
+BTN_TRIGGER_HAPPY32 = 0x2df
+BTN_TRIGGER_HAPPY33 = 0x2e0
+BTN_TRIGGER_HAPPY34 = 0x2e1
+BTN_TRIGGER_HAPPY35 = 0x2e2
+BTN_TRIGGER_HAPPY36 = 0x2e3
+BTN_TRIGGER_HAPPY37 = 0x2e4
+BTN_TRIGGER_HAPPY38 = 0x2e5
+BTN_TRIGGER_HAPPY39 = 0x2e6
+BTN_TRIGGER_HAPPY40 = 0x2e7
+
+KEY_MAX = 0x2ff
+
+# Relative axes
+
+REL_X = 0x00
+REL_Y = 0x01
+REL_Z = 0x02
+REL_RX = 0x03
+REL_RY = 0x04
+REL_RZ = 0x05
+REL_HWHEEL = 0x06
+REL_DIAL = 0x07
+REL_WHEEL = 0x08
+REL_MISC = 0x09
+REL_MAX = 0x0f
+
+# Absolute axes
+
+ABS_X = 0x00
+ABS_Y = 0x01
+ABS_Z = 0x02
+ABS_RX = 0x03
+ABS_RY = 0x04
+ABS_RZ = 0x05
+ABS_THROTTLE = 0x06
+ABS_RUDDER = 0x07
+ABS_WHEEL = 0x08
+ABS_GAS = 0x09
+ABS_BRAKE = 0x0a
+ABS_HAT0X = 0x10
+ABS_HAT0Y = 0x11
+ABS_HAT1X = 0x12
+ABS_HAT1Y = 0x13
+ABS_HAT2X = 0x14
+ABS_HAT2Y = 0x15
+ABS_HAT3X = 0x16
+ABS_HAT3Y = 0x17
+ABS_PRESSURE = 0x18
+ABS_DISTANCE = 0x19
+ABS_TILT_X = 0x1a
+ABS_TILT_Y = 0x1b
+ABS_TOOL_WIDTH = 0x1c
+ABS_VOLUME = 0x20
+ABS_MISC = 0x28
+ABS_MAX = 0x3f
+
+# Misc events
+
+MSC_SERIAL = 0x00
+MSC_PULSELED = 0x01
+MSC_GESTURE = 0x02
+MSC_RAW = 0x03
+MSC_SCAN = 0x04
+MSC_MAX = 0x07
+
+# LEDs
+
+LED_NUML = 0x00
+LED_CAPSL = 0x01
+LED_SCROLLL = 0x02
+LED_COMPOSE = 0x03
+LED_KANA = 0x04
+LED_SLEEP = 0x05
+LED_SUSPEND = 0x06
+LED_MUTE = 0x07
+LED_MISC = 0x08
+LED_MAIL = 0x09
+LED_CHARGING = 0x0a
+LED_MAX = 0x0f
+
+# Autorepeat values
+
+REP_DELAY = 0x00
+REP_PERIOD = 0x01
+REP_MAX = 0x01
+
+# Sounds
+
+SND_CLICK = 0x00
+SND_BELL = 0x01
+SND_TONE = 0x02
+SND_MAX = 0x07
+
+# IDs.
+
+ID_BUS = 0
+ID_VENDOR = 1
+ID_PRODUCT = 2
+ID_VERSION = 3
+
+BUS_PCI = 0x01
+BUS_ISAPNP = 0x02
+BUS_USB = 0x03
+BUS_HIL = 0x04
+BUS_BLUETOOTH = 0x05
+
+BUS_ISA = 0x10
+BUS_I8042 = 0x11
+BUS_XTKBD = 0x12
+BUS_RS232 = 0x13
+BUS_GAMEPORT = 0x14
+BUS_PARPORT = 0x15
+BUS_AMIGA = 0x16
+BUS_ADB = 0x17
+BUS_I2C = 0x18
+BUS_HOST = 0x19
+
+# Values describing the status of an effect
+FF_STATUS_STOPPED = 0x00
+FF_STATUS_PLAYING = 0x01
+FF_STATUS_MAX = 0x01
+
+rel_raw_names = {}
+abs_raw_names = {}
+key_raw_names = {}
+for _name, _val in locals().copy().items():
+ if _name.startswith('REL_'):
+ rel_raw_names[_val] = _name
+ elif _name.startswith('ABS_'):
+ abs_raw_names[_val] = _name
+ elif _name.startswith('KEY_') or _name.startswith('BTN_'):
+ key_raw_names[_val] = _name
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/wintab.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/wintab.py
new file mode 100644
index 0000000..de96c2c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/wintab.py
@@ -0,0 +1,218 @@
+#!/usr/bin/python
+# $Id:$
+
+from __future__ import print_function
+from builtins import range
+from builtins import object
+import ctypes
+
+import pyglet
+from pyglet.input.base import DeviceOpenException
+from pyglet.input.base import Tablet, TabletCursor, TabletCanvas
+
+from pyglet.libs.win32 import libwintab as wintab
+lib = wintab.lib
+
+def wtinfo(category, index, buffer):
+ size = lib.WTInfoW(category, index, None)
+ assert size <= ctypes.sizeof(buffer)
+ lib.WTInfoW(category, index, ctypes.byref(buffer))
+ return buffer
+
+def wtinfo_string(category, index):
+ size = lib.WTInfoW(category, index, None)
+ buffer = ctypes.create_unicode_buffer(size)
+ lib.WTInfoW(category, index, buffer)
+ return buffer.value
+
+def wtinfo_uint(category, index):
+ buffer = wintab.UINT()
+ lib.WTInfoW(category, index, ctypes.byref(buffer))
+ return buffer.value
+
+def wtinfo_word(category, index):
+ buffer = wintab.WORD()
+ lib.WTInfoW(category, index, ctypes.byref(buffer))
+ return buffer.value
+
+def wtinfo_dword(category, index):
+ buffer = wintab.DWORD()
+ lib.WTInfoW(category, index, ctypes.byref(buffer))
+ return buffer.value
+
+def wtinfo_wtpkt(category, index):
+ buffer = wintab.WTPKT()
+ lib.WTInfoW(category, index, ctypes.byref(buffer))
+ return buffer.value
+
+def wtinfo_bool(category, index):
+ buffer = wintab.BOOL()
+ lib.WTInfoW(category, index, ctypes.byref(buffer))
+ return bool(buffer.value)
+
+class WintabTablet(Tablet):
+ def __init__(self, index):
+ self._device = wintab.WTI_DEVICES + index
+ self.name = wtinfo_string(self._device, wintab.DVC_NAME).strip()
+ self.id = wtinfo_string(self._device, wintab.DVC_PNPID)
+
+ hardware = wtinfo_uint(self._device, wintab.DVC_HARDWARE)
+ #phys_cursors = hardware & wintab.HWC_PHYSID_CURSORS
+
+ n_cursors = wtinfo_uint(self._device, wintab.DVC_NCSRTYPES)
+ first_cursor = wtinfo_uint(self._device, wintab.DVC_FIRSTCSR)
+
+ self.pressure_axis = wtinfo(self._device, wintab.DVC_NPRESSURE,
+ wintab.AXIS())
+
+ self.cursors = []
+ self._cursor_map = {}
+
+ for i in range(n_cursors):
+ cursor = WintabTabletCursor(self, i + first_cursor)
+ if not cursor.bogus:
+ self.cursors.append(cursor)
+ self._cursor_map[i + first_cursor] = cursor
+
+ def open(self, window):
+ return WintabTabletCanvas(self, window)
+
+class WintabTabletCanvas(TabletCanvas):
+ def __init__(self, device, window, msg_base=wintab.WT_DEFBASE):
+ super(WintabTabletCanvas, self).__init__(window)
+
+ self.device = device
+ self.msg_base = msg_base
+
+ # Just use system context, for similarity w/ os x and xinput.
+ # WTI_DEFCONTEXT detaches mouse from tablet, which is nice, but not
+ # possible on os x afiak.
+ self.context_info = context_info = wintab.LOGCONTEXT()
+ wtinfo(wintab.WTI_DEFSYSCTX, 0, context_info)
+ context_info.lcMsgBase = msg_base
+ context_info.lcOptions |= wintab.CXO_MESSAGES
+
+ # If you change this, change definition of PACKET also.
+ context_info.lcPktData = (
+ wintab.PK_CHANGED | wintab.PK_CURSOR | wintab.PK_BUTTONS |
+ wintab.PK_X | wintab.PK_Y | wintab.PK_Z |
+ wintab.PK_NORMAL_PRESSURE | wintab.PK_TANGENT_PRESSURE |
+ wintab.PK_ORIENTATION)
+ context_info.lcPktMode = 0 # All absolute
+
+ self._context = lib.WTOpenW(window._hwnd,
+ ctypes.byref(context_info), True)
+ if not self._context:
+ raise DeviceOpenException("Couldn't open tablet context")
+
+ window._event_handlers[msg_base + wintab.WT_PACKET] = \
+ self._event_wt_packet
+ window._event_handlers[msg_base + wintab.WT_PROXIMITY] = \
+ self._event_wt_proximity
+
+ self._current_cursor = None
+ self._pressure_scale = device.pressure_axis.get_scale()
+ self._pressure_bias = device.pressure_axis.get_bias()
+
+ def close(self):
+ lib.WTClose(self._context)
+ self._context = None
+
+ del self.window._event_handlers[self.msg_base + wintab.WT_PACKET]
+ del self.window._event_handlers[self.msg_base + wintab.WT_PROXIMITY]
+
+ def _set_current_cursor(self, cursor_type):
+ if self._current_cursor:
+ self.dispatch_event('on_leave', self._current_cursor)
+
+ self._current_cursor = self.device._cursor_map.get(cursor_type, None)
+
+ if self._current_cursor:
+ self.dispatch_event('on_enter', self._current_cursor)
+
+ @pyglet.window.win32.Win32EventHandler(0)
+ def _event_wt_packet(self, msg, wParam, lParam):
+ if lParam != self._context:
+ return
+
+ packet = wintab.PACKET()
+ if lib.WTPacket(self._context, wParam, ctypes.byref(packet)) == 0:
+ return
+
+ if not packet.pkChanged:
+ return
+
+ window_x, window_y = self.window.get_location() # TODO cache on window
+ window_y = self.window.screen.height - window_y - self.window.height
+ x = packet.pkX - window_x
+ y = packet.pkY - window_y
+ pressure = (packet.pkNormalPressure + self._pressure_bias) * \
+ self._pressure_scale
+
+ if self._current_cursor is None:
+ self._set_current_cursor(packet.pkCursor)
+
+ self.dispatch_event('on_motion', self._current_cursor,
+ x, y, pressure, 0., 0.)
+
+ print(packet.pkButtons)
+
+ @pyglet.window.win32.Win32EventHandler(0)
+ def _event_wt_proximity(self, msg, wParam, lParam):
+ if wParam != self._context:
+ return
+
+ if not lParam & 0xffff0000:
+ # Not a hardware proximity event
+ return
+
+ if not lParam & 0xffff:
+ # Going out
+ self.dispatch_event('on_leave', self._current_cursor)
+
+ # If going in, proximity event will be generated by next event, which
+ # can actually grab a cursor id.
+ self._current_cursor = None
+
+class WintabTabletCursor(object):
+ def __init__(self, device, index):
+ self.device = device
+ self._cursor = wintab.WTI_CURSORS + index
+
+ self.name = wtinfo_string(self._cursor, wintab.CSR_NAME).strip()
+ self.active = wtinfo_bool(self._cursor, wintab.CSR_ACTIVE)
+ pktdata = wtinfo_wtpkt(self._cursor, wintab.CSR_PKTDATA)
+
+ # A whole bunch of cursors are reported by the driver, but most of
+ # them are hogwash. Make sure a cursor has at least X and Y data
+ # before adding it to the device.
+ self.bogus = not (pktdata & wintab.PK_X and pktdata & wintab.PK_Y)
+ if self.bogus:
+ return
+
+ self.id = (wtinfo_dword(self._cursor, wintab.CSR_TYPE) << 32) | \
+ wtinfo_dword(self._cursor, wintab.CSR_PHYSID)
+
+ def __repr__(self):
+ return 'WintabCursor(%r)' % self.name
+
+def get_spec_version():
+ spec_version = wtinfo_word(wintab.WTI_INTERFACE, wintab.IFC_SPECVERSION)
+ return spec_version
+
+def get_interface_name():
+ interface_name = wtinfo_string(wintab.WTI_INTERFACE, wintab.IFC_WINTABID)
+ return interface_name
+
+def get_implementation_version():
+ impl_version = wtinfo_word(wintab.WTI_INTERFACE, wintab.IFC_IMPLVERSION)
+ return impl_version
+
+def get_tablets(display=None):
+ # Require spec version 1.1 or greater
+ if get_spec_version() < 0x101:
+ return []
+
+ n_devices = wtinfo_uint(wintab.WTI_INTERFACE, wintab.IFC_NDEVICES)
+ devices = [WintabTablet(i) for i in range(n_devices)]
+ return devices
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/x11_xinput.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/x11_xinput.py
new file mode 100644
index 0000000..7267fcc
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/x11_xinput.py
@@ -0,0 +1,348 @@
+#!/usr/bin/env python
+
+'''
+'''
+from builtins import range
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import ctypes
+import pyglet
+from pyglet.input.base import \
+ Device, DeviceException, DeviceOpenException, \
+ Control, Button, RelativeAxis, AbsoluteAxis
+from pyglet.libs.x11 import xlib
+from pyglet.compat import asstr
+
+try:
+ from pyglet.libs.x11 import xinput as xi
+ _have_xinput = True
+except:
+ _have_xinput = False
+
+def ptr_add(ptr, offset):
+ address = ctypes.addressof(ptr.contents) + offset
+ return ctypes.pointer(type(ptr.contents).from_address(address))
+
+class DeviceResponder(object):
+ def _key_press(self, e):
+ pass
+
+ def _key_release(self, e):
+ pass
+
+ def _button_press(self, e):
+ pass
+
+ def _button_release(self, e):
+ pass
+
+ def _motion(self, e):
+ pass
+
+ def _proximity_in(self, e):
+ pass
+
+ def _proximity_out(self, e):
+ pass
+
+class XInputDevice(DeviceResponder, Device):
+ def __init__(self, display, device_info):
+ super(XInputDevice, self).__init__(display, asstr(device_info.name))
+
+ self._device_id = device_info.id
+ self._device = None
+
+ # Read device info
+ self.buttons = []
+ self.keys = []
+ self.axes = []
+
+ ptr = device_info.inputclassinfo
+ for i in range(device_info.num_classes):
+ cp = ctypes.cast(ptr, ctypes.POINTER(xi.XAnyClassInfo))
+ cls_class = getattr(cp.contents, 'class')
+
+ if cls_class == xi.KeyClass:
+ cp = ctypes.cast(ptr, ctypes.POINTER(xi.XKeyInfo))
+ self.min_keycode = cp.contents.min_keycode
+ num_keys = cp.contents.num_keys
+ for i in range(num_keys):
+ self.keys.append(Button('key%d' % i))
+
+ elif cls_class == xi.ButtonClass:
+ cp = ctypes.cast(ptr, ctypes.POINTER(xi.XButtonInfo))
+ num_buttons = cp.contents.num_buttons
+ for i in range(num_buttons):
+ self.buttons.append(Button('button%d' % i))
+
+ elif cls_class == xi.ValuatorClass:
+ cp = ctypes.cast(ptr, ctypes.POINTER(xi.XValuatorInfo))
+ num_axes = cp.contents.num_axes
+ mode = cp.contents.mode
+ axes = ctypes.cast(cp.contents.axes,
+ ctypes.POINTER(xi.XAxisInfo))
+ for i in range(num_axes):
+ axis = axes[i]
+ if mode == xi.Absolute:
+ self.axes.append(AbsoluteAxis('axis%d' % i,
+ min=axis.min_value,
+ max=axis.max_value))
+ elif mode == xi.Relative:
+ self.axes.append(RelativeAxis('axis%d' % i))
+
+ cls = cp.contents
+ ptr = ptr_add(ptr, cls.length)
+
+ self.controls = self.buttons + self.keys + self.axes
+
+ # Can't detect proximity class event without opening device. Just
+ # assume there is the possibility of a control if there are any axes.
+ if self.axes:
+ self.proximity_control = Button('proximity')
+ self.controls.append(self.proximity_control)
+ else:
+ self.proximity_control = None
+
+ def get_controls(self):
+ return self.controls
+
+ def open(self, window=None, exclusive=False):
+ # Checks for is_open and raises if already open.
+ # TODO allow opening on multiple windows.
+ super(XInputDevice, self).open(window, exclusive)
+
+ if window is None:
+ self.is_open = False
+ raise DeviceOpenException('XInput devices require a window')
+
+ if window.display._display != self.display._display:
+ self.is_open = False
+ raise DeviceOpenException('Window and device displays differ')
+
+ if exclusive:
+ self.is_open = False
+ raise DeviceOpenException('Cannot open XInput device exclusive')
+
+ self._device = xi.XOpenDevice(self.display._display, self._device_id)
+ if not self._device:
+ self.is_open = False
+ raise DeviceOpenException('Cannot open device')
+
+ self._install_events(window)
+
+ def close(self):
+ super(XInputDevice, self).close()
+
+ if not self._device:
+ return
+
+ # TODO: uninstall events
+ xi.XCloseDevice(self.display._display, self._device)
+
+ def _install_events(self, window):
+ dispatcher = XInputWindowEventDispatcher.get_dispatcher(window)
+ dispatcher.open_device(self._device_id, self._device, self)
+
+ # DeviceResponder interface
+
+ def _key_press(self, e):
+ self.keys[e.keycode - self.min_keycode].value = True
+
+ def _key_release(self, e):
+ self.keys[e.keycode - self.min_keycode].value = False
+
+ def _button_press(self, e):
+ self.buttons[e.button].value = True
+
+ def _button_release(self, e):
+ self.buttons[e.button].value = False
+
+ def _motion(self, e):
+ for i in range(e.axes_count):
+ self.axes[i].value = e.axis_data[i]
+
+ def _proximity_in(self, e):
+ if self.proximity_control:
+ self.proximity_control.value = True
+
+ def _proximity_out(self, e):
+ if self.proximity_control:
+ self.proximity_control.value = False
+
+class XInputWindowEventDispatcher(object):
+ def __init__(self, window):
+ self.window = window
+ self._responders = {}
+
+ @staticmethod
+ def get_dispatcher(window):
+ try:
+ dispatcher = window.__xinput_window_event_dispatcher
+ except AttributeError:
+ dispatcher = window.__xinput_window_event_dispatcher = \
+ XInputWindowEventDispatcher(window)
+ return dispatcher
+
+ def set_responder(self, device_id, responder):
+ self._responders[device_id] = responder
+
+ def remove_responder(self, device_id):
+ del self._responders[device_id]
+
+ def open_device(self, device_id, device, responder):
+ self.set_responder(device_id, responder)
+ device = device.contents
+ if not device.num_classes:
+ return
+
+ # Bind matching extended window events to bound instance methods
+ # on this object.
+ #
+ # This is inspired by test.c of xinput package by Frederic
+ # Lepied available at x.org.
+ #
+ # In C, this stuff is normally handled by the macro DeviceKeyPress and
+ # friends. Since we don't have access to those macros here, we do it
+ # this way.
+ events = []
+
+ def add(class_info, event, handler):
+ _type = class_info.event_type_base + event
+ _class = device_id << 8 | _type
+ events.append(_class)
+ self.window._event_handlers[_type] = handler
+
+ for i in range(device.num_classes):
+ class_info = device.classes[i]
+ if class_info.input_class == xi.KeyClass:
+ add(class_info, xi._deviceKeyPress,
+ self._event_xinput_key_press)
+ add(class_info, xi._deviceKeyRelease,
+ self._event_xinput_key_release)
+
+ elif class_info.input_class == xi.ButtonClass:
+ add(class_info, xi._deviceButtonPress,
+ self._event_xinput_button_press)
+ add(class_info, xi._deviceButtonRelease,
+ self._event_xinput_button_release)
+
+ elif class_info.input_class == xi.ValuatorClass:
+ add(class_info, xi._deviceMotionNotify,
+ self._event_xinput_motion)
+
+ elif class_info.input_class == xi.ProximityClass:
+ add(class_info, xi._proximityIn,
+ self._event_xinput_proximity_in)
+ add(class_info, xi._proximityOut,
+ self._event_xinput_proximity_out)
+
+ elif class_info.input_class == xi.FeedbackClass:
+ pass
+
+ elif class_info.input_class == xi.FocusClass:
+ pass
+
+ elif class_info.input_class == xi.OtherClass:
+ pass
+
+ array = (xi.XEventClass * len(events))(*events)
+ xi.XSelectExtensionEvent(self.window._x_display,
+ self.window._window,
+ array,
+ len(array))
+
+ @pyglet.window.xlib.XlibEventHandler(0)
+ def _event_xinput_key_press(self, ev):
+ e = ctypes.cast(ctypes.byref(ev),
+ ctypes.POINTER(xi.XDeviceKeyEvent)).contents
+
+ device = self._responders.get(e.deviceid)
+ if device is not None:
+ device._key_press(e)
+
+ @pyglet.window.xlib.XlibEventHandler(0)
+ def _event_xinput_key_release(self, ev):
+ e = ctypes.cast(ctypes.byref(ev),
+ ctypes.POINTER(xi.XDeviceKeyEvent)).contents
+
+ device = self._responders.get(e.deviceid)
+ if device is not None:
+ device._key_release(e)
+
+ @pyglet.window.xlib.XlibEventHandler(0)
+ def _event_xinput_button_press(self, ev):
+ e = ctypes.cast(ctypes.byref(ev),
+ ctypes.POINTER(xi.XDeviceButtonEvent)).contents
+
+ device = self._responders.get(e.deviceid)
+ if device is not None:
+ device._button_press(e)
+
+ @pyglet.window.xlib.XlibEventHandler(0)
+ def _event_xinput_button_release(self, ev):
+ e = ctypes.cast(ctypes.byref(ev),
+ ctypes.POINTER(xi.XDeviceButtonEvent)).contents
+
+ device = self._responders.get(e.deviceid)
+ if device is not None:
+ device._button_release(e)
+
+ @pyglet.window.xlib.XlibEventHandler(0)
+ def _event_xinput_motion(self, ev):
+ e = ctypes.cast(ctypes.byref(ev),
+ ctypes.POINTER(xi.XDeviceMotionEvent)).contents
+
+ device = self._responders.get(e.deviceid)
+ if device is not None:
+ device._motion(e)
+
+ @pyglet.window.xlib.XlibEventHandler(0)
+ def _event_xinput_proximity_in(self, ev):
+ e = ctypes.cast(ctypes.byref(ev),
+ ctypes.POINTER(xi.XProximityNotifyEvent)).contents
+
+ device = self._responders.get(e.deviceid)
+ if device is not None:
+ device._proximity_in(e)
+
+ @pyglet.window.xlib.XlibEventHandler(-1)
+ def _event_xinput_proximity_out(self, ev):
+ e = ctypes.cast(ctypes.byref(ev),
+ ctypes.POINTER(xi.XProximityNotifyEvent)).contents
+
+ device = self._responders.get(e.deviceid)
+ if device is not None:
+ device._proximity_out(e)
+
+def _check_extension(display):
+ major_opcode = ctypes.c_int()
+ first_event = ctypes.c_int()
+ first_error = ctypes.c_int()
+ xlib.XQueryExtension(display._display, b'XInputExtension',
+ ctypes.byref(major_opcode),
+ ctypes.byref(first_event),
+ ctypes.byref(first_error))
+ return bool(major_opcode.value)
+
+def get_devices(display=None):
+ if display is None:
+ display = pyglet.canvas.get_display()
+
+ if not _have_xinput or not _check_extension(display):
+ return []
+
+ devices = []
+ count = ctypes.c_int(0)
+ device_list = xi.XListInputDevices(display._display, count)
+
+ for i in range(count.value):
+ device_info = device_list[i]
+ devices.append(XInputDevice(display, device_info))
+
+ xi.XFreeDeviceList(device_list)
+
+ return devices
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/x11_xinput_tablet.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/x11_xinput_tablet.py
new file mode 100644
index 0000000..494eb4d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/input/x11_xinput_tablet.py
@@ -0,0 +1,100 @@
+#!/usr/bin/env python
+
+'''
+'''
+from __future__ import division
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+from pyglet.input.base import Tablet, TabletCanvas
+from pyglet.input.base import TabletCursor, DeviceOpenException
+from pyglet.input.x11_xinput import XInputWindowEventDispatcher
+from pyglet.input.x11_xinput import get_devices, DeviceResponder
+
+
+try:
+ from pyglet.libs.x11 import xinput as xi
+ _have_xinput = True
+except:
+ _have_xinput = False
+
+
+class XInputTablet(Tablet):
+ name = 'XInput Tablet'
+
+ def __init__(self, cursors):
+ self.cursors = cursors
+
+ def open(self, window):
+ return XInputTabletCanvas(window, self.cursors)
+
+
+class XInputTabletCanvas(DeviceResponder, TabletCanvas):
+ def __init__(self, window, cursors):
+ super(XInputTabletCanvas, self).__init__(window)
+ self.cursors = cursors
+
+ dispatcher = XInputWindowEventDispatcher.get_dispatcher(window)
+
+ self.display = window.display
+ self._open_devices = []
+ self._cursor_map = {}
+ for cursor in cursors:
+ device = cursor.device
+ device_id = device._device_id
+ self._cursor_map[device_id] = cursor
+
+ cursor.max_pressure = device.axes[2].max
+
+ if self.display._display != device.display._display:
+ raise DeviceOpenException('Window and device displays differ')
+
+ open_device = xi.XOpenDevice(device.display._display, device_id)
+ if not open_device:
+ # Ignore this cursor; fail if no cursors added
+ continue
+ self._open_devices.append(open_device)
+
+ dispatcher.open_device(device_id, open_device, self)
+
+ def close(self):
+ for device in self._open_devices:
+ xi.XCloseDevice(self.display._display, device)
+
+ def _motion(self, e):
+ cursor = self._cursor_map.get(e.deviceid)
+ x = e.x
+ y = self.window.height - e.y
+ pressure = e.axis_data[2] / float(cursor.max_pressure)
+ self.dispatch_event('on_motion', cursor, x, y, pressure, 0.0, 0.0)
+
+ def _proximity_in(self, e):
+ cursor = self._cursor_map.get(e.deviceid)
+ self.dispatch_event('on_enter', cursor)
+
+ def _proximity_out(self, e):
+ cursor = self._cursor_map.get(e.deviceid)
+ self.dispatch_event('on_leave', cursor)
+
+
+class XInputTabletCursor(TabletCursor):
+ def __init__(self, device):
+ super(XInputTabletCursor, self).__init__(device.name)
+ self.device = device
+
+
+def get_tablets(display=None):
+ # Each cursor appears as a separate xinput device; find devices that look
+ # like Wacom tablet cursors and amalgamate them into a single tablet.
+ valid_names = ('stylus', 'cursor', 'eraser', 'wacom', 'pen', 'pad')
+ cursors = []
+ devices = get_devices(display)
+ for device in devices:
+ dev_name = device.name.lower().split()
+ if any(n in dev_name for n in valid_names) and len(device.axes) >= 3:
+ cursors.append(XInputTabletCursor(device))
+
+ if cursors:
+ return [XInputTablet(cursors)]
+ return []
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/lib.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/lib.py
new file mode 100644
index 0000000..5ad8443
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/lib.py
@@ -0,0 +1,364 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+'''Functions for loading dynamic libraries.
+
+These extend and correct ctypes functions.
+'''
+from __future__ import print_function
+from builtins import str
+from builtins import object
+from past.builtins import basestring
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import os
+import re
+import sys
+
+import ctypes
+import ctypes.util
+
+import pyglet
+
+_debug_lib = pyglet.options['debug_lib']
+_debug_trace = pyglet.options['debug_trace']
+
+_is_epydoc = hasattr(sys, 'is_epydoc') and sys.is_epydoc
+
+if pyglet.options['search_local_libs']:
+ script_path = pyglet.resource.get_script_home()
+ _local_lib_paths = [script_path, os.path.join(script_path, 'lib'),]
+else:
+ _local_lib_paths = None
+
+class _TraceFunction(object):
+ def __init__(self, func):
+ self.__dict__['_func'] = func
+
+ def __str__(self):
+ return self._func.__name__
+
+ def __call__(self, *args, **kwargs):
+ return self._func(*args, **kwargs)
+
+ def __getattr__(self, name):
+ return getattr(self._func, name)
+
+ def __setattr__(self, name, value):
+ setattr(self._func, name, value)
+
+class _TraceLibrary(object):
+ def __init__(self, library):
+ self._library = library
+ print(library)
+
+ def __getattr__(self, name):
+ func = getattr(self._library, name)
+ f = _TraceFunction(func)
+ return f
+
+if _is_epydoc:
+ class LibraryMock(object):
+ """Mock library used when generating documentation."""
+ def __getattr__(self, name):
+ return LibraryMock()
+
+ def __setattr__(self, name, value):
+ pass
+
+ def __call__(self, *args, **kwargs):
+ return LibraryMock()
+
+
+class LibraryLoader(object):
+ def load_library(self, *names, **kwargs):
+ '''Find and load a library.
+
+ More than one name can be specified, they will be tried in order.
+ Platform-specific library names (given as kwargs) are tried first.
+
+ Raises ImportError if library is not found.
+ '''
+ if _is_epydoc:
+ return LibraryMock()
+
+ if 'framework' in kwargs and self.platform == 'darwin':
+ return self.load_framework(kwargs['framework'])
+
+ if not names:
+ raise ImportError("No library name specified")
+
+ platform_names = kwargs.get(self.platform, [])
+ if isinstance(platform_names, basestring):
+ platform_names = [platform_names]
+ elif type(platform_names) is tuple:
+ platform_names = list(platform_names)
+
+ if self.platform.startswith('linux'):
+ for name in names:
+ libname = self.find_library(name)
+ platform_names.append(libname or 'lib%s.so' % name)
+
+ platform_names.extend(names)
+ for name in platform_names:
+ try:
+ lib = ctypes.cdll.LoadLibrary(name)
+ if _debug_lib:
+ print(name)
+ if _debug_trace:
+ lib = _TraceLibrary(lib)
+ return lib
+ except OSError as o:
+ if self.platform == "win32" and o.winerror != 126:
+ print("Unexpected error loading library %s: %s" % (name, str(o)))
+ raise
+ path = self.find_library(name)
+ if path:
+ try:
+ lib = ctypes.cdll.LoadLibrary(path)
+ if _debug_lib:
+ print(path)
+ if _debug_trace:
+ lib = _TraceLibrary(lib)
+ return lib
+ except OSError:
+ pass
+ raise ImportError('Library "%s" not found.' % names[0])
+
+ find_library = lambda self, name: ctypes.util.find_library(name)
+
+ platform = pyglet.compat_platform
+ # this is only for library loading, don't include it in pyglet.platform
+ if platform == 'cygwin':
+ platform = 'win32'
+
+ def load_framework(self, path):
+ raise RuntimeError("Can't load framework on this platform.")
+
+class MachOLibraryLoader(LibraryLoader):
+ def __init__(self):
+ if 'LD_LIBRARY_PATH' in os.environ:
+ self.ld_library_path = os.environ['LD_LIBRARY_PATH'].split(':')
+ else:
+ self.ld_library_path = []
+
+ if _local_lib_paths:
+ # search first for local libs
+ self.ld_library_path = _local_lib_paths + self.ld_library_path
+ os.environ['LD_LIBRARY_PATH'] = ':'.join(self.ld_library_path)
+
+ if 'DYLD_LIBRARY_PATH' in os.environ:
+ self.dyld_library_path = os.environ['DYLD_LIBRARY_PATH'].split(':')
+ else:
+ self.dyld_library_path = []
+
+ if 'DYLD_FALLBACK_LIBRARY_PATH' in os.environ:
+ self.dyld_fallback_library_path = \
+ os.environ['DYLD_FALLBACK_LIBRARY_PATH'].split(':')
+ else:
+ self.dyld_fallback_library_path = [
+ os.path.expanduser('~/lib'),
+ '/usr/local/lib',
+ '/usr/lib']
+
+ def find_library(self, path):
+ '''Implements the dylib search as specified in Apple documentation:
+
+ http://developer.apple.com/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryUsageGuidelines.html
+
+ Before commencing the standard search, the method first checks
+ the bundle's ``Frameworks`` directory if the application is running
+ within a bundle (OS X .app).
+ '''
+
+ libname = os.path.basename(path)
+ search_path = []
+
+ if '.' not in libname:
+ libname = 'lib' + libname + '.dylib'
+
+ # py2app support
+ if (hasattr(sys, 'frozen') and sys.frozen == 'macosx_app' and
+ 'RESOURCEPATH' in os.environ):
+ search_path.append(os.path.join(
+ os.environ['RESOURCEPATH'],
+ '..',
+ 'Frameworks',
+ libname))
+
+ # pyinstaller.py sets sys.frozen to True, and puts dylibs in
+ # Contents/MacOS, which path pyinstaller puts in sys._MEIPASS
+ if (hasattr(sys, 'frozen') and hasattr(sys, '_MEIPASS') and
+ sys.frozen == True and pyglet.compat_platform == 'darwin'):
+ search_path.append(os.path.join(sys._MEIPASS, libname))
+
+ if '/' in path:
+ search_path.extend(
+ [os.path.join(p, libname) \
+ for p in self.dyld_library_path])
+ search_path.append(path)
+ search_path.extend(
+ [os.path.join(p, libname) \
+ for p in self.dyld_fallback_library_path])
+ else:
+ search_path.extend(
+ [os.path.join(p, libname) \
+ for p in self.ld_library_path])
+ search_path.extend(
+ [os.path.join(p, libname) \
+ for p in self.dyld_library_path])
+ search_path.append(path)
+ search_path.extend(
+ [os.path.join(p, libname) \
+ for p in self.dyld_fallback_library_path])
+
+ for path in search_path:
+ if os.path.exists(path):
+ return path
+
+ return None
+
+ def find_framework(self, path):
+ '''Implement runtime framework search as described by:
+
+ http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkBinding.html
+ '''
+
+ # e.g. path == '/System/Library/Frameworks/OpenGL.framework'
+ # name == 'OpenGL'
+ # return '/System/Library/Frameworks/OpenGL.framework/OpenGL'
+ name = os.path.splitext(os.path.split(path)[1])[0]
+
+ realpath = os.path.join(path, name)
+ if os.path.exists(realpath):
+ return realpath
+
+ for dir in ('/Library/Frameworks',
+ '/System/Library/Frameworks'):
+ realpath = os.path.join(dir, '%s.framework' % name, name)
+ if os.path.exists(realpath):
+ return realpath
+
+ return None
+
+ def load_framework(self, path):
+ realpath = self.find_framework(path)
+ if realpath:
+ lib = ctypes.cdll.LoadLibrary(realpath)
+ if _debug_lib:
+ print(realpath)
+ if _debug_trace:
+ lib = _TraceLibrary(lib)
+ return lib
+
+ raise ImportError("Can't find framework %s." % path)
+
+class LinuxLibraryLoader(LibraryLoader):
+ _ld_so_cache = None
+ _local_libs_cache = None
+
+ def _find_libs(self, directories):
+ cache = {}
+ lib_re = re.compile('lib(.*)\.so(?:$|\.)')
+ for dir in directories:
+ try:
+ for file in os.listdir(dir):
+ match = lib_re.match(file)
+ if match:
+ # Index by filename
+ path = os.path.join(dir, file)
+ if file not in cache:
+ cache[file] = path
+ # Index by library name
+ library = match.group(1)
+ if library not in cache:
+ cache[library] = path
+ except OSError:
+ pass
+ return cache
+
+ def _create_ld_so_cache(self):
+ # Recreate search path followed by ld.so. This is going to be
+ # slow to build, and incorrect (ld.so uses ld.so.cache, which may
+ # not be up-to-date). Used only as fallback for distros without
+ # /sbin/ldconfig.
+ #
+ # We assume the DT_RPATH and DT_RUNPATH binary sections are omitted.
+
+ directories = []
+ try:
+ directories.extend(os.environ['LD_LIBRARY_PATH'].split(':'))
+ except KeyError:
+ pass
+
+ try:
+ with open('/etc/ld.so.conf') as fid:
+ directories.extend([dir.strip() for dir in fid])
+ except IOError:
+ pass
+
+ directories.extend(['/lib', '/usr/lib'])
+
+ self._ld_so_cache = self._find_libs(directories)
+
+ def find_library(self, path):
+
+ # search first for local libs
+ if _local_lib_paths:
+ if not self._local_libs_cache:
+ self._local_libs_cache = self._find_libs(_local_lib_paths)
+ if path in self._local_libs_cache:
+ return self._local_libs_cache[path]
+
+ # ctypes tries ldconfig, gcc and objdump. If none of these are
+ # present, we implement the ld-linux.so search path as described in
+ # the man page.
+
+ result = ctypes.util.find_library(path)
+ if result:
+ return result
+
+ if self._ld_so_cache is None:
+ self._create_ld_so_cache()
+
+ return self._ld_so_cache.get(path)
+
+if pyglet.compat_platform == 'darwin':
+ loader = MachOLibraryLoader()
+elif pyglet.compat_platform.startswith('linux'):
+ loader = LinuxLibraryLoader()
+else:
+ loader = LibraryLoader()
+load_library = loader.load_library
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/__init__.py
new file mode 100644
index 0000000..cc55edb
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/__init__.py
@@ -0,0 +1,43 @@
+from __future__ import absolute_import
+import pyglet
+
+# Cocoa implementation:
+if pyglet.options['darwin_cocoa']:
+
+ from .cocoapy import *
+
+# Carbon implementation:
+else:
+ from .types import *
+ from .constants import *
+
+ carbon = pyglet.lib.load_library(
+ framework='/System/Library/Frameworks/Carbon.framework')
+
+ # No 64-bit version of quicktime
+ # (It was replaced with QTKit, which is written in Objective-C)
+ quicktime = pyglet.lib.load_library(
+ framework='/System/Library/Frameworks/QuickTime.framework')
+
+ carbon.GetEventDispatcherTarget.restype = EventTargetRef
+ carbon.ReceiveNextEvent.argtypes = \
+ [c_uint32, c_void_p, c_double, c_ubyte, POINTER(EventRef)]
+ #carbon.GetWindowPort.restype = agl.AGLDrawable
+ EventHandlerProcPtr = CFUNCTYPE(c_int, c_int, c_void_p, c_void_p)
+
+ # CarbonEvent functions are not available in 64-bit Carbon
+ carbon.NewEventHandlerUPP.restype = c_void_p
+ carbon.GetCurrentKeyModifiers = c_uint32
+ carbon.NewRgn.restype = RgnHandle
+ carbon.CGDisplayBounds.argtypes = [c_void_p]
+ carbon.CGDisplayBounds.restype = CGRect
+
+ def create_cfstring(text):
+ return carbon.CFStringCreateWithCString(c_void_p(),
+ text.encode('utf8'),
+ kCFStringEncodingUTF8)
+
+ def _oscheck(result):
+ if result != noErr:
+ raise RuntimeError('Carbon error %d' % result)
+ return result
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/cocoapy/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/cocoapy/__init__.py
new file mode 100644
index 0000000..165d832
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/cocoapy/__init__.py
@@ -0,0 +1,37 @@
+# objective-ctypes
+#
+# Copyright (c) 2011, Phillip Nguyen
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# Neither the name of objective-ctypes nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+from .runtime import objc, send_message, send_super
+from .runtime import get_selector
+from .runtime import ObjCClass, ObjCInstance, ObjCSubclass
+
+from .cocoatypes import *
+from .cocoalibs import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/cocoapy/cocoalibs.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/cocoapy/cocoalibs.py
new file mode 100644
index 0000000..712e961
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/cocoapy/cocoalibs.py
@@ -0,0 +1,548 @@
+from builtins import str
+
+from ctypes import *
+from ctypes import util
+
+from .runtime import send_message, ObjCInstance
+from .cocoatypes import *
+
+######################################################################
+
+# CORE FOUNDATION
+
+cf = cdll.LoadLibrary(util.find_library('CoreFoundation'))
+
+kCFStringEncodingUTF8 = 0x08000100
+
+CFAllocatorRef = c_void_p
+CFStringEncoding = c_uint32
+
+cf.CFStringCreateWithCString.restype = c_void_p
+cf.CFStringCreateWithCString.argtypes = [CFAllocatorRef, c_char_p, CFStringEncoding]
+
+cf.CFRelease.restype = c_void_p
+cf.CFRelease.argtypes = [c_void_p]
+
+cf.CFStringGetLength.restype = CFIndex
+cf.CFStringGetLength.argtypes = [c_void_p]
+
+cf.CFStringGetMaximumSizeForEncoding.restype = CFIndex
+cf.CFStringGetMaximumSizeForEncoding.argtypes = [CFIndex, CFStringEncoding]
+
+cf.CFStringGetCString.restype = c_bool
+cf.CFStringGetCString.argtypes = [c_void_p, c_char_p, CFIndex, CFStringEncoding]
+
+cf.CFStringGetTypeID.restype = CFTypeID
+cf.CFStringGetTypeID.argtypes = []
+
+cf.CFAttributedStringCreate.restype = c_void_p
+cf.CFAttributedStringCreate.argtypes = [CFAllocatorRef, c_void_p, c_void_p]
+
+# Core Foundation type to Python type conversion functions
+
+def CFSTR(string):
+ return ObjCInstance(c_void_p(cf.CFStringCreateWithCString(
+ None, string.encode('utf8'), kCFStringEncodingUTF8)))
+
+# Other possible names for this method:
+# at, ampersat, arobe, apenstaartje (little monkey tail), strudel,
+# klammeraffe (spider monkey), little_mouse, arroba, sobachka (doggie)
+# malpa (monkey), snabel (trunk), papaki (small duck), afna (monkey),
+# kukac (caterpillar).
+def get_NSString(string):
+ """Autoreleased version of CFSTR"""
+ return CFSTR(string).autorelease()
+
+def cfstring_to_string(cfstring):
+ length = cf.CFStringGetLength(cfstring)
+ size = cf.CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8)
+ buffer = c_buffer(size + 1)
+ result = cf.CFStringGetCString(cfstring, buffer, len(buffer), kCFStringEncodingUTF8)
+ if result:
+ return str(buffer.value, 'utf-8')
+
+cf.CFDataCreate.restype = c_void_p
+cf.CFDataCreate.argtypes = [c_void_p, c_void_p, CFIndex]
+
+cf.CFDataGetBytes.restype = None
+cf.CFDataGetBytes.argtypes = [c_void_p, CFRange, c_void_p]
+
+cf.CFDataGetLength.restype = CFIndex
+cf.CFDataGetLength.argtypes = [c_void_p]
+
+cf.CFDictionaryGetValue.restype = c_void_p
+cf.CFDictionaryGetValue.argtypes = [c_void_p, c_void_p]
+
+cf.CFDictionaryAddValue.restype = None
+cf.CFDictionaryAddValue.argtypes = [c_void_p, c_void_p, c_void_p]
+
+cf.CFDictionaryCreateMutable.restype = c_void_p
+cf.CFDictionaryCreateMutable.argtypes = [CFAllocatorRef, CFIndex, c_void_p, c_void_p]
+
+cf.CFNumberCreate.restype = c_void_p
+cf.CFNumberCreate.argtypes = [CFAllocatorRef, CFNumberType, c_void_p]
+
+cf.CFNumberGetType.restype = CFNumberType
+cf.CFNumberGetType.argtypes = [c_void_p]
+
+cf.CFNumberGetValue.restype = c_ubyte
+cf.CFNumberGetValue.argtypes = [c_void_p, CFNumberType, c_void_p]
+
+cf.CFNumberGetTypeID.restype = CFTypeID
+cf.CFNumberGetTypeID.argtypes = []
+
+cf.CFGetTypeID.restype = CFTypeID
+cf.CFGetTypeID.argtypes = [c_void_p]
+
+# CFNumber.h
+kCFNumberSInt8Type = 1
+kCFNumberSInt16Type = 2
+kCFNumberSInt32Type = 3
+kCFNumberSInt64Type = 4
+kCFNumberFloat32Type = 5
+kCFNumberFloat64Type = 6
+kCFNumberCharType = 7
+kCFNumberShortType = 8
+kCFNumberIntType = 9
+kCFNumberLongType = 10
+kCFNumberLongLongType = 11
+kCFNumberFloatType = 12
+kCFNumberDoubleType = 13
+kCFNumberCFIndexType = 14
+kCFNumberNSIntegerType = 15
+kCFNumberCGFloatType = 16
+kCFNumberMaxType = 16
+
+def cfnumber_to_number(cfnumber):
+ """Convert CFNumber to python int or float."""
+ numeric_type = cf.CFNumberGetType(cfnumber)
+ cfnum_to_ctype = {kCFNumberSInt8Type:c_int8, kCFNumberSInt16Type:c_int16,
+ kCFNumberSInt32Type:c_int32, kCFNumberSInt64Type:c_int64,
+ kCFNumberFloat32Type:c_float, kCFNumberFloat64Type:c_double,
+ kCFNumberCharType:c_byte, kCFNumberShortType:c_short,
+ kCFNumberIntType:c_int, kCFNumberLongType:c_long,
+ kCFNumberLongLongType:c_longlong, kCFNumberFloatType:c_float,
+ kCFNumberDoubleType:c_double, kCFNumberCFIndexType:CFIndex,
+ kCFNumberCGFloatType:CGFloat}
+
+ if numeric_type in cfnum_to_ctype:
+ t = cfnum_to_ctype[numeric_type]
+ result = t()
+ if cf.CFNumberGetValue(cfnumber, numeric_type, byref(result)):
+ return result.value
+ else:
+ raise Exception('cfnumber_to_number: unhandled CFNumber type %d' % numeric_type)
+
+# Dictionary of cftypes matched to the method converting them to python values.
+known_cftypes = { cf.CFStringGetTypeID() : cfstring_to_string,
+ cf.CFNumberGetTypeID() : cfnumber_to_number
+ }
+
+def cftype_to_value(cftype):
+ """Convert a CFType into an equivalent python type.
+ The convertible CFTypes are taken from the known_cftypes
+ dictionary, which may be added to if another library implements
+ its own conversion methods."""
+ if not cftype:
+ return None
+ typeID = cf.CFGetTypeID(cftype)
+ if typeID in known_cftypes:
+ convert_function = known_cftypes[typeID]
+ return convert_function(cftype)
+ else:
+ return cftype
+
+cf.CFSetGetCount.restype = CFIndex
+cf.CFSetGetCount.argtypes = [c_void_p]
+
+cf.CFSetGetValues.restype = None
+# PyPy 1.7 is fine with 2nd arg as POINTER(c_void_p),
+# but CPython ctypes 1.1.0 complains, so just use c_void_p.
+cf.CFSetGetValues.argtypes = [c_void_p, c_void_p]
+
+def cfset_to_set(cfset):
+ """Convert CFSet to python set."""
+ count = cf.CFSetGetCount(cfset)
+ buffer = (c_void_p * count)()
+ cf.CFSetGetValues(cfset, byref(buffer))
+ return set([ cftype_to_value(c_void_p(buffer[i])) for i in range(count) ])
+
+cf.CFArrayGetCount.restype = CFIndex
+cf.CFArrayGetCount.argtypes = [c_void_p]
+
+cf.CFArrayGetValueAtIndex.restype = c_void_p
+cf.CFArrayGetValueAtIndex.argtypes = [c_void_p, CFIndex]
+
+def cfarray_to_list(cfarray):
+ """Convert CFArray to python list."""
+ count = cf.CFArrayGetCount(cfarray)
+ return [ cftype_to_value(c_void_p(cf.CFArrayGetValueAtIndex(cfarray, i)))
+ for i in range(count) ]
+
+
+kCFRunLoopDefaultMode = c_void_p.in_dll(cf, 'kCFRunLoopDefaultMode')
+
+cf.CFRunLoopGetCurrent.restype = c_void_p
+cf.CFRunLoopGetCurrent.argtypes = []
+
+cf.CFRunLoopGetMain.restype = c_void_p
+cf.CFRunLoopGetMain.argtypes = []
+
+######################################################################
+
+# APPLICATION KIT
+
+# Even though we don't use this directly, it must be loaded so that
+# we can find the NSApplication, NSWindow, and NSView classes.
+appkit = cdll.LoadLibrary(util.find_library('AppKit'))
+
+NSDefaultRunLoopMode = c_void_p.in_dll(appkit, 'NSDefaultRunLoopMode')
+NSEventTrackingRunLoopMode = c_void_p.in_dll(appkit, 'NSEventTrackingRunLoopMode')
+NSApplicationDidHideNotification = c_void_p.in_dll(appkit, 'NSApplicationDidHideNotification')
+NSApplicationDidUnhideNotification = c_void_p.in_dll(appkit, 'NSApplicationDidUnhideNotification')
+
+# /System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h
+NSAnyEventMask = 0xFFFFFFFF # NSUIntegerMax
+
+NSKeyDown = 10
+NSKeyUp = 11
+NSFlagsChanged = 12
+NSApplicationDefined = 15
+
+NSAlphaShiftKeyMask = 1 << 16
+NSShiftKeyMask = 1 << 17
+NSControlKeyMask = 1 << 18
+NSAlternateKeyMask = 1 << 19
+NSCommandKeyMask = 1 << 20
+NSNumericPadKeyMask = 1 << 21
+NSHelpKeyMask = 1 << 22
+NSFunctionKeyMask = 1 << 23
+
+NSInsertFunctionKey = 0xF727
+NSDeleteFunctionKey = 0xF728
+NSHomeFunctionKey = 0xF729
+NSBeginFunctionKey = 0xF72A
+NSEndFunctionKey = 0xF72B
+NSPageUpFunctionKey = 0xF72C
+NSPageDownFunctionKey = 0xF72D
+
+# /System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h
+NSBorderlessWindowMask = 0
+NSTitledWindowMask = 1 << 0
+NSClosableWindowMask = 1 << 1
+NSMiniaturizableWindowMask = 1 << 2
+NSResizableWindowMask = 1 << 3
+
+# /System/Library/Frameworks/AppKit.framework/Headers/NSPanel.h
+NSUtilityWindowMask = 1 << 4
+
+# /System/Library/Frameworks/AppKit.framework/Headers/NSGraphics.h
+NSBackingStoreRetained = 0
+NSBackingStoreNonretained = 1
+NSBackingStoreBuffered = 2
+
+# /System/Library/Frameworks/AppKit.framework/Headers/NSTrackingArea.h
+NSTrackingMouseEnteredAndExited = 0x01
+NSTrackingMouseMoved = 0x02
+NSTrackingCursorUpdate = 0x04
+NSTrackingActiveInActiveApp = 0x40
+
+# /System/Library/Frameworks/AppKit.framework/Headers/NSOpenGL.h
+NSOpenGLPFAAllRenderers = 1 # choose from all available renderers
+NSOpenGLPFADoubleBuffer = 5 # choose a double buffered pixel format
+NSOpenGLPFAStereo = 6 # stereo buffering supported
+NSOpenGLPFAAuxBuffers = 7 # number of aux buffers
+NSOpenGLPFAColorSize = 8 # number of color buffer bits
+NSOpenGLPFAAlphaSize = 11 # number of alpha component bits
+NSOpenGLPFADepthSize = 12 # number of depth buffer bits
+NSOpenGLPFAStencilSize = 13 # number of stencil buffer bits
+NSOpenGLPFAAccumSize = 14 # number of accum buffer bits
+NSOpenGLPFAMinimumPolicy = 51 # never choose smaller buffers than requested
+NSOpenGLPFAMaximumPolicy = 52 # choose largest buffers of type requested
+NSOpenGLPFAOffScreen = 53 # choose an off-screen capable renderer
+NSOpenGLPFAFullScreen = 54 # choose a full-screen capable renderer
+NSOpenGLPFASampleBuffers = 55 # number of multi sample buffers
+NSOpenGLPFASamples = 56 # number of samples per multi sample buffer
+NSOpenGLPFAAuxDepthStencil = 57 # each aux buffer has its own depth stencil
+NSOpenGLPFAColorFloat = 58 # color buffers store floating point pixels
+NSOpenGLPFAMultisample = 59 # choose multisampling
+NSOpenGLPFASupersample = 60 # choose supersampling
+NSOpenGLPFASampleAlpha = 61 # request alpha filtering
+NSOpenGLPFARendererID = 70 # request renderer by ID
+NSOpenGLPFASingleRenderer = 71 # choose a single renderer for all screens
+NSOpenGLPFANoRecovery = 72 # disable all failure recovery systems
+NSOpenGLPFAAccelerated = 73 # choose a hardware accelerated renderer
+NSOpenGLPFAClosestPolicy = 74 # choose the closest color buffer to request
+NSOpenGLPFARobust = 75 # renderer does not need failure recovery
+NSOpenGLPFABackingStore = 76 # back buffer contents are valid after swap
+NSOpenGLPFAMPSafe = 78 # renderer is multi-processor safe
+NSOpenGLPFAWindow = 80 # can be used to render to an onscreen window
+NSOpenGLPFAMultiScreen = 81 # single window can span multiple screens
+NSOpenGLPFACompliant = 83 # renderer is opengl compliant
+NSOpenGLPFAScreenMask = 84 # bit mask of supported physical screens
+NSOpenGLPFAPixelBuffer = 90 # can be used to render to a pbuffer
+NSOpenGLPFARemotePixelBuffer = 91 # can be used to render offline to a pbuffer
+NSOpenGLPFAAllowOfflineRenderers = 96 # allow use of offline renderers
+NSOpenGLPFAAcceleratedCompute = 97 # choose a hardware accelerated compute device
+NSOpenGLPFAOpenGLProfile = 99 # specify an OpenGL Profile to use
+NSOpenGLPFAVirtualScreenCount = 128 # number of virtual screens in this format
+
+NSOpenGLProfileVersionLegacy = 0x1000 # choose a Legacy/Pre-OpenGL 3.0 Implementation
+NSOpenGLProfileVersion3_2Core = 0x3200 # choose an OpenGL 3.2 Core Implementation
+NSOpenGLProfileVersion4_1Core = 0x4100 # choose an OpenGL 4.1 Core Implementation
+
+NSOpenGLCPSwapInterval = 222
+
+
+# /System/Library/Frameworks/ApplicationServices.framework/Frameworks/...
+# CoreGraphics.framework/Headers/CGImage.h
+kCGImageAlphaNone = 0
+kCGImageAlphaPremultipliedLast = 1
+kCGImageAlphaPremultipliedFirst = 2
+kCGImageAlphaLast = 3
+kCGImageAlphaFirst = 4
+kCGImageAlphaNoneSkipLast = 5
+kCGImageAlphaNoneSkipFirst = 6
+kCGImageAlphaOnly = 7
+
+kCGImageAlphaPremultipliedLast = 1
+
+kCGBitmapAlphaInfoMask = 0x1F
+kCGBitmapFloatComponents = 1 << 8
+
+kCGBitmapByteOrderMask = 0x7000
+kCGBitmapByteOrderDefault = 0 << 12
+kCGBitmapByteOrder16Little = 1 << 12
+kCGBitmapByteOrder32Little = 2 << 12
+kCGBitmapByteOrder16Big = 3 << 12
+kCGBitmapByteOrder32Big = 4 << 12
+
+# NSApplication.h
+NSApplicationPresentationDefault = 0
+NSApplicationPresentationHideDock = 1 << 1
+NSApplicationPresentationHideMenuBar = 1 << 3
+NSApplicationPresentationDisableProcessSwitching = 1 << 5
+NSApplicationPresentationDisableHideApplication = 1 << 8
+
+# NSRunningApplication.h
+NSApplicationActivationPolicyRegular = 0
+NSApplicationActivationPolicyAccessory = 1
+NSApplicationActivationPolicyProhibited = 2
+
+######################################################################
+
+# QUARTZ / COREGRAPHICS
+
+quartz = cdll.LoadLibrary(util.find_library('quartz'))
+
+CGDirectDisplayID = c_uint32 # CGDirectDisplay.h
+CGError = c_int32 # CGError.h
+CGBitmapInfo = c_uint32 # CGImage.h
+
+# /System/Library/Frameworks/ApplicationServices.framework/Frameworks/...
+# ImageIO.framework/Headers/CGImageProperties.h
+kCGImagePropertyGIFDictionary = c_void_p.in_dll(quartz, 'kCGImagePropertyGIFDictionary')
+kCGImagePropertyGIFDelayTime = c_void_p.in_dll(quartz, 'kCGImagePropertyGIFDelayTime')
+
+# /System/Library/Frameworks/ApplicationServices.framework/Frameworks/...
+# CoreGraphics.framework/Headers/CGColorSpace.h
+kCGRenderingIntentDefault = 0
+
+quartz.CGDisplayIDToOpenGLDisplayMask.restype = c_uint32
+quartz.CGDisplayIDToOpenGLDisplayMask.argtypes = [c_uint32]
+
+quartz.CGMainDisplayID.restype = CGDirectDisplayID
+quartz.CGMainDisplayID.argtypes = []
+
+quartz.CGShieldingWindowLevel.restype = c_int32
+quartz.CGShieldingWindowLevel.argtypes = []
+
+quartz.CGCursorIsVisible.restype = c_bool
+
+quartz.CGDisplayCopyAllDisplayModes.restype = c_void_p
+quartz.CGDisplayCopyAllDisplayModes.argtypes = [CGDirectDisplayID, c_void_p]
+
+quartz.CGDisplaySetDisplayMode.restype = CGError
+quartz.CGDisplaySetDisplayMode.argtypes = [CGDirectDisplayID, c_void_p, c_void_p]
+
+quartz.CGDisplayCapture.restype = CGError
+quartz.CGDisplayCapture.argtypes = [CGDirectDisplayID]
+
+quartz.CGDisplayRelease.restype = CGError
+quartz.CGDisplayRelease.argtypes = [CGDirectDisplayID]
+
+quartz.CGDisplayCopyDisplayMode.restype = c_void_p
+quartz.CGDisplayCopyDisplayMode.argtypes = [CGDirectDisplayID]
+
+quartz.CGDisplayModeGetRefreshRate.restype = c_double
+quartz.CGDisplayModeGetRefreshRate.argtypes = [c_void_p]
+
+quartz.CGDisplayModeRetain.restype = c_void_p
+quartz.CGDisplayModeRetain.argtypes = [c_void_p]
+
+quartz.CGDisplayModeRelease.restype = None
+quartz.CGDisplayModeRelease.argtypes = [c_void_p]
+
+quartz.CGDisplayModeGetWidth.restype = c_size_t
+quartz.CGDisplayModeGetWidth.argtypes = [c_void_p]
+
+quartz.CGDisplayModeGetHeight.restype = c_size_t
+quartz.CGDisplayModeGetHeight.argtypes = [c_void_p]
+
+quartz.CGDisplayModeCopyPixelEncoding.restype = c_void_p
+quartz.CGDisplayModeCopyPixelEncoding.argtypes = [c_void_p]
+
+quartz.CGGetActiveDisplayList.restype = CGError
+quartz.CGGetActiveDisplayList.argtypes = [c_uint32, POINTER(CGDirectDisplayID), POINTER(c_uint32)]
+
+quartz.CGDisplayBounds.restype = CGRect
+quartz.CGDisplayBounds.argtypes = [CGDirectDisplayID]
+
+quartz.CGImageSourceCreateWithData.restype = c_void_p
+quartz.CGImageSourceCreateWithData.argtypes = [c_void_p, c_void_p]
+
+quartz.CGImageSourceCreateImageAtIndex.restype = c_void_p
+quartz.CGImageSourceCreateImageAtIndex.argtypes = [c_void_p, c_size_t, c_void_p]
+
+quartz.CGImageSourceCopyPropertiesAtIndex.restype = c_void_p
+quartz.CGImageSourceCopyPropertiesAtIndex.argtypes = [c_void_p, c_size_t, c_void_p]
+
+quartz.CGImageGetDataProvider.restype = c_void_p
+quartz.CGImageGetDataProvider.argtypes = [c_void_p]
+
+quartz.CGDataProviderCopyData.restype = c_void_p
+quartz.CGDataProviderCopyData.argtypes = [c_void_p]
+
+quartz.CGDataProviderCreateWithCFData.restype = c_void_p
+quartz.CGDataProviderCreateWithCFData.argtypes = [c_void_p]
+
+quartz.CGImageCreate.restype = c_void_p
+quartz.CGImageCreate.argtypes = [c_size_t, c_size_t, c_size_t, c_size_t, c_size_t, c_void_p, c_uint32, c_void_p, c_void_p, c_bool, c_int]
+
+quartz.CGImageRelease.restype = None
+quartz.CGImageRelease.argtypes = [c_void_p]
+
+quartz.CGImageGetBytesPerRow.restype = c_size_t
+quartz.CGImageGetBytesPerRow.argtypes = [c_void_p]
+
+quartz.CGImageGetWidth.restype = c_size_t
+quartz.CGImageGetWidth.argtypes = [c_void_p]
+
+quartz.CGImageGetHeight.restype = c_size_t
+quartz.CGImageGetHeight.argtypes = [c_void_p]
+
+quartz.CGImageGetBitsPerPixel.restype = c_size_t
+quartz.CGImageGetBitsPerPixel.argtypes = [c_void_p]
+
+quartz.CGImageGetBitmapInfo.restype = CGBitmapInfo
+quartz.CGImageGetBitmapInfo.argtypes = [c_void_p]
+
+quartz.CGColorSpaceCreateDeviceRGB.restype = c_void_p
+quartz.CGColorSpaceCreateDeviceRGB.argtypes = []
+
+quartz.CGDataProviderRelease.restype = None
+quartz.CGDataProviderRelease.argtypes = [c_void_p]
+
+quartz.CGColorSpaceRelease.restype = None
+quartz.CGColorSpaceRelease.argtypes = [c_void_p]
+
+quartz.CGWarpMouseCursorPosition.restype = CGError
+quartz.CGWarpMouseCursorPosition.argtypes = [CGPoint]
+
+quartz.CGDisplayMoveCursorToPoint.restype = CGError
+quartz.CGDisplayMoveCursorToPoint.argtypes = [CGDirectDisplayID, CGPoint]
+
+quartz.CGAssociateMouseAndMouseCursorPosition.restype = CGError
+quartz.CGAssociateMouseAndMouseCursorPosition.argtypes = [c_bool]
+
+quartz.CGBitmapContextCreate.restype = c_void_p
+quartz.CGBitmapContextCreate.argtypes = [c_void_p, c_size_t, c_size_t, c_size_t, c_size_t, c_void_p, CGBitmapInfo]
+
+quartz.CGBitmapContextCreateImage.restype = c_void_p
+quartz.CGBitmapContextCreateImage.argtypes = [c_void_p]
+
+quartz.CGFontCreateWithDataProvider.restype = c_void_p
+quartz.CGFontCreateWithDataProvider.argtypes = [c_void_p]
+
+quartz.CGFontCreateWithFontName.restype = c_void_p
+quartz.CGFontCreateWithFontName.argtypes = [c_void_p]
+
+quartz.CGContextDrawImage.restype = None
+quartz.CGContextDrawImage.argtypes = [c_void_p, CGRect, c_void_p]
+
+quartz.CGContextRelease.restype = None
+quartz.CGContextRelease.argtypes = [c_void_p]
+
+quartz.CGContextSetTextPosition.restype = None
+quartz.CGContextSetTextPosition.argtypes = [c_void_p, CGFloat, CGFloat]
+
+quartz.CGContextSetShouldAntialias.restype = None
+quartz.CGContextSetShouldAntialias.argtypes = [c_void_p, c_bool]
+
+######################################################################
+
+# CORETEXT
+ct = cdll.LoadLibrary(util.find_library('CoreText'))
+
+# Types
+CTFontOrientation = c_uint32 # CTFontDescriptor.h
+CTFontSymbolicTraits = c_uint32 # CTFontTraits.h
+
+# CoreText constants
+kCTFontAttributeName = c_void_p.in_dll(ct, 'kCTFontAttributeName')
+kCTFontFamilyNameAttribute = c_void_p.in_dll(ct, 'kCTFontFamilyNameAttribute')
+kCTFontSymbolicTrait = c_void_p.in_dll(ct, 'kCTFontSymbolicTrait')
+kCTFontWeightTrait = c_void_p.in_dll(ct, 'kCTFontWeightTrait')
+kCTFontTraitsAttribute = c_void_p.in_dll(ct, 'kCTFontTraitsAttribute')
+
+# constants from CTFontTraits.h
+kCTFontItalicTrait = (1 << 0)
+kCTFontBoldTrait = (1 << 1)
+
+ct.CTLineCreateWithAttributedString.restype = c_void_p
+ct.CTLineCreateWithAttributedString.argtypes = [c_void_p]
+
+ct.CTLineDraw.restype = None
+ct.CTLineDraw.argtypes = [c_void_p, c_void_p]
+
+ct.CTFontGetBoundingRectsForGlyphs.restype = CGRect
+ct.CTFontGetBoundingRectsForGlyphs.argtypes = [c_void_p, CTFontOrientation, POINTER(CGGlyph), POINTER(CGRect), CFIndex]
+
+ct.CTFontGetAdvancesForGlyphs.restype = c_double
+ct.CTFontGetAdvancesForGlyphs.argtypes = [c_void_p, CTFontOrientation, POINTER(CGGlyph), POINTER(CGSize), CFIndex]
+
+ct.CTFontGetAscent.restype = CGFloat
+ct.CTFontGetAscent.argtypes = [c_void_p]
+
+ct.CTFontGetDescent.restype = CGFloat
+ct.CTFontGetDescent.argtypes = [c_void_p]
+
+ct.CTFontGetSymbolicTraits.restype = CTFontSymbolicTraits
+ct.CTFontGetSymbolicTraits.argtypes = [c_void_p]
+
+ct.CTFontGetGlyphsForCharacters.restype = c_bool
+ct.CTFontGetGlyphsForCharacters.argtypes = [c_void_p, POINTER(UniChar), POINTER(CGGlyph), CFIndex]
+
+ct.CTFontCreateWithGraphicsFont.restype = c_void_p
+ct.CTFontCreateWithGraphicsFont.argtypes = [c_void_p, CGFloat, c_void_p, c_void_p]
+
+ct.CTFontCopyFamilyName.restype = c_void_p
+ct.CTFontCopyFamilyName.argtypes = [c_void_p]
+
+ct.CTFontCopyFullName.restype = c_void_p
+ct.CTFontCopyFullName.argtypes = [c_void_p]
+
+ct.CTFontCreateWithFontDescriptor.restype = c_void_p
+ct.CTFontCreateWithFontDescriptor.argtypes = [c_void_p, CGFloat, c_void_p]
+
+ct.CTFontDescriptorCreateWithAttributes.restype = c_void_p
+ct.CTFontDescriptorCreateWithAttributes.argtypes = [c_void_p]
+
+######################################################################
+
+# FOUNDATION
+
+foundation = cdll.LoadLibrary(util.find_library('Foundation'))
+
+foundation.NSMouseInRect.restype = c_bool
+foundation.NSMouseInRect.argtypes = [NSPoint, NSRect, c_bool]
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/cocoapy/cocoatypes.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/cocoapy/cocoatypes.py
new file mode 100644
index 0000000..b12dd06
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/cocoapy/cocoatypes.py
@@ -0,0 +1,85 @@
+from ctypes import *
+
+import sys, platform, struct
+
+__LP64__ = (8*struct.calcsize("P") == 64)
+__i386__ = (platform.machine() == 'i386')
+
+PyObjectEncoding = b'{PyObject=@}'
+
+def encoding_for_ctype(vartype):
+ typecodes = {c_char:b'c', c_int:b'i', c_short:b's', c_long:b'l', c_longlong:b'q',
+ c_ubyte:b'C', c_uint:b'I', c_ushort:b'S', c_ulong:b'L', c_ulonglong:b'Q',
+ c_float:b'f', c_double:b'd', c_bool:b'B', c_char_p:b'*', c_void_p:b'@',
+ py_object:PyObjectEncoding}
+ return typecodes.get(vartype, b'?')
+
+# Note CGBase.h located at
+# /System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Headers/CGBase.h
+# defines CGFloat as double if __LP64__, otherwise it's a float.
+if __LP64__:
+ NSInteger = c_long
+ NSUInteger = c_ulong
+ CGFloat = c_double
+ NSPointEncoding = b'{CGPoint=dd}'
+ NSSizeEncoding = b'{CGSize=dd}'
+ NSRectEncoding = b'{CGRect={CGPoint=dd}{CGSize=dd}}'
+ NSRangeEncoding = b'{_NSRange=QQ}'
+else:
+ NSInteger = c_int
+ NSUInteger = c_uint
+ CGFloat = c_float
+ NSPointEncoding = b'{_NSPoint=ff}'
+ NSSizeEncoding = b'{_NSSize=ff}'
+ NSRectEncoding = b'{_NSRect={_NSPoint=ff}{_NSSize=ff}}'
+ NSRangeEncoding = b'{_NSRange=II}'
+
+NSIntegerEncoding = encoding_for_ctype(NSInteger)
+NSUIntegerEncoding = encoding_for_ctype(NSUInteger)
+CGFloatEncoding = encoding_for_ctype(CGFloat)
+
+# Special case so that NSImage.initWithCGImage_size_() will work.
+CGImageEncoding = b'{CGImage=}'
+
+NSZoneEncoding = b'{_NSZone=}'
+
+# from /System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h
+class NSPoint(Structure):
+ _fields_ = [ ("x", CGFloat), ("y", CGFloat) ]
+CGPoint = NSPoint
+
+class NSSize(Structure):
+ _fields_ = [ ("width", CGFloat), ("height", CGFloat) ]
+CGSize = NSSize
+
+class NSRect(Structure):
+ _fields_ = [ ("origin", NSPoint), ("size", NSSize) ]
+CGRect = NSRect
+
+def NSMakeSize(w, h):
+ return NSSize(w, h)
+
+def NSMakeRect(x, y, w, h):
+ return NSRect(NSPoint(x, y), NSSize(w, h))
+
+# NSDate.h
+NSTimeInterval = c_double
+
+CFIndex = c_long
+UniChar = c_ushort
+unichar = c_wchar # (actually defined as c_ushort in NSString.h, but need ctypes to convert properly)
+CGGlyph = c_ushort
+
+# CFRange struct defined in CFBase.h
+# This replaces the CFRangeMake(LOC, LEN) macro.
+class CFRange(Structure):
+ _fields_ = [ ("location", CFIndex), ("length", CFIndex) ]
+
+# NSRange.h (Note, not defined the same as CFRange)
+class NSRange(Structure):
+ _fields_ = [ ("location", NSUInteger), ("length", NSUInteger) ]
+
+NSZeroPoint = NSPoint(0,0)
+
+CFTypeID = c_ulong
+CFNumberType = c_uint32
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/cocoapy/runtime.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/cocoapy/runtime.py
new file mode 100644
index 0000000..65b9ded
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/cocoapy/runtime.py
@@ -0,0 +1,1195 @@
+# objective-ctypes
+#
+# Copyright (c) 2011, Phillip Nguyen
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# Neither the name of objective-ctypes nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+import sys
+import platform
+import struct
+
+from ctypes import *
+from ctypes import util
+
+from .cocoatypes import *
+
+__LP64__ = (8*struct.calcsize("P") == 64)
+__i386__ = (platform.machine() == 'i386')
+
+if sizeof(c_void_p) == 4:
+ c_ptrdiff_t = c_int32
+elif sizeof(c_void_p) == 8:
+ c_ptrdiff_t = c_int64
+
+######################################################################
+
+objc = cdll.LoadLibrary(util.find_library('objc'))
+
+######################################################################
+
+# BOOL class_addIvar(Class cls, const char *name, size_t size, uint8_t alignment, const char *types)
+objc.class_addIvar.restype = c_bool
+objc.class_addIvar.argtypes = [c_void_p, c_char_p, c_size_t, c_uint8, c_char_p]
+
+# BOOL class_addMethod(Class cls, SEL name, IMP imp, const char *types)
+objc.class_addMethod.restype = c_bool
+
+# BOOL class_addProtocol(Class cls, Protocol *protocol)
+objc.class_addProtocol.restype = c_bool
+objc.class_addProtocol.argtypes = [c_void_p, c_void_p]
+
+# BOOL class_conformsToProtocol(Class cls, Protocol *protocol)
+objc.class_conformsToProtocol.restype = c_bool
+objc.class_conformsToProtocol.argtypes = [c_void_p, c_void_p]
+
+# Ivar * class_copyIvarList(Class cls, unsigned int *outCount)
+# Returns an array of pointers of type Ivar describing instance variables.
+# The array has *outCount pointers followed by a NULL terminator.
+# You must free() the returned array.
+objc.class_copyIvarList.restype = POINTER(c_void_p)
+objc.class_copyIvarList.argtypes = [c_void_p, POINTER(c_uint)]
+
+# Method * class_copyMethodList(Class cls, unsigned int *outCount)
+# Returns an array of pointers of type Method describing instance methods.
+# The array has *outCount pointers followed by a NULL terminator.
+# You must free() the returned array.
+objc.class_copyMethodList.restype = POINTER(c_void_p)
+objc.class_copyMethodList.argtypes = [c_void_p, POINTER(c_uint)]
+
+# objc_property_t * class_copyPropertyList(Class cls, unsigned int *outCount)
+# Returns an array of pointers of type objc_property_t describing properties.
+# The array has *outCount pointers followed by a NULL terminator.
+# You must free() the returned array.
+objc.class_copyPropertyList.restype = POINTER(c_void_p)
+objc.class_copyPropertyList.argtypes = [c_void_p, POINTER(c_uint)]
+
+# Protocol ** class_copyProtocolList(Class cls, unsigned int *outCount)
+# Returns an array of pointers of type Protocol* describing protocols.
+# The array has *outCount pointers followed by a NULL terminator.
+# You must free() the returned array.
+objc.class_copyProtocolList.restype = POINTER(c_void_p)
+objc.class_copyProtocolList.argtypes = [c_void_p, POINTER(c_uint)]
+
+# id class_createInstance(Class cls, size_t extraBytes)
+objc.class_createInstance.restype = c_void_p
+objc.class_createInstance.argtypes = [c_void_p, c_size_t]
+
+# Method class_getClassMethod(Class aClass, SEL aSelector)
+# Will also search superclass for implementations.
+objc.class_getClassMethod.restype = c_void_p
+objc.class_getClassMethod.argtypes = [c_void_p, c_void_p]
+
+# Ivar class_getClassVariable(Class cls, const char* name)
+objc.class_getClassVariable.restype = c_void_p
+objc.class_getClassVariable.argtypes = [c_void_p, c_char_p]
+
+# Method class_getInstanceMethod(Class aClass, SEL aSelector)
+# Will also search superclass for implementations.
+objc.class_getInstanceMethod.restype = c_void_p
+objc.class_getInstanceMethod.argtypes = [c_void_p, c_void_p]
+
+# size_t class_getInstanceSize(Class cls)
+objc.class_getInstanceSize.restype = c_size_t
+objc.class_getInstanceSize.argtypes = [c_void_p]
+
+# Ivar class_getInstanceVariable(Class cls, const char* name)
+objc.class_getInstanceVariable.restype = c_void_p
+objc.class_getInstanceVariable.argtypes = [c_void_p, c_char_p]
+
+# const char *class_getIvarLayout(Class cls)
+objc.class_getIvarLayout.restype = c_char_p
+objc.class_getIvarLayout.argtypes = [c_void_p]
+
+# IMP class_getMethodImplementation(Class cls, SEL name)
+objc.class_getMethodImplementation.restype = c_void_p
+objc.class_getMethodImplementation.argtypes = [c_void_p, c_void_p]
+
+# IMP class_getMethodImplementation_stret(Class cls, SEL name)
+objc.class_getMethodImplementation_stret.restype = c_void_p
+objc.class_getMethodImplementation_stret.argtypes = [c_void_p, c_void_p]
+
+# const char * class_getName(Class cls)
+objc.class_getName.restype = c_char_p
+objc.class_getName.argtypes = [c_void_p]
+
+# objc_property_t class_getProperty(Class cls, const char *name)
+objc.class_getProperty.restype = c_void_p
+objc.class_getProperty.argtypes = [c_void_p, c_char_p]
+
+# Class class_getSuperclass(Class cls)
+objc.class_getSuperclass.restype = c_void_p
+objc.class_getSuperclass.argtypes = [c_void_p]
+
+# int class_getVersion(Class theClass)
+objc.class_getVersion.restype = c_int
+objc.class_getVersion.argtypes = [c_void_p]
+
+# const char *class_getWeakIvarLayout(Class cls)
+objc.class_getWeakIvarLayout.restype = c_char_p
+objc.class_getWeakIvarLayout.argtypes = [c_void_p]
+
+# BOOL class_isMetaClass(Class cls)
+objc.class_isMetaClass.restype = c_bool
+objc.class_isMetaClass.argtypes = [c_void_p]
+
+# IMP class_replaceMethod(Class cls, SEL name, IMP imp, const char *types)
+objc.class_replaceMethod.restype = c_void_p
+objc.class_replaceMethod.argtypes = [c_void_p, c_void_p, c_void_p, c_char_p]
+
+# BOOL class_respondsToSelector(Class cls, SEL sel)
+objc.class_respondsToSelector.restype = c_bool
+objc.class_respondsToSelector.argtypes = [c_void_p, c_void_p]
+
+# void class_setIvarLayout(Class cls, const char *layout)
+objc.class_setIvarLayout.restype = None
+objc.class_setIvarLayout.argtypes = [c_void_p, c_char_p]
+
+# Class class_setSuperclass(Class cls, Class newSuper)
+objc.class_setSuperclass.restype = c_void_p
+objc.class_setSuperclass.argtypes = [c_void_p, c_void_p]
+
+# void class_setVersion(Class theClass, int version)
+objc.class_setVersion.restype = None
+objc.class_setVersion.argtypes = [c_void_p, c_int]
+
+# void class_setWeakIvarLayout(Class cls, const char *layout)
+objc.class_setWeakIvarLayout.restype = None
+objc.class_setWeakIvarLayout.argtypes = [c_void_p, c_char_p]
+
+######################################################################
+
+# const char * ivar_getName(Ivar ivar)
+objc.ivar_getName.restype = c_char_p
+objc.ivar_getName.argtypes = [c_void_p]
+
+# ptrdiff_t ivar_getOffset(Ivar ivar)
+objc.ivar_getOffset.restype = c_ptrdiff_t
+objc.ivar_getOffset.argtypes = [c_void_p]
+
+# const char * ivar_getTypeEncoding(Ivar ivar)
+objc.ivar_getTypeEncoding.restype = c_char_p
+objc.ivar_getTypeEncoding.argtypes = [c_void_p]
+
+######################################################################
+
+# char * method_copyArgumentType(Method method, unsigned int index)
+# You must free() the returned string.
+objc.method_copyArgumentType.restype = c_char_p
+objc.method_copyArgumentType.argtypes = [c_void_p, c_uint]
+
+# char * method_copyReturnType(Method method)
+# You must free() the returned string.
+objc.method_copyReturnType.restype = c_char_p
+objc.method_copyReturnType.argtypes = [c_void_p]
+
+# void method_exchangeImplementations(Method m1, Method m2)
+objc.method_exchangeImplementations.restype = None
+objc.method_exchangeImplementations.argtypes = [c_void_p, c_void_p]
+
+# void method_getArgumentType(Method method, unsigned int index, char *dst, size_t dst_len)
+# Functionally similar to strncpy(dst, parameter_type, dst_len).
+objc.method_getArgumentType.restype = None
+objc.method_getArgumentType.argtypes = [c_void_p, c_uint, c_char_p, c_size_t]
+
+# IMP method_getImplementation(Method method)
+objc.method_getImplementation.restype = c_void_p
+objc.method_getImplementation.argtypes = [c_void_p]
+
+# SEL method_getName(Method method)
+objc.method_getName.restype = c_void_p
+objc.method_getName.argtypes = [c_void_p]
+
+# unsigned method_getNumberOfArguments(Method method)
+objc.method_getNumberOfArguments.restype = c_uint
+objc.method_getNumberOfArguments.argtypes = [c_void_p]
+
+# void method_getReturnType(Method method, char *dst, size_t dst_len)
+# Functionally similar to strncpy(dst, return_type, dst_len)
+objc.method_getReturnType.restype = None
+objc.method_getReturnType.argtypes = [c_void_p, c_char_p, c_size_t]
+
+# const char * method_getTypeEncoding(Method method)
+objc.method_getTypeEncoding.restype = c_char_p
+objc.method_getTypeEncoding.argtypes = [c_void_p]
+
+# IMP method_setImplementation(Method method, IMP imp)
+objc.method_setImplementation.restype = c_void_p
+objc.method_setImplementation.argtypes = [c_void_p, c_void_p]
+
+######################################################################
+
+# Class objc_allocateClassPair(Class superclass, const char *name, size_t extraBytes)
+objc.objc_allocateClassPair.restype = c_void_p
+objc.objc_allocateClassPair.argtypes = [c_void_p, c_char_p, c_size_t]
+
+# Protocol **objc_copyProtocolList(unsigned int *outCount)
+# Returns an array of *outcount pointers followed by NULL terminator.
+# You must free() the array.
+objc.objc_copyProtocolList.restype = POINTER(c_void_p)
+objc.objc_copyProtocolList.argtypes = [POINTER(c_int)]
+
+# id objc_getAssociatedObject(id object, void *key)
+objc.objc_getAssociatedObject.restype = c_void_p
+objc.objc_getAssociatedObject.argtypes = [c_void_p, c_void_p]
+
+# id objc_getClass(const char *name)
+objc.objc_getClass.restype = c_void_p
+objc.objc_getClass.argtypes = [c_char_p]
+
+# int objc_getClassList(Class *buffer, int bufferLen)
+# Pass None for buffer to obtain just the total number of classes.
+objc.objc_getClassList.restype = c_int
+objc.objc_getClassList.argtypes = [c_void_p, c_int]
+
+# id objc_getMetaClass(const char *name)
+objc.objc_getMetaClass.restype = c_void_p
+objc.objc_getMetaClass.argtypes = [c_char_p]
+
+# Protocol *objc_getProtocol(const char *name)
+objc.objc_getProtocol.restype = c_void_p
+objc.objc_getProtocol.argtypes = [c_char_p]
+
+# You should set return and argument types depending on context.
+# id objc_msgSend(id theReceiver, SEL theSelector, ...)
+# id objc_msgSendSuper(struct objc_super *super, SEL op, ...)
+
+# void objc_msgSendSuper_stret(struct objc_super *super, SEL op, ...)
+objc.objc_msgSendSuper_stret.restype = None
+
+# double objc_msgSend_fpret(id self, SEL op, ...)
+# objc.objc_msgSend_fpret.restype = c_double
+
+# void objc_msgSend_stret(void * stretAddr, id theReceiver, SEL theSelector, ...)
+objc.objc_msgSend_stret.restype = None
+
+# void objc_registerClassPair(Class cls)
+objc.objc_registerClassPair.restype = None
+objc.objc_registerClassPair.argtypes = [c_void_p]
+
+# void objc_removeAssociatedObjects(id object)
+objc.objc_removeAssociatedObjects.restype = None
+objc.objc_removeAssociatedObjects.argtypes = [c_void_p]
+
+# void objc_setAssociatedObject(id object, void *key, id value, objc_AssociationPolicy policy)
+objc.objc_setAssociatedObject.restype = None
+objc.objc_setAssociatedObject.argtypes = [c_void_p, c_void_p, c_void_p, c_int]
+
+######################################################################
+
+# id object_copy(id obj, size_t size)
+objc.object_copy.restype = c_void_p
+objc.object_copy.argtypes = [c_void_p, c_size_t]
+
+# id object_dispose(id obj)
+objc.object_dispose.restype = c_void_p
+objc.object_dispose.argtypes = [c_void_p]
+
+# Class object_getClass(id object)
+objc.object_getClass.restype = c_void_p
+objc.object_getClass.argtypes = [c_void_p]
+
+# const char *object_getClassName(id obj)
+objc.object_getClassName.restype = c_char_p
+objc.object_getClassName.argtypes = [c_void_p]
+
+# Ivar object_getInstanceVariable(id obj, const char *name, void **outValue)
+objc.object_getInstanceVariable.restype = c_void_p
+objc.object_getInstanceVariable.argtypes=[c_void_p, c_char_p, c_void_p]
+
+# id object_getIvar(id object, Ivar ivar)
+objc.object_getIvar.restype = c_void_p
+objc.object_getIvar.argtypes = [c_void_p, c_void_p]
+
+# Class object_setClass(id object, Class cls)
+objc.object_setClass.restype = c_void_p
+objc.object_setClass.argtypes = [c_void_p, c_void_p]
+
+# Ivar object_setInstanceVariable(id obj, const char *name, void *value)
+# Set argtypes based on the data type of the instance variable.
+objc.object_setInstanceVariable.restype = c_void_p
+
+# void object_setIvar(id object, Ivar ivar, id value)
+objc.object_setIvar.restype = None
+objc.object_setIvar.argtypes = [c_void_p, c_void_p, c_void_p]
+
+######################################################################
+
+# const char *property_getAttributes(objc_property_t property)
+objc.property_getAttributes.restype = c_char_p
+objc.property_getAttributes.argtypes = [c_void_p]
+
+# const char *property_getName(objc_property_t property)
+objc.property_getName.restype = c_char_p
+objc.property_getName.argtypes = [c_void_p]
+
+######################################################################
+
+# BOOL protocol_conformsToProtocol(Protocol *proto, Protocol *other)
+objc.protocol_conformsToProtocol.restype = c_bool
+objc.protocol_conformsToProtocol.argtypes = [c_void_p, c_void_p]
+
+class OBJC_METHOD_DESCRIPTION(Structure):
+ _fields_ = [ ("name", c_void_p), ("types", c_char_p) ]
+
+# struct objc_method_description *protocol_copyMethodDescriptionList(Protocol *p, BOOL isRequiredMethod, BOOL isInstanceMethod, unsigned int *outCount)
+# You must free() the returned array.
+objc.protocol_copyMethodDescriptionList.restype = POINTER(OBJC_METHOD_DESCRIPTION)
+objc.protocol_copyMethodDescriptionList.argtypes = [c_void_p, c_bool, c_bool, POINTER(c_uint)]
+
+# objc_property_t * protocol_copyPropertyList(Protocol *protocol, unsigned int *outCount)
+objc.protocol_copyPropertyList.restype = c_void_p
+objc.protocol_copyPropertyList.argtypes = [c_void_p, POINTER(c_uint)]
+
+# Protocol **protocol_copyProtocolList(Protocol *proto, unsigned int *outCount)
+objc.protocol_copyProtocolList = POINTER(c_void_p)
+objc.protocol_copyProtocolList.argtypes = [c_void_p, POINTER(c_uint)]
+
+# struct objc_method_description protocol_getMethodDescription(Protocol *p, SEL aSel, BOOL isRequiredMethod, BOOL isInstanceMethod)
+objc.protocol_getMethodDescription.restype = OBJC_METHOD_DESCRIPTION
+objc.protocol_getMethodDescription.argtypes = [c_void_p, c_void_p, c_bool, c_bool]
+
+# const char *protocol_getName(Protocol *p)
+objc.protocol_getName.restype = c_char_p
+objc.protocol_getName.argtypes = [c_void_p]
+
+######################################################################
+
+# const char* sel_getName(SEL aSelector)
+objc.sel_getName.restype = c_char_p
+objc.sel_getName.argtypes = [c_void_p]
+
+# SEL sel_getUid(const char *str)
+# Use sel_registerName instead.
+
+# BOOL sel_isEqual(SEL lhs, SEL rhs)
+objc.sel_isEqual.restype = c_bool
+objc.sel_isEqual.argtypes = [c_void_p, c_void_p]
+
+# SEL sel_registerName(const char *str)
+objc.sel_registerName.restype = c_void_p
+objc.sel_registerName.argtypes = [c_char_p]
+
+######################################################################
+
+def ensure_bytes(x):
+ if isinstance(x, bytes):
+ return x
+ return x.encode('ascii')
+
+######################################################################
+
+def get_selector(name):
+ return c_void_p(objc.sel_registerName(ensure_bytes(name)))
+
+def get_class(name):
+ return c_void_p(objc.objc_getClass(ensure_bytes(name)))
+
+def get_object_class(obj):
+ return c_void_p(objc.object_getClass(obj))
+
+def get_metaclass(name):
+ return c_void_p(objc.objc_getMetaClass(ensure_bytes(name)))
+
+def get_superclass_of_object(obj):
+ cls = c_void_p(objc.object_getClass(obj))
+ return c_void_p(objc.class_getSuperclass(cls))
+
+
+# http://www.sealiesoftware.com/blog/archive/2008/10/30/objc_explain_objc_msgSend_stret.html
+# http://www.x86-64.org/documentation/abi-0.99.pdf (pp.17-23)
+# executive summary: on x86-64, who knows?
+def x86_should_use_stret(restype):
+ """Try to figure out when a return type will be passed on stack."""
+ if type(restype) != type(Structure):
+ return False
+ if not __LP64__ and sizeof(restype) <= 8:
+ return False
+ if __LP64__ and sizeof(restype) <= 16: # maybe? I don't know?
+ return False
+ return True
+
+# http://www.sealiesoftware.com/blog/archive/2008/11/16/objc_explain_objc_msgSend_fpret.html
+def should_use_fpret(restype):
+ """Determine if objc_msgSend_fpret is required to return a floating point type."""
+ if not __i386__:
+ # Unneeded on non-intel processors
+ return False
+ if __LP64__ and restype == c_longdouble:
+ # Use only for long double on x86_64
+ return True
+ if not __LP64__ and restype in (c_float, c_double, c_longdouble):
+ return True
+ return False
+
+# By default, assumes that restype is c_void_p
+# and that all arguments are wrapped inside c_void_p.
+# Use the restype and argtypes keyword arguments to
+# change these values. restype should be a ctypes type
+# and argtypes should be a list of ctypes types for
+# the arguments of the message only.
+def send_message(receiver, selName, *args, **kwargs):
+ if isinstance(receiver, str):
+ receiver = get_class(receiver)
+ selector = get_selector(selName)
+ restype = kwargs.get('restype', c_void_p)
+ #print 'send_message', receiver, selName, args, kwargs
+ argtypes = kwargs.get('argtypes', [])
+ # Choose the correct version of objc_msgSend based on return type.
+ if should_use_fpret(restype):
+ objc.objc_msgSend_fpret.restype = restype
+ objc.objc_msgSend_fpret.argtypes = [c_void_p, c_void_p] + argtypes
+ result = objc.objc_msgSend_fpret(receiver, selector, *args)
+ elif x86_should_use_stret(restype):
+ objc.objc_msgSend_stret.argtypes = [POINTER(restype), c_void_p, c_void_p] + argtypes
+ result = restype()
+ objc.objc_msgSend_stret(byref(result), receiver, selector, *args)
+ else:
+ objc.objc_msgSend.restype = restype
+ objc.objc_msgSend.argtypes = [c_void_p, c_void_p] + argtypes
+ result = objc.objc_msgSend(receiver, selector, *args)
+ if restype == c_void_p:
+ result = c_void_p(result)
+ return result
+
+class OBJC_SUPER(Structure):
+ _fields_ = [ ('receiver', c_void_p), ('class', c_void_p) ]
+
+OBJC_SUPER_PTR = POINTER(OBJC_SUPER)
+
+#http://stackoverflow.com/questions/3095360/what-exactly-is-super-in-objective-c
+def send_super(receiver, selName, *args, **kwargs):
+ #print 'send_super', receiver, selName, args
+ if hasattr(receiver, '_as_parameter_'):
+ receiver = receiver._as_parameter_
+ superclass = get_superclass_of_object(receiver)
+ super_struct = OBJC_SUPER(receiver, superclass)
+ selector = get_selector(selName)
+ restype = kwargs.get('restype', c_void_p)
+ argtypes = kwargs.get('argtypes', None)
+ objc.objc_msgSendSuper.restype = restype
+ if argtypes:
+ objc.objc_msgSendSuper.argtypes = [OBJC_SUPER_PTR, c_void_p] + argtypes
+ else:
+ objc.objc_msgSendSuper.argtypes = None
+ result = objc.objc_msgSendSuper(byref(super_struct), selector, *args)
+ if restype == c_void_p:
+ result = c_void_p(result)
+ return result
+
+######################################################################
+
+cfunctype_table = {}
+
+def parse_type_encoding(encoding):
+ """Takes a type encoding string and outputs a list of the separated type codes.
+ Currently does not handle unions or bitfields and strips out any field width
+ specifiers or type specifiers from the encoding. For Python 3.2+, encoding is
+ assumed to be a bytes object and not unicode.
+
+ Examples:
+ parse_type_encoding('^v16@0:8') --> ['^v', '@', ':']
+ parse_type_encoding('{CGSize=dd}40@0:8{CGSize=dd}16Q32') --> ['{CGSize=dd}', '@', ':', '{CGSize=dd}', 'Q']
+ """
+ type_encodings = []
+ brace_count = 0 # number of unclosed curly braces
+ bracket_count = 0 # number of unclosed square brackets
+ typecode = b''
+ for c in encoding:
+ # In Python 3, c comes out as an integer in the range 0-255. In Python 2, c is a single character string.
+ # To fix the disparity, we convert c to a bytes object if necessary.
+ if isinstance(c, int):
+ c = bytes([c])
+
+ if c == b'{':
+ # Check if this marked the end of previous type code.
+ if typecode and typecode[-1:] != b'^' and brace_count == 0 and bracket_count == 0:
+ type_encodings.append(typecode)
+ typecode = b''
+ typecode += c
+ brace_count += 1
+ elif c == b'}':
+ typecode += c
+ brace_count -= 1
+ assert(brace_count >= 0)
+ elif c == b'[':
+ # Check if this marked the end of previous type code.
+ if typecode and typecode[-1:] != b'^' and brace_count == 0 and bracket_count == 0:
+ type_encodings.append(typecode)
+ typecode = b''
+ typecode += c
+ bracket_count += 1
+ elif c == b']':
+ typecode += c
+ bracket_count -= 1
+ assert(bracket_count >= 0)
+ elif brace_count or bracket_count:
+ # Anything encountered while inside braces or brackets gets stuck on.
+ typecode += c
+ elif c in b'0123456789':
+ # Ignore field width specifiers for now.
+ pass
+ elif c in b'rnNoORV':
+ # Also ignore type specifiers.
+ pass
+ elif c in b'^cislqCISLQfdBv*@#:b?':
+ if typecode and typecode[-1:] == b'^':
+ # Previous char was pointer specifier, so keep going.
+ typecode += c
+ else:
+ # Add previous type code to the list.
+ if typecode:
+ type_encodings.append(typecode)
+ # Start a new type code.
+ typecode = c
+
+ # Add the last type code to the list
+ if typecode:
+ type_encodings.append(typecode)
+
+ return type_encodings
+
+
+# Limited to basic types and pointers to basic types.
+# Does not try to handle arrays, arbitrary structs, unions, or bitfields.
+# Assume that encoding is a bytes object and not unicode.
+def cfunctype_for_encoding(encoding):
+ # Check if we've already created a CFUNCTYPE for this encoding.
+ # If so, then return the cached CFUNCTYPE.
+ if encoding in cfunctype_table:
+ return cfunctype_table[encoding]
+
+ # Otherwise, create a new CFUNCTYPE for the encoding.
+ typecodes = {b'c':c_char, b'i':c_int, b's':c_short, b'l':c_long, b'q':c_longlong,
+ b'C':c_ubyte, b'I':c_uint, b'S':c_ushort, b'L':c_ulong, b'Q':c_ulonglong,
+ b'f':c_float, b'd':c_double, b'B':c_bool, b'v':None, b'*':c_char_p,
+ b'@':c_void_p, b'#':c_void_p, b':':c_void_p, NSPointEncoding:NSPoint,
+ NSSizeEncoding:NSSize, NSRectEncoding:NSRect, NSRangeEncoding:NSRange,
+ PyObjectEncoding:py_object}
+ argtypes = []
+ for code in parse_type_encoding(encoding):
+ if code in typecodes:
+ argtypes.append(typecodes[code])
+ elif code[0:1] == b'^' and code[1:] in typecodes:
+ argtypes.append(POINTER(typecodes[code[1:]]))
+ else:
+ raise Exception('unknown type encoding: ' + code)
+
+ cfunctype = CFUNCTYPE(*argtypes)
+
+ # Cache the new CFUNCTYPE in the cfunctype_table.
+ # We do this mainly because it prevents the CFUNCTYPE
+ # from being garbage-collected while we need it.
+ cfunctype_table[encoding] = cfunctype
+ return cfunctype
+
+######################################################################
+
+# After calling create_subclass, you must first register
+# it with register_subclass before you may use it.
+# You can add new methods after the class is registered,
+# but you cannot add any new ivars.
+def create_subclass(superclass, name):
+ if isinstance(superclass, str):
+ superclass = get_class(superclass)
+ return c_void_p(objc.objc_allocateClassPair(superclass, ensure_bytes(name), 0))
+
+def register_subclass(subclass):
+ objc.objc_registerClassPair(subclass)
+
+# types is a string encoding the argument types of the method.
+# The first type code of types is the return type (e.g. 'v' if void)
+# The second type code must be '@' for id self.
+# The third type code must be ':' for SEL cmd.
+# Additional type codes are for types of other arguments if any.
+def add_method(cls, selName, method, types):
+ type_encodings = parse_type_encoding(types)
+ assert(type_encodings[1] == b'@') # ensure id self typecode
+ assert(type_encodings[2] == b':') # ensure SEL cmd typecode
+ selector = get_selector(selName)
+ cfunctype = cfunctype_for_encoding(types)
+ imp = cfunctype(method)
+ objc.class_addMethod.argtypes = [c_void_p, c_void_p, cfunctype, c_char_p]
+ objc.class_addMethod(cls, selector, imp, types)
+ return imp
+
+def add_ivar(cls, name, vartype):
+ return objc.class_addIvar(cls, ensure_bytes(name), sizeof(vartype), alignment(vartype), encoding_for_ctype(vartype))
+
+def set_instance_variable(obj, varname, value, vartype):
+ objc.object_setInstanceVariable.argtypes = [c_void_p, c_char_p, vartype]
+ objc.object_setInstanceVariable(obj, ensure_bytes(varname), value)
+
+def get_instance_variable(obj, varname, vartype):
+ variable = vartype()
+ objc.object_getInstanceVariable(obj, ensure_bytes(varname), byref(variable))
+ return variable.value
+
+######################################################################
+
+class ObjCMethod(object):
+ """This represents an unbound Objective-C method (really an IMP)."""
+
+ # Note, need to map 'c' to c_byte rather than c_char, because otherwise
+ # ctypes converts the value into a one-character string which is generally
+ # not what we want at all, especially when the 'c' represents a bool var.
+ typecodes = {b'c':c_byte, b'i':c_int, b's':c_short, b'l':c_long, b'q':c_longlong,
+ b'C':c_ubyte, b'I':c_uint, b'S':c_ushort, b'L':c_ulong, b'Q':c_ulonglong,
+ b'f':c_float, b'd':c_double, b'B':c_bool, b'v':None, b'Vv':None, b'*':c_char_p,
+ b'@':c_void_p, b'#':c_void_p, b':':c_void_p, b'^v':c_void_p, b'?':c_void_p,
+ NSPointEncoding:NSPoint, NSSizeEncoding:NSSize, NSRectEncoding:NSRect,
+ NSRangeEncoding:NSRange,
+ PyObjectEncoding:py_object}
+
+ cfunctype_table = {}
+
+ def __init__(self, method):
+ """Initialize with an Objective-C Method pointer. We then determine
+ the return type and argument type information of the method."""
+ self.selector = c_void_p(objc.method_getName(method))
+ self.name = objc.sel_getName(self.selector)
+ self.pyname = self.name.replace(b':', b'_')
+ self.encoding = objc.method_getTypeEncoding(method)
+ self.return_type = objc.method_copyReturnType(method)
+ self.nargs = objc.method_getNumberOfArguments(method)
+ self.imp = c_void_p(objc.method_getImplementation(method))
+ self.argument_types = []
+ for i in range(self.nargs):
+ buffer = c_buffer(512)
+ objc.method_getArgumentType(method, i, buffer, len(buffer))
+ self.argument_types.append(buffer.value)
+ # Get types for all the arguments.
+ try:
+ self.argtypes = [self.ctype_for_encoding(t) for t in self.argument_types]
+ except:
+ #print 'no argtypes encoding for %s (%s)' % (self.name, self.argument_types)
+ self.argtypes = None
+ # Get types for the return type.
+ try:
+ if self.return_type == b'@':
+ self.restype = ObjCInstance
+ elif self.return_type == b'#':
+ self.restype = ObjCClass
+ else:
+ self.restype = self.ctype_for_encoding(self.return_type)
+ except:
+ #print 'no restype encoding for %s (%s)' % (self.name, self.return_type)
+ self.restype = None
+ self.func = None
+
+ def ctype_for_encoding(self, encoding):
+ """Return ctypes type for an encoded Objective-C type."""
+ if encoding in self.typecodes:
+ return self.typecodes[encoding]
+ elif encoding[0:1] == b'^' and encoding[1:] in self.typecodes:
+ return POINTER(self.typecodes[encoding[1:]])
+ elif encoding[0:1] == b'^' and encoding[1:] in [CGImageEncoding, NSZoneEncoding]:
+ # special cases
+ return c_void_p
+ elif encoding[0:1] == b'r' and encoding[1:] in self.typecodes:
+ # const decorator, don't care
+ return self.typecodes[encoding[1:]]
+ elif encoding[0:2] == b'r^' and encoding[2:] in self.typecodes:
+ # const pointer, also don't care
+ return POINTER(self.typecodes[encoding[2:]])
+ else:
+ raise Exception('unknown encoding for %s: %s' % (self.name, encoding))
+
+ def get_prototype(self):
+ """Returns a ctypes CFUNCTYPE for the method."""
+ if self.restype == ObjCInstance or self.restype == ObjCClass:
+ # Some hacky stuff to get around ctypes issues on 64-bit. Can't let
+ # ctypes convert the return value itself, because it truncates the pointer
+ # along the way. So instead, we must do set the return type to c_void_p to
+ # ensure we get 64-bit addresses and then convert the return value manually.
+ self.prototype = CFUNCTYPE(c_void_p, *self.argtypes)
+ else:
+ self.prototype = CFUNCTYPE(self.restype, *self.argtypes)
+ return self.prototype
+
+ def __repr__(self):
+ return "" % (self.name, self.encoding)
+
+ def get_callable(self):
+ """Returns a python-callable version of the method's IMP."""
+ if not self.func:
+ prototype = self.get_prototype()
+ self.func = cast(self.imp, prototype)
+ if self.restype == ObjCInstance or self.restype == ObjCClass:
+ self.func.restype = c_void_p
+ else:
+ self.func.restype = self.restype
+ self.func.argtypes = self.argtypes
+ return self.func
+
+ def __call__(self, objc_id, *args):
+ """Call the method with the given id and arguments. You do not need
+ to pass in the selector as an argument since it will be automatically
+ provided."""
+ f = self.get_callable()
+ try:
+ result = f(objc_id, self.selector, *args)
+ # Convert result to python type if it is a instance or class pointer.
+ if self.restype == ObjCInstance:
+ result = ObjCInstance(result)
+ elif self.restype == ObjCClass:
+ result = ObjCClass(result)
+ return result
+ except ArgumentError as error:
+ # Add more useful info to argument error exceptions, then reraise.
+ error.args += ('selector = ' + self.name,
+ 'argtypes =' + str(self.argtypes),
+ 'encoding = ' + self.encoding)
+ raise
+
+######################################################################
+
+class ObjCBoundMethod(object):
+ """This represents an Objective-C method (an IMP) which has been bound
+ to some id which will be passed as the first parameter to the method."""
+
+ def __init__(self, method, objc_id):
+ """Initialize with a method and ObjCInstance or ObjCClass object."""
+ self.method = method
+ self.objc_id = objc_id
+
+ def __repr__(self):
+ return '' % (self.method.name, self.objc_id)
+
+ def __call__(self, *args):
+ """Call the method with the given arguments."""
+ return self.method(self.objc_id, *args)
+
+######################################################################
+
+class ObjCClass(object):
+ """Python wrapper for an Objective-C class."""
+
+ # We only create one Python object for each Objective-C class.
+ # Any future calls with the same class will return the previously
+ # created Python object. Note that these aren't weak references.
+ # After you create an ObjCClass, it will exist until the end of the
+ # program.
+ _registered_classes = {}
+
+ def __new__(cls, class_name_or_ptr):
+ """Create a new ObjCClass instance or return a previously created
+ instance for the given Objective-C class. The argument may be either
+ the name of the class to retrieve, or a pointer to the class."""
+ # Determine name and ptr values from passed in argument.
+ if isinstance(class_name_or_ptr, str):
+ name = class_name_or_ptr
+ ptr = get_class(name)
+ else:
+ ptr = class_name_or_ptr
+ # Make sure that ptr value is wrapped in c_void_p object
+ # for safety when passing as ctypes argument.
+ if not isinstance(ptr, c_void_p):
+ ptr = c_void_p(ptr)
+ name = objc.class_getName(ptr)
+
+ # Check if we've already created a Python object for this class
+ # and if so, return it rather than making a new one.
+ if name in cls._registered_classes:
+ return cls._registered_classes[name]
+
+ # Otherwise create a new Python object and then initialize it.
+ objc_class = super(ObjCClass, cls).__new__(cls)
+ objc_class.ptr = ptr
+ objc_class.name = name
+ objc_class.instance_methods = {} # mapping of name -> instance method
+ objc_class.class_methods = {} # mapping of name -> class method
+ objc_class._as_parameter_ = ptr # for ctypes argument passing
+
+ # Store the new class in dictionary of registered classes.
+ cls._registered_classes[name] = objc_class
+
+ # Not sure this is necessary...
+ objc_class.cache_instance_methods()
+ objc_class.cache_class_methods()
+
+ return objc_class
+
+ def __repr__(self):
+ return "" % (self.name, str(self.ptr.value))
+
+ def cache_instance_methods(self):
+ """Create and store python representations of all instance methods
+ implemented by this class (but does not find methods of superclass)."""
+ count = c_uint()
+ method_array = objc.class_copyMethodList(self.ptr, byref(count))
+ for i in range(count.value):
+ method = c_void_p(method_array[i])
+ objc_method = ObjCMethod(method)
+ self.instance_methods[objc_method.pyname] = objc_method
+
+ def cache_class_methods(self):
+ """Create and store python representations of all class methods
+ implemented by this class (but does not find methods of superclass)."""
+ count = c_uint()
+ method_array = objc.class_copyMethodList(objc.object_getClass(self.ptr), byref(count))
+ for i in range(count.value):
+ method = c_void_p(method_array[i])
+ objc_method = ObjCMethod(method)
+ self.class_methods[objc_method.pyname] = objc_method
+
+ def get_instance_method(self, name):
+ """Returns a python representation of the named instance method,
+ either by looking it up in the cached list of methods or by searching
+ for and creating a new method object."""
+ if name in self.instance_methods:
+ return self.instance_methods[name]
+ else:
+ # If method name isn't in the cached list, it might be a method of
+ # the superclass, so call class_getInstanceMethod to check.
+ selector = get_selector(name.replace(b'_', b':'))
+ method = c_void_p(objc.class_getInstanceMethod(self.ptr, selector))
+ if method.value:
+ objc_method = ObjCMethod(method)
+ self.instance_methods[name] = objc_method
+ return objc_method
+ return None
+
+ def get_class_method(self, name):
+ """Returns a python representation of the named class method,
+ either by looking it up in the cached list of methods or by searching
+ for and creating a new method object."""
+ if name in self.class_methods:
+ return self.class_methods[name]
+ else:
+ # If method name isn't in the cached list, it might be a method of
+ # the superclass, so call class_getInstanceMethod to check.
+ selector = get_selector(name.replace(b'_', b':'))
+ method = c_void_p(objc.class_getClassMethod(self.ptr, selector))
+ if method.value:
+ objc_method = ObjCMethod(method)
+ self.class_methods[name] = objc_method
+ return objc_method
+ return None
+
+ def __getattr__(self, name):
+ """Returns a callable method object with the given name."""
+ # If name refers to a class method, then return a callable object
+ # for the class method with self.ptr as hidden first parameter.
+ name = ensure_bytes(name)
+ method = self.get_class_method(name)
+ if method:
+ return ObjCBoundMethod(method, self.ptr)
+ # If name refers to an instance method, then simply return the method.
+ # The caller will need to supply an instance as the first parameter.
+ method = self.get_instance_method(name)
+ if method:
+ return method
+ # Otherwise, raise an exception.
+ raise AttributeError('ObjCClass %s has no attribute %s' % (self.name, name))
+
+######################################################################
+
+class ObjCInstance(object):
+ """Python wrapper for an Objective-C instance."""
+
+ _cached_objects = {}
+
+ def __new__(cls, object_ptr):
+ """Create a new ObjCInstance or return a previously created one
+ for the given object_ptr which should be an Objective-C id."""
+ # Make sure that object_ptr is wrapped in a c_void_p.
+ if not isinstance(object_ptr, c_void_p):
+ object_ptr = c_void_p(object_ptr)
+
+ # If given a nil pointer, return None.
+ if not object_ptr.value:
+ return None
+
+ # Check if we've already created an python ObjCInstance for this
+ # object_ptr id and if so, then return it. A single ObjCInstance will
+ # be created for any object pointer when it is first encountered.
+ # This same ObjCInstance will then persist until the object is
+ # deallocated.
+ if object_ptr.value in cls._cached_objects:
+ return cls._cached_objects[object_ptr.value]
+
+ # Otherwise, create a new ObjCInstance.
+ objc_instance = super(ObjCInstance, cls).__new__(cls)
+ objc_instance.ptr = object_ptr
+ objc_instance._as_parameter_ = object_ptr
+ # Determine class of this object.
+ class_ptr = c_void_p(objc.object_getClass(object_ptr))
+ objc_instance.objc_class = ObjCClass(class_ptr)
+
+ # Store new object in the dictionary of cached objects, keyed
+ # by the (integer) memory address pointed to by the object_ptr.
+ cls._cached_objects[object_ptr.value] = objc_instance
+
+ # Create a DeallocationObserver and associate it with this object.
+ # When the Objective-C object is deallocated, the observer will remove
+ # the ObjCInstance corresponding to the object from the cached objects
+ # dictionary, effectively destroying the ObjCInstance.
+ observer = send_message(send_message('DeallocationObserver', 'alloc'), 'initWithObject:', objc_instance)
+ objc.objc_setAssociatedObject(objc_instance, observer, observer, 0x301)
+ # The observer is retained by the object we associate it to. We release
+ # the observer now so that it will be deallocated when the associated
+ # object is deallocated.
+ send_message(observer, 'release')
+
+ return objc_instance
+
+ def __repr__(self):
+ if self.objc_class.name == b'NSCFString':
+ # Display contents of NSString objects
+ from .cocoalibs import cfstring_to_string
+ string = cfstring_to_string(self)
+ return "" % (id(self), self.objc_class.name, string, str(self.ptr.value))
+
+ return "" % (id(self), self.objc_class.name, str(self.ptr.value))
+
+ def __getattr__(self, name):
+ """Returns a callable method object with the given name."""
+ # Search for named instance method in the class object and if it
+ # exists, return callable object with self as hidden argument.
+ # Note: you should give self and not self.ptr as a parameter to
+ # ObjCBoundMethod, so that it will be able to keep the ObjCInstance
+ # alive for chained calls like MyClass.alloc().init() where the
+ # object created by alloc() is not assigned to a variable.
+ name = ensure_bytes(name)
+ method = self.objc_class.get_instance_method(name)
+ if method:
+ return ObjCBoundMethod(method, self)
+ # Else, search for class method with given name in the class object.
+ # If it exists, return callable object with a pointer to the class
+ # as a hidden argument.
+ method = self.objc_class.get_class_method(name)
+ if method:
+ return ObjCBoundMethod(method, self.objc_class.ptr)
+ # Otherwise raise an exception.
+ raise AttributeError('ObjCInstance %s has no attribute %s' % (self.objc_class.name, name))
+
+######################################################################
+
+def convert_method_arguments(encoding, args):
+ """Used by ObjCSubclass to convert Objective-C method arguments to
+ Python values before passing them on to the Python-defined method."""
+ new_args = []
+ arg_encodings = parse_type_encoding(encoding)[3:]
+ for e, a in zip(arg_encodings, args):
+ if e == b'@':
+ new_args.append(ObjCInstance(a))
+ elif e == b'#':
+ new_args.append(ObjCClass(a))
+ else:
+ new_args.append(a)
+ return new_args
+
+# ObjCSubclass is used to define an Objective-C subclass of an existing
+# class registered with the runtime. When you create an instance of
+# ObjCSubclass, it registers the new subclass with the Objective-C
+# runtime and creates a set of function decorators that you can use to
+# add instance methods or class methods to the subclass.
+#
+# Typical usage would be to first create and register the subclass:
+#
+# MySubclass = ObjCSubclass('NSObject', 'MySubclassName')
+#
+# then add methods with:
+#
+# @MySubclass.method('v')
+# def methodThatReturnsVoid(self):
+# pass
+#
+# @MySubclass.method('Bi')
+# def boolReturningMethodWithInt_(self, x):
+# return True
+#
+# @MySubclass.classmethod('@')
+# def classMethodThatReturnsId(self):
+# return self
+#
+# It is probably a good idea to organize the code related to a single
+# subclass by either putting it in its own module (note that you don't
+# actually need to expose any of the method names or the ObjCSubclass)
+# or by bundling it all up inside a python class definition, perhaps
+# called MySubclassImplementation.
+#
+# It is also possible to add Objective-C ivars to the subclass, however
+# if you do so, you must call the __init__ method with register=False,
+# and then call the register method after the ivars have been added.
+# But rather than creating the ivars in Objective-C land, it is easier
+# to just define python-based instance variables in your subclass's init
+# method.
+#
+# This class is used only to *define* the interface and implementation
+# of an Objective-C subclass from python. It should not be used in
+# any other way. If you want a python representation of the resulting
+# class, create it with ObjCClass.
+#
+# Instances are created as a pointer to the objc object by using:
+#
+# myinstance = send_message('MySubclassName', 'alloc')
+# myinstance = send_message(myinstance, 'init')
+#
+# or wrapped inside an ObjCInstance object by using:
+#
+# myclass = ObjCClass('MySubclassName')
+# myinstance = myclass.alloc().init()
+#
+class ObjCSubclass(object):
+ """Use this to create a subclass of an existing Objective-C class.
+ It consists primarily of function decorators which you use to add methods
+ to the subclass."""
+
+ def __init__(self, superclass, name, register=True):
+ self._imp_table = {}
+ self.name = name
+ self.objc_cls = create_subclass(superclass, name)
+ self._as_parameter_ = self.objc_cls
+ if register:
+ self.register()
+
+ def register(self):
+ """Register the new class with the Objective-C runtime."""
+ objc.objc_registerClassPair(self.objc_cls)
+ # We can get the metaclass only after the class is registered.
+ self.objc_metaclass = get_metaclass(self.name)
+
+ def add_ivar(self, varname, vartype):
+ """Add instance variable named varname to the subclass.
+ varname should be a string.
+ vartype is a ctypes type.
+ The class must be registered AFTER adding instance variables."""
+ return add_ivar(self.objc_cls, varname, vartype)
+
+ def add_method(self, method, name, encoding):
+ imp = add_method(self.objc_cls, name, method, encoding)
+ self._imp_table[name] = imp
+
+ # http://iphonedevelopment.blogspot.com/2008/08/dynamically-adding-class-objects.html
+ def add_class_method(self, method, name, encoding):
+ imp = add_method(self.objc_metaclass, name, method, encoding)
+ self._imp_table[name] = imp
+
+ def rawmethod(self, encoding):
+ """Decorator for instance methods without any fancy shenanigans.
+ The function must have the signature f(self, cmd, *args)
+ where both self and cmd are just pointers to objc objects."""
+ # Add encodings for hidden self and cmd arguments.
+ encoding = ensure_bytes(encoding)
+ typecodes = parse_type_encoding(encoding)
+ typecodes.insert(1, b'@:')
+ encoding = b''.join(typecodes)
+ def decorator(f):
+ name = f.__name__.replace('_', ':')
+ self.add_method(f, name, encoding)
+ return f
+ return decorator
+
+ def method(self, encoding):
+ """Function decorator for instance methods."""
+ # Add encodings for hidden self and cmd arguments.
+ encoding = ensure_bytes(encoding)
+ typecodes = parse_type_encoding(encoding)
+ typecodes.insert(1, b'@:')
+ encoding = b''.join(typecodes)
+ def decorator(f):
+ def objc_method(objc_self, objc_cmd, *args):
+ py_self = ObjCInstance(objc_self)
+ py_self.objc_cmd = objc_cmd
+ args = convert_method_arguments(encoding, args)
+ result = f(py_self, *args)
+ if isinstance(result, ObjCClass):
+ result = result.ptr.value
+ elif isinstance(result, ObjCInstance):
+ result = result.ptr.value
+ return result
+ name = f.__name__.replace('_', ':')
+ self.add_method(objc_method, name, encoding)
+ return objc_method
+ return decorator
+
+ def classmethod(self, encoding):
+ """Function decorator for class methods."""
+ # Add encodings for hidden self and cmd arguments.
+ encoding = ensure_bytes(encoding)
+ typecodes = parse_type_encoding(encoding)
+ typecodes.insert(1, b'@:')
+ encoding = b''.join(typecodes)
+ def decorator(f):
+ def objc_class_method(objc_cls, objc_cmd, *args):
+ py_cls = ObjCClass(objc_cls)
+ py_cls.objc_cmd = objc_cmd
+ args = convert_method_arguments(encoding, args)
+ result = f(py_cls, *args)
+ if isinstance(result, ObjCClass):
+ result = result.ptr.value
+ elif isinstance(result, ObjCInstance):
+ result = result.ptr.value
+ return result
+ name = f.__name__.replace('_', ':')
+ self.add_class_method(objc_class_method, name, encoding)
+ return objc_class_method
+ return decorator
+
+######################################################################
+
+# Instances of DeallocationObserver are associated with every
+# Objective-C object that gets wrapped inside an ObjCInstance.
+# Their sole purpose is to watch for when the Objective-C object
+# is deallocated, and then remove the object from the dictionary
+# of cached ObjCInstance objects kept by the ObjCInstance class.
+#
+# The methods of the class defined below are decorated with
+# rawmethod() instead of method() because DeallocationObservers
+# are created inside of ObjCInstance's __new__ method and we have
+# to be careful to not create another ObjCInstance here (which
+# happens when the usual method decorator turns the self argument
+# into an ObjCInstance), or else get trapped in an infinite recursion.
+class DeallocationObserver_Implementation(object):
+ DeallocationObserver = ObjCSubclass('NSObject', 'DeallocationObserver', register=False)
+ DeallocationObserver.add_ivar('observed_object', c_void_p)
+ DeallocationObserver.register()
+
+ @DeallocationObserver.rawmethod('@@')
+ def initWithObject_(self, cmd, anObject):
+ self = send_super(self, 'init')
+ self = self.value
+ set_instance_variable(self, 'observed_object', anObject, c_void_p)
+ return self
+
+ @DeallocationObserver.rawmethod('v')
+ def dealloc(self, cmd):
+ anObject = get_instance_variable(self, 'observed_object', c_void_p)
+ ObjCInstance._cached_objects.pop(anObject, None)
+ send_super(self, 'dealloc')
+
+ @DeallocationObserver.rawmethod('v')
+ def finalize(self, cmd):
+ # Called instead of dealloc if using garbage collection.
+ # (which would have to be explicitly started with
+ # objc_startCollectorThread(), so probably not too much reason
+ # to have this here, but I guess it can't hurt.)
+ anObject = get_instance_variable(self, 'observed_object', c_void_p)
+ ObjCInstance._cached_objects.pop(anObject, None)
+ send_super(self, 'finalize')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/constants.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/constants.py
new file mode 100644
index 0000000..1e8e694
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/constants.py
@@ -0,0 +1,534 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+# CFString.h
+kCFStringEncodingMacRoman = 0
+kCFStringEncodingWindowsLatin1 = 0x0500
+kCFStringEncodingISOLatin1 = 0x0201
+kCFStringEncodingNextStepLatin = 0x0B01
+kCFStringEncodingASCII = 0x0600
+kCFStringEncodingUnicode = 0x0100
+kCFStringEncodingUTF8 = 0x08000100
+kCFStringEncodingNonLossyASCII = 0x0BFF
+
+# MacTypes.h
+noErr = 0
+
+# CarbonEventsCore.h
+eventLoopTimedOutErr = -9875
+eventLoopQuitErr = -9876
+kEventPriorityStandard = 1
+
+# MacApplication.h
+kUIModeNormal = 0
+kUIModeContentSuppressed = 1
+kUIModeContentHidden = 2
+kUIModeAllSuppressed = 4
+kUIModeAllHidden = 3
+kUIOptionAutoShowMenuBar = 1 << 0
+kUIOptionDisableAppleMenu = 1 << 2
+kUIOptionDisableProcessSwitch = 1 << 3
+kUIOptionDisableForceQuit = 1 << 4
+kUIOptionDisableSessionTerminate = 1 << 5
+kUIOptionDisableHide = 1 << 6
+
+# MacWindows.h
+kAlertWindowClass = 1
+kMovableAlertWindowClass = 2
+kModalWindowClass = 3
+kMovableModalWindowClass = 4
+kFloatingWindowClass = 5
+kDocumentWindowClass = 6
+kUtilityWindowClass = 8
+kHelpWindowClass = 10
+kSheetWindowClass = 11
+kToolbarWindowClass = 12
+kPlainWindowClass = 13
+kOverlayWindowClass = 14
+kSheetAlertWindowClass = 15
+kAltPlainWindowClass = 16
+kSimpleWindowClass = 18 # no window frame
+kDrawerWindowClass = 20
+
+kWindowNoAttributes = 0x0
+kWindowCloseBoxAttribute = 0x1
+kWindowHorizontalZoomAttribute = 0x2
+kWindowVerticalZoomAttribute = 0x4
+kWindowFullZoomAttribute = kWindowHorizontalZoomAttribute | \
+ kWindowVerticalZoomAttribute
+kWindowCollapseBoxAttribute = 0x8
+kWindowResizableAttribute = 0x10
+kWindowSideTitlebarAttribute = 0x20
+kWindowToolbarAttribute = 0x40
+kWindowMetalAttribute = 1 << 8
+kWindowDoesNotCycleAttribute = 1 << 15
+kWindowNoupdatesAttribute = 1 << 16
+kWindowNoActivatesAttribute = 1 << 17
+kWindowOpaqueForEventsAttribute = 1 << 18
+kWindowCompositingAttribute = 1 << 19
+kWindowNoShadowAttribute = 1 << 21
+kWindowHideOnSuspendAttribute = 1 << 24
+kWindowAsyncDragAttribute = 1 << 23
+kWindowStandardHandlerAttribute = 1 << 25
+kWindowHideOnFullScreenAttribute = 1 << 26
+kWindowInWindowMenuAttribute = 1 << 27
+kWindowLiveResizeAttribute = 1 << 28
+kWindowIgnoreClicksAttribute = 1 << 29
+kWindowNoConstrainAttribute = 1 << 31
+kWindowStandardDocumentAttributes = kWindowCloseBoxAttribute | \
+ kWindowFullZoomAttribute | \
+ kWindowCollapseBoxAttribute | \
+ kWindowResizableAttribute
+kWindowStandardFloatingAttributes = kWindowCloseBoxAttribute | \
+ kWindowCollapseBoxAttribute
+
+kWindowCenterOnMainScreen = 1
+kWindowCenterOnParentWindow = 2
+kWindowCenterOnParentWindowScreen = 3
+kWindowCascadeOnMainScreen = 4
+kWindowCascadeOnParentWindow = 5
+kWindowCascadeonParentWindowScreen = 6
+kWindowCascadeStartAtParentWindowScreen = 10
+kWindowAlertPositionOnMainScreen = 7
+kWindowAlertPositionOnParentWindow = 8
+kWindowAlertPositionOnParentWindowScreen = 9
+
+
+kWindowTitleBarRgn = 0
+kWindowTitleTextRgn = 1
+kWindowCloseBoxRgn = 2
+kWindowZoomBoxRgn = 3
+kWindowDragRgn = 5
+kWindowGrowRgn = 6
+kWindowCollapseBoxRgn = 7
+kWindowTitleProxyIconRgn = 8
+kWindowStructureRgn = 32
+kWindowContentRgn = 33
+kWindowUpdateRgn = 34
+kWindowOpaqueRgn = 35
+kWindowGlobalPortRgn = 40
+kWindowToolbarButtonRgn = 41
+
+inDesk = 0
+inNoWindow = 0
+inMenuBar = 1
+inSysWindow = 2
+inContent = 3
+inDrag = 4
+inGrow = 5
+inGoAway = 6
+inZoomIn = 7
+inZoomOut = 8
+inCollapseBox = 11
+inProxyIcon = 12
+inToolbarButton = 13
+inStructure = 15
+
+def _name(name):
+ return ord(name[0]) << 24 | \
+ ord(name[1]) << 16 | \
+ ord(name[2]) << 8 | \
+ ord(name[3])
+
+# AEDataModel.h
+
+typeBoolean = _name('bool')
+typeChar = _name('TEXT')
+typeSInt16 = _name('shor')
+typeSInt32 = _name('long')
+typeUInt32 = _name('magn')
+typeSInt64 = _name('comp')
+typeIEEE32BitFloatingPoint = _name('sing')
+typeIEEE64BitFloatingPoint = _name('doub')
+type128BitFloatingPoint = _name('ldbl')
+typeDecimalStruct = _name('decm')
+
+# AERegistry.h
+typeUnicodeText = _name('utxt')
+typeStyledUnicodeText = _name('sutx')
+typeUTF8Text = _name('utf8')
+typeEncodedString = _name('encs')
+typeCString = _name('cstr')
+typePString = _name('pstr')
+typeEventRef = _name('evrf')
+
+# CarbonEvents.h
+
+kEventParamWindowRef = _name('wind')
+kEventParamWindowPartCode = _name('wpar')
+kEventParamGrafPort = _name('graf')
+kEventParamMenuRef = _name('menu')
+kEventParamEventRef = _name('evnt')
+kEventParamControlRef = _name('ctrl')
+kEventParamRgnHandle = _name('rgnh')
+kEventParamEnabled = _name('enab')
+kEventParamDimensions = _name('dims')
+kEventParamBounds = _name('boun')
+kEventParamAvailableBounds = _name('avlb')
+#kEventParamAEEventID = keyAEEventID
+#kEventParamAEEventClass = keyAEEventClass
+kEventParamCGContextRef = _name('cntx')
+kEventParamDeviceDepth = _name('devd')
+kEventParamDeviceColor = _name('devc')
+kEventParamMutableArray = _name('marr')
+kEventParamResult = _name('ansr')
+kEventParamMinimumSize = _name('mnsz')
+kEventParamMaximumSize = _name('mxsz')
+kEventParamAttributes = _name('attr')
+kEventParamReason = _name('why?')
+kEventParamTransactionID = _name('trns')
+kEventParamGDevice = _name('gdev')
+kEventParamIndex = _name('indx')
+kEventParamUserData = _name('usrd')
+kEventParamShape = _name('shap')
+typeWindowRef = _name('wind')
+typeWindowPartCode = _name('wpar')
+typeGrafPtr = _name('graf')
+typeGWorldPtr = _name('gwld')
+typeMenuRef = _name('menu')
+typeControlRef = _name('ctrl')
+typeCollection = _name('cltn')
+typeQDRgnHandle = _name('rgnh')
+typeOSStatus = _name('osst')
+typeCFIndex = _name('cfix')
+typeCGContextRef = _name('cntx')
+typeQDPoint = _name('QDpt')
+typeHICommand = _name('hcmd')
+typeHIPoint = _name('hipt')
+typeHISize = _name('hisz')
+typeHIRect = _name('hirc')
+typeHIShapeRef = _name('shap')
+typeVoidPtr = _name('void')
+typeGDHandle = _name('gdev')
+
+kCoreEventClass = _name('aevt')
+kEventClassMouse = _name('mous')
+kEventClassKeyboard = _name('keyb')
+kEventClassTextInput = _name('text')
+kEventClassApplication = _name('appl')
+kEventClassAppleEvent = _name('eppc')
+kEventClassMenu = _name('menu')
+kEventClassWindow = _name('wind')
+kEventClassControl = _name('cntl')
+kEventClassCommand = _name('cmds')
+kEventClassTablet = _name('tblt')
+kEventClassVolume = _name('vol ')
+kEventClassAppearance = _name('appm')
+kEventClassService = _name('serv')
+kEventClassToolbar = _name('tbar')
+kEventClassToolbarItem = _name('tbit')
+kEventClassToolbarItemView = _name('tbiv')
+kEventClassAccessibility = _name('acce')
+kEventClassSystem = _name('macs')
+kEventClassInk = _name('ink ')
+kEventClassTSMDocumentAccess = _name('tdac')
+
+kEventDurationForever = -1.0
+
+# Appearance.h
+kThemeArrowCursor = 0
+kThemeCopyArrowCursor = 1
+kThemeAliasArrowCursor = 2
+kThemeContextualMenuArrowCursor = 3
+kThemeIBeamCursor = 4
+kThemeCrossCursor = 5
+kThemePlusCursor = 6
+kThemeWatchCursor = 7
+kThemeClosedHandCursor = 8
+kThemeOpenHandCursor = 9
+kThemePointingHandCursor = 10
+kThemeCountingUpHandCursor = 11
+kThemeCountingDownHandCursor = 12
+kThemeCountingUpAndDownHandCursor = 13
+kThemeSpinningCursor = 14
+kThemeResizeLeftCursor = 15
+kThemeResizeRightCursor = 16
+kThemeResizeLeftRightCursor = 17
+kThemeNotAllowedCursor = 18
+kThemeResizeUpCursor = 19
+kThemeResizeDownCursor = 20
+kThemeResizeUpDownCursor = 21
+kThemePoofCursor = 22
+
+# AE
+kEventAppleEvent = 1
+kEventAppQuit = 3
+kAEQuitApplication = _name('quit')
+
+# Commands
+kEventProcessCommand = 1
+kEventParamHICommand = _name('hcmd')
+kEventParamDirectObject = _name('----')
+kHICommandQuit = _name('quit')
+
+# Keyboard
+kEventRawKeyDown = 1
+kEventRawKeyRepeat = 2
+kEventRawKeyUp = 3
+kEventRawKeyModifiersChanged = 4
+kEventHotKeyPressed = 5
+kEventHotKeyReleased = 6
+
+kEventParamKeyCode = _name('kcod')
+kEventParamKeyMacCharCodes = _name('kchr')
+kEventParamKeyModifiers = _name('kmod')
+kEventParamKeyUnicodes = _name('kuni')
+kEventParamKeyboardType = _name('kbdt')
+typeEventHotKeyID = _name('hkid')
+
+activeFlagBit = 0
+btnStateBit = 7
+cmdKeyBit = 8
+shiftKeyBit = 9
+alphaLockBit = 10
+optionKeyBit = 11
+controlKeyBit = 12
+rightShiftKeyBit = 13
+rightOptionKeyBit = 14
+rightControlKeyBit = 15
+numLockBit = 16
+
+activeFlag = 1 << activeFlagBit
+btnState = 1 << btnStateBit
+cmdKey = 1 << cmdKeyBit
+shiftKey = 1 << shiftKeyBit
+alphaLock = 1 << alphaLockBit
+optionKey = 1 << optionKeyBit
+controlKey = 1 << controlKeyBit
+rightShiftKey = 1 << rightShiftKeyBit
+rightOptionKey = 1 << rightOptionKeyBit
+rightControlKey = 1 << rightControlKeyBit
+numLock = 1 << numLockBit
+
+# TextInput
+kEventTextInputUpdateActiveInputArea = 1
+kEventTextInputUnicodeForKeyEvent = 2
+kEventTextInputOffsetToPos = 3
+kEventTextInputPosToOffset = 4
+kEventTextInputShowHideBottomWindow = 5
+kEventTextInputGetSelectedText = 6
+kEventTextInputUnicodeText = 7
+
+kEventParamTextInputSendText = _name('tstx')
+kEventParamTextInputSendKeyboardEvent = _name('tske')
+
+# Mouse
+kEventMouseDown = 1
+kEventMouseUp = 2
+kEventMouseMoved = 5
+kEventMouseDragged = 6
+kEventMouseEntered = 8
+kEventMouseExited = 9
+kEventMouseWheelMoved = 10
+kEventParamMouseLocation = _name('mloc')
+kEventParamWindowMouseLocation = _name('wmou')
+kEventParamMouseButton = _name('mbtn')
+kEventParamClickCount = _name('ccnt')
+kEventParamMouseWheelAxis = _name('mwax')
+kEventParamMouseWheelDelta = _name('mwdl')
+kEventParamMouseDelta = _name('mdta')
+kEventParamMouseChord = _name('chor')
+kEventParamTabletEventType = _name('tblt')
+kEventParamMouseTrackingRef = _name('mtrf')
+typeMouseButton = _name('mbtn')
+typeMouseWheelAxis = _name('mwax')
+typeMouseTrackingRef = _name('mtrf')
+
+kMouseTrackingOptionsLocalClip = 0
+kMouseTrackingOptionsGlobalClip = 1
+
+kEventMouseButtonPrimary = 1
+kEventMouseButtonSecondary = 2
+kEventMouseButtonTertiary = 3
+
+kEventMouseWheelAxisX = 0
+kEventMouseWheelAxisY = 1
+
+DEFAULT_CREATOR_CODE = _name('PYGL') # this is registered for Pyglet
+ # apps. register your own at:
+ # http://developer.apple.com/datatype
+
+# Window
+kEventWindowUpdate = 1
+kEventWindowDrawContent = 2
+
+# -- window activation events --
+
+kEventWindowActivated = 5
+kEventWindowDeactivated = 6
+kEventWindowHandleActivate = 91
+kEventWindowHandleDeactivate = 92
+kEventWindowGetClickActivation = 7
+kEventWindowGetClickModality = 8
+
+# -- window state change events --
+
+kEventWindowShowing = 22
+kEventWindowHiding = 23
+kEventWindowShown = 24
+kEventWindowHidden = 25
+kEventWindowCollapsing = 86
+kEventWindowCollapsed = 67
+kEventWindowExpanding = 87
+kEventWindowExpanded = 70
+kEventWindowZoomed = 76
+kEventWindowBoundsChanging = 26
+kEventWindowBoundsChanged = 27
+kEventWindowResizeStarted = 28
+kEventWindowResizeCompleted = 29
+kEventWindowDragStarted = 30
+kEventWindowDragCompleted = 31
+kEventWindowClosed = 73
+kEventWindowTransitionStarted = 88
+kEventWindowTransitionCompleted = 89
+
+# -- window click events --
+
+kEventWindowClickDragRgn = 32
+kEventWindowClickResizeRgn = 33
+kEventWindowClickCollapseRgn = 34
+kEventWindowClickCloseRgn = 35
+kEventWindowClickZoomRgn = 36
+kEventWindowClickContentRgn = 37
+kEventWindowClickProxyIconRgn = 38
+kEventWindowClickToolbarButtonRgn = 41
+kEventWindowClickStructureRgn = 42
+
+# -- window cursor change events --
+
+kEventWindowCursorChange = 40
+
+# -- window action events --
+
+kEventWindowCollapse = 66
+kEventWindowCollapsed = 67
+kEventWindowCollapseAll = 68
+kEventWindowExpand = 69
+kEventWindowExpanded = 70
+kEventWindowExpandAll = 71
+kEventWindowClose = 72
+kEventWindowClosed = 73
+kEventWindowCloseAll = 74
+kEventWindowZoom = 75
+kEventWindowZoomed = 76
+kEventWindowZoomAll = 77
+kEventWindowContextualMenuSelect = 78
+kEventWindowPathSelect = 79
+kEventWindowGetIdealSize = 80
+kEventWindowGetMinimumSize = 81
+kEventWindowGetMaximumSize = 82
+kEventWindowConstrain = 83
+kEventWindowHandleContentClick = 85
+kEventWindowCollapsing = 86
+kEventWindowExpanding = 87
+kEventWindowTransitionStarted = 88
+kEventWindowTransitionCompleted = 89
+kEventWindowGetDockTileMenu = 90
+kEventWindowHandleActivate = 91
+kEventWindowHandleDeactivate = 92
+kEventWindowProxyBeginDrag = 128
+kEventWindowProxyEndDrag = 129
+kEventWindowToolbarSwitchMode = 150
+
+# -- window focus events --
+
+kEventWindowFocusAcquired = 200
+kEventWindowFocusRelinquish = 201
+kEventWindowFocusContent = 202
+kEventWindowFocusToolbar = 203
+kEventWindowFocusDrawer = 204
+
+# -- sheet events --
+
+kEventWindowSheetOpening = 210
+kEventWindowSheetOpened = 211
+kEventWindowSheetClosing = 212
+kEventWindowSheetClosed = 213
+
+# -- drawer events --
+
+kEventWindowDrawerOpening = 220
+kEventWindowDrawerOpened = 221
+kEventWindowDrawerClosing = 222
+kEventWindowDrawerClosed = 223
+
+# -- window definition events --
+
+kEventWindowDrawFrame = 1000
+kEventWindowDrawPart = 1001
+kEventWindowGetRegion = 1002
+kEventWindowHitTest = 1003
+kEventWindowInit = 1004
+kEventWindowDispose = 1005
+kEventWindowDragHilite = 1006
+kEventWindowModified = 1007
+kEventWindowSetupProxyDragImage = 1008
+kEventWindowStateChanged = 1009
+kEventWindowMeasureTitle = 1010
+kEventWindowDrawGrowBox = 1011
+kEventWindowGetGrowImageRegion = 1012
+kEventWindowPaint = 1013
+
+# Process.h
+
+kNoProcess = 0
+kSystemProcess = 1
+kCurrentProcess = 2
+
+# CGColorSpace.h
+kCGRenderingIntentDefault = 0
+
+# CGImage.h
+kCGImageAlphaNone = 0
+kCGImageAlphaPremultipliedLast = 1
+kCGImageAlphaPremultipliedFirst = 2
+kCGImageAlphaLast = 3
+kCGImageAlphaFirst = 4
+kCGImageAlphaNoneSkipLast = 5
+kCGImageAlphaNoneSkipFirst = 6
+kCGImageAlphaOnly = 7
+
+# Tablet
+kEventTabletPoint = 1
+kEventTabletProximity = 2
+kEventParamTabletPointRec = _name('tbrc')
+kEventParamTabletProximityRec = _name('tbpx')
+typeTabletPointRec = _name('tbrc')
+typeTabletProximityRec = _name('tbpx')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/quartzkey.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/quartzkey.py
new file mode 100644
index 0000000..e9d30d9
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/quartzkey.py
@@ -0,0 +1,349 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = ''
+
+from pyglet.window import key
+
+# From SDL: src/video/quartz/SDL_QuartzKeys.h
+# These are the Macintosh key scancode constants -- from Inside Macintosh
+# http://boredzo.org/blog/wp-content/uploads/2007/05/imtx-virtual-keycodes.png
+# Renamed QZ_RALT, QZ_LALT to QZ_ROPTION, QZ_LOPTION
+# and QZ_RMETA, QZ_LMETA to QZ_RCOMMAND, QZ_LCOMMAND.
+#
+# See also:
+# /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Headers/Events.h
+
+QZ_ESCAPE = 0x35
+QZ_F1 = 0x7A
+QZ_F2 = 0x78
+QZ_F3 = 0x63
+QZ_F4 = 0x76
+QZ_F5 = 0x60
+QZ_F6 = 0x61
+QZ_F7 = 0x62
+QZ_F8 = 0x64
+QZ_F9 = 0x65
+QZ_F10 = 0x6D
+QZ_F11 = 0x67
+QZ_F12 = 0x6F
+QZ_F13 = 0x69
+QZ_F14 = 0x6B
+QZ_F15 = 0x71
+QZ_F16 = 0x6A
+QZ_F17 = 0x40
+QZ_F18 = 0x4F
+QZ_F19 = 0x50
+QZ_F20 = 0x5A
+QZ_BACKQUOTE = 0x32
+QZ_1 = 0x12
+QZ_2 = 0x13
+QZ_3 = 0x14
+QZ_4 = 0x15
+QZ_5 = 0x17
+QZ_6 = 0x16
+QZ_7 = 0x1A
+QZ_8 = 0x1C
+QZ_9 = 0x19
+QZ_0 = 0x1D
+QZ_MINUS = 0x1B
+QZ_EQUALS = 0x18
+QZ_BACKSPACE = 0x33
+QZ_INSERT = 0x72
+QZ_HOME = 0x73
+QZ_PAGEUP = 0x74
+QZ_NUMLOCK = 0x47
+QZ_KP_EQUALS = 0x51
+QZ_KP_DIVIDE = 0x4B
+QZ_KP_MULTIPLY = 0x43
+QZ_TAB = 0x30
+QZ_q = 0x0C
+QZ_w = 0x0D
+QZ_e = 0x0E
+QZ_r = 0x0F
+QZ_t = 0x11
+QZ_y = 0x10
+QZ_u = 0x20
+QZ_i = 0x22
+QZ_o = 0x1F
+QZ_p = 0x23
+QZ_LEFTBRACKET = 0x21
+QZ_RIGHTBRACKET = 0x1E
+QZ_BACKSLASH = 0x2A
+QZ_DELETE = 0x75
+QZ_END = 0x77
+QZ_PAGEDOWN = 0x79
+QZ_KP7 = 0x59
+QZ_KP8 = 0x5B
+QZ_KP9 = 0x5C
+QZ_KP_MINUS = 0x4E
+QZ_CAPSLOCK = 0x39
+QZ_a = 0x00
+QZ_s = 0x01
+QZ_d = 0x02
+QZ_f = 0x03
+QZ_g = 0x05
+QZ_h = 0x04
+QZ_j = 0x26
+QZ_k = 0x28
+QZ_l = 0x25
+QZ_SEMICOLON = 0x29
+QZ_QUOTE = 0x27
+QZ_RETURN = 0x24
+QZ_KP4 = 0x56
+QZ_KP5 = 0x57
+QZ_KP6 = 0x58
+QZ_KP_PLUS = 0x45
+QZ_LSHIFT = 0x38
+QZ_z = 0x06
+QZ_x = 0x07
+QZ_c = 0x08
+QZ_v = 0x09
+QZ_b = 0x0B
+QZ_n = 0x2D
+QZ_m = 0x2E
+QZ_COMMA = 0x2B
+QZ_PERIOD = 0x2F
+QZ_SLASH = 0x2C
+QZ_RSHIFT = 0x3C
+QZ_UP = 0x7E
+QZ_KP1 = 0x53
+QZ_KP2 = 0x54
+QZ_KP3 = 0x55
+QZ_KP_ENTER = 0x4C
+QZ_LCTRL = 0x3B
+QZ_LOPTION = 0x3A
+QZ_LCOMMAND = 0x37
+QZ_SPACE = 0x31
+QZ_RCOMMAND = 0x36
+QZ_ROPTION = 0x3D
+QZ_RCTRL = 0x3E
+QZ_FUNCTION = 0x3F
+QZ_LEFT = 0x7B
+QZ_DOWN = 0x7D
+QZ_RIGHT = 0x7C
+QZ_KP0 = 0x52
+QZ_KP_PERIOD = 0x41
+
+keymap = {
+ QZ_ESCAPE: key.ESCAPE,
+ QZ_F1: key.F1,
+ QZ_F2: key.F2,
+ QZ_F3: key.F3,
+ QZ_F4: key.F4,
+ QZ_F5: key.F5,
+ QZ_F6: key.F6,
+ QZ_F7: key.F7,
+ QZ_F8: key.F8,
+ QZ_F9: key.F9,
+ QZ_F10: key.F10,
+ QZ_F11: key.F11,
+ QZ_F12: key.F12,
+ QZ_F13: key.F13,
+ QZ_F14: key.F14,
+ QZ_F15: key.F15,
+ QZ_F16: key.F16,
+ QZ_F17: key.F17,
+ QZ_F18: key.F18,
+ QZ_F19: key.F19,
+ QZ_F20: key.F20,
+ QZ_BACKQUOTE: key.QUOTELEFT,
+ QZ_1: key._1,
+ QZ_2: key._2,
+ QZ_3: key._3,
+ QZ_4: key._4,
+ QZ_5: key._5,
+ QZ_6: key._6,
+ QZ_7: key._7,
+ QZ_8: key._8,
+ QZ_9: key._9,
+ QZ_0: key._0,
+ QZ_MINUS: key.MINUS,
+ QZ_EQUALS: key.EQUAL,
+ QZ_BACKSPACE: key.BACKSPACE,
+ QZ_INSERT: key.INSERT,
+ QZ_HOME: key.HOME,
+ QZ_PAGEUP: key.PAGEUP,
+ QZ_NUMLOCK: key.NUMLOCK,
+ QZ_KP_EQUALS: key.NUM_EQUAL,
+ QZ_KP_DIVIDE: key.NUM_DIVIDE,
+ QZ_KP_MULTIPLY: key.NUM_MULTIPLY,
+ QZ_TAB: key.TAB,
+ QZ_q: key.Q,
+ QZ_w: key.W,
+ QZ_e: key.E,
+ QZ_r: key.R,
+ QZ_t: key.T,
+ QZ_y: key.Y,
+ QZ_u: key.U,
+ QZ_i: key.I,
+ QZ_o: key.O,
+ QZ_p: key.P,
+ QZ_LEFTBRACKET: key.BRACKETLEFT,
+ QZ_RIGHTBRACKET: key.BRACKETRIGHT,
+ QZ_BACKSLASH: key.BACKSLASH,
+ QZ_DELETE: key.DELETE,
+ QZ_END: key.END,
+ QZ_PAGEDOWN: key.PAGEDOWN,
+ QZ_KP7: key.NUM_7,
+ QZ_KP8: key.NUM_8,
+ QZ_KP9: key.NUM_9,
+ QZ_KP_MINUS: key.NUM_SUBTRACT,
+ QZ_CAPSLOCK: key.CAPSLOCK,
+ QZ_a: key.A,
+ QZ_s: key.S,
+ QZ_d: key.D,
+ QZ_f: key.F,
+ QZ_g: key.G,
+ QZ_h: key.H,
+ QZ_j: key.J,
+ QZ_k: key.K,
+ QZ_l: key.L,
+ QZ_SEMICOLON: key.SEMICOLON,
+ QZ_QUOTE: key.APOSTROPHE,
+ QZ_RETURN: key.RETURN,
+ QZ_KP4: key.NUM_4,
+ QZ_KP5: key.NUM_5,
+ QZ_KP6: key.NUM_6,
+ QZ_KP_PLUS: key.NUM_ADD,
+ QZ_LSHIFT: key.LSHIFT,
+ QZ_z: key.Z,
+ QZ_x: key.X,
+ QZ_c: key.C,
+ QZ_v: key.V,
+ QZ_b: key.B,
+ QZ_n: key.N,
+ QZ_m: key.M,
+ QZ_COMMA: key.COMMA,
+ QZ_PERIOD: key.PERIOD,
+ QZ_SLASH: key.SLASH,
+ QZ_RSHIFT: key.RSHIFT,
+ QZ_UP: key.UP,
+ QZ_KP1: key.NUM_1,
+ QZ_KP2: key.NUM_2,
+ QZ_KP3: key.NUM_3,
+ QZ_KP_ENTER: key.NUM_ENTER,
+ QZ_LCTRL: key.LCTRL,
+ QZ_LOPTION: key.LOPTION,
+ QZ_LCOMMAND: key.LCOMMAND,
+ QZ_SPACE: key.SPACE,
+ QZ_RCOMMAND: key.RCOMMAND,
+ QZ_ROPTION: key.ROPTION,
+ QZ_RCTRL: key.RCTRL,
+ QZ_FUNCTION: key.FUNCTION,
+ QZ_LEFT: key.LEFT,
+ QZ_DOWN: key.DOWN,
+ QZ_RIGHT: key.RIGHT,
+ QZ_KP0: key.NUM_0,
+ QZ_KP_PERIOD: key.NUM_DECIMAL,
+}
+
+
+charmap = {
+ ' ' : key.SPACE,
+ '!' : key.EXCLAMATION,
+ '"' : key.DOUBLEQUOTE,
+ '#' : key.HASH,
+ '#' : key.POUND,
+ '$' : key.DOLLAR,
+ '%' : key.PERCENT,
+ '&' : key.AMPERSAND,
+ "'" : key.APOSTROPHE,
+ '(' : key.PARENLEFT,
+ ')' : key.PARENRIGHT,
+ '*' : key.ASTERISK,
+ '+' : key.PLUS,
+ ',' : key.COMMA,
+ '-' : key.MINUS,
+ '.' : key.PERIOD,
+ '/' : key.SLASH,
+ '0' : key._0,
+ '1' : key._1,
+ '2' : key._2,
+ '3' : key._3,
+ '4' : key._4,
+ '5' : key._5,
+ '6' : key._6,
+ '7' : key._7,
+ '8' : key._8,
+ '9' : key._9,
+ ':' : key.COLON,
+ ';' : key.SEMICOLON,
+ '<' : key.LESS,
+ '=' : key.EQUAL,
+ '>' : key.GREATER,
+ '?' : key.QUESTION,
+ '@' : key.AT,
+ '[' : key.BRACKETLEFT,
+ '\\' : key.BACKSLASH,
+ ']' : key.BRACKETRIGHT,
+ '^' : key.ASCIICIRCUM,
+ '_' : key.UNDERSCORE,
+ '`' : key.GRAVE,
+ '`' : key.QUOTELEFT,
+ 'A' : key.A,
+ 'B' : key.B,
+ 'C' : key.C,
+ 'D' : key.D,
+ 'E' : key.E,
+ 'F' : key.F,
+ 'G' : key.G,
+ 'H' : key.H,
+ 'I' : key.I,
+ 'J' : key.J,
+ 'K' : key.K,
+ 'L' : key.L,
+ 'M' : key.M,
+ 'N' : key.N,
+ 'O' : key.O,
+ 'P' : key.P,
+ 'Q' : key.Q,
+ 'R' : key.R,
+ 'S' : key.S,
+ 'T' : key.T,
+ 'U' : key.U,
+ 'V' : key.V,
+ 'W' : key.W,
+ 'X' : key.X,
+ 'Y' : key.Y,
+ 'Z' : key.Z,
+ '{' : key.BRACELEFT,
+ '|' : key.BAR,
+ '}' : key.BRACERIGHT,
+ '~' : key.ASCIITILDE
+}
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/types.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/types.py
new file mode 100644
index 0000000..2f2e87e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/darwin/types.py
@@ -0,0 +1,193 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+from ctypes import *
+
+Boolean = c_ubyte # actually an unsigned char
+Fixed = c_int32
+ItemCount = c_uint32
+ByteOffset = ByteCount = c_uint32
+
+class Rect(Structure):
+ _fields_ = [
+ ('top', c_short),
+ ('left', c_short),
+ ('bottom', c_short),
+ ('right', c_short)
+ ]
+
+class Point(Structure):
+ _fields_ = [
+ ('v', c_short),
+ ('h', c_short),
+ ]
+
+class CGPoint(Structure):
+ _fields_ = [
+ ('x', c_float),
+ ('y', c_float),
+ ]
+
+class CGSize(Structure):
+ _fields_ = [
+ ('width', c_float),
+ ('height', c_float)
+ ]
+
+class CGRect(Structure):
+ _fields_ = [
+ ('origin', CGPoint),
+ ('size', CGSize)
+ ]
+ __slots__ = ['origin', 'size']
+
+CGDirectDisplayID = c_void_p
+CGDisplayCount = c_uint32
+CGTableCount = c_uint32
+CGDisplayCoord = c_int32
+CGByteValue = c_ubyte
+CGOpenGLDisplayMask = c_uint32
+CGRefreshRate = c_double
+CGCaptureOptions = c_uint32
+
+HIPoint = CGPoint
+HISize = CGSize
+HIRect = CGRect
+
+class EventTypeSpec(Structure):
+ _fields_ = [
+ ('eventClass', c_uint32),
+ ('eventKind', c_uint32)
+ ]
+
+WindowRef = c_void_p
+EventRef = c_void_p
+EventTargetRef = c_void_p
+EventHandlerRef = c_void_p
+
+MenuRef = c_void_p
+MenuID = c_int16
+MenuItemIndex = c_uint16
+MenuCommand = c_uint32
+
+CFStringEncoding = c_uint
+WindowClass = c_uint32
+WindowAttributes = c_uint32
+WindowPositionMethod = c_uint32
+EventMouseButton = c_uint16
+EventMouseWheelAxis = c_uint16
+
+OSType = c_uint32
+OSStatus = c_int32
+
+
+class MouseTrackingRegionID(Structure):
+ _fields_ = [('signature', OSType),
+ ('id', c_int32)]
+
+MouseTrackingRef = c_void_p
+
+RgnHandle = c_void_p
+
+class ProcessSerialNumber(Structure):
+ _fields_ = [('highLongOfPSN', c_uint32),
+ ('lowLongOfPSN', c_uint32)]
+
+
+class HICommand_Menu(Structure):
+ _fields_ = [
+ ('menuRef', MenuRef),
+ ('menuItemIndex', MenuItemIndex),
+ ]
+
+class HICommand(Structure):
+ _fields_ = [
+ ('attributes', c_uint32),
+ ('commandID', c_uint32),
+ ('menu', HICommand_Menu)
+ ]
+
+class EventRecord(Structure):
+ _fields_ = [
+ ('what', c_uint16),
+ ('message', c_uint32),
+ ('when', c_uint32),
+ ('where', Point),
+ ('modifiers', c_uint16)
+ ]
+
+class RGBColor(Structure):
+ _fields_ = [
+ ('red', c_ushort),
+ ('green', c_ushort),
+ ('blue', c_ushort)
+ ]
+
+class TabletProximityRec(Structure):
+ _fields_ = (
+ ('vendorID', c_uint16),
+ ('tabletID', c_uint16),
+ ('pointerID', c_uint16),
+ ('deviceID', c_uint16),
+ ('systemTabletID', c_uint16),
+ ('vendorPointerType', c_uint16),
+ ('pointerSerialNumber', c_uint32),
+ ('uniqueID', c_uint64),
+ ('capabilityMask', c_uint32),
+ ('pointerType', c_uint8),
+ ('enterProximity', c_uint8),
+ )
+
+class TabletPointRec(Structure):
+ _fields_ = (
+ ('absX', c_int32),
+ ('absY', c_int32),
+ ('absZ', c_int32),
+ ('buttons', c_uint16),
+ ('pressure', c_uint16),
+ ('tiltX', c_int16),
+ ('tiltY', c_int16),
+ ('rotation', c_uint16),
+ ('tangentialPressure', c_int16),
+ ('deviceID', c_uint16),
+ ('vendor1', c_int16),
+ ('vendor2', c_int16),
+ ('vendor3', c_int16),
+ )
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/win32/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/win32/__init__.py
new file mode 100644
index 0000000..a61455e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/win32/__init__.py
@@ -0,0 +1,232 @@
+#!/usr/bin/python
+# $Id: $
+
+from __future__ import print_function
+from __future__ import absolute_import
+from builtins import object
+import struct
+from ctypes import *
+
+import pyglet
+from . import constants
+from .types import *
+
+IS64 = struct.calcsize("P") == 8
+
+_debug_win32 = pyglet.options['debug_win32']
+
+if _debug_win32:
+ import traceback
+ _GetLastError = windll.kernel32.GetLastError
+ _SetLastError = windll.kernel32.SetLastError
+ _FormatMessageA = windll.kernel32.FormatMessageA
+
+ _log_win32 = open('debug_win32.log', 'w')
+
+ def format_error(err):
+ msg = create_string_buffer(256)
+ _FormatMessageA(constants.FORMAT_MESSAGE_FROM_SYSTEM,
+ c_void_p(),
+ err,
+ 0,
+ msg,
+ len(msg),
+ c_void_p())
+ return msg.value
+
+ class DebugLibrary(object):
+ def __init__(self, lib):
+ self.lib = lib
+
+ def __getattr__(self, name):
+ fn = getattr(self.lib, name)
+ def f(*args):
+ _SetLastError(0)
+ result = fn(*args)
+ err = _GetLastError()
+ if err != 0:
+ for entry in traceback.format_list(traceback.extract_stack()[:-1]):
+ _log_win32.write(entry)
+ print(format_error(err), file=_log_win32)
+ return result
+ return f
+else:
+ DebugLibrary = lambda lib: lib
+
+
+_gdi32 = DebugLibrary(windll.gdi32)
+_kernel32 = DebugLibrary(windll.kernel32)
+_user32 = DebugLibrary(windll.user32)
+
+# _gdi32
+_gdi32.AddFontMemResourceEx.restype = HANDLE
+_gdi32.AddFontMemResourceEx.argtypes = [PVOID, DWORD, PVOID, POINTER(DWORD)]
+_gdi32.ChoosePixelFormat.restype = c_int
+_gdi32.ChoosePixelFormat.argtypes = [HDC, POINTER(PIXELFORMATDESCRIPTOR)]
+_gdi32.CreateBitmap.restype = HBITMAP
+_gdi32.CreateBitmap.argtypes = [c_int, c_int, UINT, UINT, c_void_p]
+_gdi32.CreateCompatibleDC.restype = HDC
+_gdi32.CreateCompatibleDC.argtypes = [HDC]
+_gdi32.CreateDIBitmap.restype = HBITMAP
+_gdi32.CreateDIBitmap.argtypes = [HDC, POINTER(BITMAPINFOHEADER), DWORD, c_void_p, POINTER(BITMAPINFO), UINT]
+_gdi32.CreateDIBSection.restype = HBITMAP
+_gdi32.CreateDIBSection.argtypes = [HDC, c_void_p, UINT, c_void_p, HANDLE, DWORD] # POINTER(BITMAPINFO)
+_gdi32.CreateFontIndirectA.restype = HFONT
+_gdi32.CreateFontIndirectA.argtypes = [POINTER(LOGFONT)]
+_gdi32.DeleteDC.restype = BOOL
+_gdi32.DeleteDC.argtypes = [HDC]
+_gdi32.DeleteObject.restype = BOOL
+_gdi32.DeleteObject.argtypes = [HGDIOBJ]
+_gdi32.DescribePixelFormat.restype = c_int
+_gdi32.DescribePixelFormat.argtypes = [HDC, c_int, UINT, POINTER(PIXELFORMATDESCRIPTOR)]
+_gdi32.ExtTextOutA.restype = BOOL
+_gdi32.ExtTextOutA.argtypes = [HDC, c_int, c_int, UINT, LPRECT, c_char_p, UINT, POINTER(INT)]
+_gdi32.GdiFlush.restype = BOOL
+_gdi32.GdiFlush.argtypes = []
+_gdi32.GetCharABCWidthsW.restype = BOOL
+_gdi32.GetCharABCWidthsW.argtypes = [HDC, UINT, UINT, POINTER(ABC)]
+_gdi32.GetCharWidth32W.restype = BOOL
+_gdi32.GetCharWidth32W.argtypes = [HDC, UINT, UINT, POINTER(INT)]
+_gdi32.GetStockObject.restype = HGDIOBJ
+_gdi32.GetStockObject.argtypes = [c_int]
+_gdi32.GetTextMetricsA.restype = BOOL
+_gdi32.GetTextMetricsA.argtypes = [HDC, POINTER(TEXTMETRIC)]
+_gdi32.SelectObject.restype = HGDIOBJ
+_gdi32.SelectObject.argtypes = [HDC, HGDIOBJ]
+_gdi32.SetBkColor.restype = COLORREF
+_gdi32.SetBkColor.argtypes = [HDC, COLORREF]
+_gdi32.SetBkMode.restype = c_int
+_gdi32.SetBkMode.argtypes = [HDC, c_int]
+_gdi32.SetPixelFormat.restype = BOOL
+_gdi32.SetPixelFormat.argtypes = [HDC, c_int, POINTER(PIXELFORMATDESCRIPTOR)]
+_gdi32.SetTextColor.restype = COLORREF
+_gdi32.SetTextColor.argtypes = [HDC, COLORREF]
+
+_kernel32.CloseHandle.restype = BOOL
+_kernel32.CloseHandle.argtypes = [HANDLE]
+_kernel32.CreateEventW.restype = HANDLE
+_kernel32.CreateEventW.argtypes = [POINTER(SECURITY_ATTRIBUTES), BOOL, BOOL, c_wchar_p]
+_kernel32.CreateWaitableTimerA.restype = HANDLE
+_kernel32.CreateWaitableTimerA.argtypes = [POINTER(SECURITY_ATTRIBUTES), BOOL, c_char_p]
+_kernel32.GetCurrentThreadId.restype = DWORD
+_kernel32.GetCurrentThreadId.argtypes = []
+_kernel32.GetModuleHandleW.restype = HMODULE
+_kernel32.GetModuleHandleW.argtypes = [c_wchar_p]
+_kernel32.GlobalAlloc.restype = HGLOBAL
+_kernel32.GlobalAlloc.argtypes = [UINT, c_size_t]
+_kernel32.GlobalLock.restype = LPVOID
+_kernel32.GlobalLock.argtypes = [HGLOBAL]
+_kernel32.GlobalUnlock.restype = BOOL
+_kernel32.GlobalUnlock.argtypes = [HGLOBAL]
+_kernel32.SetLastError.restype = DWORD
+_kernel32.SetLastError.argtypes = []
+_kernel32.SetWaitableTimer.restype = BOOL
+_kernel32.SetWaitableTimer.argtypes = [HANDLE, POINTER(LARGE_INTEGER), LONG, LPVOID, LPVOID, BOOL] # TIMERAPCPROC
+_kernel32.WaitForSingleObject.restype = DWORD
+_kernel32.WaitForSingleObject.argtypes = [HANDLE, DWORD]
+
+_user32.AdjustWindowRectEx.restype = BOOL
+_user32.AdjustWindowRectEx.argtypes = [LPRECT, DWORD, BOOL, DWORD]
+_user32.ChangeDisplaySettingsExW.restype = LONG
+_user32.ChangeDisplaySettingsExW.argtypes = [c_wchar_p, POINTER(DEVMODE), HWND, DWORD, LPVOID]
+_user32.ClientToScreen.restype = BOOL
+_user32.ClientToScreen.argtypes = [HWND, LPPOINT]
+_user32.ClipCursor.restype = BOOL
+_user32.ClipCursor.argtypes = [LPRECT]
+_user32.CreateIconIndirect.restype = HICON
+_user32.CreateIconIndirect.argtypes = [POINTER(ICONINFO)]
+_user32.CreateWindowExW.restype = HWND
+_user32.CreateWindowExW.argtypes = [DWORD, c_wchar_p, c_wchar_p, DWORD, c_int, c_int, c_int, c_int, HWND, HMENU, HINSTANCE, LPVOID]
+_user32.DefWindowProcW.restype = LRESULT
+_user32.DefWindowProcW.argtypes = [HWND, UINT, WPARAM, LPARAM]
+_user32.DestroyWindow.restype = BOOL
+_user32.DestroyWindow.argtypes = [HWND]
+_user32.DispatchMessageW.restype = LRESULT
+_user32.DispatchMessageW.argtypes = [LPMSG]
+_user32.EnumDisplayMonitors.restype = BOOL
+_user32.EnumDisplayMonitors.argtypes = [HDC, LPRECT, MONITORENUMPROC, LPARAM]
+_user32.EnumDisplaySettingsW.restype = BOOL
+_user32.EnumDisplaySettingsW.argtypes = [c_wchar_p, DWORD, POINTER(DEVMODE)]
+_user32.FillRect.restype = c_int
+_user32.FillRect.argtypes = [HDC, LPRECT, HBRUSH]
+_user32.GetClientRect.restype = BOOL
+_user32.GetClientRect.argtypes = [HWND, LPRECT]
+_user32.GetCursorPos.restype = BOOL
+_user32.GetCursorPos.argtypes = [LPPOINT]
+# workaround for win 64-bit, see issue #664
+_user32.GetDC.restype = c_void_p # HDC
+_user32.GetDC.argtypes = [c_void_p] # [HWND]
+_user32.GetDesktopWindow.restype = HWND
+_user32.GetDesktopWindow.argtypes = []
+_user32.GetKeyState.restype = c_short
+_user32.GetKeyState.argtypes = [c_int]
+_user32.GetMessageW.restype = BOOL
+_user32.GetMessageW.argtypes = [LPMSG, HWND, UINT, UINT]
+_user32.GetMonitorInfoW.restype = BOOL
+_user32.GetMonitorInfoW.argtypes = [HMONITOR, POINTER(MONITORINFOEX)]
+_user32.GetQueueStatus.restype = DWORD
+_user32.GetQueueStatus.argtypes = [UINT]
+_user32.GetSystemMetrics.restype = c_int
+_user32.GetSystemMetrics.argtypes = [c_int]
+_user32.LoadCursorW.restype = HCURSOR
+_user32.LoadCursorW.argtypes = [HINSTANCE, c_wchar_p]
+_user32.LoadIconW.restype = HICON
+_user32.LoadIconW.argtypes = [HINSTANCE, c_wchar_p]
+_user32.MapVirtualKeyW.restype = UINT
+_user32.MapVirtualKeyW.argtypes = [UINT, UINT]
+_user32.MapWindowPoints.restype = c_int
+_user32.MapWindowPoints.argtypes = [HWND, HWND, c_void_p, UINT] # HWND, HWND, LPPOINT, UINT
+_user32.MsgWaitForMultipleObjects.restype = DWORD
+_user32.MsgWaitForMultipleObjects.argtypes = [DWORD, POINTER(HANDLE), BOOL, DWORD, DWORD]
+_user32.PeekMessageW.restype = BOOL
+_user32.PeekMessageW.argtypes = [LPMSG, HWND, UINT, UINT, UINT]
+_user32.PostThreadMessageW.restype = BOOL
+_user32.PostThreadMessageW.argtypes = [DWORD, UINT, WPARAM, LPARAM]
+_user32.RegisterClassW.restype = ATOM
+_user32.RegisterClassW.argtypes = [POINTER(WNDCLASS)]
+_user32.RegisterHotKey.restype = BOOL
+_user32.RegisterHotKey.argtypes = [HWND, c_int, UINT, UINT]
+_user32.ReleaseCapture.restype = BOOL
+_user32.ReleaseCapture.argtypes = []
+# workaround for win 64-bit, see issue #664
+_user32.ReleaseDC.restype = c_int32 # c_int
+_user32.ReleaseDC.argtypes = [c_void_p, c_void_p] # [HWND, HDC]
+_user32.ScreenToClient.restype = BOOL
+_user32.ScreenToClient.argtypes = [HWND, LPPOINT]
+_user32.SetCapture.restype = HWND
+_user32.SetCapture.argtypes = [HWND]
+_user32.SetClassLongW.restype = DWORD
+_user32.SetClassLongW.argtypes = [HWND, c_int, LONG]
+if IS64:
+ _user32.SetClassLongPtrW.restype = ULONG
+ _user32.SetClassLongPtrW.argtypes = [HWND, c_int, LONG_PTR]
+else:
+ _user32.SetClassLongPtrW = _user32.SetClassLongW
+_user32.SetCursor.restype = HCURSOR
+_user32.SetCursor.argtypes = [HCURSOR]
+_user32.SetCursorPos.restype = BOOL
+_user32.SetCursorPos.argtypes = [c_int, c_int]
+_user32.SetFocus.restype = HWND
+_user32.SetFocus.argtypes = [HWND]
+_user32.SetForegroundWindow.restype = BOOL
+_user32.SetForegroundWindow.argtypes = [HWND]
+_user32.SetTimer.restype = UINT_PTR
+_user32.SetTimer.argtypes = [HWND, UINT_PTR, UINT, TIMERPROC]
+_user32.SetWindowLongW.restype = LONG
+_user32.SetWindowLongW.argtypes = [HWND, c_int, LONG]
+_user32.SetWindowPos.restype = BOOL
+_user32.SetWindowPos.argtypes = [HWND, HWND, c_int, c_int, c_int, c_int, UINT]
+_user32.SetWindowTextW.restype = BOOL
+_user32.SetWindowTextW.argtypes = [HWND, c_wchar_p]
+_user32.ShowCursor.restype = c_int
+_user32.ShowCursor.argtypes = [BOOL]
+_user32.ShowWindow.restype = BOOL
+_user32.ShowWindow.argtypes = [HWND, c_int]
+_user32.TrackMouseEvent.restype = BOOL
+_user32.TrackMouseEvent.argtypes = [POINTER(TRACKMOUSEEVENT)]
+_user32.TranslateMessage.restype = BOOL
+_user32.TranslateMessage.argtypes = [LPMSG]
+_user32.UnregisterClassW.restype = BOOL
+_user32.UnregisterClassW.argtypes = [c_wchar_p, HINSTANCE]
+_user32.UnregisterHotKey.restype = BOOL
+_user32.UnregisterHotKey.argtypes = [HWND, c_int]
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/win32/constants.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/win32/constants.py
new file mode 100644
index 0000000..c8a09b1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/win32/constants.py
@@ -0,0 +1,4989 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+# Most of this file is win32con.py from Python for Windows Extensions:
+# http://www.python.net/crew/mhammond/win32/
+
+# From Windows 2000 API SuperBible:
+
+VK_OEM_1 = 0xba
+VK_OEM_PLUS = 0xbb
+VK_OEM_COMMA = 0xbc
+VK_OEM_MINUS = 0xbd
+VK_OEM_PERIOD = 0xbe
+VK_OEM_2 = 0xbf
+VK_OEM_3 = 0xc0
+VK_OEM_4 = 0xdb
+VK_OEM_5 = 0xdc
+VK_OEM_6 = 0xdd
+VK_OEM_7 = 0xde
+VK_OEM_8 = 0xdf
+VK_OEM_102 = 0xe2
+
+# Copyright (c) 1994-2001, Mark Hammond
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the distribution.
+#
+# Neither name of Mark Hammond nor the name of contributors may be used
+# to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. P
+
+# From WinGDI.h
+PFD_TYPE_RGBA = 0
+PFD_TYPE_COLORINDEX = 1
+PFD_MAIN_PLANE = 0
+PFD_OVERLAY_PLANE = 1
+PFD_UNDERLAY_PLANE = (-1)
+PFD_DOUBLEBUFFER = 0x00000001
+PFD_STEREO = 0x00000002
+PFD_DRAW_TO_WINDOW = 0x00000004
+PFD_DRAW_TO_BITMAP = 0x00000008
+PFD_SUPPORT_GDI = 0x00000010
+PFD_SUPPORT_OPENGL = 0x00000020
+PFD_GENERIC_FORMAT = 0x00000040
+PFD_NEED_PALETTE = 0x00000080
+PFD_NEED_SYSTEM_PALETTE = 0x00000100
+PFD_SWAP_EXCHANGE = 0x00000200
+PFD_SWAP_COPY = 0x00000400
+PFD_SWAP_LAYER_BUFFERS = 0x00000800
+PFD_GENERIC_ACCELERATED = 0x00001000
+PFD_SUPPORT_DIRECTDRAW = 0x00002000
+PFD_DEPTH_DONTCARE = 0x20000000
+PFD_DOUBLEBUFFER_DONTCARE = 0x40000000
+PFD_STEREO_DONTCARE = 0x80000000
+
+# Generated by h2py from commdlg.h (plus modifications 4jan98)
+WINVER = 1280
+WM_USER = 1024
+PY_0U = 0
+OFN_READONLY = 1
+OFN_OVERWRITEPROMPT = 2
+OFN_HIDEREADONLY = 4
+OFN_NOCHANGEDIR = 8
+OFN_SHOWHELP = 16
+OFN_ENABLEHOOK = 32
+OFN_ENABLETEMPLATE = 64
+OFN_ENABLETEMPLATEHANDLE = 128
+OFN_NOVALIDATE = 256
+OFN_ALLOWMULTISELECT = 512
+OFN_EXTENSIONDIFFERENT = 1024
+OFN_PATHMUSTEXIST = 2048
+OFN_FILEMUSTEXIST = 4096
+OFN_CREATEPROMPT = 8192
+OFN_SHAREAWARE = 16384
+OFN_NOREADONLYRETURN = 32768
+OFN_NOTESTFILECREATE = 65536
+OFN_NONETWORKBUTTON = 131072
+OFN_NOLONGNAMES = 262144
+OFN_EXPLORER = 524288 # new look commdlg
+OFN_NODEREFERENCELINKS = 1048576
+OFN_LONGNAMES = 2097152 # force long names for 3.x modules
+OFN_ENABLEINCLUDENOTIFY = 4194304 # send include message to callback
+OFN_ENABLESIZING = 8388608
+OFN_DONTADDTORECENT = 33554432
+OFN_FORCESHOWHIDDEN = 268435456 # Show All files including System and hidden files
+OFN_EX_NOPLACESBAR = 1
+OFN_SHAREFALLTHROUGH = 2
+OFN_SHARENOWARN = 1
+OFN_SHAREWARN = 0
+CDN_FIRST = (PY_0U-601)
+CDN_LAST = (PY_0U-699)
+CDN_INITDONE = (CDN_FIRST - 0)
+CDN_SELCHANGE = (CDN_FIRST - 1)
+CDN_FOLDERCHANGE = (CDN_FIRST - 2)
+CDN_SHAREVIOLATION = (CDN_FIRST - 3)
+CDN_HELP = (CDN_FIRST - 4)
+CDN_FILEOK = (CDN_FIRST - 5)
+CDN_TYPECHANGE = (CDN_FIRST - 6)
+CDN_INCLUDEITEM = (CDN_FIRST - 7)
+CDM_FIRST = (WM_USER + 100)
+CDM_LAST = (WM_USER + 200)
+CDM_GETSPEC = (CDM_FIRST + 0)
+CDM_GETFILEPATH = (CDM_FIRST + 1)
+CDM_GETFOLDERPATH = (CDM_FIRST + 2)
+CDM_GETFOLDERIDLIST = (CDM_FIRST + 3)
+CDM_SETCONTROLTEXT = (CDM_FIRST + 4)
+CDM_HIDECONTROL = (CDM_FIRST + 5)
+CDM_SETDEFEXT = (CDM_FIRST + 6)
+CC_RGBINIT = 1
+CC_FULLOPEN = 2
+CC_PREVENTFULLOPEN = 4
+CC_SHOWHELP = 8
+CC_ENABLEHOOK = 16
+CC_ENABLETEMPLATE = 32
+CC_ENABLETEMPLATEHANDLE = 64
+CC_SOLIDCOLOR = 128
+CC_ANYCOLOR = 256
+FR_DOWN = 1
+FR_WHOLEWORD = 2
+FR_MATCHCASE = 4
+FR_FINDNEXT = 8
+FR_REPLACE = 16
+FR_REPLACEALL = 32
+FR_DIALOGTERM = 64
+FR_SHOWHELP = 128
+FR_ENABLEHOOK = 256
+FR_ENABLETEMPLATE = 512
+FR_NOUPDOWN = 1024
+FR_NOMATCHCASE = 2048
+FR_NOWHOLEWORD = 4096
+FR_ENABLETEMPLATEHANDLE = 8192
+FR_HIDEUPDOWN = 16384
+FR_HIDEMATCHCASE = 32768
+FR_HIDEWHOLEWORD = 65536
+CF_SCREENFONTS = 1
+CF_PRINTERFONTS = 2
+CF_BOTH = (CF_SCREENFONTS | CF_PRINTERFONTS)
+CF_SHOWHELP = 4
+CF_ENABLEHOOK = 8
+CF_ENABLETEMPLATE = 16
+CF_ENABLETEMPLATEHANDLE = 32
+CF_INITTOLOGFONTSTRUCT = 64
+CF_USESTYLE = 128
+CF_EFFECTS = 256
+CF_APPLY = 512
+CF_ANSIONLY = 1024
+CF_SCRIPTSONLY = CF_ANSIONLY
+CF_NOVECTORFONTS = 2048
+CF_NOOEMFONTS = CF_NOVECTORFONTS
+CF_NOSIMULATIONS = 4096
+CF_LIMITSIZE = 8192
+CF_FIXEDPITCHONLY = 16384
+CF_WYSIWYG = 32768 # must also have CF_SCREENFONTS & CF_PRINTERFONTS
+CF_FORCEFONTEXIST = 65536
+CF_SCALABLEONLY = 131072
+CF_TTONLY = 262144
+CF_NOFACESEL = 524288
+CF_NOSTYLESEL = 1048576
+CF_NOSIZESEL = 2097152
+CF_SELECTSCRIPT = 4194304
+CF_NOSCRIPTSEL = 8388608
+CF_NOVERTFONTS = 16777216
+SIMULATED_FONTTYPE = 32768
+PRINTER_FONTTYPE = 16384
+SCREEN_FONTTYPE = 8192
+BOLD_FONTTYPE = 256
+ITALIC_FONTTYPE = 512
+REGULAR_FONTTYPE = 1024
+OPENTYPE_FONTTYPE = 65536
+TYPE1_FONTTYPE = 131072
+DSIG_FONTTYPE = 262144
+WM_CHOOSEFONT_GETLOGFONT = (WM_USER + 1)
+WM_CHOOSEFONT_SETLOGFONT = (WM_USER + 101)
+WM_CHOOSEFONT_SETFLAGS = (WM_USER + 102)
+LBSELCHSTRINGA = "commdlg_LBSelChangedNotify"
+SHAREVISTRINGA = "commdlg_ShareViolation"
+FILEOKSTRINGA = "commdlg_FileNameOK"
+COLOROKSTRINGA = "commdlg_ColorOK"
+SETRGBSTRINGA = "commdlg_SetRGBColor"
+HELPMSGSTRINGA = "commdlg_help"
+FINDMSGSTRINGA = "commdlg_FindReplace"
+LBSELCHSTRING = LBSELCHSTRINGA
+SHAREVISTRING = SHAREVISTRINGA
+FILEOKSTRING = FILEOKSTRINGA
+COLOROKSTRING = COLOROKSTRINGA
+SETRGBSTRING = SETRGBSTRINGA
+HELPMSGSTRING = HELPMSGSTRINGA
+FINDMSGSTRING = FINDMSGSTRINGA
+CD_LBSELNOITEMS = -1
+CD_LBSELCHANGE = 0
+CD_LBSELSUB = 1
+CD_LBSELADD = 2
+PD_ALLPAGES = 0
+PD_SELECTION = 1
+PD_PAGENUMS = 2
+PD_NOSELECTION = 4
+PD_NOPAGENUMS = 8
+PD_COLLATE = 16
+PD_PRINTTOFILE = 32
+PD_PRINTSETUP = 64
+PD_NOWARNING = 128
+PD_RETURNDC = 256
+PD_RETURNIC = 512
+PD_RETURNDEFAULT = 1024
+PD_SHOWHELP = 2048
+PD_ENABLEPRINTHOOK = 4096
+PD_ENABLESETUPHOOK = 8192
+PD_ENABLEPRINTTEMPLATE = 16384
+PD_ENABLESETUPTEMPLATE = 32768
+PD_ENABLEPRINTTEMPLATEHANDLE = 65536
+PD_ENABLESETUPTEMPLATEHANDLE = 131072
+PD_USEDEVMODECOPIES = 262144
+PD_DISABLEPRINTTOFILE = 524288
+PD_HIDEPRINTTOFILE = 1048576
+PD_NONETWORKBUTTON = 2097152
+DN_DEFAULTPRN = 1
+WM_PSD_PAGESETUPDLG = (WM_USER )
+WM_PSD_FULLPAGERECT = (WM_USER+1)
+WM_PSD_MINMARGINRECT = (WM_USER+2)
+WM_PSD_MARGINRECT = (WM_USER+3)
+WM_PSD_GREEKTEXTRECT = (WM_USER+4)
+WM_PSD_ENVSTAMPRECT = (WM_USER+5)
+WM_PSD_YAFULLPAGERECT = (WM_USER+6)
+PSD_DEFAULTMINMARGINS = 0 # default (printer's)
+PSD_INWININIINTLMEASURE = 0 # 1st of 4 possible
+PSD_MINMARGINS = 1 # use caller's
+PSD_MARGINS = 2 # use caller's
+PSD_INTHOUSANDTHSOFINCHES = 4 # 2nd of 4 possible
+PSD_INHUNDREDTHSOFMILLIMETERS = 8 # 3rd of 4 possible
+PSD_DISABLEMARGINS = 16
+PSD_DISABLEPRINTER = 32
+PSD_NOWARNING = 128 # must be same as PD_*
+PSD_DISABLEORIENTATION = 256
+PSD_RETURNDEFAULT = 1024 # must be same as PD_*
+PSD_DISABLEPAPER = 512
+PSD_SHOWHELP = 2048 # must be same as PD_*
+PSD_ENABLEPAGESETUPHOOK = 8192 # must be same as PD_*
+PSD_ENABLEPAGESETUPTEMPLATE = 32768 # must be same as PD_*
+PSD_ENABLEPAGESETUPTEMPLATEHANDLE = 131072 # must be same as PD_*
+PSD_ENABLEPAGEPAINTHOOK = 262144
+PSD_DISABLEPAGEPAINTING = 524288
+PSD_NONETWORKBUTTON = 2097152 # must be same as PD_*
+
+# Generated by h2py from winreg.h
+HKEY_CLASSES_ROOT = -2147483648
+HKEY_CURRENT_USER = -2147483647
+HKEY_LOCAL_MACHINE = -2147483646
+HKEY_USERS = -2147483645
+HKEY_PERFORMANCE_DATA = -2147483644
+HKEY_CURRENT_CONFIG = -2147483643
+HKEY_DYN_DATA = -2147483642
+HKEY_PERFORMANCE_TEXT = -2147483568 # ?? 4Jan98
+HKEY_PERFORMANCE_NLSTEXT = -2147483552 # ?? 4Jan98
+
+# Generated by h2py from winuser.h
+HWND_BROADCAST = 65535
+HWND_DESKTOP = 0
+HWND_TOP = 0
+HWND_BOTTOM = 1
+HWND_TOPMOST = -1
+HWND_NOTOPMOST = -2
+HWND_MESSAGE = -3
+
+# winuser.h line 4601
+SM_CXSCREEN = 0
+SM_CYSCREEN = 1
+SM_CXVSCROLL = 2
+SM_CYHSCROLL = 3
+SM_CYCAPTION = 4
+SM_CXBORDER = 5
+SM_CYBORDER = 6
+SM_CXDLGFRAME = 7
+SM_CYDLGFRAME = 8
+SM_CYVTHUMB = 9
+SM_CXHTHUMB = 10
+SM_CXICON = 11
+SM_CYICON = 12
+SM_CXCURSOR = 13
+SM_CYCURSOR = 14
+SM_CYMENU = 15
+SM_CXFULLSCREEN = 16
+SM_CYFULLSCREEN = 17
+SM_CYKANJIWINDOW = 18
+SM_MOUSEPRESENT = 19
+SM_CYVSCROLL = 20
+SM_CXHSCROLL = 21
+SM_DEBUG = 22
+SM_SWAPBUTTON = 23
+SM_RESERVED1 = 24
+SM_RESERVED2 = 25
+SM_RESERVED3 = 26
+SM_RESERVED4 = 27
+SM_CXMIN = 28
+SM_CYMIN = 29
+SM_CXSIZE = 30
+SM_CYSIZE = 31
+SM_CXFRAME = 32
+SM_CYFRAME = 33
+SM_CXMINTRACK = 34
+SM_CYMINTRACK = 35
+SM_CXDOUBLECLK = 36
+SM_CYDOUBLECLK = 37
+SM_CXICONSPACING = 38
+SM_CYICONSPACING = 39
+SM_MENUDROPALIGNMENT = 40
+SM_PENWINDOWS = 41
+SM_DBCSENABLED = 42
+SM_CMOUSEBUTTONS = 43
+SM_CXFIXEDFRAME = SM_CXDLGFRAME
+SM_CYFIXEDFRAME = SM_CYDLGFRAME
+SM_CXSIZEFRAME = SM_CXFRAME
+SM_CYSIZEFRAME = SM_CYFRAME
+SM_SECURE = 44
+SM_CXEDGE = 45
+SM_CYEDGE = 46
+SM_CXMINSPACING = 47
+SM_CYMINSPACING = 48
+SM_CXSMICON = 49
+SM_CYSMICON = 50
+SM_CYSMCAPTION = 51
+SM_CXSMSIZE = 52
+SM_CYSMSIZE = 53
+SM_CXMENUSIZE = 54
+SM_CYMENUSIZE = 55
+SM_ARRANGE = 56
+SM_CXMINIMIZED = 57
+SM_CYMINIMIZED = 58
+SM_CXMAXTRACK = 59
+SM_CYMAXTRACK = 60
+SM_CXMAXIMIZED = 61
+SM_CYMAXIMIZED = 62
+SM_NETWORK = 63
+SM_CLEANBOOT = 67
+SM_CXDRAG = 68
+SM_CYDRAG = 69
+SM_SHOWSOUNDS = 70
+SM_CXMENUCHECK = 71
+SM_CYMENUCHECK = 72
+SM_SLOWMACHINE = 73
+SM_MIDEASTENABLED = 74
+SM_MOUSEWHEELPRESENT = 75
+SM_XVIRTUALSCREEN = 76
+SM_YVIRTUALSCREEN = 77
+SM_CXVIRTUALSCREEN = 78
+SM_CYVIRTUALSCREEN = 79
+SM_CMONITORS = 80
+SM_SAMEDISPLAYFORMAT = 81
+SM_CMETRICS = 83
+MNC_IGNORE = 0
+MNC_CLOSE = 1
+MNC_EXECUTE = 2
+MNC_SELECT = 3
+MNS_NOCHECK = -2147483648
+MNS_MODELESS = 1073741824
+MNS_DRAGDROP = 536870912
+MNS_AUTODISMISS = 268435456
+MNS_NOTIFYBYPOS = 134217728
+MNS_CHECKORBMP = 67108864
+MIM_MAXHEIGHT = 1
+MIM_BACKGROUND = 2
+MIM_HELPID = 4
+MIM_MENUDATA = 8
+MIM_STYLE = 16
+MIM_APPLYTOSUBMENUS = -2147483648
+MND_CONTINUE = 0
+MND_ENDMENU = 1
+MNGOF_GAP = 3
+MNGO_NOINTERFACE = 0
+MNGO_NOERROR = 1
+MIIM_STATE = 1
+MIIM_ID = 2
+MIIM_SUBMENU = 4
+MIIM_CHECKMARKS = 8
+MIIM_TYPE = 16
+MIIM_DATA = 32
+MIIM_STRING = 64
+MIIM_BITMAP = 128
+MIIM_FTYPE = 256
+HBMMENU_CALLBACK = -1
+HBMMENU_SYSTEM = 1
+HBMMENU_MBAR_RESTORE = 2
+HBMMENU_MBAR_MINIMIZE = 3
+HBMMENU_MBAR_CLOSE = 5
+HBMMENU_MBAR_CLOSE_D = 6
+HBMMENU_MBAR_MINIMIZE_D = 7
+HBMMENU_POPUP_CLOSE = 8
+HBMMENU_POPUP_RESTORE = 9
+HBMMENU_POPUP_MAXIMIZE = 10
+HBMMENU_POPUP_MINIMIZE = 11
+GMDI_USEDISABLED = 1
+GMDI_GOINTOPOPUPS = 2
+TPM_LEFTBUTTON = 0
+TPM_RIGHTBUTTON = 2
+TPM_LEFTALIGN = 0
+TPM_CENTERALIGN = 4
+TPM_RIGHTALIGN = 8
+TPM_TOPALIGN = 0
+TPM_VCENTERALIGN = 16
+TPM_BOTTOMALIGN = 32
+TPM_HORIZONTAL = 0
+TPM_VERTICAL = 64
+TPM_NONOTIFY = 128
+TPM_RETURNCMD = 256
+TPM_RECURSE = 1
+DOF_EXECUTABLE = 32769
+DOF_DOCUMENT = 32770
+DOF_DIRECTORY = 32771
+DOF_MULTIPLE = 32772
+DOF_PROGMAN = 1
+DOF_SHELLDATA = 2
+DO_DROPFILE = 1162627398
+DO_PRINTFILE = 1414419024
+DT_TOP = 0
+DT_LEFT = 0
+DT_CENTER = 1
+DT_RIGHT = 2
+DT_VCENTER = 4
+DT_BOTTOM = 8
+DT_WORDBREAK = 16
+DT_SINGLELINE = 32
+DT_EXPANDTABS = 64
+DT_TABSTOP = 128
+DT_NOCLIP = 256
+DT_EXTERNALLEADING = 512
+DT_CALCRECT = 1024
+DT_NOPREFIX = 2048
+DT_INTERNAL = 4096
+DT_EDITCONTROL = 8192
+DT_PATH_ELLIPSIS = 16384
+DT_END_ELLIPSIS = 32768
+DT_MODIFYSTRING = 65536
+DT_RTLREADING = 131072
+DT_WORD_ELLIPSIS = 262144
+DST_COMPLEX = 0
+DST_TEXT = 1
+DST_PREFIXTEXT = 2
+DST_ICON = 3
+DST_BITMAP = 4
+DSS_NORMAL = 0
+DSS_UNION = 16
+DSS_DISABLED = 32
+DSS_MONO = 128
+DSS_RIGHT = 32768
+DCX_WINDOW = 1
+DCX_CACHE = 2
+DCX_NORESETATTRS = 4
+DCX_CLIPCHILDREN = 8
+DCX_CLIPSIBLINGS = 16
+DCX_PARENTCLIP = 32
+DCX_EXCLUDERGN = 64
+DCX_INTERSECTRGN = 128
+DCX_EXCLUDEUPDATE = 256
+DCX_INTERSECTUPDATE = 512
+DCX_LOCKWINDOWUPDATE = 1024
+DCX_VALIDATE = 2097152
+CUDR_NORMAL = 0
+CUDR_NOSNAPTOGRID = 1
+CUDR_NORESOLVEPOSITIONS = 2
+CUDR_NOCLOSEGAPS = 4
+CUDR_NEGATIVECOORDS = 8
+CUDR_NOPRIMARY = 16
+RDW_INVALIDATE = 1
+RDW_INTERNALPAINT = 2
+RDW_ERASE = 4
+RDW_VALIDATE = 8
+RDW_NOINTERNALPAINT = 16
+RDW_NOERASE = 32
+RDW_NOCHILDREN = 64
+RDW_ALLCHILDREN = 128
+RDW_UPDATENOW = 256
+RDW_ERASENOW = 512
+RDW_FRAME = 1024
+RDW_NOFRAME = 2048
+SW_SCROLLCHILDREN = 1
+SW_INVALIDATE = 2
+SW_ERASE = 4
+SW_SMOOTHSCROLL = 16 # Use smooth scrolling
+ESB_ENABLE_BOTH = 0
+ESB_DISABLE_BOTH = 3
+ESB_DISABLE_LEFT = 1
+ESB_DISABLE_RIGHT = 2
+ESB_DISABLE_UP = 1
+ESB_DISABLE_DOWN = 2
+ESB_DISABLE_LTUP = ESB_DISABLE_LEFT
+ESB_DISABLE_RTDN = ESB_DISABLE_RIGHT
+HELPINFO_WINDOW = 1
+HELPINFO_MENUITEM = 2
+MB_OK = 0
+MB_OKCANCEL = 1
+MB_ABORTRETRYIGNORE = 2
+MB_YESNOCANCEL = 3
+MB_YESNO = 4
+MB_RETRYCANCEL = 5
+MB_ICONHAND = 16
+MB_ICONQUESTION = 32
+MB_ICONEXCLAMATION = 48
+MB_ICONASTERISK = 64
+MB_ICONWARNING = MB_ICONEXCLAMATION
+MB_ICONERROR = MB_ICONHAND
+MB_ICONINFORMATION = MB_ICONASTERISK
+MB_ICONSTOP = MB_ICONHAND
+MB_DEFBUTTON1 = 0
+MB_DEFBUTTON2 = 256
+MB_DEFBUTTON3 = 512
+MB_DEFBUTTON4 = 768
+MB_APPLMODAL = 0
+MB_SYSTEMMODAL = 4096
+MB_TASKMODAL = 8192
+MB_HELP = 16384
+MB_NOFOCUS = 32768
+MB_SETFOREGROUND = 65536
+MB_DEFAULT_DESKTOP_ONLY = 131072
+MB_TOPMOST = 262144
+MB_RIGHT = 524288
+MB_RTLREADING = 1048576
+MB_SERVICE_NOTIFICATION = 2097152
+MB_TYPEMASK = 15
+MB_USERICON = 128
+MB_ICONMASK = 240
+MB_DEFMASK = 3840
+MB_MODEMASK = 12288
+MB_MISCMASK = 49152
+# winuser.h line 6373
+CWP_ALL = 0
+CWP_SKIPINVISIBLE = 1
+CWP_SKIPDISABLED = 2
+CWP_SKIPTRANSPARENT = 4
+CTLCOLOR_MSGBOX = 0
+CTLCOLOR_EDIT = 1
+CTLCOLOR_LISTBOX = 2
+CTLCOLOR_BTN = 3
+CTLCOLOR_DLG = 4
+CTLCOLOR_SCROLLBAR = 5
+CTLCOLOR_STATIC = 6
+CTLCOLOR_MAX = 7
+COLOR_SCROLLBAR = 0
+COLOR_BACKGROUND = 1
+COLOR_ACTIVECAPTION = 2
+COLOR_INACTIVECAPTION = 3
+COLOR_MENU = 4
+COLOR_WINDOW = 5
+COLOR_WINDOWFRAME = 6
+COLOR_MENUTEXT = 7
+COLOR_WINDOWTEXT = 8
+COLOR_CAPTIONTEXT = 9
+COLOR_ACTIVEBORDER = 10
+COLOR_INACTIVEBORDER = 11
+COLOR_APPWORKSPACE = 12
+COLOR_HIGHLIGHT = 13
+COLOR_HIGHLIGHTTEXT = 14
+COLOR_BTNFACE = 15
+COLOR_BTNSHADOW = 16
+COLOR_GRAYTEXT = 17
+COLOR_BTNTEXT = 18
+COLOR_INACTIVECAPTIONTEXT = 19
+COLOR_BTNHIGHLIGHT = 20
+COLOR_3DDKSHADOW = 21
+COLOR_3DLIGHT = 22
+COLOR_INFOTEXT = 23
+COLOR_INFOBK = 24
+COLOR_HOTLIGHT = 26
+COLOR_GRADIENTACTIVECAPTION = 27
+COLOR_GRADIENTINACTIVECAPTION = 28
+COLOR_DESKTOP = COLOR_BACKGROUND
+COLOR_3DFACE = COLOR_BTNFACE
+COLOR_3DSHADOW = COLOR_BTNSHADOW
+COLOR_3DHIGHLIGHT = COLOR_BTNHIGHLIGHT
+COLOR_3DHILIGHT = COLOR_BTNHIGHLIGHT
+COLOR_BTNHILIGHT = COLOR_BTNHIGHLIGHT
+GW_HWNDFIRST = 0
+GW_HWNDLAST = 1
+GW_HWNDNEXT = 2
+GW_HWNDPREV = 3
+GW_OWNER = 4
+GW_CHILD = 5
+GW_ENABLEDPOPUP = 6
+GW_MAX = 6
+MF_INSERT = 0
+MF_CHANGE = 128
+MF_APPEND = 256
+MF_DELETE = 512
+MF_REMOVE = 4096
+MF_BYCOMMAND = 0
+MF_BYPOSITION = 1024
+MF_SEPARATOR = 2048
+MF_ENABLED = 0
+MF_GRAYED = 1
+MF_DISABLED = 2
+MF_UNCHECKED = 0
+MF_CHECKED = 8
+MF_USECHECKBITMAPS = 512
+MF_STRING = 0
+MF_BITMAP = 4
+MF_OWNERDRAW = 256
+MF_POPUP = 16
+MF_MENUBARBREAK = 32
+MF_MENUBREAK = 64
+MF_UNHILITE = 0
+MF_HILITE = 128
+MF_DEFAULT = 4096
+MF_SYSMENU = 8192
+MF_HELP = 16384
+MF_RIGHTJUSTIFY = 16384
+MF_MOUSESELECT = 32768
+MF_END = 128
+MFT_STRING = MF_STRING
+MFT_BITMAP = MF_BITMAP
+MFT_MENUBARBREAK = MF_MENUBARBREAK
+MFT_MENUBREAK = MF_MENUBREAK
+MFT_OWNERDRAW = MF_OWNERDRAW
+MFT_RADIOCHECK = 512
+MFT_SEPARATOR = MF_SEPARATOR
+MFT_RIGHTORDER = 8192
+MFT_RIGHTJUSTIFY = MF_RIGHTJUSTIFY
+MFS_GRAYED = 3
+MFS_DISABLED = MFS_GRAYED
+MFS_CHECKED = MF_CHECKED
+MFS_HILITE = MF_HILITE
+MFS_ENABLED = MF_ENABLED
+MFS_UNCHECKED = MF_UNCHECKED
+MFS_UNHILITE = MF_UNHILITE
+MFS_DEFAULT = MF_DEFAULT
+MFS_MASK = 4235
+MFS_HOTTRACKDRAWN = 268435456
+MFS_CACHEDBMP = 536870912
+MFS_BOTTOMGAPDROP = 1073741824
+MFS_TOPGAPDROP = -2147483648
+MFS_GAPDROP = -1073741824
+SC_SIZE = 61440
+SC_MOVE = 61456
+SC_MINIMIZE = 61472
+SC_MAXIMIZE = 61488
+SC_NEXTWINDOW = 61504
+SC_PREVWINDOW = 61520
+SC_CLOSE = 61536
+SC_VSCROLL = 61552
+SC_HSCROLL = 61568
+SC_MOUSEMENU = 61584
+SC_KEYMENU = 61696
+SC_ARRANGE = 61712
+SC_RESTORE = 61728
+SC_TASKLIST = 61744
+SC_SCREENSAVE = 61760
+SC_HOTKEY = 61776
+SC_DEFAULT = 61792
+SC_MONITORPOWER = 61808
+SC_CONTEXTHELP = 61824
+SC_SEPARATOR = 61455
+SC_ICON = SC_MINIMIZE
+SC_ZOOM = SC_MAXIMIZE
+IDC_ARROW = 32512
+IDC_IBEAM = 32513
+IDC_WAIT = 32514
+IDC_CROSS = 32515
+IDC_UPARROW = 32516
+IDC_SIZE = 32640 # OBSOLETE: use IDC_SIZEALL
+IDC_ICON = 32641 # OBSOLETE: use IDC_ARROW
+IDC_SIZENWSE = 32642
+IDC_SIZENESW = 32643
+IDC_SIZEWE = 32644
+IDC_SIZENS = 32645
+IDC_SIZEALL = 32646
+IDC_NO = 32648
+IDC_HAND = 32649
+IDC_APPSTARTING = 32650
+IDC_HELP = 32651
+IMAGE_BITMAP = 0
+IMAGE_ICON = 1
+IMAGE_CURSOR = 2
+IMAGE_ENHMETAFILE = 3
+LR_DEFAULTCOLOR = 0
+LR_MONOCHROME = 1
+LR_COLOR = 2
+LR_COPYRETURNORG = 4
+LR_COPYDELETEORG = 8
+LR_LOADFROMFILE = 16
+LR_LOADTRANSPARENT = 32
+LR_DEFAULTSIZE = 64
+LR_LOADREALSIZE = 128
+LR_LOADMAP3DCOLORS = 4096
+LR_CREATEDIBSECTION = 8192
+LR_COPYFROMRESOURCE = 16384
+LR_SHARED = 32768
+DI_MASK = 1
+DI_IMAGE = 2
+DI_NORMAL = 3
+DI_COMPAT = 4
+DI_DEFAULTSIZE = 8
+RES_ICON = 1
+RES_CURSOR = 2
+OBM_CLOSE = 32754
+OBM_UPARROW = 32753
+OBM_DNARROW = 32752
+OBM_RGARROW = 32751
+OBM_LFARROW = 32750
+OBM_REDUCE = 32749
+OBM_ZOOM = 32748
+OBM_RESTORE = 32747
+OBM_REDUCED = 32746
+OBM_ZOOMD = 32745
+OBM_RESTORED = 32744
+OBM_UPARROWD = 32743
+OBM_DNARROWD = 32742
+OBM_RGARROWD = 32741
+OBM_LFARROWD = 32740
+OBM_MNARROW = 32739
+OBM_COMBO = 32738
+OBM_UPARROWI = 32737
+OBM_DNARROWI = 32736
+OBM_RGARROWI = 32735
+OBM_LFARROWI = 32734
+OBM_OLD_CLOSE = 32767
+OBM_SIZE = 32766
+OBM_OLD_UPARROW = 32765
+OBM_OLD_DNARROW = 32764
+OBM_OLD_RGARROW = 32763
+OBM_OLD_LFARROW = 32762
+OBM_BTSIZE = 32761
+OBM_CHECK = 32760
+OBM_CHECKBOXES = 32759
+OBM_BTNCORNERS = 32758
+OBM_OLD_REDUCE = 32757
+OBM_OLD_ZOOM = 32756
+OBM_OLD_RESTORE = 32755
+OCR_NORMAL = 32512
+OCR_IBEAM = 32513
+OCR_WAIT = 32514
+OCR_CROSS = 32515
+OCR_UP = 32516
+OCR_SIZE = 32640
+OCR_ICON = 32641
+OCR_SIZENWSE = 32642
+OCR_SIZENESW = 32643
+OCR_SIZEWE = 32644
+OCR_SIZENS = 32645
+OCR_SIZEALL = 32646
+OCR_ICOCUR = 32647
+OCR_NO = 32648
+OCR_HAND = 32649
+OCR_APPSTARTING = 32650
+# winuser.h line 7455
+OIC_SAMPLE = 32512
+OIC_HAND = 32513
+OIC_QUES = 32514
+OIC_BANG = 32515
+OIC_NOTE = 32516
+OIC_WINLOGO = 32517
+OIC_WARNING = OIC_BANG
+OIC_ERROR = OIC_HAND
+OIC_INFORMATION = OIC_NOTE
+ORD_LANGDRIVER = 1
+IDI_APPLICATION = 32512
+IDI_HAND = 32513
+IDI_QUESTION = 32514
+IDI_EXCLAMATION = 32515
+IDI_ASTERISK = 32516
+IDI_WINLOGO = 32517
+IDI_WARNING = IDI_EXCLAMATION
+IDI_ERROR = IDI_HAND
+IDI_INFORMATION = IDI_ASTERISK
+IDOK = 1
+IDCANCEL = 2
+IDABORT = 3
+IDRETRY = 4
+IDIGNORE = 5
+IDYES = 6
+IDNO = 7
+IDCLOSE = 8
+IDHELP = 9
+ES_LEFT = 0
+ES_CENTER = 1
+ES_RIGHT = 2
+ES_MULTILINE = 4
+ES_UPPERCASE = 8
+ES_LOWERCASE = 16
+ES_PASSWORD = 32
+ES_AUTOVSCROLL = 64
+ES_AUTOHSCROLL = 128
+ES_NOHIDESEL = 256
+ES_OEMCONVERT = 1024
+ES_READONLY = 2048
+ES_WANTRETURN = 4096
+ES_NUMBER = 8192
+EN_SETFOCUS = 256
+EN_KILLFOCUS = 512
+EN_CHANGE = 768
+EN_UPDATE = 1024
+EN_ERRSPACE = 1280
+EN_MAXTEXT = 1281
+EN_HSCROLL = 1537
+EN_VSCROLL = 1538
+EC_LEFTMARGIN = 1
+EC_RIGHTMARGIN = 2
+EC_USEFONTINFO = 65535
+EMSIS_COMPOSITIONSTRING = 1
+EIMES_GETCOMPSTRATONCE = 1
+EIMES_CANCELCOMPSTRINFOCUS = 2
+EIMES_COMPLETECOMPSTRKILLFOCUS = 4
+EM_GETSEL = 176
+EM_SETSEL = 177
+EM_GETRECT = 178
+EM_SETRECT = 179
+EM_SETRECTNP = 180
+EM_SCROLL = 181
+EM_LINESCROLL = 182
+EM_SCROLLCARET = 183
+EM_GETMODIFY = 184
+EM_SETMODIFY = 185
+EM_GETLINECOUNT = 186
+EM_LINEINDEX = 187
+EM_SETHANDLE = 188
+EM_GETHANDLE = 189
+EM_GETTHUMB = 190
+EM_LINELENGTH = 193
+EM_REPLACESEL = 194
+EM_GETLINE = 196
+EM_LIMITTEXT = 197
+EM_CANUNDO = 198
+EM_UNDO = 199
+EM_FMTLINES = 200
+EM_LINEFROMCHAR = 201
+EM_SETTABSTOPS = 203
+EM_SETPASSWORDCHAR = 204
+EM_EMPTYUNDOBUFFER = 205
+EM_GETFIRSTVISIBLELINE = 206
+EM_SETREADONLY = 207
+EM_SETWORDBREAKPROC = 208
+EM_GETWORDBREAKPROC = 209
+EM_GETPASSWORDCHAR = 210
+EM_SETMARGINS = 211
+EM_GETMARGINS = 212
+EM_SETLIMITTEXT = EM_LIMITTEXT
+EM_GETLIMITTEXT = 213
+EM_POSFROMCHAR = 214
+EM_CHARFROMPOS = 215
+EM_SETIMESTATUS = 216
+EM_GETIMESTATUS = 217
+WB_LEFT = 0
+WB_RIGHT = 1
+WB_ISDELIMITER = 2
+BS_PUSHBUTTON = 0
+BS_DEFPUSHBUTTON = 1
+BS_CHECKBOX = 2
+BS_AUTOCHECKBOX = 3
+BS_RADIOBUTTON = 4
+BS_3STATE = 5
+BS_AUTO3STATE = 6
+BS_GROUPBOX = 7
+BS_USERBUTTON = 8
+BS_AUTORADIOBUTTON = 9
+BS_OWNERDRAW = 11
+BS_LEFTTEXT = 32
+BS_TEXT = 0
+BS_ICON = 64
+BS_BITMAP = 128
+BS_LEFT = 256
+BS_RIGHT = 512
+BS_CENTER = 768
+BS_TOP = 1024
+BS_BOTTOM = 2048
+BS_VCENTER = 3072
+BS_PUSHLIKE = 4096
+BS_MULTILINE = 8192
+BS_NOTIFY = 16384
+BS_FLAT = 32768
+BS_RIGHTBUTTON = BS_LEFTTEXT
+BN_CLICKED = 0
+BN_PAINT = 1
+BN_HILITE = 2
+BN_UNHILITE = 3
+BN_DISABLE = 4
+BN_DOUBLECLICKED = 5
+BN_PUSHED = BN_HILITE
+BN_UNPUSHED = BN_UNHILITE
+BN_DBLCLK = BN_DOUBLECLICKED
+BN_SETFOCUS = 6
+BN_KILLFOCUS = 7
+BM_GETCHECK = 240
+BM_SETCHECK = 241
+BM_GETSTATE = 242
+BM_SETSTATE = 243
+BM_SETSTYLE = 244
+BM_CLICK = 245
+BM_GETIMAGE = 246
+BM_SETIMAGE = 247
+BST_UNCHECKED = 0
+BST_CHECKED = 1
+BST_INDETERMINATE = 2
+BST_PUSHED = 4
+BST_FOCUS = 8
+SS_LEFT = 0
+SS_CENTER = 1
+SS_RIGHT = 2
+SS_ICON = 3
+SS_BLACKRECT = 4
+SS_GRAYRECT = 5
+SS_WHITERECT = 6
+SS_BLACKFRAME = 7
+SS_GRAYFRAME = 8
+SS_WHITEFRAME = 9
+SS_USERITEM = 10
+SS_SIMPLE = 11
+SS_LEFTNOWORDWRAP = 12
+SS_BITMAP = 14
+SS_OWNERDRAW = 13
+SS_ENHMETAFILE = 15
+SS_ETCHEDHORZ = 16
+SS_ETCHEDVERT = 17
+SS_ETCHEDFRAME = 18
+SS_TYPEMASK = 31
+SS_NOPREFIX = 128
+SS_NOTIFY = 256
+SS_CENTERIMAGE = 512
+SS_RIGHTJUST = 1024
+SS_REALSIZEIMAGE = 2048
+SS_SUNKEN = 4096
+SS_ENDELLIPSIS = 16384
+SS_PATHELLIPSIS = 32768
+SS_WORDELLIPSIS = 49152
+SS_ELLIPSISMASK = 49152
+STM_SETICON = 368
+STM_GETICON = 369
+STM_SETIMAGE = 370
+STM_GETIMAGE = 371
+STN_CLICKED = 0
+STN_DBLCLK = 1
+STN_ENABLE = 2
+STN_DISABLE = 3
+STM_MSGMAX = 372
+DWL_MSGRESULT = 0
+DWL_DLGPROC = 4
+DWL_USER = 8
+DDL_READWRITE = 0
+DDL_READONLY = 1
+DDL_HIDDEN = 2
+DDL_SYSTEM = 4
+DDL_DIRECTORY = 16
+DDL_ARCHIVE = 32
+DDL_POSTMSGS = 8192
+DDL_DRIVES = 16384
+DDL_EXCLUSIVE = 32768
+
+#from winuser.h line 153
+RT_CURSOR = 1
+RT_BITMAP = 2
+RT_ICON = 3
+RT_MENU = 4
+RT_DIALOG = 5
+RT_STRING = 6
+RT_FONTDIR = 7
+RT_FONT = 8
+RT_ACCELERATOR = 9
+RT_RCDATA = 10
+RT_MESSAGETABLE = 11
+DIFFERENCE = 11
+RT_GROUP_CURSOR = (RT_CURSOR + DIFFERENCE)
+RT_GROUP_ICON = (RT_ICON + DIFFERENCE)
+RT_VERSION = 16
+RT_DLGINCLUDE = 17
+RT_PLUGPLAY = 19
+RT_VXD = 20
+RT_ANICURSOR = 21
+RT_ANIICON = 22
+RT_HTML = 23
+# from winuser.h line 218
+SB_HORZ = 0
+SB_VERT = 1
+SB_CTL = 2
+SB_BOTH = 3
+SB_LINEUP = 0
+SB_LINELEFT = 0
+SB_LINEDOWN = 1
+SB_LINERIGHT = 1
+SB_PAGEUP = 2
+SB_PAGELEFT = 2
+SB_PAGEDOWN = 3
+SB_PAGERIGHT = 3
+SB_THUMBPOSITION = 4
+SB_THUMBTRACK = 5
+SB_TOP = 6
+SB_LEFT = 6
+SB_BOTTOM = 7
+SB_RIGHT = 7
+SB_ENDSCROLL = 8
+SW_HIDE = 0
+SW_SHOWNORMAL = 1
+SW_NORMAL = 1
+SW_SHOWMINIMIZED = 2
+SW_SHOWMAXIMIZED = 3
+SW_MAXIMIZE = 3
+SW_SHOWNOACTIVATE = 4
+SW_SHOW = 5
+SW_MINIMIZE = 6
+SW_SHOWMINNOACTIVE = 7
+SW_SHOWNA = 8
+SW_RESTORE = 9
+SW_SHOWDEFAULT = 10
+SW_FORCEMINIMIZE = 11
+SW_MAX = 11
+HIDE_WINDOW = 0
+SHOW_OPENWINDOW = 1
+SHOW_ICONWINDOW = 2
+SHOW_FULLSCREEN = 3
+SHOW_OPENNOACTIVATE = 4
+SW_PARENTCLOSING = 1
+SW_OTHERZOOM = 2
+SW_PARENTOPENING = 3
+SW_OTHERUNZOOM = 4
+AW_HOR_POSITIVE = 1
+AW_HOR_NEGATIVE = 2
+AW_VER_POSITIVE = 4
+AW_VER_NEGATIVE = 8
+AW_CENTER = 16
+AW_HIDE = 65536
+AW_ACTIVATE = 131072
+AW_SLIDE = 262144
+AW_BLEND = 524288
+KF_EXTENDED = 256
+KF_DLGMODE = 2048
+KF_MENUMODE = 4096
+KF_ALTDOWN = 8192
+KF_REPEAT = 16384
+KF_UP = 32768
+VK_LBUTTON = 1
+VK_RBUTTON = 2
+VK_CANCEL = 3
+VK_MBUTTON = 4
+VK_BACK = 8
+VK_TAB = 9
+VK_CLEAR = 12
+VK_RETURN = 13
+VK_SHIFT = 16
+VK_CONTROL = 17
+VK_MENU = 18
+VK_PAUSE = 19
+VK_CAPITAL = 20
+VK_KANA = 21
+VK_HANGEUL = 21 # old name - should be here for compatibility
+VK_HANGUL = 21
+VK_JUNJA = 23
+VK_FINAL = 24
+VK_HANJA = 25
+VK_KANJI = 25
+VK_ESCAPE = 27
+VK_CONVERT = 28
+VK_NONCONVERT = 29
+VK_ACCEPT = 30
+VK_MODECHANGE = 31
+VK_SPACE = 32
+VK_PRIOR = 33
+VK_NEXT = 34
+VK_END = 35
+VK_HOME = 36
+VK_LEFT = 37
+VK_UP = 38
+VK_RIGHT = 39
+VK_DOWN = 40
+VK_SELECT = 41
+VK_PRINT = 42
+VK_EXECUTE = 43
+VK_SNAPSHOT = 44
+VK_INSERT = 45
+VK_DELETE = 46
+VK_HELP = 47
+VK_LWIN = 91
+VK_RWIN = 92
+VK_APPS = 93
+VK_NUMPAD0 = 96
+VK_NUMPAD1 = 97
+VK_NUMPAD2 = 98
+VK_NUMPAD3 = 99
+VK_NUMPAD4 = 100
+VK_NUMPAD5 = 101
+VK_NUMPAD6 = 102
+VK_NUMPAD7 = 103
+VK_NUMPAD8 = 104
+VK_NUMPAD9 = 105
+VK_MULTIPLY = 106
+VK_ADD = 107
+VK_SEPARATOR = 108
+VK_SUBTRACT = 109
+VK_DECIMAL = 110
+VK_DIVIDE = 111
+VK_F1 = 112
+VK_F2 = 113
+VK_F3 = 114
+VK_F4 = 115
+VK_F5 = 116
+VK_F6 = 117
+VK_F7 = 118
+VK_F8 = 119
+VK_F9 = 120
+VK_F10 = 121
+VK_F11 = 122
+VK_F12 = 123
+VK_F13 = 124
+VK_F14 = 125
+VK_F15 = 126
+VK_F16 = 127
+VK_F17 = 128
+VK_F18 = 129
+VK_F19 = 130
+VK_F20 = 131
+VK_F21 = 132
+VK_F22 = 133
+VK_F23 = 134
+VK_F24 = 135
+VK_NUMLOCK = 144
+VK_SCROLL = 145
+VK_LSHIFT = 160
+VK_RSHIFT = 161
+VK_LCONTROL = 162
+VK_RCONTROL = 163
+VK_LMENU = 164
+VK_RMENU = 165
+VK_PROCESSKEY = 229
+VK_ATTN = 246
+VK_CRSEL = 247
+VK_EXSEL = 248
+VK_EREOF = 249
+VK_PLAY = 250
+VK_ZOOM = 251
+VK_NONAME = 252
+VK_PA1 = 253
+VK_OEM_CLEAR = 254
+# multi-media related "keys"
+MOUSEEVENTF_XDOWN = 0x0080
+MOUSEEVENTF_XUP = 0x0100
+MOUSEEVENTF_WHEEL = 0x0800
+VK_XBUTTON1 = 0x05
+VK_XBUTTON2 = 0x06
+VK_VOLUME_MUTE = 0xAD
+VK_VOLUME_DOWN = 0xAE
+VK_VOLUME_UP = 0xAF
+VK_MEDIA_NEXT_TRACK = 0xB0
+VK_MEDIA_PREV_TRACK = 0xB1
+VK_MEDIA_PLAY_PAUSE = 0xB3
+VK_BROWSER_BACK = 0xA6
+VK_BROWSER_FORWARD = 0xA7
+WH_MIN = (-1)
+WH_MSGFILTER = (-1)
+WH_JOURNALRECORD = 0
+WH_JOURNALPLAYBACK = 1
+WH_KEYBOARD = 2
+WH_GETMESSAGE = 3
+WH_CALLWNDPROC = 4
+WH_CBT = 5
+WH_SYSMSGFILTER = 6
+WH_MOUSE = 7
+WH_HARDWARE = 8
+WH_DEBUG = 9
+WH_SHELL = 10
+WH_FOREGROUNDIDLE = 11
+WH_CALLWNDPROCRET = 12
+WH_KEYBOARD_LL = 13
+WH_MOUSE_LL = 14
+WH_MAX = 14
+WH_MINHOOK = WH_MIN
+WH_MAXHOOK = WH_MAX
+HC_ACTION = 0
+HC_GETNEXT = 1
+HC_SKIP = 2
+HC_NOREMOVE = 3
+HC_NOREM = HC_NOREMOVE
+HC_SYSMODALON = 4
+HC_SYSMODALOFF = 5
+HCBT_MOVESIZE = 0
+HCBT_MINMAX = 1
+HCBT_QS = 2
+HCBT_CREATEWND = 3
+HCBT_DESTROYWND = 4
+HCBT_ACTIVATE = 5
+HCBT_CLICKSKIPPED = 6
+HCBT_KEYSKIPPED = 7
+HCBT_SYSCOMMAND = 8
+HCBT_SETFOCUS = 9
+MSGF_DIALOGBOX = 0
+MSGF_MESSAGEBOX = 1
+MSGF_MENU = 2
+#MSGF_MOVE = 3
+#MSGF_SIZE = 4
+MSGF_SCROLLBAR = 5
+MSGF_NEXTWINDOW = 6
+#MSGF_MAINLOOP = 8
+MSGF_MAX = 8
+MSGF_USER = 4096
+HSHELL_WINDOWCREATED = 1
+HSHELL_WINDOWDESTROYED = 2
+HSHELL_ACTIVATESHELLWINDOW = 3
+HSHELL_WINDOWACTIVATED = 4
+HSHELL_GETMINRECT = 5
+HSHELL_REDRAW = 6
+HSHELL_TASKMAN = 7
+HSHELL_LANGUAGE = 8
+HSHELL_ACCESSIBILITYSTATE = 11
+ACCESS_STICKYKEYS = 1
+ACCESS_FILTERKEYS = 2
+ACCESS_MOUSEKEYS = 3
+# winuser.h line 624
+LLKHF_EXTENDED = 1
+LLKHF_INJECTED = 16
+LLKHF_ALTDOWN = 32
+LLKHF_UP = 128
+LLMHF_INJECTED = 1
+# line 692
+HKL_PREV = 0
+HKL_NEXT = 1
+KLF_ACTIVATE = 1
+KLF_SUBSTITUTE_OK = 2
+KLF_UNLOADPREVIOUS = 4
+KLF_REORDER = 8
+KLF_REPLACELANG = 16
+KLF_NOTELLSHELL = 128
+KLF_SETFORPROCESS = 256
+KL_NAMELENGTH = 9
+DESKTOP_READOBJECTS = 1
+DESKTOP_CREATEWINDOW = 2
+DESKTOP_CREATEMENU = 4
+DESKTOP_HOOKCONTROL = 8
+DESKTOP_JOURNALRECORD = 16
+DESKTOP_JOURNALPLAYBACK = 32
+DESKTOP_ENUMERATE = 64
+DESKTOP_WRITEOBJECTS = 128
+DESKTOP_SWITCHDESKTOP = 256
+DF_ALLOWOTHERACCOUNTHOOK = 1
+WINSTA_ENUMDESKTOPS = 1
+WINSTA_READATTRIBUTES = 2
+WINSTA_ACCESSCLIPBOARD = 4
+WINSTA_CREATEDESKTOP = 8
+WINSTA_WRITEATTRIBUTES = 16
+WINSTA_ACCESSGLOBALATOMS = 32
+WINSTA_EXITWINDOWS = 64
+WINSTA_ENUMERATE = 256
+WINSTA_READSCREEN = 512
+WSF_VISIBLE = 1
+UOI_FLAGS = 1
+UOI_NAME = 2
+UOI_TYPE = 3
+UOI_USER_SID = 4
+GWL_WNDPROC = (-4)
+GWL_HINSTANCE = (-6)
+GWL_HWNDPARENT = (-8)
+GWL_STYLE = (-16)
+GWL_EXSTYLE = (-20)
+GWL_USERDATA = (-21)
+GWL_ID = (-12)
+GCL_MENUNAME = (-8)
+GCL_HBRBACKGROUND = (-10)
+GCL_HCURSOR = (-12)
+GCL_HICON = (-14)
+GCL_HMODULE = (-16)
+GCL_CBWNDEXTRA = (-18)
+GCL_CBCLSEXTRA = (-20)
+GCL_WNDPROC = (-24)
+GCL_STYLE = (-26)
+GCW_ATOM = (-32)
+GCL_HICONSM = (-34)
+# line 1291
+WM_NULL = 0
+WM_CREATE = 1
+WM_DESTROY = 2
+WM_MOVE = 3
+WM_SIZE = 5
+WM_ACTIVATE = 6
+WA_INACTIVE = 0
+WA_ACTIVE = 1
+WA_CLICKACTIVE = 2
+WM_SETFOCUS = 7
+WM_KILLFOCUS = 8
+WM_ENABLE = 10
+WM_SETREDRAW = 11
+WM_SETTEXT = 12
+WM_GETTEXT = 13
+WM_GETTEXTLENGTH = 14
+WM_PAINT = 15
+WM_CLOSE = 16
+WM_QUERYENDSESSION = 17
+WM_QUIT = 18
+WM_QUERYOPEN = 19
+WM_ERASEBKGND = 20
+WM_SYSCOLORCHANGE = 21
+WM_ENDSESSION = 22
+WM_SHOWWINDOW = 24
+WM_WININICHANGE = 26
+WM_SETTINGCHANGE = WM_WININICHANGE
+WM_DEVMODECHANGE = 27
+WM_ACTIVATEAPP = 28
+WM_FONTCHANGE = 29
+WM_TIMECHANGE = 30
+WM_CANCELMODE = 31
+WM_SETCURSOR = 32
+WM_MOUSEACTIVATE = 33
+WM_CHILDACTIVATE = 34
+WM_QUEUESYNC = 35
+WM_GETMINMAXINFO = 36
+WM_PAINTICON = 38
+WM_ICONERASEBKGND = 39
+WM_NEXTDLGCTL = 40
+WM_SPOOLERSTATUS = 42
+WM_DRAWITEM = 43
+WM_MEASUREITEM = 44
+WM_DELETEITEM = 45
+WM_VKEYTOITEM = 46
+WM_CHARTOITEM = 47
+WM_SETFONT = 48
+WM_GETFONT = 49
+WM_SETHOTKEY = 50
+WM_GETHOTKEY = 51
+WM_QUERYDRAGICON = 55
+WM_COMPAREITEM = 57
+WM_GETOBJECT = 61
+WM_COMPACTING = 65
+WM_COMMNOTIFY = 68
+WM_WINDOWPOSCHANGING = 70
+WM_WINDOWPOSCHANGED = 71
+WM_POWER = 72
+PWR_OK = 1
+PWR_FAIL = (-1)
+PWR_SUSPENDREQUEST = 1
+PWR_SUSPENDRESUME = 2
+PWR_CRITICALRESUME = 3
+WM_COPYDATA = 74
+WM_CANCELJOURNAL = 75
+WM_NOTIFY = 78
+WM_INPUTLANGCHANGEREQUEST = 80
+WM_INPUTLANGCHANGE = 81
+WM_TCARD = 82
+WM_HELP = 83
+WM_USERCHANGED = 84
+WM_NOTIFYFORMAT = 85
+NFR_ANSI = 1
+NFR_UNICODE = 2
+NF_QUERY = 3
+NF_REQUERY = 4
+WM_CONTEXTMENU = 123
+WM_STYLECHANGING = 124
+WM_STYLECHANGED = 125
+WM_DISPLAYCHANGE = 126
+WM_GETICON = 127
+WM_SETICON = 128
+WM_NCCREATE = 129
+WM_NCDESTROY = 130
+WM_NCCALCSIZE = 131
+WM_NCHITTEST = 132
+WM_NCPAINT = 133
+WM_NCACTIVATE = 134
+WM_GETDLGCODE = 135
+WM_SYNCPAINT = 136
+WM_NCMOUSEMOVE = 160
+WM_NCLBUTTONDOWN = 161
+WM_NCLBUTTONUP = 162
+WM_NCLBUTTONDBLCLK = 163
+WM_NCRBUTTONDOWN = 164
+WM_NCRBUTTONUP = 165
+WM_NCRBUTTONDBLCLK = 166
+WM_NCMBUTTONDOWN = 167
+WM_NCMBUTTONUP = 168
+WM_NCMBUTTONDBLCLK = 169
+WM_KEYFIRST = 256
+WM_KEYDOWN = 256
+WM_KEYUP = 257
+WM_CHAR = 258
+WM_DEADCHAR = 259
+WM_SYSKEYDOWN = 260
+WM_SYSKEYUP = 261
+WM_SYSCHAR = 262
+WM_SYSDEADCHAR = 263
+WM_KEYLAST = 264
+WM_IME_STARTCOMPOSITION = 269
+WM_IME_ENDCOMPOSITION = 270
+WM_IME_COMPOSITION = 271
+WM_IME_KEYLAST = 271
+WM_INITDIALOG = 272
+WM_COMMAND = 273
+WM_SYSCOMMAND = 274
+WM_TIMER = 275
+WM_HSCROLL = 276
+WM_VSCROLL = 277
+WM_INITMENU = 278
+WM_INITMENUPOPUP = 279
+WM_MENUSELECT = 287
+WM_MENUCHAR = 288
+WM_ENTERIDLE = 289
+WM_MENURBUTTONUP = 290
+WM_MENUDRAG = 291
+WM_MENUGETOBJECT = 292
+WM_UNINITMENUPOPUP = 293
+WM_MENUCOMMAND = 294
+WM_CTLCOLORMSGBOX = 306
+WM_CTLCOLOREDIT = 307
+WM_CTLCOLORLISTBOX = 308
+WM_CTLCOLORBTN = 309
+WM_CTLCOLORDLG = 310
+WM_CTLCOLORSCROLLBAR = 311
+WM_CTLCOLORSTATIC = 312
+WM_MOUSEFIRST = 512
+WM_MOUSEMOVE = 512
+WM_LBUTTONDOWN = 513
+WM_LBUTTONUP = 514
+WM_LBUTTONDBLCLK = 515
+WM_RBUTTONDOWN = 516
+WM_RBUTTONUP = 517
+WM_RBUTTONDBLCLK = 518
+WM_MBUTTONDOWN = 519
+WM_MBUTTONUP = 520
+WM_MBUTTONDBLCLK = 521
+WM_MOUSEWHEEL = 522
+WM_MOUSELAST = 522
+WHEEL_DELTA = 120 # Value for rolling one detent
+WHEEL_PAGESCROLL = -1 # Scroll one page
+WM_PARENTNOTIFY = 528
+MENULOOP_WINDOW = 0
+MENULOOP_POPUP = 1
+WM_ENTERMENULOOP = 529
+WM_EXITMENULOOP = 530
+WM_NEXTMENU = 531
+WM_SIZING = 532
+WM_CAPTURECHANGED = 533
+WM_MOVING = 534
+WM_POWERBROADCAST = 536
+PBT_APMQUERYSUSPEND = 0
+PBT_APMQUERYSTANDBY = 1
+PBT_APMQUERYSUSPENDFAILED = 2
+PBT_APMQUERYSTANDBYFAILED = 3
+PBT_APMSUSPEND = 4
+PBT_APMSTANDBY = 5
+PBT_APMRESUMECRITICAL = 6
+PBT_APMRESUMESUSPEND = 7
+PBT_APMRESUMESTANDBY = 8
+PBTF_APMRESUMEFROMFAILURE = 1
+PBT_APMBATTERYLOW = 9
+PBT_APMPOWERSTATUSCHANGE = 10
+PBT_APMOEMEVENT = 11
+PBT_APMRESUMEAUTOMATIC = 18
+WM_DEVICECHANGE = 537
+WM_MDICREATE = 544
+WM_MDIDESTROY = 545
+WM_MDIACTIVATE = 546
+WM_MDIRESTORE = 547
+WM_MDINEXT = 548
+WM_MDIMAXIMIZE = 549
+WM_MDITILE = 550
+WM_MDICASCADE = 551
+WM_MDIICONARRANGE = 552
+WM_MDIGETACTIVE = 553
+WM_MDISETMENU = 560
+WM_ENTERSIZEMOVE = 561
+WM_EXITSIZEMOVE = 562
+WM_DROPFILES = 563
+WM_MDIREFRESHMENU = 564
+WM_IME_SETCONTEXT = 641
+WM_IME_NOTIFY = 642
+WM_IME_CONTROL = 643
+WM_IME_COMPOSITIONFULL = 644
+WM_IME_SELECT = 645
+WM_IME_CHAR = 646
+WM_IME_REQUEST = 648
+WM_IME_KEYDOWN = 656
+WM_IME_KEYUP = 657
+WM_MOUSEHOVER = 673
+WM_MOUSELEAVE = 675
+WM_CUT = 768
+WM_COPY = 769
+WM_PASTE = 770
+WM_CLEAR = 771
+WM_UNDO = 772
+WM_RENDERFORMAT = 773
+WM_RENDERALLFORMATS = 774
+WM_DESTROYCLIPBOARD = 775
+WM_DRAWCLIPBOARD = 776
+WM_PAINTCLIPBOARD = 777
+WM_VSCROLLCLIPBOARD = 778
+WM_SIZECLIPBOARD = 779
+WM_ASKCBFORMATNAME = 780
+WM_CHANGECBCHAIN = 781
+WM_HSCROLLCLIPBOARD = 782
+WM_QUERYNEWPALETTE = 783
+WM_PALETTEISCHANGING = 784
+WM_PALETTECHANGED = 785
+WM_HOTKEY = 786
+WM_PRINT = 791
+WM_PRINTCLIENT = 792
+WM_HANDHELDFIRST = 856
+WM_HANDHELDLAST = 863
+WM_AFXFIRST = 864
+WM_AFXLAST = 895
+WM_PENWINFIRST = 896
+WM_PENWINLAST = 911
+WM_APP = 32768
+WMSZ_LEFT = 1
+WMSZ_RIGHT = 2
+WMSZ_TOP = 3
+WMSZ_TOPLEFT = 4
+WMSZ_TOPRIGHT = 5
+WMSZ_BOTTOM = 6
+WMSZ_BOTTOMLEFT = 7
+WMSZ_BOTTOMRIGHT = 8
+#ST_BEGINSWP = 0
+#ST_ENDSWP = 1
+HTERROR = (-2)
+HTTRANSPARENT = (-1)
+HTNOWHERE = 0
+HTCLIENT = 1
+HTCAPTION = 2
+HTSYSMENU = 3
+HTGROWBOX = 4
+HTSIZE = HTGROWBOX
+HTMENU = 5
+HTHSCROLL = 6
+HTVSCROLL = 7
+HTMINBUTTON = 8
+HTMAXBUTTON = 9
+HTLEFT = 10
+HTRIGHT = 11
+HTTOP = 12
+HTTOPLEFT = 13
+HTTOPRIGHT = 14
+HTBOTTOM = 15
+HTBOTTOMLEFT = 16
+HTBOTTOMRIGHT = 17
+HTBORDER = 18
+HTREDUCE = HTMINBUTTON
+HTZOOM = HTMAXBUTTON
+HTSIZEFIRST = HTLEFT
+HTSIZELAST = HTBOTTOMRIGHT
+HTOBJECT = 19
+HTCLOSE = 20
+HTHELP = 21
+SMTO_NORMAL = 0
+SMTO_BLOCK = 1
+SMTO_ABORTIFHUNG = 2
+SMTO_NOTIMEOUTIFNOTHUNG = 8
+MA_ACTIVATE = 1
+MA_ACTIVATEANDEAT = 2
+MA_NOACTIVATE = 3
+MA_NOACTIVATEANDEAT = 4
+ICON_SMALL = 0
+ICON_BIG = 1
+SIZE_RESTORED = 0
+SIZE_MINIMIZED = 1
+SIZE_MAXIMIZED = 2
+SIZE_MAXSHOW = 3
+SIZE_MAXHIDE = 4
+SIZENORMAL = SIZE_RESTORED
+SIZEICONIC = SIZE_MINIMIZED
+SIZEFULLSCREEN = SIZE_MAXIMIZED
+SIZEZOOMSHOW = SIZE_MAXSHOW
+SIZEZOOMHIDE = SIZE_MAXHIDE
+WVR_ALIGNTOP = 16
+WVR_ALIGNLEFT = 32
+WVR_ALIGNBOTTOM = 64
+WVR_ALIGNRIGHT = 128
+WVR_HREDRAW = 256
+WVR_VREDRAW = 512
+WVR_REDRAW = (WVR_HREDRAW | WVR_VREDRAW)
+WVR_VALIDRECTS = 1024
+MK_LBUTTON = 1
+MK_RBUTTON = 2
+MK_SHIFT = 4
+MK_CONTROL = 8
+MK_MBUTTON = 16
+TME_HOVER = 1
+TME_LEAVE = 2
+TME_QUERY = 1073741824
+TME_CANCEL = -2147483648
+HOVER_DEFAULT = -1
+WS_OVERLAPPED = 0
+WS_POPUP = -2147483648
+WS_CHILD = 1073741824
+WS_MINIMIZE = 536870912
+WS_VISIBLE = 268435456
+WS_DISABLED = 134217728
+WS_CLIPSIBLINGS = 67108864
+WS_CLIPCHILDREN = 33554432
+WS_MAXIMIZE = 16777216
+WS_CAPTION = 12582912
+WS_BORDER = 8388608
+WS_DLGFRAME = 4194304
+WS_VSCROLL = 2097152
+WS_HSCROLL = 1048576
+WS_SYSMENU = 524288
+WS_THICKFRAME = 262144
+WS_GROUP = 131072
+WS_TABSTOP = 65536
+WS_MINIMIZEBOX = 131072
+WS_MAXIMIZEBOX = 65536
+WS_TILED = WS_OVERLAPPED
+WS_ICONIC = WS_MINIMIZE
+WS_SIZEBOX = WS_THICKFRAME
+WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED | \
+ WS_CAPTION | \
+ WS_SYSMENU | \
+ WS_THICKFRAME | \
+ WS_MINIMIZEBOX | \
+ WS_MAXIMIZEBOX)
+WS_POPUPWINDOW = (WS_POPUP | \
+ WS_BORDER | \
+ WS_SYSMENU)
+WS_CHILDWINDOW = (WS_CHILD)
+WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW
+WS_EX_DLGMODALFRAME = 1
+WS_EX_NOPARENTNOTIFY = 4
+WS_EX_TOPMOST = 8
+WS_EX_ACCEPTFILES = 16
+WS_EX_TRANSPARENT = 32
+WS_EX_MDICHILD = 64
+WS_EX_TOOLWINDOW = 128
+WS_EX_WINDOWEDGE = 256
+WS_EX_CLIENTEDGE = 512
+WS_EX_CONTEXTHELP = 1024
+WS_EX_RIGHT = 4096
+WS_EX_LEFT = 0
+WS_EX_RTLREADING = 8192
+WS_EX_LTRREADING = 0
+WS_EX_LEFTSCROLLBAR = 16384
+WS_EX_RIGHTSCROLLBAR = 0
+WS_EX_CONTROLPARENT = 65536
+WS_EX_STATICEDGE = 131072
+WS_EX_APPWINDOW = 262144
+WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE)
+WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST)
+WS_EX_LAYERED = 0x00080000
+WS_EX_NOINHERITLAYOUT = 0x00100000
+WS_EX_LAYOUTRTL = 0x00400000
+WS_EX_COMPOSITED = 0x02000000
+WS_EX_NOACTIVATE = 0x08000000
+
+CS_VREDRAW = 1
+CS_HREDRAW = 2
+#CS_KEYCVTWINDOW = 0x0004
+CS_DBLCLKS = 8
+CS_OWNDC = 32
+CS_CLASSDC = 64
+CS_PARENTDC = 128
+#CS_NOKEYCVT = 0x0100
+CS_NOCLOSE = 512
+CS_SAVEBITS = 2048
+CS_BYTEALIGNCLIENT = 4096
+CS_BYTEALIGNWINDOW = 8192
+CS_GLOBALCLASS = 16384
+CS_IME = 65536
+PRF_CHECKVISIBLE = 1
+PRF_NONCLIENT = 2
+PRF_CLIENT = 4
+PRF_ERASEBKGND = 8
+PRF_CHILDREN = 16
+PRF_OWNED = 32
+BDR_RAISEDOUTER = 1
+BDR_SUNKENOUTER = 2
+BDR_RAISEDINNER = 4
+BDR_SUNKENINNER = 8
+BDR_OUTER = 3
+BDR_INNER = 12
+#BDR_RAISED = 0x0005
+#BDR_SUNKEN = 0x000a
+EDGE_RAISED = (BDR_RAISEDOUTER | BDR_RAISEDINNER)
+EDGE_SUNKEN = (BDR_SUNKENOUTER | BDR_SUNKENINNER)
+EDGE_ETCHED = (BDR_SUNKENOUTER | BDR_RAISEDINNER)
+EDGE_BUMP = (BDR_RAISEDOUTER | BDR_SUNKENINNER)
+
+# winuser.h line 2879
+ISMEX_NOSEND = 0
+ISMEX_SEND = 1
+ISMEX_NOTIFY = 2
+ISMEX_CALLBACK = 4
+ISMEX_REPLIED = 8
+CW_USEDEFAULT = -2147483648
+FLASHW_STOP = 0
+FLASHW_CAPTION = 1
+FLASHW_TRAY = 2
+FLASHW_ALL = (FLASHW_CAPTION | FLASHW_TRAY)
+FLASHW_TIMER = 4
+FLASHW_TIMERNOFG = 12
+
+# winuser.h line 7963
+DS_ABSALIGN = 1
+DS_SYSMODAL = 2
+DS_LOCALEDIT = 32
+DS_SETFONT = 64
+DS_MODALFRAME = 128
+DS_NOIDLEMSG = 256
+DS_SETFOREGROUND = 512
+DS_3DLOOK = 4
+DS_FIXEDSYS = 8
+DS_NOFAILCREATE = 16
+DS_CONTROL = 1024
+DS_CENTER = 2048
+DS_CENTERMOUSE = 4096
+DS_CONTEXTHELP = 8192
+DM_GETDEFID = (WM_USER+0)
+DM_SETDEFID = (WM_USER+1)
+DM_REPOSITION = (WM_USER+2)
+#PSM_PAGEINFO = (WM_USER+100)
+#PSM_SHEETINFO = (WM_USER+101)
+#PSI_SETACTIVE = 0x0001
+#PSI_KILLACTIVE = 0x0002
+#PSI_APPLY = 0x0003
+#PSI_RESET = 0x0004
+#PSI_HASHELP = 0x0005
+#PSI_HELP = 0x0006
+#PSI_CHANGED = 0x0001
+#PSI_GUISTART = 0x0002
+#PSI_REBOOT = 0x0003
+#PSI_GETSIBLINGS = 0x0004
+DC_HASDEFID = 21323
+DLGC_WANTARROWS = 1
+DLGC_WANTTAB = 2
+DLGC_WANTALLKEYS = 4
+DLGC_WANTMESSAGE = 4
+DLGC_HASSETSEL = 8
+DLGC_DEFPUSHBUTTON = 16
+DLGC_UNDEFPUSHBUTTON = 32
+DLGC_RADIOBUTTON = 64
+DLGC_WANTCHARS = 128
+DLGC_STATIC = 256
+DLGC_BUTTON = 8192
+LB_CTLCODE = 0
+LB_OKAY = 0
+LB_ERR = (-1)
+LB_ERRSPACE = (-2)
+LBN_ERRSPACE = (-2)
+LBN_SELCHANGE = 1
+LBN_DBLCLK = 2
+LBN_SELCANCEL = 3
+LBN_SETFOCUS = 4
+LBN_KILLFOCUS = 5
+LB_ADDSTRING = 384
+LB_INSERTSTRING = 385
+LB_DELETESTRING = 386
+LB_SELITEMRANGEEX = 387
+LB_RESETCONTENT = 388
+LB_SETSEL = 389
+LB_SETCURSEL = 390
+LB_GETSEL = 391
+LB_GETCURSEL = 392
+LB_GETTEXT = 393
+LB_GETTEXTLEN = 394
+LB_GETCOUNT = 395
+LB_SELECTSTRING = 396
+LB_DIR = 397
+LB_GETTOPINDEX = 398
+LB_FINDSTRING = 399
+LB_GETSELCOUNT = 400
+LB_GETSELITEMS = 401
+LB_SETTABSTOPS = 402
+LB_GETHORIZONTALEXTENT = 403
+LB_SETHORIZONTALEXTENT = 404
+LB_SETCOLUMNWIDTH = 405
+LB_ADDFILE = 406
+LB_SETTOPINDEX = 407
+LB_GETITEMRECT = 408
+LB_GETITEMDATA = 409
+LB_SETITEMDATA = 410
+LB_SELITEMRANGE = 411
+LB_SETANCHORINDEX = 412
+LB_GETANCHORINDEX = 413
+LB_SETCARETINDEX = 414
+LB_GETCARETINDEX = 415
+LB_SETITEMHEIGHT = 416
+LB_GETITEMHEIGHT = 417
+LB_FINDSTRINGEXACT = 418
+LB_SETLOCALE = 421
+LB_GETLOCALE = 422
+LB_SETCOUNT = 423
+LB_INITSTORAGE = 424
+LB_ITEMFROMPOINT = 425
+LB_MSGMAX = 432
+LBS_NOTIFY = 1
+LBS_SORT = 2
+LBS_NOREDRAW = 4
+LBS_MULTIPLESEL = 8
+LBS_OWNERDRAWFIXED = 16
+LBS_OWNERDRAWVARIABLE = 32
+LBS_HASSTRINGS = 64
+LBS_USETABSTOPS = 128
+LBS_NOINTEGRALHEIGHT = 256
+LBS_MULTICOLUMN = 512
+LBS_WANTKEYBOARDINPUT = 1024
+LBS_EXTENDEDSEL = 2048
+LBS_DISABLENOSCROLL = 4096
+LBS_NODATA = 8192
+LBS_NOSEL = 16384
+LBS_STANDARD = (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER)
+CB_OKAY = 0
+CB_ERR = (-1)
+CB_ERRSPACE = (-2)
+CBN_ERRSPACE = (-1)
+CBN_SELCHANGE = 1
+CBN_DBLCLK = 2
+CBN_SETFOCUS = 3
+CBN_KILLFOCUS = 4
+CBN_EDITCHANGE = 5
+CBN_EDITUPDATE = 6
+CBN_DROPDOWN = 7
+CBN_CLOSEUP = 8
+CBN_SELENDOK = 9
+CBN_SELENDCANCEL = 10
+CBS_SIMPLE = 1
+CBS_DROPDOWN = 2
+CBS_DROPDOWNLIST = 3
+CBS_OWNERDRAWFIXED = 16
+CBS_OWNERDRAWVARIABLE = 32
+CBS_AUTOHSCROLL = 64
+CBS_OEMCONVERT = 128
+CBS_SORT = 256
+CBS_HASSTRINGS = 512
+CBS_NOINTEGRALHEIGHT = 1024
+CBS_DISABLENOSCROLL = 2048
+CBS_UPPERCASE = 8192
+CBS_LOWERCASE = 16384
+CB_GETEDITSEL = 320
+CB_LIMITTEXT = 321
+CB_SETEDITSEL = 322
+CB_ADDSTRING = 323
+CB_DELETESTRING = 324
+CB_DIR = 325
+CB_GETCOUNT = 326
+CB_GETCURSEL = 327
+CB_GETLBTEXT = 328
+CB_GETLBTEXTLEN = 329
+CB_INSERTSTRING = 330
+CB_RESETCONTENT = 331
+CB_FINDSTRING = 332
+CB_SELECTSTRING = 333
+CB_SETCURSEL = 334
+CB_SHOWDROPDOWN = 335
+CB_GETITEMDATA = 336
+CB_SETITEMDATA = 337
+CB_GETDROPPEDCONTROLRECT = 338
+CB_SETITEMHEIGHT = 339
+CB_GETITEMHEIGHT = 340
+CB_SETEXTENDEDUI = 341
+CB_GETEXTENDEDUI = 342
+CB_GETDROPPEDSTATE = 343
+CB_FINDSTRINGEXACT = 344
+CB_SETLOCALE = 345
+CB_GETLOCALE = 346
+CB_GETTOPINDEX = 347
+CB_SETTOPINDEX = 348
+CB_GETHORIZONTALEXTENT = 349
+CB_SETHORIZONTALEXTENT = 350
+CB_GETDROPPEDWIDTH = 351
+CB_SETDROPPEDWIDTH = 352
+CB_INITSTORAGE = 353
+CB_MSGMAX = 354
+SBS_HORZ = 0
+SBS_VERT = 1
+SBS_TOPALIGN = 2
+SBS_LEFTALIGN = 2
+SBS_BOTTOMALIGN = 4
+SBS_RIGHTALIGN = 4
+SBS_SIZEBOXTOPLEFTALIGN = 2
+SBS_SIZEBOXBOTTOMRIGHTALIGN = 4
+SBS_SIZEBOX = 8
+SBS_SIZEGRIP = 16
+SBM_SETPOS = 224
+SBM_GETPOS = 225
+SBM_SETRANGE = 226
+SBM_SETRANGEREDRAW = 230
+SBM_GETRANGE = 227
+SBM_ENABLE_ARROWS = 228
+SBM_SETSCROLLINFO = 233
+SBM_GETSCROLLINFO = 234
+SIF_RANGE = 1
+SIF_PAGE = 2
+SIF_POS = 4
+SIF_DISABLENOSCROLL = 8
+SIF_TRACKPOS = 16
+SIF_ALL = (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS)
+MDIS_ALLCHILDSTYLES = 1
+MDITILE_VERTICAL = 0
+MDITILE_HORIZONTAL = 1
+MDITILE_SKIPDISABLED = 2
+
+IMC_GETCANDIDATEPOS = 7
+IMC_SETCANDIDATEPOS = 8
+IMC_GETCOMPOSITIONFONT = 9
+IMC_SETCOMPOSITIONFONT = 10
+IMC_GETCOMPOSITIONWINDOW = 11
+IMC_SETCOMPOSITIONWINDOW = 12
+IMC_GETSTATUSWINDOWPOS = 15
+IMC_SETSTATUSWINDOWPOS = 16
+IMC_CLOSESTATUSWINDOW = 33
+IMC_OPENSTATUSWINDOW = 34
+# Generated by h2py from \msvc20\include\winnt.h
+# hacked and split by mhammond.
+DELETE = (65536)
+READ_CONTROL = (131072)
+WRITE_DAC = (262144)
+WRITE_OWNER = (524288)
+SYNCHRONIZE = (1048576)
+STANDARD_RIGHTS_REQUIRED = (983040)
+STANDARD_RIGHTS_READ = (READ_CONTROL)
+STANDARD_RIGHTS_WRITE = (READ_CONTROL)
+STANDARD_RIGHTS_EXECUTE = (READ_CONTROL)
+STANDARD_RIGHTS_ALL = (2031616)
+SPECIFIC_RIGHTS_ALL = (65535)
+ACCESS_SYSTEM_SECURITY = (16777216)
+MAXIMUM_ALLOWED = (33554432)
+GENERIC_READ = (-2147483648)
+GENERIC_WRITE = (1073741824)
+GENERIC_EXECUTE = (536870912)
+GENERIC_ALL = (268435456)
+
+SERVICE_KERNEL_DRIVER = 1
+SERVICE_FILE_SYSTEM_DRIVER = 2
+SERVICE_ADAPTER = 4
+SERVICE_RECOGNIZER_DRIVER = 8
+SERVICE_DRIVER = (SERVICE_KERNEL_DRIVER | \
+ SERVICE_FILE_SYSTEM_DRIVER | \
+ SERVICE_RECOGNIZER_DRIVER)
+SERVICE_WIN32_OWN_PROCESS = 16
+SERVICE_WIN32_SHARE_PROCESS = 32
+SERVICE_WIN32 = (SERVICE_WIN32_OWN_PROCESS | \
+ SERVICE_WIN32_SHARE_PROCESS)
+SERVICE_INTERACTIVE_PROCESS = 256
+SERVICE_TYPE_ALL = (SERVICE_WIN32 | \
+ SERVICE_ADAPTER | \
+ SERVICE_DRIVER | \
+ SERVICE_INTERACTIVE_PROCESS)
+SERVICE_BOOT_START = 0
+SERVICE_SYSTEM_START = 1
+SERVICE_AUTO_START = 2
+SERVICE_DEMAND_START = 3
+SERVICE_DISABLED = 4
+SERVICE_ERROR_IGNORE = 0
+SERVICE_ERROR_NORMAL = 1
+SERVICE_ERROR_SEVERE = 2
+SERVICE_ERROR_CRITICAL = 3
+TAPE_ERASE_SHORT = 0
+TAPE_ERASE_LONG = 1
+TAPE_LOAD = 0
+TAPE_UNLOAD = 1
+TAPE_TENSION = 2
+TAPE_LOCK = 3
+TAPE_UNLOCK = 4
+TAPE_FORMAT = 5
+TAPE_SETMARKS = 0
+TAPE_FILEMARKS = 1
+TAPE_SHORT_FILEMARKS = 2
+TAPE_LONG_FILEMARKS = 3
+TAPE_ABSOLUTE_POSITION = 0
+TAPE_LOGICAL_POSITION = 1
+TAPE_PSEUDO_LOGICAL_POSITION = 2
+TAPE_REWIND = 0
+TAPE_ABSOLUTE_BLOCK = 1
+TAPE_LOGICAL_BLOCK = 2
+TAPE_PSEUDO_LOGICAL_BLOCK = 3
+TAPE_SPACE_END_OF_DATA = 4
+TAPE_SPACE_RELATIVE_BLOCKS = 5
+TAPE_SPACE_FILEMARKS = 6
+TAPE_SPACE_SEQUENTIAL_FMKS = 7
+TAPE_SPACE_SETMARKS = 8
+TAPE_SPACE_SEQUENTIAL_SMKS = 9
+TAPE_DRIVE_FIXED = 1
+TAPE_DRIVE_SELECT = 2
+TAPE_DRIVE_INITIATOR = 4
+TAPE_DRIVE_ERASE_SHORT = 16
+TAPE_DRIVE_ERASE_LONG = 32
+TAPE_DRIVE_ERASE_BOP_ONLY = 64
+TAPE_DRIVE_ERASE_IMMEDIATE = 128
+TAPE_DRIVE_TAPE_CAPACITY = 256
+TAPE_DRIVE_TAPE_REMAINING = 512
+TAPE_DRIVE_FIXED_BLOCK = 1024
+TAPE_DRIVE_VARIABLE_BLOCK = 2048
+TAPE_DRIVE_WRITE_PROTECT = 4096
+TAPE_DRIVE_EOT_WZ_SIZE = 8192
+TAPE_DRIVE_ECC = 65536
+TAPE_DRIVE_COMPRESSION = 131072
+TAPE_DRIVE_PADDING = 262144
+TAPE_DRIVE_REPORT_SMKS = 524288
+TAPE_DRIVE_GET_ABSOLUTE_BLK = 1048576
+TAPE_DRIVE_GET_LOGICAL_BLK = 2097152
+TAPE_DRIVE_SET_EOT_WZ_SIZE = 4194304
+TAPE_DRIVE_LOAD_UNLOAD = -2147483647
+TAPE_DRIVE_TENSION = -2147483646
+TAPE_DRIVE_LOCK_UNLOCK = -2147483644
+TAPE_DRIVE_REWIND_IMMEDIATE = -2147483640
+TAPE_DRIVE_SET_BLOCK_SIZE = -2147483632
+TAPE_DRIVE_LOAD_UNLD_IMMED = -2147483616
+TAPE_DRIVE_TENSION_IMMED = -2147483584
+TAPE_DRIVE_LOCK_UNLK_IMMED = -2147483520
+TAPE_DRIVE_SET_ECC = -2147483392
+TAPE_DRIVE_SET_COMPRESSION = -2147483136
+TAPE_DRIVE_SET_PADDING = -2147482624
+TAPE_DRIVE_SET_REPORT_SMKS = -2147481600
+TAPE_DRIVE_ABSOLUTE_BLK = -2147479552
+TAPE_DRIVE_ABS_BLK_IMMED = -2147475456
+TAPE_DRIVE_LOGICAL_BLK = -2147467264
+TAPE_DRIVE_LOG_BLK_IMMED = -2147450880
+TAPE_DRIVE_END_OF_DATA = -2147418112
+TAPE_DRIVE_RELATIVE_BLKS = -2147352576
+TAPE_DRIVE_FILEMARKS = -2147221504
+TAPE_DRIVE_SEQUENTIAL_FMKS = -2146959360
+TAPE_DRIVE_SETMARKS = -2146435072
+TAPE_DRIVE_SEQUENTIAL_SMKS = -2145386496
+TAPE_DRIVE_REVERSE_POSITION = -2143289344
+TAPE_DRIVE_SPACE_IMMEDIATE = -2139095040
+TAPE_DRIVE_WRITE_SETMARKS = -2130706432
+TAPE_DRIVE_WRITE_FILEMARKS = -2113929216
+TAPE_DRIVE_WRITE_SHORT_FMKS = -2080374784
+TAPE_DRIVE_WRITE_LONG_FMKS = -2013265920
+TAPE_DRIVE_WRITE_MARK_IMMED = -1879048192
+TAPE_DRIVE_FORMAT = -1610612736
+TAPE_DRIVE_FORMAT_IMMEDIATE = -1073741824
+TAPE_FIXED_PARTITIONS = 0
+TAPE_SELECT_PARTITIONS = 1
+TAPE_INITIATOR_PARTITIONS = 2
+# Generated by h2py from \msvc20\include\winnt.h
+# hacked and split by mhammond.
+
+APPLICATION_ERROR_MASK = 536870912
+ERROR_SEVERITY_SUCCESS = 0
+ERROR_SEVERITY_INFORMATIONAL = 1073741824
+ERROR_SEVERITY_WARNING = -2147483648
+ERROR_SEVERITY_ERROR = -1073741824
+MINCHAR = 128
+MAXCHAR = 127
+MINSHORT = 32768
+MAXSHORT = 32767
+MINLONG = -2147483648
+MAXLONG = 2147483647
+MAXBYTE = 255
+MAXWORD = 65535
+MAXDWORD = -1
+LANG_NEUTRAL = 0
+LANG_BULGARIAN = 2
+LANG_CHINESE = 4
+LANG_CROATIAN = 26
+LANG_CZECH = 5
+LANG_DANISH = 6
+LANG_DUTCH = 19
+LANG_ENGLISH = 9
+LANG_FINNISH = 11
+LANG_FRENCH = 12
+LANG_GERMAN = 7
+LANG_GREEK = 8
+LANG_HUNGARIAN = 14
+LANG_ICELANDIC = 15
+LANG_ITALIAN = 16
+LANG_JAPANESE = 17
+LANG_KOREAN = 18
+LANG_NORWEGIAN = 20
+LANG_POLISH = 21
+LANG_PORTUGUESE = 22
+LANG_ROMANIAN = 24
+LANG_RUSSIAN = 25
+LANG_SLOVAK = 27
+LANG_SLOVENIAN = 36
+LANG_SPANISH = 10
+LANG_SWEDISH = 29
+LANG_TURKISH = 31
+SUBLANG_NEUTRAL = 0
+SUBLANG_DEFAULT = 1
+SUBLANG_SYS_DEFAULT = 2
+SUBLANG_CHINESE_TRADITIONAL = 1
+SUBLANG_CHINESE_SIMPLIFIED = 2
+SUBLANG_CHINESE_HONGKONG = 3
+SUBLANG_CHINESE_SINGAPORE = 4
+SUBLANG_DUTCH = 1
+SUBLANG_DUTCH_BELGIAN = 2
+SUBLANG_ENGLISH_US = 1
+SUBLANG_ENGLISH_UK = 2
+SUBLANG_ENGLISH_AUS = 3
+SUBLANG_ENGLISH_CAN = 4
+SUBLANG_ENGLISH_NZ = 5
+SUBLANG_ENGLISH_EIRE = 6
+SUBLANG_FRENCH = 1
+SUBLANG_FRENCH_BELGIAN = 2
+SUBLANG_FRENCH_CANADIAN = 3
+SUBLANG_FRENCH_SWISS = 4
+SUBLANG_GERMAN = 1
+SUBLANG_GERMAN_SWISS = 2
+SUBLANG_GERMAN_AUSTRIAN = 3
+SUBLANG_ITALIAN = 1
+SUBLANG_ITALIAN_SWISS = 2
+SUBLANG_NORWEGIAN_BOKMAL = 1
+SUBLANG_NORWEGIAN_NYNORSK = 2
+SUBLANG_PORTUGUESE = 2
+SUBLANG_PORTUGUESE_BRAZILIAN = 1
+SUBLANG_SPANISH = 1
+SUBLANG_SPANISH_MEXICAN = 2
+SUBLANG_SPANISH_MODERN = 3
+SORT_DEFAULT = 0
+SORT_JAPANESE_XJIS = 0
+SORT_JAPANESE_UNICODE = 1
+SORT_CHINESE_BIG5 = 0
+SORT_CHINESE_UNICODE = 1
+SORT_KOREAN_KSC = 0
+SORT_KOREAN_UNICODE = 1
+def PRIMARYLANGID(lgid): return ((lgid) & 1023)
+
+def SUBLANGID(lgid): return ((lgid) >> 10)
+
+NLS_VALID_LOCALE_MASK = 1048575
+CONTEXT_PORTABLE_32BIT = 1048576
+CONTEXT_ALPHA = 131072
+CONTEXT_CONTROL = (CONTEXT_ALPHA | 1)
+CONTEXT_FLOATING_POINT = (CONTEXT_ALPHA | 2)
+CONTEXT_INTEGER = (CONTEXT_ALPHA | 4)
+CONTEXT_FULL = (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
+SIZE_OF_80387_REGISTERS = 80
+CONTEXT_FULL = (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
+CONTEXT_CONTROL = 1
+CONTEXT_FLOATING_POINT = 2
+CONTEXT_INTEGER = 4
+CONTEXT_FULL = (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
+PROCESS_TERMINATE = (1)
+PROCESS_CREATE_THREAD = (2)
+PROCESS_VM_OPERATION = (8)
+PROCESS_VM_READ = (16)
+PROCESS_VM_WRITE = (32)
+PROCESS_DUP_HANDLE = (64)
+PROCESS_CREATE_PROCESS = (128)
+PROCESS_SET_QUOTA = (256)
+PROCESS_SET_INFORMATION = (512)
+PROCESS_QUERY_INFORMATION = (1024)
+PROCESS_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 4095)
+THREAD_TERMINATE = (1)
+THREAD_SUSPEND_RESUME = (2)
+THREAD_GET_CONTEXT = (8)
+THREAD_SET_CONTEXT = (16)
+THREAD_SET_INFORMATION = (32)
+THREAD_QUERY_INFORMATION = (64)
+THREAD_SET_THREAD_TOKEN = (128)
+THREAD_IMPERSONATE = (256)
+THREAD_DIRECT_IMPERSONATION = (512)
+TLS_MINIMUM_AVAILABLE = 64
+EVENT_MODIFY_STATE = 2
+MUTANT_QUERY_STATE = 1
+SEMAPHORE_MODIFY_STATE = 2
+TIME_ZONE_ID_UNKNOWN = 0
+TIME_ZONE_ID_STANDARD = 1
+TIME_ZONE_ID_DAYLIGHT = 2
+PROCESSOR_INTEL_386 = 386
+PROCESSOR_INTEL_486 = 486
+PROCESSOR_INTEL_PENTIUM = 586
+PROCESSOR_INTEL_860 = 860
+PROCESSOR_MIPS_R2000 = 2000
+PROCESSOR_MIPS_R3000 = 3000
+PROCESSOR_MIPS_R4000 = 4000
+PROCESSOR_ALPHA_21064 = 21064
+PROCESSOR_PPC_601 = 601
+PROCESSOR_PPC_603 = 603
+PROCESSOR_PPC_604 = 604
+PROCESSOR_PPC_620 = 620
+SECTION_QUERY = 1
+SECTION_MAP_WRITE = 2
+SECTION_MAP_READ = 4
+SECTION_MAP_EXECUTE = 8
+SECTION_EXTEND_SIZE = 16
+PAGE_NOACCESS = 1
+PAGE_READONLY = 2
+PAGE_READWRITE = 4
+PAGE_WRITECOPY = 8
+PAGE_EXECUTE = 16
+PAGE_EXECUTE_READ = 32
+PAGE_EXECUTE_READWRITE = 64
+PAGE_EXECUTE_WRITECOPY = 128
+PAGE_GUARD = 256
+PAGE_NOCACHE = 512
+MEM_COMMIT = 4096
+MEM_RESERVE = 8192
+MEM_DECOMMIT = 16384
+MEM_RELEASE = 32768
+MEM_FREE = 65536
+MEM_PRIVATE = 131072
+MEM_MAPPED = 262144
+MEM_TOP_DOWN = 1048576
+
+# Generated by h2py from \msvc20\include\winnt.h
+# hacked and split by mhammond.
+SEC_FILE = 8388608
+SEC_IMAGE = 16777216
+SEC_RESERVE = 67108864
+SEC_COMMIT = 134217728
+SEC_NOCACHE = 268435456
+MEM_IMAGE = SEC_IMAGE
+FILE_SHARE_READ = 1
+FILE_SHARE_WRITE = 2
+FILE_SHARE_DELETE = 4
+FILE_ATTRIBUTE_READONLY = 1
+FILE_ATTRIBUTE_HIDDEN = 2
+FILE_ATTRIBUTE_SYSTEM = 4
+FILE_ATTRIBUTE_DIRECTORY = 16
+FILE_ATTRIBUTE_ARCHIVE = 32
+FILE_ATTRIBUTE_NORMAL = 128
+FILE_ATTRIBUTE_TEMPORARY = 256
+FILE_ATTRIBUTE_ATOMIC_WRITE = 512
+FILE_ATTRIBUTE_XACTION_WRITE = 1024
+FILE_ATTRIBUTE_COMPRESSED = 2048
+FILE_NOTIFY_CHANGE_FILE_NAME = 1
+FILE_NOTIFY_CHANGE_DIR_NAME = 2
+FILE_NOTIFY_CHANGE_ATTRIBUTES = 4
+FILE_NOTIFY_CHANGE_SIZE = 8
+FILE_NOTIFY_CHANGE_LAST_WRITE = 16
+FILE_NOTIFY_CHANGE_SECURITY = 256
+FILE_CASE_SENSITIVE_SEARCH = 1
+FILE_CASE_PRESERVED_NAMES = 2
+FILE_UNICODE_ON_DISK = 4
+FILE_PERSISTENT_ACLS = 8
+FILE_FILE_COMPRESSION = 16
+FILE_VOLUME_IS_COMPRESSED = 32768
+IO_COMPLETION_MODIFY_STATE = 2
+DUPLICATE_CLOSE_SOURCE = 1
+DUPLICATE_SAME_ACCESS = 2
+SID_MAX_SUB_AUTHORITIES = (15)
+SECURITY_NULL_RID = (0)
+SECURITY_WORLD_RID = (0)
+SECURITY_LOCAL_RID = (0X00000000)
+SECURITY_CREATOR_OWNER_RID = (0)
+SECURITY_CREATOR_GROUP_RID = (1)
+SECURITY_DIALUP_RID = (1)
+SECURITY_NETWORK_RID = (2)
+SECURITY_BATCH_RID = (3)
+SECURITY_INTERACTIVE_RID = (4)
+SECURITY_SERVICE_RID = (6)
+SECURITY_ANONYMOUS_LOGON_RID = (7)
+SECURITY_LOGON_IDS_RID = (5)
+SECURITY_LOGON_IDS_RID_COUNT = (3)
+SECURITY_LOCAL_SYSTEM_RID = (18)
+SECURITY_NT_NON_UNIQUE = (21)
+SECURITY_BUILTIN_DOMAIN_RID = (32)
+DOMAIN_USER_RID_ADMIN = (500)
+DOMAIN_USER_RID_GUEST = (501)
+DOMAIN_GROUP_RID_ADMINS = (512)
+DOMAIN_GROUP_RID_USERS = (513)
+DOMAIN_GROUP_RID_GUESTS = (514)
+DOMAIN_ALIAS_RID_ADMINS = (544)
+DOMAIN_ALIAS_RID_USERS = (545)
+DOMAIN_ALIAS_RID_GUESTS = (546)
+DOMAIN_ALIAS_RID_POWER_USERS = (547)
+DOMAIN_ALIAS_RID_ACCOUNT_OPS = (548)
+DOMAIN_ALIAS_RID_SYSTEM_OPS = (549)
+DOMAIN_ALIAS_RID_PRINT_OPS = (550)
+DOMAIN_ALIAS_RID_BACKUP_OPS = (551)
+DOMAIN_ALIAS_RID_REPLICATOR = (552)
+SE_GROUP_MANDATORY = (1)
+SE_GROUP_ENABLED_BY_DEFAULT = (2)
+SE_GROUP_ENABLED = (4)
+SE_GROUP_OWNER = (8)
+SE_GROUP_LOGON_ID = (-1073741824)
+ACL_REVISION = (2)
+ACL_REVISION1 = (1)
+ACL_REVISION2 = (2)
+ACCESS_ALLOWED_ACE_TYPE = (0)
+ACCESS_DENIED_ACE_TYPE = (1)
+SYSTEM_AUDIT_ACE_TYPE = (2)
+SYSTEM_ALARM_ACE_TYPE = (3)
+OBJECT_INHERIT_ACE = (1)
+CONTAINER_INHERIT_ACE = (2)
+NO_PROPAGATE_INHERIT_ACE = (4)
+INHERIT_ONLY_ACE = (8)
+VALID_INHERIT_FLAGS = (15)
+SUCCESSFUL_ACCESS_ACE_FLAG = (64)
+FAILED_ACCESS_ACE_FLAG = (128)
+SECURITY_DESCRIPTOR_REVISION = (1)
+SECURITY_DESCRIPTOR_REVISION1 = (1)
+SECURITY_DESCRIPTOR_MIN_LENGTH = (20)
+SE_OWNER_DEFAULTED = (1)
+SE_GROUP_DEFAULTED = (2)
+SE_DACL_PRESENT = (4)
+SE_DACL_DEFAULTED = (8)
+SE_SACL_PRESENT = (16)
+SE_SACL_DEFAULTED = (32)
+SE_SELF_RELATIVE = (32768)
+SE_PRIVILEGE_ENABLED_BY_DEFAULT = (1)
+SE_PRIVILEGE_ENABLED = (2)
+SE_PRIVILEGE_USED_FOR_ACCESS = (-2147483648)
+PRIVILEGE_SET_ALL_NECESSARY = (1)
+SE_CREATE_TOKEN_NAME = "SeCreateTokenPrivilege"
+SE_ASSIGNPRIMARYTOKEN_NAME = "SeAssignPrimaryTokenPrivilege"
+SE_LOCK_MEMORY_NAME = "SeLockMemoryPrivilege"
+SE_INCREASE_QUOTA_NAME = "SeIncreaseQuotaPrivilege"
+SE_UNSOLICITED_INPUT_NAME = "SeUnsolicitedInputPrivilege"
+SE_MACHINE_ACCOUNT_NAME = "SeMachineAccountPrivilege"
+SE_TCB_NAME = "SeTcbPrivilege"
+SE_SECURITY_NAME = "SeSecurityPrivilege"
+SE_TAKE_OWNERSHIP_NAME = "SeTakeOwnershipPrivilege"
+SE_LOAD_DRIVER_NAME = "SeLoadDriverPrivilege"
+SE_SYSTEM_PROFILE_NAME = "SeSystemProfilePrivilege"
+SE_SYSTEMTIME_NAME = "SeSystemtimePrivilege"
+SE_PROF_SINGLE_PROCESS_NAME = "SeProfileSingleProcessPrivilege"
+SE_INC_BASE_PRIORITY_NAME = "SeIncreaseBasePriorityPrivilege"
+SE_CREATE_PAGEFILE_NAME = "SeCreatePagefilePrivilege"
+SE_CREATE_PERMANENT_NAME = "SeCreatePermanentPrivilege"
+SE_BACKUP_NAME = "SeBackupPrivilege"
+SE_RESTORE_NAME = "SeRestorePrivilege"
+SE_SHUTDOWN_NAME = "SeShutdownPrivilege"
+SE_DEBUG_NAME = "SeDebugPrivilege"
+SE_AUDIT_NAME = "SeAuditPrivilege"
+SE_SYSTEM_ENVIRONMENT_NAME = "SeSystemEnvironmentPrivilege"
+SE_CHANGE_NOTIFY_NAME = "SeChangeNotifyPrivilege"
+SE_REMOTE_SHUTDOWN_NAME = "SeRemoteShutdownPrivilege"
+
+TOKEN_ASSIGN_PRIMARY = (1)
+TOKEN_DUPLICATE = (2)
+TOKEN_IMPERSONATE = (4)
+TOKEN_QUERY = (8)
+TOKEN_QUERY_SOURCE = (16)
+TOKEN_ADJUST_PRIVILEGES = (32)
+TOKEN_ADJUST_GROUPS = (64)
+TOKEN_ADJUST_DEFAULT = (128)
+TOKEN_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED |\
+ TOKEN_ASSIGN_PRIMARY |\
+ TOKEN_DUPLICATE |\
+ TOKEN_IMPERSONATE |\
+ TOKEN_QUERY |\
+ TOKEN_QUERY_SOURCE |\
+ TOKEN_ADJUST_PRIVILEGES |\
+ TOKEN_ADJUST_GROUPS |\
+ TOKEN_ADJUST_DEFAULT)
+TOKEN_READ = (STANDARD_RIGHTS_READ |\
+ TOKEN_QUERY)
+TOKEN_WRITE = (STANDARD_RIGHTS_WRITE |\
+ TOKEN_ADJUST_PRIVILEGES |\
+ TOKEN_ADJUST_GROUPS |\
+ TOKEN_ADJUST_DEFAULT)
+TOKEN_EXECUTE = (STANDARD_RIGHTS_EXECUTE)
+TOKEN_SOURCE_LENGTH = 8
+
+KEY_QUERY_VALUE = (1)
+KEY_SET_VALUE = (2)
+KEY_CREATE_SUB_KEY = (4)
+KEY_ENUMERATE_SUB_KEYS = (8)
+KEY_NOTIFY = (16)
+KEY_CREATE_LINK = (32)
+KEY_READ = ((STANDARD_RIGHTS_READ |\
+ KEY_QUERY_VALUE |\
+ KEY_ENUMERATE_SUB_KEYS |\
+ KEY_NOTIFY) \
+ & \
+ (~SYNCHRONIZE))
+KEY_WRITE = ((STANDARD_RIGHTS_WRITE |\
+ KEY_SET_VALUE |\
+ KEY_CREATE_SUB_KEY) \
+ & \
+ (~SYNCHRONIZE))
+KEY_EXECUTE = ((KEY_READ) \
+ & \
+ (~SYNCHRONIZE))
+KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL |\
+ KEY_QUERY_VALUE |\
+ KEY_SET_VALUE |\
+ KEY_CREATE_SUB_KEY |\
+ KEY_ENUMERATE_SUB_KEYS |\
+ KEY_NOTIFY |\
+ KEY_CREATE_LINK) \
+ & \
+ (~SYNCHRONIZE))
+REG_NOTIFY_CHANGE_ATTRIBUTES = (2)
+REG_NOTIFY_CHANGE_SECURITY = (8)
+REG_RESOURCE_REQUIREMENTS_LIST = ( 10 )
+REG_NONE = ( 0 ) # No value type
+REG_SZ = ( 1 ) # Unicode nul terminated string
+REG_EXPAND_SZ = ( 2 ) # Unicode nul terminated string
+ # (with environment variable references)
+REG_BINARY = ( 3 ) # Free form binary
+REG_DWORD = ( 4 ) # 32-bit number
+REG_DWORD_LITTLE_ENDIAN = ( 4 ) # 32-bit number (same as REG_DWORD)
+REG_DWORD_BIG_ENDIAN = ( 5 ) # 32-bit number
+REG_LINK = ( 6 ) # Symbolic Link (unicode)
+REG_MULTI_SZ = ( 7 ) # Multiple Unicode strings
+REG_RESOURCE_LIST = ( 8 ) # Resource list in the resource map
+REG_FULL_RESOURCE_DESCRIPTOR =( 9 ) # Resource list in the hardware description
+REG_RESOURCE_REQUIREMENTS_LIST = ( 10 )
+REG_QWORD = ( 11 ) # 64-bit number
+REG_QWORD_LITTLE_ENDIAN = ( 11 ) # 64-bit number (same as REG_QWORD)
+
+
+# Generated by h2py from \msvc20\include\winnt.h
+# hacked and split by mhammond.
+# Included from string.h
+_NLSCMPERROR = 2147483647
+NULL = 0
+HEAP_NO_SERIALIZE = 1
+HEAP_GROWABLE = 2
+HEAP_GENERATE_EXCEPTIONS = 4
+HEAP_ZERO_MEMORY = 8
+HEAP_REALLOC_IN_PLACE_ONLY = 16
+HEAP_TAIL_CHECKING_ENABLED = 32
+HEAP_FREE_CHECKING_ENABLED = 64
+HEAP_DISABLE_COALESCE_ON_FREE = 128
+IS_TEXT_UNICODE_ASCII16 = 1
+IS_TEXT_UNICODE_REVERSE_ASCII16 = 16
+IS_TEXT_UNICODE_STATISTICS = 2
+IS_TEXT_UNICODE_REVERSE_STATISTICS = 32
+IS_TEXT_UNICODE_CONTROLS = 4
+IS_TEXT_UNICODE_REVERSE_CONTROLS = 64
+IS_TEXT_UNICODE_SIGNATURE = 8
+IS_TEXT_UNICODE_REVERSE_SIGNATURE = 128
+IS_TEXT_UNICODE_ILLEGAL_CHARS = 256
+IS_TEXT_UNICODE_ODD_LENGTH = 512
+IS_TEXT_UNICODE_DBCS_LEADBYTE = 1024
+IS_TEXT_UNICODE_NULL_BYTES = 4096
+IS_TEXT_UNICODE_UNICODE_MASK = 15
+IS_TEXT_UNICODE_REVERSE_MASK = 240
+IS_TEXT_UNICODE_NOT_UNICODE_MASK = 3840
+IS_TEXT_UNICODE_NOT_ASCII_MASK = 61440
+COMPRESSION_FORMAT_NONE = (0)
+COMPRESSION_FORMAT_DEFAULT = (1)
+COMPRESSION_FORMAT_LZNT1 = (2)
+COMPRESSION_ENGINE_STANDARD = (0)
+COMPRESSION_ENGINE_MAXIMUM = (256)
+MESSAGE_RESOURCE_UNICODE = 1
+RTL_CRITSECT_TYPE = 0
+RTL_RESOURCE_TYPE = 1
+DLL_PROCESS_ATTACH = 1
+DLL_THREAD_ATTACH = 2
+DLL_THREAD_DETACH = 3
+DLL_PROCESS_DETACH = 0
+EVENTLOG_SEQUENTIAL_READ = 0X0001
+EVENTLOG_SEEK_READ = 0X0002
+EVENTLOG_FORWARDS_READ = 0X0004
+EVENTLOG_BACKWARDS_READ = 0X0008
+EVENTLOG_SUCCESS = 0X0000
+EVENTLOG_ERROR_TYPE = 1
+EVENTLOG_WARNING_TYPE = 2
+EVENTLOG_INFORMATION_TYPE = 4
+EVENTLOG_AUDIT_SUCCESS = 8
+EVENTLOG_AUDIT_FAILURE = 16
+EVENTLOG_START_PAIRED_EVENT = 1
+EVENTLOG_END_PAIRED_EVENT = 2
+EVENTLOG_END_ALL_PAIRED_EVENTS = 4
+EVENTLOG_PAIRED_EVENT_ACTIVE = 8
+EVENTLOG_PAIRED_EVENT_INACTIVE = 16
+# Generated by h2py from \msvc20\include\winnt.h
+# hacked and split by mhammond.
+OWNER_SECURITY_INFORMATION = (0X00000001)
+GROUP_SECURITY_INFORMATION = (0X00000002)
+DACL_SECURITY_INFORMATION = (0X00000004)
+SACL_SECURITY_INFORMATION = (0X00000008)
+IMAGE_SIZEOF_FILE_HEADER = 20
+IMAGE_FILE_MACHINE_UNKNOWN = 0
+IMAGE_NUMBEROF_DIRECTORY_ENTRIES = 16
+IMAGE_SIZEOF_ROM_OPTIONAL_HEADER = 56
+IMAGE_SIZEOF_STD_OPTIONAL_HEADER = 28
+IMAGE_SIZEOF_NT_OPTIONAL_HEADER = 224
+IMAGE_NT_OPTIONAL_HDR_MAGIC = 267
+IMAGE_ROM_OPTIONAL_HDR_MAGIC = 263
+IMAGE_SIZEOF_SHORT_NAME = 8
+IMAGE_SIZEOF_SECTION_HEADER = 40
+IMAGE_SIZEOF_SYMBOL = 18
+IMAGE_SYM_CLASS_NULL = 0
+IMAGE_SYM_CLASS_AUTOMATIC = 1
+IMAGE_SYM_CLASS_EXTERNAL = 2
+IMAGE_SYM_CLASS_STATIC = 3
+IMAGE_SYM_CLASS_REGISTER = 4
+IMAGE_SYM_CLASS_EXTERNAL_DEF = 5
+IMAGE_SYM_CLASS_LABEL = 6
+IMAGE_SYM_CLASS_UNDEFINED_LABEL = 7
+IMAGE_SYM_CLASS_MEMBER_OF_STRUCT = 8
+IMAGE_SYM_CLASS_ARGUMENT = 9
+IMAGE_SYM_CLASS_STRUCT_TAG = 10
+IMAGE_SYM_CLASS_MEMBER_OF_UNION = 11
+IMAGE_SYM_CLASS_UNION_TAG = 12
+IMAGE_SYM_CLASS_TYPE_DEFINITION = 13
+IMAGE_SYM_CLASS_UNDEFINED_STATIC = 14
+IMAGE_SYM_CLASS_ENUM_TAG = 15
+IMAGE_SYM_CLASS_MEMBER_OF_ENUM = 16
+IMAGE_SYM_CLASS_REGISTER_PARAM = 17
+IMAGE_SYM_CLASS_BIT_FIELD = 18
+IMAGE_SYM_CLASS_BLOCK = 100
+IMAGE_SYM_CLASS_FUNCTION = 101
+IMAGE_SYM_CLASS_END_OF_STRUCT = 102
+IMAGE_SYM_CLASS_FILE = 103
+IMAGE_SYM_CLASS_SECTION = 104
+IMAGE_SYM_CLASS_WEAK_EXTERNAL = 105
+N_BTMASK = 0o17
+N_TMASK = 0o60
+N_TMASK1 = 0o300
+N_TMASK2 = 0o360
+N_BTSHFT = 4
+N_TSHIFT = 2
+IMAGE_SIZEOF_AUX_SYMBOL = 18
+IMAGE_COMDAT_SELECT_NODUPLICATES = 1
+IMAGE_COMDAT_SELECT_ANY = 2
+IMAGE_COMDAT_SELECT_SAME_SIZE = 3
+IMAGE_COMDAT_SELECT_EXACT_MATCH = 4
+IMAGE_COMDAT_SELECT_ASSOCIATIVE = 5
+IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY = 1
+IMAGE_WEAK_EXTERN_SEARCH_LIBRARY = 2
+IMAGE_WEAK_EXTERN_SEARCH_ALIAS = 3
+IMAGE_SIZEOF_RELOCATION = 10
+IMAGE_REL_I386_SECTION = 0o12
+IMAGE_REL_I386_SECREL = 0o13
+IMAGE_REL_MIPS_REFHALF = 0o1
+IMAGE_REL_MIPS_REFWORD = 0o2
+IMAGE_REL_MIPS_JMPADDR = 0o3
+IMAGE_REL_MIPS_REFHI = 0o4
+IMAGE_REL_MIPS_REFLO = 0o5
+IMAGE_REL_MIPS_GPREL = 0o6
+IMAGE_REL_MIPS_LITERAL = 0o7
+IMAGE_REL_MIPS_SECTION = 0o12
+IMAGE_REL_MIPS_SECREL = 0o13
+IMAGE_REL_MIPS_REFWORDNB = 0o42
+IMAGE_REL_MIPS_PAIR = 0o45
+IMAGE_REL_ALPHA_ABSOLUTE = 0
+IMAGE_REL_ALPHA_REFLONG = 1
+IMAGE_REL_ALPHA_REFQUAD = 2
+IMAGE_REL_ALPHA_GPREL32 = 3
+IMAGE_REL_ALPHA_LITERAL = 4
+IMAGE_REL_ALPHA_LITUSE = 5
+IMAGE_REL_ALPHA_GPDISP = 6
+IMAGE_REL_ALPHA_BRADDR = 7
+IMAGE_REL_ALPHA_HINT = 8
+IMAGE_REL_ALPHA_INLINE_REFLONG = 9
+IMAGE_REL_ALPHA_REFHI = 10
+IMAGE_REL_ALPHA_REFLO = 11
+IMAGE_REL_ALPHA_PAIR = 12
+IMAGE_REL_ALPHA_MATCH = 13
+IMAGE_REL_ALPHA_SECTION = 14
+IMAGE_REL_ALPHA_SECREL = 15
+IMAGE_REL_ALPHA_REFLONGNB = 16
+IMAGE_SIZEOF_BASE_RELOCATION = 8
+IMAGE_REL_BASED_ABSOLUTE = 0
+IMAGE_REL_BASED_HIGH = 1
+IMAGE_REL_BASED_LOW = 2
+IMAGE_REL_BASED_HIGHLOW = 3
+IMAGE_REL_BASED_HIGHADJ = 4
+IMAGE_REL_BASED_MIPS_JMPADDR = 5
+IMAGE_SIZEOF_LINENUMBER = 6
+IMAGE_ARCHIVE_START_SIZE = 8
+IMAGE_ARCHIVE_START = "!\n"
+IMAGE_ARCHIVE_END = "`\n"
+IMAGE_ARCHIVE_PAD = "\n"
+IMAGE_ARCHIVE_LINKER_MEMBER = "/ "
+IMAGE_ARCHIVE_LONGNAMES_MEMBER = "// "
+IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR = 60
+IMAGE_ORDINAL_FLAG = -2147483648
+def IMAGE_SNAP_BY_ORDINAL(Ordinal): return ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
+
+def IMAGE_ORDINAL(Ordinal): return (Ordinal & 65535)
+
+IMAGE_RESOURCE_NAME_IS_STRING = -2147483648
+IMAGE_RESOURCE_DATA_IS_DIRECTORY = -2147483648
+IMAGE_DEBUG_TYPE_UNKNOWN = 0
+IMAGE_DEBUG_TYPE_COFF = 1
+IMAGE_DEBUG_TYPE_CODEVIEW = 2
+IMAGE_DEBUG_TYPE_FPO = 3
+IMAGE_DEBUG_TYPE_MISC = 4
+IMAGE_DEBUG_TYPE_EXCEPTION = 5
+IMAGE_DEBUG_TYPE_FIXUP = 6
+IMAGE_DEBUG_TYPE_OMAP_TO_SRC = 7
+IMAGE_DEBUG_TYPE_OMAP_FROM_SRC = 8
+FRAME_FPO = 0
+FRAME_TRAP = 1
+FRAME_TSS = 2
+SIZEOF_RFPO_DATA = 16
+IMAGE_DEBUG_MISC_EXENAME = 1
+IMAGE_SEPARATE_DEBUG_SIGNATURE = 18756
+# Generated by h2py from \msvcnt\include\wingdi.h
+# hacked and split manually by mhammond.
+NEWFRAME = 1
+ABORTDOC = 2
+NEXTBAND = 3
+SETCOLORTABLE = 4
+GETCOLORTABLE = 5
+FLUSHOUTPUT = 6
+DRAFTMODE = 7
+QUERYESCSUPPORT = 8
+SETABORTPROC = 9
+STARTDOC = 10
+ENDDOC = 11
+GETPHYSPAGESIZE = 12
+GETPRINTINGOFFSET = 13
+GETSCALINGFACTOR = 14
+MFCOMMENT = 15
+GETPENWIDTH = 16
+SETCOPYCOUNT = 17
+SELECTPAPERSOURCE = 18
+DEVICEDATA = 19
+PASSTHROUGH = 19
+GETTECHNOLGY = 20
+GETTECHNOLOGY = 20
+SETLINECAP = 21
+SETLINEJOIN = 22
+SETMITERLIMIT = 23
+BANDINFO = 24
+DRAWPATTERNRECT = 25
+GETVECTORPENSIZE = 26
+GETVECTORBRUSHSIZE = 27
+ENABLEDUPLEX = 28
+GETSETPAPERBINS = 29
+GETSETPRINTORIENT = 30
+ENUMPAPERBINS = 31
+SETDIBSCALING = 32
+EPSPRINTING = 33
+ENUMPAPERMETRICS = 34
+GETSETPAPERMETRICS = 35
+POSTSCRIPT_DATA = 37
+POSTSCRIPT_IGNORE = 38
+MOUSETRAILS = 39
+GETDEVICEUNITS = 42
+GETEXTENDEDTEXTMETRICS = 256
+GETEXTENTTABLE = 257
+GETPAIRKERNTABLE = 258
+GETTRACKKERNTABLE = 259
+EXTTEXTOUT = 512
+GETFACENAME = 513
+DOWNLOADFACE = 514
+ENABLERELATIVEWIDTHS = 768
+ENABLEPAIRKERNING = 769
+SETKERNTRACK = 770
+SETALLJUSTVALUES = 771
+SETCHARSET = 772
+STRETCHBLT = 2048
+GETSETSCREENPARAMS = 3072
+BEGIN_PATH = 4096
+CLIP_TO_PATH = 4097
+END_PATH = 4098
+EXT_DEVICE_CAPS = 4099
+RESTORE_CTM = 4100
+SAVE_CTM = 4101
+SET_ARC_DIRECTION = 4102
+SET_BACKGROUND_COLOR = 4103
+SET_POLY_MODE = 4104
+SET_SCREEN_ANGLE = 4105
+SET_SPREAD = 4106
+TRANSFORM_CTM = 4107
+SET_CLIP_BOX = 4108
+SET_BOUNDS = 4109
+SET_MIRROR_MODE = 4110
+OPENCHANNEL = 4110
+DOWNLOADHEADER = 4111
+CLOSECHANNEL = 4112
+POSTSCRIPT_PASSTHROUGH = 4115
+ENCAPSULATED_POSTSCRIPT = 4116
+SP_NOTREPORTED = 16384
+SP_ERROR = (-1)
+SP_APPABORT = (-2)
+SP_USERABORT = (-3)
+SP_OUTOFDISK = (-4)
+SP_OUTOFMEMORY = (-5)
+PR_JOBSTATUS = 0
+OBJ_PEN = 1
+OBJ_BRUSH = 2
+OBJ_DC = 3
+OBJ_METADC = 4
+OBJ_PAL = 5
+OBJ_FONT = 6
+OBJ_BITMAP = 7
+OBJ_REGION = 8
+OBJ_METAFILE = 9
+OBJ_MEMDC = 10
+OBJ_EXTPEN = 11
+OBJ_ENHMETADC = 12
+OBJ_ENHMETAFILE = 13
+MWT_IDENTITY = 1
+MWT_LEFTMULTIPLY = 2
+MWT_RIGHTMULTIPLY = 3
+MWT_MIN = MWT_IDENTITY
+MWT_MAX = MWT_RIGHTMULTIPLY
+BI_RGB = 0
+BI_RLE8 = 1
+BI_RLE4 = 2
+BI_BITFIELDS = 3
+TMPF_FIXED_PITCH = 1
+TMPF_VECTOR = 2
+TMPF_DEVICE = 8
+TMPF_TRUETYPE = 4
+NTM_REGULAR = 64
+NTM_BOLD = 32
+NTM_ITALIC = 1
+LF_FACESIZE = 32
+LF_FULLFACESIZE = 64
+OUT_DEFAULT_PRECIS = 0
+OUT_STRING_PRECIS = 1
+OUT_CHARACTER_PRECIS = 2
+OUT_STROKE_PRECIS = 3
+OUT_TT_PRECIS = 4
+OUT_DEVICE_PRECIS = 5
+OUT_RASTER_PRECIS = 6
+OUT_TT_ONLY_PRECIS = 7
+OUT_OUTLINE_PRECIS = 8
+CLIP_DEFAULT_PRECIS = 0
+CLIP_CHARACTER_PRECIS = 1
+CLIP_STROKE_PRECIS = 2
+CLIP_MASK = 15
+CLIP_LH_ANGLES = (1<<4)
+CLIP_TT_ALWAYS = (2<<4)
+CLIP_EMBEDDED = (8<<4)
+DEFAULT_QUALITY = 0
+DRAFT_QUALITY = 1
+PROOF_QUALITY = 2
+NONANTIALIASED_QUALITY = 3
+ANTIALIASED_QUALITY = 4
+CLEARTYPE_QUALITY = 5
+CLEARTYPE_NATURAL_QUALITY = 6
+DEFAULT_PITCH = 0
+FIXED_PITCH = 1
+VARIABLE_PITCH = 2
+ANSI_CHARSET = 0
+DEFAULT_CHARSET = 1
+SYMBOL_CHARSET = 2
+SHIFTJIS_CHARSET = 128
+HANGEUL_CHARSET = 129
+CHINESEBIG5_CHARSET = 136
+OEM_CHARSET = 255
+JOHAB_CHARSET = 130
+HEBREW_CHARSET = 177
+ARABIC_CHARSET = 178
+GREEK_CHARSET = 161
+TURKISH_CHARSET = 162
+VIETNAMESE_CHARSET = 163
+THAI_CHARSET = 222
+EASTEUROPE_CHARSET = 238
+RUSSIAN_CHARSET = 204
+MAC_CHARSET = 77
+BALTIC_CHARSET = 186
+FF_DONTCARE = (0<<4)
+FF_ROMAN = (1<<4)
+FF_SWISS = (2<<4)
+FF_MODERN = (3<<4)
+FF_SCRIPT = (4<<4)
+FF_DECORATIVE = (5<<4)
+FW_DONTCARE = 0
+FW_THIN = 100
+FW_EXTRALIGHT = 200
+FW_LIGHT = 300
+FW_NORMAL = 400
+FW_MEDIUM = 500
+FW_SEMIBOLD = 600
+FW_BOLD = 700
+FW_EXTRABOLD = 800
+FW_HEAVY = 900
+FW_ULTRALIGHT = FW_EXTRALIGHT
+FW_REGULAR = FW_NORMAL
+FW_DEMIBOLD = FW_SEMIBOLD
+FW_ULTRABOLD = FW_EXTRABOLD
+FW_BLACK = FW_HEAVY
+# Generated by h2py from \msvcnt\include\wingdi.h
+# hacked and split manually by mhammond.
+BS_SOLID = 0
+BS_NULL = 1
+BS_HOLLOW = BS_NULL
+BS_HATCHED = 2
+BS_PATTERN = 3
+BS_INDEXED = 4
+BS_DIBPATTERN = 5
+BS_DIBPATTERNPT = 6
+BS_PATTERN8X8 = 7
+BS_DIBPATTERN8X8 = 8
+HS_HORIZONTAL = 0
+HS_VERTICAL = 1
+HS_FDIAGONAL = 2
+HS_BDIAGONAL = 3
+HS_CROSS = 4
+HS_DIAGCROSS = 5
+HS_FDIAGONAL1 = 6
+HS_BDIAGONAL1 = 7
+HS_SOLID = 8
+HS_DENSE1 = 9
+HS_DENSE2 = 10
+HS_DENSE3 = 11
+HS_DENSE4 = 12
+HS_DENSE5 = 13
+HS_DENSE6 = 14
+HS_DENSE7 = 15
+HS_DENSE8 = 16
+HS_NOSHADE = 17
+HS_HALFTONE = 18
+HS_SOLIDCLR = 19
+HS_DITHEREDCLR = 20
+HS_SOLIDTEXTCLR = 21
+HS_DITHEREDTEXTCLR = 22
+HS_SOLIDBKCLR = 23
+HS_DITHEREDBKCLR = 24
+HS_API_MAX = 25
+PS_SOLID = 0
+PS_DASH = 1
+PS_DOT = 2
+PS_DASHDOT = 3
+PS_DASHDOTDOT = 4
+PS_NULL = 5
+PS_INSIDEFRAME = 6
+PS_USERSTYLE = 7
+PS_ALTERNATE = 8
+PS_STYLE_MASK = 15
+PS_ENDCAP_ROUND = 0
+PS_ENDCAP_SQUARE = 256
+PS_ENDCAP_FLAT = 512
+PS_ENDCAP_MASK = 3840
+PS_JOIN_ROUND = 0
+PS_JOIN_BEVEL = 4096
+PS_JOIN_MITER = 8192
+PS_JOIN_MASK = 61440
+PS_COSMETIC = 0
+PS_GEOMETRIC = 65536
+PS_TYPE_MASK = 983040
+AD_COUNTERCLOCKWISE = 1
+AD_CLOCKWISE = 2
+DRIVERVERSION = 0
+TECHNOLOGY = 2
+HORZSIZE = 4
+VERTSIZE = 6
+HORZRES = 8
+VERTRES = 10
+BITSPIXEL = 12
+PLANES = 14
+NUMBRUSHES = 16
+NUMPENS = 18
+NUMMARKERS = 20
+NUMFONTS = 22
+NUMCOLORS = 24
+PDEVICESIZE = 26
+CURVECAPS = 28
+LINECAPS = 30
+POLYGONALCAPS = 32
+TEXTCAPS = 34
+CLIPCAPS = 36
+RASTERCAPS = 38
+ASPECTX = 40
+ASPECTY = 42
+ASPECTXY = 44
+LOGPIXELSX = 88
+LOGPIXELSY = 90
+SIZEPALETTE = 104
+NUMRESERVED = 106
+COLORRES = 108
+DT_PLOTTER = 0
+DT_RASDISPLAY = 1
+DT_RASPRINTER = 2
+DT_RASCAMERA = 3
+DT_CHARSTREAM = 4
+DT_METAFILE = 5
+DT_DISPFILE = 6
+CC_NONE = 0
+CC_CIRCLES = 1
+CC_PIE = 2
+CC_CHORD = 4
+CC_ELLIPSES = 8
+CC_WIDE = 16
+CC_STYLED = 32
+CC_WIDESTYLED = 64
+CC_INTERIORS = 128
+CC_ROUNDRECT = 256
+LC_NONE = 0
+LC_POLYLINE = 2
+LC_MARKER = 4
+LC_POLYMARKER = 8
+LC_WIDE = 16
+LC_STYLED = 32
+LC_WIDESTYLED = 64
+LC_INTERIORS = 128
+PC_NONE = 0
+PC_POLYGON = 1
+PC_RECTANGLE = 2
+PC_WINDPOLYGON = 4
+PC_TRAPEZOID = 4
+PC_SCANLINE = 8
+PC_WIDE = 16
+PC_STYLED = 32
+PC_WIDESTYLED = 64
+PC_INTERIORS = 128
+CP_NONE = 0
+CP_RECTANGLE = 1
+CP_REGION = 2
+TC_OP_CHARACTER = 1
+TC_OP_STROKE = 2
+TC_CP_STROKE = 4
+TC_CR_90 = 8
+TC_CR_ANY = 16
+TC_SF_X_YINDEP = 32
+TC_SA_DOUBLE = 64
+TC_SA_INTEGER = 128
+TC_SA_CONTIN = 256
+TC_EA_DOUBLE = 512
+TC_IA_ABLE = 1024
+TC_UA_ABLE = 2048
+TC_SO_ABLE = 4096
+TC_RA_ABLE = 8192
+TC_VA_ABLE = 16384
+TC_RESERVED = 32768
+TC_SCROLLBLT = 65536
+RC_BITBLT = 1
+RC_BANDING = 2
+RC_SCALING = 4
+RC_BITMAP64 = 8
+RC_GDI20_OUTPUT = 16
+RC_GDI20_STATE = 32
+RC_SAVEBITMAP = 64
+RC_DI_BITMAP = 128
+RC_PALETTE = 256
+RC_DIBTODEV = 512
+RC_BIGFONT = 1024
+RC_STRETCHBLT = 2048
+RC_FLOODFILL = 4096
+RC_STRETCHDIB = 8192
+RC_OP_DX_OUTPUT = 16384
+RC_DEVBITS = 32768
+DIB_RGB_COLORS = 0
+DIB_PAL_COLORS = 1
+DIB_PAL_INDICES = 2
+DIB_PAL_PHYSINDICES = 2
+DIB_PAL_LOGINDICES = 4
+SYSPAL_ERROR = 0
+SYSPAL_STATIC = 1
+SYSPAL_NOSTATIC = 2
+CBM_CREATEDIB = 2
+CBM_INIT = 4
+FLOODFILLBORDER = 0
+FLOODFILLSURFACE = 1
+CCHDEVICENAME = 32
+CCHFORMNAME = 32
+# Generated by h2py from \msvcnt\include\wingdi.h
+# hacked and split manually by mhammond.
+
+# DEVMODE.dmFields
+DM_SPECVERSION = 800
+DM_ORIENTATION = 1
+DM_PAPERSIZE = 2
+DM_PAPERLENGTH = 4
+DM_PAPERWIDTH = 8
+DM_SCALE = 16
+DM_POSITION = 32
+DM_NUP = 64
+DM_DISPLAYORIENTATION = 128
+DM_COPIES = 256
+DM_DEFAULTSOURCE = 512
+DM_PRINTQUALITY = 1024
+DM_COLOR = 2048
+DM_DUPLEX = 4096
+DM_YRESOLUTION = 8192
+DM_TTOPTION = 16384
+DM_COLLATE = 32768
+DM_FORMNAME = 65536
+DM_LOGPIXELS = 131072
+DM_BITSPERPEL = 262144
+DM_PELSWIDTH = 524288
+DM_PELSHEIGHT = 1048576
+DM_DISPLAYFLAGS = 2097152
+DM_DISPLAYFREQUENCY = 4194304
+DM_ICMMETHOD = 8388608
+DM_ICMINTENT = 16777216
+DM_MEDIATYPE = 33554432
+DM_DITHERTYPE = 67108864
+DM_PANNINGWIDTH = 134217728
+DM_PANNINGHEIGHT = 268435456
+DM_DISPLAYFIXEDOUTPUT = 536870912
+
+# DEVMODE.dmOrientation
+DMORIENT_PORTRAIT = 1
+DMORIENT_LANDSCAPE = 2
+
+# DEVMODE.dmDisplayOrientation
+DMDO_DEFAULT = 0
+DMDO_90 = 1
+DMDO_180 = 2
+DMDO_270 = 3
+
+# DEVMODE.dmDisplayFixedOutput
+DMDFO_DEFAULT = 0
+DMDFO_STRETCH = 1
+DMDFO_CENTER = 2
+
+# DEVMODE.dmPaperSize
+DMPAPER_LETTER = 1
+DMPAPER_LETTERSMALL = 2
+DMPAPER_TABLOID = 3
+DMPAPER_LEDGER = 4
+DMPAPER_LEGAL = 5
+DMPAPER_STATEMENT = 6
+DMPAPER_EXECUTIVE = 7
+DMPAPER_A3 = 8
+DMPAPER_A4 = 9
+DMPAPER_A4SMALL = 10
+DMPAPER_A5 = 11
+DMPAPER_B4 = 12
+DMPAPER_B5 = 13
+DMPAPER_FOLIO = 14
+DMPAPER_QUARTO = 15
+DMPAPER_10X14 = 16
+DMPAPER_11X17 = 17
+DMPAPER_NOTE = 18
+DMPAPER_ENV_9 = 19
+DMPAPER_ENV_10 = 20
+DMPAPER_ENV_11 = 21
+DMPAPER_ENV_12 = 22
+DMPAPER_ENV_14 = 23
+DMPAPER_CSHEET = 24
+DMPAPER_DSHEET = 25
+DMPAPER_ESHEET = 26
+DMPAPER_ENV_DL = 27
+DMPAPER_ENV_C5 = 28
+DMPAPER_ENV_C3 = 29
+DMPAPER_ENV_C4 = 30
+DMPAPER_ENV_C6 = 31
+DMPAPER_ENV_C65 = 32
+DMPAPER_ENV_B4 = 33
+DMPAPER_ENV_B5 = 34
+DMPAPER_ENV_B6 = 35
+DMPAPER_ENV_ITALY = 36
+DMPAPER_ENV_MONARCH = 37
+DMPAPER_ENV_PERSONAL = 38
+DMPAPER_FANFOLD_US = 39
+DMPAPER_FANFOLD_STD_GERMAN = 40
+DMPAPER_FANFOLD_LGL_GERMAN = 41
+DMPAPER_ISO_B4 = 42
+DMPAPER_JAPANESE_POSTCARD = 43
+DMPAPER_9X11 = 44
+DMPAPER_10X11 = 45
+DMPAPER_15X11 = 46
+DMPAPER_ENV_INVITE = 47
+DMPAPER_RESERVED_48 = 48
+DMPAPER_RESERVED_49 = 49
+DMPAPER_LETTER_EXTRA = 50
+DMPAPER_LEGAL_EXTRA = 51
+DMPAPER_TABLOID_EXTRA = 52
+DMPAPER_A4_EXTRA = 53
+DMPAPER_LETTER_TRANSVERSE = 54
+DMPAPER_A4_TRANSVERSE = 55
+DMPAPER_LETTER_EXTRA_TRANSVERSE = 56
+DMPAPER_A_PLUS = 57
+DMPAPER_B_PLUS = 58
+DMPAPER_LETTER_PLUS = 59
+DMPAPER_A4_PLUS = 60
+DMPAPER_A5_TRANSVERSE = 61
+DMPAPER_B5_TRANSVERSE = 62
+DMPAPER_A3_EXTRA = 63
+DMPAPER_A5_EXTRA = 64
+DMPAPER_B5_EXTRA = 65
+DMPAPER_A2 = 66
+DMPAPER_A3_TRANSVERSE = 67
+DMPAPER_A3_EXTRA_TRANSVERSE = 68
+DMPAPER_DBL_JAPANESE_POSTCARD = 69
+DMPAPER_A6 = 70
+DMPAPER_JENV_KAKU2 = 71
+DMPAPER_JENV_KAKU3 = 72
+DMPAPER_JENV_CHOU3 = 73
+DMPAPER_JENV_CHOU4 = 74
+DMPAPER_LETTER_ROTATED = 75
+DMPAPER_A3_ROTATED = 76
+DMPAPER_A4_ROTATED = 77
+DMPAPER_A5_ROTATED = 78
+DMPAPER_B4_JIS_ROTATED = 79
+DMPAPER_B5_JIS_ROTATED = 80
+DMPAPER_JAPANESE_POSTCARD_ROTATED = 81
+DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED = 82
+DMPAPER_A6_ROTATED = 83
+DMPAPER_JENV_KAKU2_ROTATED = 84
+DMPAPER_JENV_KAKU3_ROTATED = 85
+DMPAPER_JENV_CHOU3_ROTATED = 86
+DMPAPER_JENV_CHOU4_ROTATED = 87
+DMPAPER_B6_JIS = 88
+DMPAPER_B6_JIS_ROTATED = 89
+DMPAPER_12X11 = 90
+DMPAPER_JENV_YOU4 = 91
+DMPAPER_JENV_YOU4_ROTATED = 92
+DMPAPER_P16K = 93
+DMPAPER_P32K = 94
+DMPAPER_P32KBIG = 95
+DMPAPER_PENV_1 = 96
+DMPAPER_PENV_2 = 97
+DMPAPER_PENV_3 = 98
+DMPAPER_PENV_4 = 99
+DMPAPER_PENV_5 = 100
+DMPAPER_PENV_6 = 101
+DMPAPER_PENV_7 = 102
+DMPAPER_PENV_8 = 103
+DMPAPER_PENV_9 = 104
+DMPAPER_PENV_10 = 105
+DMPAPER_P16K_ROTATED = 106
+DMPAPER_P32K_ROTATED = 107
+DMPAPER_P32KBIG_ROTATED = 108
+DMPAPER_PENV_1_ROTATED = 109
+DMPAPER_PENV_2_ROTATED = 110
+DMPAPER_PENV_3_ROTATED = 111
+DMPAPER_PENV_4_ROTATED = 112
+DMPAPER_PENV_5_ROTATED = 113
+DMPAPER_PENV_6_ROTATED = 114
+DMPAPER_PENV_7_ROTATED = 115
+DMPAPER_PENV_8_ROTATED = 116
+DMPAPER_PENV_9_ROTATED = 117
+DMPAPER_PENV_10_ROTATED = 118
+DMPAPER_LAST = DMPAPER_PENV_10_ROTATED
+DMPAPER_USER = 256
+
+# DEVMODE.dmDefaultSource
+DMBIN_UPPER = 1
+DMBIN_ONLYONE = 1
+DMBIN_LOWER = 2
+DMBIN_MIDDLE = 3
+DMBIN_MANUAL = 4
+DMBIN_ENVELOPE = 5
+DMBIN_ENVMANUAL = 6
+DMBIN_AUTO = 7
+DMBIN_TRACTOR = 8
+DMBIN_SMALLFMT = 9
+DMBIN_LARGEFMT = 10
+DMBIN_LARGECAPACITY = 11
+DMBIN_CASSETTE = 14
+DMBIN_LAST = DMBIN_CASSETTE
+DMBIN_USER = 256
+
+# DEVMODE.dmPrintQuality
+DMRES_DRAFT = (-1)
+DMRES_LOW = (-2)
+DMRES_MEDIUM = (-3)
+DMRES_HIGH = (-4)
+
+# DEVMODE.dmColor
+DMCOLOR_MONOCHROME = 1
+DMCOLOR_COLOR = 2
+
+# DEVMODE.dmDuplex
+DMDUP_SIMPLEX = 1
+DMDUP_VERTICAL = 2
+DMDUP_HORIZONTAL = 3
+
+# DEVMODE.dmTTOption
+DMTT_BITMAP = 1
+DMTT_DOWNLOAD = 2
+DMTT_SUBDEV = 3
+DMTT_DOWNLOAD_OUTLINE = 4
+
+# DEVMODE.dmCollate
+DMCOLLATE_FALSE = 0
+DMCOLLATE_TRUE = 1
+
+# DEVMODE.dmDisplayFlags
+DM_GRAYSCALE = 1
+DM_INTERLACED = 2
+
+# DEVMODE.dmICMMethod
+DMICMMETHOD_NONE = 1
+DMICMMETHOD_SYSTEM = 2
+DMICMMETHOD_DRIVER = 3
+DMICMMETHOD_DEVICE = 4
+DMICMMETHOD_USER = 256
+
+# DEVMODE.dmICMIntent
+DMICM_SATURATE = 1
+DMICM_CONTRAST = 2
+DMICM_COLORIMETRIC = 3
+DMICM_ABS_COLORIMETRIC = 4
+DMICM_USER = 256
+
+# DEVMODE.dmMediaType
+DMMEDIA_STANDARD = 1
+DMMEDIA_TRANSPARENCY = 2
+DMMEDIA_GLOSSY = 3
+DMMEDIA_USER = 256
+
+# DEVMODE.dmDitherType
+DMDITHER_NONE = 1
+DMDITHER_COARSE = 2
+DMDITHER_FINE = 3
+DMDITHER_LINEART = 4
+DMDITHER_ERRORDIFFUSION = 5
+DMDITHER_RESERVED6 = 6
+DMDITHER_RESERVED7 = 7
+DMDITHER_RESERVED8 = 8
+DMDITHER_RESERVED9 = 9
+DMDITHER_GRAYSCALE = 10
+DMDITHER_USER = 256
+
+# DEVMODE.dmNup
+DMNUP_SYSTEM = 1
+DMNUP_ONEUP = 2
+
+RDH_RECTANGLES = 1
+GGO_METRICS = 0
+GGO_BITMAP = 1
+GGO_NATIVE = 2
+TT_POLYGON_TYPE = 24
+TT_PRIM_LINE = 1
+TT_PRIM_QSPLINE = 2
+TT_AVAILABLE = 1
+TT_ENABLED = 2
+DM_UPDATE = 1
+DM_COPY = 2
+DM_PROMPT = 4
+DM_MODIFY = 8
+DM_IN_BUFFER = DM_MODIFY
+DM_IN_PROMPT = DM_PROMPT
+DM_OUT_BUFFER = DM_COPY
+DM_OUT_DEFAULT = DM_UPDATE
+
+# DISPLAY_DEVICE.StateFlags
+DISPLAY_DEVICE_ATTACHED_TO_DESKTOP = 1
+DISPLAY_DEVICE_MULTI_DRIVER = 2
+DISPLAY_DEVICE_PRIMARY_DEVICE = 4
+DISPLAY_DEVICE_MIRRORING_DRIVER = 8
+DISPLAY_DEVICE_VGA_COMPATIBLE = 16
+DISPLAY_DEVICE_REMOVABLE = 32
+DISPLAY_DEVICE_MODESPRUNED = 134217728
+DISPLAY_DEVICE_REMOTE = 67108864
+DISPLAY_DEVICE_DISCONNECT = 33554432
+
+# DeviceCapabilities types
+DC_FIELDS = 1
+DC_PAPERS = 2
+DC_PAPERSIZE = 3
+DC_MINEXTENT = 4
+DC_MAXEXTENT = 5
+DC_BINS = 6
+DC_DUPLEX = 7
+DC_SIZE = 8
+DC_EXTRA = 9
+DC_VERSION = 10
+DC_DRIVER = 11
+DC_BINNAMES = 12
+DC_ENUMRESOLUTIONS = 13
+DC_FILEDEPENDENCIES = 14
+DC_TRUETYPE = 15
+DC_PAPERNAMES = 16
+DC_ORIENTATION = 17
+DC_COPIES = 18
+DC_BINADJUST = 19
+DC_EMF_COMPLIANT = 20
+DC_DATATYPE_PRODUCED = 21
+DC_COLLATE = 22
+DC_MANUFACTURER = 23
+DC_MODEL = 24
+DC_PERSONALITY = 25
+DC_PRINTRATE = 26
+DC_PRINTRATEUNIT = 27
+DC_PRINTERMEM = 28
+DC_MEDIAREADY = 29
+DC_STAPLE = 30
+DC_PRINTRATEPPM = 31
+DC_COLORDEVICE = 32
+DC_NUP = 33
+DC_MEDIATYPENAMES = 34
+DC_MEDIATYPES = 35
+
+PRINTRATEUNIT_PPM = 1
+PRINTRATEUNIT_CPS = 2
+PRINTRATEUNIT_LPM = 3
+PRINTRATEUNIT_IPM = 4
+
+# TrueType constants
+DCTT_BITMAP = 1
+DCTT_DOWNLOAD = 2
+DCTT_SUBDEV = 4
+DCTT_DOWNLOAD_OUTLINE = 8
+
+CA_NEGATIVE = 1
+CA_LOG_FILTER = 2
+ILLUMINANT_DEVICE_DEFAULT = 0
+ILLUMINANT_A = 1
+ILLUMINANT_B = 2
+ILLUMINANT_C = 3
+ILLUMINANT_D50 = 4
+ILLUMINANT_D55 = 5
+ILLUMINANT_D65 = 6
+ILLUMINANT_D75 = 7
+ILLUMINANT_F2 = 8
+ILLUMINANT_MAX_INDEX = ILLUMINANT_F2
+ILLUMINANT_TUNGSTEN = ILLUMINANT_A
+ILLUMINANT_DAYLIGHT = ILLUMINANT_C
+ILLUMINANT_FLUORESCENT = ILLUMINANT_F2
+ILLUMINANT_NTSC = ILLUMINANT_C
+
+# Generated by h2py from \msvcnt\include\wingdi.h
+# hacked and split manually by mhammond.
+FONTMAPPER_MAX = 10
+ENHMETA_SIGNATURE = 1179469088
+ENHMETA_STOCK_OBJECT = -2147483648
+EMR_HEADER = 1
+EMR_POLYBEZIER = 2
+EMR_POLYGON = 3
+EMR_POLYLINE = 4
+EMR_POLYBEZIERTO = 5
+EMR_POLYLINETO = 6
+EMR_POLYPOLYLINE = 7
+EMR_POLYPOLYGON = 8
+EMR_SETWINDOWEXTEX = 9
+EMR_SETWINDOWORGEX = 10
+EMR_SETVIEWPORTEXTEX = 11
+EMR_SETVIEWPORTORGEX = 12
+EMR_SETBRUSHORGEX = 13
+EMR_EOF = 14
+EMR_SETPIXELV = 15
+EMR_SETMAPPERFLAGS = 16
+EMR_SETMAPMODE = 17
+EMR_SETBKMODE = 18
+EMR_SETPOLYFILLMODE = 19
+EMR_SETROP2 = 20
+EMR_SETSTRETCHBLTMODE = 21
+EMR_SETTEXTALIGN = 22
+EMR_SETCOLORADJUSTMENT = 23
+EMR_SETTEXTCOLOR = 24
+EMR_SETBKCOLOR = 25
+EMR_OFFSETCLIPRGN = 26
+EMR_MOVETOEX = 27
+EMR_SETMETARGN = 28
+EMR_EXCLUDECLIPRECT = 29
+EMR_INTERSECTCLIPRECT = 30
+EMR_SCALEVIEWPORTEXTEX = 31
+EMR_SCALEWINDOWEXTEX = 32
+EMR_SAVEDC = 33
+EMR_RESTOREDC = 34
+EMR_SETWORLDTRANSFORM = 35
+EMR_MODIFYWORLDTRANSFORM = 36
+EMR_SELECTOBJECT = 37
+EMR_CREATEPEN = 38
+EMR_CREATEBRUSHINDIRECT = 39
+EMR_DELETEOBJECT = 40
+EMR_ANGLEARC = 41
+EMR_ELLIPSE = 42
+EMR_RECTANGLE = 43
+EMR_ROUNDRECT = 44
+EMR_ARC = 45
+EMR_CHORD = 46
+EMR_PIE = 47
+EMR_SELECTPALETTE = 48
+EMR_CREATEPALETTE = 49
+EMR_SETPALETTEENTRIES = 50
+EMR_RESIZEPALETTE = 51
+EMR_REALIZEPALETTE = 52
+EMR_EXTFLOODFILL = 53
+EMR_LINETO = 54
+EMR_ARCTO = 55
+EMR_POLYDRAW = 56
+EMR_SETARCDIRECTION = 57
+EMR_SETMITERLIMIT = 58
+EMR_BEGINPATH = 59
+EMR_ENDPATH = 60
+EMR_CLOSEFIGURE = 61
+EMR_FILLPATH = 62
+EMR_STROKEANDFILLPATH = 63
+EMR_STROKEPATH = 64
+EMR_FLATTENPATH = 65
+EMR_WIDENPATH = 66
+EMR_SELECTCLIPPATH = 67
+EMR_ABORTPATH = 68
+EMR_GDICOMMENT = 70
+EMR_FILLRGN = 71
+EMR_FRAMERGN = 72
+EMR_INVERTRGN = 73
+EMR_PAINTRGN = 74
+EMR_EXTSELECTCLIPRGN = 75
+EMR_BITBLT = 76
+EMR_STRETCHBLT = 77
+EMR_MASKBLT = 78
+EMR_PLGBLT = 79
+EMR_SETDIBITSTODEVICE = 80
+EMR_STRETCHDIBITS = 81
+EMR_EXTCREATEFONTINDIRECTW = 82
+EMR_EXTTEXTOUTA = 83
+EMR_EXTTEXTOUTW = 84
+EMR_POLYBEZIER16 = 85
+EMR_POLYGON16 = 86
+EMR_POLYLINE16 = 87
+EMR_POLYBEZIERTO16 = 88
+EMR_POLYLINETO16 = 89
+EMR_POLYPOLYLINE16 = 90
+EMR_POLYPOLYGON16 = 91
+EMR_POLYDRAW16 = 92
+EMR_CREATEMONOBRUSH = 93
+EMR_CREATEDIBPATTERNBRUSHPT = 94
+EMR_EXTCREATEPEN = 95
+EMR_POLYTEXTOUTA = 96
+EMR_POLYTEXTOUTW = 97
+EMR_MIN = 1
+EMR_MAX = 97
+# Generated by h2py from \msvcnt\include\wingdi.h
+# hacked and split manually by mhammond.
+PANOSE_COUNT = 10
+PAN_FAMILYTYPE_INDEX = 0
+PAN_SERIFSTYLE_INDEX = 1
+PAN_WEIGHT_INDEX = 2
+PAN_PROPORTION_INDEX = 3
+PAN_CONTRAST_INDEX = 4
+PAN_STROKEVARIATION_INDEX = 5
+PAN_ARMSTYLE_INDEX = 6
+PAN_LETTERFORM_INDEX = 7
+PAN_MIDLINE_INDEX = 8
+PAN_XHEIGHT_INDEX = 9
+PAN_CULTURE_LATIN = 0
+PAN_ANY = 0
+PAN_NO_FIT = 1
+PAN_FAMILY_TEXT_DISPLAY = 2
+PAN_FAMILY_SCRIPT = 3
+PAN_FAMILY_DECORATIVE = 4
+PAN_FAMILY_PICTORIAL = 5
+PAN_SERIF_COVE = 2
+PAN_SERIF_OBTUSE_COVE = 3
+PAN_SERIF_SQUARE_COVE = 4
+PAN_SERIF_OBTUSE_SQUARE_COVE = 5
+PAN_SERIF_SQUARE = 6
+PAN_SERIF_THIN = 7
+PAN_SERIF_BONE = 8
+PAN_SERIF_EXAGGERATED = 9
+PAN_SERIF_TRIANGLE = 10
+PAN_SERIF_NORMAL_SANS = 11
+PAN_SERIF_OBTUSE_SANS = 12
+PAN_SERIF_PERP_SANS = 13
+PAN_SERIF_FLARED = 14
+PAN_SERIF_ROUNDED = 15
+PAN_WEIGHT_VERY_LIGHT = 2
+PAN_WEIGHT_LIGHT = 3
+PAN_WEIGHT_THIN = 4
+PAN_WEIGHT_BOOK = 5
+PAN_WEIGHT_MEDIUM = 6
+PAN_WEIGHT_DEMI = 7
+PAN_WEIGHT_BOLD = 8
+PAN_WEIGHT_HEAVY = 9
+PAN_WEIGHT_BLACK = 10
+PAN_WEIGHT_NORD = 11
+PAN_PROP_OLD_STYLE = 2
+PAN_PROP_MODERN = 3
+PAN_PROP_EVEN_WIDTH = 4
+PAN_PROP_EXPANDED = 5
+PAN_PROP_CONDENSED = 6
+PAN_PROP_VERY_EXPANDED = 7
+PAN_PROP_VERY_CONDENSED = 8
+PAN_PROP_MONOSPACED = 9
+PAN_CONTRAST_NONE = 2
+PAN_CONTRAST_VERY_LOW = 3
+PAN_CONTRAST_LOW = 4
+PAN_CONTRAST_MEDIUM_LOW = 5
+PAN_CONTRAST_MEDIUM = 6
+PAN_CONTRAST_MEDIUM_HIGH = 7
+PAN_CONTRAST_HIGH = 8
+PAN_CONTRAST_VERY_HIGH = 9
+PAN_STROKE_GRADUAL_DIAG = 2
+PAN_STROKE_GRADUAL_TRAN = 3
+PAN_STROKE_GRADUAL_VERT = 4
+PAN_STROKE_GRADUAL_HORZ = 5
+PAN_STROKE_RAPID_VERT = 6
+PAN_STROKE_RAPID_HORZ = 7
+PAN_STROKE_INSTANT_VERT = 8
+PAN_STRAIGHT_ARMS_HORZ = 2
+PAN_STRAIGHT_ARMS_WEDGE = 3
+PAN_STRAIGHT_ARMS_VERT = 4
+PAN_STRAIGHT_ARMS_SINGLE_SERIF = 5
+PAN_STRAIGHT_ARMS_DOUBLE_SERIF = 6
+PAN_BENT_ARMS_HORZ = 7
+PAN_BENT_ARMS_WEDGE = 8
+PAN_BENT_ARMS_VERT = 9
+PAN_BENT_ARMS_SINGLE_SERIF = 10
+PAN_BENT_ARMS_DOUBLE_SERIF = 11
+PAN_LETT_NORMAL_CONTACT = 2
+PAN_LETT_NORMAL_WEIGHTED = 3
+PAN_LETT_NORMAL_BOXED = 4
+PAN_LETT_NORMAL_FLATTENED = 5
+PAN_LETT_NORMAL_ROUNDED = 6
+PAN_LETT_NORMAL_OFF_CENTER = 7
+PAN_LETT_NORMAL_SQUARE = 8
+PAN_LETT_OBLIQUE_CONTACT = 9
+PAN_LETT_OBLIQUE_WEIGHTED = 10
+PAN_LETT_OBLIQUE_BOXED = 11
+PAN_LETT_OBLIQUE_FLATTENED = 12
+PAN_LETT_OBLIQUE_ROUNDED = 13
+PAN_LETT_OBLIQUE_OFF_CENTER = 14
+PAN_LETT_OBLIQUE_SQUARE = 15
+PAN_MIDLINE_STANDARD_TRIMMED = 2
+PAN_MIDLINE_STANDARD_POINTED = 3
+PAN_MIDLINE_STANDARD_SERIFED = 4
+PAN_MIDLINE_HIGH_TRIMMED = 5
+PAN_MIDLINE_HIGH_POINTED = 6
+PAN_MIDLINE_HIGH_SERIFED = 7
+PAN_MIDLINE_CONSTANT_TRIMMED = 8
+PAN_MIDLINE_CONSTANT_POINTED = 9
+PAN_MIDLINE_CONSTANT_SERIFED = 10
+PAN_MIDLINE_LOW_TRIMMED = 11
+PAN_MIDLINE_LOW_POINTED = 12
+PAN_MIDLINE_LOW_SERIFED = 13
+PAN_XHEIGHT_CONSTANT_SMALL = 2
+PAN_XHEIGHT_CONSTANT_STD = 3
+PAN_XHEIGHT_CONSTANT_LARGE = 4
+PAN_XHEIGHT_DUCKING_SMALL = 5
+PAN_XHEIGHT_DUCKING_STD = 6
+PAN_XHEIGHT_DUCKING_LARGE = 7
+ELF_VENDOR_SIZE = 4
+ELF_VERSION = 0
+ELF_CULTURE_LATIN = 0
+RASTER_FONTTYPE = 1
+DEVICE_FONTTYPE = 2
+TRUETYPE_FONTTYPE = 4
+def PALETTEINDEX(i): return ((16777216 | (i)))
+
+PC_RESERVED = 1
+PC_EXPLICIT = 2
+PC_NOCOLLAPSE = 4
+def GetRValue(rgb): return rgb & 0xff
+
+def GetGValue(rgb): return (rgb >> 8) & 0xff
+
+def GetBValue(rgb): return (rgb >> 16) & 0xff
+
+TRANSPARENT = 1
+OPAQUE = 2
+BKMODE_LAST = 2
+GM_COMPATIBLE = 1
+GM_ADVANCED = 2
+GM_LAST = 2
+PT_CLOSEFIGURE = 1
+PT_LINETO = 2
+PT_BEZIERTO = 4
+PT_MOVETO = 6
+MM_TEXT = 1
+MM_LOMETRIC = 2
+MM_HIMETRIC = 3
+MM_LOENGLISH = 4
+MM_HIENGLISH = 5
+MM_TWIPS = 6
+MM_ISOTROPIC = 7
+MM_ANISOTROPIC = 8
+MM_MIN = MM_TEXT
+MM_MAX = MM_ANISOTROPIC
+MM_MAX_FIXEDSCALE = MM_TWIPS
+ABSOLUTE = 1
+RELATIVE = 2
+WHITE_BRUSH = 0
+LTGRAY_BRUSH = 1
+GRAY_BRUSH = 2
+DKGRAY_BRUSH = 3
+BLACK_BRUSH = 4
+NULL_BRUSH = 5
+HOLLOW_BRUSH = NULL_BRUSH
+WHITE_PEN = 6
+BLACK_PEN = 7
+NULL_PEN = 8
+OEM_FIXED_FONT = 10
+ANSI_FIXED_FONT = 11
+ANSI_VAR_FONT = 12
+SYSTEM_FONT = 13
+DEVICE_DEFAULT_FONT = 14
+DEFAULT_PALETTE = 15
+SYSTEM_FIXED_FONT = 16
+STOCK_LAST = 16
+CLR_INVALID = -1
+
+# Exception/Status codes from winuser.h and winnt.h
+STATUS_WAIT_0 = 0
+STATUS_ABANDONED_WAIT_0 = 128
+STATUS_USER_APC = 192
+STATUS_TIMEOUT = 258
+STATUS_PENDING = 259
+STATUS_SEGMENT_NOTIFICATION = 1073741829
+STATUS_GUARD_PAGE_VIOLATION = -2147483647
+STATUS_DATATYPE_MISALIGNMENT = -2147483646
+STATUS_BREAKPOINT = -2147483645
+STATUS_SINGLE_STEP = -2147483644
+STATUS_ACCESS_VIOLATION = -1073741819
+STATUS_IN_PAGE_ERROR = -1073741818
+STATUS_INVALID_HANDLE = -1073741816
+STATUS_NO_MEMORY = -1073741801
+STATUS_ILLEGAL_INSTRUCTION = -1073741795
+STATUS_NONCONTINUABLE_EXCEPTION = -1073741787
+STATUS_INVALID_DISPOSITION = -1073741786
+STATUS_ARRAY_BOUNDS_EXCEEDED = -1073741684
+STATUS_FLOAT_DENORMAL_OPERAND = -1073741683
+STATUS_FLOAT_DIVIDE_BY_ZERO = -1073741682
+STATUS_FLOAT_INEXACT_RESULT = -1073741681
+STATUS_FLOAT_INVALID_OPERATION = -1073741680
+STATUS_FLOAT_OVERFLOW = -1073741679
+STATUS_FLOAT_STACK_CHECK = -1073741678
+STATUS_FLOAT_UNDERFLOW = -1073741677
+STATUS_INTEGER_DIVIDE_BY_ZERO = -1073741676
+STATUS_INTEGER_OVERFLOW = -1073741675
+STATUS_PRIVILEGED_INSTRUCTION = -1073741674
+STATUS_STACK_OVERFLOW = -1073741571
+STATUS_CONTROL_C_EXIT = -1073741510
+
+
+WAIT_FAILED = -1
+WAIT_OBJECT_0 = STATUS_WAIT_0 + 0
+
+WAIT_ABANDONED = STATUS_ABANDONED_WAIT_0 + 0
+WAIT_ABANDONED_0 = STATUS_ABANDONED_WAIT_0 + 0
+
+WAIT_TIMEOUT = STATUS_TIMEOUT
+WAIT_IO_COMPLETION = STATUS_USER_APC
+STILL_ACTIVE = STATUS_PENDING
+EXCEPTION_ACCESS_VIOLATION = STATUS_ACCESS_VIOLATION
+EXCEPTION_DATATYPE_MISALIGNMENT = STATUS_DATATYPE_MISALIGNMENT
+EXCEPTION_BREAKPOINT = STATUS_BREAKPOINT
+EXCEPTION_SINGLE_STEP = STATUS_SINGLE_STEP
+EXCEPTION_ARRAY_BOUNDS_EXCEEDED = STATUS_ARRAY_BOUNDS_EXCEEDED
+EXCEPTION_FLT_DENORMAL_OPERAND = STATUS_FLOAT_DENORMAL_OPERAND
+EXCEPTION_FLT_DIVIDE_BY_ZERO = STATUS_FLOAT_DIVIDE_BY_ZERO
+EXCEPTION_FLT_INEXACT_RESULT = STATUS_FLOAT_INEXACT_RESULT
+EXCEPTION_FLT_INVALID_OPERATION = STATUS_FLOAT_INVALID_OPERATION
+EXCEPTION_FLT_OVERFLOW = STATUS_FLOAT_OVERFLOW
+EXCEPTION_FLT_STACK_CHECK = STATUS_FLOAT_STACK_CHECK
+EXCEPTION_FLT_UNDERFLOW = STATUS_FLOAT_UNDERFLOW
+EXCEPTION_INT_DIVIDE_BY_ZERO = STATUS_INTEGER_DIVIDE_BY_ZERO
+EXCEPTION_INT_OVERFLOW = STATUS_INTEGER_OVERFLOW
+EXCEPTION_PRIV_INSTRUCTION = STATUS_PRIVILEGED_INSTRUCTION
+EXCEPTION_IN_PAGE_ERROR = STATUS_IN_PAGE_ERROR
+EXCEPTION_ILLEGAL_INSTRUCTION = STATUS_ILLEGAL_INSTRUCTION
+EXCEPTION_NONCONTINUABLE_EXCEPTION = STATUS_NONCONTINUABLE_EXCEPTION
+EXCEPTION_STACK_OVERFLOW = STATUS_STACK_OVERFLOW
+EXCEPTION_INVALID_DISPOSITION = STATUS_INVALID_DISPOSITION
+EXCEPTION_GUARD_PAGE = STATUS_GUARD_PAGE_VIOLATION
+EXCEPTION_INVALID_HANDLE = STATUS_INVALID_HANDLE
+CONTROL_C_EXIT = STATUS_CONTROL_C_EXIT
+
+# winuser.h line 8594
+# constants used with SystemParametersInfo
+SPI_GETBEEP = 1
+SPI_SETBEEP = 2
+SPI_GETMOUSE = 3
+SPI_SETMOUSE = 4
+SPI_GETBORDER = 5
+SPI_SETBORDER = 6
+SPI_GETKEYBOARDSPEED = 10
+SPI_SETKEYBOARDSPEED = 11
+SPI_LANGDRIVER = 12
+SPI_ICONHORIZONTALSPACING = 13
+SPI_GETSCREENSAVETIMEOUT = 14
+SPI_SETSCREENSAVETIMEOUT = 15
+SPI_GETSCREENSAVEACTIVE = 16
+SPI_SETSCREENSAVEACTIVE = 17
+SPI_GETGRIDGRANULARITY = 18
+SPI_SETGRIDGRANULARITY = 19
+SPI_SETDESKWALLPAPER = 20
+SPI_SETDESKPATTERN = 21
+SPI_GETKEYBOARDDELAY = 22
+SPI_SETKEYBOARDDELAY = 23
+SPI_ICONVERTICALSPACING = 24
+SPI_GETICONTITLEWRAP = 25
+SPI_SETICONTITLEWRAP = 26
+SPI_GETMENUDROPALIGNMENT = 27
+SPI_SETMENUDROPALIGNMENT = 28
+SPI_SETDOUBLECLKWIDTH = 29
+SPI_SETDOUBLECLKHEIGHT = 30
+SPI_GETICONTITLELOGFONT = 31
+SPI_SETDOUBLECLICKTIME = 32
+SPI_SETMOUSEBUTTONSWAP = 33
+SPI_SETICONTITLELOGFONT = 34
+SPI_GETFASTTASKSWITCH = 35
+SPI_SETFASTTASKSWITCH = 36
+SPI_SETDRAGFULLWINDOWS = 37
+SPI_GETDRAGFULLWINDOWS = 38
+SPI_GETNONCLIENTMETRICS = 41
+SPI_SETNONCLIENTMETRICS = 42
+SPI_GETMINIMIZEDMETRICS = 43
+SPI_SETMINIMIZEDMETRICS = 44
+SPI_GETICONMETRICS = 45
+SPI_SETICONMETRICS = 46
+SPI_SETWORKAREA = 47
+SPI_GETWORKAREA = 48
+SPI_SETPENWINDOWS = 49
+SPI_GETFILTERKEYS = 50
+SPI_SETFILTERKEYS = 51
+SPI_GETTOGGLEKEYS = 52
+SPI_SETTOGGLEKEYS = 53
+SPI_GETMOUSEKEYS = 54
+SPI_SETMOUSEKEYS = 55
+SPI_GETSHOWSOUNDS = 56
+SPI_SETSHOWSOUNDS = 57
+SPI_GETSTICKYKEYS = 58
+SPI_SETSTICKYKEYS = 59
+SPI_GETACCESSTIMEOUT = 60
+SPI_SETACCESSTIMEOUT = 61
+SPI_GETSERIALKEYS = 62
+SPI_SETSERIALKEYS = 63
+SPI_GETSOUNDSENTRY = 64
+SPI_SETSOUNDSENTRY = 65
+SPI_GETHIGHCONTRAST = 66
+SPI_SETHIGHCONTRAST = 67
+SPI_GETKEYBOARDPREF = 68
+SPI_SETKEYBOARDPREF = 69
+SPI_GETSCREENREADER = 70
+SPI_SETSCREENREADER = 71
+SPI_GETANIMATION = 72
+SPI_SETANIMATION = 73
+SPI_GETFONTSMOOTHING = 74
+SPI_SETFONTSMOOTHING = 75
+SPI_SETDRAGWIDTH = 76
+SPI_SETDRAGHEIGHT = 77
+SPI_SETHANDHELD = 78
+SPI_GETLOWPOWERTIMEOUT = 79
+SPI_GETPOWEROFFTIMEOUT = 80
+SPI_SETLOWPOWERTIMEOUT = 81
+SPI_SETPOWEROFFTIMEOUT = 82
+SPI_GETLOWPOWERACTIVE = 83
+SPI_GETPOWEROFFACTIVE = 84
+SPI_SETLOWPOWERACTIVE = 85
+SPI_SETPOWEROFFACTIVE = 86
+SPI_SETCURSORS = 87
+SPI_SETICONS = 88
+SPI_GETDEFAULTINPUTLANG = 89
+SPI_SETDEFAULTINPUTLANG = 90
+SPI_SETLANGTOGGLE = 91
+SPI_GETWINDOWSEXTENSION = 92
+SPI_SETMOUSETRAILS = 93
+SPI_GETMOUSETRAILS = 94
+SPI_GETSNAPTODEFBUTTON = 95
+SPI_SETSNAPTODEFBUTTON = 96
+SPI_SETSCREENSAVERRUNNING = 97
+SPI_SCREENSAVERRUNNING = SPI_SETSCREENSAVERRUNNING
+SPI_GETMOUSEHOVERWIDTH = 98
+SPI_SETMOUSEHOVERWIDTH = 99
+SPI_GETMOUSEHOVERHEIGHT = 100
+SPI_SETMOUSEHOVERHEIGHT = 101
+SPI_GETMOUSEHOVERTIME = 102
+SPI_SETMOUSEHOVERTIME = 103
+SPI_GETWHEELSCROLLLINES = 104
+SPI_SETWHEELSCROLLLINES = 105
+SPI_GETMENUSHOWDELAY = 106
+SPI_SETMENUSHOWDELAY = 107
+
+SPI_GETSHOWIMEUI = 110
+SPI_SETSHOWIMEUI = 111
+SPI_GETMOUSESPEED = 112
+SPI_SETMOUSESPEED = 113
+SPI_GETSCREENSAVERRUNNING = 114
+SPI_GETDESKWALLPAPER = 115
+
+SPI_GETACTIVEWINDOWTRACKING = 4096
+SPI_SETACTIVEWINDOWTRACKING = 4097
+SPI_GETMENUANIMATION = 4098
+SPI_SETMENUANIMATION = 4099
+SPI_GETCOMBOBOXANIMATION = 4100
+SPI_SETCOMBOBOXANIMATION = 4101
+SPI_GETLISTBOXSMOOTHSCROLLING = 4102
+SPI_SETLISTBOXSMOOTHSCROLLING = 4103
+SPI_GETGRADIENTCAPTIONS = 4104
+SPI_SETGRADIENTCAPTIONS = 4105
+SPI_GETKEYBOARDCUES = 4106
+SPI_SETKEYBOARDCUES = 4107
+SPI_GETMENUUNDERLINES = 4106
+SPI_SETMENUUNDERLINES = 4107
+SPI_GETACTIVEWNDTRKZORDER = 4108
+SPI_SETACTIVEWNDTRKZORDER = 4109
+SPI_GETHOTTRACKING = 4110
+SPI_SETHOTTRACKING = 4111
+
+SPI_GETMENUFADE = 4114
+SPI_SETMENUFADE = 4115
+SPI_GETSELECTIONFADE = 4116
+SPI_SETSELECTIONFADE = 4117
+SPI_GETTOOLTIPANIMATION = 4118
+SPI_SETTOOLTIPANIMATION = 4119
+SPI_GETTOOLTIPFADE = 4120
+SPI_SETTOOLTIPFADE = 4121
+SPI_GETCURSORSHADOW = 4122
+SPI_SETCURSORSHADOW = 4123
+SPI_GETMOUSESONAR = 4124
+SPI_SETMOUSESONAR = 4125
+SPI_GETMOUSECLICKLOCK = 4126
+SPI_SETMOUSECLICKLOCK = 4127
+SPI_GETMOUSEVANISH = 4128
+SPI_SETMOUSEVANISH = 4129
+SPI_GETFLATMENU = 4130
+SPI_SETFLATMENU = 4131
+SPI_GETDROPSHADOW = 4132
+SPI_SETDROPSHADOW = 4133
+SPI_GETBLOCKSENDINPUTRESETS = 4134
+SPI_SETBLOCKSENDINPUTRESETS = 4135
+SPI_GETUIEFFECTS = 4158
+SPI_SETUIEFFECTS = 4159
+
+SPI_GETFOREGROUNDLOCKTIMEOUT = 8192
+SPI_SETFOREGROUNDLOCKTIMEOUT = 8193
+SPI_GETACTIVEWNDTRKTIMEOUT = 8194
+SPI_SETACTIVEWNDTRKTIMEOUT = 8195
+SPI_GETFOREGROUNDFLASHCOUNT = 8196
+SPI_SETFOREGROUNDFLASHCOUNT = 8197
+SPI_GETCARETWIDTH = 8198
+SPI_SETCARETWIDTH = 8199
+SPI_GETMOUSECLICKLOCKTIME = 8200
+SPI_SETMOUSECLICKLOCKTIME = 8201
+SPI_GETFONTSMOOTHINGTYPE = 8202
+SPI_SETFONTSMOOTHINGTYPE = 8203
+SPI_GETFONTSMOOTHINGCONTRAST = 8204
+SPI_SETFONTSMOOTHINGCONTRAST = 8205
+SPI_GETFOCUSBORDERWIDTH = 8206
+SPI_SETFOCUSBORDERWIDTH = 8207
+SPI_GETFOCUSBORDERHEIGHT = 8208
+SPI_SETFOCUSBORDERHEIGHT = 8209
+SPI_GETFONTSMOOTHINGORIENTATION = 8210
+SPI_SETFONTSMOOTHINGORIENTATION = 8211
+
+# fWinIni flags for SystemParametersInfo
+SPIF_UPDATEINIFILE = 1
+SPIF_SENDWININICHANGE = 2
+SPIF_SENDCHANGE = SPIF_SENDWININICHANGE
+
+# used with SystemParametersInfo and SPI_GETFONTSMOOTHINGTYPE/SPI_SETFONTSMOOTHINGTYPE
+FE_FONTSMOOTHINGSTANDARD = 1
+FE_FONTSMOOTHINGCLEARTYPE = 2
+FE_FONTSMOOTHINGDOCKING = 32768
+
+METRICS_USEDEFAULT = -1
+ARW_BOTTOMLEFT = 0
+ARW_BOTTOMRIGHT = 1
+ARW_TOPLEFT = 2
+ARW_TOPRIGHT = 3
+ARW_STARTMASK = 3
+ARW_STARTRIGHT = 1
+ARW_STARTTOP = 2
+ARW_LEFT = 0
+ARW_RIGHT = 0
+ARW_UP = 4
+ARW_DOWN = 4
+ARW_HIDE = 8
+#ARW_VALID = 0x000F
+SERKF_SERIALKEYSON = 1
+SERKF_AVAILABLE = 2
+SERKF_INDICATOR = 4
+HCF_HIGHCONTRASTON = 1
+HCF_AVAILABLE = 2
+HCF_HOTKEYACTIVE = 4
+HCF_CONFIRMHOTKEY = 8
+HCF_HOTKEYSOUND = 16
+HCF_INDICATOR = 32
+HCF_HOTKEYAVAILABLE = 64
+CDS_UPDATEREGISTRY = 1
+CDS_TEST = 2
+CDS_FULLSCREEN = 4
+CDS_GLOBAL = 8
+CDS_SET_PRIMARY = 16
+CDS_RESET = 1073741824
+CDS_SETRECT = 536870912
+CDS_NORESET = 268435456
+
+# return values from ChangeDisplaySettings and ChangeDisplaySettingsEx
+DISP_CHANGE_SUCCESSFUL = 0
+DISP_CHANGE_RESTART = 1
+DISP_CHANGE_FAILED = -1
+DISP_CHANGE_BADMODE = -2
+DISP_CHANGE_NOTUPDATED = -3
+DISP_CHANGE_BADFLAGS = -4
+DISP_CHANGE_BADPARAM = -5
+DISP_CHANGE_BADDUALVIEW = -6
+
+ENUM_CURRENT_SETTINGS = -1
+ENUM_REGISTRY_SETTINGS = -2
+FKF_FILTERKEYSON = 1
+FKF_AVAILABLE = 2
+FKF_HOTKEYACTIVE = 4
+FKF_CONFIRMHOTKEY = 8
+FKF_HOTKEYSOUND = 16
+FKF_INDICATOR = 32
+FKF_CLICKON = 64
+SKF_STICKYKEYSON = 1
+SKF_AVAILABLE = 2
+SKF_HOTKEYACTIVE = 4
+SKF_CONFIRMHOTKEY = 8
+SKF_HOTKEYSOUND = 16
+SKF_INDICATOR = 32
+SKF_AUDIBLEFEEDBACK = 64
+SKF_TRISTATE = 128
+SKF_TWOKEYSOFF = 256
+SKF_LALTLATCHED = 268435456
+SKF_LCTLLATCHED = 67108864
+SKF_LSHIFTLATCHED = 16777216
+SKF_RALTLATCHED = 536870912
+SKF_RCTLLATCHED = 134217728
+SKF_RSHIFTLATCHED = 33554432
+SKF_LWINLATCHED = 1073741824
+SKF_RWINLATCHED = -2147483648
+SKF_LALTLOCKED = 1048576
+SKF_LCTLLOCKED = 262144
+SKF_LSHIFTLOCKED = 65536
+SKF_RALTLOCKED = 2097152
+SKF_RCTLLOCKED = 524288
+SKF_RSHIFTLOCKED = 131072
+SKF_LWINLOCKED = 4194304
+SKF_RWINLOCKED = 8388608
+MKF_MOUSEKEYSON = 1
+MKF_AVAILABLE = 2
+MKF_HOTKEYACTIVE = 4
+MKF_CONFIRMHOTKEY = 8
+MKF_HOTKEYSOUND = 16
+MKF_INDICATOR = 32
+MKF_MODIFIERS = 64
+MKF_REPLACENUMBERS = 128
+MKF_LEFTBUTTONSEL = 268435456
+MKF_RIGHTBUTTONSEL = 536870912
+MKF_LEFTBUTTONDOWN = 16777216
+MKF_RIGHTBUTTONDOWN = 33554432
+MKF_MOUSEMODE = -2147483648
+ATF_TIMEOUTON = 1
+ATF_ONOFFFEEDBACK = 2
+SSGF_NONE = 0
+SSGF_DISPLAY = 3
+SSTF_NONE = 0
+SSTF_CHARS = 1
+SSTF_BORDER = 2
+SSTF_DISPLAY = 3
+SSWF_NONE = 0
+SSWF_TITLE = 1
+SSWF_WINDOW = 2
+SSWF_DISPLAY = 3
+SSWF_CUSTOM = 4
+SSF_SOUNDSENTRYON = 1
+SSF_AVAILABLE = 2
+SSF_INDICATOR = 4
+TKF_TOGGLEKEYSON = 1
+TKF_AVAILABLE = 2
+TKF_HOTKEYACTIVE = 4
+TKF_CONFIRMHOTKEY = 8
+TKF_HOTKEYSOUND = 16
+TKF_INDICATOR = 32
+SLE_ERROR = 1
+SLE_MINORERROR = 2
+SLE_WARNING = 3
+MONITOR_DEFAULTTONULL = 0
+MONITOR_DEFAULTTOPRIMARY = 1
+MONITOR_DEFAULTTONEAREST = 2
+MONITORINFOF_PRIMARY = 1
+CCHDEVICENAME = 32
+CHILDID_SELF = 0
+INDEXID_OBJECT = 0
+INDEXID_CONTAINER = 0
+OBJID_WINDOW = 0
+OBJID_SYSMENU = -1
+OBJID_TITLEBAR = -2
+OBJID_MENU = -3
+OBJID_CLIENT = -4
+OBJID_VSCROLL = -5
+OBJID_HSCROLL = -6
+OBJID_SIZEGRIP = -7
+OBJID_CARET = -8
+OBJID_CURSOR = -9
+OBJID_ALERT = -10
+OBJID_SOUND = -11
+EVENT_MIN = 1
+EVENT_MAX = 2147483647
+EVENT_SYSTEM_SOUND = 1
+EVENT_SYSTEM_ALERT = 2
+EVENT_SYSTEM_FOREGROUND = 3
+EVENT_SYSTEM_MENUSTART = 4
+EVENT_SYSTEM_MENUEND = 5
+EVENT_SYSTEM_MENUPOPUPSTART = 6
+EVENT_SYSTEM_MENUPOPUPEND = 7
+EVENT_SYSTEM_CAPTURESTART = 8
+EVENT_SYSTEM_CAPTUREEND = 9
+EVENT_SYSTEM_MOVESIZESTART = 10
+EVENT_SYSTEM_MOVESIZEEND = 11
+EVENT_SYSTEM_CONTEXTHELPSTART = 12
+EVENT_SYSTEM_CONTEXTHELPEND = 13
+EVENT_SYSTEM_DRAGDROPSTART = 14
+EVENT_SYSTEM_DRAGDROPEND = 15
+EVENT_SYSTEM_DIALOGSTART = 16
+EVENT_SYSTEM_DIALOGEND = 17
+EVENT_SYSTEM_SCROLLINGSTART = 18
+EVENT_SYSTEM_SCROLLINGEND = 19
+EVENT_SYSTEM_SWITCHSTART = 20
+EVENT_SYSTEM_SWITCHEND = 21
+EVENT_SYSTEM_MINIMIZESTART = 22
+EVENT_SYSTEM_MINIMIZEEND = 23
+EVENT_OBJECT_CREATE = 32768
+EVENT_OBJECT_DESTROY = 32769
+EVENT_OBJECT_SHOW = 32770
+EVENT_OBJECT_HIDE = 32771
+EVENT_OBJECT_REORDER = 32772
+EVENT_OBJECT_FOCUS = 32773
+EVENT_OBJECT_SELECTION = 32774
+EVENT_OBJECT_SELECTIONADD = 32775
+EVENT_OBJECT_SELECTIONREMOVE = 32776
+EVENT_OBJECT_SELECTIONWITHIN = 32777
+EVENT_OBJECT_STATECHANGE = 32778
+EVENT_OBJECT_LOCATIONCHANGE = 32779
+EVENT_OBJECT_NAMECHANGE = 32780
+EVENT_OBJECT_DESCRIPTIONCHANGE = 32781
+EVENT_OBJECT_VALUECHANGE = 32782
+EVENT_OBJECT_PARENTCHANGE = 32783
+EVENT_OBJECT_HELPCHANGE = 32784
+EVENT_OBJECT_DEFACTIONCHANGE = 32785
+EVENT_OBJECT_ACCELERATORCHANGE = 32786
+SOUND_SYSTEM_STARTUP = 1
+SOUND_SYSTEM_SHUTDOWN = 2
+SOUND_SYSTEM_BEEP = 3
+SOUND_SYSTEM_ERROR = 4
+SOUND_SYSTEM_QUESTION = 5
+SOUND_SYSTEM_WARNING = 6
+SOUND_SYSTEM_INFORMATION = 7
+SOUND_SYSTEM_MAXIMIZE = 8
+SOUND_SYSTEM_MINIMIZE = 9
+SOUND_SYSTEM_RESTOREUP = 10
+SOUND_SYSTEM_RESTOREDOWN = 11
+SOUND_SYSTEM_APPSTART = 12
+SOUND_SYSTEM_FAULT = 13
+SOUND_SYSTEM_APPEND = 14
+SOUND_SYSTEM_MENUCOMMAND = 15
+SOUND_SYSTEM_MENUPOPUP = 16
+CSOUND_SYSTEM = 16
+ALERT_SYSTEM_INFORMATIONAL = 1
+ALERT_SYSTEM_WARNING = 2
+ALERT_SYSTEM_ERROR = 3
+ALERT_SYSTEM_QUERY = 4
+ALERT_SYSTEM_CRITICAL = 5
+CALERT_SYSTEM = 6
+WINEVENT_OUTOFCONTEXT = 0
+WINEVENT_SKIPOWNTHREAD = 1
+WINEVENT_SKIPOWNPROCESS = 2
+WINEVENT_INCONTEXT = 4
+GUI_CARETBLINKING = 1
+GUI_INMOVESIZE = 2
+GUI_INMENUMODE = 4
+GUI_SYSTEMMENUMODE = 8
+GUI_POPUPMENUMODE = 16
+STATE_SYSTEM_UNAVAILABLE = 1
+STATE_SYSTEM_SELECTED = 2
+STATE_SYSTEM_FOCUSED = 4
+STATE_SYSTEM_PRESSED = 8
+STATE_SYSTEM_CHECKED = 16
+STATE_SYSTEM_MIXED = 32
+STATE_SYSTEM_READONLY = 64
+STATE_SYSTEM_HOTTRACKED = 128
+STATE_SYSTEM_DEFAULT = 256
+STATE_SYSTEM_EXPANDED = 512
+STATE_SYSTEM_COLLAPSED = 1024
+STATE_SYSTEM_BUSY = 2048
+STATE_SYSTEM_FLOATING = 4096
+STATE_SYSTEM_MARQUEED = 8192
+STATE_SYSTEM_ANIMATED = 16384
+STATE_SYSTEM_INVISIBLE = 32768
+STATE_SYSTEM_OFFSCREEN = 65536
+STATE_SYSTEM_SIZEABLE = 131072
+STATE_SYSTEM_MOVEABLE = 262144
+STATE_SYSTEM_SELFVOICING = 524288
+STATE_SYSTEM_FOCUSABLE = 1048576
+STATE_SYSTEM_SELECTABLE = 2097152
+STATE_SYSTEM_LINKED = 4194304
+STATE_SYSTEM_TRAVERSED = 8388608
+STATE_SYSTEM_MULTISELECTABLE = 16777216
+STATE_SYSTEM_EXTSELECTABLE = 33554432
+STATE_SYSTEM_ALERT_LOW = 67108864
+STATE_SYSTEM_ALERT_MEDIUM = 134217728
+STATE_SYSTEM_ALERT_HIGH = 268435456
+STATE_SYSTEM_VALID = 536870911
+CCHILDREN_TITLEBAR = 5
+CCHILDREN_SCROLLBAR = 5
+CURSOR_SHOWING = 1
+WS_ACTIVECAPTION = 1
+GA_MIC = 1
+GA_PARENT = 1
+GA_ROOT = 2
+GA_ROOTOWNER = 3
+GA_MAC = 4
+
+# winuser.h line 1979
+BF_LEFT = 1
+BF_TOP = 2
+BF_RIGHT = 4
+BF_BOTTOM = 8
+BF_TOPLEFT = (BF_TOP | BF_LEFT)
+BF_TOPRIGHT = (BF_TOP | BF_RIGHT)
+BF_BOTTOMLEFT = (BF_BOTTOM | BF_LEFT)
+BF_BOTTOMRIGHT = (BF_BOTTOM | BF_RIGHT)
+BF_RECT = (BF_LEFT | BF_TOP | BF_RIGHT | BF_BOTTOM)
+BF_DIAGONAL = 16
+BF_DIAGONAL_ENDTOPRIGHT = (BF_DIAGONAL | BF_TOP | BF_RIGHT)
+BF_DIAGONAL_ENDTOPLEFT = (BF_DIAGONAL | BF_TOP | BF_LEFT)
+BF_DIAGONAL_ENDBOTTOMLEFT = (BF_DIAGONAL | BF_BOTTOM | BF_LEFT)
+BF_DIAGONAL_ENDBOTTOMRIGHT = (BF_DIAGONAL | BF_BOTTOM | BF_RIGHT)
+BF_MIDDLE = 2048
+BF_SOFT = 4096
+BF_ADJUST = 8192
+BF_FLAT = 16384
+BF_MONO = 32768
+DFC_CAPTION = 1
+DFC_MENU = 2
+DFC_SCROLL = 3
+DFC_BUTTON = 4
+DFC_POPUPMENU = 5
+DFCS_CAPTIONCLOSE = 0
+DFCS_CAPTIONMIN = 1
+DFCS_CAPTIONMAX = 2
+DFCS_CAPTIONRESTORE = 3
+DFCS_CAPTIONHELP = 4
+DFCS_MENUARROW = 0
+DFCS_MENUCHECK = 1
+DFCS_MENUBULLET = 2
+DFCS_MENUARROWRIGHT = 4
+DFCS_SCROLLUP = 0
+DFCS_SCROLLDOWN = 1
+DFCS_SCROLLLEFT = 2
+DFCS_SCROLLRIGHT = 3
+DFCS_SCROLLCOMBOBOX = 5
+DFCS_SCROLLSIZEGRIP = 8
+DFCS_SCROLLSIZEGRIPRIGHT = 16
+DFCS_BUTTONCHECK = 0
+DFCS_BUTTONRADIOIMAGE = 1
+DFCS_BUTTONRADIOMASK = 2
+DFCS_BUTTONRADIO = 4
+DFCS_BUTTON3STATE = 8
+DFCS_BUTTONPUSH = 16
+DFCS_INACTIVE = 256
+DFCS_PUSHED = 512
+DFCS_CHECKED = 1024
+DFCS_TRANSPARENT = 2048
+DFCS_HOT = 4096
+DFCS_ADJUSTRECT = 8192
+DFCS_FLAT = 16384
+DFCS_MONO = 32768
+DC_ACTIVE = 1
+DC_SMALLCAP = 2
+DC_ICON = 4
+DC_TEXT = 8
+DC_INBUTTON = 16
+DC_GRADIENT = 32
+IDANI_OPEN = 1
+IDANI_CLOSE = 2
+IDANI_CAPTION = 3
+CF_TEXT = 1
+CF_BITMAP = 2
+CF_METAFILEPICT = 3
+CF_SYLK = 4
+CF_DIF = 5
+CF_TIFF = 6
+CF_OEMTEXT = 7
+CF_DIB = 8
+CF_PALETTE = 9
+CF_PENDATA = 10
+CF_RIFF = 11
+CF_WAVE = 12
+CF_UNICODETEXT = 13
+CF_ENHMETAFILE = 14
+CF_HDROP = 15
+CF_LOCALE = 16
+CF_MAX = 17
+CF_OWNERDISPLAY = 128
+CF_DSPTEXT = 129
+CF_DSPBITMAP = 130
+CF_DSPMETAFILEPICT = 131
+CF_DSPENHMETAFILE = 142
+CF_PRIVATEFIRST = 512
+CF_PRIVATELAST = 767
+CF_GDIOBJFIRST = 768
+CF_GDIOBJLAST = 1023
+FVIRTKEY =1
+FNOINVERT = 2
+FSHIFT = 4
+FCONTROL = 8
+FALT = 16
+WPF_SETMINPOSITION = 1
+WPF_RESTORETOMAXIMIZED = 2
+ODT_MENU = 1
+ODT_LISTBOX = 2
+ODT_COMBOBOX = 3
+ODT_BUTTON = 4
+ODT_STATIC = 5
+ODA_DRAWENTIRE = 1
+ODA_SELECT = 2
+ODA_FOCUS = 4
+ODS_SELECTED = 1
+ODS_GRAYED = 2
+ODS_DISABLED = 4
+ODS_CHECKED = 8
+ODS_FOCUS = 16
+ODS_DEFAULT = 32
+ODS_COMBOBOXEDIT = 4096
+ODS_HOTLIGHT = 64
+ODS_INACTIVE = 128
+PM_NOREMOVE = 0
+PM_REMOVE = 1
+PM_NOYIELD = 2
+# Name clashes with key.MOD_ALT, key.MOD_CONTROL and key.MOD_SHIFT
+WIN32_MOD_ALT = 1
+WIN32_MOD_CONTROL = 2
+WIN32_MOD_SHIFT = 4
+WIN32_MOD_WIN = 8
+IDHOT_SNAPWINDOW = (-1)
+IDHOT_SNAPDESKTOP = (-2)
+#EW_RESTARTWINDOWS = 0x0042
+#EW_REBOOTSYSTEM = 0x0043
+#EW_EXITANDEXECAPP = 0x0044
+ENDSESSION_LOGOFF = -2147483648
+EWX_LOGOFF = 0
+EWX_SHUTDOWN = 1
+EWX_REBOOT = 2
+EWX_FORCE = 4
+EWX_POWEROFF = 8
+EWX_FORCEIFHUNG = 16
+BSM_ALLCOMPONENTS = 0
+BSM_VXDS = 1
+BSM_NETDRIVER = 2
+BSM_INSTALLABLEDRIVERS = 4
+BSM_APPLICATIONS = 8
+BSM_ALLDESKTOPS = 16
+BSF_QUERY = 1
+BSF_IGNORECURRENTTASK = 2
+BSF_FLUSHDISK = 4
+BSF_NOHANG = 8
+BSF_POSTMESSAGE = 16
+BSF_FORCEIFHUNG = 32
+BSF_NOTIMEOUTIFNOTHUNG = 64
+BROADCAST_QUERY_DENY = 1112363332 # Return this value to deny a query.
+
+DBWF_LPARAMPOINTER = 32768
+
+# winuser.h line 3232
+SWP_NOSIZE = 1
+SWP_NOMOVE = 2
+SWP_NOZORDER = 4
+SWP_NOREDRAW = 8
+SWP_NOACTIVATE = 16
+SWP_FRAMECHANGED = 32
+SWP_SHOWWINDOW = 64
+SWP_HIDEWINDOW = 128
+SWP_NOCOPYBITS = 256
+SWP_NOOWNERZORDER = 512
+SWP_NOSENDCHANGING = 1024
+SWP_DRAWFRAME = SWP_FRAMECHANGED
+SWP_NOREPOSITION = SWP_NOOWNERZORDER
+SWP_DEFERERASE = 8192
+SWP_ASYNCWINDOWPOS = 16384
+
+DLGWINDOWEXTRA = 30
+# winuser.h line 4249
+KEYEVENTF_EXTENDEDKEY = 1
+KEYEVENTF_KEYUP = 2
+MOUSEEVENTF_MOVE = 1
+MOUSEEVENTF_LEFTDOWN = 2
+MOUSEEVENTF_LEFTUP = 4
+MOUSEEVENTF_RIGHTDOWN = 8
+MOUSEEVENTF_RIGHTUP = 16
+MOUSEEVENTF_MIDDLEDOWN = 32
+MOUSEEVENTF_MIDDLEUP = 64
+MOUSEEVENTF_ABSOLUTE = 32768
+INPUT_MOUSE = 0
+INPUT_KEYBOARD = 1
+INPUT_HARDWARE = 2
+MWMO_WAITALL = 1
+MWMO_ALERTABLE = 2
+MWMO_INPUTAVAILABLE = 4
+QS_KEY = 1
+QS_MOUSEMOVE = 2
+QS_MOUSEBUTTON = 4
+QS_POSTMESSAGE = 8
+QS_TIMER = 16
+QS_PAINT = 32
+QS_SENDMESSAGE = 64
+QS_HOTKEY = 128
+QS_MOUSE = (QS_MOUSEMOVE | \
+ QS_MOUSEBUTTON)
+QS_INPUT = (QS_MOUSE | \
+ QS_KEY)
+QS_ALLEVENTS = (QS_INPUT | \
+ QS_POSTMESSAGE | \
+ QS_TIMER | \
+ QS_PAINT | \
+ QS_HOTKEY)
+QS_ALLINPUT = (QS_INPUT | \
+ QS_POSTMESSAGE | \
+ QS_TIMER | \
+ QS_PAINT | \
+ QS_HOTKEY | \
+ QS_SENDMESSAGE)
+
+
+IMN_CLOSESTATUSWINDOW = 1
+IMN_OPENSTATUSWINDOW = 2
+IMN_CHANGECANDIDATE = 3
+IMN_CLOSECANDIDATE = 4
+IMN_OPENCANDIDATE = 5
+IMN_SETCONVERSIONMODE = 6
+IMN_SETSENTENCEMODE = 7
+IMN_SETOPENSTATUS = 8
+IMN_SETCANDIDATEPOS = 9
+IMN_SETCOMPOSITIONFONT = 10
+IMN_SETCOMPOSITIONWINDOW = 11
+IMN_SETSTATUSWINDOWPOS = 12
+IMN_GUIDELINE = 13
+IMN_PRIVATE = 14
+
+# winuser.h line 8518
+HELP_CONTEXT = 1
+HELP_QUIT = 2
+HELP_INDEX = 3
+HELP_CONTENTS = 3
+HELP_HELPONHELP = 4
+HELP_SETINDEX = 5
+HELP_SETCONTENTS = 5
+HELP_CONTEXTPOPUP = 8
+HELP_FORCEFILE = 9
+HELP_KEY = 257
+HELP_COMMAND = 258
+HELP_PARTIALKEY = 261
+HELP_MULTIKEY = 513
+HELP_SETWINPOS = 515
+HELP_CONTEXTMENU = 10
+HELP_FINDER = 11
+HELP_WM_HELP = 12
+HELP_SETPOPUP_POS = 13
+HELP_TCARD = 32768
+HELP_TCARD_DATA = 16
+HELP_TCARD_OTHER_CALLER = 17
+IDH_NO_HELP = 28440
+IDH_MISSING_CONTEXT = 28441 # Control doesn't have matching help context
+IDH_GENERIC_HELP_BUTTON = 28442 # Property sheet help button
+IDH_OK = 28443
+IDH_CANCEL = 28444
+IDH_HELP = 28445
+GR_GDIOBJECTS = 0 # Count of GDI objects
+GR_USEROBJECTS = 1 # Count of USER objects
+# Generated by h2py from \msvcnt\include\wingdi.h
+# manually added (missed by generation some how!
+SRCCOPY = 13369376 # dest = source
+SRCPAINT = 15597702 # dest = source OR dest
+SRCAND = 8913094 # dest = source AND dest
+SRCINVERT = 6684742 # dest = source XOR dest
+SRCERASE = 4457256 # dest = source AND (NOT dest )
+NOTSRCCOPY = 3342344 # dest = (NOT source)
+NOTSRCERASE = 1114278 # dest = (NOT src) AND (NOT dest)
+MERGECOPY = 12583114 # dest = (source AND pattern)
+MERGEPAINT = 12255782 # dest = (NOT source) OR dest
+PATCOPY = 15728673 # dest = pattern
+PATPAINT = 16452105 # dest = DPSnoo
+PATINVERT = 5898313 # dest = pattern XOR dest
+DSTINVERT = 5570569 # dest = (NOT dest)
+BLACKNESS = 66 # dest = BLACK
+WHITENESS = 16711778 # dest = WHITE
+
+# hacked and split manually by mhammond.
+R2_BLACK = 1
+R2_NOTMERGEPEN = 2
+R2_MASKNOTPEN = 3
+R2_NOTCOPYPEN = 4
+R2_MASKPENNOT = 5
+R2_NOT = 6
+R2_XORPEN = 7
+R2_NOTMASKPEN = 8
+R2_MASKPEN = 9
+R2_NOTXORPEN = 10
+R2_NOP = 11
+R2_MERGENOTPEN = 12
+R2_COPYPEN = 13
+R2_MERGEPENNOT = 14
+R2_MERGEPEN = 15
+R2_WHITE = 16
+R2_LAST = 16
+GDI_ERROR = (-1)
+ERROR = 0
+NULLREGION = 1
+SIMPLEREGION = 2
+COMPLEXREGION = 3
+RGN_ERROR = ERROR
+RGN_AND = 1
+RGN_OR = 2
+RGN_XOR = 3
+RGN_DIFF = 4
+RGN_COPY = 5
+RGN_MIN = RGN_AND
+RGN_MAX = RGN_COPY
+BLACKONWHITE = 1
+WHITEONBLACK = 2
+COLORONCOLOR = 3
+HALFTONE = 4
+MAXSTRETCHBLTMODE = 4
+ALTERNATE = 1
+WINDING = 2
+POLYFILL_LAST = 2
+TA_NOUPDATECP = 0
+TA_UPDATECP = 1
+TA_LEFT = 0
+TA_RIGHT = 2
+TA_CENTER = 6
+TA_TOP = 0
+TA_BOTTOM = 8
+TA_BASELINE = 24
+TA_MASK = (TA_BASELINE+TA_CENTER+TA_UPDATECP)
+VTA_BASELINE = TA_BASELINE
+VTA_LEFT = TA_BOTTOM
+VTA_RIGHT = TA_TOP
+VTA_CENTER = TA_CENTER
+VTA_BOTTOM = TA_RIGHT
+VTA_TOP = TA_LEFT
+ETO_GRAYED = 1
+ETO_OPAQUE = 2
+ETO_CLIPPED = 4
+ASPECT_FILTERING = 1
+DCB_RESET = 1
+DCB_ACCUMULATE = 2
+DCB_DIRTY = DCB_ACCUMULATE
+DCB_SET = (DCB_RESET | DCB_ACCUMULATE)
+DCB_ENABLE = 4
+DCB_DISABLE = 8
+META_SETBKCOLOR = 513
+META_SETBKMODE = 258
+META_SETMAPMODE = 259
+META_SETROP2 = 260
+META_SETRELABS = 261
+META_SETPOLYFILLMODE = 262
+META_SETSTRETCHBLTMODE = 263
+META_SETTEXTCHAREXTRA = 264
+META_SETTEXTCOLOR = 521
+META_SETTEXTJUSTIFICATION = 522
+META_SETWINDOWORG = 523
+META_SETWINDOWEXT = 524
+META_SETVIEWPORTORG = 525
+META_SETVIEWPORTEXT = 526
+META_OFFSETWINDOWORG = 527
+META_SCALEWINDOWEXT = 1040
+META_OFFSETVIEWPORTORG = 529
+META_SCALEVIEWPORTEXT = 1042
+META_LINETO = 531
+META_MOVETO = 532
+META_EXCLUDECLIPRECT = 1045
+META_INTERSECTCLIPRECT = 1046
+META_ARC = 2071
+META_ELLIPSE = 1048
+META_FLOODFILL = 1049
+META_PIE = 2074
+META_RECTANGLE = 1051
+META_ROUNDRECT = 1564
+META_PATBLT = 1565
+META_SAVEDC = 30
+META_SETPIXEL = 1055
+META_OFFSETCLIPRGN = 544
+META_TEXTOUT = 1313
+META_BITBLT = 2338
+META_STRETCHBLT = 2851
+META_POLYGON = 804
+META_POLYLINE = 805
+META_ESCAPE = 1574
+META_RESTOREDC = 295
+META_FILLREGION = 552
+META_FRAMEREGION = 1065
+META_INVERTREGION = 298
+META_PAINTREGION = 299
+META_SELECTCLIPREGION = 300
+META_SELECTOBJECT = 301
+META_SETTEXTALIGN = 302
+META_CHORD = 2096
+META_SETMAPPERFLAGS = 561
+META_EXTTEXTOUT = 2610
+META_SETDIBTODEV = 3379
+META_SELECTPALETTE = 564
+META_REALIZEPALETTE = 53
+META_ANIMATEPALETTE = 1078
+META_SETPALENTRIES = 55
+META_POLYPOLYGON = 1336
+META_RESIZEPALETTE = 313
+META_DIBBITBLT = 2368
+META_DIBSTRETCHBLT = 2881
+META_DIBCREATEPATTERNBRUSH = 322
+META_STRETCHDIB = 3907
+META_EXTFLOODFILL = 1352
+META_DELETEOBJECT = 496
+META_CREATEPALETTE = 247
+META_CREATEPATTERNBRUSH = 505
+META_CREATEPENINDIRECT = 762
+META_CREATEFONTINDIRECT = 763
+META_CREATEBRUSHINDIRECT = 764
+META_CREATEREGION = 1791
+FILE_BEGIN = 0
+FILE_CURRENT = 1
+FILE_END = 2
+FILE_FLAG_WRITE_THROUGH = -2147483648
+FILE_FLAG_OVERLAPPED = 1073741824
+FILE_FLAG_NO_BUFFERING = 536870912
+FILE_FLAG_RANDOM_ACCESS = 268435456
+FILE_FLAG_SEQUENTIAL_SCAN = 134217728
+FILE_FLAG_DELETE_ON_CLOSE = 67108864
+FILE_FLAG_BACKUP_SEMANTICS = 33554432
+FILE_FLAG_POSIX_SEMANTICS = 16777216
+CREATE_NEW = 1
+CREATE_ALWAYS = 2
+OPEN_EXISTING = 3
+OPEN_ALWAYS = 4
+TRUNCATE_EXISTING = 5
+PIPE_ACCESS_INBOUND = 1
+PIPE_ACCESS_OUTBOUND = 2
+PIPE_ACCESS_DUPLEX = 3
+PIPE_CLIENT_END = 0
+PIPE_SERVER_END = 1
+PIPE_WAIT = 0
+PIPE_NOWAIT = 1
+PIPE_READMODE_BYTE = 0
+PIPE_READMODE_MESSAGE = 2
+PIPE_TYPE_BYTE = 0
+PIPE_TYPE_MESSAGE = 4
+PIPE_UNLIMITED_INSTANCES = 255
+SECURITY_CONTEXT_TRACKING = 262144
+SECURITY_EFFECTIVE_ONLY = 524288
+SECURITY_SQOS_PRESENT = 1048576
+SECURITY_VALID_SQOS_FLAGS = 2031616
+DTR_CONTROL_DISABLE = 0
+DTR_CONTROL_ENABLE = 1
+DTR_CONTROL_HANDSHAKE = 2
+RTS_CONTROL_DISABLE = 0
+RTS_CONTROL_ENABLE = 1
+RTS_CONTROL_HANDSHAKE = 2
+RTS_CONTROL_TOGGLE = 3
+GMEM_FIXED = 0
+GMEM_MOVEABLE = 2
+GMEM_NOCOMPACT = 16
+GMEM_NODISCARD = 32
+GMEM_ZEROINIT = 64
+GMEM_MODIFY = 128
+GMEM_DISCARDABLE = 256
+GMEM_NOT_BANKED = 4096
+GMEM_SHARE = 8192
+GMEM_DDESHARE = 8192
+GMEM_NOTIFY = 16384
+GMEM_LOWER = GMEM_NOT_BANKED
+GMEM_VALID_FLAGS = 32626
+GMEM_INVALID_HANDLE = 32768
+GHND = (GMEM_MOVEABLE | GMEM_ZEROINIT)
+GPTR = (GMEM_FIXED | GMEM_ZEROINIT)
+GMEM_DISCARDED = 16384
+GMEM_LOCKCOUNT = 255
+LMEM_FIXED = 0
+LMEM_MOVEABLE = 2
+LMEM_NOCOMPACT = 16
+LMEM_NODISCARD = 32
+LMEM_ZEROINIT = 64
+LMEM_MODIFY = 128
+LMEM_DISCARDABLE = 3840
+LMEM_VALID_FLAGS = 3954
+LMEM_INVALID_HANDLE = 32768
+LHND = (LMEM_MOVEABLE | LMEM_ZEROINIT)
+LPTR = (LMEM_FIXED | LMEM_ZEROINIT)
+NONZEROLHND = (LMEM_MOVEABLE)
+NONZEROLPTR = (LMEM_FIXED)
+LMEM_DISCARDED = 16384
+LMEM_LOCKCOUNT = 255
+DEBUG_PROCESS = 1
+DEBUG_ONLY_THIS_PROCESS = 2
+CREATE_SUSPENDED = 4
+DETACHED_PROCESS = 8
+CREATE_NEW_CONSOLE = 16
+NORMAL_PRIORITY_CLASS = 32
+IDLE_PRIORITY_CLASS = 64
+HIGH_PRIORITY_CLASS = 128
+REALTIME_PRIORITY_CLASS = 256
+CREATE_NEW_PROCESS_GROUP = 512
+CREATE_UNICODE_ENVIRONMENT = 1024
+CREATE_SEPARATE_WOW_VDM = 2048
+CREATE_SHARED_WOW_VDM = 4096
+CREATE_DEFAULT_ERROR_MODE = 67108864
+CREATE_NO_WINDOW = 134217728
+PROFILE_USER = 268435456
+PROFILE_KERNEL = 536870912
+PROFILE_SERVER = 1073741824
+THREAD_BASE_PRIORITY_LOWRT = 15
+THREAD_BASE_PRIORITY_MAX = 2
+THREAD_BASE_PRIORITY_MIN = -2
+THREAD_BASE_PRIORITY_IDLE = -15
+THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN
+THREAD_PRIORITY_BELOW_NORMAL = THREAD_PRIORITY_LOWEST+1
+THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX
+THREAD_PRIORITY_ABOVE_NORMAL = THREAD_PRIORITY_HIGHEST-1
+THREAD_PRIORITY_ERROR_RETURN = MAXLONG
+THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT
+THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE
+THREAD_PRIORITY_NORMAL = 0
+EXCEPTION_DEBUG_EVENT = 1
+CREATE_THREAD_DEBUG_EVENT = 2
+CREATE_PROCESS_DEBUG_EVENT = 3
+EXIT_THREAD_DEBUG_EVENT = 4
+EXIT_PROCESS_DEBUG_EVENT = 5
+LOAD_DLL_DEBUG_EVENT = 6
+UNLOAD_DLL_DEBUG_EVENT = 7
+OUTPUT_DEBUG_STRING_EVENT = 8
+RIP_EVENT = 9
+DRIVE_UNKNOWN = 0
+DRIVE_NO_ROOT_DIR = 1
+DRIVE_REMOVABLE = 2
+DRIVE_FIXED = 3
+DRIVE_REMOTE = 4
+DRIVE_CDROM = 5
+DRIVE_RAMDISK = 6
+FILE_TYPE_UNKNOWN = 0
+FILE_TYPE_DISK = 1
+FILE_TYPE_CHAR = 2
+FILE_TYPE_PIPE = 3
+FILE_TYPE_REMOTE = 32768
+NOPARITY = 0
+ODDPARITY = 1
+EVENPARITY = 2
+MARKPARITY = 3
+SPACEPARITY = 4
+ONESTOPBIT = 0
+ONE5STOPBITS = 1
+TWOSTOPBITS = 2
+CBR_110 = 110
+CBR_300 = 300
+CBR_600 = 600
+CBR_1200 = 1200
+CBR_2400 = 2400
+CBR_4800 = 4800
+CBR_9600 = 9600
+CBR_14400 = 14400
+CBR_19200 = 19200
+CBR_38400 = 38400
+CBR_56000 = 56000
+CBR_57600 = 57600
+CBR_115200 = 115200
+CBR_128000 = 128000
+CBR_256000 = 256000
+S_QUEUEEMPTY = 0
+S_THRESHOLD = 1
+S_ALLTHRESHOLD = 2
+S_NORMAL = 0
+S_LEGATO = 1
+S_STACCATO = 2
+NMPWAIT_WAIT_FOREVER = -1
+NMPWAIT_NOWAIT = 1
+NMPWAIT_USE_DEFAULT_WAIT = 0
+OF_READ = 0
+OF_WRITE = 1
+OF_READWRITE = 2
+OF_SHARE_COMPAT = 0
+OF_SHARE_EXCLUSIVE = 16
+OF_SHARE_DENY_WRITE = 32
+OF_SHARE_DENY_READ = 48
+OF_SHARE_DENY_NONE = 64
+OF_PARSE = 256
+OF_DELETE = 512
+OF_VERIFY = 1024
+OF_CANCEL = 2048
+OF_CREATE = 4096
+OF_PROMPT = 8192
+OF_EXIST = 16384
+OF_REOPEN = 32768
+OFS_MAXPATHNAME = 128
+MAXINTATOM = 49152
+
+# winbase.h
+PROCESS_HEAP_REGION = 1
+PROCESS_HEAP_UNCOMMITTED_RANGE = 2
+PROCESS_HEAP_ENTRY_BUSY = 4
+PROCESS_HEAP_ENTRY_MOVEABLE = 16
+PROCESS_HEAP_ENTRY_DDESHARE = 32
+SCS_32BIT_BINARY = 0
+SCS_DOS_BINARY = 1
+SCS_WOW_BINARY = 2
+SCS_PIF_BINARY = 3
+SCS_POSIX_BINARY = 4
+SCS_OS216_BINARY = 5
+SEM_FAILCRITICALERRORS = 1
+SEM_NOGPFAULTERRORBOX = 2
+SEM_NOALIGNMENTFAULTEXCEPT = 4
+SEM_NOOPENFILEERRORBOX = 32768
+LOCKFILE_FAIL_IMMEDIATELY = 1
+LOCKFILE_EXCLUSIVE_LOCK = 2
+HANDLE_FLAG_INHERIT = 1
+HANDLE_FLAG_PROTECT_FROM_CLOSE = 2
+HINSTANCE_ERROR = 32
+GET_TAPE_MEDIA_INFORMATION = 0
+GET_TAPE_DRIVE_INFORMATION = 1
+SET_TAPE_MEDIA_INFORMATION = 0
+SET_TAPE_DRIVE_INFORMATION = 1
+FORMAT_MESSAGE_ALLOCATE_BUFFER = 256
+FORMAT_MESSAGE_IGNORE_INSERTS = 512
+FORMAT_MESSAGE_FROM_STRING = 1024
+FORMAT_MESSAGE_FROM_HMODULE = 2048
+FORMAT_MESSAGE_FROM_SYSTEM = 4096
+FORMAT_MESSAGE_ARGUMENT_ARRAY = 8192
+FORMAT_MESSAGE_MAX_WIDTH_MASK = 255
+BACKUP_INVALID = 0
+BACKUP_DATA = 1
+BACKUP_EA_DATA = 2
+BACKUP_SECURITY_DATA = 3
+BACKUP_ALTERNATE_DATA = 4
+BACKUP_LINK = 5
+BACKUP_PROPERTY_DATA = 6
+BACKUP_OBJECT_ID = 7
+BACKUP_REPARSE_DATA = 8
+BACKUP_SPARSE_BLOCK = 9
+
+STREAM_NORMAL_ATTRIBUTE = 0
+STREAM_MODIFIED_WHEN_READ = 1
+STREAM_CONTAINS_SECURITY = 2
+STREAM_CONTAINS_PROPERTIES = 4
+STARTF_USESHOWWINDOW = 1
+STARTF_USESIZE = 2
+STARTF_USEPOSITION = 4
+STARTF_USECOUNTCHARS = 8
+STARTF_USEFILLATTRIBUTE = 16
+STARTF_FORCEONFEEDBACK = 64
+STARTF_FORCEOFFFEEDBACK = 128
+STARTF_USESTDHANDLES = 256
+STARTF_USEHOTKEY = 512
+SHUTDOWN_NORETRY = 1
+DONT_RESOLVE_DLL_REFERENCES = 1
+LOAD_LIBRARY_AS_DATAFILE = 2
+LOAD_WITH_ALTERED_SEARCH_PATH = 8
+DDD_RAW_TARGET_PATH = 1
+DDD_REMOVE_DEFINITION = 2
+DDD_EXACT_MATCH_ON_REMOVE = 4
+MOVEFILE_REPLACE_EXISTING = 1
+MOVEFILE_COPY_ALLOWED = 2
+MOVEFILE_DELAY_UNTIL_REBOOT = 4
+MAX_COMPUTERNAME_LENGTH = 15
+LOGON32_LOGON_INTERACTIVE = 2
+LOGON32_LOGON_BATCH = 4
+LOGON32_LOGON_SERVICE = 5
+LOGON32_PROVIDER_DEFAULT = 0
+LOGON32_PROVIDER_WINNT35 = 1
+VER_PLATFORM_WIN32s = 0
+VER_PLATFORM_WIN32_WINDOWS = 1
+VER_PLATFORM_WIN32_NT = 2
+TC_NORMAL = 0
+TC_HARDERR = 1
+TC_GP_TRAP = 2
+TC_SIGNAL = 3
+AC_LINE_OFFLINE = 0
+AC_LINE_ONLINE = 1
+AC_LINE_BACKUP_POWER = 2
+AC_LINE_UNKNOWN = 255
+BATTERY_FLAG_HIGH = 1
+BATTERY_FLAG_LOW = 2
+BATTERY_FLAG_CRITICAL = 4
+BATTERY_FLAG_CHARGING = 8
+BATTERY_FLAG_NO_BATTERY = 128
+BATTERY_FLAG_UNKNOWN = 255
+BATTERY_PERCENTAGE_UNKNOWN = 255
+BATTERY_LIFE_UNKNOWN = -1
+
+# Generated by h2py from d:\msdev\include\richedit.h
+cchTextLimitDefault = 32767
+WM_CONTEXTMENU = 123
+WM_PRINTCLIENT = 792
+EN_MSGFILTER = 1792
+EN_REQUESTRESIZE = 1793
+EN_SELCHANGE = 1794
+EN_DROPFILES = 1795
+EN_PROTECTED = 1796
+EN_CORRECTTEXT = 1797
+EN_STOPNOUNDO = 1798
+EN_IMECHANGE = 1799
+EN_SAVECLIPBOARD = 1800
+EN_OLEOPFAILED = 1801
+ENM_NONE = 0
+ENM_CHANGE = 1
+ENM_UPDATE = 2
+ENM_SCROLL = 4
+ENM_KEYEVENTS = 65536
+ENM_MOUSEEVENTS = 131072
+ENM_REQUESTRESIZE = 262144
+ENM_SELCHANGE = 524288
+ENM_DROPFILES = 1048576
+ENM_PROTECTED = 2097152
+ENM_CORRECTTEXT = 4194304
+ENM_IMECHANGE = 8388608
+ES_SAVESEL = 32768
+ES_SUNKEN = 16384
+ES_DISABLENOSCROLL = 8192
+ES_SELECTIONBAR = 16777216
+ES_EX_NOCALLOLEINIT = 16777216
+ES_VERTICAL = 4194304
+ES_NOIME = 524288
+ES_SELFIME = 262144
+ECO_AUTOWORDSELECTION = 1
+ECO_AUTOVSCROLL = 64
+ECO_AUTOHSCROLL = 128
+ECO_NOHIDESEL = 256
+ECO_READONLY = 2048
+ECO_WANTRETURN = 4096
+ECO_SAVESEL = 32768
+ECO_SELECTIONBAR = 16777216
+ECO_VERTICAL = 4194304
+ECOOP_SET = 1
+ECOOP_OR = 2
+ECOOP_AND = 3
+ECOOP_XOR = 4
+WB_CLASSIFY = 3
+WB_MOVEWORDLEFT = 4
+WB_MOVEWORDRIGHT = 5
+WB_LEFTBREAK = 6
+WB_RIGHTBREAK = 7
+WB_MOVEWORDPREV = 4
+WB_MOVEWORDNEXT = 5
+WB_PREVBREAK = 6
+WB_NEXTBREAK = 7
+PC_FOLLOWING = 1
+PC_LEADING = 2
+PC_OVERFLOW = 3
+PC_DELIMITER = 4
+WBF_WORDWRAP = 16
+WBF_WORDBREAK = 32
+WBF_OVERFLOW = 64
+WBF_LEVEL1 = 128
+WBF_LEVEL2 = 256
+WBF_CUSTOM = 512
+CFM_BOLD = 1
+CFM_ITALIC = 2
+CFM_UNDERLINE = 4
+CFM_STRIKEOUT = 8
+CFM_PROTECTED = 16
+CFM_SIZE = -2147483648
+CFM_COLOR = 1073741824
+CFM_FACE = 536870912
+CFM_OFFSET = 268435456
+CFM_CHARSET = 134217728
+CFE_BOLD = 1
+CFE_ITALIC = 2
+CFE_UNDERLINE = 4
+CFE_STRIKEOUT = 8
+CFE_PROTECTED = 16
+CFE_AUTOCOLOR = 1073741824
+yHeightCharPtsMost = 1638
+SCF_SELECTION = 1
+SCF_WORD = 2
+SF_TEXT = 1
+SF_RTF = 2
+SF_RTFNOOBJS = 3
+SF_TEXTIZED = 4
+SFF_SELECTION = 32768
+SFF_PLAINRTF = 16384
+MAX_TAB_STOPS = 32
+lDefaultTab = 720
+PFM_STARTINDENT = 1
+PFM_RIGHTINDENT = 2
+PFM_OFFSET = 4
+PFM_ALIGNMENT = 8
+PFM_TABSTOPS = 16
+PFM_NUMBERING = 32
+PFM_OFFSETINDENT = -2147483648
+PFN_BULLET = 1
+PFA_LEFT = 1
+PFA_RIGHT = 2
+PFA_CENTER = 3
+WM_NOTIFY = 78
+SEL_EMPTY = 0
+SEL_TEXT = 1
+SEL_OBJECT = 2
+SEL_MULTICHAR = 4
+SEL_MULTIOBJECT = 8
+OLEOP_DOVERB = 1
+CF_RTF = "Rich Text Format"
+CF_RTFNOOBJS = "Rich Text Format Without Objects"
+CF_RETEXTOBJ = "RichEdit Text and Objects"
+
+# From wincon.h
+RIGHT_ALT_PRESSED = 1 # the right alt key is pressed.
+LEFT_ALT_PRESSED = 2 # the left alt key is pressed.
+RIGHT_CTRL_PRESSED = 4 # the right ctrl key is pressed.
+LEFT_CTRL_PRESSED = 8 # the left ctrl key is pressed.
+SHIFT_PRESSED = 16 # the shift key is pressed.
+NUMLOCK_ON = 32 # the numlock light is on.
+SCROLLLOCK_ON = 64 # the scrolllock light is on.
+CAPSLOCK_ON = 128 # the capslock light is on.
+ENHANCED_KEY = 256 # the key is enhanced.
+NLS_DBCSCHAR = 65536 # DBCS for JPN: SBCS/DBCS mode.
+NLS_ALPHANUMERIC = 0 # DBCS for JPN: Alphanumeric mode.
+NLS_KATAKANA = 131072 # DBCS for JPN: Katakana mode.
+NLS_HIRAGANA = 262144 # DBCS for JPN: Hiragana mode.
+NLS_ROMAN = 4194304 # DBCS for JPN: Roman/Noroman mode.
+NLS_IME_CONVERSION = 8388608 # DBCS for JPN: IME conversion.
+NLS_IME_DISABLE = 536870912 # DBCS for JPN: IME enable/disable.
+
+FROM_LEFT_1ST_BUTTON_PRESSED = 1
+RIGHTMOST_BUTTON_PRESSED = 2
+FROM_LEFT_2ND_BUTTON_PRESSED = 4
+FROM_LEFT_3RD_BUTTON_PRESSED = 8
+FROM_LEFT_4TH_BUTTON_PRESSED = 16
+
+CTRL_C_EVENT = 0
+CTRL_BREAK_EVENT = 1
+CTRL_CLOSE_EVENT = 2
+CTRL_LOGOFF_EVENT = 5
+CTRL_SHUTDOWN_EVENT = 6
+
+MOUSE_MOVED = 1
+DOUBLE_CLICK = 2
+MOUSE_WHEELED = 4
+
+#property sheet window messages from prsht.h
+PSM_SETCURSEL = (WM_USER + 101)
+PSM_REMOVEPAGE = (WM_USER + 102)
+PSM_ADDPAGE = (WM_USER + 103)
+PSM_CHANGED = (WM_USER + 104)
+PSM_RESTARTWINDOWS = (WM_USER + 105)
+PSM_REBOOTSYSTEM = (WM_USER + 106)
+PSM_CANCELTOCLOSE = (WM_USER + 107)
+PSM_QUERYSIBLINGS = (WM_USER + 108)
+PSM_UNCHANGED = (WM_USER + 109)
+PSM_APPLY = (WM_USER + 110)
+PSM_SETTITLEA = (WM_USER + 111)
+PSM_SETTITLEW = (WM_USER + 120)
+PSM_SETWIZBUTTONS = (WM_USER + 112)
+PSM_PRESSBUTTON = (WM_USER + 113)
+PSM_SETCURSELID = (WM_USER + 114)
+PSM_SETFINISHTEXTA = (WM_USER + 115)
+PSM_SETFINISHTEXTW = (WM_USER + 121)
+PSM_GETTABCONTROL = (WM_USER + 116)
+PSM_ISDIALOGMESSAGE = (WM_USER + 117)
+PSM_GETCURRENTPAGEHWND = (WM_USER + 118)
+PSM_INSERTPAGE = (WM_USER + 119)
+PSM_SETHEADERTITLEA = (WM_USER + 125)
+PSM_SETHEADERTITLEW = (WM_USER + 126)
+PSM_SETHEADERSUBTITLEA = (WM_USER + 127)
+PSM_SETHEADERSUBTITLEW = (WM_USER + 128)
+PSM_HWNDTOINDEX = (WM_USER + 129)
+PSM_INDEXTOHWND = (WM_USER + 130)
+PSM_PAGETOINDEX = (WM_USER + 131)
+PSM_INDEXTOPAGE = (WM_USER + 132)
+PSM_IDTOINDEX = (WM_USER + 133)
+PSM_INDEXTOID = (WM_USER + 134)
+PSM_GETRESULT = (WM_USER + 135)
+PSM_RECALCPAGESIZES = (WM_USER + 136)
+
+# GetUserNameEx/GetComputerNameEx
+NameUnknown = 0
+NameFullyQualifiedDN = 1
+NameSamCompatible = 2
+NameDisplay = 3
+NameUniqueId = 6
+NameCanonical = 7
+NameUserPrincipal = 8
+NameCanonicalEx = 9
+NameServicePrincipal = 10
+NameDnsDomain = 12
+
+ComputerNameNetBIOS = 0
+ComputerNameDnsHostname = 1
+ComputerNameDnsDomain = 2
+ComputerNameDnsFullyQualified = 3
+ComputerNamePhysicalNetBIOS = 4
+ComputerNamePhysicalDnsHostname = 5
+ComputerNamePhysicalDnsDomain = 6
+ComputerNamePhysicalDnsFullyQualified = 7
+
+LWA_COLORKEY = 0x00000001
+LWA_ALPHA = 0x00000002
+ULW_COLORKEY = 0x00000001
+ULW_ALPHA = 0x00000002
+ULW_OPAQUE = 0x00000004
+
+# WinDef.h
+TRUE = 1
+FALSE = 0
+MAX_PATH = 260
+# WinGDI.h
+AC_SRC_OVER = 0
+AC_SRC_ALPHA = 1
+GRADIENT_FILL_RECT_H = 0
+GRADIENT_FILL_RECT_V = 1
+GRADIENT_FILL_TRIANGLE = 2
+GRADIENT_FILL_OP_FLAG = 255
+
+# Bizarrely missing from any platform header. Ref:
+# http://www.codeguru.com/forum/archive/index.php/t-426785.html
+MAPVK_VK_TO_VSC = 0
+MAPVK_VSC_TO_VK = 1
+MAPVK_VK_TO_CHAR = 2
+MAPVK_VSC_TO_VK_EX = 3
+
+USER_TIMER_MAXIMUM = 0x7fffffff
+
+# From WinBase.h
+INFINITE = 0xffffffff
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/win32/dinput.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/win32/dinput.py
new file mode 100644
index 0000000..3023599
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/win32/dinput.py
@@ -0,0 +1,397 @@
+import ctypes
+
+from pyglet import com
+
+lib = ctypes.oledll.dinput8
+
+LPVOID = ctypes.c_void_p
+WORD = ctypes.c_uint16
+DWORD = ctypes.c_uint32
+LPDWORD = ctypes.POINTER(DWORD)
+BOOL = ctypes.c_int
+WCHAR = ctypes.c_wchar
+UINT = ctypes.c_uint
+HWND = ctypes.c_uint32
+HANDLE = LPVOID
+MAX_PATH = 260
+
+DIENUM_STOP = 0
+DIENUM_CONTINUE = 1
+
+DIEDFL_ALLDEVICES = 0x00000000
+DIEDFL_ATTACHEDONLY = 0x00000001
+DIEDFL_FORCEFEEDBACK = 0x00000100
+DIEDFL_INCLUDEALIASES = 0x00010000
+DIEDFL_INCLUDEPHANTOMS = 0x00020000
+DIEDFL_INCLUDEHIDDEN = 0x00040000
+
+DI8DEVCLASS_ALL = 0
+DI8DEVCLASS_DEVICE = 1
+DI8DEVCLASS_POINTER = 2
+DI8DEVCLASS_KEYBOARD = 3
+DI8DEVCLASS_GAMECTRL = 4
+
+DI8DEVTYPE_DEVICE = 0x11
+DI8DEVTYPE_MOUSE = 0x12
+DI8DEVTYPE_KEYBOARD = 0x13
+DI8DEVTYPE_JOYSTICK = 0x14
+DI8DEVTYPE_GAMEPAD = 0x15
+DI8DEVTYPE_DRIVING = 0x16
+DI8DEVTYPE_FLIGHT = 0x17
+DI8DEVTYPE_1STPERSON = 0x18
+DI8DEVTYPE_DEVICECTRL = 0x19
+DI8DEVTYPE_SCREENPOINTER = 0x1A
+DI8DEVTYPE_REMOTE = 0x1B
+DI8DEVTYPE_SUPPLEMENTAL = 0x1C
+DI8DEVTYPEMOUSE_UNKNOWN = 1
+DI8DEVTYPEMOUSE_TRADITIONAL = 2
+DI8DEVTYPEMOUSE_FINGERSTICK = 3
+DI8DEVTYPEMOUSE_TOUCHPAD = 4
+DI8DEVTYPEMOUSE_TRACKBALL = 5
+DI8DEVTYPEMOUSE_ABSOLUTE = 6
+
+DI8DEVTYPEKEYBOARD_UNKNOWN = 0
+DI8DEVTYPEKEYBOARD_PCXT = 1
+DI8DEVTYPEKEYBOARD_OLIVETTI = 2
+DI8DEVTYPEKEYBOARD_PCAT = 3
+DI8DEVTYPEKEYBOARD_PCENH = 4
+DI8DEVTYPEKEYBOARD_NOKIA1050 = 5
+DI8DEVTYPEKEYBOARD_NOKIA9140 = 6
+DI8DEVTYPEKEYBOARD_NEC98 = 7
+DI8DEVTYPEKEYBOARD_NEC98LAPTOP = 8
+DI8DEVTYPEKEYBOARD_NEC98106 = 9
+DI8DEVTYPEKEYBOARD_JAPAN106 = 10
+DI8DEVTYPEKEYBOARD_JAPANAX = 11
+DI8DEVTYPEKEYBOARD_J3100 = 12
+
+DI8DEVTYPE_LIMITEDGAMESUBTYPE = 1
+
+DI8DEVTYPEJOYSTICK_LIMITED = DI8DEVTYPE_LIMITEDGAMESUBTYPE
+DI8DEVTYPEJOYSTICK_STANDARD = 2
+
+DI8DEVTYPEGAMEPAD_LIMITED = DI8DEVTYPE_LIMITEDGAMESUBTYPE
+DI8DEVTYPEGAMEPAD_STANDARD = 2
+DI8DEVTYPEGAMEPAD_TILT = 3
+
+DI8DEVTYPEDRIVING_LIMITED = DI8DEVTYPE_LIMITEDGAMESUBTYPE
+DI8DEVTYPEDRIVING_COMBINEDPEDALS = 2
+DI8DEVTYPEDRIVING_DUALPEDALS = 3
+DI8DEVTYPEDRIVING_THREEPEDALS = 4
+DI8DEVTYPEDRIVING_HANDHELD = 5
+
+DI8DEVTYPEFLIGHT_LIMITED = DI8DEVTYPE_LIMITEDGAMESUBTYPE
+DI8DEVTYPEFLIGHT_STICK = 2
+DI8DEVTYPEFLIGHT_YOKE = 3
+DI8DEVTYPEFLIGHT_RC = 4
+
+DI8DEVTYPE1STPERSON_LIMITED = DI8DEVTYPE_LIMITEDGAMESUBTYPE
+DI8DEVTYPE1STPERSON_UNKNOWN = 2
+DI8DEVTYPE1STPERSON_SIXDOF = 3
+DI8DEVTYPE1STPERSON_SHOOTER = 4
+
+DI8DEVTYPESCREENPTR_UNKNOWN = 2
+DI8DEVTYPESCREENPTR_LIGHTGUN = 3
+DI8DEVTYPESCREENPTR_LIGHTPEN = 4
+DI8DEVTYPESCREENPTR_TOUCH = 5
+
+DI8DEVTYPEREMOTE_UNKNOWN = 2
+
+DI8DEVTYPEDEVICECTRL_UNKNOWN = 2
+DI8DEVTYPEDEVICECTRL_COMMSSELECTION = 3
+DI8DEVTYPEDEVICECTRL_COMMSSELECTION_HARDWIRED = 4
+
+DI8DEVTYPESUPPLEMENTAL_UNKNOWN = 2
+DI8DEVTYPESUPPLEMENTAL_2NDHANDCONTROLLER = 3
+DI8DEVTYPESUPPLEMENTAL_HEADTRACKER = 4
+DI8DEVTYPESUPPLEMENTAL_HANDTRACKER = 5
+DI8DEVTYPESUPPLEMENTAL_SHIFTSTICKGATE = 6
+DI8DEVTYPESUPPLEMENTAL_SHIFTER = 7
+DI8DEVTYPESUPPLEMENTAL_THROTTLE = 8
+DI8DEVTYPESUPPLEMENTAL_SPLITTHROTTLE = 9
+DI8DEVTYPESUPPLEMENTAL_COMBINEDPEDALS = 10
+DI8DEVTYPESUPPLEMENTAL_DUALPEDALS = 11
+DI8DEVTYPESUPPLEMENTAL_THREEPEDALS = 12
+DI8DEVTYPESUPPLEMENTAL_RUDDERPEDALS = 13
+DIDC_ATTACHED = 0x00000001
+DIDC_POLLEDDEVICE = 0x00000002
+DIDC_EMULATED = 0x00000004
+DIDC_POLLEDDATAFORMAT = 0x00000008
+DIDC_FORCEFEEDBACK = 0x00000100
+DIDC_FFATTACK = 0x00000200
+DIDC_FFFADE = 0x00000400
+DIDC_SATURATION = 0x00000800
+DIDC_POSNEGCOEFFICIENTS = 0x00001000
+DIDC_POSNEGSATURATION = 0x00002000
+DIDC_DEADBAND = 0x00004000
+DIDC_STARTDELAY = 0x00008000
+DIDC_ALIAS = 0x00010000
+DIDC_PHANTOM = 0x00020000
+DIDC_HIDDEN = 0x00040000
+
+def DIDFT_GETINSTANCE(n):
+ return (n >> 8) & 0xffff
+
+DIDFT_ALL = 0x00000000
+
+DIDFT_RELAXIS = 0x00000001
+DIDFT_ABSAXIS = 0x00000002
+DIDFT_AXIS = 0x00000003
+
+DIDFT_PSHBUTTON = 0x00000004
+DIDFT_TGLBUTTON = 0x00000008
+DIDFT_BUTTON = 0x0000000C
+
+DIDFT_POV = 0x00000010
+DIDFT_COLLECTION = 0x00000040
+DIDFT_NODATA = 0x00000080
+
+DIDFT_ANYINSTANCE = 0x00FFFF00
+DIDFT_INSTANCEMASK = DIDFT_ANYINSTANCE
+DIDFT_FFACTUATOR = 0x01000000
+DIDFT_FFEFFECTTRIGGER = 0x02000000
+DIDFT_OUTPUT = 0x10000000
+DIDFT_VENDORDEFINED = 0x04000000
+DIDFT_ALIAS = 0x08000000
+DIDFT_OPTIONAL = 0x80000000
+
+DIDFT_NOCOLLECTION = 0x00FFFF00
+
+DIA_FORCEFEEDBACK = 0x00000001
+DIA_APPMAPPED = 0x00000002
+DIA_APPNOMAP = 0x00000004
+DIA_NORANGE = 0x00000008
+DIA_APPFIXED = 0x00000010
+
+DIAH_UNMAPPED = 0x00000000
+DIAH_USERCONFIG = 0x00000001
+DIAH_APPREQUESTED = 0x00000002
+DIAH_HWAPP = 0x00000004
+DIAH_HWDEFAULT = 0x00000008
+DIAH_DEFAULT = 0x00000020
+DIAH_ERROR = 0x80000000
+DIAFTS_NEWDEVICELOW = 0xFFFFFFFF
+DIAFTS_NEWDEVICEHIGH = 0xFFFFFFFF
+DIAFTS_UNUSEDDEVICELOW = 0x00000000
+DIAFTS_UNUSEDDEVICEHIGH = 0x00000000
+
+DIDBAM_DEFAULT = 0x00000000
+DIDBAM_PRESERVE = 0x00000001
+DIDBAM_INITIALIZE = 0x00000002
+DIDBAM_HWDEFAULTS = 0x00000004
+
+DIDSAM_DEFAULT = 0x00000000
+DIDSAM_NOUSER = 0x00000001
+DIDSAM_FORCESAVE = 0x00000002
+
+DICD_DEFAULT = 0x00000000
+DICD_EDIT = 0x00000001
+
+DIDOI_FFACTUATOR = 0x00000001
+DIDOI_FFEFFECTTRIGGER = 0x00000002
+DIDOI_POLLED = 0x00008000
+DIDOI_ASPECTPOSITION = 0x00000100
+DIDOI_ASPECTVELOCITY = 0x00000200
+DIDOI_ASPECTACCEL = 0x00000300
+DIDOI_ASPECTFORCE = 0x00000400
+DIDOI_ASPECTMASK = 0x00000F00
+DIDOI_GUIDISUSAGE = 0x00010000
+
+DIPH_DEVICE = 0
+DIPH_BYOFFSET = 1
+DIPH_BYID = 2
+DIPH_BYUSAGE = 3
+
+DISCL_EXCLUSIVE = 0x00000001
+DISCL_NONEXCLUSIVE = 0x00000002
+DISCL_FOREGROUND = 0x00000004
+DISCL_BACKGROUND = 0x00000008
+DISCL_NOWINKEY = 0x00000010
+
+DIPROP_BUFFERSIZE = 1
+
+GUID_XAxis = \
+ com.GUID(0xA36D02E0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00)
+
+
+class DIDEVICEINSTANCE(ctypes.Structure):
+ _fields_ = (
+ ('dwSize', DWORD),
+ ('guidInstance', com.GUID),
+ ('guidProduct', com.GUID),
+ ('dwDevType', DWORD),
+ ('tszInstanceName', WCHAR * MAX_PATH),
+ ('tszProductName', WCHAR * MAX_PATH),
+ ('guidFFDriver', com.GUID),
+ ('wUsagePage', WORD),
+ ('wUsage', WORD)
+ )
+LPDIDEVICEINSTANCE = ctypes.POINTER(DIDEVICEINSTANCE)
+LPDIENUMDEVICESCALLBACK = ctypes.WINFUNCTYPE(BOOL, LPDIDEVICEINSTANCE, LPVOID)
+
+class DIDEVICEOBJECTINSTANCE(ctypes.Structure):
+ _fields_ = (
+ ('dwSize', DWORD),
+ ('guidType', com.GUID),
+ ('dwOfs', DWORD),
+ ('dwType', DWORD),
+ ('dwFlags', DWORD),
+ ('tszName', WCHAR * MAX_PATH),
+ ('dwFFMaxForce', DWORD),
+ ('dwFFForceResolution', DWORD),
+ ('wCollectionNumber', WORD),
+ ('wDesignatorIndex', WORD),
+ ('wUsagePage', WORD),
+ ('wUsage', WORD),
+ ('dwDimension', DWORD),
+ ('wExponent', WORD),
+ ('wReportId', WORD)
+ )
+LPDIDEVICEOBJECTINSTANCE = ctypes.POINTER(DIDEVICEOBJECTINSTANCE)
+LPDIENUMDEVICEOBJECTSCALLBACK = \
+ ctypes.WINFUNCTYPE( BOOL, LPDIDEVICEOBJECTINSTANCE, LPVOID)
+
+class DIOBJECTDATAFORMAT(ctypes.Structure):
+ _fields_ = (
+ ('pguid', ctypes.POINTER(com.GUID)),
+ ('dwOfs', DWORD),
+ ('dwType', DWORD),
+ ('dwFlags', DWORD)
+ )
+ __slots__ = [n for n, t in _fields_]
+LPDIOBJECTDATAFORMAT = ctypes.POINTER(DIOBJECTDATAFORMAT)
+
+class DIDATAFORMAT(ctypes.Structure):
+ _fields_ = (
+ ('dwSize', DWORD),
+ ('dwObjSize', DWORD),
+ ('dwFlags', DWORD),
+ ('dwDataSize', DWORD),
+ ('dwNumObjs', DWORD),
+ ('rgodf', LPDIOBJECTDATAFORMAT)
+ )
+ __slots__ = [n for n, t in _fields_]
+LPDIDATAFORMAT = ctypes.POINTER(DIDATAFORMAT)
+
+class DIDEVICEOBJECTDATA(ctypes.Structure):
+ _fields_ = (
+ ('dwOfs', DWORD),
+ ('dwData', DWORD),
+ ('dwTimeStamp', DWORD),
+ ('dwSequence', DWORD),
+ ('uAppData', ctypes.POINTER(UINT))
+ )
+LPDIDEVICEOBJECTDATA = ctypes.POINTER(DIDEVICEOBJECTDATA)
+
+class DIPROPHEADER(ctypes.Structure):
+ _fields_ = (
+ ('dwSize', DWORD),
+ ('dwHeaderSize', DWORD),
+ ('dwObj', DWORD),
+ ('dwHow', DWORD)
+ )
+LPDIPROPHEADER = ctypes.POINTER(DIPROPHEADER)
+
+class DIPROPDWORD(ctypes.Structure):
+ _fields_ = (
+ ('diph', DIPROPHEADER),
+ ('dwData', DWORD)
+ )
+
+# All method names in the interfaces are filled in, but unused (so far)
+# methods have no parameters.. they'll crash when we try and use them, at
+# which point we can go in and fill them in.
+
+# IDirect* interfaces are all Unicode (e.g. IDirectInputDevice8W).
+
+class IDirectInputDevice8(com.IUnknown):
+ _methods_ = [
+ ('GetCapabilities',
+ com.STDMETHOD()),
+ ('EnumObjects',
+ com.STDMETHOD(LPDIENUMDEVICEOBJECTSCALLBACK, LPVOID, DWORD)),
+ ('GetProperty',
+ com.STDMETHOD()),
+ ('SetProperty',
+ com.STDMETHOD(LPVOID, LPDIPROPHEADER)),
+ ('Acquire',
+ com.STDMETHOD()),
+ ('Unacquire',
+ com.STDMETHOD()),
+ ('GetDeviceState',
+ com.STDMETHOD()),
+ ('GetDeviceData',
+ com.STDMETHOD(DWORD, LPDIDEVICEOBJECTDATA, LPDWORD, DWORD)),
+ ('SetDataFormat',
+ com.STDMETHOD(LPDIDATAFORMAT)),
+ ('SetEventNotification',
+ com.STDMETHOD(HANDLE)),
+ ('SetCooperativeLevel',
+ com.STDMETHOD(HWND, DWORD)),
+ ('GetObjectInfo',
+ com.STDMETHOD()),
+ ('GetDeviceInfo',
+ com.STDMETHOD()),
+ ('RunControlPanel',
+ com.STDMETHOD()),
+ ('Initialize',
+ com.STDMETHOD()),
+ ('CreateEffect',
+ com.STDMETHOD()),
+ ('EnumEffects',
+ com.STDMETHOD()),
+ ('GetEffectInfo',
+ com.STDMETHOD()),
+ ('GetForceFeedbackState',
+ com.STDMETHOD()),
+ ('SendForceFeedbackCommand',
+ com.STDMETHOD()),
+ ('EnumCreatedEffectObjects',
+ com.STDMETHOD()),
+ ('Escape',
+ com.STDMETHOD()),
+ ('Poll',
+ com.STDMETHOD()),
+ ('SendDeviceData',
+ com.STDMETHOD()),
+ ('EnumEffectsInFile',
+ com.STDMETHOD()),
+ ('WriteEffectToFile',
+ com.STDMETHOD()),
+ ('BuildActionMap',
+ com.STDMETHOD()),
+ ('SetActionMap',
+ com.STDMETHOD()),
+ ('GetImageInfo',
+ com.STDMETHOD()),
+ ]
+
+class IDirectInput8(com.IUnknown):
+ _methods_ = [
+ ('CreateDevice',
+ com.STDMETHOD(ctypes.POINTER(com.GUID),
+ ctypes.POINTER(IDirectInputDevice8),
+ ctypes.c_void_p)),
+ ('EnumDevices',
+ com.STDMETHOD(DWORD, LPDIENUMDEVICESCALLBACK, LPVOID, DWORD)),
+ ('GetDeviceStatus',
+ com.STDMETHOD()),
+ ('RunControlPanel',
+ com.STDMETHOD()),
+ ('Initialize',
+ com.STDMETHOD()),
+ ('FindDevice',
+ com.STDMETHOD()),
+ ('EnumDevicesBySemantics',
+ com.STDMETHOD()),
+ ('ConfigureDevices',
+ com.STDMETHOD()),
+ ]
+
+IID_IDirectInput8W = \
+ com.GUID(0xBF798031,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00)
+
+DIRECTINPUT_VERSION = 0x0800
+DirectInput8Create = lib.DirectInput8Create
+DirectInput8Create.argtypes = \
+ (ctypes.c_void_p, DWORD, com.LPGUID, ctypes.c_void_p, ctypes.c_void_p)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/win32/libwintab.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/win32/libwintab.py
new file mode 100644
index 0000000..e85685f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/win32/libwintab.py
@@ -0,0 +1,336 @@
+#!/usr/bin/python
+# $Id:$
+
+from __future__ import division
+import ctypes
+
+lib = ctypes.windll.wintab32
+
+LONG = ctypes.c_long
+BOOL = ctypes.c_int
+UINT = ctypes.c_uint
+WORD = ctypes.c_uint16
+DWORD = ctypes.c_uint32
+WCHAR = ctypes.c_wchar
+FIX32 = DWORD
+WTPKT = DWORD
+
+LCNAMELEN = 40
+
+class AXIS(ctypes.Structure):
+ _fields_ = (
+ ('axMin', LONG),
+ ('axMax', LONG),
+ ('axUnits', UINT),
+ ('axResolution', FIX32)
+ )
+
+ def get_scale(self):
+ return 1 / float(self.axMax - self.axMin)
+
+ def get_bias(self):
+ return -self.axMin
+
+class ORIENTATION(ctypes.Structure):
+ _fields_ = (
+ ('orAzimuth', ctypes.c_int),
+ ('orAltitude', ctypes.c_int),
+ ('orTwist', ctypes.c_int)
+ )
+
+class ROTATION(ctypes.Structure):
+ _fields_ = (
+ ('roPitch', ctypes.c_int),
+ ('roRoll', ctypes.c_int),
+ ('roYaw', ctypes.c_int),
+ )
+
+class LOGCONTEXT(ctypes.Structure):
+ _fields_ = (
+ ('lcName', WCHAR * LCNAMELEN),
+ ('lcOptions', UINT),
+ ('lcStatus', UINT),
+ ('lcLocks', UINT),
+ ('lcMsgBase', UINT),
+ ('lcDevice', UINT),
+ ('lcPktRate', UINT),
+ ('lcPktData', WTPKT),
+ ('lcPktMode', WTPKT),
+ ('lcMoveMask', WTPKT),
+ ('lcBtnDnMask', DWORD),
+ ('lcBtnUpMask', DWORD),
+ ('lcInOrgX', LONG),
+ ('lcInOrgY', LONG),
+ ('lcInOrgZ', LONG),
+ ('lcInExtX', LONG),
+ ('lcInExtY', LONG),
+ ('lcInExtZ', LONG),
+ ('lcOutOrgX', LONG),
+ ('lcOutOrgY', LONG),
+ ('lcOutOrgZ', LONG),
+ ('lcOutExtX', LONG),
+ ('lcOutExtY', LONG),
+ ('lcOutExtZ', LONG),
+ ('lcSensX', FIX32),
+ ('lcSensY', FIX32),
+ ('lcSensZ', FIX32),
+ ('lcSysMode', BOOL),
+ ('lcSysOrgX', ctypes.c_int),
+ ('lcSysOrgY', ctypes.c_int),
+ ('lcSysExtX', ctypes.c_int),
+ ('lcSysExtY', ctypes.c_int),
+ ('lcSysSensX', FIX32),
+ ('lcSysSensY', FIX32),
+ )
+
+# Custom packet format with fields
+# PK_CHANGED
+# PK_CURSOR
+# PK_BUTTONS
+# PK_X
+# PK_Y
+# PK_Z
+# PK_NORMAL_PRESSURE
+# PK_TANGENT_PRESSURE
+# PK_ORIENTATION (check for tilt extension instead)?
+class PACKET(ctypes.Structure):
+ _fields_ = (
+ ('pkChanged', WTPKT),
+ ('pkCursor', UINT),
+ ('pkButtons', DWORD),
+ ('pkX', LONG),
+ ('pkY', LONG),
+ ('pkZ', LONG),
+ ('pkNormalPressure', UINT),
+ ('pkTangentPressure', UINT),
+ ('pkOrientation', ORIENTATION),
+ )
+
+PK_CONTEXT = 0x0001 # reporting context
+PK_STATUS = 0x0002 # status bits
+PK_TIME = 0x0004 # time stamp
+PK_CHANGED = 0x0008 # change bit vector
+PK_SERIAL_NUMBER = 0x0010 # packet serial number
+PK_CURSOR = 0x0020 # reporting cursor
+PK_BUTTONS = 0x0040 # button information
+PK_X = 0x0080 # x axis
+PK_Y = 0x0100 # y axis
+PK_Z = 0x0200 # z axis
+PK_NORMAL_PRESSURE = 0x0400 # normal or tip pressure
+PK_TANGENT_PRESSURE = 0x0800 # tangential or barrel pressure
+PK_ORIENTATION = 0x1000 # orientation info: tilts
+PK_ROTATION = 0x2000 # rotation info; 1.1
+
+TU_NONE = 0
+TU_INCHES = 1
+TU_CENTIMETERS = 2
+TU_CIRCLE = 3
+
+# messages
+WT_DEFBASE = 0x7ff0
+WT_MAXOFFSET = 0xf
+WT_PACKET = 0 # remember to add base
+WT_CTXOPEN = 1
+WT_CTXCLOSE = 2
+WT_CTXUPDATE = 3
+WT_CTXOVERLAP = 4
+WT_PROXIMITY = 5
+WT_INFOCHANGE = 6
+WT_CSRCHANGE = 7
+
+# system button assignment values
+SBN_NONE = 0x00
+SBN_LCLICK = 0x01
+SBN_LDBLCLICK = 0x02
+SBN_LDRAG = 0x03
+SBN_RCLICK = 0x04
+SBN_RDBLCLICK = 0x05
+SBN_RDRAG = 0x06
+SBN_MCLICK = 0x07
+SBN_MDBLCLICK = 0x08
+SBN_MDRAG = 0x09
+
+# for Pen Windows
+SBN_PTCLICK = 0x10
+SBN_PTDBLCLICK = 0x20
+SBN_PTDRAG = 0x30
+SBN_PNCLICK = 0x40
+SBN_PNDBLCLICK = 0x50
+SBN_PNDRAG = 0x60
+SBN_P1CLICK = 0x70
+SBN_P1DBLCLICK = 0x80
+SBN_P1DRAG = 0x90
+SBN_P2CLICK = 0xA0
+SBN_P2DBLCLICK = 0xB0
+SBN_P2DRAG = 0xC0
+SBN_P3CLICK = 0xD0
+SBN_P3DBLCLICK = 0xE0
+SBN_P3DRAG = 0xF0
+
+HWC_INTEGRATED = 0x0001
+HWC_TOUCH = 0x0002
+HWC_HARDPROX = 0x0004
+HWC_PHYSID_CURSORS = 0x0008 # 1.1
+
+CRC_MULTIMODE = 0x0001 # 1.1
+CRC_AGGREGATE = 0x0002 # 1.1
+CRC_INVERT = 0x0004 # 1.1
+
+WTI_INTERFACE = 1
+IFC_WINTABID = 1
+IFC_SPECVERSION = 2
+IFC_IMPLVERSION = 3
+IFC_NDEVICES = 4
+IFC_NCURSORS = 5
+IFC_NCONTEXTS = 6
+IFC_CTXOPTIONS = 7
+IFC_CTXSAVESIZE = 8
+IFC_NEXTENSIONS = 9
+IFC_NMANAGERS = 10
+IFC_MAX = 10
+
+WTI_STATUS = 2
+STA_CONTEXTS = 1
+STA_SYSCTXS = 2
+STA_PKTRATE = 3
+STA_PKTDATA = 4
+STA_MANAGERS = 5
+STA_SYSTEM = 6
+STA_BUTTONUSE = 7
+STA_SYSBTNUSE = 8
+STA_MAX = 8
+
+WTI_DEFCONTEXT = 3
+WTI_DEFSYSCTX = 4
+WTI_DDCTXS = 400 # 1.1
+WTI_DSCTXS = 500 # 1.1
+CTX_NAME = 1
+CTX_OPTIONS = 2
+CTX_STATUS = 3
+CTX_LOCKS = 4
+CTX_MSGBASE = 5
+CTX_DEVICE = 6
+CTX_PKTRATE = 7
+CTX_PKTDATA = 8
+CTX_PKTMODE = 9
+CTX_MOVEMASK = 10
+CTX_BTNDNMASK = 11
+CTX_BTNUPMASK = 12
+CTX_INORGX = 13
+CTX_INORGY = 14
+CTX_INORGZ = 15
+CTX_INEXTX = 16
+CTX_INEXTY = 17
+CTX_INEXTZ = 18
+CTX_OUTORGX = 19
+CTX_OUTORGY = 20
+CTX_OUTORGZ = 21
+CTX_OUTEXTX = 22
+CTX_OUTEXTY = 23
+CTX_OUTEXTZ = 24
+CTX_SENSX = 25
+CTX_SENSY = 26
+CTX_SENSZ = 27
+CTX_SYSMODE = 28
+CTX_SYSORGX = 29
+CTX_SYSORGY = 30
+CTX_SYSEXTX = 31
+CTX_SYSEXTY = 32
+CTX_SYSSENSX = 33
+CTX_SYSSENSY = 34
+CTX_MAX = 34
+
+WTI_DEVICES = 100
+DVC_NAME = 1
+DVC_HARDWARE = 2
+DVC_NCSRTYPES = 3
+DVC_FIRSTCSR = 4
+DVC_PKTRATE = 5
+DVC_PKTDATA = 6
+DVC_PKTMODE = 7
+DVC_CSRDATA = 8
+DVC_XMARGIN = 9
+DVC_YMARGIN = 10
+DVC_ZMARGIN = 11
+DVC_X = 12
+DVC_Y = 13
+DVC_Z = 14
+DVC_NPRESSURE = 15
+DVC_TPRESSURE = 16
+DVC_ORIENTATION = 17
+DVC_ROTATION = 18 # 1.1
+DVC_PNPID = 19 # 1.1
+DVC_MAX = 19
+
+WTI_CURSORS = 200
+CSR_NAME = 1
+CSR_ACTIVE = 2
+CSR_PKTDATA = 3
+CSR_BUTTONS = 4
+CSR_BUTTONBITS = 5
+CSR_BTNNAMES = 6
+CSR_BUTTONMAP = 7
+CSR_SYSBTNMAP = 8
+CSR_NPBUTTON = 9
+CSR_NPBTNMARKS = 10
+CSR_NPRESPONSE = 11
+CSR_TPBUTTON = 12
+CSR_TPBTNMARKS = 13
+CSR_TPRESPONSE = 14
+CSR_PHYSID = 15 # 1.1
+CSR_MODE = 16 # 1.1
+CSR_MINPKTDATA = 17 # 1.1
+CSR_MINBUTTONS = 18 # 1.1
+CSR_CAPABILITIES = 19 # 1.1
+CSR_TYPE = 20 # 1.2
+CSR_MAX = 20
+
+WTI_EXTENSIONS = 300
+EXT_NAME = 1
+EXT_TAG = 2
+EXT_MASK = 3
+EXT_SIZE = 4
+EXT_AXES = 5
+EXT_DEFAULT = 6
+EXT_DEFCONTEXT = 7
+EXT_DEFSYSCTX = 8
+EXT_CURSORS = 9
+EXT_MAX = 109 # Allow 100 cursors
+CXO_SYSTEM = 0x0001
+CXO_PEN = 0x0002
+CXO_MESSAGES = 0x0004
+CXO_MARGIN = 0x8000
+CXO_MGNINSIDE = 0x4000
+CXO_CSRMESSAGES = 0x0008 # 1.1
+
+# context status values
+CXS_DISABLED = 0x0001
+CXS_OBSCURED = 0x0002
+CXS_ONTOP = 0x0004
+
+# context lock values
+CXL_INSIZE = 0x0001
+CXL_INASPECT = 0x0002
+CXL_SENSITIVITY = 0x0004
+CXL_MARGIN = 0x0008
+CXL_SYSOUT = 0x0010
+# packet status values
+TPS_PROXIMITY = 0x0001
+TPS_QUEUE_ERR = 0x0002
+TPS_MARGIN = 0x0004
+TPS_GRAB = 0x0008
+TPS_INVERT = 0x0010 # 1.1
+
+TBN_NONE = 0
+TBN_UP = 1
+TBN_DOWN = 2
+PKEXT_ABSOLUTE = 1
+PKEXT_RELATIVE = 2
+
+# Extension tags.
+WTX_OBT = 0 # Out of bounds tracking
+WTX_FKEYS = 1 # Function keys
+WTX_TILT = 2 # Raw Cartesian tilt; 1.1
+WTX_CSRMASK = 3 # select input by cursor type; 1.1
+WTX_XBTNMASK = 4 # Extended button mask; 1.1
+WTX_EXPKEYS = 5 # ExpressKeys; 1.3
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/win32/types.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/win32/types.py
new file mode 100644
index 0000000..2f065f0
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/win32/types.py
@@ -0,0 +1,365 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import ctypes
+from ctypes import *
+from ctypes.wintypes import *
+
+
+_int_types = (c_int16, c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (c_int64,)
+for t in _int_types:
+ if sizeof(t) == sizeof(c_size_t):
+ c_ptrdiff_t = t
+del t
+del _int_types
+
+
+class c_void(Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', c_int)]
+
+
+def POINTER_(obj):
+ p = ctypes.POINTER(obj)
+
+ # Convert None to a real NULL pointer to work around bugs
+ # in how ctypes handles None on 64-bit platforms
+ if not isinstance(p.from_param, classmethod):
+ def from_param(cls, x):
+ if x is None:
+ return cls()
+ else:
+ return x
+ p.from_param = classmethod(from_param)
+
+ return p
+
+c_void_p = POINTER_(c_void)
+INT = c_int
+LPVOID = c_void_p
+HCURSOR = HANDLE
+LRESULT = LPARAM
+COLORREF = DWORD
+PVOID = c_void_p
+WCHAR = c_wchar
+BCHAR = c_wchar
+LPRECT = POINTER(RECT)
+LPPOINT = POINTER(POINT)
+LPMSG = POINTER(MSG)
+UINT_PTR = HANDLE
+LONG_PTR = HANDLE
+HDROP = HANDLE
+LPTSTR = LPWSTR
+
+LF_FACESIZE = 32
+CCHDEVICENAME = 32
+CCHFORMNAME = 32
+
+WNDPROC = WINFUNCTYPE(LRESULT, HWND, UINT, WPARAM, LPARAM)
+TIMERPROC = WINFUNCTYPE(None, HWND, UINT, POINTER(UINT), DWORD)
+TIMERAPCPROC = WINFUNCTYPE(None, PVOID, DWORD, DWORD)
+MONITORENUMPROC = WINFUNCTYPE(BOOL, HMONITOR, HDC, LPRECT, LPARAM)
+
+def MAKEINTRESOURCE(i):
+ return cast(ctypes.c_void_p(i & 0xFFFF), c_wchar_p)
+
+
+class WNDCLASS(Structure):
+ _fields_ = [
+ ('style', UINT),
+ ('lpfnWndProc', WNDPROC),
+ ('cbClsExtra', c_int),
+ ('cbWndExtra', c_int),
+ ('hInstance', HINSTANCE),
+ ('hIcon', HICON),
+ ('hCursor', HCURSOR),
+ ('hbrBackground', HBRUSH),
+ ('lpszMenuName', c_char_p),
+ ('lpszClassName', c_wchar_p)
+ ]
+
+class SECURITY_ATTRIBUTES(Structure):
+ _fields_ = [
+ ("nLength", DWORD),
+ ("lpSecurityDescriptor", c_void_p),
+ ("bInheritHandle", BOOL)
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+class PIXELFORMATDESCRIPTOR(Structure):
+ _fields_ = [
+ ('nSize', WORD),
+ ('nVersion', WORD),
+ ('dwFlags', DWORD),
+ ('iPixelType', BYTE),
+ ('cColorBits', BYTE),
+ ('cRedBits', BYTE),
+ ('cRedShift', BYTE),
+ ('cGreenBits', BYTE),
+ ('cGreenShift', BYTE),
+ ('cBlueBits', BYTE),
+ ('cBlueShift', BYTE),
+ ('cAlphaBits', BYTE),
+ ('cAlphaShift', BYTE),
+ ('cAccumBits', BYTE),
+ ('cAccumRedBits', BYTE),
+ ('cAccumGreenBits', BYTE),
+ ('cAccumBlueBits', BYTE),
+ ('cAccumAlphaBits', BYTE),
+ ('cDepthBits', BYTE),
+ ('cStencilBits', BYTE),
+ ('cAuxBuffers', BYTE),
+ ('iLayerType', BYTE),
+ ('bReserved', BYTE),
+ ('dwLayerMask', DWORD),
+ ('dwVisibleMask', DWORD),
+ ('dwDamageMask', DWORD)
+ ]
+
+class RGBQUAD(Structure):
+ _fields_ = [
+ ('rgbBlue', BYTE),
+ ('rgbGreen', BYTE),
+ ('rgbRed', BYTE),
+ ('rgbReserved', BYTE),
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+class CIEXYZ(Structure):
+ _fields_ = [
+ ('ciexyzX', DWORD),
+ ('ciexyzY', DWORD),
+ ('ciexyzZ', DWORD),
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+class CIEXYZTRIPLE(Structure):
+ _fields_ = [
+ ('ciexyzRed', CIEXYZ),
+ ('ciexyzBlue', CIEXYZ),
+ ('ciexyzGreen', CIEXYZ),
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+class BITMAPINFOHEADER(Structure):
+ _fields_ = [
+ ('biSize', DWORD),
+ ('biWidth', LONG),
+ ('biHeight', LONG),
+ ('biPlanes', WORD),
+ ('biBitCount', WORD),
+ ('biCompression', DWORD),
+ ('biSizeImage', DWORD),
+ ('biXPelsPerMeter', LONG),
+ ('biYPelsPerMeter', LONG),
+ ('biClrUsed', DWORD),
+ ('biClrImportant', DWORD),
+ ]
+
+class BITMAPV5HEADER(Structure):
+ _fields_ = [
+ ('bV5Size', DWORD),
+ ('bV5Width', LONG),
+ ('bV5Height', LONG),
+ ('bV5Planes', WORD),
+ ('bV5BitCount', WORD),
+ ('bV5Compression', DWORD),
+ ('bV5SizeImage', DWORD),
+ ('bV5XPelsPerMeter', LONG),
+ ('bV5YPelsPerMeter', LONG),
+ ('bV5ClrUsed', DWORD),
+ ('bV5ClrImportant', DWORD),
+ ('bV5RedMask', DWORD),
+ ('bV5GreenMask', DWORD),
+ ('bV5BlueMask', DWORD),
+ ('bV5AlphaMask', DWORD),
+ ('bV5CSType', DWORD),
+ ('bV5Endpoints', CIEXYZTRIPLE),
+ ('bV5GammaRed', DWORD),
+ ('bV5GammaGreen', DWORD),
+ ('bV5GammaBlue', DWORD),
+ ('bV5Intent', DWORD),
+ ('bV5ProfileData', DWORD),
+ ('bV5ProfileSize', DWORD),
+ ('bV5Reserved', DWORD),
+ ]
+
+class BITMAPINFO(Structure):
+ _fields_ = [
+ ('bmiHeader', BITMAPINFOHEADER),
+ ('bmiColors', RGBQUAD * 1)
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+class LOGFONT(Structure):
+ _fields_ = [
+ ('lfHeight', LONG),
+ ('lfWidth', LONG),
+ ('lfEscapement', LONG),
+ ('lfOrientation', LONG),
+ ('lfWeight', LONG),
+ ('lfItalic', BYTE),
+ ('lfUnderline', BYTE),
+ ('lfStrikeOut', BYTE),
+ ('lfCharSet', BYTE),
+ ('lfOutPrecision', BYTE),
+ ('lfClipPrecision', BYTE),
+ ('lfQuality', BYTE),
+ ('lfPitchAndFamily', BYTE),
+ ('lfFaceName', (c_char * LF_FACESIZE)) # Use ASCII
+ ]
+
+class TRACKMOUSEEVENT(Structure):
+ _fields_ = [
+ ('cbSize', DWORD),
+ ('dwFlags', DWORD),
+ ('hwndTrack', HWND),
+ ('dwHoverTime', DWORD)
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+class MINMAXINFO(Structure):
+ _fields_ = [
+ ('ptReserved', POINT),
+ ('ptMaxSize', POINT),
+ ('ptMaxPosition', POINT),
+ ('ptMinTrackSize', POINT),
+ ('ptMaxTrackSize', POINT)
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+class ABC(Structure):
+ _fields_ = [
+ ('abcA', c_int),
+ ('abcB', c_uint),
+ ('abcC', c_int)
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+class TEXTMETRIC(Structure):
+ _fields_ = [
+ ('tmHeight', c_long),
+ ('tmAscent', c_long),
+ ('tmDescent', c_long),
+ ('tmInternalLeading', c_long),
+ ('tmExternalLeading', c_long),
+ ('tmAveCharWidth', c_long),
+ ('tmMaxCharWidth', c_long),
+ ('tmWeight', c_long),
+ ('tmOverhang', c_long),
+ ('tmDigitizedAspectX', c_long),
+ ('tmDigitizedAspectY', c_long),
+ ('tmFirstChar', c_char), # Use ASCII
+ ('tmLastChar', c_char),
+ ('tmDefaultChar', c_char),
+ ('tmBreakChar', c_char),
+ ('tmItalic', c_byte),
+ ('tmUnderlined', c_byte),
+ ('tmStruckOut', c_byte),
+ ('tmPitchAndFamily', c_byte),
+ ('tmCharSet', c_byte)
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+class MONITORINFOEX(Structure):
+ _fields_ = [
+ ('cbSize', DWORD),
+ ('rcMonitor', RECT),
+ ('rcWork', RECT),
+ ('dwFlags', DWORD),
+ ('szDevice', WCHAR * CCHDEVICENAME)
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+class DEVMODE(Structure):
+ _fields_ = [
+ ('dmDeviceName', BCHAR * CCHDEVICENAME),
+ ('dmSpecVersion', WORD),
+ ('dmDriverVersion', WORD),
+ ('dmSize', WORD),
+ ('dmDriverExtra', WORD),
+ ('dmFields', DWORD),
+ # Just using largest union member here
+ ('dmOrientation', c_short),
+ ('dmPaperSize', c_short),
+ ('dmPaperLength', c_short),
+ ('dmPaperWidth', c_short),
+ ('dmScale', c_short),
+ ('dmCopies', c_short),
+ ('dmDefaultSource', c_short),
+ ('dmPrintQuality', c_short),
+ # End union
+ ('dmColor', c_short),
+ ('dmDuplex', c_short),
+ ('dmYResolution', c_short),
+ ('dmTTOption', c_short),
+ ('dmCollate', c_short),
+ ('dmFormName', BCHAR * CCHFORMNAME),
+ ('dmLogPixels', WORD),
+ ('dmBitsPerPel', DWORD),
+ ('dmPelsWidth', DWORD),
+ ('dmPelsHeight', DWORD),
+ ('dmDisplayFlags', DWORD), # union with dmNup
+ ('dmDisplayFrequency', DWORD),
+ ('dmICMMethod', DWORD),
+ ('dmICMIntent', DWORD),
+ ('dmDitherType', DWORD),
+ ('dmReserved1', DWORD),
+ ('dmReserved2', DWORD),
+ ('dmPanningWidth', DWORD),
+ ('dmPanningHeight', DWORD),
+ ]
+
+class ICONINFO(Structure):
+ _fields_ = [
+ ('fIcon', BOOL),
+ ('xHotspot', DWORD),
+ ('yHotspot', DWORD),
+ ('hbmMask', HBITMAP),
+ ('hbmColor', HBITMAP)
+ ]
+ __slots__ = [f[0] for f in _fields_]
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/win32/winkey.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/win32/winkey.py
new file mode 100644
index 0000000..2eef786
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/win32/winkey.py
@@ -0,0 +1,238 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+from __future__ import absolute_import
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+from pyglet.window import key
+from .constants import *
+
+keymap = {
+ ord('A'): key.A,
+ ord('B'): key.B,
+ ord('C'): key.C,
+ ord('D'): key.D,
+ ord('E'): key.E,
+ ord('F'): key.F,
+ ord('G'): key.G,
+ ord('H'): key.H,
+ ord('I'): key.I,
+ ord('J'): key.J,
+ ord('K'): key.K,
+ ord('L'): key.L,
+ ord('M'): key.M,
+ ord('N'): key.N,
+ ord('O'): key.O,
+ ord('P'): key.P,
+ ord('Q'): key.Q,
+ ord('R'): key.R,
+ ord('S'): key.S,
+ ord('T'): key.T,
+ ord('U'): key.U,
+ ord('V'): key.V,
+ ord('W'): key.W,
+ ord('X'): key.X,
+ ord('Y'): key.Y,
+ ord('Z'): key.Z,
+ ord('0'): key._0,
+ ord('1'): key._1,
+ ord('2'): key._2,
+ ord('3'): key._3,
+ ord('4'): key._4,
+ ord('5'): key._5,
+ ord('6'): key._6,
+ ord('7'): key._7,
+ ord('8'): key._8,
+ ord('9'): key._9,
+ ord('\b'): key.BACKSPACE,
+
+ # By experiment:
+ 0x14: key.CAPSLOCK,
+ 0x5d: key.MENU,
+
+# VK_LBUTTON: ,
+# VK_RBUTTON: ,
+ VK_CANCEL: key.CANCEL,
+# VK_MBUTTON: ,
+# VK_BACK: ,
+ VK_TAB: key.TAB,
+# VK_CLEAR: ,
+ VK_RETURN: key.RETURN,
+ VK_SHIFT: key.LSHIFT,
+ VK_CONTROL: key.LCTRL,
+ VK_MENU: key.LALT,
+ VK_PAUSE: key.PAUSE,
+# VK_CAPITAL: ,
+# VK_KANA: ,
+# VK_HANGEUL: ,
+# VK_HANGUL: ,
+# VK_JUNJA: ,
+# VK_FINAL: ,
+# VK_HANJA: ,
+# VK_KANJI: ,
+ VK_ESCAPE: key.ESCAPE,
+# VK_CONVERT: ,
+# VK_NONCONVERT: ,
+# VK_ACCEPT: ,
+# VK_MODECHANGE: ,
+ VK_SPACE: key.SPACE,
+ VK_PRIOR: key.PAGEUP,
+ VK_NEXT: key.PAGEDOWN,
+ VK_END: key.END,
+ VK_HOME: key.HOME,
+ VK_LEFT: key.LEFT,
+ VK_UP: key.UP,
+ VK_RIGHT: key.RIGHT,
+ VK_DOWN: key.DOWN,
+# VK_SELECT: ,
+ VK_PRINT: key.PRINT,
+# VK_EXECUTE: ,
+# VK_SNAPSHOT: ,
+ VK_INSERT: key.INSERT,
+ VK_DELETE: key.DELETE,
+ VK_HELP: key.HELP,
+ VK_LWIN: key.LWINDOWS,
+ VK_RWIN: key.RWINDOWS,
+# VK_APPS: ,
+ VK_NUMPAD0: key.NUM_0,
+ VK_NUMPAD1: key.NUM_1,
+ VK_NUMPAD2: key.NUM_2,
+ VK_NUMPAD3: key.NUM_3,
+ VK_NUMPAD4: key.NUM_4,
+ VK_NUMPAD5: key.NUM_5,
+ VK_NUMPAD6: key.NUM_6,
+ VK_NUMPAD7: key.NUM_7,
+ VK_NUMPAD8: key.NUM_8,
+ VK_NUMPAD9: key.NUM_9,
+ VK_MULTIPLY: key.NUM_MULTIPLY,
+ VK_ADD: key.NUM_ADD,
+# VK_SEPARATOR: ,
+ VK_SUBTRACT: key.NUM_SUBTRACT,
+ VK_DECIMAL: key.NUM_DECIMAL,
+ VK_DIVIDE: key.NUM_DIVIDE,
+ VK_F1: key.F1,
+ VK_F2: key.F2,
+ VK_F3: key.F3,
+ VK_F4: key.F4,
+ VK_F5: key.F5,
+ VK_F6: key.F6,
+ VK_F7: key.F7,
+ VK_F8: key.F8,
+ VK_F9: key.F9,
+ VK_F10: key.F10,
+ VK_F11: key.F11,
+ VK_F12: key.F12,
+ VK_F13: key.F13,
+ VK_F14: key.F14,
+ VK_F15: key.F15,
+ VK_F16: key.F16,
+# VK_F17: ,
+# VK_F18: ,
+# VK_F19: ,
+# VK_F20: ,
+# VK_F21: ,
+# VK_F22: ,
+# VK_F23: ,
+# VK_F24: ,
+ VK_NUMLOCK: key.NUMLOCK,
+ VK_SCROLL: key.SCROLLLOCK,
+ VK_LSHIFT: key.LSHIFT,
+ VK_RSHIFT: key.RSHIFT,
+ VK_LCONTROL: key.LCTRL,
+ VK_RCONTROL: key.RCTRL,
+ VK_LMENU: key.LALT,
+ VK_RMENU: key.RALT,
+# VK_PROCESSKEY: ,
+# VK_ATTN: ,
+# VK_CRSEL: ,
+# VK_EXSEL: ,
+# VK_EREOF: ,
+# VK_PLAY: ,
+# VK_ZOOM: ,
+# VK_NONAME: ,
+# VK_PA1: ,
+# VK_OEM_CLEAR: ,
+# VK_XBUTTON1: ,
+# VK_XBUTTON2: ,
+# VK_VOLUME_MUTE: ,
+# VK_VOLUME_DOWN: ,
+# VK_VOLUME_UP: ,
+# VK_MEDIA_NEXT_TRACK: ,
+# VK_MEDIA_PREV_TRACK: ,
+# VK_MEDIA_PLAY_PAUSE: ,
+# VK_BROWSER_BACK: ,
+# VK_BROWSER_FORWARD: ,
+}
+
+# Keys that must be translated via MapVirtualKey, as the virtual key code
+# is language and keyboard dependent.
+chmap = {
+ ord('!'): key.EXCLAMATION,
+ ord('"'): key.DOUBLEQUOTE,
+ ord('#'): key.HASH,
+ ord('$'): key.DOLLAR,
+ ord('%'): key.PERCENT,
+ ord('&'): key.AMPERSAND,
+ ord("'"): key.APOSTROPHE,
+ ord('('): key.PARENLEFT,
+ ord(')'): key.PARENRIGHT,
+ ord('*'): key.ASTERISK,
+ ord('+'): key.PLUS,
+ ord(','): key.COMMA,
+ ord('-'): key.MINUS,
+ ord('.'): key.PERIOD,
+ ord('/'): key.SLASH,
+ ord(':'): key.COLON,
+ ord(';'): key.SEMICOLON,
+ ord('<'): key.LESS,
+ ord('='): key.EQUAL,
+ ord('>'): key.GREATER,
+ ord('?'): key.QUESTION,
+ ord('@'): key.AT,
+ ord('['): key.BRACKETLEFT,
+ ord('\\'): key.BACKSLASH,
+ ord(']'): key.BRACKETRIGHT,
+ ord('\x5e'): key.ASCIICIRCUM,
+ ord('_'): key.UNDERSCORE,
+ ord('\x60'): key.GRAVE,
+ ord('`'): key.QUOTELEFT,
+ ord('{'): key.BRACELEFT,
+ ord('|'): key.BAR,
+ ord('}'): key.BRACERIGHT,
+ ord('~'): key.ASCIITILDE,
+}
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/cursorfont.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/cursorfont.py
new file mode 100644
index 0000000..0c2d224
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/cursorfont.py
@@ -0,0 +1,120 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+# /usr/include/X11/cursorfont.h
+
+XC_num_glyphs = 154
+XC_X_cursor = 0
+XC_arrow = 2
+XC_based_arrow_down = 4
+XC_based_arrow_up = 6
+XC_boat = 8
+XC_bogosity = 10
+XC_bottom_left_corner = 12
+XC_bottom_right_corner = 14
+XC_bottom_side = 16
+XC_bottom_tee = 18
+XC_box_spiral = 20
+XC_center_ptr = 22
+XC_circle = 24
+XC_clock = 26
+XC_coffee_mug = 28
+XC_cross = 30
+XC_cross_reverse = 32
+XC_crosshair = 34
+XC_diamond_cross = 36
+XC_dot = 38
+XC_dotbox = 40
+XC_double_arrow = 42
+XC_draft_large = 44
+XC_draft_small = 46
+XC_draped_box = 48
+XC_exchange = 50
+XC_fleur = 52
+XC_gobbler = 54
+XC_gumby = 56
+XC_hand1 = 58
+XC_hand2 = 60
+XC_heart = 62
+XC_icon = 64
+XC_iron_cross = 66
+XC_left_ptr = 68
+XC_left_side = 70
+XC_left_tee = 72
+XC_leftbutton = 74
+XC_ll_angle = 76
+XC_lr_angle = 78
+XC_man = 80
+XC_middlebutton = 82
+XC_mouse = 84
+XC_pencil = 86
+XC_pirate = 88
+XC_plus = 90
+XC_question_arrow = 92
+XC_right_ptr = 94
+XC_right_side = 96
+XC_right_tee = 98
+XC_rightbutton = 100
+XC_rtl_logo = 102
+XC_sailboat = 104
+XC_sb_down_arrow = 106
+XC_sb_h_double_arrow = 108
+XC_sb_left_arrow = 110
+XC_sb_right_arrow = 112
+XC_sb_up_arrow = 114
+XC_sb_v_double_arrow = 116
+XC_shuttle = 118
+XC_sizing = 120
+XC_spider = 122
+XC_spraycan = 124
+XC_star = 126
+XC_target = 128
+XC_tcross = 130
+XC_top_left_arrow = 132
+XC_top_left_corner = 134
+XC_top_right_corner = 136
+XC_top_side = 138
+XC_top_tee = 140
+XC_trek = 142
+XC_ul_angle = 144
+XC_umbrella = 146
+XC_ur_angle = 148
+XC_watch = 150
+XC_xterm = 152
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/xf86vmode.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/xf86vmode.py
new file mode 100644
index 0000000..f564ba8
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/xf86vmode.py
@@ -0,0 +1,346 @@
+'''Wrapper for Xxf86vm
+
+Generated with:
+tools/genwrappers.py xf86vmode
+
+Do not modify this file.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import ctypes
+from ctypes import *
+
+import pyglet.lib
+
+_lib = pyglet.lib.load_library('Xxf86vm')
+
+_int_types = (c_int16, c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (ctypes.c_int64,)
+for t in _int_types:
+ if sizeof(t) == sizeof(c_size_t):
+ c_ptrdiff_t = t
+
+class c_void(Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', c_int)]
+
+
+import pyglet.libs.x11.xlib
+
+X_XF86VidModeQueryVersion = 0 # /usr/include/X11/extensions/xf86vmode.h:4885
+X_XF86VidModeGetModeLine = 1 # /usr/include/X11/extensions/xf86vmode.h:4886
+X_XF86VidModeModModeLine = 2 # /usr/include/X11/extensions/xf86vmode.h:4887
+X_XF86VidModeSwitchMode = 3 # /usr/include/X11/extensions/xf86vmode.h:4888
+X_XF86VidModeGetMonitor = 4 # /usr/include/X11/extensions/xf86vmode.h:4889
+X_XF86VidModeLockModeSwitch = 5 # /usr/include/X11/extensions/xf86vmode.h:4890
+X_XF86VidModeGetAllModeLines = 6 # /usr/include/X11/extensions/xf86vmode.h:4891
+X_XF86VidModeAddModeLine = 7 # /usr/include/X11/extensions/xf86vmode.h:4892
+X_XF86VidModeDeleteModeLine = 8 # /usr/include/X11/extensions/xf86vmode.h:4893
+X_XF86VidModeValidateModeLine = 9 # /usr/include/X11/extensions/xf86vmode.h:4894
+X_XF86VidModeSwitchToMode = 10 # /usr/include/X11/extensions/xf86vmode.h:4895
+X_XF86VidModeGetViewPort = 11 # /usr/include/X11/extensions/xf86vmode.h:4896
+X_XF86VidModeSetViewPort = 12 # /usr/include/X11/extensions/xf86vmode.h:4897
+X_XF86VidModeGetDotClocks = 13 # /usr/include/X11/extensions/xf86vmode.h:4899
+X_XF86VidModeSetClientVersion = 14 # /usr/include/X11/extensions/xf86vmode.h:4900
+X_XF86VidModeSetGamma = 15 # /usr/include/X11/extensions/xf86vmode.h:4901
+X_XF86VidModeGetGamma = 16 # /usr/include/X11/extensions/xf86vmode.h:4902
+X_XF86VidModeGetGammaRamp = 17 # /usr/include/X11/extensions/xf86vmode.h:4903
+X_XF86VidModeSetGammaRamp = 18 # /usr/include/X11/extensions/xf86vmode.h:4904
+X_XF86VidModeGetGammaRampSize = 19 # /usr/include/X11/extensions/xf86vmode.h:4905
+X_XF86VidModeGetPermissions = 20 # /usr/include/X11/extensions/xf86vmode.h:4906
+CLKFLAG_PROGRAMABLE = 1 # /usr/include/X11/extensions/xf86vmode.h:4908
+XF86VidModeNumberEvents = 0 # /usr/include/X11/extensions/xf86vmode.h:4919
+XF86VidModeBadClock = 0 # /usr/include/X11/extensions/xf86vmode.h:4922
+XF86VidModeBadHTimings = 1 # /usr/include/X11/extensions/xf86vmode.h:4923
+XF86VidModeBadVTimings = 2 # /usr/include/X11/extensions/xf86vmode.h:4924
+XF86VidModeModeUnsuitable = 3 # /usr/include/X11/extensions/xf86vmode.h:4925
+XF86VidModeExtensionDisabled = 4 # /usr/include/X11/extensions/xf86vmode.h:4926
+XF86VidModeClientNotLocal = 5 # /usr/include/X11/extensions/xf86vmode.h:4927
+XF86VidModeZoomLocked = 6 # /usr/include/X11/extensions/xf86vmode.h:4928
+XF86VidModeNumberErrors = 7 # /usr/include/X11/extensions/xf86vmode.h:4929
+XF86VM_READ_PERMISSION = 1 # /usr/include/X11/extensions/xf86vmode.h:4931
+XF86VM_WRITE_PERMISSION = 2 # /usr/include/X11/extensions/xf86vmode.h:4932
+class struct_anon_93(Structure):
+ __slots__ = [
+ 'hdisplay',
+ 'hsyncstart',
+ 'hsyncend',
+ 'htotal',
+ 'hskew',
+ 'vdisplay',
+ 'vsyncstart',
+ 'vsyncend',
+ 'vtotal',
+ 'flags',
+ 'privsize',
+ 'private',
+ ]
+INT32 = c_int # /usr/include/X11/Xmd.h:135
+struct_anon_93._fields_ = [
+ ('hdisplay', c_ushort),
+ ('hsyncstart', c_ushort),
+ ('hsyncend', c_ushort),
+ ('htotal', c_ushort),
+ ('hskew', c_ushort),
+ ('vdisplay', c_ushort),
+ ('vsyncstart', c_ushort),
+ ('vsyncend', c_ushort),
+ ('vtotal', c_ushort),
+ ('flags', c_uint),
+ ('privsize', c_int),
+ ('private', POINTER(INT32)),
+]
+
+XF86VidModeModeLine = struct_anon_93 # /usr/include/X11/extensions/xf86vmode.h:4954
+class struct_anon_94(Structure):
+ __slots__ = [
+ 'dotclock',
+ 'hdisplay',
+ 'hsyncstart',
+ 'hsyncend',
+ 'htotal',
+ 'hskew',
+ 'vdisplay',
+ 'vsyncstart',
+ 'vsyncend',
+ 'vtotal',
+ 'flags',
+ 'privsize',
+ 'private',
+ ]
+struct_anon_94._fields_ = [
+ ('dotclock', c_uint),
+ ('hdisplay', c_ushort),
+ ('hsyncstart', c_ushort),
+ ('hsyncend', c_ushort),
+ ('htotal', c_ushort),
+ ('hskew', c_ushort),
+ ('vdisplay', c_ushort),
+ ('vsyncstart', c_ushort),
+ ('vsyncend', c_ushort),
+ ('vtotal', c_ushort),
+ ('flags', c_uint),
+ ('privsize', c_int),
+ ('private', POINTER(INT32)),
+]
+
+XF86VidModeModeInfo = struct_anon_94 # /usr/include/X11/extensions/xf86vmode.h:4975
+class struct_anon_95(Structure):
+ __slots__ = [
+ 'hi',
+ 'lo',
+ ]
+struct_anon_95._fields_ = [
+ ('hi', c_float),
+ ('lo', c_float),
+]
+
+XF86VidModeSyncRange = struct_anon_95 # /usr/include/X11/extensions/xf86vmode.h:4980
+class struct_anon_96(Structure):
+ __slots__ = [
+ 'vendor',
+ 'model',
+ 'EMPTY',
+ 'nhsync',
+ 'hsync',
+ 'nvsync',
+ 'vsync',
+ ]
+struct_anon_96._fields_ = [
+ ('vendor', c_char_p),
+ ('model', c_char_p),
+ ('EMPTY', c_float),
+ ('nhsync', c_ubyte),
+ ('hsync', POINTER(XF86VidModeSyncRange)),
+ ('nvsync', c_ubyte),
+ ('vsync', POINTER(XF86VidModeSyncRange)),
+]
+
+XF86VidModeMonitor = struct_anon_96 # /usr/include/X11/extensions/xf86vmode.h:4990
+class struct_anon_97(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'root',
+ 'state',
+ 'kind',
+ 'forced',
+ 'time',
+ ]
+Display = pyglet.libs.x11.xlib.Display
+Window = pyglet.libs.x11.xlib.Window
+Time = pyglet.libs.x11.xlib.Time
+struct_anon_97._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('root', Window),
+ ('state', c_int),
+ ('kind', c_int),
+ ('forced', c_int),
+ ('time', Time),
+]
+
+XF86VidModeNotifyEvent = struct_anon_97 # /usr/include/X11/extensions/xf86vmode.h:5002
+class struct_anon_98(Structure):
+ __slots__ = [
+ 'red',
+ 'green',
+ 'blue',
+ ]
+struct_anon_98._fields_ = [
+ ('red', c_float),
+ ('green', c_float),
+ ('blue', c_float),
+]
+
+XF86VidModeGamma = struct_anon_98 # /usr/include/X11/extensions/xf86vmode.h:5008
+# /usr/include/X11/extensions/xf86vmode.h:5018
+XF86VidModeQueryVersion = _lib.XF86VidModeQueryVersion
+XF86VidModeQueryVersion.restype = c_int
+XF86VidModeQueryVersion.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5024
+XF86VidModeQueryExtension = _lib.XF86VidModeQueryExtension
+XF86VidModeQueryExtension.restype = c_int
+XF86VidModeQueryExtension.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5030
+XF86VidModeSetClientVersion = _lib.XF86VidModeSetClientVersion
+XF86VidModeSetClientVersion.restype = c_int
+XF86VidModeSetClientVersion.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5034
+XF86VidModeGetModeLine = _lib.XF86VidModeGetModeLine
+XF86VidModeGetModeLine.restype = c_int
+XF86VidModeGetModeLine.argtypes = [POINTER(Display), c_int, POINTER(c_int), POINTER(XF86VidModeModeLine)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5041
+XF86VidModeGetAllModeLines = _lib.XF86VidModeGetAllModeLines
+XF86VidModeGetAllModeLines.restype = c_int
+XF86VidModeGetAllModeLines.argtypes = [POINTER(Display), c_int, POINTER(c_int), POINTER(POINTER(POINTER(XF86VidModeModeInfo)))]
+
+# /usr/include/X11/extensions/xf86vmode.h:5048
+XF86VidModeAddModeLine = _lib.XF86VidModeAddModeLine
+XF86VidModeAddModeLine.restype = c_int
+XF86VidModeAddModeLine.argtypes = [POINTER(Display), c_int, POINTER(XF86VidModeModeInfo), POINTER(XF86VidModeModeInfo)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5055
+XF86VidModeDeleteModeLine = _lib.XF86VidModeDeleteModeLine
+XF86VidModeDeleteModeLine.restype = c_int
+XF86VidModeDeleteModeLine.argtypes = [POINTER(Display), c_int, POINTER(XF86VidModeModeInfo)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5061
+XF86VidModeModModeLine = _lib.XF86VidModeModModeLine
+XF86VidModeModModeLine.restype = c_int
+XF86VidModeModModeLine.argtypes = [POINTER(Display), c_int, POINTER(XF86VidModeModeLine)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5067
+XF86VidModeValidateModeLine = _lib.XF86VidModeValidateModeLine
+XF86VidModeValidateModeLine.restype = c_int
+XF86VidModeValidateModeLine.argtypes = [POINTER(Display), c_int, POINTER(XF86VidModeModeInfo)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5073
+XF86VidModeSwitchMode = _lib.XF86VidModeSwitchMode
+XF86VidModeSwitchMode.restype = c_int
+XF86VidModeSwitchMode.argtypes = [POINTER(Display), c_int, c_int]
+
+# /usr/include/X11/extensions/xf86vmode.h:5079
+XF86VidModeSwitchToMode = _lib.XF86VidModeSwitchToMode
+XF86VidModeSwitchToMode.restype = c_int
+XF86VidModeSwitchToMode.argtypes = [POINTER(Display), c_int, POINTER(XF86VidModeModeInfo)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5085
+XF86VidModeLockModeSwitch = _lib.XF86VidModeLockModeSwitch
+XF86VidModeLockModeSwitch.restype = c_int
+XF86VidModeLockModeSwitch.argtypes = [POINTER(Display), c_int, c_int]
+
+# /usr/include/X11/extensions/xf86vmode.h:5091
+XF86VidModeGetMonitor = _lib.XF86VidModeGetMonitor
+XF86VidModeGetMonitor.restype = c_int
+XF86VidModeGetMonitor.argtypes = [POINTER(Display), c_int, POINTER(XF86VidModeMonitor)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5097
+XF86VidModeGetViewPort = _lib.XF86VidModeGetViewPort
+XF86VidModeGetViewPort.restype = c_int
+XF86VidModeGetViewPort.argtypes = [POINTER(Display), c_int, POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5104
+XF86VidModeSetViewPort = _lib.XF86VidModeSetViewPort
+XF86VidModeSetViewPort.restype = c_int
+XF86VidModeSetViewPort.argtypes = [POINTER(Display), c_int, c_int, c_int]
+
+# /usr/include/X11/extensions/xf86vmode.h:5111
+XF86VidModeGetDotClocks = _lib.XF86VidModeGetDotClocks
+XF86VidModeGetDotClocks.restype = c_int
+XF86VidModeGetDotClocks.argtypes = [POINTER(Display), c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(POINTER(c_int))]
+
+# /usr/include/X11/extensions/xf86vmode.h:5120
+XF86VidModeGetGamma = _lib.XF86VidModeGetGamma
+XF86VidModeGetGamma.restype = c_int
+XF86VidModeGetGamma.argtypes = [POINTER(Display), c_int, POINTER(XF86VidModeGamma)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5126
+XF86VidModeSetGamma = _lib.XF86VidModeSetGamma
+XF86VidModeSetGamma.restype = c_int
+XF86VidModeSetGamma.argtypes = [POINTER(Display), c_int, POINTER(XF86VidModeGamma)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5132
+XF86VidModeSetGammaRamp = _lib.XF86VidModeSetGammaRamp
+XF86VidModeSetGammaRamp.restype = c_int
+XF86VidModeSetGammaRamp.argtypes = [POINTER(Display), c_int, c_int, POINTER(c_ushort), POINTER(c_ushort), POINTER(c_ushort)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5141
+XF86VidModeGetGammaRamp = _lib.XF86VidModeGetGammaRamp
+XF86VidModeGetGammaRamp.restype = c_int
+XF86VidModeGetGammaRamp.argtypes = [POINTER(Display), c_int, c_int, POINTER(c_ushort), POINTER(c_ushort), POINTER(c_ushort)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5150
+XF86VidModeGetGammaRampSize = _lib.XF86VidModeGetGammaRampSize
+XF86VidModeGetGammaRampSize.restype = c_int
+XF86VidModeGetGammaRampSize.argtypes = [POINTER(Display), c_int, POINTER(c_int)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5156
+XF86VidModeGetPermissions = _lib.XF86VidModeGetPermissions
+XF86VidModeGetPermissions.restype = c_int
+XF86VidModeGetPermissions.argtypes = [POINTER(Display), c_int, POINTER(c_int)]
+
+
+__all__ = ['X_XF86VidModeQueryVersion', 'X_XF86VidModeGetModeLine',
+'X_XF86VidModeModModeLine', 'X_XF86VidModeSwitchMode',
+'X_XF86VidModeGetMonitor', 'X_XF86VidModeLockModeSwitch',
+'X_XF86VidModeGetAllModeLines', 'X_XF86VidModeAddModeLine',
+'X_XF86VidModeDeleteModeLine', 'X_XF86VidModeValidateModeLine',
+'X_XF86VidModeSwitchToMode', 'X_XF86VidModeGetViewPort',
+'X_XF86VidModeSetViewPort', 'X_XF86VidModeGetDotClocks',
+'X_XF86VidModeSetClientVersion', 'X_XF86VidModeSetGamma',
+'X_XF86VidModeGetGamma', 'X_XF86VidModeGetGammaRamp',
+'X_XF86VidModeSetGammaRamp', 'X_XF86VidModeGetGammaRampSize',
+'X_XF86VidModeGetPermissions', 'CLKFLAG_PROGRAMABLE',
+'XF86VidModeNumberEvents', 'XF86VidModeBadClock', 'XF86VidModeBadHTimings',
+'XF86VidModeBadVTimings', 'XF86VidModeModeUnsuitable',
+'XF86VidModeExtensionDisabled', 'XF86VidModeClientNotLocal',
+'XF86VidModeZoomLocked', 'XF86VidModeNumberErrors', 'XF86VM_READ_PERMISSION',
+'XF86VM_WRITE_PERMISSION', 'XF86VidModeModeLine', 'XF86VidModeModeInfo',
+'XF86VidModeSyncRange', 'XF86VidModeMonitor', 'XF86VidModeNotifyEvent',
+'XF86VidModeGamma', 'XF86VidModeQueryVersion', 'XF86VidModeQueryExtension',
+'XF86VidModeSetClientVersion', 'XF86VidModeGetModeLine',
+'XF86VidModeGetAllModeLines', 'XF86VidModeAddModeLine',
+'XF86VidModeDeleteModeLine', 'XF86VidModeModModeLine',
+'XF86VidModeValidateModeLine', 'XF86VidModeSwitchMode',
+'XF86VidModeSwitchToMode', 'XF86VidModeLockModeSwitch',
+'XF86VidModeGetMonitor', 'XF86VidModeGetViewPort', 'XF86VidModeSetViewPort',
+'XF86VidModeGetDotClocks', 'XF86VidModeGetGamma', 'XF86VidModeSetGamma',
+'XF86VidModeSetGammaRamp', 'XF86VidModeGetGammaRamp',
+'XF86VidModeGetGammaRampSize', 'XF86VidModeGetPermissions']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/xinerama.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/xinerama.py
new file mode 100644
index 0000000..3287e81
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/xinerama.py
@@ -0,0 +1,78 @@
+'''Wrapper for Xinerama
+
+Generated with:
+tools/genwrappers.py xinerama
+
+Do not modify this file.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import ctypes
+from ctypes import *
+
+import pyglet.lib
+
+_lib = pyglet.lib.load_library('Xinerama')
+
+_int_types = (c_int16, c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (ctypes.c_int64,)
+for t in _int_types:
+ if sizeof(t) == sizeof(c_size_t):
+ c_ptrdiff_t = t
+
+class c_void(Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', c_int)]
+
+
+import pyglet.libs.x11.xlib
+
+class struct_anon_93(Structure):
+ __slots__ = [
+ 'screen_number',
+ 'x_org',
+ 'y_org',
+ 'width',
+ 'height',
+ ]
+struct_anon_93._fields_ = [
+ ('screen_number', c_int),
+ ('x_org', c_short),
+ ('y_org', c_short),
+ ('width', c_short),
+ ('height', c_short),
+]
+
+XineramaScreenInfo = struct_anon_93 # /usr/include/X11/extensions/Xinerama.h:40
+Display = pyglet.libs.x11.xlib.Display
+# /usr/include/X11/extensions/Xinerama.h:44
+XineramaQueryExtension = _lib.XineramaQueryExtension
+XineramaQueryExtension.restype = c_int
+XineramaQueryExtension.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/extensions/Xinerama.h:50
+XineramaQueryVersion = _lib.XineramaQueryVersion
+XineramaQueryVersion.restype = c_int
+XineramaQueryVersion.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/extensions/Xinerama.h:56
+XineramaIsActive = _lib.XineramaIsActive
+XineramaIsActive.restype = c_int
+XineramaIsActive.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/extensions/Xinerama.h:67
+XineramaQueryScreens = _lib.XineramaQueryScreens
+XineramaQueryScreens.restype = POINTER(XineramaScreenInfo)
+XineramaQueryScreens.argtypes = [POINTER(Display), POINTER(c_int)]
+
+
+__all__ = ['XineramaScreenInfo', 'XineramaQueryExtension',
+'XineramaQueryVersion', 'XineramaIsActive', 'XineramaQueryScreens']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/xinput.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/xinput.py
new file mode 100644
index 0000000..39ef3c1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/xinput.py
@@ -0,0 +1,1650 @@
+'''Wrapper for Xi
+
+Generated with:
+tools/genwrappers.py xinput
+
+Do not modify this file.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: wrap.py 1694 2008-01-30 23:12:00Z Alex.Holkner $'
+
+import ctypes
+from ctypes import *
+
+import pyglet.lib
+
+_lib = pyglet.lib.load_library('Xi')
+
+_int_types = (c_int16, c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (ctypes.c_int64,)
+for t in _int_types:
+ if sizeof(t) == sizeof(c_size_t):
+ c_ptrdiff_t = t
+
+class c_void(Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', c_int)]
+
+
+import pyglet.libs.x11.xlib
+
+sz_xGetExtensionVersionReq = 8 # /usr/include/X11/extensions/XI.h:56
+sz_xGetExtensionVersionReply = 32 # /usr/include/X11/extensions/XI.h:57
+sz_xListInputDevicesReq = 4 # /usr/include/X11/extensions/XI.h:58
+sz_xListInputDevicesReply = 32 # /usr/include/X11/extensions/XI.h:59
+sz_xOpenDeviceReq = 8 # /usr/include/X11/extensions/XI.h:60
+sz_xOpenDeviceReply = 32 # /usr/include/X11/extensions/XI.h:61
+sz_xCloseDeviceReq = 8 # /usr/include/X11/extensions/XI.h:62
+sz_xSetDeviceModeReq = 8 # /usr/include/X11/extensions/XI.h:63
+sz_xSetDeviceModeReply = 32 # /usr/include/X11/extensions/XI.h:64
+sz_xSelectExtensionEventReq = 12 # /usr/include/X11/extensions/XI.h:65
+sz_xGetSelectedExtensionEventsReq = 8 # /usr/include/X11/extensions/XI.h:66
+sz_xGetSelectedExtensionEventsReply = 32 # /usr/include/X11/extensions/XI.h:67
+sz_xChangeDeviceDontPropagateListReq = 12 # /usr/include/X11/extensions/XI.h:68
+sz_xGetDeviceDontPropagateListReq = 8 # /usr/include/X11/extensions/XI.h:69
+sz_xGetDeviceDontPropagateListReply = 32 # /usr/include/X11/extensions/XI.h:70
+sz_xGetDeviceMotionEventsReq = 16 # /usr/include/X11/extensions/XI.h:71
+sz_xGetDeviceMotionEventsReply = 32 # /usr/include/X11/extensions/XI.h:72
+sz_xChangeKeyboardDeviceReq = 8 # /usr/include/X11/extensions/XI.h:73
+sz_xChangeKeyboardDeviceReply = 32 # /usr/include/X11/extensions/XI.h:74
+sz_xChangePointerDeviceReq = 8 # /usr/include/X11/extensions/XI.h:75
+sz_xChangePointerDeviceReply = 32 # /usr/include/X11/extensions/XI.h:76
+sz_xGrabDeviceReq = 20 # /usr/include/X11/extensions/XI.h:77
+sz_xGrabDeviceReply = 32 # /usr/include/X11/extensions/XI.h:78
+sz_xUngrabDeviceReq = 12 # /usr/include/X11/extensions/XI.h:79
+sz_xGrabDeviceKeyReq = 20 # /usr/include/X11/extensions/XI.h:80
+sz_xGrabDeviceKeyReply = 32 # /usr/include/X11/extensions/XI.h:81
+sz_xUngrabDeviceKeyReq = 16 # /usr/include/X11/extensions/XI.h:82
+sz_xGrabDeviceButtonReq = 20 # /usr/include/X11/extensions/XI.h:83
+sz_xGrabDeviceButtonReply = 32 # /usr/include/X11/extensions/XI.h:84
+sz_xUngrabDeviceButtonReq = 16 # /usr/include/X11/extensions/XI.h:85
+sz_xAllowDeviceEventsReq = 12 # /usr/include/X11/extensions/XI.h:86
+sz_xGetDeviceFocusReq = 8 # /usr/include/X11/extensions/XI.h:87
+sz_xGetDeviceFocusReply = 32 # /usr/include/X11/extensions/XI.h:88
+sz_xSetDeviceFocusReq = 16 # /usr/include/X11/extensions/XI.h:89
+sz_xGetFeedbackControlReq = 8 # /usr/include/X11/extensions/XI.h:90
+sz_xGetFeedbackControlReply = 32 # /usr/include/X11/extensions/XI.h:91
+sz_xChangeFeedbackControlReq = 12 # /usr/include/X11/extensions/XI.h:92
+sz_xGetDeviceKeyMappingReq = 8 # /usr/include/X11/extensions/XI.h:93
+sz_xGetDeviceKeyMappingReply = 32 # /usr/include/X11/extensions/XI.h:94
+sz_xChangeDeviceKeyMappingReq = 8 # /usr/include/X11/extensions/XI.h:95
+sz_xGetDeviceModifierMappingReq = 8 # /usr/include/X11/extensions/XI.h:96
+sz_xSetDeviceModifierMappingReq = 8 # /usr/include/X11/extensions/XI.h:97
+sz_xSetDeviceModifierMappingReply = 32 # /usr/include/X11/extensions/XI.h:98
+sz_xGetDeviceButtonMappingReq = 8 # /usr/include/X11/extensions/XI.h:99
+sz_xGetDeviceButtonMappingReply = 32 # /usr/include/X11/extensions/XI.h:100
+sz_xSetDeviceButtonMappingReq = 8 # /usr/include/X11/extensions/XI.h:101
+sz_xSetDeviceButtonMappingReply = 32 # /usr/include/X11/extensions/XI.h:102
+sz_xQueryDeviceStateReq = 8 # /usr/include/X11/extensions/XI.h:103
+sz_xQueryDeviceStateReply = 32 # /usr/include/X11/extensions/XI.h:104
+sz_xSendExtensionEventReq = 16 # /usr/include/X11/extensions/XI.h:105
+sz_xDeviceBellReq = 8 # /usr/include/X11/extensions/XI.h:106
+sz_xSetDeviceValuatorsReq = 8 # /usr/include/X11/extensions/XI.h:107
+sz_xSetDeviceValuatorsReply = 32 # /usr/include/X11/extensions/XI.h:108
+sz_xGetDeviceControlReq = 8 # /usr/include/X11/extensions/XI.h:109
+sz_xGetDeviceControlReply = 32 # /usr/include/X11/extensions/XI.h:110
+sz_xChangeDeviceControlReq = 8 # /usr/include/X11/extensions/XI.h:111
+sz_xChangeDeviceControlReply = 32 # /usr/include/X11/extensions/XI.h:112
+Dont_Check = 0 # /usr/include/X11/extensions/XI.h:135
+XInput_Initial_Release = 1 # /usr/include/X11/extensions/XI.h:136
+XInput_Add_XDeviceBell = 2 # /usr/include/X11/extensions/XI.h:137
+XInput_Add_XSetDeviceValuators = 3 # /usr/include/X11/extensions/XI.h:138
+XInput_Add_XChangeDeviceControl = 4 # /usr/include/X11/extensions/XI.h:139
+XInput_Add_DevicePresenceNotify = 5 # /usr/include/X11/extensions/XI.h:140
+XI_Absent = 0 # /usr/include/X11/extensions/XI.h:142
+XI_Present = 1 # /usr/include/X11/extensions/XI.h:143
+XI_Initial_Release_Major = 1 # /usr/include/X11/extensions/XI.h:145
+XI_Initial_Release_Minor = 0 # /usr/include/X11/extensions/XI.h:146
+XI_Add_XDeviceBell_Major = 1 # /usr/include/X11/extensions/XI.h:148
+XI_Add_XDeviceBell_Minor = 1 # /usr/include/X11/extensions/XI.h:149
+XI_Add_XSetDeviceValuators_Major = 1 # /usr/include/X11/extensions/XI.h:151
+XI_Add_XSetDeviceValuators_Minor = 2 # /usr/include/X11/extensions/XI.h:152
+XI_Add_XChangeDeviceControl_Major = 1 # /usr/include/X11/extensions/XI.h:154
+XI_Add_XChangeDeviceControl_Minor = 3 # /usr/include/X11/extensions/XI.h:155
+XI_Add_DevicePresenceNotify_Major = 1 # /usr/include/X11/extensions/XI.h:157
+XI_Add_DevicePresenceNotify_Minor = 4 # /usr/include/X11/extensions/XI.h:158
+DEVICE_RESOLUTION = 1 # /usr/include/X11/extensions/XI.h:160
+DEVICE_ABS_CALIB = 2 # /usr/include/X11/extensions/XI.h:161
+DEVICE_CORE = 3 # /usr/include/X11/extensions/XI.h:162
+DEVICE_ENABLE = 4 # /usr/include/X11/extensions/XI.h:163
+DEVICE_ABS_AREA = 5 # /usr/include/X11/extensions/XI.h:164
+NoSuchExtension = 1 # /usr/include/X11/extensions/XI.h:166
+COUNT = 0 # /usr/include/X11/extensions/XI.h:168
+CREATE = 1 # /usr/include/X11/extensions/XI.h:169
+NewPointer = 0 # /usr/include/X11/extensions/XI.h:171
+NewKeyboard = 1 # /usr/include/X11/extensions/XI.h:172
+XPOINTER = 0 # /usr/include/X11/extensions/XI.h:174
+XKEYBOARD = 1 # /usr/include/X11/extensions/XI.h:175
+UseXKeyboard = 255 # /usr/include/X11/extensions/XI.h:177
+IsXPointer = 0 # /usr/include/X11/extensions/XI.h:179
+IsXKeyboard = 1 # /usr/include/X11/extensions/XI.h:180
+IsXExtensionDevice = 2 # /usr/include/X11/extensions/XI.h:181
+IsXExtensionKeyboard = 3 # /usr/include/X11/extensions/XI.h:182
+IsXExtensionPointer = 4 # /usr/include/X11/extensions/XI.h:183
+AsyncThisDevice = 0 # /usr/include/X11/extensions/XI.h:185
+SyncThisDevice = 1 # /usr/include/X11/extensions/XI.h:186
+ReplayThisDevice = 2 # /usr/include/X11/extensions/XI.h:187
+AsyncOtherDevices = 3 # /usr/include/X11/extensions/XI.h:188
+AsyncAll = 4 # /usr/include/X11/extensions/XI.h:189
+SyncAll = 5 # /usr/include/X11/extensions/XI.h:190
+FollowKeyboard = 3 # /usr/include/X11/extensions/XI.h:192
+RevertToFollowKeyboard = 3 # /usr/include/X11/extensions/XI.h:194
+DvAccelNum = 1 # /usr/include/X11/extensions/XI.h:197
+DvAccelDenom = 2 # /usr/include/X11/extensions/XI.h:198
+DvThreshold = 4 # /usr/include/X11/extensions/XI.h:199
+DvKeyClickPercent = 1 # /usr/include/X11/extensions/XI.h:201
+DvPercent = 2 # /usr/include/X11/extensions/XI.h:202
+DvPitch = 4 # /usr/include/X11/extensions/XI.h:203
+DvDuration = 8 # /usr/include/X11/extensions/XI.h:204
+DvLed = 16 # /usr/include/X11/extensions/XI.h:205
+DvLedMode = 32 # /usr/include/X11/extensions/XI.h:206
+DvKey = 64 # /usr/include/X11/extensions/XI.h:207
+DvAutoRepeatMode = 128 # /usr/include/X11/extensions/XI.h:208
+DvString = 1 # /usr/include/X11/extensions/XI.h:210
+DvInteger = 1 # /usr/include/X11/extensions/XI.h:212
+DeviceMode = 1 # /usr/include/X11/extensions/XI.h:214
+Relative = 0 # /usr/include/X11/extensions/XI.h:215
+Absolute = 1 # /usr/include/X11/extensions/XI.h:216
+ProximityState = 2 # /usr/include/X11/extensions/XI.h:218
+InProximity = 0 # /usr/include/X11/extensions/XI.h:219
+OutOfProximity = 2 # /usr/include/X11/extensions/XI.h:220
+AddToList = 0 # /usr/include/X11/extensions/XI.h:222
+DeleteFromList = 1 # /usr/include/X11/extensions/XI.h:223
+KeyClass = 0 # /usr/include/X11/extensions/XI.h:225
+ButtonClass = 1 # /usr/include/X11/extensions/XI.h:226
+ValuatorClass = 2 # /usr/include/X11/extensions/XI.h:227
+FeedbackClass = 3 # /usr/include/X11/extensions/XI.h:228
+ProximityClass = 4 # /usr/include/X11/extensions/XI.h:229
+FocusClass = 5 # /usr/include/X11/extensions/XI.h:230
+OtherClass = 6 # /usr/include/X11/extensions/XI.h:231
+KbdFeedbackClass = 0 # /usr/include/X11/extensions/XI.h:233
+PtrFeedbackClass = 1 # /usr/include/X11/extensions/XI.h:234
+StringFeedbackClass = 2 # /usr/include/X11/extensions/XI.h:235
+IntegerFeedbackClass = 3 # /usr/include/X11/extensions/XI.h:236
+LedFeedbackClass = 4 # /usr/include/X11/extensions/XI.h:237
+BellFeedbackClass = 5 # /usr/include/X11/extensions/XI.h:238
+_devicePointerMotionHint = 0 # /usr/include/X11/extensions/XI.h:240
+_deviceButton1Motion = 1 # /usr/include/X11/extensions/XI.h:241
+_deviceButton2Motion = 2 # /usr/include/X11/extensions/XI.h:242
+_deviceButton3Motion = 3 # /usr/include/X11/extensions/XI.h:243
+_deviceButton4Motion = 4 # /usr/include/X11/extensions/XI.h:244
+_deviceButton5Motion = 5 # /usr/include/X11/extensions/XI.h:245
+_deviceButtonMotion = 6 # /usr/include/X11/extensions/XI.h:246
+_deviceButtonGrab = 7 # /usr/include/X11/extensions/XI.h:247
+_deviceOwnerGrabButton = 8 # /usr/include/X11/extensions/XI.h:248
+_noExtensionEvent = 9 # /usr/include/X11/extensions/XI.h:249
+_devicePresence = 0 # /usr/include/X11/extensions/XI.h:251
+DeviceAdded = 0 # /usr/include/X11/extensions/XI.h:253
+DeviceRemoved = 1 # /usr/include/X11/extensions/XI.h:254
+DeviceEnabled = 2 # /usr/include/X11/extensions/XI.h:255
+DeviceDisabled = 3 # /usr/include/X11/extensions/XI.h:256
+DeviceUnrecoverable = 4 # /usr/include/X11/extensions/XI.h:257
+XI_BadDevice = 0 # /usr/include/X11/extensions/XI.h:259
+XI_BadEvent = 1 # /usr/include/X11/extensions/XI.h:260
+XI_BadMode = 2 # /usr/include/X11/extensions/XI.h:261
+XI_DeviceBusy = 3 # /usr/include/X11/extensions/XI.h:262
+XI_BadClass = 4 # /usr/include/X11/extensions/XI.h:263
+XEventClass = c_ulong # /usr/include/X11/extensions/XI.h:272
+class struct_anon_93(Structure):
+ __slots__ = [
+ 'present',
+ 'major_version',
+ 'minor_version',
+ ]
+struct_anon_93._fields_ = [
+ ('present', c_int),
+ ('major_version', c_short),
+ ('minor_version', c_short),
+]
+
+XExtensionVersion = struct_anon_93 # /usr/include/X11/extensions/XI.h:285
+_deviceKeyPress = 0 # /usr/include/X11/extensions/XInput.h:4902
+_deviceKeyRelease = 1 # /usr/include/X11/extensions/XInput.h:4903
+_deviceButtonPress = 0 # /usr/include/X11/extensions/XInput.h:4905
+_deviceButtonRelease = 1 # /usr/include/X11/extensions/XInput.h:4906
+_deviceMotionNotify = 0 # /usr/include/X11/extensions/XInput.h:4908
+_deviceFocusIn = 0 # /usr/include/X11/extensions/XInput.h:4910
+_deviceFocusOut = 1 # /usr/include/X11/extensions/XInput.h:4911
+_proximityIn = 0 # /usr/include/X11/extensions/XInput.h:4913
+_proximityOut = 1 # /usr/include/X11/extensions/XInput.h:4914
+_deviceStateNotify = 0 # /usr/include/X11/extensions/XInput.h:4916
+_deviceMappingNotify = 1 # /usr/include/X11/extensions/XInput.h:4917
+_changeDeviceNotify = 2 # /usr/include/X11/extensions/XInput.h:4918
+class struct_anon_94(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'deviceid',
+ 'root',
+ 'subwindow',
+ 'time',
+ 'x',
+ 'y',
+ 'x_root',
+ 'y_root',
+ 'state',
+ 'keycode',
+ 'same_screen',
+ 'device_state',
+ 'axes_count',
+ 'first_axis',
+ 'axis_data',
+ ]
+Display = pyglet.libs.x11.xlib.Display
+Window = pyglet.libs.x11.xlib.Window
+XID = pyglet.libs.x11.xlib.XID
+Time = pyglet.libs.x11.xlib.Time
+struct_anon_94._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('deviceid', XID),
+ ('root', Window),
+ ('subwindow', Window),
+ ('time', Time),
+ ('x', c_int),
+ ('y', c_int),
+ ('x_root', c_int),
+ ('y_root', c_int),
+ ('state', c_uint),
+ ('keycode', c_uint),
+ ('same_screen', c_int),
+ ('device_state', c_uint),
+ ('axes_count', c_ubyte),
+ ('first_axis', c_ubyte),
+ ('axis_data', c_int * 6),
+]
+
+XDeviceKeyEvent = struct_anon_94 # /usr/include/X11/extensions/XInput.h:5043
+XDeviceKeyPressedEvent = XDeviceKeyEvent # /usr/include/X11/extensions/XInput.h:5045
+XDeviceKeyReleasedEvent = XDeviceKeyEvent # /usr/include/X11/extensions/XInput.h:5046
+class struct_anon_95(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'deviceid',
+ 'root',
+ 'subwindow',
+ 'time',
+ 'x',
+ 'y',
+ 'x_root',
+ 'y_root',
+ 'state',
+ 'button',
+ 'same_screen',
+ 'device_state',
+ 'axes_count',
+ 'first_axis',
+ 'axis_data',
+ ]
+struct_anon_95._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('deviceid', XID),
+ ('root', Window),
+ ('subwindow', Window),
+ ('time', Time),
+ ('x', c_int),
+ ('y', c_int),
+ ('x_root', c_int),
+ ('y_root', c_int),
+ ('state', c_uint),
+ ('button', c_uint),
+ ('same_screen', c_int),
+ ('device_state', c_uint),
+ ('axes_count', c_ubyte),
+ ('first_axis', c_ubyte),
+ ('axis_data', c_int * 6),
+]
+
+XDeviceButtonEvent = struct_anon_95 # /usr/include/X11/extensions/XInput.h:5075
+XDeviceButtonPressedEvent = XDeviceButtonEvent # /usr/include/X11/extensions/XInput.h:5077
+XDeviceButtonReleasedEvent = XDeviceButtonEvent # /usr/include/X11/extensions/XInput.h:5078
+class struct_anon_96(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'deviceid',
+ 'root',
+ 'subwindow',
+ 'time',
+ 'x',
+ 'y',
+ 'x_root',
+ 'y_root',
+ 'state',
+ 'is_hint',
+ 'same_screen',
+ 'device_state',
+ 'axes_count',
+ 'first_axis',
+ 'axis_data',
+ ]
+struct_anon_96._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('deviceid', XID),
+ ('root', Window),
+ ('subwindow', Window),
+ ('time', Time),
+ ('x', c_int),
+ ('y', c_int),
+ ('x_root', c_int),
+ ('y_root', c_int),
+ ('state', c_uint),
+ ('is_hint', c_char),
+ ('same_screen', c_int),
+ ('device_state', c_uint),
+ ('axes_count', c_ubyte),
+ ('first_axis', c_ubyte),
+ ('axis_data', c_int * 6),
+]
+
+XDeviceMotionEvent = struct_anon_96 # /usr/include/X11/extensions/XInput.h:5108
+class struct_anon_97(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'deviceid',
+ 'mode',
+ 'detail',
+ 'time',
+ ]
+struct_anon_97._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('deviceid', XID),
+ ('mode', c_int),
+ ('detail', c_int),
+ ('time', Time),
+]
+
+XDeviceFocusChangeEvent = struct_anon_97 # /usr/include/X11/extensions/XInput.h:5133
+XDeviceFocusInEvent = XDeviceFocusChangeEvent # /usr/include/X11/extensions/XInput.h:5135
+XDeviceFocusOutEvent = XDeviceFocusChangeEvent # /usr/include/X11/extensions/XInput.h:5136
+class struct_anon_98(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'deviceid',
+ 'root',
+ 'subwindow',
+ 'time',
+ 'x',
+ 'y',
+ 'x_root',
+ 'y_root',
+ 'state',
+ 'same_screen',
+ 'device_state',
+ 'axes_count',
+ 'first_axis',
+ 'axis_data',
+ ]
+struct_anon_98._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('deviceid', XID),
+ ('root', Window),
+ ('subwindow', Window),
+ ('time', Time),
+ ('x', c_int),
+ ('y', c_int),
+ ('x_root', c_int),
+ ('y_root', c_int),
+ ('state', c_uint),
+ ('same_screen', c_int),
+ ('device_state', c_uint),
+ ('axes_count', c_ubyte),
+ ('first_axis', c_ubyte),
+ ('axis_data', c_int * 6),
+]
+
+XProximityNotifyEvent = struct_anon_98 # /usr/include/X11/extensions/XInput.h:5164
+XProximityInEvent = XProximityNotifyEvent # /usr/include/X11/extensions/XInput.h:5165
+XProximityOutEvent = XProximityNotifyEvent # /usr/include/X11/extensions/XInput.h:5166
+class struct_anon_99(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ ]
+struct_anon_99._fields_ = [
+ ('class', c_ubyte),
+ ('length', c_ubyte),
+]
+
+XInputClass = struct_anon_99 # /usr/include/X11/extensions/XInput.h:5183
+class struct_anon_100(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'deviceid',
+ 'time',
+ 'num_classes',
+ 'data',
+ ]
+struct_anon_100._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('deviceid', XID),
+ ('time', Time),
+ ('num_classes', c_int),
+ ('data', c_char * 64),
+]
+
+XDeviceStateNotifyEvent = struct_anon_100 # /usr/include/X11/extensions/XInput.h:5195
+class struct_anon_101(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'num_valuators',
+ 'mode',
+ 'valuators',
+ ]
+struct_anon_101._fields_ = [
+ ('class', c_ubyte),
+ ('length', c_ubyte),
+ ('num_valuators', c_ubyte),
+ ('mode', c_ubyte),
+ ('valuators', c_int * 6),
+]
+
+XValuatorStatus = struct_anon_101 # /usr/include/X11/extensions/XInput.h:5207
+class struct_anon_102(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'num_keys',
+ 'keys',
+ ]
+struct_anon_102._fields_ = [
+ ('class', c_ubyte),
+ ('length', c_ubyte),
+ ('num_keys', c_short),
+ ('keys', c_char * 32),
+]
+
+XKeyStatus = struct_anon_102 # /usr/include/X11/extensions/XInput.h:5218
+class struct_anon_103(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'num_buttons',
+ 'buttons',
+ ]
+struct_anon_103._fields_ = [
+ ('class', c_ubyte),
+ ('length', c_ubyte),
+ ('num_buttons', c_short),
+ ('buttons', c_char * 32),
+]
+
+XButtonStatus = struct_anon_103 # /usr/include/X11/extensions/XInput.h:5229
+class struct_anon_104(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'deviceid',
+ 'time',
+ 'request',
+ 'first_keycode',
+ 'count',
+ ]
+struct_anon_104._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('deviceid', XID),
+ ('time', Time),
+ ('request', c_int),
+ ('first_keycode', c_int),
+ ('count', c_int),
+]
+
+XDeviceMappingEvent = struct_anon_104 # /usr/include/X11/extensions/XInput.h:5250
+class struct_anon_105(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'deviceid',
+ 'time',
+ 'request',
+ ]
+struct_anon_105._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('deviceid', XID),
+ ('time', Time),
+ ('request', c_int),
+]
+
+XChangeDeviceNotifyEvent = struct_anon_105 # /usr/include/X11/extensions/XInput.h:5268
+class struct_anon_106(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'time',
+ 'devchange',
+ 'deviceid',
+ 'control',
+ ]
+struct_anon_106._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('time', Time),
+ ('devchange', c_int),
+ ('deviceid', XID),
+ ('control', XID),
+]
+
+XDevicePresenceNotifyEvent = struct_anon_106 # /usr/include/X11/extensions/XInput.h:5293
+class struct_anon_107(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ ]
+struct_anon_107._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+]
+
+XFeedbackState = struct_anon_107 # /usr/include/X11/extensions/XInput.h:5311
+class struct_anon_108(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'click',
+ 'percent',
+ 'pitch',
+ 'duration',
+ 'led_mask',
+ 'global_auto_repeat',
+ 'auto_repeats',
+ ]
+struct_anon_108._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('click', c_int),
+ ('percent', c_int),
+ ('pitch', c_int),
+ ('duration', c_int),
+ ('led_mask', c_int),
+ ('global_auto_repeat', c_int),
+ ('auto_repeats', c_char * 32),
+]
+
+XKbdFeedbackState = struct_anon_108 # /usr/include/X11/extensions/XInput.h:5328
+class struct_anon_109(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'accelNum',
+ 'accelDenom',
+ 'threshold',
+ ]
+struct_anon_109._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('accelNum', c_int),
+ ('accelDenom', c_int),
+ ('threshold', c_int),
+]
+
+XPtrFeedbackState = struct_anon_109 # /usr/include/X11/extensions/XInput.h:5341
+class struct_anon_110(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'resolution',
+ 'minVal',
+ 'maxVal',
+ ]
+struct_anon_110._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('resolution', c_int),
+ ('minVal', c_int),
+ ('maxVal', c_int),
+]
+
+XIntegerFeedbackState = struct_anon_110 # /usr/include/X11/extensions/XInput.h:5354
+class struct_anon_111(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'max_symbols',
+ 'num_syms_supported',
+ 'syms_supported',
+ ]
+KeySym = pyglet.libs.x11.xlib.KeySym
+struct_anon_111._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('max_symbols', c_int),
+ ('num_syms_supported', c_int),
+ ('syms_supported', POINTER(KeySym)),
+]
+
+XStringFeedbackState = struct_anon_111 # /usr/include/X11/extensions/XInput.h:5367
+class struct_anon_112(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'percent',
+ 'pitch',
+ 'duration',
+ ]
+struct_anon_112._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('percent', c_int),
+ ('pitch', c_int),
+ ('duration', c_int),
+]
+
+XBellFeedbackState = struct_anon_112 # /usr/include/X11/extensions/XInput.h:5380
+class struct_anon_113(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'led_values',
+ 'led_mask',
+ ]
+struct_anon_113._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('led_values', c_int),
+ ('led_mask', c_int),
+]
+
+XLedFeedbackState = struct_anon_113 # /usr/include/X11/extensions/XInput.h:5392
+class struct_anon_114(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ ]
+struct_anon_114._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+]
+
+XFeedbackControl = struct_anon_114 # /usr/include/X11/extensions/XInput.h:5402
+class struct_anon_115(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'accelNum',
+ 'accelDenom',
+ 'threshold',
+ ]
+struct_anon_115._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('accelNum', c_int),
+ ('accelDenom', c_int),
+ ('threshold', c_int),
+]
+
+XPtrFeedbackControl = struct_anon_115 # /usr/include/X11/extensions/XInput.h:5415
+class struct_anon_116(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'click',
+ 'percent',
+ 'pitch',
+ 'duration',
+ 'led_mask',
+ 'led_value',
+ 'key',
+ 'auto_repeat_mode',
+ ]
+struct_anon_116._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('click', c_int),
+ ('percent', c_int),
+ ('pitch', c_int),
+ ('duration', c_int),
+ ('led_mask', c_int),
+ ('led_value', c_int),
+ ('key', c_int),
+ ('auto_repeat_mode', c_int),
+]
+
+XKbdFeedbackControl = struct_anon_116 # /usr/include/X11/extensions/XInput.h:5433
+class struct_anon_117(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'num_keysyms',
+ 'syms_to_display',
+ ]
+struct_anon_117._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('num_keysyms', c_int),
+ ('syms_to_display', POINTER(KeySym)),
+]
+
+XStringFeedbackControl = struct_anon_117 # /usr/include/X11/extensions/XInput.h:5445
+class struct_anon_118(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'int_to_display',
+ ]
+struct_anon_118._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('int_to_display', c_int),
+]
+
+XIntegerFeedbackControl = struct_anon_118 # /usr/include/X11/extensions/XInput.h:5456
+class struct_anon_119(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'percent',
+ 'pitch',
+ 'duration',
+ ]
+struct_anon_119._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('percent', c_int),
+ ('pitch', c_int),
+ ('duration', c_int),
+]
+
+XBellFeedbackControl = struct_anon_119 # /usr/include/X11/extensions/XInput.h:5469
+class struct_anon_120(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'led_mask',
+ 'led_values',
+ ]
+struct_anon_120._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('led_mask', c_int),
+ ('led_values', c_int),
+]
+
+XLedFeedbackControl = struct_anon_120 # /usr/include/X11/extensions/XInput.h:5481
+class struct_anon_121(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ ]
+struct_anon_121._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+]
+
+XDeviceControl = struct_anon_121 # /usr/include/X11/extensions/XInput.h:5492
+class struct_anon_122(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'first_valuator',
+ 'num_valuators',
+ 'resolutions',
+ ]
+struct_anon_122._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('first_valuator', c_int),
+ ('num_valuators', c_int),
+ ('resolutions', POINTER(c_int)),
+]
+
+XDeviceResolutionControl = struct_anon_122 # /usr/include/X11/extensions/XInput.h:5500
+class struct_anon_123(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'num_valuators',
+ 'resolutions',
+ 'min_resolutions',
+ 'max_resolutions',
+ ]
+struct_anon_123._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('num_valuators', c_int),
+ ('resolutions', POINTER(c_int)),
+ ('min_resolutions', POINTER(c_int)),
+ ('max_resolutions', POINTER(c_int)),
+]
+
+XDeviceResolutionState = struct_anon_123 # /usr/include/X11/extensions/XInput.h:5509
+class struct_anon_124(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'min_x',
+ 'max_x',
+ 'min_y',
+ 'max_y',
+ 'flip_x',
+ 'flip_y',
+ 'rotation',
+ 'button_threshold',
+ ]
+struct_anon_124._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('min_x', c_int),
+ ('max_x', c_int),
+ ('min_y', c_int),
+ ('max_y', c_int),
+ ('flip_x', c_int),
+ ('flip_y', c_int),
+ ('rotation', c_int),
+ ('button_threshold', c_int),
+]
+
+XDeviceAbsCalibControl = struct_anon_124 # /usr/include/X11/extensions/XInput.h:5522
+class struct_anon_125(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'min_x',
+ 'max_x',
+ 'min_y',
+ 'max_y',
+ 'flip_x',
+ 'flip_y',
+ 'rotation',
+ 'button_threshold',
+ ]
+struct_anon_125._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('min_x', c_int),
+ ('max_x', c_int),
+ ('min_y', c_int),
+ ('max_y', c_int),
+ ('flip_x', c_int),
+ ('flip_y', c_int),
+ ('rotation', c_int),
+ ('button_threshold', c_int),
+]
+
+XDeviceAbsCalibState = struct_anon_125 # /usr/include/X11/extensions/XInput.h:5522
+class struct_anon_126(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'offset_x',
+ 'offset_y',
+ 'width',
+ 'height',
+ 'screen',
+ 'following',
+ ]
+struct_anon_126._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('offset_x', c_int),
+ ('offset_y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('screen', c_int),
+ ('following', XID),
+]
+
+XDeviceAbsAreaControl = struct_anon_126 # /usr/include/X11/extensions/XInput.h:5533
+class struct_anon_127(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'offset_x',
+ 'offset_y',
+ 'width',
+ 'height',
+ 'screen',
+ 'following',
+ ]
+struct_anon_127._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('offset_x', c_int),
+ ('offset_y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('screen', c_int),
+ ('following', XID),
+]
+
+XDeviceAbsAreaState = struct_anon_127 # /usr/include/X11/extensions/XInput.h:5533
+class struct_anon_128(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'status',
+ ]
+struct_anon_128._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('status', c_int),
+]
+
+XDeviceCoreControl = struct_anon_128 # /usr/include/X11/extensions/XInput.h:5539
+class struct_anon_129(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'status',
+ 'iscore',
+ ]
+struct_anon_129._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('status', c_int),
+ ('iscore', c_int),
+]
+
+XDeviceCoreState = struct_anon_129 # /usr/include/X11/extensions/XInput.h:5546
+class struct_anon_130(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'enable',
+ ]
+struct_anon_130._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('enable', c_int),
+]
+
+XDeviceEnableControl = struct_anon_130 # /usr/include/X11/extensions/XInput.h:5552
+class struct_anon_131(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'enable',
+ ]
+struct_anon_131._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('enable', c_int),
+]
+
+XDeviceEnableState = struct_anon_131 # /usr/include/X11/extensions/XInput.h:5552
+class struct__XAnyClassinfo(Structure):
+ __slots__ = [
+ ]
+struct__XAnyClassinfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XAnyClassinfo(Structure):
+ __slots__ = [
+ ]
+struct__XAnyClassinfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XAnyClassPtr = POINTER(struct__XAnyClassinfo) # /usr/include/X11/extensions/XInput.h:5564
+class struct__XAnyClassinfo(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ ]
+struct__XAnyClassinfo._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+]
+
+XAnyClassInfo = struct__XAnyClassinfo # /usr/include/X11/extensions/XInput.h:5573
+class struct__XDeviceInfo(Structure):
+ __slots__ = [
+ ]
+struct__XDeviceInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XDeviceInfo(Structure):
+ __slots__ = [
+ ]
+struct__XDeviceInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XDeviceInfoPtr = POINTER(struct__XDeviceInfo) # /usr/include/X11/extensions/XInput.h:5575
+class struct__XDeviceInfo(Structure):
+ __slots__ = [
+ 'id',
+ 'type',
+ 'name',
+ 'num_classes',
+ 'use',
+ 'inputclassinfo',
+ ]
+Atom = pyglet.libs.x11.xlib.Atom
+struct__XDeviceInfo._fields_ = [
+ ('id', XID),
+ ('type', Atom),
+ ('name', c_char_p),
+ ('num_classes', c_int),
+ ('use', c_int),
+ ('inputclassinfo', XAnyClassPtr),
+]
+
+XDeviceInfo = struct__XDeviceInfo # /usr/include/X11/extensions/XInput.h:5585
+class struct__XKeyInfo(Structure):
+ __slots__ = [
+ ]
+struct__XKeyInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XKeyInfo(Structure):
+ __slots__ = [
+ ]
+struct__XKeyInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XKeyInfoPtr = POINTER(struct__XKeyInfo) # /usr/include/X11/extensions/XInput.h:5587
+class struct__XKeyInfo(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'min_keycode',
+ 'max_keycode',
+ 'num_keys',
+ ]
+struct__XKeyInfo._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('min_keycode', c_ushort),
+ ('max_keycode', c_ushort),
+ ('num_keys', c_ushort),
+]
+
+XKeyInfo = struct__XKeyInfo # /usr/include/X11/extensions/XInput.h:5600
+class struct__XButtonInfo(Structure):
+ __slots__ = [
+ ]
+struct__XButtonInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XButtonInfo(Structure):
+ __slots__ = [
+ ]
+struct__XButtonInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XButtonInfoPtr = POINTER(struct__XButtonInfo) # /usr/include/X11/extensions/XInput.h:5602
+class struct__XButtonInfo(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'num_buttons',
+ ]
+struct__XButtonInfo._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('num_buttons', c_short),
+]
+
+XButtonInfo = struct__XButtonInfo # /usr/include/X11/extensions/XInput.h:5612
+class struct__XAxisInfo(Structure):
+ __slots__ = [
+ ]
+struct__XAxisInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XAxisInfo(Structure):
+ __slots__ = [
+ ]
+struct__XAxisInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XAxisInfoPtr = POINTER(struct__XAxisInfo) # /usr/include/X11/extensions/XInput.h:5614
+class struct__XAxisInfo(Structure):
+ __slots__ = [
+ 'resolution',
+ 'min_value',
+ 'max_value',
+ ]
+struct__XAxisInfo._fields_ = [
+ ('resolution', c_int),
+ ('min_value', c_int),
+ ('max_value', c_int),
+]
+
+XAxisInfo = struct__XAxisInfo # /usr/include/X11/extensions/XInput.h:5620
+class struct__XValuatorInfo(Structure):
+ __slots__ = [
+ ]
+struct__XValuatorInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XValuatorInfo(Structure):
+ __slots__ = [
+ ]
+struct__XValuatorInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XValuatorInfoPtr = POINTER(struct__XValuatorInfo) # /usr/include/X11/extensions/XInput.h:5622
+class struct__XValuatorInfo(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'num_axes',
+ 'mode',
+ 'motion_buffer',
+ 'axes',
+ ]
+struct__XValuatorInfo._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('num_axes', c_ubyte),
+ ('mode', c_ubyte),
+ ('motion_buffer', c_ulong),
+ ('axes', XAxisInfoPtr),
+]
+
+XValuatorInfo = struct__XValuatorInfo # /usr/include/X11/extensions/XInput.h:5636
+class struct_anon_132(Structure):
+ __slots__ = [
+ 'input_class',
+ 'event_type_base',
+ ]
+struct_anon_132._fields_ = [
+ ('input_class', c_ubyte),
+ ('event_type_base', c_ubyte),
+]
+
+XInputClassInfo = struct_anon_132 # /usr/include/X11/extensions/XInput.h:5653
+class struct_anon_133(Structure):
+ __slots__ = [
+ 'device_id',
+ 'num_classes',
+ 'classes',
+ ]
+struct_anon_133._fields_ = [
+ ('device_id', XID),
+ ('num_classes', c_int),
+ ('classes', POINTER(XInputClassInfo)),
+]
+
+XDevice = struct_anon_133 # /usr/include/X11/extensions/XInput.h:5659
+class struct_anon_134(Structure):
+ __slots__ = [
+ 'event_type',
+ 'device',
+ ]
+struct_anon_134._fields_ = [
+ ('event_type', XEventClass),
+ ('device', XID),
+]
+
+XEventList = struct_anon_134 # /usr/include/X11/extensions/XInput.h:5672
+class struct_anon_135(Structure):
+ __slots__ = [
+ 'time',
+ 'data',
+ ]
+struct_anon_135._fields_ = [
+ ('time', Time),
+ ('data', POINTER(c_int)),
+]
+
+XDeviceTimeCoord = struct_anon_135 # /usr/include/X11/extensions/XInput.h:5685
+class struct_anon_136(Structure):
+ __slots__ = [
+ 'device_id',
+ 'num_classes',
+ 'data',
+ ]
+struct_anon_136._fields_ = [
+ ('device_id', XID),
+ ('num_classes', c_int),
+ ('data', POINTER(XInputClass)),
+]
+
+XDeviceState = struct_anon_136 # /usr/include/X11/extensions/XInput.h:5699
+class struct_anon_137(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'num_valuators',
+ 'mode',
+ 'valuators',
+ ]
+struct_anon_137._fields_ = [
+ ('class', c_ubyte),
+ ('length', c_ubyte),
+ ('num_valuators', c_ubyte),
+ ('mode', c_ubyte),
+ ('valuators', POINTER(c_int)),
+]
+
+XValuatorState = struct_anon_137 # /usr/include/X11/extensions/XInput.h:5722
+class struct_anon_138(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'num_keys',
+ 'keys',
+ ]
+struct_anon_138._fields_ = [
+ ('class', c_ubyte),
+ ('length', c_ubyte),
+ ('num_keys', c_short),
+ ('keys', c_char * 32),
+]
+
+XKeyState = struct_anon_138 # /usr/include/X11/extensions/XInput.h:5733
+class struct_anon_139(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'num_buttons',
+ 'buttons',
+ ]
+struct_anon_139._fields_ = [
+ ('class', c_ubyte),
+ ('length', c_ubyte),
+ ('num_buttons', c_short),
+ ('buttons', c_char * 32),
+]
+
+XButtonState = struct_anon_139 # /usr/include/X11/extensions/XInput.h:5744
+# /usr/include/X11/extensions/XInput.h:5754
+XChangeKeyboardDevice = _lib.XChangeKeyboardDevice
+XChangeKeyboardDevice.restype = c_int
+XChangeKeyboardDevice.argtypes = [POINTER(Display), POINTER(XDevice)]
+
+# /usr/include/X11/extensions/XInput.h:5759
+XChangePointerDevice = _lib.XChangePointerDevice
+XChangePointerDevice.restype = c_int
+XChangePointerDevice.argtypes = [POINTER(Display), POINTER(XDevice), c_int, c_int]
+
+# /usr/include/X11/extensions/XInput.h:5766
+XGrabDevice = _lib.XGrabDevice
+XGrabDevice.restype = c_int
+XGrabDevice.argtypes = [POINTER(Display), POINTER(XDevice), Window, c_int, c_int, POINTER(XEventClass), c_int, c_int, Time]
+
+# /usr/include/X11/extensions/XInput.h:5778
+XUngrabDevice = _lib.XUngrabDevice
+XUngrabDevice.restype = c_int
+XUngrabDevice.argtypes = [POINTER(Display), POINTER(XDevice), Time]
+
+# /usr/include/X11/extensions/XInput.h:5784
+XGrabDeviceKey = _lib.XGrabDeviceKey
+XGrabDeviceKey.restype = c_int
+XGrabDeviceKey.argtypes = [POINTER(Display), POINTER(XDevice), c_uint, c_uint, POINTER(XDevice), Window, c_int, c_uint, POINTER(XEventClass), c_int, c_int]
+
+# /usr/include/X11/extensions/XInput.h:5798
+XUngrabDeviceKey = _lib.XUngrabDeviceKey
+XUngrabDeviceKey.restype = c_int
+XUngrabDeviceKey.argtypes = [POINTER(Display), POINTER(XDevice), c_uint, c_uint, POINTER(XDevice), Window]
+
+# /usr/include/X11/extensions/XInput.h:5807
+XGrabDeviceButton = _lib.XGrabDeviceButton
+XGrabDeviceButton.restype = c_int
+XGrabDeviceButton.argtypes = [POINTER(Display), POINTER(XDevice), c_uint, c_uint, POINTER(XDevice), Window, c_int, c_uint, POINTER(XEventClass), c_int, c_int]
+
+# /usr/include/X11/extensions/XInput.h:5821
+XUngrabDeviceButton = _lib.XUngrabDeviceButton
+XUngrabDeviceButton.restype = c_int
+XUngrabDeviceButton.argtypes = [POINTER(Display), POINTER(XDevice), c_uint, c_uint, POINTER(XDevice), Window]
+
+# /usr/include/X11/extensions/XInput.h:5830
+XAllowDeviceEvents = _lib.XAllowDeviceEvents
+XAllowDeviceEvents.restype = c_int
+XAllowDeviceEvents.argtypes = [POINTER(Display), POINTER(XDevice), c_int, Time]
+
+# /usr/include/X11/extensions/XInput.h:5837
+XGetDeviceFocus = _lib.XGetDeviceFocus
+XGetDeviceFocus.restype = c_int
+XGetDeviceFocus.argtypes = [POINTER(Display), POINTER(XDevice), POINTER(Window), POINTER(c_int), POINTER(Time)]
+
+# /usr/include/X11/extensions/XInput.h:5845
+XSetDeviceFocus = _lib.XSetDeviceFocus
+XSetDeviceFocus.restype = c_int
+XSetDeviceFocus.argtypes = [POINTER(Display), POINTER(XDevice), Window, c_int, Time]
+
+# /usr/include/X11/extensions/XInput.h:5853
+XGetFeedbackControl = _lib.XGetFeedbackControl
+XGetFeedbackControl.restype = POINTER(XFeedbackState)
+XGetFeedbackControl.argtypes = [POINTER(Display), POINTER(XDevice), POINTER(c_int)]
+
+# /usr/include/X11/extensions/XInput.h:5859
+XFreeFeedbackList = _lib.XFreeFeedbackList
+XFreeFeedbackList.restype = None
+XFreeFeedbackList.argtypes = [POINTER(XFeedbackState)]
+
+# /usr/include/X11/extensions/XInput.h:5863
+XChangeFeedbackControl = _lib.XChangeFeedbackControl
+XChangeFeedbackControl.restype = c_int
+XChangeFeedbackControl.argtypes = [POINTER(Display), POINTER(XDevice), c_ulong, POINTER(XFeedbackControl)]
+
+# /usr/include/X11/extensions/XInput.h:5870
+XDeviceBell = _lib.XDeviceBell
+XDeviceBell.restype = c_int
+XDeviceBell.argtypes = [POINTER(Display), POINTER(XDevice), XID, XID, c_int]
+
+KeyCode = pyglet.libs.x11.xlib.KeyCode
+# /usr/include/X11/extensions/XInput.h:5878
+XGetDeviceKeyMapping = _lib.XGetDeviceKeyMapping
+XGetDeviceKeyMapping.restype = POINTER(KeySym)
+XGetDeviceKeyMapping.argtypes = [POINTER(Display), POINTER(XDevice), KeyCode, c_int, POINTER(c_int)]
+
+# /usr/include/X11/extensions/XInput.h:5890
+XChangeDeviceKeyMapping = _lib.XChangeDeviceKeyMapping
+XChangeDeviceKeyMapping.restype = c_int
+XChangeDeviceKeyMapping.argtypes = [POINTER(Display), POINTER(XDevice), c_int, c_int, POINTER(KeySym), c_int]
+
+XModifierKeymap = pyglet.libs.x11.xlib.XModifierKeymap
+# /usr/include/X11/extensions/XInput.h:5899
+XGetDeviceModifierMapping = _lib.XGetDeviceModifierMapping
+XGetDeviceModifierMapping.restype = POINTER(XModifierKeymap)
+XGetDeviceModifierMapping.argtypes = [POINTER(Display), POINTER(XDevice)]
+
+# /usr/include/X11/extensions/XInput.h:5904
+XSetDeviceModifierMapping = _lib.XSetDeviceModifierMapping
+XSetDeviceModifierMapping.restype = c_int
+XSetDeviceModifierMapping.argtypes = [POINTER(Display), POINTER(XDevice), POINTER(XModifierKeymap)]
+
+# /usr/include/X11/extensions/XInput.h:5910
+XSetDeviceButtonMapping = _lib.XSetDeviceButtonMapping
+XSetDeviceButtonMapping.restype = c_int
+XSetDeviceButtonMapping.argtypes = [POINTER(Display), POINTER(XDevice), POINTER(c_ubyte), c_int]
+
+# /usr/include/X11/extensions/XInput.h:5917
+XGetDeviceButtonMapping = _lib.XGetDeviceButtonMapping
+XGetDeviceButtonMapping.restype = c_int
+XGetDeviceButtonMapping.argtypes = [POINTER(Display), POINTER(XDevice), POINTER(c_ubyte), c_uint]
+
+# /usr/include/X11/extensions/XInput.h:5924
+XQueryDeviceState = _lib.XQueryDeviceState
+XQueryDeviceState.restype = POINTER(XDeviceState)
+XQueryDeviceState.argtypes = [POINTER(Display), POINTER(XDevice)]
+
+# /usr/include/X11/extensions/XInput.h:5929
+XFreeDeviceState = _lib.XFreeDeviceState
+XFreeDeviceState.restype = None
+XFreeDeviceState.argtypes = [POINTER(XDeviceState)]
+
+# /usr/include/X11/extensions/XInput.h:5933
+XGetExtensionVersion = _lib.XGetExtensionVersion
+XGetExtensionVersion.restype = POINTER(XExtensionVersion)
+XGetExtensionVersion.argtypes = [POINTER(Display), c_char_p]
+
+# /usr/include/X11/extensions/XInput.h:5938
+XListInputDevices = _lib.XListInputDevices
+XListInputDevices.restype = POINTER(XDeviceInfo)
+XListInputDevices.argtypes = [POINTER(Display), POINTER(c_int)]
+
+# /usr/include/X11/extensions/XInput.h:5943
+XFreeDeviceList = _lib.XFreeDeviceList
+XFreeDeviceList.restype = None
+XFreeDeviceList.argtypes = [POINTER(XDeviceInfo)]
+
+# /usr/include/X11/extensions/XInput.h:5947
+XOpenDevice = _lib.XOpenDevice
+XOpenDevice.restype = POINTER(XDevice)
+XOpenDevice.argtypes = [POINTER(Display), XID]
+
+# /usr/include/X11/extensions/XInput.h:5952
+XCloseDevice = _lib.XCloseDevice
+XCloseDevice.restype = c_int
+XCloseDevice.argtypes = [POINTER(Display), POINTER(XDevice)]
+
+# /usr/include/X11/extensions/XInput.h:5957
+XSetDeviceMode = _lib.XSetDeviceMode
+XSetDeviceMode.restype = c_int
+XSetDeviceMode.argtypes = [POINTER(Display), POINTER(XDevice), c_int]
+
+# /usr/include/X11/extensions/XInput.h:5963
+XSetDeviceValuators = _lib.XSetDeviceValuators
+XSetDeviceValuators.restype = c_int
+XSetDeviceValuators.argtypes = [POINTER(Display), POINTER(XDevice), POINTER(c_int), c_int, c_int]
+
+# /usr/include/X11/extensions/XInput.h:5971
+XGetDeviceControl = _lib.XGetDeviceControl
+XGetDeviceControl.restype = POINTER(XDeviceControl)
+XGetDeviceControl.argtypes = [POINTER(Display), POINTER(XDevice), c_int]
+
+# /usr/include/X11/extensions/XInput.h:5977
+XChangeDeviceControl = _lib.XChangeDeviceControl
+XChangeDeviceControl.restype = c_int
+XChangeDeviceControl.argtypes = [POINTER(Display), POINTER(XDevice), c_int, POINTER(XDeviceControl)]
+
+# /usr/include/X11/extensions/XInput.h:5984
+XSelectExtensionEvent = _lib.XSelectExtensionEvent
+XSelectExtensionEvent.restype = c_int
+XSelectExtensionEvent.argtypes = [POINTER(Display), Window, POINTER(XEventClass), c_int]
+
+# /usr/include/X11/extensions/XInput.h:5991
+XGetSelectedExtensionEvents = _lib.XGetSelectedExtensionEvents
+XGetSelectedExtensionEvents.restype = c_int
+XGetSelectedExtensionEvents.argtypes = [POINTER(Display), Window, POINTER(c_int), POINTER(POINTER(XEventClass)), POINTER(c_int), POINTER(POINTER(XEventClass))]
+
+# /usr/include/X11/extensions/XInput.h:6000
+XChangeDeviceDontPropagateList = _lib.XChangeDeviceDontPropagateList
+XChangeDeviceDontPropagateList.restype = c_int
+XChangeDeviceDontPropagateList.argtypes = [POINTER(Display), Window, c_int, POINTER(XEventClass), c_int]
+
+# /usr/include/X11/extensions/XInput.h:6008
+XGetDeviceDontPropagateList = _lib.XGetDeviceDontPropagateList
+XGetDeviceDontPropagateList.restype = POINTER(XEventClass)
+XGetDeviceDontPropagateList.argtypes = [POINTER(Display), Window, POINTER(c_int)]
+
+XEvent = pyglet.libs.x11.xlib.XEvent
+# /usr/include/X11/extensions/XInput.h:6014
+XSendExtensionEvent = _lib.XSendExtensionEvent
+XSendExtensionEvent.restype = c_int
+XSendExtensionEvent.argtypes = [POINTER(Display), POINTER(XDevice), Window, c_int, c_int, POINTER(XEventClass), POINTER(XEvent)]
+
+# /usr/include/X11/extensions/XInput.h:6024
+XGetDeviceMotionEvents = _lib.XGetDeviceMotionEvents
+XGetDeviceMotionEvents.restype = POINTER(XDeviceTimeCoord)
+XGetDeviceMotionEvents.argtypes = [POINTER(Display), POINTER(XDevice), Time, Time, POINTER(c_int), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/extensions/XInput.h:6034
+XFreeDeviceMotionEvents = _lib.XFreeDeviceMotionEvents
+XFreeDeviceMotionEvents.restype = None
+XFreeDeviceMotionEvents.argtypes = [POINTER(XDeviceTimeCoord)]
+
+# /usr/include/X11/extensions/XInput.h:6038
+XFreeDeviceControl = _lib.XFreeDeviceControl
+XFreeDeviceControl.restype = None
+XFreeDeviceControl.argtypes = [POINTER(XDeviceControl)]
+
+
+__all__ = ['sz_xGetExtensionVersionReq', 'sz_xGetExtensionVersionReply',
+'sz_xListInputDevicesReq', 'sz_xListInputDevicesReply', 'sz_xOpenDeviceReq',
+'sz_xOpenDeviceReply', 'sz_xCloseDeviceReq', 'sz_xSetDeviceModeReq',
+'sz_xSetDeviceModeReply', 'sz_xSelectExtensionEventReq',
+'sz_xGetSelectedExtensionEventsReq', 'sz_xGetSelectedExtensionEventsReply',
+'sz_xChangeDeviceDontPropagateListReq', 'sz_xGetDeviceDontPropagateListReq',
+'sz_xGetDeviceDontPropagateListReply', 'sz_xGetDeviceMotionEventsReq',
+'sz_xGetDeviceMotionEventsReply', 'sz_xChangeKeyboardDeviceReq',
+'sz_xChangeKeyboardDeviceReply', 'sz_xChangePointerDeviceReq',
+'sz_xChangePointerDeviceReply', 'sz_xGrabDeviceReq', 'sz_xGrabDeviceReply',
+'sz_xUngrabDeviceReq', 'sz_xGrabDeviceKeyReq', 'sz_xGrabDeviceKeyReply',
+'sz_xUngrabDeviceKeyReq', 'sz_xGrabDeviceButtonReq',
+'sz_xGrabDeviceButtonReply', 'sz_xUngrabDeviceButtonReq',
+'sz_xAllowDeviceEventsReq', 'sz_xGetDeviceFocusReq',
+'sz_xGetDeviceFocusReply', 'sz_xSetDeviceFocusReq',
+'sz_xGetFeedbackControlReq', 'sz_xGetFeedbackControlReply',
+'sz_xChangeFeedbackControlReq', 'sz_xGetDeviceKeyMappingReq',
+'sz_xGetDeviceKeyMappingReply', 'sz_xChangeDeviceKeyMappingReq',
+'sz_xGetDeviceModifierMappingReq', 'sz_xSetDeviceModifierMappingReq',
+'sz_xSetDeviceModifierMappingReply', 'sz_xGetDeviceButtonMappingReq',
+'sz_xGetDeviceButtonMappingReply', 'sz_xSetDeviceButtonMappingReq',
+'sz_xSetDeviceButtonMappingReply', 'sz_xQueryDeviceStateReq',
+'sz_xQueryDeviceStateReply', 'sz_xSendExtensionEventReq', 'sz_xDeviceBellReq',
+'sz_xSetDeviceValuatorsReq', 'sz_xSetDeviceValuatorsReply',
+'sz_xGetDeviceControlReq', 'sz_xGetDeviceControlReply',
+'sz_xChangeDeviceControlReq', 'sz_xChangeDeviceControlReply', 'Dont_Check',
+'XInput_Initial_Release', 'XInput_Add_XDeviceBell',
+'XInput_Add_XSetDeviceValuators', 'XInput_Add_XChangeDeviceControl',
+'XInput_Add_DevicePresenceNotify', 'XI_Absent', 'XI_Present',
+'XI_Initial_Release_Major', 'XI_Initial_Release_Minor',
+'XI_Add_XDeviceBell_Major', 'XI_Add_XDeviceBell_Minor',
+'XI_Add_XSetDeviceValuators_Major', 'XI_Add_XSetDeviceValuators_Minor',
+'XI_Add_XChangeDeviceControl_Major', 'XI_Add_XChangeDeviceControl_Minor',
+'XI_Add_DevicePresenceNotify_Major', 'XI_Add_DevicePresenceNotify_Minor',
+'DEVICE_RESOLUTION', 'DEVICE_ABS_CALIB', 'DEVICE_CORE', 'DEVICE_ENABLE',
+'DEVICE_ABS_AREA', 'NoSuchExtension', 'COUNT', 'CREATE', 'NewPointer',
+'NewKeyboard', 'XPOINTER', 'XKEYBOARD', 'UseXKeyboard', 'IsXPointer',
+'IsXKeyboard', 'IsXExtensionDevice', 'IsXExtensionKeyboard',
+'IsXExtensionPointer', 'AsyncThisDevice', 'SyncThisDevice',
+'ReplayThisDevice', 'AsyncOtherDevices', 'AsyncAll', 'SyncAll',
+'FollowKeyboard', 'RevertToFollowKeyboard', 'DvAccelNum', 'DvAccelDenom',
+'DvThreshold', 'DvKeyClickPercent', 'DvPercent', 'DvPitch', 'DvDuration',
+'DvLed', 'DvLedMode', 'DvKey', 'DvAutoRepeatMode', 'DvString', 'DvInteger',
+'DeviceMode', 'Relative', 'Absolute', 'ProximityState', 'InProximity',
+'OutOfProximity', 'AddToList', 'DeleteFromList', 'KeyClass', 'ButtonClass',
+'ValuatorClass', 'FeedbackClass', 'ProximityClass', 'FocusClass',
+'OtherClass', 'KbdFeedbackClass', 'PtrFeedbackClass', 'StringFeedbackClass',
+'IntegerFeedbackClass', 'LedFeedbackClass', 'BellFeedbackClass',
+'_devicePointerMotionHint', '_deviceButton1Motion', '_deviceButton2Motion',
+'_deviceButton3Motion', '_deviceButton4Motion', '_deviceButton5Motion',
+'_deviceButtonMotion', '_deviceButtonGrab', '_deviceOwnerGrabButton',
+'_noExtensionEvent', '_devicePresence', 'DeviceAdded', 'DeviceRemoved',
+'DeviceEnabled', 'DeviceDisabled', 'DeviceUnrecoverable', 'XI_BadDevice',
+'XI_BadEvent', 'XI_BadMode', 'XI_DeviceBusy', 'XI_BadClass', 'XEventClass',
+'XExtensionVersion', '_deviceKeyPress', '_deviceKeyRelease',
+'_deviceButtonPress', '_deviceButtonRelease', '_deviceMotionNotify',
+'_deviceFocusIn', '_deviceFocusOut', '_proximityIn', '_proximityOut',
+'_deviceStateNotify', '_deviceMappingNotify', '_changeDeviceNotify',
+'XDeviceKeyEvent', 'XDeviceKeyPressedEvent', 'XDeviceKeyReleasedEvent',
+'XDeviceButtonEvent', 'XDeviceButtonPressedEvent',
+'XDeviceButtonReleasedEvent', 'XDeviceMotionEvent', 'XDeviceFocusChangeEvent',
+'XDeviceFocusInEvent', 'XDeviceFocusOutEvent', 'XProximityNotifyEvent',
+'XProximityInEvent', 'XProximityOutEvent', 'XInputClass',
+'XDeviceStateNotifyEvent', 'XValuatorStatus', 'XKeyStatus', 'XButtonStatus',
+'XDeviceMappingEvent', 'XChangeDeviceNotifyEvent',
+'XDevicePresenceNotifyEvent', 'XFeedbackState', 'XKbdFeedbackState',
+'XPtrFeedbackState', 'XIntegerFeedbackState', 'XStringFeedbackState',
+'XBellFeedbackState', 'XLedFeedbackState', 'XFeedbackControl',
+'XPtrFeedbackControl', 'XKbdFeedbackControl', 'XStringFeedbackControl',
+'XIntegerFeedbackControl', 'XBellFeedbackControl', 'XLedFeedbackControl',
+'XDeviceControl', 'XDeviceResolutionControl', 'XDeviceResolutionState',
+'XDeviceAbsCalibControl', 'XDeviceAbsCalibState', 'XDeviceAbsAreaControl',
+'XDeviceAbsAreaState', 'XDeviceCoreControl', 'XDeviceCoreState',
+'XDeviceEnableControl', 'XDeviceEnableState', 'XAnyClassPtr', 'XAnyClassInfo',
+'XDeviceInfoPtr', 'XDeviceInfo', 'XKeyInfoPtr', 'XKeyInfo', 'XButtonInfoPtr',
+'XButtonInfo', 'XAxisInfoPtr', 'XAxisInfo', 'XValuatorInfoPtr',
+'XValuatorInfo', 'XInputClassInfo', 'XDevice', 'XEventList',
+'XDeviceTimeCoord', 'XDeviceState', 'XValuatorState', 'XKeyState',
+'XButtonState', 'XChangeKeyboardDevice', 'XChangePointerDevice',
+'XGrabDevice', 'XUngrabDevice', 'XGrabDeviceKey', 'XUngrabDeviceKey',
+'XGrabDeviceButton', 'XUngrabDeviceButton', 'XAllowDeviceEvents',
+'XGetDeviceFocus', 'XSetDeviceFocus', 'XGetFeedbackControl',
+'XFreeFeedbackList', 'XChangeFeedbackControl', 'XDeviceBell',
+'XGetDeviceKeyMapping', 'XChangeDeviceKeyMapping',
+'XGetDeviceModifierMapping', 'XSetDeviceModifierMapping',
+'XSetDeviceButtonMapping', 'XGetDeviceButtonMapping', 'XQueryDeviceState',
+'XFreeDeviceState', 'XGetExtensionVersion', 'XListInputDevices',
+'XFreeDeviceList', 'XOpenDevice', 'XCloseDevice', 'XSetDeviceMode',
+'XSetDeviceValuators', 'XGetDeviceControl', 'XChangeDeviceControl',
+'XSelectExtensionEvent', 'XGetSelectedExtensionEvents',
+'XChangeDeviceDontPropagateList', 'XGetDeviceDontPropagateList',
+'XSendExtensionEvent', 'XGetDeviceMotionEvents', 'XFreeDeviceMotionEvents',
+'XFreeDeviceControl']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/xlib.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/xlib.py
new file mode 100644
index 0000000..1d71d25
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/xlib.py
@@ -0,0 +1,5611 @@
+'''Wrapper for X11
+
+Generated with:
+tools/genwrappers.py xlib
+
+Do not modify this file.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import ctypes
+from ctypes import *
+
+import pyglet.lib
+
+_lib = pyglet.lib.load_library('X11')
+
+_int_types = (c_int16, c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (ctypes.c_int64,)
+for t in _int_types:
+ if sizeof(t) == sizeof(c_size_t):
+ c_ptrdiff_t = t
+
+class c_void(Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', c_int)]
+
+
+
+XlibSpecificationRelease = 6 # /usr/include/X11/Xlib.h:39
+X_PROTOCOL = 11 # /usr/include/X11/X.h:53
+X_PROTOCOL_REVISION = 0 # /usr/include/X11/X.h:54
+XID = c_ulong # /usr/include/X11/X.h:66
+Mask = c_ulong # /usr/include/X11/X.h:70
+Atom = c_ulong # /usr/include/X11/X.h:74
+VisualID = c_ulong # /usr/include/X11/X.h:76
+Time = c_ulong # /usr/include/X11/X.h:77
+Window = XID # /usr/include/X11/X.h:96
+Drawable = XID # /usr/include/X11/X.h:97
+Font = XID # /usr/include/X11/X.h:100
+Pixmap = XID # /usr/include/X11/X.h:102
+Cursor = XID # /usr/include/X11/X.h:103
+Colormap = XID # /usr/include/X11/X.h:104
+GContext = XID # /usr/include/X11/X.h:105
+KeySym = XID # /usr/include/X11/X.h:106
+KeyCode = c_ubyte # /usr/include/X11/X.h:108
+None_ = 0 # /usr/include/X11/X.h:115
+ParentRelative = 1 # /usr/include/X11/X.h:118
+CopyFromParent = 0 # /usr/include/X11/X.h:121
+PointerWindow = 0 # /usr/include/X11/X.h:126
+InputFocus = 1 # /usr/include/X11/X.h:127
+PointerRoot = 1 # /usr/include/X11/X.h:129
+AnyPropertyType = 0 # /usr/include/X11/X.h:131
+AnyKey = 0 # /usr/include/X11/X.h:133
+AnyButton = 0 # /usr/include/X11/X.h:135
+AllTemporary = 0 # /usr/include/X11/X.h:137
+CurrentTime = 0 # /usr/include/X11/X.h:139
+NoSymbol = 0 # /usr/include/X11/X.h:141
+NoEventMask = 0 # /usr/include/X11/X.h:150
+KeyPressMask = 1 # /usr/include/X11/X.h:151
+KeyReleaseMask = 2 # /usr/include/X11/X.h:152
+ButtonPressMask = 4 # /usr/include/X11/X.h:153
+ButtonReleaseMask = 8 # /usr/include/X11/X.h:154
+EnterWindowMask = 16 # /usr/include/X11/X.h:155
+LeaveWindowMask = 32 # /usr/include/X11/X.h:156
+PointerMotionMask = 64 # /usr/include/X11/X.h:157
+PointerMotionHintMask = 128 # /usr/include/X11/X.h:158
+Button1MotionMask = 256 # /usr/include/X11/X.h:159
+Button2MotionMask = 512 # /usr/include/X11/X.h:160
+Button3MotionMask = 1024 # /usr/include/X11/X.h:161
+Button4MotionMask = 2048 # /usr/include/X11/X.h:162
+Button5MotionMask = 4096 # /usr/include/X11/X.h:163
+ButtonMotionMask = 8192 # /usr/include/X11/X.h:164
+KeymapStateMask = 16384 # /usr/include/X11/X.h:165
+ExposureMask = 32768 # /usr/include/X11/X.h:166
+VisibilityChangeMask = 65536 # /usr/include/X11/X.h:167
+StructureNotifyMask = 131072 # /usr/include/X11/X.h:168
+ResizeRedirectMask = 262144 # /usr/include/X11/X.h:169
+SubstructureNotifyMask = 524288 # /usr/include/X11/X.h:170
+SubstructureRedirectMask = 1048576 # /usr/include/X11/X.h:171
+FocusChangeMask = 2097152 # /usr/include/X11/X.h:172
+PropertyChangeMask = 4194304 # /usr/include/X11/X.h:173
+ColormapChangeMask = 8388608 # /usr/include/X11/X.h:174
+OwnerGrabButtonMask = 16777216 # /usr/include/X11/X.h:175
+KeyPress = 2 # /usr/include/X11/X.h:181
+KeyRelease = 3 # /usr/include/X11/X.h:182
+ButtonPress = 4 # /usr/include/X11/X.h:183
+ButtonRelease = 5 # /usr/include/X11/X.h:184
+MotionNotify = 6 # /usr/include/X11/X.h:185
+EnterNotify = 7 # /usr/include/X11/X.h:186
+LeaveNotify = 8 # /usr/include/X11/X.h:187
+FocusIn = 9 # /usr/include/X11/X.h:188
+FocusOut = 10 # /usr/include/X11/X.h:189
+KeymapNotify = 11 # /usr/include/X11/X.h:190
+Expose = 12 # /usr/include/X11/X.h:191
+GraphicsExpose = 13 # /usr/include/X11/X.h:192
+NoExpose = 14 # /usr/include/X11/X.h:193
+VisibilityNotify = 15 # /usr/include/X11/X.h:194
+CreateNotify = 16 # /usr/include/X11/X.h:195
+DestroyNotify = 17 # /usr/include/X11/X.h:196
+UnmapNotify = 18 # /usr/include/X11/X.h:197
+MapNotify = 19 # /usr/include/X11/X.h:198
+MapRequest = 20 # /usr/include/X11/X.h:199
+ReparentNotify = 21 # /usr/include/X11/X.h:200
+ConfigureNotify = 22 # /usr/include/X11/X.h:201
+ConfigureRequest = 23 # /usr/include/X11/X.h:202
+GravityNotify = 24 # /usr/include/X11/X.h:203
+ResizeRequest = 25 # /usr/include/X11/X.h:204
+CirculateNotify = 26 # /usr/include/X11/X.h:205
+CirculateRequest = 27 # /usr/include/X11/X.h:206
+PropertyNotify = 28 # /usr/include/X11/X.h:207
+SelectionClear = 29 # /usr/include/X11/X.h:208
+SelectionRequest = 30 # /usr/include/X11/X.h:209
+SelectionNotify = 31 # /usr/include/X11/X.h:210
+ColormapNotify = 32 # /usr/include/X11/X.h:211
+ClientMessage = 33 # /usr/include/X11/X.h:212
+MappingNotify = 34 # /usr/include/X11/X.h:213
+GenericEvent = 35 # /usr/include/X11/X.h:214
+LASTEvent = 36 # /usr/include/X11/X.h:215
+ShiftMask = 1 # /usr/include/X11/X.h:221
+LockMask = 2 # /usr/include/X11/X.h:222
+ControlMask = 4 # /usr/include/X11/X.h:223
+Mod1Mask = 8 # /usr/include/X11/X.h:224
+Mod2Mask = 16 # /usr/include/X11/X.h:225
+Mod3Mask = 32 # /usr/include/X11/X.h:226
+Mod4Mask = 64 # /usr/include/X11/X.h:227
+Mod5Mask = 128 # /usr/include/X11/X.h:228
+ShiftMapIndex = 0 # /usr/include/X11/X.h:233
+LockMapIndex = 1 # /usr/include/X11/X.h:234
+ControlMapIndex = 2 # /usr/include/X11/X.h:235
+Mod1MapIndex = 3 # /usr/include/X11/X.h:236
+Mod2MapIndex = 4 # /usr/include/X11/X.h:237
+Mod3MapIndex = 5 # /usr/include/X11/X.h:238
+Mod4MapIndex = 6 # /usr/include/X11/X.h:239
+Mod5MapIndex = 7 # /usr/include/X11/X.h:240
+Button1Mask = 256 # /usr/include/X11/X.h:246
+Button2Mask = 512 # /usr/include/X11/X.h:247
+Button3Mask = 1024 # /usr/include/X11/X.h:248
+Button4Mask = 2048 # /usr/include/X11/X.h:249
+Button5Mask = 4096 # /usr/include/X11/X.h:250
+AnyModifier = 32768 # /usr/include/X11/X.h:252
+Button1 = 1 # /usr/include/X11/X.h:259
+Button2 = 2 # /usr/include/X11/X.h:260
+Button3 = 3 # /usr/include/X11/X.h:261
+Button4 = 4 # /usr/include/X11/X.h:262
+Button5 = 5 # /usr/include/X11/X.h:263
+NotifyNormal = 0 # /usr/include/X11/X.h:267
+NotifyGrab = 1 # /usr/include/X11/X.h:268
+NotifyUngrab = 2 # /usr/include/X11/X.h:269
+NotifyWhileGrabbed = 3 # /usr/include/X11/X.h:270
+NotifyHint = 1 # /usr/include/X11/X.h:272
+NotifyAncestor = 0 # /usr/include/X11/X.h:276
+NotifyVirtual = 1 # /usr/include/X11/X.h:277
+NotifyInferior = 2 # /usr/include/X11/X.h:278
+NotifyNonlinear = 3 # /usr/include/X11/X.h:279
+NotifyNonlinearVirtual = 4 # /usr/include/X11/X.h:280
+NotifyPointer = 5 # /usr/include/X11/X.h:281
+NotifyPointerRoot = 6 # /usr/include/X11/X.h:282
+NotifyDetailNone = 7 # /usr/include/X11/X.h:283
+VisibilityUnobscured = 0 # /usr/include/X11/X.h:287
+VisibilityPartiallyObscured = 1 # /usr/include/X11/X.h:288
+VisibilityFullyObscured = 2 # /usr/include/X11/X.h:289
+PlaceOnTop = 0 # /usr/include/X11/X.h:293
+PlaceOnBottom = 1 # /usr/include/X11/X.h:294
+FamilyInternet = 0 # /usr/include/X11/X.h:298
+FamilyDECnet = 1 # /usr/include/X11/X.h:299
+FamilyChaos = 2 # /usr/include/X11/X.h:300
+FamilyInternet6 = 6 # /usr/include/X11/X.h:301
+FamilyServerInterpreted = 5 # /usr/include/X11/X.h:304
+PropertyNewValue = 0 # /usr/include/X11/X.h:308
+PropertyDelete = 1 # /usr/include/X11/X.h:309
+ColormapUninstalled = 0 # /usr/include/X11/X.h:313
+ColormapInstalled = 1 # /usr/include/X11/X.h:314
+GrabModeSync = 0 # /usr/include/X11/X.h:318
+GrabModeAsync = 1 # /usr/include/X11/X.h:319
+GrabSuccess = 0 # /usr/include/X11/X.h:323
+AlreadyGrabbed = 1 # /usr/include/X11/X.h:324
+GrabInvalidTime = 2 # /usr/include/X11/X.h:325
+GrabNotViewable = 3 # /usr/include/X11/X.h:326
+GrabFrozen = 4 # /usr/include/X11/X.h:327
+AsyncPointer = 0 # /usr/include/X11/X.h:331
+SyncPointer = 1 # /usr/include/X11/X.h:332
+ReplayPointer = 2 # /usr/include/X11/X.h:333
+AsyncKeyboard = 3 # /usr/include/X11/X.h:334
+SyncKeyboard = 4 # /usr/include/X11/X.h:335
+ReplayKeyboard = 5 # /usr/include/X11/X.h:336
+AsyncBoth = 6 # /usr/include/X11/X.h:337
+SyncBoth = 7 # /usr/include/X11/X.h:338
+RevertToParent = 2 # /usr/include/X11/X.h:344
+Success = 0 # /usr/include/X11/X.h:350
+BadRequest = 1 # /usr/include/X11/X.h:351
+BadValue = 2 # /usr/include/X11/X.h:352
+BadWindow = 3 # /usr/include/X11/X.h:353
+BadPixmap = 4 # /usr/include/X11/X.h:354
+BadAtom = 5 # /usr/include/X11/X.h:355
+BadCursor = 6 # /usr/include/X11/X.h:356
+BadFont = 7 # /usr/include/X11/X.h:357
+BadMatch = 8 # /usr/include/X11/X.h:358
+BadDrawable = 9 # /usr/include/X11/X.h:359
+BadAccess = 10 # /usr/include/X11/X.h:360
+BadAlloc = 11 # /usr/include/X11/X.h:369
+BadColor = 12 # /usr/include/X11/X.h:370
+BadGC = 13 # /usr/include/X11/X.h:371
+BadIDChoice = 14 # /usr/include/X11/X.h:372
+BadName = 15 # /usr/include/X11/X.h:373
+BadLength = 16 # /usr/include/X11/X.h:374
+BadImplementation = 17 # /usr/include/X11/X.h:375
+FirstExtensionError = 128 # /usr/include/X11/X.h:377
+LastExtensionError = 255 # /usr/include/X11/X.h:378
+InputOutput = 1 # /usr/include/X11/X.h:387
+InputOnly = 2 # /usr/include/X11/X.h:388
+CWBackPixmap = 1 # /usr/include/X11/X.h:392
+CWBackPixel = 2 # /usr/include/X11/X.h:393
+CWBorderPixmap = 4 # /usr/include/X11/X.h:394
+CWBorderPixel = 8 # /usr/include/X11/X.h:395
+CWBitGravity = 16 # /usr/include/X11/X.h:396
+CWWinGravity = 32 # /usr/include/X11/X.h:397
+CWBackingStore = 64 # /usr/include/X11/X.h:398
+CWBackingPlanes = 128 # /usr/include/X11/X.h:399
+CWBackingPixel = 256 # /usr/include/X11/X.h:400
+CWOverrideRedirect = 512 # /usr/include/X11/X.h:401
+CWSaveUnder = 1024 # /usr/include/X11/X.h:402
+CWEventMask = 2048 # /usr/include/X11/X.h:403
+CWDontPropagate = 4096 # /usr/include/X11/X.h:404
+CWColormap = 8192 # /usr/include/X11/X.h:405
+CWCursor = 16384 # /usr/include/X11/X.h:406
+CWX = 1 # /usr/include/X11/X.h:410
+CWY = 2 # /usr/include/X11/X.h:411
+CWWidth = 4 # /usr/include/X11/X.h:412
+CWHeight = 8 # /usr/include/X11/X.h:413
+CWBorderWidth = 16 # /usr/include/X11/X.h:414
+CWSibling = 32 # /usr/include/X11/X.h:415
+CWStackMode = 64 # /usr/include/X11/X.h:416
+ForgetGravity = 0 # /usr/include/X11/X.h:421
+NorthWestGravity = 1 # /usr/include/X11/X.h:422
+NorthGravity = 2 # /usr/include/X11/X.h:423
+NorthEastGravity = 3 # /usr/include/X11/X.h:424
+WestGravity = 4 # /usr/include/X11/X.h:425
+CenterGravity = 5 # /usr/include/X11/X.h:426
+EastGravity = 6 # /usr/include/X11/X.h:427
+SouthWestGravity = 7 # /usr/include/X11/X.h:428
+SouthGravity = 8 # /usr/include/X11/X.h:429
+SouthEastGravity = 9 # /usr/include/X11/X.h:430
+StaticGravity = 10 # /usr/include/X11/X.h:431
+UnmapGravity = 0 # /usr/include/X11/X.h:435
+NotUseful = 0 # /usr/include/X11/X.h:439
+WhenMapped = 1 # /usr/include/X11/X.h:440
+Always = 2 # /usr/include/X11/X.h:441
+IsUnmapped = 0 # /usr/include/X11/X.h:445
+IsUnviewable = 1 # /usr/include/X11/X.h:446
+IsViewable = 2 # /usr/include/X11/X.h:447
+SetModeInsert = 0 # /usr/include/X11/X.h:451
+SetModeDelete = 1 # /usr/include/X11/X.h:452
+DestroyAll = 0 # /usr/include/X11/X.h:456
+RetainPermanent = 1 # /usr/include/X11/X.h:457
+RetainTemporary = 2 # /usr/include/X11/X.h:458
+Above = 0 # /usr/include/X11/X.h:462
+Below = 1 # /usr/include/X11/X.h:463
+TopIf = 2 # /usr/include/X11/X.h:464
+BottomIf = 3 # /usr/include/X11/X.h:465
+Opposite = 4 # /usr/include/X11/X.h:466
+RaiseLowest = 0 # /usr/include/X11/X.h:470
+LowerHighest = 1 # /usr/include/X11/X.h:471
+PropModeReplace = 0 # /usr/include/X11/X.h:475
+PropModePrepend = 1 # /usr/include/X11/X.h:476
+PropModeAppend = 2 # /usr/include/X11/X.h:477
+GXclear = 0 # /usr/include/X11/X.h:485
+GXand = 1 # /usr/include/X11/X.h:486
+GXandReverse = 2 # /usr/include/X11/X.h:487
+GXcopy = 3 # /usr/include/X11/X.h:488
+GXandInverted = 4 # /usr/include/X11/X.h:489
+GXnoop = 5 # /usr/include/X11/X.h:490
+GXxor = 6 # /usr/include/X11/X.h:491
+GXor = 7 # /usr/include/X11/X.h:492
+GXnor = 8 # /usr/include/X11/X.h:493
+GXequiv = 9 # /usr/include/X11/X.h:494
+GXinvert = 10 # /usr/include/X11/X.h:495
+GXorReverse = 11 # /usr/include/X11/X.h:496
+GXcopyInverted = 12 # /usr/include/X11/X.h:497
+GXorInverted = 13 # /usr/include/X11/X.h:498
+GXnand = 14 # /usr/include/X11/X.h:499
+GXset = 15 # /usr/include/X11/X.h:500
+LineSolid = 0 # /usr/include/X11/X.h:504
+LineOnOffDash = 1 # /usr/include/X11/X.h:505
+LineDoubleDash = 2 # /usr/include/X11/X.h:506
+CapNotLast = 0 # /usr/include/X11/X.h:510
+CapButt = 1 # /usr/include/X11/X.h:511
+CapRound = 2 # /usr/include/X11/X.h:512
+CapProjecting = 3 # /usr/include/X11/X.h:513
+JoinMiter = 0 # /usr/include/X11/X.h:517
+JoinRound = 1 # /usr/include/X11/X.h:518
+JoinBevel = 2 # /usr/include/X11/X.h:519
+FillSolid = 0 # /usr/include/X11/X.h:523
+FillTiled = 1 # /usr/include/X11/X.h:524
+FillStippled = 2 # /usr/include/X11/X.h:525
+FillOpaqueStippled = 3 # /usr/include/X11/X.h:526
+EvenOddRule = 0 # /usr/include/X11/X.h:530
+WindingRule = 1 # /usr/include/X11/X.h:531
+ClipByChildren = 0 # /usr/include/X11/X.h:535
+IncludeInferiors = 1 # /usr/include/X11/X.h:536
+Unsorted = 0 # /usr/include/X11/X.h:540
+YSorted = 1 # /usr/include/X11/X.h:541
+YXSorted = 2 # /usr/include/X11/X.h:542
+YXBanded = 3 # /usr/include/X11/X.h:543
+CoordModeOrigin = 0 # /usr/include/X11/X.h:547
+CoordModePrevious = 1 # /usr/include/X11/X.h:548
+Complex = 0 # /usr/include/X11/X.h:552
+Nonconvex = 1 # /usr/include/X11/X.h:553
+Convex = 2 # /usr/include/X11/X.h:554
+ArcChord = 0 # /usr/include/X11/X.h:558
+ArcPieSlice = 1 # /usr/include/X11/X.h:559
+GCFunction = 1 # /usr/include/X11/X.h:564
+GCPlaneMask = 2 # /usr/include/X11/X.h:565
+GCForeground = 4 # /usr/include/X11/X.h:566
+GCBackground = 8 # /usr/include/X11/X.h:567
+GCLineWidth = 16 # /usr/include/X11/X.h:568
+GCLineStyle = 32 # /usr/include/X11/X.h:569
+GCCapStyle = 64 # /usr/include/X11/X.h:570
+GCJoinStyle = 128 # /usr/include/X11/X.h:571
+GCFillStyle = 256 # /usr/include/X11/X.h:572
+GCFillRule = 512 # /usr/include/X11/X.h:573
+GCTile = 1024 # /usr/include/X11/X.h:574
+GCStipple = 2048 # /usr/include/X11/X.h:575
+GCTileStipXOrigin = 4096 # /usr/include/X11/X.h:576
+GCTileStipYOrigin = 8192 # /usr/include/X11/X.h:577
+GCFont = 16384 # /usr/include/X11/X.h:578
+GCSubwindowMode = 32768 # /usr/include/X11/X.h:579
+GCGraphicsExposures = 65536 # /usr/include/X11/X.h:580
+GCClipXOrigin = 131072 # /usr/include/X11/X.h:581
+GCClipYOrigin = 262144 # /usr/include/X11/X.h:582
+GCClipMask = 524288 # /usr/include/X11/X.h:583
+GCDashOffset = 1048576 # /usr/include/X11/X.h:584
+GCDashList = 2097152 # /usr/include/X11/X.h:585
+GCArcMode = 4194304 # /usr/include/X11/X.h:586
+GCLastBit = 22 # /usr/include/X11/X.h:588
+FontLeftToRight = 0 # /usr/include/X11/X.h:595
+FontRightToLeft = 1 # /usr/include/X11/X.h:596
+FontChange = 255 # /usr/include/X11/X.h:598
+XYBitmap = 0 # /usr/include/X11/X.h:606
+XYPixmap = 1 # /usr/include/X11/X.h:607
+ZPixmap = 2 # /usr/include/X11/X.h:608
+AllocNone = 0 # /usr/include/X11/X.h:616
+AllocAll = 1 # /usr/include/X11/X.h:617
+DoRed = 1 # /usr/include/X11/X.h:622
+DoGreen = 2 # /usr/include/X11/X.h:623
+DoBlue = 4 # /usr/include/X11/X.h:624
+CursorShape = 0 # /usr/include/X11/X.h:632
+TileShape = 1 # /usr/include/X11/X.h:633
+StippleShape = 2 # /usr/include/X11/X.h:634
+AutoRepeatModeOff = 0 # /usr/include/X11/X.h:640
+AutoRepeatModeOn = 1 # /usr/include/X11/X.h:641
+AutoRepeatModeDefault = 2 # /usr/include/X11/X.h:642
+LedModeOff = 0 # /usr/include/X11/X.h:644
+LedModeOn = 1 # /usr/include/X11/X.h:645
+KBKeyClickPercent = 1 # /usr/include/X11/X.h:649
+KBBellPercent = 2 # /usr/include/X11/X.h:650
+KBBellPitch = 4 # /usr/include/X11/X.h:651
+KBBellDuration = 8 # /usr/include/X11/X.h:652
+KBLed = 16 # /usr/include/X11/X.h:653
+KBLedMode = 32 # /usr/include/X11/X.h:654
+KBKey = 64 # /usr/include/X11/X.h:655
+KBAutoRepeatMode = 128 # /usr/include/X11/X.h:656
+MappingSuccess = 0 # /usr/include/X11/X.h:658
+MappingBusy = 1 # /usr/include/X11/X.h:659
+MappingFailed = 2 # /usr/include/X11/X.h:660
+MappingModifier = 0 # /usr/include/X11/X.h:662
+MappingKeyboard = 1 # /usr/include/X11/X.h:663
+MappingPointer = 2 # /usr/include/X11/X.h:664
+DontPreferBlanking = 0 # /usr/include/X11/X.h:670
+PreferBlanking = 1 # /usr/include/X11/X.h:671
+DefaultBlanking = 2 # /usr/include/X11/X.h:672
+DisableScreenSaver = 0 # /usr/include/X11/X.h:674
+DisableScreenInterval = 0 # /usr/include/X11/X.h:675
+DontAllowExposures = 0 # /usr/include/X11/X.h:677
+AllowExposures = 1 # /usr/include/X11/X.h:678
+DefaultExposures = 2 # /usr/include/X11/X.h:679
+ScreenSaverReset = 0 # /usr/include/X11/X.h:683
+ScreenSaverActive = 1 # /usr/include/X11/X.h:684
+HostInsert = 0 # /usr/include/X11/X.h:692
+HostDelete = 1 # /usr/include/X11/X.h:693
+EnableAccess = 1 # /usr/include/X11/X.h:697
+DisableAccess = 0 # /usr/include/X11/X.h:698
+StaticGray = 0 # /usr/include/X11/X.h:704
+GrayScale = 1 # /usr/include/X11/X.h:705
+StaticColor = 2 # /usr/include/X11/X.h:706
+PseudoColor = 3 # /usr/include/X11/X.h:707
+TrueColor = 4 # /usr/include/X11/X.h:708
+DirectColor = 5 # /usr/include/X11/X.h:709
+LSBFirst = 0 # /usr/include/X11/X.h:714
+MSBFirst = 1 # /usr/include/X11/X.h:715
+# /usr/include/X11/Xlib.h:73
+_Xmblen = _lib._Xmblen
+_Xmblen.restype = c_int
+_Xmblen.argtypes = [c_char_p, c_int]
+
+X_HAVE_UTF8_STRING = 1 # /usr/include/X11/Xlib.h:85
+XPointer = c_char_p # /usr/include/X11/Xlib.h:87
+Bool = c_int # /usr/include/X11/Xlib.h:89
+Status = c_int # /usr/include/X11/Xlib.h:90
+True_ = 1 # /usr/include/X11/Xlib.h:91
+False_ = 0 # /usr/include/X11/Xlib.h:92
+QueuedAlready = 0 # /usr/include/X11/Xlib.h:94
+QueuedAfterReading = 1 # /usr/include/X11/Xlib.h:95
+QueuedAfterFlush = 2 # /usr/include/X11/Xlib.h:96
+class struct__XExtData(Structure):
+ __slots__ = [
+ 'number',
+ 'next',
+ 'free_private',
+ 'private_data',
+ ]
+struct__XExtData._fields_ = [
+ ('number', c_int),
+ ('next', POINTER(struct__XExtData)),
+ ('free_private', POINTER(CFUNCTYPE(c_int, POINTER(struct__XExtData)))),
+ ('private_data', XPointer),
+]
+
+XExtData = struct__XExtData # /usr/include/X11/Xlib.h:166
+class struct_anon_15(Structure):
+ __slots__ = [
+ 'extension',
+ 'major_opcode',
+ 'first_event',
+ 'first_error',
+ ]
+struct_anon_15._fields_ = [
+ ('extension', c_int),
+ ('major_opcode', c_int),
+ ('first_event', c_int),
+ ('first_error', c_int),
+]
+
+XExtCodes = struct_anon_15 # /usr/include/X11/Xlib.h:176
+class struct_anon_16(Structure):
+ __slots__ = [
+ 'depth',
+ 'bits_per_pixel',
+ 'scanline_pad',
+ ]
+struct_anon_16._fields_ = [
+ ('depth', c_int),
+ ('bits_per_pixel', c_int),
+ ('scanline_pad', c_int),
+]
+
+XPixmapFormatValues = struct_anon_16 # /usr/include/X11/Xlib.h:186
+class struct_anon_17(Structure):
+ __slots__ = [
+ 'function',
+ 'plane_mask',
+ 'foreground',
+ 'background',
+ 'line_width',
+ 'line_style',
+ 'cap_style',
+ 'join_style',
+ 'fill_style',
+ 'fill_rule',
+ 'arc_mode',
+ 'tile',
+ 'stipple',
+ 'ts_x_origin',
+ 'ts_y_origin',
+ 'font',
+ 'subwindow_mode',
+ 'graphics_exposures',
+ 'clip_x_origin',
+ 'clip_y_origin',
+ 'clip_mask',
+ 'dash_offset',
+ 'dashes',
+ ]
+struct_anon_17._fields_ = [
+ ('function', c_int),
+ ('plane_mask', c_ulong),
+ ('foreground', c_ulong),
+ ('background', c_ulong),
+ ('line_width', c_int),
+ ('line_style', c_int),
+ ('cap_style', c_int),
+ ('join_style', c_int),
+ ('fill_style', c_int),
+ ('fill_rule', c_int),
+ ('arc_mode', c_int),
+ ('tile', Pixmap),
+ ('stipple', Pixmap),
+ ('ts_x_origin', c_int),
+ ('ts_y_origin', c_int),
+ ('font', Font),
+ ('subwindow_mode', c_int),
+ ('graphics_exposures', c_int),
+ ('clip_x_origin', c_int),
+ ('clip_y_origin', c_int),
+ ('clip_mask', Pixmap),
+ ('dash_offset', c_int),
+ ('dashes', c_char),
+]
+
+XGCValues = struct_anon_17 # /usr/include/X11/Xlib.h:218
+class struct__XGC(Structure):
+ __slots__ = [
+ ]
+struct__XGC._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XGC(Structure):
+ __slots__ = [
+ ]
+struct__XGC._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+GC = POINTER(struct__XGC) # /usr/include/X11/Xlib.h:233
+class struct_anon_18(Structure):
+ __slots__ = [
+ 'ext_data',
+ 'visualid',
+ 'class',
+ 'red_mask',
+ 'green_mask',
+ 'blue_mask',
+ 'bits_per_rgb',
+ 'map_entries',
+ ]
+struct_anon_18._fields_ = [
+ ('ext_data', POINTER(XExtData)),
+ ('visualid', VisualID),
+ ('class', c_int),
+ ('red_mask', c_ulong),
+ ('green_mask', c_ulong),
+ ('blue_mask', c_ulong),
+ ('bits_per_rgb', c_int),
+ ('map_entries', c_int),
+]
+
+Visual = struct_anon_18 # /usr/include/X11/Xlib.h:249
+class struct_anon_19(Structure):
+ __slots__ = [
+ 'depth',
+ 'nvisuals',
+ 'visuals',
+ ]
+struct_anon_19._fields_ = [
+ ('depth', c_int),
+ ('nvisuals', c_int),
+ ('visuals', POINTER(Visual)),
+]
+
+Depth = struct_anon_19 # /usr/include/X11/Xlib.h:258
+class struct_anon_20(Structure):
+ __slots__ = [
+ 'ext_data',
+ 'display',
+ 'root',
+ 'width',
+ 'height',
+ 'mwidth',
+ 'mheight',
+ 'ndepths',
+ 'depths',
+ 'root_depth',
+ 'root_visual',
+ 'default_gc',
+ 'cmap',
+ 'white_pixel',
+ 'black_pixel',
+ 'max_maps',
+ 'min_maps',
+ 'backing_store',
+ 'save_unders',
+ 'root_input_mask',
+ ]
+class struct__XDisplay(Structure):
+ __slots__ = [
+ ]
+struct__XDisplay._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+struct_anon_20._fields_ = [
+ ('ext_data', POINTER(XExtData)),
+ ('display', POINTER(struct__XDisplay)),
+ ('root', Window),
+ ('width', c_int),
+ ('height', c_int),
+ ('mwidth', c_int),
+ ('mheight', c_int),
+ ('ndepths', c_int),
+ ('depths', POINTER(Depth)),
+ ('root_depth', c_int),
+ ('root_visual', POINTER(Visual)),
+ ('default_gc', GC),
+ ('cmap', Colormap),
+ ('white_pixel', c_ulong),
+ ('black_pixel', c_ulong),
+ ('max_maps', c_int),
+ ('min_maps', c_int),
+ ('backing_store', c_int),
+ ('save_unders', c_int),
+ ('root_input_mask', c_long),
+]
+
+Screen = struct_anon_20 # /usr/include/X11/Xlib.h:286
+class struct_anon_21(Structure):
+ __slots__ = [
+ 'ext_data',
+ 'depth',
+ 'bits_per_pixel',
+ 'scanline_pad',
+ ]
+struct_anon_21._fields_ = [
+ ('ext_data', POINTER(XExtData)),
+ ('depth', c_int),
+ ('bits_per_pixel', c_int),
+ ('scanline_pad', c_int),
+]
+
+ScreenFormat = struct_anon_21 # /usr/include/X11/Xlib.h:296
+class struct_anon_22(Structure):
+ __slots__ = [
+ 'background_pixmap',
+ 'background_pixel',
+ 'border_pixmap',
+ 'border_pixel',
+ 'bit_gravity',
+ 'win_gravity',
+ 'backing_store',
+ 'backing_planes',
+ 'backing_pixel',
+ 'save_under',
+ 'event_mask',
+ 'do_not_propagate_mask',
+ 'override_redirect',
+ 'colormap',
+ 'cursor',
+ ]
+struct_anon_22._fields_ = [
+ ('background_pixmap', Pixmap),
+ ('background_pixel', c_ulong),
+ ('border_pixmap', Pixmap),
+ ('border_pixel', c_ulong),
+ ('bit_gravity', c_int),
+ ('win_gravity', c_int),
+ ('backing_store', c_int),
+ ('backing_planes', c_ulong),
+ ('backing_pixel', c_ulong),
+ ('save_under', c_int),
+ ('event_mask', c_long),
+ ('do_not_propagate_mask', c_long),
+ ('override_redirect', c_int),
+ ('colormap', Colormap),
+ ('cursor', Cursor),
+]
+
+XSetWindowAttributes = struct_anon_22 # /usr/include/X11/Xlib.h:317
+class struct_anon_23(Structure):
+ __slots__ = [
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'border_width',
+ 'depth',
+ 'visual',
+ 'root',
+ 'class',
+ 'bit_gravity',
+ 'win_gravity',
+ 'backing_store',
+ 'backing_planes',
+ 'backing_pixel',
+ 'save_under',
+ 'colormap',
+ 'map_installed',
+ 'map_state',
+ 'all_event_masks',
+ 'your_event_mask',
+ 'do_not_propagate_mask',
+ 'override_redirect',
+ 'screen',
+ ]
+struct_anon_23._fields_ = [
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('border_width', c_int),
+ ('depth', c_int),
+ ('visual', POINTER(Visual)),
+ ('root', Window),
+ ('class', c_int),
+ ('bit_gravity', c_int),
+ ('win_gravity', c_int),
+ ('backing_store', c_int),
+ ('backing_planes', c_ulong),
+ ('backing_pixel', c_ulong),
+ ('save_under', c_int),
+ ('colormap', Colormap),
+ ('map_installed', c_int),
+ ('map_state', c_int),
+ ('all_event_masks', c_long),
+ ('your_event_mask', c_long),
+ ('do_not_propagate_mask', c_long),
+ ('override_redirect', c_int),
+ ('screen', POINTER(Screen)),
+]
+
+XWindowAttributes = struct_anon_23 # /usr/include/X11/Xlib.h:345
+class struct_anon_24(Structure):
+ __slots__ = [
+ 'family',
+ 'length',
+ 'address',
+ ]
+struct_anon_24._fields_ = [
+ ('family', c_int),
+ ('length', c_int),
+ ('address', c_char_p),
+]
+
+XHostAddress = struct_anon_24 # /usr/include/X11/Xlib.h:356
+class struct_anon_25(Structure):
+ __slots__ = [
+ 'typelength',
+ 'valuelength',
+ 'type',
+ 'value',
+ ]
+struct_anon_25._fields_ = [
+ ('typelength', c_int),
+ ('valuelength', c_int),
+ ('type', c_char_p),
+ ('value', c_char_p),
+]
+
+XServerInterpretedAddress = struct_anon_25 # /usr/include/X11/Xlib.h:366
+class struct__XImage(Structure):
+ __slots__ = [
+ 'width',
+ 'height',
+ 'xoffset',
+ 'format',
+ 'data',
+ 'byte_order',
+ 'bitmap_unit',
+ 'bitmap_bit_order',
+ 'bitmap_pad',
+ 'depth',
+ 'bytes_per_line',
+ 'bits_per_pixel',
+ 'red_mask',
+ 'green_mask',
+ 'blue_mask',
+ 'obdata',
+ 'f',
+ ]
+class struct_funcs(Structure):
+ __slots__ = [
+ 'create_image',
+ 'destroy_image',
+ 'get_pixel',
+ 'put_pixel',
+ 'sub_image',
+ 'add_pixel',
+ ]
+class struct__XDisplay(Structure):
+ __slots__ = [
+ ]
+struct__XDisplay._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+struct_funcs._fields_ = [
+ ('create_image', POINTER(CFUNCTYPE(POINTER(struct__XImage), POINTER(struct__XDisplay), POINTER(Visual), c_uint, c_int, c_int, c_char_p, c_uint, c_uint, c_int, c_int))),
+ ('destroy_image', POINTER(CFUNCTYPE(c_int, POINTER(struct__XImage)))),
+ ('get_pixel', POINTER(CFUNCTYPE(c_ulong, POINTER(struct__XImage), c_int, c_int))),
+ ('put_pixel', POINTER(CFUNCTYPE(c_int, POINTER(struct__XImage), c_int, c_int, c_ulong))),
+ ('sub_image', POINTER(CFUNCTYPE(POINTER(struct__XImage), POINTER(struct__XImage), c_int, c_int, c_uint, c_uint))),
+ ('add_pixel', POINTER(CFUNCTYPE(c_int, POINTER(struct__XImage), c_long))),
+]
+
+struct__XImage._fields_ = [
+ ('width', c_int),
+ ('height', c_int),
+ ('xoffset', c_int),
+ ('format', c_int),
+ ('data', c_char_p),
+ ('byte_order', c_int),
+ ('bitmap_unit', c_int),
+ ('bitmap_bit_order', c_int),
+ ('bitmap_pad', c_int),
+ ('depth', c_int),
+ ('bytes_per_line', c_int),
+ ('bits_per_pixel', c_int),
+ ('red_mask', c_ulong),
+ ('green_mask', c_ulong),
+ ('blue_mask', c_ulong),
+ ('obdata', XPointer),
+ ('f', struct_funcs),
+]
+
+XImage = struct__XImage # /usr/include/X11/Xlib.h:405
+class struct_anon_26(Structure):
+ __slots__ = [
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'border_width',
+ 'sibling',
+ 'stack_mode',
+ ]
+struct_anon_26._fields_ = [
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('border_width', c_int),
+ ('sibling', Window),
+ ('stack_mode', c_int),
+]
+
+XWindowChanges = struct_anon_26 # /usr/include/X11/Xlib.h:416
+class struct_anon_27(Structure):
+ __slots__ = [
+ 'pixel',
+ 'red',
+ 'green',
+ 'blue',
+ 'flags',
+ 'pad',
+ ]
+struct_anon_27._fields_ = [
+ ('pixel', c_ulong),
+ ('red', c_ushort),
+ ('green', c_ushort),
+ ('blue', c_ushort),
+ ('flags', c_char),
+ ('pad', c_char),
+]
+
+XColor = struct_anon_27 # /usr/include/X11/Xlib.h:426
+class struct_anon_28(Structure):
+ __slots__ = [
+ 'x1',
+ 'y1',
+ 'x2',
+ 'y2',
+ ]
+struct_anon_28._fields_ = [
+ ('x1', c_short),
+ ('y1', c_short),
+ ('x2', c_short),
+ ('y2', c_short),
+]
+
+XSegment = struct_anon_28 # /usr/include/X11/Xlib.h:435
+class struct_anon_29(Structure):
+ __slots__ = [
+ 'x',
+ 'y',
+ ]
+struct_anon_29._fields_ = [
+ ('x', c_short),
+ ('y', c_short),
+]
+
+XPoint = struct_anon_29 # /usr/include/X11/Xlib.h:439
+class struct_anon_30(Structure):
+ __slots__ = [
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ ]
+struct_anon_30._fields_ = [
+ ('x', c_short),
+ ('y', c_short),
+ ('width', c_ushort),
+ ('height', c_ushort),
+]
+
+XRectangle = struct_anon_30 # /usr/include/X11/Xlib.h:444
+class struct_anon_31(Structure):
+ __slots__ = [
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'angle1',
+ 'angle2',
+ ]
+struct_anon_31._fields_ = [
+ ('x', c_short),
+ ('y', c_short),
+ ('width', c_ushort),
+ ('height', c_ushort),
+ ('angle1', c_short),
+ ('angle2', c_short),
+]
+
+XArc = struct_anon_31 # /usr/include/X11/Xlib.h:450
+class struct_anon_32(Structure):
+ __slots__ = [
+ 'key_click_percent',
+ 'bell_percent',
+ 'bell_pitch',
+ 'bell_duration',
+ 'led',
+ 'led_mode',
+ 'key',
+ 'auto_repeat_mode',
+ ]
+struct_anon_32._fields_ = [
+ ('key_click_percent', c_int),
+ ('bell_percent', c_int),
+ ('bell_pitch', c_int),
+ ('bell_duration', c_int),
+ ('led', c_int),
+ ('led_mode', c_int),
+ ('key', c_int),
+ ('auto_repeat_mode', c_int),
+]
+
+XKeyboardControl = struct_anon_32 # /usr/include/X11/Xlib.h:464
+class struct_anon_33(Structure):
+ __slots__ = [
+ 'key_click_percent',
+ 'bell_percent',
+ 'bell_pitch',
+ 'bell_duration',
+ 'led_mask',
+ 'global_auto_repeat',
+ 'auto_repeats',
+ ]
+struct_anon_33._fields_ = [
+ ('key_click_percent', c_int),
+ ('bell_percent', c_int),
+ ('bell_pitch', c_uint),
+ ('bell_duration', c_uint),
+ ('led_mask', c_ulong),
+ ('global_auto_repeat', c_int),
+ ('auto_repeats', c_char * 32),
+]
+
+XKeyboardState = struct_anon_33 # /usr/include/X11/Xlib.h:475
+class struct_anon_34(Structure):
+ __slots__ = [
+ 'time',
+ 'x',
+ 'y',
+ ]
+struct_anon_34._fields_ = [
+ ('time', Time),
+ ('x', c_short),
+ ('y', c_short),
+]
+
+XTimeCoord = struct_anon_34 # /usr/include/X11/Xlib.h:482
+class struct_anon_35(Structure):
+ __slots__ = [
+ 'max_keypermod',
+ 'modifiermap',
+ ]
+struct_anon_35._fields_ = [
+ ('max_keypermod', c_int),
+ ('modifiermap', POINTER(KeyCode)),
+]
+
+XModifierKeymap = struct_anon_35 # /usr/include/X11/Xlib.h:489
+class struct__XDisplay(Structure):
+ __slots__ = [
+ ]
+struct__XDisplay._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XDisplay(Structure):
+ __slots__ = [
+ ]
+struct__XDisplay._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+Display = struct__XDisplay # /usr/include/X11/Xlib.h:498
+class struct_anon_36(Structure):
+ __slots__ = [
+ 'ext_data',
+ 'private1',
+ 'fd',
+ 'private2',
+ 'proto_major_version',
+ 'proto_minor_version',
+ 'vendor',
+ 'private3',
+ 'private4',
+ 'private5',
+ 'private6',
+ 'resource_alloc',
+ 'byte_order',
+ 'bitmap_unit',
+ 'bitmap_pad',
+ 'bitmap_bit_order',
+ 'nformats',
+ 'pixmap_format',
+ 'private8',
+ 'release',
+ 'private9',
+ 'private10',
+ 'qlen',
+ 'last_request_read',
+ 'request',
+ 'private11',
+ 'private12',
+ 'private13',
+ 'private14',
+ 'max_request_size',
+ 'db',
+ 'private15',
+ 'display_name',
+ 'default_screen',
+ 'nscreens',
+ 'screens',
+ 'motion_buffer',
+ 'private16',
+ 'min_keycode',
+ 'max_keycode',
+ 'private17',
+ 'private18',
+ 'private19',
+ 'xdefaults',
+ ]
+class struct__XPrivate(Structure):
+ __slots__ = [
+ ]
+struct__XPrivate._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XDisplay(Structure):
+ __slots__ = [
+ ]
+struct__XDisplay._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XPrivate(Structure):
+ __slots__ = [
+ ]
+struct__XPrivate._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XPrivate(Structure):
+ __slots__ = [
+ ]
+struct__XPrivate._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XrmHashBucketRec(Structure):
+ __slots__ = [
+ ]
+struct__XrmHashBucketRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XDisplay(Structure):
+ __slots__ = [
+ ]
+struct__XDisplay._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+struct_anon_36._fields_ = [
+ ('ext_data', POINTER(XExtData)),
+ ('private1', POINTER(struct__XPrivate)),
+ ('fd', c_int),
+ ('private2', c_int),
+ ('proto_major_version', c_int),
+ ('proto_minor_version', c_int),
+ ('vendor', c_char_p),
+ ('private3', XID),
+ ('private4', XID),
+ ('private5', XID),
+ ('private6', c_int),
+ ('resource_alloc', POINTER(CFUNCTYPE(XID, POINTER(struct__XDisplay)))),
+ ('byte_order', c_int),
+ ('bitmap_unit', c_int),
+ ('bitmap_pad', c_int),
+ ('bitmap_bit_order', c_int),
+ ('nformats', c_int),
+ ('pixmap_format', POINTER(ScreenFormat)),
+ ('private8', c_int),
+ ('release', c_int),
+ ('private9', POINTER(struct__XPrivate)),
+ ('private10', POINTER(struct__XPrivate)),
+ ('qlen', c_int),
+ ('last_request_read', c_ulong),
+ ('request', c_ulong),
+ ('private11', XPointer),
+ ('private12', XPointer),
+ ('private13', XPointer),
+ ('private14', XPointer),
+ ('max_request_size', c_uint),
+ ('db', POINTER(struct__XrmHashBucketRec)),
+ ('private15', POINTER(CFUNCTYPE(c_int, POINTER(struct__XDisplay)))),
+ ('display_name', c_char_p),
+ ('default_screen', c_int),
+ ('nscreens', c_int),
+ ('screens', POINTER(Screen)),
+ ('motion_buffer', c_ulong),
+ ('private16', c_ulong),
+ ('min_keycode', c_int),
+ ('max_keycode', c_int),
+ ('private17', XPointer),
+ ('private18', XPointer),
+ ('private19', c_int),
+ ('xdefaults', c_char_p),
+]
+
+_XPrivDisplay = POINTER(struct_anon_36) # /usr/include/X11/Xlib.h:561
+class struct_anon_37(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'root',
+ 'subwindow',
+ 'time',
+ 'x',
+ 'y',
+ 'x_root',
+ 'y_root',
+ 'state',
+ 'keycode',
+ 'same_screen',
+ ]
+struct_anon_37._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('root', Window),
+ ('subwindow', Window),
+ ('time', Time),
+ ('x', c_int),
+ ('y', c_int),
+ ('x_root', c_int),
+ ('y_root', c_int),
+ ('state', c_uint),
+ ('keycode', c_uint),
+ ('same_screen', c_int),
+]
+
+XKeyEvent = struct_anon_37 # /usr/include/X11/Xlib.h:582
+XKeyPressedEvent = XKeyEvent # /usr/include/X11/Xlib.h:583
+XKeyReleasedEvent = XKeyEvent # /usr/include/X11/Xlib.h:584
+class struct_anon_38(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'root',
+ 'subwindow',
+ 'time',
+ 'x',
+ 'y',
+ 'x_root',
+ 'y_root',
+ 'state',
+ 'button',
+ 'same_screen',
+ ]
+struct_anon_38._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('root', Window),
+ ('subwindow', Window),
+ ('time', Time),
+ ('x', c_int),
+ ('y', c_int),
+ ('x_root', c_int),
+ ('y_root', c_int),
+ ('state', c_uint),
+ ('button', c_uint),
+ ('same_screen', c_int),
+]
+
+XButtonEvent = struct_anon_38 # /usr/include/X11/Xlib.h:600
+XButtonPressedEvent = XButtonEvent # /usr/include/X11/Xlib.h:601
+XButtonReleasedEvent = XButtonEvent # /usr/include/X11/Xlib.h:602
+class struct_anon_39(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'root',
+ 'subwindow',
+ 'time',
+ 'x',
+ 'y',
+ 'x_root',
+ 'y_root',
+ 'state',
+ 'is_hint',
+ 'same_screen',
+ ]
+struct_anon_39._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('root', Window),
+ ('subwindow', Window),
+ ('time', Time),
+ ('x', c_int),
+ ('y', c_int),
+ ('x_root', c_int),
+ ('y_root', c_int),
+ ('state', c_uint),
+ ('is_hint', c_char),
+ ('same_screen', c_int),
+]
+
+XMotionEvent = struct_anon_39 # /usr/include/X11/Xlib.h:618
+XPointerMovedEvent = XMotionEvent # /usr/include/X11/Xlib.h:619
+class struct_anon_40(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'root',
+ 'subwindow',
+ 'time',
+ 'x',
+ 'y',
+ 'x_root',
+ 'y_root',
+ 'mode',
+ 'detail',
+ 'same_screen',
+ 'focus',
+ 'state',
+ ]
+struct_anon_40._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('root', Window),
+ ('subwindow', Window),
+ ('time', Time),
+ ('x', c_int),
+ ('y', c_int),
+ ('x_root', c_int),
+ ('y_root', c_int),
+ ('mode', c_int),
+ ('detail', c_int),
+ ('same_screen', c_int),
+ ('focus', c_int),
+ ('state', c_uint),
+]
+
+XCrossingEvent = struct_anon_40 # /usr/include/X11/Xlib.h:641
+XEnterWindowEvent = XCrossingEvent # /usr/include/X11/Xlib.h:642
+XLeaveWindowEvent = XCrossingEvent # /usr/include/X11/Xlib.h:643
+class struct_anon_41(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'mode',
+ 'detail',
+ ]
+struct_anon_41._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('mode', c_int),
+ ('detail', c_int),
+]
+
+XFocusChangeEvent = struct_anon_41 # /usr/include/X11/Xlib.h:659
+XFocusInEvent = XFocusChangeEvent # /usr/include/X11/Xlib.h:660
+XFocusOutEvent = XFocusChangeEvent # /usr/include/X11/Xlib.h:661
+class struct_anon_42(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'key_vector',
+ ]
+struct_anon_42._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('key_vector', c_char * 32),
+]
+
+XKeymapEvent = struct_anon_42 # /usr/include/X11/Xlib.h:671
+class struct_anon_43(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'count',
+ ]
+struct_anon_43._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('count', c_int),
+]
+
+XExposeEvent = struct_anon_43 # /usr/include/X11/Xlib.h:682
+class struct_anon_44(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'drawable',
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'count',
+ 'major_code',
+ 'minor_code',
+ ]
+struct_anon_44._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('drawable', Drawable),
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('count', c_int),
+ ('major_code', c_int),
+ ('minor_code', c_int),
+]
+
+XGraphicsExposeEvent = struct_anon_44 # /usr/include/X11/Xlib.h:695
+class struct_anon_45(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'drawable',
+ 'major_code',
+ 'minor_code',
+ ]
+struct_anon_45._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('drawable', Drawable),
+ ('major_code', c_int),
+ ('minor_code', c_int),
+]
+
+XNoExposeEvent = struct_anon_45 # /usr/include/X11/Xlib.h:705
+class struct_anon_46(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'state',
+ ]
+struct_anon_46._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('state', c_int),
+]
+
+XVisibilityEvent = struct_anon_46 # /usr/include/X11/Xlib.h:714
+class struct_anon_47(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'parent',
+ 'window',
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'border_width',
+ 'override_redirect',
+ ]
+struct_anon_47._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('parent', Window),
+ ('window', Window),
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('border_width', c_int),
+ ('override_redirect', c_int),
+]
+
+XCreateWindowEvent = struct_anon_47 # /usr/include/X11/Xlib.h:727
+class struct_anon_48(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'event',
+ 'window',
+ ]
+struct_anon_48._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('event', Window),
+ ('window', Window),
+]
+
+XDestroyWindowEvent = struct_anon_48 # /usr/include/X11/Xlib.h:736
+class struct_anon_49(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'event',
+ 'window',
+ 'from_configure',
+ ]
+struct_anon_49._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('event', Window),
+ ('window', Window),
+ ('from_configure', c_int),
+]
+
+XUnmapEvent = struct_anon_49 # /usr/include/X11/Xlib.h:746
+class struct_anon_50(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'event',
+ 'window',
+ 'override_redirect',
+ ]
+struct_anon_50._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('event', Window),
+ ('window', Window),
+ ('override_redirect', c_int),
+]
+
+XMapEvent = struct_anon_50 # /usr/include/X11/Xlib.h:756
+class struct_anon_51(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'parent',
+ 'window',
+ ]
+struct_anon_51._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('parent', Window),
+ ('window', Window),
+]
+
+XMapRequestEvent = struct_anon_51 # /usr/include/X11/Xlib.h:765
+class struct_anon_52(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'event',
+ 'window',
+ 'parent',
+ 'x',
+ 'y',
+ 'override_redirect',
+ ]
+struct_anon_52._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('event', Window),
+ ('window', Window),
+ ('parent', Window),
+ ('x', c_int),
+ ('y', c_int),
+ ('override_redirect', c_int),
+]
+
+XReparentEvent = struct_anon_52 # /usr/include/X11/Xlib.h:777
+class struct_anon_53(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'event',
+ 'window',
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'border_width',
+ 'above',
+ 'override_redirect',
+ ]
+struct_anon_53._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('event', Window),
+ ('window', Window),
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('border_width', c_int),
+ ('above', Window),
+ ('override_redirect', c_int),
+]
+
+XConfigureEvent = struct_anon_53 # /usr/include/X11/Xlib.h:791
+class struct_anon_54(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'event',
+ 'window',
+ 'x',
+ 'y',
+ ]
+struct_anon_54._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('event', Window),
+ ('window', Window),
+ ('x', c_int),
+ ('y', c_int),
+]
+
+XGravityEvent = struct_anon_54 # /usr/include/X11/Xlib.h:801
+class struct_anon_55(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'width',
+ 'height',
+ ]
+struct_anon_55._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('width', c_int),
+ ('height', c_int),
+]
+
+XResizeRequestEvent = struct_anon_55 # /usr/include/X11/Xlib.h:810
+class struct_anon_56(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'parent',
+ 'window',
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'border_width',
+ 'above',
+ 'detail',
+ 'value_mask',
+ ]
+struct_anon_56._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('parent', Window),
+ ('window', Window),
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('border_width', c_int),
+ ('above', Window),
+ ('detail', c_int),
+ ('value_mask', c_ulong),
+]
+
+XConfigureRequestEvent = struct_anon_56 # /usr/include/X11/Xlib.h:825
+class struct_anon_57(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'event',
+ 'window',
+ 'place',
+ ]
+struct_anon_57._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('event', Window),
+ ('window', Window),
+ ('place', c_int),
+]
+
+XCirculateEvent = struct_anon_57 # /usr/include/X11/Xlib.h:835
+class struct_anon_58(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'parent',
+ 'window',
+ 'place',
+ ]
+struct_anon_58._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('parent', Window),
+ ('window', Window),
+ ('place', c_int),
+]
+
+XCirculateRequestEvent = struct_anon_58 # /usr/include/X11/Xlib.h:845
+class struct_anon_59(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'atom',
+ 'time',
+ 'state',
+ ]
+struct_anon_59._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('atom', Atom),
+ ('time', Time),
+ ('state', c_int),
+]
+
+XPropertyEvent = struct_anon_59 # /usr/include/X11/Xlib.h:856
+class struct_anon_60(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'selection',
+ 'time',
+ ]
+struct_anon_60._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('selection', Atom),
+ ('time', Time),
+]
+
+XSelectionClearEvent = struct_anon_60 # /usr/include/X11/Xlib.h:866
+class struct_anon_61(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'owner',
+ 'requestor',
+ 'selection',
+ 'target',
+ 'property',
+ 'time',
+ ]
+struct_anon_61._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('owner', Window),
+ ('requestor', Window),
+ ('selection', Atom),
+ ('target', Atom),
+ ('property', Atom),
+ ('time', Time),
+]
+
+XSelectionRequestEvent = struct_anon_61 # /usr/include/X11/Xlib.h:879
+class struct_anon_62(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'requestor',
+ 'selection',
+ 'target',
+ 'property',
+ 'time',
+ ]
+struct_anon_62._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('requestor', Window),
+ ('selection', Atom),
+ ('target', Atom),
+ ('property', Atom),
+ ('time', Time),
+]
+
+XSelectionEvent = struct_anon_62 # /usr/include/X11/Xlib.h:891
+class struct_anon_63(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'colormap',
+ 'new',
+ 'state',
+ ]
+struct_anon_63._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('colormap', Colormap),
+ ('new', c_int),
+ ('state', c_int),
+]
+
+XColormapEvent = struct_anon_63 # /usr/include/X11/Xlib.h:906
+class struct_anon_64(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'message_type',
+ 'format',
+ 'data',
+ ]
+class struct_anon_65(Union):
+ __slots__ = [
+ 'b',
+ 's',
+ 'l',
+ ]
+struct_anon_65._fields_ = [
+ ('b', c_char * 20),
+ ('s', c_short * 10),
+ ('l', c_long * 5),
+]
+
+struct_anon_64._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('message_type', Atom),
+ ('format', c_int),
+ ('data', struct_anon_65),
+]
+
+XClientMessageEvent = struct_anon_64 # /usr/include/X11/Xlib.h:921
+class struct_anon_66(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'request',
+ 'first_keycode',
+ 'count',
+ ]
+struct_anon_66._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('request', c_int),
+ ('first_keycode', c_int),
+ ('count', c_int),
+]
+
+XMappingEvent = struct_anon_66 # /usr/include/X11/Xlib.h:933
+class struct_anon_67(Structure):
+ __slots__ = [
+ 'type',
+ 'display',
+ 'resourceid',
+ 'serial',
+ 'error_code',
+ 'request_code',
+ 'minor_code',
+ ]
+struct_anon_67._fields_ = [
+ ('type', c_int),
+ ('display', POINTER(Display)),
+ ('resourceid', XID),
+ ('serial', c_ulong),
+ ('error_code', c_ubyte),
+ ('request_code', c_ubyte),
+ ('minor_code', c_ubyte),
+]
+
+XErrorEvent = struct_anon_67 # /usr/include/X11/Xlib.h:943
+class struct_anon_68(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ ]
+struct_anon_68._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+]
+
+XAnyEvent = struct_anon_68 # /usr/include/X11/Xlib.h:951
+class struct_anon_69(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'extension',
+ 'evtype',
+ ]
+struct_anon_69._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('extension', c_int),
+ ('evtype', c_int),
+]
+
+XGenericEvent = struct_anon_69 # /usr/include/X11/Xlib.h:967
+class struct_anon_70(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'extension',
+ 'evtype',
+ 'cookie',
+ 'data',
+ ]
+struct_anon_70._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('extension', c_int),
+ ('evtype', c_int),
+ ('cookie', c_uint),
+ ('data', POINTER(None)),
+]
+
+XGenericEventCookie = struct_anon_70 # /usr/include/X11/Xlib.h:978
+class struct__XEvent(Union):
+ __slots__ = [
+ 'type',
+ 'xany',
+ 'xkey',
+ 'xbutton',
+ 'xmotion',
+ 'xcrossing',
+ 'xfocus',
+ 'xexpose',
+ 'xgraphicsexpose',
+ 'xnoexpose',
+ 'xvisibility',
+ 'xcreatewindow',
+ 'xdestroywindow',
+ 'xunmap',
+ 'xmap',
+ 'xmaprequest',
+ 'xreparent',
+ 'xconfigure',
+ 'xgravity',
+ 'xresizerequest',
+ 'xconfigurerequest',
+ 'xcirculate',
+ 'xcirculaterequest',
+ 'xproperty',
+ 'xselectionclear',
+ 'xselectionrequest',
+ 'xselection',
+ 'xcolormap',
+ 'xclient',
+ 'xmapping',
+ 'xerror',
+ 'xkeymap',
+ 'xgeneric',
+ 'xcookie',
+ 'pad',
+ ]
+struct__XEvent._fields_ = [
+ ('type', c_int),
+ ('xany', XAnyEvent),
+ ('xkey', XKeyEvent),
+ ('xbutton', XButtonEvent),
+ ('xmotion', XMotionEvent),
+ ('xcrossing', XCrossingEvent),
+ ('xfocus', XFocusChangeEvent),
+ ('xexpose', XExposeEvent),
+ ('xgraphicsexpose', XGraphicsExposeEvent),
+ ('xnoexpose', XNoExposeEvent),
+ ('xvisibility', XVisibilityEvent),
+ ('xcreatewindow', XCreateWindowEvent),
+ ('xdestroywindow', XDestroyWindowEvent),
+ ('xunmap', XUnmapEvent),
+ ('xmap', XMapEvent),
+ ('xmaprequest', XMapRequestEvent),
+ ('xreparent', XReparentEvent),
+ ('xconfigure', XConfigureEvent),
+ ('xgravity', XGravityEvent),
+ ('xresizerequest', XResizeRequestEvent),
+ ('xconfigurerequest', XConfigureRequestEvent),
+ ('xcirculate', XCirculateEvent),
+ ('xcirculaterequest', XCirculateRequestEvent),
+ ('xproperty', XPropertyEvent),
+ ('xselectionclear', XSelectionClearEvent),
+ ('xselectionrequest', XSelectionRequestEvent),
+ ('xselection', XSelectionEvent),
+ ('xcolormap', XColormapEvent),
+ ('xclient', XClientMessageEvent),
+ ('xmapping', XMappingEvent),
+ ('xerror', XErrorEvent),
+ ('xkeymap', XKeymapEvent),
+ ('xgeneric', XGenericEvent),
+ ('xcookie', XGenericEventCookie),
+ ('pad', c_long * 24),
+]
+
+XEvent = struct__XEvent # /usr/include/X11/Xlib.h:1020
+class struct_anon_71(Structure):
+ __slots__ = [
+ 'lbearing',
+ 'rbearing',
+ 'width',
+ 'ascent',
+ 'descent',
+ 'attributes',
+ ]
+struct_anon_71._fields_ = [
+ ('lbearing', c_short),
+ ('rbearing', c_short),
+ ('width', c_short),
+ ('ascent', c_short),
+ ('descent', c_short),
+ ('attributes', c_ushort),
+]
+
+XCharStruct = struct_anon_71 # /usr/include/X11/Xlib.h:1035
+class struct_anon_72(Structure):
+ __slots__ = [
+ 'name',
+ 'card32',
+ ]
+struct_anon_72._fields_ = [
+ ('name', Atom),
+ ('card32', c_ulong),
+]
+
+XFontProp = struct_anon_72 # /usr/include/X11/Xlib.h:1044
+class struct_anon_73(Structure):
+ __slots__ = [
+ 'ext_data',
+ 'fid',
+ 'direction',
+ 'min_char_or_byte2',
+ 'max_char_or_byte2',
+ 'min_byte1',
+ 'max_byte1',
+ 'all_chars_exist',
+ 'default_char',
+ 'n_properties',
+ 'properties',
+ 'min_bounds',
+ 'max_bounds',
+ 'per_char',
+ 'ascent',
+ 'descent',
+ ]
+struct_anon_73._fields_ = [
+ ('ext_data', POINTER(XExtData)),
+ ('fid', Font),
+ ('direction', c_uint),
+ ('min_char_or_byte2', c_uint),
+ ('max_char_or_byte2', c_uint),
+ ('min_byte1', c_uint),
+ ('max_byte1', c_uint),
+ ('all_chars_exist', c_int),
+ ('default_char', c_uint),
+ ('n_properties', c_int),
+ ('properties', POINTER(XFontProp)),
+ ('min_bounds', XCharStruct),
+ ('max_bounds', XCharStruct),
+ ('per_char', POINTER(XCharStruct)),
+ ('ascent', c_int),
+ ('descent', c_int),
+]
+
+XFontStruct = struct_anon_73 # /usr/include/X11/Xlib.h:1063
+class struct_anon_74(Structure):
+ __slots__ = [
+ 'chars',
+ 'nchars',
+ 'delta',
+ 'font',
+ ]
+struct_anon_74._fields_ = [
+ ('chars', c_char_p),
+ ('nchars', c_int),
+ ('delta', c_int),
+ ('font', Font),
+]
+
+XTextItem = struct_anon_74 # /usr/include/X11/Xlib.h:1073
+class struct_anon_75(Structure):
+ __slots__ = [
+ 'byte1',
+ 'byte2',
+ ]
+struct_anon_75._fields_ = [
+ ('byte1', c_ubyte),
+ ('byte2', c_ubyte),
+]
+
+XChar2b = struct_anon_75 # /usr/include/X11/Xlib.h:1078
+class struct_anon_76(Structure):
+ __slots__ = [
+ 'chars',
+ 'nchars',
+ 'delta',
+ 'font',
+ ]
+struct_anon_76._fields_ = [
+ ('chars', POINTER(XChar2b)),
+ ('nchars', c_int),
+ ('delta', c_int),
+ ('font', Font),
+]
+
+XTextItem16 = struct_anon_76 # /usr/include/X11/Xlib.h:1085
+class struct_anon_77(Union):
+ __slots__ = [
+ 'display',
+ 'gc',
+ 'visual',
+ 'screen',
+ 'pixmap_format',
+ 'font',
+ ]
+struct_anon_77._fields_ = [
+ ('display', POINTER(Display)),
+ ('gc', GC),
+ ('visual', POINTER(Visual)),
+ ('screen', POINTER(Screen)),
+ ('pixmap_format', POINTER(ScreenFormat)),
+ ('font', POINTER(XFontStruct)),
+]
+
+XEDataObject = struct_anon_77 # /usr/include/X11/Xlib.h:1093
+class struct_anon_78(Structure):
+ __slots__ = [
+ 'max_ink_extent',
+ 'max_logical_extent',
+ ]
+struct_anon_78._fields_ = [
+ ('max_ink_extent', XRectangle),
+ ('max_logical_extent', XRectangle),
+]
+
+XFontSetExtents = struct_anon_78 # /usr/include/X11/Xlib.h:1098
+class struct__XOM(Structure):
+ __slots__ = [
+ ]
+struct__XOM._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XOM(Structure):
+ __slots__ = [
+ ]
+struct__XOM._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XOM = POINTER(struct__XOM) # /usr/include/X11/Xlib.h:1104
+class struct__XOC(Structure):
+ __slots__ = [
+ ]
+struct__XOC._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XOC(Structure):
+ __slots__ = [
+ ]
+struct__XOC._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XOC = POINTER(struct__XOC) # /usr/include/X11/Xlib.h:1105
+class struct__XOC(Structure):
+ __slots__ = [
+ ]
+struct__XOC._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XOC(Structure):
+ __slots__ = [
+ ]
+struct__XOC._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XFontSet = POINTER(struct__XOC) # /usr/include/X11/Xlib.h:1105
+class struct_anon_79(Structure):
+ __slots__ = [
+ 'chars',
+ 'nchars',
+ 'delta',
+ 'font_set',
+ ]
+struct_anon_79._fields_ = [
+ ('chars', c_char_p),
+ ('nchars', c_int),
+ ('delta', c_int),
+ ('font_set', XFontSet),
+]
+
+XmbTextItem = struct_anon_79 # /usr/include/X11/Xlib.h:1112
+class struct_anon_80(Structure):
+ __slots__ = [
+ 'chars',
+ 'nchars',
+ 'delta',
+ 'font_set',
+ ]
+struct_anon_80._fields_ = [
+ ('chars', c_wchar_p),
+ ('nchars', c_int),
+ ('delta', c_int),
+ ('font_set', XFontSet),
+]
+
+XwcTextItem = struct_anon_80 # /usr/include/X11/Xlib.h:1119
+class struct_anon_81(Structure):
+ __slots__ = [
+ 'charset_count',
+ 'charset_list',
+ ]
+struct_anon_81._fields_ = [
+ ('charset_count', c_int),
+ ('charset_list', POINTER(c_char_p)),
+]
+
+XOMCharSetList = struct_anon_81 # /usr/include/X11/Xlib.h:1135
+enum_anon_82 = c_int
+XOMOrientation_LTR_TTB = 0
+XOMOrientation_RTL_TTB = 1
+XOMOrientation_TTB_LTR = 2
+XOMOrientation_TTB_RTL = 3
+XOMOrientation_Context = 4
+XOrientation = enum_anon_82 # /usr/include/X11/Xlib.h:1143
+class struct_anon_83(Structure):
+ __slots__ = [
+ 'num_orientation',
+ 'orientation',
+ ]
+struct_anon_83._fields_ = [
+ ('num_orientation', c_int),
+ ('orientation', POINTER(XOrientation)),
+]
+
+XOMOrientation = struct_anon_83 # /usr/include/X11/Xlib.h:1148
+class struct_anon_84(Structure):
+ __slots__ = [
+ 'num_font',
+ 'font_struct_list',
+ 'font_name_list',
+ ]
+struct_anon_84._fields_ = [
+ ('num_font', c_int),
+ ('font_struct_list', POINTER(POINTER(XFontStruct))),
+ ('font_name_list', POINTER(c_char_p)),
+]
+
+XOMFontInfo = struct_anon_84 # /usr/include/X11/Xlib.h:1154
+class struct__XIM(Structure):
+ __slots__ = [
+ ]
+struct__XIM._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XIM(Structure):
+ __slots__ = [
+ ]
+struct__XIM._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XIM = POINTER(struct__XIM) # /usr/include/X11/Xlib.h:1156
+class struct__XIC(Structure):
+ __slots__ = [
+ ]
+struct__XIC._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XIC(Structure):
+ __slots__ = [
+ ]
+struct__XIC._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XIC = POINTER(struct__XIC) # /usr/include/X11/Xlib.h:1157
+XIMProc = CFUNCTYPE(None, XIM, XPointer, XPointer) # /usr/include/X11/Xlib.h:1159
+XICProc = CFUNCTYPE(c_int, XIC, XPointer, XPointer) # /usr/include/X11/Xlib.h:1165
+XIDProc = CFUNCTYPE(None, POINTER(Display), XPointer, XPointer) # /usr/include/X11/Xlib.h:1171
+XIMStyle = c_ulong # /usr/include/X11/Xlib.h:1177
+class struct_anon_85(Structure):
+ __slots__ = [
+ 'count_styles',
+ 'supported_styles',
+ ]
+struct_anon_85._fields_ = [
+ ('count_styles', c_ushort),
+ ('supported_styles', POINTER(XIMStyle)),
+]
+
+XIMStyles = struct_anon_85 # /usr/include/X11/Xlib.h:1182
+XIMPreeditArea = 1 # /usr/include/X11/Xlib.h:1184
+XIMPreeditCallbacks = 2 # /usr/include/X11/Xlib.h:1185
+XIMPreeditPosition = 4 # /usr/include/X11/Xlib.h:1186
+XIMPreeditNothing = 8 # /usr/include/X11/Xlib.h:1187
+XIMPreeditNone = 16 # /usr/include/X11/Xlib.h:1188
+XIMStatusArea = 256 # /usr/include/X11/Xlib.h:1189
+XIMStatusCallbacks = 512 # /usr/include/X11/Xlib.h:1190
+XIMStatusNothing = 1024 # /usr/include/X11/Xlib.h:1191
+XIMStatusNone = 2048 # /usr/include/X11/Xlib.h:1192
+XBufferOverflow = -1 # /usr/include/X11/Xlib.h:1238
+XLookupNone = 1 # /usr/include/X11/Xlib.h:1239
+XLookupChars = 2 # /usr/include/X11/Xlib.h:1240
+XLookupKeySym = 3 # /usr/include/X11/Xlib.h:1241
+XLookupBoth = 4 # /usr/include/X11/Xlib.h:1242
+XVaNestedList = POINTER(None) # /usr/include/X11/Xlib.h:1244
+class struct_anon_86(Structure):
+ __slots__ = [
+ 'client_data',
+ 'callback',
+ ]
+struct_anon_86._fields_ = [
+ ('client_data', XPointer),
+ ('callback', XIMProc),
+]
+
+XIMCallback = struct_anon_86 # /usr/include/X11/Xlib.h:1249
+class struct_anon_87(Structure):
+ __slots__ = [
+ 'client_data',
+ 'callback',
+ ]
+struct_anon_87._fields_ = [
+ ('client_data', XPointer),
+ ('callback', XICProc),
+]
+
+XICCallback = struct_anon_87 # /usr/include/X11/Xlib.h:1254
+XIMFeedback = c_ulong # /usr/include/X11/Xlib.h:1256
+XIMReverse = 1 # /usr/include/X11/Xlib.h:1258
+XIMUnderline = 2 # /usr/include/X11/Xlib.h:1259
+XIMHighlight = 4 # /usr/include/X11/Xlib.h:1260
+XIMPrimary = 32 # /usr/include/X11/Xlib.h:1261
+XIMSecondary = 64 # /usr/include/X11/Xlib.h:1262
+XIMTertiary = 128 # /usr/include/X11/Xlib.h:1263
+XIMVisibleToForward = 256 # /usr/include/X11/Xlib.h:1264
+XIMVisibleToBackword = 512 # /usr/include/X11/Xlib.h:1265
+XIMVisibleToCenter = 1024 # /usr/include/X11/Xlib.h:1266
+class struct__XIMText(Structure):
+ __slots__ = [
+ 'length',
+ 'feedback',
+ 'encoding_is_wchar',
+ 'string',
+ ]
+class struct_anon_88(Union):
+ __slots__ = [
+ 'multi_byte',
+ 'wide_char',
+ ]
+struct_anon_88._fields_ = [
+ ('multi_byte', c_char_p),
+ ('wide_char', c_wchar_p),
+]
+
+struct__XIMText._fields_ = [
+ ('length', c_ushort),
+ ('feedback', POINTER(XIMFeedback)),
+ ('encoding_is_wchar', c_int),
+ ('string', struct_anon_88),
+]
+
+XIMText = struct__XIMText # /usr/include/X11/Xlib.h:1276
+XIMPreeditState = c_ulong # /usr/include/X11/Xlib.h:1278
+XIMPreeditUnKnown = 0 # /usr/include/X11/Xlib.h:1280
+XIMPreeditEnable = 1 # /usr/include/X11/Xlib.h:1281
+XIMPreeditDisable = 2 # /usr/include/X11/Xlib.h:1282
+class struct__XIMPreeditStateNotifyCallbackStruct(Structure):
+ __slots__ = [
+ 'state',
+ ]
+struct__XIMPreeditStateNotifyCallbackStruct._fields_ = [
+ ('state', XIMPreeditState),
+]
+
+XIMPreeditStateNotifyCallbackStruct = struct__XIMPreeditStateNotifyCallbackStruct # /usr/include/X11/Xlib.h:1286
+XIMResetState = c_ulong # /usr/include/X11/Xlib.h:1288
+XIMInitialState = 1 # /usr/include/X11/Xlib.h:1290
+XIMPreserveState = 2 # /usr/include/X11/Xlib.h:1291
+XIMStringConversionFeedback = c_ulong # /usr/include/X11/Xlib.h:1293
+XIMStringConversionLeftEdge = 1 # /usr/include/X11/Xlib.h:1295
+XIMStringConversionRightEdge = 2 # /usr/include/X11/Xlib.h:1296
+XIMStringConversionTopEdge = 4 # /usr/include/X11/Xlib.h:1297
+XIMStringConversionBottomEdge = 8 # /usr/include/X11/Xlib.h:1298
+XIMStringConversionConcealed = 16 # /usr/include/X11/Xlib.h:1299
+XIMStringConversionWrapped = 32 # /usr/include/X11/Xlib.h:1300
+class struct__XIMStringConversionText(Structure):
+ __slots__ = [
+ 'length',
+ 'feedback',
+ 'encoding_is_wchar',
+ 'string',
+ ]
+class struct_anon_89(Union):
+ __slots__ = [
+ 'mbs',
+ 'wcs',
+ ]
+struct_anon_89._fields_ = [
+ ('mbs', c_char_p),
+ ('wcs', c_wchar_p),
+]
+
+struct__XIMStringConversionText._fields_ = [
+ ('length', c_ushort),
+ ('feedback', POINTER(XIMStringConversionFeedback)),
+ ('encoding_is_wchar', c_int),
+ ('string', struct_anon_89),
+]
+
+XIMStringConversionText = struct__XIMStringConversionText # /usr/include/X11/Xlib.h:1310
+XIMStringConversionPosition = c_ushort # /usr/include/X11/Xlib.h:1312
+XIMStringConversionType = c_ushort # /usr/include/X11/Xlib.h:1314
+XIMStringConversionBuffer = 1 # /usr/include/X11/Xlib.h:1316
+XIMStringConversionLine = 2 # /usr/include/X11/Xlib.h:1317
+XIMStringConversionWord = 3 # /usr/include/X11/Xlib.h:1318
+XIMStringConversionChar = 4 # /usr/include/X11/Xlib.h:1319
+XIMStringConversionOperation = c_ushort # /usr/include/X11/Xlib.h:1321
+XIMStringConversionSubstitution = 1 # /usr/include/X11/Xlib.h:1323
+XIMStringConversionRetrieval = 2 # /usr/include/X11/Xlib.h:1324
+enum_anon_90 = c_int
+XIMForwardChar = 0
+XIMBackwardChar = 1
+XIMForwardWord = 2
+XIMBackwardWord = 3
+XIMCaretUp = 4
+XIMCaretDown = 5
+XIMNextLine = 6
+XIMPreviousLine = 7
+XIMLineStart = 8
+XIMLineEnd = 9
+XIMAbsolutePosition = 10
+XIMDontChange = 11
+XIMCaretDirection = enum_anon_90 # /usr/include/X11/Xlib.h:1334
+class struct__XIMStringConversionCallbackStruct(Structure):
+ __slots__ = [
+ 'position',
+ 'direction',
+ 'operation',
+ 'factor',
+ 'text',
+ ]
+struct__XIMStringConversionCallbackStruct._fields_ = [
+ ('position', XIMStringConversionPosition),
+ ('direction', XIMCaretDirection),
+ ('operation', XIMStringConversionOperation),
+ ('factor', c_ushort),
+ ('text', POINTER(XIMStringConversionText)),
+]
+
+XIMStringConversionCallbackStruct = struct__XIMStringConversionCallbackStruct # /usr/include/X11/Xlib.h:1342
+class struct__XIMPreeditDrawCallbackStruct(Structure):
+ __slots__ = [
+ 'caret',
+ 'chg_first',
+ 'chg_length',
+ 'text',
+ ]
+struct__XIMPreeditDrawCallbackStruct._fields_ = [
+ ('caret', c_int),
+ ('chg_first', c_int),
+ ('chg_length', c_int),
+ ('text', POINTER(XIMText)),
+]
+
+XIMPreeditDrawCallbackStruct = struct__XIMPreeditDrawCallbackStruct # /usr/include/X11/Xlib.h:1349
+enum_anon_91 = c_int
+XIMIsInvisible = 0
+XIMIsPrimary = 1
+XIMIsSecondary = 2
+XIMCaretStyle = enum_anon_91 # /usr/include/X11/Xlib.h:1355
+class struct__XIMPreeditCaretCallbackStruct(Structure):
+ __slots__ = [
+ 'position',
+ 'direction',
+ 'style',
+ ]
+struct__XIMPreeditCaretCallbackStruct._fields_ = [
+ ('position', c_int),
+ ('direction', XIMCaretDirection),
+ ('style', XIMCaretStyle),
+]
+
+XIMPreeditCaretCallbackStruct = struct__XIMPreeditCaretCallbackStruct # /usr/include/X11/Xlib.h:1361
+enum_anon_92 = c_int
+XIMTextType = 0
+XIMBitmapType = 1
+XIMStatusDataType = enum_anon_92 # /usr/include/X11/Xlib.h:1366
+class struct__XIMStatusDrawCallbackStruct(Structure):
+ __slots__ = [
+ 'type',
+ 'data',
+ ]
+class struct_anon_93(Union):
+ __slots__ = [
+ 'text',
+ 'bitmap',
+ ]
+struct_anon_93._fields_ = [
+ ('text', POINTER(XIMText)),
+ ('bitmap', Pixmap),
+]
+
+struct__XIMStatusDrawCallbackStruct._fields_ = [
+ ('type', XIMStatusDataType),
+ ('data', struct_anon_93),
+]
+
+XIMStatusDrawCallbackStruct = struct__XIMStatusDrawCallbackStruct # /usr/include/X11/Xlib.h:1374
+class struct__XIMHotKeyTrigger(Structure):
+ __slots__ = [
+ 'keysym',
+ 'modifier',
+ 'modifier_mask',
+ ]
+struct__XIMHotKeyTrigger._fields_ = [
+ ('keysym', KeySym),
+ ('modifier', c_int),
+ ('modifier_mask', c_int),
+]
+
+XIMHotKeyTrigger = struct__XIMHotKeyTrigger # /usr/include/X11/Xlib.h:1380
+class struct__XIMHotKeyTriggers(Structure):
+ __slots__ = [
+ 'num_hot_key',
+ 'key',
+ ]
+struct__XIMHotKeyTriggers._fields_ = [
+ ('num_hot_key', c_int),
+ ('key', POINTER(XIMHotKeyTrigger)),
+]
+
+XIMHotKeyTriggers = struct__XIMHotKeyTriggers # /usr/include/X11/Xlib.h:1385
+XIMHotKeyState = c_ulong # /usr/include/X11/Xlib.h:1387
+XIMHotKeyStateON = 1 # /usr/include/X11/Xlib.h:1389
+XIMHotKeyStateOFF = 2 # /usr/include/X11/Xlib.h:1390
+class struct_anon_94(Structure):
+ __slots__ = [
+ 'count_values',
+ 'supported_values',
+ ]
+struct_anon_94._fields_ = [
+ ('count_values', c_ushort),
+ ('supported_values', POINTER(c_char_p)),
+]
+
+XIMValuesList = struct_anon_94 # /usr/include/X11/Xlib.h:1395
+# /usr/include/X11/Xlib.h:1405
+XLoadQueryFont = _lib.XLoadQueryFont
+XLoadQueryFont.restype = POINTER(XFontStruct)
+XLoadQueryFont.argtypes = [POINTER(Display), c_char_p]
+
+# /usr/include/X11/Xlib.h:1410
+XQueryFont = _lib.XQueryFont
+XQueryFont.restype = POINTER(XFontStruct)
+XQueryFont.argtypes = [POINTER(Display), XID]
+
+# /usr/include/X11/Xlib.h:1416
+XGetMotionEvents = _lib.XGetMotionEvents
+XGetMotionEvents.restype = POINTER(XTimeCoord)
+XGetMotionEvents.argtypes = [POINTER(Display), Window, Time, Time, POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1424
+XDeleteModifiermapEntry = _lib.XDeleteModifiermapEntry
+XDeleteModifiermapEntry.restype = POINTER(XModifierKeymap)
+XDeleteModifiermapEntry.argtypes = [POINTER(XModifierKeymap), KeyCode, c_int]
+
+# /usr/include/X11/Xlib.h:1434
+XGetModifierMapping = _lib.XGetModifierMapping
+XGetModifierMapping.restype = POINTER(XModifierKeymap)
+XGetModifierMapping.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1438
+XInsertModifiermapEntry = _lib.XInsertModifiermapEntry
+XInsertModifiermapEntry.restype = POINTER(XModifierKeymap)
+XInsertModifiermapEntry.argtypes = [POINTER(XModifierKeymap), KeyCode, c_int]
+
+# /usr/include/X11/Xlib.h:1448
+XNewModifiermap = _lib.XNewModifiermap
+XNewModifiermap.restype = POINTER(XModifierKeymap)
+XNewModifiermap.argtypes = [c_int]
+
+# /usr/include/X11/Xlib.h:1452
+XCreateImage = _lib.XCreateImage
+XCreateImage.restype = POINTER(XImage)
+XCreateImage.argtypes = [POINTER(Display), POINTER(Visual), c_uint, c_int, c_int, c_char_p, c_uint, c_uint, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:1464
+XInitImage = _lib.XInitImage
+XInitImage.restype = c_int
+XInitImage.argtypes = [POINTER(XImage)]
+
+# /usr/include/X11/Xlib.h:1467
+XGetImage = _lib.XGetImage
+XGetImage.restype = POINTER(XImage)
+XGetImage.argtypes = [POINTER(Display), Drawable, c_int, c_int, c_uint, c_uint, c_ulong, c_int]
+
+# /usr/include/X11/Xlib.h:1477
+XGetSubImage = _lib.XGetSubImage
+XGetSubImage.restype = POINTER(XImage)
+XGetSubImage.argtypes = [POINTER(Display), Drawable, c_int, c_int, c_uint, c_uint, c_ulong, c_int, POINTER(XImage), c_int, c_int]
+
+# /usr/include/X11/Xlib.h:1494
+XOpenDisplay = _lib.XOpenDisplay
+XOpenDisplay.restype = POINTER(Display)
+XOpenDisplay.argtypes = [c_char_p]
+
+# /usr/include/X11/Xlib.h:1498
+XrmInitialize = _lib.XrmInitialize
+XrmInitialize.restype = None
+XrmInitialize.argtypes = []
+
+# /usr/include/X11/Xlib.h:1502
+XFetchBytes = _lib.XFetchBytes
+XFetchBytes.restype = c_char_p
+XFetchBytes.argtypes = [POINTER(Display), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1506
+XFetchBuffer = _lib.XFetchBuffer
+XFetchBuffer.restype = c_char_p
+XFetchBuffer.argtypes = [POINTER(Display), POINTER(c_int), c_int]
+
+# /usr/include/X11/Xlib.h:1511
+XGetAtomName = _lib.XGetAtomName
+XGetAtomName.restype = c_char_p
+XGetAtomName.argtypes = [POINTER(Display), Atom]
+
+# /usr/include/X11/Xlib.h:1515
+XGetAtomNames = _lib.XGetAtomNames
+XGetAtomNames.restype = c_int
+XGetAtomNames.argtypes = [POINTER(Display), POINTER(Atom), c_int, POINTER(c_char_p)]
+
+# /usr/include/X11/Xlib.h:1521
+XGetDefault = _lib.XGetDefault
+XGetDefault.restype = c_char_p
+XGetDefault.argtypes = [POINTER(Display), c_char_p, c_char_p]
+
+# /usr/include/X11/Xlib.h:1526
+XDisplayName = _lib.XDisplayName
+XDisplayName.restype = c_char_p
+XDisplayName.argtypes = [c_char_p]
+
+# /usr/include/X11/Xlib.h:1529
+XKeysymToString = _lib.XKeysymToString
+XKeysymToString.restype = c_char_p
+XKeysymToString.argtypes = [KeySym]
+
+# /usr/include/X11/Xlib.h:1533
+XSynchronize = _lib.XSynchronize
+XSynchronize.restype = POINTER(CFUNCTYPE(c_int, POINTER(Display)))
+XSynchronize.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:1539
+XSetAfterFunction = _lib.XSetAfterFunction
+XSetAfterFunction.restype = POINTER(CFUNCTYPE(c_int, POINTER(Display)))
+XSetAfterFunction.argtypes = [POINTER(Display), CFUNCTYPE(c_int, POINTER(Display))]
+
+# /usr/include/X11/Xlib.h:1547
+XInternAtom = _lib.XInternAtom
+XInternAtom.restype = Atom
+XInternAtom.argtypes = [POINTER(Display), c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:1552
+XInternAtoms = _lib.XInternAtoms
+XInternAtoms.restype = c_int
+XInternAtoms.argtypes = [POINTER(Display), POINTER(c_char_p), c_int, c_int, POINTER(Atom)]
+
+# /usr/include/X11/Xlib.h:1559
+XCopyColormapAndFree = _lib.XCopyColormapAndFree
+XCopyColormapAndFree.restype = Colormap
+XCopyColormapAndFree.argtypes = [POINTER(Display), Colormap]
+
+# /usr/include/X11/Xlib.h:1563
+XCreateColormap = _lib.XCreateColormap
+XCreateColormap.restype = Colormap
+XCreateColormap.argtypes = [POINTER(Display), Window, POINTER(Visual), c_int]
+
+# /usr/include/X11/Xlib.h:1569
+XCreatePixmapCursor = _lib.XCreatePixmapCursor
+XCreatePixmapCursor.restype = Cursor
+XCreatePixmapCursor.argtypes = [POINTER(Display), Pixmap, Pixmap, POINTER(XColor), POINTER(XColor), c_uint, c_uint]
+
+# /usr/include/X11/Xlib.h:1578
+XCreateGlyphCursor = _lib.XCreateGlyphCursor
+XCreateGlyphCursor.restype = Cursor
+XCreateGlyphCursor.argtypes = [POINTER(Display), Font, Font, c_uint, c_uint, POINTER(XColor), POINTER(XColor)]
+
+# /usr/include/X11/Xlib.h:1587
+XCreateFontCursor = _lib.XCreateFontCursor
+XCreateFontCursor.restype = Cursor
+XCreateFontCursor.argtypes = [POINTER(Display), c_uint]
+
+# /usr/include/X11/Xlib.h:1591
+XLoadFont = _lib.XLoadFont
+XLoadFont.restype = Font
+XLoadFont.argtypes = [POINTER(Display), c_char_p]
+
+# /usr/include/X11/Xlib.h:1595
+XCreateGC = _lib.XCreateGC
+XCreateGC.restype = GC
+XCreateGC.argtypes = [POINTER(Display), Drawable, c_ulong, POINTER(XGCValues)]
+
+# /usr/include/X11/Xlib.h:1601
+XGContextFromGC = _lib.XGContextFromGC
+XGContextFromGC.restype = GContext
+XGContextFromGC.argtypes = [GC]
+
+# /usr/include/X11/Xlib.h:1604
+XFlushGC = _lib.XFlushGC
+XFlushGC.restype = None
+XFlushGC.argtypes = [POINTER(Display), GC]
+
+# /usr/include/X11/Xlib.h:1608
+XCreatePixmap = _lib.XCreatePixmap
+XCreatePixmap.restype = Pixmap
+XCreatePixmap.argtypes = [POINTER(Display), Drawable, c_uint, c_uint, c_uint]
+
+# /usr/include/X11/Xlib.h:1615
+XCreateBitmapFromData = _lib.XCreateBitmapFromData
+XCreateBitmapFromData.restype = Pixmap
+XCreateBitmapFromData.argtypes = [POINTER(Display), Drawable, c_char_p, c_uint, c_uint]
+
+# /usr/include/X11/Xlib.h:1622
+XCreatePixmapFromBitmapData = _lib.XCreatePixmapFromBitmapData
+XCreatePixmapFromBitmapData.restype = Pixmap
+XCreatePixmapFromBitmapData.argtypes = [POINTER(Display), Drawable, c_char_p, c_uint, c_uint, c_ulong, c_ulong, c_uint]
+
+# /usr/include/X11/Xlib.h:1632
+XCreateSimpleWindow = _lib.XCreateSimpleWindow
+XCreateSimpleWindow.restype = Window
+XCreateSimpleWindow.argtypes = [POINTER(Display), Window, c_int, c_int, c_uint, c_uint, c_uint, c_ulong, c_ulong]
+
+# /usr/include/X11/Xlib.h:1643
+XGetSelectionOwner = _lib.XGetSelectionOwner
+XGetSelectionOwner.restype = Window
+XGetSelectionOwner.argtypes = [POINTER(Display), Atom]
+
+# /usr/include/X11/Xlib.h:1647
+XCreateWindow = _lib.XCreateWindow
+XCreateWindow.restype = Window
+XCreateWindow.argtypes = [POINTER(Display), Window, c_int, c_int, c_uint, c_uint, c_uint, c_int, c_uint, POINTER(Visual), c_ulong, POINTER(XSetWindowAttributes)]
+
+# /usr/include/X11/Xlib.h:1661
+XListInstalledColormaps = _lib.XListInstalledColormaps
+XListInstalledColormaps.restype = POINTER(Colormap)
+XListInstalledColormaps.argtypes = [POINTER(Display), Window, POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1666
+XListFonts = _lib.XListFonts
+XListFonts.restype = POINTER(c_char_p)
+XListFonts.argtypes = [POINTER(Display), c_char_p, c_int, POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1672
+XListFontsWithInfo = _lib.XListFontsWithInfo
+XListFontsWithInfo.restype = POINTER(c_char_p)
+XListFontsWithInfo.argtypes = [POINTER(Display), c_char_p, c_int, POINTER(c_int), POINTER(POINTER(XFontStruct))]
+
+# /usr/include/X11/Xlib.h:1679
+XGetFontPath = _lib.XGetFontPath
+XGetFontPath.restype = POINTER(c_char_p)
+XGetFontPath.argtypes = [POINTER(Display), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1683
+XListExtensions = _lib.XListExtensions
+XListExtensions.restype = POINTER(c_char_p)
+XListExtensions.argtypes = [POINTER(Display), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1687
+XListProperties = _lib.XListProperties
+XListProperties.restype = POINTER(Atom)
+XListProperties.argtypes = [POINTER(Display), Window, POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1692
+XListHosts = _lib.XListHosts
+XListHosts.restype = POINTER(XHostAddress)
+XListHosts.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1697
+XKeycodeToKeysym = _lib.XKeycodeToKeysym
+XKeycodeToKeysym.restype = KeySym
+XKeycodeToKeysym.argtypes = [POINTER(Display), KeyCode, c_int]
+
+# /usr/include/X11/Xlib.h:1706
+XLookupKeysym = _lib.XLookupKeysym
+XLookupKeysym.restype = KeySym
+XLookupKeysym.argtypes = [POINTER(XKeyEvent), c_int]
+
+# /usr/include/X11/Xlib.h:1710
+XGetKeyboardMapping = _lib.XGetKeyboardMapping
+XGetKeyboardMapping.restype = POINTER(KeySym)
+XGetKeyboardMapping.argtypes = [POINTER(Display), KeyCode, c_int, POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1720
+XStringToKeysym = _lib.XStringToKeysym
+XStringToKeysym.restype = KeySym
+XStringToKeysym.argtypes = [c_char_p]
+
+# /usr/include/X11/Xlib.h:1723
+XMaxRequestSize = _lib.XMaxRequestSize
+XMaxRequestSize.restype = c_long
+XMaxRequestSize.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1726
+XExtendedMaxRequestSize = _lib.XExtendedMaxRequestSize
+XExtendedMaxRequestSize.restype = c_long
+XExtendedMaxRequestSize.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1729
+XResourceManagerString = _lib.XResourceManagerString
+XResourceManagerString.restype = c_char_p
+XResourceManagerString.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1732
+XScreenResourceString = _lib.XScreenResourceString
+XScreenResourceString.restype = c_char_p
+XScreenResourceString.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:1735
+XDisplayMotionBufferSize = _lib.XDisplayMotionBufferSize
+XDisplayMotionBufferSize.restype = c_ulong
+XDisplayMotionBufferSize.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1738
+XVisualIDFromVisual = _lib.XVisualIDFromVisual
+XVisualIDFromVisual.restype = VisualID
+XVisualIDFromVisual.argtypes = [POINTER(Visual)]
+
+# /usr/include/X11/Xlib.h:1744
+XInitThreads = _lib.XInitThreads
+XInitThreads.restype = c_int
+XInitThreads.argtypes = []
+
+# /usr/include/X11/Xlib.h:1748
+XLockDisplay = _lib.XLockDisplay
+XLockDisplay.restype = None
+XLockDisplay.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1752
+XUnlockDisplay = _lib.XUnlockDisplay
+XUnlockDisplay.restype = None
+XUnlockDisplay.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1758
+XInitExtension = _lib.XInitExtension
+XInitExtension.restype = POINTER(XExtCodes)
+XInitExtension.argtypes = [POINTER(Display), c_char_p]
+
+# /usr/include/X11/Xlib.h:1763
+XAddExtension = _lib.XAddExtension
+XAddExtension.restype = POINTER(XExtCodes)
+XAddExtension.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1766
+XFindOnExtensionList = _lib.XFindOnExtensionList
+XFindOnExtensionList.restype = POINTER(XExtData)
+XFindOnExtensionList.argtypes = [POINTER(POINTER(XExtData)), c_int]
+
+# /usr/include/X11/Xlib.h:1770
+XEHeadOfExtensionList = _lib.XEHeadOfExtensionList
+XEHeadOfExtensionList.restype = POINTER(POINTER(XExtData))
+XEHeadOfExtensionList.argtypes = [XEDataObject]
+
+# /usr/include/X11/Xlib.h:1775
+XRootWindow = _lib.XRootWindow
+XRootWindow.restype = Window
+XRootWindow.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:1779
+XDefaultRootWindow = _lib.XDefaultRootWindow
+XDefaultRootWindow.restype = Window
+XDefaultRootWindow.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1782
+XRootWindowOfScreen = _lib.XRootWindowOfScreen
+XRootWindowOfScreen.restype = Window
+XRootWindowOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:1785
+XDefaultVisual = _lib.XDefaultVisual
+XDefaultVisual.restype = POINTER(Visual)
+XDefaultVisual.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:1789
+XDefaultVisualOfScreen = _lib.XDefaultVisualOfScreen
+XDefaultVisualOfScreen.restype = POINTER(Visual)
+XDefaultVisualOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:1792
+XDefaultGC = _lib.XDefaultGC
+XDefaultGC.restype = GC
+XDefaultGC.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:1796
+XDefaultGCOfScreen = _lib.XDefaultGCOfScreen
+XDefaultGCOfScreen.restype = GC
+XDefaultGCOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:1799
+XBlackPixel = _lib.XBlackPixel
+XBlackPixel.restype = c_ulong
+XBlackPixel.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:1803
+XWhitePixel = _lib.XWhitePixel
+XWhitePixel.restype = c_ulong
+XWhitePixel.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:1807
+XAllPlanes = _lib.XAllPlanes
+XAllPlanes.restype = c_ulong
+XAllPlanes.argtypes = []
+
+# /usr/include/X11/Xlib.h:1810
+XBlackPixelOfScreen = _lib.XBlackPixelOfScreen
+XBlackPixelOfScreen.restype = c_ulong
+XBlackPixelOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:1813
+XWhitePixelOfScreen = _lib.XWhitePixelOfScreen
+XWhitePixelOfScreen.restype = c_ulong
+XWhitePixelOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:1816
+XNextRequest = _lib.XNextRequest
+XNextRequest.restype = c_ulong
+XNextRequest.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1819
+XLastKnownRequestProcessed = _lib.XLastKnownRequestProcessed
+XLastKnownRequestProcessed.restype = c_ulong
+XLastKnownRequestProcessed.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1822
+XServerVendor = _lib.XServerVendor
+XServerVendor.restype = c_char_p
+XServerVendor.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1825
+XDisplayString = _lib.XDisplayString
+XDisplayString.restype = c_char_p
+XDisplayString.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1828
+XDefaultColormap = _lib.XDefaultColormap
+XDefaultColormap.restype = Colormap
+XDefaultColormap.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:1832
+XDefaultColormapOfScreen = _lib.XDefaultColormapOfScreen
+XDefaultColormapOfScreen.restype = Colormap
+XDefaultColormapOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:1835
+XDisplayOfScreen = _lib.XDisplayOfScreen
+XDisplayOfScreen.restype = POINTER(Display)
+XDisplayOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:1838
+XScreenOfDisplay = _lib.XScreenOfDisplay
+XScreenOfDisplay.restype = POINTER(Screen)
+XScreenOfDisplay.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:1842
+XDefaultScreenOfDisplay = _lib.XDefaultScreenOfDisplay
+XDefaultScreenOfDisplay.restype = POINTER(Screen)
+XDefaultScreenOfDisplay.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1845
+XEventMaskOfScreen = _lib.XEventMaskOfScreen
+XEventMaskOfScreen.restype = c_long
+XEventMaskOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:1849
+XScreenNumberOfScreen = _lib.XScreenNumberOfScreen
+XScreenNumberOfScreen.restype = c_int
+XScreenNumberOfScreen.argtypes = [POINTER(Screen)]
+
+XErrorHandler = CFUNCTYPE(c_int, POINTER(Display), POINTER(XErrorEvent)) # /usr/include/X11/Xlib.h:1853
+# /usr/include/X11/Xlib.h:1858
+XSetErrorHandler = _lib.XSetErrorHandler
+XSetErrorHandler.restype = XErrorHandler
+XSetErrorHandler.argtypes = [XErrorHandler]
+
+XIOErrorHandler = CFUNCTYPE(c_int, POINTER(Display)) # /usr/include/X11/Xlib.h:1863
+# /usr/include/X11/Xlib.h:1867
+XSetIOErrorHandler = _lib.XSetIOErrorHandler
+XSetIOErrorHandler.restype = XIOErrorHandler
+XSetIOErrorHandler.argtypes = [XIOErrorHandler]
+
+# /usr/include/X11/Xlib.h:1872
+XListPixmapFormats = _lib.XListPixmapFormats
+XListPixmapFormats.restype = POINTER(XPixmapFormatValues)
+XListPixmapFormats.argtypes = [POINTER(Display), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1876
+XListDepths = _lib.XListDepths
+XListDepths.restype = POINTER(c_int)
+XListDepths.argtypes = [POINTER(Display), c_int, POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1884
+XReconfigureWMWindow = _lib.XReconfigureWMWindow
+XReconfigureWMWindow.restype = c_int
+XReconfigureWMWindow.argtypes = [POINTER(Display), Window, c_int, c_uint, POINTER(XWindowChanges)]
+
+# /usr/include/X11/Xlib.h:1892
+XGetWMProtocols = _lib.XGetWMProtocols
+XGetWMProtocols.restype = c_int
+XGetWMProtocols.argtypes = [POINTER(Display), Window, POINTER(POINTER(Atom)), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1898
+XSetWMProtocols = _lib.XSetWMProtocols
+XSetWMProtocols.restype = c_int
+XSetWMProtocols.argtypes = [POINTER(Display), Window, POINTER(Atom), c_int]
+
+# /usr/include/X11/Xlib.h:1904
+XIconifyWindow = _lib.XIconifyWindow
+XIconifyWindow.restype = c_int
+XIconifyWindow.argtypes = [POINTER(Display), Window, c_int]
+
+# /usr/include/X11/Xlib.h:1909
+XWithdrawWindow = _lib.XWithdrawWindow
+XWithdrawWindow.restype = c_int
+XWithdrawWindow.argtypes = [POINTER(Display), Window, c_int]
+
+# /usr/include/X11/Xlib.h:1914
+XGetCommand = _lib.XGetCommand
+XGetCommand.restype = c_int
+XGetCommand.argtypes = [POINTER(Display), Window, POINTER(POINTER(c_char_p)), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1920
+XGetWMColormapWindows = _lib.XGetWMColormapWindows
+XGetWMColormapWindows.restype = c_int
+XGetWMColormapWindows.argtypes = [POINTER(Display), Window, POINTER(POINTER(Window)), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1926
+XSetWMColormapWindows = _lib.XSetWMColormapWindows
+XSetWMColormapWindows.restype = c_int
+XSetWMColormapWindows.argtypes = [POINTER(Display), Window, POINTER(Window), c_int]
+
+# /usr/include/X11/Xlib.h:1932
+XFreeStringList = _lib.XFreeStringList
+XFreeStringList.restype = None
+XFreeStringList.argtypes = [POINTER(c_char_p)]
+
+# /usr/include/X11/Xlib.h:1935
+XSetTransientForHint = _lib.XSetTransientForHint
+XSetTransientForHint.restype = c_int
+XSetTransientForHint.argtypes = [POINTER(Display), Window, Window]
+
+# /usr/include/X11/Xlib.h:1943
+XActivateScreenSaver = _lib.XActivateScreenSaver
+XActivateScreenSaver.restype = c_int
+XActivateScreenSaver.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1947
+XAddHost = _lib.XAddHost
+XAddHost.restype = c_int
+XAddHost.argtypes = [POINTER(Display), POINTER(XHostAddress)]
+
+# /usr/include/X11/Xlib.h:1952
+XAddHosts = _lib.XAddHosts
+XAddHosts.restype = c_int
+XAddHosts.argtypes = [POINTER(Display), POINTER(XHostAddress), c_int]
+
+# /usr/include/X11/Xlib.h:1958
+XAddToExtensionList = _lib.XAddToExtensionList
+XAddToExtensionList.restype = c_int
+XAddToExtensionList.argtypes = [POINTER(POINTER(struct__XExtData)), POINTER(XExtData)]
+
+# /usr/include/X11/Xlib.h:1963
+XAddToSaveSet = _lib.XAddToSaveSet
+XAddToSaveSet.restype = c_int
+XAddToSaveSet.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:1968
+XAllocColor = _lib.XAllocColor
+XAllocColor.restype = c_int
+XAllocColor.argtypes = [POINTER(Display), Colormap, POINTER(XColor)]
+
+# /usr/include/X11/Xlib.h:1974
+XAllocColorCells = _lib.XAllocColorCells
+XAllocColorCells.restype = c_int
+XAllocColorCells.argtypes = [POINTER(Display), Colormap, c_int, POINTER(c_ulong), c_uint, POINTER(c_ulong), c_uint]
+
+# /usr/include/X11/Xlib.h:1984
+XAllocColorPlanes = _lib.XAllocColorPlanes
+XAllocColorPlanes.restype = c_int
+XAllocColorPlanes.argtypes = [POINTER(Display), Colormap, c_int, POINTER(c_ulong), c_int, c_int, c_int, c_int, POINTER(c_ulong), POINTER(c_ulong), POINTER(c_ulong)]
+
+# /usr/include/X11/Xlib.h:1998
+XAllocNamedColor = _lib.XAllocNamedColor
+XAllocNamedColor.restype = c_int
+XAllocNamedColor.argtypes = [POINTER(Display), Colormap, c_char_p, POINTER(XColor), POINTER(XColor)]
+
+# /usr/include/X11/Xlib.h:2006
+XAllowEvents = _lib.XAllowEvents
+XAllowEvents.restype = c_int
+XAllowEvents.argtypes = [POINTER(Display), c_int, Time]
+
+# /usr/include/X11/Xlib.h:2012
+XAutoRepeatOff = _lib.XAutoRepeatOff
+XAutoRepeatOff.restype = c_int
+XAutoRepeatOff.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2016
+XAutoRepeatOn = _lib.XAutoRepeatOn
+XAutoRepeatOn.restype = c_int
+XAutoRepeatOn.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2020
+XBell = _lib.XBell
+XBell.restype = c_int
+XBell.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2025
+XBitmapBitOrder = _lib.XBitmapBitOrder
+XBitmapBitOrder.restype = c_int
+XBitmapBitOrder.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2029
+XBitmapPad = _lib.XBitmapPad
+XBitmapPad.restype = c_int
+XBitmapPad.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2033
+XBitmapUnit = _lib.XBitmapUnit
+XBitmapUnit.restype = c_int
+XBitmapUnit.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2037
+XCellsOfScreen = _lib.XCellsOfScreen
+XCellsOfScreen.restype = c_int
+XCellsOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:2041
+XChangeActivePointerGrab = _lib.XChangeActivePointerGrab
+XChangeActivePointerGrab.restype = c_int
+XChangeActivePointerGrab.argtypes = [POINTER(Display), c_uint, Cursor, Time]
+
+# /usr/include/X11/Xlib.h:2048
+XChangeGC = _lib.XChangeGC
+XChangeGC.restype = c_int
+XChangeGC.argtypes = [POINTER(Display), GC, c_ulong, POINTER(XGCValues)]
+
+# /usr/include/X11/Xlib.h:2055
+XChangeKeyboardControl = _lib.XChangeKeyboardControl
+XChangeKeyboardControl.restype = c_int
+XChangeKeyboardControl.argtypes = [POINTER(Display), c_ulong, POINTER(XKeyboardControl)]
+
+# /usr/include/X11/Xlib.h:2061
+XChangeKeyboardMapping = _lib.XChangeKeyboardMapping
+XChangeKeyboardMapping.restype = c_int
+XChangeKeyboardMapping.argtypes = [POINTER(Display), c_int, c_int, POINTER(KeySym), c_int]
+
+# /usr/include/X11/Xlib.h:2069
+XChangePointerControl = _lib.XChangePointerControl
+XChangePointerControl.restype = c_int
+XChangePointerControl.argtypes = [POINTER(Display), c_int, c_int, c_int, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2078
+XChangeProperty = _lib.XChangeProperty
+XChangeProperty.restype = c_int
+XChangeProperty.argtypes = [POINTER(Display), Window, Atom, Atom, c_int, c_int, POINTER(c_ubyte), c_int]
+
+# /usr/include/X11/Xlib.h:2089
+XChangeSaveSet = _lib.XChangeSaveSet
+XChangeSaveSet.restype = c_int
+XChangeSaveSet.argtypes = [POINTER(Display), Window, c_int]
+
+# /usr/include/X11/Xlib.h:2095
+XChangeWindowAttributes = _lib.XChangeWindowAttributes
+XChangeWindowAttributes.restype = c_int
+XChangeWindowAttributes.argtypes = [POINTER(Display), Window, c_ulong, POINTER(XSetWindowAttributes)]
+
+# /usr/include/X11/Xlib.h:2102
+XCheckIfEvent = _lib.XCheckIfEvent
+XCheckIfEvent.restype = c_int
+XCheckIfEvent.argtypes = [POINTER(Display), POINTER(XEvent), CFUNCTYPE(c_int, POINTER(Display), POINTER(XEvent), XPointer), XPointer]
+
+# /usr/include/X11/Xlib.h:2113
+XCheckMaskEvent = _lib.XCheckMaskEvent
+XCheckMaskEvent.restype = c_int
+XCheckMaskEvent.argtypes = [POINTER(Display), c_long, POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:2119
+XCheckTypedEvent = _lib.XCheckTypedEvent
+XCheckTypedEvent.restype = c_int
+XCheckTypedEvent.argtypes = [POINTER(Display), c_int, POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:2125
+XCheckTypedWindowEvent = _lib.XCheckTypedWindowEvent
+XCheckTypedWindowEvent.restype = c_int
+XCheckTypedWindowEvent.argtypes = [POINTER(Display), Window, c_int, POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:2132
+XCheckWindowEvent = _lib.XCheckWindowEvent
+XCheckWindowEvent.restype = c_int
+XCheckWindowEvent.argtypes = [POINTER(Display), Window, c_long, POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:2139
+XCirculateSubwindows = _lib.XCirculateSubwindows
+XCirculateSubwindows.restype = c_int
+XCirculateSubwindows.argtypes = [POINTER(Display), Window, c_int]
+
+# /usr/include/X11/Xlib.h:2145
+XCirculateSubwindowsDown = _lib.XCirculateSubwindowsDown
+XCirculateSubwindowsDown.restype = c_int
+XCirculateSubwindowsDown.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:2150
+XCirculateSubwindowsUp = _lib.XCirculateSubwindowsUp
+XCirculateSubwindowsUp.restype = c_int
+XCirculateSubwindowsUp.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:2155
+XClearArea = _lib.XClearArea
+XClearArea.restype = c_int
+XClearArea.argtypes = [POINTER(Display), Window, c_int, c_int, c_uint, c_uint, c_int]
+
+# /usr/include/X11/Xlib.h:2165
+XClearWindow = _lib.XClearWindow
+XClearWindow.restype = c_int
+XClearWindow.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:2170
+XCloseDisplay = _lib.XCloseDisplay
+XCloseDisplay.restype = c_int
+XCloseDisplay.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2174
+XConfigureWindow = _lib.XConfigureWindow
+XConfigureWindow.restype = c_int
+XConfigureWindow.argtypes = [POINTER(Display), Window, c_uint, POINTER(XWindowChanges)]
+
+# /usr/include/X11/Xlib.h:2181
+XConnectionNumber = _lib.XConnectionNumber
+XConnectionNumber.restype = c_int
+XConnectionNumber.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2185
+XConvertSelection = _lib.XConvertSelection
+XConvertSelection.restype = c_int
+XConvertSelection.argtypes = [POINTER(Display), Atom, Atom, Atom, Window, Time]
+
+# /usr/include/X11/Xlib.h:2194
+XCopyArea = _lib.XCopyArea
+XCopyArea.restype = c_int
+XCopyArea.argtypes = [POINTER(Display), Drawable, Drawable, GC, c_int, c_int, c_uint, c_uint, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2207
+XCopyGC = _lib.XCopyGC
+XCopyGC.restype = c_int
+XCopyGC.argtypes = [POINTER(Display), GC, c_ulong, GC]
+
+# /usr/include/X11/Xlib.h:2214
+XCopyPlane = _lib.XCopyPlane
+XCopyPlane.restype = c_int
+XCopyPlane.argtypes = [POINTER(Display), Drawable, Drawable, GC, c_int, c_int, c_uint, c_uint, c_int, c_int, c_ulong]
+
+# /usr/include/X11/Xlib.h:2228
+XDefaultDepth = _lib.XDefaultDepth
+XDefaultDepth.restype = c_int
+XDefaultDepth.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2233
+XDefaultDepthOfScreen = _lib.XDefaultDepthOfScreen
+XDefaultDepthOfScreen.restype = c_int
+XDefaultDepthOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:2237
+XDefaultScreen = _lib.XDefaultScreen
+XDefaultScreen.restype = c_int
+XDefaultScreen.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2241
+XDefineCursor = _lib.XDefineCursor
+XDefineCursor.restype = c_int
+XDefineCursor.argtypes = [POINTER(Display), Window, Cursor]
+
+# /usr/include/X11/Xlib.h:2247
+XDeleteProperty = _lib.XDeleteProperty
+XDeleteProperty.restype = c_int
+XDeleteProperty.argtypes = [POINTER(Display), Window, Atom]
+
+# /usr/include/X11/Xlib.h:2253
+XDestroyWindow = _lib.XDestroyWindow
+XDestroyWindow.restype = c_int
+XDestroyWindow.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:2258
+XDestroySubwindows = _lib.XDestroySubwindows
+XDestroySubwindows.restype = c_int
+XDestroySubwindows.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:2263
+XDoesBackingStore = _lib.XDoesBackingStore
+XDoesBackingStore.restype = c_int
+XDoesBackingStore.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:2267
+XDoesSaveUnders = _lib.XDoesSaveUnders
+XDoesSaveUnders.restype = c_int
+XDoesSaveUnders.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:2271
+XDisableAccessControl = _lib.XDisableAccessControl
+XDisableAccessControl.restype = c_int
+XDisableAccessControl.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2276
+XDisplayCells = _lib.XDisplayCells
+XDisplayCells.restype = c_int
+XDisplayCells.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2281
+XDisplayHeight = _lib.XDisplayHeight
+XDisplayHeight.restype = c_int
+XDisplayHeight.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2286
+XDisplayHeightMM = _lib.XDisplayHeightMM
+XDisplayHeightMM.restype = c_int
+XDisplayHeightMM.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2291
+XDisplayKeycodes = _lib.XDisplayKeycodes
+XDisplayKeycodes.restype = c_int
+XDisplayKeycodes.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:2297
+XDisplayPlanes = _lib.XDisplayPlanes
+XDisplayPlanes.restype = c_int
+XDisplayPlanes.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2302
+XDisplayWidth = _lib.XDisplayWidth
+XDisplayWidth.restype = c_int
+XDisplayWidth.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2307
+XDisplayWidthMM = _lib.XDisplayWidthMM
+XDisplayWidthMM.restype = c_int
+XDisplayWidthMM.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2312
+XDrawArc = _lib.XDrawArc
+XDrawArc.restype = c_int
+XDrawArc.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, c_uint, c_uint, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2324
+XDrawArcs = _lib.XDrawArcs
+XDrawArcs.restype = c_int
+XDrawArcs.argtypes = [POINTER(Display), Drawable, GC, POINTER(XArc), c_int]
+
+# /usr/include/X11/Xlib.h:2332
+XDrawImageString = _lib.XDrawImageString
+XDrawImageString.restype = c_int
+XDrawImageString.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:2342
+XDrawImageString16 = _lib.XDrawImageString16
+XDrawImageString16.restype = c_int
+XDrawImageString16.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, POINTER(XChar2b), c_int]
+
+# /usr/include/X11/Xlib.h:2352
+XDrawLine = _lib.XDrawLine
+XDrawLine.restype = c_int
+XDrawLine.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2362
+XDrawLines = _lib.XDrawLines
+XDrawLines.restype = c_int
+XDrawLines.argtypes = [POINTER(Display), Drawable, GC, POINTER(XPoint), c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2371
+XDrawPoint = _lib.XDrawPoint
+XDrawPoint.restype = c_int
+XDrawPoint.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2379
+XDrawPoints = _lib.XDrawPoints
+XDrawPoints.restype = c_int
+XDrawPoints.argtypes = [POINTER(Display), Drawable, GC, POINTER(XPoint), c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2388
+XDrawRectangle = _lib.XDrawRectangle
+XDrawRectangle.restype = c_int
+XDrawRectangle.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, c_uint, c_uint]
+
+# /usr/include/X11/Xlib.h:2398
+XDrawRectangles = _lib.XDrawRectangles
+XDrawRectangles.restype = c_int
+XDrawRectangles.argtypes = [POINTER(Display), Drawable, GC, POINTER(XRectangle), c_int]
+
+# /usr/include/X11/Xlib.h:2406
+XDrawSegments = _lib.XDrawSegments
+XDrawSegments.restype = c_int
+XDrawSegments.argtypes = [POINTER(Display), Drawable, GC, POINTER(XSegment), c_int]
+
+# /usr/include/X11/Xlib.h:2414
+XDrawString = _lib.XDrawString
+XDrawString.restype = c_int
+XDrawString.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:2424
+XDrawString16 = _lib.XDrawString16
+XDrawString16.restype = c_int
+XDrawString16.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, POINTER(XChar2b), c_int]
+
+# /usr/include/X11/Xlib.h:2434
+XDrawText = _lib.XDrawText
+XDrawText.restype = c_int
+XDrawText.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, POINTER(XTextItem), c_int]
+
+# /usr/include/X11/Xlib.h:2444
+XDrawText16 = _lib.XDrawText16
+XDrawText16.restype = c_int
+XDrawText16.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, POINTER(XTextItem16), c_int]
+
+# /usr/include/X11/Xlib.h:2454
+XEnableAccessControl = _lib.XEnableAccessControl
+XEnableAccessControl.restype = c_int
+XEnableAccessControl.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2458
+XEventsQueued = _lib.XEventsQueued
+XEventsQueued.restype = c_int
+XEventsQueued.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2463
+XFetchName = _lib.XFetchName
+XFetchName.restype = c_int
+XFetchName.argtypes = [POINTER(Display), Window, POINTER(c_char_p)]
+
+# /usr/include/X11/Xlib.h:2469
+XFillArc = _lib.XFillArc
+XFillArc.restype = c_int
+XFillArc.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, c_uint, c_uint, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2481
+XFillArcs = _lib.XFillArcs
+XFillArcs.restype = c_int
+XFillArcs.argtypes = [POINTER(Display), Drawable, GC, POINTER(XArc), c_int]
+
+# /usr/include/X11/Xlib.h:2489
+XFillPolygon = _lib.XFillPolygon
+XFillPolygon.restype = c_int
+XFillPolygon.argtypes = [POINTER(Display), Drawable, GC, POINTER(XPoint), c_int, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2499
+XFillRectangle = _lib.XFillRectangle
+XFillRectangle.restype = c_int
+XFillRectangle.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, c_uint, c_uint]
+
+# /usr/include/X11/Xlib.h:2509
+XFillRectangles = _lib.XFillRectangles
+XFillRectangles.restype = c_int
+XFillRectangles.argtypes = [POINTER(Display), Drawable, GC, POINTER(XRectangle), c_int]
+
+# /usr/include/X11/Xlib.h:2517
+XFlush = _lib.XFlush
+XFlush.restype = c_int
+XFlush.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2521
+XForceScreenSaver = _lib.XForceScreenSaver
+XForceScreenSaver.restype = c_int
+XForceScreenSaver.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2526
+XFree = _lib.XFree
+XFree.restype = c_int
+XFree.argtypes = [POINTER(None)]
+
+# /usr/include/X11/Xlib.h:2530
+XFreeColormap = _lib.XFreeColormap
+XFreeColormap.restype = c_int
+XFreeColormap.argtypes = [POINTER(Display), Colormap]
+
+# /usr/include/X11/Xlib.h:2535
+XFreeColors = _lib.XFreeColors
+XFreeColors.restype = c_int
+XFreeColors.argtypes = [POINTER(Display), Colormap, POINTER(c_ulong), c_int, c_ulong]
+
+# /usr/include/X11/Xlib.h:2543
+XFreeCursor = _lib.XFreeCursor
+XFreeCursor.restype = c_int
+XFreeCursor.argtypes = [POINTER(Display), Cursor]
+
+# /usr/include/X11/Xlib.h:2548
+XFreeExtensionList = _lib.XFreeExtensionList
+XFreeExtensionList.restype = c_int
+XFreeExtensionList.argtypes = [POINTER(c_char_p)]
+
+# /usr/include/X11/Xlib.h:2552
+XFreeFont = _lib.XFreeFont
+XFreeFont.restype = c_int
+XFreeFont.argtypes = [POINTER(Display), POINTER(XFontStruct)]
+
+# /usr/include/X11/Xlib.h:2557
+XFreeFontInfo = _lib.XFreeFontInfo
+XFreeFontInfo.restype = c_int
+XFreeFontInfo.argtypes = [POINTER(c_char_p), POINTER(XFontStruct), c_int]
+
+# /usr/include/X11/Xlib.h:2563
+XFreeFontNames = _lib.XFreeFontNames
+XFreeFontNames.restype = c_int
+XFreeFontNames.argtypes = [POINTER(c_char_p)]
+
+# /usr/include/X11/Xlib.h:2567
+XFreeFontPath = _lib.XFreeFontPath
+XFreeFontPath.restype = c_int
+XFreeFontPath.argtypes = [POINTER(c_char_p)]
+
+# /usr/include/X11/Xlib.h:2571
+XFreeGC = _lib.XFreeGC
+XFreeGC.restype = c_int
+XFreeGC.argtypes = [POINTER(Display), GC]
+
+# /usr/include/X11/Xlib.h:2576
+XFreeModifiermap = _lib.XFreeModifiermap
+XFreeModifiermap.restype = c_int
+XFreeModifiermap.argtypes = [POINTER(XModifierKeymap)]
+
+# /usr/include/X11/Xlib.h:2580
+XFreePixmap = _lib.XFreePixmap
+XFreePixmap.restype = c_int
+XFreePixmap.argtypes = [POINTER(Display), Pixmap]
+
+# /usr/include/X11/Xlib.h:2585
+XGeometry = _lib.XGeometry
+XGeometry.restype = c_int
+XGeometry.argtypes = [POINTER(Display), c_int, c_char_p, c_char_p, c_uint, c_uint, c_uint, c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:2601
+XGetErrorDatabaseText = _lib.XGetErrorDatabaseText
+XGetErrorDatabaseText.restype = c_int
+XGetErrorDatabaseText.argtypes = [POINTER(Display), c_char_p, c_char_p, c_char_p, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:2610
+XGetErrorText = _lib.XGetErrorText
+XGetErrorText.restype = c_int
+XGetErrorText.argtypes = [POINTER(Display), c_int, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:2617
+XGetFontProperty = _lib.XGetFontProperty
+XGetFontProperty.restype = c_int
+XGetFontProperty.argtypes = [POINTER(XFontStruct), Atom, POINTER(c_ulong)]
+
+# /usr/include/X11/Xlib.h:2623
+XGetGCValues = _lib.XGetGCValues
+XGetGCValues.restype = c_int
+XGetGCValues.argtypes = [POINTER(Display), GC, c_ulong, POINTER(XGCValues)]
+
+# /usr/include/X11/Xlib.h:2630
+XGetGeometry = _lib.XGetGeometry
+XGetGeometry.restype = c_int
+XGetGeometry.argtypes = [POINTER(Display), Drawable, POINTER(Window), POINTER(c_int), POINTER(c_int), POINTER(c_uint), POINTER(c_uint), POINTER(c_uint), POINTER(c_uint)]
+
+# /usr/include/X11/Xlib.h:2642
+XGetIconName = _lib.XGetIconName
+XGetIconName.restype = c_int
+XGetIconName.argtypes = [POINTER(Display), Window, POINTER(c_char_p)]
+
+# /usr/include/X11/Xlib.h:2648
+XGetInputFocus = _lib.XGetInputFocus
+XGetInputFocus.restype = c_int
+XGetInputFocus.argtypes = [POINTER(Display), POINTER(Window), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:2654
+XGetKeyboardControl = _lib.XGetKeyboardControl
+XGetKeyboardControl.restype = c_int
+XGetKeyboardControl.argtypes = [POINTER(Display), POINTER(XKeyboardState)]
+
+# /usr/include/X11/Xlib.h:2659
+XGetPointerControl = _lib.XGetPointerControl
+XGetPointerControl.restype = c_int
+XGetPointerControl.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:2666
+XGetPointerMapping = _lib.XGetPointerMapping
+XGetPointerMapping.restype = c_int
+XGetPointerMapping.argtypes = [POINTER(Display), POINTER(c_ubyte), c_int]
+
+# /usr/include/X11/Xlib.h:2672
+XGetScreenSaver = _lib.XGetScreenSaver
+XGetScreenSaver.restype = c_int
+XGetScreenSaver.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:2680
+XGetTransientForHint = _lib.XGetTransientForHint
+XGetTransientForHint.restype = c_int
+XGetTransientForHint.argtypes = [POINTER(Display), Window, POINTER(Window)]
+
+# /usr/include/X11/Xlib.h:2686
+XGetWindowProperty = _lib.XGetWindowProperty
+XGetWindowProperty.restype = c_int
+XGetWindowProperty.argtypes = [POINTER(Display), Window, Atom, c_long, c_long, c_int, Atom, POINTER(Atom), POINTER(c_int), POINTER(c_ulong), POINTER(c_ulong), POINTER(POINTER(c_ubyte))]
+
+# /usr/include/X11/Xlib.h:2701
+XGetWindowAttributes = _lib.XGetWindowAttributes
+XGetWindowAttributes.restype = c_int
+XGetWindowAttributes.argtypes = [POINTER(Display), Window, POINTER(XWindowAttributes)]
+
+# /usr/include/X11/Xlib.h:2707
+XGrabButton = _lib.XGrabButton
+XGrabButton.restype = c_int
+XGrabButton.argtypes = [POINTER(Display), c_uint, c_uint, Window, c_int, c_uint, c_int, c_int, Window, Cursor]
+
+# /usr/include/X11/Xlib.h:2720
+XGrabKey = _lib.XGrabKey
+XGrabKey.restype = c_int
+XGrabKey.argtypes = [POINTER(Display), c_int, c_uint, Window, c_int, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2730
+XGrabKeyboard = _lib.XGrabKeyboard
+XGrabKeyboard.restype = c_int
+XGrabKeyboard.argtypes = [POINTER(Display), Window, c_int, c_int, c_int, Time]
+
+# /usr/include/X11/Xlib.h:2739
+XGrabPointer = _lib.XGrabPointer
+XGrabPointer.restype = c_int
+XGrabPointer.argtypes = [POINTER(Display), Window, c_int, c_uint, c_int, c_int, Window, Cursor, Time]
+
+# /usr/include/X11/Xlib.h:2751
+XGrabServer = _lib.XGrabServer
+XGrabServer.restype = c_int
+XGrabServer.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2755
+XHeightMMOfScreen = _lib.XHeightMMOfScreen
+XHeightMMOfScreen.restype = c_int
+XHeightMMOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:2759
+XHeightOfScreen = _lib.XHeightOfScreen
+XHeightOfScreen.restype = c_int
+XHeightOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:2763
+XIfEvent = _lib.XIfEvent
+XIfEvent.restype = c_int
+XIfEvent.argtypes = [POINTER(Display), POINTER(XEvent), CFUNCTYPE(c_int, POINTER(Display), POINTER(XEvent), XPointer), XPointer]
+
+# /usr/include/X11/Xlib.h:2774
+XImageByteOrder = _lib.XImageByteOrder
+XImageByteOrder.restype = c_int
+XImageByteOrder.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2778
+XInstallColormap = _lib.XInstallColormap
+XInstallColormap.restype = c_int
+XInstallColormap.argtypes = [POINTER(Display), Colormap]
+
+# /usr/include/X11/Xlib.h:2783
+XKeysymToKeycode = _lib.XKeysymToKeycode
+XKeysymToKeycode.restype = KeyCode
+XKeysymToKeycode.argtypes = [POINTER(Display), KeySym]
+
+# /usr/include/X11/Xlib.h:2788
+XKillClient = _lib.XKillClient
+XKillClient.restype = c_int
+XKillClient.argtypes = [POINTER(Display), XID]
+
+# /usr/include/X11/Xlib.h:2793
+XLookupColor = _lib.XLookupColor
+XLookupColor.restype = c_int
+XLookupColor.argtypes = [POINTER(Display), Colormap, c_char_p, POINTER(XColor), POINTER(XColor)]
+
+# /usr/include/X11/Xlib.h:2801
+XLowerWindow = _lib.XLowerWindow
+XLowerWindow.restype = c_int
+XLowerWindow.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:2806
+XMapRaised = _lib.XMapRaised
+XMapRaised.restype = c_int
+XMapRaised.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:2811
+XMapSubwindows = _lib.XMapSubwindows
+XMapSubwindows.restype = c_int
+XMapSubwindows.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:2816
+XMapWindow = _lib.XMapWindow
+XMapWindow.restype = c_int
+XMapWindow.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:2821
+XMaskEvent = _lib.XMaskEvent
+XMaskEvent.restype = c_int
+XMaskEvent.argtypes = [POINTER(Display), c_long, POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:2827
+XMaxCmapsOfScreen = _lib.XMaxCmapsOfScreen
+XMaxCmapsOfScreen.restype = c_int
+XMaxCmapsOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:2831
+XMinCmapsOfScreen = _lib.XMinCmapsOfScreen
+XMinCmapsOfScreen.restype = c_int
+XMinCmapsOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:2835
+XMoveResizeWindow = _lib.XMoveResizeWindow
+XMoveResizeWindow.restype = c_int
+XMoveResizeWindow.argtypes = [POINTER(Display), Window, c_int, c_int, c_uint, c_uint]
+
+# /usr/include/X11/Xlib.h:2844
+XMoveWindow = _lib.XMoveWindow
+XMoveWindow.restype = c_int
+XMoveWindow.argtypes = [POINTER(Display), Window, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2851
+XNextEvent = _lib.XNextEvent
+XNextEvent.restype = c_int
+XNextEvent.argtypes = [POINTER(Display), POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:2856
+XNoOp = _lib.XNoOp
+XNoOp.restype = c_int
+XNoOp.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2860
+XParseColor = _lib.XParseColor
+XParseColor.restype = c_int
+XParseColor.argtypes = [POINTER(Display), Colormap, c_char_p, POINTER(XColor)]
+
+# /usr/include/X11/Xlib.h:2867
+XParseGeometry = _lib.XParseGeometry
+XParseGeometry.restype = c_int
+XParseGeometry.argtypes = [c_char_p, POINTER(c_int), POINTER(c_int), POINTER(c_uint), POINTER(c_uint)]
+
+# /usr/include/X11/Xlib.h:2875
+XPeekEvent = _lib.XPeekEvent
+XPeekEvent.restype = c_int
+XPeekEvent.argtypes = [POINTER(Display), POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:2880
+XPeekIfEvent = _lib.XPeekIfEvent
+XPeekIfEvent.restype = c_int
+XPeekIfEvent.argtypes = [POINTER(Display), POINTER(XEvent), CFUNCTYPE(c_int, POINTER(Display), POINTER(XEvent), XPointer), XPointer]
+
+# /usr/include/X11/Xlib.h:2891
+XPending = _lib.XPending
+XPending.restype = c_int
+XPending.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2895
+XPlanesOfScreen = _lib.XPlanesOfScreen
+XPlanesOfScreen.restype = c_int
+XPlanesOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:2899
+XProtocolRevision = _lib.XProtocolRevision
+XProtocolRevision.restype = c_int
+XProtocolRevision.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2903
+XProtocolVersion = _lib.XProtocolVersion
+XProtocolVersion.restype = c_int
+XProtocolVersion.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2908
+XPutBackEvent = _lib.XPutBackEvent
+XPutBackEvent.restype = c_int
+XPutBackEvent.argtypes = [POINTER(Display), POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:2913
+XPutImage = _lib.XPutImage
+XPutImage.restype = c_int
+XPutImage.argtypes = [POINTER(Display), Drawable, GC, POINTER(XImage), c_int, c_int, c_int, c_int, c_uint, c_uint]
+
+# /usr/include/X11/Xlib.h:2926
+XQLength = _lib.XQLength
+XQLength.restype = c_int
+XQLength.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2930
+XQueryBestCursor = _lib.XQueryBestCursor
+XQueryBestCursor.restype = c_int
+XQueryBestCursor.argtypes = [POINTER(Display), Drawable, c_uint, c_uint, POINTER(c_uint), POINTER(c_uint)]
+
+# /usr/include/X11/Xlib.h:2939
+XQueryBestSize = _lib.XQueryBestSize
+XQueryBestSize.restype = c_int
+XQueryBestSize.argtypes = [POINTER(Display), c_int, Drawable, c_uint, c_uint, POINTER(c_uint), POINTER(c_uint)]
+
+# /usr/include/X11/Xlib.h:2949
+XQueryBestStipple = _lib.XQueryBestStipple
+XQueryBestStipple.restype = c_int
+XQueryBestStipple.argtypes = [POINTER(Display), Drawable, c_uint, c_uint, POINTER(c_uint), POINTER(c_uint)]
+
+# /usr/include/X11/Xlib.h:2958
+XQueryBestTile = _lib.XQueryBestTile
+XQueryBestTile.restype = c_int
+XQueryBestTile.argtypes = [POINTER(Display), Drawable, c_uint, c_uint, POINTER(c_uint), POINTER(c_uint)]
+
+# /usr/include/X11/Xlib.h:2967
+XQueryColor = _lib.XQueryColor
+XQueryColor.restype = c_int
+XQueryColor.argtypes = [POINTER(Display), Colormap, POINTER(XColor)]
+
+# /usr/include/X11/Xlib.h:2973
+XQueryColors = _lib.XQueryColors
+XQueryColors.restype = c_int
+XQueryColors.argtypes = [POINTER(Display), Colormap, POINTER(XColor), c_int]
+
+# /usr/include/X11/Xlib.h:2980
+XQueryExtension = _lib.XQueryExtension
+XQueryExtension.restype = c_int
+XQueryExtension.argtypes = [POINTER(Display), c_char_p, POINTER(c_int), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:2988
+XQueryKeymap = _lib.XQueryKeymap
+XQueryKeymap.restype = c_int
+XQueryKeymap.argtypes = [POINTER(Display), c_char * 32]
+
+# /usr/include/X11/Xlib.h:2993
+XQueryPointer = _lib.XQueryPointer
+XQueryPointer.restype = c_int
+XQueryPointer.argtypes = [POINTER(Display), Window, POINTER(Window), POINTER(Window), POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_uint)]
+
+# /usr/include/X11/Xlib.h:3005
+XQueryTextExtents = _lib.XQueryTextExtents
+XQueryTextExtents.restype = c_int
+XQueryTextExtents.argtypes = [POINTER(Display), XID, c_char_p, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(XCharStruct)]
+
+# /usr/include/X11/Xlib.h:3016
+XQueryTextExtents16 = _lib.XQueryTextExtents16
+XQueryTextExtents16.restype = c_int
+XQueryTextExtents16.argtypes = [POINTER(Display), XID, POINTER(XChar2b), c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(XCharStruct)]
+
+# /usr/include/X11/Xlib.h:3027
+XQueryTree = _lib.XQueryTree
+XQueryTree.restype = c_int
+XQueryTree.argtypes = [POINTER(Display), Window, POINTER(Window), POINTER(Window), POINTER(POINTER(Window)), POINTER(c_uint)]
+
+# /usr/include/X11/Xlib.h:3036
+XRaiseWindow = _lib.XRaiseWindow
+XRaiseWindow.restype = c_int
+XRaiseWindow.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:3041
+XReadBitmapFile = _lib.XReadBitmapFile
+XReadBitmapFile.restype = c_int
+XReadBitmapFile.argtypes = [POINTER(Display), Drawable, c_char_p, POINTER(c_uint), POINTER(c_uint), POINTER(Pixmap), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:3052
+XReadBitmapFileData = _lib.XReadBitmapFileData
+XReadBitmapFileData.restype = c_int
+XReadBitmapFileData.argtypes = [c_char_p, POINTER(c_uint), POINTER(c_uint), POINTER(POINTER(c_ubyte)), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:3061
+XRebindKeysym = _lib.XRebindKeysym
+XRebindKeysym.restype = c_int
+XRebindKeysym.argtypes = [POINTER(Display), KeySym, POINTER(KeySym), c_int, POINTER(c_ubyte), c_int]
+
+# /usr/include/X11/Xlib.h:3070
+XRecolorCursor = _lib.XRecolorCursor
+XRecolorCursor.restype = c_int
+XRecolorCursor.argtypes = [POINTER(Display), Cursor, POINTER(XColor), POINTER(XColor)]
+
+# /usr/include/X11/Xlib.h:3077
+XRefreshKeyboardMapping = _lib.XRefreshKeyboardMapping
+XRefreshKeyboardMapping.restype = c_int
+XRefreshKeyboardMapping.argtypes = [POINTER(XMappingEvent)]
+
+# /usr/include/X11/Xlib.h:3081
+XRemoveFromSaveSet = _lib.XRemoveFromSaveSet
+XRemoveFromSaveSet.restype = c_int
+XRemoveFromSaveSet.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:3086
+XRemoveHost = _lib.XRemoveHost
+XRemoveHost.restype = c_int
+XRemoveHost.argtypes = [POINTER(Display), POINTER(XHostAddress)]
+
+# /usr/include/X11/Xlib.h:3091
+XRemoveHosts = _lib.XRemoveHosts
+XRemoveHosts.restype = c_int
+XRemoveHosts.argtypes = [POINTER(Display), POINTER(XHostAddress), c_int]
+
+# /usr/include/X11/Xlib.h:3097
+XReparentWindow = _lib.XReparentWindow
+XReparentWindow.restype = c_int
+XReparentWindow.argtypes = [POINTER(Display), Window, Window, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3105
+XResetScreenSaver = _lib.XResetScreenSaver
+XResetScreenSaver.restype = c_int
+XResetScreenSaver.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:3109
+XResizeWindow = _lib.XResizeWindow
+XResizeWindow.restype = c_int
+XResizeWindow.argtypes = [POINTER(Display), Window, c_uint, c_uint]
+
+# /usr/include/X11/Xlib.h:3116
+XRestackWindows = _lib.XRestackWindows
+XRestackWindows.restype = c_int
+XRestackWindows.argtypes = [POINTER(Display), POINTER(Window), c_int]
+
+# /usr/include/X11/Xlib.h:3122
+XRotateBuffers = _lib.XRotateBuffers
+XRotateBuffers.restype = c_int
+XRotateBuffers.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:3127
+XRotateWindowProperties = _lib.XRotateWindowProperties
+XRotateWindowProperties.restype = c_int
+XRotateWindowProperties.argtypes = [POINTER(Display), Window, POINTER(Atom), c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3135
+XScreenCount = _lib.XScreenCount
+XScreenCount.restype = c_int
+XScreenCount.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:3139
+XSelectInput = _lib.XSelectInput
+XSelectInput.restype = c_int
+XSelectInput.argtypes = [POINTER(Display), Window, c_long]
+
+# /usr/include/X11/Xlib.h:3145
+XSendEvent = _lib.XSendEvent
+XSendEvent.restype = c_int
+XSendEvent.argtypes = [POINTER(Display), Window, c_int, c_long, POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:3153
+XSetAccessControl = _lib.XSetAccessControl
+XSetAccessControl.restype = c_int
+XSetAccessControl.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:3158
+XSetArcMode = _lib.XSetArcMode
+XSetArcMode.restype = c_int
+XSetArcMode.argtypes = [POINTER(Display), GC, c_int]
+
+# /usr/include/X11/Xlib.h:3164
+XSetBackground = _lib.XSetBackground
+XSetBackground.restype = c_int
+XSetBackground.argtypes = [POINTER(Display), GC, c_ulong]
+
+# /usr/include/X11/Xlib.h:3170
+XSetClipMask = _lib.XSetClipMask
+XSetClipMask.restype = c_int
+XSetClipMask.argtypes = [POINTER(Display), GC, Pixmap]
+
+# /usr/include/X11/Xlib.h:3176
+XSetClipOrigin = _lib.XSetClipOrigin
+XSetClipOrigin.restype = c_int
+XSetClipOrigin.argtypes = [POINTER(Display), GC, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3183
+XSetClipRectangles = _lib.XSetClipRectangles
+XSetClipRectangles.restype = c_int
+XSetClipRectangles.argtypes = [POINTER(Display), GC, c_int, c_int, POINTER(XRectangle), c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3193
+XSetCloseDownMode = _lib.XSetCloseDownMode
+XSetCloseDownMode.restype = c_int
+XSetCloseDownMode.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:3198
+XSetCommand = _lib.XSetCommand
+XSetCommand.restype = c_int
+XSetCommand.argtypes = [POINTER(Display), Window, POINTER(c_char_p), c_int]
+
+# /usr/include/X11/Xlib.h:3205
+XSetDashes = _lib.XSetDashes
+XSetDashes.restype = c_int
+XSetDashes.argtypes = [POINTER(Display), GC, c_int, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:3213
+XSetFillRule = _lib.XSetFillRule
+XSetFillRule.restype = c_int
+XSetFillRule.argtypes = [POINTER(Display), GC, c_int]
+
+# /usr/include/X11/Xlib.h:3219
+XSetFillStyle = _lib.XSetFillStyle
+XSetFillStyle.restype = c_int
+XSetFillStyle.argtypes = [POINTER(Display), GC, c_int]
+
+# /usr/include/X11/Xlib.h:3225
+XSetFont = _lib.XSetFont
+XSetFont.restype = c_int
+XSetFont.argtypes = [POINTER(Display), GC, Font]
+
+# /usr/include/X11/Xlib.h:3231
+XSetFontPath = _lib.XSetFontPath
+XSetFontPath.restype = c_int
+XSetFontPath.argtypes = [POINTER(Display), POINTER(c_char_p), c_int]
+
+# /usr/include/X11/Xlib.h:3237
+XSetForeground = _lib.XSetForeground
+XSetForeground.restype = c_int
+XSetForeground.argtypes = [POINTER(Display), GC, c_ulong]
+
+# /usr/include/X11/Xlib.h:3243
+XSetFunction = _lib.XSetFunction
+XSetFunction.restype = c_int
+XSetFunction.argtypes = [POINTER(Display), GC, c_int]
+
+# /usr/include/X11/Xlib.h:3249
+XSetGraphicsExposures = _lib.XSetGraphicsExposures
+XSetGraphicsExposures.restype = c_int
+XSetGraphicsExposures.argtypes = [POINTER(Display), GC, c_int]
+
+# /usr/include/X11/Xlib.h:3255
+XSetIconName = _lib.XSetIconName
+XSetIconName.restype = c_int
+XSetIconName.argtypes = [POINTER(Display), Window, c_char_p]
+
+# /usr/include/X11/Xlib.h:3261
+XSetInputFocus = _lib.XSetInputFocus
+XSetInputFocus.restype = c_int
+XSetInputFocus.argtypes = [POINTER(Display), Window, c_int, Time]
+
+# /usr/include/X11/Xlib.h:3268
+XSetLineAttributes = _lib.XSetLineAttributes
+XSetLineAttributes.restype = c_int
+XSetLineAttributes.argtypes = [POINTER(Display), GC, c_uint, c_int, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3277
+XSetModifierMapping = _lib.XSetModifierMapping
+XSetModifierMapping.restype = c_int
+XSetModifierMapping.argtypes = [POINTER(Display), POINTER(XModifierKeymap)]
+
+# /usr/include/X11/Xlib.h:3282
+XSetPlaneMask = _lib.XSetPlaneMask
+XSetPlaneMask.restype = c_int
+XSetPlaneMask.argtypes = [POINTER(Display), GC, c_ulong]
+
+# /usr/include/X11/Xlib.h:3288
+XSetPointerMapping = _lib.XSetPointerMapping
+XSetPointerMapping.restype = c_int
+XSetPointerMapping.argtypes = [POINTER(Display), POINTER(c_ubyte), c_int]
+
+# /usr/include/X11/Xlib.h:3294
+XSetScreenSaver = _lib.XSetScreenSaver
+XSetScreenSaver.restype = c_int
+XSetScreenSaver.argtypes = [POINTER(Display), c_int, c_int, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3302
+XSetSelectionOwner = _lib.XSetSelectionOwner
+XSetSelectionOwner.restype = c_int
+XSetSelectionOwner.argtypes = [POINTER(Display), Atom, Window, Time]
+
+# /usr/include/X11/Xlib.h:3309
+XSetState = _lib.XSetState
+XSetState.restype = c_int
+XSetState.argtypes = [POINTER(Display), GC, c_ulong, c_ulong, c_int, c_ulong]
+
+# /usr/include/X11/Xlib.h:3318
+XSetStipple = _lib.XSetStipple
+XSetStipple.restype = c_int
+XSetStipple.argtypes = [POINTER(Display), GC, Pixmap]
+
+# /usr/include/X11/Xlib.h:3324
+XSetSubwindowMode = _lib.XSetSubwindowMode
+XSetSubwindowMode.restype = c_int
+XSetSubwindowMode.argtypes = [POINTER(Display), GC, c_int]
+
+# /usr/include/X11/Xlib.h:3330
+XSetTSOrigin = _lib.XSetTSOrigin
+XSetTSOrigin.restype = c_int
+XSetTSOrigin.argtypes = [POINTER(Display), GC, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3337
+XSetTile = _lib.XSetTile
+XSetTile.restype = c_int
+XSetTile.argtypes = [POINTER(Display), GC, Pixmap]
+
+# /usr/include/X11/Xlib.h:3343
+XSetWindowBackground = _lib.XSetWindowBackground
+XSetWindowBackground.restype = c_int
+XSetWindowBackground.argtypes = [POINTER(Display), Window, c_ulong]
+
+# /usr/include/X11/Xlib.h:3349
+XSetWindowBackgroundPixmap = _lib.XSetWindowBackgroundPixmap
+XSetWindowBackgroundPixmap.restype = c_int
+XSetWindowBackgroundPixmap.argtypes = [POINTER(Display), Window, Pixmap]
+
+# /usr/include/X11/Xlib.h:3355
+XSetWindowBorder = _lib.XSetWindowBorder
+XSetWindowBorder.restype = c_int
+XSetWindowBorder.argtypes = [POINTER(Display), Window, c_ulong]
+
+# /usr/include/X11/Xlib.h:3361
+XSetWindowBorderPixmap = _lib.XSetWindowBorderPixmap
+XSetWindowBorderPixmap.restype = c_int
+XSetWindowBorderPixmap.argtypes = [POINTER(Display), Window, Pixmap]
+
+# /usr/include/X11/Xlib.h:3367
+XSetWindowBorderWidth = _lib.XSetWindowBorderWidth
+XSetWindowBorderWidth.restype = c_int
+XSetWindowBorderWidth.argtypes = [POINTER(Display), Window, c_uint]
+
+# /usr/include/X11/Xlib.h:3373
+XSetWindowColormap = _lib.XSetWindowColormap
+XSetWindowColormap.restype = c_int
+XSetWindowColormap.argtypes = [POINTER(Display), Window, Colormap]
+
+# /usr/include/X11/Xlib.h:3379
+XStoreBuffer = _lib.XStoreBuffer
+XStoreBuffer.restype = c_int
+XStoreBuffer.argtypes = [POINTER(Display), c_char_p, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3386
+XStoreBytes = _lib.XStoreBytes
+XStoreBytes.restype = c_int
+XStoreBytes.argtypes = [POINTER(Display), c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:3392
+XStoreColor = _lib.XStoreColor
+XStoreColor.restype = c_int
+XStoreColor.argtypes = [POINTER(Display), Colormap, POINTER(XColor)]
+
+# /usr/include/X11/Xlib.h:3398
+XStoreColors = _lib.XStoreColors
+XStoreColors.restype = c_int
+XStoreColors.argtypes = [POINTER(Display), Colormap, POINTER(XColor), c_int]
+
+# /usr/include/X11/Xlib.h:3405
+XStoreName = _lib.XStoreName
+XStoreName.restype = c_int
+XStoreName.argtypes = [POINTER(Display), Window, c_char_p]
+
+# /usr/include/X11/Xlib.h:3411
+XStoreNamedColor = _lib.XStoreNamedColor
+XStoreNamedColor.restype = c_int
+XStoreNamedColor.argtypes = [POINTER(Display), Colormap, c_char_p, c_ulong, c_int]
+
+# /usr/include/X11/Xlib.h:3419
+XSync = _lib.XSync
+XSync.restype = c_int
+XSync.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:3424
+XTextExtents = _lib.XTextExtents
+XTextExtents.restype = c_int
+XTextExtents.argtypes = [POINTER(XFontStruct), c_char_p, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(XCharStruct)]
+
+# /usr/include/X11/Xlib.h:3434
+XTextExtents16 = _lib.XTextExtents16
+XTextExtents16.restype = c_int
+XTextExtents16.argtypes = [POINTER(XFontStruct), POINTER(XChar2b), c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(XCharStruct)]
+
+# /usr/include/X11/Xlib.h:3444
+XTextWidth = _lib.XTextWidth
+XTextWidth.restype = c_int
+XTextWidth.argtypes = [POINTER(XFontStruct), c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:3450
+XTextWidth16 = _lib.XTextWidth16
+XTextWidth16.restype = c_int
+XTextWidth16.argtypes = [POINTER(XFontStruct), POINTER(XChar2b), c_int]
+
+# /usr/include/X11/Xlib.h:3456
+XTranslateCoordinates = _lib.XTranslateCoordinates
+XTranslateCoordinates.restype = c_int
+XTranslateCoordinates.argtypes = [POINTER(Display), Window, Window, c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(Window)]
+
+# /usr/include/X11/Xlib.h:3467
+XUndefineCursor = _lib.XUndefineCursor
+XUndefineCursor.restype = c_int
+XUndefineCursor.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:3472
+XUngrabButton = _lib.XUngrabButton
+XUngrabButton.restype = c_int
+XUngrabButton.argtypes = [POINTER(Display), c_uint, c_uint, Window]
+
+# /usr/include/X11/Xlib.h:3479
+XUngrabKey = _lib.XUngrabKey
+XUngrabKey.restype = c_int
+XUngrabKey.argtypes = [POINTER(Display), c_int, c_uint, Window]
+
+# /usr/include/X11/Xlib.h:3486
+XUngrabKeyboard = _lib.XUngrabKeyboard
+XUngrabKeyboard.restype = c_int
+XUngrabKeyboard.argtypes = [POINTER(Display), Time]
+
+# /usr/include/X11/Xlib.h:3491
+XUngrabPointer = _lib.XUngrabPointer
+XUngrabPointer.restype = c_int
+XUngrabPointer.argtypes = [POINTER(Display), Time]
+
+# /usr/include/X11/Xlib.h:3496
+XUngrabServer = _lib.XUngrabServer
+XUngrabServer.restype = c_int
+XUngrabServer.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:3500
+XUninstallColormap = _lib.XUninstallColormap
+XUninstallColormap.restype = c_int
+XUninstallColormap.argtypes = [POINTER(Display), Colormap]
+
+# /usr/include/X11/Xlib.h:3505
+XUnloadFont = _lib.XUnloadFont
+XUnloadFont.restype = c_int
+XUnloadFont.argtypes = [POINTER(Display), Font]
+
+# /usr/include/X11/Xlib.h:3510
+XUnmapSubwindows = _lib.XUnmapSubwindows
+XUnmapSubwindows.restype = c_int
+XUnmapSubwindows.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:3515
+XUnmapWindow = _lib.XUnmapWindow
+XUnmapWindow.restype = c_int
+XUnmapWindow.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:3520
+XVendorRelease = _lib.XVendorRelease
+XVendorRelease.restype = c_int
+XVendorRelease.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:3524
+XWarpPointer = _lib.XWarpPointer
+XWarpPointer.restype = c_int
+XWarpPointer.argtypes = [POINTER(Display), Window, Window, c_int, c_int, c_uint, c_uint, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3536
+XWidthMMOfScreen = _lib.XWidthMMOfScreen
+XWidthMMOfScreen.restype = c_int
+XWidthMMOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:3540
+XWidthOfScreen = _lib.XWidthOfScreen
+XWidthOfScreen.restype = c_int
+XWidthOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:3544
+XWindowEvent = _lib.XWindowEvent
+XWindowEvent.restype = c_int
+XWindowEvent.argtypes = [POINTER(Display), Window, c_long, POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:3551
+XWriteBitmapFile = _lib.XWriteBitmapFile
+XWriteBitmapFile.restype = c_int
+XWriteBitmapFile.argtypes = [POINTER(Display), c_char_p, Pixmap, c_uint, c_uint, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3561
+XSupportsLocale = _lib.XSupportsLocale
+XSupportsLocale.restype = c_int
+XSupportsLocale.argtypes = []
+
+# /usr/include/X11/Xlib.h:3563
+XSetLocaleModifiers = _lib.XSetLocaleModifiers
+XSetLocaleModifiers.restype = c_char_p
+XSetLocaleModifiers.argtypes = [c_char_p]
+
+class struct__XrmHashBucketRec(Structure):
+ __slots__ = [
+ ]
+struct__XrmHashBucketRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+# /usr/include/X11/Xlib.h:3567
+XOpenOM = _lib.XOpenOM
+XOpenOM.restype = XOM
+XOpenOM.argtypes = [POINTER(Display), POINTER(struct__XrmHashBucketRec), c_char_p, c_char_p]
+
+# /usr/include/X11/Xlib.h:3574
+XCloseOM = _lib.XCloseOM
+XCloseOM.restype = c_int
+XCloseOM.argtypes = [XOM]
+
+# /usr/include/X11/Xlib.h:3578
+XSetOMValues = _lib.XSetOMValues
+XSetOMValues.restype = c_char_p
+XSetOMValues.argtypes = [XOM]
+
+# /usr/include/X11/Xlib.h:3583
+XGetOMValues = _lib.XGetOMValues
+XGetOMValues.restype = c_char_p
+XGetOMValues.argtypes = [XOM]
+
+# /usr/include/X11/Xlib.h:3588
+XDisplayOfOM = _lib.XDisplayOfOM
+XDisplayOfOM.restype = POINTER(Display)
+XDisplayOfOM.argtypes = [XOM]
+
+# /usr/include/X11/Xlib.h:3592
+XLocaleOfOM = _lib.XLocaleOfOM
+XLocaleOfOM.restype = c_char_p
+XLocaleOfOM.argtypes = [XOM]
+
+# /usr/include/X11/Xlib.h:3596
+XCreateOC = _lib.XCreateOC
+XCreateOC.restype = XOC
+XCreateOC.argtypes = [XOM]
+
+# /usr/include/X11/Xlib.h:3601
+XDestroyOC = _lib.XDestroyOC
+XDestroyOC.restype = None
+XDestroyOC.argtypes = [XOC]
+
+# /usr/include/X11/Xlib.h:3605
+XOMOfOC = _lib.XOMOfOC
+XOMOfOC.restype = XOM
+XOMOfOC.argtypes = [XOC]
+
+# /usr/include/X11/Xlib.h:3609
+XSetOCValues = _lib.XSetOCValues
+XSetOCValues.restype = c_char_p
+XSetOCValues.argtypes = [XOC]
+
+# /usr/include/X11/Xlib.h:3614
+XGetOCValues = _lib.XGetOCValues
+XGetOCValues.restype = c_char_p
+XGetOCValues.argtypes = [XOC]
+
+# /usr/include/X11/Xlib.h:3619
+XCreateFontSet = _lib.XCreateFontSet
+XCreateFontSet.restype = XFontSet
+XCreateFontSet.argtypes = [POINTER(Display), c_char_p, POINTER(POINTER(c_char_p)), POINTER(c_int), POINTER(c_char_p)]
+
+# /usr/include/X11/Xlib.h:3627
+XFreeFontSet = _lib.XFreeFontSet
+XFreeFontSet.restype = None
+XFreeFontSet.argtypes = [POINTER(Display), XFontSet]
+
+# /usr/include/X11/Xlib.h:3632
+XFontsOfFontSet = _lib.XFontsOfFontSet
+XFontsOfFontSet.restype = c_int
+XFontsOfFontSet.argtypes = [XFontSet, POINTER(POINTER(POINTER(XFontStruct))), POINTER(POINTER(c_char_p))]
+
+# /usr/include/X11/Xlib.h:3638
+XBaseFontNameListOfFontSet = _lib.XBaseFontNameListOfFontSet
+XBaseFontNameListOfFontSet.restype = c_char_p
+XBaseFontNameListOfFontSet.argtypes = [XFontSet]
+
+# /usr/include/X11/Xlib.h:3642
+XLocaleOfFontSet = _lib.XLocaleOfFontSet
+XLocaleOfFontSet.restype = c_char_p
+XLocaleOfFontSet.argtypes = [XFontSet]
+
+# /usr/include/X11/Xlib.h:3646
+XContextDependentDrawing = _lib.XContextDependentDrawing
+XContextDependentDrawing.restype = c_int
+XContextDependentDrawing.argtypes = [XFontSet]
+
+# /usr/include/X11/Xlib.h:3650
+XDirectionalDependentDrawing = _lib.XDirectionalDependentDrawing
+XDirectionalDependentDrawing.restype = c_int
+XDirectionalDependentDrawing.argtypes = [XFontSet]
+
+# /usr/include/X11/Xlib.h:3654
+XContextualDrawing = _lib.XContextualDrawing
+XContextualDrawing.restype = c_int
+XContextualDrawing.argtypes = [XFontSet]
+
+# /usr/include/X11/Xlib.h:3658
+XExtentsOfFontSet = _lib.XExtentsOfFontSet
+XExtentsOfFontSet.restype = POINTER(XFontSetExtents)
+XExtentsOfFontSet.argtypes = [XFontSet]
+
+# /usr/include/X11/Xlib.h:3662
+XmbTextEscapement = _lib.XmbTextEscapement
+XmbTextEscapement.restype = c_int
+XmbTextEscapement.argtypes = [XFontSet, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:3668
+XwcTextEscapement = _lib.XwcTextEscapement
+XwcTextEscapement.restype = c_int
+XwcTextEscapement.argtypes = [XFontSet, c_wchar_p, c_int]
+
+# /usr/include/X11/Xlib.h:3674
+Xutf8TextEscapement = _lib.Xutf8TextEscapement
+Xutf8TextEscapement.restype = c_int
+Xutf8TextEscapement.argtypes = [XFontSet, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:3680
+XmbTextExtents = _lib.XmbTextExtents
+XmbTextExtents.restype = c_int
+XmbTextExtents.argtypes = [XFontSet, c_char_p, c_int, POINTER(XRectangle), POINTER(XRectangle)]
+
+# /usr/include/X11/Xlib.h:3688
+XwcTextExtents = _lib.XwcTextExtents
+XwcTextExtents.restype = c_int
+XwcTextExtents.argtypes = [XFontSet, c_wchar_p, c_int, POINTER(XRectangle), POINTER(XRectangle)]
+
+# /usr/include/X11/Xlib.h:3696
+Xutf8TextExtents = _lib.Xutf8TextExtents
+Xutf8TextExtents.restype = c_int
+Xutf8TextExtents.argtypes = [XFontSet, c_char_p, c_int, POINTER(XRectangle), POINTER(XRectangle)]
+
+# /usr/include/X11/Xlib.h:3704
+XmbTextPerCharExtents = _lib.XmbTextPerCharExtents
+XmbTextPerCharExtents.restype = c_int
+XmbTextPerCharExtents.argtypes = [XFontSet, c_char_p, c_int, POINTER(XRectangle), POINTER(XRectangle), c_int, POINTER(c_int), POINTER(XRectangle), POINTER(XRectangle)]
+
+# /usr/include/X11/Xlib.h:3716
+XwcTextPerCharExtents = _lib.XwcTextPerCharExtents
+XwcTextPerCharExtents.restype = c_int
+XwcTextPerCharExtents.argtypes = [XFontSet, c_wchar_p, c_int, POINTER(XRectangle), POINTER(XRectangle), c_int, POINTER(c_int), POINTER(XRectangle), POINTER(XRectangle)]
+
+# /usr/include/X11/Xlib.h:3728
+Xutf8TextPerCharExtents = _lib.Xutf8TextPerCharExtents
+Xutf8TextPerCharExtents.restype = c_int
+Xutf8TextPerCharExtents.argtypes = [XFontSet, c_char_p, c_int, POINTER(XRectangle), POINTER(XRectangle), c_int, POINTER(c_int), POINTER(XRectangle), POINTER(XRectangle)]
+
+# /usr/include/X11/Xlib.h:3740
+XmbDrawText = _lib.XmbDrawText
+XmbDrawText.restype = None
+XmbDrawText.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, POINTER(XmbTextItem), c_int]
+
+# /usr/include/X11/Xlib.h:3750
+XwcDrawText = _lib.XwcDrawText
+XwcDrawText.restype = None
+XwcDrawText.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, POINTER(XwcTextItem), c_int]
+
+# /usr/include/X11/Xlib.h:3760
+Xutf8DrawText = _lib.Xutf8DrawText
+Xutf8DrawText.restype = None
+Xutf8DrawText.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, POINTER(XmbTextItem), c_int]
+
+# /usr/include/X11/Xlib.h:3770
+XmbDrawString = _lib.XmbDrawString
+XmbDrawString.restype = None
+XmbDrawString.argtypes = [POINTER(Display), Drawable, XFontSet, GC, c_int, c_int, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:3781
+XwcDrawString = _lib.XwcDrawString
+XwcDrawString.restype = None
+XwcDrawString.argtypes = [POINTER(Display), Drawable, XFontSet, GC, c_int, c_int, c_wchar_p, c_int]
+
+# /usr/include/X11/Xlib.h:3792
+Xutf8DrawString = _lib.Xutf8DrawString
+Xutf8DrawString.restype = None
+Xutf8DrawString.argtypes = [POINTER(Display), Drawable, XFontSet, GC, c_int, c_int, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:3803
+XmbDrawImageString = _lib.XmbDrawImageString
+XmbDrawImageString.restype = None
+XmbDrawImageString.argtypes = [POINTER(Display), Drawable, XFontSet, GC, c_int, c_int, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:3814
+XwcDrawImageString = _lib.XwcDrawImageString
+XwcDrawImageString.restype = None
+XwcDrawImageString.argtypes = [POINTER(Display), Drawable, XFontSet, GC, c_int, c_int, c_wchar_p, c_int]
+
+# /usr/include/X11/Xlib.h:3825
+Xutf8DrawImageString = _lib.Xutf8DrawImageString
+Xutf8DrawImageString.restype = None
+Xutf8DrawImageString.argtypes = [POINTER(Display), Drawable, XFontSet, GC, c_int, c_int, c_char_p, c_int]
+
+class struct__XrmHashBucketRec(Structure):
+ __slots__ = [
+ ]
+struct__XrmHashBucketRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+# /usr/include/X11/Xlib.h:3836
+XOpenIM = _lib.XOpenIM
+XOpenIM.restype = XIM
+XOpenIM.argtypes = [POINTER(Display), POINTER(struct__XrmHashBucketRec), c_char_p, c_char_p]
+
+# /usr/include/X11/Xlib.h:3843
+XCloseIM = _lib.XCloseIM
+XCloseIM.restype = c_int
+XCloseIM.argtypes = [XIM]
+
+# /usr/include/X11/Xlib.h:3847
+XGetIMValues = _lib.XGetIMValues
+XGetIMValues.restype = c_char_p
+XGetIMValues.argtypes = [XIM]
+
+# /usr/include/X11/Xlib.h:3851
+XSetIMValues = _lib.XSetIMValues
+XSetIMValues.restype = c_char_p
+XSetIMValues.argtypes = [XIM]
+
+# /usr/include/X11/Xlib.h:3855
+XDisplayOfIM = _lib.XDisplayOfIM
+XDisplayOfIM.restype = POINTER(Display)
+XDisplayOfIM.argtypes = [XIM]
+
+# /usr/include/X11/Xlib.h:3859
+XLocaleOfIM = _lib.XLocaleOfIM
+XLocaleOfIM.restype = c_char_p
+XLocaleOfIM.argtypes = [XIM]
+
+# /usr/include/X11/Xlib.h:3863
+XCreateIC = _lib.XCreateIC
+XCreateIC.restype = XIC
+XCreateIC.argtypes = [XIM]
+
+# /usr/include/X11/Xlib.h:3867
+XDestroyIC = _lib.XDestroyIC
+XDestroyIC.restype = None
+XDestroyIC.argtypes = [XIC]
+
+# /usr/include/X11/Xlib.h:3871
+XSetICFocus = _lib.XSetICFocus
+XSetICFocus.restype = None
+XSetICFocus.argtypes = [XIC]
+
+# /usr/include/X11/Xlib.h:3875
+XUnsetICFocus = _lib.XUnsetICFocus
+XUnsetICFocus.restype = None
+XUnsetICFocus.argtypes = [XIC]
+
+# /usr/include/X11/Xlib.h:3879
+XwcResetIC = _lib.XwcResetIC
+XwcResetIC.restype = c_wchar_p
+XwcResetIC.argtypes = [XIC]
+
+# /usr/include/X11/Xlib.h:3883
+XmbResetIC = _lib.XmbResetIC
+XmbResetIC.restype = c_char_p
+XmbResetIC.argtypes = [XIC]
+
+# /usr/include/X11/Xlib.h:3887
+Xutf8ResetIC = _lib.Xutf8ResetIC
+Xutf8ResetIC.restype = c_char_p
+Xutf8ResetIC.argtypes = [XIC]
+
+# /usr/include/X11/Xlib.h:3891
+XSetICValues = _lib.XSetICValues
+XSetICValues.restype = c_char_p
+XSetICValues.argtypes = [XIC]
+
+# /usr/include/X11/Xlib.h:3895
+XGetICValues = _lib.XGetICValues
+XGetICValues.restype = c_char_p
+XGetICValues.argtypes = [XIC]
+
+# /usr/include/X11/Xlib.h:3899
+XIMOfIC = _lib.XIMOfIC
+XIMOfIC.restype = XIM
+XIMOfIC.argtypes = [XIC]
+
+# /usr/include/X11/Xlib.h:3903
+XFilterEvent = _lib.XFilterEvent
+XFilterEvent.restype = c_int
+XFilterEvent.argtypes = [POINTER(XEvent), Window]
+
+# /usr/include/X11/Xlib.h:3908
+XmbLookupString = _lib.XmbLookupString
+XmbLookupString.restype = c_int
+XmbLookupString.argtypes = [XIC, POINTER(XKeyPressedEvent), c_char_p, c_int, POINTER(KeySym), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:3917
+XwcLookupString = _lib.XwcLookupString
+XwcLookupString.restype = c_int
+XwcLookupString.argtypes = [XIC, POINTER(XKeyPressedEvent), c_wchar_p, c_int, POINTER(KeySym), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:3926
+Xutf8LookupString = _lib.Xutf8LookupString
+Xutf8LookupString.restype = c_int
+Xutf8LookupString.argtypes = [XIC, POINTER(XKeyPressedEvent), c_char_p, c_int, POINTER(KeySym), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:3935
+XVaCreateNestedList = _lib.XVaCreateNestedList
+XVaCreateNestedList.restype = XVaNestedList
+XVaCreateNestedList.argtypes = [c_int]
+
+class struct__XrmHashBucketRec(Structure):
+ __slots__ = [
+ ]
+struct__XrmHashBucketRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+# /usr/include/X11/Xlib.h:3941
+XRegisterIMInstantiateCallback = _lib.XRegisterIMInstantiateCallback
+XRegisterIMInstantiateCallback.restype = c_int
+XRegisterIMInstantiateCallback.argtypes = [POINTER(Display), POINTER(struct__XrmHashBucketRec), c_char_p, c_char_p, XIDProc, XPointer]
+
+class struct__XrmHashBucketRec(Structure):
+ __slots__ = [
+ ]
+struct__XrmHashBucketRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+# /usr/include/X11/Xlib.h:3950
+XUnregisterIMInstantiateCallback = _lib.XUnregisterIMInstantiateCallback
+XUnregisterIMInstantiateCallback.restype = c_int
+XUnregisterIMInstantiateCallback.argtypes = [POINTER(Display), POINTER(struct__XrmHashBucketRec), c_char_p, c_char_p, XIDProc, XPointer]
+
+XConnectionWatchProc = CFUNCTYPE(None, POINTER(Display), XPointer, c_int, c_int, POINTER(XPointer)) # /usr/include/X11/Xlib.h:3959
+# /usr/include/X11/Xlib.h:3968
+XInternalConnectionNumbers = _lib.XInternalConnectionNumbers
+XInternalConnectionNumbers.restype = c_int
+XInternalConnectionNumbers.argtypes = [POINTER(Display), POINTER(POINTER(c_int)), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:3974
+XProcessInternalConnection = _lib.XProcessInternalConnection
+XProcessInternalConnection.restype = None
+XProcessInternalConnection.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:3979
+XAddConnectionWatch = _lib.XAddConnectionWatch
+XAddConnectionWatch.restype = c_int
+XAddConnectionWatch.argtypes = [POINTER(Display), XConnectionWatchProc, XPointer]
+
+# /usr/include/X11/Xlib.h:3985
+XRemoveConnectionWatch = _lib.XRemoveConnectionWatch
+XRemoveConnectionWatch.restype = None
+XRemoveConnectionWatch.argtypes = [POINTER(Display), XConnectionWatchProc, XPointer]
+
+# /usr/include/X11/Xlib.h:3991
+XSetAuthorization = _lib.XSetAuthorization
+XSetAuthorization.restype = None
+XSetAuthorization.argtypes = [c_char_p, c_int, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:3998
+_Xmbtowc = _lib._Xmbtowc
+_Xmbtowc.restype = c_int
+_Xmbtowc.argtypes = [c_wchar_p, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:4009
+_Xwctomb = _lib._Xwctomb
+_Xwctomb.restype = c_int
+_Xwctomb.argtypes = [c_char_p, c_wchar]
+
+# /usr/include/X11/Xlib.h:4014
+XGetEventData = _lib.XGetEventData
+XGetEventData.restype = c_int
+XGetEventData.argtypes = [POINTER(Display), POINTER(XGenericEventCookie)]
+
+# /usr/include/X11/Xlib.h:4019
+XFreeEventData = _lib.XFreeEventData
+XFreeEventData.restype = None
+XFreeEventData.argtypes = [POINTER(Display), POINTER(XGenericEventCookie)]
+
+NoValue = 0 # /usr/include/X11/Xutil.h:4805
+XValue = 1 # /usr/include/X11/Xutil.h:4806
+YValue = 2 # /usr/include/X11/Xutil.h:4807
+WidthValue = 4 # /usr/include/X11/Xutil.h:4808
+HeightValue = 8 # /usr/include/X11/Xutil.h:4809
+AllValues = 15 # /usr/include/X11/Xutil.h:4810
+XNegative = 16 # /usr/include/X11/Xutil.h:4811
+YNegative = 32 # /usr/include/X11/Xutil.h:4812
+class struct_anon_95(Structure):
+ __slots__ = [
+ 'flags',
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'min_width',
+ 'min_height',
+ 'max_width',
+ 'max_height',
+ 'width_inc',
+ 'height_inc',
+ 'min_aspect',
+ 'max_aspect',
+ 'base_width',
+ 'base_height',
+ 'win_gravity',
+ ]
+class struct_anon_96(Structure):
+ __slots__ = [
+ 'x',
+ 'y',
+ ]
+struct_anon_96._fields_ = [
+ ('x', c_int),
+ ('y', c_int),
+]
+
+class struct_anon_97(Structure):
+ __slots__ = [
+ 'x',
+ 'y',
+ ]
+struct_anon_97._fields_ = [
+ ('x', c_int),
+ ('y', c_int),
+]
+
+struct_anon_95._fields_ = [
+ ('flags', c_long),
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('min_width', c_int),
+ ('min_height', c_int),
+ ('max_width', c_int),
+ ('max_height', c_int),
+ ('width_inc', c_int),
+ ('height_inc', c_int),
+ ('min_aspect', struct_anon_96),
+ ('max_aspect', struct_anon_97),
+ ('base_width', c_int),
+ ('base_height', c_int),
+ ('win_gravity', c_int),
+]
+
+XSizeHints = struct_anon_95 # /usr/include/X11/Xutil.h:4831
+USPosition = 1 # /usr/include/X11/Xutil.h:4839
+USSize = 2 # /usr/include/X11/Xutil.h:4840
+PPosition = 4 # /usr/include/X11/Xutil.h:4842
+PSize = 8 # /usr/include/X11/Xutil.h:4843
+PMinSize = 16 # /usr/include/X11/Xutil.h:4844
+PMaxSize = 32 # /usr/include/X11/Xutil.h:4845
+PResizeInc = 64 # /usr/include/X11/Xutil.h:4846
+PAspect = 128 # /usr/include/X11/Xutil.h:4847
+PBaseSize = 256 # /usr/include/X11/Xutil.h:4848
+PWinGravity = 512 # /usr/include/X11/Xutil.h:4849
+PAllHints = 252 # /usr/include/X11/Xutil.h:4852
+class struct_anon_98(Structure):
+ __slots__ = [
+ 'flags',
+ 'input',
+ 'initial_state',
+ 'icon_pixmap',
+ 'icon_window',
+ 'icon_x',
+ 'icon_y',
+ 'icon_mask',
+ 'window_group',
+ ]
+struct_anon_98._fields_ = [
+ ('flags', c_long),
+ ('input', c_int),
+ ('initial_state', c_int),
+ ('icon_pixmap', Pixmap),
+ ('icon_window', Window),
+ ('icon_x', c_int),
+ ('icon_y', c_int),
+ ('icon_mask', Pixmap),
+ ('window_group', XID),
+]
+
+XWMHints = struct_anon_98 # /usr/include/X11/Xutil.h:4867
+InputHint = 1 # /usr/include/X11/Xutil.h:4871
+StateHint = 2 # /usr/include/X11/Xutil.h:4872
+IconPixmapHint = 4 # /usr/include/X11/Xutil.h:4873
+IconWindowHint = 8 # /usr/include/X11/Xutil.h:4874
+IconPositionHint = 16 # /usr/include/X11/Xutil.h:4875
+IconMaskHint = 32 # /usr/include/X11/Xutil.h:4876
+WindowGroupHint = 64 # /usr/include/X11/Xutil.h:4877
+AllHints = 127 # /usr/include/X11/Xutil.h:4878
+XUrgencyHint = 256 # /usr/include/X11/Xutil.h:4880
+WithdrawnState = 0 # /usr/include/X11/Xutil.h:4883
+NormalState = 1 # /usr/include/X11/Xutil.h:4884
+IconicState = 3 # /usr/include/X11/Xutil.h:4885
+DontCareState = 0 # /usr/include/X11/Xutil.h:4890
+ZoomState = 2 # /usr/include/X11/Xutil.h:4891
+InactiveState = 4 # /usr/include/X11/Xutil.h:4892
+class struct_anon_99(Structure):
+ __slots__ = [
+ 'value',
+ 'encoding',
+ 'format',
+ 'nitems',
+ ]
+struct_anon_99._fields_ = [
+ ('value', POINTER(c_ubyte)),
+ ('encoding', Atom),
+ ('format', c_int),
+ ('nitems', c_ulong),
+]
+
+XTextProperty = struct_anon_99 # /usr/include/X11/Xutil.h:4905
+XNoMemory = -1 # /usr/include/X11/Xutil.h:4907
+XLocaleNotSupported = -2 # /usr/include/X11/Xutil.h:4908
+XConverterNotFound = -3 # /usr/include/X11/Xutil.h:4909
+enum_anon_100 = c_int
+XStringStyle = 0
+XCompoundTextStyle = 1
+XTextStyle = 2
+XStdICCTextStyle = 3
+XUTF8StringStyle = 4
+XICCEncodingStyle = enum_anon_100 # /usr/include/X11/Xutil.h:4918
+class struct_anon_101(Structure):
+ __slots__ = [
+ 'min_width',
+ 'min_height',
+ 'max_width',
+ 'max_height',
+ 'width_inc',
+ 'height_inc',
+ ]
+struct_anon_101._fields_ = [
+ ('min_width', c_int),
+ ('min_height', c_int),
+ ('max_width', c_int),
+ ('max_height', c_int),
+ ('width_inc', c_int),
+ ('height_inc', c_int),
+]
+
+XIconSize = struct_anon_101 # /usr/include/X11/Xutil.h:4924
+class struct_anon_102(Structure):
+ __slots__ = [
+ 'res_name',
+ 'res_class',
+ ]
+struct_anon_102._fields_ = [
+ ('res_name', c_char_p),
+ ('res_class', c_char_p),
+]
+
+XClassHint = struct_anon_102 # /usr/include/X11/Xutil.h:4929
+class struct__XComposeStatus(Structure):
+ __slots__ = [
+ 'compose_ptr',
+ 'chars_matched',
+ ]
+struct__XComposeStatus._fields_ = [
+ ('compose_ptr', XPointer),
+ ('chars_matched', c_int),
+]
+
+XComposeStatus = struct__XComposeStatus # /usr/include/X11/Xutil.h:4971
+class struct__XRegion(Structure):
+ __slots__ = [
+ ]
+struct__XRegion._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XRegion(Structure):
+ __slots__ = [
+ ]
+struct__XRegion._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+Region = POINTER(struct__XRegion) # /usr/include/X11/Xutil.h:5010
+RectangleOut = 0 # /usr/include/X11/Xutil.h:5014
+RectangleIn = 1 # /usr/include/X11/Xutil.h:5015
+RectanglePart = 2 # /usr/include/X11/Xutil.h:5016
+class struct_anon_103(Structure):
+ __slots__ = [
+ 'visual',
+ 'visualid',
+ 'screen',
+ 'depth',
+ 'class',
+ 'red_mask',
+ 'green_mask',
+ 'blue_mask',
+ 'colormap_size',
+ 'bits_per_rgb',
+ ]
+struct_anon_103._fields_ = [
+ ('visual', POINTER(Visual)),
+ ('visualid', VisualID),
+ ('screen', c_int),
+ ('depth', c_int),
+ ('class', c_int),
+ ('red_mask', c_ulong),
+ ('green_mask', c_ulong),
+ ('blue_mask', c_ulong),
+ ('colormap_size', c_int),
+ ('bits_per_rgb', c_int),
+]
+
+XVisualInfo = struct_anon_103 # /usr/include/X11/Xutil.h:5039
+VisualNoMask = 0 # /usr/include/X11/Xutil.h:5041
+VisualIDMask = 1 # /usr/include/X11/Xutil.h:5042
+VisualScreenMask = 2 # /usr/include/X11/Xutil.h:5043
+VisualDepthMask = 4 # /usr/include/X11/Xutil.h:5044
+VisualClassMask = 8 # /usr/include/X11/Xutil.h:5045
+VisualRedMaskMask = 16 # /usr/include/X11/Xutil.h:5046
+VisualGreenMaskMask = 32 # /usr/include/X11/Xutil.h:5047
+VisualBlueMaskMask = 64 # /usr/include/X11/Xutil.h:5048
+VisualColormapSizeMask = 128 # /usr/include/X11/Xutil.h:5049
+VisualBitsPerRGBMask = 256 # /usr/include/X11/Xutil.h:5050
+VisualAllMask = 511 # /usr/include/X11/Xutil.h:5051
+class struct_anon_104(Structure):
+ __slots__ = [
+ 'colormap',
+ 'red_max',
+ 'red_mult',
+ 'green_max',
+ 'green_mult',
+ 'blue_max',
+ 'blue_mult',
+ 'base_pixel',
+ 'visualid',
+ 'killid',
+ ]
+struct_anon_104._fields_ = [
+ ('colormap', Colormap),
+ ('red_max', c_ulong),
+ ('red_mult', c_ulong),
+ ('green_max', c_ulong),
+ ('green_mult', c_ulong),
+ ('blue_max', c_ulong),
+ ('blue_mult', c_ulong),
+ ('base_pixel', c_ulong),
+ ('visualid', VisualID),
+ ('killid', XID),
+]
+
+XStandardColormap = struct_anon_104 # /usr/include/X11/Xutil.h:5068
+BitmapSuccess = 0 # /usr/include/X11/Xutil.h:5076
+BitmapOpenFailed = 1 # /usr/include/X11/Xutil.h:5077
+BitmapFileInvalid = 2 # /usr/include/X11/Xutil.h:5078
+BitmapNoMemory = 3 # /usr/include/X11/Xutil.h:5079
+XCSUCCESS = 0 # /usr/include/X11/Xutil.h:5090
+XCNOMEM = 1 # /usr/include/X11/Xutil.h:5091
+XCNOENT = 2 # /usr/include/X11/Xutil.h:5092
+XContext = c_int # /usr/include/X11/Xutil.h:5094
+# /usr/include/X11/Xutil.h:5103
+XAllocClassHint = _lib.XAllocClassHint
+XAllocClassHint.restype = POINTER(XClassHint)
+XAllocClassHint.argtypes = []
+
+# /usr/include/X11/Xutil.h:5107
+XAllocIconSize = _lib.XAllocIconSize
+XAllocIconSize.restype = POINTER(XIconSize)
+XAllocIconSize.argtypes = []
+
+# /usr/include/X11/Xutil.h:5111
+XAllocSizeHints = _lib.XAllocSizeHints
+XAllocSizeHints.restype = POINTER(XSizeHints)
+XAllocSizeHints.argtypes = []
+
+# /usr/include/X11/Xutil.h:5115
+XAllocStandardColormap = _lib.XAllocStandardColormap
+XAllocStandardColormap.restype = POINTER(XStandardColormap)
+XAllocStandardColormap.argtypes = []
+
+# /usr/include/X11/Xutil.h:5119
+XAllocWMHints = _lib.XAllocWMHints
+XAllocWMHints.restype = POINTER(XWMHints)
+XAllocWMHints.argtypes = []
+
+# /usr/include/X11/Xutil.h:5123
+XClipBox = _lib.XClipBox
+XClipBox.restype = c_int
+XClipBox.argtypes = [Region, POINTER(XRectangle)]
+
+# /usr/include/X11/Xutil.h:5128
+XCreateRegion = _lib.XCreateRegion
+XCreateRegion.restype = Region
+XCreateRegion.argtypes = []
+
+# /usr/include/X11/Xutil.h:5132
+XDefaultString = _lib.XDefaultString
+XDefaultString.restype = c_char_p
+XDefaultString.argtypes = []
+
+# /usr/include/X11/Xutil.h:5134
+XDeleteContext = _lib.XDeleteContext
+XDeleteContext.restype = c_int
+XDeleteContext.argtypes = [POINTER(Display), XID, XContext]
+
+# /usr/include/X11/Xutil.h:5140
+XDestroyRegion = _lib.XDestroyRegion
+XDestroyRegion.restype = c_int
+XDestroyRegion.argtypes = [Region]
+
+# /usr/include/X11/Xutil.h:5144
+XEmptyRegion = _lib.XEmptyRegion
+XEmptyRegion.restype = c_int
+XEmptyRegion.argtypes = [Region]
+
+# /usr/include/X11/Xutil.h:5148
+XEqualRegion = _lib.XEqualRegion
+XEqualRegion.restype = c_int
+XEqualRegion.argtypes = [Region, Region]
+
+# /usr/include/X11/Xutil.h:5153
+XFindContext = _lib.XFindContext
+XFindContext.restype = c_int
+XFindContext.argtypes = [POINTER(Display), XID, XContext, POINTER(XPointer)]
+
+# /usr/include/X11/Xutil.h:5160
+XGetClassHint = _lib.XGetClassHint
+XGetClassHint.restype = c_int
+XGetClassHint.argtypes = [POINTER(Display), Window, POINTER(XClassHint)]
+
+# /usr/include/X11/Xutil.h:5166
+XGetIconSizes = _lib.XGetIconSizes
+XGetIconSizes.restype = c_int
+XGetIconSizes.argtypes = [POINTER(Display), Window, POINTER(POINTER(XIconSize)), POINTER(c_int)]
+
+# /usr/include/X11/Xutil.h:5173
+XGetNormalHints = _lib.XGetNormalHints
+XGetNormalHints.restype = c_int
+XGetNormalHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints)]
+
+# /usr/include/X11/Xutil.h:5179
+XGetRGBColormaps = _lib.XGetRGBColormaps
+XGetRGBColormaps.restype = c_int
+XGetRGBColormaps.argtypes = [POINTER(Display), Window, POINTER(POINTER(XStandardColormap)), POINTER(c_int), Atom]
+
+# /usr/include/X11/Xutil.h:5187
+XGetSizeHints = _lib.XGetSizeHints
+XGetSizeHints.restype = c_int
+XGetSizeHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints), Atom]
+
+# /usr/include/X11/Xutil.h:5194
+XGetStandardColormap = _lib.XGetStandardColormap
+XGetStandardColormap.restype = c_int
+XGetStandardColormap.argtypes = [POINTER(Display), Window, POINTER(XStandardColormap), Atom]
+
+# /usr/include/X11/Xutil.h:5201
+XGetTextProperty = _lib.XGetTextProperty
+XGetTextProperty.restype = c_int
+XGetTextProperty.argtypes = [POINTER(Display), Window, POINTER(XTextProperty), Atom]
+
+# /usr/include/X11/Xutil.h:5208
+XGetVisualInfo = _lib.XGetVisualInfo
+XGetVisualInfo.restype = POINTER(XVisualInfo)
+XGetVisualInfo.argtypes = [POINTER(Display), c_long, POINTER(XVisualInfo), POINTER(c_int)]
+
+# /usr/include/X11/Xutil.h:5215
+XGetWMClientMachine = _lib.XGetWMClientMachine
+XGetWMClientMachine.restype = c_int
+XGetWMClientMachine.argtypes = [POINTER(Display), Window, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5221
+XGetWMHints = _lib.XGetWMHints
+XGetWMHints.restype = POINTER(XWMHints)
+XGetWMHints.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xutil.h:5226
+XGetWMIconName = _lib.XGetWMIconName
+XGetWMIconName.restype = c_int
+XGetWMIconName.argtypes = [POINTER(Display), Window, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5232
+XGetWMName = _lib.XGetWMName
+XGetWMName.restype = c_int
+XGetWMName.argtypes = [POINTER(Display), Window, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5238
+XGetWMNormalHints = _lib.XGetWMNormalHints
+XGetWMNormalHints.restype = c_int
+XGetWMNormalHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints), POINTER(c_long)]
+
+# /usr/include/X11/Xutil.h:5245
+XGetWMSizeHints = _lib.XGetWMSizeHints
+XGetWMSizeHints.restype = c_int
+XGetWMSizeHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints), POINTER(c_long), Atom]
+
+# /usr/include/X11/Xutil.h:5253
+XGetZoomHints = _lib.XGetZoomHints
+XGetZoomHints.restype = c_int
+XGetZoomHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints)]
+
+# /usr/include/X11/Xutil.h:5259
+XIntersectRegion = _lib.XIntersectRegion
+XIntersectRegion.restype = c_int
+XIntersectRegion.argtypes = [Region, Region, Region]
+
+# /usr/include/X11/Xutil.h:5265
+XConvertCase = _lib.XConvertCase
+XConvertCase.restype = None
+XConvertCase.argtypes = [KeySym, POINTER(KeySym), POINTER(KeySym)]
+
+# /usr/include/X11/Xutil.h:5271
+XLookupString = _lib.XLookupString
+XLookupString.restype = c_int
+XLookupString.argtypes = [POINTER(XKeyEvent), c_char_p, c_int, POINTER(KeySym), POINTER(XComposeStatus)]
+
+# /usr/include/X11/Xutil.h:5279
+XMatchVisualInfo = _lib.XMatchVisualInfo
+XMatchVisualInfo.restype = c_int
+XMatchVisualInfo.argtypes = [POINTER(Display), c_int, c_int, c_int, POINTER(XVisualInfo)]
+
+# /usr/include/X11/Xutil.h:5287
+XOffsetRegion = _lib.XOffsetRegion
+XOffsetRegion.restype = c_int
+XOffsetRegion.argtypes = [Region, c_int, c_int]
+
+# /usr/include/X11/Xutil.h:5293
+XPointInRegion = _lib.XPointInRegion
+XPointInRegion.restype = c_int
+XPointInRegion.argtypes = [Region, c_int, c_int]
+
+# /usr/include/X11/Xutil.h:5299
+XPolygonRegion = _lib.XPolygonRegion
+XPolygonRegion.restype = Region
+XPolygonRegion.argtypes = [POINTER(XPoint), c_int, c_int]
+
+# /usr/include/X11/Xutil.h:5305
+XRectInRegion = _lib.XRectInRegion
+XRectInRegion.restype = c_int
+XRectInRegion.argtypes = [Region, c_int, c_int, c_uint, c_uint]
+
+# /usr/include/X11/Xutil.h:5313
+XSaveContext = _lib.XSaveContext
+XSaveContext.restype = c_int
+XSaveContext.argtypes = [POINTER(Display), XID, XContext, c_char_p]
+
+# /usr/include/X11/Xutil.h:5320
+XSetClassHint = _lib.XSetClassHint
+XSetClassHint.restype = c_int
+XSetClassHint.argtypes = [POINTER(Display), Window, POINTER(XClassHint)]
+
+# /usr/include/X11/Xutil.h:5326
+XSetIconSizes = _lib.XSetIconSizes
+XSetIconSizes.restype = c_int
+XSetIconSizes.argtypes = [POINTER(Display), Window, POINTER(XIconSize), c_int]
+
+# /usr/include/X11/Xutil.h:5333
+XSetNormalHints = _lib.XSetNormalHints
+XSetNormalHints.restype = c_int
+XSetNormalHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints)]
+
+# /usr/include/X11/Xutil.h:5339
+XSetRGBColormaps = _lib.XSetRGBColormaps
+XSetRGBColormaps.restype = None
+XSetRGBColormaps.argtypes = [POINTER(Display), Window, POINTER(XStandardColormap), c_int, Atom]
+
+# /usr/include/X11/Xutil.h:5347
+XSetSizeHints = _lib.XSetSizeHints
+XSetSizeHints.restype = c_int
+XSetSizeHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints), Atom]
+
+# /usr/include/X11/Xutil.h:5354
+XSetStandardProperties = _lib.XSetStandardProperties
+XSetStandardProperties.restype = c_int
+XSetStandardProperties.argtypes = [POINTER(Display), Window, c_char_p, c_char_p, Pixmap, POINTER(c_char_p), c_int, POINTER(XSizeHints)]
+
+# /usr/include/X11/Xutil.h:5365
+XSetTextProperty = _lib.XSetTextProperty
+XSetTextProperty.restype = None
+XSetTextProperty.argtypes = [POINTER(Display), Window, POINTER(XTextProperty), Atom]
+
+# /usr/include/X11/Xutil.h:5372
+XSetWMClientMachine = _lib.XSetWMClientMachine
+XSetWMClientMachine.restype = None
+XSetWMClientMachine.argtypes = [POINTER(Display), Window, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5378
+XSetWMHints = _lib.XSetWMHints
+XSetWMHints.restype = c_int
+XSetWMHints.argtypes = [POINTER(Display), Window, POINTER(XWMHints)]
+
+# /usr/include/X11/Xutil.h:5384
+XSetWMIconName = _lib.XSetWMIconName
+XSetWMIconName.restype = None
+XSetWMIconName.argtypes = [POINTER(Display), Window, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5390
+XSetWMName = _lib.XSetWMName
+XSetWMName.restype = None
+XSetWMName.argtypes = [POINTER(Display), Window, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5396
+XSetWMNormalHints = _lib.XSetWMNormalHints
+XSetWMNormalHints.restype = None
+XSetWMNormalHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints)]
+
+# /usr/include/X11/Xutil.h:5402
+XSetWMProperties = _lib.XSetWMProperties
+XSetWMProperties.restype = None
+XSetWMProperties.argtypes = [POINTER(Display), Window, POINTER(XTextProperty), POINTER(XTextProperty), POINTER(c_char_p), c_int, POINTER(XSizeHints), POINTER(XWMHints), POINTER(XClassHint)]
+
+# /usr/include/X11/Xutil.h:5414
+XmbSetWMProperties = _lib.XmbSetWMProperties
+XmbSetWMProperties.restype = None
+XmbSetWMProperties.argtypes = [POINTER(Display), Window, c_char_p, c_char_p, POINTER(c_char_p), c_int, POINTER(XSizeHints), POINTER(XWMHints), POINTER(XClassHint)]
+
+# /usr/include/X11/Xutil.h:5426
+Xutf8SetWMProperties = _lib.Xutf8SetWMProperties
+Xutf8SetWMProperties.restype = None
+Xutf8SetWMProperties.argtypes = [POINTER(Display), Window, c_char_p, c_char_p, POINTER(c_char_p), c_int, POINTER(XSizeHints), POINTER(XWMHints), POINTER(XClassHint)]
+
+# /usr/include/X11/Xutil.h:5438
+XSetWMSizeHints = _lib.XSetWMSizeHints
+XSetWMSizeHints.restype = None
+XSetWMSizeHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints), Atom]
+
+# /usr/include/X11/Xutil.h:5445
+XSetRegion = _lib.XSetRegion
+XSetRegion.restype = c_int
+XSetRegion.argtypes = [POINTER(Display), GC, Region]
+
+# /usr/include/X11/Xutil.h:5451
+XSetStandardColormap = _lib.XSetStandardColormap
+XSetStandardColormap.restype = None
+XSetStandardColormap.argtypes = [POINTER(Display), Window, POINTER(XStandardColormap), Atom]
+
+# /usr/include/X11/Xutil.h:5458
+XSetZoomHints = _lib.XSetZoomHints
+XSetZoomHints.restype = c_int
+XSetZoomHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints)]
+
+# /usr/include/X11/Xutil.h:5464
+XShrinkRegion = _lib.XShrinkRegion
+XShrinkRegion.restype = c_int
+XShrinkRegion.argtypes = [Region, c_int, c_int]
+
+# /usr/include/X11/Xutil.h:5470
+XStringListToTextProperty = _lib.XStringListToTextProperty
+XStringListToTextProperty.restype = c_int
+XStringListToTextProperty.argtypes = [POINTER(c_char_p), c_int, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5476
+XSubtractRegion = _lib.XSubtractRegion
+XSubtractRegion.restype = c_int
+XSubtractRegion.argtypes = [Region, Region, Region]
+
+# /usr/include/X11/Xutil.h:5482
+XmbTextListToTextProperty = _lib.XmbTextListToTextProperty
+XmbTextListToTextProperty.restype = c_int
+XmbTextListToTextProperty.argtypes = [POINTER(Display), POINTER(c_char_p), c_int, XICCEncodingStyle, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5490
+XwcTextListToTextProperty = _lib.XwcTextListToTextProperty
+XwcTextListToTextProperty.restype = c_int
+XwcTextListToTextProperty.argtypes = [POINTER(Display), POINTER(c_wchar_p), c_int, XICCEncodingStyle, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5498
+Xutf8TextListToTextProperty = _lib.Xutf8TextListToTextProperty
+Xutf8TextListToTextProperty.restype = c_int
+Xutf8TextListToTextProperty.argtypes = [POINTER(Display), POINTER(c_char_p), c_int, XICCEncodingStyle, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5506
+XwcFreeStringList = _lib.XwcFreeStringList
+XwcFreeStringList.restype = None
+XwcFreeStringList.argtypes = [POINTER(c_wchar_p)]
+
+# /usr/include/X11/Xutil.h:5510
+XTextPropertyToStringList = _lib.XTextPropertyToStringList
+XTextPropertyToStringList.restype = c_int
+XTextPropertyToStringList.argtypes = [POINTER(XTextProperty), POINTER(POINTER(c_char_p)), POINTER(c_int)]
+
+# /usr/include/X11/Xutil.h:5516
+XmbTextPropertyToTextList = _lib.XmbTextPropertyToTextList
+XmbTextPropertyToTextList.restype = c_int
+XmbTextPropertyToTextList.argtypes = [POINTER(Display), POINTER(XTextProperty), POINTER(POINTER(c_char_p)), POINTER(c_int)]
+
+# /usr/include/X11/Xutil.h:5523
+XwcTextPropertyToTextList = _lib.XwcTextPropertyToTextList
+XwcTextPropertyToTextList.restype = c_int
+XwcTextPropertyToTextList.argtypes = [POINTER(Display), POINTER(XTextProperty), POINTER(POINTER(c_wchar_p)), POINTER(c_int)]
+
+# /usr/include/X11/Xutil.h:5530
+Xutf8TextPropertyToTextList = _lib.Xutf8TextPropertyToTextList
+Xutf8TextPropertyToTextList.restype = c_int
+Xutf8TextPropertyToTextList.argtypes = [POINTER(Display), POINTER(XTextProperty), POINTER(POINTER(c_char_p)), POINTER(c_int)]
+
+# /usr/include/X11/Xutil.h:5537
+XUnionRectWithRegion = _lib.XUnionRectWithRegion
+XUnionRectWithRegion.restype = c_int
+XUnionRectWithRegion.argtypes = [POINTER(XRectangle), Region, Region]
+
+# /usr/include/X11/Xutil.h:5543
+XUnionRegion = _lib.XUnionRegion
+XUnionRegion.restype = c_int
+XUnionRegion.argtypes = [Region, Region, Region]
+
+# /usr/include/X11/Xutil.h:5549
+XWMGeometry = _lib.XWMGeometry
+XWMGeometry.restype = c_int
+XWMGeometry.argtypes = [POINTER(Display), c_int, c_char_p, c_char_p, c_uint, POINTER(XSizeHints), POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/Xutil.h:5563
+XXorRegion = _lib.XXorRegion
+XXorRegion.restype = c_int
+XXorRegion.argtypes = [Region, Region, Region]
+
+
+__all__ = ['XlibSpecificationRelease', 'X_PROTOCOL', 'X_PROTOCOL_REVISION',
+'XID', 'Mask', 'Atom', 'VisualID', 'Time', 'Window', 'Drawable', 'Font',
+'Pixmap', 'Cursor', 'Colormap', 'GContext', 'KeySym', 'KeyCode', 'None_',
+'ParentRelative', 'CopyFromParent', 'PointerWindow', 'InputFocus',
+'PointerRoot', 'AnyPropertyType', 'AnyKey', 'AnyButton', 'AllTemporary',
+'CurrentTime', 'NoSymbol', 'NoEventMask', 'KeyPressMask', 'KeyReleaseMask',
+'ButtonPressMask', 'ButtonReleaseMask', 'EnterWindowMask', 'LeaveWindowMask',
+'PointerMotionMask', 'PointerMotionHintMask', 'Button1MotionMask',
+'Button2MotionMask', 'Button3MotionMask', 'Button4MotionMask',
+'Button5MotionMask', 'ButtonMotionMask', 'KeymapStateMask', 'ExposureMask',
+'VisibilityChangeMask', 'StructureNotifyMask', 'ResizeRedirectMask',
+'SubstructureNotifyMask', 'SubstructureRedirectMask', 'FocusChangeMask',
+'PropertyChangeMask', 'ColormapChangeMask', 'OwnerGrabButtonMask', 'KeyPress',
+'KeyRelease', 'ButtonPress', 'ButtonRelease', 'MotionNotify', 'EnterNotify',
+'LeaveNotify', 'FocusIn', 'FocusOut', 'KeymapNotify', 'Expose',
+'GraphicsExpose', 'NoExpose', 'VisibilityNotify', 'CreateNotify',
+'DestroyNotify', 'UnmapNotify', 'MapNotify', 'MapRequest', 'ReparentNotify',
+'ConfigureNotify', 'ConfigureRequest', 'GravityNotify', 'ResizeRequest',
+'CirculateNotify', 'CirculateRequest', 'PropertyNotify', 'SelectionClear',
+'SelectionRequest', 'SelectionNotify', 'ColormapNotify', 'ClientMessage',
+'MappingNotify', 'GenericEvent', 'LASTEvent', 'ShiftMask', 'LockMask',
+'ControlMask', 'Mod1Mask', 'Mod2Mask', 'Mod3Mask', 'Mod4Mask', 'Mod5Mask',
+'ShiftMapIndex', 'LockMapIndex', 'ControlMapIndex', 'Mod1MapIndex',
+'Mod2MapIndex', 'Mod3MapIndex', 'Mod4MapIndex', 'Mod5MapIndex', 'Button1Mask',
+'Button2Mask', 'Button3Mask', 'Button4Mask', 'Button5Mask', 'AnyModifier',
+'Button1', 'Button2', 'Button3', 'Button4', 'Button5', 'NotifyNormal',
+'NotifyGrab', 'NotifyUngrab', 'NotifyWhileGrabbed', 'NotifyHint',
+'NotifyAncestor', 'NotifyVirtual', 'NotifyInferior', 'NotifyNonlinear',
+'NotifyNonlinearVirtual', 'NotifyPointer', 'NotifyPointerRoot',
+'NotifyDetailNone', 'VisibilityUnobscured', 'VisibilityPartiallyObscured',
+'VisibilityFullyObscured', 'PlaceOnTop', 'PlaceOnBottom', 'FamilyInternet',
+'FamilyDECnet', 'FamilyChaos', 'FamilyInternet6', 'FamilyServerInterpreted',
+'PropertyNewValue', 'PropertyDelete', 'ColormapUninstalled',
+'ColormapInstalled', 'GrabModeSync', 'GrabModeAsync', 'GrabSuccess',
+'AlreadyGrabbed', 'GrabInvalidTime', 'GrabNotViewable', 'GrabFrozen',
+'AsyncPointer', 'SyncPointer', 'ReplayPointer', 'AsyncKeyboard',
+'SyncKeyboard', 'ReplayKeyboard', 'AsyncBoth', 'SyncBoth', 'RevertToParent',
+'Success', 'BadRequest', 'BadValue', 'BadWindow', 'BadPixmap', 'BadAtom',
+'BadCursor', 'BadFont', 'BadMatch', 'BadDrawable', 'BadAccess', 'BadAlloc',
+'BadColor', 'BadGC', 'BadIDChoice', 'BadName', 'BadLength',
+'BadImplementation', 'FirstExtensionError', 'LastExtensionError',
+'InputOutput', 'InputOnly', 'CWBackPixmap', 'CWBackPixel', 'CWBorderPixmap',
+'CWBorderPixel', 'CWBitGravity', 'CWWinGravity', 'CWBackingStore',
+'CWBackingPlanes', 'CWBackingPixel', 'CWOverrideRedirect', 'CWSaveUnder',
+'CWEventMask', 'CWDontPropagate', 'CWColormap', 'CWCursor', 'CWX', 'CWY',
+'CWWidth', 'CWHeight', 'CWBorderWidth', 'CWSibling', 'CWStackMode',
+'ForgetGravity', 'NorthWestGravity', 'NorthGravity', 'NorthEastGravity',
+'WestGravity', 'CenterGravity', 'EastGravity', 'SouthWestGravity',
+'SouthGravity', 'SouthEastGravity', 'StaticGravity', 'UnmapGravity',
+'NotUseful', 'WhenMapped', 'Always', 'IsUnmapped', 'IsUnviewable',
+'IsViewable', 'SetModeInsert', 'SetModeDelete', 'DestroyAll',
+'RetainPermanent', 'RetainTemporary', 'Above', 'Below', 'TopIf', 'BottomIf',
+'Opposite', 'RaiseLowest', 'LowerHighest', 'PropModeReplace',
+'PropModePrepend', 'PropModeAppend', 'GXclear', 'GXand', 'GXandReverse',
+'GXcopy', 'GXandInverted', 'GXnoop', 'GXxor', 'GXor', 'GXnor', 'GXequiv',
+'GXinvert', 'GXorReverse', 'GXcopyInverted', 'GXorInverted', 'GXnand',
+'GXset', 'LineSolid', 'LineOnOffDash', 'LineDoubleDash', 'CapNotLast',
+'CapButt', 'CapRound', 'CapProjecting', 'JoinMiter', 'JoinRound', 'JoinBevel',
+'FillSolid', 'FillTiled', 'FillStippled', 'FillOpaqueStippled', 'EvenOddRule',
+'WindingRule', 'ClipByChildren', 'IncludeInferiors', 'Unsorted', 'YSorted',
+'YXSorted', 'YXBanded', 'CoordModeOrigin', 'CoordModePrevious', 'Complex',
+'Nonconvex', 'Convex', 'ArcChord', 'ArcPieSlice', 'GCFunction', 'GCPlaneMask',
+'GCForeground', 'GCBackground', 'GCLineWidth', 'GCLineStyle', 'GCCapStyle',
+'GCJoinStyle', 'GCFillStyle', 'GCFillRule', 'GCTile', 'GCStipple',
+'GCTileStipXOrigin', 'GCTileStipYOrigin', 'GCFont', 'GCSubwindowMode',
+'GCGraphicsExposures', 'GCClipXOrigin', 'GCClipYOrigin', 'GCClipMask',
+'GCDashOffset', 'GCDashList', 'GCArcMode', 'GCLastBit', 'FontLeftToRight',
+'FontRightToLeft', 'FontChange', 'XYBitmap', 'XYPixmap', 'ZPixmap',
+'AllocNone', 'AllocAll', 'DoRed', 'DoGreen', 'DoBlue', 'CursorShape',
+'TileShape', 'StippleShape', 'AutoRepeatModeOff', 'AutoRepeatModeOn',
+'AutoRepeatModeDefault', 'LedModeOff', 'LedModeOn', 'KBKeyClickPercent',
+'KBBellPercent', 'KBBellPitch', 'KBBellDuration', 'KBLed', 'KBLedMode',
+'KBKey', 'KBAutoRepeatMode', 'MappingSuccess', 'MappingBusy', 'MappingFailed',
+'MappingModifier', 'MappingKeyboard', 'MappingPointer', 'DontPreferBlanking',
+'PreferBlanking', 'DefaultBlanking', 'DisableScreenSaver',
+'DisableScreenInterval', 'DontAllowExposures', 'AllowExposures',
+'DefaultExposures', 'ScreenSaverReset', 'ScreenSaverActive', 'HostInsert',
+'HostDelete', 'EnableAccess', 'DisableAccess', 'StaticGray', 'GrayScale',
+'StaticColor', 'PseudoColor', 'TrueColor', 'DirectColor', 'LSBFirst',
+'MSBFirst', '_Xmblen', 'X_HAVE_UTF8_STRING', 'XPointer', 'Bool', 'Status',
+'True_', 'False_', 'QueuedAlready', 'QueuedAfterReading', 'QueuedAfterFlush',
+'XExtData', 'XExtCodes', 'XPixmapFormatValues', 'XGCValues', 'GC', 'Visual',
+'Depth', 'Screen', 'ScreenFormat', 'XSetWindowAttributes',
+'XWindowAttributes', 'XHostAddress', 'XServerInterpretedAddress', 'XImage',
+'XWindowChanges', 'XColor', 'XSegment', 'XPoint', 'XRectangle', 'XArc',
+'XKeyboardControl', 'XKeyboardState', 'XTimeCoord', 'XModifierKeymap',
+'Display', '_XPrivDisplay', 'XKeyEvent', 'XKeyPressedEvent',
+'XKeyReleasedEvent', 'XButtonEvent', 'XButtonPressedEvent',
+'XButtonReleasedEvent', 'XMotionEvent', 'XPointerMovedEvent',
+'XCrossingEvent', 'XEnterWindowEvent', 'XLeaveWindowEvent',
+'XFocusChangeEvent', 'XFocusInEvent', 'XFocusOutEvent', 'XKeymapEvent',
+'XExposeEvent', 'XGraphicsExposeEvent', 'XNoExposeEvent', 'XVisibilityEvent',
+'XCreateWindowEvent', 'XDestroyWindowEvent', 'XUnmapEvent', 'XMapEvent',
+'XMapRequestEvent', 'XReparentEvent', 'XConfigureEvent', 'XGravityEvent',
+'XResizeRequestEvent', 'XConfigureRequestEvent', 'XCirculateEvent',
+'XCirculateRequestEvent', 'XPropertyEvent', 'XSelectionClearEvent',
+'XSelectionRequestEvent', 'XSelectionEvent', 'XColormapEvent',
+'XClientMessageEvent', 'XMappingEvent', 'XErrorEvent', 'XAnyEvent',
+'XGenericEvent', 'XGenericEventCookie', 'XEvent', 'XCharStruct', 'XFontProp',
+'XFontStruct', 'XTextItem', 'XChar2b', 'XTextItem16', 'XEDataObject',
+'XFontSetExtents', 'XOM', 'XOC', 'XFontSet', 'XmbTextItem', 'XwcTextItem',
+'XOMCharSetList', 'XOrientation', 'XOMOrientation_LTR_TTB',
+'XOMOrientation_RTL_TTB', 'XOMOrientation_TTB_LTR', 'XOMOrientation_TTB_RTL',
+'XOMOrientation_Context', 'XOMOrientation', 'XOMFontInfo', 'XIM', 'XIC',
+'XIMProc', 'XICProc', 'XIDProc', 'XIMStyle', 'XIMStyles', 'XIMPreeditArea',
+'XIMPreeditCallbacks', 'XIMPreeditPosition', 'XIMPreeditNothing',
+'XIMPreeditNone', 'XIMStatusArea', 'XIMStatusCallbacks', 'XIMStatusNothing',
+'XIMStatusNone', 'XBufferOverflow', 'XLookupNone', 'XLookupChars',
+'XLookupKeySym', 'XLookupBoth', 'XVaNestedList', 'XIMCallback', 'XICCallback',
+'XIMFeedback', 'XIMReverse', 'XIMUnderline', 'XIMHighlight', 'XIMPrimary',
+'XIMSecondary', 'XIMTertiary', 'XIMVisibleToForward', 'XIMVisibleToBackword',
+'XIMVisibleToCenter', 'XIMText', 'XIMPreeditState', 'XIMPreeditUnKnown',
+'XIMPreeditEnable', 'XIMPreeditDisable',
+'XIMPreeditStateNotifyCallbackStruct', 'XIMResetState', 'XIMInitialState',
+'XIMPreserveState', 'XIMStringConversionFeedback',
+'XIMStringConversionLeftEdge', 'XIMStringConversionRightEdge',
+'XIMStringConversionTopEdge', 'XIMStringConversionBottomEdge',
+'XIMStringConversionConcealed', 'XIMStringConversionWrapped',
+'XIMStringConversionText', 'XIMStringConversionPosition',
+'XIMStringConversionType', 'XIMStringConversionBuffer',
+'XIMStringConversionLine', 'XIMStringConversionWord',
+'XIMStringConversionChar', 'XIMStringConversionOperation',
+'XIMStringConversionSubstitution', 'XIMStringConversionRetrieval',
+'XIMCaretDirection', 'XIMForwardChar', 'XIMBackwardChar', 'XIMForwardWord',
+'XIMBackwardWord', 'XIMCaretUp', 'XIMCaretDown', 'XIMNextLine',
+'XIMPreviousLine', 'XIMLineStart', 'XIMLineEnd', 'XIMAbsolutePosition',
+'XIMDontChange', 'XIMStringConversionCallbackStruct',
+'XIMPreeditDrawCallbackStruct', 'XIMCaretStyle', 'XIMIsInvisible',
+'XIMIsPrimary', 'XIMIsSecondary', 'XIMPreeditCaretCallbackStruct',
+'XIMStatusDataType', 'XIMTextType', 'XIMBitmapType',
+'XIMStatusDrawCallbackStruct', 'XIMHotKeyTrigger', 'XIMHotKeyTriggers',
+'XIMHotKeyState', 'XIMHotKeyStateON', 'XIMHotKeyStateOFF', 'XIMValuesList',
+'XLoadQueryFont', 'XQueryFont', 'XGetMotionEvents', 'XDeleteModifiermapEntry',
+'XGetModifierMapping', 'XInsertModifiermapEntry', 'XNewModifiermap',
+'XCreateImage', 'XInitImage', 'XGetImage', 'XGetSubImage', 'XOpenDisplay',
+'XrmInitialize', 'XFetchBytes', 'XFetchBuffer', 'XGetAtomName',
+'XGetAtomNames', 'XGetDefault', 'XDisplayName', 'XKeysymToString',
+'XSynchronize', 'XSetAfterFunction', 'XInternAtom', 'XInternAtoms',
+'XCopyColormapAndFree', 'XCreateColormap', 'XCreatePixmapCursor',
+'XCreateGlyphCursor', 'XCreateFontCursor', 'XLoadFont', 'XCreateGC',
+'XGContextFromGC', 'XFlushGC', 'XCreatePixmap', 'XCreateBitmapFromData',
+'XCreatePixmapFromBitmapData', 'XCreateSimpleWindow', 'XGetSelectionOwner',
+'XCreateWindow', 'XListInstalledColormaps', 'XListFonts',
+'XListFontsWithInfo', 'XGetFontPath', 'XListExtensions', 'XListProperties',
+'XListHosts', 'XKeycodeToKeysym', 'XLookupKeysym', 'XGetKeyboardMapping',
+'XStringToKeysym', 'XMaxRequestSize', 'XExtendedMaxRequestSize',
+'XResourceManagerString', 'XScreenResourceString', 'XDisplayMotionBufferSize',
+'XVisualIDFromVisual', 'XInitThreads', 'XLockDisplay', 'XUnlockDisplay',
+'XInitExtension', 'XAddExtension', 'XFindOnExtensionList',
+'XEHeadOfExtensionList', 'XRootWindow', 'XDefaultRootWindow',
+'XRootWindowOfScreen', 'XDefaultVisual', 'XDefaultVisualOfScreen',
+'XDefaultGC', 'XDefaultGCOfScreen', 'XBlackPixel', 'XWhitePixel',
+'XAllPlanes', 'XBlackPixelOfScreen', 'XWhitePixelOfScreen', 'XNextRequest',
+'XLastKnownRequestProcessed', 'XServerVendor', 'XDisplayString',
+'XDefaultColormap', 'XDefaultColormapOfScreen', 'XDisplayOfScreen',
+'XScreenOfDisplay', 'XDefaultScreenOfDisplay', 'XEventMaskOfScreen',
+'XScreenNumberOfScreen', 'XErrorHandler', 'XSetErrorHandler',
+'XIOErrorHandler', 'XSetIOErrorHandler', 'XListPixmapFormats', 'XListDepths',
+'XReconfigureWMWindow', 'XGetWMProtocols', 'XSetWMProtocols',
+'XIconifyWindow', 'XWithdrawWindow', 'XGetCommand', 'XGetWMColormapWindows',
+'XSetWMColormapWindows', 'XFreeStringList', 'XSetTransientForHint',
+'XActivateScreenSaver', 'XAddHost', 'XAddHosts', 'XAddToExtensionList',
+'XAddToSaveSet', 'XAllocColor', 'XAllocColorCells', 'XAllocColorPlanes',
+'XAllocNamedColor', 'XAllowEvents', 'XAutoRepeatOff', 'XAutoRepeatOn',
+'XBell', 'XBitmapBitOrder', 'XBitmapPad', 'XBitmapUnit', 'XCellsOfScreen',
+'XChangeActivePointerGrab', 'XChangeGC', 'XChangeKeyboardControl',
+'XChangeKeyboardMapping', 'XChangePointerControl', 'XChangeProperty',
+'XChangeSaveSet', 'XChangeWindowAttributes', 'XCheckIfEvent',
+'XCheckMaskEvent', 'XCheckTypedEvent', 'XCheckTypedWindowEvent',
+'XCheckWindowEvent', 'XCirculateSubwindows', 'XCirculateSubwindowsDown',
+'XCirculateSubwindowsUp', 'XClearArea', 'XClearWindow', 'XCloseDisplay',
+'XConfigureWindow', 'XConnectionNumber', 'XConvertSelection', 'XCopyArea',
+'XCopyGC', 'XCopyPlane', 'XDefaultDepth', 'XDefaultDepthOfScreen',
+'XDefaultScreen', 'XDefineCursor', 'XDeleteProperty', 'XDestroyWindow',
+'XDestroySubwindows', 'XDoesBackingStore', 'XDoesSaveUnders',
+'XDisableAccessControl', 'XDisplayCells', 'XDisplayHeight',
+'XDisplayHeightMM', 'XDisplayKeycodes', 'XDisplayPlanes', 'XDisplayWidth',
+'XDisplayWidthMM', 'XDrawArc', 'XDrawArcs', 'XDrawImageString',
+'XDrawImageString16', 'XDrawLine', 'XDrawLines', 'XDrawPoint', 'XDrawPoints',
+'XDrawRectangle', 'XDrawRectangles', 'XDrawSegments', 'XDrawString',
+'XDrawString16', 'XDrawText', 'XDrawText16', 'XEnableAccessControl',
+'XEventsQueued', 'XFetchName', 'XFillArc', 'XFillArcs', 'XFillPolygon',
+'XFillRectangle', 'XFillRectangles', 'XFlush', 'XForceScreenSaver', 'XFree',
+'XFreeColormap', 'XFreeColors', 'XFreeCursor', 'XFreeExtensionList',
+'XFreeFont', 'XFreeFontInfo', 'XFreeFontNames', 'XFreeFontPath', 'XFreeGC',
+'XFreeModifiermap', 'XFreePixmap', 'XGeometry', 'XGetErrorDatabaseText',
+'XGetErrorText', 'XGetFontProperty', 'XGetGCValues', 'XGetGeometry',
+'XGetIconName', 'XGetInputFocus', 'XGetKeyboardControl', 'XGetPointerControl',
+'XGetPointerMapping', 'XGetScreenSaver', 'XGetTransientForHint',
+'XGetWindowProperty', 'XGetWindowAttributes', 'XGrabButton', 'XGrabKey',
+'XGrabKeyboard', 'XGrabPointer', 'XGrabServer', 'XHeightMMOfScreen',
+'XHeightOfScreen', 'XIfEvent', 'XImageByteOrder', 'XInstallColormap',
+'XKeysymToKeycode', 'XKillClient', 'XLookupColor', 'XLowerWindow',
+'XMapRaised', 'XMapSubwindows', 'XMapWindow', 'XMaskEvent',
+'XMaxCmapsOfScreen', 'XMinCmapsOfScreen', 'XMoveResizeWindow', 'XMoveWindow',
+'XNextEvent', 'XNoOp', 'XParseColor', 'XParseGeometry', 'XPeekEvent',
+'XPeekIfEvent', 'XPending', 'XPlanesOfScreen', 'XProtocolRevision',
+'XProtocolVersion', 'XPutBackEvent', 'XPutImage', 'XQLength',
+'XQueryBestCursor', 'XQueryBestSize', 'XQueryBestStipple', 'XQueryBestTile',
+'XQueryColor', 'XQueryColors', 'XQueryExtension', 'XQueryKeymap',
+'XQueryPointer', 'XQueryTextExtents', 'XQueryTextExtents16', 'XQueryTree',
+'XRaiseWindow', 'XReadBitmapFile', 'XReadBitmapFileData', 'XRebindKeysym',
+'XRecolorCursor', 'XRefreshKeyboardMapping', 'XRemoveFromSaveSet',
+'XRemoveHost', 'XRemoveHosts', 'XReparentWindow', 'XResetScreenSaver',
+'XResizeWindow', 'XRestackWindows', 'XRotateBuffers',
+'XRotateWindowProperties', 'XScreenCount', 'XSelectInput', 'XSendEvent',
+'XSetAccessControl', 'XSetArcMode', 'XSetBackground', 'XSetClipMask',
+'XSetClipOrigin', 'XSetClipRectangles', 'XSetCloseDownMode', 'XSetCommand',
+'XSetDashes', 'XSetFillRule', 'XSetFillStyle', 'XSetFont', 'XSetFontPath',
+'XSetForeground', 'XSetFunction', 'XSetGraphicsExposures', 'XSetIconName',
+'XSetInputFocus', 'XSetLineAttributes', 'XSetModifierMapping',
+'XSetPlaneMask', 'XSetPointerMapping', 'XSetScreenSaver',
+'XSetSelectionOwner', 'XSetState', 'XSetStipple', 'XSetSubwindowMode',
+'XSetTSOrigin', 'XSetTile', 'XSetWindowBackground',
+'XSetWindowBackgroundPixmap', 'XSetWindowBorder', 'XSetWindowBorderPixmap',
+'XSetWindowBorderWidth', 'XSetWindowColormap', 'XStoreBuffer', 'XStoreBytes',
+'XStoreColor', 'XStoreColors', 'XStoreName', 'XStoreNamedColor', 'XSync',
+'XTextExtents', 'XTextExtents16', 'XTextWidth', 'XTextWidth16',
+'XTranslateCoordinates', 'XUndefineCursor', 'XUngrabButton', 'XUngrabKey',
+'XUngrabKeyboard', 'XUngrabPointer', 'XUngrabServer', 'XUninstallColormap',
+'XUnloadFont', 'XUnmapSubwindows', 'XUnmapWindow', 'XVendorRelease',
+'XWarpPointer', 'XWidthMMOfScreen', 'XWidthOfScreen', 'XWindowEvent',
+'XWriteBitmapFile', 'XSupportsLocale', 'XSetLocaleModifiers', 'XOpenOM',
+'XCloseOM', 'XSetOMValues', 'XGetOMValues', 'XDisplayOfOM', 'XLocaleOfOM',
+'XCreateOC', 'XDestroyOC', 'XOMOfOC', 'XSetOCValues', 'XGetOCValues',
+'XCreateFontSet', 'XFreeFontSet', 'XFontsOfFontSet',
+'XBaseFontNameListOfFontSet', 'XLocaleOfFontSet', 'XContextDependentDrawing',
+'XDirectionalDependentDrawing', 'XContextualDrawing', 'XExtentsOfFontSet',
+'XmbTextEscapement', 'XwcTextEscapement', 'Xutf8TextEscapement',
+'XmbTextExtents', 'XwcTextExtents', 'Xutf8TextExtents',
+'XmbTextPerCharExtents', 'XwcTextPerCharExtents', 'Xutf8TextPerCharExtents',
+'XmbDrawText', 'XwcDrawText', 'Xutf8DrawText', 'XmbDrawString',
+'XwcDrawString', 'Xutf8DrawString', 'XmbDrawImageString',
+'XwcDrawImageString', 'Xutf8DrawImageString', 'XOpenIM', 'XCloseIM',
+'XGetIMValues', 'XSetIMValues', 'XDisplayOfIM', 'XLocaleOfIM', 'XCreateIC',
+'XDestroyIC', 'XSetICFocus', 'XUnsetICFocus', 'XwcResetIC', 'XmbResetIC',
+'Xutf8ResetIC', 'XSetICValues', 'XGetICValues', 'XIMOfIC', 'XFilterEvent',
+'XmbLookupString', 'XwcLookupString', 'Xutf8LookupString',
+'XVaCreateNestedList', 'XRegisterIMInstantiateCallback',
+'XUnregisterIMInstantiateCallback', 'XConnectionWatchProc',
+'XInternalConnectionNumbers', 'XProcessInternalConnection',
+'XAddConnectionWatch', 'XRemoveConnectionWatch', 'XSetAuthorization',
+'_Xmbtowc', '_Xwctomb', 'XGetEventData', 'XFreeEventData', 'NoValue',
+'XValue', 'YValue', 'WidthValue', 'HeightValue', 'AllValues', 'XNegative',
+'YNegative', 'XSizeHints', 'USPosition', 'USSize', 'PPosition', 'PSize',
+'PMinSize', 'PMaxSize', 'PResizeInc', 'PAspect', 'PBaseSize', 'PWinGravity',
+'PAllHints', 'XWMHints', 'InputHint', 'StateHint', 'IconPixmapHint',
+'IconWindowHint', 'IconPositionHint', 'IconMaskHint', 'WindowGroupHint',
+'AllHints', 'XUrgencyHint', 'WithdrawnState', 'NormalState', 'IconicState',
+'DontCareState', 'ZoomState', 'InactiveState', 'XTextProperty', 'XNoMemory',
+'XLocaleNotSupported', 'XConverterNotFound', 'XICCEncodingStyle',
+'XStringStyle', 'XCompoundTextStyle', 'XTextStyle', 'XStdICCTextStyle',
+'XUTF8StringStyle', 'XIconSize', 'XClassHint', 'XComposeStatus', 'Region',
+'RectangleOut', 'RectangleIn', 'RectanglePart', 'XVisualInfo', 'VisualNoMask',
+'VisualIDMask', 'VisualScreenMask', 'VisualDepthMask', 'VisualClassMask',
+'VisualRedMaskMask', 'VisualGreenMaskMask', 'VisualBlueMaskMask',
+'VisualColormapSizeMask', 'VisualBitsPerRGBMask', 'VisualAllMask',
+'XStandardColormap', 'BitmapSuccess', 'BitmapOpenFailed', 'BitmapFileInvalid',
+'BitmapNoMemory', 'XCSUCCESS', 'XCNOMEM', 'XCNOENT', 'XContext',
+'XAllocClassHint', 'XAllocIconSize', 'XAllocSizeHints',
+'XAllocStandardColormap', 'XAllocWMHints', 'XClipBox', 'XCreateRegion',
+'XDefaultString', 'XDeleteContext', 'XDestroyRegion', 'XEmptyRegion',
+'XEqualRegion', 'XFindContext', 'XGetClassHint', 'XGetIconSizes',
+'XGetNormalHints', 'XGetRGBColormaps', 'XGetSizeHints',
+'XGetStandardColormap', 'XGetTextProperty', 'XGetVisualInfo',
+'XGetWMClientMachine', 'XGetWMHints', 'XGetWMIconName', 'XGetWMName',
+'XGetWMNormalHints', 'XGetWMSizeHints', 'XGetZoomHints', 'XIntersectRegion',
+'XConvertCase', 'XLookupString', 'XMatchVisualInfo', 'XOffsetRegion',
+'XPointInRegion', 'XPolygonRegion', 'XRectInRegion', 'XSaveContext',
+'XSetClassHint', 'XSetIconSizes', 'XSetNormalHints', 'XSetRGBColormaps',
+'XSetSizeHints', 'XSetStandardProperties', 'XSetTextProperty',
+'XSetWMClientMachine', 'XSetWMHints', 'XSetWMIconName', 'XSetWMName',
+'XSetWMNormalHints', 'XSetWMProperties', 'XmbSetWMProperties',
+'Xutf8SetWMProperties', 'XSetWMSizeHints', 'XSetRegion',
+'XSetStandardColormap', 'XSetZoomHints', 'XShrinkRegion',
+'XStringListToTextProperty', 'XSubtractRegion', 'XmbTextListToTextProperty',
+'XwcTextListToTextProperty', 'Xutf8TextListToTextProperty',
+'XwcFreeStringList', 'XTextPropertyToStringList', 'XmbTextPropertyToTextList',
+'XwcTextPropertyToTextList', 'Xutf8TextPropertyToTextList',
+'XUnionRectWithRegion', 'XUnionRegion', 'XWMGeometry', 'XXorRegion']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/xsync.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/xsync.py
new file mode 100644
index 0000000..632bc84
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/libs/x11/xsync.py
@@ -0,0 +1,472 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+'''Wrapper for Xext
+
+Generated with:
+tools/genwrappers.py xsync
+
+Do not modify this file.
+'''
+from __future__ import absolute_import
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import ctypes
+from ctypes import *
+
+import pyglet.lib
+
+_lib = pyglet.lib.load_library('Xext')
+
+_int_types = (c_int16, c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (ctypes.c_int64,)
+for t in _int_types:
+ if sizeof(t) == sizeof(c_size_t):
+ c_ptrdiff_t = t
+
+class c_void(Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', c_int)]
+
+
+# XXX DODGY relative import of xlib.py, which contains XID etc definitions.
+# can't use wrapped import which gave
+# import pyglet.window.xlib.xlib
+# because Python has the lamest import semantics and can't handle that kind of
+# recursive import, even though it's the same as
+from . import xlib
+
+SYNC_MAJOR_VERSION = 3 # /usr/include/X11/extensions/sync.h:4901
+SYNC_MINOR_VERSION = 0 # /usr/include/X11/extensions/sync.h:4902
+X_SyncInitialize = 0 # /usr/include/X11/extensions/sync.h:4904
+X_SyncListSystemCounters = 1 # /usr/include/X11/extensions/sync.h:4905
+X_SyncCreateCounter = 2 # /usr/include/X11/extensions/sync.h:4906
+X_SyncSetCounter = 3 # /usr/include/X11/extensions/sync.h:4907
+X_SyncChangeCounter = 4 # /usr/include/X11/extensions/sync.h:4908
+X_SyncQueryCounter = 5 # /usr/include/X11/extensions/sync.h:4909
+X_SyncDestroyCounter = 6 # /usr/include/X11/extensions/sync.h:4910
+X_SyncAwait = 7 # /usr/include/X11/extensions/sync.h:4911
+X_SyncCreateAlarm = 8 # /usr/include/X11/extensions/sync.h:4912
+X_SyncChangeAlarm = 9 # /usr/include/X11/extensions/sync.h:4913
+X_SyncQueryAlarm = 10 # /usr/include/X11/extensions/sync.h:4914
+X_SyncDestroyAlarm = 11 # /usr/include/X11/extensions/sync.h:4915
+X_SyncSetPriority = 12 # /usr/include/X11/extensions/sync.h:4916
+X_SyncGetPriority = 13 # /usr/include/X11/extensions/sync.h:4917
+XSyncCounterNotify = 0 # /usr/include/X11/extensions/sync.h:4919
+XSyncAlarmNotify = 1 # /usr/include/X11/extensions/sync.h:4920
+XSyncAlarmNotifyMask = 2 # /usr/include/X11/extensions/sync.h:4921
+XSyncNumberEvents = 2 # /usr/include/X11/extensions/sync.h:4923
+XSyncBadCounter = 0 # /usr/include/X11/extensions/sync.h:4925
+XSyncBadAlarm = 1 # /usr/include/X11/extensions/sync.h:4926
+XSyncNumberErrors = 2 # /usr/include/X11/extensions/sync.h:4927
+XSyncCACounter = 1 # /usr/include/X11/extensions/sync.h:4932
+XSyncCAValueType = 2 # /usr/include/X11/extensions/sync.h:4933
+XSyncCAValue = 4 # /usr/include/X11/extensions/sync.h:4934
+XSyncCATestType = 8 # /usr/include/X11/extensions/sync.h:4935
+XSyncCADelta = 16 # /usr/include/X11/extensions/sync.h:4936
+XSyncCAEvents = 32 # /usr/include/X11/extensions/sync.h:4937
+enum_anon_93 = c_int
+XSyncAbsolute = 0
+XSyncRelative = 1
+XSyncValueType = enum_anon_93 # /usr/include/X11/extensions/sync.h:4945
+enum_anon_94 = c_int
+XSyncPositiveTransition = 0
+XSyncNegativeTransition = 1
+XSyncPositiveComparison = 2
+XSyncNegativeComparison = 3
+XSyncTestType = enum_anon_94 # /usr/include/X11/extensions/sync.h:4955
+enum_anon_95 = c_int
+XSyncAlarmActive = 0
+XSyncAlarmInactive = 1
+XSyncAlarmDestroyed = 2
+XSyncAlarmState = enum_anon_95 # /usr/include/X11/extensions/sync.h:4964
+XID = xlib.XID
+XSyncCounter = XID # /usr/include/X11/extensions/sync.h:4967
+XSyncAlarm = XID # /usr/include/X11/extensions/sync.h:4968
+class struct__XSyncValue(Structure):
+ __slots__ = [
+ 'hi',
+ 'lo',
+ ]
+struct__XSyncValue._fields_ = [
+ ('hi', c_int),
+ ('lo', c_uint),
+]
+
+XSyncValue = struct__XSyncValue # /usr/include/X11/extensions/sync.h:4972
+# /usr/include/X11/extensions/sync.h:4980
+XSyncIntToValue = _lib.XSyncIntToValue
+XSyncIntToValue.restype = None
+XSyncIntToValue.argtypes = [POINTER(XSyncValue), c_int]
+
+# /usr/include/X11/extensions/sync.h:4985
+XSyncIntsToValue = _lib.XSyncIntsToValue
+XSyncIntsToValue.restype = None
+XSyncIntsToValue.argtypes = [POINTER(XSyncValue), c_uint, c_int]
+
+Bool = xlib.Bool
+# /usr/include/X11/extensions/sync.h:4991
+XSyncValueGreaterThan = _lib.XSyncValueGreaterThan
+XSyncValueGreaterThan.restype = Bool
+XSyncValueGreaterThan.argtypes = [XSyncValue, XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:4996
+XSyncValueLessThan = _lib.XSyncValueLessThan
+XSyncValueLessThan.restype = Bool
+XSyncValueLessThan.argtypes = [XSyncValue, XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5001
+XSyncValueGreaterOrEqual = _lib.XSyncValueGreaterOrEqual
+XSyncValueGreaterOrEqual.restype = Bool
+XSyncValueGreaterOrEqual.argtypes = [XSyncValue, XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5006
+XSyncValueLessOrEqual = _lib.XSyncValueLessOrEqual
+XSyncValueLessOrEqual.restype = Bool
+XSyncValueLessOrEqual.argtypes = [XSyncValue, XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5011
+XSyncValueEqual = _lib.XSyncValueEqual
+XSyncValueEqual.restype = Bool
+XSyncValueEqual.argtypes = [XSyncValue, XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5016
+XSyncValueIsNegative = _lib.XSyncValueIsNegative
+XSyncValueIsNegative.restype = Bool
+XSyncValueIsNegative.argtypes = [XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5020
+XSyncValueIsZero = _lib.XSyncValueIsZero
+XSyncValueIsZero.restype = Bool
+XSyncValueIsZero.argtypes = [XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5024
+XSyncValueIsPositive = _lib.XSyncValueIsPositive
+XSyncValueIsPositive.restype = Bool
+XSyncValueIsPositive.argtypes = [XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5028
+XSyncValueLow32 = _lib.XSyncValueLow32
+XSyncValueLow32.restype = c_uint
+XSyncValueLow32.argtypes = [XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5032
+XSyncValueHigh32 = _lib.XSyncValueHigh32
+XSyncValueHigh32.restype = c_int
+XSyncValueHigh32.argtypes = [XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5036
+XSyncValueAdd = _lib.XSyncValueAdd
+XSyncValueAdd.restype = None
+XSyncValueAdd.argtypes = [POINTER(XSyncValue), XSyncValue, XSyncValue, POINTER(c_int)]
+
+# /usr/include/X11/extensions/sync.h:5043
+XSyncValueSubtract = _lib.XSyncValueSubtract
+XSyncValueSubtract.restype = None
+XSyncValueSubtract.argtypes = [POINTER(XSyncValue), XSyncValue, XSyncValue, POINTER(c_int)]
+
+# /usr/include/X11/extensions/sync.h:5050
+XSyncMaxValue = _lib.XSyncMaxValue
+XSyncMaxValue.restype = None
+XSyncMaxValue.argtypes = [POINTER(XSyncValue)]
+
+# /usr/include/X11/extensions/sync.h:5054
+XSyncMinValue = _lib.XSyncMinValue
+XSyncMinValue.restype = None
+XSyncMinValue.argtypes = [POINTER(XSyncValue)]
+
+class struct__XSyncSystemCounter(Structure):
+ __slots__ = [
+ 'name',
+ 'counter',
+ 'resolution',
+ ]
+struct__XSyncSystemCounter._fields_ = [
+ ('name', c_char_p),
+ ('counter', XSyncCounter),
+ ('resolution', XSyncValue),
+]
+
+XSyncSystemCounter = struct__XSyncSystemCounter # /usr/include/X11/extensions/sync.h:5131
+class struct_anon_96(Structure):
+ __slots__ = [
+ 'counter',
+ 'value_type',
+ 'wait_value',
+ 'test_type',
+ ]
+struct_anon_96._fields_ = [
+ ('counter', XSyncCounter),
+ ('value_type', XSyncValueType),
+ ('wait_value', XSyncValue),
+ ('test_type', XSyncTestType),
+]
+
+XSyncTrigger = struct_anon_96 # /usr/include/X11/extensions/sync.h:5139
+class struct_anon_97(Structure):
+ __slots__ = [
+ 'trigger',
+ 'event_threshold',
+ ]
+struct_anon_97._fields_ = [
+ ('trigger', XSyncTrigger),
+ ('event_threshold', XSyncValue),
+]
+
+XSyncWaitCondition = struct_anon_97 # /usr/include/X11/extensions/sync.h:5144
+class struct_anon_98(Structure):
+ __slots__ = [
+ 'trigger',
+ 'delta',
+ 'events',
+ 'state',
+ ]
+struct_anon_98._fields_ = [
+ ('trigger', XSyncTrigger),
+ ('delta', XSyncValue),
+ ('events', Bool),
+ ('state', XSyncAlarmState),
+]
+
+XSyncAlarmAttributes = struct_anon_98 # /usr/include/X11/extensions/sync.h:5152
+class struct_anon_99(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'counter',
+ 'wait_value',
+ 'counter_value',
+ 'time',
+ 'count',
+ 'destroyed',
+ ]
+Display = xlib.Display
+Time = xlib.Time
+struct_anon_99._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', Bool),
+ ('display', POINTER(Display)),
+ ('counter', XSyncCounter),
+ ('wait_value', XSyncValue),
+ ('counter_value', XSyncValue),
+ ('time', Time),
+ ('count', c_int),
+ ('destroyed', Bool),
+]
+
+XSyncCounterNotifyEvent = struct_anon_99 # /usr/include/X11/extensions/sync.h:5169
+class struct_anon_100(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'alarm',
+ 'counter_value',
+ 'alarm_value',
+ 'time',
+ 'state',
+ ]
+struct_anon_100._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', Bool),
+ ('display', POINTER(Display)),
+ ('alarm', XSyncAlarm),
+ ('counter_value', XSyncValue),
+ ('alarm_value', XSyncValue),
+ ('time', Time),
+ ('state', XSyncAlarmState),
+]
+
+XSyncAlarmNotifyEvent = struct_anon_100 # /usr/include/X11/extensions/sync.h:5181
+class struct_anon_101(Structure):
+ __slots__ = [
+ 'type',
+ 'display',
+ 'alarm',
+ 'serial',
+ 'error_code',
+ 'request_code',
+ 'minor_code',
+ ]
+struct_anon_101._fields_ = [
+ ('type', c_int),
+ ('display', POINTER(Display)),
+ ('alarm', XSyncAlarm),
+ ('serial', c_ulong),
+ ('error_code', c_ubyte),
+ ('request_code', c_ubyte),
+ ('minor_code', c_ubyte),
+]
+
+XSyncAlarmError = struct_anon_101 # /usr/include/X11/extensions/sync.h:5195
+class struct_anon_102(Structure):
+ __slots__ = [
+ 'type',
+ 'display',
+ 'counter',
+ 'serial',
+ 'error_code',
+ 'request_code',
+ 'minor_code',
+ ]
+struct_anon_102._fields_ = [
+ ('type', c_int),
+ ('display', POINTER(Display)),
+ ('counter', XSyncCounter),
+ ('serial', c_ulong),
+ ('error_code', c_ubyte),
+ ('request_code', c_ubyte),
+ ('minor_code', c_ubyte),
+]
+
+XSyncCounterError = struct_anon_102 # /usr/include/X11/extensions/sync.h:5205
+# /usr/include/X11/extensions/sync.h:5213
+XSyncQueryExtension = _lib.XSyncQueryExtension
+XSyncQueryExtension.restype = c_int
+XSyncQueryExtension.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/extensions/sync.h:5219
+XSyncInitialize = _lib.XSyncInitialize
+XSyncInitialize.restype = c_int
+XSyncInitialize.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/extensions/sync.h:5225
+XSyncListSystemCounters = _lib.XSyncListSystemCounters
+XSyncListSystemCounters.restype = POINTER(XSyncSystemCounter)
+XSyncListSystemCounters.argtypes = [POINTER(Display), POINTER(c_int)]
+
+# /usr/include/X11/extensions/sync.h:5230
+XSyncFreeSystemCounterList = _lib.XSyncFreeSystemCounterList
+XSyncFreeSystemCounterList.restype = None
+XSyncFreeSystemCounterList.argtypes = [POINTER(XSyncSystemCounter)]
+
+# /usr/include/X11/extensions/sync.h:5234
+XSyncCreateCounter = _lib.XSyncCreateCounter
+XSyncCreateCounter.restype = XSyncCounter
+XSyncCreateCounter.argtypes = [POINTER(Display), XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5239
+XSyncSetCounter = _lib.XSyncSetCounter
+XSyncSetCounter.restype = c_int
+XSyncSetCounter.argtypes = [POINTER(Display), XSyncCounter, XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5245
+XSyncChangeCounter = _lib.XSyncChangeCounter
+XSyncChangeCounter.restype = c_int
+XSyncChangeCounter.argtypes = [POINTER(Display), XSyncCounter, XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5251
+XSyncDestroyCounter = _lib.XSyncDestroyCounter
+XSyncDestroyCounter.restype = c_int
+XSyncDestroyCounter.argtypes = [POINTER(Display), XSyncCounter]
+
+# /usr/include/X11/extensions/sync.h:5256
+XSyncQueryCounter = _lib.XSyncQueryCounter
+XSyncQueryCounter.restype = c_int
+XSyncQueryCounter.argtypes = [POINTER(Display), XSyncCounter, POINTER(XSyncValue)]
+
+# /usr/include/X11/extensions/sync.h:5262
+XSyncAwait = _lib.XSyncAwait
+XSyncAwait.restype = c_int
+XSyncAwait.argtypes = [POINTER(Display), POINTER(XSyncWaitCondition), c_int]
+
+# /usr/include/X11/extensions/sync.h:5268
+XSyncCreateAlarm = _lib.XSyncCreateAlarm
+XSyncCreateAlarm.restype = XSyncAlarm
+XSyncCreateAlarm.argtypes = [POINTER(Display), c_ulong, POINTER(XSyncAlarmAttributes)]
+
+# /usr/include/X11/extensions/sync.h:5274
+XSyncDestroyAlarm = _lib.XSyncDestroyAlarm
+XSyncDestroyAlarm.restype = c_int
+XSyncDestroyAlarm.argtypes = [POINTER(Display), XSyncAlarm]
+
+# /usr/include/X11/extensions/sync.h:5279
+XSyncQueryAlarm = _lib.XSyncQueryAlarm
+XSyncQueryAlarm.restype = c_int
+XSyncQueryAlarm.argtypes = [POINTER(Display), XSyncAlarm, POINTER(XSyncAlarmAttributes)]
+
+# /usr/include/X11/extensions/sync.h:5285
+XSyncChangeAlarm = _lib.XSyncChangeAlarm
+XSyncChangeAlarm.restype = c_int
+XSyncChangeAlarm.argtypes = [POINTER(Display), XSyncAlarm, c_ulong, POINTER(XSyncAlarmAttributes)]
+
+# /usr/include/X11/extensions/sync.h:5292
+XSyncSetPriority = _lib.XSyncSetPriority
+XSyncSetPriority.restype = c_int
+XSyncSetPriority.argtypes = [POINTER(Display), XID, c_int]
+
+# /usr/include/X11/extensions/sync.h:5298
+XSyncGetPriority = _lib.XSyncGetPriority
+XSyncGetPriority.restype = c_int
+XSyncGetPriority.argtypes = [POINTER(Display), XID, POINTER(c_int)]
+
+
+__all__ = ['SYNC_MAJOR_VERSION', 'SYNC_MINOR_VERSION', 'X_SyncInitialize',
+'X_SyncListSystemCounters', 'X_SyncCreateCounter', 'X_SyncSetCounter',
+'X_SyncChangeCounter', 'X_SyncQueryCounter', 'X_SyncDestroyCounter',
+'X_SyncAwait', 'X_SyncCreateAlarm', 'X_SyncChangeAlarm', 'X_SyncQueryAlarm',
+'X_SyncDestroyAlarm', 'X_SyncSetPriority', 'X_SyncGetPriority',
+'XSyncCounterNotify', 'XSyncAlarmNotify', 'XSyncAlarmNotifyMask',
+'XSyncNumberEvents', 'XSyncBadCounter', 'XSyncBadAlarm', 'XSyncNumberErrors',
+'XSyncCACounter', 'XSyncCAValueType', 'XSyncCAValue', 'XSyncCATestType',
+'XSyncCADelta', 'XSyncCAEvents', 'XSyncValueType', 'XSyncAbsolute',
+'XSyncRelative', 'XSyncTestType', 'XSyncPositiveTransition',
+'XSyncNegativeTransition', 'XSyncPositiveComparison',
+'XSyncNegativeComparison', 'XSyncAlarmState', 'XSyncAlarmActive',
+'XSyncAlarmInactive', 'XSyncAlarmDestroyed', 'XSyncCounter', 'XSyncAlarm',
+'XSyncValue', 'XSyncIntToValue', 'XSyncIntsToValue', 'XSyncValueGreaterThan',
+'XSyncValueLessThan', 'XSyncValueGreaterOrEqual', 'XSyncValueLessOrEqual',
+'XSyncValueEqual', 'XSyncValueIsNegative', 'XSyncValueIsZero',
+'XSyncValueIsPositive', 'XSyncValueLow32', 'XSyncValueHigh32',
+'XSyncValueAdd', 'XSyncValueSubtract', 'XSyncMaxValue', 'XSyncMinValue',
+'XSyncSystemCounter', 'XSyncTrigger', 'XSyncWaitCondition',
+'XSyncAlarmAttributes', 'XSyncCounterNotifyEvent', 'XSyncAlarmNotifyEvent',
+'XSyncAlarmError', 'XSyncCounterError', 'XSyncQueryExtension',
+'XSyncInitialize', 'XSyncListSystemCounters', 'XSyncFreeSystemCounterList',
+'XSyncCreateCounter', 'XSyncSetCounter', 'XSyncChangeCounter',
+'XSyncDestroyCounter', 'XSyncQueryCounter', 'XSyncAwait', 'XSyncCreateAlarm',
+'XSyncDestroyAlarm', 'XSyncQueryAlarm', 'XSyncChangeAlarm',
+'XSyncSetPriority', 'XSyncGetPriority']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/__init__.py
new file mode 100644
index 0000000..d5622b3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/__init__.py
@@ -0,0 +1,87 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+"""Audio and video playback.
+
+pyglet can play WAV files, and if AVbin is installed, many other audio and
+video formats.
+
+Playback is handled by the :py:class:`Player` class, which reads raw data from
+:py:class:`Source` objects and provides methods for pausing, seeking, adjusting
+the volume, and so on. The :py:class:`Player` class implements the best
+available audio device (currently, only OpenAL is supported)::
+
+ player = Player()
+
+A :py:class:`Source` is used to decode arbitrary audio and video files. It is
+associated with a single player by "queuing" it::
+
+ source = load('background_music.mp3')
+ player.queue(source)
+
+Use the :py:class:`Player` to control playback.
+
+If the source contains video, the :py:meth:`Source.video_format` attribute will
+be non-None, and the :py:attr:`Player.texture` attribute will contain the
+current video image synchronised to the audio.
+
+Decoding sounds can be processor-intensive and may introduce latency,
+particularly for short sounds that must be played quickly, such as bullets or
+explosions. You can force such sounds to be decoded and retained in memory
+rather than streamed from disk by wrapping the source in a
+:py:class:`StaticSource`::
+
+ bullet_sound = StaticSource(load('bullet.wav'))
+
+The other advantage of a :py:class:`StaticSource` is that it can be queued on
+any number of players, and so played many times simultaneously.
+
+pyglet relies on Python's garbage collector to release resources when a player
+has finished playing a source. In this way some operations that could affect
+the application performance can be delayed.
+
+The player provides a :py:meth:`Player.delete` method that can be used to
+release resources immediately. Also an explicit call to ``gc.collect()`` can be
+used to collect unused resources.
+"""
+
+# Collect public interface from all submodules/packages
+from .drivers import get_audio_driver
+from .exceptions import *
+from .player import Player, PlayerGroup
+from .sources import *
+
+# For backwards compatibility, deprecate?
+from .sources import procedural
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/__init__.py
new file mode 100644
index 0000000..d3c21f4
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/__init__.py
@@ -0,0 +1,54 @@
+"""Drivers for playing back media."""
+from __future__ import print_function
+from __future__ import absolute_import
+from builtins import str
+
+import pyglet
+
+_debug = pyglet.options['debug_media']
+
+
+def get_audio_driver():
+ global _audio_driver
+
+ if _audio_driver:
+ return _audio_driver
+
+ _audio_driver = None
+
+ for driver_name in pyglet.options['audio']:
+ try:
+ if driver_name == 'pulse':
+ from . import pulse
+ _audio_driver = pulse.create_audio_driver()
+ break
+ elif driver_name == 'openal':
+ from . import openal
+ _audio_driver = openal.create_audio_driver()
+ break
+ elif driver_name == 'directsound':
+ from . import directsound
+ _audio_driver = directsound.create_audio_driver()
+ break
+ elif driver_name == 'silent':
+ _audio_driver = get_silent_audio_driver()
+ break
+ except Exception as exp:
+ if _debug:
+ print('Error importing driver %s:' % driver_name)
+ import traceback
+ traceback.print_exc()
+ return _audio_driver
+
+def get_silent_audio_driver():
+ global _silent_audio_driver
+
+ if not _silent_audio_driver:
+ from . import silent
+ _silent_audio_driver = silent.create_audio_driver()
+
+ return _silent_audio_driver
+
+_audio_driver = None
+_silent_audio_driver = None
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/base.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/base.py
new file mode 100644
index 0000000..f689c23
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/base.py
@@ -0,0 +1,146 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+from abc import ABCMeta, abstractmethod
+from future.utils import with_metaclass
+
+
+class AbstractAudioPlayer(with_metaclass(ABCMeta, object)):
+ """Base class for driver audio players.
+ """
+
+ def __init__(self, source_group, player):
+ """Create a new audio player.
+
+ :Parameters:
+ `source_group` : `SourceGroup`
+ Source group to play from.
+ `player` : `Player`
+ Player to receive EOS and video frame sync events.
+
+ """
+ self.source_group = source_group
+ self.player = player
+
+ @abstractmethod
+ def play(self):
+ """Begin playback."""
+
+ @abstractmethod
+ def stop(self):
+ """Stop (pause) playback."""
+
+ @abstractmethod
+ def delete(self):
+ """Stop playing and clean up all resources used by player."""
+
+ def _play_group(self, audio_players):
+ """Begin simultaneous playback on a list of audio players."""
+ # This should be overridden by subclasses for better synchrony.
+ for player in audio_players:
+ player.play()
+
+ def _stop_group(self, audio_players):
+ """Stop simultaneous playback on a list of audio players."""
+ # This should be overridden by subclasses for better synchrony.
+ for player in audio_players:
+ player.stop()
+
+ @abstractmethod
+ def clear(self):
+ """Clear all buffered data and prepare for replacement data.
+
+ The player should be stopped before calling this method.
+ """
+
+ @abstractmethod
+ def get_time(self):
+ """Return approximation of current playback time within current source.
+
+ Returns ``None`` if the audio player does not know what the playback
+ time is (for example, before any valid audio data has been read).
+
+ :rtype: float
+ :return: current play cursor time, in seconds.
+ """
+ # TODO determine which source within group
+
+ def set_volume(self, volume):
+ """See `Player.volume`."""
+ pass
+
+ def set_position(self, position):
+ """See :py:attr:`~pyglet.media.Player.position`."""
+ pass
+
+ def set_min_distance(self, min_distance):
+ """See `Player.min_distance`."""
+ pass
+
+ def set_max_distance(self, max_distance):
+ """See `Player.max_distance`."""
+ pass
+
+ def set_pitch(self, pitch):
+ """See :py:attr:`~pyglet.media.Player.pitch`."""
+ pass
+
+ def set_cone_orientation(self, cone_orientation):
+ """See `Player.cone_orientation`."""
+ pass
+
+ def set_cone_inner_angle(self, cone_inner_angle):
+ """See `Player.cone_inner_angle`."""
+ pass
+
+ def set_cone_outer_angle(self, cone_outer_angle):
+ """See `Player.cone_outer_angle`."""
+ pass
+
+ def set_cone_outer_gain(self, cone_outer_gain):
+ """See `Player.cone_outer_gain`."""
+ pass
+
+
+class AbstractAudioDriver(with_metaclass(ABCMeta, object)):
+ @abstractmethod
+ def create_audio_player(self, source_group, player):
+ pass
+
+ @abstractmethod
+ def get_listener(self):
+ pass
+
+ @abstractmethod
+ def delete(self):
+ pass
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/directsound/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/directsound/__init__.py
new file mode 100644
index 0000000..6fe1db7
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/directsound/__init__.py
@@ -0,0 +1,43 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+from __future__ import absolute_import
+
+from . import adaptation
+from .exceptions import DirectSoundException, DirectSoundNativeError
+
+
+def create_audio_driver():
+ return adaptation.DirectSoundDriver()
+
+__all__ = ["create_audio_driver", "DirectSoundException", "DirectSoundNativeError"]
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/directsound/adaptation.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/directsound/adaptation.py
new file mode 100644
index 0000000..bfd0ab1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/directsound/adaptation.py
@@ -0,0 +1,454 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+from __future__ import absolute_import, print_function
+
+import ctypes
+import math
+import threading
+
+from . import interface
+from pyglet.debug import debug_print
+from pyglet.media.events import MediaEvent
+from pyglet.media.drivers.base import AbstractAudioDriver, AbstractAudioPlayer
+from pyglet.media.listener import AbstractListener
+from pyglet.media.threads import PlayerWorker
+
+_debug = debug_print('debug_media')
+
+
+def _convert_coordinates(coordinates):
+ x, y, z = coordinates
+ return (x, y, -z)
+
+
+def _gain2db(gain):
+ """
+ Convert linear gain in range [0.0, 1.0] to 100ths of dB.
+
+ Power gain = P1/P2
+ dB = 10 log(P1/P2)
+ dB * 100 = 1000 * log(power gain)
+ """
+ if gain <= 0:
+ return -10000
+ return max(-10000, min(int(1000 * math.log10(min(gain, 1))), 0))
+
+
+def _db2gain(db):
+ """Convert 100ths of dB to linear gain."""
+ return math.pow(10.0, float(db)/1000.0)
+
+
+class DirectSoundAudioPlayer(AbstractAudioPlayer):
+ # Need to cache these because pyglet API allows update separately, but
+ # DSound requires both to be set at once.
+ _cone_inner_angle = 360
+ _cone_outer_angle = 360
+
+ min_buffer_size = 9600
+
+ def __init__(self, driver, ds_driver, source_group, player):
+ super(DirectSoundAudioPlayer, self).__init__(source_group, player)
+
+ self.driver = driver
+ self._ds_driver = ds_driver
+
+ # Locking strategy:
+ # All DirectSound calls should be locked. All instance vars relating
+ # to buffering/filling/time/events should be locked (used by both
+ # application and worker thread). Other instance vars (consts and
+ # 3d vars) do not need to be locked.
+ self._lock = threading.RLock()
+
+ # Desired play state (may be actually paused due to underrun -- not
+ # implemented yet).
+ self._playing = False
+
+ # Up to one audio data may be buffered if too much data was received
+ # from the source that could not be written immediately into the
+ # buffer. See refill().
+ self._audiodata_buffer = None
+
+ # Theoretical write and play cursors for an infinite buffer. play
+ # cursor is always <= write cursor (when equal, underrun is
+ # happening).
+ self._write_cursor = 0
+ self._play_cursor = 0
+
+ # Cursor position of end of data. Silence is written after
+ # eos for one buffer size.
+ self._eos_cursor = None
+
+ # Indexes into DSound circular buffer. Complications ensue wrt each
+ # other to avoid writing over the play cursor. See get_write_size and
+ # write().
+ self._play_cursor_ring = 0
+ self._write_cursor_ring = 0
+
+ # List of (play_cursor, MediaEvent), in sort order
+ self._events = []
+
+ # List of (cursor, timestamp), in sort order (cursor gives expiry
+ # place of the timestamp)
+ self._timestamps = []
+
+ audio_format = source_group.audio_format
+
+ # DSound buffer
+ self._ds_buffer = self._ds_driver.create_buffer(audio_format)
+ self._buffer_size = self._ds_buffer.buffer_size
+
+ self._ds_buffer.current_position = 0
+
+ self.refill(self._buffer_size)
+
+ def __del__(self):
+ try:
+ self.delete()
+ except:
+ pass
+
+ def delete(self):
+ if self.driver and self.driver.worker:
+ self.driver.worker.remove(self)
+
+ with self._lock:
+ self._ds_buffer = None
+
+ def play(self):
+ assert _debug('DirectSound play')
+ self.driver.worker.add(self)
+
+ with self._lock:
+ if not self._playing:
+ self._get_audiodata() # prebuffer if needed
+ self._playing = True
+ self._ds_buffer.play()
+
+ assert _debug('return DirectSound play')
+
+ def stop(self):
+ assert _debug('DirectSound stop')
+
+ with self._lock:
+ if self._playing:
+ self._playing = False
+ self._ds_buffer.stop()
+
+ assert _debug('return DirectSound stop')
+
+ def clear(self):
+ assert _debug('DirectSound clear')
+ with self._lock:
+ self._ds_buffer.current_position = 0
+ self._play_cursor_ring = self._write_cursor_ring = 0
+ self._play_cursor = self._write_cursor
+ self._eos_cursor = None
+ self._audiodata_buffer = None
+ del self._events[:]
+ del self._timestamps[:]
+
+ def refill(self, write_size):
+ with self._lock:
+ while write_size > 0:
+ assert _debug('refill, write_size =', write_size)
+ audio_data = self._get_audiodata()
+
+ if audio_data is not None:
+ assert _debug('write', audio_data.length)
+ length = min(write_size, audio_data.length)
+ self.write(audio_data, length)
+ write_size -= length
+ else:
+ assert _debug('write silence')
+ self.write(None, write_size)
+ write_size = 0
+
+ def _has_underrun(self):
+ return (self._eos_cursor is not None
+ and self._play_cursor > self._eos_cursor)
+
+ def _dispatch_new_event(self, event_name):
+ MediaEvent(0, event_name)._sync_dispatch_to_player(self.player)
+
+ def _get_audiodata(self):
+ if self._audiodata_buffer is None or self._audiodata_buffer.length == 0:
+ self._get_new_audiodata()
+
+ return self._audiodata_buffer
+
+ def _get_new_audiodata(self):
+ assert _debug('Getting new audio data buffer.')
+ self._audiodata_buffer = self.source_group.get_audio_data(self._buffer_size)
+
+ if self._audiodata_buffer is not None:
+ assert _debug('New audio data available: {} bytes'.format(self._audiodata_buffer.length))
+
+ if self._eos_cursor is not None:
+ self._move_write_cursor_after_eos()
+
+ self._add_audiodata_events(self._audiodata_buffer)
+ self._add_audiodata_timestamp(self._audiodata_buffer)
+ self._eos_cursor = None
+ elif self._eos_cursor is None:
+ assert _debug('No more audio data.')
+ self._eos_cursor = self._write_cursor
+
+ def _move_write_cursor_after_eos(self):
+ # Set the write cursor back to eos_cursor or play_cursor to prevent gaps
+ if self._play_cursor < self._eos_cursor:
+ cursor_diff = self._write_cursor - self._eos_cursor
+ assert _debug('Moving cursor back', cursor_diff)
+ self._write_cursor = self._eos_cursor
+ self._write_cursor_ring -= cursor_diff
+ self._write_cursor_ring %= self._buffer_size
+
+ else:
+ cursor_diff = self._play_cursor - self._eos_cursor
+ assert _debug('Moving cursor back', cursor_diff)
+ self._write_cursor = self._play_cursor
+ self._write_cursor_ring -= cursor_diff
+ self._write_cursor_ring %= self._buffer_size
+
+ def _add_audiodata_events(self, audio_data):
+ for event in audio_data.events:
+ event_cursor = self._write_cursor + event.timestamp * \
+ self.source_group.audio_format.bytes_per_second
+ assert _debug('Adding event', event, 'at', event_cursor)
+ self._events.append((event_cursor, event))
+
+ def _add_audiodata_timestamp(self, audio_data):
+ ts_cursor = self._write_cursor + audio_data.length
+ self._timestamps.append(
+ (ts_cursor, audio_data.timestamp + audio_data.duration))
+
+ def update_play_cursor(self):
+ with self._lock:
+ play_cursor_ring = self._ds_buffer.current_position.play_cursor
+ if play_cursor_ring < self._play_cursor_ring:
+ # Wrapped around
+ self._play_cursor += self._buffer_size - self._play_cursor_ring
+ self._play_cursor_ring = 0
+ self._play_cursor += play_cursor_ring - self._play_cursor_ring
+ self._play_cursor_ring = play_cursor_ring
+
+ self._dispatch_pending_events()
+ self._cleanup_timestamps()
+ self._check_underrun()
+
+ def _dispatch_pending_events(self):
+ with self._lock:
+ pending_events = []
+ while self._events and self._events[0][0] <= self._play_cursor:
+ _, event = self._events.pop(0)
+ pending_events.append(event)
+ assert _debug('Dispatching pending events: {}'.format(pending_events))
+ assert _debug('Remaining events: {}'.format(self._events))
+
+ for event in pending_events:
+ event._sync_dispatch_to_player(self.player)
+
+ def _cleanup_timestamps(self):
+ with self._lock:
+ while self._timestamps and self._timestamps[0][0] < self._play_cursor:
+ del self._timestamps[0]
+
+ def _check_underrun(self):
+ if self._playing and self._has_underrun():
+ assert _debug('underrun, stopping')
+ self.stop()
+ self._dispatch_new_event('on_eos')
+ self._dispatch_new_event('on_source_group_eos')
+
+ def get_write_size(self):
+ self.update_play_cursor()
+
+ with self._lock:
+ play_cursor = self._play_cursor
+ write_cursor = self._write_cursor
+
+ return self._buffer_size - max(write_cursor - play_cursor, 0)
+
+ def write(self, audio_data, length):
+ # Pass audio_data=None to write silence
+ if length == 0:
+ return 0
+
+ with self._lock:
+ write_ptr = self._ds_buffer.lock(self._write_cursor_ring, length)
+ assert 0 < length <= self._buffer_size
+ assert length == write_ptr.audio_length_1.value + write_ptr.audio_length_2.value
+
+ if audio_data:
+ ctypes.memmove(write_ptr.audio_ptr_1, audio_data.data, write_ptr.audio_length_1.value)
+ audio_data.consume(write_ptr.audio_length_1.value, self.source_group.audio_format)
+ if write_ptr.audio_length_2.value > 0:
+ ctypes.memmove(write_ptr.audio_ptr_2, audio_data.data, write_ptr.audio_length_2.value)
+ audio_data.consume(write_ptr.audio_length_2.value, self.source_group.audio_format)
+ else:
+ if self.source_group.audio_format.sample_size == 8:
+ c = 0x80
+ else:
+ c = 0
+ ctypes.memset(write_ptr.audio_ptr_1, c, write_ptr.audio_length_1.value)
+ if write_ptr.audio_length_2.value > 0:
+ ctypes.memset(write_ptr.audio_ptr_2, c, write_ptr.audio_length_2.value)
+ self._ds_buffer.unlock(write_ptr)
+
+ self._write_cursor += length
+ self._write_cursor_ring += length
+ self._write_cursor_ring %= self._buffer_size
+
+ def get_time(self):
+ with self._lock:
+ if self._timestamps:
+ cursor, ts = self._timestamps[0]
+ result = ts + (self._play_cursor - cursor) / \
+ float(self.source_group.audio_format.bytes_per_second)
+ else:
+ result = None
+
+ return result
+
+ def set_volume(self, volume):
+ with self._lock:
+ self._ds_buffer.volume = _gain2db(volume)
+
+ def set_position(self, position):
+ if self._ds_buffer.is3d:
+ with self._lock:
+ self._ds_buffer.position = _convert_coordinates(position)
+
+ def set_min_distance(self, min_distance):
+ if self._ds_buffer.is3d:
+ with self._lock:
+ self._ds_buffer.min_distance = min_distance
+
+ def set_max_distance(self, max_distance):
+ if self._ds_buffer.is3d:
+ with self._lock:
+ self._ds_buffer.max_distance = max_distance
+
+ def set_pitch(self, pitch):
+ frequency = int(pitch * self.source_group.audio_format.sample_rate)
+ with self._lock:
+ self._ds_buffer.frequency = frequency
+
+ def set_cone_orientation(self, cone_orientation):
+ if self._ds_buffer.is3d:
+ with self._lock:
+ self._ds_buffer.cone_orientation = _convert_coordinates(cone_orientation)
+
+ def set_cone_inner_angle(self, cone_inner_angle):
+ if self._ds_buffer.is3d:
+ self._cone_inner_angle = int(cone_inner_angle)
+ self._set_cone_angles()
+
+ def set_cone_outer_angle(self, cone_outer_angle):
+ if self._ds_buffer.is3d:
+ self._cone_outer_angle = int(cone_outer_angle)
+ self._set_cone_angles()
+
+ def _set_cone_angles(self):
+ inner = min(self._cone_inner_angle, self._cone_outer_angle)
+ outer = max(self._cone_inner_angle, self._cone_outer_angle)
+ with self._lock:
+ self._ds_buffer.set_cone_angles(inner, outer)
+
+ def set_cone_outer_gain(self, cone_outer_gain):
+ if self._ds_buffer.is3d:
+ volume = _gain2db(cone_outer_gain)
+ with self._lock:
+ self._ds_buffer.cone_outside_volume = volume
+
+
+class DirectSoundDriver(AbstractAudioDriver):
+ def __init__(self):
+ self._ds_driver = interface.DirectSoundDriver()
+ self._ds_listener = self._ds_driver.create_listener()
+
+ assert self._ds_driver is not None
+ assert self._ds_listener is not None
+
+ # Create worker thread
+ self.worker = PlayerWorker()
+ self.worker.start()
+
+ def __del__(self):
+ try:
+ if self._ds_driver:
+ self.delete()
+ except:
+ pass
+
+ def create_audio_player(self, source_group, player):
+ assert self._ds_driver is not None
+ return DirectSoundAudioPlayer(self, self._ds_driver, source_group, player)
+
+ def get_listener(self):
+ assert self._ds_driver is not None
+ assert self._ds_listener is not None
+ return DirectSoundListener(self._ds_listener, self._ds_driver.primary_buffer)
+
+ def delete(self):
+ self.worker.stop()
+ self._ds_listener = None
+ self._ds_driver = None
+
+
+class DirectSoundListener(AbstractListener):
+ def __init__(self, ds_listener, ds_buffer):
+ self._ds_listener = ds_listener
+ self._ds_buffer = ds_buffer
+
+ def _set_volume(self, volume):
+ self._volume = volume
+ self._ds_buffer.volume = _gain2db(volume)
+
+ def _set_position(self, position):
+ self._position = position
+ self._ds_listener.position = _convert_coordinates(position)
+
+ def _set_forward_orientation(self, orientation):
+ self._forward_orientation = orientation
+ self._set_orientation()
+
+ def _set_up_orientation(self, orientation):
+ self._up_orientation = orientation
+ self._set_orientation()
+
+ def _set_orientation(self):
+ self._ds_listener.orientation = (_convert_coordinates(self._forward_orientation)
+ + _convert_coordinates(self._up_orientation))
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/directsound/exceptions.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/directsound/exceptions.py
new file mode 100644
index 0000000..b143506
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/directsound/exceptions.py
@@ -0,0 +1,50 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+from pyglet.media.exceptions import MediaException
+
+
+class DirectSoundException(MediaException):
+ pass
+
+
+class DirectSoundNativeError(DirectSoundException):
+ def __init__(self, hresult):
+ self.hresult = hresult
+
+ def __repr__(self):
+ return "{}: Error {}".format(self.__class__.__name__, self.hresult)
+
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/directsound/interface.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/directsound/interface.py
new file mode 100644
index 0000000..be7b48a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/directsound/interface.py
@@ -0,0 +1,447 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+"""
+Pythonic interface to DirectSound.
+"""
+from collections import namedtuple
+import ctypes
+
+from pyglet.debug import debug_print
+from pyglet.window.win32 import _user32
+
+from . import lib_dsound as lib
+from .exceptions import DirectSoundNativeError
+
+_debug_media = debug_print('debug_media')
+
+def _check(hresult):
+ if hresult != lib.DS_OK:
+ raise DirectSoundNativeError(hresult)
+
+
+class DirectSoundDriver(object):
+ def __init__(self):
+ assert _debug_media('Constructing DirectSoundDriver')
+
+ self._native_dsound = lib.IDirectSound()
+ _check(
+ lib.DirectSoundCreate(None, ctypes.byref(self._native_dsound), None)
+ )
+
+ # A trick used by mplayer.. use desktop as window handle since it
+ # would be complex to use pyglet window handles (and what to do when
+ # application is audio only?).
+ hwnd = _user32.GetDesktopWindow()
+ _check(
+ self._native_dsound.SetCooperativeLevel(hwnd, lib.DSSCL_NORMAL)
+ )
+
+ self._buffer_factory = DirectSoundBufferFactory(self, self._native_dsound)
+ self.primary_buffer = self._buffer_factory.create_primary_buffer()
+
+ def __del__(self):
+ assert _debug_media('Destroying DirectSoundDriver')
+ del self.primary_buffer
+ self._native_dsound.Release()
+
+ def create_buffer(self, audio_format):
+ return self._buffer_factory.create_buffer(audio_format)
+
+ def create_listener(self):
+ return self.primary_buffer.create_listener()
+
+
+class DirectSoundBufferFactory(object):
+ default_buffer_size = 2.0
+
+ def __init__(self, driver, native_dsound):
+ self.driver = driver
+ self._native_dsound = native_dsound
+
+ def create_buffer(self, audio_format):
+ buffer_size = int(audio_format.sample_rate * self.default_buffer_size)
+ wave_format = self._create_wave_format(audio_format)
+ buffer_desc = self._create_buffer_desc(wave_format, buffer_size)
+ return DirectSoundBuffer(
+ self.driver,
+ self._create_buffer(buffer_desc),
+ audio_format,
+ buffer_size)
+
+ def create_primary_buffer(self):
+ return DirectSoundBuffer(
+ self,
+ self._create_buffer(self._create_primary_buffer_desc()),
+ None,
+ 0)
+
+ def _create_buffer(self, buffer_desc):
+ buf = lib.IDirectSoundBuffer()
+ _check(
+ self._native_dsound.CreateSoundBuffer(buffer_desc, ctypes.byref(buf), None)
+ )
+ return buf
+
+ @staticmethod
+ def _create_wave_format(audio_format):
+ wfx = lib.WAVEFORMATEX()
+ wfx.wFormatTag = lib.WAVE_FORMAT_PCM
+ wfx.nChannels = audio_format.channels
+ wfx.nSamplesPerSec = audio_format.sample_rate
+ wfx.wBitsPerSample = audio_format.sample_size
+ wfx.nBlockAlign = wfx.wBitsPerSample * wfx.nChannels // 8
+ wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign
+ return wfx
+
+ @classmethod
+ def _create_buffer_desc(cls, wave_format, buffer_size):
+ dsbdesc = lib.DSBUFFERDESC()
+ dsbdesc.dwSize = ctypes.sizeof(dsbdesc)
+ dsbdesc.dwFlags = (lib.DSBCAPS_GLOBALFOCUS |
+ lib.DSBCAPS_GETCURRENTPOSITION2 |
+ lib.DSBCAPS_CTRLFREQUENCY |
+ lib.DSBCAPS_CTRLVOLUME)
+ if wave_format.nChannels == 1:
+ dsbdesc.dwFlags |= lib.DSBCAPS_CTRL3D
+ dsbdesc.dwBufferBytes = buffer_size
+ dsbdesc.lpwfxFormat = ctypes.pointer(wave_format)
+
+ return dsbdesc
+
+ @classmethod
+ def _create_primary_buffer_desc(cls):
+ """Primary buffer with 3D and volume capabilities"""
+ buffer_desc = lib.DSBUFFERDESC()
+ buffer_desc.dwSize = ctypes.sizeof(buffer_desc)
+ buffer_desc.dwFlags = (lib.DSBCAPS_CTRL3D |
+ lib.DSBCAPS_CTRLVOLUME |
+ lib.DSBCAPS_PRIMARYBUFFER)
+
+ return buffer_desc
+
+class DirectSoundBuffer(object):
+ def __init__(self, driver, native_buffer, audio_format, buffer_size):
+ self.driver = driver
+ self.audio_format = audio_format
+ self.buffer_size = buffer_size
+
+ self._native_buffer = native_buffer
+
+ if audio_format is not None and audio_format.channels == 1:
+ self._native_buffer3d = lib.IDirectSound3DBuffer()
+ self._native_buffer.QueryInterface(lib.IID_IDirectSound3DBuffer,
+ ctypes.byref(self._native_buffer3d))
+ else:
+ self._native_buffer3d = None
+
+ def __del__(self):
+ if self._native_buffer is not None:
+ self._native_buffer.Stop()
+ self._native_buffer.Release()
+ self._native_buffer = None
+ if self._native_buffer3d is not None:
+ self._native_buffer3d.Release()
+ self._native_buffer3d = None
+
+ @property
+ def volume(self):
+ vol = lib.LONG()
+ _check(
+ self._native_buffer.GetVolume(ctypes.byref(vol))
+ )
+ return vol.value
+
+ @volume.setter
+ def volume(self, value):
+ _check(
+ self._native_buffer.SetVolume(value)
+ )
+
+ _CurrentPosition = namedtuple('_CurrentPosition', ['play_cursor', 'write_cursor'])
+
+ @property
+ def current_position(self):
+ """Tuple of current play position and current write position.
+ Only play position can be modified, so setter only accepts a single value."""
+ play_cursor = lib.DWORD()
+ write_cursor = lib.DWORD()
+ _check(
+ self._native_buffer.GetCurrentPosition(play_cursor,
+ write_cursor)
+ )
+ return self._CurrentPosition(play_cursor.value, write_cursor.value)
+
+ @current_position.setter
+ def current_position(self, value):
+ _check(
+ self._native_buffer.SetCurrentPosition(value)
+ )
+
+ @property
+ def is3d(self):
+ return self._native_buffer3d is not None
+
+ @property
+ def is_playing(self):
+ return (self._get_status() & lib.DSBSTATUS_PLAYING) != 0
+
+ @property
+ def is_buffer_lost(self):
+ return (self._get_status() & lib.DSBSTATUS_BUFFERLOST) != 0
+
+ def _get_status(self):
+ status = lib.DWORD()
+ _check(
+ self._native_buffer.GetStatus(status)
+ )
+ return status.value
+
+ @property
+ def position(self):
+ if self.is3d:
+ position = lib.D3DVECTOR()
+ _check(
+ self._native_buffer3d.GetPosition(ctypes.byref(position))
+ )
+ return position.x, position.y, position.z
+ else:
+ return 0, 0, 0
+
+ @position.setter
+ def position(self, position):
+ if self.is3d:
+ x, y, z = position
+ _check(
+ self._native_buffer3d.SetPosition(x, y, z, lib.DS3D_IMMEDIATE)
+ )
+
+ @property
+ def min_distance(self):
+ """The minimum distance, which is the distance from the
+ listener at which sounds in this buffer begin to be attenuated."""
+ if self.is3d:
+ value = lib.D3DVALUE()
+ _check(
+ self._native_buffer3d.GetMinDistance(ctypes.byref(value))
+ )
+ return value.value
+ else:
+ return 0
+
+ @min_distance.setter
+ def min_distance(self, value):
+ if self.is3d:
+ _check(
+ self._native_buffer3d.SetMinDistance(value, lib.DS3D_IMMEDIATE)
+ )
+
+ @property
+ def max_distance(self):
+ """The maximum distance, which is the distance from the listener beyond which
+ sounds in this buffer are no longer attenuated."""
+ if self.is3d:
+ value = lib.D3DVALUE()
+ _check(
+ self._native_buffer3d.GetMaxDistance(ctypes.byref(value))
+ )
+ return value.value
+ else:
+ return 0
+
+ @max_distance.setter
+ def max_distance(self, value):
+ if self.is3d:
+ _check(
+ self._native_buffer3d.SetMaxDistance(value, lib.DS3D_IMMEDIATE)
+ )
+
+ @property
+ def frequency(self):
+ value = lib.DWORD()
+ _check(
+ self._native_buffer.GetFrequency(value)
+ )
+ return value.value
+
+ @frequency.setter
+ def frequency(self, value):
+ """The frequency, in samples per second, at which the buffer is playing."""
+ _check(
+ self._native_buffer.SetFrequency(value)
+ )
+
+ @property
+ def cone_orientation(self):
+ """The orientation of the sound projection cone."""
+ if self.is3d:
+ orientation = lib.D3DVECTOR()
+ _check(
+ self._native_buffer3d.GetConeOrientation(ctypes.byref(orientation))
+ )
+ return orientation.x, orientation.y, orientation.z
+ else:
+ return 0, 0, 0
+
+ @cone_orientation.setter
+ def cone_orientation(self, value):
+ if self.is3d:
+ x, y, z = value
+ _check(
+ self._native_buffer3d.SetConeOrientation(x, y, z, lib.DS3D_IMMEDIATE)
+ )
+
+ _ConeAngles = namedtuple('_ConeAngles', ['inside', 'outside'])
+ @property
+ def cone_angles(self):
+ """The inside and outside angles of the sound projection cone."""
+ if self.is3d:
+ inside = lib.DWORD()
+ outside = lib.DWORD()
+ _check(
+ self._native_buffer3d.GetConeAngles(ctypes.byref(inside), ctypes.byref(outside))
+ )
+ return self._ConeAngles(inside.value, outside.value)
+ else:
+ return self._ConeAngles(0, 0)
+
+ def set_cone_angles(self, inside, outside):
+ """The inside and outside angles of the sound projection cone."""
+ if self.is3d:
+ _check(
+ self._native_buffer3d.SetConeAngles(inside, outside, lib.DS3D_IMMEDIATE)
+ )
+
+ @property
+ def cone_outside_volume(self):
+ """The volume of the sound outside the outside angle of the sound projection cone."""
+ if self.is3d:
+ volume = lib.LONG()
+ _check(
+ self._native_buffer3d.GetConeOutsideVolume(ctypes.byref(volume))
+ )
+ return volume.value
+ else:
+ return 0
+
+ @cone_outside_volume.setter
+ def cone_outside_volume(self, value):
+ if self.is3d:
+ _check(
+ self._native_buffer3d.SetConeOutsideVolume(value, lib.DS3D_IMMEDIATE)
+ )
+
+ def create_listener(self):
+ native_listener = lib.IDirectSound3DListener()
+ self._native_buffer.QueryInterface(lib.IID_IDirectSound3DListener,
+ ctypes.byref(native_listener))
+ return DirectSoundListener(self, native_listener)
+
+ def play(self):
+ _check(
+ self._native_buffer.Play(0, 0, lib.DSBPLAY_LOOPING)
+ )
+
+ def stop(self):
+ _check(
+ self._native_buffer.Stop()
+ )
+
+ class _WritePointer(object):
+ def __init__(self):
+ self.audio_ptr_1 = ctypes.c_void_p()
+ self.audio_length_1 = lib.DWORD()
+ self.audio_ptr_2 = ctypes.c_void_p()
+ self.audio_length_2 = lib.DWORD()
+
+ def lock(self, write_cursor, write_size):
+ assert _debug_media('DirectSoundBuffer.lock({}, {})'.format(write_cursor, write_size))
+ pointer = self._WritePointer()
+ _check(
+ self._native_buffer.Lock(write_cursor,
+ write_size,
+ ctypes.byref(pointer.audio_ptr_1),
+ pointer.audio_length_1,
+ ctypes.byref(pointer.audio_ptr_2),
+ pointer.audio_length_2,
+ 0)
+ )
+ return pointer
+
+ def unlock(self, pointer):
+ _check(
+ self._native_buffer.Unlock(pointer.audio_ptr_1,
+ pointer.audio_length_1,
+ pointer.audio_ptr_2,
+ pointer.audio_length_2)
+ )
+
+
+class DirectSoundListener(object):
+ def __init__(self, ds_buffer, native_listener):
+ self.ds_buffer = ds_buffer
+ self._native_listener = native_listener
+
+ def __del__(self):
+ self._native_listener.Release()
+
+ @property
+ def position(self):
+ vector = lib.D3DVECTOR()
+ _check(
+ self._native_listener.GetPosition(ctypes.byref(vector))
+ )
+ return (vector.x, vector.y, vector.z)
+
+ @position.setter
+ def position(self, value):
+ _check(
+ self._native_listener.SetPosition(*(list(value) + [lib.DS3D_IMMEDIATE]))
+ )
+
+ @property
+ def orientation(self):
+ front = lib.D3DVECTOR()
+ top = lib.D3DVECTOR()
+ _check(
+ self._native_listener.GetOrientation(ctypes.byref(front), ctypes.byref(top))
+ )
+ return (front.x, front.y, front.z, top.x, top.y, top.z)
+
+ @orientation.setter
+ def orientation(self, orientation):
+ _check(
+ self._native_listener.SetOrientation(*(list(orientation) + [lib.DS3D_IMMEDIATE]))
+ )
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/directsound/lib_dsound.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/directsound/lib_dsound.py
new file mode 100644
index 0000000..849e16b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/directsound/lib_dsound.py
@@ -0,0 +1,450 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+import ctypes
+from pyglet import com
+
+lib = ctypes.oledll.dsound
+
+DWORD = ctypes.c_uint32
+LPDWORD = ctypes.POINTER(DWORD)
+LONG = ctypes.c_long
+LPLONG = ctypes.POINTER(LONG)
+WORD = ctypes.c_uint16
+HWND = DWORD
+LPUNKNOWN = ctypes.c_void_p
+
+D3DVALUE = ctypes.c_float
+PD3DVALUE = ctypes.POINTER(D3DVALUE)
+
+class D3DVECTOR(ctypes.Structure):
+ _fields_ = [
+ ('x', ctypes.c_float),
+ ('y', ctypes.c_float),
+ ('z', ctypes.c_float),
+ ]
+PD3DVECTOR = ctypes.POINTER(D3DVECTOR)
+
+class WAVEFORMATEX(ctypes.Structure):
+ _fields_ = [
+ ('wFormatTag', WORD),
+ ('nChannels', WORD),
+ ('nSamplesPerSec', DWORD),
+ ('nAvgBytesPerSec', DWORD),
+ ('nBlockAlign', WORD),
+ ('wBitsPerSample', WORD),
+ ('cbSize', WORD),
+ ]
+
+ def __repr__(self):
+ return 'WAVEFORMATEX(wFormatTag={}, nChannels={}, nSamplesPerSec={}, nAvgBytesPersec={}' \
+ ', nBlockAlign={}, wBitsPerSample={}, cbSize={})'.format(
+ self.wFormatTag, self.nChannels, self.nSamplesPerSec,
+ self.nAvgBytesPerSec, self.nBlockAlign, self.wBitsPerSample,
+ self.cbSize)
+LPWAVEFORMATEX = ctypes.POINTER(WAVEFORMATEX)
+WAVE_FORMAT_PCM = 1
+
+class DSCAPS(ctypes.Structure):
+ _fields_ = [
+ ('dwSize', DWORD),
+ ('dwFlags', DWORD),
+ ('dwMinSecondarySampleRate', DWORD),
+ ('dwMaxSecondarySampleRate', DWORD),
+ ('dwPrimaryBuffers', DWORD),
+ ('dwMaxHwMixingAllBuffers', DWORD),
+ ('dwMaxHwMixingStaticBuffers', DWORD),
+ ('dwMaxHwMixingStreamingBuffers', DWORD),
+ ('dwFreeHwMixingAllBuffers', DWORD),
+ ('dwFreeHwMixingStaticBuffers', DWORD),
+ ('dwFreeHwMixingStreamingBuffers', DWORD),
+ ('dwMaxHw3DAllBuffers', DWORD),
+ ('dwMaxHw3DStaticBuffers', DWORD),
+ ('dwMaxHw3DStreamingBuffers', DWORD),
+ ('dwFreeHw3DAllBuffers', DWORD),
+ ('dwFreeHw3DStaticBuffers', DWORD),
+ ('dwFreeHw3DStreamingBuffers', DWORD),
+ ('dwTotalHwMemBytes', DWORD),
+ ('dwFreeHwMemBytes', DWORD),
+ ('dwMaxContigFreeHwMemBytes', DWORD),
+ ('dwUnlockTransferRateHwBuffers', DWORD),
+ ('dwPlayCpuOverheadSwBuffers', DWORD),
+ ('dwReserved1', DWORD),
+ ('dwReserved2', DWORD)
+ ]
+LPDSCAPS = ctypes.POINTER(DSCAPS)
+
+class DSBCAPS(ctypes.Structure):
+ _fields_ = [
+ ('dwSize', DWORD),
+ ('dwFlags', DWORD),
+ ('dwBufferBytes', DWORD),
+ ('dwUnlockTransferRate', DWORD),
+ ('dwPlayCpuOverhead', DWORD),
+ ]
+LPDSBCAPS = ctypes.POINTER(DSBCAPS)
+
+class DSBUFFERDESC(ctypes.Structure):
+ _fields_ = [
+ ('dwSize', DWORD),
+ ('dwFlags', DWORD),
+ ('dwBufferBytes', DWORD),
+ ('dwReserved', DWORD),
+ ('lpwfxFormat', LPWAVEFORMATEX),
+ ]
+
+ def __repr__(self):
+ return 'DSBUFFERDESC(dwSize={}, dwFlags={}, dwBufferBytes={}, lpwfxFormat={})'.format(
+ self.dwSize, self.dwFlags, self.dwBufferBytes,
+ self.lpwfxFormat.contents if self.lpwfxFormat else None)
+LPDSBUFFERDESC = ctypes.POINTER(DSBUFFERDESC)
+
+class DS3DBUFFER(ctypes.Structure):
+ _fields_ = [
+ ('dwSize', DWORD),
+ ('vPosition', D3DVECTOR),
+ ('vVelocity', D3DVECTOR),
+ ('dwInsideConeAngle', DWORD),
+ ('dwOutsideConeAngle', DWORD),
+ ('vConeOrientation', D3DVECTOR),
+ ('lConeOutsideVolume', LONG),
+ ('flMinDistance', D3DVALUE),
+ ('flMaxDistance', D3DVALUE),
+ ('dwMode', DWORD),
+ ]
+LPDS3DBUFFER = ctypes.POINTER(DS3DBUFFER)
+
+class DS3DLISTENER(ctypes.Structure):
+ _fields_ = [
+ ('dwSize', DWORD),
+ ('vPosition', D3DVECTOR),
+ ('vVelocity', D3DVECTOR),
+ ('vOrientFront', D3DVECTOR),
+ ('vOrientTop', D3DVECTOR),
+ ('flDistanceFactor', D3DVALUE),
+ ('flRolloffFactor', D3DVALUE),
+ ('flDopplerFactor', D3DVALUE),
+ ]
+LPDS3DLISTENER = ctypes.POINTER(DS3DLISTENER)
+
+class IDirectSoundBuffer(com.IUnknown):
+ _methods_ = [
+ ('GetCaps',
+ com.STDMETHOD(LPDSBCAPS)),
+ ('GetCurrentPosition',
+ com.STDMETHOD(LPDWORD, LPDWORD)),
+ ('GetFormat',
+ com.STDMETHOD(LPWAVEFORMATEX, DWORD, LPDWORD)),
+ ('GetVolume',
+ com.STDMETHOD(LPLONG)),
+ ('GetPan',
+ com.STDMETHOD(LPLONG)),
+ ('GetFrequency',
+ com.STDMETHOD(LPDWORD)),
+ ('GetStatus',
+ com.STDMETHOD(LPDWORD)),
+ ('Initialize',
+ com.STDMETHOD(ctypes.c_void_p, LPDSBUFFERDESC)),
+ ('Lock',
+ com.STDMETHOD(DWORD, DWORD,
+ ctypes.POINTER(ctypes.c_void_p), LPDWORD,
+ ctypes.POINTER(ctypes.c_void_p), LPDWORD,
+ DWORD)),
+ ('Play',
+ com.STDMETHOD(DWORD, DWORD, DWORD)),
+ ('SetCurrentPosition',
+ com.STDMETHOD(DWORD)),
+ ('SetFormat',
+ com.STDMETHOD(LPWAVEFORMATEX)),
+ ('SetVolume',
+ com.STDMETHOD(LONG)),
+ ('SetPan',
+ com.STDMETHOD(LONG)),
+ ('SetFrequency',
+ com.STDMETHOD(DWORD)),
+ ('Stop',
+ com.STDMETHOD()),
+ ('Unlock',
+ com.STDMETHOD(ctypes.c_void_p, DWORD, ctypes.c_void_p, DWORD)),
+ ('Restore',
+ com.STDMETHOD()),
+ ]
+
+IID_IDirectSound3DListener = com.GUID(
+ 0x279AFA84, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60)
+
+class IDirectSound3DListener(com.IUnknown):
+ _methods_ = [
+ ('GetAllParameters',
+ com.STDMETHOD(LPDS3DLISTENER)),
+ ('GetDistanceFactor',
+ com.STDMETHOD(PD3DVALUE)),
+ ('GetDopplerFactor',
+ com.STDMETHOD(PD3DVALUE)),
+ ('GetOrientation',
+ com.STDMETHOD(PD3DVECTOR, PD3DVECTOR)),
+ ('GetPosition',
+ com.STDMETHOD(PD3DVECTOR)),
+ ('GetRolloffFactor',
+ com.STDMETHOD(PD3DVALUE)),
+ ('GetVelocity',
+ com.STDMETHOD(PD3DVECTOR)),
+ ('SetAllParameters',
+ com.STDMETHOD(LPDS3DLISTENER)),
+ ('SetDistanceFactor',
+ com.STDMETHOD(D3DVALUE, DWORD)),
+ ('SetDopplerFactor',
+ com.STDMETHOD(D3DVALUE, DWORD)),
+ ('SetOrientation',
+ com.STDMETHOD(D3DVALUE, D3DVALUE, D3DVALUE,
+ D3DVALUE, D3DVALUE, D3DVALUE, DWORD)),
+ ('SetPosition',
+ com.STDMETHOD(D3DVALUE, D3DVALUE, D3DVALUE, DWORD)),
+ ('SetRolloffFactor',
+ com.STDMETHOD(D3DVALUE, DWORD)),
+ ('SetVelocity',
+ com.STDMETHOD(D3DVALUE, D3DVALUE, D3DVALUE, DWORD)),
+ ('CommitDeferredSettings',
+ com.STDMETHOD()),
+ ]
+
+IID_IDirectSound3DBuffer = com.GUID(
+ 0x279AFA86, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60)
+
+class IDirectSound3DBuffer(com.IUnknown):
+ _methods_ = [
+ ('GetAllParameters',
+ com.STDMETHOD(LPDS3DBUFFER)),
+ ('GetConeAngles',
+ com.STDMETHOD(LPDWORD, LPDWORD)),
+ ('GetConeOrientation',
+ com.STDMETHOD(PD3DVECTOR)),
+ ('GetConeOutsideVolume',
+ com.STDMETHOD(LPLONG)),
+ ('GetMaxDistance',
+ com.STDMETHOD(PD3DVALUE)),
+ ('GetMinDistance',
+ com.STDMETHOD(PD3DVALUE)),
+ ('GetMode',
+ com.STDMETHOD(LPDWORD)),
+ ('GetPosition',
+ com.STDMETHOD(PD3DVECTOR)),
+ ('GetVelocity',
+ com.STDMETHOD(PD3DVECTOR)),
+ ('SetAllParameters',
+ com.STDMETHOD(LPDS3DBUFFER, DWORD)),
+ ('SetConeAngles',
+ com.STDMETHOD(DWORD, DWORD, DWORD)),
+ ('SetConeOrientation',
+ com.STDMETHOD(D3DVALUE, D3DVALUE, D3DVALUE, DWORD)),
+ ('SetConeOutsideVolume',
+ com.STDMETHOD(LONG, DWORD)),
+ ('SetMaxDistance',
+ com.STDMETHOD(D3DVALUE, DWORD)),
+ ('SetMinDistance',
+ com.STDMETHOD(D3DVALUE, DWORD)),
+ ('SetMode',
+ com.STDMETHOD(DWORD, DWORD)),
+ ('SetPosition',
+ com.STDMETHOD(D3DVALUE, D3DVALUE, D3DVALUE, DWORD)),
+ ('SetVelocity',
+ com.STDMETHOD(D3DVALUE, D3DVALUE, D3DVALUE, DWORD)),
+ ]
+
+class IDirectSound(com.IUnknown):
+ _methods_ = [
+ ('CreateSoundBuffer',
+ com.STDMETHOD(LPDSBUFFERDESC,
+ ctypes.POINTER(IDirectSoundBuffer),
+ LPUNKNOWN)),
+ ('GetCaps',
+ com.STDMETHOD(LPDSCAPS)),
+ ('DuplicateSoundBuffer',
+ com.STDMETHOD(IDirectSoundBuffer,
+ ctypes.POINTER(IDirectSoundBuffer))),
+ ('SetCooperativeLevel',
+ com.STDMETHOD(HWND, DWORD)),
+ ('Compact',
+ com.STDMETHOD()),
+ ('GetSpeakerConfig',
+ com.STDMETHOD(LPDWORD)),
+ ('SetSpeakerConfig',
+ com.STDMETHOD(DWORD)),
+ ('Initialize',
+ com.STDMETHOD(com.LPGUID)),
+ ]
+ _type_ = com.COMInterface
+
+DirectSoundCreate = lib.DirectSoundCreate
+DirectSoundCreate.argtypes = \
+ [com.LPGUID, ctypes.POINTER(IDirectSound), ctypes.c_void_p]
+
+DSCAPS_PRIMARYMONO = 0x00000001
+DSCAPS_PRIMARYSTEREO = 0x00000002
+DSCAPS_PRIMARY8BIT = 0x00000004
+DSCAPS_PRIMARY16BIT = 0x00000008
+DSCAPS_CONTINUOUSRATE = 0x00000010
+DSCAPS_EMULDRIVER = 0x00000020
+DSCAPS_CERTIFIED = 0x00000040
+DSCAPS_SECONDARYMONO = 0x00000100
+DSCAPS_SECONDARYSTEREO = 0x00000200
+DSCAPS_SECONDARY8BIT = 0x00000400
+DSCAPS_SECONDARY16BIT = 0x00000800
+
+DSSCL_NORMAL = 0x00000001
+DSSCL_PRIORITY = 0x00000002
+DSSCL_EXCLUSIVE = 0x00000003
+DSSCL_WRITEPRIMARY = 0x00000004
+
+DSSPEAKER_DIRECTOUT = 0x00000000
+DSSPEAKER_HEADPHONE = 0x00000001
+DSSPEAKER_MONO = 0x00000002
+DSSPEAKER_QUAD = 0x00000003
+DSSPEAKER_STEREO = 0x00000004
+DSSPEAKER_SURROUND = 0x00000005
+DSSPEAKER_5POINT1 = 0x00000006
+DSSPEAKER_7POINT1 = 0x00000007
+
+DSSPEAKER_GEOMETRY_MIN = 0x00000005 # 5 degrees
+DSSPEAKER_GEOMETRY_NARROW = 0x0000000A # 10 degrees
+DSSPEAKER_GEOMETRY_WIDE = 0x00000014 # 20 degrees
+DSSPEAKER_GEOMETRY_MAX = 0x000000B4 # 180 degrees
+
+DSBCAPS_PRIMARYBUFFER = 0x00000001
+DSBCAPS_STATIC = 0x00000002
+DSBCAPS_LOCHARDWARE = 0x00000004
+DSBCAPS_LOCSOFTWARE = 0x00000008
+DSBCAPS_CTRL3D = 0x00000010
+DSBCAPS_CTRLFREQUENCY = 0x00000020
+DSBCAPS_CTRLPAN = 0x00000040
+DSBCAPS_CTRLVOLUME = 0x00000080
+DSBCAPS_CTRLPOSITIONNOTIFY = 0x00000100
+DSBCAPS_CTRLFX = 0x00000200
+DSBCAPS_STICKYFOCUS = 0x00004000
+DSBCAPS_GLOBALFOCUS = 0x00008000
+DSBCAPS_GETCURRENTPOSITION2 = 0x00010000
+DSBCAPS_MUTE3DATMAXDISTANCE = 0x00020000
+DSBCAPS_LOCDEFER = 0x00040000
+
+DSBPLAY_LOOPING = 0x00000001
+DSBPLAY_LOCHARDWARE = 0x00000002
+DSBPLAY_LOCSOFTWARE = 0x00000004
+DSBPLAY_TERMINATEBY_TIME = 0x00000008
+DSBPLAY_TERMINATEBY_DISTANCE = 0x000000010
+DSBPLAY_TERMINATEBY_PRIORITY = 0x000000020
+
+DSBSTATUS_PLAYING = 0x00000001
+DSBSTATUS_BUFFERLOST = 0x00000002
+DSBSTATUS_LOOPING = 0x00000004
+DSBSTATUS_LOCHARDWARE = 0x00000008
+DSBSTATUS_LOCSOFTWARE = 0x00000010
+DSBSTATUS_TERMINATED = 0x00000020
+
+DSBLOCK_FROMWRITECURSOR = 0x00000001
+DSBLOCK_ENTIREBUFFER = 0x00000002
+
+DSBFREQUENCY_MIN = 100
+DSBFREQUENCY_MAX = 100000
+DSBFREQUENCY_ORIGINAL = 0
+
+DSBPAN_LEFT = -10000
+DSBPAN_CENTER = 0
+DSBPAN_RIGHT = 10000
+
+DSBVOLUME_MIN = -10000
+DSBVOLUME_MAX = 0
+
+DSBSIZE_MIN = 4
+DSBSIZE_MAX = 0x0FFFFFFF
+DSBSIZE_FX_MIN = 150 # NOTE: Milliseconds, not bytes
+
+DS3DMODE_NORMAL = 0x00000000
+DS3DMODE_HEADRELATIVE = 0x00000001
+DS3DMODE_DISABLE = 0x00000002
+
+DS3D_IMMEDIATE = 0x00000000
+DS3D_DEFERRED = 0x00000001
+
+DS3D_MINDISTANCEFACTOR = -1000000.0 # XXX FLT_MIN
+DS3D_MAXDISTANCEFACTOR = 1000000.0 # XXX FLT_MAX
+DS3D_DEFAULTDISTANCEFACTOR = 1.0
+
+DS3D_MINROLLOFFFACTOR = 0.0
+DS3D_MAXROLLOFFFACTOR = 10.0
+DS3D_DEFAULTROLLOFFFACTOR = 1.0
+
+DS3D_MINDOPPLERFACTOR = 0.0
+DS3D_MAXDOPPLERFACTOR = 10.0
+DS3D_DEFAULTDOPPLERFACTOR = 1.0
+
+DS3D_DEFAULTMINDISTANCE = 1.0
+DS3D_DEFAULTMAXDISTANCE = 1000000000.0
+
+DS3D_MINCONEANGLE = 0
+DS3D_MAXCONEANGLE = 360
+DS3D_DEFAULTCONEANGLE = 360
+
+DS3D_DEFAULTCONEOUTSIDEVOLUME = DSBVOLUME_MAX
+
+# Return codes
+DS_OK = 0x00000000
+DSERR_OUTOFMEMORY = 0x00000007
+DSERR_NOINTERFACE = 0x000001AE
+DS_NO_VIRTUALIZATION = 0x0878000A
+DS_INCOMPLETE = 0x08780014
+DSERR_UNSUPPORTED = 0x80004001
+DSERR_GENERIC = 0x80004005
+DSERR_ACCESSDENIED = 0x80070005
+DSERR_INVALIDPARAM = 0x80070057
+DSERR_ALLOCATED = 0x8878000A
+DSERR_CONTROLUNAVAIL = 0x8878001E
+DSERR_INVALIDCALL = 0x88780032
+DSERR_PRIOLEVELNEEDED = 0x88780046
+DSERR_BADFORMAT = 0x88780064
+DSERR_NODRIVER = 0x88780078
+DSERR_ALREADYINITIALIZED = 0x88780082
+DSERR_BUFFERLOST = 0x88780096
+DSERR_OTHERAPPHASPRIO = 0x887800A0
+DSERR_UNINITALIZED = 0x887800AA
+DSERR_BUFFERTOOSMALL = 0x887810B4
+DSERR_DS8_REQUIRED = 0x887810BE
+DSERR_SENDLOOP = 0x887810C8
+DSERR_BADSENDBUFFERGUID = 0x887810D2
+DSERR_FXUNAVAILABLE = 0x887810DC
+DSERR_OBJECTNOTFOUND = 0x88781161
+
+# Buffer status
+DSBSTATUS_PLAYING = 0x00000001
+DSBSTATUS_BUFFERLOST = 0x00000002
+DSBSTATUS_LOOPING = 0x00000004
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/openal/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/openal/__init__.py
new file mode 100644
index 0000000..1f98897
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/openal/__init__.py
@@ -0,0 +1,71 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+# $Id$
+from __future__ import print_function
+from __future__ import absolute_import
+
+import atexit
+
+from .adaptation import OpenALDriver
+
+import pyglet
+_debug = pyglet.options['debug_media']
+_debug_buffers = pyglet.options.get('debug_media_buffers', False)
+
+
+_driver = None
+
+def create_audio_driver(device_name=None):
+ global _driver
+ _driver = OpenALDriver(device_name)
+ if _debug:
+ print('OpenAL', _driver.get_version())
+ return _driver
+
+
+def cleanup_audio_driver():
+ global _driver
+
+ if _debug:
+ print("Cleaning up audio driver")
+
+ if _driver:
+ _driver.delete()
+ _driver = None
+
+ if _debug:
+ print("Cleaning done")
+
+atexit.register(cleanup_audio_driver)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/openal/adaptation.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/openal/adaptation.py
new file mode 100644
index 0000000..75bd2f6
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/openal/adaptation.py
@@ -0,0 +1,499 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+from __future__ import print_function
+from __future__ import absolute_import
+
+import threading
+import time
+
+from . import interface
+from pyglet.app import WeakSet
+from pyglet.debug import debug_print
+from pyglet.media.drivers.base import AbstractAudioDriver, AbstractAudioPlayer
+from pyglet.media.events import MediaEvent
+from pyglet.media.listener import AbstractListener
+from pyglet.media.threads import PlayerWorker
+
+_debug_media = debug_print('debug_media')
+
+
+class OpenALDriver(AbstractAudioDriver):
+ def __init__(self, device_name=None):
+ super(OpenALDriver, self).__init__()
+
+ # TODO devices must be enumerated on Windows, otherwise 1.0 context is
+ # returned.
+
+ self.device = interface.OpenALDevice(device_name)
+ self.context = self.device.create_context()
+ self.context.make_current()
+
+ self.lock = threading.Lock()
+
+ self._listener = OpenALListener(self)
+ self._players = WeakSet()
+
+ # Start worker thread
+ self.worker = PlayerWorker()
+ self.worker.start()
+
+ def create_audio_player(self, source_group, player):
+ assert self.device is not None, "Device was closed"
+ if self.have_version(1, 1):
+ player = OpenALAudioPlayer11(self, source_group, player)
+ else:
+ player = OpenALAudioPlayer10(self, source_group, player)
+ self._players.add(player)
+ return player
+
+ def delete(self):
+ self.worker.stop()
+ for player in self._players:
+ player.delete()
+ with self.lock:
+ if self.context is not None:
+ self.context.delete()
+ self.context = None
+ if self.device is not None:
+ self.device.delete()
+ self.device = None
+
+ def have_version(self, major, minor):
+ return (major, minor) <= self.get_version()
+
+ def get_version(self):
+ assert self.device is not None, "Device was closed"
+ return self.device.get_version()
+
+ def get_extensions(self):
+ assert self.device is not None, "Device was closed"
+ return self.device.get_extensions()
+
+ def have_extension(self, extension):
+ return extension in self.get_extensions()
+
+ def get_listener(self):
+ return self._listener
+
+ def __enter__(self):
+ self.lock.acquire()
+
+ def __exit__(self, exc_type, exc_value, traceback):
+ self.lock.release()
+
+
+class OpenALListener(AbstractListener):
+ def __init__(self, driver):
+ self._driver = driver
+ self._al_listener = interface.OpenALListener()
+
+ def _set_volume(self, volume):
+ with self._driver:
+ self._al_listener.gain = volume
+ self._volume = volume
+
+ def _set_position(self, position):
+ with self._driver:
+ self._al_listener.position = position
+ self._position = position
+
+ def _set_forward_orientation(self, orientation):
+ with self._driver:
+ self._al_listener = orientation + self._up_orientation
+ self._forward_orientation = orientation
+
+ def _set_up_orientation(self, orientation):
+ with self._driver:
+ self._al_listener.orientation = self._forward_orientation + orientation
+ self._up_orientation = orientation
+
+
+class OpenALAudioPlayer11(AbstractAudioPlayer):
+ #: Minimum size of an OpenAL buffer worth bothering with, in bytes
+ min_buffer_size = 512
+
+ #: Aggregate (desired) buffer size, in seconds
+ _ideal_buffer_size = 1.
+
+ def __init__(self, driver, source_group, player):
+ super(OpenALAudioPlayer11, self).__init__(source_group, player)
+ self.driver = driver
+ self.source = driver.context.create_source()
+
+ # Lock policy: lock all instance vars (except constants). (AL calls
+ # are locked on context).
+ self._lock = threading.RLock()
+
+ # Cursor positions, like DSound and Pulse drivers, refer to a
+ # hypothetical infinite-length buffer. Cursor units are in bytes.
+
+ # Cursor position of current (head) AL buffer
+ self._buffer_cursor = 0
+
+ # Estimated playback cursor position (last seen)
+ self._play_cursor = 0
+
+ # Cursor position of end of queued AL buffer.
+ self._write_cursor = 0
+
+ # List of currently queued buffer sizes (in bytes)
+ self._buffer_sizes = []
+
+ # List of currently queued buffer timestamps
+ self._buffer_timestamps = []
+
+ # Timestamp at end of last written buffer (timestamp to return in case
+ # of underrun)
+ self._underrun_timestamp = None
+
+ # List of (cursor, MediaEvent)
+ self._events = []
+
+ # Desired play state (True even if stopped due to underrun)
+ self._playing = False
+
+ # When clearing, the play cursor can be incorrect
+ self._clearing = False
+
+ # Up to one audio data may be buffered if too much data was received
+ # from the source that could not be written immediately into the
+ # buffer. See refill().
+ self._audiodata_buffer = None
+
+ self.refill(self.ideal_buffer_size)
+
+ def __del__(self):
+ try:
+ self.delete()
+ except:
+ pass
+
+ def delete(self):
+ assert _debug_media('OpenALAudioPlayer.delete()')
+
+ # Do not lock self._lock before calling this, or you risk a deadlock with worker
+ self.driver.worker.remove(self)
+
+ with self._lock:
+ if not self.source:
+ return
+
+ assert self.driver is not None
+ with self.driver:
+ self.source.delete()
+ self.source = None
+
+ @property
+ def ideal_buffer_size(self):
+ return int(self._ideal_buffer_size * self.source_group.audio_format.bytes_per_second)
+
+ def play(self):
+ assert _debug_media('OpenALAudioPlayer.play()')
+
+ with self._lock:
+ assert self.driver is not None
+ assert self.source is not None
+
+ with self.driver:
+ if not self.source.is_playing:
+ self.source.play()
+ self._playing = True
+ self._clearing = False
+
+ self.driver.worker.add(self)
+
+ def stop(self):
+ assert _debug_media('OpenALAudioPlayer.stop()')
+
+ with self._lock:
+ assert self.driver is not None
+ assert self.source is not None
+
+ self._pause_timestamp = self.get_time()
+
+ with self.driver:
+ self.source.pause()
+ self._playing = False
+
+ def clear(self):
+ assert _debug_media('OpenALAudioPlayer.clear()')
+
+ with self._lock:
+ assert self.driver is not None
+ assert self.source is not None
+
+ with self.driver:
+ self.source.stop()
+ self.source.byte_offset = 0
+ self._playing = False
+ self._clearing = True
+
+ self._audiodata_buffer = None
+ del self._events[:]
+ self._update_play_cursor()
+
+ self.refill(self.ideal_buffer_size)
+
+ def _update_play_cursor(self):
+ with self._lock:
+ assert self.driver is not None
+ assert self.source is not None
+
+ self._handle_processed_buffers()
+
+ # Update play cursor using buffer cursor + estimate into current
+ # buffer
+ with self.driver:
+ if self._clearing:
+ self._play_cursor = self._buffer_cursor
+ else:
+ self._play_cursor = self._buffer_cursor + self.source.byte_offset
+ assert self._check_cursors()
+
+ self._dispatch_events()
+
+ def _handle_processed_buffers(self):
+ with self._lock:
+ with self.driver:
+ processed = self.source.unqueue_buffers()
+
+ if processed > 0:
+ if (len(self._buffer_timestamps) == processed
+ and self._buffer_timestamps[-1] is not None):
+ assert _debug_media('OpenALAudioPlayer: Underrun')
+ # Underrun, take note of timestamp.
+ # We check that the timestamp is not None, because otherwise
+ # our source could have been cleared.
+ self._underrun_timestamp = \
+ self._buffer_timestamps[-1] + \
+ self._buffer_sizes[-1] / \
+ float(self.source_group.audio_format.bytes_per_second)
+ self._update_buffer_cursor(processed)
+
+ return processed
+
+ def _update_buffer_cursor(self, processed):
+ self._buffer_cursor += sum(self._buffer_sizes[:processed])
+ del self._buffer_sizes[:processed]
+ del self._buffer_timestamps[:processed]
+
+ def _dispatch_events(self):
+ with self._lock:
+ while self._events and self._events[0][0] <= self._play_cursor:
+ _, event = self._events.pop(0)
+ event._sync_dispatch_to_player(self.player)
+
+ def get_write_size(self):
+ with self._lock:
+ self._update_play_cursor()
+ buffer_size = int(self._write_cursor - self._play_cursor)
+
+ # Only write when current buffer size is smaller than ideal
+ write_size = max(self.ideal_buffer_size - buffer_size, 0)
+
+ assert _debug_media("Write size {} bytes".format(write_size))
+ return write_size
+
+ def refill(self, write_size):
+ assert _debug_media('refill', write_size)
+
+ with self._lock:
+
+ while write_size > self.min_buffer_size:
+ audio_data = self._get_audiodata()
+
+ if audio_data is None:
+ break
+
+ length = min(write_size, audio_data.length)
+ assert _debug_media('Writing {} bytes'.format(length))
+ self._queue_audio_data(audio_data, length)
+ write_size -= length
+
+ # Check for underrun stopping playback
+ with self.driver:
+ if self._playing and not self.source.is_playing:
+ assert _debug_media('underrun')
+ self.source.play()
+
+ def _get_audiodata(self):
+ if self._audiodata_buffer is None or self._audiodata_buffer.length == 0:
+ self._get_new_audiodata()
+
+ return self._audiodata_buffer
+
+ def _get_new_audiodata(self):
+ assert _debug_media('Getting new audio data buffer.')
+ self._audiodata_buffer= self.source_group.get_audio_data(self.ideal_buffer_size)
+
+ if self._audiodata_buffer is not None:
+ assert _debug_media('New audio data available: {} bytes'.format(self._audiodata_buffer.length))
+ self._queue_events(self._audiodata_buffer)
+ else:
+ assert _debug_media('No audio data left')
+ if self._has_underrun():
+ assert _debug_media('Underrun')
+ MediaEvent(0, 'on_eos')._sync_dispatch_to_player(self.player)
+ MediaEvent(0, 'on_source_group_eos')._sync_dispatch_to_player(self.player)
+
+ def _queue_audio_data(self, audio_data, length):
+ with self.driver:
+ buf = self.source.get_buffer()
+ buf.data(audio_data, self.source_group.audio_format, length)
+ self.source.queue_buffer(buf)
+ self._update_write_cursor(audio_data, length)
+
+ def _update_write_cursor(self, audio_data, length):
+ self._write_cursor += length
+ self._buffer_sizes.append(length)
+ self._buffer_timestamps.append(audio_data.timestamp)
+ audio_data.consume(length, self.source_group.audio_format)
+ assert self._check_cursors()
+
+ def _queue_events(self, audio_data):
+ for event in audio_data.events:
+ cursor = self._write_cursor + event.timestamp * \
+ self.source_group.audio_format.bytes_per_second
+ self._events.append((cursor, event))
+
+ def _has_underrun(self):
+ with self.driver:
+ return self.source.buffers_queued == 0
+
+ def get_time(self):
+ with self._lock:
+ # Update first, might remove buffers
+ self._update_play_cursor()
+
+ if not self._buffer_timestamps:
+ timestamp = self._underrun_timestamp
+ assert _debug_media('OpenALAudioPlayer: Return underrun timestamp')
+ else:
+ timestamp = self._buffer_timestamps[0]
+ assert _debug_media('OpenALAudioPlayer: Buffer timestamp: {}'.format(timestamp))
+
+ if timestamp is not None:
+ timestamp += ((self._play_cursor - self._buffer_cursor) /
+ float(self.source_group.audio_format.bytes_per_second))
+
+ assert _debug_media('OpenALAudioPlayer: get_time = {}'.format(timestamp))
+
+ return timestamp
+
+ def _check_cursors(self):
+ assert self._play_cursor >= 0
+ assert self._buffer_cursor >= 0
+ assert self._write_cursor >= 0
+ assert self._buffer_cursor <= self._play_cursor
+ assert self._play_cursor <= self._write_cursor
+ assert _debug_media('Buffer[{}], Play[{}], Write[{}]'.format(self._buffer_cursor,
+ self._play_cursor,
+ self._write_cursor))
+ return True # Return true so it can be called in an assert (and optimized out)
+
+ def set_volume(self, volume):
+ with self.driver:
+ self.source.gain = volume
+
+ def set_position(self, position):
+ with self.driver:
+ self.source.position = position
+
+ def set_min_distance(self, min_distance):
+ with self.driver:
+ self.source.reference_distance = min_distance
+
+ def set_max_distance(self, max_distance):
+ with self.driver:
+ self.source.max_distance = max_distance
+
+ def set_pitch(self, pitch):
+ with self.driver:
+ self.source.pitch = pitch
+
+ def set_cone_orientation(self, cone_orientation):
+ with self.driver:
+ self.source.direction = cone_orientation
+
+ def set_cone_inner_angle(self, cone_inner_angle):
+ with self.driver:
+ self.source.cone_inner_angle = cone_inner_angle
+
+ def set_cone_outer_angle(self, cone_outer_angle):
+ with self.driver:
+ self.source.cone_outer_angle = cone_outer_angle
+
+ def set_cone_outer_gain(self, cone_outer_gain):
+ with self.driver:
+ self.source.cone_outer_gain = cone_outer_gain
+
+
+class OpenALAudioPlayer10(OpenALAudioPlayer11):
+ """Player compatible with OpenAL version 1.0. This version needs to interpolate
+ timestamps."""
+ def __init__(self, driver, source_group, player):
+ super(OpenALAudioPlayer10, self).__init__(driver, source_group, player)
+
+ # OpenAL 1.0 timestamp interpolation: system time of current buffer
+ # playback (best guess)
+ self._buffer_system_time = time.time()
+
+ def play(self):
+ with self._lock:
+ super(OpenALAudioPlayer10, self).play()
+ self._buffer_system_time = time.time()
+
+ def _update_play_cursor(self):
+ with self._lock:
+ assert self.driver is not None
+ assert self.source is not None
+
+ self._handle_processed_buffers()
+
+ # Interpolate system time past buffer timestamp
+ self._play_cursor = \
+ self._buffer_cursor + int(
+ (time.time() - self._buffer_system_time) * \
+ self.source_group.audio_format.bytes_per_second)
+ assert self._check_cursors()
+ assert _debug_media('Play cursor at {} bytes'.format(self._play_cursor))
+
+ self._dispatch_events()
+
+ def _handle_processed_buffers(self):
+ with self._lock:
+ processed = super(OpenALAudioPlayer10, self)._handle_processed_buffers()
+ if processed > 0:
+ self._buffer_system_time = time.time()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/openal/interface.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/openal/interface.py
new file mode 100644
index 0000000..2c2ce60
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/openal/interface.py
@@ -0,0 +1,534 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+# $Id$
+from __future__ import print_function
+from __future__ import absolute_import
+from builtins import str
+
+import ctypes
+from collections import defaultdict, namedtuple
+
+from . import lib_openal as al
+from . import lib_alc as alc
+import pyglet
+from pyglet.debug import debug_print
+from pyglet.media.exceptions import MediaException
+
+_debug_media = debug_print('debug_media')
+
+
+class OpenALException(MediaException):
+ def __init__(self, message=None, error_code=None, error_string=None):
+ self.message = message
+ self.error_code = error_code
+ self.error_string = error_string
+
+ def __str__(self):
+ if self.error_code is None:
+ return 'OpenAL Exception: {}'.format(self.message)
+ else:
+ return 'OpenAL Exception [{}: {}]: {}'.format(self.error_code,
+ self.error_string,
+ self.message)
+
+class OpenALObject(object):
+ """Base class for OpenAL objects."""
+ @classmethod
+ def _check_error(cls, message=None):
+ """Check whether there is an OpenAL error and raise exception if present."""
+ error_code = al.alGetError()
+ if error_code != 0:
+ error_string = al.alGetString(error_code)
+ #TODO: Fix return type in generated code?
+ error_string = ctypes.cast(error_string, ctypes.c_char_p)
+ raise OpenALException(message=message,
+ error_code=error_code,
+ error_string=str(error_string.value))
+
+ @classmethod
+ def _raise_error(cls, message):
+ """Raise an exception. Try to check for OpenAL error code too."""
+ cls._check_error(message)
+ raise OpenALException(message)
+
+
+class OpenALDevice(OpenALObject):
+ """OpenAL audio device."""
+ def __init__(self, device_name=None):
+ self._al_device = alc.alcOpenDevice(device_name)
+ self.check_context_error('Failed to open device.')
+ if self._al_device is None:
+ raise OpenALException('No OpenAL devices.')
+
+ def __del__(self):
+ self.delete()
+
+ def delete(self):
+ if self._al_device is not None:
+ if alc.alcCloseDevice(self._al_device) == alc.ALC_FALSE:
+ self._raise_context_error('Failed to close device.')
+ self._al_device = None
+
+ @property
+ def is_ready(self):
+ return self._al_device is not None
+
+ def create_context(self):
+ al_context = alc.alcCreateContext(self._al_device, None)
+ self.check_context_error('Failed to create context')
+ return OpenALContext(self, al_context)
+
+ def get_version(self):
+ major = alc.ALCint()
+ minor = alc.ALCint()
+ alc.alcGetIntegerv(self._al_device, alc.ALC_MAJOR_VERSION,
+ ctypes.sizeof(major), major)
+ self.check_context_error('Failed to get version.')
+ alc.alcGetIntegerv(self._al_device, alc.ALC_MINOR_VERSION,
+ ctypes.sizeof(minor), minor)
+ self.check_context_error('Failed to get version.')
+ return major.value, minor.value
+
+ def get_extensions(self):
+ extensions = alc.alcGetString(self._al_device, alc.ALC_EXTENSIONS)
+ self.check_context_error('Failed to get extensions.')
+ if pyglet.compat_platform == 'darwin' or pyglet.compat_platform.startswith('linux'):
+ return [x.decode('ascii')
+ for x
+ in ctypes.cast(extensions, ctypes.c_char_p).value.split(b' ')]
+ else:
+ return self._split_nul_strings(extensions)
+
+ @staticmethod
+ def _split_nul_strings(s):
+ # NUL-separated list of strings, double-NUL-terminated.
+ nul = False
+ i = 0
+ while True:
+ if s[i] == b'\0':
+ if nul:
+ break
+ else:
+ nul = True
+ else:
+ nul = False
+ i += 1
+ s = s[:i - 1]
+ return filter(None, [ss.strip().decode('ascii') for ss in s.split(b'\0')])
+
+ def check_context_error(self, message=None):
+ """Check whether there is an OpenAL error and raise exception if present."""
+ error_code = alc.alcGetError(self._al_device)
+ if error_code != 0:
+ error_string = alc.alcGetString(self._al_device, error_code)
+ #TODO: Fix return type in generated code?
+ error_string = ctypes.cast(error_string, ctypes.c_char_p)
+ raise OpenALException(message=message,
+ error_code=error_code,
+ error_string=str(error_string.value))
+
+ def _raise_context_error(self, message):
+ """Raise an exception. Try to check for OpenAL error code too."""
+ self.check_context_error(message)
+ raise OpenALException(message)
+
+
+class OpenALContext(OpenALObject):
+ def __init__(self, device, al_context):
+ self.device = device
+ self._al_context = al_context
+ self.make_current()
+
+ def __del__(self):
+ self.delete()
+
+ def delete(self):
+ if self._al_context is not None:
+ # TODO: Check if this context is current
+ alc.alcMakeContextCurrent(None)
+ self.device.check_context_error('Failed to make context no longer current.')
+ alc.alcDestroyContext(self._al_context)
+ self.device.check_context_error('Failed to destroy context.')
+ self._al_context = None
+
+ def make_current(self):
+ alc.alcMakeContextCurrent(self._al_context)
+ self.device.check_context_error('Failed to make context current.')
+
+ def create_source(self):
+ self.make_current()
+ return OpenALSource(self)
+
+
+class OpenALSource(OpenALObject):
+ def __init__(self, context):
+ self.context = context
+ self.buffer_pool = OpenALBufferPool(context)
+
+ self._al_source = al.ALuint()
+ al.alGenSources(1, self._al_source)
+ self._check_error('Failed to create source.')
+
+ self._state = None
+ self._get_state()
+
+ self._owned_buffers = {}
+
+ def __del__(self):
+ self.delete()
+
+ def delete(self):
+ if self._al_source is not None:
+ al.alDeleteSources(1, self._al_source)
+ self._check_error('Failed to delete source.')
+ # TODO: delete buffers in use
+ self.buffer_pool.clear()
+ self._al_source = None
+
+ @property
+ def is_initial(self):
+ self._get_state()
+ return self._state == al.AL_INITIAL
+
+ @property
+ def is_playing(self):
+ self._get_state()
+ return self._state == al.AL_PLAYING
+
+ @property
+ def is_paused(self):
+ self._get_state()
+ return self._state == al.AL_PAUSED
+
+ @property
+ def is_stopped(self):
+ self._get_state()
+ return self._state == al.AL_STOPPED
+
+ def _int_source_property(attribute):
+ return property(lambda self: self._get_int(attribute),
+ lambda self, value: self._set_int(attribute, value))
+
+ def _float_source_property(attribute):
+ return property(lambda self: self._get_float(attribute),
+ lambda self, value: self._set_float(attribute, value))
+
+ def _3floats_source_property(attribute):
+ return property(lambda self: self._get_3floats(attribute),
+ lambda self, value: self._set_3floats(attribute, value))
+
+ position = _3floats_source_property(al.AL_POSITION)
+ velocity = _3floats_source_property(al.AL_VELOCITY)
+ gain = _float_source_property(al.AL_GAIN)
+ buffers_queued = _int_source_property(al.AL_BUFFERS_QUEUED)
+ buffers_processed = _int_source_property(al.AL_BUFFERS_PROCESSED)
+ min_gain = _float_source_property(al.AL_MIN_GAIN)
+ max_gain = _float_source_property(al.AL_MAX_GAIN)
+ reference_distance = _float_source_property(al.AL_REFERENCE_DISTANCE)
+ rolloff_factor = _float_source_property(al.AL_ROLLOFF_FACTOR)
+ pitch = _float_source_property(al.AL_PITCH)
+ max_distance = _float_source_property(al.AL_MAX_DISTANCE)
+ direction = _3floats_source_property(al.AL_DIRECTION)
+ cone_inner_angle =_float_source_property(al.AL_CONE_INNER_ANGLE)
+ cone_outer_angle = _float_source_property(al.AL_CONE_OUTER_ANGLE)
+ cone_outer_gain = _float_source_property(al.AL_CONE_OUTER_GAIN)
+ sec_offset = _float_source_property(al.AL_SEC_OFFSET)
+ sample_offset = _float_source_property(al.AL_SAMPLE_OFFSET)
+ byte_offset = _float_source_property(al.AL_BYTE_OFFSET)
+
+ del _int_source_property
+ del _float_source_property
+ del _3floats_source_property
+
+ def play(self):
+ al.alSourcePlay(self._al_source)
+ self._check_error('Failed to play source.')
+
+ def pause(self):
+ al.alSourcePause(self._al_source)
+ self._check_error('Failed to pause source.')
+
+ def stop(self):
+ al.alSourceStop(self._al_source)
+ self._check_error('Failed to stop source.')
+
+ def get_buffer(self):
+ return self.buffer_pool.get_buffer()
+
+ def queue_buffer(self, buf):
+ assert buf.is_valid
+ al.alSourceQueueBuffers(self._al_source, 1, ctypes.byref(buf.al_buffer))
+ self._check_error('Failed to queue buffer.')
+ self._add_buffer(buf)
+
+ def unqueue_buffers(self):
+ processed = self.buffers_processed
+ assert _debug_media("Processed buffer count: {}".format(processed))
+ if processed > 0:
+ buffers = (al.ALuint * processed)()
+ al.alSourceUnqueueBuffers(self._al_source, len(buffers), buffers)
+ self._check_error('Failed to unqueue buffers from source.')
+ for buf in buffers:
+ self.buffer_pool.unqueue_buffer(self._pop_buffer(buf))
+ return processed
+
+ def _get_state(self):
+ if self._al_source is not None:
+ self._state = self._get_int(al.AL_SOURCE_STATE)
+
+ def _get_int(self, key):
+ assert self._al_source is not None
+ al_int = al.ALint()
+ al.alGetSourcei(self._al_source, key, al_int)
+ self._check_error('Failed to get value')
+ return al_int.value
+
+ def _set_int(self, key, value):
+ assert self._al_source is not None
+ al.alSourcei(self._al_source, key, int(value))
+ self._check_error('Failed to set value.')
+
+ def _get_float(self, key):
+ assert self._al_source is not None
+ al_float = al.ALfloat()
+ al.alGetSourcef(self._al_source, key, al_float)
+ self._check_error('Failed to get value')
+ return al_float.value
+
+ def _set_float(self, key, value):
+ assert self._al_source is not None
+ al.alSourcef(self._al_source, key, float(value))
+ self._check_error('Failed to set value.')
+
+ def _get_3floats(self, key):
+ assert self._al_source is not None
+ x = al.ALfloat()
+ y = al.ALfloat()
+ z = al.ALfloat()
+ al.alGetSource3f(self._al_source, key, x, y, z)
+ self._check_error('Failed to get value')
+ return x.value, y.value, z.value
+
+ def _set_3floats(self, key, values):
+ assert self._al_source is not None
+ x, y, z = map(float, values)
+ al.alSource3f(self._al_source, key, x, y, z)
+ self._check_error('Failed to set value.')
+
+ def _add_buffer(self, buf):
+ self._owned_buffers[buf.name] = buf
+
+ def _pop_buffer(self, al_buffer):
+ buf = self._owned_buffers.pop(al_buffer, None)
+ assert buf is not None
+ return buf
+
+
+OpenALOrientation = namedtuple("OpenALOrientation", ['at', 'up'])
+
+
+class OpenALListener(OpenALObject):
+ def _float_source_property(attribute):
+ return property(lambda self: self._get_float(attribute),
+ lambda self, value: self._set_float(attribute, value))
+
+ def _3floats_source_property(attribute):
+ return property(lambda self: self._get_3floats(attribute),
+ lambda self, value: self._set_3floats(attribute, value))
+
+ position = _3floats_source_property(al.AL_POSITION)
+ velocity = _3floats_source_property(al.AL_VELOCITY)
+ gain = _float_source_property(al.AL_GAIN)
+
+ @property
+ def orientation(self):
+ values = self._get_float_vector(al.AL_ORIENTATION, 6)
+ return OpenALOrientation(values[0:3], values[3:6])
+
+ @orientation.setter
+ def orientation(self, values):
+ if len(values) == 2:
+ actual_values = values[0] + values[1]
+ elif len(values) == 6:
+ actual_values = values
+ else:
+ actual_values = []
+ if len(actual_values) != 6:
+ raise ValueError("Need 2 tuples of 3 or 1 tuple of 6.")
+ self._set_float_vector(al.AL_ORIENTATION, actual_values)
+
+
+ def _get_float(self, key):
+ al_float = al.ALfloat()
+ al.alGetListenerf(key, al_float)
+ self._check_error('Failed to get value')
+ return al_float.value
+
+ def _set_float(self, key, value):
+ al.alListenerf(key, float(value))
+ self._check_error('Failed to set value.')
+
+ def _get_3floats(self, key):
+ x = al.ALfloat()
+ y = al.ALfloat()
+ z = al.ALfloat()
+ al.alGetListener3f(key, x, y, z)
+ self._check_error('Failed to get value')
+ return x.value, y.value, z.value
+
+ def _set_3floats(self, key, values):
+ x, y, z = map(float, values)
+ al.alListener3f(key, x, y, z)
+ self._check_error('Failed to set value.')
+
+ def _get_float_vector(self, key, count):
+ al_float_vector = (al.ALfloat * count)()
+ al.alGetListenerfv(key, al_float_vector)
+ self._check_error('Failed to get value')
+ return [x for x in al_float_vector]
+
+ def _set_float_vector(self, key, values):
+ al_float_vector = (al.ALfloat * len(values))(*values)
+ al.alListenerfv(key, al_float_vector)
+ self._check_error('Failed to set value.')
+
+
+class OpenALBuffer(OpenALObject):
+ _format_map = {
+ (1, 8): al.AL_FORMAT_MONO8,
+ (1, 16): al.AL_FORMAT_MONO16,
+ (2, 8): al.AL_FORMAT_STEREO8,
+ (2, 16): al.AL_FORMAT_STEREO16,
+ }
+
+ def __init__(self, al_buffer, context):
+ self._al_buffer = al_buffer
+ self.context = context
+ assert self.is_valid
+
+ def __del__(self):
+ self.delete()
+
+ @property
+ def is_valid(self):
+ self._check_error('Before validate buffer.')
+ if self._al_buffer is None:
+ return False
+ valid = bool(al.alIsBuffer(self._al_buffer))
+ if not valid:
+ # Clear possible error due to invalid buffer
+ al.alGetError()
+ return valid
+
+ @property
+ def al_buffer(self):
+ assert self.is_valid
+ return self._al_buffer
+
+ @property
+ def name(self):
+ assert self.is_valid
+ return self._al_buffer.value
+
+ def delete(self):
+ if self.is_valid:
+ al.alDeleteBuffers(1, ctypes.byref(self._al_buffer))
+ self._check_error('Error deleting buffer.')
+ self._al_buffer = None
+
+ def data(self, audio_data, audio_format, length=None):
+ assert self.is_valid
+ length = length or audio_data.length
+ al_format = self._format_map[(audio_format.channels, audio_format.sample_size)]
+ al.alBufferData(self._al_buffer,
+ al_format,
+ audio_data.data,
+ length,
+ audio_format.sample_rate)
+ self._check_error('Failed to add data to buffer.')
+
+
+class OpenALBufferPool(OpenALObject):
+ """At least Mac OS X doesn't free buffers when a source is deleted; it just
+ detaches them from the source. So keep our own recycled queue.
+ """
+ def __init__(self, context):
+ self.context = context
+ self._buffers = [] # list of free buffer names
+
+ def __del__(self):
+ self.clear()
+
+ def __len__(self):
+ return len(self._buffers)
+
+ def clear(self):
+ while self._buffers:
+ self._buffers.pop().delete()
+
+ def get_buffer(self):
+ """Convenience for returning one buffer name"""
+ return self.get_buffers(1)[0]
+
+ def get_buffers(self, number):
+ """Returns an array containing `number` buffer names. The returned list must
+ not be modified in any way, and may get changed by subsequent calls to
+ get_buffers.
+ """
+ buffers = []
+ while number > 0:
+ if self._buffers:
+ b = self._buffers.pop()
+ else:
+ b = self.create_buffer()
+ if b.is_valid:
+ # Protect against implementations that DO free buffers
+ # when they delete a source - carry on.
+ buffers.append(b)
+ number -= 1
+
+ return buffers
+
+ def unqueue_buffer(self, buf):
+ """A buffer has finished playing, free it."""
+ if buf.is_valid:
+ self._buffers.append(buf)
+
+ def create_buffer(self):
+ """Create a new buffer."""
+ al_buffer = al.ALuint()
+ al.alGenBuffers(1, al_buffer)
+ self._check_error('Error allocating buffer.')
+ return OpenALBuffer(al_buffer, self.context)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/openal/lib_alc.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/openal/lib_alc.py
new file mode 100644
index 0000000..0bbe3d3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/openal/lib_alc.py
@@ -0,0 +1,286 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+'''Wrapper for openal
+
+Generated with:
+../tools/wraptypes/wrap.py /usr/include/AL/alc.h -lopenal -olib_alc.py
+
+.. Hacked to fix ALCvoid argtypes.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import ctypes
+from ctypes import *
+import sys
+
+import pyglet.lib
+
+_lib = pyglet.lib.load_library('openal', win32='openal32',
+ framework='/System/Library/Frameworks/OpenAL.framework')
+
+_int_types = (c_int16, c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (ctypes.c_int64,)
+for t in _int_types:
+ if sizeof(t) == sizeof(c_size_t):
+ c_ptrdiff_t = t
+
+class c_void(Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', c_int)]
+
+
+
+ALC_API = 0 # /usr/include/AL/alc.h:19
+ALCAPI = 0 # /usr/include/AL/alc.h:37
+ALC_INVALID = 0 # /usr/include/AL/alc.h:39
+ALC_VERSION_0_1 = 1 # /usr/include/AL/alc.h:42
+class struct_ALCdevice_struct(Structure):
+ __slots__ = [
+ ]
+struct_ALCdevice_struct._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_ALCdevice_struct(Structure):
+ __slots__ = [
+ ]
+struct_ALCdevice_struct._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+ALCdevice = struct_ALCdevice_struct # /usr/include/AL/alc.h:44
+class struct_ALCcontext_struct(Structure):
+ __slots__ = [
+ ]
+struct_ALCcontext_struct._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_ALCcontext_struct(Structure):
+ __slots__ = [
+ ]
+struct_ALCcontext_struct._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+ALCcontext = struct_ALCcontext_struct # /usr/include/AL/alc.h:45
+ALCboolean = c_char # /usr/include/AL/alc.h:49
+ALCchar = c_char # /usr/include/AL/alc.h:52
+ALCbyte = c_char # /usr/include/AL/alc.h:55
+ALCubyte = c_ubyte # /usr/include/AL/alc.h:58
+ALCshort = c_short # /usr/include/AL/alc.h:61
+ALCushort = c_ushort # /usr/include/AL/alc.h:64
+ALCint = c_int # /usr/include/AL/alc.h:67
+ALCuint = c_uint # /usr/include/AL/alc.h:70
+ALCsizei = c_int # /usr/include/AL/alc.h:73
+ALCenum = c_int # /usr/include/AL/alc.h:76
+ALCfloat = c_float # /usr/include/AL/alc.h:79
+ALCdouble = c_double # /usr/include/AL/alc.h:82
+ALCvoid = None # /usr/include/AL/alc.h:85
+ALC_FALSE = 0 # /usr/include/AL/alc.h:91
+ALC_TRUE = 1 # /usr/include/AL/alc.h:94
+ALC_FREQUENCY = 4103 # /usr/include/AL/alc.h:99
+ALC_REFRESH = 4104 # /usr/include/AL/alc.h:104
+ALC_SYNC = 4105 # /usr/include/AL/alc.h:109
+ALC_MONO_SOURCES = 4112 # /usr/include/AL/alc.h:114
+ALC_STEREO_SOURCES = 4113 # /usr/include/AL/alc.h:119
+ALC_NO_ERROR = 0 # /usr/include/AL/alc.h:128
+ALC_INVALID_DEVICE = 40961 # /usr/include/AL/alc.h:133
+ALC_INVALID_CONTEXT = 40962 # /usr/include/AL/alc.h:138
+ALC_INVALID_ENUM = 40963 # /usr/include/AL/alc.h:143
+ALC_INVALID_VALUE = 40964 # /usr/include/AL/alc.h:148
+ALC_OUT_OF_MEMORY = 40965 # /usr/include/AL/alc.h:153
+ALC_DEFAULT_DEVICE_SPECIFIER = 4100 # /usr/include/AL/alc.h:159
+ALC_DEVICE_SPECIFIER = 4101 # /usr/include/AL/alc.h:160
+ALC_EXTENSIONS = 4102 # /usr/include/AL/alc.h:161
+ALC_MAJOR_VERSION = 4096 # /usr/include/AL/alc.h:163
+ALC_MINOR_VERSION = 4097 # /usr/include/AL/alc.h:164
+ALC_ATTRIBUTES_SIZE = 4098 # /usr/include/AL/alc.h:166
+ALC_ALL_ATTRIBUTES = 4099 # /usr/include/AL/alc.h:167
+ALC_CAPTURE_DEVICE_SPECIFIER = 784 # /usr/include/AL/alc.h:172
+ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER = 785 # /usr/include/AL/alc.h:173
+ALC_CAPTURE_SAMPLES = 786 # /usr/include/AL/alc.h:174
+# /usr/include/AL/alc.h:180
+alcCreateContext = _lib.alcCreateContext
+alcCreateContext.restype = POINTER(ALCcontext)
+alcCreateContext.argtypes = [POINTER(ALCdevice), POINTER(ALCint)]
+
+# /usr/include/AL/alc.h:182
+alcMakeContextCurrent = _lib.alcMakeContextCurrent
+alcMakeContextCurrent.restype = ALCboolean
+alcMakeContextCurrent.argtypes = [POINTER(ALCcontext)]
+
+# /usr/include/AL/alc.h:184
+alcProcessContext = _lib.alcProcessContext
+alcProcessContext.restype = None
+alcProcessContext.argtypes = [POINTER(ALCcontext)]
+
+# /usr/include/AL/alc.h:186
+alcSuspendContext = _lib.alcSuspendContext
+alcSuspendContext.restype = None
+alcSuspendContext.argtypes = [POINTER(ALCcontext)]
+
+# /usr/include/AL/alc.h:188
+alcDestroyContext = _lib.alcDestroyContext
+alcDestroyContext.restype = None
+alcDestroyContext.argtypes = [POINTER(ALCcontext)]
+
+# /usr/include/AL/alc.h:190
+alcGetCurrentContext = _lib.alcGetCurrentContext
+alcGetCurrentContext.restype = POINTER(ALCcontext)
+alcGetCurrentContext.argtypes = []
+
+# /usr/include/AL/alc.h:192
+alcGetContextsDevice = _lib.alcGetContextsDevice
+alcGetContextsDevice.restype = POINTER(ALCdevice)
+alcGetContextsDevice.argtypes = [POINTER(ALCcontext)]
+
+# /usr/include/AL/alc.h:198
+alcOpenDevice = _lib.alcOpenDevice
+alcOpenDevice.restype = POINTER(ALCdevice)
+alcOpenDevice.argtypes = [POINTER(ALCchar)]
+
+# /usr/include/AL/alc.h:200
+alcCloseDevice = _lib.alcCloseDevice
+alcCloseDevice.restype = ALCboolean
+alcCloseDevice.argtypes = [POINTER(ALCdevice)]
+
+# /usr/include/AL/alc.h:207
+alcGetError = _lib.alcGetError
+alcGetError.restype = ALCenum
+alcGetError.argtypes = [POINTER(ALCdevice)]
+
+# /usr/include/AL/alc.h:215
+alcIsExtensionPresent = _lib.alcIsExtensionPresent
+alcIsExtensionPresent.restype = ALCboolean
+alcIsExtensionPresent.argtypes = [POINTER(ALCdevice), POINTER(ALCchar)]
+
+# /usr/include/AL/alc.h:217
+alcGetProcAddress = _lib.alcGetProcAddress
+alcGetProcAddress.restype = POINTER(c_void)
+alcGetProcAddress.argtypes = [POINTER(ALCdevice), POINTER(ALCchar)]
+
+# /usr/include/AL/alc.h:219
+alcGetEnumValue = _lib.alcGetEnumValue
+alcGetEnumValue.restype = ALCenum
+alcGetEnumValue.argtypes = [POINTER(ALCdevice), POINTER(ALCchar)]
+
+# /usr/include/AL/alc.h:225
+alcGetString = _lib.alcGetString
+alcGetString.restype = POINTER(ALCchar)
+alcGetString.argtypes = [POINTER(ALCdevice), ALCenum]
+
+# /usr/include/AL/alc.h:227
+alcGetIntegerv = _lib.alcGetIntegerv
+alcGetIntegerv.restype = None
+alcGetIntegerv.argtypes = [POINTER(ALCdevice), ALCenum, ALCsizei, POINTER(ALCint)]
+
+# /usr/include/AL/alc.h:233
+alcCaptureOpenDevice = _lib.alcCaptureOpenDevice
+alcCaptureOpenDevice.restype = POINTER(ALCdevice)
+alcCaptureOpenDevice.argtypes = [POINTER(ALCchar), ALCuint, ALCenum, ALCsizei]
+
+# /usr/include/AL/alc.h:235
+alcCaptureCloseDevice = _lib.alcCaptureCloseDevice
+alcCaptureCloseDevice.restype = ALCboolean
+alcCaptureCloseDevice.argtypes = [POINTER(ALCdevice)]
+
+# /usr/include/AL/alc.h:237
+alcCaptureStart = _lib.alcCaptureStart
+alcCaptureStart.restype = None
+alcCaptureStart.argtypes = [POINTER(ALCdevice)]
+
+# /usr/include/AL/alc.h:239
+alcCaptureStop = _lib.alcCaptureStop
+alcCaptureStop.restype = None
+alcCaptureStop.argtypes = [POINTER(ALCdevice)]
+
+# /usr/include/AL/alc.h:241
+alcCaptureSamples = _lib.alcCaptureSamples
+alcCaptureSamples.restype = None
+alcCaptureSamples.argtypes = [POINTER(ALCdevice), POINTER(ALCvoid), ALCsizei]
+
+LPALCCREATECONTEXT = CFUNCTYPE(POINTER(ALCcontext), POINTER(ALCdevice), POINTER(ALCint)) # /usr/include/AL/alc.h:246
+LPALCMAKECONTEXTCURRENT = CFUNCTYPE(ALCboolean, POINTER(ALCcontext)) # /usr/include/AL/alc.h:247
+LPALCPROCESSCONTEXT = CFUNCTYPE(None, POINTER(ALCcontext)) # /usr/include/AL/alc.h:248
+LPALCSUSPENDCONTEXT = CFUNCTYPE(None, POINTER(ALCcontext)) # /usr/include/AL/alc.h:249
+LPALCDESTROYCONTEXT = CFUNCTYPE(None, POINTER(ALCcontext)) # /usr/include/AL/alc.h:250
+LPALCGETCURRENTCONTEXT = CFUNCTYPE(POINTER(ALCcontext)) # /usr/include/AL/alc.h:251
+LPALCGETCONTEXTSDEVICE = CFUNCTYPE(POINTER(ALCdevice), POINTER(ALCcontext)) # /usr/include/AL/alc.h:252
+LPALCOPENDEVICE = CFUNCTYPE(POINTER(ALCdevice), POINTER(ALCchar)) # /usr/include/AL/alc.h:253
+LPALCCLOSEDEVICE = CFUNCTYPE(ALCboolean, POINTER(ALCdevice)) # /usr/include/AL/alc.h:254
+LPALCGETERROR = CFUNCTYPE(ALCenum, POINTER(ALCdevice)) # /usr/include/AL/alc.h:255
+LPALCISEXTENSIONPRESENT = CFUNCTYPE(ALCboolean, POINTER(ALCdevice), POINTER(ALCchar)) # /usr/include/AL/alc.h:256
+LPALCGETPROCADDRESS = CFUNCTYPE(POINTER(c_void), POINTER(ALCdevice), POINTER(ALCchar)) # /usr/include/AL/alc.h:257
+LPALCGETENUMVALUE = CFUNCTYPE(ALCenum, POINTER(ALCdevice), POINTER(ALCchar)) # /usr/include/AL/alc.h:258
+LPALCGETSTRING = CFUNCTYPE(POINTER(ALCchar), POINTER(ALCdevice), ALCenum) # /usr/include/AL/alc.h:259
+LPALCGETINTEGERV = CFUNCTYPE(None, POINTER(ALCdevice), ALCenum, ALCsizei, POINTER(ALCint)) # /usr/include/AL/alc.h:260
+LPALCCAPTUREOPENDEVICE = CFUNCTYPE(POINTER(ALCdevice), POINTER(ALCchar), ALCuint, ALCenum, ALCsizei) # /usr/include/AL/alc.h:261
+LPALCCAPTURECLOSEDEVICE = CFUNCTYPE(ALCboolean, POINTER(ALCdevice)) # /usr/include/AL/alc.h:262
+LPALCCAPTURESTART = CFUNCTYPE(None, POINTER(ALCdevice)) # /usr/include/AL/alc.h:263
+LPALCCAPTURESTOP = CFUNCTYPE(None, POINTER(ALCdevice)) # /usr/include/AL/alc.h:264
+LPALCCAPTURESAMPLES = CFUNCTYPE(None, POINTER(ALCdevice), POINTER(ALCvoid), ALCsizei) # /usr/include/AL/alc.h:265
+
+__all__ = ['ALC_API', 'ALCAPI', 'ALC_INVALID', 'ALC_VERSION_0_1', 'ALCdevice',
+'ALCcontext', 'ALCboolean', 'ALCchar', 'ALCbyte', 'ALCubyte', 'ALCshort',
+'ALCushort', 'ALCint', 'ALCuint', 'ALCsizei', 'ALCenum', 'ALCfloat',
+'ALCdouble', 'ALCvoid', 'ALC_FALSE', 'ALC_TRUE', 'ALC_FREQUENCY',
+'ALC_REFRESH', 'ALC_SYNC', 'ALC_MONO_SOURCES', 'ALC_STEREO_SOURCES',
+'ALC_NO_ERROR', 'ALC_INVALID_DEVICE', 'ALC_INVALID_CONTEXT',
+'ALC_INVALID_ENUM', 'ALC_INVALID_VALUE', 'ALC_OUT_OF_MEMORY',
+'ALC_DEFAULT_DEVICE_SPECIFIER', 'ALC_DEVICE_SPECIFIER', 'ALC_EXTENSIONS',
+'ALC_MAJOR_VERSION', 'ALC_MINOR_VERSION', 'ALC_ATTRIBUTES_SIZE',
+'ALC_ALL_ATTRIBUTES', 'ALC_CAPTURE_DEVICE_SPECIFIER',
+'ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER', 'ALC_CAPTURE_SAMPLES',
+'alcCreateContext', 'alcMakeContextCurrent', 'alcProcessContext',
+'alcSuspendContext', 'alcDestroyContext', 'alcGetCurrentContext',
+'alcGetContextsDevice', 'alcOpenDevice', 'alcCloseDevice', 'alcGetError',
+'alcIsExtensionPresent', 'alcGetProcAddress', 'alcGetEnumValue',
+'alcGetString', 'alcGetIntegerv', 'alcCaptureOpenDevice',
+'alcCaptureCloseDevice', 'alcCaptureStart', 'alcCaptureStop',
+'alcCaptureSamples', 'LPALCCREATECONTEXT', 'LPALCMAKECONTEXTCURRENT',
+'LPALCPROCESSCONTEXT', 'LPALCSUSPENDCONTEXT', 'LPALCDESTROYCONTEXT',
+'LPALCGETCURRENTCONTEXT', 'LPALCGETCONTEXTSDEVICE', 'LPALCOPENDEVICE',
+'LPALCCLOSEDEVICE', 'LPALCGETERROR', 'LPALCISEXTENSIONPRESENT',
+'LPALCGETPROCADDRESS', 'LPALCGETENUMVALUE', 'LPALCGETSTRING',
+'LPALCGETINTEGERV', 'LPALCCAPTUREOPENDEVICE', 'LPALCCAPTURECLOSEDEVICE',
+'LPALCCAPTURESTART', 'LPALCCAPTURESTOP', 'LPALCCAPTURESAMPLES']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/openal/lib_openal.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/openal/lib_openal.py
new file mode 100644
index 0000000..54a6321
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/openal/lib_openal.py
@@ -0,0 +1,655 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+'''Wrapper for openal
+
+Generated with:
+../tools/wraptypes/wrap.py /usr/include/AL/al.h -lopenal -olib_openal.py
+
+.. Hacked to remove non-existent library functions.
+
+TODO add alGetError check.
+
+.. alListener3i and alListeneriv are present in my OS X 10.4 but not another
+10.4 user's installation. They've also been removed for compatibility.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import ctypes
+from ctypes import *
+import sys
+
+import pyglet.lib
+
+_lib = pyglet.lib.load_library('openal', win32='openal32',
+ framework='/System/Library/Frameworks/OpenAL.framework')
+
+_int_types = (c_int16, c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (ctypes.c_int64,)
+for t in _int_types:
+ if sizeof(t) == sizeof(c_size_t):
+ c_ptrdiff_t = t
+
+class c_void(Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', c_int)]
+
+
+
+AL_API = 0 # /usr/include/AL/al.h:39
+ALAPI = 0 # /usr/include/AL/al.h:59
+AL_INVALID = -1 # /usr/include/AL/al.h:61
+AL_ILLEGAL_ENUM = 0 # /usr/include/AL/al.h:62
+AL_ILLEGAL_COMMAND = 0 # /usr/include/AL/al.h:63
+ALboolean = c_int # Better return type than c_char, as generated
+ALchar = c_char # /usr/include/AL/al.h:73
+ALbyte = c_char # /usr/include/AL/al.h:76
+ALubyte = c_ubyte # /usr/include/AL/al.h:79
+ALshort = c_short # /usr/include/AL/al.h:82
+ALushort = c_ushort # /usr/include/AL/al.h:85
+ALint = c_int # /usr/include/AL/al.h:88
+ALuint = c_uint # /usr/include/AL/al.h:91
+ALsizei = c_int # /usr/include/AL/al.h:94
+ALenum = c_int # /usr/include/AL/al.h:97
+ALfloat = c_float # /usr/include/AL/al.h:100
+ALdouble = c_double # /usr/include/AL/al.h:103
+ALvoid = None # /usr/include/AL/al.h:106
+AL_NONE = 0 # /usr/include/AL/al.h:112
+AL_FALSE = 0 # /usr/include/AL/al.h:115
+AL_TRUE = 1 # /usr/include/AL/al.h:118
+AL_SOURCE_RELATIVE = 514 # /usr/include/AL/al.h:121
+AL_CONE_INNER_ANGLE = 4097 # /usr/include/AL/al.h:130
+AL_CONE_OUTER_ANGLE = 4098 # /usr/include/AL/al.h:137
+AL_PITCH = 4099 # /usr/include/AL/al.h:145
+AL_POSITION = 4100 # /usr/include/AL/al.h:157
+AL_DIRECTION = 4101 # /usr/include/AL/al.h:160
+AL_VELOCITY = 4102 # /usr/include/AL/al.h:163
+AL_LOOPING = 4103 # /usr/include/AL/al.h:171
+AL_BUFFER = 4105 # /usr/include/AL/al.h:178
+AL_GAIN = 4106 # /usr/include/AL/al.h:191
+AL_MIN_GAIN = 4109 # /usr/include/AL/al.h:200
+AL_MAX_GAIN = 4110 # /usr/include/AL/al.h:209
+AL_ORIENTATION = 4111 # /usr/include/AL/al.h:216
+AL_SOURCE_STATE = 4112 # /usr/include/AL/al.h:221
+AL_INITIAL = 4113 # /usr/include/AL/al.h:222
+AL_PLAYING = 4114 # /usr/include/AL/al.h:223
+AL_PAUSED = 4115 # /usr/include/AL/al.h:224
+AL_STOPPED = 4116 # /usr/include/AL/al.h:225
+AL_BUFFERS_QUEUED = 4117 # /usr/include/AL/al.h:230
+AL_BUFFERS_PROCESSED = 4118 # /usr/include/AL/al.h:231
+AL_SEC_OFFSET = 4132 # /usr/include/AL/al.h:236
+AL_SAMPLE_OFFSET = 4133 # /usr/include/AL/al.h:237
+AL_BYTE_OFFSET = 4134 # /usr/include/AL/al.h:238
+AL_SOURCE_TYPE = 4135 # /usr/include/AL/al.h:246
+AL_STATIC = 4136 # /usr/include/AL/al.h:247
+AL_STREAMING = 4137 # /usr/include/AL/al.h:248
+AL_UNDETERMINED = 4144 # /usr/include/AL/al.h:249
+AL_FORMAT_MONO8 = 4352 # /usr/include/AL/al.h:252
+AL_FORMAT_MONO16 = 4353 # /usr/include/AL/al.h:253
+AL_FORMAT_STEREO8 = 4354 # /usr/include/AL/al.h:254
+AL_FORMAT_STEREO16 = 4355 # /usr/include/AL/al.h:255
+AL_REFERENCE_DISTANCE = 4128 # /usr/include/AL/al.h:265
+AL_ROLLOFF_FACTOR = 4129 # /usr/include/AL/al.h:273
+AL_CONE_OUTER_GAIN = 4130 # /usr/include/AL/al.h:282
+AL_MAX_DISTANCE = 4131 # /usr/include/AL/al.h:292
+AL_FREQUENCY = 8193 # /usr/include/AL/al.h:300
+AL_BITS = 8194 # /usr/include/AL/al.h:301
+AL_CHANNELS = 8195 # /usr/include/AL/al.h:302
+AL_SIZE = 8196 # /usr/include/AL/al.h:303
+AL_UNUSED = 8208 # /usr/include/AL/al.h:310
+AL_PENDING = 8209 # /usr/include/AL/al.h:311
+AL_PROCESSED = 8210 # /usr/include/AL/al.h:312
+AL_NO_ERROR = 0 # /usr/include/AL/al.h:316
+AL_INVALID_NAME = 40961 # /usr/include/AL/al.h:321
+AL_INVALID_ENUM = 40962 # /usr/include/AL/al.h:326
+AL_INVALID_VALUE = 40963 # /usr/include/AL/al.h:331
+AL_INVALID_OPERATION = 40964 # /usr/include/AL/al.h:336
+AL_OUT_OF_MEMORY = 40965 # /usr/include/AL/al.h:342
+AL_VENDOR = 45057 # /usr/include/AL/al.h:346
+AL_VERSION = 45058 # /usr/include/AL/al.h:347
+AL_RENDERER = 45059 # /usr/include/AL/al.h:348
+AL_EXTENSIONS = 45060 # /usr/include/AL/al.h:349
+AL_DOPPLER_FACTOR = 49152 # /usr/include/AL/al.h:356
+AL_DOPPLER_VELOCITY = 49153 # /usr/include/AL/al.h:361
+AL_SPEED_OF_SOUND = 49155 # /usr/include/AL/al.h:366
+AL_DISTANCE_MODEL = 53248 # /usr/include/AL/al.h:375
+AL_INVERSE_DISTANCE = 53249 # /usr/include/AL/al.h:376
+AL_INVERSE_DISTANCE_CLAMPED = 53250 # /usr/include/AL/al.h:377
+AL_LINEAR_DISTANCE = 53251 # /usr/include/AL/al.h:378
+AL_LINEAR_DISTANCE_CLAMPED = 53252 # /usr/include/AL/al.h:379
+AL_EXPONENT_DISTANCE = 53253 # /usr/include/AL/al.h:380
+AL_EXPONENT_DISTANCE_CLAMPED = 53254 # /usr/include/AL/al.h:381
+# /usr/include/AL/al.h:386
+alEnable = _lib.alEnable
+alEnable.restype = None
+alEnable.argtypes = [ALenum]
+
+# /usr/include/AL/al.h:388
+alDisable = _lib.alDisable
+alDisable.restype = None
+alDisable.argtypes = [ALenum]
+
+# /usr/include/AL/al.h:390
+alIsEnabled = _lib.alIsEnabled
+alIsEnabled.restype = ALboolean
+alIsEnabled.argtypes = [ALenum]
+
+# /usr/include/AL/al.h:396
+alGetString = _lib.alGetString
+alGetString.restype = POINTER(ALchar)
+alGetString.argtypes = [ALenum]
+
+# /usr/include/AL/al.h:398
+alGetBooleanv = _lib.alGetBooleanv
+alGetBooleanv.restype = None
+alGetBooleanv.argtypes = [ALenum, POINTER(ALboolean)]
+
+# /usr/include/AL/al.h:400
+alGetIntegerv = _lib.alGetIntegerv
+alGetIntegerv.restype = None
+alGetIntegerv.argtypes = [ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:402
+alGetFloatv = _lib.alGetFloatv
+alGetFloatv.restype = None
+alGetFloatv.argtypes = [ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:404
+alGetDoublev = _lib.alGetDoublev
+alGetDoublev.restype = None
+alGetDoublev.argtypes = [ALenum, POINTER(ALdouble)]
+
+# /usr/include/AL/al.h:406
+alGetBoolean = _lib.alGetBoolean
+alGetBoolean.restype = ALboolean
+alGetBoolean.argtypes = [ALenum]
+
+# /usr/include/AL/al.h:408
+alGetInteger = _lib.alGetInteger
+alGetInteger.restype = ALint
+alGetInteger.argtypes = [ALenum]
+
+# /usr/include/AL/al.h:410
+alGetFloat = _lib.alGetFloat
+alGetFloat.restype = ALfloat
+alGetFloat.argtypes = [ALenum]
+
+# /usr/include/AL/al.h:412
+alGetDouble = _lib.alGetDouble
+alGetDouble.restype = ALdouble
+alGetDouble.argtypes = [ALenum]
+
+# /usr/include/AL/al.h:419
+alGetError = _lib.alGetError
+alGetError.restype = ALenum
+alGetError.argtypes = []
+
+# /usr/include/AL/al.h:427
+alIsExtensionPresent = _lib.alIsExtensionPresent
+alIsExtensionPresent.restype = ALboolean
+alIsExtensionPresent.argtypes = [POINTER(ALchar)]
+
+# /usr/include/AL/al.h:429
+alGetProcAddress = _lib.alGetProcAddress
+alGetProcAddress.restype = POINTER(c_void)
+alGetProcAddress.argtypes = [POINTER(ALchar)]
+
+# /usr/include/AL/al.h:431
+alGetEnumValue = _lib.alGetEnumValue
+alGetEnumValue.restype = ALenum
+alGetEnumValue.argtypes = [POINTER(ALchar)]
+
+# /usr/include/AL/al.h:450
+alListenerf = _lib.alListenerf
+alListenerf.restype = None
+alListenerf.argtypes = [ALenum, ALfloat]
+
+# /usr/include/AL/al.h:452
+alListener3f = _lib.alListener3f
+alListener3f.restype = None
+alListener3f.argtypes = [ALenum, ALfloat, ALfloat, ALfloat]
+
+# /usr/include/AL/al.h:454
+alListenerfv = _lib.alListenerfv
+alListenerfv.restype = None
+alListenerfv.argtypes = [ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:456
+alListeneri = _lib.alListeneri
+alListeneri.restype = None
+alListeneri.argtypes = [ALenum, ALint]
+
+# /usr/include/AL/al.h:458
+#alListener3i = _lib.alListener3i
+#alListener3i.restype = None
+#alListener3i.argtypes = [ALenum, ALint, ALint, ALint]
+
+# /usr/include/AL/al.h:460
+#alListeneriv = _lib.alListeneriv
+#alListeneriv.restype = None
+#alListeneriv.argtypes = [ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:465
+alGetListenerf = _lib.alGetListenerf
+alGetListenerf.restype = None
+alGetListenerf.argtypes = [ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:467
+alGetListener3f = _lib.alGetListener3f
+alGetListener3f.restype = None
+alGetListener3f.argtypes = [ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:469
+alGetListenerfv = _lib.alGetListenerfv
+alGetListenerfv.restype = None
+alGetListenerfv.argtypes = [ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:471
+alGetListeneri = _lib.alGetListeneri
+alGetListeneri.restype = None
+alGetListeneri.argtypes = [ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:473
+alGetListener3i = _lib.alGetListener3i
+alGetListener3i.restype = None
+alGetListener3i.argtypes = [ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)]
+
+# /usr/include/AL/al.h:475
+alGetListeneriv = _lib.alGetListeneriv
+alGetListeneriv.restype = None
+alGetListeneriv.argtypes = [ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:512
+alGenSources = _lib.alGenSources
+alGenSources.restype = None
+alGenSources.argtypes = [ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:515
+alDeleteSources = _lib.alDeleteSources
+alDeleteSources.restype = None
+alDeleteSources.argtypes = [ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:518
+alIsSource = _lib.alIsSource
+alIsSource.restype = ALboolean
+alIsSource.argtypes = [ALuint]
+
+# /usr/include/AL/al.h:523
+alSourcef = _lib.alSourcef
+alSourcef.restype = None
+alSourcef.argtypes = [ALuint, ALenum, ALfloat]
+
+# /usr/include/AL/al.h:525
+alSource3f = _lib.alSource3f
+alSource3f.restype = None
+alSource3f.argtypes = [ALuint, ALenum, ALfloat, ALfloat, ALfloat]
+
+# /usr/include/AL/al.h:527
+alSourcefv = _lib.alSourcefv
+alSourcefv.restype = None
+alSourcefv.argtypes = [ALuint, ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:529
+alSourcei = _lib.alSourcei
+alSourcei.restype = None
+alSourcei.argtypes = [ALuint, ALenum, ALint]
+
+# /usr/include/AL/al.h:531
+#alSource3i = _lib.alSource3i
+#alSource3i.restype = None
+#alSource3i.argtypes = [ALuint, ALenum, ALint, ALint, ALint]
+
+# /usr/include/AL/al.h:533
+#alSourceiv = _lib.alSourceiv
+#alSourceiv.restype = None
+#alSourceiv.argtypes = [ALuint, ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:538
+alGetSourcef = _lib.alGetSourcef
+alGetSourcef.restype = None
+alGetSourcef.argtypes = [ALuint, ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:540
+alGetSource3f = _lib.alGetSource3f
+alGetSource3f.restype = None
+alGetSource3f.argtypes = [ALuint, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:542
+alGetSourcefv = _lib.alGetSourcefv
+alGetSourcefv.restype = None
+alGetSourcefv.argtypes = [ALuint, ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:544
+alGetSourcei = _lib.alGetSourcei
+alGetSourcei.restype = None
+alGetSourcei.argtypes = [ALuint, ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:546
+#alGetSource3i = _lib.alGetSource3i
+#alGetSource3i.restype = None
+#alGetSource3i.argtypes = [ALuint, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)]
+
+# /usr/include/AL/al.h:548
+alGetSourceiv = _lib.alGetSourceiv
+alGetSourceiv.restype = None
+alGetSourceiv.argtypes = [ALuint, ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:556
+alSourcePlayv = _lib.alSourcePlayv
+alSourcePlayv.restype = None
+alSourcePlayv.argtypes = [ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:559
+alSourceStopv = _lib.alSourceStopv
+alSourceStopv.restype = None
+alSourceStopv.argtypes = [ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:562
+alSourceRewindv = _lib.alSourceRewindv
+alSourceRewindv.restype = None
+alSourceRewindv.argtypes = [ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:565
+alSourcePausev = _lib.alSourcePausev
+alSourcePausev.restype = None
+alSourcePausev.argtypes = [ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:572
+alSourcePlay = _lib.alSourcePlay
+alSourcePlay.restype = None
+alSourcePlay.argtypes = [ALuint]
+
+# /usr/include/AL/al.h:575
+alSourceStop = _lib.alSourceStop
+alSourceStop.restype = None
+alSourceStop.argtypes = [ALuint]
+
+# /usr/include/AL/al.h:578
+alSourceRewind = _lib.alSourceRewind
+alSourceRewind.restype = None
+alSourceRewind.argtypes = [ALuint]
+
+# /usr/include/AL/al.h:581
+alSourcePause = _lib.alSourcePause
+alSourcePause.restype = None
+alSourcePause.argtypes = [ALuint]
+
+# /usr/include/AL/al.h:586
+alSourceQueueBuffers = _lib.alSourceQueueBuffers
+alSourceQueueBuffers.restype = None
+alSourceQueueBuffers.argtypes = [ALuint, ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:588
+alSourceUnqueueBuffers = _lib.alSourceUnqueueBuffers
+alSourceUnqueueBuffers.restype = None
+alSourceUnqueueBuffers.argtypes = [ALuint, ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:606
+alGenBuffers = _lib.alGenBuffers
+alGenBuffers.restype = None
+alGenBuffers.argtypes = [ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:609
+alDeleteBuffers = _lib.alDeleteBuffers
+alDeleteBuffers.restype = None
+alDeleteBuffers.argtypes = [ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:612
+alIsBuffer = _lib.alIsBuffer
+alIsBuffer.restype = ALboolean
+alIsBuffer.argtypes = [ALuint]
+
+# /usr/include/AL/al.h:615
+alBufferData = _lib.alBufferData
+alBufferData.restype = None
+alBufferData.argtypes = [ALuint, ALenum, POINTER(ALvoid), ALsizei, ALsizei]
+
+# /usr/include/AL/al.h:620
+alBufferf = _lib.alBufferf
+alBufferf.restype = None
+alBufferf.argtypes = [ALuint, ALenum, ALfloat]
+
+# /usr/include/AL/al.h:622
+alBuffer3f = _lib.alBuffer3f
+alBuffer3f.restype = None
+alBuffer3f.argtypes = [ALuint, ALenum, ALfloat, ALfloat, ALfloat]
+
+# /usr/include/AL/al.h:624
+alBufferfv = _lib.alBufferfv
+alBufferfv.restype = None
+alBufferfv.argtypes = [ALuint, ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:626
+alBufferi = _lib.alBufferi
+alBufferi.restype = None
+alBufferi.argtypes = [ALuint, ALenum, ALint]
+
+# /usr/include/AL/al.h:628
+alBuffer3i = _lib.alBuffer3i
+alBuffer3i.restype = None
+alBuffer3i.argtypes = [ALuint, ALenum, ALint, ALint, ALint]
+
+# /usr/include/AL/al.h:630
+alBufferiv = _lib.alBufferiv
+alBufferiv.restype = None
+alBufferiv.argtypes = [ALuint, ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:635
+alGetBufferf = _lib.alGetBufferf
+alGetBufferf.restype = None
+alGetBufferf.argtypes = [ALuint, ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:637
+alGetBuffer3f = _lib.alGetBuffer3f
+alGetBuffer3f.restype = None
+alGetBuffer3f.argtypes = [ALuint, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:639
+alGetBufferfv = _lib.alGetBufferfv
+alGetBufferfv.restype = None
+alGetBufferfv.argtypes = [ALuint, ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:641
+alGetBufferi = _lib.alGetBufferi
+alGetBufferi.restype = None
+alGetBufferi.argtypes = [ALuint, ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:643
+alGetBuffer3i = _lib.alGetBuffer3i
+alGetBuffer3i.restype = None
+alGetBuffer3i.argtypes = [ALuint, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)]
+
+# /usr/include/AL/al.h:645
+alGetBufferiv = _lib.alGetBufferiv
+alGetBufferiv.restype = None
+alGetBufferiv.argtypes = [ALuint, ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:651
+alDopplerFactor = _lib.alDopplerFactor
+alDopplerFactor.restype = None
+alDopplerFactor.argtypes = [ALfloat]
+
+# /usr/include/AL/al.h:653
+alDopplerVelocity = _lib.alDopplerVelocity
+alDopplerVelocity.restype = None
+alDopplerVelocity.argtypes = [ALfloat]
+
+# /usr/include/AL/al.h:655
+alSpeedOfSound = _lib.alSpeedOfSound
+alSpeedOfSound.restype = None
+alSpeedOfSound.argtypes = [ALfloat]
+
+# /usr/include/AL/al.h:657
+alDistanceModel = _lib.alDistanceModel
+alDistanceModel.restype = None
+alDistanceModel.argtypes = [ALenum]
+
+LPALENABLE = CFUNCTYPE(None, ALenum) # /usr/include/AL/al.h:662
+LPALDISABLE = CFUNCTYPE(None, ALenum) # /usr/include/AL/al.h:663
+LPALISENABLED = CFUNCTYPE(ALboolean, ALenum) # /usr/include/AL/al.h:664
+LPALGETSTRING = CFUNCTYPE(POINTER(ALchar), ALenum) # /usr/include/AL/al.h:665
+LPALGETBOOLEANV = CFUNCTYPE(None, ALenum, POINTER(ALboolean)) # /usr/include/AL/al.h:666
+LPALGETINTEGERV = CFUNCTYPE(None, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:667
+LPALGETFLOATV = CFUNCTYPE(None, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:668
+LPALGETDOUBLEV = CFUNCTYPE(None, ALenum, POINTER(ALdouble)) # /usr/include/AL/al.h:669
+LPALGETBOOLEAN = CFUNCTYPE(ALboolean, ALenum) # /usr/include/AL/al.h:670
+LPALGETINTEGER = CFUNCTYPE(ALint, ALenum) # /usr/include/AL/al.h:671
+LPALGETFLOAT = CFUNCTYPE(ALfloat, ALenum) # /usr/include/AL/al.h:672
+LPALGETDOUBLE = CFUNCTYPE(ALdouble, ALenum) # /usr/include/AL/al.h:673
+LPALGETERROR = CFUNCTYPE(ALenum) # /usr/include/AL/al.h:674
+LPALISEXTENSIONPRESENT = CFUNCTYPE(ALboolean, POINTER(ALchar)) # /usr/include/AL/al.h:675
+LPALGETPROCADDRESS = CFUNCTYPE(POINTER(c_void), POINTER(ALchar)) # /usr/include/AL/al.h:676
+LPALGETENUMVALUE = CFUNCTYPE(ALenum, POINTER(ALchar)) # /usr/include/AL/al.h:677
+LPALLISTENERF = CFUNCTYPE(None, ALenum, ALfloat) # /usr/include/AL/al.h:678
+LPALLISTENER3F = CFUNCTYPE(None, ALenum, ALfloat, ALfloat, ALfloat) # /usr/include/AL/al.h:679
+LPALLISTENERFV = CFUNCTYPE(None, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:680
+LPALLISTENERI = CFUNCTYPE(None, ALenum, ALint) # /usr/include/AL/al.h:681
+LPALLISTENER3I = CFUNCTYPE(None, ALenum, ALint, ALint, ALint) # /usr/include/AL/al.h:682
+LPALLISTENERIV = CFUNCTYPE(None, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:683
+LPALGETLISTENERF = CFUNCTYPE(None, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:684
+LPALGETLISTENER3F = CFUNCTYPE(None, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)) # /usr/include/AL/al.h:685
+LPALGETLISTENERFV = CFUNCTYPE(None, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:686
+LPALGETLISTENERI = CFUNCTYPE(None, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:687
+LPALGETLISTENER3I = CFUNCTYPE(None, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)) # /usr/include/AL/al.h:688
+LPALGETLISTENERIV = CFUNCTYPE(None, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:689
+LPALGENSOURCES = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:690
+LPALDELETESOURCES = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:691
+LPALISSOURCE = CFUNCTYPE(ALboolean, ALuint) # /usr/include/AL/al.h:692
+LPALSOURCEF = CFUNCTYPE(None, ALuint, ALenum, ALfloat) # /usr/include/AL/al.h:693
+LPALSOURCE3F = CFUNCTYPE(None, ALuint, ALenum, ALfloat, ALfloat, ALfloat) # /usr/include/AL/al.h:694
+LPALSOURCEFV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:695
+LPALSOURCEI = CFUNCTYPE(None, ALuint, ALenum, ALint) # /usr/include/AL/al.h:696
+LPALSOURCE3I = CFUNCTYPE(None, ALuint, ALenum, ALint, ALint, ALint) # /usr/include/AL/al.h:697
+LPALSOURCEIV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:698
+LPALGETSOURCEF = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:699
+LPALGETSOURCE3F = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)) # /usr/include/AL/al.h:700
+LPALGETSOURCEFV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:701
+LPALGETSOURCEI = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:702
+LPALGETSOURCE3I = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)) # /usr/include/AL/al.h:703
+LPALGETSOURCEIV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:704
+LPALSOURCEPLAYV = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:705
+LPALSOURCESTOPV = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:706
+LPALSOURCEREWINDV = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:707
+LPALSOURCEPAUSEV = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:708
+LPALSOURCEPLAY = CFUNCTYPE(None, ALuint) # /usr/include/AL/al.h:709
+LPALSOURCESTOP = CFUNCTYPE(None, ALuint) # /usr/include/AL/al.h:710
+LPALSOURCEREWIND = CFUNCTYPE(None, ALuint) # /usr/include/AL/al.h:711
+LPALSOURCEPAUSE = CFUNCTYPE(None, ALuint) # /usr/include/AL/al.h:712
+LPALSOURCEQUEUEBUFFERS = CFUNCTYPE(None, ALuint, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:713
+LPALSOURCEUNQUEUEBUFFERS = CFUNCTYPE(None, ALuint, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:714
+LPALGENBUFFERS = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:715
+LPALDELETEBUFFERS = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:716
+LPALISBUFFER = CFUNCTYPE(ALboolean, ALuint) # /usr/include/AL/al.h:717
+LPALBUFFERDATA = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALvoid), ALsizei, ALsizei) # /usr/include/AL/al.h:718
+LPALBUFFERF = CFUNCTYPE(None, ALuint, ALenum, ALfloat) # /usr/include/AL/al.h:719
+LPALBUFFER3F = CFUNCTYPE(None, ALuint, ALenum, ALfloat, ALfloat, ALfloat) # /usr/include/AL/al.h:720
+LPALBUFFERFV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:721
+LPALBUFFERI = CFUNCTYPE(None, ALuint, ALenum, ALint) # /usr/include/AL/al.h:722
+LPALBUFFER3I = CFUNCTYPE(None, ALuint, ALenum, ALint, ALint, ALint) # /usr/include/AL/al.h:723
+LPALBUFFERIV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:724
+LPALGETBUFFERF = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:725
+LPALGETBUFFER3F = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)) # /usr/include/AL/al.h:726
+LPALGETBUFFERFV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:727
+LPALGETBUFFERI = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:728
+LPALGETBUFFER3I = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)) # /usr/include/AL/al.h:729
+LPALGETBUFFERIV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:730
+LPALDOPPLERFACTOR = CFUNCTYPE(None, ALfloat) # /usr/include/AL/al.h:731
+LPALDOPPLERVELOCITY = CFUNCTYPE(None, ALfloat) # /usr/include/AL/al.h:732
+LPALSPEEDOFSOUND = CFUNCTYPE(None, ALfloat) # /usr/include/AL/al.h:733
+LPALDISTANCEMODEL = CFUNCTYPE(None, ALenum) # /usr/include/AL/al.h:734
+
+__all__ = ['AL_API', 'ALAPI', 'AL_INVALID', 'AL_ILLEGAL_ENUM',
+'AL_ILLEGAL_COMMAND', 'ALboolean', 'ALchar', 'ALbyte', 'ALubyte', 'ALshort',
+'ALushort', 'ALint', 'ALuint', 'ALsizei', 'ALenum', 'ALfloat', 'ALdouble',
+'ALvoid', 'AL_NONE', 'AL_FALSE', 'AL_TRUE', 'AL_SOURCE_RELATIVE',
+'AL_CONE_INNER_ANGLE', 'AL_CONE_OUTER_ANGLE', 'AL_PITCH', 'AL_POSITION',
+'AL_DIRECTION', 'AL_VELOCITY', 'AL_LOOPING', 'AL_BUFFER', 'AL_GAIN',
+'AL_MIN_GAIN', 'AL_MAX_GAIN', 'AL_ORIENTATION', 'AL_SOURCE_STATE',
+'AL_INITIAL', 'AL_PLAYING', 'AL_PAUSED', 'AL_STOPPED', 'AL_BUFFERS_QUEUED',
+'AL_BUFFERS_PROCESSED', 'AL_SEC_OFFSET', 'AL_SAMPLE_OFFSET', 'AL_BYTE_OFFSET',
+'AL_SOURCE_TYPE', 'AL_STATIC', 'AL_STREAMING', 'AL_UNDETERMINED',
+'AL_FORMAT_MONO8', 'AL_FORMAT_MONO16', 'AL_FORMAT_STEREO8',
+'AL_FORMAT_STEREO16', 'AL_REFERENCE_DISTANCE', 'AL_ROLLOFF_FACTOR',
+'AL_CONE_OUTER_GAIN', 'AL_MAX_DISTANCE', 'AL_FREQUENCY', 'AL_BITS',
+'AL_CHANNELS', 'AL_SIZE', 'AL_UNUSED', 'AL_PENDING', 'AL_PROCESSED',
+'AL_NO_ERROR', 'AL_INVALID_NAME', 'AL_INVALID_ENUM', 'AL_INVALID_VALUE',
+'AL_INVALID_OPERATION', 'AL_OUT_OF_MEMORY', 'AL_VENDOR', 'AL_VERSION',
+'AL_RENDERER', 'AL_EXTENSIONS', 'AL_DOPPLER_FACTOR', 'AL_DOPPLER_VELOCITY',
+'AL_SPEED_OF_SOUND', 'AL_DISTANCE_MODEL', 'AL_INVERSE_DISTANCE',
+'AL_INVERSE_DISTANCE_CLAMPED', 'AL_LINEAR_DISTANCE',
+'AL_LINEAR_DISTANCE_CLAMPED', 'AL_EXPONENT_DISTANCE',
+'AL_EXPONENT_DISTANCE_CLAMPED', 'alEnable', 'alDisable', 'alIsEnabled',
+'alGetString', 'alGetBooleanv', 'alGetIntegerv', 'alGetFloatv',
+'alGetDoublev', 'alGetBoolean', 'alGetInteger', 'alGetFloat', 'alGetDouble',
+'alGetError', 'alIsExtensionPresent', 'alGetProcAddress', 'alGetEnumValue',
+'alListenerf', 'alListener3f', 'alListenerfv', 'alListeneri', 'alListener3i',
+'alListeneriv', 'alGetListenerf', 'alGetListener3f', 'alGetListenerfv',
+'alGetListeneri', 'alGetListener3i', 'alGetListeneriv', 'alGenSources',
+'alDeleteSources', 'alIsSource', 'alSourcef', 'alSource3f', 'alSourcefv',
+'alSourcei', 'alSource3i', 'alSourceiv', 'alGetSourcef', 'alGetSource3f',
+'alGetSourcefv', 'alGetSourcei', 'alGetSource3i', 'alGetSourceiv',
+'alSourcePlayv', 'alSourceStopv', 'alSourceRewindv', 'alSourcePausev',
+'alSourcePlay', 'alSourceStop', 'alSourceRewind', 'alSourcePause',
+'alSourceQueueBuffers', 'alSourceUnqueueBuffers', 'alGenBuffers',
+'alDeleteBuffers', 'alIsBuffer', 'alBufferData', 'alBufferf', 'alBuffer3f',
+'alBufferfv', 'alBufferi', 'alBuffer3i', 'alBufferiv', 'alGetBufferf',
+'alGetBuffer3f', 'alGetBufferfv', 'alGetBufferi', 'alGetBuffer3i',
+'alGetBufferiv', 'alDopplerFactor', 'alDopplerVelocity', 'alSpeedOfSound',
+'alDistanceModel', 'LPALENABLE', 'LPALDISABLE', 'LPALISENABLED',
+'LPALGETSTRING', 'LPALGETBOOLEANV', 'LPALGETINTEGERV', 'LPALGETFLOATV',
+'LPALGETDOUBLEV', 'LPALGETBOOLEAN', 'LPALGETINTEGER', 'LPALGETFLOAT',
+'LPALGETDOUBLE', 'LPALGETERROR', 'LPALISEXTENSIONPRESENT',
+'LPALGETPROCADDRESS', 'LPALGETENUMVALUE', 'LPALLISTENERF', 'LPALLISTENER3F',
+'LPALLISTENERFV', 'LPALLISTENERI', 'LPALLISTENER3I', 'LPALLISTENERIV',
+'LPALGETLISTENERF', 'LPALGETLISTENER3F', 'LPALGETLISTENERFV',
+'LPALGETLISTENERI', 'LPALGETLISTENER3I', 'LPALGETLISTENERIV',
+'LPALGENSOURCES', 'LPALDELETESOURCES', 'LPALISSOURCE', 'LPALSOURCEF',
+'LPALSOURCE3F', 'LPALSOURCEFV', 'LPALSOURCEI', 'LPALSOURCE3I', 'LPALSOURCEIV',
+'LPALGETSOURCEF', 'LPALGETSOURCE3F', 'LPALGETSOURCEFV', 'LPALGETSOURCEI',
+'LPALGETSOURCE3I', 'LPALGETSOURCEIV', 'LPALSOURCEPLAYV', 'LPALSOURCESTOPV',
+'LPALSOURCEREWINDV', 'LPALSOURCEPAUSEV', 'LPALSOURCEPLAY', 'LPALSOURCESTOP',
+'LPALSOURCEREWIND', 'LPALSOURCEPAUSE', 'LPALSOURCEQUEUEBUFFERS',
+'LPALSOURCEUNQUEUEBUFFERS', 'LPALGENBUFFERS', 'LPALDELETEBUFFERS',
+'LPALISBUFFER', 'LPALBUFFERDATA', 'LPALBUFFERF', 'LPALBUFFER3F',
+'LPALBUFFERFV', 'LPALBUFFERI', 'LPALBUFFER3I', 'LPALBUFFERIV',
+'LPALGETBUFFERF', 'LPALGETBUFFER3F', 'LPALGETBUFFERFV', 'LPALGETBUFFERI',
+'LPALGETBUFFER3I', 'LPALGETBUFFERIV', 'LPALDOPPLERFACTOR',
+'LPALDOPPLERVELOCITY', 'LPALSPEEDOFSOUND', 'LPALDISTANCEMODEL']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/pulse/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/pulse/__init__.py
new file mode 100644
index 0000000..778268f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/pulse/__init__.py
@@ -0,0 +1,46 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+from __future__ import absolute_import
+
+from .adaptation import PulseAudioDriver
+
+import pyglet
+_debug = pyglet.options['debug_media']
+
+def create_audio_driver():
+ driver = PulseAudioDriver()
+ driver.connect()
+ if _debug:
+ driver.dump_debug_info()
+ return driver
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/pulse/adaptation.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/pulse/adaptation.py
new file mode 100644
index 0000000..85b39d9
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/pulse/adaptation.py
@@ -0,0 +1,417 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+from __future__ import print_function
+from __future__ import absolute_import
+
+from pyglet.media.drivers.base import AbstractAudioDriver, AbstractAudioPlayer
+from pyglet.media.events import MediaEvent
+from pyglet.media.exceptions import MediaException
+from pyglet.media.listener import AbstractListener
+
+from . import lib_pulseaudio as pa
+from .interface import PulseAudioContext, PulseAudioContext, PulseAudioMainLoop, PulseAudioStream
+
+import pyglet
+_debug = pyglet.options['debug_media']
+
+
+class PulseAudioDriver(AbstractAudioDriver):
+ def __init__(self):
+ self.mainloop = PulseAudioMainLoop()
+ self.mainloop.start()
+ self.lock = self.mainloop
+ self.context = None
+
+ self._players = pyglet.app.WeakSet()
+ self._listener = PulseAudioListener(self)
+
+ def create_audio_player(self, source_group, player):
+ assert self.context is not None
+ player = PulseAudioPlayer(source_group, player, self)
+ self._players.add(player)
+ return player
+
+ def connect(self, server=None):
+ """Connect to pulseaudio server.
+
+ :Parameters:
+ `server` : str
+ Server to connect to, or ``None`` for the default local
+ server (which may be spawned as a daemon if no server is
+ found).
+ """
+ # TODO disconnect from old
+ assert not self.context, 'Already connected'
+
+ self.context = self.mainloop.create_context()
+ self.context.connect(server)
+
+ def dump_debug_info(self):
+ print('Client version: ', pa.pa_get_library_version())
+
+ print('Server: ', self.context.server)
+ print('Protocol: ', self.context.protocol_version)
+ print('Server protocol:', self.context.server_protocol_version)
+ print('Local context: ', self.context.is_local and 'Yes' or 'No')
+
+ def delete(self):
+ """Completely shut down pulseaudio client."""
+ if self.mainloop is not None:
+ for player in self._players:
+ player.delete()
+
+ with self.mainloop:
+ if self.context is not None:
+ self.context.delete()
+ self.context = None
+
+ if self.mainloop is not None:
+ self.mainloop.delete()
+ self.mainloop = None
+ self.lock = None
+
+ def get_listener(self):
+ return self._listener
+
+
+class PulseAudioListener(AbstractListener):
+ def __init__(self, driver):
+ self.driver = driver
+
+ def _set_volume(self, volume):
+ self._volume = volume
+ for player in self.driver._players:
+ player.set_volume(player._volume)
+
+ def _set_position(self, position):
+ self._position = position
+
+ def _set_forward_orientation(self, orientation):
+ self._forward_orientation = orientation
+
+ def _set_up_orientation(self, orientation):
+ self._up_orientation = orientation
+
+
+class PulseAudioPlayer(AbstractAudioPlayer):
+ _volume = 1.0
+
+ def __init__(self, source_group, player, driver):
+ super(PulseAudioPlayer, self).__init__(source_group, player)
+ self.driver = driver
+ self.context = driver.context
+
+ self._events = []
+ self._timestamps = [] # List of (ref_time, timestamp)
+ self._write_index = 0 # Current write index (tracked manually)
+ self._read_index_valid = False # True only if buffer has non-stale data
+
+ self._clear_write = False
+ self._buffered_audio_data = None
+ self._playing = False
+
+ self._current_audio_data = None
+
+ self._time_sync_operation = None
+
+ audio_format = source_group.audio_format
+ assert audio_format
+
+ with self.context.mainloop:
+ self.stream = self.context.create_stream(audio_format)
+ self.stream.push_handlers(self)
+ self.stream.connect_playback()
+ assert self.stream.is_ready
+
+ if _debug:
+ print('PulseAudioPlayer: __init__ finished')
+
+ def on_write_needed(self, nbytes, underflow):
+ if underflow:
+ self._handle_underflow()
+ else:
+ self._write_to_stream(nbytes)
+
+ # Asynchronously update time
+ if self._events:
+ if self._time_sync_operation is not None and self._time_sync_operation.is_done:
+ self._time_sync_operation.delete()
+ self._time_sync_operation = None
+ if self._time_sync_operation is None:
+ if _debug:
+ print('PulseAudioPlayer: trigger timing info update')
+ self._time_sync_operation = self.stream.update_timing_info(self._process_events)
+
+ def _get_audio_data(self, nbytes=None):
+ if self._current_audio_data is None and self.source_group is not None:
+ # Always try to buffer at least 1 second of audio data
+ min_bytes = 1 * self.source_group.audio_format.bytes_per_second
+ if nbytes is None:
+ nbytes = min_bytes
+ else:
+ nbytes = min(min_bytes, nbytes)
+ if _debug:
+ print('PulseAudioPlayer: Try to get {} bytes of audio data'.format(nbytes))
+ self._current_audio_data = self.source_group.get_audio_data(nbytes)
+ self._schedule_events()
+ if _debug:
+ if self._current_audio_data is None:
+ print('PulseAudioPlayer: No audio data available')
+ else:
+ print('PulseAudioPlayer: Got {} bytes of audio data'.format(self._current_audio_data.length))
+ return self._current_audio_data
+
+ def _has_audio_data(self):
+ return self._get_audio_data() is not None
+
+ def _consume_audio_data(self, nbytes):
+ if self._current_audio_data is not None:
+ if nbytes == self._current_audio_data.length:
+ self._current_audio_data = None
+ else:
+ self._current_audio_data.consume(nbytes, self.source_group.audio_format)
+
+ def _schedule_events(self):
+ if self._current_audio_data is not None:
+ for event in self._current_audio_data.events:
+ event_index = self._write_index + event.timestamp * \
+ self.source_group.audio_format.bytes_per_second
+ if _debug:
+ print('PulseAudioPlayer: Schedule event at index {}'.format(event_index))
+ self._events.append((event_index, event))
+
+ def _write_to_stream(self, nbytes=None):
+ if nbytes is None:
+ nbytes = self.stream.writable_size
+ if _debug:
+ print('PulseAudioPlayer: Requested to write %d bytes to stream' % nbytes)
+
+ seek_mode = pa.PA_SEEK_RELATIVE
+ if self._clear_write:
+ seek_mode = pa.PA_SEEK_RELATIVE_ON_READ
+ self._clear_write = False
+ if _debug:
+ print('PulseAudioPlayer: Clear buffer')
+
+ while self._has_audio_data() and nbytes > 0:
+ audio_data = self._get_audio_data()
+
+ write_length = min(nbytes, audio_data.length)
+ consumption = self.stream.write(audio_data, write_length, seek_mode)
+
+ seek_mode = pa.PA_SEEK_RELATIVE
+ self._read_index_valid = True
+ self._timestamps.append((self._write_index, audio_data.timestamp))
+ self._write_index += consumption
+
+ if _debug:
+ print('PulseAudioPlayer: Actually wrote %d bytes to stream' % consumption)
+ self._consume_audio_data(consumption)
+
+ nbytes -= consumption
+
+ if not self._has_audio_data():
+ # In case the source group wasn't long enough to prebuffer stream
+ # to PA's satisfaction, trigger immediate playback (has no effect
+ # if stream is already playing).
+ if self._playing:
+ op = self.stream.trigger()
+ op.delete() # Explicit delete to prevent locking
+
+ def _handle_underflow(self):
+ if _debug:
+ print('Player: underflow')
+ if self._has_audio_data():
+ self._write_to_stream()
+ else:
+ self._add_event_at_write_index('on_eos')
+ self._add_event_at_write_index('on_source_group_eos')
+
+ def _process_events(self):
+ if _debug:
+ print('PulseAudioPlayer: Process events')
+ if not self._events:
+ if _debug:
+ print('PulseAudioPlayer: No events')
+ return
+
+ # Assume this is called after time sync
+ timing_info = self.stream.get_timing_info()
+ if not timing_info:
+ if _debug:
+ print('PulseAudioPlayer: No timing info to process events')
+ return
+
+ read_index = timing_info.read_index
+ if _debug:
+ print('PulseAudioPlayer: Dispatch events at index {}'.format(read_index))
+
+ while self._events and self._events[0][0] <= read_index:
+ _, event = self._events.pop(0)
+ if _debug:
+ print('PulseAudioPlayer: Dispatch event', event)
+ event._sync_dispatch_to_player(self.player)
+
+ def _add_event_at_write_index(self, event_name):
+ if _debug:
+ print('PulseAudioPlayer: Add event at index {}'.format(self._write_index))
+ self._events.append((self._write_index, MediaEvent(0., event_name)))
+
+
+ def __del__(self):
+ try:
+ self.delete()
+ except:
+ pass
+
+ def delete(self):
+ if _debug:
+ print('PulseAudioPlayer.delete')
+
+ if self._time_sync_operation is not None:
+ with self._time_sync_operation:
+ self._time_sync_operation.delete()
+ self._time_sync_operation = None
+
+ if self.stream is not None:
+ with self.stream:
+ self.stream.delete()
+ self.stream = None
+
+ def clear(self):
+ if _debug:
+ print('PulseAudioPlayer.clear')
+
+ self._clear_write = True
+ self._write_index = self._get_read_index()
+ self._timestamps = []
+ self._events = []
+
+ with self.stream:
+ self._read_index_valid = False
+ self.stream.prebuf().wait()
+
+ def play(self):
+ if _debug:
+ print('PulseAudioPlayer.play')
+
+ with self.stream:
+ if self.stream.is_corked:
+ self.stream.resume().wait().delete()
+ if _debug:
+ print('PulseAudioPlayer: Resumed playback')
+ if self.stream.underflow:
+ self._write_to_stream()
+ if not self._has_audio_data():
+ self.stream.trigger().wait().delete()
+ if _debug:
+ print('PulseAudioPlayer: Triggered stream for immediate playback')
+ assert not self.stream.is_corked
+
+ self._playing = True
+
+ def stop(self):
+ if _debug:
+ print('PulseAudioPlayer.stop')
+
+ with self.stream:
+ if not self.stream.is_corked:
+ self.stream.pause().wait().delete()
+
+ self._playing = False
+
+ def _get_read_index(self):
+ with self.stream:
+ self.stream.update_timing_info().wait().delete()
+
+ timing_info = self.stream.get_timing_info()
+ if timing_info:
+ read_index = timing_info.read_index
+ else:
+ read_index = 0
+
+ if _debug:
+ print('_get_read_index ->', read_index)
+ return read_index
+
+ def _get_write_index(self):
+ timing_info = self.stream.get_timing_info()
+ if timing_info:
+ write_index = timing_info.write_index
+ else:
+ write_index = 0
+
+ if _debug:
+ print('_get_write_index ->', write_index)
+ return write_index
+
+ def get_time(self):
+ if not self._read_index_valid:
+ if _debug:
+ print('get_time <_read_index_valid = False> -> None')
+ return
+
+ read_index = self._get_read_index()
+
+ write_index = 0
+ timestamp = 0.0
+
+ try:
+ write_index, timestamp = self._timestamps[0]
+ write_index, timestamp = self._timestamps[1]
+ while read_index >= write_index:
+ del self._timestamps[0]
+ write_index, timestamp = self._timestamps[1]
+ except IndexError:
+ pass
+
+ bytes_per_second = self.source_group.audio_format.bytes_per_second
+ time = timestamp + (read_index - write_index) / float(bytes_per_second)
+
+ if _debug:
+ print('get_time ->', time)
+ return time
+
+ def set_volume(self, volume):
+ self._volume = volume
+
+ if self.stream:
+ volume *= self.driver._listener._volume
+ with self.context:
+ self.context.set_input_volume(self.stream, volume).wait()
+
+ def set_pitch(self, pitch):
+ with self.stream:
+ self.stream.update_sample_rate(int(pitch * self.sample_rate)).wait()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/pulse/interface.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/pulse/interface.py
new file mode 100644
index 0000000..68dae6d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/pulse/interface.py
@@ -0,0 +1,676 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+from __future__ import print_function
+from __future__ import absolute_import
+
+import ctypes
+import sys
+
+from . import lib_pulseaudio as pa
+from pyglet.media.exceptions import MediaException
+
+import pyglet
+_debug = pyglet.options['debug_media']
+
+
+def get_uint32_or_none(value):
+ # Check for max uint32
+ if value is None or value == 4294967295:
+ return None
+ return value
+
+
+def get_bool_or_none(value):
+ if value < 0:
+ return None
+ elif value == 1:
+ return True
+ else:
+ return False
+
+
+def get_ascii_str_or_none(value):
+ if value is not None:
+ return value.decode('ascii')
+ return None
+
+
+class PulseAudioException(MediaException):
+ def __init__(self, error_code, message):
+ super(PulseAudioException, self).__init__(message)
+ self.error_code = error_code
+ self.message = message
+
+ def __str__(self):
+ return '{}: [{}] {}'.format(self.__class__.__name__,
+ self.error_code,
+ self.message)
+
+ __repr__ = __str__
+
+
+class PulseAudioMainLoop(object):
+ def __init__(self):
+ self._pa_threaded_mainloop = pa.pa_threaded_mainloop_new()
+ self._pa_mainloop = pa.pa_threaded_mainloop_get_api(
+ self._pa_threaded_mainloop)
+ self._lock_count = 0
+
+ def __del__(self):
+ self.delete()
+
+ def start(self):
+ """Start running the mainloop."""
+ with self:
+ result = pa.pa_threaded_mainloop_start(self._pa_threaded_mainloop)
+ if result < 0:
+ raise PulseAudioException(0, "Failed to start PulseAudio mainloop")
+ if _debug:
+ print('PulseAudioMainLoop: Started')
+
+ def delete(self):
+ """Clean up the mainloop."""
+ if self._pa_threaded_mainloop is not None:
+ if _debug:
+ print("PulseAudioMainLoop.delete")
+ pa.pa_threaded_mainloop_stop(self._pa_threaded_mainloop)
+ pa.pa_threaded_mainloop_free(self._pa_threaded_mainloop)
+ self._pa_threaded_mainloop = None
+ self._pa_mainloop = None
+
+ def lock(self):
+ """Lock the threaded mainloop against events. Required for all
+ calls into PA."""
+ assert self._pa_threaded_mainloop is not None
+ pa.pa_threaded_mainloop_lock(self._pa_threaded_mainloop)
+ self._lock_count += 1
+
+ def unlock(self):
+ """Unlock the mainloop thread."""
+ assert self._pa_threaded_mainloop is not None
+ # TODO: This is not completely safe. Unlock might be called without lock.
+ assert self._lock_count > 0
+ self._lock_count -= 1
+ pa.pa_threaded_mainloop_unlock(self._pa_threaded_mainloop)
+
+ def signal(self):
+ """Signal the mainloop thread to break from a wait."""
+ assert self._pa_threaded_mainloop is not None
+ pa.pa_threaded_mainloop_signal(self._pa_threaded_mainloop, 0)
+
+ def wait(self):
+ """Wait for a signal."""
+ assert self._pa_threaded_mainloop is not None
+ # Although lock and unlock can be called reentrantly, the wait call only releases one lock.
+ assert self._lock_count > 0
+ original_lock_count = self._lock_count
+ while self._lock_count > 1:
+ self.unlock()
+ pa.pa_threaded_mainloop_wait(self._pa_threaded_mainloop)
+ while self._lock_count < original_lock_count:
+ self.lock()
+
+ def create_context(self):
+ return PulseAudioContext(self, self._context_new())
+
+ def _context_new(self):
+ """Construct a new context in this mainloop."""
+ assert self._pa_mainloop is not None
+ app_name = self._get_app_name()
+ return pa.pa_context_new(self._pa_mainloop, app_name.encode('ASCII'))
+
+ def _get_app_name(self):
+ """Get the application name as advertised to the pulseaudio server."""
+ # TODO move app name into pyglet.app (also useful for OS X menu bar?).
+ return sys.argv[0]
+
+ def __enter__(self):
+ self.lock()
+
+ def __exit__(self, exc_type, exc_value, traceback):
+ self.unlock()
+
+
+class PulseAudioLockable(object):
+ def __init__(self, mainloop):
+ assert mainloop is not None
+ self.mainloop = mainloop
+
+ def lock(self):
+ """Lock the threaded mainloop against events. Required for all
+ calls into PA."""
+ self.mainloop.lock()
+
+ def unlock(self):
+ """Unlock the mainloop thread."""
+ self.mainloop.unlock()
+
+ def signal(self):
+ """Signal the mainloop thread to break from a wait."""
+ self.mainloop.signal()
+
+ def wait(self):
+ """Wait for a signal."""
+ self.mainloop.wait()
+
+ def __enter__(self):
+ self.lock()
+
+ def __exit__(self, exc_type, exc_value, traceback):
+ self.unlock()
+
+
+class PulseAudioContext(PulseAudioLockable):
+ """Basic object for a connection to a PulseAudio server."""
+ _state_name = {pa.PA_CONTEXT_UNCONNECTED: 'Unconnected',
+ pa.PA_CONTEXT_CONNECTING: 'Connecting',
+ pa.PA_CONTEXT_AUTHORIZING: 'Authorizing',
+ pa.PA_CONTEXT_SETTING_NAME: 'Setting Name',
+ pa.PA_CONTEXT_READY: 'Ready',
+ pa.PA_CONTEXT_FAILED: 'Failed',
+ pa.PA_CONTEXT_TERMINATED: 'Terminated'}
+
+ def __init__(self, mainloop, pa_context):
+ super(PulseAudioContext, self).__init__(mainloop)
+ self._pa_context = pa_context
+ self.state = None
+
+ self._connect_callbacks()
+
+ def __del__(self):
+ if self._pa_context is not None:
+ with self:
+ self.delete()
+
+ def delete(self):
+ """Completely shut down pulseaudio client."""
+ if self._pa_context is not None:
+ if _debug:
+ print("PulseAudioContext.delete")
+ pa.pa_context_disconnect(self._pa_context)
+ pa.pa_context_unref(self._pa_context)
+ while self.state is not None and not self.is_terminated:
+ self.mainloop.wait()
+ self._pa_context = None
+
+ @property
+ def is_ready(self):
+ return self.state == pa.PA_CONTEXT_READY
+
+ @property
+ def is_failed(self):
+ return self.state == pa.PA_CONTEXT_FAILED
+
+ @property
+ def is_terminated(self):
+ return self.state == pa.PA_CONTEXT_TERMINATED
+
+ @property
+ def server(self):
+ if self.is_ready:
+ return get_ascii_str_or_none(pa.pa_context_get_server(self._pa_context))
+ else:
+ return None
+
+ @property
+ def protocol_version(self):
+ if self._pa_context is not None:
+ return get_uint32_or_none(pa.pa_context_get_protocol_version(self._pa_context))
+
+ @property
+ def server_protocol_version(self):
+ if self._pa_context is not None:
+ return get_uint32_or_none(pa.pa_context_get_server_protocol_version(self._pa_context))
+
+ @property
+ def is_local(self):
+ if self._pa_context is not None:
+ return get_bool_or_none(pa.pa_context_is_local(self._pa_context))
+
+ def connect(self, server=None):
+ """Connect the context to a PulseAudio server.
+
+ :Parameters:
+ `server` : str
+ Server to connect to, or ``None`` for the default local
+ server (which may be spawned as a daemon if no server is
+ found).
+ """
+ assert self._pa_context is not None
+ self.state = None
+ self.check(
+ pa.pa_context_connect(self._pa_context, server, 0, None)
+ )
+
+ with self:
+ while not self.is_failed and not self.is_ready:
+ self.wait()
+ if self.is_failed:
+ self.raise_error()
+
+
+ def create_stream(self, audio_format):
+ """
+ Create a new audio stream.
+ """
+ assert self.is_ready
+
+ sample_spec = self.create_sample_spec(audio_format)
+ channel_map = None
+
+ # TODO It is now recommended to use pa_stream_new_with_proplist()
+ stream = pa.pa_stream_new(self._pa_context,
+ str(id(self)).encode('ASCII'),
+ sample_spec,
+ channel_map)
+ self.check_not_null(stream)
+ return PulseAudioStream(self.mainloop, self, stream)
+
+ def create_sample_spec(self, audio_format):
+ """
+ Create a PulseAudio sample spec from pyglet audio format.
+ """
+ sample_spec = pa.pa_sample_spec()
+ if audio_format.sample_size == 8:
+ sample_spec.format = pa.PA_SAMPLE_U8
+ elif audio_format.sample_size == 16:
+ if sys.byteorder == 'little':
+ sample_spec.format = pa.PA_SAMPLE_S16LE
+ else:
+ sample_spec.format = pa.PA_SAMPLE_S16BE
+ else:
+ raise MediaException('Unsupported sample size')
+ sample_spec.rate = audio_format.sample_rate
+ sample_spec.channels = audio_format.channels
+ return sample_spec
+
+ def set_input_volume(self, stream, volume):
+ """
+ Set the volume for a stream.
+ """
+ cvolume = self._get_cvolume_from_linear(stream, volume)
+ with self:
+ idx = stream.index
+ op = pa.pa_context_set_sink_volume(self._pa_context,
+ idx,
+ cvolume,
+ self._success_cb_func,
+ None)
+ return op
+
+ def _get_cvolume_from_linear(self, stream, volume):
+ cvolume = pa.pa_cvolume()
+ volume = pa.pa_sw_volume_from_linear(volume)
+ pa.pa_cvolume_set(cvolume,
+ stream.audio_format.channels,
+ volume)
+ return cvolume
+
+ def _connect_callbacks(self):
+ self._state_cb_func = pa.pa_context_notify_cb_t(self._state_callback)
+ pa.pa_context_set_state_callback(self._pa_context,
+ self._state_cb_func, None)
+
+ def _state_callback(self, context, userdata):
+ self.state = pa.pa_context_get_state(self._pa_context)
+ if _debug:
+ print('PulseAudioContext: state changed to {}'.format(self._state_name[self.state]))
+ self.signal()
+
+ def check(self, result):
+ if result < 0:
+ self.raise_error()
+ return result
+
+ def check_not_null(self, value):
+ if value is None:
+ self.raise_error()
+ return value
+
+ def check_ptr_not_null(self, value):
+ if not value:
+ self.raise_error()
+ return value
+
+ def raise_error(self):
+ error = pa.pa_context_errno(self._pa_context)
+ raise PulseAudioException(error, get_ascii_str_or_none(pa.pa_strerror(error)))
+
+
+class PulseAudioStream(PulseAudioLockable, pyglet.event.EventDispatcher):
+ """PulseAudio audio stream."""
+
+ _state_name = {pa.PA_STREAM_UNCONNECTED: 'Unconnected',
+ pa.PA_STREAM_CREATING: 'Creating',
+ pa.PA_STREAM_READY: 'Ready',
+ pa.PA_STREAM_FAILED: 'Failed',
+ pa.PA_STREAM_TERMINATED: 'Terminated'}
+
+ def __init__(self, mainloop, context, pa_stream):
+ PulseAudioLockable.__init__(self, mainloop)
+ self._pa_stream = pa_stream
+ self.context = context
+ self.state = None
+ self.underflow = False
+
+ pa.pa_stream_ref(self._pa_stream)
+ self._connect_callbacks()
+ self._refresh_state()
+
+ def __del__(self):
+ if self._pa_stream is not None:
+ with self:
+ self.delete()
+
+ def delete(self):
+ if self._pa_stream is not None:
+ if _debug:
+ print("PulseAudioStream.delete")
+ print('PulseAudioStream: writable_size {}'.format(self.writable_size))
+ if not self.is_unconnected:
+ if _debug:
+ print("PulseAudioStream: disconnecting")
+ self.context.check(
+ pa.pa_stream_disconnect(self._pa_stream)
+ )
+ while not self.is_terminated:
+ self.wait()
+
+ pa_stream = self._pa_stream
+ self._pa_stream = None
+ pa.pa_stream_unref(pa_stream)
+
+ @property
+ def is_unconnected(self):
+ return self.state == pa.PA_STREAM_UNCONNECTED
+
+ @property
+ def is_creating(self):
+ return self.state == pa.PA_STREAM_CREATING
+
+ @property
+ def is_ready(self):
+ return self.state == pa.PA_STREAM_READY
+
+ @property
+ def is_failed(self):
+ return self.state == pa.PA_STREAM_FAILED
+
+ @property
+ def is_terminated(self):
+ return self.state == pa.PA_STREAM_TERMINATED
+
+ @property
+ def writable_size(self):
+ assert self._pa_stream is not None
+ return pa.pa_stream_writable_size(self._pa_stream)
+
+ @property
+ def index(self):
+ assert self._pa_stream is not None
+ return pa.pa_stream_get_index(self._pa_stream)
+
+ @property
+ def is_corked(self):
+ assert self._pa_stream is not None
+ return get_bool_or_none(pa.pa_stream_is_corked(self._pa_stream))
+
+ def connect_playback(self):
+ assert self._pa_stream is not None
+ device = None
+ buffer_attr = None
+ flags = (pa.PA_STREAM_START_CORKED |
+ pa.PA_STREAM_INTERPOLATE_TIMING |
+ pa.PA_STREAM_VARIABLE_RATE)
+ volume = None
+ sync_stream = None # TODO use this
+ self.context.check(
+ pa.pa_stream_connect_playback(self._pa_stream,
+ device,
+ buffer_attr,
+ flags,
+ volume,
+ sync_stream)
+ )
+
+ while not self.is_ready and not self.is_failed:
+ self.wait()
+ if not self.is_ready:
+ self.context.raise_error()
+ if _debug:
+ print('PulseAudioStream: Playback connected')
+
+ def write(self, audio_data, length=None, seek_mode=pa.PA_SEEK_RELATIVE):
+ assert self._pa_stream is not None
+ assert self.is_ready
+ if length is None:
+ length = min(audio_data.length, self.writable_size)
+ if _debug:
+ print('PulseAudioStream: writing {} bytes'.format(length))
+ print('PulseAudioStream: writable size before write {} bytes'.format(self.writable_size))
+ self.context.check(
+ pa.pa_stream_write(self._pa_stream,
+ audio_data.data,
+ length,
+ pa.pa_free_cb_t(0), # Data is copied
+ 0,
+ seek_mode)
+ )
+ if _debug:
+ print('PulseAudioStream: writable size after write {} bytes'.format(self.writable_size))
+ self.underflow = False
+ return length
+
+ def update_timing_info(self, callback=None):
+ assert self._pa_stream is not None
+ op = PulseAudioOperation(self.context, callback)
+ op.execute(
+ pa.pa_stream_update_timing_info(self._pa_stream,
+ op.pa_callback,
+ None)
+ )
+ return op
+
+ def get_timing_info(self):
+ assert self._pa_stream is not None
+ timing_info = self.context.check_ptr_not_null(
+ pa.pa_stream_get_timing_info(self._pa_stream)
+ )
+ return timing_info.contents
+
+ def trigger(self, callback=None):
+ assert self._pa_stream is not None
+ op = PulseAudioOperation(self.context)
+ op.execute(
+ pa.pa_stream_trigger(self._pa_stream,
+ op.pa_callback,
+ None)
+ )
+ return op
+
+ def prebuf(self, callback=None):
+ assert self._pa_stream is not None
+ op = PulseAudioOperation(self.context)
+ op.execute(
+ pa.pa_stream_prebuf(self._pa_stream,
+ op.pa_callback,
+ None)
+ )
+ return op
+
+ def resume(self, callback=None):
+ return self._cork(False, callback)
+
+ def pause(self, callback=None):
+ return self._cork(True, callback)
+
+ def update_sample_rate(self, sample_rate, callback=None):
+ assert self._pa_stream is not None
+ op = PulseAudioOperation(self.context)
+ op.execute(
+ pa.pa_stream_update_sample_rate(self._pa_stream,
+ int(sample_rate),
+ op.pa_callback,
+ None)
+ )
+ return op
+
+ def _cork(self, pause, callback):
+ assert self._pa_stream is not None
+ op = PulseAudioOperation(self.context)
+ op.execute(
+ pa.pa_stream_cork(self._pa_stream,
+ 1 if pause else 0,
+ op.pa_callback,
+ None)
+ )
+ return op
+
+ def _connect_callbacks(self):
+ self._cb_underflow = pa.pa_stream_notify_cb_t(self._underflow_callback)
+ self._cb_write = pa.pa_stream_request_cb_t(self._write_callback)
+ self._cb_state = pa.pa_stream_notify_cb_t(self._state_callback)
+
+ pa.pa_stream_set_underflow_callback(self._pa_stream, self._cb_underflow, None)
+ pa.pa_stream_set_write_callback(self._pa_stream, self._cb_write, None)
+ pa.pa_stream_set_state_callback(self._pa_stream, self._cb_state, None)
+
+ def _underflow_callback(self, stream, userdata):
+ if _debug:
+ print("PulseAudioStream: underflow")
+ self.underflow = True
+ self._write_needed()
+ self.signal()
+
+ def _write_callback(self, stream, nbytes, userdata):
+ if _debug:
+ print("PulseAudioStream: write requested")
+ self._write_needed(nbytes)
+ self.signal()
+
+ def _state_callback(self, stream, userdata):
+ self._refresh_state()
+ if _debug:
+ print("PulseAudioStream: state changed to {}".format(self._state_name[self.state]))
+ self.signal()
+
+ def _refresh_state(self):
+ if self._pa_stream is not None:
+ self.state = pa.pa_stream_get_state(self._pa_stream)
+
+ def _write_needed(self, nbytes=None):
+ if nbytes is None:
+ nbytes = self.writable_size
+ ret = self.dispatch_event('on_write_needed', nbytes, self.underflow)
+
+ def on_write_needed(self, nbytes, underflow):
+ """A write is requested from PulseAudio.
+ Called from the PulseAudio mainloop, so no locking required.
+
+ :event:
+ """
+
+PulseAudioStream.register_event_type('on_write_needed')
+
+
+class PulseAudioOperation(PulseAudioLockable):
+ """Asynchronous PulseAudio operation"""
+
+ _state_name = {pa.PA_OPERATION_RUNNING: 'Running',
+ pa.PA_OPERATION_DONE: 'Done',
+ pa.PA_OPERATION_CANCELLED: 'Cancelled'}
+
+ def __init__(self, context, callback=None, pa_operation=None):
+ PulseAudioLockable.__init__(self, context.mainloop)
+ self.context = context
+ self._callback = callback
+ self.pa_callback = pa.pa_stream_success_cb_t(self._success_callback)
+ if pa_operation is not None:
+ self.execute(pa_operation)
+ else:
+ self._pa_operation = None
+
+ def __del__(self):
+ if self._pa_operation is not None:
+ with self:
+ self.delete()
+
+ def delete(self):
+ if self._pa_operation is not None:
+ if _debug:
+ print("PulseAudioOperation.delete({})".format(id(self)))
+ pa.pa_operation_unref(self._pa_operation)
+ self._pa_operation = None
+
+ def execute(self, pa_operation):
+ self.context.check_ptr_not_null(pa_operation)
+ if _debug:
+ print("PulseAudioOperation.execute({})".format(id(self)))
+ self._pa_operation = pa_operation
+ self._get_state()
+ return self
+
+ def cancel(self):
+ assert self._pa_operation is not None
+ pa.pa_operation_cancel(self._pa_operation)
+ return self
+
+ @property
+ def is_running(self):
+ return self._get_state() == pa.PA_OPERATION_RUNNING
+
+ @property
+ def is_done(self):
+ return self._get_state() == pa.PA_OPERATION_DONE
+
+ @property
+ def is_cancelled(self):
+ return self._get_state() == pa.PA_OPERATION_CANCELLED
+
+ def wait(self):
+ """Wait until operation is either done or cancelled."""
+ while self.is_running:
+ super(PulseAudioOperation, self).wait()
+ return self
+
+ def _get_state(self):
+ assert self._pa_operation is not None
+ return pa.pa_operation_get_state(self._pa_operation)
+
+ def _success_callback(self, stream, success, userdata):
+ if self._callback:
+ self._callback()
+ self.pa_callback = None # Clean up callback, not called anymore
+ self.signal()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/pulse/lib_pulseaudio.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/pulse/lib_pulseaudio.py
new file mode 100644
index 0000000..73ca198
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/pulse/lib_pulseaudio.py
@@ -0,0 +1,2950 @@
+'''Wrapper for pulse
+
+Generated with:
+tools/genwrappers.py pulseaudio
+
+Do not modify this file.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import ctypes
+from ctypes import *
+
+import pyglet.lib
+
+_lib = pyglet.lib.load_library('pulse')
+
+_int_types = (c_int16, c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (ctypes.c_int64,)
+for t in _int_types:
+ if sizeof(t) == sizeof(c_size_t):
+ c_ptrdiff_t = t
+
+class c_void(Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', c_int)]
+
+
+
+# /usr/include/pulse/version.h:40
+pa_get_library_version = _lib.pa_get_library_version
+pa_get_library_version.restype = c_char_p
+pa_get_library_version.argtypes = []
+
+PA_API_VERSION = 12 # /usr/include/pulse/version.h:46
+PA_PROTOCOL_VERSION = 30 # /usr/include/pulse/version.h:50
+PA_MAJOR = 6 # /usr/include/pulse/version.h:53
+PA_MINOR = 0 # /usr/include/pulse/version.h:56
+PA_MICRO = 0 # /usr/include/pulse/version.h:59
+PA_CHANNELS_MAX = 32 # /usr/include/pulse/sample.h:128
+PA_RATE_MAX = 192000 # /usr/include/pulse/sample.h:131
+enum_pa_sample_format = c_int
+PA_SAMPLE_U8 = 0
+PA_SAMPLE_ALAW = 1
+PA_SAMPLE_ULAW = 2
+PA_SAMPLE_S16LE = 3
+PA_SAMPLE_S16BE = 4
+PA_SAMPLE_FLOAT32LE = 5
+PA_SAMPLE_FLOAT32BE = 6
+PA_SAMPLE_S32LE = 7
+PA_SAMPLE_S32BE = 8
+PA_SAMPLE_S24LE = 9
+PA_SAMPLE_S24BE = 10
+PA_SAMPLE_S24_32LE = 11
+PA_SAMPLE_S24_32BE = 12
+PA_SAMPLE_MAX = 13
+PA_SAMPLE_INVALID = -1
+pa_sample_format_t = enum_pa_sample_format # /usr/include/pulse/sample.h:179
+class struct_pa_sample_spec(Structure):
+ __slots__ = [
+ 'format',
+ 'rate',
+ 'channels',
+ ]
+struct_pa_sample_spec._fields_ = [
+ ('format', pa_sample_format_t),
+ ('rate', c_uint32),
+ ('channels', c_uint8),
+]
+
+pa_sample_spec = struct_pa_sample_spec # /usr/include/pulse/sample.h:257
+pa_usec_t = c_uint64 # /usr/include/pulse/sample.h:260
+# /usr/include/pulse/sample.h:263
+pa_bytes_per_second = _lib.pa_bytes_per_second
+pa_bytes_per_second.restype = c_size_t
+pa_bytes_per_second.argtypes = [POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/sample.h:266
+pa_frame_size = _lib.pa_frame_size
+pa_frame_size.restype = c_size_t
+pa_frame_size.argtypes = [POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/sample.h:269
+pa_sample_size = _lib.pa_sample_size
+pa_sample_size.restype = c_size_t
+pa_sample_size.argtypes = [POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/sample.h:273
+pa_sample_size_of_format = _lib.pa_sample_size_of_format
+pa_sample_size_of_format.restype = c_size_t
+pa_sample_size_of_format.argtypes = [pa_sample_format_t]
+
+# /usr/include/pulse/sample.h:278
+pa_bytes_to_usec = _lib.pa_bytes_to_usec
+pa_bytes_to_usec.restype = pa_usec_t
+pa_bytes_to_usec.argtypes = [c_uint64, POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/sample.h:283
+pa_usec_to_bytes = _lib.pa_usec_to_bytes
+pa_usec_to_bytes.restype = c_size_t
+pa_usec_to_bytes.argtypes = [pa_usec_t, POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/sample.h:288
+pa_sample_spec_init = _lib.pa_sample_spec_init
+pa_sample_spec_init.restype = POINTER(pa_sample_spec)
+pa_sample_spec_init.argtypes = [POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/sample.h:291
+pa_sample_format_valid = _lib.pa_sample_format_valid
+pa_sample_format_valid.restype = c_int
+pa_sample_format_valid.argtypes = [c_uint]
+
+# /usr/include/pulse/sample.h:294
+pa_sample_rate_valid = _lib.pa_sample_rate_valid
+pa_sample_rate_valid.restype = c_int
+pa_sample_rate_valid.argtypes = [c_uint32]
+
+# /usr/include/pulse/sample.h:298
+pa_channels_valid = _lib.pa_channels_valid
+pa_channels_valid.restype = c_int
+pa_channels_valid.argtypes = [c_uint8]
+
+# /usr/include/pulse/sample.h:301
+pa_sample_spec_valid = _lib.pa_sample_spec_valid
+pa_sample_spec_valid.restype = c_int
+pa_sample_spec_valid.argtypes = [POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/sample.h:304
+pa_sample_spec_equal = _lib.pa_sample_spec_equal
+pa_sample_spec_equal.restype = c_int
+pa_sample_spec_equal.argtypes = [POINTER(pa_sample_spec), POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/sample.h:307
+pa_sample_format_to_string = _lib.pa_sample_format_to_string
+pa_sample_format_to_string.restype = c_char_p
+pa_sample_format_to_string.argtypes = [pa_sample_format_t]
+
+# /usr/include/pulse/sample.h:310
+pa_parse_sample_format = _lib.pa_parse_sample_format
+pa_parse_sample_format.restype = pa_sample_format_t
+pa_parse_sample_format.argtypes = [c_char_p]
+
+PA_SAMPLE_SPEC_SNPRINT_MAX = 32 # /usr/include/pulse/sample.h:317
+# /usr/include/pulse/sample.h:320
+pa_sample_spec_snprint = _lib.pa_sample_spec_snprint
+pa_sample_spec_snprint.restype = c_char_p
+pa_sample_spec_snprint.argtypes = [c_char_p, c_size_t, POINTER(pa_sample_spec)]
+
+PA_BYTES_SNPRINT_MAX = 11 # /usr/include/pulse/sample.h:327
+# /usr/include/pulse/sample.h:330
+pa_bytes_snprint = _lib.pa_bytes_snprint
+pa_bytes_snprint.restype = c_char_p
+pa_bytes_snprint.argtypes = [c_char_p, c_size_t, c_uint]
+
+# /usr/include/pulse/sample.h:334
+pa_sample_format_is_le = _lib.pa_sample_format_is_le
+pa_sample_format_is_le.restype = c_int
+pa_sample_format_is_le.argtypes = [pa_sample_format_t]
+
+# /usr/include/pulse/sample.h:338
+pa_sample_format_is_be = _lib.pa_sample_format_is_be
+pa_sample_format_is_be.restype = c_int
+pa_sample_format_is_be.argtypes = [pa_sample_format_t]
+
+enum_pa_context_state = c_int
+PA_CONTEXT_UNCONNECTED = 0
+PA_CONTEXT_CONNECTING = 1
+PA_CONTEXT_AUTHORIZING = 2
+PA_CONTEXT_SETTING_NAME = 3
+PA_CONTEXT_READY = 4
+PA_CONTEXT_FAILED = 5
+PA_CONTEXT_TERMINATED = 6
+pa_context_state_t = enum_pa_context_state # /usr/include/pulse/def.h:45
+enum_pa_stream_state = c_int
+PA_STREAM_UNCONNECTED = 0
+PA_STREAM_CREATING = 1
+PA_STREAM_READY = 2
+PA_STREAM_FAILED = 3
+PA_STREAM_TERMINATED = 4
+pa_stream_state_t = enum_pa_stream_state # /usr/include/pulse/def.h:74
+enum_pa_operation_state = c_int
+PA_OPERATION_RUNNING = 0
+PA_OPERATION_DONE = 1
+PA_OPERATION_CANCELLED = 2
+pa_operation_state_t = enum_pa_operation_state # /usr/include/pulse/def.h:102
+enum_pa_context_flags = c_int
+PA_CONTEXT_NOFLAGS = 0
+PA_CONTEXT_NOAUTOSPAWN = 1
+PA_CONTEXT_NOFAIL = 2
+pa_context_flags_t = enum_pa_context_flags # /usr/include/pulse/def.h:122
+enum_pa_direction = c_int
+PA_DIRECTION_OUTPUT = 1
+PA_DIRECTION_INPUT = 2
+pa_direction_t = enum_pa_direction # /usr/include/pulse/def.h:137
+enum_pa_device_type = c_int
+PA_DEVICE_TYPE_SINK = 0
+PA_DEVICE_TYPE_SOURCE = 1
+pa_device_type_t = enum_pa_device_type # /usr/include/pulse/def.h:148
+enum_pa_stream_direction = c_int
+PA_STREAM_NODIRECTION = 0
+PA_STREAM_PLAYBACK = 1
+PA_STREAM_RECORD = 2
+PA_STREAM_UPLOAD = 3
+pa_stream_direction_t = enum_pa_stream_direction # /usr/include/pulse/def.h:161
+enum_pa_stream_flags = c_int
+PA_STREAM_NOFLAGS = 0
+PA_STREAM_START_CORKED = 1
+PA_STREAM_INTERPOLATE_TIMING = 2
+PA_STREAM_NOT_MONOTONIC = 4
+PA_STREAM_AUTO_TIMING_UPDATE = 8
+PA_STREAM_NO_REMAP_CHANNELS = 16
+PA_STREAM_NO_REMIX_CHANNELS = 32
+PA_STREAM_FIX_FORMAT = 64
+PA_STREAM_FIX_RATE = 128
+PA_STREAM_FIX_CHANNELS = 256
+PA_STREAM_DONT_MOVE = 512
+PA_STREAM_VARIABLE_RATE = 1024
+PA_STREAM_PEAK_DETECT = 2048
+PA_STREAM_START_MUTED = 4096
+PA_STREAM_ADJUST_LATENCY = 8192
+PA_STREAM_EARLY_REQUESTS = 16384
+PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND = 32768
+PA_STREAM_START_UNMUTED = 65536
+PA_STREAM_FAIL_ON_SUSPEND = 131072
+PA_STREAM_RELATIVE_VOLUME = 262144
+PA_STREAM_PASSTHROUGH = 524288
+pa_stream_flags_t = enum_pa_stream_flags # /usr/include/pulse/def.h:355
+class struct_pa_buffer_attr(Structure):
+ __slots__ = [
+ 'maxlength',
+ 'tlength',
+ 'prebuf',
+ 'minreq',
+ 'fragsize',
+ ]
+struct_pa_buffer_attr._fields_ = [
+ ('maxlength', c_uint32),
+ ('tlength', c_uint32),
+ ('prebuf', c_uint32),
+ ('minreq', c_uint32),
+ ('fragsize', c_uint32),
+]
+
+pa_buffer_attr = struct_pa_buffer_attr # /usr/include/pulse/def.h:452
+enum_pa_error_code = c_int
+PA_OK = 0
+PA_ERR_ACCESS = 1
+PA_ERR_COMMAND = 2
+PA_ERR_INVALID = 3
+PA_ERR_EXIST = 4
+PA_ERR_NOENTITY = 5
+PA_ERR_CONNECTIONREFUSED = 6
+PA_ERR_PROTOCOL = 7
+PA_ERR_TIMEOUT = 8
+PA_ERR_AUTHKEY = 9
+PA_ERR_INTERNAL = 10
+PA_ERR_CONNECTIONTERMINATED = 11
+PA_ERR_KILLED = 12
+PA_ERR_INVALIDSERVER = 13
+PA_ERR_MODINITFAILED = 14
+PA_ERR_BADSTATE = 15
+PA_ERR_NODATA = 16
+PA_ERR_VERSION = 17
+PA_ERR_TOOLARGE = 18
+PA_ERR_NOTSUPPORTED = 19
+PA_ERR_UNKNOWN = 20
+PA_ERR_NOEXTENSION = 21
+PA_ERR_OBSOLETE = 22
+PA_ERR_NOTIMPLEMENTED = 23
+PA_ERR_FORKED = 24
+PA_ERR_IO = 25
+PA_ERR_BUSY = 26
+PA_ERR_MAX = 27
+pa_error_code_t = enum_pa_error_code # /usr/include/pulse/def.h:484
+enum_pa_subscription_mask = c_int
+PA_SUBSCRIPTION_MASK_NULL = 0
+PA_SUBSCRIPTION_MASK_SINK = 1
+PA_SUBSCRIPTION_MASK_SOURCE = 2
+PA_SUBSCRIPTION_MASK_SINK_INPUT = 4
+PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT = 8
+PA_SUBSCRIPTION_MASK_MODULE = 16
+PA_SUBSCRIPTION_MASK_CLIENT = 32
+PA_SUBSCRIPTION_MASK_SAMPLE_CACHE = 64
+PA_SUBSCRIPTION_MASK_SERVER = 128
+PA_SUBSCRIPTION_MASK_AUTOLOAD = 256
+PA_SUBSCRIPTION_MASK_CARD = 512
+PA_SUBSCRIPTION_MASK_ALL = 767
+pa_subscription_mask_t = enum_pa_subscription_mask # /usr/include/pulse/def.h:554
+enum_pa_subscription_event_type = c_int
+PA_SUBSCRIPTION_EVENT_SINK = 0
+PA_SUBSCRIPTION_EVENT_SOURCE = 1
+PA_SUBSCRIPTION_EVENT_SINK_INPUT = 2
+PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT = 3
+PA_SUBSCRIPTION_EVENT_MODULE = 4
+PA_SUBSCRIPTION_EVENT_CLIENT = 5
+PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE = 6
+PA_SUBSCRIPTION_EVENT_SERVER = 7
+PA_SUBSCRIPTION_EVENT_AUTOLOAD = 8
+PA_SUBSCRIPTION_EVENT_CARD = 9
+PA_SUBSCRIPTION_EVENT_FACILITY_MASK = 15
+PA_SUBSCRIPTION_EVENT_NEW = 0
+PA_SUBSCRIPTION_EVENT_CHANGE = 16
+PA_SUBSCRIPTION_EVENT_REMOVE = 32
+PA_SUBSCRIPTION_EVENT_TYPE_MASK = 48
+pa_subscription_event_type_t = enum_pa_subscription_event_type # /usr/include/pulse/def.h:605
+class struct_pa_timing_info(Structure):
+ __slots__ = [
+ 'timestamp',
+ 'synchronized_clocks',
+ 'sink_usec',
+ 'source_usec',
+ 'transport_usec',
+ 'playing',
+ 'write_index_corrupt',
+ 'write_index',
+ 'read_index_corrupt',
+ 'read_index',
+ 'configured_sink_usec',
+ 'configured_source_usec',
+ 'since_underrun',
+ ]
+class struct_timeval(Structure):
+ __slots__ = [
+ ]
+struct_timeval._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+struct_pa_timing_info._fields_ = [
+ ('timestamp', struct_timeval),
+ ('synchronized_clocks', c_int),
+ ('sink_usec', pa_usec_t),
+ ('source_usec', pa_usec_t),
+ ('transport_usec', pa_usec_t),
+ ('playing', c_int),
+ ('write_index_corrupt', c_int),
+ ('write_index', c_int64),
+ ('read_index_corrupt', c_int),
+ ('read_index', c_int64),
+ ('configured_sink_usec', pa_usec_t),
+ ('configured_source_usec', pa_usec_t),
+ ('since_underrun', c_int64),
+]
+
+pa_timing_info = struct_pa_timing_info # /usr/include/pulse/def.h:725
+class struct_pa_spawn_api(Structure):
+ __slots__ = [
+ 'prefork',
+ 'postfork',
+ 'atfork',
+ ]
+struct_pa_spawn_api._fields_ = [
+ ('prefork', POINTER(CFUNCTYPE(None))),
+ ('postfork', POINTER(CFUNCTYPE(None))),
+ ('atfork', POINTER(CFUNCTYPE(None))),
+]
+
+pa_spawn_api = struct_pa_spawn_api # /usr/include/pulse/def.h:749
+enum_pa_seek_mode = c_int
+PA_SEEK_RELATIVE = 0
+PA_SEEK_ABSOLUTE = 1
+PA_SEEK_RELATIVE_ON_READ = 2
+PA_SEEK_RELATIVE_END = 3
+pa_seek_mode_t = enum_pa_seek_mode # /usr/include/pulse/def.h:764
+enum_pa_sink_flags = c_int
+PA_SINK_NOFLAGS = 0
+PA_SINK_HW_VOLUME_CTRL = 1
+PA_SINK_LATENCY = 2
+PA_SINK_HARDWARE = 4
+PA_SINK_NETWORK = 8
+PA_SINK_HW_MUTE_CTRL = 16
+PA_SINK_DECIBEL_VOLUME = 32
+PA_SINK_FLAT_VOLUME = 64
+PA_SINK_DYNAMIC_LATENCY = 128
+PA_SINK_SET_FORMATS = 256
+pa_sink_flags_t = enum_pa_sink_flags # /usr/include/pulse/def.h:829
+enum_pa_sink_state = c_int
+PA_SINK_INVALID_STATE = -1
+PA_SINK_RUNNING = 0
+PA_SINK_IDLE = 1
+PA_SINK_SUSPENDED = 2
+PA_SINK_INIT = -2
+PA_SINK_UNLINKED = -3
+pa_sink_state_t = enum_pa_sink_state # /usr/include/pulse/def.h:875
+enum_pa_source_flags = c_int
+PA_SOURCE_NOFLAGS = 0
+PA_SOURCE_HW_VOLUME_CTRL = 1
+PA_SOURCE_LATENCY = 2
+PA_SOURCE_HARDWARE = 4
+PA_SOURCE_NETWORK = 8
+PA_SOURCE_HW_MUTE_CTRL = 16
+PA_SOURCE_DECIBEL_VOLUME = 32
+PA_SOURCE_DYNAMIC_LATENCY = 64
+PA_SOURCE_FLAT_VOLUME = 128
+pa_source_flags_t = enum_pa_source_flags # /usr/include/pulse/def.h:946
+enum_pa_source_state = c_int
+PA_SOURCE_INVALID_STATE = -1
+PA_SOURCE_RUNNING = 0
+PA_SOURCE_IDLE = 1
+PA_SOURCE_SUSPENDED = 2
+PA_SOURCE_INIT = -2
+PA_SOURCE_UNLINKED = -3
+pa_source_state_t = enum_pa_source_state # /usr/include/pulse/def.h:991
+pa_free_cb_t = CFUNCTYPE(None, POINTER(None)) # /usr/include/pulse/def.h:1014
+enum_pa_port_available = c_int
+PA_PORT_AVAILABLE_UNKNOWN = 0
+PA_PORT_AVAILABLE_NO = 1
+PA_PORT_AVAILABLE_YES = 2
+pa_port_available_t = enum_pa_port_available # /usr/include/pulse/def.h:1040
+class struct_pa_mainloop_api(Structure):
+ __slots__ = [
+ ]
+struct_pa_mainloop_api._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_pa_mainloop_api(Structure):
+ __slots__ = [
+ ]
+struct_pa_mainloop_api._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_mainloop_api = struct_pa_mainloop_api # /usr/include/pulse/mainloop-api.h:47
+enum_pa_io_event_flags = c_int
+PA_IO_EVENT_NULL = 0
+PA_IO_EVENT_INPUT = 1
+PA_IO_EVENT_OUTPUT = 2
+PA_IO_EVENT_HANGUP = 4
+PA_IO_EVENT_ERROR = 8
+pa_io_event_flags_t = enum_pa_io_event_flags # /usr/include/pulse/mainloop-api.h:56
+class struct_pa_io_event(Structure):
+ __slots__ = [
+ ]
+struct_pa_io_event._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_pa_io_event(Structure):
+ __slots__ = [
+ ]
+struct_pa_io_event._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_io_event = struct_pa_io_event # /usr/include/pulse/mainloop-api.h:59
+pa_io_event_cb_t = CFUNCTYPE(None, POINTER(pa_mainloop_api), POINTER(pa_io_event), c_int, pa_io_event_flags_t, POINTER(None)) # /usr/include/pulse/mainloop-api.h:61
+pa_io_event_destroy_cb_t = CFUNCTYPE(None, POINTER(pa_mainloop_api), POINTER(pa_io_event), POINTER(None)) # /usr/include/pulse/mainloop-api.h:63
+class struct_pa_time_event(Structure):
+ __slots__ = [
+ ]
+struct_pa_time_event._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_pa_time_event(Structure):
+ __slots__ = [
+ ]
+struct_pa_time_event._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_time_event = struct_pa_time_event # /usr/include/pulse/mainloop-api.h:66
+class struct_timeval(Structure):
+ __slots__ = [
+ ]
+struct_timeval._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_timeval(Structure):
+ __slots__ = [
+ ]
+struct_timeval._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_time_event_cb_t = CFUNCTYPE(None, POINTER(pa_mainloop_api), POINTER(pa_time_event), POINTER(struct_timeval), POINTER(None)) # /usr/include/pulse/mainloop-api.h:68
+pa_time_event_destroy_cb_t = CFUNCTYPE(None, POINTER(pa_mainloop_api), POINTER(pa_time_event), POINTER(None)) # /usr/include/pulse/mainloop-api.h:70
+class struct_pa_defer_event(Structure):
+ __slots__ = [
+ ]
+struct_pa_defer_event._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_pa_defer_event(Structure):
+ __slots__ = [
+ ]
+struct_pa_defer_event._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_defer_event = struct_pa_defer_event # /usr/include/pulse/mainloop-api.h:73
+pa_defer_event_cb_t = CFUNCTYPE(None, POINTER(pa_mainloop_api), POINTER(pa_defer_event), POINTER(None)) # /usr/include/pulse/mainloop-api.h:75
+pa_defer_event_destroy_cb_t = CFUNCTYPE(None, POINTER(pa_mainloop_api), POINTER(pa_defer_event), POINTER(None)) # /usr/include/pulse/mainloop-api.h:77
+# /usr/include/pulse/mainloop-api.h:120
+pa_mainloop_api_once = _lib.pa_mainloop_api_once
+pa_mainloop_api_once.restype = None
+pa_mainloop_api_once.argtypes = [POINTER(pa_mainloop_api), CFUNCTYPE(None, POINTER(pa_mainloop_api), POINTER(None)), POINTER(None)]
+
+enum_pa_channel_position = c_int
+PA_CHANNEL_POSITION_INVALID = -1
+PA_CHANNEL_POSITION_MONO = 0
+PA_CHANNEL_POSITION_FRONT_LEFT = 1
+PA_CHANNEL_POSITION_FRONT_RIGHT = 2
+PA_CHANNEL_POSITION_FRONT_CENTER = 3
+PA_CHANNEL_POSITION_LEFT = 0
+PA_CHANNEL_POSITION_RIGHT = 0
+PA_CHANNEL_POSITION_CENTER = 0
+PA_CHANNEL_POSITION_REAR_CENTER = 1
+PA_CHANNEL_POSITION_REAR_LEFT = 2
+PA_CHANNEL_POSITION_REAR_RIGHT = 3
+PA_CHANNEL_POSITION_LFE = 4
+PA_CHANNEL_POSITION_SUBWOOFER = 0
+PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER = 1
+PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER = 2
+PA_CHANNEL_POSITION_SIDE_LEFT = 3
+PA_CHANNEL_POSITION_SIDE_RIGHT = 4
+PA_CHANNEL_POSITION_AUX0 = 5
+PA_CHANNEL_POSITION_AUX1 = 6
+PA_CHANNEL_POSITION_AUX2 = 7
+PA_CHANNEL_POSITION_AUX3 = 8
+PA_CHANNEL_POSITION_AUX4 = 9
+PA_CHANNEL_POSITION_AUX5 = 10
+PA_CHANNEL_POSITION_AUX6 = 11
+PA_CHANNEL_POSITION_AUX7 = 12
+PA_CHANNEL_POSITION_AUX8 = 13
+PA_CHANNEL_POSITION_AUX9 = 14
+PA_CHANNEL_POSITION_AUX10 = 15
+PA_CHANNEL_POSITION_AUX11 = 16
+PA_CHANNEL_POSITION_AUX12 = 17
+PA_CHANNEL_POSITION_AUX13 = 18
+PA_CHANNEL_POSITION_AUX14 = 19
+PA_CHANNEL_POSITION_AUX15 = 20
+PA_CHANNEL_POSITION_AUX16 = 21
+PA_CHANNEL_POSITION_AUX17 = 22
+PA_CHANNEL_POSITION_AUX18 = 23
+PA_CHANNEL_POSITION_AUX19 = 24
+PA_CHANNEL_POSITION_AUX20 = 25
+PA_CHANNEL_POSITION_AUX21 = 26
+PA_CHANNEL_POSITION_AUX22 = 27
+PA_CHANNEL_POSITION_AUX23 = 28
+PA_CHANNEL_POSITION_AUX24 = 29
+PA_CHANNEL_POSITION_AUX25 = 30
+PA_CHANNEL_POSITION_AUX26 = 31
+PA_CHANNEL_POSITION_AUX27 = 32
+PA_CHANNEL_POSITION_AUX28 = 33
+PA_CHANNEL_POSITION_AUX29 = 34
+PA_CHANNEL_POSITION_AUX30 = 35
+PA_CHANNEL_POSITION_AUX31 = 36
+PA_CHANNEL_POSITION_TOP_CENTER = 37
+PA_CHANNEL_POSITION_TOP_FRONT_LEFT = 38
+PA_CHANNEL_POSITION_TOP_FRONT_RIGHT = 39
+PA_CHANNEL_POSITION_TOP_FRONT_CENTER = 40
+PA_CHANNEL_POSITION_TOP_REAR_LEFT = 41
+PA_CHANNEL_POSITION_TOP_REAR_RIGHT = 42
+PA_CHANNEL_POSITION_TOP_REAR_CENTER = 43
+PA_CHANNEL_POSITION_MAX = 44
+pa_channel_position_t = enum_pa_channel_position # /usr/include/pulse/channelmap.h:147
+pa_channel_position_mask_t = c_uint64 # /usr/include/pulse/channelmap.h:210
+enum_pa_channel_map_def = c_int
+PA_CHANNEL_MAP_AIFF = 0
+PA_CHANNEL_MAP_ALSA = 1
+PA_CHANNEL_MAP_AUX = 2
+PA_CHANNEL_MAP_WAVEEX = 3
+PA_CHANNEL_MAP_OSS = 4
+PA_CHANNEL_MAP_DEF_MAX = 5
+PA_CHANNEL_MAP_DEFAULT = 0
+pa_channel_map_def_t = enum_pa_channel_map_def # /usr/include/pulse/channelmap.h:247
+class struct_pa_channel_map(Structure):
+ __slots__ = [
+ 'channels',
+ 'map',
+ ]
+struct_pa_channel_map._fields_ = [
+ ('channels', c_uint8),
+ ('map', pa_channel_position_t * 32),
+]
+
+pa_channel_map = struct_pa_channel_map # /usr/include/pulse/channelmap.h:268
+# /usr/include/pulse/channelmap.h:273
+pa_channel_map_init = _lib.pa_channel_map_init
+pa_channel_map_init.restype = POINTER(pa_channel_map)
+pa_channel_map_init.argtypes = [POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:276
+pa_channel_map_init_mono = _lib.pa_channel_map_init_mono
+pa_channel_map_init_mono.restype = POINTER(pa_channel_map)
+pa_channel_map_init_mono.argtypes = [POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:279
+pa_channel_map_init_stereo = _lib.pa_channel_map_init_stereo
+pa_channel_map_init_stereo.restype = POINTER(pa_channel_map)
+pa_channel_map_init_stereo.argtypes = [POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:285
+pa_channel_map_init_auto = _lib.pa_channel_map_init_auto
+pa_channel_map_init_auto.restype = POINTER(pa_channel_map)
+pa_channel_map_init_auto.argtypes = [POINTER(pa_channel_map), c_uint, pa_channel_map_def_t]
+
+# /usr/include/pulse/channelmap.h:291
+pa_channel_map_init_extend = _lib.pa_channel_map_init_extend
+pa_channel_map_init_extend.restype = POINTER(pa_channel_map)
+pa_channel_map_init_extend.argtypes = [POINTER(pa_channel_map), c_uint, pa_channel_map_def_t]
+
+# /usr/include/pulse/channelmap.h:294
+pa_channel_position_to_string = _lib.pa_channel_position_to_string
+pa_channel_position_to_string.restype = c_char_p
+pa_channel_position_to_string.argtypes = [pa_channel_position_t]
+
+# /usr/include/pulse/channelmap.h:297
+pa_channel_position_from_string = _lib.pa_channel_position_from_string
+pa_channel_position_from_string.restype = pa_channel_position_t
+pa_channel_position_from_string.argtypes = [c_char_p]
+
+# /usr/include/pulse/channelmap.h:300
+pa_channel_position_to_pretty_string = _lib.pa_channel_position_to_pretty_string
+pa_channel_position_to_pretty_string.restype = c_char_p
+pa_channel_position_to_pretty_string.argtypes = [pa_channel_position_t]
+
+PA_CHANNEL_MAP_SNPRINT_MAX = 336 # /usr/include/pulse/channelmap.h:307
+# /usr/include/pulse/channelmap.h:310
+pa_channel_map_snprint = _lib.pa_channel_map_snprint
+pa_channel_map_snprint.restype = c_char_p
+pa_channel_map_snprint.argtypes = [c_char_p, c_size_t, POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:316
+pa_channel_map_parse = _lib.pa_channel_map_parse
+pa_channel_map_parse.restype = POINTER(pa_channel_map)
+pa_channel_map_parse.argtypes = [POINTER(pa_channel_map), c_char_p]
+
+# /usr/include/pulse/channelmap.h:319
+pa_channel_map_equal = _lib.pa_channel_map_equal
+pa_channel_map_equal.restype = c_int
+pa_channel_map_equal.argtypes = [POINTER(pa_channel_map), POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:322
+pa_channel_map_valid = _lib.pa_channel_map_valid
+pa_channel_map_valid.restype = c_int
+pa_channel_map_valid.argtypes = [POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:326
+pa_channel_map_compatible = _lib.pa_channel_map_compatible
+pa_channel_map_compatible.restype = c_int
+pa_channel_map_compatible.argtypes = [POINTER(pa_channel_map), POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/channelmap.h:329
+pa_channel_map_superset = _lib.pa_channel_map_superset
+pa_channel_map_superset.restype = c_int
+pa_channel_map_superset.argtypes = [POINTER(pa_channel_map), POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:334
+pa_channel_map_can_balance = _lib.pa_channel_map_can_balance
+pa_channel_map_can_balance.restype = c_int
+pa_channel_map_can_balance.argtypes = [POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:339
+pa_channel_map_can_fade = _lib.pa_channel_map_can_fade
+pa_channel_map_can_fade.restype = c_int
+pa_channel_map_can_fade.argtypes = [POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:345
+pa_channel_map_to_name = _lib.pa_channel_map_to_name
+pa_channel_map_to_name.restype = c_char_p
+pa_channel_map_to_name.argtypes = [POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:350
+pa_channel_map_to_pretty_name = _lib.pa_channel_map_to_pretty_name
+pa_channel_map_to_pretty_name.restype = c_char_p
+pa_channel_map_to_pretty_name.argtypes = [POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:354
+pa_channel_map_has_position = _lib.pa_channel_map_has_position
+pa_channel_map_has_position.restype = c_int
+pa_channel_map_has_position.argtypes = [POINTER(pa_channel_map), pa_channel_position_t]
+
+# /usr/include/pulse/channelmap.h:357
+pa_channel_map_mask = _lib.pa_channel_map_mask
+pa_channel_map_mask.restype = pa_channel_position_mask_t
+pa_channel_map_mask.argtypes = [POINTER(pa_channel_map)]
+
+class struct_pa_operation(Structure):
+ __slots__ = [
+ ]
+struct_pa_operation._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_pa_operation(Structure):
+ __slots__ = [
+ ]
+struct_pa_operation._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_operation = struct_pa_operation # /usr/include/pulse/operation.h:33
+pa_operation_notify_cb_t = CFUNCTYPE(None, POINTER(pa_operation), POINTER(None)) # /usr/include/pulse/operation.h:36
+# /usr/include/pulse/operation.h:39
+pa_operation_ref = _lib.pa_operation_ref
+pa_operation_ref.restype = POINTER(pa_operation)
+pa_operation_ref.argtypes = [POINTER(pa_operation)]
+
+# /usr/include/pulse/operation.h:42
+pa_operation_unref = _lib.pa_operation_unref
+pa_operation_unref.restype = None
+pa_operation_unref.argtypes = [POINTER(pa_operation)]
+
+# /usr/include/pulse/operation.h:49
+pa_operation_cancel = _lib.pa_operation_cancel
+pa_operation_cancel.restype = None
+pa_operation_cancel.argtypes = [POINTER(pa_operation)]
+
+# /usr/include/pulse/operation.h:52
+pa_operation_get_state = _lib.pa_operation_get_state
+pa_operation_get_state.restype = pa_operation_state_t
+pa_operation_get_state.argtypes = [POINTER(pa_operation)]
+
+# /usr/include/pulse/operation.h:60
+pa_operation_set_state_callback = _lib.pa_operation_set_state_callback
+pa_operation_set_state_callback.restype = None
+pa_operation_set_state_callback.argtypes = [POINTER(pa_operation), pa_operation_notify_cb_t, POINTER(None)]
+
+class struct_pa_context(Structure):
+ __slots__ = [
+ ]
+struct_pa_context._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_pa_context(Structure):
+ __slots__ = [
+ ]
+struct_pa_context._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_context = struct_pa_context # /usr/include/pulse/context.h:154
+pa_context_notify_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(None)) # /usr/include/pulse/context.h:157
+pa_context_success_cb_t = CFUNCTYPE(None, POINTER(pa_context), c_int, POINTER(None)) # /usr/include/pulse/context.h:160
+class struct_pa_proplist(Structure):
+ __slots__ = [
+ ]
+struct_pa_proplist._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_pa_proplist(Structure):
+ __slots__ = [
+ ]
+struct_pa_proplist._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_proplist = struct_pa_proplist # /usr/include/pulse/proplist.h:272
+pa_context_event_cb_t = CFUNCTYPE(None, POINTER(pa_context), c_char_p, POINTER(pa_proplist), POINTER(None)) # /usr/include/pulse/context.h:167
+# /usr/include/pulse/context.h:172
+pa_context_new = _lib.pa_context_new
+pa_context_new.restype = POINTER(pa_context)
+pa_context_new.argtypes = [POINTER(pa_mainloop_api), c_char_p]
+
+# /usr/include/pulse/context.h:177
+pa_context_new_with_proplist = _lib.pa_context_new_with_proplist
+pa_context_new_with_proplist.restype = POINTER(pa_context)
+pa_context_new_with_proplist.argtypes = [POINTER(pa_mainloop_api), c_char_p, POINTER(pa_proplist)]
+
+# /usr/include/pulse/context.h:180
+pa_context_unref = _lib.pa_context_unref
+pa_context_unref.restype = None
+pa_context_unref.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:183
+pa_context_ref = _lib.pa_context_ref
+pa_context_ref.restype = POINTER(pa_context)
+pa_context_ref.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:186
+pa_context_set_state_callback = _lib.pa_context_set_state_callback
+pa_context_set_state_callback.restype = None
+pa_context_set_state_callback.argtypes = [POINTER(pa_context), pa_context_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:190
+pa_context_set_event_callback = _lib.pa_context_set_event_callback
+pa_context_set_event_callback.restype = None
+pa_context_set_event_callback.argtypes = [POINTER(pa_context), pa_context_event_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:193
+pa_context_errno = _lib.pa_context_errno
+pa_context_errno.restype = c_int
+pa_context_errno.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:196
+pa_context_is_pending = _lib.pa_context_is_pending
+pa_context_is_pending.restype = c_int
+pa_context_is_pending.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:199
+pa_context_get_state = _lib.pa_context_get_state
+pa_context_get_state.restype = pa_context_state_t
+pa_context_get_state.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:209
+pa_context_connect = _lib.pa_context_connect
+pa_context_connect.restype = c_int
+pa_context_connect.argtypes = [POINTER(pa_context), c_char_p, pa_context_flags_t, POINTER(pa_spawn_api)]
+
+# /usr/include/pulse/context.h:212
+pa_context_disconnect = _lib.pa_context_disconnect
+pa_context_disconnect.restype = None
+pa_context_disconnect.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:215
+pa_context_drain = _lib.pa_context_drain
+pa_context_drain.restype = POINTER(pa_operation)
+pa_context_drain.argtypes = [POINTER(pa_context), pa_context_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:220
+pa_context_exit_daemon = _lib.pa_context_exit_daemon
+pa_context_exit_daemon.restype = POINTER(pa_operation)
+pa_context_exit_daemon.argtypes = [POINTER(pa_context), pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:223
+pa_context_set_default_sink = _lib.pa_context_set_default_sink
+pa_context_set_default_sink.restype = POINTER(pa_operation)
+pa_context_set_default_sink.argtypes = [POINTER(pa_context), c_char_p, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:226
+pa_context_set_default_source = _lib.pa_context_set_default_source
+pa_context_set_default_source.restype = POINTER(pa_operation)
+pa_context_set_default_source.argtypes = [POINTER(pa_context), c_char_p, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:229
+pa_context_is_local = _lib.pa_context_is_local
+pa_context_is_local.restype = c_int
+pa_context_is_local.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:232
+pa_context_set_name = _lib.pa_context_set_name
+pa_context_set_name.restype = POINTER(pa_operation)
+pa_context_set_name.argtypes = [POINTER(pa_context), c_char_p, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:235
+pa_context_get_server = _lib.pa_context_get_server
+pa_context_get_server.restype = c_char_p
+pa_context_get_server.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:238
+pa_context_get_protocol_version = _lib.pa_context_get_protocol_version
+pa_context_get_protocol_version.restype = c_uint32
+pa_context_get_protocol_version.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:241
+pa_context_get_server_protocol_version = _lib.pa_context_get_server_protocol_version
+pa_context_get_server_protocol_version.restype = c_uint32
+pa_context_get_server_protocol_version.argtypes = [POINTER(pa_context)]
+
+enum_pa_update_mode = c_int
+PA_UPDATE_SET = 0
+PA_UPDATE_MERGE = 1
+PA_UPDATE_REPLACE = 2
+pa_update_mode_t = enum_pa_update_mode # /usr/include/pulse/proplist.h:337
+# /usr/include/pulse/context.h:248
+pa_context_proplist_update = _lib.pa_context_proplist_update
+pa_context_proplist_update.restype = POINTER(pa_operation)
+pa_context_proplist_update.argtypes = [POINTER(pa_context), pa_update_mode_t, POINTER(pa_proplist), pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:251
+pa_context_proplist_remove = _lib.pa_context_proplist_remove
+pa_context_proplist_remove.restype = POINTER(pa_operation)
+pa_context_proplist_remove.argtypes = [POINTER(pa_context), POINTER(c_char_p), pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:256
+pa_context_get_index = _lib.pa_context_get_index
+pa_context_get_index.restype = c_uint32
+pa_context_get_index.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:260
+pa_context_rttime_new = _lib.pa_context_rttime_new
+pa_context_rttime_new.restype = POINTER(pa_time_event)
+pa_context_rttime_new.argtypes = [POINTER(pa_context), pa_usec_t, pa_time_event_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:264
+pa_context_rttime_restart = _lib.pa_context_rttime_restart
+pa_context_rttime_restart.restype = None
+pa_context_rttime_restart.argtypes = [POINTER(pa_context), POINTER(pa_time_event), pa_usec_t]
+
+# /usr/include/pulse/context.h:279
+pa_context_get_tile_size = _lib.pa_context_get_tile_size
+pa_context_get_tile_size.restype = c_size_t
+pa_context_get_tile_size.argtypes = [POINTER(pa_context), POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/context.h:287
+pa_context_load_cookie_from_file = _lib.pa_context_load_cookie_from_file
+pa_context_load_cookie_from_file.restype = c_int
+pa_context_load_cookie_from_file.argtypes = [POINTER(pa_context), c_char_p]
+
+pa_volume_t = c_uint32 # /usr/include/pulse/volume.h:120
+class struct_pa_cvolume(Structure):
+ __slots__ = [
+ 'channels',
+ 'values',
+ ]
+struct_pa_cvolume._fields_ = [
+ ('channels', c_uint8),
+ ('values', pa_volume_t * 32),
+]
+
+pa_cvolume = struct_pa_cvolume # /usr/include/pulse/volume.h:151
+# /usr/include/pulse/volume.h:154
+pa_cvolume_equal = _lib.pa_cvolume_equal
+pa_cvolume_equal.restype = c_int
+pa_cvolume_equal.argtypes = [POINTER(pa_cvolume), POINTER(pa_cvolume)]
+
+# /usr/include/pulse/volume.h:159
+pa_cvolume_init = _lib.pa_cvolume_init
+pa_cvolume_init.restype = POINTER(pa_cvolume)
+pa_cvolume_init.argtypes = [POINTER(pa_cvolume)]
+
+# /usr/include/pulse/volume.h:168
+pa_cvolume_set = _lib.pa_cvolume_set
+pa_cvolume_set.restype = POINTER(pa_cvolume)
+pa_cvolume_set.argtypes = [POINTER(pa_cvolume), c_uint, pa_volume_t]
+
+PA_CVOLUME_SNPRINT_MAX = 320 # /usr/include/pulse/volume.h:175
+# /usr/include/pulse/volume.h:178
+pa_cvolume_snprint = _lib.pa_cvolume_snprint
+pa_cvolume_snprint.restype = c_char_p
+pa_cvolume_snprint.argtypes = [c_char_p, c_size_t, POINTER(pa_cvolume)]
+
+PA_SW_CVOLUME_SNPRINT_DB_MAX = 448 # /usr/include/pulse/volume.h:185
+# /usr/include/pulse/volume.h:188
+pa_sw_cvolume_snprint_dB = _lib.pa_sw_cvolume_snprint_dB
+pa_sw_cvolume_snprint_dB.restype = c_char_p
+pa_sw_cvolume_snprint_dB.argtypes = [c_char_p, c_size_t, POINTER(pa_cvolume)]
+
+PA_CVOLUME_SNPRINT_VERBOSE_MAX = 1984 # /usr/include/pulse/volume.h:194
+# /usr/include/pulse/volume.h:200
+pa_cvolume_snprint_verbose = _lib.pa_cvolume_snprint_verbose
+pa_cvolume_snprint_verbose.restype = c_char_p
+pa_cvolume_snprint_verbose.argtypes = [c_char_p, c_size_t, POINTER(pa_cvolume), POINTER(pa_channel_map), c_int]
+
+PA_VOLUME_SNPRINT_MAX = 10 # /usr/include/pulse/volume.h:207
+# /usr/include/pulse/volume.h:210
+pa_volume_snprint = _lib.pa_volume_snprint
+pa_volume_snprint.restype = c_char_p
+pa_volume_snprint.argtypes = [c_char_p, c_size_t, pa_volume_t]
+
+PA_SW_VOLUME_SNPRINT_DB_MAX = 11 # /usr/include/pulse/volume.h:217
+# /usr/include/pulse/volume.h:220
+pa_sw_volume_snprint_dB = _lib.pa_sw_volume_snprint_dB
+pa_sw_volume_snprint_dB.restype = c_char_p
+pa_sw_volume_snprint_dB.argtypes = [c_char_p, c_size_t, pa_volume_t]
+
+PA_VOLUME_SNPRINT_VERBOSE_MAX = 35 # /usr/include/pulse/volume.h:226
+# /usr/include/pulse/volume.h:231
+pa_volume_snprint_verbose = _lib.pa_volume_snprint_verbose
+pa_volume_snprint_verbose.restype = c_char_p
+pa_volume_snprint_verbose.argtypes = [c_char_p, c_size_t, pa_volume_t, c_int]
+
+# /usr/include/pulse/volume.h:234
+pa_cvolume_avg = _lib.pa_cvolume_avg
+pa_cvolume_avg.restype = pa_volume_t
+pa_cvolume_avg.argtypes = [POINTER(pa_cvolume)]
+
+# /usr/include/pulse/volume.h:241
+pa_cvolume_avg_mask = _lib.pa_cvolume_avg_mask
+pa_cvolume_avg_mask.restype = pa_volume_t
+pa_cvolume_avg_mask.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map), pa_channel_position_mask_t]
+
+# /usr/include/pulse/volume.h:244
+pa_cvolume_max = _lib.pa_cvolume_max
+pa_cvolume_max.restype = pa_volume_t
+pa_cvolume_max.argtypes = [POINTER(pa_cvolume)]
+
+# /usr/include/pulse/volume.h:251
+pa_cvolume_max_mask = _lib.pa_cvolume_max_mask
+pa_cvolume_max_mask.restype = pa_volume_t
+pa_cvolume_max_mask.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map), pa_channel_position_mask_t]
+
+# /usr/include/pulse/volume.h:254
+pa_cvolume_min = _lib.pa_cvolume_min
+pa_cvolume_min.restype = pa_volume_t
+pa_cvolume_min.argtypes = [POINTER(pa_cvolume)]
+
+# /usr/include/pulse/volume.h:261
+pa_cvolume_min_mask = _lib.pa_cvolume_min_mask
+pa_cvolume_min_mask.restype = pa_volume_t
+pa_cvolume_min_mask.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map), pa_channel_position_mask_t]
+
+# /usr/include/pulse/volume.h:264
+pa_cvolume_valid = _lib.pa_cvolume_valid
+pa_cvolume_valid.restype = c_int
+pa_cvolume_valid.argtypes = [POINTER(pa_cvolume)]
+
+# /usr/include/pulse/volume.h:267
+pa_cvolume_channels_equal_to = _lib.pa_cvolume_channels_equal_to
+pa_cvolume_channels_equal_to.restype = c_int
+pa_cvolume_channels_equal_to.argtypes = [POINTER(pa_cvolume), pa_volume_t]
+
+# /usr/include/pulse/volume.h:278
+pa_sw_volume_multiply = _lib.pa_sw_volume_multiply
+pa_sw_volume_multiply.restype = pa_volume_t
+pa_sw_volume_multiply.argtypes = [pa_volume_t, pa_volume_t]
+
+# /usr/include/pulse/volume.h:283
+pa_sw_cvolume_multiply = _lib.pa_sw_cvolume_multiply
+pa_sw_cvolume_multiply.restype = POINTER(pa_cvolume)
+pa_sw_cvolume_multiply.argtypes = [POINTER(pa_cvolume), POINTER(pa_cvolume), POINTER(pa_cvolume)]
+
+# /usr/include/pulse/volume.h:289
+pa_sw_cvolume_multiply_scalar = _lib.pa_sw_cvolume_multiply_scalar
+pa_sw_cvolume_multiply_scalar.restype = POINTER(pa_cvolume)
+pa_sw_cvolume_multiply_scalar.argtypes = [POINTER(pa_cvolume), POINTER(pa_cvolume), pa_volume_t]
+
+# /usr/include/pulse/volume.h:295
+pa_sw_volume_divide = _lib.pa_sw_volume_divide
+pa_sw_volume_divide.restype = pa_volume_t
+pa_sw_volume_divide.argtypes = [pa_volume_t, pa_volume_t]
+
+# /usr/include/pulse/volume.h:300
+pa_sw_cvolume_divide = _lib.pa_sw_cvolume_divide
+pa_sw_cvolume_divide.restype = POINTER(pa_cvolume)
+pa_sw_cvolume_divide.argtypes = [POINTER(pa_cvolume), POINTER(pa_cvolume), POINTER(pa_cvolume)]
+
+# /usr/include/pulse/volume.h:306
+pa_sw_cvolume_divide_scalar = _lib.pa_sw_cvolume_divide_scalar
+pa_sw_cvolume_divide_scalar.restype = POINTER(pa_cvolume)
+pa_sw_cvolume_divide_scalar.argtypes = [POINTER(pa_cvolume), POINTER(pa_cvolume), pa_volume_t]
+
+# /usr/include/pulse/volume.h:309
+pa_sw_volume_from_dB = _lib.pa_sw_volume_from_dB
+pa_sw_volume_from_dB.restype = pa_volume_t
+pa_sw_volume_from_dB.argtypes = [c_double]
+
+# /usr/include/pulse/volume.h:312
+pa_sw_volume_to_dB = _lib.pa_sw_volume_to_dB
+pa_sw_volume_to_dB.restype = c_double
+pa_sw_volume_to_dB.argtypes = [pa_volume_t]
+
+# /usr/include/pulse/volume.h:316
+pa_sw_volume_from_linear = _lib.pa_sw_volume_from_linear
+pa_sw_volume_from_linear.restype = pa_volume_t
+pa_sw_volume_from_linear.argtypes = [c_double]
+
+# /usr/include/pulse/volume.h:319
+pa_sw_volume_to_linear = _lib.pa_sw_volume_to_linear
+pa_sw_volume_to_linear.restype = c_double
+pa_sw_volume_to_linear.argtypes = [pa_volume_t]
+
+# /usr/include/pulse/volume.h:329
+pa_cvolume_remap = _lib.pa_cvolume_remap
+pa_cvolume_remap.restype = POINTER(pa_cvolume)
+pa_cvolume_remap.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map), POINTER(pa_channel_map)]
+
+# /usr/include/pulse/volume.h:333
+pa_cvolume_compatible = _lib.pa_cvolume_compatible
+pa_cvolume_compatible.restype = c_int
+pa_cvolume_compatible.argtypes = [POINTER(pa_cvolume), POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/volume.h:337
+pa_cvolume_compatible_with_channel_map = _lib.pa_cvolume_compatible_with_channel_map
+pa_cvolume_compatible_with_channel_map.restype = c_int
+pa_cvolume_compatible_with_channel_map.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map)]
+
+# /usr/include/pulse/volume.h:344
+pa_cvolume_get_balance = _lib.pa_cvolume_get_balance
+pa_cvolume_get_balance.restype = c_float
+pa_cvolume_get_balance.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map)]
+
+# /usr/include/pulse/volume.h:355
+pa_cvolume_set_balance = _lib.pa_cvolume_set_balance
+pa_cvolume_set_balance.restype = POINTER(pa_cvolume)
+pa_cvolume_set_balance.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map), c_float]
+
+# /usr/include/pulse/volume.h:362
+pa_cvolume_get_fade = _lib.pa_cvolume_get_fade
+pa_cvolume_get_fade.restype = c_float
+pa_cvolume_get_fade.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map)]
+
+# /usr/include/pulse/volume.h:373
+pa_cvolume_set_fade = _lib.pa_cvolume_set_fade
+pa_cvolume_set_fade.restype = POINTER(pa_cvolume)
+pa_cvolume_set_fade.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map), c_float]
+
+# /usr/include/pulse/volume.h:378
+pa_cvolume_scale = _lib.pa_cvolume_scale
+pa_cvolume_scale.restype = POINTER(pa_cvolume)
+pa_cvolume_scale.argtypes = [POINTER(pa_cvolume), pa_volume_t]
+
+# /usr/include/pulse/volume.h:384
+pa_cvolume_scale_mask = _lib.pa_cvolume_scale_mask
+pa_cvolume_scale_mask.restype = POINTER(pa_cvolume)
+pa_cvolume_scale_mask.argtypes = [POINTER(pa_cvolume), pa_volume_t, POINTER(pa_channel_map), pa_channel_position_mask_t]
+
+# /usr/include/pulse/volume.h:391
+pa_cvolume_set_position = _lib.pa_cvolume_set_position
+pa_cvolume_set_position.restype = POINTER(pa_cvolume)
+pa_cvolume_set_position.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map), pa_channel_position_t, pa_volume_t]
+
+# /usr/include/pulse/volume.h:397
+pa_cvolume_get_position = _lib.pa_cvolume_get_position
+pa_cvolume_get_position.restype = pa_volume_t
+pa_cvolume_get_position.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map), pa_channel_position_t]
+
+# /usr/include/pulse/volume.h:402
+pa_cvolume_merge = _lib.pa_cvolume_merge
+pa_cvolume_merge.restype = POINTER(pa_cvolume)
+pa_cvolume_merge.argtypes = [POINTER(pa_cvolume), POINTER(pa_cvolume), POINTER(pa_cvolume)]
+
+# /usr/include/pulse/volume.h:406
+pa_cvolume_inc_clamp = _lib.pa_cvolume_inc_clamp
+pa_cvolume_inc_clamp.restype = POINTER(pa_cvolume)
+pa_cvolume_inc_clamp.argtypes = [POINTER(pa_cvolume), pa_volume_t, pa_volume_t]
+
+# /usr/include/pulse/volume.h:410
+pa_cvolume_inc = _lib.pa_cvolume_inc
+pa_cvolume_inc.restype = POINTER(pa_cvolume)
+pa_cvolume_inc.argtypes = [POINTER(pa_cvolume), pa_volume_t]
+
+# /usr/include/pulse/volume.h:414
+pa_cvolume_dec = _lib.pa_cvolume_dec
+pa_cvolume_dec.restype = POINTER(pa_cvolume)
+pa_cvolume_dec.argtypes = [POINTER(pa_cvolume), pa_volume_t]
+
+class struct_pa_stream(Structure):
+ __slots__ = [
+ ]
+struct_pa_stream._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_pa_stream(Structure):
+ __slots__ = [
+ ]
+struct_pa_stream._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_stream = struct_pa_stream # /usr/include/pulse/stream.h:335
+pa_stream_success_cb_t = CFUNCTYPE(None, POINTER(pa_stream), c_int, POINTER(None)) # /usr/include/pulse/stream.h:338
+pa_stream_request_cb_t = CFUNCTYPE(None, POINTER(pa_stream), c_size_t, POINTER(None)) # /usr/include/pulse/stream.h:341
+pa_stream_notify_cb_t = CFUNCTYPE(None, POINTER(pa_stream), POINTER(None)) # /usr/include/pulse/stream.h:344
+pa_stream_event_cb_t = CFUNCTYPE(None, POINTER(pa_stream), c_char_p, POINTER(pa_proplist), POINTER(None)) # /usr/include/pulse/stream.h:352
+# /usr/include/pulse/stream.h:357
+pa_stream_new = _lib.pa_stream_new
+pa_stream_new.restype = POINTER(pa_stream)
+pa_stream_new.argtypes = [POINTER(pa_context), c_char_p, POINTER(pa_sample_spec), POINTER(pa_channel_map)]
+
+# /usr/include/pulse/stream.h:366
+pa_stream_new_with_proplist = _lib.pa_stream_new_with_proplist
+pa_stream_new_with_proplist.restype = POINTER(pa_stream)
+pa_stream_new_with_proplist.argtypes = [POINTER(pa_context), c_char_p, POINTER(pa_sample_spec), POINTER(pa_channel_map), POINTER(pa_proplist)]
+
+class struct_pa_format_info(Structure):
+ __slots__ = [
+ 'encoding',
+ 'plist',
+ ]
+enum_pa_encoding = c_int
+PA_ENCODING_ANY = 0
+PA_ENCODING_PCM = 1
+PA_ENCODING_AC3_IEC61937 = 2
+PA_ENCODING_EAC3_IEC61937 = 3
+PA_ENCODING_MPEG_IEC61937 = 4
+PA_ENCODING_DTS_IEC61937 = 5
+PA_ENCODING_MPEG2_AAC_IEC61937 = 6
+PA_ENCODING_MAX = 7
+PA_ENCODING_INVALID = -1
+pa_encoding_t = enum_pa_encoding # /usr/include/pulse/format.h:64
+struct_pa_format_info._fields_ = [
+ ('encoding', pa_encoding_t),
+ ('plist', POINTER(pa_proplist)),
+]
+
+pa_format_info = struct_pa_format_info # /usr/include/pulse/format.h:91
+# /usr/include/pulse/stream.h:377
+pa_stream_new_extended = _lib.pa_stream_new_extended
+pa_stream_new_extended.restype = POINTER(pa_stream)
+pa_stream_new_extended.argtypes = [POINTER(pa_context), c_char_p, POINTER(POINTER(pa_format_info)), c_uint, POINTER(pa_proplist)]
+
+# /usr/include/pulse/stream.h:385
+pa_stream_unref = _lib.pa_stream_unref
+pa_stream_unref.restype = None
+pa_stream_unref.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:388
+pa_stream_ref = _lib.pa_stream_ref
+pa_stream_ref.restype = POINTER(pa_stream)
+pa_stream_ref.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:391
+pa_stream_get_state = _lib.pa_stream_get_state
+pa_stream_get_state.restype = pa_stream_state_t
+pa_stream_get_state.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:394
+pa_stream_get_context = _lib.pa_stream_get_context
+pa_stream_get_context.restype = POINTER(pa_context)
+pa_stream_get_context.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:400
+pa_stream_get_index = _lib.pa_stream_get_index
+pa_stream_get_index.restype = c_uint32
+pa_stream_get_index.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:411
+pa_stream_get_device_index = _lib.pa_stream_get_device_index
+pa_stream_get_device_index.restype = c_uint32
+pa_stream_get_device_index.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:422
+pa_stream_get_device_name = _lib.pa_stream_get_device_name
+pa_stream_get_device_name.restype = c_char_p
+pa_stream_get_device_name.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:428
+pa_stream_is_suspended = _lib.pa_stream_is_suspended
+pa_stream_is_suspended.restype = c_int
+pa_stream_is_suspended.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:432
+pa_stream_is_corked = _lib.pa_stream_is_corked
+pa_stream_is_corked.restype = c_int
+pa_stream_is_corked.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:458
+pa_stream_connect_playback = _lib.pa_stream_connect_playback
+pa_stream_connect_playback.restype = c_int
+pa_stream_connect_playback.argtypes = [POINTER(pa_stream), c_char_p, POINTER(pa_buffer_attr), pa_stream_flags_t, POINTER(pa_cvolume), POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:467
+pa_stream_connect_record = _lib.pa_stream_connect_record
+pa_stream_connect_record.restype = c_int
+pa_stream_connect_record.argtypes = [POINTER(pa_stream), c_char_p, POINTER(pa_buffer_attr), pa_stream_flags_t]
+
+# /usr/include/pulse/stream.h:474
+pa_stream_disconnect = _lib.pa_stream_disconnect
+pa_stream_disconnect.restype = c_int
+pa_stream_disconnect.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:508
+pa_stream_begin_write = _lib.pa_stream_begin_write
+pa_stream_begin_write.restype = c_int
+pa_stream_begin_write.argtypes = [POINTER(pa_stream), POINTER(POINTER(None)), POINTER(c_size_t)]
+
+# /usr/include/pulse/stream.h:522
+pa_stream_cancel_write = _lib.pa_stream_cancel_write
+pa_stream_cancel_write.restype = c_int
+pa_stream_cancel_write.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:547
+pa_stream_write = _lib.pa_stream_write
+pa_stream_write.restype = c_int
+pa_stream_write.argtypes = [POINTER(pa_stream), POINTER(None), c_size_t, pa_free_cb_t, c_int64, pa_seek_mode_t]
+
+# /usr/include/pulse/stream.h:557
+pa_stream_write_ext_free = _lib.pa_stream_write_ext_free
+pa_stream_write_ext_free.restype = c_int
+pa_stream_write_ext_free.argtypes = [POINTER(pa_stream), POINTER(None), c_size_t, pa_free_cb_t, POINTER(None), c_int64, pa_seek_mode_t]
+
+# /usr/include/pulse/stream.h:582
+pa_stream_peek = _lib.pa_stream_peek
+pa_stream_peek.restype = c_int
+pa_stream_peek.argtypes = [POINTER(pa_stream), POINTER(POINTER(None)), POINTER(c_size_t)]
+
+# /usr/include/pulse/stream.h:589
+pa_stream_drop = _lib.pa_stream_drop
+pa_stream_drop.restype = c_int
+pa_stream_drop.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:592
+pa_stream_writable_size = _lib.pa_stream_writable_size
+pa_stream_writable_size.restype = c_size_t
+pa_stream_writable_size.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:595
+pa_stream_readable_size = _lib.pa_stream_readable_size
+pa_stream_readable_size.restype = c_size_t
+pa_stream_readable_size.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:601
+pa_stream_drain = _lib.pa_stream_drain
+pa_stream_drain.restype = POINTER(pa_operation)
+pa_stream_drain.argtypes = [POINTER(pa_stream), pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:607
+pa_stream_update_timing_info = _lib.pa_stream_update_timing_info
+pa_stream_update_timing_info.restype = POINTER(pa_operation)
+pa_stream_update_timing_info.argtypes = [POINTER(pa_stream), pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:610
+pa_stream_set_state_callback = _lib.pa_stream_set_state_callback
+pa_stream_set_state_callback.restype = None
+pa_stream_set_state_callback.argtypes = [POINTER(pa_stream), pa_stream_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:614
+pa_stream_set_write_callback = _lib.pa_stream_set_write_callback
+pa_stream_set_write_callback.restype = None
+pa_stream_set_write_callback.argtypes = [POINTER(pa_stream), pa_stream_request_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:617
+pa_stream_set_read_callback = _lib.pa_stream_set_read_callback
+pa_stream_set_read_callback.restype = None
+pa_stream_set_read_callback.argtypes = [POINTER(pa_stream), pa_stream_request_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:620
+pa_stream_set_overflow_callback = _lib.pa_stream_set_overflow_callback
+pa_stream_set_overflow_callback.restype = None
+pa_stream_set_overflow_callback.argtypes = [POINTER(pa_stream), pa_stream_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:626
+pa_stream_get_underflow_index = _lib.pa_stream_get_underflow_index
+pa_stream_get_underflow_index.restype = c_int64
+pa_stream_get_underflow_index.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:629
+pa_stream_set_underflow_callback = _lib.pa_stream_set_underflow_callback
+pa_stream_set_underflow_callback.restype = None
+pa_stream_set_underflow_callback.argtypes = [POINTER(pa_stream), pa_stream_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:636
+pa_stream_set_started_callback = _lib.pa_stream_set_started_callback
+pa_stream_set_started_callback.restype = None
+pa_stream_set_started_callback.argtypes = [POINTER(pa_stream), pa_stream_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:641
+pa_stream_set_latency_update_callback = _lib.pa_stream_set_latency_update_callback
+pa_stream_set_latency_update_callback.restype = None
+pa_stream_set_latency_update_callback.argtypes = [POINTER(pa_stream), pa_stream_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:648
+pa_stream_set_moved_callback = _lib.pa_stream_set_moved_callback
+pa_stream_set_moved_callback.restype = None
+pa_stream_set_moved_callback.argtypes = [POINTER(pa_stream), pa_stream_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:658
+pa_stream_set_suspended_callback = _lib.pa_stream_set_suspended_callback
+pa_stream_set_suspended_callback.restype = None
+pa_stream_set_suspended_callback.argtypes = [POINTER(pa_stream), pa_stream_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:662
+pa_stream_set_event_callback = _lib.pa_stream_set_event_callback
+pa_stream_set_event_callback.restype = None
+pa_stream_set_event_callback.argtypes = [POINTER(pa_stream), pa_stream_event_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:669
+pa_stream_set_buffer_attr_callback = _lib.pa_stream_set_buffer_attr_callback
+pa_stream_set_buffer_attr_callback.restype = None
+pa_stream_set_buffer_attr_callback.argtypes = [POINTER(pa_stream), pa_stream_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:681
+pa_stream_cork = _lib.pa_stream_cork
+pa_stream_cork.restype = POINTER(pa_operation)
+pa_stream_cork.argtypes = [POINTER(pa_stream), c_int, pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:686
+pa_stream_flush = _lib.pa_stream_flush
+pa_stream_flush.restype = POINTER(pa_operation)
+pa_stream_flush.argtypes = [POINTER(pa_stream), pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:690
+pa_stream_prebuf = _lib.pa_stream_prebuf
+pa_stream_prebuf.restype = POINTER(pa_operation)
+pa_stream_prebuf.argtypes = [POINTER(pa_stream), pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:695
+pa_stream_trigger = _lib.pa_stream_trigger
+pa_stream_trigger.restype = POINTER(pa_operation)
+pa_stream_trigger.argtypes = [POINTER(pa_stream), pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:698
+pa_stream_set_name = _lib.pa_stream_set_name
+pa_stream_set_name.restype = POINTER(pa_operation)
+pa_stream_set_name.argtypes = [POINTER(pa_stream), c_char_p, pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:731
+pa_stream_get_time = _lib.pa_stream_get_time
+pa_stream_get_time.restype = c_int
+pa_stream_get_time.argtypes = [POINTER(pa_stream), POINTER(pa_usec_t)]
+
+# /usr/include/pulse/stream.h:745
+pa_stream_get_latency = _lib.pa_stream_get_latency
+pa_stream_get_latency.restype = c_int
+pa_stream_get_latency.argtypes = [POINTER(pa_stream), POINTER(pa_usec_t), POINTER(c_int)]
+
+# /usr/include/pulse/stream.h:761
+pa_stream_get_timing_info = _lib.pa_stream_get_timing_info
+pa_stream_get_timing_info.restype = POINTER(pa_timing_info)
+pa_stream_get_timing_info.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:764
+pa_stream_get_sample_spec = _lib.pa_stream_get_sample_spec
+pa_stream_get_sample_spec.restype = POINTER(pa_sample_spec)
+pa_stream_get_sample_spec.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:767
+pa_stream_get_channel_map = _lib.pa_stream_get_channel_map
+pa_stream_get_channel_map.restype = POINTER(pa_channel_map)
+pa_stream_get_channel_map.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:770
+pa_stream_get_format_info = _lib.pa_stream_get_format_info
+pa_stream_get_format_info.restype = POINTER(pa_format_info)
+pa_stream_get_format_info.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:780
+pa_stream_get_buffer_attr = _lib.pa_stream_get_buffer_attr
+pa_stream_get_buffer_attr.restype = POINTER(pa_buffer_attr)
+pa_stream_get_buffer_attr.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:790
+pa_stream_set_buffer_attr = _lib.pa_stream_set_buffer_attr
+pa_stream_set_buffer_attr.restype = POINTER(pa_operation)
+pa_stream_set_buffer_attr.argtypes = [POINTER(pa_stream), POINTER(pa_buffer_attr), pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:797
+pa_stream_update_sample_rate = _lib.pa_stream_update_sample_rate
+pa_stream_update_sample_rate.restype = POINTER(pa_operation)
+pa_stream_update_sample_rate.argtypes = [POINTER(pa_stream), c_uint32, pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:805
+pa_stream_proplist_update = _lib.pa_stream_proplist_update
+pa_stream_proplist_update.restype = POINTER(pa_operation)
+pa_stream_proplist_update.argtypes = [POINTER(pa_stream), pa_update_mode_t, POINTER(pa_proplist), pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:809
+pa_stream_proplist_remove = _lib.pa_stream_proplist_remove
+pa_stream_proplist_remove.restype = POINTER(pa_operation)
+pa_stream_proplist_remove.argtypes = [POINTER(pa_stream), POINTER(c_char_p), pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:815
+pa_stream_set_monitor_stream = _lib.pa_stream_set_monitor_stream
+pa_stream_set_monitor_stream.restype = c_int
+pa_stream_set_monitor_stream.argtypes = [POINTER(pa_stream), c_uint32]
+
+# /usr/include/pulse/stream.h:820
+pa_stream_get_monitor_stream = _lib.pa_stream_get_monitor_stream
+pa_stream_get_monitor_stream.restype = c_uint32
+pa_stream_get_monitor_stream.argtypes = [POINTER(pa_stream)]
+
+class struct_pa_sink_port_info(Structure):
+ __slots__ = [
+ 'name',
+ 'description',
+ 'priority',
+ 'available',
+ ]
+struct_pa_sink_port_info._fields_ = [
+ ('name', c_char_p),
+ ('description', c_char_p),
+ ('priority', c_uint32),
+ ('available', c_int),
+]
+
+pa_sink_port_info = struct_pa_sink_port_info # /usr/include/pulse/introspect.h:232
+class struct_pa_sink_info(Structure):
+ __slots__ = [
+ 'name',
+ 'index',
+ 'description',
+ 'sample_spec',
+ 'channel_map',
+ 'owner_module',
+ 'volume',
+ 'mute',
+ 'monitor_source',
+ 'monitor_source_name',
+ 'latency',
+ 'driver',
+ 'flags',
+ 'proplist',
+ 'configured_latency',
+ 'base_volume',
+ 'state',
+ 'n_volume_steps',
+ 'card',
+ 'n_ports',
+ 'ports',
+ 'active_port',
+ 'n_formats',
+ 'formats',
+ ]
+struct_pa_sink_info._fields_ = [
+ ('name', c_char_p),
+ ('index', c_uint32),
+ ('description', c_char_p),
+ ('sample_spec', pa_sample_spec),
+ ('channel_map', pa_channel_map),
+ ('owner_module', c_uint32),
+ ('volume', pa_cvolume),
+ ('mute', c_int),
+ ('monitor_source', c_uint32),
+ ('monitor_source_name', c_char_p),
+ ('latency', pa_usec_t),
+ ('driver', c_char_p),
+ ('flags', pa_sink_flags_t),
+ ('proplist', POINTER(pa_proplist)),
+ ('configured_latency', pa_usec_t),
+ ('base_volume', pa_volume_t),
+ ('state', pa_sink_state_t),
+ ('n_volume_steps', c_uint32),
+ ('card', c_uint32),
+ ('n_ports', c_uint32),
+ ('ports', POINTER(POINTER(pa_sink_port_info))),
+ ('active_port', POINTER(pa_sink_port_info)),
+ ('n_formats', c_uint8),
+ ('formats', POINTER(POINTER(pa_format_info))),
+]
+
+pa_sink_info = struct_pa_sink_info # /usr/include/pulse/introspect.h:262
+pa_sink_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_sink_info), c_int, POINTER(None)) # /usr/include/pulse/introspect.h:265
+# /usr/include/pulse/introspect.h:268
+pa_context_get_sink_info_by_name = _lib.pa_context_get_sink_info_by_name
+pa_context_get_sink_info_by_name.restype = POINTER(pa_operation)
+pa_context_get_sink_info_by_name.argtypes = [POINTER(pa_context), c_char_p, pa_sink_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:271
+pa_context_get_sink_info_by_index = _lib.pa_context_get_sink_info_by_index
+pa_context_get_sink_info_by_index.restype = POINTER(pa_operation)
+pa_context_get_sink_info_by_index.argtypes = [POINTER(pa_context), c_uint32, pa_sink_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:274
+pa_context_get_sink_info_list = _lib.pa_context_get_sink_info_list
+pa_context_get_sink_info_list.restype = POINTER(pa_operation)
+pa_context_get_sink_info_list.argtypes = [POINTER(pa_context), pa_sink_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:277
+pa_context_set_sink_volume_by_index = _lib.pa_context_set_sink_volume_by_index
+pa_context_set_sink_volume_by_index.restype = POINTER(pa_operation)
+pa_context_set_sink_volume_by_index.argtypes = [POINTER(pa_context), c_uint32, POINTER(pa_cvolume), pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:280
+pa_context_set_sink_volume_by_name = _lib.pa_context_set_sink_volume_by_name
+pa_context_set_sink_volume_by_name.restype = POINTER(pa_operation)
+pa_context_set_sink_volume_by_name.argtypes = [POINTER(pa_context), c_char_p, POINTER(pa_cvolume), pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:283
+pa_context_set_sink_mute_by_index = _lib.pa_context_set_sink_mute_by_index
+pa_context_set_sink_mute_by_index.restype = POINTER(pa_operation)
+pa_context_set_sink_mute_by_index.argtypes = [POINTER(pa_context), c_uint32, c_int, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:286
+pa_context_set_sink_mute_by_name = _lib.pa_context_set_sink_mute_by_name
+pa_context_set_sink_mute_by_name.restype = POINTER(pa_operation)
+pa_context_set_sink_mute_by_name.argtypes = [POINTER(pa_context), c_char_p, c_int, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:289
+pa_context_suspend_sink_by_name = _lib.pa_context_suspend_sink_by_name
+pa_context_suspend_sink_by_name.restype = POINTER(pa_operation)
+pa_context_suspend_sink_by_name.argtypes = [POINTER(pa_context), c_char_p, c_int, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:292
+pa_context_suspend_sink_by_index = _lib.pa_context_suspend_sink_by_index
+pa_context_suspend_sink_by_index.restype = POINTER(pa_operation)
+pa_context_suspend_sink_by_index.argtypes = [POINTER(pa_context), c_uint32, c_int, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:295
+pa_context_set_sink_port_by_index = _lib.pa_context_set_sink_port_by_index
+pa_context_set_sink_port_by_index.restype = POINTER(pa_operation)
+pa_context_set_sink_port_by_index.argtypes = [POINTER(pa_context), c_uint32, c_char_p, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:298
+pa_context_set_sink_port_by_name = _lib.pa_context_set_sink_port_by_name
+pa_context_set_sink_port_by_name.restype = POINTER(pa_operation)
+pa_context_set_sink_port_by_name.argtypes = [POINTER(pa_context), c_char_p, c_char_p, pa_context_success_cb_t, POINTER(None)]
+
+class struct_pa_source_port_info(Structure):
+ __slots__ = [
+ 'name',
+ 'description',
+ 'priority',
+ 'available',
+ ]
+struct_pa_source_port_info._fields_ = [
+ ('name', c_char_p),
+ ('description', c_char_p),
+ ('priority', c_uint32),
+ ('available', c_int),
+]
+
+pa_source_port_info = struct_pa_source_port_info # /usr/include/pulse/introspect.h:312
+class struct_pa_source_info(Structure):
+ __slots__ = [
+ 'name',
+ 'index',
+ 'description',
+ 'sample_spec',
+ 'channel_map',
+ 'owner_module',
+ 'volume',
+ 'mute',
+ 'monitor_of_sink',
+ 'monitor_of_sink_name',
+ 'latency',
+ 'driver',
+ 'flags',
+ 'proplist',
+ 'configured_latency',
+ 'base_volume',
+ 'state',
+ 'n_volume_steps',
+ 'card',
+ 'n_ports',
+ 'ports',
+ 'active_port',
+ 'n_formats',
+ 'formats',
+ ]
+struct_pa_source_info._fields_ = [
+ ('name', c_char_p),
+ ('index', c_uint32),
+ ('description', c_char_p),
+ ('sample_spec', pa_sample_spec),
+ ('channel_map', pa_channel_map),
+ ('owner_module', c_uint32),
+ ('volume', pa_cvolume),
+ ('mute', c_int),
+ ('monitor_of_sink', c_uint32),
+ ('monitor_of_sink_name', c_char_p),
+ ('latency', pa_usec_t),
+ ('driver', c_char_p),
+ ('flags', pa_source_flags_t),
+ ('proplist', POINTER(pa_proplist)),
+ ('configured_latency', pa_usec_t),
+ ('base_volume', pa_volume_t),
+ ('state', pa_source_state_t),
+ ('n_volume_steps', c_uint32),
+ ('card', c_uint32),
+ ('n_ports', c_uint32),
+ ('ports', POINTER(POINTER(pa_source_port_info))),
+ ('active_port', POINTER(pa_source_port_info)),
+ ('n_formats', c_uint8),
+ ('formats', POINTER(POINTER(pa_format_info))),
+]
+
+pa_source_info = struct_pa_source_info # /usr/include/pulse/introspect.h:342
+pa_source_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_source_info), c_int, POINTER(None)) # /usr/include/pulse/introspect.h:345
+# /usr/include/pulse/introspect.h:348
+pa_context_get_source_info_by_name = _lib.pa_context_get_source_info_by_name
+pa_context_get_source_info_by_name.restype = POINTER(pa_operation)
+pa_context_get_source_info_by_name.argtypes = [POINTER(pa_context), c_char_p, pa_source_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:351
+pa_context_get_source_info_by_index = _lib.pa_context_get_source_info_by_index
+pa_context_get_source_info_by_index.restype = POINTER(pa_operation)
+pa_context_get_source_info_by_index.argtypes = [POINTER(pa_context), c_uint32, pa_source_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:354
+pa_context_get_source_info_list = _lib.pa_context_get_source_info_list
+pa_context_get_source_info_list.restype = POINTER(pa_operation)
+pa_context_get_source_info_list.argtypes = [POINTER(pa_context), pa_source_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:357
+pa_context_set_source_volume_by_index = _lib.pa_context_set_source_volume_by_index
+pa_context_set_source_volume_by_index.restype = POINTER(pa_operation)
+pa_context_set_source_volume_by_index.argtypes = [POINTER(pa_context), c_uint32, POINTER(pa_cvolume), pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:360
+pa_context_set_source_volume_by_name = _lib.pa_context_set_source_volume_by_name
+pa_context_set_source_volume_by_name.restype = POINTER(pa_operation)
+pa_context_set_source_volume_by_name.argtypes = [POINTER(pa_context), c_char_p, POINTER(pa_cvolume), pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:363
+pa_context_set_source_mute_by_index = _lib.pa_context_set_source_mute_by_index
+pa_context_set_source_mute_by_index.restype = POINTER(pa_operation)
+pa_context_set_source_mute_by_index.argtypes = [POINTER(pa_context), c_uint32, c_int, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:366
+pa_context_set_source_mute_by_name = _lib.pa_context_set_source_mute_by_name
+pa_context_set_source_mute_by_name.restype = POINTER(pa_operation)
+pa_context_set_source_mute_by_name.argtypes = [POINTER(pa_context), c_char_p, c_int, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:369
+pa_context_suspend_source_by_name = _lib.pa_context_suspend_source_by_name
+pa_context_suspend_source_by_name.restype = POINTER(pa_operation)
+pa_context_suspend_source_by_name.argtypes = [POINTER(pa_context), c_char_p, c_int, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:372
+pa_context_suspend_source_by_index = _lib.pa_context_suspend_source_by_index
+pa_context_suspend_source_by_index.restype = POINTER(pa_operation)
+pa_context_suspend_source_by_index.argtypes = [POINTER(pa_context), c_uint32, c_int, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:375
+pa_context_set_source_port_by_index = _lib.pa_context_set_source_port_by_index
+pa_context_set_source_port_by_index.restype = POINTER(pa_operation)
+pa_context_set_source_port_by_index.argtypes = [POINTER(pa_context), c_uint32, c_char_p, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:378
+pa_context_set_source_port_by_name = _lib.pa_context_set_source_port_by_name
+pa_context_set_source_port_by_name.restype = POINTER(pa_operation)
+pa_context_set_source_port_by_name.argtypes = [POINTER(pa_context), c_char_p, c_char_p, pa_context_success_cb_t, POINTER(None)]
+
+class struct_pa_server_info(Structure):
+ __slots__ = [
+ 'user_name',
+ 'host_name',
+ 'server_version',
+ 'server_name',
+ 'sample_spec',
+ 'default_sink_name',
+ 'default_source_name',
+ 'cookie',
+ 'channel_map',
+ ]
+struct_pa_server_info._fields_ = [
+ ('user_name', c_char_p),
+ ('host_name', c_char_p),
+ ('server_version', c_char_p),
+ ('server_name', c_char_p),
+ ('sample_spec', pa_sample_spec),
+ ('default_sink_name', c_char_p),
+ ('default_source_name', c_char_p),
+ ('cookie', c_uint32),
+ ('channel_map', pa_channel_map),
+]
+
+pa_server_info = struct_pa_server_info # /usr/include/pulse/introspect.h:397
+pa_server_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_server_info), POINTER(None)) # /usr/include/pulse/introspect.h:400
+# /usr/include/pulse/introspect.h:403
+pa_context_get_server_info = _lib.pa_context_get_server_info
+pa_context_get_server_info.restype = POINTER(pa_operation)
+pa_context_get_server_info.argtypes = [POINTER(pa_context), pa_server_info_cb_t, POINTER(None)]
+
+class struct_pa_module_info(Structure):
+ __slots__ = [
+ 'index',
+ 'name',
+ 'argument',
+ 'n_used',
+ 'auto_unload',
+ 'proplist',
+ ]
+struct_pa_module_info._fields_ = [
+ ('index', c_uint32),
+ ('name', c_char_p),
+ ('argument', c_char_p),
+ ('n_used', c_uint32),
+ ('auto_unload', c_int),
+ ('proplist', POINTER(pa_proplist)),
+]
+
+pa_module_info = struct_pa_module_info # /usr/include/pulse/introspect.h:421
+pa_module_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_module_info), c_int, POINTER(None)) # /usr/include/pulse/introspect.h:424
+# /usr/include/pulse/introspect.h:427
+pa_context_get_module_info = _lib.pa_context_get_module_info
+pa_context_get_module_info.restype = POINTER(pa_operation)
+pa_context_get_module_info.argtypes = [POINTER(pa_context), c_uint32, pa_module_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:430
+pa_context_get_module_info_list = _lib.pa_context_get_module_info_list
+pa_context_get_module_info_list.restype = POINTER(pa_operation)
+pa_context_get_module_info_list.argtypes = [POINTER(pa_context), pa_module_info_cb_t, POINTER(None)]
+
+pa_context_index_cb_t = CFUNCTYPE(None, POINTER(pa_context), c_uint32, POINTER(None)) # /usr/include/pulse/introspect.h:433
+# /usr/include/pulse/introspect.h:436
+pa_context_load_module = _lib.pa_context_load_module
+pa_context_load_module.restype = POINTER(pa_operation)
+pa_context_load_module.argtypes = [POINTER(pa_context), c_char_p, c_char_p, pa_context_index_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:439
+pa_context_unload_module = _lib.pa_context_unload_module
+pa_context_unload_module.restype = POINTER(pa_operation)
+pa_context_unload_module.argtypes = [POINTER(pa_context), c_uint32, pa_context_success_cb_t, POINTER(None)]
+
+class struct_pa_client_info(Structure):
+ __slots__ = [
+ 'index',
+ 'name',
+ 'owner_module',
+ 'driver',
+ 'proplist',
+ ]
+struct_pa_client_info._fields_ = [
+ ('index', c_uint32),
+ ('name', c_char_p),
+ ('owner_module', c_uint32),
+ ('driver', c_char_p),
+ ('proplist', POINTER(pa_proplist)),
+]
+
+pa_client_info = struct_pa_client_info # /usr/include/pulse/introspect.h:454
+pa_client_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_client_info), c_int, POINTER(None)) # /usr/include/pulse/introspect.h:457
+# /usr/include/pulse/introspect.h:460
+pa_context_get_client_info = _lib.pa_context_get_client_info
+pa_context_get_client_info.restype = POINTER(pa_operation)
+pa_context_get_client_info.argtypes = [POINTER(pa_context), c_uint32, pa_client_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:463
+pa_context_get_client_info_list = _lib.pa_context_get_client_info_list
+pa_context_get_client_info_list.restype = POINTER(pa_operation)
+pa_context_get_client_info_list.argtypes = [POINTER(pa_context), pa_client_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:466
+pa_context_kill_client = _lib.pa_context_kill_client
+pa_context_kill_client.restype = POINTER(pa_operation)
+pa_context_kill_client.argtypes = [POINTER(pa_context), c_uint32, pa_context_success_cb_t, POINTER(None)]
+
+class struct_pa_card_profile_info(Structure):
+ __slots__ = [
+ 'name',
+ 'description',
+ 'n_sinks',
+ 'n_sources',
+ 'priority',
+ ]
+struct_pa_card_profile_info._fields_ = [
+ ('name', c_char_p),
+ ('description', c_char_p),
+ ('n_sinks', c_uint32),
+ ('n_sources', c_uint32),
+ ('priority', c_uint32),
+]
+
+pa_card_profile_info = struct_pa_card_profile_info # /usr/include/pulse/introspect.h:479
+class struct_pa_card_profile_info2(Structure):
+ __slots__ = [
+ 'name',
+ 'description',
+ 'n_sinks',
+ 'n_sources',
+ 'priority',
+ 'available',
+ ]
+struct_pa_card_profile_info2._fields_ = [
+ ('name', c_char_p),
+ ('description', c_char_p),
+ ('n_sinks', c_uint32),
+ ('n_sources', c_uint32),
+ ('priority', c_uint32),
+ ('available', c_int),
+]
+
+pa_card_profile_info2 = struct_pa_card_profile_info2 # /usr/include/pulse/introspect.h:496
+class struct_pa_card_port_info(Structure):
+ __slots__ = [
+ 'name',
+ 'description',
+ 'priority',
+ 'available',
+ 'direction',
+ 'n_profiles',
+ 'profiles',
+ 'proplist',
+ 'latency_offset',
+ 'profiles2',
+ ]
+struct_pa_card_port_info._fields_ = [
+ ('name', c_char_p),
+ ('description', c_char_p),
+ ('priority', c_uint32),
+ ('available', c_int),
+ ('direction', c_int),
+ ('n_profiles', c_uint32),
+ ('profiles', POINTER(POINTER(pa_card_profile_info))),
+ ('proplist', POINTER(pa_proplist)),
+ ('latency_offset', c_int64),
+ ('profiles2', POINTER(POINTER(pa_card_profile_info2))),
+]
+
+pa_card_port_info = struct_pa_card_port_info # /usr/include/pulse/introspect.h:512
+class struct_pa_card_info(Structure):
+ __slots__ = [
+ 'index',
+ 'name',
+ 'owner_module',
+ 'driver',
+ 'n_profiles',
+ 'profiles',
+ 'active_profile',
+ 'proplist',
+ 'n_ports',
+ 'ports',
+ 'profiles2',
+ 'active_profile2',
+ ]
+struct_pa_card_info._fields_ = [
+ ('index', c_uint32),
+ ('name', c_char_p),
+ ('owner_module', c_uint32),
+ ('driver', c_char_p),
+ ('n_profiles', c_uint32),
+ ('profiles', POINTER(pa_card_profile_info)),
+ ('active_profile', POINTER(pa_card_profile_info)),
+ ('proplist', POINTER(pa_proplist)),
+ ('n_ports', c_uint32),
+ ('ports', POINTER(POINTER(pa_card_port_info))),
+ ('profiles2', POINTER(POINTER(pa_card_profile_info2))),
+ ('active_profile2', POINTER(pa_card_profile_info2)),
+]
+
+pa_card_info = struct_pa_card_info # /usr/include/pulse/introspect.h:530
+pa_card_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_card_info), c_int, POINTER(None)) # /usr/include/pulse/introspect.h:533
+# /usr/include/pulse/introspect.h:536
+pa_context_get_card_info_by_index = _lib.pa_context_get_card_info_by_index
+pa_context_get_card_info_by_index.restype = POINTER(pa_operation)
+pa_context_get_card_info_by_index.argtypes = [POINTER(pa_context), c_uint32, pa_card_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:539
+pa_context_get_card_info_by_name = _lib.pa_context_get_card_info_by_name
+pa_context_get_card_info_by_name.restype = POINTER(pa_operation)
+pa_context_get_card_info_by_name.argtypes = [POINTER(pa_context), c_char_p, pa_card_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:542
+pa_context_get_card_info_list = _lib.pa_context_get_card_info_list
+pa_context_get_card_info_list.restype = POINTER(pa_operation)
+pa_context_get_card_info_list.argtypes = [POINTER(pa_context), pa_card_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:545
+pa_context_set_card_profile_by_index = _lib.pa_context_set_card_profile_by_index
+pa_context_set_card_profile_by_index.restype = POINTER(pa_operation)
+pa_context_set_card_profile_by_index.argtypes = [POINTER(pa_context), c_uint32, c_char_p, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:548
+pa_context_set_card_profile_by_name = _lib.pa_context_set_card_profile_by_name
+pa_context_set_card_profile_by_name.restype = POINTER(pa_operation)
+pa_context_set_card_profile_by_name.argtypes = [POINTER(pa_context), c_char_p, c_char_p, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:551
+pa_context_set_port_latency_offset = _lib.pa_context_set_port_latency_offset
+pa_context_set_port_latency_offset.restype = POINTER(pa_operation)
+pa_context_set_port_latency_offset.argtypes = [POINTER(pa_context), c_char_p, c_char_p, c_int64, pa_context_success_cb_t, POINTER(None)]
+
+class struct_pa_sink_input_info(Structure):
+ __slots__ = [
+ 'index',
+ 'name',
+ 'owner_module',
+ 'client',
+ 'sink',
+ 'sample_spec',
+ 'channel_map',
+ 'volume',
+ 'buffer_usec',
+ 'sink_usec',
+ 'resample_method',
+ 'driver',
+ 'mute',
+ 'proplist',
+ 'corked',
+ 'has_volume',
+ 'volume_writable',
+ 'format',
+ ]
+struct_pa_sink_input_info._fields_ = [
+ ('index', c_uint32),
+ ('name', c_char_p),
+ ('owner_module', c_uint32),
+ ('client', c_uint32),
+ ('sink', c_uint32),
+ ('sample_spec', pa_sample_spec),
+ ('channel_map', pa_channel_map),
+ ('volume', pa_cvolume),
+ ('buffer_usec', pa_usec_t),
+ ('sink_usec', pa_usec_t),
+ ('resample_method', c_char_p),
+ ('driver', c_char_p),
+ ('mute', c_int),
+ ('proplist', POINTER(pa_proplist)),
+ ('corked', c_int),
+ ('has_volume', c_int),
+ ('volume_writable', c_int),
+ ('format', POINTER(pa_format_info)),
+]
+
+pa_sink_input_info = struct_pa_sink_input_info # /usr/include/pulse/introspect.h:579
+pa_sink_input_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_sink_input_info), c_int, POINTER(None)) # /usr/include/pulse/introspect.h:582
+# /usr/include/pulse/introspect.h:585
+pa_context_get_sink_input_info = _lib.pa_context_get_sink_input_info
+pa_context_get_sink_input_info.restype = POINTER(pa_operation)
+pa_context_get_sink_input_info.argtypes = [POINTER(pa_context), c_uint32, pa_sink_input_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:588
+pa_context_get_sink_input_info_list = _lib.pa_context_get_sink_input_info_list
+pa_context_get_sink_input_info_list.restype = POINTER(pa_operation)
+pa_context_get_sink_input_info_list.argtypes = [POINTER(pa_context), pa_sink_input_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:591
+pa_context_move_sink_input_by_name = _lib.pa_context_move_sink_input_by_name
+pa_context_move_sink_input_by_name.restype = POINTER(pa_operation)
+pa_context_move_sink_input_by_name.argtypes = [POINTER(pa_context), c_uint32, c_char_p, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:594
+pa_context_move_sink_input_by_index = _lib.pa_context_move_sink_input_by_index
+pa_context_move_sink_input_by_index.restype = POINTER(pa_operation)
+pa_context_move_sink_input_by_index.argtypes = [POINTER(pa_context), c_uint32, c_uint32, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:597
+pa_context_set_sink_input_volume = _lib.pa_context_set_sink_input_volume
+pa_context_set_sink_input_volume.restype = POINTER(pa_operation)
+pa_context_set_sink_input_volume.argtypes = [POINTER(pa_context), c_uint32, POINTER(pa_cvolume), pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:600
+pa_context_set_sink_input_mute = _lib.pa_context_set_sink_input_mute
+pa_context_set_sink_input_mute.restype = POINTER(pa_operation)
+pa_context_set_sink_input_mute.argtypes = [POINTER(pa_context), c_uint32, c_int, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:603
+pa_context_kill_sink_input = _lib.pa_context_kill_sink_input
+pa_context_kill_sink_input.restype = POINTER(pa_operation)
+pa_context_kill_sink_input.argtypes = [POINTER(pa_context), c_uint32, pa_context_success_cb_t, POINTER(None)]
+
+class struct_pa_source_output_info(Structure):
+ __slots__ = [
+ 'index',
+ 'name',
+ 'owner_module',
+ 'client',
+ 'source',
+ 'sample_spec',
+ 'channel_map',
+ 'buffer_usec',
+ 'source_usec',
+ 'resample_method',
+ 'driver',
+ 'proplist',
+ 'corked',
+ 'volume',
+ 'mute',
+ 'has_volume',
+ 'volume_writable',
+ 'format',
+ ]
+struct_pa_source_output_info._fields_ = [
+ ('index', c_uint32),
+ ('name', c_char_p),
+ ('owner_module', c_uint32),
+ ('client', c_uint32),
+ ('source', c_uint32),
+ ('sample_spec', pa_sample_spec),
+ ('channel_map', pa_channel_map),
+ ('buffer_usec', pa_usec_t),
+ ('source_usec', pa_usec_t),
+ ('resample_method', c_char_p),
+ ('driver', c_char_p),
+ ('proplist', POINTER(pa_proplist)),
+ ('corked', c_int),
+ ('volume', pa_cvolume),
+ ('mute', c_int),
+ ('has_volume', c_int),
+ ('volume_writable', c_int),
+ ('format', POINTER(pa_format_info)),
+]
+
+pa_source_output_info = struct_pa_source_output_info # /usr/include/pulse/introspect.h:631
+pa_source_output_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_source_output_info), c_int, POINTER(None)) # /usr/include/pulse/introspect.h:634
+# /usr/include/pulse/introspect.h:637
+pa_context_get_source_output_info = _lib.pa_context_get_source_output_info
+pa_context_get_source_output_info.restype = POINTER(pa_operation)
+pa_context_get_source_output_info.argtypes = [POINTER(pa_context), c_uint32, pa_source_output_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:640
+pa_context_get_source_output_info_list = _lib.pa_context_get_source_output_info_list
+pa_context_get_source_output_info_list.restype = POINTER(pa_operation)
+pa_context_get_source_output_info_list.argtypes = [POINTER(pa_context), pa_source_output_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:643
+pa_context_move_source_output_by_name = _lib.pa_context_move_source_output_by_name
+pa_context_move_source_output_by_name.restype = POINTER(pa_operation)
+pa_context_move_source_output_by_name.argtypes = [POINTER(pa_context), c_uint32, c_char_p, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:646
+pa_context_move_source_output_by_index = _lib.pa_context_move_source_output_by_index
+pa_context_move_source_output_by_index.restype = POINTER(pa_operation)
+pa_context_move_source_output_by_index.argtypes = [POINTER(pa_context), c_uint32, c_uint32, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:649
+pa_context_set_source_output_volume = _lib.pa_context_set_source_output_volume
+pa_context_set_source_output_volume.restype = POINTER(pa_operation)
+pa_context_set_source_output_volume.argtypes = [POINTER(pa_context), c_uint32, POINTER(pa_cvolume), pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:652
+pa_context_set_source_output_mute = _lib.pa_context_set_source_output_mute
+pa_context_set_source_output_mute.restype = POINTER(pa_operation)
+pa_context_set_source_output_mute.argtypes = [POINTER(pa_context), c_uint32, c_int, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:655
+pa_context_kill_source_output = _lib.pa_context_kill_source_output
+pa_context_kill_source_output.restype = POINTER(pa_operation)
+pa_context_kill_source_output.argtypes = [POINTER(pa_context), c_uint32, pa_context_success_cb_t, POINTER(None)]
+
+class struct_pa_stat_info(Structure):
+ __slots__ = [
+ 'memblock_total',
+ 'memblock_total_size',
+ 'memblock_allocated',
+ 'memblock_allocated_size',
+ 'scache_size',
+ ]
+struct_pa_stat_info._fields_ = [
+ ('memblock_total', c_uint32),
+ ('memblock_total_size', c_uint32),
+ ('memblock_allocated', c_uint32),
+ ('memblock_allocated_size', c_uint32),
+ ('scache_size', c_uint32),
+]
+
+pa_stat_info = struct_pa_stat_info # /usr/include/pulse/introspect.h:670
+pa_stat_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_stat_info), POINTER(None)) # /usr/include/pulse/introspect.h:673
+# /usr/include/pulse/introspect.h:676
+pa_context_stat = _lib.pa_context_stat
+pa_context_stat.restype = POINTER(pa_operation)
+pa_context_stat.argtypes = [POINTER(pa_context), pa_stat_info_cb_t, POINTER(None)]
+
+class struct_pa_sample_info(Structure):
+ __slots__ = [
+ 'index',
+ 'name',
+ 'volume',
+ 'sample_spec',
+ 'channel_map',
+ 'duration',
+ 'bytes',
+ 'lazy',
+ 'filename',
+ 'proplist',
+ ]
+struct_pa_sample_info._fields_ = [
+ ('index', c_uint32),
+ ('name', c_char_p),
+ ('volume', pa_cvolume),
+ ('sample_spec', pa_sample_spec),
+ ('channel_map', pa_channel_map),
+ ('duration', pa_usec_t),
+ ('bytes', c_uint32),
+ ('lazy', c_int),
+ ('filename', c_char_p),
+ ('proplist', POINTER(pa_proplist)),
+]
+
+pa_sample_info = struct_pa_sample_info # /usr/include/pulse/introspect.h:696
+pa_sample_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_sample_info), c_int, POINTER(None)) # /usr/include/pulse/introspect.h:699
+# /usr/include/pulse/introspect.h:702
+pa_context_get_sample_info_by_name = _lib.pa_context_get_sample_info_by_name
+pa_context_get_sample_info_by_name.restype = POINTER(pa_operation)
+pa_context_get_sample_info_by_name.argtypes = [POINTER(pa_context), c_char_p, pa_sample_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:705
+pa_context_get_sample_info_by_index = _lib.pa_context_get_sample_info_by_index
+pa_context_get_sample_info_by_index.restype = POINTER(pa_operation)
+pa_context_get_sample_info_by_index.argtypes = [POINTER(pa_context), c_uint32, pa_sample_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:708
+pa_context_get_sample_info_list = _lib.pa_context_get_sample_info_list
+pa_context_get_sample_info_list.restype = POINTER(pa_operation)
+pa_context_get_sample_info_list.argtypes = [POINTER(pa_context), pa_sample_info_cb_t, POINTER(None)]
+
+enum_pa_autoload_type = c_int
+PA_AUTOLOAD_SINK = 0
+PA_AUTOLOAD_SOURCE = 1
+pa_autoload_type_t = enum_pa_autoload_type # /usr/include/pulse/introspect.h:720
+class struct_pa_autoload_info(Structure):
+ __slots__ = [
+ 'index',
+ 'name',
+ 'type',
+ 'module',
+ 'argument',
+ ]
+struct_pa_autoload_info._fields_ = [
+ ('index', c_uint32),
+ ('name', c_char_p),
+ ('type', pa_autoload_type_t),
+ ('module', c_char_p),
+ ('argument', c_char_p),
+]
+
+pa_autoload_info = struct_pa_autoload_info # /usr/include/pulse/introspect.h:731
+pa_autoload_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_autoload_info), c_int, POINTER(None)) # /usr/include/pulse/introspect.h:734
+# /usr/include/pulse/introspect.h:737
+pa_context_get_autoload_info_by_name = _lib.pa_context_get_autoload_info_by_name
+pa_context_get_autoload_info_by_name.restype = POINTER(pa_operation)
+pa_context_get_autoload_info_by_name.argtypes = [POINTER(pa_context), c_char_p, pa_autoload_type_t, pa_autoload_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:740
+pa_context_get_autoload_info_by_index = _lib.pa_context_get_autoload_info_by_index
+pa_context_get_autoload_info_by_index.restype = POINTER(pa_operation)
+pa_context_get_autoload_info_by_index.argtypes = [POINTER(pa_context), c_uint32, pa_autoload_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:743
+pa_context_get_autoload_info_list = _lib.pa_context_get_autoload_info_list
+pa_context_get_autoload_info_list.restype = POINTER(pa_operation)
+pa_context_get_autoload_info_list.argtypes = [POINTER(pa_context), pa_autoload_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:746
+pa_context_add_autoload = _lib.pa_context_add_autoload
+pa_context_add_autoload.restype = POINTER(pa_operation)
+pa_context_add_autoload.argtypes = [POINTER(pa_context), c_char_p, pa_autoload_type_t, c_char_p, c_char_p, pa_context_index_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:749
+pa_context_remove_autoload_by_name = _lib.pa_context_remove_autoload_by_name
+pa_context_remove_autoload_by_name.restype = POINTER(pa_operation)
+pa_context_remove_autoload_by_name.argtypes = [POINTER(pa_context), c_char_p, pa_autoload_type_t, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:752
+pa_context_remove_autoload_by_index = _lib.pa_context_remove_autoload_by_index
+pa_context_remove_autoload_by_index.restype = POINTER(pa_operation)
+pa_context_remove_autoload_by_index.argtypes = [POINTER(pa_context), c_uint32, pa_context_success_cb_t, POINTER(None)]
+
+pa_context_subscribe_cb_t = CFUNCTYPE(None, POINTER(pa_context), pa_subscription_event_type_t, c_uint32, POINTER(None)) # /usr/include/pulse/subscribe.h:73
+# /usr/include/pulse/subscribe.h:76
+pa_context_subscribe = _lib.pa_context_subscribe
+pa_context_subscribe.restype = POINTER(pa_operation)
+pa_context_subscribe.argtypes = [POINTER(pa_context), pa_subscription_mask_t, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/subscribe.h:79
+pa_context_set_subscribe_callback = _lib.pa_context_set_subscribe_callback
+pa_context_set_subscribe_callback.restype = None
+pa_context_set_subscribe_callback.argtypes = [POINTER(pa_context), pa_context_subscribe_cb_t, POINTER(None)]
+
+pa_context_play_sample_cb_t = CFUNCTYPE(None, POINTER(pa_context), c_uint32, POINTER(None)) # /usr/include/pulse/scache.h:85
+# /usr/include/pulse/scache.h:88
+pa_stream_connect_upload = _lib.pa_stream_connect_upload
+pa_stream_connect_upload.restype = c_int
+pa_stream_connect_upload.argtypes = [POINTER(pa_stream), c_size_t]
+
+# /usr/include/pulse/scache.h:93
+pa_stream_finish_upload = _lib.pa_stream_finish_upload
+pa_stream_finish_upload.restype = c_int
+pa_stream_finish_upload.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/scache.h:96
+pa_context_remove_sample = _lib.pa_context_remove_sample
+pa_context_remove_sample.restype = POINTER(pa_operation)
+pa_context_remove_sample.argtypes = [POINTER(pa_context), c_char_p, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/scache.h:101
+pa_context_play_sample = _lib.pa_context_play_sample
+pa_context_play_sample.restype = POINTER(pa_operation)
+pa_context_play_sample.argtypes = [POINTER(pa_context), c_char_p, c_char_p, pa_volume_t, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/scache.h:113
+pa_context_play_sample_with_proplist = _lib.pa_context_play_sample_with_proplist
+pa_context_play_sample_with_proplist.restype = POINTER(pa_operation)
+pa_context_play_sample_with_proplist.argtypes = [POINTER(pa_context), c_char_p, c_char_p, pa_volume_t, POINTER(pa_proplist), pa_context_play_sample_cb_t, POINTER(None)]
+
+# /usr/include/pulse/error.h:33
+pa_strerror = _lib.pa_strerror
+pa_strerror.restype = c_char_p
+pa_strerror.argtypes = [c_int]
+
+# /usr/include/pulse/xmalloc.h:39
+pa_xmalloc = _lib.pa_xmalloc
+pa_xmalloc.restype = POINTER(c_void)
+pa_xmalloc.argtypes = [c_size_t]
+
+# /usr/include/pulse/xmalloc.h:42
+pa_xmalloc0 = _lib.pa_xmalloc0
+pa_xmalloc0.restype = POINTER(c_void)
+pa_xmalloc0.argtypes = [c_size_t]
+
+# /usr/include/pulse/xmalloc.h:45
+pa_xrealloc = _lib.pa_xrealloc
+pa_xrealloc.restype = POINTER(c_void)
+pa_xrealloc.argtypes = [POINTER(None), c_size_t]
+
+# /usr/include/pulse/xmalloc.h:48
+pa_xfree = _lib.pa_xfree
+pa_xfree.restype = None
+pa_xfree.argtypes = [POINTER(None)]
+
+# /usr/include/pulse/xmalloc.h:51
+pa_xstrdup = _lib.pa_xstrdup
+pa_xstrdup.restype = c_char_p
+pa_xstrdup.argtypes = [c_char_p]
+
+# /usr/include/pulse/xmalloc.h:54
+pa_xstrndup = _lib.pa_xstrndup
+pa_xstrndup.restype = c_char_p
+pa_xstrndup.argtypes = [c_char_p, c_size_t]
+
+# /usr/include/pulse/xmalloc.h:57
+pa_xmemdup = _lib.pa_xmemdup
+pa_xmemdup.restype = POINTER(c_void)
+pa_xmemdup.argtypes = [POINTER(None), c_size_t]
+
+# /usr/include/pulse/utf8.h:35
+pa_utf8_valid = _lib.pa_utf8_valid
+pa_utf8_valid.restype = c_char_p
+pa_utf8_valid.argtypes = [c_char_p]
+
+# /usr/include/pulse/utf8.h:38
+pa_ascii_valid = _lib.pa_ascii_valid
+pa_ascii_valid.restype = c_char_p
+pa_ascii_valid.argtypes = [c_char_p]
+
+# /usr/include/pulse/utf8.h:41
+pa_utf8_filter = _lib.pa_utf8_filter
+pa_utf8_filter.restype = c_char_p
+pa_utf8_filter.argtypes = [c_char_p]
+
+# /usr/include/pulse/utf8.h:44
+pa_ascii_filter = _lib.pa_ascii_filter
+pa_ascii_filter.restype = c_char_p
+pa_ascii_filter.argtypes = [c_char_p]
+
+# /usr/include/pulse/utf8.h:47
+pa_utf8_to_locale = _lib.pa_utf8_to_locale
+pa_utf8_to_locale.restype = c_char_p
+pa_utf8_to_locale.argtypes = [c_char_p]
+
+# /usr/include/pulse/utf8.h:50
+pa_locale_to_utf8 = _lib.pa_locale_to_utf8
+pa_locale_to_utf8.restype = c_char_p
+pa_locale_to_utf8.argtypes = [c_char_p]
+
+class struct_pa_threaded_mainloop(Structure):
+ __slots__ = [
+ ]
+struct_pa_threaded_mainloop._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_pa_threaded_mainloop(Structure):
+ __slots__ = [
+ ]
+struct_pa_threaded_mainloop._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_threaded_mainloop = struct_pa_threaded_mainloop # /usr/include/pulse/thread-mainloop.h:246
+# /usr/include/pulse/thread-mainloop.h:251
+pa_threaded_mainloop_new = _lib.pa_threaded_mainloop_new
+pa_threaded_mainloop_new.restype = POINTER(pa_threaded_mainloop)
+pa_threaded_mainloop_new.argtypes = []
+
+# /usr/include/pulse/thread-mainloop.h:256
+pa_threaded_mainloop_free = _lib.pa_threaded_mainloop_free
+pa_threaded_mainloop_free.restype = None
+pa_threaded_mainloop_free.argtypes = [POINTER(pa_threaded_mainloop)]
+
+# /usr/include/pulse/thread-mainloop.h:259
+pa_threaded_mainloop_start = _lib.pa_threaded_mainloop_start
+pa_threaded_mainloop_start.restype = c_int
+pa_threaded_mainloop_start.argtypes = [POINTER(pa_threaded_mainloop)]
+
+# /usr/include/pulse/thread-mainloop.h:263
+pa_threaded_mainloop_stop = _lib.pa_threaded_mainloop_stop
+pa_threaded_mainloop_stop.restype = None
+pa_threaded_mainloop_stop.argtypes = [POINTER(pa_threaded_mainloop)]
+
+# /usr/include/pulse/thread-mainloop.h:271
+pa_threaded_mainloop_lock = _lib.pa_threaded_mainloop_lock
+pa_threaded_mainloop_lock.restype = None
+pa_threaded_mainloop_lock.argtypes = [POINTER(pa_threaded_mainloop)]
+
+# /usr/include/pulse/thread-mainloop.h:274
+pa_threaded_mainloop_unlock = _lib.pa_threaded_mainloop_unlock
+pa_threaded_mainloop_unlock.restype = None
+pa_threaded_mainloop_unlock.argtypes = [POINTER(pa_threaded_mainloop)]
+
+# /usr/include/pulse/thread-mainloop.h:285
+pa_threaded_mainloop_wait = _lib.pa_threaded_mainloop_wait
+pa_threaded_mainloop_wait.restype = None
+pa_threaded_mainloop_wait.argtypes = [POINTER(pa_threaded_mainloop)]
+
+# /usr/include/pulse/thread-mainloop.h:292
+pa_threaded_mainloop_signal = _lib.pa_threaded_mainloop_signal
+pa_threaded_mainloop_signal.restype = None
+pa_threaded_mainloop_signal.argtypes = [POINTER(pa_threaded_mainloop), c_int]
+
+# /usr/include/pulse/thread-mainloop.h:298
+pa_threaded_mainloop_accept = _lib.pa_threaded_mainloop_accept
+pa_threaded_mainloop_accept.restype = None
+pa_threaded_mainloop_accept.argtypes = [POINTER(pa_threaded_mainloop)]
+
+# /usr/include/pulse/thread-mainloop.h:302
+pa_threaded_mainloop_get_retval = _lib.pa_threaded_mainloop_get_retval
+pa_threaded_mainloop_get_retval.restype = c_int
+pa_threaded_mainloop_get_retval.argtypes = [POINTER(pa_threaded_mainloop)]
+
+# /usr/include/pulse/thread-mainloop.h:307
+pa_threaded_mainloop_get_api = _lib.pa_threaded_mainloop_get_api
+pa_threaded_mainloop_get_api.restype = POINTER(pa_mainloop_api)
+pa_threaded_mainloop_get_api.argtypes = [POINTER(pa_threaded_mainloop)]
+
+# /usr/include/pulse/thread-mainloop.h:310
+pa_threaded_mainloop_in_thread = _lib.pa_threaded_mainloop_in_thread
+pa_threaded_mainloop_in_thread.restype = c_int
+pa_threaded_mainloop_in_thread.argtypes = [POINTER(pa_threaded_mainloop)]
+
+# /usr/include/pulse/thread-mainloop.h:313
+pa_threaded_mainloop_set_name = _lib.pa_threaded_mainloop_set_name
+pa_threaded_mainloop_set_name.restype = None
+pa_threaded_mainloop_set_name.argtypes = [POINTER(pa_threaded_mainloop), c_char_p]
+
+class struct_pa_mainloop(Structure):
+ __slots__ = [
+ ]
+struct_pa_mainloop._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_pa_mainloop(Structure):
+ __slots__ = [
+ ]
+struct_pa_mainloop._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_mainloop = struct_pa_mainloop # /usr/include/pulse/mainloop.h:78
+# /usr/include/pulse/mainloop.h:81
+pa_mainloop_new = _lib.pa_mainloop_new
+pa_mainloop_new.restype = POINTER(pa_mainloop)
+pa_mainloop_new.argtypes = []
+
+# /usr/include/pulse/mainloop.h:84
+pa_mainloop_free = _lib.pa_mainloop_free
+pa_mainloop_free.restype = None
+pa_mainloop_free.argtypes = [POINTER(pa_mainloop)]
+
+# /usr/include/pulse/mainloop.h:89
+pa_mainloop_prepare = _lib.pa_mainloop_prepare
+pa_mainloop_prepare.restype = c_int
+pa_mainloop_prepare.argtypes = [POINTER(pa_mainloop), c_int]
+
+# /usr/include/pulse/mainloop.h:92
+pa_mainloop_poll = _lib.pa_mainloop_poll
+pa_mainloop_poll.restype = c_int
+pa_mainloop_poll.argtypes = [POINTER(pa_mainloop)]
+
+# /usr/include/pulse/mainloop.h:96
+pa_mainloop_dispatch = _lib.pa_mainloop_dispatch
+pa_mainloop_dispatch.restype = c_int
+pa_mainloop_dispatch.argtypes = [POINTER(pa_mainloop)]
+
+# /usr/include/pulse/mainloop.h:99
+pa_mainloop_get_retval = _lib.pa_mainloop_get_retval
+pa_mainloop_get_retval.restype = c_int
+pa_mainloop_get_retval.argtypes = [POINTER(pa_mainloop)]
+
+# /usr/include/pulse/mainloop.h:107
+pa_mainloop_iterate = _lib.pa_mainloop_iterate
+pa_mainloop_iterate.restype = c_int
+pa_mainloop_iterate.argtypes = [POINTER(pa_mainloop), c_int, POINTER(c_int)]
+
+# /usr/include/pulse/mainloop.h:110
+pa_mainloop_run = _lib.pa_mainloop_run
+pa_mainloop_run.restype = c_int
+pa_mainloop_run.argtypes = [POINTER(pa_mainloop), POINTER(c_int)]
+
+# /usr/include/pulse/mainloop.h:115
+pa_mainloop_get_api = _lib.pa_mainloop_get_api
+pa_mainloop_get_api.restype = POINTER(pa_mainloop_api)
+pa_mainloop_get_api.argtypes = [POINTER(pa_mainloop)]
+
+# /usr/include/pulse/mainloop.h:118
+pa_mainloop_quit = _lib.pa_mainloop_quit
+pa_mainloop_quit.restype = None
+pa_mainloop_quit.argtypes = [POINTER(pa_mainloop), c_int]
+
+# /usr/include/pulse/mainloop.h:121
+pa_mainloop_wakeup = _lib.pa_mainloop_wakeup
+pa_mainloop_wakeup.restype = None
+pa_mainloop_wakeup.argtypes = [POINTER(pa_mainloop)]
+
+class struct_pollfd(Structure):
+ __slots__ = [
+ ]
+struct_pollfd._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_pollfd(Structure):
+ __slots__ = [
+ ]
+struct_pollfd._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_poll_func = CFUNCTYPE(c_int, POINTER(struct_pollfd), c_ulong, c_int, POINTER(None)) # /usr/include/pulse/mainloop.h:124
+# /usr/include/pulse/mainloop.h:127
+pa_mainloop_set_poll_func = _lib.pa_mainloop_set_poll_func
+pa_mainloop_set_poll_func.restype = None
+pa_mainloop_set_poll_func.argtypes = [POINTER(pa_mainloop), pa_poll_func, POINTER(None)]
+
+class struct_pa_signal_event(Structure):
+ __slots__ = [
+ ]
+struct_pa_signal_event._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_pa_signal_event(Structure):
+ __slots__ = [
+ ]
+struct_pa_signal_event._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_signal_event = struct_pa_signal_event # /usr/include/pulse/mainloop-signal.h:39
+pa_signal_cb_t = CFUNCTYPE(None, POINTER(pa_mainloop_api), POINTER(pa_signal_event), c_int, POINTER(None)) # /usr/include/pulse/mainloop-signal.h:42
+pa_signal_destroy_cb_t = CFUNCTYPE(None, POINTER(pa_mainloop_api), POINTER(pa_signal_event), POINTER(None)) # /usr/include/pulse/mainloop-signal.h:45
+# /usr/include/pulse/mainloop-signal.h:48
+pa_signal_init = _lib.pa_signal_init
+pa_signal_init.restype = c_int
+pa_signal_init.argtypes = [POINTER(pa_mainloop_api)]
+
+# /usr/include/pulse/mainloop-signal.h:51
+pa_signal_done = _lib.pa_signal_done
+pa_signal_done.restype = None
+pa_signal_done.argtypes = []
+
+# /usr/include/pulse/mainloop-signal.h:54
+pa_signal_new = _lib.pa_signal_new
+pa_signal_new.restype = POINTER(pa_signal_event)
+pa_signal_new.argtypes = [c_int, pa_signal_cb_t, POINTER(None)]
+
+# /usr/include/pulse/mainloop-signal.h:57
+pa_signal_free = _lib.pa_signal_free
+pa_signal_free.restype = None
+pa_signal_free.argtypes = [POINTER(pa_signal_event)]
+
+# /usr/include/pulse/mainloop-signal.h:60
+pa_signal_set_destroy = _lib.pa_signal_set_destroy
+pa_signal_set_destroy.restype = None
+pa_signal_set_destroy.argtypes = [POINTER(pa_signal_event), pa_signal_destroy_cb_t]
+
+# /usr/include/pulse/util.h:35
+pa_get_user_name = _lib.pa_get_user_name
+pa_get_user_name.restype = c_char_p
+pa_get_user_name.argtypes = [c_char_p, c_size_t]
+
+# /usr/include/pulse/util.h:38
+pa_get_host_name = _lib.pa_get_host_name
+pa_get_host_name.restype = c_char_p
+pa_get_host_name.argtypes = [c_char_p, c_size_t]
+
+# /usr/include/pulse/util.h:41
+pa_get_fqdn = _lib.pa_get_fqdn
+pa_get_fqdn.restype = c_char_p
+pa_get_fqdn.argtypes = [c_char_p, c_size_t]
+
+# /usr/include/pulse/util.h:44
+pa_get_home_dir = _lib.pa_get_home_dir
+pa_get_home_dir.restype = c_char_p
+pa_get_home_dir.argtypes = [c_char_p, c_size_t]
+
+# /usr/include/pulse/util.h:48
+pa_get_binary_name = _lib.pa_get_binary_name
+pa_get_binary_name.restype = c_char_p
+pa_get_binary_name.argtypes = [c_char_p, c_size_t]
+
+# /usr/include/pulse/util.h:52
+pa_path_get_filename = _lib.pa_path_get_filename
+pa_path_get_filename.restype = c_char_p
+pa_path_get_filename.argtypes = [c_char_p]
+
+# /usr/include/pulse/util.h:55
+pa_msleep = _lib.pa_msleep
+pa_msleep.restype = c_int
+pa_msleep.argtypes = [c_ulong]
+
+class struct_timeval(Structure):
+ __slots__ = [
+ ]
+struct_timeval._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_timeval(Structure):
+ __slots__ = [
+ ]
+struct_timeval._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+# /usr/include/pulse/timeval.h:61
+pa_gettimeofday = _lib.pa_gettimeofday
+pa_gettimeofday.restype = POINTER(struct_timeval)
+pa_gettimeofday.argtypes = [POINTER(struct_timeval)]
+
+class struct_timeval(Structure):
+ __slots__ = [
+ ]
+struct_timeval._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_timeval(Structure):
+ __slots__ = [
+ ]
+struct_timeval._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+# /usr/include/pulse/timeval.h:65
+pa_timeval_diff = _lib.pa_timeval_diff
+pa_timeval_diff.restype = pa_usec_t
+pa_timeval_diff.argtypes = [POINTER(struct_timeval), POINTER(struct_timeval)]
+
+class struct_timeval(Structure):
+ __slots__ = [
+ ]
+struct_timeval._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_timeval(Structure):
+ __slots__ = [
+ ]
+struct_timeval._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+# /usr/include/pulse/timeval.h:68
+pa_timeval_cmp = _lib.pa_timeval_cmp
+pa_timeval_cmp.restype = c_int
+pa_timeval_cmp.argtypes = [POINTER(struct_timeval), POINTER(struct_timeval)]
+
+class struct_timeval(Structure):
+ __slots__ = [
+ ]
+struct_timeval._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+# /usr/include/pulse/timeval.h:71
+pa_timeval_age = _lib.pa_timeval_age
+pa_timeval_age.restype = pa_usec_t
+pa_timeval_age.argtypes = [POINTER(struct_timeval)]
+
+class struct_timeval(Structure):
+ __slots__ = [
+ ]
+struct_timeval._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_timeval(Structure):
+ __slots__ = [
+ ]
+struct_timeval._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+# /usr/include/pulse/timeval.h:74
+pa_timeval_add = _lib.pa_timeval_add
+pa_timeval_add.restype = POINTER(struct_timeval)
+pa_timeval_add.argtypes = [POINTER(struct_timeval), pa_usec_t]
+
+class struct_timeval(Structure):
+ __slots__ = [
+ ]
+struct_timeval._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_timeval(Structure):
+ __slots__ = [
+ ]
+struct_timeval._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+# /usr/include/pulse/timeval.h:77
+pa_timeval_sub = _lib.pa_timeval_sub
+pa_timeval_sub.restype = POINTER(struct_timeval)
+pa_timeval_sub.argtypes = [POINTER(struct_timeval), pa_usec_t]
+
+class struct_timeval(Structure):
+ __slots__ = [
+ ]
+struct_timeval._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct_timeval(Structure):
+ __slots__ = [
+ ]
+struct_timeval._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+# /usr/include/pulse/timeval.h:80
+pa_timeval_store = _lib.pa_timeval_store
+pa_timeval_store.restype = POINTER(struct_timeval)
+pa_timeval_store.argtypes = [POINTER(struct_timeval), pa_usec_t]
+
+class struct_timeval(Structure):
+ __slots__ = [
+ ]
+struct_timeval._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+# /usr/include/pulse/timeval.h:83
+pa_timeval_load = _lib.pa_timeval_load
+pa_timeval_load.restype = pa_usec_t
+pa_timeval_load.argtypes = [POINTER(struct_timeval)]
+
+
+__all__ = ['pa_get_library_version', 'PA_API_VERSION', 'PA_PROTOCOL_VERSION',
+'PA_MAJOR', 'PA_MINOR', 'PA_MICRO', 'PA_CHANNELS_MAX', 'PA_RATE_MAX',
+'pa_sample_format_t', 'PA_SAMPLE_U8', 'PA_SAMPLE_ALAW', 'PA_SAMPLE_ULAW',
+'PA_SAMPLE_S16LE', 'PA_SAMPLE_S16BE', 'PA_SAMPLE_FLOAT32LE',
+'PA_SAMPLE_FLOAT32BE', 'PA_SAMPLE_S32LE', 'PA_SAMPLE_S32BE',
+'PA_SAMPLE_S24LE', 'PA_SAMPLE_S24BE', 'PA_SAMPLE_S24_32LE',
+'PA_SAMPLE_S24_32BE', 'PA_SAMPLE_MAX', 'PA_SAMPLE_INVALID', 'pa_sample_spec',
+'pa_usec_t', 'pa_bytes_per_second', 'pa_frame_size', 'pa_sample_size',
+'pa_sample_size_of_format', 'pa_bytes_to_usec', 'pa_usec_to_bytes',
+'pa_sample_spec_init', 'pa_sample_format_valid', 'pa_sample_rate_valid',
+'pa_channels_valid', 'pa_sample_spec_valid', 'pa_sample_spec_equal',
+'pa_sample_format_to_string', 'pa_parse_sample_format',
+'PA_SAMPLE_SPEC_SNPRINT_MAX', 'pa_sample_spec_snprint',
+'PA_BYTES_SNPRINT_MAX', 'pa_bytes_snprint', 'pa_sample_format_is_le',
+'pa_sample_format_is_be', 'pa_context_state_t', 'PA_CONTEXT_UNCONNECTED',
+'PA_CONTEXT_CONNECTING', 'PA_CONTEXT_AUTHORIZING', 'PA_CONTEXT_SETTING_NAME',
+'PA_CONTEXT_READY', 'PA_CONTEXT_FAILED', 'PA_CONTEXT_TERMINATED',
+'pa_stream_state_t', 'PA_STREAM_UNCONNECTED', 'PA_STREAM_CREATING',
+'PA_STREAM_READY', 'PA_STREAM_FAILED', 'PA_STREAM_TERMINATED',
+'pa_operation_state_t', 'PA_OPERATION_RUNNING', 'PA_OPERATION_DONE',
+'PA_OPERATION_CANCELLED', 'pa_context_flags_t', 'PA_CONTEXT_NOFLAGS',
+'PA_CONTEXT_NOAUTOSPAWN', 'PA_CONTEXT_NOFAIL', 'pa_direction_t',
+'PA_DIRECTION_OUTPUT', 'PA_DIRECTION_INPUT', 'pa_device_type_t',
+'PA_DEVICE_TYPE_SINK', 'PA_DEVICE_TYPE_SOURCE', 'pa_stream_direction_t',
+'PA_STREAM_NODIRECTION', 'PA_STREAM_PLAYBACK', 'PA_STREAM_RECORD',
+'PA_STREAM_UPLOAD', 'pa_stream_flags_t', 'PA_STREAM_NOFLAGS',
+'PA_STREAM_START_CORKED', 'PA_STREAM_INTERPOLATE_TIMING',
+'PA_STREAM_NOT_MONOTONIC', 'PA_STREAM_AUTO_TIMING_UPDATE',
+'PA_STREAM_NO_REMAP_CHANNELS', 'PA_STREAM_NO_REMIX_CHANNELS',
+'PA_STREAM_FIX_FORMAT', 'PA_STREAM_FIX_RATE', 'PA_STREAM_FIX_CHANNELS',
+'PA_STREAM_DONT_MOVE', 'PA_STREAM_VARIABLE_RATE', 'PA_STREAM_PEAK_DETECT',
+'PA_STREAM_START_MUTED', 'PA_STREAM_ADJUST_LATENCY',
+'PA_STREAM_EARLY_REQUESTS', 'PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND',
+'PA_STREAM_START_UNMUTED', 'PA_STREAM_FAIL_ON_SUSPEND',
+'PA_STREAM_RELATIVE_VOLUME', 'PA_STREAM_PASSTHROUGH', 'pa_buffer_attr',
+'pa_error_code_t', 'PA_OK', 'PA_ERR_ACCESS', 'PA_ERR_COMMAND',
+'PA_ERR_INVALID', 'PA_ERR_EXIST', 'PA_ERR_NOENTITY',
+'PA_ERR_CONNECTIONREFUSED', 'PA_ERR_PROTOCOL', 'PA_ERR_TIMEOUT',
+'PA_ERR_AUTHKEY', 'PA_ERR_INTERNAL', 'PA_ERR_CONNECTIONTERMINATED',
+'PA_ERR_KILLED', 'PA_ERR_INVALIDSERVER', 'PA_ERR_MODINITFAILED',
+'PA_ERR_BADSTATE', 'PA_ERR_NODATA', 'PA_ERR_VERSION', 'PA_ERR_TOOLARGE',
+'PA_ERR_NOTSUPPORTED', 'PA_ERR_UNKNOWN', 'PA_ERR_NOEXTENSION',
+'PA_ERR_OBSOLETE', 'PA_ERR_NOTIMPLEMENTED', 'PA_ERR_FORKED', 'PA_ERR_IO',
+'PA_ERR_BUSY', 'PA_ERR_MAX', 'pa_subscription_mask_t',
+'PA_SUBSCRIPTION_MASK_NULL', 'PA_SUBSCRIPTION_MASK_SINK',
+'PA_SUBSCRIPTION_MASK_SOURCE', 'PA_SUBSCRIPTION_MASK_SINK_INPUT',
+'PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT', 'PA_SUBSCRIPTION_MASK_MODULE',
+'PA_SUBSCRIPTION_MASK_CLIENT', 'PA_SUBSCRIPTION_MASK_SAMPLE_CACHE',
+'PA_SUBSCRIPTION_MASK_SERVER', 'PA_SUBSCRIPTION_MASK_AUTOLOAD',
+'PA_SUBSCRIPTION_MASK_CARD', 'PA_SUBSCRIPTION_MASK_ALL',
+'pa_subscription_event_type_t', 'PA_SUBSCRIPTION_EVENT_SINK',
+'PA_SUBSCRIPTION_EVENT_SOURCE', 'PA_SUBSCRIPTION_EVENT_SINK_INPUT',
+'PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT', 'PA_SUBSCRIPTION_EVENT_MODULE',
+'PA_SUBSCRIPTION_EVENT_CLIENT', 'PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE',
+'PA_SUBSCRIPTION_EVENT_SERVER', 'PA_SUBSCRIPTION_EVENT_AUTOLOAD',
+'PA_SUBSCRIPTION_EVENT_CARD', 'PA_SUBSCRIPTION_EVENT_FACILITY_MASK',
+'PA_SUBSCRIPTION_EVENT_NEW', 'PA_SUBSCRIPTION_EVENT_CHANGE',
+'PA_SUBSCRIPTION_EVENT_REMOVE', 'PA_SUBSCRIPTION_EVENT_TYPE_MASK',
+'pa_timing_info', 'pa_spawn_api', 'pa_seek_mode_t', 'PA_SEEK_RELATIVE',
+'PA_SEEK_ABSOLUTE', 'PA_SEEK_RELATIVE_ON_READ', 'PA_SEEK_RELATIVE_END',
+'pa_sink_flags_t', 'PA_SINK_NOFLAGS', 'PA_SINK_HW_VOLUME_CTRL',
+'PA_SINK_LATENCY', 'PA_SINK_HARDWARE', 'PA_SINK_NETWORK',
+'PA_SINK_HW_MUTE_CTRL', 'PA_SINK_DECIBEL_VOLUME', 'PA_SINK_FLAT_VOLUME',
+'PA_SINK_DYNAMIC_LATENCY', 'PA_SINK_SET_FORMATS', 'pa_sink_state_t',
+'PA_SINK_INVALID_STATE', 'PA_SINK_RUNNING', 'PA_SINK_IDLE',
+'PA_SINK_SUSPENDED', 'PA_SINK_INIT', 'PA_SINK_UNLINKED', 'pa_source_flags_t',
+'PA_SOURCE_NOFLAGS', 'PA_SOURCE_HW_VOLUME_CTRL', 'PA_SOURCE_LATENCY',
+'PA_SOURCE_HARDWARE', 'PA_SOURCE_NETWORK', 'PA_SOURCE_HW_MUTE_CTRL',
+'PA_SOURCE_DECIBEL_VOLUME', 'PA_SOURCE_DYNAMIC_LATENCY',
+'PA_SOURCE_FLAT_VOLUME', 'pa_source_state_t', 'PA_SOURCE_INVALID_STATE',
+'PA_SOURCE_RUNNING', 'PA_SOURCE_IDLE', 'PA_SOURCE_SUSPENDED',
+'PA_SOURCE_INIT', 'PA_SOURCE_UNLINKED', 'pa_free_cb_t', 'pa_port_available_t',
+'PA_PORT_AVAILABLE_UNKNOWN', 'PA_PORT_AVAILABLE_NO', 'PA_PORT_AVAILABLE_YES',
+'pa_mainloop_api', 'pa_io_event_flags_t', 'PA_IO_EVENT_NULL',
+'PA_IO_EVENT_INPUT', 'PA_IO_EVENT_OUTPUT', 'PA_IO_EVENT_HANGUP',
+'PA_IO_EVENT_ERROR', 'pa_io_event', 'pa_io_event_cb_t',
+'pa_io_event_destroy_cb_t', 'pa_time_event', 'pa_time_event_cb_t',
+'pa_time_event_destroy_cb_t', 'pa_defer_event', 'pa_defer_event_cb_t',
+'pa_defer_event_destroy_cb_t', 'pa_mainloop_api_once',
+'pa_channel_position_t', 'PA_CHANNEL_POSITION_INVALID',
+'PA_CHANNEL_POSITION_MONO', 'PA_CHANNEL_POSITION_FRONT_LEFT',
+'PA_CHANNEL_POSITION_FRONT_RIGHT', 'PA_CHANNEL_POSITION_FRONT_CENTER',
+'PA_CHANNEL_POSITION_LEFT', 'PA_CHANNEL_POSITION_RIGHT',
+'PA_CHANNEL_POSITION_CENTER', 'PA_CHANNEL_POSITION_REAR_CENTER',
+'PA_CHANNEL_POSITION_REAR_LEFT', 'PA_CHANNEL_POSITION_REAR_RIGHT',
+'PA_CHANNEL_POSITION_LFE', 'PA_CHANNEL_POSITION_SUBWOOFER',
+'PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER',
+'PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER', 'PA_CHANNEL_POSITION_SIDE_LEFT',
+'PA_CHANNEL_POSITION_SIDE_RIGHT', 'PA_CHANNEL_POSITION_AUX0',
+'PA_CHANNEL_POSITION_AUX1', 'PA_CHANNEL_POSITION_AUX2',
+'PA_CHANNEL_POSITION_AUX3', 'PA_CHANNEL_POSITION_AUX4',
+'PA_CHANNEL_POSITION_AUX5', 'PA_CHANNEL_POSITION_AUX6',
+'PA_CHANNEL_POSITION_AUX7', 'PA_CHANNEL_POSITION_AUX8',
+'PA_CHANNEL_POSITION_AUX9', 'PA_CHANNEL_POSITION_AUX10',
+'PA_CHANNEL_POSITION_AUX11', 'PA_CHANNEL_POSITION_AUX12',
+'PA_CHANNEL_POSITION_AUX13', 'PA_CHANNEL_POSITION_AUX14',
+'PA_CHANNEL_POSITION_AUX15', 'PA_CHANNEL_POSITION_AUX16',
+'PA_CHANNEL_POSITION_AUX17', 'PA_CHANNEL_POSITION_AUX18',
+'PA_CHANNEL_POSITION_AUX19', 'PA_CHANNEL_POSITION_AUX20',
+'PA_CHANNEL_POSITION_AUX21', 'PA_CHANNEL_POSITION_AUX22',
+'PA_CHANNEL_POSITION_AUX23', 'PA_CHANNEL_POSITION_AUX24',
+'PA_CHANNEL_POSITION_AUX25', 'PA_CHANNEL_POSITION_AUX26',
+'PA_CHANNEL_POSITION_AUX27', 'PA_CHANNEL_POSITION_AUX28',
+'PA_CHANNEL_POSITION_AUX29', 'PA_CHANNEL_POSITION_AUX30',
+'PA_CHANNEL_POSITION_AUX31', 'PA_CHANNEL_POSITION_TOP_CENTER',
+'PA_CHANNEL_POSITION_TOP_FRONT_LEFT', 'PA_CHANNEL_POSITION_TOP_FRONT_RIGHT',
+'PA_CHANNEL_POSITION_TOP_FRONT_CENTER', 'PA_CHANNEL_POSITION_TOP_REAR_LEFT',
+'PA_CHANNEL_POSITION_TOP_REAR_RIGHT', 'PA_CHANNEL_POSITION_TOP_REAR_CENTER',
+'PA_CHANNEL_POSITION_MAX', 'pa_channel_position_mask_t',
+'pa_channel_map_def_t', 'PA_CHANNEL_MAP_AIFF', 'PA_CHANNEL_MAP_ALSA',
+'PA_CHANNEL_MAP_AUX', 'PA_CHANNEL_MAP_WAVEEX', 'PA_CHANNEL_MAP_OSS',
+'PA_CHANNEL_MAP_DEF_MAX', 'PA_CHANNEL_MAP_DEFAULT', 'pa_channel_map',
+'pa_channel_map_init', 'pa_channel_map_init_mono',
+'pa_channel_map_init_stereo', 'pa_channel_map_init_auto',
+'pa_channel_map_init_extend', 'pa_channel_position_to_string',
+'pa_channel_position_from_string', 'pa_channel_position_to_pretty_string',
+'PA_CHANNEL_MAP_SNPRINT_MAX', 'pa_channel_map_snprint',
+'pa_channel_map_parse', 'pa_channel_map_equal', 'pa_channel_map_valid',
+'pa_channel_map_compatible', 'pa_channel_map_superset',
+'pa_channel_map_can_balance', 'pa_channel_map_can_fade',
+'pa_channel_map_to_name', 'pa_channel_map_to_pretty_name',
+'pa_channel_map_has_position', 'pa_channel_map_mask', 'pa_operation',
+'pa_operation_notify_cb_t', 'pa_operation_ref', 'pa_operation_unref',
+'pa_operation_cancel', 'pa_operation_get_state',
+'pa_operation_set_state_callback', 'pa_context', 'pa_context_notify_cb_t',
+'pa_context_success_cb_t', 'pa_context_event_cb_t', 'pa_context_new',
+'pa_context_new_with_proplist', 'pa_context_unref', 'pa_context_ref',
+'pa_context_set_state_callback', 'pa_context_set_event_callback',
+'pa_context_errno', 'pa_context_is_pending', 'pa_context_get_state',
+'pa_context_connect', 'pa_context_disconnect', 'pa_context_drain',
+'pa_context_exit_daemon', 'pa_context_set_default_sink',
+'pa_context_set_default_source', 'pa_context_is_local', 'pa_context_set_name',
+'pa_context_get_server', 'pa_context_get_protocol_version',
+'pa_context_get_server_protocol_version', 'PA_UPDATE_SET', 'PA_UPDATE_MERGE',
+'PA_UPDATE_REPLACE', 'pa_context_proplist_update',
+'pa_context_proplist_remove', 'pa_context_get_index', 'pa_context_rttime_new',
+'pa_context_rttime_restart', 'pa_context_get_tile_size',
+'pa_context_load_cookie_from_file', 'pa_volume_t', 'pa_cvolume',
+'pa_cvolume_equal', 'pa_cvolume_init', 'pa_cvolume_set',
+'PA_CVOLUME_SNPRINT_MAX', 'pa_cvolume_snprint',
+'PA_SW_CVOLUME_SNPRINT_DB_MAX', 'pa_sw_cvolume_snprint_dB',
+'PA_CVOLUME_SNPRINT_VERBOSE_MAX', 'pa_cvolume_snprint_verbose',
+'PA_VOLUME_SNPRINT_MAX', 'pa_volume_snprint', 'PA_SW_VOLUME_SNPRINT_DB_MAX',
+'pa_sw_volume_snprint_dB', 'PA_VOLUME_SNPRINT_VERBOSE_MAX',
+'pa_volume_snprint_verbose', 'pa_cvolume_avg', 'pa_cvolume_avg_mask',
+'pa_cvolume_max', 'pa_cvolume_max_mask', 'pa_cvolume_min',
+'pa_cvolume_min_mask', 'pa_cvolume_valid', 'pa_cvolume_channels_equal_to',
+'pa_sw_volume_multiply', 'pa_sw_cvolume_multiply',
+'pa_sw_cvolume_multiply_scalar', 'pa_sw_volume_divide',
+'pa_sw_cvolume_divide', 'pa_sw_cvolume_divide_scalar', 'pa_sw_volume_from_dB',
+'pa_sw_volume_to_dB', 'pa_sw_volume_from_linear', 'pa_sw_volume_to_linear',
+'pa_cvolume_remap', 'pa_cvolume_compatible',
+'pa_cvolume_compatible_with_channel_map', 'pa_cvolume_get_balance',
+'pa_cvolume_set_balance', 'pa_cvolume_get_fade', 'pa_cvolume_set_fade',
+'pa_cvolume_scale', 'pa_cvolume_scale_mask', 'pa_cvolume_set_position',
+'pa_cvolume_get_position', 'pa_cvolume_merge', 'pa_cvolume_inc_clamp',
+'pa_cvolume_inc', 'pa_cvolume_dec', 'pa_stream', 'pa_stream_success_cb_t',
+'pa_stream_request_cb_t', 'pa_stream_notify_cb_t', 'pa_stream_event_cb_t',
+'pa_stream_new', 'pa_stream_new_with_proplist', 'PA_ENCODING_ANY',
+'PA_ENCODING_PCM', 'PA_ENCODING_AC3_IEC61937', 'PA_ENCODING_EAC3_IEC61937',
+'PA_ENCODING_MPEG_IEC61937', 'PA_ENCODING_DTS_IEC61937',
+'PA_ENCODING_MPEG2_AAC_IEC61937', 'PA_ENCODING_MAX', 'PA_ENCODING_INVALID',
+'pa_stream_new_extended', 'pa_stream_unref', 'pa_stream_ref',
+'pa_stream_get_state', 'pa_stream_get_context', 'pa_stream_get_index',
+'pa_stream_get_device_index', 'pa_stream_get_device_name',
+'pa_stream_is_suspended', 'pa_stream_is_corked', 'pa_stream_connect_playback',
+'pa_stream_connect_record', 'pa_stream_disconnect', 'pa_stream_begin_write',
+'pa_stream_cancel_write', 'pa_stream_write', 'pa_stream_write_ext_free',
+'pa_stream_peek', 'pa_stream_drop', 'pa_stream_writable_size',
+'pa_stream_readable_size', 'pa_stream_drain', 'pa_stream_update_timing_info',
+'pa_stream_set_state_callback', 'pa_stream_set_write_callback',
+'pa_stream_set_read_callback', 'pa_stream_set_overflow_callback',
+'pa_stream_get_underflow_index', 'pa_stream_set_underflow_callback',
+'pa_stream_set_started_callback', 'pa_stream_set_latency_update_callback',
+'pa_stream_set_moved_callback', 'pa_stream_set_suspended_callback',
+'pa_stream_set_event_callback', 'pa_stream_set_buffer_attr_callback',
+'pa_stream_cork', 'pa_stream_flush', 'pa_stream_prebuf', 'pa_stream_trigger',
+'pa_stream_set_name', 'pa_stream_get_time', 'pa_stream_get_latency',
+'pa_stream_get_timing_info', 'pa_stream_get_sample_spec',
+'pa_stream_get_channel_map', 'pa_stream_get_format_info',
+'pa_stream_get_buffer_attr', 'pa_stream_set_buffer_attr',
+'pa_stream_update_sample_rate', 'pa_stream_proplist_update',
+'pa_stream_proplist_remove', 'pa_stream_set_monitor_stream',
+'pa_stream_get_monitor_stream', 'pa_sink_port_info', 'pa_sink_info',
+'pa_sink_info_cb_t', 'pa_context_get_sink_info_by_name',
+'pa_context_get_sink_info_by_index', 'pa_context_get_sink_info_list',
+'pa_context_set_sink_volume_by_index', 'pa_context_set_sink_volume_by_name',
+'pa_context_set_sink_mute_by_index', 'pa_context_set_sink_mute_by_name',
+'pa_context_suspend_sink_by_name', 'pa_context_suspend_sink_by_index',
+'pa_context_set_sink_port_by_index', 'pa_context_set_sink_port_by_name',
+'pa_source_port_info', 'pa_source_info', 'pa_source_info_cb_t',
+'pa_context_get_source_info_by_name', 'pa_context_get_source_info_by_index',
+'pa_context_get_source_info_list', 'pa_context_set_source_volume_by_index',
+'pa_context_set_source_volume_by_name', 'pa_context_set_source_mute_by_index',
+'pa_context_set_source_mute_by_name', 'pa_context_suspend_source_by_name',
+'pa_context_suspend_source_by_index', 'pa_context_set_source_port_by_index',
+'pa_context_set_source_port_by_name', 'pa_server_info', 'pa_server_info_cb_t',
+'pa_context_get_server_info', 'pa_module_info', 'pa_module_info_cb_t',
+'pa_context_get_module_info', 'pa_context_get_module_info_list',
+'pa_context_index_cb_t', 'pa_context_load_module', 'pa_context_unload_module',
+'pa_client_info', 'pa_client_info_cb_t', 'pa_context_get_client_info',
+'pa_context_get_client_info_list', 'pa_context_kill_client',
+'pa_card_profile_info', 'pa_card_profile_info2', 'pa_card_port_info',
+'pa_card_info', 'pa_card_info_cb_t', 'pa_context_get_card_info_by_index',
+'pa_context_get_card_info_by_name', 'pa_context_get_card_info_list',
+'pa_context_set_card_profile_by_index', 'pa_context_set_card_profile_by_name',
+'pa_context_set_port_latency_offset', 'pa_sink_input_info',
+'pa_sink_input_info_cb_t', 'pa_context_get_sink_input_info',
+'pa_context_get_sink_input_info_list', 'pa_context_move_sink_input_by_name',
+'pa_context_move_sink_input_by_index', 'pa_context_set_sink_input_volume',
+'pa_context_set_sink_input_mute', 'pa_context_kill_sink_input',
+'pa_source_output_info', 'pa_source_output_info_cb_t',
+'pa_context_get_source_output_info', 'pa_context_get_source_output_info_list',
+'pa_context_move_source_output_by_name',
+'pa_context_move_source_output_by_index',
+'pa_context_set_source_output_volume', 'pa_context_set_source_output_mute',
+'pa_context_kill_source_output', 'pa_stat_info', 'pa_stat_info_cb_t',
+'pa_context_stat', 'pa_sample_info', 'pa_sample_info_cb_t',
+'pa_context_get_sample_info_by_name', 'pa_context_get_sample_info_by_index',
+'pa_context_get_sample_info_list', 'pa_autoload_type_t', 'PA_AUTOLOAD_SINK',
+'PA_AUTOLOAD_SOURCE', 'pa_autoload_info', 'pa_autoload_info_cb_t',
+'pa_context_get_autoload_info_by_name',
+'pa_context_get_autoload_info_by_index', 'pa_context_get_autoload_info_list',
+'pa_context_add_autoload', 'pa_context_remove_autoload_by_name',
+'pa_context_remove_autoload_by_index', 'pa_context_subscribe_cb_t',
+'pa_context_subscribe', 'pa_context_set_subscribe_callback',
+'pa_context_play_sample_cb_t', 'pa_stream_connect_upload',
+'pa_stream_finish_upload', 'pa_context_remove_sample',
+'pa_context_play_sample', 'pa_context_play_sample_with_proplist',
+'pa_strerror', 'pa_xmalloc', 'pa_xmalloc0', 'pa_xrealloc', 'pa_xfree',
+'pa_xstrdup', 'pa_xstrndup', 'pa_xmemdup', '_pa_xnew_internal',
+'_pa_xnew0_internal', '_pa_xnewdup_internal', '_pa_xrenew_internal',
+'pa_utf8_valid', 'pa_ascii_valid', 'pa_utf8_filter', 'pa_ascii_filter',
+'pa_utf8_to_locale', 'pa_locale_to_utf8', 'pa_threaded_mainloop',
+'pa_threaded_mainloop_new', 'pa_threaded_mainloop_free',
+'pa_threaded_mainloop_start', 'pa_threaded_mainloop_stop',
+'pa_threaded_mainloop_lock', 'pa_threaded_mainloop_unlock',
+'pa_threaded_mainloop_wait', 'pa_threaded_mainloop_signal',
+'pa_threaded_mainloop_accept', 'pa_threaded_mainloop_get_retval',
+'pa_threaded_mainloop_get_api', 'pa_threaded_mainloop_in_thread',
+'pa_threaded_mainloop_set_name', 'pa_mainloop', 'pa_mainloop_new',
+'pa_mainloop_free', 'pa_mainloop_prepare', 'pa_mainloop_poll',
+'pa_mainloop_dispatch', 'pa_mainloop_get_retval', 'pa_mainloop_iterate',
+'pa_mainloop_run', 'pa_mainloop_get_api', 'pa_mainloop_quit',
+'pa_mainloop_wakeup', 'pa_poll_func', 'pa_mainloop_set_poll_func',
+'pa_signal_event', 'pa_signal_cb_t', 'pa_signal_destroy_cb_t',
+'pa_signal_init', 'pa_signal_done', 'pa_signal_new', 'pa_signal_free',
+'pa_signal_set_destroy', 'pa_get_user_name', 'pa_get_host_name',
+'pa_get_fqdn', 'pa_get_home_dir', 'pa_get_binary_name',
+'pa_path_get_filename', 'pa_msleep', 'pa_gettimeofday', 'pa_timeval_diff',
+'pa_timeval_cmp', 'pa_timeval_age', 'pa_timeval_add', 'pa_timeval_sub',
+'pa_timeval_store', 'pa_timeval_load']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/silent.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/silent.py
new file mode 100644
index 0000000..747345d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/drivers/silent.py
@@ -0,0 +1,403 @@
+from __future__ import print_function
+from __future__ import division
+from builtins import object
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+import time
+
+from pyglet.app import WeakSet
+from pyglet.media.events import MediaEvent
+from pyglet.media.drivers.base import AbstractAudioDriver, AbstractAudioPlayer
+from pyglet.media.threads import MediaThread
+
+import pyglet
+_debug = pyglet.options['debug_media']
+
+
+class SilentAudioPacket(object):
+ def __init__(self, timestamp, duration):
+ self.timestamp = timestamp
+ self.duration = duration
+
+ def consume(self, dt):
+ """Try to consume `dt` seconds of audio data. Return number of seconds consumed."""
+ if dt > self.duration:
+ duration = self.duration
+ self.timestamp += self.duration
+ self.duration = 0.
+ return duration
+ else:
+ self.timestamp += dt
+ self.duration -= dt
+ return dt
+
+ def is_empty(self):
+ return self.duration == 0
+
+
+class SilentAudioBuffer(object):
+ """Buffer for silent audio packets"""
+ def __init__(self):
+ self.clear()
+
+ def clear(self):
+ # Buffered audio packets
+ self._packets = []
+
+ # Duration of the buffered contents
+ self.duration = 0.
+
+ def add_audio_data(self, audio_data):
+ assert audio_data is not None
+ packet = SilentAudioPacket(audio_data.timestamp, audio_data.duration)
+ self._add_packet(packet)
+
+ def consume_audio_data(self, dt):
+ assert dt >= 0.
+ while dt > 0. and not self.is_empty():
+ consumed = self._packets[0].consume(dt)
+ self.duration -= consumed
+ if self._packets[0].is_empty():
+ self._next_packet()
+ dt -= consumed
+
+ def is_empty(self):
+ return self.duration <= 0
+
+ def get_current_timestamp(self):
+ if self._packets:
+ return self._packets[0].timestamp
+ else:
+ return 0.
+
+ def get_time_to_next_update(self):
+ if self._packets and self.duration > 0.:
+ return self._packets[0].duration
+ else:
+ return None
+
+ def _add_packet(self, packet):
+ self.duration += packet.duration
+ self._packets.append(packet)
+
+ def _next_packet(self):
+ if len(self._packets) > 1:
+ self.duration -= self._packets[0].duration
+ del self._packets[0]
+
+
+class EventBuffer(object):
+ """Buffer for events from audio data"""
+ def __init__(self):
+ self.clear()
+
+ def clear(self):
+ # Events in the order they are retrieved from audio_data
+ self._events = []
+
+ def add_events(self, audio_data):
+ assert audio_data is not None
+ for event in audio_data.events:
+ assert event.timestamp <= audio_data.duration
+ event.timestamp += audio_data.timestamp
+ self._events.append(event)
+
+ def get_next_event_timestamp(self):
+ if self._events:
+ return self._events[0].timestamp
+ else:
+ return None
+
+ def get_time_to_next_event(self, timestamp):
+ if self._events:
+ dt = self._events[0].timestamp - timestamp
+ if dt < 0.:
+ return 0.
+ else:
+ return dt
+ else:
+ return None
+
+ def get_expired_events(self, timestamp):
+ expired_events = []
+ while self._events and self._events[0].timestamp <= timestamp:
+ expired_events.append(self._events[0])
+ del self._events[0]
+ return expired_events
+
+
+class SilentAudioPlayerPacketConsumer(AbstractAudioPlayer):
+ # When playing video, length of audio (in secs) to buffer ahead.
+ _buffer_time = 0.4
+
+ # Minimum number of bytes to request from source
+ _min_update_bytes = 1024
+
+ # Minimum sleep time to prevent asymptotic behaviour
+ _min_sleep_time = 0.01
+
+ # Maximum sleep time
+ _max_sleep_time = 0.2
+
+ def __init__(self, source_group, player):
+ super(SilentAudioPlayerPacketConsumer, self).__init__(source_group, player)
+
+ # System time of first timestamp
+ self._last_update_system_time = None
+
+ # Buffered audio data and events
+ self._audio_buffer = SilentAudioBuffer()
+ self._event_buffer = EventBuffer()
+
+ # Actual play state.
+ self._playing = False
+ self._eos = False
+
+ # TODO Be nice to avoid creating this thread if user doesn't care
+ # about EOS events and there's no video format.
+ # NOTE Use thread.condition as lock for all instance vars used by worker
+ self._thread = MediaThread(target=self._worker_func)
+ if source_group.audio_format:
+ self._thread.start()
+
+ def delete(self):
+ if _debug:
+ print('SilentAudioPlayer.delete')
+ self._thread.stop()
+
+ def play(self):
+ if _debug:
+ print('SilentAudioPlayer.play')
+
+ with self._thread.condition:
+ self._eos = False
+ if not self._playing:
+ self._playing = True
+ self._update_time()
+ self._thread.notify()
+
+ def stop(self):
+ if _debug:
+ print('SilentAudioPlayer.stop')
+
+ with self._thread.condition:
+ if self._playing:
+ self._consume_data()
+ self._playing = False
+
+ def clear(self):
+ if _debug:
+ print('SilentAudioPlayer.clear')
+
+ with self._thread.condition:
+ self._event_buffer.clear()
+ self._audio_buffer.clear()
+ self._eos = False
+ self._thread.notify()
+
+ def get_time(self):
+ with self._thread.condition:
+ result = self._audio_buffer.get_current_timestamp() + self._calculate_offset()
+
+ if _debug:
+ print('SilentAudioPlayer.get_time() -> ', result)
+ return result
+
+ def _update_time(self):
+ self._last_update_system_time = time.time()
+
+ def _consume_data(self):
+ """Consume content of packets that should have been played back up to now."""
+ with self._thread.condition:
+ offset = self._calculate_offset()
+ self._audio_buffer.consume_audio_data(offset)
+ self._update_time()
+
+ if self._audio_buffer.is_empty():
+ if _debug:
+ print('Out of packets')
+ timestamp = self.get_time()
+ MediaEvent(timestamp, 'on_eos')._sync_dispatch_to_player(self.player)
+ MediaEvent(timestamp, 'on_source_group_eos')._sync_dispatch_to_player(self.player)
+
+ def _calculate_offset(self):
+ """Calculate the current offset into the cached packages."""
+ if self._last_update_system_time is None:
+ return 0.
+ if not self._playing:
+ return 0.
+
+ offset = time.time() - self._last_update_system_time
+ if offset > self._audio_buffer.duration:
+ return self._audio_buffer.duration
+
+ return offset
+
+ def _buffer_data(self):
+ """Read data from the audio source into the internal buffer."""
+ with self._thread.condition:
+ # Calculate how much data to request from source
+ secs = self._buffer_time - self._audio_buffer.duration
+ bytes_to_read = int(secs * self.source_group.audio_format.bytes_per_second)
+
+ while bytes_to_read > self._min_update_bytes and not self._eos:
+ # Pull audio data from source
+ if _debug:
+ print('Trying to buffer %d bytes (%r secs)' % (bytes_to_read, secs))
+ audio_data = self.source_group.get_audio_data(bytes_to_read)
+ if not audio_data:
+ self._eos = True
+ break
+ else:
+ self._add_audio_data(audio_data)
+
+ bytes_to_read -= audio_data.length
+
+ def _add_audio_data(self, audio_data):
+ """Add a package of audio data to the internal buffer. Update timestamps to reflect."""
+ with self._thread.condition:
+ self._audio_buffer.add_audio_data(audio_data)
+ self._event_buffer.add_events(audio_data)
+
+ def _get_sleep_time(self):
+ """Determine how long to sleep until next event or next batch of data needs to be read."""
+ if not self._playing:
+ # Not playing, so no need to wake up
+ return None
+
+ if self._audio_buffer.duration < self._buffer_time/2 and not self._eos:
+ # More buffering required
+ return 0.
+
+ time_to_next_event = self._event_buffer.get_time_to_next_event(self.get_time())
+ time_to_next_buffer_update = self._audio_buffer.get_time_to_next_update()
+
+ if time_to_next_event is None and time_to_next_buffer_update is None and self._eos:
+ # Nothing to read and no events to handle:
+ return None
+
+ # Wait for first action to take (event or buffer) up to a maximum
+ if _debug:
+ print('Next event in {}, next buffer in {}'.format(time_to_next_event, time_to_next_buffer_update))
+ return max(min(time_to_next_buffer_update or self._max_sleep_time,
+ time_to_next_event or self._max_sleep_time,
+ self._max_sleep_time),
+ self._min_sleep_time)
+
+ def _dispatch_events(self):
+ """Dispatch any events for the current timestamp."""
+ timestamp = self.get_time()
+
+ # Dispatch events
+ for event in self._event_buffer.get_expired_events(timestamp):
+ event._sync_dispatch_to_player(self.player)
+ if _debug:
+ print('Dispatched event {}'.format(event))
+
+ # Worker func that consumes audio data and dispatches events
+ def _worker_func(self):
+ while True:
+ with self._thread.condition:
+ if self._thread.stopped:
+ break
+
+ self._consume_data()
+ self._dispatch_events()
+ self._buffer_data()
+
+ sleep_time = self._get_sleep_time()
+ if _debug:
+ print('SilentAudioPlayer(Worker).sleep', sleep_time)
+ self._thread.sleep(sleep_time)
+ if _debug:
+ print('SilentAudioPlayer(Worker).wakeup')
+ if _debug:
+ print('SilentAudioPlayer(Worker) ended')
+
+
+class SilentTimeAudioPlayer(AbstractAudioPlayer):
+ # Note that when using this player (automatic if playing back video with
+ # unsupported audio codec) no events are dispatched (because they are
+ # normally encoded in the audio packet -- so no EOS events are delivered.
+ # This is a design flaw.
+ #
+ # Also, seeking is broken because the timestamps aren't synchronized with
+ # the source group.
+
+ _time = 0.0
+ _systime = None
+
+ def play(self):
+ self._systime = time.time()
+
+ def stop(self):
+ self._time = self.get_time()
+ self._systime = None
+
+ def delete(self):
+ pass
+
+ def clear(self):
+ pass
+
+ def get_time(self):
+ if self._systime is None:
+ return self._time
+ else:
+ return time.time() - self._systime + self._time
+
+
+class SilentAudioDriver(AbstractAudioDriver):
+ def __init__(self):
+ self._players = WeakSet()
+
+ def create_audio_player(self, source_group, player):
+ if source_group.audio_format:
+ p = SilentAudioPlayerPacketConsumer(source_group, player)
+ self._players.add(p)
+ return p
+ else:
+ return SilentTimeAudioPlayer(source_group, player)
+
+ def get_listener(self):
+ raise NotImplementedError('Silent audio driver does not support positional audio')
+
+ def delete(self):
+ while len(self._players) > 0:
+ self._players.pop().delete()
+
+
+def create_audio_driver():
+ return SilentAudioDriver()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/events.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/events.py
new file mode 100644
index 0000000..7111181
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/events.py
@@ -0,0 +1,61 @@
+from builtins import object
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+import time
+
+import pyglet
+
+
+class MediaEvent(object):
+ def __init__(self, timestamp, event, *args):
+ # Meaning of timestamp is dependent on context; and not seen by
+ # application.
+ self.timestamp = timestamp
+ self.event = event
+ self.args = args
+
+ def _sync_dispatch_to_player(self, player):
+ pyglet.app.platform_event_loop.post_event(player, self.event, *self.args)
+ time.sleep(0)
+ # TODO sync with media.dispatch_events
+
+ def __repr__(self):
+ return '%s(%r, %r, %r)' % (self.__class__.__name__,
+ self.timestamp, self.event, self.args)
+
+ def __lt__(self, other):
+ return hash(self) < hash(other)
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/exceptions.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/exceptions.py
new file mode 100644
index 0000000..9af9fec
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/exceptions.py
@@ -0,0 +1,44 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+class MediaException(Exception):
+ pass
+
+class MediaFormatException(MediaException):
+ pass
+
+class CannotSeekException(MediaException):
+ pass
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/listener.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/listener.py
new file mode 100644
index 0000000..ce2d27c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/listener.py
@@ -0,0 +1,112 @@
+from builtins import object
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+from abc import ABCMeta, abstractmethod
+from future.utils import with_metaclass
+
+
+class AbstractListener(with_metaclass(ABCMeta, object)):
+ """The listener properties for positional audio.
+
+ You can obtain the singleton instance of this class by calling
+ `AbstractAudioDriver.get_listener`.
+ """
+
+ _volume = 1.0
+ _position = (0, 0, 0)
+ _forward_orientation = (0, 0, -1)
+ _up_orientation = (0, 1, 0)
+
+ @abstractmethod
+ def _set_volume(self, volume):
+ pass
+
+ volume = property(lambda self: self._volume,
+ lambda self, volume: self._set_volume(volume),
+ doc="""The master volume for sound playback.
+
+ All sound volumes are multiplied by this master volume before being
+ played. A value of 0 will silence playback (but still consume
+ resources). The nominal volume is 1.0.
+
+ :type: float
+ """)
+
+ @abstractmethod
+ def _set_position(self, position):
+ pass
+
+ position = property(lambda self: self._position,
+ lambda self, position: self._set_position(position),
+ doc="""The position of the listener in 3D space.
+
+ The position is given as a tuple of floats (x, y, z). The unit
+ defaults to meters, but can be modified with the listener
+ properties.
+
+ :type: 3-tuple of float
+ """)
+
+ @abstractmethod
+ def _set_forward_orientation(self, orientation):
+ pass
+
+ forward_orientation = property(lambda self: self._forward_orientation,
+ lambda self, o: self._set_forward_orientation(o),
+ doc="""A vector giving the direction the
+ listener is facing.
+
+ The orientation is given as a tuple of floats (x, y, z), and has
+ no unit. The forward orientation should be orthagonal to the
+ up orientation.
+
+ :type: 3-tuple of float
+ """)
+
+ @abstractmethod
+ def _set_up_orientation(self, orientation):
+ pass
+
+ up_orientation = property(lambda self: self._up_orientation,
+ lambda self, o: self._set_up_orientation(o),
+ doc="""A vector giving the "up" orientation
+ of the listener.
+
+ The orientation is given as a tuple of floats (x, y, z), and has
+ no unit. The up orientation should be orthagonal to the
+ forward orientation.
+
+ :type: 3-tuple of float
+ """)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/player.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/player.py
new file mode 100644
index 0000000..11e073d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/player.py
@@ -0,0 +1,504 @@
+"""High-level sound and video player."""
+from __future__ import print_function
+from __future__ import division
+from builtins import object
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+import pyglet
+from pyglet.media.drivers import get_audio_driver, get_silent_audio_driver
+from pyglet.media.events import MediaEvent
+from pyglet.media.exceptions import MediaException
+from pyglet.media.sources.base import SourceGroup, StaticSource
+
+_debug = pyglet.options['debug_media']
+
+
+class Player(pyglet.event.EventDispatcher):
+ """High-level sound and video player.
+ """
+
+ _last_video_timestamp = None
+ _texture = None
+
+ # Spacialisation attributes, preserved between audio players
+ _volume = 1.0
+ _min_distance = 1.0
+ _max_distance = 100000000.
+
+ _position = (0, 0, 0)
+ _pitch = 1.0
+
+ _cone_orientation = (0, 0, 1)
+ _cone_inner_angle = 360.
+ _cone_outer_angle = 360.
+ _cone_outer_gain = 1.
+
+ def __init__(self):
+ # List of queued source groups
+ self._groups = []
+
+ self._audio_player = None
+
+ # Desired play state (not an indication of actual state).
+ self._playing = False
+
+ self._paused_time = 0.0
+
+ def queue(self, source):
+ """
+ Queue the source on this player.
+
+ If the player has no source, the player will be paused immediately on this source.
+
+ :param pyglet.media.Source source: The source to queue.
+ """
+ if isinstance(source, SourceGroup):
+ self._groups.append(source)
+ else:
+ if (self._groups and
+ source.audio_format == self._groups[-1].audio_format and
+ source.video_format == self._groups[-1].video_format):
+ self._groups[-1].queue(source)
+ else:
+ group = SourceGroup(source.audio_format, source.video_format)
+ group.queue(source)
+ self._groups.append(group)
+
+ self._set_playing(self._playing)
+
+ def _set_playing(self, playing):
+ #stopping = self._playing and not playing
+ #starting = not self._playing and playing
+
+ self._playing = playing
+ source = self.source
+
+ if playing and source:
+ if not self._audio_player:
+ self._create_audio_player()
+ self._audio_player.play()
+
+ if source.video_format:
+ if not self._texture:
+ self._create_texture()
+
+ if self.source.video_format.frame_rate:
+ period = 1. / self.source.video_format.frame_rate
+ else:
+ period = 1. / 30.
+ pyglet.clock.schedule_interval(self.update_texture, period)
+ else:
+ if self._audio_player:
+ self._audio_player.stop()
+
+ pyglet.clock.unschedule(self.update_texture)
+
+ def _get_playing(self):
+ """
+ Read-only. Determine if the player state is playing.
+
+ The *playing* property is irrespective of whether or not there is
+ actually a source to play. If *playing* is ``True`` and a source is
+ queued, it will begin playing immediately. If *playing* is ``False``,
+ it is implied that the player is paused. There is no other possible
+ state.
+ """
+ return self._playing
+
+ playing = property(_get_playing)
+
+ def play(self):
+ """
+ Begin playing the current source.
+
+ This has no effect if the player is already playing.
+ """
+ self._set_playing(True)
+
+ def pause(self):
+ """
+ Pause playback of the current source.
+
+ This has no effect if the player is already paused.
+ """
+ self._set_playing(False)
+
+ if self._audio_player:
+ time = self._audio_player.get_time()
+ time = self._groups[0].translate_timestamp(time)
+ if time is not None:
+ self._paused_time = time
+
+ def delete(self):
+ """Tear down the player and any child objects."""
+ self.pause()
+
+ if self._audio_player:
+ self._audio_player.delete()
+ self._audio_player = None
+
+ while self._groups:
+ del self._groups[0]
+
+ def next_source(self):
+ """
+ Move immediately to the next queued source.
+
+ There may be a gap in playback while the audio buffer is refilled.
+ """
+ if not self._groups:
+ return
+
+ group = self._groups[0]
+ if group.has_next():
+ group.next_source()
+ return
+
+ if self.source.video_format:
+ self._texture = None
+ pyglet.clock.unschedule(self.update_texture)
+
+ if self._audio_player:
+ self._audio_player.delete()
+ self._audio_player = None
+
+ del self._groups[0]
+ if self._groups:
+ self._set_playing(self._playing)
+ return
+
+ self._set_playing(False)
+ self.dispatch_event('on_player_eos')
+
+ #: :deprecated: Use `next_source` instead.
+ next = next_source # old API, worked badly with 2to3
+
+ def seek(self, time):
+ """
+ Seek for playback to the indicated timestamp in seconds on the current
+ source. If the timestamp is outside the duration of the source, it
+ will be clamped to the end.
+ """
+ if not self.source:
+ return
+
+ if _debug:
+ print('Player.seek(%r)' % time)
+
+ self._paused_time = time
+ self.source.seek(time)
+ if self._audio_player:
+ # XXX: According to docstring in AbstractAudioPlayer this cannot be called when the
+ # player is not stopped
+ self._audio_player.clear()
+ if self.source.video_format:
+ self._last_video_timestamp = None
+ self.update_texture(time=time)
+
+ def _create_audio_player(self):
+ assert not self._audio_player
+ assert self._groups
+
+ group = self._groups[0]
+ audio_format = group.audio_format
+ if audio_format:
+ audio_driver = get_audio_driver()
+ else:
+ audio_driver = get_silent_audio_driver()
+ self._audio_player = audio_driver.create_audio_player(group, self)
+
+ _class = self.__class__
+ def _set(name):
+ private_name = '_' + name
+ value = getattr(self, private_name)
+ if value != getattr(_class, private_name):
+ getattr(self._audio_player, 'set_' + name)(value)
+ _set('volume')
+ _set('min_distance')
+ _set('max_distance')
+ _set('position')
+ _set('pitch')
+ _set('cone_orientation')
+ _set('cone_inner_angle')
+ _set('cone_outer_angle')
+ _set('cone_outer_gain')
+
+ def _get_source(self):
+ """Read-only. The current :py:class:`Source`, or ``None``."""
+ if not self._groups:
+ return None
+ return self._groups[0].get_current_source()
+
+ source = property(_get_source)
+
+ def _get_time(self):
+ """
+ Read-only. Current playback time of the current source.
+
+ The playback time is a float expressed in seconds, with 0.0 being the
+ beginning of the sound. The playback time returned represents the time
+ encoded in the source, and may not reflect actual time passed due to
+ pitch shifting or pausing.
+ """
+ time = None
+ if self._playing and self._audio_player:
+ time = self._audio_player.get_time()
+ time = self._groups[0].translate_timestamp(time)
+
+ if time is None:
+ return self._paused_time
+ else:
+ return time
+
+ time = property(_get_time)
+
+ def _create_texture(self):
+ video_format = self.source.video_format
+ self._texture = pyglet.image.Texture.create(
+ video_format.width, video_format.height, rectangle=True)
+ self._texture = self._texture.get_transform(flip_y=True)
+ self._texture.anchor_y = 0
+
+ def get_texture(self):
+ """
+ Get the texture for the current video frame.
+
+ You should call this method every time you display a frame of video,
+ as multiple textures might be used. The return value will be None if
+ there is no video in the current source.
+
+ :return: :py:class:`pyglet.image.Texture`
+ """
+ return self._texture
+
+ def seek_next_frame(self):
+ """Step forwards one video frame in the current Source.
+ """
+ time = self._groups[0].get_next_video_timestamp()
+ if time is None:
+ return
+ self.seek(time)
+
+ def update_texture(self, dt=None, time=None):
+ """Manually update the texture from the current source. This happens
+ automatically, so you shouldn't need to call this method.
+ """
+ if time is None:
+ time = self._audio_player.get_time()
+ if time is None:
+ return
+
+ if (self._last_video_timestamp is not None and
+ time <= self._last_video_timestamp):
+ return
+
+ ts = self._groups[0].get_next_video_timestamp()
+ while ts is not None and ts < time:
+ self._groups[0].get_next_video_frame() # Discard frame
+ ts = self._groups[0].get_next_video_timestamp()
+
+ if ts is None:
+ self._last_video_timestamp = None
+ return
+
+ image = self._groups[0].get_next_video_frame()
+ if image is not None:
+ if self._texture is None:
+ self._create_texture()
+ self._texture.blit_into(image, 0, 0, 0)
+ self._last_video_timestamp = ts
+
+ def _player_property(name, doc=None):
+ private_name = '_' + name
+ set_name = 'set_' + name
+ def _player_property_set(self, value):
+ setattr(self, private_name, value)
+ if self._audio_player:
+ getattr(self._audio_player, set_name)(value)
+
+ def _player_property_get(self):
+ return getattr(self, private_name)
+
+ return property(_player_property_get, _player_property_set, doc=doc)
+
+ volume = _player_property('volume', doc="""
+ The volume level of sound playback.
+
+ The nominal level is 1.0, and 0.0 is silence.
+
+ The volume level is affected by the distance from the listener (if
+ positioned).
+ """)
+ min_distance = _player_property('min_distance', doc="""
+ The distance beyond which the sound volume drops by half, and within
+ which no attenuation is applied.
+
+ The minimum distance controls how quickly a sound is attenuated as it
+ moves away from the listener. The gain is clamped at the nominal value
+ within the min distance. By default the value is 1.0.
+
+ The unit defaults to meters, but can be modified with the listener properties.
+ """)
+ max_distance = _player_property('max_distance', doc="""
+ The distance at which no further attenuation is applied.
+
+ When the distance from the listener to the player is greater than this
+ value, attenuation is calculated as if the distance were value. By
+ default the maximum distance is infinity.
+
+ The unit defaults to meters, but can be modified with the listener
+ properties.
+ """)
+ position = _player_property('position', doc="""
+ The position of the sound in 3D space.
+
+ The position is given as a tuple of floats (x, y, z). The unit
+ defaults to meters, but can be modified with the listener properties.
+ """)
+ pitch = _player_property('pitch', doc="""
+ The pitch shift to apply to the sound.
+
+ The nominal pitch is 1.0. A pitch of 2.0 will sound one octave higher,
+ and play twice as fast. A pitch of 0.5 will sound one octave lower, and
+ play twice as slow. A pitch of 0.0 is not permitted.
+ """)
+ cone_orientation = _player_property('cone_orientation', doc="""
+ The direction of the sound in 3D space.
+
+ The direction is specified as a tuple of floats (x, y, z), and has no
+ unit. The default direction is (0, 0, -1). Directional effects are only
+ noticeable if the other cone properties are changed from their default
+ values.
+ """)
+ cone_inner_angle = _player_property('cone_inner_angle', doc="""
+ The interior angle of the inner cone.
+
+ The angle is given in degrees, and defaults to 360. When the listener
+ is positioned within the volume defined by the inner cone, the sound is
+ played at normal gain (see :py:attr:`volume`).
+ """)
+ cone_outer_angle = _player_property('cone_outer_angle', doc="""
+ The interior angle of the outer cone.
+
+ The angle is given in degrees, and defaults to 360. When the listener
+ is positioned within the volume defined by the outer cone, but outside
+ the volume defined by the inner cone, the gain applied is a smooth
+ interpolation between :py:attr:`volume` and :py:attr:`cone_outer_gain`.
+ """)
+ cone_outer_gain = _player_property('cone_outer_gain', doc="""
+ The gain applied outside the cone.
+
+ When the listener is positioned outside the volume defined by the outer
+ cone, this gain is applied instead of :py:attr:`volume`.
+ """)
+
+ # Events
+
+ def on_player_eos(self):
+ """The player ran out of sources.
+
+ :event:
+ """
+ if _debug:
+ print('Player.on_player_eos')
+
+ def on_source_group_eos(self):
+ """The current source group ran out of data.
+
+ The default behaviour is to advance to the next source group if
+ possible.
+
+ :event:
+ """
+ self.next_source()
+ if _debug:
+ print('Player.on_source_group_eos')
+
+ def on_eos(self):
+ """
+
+ :event:
+ """
+ if _debug:
+ print('Player.on_eos')
+
+Player.register_event_type('on_eos')
+Player.register_event_type('on_player_eos')
+Player.register_event_type('on_source_group_eos')
+
+
+class PlayerGroup(object):
+ """Group of players that can be played and paused simultaneously.
+
+ :Ivariables:
+ `players` : list of `Player`
+ Players in this group.
+
+ """
+
+ def __init__(self, players):
+ """Create a player group for the given set of players.
+
+ All players in the group must currently not belong to any other
+ group.
+
+ :Parameters:
+ `players` : Sequence of `Player`
+ Players to add to this group.
+
+ """
+ self.players = list(players)
+
+ def play(self):
+ """Begin playing all players in the group simultaneously.
+ """
+ audio_players = [p._audio_player \
+ for p in self.players if p._audio_player]
+ if audio_players:
+ audio_players[0]._play_group(audio_players)
+ for player in self.players:
+ player.play()
+
+ def pause(self):
+ """Pause all players in the group simultaneously.
+ """
+ audio_players = [p._audio_player \
+ for p in self.players if p._audio_player]
+ if audio_players:
+ audio_players[0]._stop_group(audio_players)
+ for player in self.players:
+ player.pause()
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/sources/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/sources/__init__.py
new file mode 100644
index 0000000..d455611
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/sources/__init__.py
@@ -0,0 +1,20 @@
+"""Sources for media playback."""
+
+# Collect public interface
+from .loader import load, have_avbin
+from .base import AudioFormat, VideoFormat, AudioData, SourceInfo
+from .base import Source, StreamingSource, StaticSource, SourceGroup
+
+# help the docs figure out where these are supposed to live (they live here)
+__all__ = [
+ 'load',
+ 'have_avbin',
+ 'AudioFormat',
+ 'VideoFormat',
+ 'AudioData',
+ 'SourceInfo',
+ 'Source',
+ 'StreamingSource',
+ 'StaticSource',
+ 'SourceGroup',
+]
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/sources/avbin.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/sources/avbin.py
new file mode 100644
index 0000000..2b51d33
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/sources/avbin.py
@@ -0,0 +1,571 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+"""Use avbin to decode audio and video media.
+"""
+from __future__ import print_function
+from __future__ import division
+from builtins import range
+from builtins import object
+
+import struct
+import ctypes
+import threading
+import time
+
+import pyglet
+from pyglet import image
+import pyglet.lib
+from pyglet.media.sources.base import \
+ StreamingSource, VideoFormat, AudioFormat, \
+ AudioData, SourceInfo
+from pyglet.media.events import MediaEvent
+from pyglet.media.exceptions import MediaFormatException
+from pyglet.media.threads import WorkerThread
+from pyglet.compat import asbytes, asbytes_filename
+
+
+if pyglet.compat_platform.startswith('win') and struct.calcsize('P') == 8:
+ av = 'avbin64'
+else:
+ av = 'avbin'
+
+av = pyglet.lib.load_library(av)
+
+AVBIN_RESULT_ERROR = -1
+AVBIN_RESULT_OK = 0
+AVbinResult = ctypes.c_int
+
+AVBIN_STREAM_TYPE_UNKNOWN = 0
+AVBIN_STREAM_TYPE_VIDEO = 1
+AVBIN_STREAM_TYPE_AUDIO = 2
+AVbinStreamType = ctypes.c_int
+
+AVBIN_SAMPLE_FORMAT_U8 = 0
+AVBIN_SAMPLE_FORMAT_S16 = 1
+AVBIN_SAMPLE_FORMAT_S24 = 2
+AVBIN_SAMPLE_FORMAT_S32 = 3
+AVBIN_SAMPLE_FORMAT_FLOAT = 4
+AVbinSampleFormat = ctypes.c_int
+
+AVBIN_LOG_QUIET = -8
+AVBIN_LOG_PANIC = 0
+AVBIN_LOG_FATAL = 8
+AVBIN_LOG_ERROR = 16
+AVBIN_LOG_WARNING = 24
+AVBIN_LOG_INFO = 32
+AVBIN_LOG_VERBOSE = 40
+AVBIN_LOG_DEBUG = 48
+AVbinLogLevel = ctypes.c_int
+
+AVbinFileP = ctypes.c_void_p
+AVbinStreamP = ctypes.c_void_p
+
+Timestamp = ctypes.c_int64
+
+class AVbinFileInfo(ctypes.Structure):
+ _fields_ = [
+ ('structure_size', ctypes.c_size_t),
+ ('n_streams', ctypes.c_int),
+ ('start_time', Timestamp),
+ ('duration', Timestamp),
+ ('title', ctypes.c_char * 512),
+ ('author', ctypes.c_char * 512),
+ ('copyright', ctypes.c_char * 512),
+ ('comment', ctypes.c_char * 512),
+ ('album', ctypes.c_char * 512),
+ ('year', ctypes.c_int),
+ ('track', ctypes.c_int),
+ ('genre', ctypes.c_char * 32),
+ ]
+
+class _AVbinStreamInfoVideo8(ctypes.Structure):
+ _fields_ = [
+ ('width', ctypes.c_uint),
+ ('height', ctypes.c_uint),
+ ('sample_aspect_num', ctypes.c_uint),
+ ('sample_aspect_den', ctypes.c_uint),
+ ('frame_rate_num', ctypes.c_uint),
+ ('frame_rate_den', ctypes.c_uint),
+ ]
+
+class _AVbinStreamInfoAudio8(ctypes.Structure):
+ _fields_ = [
+ ('sample_format', ctypes.c_int),
+ ('sample_rate', ctypes.c_uint),
+ ('sample_bits', ctypes.c_uint),
+ ('channels', ctypes.c_uint),
+ ]
+
+class _AVbinStreamInfoUnion8(ctypes.Union):
+ _fields_ = [
+ ('video', _AVbinStreamInfoVideo8),
+ ('audio', _AVbinStreamInfoAudio8),
+ ]
+
+class AVbinStreamInfo8(ctypes.Structure):
+ _fields_ = [
+ ('structure_size', ctypes.c_size_t),
+ ('type', ctypes.c_int),
+ ('u', _AVbinStreamInfoUnion8)
+ ]
+
+class AVbinPacket(ctypes.Structure):
+ _fields_ = [
+ ('structure_size', ctypes.c_size_t),
+ ('timestamp', Timestamp),
+ ('stream_index', ctypes.c_int),
+ ('data', ctypes.POINTER(ctypes.c_uint8)),
+ ('size', ctypes.c_size_t),
+ ]
+
+AVbinLogCallback = ctypes.CFUNCTYPE(None,
+ ctypes.c_char_p, ctypes.c_int, ctypes.c_char_p)
+
+av.avbin_get_version.restype = ctypes.c_int
+av.avbin_get_ffmpeg_revision.restype = ctypes.c_int
+av.avbin_get_audio_buffer_size.restype = ctypes.c_size_t
+av.avbin_have_feature.restype = ctypes.c_int
+av.avbin_have_feature.argtypes = [ctypes.c_char_p]
+
+av.avbin_init.restype = AVbinResult
+av.avbin_set_log_level.restype = AVbinResult
+av.avbin_set_log_level.argtypes = [AVbinLogLevel]
+av.avbin_set_log_callback.argtypes = [AVbinLogCallback]
+
+av.avbin_open_filename.restype = AVbinFileP
+av.avbin_open_filename.argtypes = [ctypes.c_char_p]
+av.avbin_close_file.argtypes = [AVbinFileP]
+av.avbin_seek_file.argtypes = [AVbinFileP, Timestamp]
+av.avbin_file_info.argtypes = [AVbinFileP, ctypes.POINTER(AVbinFileInfo)]
+av.avbin_stream_info.argtypes = [AVbinFileP, ctypes.c_int,
+ ctypes.POINTER(AVbinStreamInfo8)]
+
+av.avbin_open_stream.restype = ctypes.c_void_p
+av.avbin_open_stream.argtypes = [AVbinFileP, ctypes.c_int]
+av.avbin_close_stream.argtypes = [AVbinStreamP]
+
+av.avbin_read.argtypes = [AVbinFileP, ctypes.POINTER(AVbinPacket)]
+av.avbin_read.restype = AVbinResult
+av.avbin_decode_audio.restype = ctypes.c_int
+av.avbin_decode_audio.argtypes = [AVbinStreamP,
+ ctypes.c_void_p, ctypes.c_size_t,
+ ctypes.c_void_p, ctypes.POINTER(ctypes.c_int)]
+av.avbin_decode_video.restype = ctypes.c_int
+av.avbin_decode_video.argtypes = [AVbinStreamP,
+ ctypes.c_void_p, ctypes.c_size_t,
+ ctypes.c_void_p]
+
+
+if True:
+ # XXX lock all avbin calls. not clear from ffmpeg documentation if this
+ # is necessary. leaving it on while debugging to rule out the possiblity
+ # of a problem.
+ def synchronize(func, lock):
+ def f(*args):
+ lock.acquire()
+ result = func(*args)
+ lock.release()
+ return result
+ return f
+
+ _avbin_lock = threading.Lock()
+ for name in dir(av):
+ if name.startswith('avbin_'):
+ setattr(av, name, synchronize(getattr(av, name), _avbin_lock))
+
+def get_version():
+ return av.avbin_get_version()
+
+class AVbinException(MediaFormatException):
+ pass
+
+def timestamp_from_avbin(timestamp):
+ return float(timestamp) / 1000000
+
+def timestamp_to_avbin(timestamp):
+ return int(timestamp * 1000000)
+
+class VideoPacket(object):
+ _next_id = 0
+
+ def __init__(self, packet):
+ self.timestamp = timestamp_from_avbin(packet.timestamp)
+ self.data = (ctypes.c_uint8 * packet.size)()
+ self.size = packet.size
+ ctypes.memmove(self.data, packet.data, self.size)
+
+ # Decoded image. 0 == not decoded yet; None == Error or discarded
+ self.image = 0
+
+ self.id = self._next_id
+ self.__class__._next_id += 1
+
+class AVbinSource(StreamingSource):
+ def __init__(self, filename, file=None):
+ if file is not None:
+ raise NotImplementedError('Loading from file stream is not supported')
+
+ self._file = av.avbin_open_filename(asbytes_filename(filename))
+ if not self._file:
+ raise AVbinException('Could not open "%s"' % filename)
+
+ self._video_stream = None
+ self._video_stream_index = -1
+ self._audio_stream = None
+ self._audio_stream_index = -1
+
+ file_info = AVbinFileInfo()
+ file_info.structure_size = ctypes.sizeof(file_info)
+ av.avbin_file_info(self._file, ctypes.byref(file_info))
+ self._duration = timestamp_from_avbin(file_info.duration)
+
+ self.info = SourceInfo()
+ self.info.title = file_info.title
+ self.info.author = file_info.author
+ self.info.copyright = file_info.copyright
+ self.info.comment = file_info.comment
+ self.info.album = file_info.album
+ self.info.year = file_info.year
+ self.info.track = file_info.track
+ self.info.genre = file_info.genre
+
+ # Pick the first video and audio streams found, ignore others.
+ for i in range(file_info.n_streams):
+ info = AVbinStreamInfo8()
+ info.structure_size = ctypes.sizeof(info)
+ av.avbin_stream_info(self._file, i, info)
+
+ if (info.type == AVBIN_STREAM_TYPE_VIDEO and
+ not self._video_stream):
+
+ stream = av.avbin_open_stream(self._file, i)
+ if not stream:
+ continue
+
+ self.video_format = VideoFormat(
+ width=info.u.video.width,
+ height=info.u.video.height)
+ if info.u.video.sample_aspect_num != 0:
+ self.video_format.sample_aspect = (
+ float(info.u.video.sample_aspect_num) /
+ info.u.video.sample_aspect_den)
+ if _have_frame_rate:
+ self.video_format.frame_rate = (
+ float(info.u.video.frame_rate_num) /
+ info.u.video.frame_rate_den)
+ self._video_stream = stream
+ self._video_stream_index = i
+
+ elif (info.type == AVBIN_STREAM_TYPE_AUDIO and
+ info.u.audio.sample_bits in (8, 16) and
+ info.u.audio.channels in (1, 2) and
+ not self._audio_stream):
+
+ stream = av.avbin_open_stream(self._file, i)
+ if not stream:
+ continue
+
+ self.audio_format = AudioFormat(
+ channels=info.u.audio.channels,
+ sample_size=info.u.audio.sample_bits,
+ sample_rate=info.u.audio.sample_rate)
+ self._audio_stream = stream
+ self._audio_stream_index = i
+
+ self._packet = AVbinPacket()
+ self._packet.structure_size = ctypes.sizeof(self._packet)
+ self._packet.stream_index = -1
+
+ self._events = []
+
+ # Timestamp of last video packet added to decoder queue.
+ self._video_timestamp = 0
+ self._buffered_audio_data = []
+
+ if self.audio_format:
+ self._audio_buffer = \
+ (ctypes.c_uint8 * av.avbin_get_audio_buffer_size())()
+
+ if self.video_format:
+ self._video_packets = []
+ self._decode_thread = WorkerThread()
+ self._decode_thread.start()
+ self._condition = threading.Condition()
+
+ def __del__(self):
+ if _debug:
+ print('del avbin source')
+ try:
+ if self._video_stream:
+ av.avbin_close_stream(self._video_stream)
+ if self._audio_stream:
+ av.avbin_close_stream(self._audio_stream)
+ av.avbin_close_file(self._file)
+ except:
+ pass
+
+ def delete(self):
+ if self.video_format:
+ self._decode_thread.stop()
+
+ def seek(self, timestamp):
+ if _debug:
+ print('AVbin seek', timestamp)
+ av.avbin_seek_file(self._file, timestamp_to_avbin(timestamp))
+
+ self._audio_packet_size = 0
+ del self._events[:]
+ del self._buffered_audio_data[:]
+
+ if self.video_format:
+ self._video_timestamp = 0
+ self._condition.acquire()
+ for packet in self._video_packets:
+ packet.image = None
+ self._condition.notify()
+ self._condition.release()
+ del self._video_packets[:]
+
+ self._decode_thread.clear_jobs()
+
+ def _get_packet(self):
+ # Read a packet into self._packet. Returns True if OK, False if no
+ # more packets are in stream.
+ return av.avbin_read(self._file, self._packet) == AVBIN_RESULT_OK
+
+ def _process_packet(self):
+ # Returns (packet_type, packet), where packet_type = 'video' or
+ # 'audio'; and packet is VideoPacket or AudioData. In either case,
+ # packet is buffered or queued for decoding; no further action is
+ # necessary. Returns (None, None) if packet was neither type.
+
+ if self._packet.stream_index == self._video_stream_index:
+ if self._packet.timestamp < 0:
+ # XXX TODO
+ # AVbin needs hack to decode timestamp for B frames in
+ # some containers (OGG?). See
+ # http://www.dranger.com/ffmpeg/tutorial05.html
+ # For now we just drop these frames.
+ return None, None
+
+ video_packet = VideoPacket(self._packet)
+
+ if _debug:
+ print('Created and queued frame %d (%f)' % \
+ (video_packet.id, video_packet.timestamp))
+
+ self._video_timestamp = max(self._video_timestamp,
+ video_packet.timestamp)
+ self._video_packets.append(video_packet)
+ self._decode_thread.put_job(
+ lambda: self._decode_video_packet(video_packet))
+
+ return 'video', video_packet
+
+ elif self._packet.stream_index == self._audio_stream_index:
+ audio_data = self._decode_audio_packet()
+ if audio_data:
+ if _debug:
+ print('Got an audio packet at', audio_data.timestamp)
+ self._buffered_audio_data.append(audio_data)
+ return 'audio', audio_data
+
+ return None, None
+
+ def get_audio_data(self, bytes):
+ try:
+ audio_data = self._buffered_audio_data.pop(0)
+ audio_data_timeend = audio_data.timestamp + audio_data.duration
+ except IndexError:
+ audio_data = None
+ audio_data_timeend = self._video_timestamp + 1
+
+ if _debug:
+ print('get_audio_data')
+
+ have_video_work = False
+
+ # Keep reading packets until we have an audio packet and all the
+ # associated video packets have been enqueued on the decoder thread.
+ while not audio_data or (
+ self._video_stream and self._video_timestamp < audio_data_timeend):
+ if not self._get_packet():
+ break
+
+ packet_type, packet = self._process_packet()
+
+ if packet_type == 'video':
+ have_video_work = True
+ elif not audio_data and packet_type == 'audio':
+ audio_data = self._buffered_audio_data.pop(0)
+ if _debug:
+ print('Got requested audio packet at', audio_data.timestamp)
+ audio_data_timeend = audio_data.timestamp + audio_data.duration
+
+ if have_video_work:
+ # Give decoder thread a chance to run before we return this audio
+ # data.
+ time.sleep(0)
+
+ if not audio_data:
+ if _debug:
+ print('get_audio_data returning None')
+ return None
+
+ while self._events and self._events[0].timestamp <= audio_data_timeend:
+ event = self._events.pop(0)
+ if event.timestamp >= audio_data.timestamp:
+ event.timestamp -= audio_data.timestamp
+ audio_data.events.append(event)
+
+ if _debug:
+ print('get_audio_data returning ts %f with events' % \
+ audio_data.timestamp, audio_data.events)
+ print('remaining events are', self._events)
+ return audio_data
+
+ def _decode_audio_packet(self):
+ packet = self._packet
+ size_out = ctypes.c_int(len(self._audio_buffer))
+
+ while True:
+ audio_packet_ptr = ctypes.cast(packet.data, ctypes.c_void_p)
+ audio_packet_size = packet.size
+
+ used = av.avbin_decode_audio(self._audio_stream,
+ audio_packet_ptr, audio_packet_size,
+ self._audio_buffer, size_out)
+
+ if used < 0:
+ self._audio_packet_size = 0
+ break
+
+ audio_packet_ptr.value += used
+ audio_packet_size -= used
+
+ if size_out.value <= 0:
+ continue
+
+ # XXX how did this ever work? replaced with copy below
+ # buffer = ctypes.string_at(self._audio_buffer, size_out)
+
+ # XXX to actually copy the data.. but it never used to crash, so
+ # maybe I'm missing something
+ buffer = ctypes.create_string_buffer(size_out.value)
+ ctypes.memmove(buffer, self._audio_buffer, len(buffer))
+ buffer = buffer.raw
+
+ duration = float(len(buffer)) / self.audio_format.bytes_per_second
+ self._audio_packet_timestamp = \
+ timestamp = timestamp_from_avbin(packet.timestamp)
+ return AudioData(buffer, len(buffer), timestamp, duration, [])
+
+ def _decode_video_packet(self, packet):
+ width = self.video_format.width
+ height = self.video_format.height
+ pitch = width * 3
+ buffer = (ctypes.c_uint8 * (pitch * height))()
+ result = av.avbin_decode_video(self._video_stream,
+ packet.data, packet.size,
+ buffer)
+ if result < 0:
+ image_data = None
+ else:
+ image_data = image.ImageData(width, height, 'RGB', buffer, pitch)
+
+ packet.image = image_data
+
+ # Notify get_next_video_frame() that another one is ready.
+ self._condition.acquire()
+ self._condition.notify()
+ self._condition.release()
+
+ def _ensure_video_packets(self):
+ """Process packets until a video packet has been queued (and begun
+ decoding). Return False if EOS.
+ """
+ if not self._video_packets:
+ if _debug:
+ print('No video packets...')
+ # Read ahead until we have another video packet
+ self._get_packet()
+ packet_type, _ = self._process_packet()
+ while packet_type and packet_type != 'video':
+ self._get_packet()
+ packet_type, _ = self._process_packet()
+ if not packet_type:
+ return False
+
+ if _debug:
+ print('Queued packet', _)
+ return True
+
+ def get_next_video_timestamp(self):
+ if not self.video_format:
+ return
+
+ if self._ensure_video_packets():
+ if _debug:
+ print('Next video timestamp is', self._video_packets[0].timestamp)
+ return self._video_packets[0].timestamp
+
+ def get_next_video_frame(self):
+ if not self.video_format:
+ return
+
+ if self._ensure_video_packets():
+ packet = self._video_packets.pop(0)
+ if _debug:
+ print('Waiting for', packet)
+
+ # Block until decoding is complete
+ self._condition.acquire()
+ while packet.image == 0:
+ self._condition.wait()
+ self._condition.release()
+
+ if _debug:
+ print('Returning', packet)
+ return packet.image
+
+av.avbin_init()
+if pyglet.options['debug_media']:
+ _debug = True
+ av.avbin_set_log_level(AVBIN_LOG_DEBUG)
+else:
+ _debug = False
+ av.avbin_set_log_level(AVBIN_LOG_QUIET)
+
+_have_frame_rate = av.avbin_have_feature(asbytes('frame_rate'))
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/sources/base.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/sources/base.py
new file mode 100644
index 0000000..2ea6f32
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/sources/base.py
@@ -0,0 +1,630 @@
+from __future__ import print_function
+from __future__ import division
+from builtins import object
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+import ctypes
+import sys
+
+import pyglet
+from pyglet.compat import bytes_type, BytesIO
+from pyglet.media.events import MediaEvent
+from pyglet.media.exceptions import MediaException
+
+_debug = pyglet.options['debug_media']
+
+
+class AudioFormat(object):
+ """Audio details.
+
+ An instance of this class is provided by sources with audio tracks. You
+ should not modify the fields, as they are used internally to describe the
+ format of data provided by the source.
+
+ :Ivariables:
+ `channels` : int
+ The number of channels: 1 for mono or 2 for stereo (pyglet does
+ not yet support surround-sound sources).
+ `sample_size` : int
+ Bits per sample; only 8 or 16 are supported.
+ `sample_rate` : int
+ Samples per second (in Hertz).
+
+ """
+
+ def __init__(self, channels, sample_size, sample_rate):
+ self.channels = channels
+ self.sample_size = sample_size
+ self.sample_rate = sample_rate
+
+ # Convenience
+ self.bytes_per_sample = (sample_size >> 3) * channels
+ self.bytes_per_second = self.bytes_per_sample * sample_rate
+
+ def __eq__(self, other):
+ return (self.channels == other.channels and
+ self.sample_size == other.sample_size and
+ self.sample_rate == other.sample_rate)
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
+ def __repr__(self):
+ return '%s(channels=%d, sample_size=%d, sample_rate=%d)' % (
+ self.__class__.__name__, self.channels, self.sample_size,
+ self.sample_rate)
+
+class VideoFormat(object):
+ """Video details.
+
+ An instance of this class is provided by sources with a video track. You
+ should not modify the fields.
+
+ Note that the sample aspect has no relation to the aspect ratio of the
+ video image. For example, a video image of 640x480 with sample aspect 2.0
+ should be displayed at 1280x480. It is the responsibility of the
+ application to perform this scaling.
+
+ :Ivariables:
+ `width` : int
+ Width of video image, in pixels.
+ `height` : int
+ Height of video image, in pixels.
+ `sample_aspect` : float
+ Aspect ratio (width over height) of a single video pixel.
+ `frame_rate` : float
+ Frame rate (frames per second) of the video.
+
+ AVbin 8 or later is required, otherwise the frame rate will be
+ ``None``.
+
+ .. versionadded:: 1.2.
+
+ """
+
+ def __init__(self, width, height, sample_aspect=1.0):
+ self.width = width
+ self.height = height
+ self.sample_aspect = sample_aspect
+ self.frame_rate = None
+
+class AudioData(object):
+ """A single packet of audio data.
+
+ This class is used internally by pyglet.
+
+ :Ivariables:
+ `data` : str or ctypes array or pointer
+ Sample data.
+ `length` : int
+ Size of sample data, in bytes.
+ `timestamp` : float
+ Time of the first sample, in seconds.
+ `duration` : float
+ Total data duration, in seconds.
+ `events` : list of MediaEvent
+ List of events contained within this packet. Events are
+ timestamped relative to this audio packet.
+
+ """
+ def __init__(self, data, length, timestamp, duration, events):
+ self.data = data
+ self.length = length
+ self.timestamp = timestamp
+ self.duration = duration
+ self.events = events
+
+ def consume(self, bytes, audio_format):
+ """Remove some data from beginning of packet. All events are
+ cleared."""
+ self.events = ()
+ if bytes >= self.length:
+ self.data = None
+ self.length = 0
+ self.timestamp += self.duration
+ self.duration = 0.
+ return
+ elif bytes == 0:
+ return
+
+ if not isinstance(self.data, str):
+ # XXX Create a string buffer for the whole packet then
+ # chop it up. Could do some pointer arith here and
+ # save a bit of data pushing, but my guess is this is
+ # faster than fudging aruond with ctypes (and easier).
+ data = ctypes.create_string_buffer(self.length)
+ ctypes.memmove(data, self.data, self.length)
+ self.data = data
+ self.data = self.data[bytes:]
+ self.length -= bytes
+ self.duration -= bytes / float(audio_format.bytes_per_second)
+ self.timestamp += bytes / float(audio_format.bytes_per_second)
+
+ def get_string_data(self):
+ """Return data as a string. (Python 3: return as bytes)"""
+ if self.data is None:
+ return b''
+
+ if isinstance(self.data, bytes_type):
+ return self.data
+
+ buf = ctypes.create_string_buffer(self.length)
+ ctypes.memmove(buf, self.data, self.length)
+ return buf.raw
+
+class SourceInfo(object):
+ """Source metadata information.
+
+ Fields are the empty string or zero if the information is not available.
+
+ :Ivariables:
+ `title` : str
+ Title
+ `author` : str
+ Author
+ `copyright` : str
+ Copyright statement
+ `comment` : str
+ Comment
+ `album` : str
+ Album name
+ `year` : int
+ Year
+ `track` : int
+ Track number
+ `genre` : str
+ Genre
+
+ .. versionadded:: 1.2
+ """
+
+ title = ''
+ author = ''
+ copyright = ''
+ comment = ''
+ album = ''
+ year = 0
+ track = 0
+ genre = ''
+
+class Source(object):
+ """An audio and/or video source.
+
+ :Ivariables:
+ `audio_format` : `AudioFormat`
+ Format of the audio in this source, or None if the source is
+ silent.
+ `video_format` : `VideoFormat`
+ Format of the video in this source, or None if there is no
+ video.
+ `info` : `SourceInfo`
+ Source metadata such as title, artist, etc; or None if the
+ information is not available.
+
+ .. versionadded:: 1.2
+ """
+
+ _duration = None
+
+ audio_format = None
+ video_format = None
+ info = None
+
+ def _get_duration(self):
+ return self._duration
+
+ duration = property(lambda self: self._get_duration(),
+ doc="""The length of the source, in seconds.
+
+ Not all source durations can be determined; in this case the value
+ is None.
+
+ Read-only.
+
+ :type: float
+ """)
+
+ def play(self):
+ """Play the source.
+
+ This is a convenience method which creates a Player for
+ this source and plays it immediately.
+
+ :rtype: `Player`
+ """
+ from pyglet.media.player import Player # XXX Nasty circular dependency
+ player = Player()
+ player.queue(self)
+ player.play()
+ return player
+
+ def get_animation(self):
+ """Import all video frames into memory as an :py:class:`~pyglet.image.Animation`.
+
+ An empty animation will be returned if the source has no video.
+ Otherwise, the animation will contain all unplayed video frames (the
+ entire source, if it has not been queued on a player). After creating
+ the animation, the source will be at EOS.
+
+ This method is unsuitable for videos running longer than a
+ few seconds.
+
+ .. versionadded:: 1.1
+
+ :rtype: `pyglet.image.Animation`
+ """
+ from pyglet.image import Animation, AnimationFrame
+ if not self.video_format:
+ # XXX: This causes an assertion in the constructor of Animation
+ return Animation([])
+ else:
+ frames = []
+ last_ts = 0
+ next_ts = self.get_next_video_timestamp()
+ while next_ts is not None:
+ image = self.get_next_video_frame()
+ if image is not None:
+ delay = next_ts - last_ts
+ frames.append(AnimationFrame(image, delay))
+ last_ts = next_ts
+ next_ts = self.get_next_video_timestamp()
+ return Animation(frames)
+
+ def get_next_video_timestamp(self):
+ """Get the timestamp of the next video frame.
+
+ .. versionadded:: 1.1
+
+ :rtype: float
+ :return: The next timestamp, or ``None`` if there are no more video
+ frames.
+ """
+ pass
+
+ def get_next_video_frame(self):
+ """Get the next video frame.
+
+ Video frames may share memory: the previous frame may be invalidated
+ or corrupted when this method is called unless the application has
+ made a copy of it.
+
+ .. versionadded:: 1.1
+
+ :rtype: `pyglet.image.AbstractImage`
+ :return: The next video frame image, or ``None`` if the video frame
+ could not be decoded or there are no more video frames.
+ """
+ pass
+
+ # Internal methods that SourceGroup calls on the source:
+
+ def seek(self, timestamp):
+ """Seek to given timestamp."""
+ raise CannotSeekException()
+
+ def _get_queue_source(self):
+ """Return the `Source` to be used as the queue source for a player.
+
+ Default implementation returns self."""
+ return self
+
+ def get_audio_data(self, bytes):
+ """Get next packet of audio data.
+
+ :Parameters:
+ `bytes` : int
+ Maximum number of bytes of data to return.
+
+ :rtype: `AudioData`
+ :return: Next packet of audio data, or None if there is no (more)
+ data.
+ """
+ return None
+
+class StreamingSource(Source):
+ """A source that is decoded as it is being played, and can only be
+ queued once.
+ """
+
+ _is_queued = False
+
+ is_queued = property(lambda self: self._is_queued,
+ doc="""Determine if this source has been queued
+ on a :py:class:`~pyglet.media.player.Player` yet.
+
+ Read-only.
+
+ :type: bool
+ """)
+
+ def _get_queue_source(self):
+ """Return the `Source` to be used as the queue source for a player.
+
+ Default implementation returns self."""
+ if self._is_queued:
+ raise MediaException('This source is already queued on a player.')
+ self._is_queued = True
+ return self
+
+ def delete(self):
+ pass
+
+class StaticSource(Source):
+ """A source that has been completely decoded in memory. This source can
+ be queued onto multiple players any number of times.
+ """
+
+ def __init__(self, source):
+ """Construct a :py:class:`~pyglet.media.StaticSource` for the data in `source`.
+
+ :Parameters:
+ `source` : `Source`
+ The source to read and decode audio and video data from.
+
+ """
+ source = source._get_queue_source()
+ if source.video_format:
+ raise NotImplementedError(
+ 'Static sources not supported for video yet.')
+
+ self.audio_format = source.audio_format
+ if not self.audio_format:
+ self._data = None
+ self._duration = 0.
+ return
+
+ # Arbitrary: number of bytes to request at a time.
+ buffer_size = 1 << 20 # 1 MB
+
+ # Naive implementation. Driver-specific implementations may override
+ # to load static audio data into device (or at least driver) memory.
+ data = BytesIO()
+ while True:
+ audio_data = source.get_audio_data(buffer_size)
+ if not audio_data:
+ break
+ data.write(audio_data.get_string_data())
+ self._data = data.getvalue()
+
+ self._duration = len(self._data) / \
+ float(self.audio_format.bytes_per_second)
+
+ def _get_queue_source(self):
+ if self._data is not None:
+ return StaticMemorySource(self._data, self.audio_format)
+
+ def get_audio_data(self, bytes):
+ raise RuntimeError('StaticSource cannot be queued.')
+
+class StaticMemorySource(StaticSource):
+ """Helper class for default implementation of :py:class:`~pyglet.media.StaticSource`. Do not use
+ directly."""
+
+ def __init__(self, data, audio_format):
+ """Construct a memory source over the given data buffer.
+ """
+ self._file = BytesIO(data)
+ self._max_offset = len(data)
+ self.audio_format = audio_format
+ self._duration = len(data) / float(audio_format.bytes_per_second)
+
+ def seek(self, timestamp):
+ offset = int(timestamp * self.audio_format.bytes_per_second)
+
+ # Align to sample
+ if self.audio_format.bytes_per_sample == 2:
+ offset &= 0xfffffffe
+ elif self.audio_format.bytes_per_sample == 4:
+ offset &= 0xfffffffc
+
+ self._file.seek(offset)
+
+ def get_audio_data(self, bytes):
+ offset = self._file.tell()
+ timestamp = float(offset) / self.audio_format.bytes_per_second
+
+ # Align to sample size
+ if self.audio_format.bytes_per_sample == 2:
+ bytes &= 0xfffffffe
+ elif self.audio_format.bytes_per_sample == 4:
+ bytes &= 0xfffffffc
+
+ data = self._file.read(bytes)
+ if not len(data):
+ return None
+
+ duration = float(len(data)) / self.audio_format.bytes_per_second
+ return AudioData(data, len(data), timestamp, duration, [])
+
+class SourceGroup(object):
+ """Read data from a queue of sources, with support for looping. All
+ sources must share the same audio format.
+
+ :Ivariables:
+ `audio_format` : `AudioFormat`
+ Required audio format for queued sources.
+
+ """
+
+ # TODO can sources list go empty? what behaviour (ignore or error)?
+
+ _advance_after_eos = False
+ _loop = False
+
+ def __init__(self, audio_format, video_format):
+ self.audio_format = audio_format
+ self.video_format = video_format
+ self.duration = 0.
+ self._timestamp_offset = 0.
+ self._dequeued_durations = []
+ self._sources = []
+
+ def seek(self, time):
+ if self._sources:
+ self._sources[0].seek(time)
+
+ def queue(self, source):
+ source = source._get_queue_source()
+ assert(source.audio_format == self.audio_format)
+ self._sources.append(source)
+ self.duration += source.duration
+
+ def has_next(self):
+ return len(self._sources) > 1
+
+ def next_source(self, immediate=True):
+ if immediate:
+ self._advance()
+ else:
+ self._advance_after_eos = True
+
+ #: :deprecated: Use `next_source` instead.
+ next = next_source # old API, worked badly with 2to3
+
+ def get_current_source(self):
+ if self._sources:
+ return self._sources[0]
+
+ def _advance(self):
+ if self._sources:
+ self._timestamp_offset += self._sources[0].duration
+ self._dequeued_durations.insert(0, self._sources[0].duration)
+ old_source = self._sources.pop(0)
+ self.duration -= old_source.duration
+
+ if isinstance(old_source, StreamingSource):
+ old_source.delete()
+ del old_source
+
+ def _get_loop(self):
+ return self._loop
+
+ def _set_loop(self, loop):
+ self._loop = loop
+
+ loop = property(_get_loop, _set_loop,
+ doc="""Loop the current source indefinitely or until
+ `next` is called. Initially False.
+
+ :type: bool
+ """)
+
+ def get_audio_data(self, bytes):
+ """Get next audio packet.
+
+ :Parameters:
+ `bytes` : int
+ Hint for preferred size of audio packet; may be ignored.
+
+ :rtype: `AudioData`
+ :return: Audio data, or None if there is no more data.
+ """
+
+ if not self._sources:
+ return None
+ data = self._sources[0].get_audio_data(bytes)
+ eos = False
+ while not data:
+ eos = True
+ if self._loop and not self._advance_after_eos:
+ self._timestamp_offset += self._sources[0].duration
+ self._dequeued_durations.insert(0, self._sources[0].duration)
+ self._sources[0].seek(0)
+ else:
+ self._advance_after_eos = False
+
+ # Advance source if there's something to advance to.
+ # Otherwise leave last source paused at EOS.
+ if len(self._sources) > 1:
+ self._advance()
+ else:
+ return None
+
+ data = self._sources[0].get_audio_data(bytes) # TODO method rename
+
+ data.timestamp += self._timestamp_offset
+ if eos:
+ if _debug:
+ print('adding on_eos event to audio data')
+ data.events.append(MediaEvent(0, 'on_eos'))
+ return data
+
+ def translate_timestamp(self, timestamp):
+ """Get source-relative timestamp for the audio player's timestamp."""
+ # XXX
+ if timestamp is None:
+ return None
+
+ timestamp = timestamp - self._timestamp_offset
+ if timestamp < 0:
+ # _dequeued_durations is already ordered last to first
+ for duration in self._dequeued_durations:
+ timestamp += duration
+ if timestamp > 0:
+ break
+ assert timestamp >= 0, 'Timestamp beyond dequeued source memory'
+ return timestamp
+
+ def get_next_video_timestamp(self):
+ """Get the timestamp of the next video frame.
+
+ :rtype: float
+ :return: The next timestamp, or ``None`` if there are no more video
+ frames.
+ """
+ # TODO track current video source independently from audio source for
+ # better prebuffering.
+ if not self._sources:
+ return None
+ timestamp = self._sources[0].get_next_video_timestamp()
+ if timestamp is not None:
+ timestamp += self._timestamp_offset
+ return timestamp
+
+ def get_next_video_frame(self):
+ """Get the next video frame.
+
+ Video frames may share memory: the previous frame may be invalidated
+ or corrupted when this method is called unless the application has
+ made a copy of it.
+
+ :rtype: `pyglet.image.AbstractImage`
+ :return: The next video frame image, or ``None`` if the video frame
+ could not be decoded or there are no more video frames.
+ """
+ if self._sources:
+ return self._sources[0].get_next_video_frame()
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/sources/loader.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/sources/loader.py
new file mode 100644
index 0000000..261be2d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/sources/loader.py
@@ -0,0 +1,121 @@
+from __future__ import print_function
+from builtins import object
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+from abc import ABCMeta, abstractmethod
+
+import pyglet
+from .base import StaticSource
+from future.utils import with_metaclass
+
+_debug = pyglet.options['debug_media']
+
+
+def load(filename, file=None, streaming=True):
+ """Load a source from a file.
+
+ Currently the `file` argument is not supported; media files must exist
+ as real paths.
+
+ :Parameters:
+ `filename` : str
+ Filename of the media file to load.
+ `file` : file-like object
+ Not yet supported.
+ `streaming` : bool
+ If False, a :py:class:`~pyglet.media.StaticSource` will be returned; otherwise (default) a
+ `StreamingSource` is created.
+
+ :rtype: `Source`
+ """
+ source = get_source_loader().load(filename, file)
+ if not streaming:
+ source = StaticSource(source)
+ return source
+
+
+class AbstractSourceLoader(with_metaclass(ABCMeta, object)):
+ @abstractmethod
+ def load(self, filename, file):
+ pass
+
+
+class AVbinSourceLoader(AbstractSourceLoader):
+ def load(self, filename, file):
+ from .avbin import AVbinSource
+ return AVbinSource(filename, file)
+
+
+class RIFFSourceLoader(AbstractSourceLoader):
+ def load(self, filename, file):
+ from .riff import WaveSource
+ return WaveSource(filename, file)
+
+
+def get_source_loader():
+ global _source_loader
+
+ if _source_loader is not None:
+ return _source_loader
+
+ if have_avbin():
+ _source_loader = AVbinSourceLoader()
+ if _debug:
+ print('AVbin available, using to load media files')
+ else:
+ _source_loader = RIFFSourceLoader()
+ if _debug:
+ print('AVbin not available. Only supporting wave files.')
+
+ return _source_loader
+
+_source_loader = None
+
+
+def have_avbin():
+ """Returns ``True`` iff AVBin is installed and accessible on the user's
+ system.
+ """
+ global _have_avbin
+ if _have_avbin is None:
+ try:
+ from .avbin import AVbinSource
+ _have_avbin = True
+ except ImportError:
+ _have_avbin = False
+ return _have_avbin
+
+_have_avbin = None
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/sources/procedural.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/sources/procedural.py
new file mode 100644
index 0000000..dade11a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/sources/procedural.py
@@ -0,0 +1,634 @@
+from __future__ import division
+from builtins import range
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+from pyglet.media.sources.base import Source, AudioFormat, AudioData
+
+from collections import deque
+
+import ctypes
+import os
+import math
+import struct
+import random
+
+
+class Envelope(object):
+ """Base class for ProceduralSource amplitude envelopes."""
+ def build_envelope(self, sample_rate, duration):
+ raise NotImplementedError
+
+
+class FlatEnvelope(Envelope):
+ """A flat envelope, providing basic amplitude setting.
+
+ :Parameters:
+ `amplitude` : float
+ The amplitude (volume) of the wave, from 0.0 to 1.0.
+ Values outside of this range will be clamped.
+ """
+ def __init__(self, amplitude=0.5):
+ self.amplitude = max(min(1.0, amplitude), 0)
+
+ def build_envelope(self, sample_rate, duration):
+ amplitude = self.amplitude
+ total_bytes = int(sample_rate * duration)
+ return [amplitude for _ in range(total_bytes)]
+
+
+class LinearDecayEnvelope(Envelope):
+ """A linearly decaying envelope.
+
+ This envelope linearly decays the amplitude from the peak value
+ to 0, over the length of the waveform.
+
+ :Parameters:
+ `peak` : float
+ The Initial peak value of the envelope, from 0.0 to 1.0.
+ Values outside of this range will be clamped.
+ """
+ def __init__(self, peak=1.0):
+ self.peak = max(min(1.0, peak), 0)
+
+ def build_envelope(self, sample_rate, duration):
+ peak = self.peak
+ total_bytes = int(sample_rate * duration)
+ envelope = []
+ for i in range(total_bytes):
+ envelope.append((total_bytes - i) / total_bytes * peak)
+ return envelope
+
+
+class ADSREnvelope(Envelope):
+ """A four part Attack, Decay, Suspend, Release envelope.
+
+ This is a four part ADSR envelope. The attack, decay, and release
+ parameters should be provided in seconds. For example, a value of
+ 0.1 would be 100ms. The sustain_amplitude parameter affects the
+ sustain volume. This defaults to a value of 0.5, but can be provided
+ on a scale from 0.0 to 1.0.
+
+ :Parameters:
+ `attack` : float
+ The attack time, in seconds.
+ `decay` : float
+ The decay time, in seconds.
+ `release` : float
+ The release time, in seconds.
+ `sustain_amplitude` : float
+ The sustain amplitude (volume), from 0.0 to 1.0.
+ """
+ def __init__(self, attack, decay, release, sustain_amplitude=0.5):
+ self.attack = attack
+ self.decay = decay
+ self.release = release
+ self.sustain_amplitude = max(min(1.0, sustain_amplitude), 0)
+
+ def build_envelope(self, sample_rate, duration):
+ sustain_amplitude = self.sustain_amplitude
+ total_bytes = int(sample_rate * duration)
+ attack_bytes = int(sample_rate * self.attack)
+ decay_bytes = int(sample_rate * self.decay)
+ release_bytes = int(sample_rate * self.release)
+ sustain_bytes = total_bytes - attack_bytes - decay_bytes - release_bytes
+ decay_step = (1 - sustain_amplitude) / decay_bytes
+ release_step = sustain_amplitude / release_bytes
+ envelope = []
+ for i in range(1, attack_bytes + 1):
+ envelope.append(i / attack_bytes)
+ for i in range(1, decay_bytes + 1):
+ envelope.append(1 - (i * decay_step))
+ for i in range(1, sustain_bytes + 1):
+ envelope.append(sustain_amplitude)
+ for i in range(1, release_bytes + 1):
+ envelope.append(sustain_amplitude - (i * release_step))
+ return envelope
+
+
+class TremoloEnvelope(Envelope):
+ """A tremolo envelope, for modulation amplitude.
+
+ A tremolo envelope that modulates the amplitude of the
+ waveform with a sinusoidal pattern. The depth and rate
+ of modulation can be specified. Depth is calculated as
+ a percentage of the maximum amplitude. For example:
+ a depth of 0.2 and amplitude of 0.5 will fluctuate
+ the amplitude between 0.4 an 0.5.
+
+ :Parameters:
+ `depth` : float
+ The amount of fluctuation, from 0.0 to 1.0.
+ `rate` : float
+ The fluctuation frequency, in seconds.
+ `amplitude` : float
+ The peak amplitude (volume), from 0.0 to 1.0.
+ """
+ def __init__(self, depth, rate, amplitude=0.5):
+ self.depth = max(min(1.0, depth), 0)
+ self.rate = rate
+ self.amplitude = max(min(1.0, amplitude), 0)
+
+ def build_envelope(self, sample_rate, duration):
+ total_bytes = int(sample_rate * duration)
+ period = total_bytes / duration
+ max_amplitude = self.amplitude
+ min_amplitude = max(0, (1 - self.depth) * self.amplitude)
+ step = (math.pi * 2) / period / self.rate
+ envelope = []
+ for i in range(total_bytes):
+ value = math.sin(step * i)
+ envelope.append(value * (max_amplitude - min_amplitude) + min_amplitude)
+ return envelope
+
+
+class ProceduralSource(Source):
+ """Base class for procedurally defined and generated waveforms.
+
+ :Parameters:
+ `duration` : float
+ The length, in seconds, of audio that you wish to generate.
+ `sample_rate` : int
+ Audio samples per second. (CD quality is 44100).
+ `sample_size` : int
+ The bit precision. Must be either 8 or 16.
+ """
+ def __init__(self, duration, sample_rate=44800, sample_size=16, envelope=None):
+
+ self._duration = float(duration)
+ self.audio_format = AudioFormat(
+ channels=1,
+ sample_size=sample_size,
+ sample_rate=sample_rate)
+
+ self._offset = 0
+ self._sample_rate = sample_rate
+ self._sample_size = sample_size
+ self._bytes_per_sample = sample_size >> 3
+ self._bytes_per_second = self._bytes_per_sample * sample_rate
+ self._max_offset = int(self._bytes_per_second * self._duration)
+ self._envelope = envelope
+
+ if self._bytes_per_sample == 2:
+ self._max_offset &= 0xfffffffe
+
+ if not self._envelope:
+ self._envelope = FlatEnvelope(amplitude=1.0)
+
+ self._envelope_array = self._envelope.build_envelope(self._sample_rate, self._duration)
+
+ @property
+ def envelope(self):
+ return self._envelope
+
+ @envelope.setter
+ def envelope(self, envelope):
+ self._envelope = envelope
+ self._envelope_array = envelope.build_envelope(self._sample_rate, self._duration)
+
+ def get_audio_data(self, num_bytes):
+ """Return `num_bytes` bytes of audio data."""
+ num_bytes = min(num_bytes, self._max_offset - self._offset)
+ if num_bytes <= 0:
+ return None
+
+ timestamp = float(self._offset) / self._bytes_per_second
+ duration = float(num_bytes) / self._bytes_per_second
+ data = self._generate_data(num_bytes, self._offset)
+ self._offset += num_bytes
+
+ return AudioData(data, num_bytes, timestamp, duration, [])
+
+ def _generate_data(self, num_bytes, offset):
+ """Generate `num_bytes` bytes of data.
+
+ Return data as ctypes array or string.
+ """
+ raise NotImplementedError('abstract')
+
+ def seek(self, timestamp):
+ self._offset = int(timestamp * self._bytes_per_second)
+
+ # Bound within duration
+ self._offset = min(max(self._offset, 0), self._max_offset)
+
+ # Align to sample
+ if self._bytes_per_sample == 2:
+ self._offset &= 0xfffffffe
+
+ def save(self, filename):
+ """Save the audio to disk as a standard RIFF Wave.
+
+ A standard RIFF wave header will be added to the raw PCM
+ audio data when it is saved to disk.
+
+ :Parameters:
+ `filename` : str
+ The file name to save as.
+
+ """
+ offset = self._offset
+ self.seek(0)
+ data = self.get_audio_data(self._max_offset).get_string_data()
+ header = struct.pack('<4sI8sIHHIIHH4sI',
+ b"RIFF",
+ len(data) + 44 - 8,
+ b"WAVEfmt ",
+ 16, # Default for PCM
+ 1, # Default for PCM
+ 1, # Number of channels
+ self._sample_rate,
+ self._bytes_per_second,
+ self._bytes_per_sample,
+ self._sample_size,
+ b"data",
+ len(data))
+
+ with open(filename, "wb") as f:
+ f.write(header)
+ f.write(data)
+ self._offset = offset
+
+
+class Silence(ProceduralSource):
+ """A silent waveform."""
+
+ def _generate_data(self, num_bytes, offset):
+ if self._bytes_per_sample == 1:
+ return b'\127' * num_bytes
+ else:
+ return b'\0' * num_bytes
+
+
+class WhiteNoise(ProceduralSource):
+ """A white noise, random waveform."""
+
+ def _generate_data(self, num_bytes, offset):
+ return os.urandom(num_bytes)
+
+
+class Sine(ProceduralSource):
+ """A procedurally generated sinusoid waveform.
+
+ :Parameters:
+ `duration` : float
+ The length, in seconds, of audio that you wish to generate.
+ `frequency` : int
+ The frequency, in Hz of the waveform you wish to produce.
+ `sample_rate` : int
+ Audio samples per second. (CD quality is 44100).
+ `sample_size` : int
+ The bit precision. Must be either 8 or 16.
+ """
+ def __init__(self, duration, frequency=440, **kwargs):
+ super(Sine, self).__init__(duration, **kwargs)
+ self.frequency = frequency
+
+ def _generate_data(self, num_bytes, offset):
+ if self._bytes_per_sample == 1:
+ start = offset
+ samples = num_bytes
+ bias = 127
+ amplitude = 127
+ data = (ctypes.c_ubyte * samples)()
+ else:
+ start = offset >> 1
+ samples = num_bytes >> 1
+ bias = 0
+ amplitude = 32767
+ data = (ctypes.c_short * samples)()
+ step = self.frequency * (math.pi * 2) / self.audio_format.sample_rate
+ envelope = self._envelope_array
+ env_offset = offset // self._bytes_per_sample
+ for i in range(samples):
+ data[i] = int(math.sin(step * (i + start)) *
+ amplitude * envelope[i+env_offset] + bias)
+ return data
+
+
+class Triangle(ProceduralSource):
+ """A procedurally generated triangle waveform.
+
+ :Parameters:
+ `duration` : float
+ The length, in seconds, of audio that you wish to generate.
+ `frequency` : int
+ The frequency, in Hz of the waveform you wish to produce.
+ `sample_rate` : int
+ Audio samples per second. (CD quality is 44100).
+ `sample_size` : int
+ The bit precision. Must be either 8 or 16.
+ """
+ def __init__(self, duration, frequency=440, **kwargs):
+ super(Triangle, self).__init__(duration, **kwargs)
+ self.frequency = frequency
+
+ def _generate_data(self, num_bytes, offset):
+ # XXX TODO consider offset
+ if self._bytes_per_sample == 1:
+ samples = num_bytes
+ value = 127
+ maximum = 255
+ minimum = 0
+ data = (ctypes.c_ubyte * samples)()
+ else:
+ samples = num_bytes >> 1
+ value = 0
+ maximum = 32767
+ minimum = -32768
+ data = (ctypes.c_short * samples)()
+ step = (maximum - minimum) * 2 * self.frequency / self.audio_format.sample_rate
+ envelope = self._envelope_array
+ env_offset = offset // self._bytes_per_sample
+ for i in range(samples):
+ value += step
+ if value > maximum:
+ value = maximum - (value - maximum)
+ step = -step
+ if value < minimum:
+ value = minimum - (value - minimum)
+ step = -step
+ data[i] = int(value * envelope[i+env_offset])
+ return data
+
+
+class Sawtooth(ProceduralSource):
+ """A procedurally generated sawtooth waveform.
+
+ :Parameters:
+ `duration` : float
+ The length, in seconds, of audio that you wish to generate.
+ `frequency` : int
+ The frequency, in Hz of the waveform you wish to produce.
+ `sample_rate` : int
+ Audio samples per second. (CD quality is 44100).
+ `sample_size` : int
+ The bit precision. Must be either 8 or 16.
+ """
+ def __init__(self, duration, frequency=440, **kwargs):
+ super(Sawtooth, self).__init__(duration, **kwargs)
+ self.frequency = frequency
+
+ def _generate_data(self, num_bytes, offset):
+ # XXX TODO consider offset
+ if self._bytes_per_sample == 1:
+ samples = num_bytes
+ value = 127
+ maximum = 255
+ minimum = 0
+ data = (ctypes.c_ubyte * samples)()
+ else:
+ samples = num_bytes >> 1
+ value = 0
+ maximum = 32767
+ minimum = -32768
+ data = (ctypes.c_short * samples)()
+ step = (maximum - minimum) * self.frequency / self._sample_rate
+ envelope = self._envelope_array
+ env_offset = offset // self._bytes_per_sample
+ for i in range(samples):
+ value += step
+ if value > maximum:
+ value = minimum + (value % maximum)
+ data[i] = int(value * envelope[i+env_offset])
+ return data
+
+
+class Square(ProceduralSource):
+ """A procedurally generated square (or pulse) waveform.
+
+ :Parameters:
+ `duration` : float
+ The length, in seconds, of audio that you wish to generate.
+ `frequency` : int
+ The frequency, in Hz of the waveform you wish to produce.
+ `sample_rate` : int
+ Audio samples per second. (CD quality is 44100).
+ `sample_size` : int
+ The bit precision. Must be either 8 or 16.
+ """
+ def __init__(self, duration, frequency=440, **kwargs):
+
+ super(Square, self).__init__(duration, **kwargs)
+ self.frequency = frequency
+
+ def _generate_data(self, num_bytes, offset):
+ # XXX TODO consider offset
+ if self._bytes_per_sample == 1:
+ start = offset
+ samples = num_bytes
+ bias = 127
+ amplitude = 127
+ data = (ctypes.c_ubyte * samples)()
+ else:
+ start = offset >> 1
+ samples = num_bytes >> 1
+ bias = 0
+ amplitude = 32767
+ data = (ctypes.c_short * samples)()
+ half_period = self.audio_format.sample_rate / self.frequency / 2
+ envelope = self._envelope_array
+ env_offset = offset // self._bytes_per_sample
+ value = 1
+ count = 0
+ for i in range(samples):
+ if count >= half_period:
+ value = -value
+ count %= half_period
+ count += 1
+ data[i] = int(value * amplitude * envelope[i+env_offset] + bias)
+ return data
+
+
+# class Noise(ProceduralSource):
+# """A pseudo-random Noise waveform.
+#
+# :Parameters:
+# `duration` : float
+# The length, in seconds, of audio that you wish to generate.
+# `frequency` : int
+# The frequency, in Hz of the waveform you wish to produce.
+# `sample_rate` : int
+# Audio samples per second. (CD quality is 44100).
+# `sample_size` : int
+# The bit precision. Must be either 8 or 16.
+# """
+# def __init__(self, duration, frequency=440, **kwargs):
+# super(Noise, self).__init__(duration, **kwargs)
+# self.frequency = frequency
+# self.lfsr = _LFSR([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])
+#
+# def _generate_data(self, num_bytes, offset):
+# # XXX TODO consider offset
+# if self._bytes_per_sample == 1:
+# start = offset
+# samples = num_bytes
+# bias = 0
+# amplitude = 255
+# data = (ctypes.c_ubyte * samples)()
+# else:
+# start = offset >> 1
+# samples = num_bytes >> 1
+# bias = -32768
+# amplitude = 32767
+# data = (ctypes.c_short * samples)()
+# envelope = self._envelope_array
+# env_offset = offset // self._bytes_per_sample
+# period = self._sample_rate / self.frequency
+# lfsr = self.lfsr
+# lfsr.advance(start)
+# counter = 0
+# for i in range(samples):
+# counter += 1
+# if counter > period:
+# lfsr.reset()
+# counter = 0
+# value = lfsr.get()
+# data[i] = int(value * amplitude * envelope[i+env_offset] + bias)
+# return data
+
+
+class FM(ProceduralSource):
+ """A procedurally generated FM waveform.
+
+ This is a simplistic frequency modulated waveform, based on the
+ concepts by John Chowning. Basic sine waves are used for both
+ frequency carrier and modulator inputs, of which the frequencies can
+ be provided. The modulation index, or amplitude, can also be adjusted.
+
+ :Parameters:
+ `duration` : float
+ The length, in seconds, of audio that you wish to generate.
+ `carrier` : int
+ The carrier frequency, in Hz.
+ `modulator` : int
+ The modulator frequency, in Hz.
+ `mod_index` : int
+ The modulation index.
+ `sample_rate` : int
+ Audio samples per second. (CD quality is 44100).
+ `sample_size` : int
+ The bit precision. Must be either 8 or 16.
+ """
+ def __init__(self, duration, carrier=440, modulator=440, mod_index=1, **kwargs):
+ super(FM, self).__init__(duration, **kwargs)
+ self.carrier = carrier
+ self.modulator = modulator
+ self.mod_index = mod_index
+
+ def _generate_data(self, num_bytes, offset):
+ if self._bytes_per_sample == 1:
+ start = offset
+ samples = num_bytes
+ bias = 127
+ amplitude = 127
+ data = (ctypes.c_ubyte * samples)()
+ else:
+ start = offset >> 1
+ samples = num_bytes >> 1
+ bias = 0
+ amplitude = 32767
+ data = (ctypes.c_short * samples)()
+ car_step = 2 * math.pi * self.carrier
+ mod_step = 2 * math.pi * self.modulator
+ mod_index = self.mod_index
+ sample_rate = self._sample_rate
+ envelope = self._envelope_array
+ env_offset = offset // self._bytes_per_sample
+ # FM equation: sin((2 * pi * carrier) + sin(2 * pi * modulator))
+ for i in range(samples):
+ increment = (i + start) / sample_rate
+ data[i] = int(math.sin(car_step * increment +
+ mod_index * math.sin(mod_step * increment))
+ * amplitude * envelope[i+env_offset] + bias)
+ return data
+
+
+class Digitar(ProceduralSource):
+ """A procedurally generated guitar-like waveform.
+
+ A guitar-like waveform, based on the Karplus-Strong algorithm.
+ The sound is similar to a plucked guitar string. The resulting
+ sound decays over time, and so the actual length will vary
+ depending on the frequency. Lower frequencies require a longer
+ `length` parameter to prevent cutting off abruptly.
+
+ :Parameters:
+ `duration` : float
+ The length, in seconds, of audio that you wish to generate.
+ `frequency` : int
+ The frequency, in Hz of the waveform you wish to produce.
+ `decay` : float
+ The decay rate of the effect. Defaults to 0.996.
+ `sample_rate` : int
+ Audio samples per second. (CD quality is 44100).
+ `sample_size` : int
+ The bit precision. Must be either 8 or 16.
+ """
+ def __init__(self, duration, frequency=440, decay=0.996, **kwargs):
+ super(Digitar, self).__init__(duration, **kwargs)
+ self.frequency = frequency
+ self.decay = decay
+ self.period = int(self._sample_rate / self.frequency)
+
+ def _advance(self, positions):
+ # XXX create fresh ring buffer, and advance if necessary.
+ period = self.period
+ random.seed(10)
+ ring_buffer = deque([random.uniform(-1, 1) for _ in range(period)], maxlen=period)
+ for _ in range(positions):
+ decay = self.decay
+ ring_buffer.append(decay * (ring_buffer[0] + ring_buffer[1]) / 2)
+ self.ring_buffer = ring_buffer
+
+ def _generate_data(self, num_bytes, offset):
+ if self._bytes_per_sample == 1:
+ start = offset
+ samples = num_bytes
+ bias = 127
+ amplitude = 127
+ data = (ctypes.c_ubyte * samples)()
+ else:
+ start = offset >> 1
+ samples = num_bytes >> 1
+ bias = 0
+ amplitude = 32767
+ data = (ctypes.c_short * samples)()
+ self._advance(start)
+ ring_buffer = self.ring_buffer
+ decay = self.decay
+ for i in range(samples):
+ data[i] = int(ring_buffer[0] * amplitude + bias)
+ ring_buffer.append(decay * (ring_buffer[0] + ring_buffer[1]) / 2)
+ return data
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/sources/riff.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/sources/riff.py
new file mode 100644
index 0000000..7a5639c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/media/sources/riff.py
@@ -0,0 +1,247 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+"""Simple Python-only RIFF reader, supports uncompressed WAV files.
+"""
+from __future__ import division
+from builtins import object
+
+# RIFF reference:
+# http://www.saettler.com/RIFFMCI/riffmci.html
+#
+# More readable WAVE summaries:
+#
+# http://www.borg.com/~jglatt/tech/wave.htm
+# http://www.sonicspot.com/guide/wavefiles.html
+
+from pyglet.media.exceptions import MediaFormatException
+from pyglet.media.sources.base import StreamingSource, AudioData, AudioFormat
+from pyglet.compat import BytesIO, asbytes
+
+import struct
+
+WAVE_FORMAT_PCM = 0x0001
+IBM_FORMAT_MULAW = 0x0101
+IBM_FORMAT_ALAW = 0x0102
+IBM_FORMAT_ADPCM = 0x0103
+
+class RIFFFormatException(MediaFormatException):
+ pass
+
+class WAVEFormatException(RIFFFormatException):
+ pass
+
+class RIFFChunk(object):
+ header_fmt = '<4sL'
+ header_length = struct.calcsize(header_fmt)
+
+ def __init__(self, file, name, length, offset):
+ self.file = file
+ self.name = name
+ self.length = length
+ self.offset = offset
+
+ def get_data(self):
+ self.file.seek(self.offset)
+ return self.file.read(self.length)
+
+ def __repr__(self):
+ return '%s(%r, offset=%r, length=%r)' % (
+ self.__class__.__name__,
+ self.name,
+ self.offset,
+ self.length)
+
+class RIFFForm(object):
+ _chunks = None
+
+ def __init__(self, file, offset):
+ self.file = file
+ self.offset = offset
+
+ def get_chunks(self):
+ if self._chunks:
+ return self._chunks
+
+ self._chunks = []
+ self.file.seek(self.offset)
+ offset = self.offset
+ while True:
+ header = self.file.read(RIFFChunk.header_length)
+ if not header:
+ break
+ name, length = struct.unpack(RIFFChunk.header_fmt, header)
+ offset += RIFFChunk.header_length
+
+ cls = self._chunk_types.get(name, RIFFChunk)
+ chunk = cls(self.file, name, length, offset)
+ self._chunks.append(chunk)
+
+ offset += length
+ if offset & 0x3 != 0:
+ offset = (offset | 0x3) + 1
+ self.file.seek(offset)
+ return self._chunks
+
+ def __repr__(self):
+ return '%s(offset=%r)' % (self.__class__.__name__, self.offset)
+
+class RIFFType(RIFFChunk):
+ def __init__(self, *args, **kwargs):
+ super(RIFFType, self).__init__(*args, **kwargs)
+
+ self.file.seek(self.offset)
+ form = self.file.read(4)
+ if form != asbytes('WAVE'):
+ raise RIFFFormatException('Unsupported RIFF form "%s"' % form)
+
+ self.form = WaveForm(self.file, self.offset + 4)
+
+class RIFFFile(RIFFForm):
+ _chunk_types = {
+ asbytes('RIFF'): RIFFType,
+ }
+
+ def __init__(self, file):
+ if not hasattr(file, 'seek'):
+ file = BytesIO(file.read())
+
+ super(RIFFFile, self).__init__(file, 0)
+
+ def get_wave_form(self):
+ chunks = self.get_chunks()
+ if len(chunks) == 1 and isinstance(chunks[0], RIFFType):
+ return chunks[0].form
+
+class WaveFormatChunk(RIFFChunk):
+ def __init__(self, *args, **kwargs):
+ super(WaveFormatChunk, self).__init__(*args, **kwargs)
+
+ fmt = ' player.min_buffer_size:
+ player.refill(write_size)
+ filled = True
+ if not filled:
+ sleep_time = self._nap_time
+ else:
+ assert _debug('PlayerWorker: No active players')
+ sleep_time = self._sleep_time
+
+ if sleep_time != -1:
+ self.sleep(sleep_time)
+ else:
+ # We MUST sleep, or we will starve pyglet's main loop. It
+ # also looks like if we don't sleep enough, we'll starve out
+ # various updates that stop us from properly removing players
+ # that should be removed.
+ self.sleep(self._nap_time)
+
+ def add(self, player):
+ assert player is not None
+ assert _debug('PlayerWorker: player added')
+ with self.condition:
+ self.players.add(player)
+ self.condition.notify()
+
+ def remove(self, player):
+ assert _debug('PlayerWorker: player removed')
+ with self.condition:
+ if player in self.players:
+ self.players.remove(player)
+ self.condition.notify()
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/resource.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/resource.py
new file mode 100644
index 0000000..5ba53d8
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/resource.py
@@ -0,0 +1,772 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+"""Load application resources from a known path.
+
+Loading resources by specifying relative paths to filenames is often
+problematic in Python, as the working directory is not necessarily the same
+directory as the application's script files.
+
+This module allows applications to specify a search path for resources.
+Relative paths are taken to be relative to the application's ``__main__``
+module. ZIP files can appear on the path; they will be searched inside. The
+resource module also behaves as expected when applications are bundled using py2exe or py2app.
+
+As well as providing file references (with the :py:func:`file` function), the
+resource module also contains convenience functions for loading images,
+textures, fonts, media and documents.
+
+3rd party modules or packages not bound to a specific application should
+construct their own :py:class:`Loader` instance and override the path to use the
+resources in the module's directory.
+
+Path format
+^^^^^^^^^^^
+
+The resource path :py:attr:`path` (see also :py:meth:`Loader.__init__` and
+:py:meth:`Loader.path`)
+is a list of locations to search for resources. Locations are searched in the
+order given in the path. If a location is not valid (for example, if the
+directory does not exist), it is skipped.
+
+Locations in the path beginning with an ampersand (''@'' symbol) specify
+Python packages. Other locations specify a ZIP archive or directory on the
+filesystem. Locations that are not absolute are assumed to be relative to the
+script home. Some examples::
+
+ # Search just the `res` directory, assumed to be located alongside the
+ # main script file.
+ path = ['res']
+
+ # Search the directory containing the module `levels.level1`, followed
+ # by the `res/images` directory.
+ path = ['@levels.level1', 'res/images']
+
+Paths are always case-sensitive and forward slashes are always used as path
+separators, even in cases when the filesystem or platform does not do this.
+This avoids a common programmer error when porting applications between
+platforms.
+
+The default path is ``['.']``. If you modify the path, you must call
+:py:func:`reindex`.
+
+.. versionadded:: 1.1
+"""
+from future import standard_library
+
+standard_library.install_aliases()
+from builtins import object
+from past.builtins import basestring
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import os
+import weakref
+import sys
+import zipfile
+
+import pyglet
+from pyglet.compat import BytesIO
+
+
+class ResourceNotFoundException(Exception):
+ """The named resource was not found on the search path."""
+
+ def __init__(self, name):
+ message = ('Resource "%s" was not found on the path. '
+ 'Ensure that the filename has the correct captialisation.') % name
+ Exception.__init__(self, message)
+
+
+def get_script_home():
+ """Get the directory containing the program entry module.
+
+ For ordinary Python scripts, this is the directory containing the
+ ``__main__`` module. For executables created with py2exe the result is
+ the directory containing the running executable file. For OS X bundles
+ created using Py2App the result is the Resources directory within the
+ running bundle.
+
+ If none of the above cases apply and the file for ``__main__`` cannot
+ be determined the working directory is returned.
+
+ When the script is being run by a Python profiler, this function
+ may return the directory where the profiler is running instead of
+ the directory of the real script. To workaround this behaviour the
+ full path to the real script can be specified in :py:attr:`pyglet.resource.path`.
+
+ :rtype: str
+ """
+ frozen = getattr(sys, 'frozen', None)
+ meipass = getattr(sys, '_MEIPASS', None)
+ if meipass:
+ # PyInstaller
+ return meipass
+ elif frozen in ('windows_exe', 'console_exe'):
+ return os.path.dirname(sys.executable)
+ elif frozen == 'macosx_app':
+ # py2app
+ return os.environ['RESOURCEPATH']
+ else:
+ main = sys.modules['__main__']
+ if hasattr(main, '__file__'):
+ return os.path.dirname(os.path.abspath(main.__file__))
+ else:
+ if 'python' in os.path.basename(sys.executable):
+ # interactive
+ return os.getcwd()
+ else:
+ # cx_Freeze
+ return os.path.dirname(sys.executable)
+
+
+def get_settings_path(name):
+ """Get a directory to save user preferences.
+
+ Different platforms have different conventions for where to save user
+ preferences, saved games, and settings. This function implements those
+ conventions. Note that the returned path may not exist: applications
+ should use ``os.makedirs`` to construct it if desired.
+
+ On Linux, a directory `name` in the user's configuration directory is
+ returned (usually under ``~/.config``).
+
+ On Windows (including under Cygwin) the `name` directory in the user's
+ ``Application Settings`` directory is returned.
+
+ On Mac OS X the `name` directory under ``~/Library/Application Support``
+ is returned.
+
+ :Parameters:
+ `name` : str
+ The name of the application.
+
+ :rtype: str
+ """
+
+ if pyglet.compat_platform in ('cygwin', 'win32'):
+ if 'APPDATA' in os.environ:
+ return os.path.join(os.environ['APPDATA'], name)
+ else:
+ return os.path.expanduser('~/%s' % name)
+ elif pyglet.compat_platform == 'darwin':
+ return os.path.expanduser('~/Library/Application Support/%s' % name)
+ elif pyglet.compat_platform.startswith('linux'):
+ if 'XDG_CONFIG_HOME' in os.environ:
+ return os.path.join(os.environ['XDG_CONFIG_HOME'], name)
+ else:
+ return os.path.expanduser('~/.config/%s' % name)
+ else:
+ return os.path.expanduser('~/.%s' % name)
+
+
+class Location(object):
+ """Abstract resource location.
+
+ Given a location, a file can be loaded from that location with the `open`
+ method. This provides a convenient way to specify a path to load files
+ from, and not necessarily have that path reside on the filesystem.
+ """
+
+ def open(self, filename, mode='rb'):
+ """Open a file at this location.
+
+ :Parameters:
+ `filename` : str
+ The filename to open. Absolute paths are not supported.
+ Relative paths are not supported by most locations (you
+ should specify only a filename with no path component).
+ `mode` : str
+ The file mode to open with. Only files opened on the
+ filesystem make use of this parameter; others ignore it.
+
+ :rtype: file object
+ """
+ raise NotImplementedError('abstract')
+
+
+class FileLocation(Location):
+ """Location on the filesystem.
+ """
+
+ def __init__(self, path):
+ """Create a location given a relative or absolute path.
+
+ :Parameters:
+ `path` : str
+ Path on the filesystem.
+ """
+ self.path = path
+
+ def open(self, filename, mode='rb'):
+ return open(os.path.join(self.path, filename), mode)
+
+
+class ZIPLocation(Location):
+ """Location within a ZIP file.
+ """
+
+ def __init__(self, zip, dir):
+ """Create a location given an open ZIP file and a path within that
+ file.
+
+ :Parameters:
+ `zip` : ``zipfile.ZipFile``
+ An open ZIP file from the ``zipfile`` module.
+ `dir` : str
+ A path within that ZIP file. Can be empty to specify files at
+ the top level of the ZIP file.
+
+ """
+ self.zip = zip
+ self.dir = dir
+
+ def open(self, filename, mode='rb'):
+ if self.dir:
+ path = self.dir + '/' + filename
+ else:
+ path = filename
+ text = self.zip.read(path)
+ return BytesIO(text)
+
+
+class URLLocation(Location):
+ """Location on the network.
+
+ This class uses the ``urlparse`` and ``urllib2`` modules to open files on
+ the network given a URL.
+ """
+
+ def __init__(self, base_url):
+ """Create a location given a base URL.
+
+ :Parameters:
+ `base_url` : str
+ URL string to prepend to filenames.
+
+ """
+ self.base = base_url
+
+ def open(self, filename, mode='rb'):
+ import urllib.request, urllib.error, urllib.parse
+ url = urllib.parse.urljoin(self.base, filename)
+ return urllib.request.urlopen(url)
+
+
+class Loader(object):
+ """Load program resource files from disk.
+
+ The loader contains a search path which can include filesystem
+ directories, ZIP archives and Python packages.
+
+ :Ivariables:
+ `path` : list of str
+ List of search locations. After modifying the path you must
+ call the `reindex` method.
+ `script_home` : str
+ Base resource location, defaulting to the location of the
+ application script.
+
+ """
+ def __init__(self, path=None, script_home=None):
+ """Create a loader for the given path.
+
+ If no path is specified it defaults to ``['.']``; that is, just the
+ program directory.
+
+ See the module documentation for details on the path format.
+
+ :Parameters:
+ `path` : list of str
+ List of locations to search for resources.
+ `script_home` : str
+ Base location of relative files. Defaults to the result of
+ `get_script_home`.
+
+ """
+ if path is None:
+ path = ['.']
+ if isinstance(path, basestring):
+ path = [path]
+ self.path = list(path)
+ if script_home is None:
+ script_home = get_script_home()
+ self._script_home = script_home
+ self._index = None
+
+ # Map bin size to list of atlases
+ self._texture_atlas_bins = {}
+
+ def _require_index(self):
+ if self._index is None:
+ self.reindex()
+
+ def reindex(self):
+ """Refresh the file index.
+
+ You must call this method if `path` is changed or the filesystem
+ layout changes.
+ """
+ # map name to image etc.
+ self._cached_textures = weakref.WeakValueDictionary()
+ self._cached_images = weakref.WeakValueDictionary()
+ self._cached_animations = weakref.WeakValueDictionary()
+
+ self._index = {}
+ for path in self.path:
+ if path.startswith('@'):
+ # Module
+ name = path[1:]
+
+ try:
+ module = __import__(name)
+ except:
+ continue
+
+ for component in name.split('.')[1:]:
+ module = getattr(module, component)
+
+ if hasattr(module, '__file__'):
+ path = os.path.dirname(module.__file__)
+ else:
+ path = '' # interactive
+ elif not os.path.isabs(path):
+ # Add script base unless absolute
+ assert '\\' not in path, \
+ 'Backslashes not permitted in relative path'
+ path = os.path.join(self._script_home, path)
+
+ if os.path.isdir(path):
+ # Filesystem directory
+ path = path.rstrip(os.path.sep)
+ location = FileLocation(path)
+ for dirpath, dirnames, filenames in os.walk(path):
+ dirpath = dirpath[len(path) + 1:]
+ # Force forward slashes for index
+ if dirpath:
+ parts = [part
+ for part
+ in dirpath.split(os.sep)
+ if part is not None]
+ dirpath = '/'.join(parts)
+ for filename in filenames:
+ if dirpath:
+ index_name = dirpath + '/' + filename
+ else:
+ index_name = filename
+ self._index_file(index_name, location)
+ else:
+ # Find path component that is the ZIP file.
+ dir = ''
+ old_path = None
+ while path and not os.path.isfile(path):
+ old_path = path
+ path, tail_dir = os.path.split(path)
+ if path == old_path:
+ break
+ dir = '/'.join((tail_dir, dir))
+ if path == old_path:
+ continue
+ dir = dir.rstrip('/')
+
+ # path is a ZIP file, dir resides within ZIP
+ if path and zipfile.is_zipfile(path):
+ zip = zipfile.ZipFile(path, 'r')
+ location = ZIPLocation(zip, dir)
+ for zip_name in zip.namelist():
+ # zip_name_dir, zip_name = os.path.split(zip_name)
+ # assert '\\' not in name_dir
+ # assert not name_dir.endswith('/')
+ if zip_name.startswith(dir):
+ if dir:
+ zip_name = zip_name[len(dir) + 1:]
+ self._index_file(zip_name, location)
+
+ def _index_file(self, name, location):
+ if name not in self._index:
+ self._index[name] = location
+
+ def file(self, name, mode='rb'):
+ """Load a resource.
+
+ :Parameters:
+ `name` : str
+ Filename of the resource to load.
+ `mode` : str
+ Combination of ``r``, ``w``, ``a``, ``b`` and ``t`` characters
+ with the meaning as for the builtin ``open`` function.
+
+ :rtype: file object
+ """
+ self._require_index()
+ try:
+ location = self._index[name]
+ return location.open(name, mode)
+ except KeyError:
+ raise ResourceNotFoundException(name)
+
+ def location(self, name):
+ """Get the location of a resource.
+
+ This method is useful for opening files referenced from a resource.
+ For example, an HTML file loaded as a resource might reference some
+ images. These images should be located relative to the HTML file, not
+ looked up individually in the loader's path.
+
+ :Parameters:
+ `name` : str
+ Filename of the resource to locate.
+
+ :rtype: `Location`
+ """
+ self._require_index()
+ try:
+ return self._index[name]
+ except KeyError:
+ raise ResourceNotFoundException(name)
+
+ def add_font(self, name):
+ """Add a font resource to the application.
+
+ Fonts not installed on the system must be added to pyglet before they
+ can be used with `font.load`. Although the font is added with
+ its filename using this function, it is loaded by specifying its
+ family name. For example::
+
+ resource.add_font('action_man.ttf')
+ action_man = font.load('Action Man')
+
+ :Parameters:
+ `name` : str
+ Filename of the font resource to add.
+
+ """
+ self._require_index()
+ from pyglet import font
+ file = self.file(name)
+ font.add_file(file)
+
+ def _alloc_image(self, name, atlas=True):
+ file = self.file(name)
+ try:
+ img = pyglet.image.load(name, file=file)
+ finally:
+ file.close()
+
+ if not atlas:
+ return img.get_texture(True)
+
+ # find an atlas suitable for the image
+ bin = self._get_texture_atlas_bin(img.width, img.height)
+ if bin is None:
+ return img.get_texture(True)
+
+ return bin.add(img)
+
+ def _get_texture_atlas_bin(self, width, height):
+ """A heuristic for determining the atlas bin to use for a given image
+ size. Returns None if the image should not be placed in an atlas (too
+ big), otherwise the bin (a list of TextureAtlas).
+ """
+ # Large images are not placed in an atlas
+ max_texture_size = pyglet.image.atlas.get_max_texture_size()
+ max_size = min(1024, max_texture_size / 2)
+ if width > max_size or height > max_size:
+ return None
+
+ # Group images with small height separately to larger height
+ # (as the allocator can't stack within a single row).
+ bin_size = 1
+ if height > max_size / 4:
+ bin_size = 2
+
+ try:
+ texture_bin = self._texture_atlas_bins[bin_size]
+ except KeyError:
+ texture_bin = self._texture_atlas_bins[bin_size] =\
+ pyglet.image.atlas.TextureBin()
+
+ return texture_bin
+
+ def image(self, name, flip_x=False, flip_y=False, rotate=0, atlas=True):
+ """Load an image with optional transformation.
+
+ This is similar to `texture`, except the resulting image will be
+ packed into a :py:class:`~pyglet.image.atlas.TextureBin` if it is an appropriate size for packing.
+ This is more efficient than loading images into separate textures.
+
+ :Parameters:
+ `name` : str
+ Filename of the image source to load.
+ `flip_x` : bool
+ If True, the returned image will be flipped horizontally.
+ `flip_y` : bool
+ If True, the returned image will be flipped vertically.
+ `rotate` : int
+ The returned image will be rotated clockwise by the given
+ number of degrees (a multiple of 90).
+ `atlas` : bool
+ If True, the image will be loaded into an atlas managed by
+ pyglet. If atlas loading is not appropriate for specific
+ texturing reasons (e.g. border control is required) then set
+ this argument to False.
+
+ :rtype: `Texture`
+ :return: A complete texture if the image is large or not in an atlas,
+ otherwise a :py:class:`~pyglet.image.TextureRegion` of a texture atlas.
+ """
+ self._require_index()
+ if name in self._cached_images:
+ identity = self._cached_images[name]
+ else:
+ identity = self._cached_images[name] = self._alloc_image(name,
+ atlas=atlas)
+
+ if not rotate and not flip_x and not flip_y:
+ return identity
+
+ return identity.get_transform(flip_x, flip_y, rotate)
+
+ def animation(self, name, flip_x=False, flip_y=False, rotate=0):
+ """Load an animation with optional transformation.
+
+ Animations loaded from the same source but with different
+ transformations will use the same textures.
+
+ :Parameters:
+ `name` : str
+ Filename of the animation source to load.
+ `flip_x` : bool
+ If True, the returned image will be flipped horizontally.
+ `flip_y` : bool
+ If True, the returned image will be flipped vertically.
+ `rotate` : int
+ The returned image will be rotated clockwise by the given
+ number of degrees (a multiple of 90).
+
+ :rtype: :py:class:`~pyglet.image.Animation`
+ """
+ self._require_index()
+ try:
+ identity = self._cached_animations[name]
+ except KeyError:
+ animation = pyglet.image.load_animation(name, self.file(name))
+ bin = self._get_texture_atlas_bin(animation.get_max_width(),
+ animation.get_max_height())
+ if bin:
+ animation.add_to_texture_bin(bin)
+
+ identity = self._cached_animations[name] = animation
+
+ if not rotate and not flip_x and not flip_y:
+ return identity
+
+ return identity.get_transform(flip_x, flip_y, rotate)
+
+ def get_cached_image_names(self):
+ """Get a list of image filenames that have been cached.
+
+ This is useful for debugging and profiling only.
+
+ :rtype: list
+ :return: List of str
+ """
+ self._require_index()
+ return list(self._cached_images.keys())
+
+ def get_cached_animation_names(self):
+ """Get a list of animation filenames that have been cached.
+
+ This is useful for debugging and profiling only.
+
+ :rtype: list
+ :return: List of str
+ """
+ self._require_index()
+ return list(self._cached_animations.keys())
+
+ def get_texture_bins(self):
+ """Get a list of texture bins in use.
+
+ This is useful for debugging and profiling only.
+
+ :rtype: list
+ :return: List of :py:class:`~pyglet.image.atlas.TextureBin`
+ """
+ self._require_index()
+ return list(self._texture_atlas_bins.values())
+
+ def media(self, name, streaming=True):
+ """Load a sound or video resource.
+
+ The meaning of `streaming` is as for `media.load`. Compressed
+ sources cannot be streamed (that is, video and compressed audio
+ cannot be streamed from a ZIP archive).
+
+ :Parameters:
+ `name` : str
+ Filename of the media source to load.
+ `streaming` : bool
+ True if the source should be streamed from disk, False if
+ it should be entirely decoded into memory immediately.
+
+ :rtype: `media.Source`
+ """
+ self._require_index()
+ from pyglet import media
+ try:
+ location = self._index[name]
+ if isinstance(location, FileLocation):
+ # Don't open the file if it's streamed from disk -- AVbin
+ # needs to do it.
+ path = os.path.join(location.path, name)
+ return media.load(path, streaming=streaming)
+ else:
+ file = location.open(name)
+ return media.load(name, file=file, streaming=streaming)
+ except KeyError:
+ raise ResourceNotFoundException(name)
+
+ def texture(self, name):
+ """Load a texture.
+
+ The named image will be loaded as a single OpenGL texture. If the
+ dimensions of the image are not powers of 2 a :py:class:`~pyglet.image.TextureRegion` will
+ be returned.
+
+ :Parameters:
+ `name` : str
+ Filename of the image resource to load.
+
+ :rtype: `Texture`
+ """
+ self._require_index()
+ if name in self._cached_textures:
+ return self._cached_textures[name]
+
+ file = self.file(name)
+ texture = pyglet.image.load(name, file=file).get_texture()
+ self._cached_textures[name] = texture
+ return texture
+
+ def html(self, name):
+ """Load an HTML document.
+
+ :Parameters:
+ `name` : str
+ Filename of the HTML resource to load.
+
+ :rtype: `FormattedDocument`
+ """
+ self._require_index()
+ file = self.file(name)
+ return pyglet.text.load(name, file, 'text/html')
+
+ def attributed(self, name):
+ """Load an attributed text document.
+
+ See `pyglet.text.formats.attributed` for details on this format.
+
+ :Parameters:
+ `name` : str
+ Filename of the attribute text resource to load.
+
+ :rtype: `FormattedDocument`
+ """
+ self._require_index()
+ file = self.file(name)
+ return pyglet.text.load(name, file, 'text/vnd.pyglet-attributed')
+
+ def text(self, name):
+ """Load a plain text document.
+
+ :Parameters:
+ `name` : str
+ Filename of the plain text resource to load.
+
+ :rtype: `UnformattedDocument`
+ """
+ self._require_index()
+ file = self.file(name)
+ return pyglet.text.load(name, file, 'text/plain')
+
+ def get_cached_texture_names(self):
+ """Get the names of textures currently cached.
+
+ :rtype: list of str
+ """
+ self._require_index()
+ return list(self._cached_textures.keys())
+
+
+#: Default resource search path.
+#:
+#: Locations in the search path are searched in order and are always
+#: case-sensitive. After changing the path you must call `reindex`.
+#:
+#: See the module documentation for details on the path format.
+#:
+#: :type: list of str
+path = []
+
+
+class _DefaultLoader(Loader):
+
+ @property
+ def path(self):
+ return path
+
+ @path.setter
+ def path(self, value):
+ global path
+ path = value
+
+
+_default_loader = _DefaultLoader()
+reindex = _default_loader.reindex
+file = _default_loader.file
+location = _default_loader.location
+add_font = _default_loader.add_font
+image = _default_loader.image
+animation = _default_loader.animation
+get_cached_image_names = _default_loader.get_cached_image_names
+get_cached_animation_names = _default_loader.get_cached_animation_names
+get_texture_bins = _default_loader.get_texture_bins
+media = _default_loader.media
+texture = _default_loader.texture
+html = _default_loader.html
+attributed = _default_loader.attributed
+text = _default_loader.text
+get_cached_texture_names = _default_loader.get_cached_texture_names
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/sprite.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/sprite.py
new file mode 100644
index 0000000..40c4b67
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/sprite.py
@@ -0,0 +1,706 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+"""Display positioned, scaled and rotated images.
+
+A sprite is an instance of an image displayed on-screen. Multiple sprites can
+display the same image at different positions on the screen. Sprites can also
+be scaled larger or smaller, rotated at any angle and drawn at a fractional
+opacity.
+
+The following complete example loads a ``"ball.png"`` image and creates a
+sprite for that image. The sprite is then drawn in the window's
+draw event handler::
+
+ import pyglet
+
+ ball_image = pyglet.image.load('ball.png')
+ ball = pyglet.sprite.Sprite(ball_image, x=50, y=50)
+
+ window = pyglet.window.Window()
+
+ @window.event
+ def on_draw():
+ ball.draw()
+
+ pyglet.app.run()
+
+The sprite can be moved by modifying the :py:attr:`~pyglet.sprite.Sprite.x` and
+:py:attr:`~pyglet.sprite.Sprite.y` properties. Other
+properties determine the sprite's :py:attr:`~pyglet.sprite.Sprite.rotation`,
+:py:attr:`~pyglet.sprite.Sprite.scale` and
+:py:attr:`~pyglet.sprite.Sprite.opacity`.
+
+By default sprite coordinates are restricted to integer values to avoid
+sub-pixel artifacts. If you require to use floats, for example for smoother
+animations, you can set the ``subpixel`` parameter to ``True`` when creating
+the sprite (:since: pyglet 1.2).
+
+The sprite's positioning, rotation and scaling all honor the original
+image's anchor (:py:attr:`~pyglet.image.AbstractImage.anchor_x`,
+:py:attr:`~pyglet.image.AbstractImage.anchor_y`).
+
+
+Drawing multiple sprites
+========================
+
+Sprites can be "batched" together and drawn at once more quickly than if each
+of their ``draw`` methods were called individually. The following example
+creates one hundred ball sprites and adds each of them to a :py:class:`~pyglet.graphics.Batch`. The
+entire batch of sprites is then drawn in one call::
+
+ batch = pyglet.graphics.Batch()
+
+ ball_sprites = []
+ for i in range(100):
+ x, y = i * 10, 50
+ ball_sprites.append(pyglet.sprite.Sprite(ball_image, x, y, batch=batch))
+
+ @window.event
+ def on_draw():
+ batch.draw()
+
+Sprites can be freely modified in any way even after being added to a batch,
+however a sprite can belong to at most one batch. See the documentation for
+:py:mod:`pyglet.graphics` for more details on batched rendering, and grouping of
+sprites within batches.
+
+.. versionadded:: 1.1
+"""
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import math
+import sys
+import warnings
+
+from pyglet.gl import *
+from pyglet import clock
+from pyglet import event
+from pyglet import graphics
+from pyglet import image
+
+_is_epydoc = hasattr(sys, 'is_epydoc') and sys.is_epydoc
+
+
+class SpriteGroup(graphics.Group):
+ """Shared sprite rendering group.
+
+ The group is automatically coalesced with other sprite groups sharing the
+ same parent group, texture and blend parameters.
+ """
+
+ def __init__(self, texture, blend_src, blend_dest, parent=None):
+ """Create a sprite group.
+
+ The group is created internally within :py:class:`~pyglet.sprite.Sprite`; applications usually
+ do not need to explicitly create it.
+
+ :Parameters:
+ `texture` : `~pyglet.image.Texture`
+ The (top-level) texture containing the sprite image.
+ `blend_src` : int
+ OpenGL blend source mode; for example,
+ ``GL_SRC_ALPHA``.
+ `blend_dest` : int
+ OpenGL blend destination mode; for example,
+ ``GL_ONE_MINUS_SRC_ALPHA``.
+ `parent` : `~pyglet.graphics.Group`
+ Optional parent group.
+ """
+ super(SpriteGroup, self).__init__(parent)
+ self.texture = texture
+ self.blend_src = blend_src
+ self.blend_dest = blend_dest
+
+ def set_state(self):
+ glEnable(self.texture.target)
+ glBindTexture(self.texture.target, self.texture.id)
+
+ glPushAttrib(GL_COLOR_BUFFER_BIT)
+ glEnable(GL_BLEND)
+ glBlendFunc(self.blend_src, self.blend_dest)
+
+ def unset_state(self):
+ glPopAttrib()
+ glDisable(self.texture.target)
+
+ def __repr__(self):
+ return '%s(%r)' % (self.__class__.__name__, self.texture)
+
+ def __eq__(self, other):
+ return (other.__class__ is self.__class__ and
+ self.parent is other.parent and
+ self.texture.target == other.texture.target and
+ self.texture.id == other.texture.id and
+ self.blend_src == other.blend_src and
+ self.blend_dest == other.blend_dest)
+
+ def __hash__(self):
+ return hash((id(self.parent),
+ self.texture.id, self.texture.target,
+ self.blend_src, self.blend_dest))
+
+
+class Sprite(event.EventDispatcher):
+ """Instance of an on-screen image.
+
+ See the module documentation for usage.
+ """
+
+ _batch = None
+ _animation = None
+ _rotation = 0
+ _opacity = 255
+ _rgb = (255, 255, 255)
+ _scale = 1.0
+ _scale_x = 1.0
+ _scale_y = 1.0
+ _visible = True
+ _vertex_list = None
+
+ def __init__(self,
+ img, x=0, y=0,
+ blend_src=GL_SRC_ALPHA,
+ blend_dest=GL_ONE_MINUS_SRC_ALPHA,
+ batch=None,
+ group=None,
+ usage='dynamic',
+ subpixel=False):
+ """Create a sprite.
+
+ :Parameters:
+ `img` : `~pyglet.image.AbstractImage` or `~pyglet.image.Animation`
+ Image or animation to display.
+ `x` : int
+ X coordinate of the sprite.
+ `y` : int
+ Y coordinate of the sprite.
+ `blend_src` : int
+ OpenGL blend source mode. The default is suitable for
+ compositing sprites drawn from back-to-front.
+ `blend_dest` : int
+ OpenGL blend destination mode. The default is suitable for
+ compositing sprites drawn from back-to-front.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional batch to add the sprite to.
+ `group` : `~pyglet.graphics.Group`
+ Optional parent group of the sprite.
+ `usage` : str
+ Vertex buffer object usage hint, one of ``"none"``,
+ ``"stream"``, ``"dynamic"`` (default) or ``"static"``. Applies
+ only to vertex data.
+ `subpixel` : bool
+ Allow floating-point coordinates for the sprite. By default,
+ coordinates are restricted to integer values.
+ """
+ if batch is not None:
+ self._batch = batch
+
+ self._x = x
+ self._y = y
+
+ if isinstance(img, image.Animation):
+ self._animation = img
+ self._frame_index = 0
+ self._texture = img.frames[0].image.get_texture()
+ self._next_dt = img.frames[0].duration
+ if self._next_dt:
+ clock.schedule_once(self._animate, self._next_dt)
+ else:
+ self._texture = img.get_texture()
+
+ self._group = SpriteGroup(self._texture, blend_src, blend_dest, group)
+ self._usage = usage
+ self._subpixel = subpixel
+ self._create_vertex_list()
+
+ def __del__(self):
+ try:
+ if self._vertex_list is not None:
+ self._vertex_list.delete()
+ except:
+ pass
+
+ def delete(self):
+ """Force immediate removal of the sprite from video memory.
+
+ This is often necessary when using batches, as the Python garbage
+ collector will not necessarily call the finalizer as soon as the
+ sprite is garbage.
+ """
+ if self._animation:
+ clock.unschedule(self._animate)
+ self._vertex_list.delete()
+ self._vertex_list = None
+ self._texture = None
+
+ # Easy way to break circular reference, speeds up GC
+ self._group = None
+
+ def _animate(self, dt):
+ self._frame_index += 1
+ if self._frame_index >= len(self._animation.frames):
+ self._frame_index = 0
+ self.dispatch_event('on_animation_end')
+ if self._vertex_list is None:
+ return # Deleted in event handler.
+
+ frame = self._animation.frames[self._frame_index]
+ self._set_texture(frame.image.get_texture())
+
+ if frame.duration is not None:
+ duration = frame.duration - (self._next_dt - dt)
+ duration = min(max(0, duration), frame.duration)
+ clock.schedule_once(self._animate, duration)
+ self._next_dt = duration
+ else:
+ self.dispatch_event('on_animation_end')
+
+ @property
+ def batch(self):
+ """Graphics batch.
+
+ The sprite can be migrated from one batch to another, or removed from
+ its batch (for individual drawing). Note that this can be an expensive
+ operation.
+
+ :type: :py:class:`pyglet.graphics.Batch`
+ """
+ return self._batch
+
+ @batch.setter
+ def batch(self, batch):
+ if self._batch == batch:
+ return
+
+ if batch is not None and self._batch is not None:
+ self._batch.migrate(self._vertex_list, GL_QUADS, self._group, batch)
+ self._batch = batch
+ else:
+ self._vertex_list.delete()
+ self._batch = batch
+ self._create_vertex_list()
+
+ @property
+ def group(self):
+ """Parent graphics group.
+
+ The sprite can change its rendering group, however this can be an
+ expensive operation.
+
+ :type: :py:class:`pyglet.graphics.Group`
+ """
+ return self._group.parent
+
+ @group.setter
+ def group(self, group):
+ if self._group.parent == group:
+ return
+ self._group = SpriteGroup(self._texture,
+ self._group.blend_src,
+ self._group.blend_dest,
+ group)
+ if self._batch is not None:
+ self._batch.migrate(self._vertex_list, GL_QUADS, self._group,
+ self._batch)
+
+ @property
+ def image(self):
+ """Image or animation to display.
+
+ :type: :py:class:`~pyglet.image.AbstractImage` or
+ :py:class:`~pyglet.image.Animation`
+ """
+ if self._animation:
+ return self._animation
+ return self._texture
+
+ @image.setter
+ def image(self, img):
+ if self._animation is not None:
+ clock.unschedule(self._animate)
+ self._animation = None
+
+ if isinstance(img, image.Animation):
+ self._animation = img
+ self._frame_index = 0
+ self._set_texture(img.frames[0].image.get_texture())
+ self._next_dt = img.frames[0].duration
+ if self._next_dt:
+ clock.schedule_once(self._animate, self._next_dt)
+ else:
+ self._set_texture(img.get_texture())
+ self._update_position()
+
+ def _set_texture(self, texture):
+ if texture.id is not self._texture.id:
+ self._group = SpriteGroup(texture,
+ self._group.blend_src,
+ self._group.blend_dest,
+ self._group.parent)
+ if self._batch is None:
+ self._vertex_list.tex_coords[:] = texture.tex_coords
+ else:
+ self._vertex_list.delete()
+ self._texture = texture
+ self._create_vertex_list()
+ else:
+ self._vertex_list.tex_coords[:] = texture.tex_coords
+ self._texture = texture
+
+ def _create_vertex_list(self):
+ if self._subpixel:
+ vertex_format = 'v2f/%s' % self._usage
+ else:
+ vertex_format = 'v2i/%s' % self._usage
+ if self._batch is None:
+ self._vertex_list = graphics.vertex_list(4, vertex_format,
+ 'c4B', ('t3f', self._texture.tex_coords))
+ else:
+ self._vertex_list = self._batch.add(4, GL_QUADS, self._group,
+ vertex_format, 'c4B', ('t3f', self._texture.tex_coords))
+ self._update_position()
+ self._update_color()
+
+ def _update_position(self):
+ img = self._texture
+ scale_x = self._scale * self.scale_x
+ scale_y = self._scale * self.scale_y
+ if not self._visible:
+ vertices = (0, 0, 0, 0, 0, 0, 0, 0)
+ elif self._rotation:
+ x1 = -img.anchor_x * scale_x
+ y1 = -img.anchor_y * scale_y
+ x2 = x1 + img.width * scale_x
+ y2 = y1 + img.height * scale_y
+ x = self._x
+ y = self._y
+
+ r = -math.radians(self._rotation)
+ cr = math.cos(r)
+ sr = math.sin(r)
+ ax = x1 * cr - y1 * sr + x
+ ay = x1 * sr + y1 * cr + y
+ bx = x2 * cr - y1 * sr + x
+ by = x2 * sr + y1 * cr + y
+ cx = x2 * cr - y2 * sr + x
+ cy = x2 * sr + y2 * cr + y
+ dx = x1 * cr - y2 * sr + x
+ dy = x1 * sr + y2 * cr + y
+ vertices = (ax, ay, bx, by, cx, cy, dx, dy)
+ elif scale_x != 1.0 or scale_y != 1.0:
+ x1 = self._x - img.anchor_x * scale_x
+ y1 = self._y - img.anchor_y * scale_y
+ x2 = x1 + img.width * scale_x
+ y2 = y1 + img.height * scale_y
+ vertices = (x1, y1, x2, y1, x2, y2, x1, y2)
+ else:
+ x1 = self._x - img.anchor_x
+ y1 = self._y - img.anchor_y
+ x2 = x1 + img.width
+ y2 = y1 + img.height
+ vertices = (x1, y1, x2, y1, x2, y2, x1, y2)
+ if not self._subpixel:
+ vertices = (int(vertices[0]), int(vertices[1]),
+ int(vertices[2]), int(vertices[3]),
+ int(vertices[4]), int(vertices[5]),
+ int(vertices[6]), int(vertices[7]))
+ self._vertex_list.vertices[:] = vertices
+
+ def _update_color(self):
+ r, g, b = self._rgb
+ self._vertex_list.colors[:] = [r, g, b, int(self._opacity)] * 4
+
+ @property
+ def position(self):
+ """The (x, y) coordinates of the sprite, as a tuple.
+
+ :Parameters:
+ `x` : int
+ X coordinate of the sprite.
+ `y` : int
+ Y coordinate of the sprite.
+ """
+ return self._x, self._y
+
+ @position.setter
+ def position(self, pos):
+ self._x, self._y = pos
+ self._update_position()
+
+ def set_position(self, x, y):
+ """Set the X and Y coordinates of the sprite simultaneously.
+
+ :Parameters:
+ `x` : int
+ X coordinate of the sprite.
+ `y` : int
+ Y coordinate of the sprite.
+
+ :deprecated: Set the X, Y coordinates via sprite.position instead.
+ """
+ self._x = x
+ self._y = y
+ self._update_position()
+ warnings.warn("Use position property instead.", DeprecationWarning)
+
+ @property
+ def x(self):
+ """X coordinate of the sprite.
+
+ :type: int
+ """
+ return self._x
+
+ @x.setter
+ def x(self, x):
+ self._x = x
+ self._update_position()
+
+ @property
+ def y(self):
+ """Y coordinate of the sprite.
+
+ :type: int
+ """
+ return self._y
+
+ @y.setter
+ def y(self, y):
+ self._y = y
+ self._update_position()
+
+ @property
+ def rotation(self):
+ """Clockwise rotation of the sprite, in degrees.
+
+ The sprite image will be rotated about its image's (anchor_x, anchor_y)
+ position.
+
+ :type: float
+ """
+ return self._rotation
+
+ @rotation.setter
+ def rotation(self, rotation):
+ self._rotation = rotation
+ self._update_position()
+
+ @property
+ def scale(self):
+ """Base Scaling factor.
+
+ A scaling factor of 1 (the default) has no effect. A scale of 2 will
+ draw the sprite at twice the native size of its image.
+
+ :type: float
+ """
+ return self._scale
+
+ @scale.setter
+ def scale(self, scale):
+ self._scale = scale
+ self._update_position()
+
+ @property
+ def scale_x(self):
+ """Horizontal scaling factor.
+
+ A scaling factor of 1 (the default) has no effect. A scale of 2 will
+ draw the sprite at twice the native width of its image.
+
+ :type: float
+ """
+ return self._scale_x
+
+ @scale_x.setter
+ def scale_x(self, scale_x):
+ self._scale_x = scale_x
+ self._update_position()
+
+ @property
+ def scale_y(self):
+ """Vertical scaling factor.
+
+ A scaling factor of 1 (the default) has no effect. A scale of 2 will
+ draw the sprite at twice the native height of its image.
+
+ :type: float
+ """
+ return self._scale_y
+
+ @scale_y.setter
+ def scale_y(self, scale_y):
+ self._scale_y = scale_y
+ self._update_position()
+
+ def update(self, x=None, y=None, rotation=None, scale=None, scale_x=None, scale_y=None):
+ """Simultaneously change the position, rotation or scale.
+
+ This method is provided for performance. In cases where
+ multiple Sprite attributes need to be updated at the same
+ time, it is more efficent to update them together using
+ the update method, rather than modifying them one by one.
+
+ :Parameters:
+ `x` : int
+ X coordinate of the sprite.
+ `y` : int
+ Y coordinate of the sprite.
+ `rotation` : float
+ Clockwise rotation of the sprite, in degrees.
+ `scale` : float
+ Scaling factor.
+ `scale_x` : float
+ Horizontal scaling factor.
+ `scale_y` : float
+ Vertical scaling factor.
+ """
+ if x is not None:
+ self._x = x
+ if y is not None:
+ self._y = y
+ if rotation is not None:
+ self._rotation = rotation
+ if scale is not None:
+ self._scale = scale
+ if scale_x is not None:
+ self._scale_x = scale_x
+ if scale_y is not None:
+ self._scale_y = scale_y
+ self._update_position()
+
+ @property
+ def width(self):
+ """Scaled width of the sprite.
+
+ Read-only. Invariant under rotation.
+
+ :type: int
+ """
+ if self._subpixel:
+ return self._texture.width * abs(self._scale_x) * abs(self._scale)
+ else:
+ return int(self._texture.width * abs(self._scale_x) * abs(self._scale))
+
+ @property
+ def height(self):
+ """Scaled height of the sprite.
+
+ Read-only. Invariant under rotation.
+
+ :type: int
+ """
+ if self._subpixel:
+ return self._texture.height * abs(self._scale_y) * abs(self._scale)
+ else:
+ return int(self._texture.height * abs(self._scale_y) * abs(self._scale))
+
+ @property
+ def opacity(self):
+ """Blend opacity.
+
+ This property sets the alpha component of the colour of the sprite's
+ vertices. With the default blend mode (see the constructor), this
+ allows the sprite to be drawn with fractional opacity, blending with the
+ background.
+
+ An opacity of 255 (the default) has no effect. An opacity of 128 will
+ make the sprite appear translucent.
+
+ :type: int
+ """
+ return self._opacity
+
+ @opacity.setter
+ def opacity(self, opacity):
+ self._opacity = opacity
+ self._update_color()
+
+ @property
+ def color(self):
+ """Blend color.
+
+ This property sets the color of the sprite's vertices. This allows the
+ sprite to be drawn with a color tint.
+
+ The color is specified as an RGB tuple of integers '(red, green, blue)'.
+ Each color component must be in the range 0 (dark) to 255 (saturated).
+
+ :type: (int, int, int)
+ """
+ return self._rgb
+
+ @color.setter
+ def color(self, rgb):
+ self._rgb = list(map(int, rgb))
+ self._update_color()
+
+ @property
+ def visible(self):
+ """True if the sprite will be drawn.
+
+ :type: bool
+ """
+ return self._visible
+
+ @visible.setter
+ def visible(self, visible):
+ self._visible = visible
+ self._update_position()
+
+ def draw(self):
+ """Draw the sprite at its current position.
+
+ See the module documentation for hints on drawing multiple sprites
+ efficiently.
+ """
+ self._group.set_state_recursive()
+ self._vertex_list.draw(GL_QUADS)
+ self._group.unset_state_recursive()
+
+ if _is_epydoc:
+ def on_animation_end(self):
+ """The sprite animation reached the final frame.
+
+ The event is triggered only if the sprite has an animation, not an
+ image. For looping animations, the event is triggered each time
+ the animation loops.
+
+ :event:
+ """
+
+Sprite.register_event_type('on_animation_end')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/__init__.py
new file mode 100644
index 0000000..8de3eda
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/__init__.py
@@ -0,0 +1,527 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+# $Id: $
+
+"""Text formatting, layout and display.
+
+This module provides classes for loading styled documents from text files,
+HTML files and a pyglet-specific markup format. Documents can be styled with
+multiple fonts, colours, styles, text sizes, margins, paragraph alignments,
+and so on.
+
+Using the layout classes, documents can be laid out on a single line or
+word-wrapped to fit a rectangle. A layout can then be efficiently drawn in
+a window or updated incrementally (for example, to support interactive text
+editing).
+
+The label classes provide a simple interface for the common case where an
+application simply needs to display some text in a window.
+
+A plain text label can be created with::
+
+ label = pyglet.text.Label('Hello, world',
+ font_name='Times New Roman',
+ font_size=36,
+ x=10, y=10)
+
+Alternatively, a styled text label using HTML can be created with::
+
+ label = pyglet.text.HTMLLabel('Hello, world',
+ x=10, y=10)
+
+Either label can then be drawn at any time with::
+
+ label.draw()
+
+For details on the subset of HTML supported, see `pyglet.text.formats.html`.
+
+Refer to the Programming Guide for advanced usage of the document and layout
+classes, including interactive editing, embedding objects within documents and
+creating scrollable layouts.
+
+.. versionadded:: 1.1
+"""
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import os.path
+
+import pyglet
+from pyglet.text import layout, document, caret
+
+
+class DocumentDecodeException(Exception):
+ """An error occurred decoding document text."""
+ pass
+
+
+class DocumentDecoder(object):
+ """Abstract document decoder.
+ """
+
+ def decode(self, text, location=None):
+ """Decode document text.
+
+ :Parameters:
+ `text` : str
+ Text to decode
+ `location` : `Location`
+ Location to use as base path for additional resources
+ referenced within the document (for example, HTML images).
+
+ :rtype: `AbstractDocument`
+ """
+ raise NotImplementedError('abstract')
+
+
+def get_decoder(filename, mimetype=None):
+ """Get a document decoder for the given filename and MIME type.
+
+ If `mimetype` is omitted it is guessed from the filename extension.
+
+ The following MIME types are supported:
+
+ ``text/plain``
+ Plain text
+ ``text/html``
+ HTML 4 Transitional
+ ``text/vnd.pyglet-attributed``
+ Attributed text; see `pyglet.text.formats.attributed`
+
+ `DocumentDecodeException` is raised if another MIME type is given.
+
+ :Parameters:
+ `filename` : str
+ Filename to guess the MIME type from. If a MIME type is given,
+ the filename is ignored.
+ `mimetype` : str
+ MIME type to lookup, or ``None`` to guess the type from the
+ filename.
+
+ :rtype: `DocumentDecoder`
+ """
+ if mimetype is None:
+ _, ext = os.path.splitext(filename)
+ if ext.lower() in ('.htm', '.html', '.xhtml'):
+ mimetype = 'text/html'
+ else:
+ mimetype = 'text/plain'
+
+ if mimetype == 'text/plain':
+ from pyglet.text.formats import plaintext
+ return plaintext.PlainTextDecoder()
+ elif mimetype == 'text/html':
+ from pyglet.text.formats import html
+ return html.HTMLDecoder()
+ elif mimetype == 'text/vnd.pyglet-attributed':
+ from pyglet.text.formats import attributed
+ return attributed.AttributedTextDecoder()
+ else:
+ raise DocumentDecodeException('Unknown format "%s"' % mimetype)
+
+
+def load(filename, file=None, mimetype=None):
+ """Load a document from a file.
+
+ :Parameters:
+ `filename` : str
+ Filename of document to load.
+ `file` : file-like object
+ File object containing encoded data. If omitted, `filename` is
+ loaded from disk.
+ `mimetype` : str
+ MIME type of the document. If omitted, the filename extension is
+ used to guess a MIME type. See `get_decoder` for a list of
+ supported MIME types.
+
+ :rtype: `AbstractDocument`
+ """
+ decoder = get_decoder(filename, mimetype)
+ if not file:
+ with open(filename) as f:
+ file_contents = f.read()
+ else:
+ file_contents = file.read()
+ file.close()
+
+ if hasattr(file_contents, "decode"):
+ file_contents = file_contents.decode()
+
+ location = pyglet.resource.FileLocation(os.path.dirname(filename))
+ return decoder.decode(file_contents, location)
+
+
+def decode_html(text, location=None):
+ """Create a document directly from some HTML formatted text.
+
+ :Parameters:
+ `text` : str
+ HTML data to decode.
+ `location` : str
+ Location giving the base path for additional resources
+ referenced from the document (e.g., images).
+
+ :rtype: `FormattedDocument`
+ """
+ decoder = get_decoder(None, 'text/html')
+ return decoder.decode(text, location)
+
+
+def decode_attributed(text):
+ """Create a document directly from some attributed text.
+
+ See `pyglet.text.formats.attributed` for a description of attributed text.
+
+ :Parameters:
+ `text` : str
+ Attributed text to decode.
+
+ :rtype: `FormattedDocument`
+ """
+ decoder = get_decoder(None, 'text/vnd.pyglet-attributed')
+ return decoder.decode(text)
+
+
+def decode_text(text):
+ """Create a document directly from some plain text.
+
+ :Parameters:
+ `text` : str
+ Plain text to initialise the document with.
+
+ :rtype: `UnformattedDocument`
+ """
+ decoder = get_decoder(None, 'text/plain')
+ return decoder.decode(text)
+
+
+class DocumentLabel(layout.TextLayout):
+ """Base label class.
+
+ A label is a layout that exposes convenience methods for manipulating the
+ associated document.
+ """
+
+ def __init__(self, document=None,
+ x=0, y=0, width=None, height=None,
+ anchor_x='left', anchor_y='baseline',
+ multiline=False, dpi=None, batch=None, group=None):
+ """Create a label for a given document.
+
+ :Parameters:
+ `document` : `AbstractDocument`
+ Document to attach to the layout.
+ `x` : int
+ X coordinate of the label.
+ `y` : int
+ Y coordinate of the label.
+ `width` : int
+ Width of the label in pixels, or None
+ `height` : int
+ Height of the label in pixels, or None
+ `anchor_x` : str
+ Anchor point of the X coordinate: one of ``"left"``,
+ ``"center"`` or ``"right"``.
+ `anchor_y` : str
+ Anchor point of the Y coordinate: one of ``"bottom"``,
+ ``"baseline"``, ``"center"`` or ``"top"``.
+ `multiline` : bool
+ If True, the label will be word-wrapped and accept newline
+ characters. You must also set the width of the label.
+ `dpi` : float
+ Resolution of the fonts in this layout. Defaults to 96.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional graphics batch to add the label to.
+ `group` : `~pyglet.graphics.Group`
+ Optional graphics group to use.
+
+ """
+ super(DocumentLabel, self).__init__(document,
+ width=width, height=height,
+ multiline=multiline,
+ dpi=dpi, batch=batch, group=group)
+
+ self._x = x
+ self._y = y
+ self._anchor_x = anchor_x
+ self._anchor_y = anchor_y
+ self._update()
+
+ @property
+ def text(self):
+ """The text of the label.
+
+ :type: str
+ """
+ return self.document.text
+
+ @text.setter
+ def text(self, text):
+ self.document.text = text
+
+ @property
+ def color(self):
+ """Text color.
+
+ Color is a 4-tuple of RGBA components, each in range [0, 255].
+
+ :type: (int, int, int, int)
+ """
+ return self.document.get_style('color')
+
+ @color.setter
+ def color(self, color):
+ self.document.set_style(0, len(self.document.text),
+ {'color': color})
+
+ @property
+ def font_name(self):
+ """Font family name.
+
+ The font name, as passed to :py:func:`pyglet.font.load`. A list of names can
+ optionally be given: the first matching font will be used.
+
+ :type: str or list
+ """
+ return self.document.get_style('font_name')
+
+ @font_name.setter
+ def font_name(self, font_name):
+ self.document.set_style(0, len(self.document.text),
+ {'font_name': font_name})
+
+ @property
+ def font_size(self):
+ """Font size, in points.
+
+ :type: float
+ """
+ return self.document.get_style('font_size')
+
+ @font_size.setter
+ def font_size(self, font_size):
+ self.document.set_style(0, len(self.document.text),
+ {'font_size': font_size})
+
+ @property
+ def bold(self):
+ """Bold font style.
+
+ :type: bool
+ """
+ return self.document.get_style('bold')
+
+ @bold.setter
+ def bold(self, bold):
+ self.document.set_style(0, len(self.document.text),
+ {'bold': bold})
+
+ @property
+ def italic(self):
+ """Italic font style.
+
+ :type: bool
+ """
+ return self.document.get_style('italic')
+
+ @italic.setter
+ def italic(self, italic):
+ self.document.set_style(0, len(self.document.text),
+ {'italic': italic})
+
+ def get_style(self, name):
+ """Get a document style value by name.
+
+ If the document has more than one value of the named style,
+ `pyglet.text.document.STYLE_INDETERMINATE` is returned.
+
+ :Parameters:
+ `name` : str
+ Style name to query. See documentation for
+ `pyglet.text.layout` for known style names.
+
+ :rtype: object
+ """
+ return self.document.get_style_range(name, 0, len(self.document.text))
+
+ def set_style(self, name, value):
+ """Set a document style value by name over the whole document.
+
+ :Parameters:
+ `name` : str
+ Name of the style to set. See documentation for
+ `pyglet.text.layout` for known style names.
+ `value` : object
+ Value of the style.
+
+ """
+ self.document.set_style(0, len(self.document.text), {name: value})
+
+
+class Label(DocumentLabel):
+ """Plain text label.
+ """
+
+ def __init__(self, text='',
+ font_name=None, font_size=None, bold=False, italic=False,
+ color=(255, 255, 255, 255),
+ x=0, y=0, width=None, height=None,
+ anchor_x='left', anchor_y='baseline',
+ align='left',
+ multiline=False, dpi=None, batch=None, group=None):
+ """Create a plain text label.
+
+ :Parameters:
+ `text` : str
+ Text to display.
+ `font_name` : str or list
+ Font family name(s). If more than one name is given, the
+ first matching name is used.
+ `font_size` : float
+ Font size, in points.
+ `bold` : bool
+ Bold font style.
+ `italic` : bool
+ Italic font style.
+ `color` : (int, int, int, int)
+ Font colour, as RGBA components in range [0, 255].
+ `x` : int
+ X coordinate of the label.
+ `y` : int
+ Y coordinate of the label.
+ `width` : int
+ Width of the label in pixels, or None
+ `height` : int
+ Height of the label in pixels, or None
+ `anchor_x` : str
+ Anchor point of the X coordinate: one of ``"left"``,
+ ``"center"`` or ``"right"``.
+ `anchor_y` : str
+ Anchor point of the Y coordinate: one of ``"bottom"``,
+ ``"baseline"``, ``"center"`` or ``"top"``.
+ `align` : str
+ Horizontal alignment of text on a line, only applies if
+ a width is supplied. One of ``"left"``, ``"center"``
+ or ``"right"``.
+ `multiline` : bool
+ If True, the label will be word-wrapped and accept newline
+ characters. You must also set the width of the label.
+ `dpi` : float
+ Resolution of the fonts in this layout. Defaults to 96.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional graphics batch to add the label to.
+ `group` : `~pyglet.graphics.Group`
+ Optional graphics group to use.
+
+ """
+ document = decode_text(text)
+ super(Label, self).__init__(document, x, y, width, height,
+ anchor_x, anchor_y,
+ multiline, dpi, batch, group)
+
+ self.document.set_style(0, len(self.document.text), {
+ 'font_name': font_name,
+ 'font_size': font_size,
+ 'bold': bold,
+ 'italic': italic,
+ 'color': color,
+ 'align': align,
+ })
+
+
+class HTMLLabel(DocumentLabel):
+ """HTML formatted text label.
+
+ A subset of HTML 4.01 is supported. See `pyglet.text.formats.html` for
+ details.
+ """
+
+ def __init__(self, text='', location=None,
+ x=0, y=0, width=None, height=None,
+ anchor_x='left', anchor_y='baseline',
+ multiline=False, dpi=None, batch=None, group=None):
+ """Create a label with an HTML string.
+
+ :Parameters:
+ `text` : str
+ HTML formatted text to display.
+ `location` : `Location`
+ Location object for loading images referred to in the
+ document. By default, the working directory is used.
+ `x` : int
+ X coordinate of the label.
+ `y` : int
+ Y coordinate of the label.
+ `width` : int
+ Width of the label in pixels, or None
+ `height` : int
+ Height of the label in pixels, or None
+ `anchor_x` : str
+ Anchor point of the X coordinate: one of ``"left"``,
+ ``"center"`` or ``"right"``.
+ `anchor_y` : str
+ Anchor point of the Y coordinate: one of ``"bottom"``,
+ ``"baseline"``, ``"center"`` or ``"top"``.
+ `multiline` : bool
+ If True, the label will be word-wrapped and render paragraph
+ and line breaks. You must also set the width of the label.
+ `dpi` : float
+ Resolution of the fonts in this layout. Defaults to 96.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional graphics batch to add the label to.
+ `group` : `~pyglet.graphics.Group`
+ Optional graphics group to use.
+
+ """
+ self._text = text
+ self._location = location
+ document = decode_html(text, location)
+ super(HTMLLabel, self).__init__(document, x, y, width, height,
+ anchor_x, anchor_y,
+ multiline, dpi, batch, group)
+
+ @property
+ def text(self):
+ """HTML formatted text of the label.
+
+ :type: str
+ """
+ return self._text
+
+ @text.setter
+ def text(self, text):
+ self._text = text
+ self.document = decode_html(text, self._location)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/caret.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/caret.py
new file mode 100644
index 0000000..3993ff8
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/caret.py
@@ -0,0 +1,592 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+# $Id:$
+
+'''Provides keyboard and mouse editing procedures for text layout.
+
+Example usage::
+
+ from pyglet import window
+ from pyglet.text import layout, caret
+
+ my_window = window.Window(...)
+ my_layout = layout.IncrementalTextLayout(...)
+ my_caret = caret.Caret(my_layout)
+ my_window.push_handlers(my_caret)
+
+.. versionadded:: 1.1
+'''
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import re
+import time
+
+from pyglet import clock
+from pyglet import event
+from pyglet.window import key
+
+class Caret(object):
+ '''Visible text insertion marker for
+ `pyglet.text.layout.IncrementalTextLayout`.
+
+ The caret is drawn as a single vertical bar at the document `position`
+ on a text layout object. If `mark` is not None, it gives the unmoving
+ end of the current text selection. The visible text selection on the
+ layout is updated along with `mark` and `position`.
+
+ By default the layout's graphics batch is used, so the caret does not need
+ to be drawn explicitly. Even if a different graphics batch is supplied,
+ the caret will be correctly positioned and clipped within the layout.
+
+ Updates to the document (and so the layout) are automatically propagated
+ to the caret.
+
+ The caret object can be pushed onto a window event handler stack with
+ `Window.push_handlers`. The caret will respond correctly to keyboard,
+ text, mouse and activation events, including double- and triple-clicks.
+ If the text layout is being used alongside other graphical widgets, a
+ GUI toolkit will be needed to delegate keyboard and mouse events to the
+ appropriate widget. pyglet does not provide such a toolkit at this stage.
+ '''
+
+ _next_word_re = re.compile(r'(?<=\W)\w')
+ _previous_word_re = re.compile(r'(?<=\W)\w+\W*$')
+ _next_para_re = re.compile(r'\n', flags=re.DOTALL)
+ _previous_para_re = re.compile(r'\n', flags=re.DOTALL)
+
+ _position = 0
+
+ _active = True
+ _visible = True
+ _blink_visible = True
+ _click_count = 0
+ _click_time = 0
+
+ #: Blink period, in seconds.
+ PERIOD = 0.5
+
+ #: Pixels to scroll viewport per mouse scroll wheel movement. Defaults
+ #: to 12pt at 96dpi.
+ SCROLL_INCREMENT= 12 * 96 // 72
+
+ def __init__(self, layout, batch=None, color=(0, 0, 0)):
+ '''Create a caret for a layout.
+
+ By default the layout's batch is used, so the caret does not need to
+ be drawn explicitly.
+
+ :Parameters:
+ `layout` : `~pyglet.text.layout.TextLayout`
+ Layout to control.
+ `batch` : `~pyglet.graphics.Batch`
+ Graphics batch to add vertices to.
+ `color` : (int, int, int)
+ RGB tuple with components in range [0, 255].
+
+ '''
+ from pyglet import gl
+ self._layout = layout
+ if batch is None:
+ batch = layout.batch
+ r, g, b = color
+ colors = (r, g, b, 255, r, g, b, 255)
+ self._list = batch.add(2, gl.GL_LINES, layout.background_group,
+ 'v2f', ('c4B', colors))
+
+ self._ideal_x = None
+ self._ideal_line = None
+ self._next_attributes = {}
+
+ self.visible = True
+
+ layout.push_handlers(self)
+
+ def delete(self):
+ '''Remove the caret from its batch.
+
+ Also disconnects the caret from further layout events.
+ '''
+ self._list.delete()
+ self._layout.remove_handlers(self)
+
+ def _blink(self, dt):
+ if self.PERIOD:
+ self._blink_visible = not self._blink_visible
+ if self._visible and self._active and self._blink_visible:
+ alpha = 255
+ else:
+ alpha = 0
+ self._list.colors[3] = alpha
+ self._list.colors[7] = alpha
+
+ def _nudge(self):
+ self.visible = True
+
+ def _set_visible(self, visible):
+ self._visible = visible
+ clock.unschedule(self._blink)
+ if visible and self._active and self.PERIOD:
+ clock.schedule_interval(self._blink, self.PERIOD)
+ self._blink_visible = False # flipped immediately by next blink
+ self._blink(0)
+
+ def _get_visible(self):
+ return self._visible
+
+ visible = property(_get_visible, _set_visible,
+ doc='''Caret visibility.
+
+ The caret may be hidden despite this property due to the periodic blinking
+ or by `on_deactivate` if the event handler is attached to a window.
+
+ :type: bool
+ ''')
+
+ def _set_color(self, color):
+ self._list.colors[:3] = color
+ self._list.colors[4:7] = color
+
+ def _get_color(self):
+ return self._list.colors[:3]
+
+ color = property(_get_color, _set_color,
+ doc='''Caret color.
+
+ The default caret color is ``[0, 0, 0]`` (black). Each RGB color
+ component is in the range 0 to 255.
+
+ :type: (int, int, int)
+ ''')
+
+ def _set_position(self, index):
+ self._position = index
+ self._next_attributes.clear()
+ self._update()
+
+ def _get_position(self):
+ return self._position
+
+ position = property(_get_position, _set_position,
+ doc='''Position of caret within document.
+
+ :type: int
+ ''')
+
+ _mark = None
+ def _set_mark(self, mark):
+ self._mark = mark
+ self._update(line=self._ideal_line)
+ if mark is None:
+ self._layout.set_selection(0, 0)
+
+ def _get_mark(self):
+ return self._mark
+
+ mark = property(_get_mark, _set_mark,
+ doc='''Position of immovable end of text selection within
+ document.
+
+ An interactive text selection is determined by its immovable end (the
+ caret's position when a mouse drag begins) and the caret's position, which
+ moves interactively by mouse and keyboard input.
+
+ This property is ``None`` when there is no selection.
+
+ :type: int
+ ''')
+
+ def _set_line(self, line):
+ if self._ideal_x is None:
+ self._ideal_x, _ = \
+ self._layout.get_point_from_position(self._position)
+ self._position = \
+ self._layout.get_position_on_line(line, self._ideal_x)
+ self._update(line=line, update_ideal_x=False)
+
+ def _get_line(self):
+ if self._ideal_line is not None:
+ return self._ideal_line
+ else:
+ return self._layout.get_line_from_position(self._position)
+
+ line = property(_get_line, _set_line,
+ doc='''Index of line containing the caret's position.
+
+ When set, `position` is modified to place the caret on requested line
+ while maintaining the closest possible X offset.
+
+ :type: int
+ ''')
+
+ def get_style(self, attribute):
+ '''Get the document's named style at the caret's current position.
+
+ If there is a text selection and the style varies over the selection,
+ `pyglet.text.document.STYLE_INDETERMINATE` is returned.
+
+ :Parameters:
+ `attribute` : str
+ Name of style attribute to retrieve. See
+ `pyglet.text.document` for a list of recognised attribute
+ names.
+
+ :rtype: object
+ '''
+ if self._mark is None or self._mark == self._position:
+ try:
+ return self._next_attributes[attribute]
+ except KeyError:
+ return self._layout.document.get_style(attribute,
+ self._position)
+
+ start = min(self._position, self._mark)
+ end = max(self._position, self._mark)
+ return self._layout.document.get_style_range(attribute, start, end)
+
+ def set_style(self, attributes):
+ '''Set the document style at the caret's current position.
+
+ If there is a text selection the style is modified immediately.
+ Otherwise, the next text that is entered before the position is
+ modified will take on the given style.
+
+ :Parameters:
+ `attributes` : dict
+ Dict mapping attribute names to style values. See
+ `pyglet.text.document` for a list of recognised attribute
+ names.
+
+ '''
+
+ if self._mark is None or self._mark == self._position:
+ self._next_attributes.update(attributes)
+ return
+
+ start = min(self._position, self._mark)
+ end = max(self._position, self._mark)
+ self._layout.document.set_style(start, end, attributes)
+
+ def _delete_selection(self):
+ start = min(self._mark, self._position)
+ end = max(self._mark, self._position)
+ self._position = start
+ self._mark = None
+ self._layout.document.delete_text(start, end)
+ self._layout.set_selection(0, 0)
+
+ def move_to_point(self, x, y):
+ '''Move the caret close to the given window coordinate.
+
+ The `mark` will be reset to ``None``.
+
+ :Parameters:
+ `x` : int
+ X coordinate.
+ `y` : int
+ Y coordinate.
+
+ '''
+ line = self._layout.get_line_from_point(x, y)
+ self._mark = None
+ self._layout.set_selection(0, 0)
+ self._position = self._layout.get_position_on_line(line, x)
+ self._update(line=line)
+ self._next_attributes.clear()
+
+ def select_to_point(self, x, y):
+ '''Move the caret close to the given window coordinate while
+ maintaining the `mark`.
+
+ :Parameters:
+ `x` : int
+ X coordinate.
+ `y` : int
+ Y coordinate.
+
+ '''
+ line = self._layout.get_line_from_point(x, y)
+ self._position = self._layout.get_position_on_line(line, x)
+ self._update(line=line)
+ self._next_attributes.clear()
+
+ def select_word(self, x, y):
+ '''Select the word at the given window coordinate.
+
+ :Parameters:
+ `x` : int
+ X coordinate.
+ `y` : int
+ Y coordinate.
+
+ '''
+ line = self._layout.get_line_from_point(x, y)
+ p = self._layout.get_position_on_line(line, x)
+ m1 = self._previous_word_re.search(self._layout.document.text,
+ 0, p+1)
+ if not m1:
+ m1 = 0
+ else:
+ m1 = m1.start()
+ self.mark = m1
+
+ m2 = self._next_word_re.search(self._layout.document.text, p)
+ if not m2:
+ m2 = len(self._layout.document.text)
+ else:
+ m2 = m2.start()
+ self._position = m2
+ self._update(line=line)
+ self._next_attributes.clear()
+
+ def select_paragraph(self, x, y):
+ '''Select the paragraph at the given window coordinate.
+
+ :Parameters:
+ `x` : int
+ X coordinate.
+ `y` : int
+ Y coordinate.
+
+ '''
+ line = self._layout.get_line_from_point(x, y)
+ p = self._layout.get_position_on_line(line, x)
+ self.mark = self._layout.document.get_paragraph_start(p)
+ self._position = self._layout.document.get_paragraph_end(p)
+ self._update(line=line)
+ self._next_attributes.clear()
+
+ def _update(self, line=None, update_ideal_x=True):
+ if line is None:
+ line = self._layout.get_line_from_position(self._position)
+ self._ideal_line = None
+ else:
+ self._ideal_line = line
+ x, y = self._layout.get_point_from_position(self._position, line)
+ if update_ideal_x:
+ self._ideal_x = x
+
+ x -= self._layout.top_group.translate_x
+ y -= self._layout.top_group.translate_y
+ font = self._layout.document.get_font(max(0, self._position - 1))
+ self._list.vertices[:] = [x, y + font.descent, x, y + font.ascent]
+
+ if self._mark is not None:
+ self._layout.set_selection(min(self._position, self._mark),
+ max(self._position, self._mark))
+
+ self._layout.ensure_line_visible(line)
+ self._layout.ensure_x_visible(x)
+
+ def on_layout_update(self):
+ if self.position > len(self._layout.document.text):
+ self.position = len(self._layout.document.text)
+ self._update()
+
+ def on_text(self, text):
+ '''Handler for the `pyglet.window.Window.on_text` event.
+
+ Caret keyboard handlers assume the layout always has keyboard focus.
+ GUI toolkits should filter keyboard and text events by widget focus
+ before invoking this handler.
+ '''
+ if self._mark is not None:
+ self._delete_selection()
+
+ text = text.replace('\r', '\n')
+ pos = self._position
+ self._position += len(text)
+ self._layout.document.insert_text(pos, text, self._next_attributes)
+ self._nudge()
+ return event.EVENT_HANDLED
+
+ def on_text_motion(self, motion, select=False):
+ '''Handler for the `pyglet.window.Window.on_text_motion` event.
+
+ Caret keyboard handlers assume the layout always has keyboard focus.
+ GUI toolkits should filter keyboard and text events by widget focus
+ before invoking this handler.
+ '''
+ if motion == key.MOTION_BACKSPACE:
+ if self.mark is not None:
+ self._delete_selection()
+ elif self._position > 0:
+ self._position -= 1
+ self._layout.document.delete_text(
+ self._position, self._position + 1)
+ elif motion == key.MOTION_DELETE:
+ if self.mark is not None:
+ self._delete_selection()
+ elif self._position < len(self._layout.document.text):
+ self._layout.document.delete_text(
+ self._position, self._position + 1)
+ elif self._mark is not None and not select:
+ self._mark = None
+ self._layout.set_selection(0, 0)
+
+ if motion == key.MOTION_LEFT:
+ self.position = max(0, self.position - 1)
+ elif motion == key.MOTION_RIGHT:
+ self.position = min(len(self._layout.document.text),
+ self.position + 1)
+ elif motion == key.MOTION_UP:
+ self.line = max(0, self.line - 1)
+ elif motion == key.MOTION_DOWN:
+ line = self.line
+ if line < self._layout.get_line_count() - 1:
+ self.line = line + 1
+ elif motion == key.MOTION_BEGINNING_OF_LINE:
+ self.position = self._layout.get_position_from_line(self.line)
+ elif motion == key.MOTION_END_OF_LINE:
+ line = self.line
+ if line < self._layout.get_line_count() - 1:
+ self._position = \
+ self._layout.get_position_from_line(line + 1) - 1
+ self._update(line)
+ else:
+ self.position = len(self._layout.document.text)
+ elif motion == key.MOTION_BEGINNING_OF_FILE:
+ self.position = 0
+ elif motion == key.MOTION_END_OF_FILE:
+ self.position = len(self._layout.document.text)
+ elif motion == key.MOTION_NEXT_WORD:
+ pos = self._position + 1
+ m = self._next_word_re.search(self._layout.document.text, pos)
+ if not m:
+ self.position = len(self._layout.document.text)
+ else:
+ self.position = m.start()
+ elif motion == key.MOTION_PREVIOUS_WORD:
+ pos = self._position
+ m = self._previous_word_re.search(self._layout.document.text,
+ 0, pos)
+ if not m:
+ self.position = 0
+ else:
+ self.position = m.start()
+
+ self._next_attributes.clear()
+ self._nudge()
+ return event.EVENT_HANDLED
+
+ def on_text_motion_select(self, motion):
+ '''Handler for the `pyglet.window.Window.on_text_motion_select` event.
+
+ Caret keyboard handlers assume the layout always has keyboard focus.
+ GUI toolkits should filter keyboard and text events by widget focus
+ before invoking this handler.
+ '''
+ if self.mark is None:
+ self.mark = self.position
+ self.on_text_motion(motion, True)
+ return event.EVENT_HANDLED
+
+ def on_mouse_scroll(self, x, y, scroll_x, scroll_y):
+ '''Handler for the `pyglet.window.Window.on_mouse_scroll` event.
+
+ Mouse handlers do not check the bounds of the coordinates: GUI
+ toolkits should filter events that do not intersect the layout
+ before invoking this handler.
+
+ The layout viewport is scrolled by `SCROLL_INCREMENT` pixels per
+ "click".
+ '''
+ self._layout.view_x -= scroll_x * self.SCROLL_INCREMENT
+ self._layout.view_y += scroll_y * self.SCROLL_INCREMENT
+ return event.EVENT_HANDLED
+
+ def on_mouse_press(self, x, y, button, modifiers):
+ '''Handler for the `pyglet.window.Window.on_mouse_press` event.
+
+ Mouse handlers do not check the bounds of the coordinates: GUI
+ toolkits should filter events that do not intersect the layout
+ before invoking this handler.
+
+ This handler keeps track of the number of mouse presses within
+ a short span of time and uses this to reconstruct double- and
+ triple-click events for selecting words and paragraphs. This
+ technique is not suitable when a GUI toolkit is in use, as the active
+ widget must also be tracked. Do not use this mouse handler if
+ a GUI toolkit is being used.
+ '''
+ t = time.time()
+ if t - self._click_time < 0.25:
+ self._click_count += 1
+ else:
+ self._click_count = 1
+ self._click_time = time.time()
+
+ if self._click_count == 1:
+ self.move_to_point(x, y)
+ elif self._click_count == 2:
+ self.select_word(x, y)
+ elif self._click_count == 3:
+ self.select_paragraph(x, y)
+ self._click_count = 0
+
+ self._nudge()
+ return event.EVENT_HANDLED
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ '''Handler for the `pyglet.window.Window.on_mouse_drag` event.
+
+ Mouse handlers do not check the bounds of the coordinates: GUI
+ toolkits should filter events that do not intersect the layout
+ before invoking this handler.
+ '''
+ if self.mark is None:
+ self.mark = self.position
+ self.select_to_point(x, y)
+ self._nudge()
+ return event.EVENT_HANDLED
+
+ def on_activate(self):
+ '''Handler for the `pyglet.window.Window.on_activate` event.
+
+ The caret is hidden when the window is not active.
+ '''
+ self._active = True
+ self.visible = self._active
+ return event.EVENT_HANDLED
+
+ def on_deactivate(self):
+ '''Handler for the `pyglet.window.Window.on_deactivate` event.
+
+ The caret is hidden when the window is not active.
+ '''
+ self._active = False
+ self.visible = self._active
+ return event.EVENT_HANDLED
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/document.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/document.py
new file mode 100644
index 0000000..710006d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/document.py
@@ -0,0 +1,748 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+# $Id:$
+
+"""Formatted and unformatted document interfaces used by text layout.
+
+Abstract representation
+=======================
+
+Styled text in pyglet is represented by one of the :py:class:`~pyglet.text.document.AbstractDocument` classes,
+which manage the state representation of text and style independently of how
+it is loaded or rendered.
+
+A document consists of the document text (a Unicode string) and a set of
+named style ranges. For example, consider the following (artificial)
+example::
+
+ 0 5 10 15 20
+ The cat sat on the mat.
+ +++++++ +++++++ "bold"
+ ++++++ "italic"
+
+If this example were to be rendered, "The cat" and "the mat" would be in bold,
+and "on the" in italics. Note that the second "the" is both bold and italic.
+
+The document styles recorded for this example would be ``"bold"`` over ranges
+(0-7, 15-22) and ``"italic"`` over range (12-18). Overlapping styles are
+permitted; unlike HTML and other structured markup, the ranges need not be
+nested.
+
+The document has no knowledge of the semantics of ``"bold"`` or ``"italic"``,
+it stores only the style names. The pyglet layout classes give meaning to
+these style names in the way they are rendered; but you are also free to
+invent your own style names (which will be ignored by the layout classes).
+This can be useful to tag areas of interest in a document, or maintain
+references back to the source material.
+
+As well as text, the document can contain arbitrary elements represented by
+:py:class:`~pyglet.text.document.InlineElement`. An inline element behaves like a single character in the
+documented, but can be rendered by the application.
+
+Paragraph breaks
+================
+
+Paragraph breaks are marked with a "newline" character (U+0010). The Unicode
+paragraph break (U+2029) can also be used.
+
+Line breaks (U+2028) can be used to force a line break within a paragraph.
+
+See Unicode recommendation UTR #13 for more information:
+http://unicode.org/reports/tr13/tr13-5.html.
+
+Document classes
+================
+
+Any class implementing :py:class:`~pyglet.text.document.AbstractDocument` provides an interface to a
+document model as described above. In theory a structured document such as
+HTML or XML could export this model, though the classes provided by pyglet
+implement only unstructured documents.
+
+The :py:class:`~pyglet.text.document.UnformattedDocument` class assumes any styles set are set over the entire
+document. So, regardless of the range specified when setting a ``"bold"``
+style attribute, for example, the entire document will receive that style.
+
+The :py:class:`~pyglet.text.document.FormattedDocument` class implements the document model directly, using
+the `RunList` class to represent style runs efficiently.
+
+Style attributes
+================
+
+The following character style attribute names are recognised by pyglet:
+
+``font_name``
+ Font family name, as given to :py:func:`pyglet.font.load`.
+``font_size``
+ Font size, in points.
+``bold``
+ Boolean.
+``italic``
+ Boolean.
+``underline``
+ 4-tuple of ints in range (0, 255) giving RGBA underline color, or None
+ (default) for no underline.
+``kerning``
+ Additional space to insert between glyphs, in points. Defaults to 0.
+``baseline``
+ Offset of glyph baseline from line baseline, in points. Positive values
+ give a superscript, negative values give a subscript. Defaults to 0.
+``color``
+ 4-tuple of ints in range (0, 255) giving RGBA text color
+``background_color``
+ 4-tuple of ints in range (0, 255) giving RGBA text background color; or
+ ``None`` for no background fill.
+
+The following paragraph style attribute names are recognised by pyglet. Note
+that paragraph styles are handled no differently from character styles by the
+document: it is the application's responsibility to set the style over an
+entire paragraph, otherwise results are undefined.
+
+``align``
+ ``left`` (default), ``center`` or ``right``.
+``indent``
+ Additional horizontal space to insert before the first
+``leading``
+ Additional space to insert between consecutive lines within a paragraph,
+ in points. Defaults to 0.
+``line_spacing``
+ Distance between consecutive baselines in a paragraph, in points.
+ Defaults to ``None``, which automatically calculates the tightest line
+ spacing for each line based on the font ascent and descent.
+``margin_left``
+ Left paragraph margin, in pixels.
+``margin_right``
+ Right paragraph margin, in pixels.
+``margin_top``
+ Margin above paragraph, in pixels.
+``margin_bottom``
+ Margin below paragraph, in pixels. Adjacent margins do not collapse.
+``tab_stops``
+ List of horizontal tab stops, in pixels, measured from the left edge of
+ the text layout. Defaults to the empty list. When the tab stops
+ are exhausted, they implicitly continue at 50 pixel intervals.
+``wrap``
+ Boolean. If True (the default), text wraps within the width of the layout.
+
+Other attributes can be used to store additional style information within the
+document; it will be ignored by the built-in text classes.
+
+All style attributes (including those not present in a document) default to
+``None`` (including the so-called "boolean" styles listed above). The meaning
+of a ``None`` style is style- and application-dependent.
+
+.. versionadded:: 1.1
+"""
+from builtins import next
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import re
+import sys
+
+from pyglet import event
+from pyglet.text import runlist
+
+_is_epydoc = hasattr(sys, 'is_epydoc') and sys.is_epydoc
+
+#: The style attribute takes on multiple values in the document.
+STYLE_INDETERMINATE = 'indeterminate'
+
+
+class InlineElement(object):
+ """Arbitrary inline element positioned within a formatted document.
+
+ Elements behave like a single glyph in the document. They are
+ measured by their horizontal advance, ascent above the baseline, and
+ descent below the baseline.
+
+ The pyglet layout classes reserve space in the layout for elements and
+ call the element's methods to ensure they are rendered at the
+ appropriate position.
+
+ If the size of a element (any of the `advance`, `ascent`, or `descent`
+ instance variables) is modified it is the application's responsibility to
+ trigger a reflow of the appropriate area in the affected layouts. This
+ can be done by forcing a style change over the element's position.
+
+ :Ivariables:
+ `ascent` : int
+ Ascent of the element above the baseline, in pixels.
+ `descent` : int
+ Descent of the element below the baseline, in pixels.
+ Typically negative.
+ `advance` : int
+ Width of the element, in pixels.
+
+ """
+
+ def __init__(self, ascent, descent, advance):
+ self.ascent = ascent
+ self.descent = descent
+ self.advance = advance
+ self._position = None
+
+ position = property(lambda self: self._position,
+ doc="""Position of the element within the
+ document. Read-only.
+
+ :type: int
+ """)
+
+ def place(self, layout, x, y):
+ """Construct an instance of the element at the given coordinates.
+
+ Called when the element's position within a layout changes, either
+ due to the initial condition, changes in the document or changes in
+ the layout size.
+
+ It is the responsibility of the element to clip itself against
+ the layout boundaries, and position itself appropriately with respect
+ to the layout's position and viewport offset.
+
+ The `TextLayout.top_state` graphics state implements this transform
+ and clipping into window space.
+
+ :Parameters:
+ `layout` : `pyglet.text.layout.TextLayout`
+ The layout the element moved within.
+ `x` : int
+ Position of the left edge of the element, relative
+ to the left edge of the document, in pixels.
+ `y` : int
+ Position of the baseline, relative to the top edge of the
+ document, in pixels. Note that this is typically negative.
+
+ """
+ raise NotImplementedError('abstract')
+
+ def remove(self, layout):
+ """Remove this element from a layout.
+
+ The counterpart of `place`; called when the element is no longer
+ visible in the given layout.
+
+ :Parameters:
+ `layout` : `pyglet.text.layout.TextLayout`
+ The layout the element was removed from.
+
+ """
+ raise NotImplementedError('abstract')
+
+
+class AbstractDocument(event.EventDispatcher):
+ """Abstract document interface used by all :py:mod:`pyglet.text` classes.
+
+ This class can be overridden to interface pyglet with a third-party
+ document format. It may be easier to implement the document format in
+ terms of one of the supplied concrete classes :py:class:`~pyglet.text.document.FormattedDocument` or
+ :py:class:`~pyglet.text.document.UnformattedDocument`.
+ """
+ _previous_paragraph_re = re.compile(u'\n[^\n\u2029]*$')
+ _next_paragraph_re = re.compile(u'[\n\u2029]')
+
+ def __init__(self, text=''):
+ super(AbstractDocument, self).__init__()
+ self._text = u''
+ self._elements = []
+ if text:
+ self.insert_text(0, text)
+
+ @property
+ def text(self):
+ """Document text.
+
+ For efficient incremental updates, use the :py:func:`~pyglet.text.document.AbstractDocument.insert_text` and
+ :py:func:`~pyglet.text.document.AbstractDocument.delete_text` methods instead of replacing this property.
+
+ :type: str
+ """
+ return self._text
+
+ @text.setter
+ def text(self, text):
+ if text == self._text:
+ return
+ self.delete_text(0, len(self._text))
+ self.insert_text(0, text)
+
+ def get_paragraph_start(self, pos):
+ """Get the starting position of a paragraph.
+
+ :Parameters:
+ `pos` : int
+ Character position within paragraph.
+
+ :rtype: int
+ """
+ # Tricky special case where the $ in pattern matches before the \n at
+ # the end of the string instead of the end of the string.
+ if (self._text[:pos + 1].endswith('\n') or
+ self._text[:pos + 1].endswith(u'\u2029')):
+ return pos
+
+ m = self._previous_paragraph_re.search(self._text, 0, pos + 1)
+ if not m:
+ return 0
+ return m.start() + 1
+
+ def get_paragraph_end(self, pos):
+ """Get the end position of a paragraph.
+
+ :Parameters:
+ `pos` : int
+ Character position within paragraph.
+
+ :rtype: int
+ """
+ m = self._next_paragraph_re.search(self._text, pos)
+ if not m:
+ return len(self._text)
+ return m.start() + 1
+
+ def get_style_runs(self, attribute):
+ """Get a style iterator over the given style attribute.
+
+ :Parameters:
+ `attribute` : str
+ Name of style attribute to query.
+
+ :rtype: `AbstractRunIterator`
+ """
+ raise NotImplementedError('abstract')
+
+ def get_style(self, attribute, position=0):
+ """Get an attribute style at the given position.
+
+ :Parameters:
+ `attribute` : str
+ Name of style attribute to query.
+ `position` : int
+ Character position of document to query.
+
+ :return: The style set for the attribute at the given position.
+ """
+ raise NotImplementedError('abstract')
+
+ def get_style_range(self, attribute, start, end):
+ """Get an attribute style over the given range.
+
+ If the style varies over the range, `STYLE_INDETERMINATE` is returned.
+
+ :Parameters:
+ `attribute` : str
+ Name of style attribute to query.
+ `start` : int
+ Starting character position.
+ `end` : int
+ Ending character position (exclusive).
+
+ :return: The style set for the attribute over the given range, or
+ `STYLE_INDETERMINATE` if more than one value is set.
+ """
+ iterable = self.get_style_runs(attribute)
+ _, value_end, value = next(iterable.ranges(start, end))
+ if value_end < end:
+ return STYLE_INDETERMINATE
+ else:
+ return value
+
+ def get_font_runs(self, dpi=None):
+ """Get a style iterator over the `pyglet.font.Font` instances used in
+ the document.
+
+ The font instances are created on-demand by inspection of the
+ ``font_name``, ``font_size``, ``bold`` and ``italic`` style
+ attributes.
+
+ :Parameters:
+ `dpi` : float
+ Optional resolution to construct fonts at. See
+ :py:func:`pyglet.font.load`.
+
+ :rtype: `AbstractRunIterator`
+ """
+ raise NotImplementedError('abstract')
+
+ def get_font(self, position, dpi=None):
+ """Get the font instance used at the given position.
+
+ :see: `get_font_runs`
+
+ :Parameters:
+ `position` : int
+ Character position of document to query.
+ `dpi` : float
+ Optional resolution to construct fonts at. See
+ :py:func:`pyglet.font.load`.
+
+ :rtype: `pyglet.font.Font`
+ :return: The font at the given position.
+ """
+ raise NotImplementedError('abstract')
+
+ def insert_text(self, start, text, attributes=None):
+ """Insert text into the document.
+
+ :Parameters:
+ `start` : int
+ Character insertion point within document.
+ `text` : str
+ Text to insert.
+ `attributes` : dict
+ Optional dictionary giving named style attributes of the
+ inserted text.
+
+ """
+ self._insert_text(start, text, attributes)
+ self.dispatch_event('on_insert_text', start, text)
+
+ def _insert_text(self, start, text, attributes):
+ self._text = u''.join((self._text[:start], text, self._text[start:]))
+ len_text = len(text)
+ for element in self._elements:
+ if element._position >= start:
+ element._position += len_text
+
+ def delete_text(self, start, end):
+ """Delete text from the document.
+
+ :Parameters:
+ `start` : int
+ Starting character position to delete from.
+ `end` : int
+ Ending character position to delete to (exclusive).
+
+ """
+ self._delete_text(start, end)
+ self.dispatch_event('on_delete_text', start, end)
+
+ def _delete_text(self, start, end):
+ for element in list(self._elements):
+ if start <= element._position < end:
+ self._elements.remove(element)
+ elif element._position >= end: # fix bug 538
+ element._position -= (end - start)
+
+ self._text = self._text[:start] + self._text[end:]
+
+ def insert_element(self, position, element, attributes=None):
+ """Insert a element into the document.
+
+ See the :py:class:`~pyglet.text.document.InlineElement` class documentation for details of
+ usage.
+
+ :Parameters:
+ `position` : int
+ Character insertion point within document.
+ `element` : `~pyglet.text.document.InlineElement`
+ Element to insert.
+ `attributes` : dict
+ Optional dictionary giving named style attributes of the
+ inserted text.
+
+ """
+ assert element._position is None, \
+ 'Element is already in a document.'
+ self.insert_text(position, '\0', attributes)
+ element._position = position
+ self._elements.append(element)
+ self._elements.sort(key=lambda d: d.position)
+
+ def get_element(self, position):
+ """Get the element at a specified position.
+
+ :Parameters:
+ `position` : int
+ Position in the document of the element.
+
+ :rtype: :py:class:`~pyglet.text.document.InlineElement`
+ """
+ for element in self._elements:
+ if element._position == position:
+ return element
+ raise RuntimeError('No element at position %d' % position)
+
+ def set_style(self, start, end, attributes):
+ """Set text style of some or all of the document.
+
+ :Parameters:
+ `start` : int
+ Starting character position.
+ `end` : int
+ Ending character position (exclusive).
+ `attributes` : dict
+ Dictionary giving named style attributes of the text.
+
+ """
+ self._set_style(start, end, attributes)
+ self.dispatch_event('on_style_text', start, end, attributes)
+
+ def _set_style(self, start, end, attributes):
+ raise NotImplementedError('abstract')
+
+ def set_paragraph_style(self, start, end, attributes):
+ """Set the style for a range of paragraphs.
+
+ This is a convenience method for `set_style` that aligns the
+ character range to the enclosing paragraph(s).
+
+ :Parameters:
+ `start` : int
+ Starting character position.
+ `end` : int
+ Ending character position (exclusive).
+ `attributes` : dict
+ Dictionary giving named style attributes of the paragraphs.
+
+ """
+ start = self.get_paragraph_start(start)
+ end = self.get_paragraph_end(end)
+ self._set_style(start, end, attributes)
+ self.dispatch_event('on_style_text', start, end, attributes)
+
+ if _is_epydoc:
+ def on_insert_text(self, start, text):
+ """Text was inserted into the document.
+
+ :Parameters:
+ `start` : int
+ Character insertion point within document.
+ `text` : str
+ The text that was inserted.
+
+ :event:
+ """
+
+ def on_delete_text(self, start, end):
+ """Text was deleted from the document.
+
+ :Parameters:
+ `start` : int
+ Starting character position of deleted text.
+ `end` : int
+ Ending character position of deleted text (exclusive).
+
+ :event:
+ """
+
+ def on_style_text(self, start, end, attributes):
+ """Text character style was modified.
+
+ :Parameters:
+ `start` : int
+ Starting character position of modified text.
+ `end` : int
+ Ending character position of modified text (exclusive).
+ `attributes` : dict
+ Dictionary giving updated named style attributes of the
+ text.
+
+ :event:
+ """
+
+
+AbstractDocument.register_event_type('on_insert_text')
+AbstractDocument.register_event_type('on_delete_text')
+AbstractDocument.register_event_type('on_style_text')
+
+
+class UnformattedDocument(AbstractDocument):
+ """A document having uniform style over all text.
+
+ Changes to the style of text within the document affects the entire
+ document. For convenience, the ``position`` parameters of the style
+ methods may therefore be omitted.
+ """
+
+ def __init__(self, text=''):
+ super(UnformattedDocument, self).__init__(text)
+ self.styles = {}
+
+ def get_style_runs(self, attribute):
+ value = self.styles.get(attribute)
+ return runlist.ConstRunIterator(len(self.text), value)
+
+ def get_style(self, attribute, position=None):
+ return self.styles.get(attribute)
+
+ def set_style(self, start, end, attributes):
+ return super(UnformattedDocument, self).set_style(
+ 0, len(self.text), attributes)
+
+ def _set_style(self, start, end, attributes):
+ self.styles.update(attributes)
+
+ def set_paragraph_style(self, start, end, attributes):
+ return super(UnformattedDocument, self).set_paragraph_style(
+ 0, len(self.text), attributes)
+
+ def get_font_runs(self, dpi=None):
+ ft = self.get_font(dpi=dpi)
+ return runlist.ConstRunIterator(len(self.text), ft)
+
+ def get_font(self, position=None, dpi=None):
+ from pyglet import font
+ font_name = self.styles.get('font_name')
+ font_size = self.styles.get('font_size')
+ bold = self.styles.get('bold', False)
+ italic = self.styles.get('italic', False)
+ return font.load(font_name, font_size,
+ bold=bool(bold), italic=bool(italic), dpi=dpi)
+
+ def get_element_runs(self):
+ return runlist.ConstRunIterator(len(self._text), None)
+
+
+class FormattedDocument(AbstractDocument):
+ """Simple implementation of a document that maintains text formatting.
+
+ Changes to text style are applied according to the description in
+ :py:class:`~pyglet.text.document.AbstractDocument`. All styles default to ``None``.
+ """
+
+ def __init__(self, text=''):
+ self._style_runs = {}
+ super(FormattedDocument, self).__init__(text)
+
+ def get_style_runs(self, attribute):
+ try:
+ return self._style_runs[attribute].get_run_iterator()
+ except KeyError:
+ return _no_style_range_iterator
+
+ def get_style(self, attribute, position=0):
+ try:
+ return self._style_runs[attribute][position]
+ except KeyError:
+ return None
+
+ def _set_style(self, start, end, attributes):
+ for attribute, value in attributes.items():
+ try:
+ runs = self._style_runs[attribute]
+ except KeyError:
+ runs = self._style_runs[attribute] = runlist.RunList(0, None)
+ runs.insert(0, len(self._text))
+ runs.set_run(start, end, value)
+
+ def get_font_runs(self, dpi=None):
+ return _FontStyleRunsRangeIterator(
+ self.get_style_runs('font_name'),
+ self.get_style_runs('font_size'),
+ self.get_style_runs('bold'),
+ self.get_style_runs('italic'),
+ dpi)
+
+ def get_font(self, position, dpi=None):
+ iter = self.get_font_runs(dpi)
+ return iter[position]
+
+ def get_element_runs(self):
+ return _ElementIterator(self._elements, len(self._text))
+
+ def _insert_text(self, start, text, attributes):
+ super(FormattedDocument, self)._insert_text(start, text, attributes)
+
+ len_text = len(text)
+ for runs in self._style_runs.values():
+ runs.insert(start, len_text)
+
+ if attributes is not None:
+ for attribute, value in attributes.items():
+ try:
+ runs = self._style_runs[attribute]
+ except KeyError:
+ runs = self._style_runs[attribute] = \
+ runlist.RunList(0, None)
+ runs.insert(0, len(self.text))
+ runs.set_run(start, start + len_text, value)
+
+ def _delete_text(self, start, end):
+ super(FormattedDocument, self)._delete_text(start, end)
+ for runs in self._style_runs.values():
+ runs.delete(start, end)
+
+
+def _iter_elements(elements, length):
+ last = 0
+ for element in elements:
+ p = element.position
+ yield last, p, None
+ yield p, p + 1, element
+ last = p + 1
+ yield last, length, None
+
+
+class _ElementIterator(runlist.RunIterator):
+ def __init__(self, elements, length):
+ self._run_list_iter = _iter_elements(elements, length)
+ self.start, self.end, self.value = next(self)
+
+
+class _FontStyleRunsRangeIterator(object):
+ # XXX subclass runlist
+ def __init__(self, font_names, font_sizes, bolds, italics, dpi):
+ self.zip_iter = runlist.ZipRunIterator(
+ (font_names, font_sizes, bolds, italics))
+ self.dpi = dpi
+
+ def ranges(self, start, end):
+ from pyglet import font
+ for start, end, styles in self.zip_iter.ranges(start, end):
+ font_name, font_size, bold, italic = styles
+ ft = font.load(font_name, font_size,
+ bold=bool(bold), italic=bool(italic),
+ dpi=self.dpi)
+ yield start, end, ft
+
+ def __getitem__(self, index):
+ from pyglet import font
+ font_name, font_size, bold, italic = self.zip_iter[index]
+ return font.load(font_name, font_size,
+ bold=bool(bold), italic=bool(italic),
+ dpi=self.dpi)
+
+
+class _NoStyleRangeIterator(object):
+ # XXX subclass runlist
+ def ranges(self, start, end):
+ yield start, end, None
+
+ def __getitem__(self, index):
+ return None
+
+
+_no_style_range_iterator = _NoStyleRangeIterator()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/formats/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/formats/__init__.py
new file mode 100644
index 0000000..1ec5171
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/formats/__init__.py
@@ -0,0 +1,40 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+'''Document formats.
+
+.. versionadded:: 1.1
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/formats/attributed.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/formats/attributed.py
new file mode 100644
index 0000000..c228337
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/formats/attributed.py
@@ -0,0 +1,138 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Extensible attributed text format for representing pyglet formatted
+documents.
+'''
+from builtins import chr
+from builtins import map
+
+from functools import reduce
+import operator
+import parser
+import re
+import token
+
+import pyglet
+
+_pattern = re.compile(r'''
+ (?P\{\#x(?P[0-9a-fA-F]+)\})
+ | (?P\{\#(?P[0-9]+)\})
+ | (?P\{\{)
+ | (?P\}\})
+ | (?P\{
+ (?P[^ \{\}]+)\s+
+ (?P[^\}]+)\})
+ | (?P\n(?=[ \t]))
+ | (?P\{\}\n)
+ | (?P\n(?=\S))
+ | (?P\n\n+)
+ | (?P[^\{\}\n]+)
+ ''', re.VERBOSE | re.DOTALL)
+
+class AttributedTextDecoder(pyglet.text.DocumentDecoder):
+ def decode(self, text, location=None):
+ self.doc = pyglet.text.document.FormattedDocument()
+
+ self.length = 0
+ self.attributes = {}
+ next_trailing_space = True
+ trailing_newline = True
+
+ for m in _pattern.finditer(text):
+ group = m.lastgroup
+ trailing_space = True
+ if group == 'text':
+ t = m.group('text')
+ self.append(t)
+ trailing_space = t.endswith(' ')
+ trailing_newline = False
+ elif group == 'nl_soft':
+ if not next_trailing_space:
+ self.append(' ')
+ trailing_newline = False
+ elif group in ('nl_hard1', 'nl_hard2'):
+ self.append('\n')
+ trailing_newline = True
+ elif group == 'nl_para':
+ self.append(m.group('nl_para')[1:]) # ignore the first \n
+ trailing_newline = True
+ elif group == 'attr':
+ try:
+ ast = parser.expr(m.group('attr_val'))
+ if self.safe(ast):
+ val = eval(ast.compile())
+ else:
+ val = None
+ except (parser.ParserError, SyntaxError):
+ val = None
+ name = m.group('attr_name')
+ if name[0] == '.':
+ if trailing_newline:
+ self.attributes[name[1:]] = val
+ else:
+ self.doc.set_paragraph_style(self.length, self.length,
+ {name[1:]: val})
+ else:
+ self.attributes[name] = val
+ elif group == 'escape_dec':
+ self.append(chr(int(m.group('escape_dec_val'))))
+ elif group == 'escape_hex':
+ self.append(chr(int(m.group('escape_hex_val'), 16)))
+ elif group == 'escape_lbrace':
+ self.append('{')
+ elif group == 'escape_rbrace':
+ self.append('}')
+ next_trailing_space = trailing_space
+
+ return self.doc
+
+ def append(self, text):
+ self.doc.insert_text(self.length, text, self.attributes)
+ self.length += len(text)
+ self.attributes.clear()
+
+ _safe_names = ('True', 'False', 'None')
+
+ def safe(self, ast):
+ tree = ast.totuple()
+ return self.safe_node(tree)
+
+ def safe_node(self, node):
+ if token.ISNONTERMINAL(node[0]):
+ return reduce(operator.and_, map(self.safe_node, node[1:]))
+ elif node[0] == token.NAME:
+ return node[1] in self._safe_names
+ else:
+ return True
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/formats/html.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/formats/html.py
new file mode 100644
index 0000000..dedcc85
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/formats/html.py
@@ -0,0 +1,364 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Decode HTML into attributed text.
+
+A subset of HTML 4.01 Transitional is implemented. The following elements are
+supported fully::
+
+ B BLOCKQUOTE BR CENTER CODE DD DIR DL EM FONT H1 H2 H3 H4 H5 H6 I IMG KBD
+ LI MENU OL P PRE Q SAMP STRONG SUB SUP TT U UL VAR
+
+The mark (bullet or number) of a list item is separated from the body of the
+list item with a tab, as the pyglet document model does not allow
+out-of-stream text. This means lists display as expected, but behave a little
+oddly if edited.
+
+No CSS styling is supported.
+'''
+from builtins import chr
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+from future.moves.html.parser import HTMLParser
+from future.moves.html import entities
+import re
+
+import pyglet
+from pyglet.text.formats import structured
+
+def _hex_color(val):
+ return [(val >> 16) & 0xff, (val >> 8) & 0xff, val & 0xff, 255]
+
+_color_names = {
+ 'black': _hex_color(0x000000),
+ 'silver': _hex_color(0xc0c0c0),
+ 'gray': _hex_color(0x808080),
+ 'white': _hex_color(0xffffff),
+ 'maroon': _hex_color(0x800000),
+ 'red': _hex_color(0xff0000),
+ 'purple': _hex_color(0x800080),
+ 'fucsia': _hex_color(0x008000),
+ 'green': _hex_color(0x00ff00),
+ 'lime': _hex_color(0xffff00),
+ 'olive': _hex_color(0x808000),
+ 'yellow': _hex_color(0xff0000),
+ 'navy': _hex_color(0x000080),
+ 'blue': _hex_color(0x0000ff),
+ 'teal': _hex_color(0x008080),
+ 'aqua': _hex_color(0x00ffff),
+}
+
+def _parse_color(value):
+ if value.startswith('#'):
+ return _hex_color(int(value[1:], 16))
+ else:
+ try:
+ return _color_names[value.lower()]
+ except KeyError:
+ raise ValueError()
+
+_whitespace_re = re.compile(u'[\u0020\u0009\u000c\u200b\r\n]+', re.DOTALL)
+
+_metadata_elements = ['head', 'title']
+
+_block_elements = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
+ 'ul', 'ol', 'dir', 'menu',
+ 'pre', 'dl', 'div', 'center',
+ 'noscript', 'noframes', 'blockquote', 'form',
+ 'isindex', 'hr', 'table', 'fieldset', 'address',
+ # Incorrect, but we treat list items as blocks:
+ 'li', 'dd', 'dt', ]
+
+
+_block_containers = ['_top_block',
+ 'body', 'div', 'center', 'object', 'applet',
+ 'blockquote', 'ins', 'del', 'dd', 'li', 'form',
+ 'fieldset', 'button', 'th', 'td', 'iframe', 'noscript',
+ 'noframes',
+ # Incorrect, but we treat list items as blocks:
+ 'ul', 'ol', 'dir', 'menu', 'dl']
+
+
+class HTMLDecoder(HTMLParser, structured.StructuredTextDecoder):
+ '''Decoder for HTML documents.
+ '''
+ #: Default style attributes for unstyled text in the HTML document.
+ #:
+ #: :type: dict
+ default_style = {
+ 'font_name': 'Times New Roman',
+ 'font_size': 12,
+ 'margin_bottom': '12pt',
+ }
+
+ #: Map HTML font sizes to actual font sizes, in points.
+ #:
+ #: :type: dict
+ font_sizes = {
+ 1: 8,
+ 2: 10,
+ 3: 12,
+ 4: 14,
+ 5: 18,
+ 6: 24,
+ 7: 48
+ }
+
+ def decode_structured(self, text, location):
+ self.location = location
+ self._font_size_stack = [3]
+ self.list_stack.append(structured.UnorderedListBuilder({}))
+ self.strip_leading_space = True
+ self.block_begin = True
+ self.need_block_begin = False
+ self.element_stack = ['_top_block']
+ self.in_metadata = False
+ self.in_pre = False
+
+ self.push_style('_default', self.default_style)
+
+ self.feed(text)
+ self.close()
+
+ def get_image(self, filename):
+ return pyglet.image.load(filename, file=self.location.open(filename))
+
+ def prepare_for_data(self):
+ if self.need_block_begin:
+ self.add_text('\n')
+ self.block_begin = True
+ self.need_block_begin = False
+
+ def handle_data(self, data):
+ if self.in_metadata:
+ return
+
+ if self.in_pre:
+ self.add_text(data)
+ else:
+ data = _whitespace_re.sub(' ', data)
+ if data.strip():
+ self.prepare_for_data()
+ if self.block_begin or self.strip_leading_space:
+ data = data.lstrip()
+ self.block_begin = False
+ self.add_text(data)
+ self.strip_leading_space = data.endswith(' ')
+
+ def handle_starttag(self, tag, case_attrs):
+ if self.in_metadata:
+ return
+
+ element = tag.lower()
+ attrs = {}
+ for key, value in case_attrs:
+ attrs[key.lower()] = value
+
+ if element in _metadata_elements:
+ self.in_metadata = True
+ elif element in _block_elements:
+ # Pop off elements until we get to a block container.
+ while self.element_stack[-1] not in _block_containers:
+ self.handle_endtag(self.element_stack[-1])
+ if not self.block_begin:
+ self.add_text('\n')
+ self.block_begin = True
+ self.need_block_begin = False
+ self.element_stack.append(element)
+
+ style = {}
+ if element in ('b', 'strong'):
+ style['bold'] = True
+ elif element in ('i', 'em', 'var'):
+ style['italic'] = True
+ elif element in ('tt', 'code', 'samp', 'kbd'):
+ style['font_name'] = 'Courier New'
+ elif element == 'u':
+ color = self.current_style.get('color')
+ if color is None:
+ color = [0, 0, 0, 255]
+ style['underline'] = color
+ elif element == 'font':
+ if 'face' in attrs:
+ style['font_name'] = attrs['face'].split(',')
+ if 'size' in attrs:
+ size = attrs['size']
+ try:
+ if size.startswith('+'):
+ size = self._font_size_stack[-1] + int(size[1:])
+ elif size.startswith('-'):
+ size = self._font_size_stack[-1] - int(size[1:])
+ else:
+ size = int(size)
+ except ValueError:
+ size = 3
+ self._font_size_stack.append(size)
+ if size in self.font_sizes:
+ style['font_size'] = self.font_sizes.get(size, 3)
+ else:
+ self._font_size_stack.append(self._font_size_stack[-1])
+ if 'color' in attrs:
+ try:
+ style['color'] = _parse_color(attrs['color'])
+ except ValueError:
+ pass
+ elif element == 'sup':
+ size = self._font_size_stack[-1] - 1
+ style['font_size'] = self.font_sizes.get(size, 1)
+ style['baseline'] = '3pt'
+ elif element == 'sub':
+ size = self._font_size_stack[-1] - 1
+ style['font_size'] = self.font_sizes.get(size, 1)
+ style['baseline'] = '-3pt'
+ elif element == 'h1':
+ style['font_size'] = 24
+ style['bold'] = True
+ style['align'] = 'center'
+ elif element == 'h2':
+ style['font_size'] = 18
+ style['bold'] = True
+ elif element == 'h3':
+ style['font_size'] = 16
+ style['bold'] = True
+ elif element == 'h4':
+ style['font_size'] = 14
+ style['bold'] = True
+ elif element == 'h5':
+ style['font_size'] = 12
+ style['bold'] = True
+ elif element == 'h6':
+ style['font_size'] = 12
+ style['italic'] = True
+ elif element == 'br':
+ self.add_text(u'\u2028')
+ self.strip_leading_space = True
+ elif element == 'p':
+ if attrs.get('align') in ('left', 'center', 'right'):
+ style['align'] = attrs['align']
+ elif element == 'center':
+ style['align'] = 'center'
+ elif element == 'pre':
+ style['font_name'] = 'Courier New'
+ style['margin_bottom'] = 0
+ self.in_pre = True
+ elif element == 'blockquote':
+ left_margin = self.current_style.get('margin_left') or 0
+ right_margin = self.current_style.get('margin_right') or 0
+ style['margin_left'] = left_margin + 60
+ style['margin_right'] = right_margin + 60
+ elif element == 'q':
+ self.handle_data(u'\u201c')
+ elif element == 'ol':
+ try:
+ start = int(attrs.get('start', 1))
+ except ValueError:
+ start = 1
+ format = attrs.get('type', '1') + '.'
+ builder = structured.OrderedListBuilder(start, format)
+ builder.begin(self, style)
+ self.list_stack.append(builder)
+ elif element in ('ul', 'dir', 'menu'):
+ type = attrs.get('type', 'disc').lower()
+ if type == 'circle':
+ mark = u'\u25cb'
+ elif type == 'square':
+ mark = u'\u25a1'
+ else:
+ mark = u'\u25cf'
+ builder = structured.UnorderedListBuilder(mark)
+ builder.begin(self, style)
+ self.list_stack.append(builder)
+ elif element == 'li':
+ self.list_stack[-1].item(self, style)
+ self.strip_leading_space = True
+ elif element == 'dl':
+ style['margin_bottom'] = 0
+ elif element == 'dd':
+ left_margin = self.current_style.get('margin_left') or 0
+ style['margin_left'] = left_margin + 30
+ elif element == 'img':
+ image = self.get_image(attrs.get('src'))
+ if image:
+ width = attrs.get('width')
+ if width:
+ width = int(width)
+ height = attrs.get('height')
+ if height:
+ height = int(height)
+ self.prepare_for_data()
+ self.add_element(structured.ImageElement(image, width, height))
+ self.strip_leading_space = False
+
+ self.push_style(element, style)
+
+ def handle_endtag(self, tag):
+ element = tag.lower()
+ if element not in self.element_stack:
+ return
+
+ self.pop_style(element)
+ while self.element_stack.pop() != element:
+ pass
+
+ if element in _metadata_elements:
+ self.in_metadata = False
+ elif element in _block_elements:
+ self.block_begin = False
+ self.need_block_begin = True
+
+ if element == 'font' and len(self._font_size_stack) > 1:
+ self._font_size_stack.pop()
+ elif element == 'pre':
+ self.in_pre = False
+ elif element == 'q':
+ self.handle_data(u'\u201d')
+ elif element in ('ul', 'ol'):
+ if len(self.list_stack) > 1:
+ self.list_stack.pop()
+
+ def handle_entityref(self, name):
+ if name in entities.name2codepoint:
+ self.handle_data(chr(entities.name2codepoint[name]))
+
+ def handle_charref(self, name):
+ name = name.lower()
+ try:
+ if name.startswith('x'):
+ self.handle_data(chr(int(name[1:], 16)))
+ else:
+ self.handle_data(chr(int(name)))
+ except ValueError:
+ pass
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/formats/plaintext.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/formats/plaintext.py
new file mode 100644
index 0000000..560a152
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/formats/plaintext.py
@@ -0,0 +1,47 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Plain text decoder.
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import pyglet
+
+class PlainTextDecoder(pyglet.text.DocumentDecoder):
+ def decode(self, text, location=None):
+ document = pyglet.text.document.UnformattedDocument()
+ document.insert_text(0, text)
+ return document
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/formats/structured.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/formats/structured.py
new file mode 100644
index 0000000..bfaf015
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/formats/structured.py
@@ -0,0 +1,264 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''Base class for structured (hierarchical) document formats.
+'''
+from __future__ import division
+from builtins import range
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import re
+
+import pyglet
+
+class ImageElement(pyglet.text.document.InlineElement):
+ def __init__(self, image, width=None, height=None):
+ self.image = image.get_texture()
+ self.width = width is None and image.width or width
+ self.height = height is None and image.height or height
+ self.vertex_lists = {}
+
+ anchor_y = self.height // image.height * image.anchor_y
+ ascent = max(0, self.height - anchor_y)
+ descent = min(0, -anchor_y)
+ super(ImageElement, self).__init__(ascent, descent, self.width)
+
+ def place(self, layout, x, y):
+ group = pyglet.graphics.TextureGroup(self.image.texture,
+ layout.top_group)
+ x1 = x
+ y1 = y + self.descent
+ x2 = x + self.width
+ y2 = y + self.height + self.descent
+ vertex_list = layout.batch.add(4, pyglet.gl.GL_QUADS, group,
+ ('v2i', (x1, y1, x2, y1, x2, y2, x1, y2)),
+ ('c3B', (255, 255, 255) * 4),
+ ('t3f', self.image.tex_coords))
+ self.vertex_lists[layout] = vertex_list
+
+ def remove(self, layout):
+ self.vertex_lists[layout].delete()
+ del self.vertex_lists[layout]
+
+def _int_to_roman(input):
+ # From http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81611
+ if not 0 < input < 4000:
+ raise ValueError("Argument must be between 1 and 3999")
+ ints = (1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1)
+ nums = ('M', 'CM', 'D', 'CD','C', 'XC','L','XL','X','IX','V','IV','I')
+ result = ""
+ for i in range(len(ints)):
+ count = int(input // ints[i])
+ result += nums[i] * count
+ input -= ints[i] * count
+ return result
+
+class ListBuilder(object):
+ def begin(self, decoder, style):
+ '''Begin a list.
+
+ :Parameters:
+ `decoder` : `StructuredTextDecoder`
+ Decoder.
+ `style` : dict
+ Style dictionary that applies over the entire list.
+
+ '''
+ left_margin = decoder.current_style.get('margin_left') or 0
+ tab_stops = decoder.current_style.get('tab_stops')
+ if tab_stops:
+ tab_stops = list(tab_stops)
+ else:
+ tab_stops = []
+ tab_stops.append(left_margin + 50)
+ style['margin_left'] = left_margin + 50
+ style['indent'] = -30
+ style['tab_stops'] = tab_stops
+
+ def item(self, decoder, style, value=None):
+ '''Begin a list item.
+
+ :Parameters:
+ `decoder` : `StructuredTextDecoder`
+ Decoder.
+ `style` : dict
+ Style dictionary that applies over the list item.
+ `value` : str
+ Optional value of the list item. The meaning is list-type
+ dependent.
+
+ '''
+ mark = self.get_mark(value)
+ if mark:
+ decoder.add_text(mark)
+ decoder.add_text('\t')
+
+ def get_mark(self, value=None):
+ '''Get the mark text for the next list item.
+
+ :Parameters:
+ `value` : str
+ Optional value of the list item. The meaning is list-type
+ dependent.
+
+ :rtype: str
+ '''
+ return ''
+
+class UnorderedListBuilder(ListBuilder):
+ def __init__(self, mark):
+ '''Create an unordered list with constant mark text.
+
+ :Parameters:
+ `mark` : str
+ Mark to prepend to each list item.
+
+ '''
+ self.mark = mark
+
+
+ def get_mark(self, value):
+ return self.mark
+
+class OrderedListBuilder(ListBuilder):
+ format_re = re.compile('(.*?)([1aAiI])(.*)')
+
+ def __init__(self, start, format):
+ '''Create an ordered list with sequentially numbered mark text.
+
+ The format is composed of an optional prefix text, a numbering
+ scheme character followed by suffix text. Valid numbering schemes
+ are:
+
+ ``1``
+ Decimal Arabic
+ ``a``
+ Lowercase alphanumeric
+ ``A``
+ Uppercase alphanumeric
+ ``i``
+ Lowercase Roman
+ ``I``
+ Uppercase Roman
+
+ Prefix text may typically be ``(`` or ``[`` and suffix text is
+ typically ``.``, ``)`` or empty, but either can be any string.
+
+ :Parameters:
+ `start` : int
+ First list item number.
+ `format` : str
+ Format style, for example ``"1."``.
+
+ '''
+ self.next_value = start
+
+ self.prefix, self.numbering, self.suffix = self.format_re.match(format).groups()
+ assert self.numbering in '1aAiI'
+
+ def get_mark(self, value):
+ if value is None:
+ value = self.next_value
+ self.next_value = value + 1
+ if self.numbering in 'aA':
+ try:
+ mark = 'abcdefghijklmnopqrstuvwxyz'[value - 1]
+ except ValueError:
+ mark = '?'
+ if self.numbering == 'A':
+ mark = mark.upper()
+ return '%s%s%s' % (self.prefix, mark, self.suffix)
+ elif self.numbering in 'iI':
+ try:
+ mark = _int_to_roman(value)
+ except ValueError:
+ mark = '?'
+ if self.numbering == 'i':
+ mark = mark.lower()
+ return '%s%s%s' % (self.prefix, mark, self.suffix)
+ else:
+ return '%s%d%s' % (self.prefix, value, self.suffix)
+
+class StructuredTextDecoder(pyglet.text.DocumentDecoder):
+ def decode(self, text, location=None):
+ self.len_text = 0
+ self.current_style = {}
+ self.next_style = {}
+ self.stack = []
+ self.list_stack = []
+ self.document = pyglet.text.document.FormattedDocument()
+ if location is None:
+ location = pyglet.resource.FileLocation('')
+ self.decode_structured(text, location)
+ return self.document
+
+ def decode_structured(self, text, location):
+ raise NotImplementedError('abstract')
+
+ def push_style(self, key, styles):
+ old_styles = {}
+ for name in styles.keys():
+ old_styles[name] = self.current_style.get(name)
+ self.stack.append((key, old_styles))
+ self.current_style.update(styles)
+ self.next_style.update(styles)
+
+ def pop_style(self, key):
+ # Don't do anything if key is not in stack
+ for match, _ in self.stack:
+ if key == match:
+ break
+ else:
+ return
+
+ # Remove all innermost elements until key is closed.
+ while True:
+ match, old_styles = self.stack.pop()
+ self.next_style.update(old_styles)
+ self.current_style.update(old_styles)
+ if match == key:
+ break
+
+ def add_text(self, text):
+ self.document.insert_text(self.len_text, text, self.next_style)
+ self.next_style.clear()
+ self.len_text += len(text)
+
+ def add_element(self, element):
+ self.document.insert_element(self.len_text, element, self.next_style)
+ self.next_style.clear()
+ self.len_text += 1
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/layout.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/layout.py
new file mode 100644
index 0000000..bf88f6e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/layout.py
@@ -0,0 +1,2470 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+# $Id: $
+
+"""Render simple text and formatted documents efficiently.
+
+Three layout classes are provided:
+
+:py:class:`~pyglet.text.layout.TextLayout`
+ The entire document is laid out before it is rendered. The layout will
+ be grouped with other layouts in the same batch (allowing for efficient
+ rendering of multiple layouts).
+
+ Any change to the layout or document,
+ and even querying some properties, will cause the entire document
+ to be laid out again.
+
+:py:class:`~pyglet.text.layout.ScrollableTextLayout`
+ Based on :py:func:`~pyglet.text.layout.TextLayout`.
+
+ A separate group is used for layout which crops the contents of the
+ layout to the layout rectangle. Additionally, the contents of the
+ layout can be "scrolled" within that rectangle with the ``view_x`` and
+ ``view_y`` properties.
+
+:py:class:`~pyglet.text.layout.IncrementalTextLayout`
+ Based on :py:class:`~pyglet.text.layout.ScrollableTextLayout`.
+
+ When the layout or document are modified, only the affected regions
+ are laid out again. This permits efficient interactive editing and
+ styling of text.
+
+ Only the visible portion of the layout is actually rendered; as the
+ viewport is scrolled additional sections are rendered and discarded as
+ required. This permits efficient viewing and editing of large documents.
+
+ Additionally, this class provides methods for locating the position of a
+ caret in the document, and for displaying interactive text selections.
+
+All three layout classes can be used with either :py:class:`~pyglet.text.document.UnformattedDocument` or
+:py:class:`~pyglet.text.document.FormattedDocument`, and can be either single-line or ``multiline``. The
+combinations of these options effectively provides 12 different text display
+possibilities.
+
+Style attributes
+================
+
+The following character style attribute names are recognised by the layout
+classes. Data types and units are as specified.
+
+Where an attribute is marked "as a distance" the value is assumed to be
+in pixels if given as an int or float, otherwise a string of the form
+``"0u"`` is required, where ``0`` is the distance and ``u`` is the unit; one
+of ``"px"`` (pixels), ``"pt"`` (points), ``"pc"`` (picas), ``"cm"``
+(centimeters), ``"mm"`` (millimeters) or ``"in"`` (inches). For example,
+``"14pt"`` is the distance covering 14 points, which at the default DPI of 96
+is 18 pixels.
+
+``font_name``
+ Font family name, as given to :py:func:`pyglet.font.load`.
+``font_size``
+ Font size, in points.
+``bold``
+ Boolean.
+``italic``
+ Boolean.
+``underline``
+ 4-tuple of ints in range (0, 255) giving RGBA underline color, or None
+ (default) for no underline.
+``kerning``
+ Additional space to insert between glyphs, as a distance. Defaults to 0.
+``baseline``
+ Offset of glyph baseline from line baseline, as a distance. Positive
+ values give a superscript, negative values give a subscript. Defaults to
+ 0.
+``color``
+ 4-tuple of ints in range (0, 255) giving RGBA text color
+``background_color``
+ 4-tuple of ints in range (0, 255) giving RGBA text background color; or
+ ``None`` for no background fill.
+
+The following paragraph style attribute names are recognised. Note
+that paragraph styles are handled no differently from character styles by the
+document: it is the application's responsibility to set the style over an
+entire paragraph, otherwise results are undefined.
+
+``align``
+ ``left`` (default), ``center`` or ``right``.
+``indent``
+ Additional horizontal space to insert before the first glyph of the
+ first line of a paragraph, as a distance.
+``leading``
+ Additional space to insert between consecutive lines within a paragraph,
+ as a distance. Defaults to 0.
+``line_spacing``
+ Distance between consecutive baselines in a paragraph, as a distance.
+ Defaults to ``None``, which automatically calculates the tightest line
+ spacing for each line based on the font ascent and descent.
+``margin_left``
+ Left paragraph margin, as a distance.
+``margin_right``
+ Right paragraph margin, as a distance.
+``margin_top``
+ Margin above paragraph, as a distance.
+``margin_bottom``
+ Margin below paragraph, as a distance. Adjacent margins do not collapse.
+``tab_stops``
+ List of horizontal tab stops, as distances, measured from the left edge of
+ the text layout. Defaults to the empty list. When the tab stops
+ are exhausted, they implicitly continue at 50 pixel intervals.
+``wrap``
+ ``char``, ``word``, True (default) or False. The boundaries at which to
+ wrap text to prevent it overflowing a line. With ``char``, the line
+ wraps anywhere in the text; with ``word`` or True, the line wraps at
+ appropriate boundaries between words; with False the line does not wrap,
+ and may overflow the layout width. ``char`` and ``word`` styles are
+ since pyglet 1.2.
+
+Other attributes can be used to store additional style information within the
+document; they will be ignored by the built-in text classes.
+
+.. versionadded:: 1.1
+"""
+from __future__ import division
+from builtins import zip
+from builtins import map
+from builtins import range
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+import re
+import sys
+
+from pyglet.gl import *
+from pyglet import event
+from pyglet import graphics
+from pyglet.text import runlist
+
+from pyglet.font.base import _grapheme_break
+
+_is_epydoc = hasattr(sys, 'is_epydoc') and sys.is_epydoc
+
+_distance_re = re.compile(r'([-0-9.]+)([a-zA-Z]+)')
+
+
+def _parse_distance(distance, dpi):
+ """Parse a distance string and return corresponding distance in pixels as
+ an integer.
+ """
+ if isinstance(distance, int):
+ return distance
+ elif isinstance(distance, float):
+ return int(distance)
+
+ match = _distance_re.match(distance)
+ assert match, 'Could not parse distance %s' % (distance)
+ if not match:
+ return 0
+
+ value, unit = match.groups()
+ value = float(value)
+ if unit == 'px':
+ return int(value)
+ elif unit == 'pt':
+ return int(value * dpi / 72.0)
+ elif unit == 'pc':
+ return int(value * dpi / 6.0)
+ elif unit == 'in':
+ return int(value * dpi)
+ elif unit == 'mm':
+ return int(value * dpi * 0.0393700787)
+ elif unit == 'cm':
+ return int(value * dpi * 0.393700787)
+ else:
+ assert False, 'Unknown distance unit %s' % unit
+
+
+class _Line(object):
+ align = 'left'
+
+ margin_left = 0
+ margin_right = 0
+
+ length = 0
+
+ ascent = 0
+ descent = 0
+ width = 0
+ paragraph_begin = False
+ paragraph_end = False
+
+ x = None
+ y = None
+
+ def __init__(self, start):
+ self.vertex_lists = []
+ self.start = start
+ self.boxes = []
+
+ def __repr__(self):
+ return '_Line(%r)' % self.boxes
+
+ def add_box(self, box):
+ self.boxes.append(box)
+ self.length += box.length
+ self.ascent = max(self.ascent, box.ascent)
+ self.descent = min(self.descent, box.descent)
+ self.width += box.advance
+
+ def delete(self, layout):
+ for vertex_list in self.vertex_lists:
+ vertex_list.delete()
+ self.vertex_lists = []
+
+ for box in self.boxes:
+ box.delete(layout)
+
+
+class _LayoutContext(object):
+ def __init__(self, layout, document, colors_iter, background_iter):
+ self.colors_iter = colors_iter
+ underline_iter = document.get_style_runs('underline')
+ self.decoration_iter = runlist.ZipRunIterator(
+ (background_iter,
+ underline_iter))
+ self.baseline_iter = runlist.FilteredRunIterator(
+ document.get_style_runs('baseline'),
+ lambda value: value is not None, 0)
+
+
+class _StaticLayoutContext(_LayoutContext):
+ def __init__(self, layout, document, colors_iter, background_iter):
+ super(_StaticLayoutContext, self).__init__(layout, document,
+ colors_iter, background_iter)
+ self.vertex_lists = layout._vertex_lists
+ self.boxes = layout._boxes
+
+ def add_list(self, vertex_list):
+ self.vertex_lists.append(vertex_list)
+
+ def add_box(self, box):
+ self.boxes.append(box)
+
+
+class _IncrementalLayoutContext(_LayoutContext):
+ line = None
+
+ def add_list(self, vertex_list):
+ self.line.vertex_lists.append(vertex_list)
+
+ def add_box(self, box):
+ pass
+
+
+class _AbstractBox(object):
+ owner = None
+
+ def __init__(self, ascent, descent, advance, length):
+ self.ascent = ascent
+ self.descent = descent
+ self.advance = advance
+ self.length = length
+
+ def place(self, layout, i, x, y):
+ raise NotImplementedError('abstract')
+
+ def delete(self, layout):
+ raise NotImplementedError('abstract')
+
+ def get_position_in_box(self, x):
+ raise NotImplementedError('abstract')
+
+ def get_point_in_box(self, position):
+ raise NotImplementedError('abstract')
+
+
+class _GlyphBox(_AbstractBox):
+ def __init__(self, owner, font, glyphs, advance):
+ """Create a run of glyphs sharing the same texture.
+
+ :Parameters:
+ `owner` : `pyglet.image.Texture`
+ Texture of all glyphs in this run.
+ `font` : `pyglet.font.base.Font`
+ Font of all glyphs in this run.
+ `glyphs` : list of (int, `pyglet.font.base.Glyph`)
+ Pairs of ``(kern, glyph)``, where ``kern`` gives horizontal
+ displacement of the glyph in pixels (typically 0).
+ `advance` : int
+ Width of glyph run; must correspond to the sum of advances
+ and kerns in the glyph list.
+
+ """
+ super(_GlyphBox, self).__init__(
+ font.ascent, font.descent, advance, len(glyphs))
+ assert owner
+ self.owner = owner
+ self.font = font
+ self.glyphs = glyphs
+ self.advance = advance
+
+ def place(self, layout, i, x, y, context):
+ assert self.glyphs
+ try:
+ group = layout.groups[self.owner]
+ except KeyError:
+ group = layout.groups[self.owner] = \
+ TextLayoutTextureGroup(self.owner, layout.foreground_group)
+
+ n_glyphs = self.length
+ vertices = []
+ tex_coords = []
+ x1 = x
+ for start, end, baseline in context.baseline_iter.ranges(i, i + n_glyphs):
+ baseline = layout._parse_distance(baseline)
+ assert len(self.glyphs[start - i:end - i]) == end - start
+ for kern, glyph in self.glyphs[start - i:end - i]:
+ x1 += kern
+ v0, v1, v2, v3 = glyph.vertices
+ v0 += x1
+ v2 += x1
+ v1 += y + baseline
+ v3 += y + baseline
+ vertices.extend(map(int, [v0, v1, v2, v1, v2, v3, v0, v3]))
+ t = glyph.tex_coords
+ tex_coords.extend(t)
+ x1 += glyph.advance
+
+ # Text color
+ colors = []
+ for start, end, color in context.colors_iter.ranges(i, i + n_glyphs):
+ if color is None:
+ color = (0, 0, 0, 255)
+ colors.extend(color * ((end - start) * 4))
+
+ vertex_list = layout.batch.add(n_glyphs * 4, GL_QUADS, group,
+ ('v2f/dynamic', vertices),
+ ('t3f/dynamic', tex_coords),
+ ('c4B/dynamic', colors))
+ context.add_list(vertex_list)
+
+ # Decoration (background color and underline)
+ #
+ # Should iterate over baseline too, but in practice any sensible
+ # change in baseline will correspond with a change in font size,
+ # and thus glyph run as well. So we cheat and just use whatever
+ # baseline was seen last.
+ background_vertices = []
+ background_colors = []
+ underline_vertices = []
+ underline_colors = []
+ y1 = y + self.descent + baseline
+ y2 = y + self.ascent + baseline
+ x1 = x
+ for start, end, decoration in context.decoration_iter.ranges(i, i + n_glyphs):
+ bg, underline = decoration
+ x2 = x1
+ for kern, glyph in self.glyphs[start - i:end - i]:
+ x2 += glyph.advance + kern
+
+ if bg is not None:
+ background_vertices.extend(
+ [x1, y1, x2, y1, x2, y2, x1, y2])
+ background_colors.extend(bg * 4)
+
+ if underline is not None:
+ underline_vertices.extend(
+ [x1, y + baseline - 2, x2, y + baseline - 2])
+ underline_colors.extend(underline * 2)
+
+ x1 = x2
+
+ if background_vertices:
+ background_list = layout.batch.add(
+ len(background_vertices) // 2, GL_QUADS,
+ layout.background_group,
+ ('v2f/dynamic', background_vertices),
+ ('c4B/dynamic', background_colors))
+ context.add_list(background_list)
+
+ if underline_vertices:
+ underline_list = layout.batch.add(
+ len(underline_vertices) // 2, GL_LINES,
+ layout.foreground_decoration_group,
+ ('v2f/dynamic', underline_vertices),
+ ('c4B/dynamic', underline_colors))
+ context.add_list(underline_list)
+
+ def delete(self, layout):
+ pass
+
+ def get_point_in_box(self, position):
+ x = 0
+ for (kern, glyph) in self.glyphs:
+ if position == 0:
+ break
+ position -= 1
+ x += glyph.advance + kern
+ return x
+
+ def get_position_in_box(self, x):
+ position = 0
+ last_glyph_x = 0
+ for kern, glyph in self.glyphs:
+ last_glyph_x += kern
+ if last_glyph_x + glyph.advance // 2 > x:
+ return position
+ position += 1
+ last_glyph_x += glyph.advance
+ return position
+
+ def __repr__(self):
+ return '_GlyphBox(%r)' % self.glyphs
+
+
+class _InlineElementBox(_AbstractBox):
+ def __init__(self, element):
+ """Create a glyph run holding a single element.
+ """
+ super(_InlineElementBox, self).__init__(
+ element.ascent, element.descent, element.advance, 1)
+ self.element = element
+ self.placed = False
+
+ def place(self, layout, i, x, y, context):
+ self.element.place(layout, x, y)
+ self.placed = True
+ context.add_box(self)
+
+ def delete(self, layout):
+ # font == element
+ if self.placed:
+ self.element.remove(layout)
+ self.placed = False
+
+ def get_point_in_box(self, position):
+ if position == 0:
+ return 0
+ else:
+ return self.advance
+
+ def get_position_in_box(self, x):
+ if x < self.advance // 2:
+ return 0
+ else:
+ return 1
+
+ def __repr__(self):
+ return '_InlineElementBox(%r)' % self.element
+
+
+class _InvalidRange(object):
+ def __init__(self):
+ self.start = sys.maxsize
+ self.end = 0
+
+ def insert(self, start, length):
+ if self.start >= start:
+ self.start += length
+ if self.end >= start:
+ self.end += length
+ self.invalidate(start, start + length)
+
+ def delete(self, start, end):
+ if self.start > end:
+ self.start -= end - start
+ elif self.start > start:
+ self.start = start
+ if self.end > end:
+ self.end -= end - start
+ elif self.end > start:
+ self.end = start
+
+ def invalidate(self, start, end):
+ if end <= start:
+ return
+ self.start = min(self.start, start)
+ self.end = max(self.end, end)
+
+ def validate(self):
+ start, end = self.start, self.end
+ self.start = sys.maxsize
+ self.end = 0
+ return start, end
+
+ def is_invalid(self):
+ return self.end > self.start
+
+
+# Text group hierarchy
+#
+# top_group [Scrollable]TextLayoutGroup(Group)
+# background_group OrderedGroup(0)
+# foreground_group TextLayoutForegroundGroup(OrderedGroup(1))
+# [font textures] TextLayoutTextureGroup(Group)
+# [...] TextLayoutTextureGroup(Group)
+# foreground_decoration_group
+# TextLayoutForegroundDecorationGroup(OrderedGroup(2))
+
+class TextLayoutGroup(graphics.Group):
+ """Top-level rendering group for :py:func:`~pyglet.text.layout.TextLayout`.
+
+ The blend function is set for glyph rendering (``GL_SRC_ALPHA`` /
+ ``GL_ONE_MINUS_SRC_ALPHA``). The group is shared by all :py:func:`~pyglet.text.layout.TextLayout`
+ instances as it has no internal state.
+ """
+
+ def set_state(self):
+ glPushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT)
+ glEnable(GL_BLEND)
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+
+ def unset_state(self):
+ glPopAttrib()
+
+
+class ScrollableTextLayoutGroup(graphics.Group):
+ """Top-level rendering group for :py:class:`~pyglet.text.layout.ScrollableTextLayout`.
+
+ The group maintains internal state for setting the clipping planes and
+ view transform for scrolling. Because the group has internal state
+ specific to the text layout, the group is never shared.
+ """
+ _clip_x = 0
+ _clip_y = 0
+ _clip_width = 0
+ _clip_height = 0
+ _view_x = 0
+ _view_y = 0
+ translate_x = 0 # x - view_x
+ translate_y = 0 # y - view_y
+
+ def set_state(self):
+ glPushAttrib(GL_ENABLE_BIT | GL_TRANSFORM_BIT | GL_CURRENT_BIT)
+ glEnable(GL_BLEND)
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+ # Disable clipping planes to check culling.
+ glEnable(GL_CLIP_PLANE0)
+ glEnable(GL_CLIP_PLANE1)
+ glEnable(GL_CLIP_PLANE2)
+ glEnable(GL_CLIP_PLANE3)
+ # Left
+ glClipPlane(GL_CLIP_PLANE0, (GLdouble * 4)(1, 0, 0, -(self._clip_x - 1)))
+ # Top
+ glClipPlane(GL_CLIP_PLANE1, (GLdouble * 4)(0, -1, 0, self._clip_y))
+ # Right
+ glClipPlane(GL_CLIP_PLANE2, (GLdouble * 4)(-1, 0, 0, self._clip_x + self._clip_width + 1))
+ # Bottom
+ glClipPlane(GL_CLIP_PLANE3, (GLdouble * 4)(0, 1, 0, -(self._clip_y - self._clip_height)))
+ glTranslatef(self.translate_x, self.translate_y, 0)
+
+ def unset_state(self):
+ glTranslatef(-self.translate_x, -self.translate_y, 0)
+ glPopAttrib()
+
+ def _set_top(self, top):
+ self._clip_y = top
+ self.translate_y = self._clip_y - self._view_y
+
+ top = property(lambda self: self._clip_y, _set_top,
+ doc="""Top edge of the text layout (measured from the
+ bottom of the graphics viewport).
+
+ :type: int
+ """)
+
+ def _set_left(self, left):
+ self._clip_x = left
+ self.translate_x = self._clip_x - self._view_x
+
+ left = property(lambda self: self._clip_x, _set_left,
+ doc="""Left edge of the text layout.
+
+ :type: int
+ """)
+
+ def _set_width(self, width):
+ self._clip_width = width
+
+ width = property(lambda self: self._clip_width, _set_width,
+ doc="""Width of the text layout.
+
+ :type: int
+ """)
+
+ def _set_height(self, height):
+ self._clip_height = height
+
+ height = property(lambda self: self._height, _set_height,
+ doc="""Height of the text layout.
+
+ :type: int
+ """)
+
+ def _set_view_x(self, view_x):
+ self._view_x = view_x
+ self.translate_x = self._clip_x - self._view_x
+
+ view_x = property(lambda self: self._view_x, _set_view_x,
+ doc="""Horizontal scroll offset.
+
+ :type: int
+ """)
+
+ def _set_view_y(self, view_y):
+ self._view_y = view_y
+ self.translate_y = self._clip_y - self._view_y
+
+ view_y = property(lambda self: self._view_y, _set_view_y,
+ doc="""Vertical scroll offset.
+
+ :type: int
+ """)
+
+ def __eq__(self, other):
+ return self is other
+
+ def __hash__(self):
+ return id(self)
+
+
+class TextLayoutForegroundGroup(graphics.OrderedGroup):
+ """Rendering group for foreground elements (glyphs) in all text layouts.
+
+ The group enables ``GL_TEXTURE_2D``.
+ """
+
+ def set_state(self):
+ glEnable(GL_TEXTURE_2D)
+
+ # unset_state not needed, as parent group will pop enable bit
+
+
+class TextLayoutForegroundDecorationGroup(graphics.OrderedGroup):
+ """Rendering group for decorative elements (e.g., glyph underlines) in all
+ text layouts.
+
+ The group disables ``GL_TEXTURE_2D``.
+ """
+
+ def set_state(self):
+ glDisable(GL_TEXTURE_2D)
+
+ # unset_state not needed, as parent group will pop enable bit
+
+
+class TextLayoutTextureGroup(graphics.Group):
+ """Rendering group for a glyph texture in all text layouts.
+
+ The group binds its texture to ``GL_TEXTURE_2D``. The group is shared
+ between all other text layout uses of the same texture.
+ """
+
+ def __init__(self, texture, parent):
+ assert texture.target == GL_TEXTURE_2D
+ super(TextLayoutTextureGroup, self).__init__(parent)
+
+ self.texture = texture
+
+ def set_state(self):
+ glBindTexture(GL_TEXTURE_2D, self.texture.id)
+
+ # unset_state not needed, as next group will either
+ # bind a new texture or pop enable bit.
+
+ def __hash__(self):
+ return hash((self.texture.id, self.parent))
+
+ def __eq__(self, other):
+ return (self.__class__ is other.__class__ and
+ self.texture.id == other.texture.id and
+ self.parent is other.parent)
+
+ def __repr__(self):
+ return '%s(%d, %r)' % (self.__class__.__name__,
+ self.texture.id,
+ self.parent)
+
+
+class TextLayout(object):
+ """Lay out and display documents.
+
+ This class is intended for displaying documents that do not change
+ regularly -- any change will cost some time to lay out the complete
+ document again and regenerate all vertex lists.
+
+ The benefit of this class is that texture state is shared between
+ all layouts of this class. The time to draw one :py:func:`~pyglet.text.layout.TextLayout` may be
+ roughly the same as the time to draw one :py:class:`~pyglet.text.layout.IncrementalTextLayout`; but
+ drawing ten :py:func:`~pyglet.text.layout.TextLayout` objects in one batch is much faster than drawing
+ ten incremental or scrollable text layouts.
+
+ :py:func:`~pyglet.text.Label` and :py:func:`~pyglet.text.HTMLLabel` provide a convenient interface to this class.
+
+ :Ivariables:
+ `content_width` : int
+ Calculated width of the text in the layout. This may overflow
+ the desired width if word-wrapping failed.
+ `content_height` : int
+ Calculated height of the text in the layout.
+ `top_group` : `~pyglet.graphics.Group`
+ Top-level rendering group.
+ `background_group` : `~pyglet.graphics.Group`
+ Rendering group for background color.
+ `foreground_group` : `~pyglet.graphics.Group`
+ Rendering group for glyphs.
+ `foreground_decoration_group` : `~pyglet.graphics.Group`
+ Rendering group for glyph underlines.
+
+ """
+ _document = None
+ _vertex_lists = ()
+ _boxes = ()
+
+ top_group = TextLayoutGroup()
+ background_group = graphics.OrderedGroup(0, top_group)
+ foreground_group = TextLayoutForegroundGroup(1, top_group)
+ foreground_decoration_group = \
+ TextLayoutForegroundDecorationGroup(2, top_group)
+
+ _update_enabled = True
+ _own_batch = False
+ _origin_layout = False # Lay out relative to origin? Otherwise to box.
+
+ def __init__(self, document, width=None, height=None,
+ multiline=False, dpi=None, batch=None, group=None,
+ wrap_lines=True):
+ """Create a text layout.
+
+ :Parameters:
+ `document` : `AbstractDocument`
+ Document to display.
+ `width` : int
+ Width of the layout in pixels, or None
+ `height` : int
+ Height of the layout in pixels, or None
+ `multiline` : bool
+ If False, newline and paragraph characters are ignored, and
+ text is not word-wrapped.
+ If True, text is wrapped only if the `wrap_lines` is True.
+ `dpi` : float
+ Font resolution; defaults to 96.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional graphics batch to add this layout to.
+ `group` : `~pyglet.graphics.Group`
+ Optional rendering group to parent all groups this text layout
+ uses. Note that layouts with different
+ rendered simultaneously in a batch.
+ `wrap_lines` : bool
+ If True and `multiline` is True, the text is word-wrapped using
+ the specified width.
+
+ """
+ self.content_width = 0
+ self.content_height = 0
+
+ self.groups = {}
+ self._init_groups(group)
+
+ if batch is None:
+ batch = graphics.Batch()
+ self._own_batch = True
+ self._batch = batch
+
+ self._width = width
+ if height is not None:
+ self._height = height
+ if multiline:
+ self._multiline = multiline
+
+ self._wrap_lines_flag = wrap_lines
+ self._wrap_lines_invariant()
+
+ if dpi is None:
+ dpi = 96
+ self._dpi = dpi
+ self.document = document
+
+ @property
+ def batch(self):
+ """The Batch that this Layout is assigned to.
+
+ If no Batch is assigned, an internal Batch is
+ created and used.
+
+ :type: :py:class:`~pyglet.graphics.Batch`
+
+ """
+ return self._batch
+
+ @batch.setter
+ def batch(self, batch):
+ if self._batch == batch:
+ return
+
+ if batch is None:
+ self._batch = graphics.Batch()
+ self._own_batch = True
+ self._update()
+ elif batch is not None:
+ self._batch = batch
+ self._own_batch = False
+ self._update()
+
+ def _wrap_lines_invariant(self):
+ self._wrap_lines = self._multiline and self._wrap_lines_flag
+ assert not self._wrap_lines or self._width, \
+ "When the parameters 'multiline' and 'wrap_lines' are True," \
+ "the parameter 'width' must be a number."
+
+ def _parse_distance(self, distance):
+ if distance is None:
+ return None
+ return _parse_distance(distance, self._dpi)
+
+ def begin_update(self):
+ """Indicate that a number of changes to the layout or document
+ are about to occur.
+
+ Changes to the layout or document between calls to `begin_update` and
+ `end_update` do not trigger any costly relayout of text. Relayout of
+ all changes is performed when `end_update` is called.
+
+ Note that between the `begin_update` and `end_update` calls, values
+ such as `content_width` and `content_height` are undefined (i.e., they
+ may or may not be updated to reflect the latest changes).
+ """
+ self._update_enabled = False
+
+ def end_update(self):
+ """Perform pending layout changes since `begin_update`.
+
+ See `begin_update`.
+ """
+ self._update_enabled = True
+ self._update()
+
+ dpi = property(lambda self: self._dpi,
+ doc="""Get DPI used by this layout.
+
+ Read-only.
+
+ :type: float
+ """)
+
+ def delete(self):
+ """Remove this layout from its batch.
+ """
+ for vertex_list in self._vertex_lists:
+ vertex_list.delete()
+ self._vertex_lists = []
+
+ for box in self._boxes:
+ box.delete(self)
+
+ def draw(self):
+ """Draw this text layout.
+
+ Note that this method performs very badly if a batch was supplied to
+ the constructor. If you add this layout to a batch, you should
+ ideally use only the batch's draw method.
+ """
+ if self._own_batch:
+ self._batch.draw()
+ else:
+ self._batch.draw_subset(self._vertex_lists)
+
+ def _init_groups(self, group):
+ if group:
+ self.top_group = TextLayoutGroup(group)
+ self.background_group = graphics.OrderedGroup(0, self.top_group)
+ self.foreground_group = TextLayoutForegroundGroup(1, self.top_group)
+ self.foreground_decoration_group = \
+ TextLayoutForegroundDecorationGroup(2, self.top_group)
+ # Otherwise class groups are (re)used.
+
+ def _get_document(self):
+ return self._document
+
+ def _set_document(self, document):
+ if self._document:
+ self._document.remove_handlers(self)
+ self._uninit_document()
+ document.push_handlers(self)
+ self._document = document
+ self._init_document()
+
+ document = property(_get_document, _set_document,
+ doc="""Document to display.
+
+ For :py:class:`~pyglet.text.layout.IncrementalTextLayout` it is far more efficient to modify a document
+ in-place than to replace the document instance on the layout.
+
+ :type: `AbstractDocument`
+ """)
+
+ def _get_lines(self):
+ len_text = len(self._document.text)
+ glyphs = self._get_glyphs()
+ owner_runs = runlist.RunList(len_text, None)
+ self._get_owner_runs(owner_runs, glyphs, 0, len_text)
+ lines = [line for line in self._flow_glyphs(glyphs, owner_runs,
+ 0, len_text)]
+ self.content_width = 0
+ self._flow_lines(lines, 0, len(lines))
+ return lines
+
+ def _update(self):
+ if not self._update_enabled:
+ return
+
+ for _vertex_list in self._vertex_lists:
+ _vertex_list.delete()
+ for box in self._boxes:
+ box.delete(self)
+ self._vertex_lists = []
+ self._boxes = []
+ self.groups.clear()
+
+ if not self._document or not self._document.text:
+ return
+
+ lines = self._get_lines()
+
+ colors_iter = self._document.get_style_runs('color')
+ background_iter = self._document.get_style_runs('background_color')
+
+ if self._origin_layout:
+ left = top = 0
+ else:
+ left = self._get_left()
+ top = self._get_top(lines)
+
+ context = _StaticLayoutContext(self, self._document,
+ colors_iter, background_iter)
+ for line in lines:
+ self._create_vertex_lists(left + line.x, top + line.y,
+ line.start, line.boxes, context)
+
+ def _get_left(self):
+ if self._multiline:
+ width = self._width if self._wrap_lines else self.content_width
+ else:
+ width = self.content_width
+
+ if self._anchor_x == 'left':
+ return self._x
+ elif self._anchor_x == 'center':
+ return self._x - width // 2
+ elif self._anchor_x == 'right':
+ return self._x - width
+ else:
+ assert False, 'Invalid anchor_x'
+
+ def _get_top(self, lines):
+ if self._height is None:
+ height = self.content_height
+ offset = 0
+ else:
+ height = self._height
+ if self._content_valign == 'top':
+ offset = 0
+ elif self._content_valign == 'bottom':
+ offset = max(0, self._height - self.content_height)
+ elif self._content_valign == 'center':
+ offset = max(0, self._height - self.content_height) // 2
+ else:
+ assert False, 'Invalid content_valign'
+
+ if self._anchor_y == 'top':
+ return self._y - offset
+ elif self._anchor_y == 'baseline':
+ return self._y + lines[0].ascent - offset
+ elif self._anchor_y == 'bottom':
+ return self._y + height - offset
+ elif self._anchor_y == 'center':
+ if len(lines) == 1 and self._height is None:
+ # This "looks" more centered than considering all of the descent.
+ line = lines[0]
+ return self._y + line.ascent // 2 - line.descent // 4
+ else:
+ return self._y + height // 2 - offset
+ else:
+ assert False, 'Invalid anchor_y'
+
+ def _init_document(self):
+ self._update()
+
+ def _uninit_document(self):
+ pass
+
+ def on_insert_text(self, start, text):
+ """Event handler for `AbstractDocument.on_insert_text`.
+
+ The event handler is bound by the text layout; there is no need for
+ applications to interact with this method.
+ """
+ self._init_document()
+
+ def on_delete_text(self, start, end):
+ """Event handler for `AbstractDocument.on_delete_text`.
+
+ The event handler is bound by the text layout; there is no need for
+ applications to interact with this method.
+ """
+ self._init_document()
+
+ def on_style_text(self, start, end, attributes):
+ """Event handler for `AbstractDocument.on_style_text`.
+
+ The event handler is bound by the text layout; there is no need for
+ applications to interact with this method.
+ """
+ self._init_document()
+
+ def _get_glyphs(self):
+ glyphs = []
+ runs = runlist.ZipRunIterator((
+ self._document.get_font_runs(dpi=self._dpi),
+ self._document.get_element_runs()))
+ text = self._document.text
+ for start, end, (font, element) in runs.ranges(0, len(text)):
+ if element:
+ glyphs.append(_InlineElementBox(element))
+ else:
+ glyphs.extend(font.get_glyphs(text[start:end]))
+ return glyphs
+
+ def _get_owner_runs(self, owner_runs, glyphs, start, end):
+ owner = glyphs[start].owner
+ run_start = start
+ # TODO avoid glyph slice on non-incremental
+ for i, glyph in enumerate(glyphs[start:end]):
+ if owner != glyph.owner:
+ owner_runs.set_run(run_start, i + start, owner)
+ owner = glyph.owner
+ run_start = i + start
+ owner_runs.set_run(run_start, end, owner)
+
+ def _flow_glyphs(self, glyphs, owner_runs, start, end):
+ # TODO change flow generator on self, avoiding this conditional.
+ if not self._multiline:
+ for line in self._flow_glyphs_single_line(glyphs, owner_runs,
+ start, end):
+ yield line
+ else:
+ for line in self._flow_glyphs_wrap(glyphs, owner_runs, start, end):
+ yield line
+
+ def _flow_glyphs_wrap(self, glyphs, owner_runs, start, end):
+ """Word-wrap styled text into lines of fixed width.
+
+ Fits `glyphs` in range `start` to `end` into `_Line` s which are
+ then yielded.
+ """
+ owner_iterator = owner_runs.get_run_iterator().ranges(start, end)
+
+ font_iterator = self._document.get_font_runs(dpi=self._dpi)
+
+ align_iterator = runlist.FilteredRunIterator(
+ self._document.get_style_runs('align'),
+ lambda value: value in ('left', 'right', 'center'),
+ 'left')
+ if self._width is None:
+ wrap_iterator = runlist.ConstRunIterator(
+ len(self.document.text), False)
+ else:
+ wrap_iterator = runlist.FilteredRunIterator(
+ self._document.get_style_runs('wrap'),
+ lambda value: value in (True, False, 'char', 'word'),
+ True)
+ margin_left_iterator = runlist.FilteredRunIterator(
+ self._document.get_style_runs('margin_left'),
+ lambda value: value is not None, 0)
+ margin_right_iterator = runlist.FilteredRunIterator(
+ self._document.get_style_runs('margin_right'),
+ lambda value: value is not None, 0)
+ indent_iterator = runlist.FilteredRunIterator(
+ self._document.get_style_runs('indent'),
+ lambda value: value is not None, 0)
+ kerning_iterator = runlist.FilteredRunIterator(
+ self._document.get_style_runs('kerning'),
+ lambda value: value is not None, 0)
+ tab_stops_iterator = runlist.FilteredRunIterator(
+ self._document.get_style_runs('tab_stops'),
+ lambda value: value is not None, [])
+
+ line = _Line(start)
+ line.align = align_iterator[start]
+ line.margin_left = self._parse_distance(margin_left_iterator[start])
+ line.margin_right = self._parse_distance(margin_right_iterator[start])
+ if start == 0 or self.document.text[start - 1] in u'\n\u2029':
+ line.paragraph_begin = True
+ line.margin_left += self._parse_distance(indent_iterator[start])
+ wrap = wrap_iterator[start]
+ if self._wrap_lines:
+ width = self._width - line.margin_left - line.margin_right
+
+ # Current right-most x position in line being laid out.
+ x = 0
+
+ # Boxes accumulated but not yet committed to a line.
+ run_accum = []
+ run_accum_width = 0
+
+ # Amount of whitespace accumulated at end of line
+ eol_ws = 0
+
+ # Iterate over glyph owners (texture states); these form GlyphBoxes,
+ # but broken into lines.
+ font = None
+ for start, end, owner in owner_iterator:
+ font = font_iterator[start]
+
+ # Glyphs accumulated in this owner but not yet committed to a
+ # line.
+ owner_accum = []
+ owner_accum_width = 0
+
+ # Glyphs accumulated in this owner AND also committed to the
+ # current line (some whitespace has followed all of the committed
+ # glyphs).
+ owner_accum_commit = []
+ owner_accum_commit_width = 0
+
+ # Ignore kerning of first glyph on each line
+ nokern = True
+
+ # Current glyph index
+ index = start
+
+ # Iterate over glyphs in this owner run. `text` is the
+ # corresponding character data for the glyph, and is used to find
+ # whitespace and newlines.
+ for (text, glyph) in zip(self.document.text[start:end],
+ glyphs[start:end]):
+ if nokern:
+ kern = 0
+ nokern = False
+ else:
+ kern = self._parse_distance(kerning_iterator[index])
+
+ if wrap != 'char' and text in u'\u0020\u200b\t':
+ # Whitespace: commit pending runs to this line.
+ for run in run_accum:
+ line.add_box(run)
+ run_accum = []
+ run_accum_width = 0
+
+ if text == '\t':
+ # Fix up kern for this glyph to align to the next tab
+ # stop
+ for tab_stop in tab_stops_iterator[index]:
+ tab_stop = self._parse_distance(tab_stop)
+ if tab_stop > x + line.margin_left:
+ break
+ else:
+ # No more tab stops, tab to 100 pixels
+ tab = 50.
+ tab_stop = \
+ (((x + line.margin_left) // tab) + 1) * tab
+ kern = int(tab_stop - x - line.margin_left -
+ glyph.advance)
+
+ owner_accum.append((kern, glyph))
+ owner_accum_commit.extend(owner_accum)
+ owner_accum_commit_width += owner_accum_width + \
+ glyph.advance + kern
+ eol_ws += glyph.advance + kern
+
+ owner_accum = []
+ owner_accum_width = 0
+
+ x += glyph.advance + kern
+ index += 1
+
+ # The index at which the next line will begin (the
+ # current index, because this is the current best
+ # breakpoint).
+ next_start = index
+ else:
+ new_paragraph = text in u'\n\u2029'
+ new_line = (text == u'\u2028') or new_paragraph
+ if (wrap and self._wrap_lines and x + kern + glyph.advance >= width)\
+ or new_line:
+ # Either the pending runs have overflowed the allowed
+ # line width or a newline was encountered. Either
+ # way, the current line must be flushed.
+
+ if new_line or wrap == 'char':
+ # Forced newline or char-level wrapping. Commit
+ # everything pending without exception.
+ for run in run_accum:
+ line.add_box(run)
+ run_accum = []
+ run_accum_width = 0
+ owner_accum_commit.extend(owner_accum)
+ owner_accum_commit_width += owner_accum_width
+ owner_accum = []
+ owner_accum_width = 0
+
+ line.length += 1
+ next_start = index
+ if new_line:
+ next_start += 1
+
+ # Create the _GlyphBox for the committed glyphs in the
+ # current owner.
+ if owner_accum_commit:
+ line.add_box(
+ _GlyphBox(owner, font, owner_accum_commit,
+ owner_accum_commit_width))
+ owner_accum_commit = []
+ owner_accum_commit_width = 0
+
+ if new_line and not line.boxes:
+ # Empty line: give it the current font's default
+ # line-height.
+ line.ascent = font.ascent
+ line.descent = font.descent
+
+ # Flush the line, unless nothing got committed, in
+ # which case it's a really long string of glyphs
+ # without any breakpoints (in which case it will be
+ # flushed at the earliest breakpoint, not before
+ # something is committed).
+ if line.boxes or new_line:
+ # Trim line width of whitespace on right-side.
+ line.width -= eol_ws
+ if new_paragraph:
+ line.paragraph_end = True
+ yield line
+ line = _Line(next_start)
+ line.align = align_iterator[next_start]
+ line.margin_left = self._parse_distance(
+ margin_left_iterator[next_start])
+ line.margin_right = self._parse_distance(
+ margin_right_iterator[next_start])
+ if new_paragraph:
+ line.paragraph_begin = True
+
+ # Remove kern from first glyph of line
+ if run_accum and hasattr(run_accum, 'glyphs') and run_accum.glyphs:
+ k, g = run_accum[0].glyphs[0]
+ run_accum[0].glyphs[0] = (0, g)
+ run_accum_width -= k
+ elif owner_accum:
+ k, g = owner_accum[0]
+ owner_accum[0] = (0, g)
+ owner_accum_width -= k
+ else:
+ nokern = True
+
+ x = run_accum_width + owner_accum_width
+ if self._wrap_lines:
+ width = (self._width -
+ line.margin_left - line.margin_right)
+
+ if isinstance(glyph, _AbstractBox):
+ # Glyph is already in a box. XXX Ignore kern?
+ run_accum.append(glyph)
+ run_accum_width += glyph.advance
+ x += glyph.advance
+ elif new_paragraph:
+ # New paragraph started, update wrap style
+ wrap = wrap_iterator[next_start]
+ line.margin_left += \
+ self._parse_distance(indent_iterator[next_start])
+ if self._wrap_lines:
+ width = (self._width -
+ line.margin_left - line.margin_right)
+ elif not new_line:
+ # If the glyph was any non-whitespace, non-newline
+ # character, add it to the pending run.
+ owner_accum.append((kern, glyph))
+ owner_accum_width += glyph.advance + kern
+ x += glyph.advance + kern
+ index += 1
+ eol_ws = 0
+
+ # The owner run is finished; create GlyphBoxes for the committed
+ # and pending glyphs.
+ if owner_accum_commit:
+ line.add_box(_GlyphBox(owner, font, owner_accum_commit,
+ owner_accum_commit_width))
+ if owner_accum:
+ run_accum.append(_GlyphBox(owner, font, owner_accum,
+ owner_accum_width))
+ run_accum_width += owner_accum_width
+
+ # All glyphs have been processed: commit everything pending and flush
+ # the final line.
+ for run in run_accum:
+ line.add_box(run)
+
+ if not line.boxes:
+ # Empty line gets font's line-height
+ if font is None:
+ font = self._document.get_font(0, dpi=self._dpi)
+ line.ascent = font.ascent
+ line.descent = font.descent
+
+ yield line
+
+ def _flow_glyphs_single_line(self, glyphs, owner_runs, start, end):
+ owner_iterator = owner_runs.get_run_iterator().ranges(start, end)
+ font_iterator = self.document.get_font_runs(dpi=self._dpi)
+ kern_iterator = runlist.FilteredRunIterator(
+ self.document.get_style_runs('kerning'),
+ lambda value: value is not None, 0)
+
+ line = _Line(start)
+ font = font_iterator[0]
+
+ for start, end, owner in owner_iterator:
+ font = font_iterator[start]
+ width = 0
+ owner_glyphs = []
+ for kern_start, kern_end, kern in kern_iterator.ranges(start, end):
+ gs = glyphs[kern_start:kern_end]
+ width += sum([g.advance for g in gs])
+ width += kern * (kern_end - kern_start)
+ owner_glyphs.extend(zip([kern] * (kern_end - kern_start), gs))
+ if owner is None:
+ # Assume glyphs are already boxes.
+ for kern, glyph in owner_glyphs:
+ line.add_box(glyph)
+ else:
+ line.add_box(_GlyphBox(owner, font, owner_glyphs, width))
+
+ if not line.boxes:
+ line.ascent = font.ascent
+ line.descent = font.descent
+
+ line.paragraph_begin = line.paragraph_end = True
+
+ yield line
+
+ def _flow_lines(self, lines, start, end):
+ margin_top_iterator = runlist.FilteredRunIterator(
+ self._document.get_style_runs('margin_top'),
+ lambda value: value is not None, 0)
+ margin_bottom_iterator = runlist.FilteredRunIterator(
+ self._document.get_style_runs('margin_bottom'),
+ lambda value: value is not None, 0)
+ line_spacing_iterator = self._document.get_style_runs('line_spacing')
+ leading_iterator = runlist.FilteredRunIterator(
+ self._document.get_style_runs('leading'),
+ lambda value: value is not None, 0)
+
+ if start == 0:
+ y = 0
+ else:
+ line = lines[start - 1]
+ line_spacing = \
+ self._parse_distance(line_spacing_iterator[line.start])
+ leading = \
+ self._parse_distance(leading_iterator[line.start])
+
+ y = line.y
+ if line_spacing is None:
+ y += line.descent
+ if line.paragraph_end:
+ y -= self._parse_distance(margin_bottom_iterator[line.start])
+
+ line_index = start
+ for line in lines[start:]:
+ if line.paragraph_begin:
+ y -= self._parse_distance(margin_top_iterator[line.start])
+ line_spacing = \
+ self._parse_distance(line_spacing_iterator[line.start])
+ leading = self._parse_distance(leading_iterator[line.start])
+ else:
+ y -= leading
+
+ if line_spacing is None:
+ y -= line.ascent
+ else:
+ y -= line_spacing
+ if line.align == 'left' or line.width > self.width:
+ line.x = line.margin_left
+ elif line.align == 'center':
+ line.x = (self.width - line.margin_left - line.margin_right
+ - line.width) // 2 + line.margin_left
+ elif line.align == 'right':
+ line.x = self.width - line.margin_right - line.width
+
+ self.content_width = max(self.content_width,
+ line.width + line.margin_left)
+
+ if line.y == y and line_index >= end:
+ # Early exit: all invalidated lines have been reflowed and the
+ # next line has no change (therefore subsequent lines do not
+ # need to be changed).
+ break
+ line.y = y
+
+ if line_spacing is None:
+ y += line.descent
+ if line.paragraph_end:
+ y -= self._parse_distance(margin_bottom_iterator[line.start])
+
+ line_index += 1
+ else:
+ self.content_height = -y
+
+ return line_index
+
+ def _create_vertex_lists(self, x, y, i, boxes, context):
+ for box in boxes:
+ box.place(self, i, x, y, context)
+ x += box.advance
+ i += box.length
+
+ _x = 0
+
+ def _set_x(self, x):
+ if self._boxes:
+ self._x = x
+ self._update()
+ else:
+ dx = x - self._x
+ l_dx = lambda x: int(x + dx)
+ for vertex_list in self._vertex_lists:
+ vertices = vertex_list.vertices[:]
+ vertices[::2] = list(map(l_dx, vertices[::2]))
+ vertex_list.vertices[:] = vertices
+ self._x = x
+
+ def _get_x(self):
+ return self._x
+
+ x = property(_get_x, _set_x,
+ doc="""X coordinate of the layout.
+
+ See also :py:attr:`~pyglet.text.layout.TextLayout.anchor_x`.
+
+ :type: int
+ """)
+
+ _y = 0
+
+ def _set_y(self, y):
+ if self._boxes:
+ self._y = y
+ self._update()
+ else:
+ dy = y - self._y
+ l_dy = lambda y: int(y + dy)
+ for vertex_list in self._vertex_lists:
+ vertices = vertex_list.vertices[:]
+ vertices[1::2] = list(map(l_dy, vertices[1::2]))
+ vertex_list.vertices[:] = vertices
+ self._y = y
+
+ def _get_y(self):
+ return self._y
+
+ y = property(_get_y, _set_y,
+ doc="""Y coordinate of the layout.
+
+ See also `anchor_y`.
+
+ :type: int
+ """)
+
+ _width = None
+
+ def _set_width(self, width):
+ self._width = width
+ self._wrap_lines_invariant()
+ self._update()
+
+ def _get_width(self):
+ return self._width
+
+ width = property(_get_width, _set_width,
+ doc="""Width of the layout.
+
+ This property has no effect if `multiline` is False or `wrap_lines` is False.
+
+ :type: int
+ """)
+
+ _height = None
+
+ def _set_height(self, height):
+ self._height = height
+ self._update()
+
+ def _get_height(self):
+ return self._height
+
+ height = property(_get_height, _set_height,
+ doc="""Height of the layout.
+
+ :type: int
+ """)
+
+ _multiline = False
+
+ def _set_multiline(self, multiline):
+ self._multiline = multiline
+ self._wrap_lines_invariant()
+ self._update()
+
+ def _get_multiline(self):
+ return self._multiline
+
+ multiline = property(_get_multiline, _set_multiline,
+ doc="""Set if multiline layout is enabled.
+
+ If multiline is False, newline and paragraph characters are ignored and
+ text is not word-wrapped.
+ If True, the text is word-wrapped only if the `wrap_lines` is True.
+
+ :type: bool
+ """)
+
+ _anchor_x = 'left'
+
+ def _set_anchor_x(self, anchor_x):
+ self._anchor_x = anchor_x
+ self._update()
+
+ def _get_anchor_x(self):
+ return self._anchor_x
+
+ anchor_x = property(_get_anchor_x, _set_anchor_x,
+ doc="""Horizontal anchor alignment.
+
+ This property determines the meaning of the `x` coordinate. It is one of
+ the enumerants:
+
+ ``"left"`` (default)
+ The X coordinate gives the position of the left edge of the layout.
+ ``"center"``
+ The X coordinate gives the position of the center of the layout.
+ ``"right"``
+ The X coordinate gives the position of the right edge of the layout.
+
+ For the purposes of calculating the position resulting from this
+ alignment, the width of the layout is taken to be `width` if `multiline`
+ is True and `wrap_lines` is True, otherwise `content_width`.
+
+ :type: str
+ """)
+
+ _anchor_y = 'bottom'
+
+ def _set_anchor_y(self, anchor_y):
+ self._anchor_y = anchor_y
+ self._update()
+
+ def _get_anchor_y(self):
+ return self._anchor_y
+
+ anchor_y = property(_get_anchor_y, _set_anchor_y,
+ doc="""Vertical anchor alignment.
+
+ This property determines the meaning of the `y` coordinate. It is one of
+ the enumerants:
+
+ ``"top"``
+ The Y coordinate gives the position of the top edge of the layout.
+ ``"center"``
+ The Y coordinate gives the position of the center of the layout.
+ ``"baseline"``
+ The Y coordinate gives the position of the baseline of the first
+ line of text in the layout.
+ ``"bottom"`` (default)
+ The Y coordinate gives the position of the bottom edge of the layout.
+
+ For the purposes of calculating the position resulting from this
+ alignment, the height of the layout is taken to be the smaller of
+ `height` and `content_height`.
+
+ See also `content_valign`.
+
+ :type: str
+ """)
+
+ _content_valign = 'top'
+
+ def _set_content_valign(self, content_valign):
+ self._content_valign = content_valign
+ self._update()
+
+ def _get_content_valign(self):
+ return self._content_valign
+
+ content_valign = property(_get_content_valign, _set_content_valign,
+ doc="""Vertical alignment of content within
+ larger layout box.
+
+ This property determines how content is positioned within the layout
+ box when ``content_height`` is less than ``height``. It is one
+ of the enumerants:
+
+ ``top`` (default)
+ Content is aligned to the top of the layout box.
+ ``center``
+ Content is centered vertically within the layout box.
+ ``bottom``
+ Content is aligned to the bottom of the layout box.
+
+ This property has no effect when ``content_height`` is greater
+ than ``height`` (in which case the content is aligned to the top) or when
+ ``height`` is ``None`` (in which case there is no vertical layout box
+ dimension).
+
+ :type: str
+ """)
+
+
+class ScrollableTextLayout(TextLayout):
+ """Display text in a scrollable viewport.
+
+ This class does not display a scrollbar or handle scroll events; it merely
+ clips the text that would be drawn in :py:func:`~pyglet.text.layout.TextLayout` to the bounds of the
+ layout given by `x`, `y`, `width` and `height`; and offsets the text by a
+ scroll offset.
+
+ Use `view_x` and `view_y` to scroll the text within the viewport.
+ """
+ _origin_layout = True
+
+ def __init__(self, document, width, height, multiline=False, dpi=None,
+ batch=None, group=None, wrap_lines=True):
+ super(ScrollableTextLayout, self).__init__(
+ document, width, height, multiline, dpi, batch, group, wrap_lines)
+ self.top_group.width = self._width
+ self.top_group.height = self._height
+
+ def _init_groups(self, group):
+ # Scrollable layout never shares group becauase of translation.
+ self.top_group = ScrollableTextLayoutGroup(group)
+ self.background_group = graphics.OrderedGroup(0, self.top_group)
+ self.foreground_group = TextLayoutForegroundGroup(1, self.top_group)
+ self.foreground_decoration_group = \
+ TextLayoutForegroundDecorationGroup(2, self.top_group)
+
+ def _set_x(self, x):
+ self._x = x
+ self.top_group.left = self._get_left()
+
+ def _get_x(self):
+ return self._x
+
+ x = property(_get_x, _set_x)
+
+ def _set_y(self, y):
+ self._y = y
+ self.top_group.top = self._get_top(self._get_lines())
+
+ def _get_y(self):
+ return self._y
+
+ y = property(_get_y, _set_y)
+
+ def _set_width(self, width):
+ super(ScrollableTextLayout, self)._set_width(width)
+ self.top_group.left = self._get_left()
+ self.top_group.width = self._width
+
+ def _get_width(self):
+ return self._width
+
+ width = property(_get_width, _set_width)
+
+ def _set_height(self, height):
+ super(ScrollableTextLayout, self)._set_height(height)
+ self.top_group.top = self._get_top(self._get_lines())
+ self.top_group.height = self._height
+
+ def _get_height(self):
+ return self._height
+
+ height = property(_get_height, _set_height)
+
+ def _set_anchor_x(self, anchor_x):
+ self._anchor_x = anchor_x
+ self.top_group.left = self._get_left()
+
+ def _get_anchor_x(self):
+ return self._anchor_x
+
+ anchor_x = property(_get_anchor_x, _set_anchor_x)
+
+ def _set_anchor_y(self, anchor_y):
+ self._anchor_y = anchor_y
+ self.top_group.top = self._get_top(self._get_lines())
+
+ def _get_anchor_y(self):
+ return self._anchor_y
+
+ anchor_y = property(_get_anchor_y, _set_anchor_y)
+
+ # Offset of content within viewport
+
+ def _set_view_x(self, view_x):
+ view_x = max(0, min(self.content_width - self.width, view_x))
+ self.top_group.view_x = view_x
+
+ def _get_view_x(self):
+ return self.top_group.view_x
+
+ view_x = property(_get_view_x, _set_view_x,
+ doc="""Horizontal scroll offset.
+
+ The initial value is 0, and the left edge of the text will touch the left
+ side of the layout bounds. A positive value causes the text to "scroll"
+ to the right. Values are automatically clipped into the range
+ ``[0, content_width - width]``
+
+ :type: int
+ """)
+
+ def _set_view_y(self, view_y):
+ # view_y must be negative.
+ view_y = min(0, max(self.height - self.content_height, view_y))
+ self.top_group.view_y = view_y
+
+ def _get_view_y(self):
+ return self.top_group.view_y
+
+ view_y = property(_get_view_y, _set_view_y,
+ doc="""Vertical scroll offset.
+
+ The initial value is 0, and the top of the text will touch the top of the
+ layout bounds (unless the content height is less than the layout height,
+ in which case `content_valign` is used).
+
+ A negative value causes the text to "scroll" upwards. Values outside of
+ the range ``[height - content_height, 0]`` are automatically clipped in
+ range.
+
+ :type: int
+ """)
+
+
+class IncrementalTextLayout(ScrollableTextLayout, event.EventDispatcher):
+ """Displayed text suitable for interactive editing and/or scrolling
+ large documents.
+
+ Unlike :py:func:`~pyglet.text.layout.TextLayout` and :py:class:`~pyglet.text.layout.ScrollableTextLayout`, this class generates
+ vertex lists only for lines of text that are visible. As the document is
+ scrolled, vertex lists are deleted and created as appropriate to keep
+ video memory usage to a minimum and improve rendering speed.
+
+ Changes to the document are quickly reflected in this layout, as only the
+ affected line(s) are reflowed. Use `begin_update` and `end_update` to
+ further reduce the amount of processing required.
+
+ The layout can also display a text selection (text with a different
+ background color). The :py:class:`~pyglet.text.caret.Caret` class implements a visible text cursor and
+ provides event handlers for scrolling, selecting and editing text in an
+ incremental text layout.
+ """
+ _selection_start = 0
+ _selection_end = 0
+ _selection_color = [255, 255, 255, 255]
+ _selection_background_color = [46, 106, 197, 255]
+
+ def __init__(self, document, width, height, multiline=False, dpi=None,
+ batch=None, group=None, wrap_lines=True):
+ event.EventDispatcher.__init__(self)
+ self.glyphs = []
+ self.lines = []
+
+ self.invalid_glyphs = _InvalidRange()
+ self.invalid_flow = _InvalidRange()
+ self.invalid_lines = _InvalidRange()
+ self.invalid_style = _InvalidRange()
+ self.invalid_vertex_lines = _InvalidRange()
+ self.visible_lines = _InvalidRange()
+
+ self.owner_runs = runlist.RunList(0, None)
+
+ ScrollableTextLayout.__init__(self,
+ document, width, height, multiline, dpi, batch, group,
+ wrap_lines)
+
+ self.top_group.width = width
+ self.top_group.left = self._get_left()
+ self.top_group.height = height
+ self.top_group.top = self._get_top(self._get_lines())
+
+ def _init_document(self):
+ assert self._document, \
+ 'Cannot remove document from IncrementalTextLayout'
+ self.on_insert_text(0, self._document.text)
+
+ def _uninit_document(self):
+ self.on_delete_text(0, len(self._document.text))
+
+ def _get_lines(self):
+ return self.lines
+
+ def delete(self):
+ for line in self.lines:
+ line.delete(self)
+ self._batch = None
+ if self._document:
+ self._document.remove_handlers(self)
+ self._document = None
+
+ def on_insert_text(self, start, text):
+ len_text = len(text)
+ self.glyphs[start:start] = [None] * len_text
+
+ self.invalid_glyphs.insert(start, len_text)
+ self.invalid_flow.insert(start, len_text)
+ self.invalid_style.insert(start, len_text)
+
+ self.owner_runs.insert(start, len_text)
+
+ for line in self.lines:
+ if line.start >= start:
+ line.start += len_text
+
+ self._update()
+
+ def on_delete_text(self, start, end):
+ self.glyphs[start:end] = []
+
+ self.invalid_glyphs.delete(start, end)
+ self.invalid_flow.delete(start, end)
+ self.invalid_style.delete(start, end)
+
+ self.owner_runs.delete(start, end)
+
+ size = end - start
+ for line in self.lines:
+ if line.start > start:
+ line.start = max(line.start - size, start)
+
+ if start == 0:
+ self.invalid_flow.invalidate(0, 1)
+ else:
+ self.invalid_flow.invalidate(start - 1, start)
+
+ self._update()
+
+ def on_style_text(self, start, end, attributes):
+ if ('font_name' in attributes or
+ 'font_size' in attributes or
+ 'bold' in attributes or
+ 'italic' in attributes):
+ self.invalid_glyphs.invalidate(start, end)
+ elif False: # Attributes that change flow
+ self.invalid_flow.invalidate(start, end)
+ elif ('color' in attributes or
+ 'background_color' in attributes):
+ self.invalid_style.invalidate(start, end)
+
+ self._update()
+
+ def _update(self):
+ if not self._update_enabled:
+ return
+
+ trigger_update_event = (self.invalid_glyphs.is_invalid() or
+ self.invalid_flow.is_invalid() or
+ self.invalid_lines.is_invalid())
+
+ # Special care if there is no text:
+ if not self.glyphs:
+ for line in self.lines:
+ line.delete(self)
+ del self.lines[:]
+ self.lines.append(_Line(0))
+ font = self.document.get_font(0, dpi=self._dpi)
+ self.lines[0].ascent = font.ascent
+ self.lines[0].descent = font.descent
+ self.lines[0].paragraph_begin = self.lines[0].paragraph_end = True
+ self.invalid_lines.invalidate(0, 1)
+
+ self._update_glyphs()
+ self._update_flow_glyphs()
+ self._update_flow_lines()
+ self._update_visible_lines()
+ self._update_vertex_lists()
+ self.top_group.top = self._get_top(self.lines)
+
+ # Reclamp view_y in case content height has changed and reset top of
+ # content.
+ self.view_y = self.view_y
+ self.top_group.top = self._get_top(self._get_lines())
+
+ if trigger_update_event:
+ self.dispatch_event('on_layout_update')
+
+ def _update_glyphs(self):
+ invalid_start, invalid_end = self.invalid_glyphs.validate()
+
+ if invalid_end - invalid_start <= 0:
+ return
+
+ # Find grapheme breaks and extend glyph range to encompass.
+ text = self.document.text
+ while invalid_start > 0:
+ if _grapheme_break(text[invalid_start - 1], text[invalid_start]):
+ break
+ invalid_start -= 1
+
+ len_text = len(text)
+ while invalid_end < len_text:
+ if _grapheme_break(text[invalid_end - 1], text[invalid_end]):
+ break
+ invalid_end += 1
+
+ # Update glyphs
+ runs = runlist.ZipRunIterator((
+ self._document.get_font_runs(dpi=self._dpi),
+ self._document.get_element_runs()))
+ for start, end, (font, element) in \
+ runs.ranges(invalid_start, invalid_end):
+ if element:
+ self.glyphs[start] = _InlineElementBox(element)
+ else:
+ text = self.document.text[start:end]
+ self.glyphs[start:end] = font.get_glyphs(text)
+
+ # Update owner runs
+ self._get_owner_runs(
+ self.owner_runs, self.glyphs, invalid_start, invalid_end)
+
+ # Updated glyphs need flowing
+ self.invalid_flow.invalidate(invalid_start, invalid_end)
+
+ def _update_flow_glyphs(self):
+ invalid_start, invalid_end = self.invalid_flow.validate()
+
+ if invalid_end - invalid_start <= 0:
+ return
+
+ # Find first invalid line
+ line_index = 0
+ for i, line in enumerate(self.lines):
+ if line.start >= invalid_start:
+ break
+ line_index = i
+
+ # Flow from previous line; fixes issue with adding a space into
+ # overlong line (glyphs before space would then flow back onto
+ # previous line). TODO Could optimise this by keeping track of where
+ # the overlong lines are.
+ line_index = max(0, line_index - 1)
+
+ # (No need to find last invalid line; the update loop below stops
+ # calling the flow generator when no more changes are necessary.)
+
+ try:
+ line = self.lines[line_index]
+ invalid_start = min(invalid_start, line.start)
+ line.delete(self)
+ line = self.lines[line_index] = _Line(invalid_start)
+ self.invalid_lines.invalidate(line_index, line_index + 1)
+ except IndexError:
+ line_index = 0
+ invalid_start = 0
+ line = _Line(0)
+ self.lines.append(line)
+ self.invalid_lines.insert(0, 1)
+
+ content_width_invalid = False
+ next_start = invalid_start
+
+ for line in self._flow_glyphs(self.glyphs, self.owner_runs,
+ invalid_start, len(self._document.text)):
+ try:
+ old_line = self.lines[line_index]
+ old_line.delete(self)
+ old_line_width = old_line.width + old_line.margin_left
+ new_line_width = line.width + line.margin_left
+ if (old_line_width == self.content_width and
+ new_line_width < old_line_width):
+ content_width_invalid = True
+ self.lines[line_index] = line
+ self.invalid_lines.invalidate(line_index, line_index + 1)
+ except IndexError:
+ self.lines.append(line)
+ self.invalid_lines.insert(line_index, 1)
+
+ next_start = line.start + line.length
+ line_index += 1
+
+ try:
+ next_line = self.lines[line_index]
+ if next_start == next_line.start and next_start > invalid_end:
+ # No more lines need to be modified, early exit.
+ break
+ except IndexError:
+ pass
+ else:
+ # The last line is at line_index - 1, if there are any more lines
+ # after that they are stale and need to be deleted.
+ if next_start == len(self._document.text) and line_index > 0:
+ for line in self.lines[line_index:]:
+ old_line_width = old_line.width + old_line.margin_left
+ if old_line_width == self.content_width:
+ content_width_invalid = True
+ line.delete(self)
+ del self.lines[line_index:]
+
+ if content_width_invalid:
+ # Rescan all lines to look for the new maximum content width
+ content_width = 0
+ for line in self.lines:
+ content_width = max(line.width + line.margin_left,
+ content_width)
+ self.content_width = content_width
+
+ def _update_flow_lines(self):
+ invalid_start, invalid_end = self.invalid_lines.validate()
+ if invalid_end - invalid_start <= 0:
+ return
+
+ invalid_end = self._flow_lines(self.lines, invalid_start, invalid_end)
+
+ # Invalidate lines that need new vertex lists.
+ self.invalid_vertex_lines.invalidate(invalid_start, invalid_end)
+
+ def _update_visible_lines(self):
+ start = sys.maxsize
+ end = 0
+ for i, line in enumerate(self.lines):
+ if line.y + line.descent < self.view_y:
+ start = min(start, i)
+ if line.y + line.ascent > self.view_y - self.height:
+ end = max(end, i) + 1
+
+ # Delete newly invisible lines
+ for i in range(self.visible_lines.start, min(start, len(self.lines))):
+ self.lines[i].delete(self)
+ for i in range(end, min(self.visible_lines.end, len(self.lines))):
+ self.lines[i].delete(self)
+
+ # Invalidate newly visible lines
+ self.invalid_vertex_lines.invalidate(start, self.visible_lines.start)
+ self.invalid_vertex_lines.invalidate(self.visible_lines.end, end)
+
+ self.visible_lines.start = start
+ self.visible_lines.end = end
+
+ def _update_vertex_lists(self):
+ # Find lines that have been affected by style changes
+ style_invalid_start, style_invalid_end = self.invalid_style.validate()
+ self.invalid_vertex_lines.invalidate(
+ self.get_line_from_position(style_invalid_start),
+ self.get_line_from_position(style_invalid_end) + 1)
+
+ invalid_start, invalid_end = self.invalid_vertex_lines.validate()
+ if invalid_end - invalid_start <= 0:
+ return
+
+ colors_iter = self.document.get_style_runs('color')
+ background_iter = self.document.get_style_runs('background_color')
+ if self._selection_end - self._selection_start > 0:
+ colors_iter = runlist.OverriddenRunIterator(
+ colors_iter,
+ self._selection_start,
+ self._selection_end,
+ self._selection_color)
+ background_iter = runlist.OverriddenRunIterator(
+ background_iter,
+ self._selection_start,
+ self._selection_end,
+ self._selection_background_color)
+
+ context = _IncrementalLayoutContext(self, self._document,
+ colors_iter, background_iter)
+
+ for line in self.lines[invalid_start:invalid_end]:
+ line.delete(self)
+ context.line = line
+ y = line.y
+
+ # Early out if not visible
+ if y + line.descent > self.view_y:
+ continue
+ elif y + line.ascent < self.view_y - self.height:
+ break
+
+ self._create_vertex_lists(line.x, y, line.start,
+ line.boxes, context)
+
+ # Invalidate everything when width changes
+
+ def _set_width(self, width):
+ if width == self._width:
+ return
+
+ self.invalid_flow.invalidate(0, len(self.document.text))
+ super(IncrementalTextLayout, self)._set_width(width)
+
+ def _get_width(self):
+ return self._width
+
+ width = property(_get_width, _set_width)
+
+ # Recalculate visible lines when height changes
+ def _set_height(self, height):
+ if height == self._height:
+ return
+
+ super(IncrementalTextLayout, self)._set_height(height)
+ if self._update_enabled:
+ self._update_visible_lines()
+ self._update_vertex_lists()
+
+ def _get_height(self):
+ return self._height
+
+ height = property(_get_height, _set_height)
+
+ def _set_multiline(self, multiline):
+ self.invalid_flow.invalidate(0, len(self.document.text))
+ super(IncrementalTextLayout, self)._set_multiline(multiline)
+
+ def _get_multiline(self):
+ return self._multiline
+
+ multiline = property(_get_multiline, _set_multiline)
+
+ # Invalidate invisible/visible lines when y scrolls
+
+ def _set_view_y(self, view_y):
+ # view_y must be negative.
+ super(IncrementalTextLayout, self)._set_view_y(view_y)
+ self._update_visible_lines()
+ self._update_vertex_lists()
+
+ def _get_view_y(self):
+ return self.top_group.view_y
+
+ view_y = property(_get_view_y, _set_view_y)
+
+ # Visible selection
+
+ def set_selection(self, start, end):
+ """Set the text selection range.
+
+ If ``start`` equals ``end`` no selection will be visible.
+
+ :Parameters:
+ `start` : int
+ Starting character position of selection.
+ `end` : int
+ End of selection, exclusive.
+
+ """
+ start = max(0, start)
+ end = min(end, len(self.document.text))
+ if start == self._selection_start and end == self._selection_end:
+ return
+
+ if end > self._selection_start and start < self._selection_end:
+ # Overlapping, only invalidate difference
+ self.invalid_style.invalidate(min(start, self._selection_start),
+ max(start, self._selection_start))
+ self.invalid_style.invalidate(min(end, self._selection_end),
+ max(end, self._selection_end))
+ else:
+ # Non-overlapping, invalidate both ranges
+ self.invalid_style.invalidate(self._selection_start,
+ self._selection_end)
+ self.invalid_style.invalidate(start, end)
+
+ self._selection_start = start
+ self._selection_end = end
+
+ self._update()
+
+ selection_start = property(
+ lambda self: self._selection_start,
+ lambda self, v: self.set_selection(v, self._selection_end),
+ doc="""Starting position of the active selection.
+
+ :see: `set_selection`
+
+ :type: int
+ """)
+
+ selection_end = property(
+ lambda self: self._selection_end,
+ lambda self, v: self.set_selection(self._selection_start, v),
+ doc="""End position of the active selection (exclusive).
+
+ :see: `set_selection`
+
+ :type: int
+ """)
+
+ def _get_selection_color(self):
+ return self._selection_color
+
+ def _set_selection_color(self, color):
+ self._selection_color = color
+ self.invalid_style.invalidate(self._selection_start,
+ self._selection_end)
+
+ selection_color = property(_get_selection_color, _set_selection_color,
+ doc="""Text color of active selection.
+
+ The color is an RGBA tuple with components in range [0, 255].
+
+ :type: (int, int, int, int)
+ """)
+
+ def _get_selection_background_color(self):
+ return self._selection_background_color
+
+ def _set_selection_background_color(self, background_color):
+ self._selection_background_color = background_color
+ self.invalid_style.invalidate(self._selection_start,
+ self._selection_end)
+
+ selection_background_color = property(_get_selection_background_color,
+ _set_selection_background_color,
+ doc="""Background color of active
+ selection.
+
+ The color is an RGBA tuple with components in range [0, 255].
+
+ :type: (int, int, int, int)
+ """)
+
+ # Coordinate translation
+
+ def get_position_from_point(self, x, y):
+ """Get the closest document position to a point.
+
+ :Parameters:
+ `x` : int
+ X coordinate
+ `y` : int
+ Y coordinate
+
+ """
+ line = self.get_line_from_point(x, y)
+ return self.get_position_on_line(line, x)
+
+ def get_point_from_position(self, position, line=None):
+ """Get the X, Y coordinates of a position in the document.
+
+ The position that ends a line has an ambiguous point: it can be either
+ the end of the line, or the beginning of the next line. You may
+ optionally specify a line index to disambiguate the case.
+
+ The resulting Y coordinate gives the baseline of the line.
+
+ :Parameters:
+ `position` : int
+ Character position within document.
+ `line` : int
+ Line index.
+
+ :rtype: (int, int)
+ :return: (x, y)
+ """
+ if line is None:
+ line = self.lines[0]
+ for next_line in self.lines:
+ if next_line.start > position:
+ break
+ line = next_line
+ else:
+ line = self.lines[line]
+
+ x = line.x
+
+ baseline = self._document.get_style('baseline', max(0, position - 1))
+ if baseline is None:
+ baseline = 0
+ else:
+ baseline = self._parse_distance(baseline)
+
+ position -= line.start
+ for box in line.boxes:
+ if position - box.length <= 0:
+ x += box.get_point_in_box(position)
+ break
+ position -= box.length
+ x += box.advance
+
+ return (x + self.top_group.translate_x,
+ line.y + self.top_group.translate_y + baseline)
+
+ def get_line_from_point(self, x, y):
+ """Get the closest line index to a point.
+
+ :Parameters:
+ `x` : int
+ X coordinate.
+ `y` : int
+ Y coordinate.
+
+ :rtype: int
+ """
+ x -= self.top_group.translate_x
+ y -= self.top_group.translate_y
+
+ line_index = 0
+ for line in self.lines:
+ if y > line.y + line.descent:
+ break
+ line_index += 1
+ if line_index >= len(self.lines):
+ line_index = len(self.lines) - 1
+ return line_index
+
+ def get_point_from_line(self, line):
+ """Get the X, Y coordinates of a line index.
+
+ :Parameters:
+ `line` : int
+ Line index.
+
+ :rtype: (int, int)
+ :return: (x, y)
+ """
+ line = self.lines[line]
+ return (line.x + self.top_group.translate_x,
+ line.y + self.top_group.translate_y)
+
+ def get_line_from_position(self, position):
+ """Get the line index of a character position in the document.
+
+ :Parameters:
+ `position` : int
+ Document position.
+
+ :rtype: int
+ """
+ line = -1
+ for next_line in self.lines:
+ if next_line.start > position:
+ break
+ line += 1
+ return line
+
+ def get_position_from_line(self, line):
+ """Get the first document character position of a given line index.
+
+ :Parameters:
+ `line` : int
+ Line index.
+
+ :rtype: int
+ """
+ return self.lines[line].start
+
+ def get_position_on_line(self, line, x):
+ """Get the closest document position for a given line index and X
+ coordinate.
+
+ :Parameters:
+ `line` : int
+ Line index.
+ `x` : int
+ X coordinate.
+
+ :rtype: int
+ """
+ line = self.lines[line]
+ x -= self.top_group.translate_x
+
+ position = line.start
+ last_glyph_x = line.x
+ for box in line.boxes:
+ if 0 <= x - last_glyph_x < box.advance:
+ position += box.get_position_in_box(x - last_glyph_x)
+ break
+ last_glyph_x += box.advance
+ position += box.length
+
+ return position
+
+ def get_line_count(self):
+ """Get the number of lines in the text layout.
+
+ :rtype: int
+ """
+ return len(self.lines)
+
+ def ensure_line_visible(self, line):
+ """Adjust `view_y` so that the line with the given index is visible.
+
+ :Parameters:
+ `line` : int
+ Line index.
+
+ """
+ line = self.lines[line]
+ y1 = line.y + line.ascent
+ y2 = line.y + line.descent
+ if y1 > self.view_y:
+ self.view_y = y1
+ elif y2 < self.view_y - self.height:
+ self.view_y = y2 + self.height
+
+ def ensure_x_visible(self, x):
+ """Adjust `view_x` so that the given X coordinate is visible.
+
+ The X coordinate is given relative to the current `view_x`.
+
+ :Parameters:
+ `x` : int
+ X coordinate
+
+ """
+ if x <= self.view_x + 10:
+ self.view_x = x - 10
+ elif x >= self.view_x + self.width:
+ self.view_x = x - self.width + 10
+ elif (x >= self.view_x + self.width - 10 and
+ self.content_width > self.width):
+ self.view_x = x - self.width + 10
+
+ if _is_epydoc:
+ def on_layout_update(self):
+ """Some or all of the layout text was reflowed.
+
+ Text reflow is caused by document edits or changes to the layout's
+ size. Changes to the layout's position or active selection, and
+ certain document edits such as text color, do not cause a reflow.
+
+ Handle this event to update the position of a graphical element
+ that depends on the laid out position of a glyph or line.
+
+ :event:
+ """
+
+
+IncrementalTextLayout.register_event_type('on_layout_update')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/runlist.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/runlist.py
new file mode 100644
index 0000000..04d4cd6
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/text/runlist.py
@@ -0,0 +1,426 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+'''Run list encoding utilities.
+
+.. versionadded:: 1.1
+'''
+from builtins import str
+from builtins import zip
+from builtins import next
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+class _Run(object):
+ def __init__(self, value, count):
+ self.value = value
+ self.count = count
+
+ def __repr__(self):
+ return 'Run(%r, %d)' % (self.value, self.count)
+
+class RunList(object):
+ '''List of contiguous runs of values.
+
+ A `RunList` is an efficient encoding of a sequence of values. For
+ example, the sequence ``aaaabbccccc`` is encoded as ``(4, a), (2, b),
+ (5, c)``. The class provides methods for modifying and querying the
+ run list without needing to deal with the tricky cases of splitting and
+ merging the run list entries.
+
+ Run lists are used to represent formatted character data in pyglet. A
+ separate run list is maintained for each style attribute, for example,
+ bold, italic, font size, and so on. Unless you are overriding the
+ document interfaces, the only interaction with run lists is via
+ `RunIterator`.
+
+ The length and ranges of a run list always refer to the character
+ positions in the decoded list. For example, in the above sequence,
+ ``set_run(2, 5, 'x')`` would change the sequence to ``aaxxxbccccc``.
+ '''
+ def __init__(self, size, initial):
+ '''Create a run list of the given size and a default value.
+
+ :Parameters:
+ `size` : int
+ Number of characters to represent initially.
+ `initial` : object
+ The value of all characters in the run list.
+
+ '''
+ self.runs = [_Run(initial, size)]
+
+ def insert(self, pos, length):
+ '''Insert characters into the run list.
+
+ The inserted characters will take on the value immediately preceding
+ the insertion point (or the value of the first character, if `pos` is
+ 0).
+
+ :Parameters:
+ `pos` : int
+ Insertion index
+ `length` : int
+ Number of characters to insert.
+
+ '''
+
+ i = 0
+ for run in self.runs:
+ if i <= pos <= i + run.count:
+ run.count += length
+ i += run.count
+
+ def delete(self, start, end):
+ '''Remove characters from the run list.
+
+ :Parameters:
+ `start` : int
+ Starting index to remove from.
+ `end` : int
+ End index, exclusive.
+
+ '''
+ i = 0
+ for run in self.runs:
+ if end - start == 0:
+ break
+ if i <= start <= i + run.count:
+ trim = min(end - start, i + run.count - start)
+ run.count -= trim
+ end -= trim
+ i += run.count
+ self.runs = [r for r in self.runs if r.count > 0]
+
+ # Don't leave an empty list
+ if not self.runs:
+ self.runs = [_Run(run.value, 0)]
+
+ def set_run(self, start, end, value):
+ '''Set the value of a range of characters.
+
+ :Parameters:
+ `start` : int
+ Start index of range.
+ `end` : int
+ End of range, exclusive.
+ `value` : object
+ Value to set over the range.
+
+ '''
+ if end - start <= 0:
+ return
+
+ # Find runs that need to be split
+ i = 0
+ start_i = None
+ start_trim = 0
+ end_i = None
+ end_trim = 0
+ for run_i, run in enumerate(self.runs):
+ count = run.count
+ if i < start < i + count:
+ start_i = run_i
+ start_trim = start - i
+ if i < end < i + count:
+ end_i = run_i
+ end_trim = end - i
+ i += count
+
+ # Split runs
+ if start_i is not None:
+ run = self.runs[start_i]
+ self.runs.insert(start_i, _Run(run.value, start_trim))
+ run.count -= start_trim
+ if end_i is not None:
+ if end_i == start_i:
+ end_trim -= start_trim
+ end_i += 1
+ if end_i is not None:
+ run = self.runs[end_i]
+ self.runs.insert(end_i, _Run(run.value, end_trim))
+ run.count -= end_trim
+
+ # Set new value on runs
+ i = 0
+ for run in self.runs:
+ if start <= i and i + run.count <= end:
+ run.value = value
+ i += run.count
+
+ # Merge adjacent runs
+ last_run = self.runs[0]
+ for run in self.runs[1:]:
+ if run.value == last_run.value:
+ run.count += last_run.count
+ last_run.count = 0
+ last_run = run
+
+ # Delete collapsed runs
+ self.runs = [r for r in self.runs if r.count > 0]
+
+ def __iter__(self):
+ i = 0
+ for run in self.runs:
+ yield i, i + run.count, run.value
+ i += run.count
+
+ def get_run_iterator(self):
+ '''Get an extended iterator over the run list.
+
+ :rtype: `RunIterator`
+ '''
+ return RunIterator(self)
+
+ def __getitem__(self, index):
+ '''Get the value at a character position.
+
+ :Parameters:
+ `index` : int
+ Index of character. Must be within range and non-negative.
+
+ :rtype: object
+ '''
+ i = 0
+ for run in self.runs:
+ if i <= index < i + run.count:
+ return run.value
+ i += run.count
+
+ # Append insertion point
+ if index == i:
+ return self.runs[-1].value
+
+ assert False, 'Index not in range'
+
+ def __repr__(self):
+ return str(list(self))
+
+class AbstractRunIterator(object):
+ '''Range iteration over `RunList`.
+
+ `AbstractRunIterator` objects allow any monotonically non-decreasing
+ access of the iteration, including repeated iteration over the same index.
+ Use the ``[index]`` operator to get the value at a particular index within
+ the document. For example::
+
+ run_iter = iter(run_list)
+ value = run_iter[0]
+ value = run_iter[0] # non-decreasing access is OK
+ value = run_iter[15]
+ value = run_iter[17]
+ value = run_iter[16] # this is illegal, the index decreased.
+
+ Using `AbstractRunIterator` to access increasing indices of the value runs
+ is more efficient than calling `RunList.__getitem__` repeatedly.
+
+ You can also iterate over monotonically non-decreasing ranges over the
+ iteration. For example::
+
+ run_iter = iter(run_list)
+ for start, end, value in run_iter.ranges(0, 20):
+ pass
+ for start, end, value in run_iter.ranges(25, 30):
+ pass
+ for start, end, value in run_iter.ranges(30, 40):
+ pass
+
+ Both start and end indices of the slice are required and must be positive.
+ '''
+
+ def __getitem__(self, index):
+ '''Get the value at a given index.
+
+ See the class documentation for examples of valid usage.
+
+ :Parameters:
+ `index` : int
+ Document position to query.
+
+ :rtype: object
+ '''
+
+ def ranges(self, start, end):
+ '''Iterate over a subrange of the run list.
+
+ See the class documentation for examples of valid usage.
+
+ :Parameters:
+ `start` : int
+ Start index to iterate from.
+ `end` : int
+ End index, exclusive.
+
+ :rtype: iterator
+ :return: Iterator over (start, end, value) tuples.
+ '''
+
+class RunIterator(AbstractRunIterator):
+ def __init__(self, run_list):
+ self._run_list_iter = iter(run_list)
+ self.start, self.end, self.value = next(self)
+
+ def __next__(self):
+ return next(self._run_list_iter)
+
+ def __getitem__(self, index):
+ while index >= self.end and index > self.start:
+ # condition has special case for 0-length run (fixes issue 471)
+ self.start, self.end, self.value = next(self)
+ return self.value
+
+ def ranges(self, start, end):
+ while start >= self.end:
+ self.start, self.end, self.value = next(self)
+ yield start, min(self.end, end), self.value
+ while end > self.end:
+ self.start, self.end, self.value = next(self)
+ yield self.start, min(self.end, end), self.value
+
+class OverriddenRunIterator(AbstractRunIterator):
+ '''Iterator over a `RunIterator`, with a value temporarily replacing
+ a given range.
+ '''
+ def __init__(self, base_iterator, start, end, value):
+ '''Create a derived iterator.
+
+ :Parameters:
+ `start` : int
+ Start of range to override
+ `end` : int
+ End of range to override, exclusive
+ `value` : object
+ Value to replace over the range
+
+ '''
+ self.iter = base_iterator
+ self.override_start = start
+ self.override_end = end
+ self.override_value = value
+
+ def ranges(self, start, end):
+ if end <= self.override_start or start >= self.override_end:
+ # No overlap
+ for r in self.iter.ranges(start, end):
+ yield r
+ else:
+ # Overlap: before, override, after
+ if start < self.override_start < end:
+ for r in self.iter.ranges(start, self.override_start):
+ yield r
+ yield (max(self.override_start, start),
+ min(self.override_end, end),
+ self.override_value)
+ if start < self.override_end < end:
+ for r in self.iter.ranges(self.override_end, end):
+ yield r
+
+ def __getitem__(self, index):
+ if self.override_start <= index < self.override_end:
+ return self.override_value
+ else:
+ return self.iter[index]
+
+class FilteredRunIterator(AbstractRunIterator):
+ '''Iterate over an `AbstractRunIterator` with filtered values replaced
+ by a default value.
+ '''
+ def __init__(self, base_iterator, filter, default):
+ '''Create a filtered run iterator.
+
+ :Parameters:
+ `base_iterator` : `AbstractRunIterator`
+ Source of runs.
+ `filter` : ``lambda object: bool``
+ Function taking a value as parameter, and returning ``True``
+ if the value is acceptable, and ``False`` if the default value
+ should be substituted.
+ `default` : object
+ Default value to replace filtered values.
+
+ '''
+ self.iter = base_iterator
+ self.filter = filter
+ self.default = default
+
+ def ranges(self, start, end):
+ for start, end, value in self.iter.ranges(start, end):
+ if self.filter(value):
+ yield start, end, value
+ else:
+ yield start, end, self.default
+
+ def __getitem__(self, index):
+ value = self.iter[index]
+ if self.filter(value):
+ return value
+ return self.default
+
+class ZipRunIterator(AbstractRunIterator):
+ '''Iterate over multiple run iterators concurrently.'''
+ def __init__(self, range_iterators):
+ self.range_iterators = range_iterators
+
+ def ranges(self, start, end):
+ iterators = [i.ranges(start, end) for i in self.range_iterators]
+ starts, ends, values = zip(*[next(i) for i in iterators])
+ starts = list(starts)
+ ends = list(ends)
+ values = list(values)
+ while start < end:
+ min_end = min(ends)
+ yield start, min_end, values
+ start = min_end
+ for i, iterator in enumerate(iterators):
+ if ends[i] == min_end:
+ starts[i], ends[i], values[i] = next(iterator)
+
+ def __getitem__(self, index):
+ return [i[index] for i in self.range_iterators]
+
+class ConstRunIterator(AbstractRunIterator):
+ '''Iterate over a constant value without creating a RunList.'''
+ def __init__(self, length, value):
+ self.length = length
+ self.value = value
+
+ def __next__(self):
+ yield 0, self.length, self.value
+
+ def ranges(self, start, end):
+ yield start, end, self.value
+
+ def __getitem__(self, index):
+ return self.value
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/__init__.py
new file mode 100644
index 0000000..9c3a9e4
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/__init__.py
@@ -0,0 +1,1885 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+"""Windowing and user-interface events.
+
+This module allows applications to create and display windows with an
+OpenGL context. Windows can be created with a variety of border styles
+or set fullscreen.
+
+You can register event handlers for keyboard, mouse and window events.
+For games and kiosks you can also restrict the input to your windows,
+for example disabling users from switching away from the application
+with certain key combinations or capturing and hiding the mouse.
+
+Getting started
+---------------
+
+Call the Window constructor to create a new window::
+
+ from pyglet.window import Window
+ win = Window(width=640, height=480)
+
+Attach your own event handlers::
+
+ @win.event
+ def on_key_press(symbol, modifiers):
+ # ... handle this event ...
+
+Place drawing code for the window within the `Window.on_draw` event handler::
+
+ @win.event
+ def on_draw():
+ # ... drawing code ...
+
+Call `pyglet.app.run` to enter the main event loop (by default, this
+returns when all open windows are closed)::
+
+ from pyglet import app
+ app.run()
+
+Creating a game window
+----------------------
+
+Use :py:meth:`~pyglet.window.Window.set_exclusive_mouse` to hide the mouse cursor and receive relative
+mouse movement events. Specify ``fullscreen=True`` as a keyword argument to
+the :py:class:`~pyglet.window.Window` constructor to render to the entire screen rather than opening a
+window::
+
+ win = Window(fullscreen=True)
+ win.set_exclusive_mouse()
+
+Working with multiple screens
+-----------------------------
+
+By default, fullscreen windows are opened on the primary display (typically
+set by the user in their operating system settings). You can retrieve a list
+of attached screens and select one manually if you prefer. This is useful for
+opening a fullscreen window on each screen::
+
+ display = window.get_platform().get_default_display()
+ screens = display.get_screens()
+ windows = []
+ for screen in screens:
+ windows.append(window.Window(fullscreen=True, screen=screen))
+
+Specifying a screen has no effect if the window is not fullscreen.
+
+Specifying the OpenGL context properties
+----------------------------------------
+
+Each window has its own context which is created when the window is created.
+You can specify the properties of the context before it is created
+by creating a "template" configuration::
+
+ from pyglet import gl
+ # Create template config
+ config = gl.Config()
+ config.stencil_size = 8
+ config.aux_buffers = 4
+ # Create a window using this config
+ win = window.Window(config=config)
+
+To determine if a given configuration is supported, query the screen (see
+above, "Working with multiple screens")::
+
+ configs = screen.get_matching_configs(config)
+ if not configs:
+ # ... config is not supported
+ else:
+ win = window.Window(config=configs[0])
+
+"""
+from __future__ import division
+from builtins import object
+from future.utils import with_metaclass
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import sys
+
+import pyglet
+from pyglet import gl
+from pyglet.event import EventDispatcher
+import pyglet.window.key
+import pyglet.window.event
+
+_is_epydoc = hasattr(sys, 'is_epydoc') and sys.is_epydoc
+
+
+class WindowException(Exception):
+ """The root exception for all window-related errors."""
+ pass
+
+
+class NoSuchDisplayException(WindowException):
+ """An exception indicating the requested display is not available."""
+ pass
+
+
+class NoSuchConfigException(WindowException):
+ """An exception indicating the requested configuration is not
+ available."""
+ pass
+
+
+class NoSuchScreenModeException(WindowException):
+ """An exception indicating the requested screen resolution could not be
+ met."""
+ pass
+
+
+class MouseCursorException(WindowException):
+ """The root exception for all mouse cursor-related errors."""
+ pass
+
+
+class MouseCursor(object):
+ """An abstract mouse cursor."""
+
+ #: Indicates if the cursor is drawn using OpenGL. This is True
+ #: for all mouse cursors except system cursors.
+ drawable = True
+
+ def draw(self, x, y):
+ """Abstract render method.
+
+ The cursor should be drawn with the "hot" spot at the given
+ coordinates. The projection is set to the pyglet default (i.e.,
+ orthographic in window-space), however no other aspects of the
+ state can be assumed.
+
+ :Parameters:
+ `x` : int
+ X coordinate of the mouse pointer's hot spot.
+ `y` : int
+ Y coordinate of the mouse pointer's hot spot.
+
+ """
+ raise NotImplementedError('abstract')
+
+
+class DefaultMouseCursor(MouseCursor):
+ """The default mouse cursor #sed by the operating system."""
+ drawable = False
+
+
+class ImageMouseCursor(MouseCursor):
+ """A user-defined mouse cursor created from an image.
+
+ Use this class to create your own mouse cursors and assign them
+ to windows. There are no constraints on the image size or format.
+ """
+ drawable = True
+
+ def __init__(self, image, hot_x=0, hot_y=0):
+ """Create a mouse cursor from an image.
+
+ :Parameters:
+ `image` : `pyglet.image.AbstractImage`
+ Image to use for the mouse cursor. It must have a
+ valid ``texture`` attribute.
+ `hot_x` : int
+ X coordinate of the "hot" spot in the image relative to the
+ image's anchor.
+ `hot_y` : int
+ Y coordinate of the "hot" spot in the image, relative to the
+ image's anchor.
+ """
+ self.texture = image.get_texture()
+ self.hot_x = hot_x
+ self.hot_y = hot_y
+
+ def draw(self, x, y):
+ gl.glPushAttrib(gl.GL_ENABLE_BIT | gl.GL_CURRENT_BIT)
+ gl.glColor4f(1, 1, 1, 1)
+ gl.glEnable(gl.GL_BLEND)
+ gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
+ self.texture.blit(x - self.hot_x, y - self.hot_y, 0)
+ gl.glPopAttrib()
+
+
+def _PlatformEventHandler(data):
+ """Decorator for platform event handlers.
+
+ Apply giving the platform-specific data needed by the window to associate
+ the method with an event. See platform-specific subclasses of this
+ decorator for examples.
+
+ The following attributes are set on the function, which is returned
+ otherwise unchanged:
+
+ _platform_event
+ True
+ _platform_event_data
+ List of data applied to the function (permitting multiple decorators
+ on the same method).
+ """
+ def _event_wrapper(f):
+ f._platform_event = True
+ if not hasattr(f, '_platform_event_data'):
+ f._platform_event_data = []
+ f._platform_event_data.append(data)
+ return f
+ return _event_wrapper
+
+
+def _ViewEventHandler(f):
+ f._view = True
+ return f
+
+
+class _WindowMetaclass(type):
+ """Sets the _platform_event_names class variable on the window
+ subclass.
+ """
+ def __init__(cls, name, bases, dict):
+ cls._platform_event_names = set()
+ for base in bases:
+ if hasattr(base, '_platform_event_names'):
+ cls._platform_event_names.update(base._platform_event_names)
+ for name, func in dict.items():
+ if hasattr(func, '_platform_event'):
+ cls._platform_event_names.add(name)
+ super(_WindowMetaclass, cls).__init__(name, bases, dict)
+
+
+class BaseWindow(with_metaclass(_WindowMetaclass, EventDispatcher)):
+ """Platform-independent application window.
+
+ A window is a "heavyweight" object occupying operating system resources.
+ The "client" or "content" area of a window is filled entirely with
+ an OpenGL viewport. Applications have no access to operating system
+ widgets or controls; all rendering must be done via OpenGL.
+
+ Windows may appear as floating regions or can be set to fill an entire
+ screen (fullscreen). When floating, windows may appear borderless or
+ decorated with a platform-specific frame (including, for example, the
+ title bar, minimize and close buttons, resize handles, and so on).
+
+ While it is possible to set the location of a window, it is recommended
+ that applications allow the platform to place it according to local
+ conventions. This will ensure it is not obscured by other windows,
+ and appears on an appropriate screen for the user.
+
+ To render into a window, you must first call `switch_to`, to make
+ it the current OpenGL context. If you use only one window in the
+ application, there is no need to do this.
+ """
+
+ # Filled in by metaclass with the names of all methods on this (sub)class
+ # that are platform event handlers.
+ _platform_event_names = set()
+
+ #: The default window style.
+ WINDOW_STYLE_DEFAULT = None
+ #: The window style for pop-up dialogs.
+ WINDOW_STYLE_DIALOG = 'dialog'
+ #: The window style for tool windows.
+ WINDOW_STYLE_TOOL = 'tool'
+ #: A window style without any decoration.
+ WINDOW_STYLE_BORDERLESS = 'borderless'
+
+ #: The default mouse cursor.
+ CURSOR_DEFAULT = None
+ #: A crosshair mouse cursor.
+ CURSOR_CROSSHAIR = 'crosshair'
+ #: A pointing hand mouse cursor.
+ CURSOR_HAND = 'hand'
+ #: A "help" mouse cursor; typically a question mark and an arrow.
+ CURSOR_HELP = 'help'
+ #: A mouse cursor indicating that the selected operation is not permitted.
+ CURSOR_NO = 'no'
+ #: A mouse cursor indicating the element can be resized.
+ CURSOR_SIZE = 'size'
+ #: A mouse cursor indicating the element can be resized from the top
+ #: border.
+ CURSOR_SIZE_UP = 'size_up'
+ #: A mouse cursor indicating the element can be resized from the
+ #: upper-right corner.
+ CURSOR_SIZE_UP_RIGHT = 'size_up_right'
+ #: A mouse cursor indicating the element can be resized from the right
+ #: border.
+ CURSOR_SIZE_RIGHT = 'size_right'
+ #: A mouse cursor indicating the element can be resized from the lower-right
+ #: corner.
+ CURSOR_SIZE_DOWN_RIGHT = 'size_down_right'
+ #: A mouse cursor indicating the element can be resized from the bottom
+ #: border.
+ CURSOR_SIZE_DOWN = 'size_down'
+ #: A mouse cursor indicating the element can be resized from the lower-left
+ #: corner.
+ CURSOR_SIZE_DOWN_LEFT = 'size_down_left'
+ #: A mouse cursor indicating the element can be resized from the left
+ #: border.
+ CURSOR_SIZE_LEFT = 'size_left'
+ #: A mouse cursor indicating the element can be resized from the upper-left
+ #: corner.
+ CURSOR_SIZE_UP_LEFT = 'size_up_left'
+ #: A mouse cursor indicating the element can be resized vertically.
+ CURSOR_SIZE_UP_DOWN = 'size_up_down'
+ #: A mouse cursor indicating the element can be resized horizontally.
+ CURSOR_SIZE_LEFT_RIGHT = 'size_left_right'
+ #: A text input mouse cursor (I-beam).
+ CURSOR_TEXT = 'text'
+ #: A "wait" mouse cursor; typically an hourglass or watch.
+ CURSOR_WAIT = 'wait'
+ #: The "wait" mouse cursor combined with an arrow.
+ CURSOR_WAIT_ARROW = 'wait_arrow'
+
+ #: True if the user has attempted to close the window.
+ #:
+ #: :deprecated: Windows are closed immediately by the default
+ #: :py:meth:`~pyglet.window.Window.on_close` handler when `pyglet.app.event_loop` is being
+ #: used.
+ has_exit = False
+
+ #: Window display contents validity. The :py:mod:`pyglet.app` event loop
+ #: examines every window each iteration and only dispatches the :py:meth:`~pyglet.window.Window.on_draw`
+ #: event to windows that have `invalid` set. By default, windows always
+ #: have `invalid` set to ``True``.
+ #:
+ #: You can prevent redundant redraws by setting this variable to ``False``
+ #: in the window's :py:meth:`~pyglet.window.Window.on_draw` handler, and setting it to True again in
+ #: response to any events that actually do require a window contents
+ #: update.
+ #:
+ #: :type: bool
+ #: .. versionadded:: 1.1
+ invalid = True
+
+ #: Legacy invalidation flag introduced in pyglet 1.2: set by all event
+ #: dispatches that go to non-empty handlers. The default 1.2 event loop
+ #: will therefore redraw after any handled event or scheduled function.
+ _legacy_invalid = True
+
+ # Instance variables accessible only via properties
+
+ _width = None
+ _height = None
+ _caption = None
+ _resizable = False
+ _style = WINDOW_STYLE_DEFAULT
+ _fullscreen = False
+ _visible = False
+ _vsync = False
+ _screen = None
+ _config = None
+ _context = None
+
+ # Used to restore window size and position after fullscreen
+ _windowed_size = None
+ _windowed_location = None
+
+ # Subclasses should update these after relevant events
+ _mouse_cursor = DefaultMouseCursor()
+ _mouse_x = 0
+ _mouse_y = 0
+ _mouse_visible = True
+ _mouse_exclusive = False
+ _mouse_in_window = False
+
+ _event_queue = None
+ _enable_event_queue = True # overridden by EventLoop.
+ _allow_dispatch_event = False # controlled by dispatch_events stack frame
+
+ # Class attributes
+
+ _default_width = 640
+ _default_height = 480
+
+ def __init__(self,
+ width=None,
+ height=None,
+ caption=None,
+ resizable=False,
+ style=WINDOW_STYLE_DEFAULT,
+ fullscreen=False,
+ visible=True,
+ vsync=True,
+ display=None,
+ screen=None,
+ config=None,
+ context=None,
+ mode=None):
+ """Create a window.
+
+ All parameters are optional, and reasonable defaults are assumed
+ where they are not specified.
+
+ The `display`, `screen`, `config` and `context` parameters form
+ a hierarchy of control: there is no need to specify more than
+ one of these. For example, if you specify `screen` the `display`
+ will be inferred, and a default `config` and `context` will be
+ created.
+
+ `config` is a special case; it can be a template created by the
+ user specifying the attributes desired, or it can be a complete
+ `config` as returned from `Screen.get_matching_configs` or similar.
+
+ The context will be active as soon as the window is created, as if
+ `switch_to` was just called.
+
+ :Parameters:
+ `width` : int
+ Width of the window, in pixels. Defaults to 640, or the
+ screen width if `fullscreen` is True.
+ `height` : int
+ Height of the window, in pixels. Defaults to 480, or the
+ screen height if `fullscreen` is True.
+ `caption` : str or unicode
+ Initial caption (title) of the window. Defaults to
+ ``sys.argv[0]``.
+ `resizable` : bool
+ If True, the window will be resizable. Defaults to False.
+ `style` : int
+ One of the ``WINDOW_STYLE_*`` constants specifying the
+ border style of the window.
+ `fullscreen` : bool
+ If True, the window will cover the entire screen rather
+ than floating. Defaults to False.
+ `visible` : bool
+ Determines if the window is visible immediately after
+ creation. Defaults to True. Set this to False if you
+ would like to change attributes of the window before
+ having it appear to the user.
+ `vsync` : bool
+ If True, buffer flips are synchronised to the primary screen's
+ vertical retrace, eliminating flicker.
+ `display` : `Display`
+ The display device to use. Useful only under X11.
+ `screen` : `Screen`
+ The screen to use, if in fullscreen.
+ `config` : `pyglet.gl.Config`
+ Either a template from which to create a complete config,
+ or a complete config.
+ `context` : `pyglet.gl.Context`
+ The context to attach to this window. The context must
+ not already be attached to another window.
+ `mode` : `ScreenMode`
+ The screen will be switched to this mode if `fullscreen` is
+ True. If None, an appropriate mode is selected to accomodate
+ `width` and `height.`
+
+ """
+ EventDispatcher.__init__(self)
+ self._event_queue = []
+
+ if not display:
+ display = get_platform().get_default_display()
+
+ if not screen:
+ screen = display.get_default_screen()
+
+ if not config:
+ for template_config in [
+ gl.Config(double_buffer=True, depth_size=24),
+ gl.Config(double_buffer=True, depth_size=16),
+ None]:
+ try:
+ config = screen.get_best_config(template_config)
+ break
+ except NoSuchConfigException:
+ pass
+ if not config:
+ raise NoSuchConfigException('No standard config is available.')
+
+ if not config.is_complete():
+ config = screen.get_best_config(config)
+
+ if not context:
+ context = config.create_context(gl.current_context)
+
+ # Set these in reverse order to above, to ensure we get user
+ # preference
+ self._context = context
+ self._config = self._context.config
+ # XXX deprecate config's being screen-specific
+ if hasattr(self._config, 'screen'):
+ self._screen = self._config.screen
+ else:
+ display = self._config.canvas.display
+ self._screen = display.get_default_screen()
+ self._display = self._screen.display
+
+ if fullscreen:
+ if width is None and height is None:
+ self._windowed_size = self._default_width, self._default_height
+ width, height = self._set_fullscreen_mode(mode, width, height)
+ if not self._windowed_size:
+ self._windowed_size = width, height
+ else:
+ if width is None:
+ width = self._default_width
+ if height is None:
+ height = self._default_height
+
+ self._width = width
+ self._height = height
+ self._resizable = resizable
+ self._fullscreen = fullscreen
+ self._style = style
+ if pyglet.options['vsync'] is not None:
+ self._vsync = pyglet.options['vsync']
+ else:
+ self._vsync = vsync
+
+ if caption is None:
+ caption = sys.argv[0]
+ # Decode hack for Python2 unicode support:
+ if hasattr(caption, "decode"):
+ try:
+ caption = caption.decode("utf8")
+ except UnicodeDecodeError:
+ caption = "pyglet"
+ self._caption = caption
+
+ from pyglet import app
+ app.windows.add(self)
+ self._create()
+
+ self.switch_to()
+ if visible:
+ self.set_visible(True)
+ self.activate()
+
+ def __del__(self):
+ # Always try to clean up the window when it is dereferenced.
+ # Makes sure there are no dangling pointers or memory leaks.
+ # If the window is already closed, pass silently.
+ try:
+ self.close()
+ except: # XXX Avoid a NoneType error if already closed.
+ pass
+
+ def __repr__(self):
+ return '%s(width=%d, height=%d)' % \
+ (self.__class__.__name__, self.width, self.height)
+
+ def _create(self):
+ raise NotImplementedError('abstract')
+
+ def _recreate(self, changes):
+ """Recreate the window with current attributes.
+
+ :Parameters:
+ `changes` : list of str
+ List of attribute names that were changed since the last
+ `_create` or `_recreate`. For example, ``['fullscreen']``
+ is given if the window is to be toggled to or from fullscreen.
+ """
+ raise NotImplementedError('abstract')
+
+ def flip(self):
+ """Swap the OpenGL front and back buffers.
+
+ Call this method on a double-buffered window to update the
+ visible display with the back buffer. The contents of the back buffer
+ is undefined after this operation.
+
+ Windows are double-buffered by default. This method is called
+ automatically by `EventLoop` after the :py:meth:`~pyglet.window.Window.on_draw` event.
+ """
+ raise NotImplementedError('abstract')
+
+ def switch_to(self):
+ """Make this window the current OpenGL rendering context.
+
+ Only one OpenGL context can be active at a time. This method sets
+ the current window's context to be current. You should use this
+ method in preference to `pyglet.gl.Context.set_current`, as it may
+ perform additional initialisation functions.
+ """
+ raise NotImplementedError('abstract')
+
+ def set_fullscreen(self, fullscreen=True, screen=None, mode=None,
+ width=None, height=None):
+ """Toggle to or from fullscreen.
+
+ After toggling fullscreen, the GL context should have retained its
+ state and objects, however the buffers will need to be cleared and
+ redrawn.
+
+ If `width` and `height` are specified and `fullscreen` is True, the
+ screen may be switched to a different resolution that most closely
+ matches the given size. If the resolution doesn't match exactly,
+ a higher resolution is selected and the window will be centered
+ within a black border covering the rest of the screen.
+
+ :Parameters:
+ `fullscreen` : bool
+ True if the window should be made fullscreen, False if it
+ should be windowed.
+ `screen` : Screen
+ If not None and fullscreen is True, the window is moved to the
+ given screen. The screen must belong to the same display as
+ the window.
+ `mode` : `ScreenMode`
+ The screen will be switched to the given mode. The mode must
+ have been obtained by enumerating `Screen.get_modes`. If
+ None, an appropriate mode will be selected from the given
+ `width` and `height`.
+ `width` : int
+ Optional width of the window. If unspecified, defaults to the
+ previous window size when windowed, or the screen size if
+ fullscreen.
+
+ .. versionadded:: 1.2
+ `height` : int
+ Optional height of the window. If unspecified, defaults to
+ the previous window size when windowed, or the screen size if
+ fullscreen.
+
+ .. versionadded:: 1.2
+ """
+ if (fullscreen == self._fullscreen and
+ (screen is None or screen is self._screen) and
+ (width is None or width == self._width) and
+ (height is None or height == self._height)):
+ return
+
+ if not self._fullscreen:
+ # Save windowed size
+ self._windowed_size = self.get_size()
+ self._windowed_location = self.get_location()
+
+ if fullscreen and screen is not None:
+ assert screen.display is self.display
+ self._screen = screen
+
+ self._fullscreen = fullscreen
+ if self._fullscreen:
+ self._width, self._height = self._set_fullscreen_mode(
+ mode, width, height)
+ else:
+ self.screen.restore_mode()
+
+ self._width, self._height = self._windowed_size
+ if width is not None:
+ self._width = width
+ if height is not None:
+ self._height = height
+
+ self._recreate(['fullscreen'])
+
+ if not self._fullscreen and self._windowed_location:
+ # Restore windowed location.
+ # TODO: Move into platform _create?
+ # Not harmless on Carbon because upsets _width and _height
+ # via _on_window_bounds_changed.
+ if pyglet.compat_platform != 'darwin' or pyglet.options['darwin_cocoa']:
+ self.set_location(*self._windowed_location)
+
+ def _set_fullscreen_mode(self, mode, width, height):
+ if mode is not None:
+ self.screen.set_mode(mode)
+ if width is None:
+ width = self.screen.width
+ if height is None:
+ height = self.screen.height
+ elif width is not None or height is not None:
+ if width is None:
+ width = 0
+ if height is None:
+ height = 0
+ mode = self.screen.get_closest_mode(width, height)
+ if mode is not None:
+ self.screen.set_mode(mode)
+ elif self.screen.get_modes():
+ # Only raise exception if mode switching is at all possible.
+ raise NoSuchScreenModeException(
+ 'No mode matching %dx%d' % (width, height))
+ else:
+ width = self.screen.width
+ height = self.screen.height
+ return width, height
+
+ def on_resize(self, width, height):
+ """A default resize event handler.
+
+ This default handler updates the GL viewport to cover the entire
+ window and sets the ``GL_PROJECTION`` matrix to be orthogonal in
+ window space. The bottom-left corner is (0, 0) and the top-right
+ corner is the width and height of the window in pixels.
+
+ Override this event handler with your own to create another
+ projection, for example in perspective.
+ """
+ # XXX avoid GLException by not allowing 0 width or height.
+ width = max(1, width)
+ height = max(1, height)
+ gl.glViewport(0, 0, width, height)
+ gl.glMatrixMode(gl.GL_PROJECTION)
+ gl.glLoadIdentity()
+ gl.glOrtho(0, width, 0, height, -1, 1)
+ gl.glMatrixMode(gl.GL_MODELVIEW)
+
+ def on_close(self):
+ """Default on_close handler."""
+ self.has_exit = True
+ from pyglet import app
+ if app.event_loop.is_running:
+ self.close()
+
+ def on_key_press(self, symbol, modifiers):
+ """Default on_key_press handler."""
+ if symbol == key.ESCAPE and not (modifiers & ~(key.MOD_NUMLOCK |
+ key.MOD_CAPSLOCK |
+ key.MOD_SCROLLLOCK)):
+ self.dispatch_event('on_close')
+
+ def close(self):
+ """Close the window.
+
+ After closing the window, the GL context will be invalid. The
+ window instance cannot be reused once closed (see also `set_visible`).
+
+ The `pyglet.app.EventLoop.on_window_close` event is dispatched on
+ `pyglet.app.event_loop` when this method is called.
+ """
+ from pyglet import app
+ if not self._context:
+ return
+ app.windows.remove(self)
+ self._context.destroy()
+ self._config = None
+ self._context = None
+ if app.event_loop:
+ app.event_loop.dispatch_event('on_window_close', self)
+ self._event_queue = []
+
+ def draw_mouse_cursor(self):
+ """Draw the custom mouse cursor.
+
+ If the current mouse cursor has ``drawable`` set, this method
+ is called before the buffers are flipped to render it.
+
+ This method always leaves the ``GL_MODELVIEW`` matrix as current,
+ regardless of what it was set to previously. No other GL state
+ is affected.
+
+ There is little need to override this method; instead, subclass
+ :py:class:`MouseCursor` and provide your own
+ :py:meth:`~MouseCursor.draw` method.
+ """
+ # Draw mouse cursor if set and visible.
+ # XXX leaves state in modelview regardless of starting state
+ if (self._mouse_cursor.drawable and
+ self._mouse_visible and
+ self._mouse_in_window):
+ gl.glMatrixMode(gl.GL_PROJECTION)
+ gl.glPushMatrix()
+ gl.glLoadIdentity()
+ gl.glOrtho(0, self.width, 0, self.height, -1, 1)
+
+ gl.glMatrixMode(gl.GL_MODELVIEW)
+ gl.glPushMatrix()
+ gl.glLoadIdentity()
+
+ self._mouse_cursor.draw(self._mouse_x, self._mouse_y)
+
+ gl.glMatrixMode(gl.GL_PROJECTION)
+ gl.glPopMatrix()
+
+ gl.glMatrixMode(gl.GL_MODELVIEW)
+ gl.glPopMatrix()
+
+ # Properties provide read-only access to instance variables. Use
+ # set_* methods to change them if applicable.
+
+ @property
+ def caption(self):
+ """The window caption (title). Read-only.
+
+ :type: str
+ """
+ return self._caption
+
+ @property
+ def resizeable(self):
+ """True if the window is resizable. Read-only.
+
+ :type: bool
+ """
+ return self._resizable
+
+ @property
+ def style(self):
+ """The window style; one of the ``WINDOW_STYLE_*`` constants.
+ Read-only.
+
+ :type: int
+ """
+ return self._style
+
+ @property
+ def fullscreen(self):
+ """True if the window is currently fullscreen. Read-only.
+
+ :type: bool
+ """
+ return self._fullscreen
+
+ @property
+ def visible(self):
+ """True if the window is currently visible. Read-only.
+
+ :type: bool
+ """
+ return self._visible
+
+ @property
+ def vsync(self):
+ """True if buffer flips are synchronised to the screen's vertical
+ retrace. Read-only.
+
+ :type: bool
+ """
+ return self._vsync
+
+ @property
+ def display(self):
+ """The display this window belongs to. Read-only.
+
+ :type: :py:class:`Display`
+ """
+ return self._display
+
+ @property
+ def screen(self):
+ """The screen this window is fullscreen in. Read-only.
+
+ :type: :py:class:`Screen`
+ """
+ return self._screen
+
+ @property
+ def config(self):
+ """A GL config describing the context of this window. Read-only.
+
+ :type: :py:class:`pyglet.gl.Config`
+ """
+ return self._config
+
+ @property
+ def context(self):
+ """The OpenGL context attached to this window. Read-only.
+
+ :type: :py:class:`pyglet.gl.Context`
+ """
+ return self._context
+
+ # These are the only properties that can be set
+ @property
+ def width(self):
+ """The width of the window, in pixels. Read-write.
+
+ :type: int
+ """
+ return self.get_size()[0]
+
+ @width.setter
+ def width(self, new_width):
+ self.set_size(new_width, self.height)
+
+ @property
+ def height(self):
+ """The height of the window, in pixels. Read-write.
+
+ :type: int
+ """
+ return self.get_size()[1]
+
+ @height.setter
+ def height(self, new_height):
+ self.set_size(self.width, new_height)
+
+ def set_caption(self, caption):
+ """Set the window's caption.
+
+ The caption appears in the titlebar of the window, if it has one,
+ and in the taskbar on Windows and many X11 window managers.
+
+ :Parameters:
+ `caption` : str or unicode
+ The caption to set.
+
+ """
+ raise NotImplementedError('abstract')
+
+ def set_minimum_size(self, width, height):
+ """Set the minimum size of the window.
+
+ Once set, the user will not be able to resize the window smaller
+ than the given dimensions. There is no way to remove the
+ minimum size constraint on a window (but you could set it to 0,0).
+
+ The behaviour is undefined if the minimum size is set larger than
+ the current size of the window.
+
+ The window size does not include the border or title bar.
+
+ :Parameters:
+ `width` : int
+ Minimum width of the window, in pixels.
+ `height` : int
+ Minimum height of the window, in pixels.
+
+ """
+ raise NotImplementedError('abstract')
+
+ def set_maximum_size(self, width, height):
+ """Set the maximum size of the window.
+
+ Once set, the user will not be able to resize the window larger
+ than the given dimensions. There is no way to remove the
+ maximum size constraint on a window (but you could set it to a large
+ value).
+
+ The behaviour is undefined if the maximum size is set smaller than
+ the current size of the window.
+
+ The window size does not include the border or title bar.
+
+ :Parameters:
+ `width` : int
+ Maximum width of the window, in pixels.
+ `height` : int
+ Maximum height of the window, in pixels.
+
+ """
+ raise NotImplementedError('abstract')
+
+ def set_size(self, width, height):
+ """Resize the window.
+
+ The behaviour is undefined if the window is not resizable, or if
+ it is currently fullscreen.
+
+ The window size does not include the border or title bar.
+
+ :Parameters:
+ `width` : int
+ New width of the window, in pixels.
+ `height` : int
+ New height of the window, in pixels.
+
+ """
+ raise NotImplementedError('abstract')
+
+ def get_size(self):
+ """Return the current size of the window.
+
+ The window size does not include the border or title bar.
+
+ :rtype: (int, int)
+ :return: The width and height of the window, in pixels.
+ """
+ raise NotImplementedError('abstract')
+
+ def set_location(self, x, y):
+ """Set the position of the window.
+
+ :Parameters:
+ `x` : int
+ Distance of the left edge of the window from the left edge
+ of the virtual desktop, in pixels.
+ `y` : int
+ Distance of the top edge of the window from the top edge of
+ the virtual desktop, in pixels.
+
+ """
+ raise NotImplementedError('abstract')
+
+ def get_location(self):
+ """Return the current position of the window.
+
+ :rtype: (int, int)
+ :return: The distances of the left and top edges from their respective
+ edges on the virtual desktop, in pixels.
+ """
+ raise NotImplementedError('abstract')
+
+ def activate(self):
+ """Attempt to restore keyboard focus to the window.
+
+ Depending on the window manager or operating system, this may not
+ be successful. For example, on Windows XP an application is not
+ allowed to "steal" focus from another application. Instead, the
+ window's taskbar icon will flash, indicating it requires attention.
+ """
+ raise NotImplementedError('abstract')
+
+ def set_visible(self, visible=True):
+ """Show or hide the window.
+
+ :Parameters:
+ `visible` : bool
+ If True, the window will be shown; otherwise it will be
+ hidden.
+
+ """
+ raise NotImplementedError('abstract')
+
+ def minimize(self):
+ """Minimize the window.
+ """
+ raise NotImplementedError('abstract')
+
+ def maximize(self):
+ """Maximize the window.
+
+ The behaviour of this method is somewhat dependent on the user's
+ display setup. On a multi-monitor system, the window may maximize
+ to either a single screen or the entire virtual desktop.
+ """
+ raise NotImplementedError('abstract')
+
+ def set_vsync(self, vsync):
+ """Enable or disable vertical sync control.
+
+ When enabled, this option ensures flips from the back to the front
+ buffer are performed only during the vertical retrace period of the
+ primary display. This can prevent "tearing" or flickering when
+ the buffer is updated in the middle of a video scan.
+
+ Note that LCD monitors have an analogous time in which they are not
+ reading from the video buffer; while it does not correspond to
+ a vertical retrace it has the same effect.
+
+ With multi-monitor systems the secondary monitor cannot be
+ synchronised to, so tearing and flicker cannot be avoided when the
+ window is positioned outside of the primary display. In this case
+ it may be advisable to forcibly reduce the framerate (for example,
+ using `pyglet.clock.set_fps_limit`).
+
+ :Parameters:
+ `vsync` : bool
+ If True, vsync is enabled, otherwise it is disabled.
+
+ """
+ raise NotImplementedError('abstract')
+
+ def set_mouse_visible(self, visible=True):
+ """Show or hide the mouse cursor.
+
+ The mouse cursor will only be hidden while it is positioned within
+ this window. Mouse events will still be processed as usual.
+
+ :Parameters:
+ `visible` : bool
+ If True, the mouse cursor will be visible, otherwise it
+ will be hidden.
+
+ """
+ self._mouse_visible = visible
+ self.set_mouse_platform_visible()
+
+ def set_mouse_platform_visible(self, platform_visible=None):
+ """Set the platform-drawn mouse cursor visibility. This is called
+ automatically after changing the mouse cursor or exclusive mode.
+
+ Applications should not normally need to call this method, see
+ `set_mouse_visible` instead.
+
+ :Parameters:
+ `platform_visible` : bool or None
+ If None, sets platform visibility to the required visibility
+ for the current exclusive mode and cursor type. Otherwise,
+ a bool value will override and force a visibility.
+
+ """
+ raise NotImplementedError()
+
+ def set_mouse_cursor(self, cursor=None):
+ """Change the appearance of the mouse cursor.
+
+ The appearance of the mouse cursor is only changed while it is
+ within this window.
+
+ :Parameters:
+ `cursor` : `MouseCursor`
+ The cursor to set, or None to restore the default cursor.
+
+ """
+ if cursor is None:
+ cursor = DefaultMouseCursor()
+ self._mouse_cursor = cursor
+ self.set_mouse_platform_visible()
+
+ def set_exclusive_mouse(self, exclusive=True):
+ """Hide the mouse cursor and direct all mouse events to this
+ window.
+
+ When enabled, this feature prevents the mouse leaving the window. It
+ is useful for certain styles of games that require complete control of
+ the mouse. The position of the mouse as reported in subsequent events
+ is meaningless when exclusive mouse is enabled; you should only use
+ the relative motion parameters ``dx`` and ``dy``.
+
+ :Parameters:
+ `exclusive` : bool
+ If True, exclusive mouse is enabled, otherwise it is disabled.
+
+ """
+ raise NotImplementedError('abstract')
+
+ def set_exclusive_keyboard(self, exclusive=True):
+ """Prevent the user from switching away from this window using
+ keyboard accelerators.
+
+ When enabled, this feature disables certain operating-system specific
+ key combinations such as Alt+Tab (Command+Tab on OS X). This can be
+ useful in certain kiosk applications, it should be avoided in general
+ applications or games.
+
+ :Parameters:
+ `exclusive` : bool
+ If True, exclusive keyboard is enabled, otherwise it is
+ disabled.
+
+ """
+ raise NotImplementedError('abstract')
+
+ def get_system_mouse_cursor(self, name):
+ """Obtain a system mouse cursor.
+
+ Use `set_mouse_cursor` to make the cursor returned by this method
+ active. The names accepted by this method are the ``CURSOR_*``
+ constants defined on this class.
+
+ :Parameters:
+ `name` : str
+ Name describing the mouse cursor to return. For example,
+ ``CURSOR_WAIT``, ``CURSOR_HELP``, etc.
+
+ :rtype: `MouseCursor`
+ :return: A mouse cursor which can be used with `set_mouse_cursor`.
+ """
+ raise NotImplementedError()
+
+ def set_icon(self, *images):
+ """Set the window icon.
+
+ If multiple images are provided, one with an appropriate size
+ will be selected (if the correct size is not provided, the image
+ will be scaled).
+
+ Useful sizes to provide are 16x16, 32x32, 64x64 (Mac only) and
+ 128x128 (Mac only).
+
+ :Parameters:
+ `images` : sequence of `pyglet.image.AbstractImage`
+ List of images to use for the window icon.
+
+ """
+ pass
+
+ def clear(self):
+ """Clear the window.
+
+ This is a convenience method for clearing the color and depth
+ buffer. The window must be the active context (see `switch_to`).
+ """
+ gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
+
+ def dispatch_event(self, *args):
+ if not self._enable_event_queue or self._allow_dispatch_event:
+ if EventDispatcher.dispatch_event(self, *args) != False:
+ self._legacy_invalid = True
+ else:
+ self._event_queue.append(args)
+
+ def dispatch_events(self):
+ """Poll the operating system event queue for new events and call
+ attached event handlers.
+
+ This method is provided for legacy applications targeting pyglet 1.0,
+ and advanced applications that must integrate their event loop
+ into another framework.
+
+ Typical applications should use `pyglet.app.run`.
+ """
+ raise NotImplementedError('abstract')
+
+ # If documenting, show the event methods. Otherwise, leave them out
+ # as they are not really methods.
+ if _is_epydoc:
+ def on_key_press(symbol, modifiers):
+ """A key on the keyboard was pressed (and held down).
+
+ In pyglet 1.0 the default handler sets `has_exit` to ``True`` if
+ the ``ESC`` key is pressed.
+
+ In pyglet 1.1 the default handler dispatches the :py:meth:`~pyglet.window.Window.on_close`
+ event if the ``ESC`` key is pressed.
+
+ :Parameters:
+ `symbol` : int
+ The key symbol pressed.
+ `modifiers` : int
+ Bitwise combination of the key modifiers active.
+
+ :event:
+ """
+
+ def on_key_release(symbol, modifiers):
+ """A key on the keyboard was released.
+
+ :Parameters:
+ `symbol` : int
+ The key symbol pressed.
+ `modifiers` : int
+ Bitwise combination of the key modifiers active.
+
+ :event:
+ """
+
+ def on_text(text):
+ """The user input some text.
+
+ Typically this is called after :py:meth:`~pyglet.window.Window.on_key_press` and before
+ :py:meth:`~pyglet.window.Window.on_key_release`, but may also be called multiple times if the key
+ is held down (key repeating); or called without key presses if
+ another input method was used (e.g., a pen input).
+
+ You should always use this method for interpreting text, as the
+ key symbols often have complex mappings to their unicode
+ representation which this event takes care of.
+
+ :Parameters:
+ `text` : unicode
+ The text entered by the user.
+
+ :event:
+ """
+
+ def on_text_motion(motion):
+ """The user moved the text input cursor.
+
+ Typically this is called after :py:meth:`~pyglet.window.Window.on_key_press` and before
+ :py:meth:`~pyglet.window.Window.on_key_release`, but may also be called multiple times if the key
+ is help down (key repeating).
+
+ You should always use this method for moving the text input cursor
+ (caret), as different platforms have different default keyboard
+ mappings, and key repeats are handled correctly.
+
+ The values that `motion` can take are defined in
+ :py:mod:`pyglet.window.key`:
+
+ * MOTION_UP
+ * MOTION_RIGHT
+ * MOTION_DOWN
+ * MOTION_LEFT
+ * MOTION_NEXT_WORD
+ * MOTION_PREVIOUS_WORD
+ * MOTION_BEGINNING_OF_LINE
+ * MOTION_END_OF_LINE
+ * MOTION_NEXT_PAGE
+ * MOTION_PREVIOUS_PAGE
+ * MOTION_BEGINNING_OF_FILE
+ * MOTION_END_OF_FILE
+ * MOTION_BACKSPACE
+ * MOTION_DELETE
+
+ :Parameters:
+ `motion` : int
+ The direction of motion; see remarks.
+
+ :event:
+ """
+
+ def on_text_motion_select(motion):
+ """The user moved the text input cursor while extending the
+ selection.
+
+ Typically this is called after :py:meth:`~pyglet.window.Window.on_key_press` and before
+ :py:meth:`~pyglet.window.Window.on_key_release`, but may also be called multiple times if the key
+ is help down (key repeating).
+
+ You should always use this method for responding to text selection
+ events rather than the raw :py:meth:`~pyglet.window.Window.on_key_press`, as different platforms
+ have different default keyboard mappings, and key repeats are
+ handled correctly.
+
+ The values that `motion` can take are defined in :py:mod:`pyglet.window.key`:
+
+ * MOTION_UP
+ * MOTION_RIGHT
+ * MOTION_DOWN
+ * MOTION_LEFT
+ * MOTION_NEXT_WORD
+ * MOTION_PREVIOUS_WORD
+ * MOTION_BEGINNING_OF_LINE
+ * MOTION_END_OF_LINE
+ * MOTION_NEXT_PAGE
+ * MOTION_PREVIOUS_PAGE
+ * MOTION_BEGINNING_OF_FILE
+ * MOTION_END_OF_FILE
+
+ :Parameters:
+ `motion` : int
+ The direction of selection motion; see remarks.
+
+ :event:
+ """
+
+ def on_mouse_motion(x, y, dx, dy):
+ """The mouse was moved with no buttons held down.
+
+ :Parameters:
+ `x` : int
+ Distance in pixels from the left edge of the window.
+ `y` : int
+ Distance in pixels from the bottom edge of the window.
+ `dx` : int
+ Relative X position from the previous mouse position.
+ `dy` : int
+ Relative Y position from the previous mouse position.
+
+ :event:
+ """
+
+ def on_mouse_drag(x, y, dx, dy, buttons, modifiers):
+ """The mouse was moved with one or more mouse buttons pressed.
+
+ This event will continue to be fired even if the mouse leaves
+ the window, so long as the drag buttons are continuously held down.
+
+ :Parameters:
+ `x` : int
+ Distance in pixels from the left edge of the window.
+ `y` : int
+ Distance in pixels from the bottom edge of the window.
+ `dx` : int
+ Relative X position from the previous mouse position.
+ `dy` : int
+ Relative Y position from the previous mouse position.
+ `buttons` : int
+ Bitwise combination of the mouse buttons currently pressed.
+ `modifiers` : int
+ Bitwise combination of any keyboard modifiers currently
+ active.
+
+ :event:
+ """
+
+ def on_mouse_press(x, y, button, modifiers):
+ """A mouse button was pressed (and held down).
+
+ :Parameters:
+ `x` : int
+ Distance in pixels from the left edge of the window.
+ `y` : int
+ Distance in pixels from the bottom edge of the window.
+ `button` : int
+ The mouse button that was pressed.
+ `modifiers` : int
+ Bitwise combination of any keyboard modifiers currently
+ active.
+
+ :event:
+ """
+
+ def on_mouse_release(x, y, button, modifiers):
+ """A mouse button was released.
+
+ :Parameters:
+ `x` : int
+ Distance in pixels from the left edge of the window.
+ `y` : int
+ Distance in pixels from the bottom edge of the window.
+ `button` : int
+ The mouse button that was released.
+ `modifiers` : int
+ Bitwise combination of any keyboard modifiers currently
+ active.
+
+ :event:
+ """
+
+ def on_mouse_scroll(x, y, scroll_x, scroll_y):
+ """The mouse wheel was scrolled.
+
+ Note that most mice have only a vertical scroll wheel, so
+ `scroll_x` is usually 0. An exception to this is the Apple Mighty
+ Mouse, which has a mouse ball in place of the wheel which allows
+ both `scroll_x` and `scroll_y` movement.
+
+ :Parameters:
+ `x` : int
+ Distance in pixels from the left edge of the window.
+ `y` : int
+ Distance in pixels from the bottom edge of the window.
+ `scroll_x` : int
+ Number of "clicks" towards the right (left if negative).
+ `scroll_y` : int
+ Number of "clicks" upwards (downwards if negative).
+
+ :event:
+ """
+
+ def on_close():
+ """The user attempted to close the window.
+
+ This event can be triggered by clicking on the "X" control box in
+ the window title bar, or by some other platform-dependent manner.
+
+ The default handler sets `has_exit` to ``True``. In pyglet 1.1, if
+ `pyglet.app.event_loop` is being used, `close` is also called,
+ closing the window immediately.
+
+ :event:
+ """
+
+ def on_mouse_enter(x, y):
+ """The mouse was moved into the window.
+
+ This event will not be trigged if the mouse is currently being
+ dragged.
+
+ :Parameters:
+ `x` : int
+ Distance in pixels from the left edge of the window.
+ `y` : int
+ Distance in pixels from the bottom edge of the window.
+
+ :event:
+ """
+
+ def on_mouse_leave(x, y):
+ """The mouse was moved outside of the window.
+
+ This event will not be trigged if the mouse is currently being
+ dragged. Note that the coordinates of the mouse pointer will be
+ outside of the window rectangle.
+
+ :Parameters:
+ `x` : int
+ Distance in pixels from the left edge of the window.
+ `y` : int
+ Distance in pixels from the bottom edge of the window.
+
+ :event:
+ """
+
+ def on_expose():
+ """A portion of the window needs to be redrawn.
+
+ This event is triggered when the window first appears, and any time
+ the contents of the window is invalidated due to another window
+ obscuring it.
+
+ There is no way to determine which portion of the window needs
+ redrawing. Note that the use of this method is becoming
+ increasingly uncommon, as newer window managers composite windows
+ automatically and keep a backing store of the window contents.
+
+ :event:
+ """
+
+ def on_resize(width, height):
+ """The window was resized.
+
+ The window will have the GL context when this event is dispatched;
+ there is no need to call `switch_to` in this handler.
+
+ :Parameters:
+ `width` : int
+ The new width of the window, in pixels.
+ `height` : int
+ The new height of the window, in pixels.
+
+ :event:
+ """
+
+ def on_move(x, y):
+ """The window was moved.
+
+ :Parameters:
+ `x` : int
+ Distance from the left edge of the screen to the left edge
+ of the window.
+ `y` : int
+ Distance from the top edge of the screen to the top edge of
+ the window. Note that this is one of few methods in pyglet
+ which use a Y-down coordinate system.
+
+ :event:
+ """
+
+ def on_activate():
+ """The window was activated.
+
+ This event can be triggered by clicking on the title bar, bringing
+ it to the foreground; or by some platform-specific method.
+
+ When a window is "active" it has the keyboard focus.
+
+ :event:
+ """
+
+ def on_deactivate():
+ """The window was deactivated.
+
+ This event can be triggered by clicking on another application
+ window. When a window is deactivated it no longer has the
+ keyboard focus.
+
+ :event:
+ """
+
+ def on_show():
+ """The window was shown.
+
+ This event is triggered when a window is restored after being
+ minimised, or after being displayed for the first time.
+
+ :event:
+ """
+
+ def on_hide():
+ """The window was hidden.
+
+ This event is triggered when a window is minimised or (on Mac OS X)
+ hidden by the user.
+
+ :event:
+ """
+
+ def on_context_lost():
+ """The window's GL context was lost.
+
+ When the context is lost no more GL methods can be called until it
+ is recreated. This is a rare event, triggered perhaps by the user
+ switching to an incompatible video mode. When it occurs, an
+ application will need to reload all objects (display lists, texture
+ objects, shaders) as well as restore the GL state.
+
+ :event:
+ """
+
+ def on_context_state_lost():
+ """The state of the window's GL context was lost.
+
+ pyglet may sometimes need to recreate the window's GL context if
+ the window is moved to another video device, or between fullscreen
+ or windowed mode. In this case it will try to share the objects
+ (display lists, texture objects, shaders) between the old and new
+ contexts. If this is possible, only the current state of the GL
+ context is lost, and the application should simply restore state.
+
+ :event:
+ """
+
+ def on_draw():
+ """The window contents must be redrawn.
+
+ The `EventLoop` will dispatch this event when the window
+ should be redrawn. This will happen during idle time after
+ any window events and after any scheduled functions were called.
+
+ The window will already have the GL context, so there is no
+ need to call `switch_to`. The window's `flip` method will
+ be called after this event, so your event handler should not.
+
+ You should make no assumptions about the window contents when
+ this event is triggered; a resize or expose event may have
+ invalidated the framebuffer since the last time it was drawn.
+
+ .. versionadded:: 1.1
+
+ :event:
+ """
+
+BaseWindow.register_event_type('on_key_press')
+BaseWindow.register_event_type('on_key_release')
+BaseWindow.register_event_type('on_text')
+BaseWindow.register_event_type('on_text_motion')
+BaseWindow.register_event_type('on_text_motion_select')
+BaseWindow.register_event_type('on_mouse_motion')
+BaseWindow.register_event_type('on_mouse_drag')
+BaseWindow.register_event_type('on_mouse_press')
+BaseWindow.register_event_type('on_mouse_release')
+BaseWindow.register_event_type('on_mouse_scroll')
+BaseWindow.register_event_type('on_mouse_enter')
+BaseWindow.register_event_type('on_mouse_leave')
+BaseWindow.register_event_type('on_close')
+BaseWindow.register_event_type('on_expose')
+BaseWindow.register_event_type('on_resize')
+BaseWindow.register_event_type('on_move')
+BaseWindow.register_event_type('on_activate')
+BaseWindow.register_event_type('on_deactivate')
+BaseWindow.register_event_type('on_show')
+BaseWindow.register_event_type('on_hide')
+BaseWindow.register_event_type('on_context_lost')
+BaseWindow.register_event_type('on_context_state_lost')
+BaseWindow.register_event_type('on_draw')
+
+
+class FPSDisplay(object):
+ """Display of a window's framerate.
+
+ This is a convenience class to aid in profiling and debugging. Typical
+ usage is to create an `FPSDisplay` for each window, and draw the display
+ at the end of the windows' :py:meth:`~pyglet.window.Window.on_draw` event handler::
+
+ window = pyglet.window.Window()
+ fps_display = FPSDisplay(window)
+
+ @window.event
+ def on_draw():
+ # ... perform ordinary window drawing operations ...
+
+ fps_display.draw()
+
+ The style and position of the display can be modified via the :py:func:`~pyglet.text.Label`
+ attribute. Different text can be substituted by overriding the
+ `set_fps` method. The display can be set to update more or less often
+ by setting the `update_period` attribute.
+
+ :Ivariables:
+ `label` : Label
+ The text label displaying the framerate.
+
+ """
+
+ #: Time in seconds between updates.
+ #:
+ #: :type: float
+ update_period = 0.25
+
+ def __init__(self, window):
+ from time import time
+ from pyglet.text import Label
+ self.label = Label('', x=10, y=10,
+ font_size=24, bold=True,
+ color=(127, 127, 127, 127))
+
+ self.window = window
+ self._window_flip = window.flip
+ window.flip = self._hook_flip
+
+ self.time = 0.0
+ self.last_time = time()
+ self.count = 0
+
+ def update(self):
+ """Records a new data point at the current time. This method
+ is called automatically when the window buffer is flipped.
+ """
+ from time import time
+ t = time()
+ self.count += 1
+ self.time += t - self.last_time
+ self.last_time = t
+
+ if self.time >= self.update_period:
+ self.set_fps(self.count / self.update_period)
+ self.time %= self.update_period
+ self.count = 0
+
+ def set_fps(self, fps):
+ """Set the label text for the given FPS estimation.
+
+ Called by `update` every `update_period` seconds.
+
+ :Parameters:
+ `fps` : float
+ Estimated framerate of the window.
+
+ """
+ self.label.text = '%.2f' % fps
+
+ def draw(self):
+ """Draw the label.
+
+ The OpenGL state is assumed to be at default values, except
+ that the MODELVIEW and PROJECTION matrices are ignored. At
+ the return of this method the matrix mode will be MODELVIEW.
+ """
+ gl.glMatrixMode(gl.GL_MODELVIEW)
+ gl.glPushMatrix()
+ gl.glLoadIdentity()
+
+ gl.glMatrixMode(gl.GL_PROJECTION)
+ gl.glPushMatrix()
+ gl.glLoadIdentity()
+ gl.glOrtho(0, self.window.width, 0, self.window.height, -1, 1)
+
+ self.label.draw()
+
+ gl.glPopMatrix()
+
+ gl.glMatrixMode(gl.GL_MODELVIEW)
+ gl.glPopMatrix()
+
+ def _hook_flip(self):
+ self.update()
+ self._window_flip()
+
+if _is_epydoc:
+ # We are building documentation
+ Window = BaseWindow
+ Window.__name__ = 'Window'
+ del BaseWindow
+
+
+else:
+ # Try to determine which platform to use.
+ if pyglet.compat_platform == 'darwin':
+ if pyglet.options['darwin_cocoa']:
+ from pyglet.window.cocoa import CocoaWindow as Window
+ else:
+ from pyglet.window.carbon import CarbonWindow as Window
+ elif pyglet.compat_platform in ('win32', 'cygwin'):
+ from pyglet.window.win32 import Win32Window as Window
+ else:
+ # XXX HACK around circ problem, should be fixed after removal of
+ # shadow nonsense
+ #pyglet.window = sys.modules[__name__]
+ #import key, mouse
+
+ from pyglet.window.xlib import XlibWindow as Window
+
+
+# Deprecated API
+def get_platform():
+ """Get an instance of the Platform most appropriate for this
+ system.
+
+ :deprecated: Use `pyglet.canvas.Display`.
+
+ :rtype: :py:class:`Platform`
+ :return: The platform instance.
+ """
+ return Platform()
+
+
+class Platform(object):
+ """Operating-system-level functionality.
+
+ The platform instance can only be obtained with `get_platform`. Use
+ the platform to obtain a `Display` instance.
+
+ :deprecated: Use `pyglet.canvas.Display`
+ """
+ def get_display(self, name):
+ """Get a display device by name.
+
+ This is meaningful only under X11, where the `name` is a
+ string including the host name and display number; for example
+ ``"localhost:1"``.
+
+ On platforms other than X11, `name` is ignored and the default
+ display is returned. pyglet does not support multiple multiple
+ video devices on Windows or OS X. If more than one device is
+ attached, they will appear as a single virtual device comprising
+ all the attached screens.
+
+ :deprecated: Use `pyglet.canvas.get_display`.
+
+ :Parameters:
+ `name` : str
+ The name of the display to connect to.
+
+ :rtype: `Display`
+ """
+ for display in pyglet.app.displays:
+ if display.name == name:
+ return display
+ return pyglet.canvas.Display(name)
+
+ def get_default_display(self):
+ """Get the default display device.
+
+ :deprecated: Use `pyglet.canvas.get_display`.
+
+ :rtype: `Display`
+ """
+ return pyglet.canvas.get_display()
+
+if _is_epydoc:
+ class Display(object):
+ """A display device supporting one or more screens.
+
+ Use `Platform.get_display` or `Platform.get_default_display` to obtain
+ an instance of this class. Use a display to obtain `Screen` instances.
+
+ :deprecated: Use `pyglet.canvas.Display`.
+ """
+ def __init__(self):
+ raise NotImplementedError('deprecated')
+
+ def get_screens(self):
+ """Get the available screens.
+
+ A typical multi-monitor workstation comprises one `Display` with
+ multiple `Screen` s. This method returns a list of screens which
+ can be enumerated to select one for full-screen display.
+
+ For the purposes of creating an OpenGL config, the default screen
+ will suffice.
+
+ :rtype: list of `Screen`
+ """
+ raise NotImplementedError('deprecated')
+
+ def get_default_screen(self):
+ """Get the default screen as specified by the user's operating system
+ preferences.
+
+ :rtype: `Screen`
+ """
+ raise NotImplementedError('deprecated')
+
+ def get_windows(self):
+ """Get the windows currently attached to this display.
+
+ :rtype: sequence of `Window`
+ """
+ raise NotImplementedError('deprecated')
+else:
+ Display = pyglet.canvas.Display
+ Screen = pyglet.canvas.Screen
+
+
+# XXX remove
+# Create shadow window. (trickery is for circular import)
+if not _is_epydoc:
+ pyglet.window = sys.modules[__name__]
+ gl._create_shadow_window()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/carbon/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/carbon/__init__.py
new file mode 100644
index 0000000..ef0f48f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/carbon/__init__.py
@@ -0,0 +1,1073 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+from __future__ import division
+from builtins import str
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+from ctypes import *
+import os.path
+import unicodedata
+import warnings
+
+import pyglet
+from pyglet.window import WindowException, \
+ BaseWindow, MouseCursor, DefaultMouseCursor, _PlatformEventHandler
+from pyglet.window import key
+from pyglet.window import mouse
+from pyglet.window import event
+from pyglet.canvas.carbon import CarbonCanvas
+
+from pyglet.libs.darwin import *
+from pyglet.libs.darwin import _oscheck
+from pyglet.libs.darwin.quartzkey import keymap, charmap
+
+from pyglet.event import EventDispatcher
+
+# Map symbol,modifiers -> motion
+# Determined by experiment with TextEdit.app
+_motion_map = {
+ (key.UP, False): key.MOTION_UP,
+ (key.RIGHT, False): key.MOTION_RIGHT,
+ (key.DOWN, False): key.MOTION_DOWN,
+ (key.LEFT, False): key.MOTION_LEFT,
+ (key.LEFT, key.MOD_OPTION): key.MOTION_PREVIOUS_WORD,
+ (key.RIGHT, key.MOD_OPTION): key.MOTION_NEXT_WORD,
+ (key.LEFT, key.MOD_COMMAND): key.MOTION_BEGINNING_OF_LINE,
+ (key.RIGHT, key.MOD_COMMAND): key.MOTION_END_OF_LINE,
+ (key.PAGEUP, False): key.MOTION_PREVIOUS_PAGE,
+ (key.PAGEDOWN, False): key.MOTION_NEXT_PAGE,
+ (key.HOME, False): key.MOTION_BEGINNING_OF_FILE,
+ (key.END, False): key.MOTION_END_OF_FILE,
+ (key.UP, key.MOD_COMMAND): key.MOTION_BEGINNING_OF_FILE,
+ (key.DOWN, key.MOD_COMMAND): key.MOTION_END_OF_FILE,
+ (key.BACKSPACE, False): key.MOTION_BACKSPACE,
+ (key.DELETE, False): key.MOTION_DELETE,
+}
+
+
+class CarbonMouseCursor(MouseCursor):
+ drawable = False
+ def __init__(self, theme):
+ self.theme = theme
+
+def CarbonEventHandler(event_class, event_kind):
+ return _PlatformEventHandler((event_class, event_kind))
+
+class CarbonWindow(BaseWindow):
+ _window = None # Carbon WindowRef
+
+ # Window properties
+ _minimum_size = None
+ _maximum_size = None
+ _event_dispatcher = None
+ _current_modifiers = 0
+ _mapped_modifers = 0
+ _carbon_event_handlers = []
+ _carbon_event_handler_refs = []
+ _track_ref = 0
+ _track_region = None
+
+ _mouse_exclusive = False
+ _mouse_platform_visible = True
+ _mouse_ignore_motion = False
+ _mouse_button_state = 0
+
+ def _recreate(self, changes):
+ # We can't destroy the window while event handlers are active,
+ # otherwise the (OS X) event dispatcher gets lost and segfaults.
+ #
+ # Defer actual recreation until dispatch_events next finishes.
+ from pyglet import app
+ app.platform_event_loop.post_event(self,
+ 'on_recreate_immediate', changes)
+
+ def on_recreate_immediate(self, changes):
+ # The actual _recreate function.
+ if ('context' in changes):
+ self.context.detach()
+
+ self._create()
+
+ def _create(self):
+ if self._window:
+ # The window is about to be recreated; destroy everything
+ # associated with the old window, then the window itself.
+ self._remove_track_region()
+ self._remove_event_handlers()
+ self.context.detach()
+ self.canvas = None
+ carbon.DisposeWindow(self._window)
+ self._window = None
+
+ self._window = WindowRef()
+
+ if self._fullscreen:
+ rect = Rect()
+ rect.left = 0
+ rect.top = 0
+ rect.right = self.screen.width
+ rect.bottom = self.screen.height
+ r = carbon.CreateNewWindow(kSimpleWindowClass,
+ kWindowNoAttributes,
+ byref(rect),
+ byref(self._window))
+ _oscheck(r)
+
+ # Set window level to shield level
+ level = carbon.CGShieldingWindowLevel()
+ WindowGroupRef = c_void_p
+ group = WindowGroupRef()
+ _oscheck(carbon.CreateWindowGroup(0, byref(group)))
+ _oscheck(carbon.SetWindowGroup(self._window, group))
+ _oscheck(carbon.SetWindowGroupLevel(group, level))
+
+ # Set black background
+ color = RGBColor(0, 0, 0)
+ _oscheck(carbon.SetWindowContentColor(self._window, byref(color)))
+
+ self._mouse_in_window = True
+ self.dispatch_event('on_resize', self._width, self._height)
+ self.dispatch_event('on_show')
+ self.dispatch_event('on_expose')
+ self._view_x = (self.screen.width - self._width) // 2
+ self._view_y = (self.screen.height - self._height) // 2
+ self.canvas = CarbonCanvas(self.display, self.screen,
+ carbon.GetWindowPort(self._window))
+ self.canvas.bounds = (self._view_x, self._view_y,
+ self._width, self._height)
+ else:
+ # Create floating window
+ rect = Rect()
+ location = None # TODO
+ if location is not None:
+ rect.left = location[0]
+ rect.top = location[1]
+ else:
+ rect.top = rect.left = 0
+ rect.right = rect.left + self._width
+ rect.bottom = rect.top + self._height
+
+ styles = {
+ self.WINDOW_STYLE_DEFAULT: (kDocumentWindowClass,
+ kWindowCloseBoxAttribute |
+ kWindowCollapseBoxAttribute),
+ self.WINDOW_STYLE_DIALOG: (kDocumentWindowClass,
+ kWindowCloseBoxAttribute),
+ self.WINDOW_STYLE_TOOL: (kUtilityWindowClass,
+ kWindowCloseBoxAttribute),
+ self.WINDOW_STYLE_BORDERLESS: (kSimpleWindowClass,
+ kWindowNoAttributes)
+ }
+ window_class, window_attributes = \
+ styles.get(self._style, kDocumentWindowClass)
+
+ if self._resizable:
+ window_attributes |= (kWindowFullZoomAttribute |
+ kWindowLiveResizeAttribute |
+ kWindowResizableAttribute)
+
+ r = carbon.CreateNewWindow(window_class,
+ window_attributes,
+ byref(rect),
+ byref(self._window))
+ _oscheck(r)
+
+ if location is None:
+ carbon.RepositionWindow(self._window, c_void_p(),
+ kWindowCascadeOnMainScreen)
+
+ self.canvas = CarbonCanvas(self.display, self.screen,
+ carbon.GetWindowPort(self._window))
+ self._view_x = self._view_y = 0
+
+ self.context.attach(self.canvas)
+
+ self.set_caption(self._caption)
+
+ # Get initial state
+ self._event_dispatcher = carbon.GetEventDispatcherTarget()
+ self._current_modifiers = carbon.GetCurrentKeyModifiers().value
+ self._mapped_modifiers = self._map_modifiers(self._current_modifiers)
+
+ # (re)install Carbon event handlers
+ self._install_event_handlers()
+
+ self._create_track_region()
+
+ self.switch_to() # XXX
+ self.set_vsync(self._vsync)
+
+ if self._visible:
+ self.set_visible(True)
+
+ def _create_track_region(self):
+ self._remove_track_region()
+
+ # Create a tracking region for the content part of the window
+ # to receive enter/leave events.
+ track_id = MouseTrackingRegionID()
+ track_id.signature = DEFAULT_CREATOR_CODE
+ track_id.id = 1
+ self._track_ref = MouseTrackingRef()
+ self._track_region = carbon.NewRgn()
+ if self._fullscreen:
+ carbon.SetRectRgn(self._track_region,
+ self._view_x, self._view_y,
+ self._view_x + self._width, self._view_y + self._height)
+ options = kMouseTrackingOptionsGlobalClip
+ else:
+ carbon.GetWindowRegion(self._window,
+ kWindowContentRgn, self._track_region)
+ options = kMouseTrackingOptionsGlobalClip
+ carbon.CreateMouseTrackingRegion(self._window,
+ self._track_region, None, options,
+ track_id, None, None,
+ byref(self._track_ref))
+
+ def _remove_track_region(self):
+ if self._track_region:
+ carbon.ReleaseMouseTrackingRegion(self._track_region)
+ self._track_region = None
+
+ def close(self):
+ super(CarbonWindow, self).close()
+ self._remove_event_handlers()
+ self._remove_track_region()
+
+ # Restore cursor visibility
+ self.set_mouse_platform_visible(True)
+ self.set_exclusive_mouse(False)
+
+ if self._window:
+ carbon.DisposeWindow(self._window)
+ self._window = None
+
+ def switch_to(self):
+ self.context.set_current()
+ '''
+ agl.aglSetCurrentContext(self._agl_context)
+ self._context.set_current()
+ _aglcheck()
+ # XXX TODO transpose gl[u]_info to gl.Context.attach
+ gl_info.set_active_context()
+ glu_info.set_active_context()
+ '''
+
+ def flip(self):
+ self.draw_mouse_cursor()
+ if self.context:
+ self.context.flip()
+
+ def _get_vsync(self):
+ if self.context:
+ return self.context.get_vsync()
+ return self._vsync
+ vsync = property(_get_vsync) # overrides BaseWindow property
+
+ def set_vsync(self, vsync):
+ if pyglet.options['vsync'] is not None:
+ vsync = pyglet.options['vsync']
+ self._vsync = vsync # _recreate depends on this
+ if self.context:
+ self.context.set_vsync(vsync)
+
+ def dispatch_events(self):
+ from pyglet import app
+ app.platform_event_loop.dispatch_posted_events()
+
+ self._allow_dispatch_event = True
+ while self._event_queue:
+ EventDispatcher.dispatch_event(self, *self._event_queue.pop(0))
+
+ e = EventRef()
+ result = carbon.ReceiveNextEvent(0, c_void_p(), 0, True, byref(e))
+ while result == noErr:
+ carbon.SendEventToEventTarget(e, self._event_dispatcher)
+ carbon.ReleaseEvent(e)
+
+ result = carbon.ReceiveNextEvent(0, c_void_p(), 0, True, byref(e))
+
+ self._allow_dispatch_event = False
+
+ # Return value from ReceiveNextEvent can be ignored if not
+ # noErr; we check here only to look for new bugs.
+ # eventLoopQuitErr: the inner event loop was quit, see
+ # http://lists.apple.com/archives/Carbon-dev/2006/Jun/msg00850.html
+ # Can occur when mixing with other toolkits, e.g. Tk.
+ # Fixes issue 180.
+ if result not in (eventLoopTimedOutErr, eventLoopQuitErr):
+ raise 'Error %d' % result
+
+ def dispatch_pending_events(self):
+ while self._event_queue:
+ EventDispatcher.dispatch_event(self, *self._event_queue.pop(0))
+
+ def set_caption(self, caption):
+ self._caption = caption
+ s = create_cfstring(caption)
+ carbon.SetWindowTitleWithCFString(self._window, s)
+ carbon.CFRelease(s)
+
+ def set_location(self, x, y):
+ rect = Rect()
+ carbon.GetWindowBounds(self._window, kWindowContentRgn, byref(rect))
+ rect.right += x - rect.left
+ rect.bottom += y - rect.top
+ rect.left = x
+ rect.top = y
+ carbon.SetWindowBounds(self._window, kWindowContentRgn, byref(rect))
+
+ def get_location(self):
+ rect = Rect()
+ carbon.GetWindowBounds(self._window, kWindowContentRgn, byref(rect))
+ return rect.left, rect.top
+
+ def set_size(self, width, height):
+ if self._fullscreen:
+ raise WindowException('Cannot set size of fullscreen window.')
+ rect = Rect()
+ carbon.GetWindowBounds(self._window, kWindowContentRgn, byref(rect))
+ rect.right = rect.left + width
+ rect.bottom = rect.top + height
+ carbon.SetWindowBounds(self._window, kWindowContentRgn, byref(rect))
+
+ self._width = width
+ self._height = height
+ self.dispatch_event('on_resize', width, height)
+ self.dispatch_event('on_expose')
+
+ def get_size(self):
+ if self._fullscreen:
+ return self._width, self._height
+ rect = Rect()
+ carbon.GetWindowBounds(self._window, kWindowContentRgn, byref(rect))
+ return rect.right - rect.left, rect.bottom - rect.top
+
+ def set_minimum_size(self, width, height):
+ self._minimum_size = (width, height)
+ minimum = HISize()
+ minimum.width = width
+ minimum.height = height
+ if self._maximum_size:
+ maximum = HISize()
+ maximum.width, maximum.height = self._maximum_size
+ maximum = byref(maximum)
+ else:
+ maximum = None
+ carbon.SetWindowResizeLimits(self._window,
+ byref(minimum), maximum)
+
+ def set_maximum_size(self, width, height):
+ self._maximum_size = (width, height)
+ maximum = HISize()
+ maximum.width = width
+ maximum.height = height
+ if self._minimum_size:
+ minimum = HISize()
+ minimum.width, minimum.height = self._minimum_size
+ minimum = byref(minimum)
+ else:
+ minimum = None
+ carbon.SetWindowResizeLimits(self._window,
+ minimum, byref(maximum))
+
+ def activate(self):
+ carbon.ActivateWindow(self._window, 1)
+
+ # Also make the application the "front" application. TODO
+ # maybe don't bring forward all of the application's windows?
+ psn = ProcessSerialNumber()
+ psn.highLongOfPSN = 0
+ psn.lowLongOfPSN = kCurrentProcess
+ carbon.SetFrontProcess(byref(psn))
+
+ def set_visible(self, visible=True):
+ self._visible = visible
+ if visible:
+ self.dispatch_event('on_resize', self._width, self._height)
+ self.dispatch_event('on_show')
+ self.dispatch_event('on_expose')
+ carbon.ShowWindow(self._window)
+ else:
+ carbon.HideWindow(self._window)
+
+ def minimize(self):
+ self._mouse_in_window = False
+ self.set_mouse_platform_visible()
+ carbon.CollapseWindow(self._window, True)
+
+ def maximize(self):
+ # Maximum "safe" value, gets trimmed to screen size automatically.
+ p = Point()
+ p.v, p.h = 16000,16000
+ if not carbon.IsWindowInStandardState(self._window, byref(p), None):
+ carbon.ZoomWindowIdeal(self._window, inZoomOut, byref(p))
+
+ def set_mouse_platform_visible(self, platform_visible=None):
+ if platform_visible is None:
+ platform_visible = self._mouse_visible and \
+ not self._mouse_exclusive and \
+ not self._mouse_cursor.drawable
+ if not self._mouse_in_window:
+ platform_visible = True
+
+ if self._mouse_in_window and \
+ isinstance(self._mouse_cursor, CarbonMouseCursor):
+ carbon.SetThemeCursor(self._mouse_cursor.theme)
+ else:
+ carbon.SetThemeCursor(kThemeArrowCursor)
+
+ if self._mouse_platform_visible == platform_visible:
+ return
+
+ if platform_visible:
+ carbon.ShowCursor()
+ else:
+ carbon.HideCursor()
+ self._mouse_platform_visible = platform_visible
+
+ def set_exclusive_mouse(self, exclusive=True):
+ self._mouse_exclusive = exclusive
+ if exclusive:
+ # Move mouse to center of window
+ rect = Rect()
+ carbon.GetWindowBounds(self._window, kWindowContentRgn, byref(rect))
+ x = (rect.right + rect.left) / 2
+ y = (rect.bottom + rect.top) / 2
+ # Skip the next motion event, which would return a large delta.
+ self._mouse_ignore_motion = True
+ self.set_mouse_position(x, y, absolute=True)
+ carbon.CGAssociateMouseAndMouseCursorPosition(False)
+ else:
+ carbon.CGAssociateMouseAndMouseCursorPosition(True)
+ self.set_mouse_platform_visible()
+
+ def set_mouse_position(self, x, y, absolute=False):
+ point = CGPoint()
+ if absolute:
+ point.x = x
+ point.y = y
+ else:
+ rect = Rect()
+ carbon.GetWindowBounds(self._window, kWindowContentRgn, byref(rect))
+ point.x = x + rect.left
+ point.y = rect.top + (rect.bottom - rect.top) - y
+ carbon.CGWarpMouseCursorPosition(point)
+
+ def set_exclusive_keyboard(self, exclusive=True):
+ if exclusive:
+ # Note: power switch can also be disabled, with
+ # kUIOptionDisableSessionTerminate. That seems
+ # a little extreme though.
+ carbon.SetSystemUIMode(kUIModeAllHidden,
+ (kUIOptionDisableAppleMenu |
+ kUIOptionDisableProcessSwitch |
+ kUIOptionDisableForceQuit |
+ kUIOptionDisableHide))
+ else:
+ carbon.SetSystemUIMode(kUIModeNormal, 0)
+
+ def get_system_mouse_cursor(self, name):
+ if name == self.CURSOR_DEFAULT:
+ return DefaultMouseCursor()
+
+ themes = {
+ self.CURSOR_CROSSHAIR: kThemeCrossCursor,
+ self.CURSOR_HAND: kThemePointingHandCursor,
+ self.CURSOR_HELP: kThemeArrowCursor,
+ self.CURSOR_NO: kThemeNotAllowedCursor,
+ self.CURSOR_SIZE: kThemeArrowCursor,
+ self.CURSOR_SIZE_UP: kThemeResizeUpCursor,
+ self.CURSOR_SIZE_UP_RIGHT: kThemeArrowCursor,
+ self.CURSOR_SIZE_RIGHT: kThemeResizeRightCursor,
+ self.CURSOR_SIZE_DOWN_RIGHT: kThemeArrowCursor,
+ self.CURSOR_SIZE_DOWN: kThemeResizeDownCursor,
+ self.CURSOR_SIZE_DOWN_LEFT: kThemeArrowCursor,
+ self.CURSOR_SIZE_LEFT: kThemeResizeLeftCursor,
+ self.CURSOR_SIZE_UP_LEFT: kThemeArrowCursor,
+ self.CURSOR_SIZE_UP_DOWN: kThemeResizeUpDownCursor,
+ self.CURSOR_SIZE_LEFT_RIGHT: kThemeResizeLeftRightCursor,
+ self.CURSOR_TEXT: kThemeIBeamCursor,
+ self.CURSOR_WAIT: kThemeWatchCursor,
+ self.CURSOR_WAIT_ARROW: kThemeWatchCursor,
+ }
+ if name not in themes:
+ raise RuntimeError('Unknown cursor name "%s"' % name)
+ return CarbonMouseCursor(themes[name])
+
+ def set_icon(self, *images):
+ # Only use the biggest image
+ image = images[0]
+ size = image.width * image.height
+ for img in images:
+ if img.width * img.height > size:
+ size = img.width * img.height
+ image = img
+
+ image = image.get_image_data()
+ format = 'ARGB'
+ pitch = -len(format) * image.width
+
+ data = image.get_data(format, pitch)
+ provider = carbon.CGDataProviderCreateWithData(
+ None, data, len(data), None)
+
+ colorspace = carbon.CGColorSpaceCreateDeviceRGB()
+
+ cgi = carbon.CGImageCreate(
+ image.width, image.height, 8, 32, -pitch,
+ colorspace,
+ kCGImageAlphaFirst,
+ provider,
+ None,
+ True,
+ kCGRenderingIntentDefault)
+
+ carbon.SetApplicationDockTileImage(cgi)
+
+ carbon.CGDataProviderRelease(provider)
+ carbon.CGColorSpaceRelease(colorspace)
+
+ # Non-public utilities
+
+ def _update_drawable(self):
+ if self.context:
+ self.context.update_geometry()
+
+ # Need a redraw
+ self.dispatch_event('on_expose')
+
+ def _update_track_region(self):
+ if not self._fullscreen:
+ carbon.GetWindowRegion(self._window,
+ kWindowContentRgn, self._track_region)
+ carbon.ChangeMouseTrackingRegion(self._track_ref,
+ self._track_region, None)
+
+ def _install_event_handlers(self):
+ self._remove_event_handlers()
+
+ if self._fullscreen:
+ target = carbon.GetApplicationEventTarget()
+ else:
+ target = carbon.GetWindowEventTarget(self._window)
+ carbon.InstallStandardEventHandler(target)
+
+ self._carbon_event_handlers = []
+ self._carbon_event_handler_refs = []
+
+ for func_name in self._platform_event_names:
+ if not hasattr(self, func_name):
+ continue
+
+ func = getattr(self, func_name)
+ self._install_event_handler(func)
+
+ def _install_event_handler(self, func):
+ if self._fullscreen:
+ target = carbon.GetApplicationEventTarget()
+ else:
+ target = carbon.GetWindowEventTarget(self._window)
+
+ for event_class, event_kind in func._platform_event_data:
+ # TODO: could just build up array of class/kind
+ proc = EventHandlerProcPtr(func)
+ self._carbon_event_handlers.append(proc)
+ upp = carbon.NewEventHandlerUPP(proc)
+ types = EventTypeSpec()
+ types.eventClass = event_class
+ types.eventKind = event_kind
+ handler_ref = EventHandlerRef()
+ carbon.InstallEventHandler(
+ target,
+ upp,
+ 1,
+ byref(types),
+ c_void_p(),
+ byref(handler_ref))
+ self._carbon_event_handler_refs.append(handler_ref)
+
+ def _remove_event_handlers(self):
+ for ref in self._carbon_event_handler_refs:
+ carbon.RemoveEventHandler(ref)
+ self._carbon_event_handler_refs = []
+ self._carbon_event_handlers = []
+
+ # Carbon event handlers
+
+ @CarbonEventHandler(kEventClassTextInput, kEventTextInputUnicodeForKeyEvent)
+ def _on_text_input(self, next_handler, ev, data):
+ size = c_uint32()
+ carbon.GetEventParameter(ev, kEventParamTextInputSendText,
+ typeUTF8Text, c_void_p(), 0, byref(size), c_void_p())
+ text = create_string_buffer(size.value)
+ carbon.GetEventParameter(ev, kEventParamTextInputSendText,
+ typeUTF8Text, c_void_p(), size.value, c_void_p(), byref(text))
+ text = text.value.decode('utf8')
+
+ raw_event = EventRef()
+ carbon.GetEventParameter(ev, kEventParamTextInputSendKeyboardEvent,
+ typeEventRef, c_void_p(), sizeof(raw_event), c_void_p(),
+ byref(raw_event))
+ symbol, modifiers = self._get_symbol_and_modifiers(raw_event)
+
+ motion_modifiers = modifiers & \
+ (key.MOD_COMMAND | key.MOD_CTRL | key.MOD_OPTION)
+ if (symbol, motion_modifiers) in _motion_map:
+ motion = _motion_map[symbol, motion_modifiers]
+ if modifiers & key.MOD_SHIFT:
+ self.dispatch_event('on_text_motion_select', motion)
+ else:
+ self.dispatch_event('on_text_motion', motion)
+ elif ((unicodedata.category(text[0]) != 'Cc' or text == u'\r') and
+ not (modifiers & key.MOD_COMMAND)):
+ self.dispatch_event('on_text', text)
+ return noErr
+
+ @CarbonEventHandler(kEventClassKeyboard, kEventRawKeyUp)
+ def _on_key_up(self, next_handler, ev, data):
+ symbol, modifiers = self._get_symbol_and_modifiers(ev)
+ if symbol:
+ self.dispatch_event('on_key_release', symbol, modifiers)
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @CarbonEventHandler(kEventClassKeyboard, kEventRawKeyDown)
+ def _on_key_down(self, next_handler, ev, data):
+ symbol, modifiers = self._get_symbol_and_modifiers(ev)
+ if symbol:
+ self.dispatch_event('on_key_press', symbol, modifiers)
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @staticmethod
+ def _get_symbol_and_modifiers(ev):
+ # The unicode char help processing virtual keycodes (see issue 405)
+ wchar = c_wchar()
+ carbon.GetEventParameter(ev, kEventParamKeyUnicodes,
+ typeUnicodeText, c_void_p(), sizeof(wchar), c_void_p(), byref(wchar))
+ try:
+ wchar = str((wchar.value)).upper()
+ except UnicodeEncodeError:
+ # (this fix for issue 405 caused a bug itself (see comments 6-7);
+ # this try/except fixes it)
+ wchar = None
+ # If the unicode char is within charmap keys (ascii value), then we use
+ # the corresponding symbol.
+ if wchar in charmap.keys():
+ symbol = charmap[wchar]
+ else:
+ sym = c_uint32()
+ carbon.GetEventParameter(ev, kEventParamKeyCode,
+ typeUInt32, c_void_p(), sizeof(sym), c_void_p(), byref(sym))
+ symbol = keymap.get(sym.value, None)
+ if symbol is None:
+ symbol = key.user_key(sym.value)
+ modifiers = c_uint32()
+ carbon.GetEventParameter(ev, kEventParamKeyModifiers,
+ typeUInt32, c_void_p(), sizeof(modifiers), c_void_p(),
+ byref(modifiers))
+ return (symbol, CarbonWindow._map_modifiers(modifiers.value))
+
+ @staticmethod
+ def _map_modifiers(modifiers):
+ mapped_modifiers = 0
+ if modifiers & (shiftKey | rightShiftKey):
+ mapped_modifiers |= key.MOD_SHIFT
+ if modifiers & (controlKey | rightControlKey):
+ mapped_modifiers |= key.MOD_CTRL
+ if modifiers & (optionKey | rightOptionKey):
+ mapped_modifiers |= key.MOD_OPTION
+ if modifiers & alphaLock:
+ mapped_modifiers |= key.MOD_CAPSLOCK
+ if modifiers & cmdKey:
+ mapped_modifiers |= key.MOD_COMMAND
+
+ return mapped_modifiers
+
+ @CarbonEventHandler(kEventClassKeyboard, kEventRawKeyModifiersChanged)
+ def _on_modifiers_changed(self, next_handler, ev, data):
+ modifiers = c_uint32()
+ carbon.GetEventParameter(ev, kEventParamKeyModifiers,
+ typeUInt32, c_void_p(), sizeof(modifiers), c_void_p(),
+ byref(modifiers))
+ modifiers = modifiers.value
+ deltas = modifiers ^ self._current_modifiers
+ for mask, k in [
+ (controlKey, key.LCTRL),
+ (shiftKey, key.LSHIFT),
+ (cmdKey, key.LCOMMAND),
+ (optionKey, key.LOPTION),
+ (rightShiftKey, key.RSHIFT),
+ (rightOptionKey, key.ROPTION),
+ (rightControlKey, key.RCTRL),
+ (alphaLock, key.CAPSLOCK),
+ (numLock, key.NUMLOCK)]:
+ if deltas & mask:
+ if modifiers & mask:
+ self.dispatch_event('on_key_press',
+ k, self._mapped_modifiers)
+ else:
+ self.dispatch_event('on_key_release',
+ k, self._mapped_modifiers)
+ carbon.CallNextEventHandler(next_handler, ev)
+
+ self._mapped_modifiers = self._map_modifiers(modifiers)
+ self._current_modifiers = modifiers
+ return noErr
+
+ def _get_mouse_position(self, ev):
+ position = HIPoint()
+ carbon.GetEventParameter(ev, kEventParamMouseLocation,
+ typeHIPoint, c_void_p(), sizeof(position), c_void_p(),
+ byref(position))
+
+ bounds = Rect()
+ carbon.GetWindowBounds(self._window, kWindowContentRgn, byref(bounds))
+ return (int(position.x - bounds.left - self._view_x),
+ int(position.y - bounds.top - self._view_y))
+
+ def _get_mouse_buttons_changed(self):
+ button_state = self._get_mouse_buttons()
+ change = self._mouse_button_state ^ button_state
+ self._mouse_button_state = button_state
+ return change
+
+ @staticmethod
+ def _get_mouse_buttons():
+ buttons = carbon.GetCurrentEventButtonState()
+ button_state = 0
+ if buttons & 0x1: button_state |= mouse.LEFT
+ if buttons & 0x2: button_state |= mouse.RIGHT
+ if buttons & 0x4: button_state |= mouse.MIDDLE
+ return button_state
+
+ @staticmethod
+ def _get_modifiers(ev):
+ modifiers = c_uint32()
+ carbon.GetEventParameter(ev, kEventParamKeyModifiers,
+ typeUInt32, c_void_p(), sizeof(modifiers), c_void_p(),
+ byref(modifiers))
+
+ return CarbonWindow._map_modifiers(modifiers.value)
+
+ def _get_mouse_in_content(self, ev, x, y):
+ if self._fullscreen:
+ return 0 <= x < self._width and 0 <= y < self._height
+ else:
+ position = Point()
+ carbon.GetEventParameter(ev, kEventParamMouseLocation,
+ typeQDPoint, c_void_p(), sizeof(position), c_void_p(),
+ byref(position))
+ return carbon.FindWindow(position, None) == inContent
+
+ @CarbonEventHandler(kEventClassMouse, kEventMouseDown)
+ def _on_mouse_down(self, next_handler, ev, data):
+ x, y = self._get_mouse_position(ev)
+ if self._get_mouse_in_content(ev, x, y):
+ button = self._get_mouse_buttons_changed()
+ modifiers = self._get_modifiers(ev)
+ if button is not None:
+ y = self.height - y
+ self.dispatch_event('on_mouse_press', x, y, button, modifiers)
+
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @CarbonEventHandler(kEventClassMouse, kEventMouseUp)
+ def _on_mouse_up(self, next_handler, ev, data):
+ # Always report mouse up, even out of content area, because it's
+ # probably after a drag gesture.
+ button = self._get_mouse_buttons_changed()
+ modifiers = self._get_modifiers(ev)
+ if button is not None:
+ x, y = self._get_mouse_position(ev)
+ y = self.height - y
+ self.dispatch_event('on_mouse_release', x, y, button, modifiers)
+
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @CarbonEventHandler(kEventClassMouse, kEventMouseMoved)
+ def _on_mouse_moved(self, next_handler, ev, data):
+ x, y = self._get_mouse_position(ev)
+ if (self._get_mouse_in_content(ev, x, y)
+ and not self._mouse_ignore_motion):
+ y = self.height - y
+
+ self._mouse_x = x
+ self._mouse_y = y
+
+ delta = HIPoint()
+ carbon.GetEventParameter(ev, kEventParamMouseDelta,
+ typeHIPoint, c_void_p(), sizeof(delta), c_void_p(),
+ byref(delta))
+
+ # Motion event
+ self.dispatch_event('on_mouse_motion',
+ x, y, delta.x, -delta.y)
+ elif self._mouse_ignore_motion:
+ self._mouse_ignore_motion = False
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @CarbonEventHandler(kEventClassMouse, kEventMouseDragged)
+ def _on_mouse_dragged(self, next_handler, ev, data):
+ button = self._get_mouse_buttons()
+ modifiers = self._get_modifiers(ev)
+ if button is not None:
+ x, y = self._get_mouse_position(ev)
+ y = self.height - y
+
+ self._mouse_x = x
+ self._mouse_y = y
+
+ delta = HIPoint()
+ carbon.GetEventParameter(ev, kEventParamMouseDelta,
+ typeHIPoint, c_void_p(), sizeof(delta), c_void_p(),
+ byref(delta))
+
+ # Drag event
+ self.dispatch_event('on_mouse_drag',
+ x, y, delta.x, -delta.y, button, modifiers)
+
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @CarbonEventHandler(kEventClassMouse, kEventMouseEntered)
+ def _on_mouse_entered(self, next_handler, ev, data):
+ x, y = self._get_mouse_position(ev)
+ y = self.height - y
+
+ self._mouse_x = x
+ self._mouse_y = y
+ self._mouse_in_window = True
+ self.set_mouse_platform_visible()
+
+ self.dispatch_event('on_mouse_enter', x, y)
+
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @CarbonEventHandler(kEventClassMouse, kEventMouseExited)
+ def _on_mouse_exited(self, next_handler, ev, data):
+ x, y = self._get_mouse_position(ev)
+ y = self.height - y
+
+ self._mouse_in_window = False
+ self.set_mouse_platform_visible()
+
+ self.dispatch_event('on_mouse_leave', x, y)
+
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @CarbonEventHandler(kEventClassMouse, kEventMouseWheelMoved)
+ def _on_mouse_wheel_moved(self, next_handler, ev, data):
+
+ x, y = self._get_mouse_position(ev)
+ y = self.height - y
+
+ axis = EventMouseWheelAxis()
+ carbon.GetEventParameter(ev, kEventParamMouseWheelAxis,
+ typeMouseWheelAxis, c_void_p(), sizeof(axis), c_void_p(),
+ byref(axis))
+ delta = c_long()
+ carbon.GetEventParameter(ev, kEventParamMouseWheelDelta,
+ typeSInt32, c_void_p(), sizeof(delta), c_void_p(),
+ byref(delta))
+ if axis.value == kEventMouseWheelAxisX:
+ self.dispatch_event('on_mouse_scroll',
+ x, y, delta.value, 0)
+ else:
+ self.dispatch_event('on_mouse_scroll',
+ x, y, 0, delta.value)
+
+ # _Don't_ call the next handler, which is application, as this then
+ # calls our window handler again.
+ #carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @CarbonEventHandler(kEventClassWindow, kEventWindowClose)
+ def _on_window_close(self, next_handler, ev, data):
+ self.dispatch_event('on_close')
+
+ # Presumably the next event handler is the one that closes
+ # the window; don't do that here.
+ #carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @CarbonEventHandler(kEventClassWindow, kEventWindowResizeStarted)
+ def _on_window_resize_started(self, next_handler, ev, data):
+ from pyglet import app
+ if app.event_loop is not None:
+ app.event_loop.enter_blocking()
+
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @CarbonEventHandler(kEventClassWindow, kEventWindowResizeCompleted)
+ def _on_window_resize_completed(self, next_handler, ev, data):
+ from pyglet import app
+ if app.event_loop is not None:
+ app.event_loop.exit_blocking()
+
+ rect = Rect()
+ carbon.GetWindowBounds(self._window, kWindowContentRgn, byref(rect))
+ width = rect.right - rect.left
+ height = rect.bottom - rect.top
+
+ self.switch_to()
+ self.dispatch_event('on_resize', width, height)
+ self.dispatch_event('on_expose')
+
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ _dragging = False
+
+ @CarbonEventHandler(kEventClassWindow, kEventWindowDragStarted)
+ def _on_window_drag_started(self, next_handler, ev, data):
+ self._dragging = True
+
+ from pyglet import app
+ if app.event_loop is not None:
+ app.event_loop.enter_blocking()
+
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @CarbonEventHandler(kEventClassWindow, kEventWindowDragCompleted)
+ def _on_window_drag_completed(self, next_handler, ev, data):
+ self._dragging = False
+
+ from pyglet import app
+ if app.event_loop is not None:
+ app.event_loop.exit_blocking()
+
+ rect = Rect()
+ carbon.GetWindowBounds(self._window, kWindowContentRgn, byref(rect))
+
+ self.dispatch_event('on_move', rect.left, rect.top)
+
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @CarbonEventHandler(kEventClassWindow, kEventWindowBoundsChanging)
+ def _on_window_bounds_changing(self, next_handler, ev, data):
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @CarbonEventHandler(kEventClassWindow, kEventWindowBoundsChanged)
+ def _on_window_bounds_change(self, next_handler, ev, data):
+ self._update_track_region()
+
+ rect = Rect()
+ carbon.GetWindowBounds(self._window, kWindowContentRgn, byref(rect))
+ width = rect.right - rect.left
+ height = rect.bottom - rect.top
+ if width != self._width or height != self._height:
+ self._update_drawable()
+ self.switch_to()
+ self.dispatch_event('on_resize', width, height)
+
+ from pyglet import app
+ if app.event_loop is not None:
+ app.event_loop.enter_blocking()
+
+ self._width = width
+ self._height = height
+ else:
+ self.dispatch_event('on_move', rect.left, rect.top)
+
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @CarbonEventHandler(kEventClassWindow, kEventWindowZoomed)
+ def _on_window_zoomed(self, next_handler, ev, data):
+ rect = Rect()
+ carbon.GetWindowBounds(self._window, kWindowContentRgn, byref(rect))
+ width = rect.right - rect.left
+ height = rect.bottom - rect.top
+
+ self.dispatch_event('on_move', rect.left, rect.top)
+ self.dispatch_event('on_resize', width, height)
+
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @CarbonEventHandler(kEventClassWindow, kEventWindowActivated)
+ def _on_window_activated(self, next_handler, ev, data):
+ self.dispatch_event('on_activate')
+
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @CarbonEventHandler(kEventClassWindow, kEventWindowDeactivated)
+ def _on_window_deactivated(self, next_handler, ev, data):
+ self.dispatch_event('on_deactivate')
+
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @CarbonEventHandler(kEventClassWindow, kEventWindowShown)
+ @CarbonEventHandler(kEventClassWindow, kEventWindowExpanded)
+ def _on_window_shown(self, next_handler, ev, data):
+ self._update_drawable() # XXX not needed here according to apple docs
+ self.dispatch_event('on_show')
+
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @CarbonEventHandler(kEventClassWindow, kEventWindowHidden)
+ @CarbonEventHandler(kEventClassWindow, kEventWindowCollapsed)
+ def _on_window_hidden(self, next_handler, ev, data):
+ self.dispatch_event('on_hide')
+
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+ @CarbonEventHandler(kEventClassWindow, kEventWindowDrawContent)
+ def _on_window_draw_content(self, next_handler, ev, data):
+ self.dispatch_event('on_expose')
+
+ carbon.CallNextEventHandler(next_handler, ev)
+ return noErr
+
+CarbonWindow.register_event_type('on_recreate_immediate')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/cocoa/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/cocoa/__init__.py
new file mode 100644
index 0000000..0a77248
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/cocoa/__init__.py
@@ -0,0 +1,621 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+from __future__ import absolute_import
+from __future__ import division
+from past.utils import old_div
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+from ctypes import *
+
+import pyglet
+from pyglet import gl
+from pyglet.window import BaseWindow, WindowException
+from pyglet.window import MouseCursor, DefaultMouseCursor
+from pyglet.event import EventDispatcher
+
+from pyglet.canvas.cocoa import CocoaCanvas
+
+from pyglet.libs.darwin.cocoapy import *
+
+from .systemcursor import SystemCursor
+from .pyglet_delegate import PygletDelegate
+from .pyglet_textview import PygletTextView
+from .pyglet_window import PygletWindow, PygletToolWindow
+from .pyglet_view import PygletView
+
+NSApplication = ObjCClass('NSApplication')
+NSCursor = ObjCClass('NSCursor')
+NSAutoreleasePool = ObjCClass('NSAutoreleasePool')
+NSColor = ObjCClass('NSColor')
+NSEvent = ObjCClass('NSEvent')
+NSImage = ObjCClass('NSImage')
+
+class CocoaMouseCursor(MouseCursor):
+ drawable = False
+ def __init__(self, cursorName):
+ # cursorName is a string identifying one of the named default NSCursors
+ # e.g. 'pointingHandCursor', and can be sent as message to NSCursor class.
+ self.cursorName = cursorName
+ def set(self):
+ cursor = getattr(NSCursor, self.cursorName)()
+ cursor.set()
+
+class CocoaWindow(BaseWindow):
+
+ # NSWindow instance.
+ _nswindow = None
+
+ # Delegate object.
+ _delegate = None
+
+ # Window properties
+ _minimum_size = None
+ _maximum_size = None
+
+ _is_mouse_exclusive = False
+ _mouse_platform_visible = True
+ _mouse_ignore_motion = False
+
+ _is_keyboard_exclusive = False
+
+ # Flag set during close() method.
+ _was_closed = False
+
+ # NSWindow style masks.
+ _style_masks = {
+ BaseWindow.WINDOW_STYLE_DEFAULT: NSTitledWindowMask |
+ NSClosableWindowMask |
+ NSMiniaturizableWindowMask,
+ BaseWindow.WINDOW_STYLE_DIALOG: NSTitledWindowMask |
+ NSClosableWindowMask,
+ BaseWindow.WINDOW_STYLE_TOOL: NSTitledWindowMask |
+ NSClosableWindowMask |
+ NSUtilityWindowMask,
+ BaseWindow.WINDOW_STYLE_BORDERLESS: NSBorderlessWindowMask,
+ }
+
+ def _recreate(self, changes):
+ if ('context' in changes):
+ self.context.set_current()
+
+ if 'fullscreen' in changes:
+ if not self._fullscreen: # leaving fullscreen
+ self.screen.release_display()
+
+ self._create()
+
+ def _create(self):
+ # Create a temporary autorelease pool for this method.
+ pool = NSAutoreleasePool.alloc().init()
+
+ if self._nswindow:
+ # The window is about the be recreated so destroy everything
+ # associated with the old window, then destroy the window itself.
+ nsview = self.canvas.nsview
+ self.canvas = None
+ self._nswindow.orderOut_(None)
+ self._nswindow.close()
+ self.context.detach()
+ self._nswindow.release()
+ self._nswindow = None
+ nsview.release()
+ self._delegate.release()
+ self._delegate = None
+
+ # Determine window parameters.
+ content_rect = NSMakeRect(0, 0, self._width, self._height)
+ WindowClass = PygletWindow
+ if self._fullscreen:
+ style_mask = NSBorderlessWindowMask
+ else:
+ if self._style not in self._style_masks:
+ self._style = self.WINDOW_STYLE_DEFAULT
+ style_mask = self._style_masks[self._style]
+ if self._resizable:
+ style_mask |= NSResizableWindowMask
+ if self._style == BaseWindow.WINDOW_STYLE_TOOL:
+ WindowClass = PygletToolWindow
+
+ # First create an instance of our NSWindow subclass.
+
+ # FIX ME:
+ # Need to use this initializer to have any hope of multi-monitor support.
+ # But currently causes problems on Mac OS X Lion. So for now, we initialize the
+ # window without including screen information.
+ #
+ # self._nswindow = WindowClass.alloc().initWithContentRect_styleMask_backing_defer_screen_(
+ # content_rect, # contentRect
+ # style_mask, # styleMask
+ # NSBackingStoreBuffered, # backing
+ # False, # defer
+ # self.screen.get_nsscreen()) # screen
+
+ self._nswindow = WindowClass.alloc().initWithContentRect_styleMask_backing_defer_(
+ content_rect, # contentRect
+ style_mask, # styleMask
+ NSBackingStoreBuffered, # backing
+ False) # defer
+
+ if self._fullscreen:
+ # BUG: I suspect that this doesn't do the right thing when using
+ # multiple monitors (which would be to go fullscreen on the monitor
+ # where the window is located). However I've no way to test.
+ blackColor = NSColor.blackColor()
+ self._nswindow.setBackgroundColor_(blackColor)
+ self._nswindow.setOpaque_(True)
+ self.screen.capture_display()
+ self._nswindow.setLevel_(quartz.CGShieldingWindowLevel())
+ self.context.set_full_screen()
+ self._center_window()
+ self._mouse_in_window = True
+ else:
+ self._set_nice_window_location()
+ self._mouse_in_window = self._mouse_in_content_rect()
+
+ # Then create a view and set it as our NSWindow's content view.
+ self._nsview = PygletView.alloc().initWithFrame_cocoaWindow_(content_rect, self)
+ self._nswindow.setContentView_(self._nsview)
+ self._nswindow.makeFirstResponder_(self._nsview)
+
+ # Create a canvas with the view as its drawable and attach context to it.
+ self.canvas = CocoaCanvas(self.display, self.screen, self._nsview)
+ self.context.attach(self.canvas)
+
+ # Configure the window.
+ self._nswindow.setAcceptsMouseMovedEvents_(True)
+ self._nswindow.setReleasedWhenClosed_(False)
+ self._nswindow.useOptimizedDrawing_(True)
+ self._nswindow.setPreservesContentDuringLiveResize_(False)
+
+ # Set the delegate.
+ self._delegate = PygletDelegate.alloc().initWithWindow_(self)
+
+ # Configure CocoaWindow.
+ self.set_caption(self._caption)
+ if self._minimum_size is not None:
+ self.set_minimum_size(*self._minimum_size)
+ if self._maximum_size is not None:
+ self.set_maximum_size(*self._maximum_size)
+
+ self.context.update_geometry()
+ self.switch_to()
+ self.set_vsync(self._vsync)
+ self.set_visible(self._visible)
+
+ pool.drain()
+
+ def _set_nice_window_location(self):
+ # Construct a list of all visible windows that aren't us.
+ visible_windows = [ win for win in pyglet.app.windows if
+ win is not self and
+ win._nswindow and
+ win._nswindow.isVisible() ]
+ # If there aren't any visible windows, then center this window.
+ if not visible_windows:
+ self._center_window()
+ # Otherwise, cascade from last window in list.
+ else:
+ point = visible_windows[-1]._nswindow.cascadeTopLeftFromPoint_(NSZeroPoint)
+ self._nswindow.cascadeTopLeftFromPoint_(point)
+
+ def _center_window(self):
+ # [NSWindow center] does not move the window to a true center position
+ # and also always moves the window to the main display.
+ x = self.screen.x + int((self.screen.width - self._width) // 2)
+ y = self.screen.y + int((self.screen.height - self._height) // 2)
+ self._nswindow.setFrameOrigin_(NSPoint(x, y))
+
+ def close(self):
+ # If we've already gone through this once, don't do it again.
+ if self._was_closed:
+ return
+
+ # Create a temporary autorelease pool for this method.
+ pool = NSAutoreleasePool.new()
+
+ # Restore cursor visibility
+ self.set_mouse_platform_visible(True)
+ self.set_exclusive_mouse(False)
+ self.set_exclusive_keyboard(False)
+
+ # Remove the delegate object
+ if self._delegate:
+ self._nswindow.setDelegate_(None)
+ self._delegate.release()
+ self._delegate = None
+
+ # Remove window from display and remove its view.
+ if self._nswindow:
+ self._nswindow.orderOut_(None)
+ self._nswindow.setContentView_(None)
+ self._nswindow.close()
+
+ # Restore screen mode. This also releases the display
+ # if it was captured for fullscreen mode.
+ self.screen.restore_mode()
+
+ # Remove view from canvas and then remove canvas.
+ if self.canvas:
+ self.canvas.nsview.release()
+ self.canvas.nsview = None
+ self.canvas = None
+
+ # Do this last, so that we don't see white flash
+ # when exiting application from fullscreen mode.
+ super(CocoaWindow, self).close()
+
+ self._was_closed = True
+ pool.drain()
+
+ def switch_to(self):
+ if self.context:
+ self.context.set_current()
+
+ def flip(self):
+ self.draw_mouse_cursor()
+ if self.context:
+ self.context.flip()
+
+ def dispatch_events(self):
+ self._allow_dispatch_event = True
+ # Process all pyglet events.
+ self.dispatch_pending_events()
+ event = True
+
+ # Dequeue and process all of the pending Cocoa events.
+ pool = NSAutoreleasePool.new()
+ NSApp = NSApplication.sharedApplication()
+ while event and self._nswindow and self._context:
+ event = NSApp.nextEventMatchingMask_untilDate_inMode_dequeue_(
+ NSAnyEventMask, None, NSEventTrackingRunLoopMode, True)
+
+ if event:
+ event_type = event.type()
+ # Pass on all events.
+ NSApp.sendEvent_(event)
+ # And resend key events to special handlers.
+ if event_type == NSKeyDown and not event.isARepeat():
+ NSApp.sendAction_to_from_(get_selector('pygletKeyDown:'), None, event)
+ elif event_type == NSKeyUp:
+ NSApp.sendAction_to_from_(get_selector('pygletKeyUp:'), None, event)
+ elif event_type == NSFlagsChanged:
+ NSApp.sendAction_to_from_(get_selector('pygletFlagsChanged:'), None, event)
+ NSApp.updateWindows()
+
+ pool.drain()
+
+ self._allow_dispatch_event = False
+
+ def dispatch_pending_events(self):
+ while self._event_queue:
+ event = self._event_queue.pop(0)
+ EventDispatcher.dispatch_event(self, *event)
+
+ def set_caption(self, caption):
+ self._caption = caption
+ if self._nswindow is not None:
+ self._nswindow.setTitle_(get_NSString(caption))
+
+ def set_icon(self, *images):
+ # Only use the biggest image from the list.
+ max_image = images[0]
+ for img in images:
+ if img.width > max_image.width and img.height > max_image.height:
+ max_image = img
+
+ # Grab image data from pyglet image.
+ image = max_image.get_image_data()
+ format = 'ARGB'
+ bytesPerRow = len(format) * image.width
+ data = image.get_data(format, -bytesPerRow)
+
+ # Use image data to create a data provider.
+ # Using CGDataProviderCreateWithData crashes PyObjC 2.2b3, so we create
+ # a CFDataRef object first and use it to create the data provider.
+ cfdata = c_void_p(cf.CFDataCreate(None, data, len(data)))
+ provider = c_void_p(quartz.CGDataProviderCreateWithCFData(cfdata))
+
+ colorSpace = c_void_p(quartz.CGColorSpaceCreateDeviceRGB())
+
+ # Then create a CGImage from the provider.
+ cgimage = c_void_p(quartz.CGImageCreate(
+ image.width, image.height, 8, 32, bytesPerRow,
+ colorSpace,
+ kCGImageAlphaFirst,
+ provider,
+ None,
+ True,
+ kCGRenderingIntentDefault))
+
+ if not cgimage:
+ return
+
+ cf.CFRelease(cfdata)
+ quartz.CGDataProviderRelease(provider)
+ quartz.CGColorSpaceRelease(colorSpace)
+
+ # Turn the CGImage into an NSImage.
+ size = NSMakeSize(image.width, image.height)
+ nsimage = NSImage.alloc().initWithCGImage_size_(cgimage, size)
+ if not nsimage:
+ return
+
+ # And finally set the app icon.
+ NSApp = NSApplication.sharedApplication()
+ NSApp.setApplicationIconImage_(nsimage)
+ nsimage.release()
+
+ def get_location(self):
+ window_frame = self._nswindow.frame()
+ rect = self._nswindow.contentRectForFrameRect_(window_frame)
+ screen_frame = self._nswindow.screen().frame()
+ screen_width = int(screen_frame.size.width)
+ screen_height = int(screen_frame.size.height)
+ return int(rect.origin.x), int(screen_height - rect.origin.y - rect.size.height)
+
+ def set_location(self, x, y):
+ window_frame = self._nswindow.frame()
+ rect = self._nswindow.contentRectForFrameRect_(window_frame)
+ screen_frame = self._nswindow.screen().frame()
+ screen_width = int(screen_frame.size.width)
+ screen_height = int(screen_frame.size.height)
+ origin = NSPoint(x, screen_height - y - rect.size.height)
+ self._nswindow.setFrameOrigin_(origin)
+
+ def get_size(self):
+ window_frame = self._nswindow.frame()
+ rect = self._nswindow.contentRectForFrameRect_(window_frame)
+ return int(rect.size.width), int(rect.size.height)
+
+ def set_size(self, width, height):
+ if self._fullscreen:
+ raise WindowException('Cannot set size of fullscreen window.')
+ self._width = max(1, int(width))
+ self._height = max(1, int(height))
+ # Move frame origin down so that top-left corner of window doesn't move.
+ window_frame = self._nswindow.frame()
+ rect = self._nswindow.contentRectForFrameRect_(window_frame)
+ rect.origin.y += rect.size.height - self._height
+ rect.size.width = self._width
+ rect.size.height = self._height
+ new_frame = self._nswindow.frameRectForContentRect_(rect)
+ # The window background flashes when the frame size changes unless it's
+ # animated, but we can set the window's animationResizeTime to zero.
+ is_visible = self._nswindow.isVisible()
+ self._nswindow.setFrame_display_animate_(new_frame, True, is_visible)
+
+ def set_minimum_size(self, width, height):
+ self._minimum_size = NSSize(width, height)
+ if self._nswindow is not None:
+ self._nswindow.setContentMinSize_(self._minimum_size)
+
+ def set_maximum_size(self, width, height):
+ self._maximum_size = NSSize(width, height)
+ if self._nswindow is not None:
+ self._nswindow.setContentMaxSize_(self._maximum_size)
+
+ def activate(self):
+ if self._nswindow is not None:
+ NSApp = NSApplication.sharedApplication()
+ NSApp.activateIgnoringOtherApps_(True)
+ self._nswindow.makeKeyAndOrderFront_(None)
+
+ def set_visible(self, visible=True):
+ self._visible = visible
+ if self._nswindow is not None:
+ if visible:
+ # Not really sure why on_resize needs to be here,
+ # but it's what pyglet wants.
+ self.dispatch_event('on_resize', self._width, self._height)
+ self.dispatch_event('on_show')
+ self.dispatch_event('on_expose')
+ self._nswindow.makeKeyAndOrderFront_(None)
+ else:
+ self._nswindow.orderOut_(None)
+
+ def minimize(self):
+ self._mouse_in_window = False
+ if self._nswindow is not None:
+ self._nswindow.miniaturize_(None)
+
+ def maximize(self):
+ if self._nswindow is not None:
+ self._nswindow.zoom_(None)
+
+ def set_vsync(self, vsync):
+ if pyglet.options['vsync'] is not None:
+ vsync = pyglet.options['vsync']
+ self._vsync = vsync # _recreate depends on this
+ if self.context:
+ self.context.set_vsync(vsync)
+
+ def _mouse_in_content_rect(self):
+ # Returns true if mouse is inside the window's content rectangle.
+ # Better to use this method to check manually rather than relying
+ # on instance variables that may not be set correctly.
+ point = NSEvent.mouseLocation()
+ window_frame = self._nswindow.frame()
+ rect = self._nswindow.contentRectForFrameRect_(window_frame)
+ return foundation.NSMouseInRect(point, rect, False)
+
+ def set_mouse_platform_visible(self, platform_visible=None):
+ # When the platform_visible argument is supplied with a boolean, then this
+ # method simply sets whether or not the platform mouse cursor is visible.
+ if platform_visible is not None:
+ if platform_visible:
+ SystemCursor.unhide()
+ else:
+ SystemCursor.hide()
+ # But if it has been called without an argument, it turns into
+ # a completely different function. Now we are trying to figure out
+ # whether or not the mouse *should* be visible, and if so, what it should
+ # look like.
+ else:
+ # If we are in mouse exclusive mode, then hide the mouse cursor.
+ if self._is_mouse_exclusive:
+ SystemCursor.hide()
+ # If we aren't inside the window, then always show the mouse
+ # and make sure that it is the default cursor.
+ elif not self._mouse_in_content_rect():
+ NSCursor.arrowCursor().set()
+ SystemCursor.unhide()
+ # If we are in the window, then what we do depends on both
+ # the current pyglet-set visibility setting for the mouse and
+ # the type of the mouse cursor. If the cursor has been hidden
+ # in the window with set_mouse_visible() then don't show it.
+ elif not self._mouse_visible:
+ SystemCursor.hide()
+ # If the mouse is set as a system-defined cursor, then we
+ # need to set the cursor and show the mouse.
+ # *** FIX ME ***
+ elif isinstance(self._mouse_cursor, CocoaMouseCursor):
+ self._mouse_cursor.set()
+ SystemCursor.unhide()
+ # If the mouse cursor is drawable, then it we need to hide
+ # the system mouse cursor, so that the cursor can draw itself.
+ elif self._mouse_cursor.drawable:
+ SystemCursor.hide()
+ # Otherwise, show the default cursor.
+ else:
+ NSCursor.arrowCursor().set()
+ SystemCursor.unhide()
+
+ def get_system_mouse_cursor(self, name):
+ # It would make a lot more sense for most of this code to be
+ # inside the CocoaMouseCursor class, but all of the CURSOR_xxx
+ # constants are defined as properties of BaseWindow.
+ if name == self.CURSOR_DEFAULT:
+ return DefaultMouseCursor()
+ cursors = {
+ self.CURSOR_CROSSHAIR: 'crosshairCursor',
+ self.CURSOR_HAND: 'pointingHandCursor',
+ self.CURSOR_HELP: 'arrowCursor',
+ self.CURSOR_NO: 'operationNotAllowedCursor', # Mac OS 10.6
+ self.CURSOR_SIZE: 'arrowCursor',
+ self.CURSOR_SIZE_UP: 'resizeUpCursor',
+ self.CURSOR_SIZE_UP_RIGHT: 'arrowCursor',
+ self.CURSOR_SIZE_RIGHT: 'resizeRightCursor',
+ self.CURSOR_SIZE_DOWN_RIGHT: 'arrowCursor',
+ self.CURSOR_SIZE_DOWN: 'resizeDownCursor',
+ self.CURSOR_SIZE_DOWN_LEFT: 'arrowCursor',
+ self.CURSOR_SIZE_LEFT: 'resizeLeftCursor',
+ self.CURSOR_SIZE_UP_LEFT: 'arrowCursor',
+ self.CURSOR_SIZE_UP_DOWN: 'resizeUpDownCursor',
+ self.CURSOR_SIZE_LEFT_RIGHT: 'resizeLeftRightCursor',
+ self.CURSOR_TEXT: 'IBeamCursor',
+ self.CURSOR_WAIT: 'arrowCursor', # No wristwatch cursor in Cocoa
+ self.CURSOR_WAIT_ARROW: 'arrowCursor', # No wristwatch cursor in Cocoa
+ }
+ if name not in cursors:
+ raise RuntimeError('Unknown cursor name "%s"' % name)
+ return CocoaMouseCursor(cursors[name])
+
+ def set_mouse_position(self, x, y, absolute=False):
+ if absolute:
+ # If absolute, then x, y is given in global display coordinates
+ # which sets (0,0) at top left corner of main display. It is possible
+ # to warp the mouse position to a point inside of another display.
+ quartz.CGWarpMouseCursorPosition(CGPoint(x,y))
+ else:
+ # Window-relative coordinates: (x, y) are given in window coords
+ # with (0,0) at bottom-left corner of window and y up. We find
+ # which display the window is in and then convert x, y into local
+ # display coords where (0,0) is now top-left of display and y down.
+ screenInfo = self._nswindow.screen().deviceDescription()
+ displayID = screenInfo.objectForKey_(get_NSString('NSScreenNumber'))
+ displayID = displayID.intValue()
+ displayBounds = quartz.CGDisplayBounds(displayID)
+ frame = self._nswindow.frame()
+ windowOrigin = frame.origin
+ x += windowOrigin.x
+ y = displayBounds.size.height - windowOrigin.y - y
+ quartz.CGDisplayMoveCursorToPoint(displayID, NSPoint(x,y))
+
+ def set_exclusive_mouse(self, exclusive=True):
+ self._is_mouse_exclusive = exclusive
+ if exclusive:
+ # Skip the next motion event, which would return a large delta.
+ self._mouse_ignore_motion = True
+ # Move mouse to center of window.
+ frame = self._nswindow.frame()
+ width, height = frame.size.width, frame.size.height
+ self.set_mouse_position(width/2, height/2)
+ quartz.CGAssociateMouseAndMouseCursorPosition(False)
+ else:
+ quartz.CGAssociateMouseAndMouseCursorPosition(True)
+
+ # Update visibility of mouse cursor.
+ self.set_mouse_platform_visible()
+
+ def set_exclusive_keyboard(self, exclusive=True):
+ # http://developer.apple.com/mac/library/technotes/tn2002/tn2062.html
+ # http://developer.apple.com/library/mac/#technotes/KioskMode/
+
+ # BUG: System keys like F9 or command-tab are disabled, however
+ # pyglet also does not receive key press events for them.
+
+ # This flag is queried by window delegate to determine whether
+ # the quit menu item is active.
+ self._is_keyboard_exclusive = exclusive
+
+ if exclusive:
+ # "Be nice! Don't disable force-quit!"
+ # -- Patrick Swayze, Road House (1989)
+ options = NSApplicationPresentationHideDock | \
+ NSApplicationPresentationHideMenuBar | \
+ NSApplicationPresentationDisableProcessSwitching | \
+ NSApplicationPresentationDisableHideApplication
+ else:
+ options = NSApplicationPresentationDefault
+
+ NSApp = NSApplication.sharedApplication()
+ NSApp.setPresentationOptions_(options)
+
+ def on_resize(self, width, height):
+ """Override default implementation to support retina displays."""
+ view = self.context._nscontext.view()
+ bounds = view.convertRectToBacking_(view.bounds()).size
+ back_width, back_height = (int(bounds.width), int(bounds.height))
+
+ gl.glViewport(0, 0, back_width, back_height)
+ gl.glMatrixMode(gl.GL_PROJECTION)
+ gl.glLoadIdentity()
+ gl.glOrtho(0, width, 0, height, -1, 1)
+ gl.glMatrixMode(gl.GL_MODELVIEW)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/cocoa/pyglet_delegate.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/cocoa/pyglet_delegate.py
new file mode 100644
index 0000000..451292f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/cocoa/pyglet_delegate.py
@@ -0,0 +1,128 @@
+from __future__ import absolute_import
+from builtins import object
+from pyglet.libs.darwin.cocoapy import *
+from .systemcursor import SystemCursor
+
+NSNotificationCenter = ObjCClass('NSNotificationCenter')
+NSApplication = ObjCClass('NSApplication')
+
+class PygletDelegate_Implementation(object):
+ PygletDelegate = ObjCSubclass('NSObject', 'PygletDelegate')
+
+ @PygletDelegate.method(b'@'+PyObjectEncoding)
+ def initWithWindow_(self, window):
+ self = ObjCInstance(send_super(self, 'init'))
+
+ if not self:
+ return None
+
+ # CocoaWindow object.
+ self._window = window
+ window._nswindow.setDelegate_(self)
+
+ # Register delegate for hide and unhide notifications so that we
+ # can dispatch the corresponding pyglet events.
+ notificationCenter = NSNotificationCenter.defaultCenter()
+
+ notificationCenter.addObserver_selector_name_object_(
+ self, get_selector('applicationDidHide:'),
+ NSApplicationDidHideNotification, None)
+
+ notificationCenter.addObserver_selector_name_object_(
+ self, get_selector('applicationDidUnhide:'),
+ NSApplicationDidUnhideNotification, None)
+
+ # Flag set when we pause exclusive mouse mode if window loses key status.
+ self.did_pause_exclusive_mouse = False
+ return self
+
+ @PygletDelegate.method('v')
+ def dealloc(self):
+ # Unregister delegate from notification center.
+ notificationCenter = NSNotificationCenter.defaultCenter()
+ notificationCenter.removeObserver_(self)
+ self._window = None
+ send_super(self, 'dealloc')
+
+ @PygletDelegate.method('v@')
+ def applicationDidHide_(self, notification):
+ self._window.dispatch_event("on_hide")
+
+ @PygletDelegate.method('v@')
+ def applicationDidUnhide_(self, notification):
+ if self._window._is_mouse_exclusive and quartz.CGCursorIsVisible():
+ # The cursor should be hidden, but for some reason it's not;
+ # try to force the cursor to hide (without over-hiding).
+ SystemCursor.unhide()
+ SystemCursor.hide()
+ pass
+ self._window.dispatch_event("on_show")
+
+ @PygletDelegate.method('B@')
+ def windowShouldClose_(self, notification):
+ # The method is not called if [NSWindow close] was used.
+ self._window.dispatch_event("on_close")
+ return False
+
+ @PygletDelegate.method('v@')
+ def windowDidMove_(self, notification):
+ x, y = self._window.get_location()
+ self._window.dispatch_event("on_move", x, y)
+
+ @PygletDelegate.method('v@')
+ def windowDidBecomeKey_(self, notification):
+ # Restore exclusive mouse mode if it was active before we lost key status.
+ if self.did_pause_exclusive_mouse:
+ self._window.set_exclusive_mouse(True)
+ self.did_pause_exclusive_mouse = False
+ self._window._nswindow.setMovable_(True) # Mac OS 10.6
+ # Restore previous mouse visibility settings.
+ self._window.set_mouse_platform_visible()
+ self._window.dispatch_event("on_activate")
+
+ @PygletDelegate.method('v@')
+ def windowDidResignKey_(self, notification):
+ # Pause exclusive mouse mode if it is active.
+ if self._window._is_mouse_exclusive:
+ self._window.set_exclusive_mouse(False)
+ self.did_pause_exclusive_mouse = True
+ # We need to prevent the window from being unintentionally dragged
+ # (by the call to set_mouse_position in set_exclusive_mouse) when
+ # the window is reactivated by clicking on its title bar.
+ self._window._nswindow.setMovable_(False) # Mac OS X 10.6
+ # Make sure that cursor is visible.
+ self._window.set_mouse_platform_visible(True)
+ self._window.dispatch_event("on_deactivate")
+
+ @PygletDelegate.method('v@')
+ def windowDidMiniaturize_(self, notification):
+ self._window.dispatch_event("on_hide")
+
+ @PygletDelegate.method('v@')
+ def windowDidDeminiaturize_(self, notification):
+ if self._window._is_mouse_exclusive and quartz.CGCursorIsVisible():
+ # The cursor should be hidden, but for some reason it's not;
+ # try to force the cursor to hide (without over-hiding).
+ SystemCursor.unhide()
+ SystemCursor.hide()
+ pass
+ self._window.dispatch_event("on_show")
+
+ @PygletDelegate.method('v@')
+ def windowDidExpose_(self, notification):
+ self._window.dispatch_event("on_expose")
+
+ @PygletDelegate.method('v@')
+ def terminate_(self, sender):
+ NSApp = NSApplication.sharedApplication()
+ NSApp.terminate_(self)
+
+ @PygletDelegate.method('B@')
+ def validateMenuItem_(self, menuitem):
+ # Disable quitting with command-q when in keyboard exclusive mode.
+ if menuitem.action() == get_selector('terminate:'):
+ return not self._window._is_keyboard_exclusive
+ return True
+
+
+PygletDelegate = ObjCClass('PygletDelegate')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/cocoa/pyglet_textview.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/cocoa/pyglet_textview.py
new file mode 100644
index 0000000..1f3e876
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/cocoa/pyglet_textview.py
@@ -0,0 +1,160 @@
+from builtins import chr
+from builtins import object
+import unicodedata
+
+from pyglet.window import key
+
+from pyglet.libs.darwin.cocoapy import *
+
+NSArray = ObjCClass('NSArray')
+NSApplication = ObjCClass('NSApplication')
+
+# This custom NSTextView subclass is used for capturing all of the
+# on_text, on_text_motion, and on_text_motion_select events.
+class PygletTextView_Implementation(object):
+ PygletTextView = ObjCSubclass('NSTextView', 'PygletTextView')
+
+ @PygletTextView.method(b'@'+PyObjectEncoding)
+ def initWithCocoaWindow_(self, window):
+ self = ObjCInstance(send_super(self, 'init'))
+ if not self:
+ return None
+ self._window = window
+ # Interpret tab and return as raw characters
+ self.setFieldEditor_(False)
+ self.empty_string = CFSTR("")
+ return self
+
+ @PygletTextView.method('v')
+ def dealloc(self):
+ self.empty_string.release()
+
+ @PygletTextView.method('v@')
+ def keyDown_(self, nsevent):
+ array = NSArray.arrayWithObject_(nsevent)
+ self.interpretKeyEvents_(array)
+
+ @PygletTextView.method('v@')
+ def insertText_(self, text):
+ text = cfstring_to_string(text)
+ self.setString_(self.empty_string)
+ # Don't send control characters (tab, newline) as on_text events.
+ if unicodedata.category(text[0]) != 'Cc':
+ self._window.dispatch_event("on_text", text)
+
+ @PygletTextView.method('v@')
+ def insertNewline_(self, sender):
+ # Distinguish between carriage return (u'\r') and enter (u'\x03').
+ # Only the return key press gets sent as an on_text event.
+ event = NSApplication.sharedApplication().currentEvent()
+ chars = event.charactersIgnoringModifiers()
+ ch = chr(chars.characterAtIndex_(0))
+ if ch == u'\r':
+ self._window.dispatch_event("on_text", u'\r')
+
+ @PygletTextView.method('v@')
+ def moveUp_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_UP)
+
+ @PygletTextView.method('v@')
+ def moveDown_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_DOWN)
+
+ @PygletTextView.method('v@')
+ def moveLeft_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_LEFT)
+
+ @PygletTextView.method('v@')
+ def moveRight_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_RIGHT)
+
+ @PygletTextView.method('v@')
+ def moveWordLeft_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_PREVIOUS_WORD)
+
+ @PygletTextView.method('v@')
+ def moveWordRight_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_NEXT_WORD)
+
+ @PygletTextView.method('v@')
+ def moveToBeginningOfLine_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_BEGINNING_OF_LINE)
+
+ @PygletTextView.method('v@')
+ def moveToEndOfLine_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_END_OF_LINE)
+
+ @PygletTextView.method('v@')
+ def scrollPageUp_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_PREVIOUS_PAGE)
+
+ @PygletTextView.method('v@')
+ def scrollPageDown_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_NEXT_PAGE)
+
+ @PygletTextView.method('v@')
+ def scrollToBeginningOfDocument_(self, sender): # Mac OS X 10.6
+ self._window.dispatch_event("on_text_motion", key.MOTION_BEGINNING_OF_FILE)
+
+ @PygletTextView.method('v@')
+ def scrollToEndOfDocument_(self, sender): # Mac OS X 10.6
+ self._window.dispatch_event("on_text_motion", key.MOTION_END_OF_FILE)
+
+ @PygletTextView.method('v@')
+ def deleteBackward_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_BACKSPACE)
+
+ @PygletTextView.method('v@')
+ def deleteForward_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_DELETE)
+
+ @PygletTextView.method('v@')
+ def moveUpAndModifySelection_(self, sender):
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_UP)
+
+ @PygletTextView.method('v@')
+ def moveDownAndModifySelection_(self, sender):
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_DOWN)
+
+ @PygletTextView.method('v@')
+ def moveLeftAndModifySelection_(self, sender):
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_LEFT)
+
+ @PygletTextView.method('v@')
+ def moveRightAndModifySelection_(self, sender):
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_RIGHT)
+
+ @PygletTextView.method('v@')
+ def moveWordLeftAndModifySelection_(self, sender):
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_PREVIOUS_WORD)
+
+ @PygletTextView.method('v@')
+ def moveWordRightAndModifySelection_(self, sender):
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_NEXT_WORD)
+
+ @PygletTextView.method('v@')
+ def moveToBeginningOfLineAndModifySelection_(self, sender): # Mac OS X 10.6
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_BEGINNING_OF_LINE)
+
+ @PygletTextView.method('v@')
+ def moveToEndOfLineAndModifySelection_(self, sender): # Mac OS X 10.6
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_END_OF_LINE)
+
+ @PygletTextView.method('v@')
+ def pageUpAndModifySelection_(self, sender): # Mac OS X 10.6
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_PREVIOUS_PAGE)
+
+ @PygletTextView.method('v@')
+ def pageDownAndModifySelection_(self, sender): # Mac OS X 10.6
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_NEXT_PAGE)
+
+ @PygletTextView.method('v@')
+ def moveToBeginningOfDocumentAndModifySelection_(self, sender): # Mac OS X 10.6
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_BEGINNING_OF_FILE)
+
+ @PygletTextView.method('v@')
+ def moveToEndOfDocumentAndModifySelection_(self, sender): # Mac OS X 10.6
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_END_OF_FILE)
+
+
+PygletTextView = ObjCClass('PygletTextView')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/cocoa/pyglet_view.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/cocoa/pyglet_view.py
new file mode 100644
index 0000000..bc7afb2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/cocoa/pyglet_view.py
@@ -0,0 +1,337 @@
+from builtins import object
+from pyglet.window import key, mouse
+from pyglet.libs.darwin.quartzkey import keymap, charmap
+
+from pyglet.libs.darwin.cocoapy import *
+
+NSTrackingArea = ObjCClass('NSTrackingArea')
+
+# Event data helper functions.
+
+def getMouseDelta(nsevent):
+ dx = nsevent.deltaX()
+ dy = -nsevent.deltaY()
+ return int(round(dx)), int(round(dy))
+
+def getMousePosition(self, nsevent):
+ in_window = nsevent.locationInWindow()
+ in_window = self.convertPoint_fromView_(in_window, None)
+ x = int(in_window.x)
+ y = int(in_window.y)
+ # Must record mouse position for BaseWindow.draw_mouse_cursor to work.
+ self._window._mouse_x = x
+ self._window._mouse_y = y
+ return x, y
+
+def getModifiers(nsevent):
+ modifiers = 0
+ modifierFlags = nsevent.modifierFlags()
+ if modifierFlags & NSAlphaShiftKeyMask:
+ modifiers |= key.MOD_CAPSLOCK
+ if modifierFlags & NSShiftKeyMask:
+ modifiers |= key.MOD_SHIFT
+ if modifierFlags & NSControlKeyMask:
+ modifiers |= key.MOD_CTRL
+ if modifierFlags & NSAlternateKeyMask:
+ modifiers |= key.MOD_ALT
+ modifiers |= key.MOD_OPTION
+ if modifierFlags & NSCommandKeyMask:
+ modifiers |= key.MOD_COMMAND
+ if modifierFlags & NSFunctionKeyMask:
+ modifiers |= key.MOD_FUNCTION
+ return modifiers
+
+def getSymbol(nsevent):
+ keycode = nsevent.keyCode()
+ return keymap[keycode]
+
+
+class PygletView_Implementation(object):
+ PygletView = ObjCSubclass('NSView', 'PygletView')
+
+ @PygletView.method(b'@'+NSRectEncoding+PyObjectEncoding)
+ def initWithFrame_cocoaWindow_(self, frame, window):
+
+ # The tracking area is used to get mouseEntered, mouseExited, and cursorUpdate
+ # events so that we can custom set the mouse cursor within the view.
+ self._tracking_area = None
+
+ self = ObjCInstance(send_super(self, 'initWithFrame:', frame, argtypes=[NSRect]))
+
+ if not self:
+ return None
+
+ # CocoaWindow object.
+ self._window = window
+ self.updateTrackingAreas()
+
+ # Create an instance of PygletTextView to handle text events.
+ # We must do this because NSOpenGLView doesn't conform to the
+ # NSTextInputClient protocol by default, and the insertText: method will
+ # not do the right thing with respect to translating key sequences like
+ # "Option-e", "e" if the protocol isn't implemented. So the easiest
+ # thing to do is to subclass NSTextView which *does* implement the
+ # protocol and let it handle text input.
+ PygletTextView = ObjCClass('PygletTextView')
+ self._textview = PygletTextView.alloc().initWithCocoaWindow_(window)
+ # Add text view to the responder chain.
+ self.addSubview_(self._textview)
+ return self
+
+ @PygletView.method('v')
+ def dealloc(self):
+ self._window = None
+ #send_message(self.objc_self, 'removeFromSuperviewWithoutNeedingDisplay')
+ self._textview.release()
+ self._textview = None
+ self._tracking_area.release()
+ self._tracking_area = None
+ send_super(self, 'dealloc')
+
+ @PygletView.method('v')
+ def updateTrackingAreas(self):
+ # This method is called automatically whenever the tracking areas need to be
+ # recreated, for example when window resizes.
+ if self._tracking_area:
+ self.removeTrackingArea_(self._tracking_area)
+ self._tracking_area.release()
+ self._tracking_area = None
+
+ tracking_options = NSTrackingMouseEnteredAndExited | NSTrackingActiveInActiveApp | NSTrackingCursorUpdate
+ frame = self.frame()
+
+ self._tracking_area = NSTrackingArea.alloc().initWithRect_options_owner_userInfo_(
+ frame, # rect
+ tracking_options, # options
+ self, # owner
+ None) # userInfo
+
+ self.addTrackingArea_(self._tracking_area)
+
+ @PygletView.method('B')
+ def canBecomeKeyView(self):
+ return True
+
+ @PygletView.method('B')
+ def isOpaque(self):
+ return True
+
+ ## Event responders.
+
+ # This method is called whenever the view changes size.
+ @PygletView.method(b'v'+NSSizeEncoding)
+ def setFrameSize_(self, size):
+ send_super(self, 'setFrameSize:', size, argtypes=[NSSize])
+
+ # This method is called when view is first installed as the
+ # contentView of window. Don't do anything on first call.
+ # This also helps ensure correct window creation event ordering.
+ if not self._window.context.canvas:
+ return
+
+ width, height = int(size.width), int(size.height)
+ self._window.switch_to()
+ self._window.context.update_geometry()
+ self._window.dispatch_event("on_resize", width, height)
+ self._window.dispatch_event("on_expose")
+ # Can't get app.event_loop.enter_blocking() working with Cocoa, because
+ # when mouse clicks on the window's resize control, Cocoa enters into a
+ # mini-event loop that only responds to mouseDragged and mouseUp events.
+ # This means that using NSTimer to call idle() won't work. Our kludge
+ # is to override NSWindow's nextEventMatchingMask_etc method and call
+ # idle() from there.
+ if self.inLiveResize():
+ from pyglet import app
+ if app.event_loop is not None:
+ app.event_loop.idle()
+
+ @PygletView.method('v@')
+ def pygletKeyDown_(self, nsevent):
+ symbol = getSymbol(nsevent)
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_key_press', symbol, modifiers)
+
+ @PygletView.method('v@')
+ def pygletKeyUp_(self, nsevent):
+ symbol = getSymbol(nsevent)
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_key_release', symbol, modifiers)
+
+ @PygletView.method('v@')
+ def pygletFlagsChanged_(self, nsevent):
+ # Handles on_key_press and on_key_release events for modifier keys.
+ # Note that capslock is handled differently than other keys; it acts
+ # as a toggle, so on_key_release is only sent when it's turned off.
+
+ # TODO: Move these constants somewhere else.
+ # Undocumented left/right modifier masks found by experimentation:
+ NSLeftShiftKeyMask = 1 << 1
+ NSRightShiftKeyMask = 1 << 2
+ NSLeftControlKeyMask = 1 << 0
+ NSRightControlKeyMask = 1 << 13
+ NSLeftAlternateKeyMask = 1 << 5
+ NSRightAlternateKeyMask = 1 << 6
+ NSLeftCommandKeyMask = 1 << 3
+ NSRightCommandKeyMask = 1 << 4
+
+ maskForKey = { key.LSHIFT : NSLeftShiftKeyMask,
+ key.RSHIFT : NSRightShiftKeyMask,
+ key.LCTRL : NSLeftControlKeyMask,
+ key.RCTRL : NSRightControlKeyMask,
+ key.LOPTION : NSLeftAlternateKeyMask,
+ key.ROPTION : NSRightAlternateKeyMask,
+ key.LCOMMAND : NSLeftCommandKeyMask,
+ key.RCOMMAND : NSRightCommandKeyMask,
+ key.CAPSLOCK : NSAlphaShiftKeyMask,
+ key.FUNCTION : NSFunctionKeyMask }
+
+ symbol = getSymbol(nsevent)
+
+ # Ignore this event if symbol is not a modifier key. We must check this
+ # because e.g., we receive a flagsChanged message when using CMD-tab to
+ # switch applications, with symbol == "a" when command key is released.
+ if symbol not in maskForKey:
+ return
+
+ modifiers = getModifiers(nsevent)
+ modifierFlags = nsevent.modifierFlags()
+
+ if symbol and modifierFlags & maskForKey[symbol]:
+ self._window.dispatch_event('on_key_press', symbol, modifiers)
+ else:
+ self._window.dispatch_event('on_key_release', symbol, modifiers)
+
+ # Overriding this method helps prevent system beeps for unhandled events.
+ @PygletView.method('B@')
+ def performKeyEquivalent_(self, nsevent):
+ # Let arrow keys and certain function keys pass through the responder
+ # chain so that the textview can handle on_text_motion events.
+ modifierFlags = nsevent.modifierFlags()
+ if modifierFlags & NSNumericPadKeyMask:
+ return False
+ if modifierFlags & NSFunctionKeyMask:
+ ch = cfstring_to_string(nsevent.charactersIgnoringModifiers())
+ if ch in (NSHomeFunctionKey, NSEndFunctionKey,
+ NSPageUpFunctionKey, NSPageDownFunctionKey):
+ return False
+ # Send the key equivalent to the main menu to perform menu items.
+ NSApp = ObjCClass('NSApplication').sharedApplication()
+ NSApp.mainMenu().performKeyEquivalent_(nsevent)
+ # Indicate that we've handled the event so system won't beep.
+ return True
+
+ @PygletView.method('v@')
+ def mouseMoved_(self, nsevent):
+ if self._window._mouse_ignore_motion:
+ self._window._mouse_ignore_motion = False
+ return
+ # Don't send on_mouse_motion events if we're not inside the content rectangle.
+ if not self._window._mouse_in_window:
+ return
+ x, y = getMousePosition(self, nsevent)
+ dx, dy = getMouseDelta(nsevent)
+ self._window.dispatch_event('on_mouse_motion', x, y, dx, dy)
+
+ @PygletView.method('v@')
+ def scrollWheel_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ scroll_x, scroll_y = getMouseDelta(nsevent)
+ self._window.dispatch_event('on_mouse_scroll', x, y, scroll_x, scroll_y)
+
+ @PygletView.method('v@')
+ def mouseDown_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ buttons = mouse.LEFT
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_mouse_press', x, y, buttons, modifiers)
+
+ @PygletView.method('v@')
+ def mouseDragged_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ dx, dy = getMouseDelta(nsevent)
+ buttons = mouse.LEFT
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_mouse_drag', x, y, dx, dy, buttons, modifiers)
+
+ @PygletView.method('v@')
+ def mouseUp_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ buttons = mouse.LEFT
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_mouse_release', x, y, buttons, modifiers)
+
+ @PygletView.method('v@')
+ def rightMouseDown_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ buttons = mouse.RIGHT
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_mouse_press', x, y, buttons, modifiers)
+
+ @PygletView.method('v@')
+ def rightMouseDragged_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ dx, dy = getMouseDelta(nsevent)
+ buttons = mouse.RIGHT
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_mouse_drag', x, y, dx, dy, buttons, modifiers)
+
+ @PygletView.method('v@')
+ def rightMouseUp_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ buttons = mouse.RIGHT
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_mouse_release', x, y, buttons, modifiers)
+
+ @PygletView.method('v@')
+ def otherMouseDown_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ buttons = mouse.MIDDLE
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_mouse_press', x, y, buttons, modifiers)
+
+ @PygletView.method('v@')
+ def otherMouseDragged_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ dx, dy = getMouseDelta(nsevent)
+ buttons = mouse.MIDDLE
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_mouse_drag', x, y, dx, dy, buttons, modifiers)
+
+ @PygletView.method('v@')
+ def otherMouseUp_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ buttons = mouse.MIDDLE
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_mouse_release', x, y, buttons, modifiers)
+
+ @PygletView.method('v@')
+ def mouseEntered_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ self._window._mouse_in_window = True
+ # Don't call self._window.set_mouse_platform_visible() from here.
+ # Better to do it from cursorUpdate:
+ self._window.dispatch_event('on_mouse_enter', x, y)
+
+ @PygletView.method('v@')
+ def mouseExited_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ self._window._mouse_in_window = False
+ if not self._window._is_mouse_exclusive:
+ self._window.set_mouse_platform_visible()
+ self._window.dispatch_event('on_mouse_leave', x, y)
+
+ @PygletView.method('v@')
+ def cursorUpdate_(self, nsevent):
+ # Called when mouse cursor enters view. Unlike mouseEntered:,
+ # this method will be called if the view appears underneath a
+ # motionless mouse cursor, as can happen during window creation,
+ # or when switching into fullscreen mode.
+ # BUG: If the mouse enters the window via the resize control at the
+ # the bottom right corner, the resize control will set the cursor
+ # to the default arrow and screw up our cursor tracking.
+ self._window._mouse_in_window = True
+ if not self._window._is_mouse_exclusive:
+ self._window.set_mouse_platform_visible()
+
+
+PygletView = ObjCClass('PygletView')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/cocoa/pyglet_window.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/cocoa/pyglet_window.py
new file mode 100644
index 0000000..eb20ff6
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/cocoa/pyglet_window.py
@@ -0,0 +1,71 @@
+from builtins import object
+from pyglet.libs.darwin.cocoapy import *
+
+class PygletWindow_Implementation(object):
+ PygletWindow = ObjCSubclass('NSWindow', 'PygletWindow')
+
+ @PygletWindow.method('B')
+ def canBecomeKeyWindow(self):
+ return True
+
+ # When the window is being resized, it enters into a mini event loop that
+ # only looks at mouseDragged and mouseUp events, blocking everything else.
+ # Among other things, this makes it impossible to run an NSTimer to call the
+ # idle() function in order to update the view during the resize. So we
+ # override this method, called by the resizing event loop, and call the
+ # idle() function from here. This *almost* works. I can't figure out what
+ # is happening at the very beginning of a resize event. The NSView's
+ # viewWillStartLiveResize method is called and then nothing happens until
+ # the mouse is dragged. I think NSApplication's nextEventMatchingMask_etc
+ # method is being called instead of this one. I don't really feel like
+ # subclassing NSApplication just to fix this. Also, to prevent white flashes
+ # while resizing, we must also call idle() from the view's reshape method.
+ @PygletWindow.method(b'@'+NSUIntegerEncoding+b'@@B')
+ def nextEventMatchingMask_untilDate_inMode_dequeue_(self, mask, date, mode, dequeue):
+ if self.inLiveResize():
+ # Call the idle() method while we're stuck in a live resize event.
+ from pyglet import app
+ if app.event_loop is not None:
+ app.event_loop.idle()
+
+ event = send_super(self, 'nextEventMatchingMask:untilDate:inMode:dequeue:',
+ mask, date, mode, dequeue, argtypes=[NSUInteger, c_void_p, c_void_p, c_bool])
+
+ if event.value == None:
+ return 0
+ else:
+ return event.value
+
+
+ # Need this for set_size to not flash.
+ @PygletWindow.method(b'd'+NSRectEncoding)
+ def animationResizeTime_(self, newFrame):
+ return 0.0
+
+
+class PygletToolWindow_Implementation(object):
+ PygletToolWindow = ObjCSubclass('NSPanel', 'PygletToolWindow')
+
+ @PygletToolWindow.method(b'@'+NSUIntegerEncoding+b'@@B')
+ def nextEventMatchingMask_untilDate_inMode_dequeue_(self, mask, date, mode, dequeue):
+ if self.inLiveResize():
+ # Call the idle() method while we're stuck in a live resize event.
+ from pyglet import app
+ if app.event_loop is not None:
+ app.event_loop.idle()
+
+ event = send_super(self, 'nextEventMatchingMask:untilDate:inMode:dequeue:',
+ mask, date, mode, dequeue, argtypes=[NSUInteger, c_void_p, c_void_p, c_bool])
+
+ if event.value == None:
+ return 0
+ else:
+ return event.value
+
+ # Need this for set_size to not flash.
+ @PygletToolWindow.method(b'd'+NSRectEncoding)
+ def animationResizeTime_(self, newFrame):
+ return 0.0
+
+PygletWindow = ObjCClass('PygletWindow')
+PygletToolWindow = ObjCClass('PygletToolWindow')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/cocoa/systemcursor.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/cocoa/systemcursor.py
new file mode 100644
index 0000000..1bb52d7
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/cocoa/systemcursor.py
@@ -0,0 +1,19 @@
+from builtins import object
+from pyglet.libs.darwin.cocoapy import *
+
+# This class is a wrapper around NSCursor which prevents us from
+# sending too many hide or unhide messages in a row. Apparently
+# NSCursor treats them like retain/release messages, which can be
+# problematic when we are e.g. switching between window & fullscreen.
+class SystemCursor(object):
+ cursor_is_hidden = False
+ @classmethod
+ def hide(cls):
+ if not cls.cursor_is_hidden:
+ send_message('NSCursor', 'hide')
+ cls.cursor_is_hidden = True
+ @classmethod
+ def unhide(cls):
+ if cls.cursor_is_hidden:
+ send_message('NSCursor', 'unhide')
+ cls.cursor_is_hidden = False
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/event.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/event.py
new file mode 100644
index 0000000..6225d65
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/event.py
@@ -0,0 +1,179 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+"""Events for :py:mod:`pyglet.window`.
+
+See :py:class:`~pyglet.window.Window` for a description of the window event types.
+"""
+from __future__ import print_function
+from builtins import object
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import sys
+
+from pyglet.window import key
+from pyglet.window import mouse
+
+
+class WindowExitHandler(object):
+ """Determine if the window should be closed.
+
+ This event handler watches for the ESC key or the window close event
+ and sets `self.has_exit` to True when either is pressed. An instance
+ of this class is automatically attached to all new `pyglet.window.Window`
+ objects.
+
+ :deprecated: This class's functionality is provided directly on :py:class:`~pyglet.window.Window`
+ in pyglet 1.1.
+ """
+
+ has_exit = False
+ """True if the user wants to close the window."""
+
+ def on_close(self):
+ self.has_exit = True
+
+ def on_key_press(self, symbol, modifiers):
+ if symbol == key.ESCAPE:
+ self.has_exit = True
+
+
+class WindowEventLogger(object):
+ """Print all events to a file.
+
+ When this event handler is added to a window it prints out all events
+ and their parameters; useful for debugging or discovering which events
+ you need to handle.
+
+ Example::
+
+ win = window.Window()
+ win.push_handlers(WindowEventLogger())
+
+ """
+ def __init__(self, logfile=None):
+ """Create a `WindowEventLogger` which writes to `logfile`.
+
+ :Parameters:
+ `logfile` : file-like object
+ The file to write to. If unspecified, stdout will be used.
+
+ """
+ if logfile is None:
+ logfile = sys.stdout
+ self.file = logfile
+
+ def on_key_press(self, symbol, modifiers):
+ print('on_key_press(symbol=%s, modifiers=%s)' % (
+ key.symbol_string(symbol), key.modifiers_string(modifiers)), file=self.file)
+
+ def on_key_release(self, symbol, modifiers):
+ print('on_key_release(symbol=%s, modifiers=%s)' % (
+ key.symbol_string(symbol), key.modifiers_string(modifiers)), file=self.file)
+
+ def on_text(self, text):
+ print('on_text(text=%r)' % text, file=self.file)
+
+ def on_text_motion(self, motion):
+ print('on_text_motion(motion=%s)' % (
+ key.motion_string(motion)), file=self.file)
+
+ def on_text_motion_select(self, motion):
+ print('on_text_motion_select(motion=%s)' % (
+ key.motion_string(motion)), file=self.file)
+
+ def on_mouse_motion(self, x, y, dx, dy):
+ print('on_mouse_motion(x=%d, y=%d, dx=%d, dy=%d)' % (
+ x, y, dx, dy), file=self.file)
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ print('on_mouse_drag(x=%d, y=%d, dx=%d, dy=%d, '\
+ 'buttons=%s, modifiers=%s)' % (
+ x, y, dx, dy,
+ mouse.buttons_string(buttons), key.modifiers_string(modifiers)), file=self.file)
+
+ def on_mouse_press(self, x, y, button, modifiers):
+ print('on_mouse_press(x=%d, y=%d, button=%r, '\
+ 'modifiers=%s)' % (x, y,
+ mouse.buttons_string(button), key.modifiers_string(modifiers)), file=self.file)
+
+ def on_mouse_release(self, x, y, button, modifiers):
+ print('on_mouse_release(x=%d, y=%d, button=%r, '\
+ 'modifiers=%s)' % (x, y,
+ mouse.buttons_string(button), key.modifiers_string(modifiers)), file=self.file)
+
+ def on_mouse_scroll(self, x, y, dx, dy):
+ print('on_mouse_scroll(x=%f, y=%f, dx=%f, dy=%f)' % (
+ x, y, dx, dy), file=self.file)
+
+ def on_close(self):
+ print('on_close()', file=self.file)
+
+ def on_mouse_enter(self, x, y):
+ print('on_mouse_enter(x=%d, y=%d)' % (x, y), file=self.file)
+
+ def on_mouse_leave(self, x, y):
+ print('on_mouse_leave(x=%d, y=%d)' % (x, y), file=self.file)
+
+ def on_expose(self):
+ print('on_expose()', file=self.file)
+
+ def on_resize(self, width, height):
+ print('on_resize(width=%d, height=%d)' % (width, height), file=self.file)
+
+ def on_move(self, x, y):
+ print('on_move(x=%d, y=%d)' % (x, y), file=self.file)
+
+ def on_activate(self):
+ print('on_activate()', file=self.file)
+
+ def on_deactivate(self):
+ print('on_deactivate()', file=self.file)
+
+ def on_show(self):
+ print('on_show()', file=self.file)
+
+ def on_hide(self):
+ print('on_hide()', file=self.file)
+
+ def on_context_lost(self):
+ print('on_context_lost()', file=self.file)
+
+ def on_context_state_lost(self):
+ print('on_context_state_lost()', file=self.file)
+
+ def on_draw(self):
+ print('on_draw()', file=self.file)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/key.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/key.py
new file mode 100644
index 0000000..f3063df
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/key.py
@@ -0,0 +1,424 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+"""Key constants and utilities for pyglet.window.
+
+Usage::
+
+ from pyglet.window import Window
+ from pyglet.window import key
+
+ window = Window()
+
+ @window.event
+ def on_key_press(symbol, modifiers):
+ # Symbolic names:
+ if symbol == key.RETURN:
+
+ # Alphabet keys:
+ elif symbol == key.Z:
+
+ # Number keys:
+ elif symbol == key._1:
+
+ # Number keypad keys:
+ elif symbol == key.NUM_1:
+
+ # Modifiers:
+ if modifiers & key.MOD_CTRL:
+
+"""
+from builtins import str
+
+from pyglet import compat_platform
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+
+class KeyStateHandler(dict):
+ """Simple handler that tracks the state of keys on the keyboard. If a
+ key is pressed then this handler holds a True value for it.
+
+ For example::
+
+ >>> win = window.Window
+ >>> keyboard = key.KeyStateHandler()
+ >>> win.push_handlers(keyboard)
+
+ # Hold down the "up" arrow...
+
+ >>> keyboard[key.UP]
+ True
+ >>> keyboard[key.DOWN]
+ False
+
+ """
+ def on_key_press(self, symbol, modifiers):
+ self[symbol] = True
+
+ def on_key_release(self, symbol, modifiers):
+ self[symbol] = False
+
+ def __getitem__(self, key):
+ return self.get(key, False)
+
+
+def modifiers_string(modifiers):
+ """Return a string describing a set of modifiers.
+
+ Example::
+
+ >>> modifiers_string(MOD_SHIFT | MOD_CTRL)
+ 'MOD_SHIFT|MOD_CTRL'
+
+ :Parameters:
+ `modifiers` : int
+ Bitwise combination of modifier constants.
+
+ :rtype: str
+ """
+ mod_names = []
+ if modifiers & MOD_SHIFT:
+ mod_names.append('MOD_SHIFT')
+ if modifiers & MOD_CTRL:
+ mod_names.append('MOD_CTRL')
+ if modifiers & MOD_ALT:
+ mod_names.append('MOD_ALT')
+ if modifiers & MOD_CAPSLOCK:
+ mod_names.append('MOD_CAPSLOCK')
+ if modifiers & MOD_NUMLOCK:
+ mod_names.append('MOD_NUMLOCK')
+ if modifiers & MOD_SCROLLLOCK:
+ mod_names.append('MOD_SCROLLLOCK')
+ if modifiers & MOD_COMMAND:
+ mod_names.append('MOD_COMMAND')
+ if modifiers & MOD_OPTION:
+ mod_names.append('MOD_OPTION')
+ if modifiers & MOD_FUNCTION:
+ mod_names.append('MOD_FUNCTION')
+ return '|'.join(mod_names)
+
+
+def symbol_string(symbol):
+ """Return a string describing a key symbol.
+
+ Example::
+
+ >>> symbol_string(BACKSPACE)
+ 'BACKSPACE'
+
+ :Parameters:
+ `symbol` : int
+ Symbolic key constant.
+
+ :rtype: str
+ """
+ if symbol < 1 << 32:
+ return _key_names.get(symbol, str(symbol))
+ else:
+ return 'user_key(%x)' % (symbol >> 32)
+
+
+def motion_string(motion):
+ """Return a string describing a text motion.
+
+ Example::
+
+ >>> motion_string(MOTION_NEXT_WORD)
+ 'MOTION_NEXT_WORD'
+
+ :Parameters:
+ `motion` : int
+ Text motion constant.
+
+ :rtype: str
+ """
+ return _motion_names.get(motion, str(motion))
+
+
+def user_key(scancode):
+ """Return a key symbol for a key not supported by pyglet.
+
+ This can be used to map virtual keys or scancodes from unsupported
+ keyboard layouts into a machine-specific symbol. The symbol will
+ be meaningless on any other machine, or under a different keyboard layout.
+
+ Applications should use user-keys only when user explicitly binds them
+ (for example, mapping keys to actions in a game options screen).
+ """
+ assert scancode > 0
+ return scancode << 32
+
+# Modifier mask constants
+MOD_SHIFT = 1 << 0
+MOD_CTRL = 1 << 1
+MOD_ALT = 1 << 2
+MOD_CAPSLOCK = 1 << 3
+MOD_NUMLOCK = 1 << 4
+MOD_WINDOWS = 1 << 5
+MOD_COMMAND = 1 << 6
+MOD_OPTION = 1 << 7
+MOD_SCROLLLOCK = 1 << 8
+MOD_FUNCTION = 1 << 9
+
+#: Accelerator modifier. On Windows and Linux, this is ``MOD_CTRL``, on
+#: Mac OS X it's ``MOD_COMMAND``.
+MOD_ACCEL = MOD_CTRL
+if compat_platform == 'darwin':
+ MOD_ACCEL = MOD_COMMAND
+
+
+# Key symbol constants
+
+# ASCII commands
+BACKSPACE = 0xff08
+TAB = 0xff09
+LINEFEED = 0xff0a
+CLEAR = 0xff0b
+RETURN = 0xff0d
+ENTER = 0xff0d # synonym
+PAUSE = 0xff13
+SCROLLLOCK = 0xff14
+SYSREQ = 0xff15
+ESCAPE = 0xff1b
+SPACE = 0xff20
+
+# Cursor control and motion
+HOME = 0xff50
+LEFT = 0xff51
+UP = 0xff52
+RIGHT = 0xff53
+DOWN = 0xff54
+PAGEUP = 0xff55
+PAGEDOWN = 0xff56
+END = 0xff57
+BEGIN = 0xff58
+
+# Misc functions
+DELETE = 0xffff
+SELECT = 0xff60
+PRINT = 0xff61
+EXECUTE = 0xff62
+INSERT = 0xff63
+UNDO = 0xff65
+REDO = 0xff66
+MENU = 0xff67
+FIND = 0xff68
+CANCEL = 0xff69
+HELP = 0xff6a
+BREAK = 0xff6b
+MODESWITCH = 0xff7e
+SCRIPTSWITCH = 0xff7e
+FUNCTION = 0xffd2
+
+# Text motion constants: these are allowed to clash with key constants
+MOTION_UP = UP
+MOTION_RIGHT = RIGHT
+MOTION_DOWN = DOWN
+MOTION_LEFT = LEFT
+MOTION_NEXT_WORD = 1
+MOTION_PREVIOUS_WORD = 2
+MOTION_BEGINNING_OF_LINE = 3
+MOTION_END_OF_LINE = 4
+MOTION_NEXT_PAGE = PAGEDOWN
+MOTION_PREVIOUS_PAGE = PAGEUP
+MOTION_BEGINNING_OF_FILE = 5
+MOTION_END_OF_FILE = 6
+MOTION_BACKSPACE = BACKSPACE
+MOTION_DELETE = DELETE
+
+# Number pad
+NUMLOCK = 0xff7f
+NUM_SPACE = 0xff80
+NUM_TAB = 0xff89
+NUM_ENTER = 0xff8d
+NUM_F1 = 0xff91
+NUM_F2 = 0xff92
+NUM_F3 = 0xff93
+NUM_F4 = 0xff94
+NUM_HOME = 0xff95
+NUM_LEFT = 0xff96
+NUM_UP = 0xff97
+NUM_RIGHT = 0xff98
+NUM_DOWN = 0xff99
+NUM_PRIOR = 0xff9a
+NUM_PAGE_UP = 0xff9a
+NUM_NEXT = 0xff9b
+NUM_PAGE_DOWN = 0xff9b
+NUM_END = 0xff9c
+NUM_BEGIN = 0xff9d
+NUM_INSERT = 0xff9e
+NUM_DELETE = 0xff9f
+NUM_EQUAL = 0xffbd
+NUM_MULTIPLY = 0xffaa
+NUM_ADD = 0xffab
+NUM_SEPARATOR = 0xffac
+NUM_SUBTRACT = 0xffad
+NUM_DECIMAL = 0xffae
+NUM_DIVIDE = 0xffaf
+
+NUM_0 = 0xffb0
+NUM_1 = 0xffb1
+NUM_2 = 0xffb2
+NUM_3 = 0xffb3
+NUM_4 = 0xffb4
+NUM_5 = 0xffb5
+NUM_6 = 0xffb6
+NUM_7 = 0xffb7
+NUM_8 = 0xffb8
+NUM_9 = 0xffb9
+
+# Function keys
+F1 = 0xffbe
+F2 = 0xffbf
+F3 = 0xffc0
+F4 = 0xffc1
+F5 = 0xffc2
+F6 = 0xffc3
+F7 = 0xffc4
+F8 = 0xffc5
+F9 = 0xffc6
+F10 = 0xffc7
+F11 = 0xffc8
+F12 = 0xffc9
+F13 = 0xffca
+F14 = 0xffcb
+F15 = 0xffcc
+F16 = 0xffcd
+F17 = 0xffce
+F18 = 0xffcf
+F19 = 0xffd0
+F20 = 0xffd1
+
+# Modifiers
+LSHIFT = 0xffe1
+RSHIFT = 0xffe2
+LCTRL = 0xffe3
+RCTRL = 0xffe4
+CAPSLOCK = 0xffe5
+LMETA = 0xffe7
+RMETA = 0xffe8
+LALT = 0xffe9
+RALT = 0xffea
+LWINDOWS = 0xffeb
+RWINDOWS = 0xffec
+LCOMMAND = 0xffed
+RCOMMAND = 0xffee
+LOPTION = 0xffef
+ROPTION = 0xfff0
+
+# Latin-1
+SPACE = 0x020
+EXCLAMATION = 0x021
+DOUBLEQUOTE = 0x022
+HASH = 0x023
+POUND = 0x023 # synonym
+DOLLAR = 0x024
+PERCENT = 0x025
+AMPERSAND = 0x026
+APOSTROPHE = 0x027
+PARENLEFT = 0x028
+PARENRIGHT = 0x029
+ASTERISK = 0x02a
+PLUS = 0x02b
+COMMA = 0x02c
+MINUS = 0x02d
+PERIOD = 0x02e
+SLASH = 0x02f
+_0 = 0x030
+_1 = 0x031
+_2 = 0x032
+_3 = 0x033
+_4 = 0x034
+_5 = 0x035
+_6 = 0x036
+_7 = 0x037
+_8 = 0x038
+_9 = 0x039
+COLON = 0x03a
+SEMICOLON = 0x03b
+LESS = 0x03c
+EQUAL = 0x03d
+GREATER = 0x03e
+QUESTION = 0x03f
+AT = 0x040
+BRACKETLEFT = 0x05b
+BACKSLASH = 0x05c
+BRACKETRIGHT = 0x05d
+ASCIICIRCUM = 0x05e
+UNDERSCORE = 0x05f
+GRAVE = 0x060
+QUOTELEFT = 0x060
+A = 0x061
+B = 0x062
+C = 0x063
+D = 0x064
+E = 0x065
+F = 0x066
+G = 0x067
+H = 0x068
+I = 0x069
+J = 0x06a
+K = 0x06b
+L = 0x06c
+M = 0x06d
+N = 0x06e
+O = 0x06f
+P = 0x070
+Q = 0x071
+R = 0x072
+S = 0x073
+T = 0x074
+U = 0x075
+V = 0x076
+W = 0x077
+X = 0x078
+Y = 0x079
+Z = 0x07a
+BRACELEFT = 0x07b
+BAR = 0x07c
+BRACERIGHT = 0x07d
+ASCIITILDE = 0x07e
+
+_key_names = {}
+_motion_names = {}
+for _name, _value in locals().copy().items():
+ if _name[:2] != '__' and _name.upper() == _name and \
+ not _name.startswith('MOD_'):
+ if _name.startswith('MOTION_'):
+ _motion_names[_value] = _name
+ else:
+ _key_names[_value] = _name
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/mouse.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/mouse.py
new file mode 100644
index 0000000..7f8097c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/mouse.py
@@ -0,0 +1,67 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+"""Mouse constants and utilities for pyglet.window.
+"""
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+
+def buttons_string(buttons):
+ """Return a string describing a set of active mouse buttons.
+
+ Example::
+
+ >>> buttons_string(LEFT | RIGHT)
+ 'LEFT|RIGHT'
+
+ :Parameters:
+ `buttons` : int
+ Bitwise combination of mouse button constants.
+
+ :rtype: str
+ """
+ button_names = []
+ if buttons & LEFT:
+ button_names.append('LEFT')
+ if buttons & MIDDLE:
+ button_names.append('MIDDLE')
+ if buttons & RIGHT:
+ button_names.append('RIGHT')
+ return '|'.join(button_names)
+
+# Symbolic names for the mouse buttons
+LEFT = 1 << 0
+MIDDLE = 1 << 1
+RIGHT = 1 << 2
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/win32/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/win32/__init__.py
new file mode 100644
index 0000000..b8e3a80
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/win32/__init__.py
@@ -0,0 +1,980 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+'''
+'''
+from __future__ import division
+from builtins import chr
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id: $'
+
+from ctypes import *
+import unicodedata
+import warnings
+
+from pyglet import compat_platform
+if compat_platform not in ('cygwin', 'win32'):
+ raise ImportError('Not a win32 platform.')
+
+import pyglet
+from pyglet.window import BaseWindow, \
+ WindowException, MouseCursor, DefaultMouseCursor, _PlatformEventHandler, \
+ _ViewEventHandler
+from pyglet.event import EventDispatcher
+from pyglet.window import key
+from pyglet.window import mouse
+
+from pyglet.canvas.win32 import Win32Canvas
+
+from pyglet.libs.win32 import _user32, _kernel32, _gdi32
+from pyglet.libs.win32.constants import *
+from pyglet.libs.win32.winkey import *
+from pyglet.libs.win32.types import *
+
+# symbol,ctrl -> motion mapping
+_motion_map = {
+ (key.UP, False): key.MOTION_UP,
+ (key.RIGHT, False): key.MOTION_RIGHT,
+ (key.DOWN, False): key.MOTION_DOWN,
+ (key.LEFT, False): key.MOTION_LEFT,
+ (key.RIGHT, True): key.MOTION_NEXT_WORD,
+ (key.LEFT, True): key.MOTION_PREVIOUS_WORD,
+ (key.HOME, False): key.MOTION_BEGINNING_OF_LINE,
+ (key.END, False): key.MOTION_END_OF_LINE,
+ (key.PAGEUP, False): key.MOTION_PREVIOUS_PAGE,
+ (key.PAGEDOWN, False): key.MOTION_NEXT_PAGE,
+ (key.HOME, True): key.MOTION_BEGINNING_OF_FILE,
+ (key.END, True): key.MOTION_END_OF_FILE,
+ (key.BACKSPACE, False): key.MOTION_BACKSPACE,
+ (key.DELETE, False): key.MOTION_DELETE,
+}
+
+class Win32MouseCursor(MouseCursor):
+ drawable = False
+ def __init__(self, cursor):
+ self.cursor = cursor
+
+# This is global state, we have to be careful not to set the same state twice,
+# which will throw off the ShowCursor counter.
+_win32_cursor_visible = True
+
+Win32EventHandler = _PlatformEventHandler
+ViewEventHandler = _ViewEventHandler
+
+class Win32Window(BaseWindow):
+ _window_class = None
+ _hwnd = None
+ _dc = None
+ _wgl_context = None
+ _tracking = False
+ _hidden = False
+ _has_focus = False
+
+ _exclusive_keyboard = False
+ _exclusive_keyboard_focus = True
+ _exclusive_mouse = False
+ _exclusive_mouse_focus = True
+ _exclusive_mouse_screen = None
+ _exclusive_mouse_client = None
+ _mouse_platform_visible = True
+
+ _ws_style = 0
+ _ex_ws_style = 0
+ _minimum_size = None
+ _maximum_size = None
+
+ def __init__(self, *args, **kwargs):
+ # Bind event handlers
+ self._event_handlers = {}
+ self._view_event_handlers = {}
+ for func_name in self._platform_event_names:
+ if not hasattr(self, func_name):
+ continue
+ func = getattr(self, func_name)
+ for message in func._platform_event_data:
+ if hasattr(func, '_view'):
+ self._view_event_handlers[message] = func
+ else:
+ self._event_handlers[message] = func
+
+
+ super(Win32Window, self).__init__(*args, **kwargs)
+
+ def _recreate(self, changes):
+ if 'context' in changes:
+ self._wgl_context = None
+
+ self._create()
+
+ def _create(self):
+ # Ensure style is set before determining width/height.
+ if self._fullscreen:
+ self._ws_style = WS_POPUP
+ self._ex_ws_style = 0 # WS_EX_TOPMOST
+ else:
+ styles = {
+ self.WINDOW_STYLE_DEFAULT: (WS_OVERLAPPEDWINDOW, 0),
+ self.WINDOW_STYLE_DIALOG: (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU,
+ WS_EX_DLGMODALFRAME),
+ self.WINDOW_STYLE_TOOL: (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU,
+ WS_EX_TOOLWINDOW),
+ self.WINDOW_STYLE_BORDERLESS: (WS_POPUP, 0),
+ }
+ self._ws_style, self._ex_ws_style = styles[self._style]
+
+ if self._resizable and not self._fullscreen:
+ self._ws_style |= WS_THICKFRAME
+ else:
+ self._ws_style &= ~(WS_THICKFRAME|WS_MAXIMIZEBOX)
+
+
+ if self._fullscreen:
+ width = self.screen.width
+ height = self.screen.height
+ else:
+ width, height = \
+ self._client_to_window_size(self._width, self._height)
+
+ if not self._window_class:
+ module = _kernel32.GetModuleHandleW(None)
+ white = _gdi32.GetStockObject(WHITE_BRUSH)
+ black = _gdi32.GetStockObject(BLACK_BRUSH)
+ self._window_class = WNDCLASS()
+ self._window_class.lpszClassName = u'GenericAppClass%d' % id(self)
+ self._window_class.lpfnWndProc = WNDPROC(
+ self._get_window_proc(self._event_handlers))
+ self._window_class.style = CS_VREDRAW | CS_HREDRAW
+ self._window_class.hInstance = 0
+ self._window_class.hIcon = _user32.LoadIconW(module, MAKEINTRESOURCE(1))
+ self._window_class.hbrBackground = black
+ self._window_class.lpszMenuName = None
+ self._window_class.cbClsExtra = 0
+ self._window_class.cbWndExtra = 0
+ _user32.RegisterClassW(byref(self._window_class))
+
+ self._view_window_class = WNDCLASS()
+ self._view_window_class.lpszClassName = \
+ u'GenericViewClass%d' % id(self)
+ self._view_window_class.lpfnWndProc = WNDPROC(
+ self._get_window_proc(self._view_event_handlers))
+ self._view_window_class.style = 0
+ self._view_window_class.hInstance = 0
+ self._view_window_class.hIcon = 0
+ self._view_window_class.hbrBackground = white
+ self._view_window_class.lpszMenuName = None
+ self._view_window_class.cbClsExtra = 0
+ self._view_window_class.cbWndExtra = 0
+ _user32.RegisterClassW(byref(self._view_window_class))
+
+ if not self._hwnd:
+ self._hwnd = _user32.CreateWindowExW(
+ self._ex_ws_style,
+ self._window_class.lpszClassName,
+ u'',
+ self._ws_style,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ width,
+ height,
+ 0,
+ 0,
+ self._window_class.hInstance,
+ 0)
+
+ self._view_hwnd = _user32.CreateWindowExW(
+ 0,
+ self._view_window_class.lpszClassName,
+ u'',
+ WS_CHILD | WS_VISIBLE,
+ 0, 0, 0, 0,
+ self._hwnd,
+ 0,
+ self._view_window_class.hInstance,
+ 0)
+
+
+ self._dc = _user32.GetDC(self._view_hwnd)
+ else:
+ # Window already exists, update it with new style
+
+ # We need to hide window here, otherwise Windows forgets
+ # to redraw the whole screen after leaving fullscreen.
+ _user32.ShowWindow(self._hwnd, SW_HIDE)
+
+ _user32.SetWindowLongW(self._hwnd,
+ GWL_STYLE,
+ self._ws_style)
+ _user32.SetWindowLongW(self._hwnd,
+ GWL_EXSTYLE,
+ self._ex_ws_style)
+
+ if self._fullscreen:
+ hwnd_after = HWND_TOPMOST
+ else:
+ hwnd_after = HWND_NOTOPMOST
+
+ # Position and size window
+ if self._fullscreen:
+ _user32.SetWindowPos(self._hwnd, hwnd_after,
+ self._screen.x, self._screen.y, width, height, SWP_FRAMECHANGED)
+ elif False: # TODO location not in pyglet API
+ x, y = self._client_to_window_pos(*factory.get_location())
+ _user32.SetWindowPos(self._hwnd, hwnd_after,
+ x, y, width, height, SWP_FRAMECHANGED)
+ else:
+ _user32.SetWindowPos(self._hwnd, hwnd_after,
+ 0, 0, width, height, SWP_NOMOVE | SWP_FRAMECHANGED)
+
+ self._update_view_location(self._width, self._height)
+
+ # Context must be created after window is created.
+ if not self._wgl_context:
+ self.canvas = Win32Canvas(self.display, self._view_hwnd, self._dc)
+ self.context.attach(self.canvas)
+ self._wgl_context = self.context._context
+
+ self.set_caption(self._caption)
+
+ self.switch_to()
+ self.set_vsync(self._vsync)
+
+ if self._visible:
+ self.set_visible()
+ # Might need resize event if going from fullscreen to fullscreen
+ self.dispatch_event('on_resize', self._width, self._height)
+ self.dispatch_event('on_expose')
+
+ def _update_view_location(self, width, height):
+ if self._fullscreen:
+ x = (self.screen.width - width) // 2
+ y = (self.screen.height - height) // 2
+ else:
+ x = y = 0
+ _user32.SetWindowPos(self._view_hwnd, 0,
+ x, y, width, height, SWP_NOZORDER | SWP_NOOWNERZORDER)
+
+ def close(self):
+ if not self._hwnd:
+ super(Win32Window, self).close()
+ return
+
+ _user32.DestroyWindow(self._hwnd)
+ _user32.UnregisterClassW(self._window_class.lpszClassName, 0)
+
+ self._window_class = None
+ self._view_window_class = None
+ self._view_event_handlers.clear()
+ self._event_handlers.clear()
+ self.set_mouse_platform_visible(True)
+ self._hwnd = None
+ self._dc = None
+ self._wgl_context = None
+ super(Win32Window, self).close()
+
+ def _get_vsync(self):
+ return self.context.get_vsync()
+ vsync = property(_get_vsync) # overrides BaseWindow property
+
+ def set_vsync(self, vsync):
+ if pyglet.options['vsync'] is not None:
+ vsync = pyglet.options['vsync']
+ self.context.set_vsync(vsync)
+
+ def switch_to(self):
+ self.context.set_current()
+
+ def flip(self):
+ self.draw_mouse_cursor()
+ self.context.flip()
+
+ def set_location(self, x, y):
+ x, y = self._client_to_window_pos(x, y)
+ _user32.SetWindowPos(self._hwnd, 0, x, y, 0, 0,
+ (SWP_NOZORDER |
+ SWP_NOSIZE |
+ SWP_NOOWNERZORDER))
+
+ def get_location(self):
+ rect = RECT()
+ _user32.GetClientRect(self._hwnd, byref(rect))
+ point = POINT()
+ point.x = rect.left
+ point.y = rect.top
+ _user32.ClientToScreen(self._hwnd, byref(point))
+ return point.x, point.y
+
+ def set_size(self, width, height):
+ if self._fullscreen:
+ raise WindowException('Cannot set size of fullscreen window.')
+ width, height = self._client_to_window_size(width, height)
+ _user32.SetWindowPos(self._hwnd, 0, 0, 0, width, height,
+ (SWP_NOZORDER |
+ SWP_NOMOVE |
+ SWP_NOOWNERZORDER))
+
+ def get_size(self):
+ #rect = RECT()
+ #_user32.GetClientRect(self._hwnd, byref(rect))
+ #return rect.right - rect.left, rect.bottom - rect.top
+ return self._width, self._height
+
+ def set_minimum_size(self, width, height):
+ self._minimum_size = width, height
+
+ def set_maximum_size(self, width, height):
+ self._maximum_size = width, height
+
+ def activate(self):
+ _user32.SetForegroundWindow(self._hwnd)
+
+ def set_visible(self, visible=True):
+ if visible:
+ insertAfter = HWND_TOPMOST if self._fullscreen else HWND_TOP
+ _user32.SetWindowPos(self._hwnd, insertAfter, 0, 0, 0, 0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW)
+ self.dispatch_event('on_resize', self._width, self._height)
+ self.activate()
+ self.dispatch_event('on_show')
+ else:
+ _user32.ShowWindow(self._hwnd, SW_HIDE)
+ self.dispatch_event('on_hide')
+ self._visible = visible
+ self.set_mouse_platform_visible()
+
+ def minimize(self):
+ _user32.ShowWindow(self._hwnd, SW_MINIMIZE)
+
+ def maximize(self):
+ _user32.ShowWindow(self._hwnd, SW_MAXIMIZE)
+
+ def set_caption(self, caption):
+ self._caption = caption
+ _user32.SetWindowTextW(self._hwnd, c_wchar_p(caption))
+
+ def set_mouse_platform_visible(self, platform_visible=None):
+ if platform_visible is None:
+ platform_visible = (self._mouse_visible and
+ not self._exclusive_mouse and
+ not self._mouse_cursor.drawable) or \
+ (not self._mouse_in_window or
+ not self._has_focus)
+
+ if platform_visible and not self._mouse_cursor.drawable:
+ if isinstance(self._mouse_cursor, Win32MouseCursor):
+ cursor = self._mouse_cursor.cursor
+ else:
+ cursor = _user32.LoadCursorW(None, MAKEINTRESOURCE(IDC_ARROW))
+ _user32.SetClassLongW(self._view_hwnd, GCL_HCURSOR, cursor)
+ _user32.SetCursor(cursor)
+
+ if platform_visible == self._mouse_platform_visible:
+ return
+
+ # Avoid calling ShowCursor with the current visibility (which would
+ # push the counter too far away from zero).
+ global _win32_cursor_visible
+ if _win32_cursor_visible != platform_visible:
+ _user32.ShowCursor(platform_visible)
+ _win32_cursor_visible = platform_visible
+
+ self._mouse_platform_visible = platform_visible
+
+ def _reset_exclusive_mouse_screen(self):
+ '''Recalculate screen coords of mouse warp point for exclusive
+ mouse.'''
+ p = POINT()
+ rect = RECT()
+ _user32.GetClientRect(self._view_hwnd, byref(rect))
+ _user32.MapWindowPoints(self._view_hwnd, HWND_DESKTOP, byref(rect), 2)
+ p.x = (rect.left + rect.right) // 2
+ p.y = (rect.top + rect.bottom) // 2
+
+ # This is the point the mouse will be kept at while in exclusive
+ # mode.
+ self._exclusive_mouse_screen = p.x, p.y
+ self._exclusive_mouse_client = p.x - rect.left, p.y - rect.top
+
+ def set_exclusive_mouse(self, exclusive=True):
+ if self._exclusive_mouse == exclusive and \
+ self._exclusive_mouse_focus == self._has_focus:
+ return
+
+ if exclusive and self._has_focus:
+ # Move mouse to the center of the window.
+ self._reset_exclusive_mouse_screen()
+ x, y = self._exclusive_mouse_screen
+ self.set_mouse_position(x, y, absolute=True)
+
+ # Clip to client area, to prevent large mouse movements taking
+ # it outside the client area.
+ rect = RECT()
+ _user32.GetClientRect(self._view_hwnd, byref(rect))
+ _user32.MapWindowPoints(self._view_hwnd, HWND_DESKTOP,
+ byref(rect), 2)
+ _user32.ClipCursor(byref(rect))
+ else:
+ # Release clip
+ _user32.ClipCursor(None)
+
+ self._exclusive_mouse = exclusive
+ self._exclusive_mouse_focus = self._has_focus
+ self.set_mouse_platform_visible()
+
+ def set_mouse_position(self, x, y, absolute=False):
+ if not absolute:
+ rect = RECT()
+ _user32.GetClientRect(self._view_hwnd, byref(rect))
+ _user32.MapWindowPoints(self._view_hwnd, HWND_DESKTOP, byref(rect), 2)
+
+ x = x + rect.left
+ y = rect.top + (rect.bottom - rect.top) - y
+
+ _user32.SetCursorPos(x, y)
+
+ def set_exclusive_keyboard(self, exclusive=True):
+ if self._exclusive_keyboard == exclusive and \
+ self._exclusive_keyboard_focus == self._has_focus:
+ return
+
+ if exclusive and self._has_focus:
+ _user32.RegisterHotKey(self._hwnd, 0, WIN32_MOD_ALT, VK_TAB)
+ else:
+ _user32.UnregisterHotKey(self._hwnd, 0)
+
+ self._exclusive_keyboard = exclusive
+ self._exclusive_keyboard_focus = self._has_focus
+
+ def get_system_mouse_cursor(self, name):
+ if name == self.CURSOR_DEFAULT:
+ return DefaultMouseCursor()
+
+ names = {
+ self.CURSOR_CROSSHAIR: IDC_CROSS,
+ self.CURSOR_HAND: IDC_HAND,
+ self.CURSOR_HELP: IDC_HELP,
+ self.CURSOR_NO: IDC_NO,
+ self.CURSOR_SIZE: IDC_SIZEALL,
+ self.CURSOR_SIZE_UP: IDC_SIZENS,
+ self.CURSOR_SIZE_UP_RIGHT: IDC_SIZENESW,
+ self.CURSOR_SIZE_RIGHT: IDC_SIZEWE,
+ self.CURSOR_SIZE_DOWN_RIGHT: IDC_SIZENWSE,
+ self.CURSOR_SIZE_DOWN: IDC_SIZENS,
+ self.CURSOR_SIZE_DOWN_LEFT: IDC_SIZENESW,
+ self.CURSOR_SIZE_LEFT: IDC_SIZEWE,
+ self.CURSOR_SIZE_UP_LEFT: IDC_SIZENWSE,
+ self.CURSOR_SIZE_UP_DOWN: IDC_SIZENS,
+ self.CURSOR_SIZE_LEFT_RIGHT: IDC_SIZEWE,
+ self.CURSOR_TEXT: IDC_IBEAM,
+ self.CURSOR_WAIT: IDC_WAIT,
+ self.CURSOR_WAIT_ARROW: IDC_APPSTARTING,
+ }
+ if name not in names:
+ raise RuntimeError('Unknown cursor name "%s"' % name)
+ cursor = _user32.LoadCursorW(None, MAKEINTRESOURCE(names[name]))
+ return Win32MouseCursor(cursor)
+
+ def set_icon(self, *images):
+ # XXX Undocumented AFAICT, but XP seems happy to resize an image
+ # of any size, so no scaling necessary.
+
+ def best_image(width, height):
+ # A heuristic for finding closest sized image to required size.
+ image = images[0]
+ for img in images:
+ if img.width == width and img.height == height:
+ # Exact match always used
+ return img
+ elif img.width >= width and \
+ img.width * img.height > image.width * image.height:
+ # At least wide enough, and largest area
+ image = img
+ return image
+
+ def get_icon(image):
+ # Alpha-blended icon: see http://support.microsoft.com/kb/318876
+ format = 'BGRA'
+ pitch = len(format) * image.width
+
+ header = BITMAPV5HEADER()
+ header.bV5Size = sizeof(header)
+ header.bV5Width = image.width
+ header.bV5Height = image.height
+ header.bV5Planes = 1
+ header.bV5BitCount = 32
+ header.bV5Compression = BI_BITFIELDS
+ header.bV5RedMask = 0x00ff0000
+ header.bV5GreenMask = 0x0000ff00
+ header.bV5BlueMask = 0x000000ff
+ header.bV5AlphaMask = 0xff000000
+
+ hdc = _user32.GetDC(None)
+ dataptr = c_void_p()
+ bitmap = _gdi32.CreateDIBSection(hdc, byref(header), DIB_RGB_COLORS,
+ byref(dataptr), None, 0)
+ _user32.ReleaseDC(None, hdc)
+
+ image = image.get_image_data()
+ data = image.get_data(format, pitch)
+ memmove(dataptr, data, len(data))
+
+ mask = _gdi32.CreateBitmap(image.width, image.height, 1, 1, None)
+
+ iconinfo = ICONINFO()
+ iconinfo.fIcon = True
+ iconinfo.hbmMask = mask
+ iconinfo.hbmColor = bitmap
+ icon = _user32.CreateIconIndirect(byref(iconinfo))
+
+ _gdi32.DeleteObject(mask)
+ _gdi32.DeleteObject(bitmap)
+
+ return icon
+
+ # Set large icon
+ image = best_image(_user32.GetSystemMetrics(SM_CXICON),
+ _user32.GetSystemMetrics(SM_CYICON))
+ icon = get_icon(image)
+ _user32.SetClassLongPtrW(self._hwnd, GCL_HICON, icon)
+
+ # Set small icon
+ image = best_image(_user32.GetSystemMetrics(SM_CXSMICON),
+ _user32.GetSystemMetrics(SM_CYSMICON))
+ icon = get_icon(image)
+ _user32.SetClassLongPtrW(self._hwnd, GCL_HICONSM, icon)
+
+ # Private util
+
+ def _client_to_window_size(self, width, height):
+ rect = RECT()
+ rect.left = 0
+ rect.top = 0
+ rect.right = width
+ rect.bottom = height
+ _user32.AdjustWindowRectEx(byref(rect),
+ self._ws_style, False, self._ex_ws_style)
+ return rect.right - rect.left, rect.bottom - rect.top
+
+ def _client_to_window_pos(self, x, y):
+ rect = RECT()
+ rect.left = x
+ rect.top = y
+ _user32.AdjustWindowRectEx(byref(rect),
+ self._ws_style, False, self._ex_ws_style)
+ return rect.left, rect.top
+
+ # Event dispatching
+
+ def dispatch_events(self):
+ from pyglet import app
+ app.platform_event_loop.start()
+ self._allow_dispatch_event = True
+ self.dispatch_pending_events()
+
+ msg = MSG()
+ while _user32.PeekMessageW(byref(msg), 0, 0, 0, PM_REMOVE):
+ _user32.TranslateMessage(byref(msg))
+ _user32.DispatchMessageW(byref(msg))
+ self._allow_dispatch_event = False
+
+ def dispatch_pending_events(self):
+ while self._event_queue:
+ event = self._event_queue.pop(0)
+ if type(event[0]) is str:
+ # pyglet event
+ EventDispatcher.dispatch_event(self, *event)
+ else:
+ # win32 event
+ event[0](*event[1:])
+
+ def _get_window_proc(self, event_handlers):
+ def f(hwnd, msg, wParam, lParam):
+ event_handler = event_handlers.get(msg, None)
+ result = None
+ if event_handler:
+ if self._allow_dispatch_event or not self._enable_event_queue:
+ result = event_handler(msg, wParam, lParam)
+ else:
+ result = 0
+ self._event_queue.append((event_handler, msg,
+ wParam, lParam))
+ if result is None:
+ result = _user32.DefWindowProcW(hwnd, msg, wParam, lParam)
+ return result
+
+ return f
+
+ # Event handlers
+
+ def _get_modifiers(self, key_lParam=0):
+ modifiers = 0
+ if _user32.GetKeyState(VK_SHIFT) & 0xff00:
+ modifiers |= key.MOD_SHIFT
+ if _user32.GetKeyState(VK_CONTROL) & 0xff00:
+ modifiers |= key.MOD_CTRL
+ if _user32.GetKeyState(VK_LWIN) & 0xff00:
+ modifiers |= key.MOD_WINDOWS
+ if _user32.GetKeyState(VK_CAPITAL) & 0x00ff: # toggle
+ modifiers |= key.MOD_CAPSLOCK
+ if _user32.GetKeyState(VK_NUMLOCK) & 0x00ff: # toggle
+ modifiers |= key.MOD_NUMLOCK
+ if _user32.GetKeyState(VK_SCROLL) & 0x00ff: # toggle
+ modifiers |= key.MOD_SCROLLLOCK
+ if key_lParam:
+ if key_lParam & (1 << 29):
+ modifiers |= key.MOD_ALT
+ elif _user32.GetKeyState(VK_MENU) < 0:
+ modifiers |= key.MOD_ALT
+ return modifiers
+
+ @staticmethod
+ def _get_location(lParam):
+ x = c_int16(lParam & 0xffff).value
+ y = c_int16(lParam >> 16).value
+ return x, y
+
+ @Win32EventHandler(WM_KEYDOWN)
+ @Win32EventHandler(WM_KEYUP)
+ @Win32EventHandler(WM_SYSKEYDOWN)
+ @Win32EventHandler(WM_SYSKEYUP)
+ def _event_key(self, msg, wParam, lParam):
+ repeat = False
+ if lParam & (1 << 30):
+ if msg not in (WM_KEYUP, WM_SYSKEYUP):
+ repeat = True
+ ev = 'on_key_release'
+ else:
+ ev = 'on_key_press'
+
+ symbol = keymap.get(wParam, None)
+ if symbol is None:
+ ch = _user32.MapVirtualKeyW(wParam, MAPVK_VK_TO_CHAR)
+ symbol = chmap.get(ch)
+
+ if symbol is None:
+ symbol = key.user_key(wParam)
+ elif symbol == key.LCTRL and lParam & (1 << 24):
+ symbol = key.RCTRL
+ elif symbol == key.LALT and lParam & (1 << 24):
+ symbol = key.RALT
+ elif symbol == key.LSHIFT:
+ pass # TODO: some magic with getstate to find out if it's the
+ # right or left shift key.
+
+ modifiers = self._get_modifiers(lParam)
+
+ if not repeat:
+ self.dispatch_event(ev, symbol, modifiers)
+
+ ctrl = modifiers & key.MOD_CTRL != 0
+ if (symbol, ctrl) in _motion_map and msg not in (WM_KEYUP, WM_SYSKEYUP):
+ motion = _motion_map[symbol, ctrl]
+ if modifiers & key.MOD_SHIFT:
+ self.dispatch_event('on_text_motion_select', motion)
+ else:
+ self.dispatch_event('on_text_motion', motion)
+
+ # Send on to DefWindowProc if not exclusive.
+ if self._exclusive_keyboard:
+ return 0
+ else:
+ return None
+
+ @Win32EventHandler(WM_CHAR)
+ def _event_char(self, msg, wParam, lParam):
+ text = chr(wParam)
+ if unicodedata.category(text) != 'Cc' or text == '\r':
+ self.dispatch_event('on_text', text)
+ return 0
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_MOUSEMOVE)
+ def _event_mousemove(self, msg, wParam, lParam):
+ x, y = self._get_location(lParam)
+
+ if (x, y) == self._exclusive_mouse_client:
+ # Ignore the event caused by SetCursorPos
+ self._mouse_x = x
+ self._mouse_y = y
+ return 0
+
+ y = self._height - y
+
+ if self._exclusive_mouse and self._has_focus:
+ # Reset mouse position (so we don't hit the edge of the screen).
+ _x, _y = self._exclusive_mouse_screen
+ self.set_mouse_position(_x, _y, absolute=True)
+
+ dx = x - self._mouse_x
+ dy = y - self._mouse_y
+
+ if not self._tracking:
+ # There is no WM_MOUSEENTER message (!), so fake it from the
+ # first WM_MOUSEMOVE event after leaving. Use self._tracking
+ # to determine when to recreate the tracking structure after
+ # re-entering (to track the next WM_MOUSELEAVE).
+ self._mouse_in_window = True
+ self.set_mouse_platform_visible()
+ self.dispatch_event('on_mouse_enter', x, y)
+ self._tracking = True
+ track = TRACKMOUSEEVENT()
+ track.cbSize = sizeof(track)
+ track.dwFlags = TME_LEAVE
+ track.hwndTrack = self._view_hwnd
+ _user32.TrackMouseEvent(byref(track))
+
+ # Don't generate motion/drag events when mouse hasn't moved. (Issue
+ # 305)
+ if self._mouse_x == x and self._mouse_y == y:
+ return 0
+
+ self._mouse_x = x
+ self._mouse_y = y
+
+ buttons = 0
+ if wParam & MK_LBUTTON:
+ buttons |= mouse.LEFT
+ if wParam & MK_MBUTTON:
+ buttons |= mouse.MIDDLE
+ if wParam & MK_RBUTTON:
+ buttons |= mouse.RIGHT
+
+ if buttons:
+ # Drag event
+ modifiers = self._get_modifiers()
+ self.dispatch_event('on_mouse_drag',
+ x, y, dx, dy, buttons, modifiers)
+ else:
+ # Motion event
+ self.dispatch_event('on_mouse_motion', x, y, dx, dy)
+ return 0
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_MOUSELEAVE)
+ def _event_mouseleave(self, msg, wParam, lParam):
+ point = POINT()
+ _user32.GetCursorPos(byref(point))
+ _user32.ScreenToClient(self._view_hwnd, byref(point))
+ x = point.x
+ y = self._height - point.y
+ self._tracking = False
+ self._mouse_in_window = False
+ self.set_mouse_platform_visible()
+ self.dispatch_event('on_mouse_leave', x, y)
+ return 0
+
+ def _event_mousebutton(self, ev, button, lParam):
+ if ev == 'on_mouse_press':
+ _user32.SetCapture(self._view_hwnd)
+ else:
+ _user32.ReleaseCapture()
+ x, y = self._get_location(lParam)
+ y = self._height - y
+ self.dispatch_event(ev, x, y, button, self._get_modifiers())
+ return 0
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_LBUTTONDOWN)
+ def _event_lbuttondown(self, msg, wParam, lParam):
+ return self._event_mousebutton(
+ 'on_mouse_press', mouse.LEFT, lParam)
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_LBUTTONUP)
+ def _event_lbuttonup(self, msg, wParam, lParam):
+ return self._event_mousebutton(
+ 'on_mouse_release', mouse.LEFT, lParam)
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_MBUTTONDOWN)
+ def _event_mbuttondown(self, msg, wParam, lParam):
+ return self._event_mousebutton(
+ 'on_mouse_press', mouse.MIDDLE, lParam)
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_MBUTTONUP)
+ def _event_mbuttonup(self, msg, wParam, lParam):
+ return self._event_mousebutton(
+ 'on_mouse_release', mouse.MIDDLE, lParam)
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_RBUTTONDOWN)
+ def _event_rbuttondown(self, msg, wParam, lParam):
+ return self._event_mousebutton(
+ 'on_mouse_press', mouse.RIGHT, lParam)
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_RBUTTONUP)
+ def _event_rbuttonup(self, msg, wParam, lParam):
+ return self._event_mousebutton(
+ 'on_mouse_release', mouse.RIGHT, lParam)
+
+ @Win32EventHandler(WM_MOUSEWHEEL)
+ def _event_mousewheel(self, msg, wParam, lParam):
+ delta = c_short(wParam >> 16).value
+ self.dispatch_event('on_mouse_scroll',
+ self._mouse_x, self._mouse_y, 0, delta / float(WHEEL_DELTA))
+ return 0
+
+ @Win32EventHandler(WM_CLOSE)
+ def _event_close(self, msg, wParam, lParam):
+ self.dispatch_event('on_close')
+ return 0
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_PAINT)
+ def _event_paint(self, msg, wParam, lParam):
+ self.dispatch_event('on_expose')
+
+ # Validating the window using ValidateRect or ValidateRgn
+ # doesn't clear the paint message when more than one window
+ # is open [why?]; defer to DefWindowProc instead.
+ return None
+
+ @Win32EventHandler(WM_SIZING)
+ def _event_sizing(self, msg, wParam, lParam):
+ # rect = cast(lParam, POINTER(RECT)).contents
+ # width, height = self.get_size()
+
+ from pyglet import app
+ if app.event_loop is not None:
+ app.event_loop.enter_blocking()
+ return 1
+
+ @Win32EventHandler(WM_SIZE)
+ def _event_size(self, msg, wParam, lParam):
+ if not self._dc:
+ # Ignore window creation size event (appears for fullscreen
+ # only) -- we haven't got DC or HWND yet.
+ return None
+
+ if wParam == SIZE_MINIMIZED:
+ # Minimized, not resized.
+ self._hidden = True
+ self.dispatch_event('on_hide')
+ return 0
+ if self._hidden:
+ # Restored
+ self._hidden = False
+ self.dispatch_event('on_show')
+ w, h = self._get_location(lParam)
+ if not self._fullscreen:
+ self._width, self._height = w, h
+ self._update_view_location(self._width, self._height)
+ self._reset_exclusive_mouse_screen()
+ self.switch_to()
+ self.dispatch_event('on_resize', self._width, self._height)
+ return 0
+
+ @Win32EventHandler(WM_SYSCOMMAND)
+ def _event_syscommand(self, msg, wParam, lParam):
+ # check for ALT key to prevent app from hanging because there is
+ # no windows menu bar
+ if wParam == SC_KEYMENU and lParam & (1 >> 16) <= 0:
+ return 0
+
+ if wParam & 0xfff0 in (SC_MOVE, SC_SIZE):
+ # Should be in WM_ENTERSIZEMOVE, but we never get that message.
+ from pyglet import app
+
+ if app.event_loop is not None:
+ app.event_loop.enter_blocking()
+
+ @Win32EventHandler(WM_MOVE)
+ def _event_move(self, msg, wParam, lParam):
+ x, y = self._get_location(lParam)
+ self._reset_exclusive_mouse_screen()
+ self.dispatch_event('on_move', x, y)
+ return 0
+
+ @Win32EventHandler(WM_EXITSIZEMOVE)
+ def _event_entersizemove(self, msg, wParam, lParam):
+ from pyglet import app
+ if app.event_loop is not None:
+ app.event_loop.exit_blocking()
+
+ '''
+ # Alternative to using WM_SETFOCUS and WM_KILLFOCUS. Which
+ # is better?
+
+ @Win32EventHandler(WM_ACTIVATE)
+ def _event_activate(self, msg, wParam, lParam):
+ if wParam & 0xffff == WA_INACTIVE:
+ self.dispatch_event('on_deactivate')
+ else:
+ self.dispatch_event('on_activate')
+ _user32.SetFocus(self._hwnd)
+ return 0
+ '''
+
+ @Win32EventHandler(WM_SETFOCUS)
+ def _event_setfocus(self, msg, wParam, lParam):
+ self.dispatch_event('on_activate')
+ self._has_focus = True
+ self.set_exclusive_keyboard(self._exclusive_keyboard)
+ self.set_exclusive_mouse(self._exclusive_mouse)
+ return 0
+
+ @Win32EventHandler(WM_KILLFOCUS)
+ def _event_killfocus(self, msg, wParam, lParam):
+ self.dispatch_event('on_deactivate')
+ self._has_focus = False
+ self.set_exclusive_keyboard(self._exclusive_keyboard)
+ self.set_exclusive_mouse(self._exclusive_mouse)
+ return 0
+
+ @Win32EventHandler(WM_GETMINMAXINFO)
+ def _event_getminmaxinfo(self, msg, wParam, lParam):
+ info = MINMAXINFO.from_address(lParam)
+ if self._minimum_size:
+ info.ptMinTrackSize.x, info.ptMinTrackSize.y = \
+ self._client_to_window_size(*self._minimum_size)
+ if self._maximum_size:
+ info.ptMaxTrackSize.x, info.ptMaxTrackSize.y = \
+ self._client_to_window_size(*self._maximum_size)
+ return 0
+
+ @Win32EventHandler(WM_ERASEBKGND)
+ def _event_erasebkgnd(self, msg, wParam, lParam):
+ # Prevent flicker during resize; but erase bkgnd if we're fullscreen.
+ if self._fullscreen:
+ return 0
+ else:
+ return 1
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_ERASEBKGND)
+ def _event_erasebkgnd_view(self, msg, wParam, lParam):
+ # Prevent flicker during resize.
+ return 1
diff --git a/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/xlib/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/xlib/__init__.py
new file mode 100644
index 0000000..abdb1b3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/pyglet/window/xlib/__init__.py
@@ -0,0 +1,1323 @@
+# ----------------------------------------------------------------------------
+# pyglet
+# Copyright (c) 2006-2008 Alex Holkner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of pyglet nor the names of its
+# contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# ----------------------------------------------------------------------------
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+from builtins import chr
+from past.builtins import basestring
+
+from ctypes import *
+import unicodedata
+import warnings
+
+import pyglet
+from pyglet.window import WindowException, NoSuchDisplayException, \
+ MouseCursorException, MouseCursor, \
+ DefaultMouseCursor, ImageMouseCursor, BaseWindow, _PlatformEventHandler, \
+ _ViewEventHandler
+from pyglet.window import key
+from pyglet.window import mouse
+from pyglet.event import EventDispatcher
+
+from pyglet.canvas.xlib import XlibCanvas
+
+from pyglet.libs.x11 import xlib
+from pyglet.libs.x11 import cursorfont
+
+from pyglet.compat import asbytes
+
+try:
+ from pyglet.libs.x11 import xsync
+ _have_xsync = True
+except:
+ _have_xsync = False
+
+class mwmhints_t(Structure):
+ _fields_ = [
+ ('flags', c_uint32),
+ ('functions', c_uint32),
+ ('decorations', c_uint32),
+ ('input_mode', c_int32),
+ ('status', c_uint32)
+ ]
+
+# XXX: wraptypes can't parse the header this function is in yet
+XkbSetDetectableAutoRepeat = xlib._lib.XkbSetDetectableAutoRepeat
+XkbSetDetectableAutoRepeat.restype = c_int
+XkbSetDetectableAutoRepeat.argtypes = [POINTER(xlib.Display), c_int, POINTER(c_int)]
+_can_detect_autorepeat = None
+
+XA_CARDINAL = 6 # Xatom.h:14
+
+# Do we have the November 2000 UTF8 extension?
+_have_utf8 = hasattr(xlib._lib, 'Xutf8TextListToTextProperty')
+
+# symbol,ctrl -> motion mapping
+_motion_map = {
+ (key.UP, False): key.MOTION_UP,
+ (key.RIGHT, False): key.MOTION_RIGHT,
+ (key.DOWN, False): key.MOTION_DOWN,
+ (key.LEFT, False): key.MOTION_LEFT,
+ (key.RIGHT, True): key.MOTION_NEXT_WORD,
+ (key.LEFT, True): key.MOTION_PREVIOUS_WORD,
+ (key.HOME, False): key.MOTION_BEGINNING_OF_LINE,
+ (key.END, False): key.MOTION_END_OF_LINE,
+ (key.PAGEUP, False): key.MOTION_PREVIOUS_PAGE,
+ (key.PAGEDOWN, False): key.MOTION_NEXT_PAGE,
+ (key.HOME, True): key.MOTION_BEGINNING_OF_FILE,
+ (key.END, True): key.MOTION_END_OF_FILE,
+ (key.BACKSPACE, False): key.MOTION_BACKSPACE,
+ (key.DELETE, False): key.MOTION_DELETE,
+}
+
+class XlibException(WindowException):
+ '''An X11-specific exception. This exception is probably a programming
+ error in pyglet.'''
+ pass
+
+class XlibMouseCursor(MouseCursor):
+ drawable = False
+
+ def __init__(self, cursor):
+ self.cursor = cursor
+
+# Platform event data is single item, so use platform event handler directly.
+XlibEventHandler = _PlatformEventHandler
+ViewEventHandler = _ViewEventHandler
+
+class XlibWindow(BaseWindow):
+ _x_display = None # X display connection
+ _x_screen_id = None # X screen index
+ _x_ic = None # X input context
+ _window = None # Xlib window handle
+ _minimum_size = None
+ _maximum_size = None
+ _override_redirect = False
+
+ _x = 0
+ _y = 0 # Last known window position
+ _width = 0
+ _height = 0 # Last known window size
+ _mouse_exclusive_client = None # x,y of "real" mouse during exclusive
+ _mouse_buttons = [False] * 6 # State of each xlib button
+ _keyboard_exclusive = False
+ _active = True
+ _applied_mouse_exclusive = False
+ _applied_keyboard_exclusive = False
+ _mapped = False
+ _lost_context = False
+ _lost_context_state = False
+
+ _enable_xsync = False
+ _current_sync_value = None
+ _current_sync_valid = False
+
+ _default_event_mask = (0x1ffffff
+ & ~xlib.PointerMotionHintMask
+ & ~xlib.ResizeRedirectMask
+ & ~xlib.SubstructureNotifyMask)
+
+ def __init__(self, *args, **kwargs):
+ # Bind event handlers
+ self._event_handlers = {}
+ self._view_event_handlers = {}
+ for name in self._platform_event_names:
+ if not hasattr(self, name):
+ continue
+ func = getattr(self, name)
+ for message in func._platform_event_data:
+ if hasattr(func, '_view'):
+ self._view_event_handlers[message] = func
+ else:
+ self._event_handlers[message] = func
+
+ super(XlibWindow, self).__init__(*args, **kwargs)
+
+ global _can_detect_autorepeat
+ if _can_detect_autorepeat == None:
+ supported_rtrn = c_int()
+ _can_detect_autorepeat = XkbSetDetectableAutoRepeat(self.display._display, c_int(1), byref(supported_rtrn))
+ if _can_detect_autorepeat:
+ self.pressed_keys = set()
+
+ def _recreate(self, changes):
+ # If flipping to/from fullscreen, need to recreate the window. (This
+ # is the case with both override_redirect method and
+ # _NET_WM_STATE_FULLSCREEN).
+ #
+ # A possible improvement could be to just hide the top window,
+ # destroy the GLX window, and reshow it again when leaving fullscreen.
+ # This would prevent the floating window from being moved by the
+ # WM.
+ if ('fullscreen' in changes or 'resizable' in changes):
+ # clear out the GLX context
+ self.context.detach()
+ xlib.XDestroyWindow(self._x_display, self._window)
+ del self.display._window_map[self._window]
+ del self.display._window_map[self._view]
+ self._window = None
+ self._mapped = False
+
+ # TODO: detect state loss only by examining context share.
+ if 'context' in changes:
+ self._lost_context = True
+ self._lost_context_state = True
+
+ self._create()
+
+ def _create(self):
+ # Unmap existing window if necessary while we fiddle with it.
+ if self._window and self._mapped:
+ self._unmap()
+
+ self._x_display = self.display._display
+ self._x_screen_id = self.display.x_screen
+
+
+ # Create X window if not already existing.
+ if not self._window:
+ root = xlib.XRootWindow(self._x_display, self._x_screen_id)
+
+ visual_info = self.config.get_visual_info()
+
+ visual = visual_info.visual
+ visual_id = xlib.XVisualIDFromVisual(visual)
+ default_visual = xlib.XDefaultVisual(
+ self._x_display, self._x_screen_id)
+ default_visual_id = xlib.XVisualIDFromVisual(default_visual)
+ window_attributes = xlib.XSetWindowAttributes()
+ if visual_id != default_visual_id:
+ window_attributes.colormap = xlib.XCreateColormap(
+ self._x_display, root, visual, xlib.AllocNone)
+ else:
+ window_attributes.colormap = xlib.XDefaultColormap(
+ self._x_display, self._x_screen_id)
+ window_attributes.bit_gravity = xlib.StaticGravity
+
+ # Issue 287: Compiz on Intel/Mesa doesn't draw window decoration
+ # unless CWBackPixel is given in mask. Should have
+ # no effect on other systems, so it's set
+ # unconditionally.
+ mask = xlib.CWColormap | xlib.CWBitGravity | xlib.CWBackPixel
+
+ if self._fullscreen:
+ width, height = self.screen.width, self.screen.height
+ self._view_x = (width - self._width) // 2
+ self._view_y = (height - self._height) // 2
+ else:
+ width, height = self._width, self._height
+ self._view_x = self._view_y = 0
+
+ self._window = xlib.XCreateWindow(self._x_display, root,
+ 0, 0, width, height, 0, visual_info.depth,
+ xlib.InputOutput, visual, mask,
+ byref(window_attributes))
+ self._view = xlib.XCreateWindow(self._x_display,
+ self._window, self._view_x, self._view_y,
+ self._width, self._height, 0, visual_info.depth,
+ xlib.InputOutput, visual, mask,
+ byref(window_attributes));
+ xlib.XMapWindow(self._x_display, self._view)
+ xlib.XSelectInput(
+ self._x_display, self._view, self._default_event_mask)
+
+ self.display._window_map[self._window] = \
+ self.dispatch_platform_event
+ self.display._window_map[self._view] = \
+ self.dispatch_platform_event_view
+
+ self.canvas = XlibCanvas(self.display, self._view)
+
+ self.context.attach(self.canvas)
+ self.context.set_vsync(self._vsync) # XXX ?
+
+ # Setting null background pixmap disables drawing the background,
+ # preventing flicker while resizing (in theory).
+ #
+ # Issue 287: Compiz on Intel/Mesa doesn't draw window decoration if
+ # this is called. As it doesn't seem to have any
+ # effect anyway, it's just commented out.
+ #xlib.XSetWindowBackgroundPixmap(self._x_display, self._window, 0)
+
+ self._enable_xsync = (pyglet.options['xsync'] and
+ self.display._enable_xsync and
+ self.config.double_buffer)
+
+ # Set supported protocols
+ protocols = []
+ protocols.append(xlib.XInternAtom(self._x_display,
+ asbytes('WM_DELETE_WINDOW'), False))
+ if self._enable_xsync:
+ protocols.append(xlib.XInternAtom(self._x_display,
+ asbytes('_NET_WM_SYNC_REQUEST'),
+ False))
+ protocols = (c_ulong * len(protocols))(*protocols)
+ xlib.XSetWMProtocols(self._x_display, self._window,
+ protocols, len(protocols))
+
+ # Create window resize sync counter
+ if self._enable_xsync:
+ value = xsync.XSyncValue()
+ self._sync_counter = xlib.XID(
+ xsync.XSyncCreateCounter(self._x_display, value))
+ atom = xlib.XInternAtom(self._x_display,
+ asbytes('_NET_WM_SYNC_REQUEST_COUNTER'), False)
+ ptr = pointer(self._sync_counter)
+
+ xlib.XChangeProperty(self._x_display, self._window,
+ atom, XA_CARDINAL, 32,
+ xlib.PropModeReplace,
+ cast(ptr, POINTER(c_ubyte)), 1)
+ # Set window attributes
+ attributes = xlib.XSetWindowAttributes()
+ attributes_mask = 0
+
+ self._override_redirect = False
+ if self._fullscreen:
+ if pyglet.options['xlib_fullscreen_override_redirect']:
+ # Try not to use this any more, it causes problems; disabled
+ # by default in favour of _NET_WM_STATE_FULLSCREEN.
+ attributes.override_redirect = self._fullscreen
+ attributes_mask |= xlib.CWOverrideRedirect
+ self._override_redirect = True
+ else:
+ self._set_wm_state('_NET_WM_STATE_FULLSCREEN')
+
+ if self._fullscreen:
+ xlib.XMoveResizeWindow(self._x_display, self._window,
+ self.screen.x, self.screen.y,
+ self.screen.width, self.screen.height)
+ else:
+ xlib.XResizeWindow(self._x_display, self._window,
+ self._width, self._height)
+
+ xlib.XChangeWindowAttributes(self._x_display, self._window,
+ attributes_mask, byref(attributes))
+
+ # Set style
+ styles = {
+ self.WINDOW_STYLE_DEFAULT: '_NET_WM_WINDOW_TYPE_NORMAL',
+ self.WINDOW_STYLE_DIALOG: '_NET_WM_WINDOW_TYPE_DIALOG',
+ self.WINDOW_STYLE_TOOL: '_NET_WM_WINDOW_TYPE_UTILITY',
+ }
+ if self._style in styles:
+ self._set_atoms_property('_NET_WM_WINDOW_TYPE',
+ (styles[self._style],))
+ elif self._style == self.WINDOW_STYLE_BORDERLESS:
+ MWM_HINTS_DECORATIONS = 1 << 1
+ PROP_MWM_HINTS_ELEMENTS = 5
+ mwmhints = mwmhints_t()
+ mwmhints.flags = MWM_HINTS_DECORATIONS
+ mwmhints.decorations = 0
+ name = xlib.XInternAtom(self._x_display, asbytes('_MOTIF_WM_HINTS'), False)
+ xlib.XChangeProperty(self._x_display, self._window,
+ name, name, 32, xlib.PropModeReplace,
+ cast(pointer(mwmhints), POINTER(c_ubyte)),
+ PROP_MWM_HINTS_ELEMENTS)
+
+ # Set resizeable
+ if not self._resizable and not self._fullscreen:
+ self.set_minimum_size(self._width, self._height)
+ self.set_maximum_size(self._width, self._height)
+
+ # Set caption
+ self.set_caption(self._caption)
+
+ # Set WM_CLASS for modern desktop environments
+ self.set_wm_class(self._caption)
+
+ # this is supported by some compositors (ie gnome-shell), and more to come
+ # see: http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idp6357888
+ _NET_WM_BYPASS_COMPOSITOR_HINT_ON = c_ulong(int(self._fullscreen))
+ name = xlib.XInternAtom(self._x_display,
+ asbytes('_NET_WM_BYPASS_COMPOSITOR'), False)
+ ptr = pointer(_NET_WM_BYPASS_COMPOSITOR_HINT_ON)
+
+ xlib.XChangeProperty(self._x_display, self._window,
+ name, XA_CARDINAL, 32,
+ xlib.PropModeReplace,
+ cast(ptr, POINTER(c_ubyte)), 1)
+
+ # Create input context. A good but very outdated reference for this
+ # is http://www.sbin.org/doc/Xlib/chapt_11.html
+ if _have_utf8 and not self._x_ic:
+ if not self.display._x_im:
+ xlib.XSetLocaleModifiers(asbytes('@im=none'))
+ self.display._x_im = \
+ xlib.XOpenIM(self._x_display, None, None, None)
+
+ xlib.XFlush(self._x_display);
+
+ # Need to set argtypes on this function because it's vararg,
+ # and ctypes guesses wrong.
+ xlib.XCreateIC.argtypes = [xlib.XIM,
+ c_char_p, c_int,
+ c_char_p, xlib.Window,
+ c_char_p, xlib.Window,
+ c_void_p]
+ self._x_ic = xlib.XCreateIC(self.display._x_im,
+ asbytes('inputStyle'), xlib.XIMPreeditNothing|xlib.XIMStatusNothing,
+ asbytes('clientWindow'), self._window,
+ asbytes('focusWindow'), self._window,
+ None)
+
+ filter_events = c_ulong()
+ xlib.XGetICValues(self._x_ic,
+ 'filterEvents', byref(filter_events),
+ None)
+ self._default_event_mask |= filter_events.value
+ xlib.XSetICFocus(self._x_ic)
+
+ self.switch_to()
+ if self._visible:
+ self.set_visible(True)
+
+ self.set_mouse_platform_visible()
+ self._applied_mouse_exclusive = None
+ self._update_exclusivity()
+
+ def _map(self):
+ if self._mapped:
+ return
+
+ # Map the window, wait for map event before continuing.
+ xlib.XSelectInput(
+ self._x_display, self._window, xlib.StructureNotifyMask)
+ xlib.XMapRaised(self._x_display, self._window)
+ e = xlib.XEvent()
+ while True:
+ xlib.XNextEvent(self._x_display, e)
+ if e.type == xlib.ConfigureNotify:
+ self._width = e.xconfigure.width
+ self._height = e.xconfigure.height
+ elif e.type == xlib.MapNotify:
+ break
+ xlib.XSelectInput(
+ self._x_display, self._window, self._default_event_mask)
+ self._mapped = True
+
+ if self._override_redirect:
+ # Possibly an override_redirect issue.
+ self.activate()
+
+ self._update_view_size()
+
+ self.dispatch_event('on_resize', self._width, self._height)
+ self.dispatch_event('on_show')
+ self.dispatch_event('on_expose')
+
+ def _unmap(self):
+ if not self._mapped:
+ return
+
+ xlib.XSelectInput(
+ self._x_display, self._window, xlib.StructureNotifyMask)
+ xlib.XUnmapWindow(self._x_display, self._window)
+ e = xlib.XEvent()
+ while True:
+ xlib.XNextEvent(self._x_display, e)
+ if e.type == xlib.UnmapNotify:
+ break
+
+ xlib.XSelectInput(
+ self._x_display, self._window, self._default_event_mask)
+ self._mapped = False
+
+ def _get_root(self):
+ attributes = xlib.XWindowAttributes()
+ xlib.XGetWindowAttributes(self._x_display, self._window,
+ byref(attributes))
+ return attributes.root
+
+ def _is_reparented(self):
+ root = c_ulong()
+ parent = c_ulong()
+ children = pointer(c_ulong())
+ n_children = c_uint()
+
+ xlib.XQueryTree(self._x_display, self._window,
+ byref(root), byref(parent), byref(children),
+ byref(n_children))
+
+ return root.value != parent.value
+
+ def close(self):
+ if not self._window:
+ return
+
+ self.context.destroy()
+ self._unmap()
+ if self._window:
+ xlib.XDestroyWindow(self._x_display, self._window)
+
+ del self.display._window_map[self._window]
+ self._window = None
+
+ self._view_event_handlers.clear()
+ self._event_handlers.clear()
+
+ if _have_utf8:
+ xlib.XDestroyIC(self._x_ic)
+ self._x_ic = None
+
+ super(XlibWindow, self).close()
+
+ def switch_to(self):
+ if self.context:
+ self.context.set_current()
+
+ def flip(self):
+ self.draw_mouse_cursor()
+
+ # TODO canvas.flip?
+ if self.context:
+ self.context.flip()
+
+ self._sync_resize()
+
+ def set_vsync(self, vsync):
+ if pyglet.options['vsync'] is not None:
+ vsync = pyglet.options['vsync']
+ self._vsync = vsync
+ self.context.set_vsync(vsync)
+
+ def set_caption(self, caption):
+ if caption is None:
+ caption = ''
+ self._caption = caption
+ self._set_text_property('WM_NAME', caption, allow_utf8=False)
+ self._set_text_property('WM_ICON_NAME', caption, allow_utf8=False)
+ self._set_text_property('_NET_WM_NAME', caption)
+ self._set_text_property('_NET_WM_ICON_NAME', caption)
+
+ def set_wm_class(self, name):
+ # WM_CLASS can only contain Ascii characters
+ try:
+ name = name.encode('ascii')
+ except UnicodeEncodeError:
+ name = "pyglet"
+
+ hints = xlib.XAllocClassHint()
+ hints.contents.res_class = asbytes(name)
+ hints.contents.res_name = asbytes(name.lower())
+ xlib.XSetClassHint(self._x_display, self._window, hints.contents)
+ xlib.XFree(hints)
+
+ def get_caption(self):
+ return self._caption
+
+ def set_size(self, width, height):
+ if self._fullscreen:
+ raise WindowException('Cannot set size of fullscreen window.')
+ self._width = width
+ self._height = height
+ if not self._resizable:
+ self.set_minimum_size(width, height)
+ self.set_maximum_size(width, height)
+ xlib.XResizeWindow(self._x_display, self._window, width, height)
+ self._update_view_size()
+ self.dispatch_event('on_resize', width, height)
+
+ def _update_view_size(self):
+ xlib.XResizeWindow(self._x_display, self._view,
+ self._width, self._height)
+
+ def get_size(self):
+ # XGetGeometry and XWindowAttributes seem to always return the
+ # original size of the window, which is wrong after the user
+ # has resized it.
+ # XXX this is probably fixed now, with fix of resize.
+ return self._width, self._height
+
+ def set_location(self, x, y):
+ if self._is_reparented():
+ # Assume the window manager has reparented our top-level window
+ # only once, in which case attributes.x/y give the offset from
+ # the frame to the content window. Better solution would be
+ # to use _NET_FRAME_EXTENTS, where supported.
+ attributes = xlib.XWindowAttributes()
+ xlib.XGetWindowAttributes(self._x_display, self._window,
+ byref(attributes))
+ # XXX at least under KDE's WM these attrs are both 0
+ x -= attributes.x
+ y -= attributes.y
+ xlib.XMoveWindow(self._x_display, self._window, x, y)
+
+ def get_location(self):
+ child = xlib.Window()
+ x = c_int()
+ y = c_int()
+ xlib.XTranslateCoordinates(self._x_display,
+ self._window,
+ self._get_root(),
+ 0, 0,
+ byref(x),
+ byref(y),
+ byref(child))
+ return x.value, y.value
+
+ def activate(self):
+ xlib.XSetInputFocus(self._x_display, self._window,
+ xlib.RevertToParent, xlib.CurrentTime)
+
+ def set_visible(self, visible=True):
+ if visible:
+ self._map()
+ else:
+ self._unmap()
+ self._visible = visible
+
+ def set_minimum_size(self, width, height):
+ self._minimum_size = width, height
+ self._set_wm_normal_hints()
+
+ def set_maximum_size(self, width, height):
+ self._maximum_size = width, height
+ self._set_wm_normal_hints()
+
+ def minimize(self):
+ xlib.XIconifyWindow(self._x_display, self._window, self._x_screen_id)
+
+ def maximize(self):
+ self._set_wm_state('_NET_WM_STATE_MAXIMIZED_HORZ',
+ '_NET_WM_STATE_MAXIMIZED_VERT')
+
+ def set_mouse_platform_visible(self, platform_visible=None):
+ if not self._window:
+ return
+ if platform_visible is None:
+ platform_visible = self._mouse_visible and \
+ not self._mouse_cursor.drawable
+
+ if not platform_visible:
+ # Hide pointer by creating an empty cursor
+ black = xlib.XBlackPixel(self._x_display, self._x_screen_id)
+ black = xlib.XColor()
+ bmp = xlib.XCreateBitmapFromData(self._x_display, self._window,
+ c_buffer(8), 8, 8)
+ cursor = xlib.XCreatePixmapCursor(self._x_display, bmp, bmp,
+ black, black, 0, 0)
+ xlib.XDefineCursor(self._x_display, self._window, cursor)
+ xlib.XFreeCursor(self._x_display, cursor)
+ xlib.XFreePixmap(self._x_display, bmp)
+ else:
+ # Restore cursor
+ if isinstance(self._mouse_cursor, XlibMouseCursor):
+ xlib.XDefineCursor(self._x_display, self._window,
+ self._mouse_cursor.cursor)
+ else:
+ xlib.XUndefineCursor(self._x_display, self._window)
+
+ def set_mouse_position(self, x, y):
+ xlib.XWarpPointer(self._x_display,
+ 0, # src window
+ self._window, # dst window
+ 0, 0, # src x, y
+ 0, 0, # src w, h
+ x, self._height - y,
+ )
+
+ def _update_exclusivity(self):
+ mouse_exclusive = self._active and self._mouse_exclusive
+ keyboard_exclusive = self._active and self._keyboard_exclusive
+
+ if mouse_exclusive != self._applied_mouse_exclusive:
+ if mouse_exclusive:
+ self.set_mouse_platform_visible(False)
+
+ # Restrict to client area
+ xlib.XGrabPointer(self._x_display, self._window,
+ True,
+ 0,
+ xlib.GrabModeAsync,
+ xlib.GrabModeAsync,
+ self._window,
+ 0,
+ xlib.CurrentTime)
+
+ # Move pointer to center of window
+ x = self._width // 2
+ y = self._height // 2
+ self._mouse_exclusive_client = x, y
+ self.set_mouse_position(x, y)
+ elif self._fullscreen and not self.screen._xinerama:
+ # Restrict to fullscreen area (prevent viewport scrolling)
+ self.set_mouse_position(0, 0)
+ r = xlib.XGrabPointer(self._x_display, self._view,
+ True, 0,
+ xlib.GrabModeAsync,
+ xlib.GrabModeAsync,
+ self._view,
+ 0,
+ xlib.CurrentTime)
+ if r:
+ # Failed to grab, try again later
+ self._applied_mouse_exclusive = None
+ return
+ self.set_mouse_platform_visible()
+ else:
+ # Unclip
+ xlib.XUngrabPointer(self._x_display, xlib.CurrentTime)
+ self.set_mouse_platform_visible()
+
+ self._applied_mouse_exclusive = mouse_exclusive
+
+ if keyboard_exclusive != self._applied_keyboard_exclusive:
+ if keyboard_exclusive:
+ xlib.XGrabKeyboard(self._x_display,
+ self._window,
+ False,
+ xlib.GrabModeAsync,
+ xlib.GrabModeAsync,
+ xlib.CurrentTime)
+ else:
+ xlib.XUngrabKeyboard(self._x_display, xlib.CurrentTime)
+ self._applied_keyboard_exclusive = keyboard_exclusive
+
+ def set_exclusive_mouse(self, exclusive=True):
+ if exclusive == self._mouse_exclusive:
+ return
+
+ self._mouse_exclusive = exclusive
+ self._update_exclusivity()
+
+ def set_exclusive_keyboard(self, exclusive=True):
+ if exclusive == self._keyboard_exclusive:
+ return
+
+ self._keyboard_exclusive = exclusive
+ self._update_exclusivity()
+
+ def get_system_mouse_cursor(self, name):
+ if name == self.CURSOR_DEFAULT:
+ return DefaultMouseCursor()
+
+ # NQR means default shape is not pretty... surely there is another
+ # cursor font?
+ cursor_shapes = {
+ self.CURSOR_CROSSHAIR: cursorfont.XC_crosshair,
+ self.CURSOR_HAND: cursorfont.XC_hand2,
+ self.CURSOR_HELP: cursorfont.XC_question_arrow, # NQR
+ self.CURSOR_NO: cursorfont.XC_pirate, # NQR
+ self.CURSOR_SIZE: cursorfont.XC_fleur,
+ self.CURSOR_SIZE_UP: cursorfont.XC_top_side,
+ self.CURSOR_SIZE_UP_RIGHT: cursorfont.XC_top_right_corner,
+ self.CURSOR_SIZE_RIGHT: cursorfont.XC_right_side,
+ self.CURSOR_SIZE_DOWN_RIGHT: cursorfont.XC_bottom_right_corner,
+ self.CURSOR_SIZE_DOWN: cursorfont.XC_bottom_side,
+ self.CURSOR_SIZE_DOWN_LEFT: cursorfont.XC_bottom_left_corner,
+ self.CURSOR_SIZE_LEFT: cursorfont.XC_left_side,
+ self.CURSOR_SIZE_UP_LEFT: cursorfont.XC_top_left_corner,
+ self.CURSOR_SIZE_UP_DOWN: cursorfont.XC_sb_v_double_arrow,
+ self.CURSOR_SIZE_LEFT_RIGHT: cursorfont.XC_sb_h_double_arrow,
+ self.CURSOR_TEXT: cursorfont.XC_xterm,
+ self.CURSOR_WAIT: cursorfont.XC_watch,
+ self.CURSOR_WAIT_ARROW: cursorfont.XC_watch, # NQR
+ }
+ if name not in cursor_shapes:
+ raise MouseCursorException('Unknown cursor name "%s"' % name)
+ cursor = xlib.XCreateFontCursor(self._x_display, cursor_shapes[name])
+ return XlibMouseCursor(cursor)
+
+ def set_icon(self, *images):
+ # Careful! XChangeProperty takes an array of long when data type
+ # is 32-bit (but long can be 64 bit!), so pad high bytes of format if
+ # necessary.
+
+ import sys
+ format = {
+ ('little', 4): 'BGRA',
+ ('little', 8): 'BGRAAAAA',
+ ('big', 4): 'ARGB',
+ ('big', 8): 'AAAAARGB'
+ }[(sys.byteorder, sizeof(c_ulong))]
+
+ data = asbytes('')
+ for image in images:
+ image = image.get_image_data()
+ pitch = -(image.width * len(format))
+ s = c_buffer(sizeof(c_ulong) * 2)
+ memmove(s, cast((c_ulong * 2)(image.width, image.height),
+ POINTER(c_ubyte)), len(s))
+ data += s.raw + image.get_data(format, pitch)
+ buffer = (c_ubyte * len(data))()
+ memmove(buffer, data, len(data))
+ atom = xlib.XInternAtom(self._x_display, asbytes('_NET_WM_ICON'), False)
+ xlib.XChangeProperty(self._x_display, self._window, atom, XA_CARDINAL,
+ 32, xlib.PropModeReplace, buffer, len(data)//sizeof(c_ulong))
+
+ # Private utility
+
+ def _set_wm_normal_hints(self):
+ hints = xlib.XAllocSizeHints().contents
+ if self._minimum_size:
+ hints.flags |= xlib.PMinSize
+ hints.min_width, hints.min_height = self._minimum_size
+ if self._maximum_size:
+ hints.flags |= xlib.PMaxSize
+ hints.max_width, hints.max_height = self._maximum_size
+ xlib.XSetWMNormalHints(self._x_display, self._window, byref(hints))
+
+ def _set_text_property(self, name, value, allow_utf8=True):
+ atom = xlib.XInternAtom(self._x_display, asbytes(name), False)
+ if not atom:
+ raise XlibException('Undefined atom "%s"' % name)
+ assert isinstance(value, basestring)
+ property = xlib.XTextProperty()
+ if _have_utf8 and allow_utf8:
+ buf = create_string_buffer(value.encode('utf8'))
+ result = xlib.Xutf8TextListToTextProperty(self._x_display,
+ cast(pointer(buf), c_char_p), 1, xlib.XUTF8StringStyle,
+ byref(property))
+ if result < 0:
+ raise XlibException('Could not create UTF8 text property')
+ else:
+ buf = create_string_buffer(value.encode('ascii', 'ignore'))
+ result = xlib.XStringListToTextProperty(
+ cast(pointer(buf), c_char_p), 1, byref(property))
+ if result < 0:
+ raise XlibException('Could not create text property')
+ xlib.XSetTextProperty(self._x_display,
+ self._window, byref(property), atom)
+ # XXX Xlib doesn't like us freeing this
+ #xlib.XFree(property.value)
+
+ def _set_atoms_property(self, name, values, mode=xlib.PropModeReplace):
+ name_atom = xlib.XInternAtom(self._x_display, asbytes(name), False)
+ atoms = []
+ for value in values:
+ atoms.append(xlib.XInternAtom(self._x_display, asbytes(value), False))
+ atom_type = xlib.XInternAtom(self._x_display, asbytes('ATOM'), False)
+ if len(atoms):
+ atoms_ar = (xlib.Atom * len(atoms))(*atoms)
+ xlib.XChangeProperty(self._x_display, self._window,
+ name_atom, atom_type, 32, mode,
+ cast(pointer(atoms_ar), POINTER(c_ubyte)), len(atoms))
+ else:
+ xlib.XDeleteProperty(self._x_display, self._window, net_wm_state)
+
+ def _set_wm_state(self, *states):
+ # Set property
+ net_wm_state = xlib.XInternAtom(self._x_display, asbytes('_NET_WM_STATE'), False)
+ atoms = []
+ for state in states:
+ atoms.append(xlib.XInternAtom(self._x_display, asbytes(state), False))
+ atom_type = xlib.XInternAtom(self._x_display, asbytes('ATOM'), False)
+ if len(atoms):
+ atoms_ar = (xlib.Atom * len(atoms))(*atoms)
+ xlib.XChangeProperty(self._x_display, self._window,
+ net_wm_state, atom_type, 32, xlib.PropModePrepend,
+ cast(pointer(atoms_ar), POINTER(c_ubyte)), len(atoms))
+ else:
+ xlib.XDeleteProperty(self._x_display, self._window, net_wm_state)
+
+ # Nudge the WM
+ e = xlib.XEvent()
+ e.xclient.type = xlib.ClientMessage
+ e.xclient.message_type = net_wm_state
+ e.xclient.display = cast(self._x_display, POINTER(xlib.Display))
+ e.xclient.window = self._window
+ e.xclient.format = 32
+ e.xclient.data.l[0] = xlib.PropModePrepend
+ for i, atom in enumerate(atoms):
+ e.xclient.data.l[i + 1] = atom
+ xlib.XSendEvent(self._x_display, self._get_root(),
+ False, xlib.SubstructureRedirectMask, byref(e))
+
+ # Event handling
+
+ def dispatch_events(self):
+ self.dispatch_pending_events()
+
+ self._allow_dispatch_event = True
+
+ e = xlib.XEvent()
+
+ # Cache these in case window is closed from an event handler
+ _x_display = self._x_display
+ _window = self._window
+ _view = self._view
+
+ # Check for the events specific to this window
+ while xlib.XCheckWindowEvent(_x_display, _window,
+ 0x1ffffff, byref(e)):
+ # Key events are filtered by the xlib window event
+ # handler so they get a shot at the prefiltered event.
+ if e.xany.type not in (xlib.KeyPress, xlib.KeyRelease):
+ if xlib.XFilterEvent(e, 0):
+ continue
+ self.dispatch_platform_event(e)
+
+ # Check for the events specific to this view
+ while xlib.XCheckWindowEvent(_x_display, _view,
+ 0x1ffffff, byref(e)):
+ # Key events are filtered by the xlib window event
+ # handler so they get a shot at the prefiltered event.
+ if e.xany.type not in (xlib.KeyPress, xlib.KeyRelease):
+ if xlib.XFilterEvent(e, 0):
+ continue
+ self.dispatch_platform_event_view(e)
+
+ # Generic events for this window (the window close event).
+ while xlib.XCheckTypedWindowEvent(_x_display, _window,
+ xlib.ClientMessage, byref(e)):
+ self.dispatch_platform_event(e)
+
+ self._allow_dispatch_event = False
+
+ def dispatch_pending_events(self):
+ while self._event_queue:
+ EventDispatcher.dispatch_event(self, *self._event_queue.pop(0))
+
+ # Dispatch any context-related events
+ if self._lost_context:
+ self._lost_context = False
+ EventDispatcher.dispatch_event(self, 'on_context_lost')
+ if self._lost_context_state:
+ self._lost_context_state = False
+ EventDispatcher.dispatch_event(self, 'on_context_state_lost')
+
+ def dispatch_platform_event(self, e):
+ if self._applied_mouse_exclusive is None:
+ self._update_exclusivity()
+ event_handler = self._event_handlers.get(e.type)
+ if event_handler:
+ event_handler(e)
+
+ def dispatch_platform_event_view(self, e):
+ event_handler = self._view_event_handlers.get(e.type)
+ if event_handler:
+ event_handler(e)
+
+ @staticmethod
+ def _translate_modifiers(state):
+ modifiers = 0
+ if state & xlib.ShiftMask:
+ modifiers |= key.MOD_SHIFT
+ if state & xlib.ControlMask:
+ modifiers |= key.MOD_CTRL
+ if state & xlib.LockMask:
+ modifiers |= key.MOD_CAPSLOCK
+ if state & xlib.Mod1Mask:
+ modifiers |= key.MOD_ALT
+ if state & xlib.Mod2Mask:
+ modifiers |= key.MOD_NUMLOCK
+ if state & xlib.Mod4Mask:
+ modifiers |= key.MOD_WINDOWS
+ if state & xlib.Mod5Mask:
+ modifiers |= key.MOD_SCROLLLOCK
+ return modifiers
+
+ # Event handlers
+ '''
+ def _event_symbol(self, event):
+ # pyglet.self.key keysymbols are identical to X11 keysymbols, no
+ # need to map the keysymbol.
+ symbol = xlib.XKeycodeToKeysym(self._x_display, event.xkey.keycode, 0)
+ if symbol == 0:
+ # XIM event
+ return None
+ elif symbol not in key._key_names.keys():
+ symbol = key.user_key(event.xkey.keycode)
+ return symbol
+ '''
+
+ def _event_text_symbol(self, ev):
+ text = None
+ symbol = xlib.KeySym()
+ buffer = create_string_buffer(128)
+
+ # Look up raw keysym before XIM filters it (default for keypress and
+ # keyrelease)
+ count = xlib.XLookupString(ev.xkey,
+ buffer, len(buffer) - 1,
+ byref(symbol), None)
+
+ # Give XIM a shot
+ filtered = xlib.XFilterEvent(ev, ev.xany.window)
+
+ if ev.type == xlib.KeyPress and not filtered:
+ status = c_int()
+ if _have_utf8:
+ encoding = 'utf8'
+ count = xlib.Xutf8LookupString(self._x_ic,
+ ev.xkey,
+ buffer, len(buffer) - 1,
+ byref(symbol), byref(status))
+ if status.value == xlib.XBufferOverflow:
+ raise NotImplementedError('TODO: XIM buffer resize')
+
+ else:
+ encoding = 'ascii'
+ count = xlib.XLookupString(ev.xkey,
+ buffer, len(buffer) - 1,
+ byref(symbol), None)
+ if count:
+ status.value = xlib.XLookupBoth
+
+ if status.value & (xlib.XLookupChars | xlib.XLookupBoth):
+ text = buffer.value[:count].decode(encoding)
+
+ # Don't treat Unicode command codepoints as text, except Return.
+ if text and unicodedata.category(text) == 'Cc' and text != '\r':
+ text = None
+
+ symbol = symbol.value
+
+ # If the event is a XIM filtered event, the keysym will be virtual
+ # (e.g., aacute instead of A after a dead key). Drop it, we don't
+ # want these kind of key events.
+ if ev.xkey.keycode == 0 and not filtered:
+ symbol = None
+
+ # pyglet.self.key keysymbols are identical to X11 keysymbols, no
+ # need to map the keysymbol. For keysyms outside the pyglet set, map
+ # raw key code to a user key.
+ if symbol and symbol not in key._key_names and ev.xkey.keycode:
+ # Issue 353: Symbol is uppercase when shift key held down.
+ try:
+ symbol = ord(chr(symbol).lower())
+ except ValueError:
+ # Not a valid unichr, use the keycode
+ symbol = key.user_key(ev.xkey.keycode)
+ else:
+ # If still not recognised, use the keycode
+ if symbol not in key._key_names:
+ symbol = key.user_key(ev.xkey.keycode)
+
+ if filtered:
+ # The event was filtered, text must be ignored, but the symbol is
+ # still good.
+ return None, symbol
+
+ return text, symbol
+
+ def _event_text_motion(self, symbol, modifiers):
+ if modifiers & key.MOD_ALT:
+ return None
+ ctrl = modifiers & key.MOD_CTRL != 0
+ return _motion_map.get((symbol, ctrl), None)
+
+ @ViewEventHandler
+ @XlibEventHandler(xlib.KeyPress)
+ @XlibEventHandler(xlib.KeyRelease)
+ def _event_key_view(self, ev):
+ # Try to detect autorepeat ourselves if the server doesn't support it
+ # XXX: Doesn't always work, better off letting the server do it
+ global _can_detect_autorepeat
+ if not _can_detect_autorepeat and ev.type == xlib.KeyRelease:
+ # Look in the queue for a matching KeyPress with same timestamp,
+ # indicating an auto-repeat rather than actual key event.
+ saved = []
+ while True:
+ auto_event = xlib.XEvent()
+ result = xlib.XCheckWindowEvent(self._x_display,
+ self._window, xlib.KeyPress|xlib.KeyRelease,
+ byref(auto_event))
+ if not result:
+ break
+ saved.append(auto_event)
+ if auto_event.type == xlib.KeyRelease:
+ # just save this off for restoration back to the queue
+ continue
+ if ev.xkey.keycode == auto_event.xkey.keycode:
+ # Found a key repeat: dispatch EVENT_TEXT* event
+ text, symbol = self._event_text_symbol(auto_event)
+ modifiers = self._translate_modifiers(ev.xkey.state)
+ modifiers_ctrl = modifiers & (key.MOD_CTRL | key.MOD_ALT)
+ motion = self._event_text_motion(symbol, modifiers)
+ if motion:
+ if modifiers & key.MOD_SHIFT:
+ self.dispatch_event(
+ 'on_text_motion_select', motion)
+ else:
+ self.dispatch_event('on_text_motion', motion)
+ elif text and not modifiers_ctrl:
+ self.dispatch_event('on_text', text)
+
+ ditched = saved.pop()
+ for auto_event in reversed(saved):
+ xlib.XPutBackEvent(self._x_display, byref(auto_event))
+ return
+ else:
+ # Key code of press did not match, therefore no repeating
+ # is going on, stop searching.
+ break
+ # Whoops, put the events back, it's for real.
+ for auto_event in reversed(saved):
+ xlib.XPutBackEvent(self._x_display, byref(auto_event))
+
+ text, symbol = self._event_text_symbol(ev)
+ modifiers = self._translate_modifiers(ev.xkey.state)
+ modifiers_ctrl = modifiers & (key.MOD_CTRL | key.MOD_ALT)
+ motion = self._event_text_motion(symbol, modifiers)
+
+ if ev.type == xlib.KeyPress:
+ if symbol and (not _can_detect_autorepeat or symbol not in self.pressed_keys):
+ self.dispatch_event('on_key_press', symbol, modifiers)
+ if _can_detect_autorepeat:
+ self.pressed_keys.add(symbol)
+ if motion:
+ if modifiers & key.MOD_SHIFT:
+ self.dispatch_event('on_text_motion_select', motion)
+ else:
+ self.dispatch_event('on_text_motion', motion)
+ elif text and not modifiers_ctrl:
+ self.dispatch_event('on_text', text)
+ elif ev.type == xlib.KeyRelease:
+ if symbol:
+ self.dispatch_event('on_key_release', symbol, modifiers)
+ if _can_detect_autorepeat and symbol in self.pressed_keys:
+ self.pressed_keys.remove(symbol)
+
+ @XlibEventHandler(xlib.KeyPress)
+ @XlibEventHandler(xlib.KeyRelease)
+ def _event_key(self, ev):
+ return self._event_key_view(ev)
+
+ @ViewEventHandler
+ @XlibEventHandler(xlib.MotionNotify)
+ def _event_motionnotify_view(self, ev):
+ x = ev.xmotion.x
+ y = self.height - ev.xmotion.y
+
+ if self._mouse_in_window:
+ dx = x - self._mouse_x
+ dy = y - self._mouse_y
+ else:
+ dx = dy = 0
+
+ if self._applied_mouse_exclusive and \
+ (ev.xmotion.x, ev.xmotion.y) == self._mouse_exclusive_client:
+ # Ignore events caused by XWarpPointer
+ self._mouse_x = x
+ self._mouse_y = y
+ return
+
+ if self._applied_mouse_exclusive:
+ # Reset pointer position
+ ex, ey = self._mouse_exclusive_client
+ xlib.XWarpPointer(self._x_display,
+ 0,
+ self._window,
+ 0, 0,
+ 0, 0,
+ ex, ey)
+
+ self._mouse_x = x
+ self._mouse_y = y
+ self._mouse_in_window = True
+
+ buttons = 0
+ if ev.xmotion.state & xlib.Button1MotionMask:
+ buttons |= mouse.LEFT
+ if ev.xmotion.state & xlib.Button2MotionMask:
+ buttons |= mouse.MIDDLE
+ if ev.xmotion.state & xlib.Button3MotionMask:
+ buttons |= mouse.RIGHT
+
+ if buttons:
+ # Drag event
+ modifiers = self._translate_modifiers(ev.xmotion.state)
+ self.dispatch_event('on_mouse_drag',
+ x, y, dx, dy, buttons, modifiers)
+ else:
+ # Motion event
+ self.dispatch_event('on_mouse_motion', x, y, dx, dy)
+
+ @XlibEventHandler(xlib.MotionNotify)
+ def _event_motionnotify(self, ev):
+ # Window motion looks for drags that are outside the view but within
+ # the window.
+ buttons = 0
+ if ev.xmotion.state & xlib.Button1MotionMask:
+ buttons |= mouse.LEFT
+ if ev.xmotion.state & xlib.Button2MotionMask:
+ buttons |= mouse.MIDDLE
+ if ev.xmotion.state & xlib.Button3MotionMask:
+ buttons |= mouse.RIGHT
+
+ if buttons:
+ # Drag event
+ x = ev.xmotion.x - self._view_x
+ y = self._height - (ev.xmotion.y - self._view_y)
+
+ if self._mouse_in_window:
+ dx = x - self._mouse_x
+ dy = y - self._mouse_y
+ else:
+ dx = dy = 0
+ self._mouse_x = x
+ self._mouse_y = y
+
+ modifiers = self._translate_modifiers(ev.xmotion.state)
+ self.dispatch_event('on_mouse_drag',
+ x, y, dx, dy, buttons, modifiers)
+
+ @XlibEventHandler(xlib.ClientMessage)
+ def _event_clientmessage(self, ev):
+ atom = ev.xclient.data.l[0]
+ if atom == xlib.XInternAtom(ev.xclient.display,
+ asbytes('WM_DELETE_WINDOW'), False):
+ self.dispatch_event('on_close')
+ elif (self._enable_xsync and
+ atom == xlib.XInternAtom(ev.xclient.display,
+ asbytes('_NET_WM_SYNC_REQUEST'), False)):
+ lo = ev.xclient.data.l[2]
+ hi = ev.xclient.data.l[3]
+ self._current_sync_value = xsync.XSyncValue(hi, lo)
+
+ def _sync_resize(self):
+ if self._enable_xsync and self._current_sync_valid:
+ if xsync.XSyncValueIsZero(self._current_sync_value):
+ self._current_sync_valid = False
+ return
+ xsync.XSyncSetCounter(self._x_display,
+ self._sync_counter,
+ self._current_sync_value)
+ self._current_sync_value = None
+ self._current_sync_valid = False
+
+ @ViewEventHandler
+ @XlibEventHandler(xlib.ButtonPress)
+ @XlibEventHandler(xlib.ButtonRelease)
+ def _event_button(self, ev):
+ x = ev.xbutton.x
+ y = self.height - ev.xbutton.y
+ button = 1 << (ev.xbutton.button - 1) # 1, 2, 3 -> 1, 2, 4
+ modifiers = self._translate_modifiers(ev.xbutton.state)
+ if ev.type == xlib.ButtonPress:
+ # override_redirect issue: manually activate this window if
+ # fullscreen.
+ if self._override_redirect and not self._active:
+ self.activate()
+
+ if ev.xbutton.button == 4:
+ self.dispatch_event('on_mouse_scroll', x, y, 0, 1)
+ elif ev.xbutton.button == 5:
+ self.dispatch_event('on_mouse_scroll', x, y, 0, -1)
+ elif ev.xbutton.button < len(self._mouse_buttons):
+ self._mouse_buttons[ev.xbutton.button] = True
+ self.dispatch_event('on_mouse_press',
+ x, y, button, modifiers)
+ else:
+ if ev.xbutton.button < 4:
+ self._mouse_buttons[ev.xbutton.button] = False
+ self.dispatch_event('on_mouse_release',
+ x, y, button, modifiers)
+
+ @ViewEventHandler
+ @XlibEventHandler(xlib.Expose)
+ def _event_expose(self, ev):
+ # Ignore all expose events except the last one. We could be told
+ # about exposure rects - but I don't see the point since we're
+ # working with OpenGL and we'll just redraw the whole scene.
+ if ev.xexpose.count > 0: return
+ self.dispatch_event('on_expose')
+
+ @ViewEventHandler
+ @XlibEventHandler(xlib.EnterNotify)
+ def _event_enternotify(self, ev):
+ # figure active mouse buttons
+ # XXX ignore modifier state?
+ state = ev.xcrossing.state
+ self._mouse_buttons[1] = state & xlib.Button1Mask
+ self._mouse_buttons[2] = state & xlib.Button2Mask
+ self._mouse_buttons[3] = state & xlib.Button3Mask
+ self._mouse_buttons[4] = state & xlib.Button4Mask
+ self._mouse_buttons[5] = state & xlib.Button5Mask
+
+ # mouse position
+ x = self._mouse_x = ev.xcrossing.x
+ y = self._mouse_y = self.height - ev.xcrossing.y
+ self._mouse_in_window = True
+
+ # XXX there may be more we could do here
+ self.dispatch_event('on_mouse_enter', x, y)
+
+ @ViewEventHandler
+ @XlibEventHandler(xlib.LeaveNotify)
+ def _event_leavenotify(self, ev):
+ x = self._mouse_x = ev.xcrossing.x
+ y = self._mouse_y = self.height - ev.xcrossing.y
+ self._mouse_in_window = False
+ self.dispatch_event('on_mouse_leave', x, y)
+
+ @XlibEventHandler(xlib.ConfigureNotify)
+ def _event_configurenotify(self, ev):
+ if self._enable_xsync and self._current_sync_value:
+ self._current_sync_valid = True
+
+ if self._fullscreen:
+ return
+
+ self.switch_to()
+
+ w, h = ev.xconfigure.width, ev.xconfigure.height
+ x, y = ev.xconfigure.x, ev.xconfigure.y
+ if self._width != w or self._height != h:
+ self._width = w
+ self._height = h
+ self._update_view_size()
+ self.dispatch_event('on_resize', self._width, self._height)
+ if self._x != x or self._y != y:
+ self.dispatch_event('on_move', x, y)
+ self._x = x
+ self._y = y
+
+ @XlibEventHandler(xlib.FocusIn)
+ def _event_focusin(self, ev):
+ self._active = True
+ self._update_exclusivity()
+ self.dispatch_event('on_activate')
+ xlib.XSetICFocus(self._x_ic)
+
+ @XlibEventHandler(xlib.FocusOut)
+ def _event_focusout(self, ev):
+ self._active = False
+ self._update_exclusivity()
+ self.dispatch_event('on_deactivate')
+ xlib.XUnsetICFocus(self._x_ic)
+
+ @XlibEventHandler(xlib.MapNotify)
+ def _event_mapnotify(self, ev):
+ self._mapped = True
+ self.dispatch_event('on_show')
+ self._update_exclusivity()
+
+ @XlibEventHandler(xlib.UnmapNotify)
+ def _event_unmapnotify(self, ev):
+ self._mapped = False
+ self.dispatch_event('on_hide')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/setup.cfg b/pyglet-1.3.0/pyglet-1.3.0/setup.cfg
new file mode 100644
index 0000000..6f08d0e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/setup.cfg
@@ -0,0 +1,8 @@
+[bdist_wheel]
+universal = 1
+
+[egg_info]
+tag_build =
+tag_date = 0
+tag_svn_revision = 0
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/setup.py b/pyglet-1.3.0/pyglet-1.3.0/setup.py
new file mode 100644
index 0000000..1a11ec4
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/setup.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python
+import os
+import shutil
+import sys
+from setuptools import setup, find_packages
+
+# Bump pyglet/__init__.py version as well.
+VERSION = '1.3.0'
+
+long_description = '''pyglet provides an object-oriented programming
+interface for developing games and other visually-rich applications
+for Windows, Mac OS X and Linux.'''
+
+# The source dist comes with batteries included, the wheel can use pip to get the rest
+is_wheel = 'bdist_wheel' in sys.argv
+
+excluded = []
+if is_wheel:
+ excluded.append('extlibs.future')
+
+def exclude_package(pkg):
+ for exclude in excluded:
+ if pkg.startswith(exclude):
+ return True
+ return False
+
+def create_package_list(base_package):
+ return ([base_package] +
+ [base_package + '.' + pkg
+ for pkg
+ in find_packages(base_package)
+ if not exclude_package(pkg)])
+
+
+setup_info = dict(
+ # Metadata
+ name='pyglet',
+ version=VERSION,
+ author='Alex Holkner',
+ author_email='Alex.Holkner@gmail.com',
+ url='http://pyglet.readthedocs.org/en/latest/',
+ download_url='http://pypi.python.org/pypi/pyglet',
+ description='Cross-platform windowing and multimedia library',
+ long_description=long_description,
+ license='BSD',
+ classifiers=[
+ 'Development Status :: 5 - Production/Stable',
+ 'Environment :: MacOS X',
+ 'Environment :: Win32 (MS Windows)',
+ 'Environment :: X11 Applications',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: BSD License',
+ 'Operating System :: MacOS :: MacOS X',
+ 'Operating System :: Microsoft :: Windows',
+ 'Operating System :: POSIX :: Linux',
+ 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.4',
+ 'Programming Language :: Python :: 3.5',
+ 'Programming Language :: Python :: 3.6',
+ 'Topic :: Games/Entertainment',
+ 'Topic :: Software Development :: Libraries :: Python Modules',
+ ],
+
+ # Package info
+ packages=create_package_list('pyglet'),
+
+ # Add _ prefix to the names of temporary build dirs
+ options={
+ 'build': {'build_base': '_build'},
+ # 'sdist': {'dist_dir': '_dist'},
+ },
+ zip_safe=True,
+)
+
+if is_wheel:
+ setup_info['install_requires'] = ['future']
+
+setup(**setup_info)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/__init__.py
new file mode 100644
index 0000000..0adb745
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/__init__.py
@@ -0,0 +1,35 @@
+"""
+Please see doc/internal/testing.txt for test documentation.
+"""
+
+# Try to get a version of mock
+try:
+ # Python 3.3+ has mock in the stdlib
+ import unittest.mock as mock
+except ImportError:
+ try:
+ # User could have mock installed
+ import mock
+ except ImportError:
+ # Last resort: use included mock library
+ import tests.extlibs.mock as mock
+
+# Try to get python-future
+try:
+ import future
+except ImportError:
+ import os.path as op
+ import sys
+ future_base = op.abspath(op.join(op.dirname(__file__), 'extlibs', 'future'))
+ sys.path.insert(0, op.join(future_base, 'py2_3'))
+ if sys.version_info[:2] < (3, 0):
+ sys.path.insert(0, op.join(future_base, 'py2'))
+ del future_base
+ del sys
+ del op
+ try:
+ import future
+ except ImportError:
+ print('Failed to get python-future')
+ raise
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/annotations.py b/pyglet-1.3.0/pyglet-1.3.0/tests/annotations.py
new file mode 100644
index 0000000..55b1e6e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/annotations.py
@@ -0,0 +1,51 @@
+from builtins import object
+
+import pyglet
+from pyglet.gl import gl_info
+import pytest
+
+
+# Platform identifiers
+class Platform(object):
+ """
+ Predefined lists of identifiers for platforms. For use with
+ :func:`.require_platform` and :func:`.skip_platform`. Combine platforms using +.
+ """
+ LINUX = ('linux-compat', 'linux2', 'linux')
+ """Linux platforms"""
+
+ WINDOWS = ('win32', 'cygwin')
+ """MS Windows platforms"""
+
+ OSX = ('darwin',)
+ """Mac OS X platforms"""
+
+
+def require_platform(platform):
+ """
+ Only run the test on the given platform(s), skip on other platforms.
+
+ :param list(str) platform: A list of platform identifiers as returned by
+ :data:`pyglet.options`. See also :class:`tests.annotations.Platform`.
+ """
+ return pytest.mark.skipif(pyglet.compat_platform not in platform,
+ reason='requires platform: %s' % str(platform))
+
+def skip_platform(platform):
+ """
+ Skip test on the given platform(s).
+
+ :param list(str) platform: A list of platform identifiers as returned by
+ :data:`pyglet.options`. See also :class:`tests.annotations.Platform`.
+ """
+ return pytest.mark.skipif(pyglet.compat_platform in platform,
+ reason='not supported for platform: %s' % str(platform))
+
+def require_gl_extension(extension):
+ """
+ Skip the test if the given GL extension is not available.
+
+ :param str extension: Name of the extension required.
+ """
+ return pytest.mark.skipif(not gl_info.have_extension(extension),
+ reason='Tests requires GL extension {}'.format(extension))
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/base/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/base/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/base/data.py b/pyglet-1.3.0/pyglet-1.3.0/tests/base/data.py
new file mode 100644
index 0000000..766acf3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/base/data.py
@@ -0,0 +1,42 @@
+from __future__ import absolute_import
+
+import os
+import pytest
+
+from .future_test import FutureTestCase
+
+local_dir = os.path.dirname(__file__)
+test_data_path = os.path.abspath(os.path.join(local_dir, '..', 'data'))
+del local_dir
+
+class PygletTestCase(FutureTestCase):
+ """
+ Base class for pyglet tests.
+ Specifies helper methods for all tests.
+ """
+ @staticmethod
+ def get_test_data_file(*file_parts):
+ """
+ Get a file from the test data directory in an OS independent way. Supply relative file
+ name as you would in os.path.join().
+ """
+ return os.path.join(test_data_path, *file_parts)
+
+
+class TestDataFixture(object):
+ """Fixture for accessing test data."""
+ def __init__(self):
+ local_dir = os.path.dirname(__file__)
+ self._test_data_path = os.path.abspath(os.path.join(local_dir, '..', 'data'))
+
+ def get_file(self, *file_parts):
+ """
+ Get a file from the test data directory in an OS independent way. Supply relative file
+ name as you would in os.path.join().
+ """
+ return os.path.join(self._test_data_path, *file_parts)
+
+
+@pytest.fixture(scope="session")
+def test_data():
+ return TestDataFixture()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/base/event_loop.py b/pyglet-1.3.0/pyglet-1.3.0/tests/base/event_loop.py
new file mode 100644
index 0000000..0837953
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/base/event_loop.py
@@ -0,0 +1,173 @@
+"""
+Base classes for test cases using the normal pyglet application event loop.
+"""
+
+import pytest
+
+import pyglet
+from pyglet import clock
+from pyglet import gl
+from pyglet.graphics import Batch
+from pyglet.text.document import FormattedDocument
+from pyglet.text.layout import TextLayout
+from pyglet.window import Window, key
+
+from .interactive import InteractiveFixture
+
+
+@pytest.fixture
+def event_loop(request):
+ return EventLoopFixture(request)
+
+
+class EventLoopFixture(InteractiveFixture):
+
+ question = '\n\n(P)ass/(F)ail/(S)kip/(Q)uit?'
+ key_pass = key.P
+ key_fail = key.F
+ key_skip = key.S
+ key_quit = key.Q
+ clear_color = 1, 1, 1, 1
+ base_options = {
+ 'width': 300,
+ 'height': 300,
+ }
+
+ def __init__(self, request):
+ super(EventLoopFixture, self).__init__(request)
+ self._request = request
+ self.window = None
+ self.text_batch = None
+ self.text_document = None
+ self.answer = None
+ request.addfinalizer(self.tear_down)
+
+ def tear_down(self):
+ if self.window:
+ self.window.close()
+ self.window = None
+
+ def create_window(self, **kwargs):
+ combined_kwargs = {}
+ combined_kwargs.update(self.base_options)
+ combined_kwargs.update(kwargs)
+ self.window = Window(**combined_kwargs)
+ self.window.push_handlers(self)
+ return self.window
+
+ def get_document(self):
+ if self.text_document is None:
+ self._create_text()
+ return self.text_document
+
+ def _create_text(self):
+ assert self.window is not None
+ self.text_batch = Batch()
+ self.text_document = FormattedDocument()
+ layout = TextLayout(self.text_document, self.window.width, self.window.height,
+ multiline=True, wrap_lines=True, batch=self.text_batch)
+ layout.content_valign = 'bottom'
+
+ def add_text(self, text):
+ self.get_document()
+ self.text_document.insert_text(len(self.text_document.text), text)
+ self.window._legacy_invalid = True
+
+ def ask_question(self, description=None, screenshot=True):
+ """Ask a question inside the test window. By default takes a screenshot and validates
+ that too."""
+ if self.window is None:
+ self.create_window()
+ self.add_text('\n\n')
+ if description:
+ self.add_text(description)
+ self.add_text(self.question)
+ self.answer = None
+ caught_exception = None
+ try:
+ if self.interactive:
+ self.run_event_loop()
+ self.handle_answer()
+ else:
+ self.run_event_loop(0.1)
+ except Exception as ex:
+ import traceback
+ traceback.print_exc()
+ caught_exception = ex
+ finally:
+ if screenshot:
+ try:
+ screenshot_name = self._take_screenshot(self.window)
+ if caught_exception is None and not self.interactive:
+ self._check_screenshot(screenshot_name)
+ except:
+ if not caught_exception:
+ raise
+ if caught_exception:
+ raise caught_exception
+
+ def handle_answer(self):
+ if self.answer is None:
+ raise Exception('Did not receive valid input in question window')
+ elif self.answer == self.key_fail:
+ # TODO: Ask input
+ pytest.fail('Tester marked test failed')
+ elif self.answer == self.key_skip:
+ pytest.skip('Tester marked test skipped')
+ elif self.answer == self.key_quit:
+ pytest.exit('Tester requested to quit')
+
+ def ask_question_no_window(self, description=None):
+ """Ask a question to verify the current test result. Uses the console or an external gui
+ as no window is available."""
+ super(EventLoopFixture, self).ask_question(description)
+
+ def run_event_loop(self, duration=None):
+ if duration:
+ clock.schedule_once(self.interrupt_event_loop, duration)
+ pyglet.app.run()
+
+ def interrupt_event_loop(self, *args, **kwargs):
+ pyglet.app.exit()
+
+ @staticmethod
+ def schedule_once(callback, dt=.1):
+ clock.schedule_once(callback, dt)
+
+ def on_draw(self):
+ self.clear()
+ self.draw_text()
+
+ def clear(self):
+ gl.glClearColor(*self.clear_color)
+ self.window.clear()
+
+ def draw_text(self):
+ if self.text_batch is not None:
+ self.text_batch.draw()
+
+ def on_key_press(self, symbol, modifiers):
+ if symbol in (self.key_pass, self.key_fail, self.key_skip, self.key_quit):
+ self.answer = symbol
+ self.interrupt_event_loop()
+
+ # Prevent handling of Escape to close the window
+ return True
+
+
+
+def test_question_pass(event_loop):
+ event_loop.create_window()
+ event_loop.ask_question('If you read this text, you should let the test pass.')
+
+def test_question_fail(event_loop):
+ event_loop.create_window()
+ with pytest.raises(pytest.fail.Exception):
+ event_loop.ask_question('Please press F to fail this test.')
+
+def test_question_skip(event_loop):
+ event_loop.create_window()
+ event_loop.ask_question('Please press S to skip the rest of this test.')
+ pytest.fail('You should have pressed S')
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/base/future_test.py b/pyglet-1.3.0/pyglet-1.3.0/tests/base/future_test.py
new file mode 100644
index 0000000..a1e15b6
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/base/future_test.py
@@ -0,0 +1,30 @@
+from builtins import bytes
+import sys
+import unittest
+
+if sys.version_info[:2] < (3, 0):
+ _py2 = True
+else:
+ _py2 = False
+
+
+class FutureTestCase(unittest.TestCase):
+ """Base class for unittests that adds compatibility for both the Py2 and Py3 version of the
+ unittest module."""
+
+ if _py2:
+ assertCountEqual = unittest.TestCase.assertItemsEqual
+
+ if _py2:
+ assertBytesEqual = unittest.TestCase.assertEqual
+ else:
+ def assertBytesEqual(self, first, second, msg=None):
+ if isinstance(first, str):
+ first = first.encode('latin-1')
+ elif not isinstance(first, bytes):
+ first = bytes(first)
+ if isinstance(second, str):
+ second = second.encode('latin-1')
+ elif not isinstance(second, bytes):
+ second = bytes(second)
+ self.assertEqual(first, second)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/base/interactive.py b/pyglet-1.3.0/pyglet-1.3.0/tests/base/interactive.py
new file mode 100644
index 0000000..d851591
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/base/interactive.py
@@ -0,0 +1,333 @@
+from __future__ import absolute_import, print_function
+from builtins import zip
+from builtins import input
+
+import array
+import os
+import pytest
+import shutil
+import warnings
+
+import pyglet
+from pyglet.image import get_buffer_manager
+
+from .data import PygletTestCase
+
+try:
+ # If the easygui package is available, use it to display popup questions, instead of using the
+ # console (which might lose focus to the Pyglet windows).
+ # Not using Pyglet to show a window with the question to prevent interfering with the test.
+ import easygui
+ _has_gui = True
+except:
+ _has_gui = False
+
+local_dir = os.path.dirname(__file__)
+test_dir = os.path.normpath(os.path.join(local_dir, '..'))
+
+base_screenshot_path = os.path.join(test_dir, 'interactive', 'screenshots')
+committed_screenshot_path = os.path.join(base_screenshot_path, 'committed')
+session_screenshot_path = os.path.join(base_screenshot_path, 'session')
+
+del local_dir, test_dir
+
+
+class InteractiveFixture(object):
+ """Fixture for interactive test cases. Provides interactive prompts and
+ verifying screenshots.
+ """
+ def __init__(self, request):
+ self.screenshots = []
+ self._request = request
+
+ @property
+ def interactive(self):
+ return not self.sanity and not self.non_interactive
+
+ @property
+ def sanity(self):
+ return self._request.config.getoption('--sanity', False)
+
+ @property
+ def non_interactive(self):
+ return self._request.config.getoption('--non-interactive', False)
+
+ @property
+ def allow_missing_screenshots(self):
+ return not self.non_interactive
+
+ @property
+ def testname(self):
+ parts = []
+ parts.append(self._request.node.module.__name__)
+ if self._request.node.cls:
+ parts.append(self._request.node.cls.__name__)
+ parts.append(self._request.node.name)
+ return '.'.join(parts)
+
+ def ask_question(self, description=None):
+ """Ask a question to verify the current test result. Uses the console or an external gui
+ as no window is available."""
+ failure_description = None
+ if self.interactive:
+ failure_description = _ask_user_to_verify(description)
+ if failure_description is not None:
+ self.fail(failure_description)
+
+ def _take_screenshot(self, window=None):
+ """
+ Take a screenshot to allow visual verification.
+ """
+ screenshot_name = self._get_next_screenshot_name()
+ screenshot_file_name = self._get_screenshot_session_file_name(screenshot_name)
+
+ if window is not None:
+ window.switch_to()
+
+ get_buffer_manager().get_color_buffer().image_data.save(screenshot_file_name)
+ self.screenshots.append(screenshot_name)
+ self._schedule_commit()
+
+ return screenshot_name
+
+ def _check_screenshot(self, screenshot_name):
+ session_file_name = self._get_screenshot_session_file_name(screenshot_name)
+ committed_file_name = self._get_screenshot_committed_file_name(screenshot_name)
+
+ assert os.path.isfile(session_file_name)
+ if os.path.isfile(committed_file_name):
+ committed_image = pyglet.image.load(committed_file_name)
+ session_image = pyglet.image.load(session_file_name)
+ self.assert_image_equal(committed_image, session_image)
+ else:
+ assert self.allow_missing_screenshots
+ warnings.warn('No committed reference screenshot available.')
+
+ def _get_next_screenshot_name(self):
+ """
+ Get the unique name for the next screenshot.
+ """
+ return '{}.{:03d}.png'.format(self.testname,
+ len(self.screenshots)+1)
+
+ def _get_screenshot_session_file_name(self, screenshot_name):
+ return os.path.join(session_screenshot_path, screenshot_name)
+
+ def _get_screenshot_committed_file_name(self, screenshot_name):
+ return os.path.join(committed_screenshot_path, screenshot_name)
+
+ def _schedule_commit(self):
+ if not hasattr(self._request.session, 'pending_screenshots'):
+ self._request.session.pending_screenshots = set()
+ self._request.session.pending_screenshots.add(self)
+
+ def assert_image_equal(self, a, b, tolerance=0, msg=None):
+ if msg is None:
+ msg = 'Screenshot does not match last committed screenshot'
+ if a is None:
+ assert b is None, msg
+ else:
+ assert b is not None, msg
+
+ a_data = a.image_data
+ b_data = b.image_data
+
+ assert a_data.width == b_data.width, msg
+ assert a_data.height == b_data.height, msg
+ assert a_data.format == b_data.format, msg
+ assert a_data.pitch == b_data.pitch, msg
+ self.assert_buffer_equal(a_data.data, b_data.data, tolerance, msg)
+
+ def assert_buffer_equal(self, a, b, tolerance=0, msg=None):
+ if tolerance == 0:
+ assert a == b, msg
+
+ assert len(a) == len(b), msg
+
+ a = array.array('B', a)
+ b = array.array('B', b)
+ for (aa, bb) in zip(a, b):
+ assert abs(aa - bb) <= tolerance, msg
+
+ def commit_screenshots(self):
+ """
+ Store the screenshots for reference if the test case is successful.
+ """
+ for screenshot_name in self.screenshots:
+ shutil.copyfile(self._get_screenshot_session_file_name(screenshot_name),
+ self._get_screenshot_committed_file_name(screenshot_name))
+
+
+class InteractiveTestCase(PygletTestCase):
+ """
+ Base class for interactive tests.
+
+ Interactive tests exist on several levels of interactivity. The least interactive tests store
+ screenshots of user validated output that can be used to automatically compare to in a non
+ interactive run. More interactive tests cannot validate the results automatically, but can
+ run fully automatic for sanity checks. Finally there are tests that really require the user
+ to perform an action for the test to continue.
+
+ Use the decorators @only_interactive, @requires_user_validation and @requires_user_action to
+ mark a test case as such. This only works on the test suite (class) level.
+ """
+ # Show interactive prompts
+ interactive = True
+
+ # Allow tests missing reference screenshots to pass
+ allow_missing_screenshots = False
+
+ def __init__(self, methodName):
+ super(InteractiveTestCase, self).__init__(methodName=methodName)
+ self._screenshots = []
+
+ def check_screenshots(self):
+ # If we arrive here, there have not been any failures yet
+ if self.interactive:
+ self._commit_screenshots()
+ else:
+ if self._has_reference_screenshots():
+ self._validate_screenshots()
+ # Always commit the screenshots here. They can be used for the next test run.
+ # If reference screenshots were already present and there was a mismatch, it should
+ # have failed above.
+ self._commit_screenshots()
+
+ elif self.allow_missing_screenshots:
+ warnings.warn('No committed reference screenshots available. Ignoring.')
+ else:
+ self.fail('No committed reference screenshots available. Run interactive first.')
+
+ def user_verify(self, description, take_screenshot=True):
+ """
+ Request the user to verify the current display is correct.
+ """
+ failed = False
+ failure_description = None
+
+ if self.interactive:
+ failure_description = _ask_user_to_verify(description)
+ if take_screenshot:
+ self._take_screenshot()
+
+ if failure_description is not None:
+ self.fail(failure_description)
+
+ def assert_image_equal(self, a, b, tolerance=0, msg=None):
+ if msg is None:
+ msg = 'Screenshot does not match last committed screenshot'
+ if a is None:
+ self.assertIsNone(b, msg)
+ else:
+ self.assertIsNotNone(b, msg)
+
+ a_data = a.image_data
+ b_data = b.image_data
+
+ self.assertEqual(a_data.width, b_data.width, msg)
+ self.assertEqual(a_data.height, b_data.height, msg)
+ self.assertEqual(a_data.format, b_data.format, msg)
+ self.assertEqual(a_data.pitch, b_data.pitch, msg)
+ self.assert_buffer_equal(a_data.data, b_data.data, tolerance, msg)
+
+ def assert_buffer_equal(self, a, b, tolerance=0, msg=None):
+ if tolerance == 0:
+ self.assertEqual(a, b, msg)
+
+ self.assertEqual(len(a), len(b), msg)
+
+ a = array.array('B', a)
+ b = array.array('B', b)
+ for (aa, bb) in zip(a, b):
+ self.assertTrue(abs(aa - bb) <= tolerance, msg)
+
+ def _take_screenshot(self):
+ """
+ Take a screenshot to allow visual verification.
+ """
+ screenshot_name = self._get_next_screenshot_name()
+ screenshot_file_name = self._get_screenshot_session_file_name(screenshot_name)
+
+ get_buffer_manager().get_color_buffer().image_data.save(screenshot_file_name)
+
+ self._screenshots.append(screenshot_name)
+
+ def _commit_screenshots(self):
+ """
+ Store the screenshots for reference if the test case is successful.
+ """
+ for screenshot_name in self._screenshots:
+ shutil.copyfile(self._get_screenshot_session_file_name(screenshot_name),
+ self._get_screenshot_committed_file_name(screenshot_name))
+
+ def _validate_screenshots(self):
+ """
+ Check the screenshot against regression reference images if available.
+ """
+ for screenshot_name in self._screenshots:
+ committed_image = pyglet.image.load(self._get_screenshot_committed_file_name(screenshot_name))
+ session_image = pyglet.image.load(self._get_screenshot_session_file_name(screenshot_name))
+ self.assert_image_equal(committed_image, session_image)
+
+ def _has_reference_screenshots(self):
+ """
+ Check whether there are screenshots from a previous successful run available to validate
+ against. Use after taking all required screenshots. Also validates the number of required
+ screenshots.
+ """
+ for screenshot_name in self._screenshots:
+ if not os.path.isfile(self._get_screenshot_committed_file_name(screenshot_name)):
+ return False
+ else:
+ return True
+
+ def _get_next_screenshot_name(self):
+ """
+ Get the unique name for the next screenshot.
+ """
+ return '{}.{}.{}.{:03d}.png'.format(self.__class__.__module__,
+ self.__class__.__name__,
+ self._testMethodName,
+ len(self._screenshots)+1)
+
+ def _get_screenshot_session_file_name(self, screenshot_name):
+ return os.path.join(session_screenshot_path, screenshot_name)
+
+ def _get_screenshot_committed_file_name(self, screenshot_name):
+ return os.path.join(committed_screenshot_path, screenshot_name)
+
+if _has_gui:
+ def _ask_user_to_verify(description):
+ failure_description = None
+ success = easygui.ynbox(description)
+ if not success:
+ failure_description = easygui.enterbox('Enter failure description:')
+ if not failure_description:
+ failure_description = 'No description entered'
+ return failure_description
+else:
+ def _ask_user_to_verify(description):
+ failure_description = None
+ print()
+ print(description)
+ while True:
+ response = input('Passed [Yn]: ')
+ if not response:
+ break
+ elif response in 'Nn':
+ failure_description = input('Enter failure description: ')
+ if not failure_description:
+ failure_description = 'No description entered'
+ break
+ elif response in 'Yy':
+ break
+ else:
+ print('Invalid response')
+ return failure_description
+
+@pytest.fixture
+def interactive(request):
+ """Fixture for interactive test cases. Returns an object that can be used for
+ requesting interactive prompts and verifying screenshots.
+ """
+ return InteractiveFixture(request)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/base/performance.py b/pyglet-1.3.0/pyglet-1.3.0/tests/base/performance.py
new file mode 100644
index 0000000..51fd0ea
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/base/performance.py
@@ -0,0 +1,27 @@
+"""
+Performance measurement utilities.
+"""
+import pytest
+import time
+
+
+class PerformanceTimer(object):
+ def __init__(self, max_time):
+ self.max_time = max_time
+ self.start_time = None
+
+ def __enter__(self):
+ self.start_time = time.time()
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ assert time.time() - self.start_time < self.max_time
+
+
+class PerformanceFixture(object):
+ timer = PerformanceTimer
+
+
+@pytest.fixture
+def performance():
+ return PerformanceFixture()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/base/test_interactive_test_base.py b/pyglet-1.3.0/pyglet-1.3.0/tests/base/test_interactive_test_base.py
new file mode 100644
index 0000000..775643c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/base/test_interactive_test_base.py
@@ -0,0 +1,380 @@
+"""
+Test the base class for interactive test cases.
+"""
+
+import glob
+from tests import mock
+import os
+import pytest
+import shutil
+from .interactive import InteractiveTestCase
+import tempfile
+import unittest
+
+import pyglet
+from pyglet import window
+from pyglet.gl import *
+
+@pytest.mark.requires_user_action
+class InteractiveTestCaseTest(InteractiveTestCase):
+ """
+ Test the interactive test case base. Is an interactive test case itself, to be able to test it
+ properly.
+ """
+
+ def setUp(self):
+ self._patchers = []
+ self._temporary_directories = []
+
+ def tearDown(self):
+ for patcher in self._patchers:
+ patcher.stop()
+ for directory in self._temporary_directories:
+ shutil.rmtree(directory)
+
+ def _patch_directory(self, target):
+ directory = tempfile.mkdtemp()
+ self._temporary_directories.append(directory)
+ patcher = mock.patch(target, directory)
+ self._patchers.append(patcher)
+ patcher.start()
+ return directory
+
+ def _patch_screenshot_paths(self):
+ self._session_screenshot_path = self._patch_directory('tests.interactive.interactive_test_base.session_screenshot_path')
+ self._committed_screenshot_path = self._patch_directory('tests.interactive.interactive_test_base.committed_screenshot_path')
+
+ def test_single_method(self):
+ class _Test(InteractiveTestCase):
+ test1_ran = False
+
+ def test_1(self):
+ _Test.test1_ran = True
+
+ tests = unittest.defaultTestLoader.loadTestsFromTestCase(_Test)
+ self.assertIsNotNone(tests)
+ self.assertEqual(tests.countTestCases(), 1)
+
+ result = unittest.TestResult()
+ tests.run(result)
+
+ self.assertTrue(_Test.test1_ran, 'Test should have run')
+
+ def test_multiple_methods(self):
+ class _Test(InteractiveTestCase):
+ test1_ran = False
+ test2_ran = False
+
+ def test_1(self):
+ _Test.test1_ran = True
+
+ def test_2(self):
+ _Test.test2_ran = True
+
+ tests = unittest.defaultTestLoader.loadTestsFromTestCase(_Test)
+ self.assertIsNotNone(tests)
+ self.assertEqual(tests.countTestCases(), 2)
+
+ result = unittest.TestResult()
+ tests.run(result)
+
+ self.assertTrue(_Test.test1_ran, 'Test 1 should have run')
+ self.assertTrue(_Test.test2_ran, 'Test 2 should have run')
+
+ def test_user_verify_passed(self):
+ class _Test(InteractiveTestCase):
+ test1_ran = False
+
+ def test_1(self):
+ _Test.test1_ran = True
+
+ self.user_verify('Just press Enter', take_screenshot=False)
+
+ tests = unittest.defaultTestLoader.loadTestsFromTestCase(_Test)
+ self.assertIsNotNone(tests)
+ self.assertEqual(tests.countTestCases(), 1)
+
+ result = unittest.TestResult()
+ tests.run(result)
+
+ self.assertTrue(_Test.test1_ran, 'Test should have run')
+ self.assertEqual(len(result.failures), 0, 'Not expecting failures')
+ self.assertEqual(len(result.errors), 0, 'Not expecting errors')
+ self.assertEqual(result.testsRun, 1, 'Expected 1 test run')
+
+ self.user_verify('Did I ask you to press Enter?', take_screenshot=False)
+
+ def test_user_verify_failed(self):
+ class _Test(InteractiveTestCase):
+ test1_ran = False
+
+ def test_1(self):
+ _Test.test1_ran = True
+
+ self.user_verify('Enter "n" and then enter reason "abcd"', take_screenshot=False)
+
+ tests = unittest.defaultTestLoader.loadTestsFromTestCase(_Test)
+ self.assertIsNotNone(tests)
+ self.assertEqual(tests.countTestCases(), 1)
+
+ result = unittest.TestResult()
+ tests.run(result)
+
+ self.assertTrue(_Test.test1_ran, 'Test should have run')
+ self.assertEqual(len(result.failures), 1, 'Expected 1 test failure')
+ self.assertEqual(len(result.errors), 0, 'Not expecting errors')
+ self.assertEqual(result.testsRun, 1, 'Expected 1 test run')
+
+ self.assertIn('AssertionError: abcd', result.failures[0][1], 'Did not get failure message entered by user.')
+
+ def test_verify_commits_screenshot_on_user_passed(self):
+ class _Test(InteractiveTestCase):
+ def test_1(self):
+ w = window.Window(200, 200)
+ w.switch_to()
+ glClearColor(1, 0, 1, 1)
+ glClear(GL_COLOR_BUFFER_BIT)
+ w.flip()
+
+ self.user_verify('Please choose yes (or press Enter)')
+ w.close()
+
+ self._patch_screenshot_paths()
+
+ tests = unittest.defaultTestLoader.loadTestsFromTestCase(_Test)
+ self.assertIsNotNone(tests)
+ self.assertEqual(tests.countTestCases(), 1)
+
+ result = unittest.TestResult()
+ tests.run(result)
+
+ self.assertEqual(len(result.failures), 0, 'Not expecting failures')
+ self.assertEqual(len(result.errors), 0, 'Not expecting errors')
+ self.assertEqual(result.testsRun, 1, 'Expected 1 test run')
+
+ files = glob.glob(os.path.join(self._session_screenshot_path, '*.png'))
+ self.assertEqual(len(files), 1, 'Screenshot not stored in session directory')
+ self.assertIn('tests.interactive.test_interactive_test_base._Test.test_1.001.png', files[0])
+
+ files = glob.glob(os.path.join(self._committed_screenshot_path, '*.png'))
+ self.assertEqual(len(files), 1, 'Screenshot not committed')
+ self.assertIn('tests.interactive.test_interactive_test_base._Test.test_1.001.png', files[0])
+
+ @mock.patch('tests.interactive.interactive_test_base.interactive', False)
+ def test_screenshot_taken_but_not_committed_on_noninteractive_failure(self):
+ class _Test(InteractiveTestCase):
+ def test_1(self):
+ w = window.Window(200, 200)
+ w.switch_to()
+ glClearColor(1, 0, 1, 1)
+ glClear(GL_COLOR_BUFFER_BIT)
+ w.flip()
+
+ self.user_verify('Empty window')
+ w.close()
+
+ self.fail('Test failed')
+
+ self._patch_screenshot_paths()
+
+ tests = unittest.defaultTestLoader.loadTestsFromTestCase(_Test)
+ self.assertIsNotNone(tests)
+ self.assertEqual(tests.countTestCases(), 1)
+
+ result = unittest.TestResult()
+ tests.run(result)
+
+ self.assertEqual(len(result.failures), 1, 'Expecting 1 failure')
+ self.assertEqual(len(result.errors), 0, 'Not expecting errors')
+ self.assertEqual(result.testsRun, 1, 'Expected 1 test run')
+
+ files = glob.glob(os.path.join(self._session_screenshot_path, '*.png'))
+ self.assertEqual(len(files), 1, 'Screenshot not stored in session directory')
+ self.assertIn('tests.interactive.test_interactive_test_base._Test.test_1.001.png', files[0])
+
+ files = glob.glob(os.path.join(self._committed_screenshot_path, '*.png'))
+ self.assertEqual(len(files), 0, 'Screenshot should not have been comitted')
+
+ @mock.patch('tests.interactive.interactive_test_base.interactive', False)
+ @mock.patch('tests.interactive.interactive_test_base.allow_missing_screenshots', True)
+ def test_screenshot_taken_but_not_committed_on_noninteractive_pass(self):
+ class _Test(InteractiveTestCase):
+ def test_1(self):
+ w = window.Window(200, 200)
+ w.switch_to()
+ glClearColor(1, 0, 1, 1)
+ glClear(GL_COLOR_BUFFER_BIT)
+ w.flip()
+
+ self.user_verify('Empty window')
+ w.close()
+
+ self._patch_screenshot_paths()
+
+ tests = unittest.defaultTestLoader.loadTestsFromTestCase(_Test)
+ self.assertIsNotNone(tests)
+ self.assertEqual(tests.countTestCases(), 1)
+
+ result = unittest.TestResult()
+ tests.run(result)
+
+ self.assertEqual(len(result.failures), 0, 'Not expecting failures')
+ self.assertEqual(len(result.errors), 0, 'Not expecting errors')
+ self.assertEqual(result.testsRun, 1, 'Expected 1 test run')
+
+ files = glob.glob(os.path.join(self._session_screenshot_path, '*.png'))
+ self.assertEqual(len(files), 1, 'Screenshot not stored in session directory')
+ self.assertIn('tests.interactive.test_interactive_test_base._Test.test_1.001.png', files[0])
+
+ files = glob.glob(os.path.join(self._committed_screenshot_path, '*.png'))
+ self.assertEqual(len(files), 0, 'Screenshot should not have been comitted')
+
+ @mock.patch('tests.interactive.interactive_test_base.interactive', False)
+ def test_fails_on_missing_screenshot_on_noninteractive_pass(self):
+ class _Test(InteractiveTestCase):
+ def test_1(self):
+ w = window.Window(200, 200)
+ w.switch_to()
+ glClearColor(1, 0, 1, 1)
+ glClear(GL_COLOR_BUFFER_BIT)
+ w.flip()
+
+ self.user_verify('Empty window')
+ w.close()
+
+ self._patch_screenshot_paths()
+
+ tests = unittest.defaultTestLoader.loadTestsFromTestCase(_Test)
+ self.assertIsNotNone(tests)
+ self.assertEqual(tests.countTestCases(), 1)
+
+ result = unittest.TestResult()
+ tests.run(result)
+
+ self.assertEqual(len(result.failures), 1, 'Expecting 1 failure')
+ self.assertEqual(len(result.errors), 0, 'Not expecting errors')
+ self.assertEqual(result.testsRun, 1, 'Expected 1 test run')
+
+ files = glob.glob(os.path.join(self._session_screenshot_path, '*.png'))
+ self.assertEqual(len(files), 1, 'Screenshot not stored in session directory')
+ self.assertIn('tests.interactive.test_interactive_test_base._Test.test_1.001.png', files[0])
+
+ files = glob.glob(os.path.join(self._committed_screenshot_path, '*.png'))
+ self.assertEqual(len(files), 0, 'Screenshot should not have been comitted')
+
+
+ def test_screenshot_taken_but_not_committed_on_user_failure(self):
+ class _Test(InteractiveTestCase):
+ def test_1(self):
+ w = window.Window(200, 200)
+ w.switch_to()
+ glClearColor(1, 0, 1, 1)
+ glClear(GL_COLOR_BUFFER_BIT)
+ w.flip()
+
+ try:
+ self.user_verify('Please select "n" and enter any reason')
+ finally:
+ w.close()
+
+
+ self._patch_screenshot_paths()
+
+ tests = unittest.defaultTestLoader.loadTestsFromTestCase(_Test)
+ self.assertIsNotNone(tests)
+ self.assertEqual(tests.countTestCases(), 1)
+
+ result = unittest.TestResult()
+ tests.run(result)
+
+ self.assertEqual(len(result.failures), 1, 'Expecting 1 failure')
+ self.assertEqual(len(result.errors), 0, 'Not expecting errors')
+ self.assertEqual(result.testsRun, 1, 'Expected 1 test run')
+
+ files = glob.glob(os.path.join(self._session_screenshot_path, '*.png'))
+ self.assertEqual(len(files), 1, 'Screenshot not stored in session directory')
+ self.assertIn('tests.interactive.test_interactive_test_base._Test.test_1.001.png', files[0])
+
+ files = glob.glob(os.path.join(self._committed_screenshot_path, '*.png'))
+ self.assertEqual(len(files), 0, 'Screenshot should not have been committed')
+
+ @mock.patch('tests.interactive.interactive_test_base.interactive', False)
+ def test_screenshot_does_not_match(self):
+ class _Test(InteractiveTestCase):
+ def test_1(self):
+ w = window.Window(200, 200)
+ w.switch_to()
+ glClearColor(0, 0, 1, 1)
+ glClear(GL_COLOR_BUFFER_BIT)
+ w.flip()
+
+ self.user_verify('Empty window')
+ w.close()
+
+ self._patch_screenshot_paths()
+
+ # Copy non matching screenshot
+ screenshot_name = 'tests.interactive.test_interactive_test_base._Test.test_1.001.png'
+ original_screenshot = os.path.join(os.path.dirname(__file__), '..', 'data', 'images', screenshot_name)
+ committed_screenshot = os.path.join(self._committed_screenshot_path, screenshot_name)
+ shutil.copy(original_screenshot, committed_screenshot)
+
+ # Start the test
+ tests = unittest.defaultTestLoader.loadTestsFromTestCase(_Test)
+ self.assertIsNotNone(tests)
+ self.assertEqual(tests.countTestCases(), 1)
+
+ result = unittest.TestResult()
+ tests.run(result)
+
+ self.assertEqual(len(result.failures), 1, 'Expecting 1 failure')
+ self.assertEqual(len(result.errors), 0, 'Not expecting errors')
+ self.assertEqual(result.testsRun, 1, 'Expected 1 test run')
+
+ files = glob.glob(os.path.join(self._session_screenshot_path, '*.png'))
+ self.assertEqual(len(files), 1, 'Screenshot not stored in session directory')
+ self.assertIn('tests.interactive.test_interactive_test_base._Test.test_1.001.png', files[0])
+
+ # Verify committed image not changed
+ original_image = pyglet.image.load(original_screenshot)
+ committed_image = pyglet.image.load(committed_screenshot)
+ self.assert_image_equal(original_image, committed_image, msg='Committed image should not be overwritten')
+
+ @mock.patch('tests.interactive.interactive_test_base.interactive', False)
+ def test_screenshot_matches(self):
+ class _Test(InteractiveTestCase):
+ def test_1(self):
+ w = window.Window(200, 200)
+ w.switch_to()
+ glClearColor(1, 0, 1, 1)
+ glClear(GL_COLOR_BUFFER_BIT)
+ w.flip()
+
+ self.user_verify('Empty window')
+ w.close()
+
+ self._patch_screenshot_paths()
+
+ # Copy matching screenshot
+ screenshot_name = 'tests.interactive.test_interactive_test_base._Test.test_1.001.png'
+ original_screenshot = os.path.join(os.path.dirname(__file__), '..', 'data', 'images', screenshot_name)
+ committed_screenshot = os.path.join(self._committed_screenshot_path, screenshot_name)
+ shutil.copy(original_screenshot, committed_screenshot)
+
+ # Start the test
+ tests = unittest.defaultTestLoader.loadTestsFromTestCase(_Test)
+ self.assertIsNotNone(tests)
+ self.assertEqual(tests.countTestCases(), 1)
+
+ result = unittest.TestResult()
+ tests.run(result)
+
+ self.assertEqual(len(result.failures), 0, 'Not expecting failures')
+ self.assertEqual(len(result.errors), 0, 'Not expecting errors')
+ self.assertEqual(result.testsRun, 1, 'Expected 1 test run')
+
+ files = glob.glob(os.path.join(self._session_screenshot_path, '*.png'))
+ self.assertEqual(len(files), 1, 'Screenshot not stored in session directory')
+ self.assertIn('tests.interactive.test_interactive_test_base._Test.test_1.001.png', files[0])
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/conftest.py b/pyglet-1.3.0/pyglet-1.3.0/tests/conftest.py
new file mode 100644
index 0000000..351d312
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/conftest.py
@@ -0,0 +1,21 @@
+from __future__ import absolute_import
+
+
+def pytest_addoption(parser):
+ """Add the special options for interactive tests."""
+ parser.addoption('--non-interactive',
+ action='store_true',
+ help='[Interactive tests only] Do not use interactive prompts. Skip tests that cannot validate or run without.'
+ )
+ parser.addoption('--sanity',
+ action='store_true',
+ help='[Interactive tests only] Do not use interactive prompts. Only skips tests that cannot finish without user intervention.'
+ )
+
+
+# Import shared fixtures
+from .base.data import test_data
+from .base.event_loop import event_loop
+from .base.interactive import interactive
+from .base.performance import performance
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/fonts/README b/pyglet-1.3.0/pyglet-1.3.0/tests/data/fonts/README
new file mode 100644
index 0000000..8670a71
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/data/fonts/README
@@ -0,0 +1,4 @@
+Action Man font (action_man.ttf and action_man_italic.ttf) from
+http://www.webpagepublicity.com/free-fonts.html
+
+Courier font from debian package xfonts-100dpi_1.0.3_all.deb
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/fonts/action_man.ttf b/pyglet-1.3.0/pyglet-1.3.0/tests/data/fonts/action_man.ttf
new file mode 100644
index 0000000..4663bf9
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/fonts/action_man.ttf differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/fonts/action_man_bold.ttf b/pyglet-1.3.0/pyglet-1.3.0/tests/data/fonts/action_man_bold.ttf
new file mode 100644
index 0000000..fd5ffff
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/fonts/action_man_bold.ttf differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/fonts/action_man_bold_italic.ttf b/pyglet-1.3.0/pyglet-1.3.0/tests/data/fonts/action_man_bold_italic.ttf
new file mode 100644
index 0000000..f061def
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/fonts/action_man_bold_italic.ttf differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/fonts/action_man_italic.ttf b/pyglet-1.3.0/pyglet-1.3.0/tests/data/fonts/action_man_italic.ttf
new file mode 100644
index 0000000..59c964c
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/fonts/action_man_italic.ttf differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/fonts/courR12-ISO8859-1.pcf b/pyglet-1.3.0/pyglet-1.3.0/tests/data/fonts/courR12-ISO8859-1.pcf
new file mode 100644
index 0000000..91ee829
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/fonts/courR12-ISO8859-1.pcf differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/8bpp.gif b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/8bpp.gif
new file mode 100644
index 0000000..a763e25
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/8bpp.gif differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/cursor.png b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/cursor.png
new file mode 100644
index 0000000..ae1b5c9
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/cursor.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/dinosaur.gif b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/dinosaur.gif
new file mode 100644
index 0000000..90210a2
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/dinosaur.gif differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/gdk_close.png b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/gdk_close.png
new file mode 100644
index 0000000..f5b3ed8
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/gdk_close.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/grey_background.png b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/grey_background.png
new file mode 100644
index 0000000..d721cff
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/grey_background.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/icon1.png b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/icon1.png
new file mode 100644
index 0000000..971f7fa
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/icon1.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/icon_size1.png b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/icon_size1.png
new file mode 100644
index 0000000..36a0db6
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/icon_size1.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/icon_size2.png b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/icon_size2.png
new file mode 100644
index 0000000..4d0e175
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/icon_size2.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/icon_size3.png b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/icon_size3.png
new file mode 100644
index 0000000..c13749d
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/icon_size3.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/icon_size4.png b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/icon_size4.png
new file mode 100644
index 0000000..d72d06c
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/icon_size4.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/icon_size5.png b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/icon_size5.png
new file mode 100644
index 0000000..e66c227
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/icon_size5.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/l.png b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/l.png
new file mode 100644
index 0000000..c3abaac
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/l.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/la.png b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/la.png
new file mode 100644
index 0000000..192a906
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/la.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/multitexture.png b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/multitexture.png
new file mode 100644
index 0000000..06ecfae
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/multitexture.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb.png b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb.png
new file mode 100644
index 0000000..62a25ce
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_16bpp.bmp b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_16bpp.bmp
new file mode 100644
index 0000000..9481169
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_16bpp.bmp differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_1bpp.bmp b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_1bpp.bmp
new file mode 100644
index 0000000..43fa4b4
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_1bpp.bmp differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_24bpp.bmp b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_24bpp.bmp
new file mode 100644
index 0000000..dd50fd7
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_24bpp.bmp differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_32bpp.bmp b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_32bpp.bmp
new file mode 100644
index 0000000..2f67629
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_32bpp.bmp differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_4bpp.bmp b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_4bpp.bmp
new file mode 100644
index 0000000..62627c9
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_4bpp.bmp differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_8bpp.bmp b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_8bpp.bmp
new file mode 100644
index 0000000..1f09081
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_8bpp.bmp differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_8bpp.png b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_8bpp.png
new file mode 100644
index 0000000..926faf6
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_8bpp.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_8bpp_trans.png b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_8bpp_trans.png
new file mode 100644
index 0000000..ff3d2f0
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_8bpp_trans.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_dxt1.dds b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_dxt1.dds
new file mode 100644
index 0000000..7587767
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgb_dxt1.dds differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgba.png b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgba.png
new file mode 100644
index 0000000..8dd50a2
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgba.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgba_32bpp.bmp b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgba_32bpp.bmp
new file mode 100644
index 0000000..06fddfe
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgba_32bpp.bmp differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgba_dxt1.dds b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgba_dxt1.dds
new file mode 100644
index 0000000..2122907
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgba_dxt1.dds differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgba_dxt3.dds b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgba_dxt3.dds
new file mode 100644
index 0000000..3630ddc
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgba_dxt3.dds differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgba_dxt5.dds b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgba_dxt5.dds
new file mode 100644
index 0000000..df11a37
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/rgba_dxt5.dds differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/tests.interactive.test_interactive_test_base._Test.test_1.001.png b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/tests.interactive.test_interactive_test_base._Test.test_1.001.png
new file mode 100644
index 0000000..beeaa2b
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/images/tests.interactive.test_interactive_test_base._Test.test_1.001.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/README b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/README
new file mode 100644
index 0000000..4f72c5b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/README
@@ -0,0 +1 @@
+The .wav files have been retrieved from libpurple.
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/alert.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/alert.wav
new file mode 100644
index 0000000..e456f4a
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/alert.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/alert_pcm_16_11025_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/alert_pcm_16_11025_1ch.wav
new file mode 100644
index 0000000..05650d5
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/alert_pcm_16_11025_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/alert_pcm_16_22050_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/alert_pcm_16_22050_1ch.wav
new file mode 100644
index 0000000..e456f4a
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/alert_pcm_16_22050_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/alert_pcm_8_22050_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/alert_pcm_8_22050_1ch.wav
new file mode 100644
index 0000000..d69e296
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/alert_pcm_8_22050_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/login.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/login.wav
new file mode 100644
index 0000000..ec06433
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/login.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/logout.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/logout.wav
new file mode 100644
index 0000000..69af246
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/logout.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_digitar_16_11025_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_digitar_16_11025_1ch.wav
new file mode 100644
index 0000000..51ef3bd
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_digitar_16_11025_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_digitar_16_44800_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_digitar_16_44800_1ch.wav
new file mode 100644
index 0000000..959db81
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_digitar_16_44800_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_digitar_8_44800_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_digitar_8_44800_1ch.wav
new file mode 100644
index 0000000..f25b188
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_digitar_8_44800_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_fm_16_11025_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_fm_16_11025_1ch.wav
new file mode 100644
index 0000000..ac25d8f
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_fm_16_11025_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_fm_16_44800_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_fm_16_44800_1ch.wav
new file mode 100644
index 0000000..451f1fe
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_fm_16_44800_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_fm_8_44800_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_fm_8_44800_1ch.wav
new file mode 100644
index 0000000..43ce00d
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_fm_8_44800_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_sawtooth_16_11025_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_sawtooth_16_11025_1ch.wav
new file mode 100644
index 0000000..d33451f
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_sawtooth_16_11025_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_sawtooth_16_44800_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_sawtooth_16_44800_1ch.wav
new file mode 100644
index 0000000..e22d5b4
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_sawtooth_16_44800_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_sawtooth_8_44800_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_sawtooth_8_44800_1ch.wav
new file mode 100644
index 0000000..d11ddbe
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_sawtooth_8_44800_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_silence_16_11025_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_silence_16_11025_1ch.wav
new file mode 100644
index 0000000..2e7f23c
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_silence_16_11025_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_silence_16_44800_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_silence_16_44800_1ch.wav
new file mode 100644
index 0000000..d9a376d
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_silence_16_44800_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_silence_8_44800_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_silence_8_44800_1ch.wav
new file mode 100644
index 0000000..4c144f0
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_silence_8_44800_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_sine_16_11025_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_sine_16_11025_1ch.wav
new file mode 100644
index 0000000..e2b566c
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_sine_16_11025_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_sine_16_44800_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_sine_16_44800_1ch.wav
new file mode 100644
index 0000000..24ea069
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_sine_16_44800_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_sine_8_44800_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_sine_8_44800_1ch.wav
new file mode 100644
index 0000000..ab0e1ef
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_sine_8_44800_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_square_16_11025_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_square_16_11025_1ch.wav
new file mode 100644
index 0000000..5edfc02
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_square_16_11025_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_square_16_44800_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_square_16_44800_1ch.wav
new file mode 100644
index 0000000..d28d86b
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_square_16_44800_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_square_8_44800_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_square_8_44800_1ch.wav
new file mode 100644
index 0000000..7a9a21a
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_square_8_44800_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_triangle_16_11025_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_triangle_16_11025_1ch.wav
new file mode 100644
index 0000000..1f41e77
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_triangle_16_11025_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_triangle_16_44800_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_triangle_16_44800_1ch.wav
new file mode 100644
index 0000000..2b36a19
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_triangle_16_44800_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_triangle_8_44800_1ch.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_triangle_8_44800_1ch.wav
new file mode 100644
index 0000000..19702ae
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/procedural_triangle_8_44800_1ch.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/receive.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/receive.wav
new file mode 100644
index 0000000..dce135e
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/receive.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/send.wav b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/send.wav
new file mode 100644
index 0000000..c77beb7
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/data/media/send.wav differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/_dummy_thread/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/_dummy_thread/__init__.py
new file mode 100644
index 0000000..63dced6
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/_dummy_thread/__init__.py
@@ -0,0 +1,10 @@
+from __future__ import absolute_import
+import sys
+__future_module__ = True
+
+if sys.version_info[0] < 3:
+ from dummy_thread import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/_markupbase/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/_markupbase/__init__.py
new file mode 100644
index 0000000..2909065
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/_markupbase/__init__.py
@@ -0,0 +1,10 @@
+from __future__ import absolute_import
+import sys
+__future_module__ = True
+
+if sys.version_info[0] < 3:
+ from markupbase import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/_thread/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/_thread/__init__.py
new file mode 100644
index 0000000..9f2a51c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/_thread/__init__.py
@@ -0,0 +1,10 @@
+from __future__ import absolute_import
+import sys
+__future_module__ = True
+
+if sys.version_info[0] < 3:
+ from thread import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/builtins/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/builtins/__init__.py
new file mode 100644
index 0000000..4f936f2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/builtins/__init__.py
@@ -0,0 +1,12 @@
+from __future__ import absolute_import
+import sys
+__future_module__ = True
+
+if sys.version_info[0] < 3:
+ from __builtin__ import *
+ # Overwrite any old definitions with the equivalent future.builtins ones:
+ from future.builtins import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/configparser/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/configparser/__init__.py
new file mode 100644
index 0000000..3642c5e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/configparser/__init__.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+import sys
+
+if sys.version_info[0] < 3:
+ from ConfigParser import *
+ try:
+ from ConfigParser import (_Chainmap, Error, InterpolationMissingOptionError)
+ except ImportError:
+ pass
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/copyreg/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/copyreg/__init__.py
new file mode 100644
index 0000000..51bd4b9
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/copyreg/__init__.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+import sys
+
+if sys.version_info[0] < 3:
+ from copy_reg import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/html/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/html/__init__.py
new file mode 100644
index 0000000..e957e74
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/html/__init__.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+import sys
+
+if sys.version_info[0] < 3:
+ from future.moves.html import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/html/entities.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/html/entities.py
new file mode 100644
index 0000000..211649e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/html/entities.py
@@ -0,0 +1,7 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from html.entities import *
+else:
+ from future.moves.html.entities import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/html/parser.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/html/parser.py
new file mode 100644
index 0000000..541def3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/html/parser.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+import sys
+__future_module__ = True
+
+if sys.version_info[0] == 3:
+ raise ImportError('Cannot import module from python-future source folder')
+else:
+ from future.moves.html.parser import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/http/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/http/__init__.py
new file mode 100644
index 0000000..e4f853e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/http/__init__.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+import sys
+
+if sys.version_info[0] < 3:
+ pass
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/http/client.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/http/client.py
new file mode 100644
index 0000000..429cac4
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/http/client.py
@@ -0,0 +1,6 @@
+from __future__ import absolute_import
+import sys
+
+assert sys.version_info[0] < 3
+
+from httplib import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/http/cookiejar.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/http/cookiejar.py
new file mode 100644
index 0000000..d847b2b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/http/cookiejar.py
@@ -0,0 +1,6 @@
+from __future__ import absolute_import
+import sys
+
+assert sys.version_info[0] < 3
+
+from cookielib import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/http/cookies.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/http/cookies.py
new file mode 100644
index 0000000..eb2a823
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/http/cookies.py
@@ -0,0 +1,7 @@
+from __future__ import absolute_import
+import sys
+
+assert sys.version_info[0] < 3
+
+from Cookie import *
+from Cookie import Morsel # left out of __all__ on Py2.7!
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/http/server.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/http/server.py
new file mode 100644
index 0000000..2971055
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/http/server.py
@@ -0,0 +1,18 @@
+from __future__ import absolute_import
+import sys
+
+assert sys.version_info[0] < 3
+
+from BaseHTTPServer import *
+from CGIHTTPServer import *
+from SimpleHTTPServer import *
+try:
+ from CGIHTTPServer import _url_collapse_path # needed for a test
+except ImportError:
+ try:
+ # Python 2.7.0 to 2.7.3
+ from CGIHTTPServer import (
+ _url_collapse_path_split as _url_collapse_path)
+ except ImportError:
+ # Doesn't exist on Python 2.6.x. Ignore it.
+ pass
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/queue/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/queue/__init__.py
new file mode 100644
index 0000000..22bd296
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/queue/__init__.py
@@ -0,0 +1,10 @@
+from __future__ import absolute_import
+import sys
+__future_module__ = True
+
+if sys.version_info[0] < 3:
+ from Queue import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/reprlib/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/reprlib/__init__.py
new file mode 100644
index 0000000..6ccf9c0
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/reprlib/__init__.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+import sys
+
+if sys.version_info[0] < 3:
+ from repr import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/socketserver/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/socketserver/__init__.py
new file mode 100644
index 0000000..c5b8c9c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/socketserver/__init__.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+import sys
+
+if sys.version_info[0] < 3:
+ from SocketServer import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/__init__.py
new file mode 100644
index 0000000..cff06c0
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/__init__.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+import sys
+
+if sys.version_info[0] < 3:
+ from Tkinter import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/colorchooser.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/colorchooser.py
new file mode 100644
index 0000000..5e7c97f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/colorchooser.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.colorchooser import *
+else:
+ try:
+ from tkColorChooser import *
+ except ImportError:
+ raise ImportError('The tkColorChooser module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/commondialog.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/commondialog.py
new file mode 100644
index 0000000..7747a0b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/commondialog.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.commondialog import *
+else:
+ try:
+ from tkCommonDialog import *
+ except ImportError:
+ raise ImportError('The tkCommonDialog module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/constants.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/constants.py
new file mode 100644
index 0000000..99216f3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/constants.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.constants import *
+else:
+ try:
+ from Tkconstants import *
+ except ImportError:
+ raise ImportError('The Tkconstants module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/dialog.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/dialog.py
new file mode 100644
index 0000000..a5b7778
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/dialog.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.dialog import *
+else:
+ try:
+ from Dialog import *
+ except ImportError:
+ raise ImportError('The Dialog module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/dnd.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/dnd.py
new file mode 100644
index 0000000..748b111
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/dnd.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.dnd import *
+else:
+ try:
+ from Tkdnd import *
+ except ImportError:
+ raise ImportError('The Tkdnd module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/filedialog.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/filedialog.py
new file mode 100644
index 0000000..35e21ac
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/filedialog.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.filedialog import *
+else:
+ try:
+ from FileDialog import *
+ except ImportError:
+ raise ImportError('The FileDialog module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/font.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/font.py
new file mode 100644
index 0000000..63d86dc
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/font.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.font import *
+else:
+ try:
+ from tkFont import *
+ except ImportError:
+ raise ImportError('The tkFont module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/messagebox.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/messagebox.py
new file mode 100644
index 0000000..3ed52e1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/messagebox.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.messagebox import *
+else:
+ try:
+ from tkMessageBox import *
+ except ImportError:
+ raise ImportError('The tkMessageBox module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/scrolledtext.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/scrolledtext.py
new file mode 100644
index 0000000..13bd660
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/scrolledtext.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.scrolledtext import *
+else:
+ try:
+ from ScrolledText import *
+ except ImportError:
+ raise ImportError('The ScrolledText module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/simpledialog.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/simpledialog.py
new file mode 100644
index 0000000..e952fa9
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/simpledialog.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.simpledialog import *
+else:
+ try:
+ from SimpleDialog import *
+ except ImportError:
+ raise ImportError('The SimpleDialog module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/tix.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/tix.py
new file mode 100644
index 0000000..019df6f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/tkinter/tix.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.tix import *
+else:
+ try:
+ from Tix import *
+ except ImportError:
+ raise ImportError('The Tix module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/winreg/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/winreg/__init__.py
new file mode 100644
index 0000000..97243bb
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/winreg/__init__.py
@@ -0,0 +1,10 @@
+from __future__ import absolute_import
+import sys
+__future_module__ = True
+
+if sys.version_info[0] < 3:
+ from _winreg import *
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/xmlrpc/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/xmlrpc/__init__.py
new file mode 100644
index 0000000..e4f853e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/xmlrpc/__init__.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+import sys
+
+if sys.version_info[0] < 3:
+ pass
+else:
+ raise ImportError('This package should not be accessible on Python 3. '
+ 'Either you are trying to run from the python-future src folder '
+ 'or your installation of python-future is corrupted.')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/xmlrpc/client.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/xmlrpc/client.py
new file mode 100644
index 0000000..a8d0827
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/xmlrpc/client.py
@@ -0,0 +1,5 @@
+from __future__ import absolute_import
+import sys
+
+assert sys.version_info[0] < 3
+from xmlrpclib import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/xmlrpc/server.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/xmlrpc/server.py
new file mode 100644
index 0000000..a8d0827
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2/xmlrpc/server.py
@@ -0,0 +1,5 @@
+from __future__ import absolute_import
+import sys
+
+assert sys.version_info[0] < 3
+from xmlrpclib import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/__init__.py
new file mode 100644
index 0000000..a93381f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/__init__.py
@@ -0,0 +1,94 @@
+"""
+future: Easy, safe support for Python 2/3 compatibility
+=======================================================
+
+``future`` is the missing compatibility layer between Python 2 and Python
+3. It allows you to use a single, clean Python 3.x-compatible codebase to
+support both Python 2 and Python 3 with minimal overhead.
+
+It is designed to be used as follows::
+
+ from __future__ import (absolute_import, division,
+ print_function, unicode_literals)
+ from builtins import (
+ bytes, dict, int, list, object, range, str,
+ ascii, chr, hex, input, next, oct, open,
+ pow, round, super,
+ filter, map, zip)
+
+followed by predominantly standard, idiomatic Python 3 code that then runs
+similarly on Python 2.6/2.7 and Python 3.3+.
+
+The imports have no effect on Python 3. On Python 2, they shadow the
+corresponding builtins, which normally have different semantics on Python 3
+versus 2, to provide their Python 3 semantics.
+
+
+Standard library reorganization
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+``future`` supports the standard library reorganization (PEP 3108) through the
+following Py3 interfaces:
+
+ >>> # Top-level packages with Py3 names provided on Py2:
+ >>> import configparser
+ >>> import html.parser
+ >>> import queue
+ >>> import tkinter.dialog
+ >>> import xmlrpc.client
+ >>> # etc.
+
+ >>> # Aliases provided for extensions to existing Py2 module names:
+ >>> from future.standard_library import install_aliases
+ >>> install_aliases()
+
+ >>> from collections import Counter, OrderedDict # backported to Py2.6
+ >>> from collections import UserDict, UserList, UserString
+ >>> import urllib.request
+ >>> from itertools import filterfalse, zip_longest
+ >>> from subprocess import getoutput, getstatusoutput
+
+
+Automatic conversion
+--------------------
+
+An included script called `futurize
+`_ aids in converting
+code (from either Python 2 or Python 3) to code compatible with both
+platforms. It is similar to ``python-modernize`` but goes further in
+providing Python 3 compatibility through the use of the backported types
+and builtin functions in ``future``.
+
+
+Documentation
+-------------
+
+See: http://python-future.org
+
+
+Credits
+-------
+
+:Author: Ed Schofield
+:Sponsor: Python Charmers Pty Ltd, Australia, and Python Charmers Pte
+ Ltd, Singapore. http://pythoncharmers.com
+:Others: See docs/credits.rst or http://python-future.org/credits.html
+
+
+Licensing
+---------
+Copyright 2013-2015 Python Charmers Pty Ltd, Australia.
+The software is distributed under an MIT licence. See LICENSE.txt.
+
+"""
+
+__title__ = 'future'
+__author__ = 'Ed Schofield'
+__license__ = 'MIT'
+__copyright__ = 'Copyright 2013-2015 Python Charmers Pty Ltd'
+__ver_major__ = 0
+__ver_minor__ = 14
+__ver_patch__ = 3
+__ver_sub__ = ''
+__version__ = "%d.%d.%d%s" % (__ver_major__, __ver_minor__,
+ __ver_patch__, __ver_sub__)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/__init__.py
new file mode 100644
index 0000000..d68c0f4
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/__init__.py
@@ -0,0 +1,8 @@
+# future.backports package
+from __future__ import absolute_import
+import sys
+__future_module__ = True
+from future.standard_library import import_top_level_modules
+
+if sys.version_info[0] == 3:
+ import_top_level_modules()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/_markupbase.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/_markupbase.py
new file mode 100644
index 0000000..d51bfc7
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/_markupbase.py
@@ -0,0 +1,422 @@
+"""Shared support for scanning document type declarations in HTML and XHTML.
+
+Backported for python-future from Python 3.3. Reason: ParserBase is an
+old-style class in the Python 2.7 source of markupbase.py, which I suspect
+might be the cause of sporadic unit-test failures on travis-ci.org with
+test_htmlparser.py. The test failures look like this:
+
+ ======================================================================
+
+ERROR: test_attr_entity_replacement (future.tests.test_htmlparser.AttributesStrictTestCase)
+
+----------------------------------------------------------------------
+
+Traceback (most recent call last):
+ File "/home/travis/build/edschofield/python-future/future/tests/test_htmlparser.py", line 661, in test_attr_entity_replacement
+ [("starttag", "a", [("b", "&><\"'")])])
+ File "/home/travis/build/edschofield/python-future/future/tests/test_htmlparser.py", line 93, in _run_check
+ collector = self.get_collector()
+ File "/home/travis/build/edschofield/python-future/future/tests/test_htmlparser.py", line 617, in get_collector
+ return EventCollector(strict=True)
+ File "/home/travis/build/edschofield/python-future/future/tests/test_htmlparser.py", line 27, in __init__
+ html.parser.HTMLParser.__init__(self, *args, **kw)
+ File "/home/travis/build/edschofield/python-future/future/backports/html/parser.py", line 135, in __init__
+ self.reset()
+ File "/home/travis/build/edschofield/python-future/future/backports/html/parser.py", line 143, in reset
+ _markupbase.ParserBase.reset(self)
+
+TypeError: unbound method reset() must be called with ParserBase instance as first argument (got EventCollector instance instead)
+
+This module is used as a foundation for the html.parser module. It has no
+documented public API and should not be used directly.
+
+"""
+
+import re
+
+_declname_match = re.compile(r'[a-zA-Z][-_.a-zA-Z0-9]*\s*').match
+_declstringlit_match = re.compile(r'(\'[^\']*\'|"[^"]*")\s*').match
+_commentclose = re.compile(r'--\s*>')
+_markedsectionclose = re.compile(r']\s*]\s*>')
+
+# An analysis of the MS-Word extensions is available at
+# http://www.planetpublish.com/xmlarena/xap/Thursday/WordtoXML.pdf
+
+_msmarkedsectionclose = re.compile(r']\s*>')
+
+del re
+
+
+class ParserBase(object):
+ """Parser base class which provides some common support methods used
+ by the SGML/HTML and XHTML parsers."""
+
+ def __init__(self):
+ if self.__class__ is ParserBase:
+ raise RuntimeError(
+ "_markupbase.ParserBase must be subclassed")
+
+ def error(self, message):
+ raise NotImplementedError(
+ "subclasses of ParserBase must override error()")
+
+ def reset(self):
+ self.lineno = 1
+ self.offset = 0
+
+ def getpos(self):
+ """Return current line number and offset."""
+ return self.lineno, self.offset
+
+ # Internal -- update line number and offset. This should be
+ # called for each piece of data exactly once, in order -- in other
+ # words the concatenation of all the input strings to this
+ # function should be exactly the entire input.
+ def updatepos(self, i, j):
+ if i >= j:
+ return j
+ rawdata = self.rawdata
+ nlines = rawdata.count("\n", i, j)
+ if nlines:
+ self.lineno = self.lineno + nlines
+ pos = rawdata.rindex("\n", i, j) # Should not fail
+ self.offset = j-(pos+1)
+ else:
+ self.offset = self.offset + j-i
+ return j
+
+ _decl_otherchars = ''
+
+ # Internal -- parse declaration (for use by subclasses).
+ def parse_declaration(self, i):
+ # This is some sort of declaration; in "HTML as
+ # deployed," this should only be the document type
+ # declaration ("").
+ # ISO 8879:1986, however, has more complex
+ # declaration syntax for elements in , including:
+ # --comment--
+ # [marked section]
+ # name in the following list: ENTITY, DOCTYPE, ELEMENT,
+ # ATTLIST, NOTATION, SHORTREF, USEMAP,
+ # LINKTYPE, LINK, IDLINK, USELINK, SYSTEM
+ rawdata = self.rawdata
+ j = i + 2
+ assert rawdata[i:j] == "":
+ # the empty comment
+ return j + 1
+ if rawdata[j:j+1] in ("-", ""):
+ # Start of comment followed by buffer boundary,
+ # or just a buffer boundary.
+ return -1
+ # A simple, practical version could look like: ((name|stringlit) S*) + '>'
+ n = len(rawdata)
+ if rawdata[j:j+2] == '--': #comment
+ # Locate --.*-- as the body of the comment
+ return self.parse_comment(i)
+ elif rawdata[j] == '[': #marked section
+ # Locate [statusWord [...arbitrary SGML...]] as the body of the marked section
+ # Where statusWord is one of TEMP, CDATA, IGNORE, INCLUDE, RCDATA
+ # Note that this is extended by Microsoft Office "Save as Web" function
+ # to include [if...] and [endif].
+ return self.parse_marked_section(i)
+ else: #all other declaration elements
+ decltype, j = self._scan_name(j, i)
+ if j < 0:
+ return j
+ if decltype == "doctype":
+ self._decl_otherchars = ''
+ while j < n:
+ c = rawdata[j]
+ if c == ">":
+ # end of declaration syntax
+ data = rawdata[i+2:j]
+ if decltype == "doctype":
+ self.handle_decl(data)
+ else:
+ # According to the HTML5 specs sections "8.2.4.44 Bogus
+ # comment state" and "8.2.4.45 Markup declaration open
+ # state", a comment token should be emitted.
+ # Calling unknown_decl provides more flexibility though.
+ self.unknown_decl(data)
+ return j + 1
+ if c in "\"'":
+ m = _declstringlit_match(rawdata, j)
+ if not m:
+ return -1 # incomplete
+ j = m.end()
+ elif c in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ":
+ name, j = self._scan_name(j, i)
+ elif c in self._decl_otherchars:
+ j = j + 1
+ elif c == "[":
+ # this could be handled in a separate doctype parser
+ if decltype == "doctype":
+ j = self._parse_doctype_subset(j + 1, i)
+ elif decltype in set(["attlist", "linktype", "link", "element"]):
+ # must tolerate []'d groups in a content model in an element declaration
+ # also in data attribute specifications of attlist declaration
+ # also link type declaration subsets in linktype declarations
+ # also link attribute specification lists in link declarations
+ self.error("unsupported '[' char in %s declaration" % decltype)
+ else:
+ self.error("unexpected '[' char in declaration")
+ else:
+ self.error(
+ "unexpected %r char in declaration" % rawdata[j])
+ if j < 0:
+ return j
+ return -1 # incomplete
+
+ # Internal -- parse a marked section
+ # Override this to handle MS-word extension syntax content
+ def parse_marked_section(self, i, report=1):
+ rawdata= self.rawdata
+ assert rawdata[i:i+3] == ' ending
+ match= _markedsectionclose.search(rawdata, i+3)
+ elif sectName in set(["if", "else", "endif"]):
+ # look for MS Office ]> ending
+ match= _msmarkedsectionclose.search(rawdata, i+3)
+ else:
+ self.error('unknown status keyword %r in marked section' % rawdata[i+3:j])
+ if not match:
+ return -1
+ if report:
+ j = match.start(0)
+ self.unknown_decl(rawdata[i+3: j])
+ return match.end(0)
+
+ # Internal -- parse comment, return length or -1 if not terminated
+ def parse_comment(self, i, report=1):
+ rawdata = self.rawdata
+ if rawdata[i:i+4] != ' delimiter transport-padding
+ # --> CRLF body-part
+ for body_part in msgtexts:
+ # delimiter transport-padding CRLF
+ self.write(self._NL + '--' + boundary + self._NL)
+ # body-part
+ self._fp.write(body_part)
+ # close-delimiter transport-padding
+ self.write(self._NL + '--' + boundary + '--')
+ if msg.epilogue is not None:
+ self.write(self._NL)
+ if self._mangle_from_:
+ epilogue = fcre.sub('>From ', msg.epilogue)
+ else:
+ epilogue = msg.epilogue
+ self._write_lines(epilogue)
+
+ def _handle_multipart_signed(self, msg):
+ # The contents of signed parts has to stay unmodified in order to keep
+ # the signature intact per RFC1847 2.1, so we disable header wrapping.
+ # RDM: This isn't enough to completely preserve the part, but it helps.
+ p = self.policy
+ self.policy = p.clone(max_line_length=0)
+ try:
+ self._handle_multipart(msg)
+ finally:
+ self.policy = p
+
+ def _handle_message_delivery_status(self, msg):
+ # We can't just write the headers directly to self's file object
+ # because this will leave an extra newline between the last header
+ # block and the boundary. Sigh.
+ blocks = []
+ for part in msg.get_payload():
+ s = self._new_buffer()
+ g = self.clone(s)
+ g.flatten(part, unixfrom=False, linesep=self._NL)
+ text = s.getvalue()
+ lines = text.split(self._encoded_NL)
+ # Strip off the unnecessary trailing empty line
+ if lines and lines[-1] == self._encoded_EMPTY:
+ blocks.append(self._encoded_NL.join(lines[:-1]))
+ else:
+ blocks.append(text)
+ # Now join all the blocks with an empty line. This has the lovely
+ # effect of separating each block with an empty line, but not adding
+ # an extra one after the last one.
+ self._fp.write(self._encoded_NL.join(blocks))
+
+ def _handle_message(self, msg):
+ s = self._new_buffer()
+ g = self.clone(s)
+ # The payload of a message/rfc822 part should be a multipart sequence
+ # of length 1. The zeroth element of the list should be the Message
+ # object for the subpart. Extract that object, stringify it, and
+ # write it out.
+ # Except, it turns out, when it's a string instead, which happens when
+ # and only when HeaderParser is used on a message of mime type
+ # message/rfc822. Such messages are generated by, for example,
+ # Groupwise when forwarding unadorned messages. (Issue 7970.) So
+ # in that case we just emit the string body.
+ payload = msg._payload
+ if isinstance(payload, list):
+ g.flatten(msg.get_payload(0), unixfrom=False, linesep=self._NL)
+ payload = s.getvalue()
+ else:
+ payload = self._encode(payload)
+ self._fp.write(payload)
+
+ # This used to be a module level function; we use a classmethod for this
+ # and _compile_re so we can continue to provide the module level function
+ # for backward compatibility by doing
+ # _make_boudary = Generator._make_boundary
+ # at the end of the module. It *is* internal, so we could drop that...
+ @classmethod
+ def _make_boundary(cls, text=None):
+ # Craft a random boundary. If text is given, ensure that the chosen
+ # boundary doesn't appear in the text.
+ token = random.randrange(sys.maxsize)
+ boundary = ('=' * 15) + (_fmt % token) + '=='
+ if text is None:
+ return boundary
+ b = boundary
+ counter = 0
+ while True:
+ cre = cls._compile_re('^--' + re.escape(b) + '(--)?$', re.MULTILINE)
+ if not cre.search(text):
+ break
+ b = boundary + '.' + str(counter)
+ counter += 1
+ return b
+
+ @classmethod
+ def _compile_re(cls, s, flags):
+ return re.compile(s, flags)
+
+class BytesGenerator(Generator):
+ """Generates a bytes version of a Message object tree.
+
+ Functionally identical to the base Generator except that the output is
+ bytes and not string. When surrogates were used in the input to encode
+ bytes, these are decoded back to bytes for output. If the policy has
+ cte_type set to 7bit, then the message is transformed such that the
+ non-ASCII bytes are properly content transfer encoded, using the charset
+ unknown-8bit.
+
+ The outfp object must accept bytes in its write method.
+ """
+
+ # Bytes versions of this constant for use in manipulating data from
+ # the BytesIO buffer.
+ _encoded_EMPTY = b''
+
+ def write(self, s):
+ self._fp.write(str(s).encode('ascii', 'surrogateescape'))
+
+ def _new_buffer(self):
+ return BytesIO()
+
+ def _encode(self, s):
+ return s.encode('ascii')
+
+ def _write_headers(self, msg):
+ # This is almost the same as the string version, except for handling
+ # strings with 8bit bytes.
+ for h, v in msg.raw_items():
+ self._fp.write(self.policy.fold_binary(h, v))
+ # A blank line always separates headers from body
+ self.write(self._NL)
+
+ def _handle_text(self, msg):
+ # If the string has surrogates the original source was bytes, so
+ # just write it back out.
+ if msg._payload is None:
+ return
+ if _has_surrogates(msg._payload) and not self.policy.cte_type=='7bit':
+ if self._mangle_from_:
+ msg._payload = fcre.sub(">From ", msg._payload)
+ self._write_lines(msg._payload)
+ else:
+ super(BytesGenerator,self)._handle_text(msg)
+
+ # Default body handler
+ _writeBody = _handle_text
+
+ @classmethod
+ def _compile_re(cls, s, flags):
+ return re.compile(s.encode('ascii'), flags)
+
+
+_FMT = '[Non-text (%(type)s) part of message omitted, filename %(filename)s]'
+
+class DecodedGenerator(Generator):
+ """Generates a text representation of a message.
+
+ Like the Generator base class, except that non-text parts are substituted
+ with a format string representing the part.
+ """
+ def __init__(self, outfp, mangle_from_=True, maxheaderlen=78, fmt=None):
+ """Like Generator.__init__() except that an additional optional
+ argument is allowed.
+
+ Walks through all subparts of a message. If the subpart is of main
+ type `text', then it prints the decoded payload of the subpart.
+
+ Otherwise, fmt is a format string that is used instead of the message
+ payload. fmt is expanded with the following keywords (in
+ %(keyword)s format):
+
+ type : Full MIME type of the non-text part
+ maintype : Main MIME type of the non-text part
+ subtype : Sub-MIME type of the non-text part
+ filename : Filename of the non-text part
+ description: Description associated with the non-text part
+ encoding : Content transfer encoding of the non-text part
+
+ The default value for fmt is None, meaning
+
+ [Non-text (%(type)s) part of message omitted, filename %(filename)s]
+ """
+ Generator.__init__(self, outfp, mangle_from_, maxheaderlen)
+ if fmt is None:
+ self._fmt = _FMT
+ else:
+ self._fmt = fmt
+
+ def _dispatch(self, msg):
+ for part in msg.walk():
+ maintype = part.get_content_maintype()
+ if maintype == 'text':
+ print(part.get_payload(decode=False), file=self)
+ elif maintype == 'multipart':
+ # Just skip this
+ pass
+ else:
+ print(self._fmt % {
+ 'type' : part.get_content_type(),
+ 'maintype' : part.get_content_maintype(),
+ 'subtype' : part.get_content_subtype(),
+ 'filename' : part.get_filename('[no filename]'),
+ 'description': part.get('Content-Description',
+ '[no description]'),
+ 'encoding' : part.get('Content-Transfer-Encoding',
+ '[no encoding]'),
+ }, file=self)
+
+
+# Helper used by Generator._make_boundary
+_width = len(repr(sys.maxsize-1))
+_fmt = '%%0%dd' % _width
+
+# Backward compatibility
+_make_boundary = Generator._make_boundary
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/header.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/header.py
new file mode 100644
index 0000000..63bf038
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/header.py
@@ -0,0 +1,581 @@
+# Copyright (C) 2002-2007 Python Software Foundation
+# Author: Ben Gertzfield, Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Header encoding and decoding functionality."""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+from future.builtins import bytes, range, str, super, zip
+
+__all__ = [
+ 'Header',
+ 'decode_header',
+ 'make_header',
+ ]
+
+import re
+import binascii
+
+from future.backports import email
+from future.backports.email import base64mime
+from future.backports.email.errors import HeaderParseError
+import future.backports.email.charset as _charset
+
+# Helpers
+from future.backports.email.quoprimime import _max_append, header_decode
+
+Charset = _charset.Charset
+
+NL = '\n'
+SPACE = ' '
+BSPACE = b' '
+SPACE8 = ' ' * 8
+EMPTYSTRING = ''
+MAXLINELEN = 78
+FWS = ' \t'
+
+USASCII = Charset('us-ascii')
+UTF8 = Charset('utf-8')
+
+# Match encoded-word strings in the form =?charset?q?Hello_World?=
+ecre = re.compile(r'''
+ =\? # literal =?
+ (?P[^?]*?) # non-greedy up to the next ? is the charset
+ \? # literal ?
+ (?P[qb]) # either a "q" or a "b", case insensitive
+ \? # literal ?
+ (?P.*?) # non-greedy up to the next ?= is the encoded string
+ \?= # literal ?=
+ ''', re.VERBOSE | re.IGNORECASE | re.MULTILINE)
+
+# Field name regexp, including trailing colon, but not separating whitespace,
+# according to RFC 2822. Character range is from tilde to exclamation mark.
+# For use with .match()
+fcre = re.compile(r'[\041-\176]+:$')
+
+# Find a header embedded in a putative header value. Used to check for
+# header injection attack.
+_embeded_header = re.compile(r'\n[^ \t]+:')
+
+
+def decode_header(header):
+ """Decode a message header value without converting charset.
+
+ Returns a list of (string, charset) pairs containing each of the decoded
+ parts of the header. Charset is None for non-encoded parts of the header,
+ otherwise a lower-case string containing the name of the character set
+ specified in the encoded string.
+
+ header may be a string that may or may not contain RFC2047 encoded words,
+ or it may be a Header object.
+
+ An email.errors.HeaderParseError may be raised when certain decoding error
+ occurs (e.g. a base64 decoding exception).
+ """
+ # If it is a Header object, we can just return the encoded chunks.
+ if hasattr(header, '_chunks'):
+ return [(_charset._encode(string, str(charset)), str(charset))
+ for string, charset in header._chunks]
+ # If no encoding, just return the header with no charset.
+ if not ecre.search(header):
+ return [(header, None)]
+ # First step is to parse all the encoded parts into triplets of the form
+ # (encoded_string, encoding, charset). For unencoded strings, the last
+ # two parts will be None.
+ words = []
+ for line in header.splitlines():
+ parts = ecre.split(line)
+ first = True
+ while parts:
+ unencoded = parts.pop(0)
+ if first:
+ unencoded = unencoded.lstrip()
+ first = False
+ if unencoded:
+ words.append((unencoded, None, None))
+ if parts:
+ charset = parts.pop(0).lower()
+ encoding = parts.pop(0).lower()
+ encoded = parts.pop(0)
+ words.append((encoded, encoding, charset))
+ # Now loop over words and remove words that consist of whitespace
+ # between two encoded strings.
+ import sys
+ droplist = []
+ for n, w in enumerate(words):
+ if n>1 and w[1] and words[n-2][1] and words[n-1][0].isspace():
+ droplist.append(n-1)
+ for d in reversed(droplist):
+ del words[d]
+
+ # The next step is to decode each encoded word by applying the reverse
+ # base64 or quopri transformation. decoded_words is now a list of the
+ # form (decoded_word, charset).
+ decoded_words = []
+ for encoded_string, encoding, charset in words:
+ if encoding is None:
+ # This is an unencoded word.
+ decoded_words.append((encoded_string, charset))
+ elif encoding == 'q':
+ word = header_decode(encoded_string)
+ decoded_words.append((word, charset))
+ elif encoding == 'b':
+ paderr = len(encoded_string) % 4 # Postel's law: add missing padding
+ if paderr:
+ encoded_string += '==='[:4 - paderr]
+ try:
+ word = base64mime.decode(encoded_string)
+ except binascii.Error:
+ raise HeaderParseError('Base64 decoding error')
+ else:
+ decoded_words.append((word, charset))
+ else:
+ raise AssertionError('Unexpected encoding: ' + encoding)
+ # Now convert all words to bytes and collapse consecutive runs of
+ # similarly encoded words.
+ collapsed = []
+ last_word = last_charset = None
+ for word, charset in decoded_words:
+ if isinstance(word, str):
+ word = bytes(word, 'raw-unicode-escape')
+ if last_word is None:
+ last_word = word
+ last_charset = charset
+ elif charset != last_charset:
+ collapsed.append((last_word, last_charset))
+ last_word = word
+ last_charset = charset
+ elif last_charset is None:
+ last_word += BSPACE + word
+ else:
+ last_word += word
+ collapsed.append((last_word, last_charset))
+ return collapsed
+
+
+def make_header(decoded_seq, maxlinelen=None, header_name=None,
+ continuation_ws=' '):
+ """Create a Header from a sequence of pairs as returned by decode_header()
+
+ decode_header() takes a header value string and returns a sequence of
+ pairs of the format (decoded_string, charset) where charset is the string
+ name of the character set.
+
+ This function takes one of those sequence of pairs and returns a Header
+ instance. Optional maxlinelen, header_name, and continuation_ws are as in
+ the Header constructor.
+ """
+ h = Header(maxlinelen=maxlinelen, header_name=header_name,
+ continuation_ws=continuation_ws)
+ for s, charset in decoded_seq:
+ # None means us-ascii but we can simply pass it on to h.append()
+ if charset is not None and not isinstance(charset, Charset):
+ charset = Charset(charset)
+ h.append(s, charset)
+ return h
+
+
+class Header(object):
+ def __init__(self, s=None, charset=None,
+ maxlinelen=None, header_name=None,
+ continuation_ws=' ', errors='strict'):
+ """Create a MIME-compliant header that can contain many character sets.
+
+ Optional s is the initial header value. If None, the initial header
+ value is not set. You can later append to the header with .append()
+ method calls. s may be a byte string or a Unicode string, but see the
+ .append() documentation for semantics.
+
+ Optional charset serves two purposes: it has the same meaning as the
+ charset argument to the .append() method. It also sets the default
+ character set for all subsequent .append() calls that omit the charset
+ argument. If charset is not provided in the constructor, the us-ascii
+ charset is used both as s's initial charset and as the default for
+ subsequent .append() calls.
+
+ The maximum line length can be specified explicitly via maxlinelen. For
+ splitting the first line to a shorter value (to account for the field
+ header which isn't included in s, e.g. `Subject') pass in the name of
+ the field in header_name. The default maxlinelen is 78 as recommended
+ by RFC 2822.
+
+ continuation_ws must be RFC 2822 compliant folding whitespace (usually
+ either a space or a hard tab) which will be prepended to continuation
+ lines.
+
+ errors is passed through to the .append() call.
+ """
+ if charset is None:
+ charset = USASCII
+ elif not isinstance(charset, Charset):
+ charset = Charset(charset)
+ self._charset = charset
+ self._continuation_ws = continuation_ws
+ self._chunks = []
+ if s is not None:
+ self.append(s, charset, errors)
+ if maxlinelen is None:
+ maxlinelen = MAXLINELEN
+ self._maxlinelen = maxlinelen
+ if header_name is None:
+ self._headerlen = 0
+ else:
+ # Take the separating colon and space into account.
+ self._headerlen = len(header_name) + 2
+
+ def __str__(self):
+ """Return the string value of the header."""
+ self._normalize()
+ uchunks = []
+ lastcs = None
+ lastspace = None
+ for string, charset in self._chunks:
+ # We must preserve spaces between encoded and non-encoded word
+ # boundaries, which means for us we need to add a space when we go
+ # from a charset to None/us-ascii, or from None/us-ascii to a
+ # charset. Only do this for the second and subsequent chunks.
+ # Don't add a space if the None/us-ascii string already has
+ # a space (trailing or leading depending on transition)
+ nextcs = charset
+ if nextcs == _charset.UNKNOWN8BIT:
+ original_bytes = string.encode('ascii', 'surrogateescape')
+ string = original_bytes.decode('ascii', 'replace')
+ if uchunks:
+ hasspace = string and self._nonctext(string[0])
+ if lastcs not in (None, 'us-ascii'):
+ if nextcs in (None, 'us-ascii') and not hasspace:
+ uchunks.append(SPACE)
+ nextcs = None
+ elif nextcs not in (None, 'us-ascii') and not lastspace:
+ uchunks.append(SPACE)
+ lastspace = string and self._nonctext(string[-1])
+ lastcs = nextcs
+ uchunks.append(string)
+ return EMPTYSTRING.join(uchunks)
+
+ # Rich comparison operators for equality only. BAW: does it make sense to
+ # have or explicitly disable <, <=, >, >= operators?
+ def __eq__(self, other):
+ # other may be a Header or a string. Both are fine so coerce
+ # ourselves to a unicode (of the unencoded header value), swap the
+ # args and do another comparison.
+ return other == str(self)
+
+ def __ne__(self, other):
+ return not self == other
+
+ def append(self, s, charset=None, errors='strict'):
+ """Append a string to the MIME header.
+
+ Optional charset, if given, should be a Charset instance or the name
+ of a character set (which will be converted to a Charset instance). A
+ value of None (the default) means that the charset given in the
+ constructor is used.
+
+ s may be a byte string or a Unicode string. If it is a byte string
+ (i.e. isinstance(s, str) is false), then charset is the encoding of
+ that byte string, and a UnicodeError will be raised if the string
+ cannot be decoded with that charset. If s is a Unicode string, then
+ charset is a hint specifying the character set of the characters in
+ the string. In either case, when producing an RFC 2822 compliant
+ header using RFC 2047 rules, the string will be encoded using the
+ output codec of the charset. If the string cannot be encoded to the
+ output codec, a UnicodeError will be raised.
+
+ Optional `errors' is passed as the errors argument to the decode
+ call if s is a byte string.
+ """
+ if charset is None:
+ charset = self._charset
+ elif not isinstance(charset, Charset):
+ charset = Charset(charset)
+ if not isinstance(s, str):
+ input_charset = charset.input_codec or 'us-ascii'
+ if input_charset == _charset.UNKNOWN8BIT:
+ s = s.decode('us-ascii', 'surrogateescape')
+ else:
+ s = s.decode(input_charset, errors)
+ # Ensure that the bytes we're storing can be decoded to the output
+ # character set, otherwise an early error is raised.
+ output_charset = charset.output_codec or 'us-ascii'
+ if output_charset != _charset.UNKNOWN8BIT:
+ try:
+ s.encode(output_charset, errors)
+ except UnicodeEncodeError:
+ if output_charset!='us-ascii':
+ raise
+ charset = UTF8
+ self._chunks.append((s, charset))
+
+ def _nonctext(self, s):
+ """True if string s is not a ctext character of RFC822.
+ """
+ return s.isspace() or s in ('(', ')', '\\')
+
+ def encode(self, splitchars=';, \t', maxlinelen=None, linesep='\n'):
+ r"""Encode a message header into an RFC-compliant format.
+
+ There are many issues involved in converting a given string for use in
+ an email header. Only certain character sets are readable in most
+ email clients, and as header strings can only contain a subset of
+ 7-bit ASCII, care must be taken to properly convert and encode (with
+ Base64 or quoted-printable) header strings. In addition, there is a
+ 75-character length limit on any given encoded header field, so
+ line-wrapping must be performed, even with double-byte character sets.
+
+ Optional maxlinelen specifies the maximum length of each generated
+ line, exclusive of the linesep string. Individual lines may be longer
+ than maxlinelen if a folding point cannot be found. The first line
+ will be shorter by the length of the header name plus ": " if a header
+ name was specified at Header construction time. The default value for
+ maxlinelen is determined at header construction time.
+
+ Optional splitchars is a string containing characters which should be
+ given extra weight by the splitting algorithm during normal header
+ wrapping. This is in very rough support of RFC 2822's `higher level
+ syntactic breaks': split points preceded by a splitchar are preferred
+ during line splitting, with the characters preferred in the order in
+ which they appear in the string. Space and tab may be included in the
+ string to indicate whether preference should be given to one over the
+ other as a split point when other split chars do not appear in the line
+ being split. Splitchars does not affect RFC 2047 encoded lines.
+
+ Optional linesep is a string to be used to separate the lines of
+ the value. The default value is the most useful for typical
+ Python applications, but it can be set to \r\n to produce RFC-compliant
+ line separators when needed.
+ """
+ self._normalize()
+ if maxlinelen is None:
+ maxlinelen = self._maxlinelen
+ # A maxlinelen of 0 means don't wrap. For all practical purposes,
+ # choosing a huge number here accomplishes that and makes the
+ # _ValueFormatter algorithm much simpler.
+ if maxlinelen == 0:
+ maxlinelen = 1000000
+ formatter = _ValueFormatter(self._headerlen, maxlinelen,
+ self._continuation_ws, splitchars)
+ lastcs = None
+ hasspace = lastspace = None
+ for string, charset in self._chunks:
+ if hasspace is not None:
+ hasspace = string and self._nonctext(string[0])
+ import sys
+ if lastcs not in (None, 'us-ascii'):
+ if not hasspace or charset not in (None, 'us-ascii'):
+ formatter.add_transition()
+ elif charset not in (None, 'us-ascii') and not lastspace:
+ formatter.add_transition()
+ lastspace = string and self._nonctext(string[-1])
+ lastcs = charset
+ hasspace = False
+ lines = string.splitlines()
+ if lines:
+ formatter.feed('', lines[0], charset)
+ else:
+ formatter.feed('', '', charset)
+ for line in lines[1:]:
+ formatter.newline()
+ if charset.header_encoding is not None:
+ formatter.feed(self._continuation_ws, ' ' + line.lstrip(),
+ charset)
+ else:
+ sline = line.lstrip()
+ fws = line[:len(line)-len(sline)]
+ formatter.feed(fws, sline, charset)
+ if len(lines) > 1:
+ formatter.newline()
+ if self._chunks:
+ formatter.add_transition()
+ value = formatter._str(linesep)
+ if _embeded_header.search(value):
+ raise HeaderParseError("header value appears to contain "
+ "an embedded header: {!r}".format(value))
+ return value
+
+ def _normalize(self):
+ # Step 1: Normalize the chunks so that all runs of identical charsets
+ # get collapsed into a single unicode string.
+ chunks = []
+ last_charset = None
+ last_chunk = []
+ for string, charset in self._chunks:
+ if charset == last_charset:
+ last_chunk.append(string)
+ else:
+ if last_charset is not None:
+ chunks.append((SPACE.join(last_chunk), last_charset))
+ last_chunk = [string]
+ last_charset = charset
+ if last_chunk:
+ chunks.append((SPACE.join(last_chunk), last_charset))
+ self._chunks = chunks
+
+
+class _ValueFormatter(object):
+ def __init__(self, headerlen, maxlen, continuation_ws, splitchars):
+ self._maxlen = maxlen
+ self._continuation_ws = continuation_ws
+ self._continuation_ws_len = len(continuation_ws)
+ self._splitchars = splitchars
+ self._lines = []
+ self._current_line = _Accumulator(headerlen)
+
+ def _str(self, linesep):
+ self.newline()
+ return linesep.join(self._lines)
+
+ def __str__(self):
+ return self._str(NL)
+
+ def newline(self):
+ end_of_line = self._current_line.pop()
+ if end_of_line != (' ', ''):
+ self._current_line.push(*end_of_line)
+ if len(self._current_line) > 0:
+ if self._current_line.is_onlyws():
+ self._lines[-1] += str(self._current_line)
+ else:
+ self._lines.append(str(self._current_line))
+ self._current_line.reset()
+
+ def add_transition(self):
+ self._current_line.push(' ', '')
+
+ def feed(self, fws, string, charset):
+ # If the charset has no header encoding (i.e. it is an ASCII encoding)
+ # then we must split the header at the "highest level syntactic break"
+ # possible. Note that we don't have a lot of smarts about field
+ # syntax; we just try to break on semi-colons, then commas, then
+ # whitespace. Eventually, this should be pluggable.
+ if charset.header_encoding is None:
+ self._ascii_split(fws, string, self._splitchars)
+ return
+ # Otherwise, we're doing either a Base64 or a quoted-printable
+ # encoding which means we don't need to split the line on syntactic
+ # breaks. We can basically just find enough characters to fit on the
+ # current line, minus the RFC 2047 chrome. What makes this trickier
+ # though is that we have to split at octet boundaries, not character
+ # boundaries but it's only safe to split at character boundaries so at
+ # best we can only get close.
+ encoded_lines = charset.header_encode_lines(string, self._maxlengths())
+ # The first element extends the current line, but if it's None then
+ # nothing more fit on the current line so start a new line.
+ try:
+ first_line = encoded_lines.pop(0)
+ except IndexError:
+ # There are no encoded lines, so we're done.
+ return
+ if first_line is not None:
+ self._append_chunk(fws, first_line)
+ try:
+ last_line = encoded_lines.pop()
+ except IndexError:
+ # There was only one line.
+ return
+ self.newline()
+ self._current_line.push(self._continuation_ws, last_line)
+ # Everything else are full lines in themselves.
+ for line in encoded_lines:
+ self._lines.append(self._continuation_ws + line)
+
+ def _maxlengths(self):
+ # The first line's length.
+ yield self._maxlen - len(self._current_line)
+ while True:
+ yield self._maxlen - self._continuation_ws_len
+
+ def _ascii_split(self, fws, string, splitchars):
+ # The RFC 2822 header folding algorithm is simple in principle but
+ # complex in practice. Lines may be folded any place where "folding
+ # white space" appears by inserting a linesep character in front of the
+ # FWS. The complication is that not all spaces or tabs qualify as FWS,
+ # and we are also supposed to prefer to break at "higher level
+ # syntactic breaks". We can't do either of these without intimate
+ # knowledge of the structure of structured headers, which we don't have
+ # here. So the best we can do here is prefer to break at the specified
+ # splitchars, and hope that we don't choose any spaces or tabs that
+ # aren't legal FWS. (This is at least better than the old algorithm,
+ # where we would sometimes *introduce* FWS after a splitchar, or the
+ # algorithm before that, where we would turn all white space runs into
+ # single spaces or tabs.)
+ parts = re.split("(["+FWS+"]+)", fws+string)
+ if parts[0]:
+ parts[:0] = ['']
+ else:
+ parts.pop(0)
+ for fws, part in zip(*[iter(parts)]*2):
+ self._append_chunk(fws, part)
+
+ def _append_chunk(self, fws, string):
+ self._current_line.push(fws, string)
+ if len(self._current_line) > self._maxlen:
+ # Find the best split point, working backward from the end.
+ # There might be none, on a long first line.
+ for ch in self._splitchars:
+ for i in range(self._current_line.part_count()-1, 0, -1):
+ if ch.isspace():
+ fws = self._current_line[i][0]
+ if fws and fws[0]==ch:
+ break
+ prevpart = self._current_line[i-1][1]
+ if prevpart and prevpart[-1]==ch:
+ break
+ else:
+ continue
+ break
+ else:
+ fws, part = self._current_line.pop()
+ if self._current_line._initial_size > 0:
+ # There will be a header, so leave it on a line by itself.
+ self.newline()
+ if not fws:
+ # We don't use continuation_ws here because the whitespace
+ # after a header should always be a space.
+ fws = ' '
+ self._current_line.push(fws, part)
+ return
+ remainder = self._current_line.pop_from(i)
+ self._lines.append(str(self._current_line))
+ self._current_line.reset(remainder)
+
+
+class _Accumulator(list):
+
+ def __init__(self, initial_size=0):
+ self._initial_size = initial_size
+ super().__init__()
+
+ def push(self, fws, string):
+ self.append((fws, string))
+
+ def pop_from(self, i=0):
+ popped = self[i:]
+ self[i:] = []
+ return popped
+
+ def pop(self):
+ if self.part_count()==0:
+ return ('', '')
+ return super().pop()
+
+ def __len__(self):
+ return sum((len(fws)+len(part) for fws, part in self),
+ self._initial_size)
+
+ def __str__(self):
+ return EMPTYSTRING.join((EMPTYSTRING.join((fws, part))
+ for fws, part in self))
+
+ def reset(self, startval=None):
+ if startval is None:
+ startval = []
+ self[:] = startval
+ self._initial_size = 0
+
+ def is_onlyws(self):
+ return self._initial_size==0 and (not self or str(self).isspace())
+
+ def part_count(self):
+ return super().__len__()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/headerregistry.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/headerregistry.py
new file mode 100644
index 0000000..9aaad65
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/headerregistry.py
@@ -0,0 +1,592 @@
+"""Representing and manipulating email headers via custom objects.
+
+This module provides an implementation of the HeaderRegistry API.
+The implementation is designed to flexibly follow RFC5322 rules.
+
+Eventually HeaderRegistry will be a public API, but it isn't yet,
+and will probably change some before that happens.
+
+"""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+from future.builtins import super
+from future.builtins import str
+from future.utils import text_to_native_str
+from future.backports.email import utils
+from future.backports.email import errors
+from future.backports.email import _header_value_parser as parser
+
+class Address(object):
+
+ def __init__(self, display_name='', username='', domain='', addr_spec=None):
+ """Create an object represeting a full email address.
+
+ An address can have a 'display_name', a 'username', and a 'domain'. In
+ addition to specifying the username and domain separately, they may be
+ specified together by using the addr_spec keyword *instead of* the
+ username and domain keywords. If an addr_spec string is specified it
+ must be properly quoted according to RFC 5322 rules; an error will be
+ raised if it is not.
+
+ An Address object has display_name, username, domain, and addr_spec
+ attributes, all of which are read-only. The addr_spec and the string
+ value of the object are both quoted according to RFC5322 rules, but
+ without any Content Transfer Encoding.
+
+ """
+ # This clause with its potential 'raise' may only happen when an
+ # application program creates an Address object using an addr_spec
+ # keyword. The email library code itself must always supply username
+ # and domain.
+ if addr_spec is not None:
+ if username or domain:
+ raise TypeError("addrspec specified when username and/or "
+ "domain also specified")
+ a_s, rest = parser.get_addr_spec(addr_spec)
+ if rest:
+ raise ValueError("Invalid addr_spec; only '{}' "
+ "could be parsed from '{}'".format(
+ a_s, addr_spec))
+ if a_s.all_defects:
+ raise a_s.all_defects[0]
+ username = a_s.local_part
+ domain = a_s.domain
+ self._display_name = display_name
+ self._username = username
+ self._domain = domain
+
+ @property
+ def display_name(self):
+ return self._display_name
+
+ @property
+ def username(self):
+ return self._username
+
+ @property
+ def domain(self):
+ return self._domain
+
+ @property
+ def addr_spec(self):
+ """The addr_spec (username@domain) portion of the address, quoted
+ according to RFC 5322 rules, but with no Content Transfer Encoding.
+ """
+ nameset = set(self.username)
+ if len(nameset) > len(nameset-parser.DOT_ATOM_ENDS):
+ lp = parser.quote_string(self.username)
+ else:
+ lp = self.username
+ if self.domain:
+ return lp + '@' + self.domain
+ if not lp:
+ return '<>'
+ return lp
+
+ def __repr__(self):
+ return "Address(display_name={!r}, username={!r}, domain={!r})".format(
+ self.display_name, self.username, self.domain)
+
+ def __str__(self):
+ nameset = set(self.display_name)
+ if len(nameset) > len(nameset-parser.SPECIALS):
+ disp = parser.quote_string(self.display_name)
+ else:
+ disp = self.display_name
+ if disp:
+ addr_spec = '' if self.addr_spec=='<>' else self.addr_spec
+ return "{} <{}>".format(disp, addr_spec)
+ return self.addr_spec
+
+ def __eq__(self, other):
+ if type(other) != type(self):
+ return False
+ return (self.display_name == other.display_name and
+ self.username == other.username and
+ self.domain == other.domain)
+
+
+class Group(object):
+
+ def __init__(self, display_name=None, addresses=None):
+ """Create an object representing an address group.
+
+ An address group consists of a display_name followed by colon and an
+ list of addresses (see Address) terminated by a semi-colon. The Group
+ is created by specifying a display_name and a possibly empty list of
+ Address objects. A Group can also be used to represent a single
+ address that is not in a group, which is convenient when manipulating
+ lists that are a combination of Groups and individual Addresses. In
+ this case the display_name should be set to None. In particular, the
+ string representation of a Group whose display_name is None is the same
+ as the Address object, if there is one and only one Address object in
+ the addresses list.
+
+ """
+ self._display_name = display_name
+ self._addresses = tuple(addresses) if addresses else tuple()
+
+ @property
+ def display_name(self):
+ return self._display_name
+
+ @property
+ def addresses(self):
+ return self._addresses
+
+ def __repr__(self):
+ return "Group(display_name={!r}, addresses={!r}".format(
+ self.display_name, self.addresses)
+
+ def __str__(self):
+ if self.display_name is None and len(self.addresses)==1:
+ return str(self.addresses[0])
+ disp = self.display_name
+ if disp is not None:
+ nameset = set(disp)
+ if len(nameset) > len(nameset-parser.SPECIALS):
+ disp = parser.quote_string(disp)
+ adrstr = ", ".join(str(x) for x in self.addresses)
+ adrstr = ' ' + adrstr if adrstr else adrstr
+ return "{}:{};".format(disp, adrstr)
+
+ def __eq__(self, other):
+ if type(other) != type(self):
+ return False
+ return (self.display_name == other.display_name and
+ self.addresses == other.addresses)
+
+
+# Header Classes #
+
+class BaseHeader(str):
+
+ """Base class for message headers.
+
+ Implements generic behavior and provides tools for subclasses.
+
+ A subclass must define a classmethod named 'parse' that takes an unfolded
+ value string and a dictionary as its arguments. The dictionary will
+ contain one key, 'defects', initialized to an empty list. After the call
+ the dictionary must contain two additional keys: parse_tree, set to the
+ parse tree obtained from parsing the header, and 'decoded', set to the
+ string value of the idealized representation of the data from the value.
+ (That is, encoded words are decoded, and values that have canonical
+ representations are so represented.)
+
+ The defects key is intended to collect parsing defects, which the message
+ parser will subsequently dispose of as appropriate. The parser should not,
+ insofar as practical, raise any errors. Defects should be added to the
+ list instead. The standard header parsers register defects for RFC
+ compliance issues, for obsolete RFC syntax, and for unrecoverable parsing
+ errors.
+
+ The parse method may add additional keys to the dictionary. In this case
+ the subclass must define an 'init' method, which will be passed the
+ dictionary as its keyword arguments. The method should use (usually by
+ setting them as the value of similarly named attributes) and remove all the
+ extra keys added by its parse method, and then use super to call its parent
+ class with the remaining arguments and keywords.
+
+ The subclass should also make sure that a 'max_count' attribute is defined
+ that is either None or 1. XXX: need to better define this API.
+
+ """
+
+ def __new__(cls, name, value):
+ kwds = {'defects': []}
+ cls.parse(value, kwds)
+ if utils._has_surrogates(kwds['decoded']):
+ kwds['decoded'] = utils._sanitize(kwds['decoded'])
+ self = str.__new__(cls, kwds['decoded'])
+ # del kwds['decoded']
+ self.init(name, **kwds)
+ return self
+
+ def init(self, name, **_3to2kwargs):
+ defects = _3to2kwargs['defects']; del _3to2kwargs['defects']
+ parse_tree = _3to2kwargs['parse_tree']; del _3to2kwargs['parse_tree']
+ self._name = name
+ self._parse_tree = parse_tree
+ self._defects = defects
+
+ @property
+ def name(self):
+ return self._name
+
+ @property
+ def defects(self):
+ return tuple(self._defects)
+
+ def __reduce__(self):
+ return (
+ _reconstruct_header,
+ (
+ self.__class__.__name__,
+ self.__class__.__bases__,
+ str(self),
+ ),
+ self.__dict__)
+
+ @classmethod
+ def _reconstruct(cls, value):
+ return str.__new__(cls, value)
+
+ def fold(self, **_3to2kwargs):
+ policy = _3to2kwargs['policy']; del _3to2kwargs['policy']
+ """Fold header according to policy.
+
+ The parsed representation of the header is folded according to
+ RFC5322 rules, as modified by the policy. If the parse tree
+ contains surrogateescaped bytes, the bytes are CTE encoded using
+ the charset 'unknown-8bit".
+
+ Any non-ASCII characters in the parse tree are CTE encoded using
+ charset utf-8. XXX: make this a policy setting.
+
+ The returned value is an ASCII-only string possibly containing linesep
+ characters, and ending with a linesep character. The string includes
+ the header name and the ': ' separator.
+
+ """
+ # At some point we need to only put fws here if it was in the source.
+ header = parser.Header([
+ parser.HeaderLabel([
+ parser.ValueTerminal(self.name, 'header-name'),
+ parser.ValueTerminal(':', 'header-sep')]),
+ parser.CFWSList([parser.WhiteSpaceTerminal(' ', 'fws')]),
+ self._parse_tree])
+ return header.fold(policy=policy)
+
+
+def _reconstruct_header(cls_name, bases, value):
+ return type(text_to_native_str(cls_name), bases, {})._reconstruct(value)
+
+
+class UnstructuredHeader(object):
+
+ max_count = None
+ value_parser = staticmethod(parser.get_unstructured)
+
+ @classmethod
+ def parse(cls, value, kwds):
+ kwds['parse_tree'] = cls.value_parser(value)
+ kwds['decoded'] = str(kwds['parse_tree'])
+
+
+class UniqueUnstructuredHeader(UnstructuredHeader):
+
+ max_count = 1
+
+
+class DateHeader(object):
+
+ """Header whose value consists of a single timestamp.
+
+ Provides an additional attribute, datetime, which is either an aware
+ datetime using a timezone, or a naive datetime if the timezone
+ in the input string is -0000. Also accepts a datetime as input.
+ The 'value' attribute is the normalized form of the timestamp,
+ which means it is the output of format_datetime on the datetime.
+ """
+
+ max_count = None
+
+ # This is used only for folding, not for creating 'decoded'.
+ value_parser = staticmethod(parser.get_unstructured)
+
+ @classmethod
+ def parse(cls, value, kwds):
+ if not value:
+ kwds['defects'].append(errors.HeaderMissingRequiredValue())
+ kwds['datetime'] = None
+ kwds['decoded'] = ''
+ kwds['parse_tree'] = parser.TokenList()
+ return
+ if isinstance(value, str):
+ value = utils.parsedate_to_datetime(value)
+ kwds['datetime'] = value
+ kwds['decoded'] = utils.format_datetime(kwds['datetime'])
+ kwds['parse_tree'] = cls.value_parser(kwds['decoded'])
+
+ def init(self, *args, **kw):
+ self._datetime = kw.pop('datetime')
+ super().init(*args, **kw)
+
+ @property
+ def datetime(self):
+ return self._datetime
+
+
+class UniqueDateHeader(DateHeader):
+
+ max_count = 1
+
+
+class AddressHeader(object):
+
+ max_count = None
+
+ @staticmethod
+ def value_parser(value):
+ address_list, value = parser.get_address_list(value)
+ assert not value, 'this should not happen'
+ return address_list
+
+ @classmethod
+ def parse(cls, value, kwds):
+ if isinstance(value, str):
+ # We are translating here from the RFC language (address/mailbox)
+ # to our API language (group/address).
+ kwds['parse_tree'] = address_list = cls.value_parser(value)
+ groups = []
+ for addr in address_list.addresses:
+ groups.append(Group(addr.display_name,
+ [Address(mb.display_name or '',
+ mb.local_part or '',
+ mb.domain or '')
+ for mb in addr.all_mailboxes]))
+ defects = list(address_list.all_defects)
+ else:
+ # Assume it is Address/Group stuff
+ if not hasattr(value, '__iter__'):
+ value = [value]
+ groups = [Group(None, [item]) if not hasattr(item, 'addresses')
+ else item
+ for item in value]
+ defects = []
+ kwds['groups'] = groups
+ kwds['defects'] = defects
+ kwds['decoded'] = ', '.join([str(item) for item in groups])
+ if 'parse_tree' not in kwds:
+ kwds['parse_tree'] = cls.value_parser(kwds['decoded'])
+
+ def init(self, *args, **kw):
+ self._groups = tuple(kw.pop('groups'))
+ self._addresses = None
+ super().init(*args, **kw)
+
+ @property
+ def groups(self):
+ return self._groups
+
+ @property
+ def addresses(self):
+ if self._addresses is None:
+ self._addresses = tuple([address for group in self._groups
+ for address in group.addresses])
+ return self._addresses
+
+
+class UniqueAddressHeader(AddressHeader):
+
+ max_count = 1
+
+
+class SingleAddressHeader(AddressHeader):
+
+ @property
+ def address(self):
+ if len(self.addresses)!=1:
+ raise ValueError(("value of single address header {} is not "
+ "a single address").format(self.name))
+ return self.addresses[0]
+
+
+class UniqueSingleAddressHeader(SingleAddressHeader):
+
+ max_count = 1
+
+
+class MIMEVersionHeader(object):
+
+ max_count = 1
+
+ value_parser = staticmethod(parser.parse_mime_version)
+
+ @classmethod
+ def parse(cls, value, kwds):
+ kwds['parse_tree'] = parse_tree = cls.value_parser(value)
+ kwds['decoded'] = str(parse_tree)
+ kwds['defects'].extend(parse_tree.all_defects)
+ kwds['major'] = None if parse_tree.minor is None else parse_tree.major
+ kwds['minor'] = parse_tree.minor
+ if parse_tree.minor is not None:
+ kwds['version'] = '{}.{}'.format(kwds['major'], kwds['minor'])
+ else:
+ kwds['version'] = None
+
+ def init(self, *args, **kw):
+ self._version = kw.pop('version')
+ self._major = kw.pop('major')
+ self._minor = kw.pop('minor')
+ super().init(*args, **kw)
+
+ @property
+ def major(self):
+ return self._major
+
+ @property
+ def minor(self):
+ return self._minor
+
+ @property
+ def version(self):
+ return self._version
+
+
+class ParameterizedMIMEHeader(object):
+
+ # Mixin that handles the params dict. Must be subclassed and
+ # a property value_parser for the specific header provided.
+
+ max_count = 1
+
+ @classmethod
+ def parse(cls, value, kwds):
+ kwds['parse_tree'] = parse_tree = cls.value_parser(value)
+ kwds['decoded'] = str(parse_tree)
+ kwds['defects'].extend(parse_tree.all_defects)
+ if parse_tree.params is None:
+ kwds['params'] = {}
+ else:
+ # The MIME RFCs specify that parameter ordering is arbitrary.
+ kwds['params'] = dict((utils._sanitize(name).lower(),
+ utils._sanitize(value))
+ for name, value in parse_tree.params)
+
+ def init(self, *args, **kw):
+ self._params = kw.pop('params')
+ super().init(*args, **kw)
+
+ @property
+ def params(self):
+ return self._params.copy()
+
+
+class ContentTypeHeader(ParameterizedMIMEHeader):
+
+ value_parser = staticmethod(parser.parse_content_type_header)
+
+ def init(self, *args, **kw):
+ super().init(*args, **kw)
+ self._maintype = utils._sanitize(self._parse_tree.maintype)
+ self._subtype = utils._sanitize(self._parse_tree.subtype)
+
+ @property
+ def maintype(self):
+ return self._maintype
+
+ @property
+ def subtype(self):
+ return self._subtype
+
+ @property
+ def content_type(self):
+ return self.maintype + '/' + self.subtype
+
+
+class ContentDispositionHeader(ParameterizedMIMEHeader):
+
+ value_parser = staticmethod(parser.parse_content_disposition_header)
+
+ def init(self, *args, **kw):
+ super().init(*args, **kw)
+ cd = self._parse_tree.content_disposition
+ self._content_disposition = cd if cd is None else utils._sanitize(cd)
+
+ @property
+ def content_disposition(self):
+ return self._content_disposition
+
+
+class ContentTransferEncodingHeader(object):
+
+ max_count = 1
+
+ value_parser = staticmethod(parser.parse_content_transfer_encoding_header)
+
+ @classmethod
+ def parse(cls, value, kwds):
+ kwds['parse_tree'] = parse_tree = cls.value_parser(value)
+ kwds['decoded'] = str(parse_tree)
+ kwds['defects'].extend(parse_tree.all_defects)
+
+ def init(self, *args, **kw):
+ super().init(*args, **kw)
+ self._cte = utils._sanitize(self._parse_tree.cte)
+
+ @property
+ def cte(self):
+ return self._cte
+
+
+# The header factory #
+
+_default_header_map = {
+ 'subject': UniqueUnstructuredHeader,
+ 'date': UniqueDateHeader,
+ 'resent-date': DateHeader,
+ 'orig-date': UniqueDateHeader,
+ 'sender': UniqueSingleAddressHeader,
+ 'resent-sender': SingleAddressHeader,
+ 'to': UniqueAddressHeader,
+ 'resent-to': AddressHeader,
+ 'cc': UniqueAddressHeader,
+ 'resent-cc': AddressHeader,
+ 'bcc': UniqueAddressHeader,
+ 'resent-bcc': AddressHeader,
+ 'from': UniqueAddressHeader,
+ 'resent-from': AddressHeader,
+ 'reply-to': UniqueAddressHeader,
+ 'mime-version': MIMEVersionHeader,
+ 'content-type': ContentTypeHeader,
+ 'content-disposition': ContentDispositionHeader,
+ 'content-transfer-encoding': ContentTransferEncodingHeader,
+ }
+
+class HeaderRegistry(object):
+
+ """A header_factory and header registry."""
+
+ def __init__(self, base_class=BaseHeader, default_class=UnstructuredHeader,
+ use_default_map=True):
+ """Create a header_factory that works with the Policy API.
+
+ base_class is the class that will be the last class in the created
+ header class's __bases__ list. default_class is the class that will be
+ used if "name" (see __call__) does not appear in the registry.
+ use_default_map controls whether or not the default mapping of names to
+ specialized classes is copied in to the registry when the factory is
+ created. The default is True.
+
+ """
+ self.registry = {}
+ self.base_class = base_class
+ self.default_class = default_class
+ if use_default_map:
+ self.registry.update(_default_header_map)
+
+ def map_to_type(self, name, cls):
+ """Register cls as the specialized class for handling "name" headers.
+
+ """
+ self.registry[name.lower()] = cls
+
+ def __getitem__(self, name):
+ cls = self.registry.get(name.lower(), self.default_class)
+ return type(text_to_native_str('_'+cls.__name__), (cls, self.base_class), {})
+
+ def __call__(self, name, value):
+ """Create a header instance for header 'name' from 'value'.
+
+ Creates a header instance by creating a specialized class for parsing
+ and representing the specified header by combining the factory
+ base_class with a specialized class from the registry or the
+ default_class, and passing the name and value to the constructed
+ class's constructor.
+
+ """
+ return self[name](name, value)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/iterators.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/iterators.py
new file mode 100644
index 0000000..82d320f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/iterators.py
@@ -0,0 +1,74 @@
+# Copyright (C) 2001-2006 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Various types of useful iterators and generators."""
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+__all__ = [
+ 'body_line_iterator',
+ 'typed_subpart_iterator',
+ 'walk',
+ # Do not include _structure() since it's part of the debugging API.
+ ]
+
+import sys
+from io import StringIO
+
+
+# This function will become a method of the Message class
+def walk(self):
+ """Walk over the message tree, yielding each subpart.
+
+ The walk is performed in depth-first order. This method is a
+ generator.
+ """
+ yield self
+ if self.is_multipart():
+ for subpart in self.get_payload():
+ for subsubpart in subpart.walk():
+ yield subsubpart
+
+
+# These two functions are imported into the Iterators.py interface module.
+def body_line_iterator(msg, decode=False):
+ """Iterate over the parts, returning string payloads line-by-line.
+
+ Optional decode (default False) is passed through to .get_payload().
+ """
+ for subpart in msg.walk():
+ payload = subpart.get_payload(decode=decode)
+ if isinstance(payload, str):
+ for line in StringIO(payload):
+ yield line
+
+
+def typed_subpart_iterator(msg, maintype='text', subtype=None):
+ """Iterate over the subparts with a given MIME type.
+
+ Use `maintype' as the main MIME type to match against; this defaults to
+ "text". Optional `subtype' is the MIME subtype to match against; if
+ omitted, only the main type is matched.
+ """
+ for subpart in msg.walk():
+ if subpart.get_content_maintype() == maintype:
+ if subtype is None or subpart.get_content_subtype() == subtype:
+ yield subpart
+
+
+def _structure(msg, fp=None, level=0, include_default=False):
+ """A handy debugging aid"""
+ if fp is None:
+ fp = sys.stdout
+ tab = ' ' * (level * 4)
+ print(tab + msg.get_content_type(), end='', file=fp)
+ if include_default:
+ print(' [%s]' % msg.get_default_type(), file=fp)
+ else:
+ print(file=fp)
+ if msg.is_multipart():
+ for subpart in msg.get_payload():
+ _structure(subpart, fp, level+1, include_default)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/message.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/message.py
new file mode 100644
index 0000000..99715fc
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/message.py
@@ -0,0 +1,882 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2001-2007 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Basic message object for the email package object model."""
+from __future__ import absolute_import, division, unicode_literals
+from future.builtins import list, range, str, zip
+
+__all__ = ['Message']
+
+import re
+import uu
+import base64
+import binascii
+from io import BytesIO, StringIO
+
+# Intrapackage imports
+from future.utils import as_native_str
+from future.backports.email import utils
+from future.backports.email import errors
+from future.backports.email._policybase import compat32
+from future.backports.email import charset as _charset
+from future.backports.email._encoded_words import decode_b
+Charset = _charset.Charset
+
+SEMISPACE = '; '
+
+# Regular expression that matches `special' characters in parameters, the
+# existence of which force quoting of the parameter value.
+tspecials = re.compile(r'[ \(\)<>@,;:\\"/\[\]\?=]')
+
+
+def _splitparam(param):
+ # Split header parameters. BAW: this may be too simple. It isn't
+ # strictly RFC 2045 (section 5.1) compliant, but it catches most headers
+ # found in the wild. We may eventually need a full fledged parser.
+ # RDM: we might have a Header here; for now just stringify it.
+ a, sep, b = str(param).partition(';')
+ if not sep:
+ return a.strip(), None
+ return a.strip(), b.strip()
+
+def _formatparam(param, value=None, quote=True):
+ """Convenience function to format and return a key=value pair.
+
+ This will quote the value if needed or if quote is true. If value is a
+ three tuple (charset, language, value), it will be encoded according
+ to RFC2231 rules. If it contains non-ascii characters it will likewise
+ be encoded according to RFC2231 rules, using the utf-8 charset and
+ a null language.
+ """
+ if value is not None and len(value) > 0:
+ # A tuple is used for RFC 2231 encoded parameter values where items
+ # are (charset, language, value). charset is a string, not a Charset
+ # instance. RFC 2231 encoded values are never quoted, per RFC.
+ if isinstance(value, tuple):
+ # Encode as per RFC 2231
+ param += '*'
+ value = utils.encode_rfc2231(value[2], value[0], value[1])
+ return '%s=%s' % (param, value)
+ else:
+ try:
+ value.encode('ascii')
+ except UnicodeEncodeError:
+ param += '*'
+ value = utils.encode_rfc2231(value, 'utf-8', '')
+ return '%s=%s' % (param, value)
+ # BAW: Please check this. I think that if quote is set it should
+ # force quoting even if not necessary.
+ if quote or tspecials.search(value):
+ return '%s="%s"' % (param, utils.quote(value))
+ else:
+ return '%s=%s' % (param, value)
+ else:
+ return param
+
+def _parseparam(s):
+ # RDM This might be a Header, so for now stringify it.
+ s = ';' + str(s)
+ plist = []
+ while s[:1] == ';':
+ s = s[1:]
+ end = s.find(';')
+ while end > 0 and (s.count('"', 0, end) - s.count('\\"', 0, end)) % 2:
+ end = s.find(';', end + 1)
+ if end < 0:
+ end = len(s)
+ f = s[:end]
+ if '=' in f:
+ i = f.index('=')
+ f = f[:i].strip().lower() + '=' + f[i+1:].strip()
+ plist.append(f.strip())
+ s = s[end:]
+ return plist
+
+
+def _unquotevalue(value):
+ # This is different than utils.collapse_rfc2231_value() because it doesn't
+ # try to convert the value to a unicode. Message.get_param() and
+ # Message.get_params() are both currently defined to return the tuple in
+ # the face of RFC 2231 parameters.
+ if isinstance(value, tuple):
+ return value[0], value[1], utils.unquote(value[2])
+ else:
+ return utils.unquote(value)
+
+
+class Message(object):
+ """Basic message object.
+
+ A message object is defined as something that has a bunch of RFC 2822
+ headers and a payload. It may optionally have an envelope header
+ (a.k.a. Unix-From or From_ header). If the message is a container (i.e. a
+ multipart or a message/rfc822), then the payload is a list of Message
+ objects, otherwise it is a string.
+
+ Message objects implement part of the `mapping' interface, which assumes
+ there is exactly one occurrence of the header per message. Some headers
+ do in fact appear multiple times (e.g. Received) and for those headers,
+ you must use the explicit API to set or get all the headers. Not all of
+ the mapping methods are implemented.
+ """
+ def __init__(self, policy=compat32):
+ self.policy = policy
+ self._headers = list()
+ self._unixfrom = None
+ self._payload = None
+ self._charset = None
+ # Defaults for multipart messages
+ self.preamble = self.epilogue = None
+ self.defects = []
+ # Default content type
+ self._default_type = 'text/plain'
+
+ @as_native_str(encoding='utf-8')
+ def __str__(self):
+ """Return the entire formatted message as a string.
+ This includes the headers, body, and envelope header.
+ """
+ return self.as_string()
+
+ def as_string(self, unixfrom=False, maxheaderlen=0):
+ """Return the entire formatted message as a (unicode) string.
+ Optional `unixfrom' when True, means include the Unix From_ envelope
+ header.
+
+ This is a convenience method and may not generate the message exactly
+ as you intend. For more flexibility, use the flatten() method of a
+ Generator instance.
+ """
+ from future.backports.email.generator import Generator
+ fp = StringIO()
+ g = Generator(fp, mangle_from_=False, maxheaderlen=maxheaderlen)
+ g.flatten(self, unixfrom=unixfrom)
+ return fp.getvalue()
+
+ def is_multipart(self):
+ """Return True if the message consists of multiple parts."""
+ return isinstance(self._payload, list)
+
+ #
+ # Unix From_ line
+ #
+ def set_unixfrom(self, unixfrom):
+ self._unixfrom = unixfrom
+
+ def get_unixfrom(self):
+ return self._unixfrom
+
+ #
+ # Payload manipulation.
+ #
+ def attach(self, payload):
+ """Add the given payload to the current payload.
+
+ The current payload will always be a list of objects after this method
+ is called. If you want to set the payload to a scalar object, use
+ set_payload() instead.
+ """
+ if self._payload is None:
+ self._payload = [payload]
+ else:
+ self._payload.append(payload)
+
+ def get_payload(self, i=None, decode=False):
+ """Return a reference to the payload.
+
+ The payload will either be a list object or a string. If you mutate
+ the list object, you modify the message's payload in place. Optional
+ i returns that index into the payload.
+
+ Optional decode is a flag indicating whether the payload should be
+ decoded or not, according to the Content-Transfer-Encoding header
+ (default is False).
+
+ When True and the message is not a multipart, the payload will be
+ decoded if this header's value is `quoted-printable' or `base64'. If
+ some other encoding is used, or the header is missing, or if the
+ payload has bogus data (i.e. bogus base64 or uuencoded data), the
+ payload is returned as-is.
+
+ If the message is a multipart and the decode flag is True, then None
+ is returned.
+ """
+ # Here is the logic table for this code, based on the email5.0.0 code:
+ # i decode is_multipart result
+ # ------ ------ ------------ ------------------------------
+ # None True True None
+ # i True True None
+ # None False True _payload (a list)
+ # i False True _payload element i (a Message)
+ # i False False error (not a list)
+ # i True False error (not a list)
+ # None False False _payload
+ # None True False _payload decoded (bytes)
+ # Note that Barry planned to factor out the 'decode' case, but that
+ # isn't so easy now that we handle the 8 bit data, which needs to be
+ # converted in both the decode and non-decode path.
+ if self.is_multipart():
+ if decode:
+ return None
+ if i is None:
+ return self._payload
+ else:
+ return self._payload[i]
+ # For backward compatibility, Use isinstance and this error message
+ # instead of the more logical is_multipart test.
+ if i is not None and not isinstance(self._payload, list):
+ raise TypeError('Expected list, got %s' % type(self._payload))
+ payload = self._payload
+ # cte might be a Header, so for now stringify it.
+ cte = str(self.get('content-transfer-encoding', '')).lower()
+ # payload may be bytes here.
+ if isinstance(payload, str):
+ payload = str(payload) # for Python-Future, so surrogateescape works
+ if utils._has_surrogates(payload):
+ bpayload = payload.encode('ascii', 'surrogateescape')
+ if not decode:
+ try:
+ payload = bpayload.decode(self.get_param('charset', 'ascii'), 'replace')
+ except LookupError:
+ payload = bpayload.decode('ascii', 'replace')
+ elif decode:
+ try:
+ bpayload = payload.encode('ascii')
+ except UnicodeError:
+ # This won't happen for RFC compliant messages (messages
+ # containing only ASCII codepoints in the unicode input).
+ # If it does happen, turn the string into bytes in a way
+ # guaranteed not to fail.
+ bpayload = payload.encode('raw-unicode-escape')
+ if not decode:
+ return payload
+ if cte == 'quoted-printable':
+ return utils._qdecode(bpayload)
+ elif cte == 'base64':
+ # XXX: this is a bit of a hack; decode_b should probably be factored
+ # out somewhere, but I haven't figured out where yet.
+ value, defects = decode_b(b''.join(bpayload.splitlines()))
+ for defect in defects:
+ self.policy.handle_defect(self, defect)
+ return value
+ elif cte in ('x-uuencode', 'uuencode', 'uue', 'x-uue'):
+ in_file = BytesIO(bpayload)
+ out_file = BytesIO()
+ try:
+ uu.decode(in_file, out_file, quiet=True)
+ return out_file.getvalue()
+ except uu.Error:
+ # Some decoding problem
+ return bpayload
+ if isinstance(payload, str):
+ return bpayload
+ return payload
+
+ def set_payload(self, payload, charset=None):
+ """Set the payload to the given value.
+
+ Optional charset sets the message's default character set. See
+ set_charset() for details.
+ """
+ self._payload = payload
+ if charset is not None:
+ self.set_charset(charset)
+
+ def set_charset(self, charset):
+ """Set the charset of the payload to a given character set.
+
+ charset can be a Charset instance, a string naming a character set, or
+ None. If it is a string it will be converted to a Charset instance.
+ If charset is None, the charset parameter will be removed from the
+ Content-Type field. Anything else will generate a TypeError.
+
+ The message will be assumed to be of type text/* encoded with
+ charset.input_charset. It will be converted to charset.output_charset
+ and encoded properly, if needed, when generating the plain text
+ representation of the message. MIME headers (MIME-Version,
+ Content-Type, Content-Transfer-Encoding) will be added as needed.
+ """
+ if charset is None:
+ self.del_param('charset')
+ self._charset = None
+ return
+ if not isinstance(charset, Charset):
+ charset = Charset(charset)
+ self._charset = charset
+ if 'MIME-Version' not in self:
+ self.add_header('MIME-Version', '1.0')
+ if 'Content-Type' not in self:
+ self.add_header('Content-Type', 'text/plain',
+ charset=charset.get_output_charset())
+ else:
+ self.set_param('charset', charset.get_output_charset())
+ if charset != charset.get_output_charset():
+ self._payload = charset.body_encode(self._payload)
+ if 'Content-Transfer-Encoding' not in self:
+ cte = charset.get_body_encoding()
+ try:
+ cte(self)
+ except TypeError:
+ self._payload = charset.body_encode(self._payload)
+ self.add_header('Content-Transfer-Encoding', cte)
+
+ def get_charset(self):
+ """Return the Charset instance associated with the message's payload.
+ """
+ return self._charset
+
+ #
+ # MAPPING INTERFACE (partial)
+ #
+ def __len__(self):
+ """Return the total number of headers, including duplicates."""
+ return len(self._headers)
+
+ def __getitem__(self, name):
+ """Get a header value.
+
+ Return None if the header is missing instead of raising an exception.
+
+ Note that if the header appeared multiple times, exactly which
+ occurrence gets returned is undefined. Use get_all() to get all
+ the values matching a header field name.
+ """
+ return self.get(name)
+
+ def __setitem__(self, name, val):
+ """Set the value of a header.
+
+ Note: this does not overwrite an existing header with the same field
+ name. Use __delitem__() first to delete any existing headers.
+ """
+ max_count = self.policy.header_max_count(name)
+ if max_count:
+ lname = name.lower()
+ found = 0
+ for k, v in self._headers:
+ if k.lower() == lname:
+ found += 1
+ if found >= max_count:
+ raise ValueError("There may be at most {} {} headers "
+ "in a message".format(max_count, name))
+ self._headers.append(self.policy.header_store_parse(name, val))
+
+ def __delitem__(self, name):
+ """Delete all occurrences of a header, if present.
+
+ Does not raise an exception if the header is missing.
+ """
+ name = name.lower()
+ newheaders = list()
+ for k, v in self._headers:
+ if k.lower() != name:
+ newheaders.append((k, v))
+ self._headers = newheaders
+
+ def __contains__(self, name):
+ return name.lower() in [k.lower() for k, v in self._headers]
+
+ def __iter__(self):
+ for field, value in self._headers:
+ yield field
+
+ def keys(self):
+ """Return a list of all the message's header field names.
+
+ These will be sorted in the order they appeared in the original
+ message, or were added to the message, and may contain duplicates.
+ Any fields deleted and re-inserted are always appended to the header
+ list.
+ """
+ return [k for k, v in self._headers]
+
+ def values(self):
+ """Return a list of all the message's header values.
+
+ These will be sorted in the order they appeared in the original
+ message, or were added to the message, and may contain duplicates.
+ Any fields deleted and re-inserted are always appended to the header
+ list.
+ """
+ return [self.policy.header_fetch_parse(k, v)
+ for k, v in self._headers]
+
+ def items(self):
+ """Get all the message's header fields and values.
+
+ These will be sorted in the order they appeared in the original
+ message, or were added to the message, and may contain duplicates.
+ Any fields deleted and re-inserted are always appended to the header
+ list.
+ """
+ return [(k, self.policy.header_fetch_parse(k, v))
+ for k, v in self._headers]
+
+ def get(self, name, failobj=None):
+ """Get a header value.
+
+ Like __getitem__() but return failobj instead of None when the field
+ is missing.
+ """
+ name = name.lower()
+ for k, v in self._headers:
+ if k.lower() == name:
+ return self.policy.header_fetch_parse(k, v)
+ return failobj
+
+ #
+ # "Internal" methods (public API, but only intended for use by a parser
+ # or generator, not normal application code.
+ #
+
+ def set_raw(self, name, value):
+ """Store name and value in the model without modification.
+
+ This is an "internal" API, intended only for use by a parser.
+ """
+ self._headers.append((name, value))
+
+ def raw_items(self):
+ """Return the (name, value) header pairs without modification.
+
+ This is an "internal" API, intended only for use by a generator.
+ """
+ return iter(self._headers.copy())
+
+ #
+ # Additional useful stuff
+ #
+
+ def get_all(self, name, failobj=None):
+ """Return a list of all the values for the named field.
+
+ These will be sorted in the order they appeared in the original
+ message, and may contain duplicates. Any fields deleted and
+ re-inserted are always appended to the header list.
+
+ If no such fields exist, failobj is returned (defaults to None).
+ """
+ values = []
+ name = name.lower()
+ for k, v in self._headers:
+ if k.lower() == name:
+ values.append(self.policy.header_fetch_parse(k, v))
+ if not values:
+ return failobj
+ return values
+
+ def add_header(self, _name, _value, **_params):
+ """Extended header setting.
+
+ name is the header field to add. keyword arguments can be used to set
+ additional parameters for the header field, with underscores converted
+ to dashes. Normally the parameter will be added as key="value" unless
+ value is None, in which case only the key will be added. If a
+ parameter value contains non-ASCII characters it can be specified as a
+ three-tuple of (charset, language, value), in which case it will be
+ encoded according to RFC2231 rules. Otherwise it will be encoded using
+ the utf-8 charset and a language of ''.
+
+ Examples:
+
+ msg.add_header('content-disposition', 'attachment', filename='bud.gif')
+ msg.add_header('content-disposition', 'attachment',
+ filename=('utf-8', '', 'Fußballer.ppt'))
+ msg.add_header('content-disposition', 'attachment',
+ filename='Fußballer.ppt'))
+ """
+ parts = []
+ for k, v in _params.items():
+ if v is None:
+ parts.append(k.replace('_', '-'))
+ else:
+ parts.append(_formatparam(k.replace('_', '-'), v))
+ if _value is not None:
+ parts.insert(0, _value)
+ self[_name] = SEMISPACE.join(parts)
+
+ def replace_header(self, _name, _value):
+ """Replace a header.
+
+ Replace the first matching header found in the message, retaining
+ header order and case. If no matching header was found, a KeyError is
+ raised.
+ """
+ _name = _name.lower()
+ for i, (k, v) in zip(range(len(self._headers)), self._headers):
+ if k.lower() == _name:
+ self._headers[i] = self.policy.header_store_parse(k, _value)
+ break
+ else:
+ raise KeyError(_name)
+
+ #
+ # Use these three methods instead of the three above.
+ #
+
+ def get_content_type(self):
+ """Return the message's content type.
+
+ The returned string is coerced to lower case of the form
+ `maintype/subtype'. If there was no Content-Type header in the
+ message, the default type as given by get_default_type() will be
+ returned. Since according to RFC 2045, messages always have a default
+ type this will always return a value.
+
+ RFC 2045 defines a message's default type to be text/plain unless it
+ appears inside a multipart/digest container, in which case it would be
+ message/rfc822.
+ """
+ missing = object()
+ value = self.get('content-type', missing)
+ if value is missing:
+ # This should have no parameters
+ return self.get_default_type()
+ ctype = _splitparam(value)[0].lower()
+ # RFC 2045, section 5.2 says if its invalid, use text/plain
+ if ctype.count('/') != 1:
+ return 'text/plain'
+ return ctype
+
+ def get_content_maintype(self):
+ """Return the message's main content type.
+
+ This is the `maintype' part of the string returned by
+ get_content_type().
+ """
+ ctype = self.get_content_type()
+ return ctype.split('/')[0]
+
+ def get_content_subtype(self):
+ """Returns the message's sub-content type.
+
+ This is the `subtype' part of the string returned by
+ get_content_type().
+ """
+ ctype = self.get_content_type()
+ return ctype.split('/')[1]
+
+ def get_default_type(self):
+ """Return the `default' content type.
+
+ Most messages have a default content type of text/plain, except for
+ messages that are subparts of multipart/digest containers. Such
+ subparts have a default content type of message/rfc822.
+ """
+ return self._default_type
+
+ def set_default_type(self, ctype):
+ """Set the `default' content type.
+
+ ctype should be either "text/plain" or "message/rfc822", although this
+ is not enforced. The default content type is not stored in the
+ Content-Type header.
+ """
+ self._default_type = ctype
+
+ def _get_params_preserve(self, failobj, header):
+ # Like get_params() but preserves the quoting of values. BAW:
+ # should this be part of the public interface?
+ missing = object()
+ value = self.get(header, missing)
+ if value is missing:
+ return failobj
+ params = []
+ for p in _parseparam(value):
+ try:
+ name, val = p.split('=', 1)
+ name = name.strip()
+ val = val.strip()
+ except ValueError:
+ # Must have been a bare attribute
+ name = p.strip()
+ val = ''
+ params.append((name, val))
+ params = utils.decode_params(params)
+ return params
+
+ def get_params(self, failobj=None, header='content-type', unquote=True):
+ """Return the message's Content-Type parameters, as a list.
+
+ The elements of the returned list are 2-tuples of key/value pairs, as
+ split on the `=' sign. The left hand side of the `=' is the key,
+ while the right hand side is the value. If there is no `=' sign in
+ the parameter the value is the empty string. The value is as
+ described in the get_param() method.
+
+ Optional failobj is the object to return if there is no Content-Type
+ header. Optional header is the header to search instead of
+ Content-Type. If unquote is True, the value is unquoted.
+ """
+ missing = object()
+ params = self._get_params_preserve(missing, header)
+ if params is missing:
+ return failobj
+ if unquote:
+ return [(k, _unquotevalue(v)) for k, v in params]
+ else:
+ return params
+
+ def get_param(self, param, failobj=None, header='content-type',
+ unquote=True):
+ """Return the parameter value if found in the Content-Type header.
+
+ Optional failobj is the object to return if there is no Content-Type
+ header, or the Content-Type header has no such parameter. Optional
+ header is the header to search instead of Content-Type.
+
+ Parameter keys are always compared case insensitively. The return
+ value can either be a string, or a 3-tuple if the parameter was RFC
+ 2231 encoded. When it's a 3-tuple, the elements of the value are of
+ the form (CHARSET, LANGUAGE, VALUE). Note that both CHARSET and
+ LANGUAGE can be None, in which case you should consider VALUE to be
+ encoded in the us-ascii charset. You can usually ignore LANGUAGE.
+ The parameter value (either the returned string, or the VALUE item in
+ the 3-tuple) is always unquoted, unless unquote is set to False.
+
+ If your application doesn't care whether the parameter was RFC 2231
+ encoded, it can turn the return value into a string as follows:
+
+ param = msg.get_param('foo')
+ param = email.utils.collapse_rfc2231_value(rawparam)
+
+ """
+ if header not in self:
+ return failobj
+ for k, v in self._get_params_preserve(failobj, header):
+ if k.lower() == param.lower():
+ if unquote:
+ return _unquotevalue(v)
+ else:
+ return v
+ return failobj
+
+ def set_param(self, param, value, header='Content-Type', requote=True,
+ charset=None, language=''):
+ """Set a parameter in the Content-Type header.
+
+ If the parameter already exists in the header, its value will be
+ replaced with the new value.
+
+ If header is Content-Type and has not yet been defined for this
+ message, it will be set to "text/plain" and the new parameter and
+ value will be appended as per RFC 2045.
+
+ An alternate header can specified in the header argument, and all
+ parameters will be quoted as necessary unless requote is False.
+
+ If charset is specified, the parameter will be encoded according to RFC
+ 2231. Optional language specifies the RFC 2231 language, defaulting
+ to the empty string. Both charset and language should be strings.
+ """
+ if not isinstance(value, tuple) and charset:
+ value = (charset, language, value)
+
+ if header not in self and header.lower() == 'content-type':
+ ctype = 'text/plain'
+ else:
+ ctype = self.get(header)
+ if not self.get_param(param, header=header):
+ if not ctype:
+ ctype = _formatparam(param, value, requote)
+ else:
+ ctype = SEMISPACE.join(
+ [ctype, _formatparam(param, value, requote)])
+ else:
+ ctype = ''
+ for old_param, old_value in self.get_params(header=header,
+ unquote=requote):
+ append_param = ''
+ if old_param.lower() == param.lower():
+ append_param = _formatparam(param, value, requote)
+ else:
+ append_param = _formatparam(old_param, old_value, requote)
+ if not ctype:
+ ctype = append_param
+ else:
+ ctype = SEMISPACE.join([ctype, append_param])
+ if ctype != self.get(header):
+ del self[header]
+ self[header] = ctype
+
+ def del_param(self, param, header='content-type', requote=True):
+ """Remove the given parameter completely from the Content-Type header.
+
+ The header will be re-written in place without the parameter or its
+ value. All values will be quoted as necessary unless requote is
+ False. Optional header specifies an alternative to the Content-Type
+ header.
+ """
+ if header not in self:
+ return
+ new_ctype = ''
+ for p, v in self.get_params(header=header, unquote=requote):
+ if p.lower() != param.lower():
+ if not new_ctype:
+ new_ctype = _formatparam(p, v, requote)
+ else:
+ new_ctype = SEMISPACE.join([new_ctype,
+ _formatparam(p, v, requote)])
+ if new_ctype != self.get(header):
+ del self[header]
+ self[header] = new_ctype
+
+ def set_type(self, type, header='Content-Type', requote=True):
+ """Set the main type and subtype for the Content-Type header.
+
+ type must be a string in the form "maintype/subtype", otherwise a
+ ValueError is raised.
+
+ This method replaces the Content-Type header, keeping all the
+ parameters in place. If requote is False, this leaves the existing
+ header's quoting as is. Otherwise, the parameters will be quoted (the
+ default).
+
+ An alternative header can be specified in the header argument. When
+ the Content-Type header is set, we'll always also add a MIME-Version
+ header.
+ """
+ # BAW: should we be strict?
+ if not type.count('/') == 1:
+ raise ValueError
+ # Set the Content-Type, you get a MIME-Version
+ if header.lower() == 'content-type':
+ del self['mime-version']
+ self['MIME-Version'] = '1.0'
+ if header not in self:
+ self[header] = type
+ return
+ params = self.get_params(header=header, unquote=requote)
+ del self[header]
+ self[header] = type
+ # Skip the first param; it's the old type.
+ for p, v in params[1:]:
+ self.set_param(p, v, header, requote)
+
+ def get_filename(self, failobj=None):
+ """Return the filename associated with the payload if present.
+
+ The filename is extracted from the Content-Disposition header's
+ `filename' parameter, and it is unquoted. If that header is missing
+ the `filename' parameter, this method falls back to looking for the
+ `name' parameter.
+ """
+ missing = object()
+ filename = self.get_param('filename', missing, 'content-disposition')
+ if filename is missing:
+ filename = self.get_param('name', missing, 'content-type')
+ if filename is missing:
+ return failobj
+ return utils.collapse_rfc2231_value(filename).strip()
+
+ def get_boundary(self, failobj=None):
+ """Return the boundary associated with the payload if present.
+
+ The boundary is extracted from the Content-Type header's `boundary'
+ parameter, and it is unquoted.
+ """
+ missing = object()
+ boundary = self.get_param('boundary', missing)
+ if boundary is missing:
+ return failobj
+ # RFC 2046 says that boundaries may begin but not end in w/s
+ return utils.collapse_rfc2231_value(boundary).rstrip()
+
+ def set_boundary(self, boundary):
+ """Set the boundary parameter in Content-Type to 'boundary'.
+
+ This is subtly different than deleting the Content-Type header and
+ adding a new one with a new boundary parameter via add_header(). The
+ main difference is that using the set_boundary() method preserves the
+ order of the Content-Type header in the original message.
+
+ HeaderParseError is raised if the message has no Content-Type header.
+ """
+ missing = object()
+ params = self._get_params_preserve(missing, 'content-type')
+ if params is missing:
+ # There was no Content-Type header, and we don't know what type
+ # to set it to, so raise an exception.
+ raise errors.HeaderParseError('No Content-Type header found')
+ newparams = []
+ foundp = False
+ for pk, pv in params:
+ if pk.lower() == 'boundary':
+ newparams.append(('boundary', '"%s"' % boundary))
+ foundp = True
+ else:
+ newparams.append((pk, pv))
+ if not foundp:
+ # The original Content-Type header had no boundary attribute.
+ # Tack one on the end. BAW: should we raise an exception
+ # instead???
+ newparams.append(('boundary', '"%s"' % boundary))
+ # Replace the existing Content-Type header with the new value
+ newheaders = []
+ for h, v in self._headers:
+ if h.lower() == 'content-type':
+ parts = []
+ for k, v in newparams:
+ if v == '':
+ parts.append(k)
+ else:
+ parts.append('%s=%s' % (k, v))
+ val = SEMISPACE.join(parts)
+ newheaders.append(self.policy.header_store_parse(h, val))
+
+ else:
+ newheaders.append((h, v))
+ self._headers = newheaders
+
+ def get_content_charset(self, failobj=None):
+ """Return the charset parameter of the Content-Type header.
+
+ The returned string is always coerced to lower case. If there is no
+ Content-Type header, or if that header has no charset parameter,
+ failobj is returned.
+ """
+ missing = object()
+ charset = self.get_param('charset', missing)
+ if charset is missing:
+ return failobj
+ if isinstance(charset, tuple):
+ # RFC 2231 encoded, so decode it, and it better end up as ascii.
+ pcharset = charset[0] or 'us-ascii'
+ try:
+ # LookupError will be raised if the charset isn't known to
+ # Python. UnicodeError will be raised if the encoded text
+ # contains a character not in the charset.
+ as_bytes = charset[2].encode('raw-unicode-escape')
+ charset = str(as_bytes, pcharset)
+ except (LookupError, UnicodeError):
+ charset = charset[2]
+ # charset characters must be in us-ascii range
+ try:
+ charset.encode('us-ascii')
+ except UnicodeError:
+ return failobj
+ # RFC 2046, $4.1.2 says charsets are not case sensitive
+ return charset.lower()
+
+ def get_charsets(self, failobj=None):
+ """Return a list containing the charset(s) used in this message.
+
+ The returned list of items describes the Content-Type headers'
+ charset parameter for this message and all the subparts in its
+ payload.
+
+ Each item will either be a string (the value of the charset parameter
+ in the Content-Type header of that part) or the value of the
+ 'failobj' parameter (defaults to None), if the part does not have a
+ main MIME type of "text", or the charset is not defined.
+
+ The list will contain one string for each part of the message, plus
+ one for the container message (i.e. self), so that a non-multipart
+ message will still return a list of length 1.
+ """
+ return [part.get_content_charset(failobj) for part in self.walk()]
+
+ # I.e. def walk(self): ...
+ from future.backports.email.iterators import walk
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/application.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/application.py
new file mode 100644
index 0000000..5cbfb17
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/application.py
@@ -0,0 +1,39 @@
+# Copyright (C) 2001-2006 Python Software Foundation
+# Author: Keith Dart
+# Contact: email-sig@python.org
+
+"""Class representing application/* type MIME documents."""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+from future.backports.email import encoders
+from future.backports.email.mime.nonmultipart import MIMENonMultipart
+
+__all__ = ["MIMEApplication"]
+
+
+class MIMEApplication(MIMENonMultipart):
+ """Class for generating application/* MIME documents."""
+
+ def __init__(self, _data, _subtype='octet-stream',
+ _encoder=encoders.encode_base64, **_params):
+ """Create an application/* type MIME document.
+
+ _data is a string containing the raw application data.
+
+ _subtype is the MIME content type subtype, defaulting to
+ 'octet-stream'.
+
+ _encoder is a function which will perform the actual encoding for
+ transport of the application data, defaulting to base64 encoding.
+
+ Any additional keyword arguments are passed to the base class
+ constructor, which turns them into parameters on the Content-Type
+ header.
+ """
+ if _subtype is None:
+ raise TypeError('Invalid application MIME subtype')
+ MIMENonMultipart.__init__(self, 'application', _subtype, **_params)
+ self.set_payload(_data)
+ _encoder(self)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/audio.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/audio.py
new file mode 100644
index 0000000..4989c11
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/audio.py
@@ -0,0 +1,74 @@
+# Copyright (C) 2001-2007 Python Software Foundation
+# Author: Anthony Baxter
+# Contact: email-sig@python.org
+
+"""Class representing audio/* type MIME documents."""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+__all__ = ['MIMEAudio']
+
+import sndhdr
+
+from io import BytesIO
+from future.backports.email import encoders
+from future.backports.email.mime.nonmultipart import MIMENonMultipart
+
+
+_sndhdr_MIMEmap = {'au' : 'basic',
+ 'wav' :'x-wav',
+ 'aiff':'x-aiff',
+ 'aifc':'x-aiff',
+ }
+
+# There are others in sndhdr that don't have MIME types. :(
+# Additional ones to be added to sndhdr? midi, mp3, realaudio, wma??
+def _whatsnd(data):
+ """Try to identify a sound file type.
+
+ sndhdr.what() has a pretty cruddy interface, unfortunately. This is why
+ we re-do it here. It would be easier to reverse engineer the Unix 'file'
+ command and use the standard 'magic' file, as shipped with a modern Unix.
+ """
+ hdr = data[:512]
+ fakefile = BytesIO(hdr)
+ for testfn in sndhdr.tests:
+ res = testfn(hdr, fakefile)
+ if res is not None:
+ return _sndhdr_MIMEmap.get(res[0])
+ return None
+
+
+class MIMEAudio(MIMENonMultipart):
+ """Class for generating audio/* MIME documents."""
+
+ def __init__(self, _audiodata, _subtype=None,
+ _encoder=encoders.encode_base64, **_params):
+ """Create an audio/* type MIME document.
+
+ _audiodata is a string containing the raw audio data. If this data
+ can be decoded by the standard Python `sndhdr' module, then the
+ subtype will be automatically included in the Content-Type header.
+ Otherwise, you can specify the specific audio subtype via the
+ _subtype parameter. If _subtype is not given, and no subtype can be
+ guessed, a TypeError is raised.
+
+ _encoder is a function which will perform the actual encoding for
+ transport of the image data. It takes one argument, which is this
+ Image instance. It should use get_payload() and set_payload() to
+ change the payload to the encoded form. It should also add any
+ Content-Transfer-Encoding or other headers to the message as
+ necessary. The default encoding is Base64.
+
+ Any additional keyword arguments are passed to the base class
+ constructor, which turns them into parameters on the Content-Type
+ header.
+ """
+ if _subtype is None:
+ _subtype = _whatsnd(_audiodata)
+ if _subtype is None:
+ raise TypeError('Could not find audio MIME subtype')
+ MIMENonMultipart.__init__(self, 'audio', _subtype, **_params)
+ self.set_payload(_audiodata)
+ _encoder(self)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/base.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/base.py
new file mode 100644
index 0000000..e77f3ca
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/base.py
@@ -0,0 +1,25 @@
+# Copyright (C) 2001-2006 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Base class for MIME specializations."""
+from __future__ import absolute_import, division, unicode_literals
+from future.backports.email import message
+
+__all__ = ['MIMEBase']
+
+
+class MIMEBase(message.Message):
+ """Base class for MIME specializations."""
+
+ def __init__(self, _maintype, _subtype, **_params):
+ """This constructor adds a Content-Type: and a MIME-Version: header.
+
+ The Content-Type: header is taken from the _maintype and _subtype
+ arguments. Additional parameters for this header are taken from the
+ keyword arguments.
+ """
+ message.Message.__init__(self)
+ ctype = '%s/%s' % (_maintype, _subtype)
+ self.add_header('Content-Type', ctype, **_params)
+ self['MIME-Version'] = '1.0'
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/image.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/image.py
new file mode 100644
index 0000000..a036024
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/image.py
@@ -0,0 +1,48 @@
+# Copyright (C) 2001-2006 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Class representing image/* type MIME documents."""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+__all__ = ['MIMEImage']
+
+import imghdr
+
+from future.backports.email import encoders
+from future.backports.email.mime.nonmultipart import MIMENonMultipart
+
+
+class MIMEImage(MIMENonMultipart):
+ """Class for generating image/* type MIME documents."""
+
+ def __init__(self, _imagedata, _subtype=None,
+ _encoder=encoders.encode_base64, **_params):
+ """Create an image/* type MIME document.
+
+ _imagedata is a string containing the raw image data. If this data
+ can be decoded by the standard Python `imghdr' module, then the
+ subtype will be automatically included in the Content-Type header.
+ Otherwise, you can specify the specific image subtype via the _subtype
+ parameter.
+
+ _encoder is a function which will perform the actual encoding for
+ transport of the image data. It takes one argument, which is this
+ Image instance. It should use get_payload() and set_payload() to
+ change the payload to the encoded form. It should also add any
+ Content-Transfer-Encoding or other headers to the message as
+ necessary. The default encoding is Base64.
+
+ Any additional keyword arguments are passed to the base class
+ constructor, which turns them into parameters on the Content-Type
+ header.
+ """
+ if _subtype is None:
+ _subtype = imghdr.what(None, _imagedata)
+ if _subtype is None:
+ raise TypeError('Could not guess image MIME subtype')
+ MIMENonMultipart.__init__(self, 'image', _subtype, **_params)
+ self.set_payload(_imagedata)
+ _encoder(self)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/message.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/message.py
new file mode 100644
index 0000000..7f92075
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/message.py
@@ -0,0 +1,36 @@
+# Copyright (C) 2001-2006 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Class representing message/* MIME documents."""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+__all__ = ['MIMEMessage']
+
+from future.backports.email import message
+from future.backports.email.mime.nonmultipart import MIMENonMultipart
+
+
+class MIMEMessage(MIMENonMultipart):
+ """Class representing message/* MIME documents."""
+
+ def __init__(self, _msg, _subtype='rfc822'):
+ """Create a message/* type MIME document.
+
+ _msg is a message object and must be an instance of Message, or a
+ derived class of Message, otherwise a TypeError is raised.
+
+ Optional _subtype defines the subtype of the contained message. The
+ default is "rfc822" (this is defined by the MIME standard, even though
+ the term "rfc822" is technically outdated by RFC 2822).
+ """
+ MIMENonMultipart.__init__(self, 'message', _subtype)
+ if not isinstance(_msg, message.Message):
+ raise TypeError('Argument is not an instance of Message')
+ # It's convenient to use this base class method. We need to do it
+ # this way or we'll get an exception
+ message.Message.attach(self, _msg)
+ # And be sure our default type is set correctly
+ self.set_default_type('message/rfc822')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/multipart.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/multipart.py
new file mode 100644
index 0000000..6d7ed3d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/multipart.py
@@ -0,0 +1,49 @@
+# Copyright (C) 2002-2006 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Base class for MIME multipart/* type messages."""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+__all__ = ['MIMEMultipart']
+
+from future.backports.email.mime.base import MIMEBase
+
+
+class MIMEMultipart(MIMEBase):
+ """Base class for MIME multipart/* type messages."""
+
+ def __init__(self, _subtype='mixed', boundary=None, _subparts=None,
+ **_params):
+ """Creates a multipart/* type message.
+
+ By default, creates a multipart/mixed message, with proper
+ Content-Type and MIME-Version headers.
+
+ _subtype is the subtype of the multipart content type, defaulting to
+ `mixed'.
+
+ boundary is the multipart boundary string. By default it is
+ calculated as needed.
+
+ _subparts is a sequence of initial subparts for the payload. It
+ must be an iterable object, such as a list. You can always
+ attach new subparts to the message by using the attach() method.
+
+ Additional parameters for the Content-Type header are taken from the
+ keyword arguments (or passed into the _params argument).
+ """
+ MIMEBase.__init__(self, 'multipart', _subtype, **_params)
+
+ # Initialise _payload to an empty list as the Message superclass's
+ # implementation of is_multipart assumes that _payload is a list for
+ # multipart messages.
+ self._payload = []
+
+ if _subparts:
+ for p in _subparts:
+ self.attach(p)
+ if boundary:
+ self.set_boundary(boundary)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/nonmultipart.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/nonmultipart.py
new file mode 100644
index 0000000..08c37c3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/nonmultipart.py
@@ -0,0 +1,24 @@
+# Copyright (C) 2002-2006 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Base class for MIME type messages that are not multipart."""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+__all__ = ['MIMENonMultipart']
+
+from future.backports.email import errors
+from future.backports.email.mime.base import MIMEBase
+
+
+class MIMENonMultipart(MIMEBase):
+ """Base class for MIME multipart/* type messages."""
+
+ def attach(self, payload):
+ # The public API prohibits attaching multiple subparts to MIMEBase
+ # derived subtypes since none of them are, by definition, of content
+ # type multipart/*
+ raise errors.MultipartConversionError(
+ 'Cannot attach additional subparts to non-multipart/*')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/text.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/text.py
new file mode 100644
index 0000000..6269f4a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/mime/text.py
@@ -0,0 +1,44 @@
+# Copyright (C) 2001-2006 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Class representing text/* type MIME documents."""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+__all__ = ['MIMEText']
+
+from future.backports.email.encoders import encode_7or8bit
+from future.backports.email.mime.nonmultipart import MIMENonMultipart
+
+
+class MIMEText(MIMENonMultipart):
+ """Class for generating text/* type MIME documents."""
+
+ def __init__(self, _text, _subtype='plain', _charset=None):
+ """Create a text/* type MIME document.
+
+ _text is the string for this message object.
+
+ _subtype is the MIME sub content type, defaulting to "plain".
+
+ _charset is the character set parameter added to the Content-Type
+ header. This defaults to "us-ascii". Note that as a side-effect, the
+ Content-Transfer-Encoding header will also be set.
+ """
+
+ # If no _charset was specified, check to see if there are non-ascii
+ # characters present. If not, use 'us-ascii', otherwise use utf-8.
+ # XXX: This can be removed once #7304 is fixed.
+ if _charset is None:
+ try:
+ _text.encode('us-ascii')
+ _charset = 'us-ascii'
+ except UnicodeEncodeError:
+ _charset = 'utf-8'
+
+ MIMENonMultipart.__init__(self, 'text', _subtype,
+ **{'charset': _charset})
+
+ self.set_payload(_text, _charset)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/parser.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/parser.py
new file mode 100644
index 0000000..df1c6e2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/parser.py
@@ -0,0 +1,135 @@
+# Copyright (C) 2001-2007 Python Software Foundation
+# Author: Barry Warsaw, Thomas Wouters, Anthony Baxter
+# Contact: email-sig@python.org
+
+"""A parser of RFC 2822 and MIME email messages."""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+
+__all__ = ['Parser', 'HeaderParser', 'BytesParser', 'BytesHeaderParser']
+
+import warnings
+from io import StringIO, TextIOWrapper
+
+from future.backports.email.feedparser import FeedParser, BytesFeedParser
+from future.backports.email.message import Message
+from future.backports.email._policybase import compat32
+
+
+class Parser(object):
+ def __init__(self, _class=Message, **_3to2kwargs):
+ """Parser of RFC 2822 and MIME email messages.
+
+ Creates an in-memory object tree representing the email message, which
+ can then be manipulated and turned over to a Generator to return the
+ textual representation of the message.
+
+ The string must be formatted as a block of RFC 2822 headers and header
+ continuation lines, optionally preceeded by a `Unix-from' header. The
+ header block is terminated either by the end of the string or by a
+ blank line.
+
+ _class is the class to instantiate for new message objects when they
+ must be created. This class must have a constructor that can take
+ zero arguments. Default is Message.Message.
+
+ The policy keyword specifies a policy object that controls a number of
+ aspects of the parser's operation. The default policy maintains
+ backward compatibility.
+
+ """
+ if 'policy' in _3to2kwargs: policy = _3to2kwargs['policy']; del _3to2kwargs['policy']
+ else: policy = compat32
+ self._class = _class
+ self.policy = policy
+
+ def parse(self, fp, headersonly=False):
+ """Create a message structure from the data in a file.
+
+ Reads all the data from the file and returns the root of the message
+ structure. Optional headersonly is a flag specifying whether to stop
+ parsing after reading the headers or not. The default is False,
+ meaning it parses the entire contents of the file.
+ """
+ feedparser = FeedParser(self._class, policy=self.policy)
+ if headersonly:
+ feedparser._set_headersonly()
+ while True:
+ data = fp.read(8192)
+ if not data:
+ break
+ feedparser.feed(data)
+ return feedparser.close()
+
+ def parsestr(self, text, headersonly=False):
+ """Create a message structure from a string.
+
+ Returns the root of the message structure. Optional headersonly is a
+ flag specifying whether to stop parsing after reading the headers or
+ not. The default is False, meaning it parses the entire contents of
+ the file.
+ """
+ return self.parse(StringIO(text), headersonly=headersonly)
+
+
+
+class HeaderParser(Parser):
+ def parse(self, fp, headersonly=True):
+ return Parser.parse(self, fp, True)
+
+ def parsestr(self, text, headersonly=True):
+ return Parser.parsestr(self, text, True)
+
+
+class BytesParser(object):
+
+ def __init__(self, *args, **kw):
+ """Parser of binary RFC 2822 and MIME email messages.
+
+ Creates an in-memory object tree representing the email message, which
+ can then be manipulated and turned over to a Generator to return the
+ textual representation of the message.
+
+ The input must be formatted as a block of RFC 2822 headers and header
+ continuation lines, optionally preceeded by a `Unix-from' header. The
+ header block is terminated either by the end of the input or by a
+ blank line.
+
+ _class is the class to instantiate for new message objects when they
+ must be created. This class must have a constructor that can take
+ zero arguments. Default is Message.Message.
+ """
+ self.parser = Parser(*args, **kw)
+
+ def parse(self, fp, headersonly=False):
+ """Create a message structure from the data in a binary file.
+
+ Reads all the data from the file and returns the root of the message
+ structure. Optional headersonly is a flag specifying whether to stop
+ parsing after reading the headers or not. The default is False,
+ meaning it parses the entire contents of the file.
+ """
+ fp = TextIOWrapper(fp, encoding='ascii', errors='surrogateescape')
+ with fp:
+ return self.parser.parse(fp, headersonly)
+
+
+ def parsebytes(self, text, headersonly=False):
+ """Create a message structure from a byte string.
+
+ Returns the root of the message structure. Optional headersonly is a
+ flag specifying whether to stop parsing after reading the headers or
+ not. The default is False, meaning it parses the entire contents of
+ the file.
+ """
+ text = text.decode('ASCII', errors='surrogateescape')
+ return self.parser.parsestr(text, headersonly)
+
+
+class BytesHeaderParser(BytesParser):
+ def parse(self, fp, headersonly=True):
+ return BytesParser.parse(self, fp, headersonly=True)
+
+ def parsebytes(self, text, headersonly=True):
+ return BytesParser.parsebytes(self, text, headersonly=True)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/policy.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/policy.py
new file mode 100644
index 0000000..2f609a2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/policy.py
@@ -0,0 +1,193 @@
+"""This will be the home for the policy that hooks in the new
+code that adds all the email6 features.
+"""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+from future.builtins import super
+
+from future.standard_library.email._policybase import (Policy, Compat32,
+ compat32, _extend_docstrings)
+from future.standard_library.email.utils import _has_surrogates
+from future.standard_library.email.headerregistry import HeaderRegistry as HeaderRegistry
+
+__all__ = [
+ 'Compat32',
+ 'compat32',
+ 'Policy',
+ 'EmailPolicy',
+ 'default',
+ 'strict',
+ 'SMTP',
+ 'HTTP',
+ ]
+
+@_extend_docstrings
+class EmailPolicy(Policy):
+
+ """+
+ PROVISIONAL
+
+ The API extensions enabled by this policy are currently provisional.
+ Refer to the documentation for details.
+
+ This policy adds new header parsing and folding algorithms. Instead of
+ simple strings, headers are custom objects with custom attributes
+ depending on the type of the field. The folding algorithm fully
+ implements RFCs 2047 and 5322.
+
+ In addition to the settable attributes listed above that apply to
+ all Policies, this policy adds the following additional attributes:
+
+ refold_source -- if the value for a header in the Message object
+ came from the parsing of some source, this attribute
+ indicates whether or not a generator should refold
+ that value when transforming the message back into
+ stream form. The possible values are:
+
+ none -- all source values use original folding
+ long -- source values that have any line that is
+ longer than max_line_length will be
+ refolded
+ all -- all values are refolded.
+
+ The default is 'long'.
+
+ header_factory -- a callable that takes two arguments, 'name' and
+ 'value', where 'name' is a header field name and
+ 'value' is an unfolded header field value, and
+ returns a string-like object that represents that
+ header. A default header_factory is provided that
+ understands some of the RFC5322 header field types.
+ (Currently address fields and date fields have
+ special treatment, while all other fields are
+ treated as unstructured. This list will be
+ completed before the extension is marked stable.)
+ """
+
+ refold_source = 'long'
+ header_factory = HeaderRegistry()
+
+ def __init__(self, **kw):
+ # Ensure that each new instance gets a unique header factory
+ # (as opposed to clones, which share the factory).
+ if 'header_factory' not in kw:
+ object.__setattr__(self, 'header_factory', HeaderRegistry())
+ super().__init__(**kw)
+
+ def header_max_count(self, name):
+ """+
+ The implementation for this class returns the max_count attribute from
+ the specialized header class that would be used to construct a header
+ of type 'name'.
+ """
+ return self.header_factory[name].max_count
+
+ # The logic of the next three methods is chosen such that it is possible to
+ # switch a Message object between a Compat32 policy and a policy derived
+ # from this class and have the results stay consistent. This allows a
+ # Message object constructed with this policy to be passed to a library
+ # that only handles Compat32 objects, or to receive such an object and
+ # convert it to use the newer style by just changing its policy. It is
+ # also chosen because it postpones the relatively expensive full rfc5322
+ # parse until as late as possible when parsing from source, since in many
+ # applications only a few headers will actually be inspected.
+
+ def header_source_parse(self, sourcelines):
+ """+
+ The name is parsed as everything up to the ':' and returned unmodified.
+ The value is determined by stripping leading whitespace off the
+ remainder of the first line, joining all subsequent lines together, and
+ stripping any trailing carriage return or linefeed characters. (This
+ is the same as Compat32).
+
+ """
+ name, value = sourcelines[0].split(':', 1)
+ value = value.lstrip(' \t') + ''.join(sourcelines[1:])
+ return (name, value.rstrip('\r\n'))
+
+ def header_store_parse(self, name, value):
+ """+
+ The name is returned unchanged. If the input value has a 'name'
+ attribute and it matches the name ignoring case, the value is returned
+ unchanged. Otherwise the name and value are passed to header_factory
+ method, and the resulting custom header object is returned as the
+ value. In this case a ValueError is raised if the input value contains
+ CR or LF characters.
+
+ """
+ if hasattr(value, 'name') and value.name.lower() == name.lower():
+ return (name, value)
+ if isinstance(value, str) and len(value.splitlines())>1:
+ raise ValueError("Header values may not contain linefeed "
+ "or carriage return characters")
+ return (name, self.header_factory(name, value))
+
+ def header_fetch_parse(self, name, value):
+ """+
+ If the value has a 'name' attribute, it is returned to unmodified.
+ Otherwise the name and the value with any linesep characters removed
+ are passed to the header_factory method, and the resulting custom
+ header object is returned. Any surrogateescaped bytes get turned
+ into the unicode unknown-character glyph.
+
+ """
+ if hasattr(value, 'name'):
+ return value
+ return self.header_factory(name, ''.join(value.splitlines()))
+
+ def fold(self, name, value):
+ """+
+ Header folding is controlled by the refold_source policy setting. A
+ value is considered to be a 'source value' if and only if it does not
+ have a 'name' attribute (having a 'name' attribute means it is a header
+ object of some sort). If a source value needs to be refolded according
+ to the policy, it is converted into a custom header object by passing
+ the name and the value with any linesep characters removed to the
+ header_factory method. Folding of a custom header object is done by
+ calling its fold method with the current policy.
+
+ Source values are split into lines using splitlines. If the value is
+ not to be refolded, the lines are rejoined using the linesep from the
+ policy and returned. The exception is lines containing non-ascii
+ binary data. In that case the value is refolded regardless of the
+ refold_source setting, which causes the binary data to be CTE encoded
+ using the unknown-8bit charset.
+
+ """
+ return self._fold(name, value, refold_binary=True)
+
+ def fold_binary(self, name, value):
+ """+
+ The same as fold if cte_type is 7bit, except that the returned value is
+ bytes.
+
+ If cte_type is 8bit, non-ASCII binary data is converted back into
+ bytes. Headers with binary data are not refolded, regardless of the
+ refold_header setting, since there is no way to know whether the binary
+ data consists of single byte characters or multibyte characters.
+
+ """
+ folded = self._fold(name, value, refold_binary=self.cte_type=='7bit')
+ return folded.encode('ascii', 'surrogateescape')
+
+ def _fold(self, name, value, refold_binary=False):
+ if hasattr(value, 'name'):
+ return value.fold(policy=self)
+ maxlen = self.max_line_length if self.max_line_length else float('inf')
+ lines = value.splitlines()
+ refold = (self.refold_source == 'all' or
+ self.refold_source == 'long' and
+ (lines and len(lines[0])+len(name)+2 > maxlen or
+ any(len(x) > maxlen for x in lines[1:])))
+ if refold or refold_binary and _has_surrogates(value):
+ return self.header_factory(name, ''.join(lines)).fold(policy=self)
+ return name + ': ' + self.linesep.join(lines) + self.linesep
+
+
+default = EmailPolicy()
+# Make the default policy use the class default header_factory
+del default.header_factory
+strict = default.clone(raise_on_defect=True)
+SMTP = default.clone(linesep='\r\n')
+HTTP = default.clone(linesep='\r\n', max_line_length=None)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/quoprimime.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/quoprimime.py
new file mode 100644
index 0000000..b69d158
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/quoprimime.py
@@ -0,0 +1,326 @@
+# Copyright (C) 2001-2006 Python Software Foundation
+# Author: Ben Gertzfield
+# Contact: email-sig@python.org
+
+"""Quoted-printable content transfer encoding per RFCs 2045-2047.
+
+This module handles the content transfer encoding method defined in RFC 2045
+to encode US ASCII-like 8-bit data called `quoted-printable'. It is used to
+safely encode text that is in a character set similar to the 7-bit US ASCII
+character set, but that includes some 8-bit characters that are normally not
+allowed in email bodies or headers.
+
+Quoted-printable is very space-inefficient for encoding binary files; use the
+email.base64mime module for that instead.
+
+This module provides an interface to encode and decode both headers and bodies
+with quoted-printable encoding.
+
+RFC 2045 defines a method for including character set information in an
+`encoded-word' in a header. This method is commonly used for 8-bit real names
+in To:/From:/Cc: etc. fields, as well as Subject: lines.
+
+This module does not do the line wrapping or end-of-line character
+conversion necessary for proper internationalized headers; it only
+does dumb encoding and decoding. To deal with the various line
+wrapping issues, use the email.header module.
+"""
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+from future.builtins import bytes, chr, dict, int, range, super
+
+__all__ = [
+ 'body_decode',
+ 'body_encode',
+ 'body_length',
+ 'decode',
+ 'decodestring',
+ 'header_decode',
+ 'header_encode',
+ 'header_length',
+ 'quote',
+ 'unquote',
+ ]
+
+import re
+import io
+
+from string import ascii_letters, digits, hexdigits
+
+CRLF = '\r\n'
+NL = '\n'
+EMPTYSTRING = ''
+
+# Build a mapping of octets to the expansion of that octet. Since we're only
+# going to have 256 of these things, this isn't terribly inefficient
+# space-wise. Remember that headers and bodies have different sets of safe
+# characters. Initialize both maps with the full expansion, and then override
+# the safe bytes with the more compact form.
+_QUOPRI_HEADER_MAP = dict((c, '=%02X' % c) for c in range(256))
+_QUOPRI_BODY_MAP = _QUOPRI_HEADER_MAP.copy()
+
+# Safe header bytes which need no encoding.
+for c in bytes(b'-!*+/' + ascii_letters.encode('ascii') + digits.encode('ascii')):
+ _QUOPRI_HEADER_MAP[c] = chr(c)
+# Headers have one other special encoding; spaces become underscores.
+_QUOPRI_HEADER_MAP[ord(' ')] = '_'
+
+# Safe body bytes which need no encoding.
+for c in bytes(b' !"#$%&\'()*+,-./0123456789:;<>'
+ b'?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`'
+ b'abcdefghijklmnopqrstuvwxyz{|}~\t'):
+ _QUOPRI_BODY_MAP[c] = chr(c)
+
+
+
+# Helpers
+def header_check(octet):
+ """Return True if the octet should be escaped with header quopri."""
+ return chr(octet) != _QUOPRI_HEADER_MAP[octet]
+
+
+def body_check(octet):
+ """Return True if the octet should be escaped with body quopri."""
+ return chr(octet) != _QUOPRI_BODY_MAP[octet]
+
+
+def header_length(bytearray):
+ """Return a header quoted-printable encoding length.
+
+ Note that this does not include any RFC 2047 chrome added by
+ `header_encode()`.
+
+ :param bytearray: An array of bytes (a.k.a. octets).
+ :return: The length in bytes of the byte array when it is encoded with
+ quoted-printable for headers.
+ """
+ return sum(len(_QUOPRI_HEADER_MAP[octet]) for octet in bytearray)
+
+
+def body_length(bytearray):
+ """Return a body quoted-printable encoding length.
+
+ :param bytearray: An array of bytes (a.k.a. octets).
+ :return: The length in bytes of the byte array when it is encoded with
+ quoted-printable for bodies.
+ """
+ return sum(len(_QUOPRI_BODY_MAP[octet]) for octet in bytearray)
+
+
+def _max_append(L, s, maxlen, extra=''):
+ if not isinstance(s, str):
+ s = chr(s)
+ if not L:
+ L.append(s.lstrip())
+ elif len(L[-1]) + len(s) <= maxlen:
+ L[-1] += extra + s
+ else:
+ L.append(s.lstrip())
+
+
+def unquote(s):
+ """Turn a string in the form =AB to the ASCII character with value 0xab"""
+ return chr(int(s[1:3], 16))
+
+
+def quote(c):
+ return '=%02X' % ord(c)
+
+
+
+def header_encode(header_bytes, charset='iso-8859-1'):
+ """Encode a single header line with quoted-printable (like) encoding.
+
+ Defined in RFC 2045, this `Q' encoding is similar to quoted-printable, but
+ used specifically for email header fields to allow charsets with mostly 7
+ bit characters (and some 8 bit) to remain more or less readable in non-RFC
+ 2045 aware mail clients.
+
+ charset names the character set to use in the RFC 2046 header. It
+ defaults to iso-8859-1.
+ """
+ # Return empty headers as an empty string.
+ if not header_bytes:
+ return ''
+ # Iterate over every byte, encoding if necessary.
+ encoded = []
+ for octet in header_bytes:
+ encoded.append(_QUOPRI_HEADER_MAP[octet])
+ # Now add the RFC chrome to each encoded chunk and glue the chunks
+ # together.
+ return '=?%s?q?%s?=' % (charset, EMPTYSTRING.join(encoded))
+
+
+class _body_accumulator(io.StringIO):
+
+ def __init__(self, maxlinelen, eol, *args, **kw):
+ super().__init__(*args, **kw)
+ self.eol = eol
+ self.maxlinelen = self.room = maxlinelen
+
+ def write_str(self, s):
+ """Add string s to the accumulated body."""
+ self.write(s)
+ self.room -= len(s)
+
+ def newline(self):
+ """Write eol, then start new line."""
+ self.write_str(self.eol)
+ self.room = self.maxlinelen
+
+ def write_soft_break(self):
+ """Write a soft break, then start a new line."""
+ self.write_str('=')
+ self.newline()
+
+ def write_wrapped(self, s, extra_room=0):
+ """Add a soft line break if needed, then write s."""
+ if self.room < len(s) + extra_room:
+ self.write_soft_break()
+ self.write_str(s)
+
+ def write_char(self, c, is_last_char):
+ if not is_last_char:
+ # Another character follows on this line, so we must leave
+ # extra room, either for it or a soft break, and whitespace
+ # need not be quoted.
+ self.write_wrapped(c, extra_room=1)
+ elif c not in ' \t':
+ # For this and remaining cases, no more characters follow,
+ # so there is no need to reserve extra room (since a hard
+ # break will immediately follow).
+ self.write_wrapped(c)
+ elif self.room >= 3:
+ # It's a whitespace character at end-of-line, and we have room
+ # for the three-character quoted encoding.
+ self.write(quote(c))
+ elif self.room == 2:
+ # There's room for the whitespace character and a soft break.
+ self.write(c)
+ self.write_soft_break()
+ else:
+ # There's room only for a soft break. The quoted whitespace
+ # will be the only content on the subsequent line.
+ self.write_soft_break()
+ self.write(quote(c))
+
+
+def body_encode(body, maxlinelen=76, eol=NL):
+ """Encode with quoted-printable, wrapping at maxlinelen characters.
+
+ Each line of encoded text will end with eol, which defaults to "\\n". Set
+ this to "\\r\\n" if you will be using the result of this function directly
+ in an email.
+
+ Each line will be wrapped at, at most, maxlinelen characters before the
+ eol string (maxlinelen defaults to 76 characters, the maximum value
+ permitted by RFC 2045). Long lines will have the 'soft line break'
+ quoted-printable character "=" appended to them, so the decoded text will
+ be identical to the original text.
+
+ The minimum maxlinelen is 4 to have room for a quoted character ("=XX")
+ followed by a soft line break. Smaller values will generate a
+ ValueError.
+
+ """
+
+ if maxlinelen < 4:
+ raise ValueError("maxlinelen must be at least 4")
+ if not body:
+ return body
+
+ # The last line may or may not end in eol, but all other lines do.
+ last_has_eol = (body[-1] in '\r\n')
+
+ # This accumulator will make it easier to build the encoded body.
+ encoded_body = _body_accumulator(maxlinelen, eol)
+
+ lines = body.splitlines()
+ last_line_no = len(lines) - 1
+ for line_no, line in enumerate(lines):
+ last_char_index = len(line) - 1
+ for i, c in enumerate(line):
+ if body_check(ord(c)):
+ c = quote(c)
+ encoded_body.write_char(c, i==last_char_index)
+ # Add an eol if input line had eol. All input lines have eol except
+ # possibly the last one.
+ if line_no < last_line_no or last_has_eol:
+ encoded_body.newline()
+
+ return encoded_body.getvalue()
+
+
+
+# BAW: I'm not sure if the intent was for the signature of this function to be
+# the same as base64MIME.decode() or not...
+def decode(encoded, eol=NL):
+ """Decode a quoted-printable string.
+
+ Lines are separated with eol, which defaults to \\n.
+ """
+ if not encoded:
+ return encoded
+ # BAW: see comment in encode() above. Again, we're building up the
+ # decoded string with string concatenation, which could be done much more
+ # efficiently.
+ decoded = ''
+
+ for line in encoded.splitlines():
+ line = line.rstrip()
+ if not line:
+ decoded += eol
+ continue
+
+ i = 0
+ n = len(line)
+ while i < n:
+ c = line[i]
+ if c != '=':
+ decoded += c
+ i += 1
+ # Otherwise, c == "=". Are we at the end of the line? If so, add
+ # a soft line break.
+ elif i+1 == n:
+ i += 1
+ continue
+ # Decode if in form =AB
+ elif i+2 < n and line[i+1] in hexdigits and line[i+2] in hexdigits:
+ decoded += unquote(line[i:i+3])
+ i += 3
+ # Otherwise, not in form =AB, pass literally
+ else:
+ decoded += c
+ i += 1
+
+ if i == n:
+ decoded += eol
+ # Special case if original string did not end with eol
+ if encoded[-1] not in '\r\n' and decoded.endswith(eol):
+ decoded = decoded[:-1]
+ return decoded
+
+
+# For convenience and backwards compatibility w/ standard base64 module
+body_decode = decode
+decodestring = decode
+
+
+
+def _unquote_match(match):
+ """Turn a match in the form =AB to the ASCII character with value 0xab"""
+ s = match.group(0)
+ return unquote(s)
+
+
+# Header decoding is done a bit differently
+def header_decode(s):
+ """Decode a string encoded with RFC 2045 MIME header `Q' encoding.
+
+ This function does not parse a full MIME header value encoded with
+ quoted-printable (like =?iso-8895-1?q?Hello_World?=) -- please use
+ the high level email.header class for that functionality.
+ """
+ s = s.replace('_', ' ')
+ return re.sub(r'=[a-fA-F0-9]{2}', _unquote_match, s, re.ASCII)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/utils.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/utils.py
new file mode 100644
index 0000000..4abebf7
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/email/utils.py
@@ -0,0 +1,400 @@
+# Copyright (C) 2001-2010 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Miscellaneous utilities."""
+
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+from future import utils
+from future.builtins import bytes, int, str
+
+__all__ = [
+ 'collapse_rfc2231_value',
+ 'decode_params',
+ 'decode_rfc2231',
+ 'encode_rfc2231',
+ 'formataddr',
+ 'formatdate',
+ 'format_datetime',
+ 'getaddresses',
+ 'make_msgid',
+ 'mktime_tz',
+ 'parseaddr',
+ 'parsedate',
+ 'parsedate_tz',
+ 'parsedate_to_datetime',
+ 'unquote',
+ ]
+
+import os
+import re
+if utils.PY2:
+ re.ASCII = 0
+import time
+import base64
+import random
+import socket
+from future.backports import datetime
+from future.backports.urllib.parse import quote as url_quote, unquote as url_unquote
+import warnings
+from io import StringIO
+
+from future.backports.email._parseaddr import quote
+from future.backports.email._parseaddr import AddressList as _AddressList
+from future.backports.email._parseaddr import mktime_tz
+
+from future.backports.email._parseaddr import parsedate, parsedate_tz, _parsedate_tz
+
+from quopri import decodestring as _qdecode
+
+# Intrapackage imports
+from future.backports.email.encoders import _bencode, _qencode
+from future.backports.email.charset import Charset
+
+COMMASPACE = ', '
+EMPTYSTRING = ''
+UEMPTYSTRING = ''
+CRLF = '\r\n'
+TICK = "'"
+
+specialsre = re.compile(r'[][\\()<>@,:;".]')
+escapesre = re.compile(r'[\\"]')
+
+# How to figure out if we are processing strings that come from a byte
+# source with undecodable characters.
+_has_surrogates = re.compile(
+ '([^\ud800-\udbff]|\A)[\udc00-\udfff]([^\udc00-\udfff]|\Z)').search
+
+# How to deal with a string containing bytes before handing it to the
+# application through the 'normal' interface.
+def _sanitize(string):
+ # Turn any escaped bytes into unicode 'unknown' char.
+ original_bytes = string.encode('ascii', 'surrogateescape')
+ return original_bytes.decode('ascii', 'replace')
+
+
+# Helpers
+
+def formataddr(pair, charset='utf-8'):
+ """The inverse of parseaddr(), this takes a 2-tuple of the form
+ (realname, email_address) and returns the string value suitable
+ for an RFC 2822 From, To or Cc header.
+
+ If the first element of pair is false, then the second element is
+ returned unmodified.
+
+ Optional charset if given is the character set that is used to encode
+ realname in case realname is not ASCII safe. Can be an instance of str or
+ a Charset-like object which has a header_encode method. Default is
+ 'utf-8'.
+ """
+ name, address = pair
+ # The address MUST (per RFC) be ascii, so raise an UnicodeError if it isn't.
+ address.encode('ascii')
+ if name:
+ try:
+ name.encode('ascii')
+ except UnicodeEncodeError:
+ if isinstance(charset, str):
+ charset = Charset(charset)
+ encoded_name = charset.header_encode(name)
+ return "%s <%s>" % (encoded_name, address)
+ else:
+ quotes = ''
+ if specialsre.search(name):
+ quotes = '"'
+ name = escapesre.sub(r'\\\g<0>', name)
+ return '%s%s%s <%s>' % (quotes, name, quotes, address)
+ return address
+
+
+
+def getaddresses(fieldvalues):
+ """Return a list of (REALNAME, EMAIL) for each fieldvalue."""
+ all = COMMASPACE.join(fieldvalues)
+ a = _AddressList(all)
+ return a.addresslist
+
+
+
+ecre = re.compile(r'''
+ =\? # literal =?
+ (?P[^?]*?) # non-greedy up to the next ? is the charset
+ \? # literal ?
+ (?P[qb]) # either a "q" or a "b", case insensitive
+ \? # literal ?
+ (?P.*?) # non-greedy up to the next ?= is the atom
+ \?= # literal ?=
+ ''', re.VERBOSE | re.IGNORECASE)
+
+
+def _format_timetuple_and_zone(timetuple, zone):
+ return '%s, %02d %s %04d %02d:%02d:%02d %s' % (
+ ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'][timetuple[6]],
+ timetuple[2],
+ ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][timetuple[1] - 1],
+ timetuple[0], timetuple[3], timetuple[4], timetuple[5],
+ zone)
+
+def formatdate(timeval=None, localtime=False, usegmt=False):
+ """Returns a date string as specified by RFC 2822, e.g.:
+
+ Fri, 09 Nov 2001 01:08:47 -0000
+
+ Optional timeval if given is a floating point time value as accepted by
+ gmtime() and localtime(), otherwise the current time is used.
+
+ Optional localtime is a flag that when True, interprets timeval, and
+ returns a date relative to the local timezone instead of UTC, properly
+ taking daylight savings time into account.
+
+ Optional argument usegmt means that the timezone is written out as
+ an ascii string, not numeric one (so "GMT" instead of "+0000"). This
+ is needed for HTTP, and is only used when localtime==False.
+ """
+ # Note: we cannot use strftime() because that honors the locale and RFC
+ # 2822 requires that day and month names be the English abbreviations.
+ if timeval is None:
+ timeval = time.time()
+ if localtime:
+ now = time.localtime(timeval)
+ # Calculate timezone offset, based on whether the local zone has
+ # daylight savings time, and whether DST is in effect.
+ if time.daylight and now[-1]:
+ offset = time.altzone
+ else:
+ offset = time.timezone
+ hours, minutes = divmod(abs(offset), 3600)
+ # Remember offset is in seconds west of UTC, but the timezone is in
+ # minutes east of UTC, so the signs differ.
+ if offset > 0:
+ sign = '-'
+ else:
+ sign = '+'
+ zone = '%s%02d%02d' % (sign, hours, minutes // 60)
+ else:
+ now = time.gmtime(timeval)
+ # Timezone offset is always -0000
+ if usegmt:
+ zone = 'GMT'
+ else:
+ zone = '-0000'
+ return _format_timetuple_and_zone(now, zone)
+
+def format_datetime(dt, usegmt=False):
+ """Turn a datetime into a date string as specified in RFC 2822.
+
+ If usegmt is True, dt must be an aware datetime with an offset of zero. In
+ this case 'GMT' will be rendered instead of the normal +0000 required by
+ RFC2822. This is to support HTTP headers involving date stamps.
+ """
+ now = dt.timetuple()
+ if usegmt:
+ if dt.tzinfo is None or dt.tzinfo != datetime.timezone.utc:
+ raise ValueError("usegmt option requires a UTC datetime")
+ zone = 'GMT'
+ elif dt.tzinfo is None:
+ zone = '-0000'
+ else:
+ zone = dt.strftime("%z")
+ return _format_timetuple_and_zone(now, zone)
+
+
+def make_msgid(idstring=None, domain=None):
+ """Returns a string suitable for RFC 2822 compliant Message-ID, e.g:
+
+ <20020201195627.33539.96671@nightshade.la.mastaler.com>
+
+ Optional idstring if given is a string used to strengthen the
+ uniqueness of the message id. Optional domain if given provides the
+ portion of the message id after the '@'. It defaults to the locally
+ defined hostname.
+ """
+ timeval = time.time()
+ utcdate = time.strftime('%Y%m%d%H%M%S', time.gmtime(timeval))
+ pid = os.getpid()
+ randint = random.randrange(100000)
+ if idstring is None:
+ idstring = ''
+ else:
+ idstring = '.' + idstring
+ if domain is None:
+ domain = socket.getfqdn()
+ msgid = '<%s.%s.%s%s@%s>' % (utcdate, pid, randint, idstring, domain)
+ return msgid
+
+
+def parsedate_to_datetime(data):
+ _3to2list = list(_parsedate_tz(data))
+ dtuple, tz, = [_3to2list[:-1]] + _3to2list[-1:]
+ if tz is None:
+ return datetime.datetime(*dtuple[:6])
+ return datetime.datetime(*dtuple[:6],
+ tzinfo=datetime.timezone(datetime.timedelta(seconds=tz)))
+
+
+def parseaddr(addr):
+ addrs = _AddressList(addr).addresslist
+ if not addrs:
+ return '', ''
+ return addrs[0]
+
+
+# rfc822.unquote() doesn't properly de-backslash-ify in Python pre-2.3.
+def unquote(str):
+ """Remove quotes from a string."""
+ if len(str) > 1:
+ if str.startswith('"') and str.endswith('"'):
+ return str[1:-1].replace('\\\\', '\\').replace('\\"', '"')
+ if str.startswith('<') and str.endswith('>'):
+ return str[1:-1]
+ return str
+
+
+
+# RFC2231-related functions - parameter encoding and decoding
+def decode_rfc2231(s):
+ """Decode string according to RFC 2231"""
+ parts = s.split(TICK, 2)
+ if len(parts) <= 2:
+ return None, None, s
+ return parts
+
+
+def encode_rfc2231(s, charset=None, language=None):
+ """Encode string according to RFC 2231.
+
+ If neither charset nor language is given, then s is returned as-is. If
+ charset is given but not language, the string is encoded using the empty
+ string for language.
+ """
+ s = url_quote(s, safe='', encoding=charset or 'ascii')
+ if charset is None and language is None:
+ return s
+ if language is None:
+ language = ''
+ return "%s'%s'%s" % (charset, language, s)
+
+
+rfc2231_continuation = re.compile(r'^(?P\w+)\*((?P[0-9]+)\*?)?$',
+ re.ASCII)
+
+def decode_params(params):
+ """Decode parameters list according to RFC 2231.
+
+ params is a sequence of 2-tuples containing (param name, string value).
+ """
+ # Copy params so we don't mess with the original
+ params = params[:]
+ new_params = []
+ # Map parameter's name to a list of continuations. The values are a
+ # 3-tuple of the continuation number, the string value, and a flag
+ # specifying whether a particular segment is %-encoded.
+ rfc2231_params = {}
+ name, value = params.pop(0)
+ new_params.append((name, value))
+ while params:
+ name, value = params.pop(0)
+ if name.endswith('*'):
+ encoded = True
+ else:
+ encoded = False
+ value = unquote(value)
+ mo = rfc2231_continuation.match(name)
+ if mo:
+ name, num = mo.group('name', 'num')
+ if num is not None:
+ num = int(num)
+ rfc2231_params.setdefault(name, []).append((num, value, encoded))
+ else:
+ new_params.append((name, '"%s"' % quote(value)))
+ if rfc2231_params:
+ for name, continuations in rfc2231_params.items():
+ value = []
+ extended = False
+ # Sort by number
+ continuations.sort()
+ # And now append all values in numerical order, converting
+ # %-encodings for the encoded segments. If any of the
+ # continuation names ends in a *, then the entire string, after
+ # decoding segments and concatenating, must have the charset and
+ # language specifiers at the beginning of the string.
+ for num, s, encoded in continuations:
+ if encoded:
+ # Decode as "latin-1", so the characters in s directly
+ # represent the percent-encoded octet values.
+ # collapse_rfc2231_value treats this as an octet sequence.
+ s = url_unquote(s, encoding="latin-1")
+ extended = True
+ value.append(s)
+ value = quote(EMPTYSTRING.join(value))
+ if extended:
+ charset, language, value = decode_rfc2231(value)
+ new_params.append((name, (charset, language, '"%s"' % value)))
+ else:
+ new_params.append((name, '"%s"' % value))
+ return new_params
+
+def collapse_rfc2231_value(value, errors='replace',
+ fallback_charset='us-ascii'):
+ if not isinstance(value, tuple) or len(value) != 3:
+ return unquote(value)
+ # While value comes to us as a unicode string, we need it to be a bytes
+ # object. We do not want bytes() normal utf-8 decoder, we want a straight
+ # interpretation of the string as character bytes.
+ charset, language, text = value
+ rawbytes = bytes(text, 'raw-unicode-escape')
+ try:
+ return str(rawbytes, charset, errors)
+ except LookupError:
+ # charset is not a known codec.
+ return unquote(text)
+
+
+#
+# datetime doesn't provide a localtime function yet, so provide one. Code
+# adapted from the patch in issue 9527. This may not be perfect, but it is
+# better than not having it.
+#
+
+def localtime(dt=None, isdst=-1):
+ """Return local time as an aware datetime object.
+
+ If called without arguments, return current time. Otherwise *dt*
+ argument should be a datetime instance, and it is converted to the
+ local time zone according to the system time zone database. If *dt* is
+ naive (that is, dt.tzinfo is None), it is assumed to be in local time.
+ In this case, a positive or zero value for *isdst* causes localtime to
+ presume initially that summer time (for example, Daylight Saving Time)
+ is or is not (respectively) in effect for the specified time. A
+ negative value for *isdst* causes the localtime() function to attempt
+ to divine whether summer time is in effect for the specified time.
+
+ """
+ if dt is None:
+ return datetime.datetime.now(datetime.timezone.utc).astimezone()
+ if dt.tzinfo is not None:
+ return dt.astimezone()
+ # We have a naive datetime. Convert to a (localtime) timetuple and pass to
+ # system mktime together with the isdst hint. System mktime will return
+ # seconds since epoch.
+ tm = dt.timetuple()[:-1] + (isdst,)
+ seconds = time.mktime(tm)
+ localtm = time.localtime(seconds)
+ try:
+ delta = datetime.timedelta(seconds=localtm.tm_gmtoff)
+ tz = datetime.timezone(delta, localtm.tm_zone)
+ except AttributeError:
+ # Compute UTC offset and compare with the value implied by tm_isdst.
+ # If the values match, use the zone name implied by tm_isdst.
+ delta = dt - datetime.datetime(*time.gmtime(seconds)[:6])
+ dst = time.daylight and localtm.tm_isdst > 0
+ gmtoff = -(time.altzone if dst else time.timezone)
+ if delta == datetime.timedelta(seconds=gmtoff):
+ tz = datetime.timezone(delta, time.tzname[dst])
+ else:
+ tz = datetime.timezone(delta)
+ return dt.replace(tzinfo=tz)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/html/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/html/__init__.py
new file mode 100644
index 0000000..837afce
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/html/__init__.py
@@ -0,0 +1,28 @@
+"""
+General functions for HTML manipulation, backported from Py3.
+
+Note that this uses Python 2.7 code with the corresponding Python 3
+module names and locations.
+"""
+
+from __future__ import unicode_literals
+
+
+_escape_map = {ord('&'): '&', ord('<'): '<', ord('>'): '>'}
+_escape_map_full = {ord('&'): '&', ord('<'): '<', ord('>'): '>',
+ ord('"'): '"', ord('\''): '''}
+
+# NB: this is a candidate for a bytes/string polymorphic interface
+
+def escape(s, quote=True):
+ """
+ Replace special characters "&", "<" and ">" to HTML-safe sequences.
+ If the optional flag quote is true (the default), the quotation mark
+ characters, both double quote (") and single quote (') characters are also
+ translated.
+ """
+ assert not isinstance(s, bytes), 'Pass a unicode string'
+ if quote:
+ return s.translate(_escape_map_full)
+ return s.translate(_escape_map)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/html/entities.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/html/entities.py
new file mode 100644
index 0000000..6798187
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/html/entities.py
@@ -0,0 +1,2515 @@
+"""HTML character entity references.
+
+Backported for python-future from Python 3.3
+"""
+
+from __future__ import (absolute_import, division,
+ print_function, unicode_literals)
+from future.builtins import *
+
+
+# maps the HTML entity name to the Unicode codepoint
+name2codepoint = {
+ 'AElig': 0x00c6, # latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1
+ 'Aacute': 0x00c1, # latin capital letter A with acute, U+00C1 ISOlat1
+ 'Acirc': 0x00c2, # latin capital letter A with circumflex, U+00C2 ISOlat1
+ 'Agrave': 0x00c0, # latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1
+ 'Alpha': 0x0391, # greek capital letter alpha, U+0391
+ 'Aring': 0x00c5, # latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1
+ 'Atilde': 0x00c3, # latin capital letter A with tilde, U+00C3 ISOlat1
+ 'Auml': 0x00c4, # latin capital letter A with diaeresis, U+00C4 ISOlat1
+ 'Beta': 0x0392, # greek capital letter beta, U+0392
+ 'Ccedil': 0x00c7, # latin capital letter C with cedilla, U+00C7 ISOlat1
+ 'Chi': 0x03a7, # greek capital letter chi, U+03A7
+ 'Dagger': 0x2021, # double dagger, U+2021 ISOpub
+ 'Delta': 0x0394, # greek capital letter delta, U+0394 ISOgrk3
+ 'ETH': 0x00d0, # latin capital letter ETH, U+00D0 ISOlat1
+ 'Eacute': 0x00c9, # latin capital letter E with acute, U+00C9 ISOlat1
+ 'Ecirc': 0x00ca, # latin capital letter E with circumflex, U+00CA ISOlat1
+ 'Egrave': 0x00c8, # latin capital letter E with grave, U+00C8 ISOlat1
+ 'Epsilon': 0x0395, # greek capital letter epsilon, U+0395
+ 'Eta': 0x0397, # greek capital letter eta, U+0397
+ 'Euml': 0x00cb, # latin capital letter E with diaeresis, U+00CB ISOlat1
+ 'Gamma': 0x0393, # greek capital letter gamma, U+0393 ISOgrk3
+ 'Iacute': 0x00cd, # latin capital letter I with acute, U+00CD ISOlat1
+ 'Icirc': 0x00ce, # latin capital letter I with circumflex, U+00CE ISOlat1
+ 'Igrave': 0x00cc, # latin capital letter I with grave, U+00CC ISOlat1
+ 'Iota': 0x0399, # greek capital letter iota, U+0399
+ 'Iuml': 0x00cf, # latin capital letter I with diaeresis, U+00CF ISOlat1
+ 'Kappa': 0x039a, # greek capital letter kappa, U+039A
+ 'Lambda': 0x039b, # greek capital letter lambda, U+039B ISOgrk3
+ 'Mu': 0x039c, # greek capital letter mu, U+039C
+ 'Ntilde': 0x00d1, # latin capital letter N with tilde, U+00D1 ISOlat1
+ 'Nu': 0x039d, # greek capital letter nu, U+039D
+ 'OElig': 0x0152, # latin capital ligature OE, U+0152 ISOlat2
+ 'Oacute': 0x00d3, # latin capital letter O with acute, U+00D3 ISOlat1
+ 'Ocirc': 0x00d4, # latin capital letter O with circumflex, U+00D4 ISOlat1
+ 'Ograve': 0x00d2, # latin capital letter O with grave, U+00D2 ISOlat1
+ 'Omega': 0x03a9, # greek capital letter omega, U+03A9 ISOgrk3
+ 'Omicron': 0x039f, # greek capital letter omicron, U+039F
+ 'Oslash': 0x00d8, # latin capital letter O with stroke = latin capital letter O slash, U+00D8 ISOlat1
+ 'Otilde': 0x00d5, # latin capital letter O with tilde, U+00D5 ISOlat1
+ 'Ouml': 0x00d6, # latin capital letter O with diaeresis, U+00D6 ISOlat1
+ 'Phi': 0x03a6, # greek capital letter phi, U+03A6 ISOgrk3
+ 'Pi': 0x03a0, # greek capital letter pi, U+03A0 ISOgrk3
+ 'Prime': 0x2033, # double prime = seconds = inches, U+2033 ISOtech
+ 'Psi': 0x03a8, # greek capital letter psi, U+03A8 ISOgrk3
+ 'Rho': 0x03a1, # greek capital letter rho, U+03A1
+ 'Scaron': 0x0160, # latin capital letter S with caron, U+0160 ISOlat2
+ 'Sigma': 0x03a3, # greek capital letter sigma, U+03A3 ISOgrk3
+ 'THORN': 0x00de, # latin capital letter THORN, U+00DE ISOlat1
+ 'Tau': 0x03a4, # greek capital letter tau, U+03A4
+ 'Theta': 0x0398, # greek capital letter theta, U+0398 ISOgrk3
+ 'Uacute': 0x00da, # latin capital letter U with acute, U+00DA ISOlat1
+ 'Ucirc': 0x00db, # latin capital letter U with circumflex, U+00DB ISOlat1
+ 'Ugrave': 0x00d9, # latin capital letter U with grave, U+00D9 ISOlat1
+ 'Upsilon': 0x03a5, # greek capital letter upsilon, U+03A5 ISOgrk3
+ 'Uuml': 0x00dc, # latin capital letter U with diaeresis, U+00DC ISOlat1
+ 'Xi': 0x039e, # greek capital letter xi, U+039E ISOgrk3
+ 'Yacute': 0x00dd, # latin capital letter Y with acute, U+00DD ISOlat1
+ 'Yuml': 0x0178, # latin capital letter Y with diaeresis, U+0178 ISOlat2
+ 'Zeta': 0x0396, # greek capital letter zeta, U+0396
+ 'aacute': 0x00e1, # latin small letter a with acute, U+00E1 ISOlat1
+ 'acirc': 0x00e2, # latin small letter a with circumflex, U+00E2 ISOlat1
+ 'acute': 0x00b4, # acute accent = spacing acute, U+00B4 ISOdia
+ 'aelig': 0x00e6, # latin small letter ae = latin small ligature ae, U+00E6 ISOlat1
+ 'agrave': 0x00e0, # latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1
+ 'alefsym': 0x2135, # alef symbol = first transfinite cardinal, U+2135 NEW
+ 'alpha': 0x03b1, # greek small letter alpha, U+03B1 ISOgrk3
+ 'amp': 0x0026, # ampersand, U+0026 ISOnum
+ 'and': 0x2227, # logical and = wedge, U+2227 ISOtech
+ 'ang': 0x2220, # angle, U+2220 ISOamso
+ 'aring': 0x00e5, # latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1
+ 'asymp': 0x2248, # almost equal to = asymptotic to, U+2248 ISOamsr
+ 'atilde': 0x00e3, # latin small letter a with tilde, U+00E3 ISOlat1
+ 'auml': 0x00e4, # latin small letter a with diaeresis, U+00E4 ISOlat1
+ 'bdquo': 0x201e, # double low-9 quotation mark, U+201E NEW
+ 'beta': 0x03b2, # greek small letter beta, U+03B2 ISOgrk3
+ 'brvbar': 0x00a6, # broken bar = broken vertical bar, U+00A6 ISOnum
+ 'bull': 0x2022, # bullet = black small circle, U+2022 ISOpub
+ 'cap': 0x2229, # intersection = cap, U+2229 ISOtech
+ 'ccedil': 0x00e7, # latin small letter c with cedilla, U+00E7 ISOlat1
+ 'cedil': 0x00b8, # cedilla = spacing cedilla, U+00B8 ISOdia
+ 'cent': 0x00a2, # cent sign, U+00A2 ISOnum
+ 'chi': 0x03c7, # greek small letter chi, U+03C7 ISOgrk3
+ 'circ': 0x02c6, # modifier letter circumflex accent, U+02C6 ISOpub
+ 'clubs': 0x2663, # black club suit = shamrock, U+2663 ISOpub
+ 'cong': 0x2245, # approximately equal to, U+2245 ISOtech
+ 'copy': 0x00a9, # copyright sign, U+00A9 ISOnum
+ 'crarr': 0x21b5, # downwards arrow with corner leftwards = carriage return, U+21B5 NEW
+ 'cup': 0x222a, # union = cup, U+222A ISOtech
+ 'curren': 0x00a4, # currency sign, U+00A4 ISOnum
+ 'dArr': 0x21d3, # downwards double arrow, U+21D3 ISOamsa
+ 'dagger': 0x2020, # dagger, U+2020 ISOpub
+ 'darr': 0x2193, # downwards arrow, U+2193 ISOnum
+ 'deg': 0x00b0, # degree sign, U+00B0 ISOnum
+ 'delta': 0x03b4, # greek small letter delta, U+03B4 ISOgrk3
+ 'diams': 0x2666, # black diamond suit, U+2666 ISOpub
+ 'divide': 0x00f7, # division sign, U+00F7 ISOnum
+ 'eacute': 0x00e9, # latin small letter e with acute, U+00E9 ISOlat1
+ 'ecirc': 0x00ea, # latin small letter e with circumflex, U+00EA ISOlat1
+ 'egrave': 0x00e8, # latin small letter e with grave, U+00E8 ISOlat1
+ 'empty': 0x2205, # empty set = null set = diameter, U+2205 ISOamso
+ 'emsp': 0x2003, # em space, U+2003 ISOpub
+ 'ensp': 0x2002, # en space, U+2002 ISOpub
+ 'epsilon': 0x03b5, # greek small letter epsilon, U+03B5 ISOgrk3
+ 'equiv': 0x2261, # identical to, U+2261 ISOtech
+ 'eta': 0x03b7, # greek small letter eta, U+03B7 ISOgrk3
+ 'eth': 0x00f0, # latin small letter eth, U+00F0 ISOlat1
+ 'euml': 0x00eb, # latin small letter e with diaeresis, U+00EB ISOlat1
+ 'euro': 0x20ac, # euro sign, U+20AC NEW
+ 'exist': 0x2203, # there exists, U+2203 ISOtech
+ 'fnof': 0x0192, # latin small f with hook = function = florin, U+0192 ISOtech
+ 'forall': 0x2200, # for all, U+2200 ISOtech
+ 'frac12': 0x00bd, # vulgar fraction one half = fraction one half, U+00BD ISOnum
+ 'frac14': 0x00bc, # vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum
+ 'frac34': 0x00be, # vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum
+ 'frasl': 0x2044, # fraction slash, U+2044 NEW
+ 'gamma': 0x03b3, # greek small letter gamma, U+03B3 ISOgrk3
+ 'ge': 0x2265, # greater-than or equal to, U+2265 ISOtech
+ 'gt': 0x003e, # greater-than sign, U+003E ISOnum
+ 'hArr': 0x21d4, # left right double arrow, U+21D4 ISOamsa
+ 'harr': 0x2194, # left right arrow, U+2194 ISOamsa
+ 'hearts': 0x2665, # black heart suit = valentine, U+2665 ISOpub
+ 'hellip': 0x2026, # horizontal ellipsis = three dot leader, U+2026 ISOpub
+ 'iacute': 0x00ed, # latin small letter i with acute, U+00ED ISOlat1
+ 'icirc': 0x00ee, # latin small letter i with circumflex, U+00EE ISOlat1
+ 'iexcl': 0x00a1, # inverted exclamation mark, U+00A1 ISOnum
+ 'igrave': 0x00ec, # latin small letter i with grave, U+00EC ISOlat1
+ 'image': 0x2111, # blackletter capital I = imaginary part, U+2111 ISOamso
+ 'infin': 0x221e, # infinity, U+221E ISOtech
+ 'int': 0x222b, # integral, U+222B ISOtech
+ 'iota': 0x03b9, # greek small letter iota, U+03B9 ISOgrk3
+ 'iquest': 0x00bf, # inverted question mark = turned question mark, U+00BF ISOnum
+ 'isin': 0x2208, # element of, U+2208 ISOtech
+ 'iuml': 0x00ef, # latin small letter i with diaeresis, U+00EF ISOlat1
+ 'kappa': 0x03ba, # greek small letter kappa, U+03BA ISOgrk3
+ 'lArr': 0x21d0, # leftwards double arrow, U+21D0 ISOtech
+ 'lambda': 0x03bb, # greek small letter lambda, U+03BB ISOgrk3
+ 'lang': 0x2329, # left-pointing angle bracket = bra, U+2329 ISOtech
+ 'laquo': 0x00ab, # left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum
+ 'larr': 0x2190, # leftwards arrow, U+2190 ISOnum
+ 'lceil': 0x2308, # left ceiling = apl upstile, U+2308 ISOamsc
+ 'ldquo': 0x201c, # left double quotation mark, U+201C ISOnum
+ 'le': 0x2264, # less-than or equal to, U+2264 ISOtech
+ 'lfloor': 0x230a, # left floor = apl downstile, U+230A ISOamsc
+ 'lowast': 0x2217, # asterisk operator, U+2217 ISOtech
+ 'loz': 0x25ca, # lozenge, U+25CA ISOpub
+ 'lrm': 0x200e, # left-to-right mark, U+200E NEW RFC 2070
+ 'lsaquo': 0x2039, # single left-pointing angle quotation mark, U+2039 ISO proposed
+ 'lsquo': 0x2018, # left single quotation mark, U+2018 ISOnum
+ 'lt': 0x003c, # less-than sign, U+003C ISOnum
+ 'macr': 0x00af, # macron = spacing macron = overline = APL overbar, U+00AF ISOdia
+ 'mdash': 0x2014, # em dash, U+2014 ISOpub
+ 'micro': 0x00b5, # micro sign, U+00B5 ISOnum
+ 'middot': 0x00b7, # middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum
+ 'minus': 0x2212, # minus sign, U+2212 ISOtech
+ 'mu': 0x03bc, # greek small letter mu, U+03BC ISOgrk3
+ 'nabla': 0x2207, # nabla = backward difference, U+2207 ISOtech
+ 'nbsp': 0x00a0, # no-break space = non-breaking space, U+00A0 ISOnum
+ 'ndash': 0x2013, # en dash, U+2013 ISOpub
+ 'ne': 0x2260, # not equal to, U+2260 ISOtech
+ 'ni': 0x220b, # contains as member, U+220B ISOtech
+ 'not': 0x00ac, # not sign, U+00AC ISOnum
+ 'notin': 0x2209, # not an element of, U+2209 ISOtech
+ 'nsub': 0x2284, # not a subset of, U+2284 ISOamsn
+ 'ntilde': 0x00f1, # latin small letter n with tilde, U+00F1 ISOlat1
+ 'nu': 0x03bd, # greek small letter nu, U+03BD ISOgrk3
+ 'oacute': 0x00f3, # latin small letter o with acute, U+00F3 ISOlat1
+ 'ocirc': 0x00f4, # latin small letter o with circumflex, U+00F4 ISOlat1
+ 'oelig': 0x0153, # latin small ligature oe, U+0153 ISOlat2
+ 'ograve': 0x00f2, # latin small letter o with grave, U+00F2 ISOlat1
+ 'oline': 0x203e, # overline = spacing overscore, U+203E NEW
+ 'omega': 0x03c9, # greek small letter omega, U+03C9 ISOgrk3
+ 'omicron': 0x03bf, # greek small letter omicron, U+03BF NEW
+ 'oplus': 0x2295, # circled plus = direct sum, U+2295 ISOamsb
+ 'or': 0x2228, # logical or = vee, U+2228 ISOtech
+ 'ordf': 0x00aa, # feminine ordinal indicator, U+00AA ISOnum
+ 'ordm': 0x00ba, # masculine ordinal indicator, U+00BA ISOnum
+ 'oslash': 0x00f8, # latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1
+ 'otilde': 0x00f5, # latin small letter o with tilde, U+00F5 ISOlat1
+ 'otimes': 0x2297, # circled times = vector product, U+2297 ISOamsb
+ 'ouml': 0x00f6, # latin small letter o with diaeresis, U+00F6 ISOlat1
+ 'para': 0x00b6, # pilcrow sign = paragraph sign, U+00B6 ISOnum
+ 'part': 0x2202, # partial differential, U+2202 ISOtech
+ 'permil': 0x2030, # per mille sign, U+2030 ISOtech
+ 'perp': 0x22a5, # up tack = orthogonal to = perpendicular, U+22A5 ISOtech
+ 'phi': 0x03c6, # greek small letter phi, U+03C6 ISOgrk3
+ 'pi': 0x03c0, # greek small letter pi, U+03C0 ISOgrk3
+ 'piv': 0x03d6, # greek pi symbol, U+03D6 ISOgrk3
+ 'plusmn': 0x00b1, # plus-minus sign = plus-or-minus sign, U+00B1 ISOnum
+ 'pound': 0x00a3, # pound sign, U+00A3 ISOnum
+ 'prime': 0x2032, # prime = minutes = feet, U+2032 ISOtech
+ 'prod': 0x220f, # n-ary product = product sign, U+220F ISOamsb
+ 'prop': 0x221d, # proportional to, U+221D ISOtech
+ 'psi': 0x03c8, # greek small letter psi, U+03C8 ISOgrk3
+ 'quot': 0x0022, # quotation mark = APL quote, U+0022 ISOnum
+ 'rArr': 0x21d2, # rightwards double arrow, U+21D2 ISOtech
+ 'radic': 0x221a, # square root = radical sign, U+221A ISOtech
+ 'rang': 0x232a, # right-pointing angle bracket = ket, U+232A ISOtech
+ 'raquo': 0x00bb, # right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum
+ 'rarr': 0x2192, # rightwards arrow, U+2192 ISOnum
+ 'rceil': 0x2309, # right ceiling, U+2309 ISOamsc
+ 'rdquo': 0x201d, # right double quotation mark, U+201D ISOnum
+ 'real': 0x211c, # blackletter capital R = real part symbol, U+211C ISOamso
+ 'reg': 0x00ae, # registered sign = registered trade mark sign, U+00AE ISOnum
+ 'rfloor': 0x230b, # right floor, U+230B ISOamsc
+ 'rho': 0x03c1, # greek small letter rho, U+03C1 ISOgrk3
+ 'rlm': 0x200f, # right-to-left mark, U+200F NEW RFC 2070
+ 'rsaquo': 0x203a, # single right-pointing angle quotation mark, U+203A ISO proposed
+ 'rsquo': 0x2019, # right single quotation mark, U+2019 ISOnum
+ 'sbquo': 0x201a, # single low-9 quotation mark, U+201A NEW
+ 'scaron': 0x0161, # latin small letter s with caron, U+0161 ISOlat2
+ 'sdot': 0x22c5, # dot operator, U+22C5 ISOamsb
+ 'sect': 0x00a7, # section sign, U+00A7 ISOnum
+ 'shy': 0x00ad, # soft hyphen = discretionary hyphen, U+00AD ISOnum
+ 'sigma': 0x03c3, # greek small letter sigma, U+03C3 ISOgrk3
+ 'sigmaf': 0x03c2, # greek small letter final sigma, U+03C2 ISOgrk3
+ 'sim': 0x223c, # tilde operator = varies with = similar to, U+223C ISOtech
+ 'spades': 0x2660, # black spade suit, U+2660 ISOpub
+ 'sub': 0x2282, # subset of, U+2282 ISOtech
+ 'sube': 0x2286, # subset of or equal to, U+2286 ISOtech
+ 'sum': 0x2211, # n-ary sumation, U+2211 ISOamsb
+ 'sup': 0x2283, # superset of, U+2283 ISOtech
+ 'sup1': 0x00b9, # superscript one = superscript digit one, U+00B9 ISOnum
+ 'sup2': 0x00b2, # superscript two = superscript digit two = squared, U+00B2 ISOnum
+ 'sup3': 0x00b3, # superscript three = superscript digit three = cubed, U+00B3 ISOnum
+ 'supe': 0x2287, # superset of or equal to, U+2287 ISOtech
+ 'szlig': 0x00df, # latin small letter sharp s = ess-zed, U+00DF ISOlat1
+ 'tau': 0x03c4, # greek small letter tau, U+03C4 ISOgrk3
+ 'there4': 0x2234, # therefore, U+2234 ISOtech
+ 'theta': 0x03b8, # greek small letter theta, U+03B8 ISOgrk3
+ 'thetasym': 0x03d1, # greek small letter theta symbol, U+03D1 NEW
+ 'thinsp': 0x2009, # thin space, U+2009 ISOpub
+ 'thorn': 0x00fe, # latin small letter thorn with, U+00FE ISOlat1
+ 'tilde': 0x02dc, # small tilde, U+02DC ISOdia
+ 'times': 0x00d7, # multiplication sign, U+00D7 ISOnum
+ 'trade': 0x2122, # trade mark sign, U+2122 ISOnum
+ 'uArr': 0x21d1, # upwards double arrow, U+21D1 ISOamsa
+ 'uacute': 0x00fa, # latin small letter u with acute, U+00FA ISOlat1
+ 'uarr': 0x2191, # upwards arrow, U+2191 ISOnum
+ 'ucirc': 0x00fb, # latin small letter u with circumflex, U+00FB ISOlat1
+ 'ugrave': 0x00f9, # latin small letter u with grave, U+00F9 ISOlat1
+ 'uml': 0x00a8, # diaeresis = spacing diaeresis, U+00A8 ISOdia
+ 'upsih': 0x03d2, # greek upsilon with hook symbol, U+03D2 NEW
+ 'upsilon': 0x03c5, # greek small letter upsilon, U+03C5 ISOgrk3
+ 'uuml': 0x00fc, # latin small letter u with diaeresis, U+00FC ISOlat1
+ 'weierp': 0x2118, # script capital P = power set = Weierstrass p, U+2118 ISOamso
+ 'xi': 0x03be, # greek small letter xi, U+03BE ISOgrk3
+ 'yacute': 0x00fd, # latin small letter y with acute, U+00FD ISOlat1
+ 'yen': 0x00a5, # yen sign = yuan sign, U+00A5 ISOnum
+ 'yuml': 0x00ff, # latin small letter y with diaeresis, U+00FF ISOlat1
+ 'zeta': 0x03b6, # greek small letter zeta, U+03B6 ISOgrk3
+ 'zwj': 0x200d, # zero width joiner, U+200D NEW RFC 2070
+ 'zwnj': 0x200c, # zero width non-joiner, U+200C NEW RFC 2070
+}
+
+
+# maps the HTML5 named character references to the equivalent Unicode character(s)
+html5 = {
+ 'Aacute': '\xc1',
+ 'aacute': '\xe1',
+ 'Aacute;': '\xc1',
+ 'aacute;': '\xe1',
+ 'Abreve;': '\u0102',
+ 'abreve;': '\u0103',
+ 'ac;': '\u223e',
+ 'acd;': '\u223f',
+ 'acE;': '\u223e\u0333',
+ 'Acirc': '\xc2',
+ 'acirc': '\xe2',
+ 'Acirc;': '\xc2',
+ 'acirc;': '\xe2',
+ 'acute': '\xb4',
+ 'acute;': '\xb4',
+ 'Acy;': '\u0410',
+ 'acy;': '\u0430',
+ 'AElig': '\xc6',
+ 'aelig': '\xe6',
+ 'AElig;': '\xc6',
+ 'aelig;': '\xe6',
+ 'af;': '\u2061',
+ 'Afr;': '\U0001d504',
+ 'afr;': '\U0001d51e',
+ 'Agrave': '\xc0',
+ 'agrave': '\xe0',
+ 'Agrave;': '\xc0',
+ 'agrave;': '\xe0',
+ 'alefsym;': '\u2135',
+ 'aleph;': '\u2135',
+ 'Alpha;': '\u0391',
+ 'alpha;': '\u03b1',
+ 'Amacr;': '\u0100',
+ 'amacr;': '\u0101',
+ 'amalg;': '\u2a3f',
+ 'AMP': '&',
+ 'amp': '&',
+ 'AMP;': '&',
+ 'amp;': '&',
+ 'And;': '\u2a53',
+ 'and;': '\u2227',
+ 'andand;': '\u2a55',
+ 'andd;': '\u2a5c',
+ 'andslope;': '\u2a58',
+ 'andv;': '\u2a5a',
+ 'ang;': '\u2220',
+ 'ange;': '\u29a4',
+ 'angle;': '\u2220',
+ 'angmsd;': '\u2221',
+ 'angmsdaa;': '\u29a8',
+ 'angmsdab;': '\u29a9',
+ 'angmsdac;': '\u29aa',
+ 'angmsdad;': '\u29ab',
+ 'angmsdae;': '\u29ac',
+ 'angmsdaf;': '\u29ad',
+ 'angmsdag;': '\u29ae',
+ 'angmsdah;': '\u29af',
+ 'angrt;': '\u221f',
+ 'angrtvb;': '\u22be',
+ 'angrtvbd;': '\u299d',
+ 'angsph;': '\u2222',
+ 'angst;': '\xc5',
+ 'angzarr;': '\u237c',
+ 'Aogon;': '\u0104',
+ 'aogon;': '\u0105',
+ 'Aopf;': '\U0001d538',
+ 'aopf;': '\U0001d552',
+ 'ap;': '\u2248',
+ 'apacir;': '\u2a6f',
+ 'apE;': '\u2a70',
+ 'ape;': '\u224a',
+ 'apid;': '\u224b',
+ 'apos;': "'",
+ 'ApplyFunction;': '\u2061',
+ 'approx;': '\u2248',
+ 'approxeq;': '\u224a',
+ 'Aring': '\xc5',
+ 'aring': '\xe5',
+ 'Aring;': '\xc5',
+ 'aring;': '\xe5',
+ 'Ascr;': '\U0001d49c',
+ 'ascr;': '\U0001d4b6',
+ 'Assign;': '\u2254',
+ 'ast;': '*',
+ 'asymp;': '\u2248',
+ 'asympeq;': '\u224d',
+ 'Atilde': '\xc3',
+ 'atilde': '\xe3',
+ 'Atilde;': '\xc3',
+ 'atilde;': '\xe3',
+ 'Auml': '\xc4',
+ 'auml': '\xe4',
+ 'Auml;': '\xc4',
+ 'auml;': '\xe4',
+ 'awconint;': '\u2233',
+ 'awint;': '\u2a11',
+ 'backcong;': '\u224c',
+ 'backepsilon;': '\u03f6',
+ 'backprime;': '\u2035',
+ 'backsim;': '\u223d',
+ 'backsimeq;': '\u22cd',
+ 'Backslash;': '\u2216',
+ 'Barv;': '\u2ae7',
+ 'barvee;': '\u22bd',
+ 'Barwed;': '\u2306',
+ 'barwed;': '\u2305',
+ 'barwedge;': '\u2305',
+ 'bbrk;': '\u23b5',
+ 'bbrktbrk;': '\u23b6',
+ 'bcong;': '\u224c',
+ 'Bcy;': '\u0411',
+ 'bcy;': '\u0431',
+ 'bdquo;': '\u201e',
+ 'becaus;': '\u2235',
+ 'Because;': '\u2235',
+ 'because;': '\u2235',
+ 'bemptyv;': '\u29b0',
+ 'bepsi;': '\u03f6',
+ 'bernou;': '\u212c',
+ 'Bernoullis;': '\u212c',
+ 'Beta;': '\u0392',
+ 'beta;': '\u03b2',
+ 'beth;': '\u2136',
+ 'between;': '\u226c',
+ 'Bfr;': '\U0001d505',
+ 'bfr;': '\U0001d51f',
+ 'bigcap;': '\u22c2',
+ 'bigcirc;': '\u25ef',
+ 'bigcup;': '\u22c3',
+ 'bigodot;': '\u2a00',
+ 'bigoplus;': '\u2a01',
+ 'bigotimes;': '\u2a02',
+ 'bigsqcup;': '\u2a06',
+ 'bigstar;': '\u2605',
+ 'bigtriangledown;': '\u25bd',
+ 'bigtriangleup;': '\u25b3',
+ 'biguplus;': '\u2a04',
+ 'bigvee;': '\u22c1',
+ 'bigwedge;': '\u22c0',
+ 'bkarow;': '\u290d',
+ 'blacklozenge;': '\u29eb',
+ 'blacksquare;': '\u25aa',
+ 'blacktriangle;': '\u25b4',
+ 'blacktriangledown;': '\u25be',
+ 'blacktriangleleft;': '\u25c2',
+ 'blacktriangleright;': '\u25b8',
+ 'blank;': '\u2423',
+ 'blk12;': '\u2592',
+ 'blk14;': '\u2591',
+ 'blk34;': '\u2593',
+ 'block;': '\u2588',
+ 'bne;': '=\u20e5',
+ 'bnequiv;': '\u2261\u20e5',
+ 'bNot;': '\u2aed',
+ 'bnot;': '\u2310',
+ 'Bopf;': '\U0001d539',
+ 'bopf;': '\U0001d553',
+ 'bot;': '\u22a5',
+ 'bottom;': '\u22a5',
+ 'bowtie;': '\u22c8',
+ 'boxbox;': '\u29c9',
+ 'boxDL;': '\u2557',
+ 'boxDl;': '\u2556',
+ 'boxdL;': '\u2555',
+ 'boxdl;': '\u2510',
+ 'boxDR;': '\u2554',
+ 'boxDr;': '\u2553',
+ 'boxdR;': '\u2552',
+ 'boxdr;': '\u250c',
+ 'boxH;': '\u2550',
+ 'boxh;': '\u2500',
+ 'boxHD;': '\u2566',
+ 'boxHd;': '\u2564',
+ 'boxhD;': '\u2565',
+ 'boxhd;': '\u252c',
+ 'boxHU;': '\u2569',
+ 'boxHu;': '\u2567',
+ 'boxhU;': '\u2568',
+ 'boxhu;': '\u2534',
+ 'boxminus;': '\u229f',
+ 'boxplus;': '\u229e',
+ 'boxtimes;': '\u22a0',
+ 'boxUL;': '\u255d',
+ 'boxUl;': '\u255c',
+ 'boxuL;': '\u255b',
+ 'boxul;': '\u2518',
+ 'boxUR;': '\u255a',
+ 'boxUr;': '\u2559',
+ 'boxuR;': '\u2558',
+ 'boxur;': '\u2514',
+ 'boxV;': '\u2551',
+ 'boxv;': '\u2502',
+ 'boxVH;': '\u256c',
+ 'boxVh;': '\u256b',
+ 'boxvH;': '\u256a',
+ 'boxvh;': '\u253c',
+ 'boxVL;': '\u2563',
+ 'boxVl;': '\u2562',
+ 'boxvL;': '\u2561',
+ 'boxvl;': '\u2524',
+ 'boxVR;': '\u2560',
+ 'boxVr;': '\u255f',
+ 'boxvR;': '\u255e',
+ 'boxvr;': '\u251c',
+ 'bprime;': '\u2035',
+ 'Breve;': '\u02d8',
+ 'breve;': '\u02d8',
+ 'brvbar': '\xa6',
+ 'brvbar;': '\xa6',
+ 'Bscr;': '\u212c',
+ 'bscr;': '\U0001d4b7',
+ 'bsemi;': '\u204f',
+ 'bsim;': '\u223d',
+ 'bsime;': '\u22cd',
+ 'bsol;': '\\',
+ 'bsolb;': '\u29c5',
+ 'bsolhsub;': '\u27c8',
+ 'bull;': '\u2022',
+ 'bullet;': '\u2022',
+ 'bump;': '\u224e',
+ 'bumpE;': '\u2aae',
+ 'bumpe;': '\u224f',
+ 'Bumpeq;': '\u224e',
+ 'bumpeq;': '\u224f',
+ 'Cacute;': '\u0106',
+ 'cacute;': '\u0107',
+ 'Cap;': '\u22d2',
+ 'cap;': '\u2229',
+ 'capand;': '\u2a44',
+ 'capbrcup;': '\u2a49',
+ 'capcap;': '\u2a4b',
+ 'capcup;': '\u2a47',
+ 'capdot;': '\u2a40',
+ 'CapitalDifferentialD;': '\u2145',
+ 'caps;': '\u2229\ufe00',
+ 'caret;': '\u2041',
+ 'caron;': '\u02c7',
+ 'Cayleys;': '\u212d',
+ 'ccaps;': '\u2a4d',
+ 'Ccaron;': '\u010c',
+ 'ccaron;': '\u010d',
+ 'Ccedil': '\xc7',
+ 'ccedil': '\xe7',
+ 'Ccedil;': '\xc7',
+ 'ccedil;': '\xe7',
+ 'Ccirc;': '\u0108',
+ 'ccirc;': '\u0109',
+ 'Cconint;': '\u2230',
+ 'ccups;': '\u2a4c',
+ 'ccupssm;': '\u2a50',
+ 'Cdot;': '\u010a',
+ 'cdot;': '\u010b',
+ 'cedil': '\xb8',
+ 'cedil;': '\xb8',
+ 'Cedilla;': '\xb8',
+ 'cemptyv;': '\u29b2',
+ 'cent': '\xa2',
+ 'cent;': '\xa2',
+ 'CenterDot;': '\xb7',
+ 'centerdot;': '\xb7',
+ 'Cfr;': '\u212d',
+ 'cfr;': '\U0001d520',
+ 'CHcy;': '\u0427',
+ 'chcy;': '\u0447',
+ 'check;': '\u2713',
+ 'checkmark;': '\u2713',
+ 'Chi;': '\u03a7',
+ 'chi;': '\u03c7',
+ 'cir;': '\u25cb',
+ 'circ;': '\u02c6',
+ 'circeq;': '\u2257',
+ 'circlearrowleft;': '\u21ba',
+ 'circlearrowright;': '\u21bb',
+ 'circledast;': '\u229b',
+ 'circledcirc;': '\u229a',
+ 'circleddash;': '\u229d',
+ 'CircleDot;': '\u2299',
+ 'circledR;': '\xae',
+ 'circledS;': '\u24c8',
+ 'CircleMinus;': '\u2296',
+ 'CirclePlus;': '\u2295',
+ 'CircleTimes;': '\u2297',
+ 'cirE;': '\u29c3',
+ 'cire;': '\u2257',
+ 'cirfnint;': '\u2a10',
+ 'cirmid;': '\u2aef',
+ 'cirscir;': '\u29c2',
+ 'ClockwiseContourIntegral;': '\u2232',
+ 'CloseCurlyDoubleQuote;': '\u201d',
+ 'CloseCurlyQuote;': '\u2019',
+ 'clubs;': '\u2663',
+ 'clubsuit;': '\u2663',
+ 'Colon;': '\u2237',
+ 'colon;': ':',
+ 'Colone;': '\u2a74',
+ 'colone;': '\u2254',
+ 'coloneq;': '\u2254',
+ 'comma;': ',',
+ 'commat;': '@',
+ 'comp;': '\u2201',
+ 'compfn;': '\u2218',
+ 'complement;': '\u2201',
+ 'complexes;': '\u2102',
+ 'cong;': '\u2245',
+ 'congdot;': '\u2a6d',
+ 'Congruent;': '\u2261',
+ 'Conint;': '\u222f',
+ 'conint;': '\u222e',
+ 'ContourIntegral;': '\u222e',
+ 'Copf;': '\u2102',
+ 'copf;': '\U0001d554',
+ 'coprod;': '\u2210',
+ 'Coproduct;': '\u2210',
+ 'COPY': '\xa9',
+ 'copy': '\xa9',
+ 'COPY;': '\xa9',
+ 'copy;': '\xa9',
+ 'copysr;': '\u2117',
+ 'CounterClockwiseContourIntegral;': '\u2233',
+ 'crarr;': '\u21b5',
+ 'Cross;': '\u2a2f',
+ 'cross;': '\u2717',
+ 'Cscr;': '\U0001d49e',
+ 'cscr;': '\U0001d4b8',
+ 'csub;': '\u2acf',
+ 'csube;': '\u2ad1',
+ 'csup;': '\u2ad0',
+ 'csupe;': '\u2ad2',
+ 'ctdot;': '\u22ef',
+ 'cudarrl;': '\u2938',
+ 'cudarrr;': '\u2935',
+ 'cuepr;': '\u22de',
+ 'cuesc;': '\u22df',
+ 'cularr;': '\u21b6',
+ 'cularrp;': '\u293d',
+ 'Cup;': '\u22d3',
+ 'cup;': '\u222a',
+ 'cupbrcap;': '\u2a48',
+ 'CupCap;': '\u224d',
+ 'cupcap;': '\u2a46',
+ 'cupcup;': '\u2a4a',
+ 'cupdot;': '\u228d',
+ 'cupor;': '\u2a45',
+ 'cups;': '\u222a\ufe00',
+ 'curarr;': '\u21b7',
+ 'curarrm;': '\u293c',
+ 'curlyeqprec;': '\u22de',
+ 'curlyeqsucc;': '\u22df',
+ 'curlyvee;': '\u22ce',
+ 'curlywedge;': '\u22cf',
+ 'curren': '\xa4',
+ 'curren;': '\xa4',
+ 'curvearrowleft;': '\u21b6',
+ 'curvearrowright;': '\u21b7',
+ 'cuvee;': '\u22ce',
+ 'cuwed;': '\u22cf',
+ 'cwconint;': '\u2232',
+ 'cwint;': '\u2231',
+ 'cylcty;': '\u232d',
+ 'Dagger;': '\u2021',
+ 'dagger;': '\u2020',
+ 'daleth;': '\u2138',
+ 'Darr;': '\u21a1',
+ 'dArr;': '\u21d3',
+ 'darr;': '\u2193',
+ 'dash;': '\u2010',
+ 'Dashv;': '\u2ae4',
+ 'dashv;': '\u22a3',
+ 'dbkarow;': '\u290f',
+ 'dblac;': '\u02dd',
+ 'Dcaron;': '\u010e',
+ 'dcaron;': '\u010f',
+ 'Dcy;': '\u0414',
+ 'dcy;': '\u0434',
+ 'DD;': '\u2145',
+ 'dd;': '\u2146',
+ 'ddagger;': '\u2021',
+ 'ddarr;': '\u21ca',
+ 'DDotrahd;': '\u2911',
+ 'ddotseq;': '\u2a77',
+ 'deg': '\xb0',
+ 'deg;': '\xb0',
+ 'Del;': '\u2207',
+ 'Delta;': '\u0394',
+ 'delta;': '\u03b4',
+ 'demptyv;': '\u29b1',
+ 'dfisht;': '\u297f',
+ 'Dfr;': '\U0001d507',
+ 'dfr;': '\U0001d521',
+ 'dHar;': '\u2965',
+ 'dharl;': '\u21c3',
+ 'dharr;': '\u21c2',
+ 'DiacriticalAcute;': '\xb4',
+ 'DiacriticalDot;': '\u02d9',
+ 'DiacriticalDoubleAcute;': '\u02dd',
+ 'DiacriticalGrave;': '`',
+ 'DiacriticalTilde;': '\u02dc',
+ 'diam;': '\u22c4',
+ 'Diamond;': '\u22c4',
+ 'diamond;': '\u22c4',
+ 'diamondsuit;': '\u2666',
+ 'diams;': '\u2666',
+ 'die;': '\xa8',
+ 'DifferentialD;': '\u2146',
+ 'digamma;': '\u03dd',
+ 'disin;': '\u22f2',
+ 'div;': '\xf7',
+ 'divide': '\xf7',
+ 'divide;': '\xf7',
+ 'divideontimes;': '\u22c7',
+ 'divonx;': '\u22c7',
+ 'DJcy;': '\u0402',
+ 'djcy;': '\u0452',
+ 'dlcorn;': '\u231e',
+ 'dlcrop;': '\u230d',
+ 'dollar;': '$',
+ 'Dopf;': '\U0001d53b',
+ 'dopf;': '\U0001d555',
+ 'Dot;': '\xa8',
+ 'dot;': '\u02d9',
+ 'DotDot;': '\u20dc',
+ 'doteq;': '\u2250',
+ 'doteqdot;': '\u2251',
+ 'DotEqual;': '\u2250',
+ 'dotminus;': '\u2238',
+ 'dotplus;': '\u2214',
+ 'dotsquare;': '\u22a1',
+ 'doublebarwedge;': '\u2306',
+ 'DoubleContourIntegral;': '\u222f',
+ 'DoubleDot;': '\xa8',
+ 'DoubleDownArrow;': '\u21d3',
+ 'DoubleLeftArrow;': '\u21d0',
+ 'DoubleLeftRightArrow;': '\u21d4',
+ 'DoubleLeftTee;': '\u2ae4',
+ 'DoubleLongLeftArrow;': '\u27f8',
+ 'DoubleLongLeftRightArrow;': '\u27fa',
+ 'DoubleLongRightArrow;': '\u27f9',
+ 'DoubleRightArrow;': '\u21d2',
+ 'DoubleRightTee;': '\u22a8',
+ 'DoubleUpArrow;': '\u21d1',
+ 'DoubleUpDownArrow;': '\u21d5',
+ 'DoubleVerticalBar;': '\u2225',
+ 'DownArrow;': '\u2193',
+ 'Downarrow;': '\u21d3',
+ 'downarrow;': '\u2193',
+ 'DownArrowBar;': '\u2913',
+ 'DownArrowUpArrow;': '\u21f5',
+ 'DownBreve;': '\u0311',
+ 'downdownarrows;': '\u21ca',
+ 'downharpoonleft;': '\u21c3',
+ 'downharpoonright;': '\u21c2',
+ 'DownLeftRightVector;': '\u2950',
+ 'DownLeftTeeVector;': '\u295e',
+ 'DownLeftVector;': '\u21bd',
+ 'DownLeftVectorBar;': '\u2956',
+ 'DownRightTeeVector;': '\u295f',
+ 'DownRightVector;': '\u21c1',
+ 'DownRightVectorBar;': '\u2957',
+ 'DownTee;': '\u22a4',
+ 'DownTeeArrow;': '\u21a7',
+ 'drbkarow;': '\u2910',
+ 'drcorn;': '\u231f',
+ 'drcrop;': '\u230c',
+ 'Dscr;': '\U0001d49f',
+ 'dscr;': '\U0001d4b9',
+ 'DScy;': '\u0405',
+ 'dscy;': '\u0455',
+ 'dsol;': '\u29f6',
+ 'Dstrok;': '\u0110',
+ 'dstrok;': '\u0111',
+ 'dtdot;': '\u22f1',
+ 'dtri;': '\u25bf',
+ 'dtrif;': '\u25be',
+ 'duarr;': '\u21f5',
+ 'duhar;': '\u296f',
+ 'dwangle;': '\u29a6',
+ 'DZcy;': '\u040f',
+ 'dzcy;': '\u045f',
+ 'dzigrarr;': '\u27ff',
+ 'Eacute': '\xc9',
+ 'eacute': '\xe9',
+ 'Eacute;': '\xc9',
+ 'eacute;': '\xe9',
+ 'easter;': '\u2a6e',
+ 'Ecaron;': '\u011a',
+ 'ecaron;': '\u011b',
+ 'ecir;': '\u2256',
+ 'Ecirc': '\xca',
+ 'ecirc': '\xea',
+ 'Ecirc;': '\xca',
+ 'ecirc;': '\xea',
+ 'ecolon;': '\u2255',
+ 'Ecy;': '\u042d',
+ 'ecy;': '\u044d',
+ 'eDDot;': '\u2a77',
+ 'Edot;': '\u0116',
+ 'eDot;': '\u2251',
+ 'edot;': '\u0117',
+ 'ee;': '\u2147',
+ 'efDot;': '\u2252',
+ 'Efr;': '\U0001d508',
+ 'efr;': '\U0001d522',
+ 'eg;': '\u2a9a',
+ 'Egrave': '\xc8',
+ 'egrave': '\xe8',
+ 'Egrave;': '\xc8',
+ 'egrave;': '\xe8',
+ 'egs;': '\u2a96',
+ 'egsdot;': '\u2a98',
+ 'el;': '\u2a99',
+ 'Element;': '\u2208',
+ 'elinters;': '\u23e7',
+ 'ell;': '\u2113',
+ 'els;': '\u2a95',
+ 'elsdot;': '\u2a97',
+ 'Emacr;': '\u0112',
+ 'emacr;': '\u0113',
+ 'empty;': '\u2205',
+ 'emptyset;': '\u2205',
+ 'EmptySmallSquare;': '\u25fb',
+ 'emptyv;': '\u2205',
+ 'EmptyVerySmallSquare;': '\u25ab',
+ 'emsp13;': '\u2004',
+ 'emsp14;': '\u2005',
+ 'emsp;': '\u2003',
+ 'ENG;': '\u014a',
+ 'eng;': '\u014b',
+ 'ensp;': '\u2002',
+ 'Eogon;': '\u0118',
+ 'eogon;': '\u0119',
+ 'Eopf;': '\U0001d53c',
+ 'eopf;': '\U0001d556',
+ 'epar;': '\u22d5',
+ 'eparsl;': '\u29e3',
+ 'eplus;': '\u2a71',
+ 'epsi;': '\u03b5',
+ 'Epsilon;': '\u0395',
+ 'epsilon;': '\u03b5',
+ 'epsiv;': '\u03f5',
+ 'eqcirc;': '\u2256',
+ 'eqcolon;': '\u2255',
+ 'eqsim;': '\u2242',
+ 'eqslantgtr;': '\u2a96',
+ 'eqslantless;': '\u2a95',
+ 'Equal;': '\u2a75',
+ 'equals;': '=',
+ 'EqualTilde;': '\u2242',
+ 'equest;': '\u225f',
+ 'Equilibrium;': '\u21cc',
+ 'equiv;': '\u2261',
+ 'equivDD;': '\u2a78',
+ 'eqvparsl;': '\u29e5',
+ 'erarr;': '\u2971',
+ 'erDot;': '\u2253',
+ 'Escr;': '\u2130',
+ 'escr;': '\u212f',
+ 'esdot;': '\u2250',
+ 'Esim;': '\u2a73',
+ 'esim;': '\u2242',
+ 'Eta;': '\u0397',
+ 'eta;': '\u03b7',
+ 'ETH': '\xd0',
+ 'eth': '\xf0',
+ 'ETH;': '\xd0',
+ 'eth;': '\xf0',
+ 'Euml': '\xcb',
+ 'euml': '\xeb',
+ 'Euml;': '\xcb',
+ 'euml;': '\xeb',
+ 'euro;': '\u20ac',
+ 'excl;': '!',
+ 'exist;': '\u2203',
+ 'Exists;': '\u2203',
+ 'expectation;': '\u2130',
+ 'ExponentialE;': '\u2147',
+ 'exponentiale;': '\u2147',
+ 'fallingdotseq;': '\u2252',
+ 'Fcy;': '\u0424',
+ 'fcy;': '\u0444',
+ 'female;': '\u2640',
+ 'ffilig;': '\ufb03',
+ 'fflig;': '\ufb00',
+ 'ffllig;': '\ufb04',
+ 'Ffr;': '\U0001d509',
+ 'ffr;': '\U0001d523',
+ 'filig;': '\ufb01',
+ 'FilledSmallSquare;': '\u25fc',
+ 'FilledVerySmallSquare;': '\u25aa',
+ 'fjlig;': 'fj',
+ 'flat;': '\u266d',
+ 'fllig;': '\ufb02',
+ 'fltns;': '\u25b1',
+ 'fnof;': '\u0192',
+ 'Fopf;': '\U0001d53d',
+ 'fopf;': '\U0001d557',
+ 'ForAll;': '\u2200',
+ 'forall;': '\u2200',
+ 'fork;': '\u22d4',
+ 'forkv;': '\u2ad9',
+ 'Fouriertrf;': '\u2131',
+ 'fpartint;': '\u2a0d',
+ 'frac12': '\xbd',
+ 'frac12;': '\xbd',
+ 'frac13;': '\u2153',
+ 'frac14': '\xbc',
+ 'frac14;': '\xbc',
+ 'frac15;': '\u2155',
+ 'frac16;': '\u2159',
+ 'frac18;': '\u215b',
+ 'frac23;': '\u2154',
+ 'frac25;': '\u2156',
+ 'frac34': '\xbe',
+ 'frac34;': '\xbe',
+ 'frac35;': '\u2157',
+ 'frac38;': '\u215c',
+ 'frac45;': '\u2158',
+ 'frac56;': '\u215a',
+ 'frac58;': '\u215d',
+ 'frac78;': '\u215e',
+ 'frasl;': '\u2044',
+ 'frown;': '\u2322',
+ 'Fscr;': '\u2131',
+ 'fscr;': '\U0001d4bb',
+ 'gacute;': '\u01f5',
+ 'Gamma;': '\u0393',
+ 'gamma;': '\u03b3',
+ 'Gammad;': '\u03dc',
+ 'gammad;': '\u03dd',
+ 'gap;': '\u2a86',
+ 'Gbreve;': '\u011e',
+ 'gbreve;': '\u011f',
+ 'Gcedil;': '\u0122',
+ 'Gcirc;': '\u011c',
+ 'gcirc;': '\u011d',
+ 'Gcy;': '\u0413',
+ 'gcy;': '\u0433',
+ 'Gdot;': '\u0120',
+ 'gdot;': '\u0121',
+ 'gE;': '\u2267',
+ 'ge;': '\u2265',
+ 'gEl;': '\u2a8c',
+ 'gel;': '\u22db',
+ 'geq;': '\u2265',
+ 'geqq;': '\u2267',
+ 'geqslant;': '\u2a7e',
+ 'ges;': '\u2a7e',
+ 'gescc;': '\u2aa9',
+ 'gesdot;': '\u2a80',
+ 'gesdoto;': '\u2a82',
+ 'gesdotol;': '\u2a84',
+ 'gesl;': '\u22db\ufe00',
+ 'gesles;': '\u2a94',
+ 'Gfr;': '\U0001d50a',
+ 'gfr;': '\U0001d524',
+ 'Gg;': '\u22d9',
+ 'gg;': '\u226b',
+ 'ggg;': '\u22d9',
+ 'gimel;': '\u2137',
+ 'GJcy;': '\u0403',
+ 'gjcy;': '\u0453',
+ 'gl;': '\u2277',
+ 'gla;': '\u2aa5',
+ 'glE;': '\u2a92',
+ 'glj;': '\u2aa4',
+ 'gnap;': '\u2a8a',
+ 'gnapprox;': '\u2a8a',
+ 'gnE;': '\u2269',
+ 'gne;': '\u2a88',
+ 'gneq;': '\u2a88',
+ 'gneqq;': '\u2269',
+ 'gnsim;': '\u22e7',
+ 'Gopf;': '\U0001d53e',
+ 'gopf;': '\U0001d558',
+ 'grave;': '`',
+ 'GreaterEqual;': '\u2265',
+ 'GreaterEqualLess;': '\u22db',
+ 'GreaterFullEqual;': '\u2267',
+ 'GreaterGreater;': '\u2aa2',
+ 'GreaterLess;': '\u2277',
+ 'GreaterSlantEqual;': '\u2a7e',
+ 'GreaterTilde;': '\u2273',
+ 'Gscr;': '\U0001d4a2',
+ 'gscr;': '\u210a',
+ 'gsim;': '\u2273',
+ 'gsime;': '\u2a8e',
+ 'gsiml;': '\u2a90',
+ 'GT': '>',
+ 'gt': '>',
+ 'GT;': '>',
+ 'Gt;': '\u226b',
+ 'gt;': '>',
+ 'gtcc;': '\u2aa7',
+ 'gtcir;': '\u2a7a',
+ 'gtdot;': '\u22d7',
+ 'gtlPar;': '\u2995',
+ 'gtquest;': '\u2a7c',
+ 'gtrapprox;': '\u2a86',
+ 'gtrarr;': '\u2978',
+ 'gtrdot;': '\u22d7',
+ 'gtreqless;': '\u22db',
+ 'gtreqqless;': '\u2a8c',
+ 'gtrless;': '\u2277',
+ 'gtrsim;': '\u2273',
+ 'gvertneqq;': '\u2269\ufe00',
+ 'gvnE;': '\u2269\ufe00',
+ 'Hacek;': '\u02c7',
+ 'hairsp;': '\u200a',
+ 'half;': '\xbd',
+ 'hamilt;': '\u210b',
+ 'HARDcy;': '\u042a',
+ 'hardcy;': '\u044a',
+ 'hArr;': '\u21d4',
+ 'harr;': '\u2194',
+ 'harrcir;': '\u2948',
+ 'harrw;': '\u21ad',
+ 'Hat;': '^',
+ 'hbar;': '\u210f',
+ 'Hcirc;': '\u0124',
+ 'hcirc;': '\u0125',
+ 'hearts;': '\u2665',
+ 'heartsuit;': '\u2665',
+ 'hellip;': '\u2026',
+ 'hercon;': '\u22b9',
+ 'Hfr;': '\u210c',
+ 'hfr;': '\U0001d525',
+ 'HilbertSpace;': '\u210b',
+ 'hksearow;': '\u2925',
+ 'hkswarow;': '\u2926',
+ 'hoarr;': '\u21ff',
+ 'homtht;': '\u223b',
+ 'hookleftarrow;': '\u21a9',
+ 'hookrightarrow;': '\u21aa',
+ 'Hopf;': '\u210d',
+ 'hopf;': '\U0001d559',
+ 'horbar;': '\u2015',
+ 'HorizontalLine;': '\u2500',
+ 'Hscr;': '\u210b',
+ 'hscr;': '\U0001d4bd',
+ 'hslash;': '\u210f',
+ 'Hstrok;': '\u0126',
+ 'hstrok;': '\u0127',
+ 'HumpDownHump;': '\u224e',
+ 'HumpEqual;': '\u224f',
+ 'hybull;': '\u2043',
+ 'hyphen;': '\u2010',
+ 'Iacute': '\xcd',
+ 'iacute': '\xed',
+ 'Iacute;': '\xcd',
+ 'iacute;': '\xed',
+ 'ic;': '\u2063',
+ 'Icirc': '\xce',
+ 'icirc': '\xee',
+ 'Icirc;': '\xce',
+ 'icirc;': '\xee',
+ 'Icy;': '\u0418',
+ 'icy;': '\u0438',
+ 'Idot;': '\u0130',
+ 'IEcy;': '\u0415',
+ 'iecy;': '\u0435',
+ 'iexcl': '\xa1',
+ 'iexcl;': '\xa1',
+ 'iff;': '\u21d4',
+ 'Ifr;': '\u2111',
+ 'ifr;': '\U0001d526',
+ 'Igrave': '\xcc',
+ 'igrave': '\xec',
+ 'Igrave;': '\xcc',
+ 'igrave;': '\xec',
+ 'ii;': '\u2148',
+ 'iiiint;': '\u2a0c',
+ 'iiint;': '\u222d',
+ 'iinfin;': '\u29dc',
+ 'iiota;': '\u2129',
+ 'IJlig;': '\u0132',
+ 'ijlig;': '\u0133',
+ 'Im;': '\u2111',
+ 'Imacr;': '\u012a',
+ 'imacr;': '\u012b',
+ 'image;': '\u2111',
+ 'ImaginaryI;': '\u2148',
+ 'imagline;': '\u2110',
+ 'imagpart;': '\u2111',
+ 'imath;': '\u0131',
+ 'imof;': '\u22b7',
+ 'imped;': '\u01b5',
+ 'Implies;': '\u21d2',
+ 'in;': '\u2208',
+ 'incare;': '\u2105',
+ 'infin;': '\u221e',
+ 'infintie;': '\u29dd',
+ 'inodot;': '\u0131',
+ 'Int;': '\u222c',
+ 'int;': '\u222b',
+ 'intcal;': '\u22ba',
+ 'integers;': '\u2124',
+ 'Integral;': '\u222b',
+ 'intercal;': '\u22ba',
+ 'Intersection;': '\u22c2',
+ 'intlarhk;': '\u2a17',
+ 'intprod;': '\u2a3c',
+ 'InvisibleComma;': '\u2063',
+ 'InvisibleTimes;': '\u2062',
+ 'IOcy;': '\u0401',
+ 'iocy;': '\u0451',
+ 'Iogon;': '\u012e',
+ 'iogon;': '\u012f',
+ 'Iopf;': '\U0001d540',
+ 'iopf;': '\U0001d55a',
+ 'Iota;': '\u0399',
+ 'iota;': '\u03b9',
+ 'iprod;': '\u2a3c',
+ 'iquest': '\xbf',
+ 'iquest;': '\xbf',
+ 'Iscr;': '\u2110',
+ 'iscr;': '\U0001d4be',
+ 'isin;': '\u2208',
+ 'isindot;': '\u22f5',
+ 'isinE;': '\u22f9',
+ 'isins;': '\u22f4',
+ 'isinsv;': '\u22f3',
+ 'isinv;': '\u2208',
+ 'it;': '\u2062',
+ 'Itilde;': '\u0128',
+ 'itilde;': '\u0129',
+ 'Iukcy;': '\u0406',
+ 'iukcy;': '\u0456',
+ 'Iuml': '\xcf',
+ 'iuml': '\xef',
+ 'Iuml;': '\xcf',
+ 'iuml;': '\xef',
+ 'Jcirc;': '\u0134',
+ 'jcirc;': '\u0135',
+ 'Jcy;': '\u0419',
+ 'jcy;': '\u0439',
+ 'Jfr;': '\U0001d50d',
+ 'jfr;': '\U0001d527',
+ 'jmath;': '\u0237',
+ 'Jopf;': '\U0001d541',
+ 'jopf;': '\U0001d55b',
+ 'Jscr;': '\U0001d4a5',
+ 'jscr;': '\U0001d4bf',
+ 'Jsercy;': '\u0408',
+ 'jsercy;': '\u0458',
+ 'Jukcy;': '\u0404',
+ 'jukcy;': '\u0454',
+ 'Kappa;': '\u039a',
+ 'kappa;': '\u03ba',
+ 'kappav;': '\u03f0',
+ 'Kcedil;': '\u0136',
+ 'kcedil;': '\u0137',
+ 'Kcy;': '\u041a',
+ 'kcy;': '\u043a',
+ 'Kfr;': '\U0001d50e',
+ 'kfr;': '\U0001d528',
+ 'kgreen;': '\u0138',
+ 'KHcy;': '\u0425',
+ 'khcy;': '\u0445',
+ 'KJcy;': '\u040c',
+ 'kjcy;': '\u045c',
+ 'Kopf;': '\U0001d542',
+ 'kopf;': '\U0001d55c',
+ 'Kscr;': '\U0001d4a6',
+ 'kscr;': '\U0001d4c0',
+ 'lAarr;': '\u21da',
+ 'Lacute;': '\u0139',
+ 'lacute;': '\u013a',
+ 'laemptyv;': '\u29b4',
+ 'lagran;': '\u2112',
+ 'Lambda;': '\u039b',
+ 'lambda;': '\u03bb',
+ 'Lang;': '\u27ea',
+ 'lang;': '\u27e8',
+ 'langd;': '\u2991',
+ 'langle;': '\u27e8',
+ 'lap;': '\u2a85',
+ 'Laplacetrf;': '\u2112',
+ 'laquo': '\xab',
+ 'laquo;': '\xab',
+ 'Larr;': '\u219e',
+ 'lArr;': '\u21d0',
+ 'larr;': '\u2190',
+ 'larrb;': '\u21e4',
+ 'larrbfs;': '\u291f',
+ 'larrfs;': '\u291d',
+ 'larrhk;': '\u21a9',
+ 'larrlp;': '\u21ab',
+ 'larrpl;': '\u2939',
+ 'larrsim;': '\u2973',
+ 'larrtl;': '\u21a2',
+ 'lat;': '\u2aab',
+ 'lAtail;': '\u291b',
+ 'latail;': '\u2919',
+ 'late;': '\u2aad',
+ 'lates;': '\u2aad\ufe00',
+ 'lBarr;': '\u290e',
+ 'lbarr;': '\u290c',
+ 'lbbrk;': '\u2772',
+ 'lbrace;': '{',
+ 'lbrack;': '[',
+ 'lbrke;': '\u298b',
+ 'lbrksld;': '\u298f',
+ 'lbrkslu;': '\u298d',
+ 'Lcaron;': '\u013d',
+ 'lcaron;': '\u013e',
+ 'Lcedil;': '\u013b',
+ 'lcedil;': '\u013c',
+ 'lceil;': '\u2308',
+ 'lcub;': '{',
+ 'Lcy;': '\u041b',
+ 'lcy;': '\u043b',
+ 'ldca;': '\u2936',
+ 'ldquo;': '\u201c',
+ 'ldquor;': '\u201e',
+ 'ldrdhar;': '\u2967',
+ 'ldrushar;': '\u294b',
+ 'ldsh;': '\u21b2',
+ 'lE;': '\u2266',
+ 'le;': '\u2264',
+ 'LeftAngleBracket;': '\u27e8',
+ 'LeftArrow;': '\u2190',
+ 'Leftarrow;': '\u21d0',
+ 'leftarrow;': '\u2190',
+ 'LeftArrowBar;': '\u21e4',
+ 'LeftArrowRightArrow;': '\u21c6',
+ 'leftarrowtail;': '\u21a2',
+ 'LeftCeiling;': '\u2308',
+ 'LeftDoubleBracket;': '\u27e6',
+ 'LeftDownTeeVector;': '\u2961',
+ 'LeftDownVector;': '\u21c3',
+ 'LeftDownVectorBar;': '\u2959',
+ 'LeftFloor;': '\u230a',
+ 'leftharpoondown;': '\u21bd',
+ 'leftharpoonup;': '\u21bc',
+ 'leftleftarrows;': '\u21c7',
+ 'LeftRightArrow;': '\u2194',
+ 'Leftrightarrow;': '\u21d4',
+ 'leftrightarrow;': '\u2194',
+ 'leftrightarrows;': '\u21c6',
+ 'leftrightharpoons;': '\u21cb',
+ 'leftrightsquigarrow;': '\u21ad',
+ 'LeftRightVector;': '\u294e',
+ 'LeftTee;': '\u22a3',
+ 'LeftTeeArrow;': '\u21a4',
+ 'LeftTeeVector;': '\u295a',
+ 'leftthreetimes;': '\u22cb',
+ 'LeftTriangle;': '\u22b2',
+ 'LeftTriangleBar;': '\u29cf',
+ 'LeftTriangleEqual;': '\u22b4',
+ 'LeftUpDownVector;': '\u2951',
+ 'LeftUpTeeVector;': '\u2960',
+ 'LeftUpVector;': '\u21bf',
+ 'LeftUpVectorBar;': '\u2958',
+ 'LeftVector;': '\u21bc',
+ 'LeftVectorBar;': '\u2952',
+ 'lEg;': '\u2a8b',
+ 'leg;': '\u22da',
+ 'leq;': '\u2264',
+ 'leqq;': '\u2266',
+ 'leqslant;': '\u2a7d',
+ 'les;': '\u2a7d',
+ 'lescc;': '\u2aa8',
+ 'lesdot;': '\u2a7f',
+ 'lesdoto;': '\u2a81',
+ 'lesdotor;': '\u2a83',
+ 'lesg;': '\u22da\ufe00',
+ 'lesges;': '\u2a93',
+ 'lessapprox;': '\u2a85',
+ 'lessdot;': '\u22d6',
+ 'lesseqgtr;': '\u22da',
+ 'lesseqqgtr;': '\u2a8b',
+ 'LessEqualGreater;': '\u22da',
+ 'LessFullEqual;': '\u2266',
+ 'LessGreater;': '\u2276',
+ 'lessgtr;': '\u2276',
+ 'LessLess;': '\u2aa1',
+ 'lesssim;': '\u2272',
+ 'LessSlantEqual;': '\u2a7d',
+ 'LessTilde;': '\u2272',
+ 'lfisht;': '\u297c',
+ 'lfloor;': '\u230a',
+ 'Lfr;': '\U0001d50f',
+ 'lfr;': '\U0001d529',
+ 'lg;': '\u2276',
+ 'lgE;': '\u2a91',
+ 'lHar;': '\u2962',
+ 'lhard;': '\u21bd',
+ 'lharu;': '\u21bc',
+ 'lharul;': '\u296a',
+ 'lhblk;': '\u2584',
+ 'LJcy;': '\u0409',
+ 'ljcy;': '\u0459',
+ 'Ll;': '\u22d8',
+ 'll;': '\u226a',
+ 'llarr;': '\u21c7',
+ 'llcorner;': '\u231e',
+ 'Lleftarrow;': '\u21da',
+ 'llhard;': '\u296b',
+ 'lltri;': '\u25fa',
+ 'Lmidot;': '\u013f',
+ 'lmidot;': '\u0140',
+ 'lmoust;': '\u23b0',
+ 'lmoustache;': '\u23b0',
+ 'lnap;': '\u2a89',
+ 'lnapprox;': '\u2a89',
+ 'lnE;': '\u2268',
+ 'lne;': '\u2a87',
+ 'lneq;': '\u2a87',
+ 'lneqq;': '\u2268',
+ 'lnsim;': '\u22e6',
+ 'loang;': '\u27ec',
+ 'loarr;': '\u21fd',
+ 'lobrk;': '\u27e6',
+ 'LongLeftArrow;': '\u27f5',
+ 'Longleftarrow;': '\u27f8',
+ 'longleftarrow;': '\u27f5',
+ 'LongLeftRightArrow;': '\u27f7',
+ 'Longleftrightarrow;': '\u27fa',
+ 'longleftrightarrow;': '\u27f7',
+ 'longmapsto;': '\u27fc',
+ 'LongRightArrow;': '\u27f6',
+ 'Longrightarrow;': '\u27f9',
+ 'longrightarrow;': '\u27f6',
+ 'looparrowleft;': '\u21ab',
+ 'looparrowright;': '\u21ac',
+ 'lopar;': '\u2985',
+ 'Lopf;': '\U0001d543',
+ 'lopf;': '\U0001d55d',
+ 'loplus;': '\u2a2d',
+ 'lotimes;': '\u2a34',
+ 'lowast;': '\u2217',
+ 'lowbar;': '_',
+ 'LowerLeftArrow;': '\u2199',
+ 'LowerRightArrow;': '\u2198',
+ 'loz;': '\u25ca',
+ 'lozenge;': '\u25ca',
+ 'lozf;': '\u29eb',
+ 'lpar;': '(',
+ 'lparlt;': '\u2993',
+ 'lrarr;': '\u21c6',
+ 'lrcorner;': '\u231f',
+ 'lrhar;': '\u21cb',
+ 'lrhard;': '\u296d',
+ 'lrm;': '\u200e',
+ 'lrtri;': '\u22bf',
+ 'lsaquo;': '\u2039',
+ 'Lscr;': '\u2112',
+ 'lscr;': '\U0001d4c1',
+ 'Lsh;': '\u21b0',
+ 'lsh;': '\u21b0',
+ 'lsim;': '\u2272',
+ 'lsime;': '\u2a8d',
+ 'lsimg;': '\u2a8f',
+ 'lsqb;': '[',
+ 'lsquo;': '\u2018',
+ 'lsquor;': '\u201a',
+ 'Lstrok;': '\u0141',
+ 'lstrok;': '\u0142',
+ 'LT': '<',
+ 'lt': '<',
+ 'LT;': '<',
+ 'Lt;': '\u226a',
+ 'lt;': '<',
+ 'ltcc;': '\u2aa6',
+ 'ltcir;': '\u2a79',
+ 'ltdot;': '\u22d6',
+ 'lthree;': '\u22cb',
+ 'ltimes;': '\u22c9',
+ 'ltlarr;': '\u2976',
+ 'ltquest;': '\u2a7b',
+ 'ltri;': '\u25c3',
+ 'ltrie;': '\u22b4',
+ 'ltrif;': '\u25c2',
+ 'ltrPar;': '\u2996',
+ 'lurdshar;': '\u294a',
+ 'luruhar;': '\u2966',
+ 'lvertneqq;': '\u2268\ufe00',
+ 'lvnE;': '\u2268\ufe00',
+ 'macr': '\xaf',
+ 'macr;': '\xaf',
+ 'male;': '\u2642',
+ 'malt;': '\u2720',
+ 'maltese;': '\u2720',
+ 'Map;': '\u2905',
+ 'map;': '\u21a6',
+ 'mapsto;': '\u21a6',
+ 'mapstodown;': '\u21a7',
+ 'mapstoleft;': '\u21a4',
+ 'mapstoup;': '\u21a5',
+ 'marker;': '\u25ae',
+ 'mcomma;': '\u2a29',
+ 'Mcy;': '\u041c',
+ 'mcy;': '\u043c',
+ 'mdash;': '\u2014',
+ 'mDDot;': '\u223a',
+ 'measuredangle;': '\u2221',
+ 'MediumSpace;': '\u205f',
+ 'Mellintrf;': '\u2133',
+ 'Mfr;': '\U0001d510',
+ 'mfr;': '\U0001d52a',
+ 'mho;': '\u2127',
+ 'micro': '\xb5',
+ 'micro;': '\xb5',
+ 'mid;': '\u2223',
+ 'midast;': '*',
+ 'midcir;': '\u2af0',
+ 'middot': '\xb7',
+ 'middot;': '\xb7',
+ 'minus;': '\u2212',
+ 'minusb;': '\u229f',
+ 'minusd;': '\u2238',
+ 'minusdu;': '\u2a2a',
+ 'MinusPlus;': '\u2213',
+ 'mlcp;': '\u2adb',
+ 'mldr;': '\u2026',
+ 'mnplus;': '\u2213',
+ 'models;': '\u22a7',
+ 'Mopf;': '\U0001d544',
+ 'mopf;': '\U0001d55e',
+ 'mp;': '\u2213',
+ 'Mscr;': '\u2133',
+ 'mscr;': '\U0001d4c2',
+ 'mstpos;': '\u223e',
+ 'Mu;': '\u039c',
+ 'mu;': '\u03bc',
+ 'multimap;': '\u22b8',
+ 'mumap;': '\u22b8',
+ 'nabla;': '\u2207',
+ 'Nacute;': '\u0143',
+ 'nacute;': '\u0144',
+ 'nang;': '\u2220\u20d2',
+ 'nap;': '\u2249',
+ 'napE;': '\u2a70\u0338',
+ 'napid;': '\u224b\u0338',
+ 'napos;': '\u0149',
+ 'napprox;': '\u2249',
+ 'natur;': '\u266e',
+ 'natural;': '\u266e',
+ 'naturals;': '\u2115',
+ 'nbsp': '\xa0',
+ 'nbsp;': '\xa0',
+ 'nbump;': '\u224e\u0338',
+ 'nbumpe;': '\u224f\u0338',
+ 'ncap;': '\u2a43',
+ 'Ncaron;': '\u0147',
+ 'ncaron;': '\u0148',
+ 'Ncedil;': '\u0145',
+ 'ncedil;': '\u0146',
+ 'ncong;': '\u2247',
+ 'ncongdot;': '\u2a6d\u0338',
+ 'ncup;': '\u2a42',
+ 'Ncy;': '\u041d',
+ 'ncy;': '\u043d',
+ 'ndash;': '\u2013',
+ 'ne;': '\u2260',
+ 'nearhk;': '\u2924',
+ 'neArr;': '\u21d7',
+ 'nearr;': '\u2197',
+ 'nearrow;': '\u2197',
+ 'nedot;': '\u2250\u0338',
+ 'NegativeMediumSpace;': '\u200b',
+ 'NegativeThickSpace;': '\u200b',
+ 'NegativeThinSpace;': '\u200b',
+ 'NegativeVeryThinSpace;': '\u200b',
+ 'nequiv;': '\u2262',
+ 'nesear;': '\u2928',
+ 'nesim;': '\u2242\u0338',
+ 'NestedGreaterGreater;': '\u226b',
+ 'NestedLessLess;': '\u226a',
+ 'NewLine;': '\n',
+ 'nexist;': '\u2204',
+ 'nexists;': '\u2204',
+ 'Nfr;': '\U0001d511',
+ 'nfr;': '\U0001d52b',
+ 'ngE;': '\u2267\u0338',
+ 'nge;': '\u2271',
+ 'ngeq;': '\u2271',
+ 'ngeqq;': '\u2267\u0338',
+ 'ngeqslant;': '\u2a7e\u0338',
+ 'nges;': '\u2a7e\u0338',
+ 'nGg;': '\u22d9\u0338',
+ 'ngsim;': '\u2275',
+ 'nGt;': '\u226b\u20d2',
+ 'ngt;': '\u226f',
+ 'ngtr;': '\u226f',
+ 'nGtv;': '\u226b\u0338',
+ 'nhArr;': '\u21ce',
+ 'nharr;': '\u21ae',
+ 'nhpar;': '\u2af2',
+ 'ni;': '\u220b',
+ 'nis;': '\u22fc',
+ 'nisd;': '\u22fa',
+ 'niv;': '\u220b',
+ 'NJcy;': '\u040a',
+ 'njcy;': '\u045a',
+ 'nlArr;': '\u21cd',
+ 'nlarr;': '\u219a',
+ 'nldr;': '\u2025',
+ 'nlE;': '\u2266\u0338',
+ 'nle;': '\u2270',
+ 'nLeftarrow;': '\u21cd',
+ 'nleftarrow;': '\u219a',
+ 'nLeftrightarrow;': '\u21ce',
+ 'nleftrightarrow;': '\u21ae',
+ 'nleq;': '\u2270',
+ 'nleqq;': '\u2266\u0338',
+ 'nleqslant;': '\u2a7d\u0338',
+ 'nles;': '\u2a7d\u0338',
+ 'nless;': '\u226e',
+ 'nLl;': '\u22d8\u0338',
+ 'nlsim;': '\u2274',
+ 'nLt;': '\u226a\u20d2',
+ 'nlt;': '\u226e',
+ 'nltri;': '\u22ea',
+ 'nltrie;': '\u22ec',
+ 'nLtv;': '\u226a\u0338',
+ 'nmid;': '\u2224',
+ 'NoBreak;': '\u2060',
+ 'NonBreakingSpace;': '\xa0',
+ 'Nopf;': '\u2115',
+ 'nopf;': '\U0001d55f',
+ 'not': '\xac',
+ 'Not;': '\u2aec',
+ 'not;': '\xac',
+ 'NotCongruent;': '\u2262',
+ 'NotCupCap;': '\u226d',
+ 'NotDoubleVerticalBar;': '\u2226',
+ 'NotElement;': '\u2209',
+ 'NotEqual;': '\u2260',
+ 'NotEqualTilde;': '\u2242\u0338',
+ 'NotExists;': '\u2204',
+ 'NotGreater;': '\u226f',
+ 'NotGreaterEqual;': '\u2271',
+ 'NotGreaterFullEqual;': '\u2267\u0338',
+ 'NotGreaterGreater;': '\u226b\u0338',
+ 'NotGreaterLess;': '\u2279',
+ 'NotGreaterSlantEqual;': '\u2a7e\u0338',
+ 'NotGreaterTilde;': '\u2275',
+ 'NotHumpDownHump;': '\u224e\u0338',
+ 'NotHumpEqual;': '\u224f\u0338',
+ 'notin;': '\u2209',
+ 'notindot;': '\u22f5\u0338',
+ 'notinE;': '\u22f9\u0338',
+ 'notinva;': '\u2209',
+ 'notinvb;': '\u22f7',
+ 'notinvc;': '\u22f6',
+ 'NotLeftTriangle;': '\u22ea',
+ 'NotLeftTriangleBar;': '\u29cf\u0338',
+ 'NotLeftTriangleEqual;': '\u22ec',
+ 'NotLess;': '\u226e',
+ 'NotLessEqual;': '\u2270',
+ 'NotLessGreater;': '\u2278',
+ 'NotLessLess;': '\u226a\u0338',
+ 'NotLessSlantEqual;': '\u2a7d\u0338',
+ 'NotLessTilde;': '\u2274',
+ 'NotNestedGreaterGreater;': '\u2aa2\u0338',
+ 'NotNestedLessLess;': '\u2aa1\u0338',
+ 'notni;': '\u220c',
+ 'notniva;': '\u220c',
+ 'notnivb;': '\u22fe',
+ 'notnivc;': '\u22fd',
+ 'NotPrecedes;': '\u2280',
+ 'NotPrecedesEqual;': '\u2aaf\u0338',
+ 'NotPrecedesSlantEqual;': '\u22e0',
+ 'NotReverseElement;': '\u220c',
+ 'NotRightTriangle;': '\u22eb',
+ 'NotRightTriangleBar;': '\u29d0\u0338',
+ 'NotRightTriangleEqual;': '\u22ed',
+ 'NotSquareSubset;': '\u228f\u0338',
+ 'NotSquareSubsetEqual;': '\u22e2',
+ 'NotSquareSuperset;': '\u2290\u0338',
+ 'NotSquareSupersetEqual;': '\u22e3',
+ 'NotSubset;': '\u2282\u20d2',
+ 'NotSubsetEqual;': '\u2288',
+ 'NotSucceeds;': '\u2281',
+ 'NotSucceedsEqual;': '\u2ab0\u0338',
+ 'NotSucceedsSlantEqual;': '\u22e1',
+ 'NotSucceedsTilde;': '\u227f\u0338',
+ 'NotSuperset;': '\u2283\u20d2',
+ 'NotSupersetEqual;': '\u2289',
+ 'NotTilde;': '\u2241',
+ 'NotTildeEqual;': '\u2244',
+ 'NotTildeFullEqual;': '\u2247',
+ 'NotTildeTilde;': '\u2249',
+ 'NotVerticalBar;': '\u2224',
+ 'npar;': '\u2226',
+ 'nparallel;': '\u2226',
+ 'nparsl;': '\u2afd\u20e5',
+ 'npart;': '\u2202\u0338',
+ 'npolint;': '\u2a14',
+ 'npr;': '\u2280',
+ 'nprcue;': '\u22e0',
+ 'npre;': '\u2aaf\u0338',
+ 'nprec;': '\u2280',
+ 'npreceq;': '\u2aaf\u0338',
+ 'nrArr;': '\u21cf',
+ 'nrarr;': '\u219b',
+ 'nrarrc;': '\u2933\u0338',
+ 'nrarrw;': '\u219d\u0338',
+ 'nRightarrow;': '\u21cf',
+ 'nrightarrow;': '\u219b',
+ 'nrtri;': '\u22eb',
+ 'nrtrie;': '\u22ed',
+ 'nsc;': '\u2281',
+ 'nsccue;': '\u22e1',
+ 'nsce;': '\u2ab0\u0338',
+ 'Nscr;': '\U0001d4a9',
+ 'nscr;': '\U0001d4c3',
+ 'nshortmid;': '\u2224',
+ 'nshortparallel;': '\u2226',
+ 'nsim;': '\u2241',
+ 'nsime;': '\u2244',
+ 'nsimeq;': '\u2244',
+ 'nsmid;': '\u2224',
+ 'nspar;': '\u2226',
+ 'nsqsube;': '\u22e2',
+ 'nsqsupe;': '\u22e3',
+ 'nsub;': '\u2284',
+ 'nsubE;': '\u2ac5\u0338',
+ 'nsube;': '\u2288',
+ 'nsubset;': '\u2282\u20d2',
+ 'nsubseteq;': '\u2288',
+ 'nsubseteqq;': '\u2ac5\u0338',
+ 'nsucc;': '\u2281',
+ 'nsucceq;': '\u2ab0\u0338',
+ 'nsup;': '\u2285',
+ 'nsupE;': '\u2ac6\u0338',
+ 'nsupe;': '\u2289',
+ 'nsupset;': '\u2283\u20d2',
+ 'nsupseteq;': '\u2289',
+ 'nsupseteqq;': '\u2ac6\u0338',
+ 'ntgl;': '\u2279',
+ 'Ntilde': '\xd1',
+ 'ntilde': '\xf1',
+ 'Ntilde;': '\xd1',
+ 'ntilde;': '\xf1',
+ 'ntlg;': '\u2278',
+ 'ntriangleleft;': '\u22ea',
+ 'ntrianglelefteq;': '\u22ec',
+ 'ntriangleright;': '\u22eb',
+ 'ntrianglerighteq;': '\u22ed',
+ 'Nu;': '\u039d',
+ 'nu;': '\u03bd',
+ 'num;': '#',
+ 'numero;': '\u2116',
+ 'numsp;': '\u2007',
+ 'nvap;': '\u224d\u20d2',
+ 'nVDash;': '\u22af',
+ 'nVdash;': '\u22ae',
+ 'nvDash;': '\u22ad',
+ 'nvdash;': '\u22ac',
+ 'nvge;': '\u2265\u20d2',
+ 'nvgt;': '>\u20d2',
+ 'nvHarr;': '\u2904',
+ 'nvinfin;': '\u29de',
+ 'nvlArr;': '\u2902',
+ 'nvle;': '\u2264\u20d2',
+ 'nvlt;': '<\u20d2',
+ 'nvltrie;': '\u22b4\u20d2',
+ 'nvrArr;': '\u2903',
+ 'nvrtrie;': '\u22b5\u20d2',
+ 'nvsim;': '\u223c\u20d2',
+ 'nwarhk;': '\u2923',
+ 'nwArr;': '\u21d6',
+ 'nwarr;': '\u2196',
+ 'nwarrow;': '\u2196',
+ 'nwnear;': '\u2927',
+ 'Oacute': '\xd3',
+ 'oacute': '\xf3',
+ 'Oacute;': '\xd3',
+ 'oacute;': '\xf3',
+ 'oast;': '\u229b',
+ 'ocir;': '\u229a',
+ 'Ocirc': '\xd4',
+ 'ocirc': '\xf4',
+ 'Ocirc;': '\xd4',
+ 'ocirc;': '\xf4',
+ 'Ocy;': '\u041e',
+ 'ocy;': '\u043e',
+ 'odash;': '\u229d',
+ 'Odblac;': '\u0150',
+ 'odblac;': '\u0151',
+ 'odiv;': '\u2a38',
+ 'odot;': '\u2299',
+ 'odsold;': '\u29bc',
+ 'OElig;': '\u0152',
+ 'oelig;': '\u0153',
+ 'ofcir;': '\u29bf',
+ 'Ofr;': '\U0001d512',
+ 'ofr;': '\U0001d52c',
+ 'ogon;': '\u02db',
+ 'Ograve': '\xd2',
+ 'ograve': '\xf2',
+ 'Ograve;': '\xd2',
+ 'ograve;': '\xf2',
+ 'ogt;': '\u29c1',
+ 'ohbar;': '\u29b5',
+ 'ohm;': '\u03a9',
+ 'oint;': '\u222e',
+ 'olarr;': '\u21ba',
+ 'olcir;': '\u29be',
+ 'olcross;': '\u29bb',
+ 'oline;': '\u203e',
+ 'olt;': '\u29c0',
+ 'Omacr;': '\u014c',
+ 'omacr;': '\u014d',
+ 'Omega;': '\u03a9',
+ 'omega;': '\u03c9',
+ 'Omicron;': '\u039f',
+ 'omicron;': '\u03bf',
+ 'omid;': '\u29b6',
+ 'ominus;': '\u2296',
+ 'Oopf;': '\U0001d546',
+ 'oopf;': '\U0001d560',
+ 'opar;': '\u29b7',
+ 'OpenCurlyDoubleQuote;': '\u201c',
+ 'OpenCurlyQuote;': '\u2018',
+ 'operp;': '\u29b9',
+ 'oplus;': '\u2295',
+ 'Or;': '\u2a54',
+ 'or;': '\u2228',
+ 'orarr;': '\u21bb',
+ 'ord;': '\u2a5d',
+ 'order;': '\u2134',
+ 'orderof;': '\u2134',
+ 'ordf': '\xaa',
+ 'ordf;': '\xaa',
+ 'ordm': '\xba',
+ 'ordm;': '\xba',
+ 'origof;': '\u22b6',
+ 'oror;': '\u2a56',
+ 'orslope;': '\u2a57',
+ 'orv;': '\u2a5b',
+ 'oS;': '\u24c8',
+ 'Oscr;': '\U0001d4aa',
+ 'oscr;': '\u2134',
+ 'Oslash': '\xd8',
+ 'oslash': '\xf8',
+ 'Oslash;': '\xd8',
+ 'oslash;': '\xf8',
+ 'osol;': '\u2298',
+ 'Otilde': '\xd5',
+ 'otilde': '\xf5',
+ 'Otilde;': '\xd5',
+ 'otilde;': '\xf5',
+ 'Otimes;': '\u2a37',
+ 'otimes;': '\u2297',
+ 'otimesas;': '\u2a36',
+ 'Ouml': '\xd6',
+ 'ouml': '\xf6',
+ 'Ouml;': '\xd6',
+ 'ouml;': '\xf6',
+ 'ovbar;': '\u233d',
+ 'OverBar;': '\u203e',
+ 'OverBrace;': '\u23de',
+ 'OverBracket;': '\u23b4',
+ 'OverParenthesis;': '\u23dc',
+ 'par;': '\u2225',
+ 'para': '\xb6',
+ 'para;': '\xb6',
+ 'parallel;': '\u2225',
+ 'parsim;': '\u2af3',
+ 'parsl;': '\u2afd',
+ 'part;': '\u2202',
+ 'PartialD;': '\u2202',
+ 'Pcy;': '\u041f',
+ 'pcy;': '\u043f',
+ 'percnt;': '%',
+ 'period;': '.',
+ 'permil;': '\u2030',
+ 'perp;': '\u22a5',
+ 'pertenk;': '\u2031',
+ 'Pfr;': '\U0001d513',
+ 'pfr;': '\U0001d52d',
+ 'Phi;': '\u03a6',
+ 'phi;': '\u03c6',
+ 'phiv;': '\u03d5',
+ 'phmmat;': '\u2133',
+ 'phone;': '\u260e',
+ 'Pi;': '\u03a0',
+ 'pi;': '\u03c0',
+ 'pitchfork;': '\u22d4',
+ 'piv;': '\u03d6',
+ 'planck;': '\u210f',
+ 'planckh;': '\u210e',
+ 'plankv;': '\u210f',
+ 'plus;': '+',
+ 'plusacir;': '\u2a23',
+ 'plusb;': '\u229e',
+ 'pluscir;': '\u2a22',
+ 'plusdo;': '\u2214',
+ 'plusdu;': '\u2a25',
+ 'pluse;': '\u2a72',
+ 'PlusMinus;': '\xb1',
+ 'plusmn': '\xb1',
+ 'plusmn;': '\xb1',
+ 'plussim;': '\u2a26',
+ 'plustwo;': '\u2a27',
+ 'pm;': '\xb1',
+ 'Poincareplane;': '\u210c',
+ 'pointint;': '\u2a15',
+ 'Popf;': '\u2119',
+ 'popf;': '\U0001d561',
+ 'pound': '\xa3',
+ 'pound;': '\xa3',
+ 'Pr;': '\u2abb',
+ 'pr;': '\u227a',
+ 'prap;': '\u2ab7',
+ 'prcue;': '\u227c',
+ 'prE;': '\u2ab3',
+ 'pre;': '\u2aaf',
+ 'prec;': '\u227a',
+ 'precapprox;': '\u2ab7',
+ 'preccurlyeq;': '\u227c',
+ 'Precedes;': '\u227a',
+ 'PrecedesEqual;': '\u2aaf',
+ 'PrecedesSlantEqual;': '\u227c',
+ 'PrecedesTilde;': '\u227e',
+ 'preceq;': '\u2aaf',
+ 'precnapprox;': '\u2ab9',
+ 'precneqq;': '\u2ab5',
+ 'precnsim;': '\u22e8',
+ 'precsim;': '\u227e',
+ 'Prime;': '\u2033',
+ 'prime;': '\u2032',
+ 'primes;': '\u2119',
+ 'prnap;': '\u2ab9',
+ 'prnE;': '\u2ab5',
+ 'prnsim;': '\u22e8',
+ 'prod;': '\u220f',
+ 'Product;': '\u220f',
+ 'profalar;': '\u232e',
+ 'profline;': '\u2312',
+ 'profsurf;': '\u2313',
+ 'prop;': '\u221d',
+ 'Proportion;': '\u2237',
+ 'Proportional;': '\u221d',
+ 'propto;': '\u221d',
+ 'prsim;': '\u227e',
+ 'prurel;': '\u22b0',
+ 'Pscr;': '\U0001d4ab',
+ 'pscr;': '\U0001d4c5',
+ 'Psi;': '\u03a8',
+ 'psi;': '\u03c8',
+ 'puncsp;': '\u2008',
+ 'Qfr;': '\U0001d514',
+ 'qfr;': '\U0001d52e',
+ 'qint;': '\u2a0c',
+ 'Qopf;': '\u211a',
+ 'qopf;': '\U0001d562',
+ 'qprime;': '\u2057',
+ 'Qscr;': '\U0001d4ac',
+ 'qscr;': '\U0001d4c6',
+ 'quaternions;': '\u210d',
+ 'quatint;': '\u2a16',
+ 'quest;': '?',
+ 'questeq;': '\u225f',
+ 'QUOT': '"',
+ 'quot': '"',
+ 'QUOT;': '"',
+ 'quot;': '"',
+ 'rAarr;': '\u21db',
+ 'race;': '\u223d\u0331',
+ 'Racute;': '\u0154',
+ 'racute;': '\u0155',
+ 'radic;': '\u221a',
+ 'raemptyv;': '\u29b3',
+ 'Rang;': '\u27eb',
+ 'rang;': '\u27e9',
+ 'rangd;': '\u2992',
+ 'range;': '\u29a5',
+ 'rangle;': '\u27e9',
+ 'raquo': '\xbb',
+ 'raquo;': '\xbb',
+ 'Rarr;': '\u21a0',
+ 'rArr;': '\u21d2',
+ 'rarr;': '\u2192',
+ 'rarrap;': '\u2975',
+ 'rarrb;': '\u21e5',
+ 'rarrbfs;': '\u2920',
+ 'rarrc;': '\u2933',
+ 'rarrfs;': '\u291e',
+ 'rarrhk;': '\u21aa',
+ 'rarrlp;': '\u21ac',
+ 'rarrpl;': '\u2945',
+ 'rarrsim;': '\u2974',
+ 'Rarrtl;': '\u2916',
+ 'rarrtl;': '\u21a3',
+ 'rarrw;': '\u219d',
+ 'rAtail;': '\u291c',
+ 'ratail;': '\u291a',
+ 'ratio;': '\u2236',
+ 'rationals;': '\u211a',
+ 'RBarr;': '\u2910',
+ 'rBarr;': '\u290f',
+ 'rbarr;': '\u290d',
+ 'rbbrk;': '\u2773',
+ 'rbrace;': '}',
+ 'rbrack;': ']',
+ 'rbrke;': '\u298c',
+ 'rbrksld;': '\u298e',
+ 'rbrkslu;': '\u2990',
+ 'Rcaron;': '\u0158',
+ 'rcaron;': '\u0159',
+ 'Rcedil;': '\u0156',
+ 'rcedil;': '\u0157',
+ 'rceil;': '\u2309',
+ 'rcub;': '}',
+ 'Rcy;': '\u0420',
+ 'rcy;': '\u0440',
+ 'rdca;': '\u2937',
+ 'rdldhar;': '\u2969',
+ 'rdquo;': '\u201d',
+ 'rdquor;': '\u201d',
+ 'rdsh;': '\u21b3',
+ 'Re;': '\u211c',
+ 'real;': '\u211c',
+ 'realine;': '\u211b',
+ 'realpart;': '\u211c',
+ 'reals;': '\u211d',
+ 'rect;': '\u25ad',
+ 'REG': '\xae',
+ 'reg': '\xae',
+ 'REG;': '\xae',
+ 'reg;': '\xae',
+ 'ReverseElement;': '\u220b',
+ 'ReverseEquilibrium;': '\u21cb',
+ 'ReverseUpEquilibrium;': '\u296f',
+ 'rfisht;': '\u297d',
+ 'rfloor;': '\u230b',
+ 'Rfr;': '\u211c',
+ 'rfr;': '\U0001d52f',
+ 'rHar;': '\u2964',
+ 'rhard;': '\u21c1',
+ 'rharu;': '\u21c0',
+ 'rharul;': '\u296c',
+ 'Rho;': '\u03a1',
+ 'rho;': '\u03c1',
+ 'rhov;': '\u03f1',
+ 'RightAngleBracket;': '\u27e9',
+ 'RightArrow;': '\u2192',
+ 'Rightarrow;': '\u21d2',
+ 'rightarrow;': '\u2192',
+ 'RightArrowBar;': '\u21e5',
+ 'RightArrowLeftArrow;': '\u21c4',
+ 'rightarrowtail;': '\u21a3',
+ 'RightCeiling;': '\u2309',
+ 'RightDoubleBracket;': '\u27e7',
+ 'RightDownTeeVector;': '\u295d',
+ 'RightDownVector;': '\u21c2',
+ 'RightDownVectorBar;': '\u2955',
+ 'RightFloor;': '\u230b',
+ 'rightharpoondown;': '\u21c1',
+ 'rightharpoonup;': '\u21c0',
+ 'rightleftarrows;': '\u21c4',
+ 'rightleftharpoons;': '\u21cc',
+ 'rightrightarrows;': '\u21c9',
+ 'rightsquigarrow;': '\u219d',
+ 'RightTee;': '\u22a2',
+ 'RightTeeArrow;': '\u21a6',
+ 'RightTeeVector;': '\u295b',
+ 'rightthreetimes;': '\u22cc',
+ 'RightTriangle;': '\u22b3',
+ 'RightTriangleBar;': '\u29d0',
+ 'RightTriangleEqual;': '\u22b5',
+ 'RightUpDownVector;': '\u294f',
+ 'RightUpTeeVector;': '\u295c',
+ 'RightUpVector;': '\u21be',
+ 'RightUpVectorBar;': '\u2954',
+ 'RightVector;': '\u21c0',
+ 'RightVectorBar;': '\u2953',
+ 'ring;': '\u02da',
+ 'risingdotseq;': '\u2253',
+ 'rlarr;': '\u21c4',
+ 'rlhar;': '\u21cc',
+ 'rlm;': '\u200f',
+ 'rmoust;': '\u23b1',
+ 'rmoustache;': '\u23b1',
+ 'rnmid;': '\u2aee',
+ 'roang;': '\u27ed',
+ 'roarr;': '\u21fe',
+ 'robrk;': '\u27e7',
+ 'ropar;': '\u2986',
+ 'Ropf;': '\u211d',
+ 'ropf;': '\U0001d563',
+ 'roplus;': '\u2a2e',
+ 'rotimes;': '\u2a35',
+ 'RoundImplies;': '\u2970',
+ 'rpar;': ')',
+ 'rpargt;': '\u2994',
+ 'rppolint;': '\u2a12',
+ 'rrarr;': '\u21c9',
+ 'Rrightarrow;': '\u21db',
+ 'rsaquo;': '\u203a',
+ 'Rscr;': '\u211b',
+ 'rscr;': '\U0001d4c7',
+ 'Rsh;': '\u21b1',
+ 'rsh;': '\u21b1',
+ 'rsqb;': ']',
+ 'rsquo;': '\u2019',
+ 'rsquor;': '\u2019',
+ 'rthree;': '\u22cc',
+ 'rtimes;': '\u22ca',
+ 'rtri;': '\u25b9',
+ 'rtrie;': '\u22b5',
+ 'rtrif;': '\u25b8',
+ 'rtriltri;': '\u29ce',
+ 'RuleDelayed;': '\u29f4',
+ 'ruluhar;': '\u2968',
+ 'rx;': '\u211e',
+ 'Sacute;': '\u015a',
+ 'sacute;': '\u015b',
+ 'sbquo;': '\u201a',
+ 'Sc;': '\u2abc',
+ 'sc;': '\u227b',
+ 'scap;': '\u2ab8',
+ 'Scaron;': '\u0160',
+ 'scaron;': '\u0161',
+ 'sccue;': '\u227d',
+ 'scE;': '\u2ab4',
+ 'sce;': '\u2ab0',
+ 'Scedil;': '\u015e',
+ 'scedil;': '\u015f',
+ 'Scirc;': '\u015c',
+ 'scirc;': '\u015d',
+ 'scnap;': '\u2aba',
+ 'scnE;': '\u2ab6',
+ 'scnsim;': '\u22e9',
+ 'scpolint;': '\u2a13',
+ 'scsim;': '\u227f',
+ 'Scy;': '\u0421',
+ 'scy;': '\u0441',
+ 'sdot;': '\u22c5',
+ 'sdotb;': '\u22a1',
+ 'sdote;': '\u2a66',
+ 'searhk;': '\u2925',
+ 'seArr;': '\u21d8',
+ 'searr;': '\u2198',
+ 'searrow;': '\u2198',
+ 'sect': '\xa7',
+ 'sect;': '\xa7',
+ 'semi;': ';',
+ 'seswar;': '\u2929',
+ 'setminus;': '\u2216',
+ 'setmn;': '\u2216',
+ 'sext;': '\u2736',
+ 'Sfr;': '\U0001d516',
+ 'sfr;': '\U0001d530',
+ 'sfrown;': '\u2322',
+ 'sharp;': '\u266f',
+ 'SHCHcy;': '\u0429',
+ 'shchcy;': '\u0449',
+ 'SHcy;': '\u0428',
+ 'shcy;': '\u0448',
+ 'ShortDownArrow;': '\u2193',
+ 'ShortLeftArrow;': '\u2190',
+ 'shortmid;': '\u2223',
+ 'shortparallel;': '\u2225',
+ 'ShortRightArrow;': '\u2192',
+ 'ShortUpArrow;': '\u2191',
+ 'shy': '\xad',
+ 'shy;': '\xad',
+ 'Sigma;': '\u03a3',
+ 'sigma;': '\u03c3',
+ 'sigmaf;': '\u03c2',
+ 'sigmav;': '\u03c2',
+ 'sim;': '\u223c',
+ 'simdot;': '\u2a6a',
+ 'sime;': '\u2243',
+ 'simeq;': '\u2243',
+ 'simg;': '\u2a9e',
+ 'simgE;': '\u2aa0',
+ 'siml;': '\u2a9d',
+ 'simlE;': '\u2a9f',
+ 'simne;': '\u2246',
+ 'simplus;': '\u2a24',
+ 'simrarr;': '\u2972',
+ 'slarr;': '\u2190',
+ 'SmallCircle;': '\u2218',
+ 'smallsetminus;': '\u2216',
+ 'smashp;': '\u2a33',
+ 'smeparsl;': '\u29e4',
+ 'smid;': '\u2223',
+ 'smile;': '\u2323',
+ 'smt;': '\u2aaa',
+ 'smte;': '\u2aac',
+ 'smtes;': '\u2aac\ufe00',
+ 'SOFTcy;': '\u042c',
+ 'softcy;': '\u044c',
+ 'sol;': '/',
+ 'solb;': '\u29c4',
+ 'solbar;': '\u233f',
+ 'Sopf;': '\U0001d54a',
+ 'sopf;': '\U0001d564',
+ 'spades;': '\u2660',
+ 'spadesuit;': '\u2660',
+ 'spar;': '\u2225',
+ 'sqcap;': '\u2293',
+ 'sqcaps;': '\u2293\ufe00',
+ 'sqcup;': '\u2294',
+ 'sqcups;': '\u2294\ufe00',
+ 'Sqrt;': '\u221a',
+ 'sqsub;': '\u228f',
+ 'sqsube;': '\u2291',
+ 'sqsubset;': '\u228f',
+ 'sqsubseteq;': '\u2291',
+ 'sqsup;': '\u2290',
+ 'sqsupe;': '\u2292',
+ 'sqsupset;': '\u2290',
+ 'sqsupseteq;': '\u2292',
+ 'squ;': '\u25a1',
+ 'Square;': '\u25a1',
+ 'square;': '\u25a1',
+ 'SquareIntersection;': '\u2293',
+ 'SquareSubset;': '\u228f',
+ 'SquareSubsetEqual;': '\u2291',
+ 'SquareSuperset;': '\u2290',
+ 'SquareSupersetEqual;': '\u2292',
+ 'SquareUnion;': '\u2294',
+ 'squarf;': '\u25aa',
+ 'squf;': '\u25aa',
+ 'srarr;': '\u2192',
+ 'Sscr;': '\U0001d4ae',
+ 'sscr;': '\U0001d4c8',
+ 'ssetmn;': '\u2216',
+ 'ssmile;': '\u2323',
+ 'sstarf;': '\u22c6',
+ 'Star;': '\u22c6',
+ 'star;': '\u2606',
+ 'starf;': '\u2605',
+ 'straightepsilon;': '\u03f5',
+ 'straightphi;': '\u03d5',
+ 'strns;': '\xaf',
+ 'Sub;': '\u22d0',
+ 'sub;': '\u2282',
+ 'subdot;': '\u2abd',
+ 'subE;': '\u2ac5',
+ 'sube;': '\u2286',
+ 'subedot;': '\u2ac3',
+ 'submult;': '\u2ac1',
+ 'subnE;': '\u2acb',
+ 'subne;': '\u228a',
+ 'subplus;': '\u2abf',
+ 'subrarr;': '\u2979',
+ 'Subset;': '\u22d0',
+ 'subset;': '\u2282',
+ 'subseteq;': '\u2286',
+ 'subseteqq;': '\u2ac5',
+ 'SubsetEqual;': '\u2286',
+ 'subsetneq;': '\u228a',
+ 'subsetneqq;': '\u2acb',
+ 'subsim;': '\u2ac7',
+ 'subsub;': '\u2ad5',
+ 'subsup;': '\u2ad3',
+ 'succ;': '\u227b',
+ 'succapprox;': '\u2ab8',
+ 'succcurlyeq;': '\u227d',
+ 'Succeeds;': '\u227b',
+ 'SucceedsEqual;': '\u2ab0',
+ 'SucceedsSlantEqual;': '\u227d',
+ 'SucceedsTilde;': '\u227f',
+ 'succeq;': '\u2ab0',
+ 'succnapprox;': '\u2aba',
+ 'succneqq;': '\u2ab6',
+ 'succnsim;': '\u22e9',
+ 'succsim;': '\u227f',
+ 'SuchThat;': '\u220b',
+ 'Sum;': '\u2211',
+ 'sum;': '\u2211',
+ 'sung;': '\u266a',
+ 'sup1': '\xb9',
+ 'sup1;': '\xb9',
+ 'sup2': '\xb2',
+ 'sup2;': '\xb2',
+ 'sup3': '\xb3',
+ 'sup3;': '\xb3',
+ 'Sup;': '\u22d1',
+ 'sup;': '\u2283',
+ 'supdot;': '\u2abe',
+ 'supdsub;': '\u2ad8',
+ 'supE;': '\u2ac6',
+ 'supe;': '\u2287',
+ 'supedot;': '\u2ac4',
+ 'Superset;': '\u2283',
+ 'SupersetEqual;': '\u2287',
+ 'suphsol;': '\u27c9',
+ 'suphsub;': '\u2ad7',
+ 'suplarr;': '\u297b',
+ 'supmult;': '\u2ac2',
+ 'supnE;': '\u2acc',
+ 'supne;': '\u228b',
+ 'supplus;': '\u2ac0',
+ 'Supset;': '\u22d1',
+ 'supset;': '\u2283',
+ 'supseteq;': '\u2287',
+ 'supseteqq;': '\u2ac6',
+ 'supsetneq;': '\u228b',
+ 'supsetneqq;': '\u2acc',
+ 'supsim;': '\u2ac8',
+ 'supsub;': '\u2ad4',
+ 'supsup;': '\u2ad6',
+ 'swarhk;': '\u2926',
+ 'swArr;': '\u21d9',
+ 'swarr;': '\u2199',
+ 'swarrow;': '\u2199',
+ 'swnwar;': '\u292a',
+ 'szlig': '\xdf',
+ 'szlig;': '\xdf',
+ 'Tab;': '\t',
+ 'target;': '\u2316',
+ 'Tau;': '\u03a4',
+ 'tau;': '\u03c4',
+ 'tbrk;': '\u23b4',
+ 'Tcaron;': '\u0164',
+ 'tcaron;': '\u0165',
+ 'Tcedil;': '\u0162',
+ 'tcedil;': '\u0163',
+ 'Tcy;': '\u0422',
+ 'tcy;': '\u0442',
+ 'tdot;': '\u20db',
+ 'telrec;': '\u2315',
+ 'Tfr;': '\U0001d517',
+ 'tfr;': '\U0001d531',
+ 'there4;': '\u2234',
+ 'Therefore;': '\u2234',
+ 'therefore;': '\u2234',
+ 'Theta;': '\u0398',
+ 'theta;': '\u03b8',
+ 'thetasym;': '\u03d1',
+ 'thetav;': '\u03d1',
+ 'thickapprox;': '\u2248',
+ 'thicksim;': '\u223c',
+ 'ThickSpace;': '\u205f\u200a',
+ 'thinsp;': '\u2009',
+ 'ThinSpace;': '\u2009',
+ 'thkap;': '\u2248',
+ 'thksim;': '\u223c',
+ 'THORN': '\xde',
+ 'thorn': '\xfe',
+ 'THORN;': '\xde',
+ 'thorn;': '\xfe',
+ 'Tilde;': '\u223c',
+ 'tilde;': '\u02dc',
+ 'TildeEqual;': '\u2243',
+ 'TildeFullEqual;': '\u2245',
+ 'TildeTilde;': '\u2248',
+ 'times': '\xd7',
+ 'times;': '\xd7',
+ 'timesb;': '\u22a0',
+ 'timesbar;': '\u2a31',
+ 'timesd;': '\u2a30',
+ 'tint;': '\u222d',
+ 'toea;': '\u2928',
+ 'top;': '\u22a4',
+ 'topbot;': '\u2336',
+ 'topcir;': '\u2af1',
+ 'Topf;': '\U0001d54b',
+ 'topf;': '\U0001d565',
+ 'topfork;': '\u2ada',
+ 'tosa;': '\u2929',
+ 'tprime;': '\u2034',
+ 'TRADE;': '\u2122',
+ 'trade;': '\u2122',
+ 'triangle;': '\u25b5',
+ 'triangledown;': '\u25bf',
+ 'triangleleft;': '\u25c3',
+ 'trianglelefteq;': '\u22b4',
+ 'triangleq;': '\u225c',
+ 'triangleright;': '\u25b9',
+ 'trianglerighteq;': '\u22b5',
+ 'tridot;': '\u25ec',
+ 'trie;': '\u225c',
+ 'triminus;': '\u2a3a',
+ 'TripleDot;': '\u20db',
+ 'triplus;': '\u2a39',
+ 'trisb;': '\u29cd',
+ 'tritime;': '\u2a3b',
+ 'trpezium;': '\u23e2',
+ 'Tscr;': '\U0001d4af',
+ 'tscr;': '\U0001d4c9',
+ 'TScy;': '\u0426',
+ 'tscy;': '\u0446',
+ 'TSHcy;': '\u040b',
+ 'tshcy;': '\u045b',
+ 'Tstrok;': '\u0166',
+ 'tstrok;': '\u0167',
+ 'twixt;': '\u226c',
+ 'twoheadleftarrow;': '\u219e',
+ 'twoheadrightarrow;': '\u21a0',
+ 'Uacute': '\xda',
+ 'uacute': '\xfa',
+ 'Uacute;': '\xda',
+ 'uacute;': '\xfa',
+ 'Uarr;': '\u219f',
+ 'uArr;': '\u21d1',
+ 'uarr;': '\u2191',
+ 'Uarrocir;': '\u2949',
+ 'Ubrcy;': '\u040e',
+ 'ubrcy;': '\u045e',
+ 'Ubreve;': '\u016c',
+ 'ubreve;': '\u016d',
+ 'Ucirc': '\xdb',
+ 'ucirc': '\xfb',
+ 'Ucirc;': '\xdb',
+ 'ucirc;': '\xfb',
+ 'Ucy;': '\u0423',
+ 'ucy;': '\u0443',
+ 'udarr;': '\u21c5',
+ 'Udblac;': '\u0170',
+ 'udblac;': '\u0171',
+ 'udhar;': '\u296e',
+ 'ufisht;': '\u297e',
+ 'Ufr;': '\U0001d518',
+ 'ufr;': '\U0001d532',
+ 'Ugrave': '\xd9',
+ 'ugrave': '\xf9',
+ 'Ugrave;': '\xd9',
+ 'ugrave;': '\xf9',
+ 'uHar;': '\u2963',
+ 'uharl;': '\u21bf',
+ 'uharr;': '\u21be',
+ 'uhblk;': '\u2580',
+ 'ulcorn;': '\u231c',
+ 'ulcorner;': '\u231c',
+ 'ulcrop;': '\u230f',
+ 'ultri;': '\u25f8',
+ 'Umacr;': '\u016a',
+ 'umacr;': '\u016b',
+ 'uml': '\xa8',
+ 'uml;': '\xa8',
+ 'UnderBar;': '_',
+ 'UnderBrace;': '\u23df',
+ 'UnderBracket;': '\u23b5',
+ 'UnderParenthesis;': '\u23dd',
+ 'Union;': '\u22c3',
+ 'UnionPlus;': '\u228e',
+ 'Uogon;': '\u0172',
+ 'uogon;': '\u0173',
+ 'Uopf;': '\U0001d54c',
+ 'uopf;': '\U0001d566',
+ 'UpArrow;': '\u2191',
+ 'Uparrow;': '\u21d1',
+ 'uparrow;': '\u2191',
+ 'UpArrowBar;': '\u2912',
+ 'UpArrowDownArrow;': '\u21c5',
+ 'UpDownArrow;': '\u2195',
+ 'Updownarrow;': '\u21d5',
+ 'updownarrow;': '\u2195',
+ 'UpEquilibrium;': '\u296e',
+ 'upharpoonleft;': '\u21bf',
+ 'upharpoonright;': '\u21be',
+ 'uplus;': '\u228e',
+ 'UpperLeftArrow;': '\u2196',
+ 'UpperRightArrow;': '\u2197',
+ 'Upsi;': '\u03d2',
+ 'upsi;': '\u03c5',
+ 'upsih;': '\u03d2',
+ 'Upsilon;': '\u03a5',
+ 'upsilon;': '\u03c5',
+ 'UpTee;': '\u22a5',
+ 'UpTeeArrow;': '\u21a5',
+ 'upuparrows;': '\u21c8',
+ 'urcorn;': '\u231d',
+ 'urcorner;': '\u231d',
+ 'urcrop;': '\u230e',
+ 'Uring;': '\u016e',
+ 'uring;': '\u016f',
+ 'urtri;': '\u25f9',
+ 'Uscr;': '\U0001d4b0',
+ 'uscr;': '\U0001d4ca',
+ 'utdot;': '\u22f0',
+ 'Utilde;': '\u0168',
+ 'utilde;': '\u0169',
+ 'utri;': '\u25b5',
+ 'utrif;': '\u25b4',
+ 'uuarr;': '\u21c8',
+ 'Uuml': '\xdc',
+ 'uuml': '\xfc',
+ 'Uuml;': '\xdc',
+ 'uuml;': '\xfc',
+ 'uwangle;': '\u29a7',
+ 'vangrt;': '\u299c',
+ 'varepsilon;': '\u03f5',
+ 'varkappa;': '\u03f0',
+ 'varnothing;': '\u2205',
+ 'varphi;': '\u03d5',
+ 'varpi;': '\u03d6',
+ 'varpropto;': '\u221d',
+ 'vArr;': '\u21d5',
+ 'varr;': '\u2195',
+ 'varrho;': '\u03f1',
+ 'varsigma;': '\u03c2',
+ 'varsubsetneq;': '\u228a\ufe00',
+ 'varsubsetneqq;': '\u2acb\ufe00',
+ 'varsupsetneq;': '\u228b\ufe00',
+ 'varsupsetneqq;': '\u2acc\ufe00',
+ 'vartheta;': '\u03d1',
+ 'vartriangleleft;': '\u22b2',
+ 'vartriangleright;': '\u22b3',
+ 'Vbar;': '\u2aeb',
+ 'vBar;': '\u2ae8',
+ 'vBarv;': '\u2ae9',
+ 'Vcy;': '\u0412',
+ 'vcy;': '\u0432',
+ 'VDash;': '\u22ab',
+ 'Vdash;': '\u22a9',
+ 'vDash;': '\u22a8',
+ 'vdash;': '\u22a2',
+ 'Vdashl;': '\u2ae6',
+ 'Vee;': '\u22c1',
+ 'vee;': '\u2228',
+ 'veebar;': '\u22bb',
+ 'veeeq;': '\u225a',
+ 'vellip;': '\u22ee',
+ 'Verbar;': '\u2016',
+ 'verbar;': '|',
+ 'Vert;': '\u2016',
+ 'vert;': '|',
+ 'VerticalBar;': '\u2223',
+ 'VerticalLine;': '|',
+ 'VerticalSeparator;': '\u2758',
+ 'VerticalTilde;': '\u2240',
+ 'VeryThinSpace;': '\u200a',
+ 'Vfr;': '\U0001d519',
+ 'vfr;': '\U0001d533',
+ 'vltri;': '\u22b2',
+ 'vnsub;': '\u2282\u20d2',
+ 'vnsup;': '\u2283\u20d2',
+ 'Vopf;': '\U0001d54d',
+ 'vopf;': '\U0001d567',
+ 'vprop;': '\u221d',
+ 'vrtri;': '\u22b3',
+ 'Vscr;': '\U0001d4b1',
+ 'vscr;': '\U0001d4cb',
+ 'vsubnE;': '\u2acb\ufe00',
+ 'vsubne;': '\u228a\ufe00',
+ 'vsupnE;': '\u2acc\ufe00',
+ 'vsupne;': '\u228b\ufe00',
+ 'Vvdash;': '\u22aa',
+ 'vzigzag;': '\u299a',
+ 'Wcirc;': '\u0174',
+ 'wcirc;': '\u0175',
+ 'wedbar;': '\u2a5f',
+ 'Wedge;': '\u22c0',
+ 'wedge;': '\u2227',
+ 'wedgeq;': '\u2259',
+ 'weierp;': '\u2118',
+ 'Wfr;': '\U0001d51a',
+ 'wfr;': '\U0001d534',
+ 'Wopf;': '\U0001d54e',
+ 'wopf;': '\U0001d568',
+ 'wp;': '\u2118',
+ 'wr;': '\u2240',
+ 'wreath;': '\u2240',
+ 'Wscr;': '\U0001d4b2',
+ 'wscr;': '\U0001d4cc',
+ 'xcap;': '\u22c2',
+ 'xcirc;': '\u25ef',
+ 'xcup;': '\u22c3',
+ 'xdtri;': '\u25bd',
+ 'Xfr;': '\U0001d51b',
+ 'xfr;': '\U0001d535',
+ 'xhArr;': '\u27fa',
+ 'xharr;': '\u27f7',
+ 'Xi;': '\u039e',
+ 'xi;': '\u03be',
+ 'xlArr;': '\u27f8',
+ 'xlarr;': '\u27f5',
+ 'xmap;': '\u27fc',
+ 'xnis;': '\u22fb',
+ 'xodot;': '\u2a00',
+ 'Xopf;': '\U0001d54f',
+ 'xopf;': '\U0001d569',
+ 'xoplus;': '\u2a01',
+ 'xotime;': '\u2a02',
+ 'xrArr;': '\u27f9',
+ 'xrarr;': '\u27f6',
+ 'Xscr;': '\U0001d4b3',
+ 'xscr;': '\U0001d4cd',
+ 'xsqcup;': '\u2a06',
+ 'xuplus;': '\u2a04',
+ 'xutri;': '\u25b3',
+ 'xvee;': '\u22c1',
+ 'xwedge;': '\u22c0',
+ 'Yacute': '\xdd',
+ 'yacute': '\xfd',
+ 'Yacute;': '\xdd',
+ 'yacute;': '\xfd',
+ 'YAcy;': '\u042f',
+ 'yacy;': '\u044f',
+ 'Ycirc;': '\u0176',
+ 'ycirc;': '\u0177',
+ 'Ycy;': '\u042b',
+ 'ycy;': '\u044b',
+ 'yen': '\xa5',
+ 'yen;': '\xa5',
+ 'Yfr;': '\U0001d51c',
+ 'yfr;': '\U0001d536',
+ 'YIcy;': '\u0407',
+ 'yicy;': '\u0457',
+ 'Yopf;': '\U0001d550',
+ 'yopf;': '\U0001d56a',
+ 'Yscr;': '\U0001d4b4',
+ 'yscr;': '\U0001d4ce',
+ 'YUcy;': '\u042e',
+ 'yucy;': '\u044e',
+ 'yuml': '\xff',
+ 'Yuml;': '\u0178',
+ 'yuml;': '\xff',
+ 'Zacute;': '\u0179',
+ 'zacute;': '\u017a',
+ 'Zcaron;': '\u017d',
+ 'zcaron;': '\u017e',
+ 'Zcy;': '\u0417',
+ 'zcy;': '\u0437',
+ 'Zdot;': '\u017b',
+ 'zdot;': '\u017c',
+ 'zeetrf;': '\u2128',
+ 'ZeroWidthSpace;': '\u200b',
+ 'Zeta;': '\u0396',
+ 'zeta;': '\u03b6',
+ 'Zfr;': '\u2128',
+ 'zfr;': '\U0001d537',
+ 'ZHcy;': '\u0416',
+ 'zhcy;': '\u0436',
+ 'zigrarr;': '\u21dd',
+ 'Zopf;': '\u2124',
+ 'zopf;': '\U0001d56b',
+ 'Zscr;': '\U0001d4b5',
+ 'zscr;': '\U0001d4cf',
+ 'zwj;': '\u200d',
+ 'zwnj;': '\u200c',
+}
+
+# maps the Unicode codepoint to the HTML entity name
+codepoint2name = {}
+
+# maps the HTML entity name to the character
+# (or a character reference if the character is outside the Latin-1 range)
+entitydefs = {}
+
+for (name, codepoint) in name2codepoint.items():
+ codepoint2name[codepoint] = name
+ entitydefs[name] = chr(codepoint)
+
+del name, codepoint
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/html/parser.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/html/parser.py
new file mode 100644
index 0000000..7b8cdba
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/html/parser.py
@@ -0,0 +1,537 @@
+"""A parser for HTML and XHTML.
+
+Backported for python-future from Python 3.3.
+"""
+
+# This file is based on sgmllib.py, but the API is slightly different.
+
+# XXX There should be a way to distinguish between PCDATA (parsed
+# character data -- the normal case), RCDATA (replaceable character
+# data -- only char and entity references and end tags are special)
+# and CDATA (character data -- only end tags are special).
+
+from __future__ import (absolute_import, division,
+ print_function, unicode_literals)
+from future.builtins import *
+from future.backports import _markupbase
+import re
+import warnings
+
+# Regular expressions used for parsing
+
+interesting_normal = re.compile('[&<]')
+incomplete = re.compile('&[a-zA-Z#]')
+
+entityref = re.compile('&([a-zA-Z][-.a-zA-Z0-9]*)[^a-zA-Z0-9]')
+charref = re.compile('(?:[0-9]+|[xX][0-9a-fA-F]+)[^0-9a-fA-F]')
+
+starttagopen = re.compile('<[a-zA-Z]')
+piclose = re.compile('>')
+commentclose = re.compile(r'--\s*>')
+tagfind = re.compile('([a-zA-Z][-.a-zA-Z0-9:_]*)(?:\s|/(?!>))*')
+# see http://www.w3.org/TR/html5/tokenization.html#tag-open-state
+# and http://www.w3.org/TR/html5/tokenization.html#tag-name-state
+tagfind_tolerant = re.compile('[a-zA-Z][^\t\n\r\f />\x00]*')
+# Note:
+# 1) the strict attrfind isn't really strict, but we can't make it
+# correctly strict without breaking backward compatibility;
+# 2) if you change attrfind remember to update locatestarttagend too;
+# 3) if you change attrfind and/or locatestarttagend the parser will
+# explode, so don't do it.
+attrfind = re.compile(
+ r'\s*([a-zA-Z_][-.:a-zA-Z_0-9]*)(\s*=\s*'
+ r'(\'[^\']*\'|"[^"]*"|[^\s"\'=<>`]*))?')
+attrfind_tolerant = re.compile(
+ r'((?<=[\'"\s/])[^\s/>][^\s/=>]*)(\s*=+\s*'
+ r'(\'[^\']*\'|"[^"]*"|(?![\'"])[^>\s]*))?(?:\s|/(?!>))*')
+locatestarttagend = re.compile(r"""
+ <[a-zA-Z][-.a-zA-Z0-9:_]* # tag name
+ (?:\s+ # whitespace before attribute name
+ (?:[a-zA-Z_][-.:a-zA-Z0-9_]* # attribute name
+ (?:\s*=\s* # value indicator
+ (?:'[^']*' # LITA-enclosed value
+ |\"[^\"]*\" # LIT-enclosed value
+ |[^'\">\s]+ # bare value
+ )
+ )?
+ )
+ )*
+ \s* # trailing whitespace
+""", re.VERBOSE)
+locatestarttagend_tolerant = re.compile(r"""
+ <[a-zA-Z][-.a-zA-Z0-9:_]* # tag name
+ (?:[\s/]* # optional whitespace before attribute name
+ (?:(?<=['"\s/])[^\s/>][^\s/=>]* # attribute name
+ (?:\s*=+\s* # value indicator
+ (?:'[^']*' # LITA-enclosed value
+ |"[^"]*" # LIT-enclosed value
+ |(?!['"])[^>\s]* # bare value
+ )
+ (?:\s*,)* # possibly followed by a comma
+ )?(?:\s|/(?!>))*
+ )*
+ )?
+ \s* # trailing whitespace
+""", re.VERBOSE)
+endendtag = re.compile('>')
+# the HTML 5 spec, section 8.1.2.2, doesn't allow spaces between
+# and the tag name, so maybe this should be fixed
+endtagfind = re.compile('\s*([a-zA-Z][-.a-zA-Z0-9:_]*)\s*>')
+
+
+class HTMLParseError(Exception):
+ """Exception raised for all parse errors."""
+
+ def __init__(self, msg, position=(None, None)):
+ assert msg
+ self.msg = msg
+ self.lineno = position[0]
+ self.offset = position[1]
+
+ def __str__(self):
+ result = self.msg
+ if self.lineno is not None:
+ result = result + ", at line %d" % self.lineno
+ if self.offset is not None:
+ result = result + ", column %d" % (self.offset + 1)
+ return result
+
+
+class HTMLParser(_markupbase.ParserBase):
+ """Find tags and other markup and call handler functions.
+
+ Usage:
+ p = HTMLParser()
+ p.feed(data)
+ ...
+ p.close()
+
+ Start tags are handled by calling self.handle_starttag() or
+ self.handle_startendtag(); end tags by self.handle_endtag(). The
+ data between tags is passed from the parser to the derived class
+ by calling self.handle_data() with the data as argument (the data
+ may be split up in arbitrary chunks). Entity references are
+ passed by calling self.handle_entityref() with the entity
+ reference as the argument. Numeric character references are
+ passed to self.handle_charref() with the string containing the
+ reference as the argument.
+ """
+
+ CDATA_CONTENT_ELEMENTS = ("script", "style")
+
+ def __init__(self, strict=False):
+ """Initialize and reset this instance.
+
+ If strict is set to False (the default) the parser will parse invalid
+ markup, otherwise it will raise an error. Note that the strict mode
+ is deprecated.
+ """
+ if strict:
+ warnings.warn("The strict mode is deprecated.",
+ DeprecationWarning, stacklevel=2)
+ self.strict = strict
+ self.reset()
+
+ def reset(self):
+ """Reset this instance. Loses all unprocessed data."""
+ self.rawdata = ''
+ self.lasttag = '???'
+ self.interesting = interesting_normal
+ self.cdata_elem = None
+ _markupbase.ParserBase.reset(self)
+
+ def feed(self, data):
+ r"""Feed data to the parser.
+
+ Call this as often as you want, with as little or as much text
+ as you want (may include '\n').
+ """
+ self.rawdata = self.rawdata + data
+ self.goahead(0)
+
+ def close(self):
+ """Handle any buffered data."""
+ self.goahead(1)
+
+ def error(self, message):
+ raise HTMLParseError(message, self.getpos())
+
+ __starttag_text = None
+
+ def get_starttag_text(self):
+ """Return full source of start tag: '<...>'."""
+ return self.__starttag_text
+
+ def set_cdata_mode(self, elem):
+ self.cdata_elem = elem.lower()
+ self.interesting = re.compile(r'\s*%s\s*>' % self.cdata_elem, re.I)
+
+ def clear_cdata_mode(self):
+ self.interesting = interesting_normal
+ self.cdata_elem = None
+
+ # Internal -- handle data as far as reasonable. May leave state
+ # and data to be processed by a subsequent call. If 'end' is
+ # true, force handling all data as if followed by EOF marker.
+ def goahead(self, end):
+ rawdata = self.rawdata
+ i = 0
+ n = len(rawdata)
+ while i < n:
+ match = self.interesting.search(rawdata, i) # < or &
+ if match:
+ j = match.start()
+ else:
+ if self.cdata_elem:
+ break
+ j = n
+ if i < j: self.handle_data(rawdata[i:j])
+ i = self.updatepos(i, j)
+ if i == n: break
+ startswith = rawdata.startswith
+ if startswith('<', i):
+ if starttagopen.match(rawdata, i): # < + letter
+ k = self.parse_starttag(i)
+ elif startswith("", i):
+ k = self.parse_endtag(i)
+ elif startswith(" \n
+ # \" --> "
+ #
+ i = 0
+ n = len(mystr)
+ res = []
+ while 0 <= i < n:
+ o_match = _OctalPatt.search(mystr, i)
+ q_match = _QuotePatt.search(mystr, i)
+ if not o_match and not q_match: # Neither matched
+ res.append(mystr[i:])
+ break
+ # else:
+ j = k = -1
+ if o_match:
+ j = o_match.start(0)
+ if q_match:
+ k = q_match.start(0)
+ if q_match and (not o_match or k < j): # QuotePatt matched
+ res.append(mystr[i:k])
+ res.append(mystr[k+1])
+ i = k + 2
+ else: # OctalPatt matched
+ res.append(mystr[i:j])
+ res.append(chr(int(mystr[j+1:j+4], 8)))
+ i = j + 4
+ return _nulljoin(res)
+
+# The _getdate() routine is used to set the expiration time in the cookie's HTTP
+# header. By default, _getdate() returns the current time in the appropriate
+# "expires" format for a Set-Cookie header. The one optional argument is an
+# offset from now, in seconds. For example, an offset of -3600 means "one hour
+# ago". The offset may be a floating point number.
+#
+
+_weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+
+_monthname = [None,
+ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
+
+def _getdate(future=0, weekdayname=_weekdayname, monthname=_monthname):
+ from time import gmtime, time
+ now = time()
+ year, month, day, hh, mm, ss, wd, y, z = gmtime(now + future)
+ return "%s, %02d %3s %4d %02d:%02d:%02d GMT" % \
+ (weekdayname[wd], day, monthname[month], year, hh, mm, ss)
+
+
+class Morsel(dict):
+ """A class to hold ONE (key, value) pair.
+
+ In a cookie, each such pair may have several attributes, so this class is
+ used to keep the attributes associated with the appropriate key,value pair.
+ This class also includes a coded_value attribute, which is used to hold
+ the network representation of the value. This is most useful when Python
+ objects are pickled for network transit.
+ """
+ # RFC 2109 lists these attributes as reserved:
+ # path comment domain
+ # max-age secure version
+ #
+ # For historical reasons, these attributes are also reserved:
+ # expires
+ #
+ # This is an extension from Microsoft:
+ # httponly
+ #
+ # This dictionary provides a mapping from the lowercase
+ # variant on the left to the appropriate traditional
+ # formatting on the right.
+ _reserved = {
+ "expires" : "expires",
+ "path" : "Path",
+ "comment" : "Comment",
+ "domain" : "Domain",
+ "max-age" : "Max-Age",
+ "secure" : "secure",
+ "httponly" : "httponly",
+ "version" : "Version",
+ }
+
+ _flags = set(['secure', 'httponly'])
+
+ def __init__(self):
+ # Set defaults
+ self.key = self.value = self.coded_value = None
+
+ # Set default attributes
+ for key in self._reserved:
+ dict.__setitem__(self, key, "")
+
+ def __setitem__(self, K, V):
+ K = K.lower()
+ if not K in self._reserved:
+ raise CookieError("Invalid Attribute %s" % K)
+ dict.__setitem__(self, K, V)
+
+ def isReservedKey(self, K):
+ return K.lower() in self._reserved
+
+ def set(self, key, val, coded_val, LegalChars=_LegalChars):
+ # First we verify that the key isn't a reserved word
+ # Second we make sure it only contains legal characters
+ if key.lower() in self._reserved:
+ raise CookieError("Attempt to set a reserved key: %s" % key)
+ if any(c not in LegalChars for c in key):
+ raise CookieError("Illegal key value: %s" % key)
+
+ # It's a good key, so save it.
+ self.key = key
+ self.value = val
+ self.coded_value = coded_val
+
+ def output(self, attrs=None, header="Set-Cookie:"):
+ return "%s %s" % (header, self.OutputString(attrs))
+
+ __str__ = output
+
+ @as_native_str()
+ def __repr__(self):
+ if PY2 and isinstance(self.value, unicode):
+ val = str(self.value) # make it a newstr to remove the u prefix
+ else:
+ val = self.value
+ return '<%s: %s=%s>' % (self.__class__.__name__,
+ str(self.key), repr(val))
+
+ def js_output(self, attrs=None):
+ # Print javascript
+ return """
+
+ """ % (self.OutputString(attrs).replace('"', r'\"'))
+
+ def OutputString(self, attrs=None):
+ # Build up our result
+ #
+ result = []
+ append = result.append
+
+ # First, the key=value pair
+ append("%s=%s" % (self.key, self.coded_value))
+
+ # Now add any defined attributes
+ if attrs is None:
+ attrs = self._reserved
+ items = sorted(self.items())
+ for key, value in items:
+ if value == "":
+ continue
+ if key not in attrs:
+ continue
+ if key == "expires" and isinstance(value, int):
+ append("%s=%s" % (self._reserved[key], _getdate(value)))
+ elif key == "max-age" and isinstance(value, int):
+ append("%s=%d" % (self._reserved[key], value))
+ elif key == "secure":
+ append(str(self._reserved[key]))
+ elif key == "httponly":
+ append(str(self._reserved[key]))
+ else:
+ append("%s=%s" % (self._reserved[key], value))
+
+ # Return the result
+ return _semispacejoin(result)
+
+
+#
+# Pattern for finding cookie
+#
+# This used to be strict parsing based on the RFC2109 and RFC2068
+# specifications. I have since discovered that MSIE 3.0x doesn't
+# follow the character rules outlined in those specs. As a
+# result, the parsing rules here are less strict.
+#
+
+_LegalCharsPatt = r"[\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=]"
+_CookiePattern = re.compile(r"""
+ (?x) # This is a verbose pattern
+ (?P # Start of group 'key'
+ """ + _LegalCharsPatt + r"""+? # Any word of at least one letter
+ ) # End of group 'key'
+ ( # Optional group: there may not be a value.
+ \s*=\s* # Equal Sign
+ (?P # Start of group 'val'
+ "(?:[^\\"]|\\.)*" # Any doublequoted string
+ | # or
+ \w{3},\s[\w\d\s-]{9,11}\s[\d:]{8}\sGMT # Special case for "expires" attr
+ | # or
+ """ + _LegalCharsPatt + r"""* # Any word or empty string
+ ) # End of group 'val'
+ )? # End of optional value group
+ \s* # Any number of spaces.
+ (\s+|;|$) # Ending either at space, semicolon, or EOS.
+ """, re.ASCII) # May be removed if safe.
+
+
+# At long last, here is the cookie class. Using this class is almost just like
+# using a dictionary. See this module's docstring for example usage.
+#
+class BaseCookie(dict):
+ """A container class for a set of Morsels."""
+
+ def value_decode(self, val):
+ """real_value, coded_value = value_decode(STRING)
+ Called prior to setting a cookie's value from the network
+ representation. The VALUE is the value read from HTTP
+ header.
+ Override this function to modify the behavior of cookies.
+ """
+ return val, val
+
+ def value_encode(self, val):
+ """real_value, coded_value = value_encode(VALUE)
+ Called prior to setting a cookie's value from the dictionary
+ representation. The VALUE is the value being assigned.
+ Override this function to modify the behavior of cookies.
+ """
+ strval = str(val)
+ return strval, strval
+
+ def __init__(self, input=None):
+ if input:
+ self.load(input)
+
+ def __set(self, key, real_value, coded_value):
+ """Private method for setting a cookie's value"""
+ M = self.get(key, Morsel())
+ M.set(key, real_value, coded_value)
+ dict.__setitem__(self, key, M)
+
+ def __setitem__(self, key, value):
+ """Dictionary style assignment."""
+ rval, cval = self.value_encode(value)
+ self.__set(key, rval, cval)
+
+ def output(self, attrs=None, header="Set-Cookie:", sep="\015\012"):
+ """Return a string suitable for HTTP."""
+ result = []
+ items = sorted(self.items())
+ for key, value in items:
+ result.append(value.output(attrs, header))
+ return sep.join(result)
+
+ __str__ = output
+
+ @as_native_str()
+ def __repr__(self):
+ l = []
+ items = sorted(self.items())
+ for key, value in items:
+ if PY2 and isinstance(value.value, unicode):
+ val = str(value.value) # make it a newstr to remove the u prefix
+ else:
+ val = value.value
+ l.append('%s=%s' % (str(key), repr(val)))
+ return '<%s: %s>' % (self.__class__.__name__, _spacejoin(l))
+
+ def js_output(self, attrs=None):
+ """Return a string suitable for JavaScript."""
+ result = []
+ items = sorted(self.items())
+ for key, value in items:
+ result.append(value.js_output(attrs))
+ return _nulljoin(result)
+
+ def load(self, rawdata):
+ """Load cookies from a string (presumably HTTP_COOKIE) or
+ from a dictionary. Loading cookies from a dictionary 'd'
+ is equivalent to calling:
+ map(Cookie.__setitem__, d.keys(), d.values())
+ """
+ if isinstance(rawdata, str):
+ self.__parse_string(rawdata)
+ else:
+ # self.update() wouldn't call our custom __setitem__
+ for key, value in rawdata.items():
+ self[key] = value
+ return
+
+ def __parse_string(self, mystr, patt=_CookiePattern):
+ i = 0 # Our starting point
+ n = len(mystr) # Length of string
+ M = None # current morsel
+
+ while 0 <= i < n:
+ # Start looking for a cookie
+ match = patt.search(mystr, i)
+ if not match:
+ # No more cookies
+ break
+
+ key, value = match.group("key"), match.group("val")
+
+ i = match.end(0)
+
+ # Parse the key, value in case it's metainfo
+ if key[0] == "$":
+ # We ignore attributes which pertain to the cookie
+ # mechanism as a whole. See RFC 2109.
+ # (Does anyone care?)
+ if M:
+ M[key[1:]] = value
+ elif key.lower() in Morsel._reserved:
+ if M:
+ if value is None:
+ if key.lower() in Morsel._flags:
+ M[key] = True
+ else:
+ M[key] = _unquote(value)
+ elif value is not None:
+ rval, cval = self.value_decode(value)
+ self.__set(key, rval, cval)
+ M = self[key]
+
+
+class SimpleCookie(BaseCookie):
+ """
+ SimpleCookie supports strings as cookie values. When setting
+ the value using the dictionary assignment notation, SimpleCookie
+ calls the builtin str() to convert the value to a string. Values
+ received from HTTP are kept as strings.
+ """
+ def value_decode(self, val):
+ return _unquote(val), val
+
+ def value_encode(self, val):
+ strval = str(val)
+ return strval, _quote(strval)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/http/server.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/http/server.py
new file mode 100644
index 0000000..b1c11e0
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/http/server.py
@@ -0,0 +1,1226 @@
+"""HTTP server classes.
+
+From Python 3.3
+
+Note: BaseHTTPRequestHandler doesn't implement any HTTP request; see
+SimpleHTTPRequestHandler for simple implementations of GET, HEAD and POST,
+and CGIHTTPRequestHandler for CGI scripts.
+
+It does, however, optionally implement HTTP/1.1 persistent connections,
+as of version 0.3.
+
+Notes on CGIHTTPRequestHandler
+------------------------------
+
+This class implements GET and POST requests to cgi-bin scripts.
+
+If the os.fork() function is not present (e.g. on Windows),
+subprocess.Popen() is used as a fallback, with slightly altered semantics.
+
+In all cases, the implementation is intentionally naive -- all
+requests are executed synchronously.
+
+SECURITY WARNING: DON'T USE THIS CODE UNLESS YOU ARE INSIDE A FIREWALL
+-- it may execute arbitrary Python code or external programs.
+
+Note that status code 200 is sent prior to execution of a CGI script, so
+scripts cannot send other status codes such as 302 (redirect).
+
+XXX To do:
+
+- log requests even later (to capture byte count)
+- log user-agent header and other interesting goodies
+- send error log to separate file
+"""
+
+from __future__ import (absolute_import, division,
+ print_function, unicode_literals)
+from future import utils
+from future.builtins import *
+
+
+# See also:
+#
+# HTTP Working Group T. Berners-Lee
+# INTERNET-DRAFT R. T. Fielding
+# H. Frystyk Nielsen
+# Expires September 8, 1995 March 8, 1995
+#
+# URL: http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-v10-spec-00.txt
+#
+# and
+#
+# Network Working Group R. Fielding
+# Request for Comments: 2616 et al
+# Obsoletes: 2068 June 1999
+# Category: Standards Track
+#
+# URL: http://www.faqs.org/rfcs/rfc2616.html
+
+# Log files
+# ---------
+#
+# Here's a quote from the NCSA httpd docs about log file format.
+#
+# | The logfile format is as follows. Each line consists of:
+# |
+# | host rfc931 authuser [DD/Mon/YYYY:hh:mm:ss] "request" ddd bbbb
+# |
+# | host: Either the DNS name or the IP number of the remote client
+# | rfc931: Any information returned by identd for this person,
+# | - otherwise.
+# | authuser: If user sent a userid for authentication, the user name,
+# | - otherwise.
+# | DD: Day
+# | Mon: Month (calendar name)
+# | YYYY: Year
+# | hh: hour (24-hour format, the machine's timezone)
+# | mm: minutes
+# | ss: seconds
+# | request: The first line of the HTTP request as sent by the client.
+# | ddd: the status code returned by the server, - if not available.
+# | bbbb: the total number of bytes sent,
+# | *not including the HTTP/1.0 header*, - if not available
+# |
+# | You can determine the name of the file accessed through request.
+#
+# (Actually, the latter is only true if you know the server configuration
+# at the time the request was made!)
+
+__version__ = "0.6"
+
+__all__ = ["HTTPServer", "BaseHTTPRequestHandler"]
+
+from future.backports import html
+from future.backports.http import client as http_client
+from future.backports.urllib import parse as urllib_parse
+from future.backports import socketserver
+
+import io
+import mimetypes
+import os
+import posixpath
+import select
+import shutil
+import socket # For gethostbyaddr()
+import sys
+import time
+import copy
+import argparse
+
+
+# Default error message template
+DEFAULT_ERROR_MESSAGE = """\
+
+
+
+
+ Error response
+
+
+
Error response
+
Error code: %(code)d
+
Message: %(message)s.
+
Error code explanation: %(code)s - %(explain)s.
+
+
+"""
+
+DEFAULT_ERROR_CONTENT_TYPE = "text/html;charset=utf-8"
+
+def _quote_html(html):
+ return html.replace("&", "&").replace("<", "<").replace(">", ">")
+
+class HTTPServer(socketserver.TCPServer):
+
+ allow_reuse_address = 1 # Seems to make sense in testing environment
+
+ def server_bind(self):
+ """Override server_bind to store the server name."""
+ socketserver.TCPServer.server_bind(self)
+ host, port = self.socket.getsockname()[:2]
+ self.server_name = socket.getfqdn(host)
+ self.server_port = port
+
+
+class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
+
+ """HTTP request handler base class.
+
+ The following explanation of HTTP serves to guide you through the
+ code as well as to expose any misunderstandings I may have about
+ HTTP (so you don't need to read the code to figure out I'm wrong
+ :-).
+
+ HTTP (HyperText Transfer Protocol) is an extensible protocol on
+ top of a reliable stream transport (e.g. TCP/IP). The protocol
+ recognizes three parts to a request:
+
+ 1. One line identifying the request type and path
+ 2. An optional set of RFC-822-style headers
+ 3. An optional data part
+
+ The headers and data are separated by a blank line.
+
+ The first line of the request has the form
+
+
+
+ where is a (case-sensitive) keyword such as GET or POST,
+ is a string containing path information for the request,
+ and should be the string "HTTP/1.0" or "HTTP/1.1".
+ is encoded using the URL encoding scheme (using %xx to signify
+ the ASCII character with hex code xx).
+
+ The specification specifies that lines are separated by CRLF but
+ for compatibility with the widest range of clients recommends
+ servers also handle LF. Similarly, whitespace in the request line
+ is treated sensibly (allowing multiple spaces between components
+ and allowing trailing whitespace).
+
+ Similarly, for output, lines ought to be separated by CRLF pairs
+ but most clients grok LF characters just fine.
+
+ If the first line of the request has the form
+
+
+
+ (i.e. is left out) then this is assumed to be an HTTP
+ 0.9 request; this form has no optional headers and data part and
+ the reply consists of just the data.
+
+ The reply form of the HTTP 1.x protocol again has three parts:
+
+ 1. One line giving the response code
+ 2. An optional set of RFC-822-style headers
+ 3. The data
+
+ Again, the headers and data are separated by a blank line.
+
+ The response code line has the form
+
+
+
+ where is the protocol version ("HTTP/1.0" or "HTTP/1.1"),
+ is a 3-digit response code indicating success or
+ failure of the request, and is an optional
+ human-readable string explaining what the response code means.
+
+ This server parses the request and the headers, and then calls a
+ function specific to the request type (). Specifically,
+ a request SPAM will be handled by a method do_SPAM(). If no
+ such method exists the server sends an error response to the
+ client. If it exists, it is called with no arguments:
+
+ do_SPAM()
+
+ Note that the request name is case sensitive (i.e. SPAM and spam
+ are different requests).
+
+ The various request details are stored in instance variables:
+
+ - client_address is the client IP address in the form (host,
+ port);
+
+ - command, path and version are the broken-down request line;
+
+ - headers is an instance of email.message.Message (or a derived
+ class) containing the header information;
+
+ - rfile is a file object open for reading positioned at the
+ start of the optional input data part;
+
+ - wfile is a file object open for writing.
+
+ IT IS IMPORTANT TO ADHERE TO THE PROTOCOL FOR WRITING!
+
+ The first thing to be written must be the response line. Then
+ follow 0 or more header lines, then a blank line, and then the
+ actual data (if any). The meaning of the header lines depends on
+ the command executed by the server; in most cases, when data is
+ returned, there should be at least one header line of the form
+
+ Content-type: /
+
+ where and should be registered MIME types,
+ e.g. "text/html" or "text/plain".
+
+ """
+
+ # The Python system version, truncated to its first component.
+ sys_version = "Python/" + sys.version.split()[0]
+
+ # The server software version. You may want to override this.
+ # The format is multiple whitespace-separated strings,
+ # where each string is of the form name[/version].
+ server_version = "BaseHTTP/" + __version__
+
+ error_message_format = DEFAULT_ERROR_MESSAGE
+ error_content_type = DEFAULT_ERROR_CONTENT_TYPE
+
+ # The default request version. This only affects responses up until
+ # the point where the request line is parsed, so it mainly decides what
+ # the client gets back when sending a malformed request line.
+ # Most web servers default to HTTP 0.9, i.e. don't send a status line.
+ default_request_version = "HTTP/0.9"
+
+ def parse_request(self):
+ """Parse a request (internal).
+
+ The request should be stored in self.raw_requestline; the results
+ are in self.command, self.path, self.request_version and
+ self.headers.
+
+ Return True for success, False for failure; on failure, an
+ error is sent back.
+
+ """
+ self.command = None # set in case of error on the first line
+ self.request_version = version = self.default_request_version
+ self.close_connection = 1
+ requestline = str(self.raw_requestline, 'iso-8859-1')
+ requestline = requestline.rstrip('\r\n')
+ self.requestline = requestline
+ words = requestline.split()
+ if len(words) == 3:
+ command, path, version = words
+ if version[:5] != 'HTTP/':
+ self.send_error(400, "Bad request version (%r)" % version)
+ return False
+ try:
+ base_version_number = version.split('/', 1)[1]
+ version_number = base_version_number.split(".")
+ # RFC 2145 section 3.1 says there can be only one "." and
+ # - major and minor numbers MUST be treated as
+ # separate integers;
+ # - HTTP/2.4 is a lower version than HTTP/2.13, which in
+ # turn is lower than HTTP/12.3;
+ # - Leading zeros MUST be ignored by recipients.
+ if len(version_number) != 2:
+ raise ValueError
+ version_number = int(version_number[0]), int(version_number[1])
+ except (ValueError, IndexError):
+ self.send_error(400, "Bad request version (%r)" % version)
+ return False
+ if version_number >= (1, 1) and self.protocol_version >= "HTTP/1.1":
+ self.close_connection = 0
+ if version_number >= (2, 0):
+ self.send_error(505,
+ "Invalid HTTP Version (%s)" % base_version_number)
+ return False
+ elif len(words) == 2:
+ command, path = words
+ self.close_connection = 1
+ if command != 'GET':
+ self.send_error(400,
+ "Bad HTTP/0.9 request type (%r)" % command)
+ return False
+ elif not words:
+ return False
+ else:
+ self.send_error(400, "Bad request syntax (%r)" % requestline)
+ return False
+ self.command, self.path, self.request_version = command, path, version
+
+ # Examine the headers and look for a Connection directive.
+ try:
+ self.headers = http_client.parse_headers(self.rfile,
+ _class=self.MessageClass)
+ except http_client.LineTooLong:
+ self.send_error(400, "Line too long")
+ return False
+
+ conntype = self.headers.get('Connection', "")
+ if conntype.lower() == 'close':
+ self.close_connection = 1
+ elif (conntype.lower() == 'keep-alive' and
+ self.protocol_version >= "HTTP/1.1"):
+ self.close_connection = 0
+ # Examine the headers and look for an Expect directive
+ expect = self.headers.get('Expect', "")
+ if (expect.lower() == "100-continue" and
+ self.protocol_version >= "HTTP/1.1" and
+ self.request_version >= "HTTP/1.1"):
+ if not self.handle_expect_100():
+ return False
+ return True
+
+ def handle_expect_100(self):
+ """Decide what to do with an "Expect: 100-continue" header.
+
+ If the client is expecting a 100 Continue response, we must
+ respond with either a 100 Continue or a final response before
+ waiting for the request body. The default is to always respond
+ with a 100 Continue. You can behave differently (for example,
+ reject unauthorized requests) by overriding this method.
+
+ This method should either return True (possibly after sending
+ a 100 Continue response) or send an error response and return
+ False.
+
+ """
+ self.send_response_only(100)
+ self.flush_headers()
+ return True
+
+ def handle_one_request(self):
+ """Handle a single HTTP request.
+
+ You normally don't need to override this method; see the class
+ __doc__ string for information on how to handle specific HTTP
+ commands such as GET and POST.
+
+ """
+ try:
+ self.raw_requestline = self.rfile.readline(65537)
+ if len(self.raw_requestline) > 65536:
+ self.requestline = ''
+ self.request_version = ''
+ self.command = ''
+ self.send_error(414)
+ return
+ if not self.raw_requestline:
+ self.close_connection = 1
+ return
+ if not self.parse_request():
+ # An error code has been sent, just exit
+ return
+ mname = 'do_' + self.command
+ if not hasattr(self, mname):
+ self.send_error(501, "Unsupported method (%r)" % self.command)
+ return
+ method = getattr(self, mname)
+ method()
+ self.wfile.flush() #actually send the response if not already done.
+ except socket.timeout as e:
+ #a read or a write timed out. Discard this connection
+ self.log_error("Request timed out: %r", e)
+ self.close_connection = 1
+ return
+
+ def handle(self):
+ """Handle multiple requests if necessary."""
+ self.close_connection = 1
+
+ self.handle_one_request()
+ while not self.close_connection:
+ self.handle_one_request()
+
+ def send_error(self, code, message=None):
+ """Send and log an error reply.
+
+ Arguments are the error code, and a detailed message.
+ The detailed message defaults to the short entry matching the
+ response code.
+
+ This sends an error response (so it must be called before any
+ output has been generated), logs the error, and finally sends
+ a piece of HTML explaining the error to the user.
+
+ """
+
+ try:
+ shortmsg, longmsg = self.responses[code]
+ except KeyError:
+ shortmsg, longmsg = '???', '???'
+ if message is None:
+ message = shortmsg
+ explain = longmsg
+ self.log_error("code %d, message %s", code, message)
+ # using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201)
+ content = (self.error_message_format %
+ {'code': code, 'message': _quote_html(message), 'explain': explain})
+ self.send_response(code, message)
+ self.send_header("Content-Type", self.error_content_type)
+ self.send_header('Connection', 'close')
+ self.end_headers()
+ if self.command != 'HEAD' and code >= 200 and code not in (204, 304):
+ self.wfile.write(content.encode('UTF-8', 'replace'))
+
+ def send_response(self, code, message=None):
+ """Add the response header to the headers buffer and log the
+ response code.
+
+ Also send two standard headers with the server software
+ version and the current date.
+
+ """
+ self.log_request(code)
+ self.send_response_only(code, message)
+ self.send_header('Server', self.version_string())
+ self.send_header('Date', self.date_time_string())
+
+ def send_response_only(self, code, message=None):
+ """Send the response header only."""
+ if message is None:
+ if code in self.responses:
+ message = self.responses[code][0]
+ else:
+ message = ''
+ if self.request_version != 'HTTP/0.9':
+ if not hasattr(self, '_headers_buffer'):
+ self._headers_buffer = []
+ self._headers_buffer.append(("%s %d %s\r\n" %
+ (self.protocol_version, code, message)).encode(
+ 'latin-1', 'strict'))
+
+ def send_header(self, keyword, value):
+ """Send a MIME header to the headers buffer."""
+ if self.request_version != 'HTTP/0.9':
+ if not hasattr(self, '_headers_buffer'):
+ self._headers_buffer = []
+ self._headers_buffer.append(
+ ("%s: %s\r\n" % (keyword, value)).encode('latin-1', 'strict'))
+
+ if keyword.lower() == 'connection':
+ if value.lower() == 'close':
+ self.close_connection = 1
+ elif value.lower() == 'keep-alive':
+ self.close_connection = 0
+
+ def end_headers(self):
+ """Send the blank line ending the MIME headers."""
+ if self.request_version != 'HTTP/0.9':
+ self._headers_buffer.append(b"\r\n")
+ self.flush_headers()
+
+ def flush_headers(self):
+ if hasattr(self, '_headers_buffer'):
+ self.wfile.write(b"".join(self._headers_buffer))
+ self._headers_buffer = []
+
+ def log_request(self, code='-', size='-'):
+ """Log an accepted request.
+
+ This is called by send_response().
+
+ """
+
+ self.log_message('"%s" %s %s',
+ self.requestline, str(code), str(size))
+
+ def log_error(self, format, *args):
+ """Log an error.
+
+ This is called when a request cannot be fulfilled. By
+ default it passes the message on to log_message().
+
+ Arguments are the same as for log_message().
+
+ XXX This should go to the separate error log.
+
+ """
+
+ self.log_message(format, *args)
+
+ def log_message(self, format, *args):
+ """Log an arbitrary message.
+
+ This is used by all other logging functions. Override
+ it if you have specific logging wishes.
+
+ The first argument, FORMAT, is a format string for the
+ message to be logged. If the format string contains
+ any % escapes requiring parameters, they should be
+ specified as subsequent arguments (it's just like
+ printf!).
+
+ The client ip and current date/time are prefixed to
+ every message.
+
+ """
+
+ sys.stderr.write("%s - - [%s] %s\n" %
+ (self.address_string(),
+ self.log_date_time_string(),
+ format%args))
+
+ def version_string(self):
+ """Return the server software version string."""
+ return self.server_version + ' ' + self.sys_version
+
+ def date_time_string(self, timestamp=None):
+ """Return the current date and time formatted for a message header."""
+ if timestamp is None:
+ timestamp = time.time()
+ year, month, day, hh, mm, ss, wd, y, z = time.gmtime(timestamp)
+ s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % (
+ self.weekdayname[wd],
+ day, self.monthname[month], year,
+ hh, mm, ss)
+ return s
+
+ def log_date_time_string(self):
+ """Return the current time formatted for logging."""
+ now = time.time()
+ year, month, day, hh, mm, ss, x, y, z = time.localtime(now)
+ s = "%02d/%3s/%04d %02d:%02d:%02d" % (
+ day, self.monthname[month], year, hh, mm, ss)
+ return s
+
+ weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+
+ monthname = [None,
+ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
+
+ def address_string(self):
+ """Return the client address."""
+
+ return self.client_address[0]
+
+ # Essentially static class variables
+
+ # The version of the HTTP protocol we support.
+ # Set this to HTTP/1.1 to enable automatic keepalive
+ protocol_version = "HTTP/1.0"
+
+ # MessageClass used to parse headers
+ MessageClass = http_client.HTTPMessage
+
+ # Table mapping response codes to messages; entries have the
+ # form {code: (shortmessage, longmessage)}.
+ # See RFC 2616 and 6585.
+ responses = {
+ 100: ('Continue', 'Request received, please continue'),
+ 101: ('Switching Protocols',
+ 'Switching to new protocol; obey Upgrade header'),
+
+ 200: ('OK', 'Request fulfilled, document follows'),
+ 201: ('Created', 'Document created, URL follows'),
+ 202: ('Accepted',
+ 'Request accepted, processing continues off-line'),
+ 203: ('Non-Authoritative Information', 'Request fulfilled from cache'),
+ 204: ('No Content', 'Request fulfilled, nothing follows'),
+ 205: ('Reset Content', 'Clear input form for further input.'),
+ 206: ('Partial Content', 'Partial content follows.'),
+
+ 300: ('Multiple Choices',
+ 'Object has several resources -- see URI list'),
+ 301: ('Moved Permanently', 'Object moved permanently -- see URI list'),
+ 302: ('Found', 'Object moved temporarily -- see URI list'),
+ 303: ('See Other', 'Object moved -- see Method and URL list'),
+ 304: ('Not Modified',
+ 'Document has not changed since given time'),
+ 305: ('Use Proxy',
+ 'You must use proxy specified in Location to access this '
+ 'resource.'),
+ 307: ('Temporary Redirect',
+ 'Object moved temporarily -- see URI list'),
+
+ 400: ('Bad Request',
+ 'Bad request syntax or unsupported method'),
+ 401: ('Unauthorized',
+ 'No permission -- see authorization schemes'),
+ 402: ('Payment Required',
+ 'No payment -- see charging schemes'),
+ 403: ('Forbidden',
+ 'Request forbidden -- authorization will not help'),
+ 404: ('Not Found', 'Nothing matches the given URI'),
+ 405: ('Method Not Allowed',
+ 'Specified method is invalid for this resource.'),
+ 406: ('Not Acceptable', 'URI not available in preferred format.'),
+ 407: ('Proxy Authentication Required', 'You must authenticate with '
+ 'this proxy before proceeding.'),
+ 408: ('Request Timeout', 'Request timed out; try again later.'),
+ 409: ('Conflict', 'Request conflict.'),
+ 410: ('Gone',
+ 'URI no longer exists and has been permanently removed.'),
+ 411: ('Length Required', 'Client must specify Content-Length.'),
+ 412: ('Precondition Failed', 'Precondition in headers is false.'),
+ 413: ('Request Entity Too Large', 'Entity is too large.'),
+ 414: ('Request-URI Too Long', 'URI is too long.'),
+ 415: ('Unsupported Media Type', 'Entity body in unsupported format.'),
+ 416: ('Requested Range Not Satisfiable',
+ 'Cannot satisfy request range.'),
+ 417: ('Expectation Failed',
+ 'Expect condition could not be satisfied.'),
+ 428: ('Precondition Required',
+ 'The origin server requires the request to be conditional.'),
+ 429: ('Too Many Requests', 'The user has sent too many requests '
+ 'in a given amount of time ("rate limiting").'),
+ 431: ('Request Header Fields Too Large', 'The server is unwilling to '
+ 'process the request because its header fields are too large.'),
+
+ 500: ('Internal Server Error', 'Server got itself in trouble'),
+ 501: ('Not Implemented',
+ 'Server does not support this operation'),
+ 502: ('Bad Gateway', 'Invalid responses from another server/proxy.'),
+ 503: ('Service Unavailable',
+ 'The server cannot process the request due to a high load'),
+ 504: ('Gateway Timeout',
+ 'The gateway server did not receive a timely response'),
+ 505: ('HTTP Version Not Supported', 'Cannot fulfill request.'),
+ 511: ('Network Authentication Required',
+ 'The client needs to authenticate to gain network access.'),
+ }
+
+
+class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
+
+ """Simple HTTP request handler with GET and HEAD commands.
+
+ This serves files from the current directory and any of its
+ subdirectories. The MIME type for files is determined by
+ calling the .guess_type() method.
+
+ The GET and HEAD requests are identical except that the HEAD
+ request omits the actual contents of the file.
+
+ """
+
+ server_version = "SimpleHTTP/" + __version__
+
+ def do_GET(self):
+ """Serve a GET request."""
+ f = self.send_head()
+ if f:
+ self.copyfile(f, self.wfile)
+ f.close()
+
+ def do_HEAD(self):
+ """Serve a HEAD request."""
+ f = self.send_head()
+ if f:
+ f.close()
+
+ def send_head(self):
+ """Common code for GET and HEAD commands.
+
+ This sends the response code and MIME headers.
+
+ Return value is either a file object (which has to be copied
+ to the outputfile by the caller unless the command was HEAD,
+ and must be closed by the caller under all circumstances), or
+ None, in which case the caller has nothing further to do.
+
+ """
+ path = self.translate_path(self.path)
+ f = None
+ if os.path.isdir(path):
+ if not self.path.endswith('/'):
+ # redirect browser - doing basically what apache does
+ self.send_response(301)
+ self.send_header("Location", self.path + "/")
+ self.end_headers()
+ return None
+ for index in "index.html", "index.htm":
+ index = os.path.join(path, index)
+ if os.path.exists(index):
+ path = index
+ break
+ else:
+ return self.list_directory(path)
+ ctype = self.guess_type(path)
+ try:
+ f = open(path, 'rb')
+ except IOError:
+ self.send_error(404, "File not found")
+ return None
+ self.send_response(200)
+ self.send_header("Content-type", ctype)
+ fs = os.fstat(f.fileno())
+ self.send_header("Content-Length", str(fs[6]))
+ self.send_header("Last-Modified", self.date_time_string(fs.st_mtime))
+ self.end_headers()
+ return f
+
+ def list_directory(self, path):
+ """Helper to produce a directory listing (absent index.html).
+
+ Return value is either a file object, or None (indicating an
+ error). In either case, the headers are sent, making the
+ interface the same as for send_head().
+
+ """
+ try:
+ list = os.listdir(path)
+ except os.error:
+ self.send_error(404, "No permission to list directory")
+ return None
+ list.sort(key=lambda a: a.lower())
+ r = []
+ displaypath = html.escape(urllib_parse.unquote(self.path))
+ enc = sys.getfilesystemencoding()
+ title = 'Directory listing for %s' % displaypath
+ r.append('')
+ r.append('\n')
+ r.append('' % enc)
+ r.append('%s\n' % title)
+ r.append('\n
%s
' % title)
+ r.append('\n
')
+ for name in list:
+ fullname = os.path.join(path, name)
+ displayname = linkname = name
+ # Append / for directories or @ for symbolic links
+ if os.path.isdir(fullname):
+ displayname = name + "/"
+ linkname = name + "/"
+ if os.path.islink(fullname):
+ displayname = name + "@"
+ # Note: a link to a directory displays with @ and links with /
+ r.append('
\n\n\n\n')
+ encoded = '\n'.join(r).encode(enc)
+ f = io.BytesIO()
+ f.write(encoded)
+ f.seek(0)
+ self.send_response(200)
+ self.send_header("Content-type", "text/html; charset=%s" % enc)
+ self.send_header("Content-Length", str(len(encoded)))
+ self.end_headers()
+ return f
+
+ def translate_path(self, path):
+ """Translate a /-separated PATH to the local filename syntax.
+
+ Components that mean special things to the local file system
+ (e.g. drive or directory names) are ignored. (XXX They should
+ probably be diagnosed.)
+
+ """
+ # abandon query parameters
+ path = path.split('?',1)[0]
+ path = path.split('#',1)[0]
+ path = posixpath.normpath(urllib_parse.unquote(path))
+ words = path.split('/')
+ words = filter(None, words)
+ path = os.getcwd()
+ for word in words:
+ drive, word = os.path.splitdrive(word)
+ head, word = os.path.split(word)
+ if word in (os.curdir, os.pardir): continue
+ path = os.path.join(path, word)
+ return path
+
+ def copyfile(self, source, outputfile):
+ """Copy all data between two file objects.
+
+ The SOURCE argument is a file object open for reading
+ (or anything with a read() method) and the DESTINATION
+ argument is a file object open for writing (or
+ anything with a write() method).
+
+ The only reason for overriding this would be to change
+ the block size or perhaps to replace newlines by CRLF
+ -- note however that this the default server uses this
+ to copy binary data as well.
+
+ """
+ shutil.copyfileobj(source, outputfile)
+
+ def guess_type(self, path):
+ """Guess the type of a file.
+
+ Argument is a PATH (a filename).
+
+ Return value is a string of the form type/subtype,
+ usable for a MIME Content-type header.
+
+ The default implementation looks the file's extension
+ up in the table self.extensions_map, using application/octet-stream
+ as a default; however it would be permissible (if
+ slow) to look inside the data to make a better guess.
+
+ """
+
+ base, ext = posixpath.splitext(path)
+ if ext in self.extensions_map:
+ return self.extensions_map[ext]
+ ext = ext.lower()
+ if ext in self.extensions_map:
+ return self.extensions_map[ext]
+ else:
+ return self.extensions_map['']
+
+ if not mimetypes.inited:
+ mimetypes.init() # try to read system mime.types
+ extensions_map = mimetypes.types_map.copy()
+ extensions_map.update({
+ '': 'application/octet-stream', # Default
+ '.py': 'text/plain',
+ '.c': 'text/plain',
+ '.h': 'text/plain',
+ })
+
+
+# Utilities for CGIHTTPRequestHandler
+
+def _url_collapse_path(path):
+ """
+ Given a URL path, remove extra '/'s and '.' path elements and collapse
+ any '..' references and returns a colllapsed path.
+
+ Implements something akin to RFC-2396 5.2 step 6 to parse relative paths.
+ The utility of this function is limited to is_cgi method and helps
+ preventing some security attacks.
+
+ Returns: A tuple of (head, tail) where tail is everything after the final /
+ and head is everything before it. Head will always start with a '/' and,
+ if it contains anything else, never have a trailing '/'.
+
+ Raises: IndexError if too many '..' occur within the path.
+
+ """
+ # Similar to os.path.split(os.path.normpath(path)) but specific to URL
+ # path semantics rather than local operating system semantics.
+ path_parts = path.split('/')
+ head_parts = []
+ for part in path_parts[:-1]:
+ if part == '..':
+ head_parts.pop() # IndexError if more '..' than prior parts
+ elif part and part != '.':
+ head_parts.append( part )
+ if path_parts:
+ tail_part = path_parts.pop()
+ if tail_part:
+ if tail_part == '..':
+ head_parts.pop()
+ tail_part = ''
+ elif tail_part == '.':
+ tail_part = ''
+ else:
+ tail_part = ''
+
+ splitpath = ('/' + '/'.join(head_parts), tail_part)
+ collapsed_path = "/".join(splitpath)
+
+ return collapsed_path
+
+
+
+nobody = None
+
+def nobody_uid():
+ """Internal routine to get nobody's uid"""
+ global nobody
+ if nobody:
+ return nobody
+ try:
+ import pwd
+ except ImportError:
+ return -1
+ try:
+ nobody = pwd.getpwnam('nobody')[2]
+ except KeyError:
+ nobody = 1 + max(x[2] for x in pwd.getpwall())
+ return nobody
+
+
+def executable(path):
+ """Test for executable file."""
+ return os.access(path, os.X_OK)
+
+
+class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
+
+ """Complete HTTP server with GET, HEAD and POST commands.
+
+ GET and HEAD also support running CGI scripts.
+
+ The POST command is *only* implemented for CGI scripts.
+
+ """
+
+ # Determine platform specifics
+ have_fork = hasattr(os, 'fork')
+
+ # Make rfile unbuffered -- we need to read one line and then pass
+ # the rest to a subprocess, so we can't use buffered input.
+ rbufsize = 0
+
+ def do_POST(self):
+ """Serve a POST request.
+
+ This is only implemented for CGI scripts.
+
+ """
+
+ if self.is_cgi():
+ self.run_cgi()
+ else:
+ self.send_error(501, "Can only POST to CGI scripts")
+
+ def send_head(self):
+ """Version of send_head that support CGI scripts"""
+ if self.is_cgi():
+ return self.run_cgi()
+ else:
+ return SimpleHTTPRequestHandler.send_head(self)
+
+ def is_cgi(self):
+ """Test whether self.path corresponds to a CGI script.
+
+ Returns True and updates the cgi_info attribute to the tuple
+ (dir, rest) if self.path requires running a CGI script.
+ Returns False otherwise.
+
+ If any exception is raised, the caller should assume that
+ self.path was rejected as invalid and act accordingly.
+
+ The default implementation tests whether the normalized url
+ path begins with one of the strings in self.cgi_directories
+ (and the next character is a '/' or the end of the string).
+
+ """
+ collapsed_path = _url_collapse_path(self.path)
+ dir_sep = collapsed_path.find('/', 1)
+ head, tail = collapsed_path[:dir_sep], collapsed_path[dir_sep+1:]
+ if head in self.cgi_directories:
+ self.cgi_info = head, tail
+ return True
+ return False
+
+
+ cgi_directories = ['/cgi-bin', '/htbin']
+
+ def is_executable(self, path):
+ """Test whether argument path is an executable file."""
+ return executable(path)
+
+ def is_python(self, path):
+ """Test whether argument path is a Python script."""
+ head, tail = os.path.splitext(path)
+ return tail.lower() in (".py", ".pyw")
+
+ def run_cgi(self):
+ """Execute a CGI script."""
+ path = self.path
+ dir, rest = self.cgi_info
+
+ i = path.find('/', len(dir) + 1)
+ while i >= 0:
+ nextdir = path[:i]
+ nextrest = path[i+1:]
+
+ scriptdir = self.translate_path(nextdir)
+ if os.path.isdir(scriptdir):
+ dir, rest = nextdir, nextrest
+ i = path.find('/', len(dir) + 1)
+ else:
+ break
+
+ # find an explicit query string, if present.
+ i = rest.rfind('?')
+ if i >= 0:
+ rest, query = rest[:i], rest[i+1:]
+ else:
+ query = ''
+
+ # dissect the part after the directory name into a script name &
+ # a possible additional path, to be stored in PATH_INFO.
+ i = rest.find('/')
+ if i >= 0:
+ script, rest = rest[:i], rest[i:]
+ else:
+ script, rest = rest, ''
+
+ scriptname = dir + '/' + script
+ scriptfile = self.translate_path(scriptname)
+ if not os.path.exists(scriptfile):
+ self.send_error(404, "No such CGI script (%r)" % scriptname)
+ return
+ if not os.path.isfile(scriptfile):
+ self.send_error(403, "CGI script is not a plain file (%r)" %
+ scriptname)
+ return
+ ispy = self.is_python(scriptname)
+ if self.have_fork or not ispy:
+ if not self.is_executable(scriptfile):
+ self.send_error(403, "CGI script is not executable (%r)" %
+ scriptname)
+ return
+
+ # Reference: http://hoohoo.ncsa.uiuc.edu/cgi/env.html
+ # XXX Much of the following could be prepared ahead of time!
+ env = copy.deepcopy(os.environ)
+ env['SERVER_SOFTWARE'] = self.version_string()
+ env['SERVER_NAME'] = self.server.server_name
+ env['GATEWAY_INTERFACE'] = 'CGI/1.1'
+ env['SERVER_PROTOCOL'] = self.protocol_version
+ env['SERVER_PORT'] = str(self.server.server_port)
+ env['REQUEST_METHOD'] = self.command
+ uqrest = urllib_parse.unquote(rest)
+ env['PATH_INFO'] = uqrest
+ env['PATH_TRANSLATED'] = self.translate_path(uqrest)
+ env['SCRIPT_NAME'] = scriptname
+ if query:
+ env['QUERY_STRING'] = query
+ env['REMOTE_ADDR'] = self.client_address[0]
+ authorization = self.headers.get("authorization")
+ if authorization:
+ authorization = authorization.split()
+ if len(authorization) == 2:
+ import base64, binascii
+ env['AUTH_TYPE'] = authorization[0]
+ if authorization[0].lower() == "basic":
+ try:
+ authorization = authorization[1].encode('ascii')
+ if utils.PY3:
+ # In Py3.3, was:
+ authorization = base64.decodebytes(authorization).\
+ decode('ascii')
+ else:
+ # Backport to Py2.7:
+ authorization = base64.decodestring(authorization).\
+ decode('ascii')
+ except (binascii.Error, UnicodeError):
+ pass
+ else:
+ authorization = authorization.split(':')
+ if len(authorization) == 2:
+ env['REMOTE_USER'] = authorization[0]
+ # XXX REMOTE_IDENT
+ if self.headers.get('content-type') is None:
+ env['CONTENT_TYPE'] = self.headers.get_content_type()
+ else:
+ env['CONTENT_TYPE'] = self.headers['content-type']
+ length = self.headers.get('content-length')
+ if length:
+ env['CONTENT_LENGTH'] = length
+ referer = self.headers.get('referer')
+ if referer:
+ env['HTTP_REFERER'] = referer
+ accept = []
+ for line in self.headers.getallmatchingheaders('accept'):
+ if line[:1] in "\t\n\r ":
+ accept.append(line.strip())
+ else:
+ accept = accept + line[7:].split(',')
+ env['HTTP_ACCEPT'] = ','.join(accept)
+ ua = self.headers.get('user-agent')
+ if ua:
+ env['HTTP_USER_AGENT'] = ua
+ co = filter(None, self.headers.get_all('cookie', []))
+ cookie_str = ', '.join(co)
+ if cookie_str:
+ env['HTTP_COOKIE'] = cookie_str
+ # XXX Other HTTP_* headers
+ # Since we're setting the env in the parent, provide empty
+ # values to override previously set values
+ for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH',
+ 'HTTP_USER_AGENT', 'HTTP_COOKIE', 'HTTP_REFERER'):
+ env.setdefault(k, "")
+
+ self.send_response(200, "Script output follows")
+ self.flush_headers()
+
+ decoded_query = query.replace('+', ' ')
+
+ if self.have_fork:
+ # Unix -- fork as we should
+ args = [script]
+ if '=' not in decoded_query:
+ args.append(decoded_query)
+ nobody = nobody_uid()
+ self.wfile.flush() # Always flush before forking
+ pid = os.fork()
+ if pid != 0:
+ # Parent
+ pid, sts = os.waitpid(pid, 0)
+ # throw away additional data [see bug #427345]
+ while select.select([self.rfile], [], [], 0)[0]:
+ if not self.rfile.read(1):
+ break
+ if sts:
+ self.log_error("CGI script exit status %#x", sts)
+ return
+ # Child
+ try:
+ try:
+ os.setuid(nobody)
+ except os.error:
+ pass
+ os.dup2(self.rfile.fileno(), 0)
+ os.dup2(self.wfile.fileno(), 1)
+ os.execve(scriptfile, args, env)
+ except:
+ self.server.handle_error(self.request, self.client_address)
+ os._exit(127)
+
+ else:
+ # Non-Unix -- use subprocess
+ import subprocess
+ cmdline = [scriptfile]
+ if self.is_python(scriptfile):
+ interp = sys.executable
+ if interp.lower().endswith("w.exe"):
+ # On Windows, use python.exe, not pythonw.exe
+ interp = interp[:-5] + interp[-4:]
+ cmdline = [interp, '-u'] + cmdline
+ if '=' not in query:
+ cmdline.append(query)
+ self.log_message("command: %s", subprocess.list2cmdline(cmdline))
+ try:
+ nbytes = int(length)
+ except (TypeError, ValueError):
+ nbytes = 0
+ p = subprocess.Popen(cmdline,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ env = env
+ )
+ if self.command.lower() == "post" and nbytes > 0:
+ data = self.rfile.read(nbytes)
+ else:
+ data = None
+ # throw away additional data [see bug #427345]
+ while select.select([self.rfile._sock], [], [], 0)[0]:
+ if not self.rfile._sock.recv(1):
+ break
+ stdout, stderr = p.communicate(data)
+ self.wfile.write(stdout)
+ if stderr:
+ self.log_error('%s', stderr)
+ p.stderr.close()
+ p.stdout.close()
+ status = p.returncode
+ if status:
+ self.log_error("CGI script exit status %#x", status)
+ else:
+ self.log_message("CGI script exited OK")
+
+
+def test(HandlerClass = BaseHTTPRequestHandler,
+ ServerClass = HTTPServer, protocol="HTTP/1.0", port=8000):
+ """Test the HTTP request handler class.
+
+ This runs an HTTP server on port 8000 (or the first command line
+ argument).
+
+ """
+ server_address = ('', port)
+
+ HandlerClass.protocol_version = protocol
+ httpd = ServerClass(server_address, HandlerClass)
+
+ sa = httpd.socket.getsockname()
+ print("Serving HTTP on", sa[0], "port", sa[1], "...")
+ try:
+ httpd.serve_forever()
+ except KeyboardInterrupt:
+ print("\nKeyboard interrupt received, exiting.")
+ httpd.server_close()
+ sys.exit(0)
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--cgi', action='store_true',
+ help='Run as CGI Server')
+ parser.add_argument('port', action='store',
+ default=8000, type=int,
+ nargs='?',
+ help='Specify alternate port [default: 8000]')
+ args = parser.parse_args()
+ if args.cgi:
+ test(HandlerClass=CGIHTTPRequestHandler, port=args.port)
+ else:
+ test(HandlerClass=SimpleHTTPRequestHandler, port=args.port)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/misc.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/misc.py
new file mode 100644
index 0000000..03c68c1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/misc.py
@@ -0,0 +1,505 @@
+"""
+Miscellaneous function (re)definitions from the Py3.3 standard library for
+Python 2.6/2.7.
+
+math.ceil
+
+collections.OrderedDict (for Python 2.6)
+collections.Counter (for Python 2.6)
+"""
+
+from math import ceil as oldceil
+import subprocess
+
+from future.utils import iteritems, itervalues, PY26
+
+
+def ceil(x):
+ """
+ Return the ceiling of x as an int.
+ This is the smallest integral value >= x.
+ """
+ return int(oldceil(x))
+
+
+# OrderedDict Shim from Raymond Hettinger, python core dev
+# http://code.activestate.com/recipes/576693-ordered-dictionary-for-py24/
+# here to support version 2.6.
+
+if PY26:
+ # don't need this except in 2.6
+ try:
+ from thread import get_ident
+ except ImportError:
+ from dummy_thread import get_ident
+
+try:
+ from _abcoll import KeysView, ValuesView, ItemsView
+except ImportError:
+ pass
+
+
+class _OrderedDict(dict):
+
+ 'Dictionary that remembers insertion order'
+ # An inherited dict maps keys to values.
+ # The inherited dict provides __getitem__, __len__, __contains__, and get.
+ # The remaining methods are order-aware.
+ # Big-O running times for all methods are the same as for regular
+ # dictionaries.
+
+ # The internal self.__map dictionary maps keys to links in a doubly linked
+ # list. The circular doubly linked list starts and ends with a sentinel
+ # element. The sentinel element never gets deleted (this simplifies the
+ # algorithm). Each link is stored as a list of length three: [PREV, NEXT,
+ # KEY].
+
+ def __init__(self, *args, **kwds):
+ '''Initialize an ordered dictionary. Signature is the same as for
+ regular dictionaries, but keyword arguments are not recommended
+ because their insertion order is arbitrary.
+
+ '''
+ if len(args) > 1:
+ raise TypeError('expected at most 1 arguments, got %d' % len(args))
+ try:
+ self.__root
+ except AttributeError:
+ self.__root = root = [] # sentinel node
+ root[:] = [root, root, None]
+ self.__map = {}
+ self.__update(*args, **kwds)
+
+ def __setitem__(self, key, value, dict_setitem=dict.__setitem__):
+ 'od.__setitem__(i, y) <==> od[i]=y'
+ # Setting a new item creates a new link which goes at the end of the
+ # linked list, and the inherited dictionary is updated with the new
+ # key/value pair.
+ if key not in self:
+ root = self.__root
+ last = root[0]
+ last[1] = root[0] = self.__map[key] = [last, root, key]
+ dict_setitem(self, key, value)
+
+ def __delitem__(self, key, dict_delitem=dict.__delitem__):
+ 'od.__delitem__(y) <==> del od[y]'
+ # Deleting an existing item uses self.__map to find the link which is
+ # then removed by updating the links in the predecessor and successor
+ # nodes.
+ dict_delitem(self, key)
+ link_prev, link_next, key = self.__map.pop(key)
+ link_prev[1] = link_next
+ link_next[0] = link_prev
+
+ def __iter__(self):
+ 'od.__iter__() <==> iter(od)'
+ root = self.__root
+ curr = root[1]
+ while curr is not root:
+ yield curr[2]
+ curr = curr[1]
+
+ def __reversed__(self):
+ 'od.__reversed__() <==> reversed(od)'
+ root = self.__root
+ curr = root[0]
+ while curr is not root:
+ yield curr[2]
+ curr = curr[0]
+
+ def clear(self):
+ 'od.clear() -> None. Remove all items from od.'
+ try:
+ for node in itervalues(self.__map):
+ del node[:]
+ root = self.__root
+ root[:] = [root, root, None]
+ self.__map.clear()
+ except AttributeError:
+ pass
+ dict.clear(self)
+
+ def popitem(self, last=True):
+ '''od.popitem() -> (k, v), return and remove a (key, value) pair.
+ Pairs are returned in LIFO order if last is true or FIFO order if
+ false.
+ '''
+ if not self:
+ raise KeyError('dictionary is empty')
+ root = self.__root
+ if last:
+ link = root[0]
+ link_prev = link[0]
+ link_prev[1] = root
+ root[0] = link_prev
+ else:
+ link = root[1]
+ link_next = link[1]
+ root[1] = link_next
+ link_next[0] = root
+ key = link[2]
+ del self.__map[key]
+ value = dict.pop(self, key)
+ return key, value
+
+ # -- the following methods do not depend on the internal structure --
+
+ def keys(self):
+ 'od.keys() -> list of keys in od'
+ return list(self)
+
+ def values(self):
+ 'od.values() -> list of values in od'
+ return [self[key] for key in self]
+
+ def items(self):
+ 'od.items() -> list of (key, value) pairs in od'
+ return [(key, self[key]) for key in self]
+
+ def iterkeys(self):
+ 'od.iterkeys() -> an iterator over the keys in od'
+ return iter(self)
+
+ def itervalues(self):
+ 'od.itervalues -> an iterator over the values in od'
+ for k in self:
+ yield self[k]
+
+ def iteritems(self):
+ 'od.iteritems -> an iterator over the (key, value) items in od'
+ for k in self:
+ yield (k, self[k])
+
+ def update(*args, **kwds):
+ '''od.update(E, **F) -> None. Update od from dict/iterable E and F.
+
+ If E is a dict instance, does: for k in E: od[k] = E[k]
+ If E has a .keys() method, does: for k in E.keys(): od[k] = E[k]
+ Or if E is an iterable of items, does:for k, v in E: od[k] = v
+ In either case, this is followed by: for k, v in F.items(): od[k] = v
+ '''
+ if len(args) > 2:
+ raise TypeError('update() takes at most 2 positional '
+ 'arguments (%d given)' % (len(args),))
+ elif not args:
+ raise TypeError('update() takes at least 1 argument (0 given)')
+ self = args[0]
+ # Make progressively weaker assumptions about "other"
+ other = ()
+ if len(args) == 2:
+ other = args[1]
+ if isinstance(other, dict):
+ for key in other:
+ self[key] = other[key]
+ elif hasattr(other, 'keys'):
+ for key in other.keys():
+ self[key] = other[key]
+ else:
+ for key, value in other:
+ self[key] = value
+ for key, value in kwds.items():
+ self[key] = value
+ # let subclasses override update without breaking __init__
+ __update = update
+
+ __marker = object()
+
+ def pop(self, key, default=__marker):
+ '''od.pop(k[,d]) -> v, remove specified key and return the\
+ corresponding value. If key is not found, d is returned if given,
+ otherwise KeyError is raised.
+ '''
+ if key in self:
+ result = self[key]
+ del self[key]
+ return result
+ if default is self.__marker:
+ raise KeyError(key)
+ return default
+
+ def setdefault(self, key, default=None):
+ 'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od'
+ if key in self:
+ return self[key]
+ self[key] = default
+ return default
+
+ def __repr__(self, _repr_running={}):
+ 'od.__repr__() <==> repr(od)'
+ call_key = id(self), get_ident()
+ if call_key in _repr_running:
+ return '...'
+ _repr_running[call_key] = 1
+ try:
+ if not self:
+ return '%s()' % (self.__class__.__name__,)
+ return '%s(%r)' % (self.__class__.__name__, list(self.items()))
+ finally:
+ del _repr_running[call_key]
+
+ def __reduce__(self):
+ 'Return state information for pickling'
+ items = [[k, self[k]] for k in self]
+ inst_dict = vars(self).copy()
+ for k in vars(OrderedDict()):
+ inst_dict.pop(k, None)
+ if inst_dict:
+ return (self.__class__, (items,), inst_dict)
+ return self.__class__, (items,)
+
+ def copy(self):
+ 'od.copy() -> a shallow copy of od'
+ return self.__class__(self)
+
+ @classmethod
+ def fromkeys(cls, iterable, value=None):
+ '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S and
+ values equal to v (which defaults to None).
+ '''
+ d = cls()
+ for key in iterable:
+ d[key] = value
+ return d
+
+ def __eq__(self, other):
+ '''od.__eq__(y) <==> od==y. Comparison to another OD is
+ order-sensitive while comparison to a regular mapping is
+ order-insensitive.
+ '''
+ if isinstance(other, OrderedDict):
+ return (len(self) == len(other) and
+ list(self.items()) == list(other.items()))
+ return dict.__eq__(self, other)
+
+ def __ne__(self, other):
+ return not self == other
+
+ # -- the following methods are only used in Python 2.7 --
+
+ def viewkeys(self):
+ "od.viewkeys() -> a set-like object providing a view on od's keys"
+ return KeysView(self)
+
+ def viewvalues(self):
+ "od.viewvalues() -> an object providing a view on od's values"
+ return ValuesView(self)
+
+ def viewitems(self):
+ "od.viewitems() -> a set-like object providing a view on od's items"
+ return ItemsView(self)
+
+
+# {{{ http://code.activestate.com/recipes/576611/ (r11)
+
+try:
+ from operator import itemgetter
+ from heapq import nlargest
+except ImportError:
+ pass
+
+
+class _Counter(dict):
+
+ '''Dict subclass for counting hashable objects. Sometimes called a bag
+ or multiset. Elements are stored as dictionary keys and their counts
+ are stored as dictionary values.
+
+ >>> Counter('zyzygy')
+ Counter({'y': 3, 'z': 2, 'g': 1})
+
+ '''
+
+ def __init__(self, iterable=None, **kwds):
+ '''Create a new, empty Counter object. And if given, count elements
+ from an input iterable. Or, initialize the count from another mapping
+ of elements to their counts.
+
+ >>> c = Counter() # a new, empty counter
+ >>> c = Counter('gallahad') # a new counter from an iterable
+ >>> c = Counter({'a': 4, 'b': 2}) # a new counter from a mapping
+ >>> c = Counter(a=4, b=2) # a new counter from keyword args
+
+ '''
+ self.update(iterable, **kwds)
+
+ def __missing__(self, key):
+ return 0
+
+ def most_common(self, n=None):
+ '''List the n most common elements and their counts from the most
+ common to the least. If n is None, then list all element counts.
+
+ >>> Counter('abracadabra').most_common(3)
+ [('a', 5), ('r', 2), ('b', 2)]
+
+ '''
+ if n is None:
+ return sorted(iteritems(self), key=itemgetter(1), reverse=True)
+ return nlargest(n, iteritems(self), key=itemgetter(1))
+
+ def elements(self):
+ '''Iterator over elements repeating each as many times as its count.
+
+ >>> c = Counter('ABCABC')
+ >>> sorted(c.elements())
+ ['A', 'A', 'B', 'B', 'C', 'C']
+
+ If an element's count has been set to zero or is a negative number,
+ elements() will ignore it.
+
+ '''
+ for elem, count in iteritems(self):
+ for _ in range(count):
+ yield elem
+
+ # Override dict methods where the meaning changes for Counter objects.
+
+ @classmethod
+ def fromkeys(cls, iterable, v=None):
+ raise NotImplementedError(
+ 'Counter.fromkeys() is undefined. Use Counter(iterable) instead.')
+
+ def update(self, iterable=None, **kwds):
+ '''Like dict.update() but add counts instead of replacing them.
+
+ Source can be an iterable, a dictionary, or another Counter instance.
+
+ >>> c = Counter('which')
+ >>> c.update('witch') # add elements from another iterable
+ >>> d = Counter('watch')
+ >>> c.update(d) # add elements from another counter
+ >>> c['h'] # four 'h' in which, witch, and watch
+ 4
+
+ '''
+ if iterable is not None:
+ if hasattr(iterable, 'iteritems'):
+ if self:
+ self_get = self.get
+ for elem, count in iteritems(iterable):
+ self[elem] = self_get(elem, 0) + count
+ else:
+ dict.update(
+ self, iterable) # fast path when counter is empty
+ else:
+ self_get = self.get
+ for elem in iterable:
+ self[elem] = self_get(elem, 0) + 1
+ if kwds:
+ self.update(kwds)
+
+ def copy(self):
+ 'Like dict.copy() but returns a Counter instance instead of a dict.'
+ return Counter(self)
+
+ def __delitem__(self, elem):
+ '''Like dict.__delitem__() but does not raise KeyError for missing
+ values.'''
+ if elem in self:
+ dict.__delitem__(self, elem)
+
+ def __repr__(self):
+ if not self:
+ return '%s()' % self.__class__.__name__
+ items = ', '.join(map('%r: %r'.__mod__, self.most_common()))
+ return '%s({%s})' % (self.__class__.__name__, items)
+
+ # Multiset-style mathematical operations discussed in:
+ # Knuth TAOCP Volume II section 4.6.3 exercise 19
+ # and at http://en.wikipedia.org/wiki/Multiset
+ #
+ # Outputs guaranteed to only include positive counts.
+ #
+ # To strip negative and zero counts, add-in an empty counter:
+ # c += Counter()
+
+ def __add__(self, other):
+ '''Add counts from two counters.
+
+ >>> Counter('abbb') + Counter('bcc')
+ Counter({'b': 4, 'c': 2, 'a': 1})
+
+
+ '''
+ if not isinstance(other, Counter):
+ return NotImplemented
+ result = Counter()
+ for elem in set(self) | set(other):
+ newcount = self[elem] + other[elem]
+ if newcount > 0:
+ result[elem] = newcount
+ return result
+
+ def __sub__(self, other):
+ ''' Subtract count, but keep only results with positive counts.
+
+ >>> Counter('abbbc') - Counter('bccd')
+ Counter({'b': 2, 'a': 1})
+
+ '''
+ if not isinstance(other, Counter):
+ return NotImplemented
+ result = Counter()
+ for elem in set(self) | set(other):
+ newcount = self[elem] - other[elem]
+ if newcount > 0:
+ result[elem] = newcount
+ return result
+
+ def __or__(self, other):
+ '''Union is the maximum of value in either of the input counters.
+
+ >>> Counter('abbb') | Counter('bcc')
+ Counter({'b': 3, 'c': 2, 'a': 1})
+
+ '''
+ if not isinstance(other, Counter):
+ return NotImplemented
+ _max = max
+ result = Counter()
+ for elem in set(self) | set(other):
+ newcount = _max(self[elem], other[elem])
+ if newcount > 0:
+ result[elem] = newcount
+ return result
+
+ def __and__(self, other):
+ ''' Intersection is the minimum of corresponding counts.
+
+ >>> Counter('abbb') & Counter('bcc')
+ Counter({'b': 1})
+
+ '''
+ if not isinstance(other, Counter):
+ return NotImplemented
+ _min = min
+ result = Counter()
+ if len(self) < len(other):
+ self, other = other, self
+ for elem in filter(self.__contains__, other):
+ newcount = _min(self[elem], other[elem])
+ if newcount > 0:
+ result[elem] = newcount
+ return result
+
+try:
+ from collections import OrderedDict, Counter
+except ImportError:
+ # Python 2.6 doesn't have these:
+ OrderedDict = _OrderedDict
+ Counter = _Counter
+
+
+# For Python 2.6 compatibility: see http://stackoverflow.com/questions/4814970/
+def check_output(*popenargs, **kwargs):
+ if 'stdout' in kwargs:
+ raise ValueError('stdout argument not allowed, it will be overridden.')
+ process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
+ output, unused_err = process.communicate()
+ retcode = process.poll()
+ if retcode:
+ cmd = kwargs.get("args")
+ if cmd is None:
+ cmd = popenargs[0]
+ raise subprocess.CalledProcessError(retcode, cmd)
+ return output
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/socket.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/socket.py
new file mode 100644
index 0000000..84e0e9d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/socket.py
@@ -0,0 +1,451 @@
+# Wrapper module for _socket, providing some additional facilities
+# implemented in Python.
+
+"""\
+This module provides socket operations and some related functions.
+On Unix, it supports IP (Internet Protocol) and Unix domain sockets.
+On other systems, it only supports IP. Functions specific for a
+socket are available as methods of the socket object.
+
+Functions:
+
+socket() -- create a new socket object
+socketpair() -- create a pair of new socket objects [*]
+fromfd() -- create a socket object from an open file descriptor [*]
+fromshare() -- create a socket object from data received from socket.share() [*]
+gethostname() -- return the current hostname
+gethostbyname() -- map a hostname to its IP number
+gethostbyaddr() -- map an IP number or hostname to DNS info
+getservbyname() -- map a service name and a protocol name to a port number
+getprotobyname() -- map a protocol name (e.g. 'tcp') to a number
+ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order
+htons(), htonl() -- convert 16, 32 bit int from host to network byte order
+inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format
+inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89)
+socket.getdefaulttimeout() -- get the default timeout value
+socket.setdefaulttimeout() -- set the default timeout value
+create_connection() -- connects to an address, with an optional timeout and
+ optional source address.
+
+ [*] not available on all platforms!
+
+Special objects:
+
+SocketType -- type object for socket objects
+error -- exception raised for I/O errors
+has_ipv6 -- boolean value indicating if IPv6 is supported
+
+Integer constants:
+
+AF_INET, AF_UNIX -- socket domains (first argument to socket() call)
+SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument)
+
+Many other constants may be defined; these may be used in calls to
+the setsockopt() and getsockopt() methods.
+"""
+
+from __future__ import unicode_literals
+from __future__ import print_function
+from __future__ import division
+from __future__ import absolute_import
+from future.builtins import super
+
+import _socket
+from _socket import *
+
+import os, sys, io
+
+try:
+ import errno
+except ImportError:
+ errno = None
+EBADF = getattr(errno, 'EBADF', 9)
+EAGAIN = getattr(errno, 'EAGAIN', 11)
+EWOULDBLOCK = getattr(errno, 'EWOULDBLOCK', 11)
+
+__all__ = ["getfqdn", "create_connection"]
+__all__.extend(os._get_exports_list(_socket))
+
+
+_realsocket = socket
+
+# WSA error codes
+if sys.platform.lower().startswith("win"):
+ errorTab = {}
+ errorTab[10004] = "The operation was interrupted."
+ errorTab[10009] = "A bad file handle was passed."
+ errorTab[10013] = "Permission denied."
+ errorTab[10014] = "A fault occurred on the network??" # WSAEFAULT
+ errorTab[10022] = "An invalid operation was attempted."
+ errorTab[10035] = "The socket operation would block"
+ errorTab[10036] = "A blocking operation is already in progress."
+ errorTab[10048] = "The network address is in use."
+ errorTab[10054] = "The connection has been reset."
+ errorTab[10058] = "The network has been shut down."
+ errorTab[10060] = "The operation timed out."
+ errorTab[10061] = "Connection refused."
+ errorTab[10063] = "The name is too long."
+ errorTab[10064] = "The host is down."
+ errorTab[10065] = "The host is unreachable."
+ __all__.append("errorTab")
+
+
+class socket(_socket.socket):
+
+ """A subclass of _socket.socket adding the makefile() method."""
+
+ __slots__ = ["__weakref__", "_io_refs", "_closed"]
+
+ def __init__(self, family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None):
+ if fileno is None:
+ _socket.socket.__init__(self, family, type, proto)
+ else:
+ _socket.socket.__init__(self, family, type, proto, fileno)
+ self._io_refs = 0
+ self._closed = False
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *args):
+ if not self._closed:
+ self.close()
+
+ def __repr__(self):
+ """Wrap __repr__() to reveal the real class name."""
+ s = _socket.socket.__repr__(self)
+ if s.startswith(" socket object
+
+ Return a new socket object connected to the same system resource.
+ """
+ fd = dup(self.fileno())
+ sock = self.__class__(self.family, self.type, self.proto, fileno=fd)
+ sock.settimeout(self.gettimeout())
+ return sock
+
+ def accept(self):
+ """accept() -> (socket object, address info)
+
+ Wait for an incoming connection. Return a new socket
+ representing the connection, and the address of the client.
+ For IP sockets, the address info is a pair (hostaddr, port).
+ """
+ fd, addr = self._accept()
+ sock = socket(self.family, self.type, self.proto, fileno=fd)
+ # Issue #7995: if no default timeout is set and the listening
+ # socket had a (non-zero) timeout, force the new socket in blocking
+ # mode to override platform-specific socket flags inheritance.
+ if getdefaulttimeout() is None and self.gettimeout():
+ sock.setblocking(True)
+ return sock, addr
+
+ def makefile(self, mode="r", buffering=None, **_3to2kwargs):
+ """makefile(...) -> an I/O stream connected to the socket
+
+ The arguments are as for io.open() after the filename,
+ except the only mode characters supported are 'r', 'w' and 'b'.
+ The semantics are similar too. (XXX refactor to share code?)
+ """
+ if 'newline' in _3to2kwargs: newline = _3to2kwargs['newline']; del _3to2kwargs['newline']
+ else: newline = None
+ if 'errors' in _3to2kwargs: errors = _3to2kwargs['errors']; del _3to2kwargs['errors']
+ else: errors = None
+ if 'encoding' in _3to2kwargs: encoding = _3to2kwargs['encoding']; del _3to2kwargs['encoding']
+ else: encoding = None
+ for c in mode:
+ if c not in ("r", "w", "b"):
+ raise ValueError("invalid mode %r (only r, w, b allowed)")
+ writing = "w" in mode
+ reading = "r" in mode or not writing
+ assert reading or writing
+ binary = "b" in mode
+ rawmode = ""
+ if reading:
+ rawmode += "r"
+ if writing:
+ rawmode += "w"
+ raw = SocketIO(self, rawmode)
+ self._io_refs += 1
+ if buffering is None:
+ buffering = -1
+ if buffering < 0:
+ buffering = io.DEFAULT_BUFFER_SIZE
+ if buffering == 0:
+ if not binary:
+ raise ValueError("unbuffered streams must be binary")
+ return raw
+ if reading and writing:
+ buffer = io.BufferedRWPair(raw, raw, buffering)
+ elif reading:
+ buffer = io.BufferedReader(raw, buffering)
+ else:
+ assert writing
+ buffer = io.BufferedWriter(raw, buffering)
+ if binary:
+ return buffer
+ text = io.TextIOWrapper(buffer, encoding, errors, newline)
+ text.mode = mode
+ return text
+
+ def _decref_socketios(self):
+ if self._io_refs > 0:
+ self._io_refs -= 1
+ if self._closed:
+ self.close()
+
+ def _real_close(self, _ss=_socket.socket):
+ # This function should not reference any globals. See issue #808164.
+ _ss.close(self)
+
+ def close(self):
+ # This function should not reference any globals. See issue #808164.
+ self._closed = True
+ if self._io_refs <= 0:
+ self._real_close()
+
+ def detach(self):
+ """detach() -> file descriptor
+
+ Close the socket object without closing the underlying file descriptor.
+ The object cannot be used after this call, but the file descriptor
+ can be reused for other purposes. The file descriptor is returned.
+ """
+ self._closed = True
+ return super().detach()
+
+def fromfd(fd, family, type, proto=0):
+ """ fromfd(fd, family, type[, proto]) -> socket object
+
+ Create a socket object from a duplicate of the given file
+ descriptor. The remaining arguments are the same as for socket().
+ """
+ nfd = dup(fd)
+ return socket(family, type, proto, nfd)
+
+if hasattr(_socket.socket, "share"):
+ def fromshare(info):
+ """ fromshare(info) -> socket object
+
+ Create a socket object from a the bytes object returned by
+ socket.share(pid).
+ """
+ return socket(0, 0, 0, info)
+
+if hasattr(_socket, "socketpair"):
+
+ def socketpair(family=None, type=SOCK_STREAM, proto=0):
+ """socketpair([family[, type[, proto]]]) -> (socket object, socket object)
+
+ Create a pair of socket objects from the sockets returned by the platform
+ socketpair() function.
+ The arguments are the same as for socket() except the default family is
+ AF_UNIX if defined on the platform; otherwise, the default is AF_INET.
+ """
+ if family is None:
+ try:
+ family = AF_UNIX
+ except NameError:
+ family = AF_INET
+ a, b = _socket.socketpair(family, type, proto)
+ a = socket(family, type, proto, a.detach())
+ b = socket(family, type, proto, b.detach())
+ return a, b
+
+
+_blocking_errnos = set([EAGAIN, EWOULDBLOCK])
+
+class SocketIO(io.RawIOBase):
+
+ """Raw I/O implementation for stream sockets.
+
+ This class supports the makefile() method on sockets. It provides
+ the raw I/O interface on top of a socket object.
+ """
+
+ # One might wonder why not let FileIO do the job instead. There are two
+ # main reasons why FileIO is not adapted:
+ # - it wouldn't work under Windows (where you can't used read() and
+ # write() on a socket handle)
+ # - it wouldn't work with socket timeouts (FileIO would ignore the
+ # timeout and consider the socket non-blocking)
+
+ # XXX More docs
+
+ def __init__(self, sock, mode):
+ if mode not in ("r", "w", "rw", "rb", "wb", "rwb"):
+ raise ValueError("invalid mode: %r" % mode)
+ io.RawIOBase.__init__(self)
+ self._sock = sock
+ if "b" not in mode:
+ mode += "b"
+ self._mode = mode
+ self._reading = "r" in mode
+ self._writing = "w" in mode
+ self._timeout_occurred = False
+
+ def readinto(self, b):
+ """Read up to len(b) bytes into the writable buffer *b* and return
+ the number of bytes read. If the socket is non-blocking and no bytes
+ are available, None is returned.
+
+ If *b* is non-empty, a 0 return value indicates that the connection
+ was shutdown at the other end.
+ """
+ self._checkClosed()
+ self._checkReadable()
+ if self._timeout_occurred:
+ raise IOError("cannot read from timed out object")
+ while True:
+ try:
+ return self._sock.recv_into(b)
+ except timeout:
+ self._timeout_occurred = True
+ raise
+ # except InterruptedError:
+ # continue
+ except error as e:
+ if e.args[0] in _blocking_errnos:
+ return None
+ raise
+
+ def write(self, b):
+ """Write the given bytes or bytearray object *b* to the socket
+ and return the number of bytes written. This can be less than
+ len(b) if not all data could be written. If the socket is
+ non-blocking and no bytes could be written None is returned.
+ """
+ self._checkClosed()
+ self._checkWritable()
+ try:
+ return self._sock.send(b)
+ except error as e:
+ # XXX what about EINTR?
+ if e.args[0] in _blocking_errnos:
+ return None
+ raise
+
+ def readable(self):
+ """True if the SocketIO is open for reading.
+ """
+ if self.closed:
+ raise ValueError("I/O operation on closed socket.")
+ return self._reading
+
+ def writable(self):
+ """True if the SocketIO is open for writing.
+ """
+ if self.closed:
+ raise ValueError("I/O operation on closed socket.")
+ return self._writing
+
+ def seekable(self):
+ """True if the SocketIO is open for seeking.
+ """
+ if self.closed:
+ raise ValueError("I/O operation on closed socket.")
+ return super().seekable()
+
+ def fileno(self):
+ """Return the file descriptor of the underlying socket.
+ """
+ self._checkClosed()
+ return self._sock.fileno()
+
+ @property
+ def name(self):
+ if not self.closed:
+ return self.fileno()
+ else:
+ return -1
+
+ @property
+ def mode(self):
+ return self._mode
+
+ def close(self):
+ """Close the SocketIO object. This doesn't close the underlying
+ socket, except if all references to it have disappeared.
+ """
+ if self.closed:
+ return
+ io.RawIOBase.close(self)
+ self._sock._decref_socketios()
+ self._sock = None
+
+
+def getfqdn(name=''):
+ """Get fully qualified domain name from name.
+
+ An empty argument is interpreted as meaning the local host.
+
+ First the hostname returned by gethostbyaddr() is checked, then
+ possibly existing aliases. In case no FQDN is available, hostname
+ from gethostname() is returned.
+ """
+ name = name.strip()
+ if not name or name == '0.0.0.0':
+ name = gethostname()
+ try:
+ hostname, aliases, ipaddrs = gethostbyaddr(name)
+ except error:
+ pass
+ else:
+ aliases.insert(0, hostname)
+ for name in aliases:
+ if '.' in name:
+ break
+ else:
+ name = hostname
+ return name
+
+
+_GLOBAL_DEFAULT_TIMEOUT = object()
+
+def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT,
+ source_address=None):
+ """Connect to *address* and return the socket object.
+
+ Convenience function. Connect to *address* (a 2-tuple ``(host,
+ port)``) and return the socket object. Passing the optional
+ *timeout* parameter will set the timeout on the socket instance
+ before attempting to connect. If no *timeout* is supplied, the
+ global default timeout setting returned by :func:`getdefaulttimeout`
+ is used. If *source_address* is set it must be a tuple of (host, port)
+ for the socket to bind as a source address before making the connection.
+ An host of '' or port 0 tells the OS to use the default.
+ """
+
+ host, port = address
+ err = None
+ for res in getaddrinfo(host, port, 0, SOCK_STREAM):
+ af, socktype, proto, canonname, sa = res
+ sock = None
+ try:
+ sock = socket(af, socktype, proto)
+ if timeout is not _GLOBAL_DEFAULT_TIMEOUT:
+ sock.settimeout(timeout)
+ if source_address:
+ sock.bind(source_address)
+ sock.connect(sa)
+ return sock
+
+ except error as _:
+ err = _
+ if sock is not None:
+ sock.close()
+
+ if err is not None:
+ raise err
+ else:
+ raise error("getaddrinfo returns an empty list")
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/socketserver.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/socketserver.py
new file mode 100644
index 0000000..d1e24a6
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/socketserver.py
@@ -0,0 +1,747 @@
+"""Generic socket server classes.
+
+This module tries to capture the various aspects of defining a server:
+
+For socket-based servers:
+
+- address family:
+ - AF_INET{,6}: IP (Internet Protocol) sockets (default)
+ - AF_UNIX: Unix domain sockets
+ - others, e.g. AF_DECNET are conceivable (see
+- socket type:
+ - SOCK_STREAM (reliable stream, e.g. TCP)
+ - SOCK_DGRAM (datagrams, e.g. UDP)
+
+For request-based servers (including socket-based):
+
+- client address verification before further looking at the request
+ (This is actually a hook for any processing that needs to look
+ at the request before anything else, e.g. logging)
+- how to handle multiple requests:
+ - synchronous (one request is handled at a time)
+ - forking (each request is handled by a new process)
+ - threading (each request is handled by a new thread)
+
+The classes in this module favor the server type that is simplest to
+write: a synchronous TCP/IP server. This is bad class design, but
+save some typing. (There's also the issue that a deep class hierarchy
+slows down method lookups.)
+
+There are five classes in an inheritance diagram, four of which represent
+synchronous servers of four types:
+
+ +------------+
+ | BaseServer |
+ +------------+
+ |
+ v
+ +-----------+ +------------------+
+ | TCPServer |------->| UnixStreamServer |
+ +-----------+ +------------------+
+ |
+ v
+ +-----------+ +--------------------+
+ | UDPServer |------->| UnixDatagramServer |
+ +-----------+ +--------------------+
+
+Note that UnixDatagramServer derives from UDPServer, not from
+UnixStreamServer -- the only difference between an IP and a Unix
+stream server is the address family, which is simply repeated in both
+unix server classes.
+
+Forking and threading versions of each type of server can be created
+using the ForkingMixIn and ThreadingMixIn mix-in classes. For
+instance, a threading UDP server class is created as follows:
+
+ class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass
+
+The Mix-in class must come first, since it overrides a method defined
+in UDPServer! Setting the various member variables also changes
+the behavior of the underlying server mechanism.
+
+To implement a service, you must derive a class from
+BaseRequestHandler and redefine its handle() method. You can then run
+various versions of the service by combining one of the server classes
+with your request handler class.
+
+The request handler class must be different for datagram or stream
+services. This can be hidden by using the request handler
+subclasses StreamRequestHandler or DatagramRequestHandler.
+
+Of course, you still have to use your head!
+
+For instance, it makes no sense to use a forking server if the service
+contains state in memory that can be modified by requests (since the
+modifications in the child process would never reach the initial state
+kept in the parent process and passed to each child). In this case,
+you can use a threading server, but you will probably have to use
+locks to avoid two requests that come in nearly simultaneous to apply
+conflicting changes to the server state.
+
+On the other hand, if you are building e.g. an HTTP server, where all
+data is stored externally (e.g. in the file system), a synchronous
+class will essentially render the service "deaf" while one request is
+being handled -- which may be for a very long time if a client is slow
+to read all the data it has requested. Here a threading or forking
+server is appropriate.
+
+In some cases, it may be appropriate to process part of a request
+synchronously, but to finish processing in a forked child depending on
+the request data. This can be implemented by using a synchronous
+server and doing an explicit fork in the request handler class
+handle() method.
+
+Another approach to handling multiple simultaneous requests in an
+environment that supports neither threads nor fork (or where these are
+too expensive or inappropriate for the service) is to maintain an
+explicit table of partially finished requests and to use select() to
+decide which request to work on next (or whether to handle a new
+incoming request). This is particularly important for stream services
+where each client can potentially be connected for a long time (if
+threads or subprocesses cannot be used).
+
+Future work:
+- Standard classes for Sun RPC (which uses either UDP or TCP)
+- Standard mix-in classes to implement various authentication
+ and encryption schemes
+- Standard framework for select-based multiplexing
+
+XXX Open problems:
+- What to do with out-of-band data?
+
+BaseServer:
+- split generic "request" functionality out into BaseServer class.
+ Copyright (C) 2000 Luke Kenneth Casson Leighton
+
+ example: read entries from a SQL database (requires overriding
+ get_request() to return a table entry from the database).
+ entry is processed by a RequestHandlerClass.
+
+"""
+
+# Author of the BaseServer patch: Luke Kenneth Casson Leighton
+
+# XXX Warning!
+# There is a test suite for this module, but it cannot be run by the
+# standard regression test.
+# To run it manually, run Lib/test/test_socketserver.py.
+
+from __future__ import (absolute_import, print_function)
+
+__version__ = "0.4"
+
+
+import socket
+import select
+import sys
+import os
+import errno
+try:
+ import threading
+except ImportError:
+ import dummy_threading as threading
+
+__all__ = ["TCPServer","UDPServer","ForkingUDPServer","ForkingTCPServer",
+ "ThreadingUDPServer","ThreadingTCPServer","BaseRequestHandler",
+ "StreamRequestHandler","DatagramRequestHandler",
+ "ThreadingMixIn", "ForkingMixIn"]
+if hasattr(socket, "AF_UNIX"):
+ __all__.extend(["UnixStreamServer","UnixDatagramServer",
+ "ThreadingUnixStreamServer",
+ "ThreadingUnixDatagramServer"])
+
+def _eintr_retry(func, *args):
+ """restart a system call interrupted by EINTR"""
+ while True:
+ try:
+ return func(*args)
+ except OSError as e:
+ if e.errno != errno.EINTR:
+ raise
+
+class BaseServer(object):
+
+ """Base class for server classes.
+
+ Methods for the caller:
+
+ - __init__(server_address, RequestHandlerClass)
+ - serve_forever(poll_interval=0.5)
+ - shutdown()
+ - handle_request() # if you do not use serve_forever()
+ - fileno() -> int # for select()
+
+ Methods that may be overridden:
+
+ - server_bind()
+ - server_activate()
+ - get_request() -> request, client_address
+ - handle_timeout()
+ - verify_request(request, client_address)
+ - server_close()
+ - process_request(request, client_address)
+ - shutdown_request(request)
+ - close_request(request)
+ - service_actions()
+ - handle_error()
+
+ Methods for derived classes:
+
+ - finish_request(request, client_address)
+
+ Class variables that may be overridden by derived classes or
+ instances:
+
+ - timeout
+ - address_family
+ - socket_type
+ - allow_reuse_address
+
+ Instance variables:
+
+ - RequestHandlerClass
+ - socket
+
+ """
+
+ timeout = None
+
+ def __init__(self, server_address, RequestHandlerClass):
+ """Constructor. May be extended, do not override."""
+ self.server_address = server_address
+ self.RequestHandlerClass = RequestHandlerClass
+ self.__is_shut_down = threading.Event()
+ self.__shutdown_request = False
+
+ def server_activate(self):
+ """Called by constructor to activate the server.
+
+ May be overridden.
+
+ """
+ pass
+
+ def serve_forever(self, poll_interval=0.5):
+ """Handle one request at a time until shutdown.
+
+ Polls for shutdown every poll_interval seconds. Ignores
+ self.timeout. If you need to do periodic tasks, do them in
+ another thread.
+ """
+ self.__is_shut_down.clear()
+ try:
+ while not self.__shutdown_request:
+ # XXX: Consider using another file descriptor or
+ # connecting to the socket to wake this up instead of
+ # polling. Polling reduces our responsiveness to a
+ # shutdown request and wastes cpu at all other times.
+ r, w, e = _eintr_retry(select.select, [self], [], [],
+ poll_interval)
+ if self in r:
+ self._handle_request_noblock()
+
+ self.service_actions()
+ finally:
+ self.__shutdown_request = False
+ self.__is_shut_down.set()
+
+ def shutdown(self):
+ """Stops the serve_forever loop.
+
+ Blocks until the loop has finished. This must be called while
+ serve_forever() is running in another thread, or it will
+ deadlock.
+ """
+ self.__shutdown_request = True
+ self.__is_shut_down.wait()
+
+ def service_actions(self):
+ """Called by the serve_forever() loop.
+
+ May be overridden by a subclass / Mixin to implement any code that
+ needs to be run during the loop.
+ """
+ pass
+
+ # The distinction between handling, getting, processing and
+ # finishing a request is fairly arbitrary. Remember:
+ #
+ # - handle_request() is the top-level call. It calls
+ # select, get_request(), verify_request() and process_request()
+ # - get_request() is different for stream or datagram sockets
+ # - process_request() is the place that may fork a new process
+ # or create a new thread to finish the request
+ # - finish_request() instantiates the request handler class;
+ # this constructor will handle the request all by itself
+
+ def handle_request(self):
+ """Handle one request, possibly blocking.
+
+ Respects self.timeout.
+ """
+ # Support people who used socket.settimeout() to escape
+ # handle_request before self.timeout was available.
+ timeout = self.socket.gettimeout()
+ if timeout is None:
+ timeout = self.timeout
+ elif self.timeout is not None:
+ timeout = min(timeout, self.timeout)
+ fd_sets = _eintr_retry(select.select, [self], [], [], timeout)
+ if not fd_sets[0]:
+ self.handle_timeout()
+ return
+ self._handle_request_noblock()
+
+ def _handle_request_noblock(self):
+ """Handle one request, without blocking.
+
+ I assume that select.select has returned that the socket is
+ readable before this function was called, so there should be
+ no risk of blocking in get_request().
+ """
+ try:
+ request, client_address = self.get_request()
+ except socket.error:
+ return
+ if self.verify_request(request, client_address):
+ try:
+ self.process_request(request, client_address)
+ except:
+ self.handle_error(request, client_address)
+ self.shutdown_request(request)
+
+ def handle_timeout(self):
+ """Called if no new request arrives within self.timeout.
+
+ Overridden by ForkingMixIn.
+ """
+ pass
+
+ def verify_request(self, request, client_address):
+ """Verify the request. May be overridden.
+
+ Return True if we should proceed with this request.
+
+ """
+ return True
+
+ def process_request(self, request, client_address):
+ """Call finish_request.
+
+ Overridden by ForkingMixIn and ThreadingMixIn.
+
+ """
+ self.finish_request(request, client_address)
+ self.shutdown_request(request)
+
+ def server_close(self):
+ """Called to clean-up the server.
+
+ May be overridden.
+
+ """
+ pass
+
+ def finish_request(self, request, client_address):
+ """Finish one request by instantiating RequestHandlerClass."""
+ self.RequestHandlerClass(request, client_address, self)
+
+ def shutdown_request(self, request):
+ """Called to shutdown and close an individual request."""
+ self.close_request(request)
+
+ def close_request(self, request):
+ """Called to clean up an individual request."""
+ pass
+
+ def handle_error(self, request, client_address):
+ """Handle an error gracefully. May be overridden.
+
+ The default is to print a traceback and continue.
+
+ """
+ print('-'*40)
+ print('Exception happened during processing of request from', end=' ')
+ print(client_address)
+ import traceback
+ traceback.print_exc() # XXX But this goes to stderr!
+ print('-'*40)
+
+
+class TCPServer(BaseServer):
+
+ """Base class for various socket-based server classes.
+
+ Defaults to synchronous IP stream (i.e., TCP).
+
+ Methods for the caller:
+
+ - __init__(server_address, RequestHandlerClass, bind_and_activate=True)
+ - serve_forever(poll_interval=0.5)
+ - shutdown()
+ - handle_request() # if you don't use serve_forever()
+ - fileno() -> int # for select()
+
+ Methods that may be overridden:
+
+ - server_bind()
+ - server_activate()
+ - get_request() -> request, client_address
+ - handle_timeout()
+ - verify_request(request, client_address)
+ - process_request(request, client_address)
+ - shutdown_request(request)
+ - close_request(request)
+ - handle_error()
+
+ Methods for derived classes:
+
+ - finish_request(request, client_address)
+
+ Class variables that may be overridden by derived classes or
+ instances:
+
+ - timeout
+ - address_family
+ - socket_type
+ - request_queue_size (only for stream sockets)
+ - allow_reuse_address
+
+ Instance variables:
+
+ - server_address
+ - RequestHandlerClass
+ - socket
+
+ """
+
+ address_family = socket.AF_INET
+
+ socket_type = socket.SOCK_STREAM
+
+ request_queue_size = 5
+
+ allow_reuse_address = False
+
+ def __init__(self, server_address, RequestHandlerClass, bind_and_activate=True):
+ """Constructor. May be extended, do not override."""
+ BaseServer.__init__(self, server_address, RequestHandlerClass)
+ self.socket = socket.socket(self.address_family,
+ self.socket_type)
+ if bind_and_activate:
+ self.server_bind()
+ self.server_activate()
+
+ def server_bind(self):
+ """Called by constructor to bind the socket.
+
+ May be overridden.
+
+ """
+ if self.allow_reuse_address:
+ self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ self.socket.bind(self.server_address)
+ self.server_address = self.socket.getsockname()
+
+ def server_activate(self):
+ """Called by constructor to activate the server.
+
+ May be overridden.
+
+ """
+ self.socket.listen(self.request_queue_size)
+
+ def server_close(self):
+ """Called to clean-up the server.
+
+ May be overridden.
+
+ """
+ self.socket.close()
+
+ def fileno(self):
+ """Return socket file number.
+
+ Interface required by select().
+
+ """
+ return self.socket.fileno()
+
+ def get_request(self):
+ """Get the request and client address from the socket.
+
+ May be overridden.
+
+ """
+ return self.socket.accept()
+
+ def shutdown_request(self, request):
+ """Called to shutdown and close an individual request."""
+ try:
+ #explicitly shutdown. socket.close() merely releases
+ #the socket and waits for GC to perform the actual close.
+ request.shutdown(socket.SHUT_WR)
+ except socket.error:
+ pass #some platforms may raise ENOTCONN here
+ self.close_request(request)
+
+ def close_request(self, request):
+ """Called to clean up an individual request."""
+ request.close()
+
+
+class UDPServer(TCPServer):
+
+ """UDP server class."""
+
+ allow_reuse_address = False
+
+ socket_type = socket.SOCK_DGRAM
+
+ max_packet_size = 8192
+
+ def get_request(self):
+ data, client_addr = self.socket.recvfrom(self.max_packet_size)
+ return (data, self.socket), client_addr
+
+ def server_activate(self):
+ # No need to call listen() for UDP.
+ pass
+
+ def shutdown_request(self, request):
+ # No need to shutdown anything.
+ self.close_request(request)
+
+ def close_request(self, request):
+ # No need to close anything.
+ pass
+
+class ForkingMixIn(object):
+
+ """Mix-in class to handle each request in a new process."""
+
+ timeout = 300
+ active_children = None
+ max_children = 40
+
+ def collect_children(self):
+ """Internal routine to wait for children that have exited."""
+ if self.active_children is None: return
+ while len(self.active_children) >= self.max_children:
+ # XXX: This will wait for any child process, not just ones
+ # spawned by this library. This could confuse other
+ # libraries that expect to be able to wait for their own
+ # children.
+ try:
+ pid, status = os.waitpid(0, 0)
+ except os.error:
+ pid = None
+ if pid not in self.active_children: continue
+ self.active_children.remove(pid)
+
+ # XXX: This loop runs more system calls than it ought
+ # to. There should be a way to put the active_children into a
+ # process group and then use os.waitpid(-pgid) to wait for any
+ # of that set, but I couldn't find a way to allocate pgids
+ # that couldn't collide.
+ for child in self.active_children:
+ try:
+ pid, status = os.waitpid(child, os.WNOHANG)
+ except os.error:
+ pid = None
+ if not pid: continue
+ try:
+ self.active_children.remove(pid)
+ except ValueError as e:
+ raise ValueError('%s. x=%d and list=%r' % (e.message, pid,
+ self.active_children))
+
+ def handle_timeout(self):
+ """Wait for zombies after self.timeout seconds of inactivity.
+
+ May be extended, do not override.
+ """
+ self.collect_children()
+
+ def service_actions(self):
+ """Collect the zombie child processes regularly in the ForkingMixIn.
+
+ service_actions is called in the BaseServer's serve_forver loop.
+ """
+ self.collect_children()
+
+ def process_request(self, request, client_address):
+ """Fork a new subprocess to process the request."""
+ pid = os.fork()
+ if pid:
+ # Parent process
+ if self.active_children is None:
+ self.active_children = []
+ self.active_children.append(pid)
+ self.close_request(request)
+ return
+ else:
+ # Child process.
+ # This must never return, hence os._exit()!
+ try:
+ self.finish_request(request, client_address)
+ self.shutdown_request(request)
+ os._exit(0)
+ except:
+ try:
+ self.handle_error(request, client_address)
+ self.shutdown_request(request)
+ finally:
+ os._exit(1)
+
+
+class ThreadingMixIn(object):
+ """Mix-in class to handle each request in a new thread."""
+
+ # Decides how threads will act upon termination of the
+ # main process
+ daemon_threads = False
+
+ def process_request_thread(self, request, client_address):
+ """Same as in BaseServer but as a thread.
+
+ In addition, exception handling is done here.
+
+ """
+ try:
+ self.finish_request(request, client_address)
+ self.shutdown_request(request)
+ except:
+ self.handle_error(request, client_address)
+ self.shutdown_request(request)
+
+ def process_request(self, request, client_address):
+ """Start a new thread to process the request."""
+ t = threading.Thread(target = self.process_request_thread,
+ args = (request, client_address))
+ t.daemon = self.daemon_threads
+ t.start()
+
+
+class ForkingUDPServer(ForkingMixIn, UDPServer): pass
+class ForkingTCPServer(ForkingMixIn, TCPServer): pass
+
+class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass
+class ThreadingTCPServer(ThreadingMixIn, TCPServer): pass
+
+if hasattr(socket, 'AF_UNIX'):
+
+ class UnixStreamServer(TCPServer):
+ address_family = socket.AF_UNIX
+
+ class UnixDatagramServer(UDPServer):
+ address_family = socket.AF_UNIX
+
+ class ThreadingUnixStreamServer(ThreadingMixIn, UnixStreamServer): pass
+
+ class ThreadingUnixDatagramServer(ThreadingMixIn, UnixDatagramServer): pass
+
+class BaseRequestHandler(object):
+
+ """Base class for request handler classes.
+
+ This class is instantiated for each request to be handled. The
+ constructor sets the instance variables request, client_address
+ and server, and then calls the handle() method. To implement a
+ specific service, all you need to do is to derive a class which
+ defines a handle() method.
+
+ The handle() method can find the request as self.request, the
+ client address as self.client_address, and the server (in case it
+ needs access to per-server information) as self.server. Since a
+ separate instance is created for each request, the handle() method
+ can define arbitrary other instance variariables.
+
+ """
+
+ def __init__(self, request, client_address, server):
+ self.request = request
+ self.client_address = client_address
+ self.server = server
+ self.setup()
+ try:
+ self.handle()
+ finally:
+ self.finish()
+
+ def setup(self):
+ pass
+
+ def handle(self):
+ pass
+
+ def finish(self):
+ pass
+
+
+# The following two classes make it possible to use the same service
+# class for stream or datagram servers.
+# Each class sets up these instance variables:
+# - rfile: a file object from which receives the request is read
+# - wfile: a file object to which the reply is written
+# When the handle() method returns, wfile is flushed properly
+
+
+class StreamRequestHandler(BaseRequestHandler):
+
+ """Define self.rfile and self.wfile for stream sockets."""
+
+ # Default buffer sizes for rfile, wfile.
+ # We default rfile to buffered because otherwise it could be
+ # really slow for large data (a getc() call per byte); we make
+ # wfile unbuffered because (a) often after a write() we want to
+ # read and we need to flush the line; (b) big writes to unbuffered
+ # files are typically optimized by stdio even when big reads
+ # aren't.
+ rbufsize = -1
+ wbufsize = 0
+
+ # A timeout to apply to the request socket, if not None.
+ timeout = None
+
+ # Disable nagle algorithm for this socket, if True.
+ # Use only when wbufsize != 0, to avoid small packets.
+ disable_nagle_algorithm = False
+
+ def setup(self):
+ self.connection = self.request
+ if self.timeout is not None:
+ self.connection.settimeout(self.timeout)
+ if self.disable_nagle_algorithm:
+ self.connection.setsockopt(socket.IPPROTO_TCP,
+ socket.TCP_NODELAY, True)
+ self.rfile = self.connection.makefile('rb', self.rbufsize)
+ self.wfile = self.connection.makefile('wb', self.wbufsize)
+
+ def finish(self):
+ if not self.wfile.closed:
+ try:
+ self.wfile.flush()
+ except socket.error:
+ # An final socket error may have occurred here, such as
+ # the local error ECONNABORTED.
+ pass
+ self.wfile.close()
+ self.rfile.close()
+
+
+class DatagramRequestHandler(BaseRequestHandler):
+
+ # XXX Regrettably, I cannot get this working on Linux;
+ # s.recvfrom() doesn't return a meaningful client address.
+
+ """Define self.rfile and self.wfile for datagram sockets."""
+
+ def setup(self):
+ from io import BytesIO
+ self.packet, self.socket = self.request
+ self.rfile = BytesIO(self.packet)
+ self.wfile = BytesIO()
+
+ def finish(self):
+ self.socket.sendto(self.wfile.getvalue(), self.client_address)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/__init__.py
new file mode 100644
index 0000000..0bba5e6
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/__init__.py
@@ -0,0 +1,9 @@
+"""
+test package backported for python-future.
+
+Its primary purpose is to allow use of "import test.support" for running
+the Python standard library unit tests using the new Python 3 stdlib
+import location.
+
+Python 3 renamed test.test_support to test.support.
+"""
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/badcert.pem b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/badcert.pem
new file mode 100644
index 0000000..c419146
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/badcert.pem
@@ -0,0 +1,36 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXwIBAAKBgQC8ddrhm+LutBvjYcQlnH21PPIseJ1JVG2HMmN2CmZk2YukO+9L
+opdJhTvbGfEj0DQs1IE8M+kTUyOmuKfVrFMKwtVeCJphrAnhoz7TYOuLBSqt7lVH
+fhi/VwovESJlaBOp+WMnfhcduPEYHYx/6cnVapIkZnLt30zu2um+DzA9jQIDAQAB
+AoGBAK0FZpaKj6WnJZN0RqhhK+ggtBWwBnc0U/ozgKz2j1s3fsShYeiGtW6CK5nU
+D1dZ5wzhbGThI7LiOXDvRucc9n7vUgi0alqPQ/PFodPxAN/eEYkmXQ7W2k7zwsDA
+IUK0KUhktQbLu8qF/m8qM86ba9y9/9YkXuQbZ3COl5ahTZrhAkEA301P08RKv3KM
+oXnGU2UHTuJ1MAD2hOrPxjD4/wxA/39EWG9bZczbJyggB4RHu0I3NOSFjAm3HQm0
+ANOu5QK9owJBANgOeLfNNcF4pp+UikRFqxk5hULqRAWzVxVrWe85FlPm0VVmHbb/
+loif7mqjU8o1jTd/LM7RD9f2usZyE2psaw8CQQCNLhkpX3KO5kKJmS9N7JMZSc4j
+oog58yeYO8BBqKKzpug0LXuQultYv2K4veaIO04iL9VLe5z9S/Q1jaCHBBuXAkEA
+z8gjGoi1AOp6PBBLZNsncCvcV/0aC+1se4HxTNo2+duKSDnbq+ljqOM+E7odU+Nq
+ewvIWOG//e8fssd0mq3HywJBAJ8l/c8GVmrpFTx8r/nZ2Pyyjt3dH1widooDXYSV
+q6Gbf41Llo5sYAtmxdndTLASuHKecacTgZVhy0FryZpLKrU=
+-----END RSA PRIVATE KEY-----
+-----BEGIN CERTIFICATE-----
+Just bad cert data
+-----END CERTIFICATE-----
+-----BEGIN RSA PRIVATE KEY-----
+MIICXwIBAAKBgQC8ddrhm+LutBvjYcQlnH21PPIseJ1JVG2HMmN2CmZk2YukO+9L
+opdJhTvbGfEj0DQs1IE8M+kTUyOmuKfVrFMKwtVeCJphrAnhoz7TYOuLBSqt7lVH
+fhi/VwovESJlaBOp+WMnfhcduPEYHYx/6cnVapIkZnLt30zu2um+DzA9jQIDAQAB
+AoGBAK0FZpaKj6WnJZN0RqhhK+ggtBWwBnc0U/ozgKz2j1s3fsShYeiGtW6CK5nU
+D1dZ5wzhbGThI7LiOXDvRucc9n7vUgi0alqPQ/PFodPxAN/eEYkmXQ7W2k7zwsDA
+IUK0KUhktQbLu8qF/m8qM86ba9y9/9YkXuQbZ3COl5ahTZrhAkEA301P08RKv3KM
+oXnGU2UHTuJ1MAD2hOrPxjD4/wxA/39EWG9bZczbJyggB4RHu0I3NOSFjAm3HQm0
+ANOu5QK9owJBANgOeLfNNcF4pp+UikRFqxk5hULqRAWzVxVrWe85FlPm0VVmHbb/
+loif7mqjU8o1jTd/LM7RD9f2usZyE2psaw8CQQCNLhkpX3KO5kKJmS9N7JMZSc4j
+oog58yeYO8BBqKKzpug0LXuQultYv2K4veaIO04iL9VLe5z9S/Q1jaCHBBuXAkEA
+z8gjGoi1AOp6PBBLZNsncCvcV/0aC+1se4HxTNo2+duKSDnbq+ljqOM+E7odU+Nq
+ewvIWOG//e8fssd0mq3HywJBAJ8l/c8GVmrpFTx8r/nZ2Pyyjt3dH1widooDXYSV
+q6Gbf41Llo5sYAtmxdndTLASuHKecacTgZVhy0FryZpLKrU=
+-----END RSA PRIVATE KEY-----
+-----BEGIN CERTIFICATE-----
+Just bad cert data
+-----END CERTIFICATE-----
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/badkey.pem b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/badkey.pem
new file mode 100644
index 0000000..1c8a955
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/badkey.pem
@@ -0,0 +1,40 @@
+-----BEGIN RSA PRIVATE KEY-----
+Bad Key, though the cert should be OK
+-----END RSA PRIVATE KEY-----
+-----BEGIN CERTIFICATE-----
+MIICpzCCAhCgAwIBAgIJAP+qStv1cIGNMA0GCSqGSIb3DQEBBQUAMIGJMQswCQYD
+VQQGEwJVUzERMA8GA1UECBMIRGVsYXdhcmUxEzARBgNVBAcTCldpbG1pbmd0b24x
+IzAhBgNVBAoTGlB5dGhvbiBTb2Z0d2FyZSBGb3VuZGF0aW9uMQwwCgYDVQQLEwNT
+U0wxHzAdBgNVBAMTFnNvbWVtYWNoaW5lLnB5dGhvbi5vcmcwHhcNMDcwODI3MTY1
+NDUwWhcNMTMwMjE2MTY1NDUwWjCBiTELMAkGA1UEBhMCVVMxETAPBgNVBAgTCERl
+bGF3YXJlMRMwEQYDVQQHEwpXaWxtaW5ndG9uMSMwIQYDVQQKExpQeXRob24gU29m
+dHdhcmUgRm91bmRhdGlvbjEMMAoGA1UECxMDU1NMMR8wHQYDVQQDExZzb21lbWFj
+aGluZS5weXRob24ub3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8ddrh
+m+LutBvjYcQlnH21PPIseJ1JVG2HMmN2CmZk2YukO+9LopdJhTvbGfEj0DQs1IE8
+M+kTUyOmuKfVrFMKwtVeCJphrAnhoz7TYOuLBSqt7lVHfhi/VwovESJlaBOp+WMn
+fhcduPEYHYx/6cnVapIkZnLt30zu2um+DzA9jQIDAQABoxUwEzARBglghkgBhvhC
+AQEEBAMCBkAwDQYJKoZIhvcNAQEFBQADgYEAF4Q5BVqmCOLv1n8je/Jw9K669VXb
+08hyGzQhkemEBYQd6fzQ9A/1ZzHkJKb1P6yreOLSEh4KcxYPyrLRC1ll8nr5OlCx
+CMhKkTnR6qBsdNV0XtdU2+N25hqW+Ma4ZeqsN/iiJVCGNOZGnvQuvCAGWF8+J/f/
+iHkC6gGdBJhogs4=
+-----END CERTIFICATE-----
+-----BEGIN RSA PRIVATE KEY-----
+Bad Key, though the cert should be OK
+-----END RSA PRIVATE KEY-----
+-----BEGIN CERTIFICATE-----
+MIICpzCCAhCgAwIBAgIJAP+qStv1cIGNMA0GCSqGSIb3DQEBBQUAMIGJMQswCQYD
+VQQGEwJVUzERMA8GA1UECBMIRGVsYXdhcmUxEzARBgNVBAcTCldpbG1pbmd0b24x
+IzAhBgNVBAoTGlB5dGhvbiBTb2Z0d2FyZSBGb3VuZGF0aW9uMQwwCgYDVQQLEwNT
+U0wxHzAdBgNVBAMTFnNvbWVtYWNoaW5lLnB5dGhvbi5vcmcwHhcNMDcwODI3MTY1
+NDUwWhcNMTMwMjE2MTY1NDUwWjCBiTELMAkGA1UEBhMCVVMxETAPBgNVBAgTCERl
+bGF3YXJlMRMwEQYDVQQHEwpXaWxtaW5ndG9uMSMwIQYDVQQKExpQeXRob24gU29m
+dHdhcmUgRm91bmRhdGlvbjEMMAoGA1UECxMDU1NMMR8wHQYDVQQDExZzb21lbWFj
+aGluZS5weXRob24ub3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8ddrh
+m+LutBvjYcQlnH21PPIseJ1JVG2HMmN2CmZk2YukO+9LopdJhTvbGfEj0DQs1IE8
+M+kTUyOmuKfVrFMKwtVeCJphrAnhoz7TYOuLBSqt7lVHfhi/VwovESJlaBOp+WMn
+fhcduPEYHYx/6cnVapIkZnLt30zu2um+DzA9jQIDAQABoxUwEzARBglghkgBhvhC
+AQEEBAMCBkAwDQYJKoZIhvcNAQEFBQADgYEAF4Q5BVqmCOLv1n8je/Jw9K669VXb
+08hyGzQhkemEBYQd6fzQ9A/1ZzHkJKb1P6yreOLSEh4KcxYPyrLRC1ll8nr5OlCx
+CMhKkTnR6qBsdNV0XtdU2+N25hqW+Ma4ZeqsN/iiJVCGNOZGnvQuvCAGWF8+J/f/
+iHkC6gGdBJhogs4=
+-----END CERTIFICATE-----
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/dh512.pem b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/dh512.pem
new file mode 100644
index 0000000..200d16c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/dh512.pem
@@ -0,0 +1,9 @@
+-----BEGIN DH PARAMETERS-----
+MEYCQQD1Kv884bEpQBgRjXyEpwpy1obEAxnIByl6ypUM2Zafq9AKUJsCRtMIPWak
+XUGfnHy9iUsiGSa6q6Jew1XpKgVfAgEC
+-----END DH PARAMETERS-----
+
+These are the 512 bit DH parameters from "Assigned Number for SKIP Protocols"
+(http://www.skip-vpn.org/spec/numbers.html).
+See there for how they were generated.
+Note that g is not a generator, but this is not a problem since p is a safe prime.
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/https_svn_python_org_root.pem b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/https_svn_python_org_root.pem
new file mode 100644
index 0000000..e7dfc82
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/https_svn_python_org_root.pem
@@ -0,0 +1,41 @@
+-----BEGIN CERTIFICATE-----
+MIIHPTCCBSWgAwIBAgIBADANBgkqhkiG9w0BAQQFADB5MRAwDgYDVQQKEwdSb290
+IENBMR4wHAYDVQQLExVodHRwOi8vd3d3LmNhY2VydC5vcmcxIjAgBgNVBAMTGUNB
+IENlcnQgU2lnbmluZyBBdXRob3JpdHkxITAfBgkqhkiG9w0BCQEWEnN1cHBvcnRA
+Y2FjZXJ0Lm9yZzAeFw0wMzAzMzAxMjI5NDlaFw0zMzAzMjkxMjI5NDlaMHkxEDAO
+BgNVBAoTB1Jvb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEi
+MCAGA1UEAxMZQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJ
+ARYSc3VwcG9ydEBjYWNlcnQub3JnMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC
+CgKCAgEAziLA4kZ97DYoB1CW8qAzQIxL8TtmPzHlawI229Z89vGIj053NgVBlfkJ
+8BLPRoZzYLdufujAWGSuzbCtRRcMY/pnCujW0r8+55jE8Ez64AO7NV1sId6eINm6
+zWYyN3L69wj1x81YyY7nDl7qPv4coRQKFWyGhFtkZip6qUtTefWIonvuLwphK42y
+fk1WpRPs6tqSnqxEQR5YYGUFZvjARL3LlPdCfgv3ZWiYUQXw8wWRBB0bF4LsyFe7
+w2t6iPGwcswlWyCR7BYCEo8y6RcYSNDHBS4CMEK4JZwFaz+qOqfrU0j36NK2B5jc
+G8Y0f3/JHIJ6BVgrCFvzOKKrF11myZjXnhCLotLddJr3cQxyYN/Nb5gznZY0dj4k
+epKwDpUeb+agRThHqtdB7Uq3EvbXG4OKDy7YCbZZ16oE/9KTfWgu3YtLq1i6L43q
+laegw1SJpfvbi1EinbLDvhG+LJGGi5Z4rSDTii8aP8bQUWWHIbEZAWV/RRyH9XzQ
+QUxPKZgh/TMfdQwEUfoZd9vUFBzugcMd9Zi3aQaRIt0AUMyBMawSB3s42mhb5ivU
+fslfrejrckzzAeVLIL+aplfKkQABi6F1ITe1Yw1nPkZPcCBnzsXWWdsC4PDSy826
+YreQQejdIOQpvGQpQsgi3Hia/0PsmBsJUUtaWsJx8cTLc6nloQsCAwEAAaOCAc4w
+ggHKMB0GA1UdDgQWBBQWtTIb1Mfz4OaO873SsDrusjkY0TCBowYDVR0jBIGbMIGY
+gBQWtTIb1Mfz4OaO873SsDrusjkY0aF9pHsweTEQMA4GA1UEChMHUm9vdCBDQTEe
+MBwGA1UECxMVaHR0cDovL3d3dy5jYWNlcnQub3JnMSIwIAYDVQQDExlDQSBDZXJ0
+IFNpZ25pbmcgQXV0aG9yaXR5MSEwHwYJKoZIhvcNAQkBFhJzdXBwb3J0QGNhY2Vy
+dC5vcmeCAQAwDwYDVR0TAQH/BAUwAwEB/zAyBgNVHR8EKzApMCegJaAjhiFodHRw
+czovL3d3dy5jYWNlcnQub3JnL3Jldm9rZS5jcmwwMAYJYIZIAYb4QgEEBCMWIWh0
+dHBzOi8vd3d3LmNhY2VydC5vcmcvcmV2b2tlLmNybDA0BglghkgBhvhCAQgEJxYl
+aHR0cDovL3d3dy5jYWNlcnQub3JnL2luZGV4LnBocD9pZD0xMDBWBglghkgBhvhC
+AQ0ESRZHVG8gZ2V0IHlvdXIgb3duIGNlcnRpZmljYXRlIGZvciBGUkVFIGhlYWQg
+b3ZlciB0byBodHRwOi8vd3d3LmNhY2VydC5vcmcwDQYJKoZIhvcNAQEEBQADggIB
+ACjH7pyCArpcgBLKNQodgW+JapnM8mgPf6fhjViVPr3yBsOQWqy1YPaZQwGjiHCc
+nWKdpIevZ1gNMDY75q1I08t0AoZxPuIrA2jxNGJARjtT6ij0rPtmlVOKTV39O9lg
+18p5aTuxZZKmxoGCXJzN600BiqXfEVWqFcofN8CCmHBh22p8lqOOLlQ+TyGpkO/c
+gr/c6EWtTZBzCDyUZbAEmXZ/4rzCahWqlwQ3JNgelE5tDlG+1sSPypZt90Pf6DBl
+Jzt7u0NDY8RD97LsaMzhGY4i+5jhe1o+ATc7iwiwovOVThrLm82asduycPAtStvY
+sONvRUgzEv/+PDIqVPfE94rwiCPCR/5kenHA0R6mY7AHfqQv0wGP3J8rtsYIqQ+T
+SCX8Ev2fQtzzxD72V7DX3WnRBnc0CkvSyqD/HMaMyRa+xMwyN2hzXwj7UfdJUzYF
+CpUCTPJ5GhD22Dp1nPMd8aINcGeGG7MW9S/lpOt5hvk9C8JzC6WZrG/8Z7jlLwum
+GCSNe9FINSkYQKyTYOGWhlC0elnYjyELn8+CkcY7v2vcB5G5l1YjqrZslMZIBjzk
+zk6q5PYvCdxTby78dOs6Y5nCpqyJvKeyRKANihDjbPIky/qbn3BHLt4Ui9SyIAmW
+omTxJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD
+-----END CERTIFICATE-----
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/keycert.passwd.pem b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/keycert.passwd.pem
new file mode 100644
index 0000000..e905748
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/keycert.passwd.pem
@@ -0,0 +1,33 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: DES-EDE3-CBC,1A8D9D2A02EC698A
+
+kJYbfZ8L0sfe9Oty3gw0aloNnY5E8fegRfQLZlNoxTl6jNt0nIwI8kDJ36CZgR9c
+u3FDJm/KqrfUoz8vW+qEnWhSG7QPX2wWGPHd4K94Yz/FgrRzZ0DoK7XxXq9gOtVA
+AVGQhnz32p+6WhfGsCr9ArXEwRZrTk/FvzEPaU5fHcoSkrNVAGX8IpSVkSDwEDQr
+Gv17+cfk99UV1OCza6yKHoFkTtrC+PZU71LomBabivS2Oc4B9hYuSR2hF01wTHP+
+YlWNagZOOVtNz4oKK9x9eNQpmfQXQvPPTfusexKIbKfZrMvJoxcm1gfcZ0H/wK6P
+6wmXSG35qMOOztCZNtperjs1wzEBXznyK8QmLcAJBjkfarABJX9vBEzZV0OUKhy+
+noORFwHTllphbmydLhu6ehLUZMHPhzAS5UN7srtpSN81eerDMy0RMUAwA7/PofX1
+94Me85Q8jP0PC9ETdsJcPqLzAPETEYu0ELewKRcrdyWi+tlLFrpE5KT/s5ecbl9l
+7B61U4Kfd1PIXc/siINhU3A3bYK+845YyUArUOnKf1kEox7p1RpD7yFqVT04lRTo
+cibNKATBusXSuBrp2G6GNuhWEOSafWCKJQAzgCYIp6ZTV2khhMUGppc/2H3CF6cO
+zX0KtlPVZC7hLkB6HT8SxYUwF1zqWY7+/XPPdc37MeEZ87Q3UuZwqORLY+Z0hpgt
+L5JXBCoklZhCAaN2GqwFLXtGiRSRFGY7xXIhbDTlE65Wv1WGGgDLMKGE1gOz3yAo
+2jjG1+yAHJUdE69XTFHSqSkvaloA1W03LdMXZ9VuQJ/ySXCie6ABAQ==
+-----END RSA PRIVATE KEY-----
+-----BEGIN CERTIFICATE-----
+MIICVDCCAb2gAwIBAgIJANfHOBkZr8JOMA0GCSqGSIb3DQEBBQUAMF8xCzAJBgNV
+BAYTAlhZMRcwFQYDVQQHEw5DYXN0bGUgQW50aHJheDEjMCEGA1UEChMaUHl0aG9u
+IFNvZnR3YXJlIEZvdW5kYXRpb24xEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0xMDEw
+MDgyMzAxNTZaFw0yMDEwMDUyMzAxNTZaMF8xCzAJBgNVBAYTAlhZMRcwFQYDVQQH
+Ew5DYXN0bGUgQW50aHJheDEjMCEGA1UEChMaUHl0aG9uIFNvZnR3YXJlIEZvdW5k
+YXRpb24xEjAQBgNVBAMTCWxvY2FsaG9zdDCBnzANBgkqhkiG9w0BAQEFAAOBjQAw
+gYkCgYEA21vT5isq7F68amYuuNpSFlKDPrMUCa4YWYqZRt2OZ+/3NKaZ2xAiSwr7
+6MrQF70t5nLbSPpqE5+5VrS58SY+g/sXLiFd6AplH1wJZwh78DofbFYXUggktFMt
+pTyiX8jtP66bkcPkDADA089RI1TQR6Ca+n7HFa7c1fabVV6i3zkCAwEAAaMYMBYw
+FAYDVR0RBA0wC4IJbG9jYWxob3N0MA0GCSqGSIb3DQEBBQUAA4GBAHPctQBEQ4wd
+BJ6+JcpIraopLn8BGhbjNWj40mmRqWB/NAWF6M5ne7KpGAu7tLeG4hb1zLaldK8G
+lxy2GPSRF6LFS48dpEj2HbMv2nvv6xxalDMJ9+DicWgAKTQ6bcX2j3GUkCR0g/T1
+CRlNBAAlvhKzO7Clpf9l0YKBEfraJByX
+-----END CERTIFICATE-----
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/keycert.pem b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/keycert.pem
new file mode 100644
index 0000000..64318aa
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/keycert.pem
@@ -0,0 +1,31 @@
+-----BEGIN PRIVATE KEY-----
+MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBANtb0+YrKuxevGpm
+LrjaUhZSgz6zFAmuGFmKmUbdjmfv9zSmmdsQIksK++jK0Be9LeZy20j6ahOfuVa0
+ufEmPoP7Fy4hXegKZR9cCWcIe/A6H2xWF1IIJLRTLaU8ol/I7T+um5HD5AwAwNPP
+USNU0Eegmvp+xxWu3NX2m1Veot85AgMBAAECgYA3ZdZ673X0oexFlq7AAmrutkHt
+CL7LvwrpOiaBjhyTxTeSNWzvtQBkIU8DOI0bIazA4UreAFffwtvEuPmonDb3F+Iq
+SMAu42XcGyVZEl+gHlTPU9XRX7nTOXVt+MlRRRxL6t9GkGfUAXI3XxJDXW3c0vBK
+UL9xqD8cORXOfE06rQJBAP8mEX1ERkR64Ptsoe4281vjTlNfIbs7NMPkUnrn9N/Y
+BLhjNIfQ3HFZG8BTMLfX7kCS9D593DW5tV4Z9BP/c6cCQQDcFzCcVArNh2JSywOQ
+ZfTfRbJg/Z5Lt9Fkngv1meeGNPgIMLN8Sg679pAOOWmzdMO3V706rNPzSVMME7E5
+oPIfAkEA8pDddarP5tCvTTgUpmTFbakm0KoTZm2+FzHcnA4jRh+XNTjTOv98Y6Ik
+eO5d1ZnKXseWvkZncQgxfdnMqqpj5wJAcNq/RVne1DbYlwWchT2Si65MYmmJ8t+F
+0mcsULqjOnEMwf5e+ptq5LzwbyrHZYq5FNk7ocufPv/ZQrcSSC+cFwJBAKvOJByS
+x56qyGeZLOQlWS2JS3KJo59XuLFGqcbgN9Om9xFa41Yb4N9NvplFivsvZdw3m1Q/
+SPIXQuT8RMPDVNQ=
+-----END PRIVATE KEY-----
+-----BEGIN CERTIFICATE-----
+MIICVDCCAb2gAwIBAgIJANfHOBkZr8JOMA0GCSqGSIb3DQEBBQUAMF8xCzAJBgNV
+BAYTAlhZMRcwFQYDVQQHEw5DYXN0bGUgQW50aHJheDEjMCEGA1UEChMaUHl0aG9u
+IFNvZnR3YXJlIEZvdW5kYXRpb24xEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0xMDEw
+MDgyMzAxNTZaFw0yMDEwMDUyMzAxNTZaMF8xCzAJBgNVBAYTAlhZMRcwFQYDVQQH
+Ew5DYXN0bGUgQW50aHJheDEjMCEGA1UEChMaUHl0aG9uIFNvZnR3YXJlIEZvdW5k
+YXRpb24xEjAQBgNVBAMTCWxvY2FsaG9zdDCBnzANBgkqhkiG9w0BAQEFAAOBjQAw
+gYkCgYEA21vT5isq7F68amYuuNpSFlKDPrMUCa4YWYqZRt2OZ+/3NKaZ2xAiSwr7
+6MrQF70t5nLbSPpqE5+5VrS58SY+g/sXLiFd6AplH1wJZwh78DofbFYXUggktFMt
+pTyiX8jtP66bkcPkDADA089RI1TQR6Ca+n7HFa7c1fabVV6i3zkCAwEAAaMYMBYw
+FAYDVR0RBA0wC4IJbG9jYWxob3N0MA0GCSqGSIb3DQEBBQUAA4GBAHPctQBEQ4wd
+BJ6+JcpIraopLn8BGhbjNWj40mmRqWB/NAWF6M5ne7KpGAu7tLeG4hb1zLaldK8G
+lxy2GPSRF6LFS48dpEj2HbMv2nvv6xxalDMJ9+DicWgAKTQ6bcX2j3GUkCR0g/T1
+CRlNBAAlvhKzO7Clpf9l0YKBEfraJByX
+-----END CERTIFICATE-----
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/keycert2.pem b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/keycert2.pem
new file mode 100644
index 0000000..e8a9e08
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/keycert2.pem
@@ -0,0 +1,31 @@
+-----BEGIN PRIVATE KEY-----
+MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAJnsJZVrppL+W5I9
+zGQrrawWwE5QJpBK9nWw17mXrZ03R1cD9BamLGivVISbPlRlAVnZBEyh1ATpsB7d
+CUQ+WHEvALquvx4+Yw5l+fXeiYRjrLRBYZuVy8yNtXzU3iWcGObcYRkUdiXdOyP7
+sLF2YZHRvQZpzgDBKkrraeQ81w21AgMBAAECgYBEm7n07FMHWlE+0kT0sXNsLYfy
+YE+QKZnJw9WkaDN+zFEEPELkhZVt5BjsMraJr6v2fIEqF0gGGJPkbenffVq2B5dC
+lWUOxvJHufMK4sM3Cp6s/gOp3LP+QkzVnvJSfAyZU6l+4PGX5pLdUsXYjPxgzjzL
+S36tF7/2Uv1WePyLUQJBAMsPhYzUXOPRgmbhcJiqi9A9c3GO8kvSDYTCKt3VMnqz
+HBn6MQ4VQasCD1F+7jWTI0FU/3vdw8non/Fj8hhYqZcCQQDCDRdvmZqDiZnpMqDq
+L6ZSrLTVtMvZXZbgwForaAD9uHj51TME7+eYT7EG2YCgJTXJ4YvRJEnPNyskwdKt
+vTSTAkEAtaaN/vyemEJ82BIGStwONNw0ILsSr5cZ9tBHzqiA/tipY+e36HRFiXhP
+QcU9zXlxyWkDH8iz9DSAmE2jbfoqwwJANlMJ65E543cjIlitGcKLMnvtCCLcKpb7
+xSG0XJB6Lo11OKPJ66jp0gcFTSCY1Lx2CXVd+gfJrfwI1Pp562+bhwJBAJ9IfDPU
+R8OpO9v1SGd8x33Owm7uXOpB9d63/T70AD1QOXjKUC4eXYbt0WWfWuny/RNPRuyh
+w7DXSfUF+kPKolU=
+-----END PRIVATE KEY-----
+-----BEGIN CERTIFICATE-----
+MIICXTCCAcagAwIBAgIJAIO3upAG445fMA0GCSqGSIb3DQEBBQUAMGIxCzAJBgNV
+BAYTAlhZMRcwFQYDVQQHEw5DYXN0bGUgQW50aHJheDEjMCEGA1UEChMaUHl0aG9u
+IFNvZnR3YXJlIEZvdW5kYXRpb24xFTATBgNVBAMTDGZha2Vob3N0bmFtZTAeFw0x
+MDEwMDkxNTAxMDBaFw0yMDEwMDYxNTAxMDBaMGIxCzAJBgNVBAYTAlhZMRcwFQYD
+VQQHEw5DYXN0bGUgQW50aHJheDEjMCEGA1UEChMaUHl0aG9uIFNvZnR3YXJlIEZv
+dW5kYXRpb24xFTATBgNVBAMTDGZha2Vob3N0bmFtZTCBnzANBgkqhkiG9w0BAQEF
+AAOBjQAwgYkCgYEAmewllWumkv5bkj3MZCutrBbATlAmkEr2dbDXuZetnTdHVwP0
+FqYsaK9UhJs+VGUBWdkETKHUBOmwHt0JRD5YcS8Auq6/Hj5jDmX59d6JhGOstEFh
+m5XLzI21fNTeJZwY5txhGRR2Jd07I/uwsXZhkdG9BmnOAMEqSutp5DzXDbUCAwEA
+AaMbMBkwFwYDVR0RBBAwDoIMZmFrZWhvc3RuYW1lMA0GCSqGSIb3DQEBBQUAA4GB
+AH+iMClLLGSaKWgwXsmdVo4FhTZZHo8Uprrtg3N9FxEeE50btpDVQysgRt5ias3K
+m+bME9zbKwvbVWD5zZdjus4pDgzwF/iHyccL8JyYhxOvS/9zmvAtFXj/APIIbZFp
+IT75d9f88ScIGEtknZQejnrdhB64tYki/EqluiuKBqKD
+-----END CERTIFICATE-----
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/nokia.pem b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/nokia.pem
new file mode 100644
index 0000000..0d044df
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/nokia.pem
@@ -0,0 +1,31 @@
+# Certificate for projects.developer.nokia.com:443 (see issue 13034)
+-----BEGIN CERTIFICATE-----
+MIIFLDCCBBSgAwIBAgIQLubqdkCgdc7lAF9NfHlUmjANBgkqhkiG9w0BAQUFADCB
+vDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL
+ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTswOQYDVQQLEzJUZXJtcyBvZiB1c2Ug
+YXQgaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JwYSAoYykxMDE2MDQGA1UEAxMt
+VmVyaVNpZ24gQ2xhc3MgMyBJbnRlcm5hdGlvbmFsIFNlcnZlciBDQSAtIEczMB4X
+DTExMDkyMTAwMDAwMFoXDTEyMDkyMDIzNTk1OVowcTELMAkGA1UEBhMCRkkxDjAM
+BgNVBAgTBUVzcG9vMQ4wDAYDVQQHFAVFc3BvbzEOMAwGA1UEChQFTm9raWExCzAJ
+BgNVBAsUAkJJMSUwIwYDVQQDFBxwcm9qZWN0cy5kZXZlbG9wZXIubm9raWEuY29t
+MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCr92w1bpHYSYxUEx8N/8Iddda2
+lYi+aXNtQfV/l2Fw9Ykv3Ipw4nLeGTj18FFlAZgMdPRlgrzF/NNXGw/9l3/qKdow
+CypkQf8lLaxb9Ze1E/KKmkRJa48QTOqvo6GqKuTI6HCeGlG1RxDb8YSKcQWLiytn
+yj3Wp4MgRQO266xmMQIDAQABo4IB9jCCAfIwQQYDVR0RBDowOIIccHJvamVjdHMu
+ZGV2ZWxvcGVyLm5va2lhLmNvbYIYcHJvamVjdHMuZm9ydW0ubm9raWEuY29tMAkG
+A1UdEwQCMAAwCwYDVR0PBAQDAgWgMEEGA1UdHwQ6MDgwNqA0oDKGMGh0dHA6Ly9T
+VlJJbnRsLUczLWNybC52ZXJpc2lnbi5jb20vU1ZSSW50bEczLmNybDBEBgNVHSAE
+PTA7MDkGC2CGSAGG+EUBBxcDMCowKAYIKwYBBQUHAgEWHGh0dHBzOi8vd3d3LnZl
+cmlzaWduLmNvbS9ycGEwKAYDVR0lBCEwHwYJYIZIAYb4QgQBBggrBgEFBQcDAQYI
+KwYBBQUHAwIwcgYIKwYBBQUHAQEEZjBkMCQGCCsGAQUFBzABhhhodHRwOi8vb2Nz
+cC52ZXJpc2lnbi5jb20wPAYIKwYBBQUHMAKGMGh0dHA6Ly9TVlJJbnRsLUczLWFp
+YS52ZXJpc2lnbi5jb20vU1ZSSW50bEczLmNlcjBuBggrBgEFBQcBDARiMGChXqBc
+MFowWDBWFglpbWFnZS9naWYwITAfMAcGBSsOAwIaBBRLa7kolgYMu9BSOJsprEsH
+iyEFGDAmFiRodHRwOi8vbG9nby52ZXJpc2lnbi5jb20vdnNsb2dvMS5naWYwDQYJ
+KoZIhvcNAQEFBQADggEBACQuPyIJqXwUyFRWw9x5yDXgMW4zYFopQYOw/ItRY522
+O5BsySTh56BWS6mQB07XVfxmYUGAvRQDA5QHpmY8jIlNwSmN3s8RKo+fAtiNRlcL
+x/mWSfuMs3D/S6ev3D6+dpEMZtjrhOdctsarMKp8n/hPbwhAbg5hVjpkW5n8vz2y
+0KxvvkA1AxpLwpVv7OlK17ttzIHw8bp9HTlHBU5s8bKz4a565V/a5HI0CSEv/+0y
+ko4/ghTnZc1CkmUngKKeFMSah/mT/xAh8XnE2l1AazFa8UKuYki1e+ArHaGZc4ix
+UYOtiRphwfuYQhRZ7qX9q2MMkCMI65XNK/SaFrAbbG0=
+-----END CERTIFICATE-----
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/nullbytecert.pem b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/nullbytecert.pem
new file mode 100644
index 0000000..447186c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/nullbytecert.pem
@@ -0,0 +1,90 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 0 (0x0)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=US, ST=Oregon, L=Beaverton, O=Python Software Foundation, OU=Python Core Development, CN=null.python.org\x00example.org/emailAddress=python-dev@python.org
+ Validity
+ Not Before: Aug 7 13:11:52 2013 GMT
+ Not After : Aug 7 13:12:52 2013 GMT
+ Subject: C=US, ST=Oregon, L=Beaverton, O=Python Software Foundation, OU=Python Core Development, CN=null.python.org\x00example.org/emailAddress=python-dev@python.org
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ Public-Key: (2048 bit)
+ Modulus:
+ 00:b5:ea:ed:c9:fb:46:7d:6f:3b:76:80:dd:3a:f3:
+ 03:94:0b:a7:a6:db:ec:1d:df:ff:23:74:08:9d:97:
+ 16:3f:a3:a4:7b:3e:1b:0e:96:59:25:03:a7:26:e2:
+ 88:a9:cf:79:cd:f7:04:56:b0:ab:79:32:6e:59:c1:
+ 32:30:54:eb:58:a8:cb:91:f0:42:a5:64:27:cb:d4:
+ 56:31:88:52:ad:cf:bd:7f:f0:06:64:1f:cc:27:b8:
+ a3:8b:8c:f3:d8:29:1f:25:0b:f5:46:06:1b:ca:02:
+ 45:ad:7b:76:0a:9c:bf:bb:b9:ae:0d:16:ab:60:75:
+ ae:06:3e:9c:7c:31:dc:92:2f:29:1a:e0:4b:0c:91:
+ 90:6c:e9:37:c5:90:d7:2a:d7:97:15:a3:80:8f:5d:
+ 7b:49:8f:54:30:d4:97:2c:1c:5b:37:b5:ab:69:30:
+ 68:43:d3:33:78:4b:02:60:f5:3c:44:80:a1:8f:e7:
+ f0:0f:d1:5e:87:9e:46:cf:62:fc:f9:bf:0c:65:12:
+ f1:93:c8:35:79:3f:c8:ec:ec:47:f5:ef:be:44:d5:
+ ae:82:1e:2d:9a:9f:98:5a:67:65:e1:74:70:7c:cb:
+ d3:c2:ce:0e:45:49:27:dc:e3:2d:d4:fb:48:0e:2f:
+ 9e:77:b8:14:46:c0:c4:36:ca:02:ae:6a:91:8c:da:
+ 2f:85
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Basic Constraints: critical
+ CA:FALSE
+ X509v3 Subject Key Identifier:
+ 88:5A:55:C0:52:FF:61:CD:52:A3:35:0F:EA:5A:9C:24:38:22:F7:5C
+ X509v3 Key Usage:
+ Digital Signature, Non Repudiation, Key Encipherment
+ X509v3 Subject Alternative Name:
+ *************************************************************
+ WARNING: The values for DNS, email and URI are WRONG. OpenSSL
+ doesn't print the text after a NULL byte.
+ *************************************************************
+ DNS:altnull.python.org, email:null@python.org, URI:http://null.python.org, IP Address:192.0.2.1, IP Address:2001:DB8:0:0:0:0:0:1
+ Signature Algorithm: sha1WithRSAEncryption
+ ac:4f:45:ef:7d:49:a8:21:70:8e:88:59:3e:d4:36:42:70:f5:
+ a3:bd:8b:d7:a8:d0:58:f6:31:4a:b1:a4:a6:dd:6f:d9:e8:44:
+ 3c:b6:0a:71:d6:7f:b1:08:61:9d:60:ce:75:cf:77:0c:d2:37:
+ 86:02:8d:5e:5d:f9:0f:71:b4:16:a8:c1:3d:23:1c:f1:11:b3:
+ 56:6e:ca:d0:8d:34:94:e6:87:2a:99:f2:ae:ae:cc:c2:e8:86:
+ de:08:a8:7f:c5:05:fa:6f:81:a7:82:e6:d0:53:9d:34:f4:ac:
+ 3e:40:fe:89:57:7a:29:a4:91:7e:0b:c6:51:31:e5:10:2f:a4:
+ 60:76:cd:95:51:1a:be:8b:a1:b0:fd:ad:52:bd:d7:1b:87:60:
+ d2:31:c7:17:c4:18:4f:2d:08:25:a3:a7:4f:b7:92:ca:e2:f5:
+ 25:f1:54:75:81:9d:b3:3d:61:a2:f7:da:ed:e1:c6:6f:2c:60:
+ 1f:d8:6f:c5:92:05:ab:c9:09:62:49:a9:14:ad:55:11:cc:d6:
+ 4a:19:94:99:97:37:1d:81:5f:8b:cf:a3:a8:96:44:51:08:3d:
+ 0b:05:65:12:eb:b6:70:80:88:48:72:4f:c6:c2:da:cf:cd:8e:
+ 5b:ba:97:2f:60:b4:96:56:49:5e:3a:43:76:63:04:be:2a:f6:
+ c1:ca:a9:94
+-----BEGIN CERTIFICATE-----
+MIIE2DCCA8CgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBxTELMAkGA1UEBhMCVVMx
+DzANBgNVBAgMBk9yZWdvbjESMBAGA1UEBwwJQmVhdmVydG9uMSMwIQYDVQQKDBpQ
+eXRob24gU29mdHdhcmUgRm91bmRhdGlvbjEgMB4GA1UECwwXUHl0aG9uIENvcmUg
+RGV2ZWxvcG1lbnQxJDAiBgNVBAMMG251bGwucHl0aG9uLm9yZwBleGFtcGxlLm9y
+ZzEkMCIGCSqGSIb3DQEJARYVcHl0aG9uLWRldkBweXRob24ub3JnMB4XDTEzMDgw
+NzEzMTE1MloXDTEzMDgwNzEzMTI1MlowgcUxCzAJBgNVBAYTAlVTMQ8wDQYDVQQI
+DAZPcmVnb24xEjAQBgNVBAcMCUJlYXZlcnRvbjEjMCEGA1UECgwaUHl0aG9uIFNv
+ZnR3YXJlIEZvdW5kYXRpb24xIDAeBgNVBAsMF1B5dGhvbiBDb3JlIERldmVsb3Bt
+ZW50MSQwIgYDVQQDDBtudWxsLnB5dGhvbi5vcmcAZXhhbXBsZS5vcmcxJDAiBgkq
+hkiG9w0BCQEWFXB5dGhvbi1kZXZAcHl0aG9uLm9yZzCCASIwDQYJKoZIhvcNAQEB
+BQADggEPADCCAQoCggEBALXq7cn7Rn1vO3aA3TrzA5QLp6bb7B3f/yN0CJ2XFj+j
+pHs+Gw6WWSUDpybiiKnPec33BFawq3kyblnBMjBU61ioy5HwQqVkJ8vUVjGIUq3P
+vX/wBmQfzCe4o4uM89gpHyUL9UYGG8oCRa17dgqcv7u5rg0Wq2B1rgY+nHwx3JIv
+KRrgSwyRkGzpN8WQ1yrXlxWjgI9de0mPVDDUlywcWze1q2kwaEPTM3hLAmD1PESA
+oY/n8A/RXoeeRs9i/Pm/DGUS8ZPINXk/yOzsR/XvvkTVroIeLZqfmFpnZeF0cHzL
+08LODkVJJ9zjLdT7SA4vnne4FEbAxDbKAq5qkYzaL4UCAwEAAaOB0DCBzTAMBgNV
+HRMBAf8EAjAAMB0GA1UdDgQWBBSIWlXAUv9hzVKjNQ/qWpwkOCL3XDALBgNVHQ8E
+BAMCBeAwgZAGA1UdEQSBiDCBhYIeYWx0bnVsbC5weXRob24ub3JnAGV4YW1wbGUu
+Y29tgSBudWxsQHB5dGhvbi5vcmcAdXNlckBleGFtcGxlLm9yZ4YpaHR0cDovL251
+bGwucHl0aG9uLm9yZwBodHRwOi8vZXhhbXBsZS5vcmeHBMAAAgGHECABDbgAAAAA
+AAAAAAAAAAEwDQYJKoZIhvcNAQEFBQADggEBAKxPRe99SaghcI6IWT7UNkJw9aO9
+i9eo0Fj2MUqxpKbdb9noRDy2CnHWf7EIYZ1gznXPdwzSN4YCjV5d+Q9xtBaowT0j
+HPERs1ZuytCNNJTmhyqZ8q6uzMLoht4IqH/FBfpvgaeC5tBTnTT0rD5A/olXeimk
+kX4LxlEx5RAvpGB2zZVRGr6LobD9rVK91xuHYNIxxxfEGE8tCCWjp0+3ksri9SXx
+VHWBnbM9YaL32u3hxm8sYB/Yb8WSBavJCWJJqRStVRHM1koZlJmXNx2BX4vPo6iW
+RFEIPQsFZRLrtnCAiEhyT8bC2s/Njlu6ly9gtJZWSV46Q3ZjBL4q9sHKqZQ=
+-----END CERTIFICATE-----
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/nullcert.pem b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/nullcert.pem
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/pystone.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/pystone.py
new file mode 100644
index 0000000..7652027
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/pystone.py
@@ -0,0 +1,272 @@
+#!/usr/bin/env python3
+
+"""
+"PYSTONE" Benchmark Program
+
+Version: Python/1.1 (corresponds to C/1.1 plus 2 Pystone fixes)
+
+Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013.
+
+ Translated from ADA to C by Rick Richardson.
+ Every method to preserve ADA-likeness has been used,
+ at the expense of C-ness.
+
+ Translated from C to Python by Guido van Rossum.
+
+Version History:
+
+ Version 1.1 corrects two bugs in version 1.0:
+
+ First, it leaked memory: in Proc1(), NextRecord ends
+ up having a pointer to itself. I have corrected this
+ by zapping NextRecord.PtrComp at the end of Proc1().
+
+ Second, Proc3() used the operator != to compare a
+ record to None. This is rather inefficient and not
+ true to the intention of the original benchmark (where
+ a pointer comparison to None is intended; the !=
+ operator attempts to find a method __cmp__ to do value
+ comparison of the record). Version 1.1 runs 5-10
+ percent faster than version 1.0, so benchmark figures
+ of different versions can't be compared directly.
+
+"""
+
+from __future__ import print_function
+
+from time import clock
+
+LOOPS = 50000
+
+__version__ = "1.1"
+
+[Ident1, Ident2, Ident3, Ident4, Ident5] = range(1, 6)
+
+class Record(object):
+
+ def __init__(self, PtrComp = None, Discr = 0, EnumComp = 0,
+ IntComp = 0, StringComp = 0):
+ self.PtrComp = PtrComp
+ self.Discr = Discr
+ self.EnumComp = EnumComp
+ self.IntComp = IntComp
+ self.StringComp = StringComp
+
+ def copy(self):
+ return Record(self.PtrComp, self.Discr, self.EnumComp,
+ self.IntComp, self.StringComp)
+
+TRUE = 1
+FALSE = 0
+
+def main(loops=LOOPS):
+ benchtime, stones = pystones(loops)
+ print("Pystone(%s) time for %d passes = %g" % \
+ (__version__, loops, benchtime))
+ print("This machine benchmarks at %g pystones/second" % stones)
+
+
+def pystones(loops=LOOPS):
+ return Proc0(loops)
+
+IntGlob = 0
+BoolGlob = FALSE
+Char1Glob = '\0'
+Char2Glob = '\0'
+Array1Glob = [0]*51
+Array2Glob = [x[:] for x in [Array1Glob]*51]
+PtrGlb = None
+PtrGlbNext = None
+
+def Proc0(loops=LOOPS):
+ global IntGlob
+ global BoolGlob
+ global Char1Glob
+ global Char2Glob
+ global Array1Glob
+ global Array2Glob
+ global PtrGlb
+ global PtrGlbNext
+
+ starttime = clock()
+ for i in range(loops):
+ pass
+ nulltime = clock() - starttime
+
+ PtrGlbNext = Record()
+ PtrGlb = Record()
+ PtrGlb.PtrComp = PtrGlbNext
+ PtrGlb.Discr = Ident1
+ PtrGlb.EnumComp = Ident3
+ PtrGlb.IntComp = 40
+ PtrGlb.StringComp = "DHRYSTONE PROGRAM, SOME STRING"
+ String1Loc = "DHRYSTONE PROGRAM, 1'ST STRING"
+ Array2Glob[8][7] = 10
+
+ starttime = clock()
+
+ for i in range(loops):
+ Proc5()
+ Proc4()
+ IntLoc1 = 2
+ IntLoc2 = 3
+ String2Loc = "DHRYSTONE PROGRAM, 2'ND STRING"
+ EnumLoc = Ident2
+ BoolGlob = not Func2(String1Loc, String2Loc)
+ while IntLoc1 < IntLoc2:
+ IntLoc3 = 5 * IntLoc1 - IntLoc2
+ IntLoc3 = Proc7(IntLoc1, IntLoc2)
+ IntLoc1 = IntLoc1 + 1
+ Proc8(Array1Glob, Array2Glob, IntLoc1, IntLoc3)
+ PtrGlb = Proc1(PtrGlb)
+ CharIndex = 'A'
+ while CharIndex <= Char2Glob:
+ if EnumLoc == Func1(CharIndex, 'C'):
+ EnumLoc = Proc6(Ident1)
+ CharIndex = chr(ord(CharIndex)+1)
+ IntLoc3 = IntLoc2 * IntLoc1
+ IntLoc2 = IntLoc3 / IntLoc1
+ IntLoc2 = 7 * (IntLoc3 - IntLoc2) - IntLoc1
+ IntLoc1 = Proc2(IntLoc1)
+
+ benchtime = clock() - starttime - nulltime
+ if benchtime == 0.0:
+ loopsPerBenchtime = 0.0
+ else:
+ loopsPerBenchtime = (loops / benchtime)
+ return benchtime, loopsPerBenchtime
+
+def Proc1(PtrParIn):
+ PtrParIn.PtrComp = NextRecord = PtrGlb.copy()
+ PtrParIn.IntComp = 5
+ NextRecord.IntComp = PtrParIn.IntComp
+ NextRecord.PtrComp = PtrParIn.PtrComp
+ NextRecord.PtrComp = Proc3(NextRecord.PtrComp)
+ if NextRecord.Discr == Ident1:
+ NextRecord.IntComp = 6
+ NextRecord.EnumComp = Proc6(PtrParIn.EnumComp)
+ NextRecord.PtrComp = PtrGlb.PtrComp
+ NextRecord.IntComp = Proc7(NextRecord.IntComp, 10)
+ else:
+ PtrParIn = NextRecord.copy()
+ NextRecord.PtrComp = None
+ return PtrParIn
+
+def Proc2(IntParIO):
+ IntLoc = IntParIO + 10
+ while 1:
+ if Char1Glob == 'A':
+ IntLoc = IntLoc - 1
+ IntParIO = IntLoc - IntGlob
+ EnumLoc = Ident1
+ if EnumLoc == Ident1:
+ break
+ return IntParIO
+
+def Proc3(PtrParOut):
+ global IntGlob
+
+ if PtrGlb is not None:
+ PtrParOut = PtrGlb.PtrComp
+ else:
+ IntGlob = 100
+ PtrGlb.IntComp = Proc7(10, IntGlob)
+ return PtrParOut
+
+def Proc4():
+ global Char2Glob
+
+ BoolLoc = Char1Glob == 'A'
+ BoolLoc = BoolLoc or BoolGlob
+ Char2Glob = 'B'
+
+def Proc5():
+ global Char1Glob
+ global BoolGlob
+
+ Char1Glob = 'A'
+ BoolGlob = FALSE
+
+def Proc6(EnumParIn):
+ EnumParOut = EnumParIn
+ if not Func3(EnumParIn):
+ EnumParOut = Ident4
+ if EnumParIn == Ident1:
+ EnumParOut = Ident1
+ elif EnumParIn == Ident2:
+ if IntGlob > 100:
+ EnumParOut = Ident1
+ else:
+ EnumParOut = Ident4
+ elif EnumParIn == Ident3:
+ EnumParOut = Ident2
+ elif EnumParIn == Ident4:
+ pass
+ elif EnumParIn == Ident5:
+ EnumParOut = Ident3
+ return EnumParOut
+
+def Proc7(IntParI1, IntParI2):
+ IntLoc = IntParI1 + 2
+ IntParOut = IntParI2 + IntLoc
+ return IntParOut
+
+def Proc8(Array1Par, Array2Par, IntParI1, IntParI2):
+ global IntGlob
+
+ IntLoc = IntParI1 + 5
+ Array1Par[IntLoc] = IntParI2
+ Array1Par[IntLoc+1] = Array1Par[IntLoc]
+ Array1Par[IntLoc+30] = IntLoc
+ for IntIndex in range(IntLoc, IntLoc+2):
+ Array2Par[IntLoc][IntIndex] = IntLoc
+ Array2Par[IntLoc][IntLoc-1] = Array2Par[IntLoc][IntLoc-1] + 1
+ Array2Par[IntLoc+20][IntLoc] = Array1Par[IntLoc]
+ IntGlob = 5
+
+def Func1(CharPar1, CharPar2):
+ CharLoc1 = CharPar1
+ CharLoc2 = CharLoc1
+ if CharLoc2 != CharPar2:
+ return Ident1
+ else:
+ return Ident2
+
+def Func2(StrParI1, StrParI2):
+ IntLoc = 1
+ while IntLoc <= 1:
+ if Func1(StrParI1[IntLoc], StrParI2[IntLoc+1]) == Ident1:
+ CharLoc = 'A'
+ IntLoc = IntLoc + 1
+ if CharLoc >= 'W' and CharLoc <= 'Z':
+ IntLoc = 7
+ if CharLoc == 'X':
+ return TRUE
+ else:
+ if StrParI1 > StrParI2:
+ IntLoc = IntLoc + 7
+ return TRUE
+ else:
+ return FALSE
+
+def Func3(EnumParIn):
+ EnumLoc = EnumParIn
+ if EnumLoc == Ident3: return TRUE
+ return FALSE
+
+if __name__ == '__main__':
+ import sys
+ def error(msg):
+ print(msg, end=' ', file=sys.stderr)
+ print("usage: %s [number_of_loops]" % sys.argv[0], file=sys.stderr)
+ sys.exit(100)
+ nargs = len(sys.argv) - 1
+ if nargs > 1:
+ error("%d arguments are too many;" % nargs)
+ elif nargs == 1:
+ try: loops = int(sys.argv[1])
+ except ValueError:
+ error("Invalid argument %r;" % sys.argv[1])
+ else:
+ loops = LOOPS
+ main(loops)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/sha256.pem b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/sha256.pem
new file mode 100644
index 0000000..d3db4b8
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/sha256.pem
@@ -0,0 +1,128 @@
+# Certificate chain for https://sha256.tbs-internet.com
+ 0 s:/C=FR/postalCode=14000/ST=Calvados/L=CAEN/street=22 rue de Bretagne/O=TBS INTERNET/OU=0002 440443810/OU=sha-256 production/CN=sha256.tbs-internet.com
+ i:/C=FR/ST=Calvados/L=Caen/O=TBS INTERNET/OU=Terms and Conditions: http://www.tbs-internet.com/CA/repository/OU=TBS INTERNET CA/CN=TBS X509 CA SGC
+-----BEGIN CERTIFICATE-----
+MIIGXDCCBUSgAwIBAgIRAKpVmHgg9nfCodAVwcP4siwwDQYJKoZIhvcNAQELBQAw
+gcQxCzAJBgNVBAYTAkZSMREwDwYDVQQIEwhDYWx2YWRvczENMAsGA1UEBxMEQ2Fl
+bjEVMBMGA1UEChMMVEJTIElOVEVSTkVUMUgwRgYDVQQLEz9UZXJtcyBhbmQgQ29u
+ZGl0aW9uczogaHR0cDovL3d3dy50YnMtaW50ZXJuZXQuY29tL0NBL3JlcG9zaXRv
+cnkxGDAWBgNVBAsTD1RCUyBJTlRFUk5FVCBDQTEYMBYGA1UEAxMPVEJTIFg1MDkg
+Q0EgU0dDMB4XDTEyMDEwNDAwMDAwMFoXDTE0MDIxNzIzNTk1OVowgcsxCzAJBgNV
+BAYTAkZSMQ4wDAYDVQQREwUxNDAwMDERMA8GA1UECBMIQ2FsdmFkb3MxDTALBgNV
+BAcTBENBRU4xGzAZBgNVBAkTEjIyIHJ1ZSBkZSBCcmV0YWduZTEVMBMGA1UEChMM
+VEJTIElOVEVSTkVUMRcwFQYDVQQLEw4wMDAyIDQ0MDQ0MzgxMDEbMBkGA1UECxMS
+c2hhLTI1NiBwcm9kdWN0aW9uMSAwHgYDVQQDExdzaGEyNTYudGJzLWludGVybmV0
+LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKQIX/zdJcyxty0m
+PM1XQSoSSifueS3AVcgqMsaIKS/u+rYzsv4hQ/qA6vLn5m5/ewUcZDj7zdi6rBVf
+PaVNXJ6YinLX0tkaW8TEjeVuZG5yksGZlhCt1CJ1Ho9XLiLaP4uJ7MCoNUntpJ+E
+LfrOdgsIj91kPmwjDJeztVcQCvKzhjVJA/KxdInc0JvOATn7rpaSmQI5bvIjufgo
+qVsTPwVFzuUYULXBk7KxRT7MiEqnd5HvviNh0285QC478zl3v0I0Fb5El4yD3p49
+IthcRnxzMKc0UhU5ogi0SbONyBfm/mzONVfSxpM+MlyvZmJqrbuuLoEDzJD+t8PU
+xSuzgbcCAwEAAaOCAj4wggI6MB8GA1UdIwQYMBaAFAdEdoWTKLx/bXjSCuv6TEvf
+2YIfMB0GA1UdDgQWBBT/qTGYdaj+f61c2IRFL/B1eEsM8DAOBgNVHQ8BAf8EBAMC
+BaAwDAYDVR0TAQH/BAIwADA0BgNVHSUELTArBggrBgEFBQcDAQYIKwYBBQUHAwIG
+CisGAQQBgjcKAwMGCWCGSAGG+EIEATBLBgNVHSAERDBCMEAGCisGAQQB5TcCBAEw
+MjAwBggrBgEFBQcCARYkaHR0cHM6Ly93d3cudGJzLWludGVybmV0LmNvbS9DQS9D
+UFM0MG0GA1UdHwRmMGQwMqAwoC6GLGh0dHA6Ly9jcmwudGJzLWludGVybmV0LmNv
+bS9UQlNYNTA5Q0FTR0MuY3JsMC6gLKAqhihodHRwOi8vY3JsLnRicy14NTA5LmNv
+bS9UQlNYNTA5Q0FTR0MuY3JsMIGmBggrBgEFBQcBAQSBmTCBljA4BggrBgEFBQcw
+AoYsaHR0cDovL2NydC50YnMtaW50ZXJuZXQuY29tL1RCU1g1MDlDQVNHQy5jcnQw
+NAYIKwYBBQUHMAKGKGh0dHA6Ly9jcnQudGJzLXg1MDkuY29tL1RCU1g1MDlDQVNH
+Qy5jcnQwJAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3NwLnRicy14NTA5LmNvbTA/BgNV
+HREEODA2ghdzaGEyNTYudGJzLWludGVybmV0LmNvbYIbd3d3LnNoYTI1Ni50YnMt
+aW50ZXJuZXQuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQA0pOuL8QvAa5yksTbGShzX
+ABApagunUGoEydv4YJT1MXy9tTp7DrWaozZSlsqBxrYAXP1d9r2fuKbEniYHxaQ0
+UYaf1VSIlDo1yuC8wE7wxbHDIpQ/E5KAyxiaJ8obtDhFstWAPAH+UoGXq0kj2teN
+21sFQ5dXgA95nldvVFsFhrRUNB6xXAcaj0VZFhttI0ZfQZmQwEI/P+N9Jr40OGun
+aa+Dn0TMeUH4U20YntfLbu2nDcJcYfyurm+8/0Tr4HznLnedXu9pCPYj0TaddrgT
+XO0oFiyy7qGaY6+qKh71yD64Y3ycCJ/HR9Wm39mjZYc9ezYwT4noP6r7Lk8YO7/q
+-----END CERTIFICATE-----
+ 1 s:/C=FR/ST=Calvados/L=Caen/O=TBS INTERNET/OU=Terms and Conditions: http://www.tbs-internet.com/CA/repository/OU=TBS INTERNET CA/CN=TBS X509 CA SGC
+ i:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
+-----BEGIN CERTIFICATE-----
+MIIFVjCCBD6gAwIBAgIQXpDZ0ETJMV02WTx3GTnhhTANBgkqhkiG9w0BAQUFADBv
+MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFk
+ZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBF
+eHRlcm5hbCBDQSBSb290MB4XDTA1MTIwMTAwMDAwMFoXDTE5MDYyNDE5MDYzMFow
+gcQxCzAJBgNVBAYTAkZSMREwDwYDVQQIEwhDYWx2YWRvczENMAsGA1UEBxMEQ2Fl
+bjEVMBMGA1UEChMMVEJTIElOVEVSTkVUMUgwRgYDVQQLEz9UZXJtcyBhbmQgQ29u
+ZGl0aW9uczogaHR0cDovL3d3dy50YnMtaW50ZXJuZXQuY29tL0NBL3JlcG9zaXRv
+cnkxGDAWBgNVBAsTD1RCUyBJTlRFUk5FVCBDQTEYMBYGA1UEAxMPVEJTIFg1MDkg
+Q0EgU0dDMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsgOkO3f7wzN6
+rOjg45tR5vjBfzK7qmV9IBxb/QW9EEXxG+E7FNhZqQLtwGBKoSsHTnQqV75wWMk0
+9tinWvftBkSpj5sTi/8cbzJfUvTSVYh3Qxv6AVVjMMH/ruLjE6y+4PoaPs8WoYAQ
+ts5R4Z1g8c/WnTepLst2x0/Wv7GmuoQi+gXvHU6YrBiu7XkeYhzc95QdviWSJRDk
+owhb5K43qhcvjRmBfO/paGlCliDGZp8mHwrI21mwobWpVjTxZRwYO3bd4+TGcI4G
+Ie5wmHwE8F7SK1tgSqbBacKjDa93j7txKkfz/Yd2n7TGqOXiHPsJpG655vrKtnXk
+9vs1zoDeJQIDAQABo4IBljCCAZIwHQYDVR0OBBYEFAdEdoWTKLx/bXjSCuv6TEvf
+2YIfMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEAMCAGA1UdJQQZ
+MBcGCisGAQQBgjcKAwMGCWCGSAGG+EIEATAYBgNVHSAEETAPMA0GCysGAQQBgOU3
+AgQBMHsGA1UdHwR0MHIwOKA2oDSGMmh0dHA6Ly9jcmwuY29tb2RvY2EuY29tL0Fk
+ZFRydXN0RXh0ZXJuYWxDQVJvb3QuY3JsMDagNKAyhjBodHRwOi8vY3JsLmNvbW9k
+by5uZXQvQWRkVHJ1c3RFeHRlcm5hbENBUm9vdC5jcmwwgYAGCCsGAQUFBwEBBHQw
+cjA4BggrBgEFBQcwAoYsaHR0cDovL2NydC5jb21vZG9jYS5jb20vQWRkVHJ1c3RV
+VE5TR0NDQS5jcnQwNgYIKwYBBQUHMAKGKmh0dHA6Ly9jcnQuY29tb2RvLm5ldC9B
+ZGRUcnVzdFVUTlNHQ0NBLmNydDARBglghkgBhvhCAQEEBAMCAgQwDQYJKoZIhvcN
+AQEFBQADggEBAK2zEzs+jcIrVK9oDkdDZNvhuBYTdCfpxfFs+OAujW0bIfJAy232
+euVsnJm6u/+OrqKudD2tad2BbejLLXhMZViaCmK7D9nrXHx4te5EP8rL19SUVqLY
+1pTnv5dhNgEgvA7n5lIzDSYs7yRLsr7HJsYPr6SeYSuZizyX1SNz7ooJ32/F3X98
+RB0Mlc/E0OyOrkQ9/y5IrnpnaSora8CnUrV5XNOg+kyCz9edCyx4D5wXYcwZPVWz
+8aDqquESrezPyjtfi4WRO4s/VD3HLZvOxzMrWAVYCDG9FxaOhF0QGuuG1F7F3GKV
+v6prNyCl016kRl2j1UT+a7gLd8fA25A4C9E=
+-----END CERTIFICATE-----
+ 2 s:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
+ i:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC
+-----BEGIN CERTIFICATE-----
+MIIEZjCCA06gAwIBAgIQUSYKkxzif5zDpV954HKugjANBgkqhkiG9w0BAQUFADCB
+kzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug
+Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho
+dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZBgNVBAMTElVUTiAtIERBVEFDb3Jw
+IFNHQzAeFw0wNTA2MDcwODA5MTBaFw0xOTA2MjQxOTA2MzBaMG8xCzAJBgNVBAYT
+AlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0
+ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
+IFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC39xoz5vIABC05
+4E5b7R+8bA/Ntfojts7emxEzl6QpTH2Tn71KvJPtAxrjj8/lbVBa1pcplFqAsEl6
+2y6V/bjKvzc4LR4+kUGtcFbH8E8/6DKedMrIkFTpxl8PeJ2aQDwOrGGqXhSPnoeh
+alDc15pOrwWzpnGUnHGzUGAKxxOdOAeGAqjpqGkmGJCrTLBPI6s6T4TY386f4Wlv
+u9dC12tE5Met7m1BX3JacQg3s3llpFmglDf3AC8NwpJy2tA4ctsUqEXEXSp9t7TW
+xO6szRNEt8kr3UMAJfphuWlqWCMRt6czj1Z1WfXNKddGtworZbbTQm8Vsrh7++/p
+XVPVNFonAgMBAAGjgdgwgdUwHwYDVR0jBBgwFoAUUzLRs89/+uDxoF2FTpLSnkUd
+tE8wHQYDVR0OBBYEFK29mHo0tCb3+sQmVO8DveAky1QaMA4GA1UdDwEB/wQEAwIB
+BjAPBgNVHRMBAf8EBTADAQH/MBEGCWCGSAGG+EIBAQQEAwIBAjAgBgNVHSUEGTAX
+BgorBgEEAYI3CgMDBglghkgBhvhCBAEwPQYDVR0fBDYwNDAyoDCgLoYsaHR0cDov
+L2NybC51c2VydHJ1c3QuY29tL1VUTi1EQVRBQ29ycFNHQy5jcmwwDQYJKoZIhvcN
+AQEFBQADggEBAMbuUxdoFLJRIh6QWA2U/b3xcOWGLcM2MY9USEbnLQg3vGwKYOEO
+rVE04BKT6b64q7gmtOmWPSiPrmQH/uAB7MXjkesYoPF1ftsK5p+R26+udd8jkWjd
+FwBaS/9kbHDrARrQkNnHptZt9hPk/7XJ0h4qy7ElQyZ42TCbTg0evmnv3+r+LbPM
++bDdtRTKkdSytaX7ARmjR3mfnYyVhzT4HziS2jamEfpr62vp3EV4FTkG101B5CHI
+3C+H0be/SGB1pWLLJN47YaApIKa+xWycxOkKaSLvkTr6Jq/RW0GnOuL4OAdCq8Fb
++M5tug8EPzI0rNwEKNdwMBQmBsTkm5jVz3g=
+-----END CERTIFICATE-----
+ 3 s:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC
+ i:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC
+-----BEGIN CERTIFICATE-----
+MIIEXjCCA0agAwIBAgIQRL4Mi1AAIbQR0ypoBqmtaTANBgkqhkiG9w0BAQUFADCB
+kzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug
+Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho
+dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZBgNVBAMTElVUTiAtIERBVEFDb3Jw
+IFNHQzAeFw05OTA2MjQxODU3MjFaFw0xOTA2MjQxOTA2MzBaMIGTMQswCQYDVQQG
+EwJVUzELMAkGA1UECBMCVVQxFzAVBgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4wHAYD
+VQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cu
+dXNlcnRydXN0LmNvbTEbMBkGA1UEAxMSVVROIC0gREFUQUNvcnAgU0dDMIIBIjAN
+BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3+5YEKIrblXEjr8uRgnn4AgPLit6
+E5Qbvfa2gI5lBZMAHryv4g+OGQ0SR+ysraP6LnD43m77VkIVni5c7yPeIbkFdicZ
+D0/Ww5y0vpQZY/KmEQrrU0icvvIpOxboGqBMpsn0GFlowHDyUwDAXlCCpVZvNvlK
+4ESGoE1O1kduSUrLZ9emxAW5jh70/P/N5zbgnAVssjMiFdC04MwXwLLA9P4yPykq
+lXvY8qdOD1R8oQ2AswkDwf9c3V6aPryuvEeKaq5xyh+xKrhfQgUL7EYw0XILyulW
+bfXv33i+Ybqypa4ETLyorGkVl73v67SMvzX41MPRKA5cOp9wGDMgd8SirwIDAQAB
+o4GrMIGoMAsGA1UdDwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRT
+MtGzz3/64PGgXYVOktKeRR20TzA9BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3Js
+LnVzZXJ0cnVzdC5jb20vVVROLURBVEFDb3JwU0dDLmNybDAqBgNVHSUEIzAhBggr
+BgEFBQcDAQYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMA0GCSqGSIb3DQEBBQUAA4IB
+AQAnNZcAiosovcYzMB4p/OL31ZjUQLtgyr+rFywJNn9Q+kHcrpY6CiM+iVnJowft
+Gzet/Hy+UUla3joKVAgWRcKZsYfNjGjgaQPpxE6YsjuMFrMOoAyYUJuTqXAJyCyj
+j98C5OBxOvG0I3KgqgHf35g+FFCgMSa9KOlaMCZ1+XtgHI3zzVAmbQQnmt/VDUVH
+KWss5nbZqSl9Mt3JNjy9rjXxEZ4du5A/EkdOjtd+D2JzHVImOBwYSf0wdJrE5SIv
+2MCN7ZF6TACPcn9d2t0bi0Vr591pl6jFVkwPDPafepE39peC4N1xaf92P2BNPM/3
+mfnGV/TJVTl4uix5yaaIK/QI
+-----END CERTIFICATE-----
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/ssl_cert.pem b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/ssl_cert.pem
new file mode 100644
index 0000000..47a7d7e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/ssl_cert.pem
@@ -0,0 +1,15 @@
+-----BEGIN CERTIFICATE-----
+MIICVDCCAb2gAwIBAgIJANfHOBkZr8JOMA0GCSqGSIb3DQEBBQUAMF8xCzAJBgNV
+BAYTAlhZMRcwFQYDVQQHEw5DYXN0bGUgQW50aHJheDEjMCEGA1UEChMaUHl0aG9u
+IFNvZnR3YXJlIEZvdW5kYXRpb24xEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0xMDEw
+MDgyMzAxNTZaFw0yMDEwMDUyMzAxNTZaMF8xCzAJBgNVBAYTAlhZMRcwFQYDVQQH
+Ew5DYXN0bGUgQW50aHJheDEjMCEGA1UEChMaUHl0aG9uIFNvZnR3YXJlIEZvdW5k
+YXRpb24xEjAQBgNVBAMTCWxvY2FsaG9zdDCBnzANBgkqhkiG9w0BAQEFAAOBjQAw
+gYkCgYEA21vT5isq7F68amYuuNpSFlKDPrMUCa4YWYqZRt2OZ+/3NKaZ2xAiSwr7
+6MrQF70t5nLbSPpqE5+5VrS58SY+g/sXLiFd6AplH1wJZwh78DofbFYXUggktFMt
+pTyiX8jtP66bkcPkDADA089RI1TQR6Ca+n7HFa7c1fabVV6i3zkCAwEAAaMYMBYw
+FAYDVR0RBA0wC4IJbG9jYWxob3N0MA0GCSqGSIb3DQEBBQUAA4GBAHPctQBEQ4wd
+BJ6+JcpIraopLn8BGhbjNWj40mmRqWB/NAWF6M5ne7KpGAu7tLeG4hb1zLaldK8G
+lxy2GPSRF6LFS48dpEj2HbMv2nvv6xxalDMJ9+DicWgAKTQ6bcX2j3GUkCR0g/T1
+CRlNBAAlvhKzO7Clpf9l0YKBEfraJByX
+-----END CERTIFICATE-----
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/ssl_key.passwd.pem b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/ssl_key.passwd.pem
new file mode 100644
index 0000000..2524672
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/ssl_key.passwd.pem
@@ -0,0 +1,18 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: DES-EDE3-CBC,1A8D9D2A02EC698A
+
+kJYbfZ8L0sfe9Oty3gw0aloNnY5E8fegRfQLZlNoxTl6jNt0nIwI8kDJ36CZgR9c
+u3FDJm/KqrfUoz8vW+qEnWhSG7QPX2wWGPHd4K94Yz/FgrRzZ0DoK7XxXq9gOtVA
+AVGQhnz32p+6WhfGsCr9ArXEwRZrTk/FvzEPaU5fHcoSkrNVAGX8IpSVkSDwEDQr
+Gv17+cfk99UV1OCza6yKHoFkTtrC+PZU71LomBabivS2Oc4B9hYuSR2hF01wTHP+
+YlWNagZOOVtNz4oKK9x9eNQpmfQXQvPPTfusexKIbKfZrMvJoxcm1gfcZ0H/wK6P
+6wmXSG35qMOOztCZNtperjs1wzEBXznyK8QmLcAJBjkfarABJX9vBEzZV0OUKhy+
+noORFwHTllphbmydLhu6ehLUZMHPhzAS5UN7srtpSN81eerDMy0RMUAwA7/PofX1
+94Me85Q8jP0PC9ETdsJcPqLzAPETEYu0ELewKRcrdyWi+tlLFrpE5KT/s5ecbl9l
+7B61U4Kfd1PIXc/siINhU3A3bYK+845YyUArUOnKf1kEox7p1RpD7yFqVT04lRTo
+cibNKATBusXSuBrp2G6GNuhWEOSafWCKJQAzgCYIp6ZTV2khhMUGppc/2H3CF6cO
+zX0KtlPVZC7hLkB6HT8SxYUwF1zqWY7+/XPPdc37MeEZ87Q3UuZwqORLY+Z0hpgt
+L5JXBCoklZhCAaN2GqwFLXtGiRSRFGY7xXIhbDTlE65Wv1WGGgDLMKGE1gOz3yAo
+2jjG1+yAHJUdE69XTFHSqSkvaloA1W03LdMXZ9VuQJ/ySXCie6ABAQ==
+-----END RSA PRIVATE KEY-----
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/ssl_key.pem b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/ssl_key.pem
new file mode 100644
index 0000000..3fd3bbd
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/ssl_key.pem
@@ -0,0 +1,16 @@
+-----BEGIN PRIVATE KEY-----
+MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBANtb0+YrKuxevGpm
+LrjaUhZSgz6zFAmuGFmKmUbdjmfv9zSmmdsQIksK++jK0Be9LeZy20j6ahOfuVa0
+ufEmPoP7Fy4hXegKZR9cCWcIe/A6H2xWF1IIJLRTLaU8ol/I7T+um5HD5AwAwNPP
+USNU0Eegmvp+xxWu3NX2m1Veot85AgMBAAECgYA3ZdZ673X0oexFlq7AAmrutkHt
+CL7LvwrpOiaBjhyTxTeSNWzvtQBkIU8DOI0bIazA4UreAFffwtvEuPmonDb3F+Iq
+SMAu42XcGyVZEl+gHlTPU9XRX7nTOXVt+MlRRRxL6t9GkGfUAXI3XxJDXW3c0vBK
+UL9xqD8cORXOfE06rQJBAP8mEX1ERkR64Ptsoe4281vjTlNfIbs7NMPkUnrn9N/Y
+BLhjNIfQ3HFZG8BTMLfX7kCS9D593DW5tV4Z9BP/c6cCQQDcFzCcVArNh2JSywOQ
+ZfTfRbJg/Z5Lt9Fkngv1meeGNPgIMLN8Sg679pAOOWmzdMO3V706rNPzSVMME7E5
+oPIfAkEA8pDddarP5tCvTTgUpmTFbakm0KoTZm2+FzHcnA4jRh+XNTjTOv98Y6Ik
+eO5d1ZnKXseWvkZncQgxfdnMqqpj5wJAcNq/RVne1DbYlwWchT2Si65MYmmJ8t+F
+0mcsULqjOnEMwf5e+ptq5LzwbyrHZYq5FNk7ocufPv/ZQrcSSC+cFwJBAKvOJByS
+x56qyGeZLOQlWS2JS3KJo59XuLFGqcbgN9Om9xFa41Yb4N9NvplFivsvZdw3m1Q/
+SPIXQuT8RMPDVNQ=
+-----END PRIVATE KEY-----
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/ssl_servers.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/ssl_servers.py
new file mode 100644
index 0000000..87a3fb8
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/ssl_servers.py
@@ -0,0 +1,207 @@
+from __future__ import absolute_import, division, print_function, unicode_literals
+from future.builtins import filter, str
+from future import utils
+import os
+import sys
+import ssl
+import pprint
+import socket
+from future.backports.urllib import parse as urllib_parse
+from future.backports.http.server import (HTTPServer as _HTTPServer,
+ SimpleHTTPRequestHandler, BaseHTTPRequestHandler)
+from future.backports.test import support
+threading = support.import_module("threading")
+
+here = os.path.dirname(__file__)
+
+HOST = support.HOST
+CERTFILE = os.path.join(here, 'keycert.pem')
+
+# This one's based on HTTPServer, which is based on SocketServer
+
+class HTTPSServer(_HTTPServer):
+
+ def __init__(self, server_address, handler_class, context):
+ _HTTPServer.__init__(self, server_address, handler_class)
+ self.context = context
+
+ def __str__(self):
+ return ('<%s %s:%s>' %
+ (self.__class__.__name__,
+ self.server_name,
+ self.server_port))
+
+ def get_request(self):
+ # override this to wrap socket with SSL
+ try:
+ sock, addr = self.socket.accept()
+ sslconn = self.context.wrap_socket(sock, server_side=True)
+ except socket.error as e:
+ # socket errors are silenced by the caller, print them here
+ if support.verbose:
+ sys.stderr.write("Got an error:\n%s\n" % e)
+ raise
+ return sslconn, addr
+
+class RootedHTTPRequestHandler(SimpleHTTPRequestHandler):
+ # need to override translate_path to get a known root,
+ # instead of using os.curdir, since the test could be
+ # run from anywhere
+
+ server_version = "TestHTTPS/1.0"
+ root = here
+ # Avoid hanging when a request gets interrupted by the client
+ timeout = 5
+
+ def translate_path(self, path):
+ """Translate a /-separated PATH to the local filename syntax.
+
+ Components that mean special things to the local file system
+ (e.g. drive or directory names) are ignored. (XXX They should
+ probably be diagnosed.)
+
+ """
+ # abandon query parameters
+ path = urllib.parse.urlparse(path)[2]
+ path = os.path.normpath(urllib.parse.unquote(path))
+ words = path.split('/')
+ words = filter(None, words)
+ path = self.root
+ for word in words:
+ drive, word = os.path.splitdrive(word)
+ head, word = os.path.split(word)
+ path = os.path.join(path, word)
+ return path
+
+ def log_message(self, format, *args):
+ # we override this to suppress logging unless "verbose"
+ if support.verbose:
+ sys.stdout.write(" server (%s:%d %s):\n [%s] %s\n" %
+ (self.server.server_address,
+ self.server.server_port,
+ self.request.cipher(),
+ self.log_date_time_string(),
+ format%args))
+
+
+class StatsRequestHandler(BaseHTTPRequestHandler):
+ """Example HTTP request handler which returns SSL statistics on GET
+ requests.
+ """
+
+ server_version = "StatsHTTPS/1.0"
+
+ def do_GET(self, send_body=True):
+ """Serve a GET request."""
+ sock = self.rfile.raw._sock
+ context = sock.context
+ stats = {
+ 'session_cache': context.session_stats(),
+ 'cipher': sock.cipher(),
+ 'compression': sock.compression(),
+ }
+ body = pprint.pformat(stats)
+ body = body.encode('utf-8')
+ self.send_response(200)
+ self.send_header("Content-type", "text/plain; charset=utf-8")
+ self.send_header("Content-Length", str(len(body)))
+ self.end_headers()
+ if send_body:
+ self.wfile.write(body)
+
+ def do_HEAD(self):
+ """Serve a HEAD request."""
+ self.do_GET(send_body=False)
+
+ def log_request(self, format, *args):
+ if support.verbose:
+ BaseHTTPRequestHandler.log_request(self, format, *args)
+
+
+class HTTPSServerThread(threading.Thread):
+
+ def __init__(self, context, host=HOST, handler_class=None):
+ self.flag = None
+ self.server = HTTPSServer((host, 0),
+ handler_class or RootedHTTPRequestHandler,
+ context)
+ self.port = self.server.server_port
+ threading.Thread.__init__(self)
+ self.daemon = True
+
+ def __str__(self):
+ return "<%s %s>" % (self.__class__.__name__, self.server)
+
+ def start(self, flag=None):
+ self.flag = flag
+ threading.Thread.start(self)
+
+ def run(self):
+ if self.flag:
+ self.flag.set()
+ try:
+ self.server.serve_forever(0.05)
+ finally:
+ self.server.server_close()
+
+ def stop(self):
+ self.server.shutdown()
+
+
+def make_https_server(case, certfile=CERTFILE, host=HOST, handler_class=None):
+ # we assume the certfile contains both private key and certificate
+ context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
+ context.load_cert_chain(certfile)
+ server = HTTPSServerThread(context, host, handler_class)
+ flag = threading.Event()
+ server.start(flag)
+ flag.wait()
+ def cleanup():
+ if support.verbose:
+ sys.stdout.write('stopping HTTPS server\n')
+ server.stop()
+ if support.verbose:
+ sys.stdout.write('joining HTTPS thread\n')
+ server.join()
+ case.addCleanup(cleanup)
+ return server
+
+
+if __name__ == "__main__":
+ import argparse
+ parser = argparse.ArgumentParser(
+ description='Run a test HTTPS server. '
+ 'By default, the current directory is served.')
+ parser.add_argument('-p', '--port', type=int, default=4433,
+ help='port to listen on (default: %(default)s)')
+ parser.add_argument('-q', '--quiet', dest='verbose', default=True,
+ action='store_false', help='be less verbose')
+ parser.add_argument('-s', '--stats', dest='use_stats_handler', default=False,
+ action='store_true', help='always return stats page')
+ parser.add_argument('--curve-name', dest='curve_name', type=str,
+ action='store',
+ help='curve name for EC-based Diffie-Hellman')
+ parser.add_argument('--dh', dest='dh_file', type=str, action='store',
+ help='PEM file containing DH parameters')
+ args = parser.parse_args()
+
+ support.verbose = args.verbose
+ if args.use_stats_handler:
+ handler_class = StatsRequestHandler
+ else:
+ handler_class = RootedHTTPRequestHandler
+ if utils.PY2:
+ handler_class.root = os.getcwdu()
+ else:
+ handler_class.root = os.getcwd()
+ context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
+ context.load_cert_chain(CERTFILE)
+ if args.curve_name:
+ context.set_ecdh_curve(args.curve_name)
+ if args.dh_file:
+ context.load_dh_params(args.dh_file)
+
+ server = HTTPSServer(("", args.port), handler_class, context)
+ if args.verbose:
+ print("Listening on https://localhost:{0.port}".format(args))
+ server.serve_forever(0.1)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/support.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/support.py
new file mode 100644
index 0000000..b59c4ff
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/test/support.py
@@ -0,0 +1,2048 @@
+# -*- coding: utf-8 -*-
+"""Supporting definitions for the Python regression tests.
+
+Backported for python-future from Python 3.3 test/support.py.
+"""
+
+from __future__ import (absolute_import, division,
+ print_function, unicode_literals)
+from future import utils
+from future.builtins import str, range, open, int, map, list
+
+import contextlib
+import errno
+import functools
+import gc
+import socket
+import sys
+import os
+import platform
+import shutil
+import warnings
+import unittest
+# For Python 2.6 compatibility:
+if not hasattr(unittest, 'skip'):
+ import unittest2 as unittest
+
+import importlib
+# import collections.abc # not present on Py2.7
+import re
+import subprocess
+import imp
+import time
+try:
+ import sysconfig
+except ImportError:
+ # sysconfig is not available on Python 2.6. Try using distutils.sysconfig instead:
+ from distutils import sysconfig
+import fnmatch
+import logging.handlers
+import struct
+import tempfile
+
+try:
+ if utils.PY3:
+ import _thread, threading
+ else:
+ import thread as _thread, threading
+except ImportError:
+ _thread = None
+ threading = None
+try:
+ import multiprocessing.process
+except ImportError:
+ multiprocessing = None
+
+try:
+ import zlib
+except ImportError:
+ zlib = None
+
+try:
+ import gzip
+except ImportError:
+ gzip = None
+
+try:
+ import bz2
+except ImportError:
+ bz2 = None
+
+try:
+ import lzma
+except ImportError:
+ lzma = None
+
+__all__ = [
+ "Error", "TestFailed", "ResourceDenied", "import_module", "verbose",
+ "use_resources", "max_memuse", "record_original_stdout",
+ "get_original_stdout", "unload", "unlink", "rmtree", "forget",
+ "is_resource_enabled", "requires", "requires_freebsd_version",
+ "requires_linux_version", "requires_mac_ver", "find_unused_port",
+ "bind_port", "IPV6_ENABLED", "is_jython", "TESTFN", "HOST", "SAVEDCWD",
+ "temp_cwd", "findfile", "create_empty_file", "sortdict",
+ "check_syntax_error", "open_urlresource", "check_warnings", "CleanImport",
+ "EnvironmentVarGuard", "TransientResource", "captured_stdout",
+ "captured_stdin", "captured_stderr", "time_out", "socket_peer_reset",
+ "ioerror_peer_reset", "run_with_locale", 'temp_umask',
+ "transient_internet", "set_memlimit", "bigmemtest", "bigaddrspacetest",
+ "BasicTestRunner", "run_unittest", "run_doctest", "threading_setup",
+ "threading_cleanup", "reap_children", "cpython_only", "check_impl_detail",
+ "get_attribute", "swap_item", "swap_attr", "requires_IEEE_754",
+ "TestHandler", "Matcher", "can_symlink", "skip_unless_symlink",
+ "skip_unless_xattr", "import_fresh_module", "requires_zlib",
+ "PIPE_MAX_SIZE", "failfast", "anticipate_failure", "run_with_tz",
+ "requires_gzip", "requires_bz2", "requires_lzma", "suppress_crash_popup",
+ ]
+
+class Error(Exception):
+ """Base class for regression test exceptions."""
+
+class TestFailed(Error):
+ """Test failed."""
+
+class ResourceDenied(unittest.SkipTest):
+ """Test skipped because it requested a disallowed resource.
+
+ This is raised when a test calls requires() for a resource that
+ has not be enabled. It is used to distinguish between expected
+ and unexpected skips.
+ """
+
+@contextlib.contextmanager
+def _ignore_deprecated_imports(ignore=True):
+ """Context manager to suppress package and module deprecation
+ warnings when importing them.
+
+ If ignore is False, this context manager has no effect."""
+ if ignore:
+ with warnings.catch_warnings():
+ warnings.filterwarnings("ignore", ".+ (module|package)",
+ DeprecationWarning)
+ yield
+ else:
+ yield
+
+
+def import_module(name, deprecated=False):
+ """Import and return the module to be tested, raising SkipTest if
+ it is not available.
+
+ If deprecated is True, any module or package deprecation messages
+ will be suppressed."""
+ with _ignore_deprecated_imports(deprecated):
+ try:
+ return importlib.import_module(name)
+ except ImportError as msg:
+ raise unittest.SkipTest(str(msg))
+
+
+def _save_and_remove_module(name, orig_modules):
+ """Helper function to save and remove a module from sys.modules
+
+ Raise ImportError if the module can't be imported.
+ """
+ # try to import the module and raise an error if it can't be imported
+ if name not in sys.modules:
+ __import__(name)
+ del sys.modules[name]
+ for modname in list(sys.modules):
+ if modname == name or modname.startswith(name + '.'):
+ orig_modules[modname] = sys.modules[modname]
+ del sys.modules[modname]
+
+def _save_and_block_module(name, orig_modules):
+ """Helper function to save and block a module in sys.modules
+
+ Return True if the module was in sys.modules, False otherwise.
+ """
+ saved = True
+ try:
+ orig_modules[name] = sys.modules[name]
+ except KeyError:
+ saved = False
+ sys.modules[name] = None
+ return saved
+
+
+def anticipate_failure(condition):
+ """Decorator to mark a test that is known to be broken in some cases
+
+ Any use of this decorator should have a comment identifying the
+ associated tracker issue.
+ """
+ if condition:
+ return unittest.expectedFailure
+ return lambda f: f
+
+
+def import_fresh_module(name, fresh=(), blocked=(), deprecated=False):
+ """Import and return a module, deliberately bypassing sys.modules.
+ This function imports and returns a fresh copy of the named Python module
+ by removing the named module from sys.modules before doing the import.
+ Note that unlike reload, the original module is not affected by
+ this operation.
+
+ *fresh* is an iterable of additional module names that are also removed
+ from the sys.modules cache before doing the import.
+
+ *blocked* is an iterable of module names that are replaced with None
+ in the module cache during the import to ensure that attempts to import
+ them raise ImportError.
+
+ The named module and any modules named in the *fresh* and *blocked*
+ parameters are saved before starting the import and then reinserted into
+ sys.modules when the fresh import is complete.
+
+ Module and package deprecation messages are suppressed during this import
+ if *deprecated* is True.
+
+ This function will raise ImportError if the named module cannot be
+ imported.
+
+ If deprecated is True, any module or package deprecation messages
+ will be suppressed.
+ """
+ # NOTE: test_heapq, test_json and test_warnings include extra sanity checks
+ # to make sure that this utility function is working as expected
+ with _ignore_deprecated_imports(deprecated):
+ # Keep track of modules saved for later restoration as well
+ # as those which just need a blocking entry removed
+ orig_modules = {}
+ names_to_remove = []
+ _save_and_remove_module(name, orig_modules)
+ try:
+ for fresh_name in fresh:
+ _save_and_remove_module(fresh_name, orig_modules)
+ for blocked_name in blocked:
+ if not _save_and_block_module(blocked_name, orig_modules):
+ names_to_remove.append(blocked_name)
+ fresh_module = importlib.import_module(name)
+ except ImportError:
+ fresh_module = None
+ finally:
+ for orig_name, module in orig_modules.items():
+ sys.modules[orig_name] = module
+ for name_to_remove in names_to_remove:
+ del sys.modules[name_to_remove]
+ return fresh_module
+
+
+def get_attribute(obj, name):
+ """Get an attribute, raising SkipTest if AttributeError is raised."""
+ try:
+ attribute = getattr(obj, name)
+ except AttributeError:
+ raise unittest.SkipTest("object %r has no attribute %r" % (obj, name))
+ else:
+ return attribute
+
+verbose = 1 # Flag set to 0 by regrtest.py
+use_resources = None # Flag set to [] by regrtest.py
+max_memuse = 0 # Disable bigmem tests (they will still be run with
+ # small sizes, to make sure they work.)
+real_max_memuse = 0
+failfast = False
+match_tests = None
+
+# _original_stdout is meant to hold stdout at the time regrtest began.
+# This may be "the real" stdout, or IDLE's emulation of stdout, or whatever.
+# The point is to have some flavor of stdout the user can actually see.
+_original_stdout = None
+def record_original_stdout(stdout):
+ global _original_stdout
+ _original_stdout = stdout
+
+def get_original_stdout():
+ return _original_stdout or sys.stdout
+
+def unload(name):
+ try:
+ del sys.modules[name]
+ except KeyError:
+ pass
+
+if sys.platform.startswith("win"):
+ def _waitfor(func, pathname, waitall=False):
+ # Perform the operation
+ func(pathname)
+ # Now setup the wait loop
+ if waitall:
+ dirname = pathname
+ else:
+ dirname, name = os.path.split(pathname)
+ dirname = dirname or '.'
+ # Check for `pathname` to be removed from the filesystem.
+ # The exponential backoff of the timeout amounts to a total
+ # of ~1 second after which the deletion is probably an error
+ # anyway.
+ # Testing on a i7@4.3GHz shows that usually only 1 iteration is
+ # required when contention occurs.
+ timeout = 0.001
+ while timeout < 1.0:
+ # Note we are only testing for the existence of the file(s) in
+ # the contents of the directory regardless of any security or
+ # access rights. If we have made it this far, we have sufficient
+ # permissions to do that much using Python's equivalent of the
+ # Windows API FindFirstFile.
+ # Other Windows APIs can fail or give incorrect results when
+ # dealing with files that are pending deletion.
+ L = os.listdir(dirname)
+ if not (L if waitall else name in L):
+ return
+ # Increase the timeout and try again
+ time.sleep(timeout)
+ timeout *= 2
+ warnings.warn('tests may fail, delete still pending for ' + pathname,
+ RuntimeWarning, stacklevel=4)
+
+ def _unlink(filename):
+ _waitfor(os.unlink, filename)
+
+ def _rmdir(dirname):
+ _waitfor(os.rmdir, dirname)
+
+ def _rmtree(path):
+ def _rmtree_inner(path):
+ for name in os.listdir(path):
+ fullname = os.path.join(path, name)
+ if os.path.isdir(fullname):
+ _waitfor(_rmtree_inner, fullname, waitall=True)
+ os.rmdir(fullname)
+ else:
+ os.unlink(fullname)
+ _waitfor(_rmtree_inner, path, waitall=True)
+ _waitfor(os.rmdir, path)
+else:
+ _unlink = os.unlink
+ _rmdir = os.rmdir
+ _rmtree = shutil.rmtree
+
+def unlink(filename):
+ try:
+ _unlink(filename)
+ except OSError as error:
+ # The filename need not exist.
+ if error.errno not in (errno.ENOENT, errno.ENOTDIR):
+ raise
+
+def rmdir(dirname):
+ try:
+ _rmdir(dirname)
+ except OSError as error:
+ # The directory need not exist.
+ if error.errno != errno.ENOENT:
+ raise
+
+def rmtree(path):
+ try:
+ _rmtree(path)
+ except OSError as error:
+ if error.errno != errno.ENOENT:
+ raise
+
+def make_legacy_pyc(source):
+ """Move a PEP 3147 pyc/pyo file to its legacy pyc/pyo location.
+
+ The choice of .pyc or .pyo extension is done based on the __debug__ flag
+ value.
+
+ :param source: The file system path to the source file. The source file
+ does not need to exist, however the PEP 3147 pyc file must exist.
+ :return: The file system path to the legacy pyc file.
+ """
+ pyc_file = imp.cache_from_source(source)
+ up_one = os.path.dirname(os.path.abspath(source))
+ legacy_pyc = os.path.join(up_one, source + ('c' if __debug__ else 'o'))
+ os.rename(pyc_file, legacy_pyc)
+ return legacy_pyc
+
+def forget(modname):
+ """'Forget' a module was ever imported.
+
+ This removes the module from sys.modules and deletes any PEP 3147 or
+ legacy .pyc and .pyo files.
+ """
+ unload(modname)
+ for dirname in sys.path:
+ source = os.path.join(dirname, modname + '.py')
+ # It doesn't matter if they exist or not, unlink all possible
+ # combinations of PEP 3147 and legacy pyc and pyo files.
+ unlink(source + 'c')
+ unlink(source + 'o')
+ unlink(imp.cache_from_source(source, debug_override=True))
+ unlink(imp.cache_from_source(source, debug_override=False))
+
+# On some platforms, should not run gui test even if it is allowed
+# in `use_resources'.
+if sys.platform.startswith('win'):
+ import ctypes
+ import ctypes.wintypes
+ def _is_gui_available():
+ UOI_FLAGS = 1
+ WSF_VISIBLE = 0x0001
+ class USEROBJECTFLAGS(ctypes.Structure):
+ _fields_ = [("fInherit", ctypes.wintypes.BOOL),
+ ("fReserved", ctypes.wintypes.BOOL),
+ ("dwFlags", ctypes.wintypes.DWORD)]
+ dll = ctypes.windll.user32
+ h = dll.GetProcessWindowStation()
+ if not h:
+ raise ctypes.WinError()
+ uof = USEROBJECTFLAGS()
+ needed = ctypes.wintypes.DWORD()
+ res = dll.GetUserObjectInformationW(h,
+ UOI_FLAGS,
+ ctypes.byref(uof),
+ ctypes.sizeof(uof),
+ ctypes.byref(needed))
+ if not res:
+ raise ctypes.WinError()
+ return bool(uof.dwFlags & WSF_VISIBLE)
+else:
+ def _is_gui_available():
+ return True
+
+def is_resource_enabled(resource):
+ """Test whether a resource is enabled. Known resources are set by
+ regrtest.py."""
+ return use_resources is not None and resource in use_resources
+
+def requires(resource, msg=None):
+ """Raise ResourceDenied if the specified resource is not available.
+
+ If the caller's module is __main__ then automatically return True. The
+ possibility of False being returned occurs when regrtest.py is
+ executing.
+ """
+ if resource == 'gui' and not _is_gui_available():
+ raise unittest.SkipTest("Cannot use the 'gui' resource")
+ # see if the caller's module is __main__ - if so, treat as if
+ # the resource was set
+ if sys._getframe(1).f_globals.get("__name__") == "__main__":
+ return
+ if not is_resource_enabled(resource):
+ if msg is None:
+ msg = "Use of the %r resource not enabled" % resource
+ raise ResourceDenied(msg)
+
+def _requires_unix_version(sysname, min_version):
+ """Decorator raising SkipTest if the OS is `sysname` and the version is less
+ than `min_version`.
+
+ For example, @_requires_unix_version('FreeBSD', (7, 2)) raises SkipTest if
+ the FreeBSD version is less than 7.2.
+ """
+ def decorator(func):
+ @functools.wraps(func)
+ def wrapper(*args, **kw):
+ if platform.system() == sysname:
+ version_txt = platform.release().split('-', 1)[0]
+ try:
+ version = tuple(map(int, version_txt.split('.')))
+ except ValueError:
+ pass
+ else:
+ if version < min_version:
+ min_version_txt = '.'.join(map(str, min_version))
+ raise unittest.SkipTest(
+ "%s version %s or higher required, not %s"
+ % (sysname, min_version_txt, version_txt))
+ return func(*args, **kw)
+ wrapper.min_version = min_version
+ return wrapper
+ return decorator
+
+def requires_freebsd_version(*min_version):
+ """Decorator raising SkipTest if the OS is FreeBSD and the FreeBSD version is
+ less than `min_version`.
+
+ For example, @requires_freebsd_version(7, 2) raises SkipTest if the FreeBSD
+ version is less than 7.2.
+ """
+ return _requires_unix_version('FreeBSD', min_version)
+
+def requires_linux_version(*min_version):
+ """Decorator raising SkipTest if the OS is Linux and the Linux version is
+ less than `min_version`.
+
+ For example, @requires_linux_version(2, 6, 32) raises SkipTest if the Linux
+ version is less than 2.6.32.
+ """
+ return _requires_unix_version('Linux', min_version)
+
+def requires_mac_ver(*min_version):
+ """Decorator raising SkipTest if the OS is Mac OS X and the OS X
+ version if less than min_version.
+
+ For example, @requires_mac_ver(10, 5) raises SkipTest if the OS X version
+ is lesser than 10.5.
+ """
+ def decorator(func):
+ @functools.wraps(func)
+ def wrapper(*args, **kw):
+ if sys.platform == 'darwin':
+ version_txt = platform.mac_ver()[0]
+ try:
+ version = tuple(map(int, version_txt.split('.')))
+ except ValueError:
+ pass
+ else:
+ if version < min_version:
+ min_version_txt = '.'.join(map(str, min_version))
+ raise unittest.SkipTest(
+ "Mac OS X %s or higher required, not %s"
+ % (min_version_txt, version_txt))
+ return func(*args, **kw)
+ wrapper.min_version = min_version
+ return wrapper
+ return decorator
+
+# Don't use "localhost", since resolving it uses the DNS under recent
+# Windows versions (see issue #18792).
+HOST = "127.0.0.1"
+HOSTv6 = "::1"
+
+
+def find_unused_port(family=socket.AF_INET, socktype=socket.SOCK_STREAM):
+ """Returns an unused port that should be suitable for binding. This is
+ achieved by creating a temporary socket with the same family and type as
+ the 'sock' parameter (default is AF_INET, SOCK_STREAM), and binding it to
+ the specified host address (defaults to 0.0.0.0) with the port set to 0,
+ eliciting an unused ephemeral port from the OS. The temporary socket is
+ then closed and deleted, and the ephemeral port is returned.
+
+ Either this method or bind_port() should be used for any tests where a
+ server socket needs to be bound to a particular port for the duration of
+ the test. Which one to use depends on whether the calling code is creating
+ a python socket, or if an unused port needs to be provided in a constructor
+ or passed to an external program (i.e. the -accept argument to openssl's
+ s_server mode). Always prefer bind_port() over find_unused_port() where
+ possible. Hard coded ports should *NEVER* be used. As soon as a server
+ socket is bound to a hard coded port, the ability to run multiple instances
+ of the test simultaneously on the same host is compromised, which makes the
+ test a ticking time bomb in a buildbot environment. On Unix buildbots, this
+ may simply manifest as a failed test, which can be recovered from without
+ intervention in most cases, but on Windows, the entire python process can
+ completely and utterly wedge, requiring someone to log in to the buildbot
+ and manually kill the affected process.
+
+ (This is easy to reproduce on Windows, unfortunately, and can be traced to
+ the SO_REUSEADDR socket option having different semantics on Windows versus
+ Unix/Linux. On Unix, you can't have two AF_INET SOCK_STREAM sockets bind,
+ listen and then accept connections on identical host/ports. An EADDRINUSE
+ socket.error will be raised at some point (depending on the platform and
+ the order bind and listen were called on each socket).
+
+ However, on Windows, if SO_REUSEADDR is set on the sockets, no EADDRINUSE
+ will ever be raised when attempting to bind two identical host/ports. When
+ accept() is called on each socket, the second caller's process will steal
+ the port from the first caller, leaving them both in an awkwardly wedged
+ state where they'll no longer respond to any signals or graceful kills, and
+ must be forcibly killed via OpenProcess()/TerminateProcess().
+
+ The solution on Windows is to use the SO_EXCLUSIVEADDRUSE socket option
+ instead of SO_REUSEADDR, which effectively affords the same semantics as
+ SO_REUSEADDR on Unix. Given the propensity of Unix developers in the Open
+ Source world compared to Windows ones, this is a common mistake. A quick
+ look over OpenSSL's 0.9.8g source shows that they use SO_REUSEADDR when
+ openssl.exe is called with the 's_server' option, for example. See
+ http://bugs.python.org/issue2550 for more info. The following site also
+ has a very thorough description about the implications of both REUSEADDR
+ and EXCLUSIVEADDRUSE on Windows:
+ http://msdn2.microsoft.com/en-us/library/ms740621(VS.85).aspx)
+
+ XXX: although this approach is a vast improvement on previous attempts to
+ elicit unused ports, it rests heavily on the assumption that the ephemeral
+ port returned to us by the OS won't immediately be dished back out to some
+ other process when we close and delete our temporary socket but before our
+ calling code has a chance to bind the returned port. We can deal with this
+ issue if/when we come across it.
+ """
+
+ tempsock = socket.socket(family, socktype)
+ port = bind_port(tempsock)
+ tempsock.close()
+ del tempsock
+ return port
+
+def bind_port(sock, host=HOST):
+ """Bind the socket to a free port and return the port number. Relies on
+ ephemeral ports in order to ensure we are using an unbound port. This is
+ important as many tests may be running simultaneously, especially in a
+ buildbot environment. This method raises an exception if the sock.family
+ is AF_INET and sock.type is SOCK_STREAM, *and* the socket has SO_REUSEADDR
+ or SO_REUSEPORT set on it. Tests should *never* set these socket options
+ for TCP/IP sockets. The only case for setting these options is testing
+ multicasting via multiple UDP sockets.
+
+ Additionally, if the SO_EXCLUSIVEADDRUSE socket option is available (i.e.
+ on Windows), it will be set on the socket. This will prevent anyone else
+ from bind()'ing to our host/port for the duration of the test.
+ """
+
+ if sock.family == socket.AF_INET and sock.type == socket.SOCK_STREAM:
+ if hasattr(socket, 'SO_REUSEADDR'):
+ if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) == 1:
+ raise TestFailed("tests should never set the SO_REUSEADDR " \
+ "socket option on TCP/IP sockets!")
+ if hasattr(socket, 'SO_REUSEPORT'):
+ try:
+ if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1:
+ raise TestFailed("tests should never set the SO_REUSEPORT " \
+ "socket option on TCP/IP sockets!")
+ except socket.error:
+ # Python's socket module was compiled using modern headers
+ # thus defining SO_REUSEPORT but this process is running
+ # under an older kernel that does not support SO_REUSEPORT.
+ pass
+ if hasattr(socket, 'SO_EXCLUSIVEADDRUSE'):
+ sock.setsockopt(socket.SOL_SOCKET, socket.SO_EXCLUSIVEADDRUSE, 1)
+
+ sock.bind((host, 0))
+ port = sock.getsockname()[1]
+ return port
+
+def _is_ipv6_enabled():
+ """Check whether IPv6 is enabled on this host."""
+ if socket.has_ipv6:
+ sock = None
+ try:
+ sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
+ sock.bind(('::1', 0))
+ return True
+ except (socket.error, socket.gaierror):
+ pass
+ finally:
+ if sock:
+ sock.close()
+ return False
+
+IPV6_ENABLED = _is_ipv6_enabled()
+
+
+# A constant likely larger than the underlying OS pipe buffer size, to
+# make writes blocking.
+# Windows limit seems to be around 512 B, and many Unix kernels have a
+# 64 KiB pipe buffer size or 16 * PAGE_SIZE: take a few megs to be sure.
+# (see issue #17835 for a discussion of this number).
+PIPE_MAX_SIZE = 4 * 1024 * 1024 + 1
+
+# A constant likely larger than the underlying OS socket buffer size, to make
+# writes blocking.
+# The socket buffer sizes can usually be tuned system-wide (e.g. through sysctl
+# on Linux), or on a per-socket basis (SO_SNDBUF/SO_RCVBUF). See issue #18643
+# for a discussion of this number).
+SOCK_MAX_SIZE = 16 * 1024 * 1024 + 1
+
+# # decorator for skipping tests on non-IEEE 754 platforms
+# requires_IEEE_754 = unittest.skipUnless(
+# float.__getformat__("double").startswith("IEEE"),
+# "test requires IEEE 754 doubles")
+
+requires_zlib = unittest.skipUnless(zlib, 'requires zlib')
+
+requires_bz2 = unittest.skipUnless(bz2, 'requires bz2')
+
+requires_lzma = unittest.skipUnless(lzma, 'requires lzma')
+
+is_jython = sys.platform.startswith('java')
+
+# Filename used for testing
+if os.name == 'java':
+ # Jython disallows @ in module names
+ TESTFN = '$test'
+else:
+ TESTFN = '@test'
+
+# Disambiguate TESTFN for parallel testing, while letting it remain a valid
+# module name.
+TESTFN = "{0}_{1}_tmp".format(TESTFN, os.getpid())
+
+# # FS_NONASCII: non-ASCII character encodable by os.fsencode(),
+# # or None if there is no such character.
+# FS_NONASCII = None
+# for character in (
+# # First try printable and common characters to have a readable filename.
+# # For each character, the encoding list are just example of encodings able
+# # to encode the character (the list is not exhaustive).
+#
+# # U+00E6 (Latin Small Letter Ae): cp1252, iso-8859-1
+# '\u00E6',
+# # U+0130 (Latin Capital Letter I With Dot Above): cp1254, iso8859_3
+# '\u0130',
+# # U+0141 (Latin Capital Letter L With Stroke): cp1250, cp1257
+# '\u0141',
+# # U+03C6 (Greek Small Letter Phi): cp1253
+# '\u03C6',
+# # U+041A (Cyrillic Capital Letter Ka): cp1251
+# '\u041A',
+# # U+05D0 (Hebrew Letter Alef): Encodable to cp424
+# '\u05D0',
+# # U+060C (Arabic Comma): cp864, cp1006, iso8859_6, mac_arabic
+# '\u060C',
+# # U+062A (Arabic Letter Teh): cp720
+# '\u062A',
+# # U+0E01 (Thai Character Ko Kai): cp874
+# '\u0E01',
+#
+# # Then try more "special" characters. "special" because they may be
+# # interpreted or displayed differently depending on the exact locale
+# # encoding and the font.
+#
+# # U+00A0 (No-Break Space)
+# '\u00A0',
+# # U+20AC (Euro Sign)
+# '\u20AC',
+# ):
+# try:
+# os.fsdecode(os.fsencode(character))
+# except UnicodeError:
+# pass
+# else:
+# FS_NONASCII = character
+# break
+#
+# # TESTFN_UNICODE is a non-ascii filename
+# TESTFN_UNICODE = TESTFN + "-\xe0\xf2\u0258\u0141\u011f"
+# if sys.platform == 'darwin':
+# # In Mac OS X's VFS API file names are, by definition, canonically
+# # decomposed Unicode, encoded using UTF-8. See QA1173:
+# # http://developer.apple.com/mac/library/qa/qa2001/qa1173.html
+# import unicodedata
+# TESTFN_UNICODE = unicodedata.normalize('NFD', TESTFN_UNICODE)
+# TESTFN_ENCODING = sys.getfilesystemencoding()
+#
+# # TESTFN_UNENCODABLE is a filename (str type) that should *not* be able to be
+# # encoded by the filesystem encoding (in strict mode). It can be None if we
+# # cannot generate such filename.
+# TESTFN_UNENCODABLE = None
+# if os.name in ('nt', 'ce'):
+# # skip win32s (0) or Windows 9x/ME (1)
+# if sys.getwindowsversion().platform >= 2:
+# # Different kinds of characters from various languages to minimize the
+# # probability that the whole name is encodable to MBCS (issue #9819)
+# TESTFN_UNENCODABLE = TESTFN + "-\u5171\u0141\u2661\u0363\uDC80"
+# try:
+# TESTFN_UNENCODABLE.encode(TESTFN_ENCODING)
+# except UnicodeEncodeError:
+# pass
+# else:
+# print('WARNING: The filename %r CAN be encoded by the filesystem encoding (%s). '
+# 'Unicode filename tests may not be effective'
+# % (TESTFN_UNENCODABLE, TESTFN_ENCODING))
+# TESTFN_UNENCODABLE = None
+# # Mac OS X denies unencodable filenames (invalid utf-8)
+# elif sys.platform != 'darwin':
+# try:
+# # ascii and utf-8 cannot encode the byte 0xff
+# b'\xff'.decode(TESTFN_ENCODING)
+# except UnicodeDecodeError:
+# # 0xff will be encoded using the surrogate character u+DCFF
+# TESTFN_UNENCODABLE = TESTFN \
+# + b'-\xff'.decode(TESTFN_ENCODING, 'surrogateescape')
+# else:
+# # File system encoding (eg. ISO-8859-* encodings) can encode
+# # the byte 0xff. Skip some unicode filename tests.
+# pass
+#
+# # TESTFN_UNDECODABLE is a filename (bytes type) that should *not* be able to be
+# # decoded from the filesystem encoding (in strict mode). It can be None if we
+# # cannot generate such filename (ex: the latin1 encoding can decode any byte
+# # sequence). On UNIX, TESTFN_UNDECODABLE can be decoded by os.fsdecode() thanks
+# # to the surrogateescape error handler (PEP 383), but not from the filesystem
+# # encoding in strict mode.
+# TESTFN_UNDECODABLE = None
+# for name in (
+# # b'\xff' is not decodable by os.fsdecode() with code page 932. Windows
+# # accepts it to create a file or a directory, or don't accept to enter to
+# # such directory (when the bytes name is used). So test b'\xe7' first: it is
+# # not decodable from cp932.
+# b'\xe7w\xf0',
+# # undecodable from ASCII, UTF-8
+# b'\xff',
+# # undecodable from iso8859-3, iso8859-6, iso8859-7, cp424, iso8859-8, cp856
+# # and cp857
+# b'\xae\xd5'
+# # undecodable from UTF-8 (UNIX and Mac OS X)
+# b'\xed\xb2\x80', b'\xed\xb4\x80',
+# # undecodable from shift_jis, cp869, cp874, cp932, cp1250, cp1251, cp1252,
+# # cp1253, cp1254, cp1255, cp1257, cp1258
+# b'\x81\x98',
+# ):
+# try:
+# name.decode(TESTFN_ENCODING)
+# except UnicodeDecodeError:
+# TESTFN_UNDECODABLE = os.fsencode(TESTFN) + name
+# break
+#
+# if FS_NONASCII:
+# TESTFN_NONASCII = TESTFN + '-' + FS_NONASCII
+# else:
+# TESTFN_NONASCII = None
+
+# Save the initial cwd
+SAVEDCWD = os.getcwd()
+
+@contextlib.contextmanager
+def temp_cwd(name='tempcwd', quiet=False, path=None):
+ """
+ Context manager that temporarily changes the CWD.
+
+ An existing path may be provided as *path*, in which case this
+ function makes no changes to the file system.
+
+ Otherwise, the new CWD is created in the current directory and it's
+ named *name*. If *quiet* is False (default) and it's not possible to
+ create or change the CWD, an error is raised. If it's True, only a
+ warning is raised and the original CWD is used.
+ """
+ saved_dir = os.getcwd()
+ is_temporary = False
+ if path is None:
+ path = name
+ try:
+ os.mkdir(name)
+ is_temporary = True
+ except OSError:
+ if not quiet:
+ raise
+ warnings.warn('tests may fail, unable to create temp CWD ' + name,
+ RuntimeWarning, stacklevel=3)
+ try:
+ os.chdir(path)
+ except OSError:
+ if not quiet:
+ raise
+ warnings.warn('tests may fail, unable to change the CWD to ' + path,
+ RuntimeWarning, stacklevel=3)
+ try:
+ yield os.getcwd()
+ finally:
+ os.chdir(saved_dir)
+ if is_temporary:
+ rmtree(name)
+
+
+if hasattr(os, "umask"):
+ @contextlib.contextmanager
+ def temp_umask(umask):
+ """Context manager that temporarily sets the process umask."""
+ oldmask = os.umask(umask)
+ try:
+ yield
+ finally:
+ os.umask(oldmask)
+
+
+def findfile(file, here=__file__, subdir=None):
+ """Try to find a file on sys.path and the working directory. If it is not
+ found the argument passed to the function is returned (this does not
+ necessarily signal failure; could still be the legitimate path)."""
+ if os.path.isabs(file):
+ return file
+ if subdir is not None:
+ file = os.path.join(subdir, file)
+ path = sys.path
+ path = [os.path.dirname(here)] + path
+ for dn in path:
+ fn = os.path.join(dn, file)
+ if os.path.exists(fn): return fn
+ return file
+
+def create_empty_file(filename):
+ """Create an empty file. If the file already exists, truncate it."""
+ fd = os.open(filename, os.O_WRONLY | os.O_CREAT | os.O_TRUNC)
+ os.close(fd)
+
+def sortdict(dict):
+ "Like repr(dict), but in sorted order."
+ items = sorted(dict.items())
+ reprpairs = ["%r: %r" % pair for pair in items]
+ withcommas = ", ".join(reprpairs)
+ return "{%s}" % withcommas
+
+def make_bad_fd():
+ """
+ Create an invalid file descriptor by opening and closing a file and return
+ its fd.
+ """
+ file = open(TESTFN, "wb")
+ try:
+ return file.fileno()
+ finally:
+ file.close()
+ unlink(TESTFN)
+
+def check_syntax_error(testcase, statement):
+ testcase.assertRaises(SyntaxError, compile, statement,
+ '', 'exec')
+
+def open_urlresource(url, *args, **kw):
+ from future.backports.urllib import (request as urllib_request,
+ parse as urllib_parse)
+
+ check = kw.pop('check', None)
+
+ filename = urllib_parse.urlparse(url)[2].split('/')[-1] # '/': it's URL!
+
+ fn = os.path.join(os.path.dirname(__file__), "data", filename)
+
+ def check_valid_file(fn):
+ f = open(fn, *args, **kw)
+ if check is None:
+ return f
+ elif check(f):
+ f.seek(0)
+ return f
+ f.close()
+
+ if os.path.exists(fn):
+ f = check_valid_file(fn)
+ if f is not None:
+ return f
+ unlink(fn)
+
+ # Verify the requirement before downloading the file
+ requires('urlfetch')
+
+ print('\tfetching %s ...' % url, file=get_original_stdout())
+ f = urllib_request.urlopen(url, timeout=15)
+ try:
+ with open(fn, "wb") as out:
+ s = f.read()
+ while s:
+ out.write(s)
+ s = f.read()
+ finally:
+ f.close()
+
+ f = check_valid_file(fn)
+ if f is not None:
+ return f
+ raise TestFailed('invalid resource %r' % fn)
+
+
+class WarningsRecorder(object):
+ """Convenience wrapper for the warnings list returned on
+ entry to the warnings.catch_warnings() context manager.
+ """
+ def __init__(self, warnings_list):
+ self._warnings = warnings_list
+ self._last = 0
+
+ def __getattr__(self, attr):
+ if len(self._warnings) > self._last:
+ return getattr(self._warnings[-1], attr)
+ elif attr in warnings.WarningMessage._WARNING_DETAILS:
+ return None
+ raise AttributeError("%r has no attribute %r" % (self, attr))
+
+ @property
+ def warnings(self):
+ return self._warnings[self._last:]
+
+ def reset(self):
+ self._last = len(self._warnings)
+
+
+def _filterwarnings(filters, quiet=False):
+ """Catch the warnings, then check if all the expected
+ warnings have been raised and re-raise unexpected warnings.
+ If 'quiet' is True, only re-raise the unexpected warnings.
+ """
+ # Clear the warning registry of the calling module
+ # in order to re-raise the warnings.
+ frame = sys._getframe(2)
+ registry = frame.f_globals.get('__warningregistry__')
+ if registry:
+ if utils.PY3:
+ registry.clear()
+ else:
+ # Py2-compatible:
+ for i in range(len(registry)):
+ registry.pop()
+ with warnings.catch_warnings(record=True) as w:
+ # Set filter "always" to record all warnings. Because
+ # test_warnings swap the module, we need to look up in
+ # the sys.modules dictionary.
+ sys.modules['warnings'].simplefilter("always")
+ yield WarningsRecorder(w)
+ # Filter the recorded warnings
+ reraise = list(w)
+ missing = []
+ for msg, cat in filters:
+ seen = False
+ for w in reraise[:]:
+ warning = w.message
+ # Filter out the matching messages
+ if (re.match(msg, str(warning), re.I) and
+ issubclass(warning.__class__, cat)):
+ seen = True
+ reraise.remove(w)
+ if not seen and not quiet:
+ # This filter caught nothing
+ missing.append((msg, cat.__name__))
+ if reraise:
+ raise AssertionError("unhandled warning %s" % reraise[0])
+ if missing:
+ raise AssertionError("filter (%r, %s) did not catch any warning" %
+ missing[0])
+
+
+@contextlib.contextmanager
+def check_warnings(*filters, **kwargs):
+ """Context manager to silence warnings.
+
+ Accept 2-tuples as positional arguments:
+ ("message regexp", WarningCategory)
+
+ Optional argument:
+ - if 'quiet' is True, it does not fail if a filter catches nothing
+ (default True without argument,
+ default False if some filters are defined)
+
+ Without argument, it defaults to:
+ check_warnings(("", Warning), quiet=True)
+ """
+ quiet = kwargs.get('quiet')
+ if not filters:
+ filters = (("", Warning),)
+ # Preserve backward compatibility
+ if quiet is None:
+ quiet = True
+ return _filterwarnings(filters, quiet)
+
+
+class CleanImport(object):
+ """Context manager to force import to return a new module reference.
+
+ This is useful for testing module-level behaviours, such as
+ the emission of a DeprecationWarning on import.
+
+ Use like this:
+
+ with CleanImport("foo"):
+ importlib.import_module("foo") # new reference
+ """
+
+ def __init__(self, *module_names):
+ self.original_modules = sys.modules.copy()
+ for module_name in module_names:
+ if module_name in sys.modules:
+ module = sys.modules[module_name]
+ # It is possible that module_name is just an alias for
+ # another module (e.g. stub for modules renamed in 3.x).
+ # In that case, we also need delete the real module to clear
+ # the import cache.
+ if module.__name__ != module_name:
+ del sys.modules[module.__name__]
+ del sys.modules[module_name]
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *ignore_exc):
+ sys.modules.update(self.original_modules)
+
+### Added for python-future:
+if utils.PY3:
+ import collections.abc
+ mybase = collections.abc.MutableMapping
+else:
+ import UserDict
+ mybase = UserDict.DictMixin
+###
+
+class EnvironmentVarGuard(mybase):
+
+ """Class to help protect the environment variable properly. Can be used as
+ a context manager."""
+
+ def __init__(self):
+ self._environ = os.environ
+ self._changed = {}
+
+ def __getitem__(self, envvar):
+ return self._environ[envvar]
+
+ def __setitem__(self, envvar, value):
+ # Remember the initial value on the first access
+ if envvar not in self._changed:
+ self._changed[envvar] = self._environ.get(envvar)
+ self._environ[envvar] = value
+
+ def __delitem__(self, envvar):
+ # Remember the initial value on the first access
+ if envvar not in self._changed:
+ self._changed[envvar] = self._environ.get(envvar)
+ if envvar in self._environ:
+ del self._environ[envvar]
+
+ def keys(self):
+ return self._environ.keys()
+
+ def __iter__(self):
+ return iter(self._environ)
+
+ def __len__(self):
+ return len(self._environ)
+
+ def set(self, envvar, value):
+ self[envvar] = value
+
+ def unset(self, envvar):
+ del self[envvar]
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *ignore_exc):
+ for (k, v) in self._changed.items():
+ if v is None:
+ if k in self._environ:
+ del self._environ[k]
+ else:
+ self._environ[k] = v
+ os.environ = self._environ
+
+
+class DirsOnSysPath(object):
+ """Context manager to temporarily add directories to sys.path.
+
+ This makes a copy of sys.path, appends any directories given
+ as positional arguments, then reverts sys.path to the copied
+ settings when the context ends.
+
+ Note that *all* sys.path modifications in the body of the
+ context manager, including replacement of the object,
+ will be reverted at the end of the block.
+ """
+
+ def __init__(self, *paths):
+ self.original_value = sys.path[:]
+ self.original_object = sys.path
+ sys.path.extend(paths)
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *ignore_exc):
+ sys.path = self.original_object
+ sys.path[:] = self.original_value
+
+
+class TransientResource(object):
+
+ """Raise ResourceDenied if an exception is raised while the context manager
+ is in effect that matches the specified exception and attributes."""
+
+ def __init__(self, exc, **kwargs):
+ self.exc = exc
+ self.attrs = kwargs
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, type_=None, value=None, traceback=None):
+ """If type_ is a subclass of self.exc and value has attributes matching
+ self.attrs, raise ResourceDenied. Otherwise let the exception
+ propagate (if any)."""
+ if type_ is not None and issubclass(self.exc, type_):
+ for attr, attr_value in self.attrs.items():
+ if not hasattr(value, attr):
+ break
+ if getattr(value, attr) != attr_value:
+ break
+ else:
+ raise ResourceDenied("an optional resource is not available")
+
+# Context managers that raise ResourceDenied when various issues
+# with the Internet connection manifest themselves as exceptions.
+# XXX deprecate these and use transient_internet() instead
+time_out = TransientResource(IOError, errno=errno.ETIMEDOUT)
+socket_peer_reset = TransientResource(socket.error, errno=errno.ECONNRESET)
+ioerror_peer_reset = TransientResource(IOError, errno=errno.ECONNRESET)
+
+
+@contextlib.contextmanager
+def transient_internet(resource_name, timeout=30.0, errnos=()):
+ """Return a context manager that raises ResourceDenied when various issues
+ with the Internet connection manifest themselves as exceptions."""
+ default_errnos = [
+ ('ECONNREFUSED', 111),
+ ('ECONNRESET', 104),
+ ('EHOSTUNREACH', 113),
+ ('ENETUNREACH', 101),
+ ('ETIMEDOUT', 110),
+ ]
+ default_gai_errnos = [
+ ('EAI_AGAIN', -3),
+ ('EAI_FAIL', -4),
+ ('EAI_NONAME', -2),
+ ('EAI_NODATA', -5),
+ # Encountered when trying to resolve IPv6-only hostnames
+ ('WSANO_DATA', 11004),
+ ]
+
+ denied = ResourceDenied("Resource %r is not available" % resource_name)
+ captured_errnos = errnos
+ gai_errnos = []
+ if not captured_errnos:
+ captured_errnos = [getattr(errno, name, num)
+ for (name, num) in default_errnos]
+ gai_errnos = [getattr(socket, name, num)
+ for (name, num) in default_gai_errnos]
+
+ def filter_error(err):
+ n = getattr(err, 'errno', None)
+ if (isinstance(err, socket.timeout) or
+ (isinstance(err, socket.gaierror) and n in gai_errnos) or
+ n in captured_errnos):
+ if not verbose:
+ sys.stderr.write(denied.args[0] + "\n")
+ # Was: raise denied from err
+ # For Python-Future:
+ exc = denied
+ exc.__cause__ = err
+ raise exc
+
+ old_timeout = socket.getdefaulttimeout()
+ try:
+ if timeout is not None:
+ socket.setdefaulttimeout(timeout)
+ yield
+ except IOError as err:
+ # urllib can wrap original socket errors multiple times (!), we must
+ # unwrap to get at the original error.
+ while True:
+ a = err.args
+ if len(a) >= 1 and isinstance(a[0], IOError):
+ err = a[0]
+ # The error can also be wrapped as args[1]:
+ # except socket.error as msg:
+ # raise IOError('socket error', msg).with_traceback(sys.exc_info()[2])
+ elif len(a) >= 2 and isinstance(a[1], IOError):
+ err = a[1]
+ else:
+ break
+ filter_error(err)
+ raise
+ # XXX should we catch generic exceptions and look for their
+ # __cause__ or __context__?
+ finally:
+ socket.setdefaulttimeout(old_timeout)
+
+
+@contextlib.contextmanager
+def captured_output(stream_name):
+ """Return a context manager used by captured_stdout/stdin/stderr
+ that temporarily replaces the sys stream *stream_name* with a StringIO."""
+ import io
+ orig_stdout = getattr(sys, stream_name)
+ setattr(sys, stream_name, io.StringIO())
+ try:
+ yield getattr(sys, stream_name)
+ finally:
+ setattr(sys, stream_name, orig_stdout)
+
+def captured_stdout():
+ """Capture the output of sys.stdout:
+
+ with captured_stdout() as s:
+ print("hello")
+ self.assertEqual(s.getvalue(), "hello")
+ """
+ return captured_output("stdout")
+
+def captured_stderr():
+ return captured_output("stderr")
+
+def captured_stdin():
+ return captured_output("stdin")
+
+
+def gc_collect():
+ """Force as many objects as possible to be collected.
+
+ In non-CPython implementations of Python, this is needed because timely
+ deallocation is not guaranteed by the garbage collector. (Even in CPython
+ this can be the case in case of reference cycles.) This means that __del__
+ methods may be called later than expected and weakrefs may remain alive for
+ longer than expected. This function tries its best to force all garbage
+ objects to disappear.
+ """
+ gc.collect()
+ if is_jython:
+ time.sleep(0.1)
+ gc.collect()
+ gc.collect()
+
+@contextlib.contextmanager
+def disable_gc():
+ have_gc = gc.isenabled()
+ gc.disable()
+ try:
+ yield
+ finally:
+ if have_gc:
+ gc.enable()
+
+
+def python_is_optimized():
+ """Find if Python was built with optimizations."""
+ # We don't have sysconfig on Py2.6:
+ import sysconfig
+ cflags = sysconfig.get_config_var('PY_CFLAGS') or ''
+ final_opt = ""
+ for opt in cflags.split():
+ if opt.startswith('-O'):
+ final_opt = opt
+ return final_opt != '' and final_opt != '-O0'
+
+
+_header = 'nP'
+_align = '0n'
+if hasattr(sys, "gettotalrefcount"):
+ _header = '2P' + _header
+ _align = '0P'
+_vheader = _header + 'n'
+
+def calcobjsize(fmt):
+ return struct.calcsize(_header + fmt + _align)
+
+def calcvobjsize(fmt):
+ return struct.calcsize(_vheader + fmt + _align)
+
+
+_TPFLAGS_HAVE_GC = 1<<14
+_TPFLAGS_HEAPTYPE = 1<<9
+
+def check_sizeof(test, o, size):
+ result = sys.getsizeof(o)
+ # add GC header size
+ if ((type(o) == type) and (o.__flags__ & _TPFLAGS_HEAPTYPE) or\
+ ((type(o) != type) and (type(o).__flags__ & _TPFLAGS_HAVE_GC))):
+ size += _testcapi.SIZEOF_PYGC_HEAD
+ msg = 'wrong size for %s: got %d, expected %d' \
+ % (type(o), result, size)
+ test.assertEqual(result, size, msg)
+
+#=======================================================================
+# Decorator for running a function in a different locale, correctly resetting
+# it afterwards.
+
+def run_with_locale(catstr, *locales):
+ def decorator(func):
+ def inner(*args, **kwds):
+ try:
+ import locale
+ category = getattr(locale, catstr)
+ orig_locale = locale.setlocale(category)
+ except AttributeError:
+ # if the test author gives us an invalid category string
+ raise
+ except:
+ # cannot retrieve original locale, so do nothing
+ locale = orig_locale = None
+ else:
+ for loc in locales:
+ try:
+ locale.setlocale(category, loc)
+ break
+ except:
+ pass
+
+ # now run the function, resetting the locale on exceptions
+ try:
+ return func(*args, **kwds)
+ finally:
+ if locale and orig_locale:
+ locale.setlocale(category, orig_locale)
+ inner.__name__ = func.__name__
+ inner.__doc__ = func.__doc__
+ return inner
+ return decorator
+
+#=======================================================================
+# Decorator for running a function in a specific timezone, correctly
+# resetting it afterwards.
+
+def run_with_tz(tz):
+ def decorator(func):
+ def inner(*args, **kwds):
+ try:
+ tzset = time.tzset
+ except AttributeError:
+ raise unittest.SkipTest("tzset required")
+ if 'TZ' in os.environ:
+ orig_tz = os.environ['TZ']
+ else:
+ orig_tz = None
+ os.environ['TZ'] = tz
+ tzset()
+
+ # now run the function, resetting the tz on exceptions
+ try:
+ return func(*args, **kwds)
+ finally:
+ if orig_tz is None:
+ del os.environ['TZ']
+ else:
+ os.environ['TZ'] = orig_tz
+ time.tzset()
+
+ inner.__name__ = func.__name__
+ inner.__doc__ = func.__doc__
+ return inner
+ return decorator
+
+#=======================================================================
+# Big-memory-test support. Separate from 'resources' because memory use
+# should be configurable.
+
+# Some handy shorthands. Note that these are used for byte-limits as well
+# as size-limits, in the various bigmem tests
+_1M = 1024*1024
+_1G = 1024 * _1M
+_2G = 2 * _1G
+_4G = 4 * _1G
+
+MAX_Py_ssize_t = sys.maxsize
+
+def set_memlimit(limit):
+ global max_memuse
+ global real_max_memuse
+ sizes = {
+ 'k': 1024,
+ 'm': _1M,
+ 'g': _1G,
+ 't': 1024*_1G,
+ }
+ m = re.match(r'(\d+(\.\d+)?) (K|M|G|T)b?$', limit,
+ re.IGNORECASE | re.VERBOSE)
+ if m is None:
+ raise ValueError('Invalid memory limit %r' % (limit,))
+ memlimit = int(float(m.group(1)) * sizes[m.group(3).lower()])
+ real_max_memuse = memlimit
+ if memlimit > MAX_Py_ssize_t:
+ memlimit = MAX_Py_ssize_t
+ if memlimit < _2G - 1:
+ raise ValueError('Memory limit %r too low to be useful' % (limit,))
+ max_memuse = memlimit
+
+class _MemoryWatchdog(object):
+ """An object which periodically watches the process' memory consumption
+ and prints it out.
+ """
+
+ def __init__(self):
+ self.procfile = '/proc/{pid}/statm'.format(pid=os.getpid())
+ self.started = False
+
+ def start(self):
+ try:
+ f = open(self.procfile, 'r')
+ except OSError as e:
+ warnings.warn('/proc not available for stats: {0}'.format(e),
+ RuntimeWarning)
+ sys.stderr.flush()
+ return
+
+ watchdog_script = findfile("memory_watchdog.py")
+ self.mem_watchdog = subprocess.Popen([sys.executable, watchdog_script],
+ stdin=f, stderr=subprocess.DEVNULL)
+ f.close()
+ self.started = True
+
+ def stop(self):
+ if self.started:
+ self.mem_watchdog.terminate()
+ self.mem_watchdog.wait()
+
+
+def bigmemtest(size, memuse, dry_run=True):
+ """Decorator for bigmem tests.
+
+ 'minsize' is the minimum useful size for the test (in arbitrary,
+ test-interpreted units.) 'memuse' is the number of 'bytes per size' for
+ the test, or a good estimate of it.
+
+ if 'dry_run' is False, it means the test doesn't support dummy runs
+ when -M is not specified.
+ """
+ def decorator(f):
+ def wrapper(self):
+ size = wrapper.size
+ memuse = wrapper.memuse
+ if not real_max_memuse:
+ maxsize = 5147
+ else:
+ maxsize = size
+
+ if ((real_max_memuse or not dry_run)
+ and real_max_memuse < maxsize * memuse):
+ raise unittest.SkipTest(
+ "not enough memory: %.1fG minimum needed"
+ % (size * memuse / (1024 ** 3)))
+
+ if real_max_memuse and verbose:
+ print()
+ print(" ... expected peak memory use: {peak:.1f}G"
+ .format(peak=size * memuse / (1024 ** 3)))
+ watchdog = _MemoryWatchdog()
+ watchdog.start()
+ else:
+ watchdog = None
+
+ try:
+ return f(self, maxsize)
+ finally:
+ if watchdog:
+ watchdog.stop()
+
+ wrapper.size = size
+ wrapper.memuse = memuse
+ return wrapper
+ return decorator
+
+def bigaddrspacetest(f):
+ """Decorator for tests that fill the address space."""
+ def wrapper(self):
+ if max_memuse < MAX_Py_ssize_t:
+ if MAX_Py_ssize_t >= 2**63 - 1 and max_memuse >= 2**31:
+ raise unittest.SkipTest(
+ "not enough memory: try a 32-bit build instead")
+ else:
+ raise unittest.SkipTest(
+ "not enough memory: %.1fG minimum needed"
+ % (MAX_Py_ssize_t / (1024 ** 3)))
+ else:
+ return f(self)
+ return wrapper
+
+#=======================================================================
+# unittest integration.
+
+class BasicTestRunner(object):
+ def run(self, test):
+ result = unittest.TestResult()
+ test(result)
+ return result
+
+def _id(obj):
+ return obj
+
+def requires_resource(resource):
+ if resource == 'gui' and not _is_gui_available():
+ return unittest.skip("resource 'gui' is not available")
+ if is_resource_enabled(resource):
+ return _id
+ else:
+ return unittest.skip("resource {0!r} is not enabled".format(resource))
+
+def cpython_only(test):
+ """
+ Decorator for tests only applicable on CPython.
+ """
+ return impl_detail(cpython=True)(test)
+
+def impl_detail(msg=None, **guards):
+ if check_impl_detail(**guards):
+ return _id
+ if msg is None:
+ guardnames, default = _parse_guards(guards)
+ if default:
+ msg = "implementation detail not available on {0}"
+ else:
+ msg = "implementation detail specific to {0}"
+ guardnames = sorted(guardnames.keys())
+ msg = msg.format(' or '.join(guardnames))
+ return unittest.skip(msg)
+
+def _parse_guards(guards):
+ # Returns a tuple ({platform_name: run_me}, default_value)
+ if not guards:
+ return ({'cpython': True}, False)
+ is_true = list(guards.values())[0]
+ assert list(guards.values()) == [is_true] * len(guards) # all True or all False
+ return (guards, not is_true)
+
+# Use the following check to guard CPython's implementation-specific tests --
+# or to run them only on the implementation(s) guarded by the arguments.
+def check_impl_detail(**guards):
+ """This function returns True or False depending on the host platform.
+ Examples:
+ if check_impl_detail(): # only on CPython (default)
+ if check_impl_detail(jython=True): # only on Jython
+ if check_impl_detail(cpython=False): # everywhere except on CPython
+ """
+ guards, default = _parse_guards(guards)
+ return guards.get(platform.python_implementation().lower(), default)
+
+
+def no_tracing(func):
+ """Decorator to temporarily turn off tracing for the duration of a test."""
+ if not hasattr(sys, 'gettrace'):
+ return func
+ else:
+ @functools.wraps(func)
+ def wrapper(*args, **kwargs):
+ original_trace = sys.gettrace()
+ try:
+ sys.settrace(None)
+ return func(*args, **kwargs)
+ finally:
+ sys.settrace(original_trace)
+ return wrapper
+
+
+def refcount_test(test):
+ """Decorator for tests which involve reference counting.
+
+ To start, the decorator does not run the test if is not run by CPython.
+ After that, any trace function is unset during the test to prevent
+ unexpected refcounts caused by the trace function.
+
+ """
+ return no_tracing(cpython_only(test))
+
+
+def _filter_suite(suite, pred):
+ """Recursively filter test cases in a suite based on a predicate."""
+ newtests = []
+ for test in suite._tests:
+ if isinstance(test, unittest.TestSuite):
+ _filter_suite(test, pred)
+ newtests.append(test)
+ else:
+ if pred(test):
+ newtests.append(test)
+ suite._tests = newtests
+
+def _run_suite(suite):
+ """Run tests from a unittest.TestSuite-derived class."""
+ if verbose:
+ runner = unittest.TextTestRunner(sys.stdout, verbosity=2,
+ failfast=failfast)
+ else:
+ runner = BasicTestRunner()
+
+ result = runner.run(suite)
+ if not result.wasSuccessful():
+ if len(result.errors) == 1 and not result.failures:
+ err = result.errors[0][1]
+ elif len(result.failures) == 1 and not result.errors:
+ err = result.failures[0][1]
+ else:
+ err = "multiple errors occurred"
+ if not verbose: err += "; run in verbose mode for details"
+ raise TestFailed(err)
+
+
+def run_unittest(*classes):
+ """Run tests from unittest.TestCase-derived classes."""
+ valid_types = (unittest.TestSuite, unittest.TestCase)
+ suite = unittest.TestSuite()
+ for cls in classes:
+ if isinstance(cls, str):
+ if cls in sys.modules:
+ suite.addTest(unittest.findTestCases(sys.modules[cls]))
+ else:
+ raise ValueError("str arguments must be keys in sys.modules")
+ elif isinstance(cls, valid_types):
+ suite.addTest(cls)
+ else:
+ suite.addTest(unittest.makeSuite(cls))
+ def case_pred(test):
+ if match_tests is None:
+ return True
+ for name in test.id().split("."):
+ if fnmatch.fnmatchcase(name, match_tests):
+ return True
+ return False
+ _filter_suite(suite, case_pred)
+ _run_suite(suite)
+
+# We don't have sysconfig on Py2.6:
+# #=======================================================================
+# # Check for the presence of docstrings.
+#
+# HAVE_DOCSTRINGS = (check_impl_detail(cpython=False) or
+# sys.platform == 'win32' or
+# sysconfig.get_config_var('WITH_DOC_STRINGS'))
+#
+# requires_docstrings = unittest.skipUnless(HAVE_DOCSTRINGS,
+# "test requires docstrings")
+#
+#
+# #=======================================================================
+# doctest driver.
+
+def run_doctest(module, verbosity=None, optionflags=0):
+ """Run doctest on the given module. Return (#failures, #tests).
+
+ If optional argument verbosity is not specified (or is None), pass
+ support's belief about verbosity on to doctest. Else doctest's
+ usual behavior is used (it searches sys.argv for -v).
+ """
+
+ import doctest
+
+ if verbosity is None:
+ verbosity = verbose
+ else:
+ verbosity = None
+
+ f, t = doctest.testmod(module, verbose=verbosity, optionflags=optionflags)
+ if f:
+ raise TestFailed("%d of %d doctests failed" % (f, t))
+ if verbose:
+ print('doctest (%s) ... %d tests with zero failures' %
+ (module.__name__, t))
+ return f, t
+
+
+#=======================================================================
+# Support for saving and restoring the imported modules.
+
+def modules_setup():
+ return sys.modules.copy(),
+
+def modules_cleanup(oldmodules):
+ # Encoders/decoders are registered permanently within the internal
+ # codec cache. If we destroy the corresponding modules their
+ # globals will be set to None which will trip up the cached functions.
+ encodings = [(k, v) for k, v in sys.modules.items()
+ if k.startswith('encodings.')]
+ # Was:
+ # sys.modules.clear()
+ # Py2-compatible:
+ for i in range(len(sys.modules)):
+ sys.modules.pop()
+
+ sys.modules.update(encodings)
+ # XXX: This kind of problem can affect more than just encodings. In particular
+ # extension modules (such as _ssl) don't cope with reloading properly.
+ # Really, test modules should be cleaning out the test specific modules they
+ # know they added (ala test_runpy) rather than relying on this function (as
+ # test_importhooks and test_pkg do currently).
+ # Implicitly imported *real* modules should be left alone (see issue 10556).
+ sys.modules.update(oldmodules)
+
+#=======================================================================
+# Backported versions of threading_setup() and threading_cleanup() which don't refer
+# to threading._dangling (not available on Py2.7).
+
+# Threading support to prevent reporting refleaks when running regrtest.py -R
+
+# NOTE: we use thread._count() rather than threading.enumerate() (or the
+# moral equivalent thereof) because a threading.Thread object is still alive
+# until its __bootstrap() method has returned, even after it has been
+# unregistered from the threading module.
+# thread._count(), on the other hand, only gets decremented *after* the
+# __bootstrap() method has returned, which gives us reliable reference counts
+# at the end of a test run.
+
+def threading_setup():
+ if _thread:
+ return _thread._count(),
+ else:
+ return 1,
+
+def threading_cleanup(nb_threads):
+ if not _thread:
+ return
+
+ _MAX_COUNT = 10
+ for count in range(_MAX_COUNT):
+ n = _thread._count()
+ if n == nb_threads:
+ break
+ time.sleep(0.1)
+ # XXX print a warning in case of failure?
+
+def reap_threads(func):
+ """Use this function when threads are being used. This will
+ ensure that the threads are cleaned up even when the test fails.
+ If threading is unavailable this function does nothing.
+ """
+ if not _thread:
+ return func
+
+ @functools.wraps(func)
+ def decorator(*args):
+ key = threading_setup()
+ try:
+ return func(*args)
+ finally:
+ threading_cleanup(*key)
+ return decorator
+
+def reap_children():
+ """Use this function at the end of test_main() whenever sub-processes
+ are started. This will help ensure that no extra children (zombies)
+ stick around to hog resources and create problems when looking
+ for refleaks.
+ """
+
+ # Reap all our dead child processes so we don't leave zombies around.
+ # These hog resources and might be causing some of the buildbots to die.
+ if hasattr(os, 'waitpid'):
+ any_process = -1
+ while True:
+ try:
+ # This will raise an exception on Windows. That's ok.
+ pid, status = os.waitpid(any_process, os.WNOHANG)
+ if pid == 0:
+ break
+ except:
+ break
+
+@contextlib.contextmanager
+def swap_attr(obj, attr, new_val):
+ """Temporary swap out an attribute with a new object.
+
+ Usage:
+ with swap_attr(obj, "attr", 5):
+ ...
+
+ This will set obj.attr to 5 for the duration of the with: block,
+ restoring the old value at the end of the block. If `attr` doesn't
+ exist on `obj`, it will be created and then deleted at the end of the
+ block.
+ """
+ if hasattr(obj, attr):
+ real_val = getattr(obj, attr)
+ setattr(obj, attr, new_val)
+ try:
+ yield
+ finally:
+ setattr(obj, attr, real_val)
+ else:
+ setattr(obj, attr, new_val)
+ try:
+ yield
+ finally:
+ delattr(obj, attr)
+
+@contextlib.contextmanager
+def swap_item(obj, item, new_val):
+ """Temporary swap out an item with a new object.
+
+ Usage:
+ with swap_item(obj, "item", 5):
+ ...
+
+ This will set obj["item"] to 5 for the duration of the with: block,
+ restoring the old value at the end of the block. If `item` doesn't
+ exist on `obj`, it will be created and then deleted at the end of the
+ block.
+ """
+ if item in obj:
+ real_val = obj[item]
+ obj[item] = new_val
+ try:
+ yield
+ finally:
+ obj[item] = real_val
+ else:
+ obj[item] = new_val
+ try:
+ yield
+ finally:
+ del obj[item]
+
+def strip_python_stderr(stderr):
+ """Strip the stderr of a Python process from potential debug output
+ emitted by the interpreter.
+
+ This will typically be run on the result of the communicate() method
+ of a subprocess.Popen object.
+ """
+ stderr = re.sub(br"\[\d+ refs\]\r?\n?", b"", stderr).strip()
+ return stderr
+
+def args_from_interpreter_flags():
+ """Return a list of command-line arguments reproducing the current
+ settings in sys.flags and sys.warnoptions."""
+ return subprocess._args_from_interpreter_flags()
+
+#============================================================
+# Support for assertions about logging.
+#============================================================
+
+class TestHandler(logging.handlers.BufferingHandler):
+ def __init__(self, matcher):
+ # BufferingHandler takes a "capacity" argument
+ # so as to know when to flush. As we're overriding
+ # shouldFlush anyway, we can set a capacity of zero.
+ # You can call flush() manually to clear out the
+ # buffer.
+ logging.handlers.BufferingHandler.__init__(self, 0)
+ self.matcher = matcher
+
+ def shouldFlush(self):
+ return False
+
+ def emit(self, record):
+ self.format(record)
+ self.buffer.append(record.__dict__)
+
+ def matches(self, **kwargs):
+ """
+ Look for a saved dict whose keys/values match the supplied arguments.
+ """
+ result = False
+ for d in self.buffer:
+ if self.matcher.matches(d, **kwargs):
+ result = True
+ break
+ return result
+
+class Matcher(object):
+
+ _partial_matches = ('msg', 'message')
+
+ def matches(self, d, **kwargs):
+ """
+ Try to match a single dict with the supplied arguments.
+
+ Keys whose values are strings and which are in self._partial_matches
+ will be checked for partial (i.e. substring) matches. You can extend
+ this scheme to (for example) do regular expression matching, etc.
+ """
+ result = True
+ for k in kwargs:
+ v = kwargs[k]
+ dv = d.get(k)
+ if not self.match_value(k, dv, v):
+ result = False
+ break
+ return result
+
+ def match_value(self, k, dv, v):
+ """
+ Try to match a single stored value (dv) with a supplied value (v).
+ """
+ if type(v) != type(dv):
+ result = False
+ elif type(dv) is not str or k not in self._partial_matches:
+ result = (v == dv)
+ else:
+ result = dv.find(v) >= 0
+ return result
+
+
+_can_symlink = None
+def can_symlink():
+ global _can_symlink
+ if _can_symlink is not None:
+ return _can_symlink
+ symlink_path = TESTFN + "can_symlink"
+ try:
+ os.symlink(TESTFN, symlink_path)
+ can = True
+ except (OSError, NotImplementedError, AttributeError):
+ can = False
+ else:
+ os.remove(symlink_path)
+ _can_symlink = can
+ return can
+
+def skip_unless_symlink(test):
+ """Skip decorator for tests that require functional symlink"""
+ ok = can_symlink()
+ msg = "Requires functional symlink implementation"
+ return test if ok else unittest.skip(msg)(test)
+
+_can_xattr = None
+def can_xattr():
+ global _can_xattr
+ if _can_xattr is not None:
+ return _can_xattr
+ if not hasattr(os, "setxattr"):
+ can = False
+ else:
+ tmp_fp, tmp_name = tempfile.mkstemp()
+ try:
+ with open(TESTFN, "wb") as fp:
+ try:
+ # TESTFN & tempfile may use different file systems with
+ # different capabilities
+ os.setxattr(tmp_fp, b"user.test", b"")
+ os.setxattr(fp.fileno(), b"user.test", b"")
+ # Kernels < 2.6.39 don't respect setxattr flags.
+ kernel_version = platform.release()
+ m = re.match("2.6.(\d{1,2})", kernel_version)
+ can = m is None or int(m.group(1)) >= 39
+ except OSError:
+ can = False
+ finally:
+ unlink(TESTFN)
+ unlink(tmp_name)
+ _can_xattr = can
+ return can
+
+def skip_unless_xattr(test):
+ """Skip decorator for tests that require functional extended attributes"""
+ ok = can_xattr()
+ msg = "no non-broken extended attribute support"
+ return test if ok else unittest.skip(msg)(test)
+
+
+if sys.platform.startswith('win'):
+ @contextlib.contextmanager
+ def suppress_crash_popup():
+ """Disable Windows Error Reporting dialogs using SetErrorMode."""
+ # see http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621%28v=vs.85%29.aspx
+ # GetErrorMode is not available on Windows XP and Windows Server 2003,
+ # but SetErrorMode returns the previous value, so we can use that
+ import ctypes
+ k32 = ctypes.windll.kernel32
+ SEM_NOGPFAULTERRORBOX = 0x02
+ old_error_mode = k32.SetErrorMode(SEM_NOGPFAULTERRORBOX)
+ k32.SetErrorMode(old_error_mode | SEM_NOGPFAULTERRORBOX)
+ try:
+ yield
+ finally:
+ k32.SetErrorMode(old_error_mode)
+else:
+ # this is a no-op for other platforms
+ @contextlib.contextmanager
+ def suppress_crash_popup():
+ yield
+
+
+def patch(test_instance, object_to_patch, attr_name, new_value):
+ """Override 'object_to_patch'.'attr_name' with 'new_value'.
+
+ Also, add a cleanup procedure to 'test_instance' to restore
+ 'object_to_patch' value for 'attr_name'.
+ The 'attr_name' should be a valid attribute for 'object_to_patch'.
+
+ """
+ # check that 'attr_name' is a real attribute for 'object_to_patch'
+ # will raise AttributeError if it does not exist
+ getattr(object_to_patch, attr_name)
+
+ # keep a copy of the old value
+ attr_is_local = False
+ try:
+ old_value = object_to_patch.__dict__[attr_name]
+ except (AttributeError, KeyError):
+ old_value = getattr(object_to_patch, attr_name, None)
+ else:
+ attr_is_local = True
+
+ # restore the value when the test is done
+ def cleanup():
+ if attr_is_local:
+ setattr(object_to_patch, attr_name, old_value)
+ else:
+ delattr(object_to_patch, attr_name)
+
+ test_instance.addCleanup(cleanup)
+
+ # actually override the attribute
+ setattr(object_to_patch, attr_name, new_value)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/total_ordering.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/total_ordering.py
new file mode 100644
index 0000000..760f06d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/total_ordering.py
@@ -0,0 +1,38 @@
+"""
+For Python < 2.7.2. total_ordering in versions prior to 2.7.2 is buggy.
+See http://bugs.python.org/issue10042 for details. For these versions use
+code borrowed from Python 2.7.3.
+
+From django.utils.
+"""
+
+import sys
+if sys.version_info >= (2, 7, 2):
+ from functools import total_ordering
+else:
+ def total_ordering(cls):
+ """Class decorator that fills in missing ordering methods"""
+ convert = {
+ '__lt__': [('__gt__', lambda self, other: not (self < other or self == other)),
+ ('__le__', lambda self, other: self < other or self == other),
+ ('__ge__', lambda self, other: not self < other)],
+ '__le__': [('__ge__', lambda self, other: not self <= other or self == other),
+ ('__lt__', lambda self, other: self <= other and not self == other),
+ ('__gt__', lambda self, other: not self <= other)],
+ '__gt__': [('__lt__', lambda self, other: not (self > other or self == other)),
+ ('__ge__', lambda self, other: self > other or self == other),
+ ('__le__', lambda self, other: not self > other)],
+ '__ge__': [('__le__', lambda self, other: (not self >= other) or self == other),
+ ('__gt__', lambda self, other: self >= other and not self == other),
+ ('__lt__', lambda self, other: not self >= other)]
+ }
+ roots = set(dir(cls)) & set(convert)
+ if not roots:
+ raise ValueError('must define at least one ordering operation: < > <= >=')
+ root = max(roots) # prefer __lt__ to __le__ to __gt__ to __ge__
+ for opname, opfunc in convert[root]:
+ if opname not in roots:
+ opfunc.__name__ = opname
+ opfunc.__doc__ = getattr(int, opname).__doc__
+ setattr(cls, opname, opfunc)
+ return cls
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/urllib/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/urllib/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/urllib/error.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/urllib/error.py
new file mode 100644
index 0000000..a473e44
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/urllib/error.py
@@ -0,0 +1,75 @@
+"""Exception classes raised by urllib.
+
+The base exception class is URLError, which inherits from IOError. It
+doesn't define any behavior of its own, but is the base class for all
+exceptions defined in this package.
+
+HTTPError is an exception class that is also a valid HTTP response
+instance. It behaves this way because HTTP protocol errors are valid
+responses, with a status code, headers, and a body. In some contexts,
+an application may want to handle an exception like a regular
+response.
+"""
+from __future__ import absolute_import, division, unicode_literals
+from future import standard_library
+
+from future.backports.urllib import response as urllib_response
+
+
+__all__ = ['URLError', 'HTTPError', 'ContentTooShortError']
+
+
+# do these error classes make sense?
+# make sure all of the IOError stuff is overridden. we just want to be
+# subtypes.
+
+class URLError(IOError):
+ # URLError is a sub-type of IOError, but it doesn't share any of
+ # the implementation. need to override __init__ and __str__.
+ # It sets self.args for compatibility with other EnvironmentError
+ # subclasses, but args doesn't have the typical format with errno in
+ # slot 0 and strerror in slot 1. This may be better than nothing.
+ def __init__(self, reason, filename=None):
+ self.args = reason,
+ self.reason = reason
+ if filename is not None:
+ self.filename = filename
+
+ def __str__(self):
+ return '' % self.reason
+
+class HTTPError(URLError, urllib_response.addinfourl):
+ """Raised when HTTP error occurs, but also acts like non-error return"""
+ __super_init = urllib_response.addinfourl.__init__
+
+ def __init__(self, url, code, msg, hdrs, fp):
+ self.code = code
+ self.msg = msg
+ self.hdrs = hdrs
+ self.fp = fp
+ self.filename = url
+ # The addinfourl classes depend on fp being a valid file
+ # object. In some cases, the HTTPError may not have a valid
+ # file object. If this happens, the simplest workaround is to
+ # not initialize the base classes.
+ if fp is not None:
+ self.__super_init(fp, hdrs, url, code)
+
+ def __str__(self):
+ return 'HTTP Error %s: %s' % (self.code, self.msg)
+
+ # since URLError specifies a .reason attribute, HTTPError should also
+ # provide this attribute. See issue13211 for discussion.
+ @property
+ def reason(self):
+ return self.msg
+
+ def info(self):
+ return self.hdrs
+
+
+# exception raised when downloaded size does not match content-length
+class ContentTooShortError(URLError):
+ def __init__(self, message, content):
+ URLError.__init__(self, message)
+ self.content = content
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/urllib/parse.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/urllib/parse.py
new file mode 100644
index 0000000..ada2f8b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/urllib/parse.py
@@ -0,0 +1,991 @@
+"""
+Ported using Python-Future from the Python 3.3 standard library.
+
+Parse (absolute and relative) URLs.
+
+urlparse module is based upon the following RFC specifications.
+
+RFC 3986 (STD66): "Uniform Resource Identifiers" by T. Berners-Lee, R. Fielding
+and L. Masinter, January 2005.
+
+RFC 2732 : "Format for Literal IPv6 Addresses in URL's by R.Hinden, B.Carpenter
+and L.Masinter, December 1999.
+
+RFC 2396: "Uniform Resource Identifiers (URI)": Generic Syntax by T.
+Berners-Lee, R. Fielding, and L. Masinter, August 1998.
+
+RFC 2368: "The mailto URL scheme", by P.Hoffman , L Masinter, J. Zawinski, July 1998.
+
+RFC 1808: "Relative Uniform Resource Locators", by R. Fielding, UC Irvine, June
+1995.
+
+RFC 1738: "Uniform Resource Locators (URL)" by T. Berners-Lee, L. Masinter, M.
+McCahill, December 1994
+
+RFC 3986 is considered the current standard and any future changes to
+urlparse module should conform with it. The urlparse module is
+currently not entirely compliant with this RFC due to defacto
+scenarios for parsing, and for backward compatibility purposes, some
+parsing quirks from older RFCs are retained. The testcases in
+test_urlparse.py provides a good indicator of parsing behavior.
+"""
+from __future__ import absolute_import, division, unicode_literals
+from future.builtins import bytes, chr, dict, int, range, str
+from future.utils import raise_with_traceback
+
+import re
+import sys
+import collections
+
+__all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag",
+ "urlsplit", "urlunsplit", "urlencode", "parse_qs",
+ "parse_qsl", "quote", "quote_plus", "quote_from_bytes",
+ "unquote", "unquote_plus", "unquote_to_bytes"]
+
+# A classification of schemes ('' means apply by default)
+uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap',
+ 'wais', 'file', 'https', 'shttp', 'mms',
+ 'prospero', 'rtsp', 'rtspu', '', 'sftp',
+ 'svn', 'svn+ssh']
+uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet',
+ 'imap', 'wais', 'file', 'mms', 'https', 'shttp',
+ 'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', '',
+ 'svn', 'svn+ssh', 'sftp', 'nfs', 'git', 'git+ssh']
+uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap',
+ 'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips',
+ 'mms', '', 'sftp', 'tel']
+
+# These are not actually used anymore, but should stay for backwards
+# compatibility. (They are undocumented, but have a public-looking name.)
+non_hierarchical = ['gopher', 'hdl', 'mailto', 'news',
+ 'telnet', 'wais', 'imap', 'snews', 'sip', 'sips']
+uses_query = ['http', 'wais', 'imap', 'https', 'shttp', 'mms',
+ 'gopher', 'rtsp', 'rtspu', 'sip', 'sips', '']
+uses_fragment = ['ftp', 'hdl', 'http', 'gopher', 'news',
+ 'nntp', 'wais', 'https', 'shttp', 'snews',
+ 'file', 'prospero', '']
+
+# Characters valid in scheme names
+scheme_chars = ('abcdefghijklmnopqrstuvwxyz'
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ '0123456789'
+ '+-.')
+
+# XXX: Consider replacing with functools.lru_cache
+MAX_CACHE_SIZE = 20
+_parse_cache = {}
+
+def clear_cache():
+ """Clear the parse cache and the quoters cache."""
+ _parse_cache.clear()
+ _safe_quoters.clear()
+
+
+# Helpers for bytes handling
+# For 3.2, we deliberately require applications that
+# handle improperly quoted URLs to do their own
+# decoding and encoding. If valid use cases are
+# presented, we may relax this by using latin-1
+# decoding internally for 3.3
+_implicit_encoding = 'ascii'
+_implicit_errors = 'strict'
+
+def _noop(obj):
+ return obj
+
+def _encode_result(obj, encoding=_implicit_encoding,
+ errors=_implicit_errors):
+ return obj.encode(encoding, errors)
+
+def _decode_args(args, encoding=_implicit_encoding,
+ errors=_implicit_errors):
+ return tuple(x.decode(encoding, errors) if x else '' for x in args)
+
+def _coerce_args(*args):
+ # Invokes decode if necessary to create str args
+ # and returns the coerced inputs along with
+ # an appropriate result coercion function
+ # - noop for str inputs
+ # - encoding function otherwise
+ str_input = isinstance(args[0], str)
+ for arg in args[1:]:
+ # We special-case the empty string to support the
+ # "scheme=''" default argument to some functions
+ if arg and isinstance(arg, str) != str_input:
+ raise TypeError("Cannot mix str and non-str arguments")
+ if str_input:
+ return args + (_noop,)
+ return _decode_args(args) + (_encode_result,)
+
+# Result objects are more helpful than simple tuples
+class _ResultMixinStr(object):
+ """Standard approach to encoding parsed results from str to bytes"""
+ __slots__ = ()
+
+ def encode(self, encoding='ascii', errors='strict'):
+ return self._encoded_counterpart(*(x.encode(encoding, errors) for x in self))
+
+
+class _ResultMixinBytes(object):
+ """Standard approach to decoding parsed results from bytes to str"""
+ __slots__ = ()
+
+ def decode(self, encoding='ascii', errors='strict'):
+ return self._decoded_counterpart(*(x.decode(encoding, errors) for x in self))
+
+
+class _NetlocResultMixinBase(object):
+ """Shared methods for the parsed result objects containing a netloc element"""
+ __slots__ = ()
+
+ @property
+ def username(self):
+ return self._userinfo[0]
+
+ @property
+ def password(self):
+ return self._userinfo[1]
+
+ @property
+ def hostname(self):
+ hostname = self._hostinfo[0]
+ if not hostname:
+ hostname = None
+ elif hostname is not None:
+ hostname = hostname.lower()
+ return hostname
+
+ @property
+ def port(self):
+ port = self._hostinfo[1]
+ if port is not None:
+ port = int(port, 10)
+ # Return None on an illegal port
+ if not ( 0 <= port <= 65535):
+ return None
+ return port
+
+
+class _NetlocResultMixinStr(_NetlocResultMixinBase, _ResultMixinStr):
+ __slots__ = ()
+
+ @property
+ def _userinfo(self):
+ netloc = self.netloc
+ userinfo, have_info, hostinfo = netloc.rpartition('@')
+ if have_info:
+ username, have_password, password = userinfo.partition(':')
+ if not have_password:
+ password = None
+ else:
+ username = password = None
+ return username, password
+
+ @property
+ def _hostinfo(self):
+ netloc = self.netloc
+ _, _, hostinfo = netloc.rpartition('@')
+ _, have_open_br, bracketed = hostinfo.partition('[')
+ if have_open_br:
+ hostname, _, port = bracketed.partition(']')
+ _, have_port, port = port.partition(':')
+ else:
+ hostname, have_port, port = hostinfo.partition(':')
+ if not have_port:
+ port = None
+ return hostname, port
+
+
+class _NetlocResultMixinBytes(_NetlocResultMixinBase, _ResultMixinBytes):
+ __slots__ = ()
+
+ @property
+ def _userinfo(self):
+ netloc = self.netloc
+ userinfo, have_info, hostinfo = netloc.rpartition(b'@')
+ if have_info:
+ username, have_password, password = userinfo.partition(b':')
+ if not have_password:
+ password = None
+ else:
+ username = password = None
+ return username, password
+
+ @property
+ def _hostinfo(self):
+ netloc = self.netloc
+ _, _, hostinfo = netloc.rpartition(b'@')
+ _, have_open_br, bracketed = hostinfo.partition(b'[')
+ if have_open_br:
+ hostname, _, port = bracketed.partition(b']')
+ _, have_port, port = port.partition(b':')
+ else:
+ hostname, have_port, port = hostinfo.partition(b':')
+ if not have_port:
+ port = None
+ return hostname, port
+
+
+from collections import namedtuple
+
+_DefragResultBase = namedtuple('DefragResult', 'url fragment')
+_SplitResultBase = namedtuple('SplitResult', 'scheme netloc path query fragment')
+_ParseResultBase = namedtuple('ParseResult', 'scheme netloc path params query fragment')
+
+# For backwards compatibility, alias _NetlocResultMixinStr
+# ResultBase is no longer part of the documented API, but it is
+# retained since deprecating it isn't worth the hassle
+ResultBase = _NetlocResultMixinStr
+
+# Structured result objects for string data
+class DefragResult(_DefragResultBase, _ResultMixinStr):
+ __slots__ = ()
+ def geturl(self):
+ if self.fragment:
+ return self.url + '#' + self.fragment
+ else:
+ return self.url
+
+class SplitResult(_SplitResultBase, _NetlocResultMixinStr):
+ __slots__ = ()
+ def geturl(self):
+ return urlunsplit(self)
+
+class ParseResult(_ParseResultBase, _NetlocResultMixinStr):
+ __slots__ = ()
+ def geturl(self):
+ return urlunparse(self)
+
+# Structured result objects for bytes data
+class DefragResultBytes(_DefragResultBase, _ResultMixinBytes):
+ __slots__ = ()
+ def geturl(self):
+ if self.fragment:
+ return self.url + b'#' + self.fragment
+ else:
+ return self.url
+
+class SplitResultBytes(_SplitResultBase, _NetlocResultMixinBytes):
+ __slots__ = ()
+ def geturl(self):
+ return urlunsplit(self)
+
+class ParseResultBytes(_ParseResultBase, _NetlocResultMixinBytes):
+ __slots__ = ()
+ def geturl(self):
+ return urlunparse(self)
+
+# Set up the encode/decode result pairs
+def _fix_result_transcoding():
+ _result_pairs = (
+ (DefragResult, DefragResultBytes),
+ (SplitResult, SplitResultBytes),
+ (ParseResult, ParseResultBytes),
+ )
+ for _decoded, _encoded in _result_pairs:
+ _decoded._encoded_counterpart = _encoded
+ _encoded._decoded_counterpart = _decoded
+
+_fix_result_transcoding()
+del _fix_result_transcoding
+
+def urlparse(url, scheme='', allow_fragments=True):
+ """Parse a URL into 6 components:
+ :///;?#
+ Return a 6-tuple: (scheme, netloc, path, params, query, fragment).
+ Note that we don't break the components up in smaller bits
+ (e.g. netloc is a single string) and we don't expand % escapes."""
+ url, scheme, _coerce_result = _coerce_args(url, scheme)
+ splitresult = urlsplit(url, scheme, allow_fragments)
+ scheme, netloc, url, query, fragment = splitresult
+ if scheme in uses_params and ';' in url:
+ url, params = _splitparams(url)
+ else:
+ params = ''
+ result = ParseResult(scheme, netloc, url, params, query, fragment)
+ return _coerce_result(result)
+
+def _splitparams(url):
+ if '/' in url:
+ i = url.find(';', url.rfind('/'))
+ if i < 0:
+ return url, ''
+ else:
+ i = url.find(';')
+ return url[:i], url[i+1:]
+
+def _splitnetloc(url, start=0):
+ delim = len(url) # position of end of domain part of url, default is end
+ for c in '/?#': # look for delimiters; the order is NOT important
+ wdelim = url.find(c, start) # find first of this delim
+ if wdelim >= 0: # if found
+ delim = min(delim, wdelim) # use earliest delim position
+ return url[start:delim], url[delim:] # return (domain, rest)
+
+def urlsplit(url, scheme='', allow_fragments=True):
+ """Parse a URL into 5 components:
+ :///?#
+ Return a 5-tuple: (scheme, netloc, path, query, fragment).
+ Note that we don't break the components up in smaller bits
+ (e.g. netloc is a single string) and we don't expand % escapes."""
+ url, scheme, _coerce_result = _coerce_args(url, scheme)
+ allow_fragments = bool(allow_fragments)
+ key = url, scheme, allow_fragments, type(url), type(scheme)
+ cached = _parse_cache.get(key, None)
+ if cached:
+ return _coerce_result(cached)
+ if len(_parse_cache) >= MAX_CACHE_SIZE: # avoid runaway growth
+ clear_cache()
+ netloc = query = fragment = ''
+ i = url.find(':')
+ if i > 0:
+ if url[:i] == 'http': # optimize the common case
+ scheme = url[:i].lower()
+ url = url[i+1:]
+ if url[:2] == '//':
+ netloc, url = _splitnetloc(url, 2)
+ if (('[' in netloc and ']' not in netloc) or
+ (']' in netloc and '[' not in netloc)):
+ raise ValueError("Invalid IPv6 URL")
+ if allow_fragments and '#' in url:
+ url, fragment = url.split('#', 1)
+ if '?' in url:
+ url, query = url.split('?', 1)
+ v = SplitResult(scheme, netloc, url, query, fragment)
+ _parse_cache[key] = v
+ return _coerce_result(v)
+ for c in url[:i]:
+ if c not in scheme_chars:
+ break
+ else:
+ # make sure "url" is not actually a port number (in which case
+ # "scheme" is really part of the path)
+ rest = url[i+1:]
+ if not rest or any(c not in '0123456789' for c in rest):
+ # not a port number
+ scheme, url = url[:i].lower(), rest
+
+ if url[:2] == '//':
+ netloc, url = _splitnetloc(url, 2)
+ if (('[' in netloc and ']' not in netloc) or
+ (']' in netloc and '[' not in netloc)):
+ raise ValueError("Invalid IPv6 URL")
+ if allow_fragments and '#' in url:
+ url, fragment = url.split('#', 1)
+ if '?' in url:
+ url, query = url.split('?', 1)
+ v = SplitResult(scheme, netloc, url, query, fragment)
+ _parse_cache[key] = v
+ return _coerce_result(v)
+
+def urlunparse(components):
+ """Put a parsed URL back together again. This may result in a
+ slightly different, but equivalent URL, if the URL that was parsed
+ originally had redundant delimiters, e.g. a ? with an empty query
+ (the draft states that these are equivalent)."""
+ scheme, netloc, url, params, query, fragment, _coerce_result = (
+ _coerce_args(*components))
+ if params:
+ url = "%s;%s" % (url, params)
+ return _coerce_result(urlunsplit((scheme, netloc, url, query, fragment)))
+
+def urlunsplit(components):
+ """Combine the elements of a tuple as returned by urlsplit() into a
+ complete URL as a string. The data argument can be any five-item iterable.
+ This may result in a slightly different, but equivalent URL, if the URL that
+ was parsed originally had unnecessary delimiters (for example, a ? with an
+ empty query; the RFC states that these are equivalent)."""
+ scheme, netloc, url, query, fragment, _coerce_result = (
+ _coerce_args(*components))
+ if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'):
+ if url and url[:1] != '/': url = '/' + url
+ url = '//' + (netloc or '') + url
+ if scheme:
+ url = scheme + ':' + url
+ if query:
+ url = url + '?' + query
+ if fragment:
+ url = url + '#' + fragment
+ return _coerce_result(url)
+
+def urljoin(base, url, allow_fragments=True):
+ """Join a base URL and a possibly relative URL to form an absolute
+ interpretation of the latter."""
+ if not base:
+ return url
+ if not url:
+ return base
+ base, url, _coerce_result = _coerce_args(base, url)
+ bscheme, bnetloc, bpath, bparams, bquery, bfragment = \
+ urlparse(base, '', allow_fragments)
+ scheme, netloc, path, params, query, fragment = \
+ urlparse(url, bscheme, allow_fragments)
+ if scheme != bscheme or scheme not in uses_relative:
+ return _coerce_result(url)
+ if scheme in uses_netloc:
+ if netloc:
+ return _coerce_result(urlunparse((scheme, netloc, path,
+ params, query, fragment)))
+ netloc = bnetloc
+ if path[:1] == '/':
+ return _coerce_result(urlunparse((scheme, netloc, path,
+ params, query, fragment)))
+ if not path and not params:
+ path = bpath
+ params = bparams
+ if not query:
+ query = bquery
+ return _coerce_result(urlunparse((scheme, netloc, path,
+ params, query, fragment)))
+ segments = bpath.split('/')[:-1] + path.split('/')
+ # XXX The stuff below is bogus in various ways...
+ if segments[-1] == '.':
+ segments[-1] = ''
+ while '.' in segments:
+ segments.remove('.')
+ while 1:
+ i = 1
+ n = len(segments) - 1
+ while i < n:
+ if (segments[i] == '..'
+ and segments[i-1] not in ('', '..')):
+ del segments[i-1:i+1]
+ break
+ i = i+1
+ else:
+ break
+ if segments == ['', '..']:
+ segments[-1] = ''
+ elif len(segments) >= 2 and segments[-1] == '..':
+ segments[-2:] = ['']
+ return _coerce_result(urlunparse((scheme, netloc, '/'.join(segments),
+ params, query, fragment)))
+
+def urldefrag(url):
+ """Removes any existing fragment from URL.
+
+ Returns a tuple of the defragmented URL and the fragment. If
+ the URL contained no fragments, the second element is the
+ empty string.
+ """
+ url, _coerce_result = _coerce_args(url)
+ if '#' in url:
+ s, n, p, a, q, frag = urlparse(url)
+ defrag = urlunparse((s, n, p, a, q, ''))
+ else:
+ frag = ''
+ defrag = url
+ return _coerce_result(DefragResult(defrag, frag))
+
+_hexdig = '0123456789ABCDEFabcdef'
+_hextobyte = dict(((a + b).encode(), bytes([int(a + b, 16)]))
+ for a in _hexdig for b in _hexdig)
+
+def unquote_to_bytes(string):
+ """unquote_to_bytes('abc%20def') -> b'abc def'."""
+ # Note: strings are encoded as UTF-8. This is only an issue if it contains
+ # unescaped non-ASCII characters, which URIs should not.
+ if not string:
+ # Is it a string-like object?
+ string.split
+ return bytes(b'')
+ if isinstance(string, str):
+ string = string.encode('utf-8')
+ ### For Python-Future:
+ # It is already a byte-string object, but force it to be newbytes here on
+ # Py2:
+ string = bytes(string)
+ ###
+ bits = string.split(b'%')
+ if len(bits) == 1:
+ return string
+ res = [bits[0]]
+ append = res.append
+ for item in bits[1:]:
+ try:
+ append(_hextobyte[item[:2]])
+ append(item[2:])
+ except KeyError:
+ append(b'%')
+ append(item)
+ return bytes(b'').join(res)
+
+_asciire = re.compile('([\x00-\x7f]+)')
+
+def unquote(string, encoding='utf-8', errors='replace'):
+ """Replace %xx escapes by their single-character equivalent. The optional
+ encoding and errors parameters specify how to decode percent-encoded
+ sequences into Unicode characters, as accepted by the bytes.decode()
+ method.
+ By default, percent-encoded sequences are decoded with UTF-8, and invalid
+ sequences are replaced by a placeholder character.
+
+ unquote('abc%20def') -> 'abc def'.
+ """
+ if '%' not in string:
+ string.split
+ return string
+ if encoding is None:
+ encoding = 'utf-8'
+ if errors is None:
+ errors = 'replace'
+ bits = _asciire.split(string)
+ res = [bits[0]]
+ append = res.append
+ for i in range(1, len(bits), 2):
+ append(unquote_to_bytes(bits[i]).decode(encoding, errors))
+ append(bits[i + 1])
+ return ''.join(res)
+
+def parse_qs(qs, keep_blank_values=False, strict_parsing=False,
+ encoding='utf-8', errors='replace'):
+ """Parse a query given as a string argument.
+
+ Arguments:
+
+ qs: percent-encoded query string to be parsed
+
+ keep_blank_values: flag indicating whether blank values in
+ percent-encoded queries should be treated as blank strings.
+ A true value indicates that blanks should be retained as
+ blank strings. The default false value indicates that
+ blank values are to be ignored and treated as if they were
+ not included.
+
+ strict_parsing: flag indicating what to do with parsing errors.
+ If false (the default), errors are silently ignored.
+ If true, errors raise a ValueError exception.
+
+ encoding and errors: specify how to decode percent-encoded sequences
+ into Unicode characters, as accepted by the bytes.decode() method.
+ """
+ parsed_result = {}
+ pairs = parse_qsl(qs, keep_blank_values, strict_parsing,
+ encoding=encoding, errors=errors)
+ for name, value in pairs:
+ if name in parsed_result:
+ parsed_result[name].append(value)
+ else:
+ parsed_result[name] = [value]
+ return parsed_result
+
+def parse_qsl(qs, keep_blank_values=False, strict_parsing=False,
+ encoding='utf-8', errors='replace'):
+ """Parse a query given as a string argument.
+
+ Arguments:
+
+ qs: percent-encoded query string to be parsed
+
+ keep_blank_values: flag indicating whether blank values in
+ percent-encoded queries should be treated as blank strings. A
+ true value indicates that blanks should be retained as blank
+ strings. The default false value indicates that blank values
+ are to be ignored and treated as if they were not included.
+
+ strict_parsing: flag indicating what to do with parsing errors. If
+ false (the default), errors are silently ignored. If true,
+ errors raise a ValueError exception.
+
+ encoding and errors: specify how to decode percent-encoded sequences
+ into Unicode characters, as accepted by the bytes.decode() method.
+
+ Returns a list, as G-d intended.
+ """
+ qs, _coerce_result = _coerce_args(qs)
+ pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')]
+ r = []
+ for name_value in pairs:
+ if not name_value and not strict_parsing:
+ continue
+ nv = name_value.split('=', 1)
+ if len(nv) != 2:
+ if strict_parsing:
+ raise ValueError("bad query field: %r" % (name_value,))
+ # Handle case of a control-name with no equal sign
+ if keep_blank_values:
+ nv.append('')
+ else:
+ continue
+ if len(nv[1]) or keep_blank_values:
+ name = nv[0].replace('+', ' ')
+ name = unquote(name, encoding=encoding, errors=errors)
+ name = _coerce_result(name)
+ value = nv[1].replace('+', ' ')
+ value = unquote(value, encoding=encoding, errors=errors)
+ value = _coerce_result(value)
+ r.append((name, value))
+ return r
+
+def unquote_plus(string, encoding='utf-8', errors='replace'):
+ """Like unquote(), but also replace plus signs by spaces, as required for
+ unquoting HTML form values.
+
+ unquote_plus('%7e/abc+def') -> '~/abc def'
+ """
+ string = string.replace('+', ' ')
+ return unquote(string, encoding, errors)
+
+_ALWAYS_SAFE = frozenset(bytes(b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ b'abcdefghijklmnopqrstuvwxyz'
+ b'0123456789'
+ b'_.-'))
+_ALWAYS_SAFE_BYTES = bytes(_ALWAYS_SAFE)
+_safe_quoters = {}
+
+class Quoter(collections.defaultdict):
+ """A mapping from bytes (in range(0,256)) to strings.
+
+ String values are percent-encoded byte values, unless the key < 128, and
+ in the "safe" set (either the specified safe set, or default set).
+ """
+ # Keeps a cache internally, using defaultdict, for efficiency (lookups
+ # of cached keys don't call Python code at all).
+ def __init__(self, safe):
+ """safe: bytes object."""
+ self.safe = _ALWAYS_SAFE.union(bytes(safe))
+
+ def __repr__(self):
+ # Without this, will just display as a defaultdict
+ return "" % dict(self)
+
+ def __missing__(self, b):
+ # Handle a cache miss. Store quoted string in cache and return.
+ res = chr(b) if b in self.safe else '%{0:02X}'.format(b)
+ self[b] = res
+ return res
+
+def quote(string, safe='/', encoding=None, errors=None):
+ """quote('abc def') -> 'abc%20def'
+
+ Each part of a URL, e.g. the path info, the query, etc., has a
+ different set of reserved characters that must be quoted.
+
+ RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists
+ the following reserved characters.
+
+ reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
+ "$" | ","
+
+ Each of these characters is reserved in some component of a URL,
+ but not necessarily in all of them.
+
+ By default, the quote function is intended for quoting the path
+ section of a URL. Thus, it will not encode '/'. This character
+ is reserved, but in typical usage the quote function is being
+ called on a path where the existing slash characters are used as
+ reserved characters.
+
+ string and safe may be either str or bytes objects. encoding must
+ not be specified if string is a str.
+
+ The optional encoding and errors parameters specify how to deal with
+ non-ASCII characters, as accepted by the str.encode method.
+ By default, encoding='utf-8' (characters are encoded with UTF-8), and
+ errors='strict' (unsupported characters raise a UnicodeEncodeError).
+ """
+ if isinstance(string, str):
+ if not string:
+ return string
+ if encoding is None:
+ encoding = 'utf-8'
+ if errors is None:
+ errors = 'strict'
+ string = string.encode(encoding, errors)
+ else:
+ if encoding is not None:
+ raise TypeError("quote() doesn't support 'encoding' for bytes")
+ if errors is not None:
+ raise TypeError("quote() doesn't support 'errors' for bytes")
+ return quote_from_bytes(string, safe)
+
+def quote_plus(string, safe='', encoding=None, errors=None):
+ """Like quote(), but also replace ' ' with '+', as required for quoting
+ HTML form values. Plus signs in the original string are escaped unless
+ they are included in safe. It also does not have safe default to '/'.
+ """
+ # Check if ' ' in string, where string may either be a str or bytes. If
+ # there are no spaces, the regular quote will produce the right answer.
+ if ((isinstance(string, str) and ' ' not in string) or
+ (isinstance(string, bytes) and b' ' not in string)):
+ return quote(string, safe, encoding, errors)
+ if isinstance(safe, str):
+ space = str(' ')
+ else:
+ space = bytes(b' ')
+ string = quote(string, safe + space, encoding, errors)
+ return string.replace(' ', '+')
+
+def quote_from_bytes(bs, safe='/'):
+ """Like quote(), but accepts a bytes object rather than a str, and does
+ not perform string-to-bytes encoding. It always returns an ASCII string.
+ quote_from_bytes(b'abc def\x3f') -> 'abc%20def%3f'
+ """
+ if not isinstance(bs, (bytes, bytearray)):
+ raise TypeError("quote_from_bytes() expected bytes")
+ if not bs:
+ return str('')
+ ### For Python-Future:
+ bs = bytes(bs)
+ ###
+ if isinstance(safe, str):
+ # Normalize 'safe' by converting to bytes and removing non-ASCII chars
+ safe = str(safe).encode('ascii', 'ignore')
+ else:
+ ### For Python-Future:
+ safe = bytes(safe)
+ ###
+ safe = bytes([c for c in safe if c < 128])
+ if not bs.rstrip(_ALWAYS_SAFE_BYTES + safe):
+ return bs.decode()
+ try:
+ quoter = _safe_quoters[safe]
+ except KeyError:
+ _safe_quoters[safe] = quoter = Quoter(safe).__getitem__
+ return str('').join([quoter(char) for char in bs])
+
+def urlencode(query, doseq=False, safe='', encoding=None, errors=None):
+ """Encode a sequence of two-element tuples or dictionary into a URL query string.
+
+ If any values in the query arg are sequences and doseq is true, each
+ sequence element is converted to a separate parameter.
+
+ If the query arg is a sequence of two-element tuples, the order of the
+ parameters in the output will match the order of parameters in the
+ input.
+
+ The query arg may be either a string or a bytes type. When query arg is a
+ string, the safe, encoding and error parameters are sent the quote_plus for
+ encoding.
+ """
+
+ if hasattr(query, "items"):
+ query = query.items()
+ else:
+ # It's a bother at times that strings and string-like objects are
+ # sequences.
+ try:
+ # non-sequence items should not work with len()
+ # non-empty strings will fail this
+ if len(query) and not isinstance(query[0], tuple):
+ raise TypeError
+ # Zero-length sequences of all types will get here and succeed,
+ # but that's a minor nit. Since the original implementation
+ # allowed empty dicts that type of behavior probably should be
+ # preserved for consistency
+ except TypeError:
+ ty, va, tb = sys.exc_info()
+ raise_with_traceback(TypeError("not a valid non-string sequence "
+ "or mapping object"), tb)
+
+ l = []
+ if not doseq:
+ for k, v in query:
+ if isinstance(k, bytes):
+ k = quote_plus(k, safe)
+ else:
+ k = quote_plus(str(k), safe, encoding, errors)
+
+ if isinstance(v, bytes):
+ v = quote_plus(v, safe)
+ else:
+ v = quote_plus(str(v), safe, encoding, errors)
+ l.append(k + '=' + v)
+ else:
+ for k, v in query:
+ if isinstance(k, bytes):
+ k = quote_plus(k, safe)
+ else:
+ k = quote_plus(str(k), safe, encoding, errors)
+
+ if isinstance(v, bytes):
+ v = quote_plus(v, safe)
+ l.append(k + '=' + v)
+ elif isinstance(v, str):
+ v = quote_plus(v, safe, encoding, errors)
+ l.append(k + '=' + v)
+ else:
+ try:
+ # Is this a sufficient test for sequence-ness?
+ x = len(v)
+ except TypeError:
+ # not a sequence
+ v = quote_plus(str(v), safe, encoding, errors)
+ l.append(k + '=' + v)
+ else:
+ # loop over the sequence
+ for elt in v:
+ if isinstance(elt, bytes):
+ elt = quote_plus(elt, safe)
+ else:
+ elt = quote_plus(str(elt), safe, encoding, errors)
+ l.append(k + '=' + elt)
+ return str('&').join(l)
+
+# Utilities to parse URLs (most of these return None for missing parts):
+# unwrap('') --> 'type://host/path'
+# splittype('type:opaquestring') --> 'type', 'opaquestring'
+# splithost('//host[:port]/path') --> 'host[:port]', '/path'
+# splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'
+# splitpasswd('user:passwd') -> 'user', 'passwd'
+# splitport('host:port') --> 'host', 'port'
+# splitquery('/path?query') --> '/path', 'query'
+# splittag('/path#tag') --> '/path', 'tag'
+# splitattr('/path;attr1=value1;attr2=value2;...') ->
+# '/path', ['attr1=value1', 'attr2=value2', ...]
+# splitvalue('attr=value') --> 'attr', 'value'
+# urllib.parse.unquote('abc%20def') -> 'abc def'
+# quote('abc def') -> 'abc%20def')
+
+def to_bytes(url):
+ """to_bytes(u"URL") --> 'URL'."""
+ # Most URL schemes require ASCII. If that changes, the conversion
+ # can be relaxed.
+ # XXX get rid of to_bytes()
+ if isinstance(url, str):
+ try:
+ url = url.encode("ASCII").decode()
+ except UnicodeError:
+ raise UnicodeError("URL " + repr(url) +
+ " contains non-ASCII characters")
+ return url
+
+def unwrap(url):
+ """unwrap('') --> 'type://host/path'."""
+ url = str(url).strip()
+ if url[:1] == '<' and url[-1:] == '>':
+ url = url[1:-1].strip()
+ if url[:4] == 'URL:': url = url[4:].strip()
+ return url
+
+_typeprog = None
+def splittype(url):
+ """splittype('type:opaquestring') --> 'type', 'opaquestring'."""
+ global _typeprog
+ if _typeprog is None:
+ import re
+ _typeprog = re.compile('^([^/:]+):')
+
+ match = _typeprog.match(url)
+ if match:
+ scheme = match.group(1)
+ return scheme.lower(), url[len(scheme) + 1:]
+ return None, url
+
+_hostprog = None
+def splithost(url):
+ """splithost('//host[:port]/path') --> 'host[:port]', '/path'."""
+ global _hostprog
+ if _hostprog is None:
+ import re
+ _hostprog = re.compile('^//([^/?]*)(.*)$')
+
+ match = _hostprog.match(url)
+ if match:
+ host_port = match.group(1)
+ path = match.group(2)
+ if path and not path.startswith('/'):
+ path = '/' + path
+ return host_port, path
+ return None, url
+
+_userprog = None
+def splituser(host):
+ """splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'."""
+ global _userprog
+ if _userprog is None:
+ import re
+ _userprog = re.compile('^(.*)@(.*)$')
+
+ match = _userprog.match(host)
+ if match: return match.group(1, 2)
+ return None, host
+
+_passwdprog = None
+def splitpasswd(user):
+ """splitpasswd('user:passwd') -> 'user', 'passwd'."""
+ global _passwdprog
+ if _passwdprog is None:
+ import re
+ _passwdprog = re.compile('^([^:]*):(.*)$',re.S)
+
+ match = _passwdprog.match(user)
+ if match: return match.group(1, 2)
+ return user, None
+
+# splittag('/path#tag') --> '/path', 'tag'
+_portprog = None
+def splitport(host):
+ """splitport('host:port') --> 'host', 'port'."""
+ global _portprog
+ if _portprog is None:
+ import re
+ _portprog = re.compile('^(.*):([0-9]+)$')
+
+ match = _portprog.match(host)
+ if match: return match.group(1, 2)
+ return host, None
+
+_nportprog = None
+def splitnport(host, defport=-1):
+ """Split host and port, returning numeric port.
+ Return given default port if no ':' found; defaults to -1.
+ Return numerical port if a valid number are found after ':'.
+ Return None if ':' but not a valid number."""
+ global _nportprog
+ if _nportprog is None:
+ import re
+ _nportprog = re.compile('^(.*):(.*)$')
+
+ match = _nportprog.match(host)
+ if match:
+ host, port = match.group(1, 2)
+ try:
+ if not port: raise ValueError("no digits")
+ nport = int(port)
+ except ValueError:
+ nport = None
+ return host, nport
+ return host, defport
+
+_queryprog = None
+def splitquery(url):
+ """splitquery('/path?query') --> '/path', 'query'."""
+ global _queryprog
+ if _queryprog is None:
+ import re
+ _queryprog = re.compile('^(.*)\?([^?]*)$')
+
+ match = _queryprog.match(url)
+ if match: return match.group(1, 2)
+ return url, None
+
+_tagprog = None
+def splittag(url):
+ """splittag('/path#tag') --> '/path', 'tag'."""
+ global _tagprog
+ if _tagprog is None:
+ import re
+ _tagprog = re.compile('^(.*)#([^#]*)$')
+
+ match = _tagprog.match(url)
+ if match: return match.group(1, 2)
+ return url, None
+
+def splitattr(url):
+ """splitattr('/path;attr1=value1;attr2=value2;...') ->
+ '/path', ['attr1=value1', 'attr2=value2', ...]."""
+ words = url.split(';')
+ return words[0], words[1:]
+
+_valueprog = None
+def splitvalue(attr):
+ """splitvalue('attr=value') --> 'attr', 'value'."""
+ global _valueprog
+ if _valueprog is None:
+ import re
+ _valueprog = re.compile('^([^=]*)=(.*)$')
+
+ match = _valueprog.match(attr)
+ if match: return match.group(1, 2)
+ return attr, None
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/urllib/request.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/urllib/request.py
new file mode 100644
index 0000000..b1545ca
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/urllib/request.py
@@ -0,0 +1,2641 @@
+"""
+Ported using Python-Future from the Python 3.3 standard library.
+
+An extensible library for opening URLs using a variety of protocols
+
+The simplest way to use this module is to call the urlopen function,
+which accepts a string containing a URL or a Request object (described
+below). It opens the URL and returns the results as file-like
+object; the returned object has some extra methods described below.
+
+The OpenerDirector manages a collection of Handler objects that do
+all the actual work. Each Handler implements a particular protocol or
+option. The OpenerDirector is a composite object that invokes the
+Handlers needed to open the requested URL. For example, the
+HTTPHandler performs HTTP GET and POST requests and deals with
+non-error returns. The HTTPRedirectHandler automatically deals with
+HTTP 301, 302, 303 and 307 redirect errors, and the HTTPDigestAuthHandler
+deals with digest authentication.
+
+urlopen(url, data=None) -- Basic usage is the same as original
+urllib. pass the url and optionally data to post to an HTTP URL, and
+get a file-like object back. One difference is that you can also pass
+a Request instance instead of URL. Raises a URLError (subclass of
+IOError); for HTTP errors, raises an HTTPError, which can also be
+treated as a valid response.
+
+build_opener -- Function that creates a new OpenerDirector instance.
+Will install the default handlers. Accepts one or more Handlers as
+arguments, either instances or Handler classes that it will
+instantiate. If one of the argument is a subclass of the default
+handler, the argument will be installed instead of the default.
+
+install_opener -- Installs a new opener as the default opener.
+
+objects of interest:
+
+OpenerDirector -- Sets up the User Agent as the Python-urllib client and manages
+the Handler classes, while dealing with requests and responses.
+
+Request -- An object that encapsulates the state of a request. The
+state can be as simple as the URL. It can also include extra HTTP
+headers, e.g. a User-Agent.
+
+BaseHandler --
+
+internals:
+BaseHandler and parent
+_call_chain conventions
+
+Example usage:
+
+import urllib.request
+
+# set up authentication info
+authinfo = urllib.request.HTTPBasicAuthHandler()
+authinfo.add_password(realm='PDQ Application',
+ uri='https://mahler:8092/site-updates.py',
+ user='klem',
+ passwd='geheim$parole')
+
+proxy_support = urllib.request.ProxyHandler({"http" : "http://ahad-haam:3128"})
+
+# build a new opener that adds authentication and caching FTP handlers
+opener = urllib.request.build_opener(proxy_support, authinfo,
+ urllib.request.CacheFTPHandler)
+
+# install it
+urllib.request.install_opener(opener)
+
+f = urllib.request.urlopen('http://www.python.org/')
+"""
+
+# XXX issues:
+# If an authentication error handler that tries to perform
+# authentication for some reason but fails, how should the error be
+# signalled? The client needs to know the HTTP error code. But if
+# the handler knows that the problem was, e.g., that it didn't know
+# that hash algo that requested in the challenge, it would be good to
+# pass that information along to the client, too.
+# ftp errors aren't handled cleanly
+# check digest against correct (i.e. non-apache) implementation
+
+# Possible extensions:
+# complex proxies XXX not sure what exactly was meant by this
+# abstract factory for opener
+
+from __future__ import absolute_import, division, print_function, unicode_literals
+from future.builtins import bytes, dict, filter, input, int, map, open, str
+from future.utils import PY2, PY3, raise_with_traceback
+
+import base64
+import bisect
+import hashlib
+import array
+
+from future.backports import email
+from future.backports.http import client as http_client
+from .error import URLError, HTTPError, ContentTooShortError
+from .parse import (
+ urlparse, urlsplit, urljoin, unwrap, quote, unquote,
+ splittype, splithost, splitport, splituser, splitpasswd,
+ splitattr, splitquery, splitvalue, splittag, to_bytes, urlunparse)
+from .response import addinfourl, addclosehook
+
+import io
+import os
+import posixpath
+import re
+import socket
+import sys
+import time
+import collections
+import tempfile
+import contextlib
+import warnings
+
+# check for SSL
+try:
+ import ssl
+ # Not available in the SSL module in Py2:
+ from ssl import SSLContext
+except ImportError:
+ _have_ssl = False
+else:
+ _have_ssl = True
+
+__all__ = [
+ # Classes
+ 'Request', 'OpenerDirector', 'BaseHandler', 'HTTPDefaultErrorHandler',
+ 'HTTPRedirectHandler', 'HTTPCookieProcessor', 'ProxyHandler',
+ 'HTTPPasswordMgr', 'HTTPPasswordMgrWithDefaultRealm',
+ 'AbstractBasicAuthHandler', 'HTTPBasicAuthHandler', 'ProxyBasicAuthHandler',
+ 'AbstractDigestAuthHandler', 'HTTPDigestAuthHandler', 'ProxyDigestAuthHandler',
+ 'HTTPHandler', 'FileHandler', 'FTPHandler', 'CacheFTPHandler',
+ 'UnknownHandler', 'HTTPErrorProcessor',
+ # Functions
+ 'urlopen', 'install_opener', 'build_opener',
+ 'pathname2url', 'url2pathname', 'getproxies',
+ # Legacy interface
+ 'urlretrieve', 'urlcleanup', 'URLopener', 'FancyURLopener',
+]
+
+# used in User-Agent header sent
+__version__ = sys.version[:3]
+
+_opener = None
+def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, **_3to2kwargs):
+ if 'cadefault' in _3to2kwargs: cadefault = _3to2kwargs['cadefault']; del _3to2kwargs['cadefault']
+ else: cadefault = False
+ if 'capath' in _3to2kwargs: capath = _3to2kwargs['capath']; del _3to2kwargs['capath']
+ else: capath = None
+ if 'cafile' in _3to2kwargs: cafile = _3to2kwargs['cafile']; del _3to2kwargs['cafile']
+ else: cafile = None
+ global _opener
+ if cafile or capath or cadefault:
+ if not _have_ssl:
+ raise ValueError('SSL support not available')
+ context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
+ context.options |= ssl.OP_NO_SSLv2
+ context.verify_mode = ssl.CERT_REQUIRED
+ if cafile or capath:
+ context.load_verify_locations(cafile, capath)
+ else:
+ context.set_default_verify_paths()
+ https_handler = HTTPSHandler(context=context, check_hostname=True)
+ opener = build_opener(https_handler)
+ elif _opener is None:
+ _opener = opener = build_opener()
+ else:
+ opener = _opener
+ return opener.open(url, data, timeout)
+
+def install_opener(opener):
+ global _opener
+ _opener = opener
+
+_url_tempfiles = []
+def urlretrieve(url, filename=None, reporthook=None, data=None):
+ """
+ Retrieve a URL into a temporary location on disk.
+
+ Requires a URL argument. If a filename is passed, it is used as
+ the temporary file location. The reporthook argument should be
+ a callable that accepts a block number, a read size, and the
+ total file size of the URL target. The data argument should be
+ valid URL encoded data.
+
+ If a filename is passed and the URL points to a local resource,
+ the result is a copy from local file to new file.
+
+ Returns a tuple containing the path to the newly created
+ data file as well as the resulting HTTPMessage object.
+ """
+ url_type, path = splittype(url)
+
+ with contextlib.closing(urlopen(url, data)) as fp:
+ headers = fp.info()
+
+ # Just return the local path and the "headers" for file://
+ # URLs. No sense in performing a copy unless requested.
+ if url_type == "file" and not filename:
+ return os.path.normpath(path), headers
+
+ # Handle temporary file setup.
+ if filename:
+ tfp = open(filename, 'wb')
+ else:
+ tfp = tempfile.NamedTemporaryFile(delete=False)
+ filename = tfp.name
+ _url_tempfiles.append(filename)
+
+ with tfp:
+ result = filename, headers
+ bs = 1024*8
+ size = -1
+ read = 0
+ blocknum = 0
+ if "content-length" in headers:
+ size = int(headers["Content-Length"])
+
+ if reporthook:
+ reporthook(blocknum, bs, size)
+
+ while True:
+ block = fp.read(bs)
+ if not block:
+ break
+ read += len(block)
+ tfp.write(block)
+ blocknum += 1
+ if reporthook:
+ reporthook(blocknum, bs, size)
+
+ if size >= 0 and read < size:
+ raise ContentTooShortError(
+ "retrieval incomplete: got only %i out of %i bytes"
+ % (read, size), result)
+
+ return result
+
+def urlcleanup():
+ for temp_file in _url_tempfiles:
+ try:
+ os.unlink(temp_file)
+ except EnvironmentError:
+ pass
+
+ del _url_tempfiles[:]
+ global _opener
+ if _opener:
+ _opener = None
+
+if PY3:
+ _cut_port_re = re.compile(r":\d+$", re.ASCII)
+else:
+ _cut_port_re = re.compile(r":\d+$")
+
+def request_host(request):
+
+ """Return request-host, as defined by RFC 2965.
+
+ Variation from RFC: returned value is lowercased, for convenient
+ comparison.
+
+ """
+ url = request.full_url
+ host = urlparse(url)[1]
+ if host == "":
+ host = request.get_header("Host", "")
+
+ # remove port, if present
+ host = _cut_port_re.sub("", host, 1)
+ return host.lower()
+
+class Request(object):
+
+ def __init__(self, url, data=None, headers={},
+ origin_req_host=None, unverifiable=False,
+ method=None):
+ # unwrap('') --> 'type://host/path'
+ self.full_url = unwrap(url)
+ self.full_url, self.fragment = splittag(self.full_url)
+ self.data = data
+ self.headers = {}
+ self._tunnel_host = None
+ for key, value in headers.items():
+ self.add_header(key, value)
+ self.unredirected_hdrs = {}
+ if origin_req_host is None:
+ origin_req_host = request_host(self)
+ self.origin_req_host = origin_req_host
+ self.unverifiable = unverifiable
+ self.method = method
+ self._parse()
+
+ def _parse(self):
+ self.type, rest = splittype(self.full_url)
+ if self.type is None:
+ raise ValueError("unknown url type: %r" % self.full_url)
+ self.host, self.selector = splithost(rest)
+ if self.host:
+ self.host = unquote(self.host)
+
+ def get_method(self):
+ """Return a string indicating the HTTP request method."""
+ if self.method is not None:
+ return self.method
+ elif self.data is not None:
+ return "POST"
+ else:
+ return "GET"
+
+ def get_full_url(self):
+ if self.fragment:
+ return '%s#%s' % (self.full_url, self.fragment)
+ else:
+ return self.full_url
+
+ # Begin deprecated methods
+
+ def add_data(self, data):
+ msg = "Request.add_data method is deprecated."
+ warnings.warn(msg, DeprecationWarning, stacklevel=1)
+ self.data = data
+
+ def has_data(self):
+ msg = "Request.has_data method is deprecated."
+ warnings.warn(msg, DeprecationWarning, stacklevel=1)
+ return self.data is not None
+
+ def get_data(self):
+ msg = "Request.get_data method is deprecated."
+ warnings.warn(msg, DeprecationWarning, stacklevel=1)
+ return self.data
+
+ def get_type(self):
+ msg = "Request.get_type method is deprecated."
+ warnings.warn(msg, DeprecationWarning, stacklevel=1)
+ return self.type
+
+ def get_host(self):
+ msg = "Request.get_host method is deprecated."
+ warnings.warn(msg, DeprecationWarning, stacklevel=1)
+ return self.host
+
+ def get_selector(self):
+ msg = "Request.get_selector method is deprecated."
+ warnings.warn(msg, DeprecationWarning, stacklevel=1)
+ return self.selector
+
+ def is_unverifiable(self):
+ msg = "Request.is_unverifiable method is deprecated."
+ warnings.warn(msg, DeprecationWarning, stacklevel=1)
+ return self.unverifiable
+
+ def get_origin_req_host(self):
+ msg = "Request.get_origin_req_host method is deprecated."
+ warnings.warn(msg, DeprecationWarning, stacklevel=1)
+ return self.origin_req_host
+
+ # End deprecated methods
+
+ def set_proxy(self, host, type):
+ if self.type == 'https' and not self._tunnel_host:
+ self._tunnel_host = self.host
+ else:
+ self.type= type
+ self.selector = self.full_url
+ self.host = host
+
+ def has_proxy(self):
+ return self.selector == self.full_url
+
+ def add_header(self, key, val):
+ # useful for something like authentication
+ self.headers[key.capitalize()] = val
+
+ def add_unredirected_header(self, key, val):
+ # will not be added to a redirected request
+ self.unredirected_hdrs[key.capitalize()] = val
+
+ def has_header(self, header_name):
+ return (header_name in self.headers or
+ header_name in self.unredirected_hdrs)
+
+ def get_header(self, header_name, default=None):
+ return self.headers.get(
+ header_name,
+ self.unredirected_hdrs.get(header_name, default))
+
+ def header_items(self):
+ hdrs = self.unredirected_hdrs.copy()
+ hdrs.update(self.headers)
+ return list(hdrs.items())
+
+class OpenerDirector(object):
+ def __init__(self):
+ client_version = "Python-urllib/%s" % __version__
+ self.addheaders = [('User-agent', client_version)]
+ # self.handlers is retained only for backward compatibility
+ self.handlers = []
+ # manage the individual handlers
+ self.handle_open = {}
+ self.handle_error = {}
+ self.process_response = {}
+ self.process_request = {}
+
+ def add_handler(self, handler):
+ if not hasattr(handler, "add_parent"):
+ raise TypeError("expected BaseHandler instance, got %r" %
+ type(handler))
+
+ added = False
+ for meth in dir(handler):
+ if meth in ["redirect_request", "do_open", "proxy_open"]:
+ # oops, coincidental match
+ continue
+
+ i = meth.find("_")
+ protocol = meth[:i]
+ condition = meth[i+1:]
+
+ if condition.startswith("error"):
+ j = condition.find("_") + i + 1
+ kind = meth[j+1:]
+ try:
+ kind = int(kind)
+ except ValueError:
+ pass
+ lookup = self.handle_error.get(protocol, {})
+ self.handle_error[protocol] = lookup
+ elif condition == "open":
+ kind = protocol
+ lookup = self.handle_open
+ elif condition == "response":
+ kind = protocol
+ lookup = self.process_response
+ elif condition == "request":
+ kind = protocol
+ lookup = self.process_request
+ else:
+ continue
+
+ handlers = lookup.setdefault(kind, [])
+ if handlers:
+ bisect.insort(handlers, handler)
+ else:
+ handlers.append(handler)
+ added = True
+
+ if added:
+ bisect.insort(self.handlers, handler)
+ handler.add_parent(self)
+
+ def close(self):
+ # Only exists for backwards compatibility.
+ pass
+
+ def _call_chain(self, chain, kind, meth_name, *args):
+ # Handlers raise an exception if no one else should try to handle
+ # the request, or return None if they can't but another handler
+ # could. Otherwise, they return the response.
+ handlers = chain.get(kind, ())
+ for handler in handlers:
+ func = getattr(handler, meth_name)
+ result = func(*args)
+ if result is not None:
+ return result
+
+ def open(self, fullurl, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
+ """
+ Accept a URL or a Request object
+
+ Python-Future: if the URL is passed as a byte-string, decode it first.
+ """
+ if isinstance(fullurl, bytes):
+ fullurl = fullurl.decode()
+ if isinstance(fullurl, str):
+ req = Request(fullurl, data)
+ else:
+ req = fullurl
+ if data is not None:
+ req.data = data
+
+ req.timeout = timeout
+ protocol = req.type
+
+ # pre-process request
+ meth_name = protocol+"_request"
+ for processor in self.process_request.get(protocol, []):
+ meth = getattr(processor, meth_name)
+ req = meth(req)
+
+ response = self._open(req, data)
+
+ # post-process response
+ meth_name = protocol+"_response"
+ for processor in self.process_response.get(protocol, []):
+ meth = getattr(processor, meth_name)
+ response = meth(req, response)
+
+ return response
+
+ def _open(self, req, data=None):
+ result = self._call_chain(self.handle_open, 'default',
+ 'default_open', req)
+ if result:
+ return result
+
+ protocol = req.type
+ result = self._call_chain(self.handle_open, protocol, protocol +
+ '_open', req)
+ if result:
+ return result
+
+ return self._call_chain(self.handle_open, 'unknown',
+ 'unknown_open', req)
+
+ def error(self, proto, *args):
+ if proto in ('http', 'https'):
+ # XXX http[s] protocols are special-cased
+ dict = self.handle_error['http'] # https is not different than http
+ proto = args[2] # YUCK!
+ meth_name = 'http_error_%s' % proto
+ http_err = 1
+ orig_args = args
+ else:
+ dict = self.handle_error
+ meth_name = proto + '_error'
+ http_err = 0
+ args = (dict, proto, meth_name) + args
+ result = self._call_chain(*args)
+ if result:
+ return result
+
+ if http_err:
+ args = (dict, 'default', 'http_error_default') + orig_args
+ return self._call_chain(*args)
+
+# XXX probably also want an abstract factory that knows when it makes
+# sense to skip a superclass in favor of a subclass and when it might
+# make sense to include both
+
+def build_opener(*handlers):
+ """Create an opener object from a list of handlers.
+
+ The opener will use several default handlers, including support
+ for HTTP, FTP and when applicable HTTPS.
+
+ If any of the handlers passed as arguments are subclasses of the
+ default handlers, the default handlers will not be used.
+ """
+ def isclass(obj):
+ return isinstance(obj, type) or hasattr(obj, "__bases__")
+
+ opener = OpenerDirector()
+ default_classes = [ProxyHandler, UnknownHandler, HTTPHandler,
+ HTTPDefaultErrorHandler, HTTPRedirectHandler,
+ FTPHandler, FileHandler, HTTPErrorProcessor]
+ if hasattr(http_client, "HTTPSConnection"):
+ default_classes.append(HTTPSHandler)
+ skip = set()
+ for klass in default_classes:
+ for check in handlers:
+ if isclass(check):
+ if issubclass(check, klass):
+ skip.add(klass)
+ elif isinstance(check, klass):
+ skip.add(klass)
+ for klass in skip:
+ default_classes.remove(klass)
+
+ for klass in default_classes:
+ opener.add_handler(klass())
+
+ for h in handlers:
+ if isclass(h):
+ h = h()
+ opener.add_handler(h)
+ return opener
+
+class BaseHandler(object):
+ handler_order = 500
+
+ def add_parent(self, parent):
+ self.parent = parent
+
+ def close(self):
+ # Only exists for backwards compatibility
+ pass
+
+ def __lt__(self, other):
+ if not hasattr(other, "handler_order"):
+ # Try to preserve the old behavior of having custom classes
+ # inserted after default ones (works only for custom user
+ # classes which are not aware of handler_order).
+ return True
+ return self.handler_order < other.handler_order
+
+
+class HTTPErrorProcessor(BaseHandler):
+ """Process HTTP error responses."""
+ handler_order = 1000 # after all other processing
+
+ def http_response(self, request, response):
+ code, msg, hdrs = response.code, response.msg, response.info()
+
+ # According to RFC 2616, "2xx" code indicates that the client's
+ # request was successfully received, understood, and accepted.
+ if not (200 <= code < 300):
+ response = self.parent.error(
+ 'http', request, response, code, msg, hdrs)
+
+ return response
+
+ https_response = http_response
+
+class HTTPDefaultErrorHandler(BaseHandler):
+ def http_error_default(self, req, fp, code, msg, hdrs):
+ raise HTTPError(req.full_url, code, msg, hdrs, fp)
+
+class HTTPRedirectHandler(BaseHandler):
+ # maximum number of redirections to any single URL
+ # this is needed because of the state that cookies introduce
+ max_repeats = 4
+ # maximum total number of redirections (regardless of URL) before
+ # assuming we're in a loop
+ max_redirections = 10
+
+ def redirect_request(self, req, fp, code, msg, headers, newurl):
+ """Return a Request or None in response to a redirect.
+
+ This is called by the http_error_30x methods when a
+ redirection response is received. If a redirection should
+ take place, return a new Request to allow http_error_30x to
+ perform the redirect. Otherwise, raise HTTPError if no-one
+ else should try to handle this url. Return None if you can't
+ but another Handler might.
+ """
+ m = req.get_method()
+ if (not (code in (301, 302, 303, 307) and m in ("GET", "HEAD")
+ or code in (301, 302, 303) and m == "POST")):
+ raise HTTPError(req.full_url, code, msg, headers, fp)
+
+ # Strictly (according to RFC 2616), 301 or 302 in response to
+ # a POST MUST NOT cause a redirection without confirmation
+ # from the user (of urllib.request, in this case). In practice,
+ # essentially all clients do redirect in this case, so we do
+ # the same.
+ # be conciliant with URIs containing a space
+ newurl = newurl.replace(' ', '%20')
+ CONTENT_HEADERS = ("content-length", "content-type")
+ newheaders = dict((k, v) for k, v in req.headers.items()
+ if k.lower() not in CONTENT_HEADERS)
+ return Request(newurl,
+ headers=newheaders,
+ origin_req_host=req.origin_req_host,
+ unverifiable=True)
+
+ # Implementation note: To avoid the server sending us into an
+ # infinite loop, the request object needs to track what URLs we
+ # have already seen. Do this by adding a handler-specific
+ # attribute to the Request object.
+ def http_error_302(self, req, fp, code, msg, headers):
+ # Some servers (incorrectly) return multiple Location headers
+ # (so probably same goes for URI). Use first header.
+ if "location" in headers:
+ newurl = headers["location"]
+ elif "uri" in headers:
+ newurl = headers["uri"]
+ else:
+ return
+
+ # fix a possible malformed URL
+ urlparts = urlparse(newurl)
+
+ # For security reasons we don't allow redirection to anything other
+ # than http, https or ftp.
+
+ if urlparts.scheme not in ('http', 'https', 'ftp', ''):
+ raise HTTPError(
+ newurl, code,
+ "%s - Redirection to url '%s' is not allowed" % (msg, newurl),
+ headers, fp)
+
+ if not urlparts.path:
+ urlparts = list(urlparts)
+ urlparts[2] = "/"
+ newurl = urlunparse(urlparts)
+
+ newurl = urljoin(req.full_url, newurl)
+
+ # XXX Probably want to forget about the state of the current
+ # request, although that might interact poorly with other
+ # handlers that also use handler-specific request attributes
+ new = self.redirect_request(req, fp, code, msg, headers, newurl)
+ if new is None:
+ return
+
+ # loop detection
+ # .redirect_dict has a key url if url was previously visited.
+ if hasattr(req, 'redirect_dict'):
+ visited = new.redirect_dict = req.redirect_dict
+ if (visited.get(newurl, 0) >= self.max_repeats or
+ len(visited) >= self.max_redirections):
+ raise HTTPError(req.full_url, code,
+ self.inf_msg + msg, headers, fp)
+ else:
+ visited = new.redirect_dict = req.redirect_dict = {}
+ visited[newurl] = visited.get(newurl, 0) + 1
+
+ # Don't close the fp until we are sure that we won't use it
+ # with HTTPError.
+ fp.read()
+ fp.close()
+
+ return self.parent.open(new, timeout=req.timeout)
+
+ http_error_301 = http_error_303 = http_error_307 = http_error_302
+
+ inf_msg = "The HTTP server returned a redirect error that would " \
+ "lead to an infinite loop.\n" \
+ "The last 30x error message was:\n"
+
+
+def _parse_proxy(proxy):
+ """Return (scheme, user, password, host/port) given a URL or an authority.
+
+ If a URL is supplied, it must have an authority (host:port) component.
+ According to RFC 3986, having an authority component means the URL must
+ have two slashes after the scheme:
+
+ >>> _parse_proxy('file:/ftp.example.com/')
+ Traceback (most recent call last):
+ ValueError: proxy URL with no authority: 'file:/ftp.example.com/'
+
+ The first three items of the returned tuple may be None.
+
+ Examples of authority parsing:
+
+ >>> _parse_proxy('proxy.example.com')
+ (None, None, None, 'proxy.example.com')
+ >>> _parse_proxy('proxy.example.com:3128')
+ (None, None, None, 'proxy.example.com:3128')
+
+ The authority component may optionally include userinfo (assumed to be
+ username:password):
+
+ >>> _parse_proxy('joe:password@proxy.example.com')
+ (None, 'joe', 'password', 'proxy.example.com')
+ >>> _parse_proxy('joe:password@proxy.example.com:3128')
+ (None, 'joe', 'password', 'proxy.example.com:3128')
+
+ Same examples, but with URLs instead:
+
+ >>> _parse_proxy('http://proxy.example.com/')
+ ('http', None, None, 'proxy.example.com')
+ >>> _parse_proxy('http://proxy.example.com:3128/')
+ ('http', None, None, 'proxy.example.com:3128')
+ >>> _parse_proxy('http://joe:password@proxy.example.com/')
+ ('http', 'joe', 'password', 'proxy.example.com')
+ >>> _parse_proxy('http://joe:password@proxy.example.com:3128')
+ ('http', 'joe', 'password', 'proxy.example.com:3128')
+
+ Everything after the authority is ignored:
+
+ >>> _parse_proxy('ftp://joe:password@proxy.example.com/rubbish:3128')
+ ('ftp', 'joe', 'password', 'proxy.example.com')
+
+ Test for no trailing '/' case:
+
+ >>> _parse_proxy('http://joe:password@proxy.example.com')
+ ('http', 'joe', 'password', 'proxy.example.com')
+
+ """
+ scheme, r_scheme = splittype(proxy)
+ if not r_scheme.startswith("/"):
+ # authority
+ scheme = None
+ authority = proxy
+ else:
+ # URL
+ if not r_scheme.startswith("//"):
+ raise ValueError("proxy URL with no authority: %r" % proxy)
+ # We have an authority, so for RFC 3986-compliant URLs (by ss 3.
+ # and 3.3.), path is empty or starts with '/'
+ end = r_scheme.find("/", 2)
+ if end == -1:
+ end = None
+ authority = r_scheme[2:end]
+ userinfo, hostport = splituser(authority)
+ if userinfo is not None:
+ user, password = splitpasswd(userinfo)
+ else:
+ user = password = None
+ return scheme, user, password, hostport
+
+class ProxyHandler(BaseHandler):
+ # Proxies must be in front
+ handler_order = 100
+
+ def __init__(self, proxies=None):
+ if proxies is None:
+ proxies = getproxies()
+ assert hasattr(proxies, 'keys'), "proxies must be a mapping"
+ self.proxies = proxies
+ for type, url in proxies.items():
+ setattr(self, '%s_open' % type,
+ lambda r, proxy=url, type=type, meth=self.proxy_open:
+ meth(r, proxy, type))
+
+ def proxy_open(self, req, proxy, type):
+ orig_type = req.type
+ proxy_type, user, password, hostport = _parse_proxy(proxy)
+ if proxy_type is None:
+ proxy_type = orig_type
+
+ if req.host and proxy_bypass(req.host):
+ return None
+
+ if user and password:
+ user_pass = '%s:%s' % (unquote(user),
+ unquote(password))
+ creds = base64.b64encode(user_pass.encode()).decode("ascii")
+ req.add_header('Proxy-authorization', 'Basic ' + creds)
+ hostport = unquote(hostport)
+ req.set_proxy(hostport, proxy_type)
+ if orig_type == proxy_type or orig_type == 'https':
+ # let other handlers take care of it
+ return None
+ else:
+ # need to start over, because the other handlers don't
+ # grok the proxy's URL type
+ # e.g. if we have a constructor arg proxies like so:
+ # {'http': 'ftp://proxy.example.com'}, we may end up turning
+ # a request for http://acme.example.com/a into one for
+ # ftp://proxy.example.com/a
+ return self.parent.open(req, timeout=req.timeout)
+
+class HTTPPasswordMgr(object):
+
+ def __init__(self):
+ self.passwd = {}
+
+ def add_password(self, realm, uri, user, passwd):
+ # uri could be a single URI or a sequence
+ if isinstance(uri, str):
+ uri = [uri]
+ if realm not in self.passwd:
+ self.passwd[realm] = {}
+ for default_port in True, False:
+ reduced_uri = tuple(
+ [self.reduce_uri(u, default_port) for u in uri])
+ self.passwd[realm][reduced_uri] = (user, passwd)
+
+ def find_user_password(self, realm, authuri):
+ domains = self.passwd.get(realm, {})
+ for default_port in True, False:
+ reduced_authuri = self.reduce_uri(authuri, default_port)
+ for uris, authinfo in domains.items():
+ for uri in uris:
+ if self.is_suburi(uri, reduced_authuri):
+ return authinfo
+ return None, None
+
+ def reduce_uri(self, uri, default_port=True):
+ """Accept authority or URI and extract only the authority and path."""
+ # note HTTP URLs do not have a userinfo component
+ parts = urlsplit(uri)
+ if parts[1]:
+ # URI
+ scheme = parts[0]
+ authority = parts[1]
+ path = parts[2] or '/'
+ else:
+ # host or host:port
+ scheme = None
+ authority = uri
+ path = '/'
+ host, port = splitport(authority)
+ if default_port and port is None and scheme is not None:
+ dport = {"http": 80,
+ "https": 443,
+ }.get(scheme)
+ if dport is not None:
+ authority = "%s:%d" % (host, dport)
+ return authority, path
+
+ def is_suburi(self, base, test):
+ """Check if test is below base in a URI tree
+
+ Both args must be URIs in reduced form.
+ """
+ if base == test:
+ return True
+ if base[0] != test[0]:
+ return False
+ common = posixpath.commonprefix((base[1], test[1]))
+ if len(common) == len(base[1]):
+ return True
+ return False
+
+
+class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr):
+
+ def find_user_password(self, realm, authuri):
+ user, password = HTTPPasswordMgr.find_user_password(self, realm,
+ authuri)
+ if user is not None:
+ return user, password
+ return HTTPPasswordMgr.find_user_password(self, None, authuri)
+
+
+class AbstractBasicAuthHandler(object):
+
+ # XXX this allows for multiple auth-schemes, but will stupidly pick
+ # the last one with a realm specified.
+
+ # allow for double- and single-quoted realm values
+ # (single quotes are a violation of the RFC, but appear in the wild)
+ rx = re.compile('(?:.*,)*[ \t]*([^ \t]+)[ \t]+'
+ 'realm=(["\']?)([^"\']*)\\2', re.I)
+
+ # XXX could pre-emptively send auth info already accepted (RFC 2617,
+ # end of section 2, and section 1.2 immediately after "credentials"
+ # production).
+
+ def __init__(self, password_mgr=None):
+ if password_mgr is None:
+ password_mgr = HTTPPasswordMgr()
+ self.passwd = password_mgr
+ self.add_password = self.passwd.add_password
+ self.retried = 0
+
+ def reset_retry_count(self):
+ self.retried = 0
+
+ def http_error_auth_reqed(self, authreq, host, req, headers):
+ # host may be an authority (without userinfo) or a URL with an
+ # authority
+ # XXX could be multiple headers
+ authreq = headers.get(authreq, None)
+
+ if self.retried > 5:
+ # retry sending the username:password 5 times before failing.
+ raise HTTPError(req.get_full_url(), 401, "basic auth failed",
+ headers, None)
+ else:
+ self.retried += 1
+
+ if authreq:
+ scheme = authreq.split()[0]
+ if scheme.lower() != 'basic':
+ raise ValueError("AbstractBasicAuthHandler does not"
+ " support the following scheme: '%s'" %
+ scheme)
+ else:
+ mo = AbstractBasicAuthHandler.rx.search(authreq)
+ if mo:
+ scheme, quote, realm = mo.groups()
+ if quote not in ['"',"'"]:
+ warnings.warn("Basic Auth Realm was unquoted",
+ UserWarning, 2)
+ if scheme.lower() == 'basic':
+ response = self.retry_http_basic_auth(host, req, realm)
+ if response and response.code != 401:
+ self.retried = 0
+ return response
+
+ def retry_http_basic_auth(self, host, req, realm):
+ user, pw = self.passwd.find_user_password(realm, host)
+ if pw is not None:
+ raw = "%s:%s" % (user, pw)
+ auth = "Basic " + base64.b64encode(raw.encode()).decode("ascii")
+ if req.headers.get(self.auth_header, None) == auth:
+ return None
+ req.add_unredirected_header(self.auth_header, auth)
+ return self.parent.open(req, timeout=req.timeout)
+ else:
+ return None
+
+
+class HTTPBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler):
+
+ auth_header = 'Authorization'
+
+ def http_error_401(self, req, fp, code, msg, headers):
+ url = req.full_url
+ response = self.http_error_auth_reqed('www-authenticate',
+ url, req, headers)
+ self.reset_retry_count()
+ return response
+
+
+class ProxyBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler):
+
+ auth_header = 'Proxy-authorization'
+
+ def http_error_407(self, req, fp, code, msg, headers):
+ # http_error_auth_reqed requires that there is no userinfo component in
+ # authority. Assume there isn't one, since urllib.request does not (and
+ # should not, RFC 3986 s. 3.2.1) support requests for URLs containing
+ # userinfo.
+ authority = req.host
+ response = self.http_error_auth_reqed('proxy-authenticate',
+ authority, req, headers)
+ self.reset_retry_count()
+ return response
+
+
+# Return n random bytes.
+_randombytes = os.urandom
+
+
+class AbstractDigestAuthHandler(object):
+ # Digest authentication is specified in RFC 2617.
+
+ # XXX The client does not inspect the Authentication-Info header
+ # in a successful response.
+
+ # XXX It should be possible to test this implementation against
+ # a mock server that just generates a static set of challenges.
+
+ # XXX qop="auth-int" supports is shaky
+
+ def __init__(self, passwd=None):
+ if passwd is None:
+ passwd = HTTPPasswordMgr()
+ self.passwd = passwd
+ self.add_password = self.passwd.add_password
+ self.retried = 0
+ self.nonce_count = 0
+ self.last_nonce = None
+
+ def reset_retry_count(self):
+ self.retried = 0
+
+ def http_error_auth_reqed(self, auth_header, host, req, headers):
+ authreq = headers.get(auth_header, None)
+ if self.retried > 5:
+ # Don't fail endlessly - if we failed once, we'll probably
+ # fail a second time. Hm. Unless the Password Manager is
+ # prompting for the information. Crap. This isn't great
+ # but it's better than the current 'repeat until recursion
+ # depth exceeded' approach
+ raise HTTPError(req.full_url, 401, "digest auth failed",
+ headers, None)
+ else:
+ self.retried += 1
+ if authreq:
+ scheme = authreq.split()[0]
+ if scheme.lower() == 'digest':
+ return self.retry_http_digest_auth(req, authreq)
+ elif scheme.lower() != 'basic':
+ raise ValueError("AbstractDigestAuthHandler does not support"
+ " the following scheme: '%s'" % scheme)
+
+ def retry_http_digest_auth(self, req, auth):
+ token, challenge = auth.split(' ', 1)
+ chal = parse_keqv_list(filter(None, parse_http_list(challenge)))
+ auth = self.get_authorization(req, chal)
+ if auth:
+ auth_val = 'Digest %s' % auth
+ if req.headers.get(self.auth_header, None) == auth_val:
+ return None
+ req.add_unredirected_header(self.auth_header, auth_val)
+ resp = self.parent.open(req, timeout=req.timeout)
+ return resp
+
+ def get_cnonce(self, nonce):
+ # The cnonce-value is an opaque
+ # quoted string value provided by the client and used by both client
+ # and server to avoid chosen plaintext attacks, to provide mutual
+ # authentication, and to provide some message integrity protection.
+ # This isn't a fabulous effort, but it's probably Good Enough.
+ s = "%s:%s:%s:" % (self.nonce_count, nonce, time.ctime())
+ b = s.encode("ascii") + _randombytes(8)
+ dig = hashlib.sha1(b).hexdigest()
+ return dig[:16]
+
+ def get_authorization(self, req, chal):
+ try:
+ realm = chal['realm']
+ nonce = chal['nonce']
+ qop = chal.get('qop')
+ algorithm = chal.get('algorithm', 'MD5')
+ # mod_digest doesn't send an opaque, even though it isn't
+ # supposed to be optional
+ opaque = chal.get('opaque', None)
+ except KeyError:
+ return None
+
+ H, KD = self.get_algorithm_impls(algorithm)
+ if H is None:
+ return None
+
+ user, pw = self.passwd.find_user_password(realm, req.full_url)
+ if user is None:
+ return None
+
+ # XXX not implemented yet
+ if req.data is not None:
+ entdig = self.get_entity_digest(req.data, chal)
+ else:
+ entdig = None
+
+ A1 = "%s:%s:%s" % (user, realm, pw)
+ A2 = "%s:%s" % (req.get_method(),
+ # XXX selector: what about proxies and full urls
+ req.selector)
+ if qop == 'auth':
+ if nonce == self.last_nonce:
+ self.nonce_count += 1
+ else:
+ self.nonce_count = 1
+ self.last_nonce = nonce
+ ncvalue = '%08x' % self.nonce_count
+ cnonce = self.get_cnonce(nonce)
+ noncebit = "%s:%s:%s:%s:%s" % (nonce, ncvalue, cnonce, qop, H(A2))
+ respdig = KD(H(A1), noncebit)
+ elif qop is None:
+ respdig = KD(H(A1), "%s:%s" % (nonce, H(A2)))
+ else:
+ # XXX handle auth-int.
+ raise URLError("qop '%s' is not supported." % qop)
+
+ # XXX should the partial digests be encoded too?
+
+ base = 'username="%s", realm="%s", nonce="%s", uri="%s", ' \
+ 'response="%s"' % (user, realm, nonce, req.selector,
+ respdig)
+ if opaque:
+ base += ', opaque="%s"' % opaque
+ if entdig:
+ base += ', digest="%s"' % entdig
+ base += ', algorithm="%s"' % algorithm
+ if qop:
+ base += ', qop=auth, nc=%s, cnonce="%s"' % (ncvalue, cnonce)
+ return base
+
+ def get_algorithm_impls(self, algorithm):
+ # lambdas assume digest modules are imported at the top level
+ if algorithm == 'MD5':
+ H = lambda x: hashlib.md5(x.encode("ascii")).hexdigest()
+ elif algorithm == 'SHA':
+ H = lambda x: hashlib.sha1(x.encode("ascii")).hexdigest()
+ # XXX MD5-sess
+ KD = lambda s, d: H("%s:%s" % (s, d))
+ return H, KD
+
+ def get_entity_digest(self, data, chal):
+ # XXX not implemented yet
+ return None
+
+
+class HTTPDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler):
+ """An authentication protocol defined by RFC 2069
+
+ Digest authentication improves on basic authentication because it
+ does not transmit passwords in the clear.
+ """
+
+ auth_header = 'Authorization'
+ handler_order = 490 # before Basic auth
+
+ def http_error_401(self, req, fp, code, msg, headers):
+ host = urlparse(req.full_url)[1]
+ retry = self.http_error_auth_reqed('www-authenticate',
+ host, req, headers)
+ self.reset_retry_count()
+ return retry
+
+
+class ProxyDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler):
+
+ auth_header = 'Proxy-Authorization'
+ handler_order = 490 # before Basic auth
+
+ def http_error_407(self, req, fp, code, msg, headers):
+ host = req.host
+ retry = self.http_error_auth_reqed('proxy-authenticate',
+ host, req, headers)
+ self.reset_retry_count()
+ return retry
+
+class AbstractHTTPHandler(BaseHandler):
+
+ def __init__(self, debuglevel=0):
+ self._debuglevel = debuglevel
+
+ def set_http_debuglevel(self, level):
+ self._debuglevel = level
+
+ def do_request_(self, request):
+ host = request.host
+ if not host:
+ raise URLError('no host given')
+
+ if request.data is not None: # POST
+ data = request.data
+ if isinstance(data, str):
+ msg = "POST data should be bytes or an iterable of bytes. " \
+ "It cannot be of type str."
+ raise TypeError(msg)
+ if not request.has_header('Content-type'):
+ request.add_unredirected_header(
+ 'Content-type',
+ 'application/x-www-form-urlencoded')
+ if not request.has_header('Content-length'):
+ size = None
+ try:
+ ### For Python-Future:
+ if PY2 and isinstance(data, array.array):
+ # memoryviews of arrays aren't supported
+ # in Py2.7. (e.g. memoryview(array.array('I',
+ # [1, 2, 3, 4])) raises a TypeError.)
+ # So we calculate the size manually instead:
+ size = len(data) * data.itemsize
+ ###
+ else:
+ mv = memoryview(data)
+ size = len(mv) * mv.itemsize
+ except TypeError:
+ if isinstance(data, collections.Iterable):
+ raise ValueError("Content-Length should be specified "
+ "for iterable data of type %r %r" % (type(data),
+ data))
+ else:
+ request.add_unredirected_header(
+ 'Content-length', '%d' % size)
+
+ sel_host = host
+ if request.has_proxy():
+ scheme, sel = splittype(request.selector)
+ sel_host, sel_path = splithost(sel)
+ if not request.has_header('Host'):
+ request.add_unredirected_header('Host', sel_host)
+ for name, value in self.parent.addheaders:
+ name = name.capitalize()
+ if not request.has_header(name):
+ request.add_unredirected_header(name, value)
+
+ return request
+
+ def do_open(self, http_class, req, **http_conn_args):
+ """Return an HTTPResponse object for the request, using http_class.
+
+ http_class must implement the HTTPConnection API from http.client.
+ """
+ host = req.host
+ if not host:
+ raise URLError('no host given')
+
+ # will parse host:port
+ h = http_class(host, timeout=req.timeout, **http_conn_args)
+
+ headers = dict(req.unredirected_hdrs)
+ headers.update(dict((k, v) for k, v in req.headers.items()
+ if k not in headers))
+
+ # TODO(jhylton): Should this be redesigned to handle
+ # persistent connections?
+
+ # We want to make an HTTP/1.1 request, but the addinfourl
+ # class isn't prepared to deal with a persistent connection.
+ # It will try to read all remaining data from the socket,
+ # which will block while the server waits for the next request.
+ # So make sure the connection gets closed after the (only)
+ # request.
+ headers["Connection"] = "close"
+ headers = dict((name.title(), val) for name, val in headers.items())
+
+ if req._tunnel_host:
+ tunnel_headers = {}
+ proxy_auth_hdr = "Proxy-Authorization"
+ if proxy_auth_hdr in headers:
+ tunnel_headers[proxy_auth_hdr] = headers[proxy_auth_hdr]
+ # Proxy-Authorization should not be sent to origin
+ # server.
+ del headers[proxy_auth_hdr]
+ h.set_tunnel(req._tunnel_host, headers=tunnel_headers)
+
+ try:
+ h.request(req.get_method(), req.selector, req.data, headers)
+ except socket.error as err: # timeout error
+ h.close()
+ raise URLError(err)
+ else:
+ r = h.getresponse()
+ # If the server does not send us a 'Connection: close' header,
+ # HTTPConnection assumes the socket should be left open. Manually
+ # mark the socket to be closed when this response object goes away.
+ if h.sock:
+ h.sock.close()
+ h.sock = None
+
+
+ r.url = req.get_full_url()
+ # This line replaces the .msg attribute of the HTTPResponse
+ # with .headers, because urllib clients expect the response to
+ # have the reason in .msg. It would be good to mark this
+ # attribute is deprecated and get then to use info() or
+ # .headers.
+ r.msg = r.reason
+ return r
+
+
+class HTTPHandler(AbstractHTTPHandler):
+
+ def http_open(self, req):
+ return self.do_open(http_client.HTTPConnection, req)
+
+ http_request = AbstractHTTPHandler.do_request_
+
+if hasattr(http_client, 'HTTPSConnection'):
+
+ class HTTPSHandler(AbstractHTTPHandler):
+
+ def __init__(self, debuglevel=0, context=None, check_hostname=None):
+ AbstractHTTPHandler.__init__(self, debuglevel)
+ self._context = context
+ self._check_hostname = check_hostname
+
+ def https_open(self, req):
+ return self.do_open(http_client.HTTPSConnection, req,
+ context=self._context, check_hostname=self._check_hostname)
+
+ https_request = AbstractHTTPHandler.do_request_
+
+ __all__.append('HTTPSHandler')
+
+class HTTPCookieProcessor(BaseHandler):
+ def __init__(self, cookiejar=None):
+ import future.backports.http.cookiejar as http_cookiejar
+ if cookiejar is None:
+ cookiejar = http_cookiejar.CookieJar()
+ self.cookiejar = cookiejar
+
+ def http_request(self, request):
+ self.cookiejar.add_cookie_header(request)
+ return request
+
+ def http_response(self, request, response):
+ self.cookiejar.extract_cookies(response, request)
+ return response
+
+ https_request = http_request
+ https_response = http_response
+
+class UnknownHandler(BaseHandler):
+ def unknown_open(self, req):
+ type = req.type
+ raise URLError('unknown url type: %s' % type)
+
+def parse_keqv_list(l):
+ """Parse list of key=value strings where keys are not duplicated."""
+ parsed = {}
+ for elt in l:
+ k, v = elt.split('=', 1)
+ if v[0] == '"' and v[-1] == '"':
+ v = v[1:-1]
+ parsed[k] = v
+ return parsed
+
+def parse_http_list(s):
+ """Parse lists as described by RFC 2068 Section 2.
+
+ In particular, parse comma-separated lists where the elements of
+ the list may include quoted-strings. A quoted-string could
+ contain a comma. A non-quoted string could have quotes in the
+ middle. Neither commas nor quotes count if they are escaped.
+ Only double-quotes count, not single-quotes.
+ """
+ res = []
+ part = ''
+
+ escape = quote = False
+ for cur in s:
+ if escape:
+ part += cur
+ escape = False
+ continue
+ if quote:
+ if cur == '\\':
+ escape = True
+ continue
+ elif cur == '"':
+ quote = False
+ part += cur
+ continue
+
+ if cur == ',':
+ res.append(part)
+ part = ''
+ continue
+
+ if cur == '"':
+ quote = True
+
+ part += cur
+
+ # append last part
+ if part:
+ res.append(part)
+
+ return [part.strip() for part in res]
+
+class FileHandler(BaseHandler):
+ # Use local file or FTP depending on form of URL
+ def file_open(self, req):
+ url = req.selector
+ if url[:2] == '//' and url[2:3] != '/' and (req.host and
+ req.host != 'localhost'):
+ if not req.host is self.get_names():
+ raise URLError("file:// scheme is supported only on localhost")
+ else:
+ return self.open_local_file(req)
+
+ # names for the localhost
+ names = None
+ def get_names(self):
+ if FileHandler.names is None:
+ try:
+ FileHandler.names = tuple(
+ socket.gethostbyname_ex('localhost')[2] +
+ socket.gethostbyname_ex(socket.gethostname())[2])
+ except socket.gaierror:
+ FileHandler.names = (socket.gethostbyname('localhost'),)
+ return FileHandler.names
+
+ # not entirely sure what the rules are here
+ def open_local_file(self, req):
+ import future.backports.email.utils as email_utils
+ import mimetypes
+ host = req.host
+ filename = req.selector
+ localfile = url2pathname(filename)
+ try:
+ stats = os.stat(localfile)
+ size = stats.st_size
+ modified = email_utils.formatdate(stats.st_mtime, usegmt=True)
+ mtype = mimetypes.guess_type(filename)[0]
+ headers = email.message_from_string(
+ 'Content-type: %s\nContent-length: %d\nLast-modified: %s\n' %
+ (mtype or 'text/plain', size, modified))
+ if host:
+ host, port = splitport(host)
+ if not host or \
+ (not port and _safe_gethostbyname(host) in self.get_names()):
+ if host:
+ origurl = 'file://' + host + filename
+ else:
+ origurl = 'file://' + filename
+ return addinfourl(open(localfile, 'rb'), headers, origurl)
+ except OSError as exp:
+ # users shouldn't expect OSErrors coming from urlopen()
+ raise URLError(exp)
+ raise URLError('file not on local host')
+
+def _safe_gethostbyname(host):
+ try:
+ return socket.gethostbyname(host)
+ except socket.gaierror:
+ return None
+
+class FTPHandler(BaseHandler):
+ def ftp_open(self, req):
+ import ftplib
+ import mimetypes
+ host = req.host
+ if not host:
+ raise URLError('ftp error: no host given')
+ host, port = splitport(host)
+ if port is None:
+ port = ftplib.FTP_PORT
+ else:
+ port = int(port)
+
+ # username/password handling
+ user, host = splituser(host)
+ if user:
+ user, passwd = splitpasswd(user)
+ else:
+ passwd = None
+ host = unquote(host)
+ user = user or ''
+ passwd = passwd or ''
+
+ try:
+ host = socket.gethostbyname(host)
+ except socket.error as msg:
+ raise URLError(msg)
+ path, attrs = splitattr(req.selector)
+ dirs = path.split('/')
+ dirs = list(map(unquote, dirs))
+ dirs, file = dirs[:-1], dirs[-1]
+ if dirs and not dirs[0]:
+ dirs = dirs[1:]
+ try:
+ fw = self.connect_ftp(user, passwd, host, port, dirs, req.timeout)
+ type = file and 'I' or 'D'
+ for attr in attrs:
+ attr, value = splitvalue(attr)
+ if attr.lower() == 'type' and \
+ value in ('a', 'A', 'i', 'I', 'd', 'D'):
+ type = value.upper()
+ fp, retrlen = fw.retrfile(file, type)
+ headers = ""
+ mtype = mimetypes.guess_type(req.full_url)[0]
+ if mtype:
+ headers += "Content-type: %s\n" % mtype
+ if retrlen is not None and retrlen >= 0:
+ headers += "Content-length: %d\n" % retrlen
+ headers = email.message_from_string(headers)
+ return addinfourl(fp, headers, req.full_url)
+ except ftplib.all_errors as exp:
+ exc = URLError('ftp error: %r' % exp)
+ raise_with_traceback(exc)
+
+ def connect_ftp(self, user, passwd, host, port, dirs, timeout):
+ return ftpwrapper(user, passwd, host, port, dirs, timeout,
+ persistent=False)
+
+class CacheFTPHandler(FTPHandler):
+ # XXX would be nice to have pluggable cache strategies
+ # XXX this stuff is definitely not thread safe
+ def __init__(self):
+ self.cache = {}
+ self.timeout = {}
+ self.soonest = 0
+ self.delay = 60
+ self.max_conns = 16
+
+ def setTimeout(self, t):
+ self.delay = t
+
+ def setMaxConns(self, m):
+ self.max_conns = m
+
+ def connect_ftp(self, user, passwd, host, port, dirs, timeout):
+ key = user, host, port, '/'.join(dirs), timeout
+ if key in self.cache:
+ self.timeout[key] = time.time() + self.delay
+ else:
+ self.cache[key] = ftpwrapper(user, passwd, host, port,
+ dirs, timeout)
+ self.timeout[key] = time.time() + self.delay
+ self.check_cache()
+ return self.cache[key]
+
+ def check_cache(self):
+ # first check for old ones
+ t = time.time()
+ if self.soonest <= t:
+ for k, v in list(self.timeout.items()):
+ if v < t:
+ self.cache[k].close()
+ del self.cache[k]
+ del self.timeout[k]
+ self.soonest = min(list(self.timeout.values()))
+
+ # then check the size
+ if len(self.cache) == self.max_conns:
+ for k, v in list(self.timeout.items()):
+ if v == self.soonest:
+ del self.cache[k]
+ del self.timeout[k]
+ break
+ self.soonest = min(list(self.timeout.values()))
+
+ def clear_cache(self):
+ for conn in self.cache.values():
+ conn.close()
+ self.cache.clear()
+ self.timeout.clear()
+
+
+# Code move from the old urllib module
+
+MAXFTPCACHE = 10 # Trim the ftp cache beyond this size
+
+# Helper for non-unix systems
+if os.name == 'nt':
+ from nturl2path import url2pathname, pathname2url
+else:
+ def url2pathname(pathname):
+ """OS-specific conversion from a relative URL of the 'file' scheme
+ to a file system path; not recommended for general use."""
+ return unquote(pathname)
+
+ def pathname2url(pathname):
+ """OS-specific conversion from a file system path to a relative URL
+ of the 'file' scheme; not recommended for general use."""
+ return quote(pathname)
+
+# This really consists of two pieces:
+# (1) a class which handles opening of all sorts of URLs
+# (plus assorted utilities etc.)
+# (2) a set of functions for parsing URLs
+# XXX Should these be separated out into different modules?
+
+
+ftpcache = {}
+class URLopener(object):
+ """Class to open URLs.
+ This is a class rather than just a subroutine because we may need
+ more than one set of global protocol-specific options.
+ Note -- this is a base class for those who don't want the
+ automatic handling of errors type 302 (relocated) and 401
+ (authorization needed)."""
+
+ __tempfiles = None
+
+ version = "Python-urllib/%s" % __version__
+
+ # Constructor
+ def __init__(self, proxies=None, **x509):
+ msg = "%(class)s style of invoking requests is deprecated. " \
+ "Use newer urlopen functions/methods" % {'class': self.__class__.__name__}
+ warnings.warn(msg, DeprecationWarning, stacklevel=3)
+ if proxies is None:
+ proxies = getproxies()
+ assert hasattr(proxies, 'keys'), "proxies must be a mapping"
+ self.proxies = proxies
+ self.key_file = x509.get('key_file')
+ self.cert_file = x509.get('cert_file')
+ self.addheaders = [('User-Agent', self.version)]
+ self.__tempfiles = []
+ self.__unlink = os.unlink # See cleanup()
+ self.tempcache = None
+ # Undocumented feature: if you assign {} to tempcache,
+ # it is used to cache files retrieved with
+ # self.retrieve(). This is not enabled by default
+ # since it does not work for changing documents (and I
+ # haven't got the logic to check expiration headers
+ # yet).
+ self.ftpcache = ftpcache
+ # Undocumented feature: you can use a different
+ # ftp cache by assigning to the .ftpcache member;
+ # in case you want logically independent URL openers
+ # XXX This is not threadsafe. Bah.
+
+ def __del__(self):
+ self.close()
+
+ def close(self):
+ self.cleanup()
+
+ def cleanup(self):
+ # This code sometimes runs when the rest of this module
+ # has already been deleted, so it can't use any globals
+ # or import anything.
+ if self.__tempfiles:
+ for file in self.__tempfiles:
+ try:
+ self.__unlink(file)
+ except OSError:
+ pass
+ del self.__tempfiles[:]
+ if self.tempcache:
+ self.tempcache.clear()
+
+ def addheader(self, *args):
+ """Add a header to be used by the HTTP interface only
+ e.g. u.addheader('Accept', 'sound/basic')"""
+ self.addheaders.append(args)
+
+ # External interface
+ def open(self, fullurl, data=None):
+ """Use URLopener().open(file) instead of open(file, 'r')."""
+ fullurl = unwrap(to_bytes(fullurl))
+ fullurl = quote(fullurl, safe="%/:=&?~#+!$,;'@()*[]|")
+ if self.tempcache and fullurl in self.tempcache:
+ filename, headers = self.tempcache[fullurl]
+ fp = open(filename, 'rb')
+ return addinfourl(fp, headers, fullurl)
+ urltype, url = splittype(fullurl)
+ if not urltype:
+ urltype = 'file'
+ if urltype in self.proxies:
+ proxy = self.proxies[urltype]
+ urltype, proxyhost = splittype(proxy)
+ host, selector = splithost(proxyhost)
+ url = (host, fullurl) # Signal special case to open_*()
+ else:
+ proxy = None
+ name = 'open_' + urltype
+ self.type = urltype
+ name = name.replace('-', '_')
+ if not hasattr(self, name):
+ if proxy:
+ return self.open_unknown_proxy(proxy, fullurl, data)
+ else:
+ return self.open_unknown(fullurl, data)
+ try:
+ if data is None:
+ return getattr(self, name)(url)
+ else:
+ return getattr(self, name)(url, data)
+ except HTTPError:
+ raise
+ except socket.error as msg:
+ raise_with_traceback(IOError('socket error', msg))
+
+ def open_unknown(self, fullurl, data=None):
+ """Overridable interface to open unknown URL type."""
+ type, url = splittype(fullurl)
+ raise IOError('url error', 'unknown url type', type)
+
+ def open_unknown_proxy(self, proxy, fullurl, data=None):
+ """Overridable interface to open unknown URL type."""
+ type, url = splittype(fullurl)
+ raise IOError('url error', 'invalid proxy for %s' % type, proxy)
+
+ # External interface
+ def retrieve(self, url, filename=None, reporthook=None, data=None):
+ """retrieve(url) returns (filename, headers) for a local object
+ or (tempfilename, headers) for a remote object."""
+ url = unwrap(to_bytes(url))
+ if self.tempcache and url in self.tempcache:
+ return self.tempcache[url]
+ type, url1 = splittype(url)
+ if filename is None and (not type or type == 'file'):
+ try:
+ fp = self.open_local_file(url1)
+ hdrs = fp.info()
+ fp.close()
+ return url2pathname(splithost(url1)[1]), hdrs
+ except IOError as msg:
+ pass
+ fp = self.open(url, data)
+ try:
+ headers = fp.info()
+ if filename:
+ tfp = open(filename, 'wb')
+ else:
+ import tempfile
+ garbage, path = splittype(url)
+ garbage, path = splithost(path or "")
+ path, garbage = splitquery(path or "")
+ path, garbage = splitattr(path or "")
+ suffix = os.path.splitext(path)[1]
+ (fd, filename) = tempfile.mkstemp(suffix)
+ self.__tempfiles.append(filename)
+ tfp = os.fdopen(fd, 'wb')
+ try:
+ result = filename, headers
+ if self.tempcache is not None:
+ self.tempcache[url] = result
+ bs = 1024*8
+ size = -1
+ read = 0
+ blocknum = 0
+ if "content-length" in headers:
+ size = int(headers["Content-Length"])
+ if reporthook:
+ reporthook(blocknum, bs, size)
+ while 1:
+ block = fp.read(bs)
+ if not block:
+ break
+ read += len(block)
+ tfp.write(block)
+ blocknum += 1
+ if reporthook:
+ reporthook(blocknum, bs, size)
+ finally:
+ tfp.close()
+ finally:
+ fp.close()
+
+ # raise exception if actual size does not match content-length header
+ if size >= 0 and read < size:
+ raise ContentTooShortError(
+ "retrieval incomplete: got only %i out of %i bytes"
+ % (read, size), result)
+
+ return result
+
+ # Each method named open_ knows how to open that type of URL
+
+ def _open_generic_http(self, connection_factory, url, data):
+ """Make an HTTP connection using connection_class.
+
+ This is an internal method that should be called from
+ open_http() or open_https().
+
+ Arguments:
+ - connection_factory should take a host name and return an
+ HTTPConnection instance.
+ - url is the url to retrieval or a host, relative-path pair.
+ - data is payload for a POST request or None.
+ """
+
+ user_passwd = None
+ proxy_passwd= None
+ if isinstance(url, str):
+ host, selector = splithost(url)
+ if host:
+ user_passwd, host = splituser(host)
+ host = unquote(host)
+ realhost = host
+ else:
+ host, selector = url
+ # check whether the proxy contains authorization information
+ proxy_passwd, host = splituser(host)
+ # now we proceed with the url we want to obtain
+ urltype, rest = splittype(selector)
+ url = rest
+ user_passwd = None
+ if urltype.lower() != 'http':
+ realhost = None
+ else:
+ realhost, rest = splithost(rest)
+ if realhost:
+ user_passwd, realhost = splituser(realhost)
+ if user_passwd:
+ selector = "%s://%s%s" % (urltype, realhost, rest)
+ if proxy_bypass(realhost):
+ host = realhost
+
+ if not host: raise IOError('http error', 'no host given')
+
+ if proxy_passwd:
+ proxy_passwd = unquote(proxy_passwd)
+ proxy_auth = base64.b64encode(proxy_passwd.encode()).decode('ascii')
+ else:
+ proxy_auth = None
+
+ if user_passwd:
+ user_passwd = unquote(user_passwd)
+ auth = base64.b64encode(user_passwd.encode()).decode('ascii')
+ else:
+ auth = None
+ http_conn = connection_factory(host)
+ headers = {}
+ if proxy_auth:
+ headers["Proxy-Authorization"] = "Basic %s" % proxy_auth
+ if auth:
+ headers["Authorization"] = "Basic %s" % auth
+ if realhost:
+ headers["Host"] = realhost
+
+ # Add Connection:close as we don't support persistent connections yet.
+ # This helps in closing the socket and avoiding ResourceWarning
+
+ headers["Connection"] = "close"
+
+ for header, value in self.addheaders:
+ headers[header] = value
+
+ if data is not None:
+ headers["Content-Type"] = "application/x-www-form-urlencoded"
+ http_conn.request("POST", selector, data, headers)
+ else:
+ http_conn.request("GET", selector, headers=headers)
+
+ try:
+ response = http_conn.getresponse()
+ except http_client.BadStatusLine:
+ # something went wrong with the HTTP status line
+ raise URLError("http protocol error: bad status line")
+
+ # According to RFC 2616, "2xx" code indicates that the client's
+ # request was successfully received, understood, and accepted.
+ if 200 <= response.status < 300:
+ return addinfourl(response, response.msg, "http:" + url,
+ response.status)
+ else:
+ return self.http_error(
+ url, response.fp,
+ response.status, response.reason, response.msg, data)
+
+ def open_http(self, url, data=None):
+ """Use HTTP protocol."""
+ return self._open_generic_http(http_client.HTTPConnection, url, data)
+
+ def http_error(self, url, fp, errcode, errmsg, headers, data=None):
+ """Handle http errors.
+
+ Derived class can override this, or provide specific handlers
+ named http_error_DDD where DDD is the 3-digit error code."""
+ # First check if there's a specific handler for this error
+ name = 'http_error_%d' % errcode
+ if hasattr(self, name):
+ method = getattr(self, name)
+ if data is None:
+ result = method(url, fp, errcode, errmsg, headers)
+ else:
+ result = method(url, fp, errcode, errmsg, headers, data)
+ if result: return result
+ return self.http_error_default(url, fp, errcode, errmsg, headers)
+
+ def http_error_default(self, url, fp, errcode, errmsg, headers):
+ """Default error handler: close the connection and raise IOError."""
+ fp.close()
+ raise HTTPError(url, errcode, errmsg, headers, None)
+
+ if _have_ssl:
+ def _https_connection(self, host):
+ return http_client.HTTPSConnection(host,
+ key_file=self.key_file,
+ cert_file=self.cert_file)
+
+ def open_https(self, url, data=None):
+ """Use HTTPS protocol."""
+ return self._open_generic_http(self._https_connection, url, data)
+
+ def open_file(self, url):
+ """Use local file or FTP depending on form of URL."""
+ if not isinstance(url, str):
+ raise URLError('file error: proxy support for file protocol currently not implemented')
+ if url[:2] == '//' and url[2:3] != '/' and url[2:12].lower() != 'localhost/':
+ raise ValueError("file:// scheme is supported only on localhost")
+ else:
+ return self.open_local_file(url)
+
+ def open_local_file(self, url):
+ """Use local file."""
+ import future.backports.email.utils as email_utils
+ import mimetypes
+ host, file = splithost(url)
+ localname = url2pathname(file)
+ try:
+ stats = os.stat(localname)
+ except OSError as e:
+ raise URLError(e.strerror, e.filename)
+ size = stats.st_size
+ modified = email_utils.formatdate(stats.st_mtime, usegmt=True)
+ mtype = mimetypes.guess_type(url)[0]
+ headers = email.message_from_string(
+ 'Content-Type: %s\nContent-Length: %d\nLast-modified: %s\n' %
+ (mtype or 'text/plain', size, modified))
+ if not host:
+ urlfile = file
+ if file[:1] == '/':
+ urlfile = 'file://' + file
+ return addinfourl(open(localname, 'rb'), headers, urlfile)
+ host, port = splitport(host)
+ if (not port
+ and socket.gethostbyname(host) in ((localhost(),) + thishost())):
+ urlfile = file
+ if file[:1] == '/':
+ urlfile = 'file://' + file
+ elif file[:2] == './':
+ raise ValueError("local file url may start with / or file:. Unknown url of type: %s" % url)
+ return addinfourl(open(localname, 'rb'), headers, urlfile)
+ raise URLError('local file error: not on local host')
+
+ def open_ftp(self, url):
+ """Use FTP protocol."""
+ if not isinstance(url, str):
+ raise URLError('ftp error: proxy support for ftp protocol currently not implemented')
+ import mimetypes
+ host, path = splithost(url)
+ if not host: raise URLError('ftp error: no host given')
+ host, port = splitport(host)
+ user, host = splituser(host)
+ if user: user, passwd = splitpasswd(user)
+ else: passwd = None
+ host = unquote(host)
+ user = unquote(user or '')
+ passwd = unquote(passwd or '')
+ host = socket.gethostbyname(host)
+ if not port:
+ import ftplib
+ port = ftplib.FTP_PORT
+ else:
+ port = int(port)
+ path, attrs = splitattr(path)
+ path = unquote(path)
+ dirs = path.split('/')
+ dirs, file = dirs[:-1], dirs[-1]
+ if dirs and not dirs[0]: dirs = dirs[1:]
+ if dirs and not dirs[0]: dirs[0] = '/'
+ key = user, host, port, '/'.join(dirs)
+ # XXX thread unsafe!
+ if len(self.ftpcache) > MAXFTPCACHE:
+ # Prune the cache, rather arbitrarily
+ for k in self.ftpcache.keys():
+ if k != key:
+ v = self.ftpcache[k]
+ del self.ftpcache[k]
+ v.close()
+ try:
+ if key not in self.ftpcache:
+ self.ftpcache[key] = \
+ ftpwrapper(user, passwd, host, port, dirs)
+ if not file: type = 'D'
+ else: type = 'I'
+ for attr in attrs:
+ attr, value = splitvalue(attr)
+ if attr.lower() == 'type' and \
+ value in ('a', 'A', 'i', 'I', 'd', 'D'):
+ type = value.upper()
+ (fp, retrlen) = self.ftpcache[key].retrfile(file, type)
+ mtype = mimetypes.guess_type("ftp:" + url)[0]
+ headers = ""
+ if mtype:
+ headers += "Content-Type: %s\n" % mtype
+ if retrlen is not None and retrlen >= 0:
+ headers += "Content-Length: %d\n" % retrlen
+ headers = email.message_from_string(headers)
+ return addinfourl(fp, headers, "ftp:" + url)
+ except ftperrors() as exp:
+ raise_with_traceback(URLError('ftp error %r' % exp))
+
+ def open_data(self, url, data=None):
+ """Use "data" URL."""
+ if not isinstance(url, str):
+ raise URLError('data error: proxy support for data protocol currently not implemented')
+ # ignore POSTed data
+ #
+ # syntax of data URLs:
+ # dataurl := "data:" [ mediatype ] [ ";base64" ] "," data
+ # mediatype := [ type "/" subtype ] *( ";" parameter )
+ # data := *urlchar
+ # parameter := attribute "=" value
+ try:
+ [type, data] = url.split(',', 1)
+ except ValueError:
+ raise IOError('data error', 'bad data URL')
+ if not type:
+ type = 'text/plain;charset=US-ASCII'
+ semi = type.rfind(';')
+ if semi >= 0 and '=' not in type[semi:]:
+ encoding = type[semi+1:]
+ type = type[:semi]
+ else:
+ encoding = ''
+ msg = []
+ msg.append('Date: %s'%time.strftime('%a, %d %b %Y %H:%M:%S GMT',
+ time.gmtime(time.time())))
+ msg.append('Content-type: %s' % type)
+ if encoding == 'base64':
+ # XXX is this encoding/decoding ok?
+ data = base64.decodebytes(data.encode('ascii')).decode('latin-1')
+ else:
+ data = unquote(data)
+ msg.append('Content-Length: %d' % len(data))
+ msg.append('')
+ msg.append(data)
+ msg = '\n'.join(msg)
+ headers = email.message_from_string(msg)
+ f = io.StringIO(msg)
+ #f.fileno = None # needed for addinfourl
+ return addinfourl(f, headers, url)
+
+
+class FancyURLopener(URLopener):
+ """Derived class with handlers for errors we can handle (perhaps)."""
+
+ def __init__(self, *args, **kwargs):
+ URLopener.__init__(self, *args, **kwargs)
+ self.auth_cache = {}
+ self.tries = 0
+ self.maxtries = 10
+
+ def http_error_default(self, url, fp, errcode, errmsg, headers):
+ """Default error handling -- don't raise an exception."""
+ return addinfourl(fp, headers, "http:" + url, errcode)
+
+ def http_error_302(self, url, fp, errcode, errmsg, headers, data=None):
+ """Error 302 -- relocated (temporarily)."""
+ self.tries += 1
+ if self.maxtries and self.tries >= self.maxtries:
+ if hasattr(self, "http_error_500"):
+ meth = self.http_error_500
+ else:
+ meth = self.http_error_default
+ self.tries = 0
+ return meth(url, fp, 500,
+ "Internal Server Error: Redirect Recursion", headers)
+ result = self.redirect_internal(url, fp, errcode, errmsg, headers,
+ data)
+ self.tries = 0
+ return result
+
+ def redirect_internal(self, url, fp, errcode, errmsg, headers, data):
+ if 'location' in headers:
+ newurl = headers['location']
+ elif 'uri' in headers:
+ newurl = headers['uri']
+ else:
+ return
+ fp.close()
+
+ # In case the server sent a relative URL, join with original:
+ newurl = urljoin(self.type + ":" + url, newurl)
+
+ urlparts = urlparse(newurl)
+
+ # For security reasons, we don't allow redirection to anything other
+ # than http, https and ftp.
+
+ # We are using newer HTTPError with older redirect_internal method
+ # This older method will get deprecated in 3.3
+
+ if urlparts.scheme not in ('http', 'https', 'ftp', ''):
+ raise HTTPError(newurl, errcode,
+ errmsg +
+ " Redirection to url '%s' is not allowed." % newurl,
+ headers, fp)
+
+ return self.open(newurl)
+
+ def http_error_301(self, url, fp, errcode, errmsg, headers, data=None):
+ """Error 301 -- also relocated (permanently)."""
+ return self.http_error_302(url, fp, errcode, errmsg, headers, data)
+
+ def http_error_303(self, url, fp, errcode, errmsg, headers, data=None):
+ """Error 303 -- also relocated (essentially identical to 302)."""
+ return self.http_error_302(url, fp, errcode, errmsg, headers, data)
+
+ def http_error_307(self, url, fp, errcode, errmsg, headers, data=None):
+ """Error 307 -- relocated, but turn POST into error."""
+ if data is None:
+ return self.http_error_302(url, fp, errcode, errmsg, headers, data)
+ else:
+ return self.http_error_default(url, fp, errcode, errmsg, headers)
+
+ def http_error_401(self, url, fp, errcode, errmsg, headers, data=None,
+ retry=False):
+ """Error 401 -- authentication required.
+ This function supports Basic authentication only."""
+ if 'www-authenticate' not in headers:
+ URLopener.http_error_default(self, url, fp,
+ errcode, errmsg, headers)
+ stuff = headers['www-authenticate']
+ match = re.match('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', stuff)
+ if not match:
+ URLopener.http_error_default(self, url, fp,
+ errcode, errmsg, headers)
+ scheme, realm = match.groups()
+ if scheme.lower() != 'basic':
+ URLopener.http_error_default(self, url, fp,
+ errcode, errmsg, headers)
+ if not retry:
+ URLopener.http_error_default(self, url, fp, errcode, errmsg,
+ headers)
+ name = 'retry_' + self.type + '_basic_auth'
+ if data is None:
+ return getattr(self,name)(url, realm)
+ else:
+ return getattr(self,name)(url, realm, data)
+
+ def http_error_407(self, url, fp, errcode, errmsg, headers, data=None,
+ retry=False):
+ """Error 407 -- proxy authentication required.
+ This function supports Basic authentication only."""
+ if 'proxy-authenticate' not in headers:
+ URLopener.http_error_default(self, url, fp,
+ errcode, errmsg, headers)
+ stuff = headers['proxy-authenticate']
+ match = re.match('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', stuff)
+ if not match:
+ URLopener.http_error_default(self, url, fp,
+ errcode, errmsg, headers)
+ scheme, realm = match.groups()
+ if scheme.lower() != 'basic':
+ URLopener.http_error_default(self, url, fp,
+ errcode, errmsg, headers)
+ if not retry:
+ URLopener.http_error_default(self, url, fp, errcode, errmsg,
+ headers)
+ name = 'retry_proxy_' + self.type + '_basic_auth'
+ if data is None:
+ return getattr(self,name)(url, realm)
+ else:
+ return getattr(self,name)(url, realm, data)
+
+ def retry_proxy_http_basic_auth(self, url, realm, data=None):
+ host, selector = splithost(url)
+ newurl = 'http://' + host + selector
+ proxy = self.proxies['http']
+ urltype, proxyhost = splittype(proxy)
+ proxyhost, proxyselector = splithost(proxyhost)
+ i = proxyhost.find('@') + 1
+ proxyhost = proxyhost[i:]
+ user, passwd = self.get_user_passwd(proxyhost, realm, i)
+ if not (user or passwd): return None
+ proxyhost = "%s:%s@%s" % (quote(user, safe=''),
+ quote(passwd, safe=''), proxyhost)
+ self.proxies['http'] = 'http://' + proxyhost + proxyselector
+ if data is None:
+ return self.open(newurl)
+ else:
+ return self.open(newurl, data)
+
+ def retry_proxy_https_basic_auth(self, url, realm, data=None):
+ host, selector = splithost(url)
+ newurl = 'https://' + host + selector
+ proxy = self.proxies['https']
+ urltype, proxyhost = splittype(proxy)
+ proxyhost, proxyselector = splithost(proxyhost)
+ i = proxyhost.find('@') + 1
+ proxyhost = proxyhost[i:]
+ user, passwd = self.get_user_passwd(proxyhost, realm, i)
+ if not (user or passwd): return None
+ proxyhost = "%s:%s@%s" % (quote(user, safe=''),
+ quote(passwd, safe=''), proxyhost)
+ self.proxies['https'] = 'https://' + proxyhost + proxyselector
+ if data is None:
+ return self.open(newurl)
+ else:
+ return self.open(newurl, data)
+
+ def retry_http_basic_auth(self, url, realm, data=None):
+ host, selector = splithost(url)
+ i = host.find('@') + 1
+ host = host[i:]
+ user, passwd = self.get_user_passwd(host, realm, i)
+ if not (user or passwd): return None
+ host = "%s:%s@%s" % (quote(user, safe=''),
+ quote(passwd, safe=''), host)
+ newurl = 'http://' + host + selector
+ if data is None:
+ return self.open(newurl)
+ else:
+ return self.open(newurl, data)
+
+ def retry_https_basic_auth(self, url, realm, data=None):
+ host, selector = splithost(url)
+ i = host.find('@') + 1
+ host = host[i:]
+ user, passwd = self.get_user_passwd(host, realm, i)
+ if not (user or passwd): return None
+ host = "%s:%s@%s" % (quote(user, safe=''),
+ quote(passwd, safe=''), host)
+ newurl = 'https://' + host + selector
+ if data is None:
+ return self.open(newurl)
+ else:
+ return self.open(newurl, data)
+
+ def get_user_passwd(self, host, realm, clear_cache=0):
+ key = realm + '@' + host.lower()
+ if key in self.auth_cache:
+ if clear_cache:
+ del self.auth_cache[key]
+ else:
+ return self.auth_cache[key]
+ user, passwd = self.prompt_user_passwd(host, realm)
+ if user or passwd: self.auth_cache[key] = (user, passwd)
+ return user, passwd
+
+ def prompt_user_passwd(self, host, realm):
+ """Override this in a GUI environment!"""
+ import getpass
+ try:
+ user = input("Enter username for %s at %s: " % (realm, host))
+ passwd = getpass.getpass("Enter password for %s in %s at %s: " %
+ (user, realm, host))
+ return user, passwd
+ except KeyboardInterrupt:
+ print()
+ return None, None
+
+
+# Utility functions
+
+_localhost = None
+def localhost():
+ """Return the IP address of the magic hostname 'localhost'."""
+ global _localhost
+ if _localhost is None:
+ _localhost = socket.gethostbyname('localhost')
+ return _localhost
+
+_thishost = None
+def thishost():
+ """Return the IP addresses of the current host."""
+ global _thishost
+ if _thishost is None:
+ try:
+ _thishost = tuple(socket.gethostbyname_ex(socket.gethostname())[2])
+ except socket.gaierror:
+ _thishost = tuple(socket.gethostbyname_ex('localhost')[2])
+ return _thishost
+
+_ftperrors = None
+def ftperrors():
+ """Return the set of errors raised by the FTP class."""
+ global _ftperrors
+ if _ftperrors is None:
+ import ftplib
+ _ftperrors = ftplib.all_errors
+ return _ftperrors
+
+_noheaders = None
+def noheaders():
+ """Return an empty email Message object."""
+ global _noheaders
+ if _noheaders is None:
+ _noheaders = email.message_from_string("")
+ return _noheaders
+
+
+# Utility classes
+
+class ftpwrapper(object):
+ """Class used by open_ftp() for cache of open FTP connections."""
+
+ def __init__(self, user, passwd, host, port, dirs, timeout=None,
+ persistent=True):
+ self.user = user
+ self.passwd = passwd
+ self.host = host
+ self.port = port
+ self.dirs = dirs
+ self.timeout = timeout
+ self.refcount = 0
+ self.keepalive = persistent
+ self.init()
+
+ def init(self):
+ import ftplib
+ self.busy = 0
+ self.ftp = ftplib.FTP()
+ self.ftp.connect(self.host, self.port, self.timeout)
+ self.ftp.login(self.user, self.passwd)
+ _target = '/'.join(self.dirs)
+ self.ftp.cwd(_target)
+
+ def retrfile(self, file, type):
+ import ftplib
+ self.endtransfer()
+ if type in ('d', 'D'): cmd = 'TYPE A'; isdir = 1
+ else: cmd = 'TYPE ' + type; isdir = 0
+ try:
+ self.ftp.voidcmd(cmd)
+ except ftplib.all_errors:
+ self.init()
+ self.ftp.voidcmd(cmd)
+ conn = None
+ if file and not isdir:
+ # Try to retrieve as a file
+ try:
+ cmd = 'RETR ' + file
+ conn, retrlen = self.ftp.ntransfercmd(cmd)
+ except ftplib.error_perm as reason:
+ if str(reason)[:3] != '550':
+ raise_with_traceback(URLError('ftp error: %r' % reason))
+ if not conn:
+ # Set transfer mode to ASCII!
+ self.ftp.voidcmd('TYPE A')
+ # Try a directory listing. Verify that directory exists.
+ if file:
+ pwd = self.ftp.pwd()
+ try:
+ try:
+ self.ftp.cwd(file)
+ except ftplib.error_perm as reason:
+ ### Was:
+ # raise URLError('ftp error: %r' % reason) from reason
+ exc = URLError('ftp error: %r' % reason)
+ exc.__cause__ = reason
+ raise exc
+ finally:
+ self.ftp.cwd(pwd)
+ cmd = 'LIST ' + file
+ else:
+ cmd = 'LIST'
+ conn, retrlen = self.ftp.ntransfercmd(cmd)
+ self.busy = 1
+
+ ftpobj = addclosehook(conn.makefile('rb'), self.file_close)
+ self.refcount += 1
+ conn.close()
+ # Pass back both a suitably decorated object and a retrieval length
+ return (ftpobj, retrlen)
+
+ def endtransfer(self):
+ self.busy = 0
+
+ def close(self):
+ self.keepalive = False
+ if self.refcount <= 0:
+ self.real_close()
+
+ def file_close(self):
+ self.endtransfer()
+ self.refcount -= 1
+ if self.refcount <= 0 and not self.keepalive:
+ self.real_close()
+
+ def real_close(self):
+ self.endtransfer()
+ try:
+ self.ftp.close()
+ except ftperrors():
+ pass
+
+# Proxy handling
+def getproxies_environment():
+ """Return a dictionary of scheme -> proxy server URL mappings.
+
+ Scan the environment for variables named _proxy;
+ this seems to be the standard convention. If you need a
+ different way, you can pass a proxies dictionary to the
+ [Fancy]URLopener constructor.
+
+ """
+ proxies = {}
+ for name, value in os.environ.items():
+ name = name.lower()
+ if value and name[-6:] == '_proxy':
+ proxies[name[:-6]] = value
+ return proxies
+
+def proxy_bypass_environment(host):
+ """Test if proxies should not be used for a particular host.
+
+ Checks the environment for a variable named no_proxy, which should
+ be a list of DNS suffixes separated by commas, or '*' for all hosts.
+ """
+ no_proxy = os.environ.get('no_proxy', '') or os.environ.get('NO_PROXY', '')
+ # '*' is special case for always bypass
+ if no_proxy == '*':
+ return 1
+ # strip port off host
+ hostonly, port = splitport(host)
+ # check if the host ends with any of the DNS suffixes
+ no_proxy_list = [proxy.strip() for proxy in no_proxy.split(',')]
+ for name in no_proxy_list:
+ if name and (hostonly.endswith(name) or host.endswith(name)):
+ return 1
+ # otherwise, don't bypass
+ return 0
+
+
+# This code tests an OSX specific data structure but is testable on all
+# platforms
+def _proxy_bypass_macosx_sysconf(host, proxy_settings):
+ """
+ Return True iff this host shouldn't be accessed using a proxy
+
+ This function uses the MacOSX framework SystemConfiguration
+ to fetch the proxy information.
+
+ proxy_settings come from _scproxy._get_proxy_settings or get mocked ie:
+ { 'exclude_simple': bool,
+ 'exceptions': ['foo.bar', '*.bar.com', '127.0.0.1', '10.1', '10.0/16']
+ }
+ """
+ from fnmatch import fnmatch
+
+ hostonly, port = splitport(host)
+
+ def ip2num(ipAddr):
+ parts = ipAddr.split('.')
+ parts = list(map(int, parts))
+ if len(parts) != 4:
+ parts = (parts + [0, 0, 0, 0])[:4]
+ return (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8) | parts[3]
+
+ # Check for simple host names:
+ if '.' not in host:
+ if proxy_settings['exclude_simple']:
+ return True
+
+ hostIP = None
+
+ for value in proxy_settings.get('exceptions', ()):
+ # Items in the list are strings like these: *.local, 169.254/16
+ if not value: continue
+
+ m = re.match(r"(\d+(?:\.\d+)*)(/\d+)?", value)
+ if m is not None:
+ if hostIP is None:
+ try:
+ hostIP = socket.gethostbyname(hostonly)
+ hostIP = ip2num(hostIP)
+ except socket.error:
+ continue
+
+ base = ip2num(m.group(1))
+ mask = m.group(2)
+ if mask is None:
+ mask = 8 * (m.group(1).count('.') + 1)
+ else:
+ mask = int(mask[1:])
+ mask = 32 - mask
+
+ if (hostIP >> mask) == (base >> mask):
+ return True
+
+ elif fnmatch(host, value):
+ return True
+
+ return False
+
+
+if sys.platform == 'darwin':
+ from _scproxy import _get_proxy_settings, _get_proxies
+
+ def proxy_bypass_macosx_sysconf(host):
+ proxy_settings = _get_proxy_settings()
+ return _proxy_bypass_macosx_sysconf(host, proxy_settings)
+
+ def getproxies_macosx_sysconf():
+ """Return a dictionary of scheme -> proxy server URL mappings.
+
+ This function uses the MacOSX framework SystemConfiguration
+ to fetch the proxy information.
+ """
+ return _get_proxies()
+
+
+
+ def proxy_bypass(host):
+ if getproxies_environment():
+ return proxy_bypass_environment(host)
+ else:
+ return proxy_bypass_macosx_sysconf(host)
+
+ def getproxies():
+ return getproxies_environment() or getproxies_macosx_sysconf()
+
+
+elif os.name == 'nt':
+ def getproxies_registry():
+ """Return a dictionary of scheme -> proxy server URL mappings.
+
+ Win32 uses the registry to store proxies.
+
+ """
+ proxies = {}
+ try:
+ import winreg
+ except ImportError:
+ # Std module, so should be around - but you never know!
+ return proxies
+ try:
+ internetSettings = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
+ r'Software\Microsoft\Windows\CurrentVersion\Internet Settings')
+ proxyEnable = winreg.QueryValueEx(internetSettings,
+ 'ProxyEnable')[0]
+ if proxyEnable:
+ # Returned as Unicode but problems if not converted to ASCII
+ proxyServer = str(winreg.QueryValueEx(internetSettings,
+ 'ProxyServer')[0])
+ if '=' in proxyServer:
+ # Per-protocol settings
+ for p in proxyServer.split(';'):
+ protocol, address = p.split('=', 1)
+ # See if address has a type:// prefix
+ if not re.match('^([^/:]+)://', address):
+ address = '%s://%s' % (protocol, address)
+ proxies[protocol] = address
+ else:
+ # Use one setting for all protocols
+ if proxyServer[:5] == 'http:':
+ proxies['http'] = proxyServer
+ else:
+ proxies['http'] = 'http://%s' % proxyServer
+ proxies['https'] = 'https://%s' % proxyServer
+ proxies['ftp'] = 'ftp://%s' % proxyServer
+ internetSettings.Close()
+ except (WindowsError, ValueError, TypeError):
+ # Either registry key not found etc, or the value in an
+ # unexpected format.
+ # proxies already set up to be empty so nothing to do
+ pass
+ return proxies
+
+ def getproxies():
+ """Return a dictionary of scheme -> proxy server URL mappings.
+
+ Returns settings gathered from the environment, if specified,
+ or the registry.
+
+ """
+ return getproxies_environment() or getproxies_registry()
+
+ def proxy_bypass_registry(host):
+ try:
+ import winreg
+ except ImportError:
+ # Std modules, so should be around - but you never know!
+ return 0
+ try:
+ internetSettings = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
+ r'Software\Microsoft\Windows\CurrentVersion\Internet Settings')
+ proxyEnable = winreg.QueryValueEx(internetSettings,
+ 'ProxyEnable')[0]
+ proxyOverride = str(winreg.QueryValueEx(internetSettings,
+ 'ProxyOverride')[0])
+ # ^^^^ Returned as Unicode but problems if not converted to ASCII
+ except WindowsError:
+ return 0
+ if not proxyEnable or not proxyOverride:
+ return 0
+ # try to make a host list from name and IP address.
+ rawHost, port = splitport(host)
+ host = [rawHost]
+ try:
+ addr = socket.gethostbyname(rawHost)
+ if addr != rawHost:
+ host.append(addr)
+ except socket.error:
+ pass
+ try:
+ fqdn = socket.getfqdn(rawHost)
+ if fqdn != rawHost:
+ host.append(fqdn)
+ except socket.error:
+ pass
+ # make a check value list from the registry entry: replace the
+ # '' string by the localhost entry and the corresponding
+ # canonical entry.
+ proxyOverride = proxyOverride.split(';')
+ # now check if we match one of the registry values.
+ for test in proxyOverride:
+ if test == '':
+ if '.' not in rawHost:
+ return 1
+ test = test.replace(".", r"\.") # mask dots
+ test = test.replace("*", r".*") # change glob sequence
+ test = test.replace("?", r".") # change glob char
+ for val in host:
+ if re.match(test, val, re.I):
+ return 1
+ return 0
+
+ def proxy_bypass(host):
+ """Return a dictionary of scheme -> proxy server URL mappings.
+
+ Returns settings gathered from the environment, if specified,
+ or the registry.
+
+ """
+ if getproxies_environment():
+ return proxy_bypass_environment(host)
+ else:
+ return proxy_bypass_registry(host)
+
+else:
+ # By default use environment variables
+ getproxies = getproxies_environment
+ proxy_bypass = proxy_bypass_environment
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/urllib/response.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/urllib/response.py
new file mode 100644
index 0000000..adbf6e5
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/urllib/response.py
@@ -0,0 +1,103 @@
+"""Response classes used by urllib.
+
+The base class, addbase, defines a minimal file-like interface,
+including read() and readline(). The typical response object is an
+addinfourl instance, which defines an info() method that returns
+headers and a geturl() method that returns the url.
+"""
+from __future__ import absolute_import, division, unicode_literals
+from future.builtins import object
+
+class addbase(object):
+ """Base class for addinfo and addclosehook."""
+
+ # XXX Add a method to expose the timeout on the underlying socket?
+
+ def __init__(self, fp):
+ # TODO(jhylton): Is there a better way to delegate using io?
+ self.fp = fp
+ self.read = self.fp.read
+ self.readline = self.fp.readline
+ # TODO(jhylton): Make sure an object with readlines() is also iterable
+ if hasattr(self.fp, "readlines"):
+ self.readlines = self.fp.readlines
+ if hasattr(self.fp, "fileno"):
+ self.fileno = self.fp.fileno
+ else:
+ self.fileno = lambda: None
+
+ def __iter__(self):
+ # Assigning `__iter__` to the instance doesn't work as intended
+ # because the iter builtin does something like `cls.__iter__(obj)`
+ # and thus fails to find the _bound_ method `obj.__iter__`.
+ # Returning just `self.fp` works for built-in file objects but
+ # might not work for general file-like objects.
+ return iter(self.fp)
+
+ def __repr__(self):
+ return '<%s at %r whose fp = %r>' % (self.__class__.__name__,
+ id(self), self.fp)
+
+ def close(self):
+ if self.fp:
+ self.fp.close()
+ self.fp = None
+ self.read = None
+ self.readline = None
+ self.readlines = None
+ self.fileno = None
+ self.__iter__ = None
+ self.__next__ = None
+
+ def __enter__(self):
+ if self.fp is None:
+ raise ValueError("I/O operation on closed file")
+ return self
+
+ def __exit__(self, type, value, traceback):
+ self.close()
+
+class addclosehook(addbase):
+ """Class to add a close hook to an open file."""
+
+ def __init__(self, fp, closehook, *hookargs):
+ addbase.__init__(self, fp)
+ self.closehook = closehook
+ self.hookargs = hookargs
+
+ def close(self):
+ if self.closehook:
+ self.closehook(*self.hookargs)
+ self.closehook = None
+ self.hookargs = None
+ addbase.close(self)
+
+class addinfo(addbase):
+ """class to add an info() method to an open file."""
+
+ def __init__(self, fp, headers):
+ addbase.__init__(self, fp)
+ self.headers = headers
+
+ def info(self):
+ return self.headers
+
+class addinfourl(addbase):
+ """class to add info() and geturl() methods to an open file."""
+
+ def __init__(self, fp, headers, url, code=None):
+ addbase.__init__(self, fp)
+ self.headers = headers
+ self.url = url
+ self.code = code
+
+ def info(self):
+ return self.headers
+
+ def getcode(self):
+ return self.code
+
+ def geturl(self):
+ return self.url
+
+del absolute_import, division, unicode_literals, object
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/urllib/robotparser.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/urllib/robotparser.py
new file mode 100644
index 0000000..a0f3651
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/urllib/robotparser.py
@@ -0,0 +1,211 @@
+from __future__ import absolute_import, division, unicode_literals
+from future.builtins import str
+""" robotparser.py
+
+ Copyright (C) 2000 Bastian Kleineidam
+
+ You can choose between two licenses when using this package:
+ 1) GNU GPLv2
+ 2) PSF license for Python 2.2
+
+ The robots.txt Exclusion Protocol is implemented as specified in
+ http://info.webcrawler.com/mak/projects/robots/norobots-rfc.html
+"""
+
+# Was: import urllib.parse, urllib.request
+from future.backports import urllib
+from future.backports.urllib import parse as _parse, request as _request
+urllib.parse = _parse
+urllib.request = _request
+
+
+__all__ = ["RobotFileParser"]
+
+class RobotFileParser(object):
+ """ This class provides a set of methods to read, parse and answer
+ questions about a single robots.txt file.
+
+ """
+
+ def __init__(self, url=''):
+ self.entries = []
+ self.default_entry = None
+ self.disallow_all = False
+ self.allow_all = False
+ self.set_url(url)
+ self.last_checked = 0
+
+ def mtime(self):
+ """Returns the time the robots.txt file was last fetched.
+
+ This is useful for long-running web spiders that need to
+ check for new robots.txt files periodically.
+
+ """
+ return self.last_checked
+
+ def modified(self):
+ """Sets the time the robots.txt file was last fetched to the
+ current time.
+
+ """
+ import time
+ self.last_checked = time.time()
+
+ def set_url(self, url):
+ """Sets the URL referring to a robots.txt file."""
+ self.url = url
+ self.host, self.path = urllib.parse.urlparse(url)[1:3]
+
+ def read(self):
+ """Reads the robots.txt URL and feeds it to the parser."""
+ try:
+ f = urllib.request.urlopen(self.url)
+ except urllib.error.HTTPError as err:
+ if err.code in (401, 403):
+ self.disallow_all = True
+ elif err.code >= 400:
+ self.allow_all = True
+ else:
+ raw = f.read()
+ self.parse(raw.decode("utf-8").splitlines())
+
+ def _add_entry(self, entry):
+ if "*" in entry.useragents:
+ # the default entry is considered last
+ if self.default_entry is None:
+ # the first default entry wins
+ self.default_entry = entry
+ else:
+ self.entries.append(entry)
+
+ def parse(self, lines):
+ """Parse the input lines from a robots.txt file.
+
+ We allow that a user-agent: line is not preceded by
+ one or more blank lines.
+ """
+ # states:
+ # 0: start state
+ # 1: saw user-agent line
+ # 2: saw an allow or disallow line
+ state = 0
+ entry = Entry()
+
+ for line in lines:
+ if not line:
+ if state == 1:
+ entry = Entry()
+ state = 0
+ elif state == 2:
+ self._add_entry(entry)
+ entry = Entry()
+ state = 0
+ # remove optional comment and strip line
+ i = line.find('#')
+ if i >= 0:
+ line = line[:i]
+ line = line.strip()
+ if not line:
+ continue
+ line = line.split(':', 1)
+ if len(line) == 2:
+ line[0] = line[0].strip().lower()
+ line[1] = urllib.parse.unquote(line[1].strip())
+ if line[0] == "user-agent":
+ if state == 2:
+ self._add_entry(entry)
+ entry = Entry()
+ entry.useragents.append(line[1])
+ state = 1
+ elif line[0] == "disallow":
+ if state != 0:
+ entry.rulelines.append(RuleLine(line[1], False))
+ state = 2
+ elif line[0] == "allow":
+ if state != 0:
+ entry.rulelines.append(RuleLine(line[1], True))
+ state = 2
+ if state == 2:
+ self._add_entry(entry)
+
+
+ def can_fetch(self, useragent, url):
+ """using the parsed robots.txt decide if useragent can fetch url"""
+ if self.disallow_all:
+ return False
+ if self.allow_all:
+ return True
+ # search for given user agent matches
+ # the first match counts
+ parsed_url = urllib.parse.urlparse(urllib.parse.unquote(url))
+ url = urllib.parse.urlunparse(('','',parsed_url.path,
+ parsed_url.params,parsed_url.query, parsed_url.fragment))
+ url = urllib.parse.quote(url)
+ if not url:
+ url = "/"
+ for entry in self.entries:
+ if entry.applies_to(useragent):
+ return entry.allowance(url)
+ # try the default entry last
+ if self.default_entry:
+ return self.default_entry.allowance(url)
+ # agent not found ==> access granted
+ return True
+
+ def __str__(self):
+ return ''.join([str(entry) + "\n" for entry in self.entries])
+
+
+class RuleLine(object):
+ """A rule line is a single "Allow:" (allowance==True) or "Disallow:"
+ (allowance==False) followed by a path."""
+ def __init__(self, path, allowance):
+ if path == '' and not allowance:
+ # an empty value means allow all
+ allowance = True
+ self.path = urllib.parse.quote(path)
+ self.allowance = allowance
+
+ def applies_to(self, filename):
+ return self.path == "*" or filename.startswith(self.path)
+
+ def __str__(self):
+ return (self.allowance and "Allow" or "Disallow") + ": " + self.path
+
+
+class Entry(object):
+ """An entry has one or more user-agents and zero or more rulelines"""
+ def __init__(self):
+ self.useragents = []
+ self.rulelines = []
+
+ def __str__(self):
+ ret = []
+ for agent in self.useragents:
+ ret.extend(["User-agent: ", agent, "\n"])
+ for line in self.rulelines:
+ ret.extend([str(line), "\n"])
+ return ''.join(ret)
+
+ def applies_to(self, useragent):
+ """check if this entry applies to the specified agent"""
+ # split the name token and make it lower case
+ useragent = useragent.split("/")[0].lower()
+ for agent in self.useragents:
+ if agent == '*':
+ # we have the catch-all agent
+ return True
+ agent = agent.lower()
+ if agent in useragent:
+ return True
+ return False
+
+ def allowance(self, filename):
+ """Preconditions:
+ - our agent applies to this entry
+ - filename is URL decoded"""
+ for line in self.rulelines:
+ if line.applies_to(filename):
+ return line.allowance
+ return True
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/xmlrpc/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/xmlrpc/__init__.py
new file mode 100644
index 0000000..196d378
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/xmlrpc/__init__.py
@@ -0,0 +1 @@
+# This directory is a Python package.
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/xmlrpc/client.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/xmlrpc/client.py
new file mode 100644
index 0000000..b78e5ba
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/xmlrpc/client.py
@@ -0,0 +1,1496 @@
+#
+# XML-RPC CLIENT LIBRARY
+# $Id$
+#
+# an XML-RPC client interface for Python.
+#
+# the marshalling and response parser code can also be used to
+# implement XML-RPC servers.
+#
+# Notes:
+# this version is designed to work with Python 2.1 or newer.
+#
+# History:
+# 1999-01-14 fl Created
+# 1999-01-15 fl Changed dateTime to use localtime
+# 1999-01-16 fl Added Binary/base64 element, default to RPC2 service
+# 1999-01-19 fl Fixed array data element (from Skip Montanaro)
+# 1999-01-21 fl Fixed dateTime constructor, etc.
+# 1999-02-02 fl Added fault handling, handle empty sequences, etc.
+# 1999-02-10 fl Fixed problem with empty responses (from Skip Montanaro)
+# 1999-06-20 fl Speed improvements, pluggable parsers/transports (0.9.8)
+# 2000-11-28 fl Changed boolean to check the truth value of its argument
+# 2001-02-24 fl Added encoding/Unicode/SafeTransport patches
+# 2001-02-26 fl Added compare support to wrappers (0.9.9/1.0b1)
+# 2001-03-28 fl Make sure response tuple is a singleton
+# 2001-03-29 fl Don't require empty params element (from Nicholas Riley)
+# 2001-06-10 fl Folded in _xmlrpclib accelerator support (1.0b2)
+# 2001-08-20 fl Base xmlrpclib.Error on built-in Exception (from Paul Prescod)
+# 2001-09-03 fl Allow Transport subclass to override getparser
+# 2001-09-10 fl Lazy import of urllib, cgi, xmllib (20x import speedup)
+# 2001-10-01 fl Remove containers from memo cache when done with them
+# 2001-10-01 fl Use faster escape method (80% dumps speedup)
+# 2001-10-02 fl More dumps microtuning
+# 2001-10-04 fl Make sure import expat gets a parser (from Guido van Rossum)
+# 2001-10-10 sm Allow long ints to be passed as ints if they don't overflow
+# 2001-10-17 sm Test for int and long overflow (allows use on 64-bit systems)
+# 2001-11-12 fl Use repr() to marshal doubles (from Paul Felix)
+# 2002-03-17 fl Avoid buffered read when possible (from James Rucker)
+# 2002-04-07 fl Added pythondoc comments
+# 2002-04-16 fl Added __str__ methods to datetime/binary wrappers
+# 2002-05-15 fl Added error constants (from Andrew Kuchling)
+# 2002-06-27 fl Merged with Python CVS version
+# 2002-10-22 fl Added basic authentication (based on code from Phillip Eby)
+# 2003-01-22 sm Add support for the bool type
+# 2003-02-27 gvr Remove apply calls
+# 2003-04-24 sm Use cStringIO if available
+# 2003-04-25 ak Add support for nil
+# 2003-06-15 gn Add support for time.struct_time
+# 2003-07-12 gp Correct marshalling of Faults
+# 2003-10-31 mvl Add multicall support
+# 2004-08-20 mvl Bump minimum supported Python version to 2.1
+#
+# Copyright (c) 1999-2002 by Secret Labs AB.
+# Copyright (c) 1999-2002 by Fredrik Lundh.
+#
+# info@pythonware.com
+# http://www.pythonware.com
+#
+# --------------------------------------------------------------------
+# The XML-RPC client interface is
+#
+# Copyright (c) 1999-2002 by Secret Labs AB
+# Copyright (c) 1999-2002 by Fredrik Lundh
+#
+# By obtaining, using, and/or copying this software and/or its
+# associated documentation, you agree that you have read, understood,
+# and will comply with the following terms and conditions:
+#
+# Permission to use, copy, modify, and distribute this software and
+# its associated documentation for any purpose and without fee is
+# hereby granted, provided that the above copyright notice appears in
+# all copies, and that both that copyright notice and this permission
+# notice appear in supporting documentation, and that the name of
+# Secret Labs AB or the author not be used in advertising or publicity
+# pertaining to distribution of the software without specific, written
+# prior permission.
+#
+# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
+# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
+# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
+# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+# --------------------------------------------------------------------
+
+"""
+Ported using Python-Future from the Python 3.3 standard library.
+
+An XML-RPC client interface for Python.
+
+The marshalling and response parser code can also be used to
+implement XML-RPC servers.
+
+Exported exceptions:
+
+ Error Base class for client errors
+ ProtocolError Indicates an HTTP protocol error
+ ResponseError Indicates a broken response package
+ Fault Indicates an XML-RPC fault package
+
+Exported classes:
+
+ ServerProxy Represents a logical connection to an XML-RPC server
+
+ MultiCall Executor of boxcared xmlrpc requests
+ DateTime dateTime wrapper for an ISO 8601 string or time tuple or
+ localtime integer value to generate a "dateTime.iso8601"
+ XML-RPC value
+ Binary binary data wrapper
+
+ Marshaller Generate an XML-RPC params chunk from a Python data structure
+ Unmarshaller Unmarshal an XML-RPC response from incoming XML event message
+ Transport Handles an HTTP transaction to an XML-RPC server
+ SafeTransport Handles an HTTPS transaction to an XML-RPC server
+
+Exported constants:
+
+ (none)
+
+Exported functions:
+
+ getparser Create instance of the fastest available parser & attach
+ to an unmarshalling object
+ dumps Convert an argument tuple or a Fault instance to an XML-RPC
+ request (or response, if the methodresponse option is used).
+ loads Convert an XML-RPC packet to unmarshalled data plus a method
+ name (None if not present).
+"""
+
+from __future__ import (absolute_import, division, print_function,
+ unicode_literals)
+from future.builtins import bytes, dict, int, range, str
+
+import base64
+# Py2.7 compatibility hack
+base64.encodebytes = base64.encodestring
+base64.decodebytes = base64.decodestring
+import sys
+import time
+from datetime import datetime
+from future.backports.http import client as http_client
+from future.backports.urllib import parse as urllib_parse
+from future.utils import ensure_new_type
+from xml.parsers import expat
+import socket
+import errno
+from io import BytesIO
+try:
+ import gzip
+except ImportError:
+ gzip = None #python can be built without zlib/gzip support
+
+# --------------------------------------------------------------------
+# Internal stuff
+
+def escape(s):
+ s = s.replace("&", "&")
+ s = s.replace("<", "<")
+ return s.replace(">", ">",)
+
+# used in User-Agent header sent
+__version__ = sys.version[:3]
+
+# xmlrpc integer limits
+MAXINT = 2**31-1
+MININT = -2**31
+
+# --------------------------------------------------------------------
+# Error constants (from Dan Libby's specification at
+# http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php)
+
+# Ranges of errors
+PARSE_ERROR = -32700
+SERVER_ERROR = -32600
+APPLICATION_ERROR = -32500
+SYSTEM_ERROR = -32400
+TRANSPORT_ERROR = -32300
+
+# Specific errors
+NOT_WELLFORMED_ERROR = -32700
+UNSUPPORTED_ENCODING = -32701
+INVALID_ENCODING_CHAR = -32702
+INVALID_XMLRPC = -32600
+METHOD_NOT_FOUND = -32601
+INVALID_METHOD_PARAMS = -32602
+INTERNAL_ERROR = -32603
+
+# --------------------------------------------------------------------
+# Exceptions
+
+##
+# Base class for all kinds of client-side errors.
+
+class Error(Exception):
+ """Base class for client errors."""
+ def __str__(self):
+ return repr(self)
+
+##
+# Indicates an HTTP-level protocol error. This is raised by the HTTP
+# transport layer, if the server returns an error code other than 200
+# (OK).
+#
+# @param url The target URL.
+# @param errcode The HTTP error code.
+# @param errmsg The HTTP error message.
+# @param headers The HTTP header dictionary.
+
+class ProtocolError(Error):
+ """Indicates an HTTP protocol error."""
+ def __init__(self, url, errcode, errmsg, headers):
+ Error.__init__(self)
+ self.url = url
+ self.errcode = errcode
+ self.errmsg = errmsg
+ self.headers = headers
+ def __repr__(self):
+ return (
+ "" %
+ (self.url, self.errcode, self.errmsg)
+ )
+
+##
+# Indicates a broken XML-RPC response package. This exception is
+# raised by the unmarshalling layer, if the XML-RPC response is
+# malformed.
+
+class ResponseError(Error):
+ """Indicates a broken response package."""
+ pass
+
+##
+# Indicates an XML-RPC fault response package. This exception is
+# raised by the unmarshalling layer, if the XML-RPC response contains
+# a fault string. This exception can also be used as a class, to
+# generate a fault XML-RPC message.
+#
+# @param faultCode The XML-RPC fault code.
+# @param faultString The XML-RPC fault string.
+
+class Fault(Error):
+ """Indicates an XML-RPC fault package."""
+ def __init__(self, faultCode, faultString, **extra):
+ Error.__init__(self)
+ self.faultCode = faultCode
+ self.faultString = faultString
+ def __repr__(self):
+ return "" % (ensure_new_type(self.faultCode),
+ ensure_new_type(self.faultString))
+
+# --------------------------------------------------------------------
+# Special values
+
+##
+# Backwards compatibility
+
+boolean = Boolean = bool
+
+##
+# Wrapper for XML-RPC DateTime values. This converts a time value to
+# the format used by XML-RPC.
+#
+# The value can be given as a datetime object, as a string in the
+# format "yyyymmddThh:mm:ss", as a 9-item time tuple (as returned by
+# time.localtime()), or an integer value (as returned by time.time()).
+# The wrapper uses time.localtime() to convert an integer to a time
+# tuple.
+#
+# @param value The time, given as a datetime object, an ISO 8601 string,
+# a time tuple, or an integer time value.
+
+
+### For Python-Future:
+def _iso8601_format(value):
+ return "%04d%02d%02dT%02d:%02d:%02d" % (
+ value.year, value.month, value.day,
+ value.hour, value.minute, value.second)
+###
+# Issue #13305: different format codes across platforms
+# _day0 = datetime(1, 1, 1)
+# if _day0.strftime('%Y') == '0001': # Mac OS X
+# def _iso8601_format(value):
+# return value.strftime("%Y%m%dT%H:%M:%S")
+# elif _day0.strftime('%4Y') == '0001': # Linux
+# def _iso8601_format(value):
+# return value.strftime("%4Y%m%dT%H:%M:%S")
+# else:
+# def _iso8601_format(value):
+# return value.strftime("%Y%m%dT%H:%M:%S").zfill(17)
+# del _day0
+
+
+def _strftime(value):
+ if isinstance(value, datetime):
+ return _iso8601_format(value)
+
+ if not isinstance(value, (tuple, time.struct_time)):
+ if value == 0:
+ value = time.time()
+ value = time.localtime(value)
+
+ return "%04d%02d%02dT%02d:%02d:%02d" % value[:6]
+
+class DateTime(object):
+ """DateTime wrapper for an ISO 8601 string or time tuple or
+ localtime integer value to generate 'dateTime.iso8601' XML-RPC
+ value.
+ """
+
+ def __init__(self, value=0):
+ if isinstance(value, str):
+ self.value = value
+ else:
+ self.value = _strftime(value)
+
+ def make_comparable(self, other):
+ if isinstance(other, DateTime):
+ s = self.value
+ o = other.value
+ elif isinstance(other, datetime):
+ s = self.value
+ o = _iso8601_format(other)
+ elif isinstance(other, str):
+ s = self.value
+ o = other
+ elif hasattr(other, "timetuple"):
+ s = self.timetuple()
+ o = other.timetuple()
+ else:
+ otype = (hasattr(other, "__class__")
+ and other.__class__.__name__
+ or type(other))
+ raise TypeError("Can't compare %s and %s" %
+ (self.__class__.__name__, otype))
+ return s, o
+
+ def __lt__(self, other):
+ s, o = self.make_comparable(other)
+ return s < o
+
+ def __le__(self, other):
+ s, o = self.make_comparable(other)
+ return s <= o
+
+ def __gt__(self, other):
+ s, o = self.make_comparable(other)
+ return s > o
+
+ def __ge__(self, other):
+ s, o = self.make_comparable(other)
+ return s >= o
+
+ def __eq__(self, other):
+ s, o = self.make_comparable(other)
+ return s == o
+
+ def __ne__(self, other):
+ s, o = self.make_comparable(other)
+ return s != o
+
+ def timetuple(self):
+ return time.strptime(self.value, "%Y%m%dT%H:%M:%S")
+
+ ##
+ # Get date/time value.
+ #
+ # @return Date/time value, as an ISO 8601 string.
+
+ def __str__(self):
+ return self.value
+
+ def __repr__(self):
+ return "" % (ensure_new_type(self.value), id(self))
+
+ def decode(self, data):
+ self.value = str(data).strip()
+
+ def encode(self, out):
+ out.write("")
+ out.write(self.value)
+ out.write("\n")
+
+def _datetime(data):
+ # decode xml element contents into a DateTime structure.
+ value = DateTime()
+ value.decode(data)
+ return value
+
+def _datetime_type(data):
+ return datetime.strptime(data, "%Y%m%dT%H:%M:%S")
+
+##
+# Wrapper for binary data. This can be used to transport any kind
+# of binary data over XML-RPC, using BASE64 encoding.
+#
+# @param data An 8-bit string containing arbitrary data.
+
+class Binary(object):
+ """Wrapper for binary data."""
+
+ def __init__(self, data=None):
+ if data is None:
+ data = b""
+ else:
+ if not isinstance(data, (bytes, bytearray)):
+ raise TypeError("expected bytes or bytearray, not %s" %
+ data.__class__.__name__)
+ data = bytes(data) # Make a copy of the bytes!
+ self.data = data
+
+ ##
+ # Get buffer contents.
+ #
+ # @return Buffer contents, as an 8-bit string.
+
+ def __str__(self):
+ return str(self.data, "latin-1") # XXX encoding?!
+
+ def __eq__(self, other):
+ if isinstance(other, Binary):
+ other = other.data
+ return self.data == other
+
+ def __ne__(self, other):
+ if isinstance(other, Binary):
+ other = other.data
+ return self.data != other
+
+ def decode(self, data):
+ self.data = base64.decodebytes(data)
+
+ def encode(self, out):
+ out.write("\n")
+ encoded = base64.encodebytes(self.data)
+ out.write(encoded.decode('ascii'))
+ out.write("\n")
+
+def _binary(data):
+ # decode xml element contents into a Binary structure
+ value = Binary()
+ value.decode(data)
+ return value
+
+WRAPPERS = (DateTime, Binary)
+
+# --------------------------------------------------------------------
+# XML parsers
+
+class ExpatParser(object):
+ # fast expat parser for Python 2.0 and later.
+ def __init__(self, target):
+ self._parser = parser = expat.ParserCreate(None, None)
+ self._target = target
+ parser.StartElementHandler = target.start
+ parser.EndElementHandler = target.end
+ parser.CharacterDataHandler = target.data
+ encoding = None
+ target.xml(encoding, None)
+
+ def feed(self, data):
+ self._parser.Parse(data, 0)
+
+ def close(self):
+ self._parser.Parse("", 1) # end of data
+ del self._target, self._parser # get rid of circular references
+
+# --------------------------------------------------------------------
+# XML-RPC marshalling and unmarshalling code
+
+##
+# XML-RPC marshaller.
+#
+# @param encoding Default encoding for 8-bit strings. The default
+# value is None (interpreted as UTF-8).
+# @see dumps
+
+class Marshaller(object):
+ """Generate an XML-RPC params chunk from a Python data structure.
+
+ Create a Marshaller instance for each set of parameters, and use
+ the "dumps" method to convert your data (represented as a tuple)
+ to an XML-RPC params chunk. To write a fault response, pass a
+ Fault instance instead. You may prefer to use the "dumps" module
+ function for this purpose.
+ """
+
+ # by the way, if you don't understand what's going on in here,
+ # that's perfectly ok.
+
+ def __init__(self, encoding=None, allow_none=False):
+ self.memo = {}
+ self.data = None
+ self.encoding = encoding
+ self.allow_none = allow_none
+
+ dispatch = {}
+
+ def dumps(self, values):
+ out = []
+ write = out.append
+ dump = self.__dump
+ if isinstance(values, Fault):
+ # fault instance
+ write("\n")
+ dump({'faultCode': values.faultCode,
+ 'faultString': values.faultString},
+ write)
+ write("\n")
+ else:
+ # parameter block
+ # FIXME: the xml-rpc specification allows us to leave out
+ # the entire block if there are no parameters.
+ # however, changing this may break older code (including
+ # old versions of xmlrpclib.py), so this is better left as
+ # is for now. See @XMLRPC3 for more information. /F
+ write("\n")
+ for v in values:
+ write("\n")
+ dump(v, write)
+ write("\n")
+ write("\n")
+ result = "".join(out)
+ return str(result)
+
+ def __dump(self, value, write):
+ try:
+ f = self.dispatch[type(ensure_new_type(value))]
+ except KeyError:
+ # check if this object can be marshalled as a structure
+ if not hasattr(value, '__dict__'):
+ raise TypeError("cannot marshal %s objects" % type(value))
+ # check if this class is a sub-class of a basic type,
+ # because we don't know how to marshal these types
+ # (e.g. a string sub-class)
+ for type_ in type(value).__mro__:
+ if type_ in self.dispatch.keys():
+ raise TypeError("cannot marshal %s objects" % type(value))
+ # XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
+ # for the p3yk merge, this should probably be fixed more neatly.
+ f = self.dispatch["_arbitrary_instance"]
+ f(self, value, write)
+
+ def dump_nil (self, value, write):
+ if not self.allow_none:
+ raise TypeError("cannot marshal None unless allow_none is enabled")
+ write("")
+ dispatch[type(None)] = dump_nil
+
+ def dump_bool(self, value, write):
+ write("")
+ write(value and "1" or "0")
+ write("\n")
+ dispatch[bool] = dump_bool
+
+ def dump_long(self, value, write):
+ if value > MAXINT or value < MININT:
+ raise OverflowError("long int exceeds XML-RPC limits")
+ write("")
+ write(str(int(value)))
+ write("\n")
+ dispatch[int] = dump_long
+
+ # backward compatible
+ dump_int = dump_long
+
+ def dump_double(self, value, write):
+ write("")
+ write(repr(ensure_new_type(value)))
+ write("\n")
+ dispatch[float] = dump_double
+
+ def dump_unicode(self, value, write, escape=escape):
+ write("")
+ write(escape(value))
+ write("\n")
+ dispatch[str] = dump_unicode
+
+ def dump_bytes(self, value, write):
+ write("\n")
+ encoded = base64.encodebytes(value)
+ write(encoded.decode('ascii'))
+ write("\n")
+ dispatch[bytes] = dump_bytes
+ dispatch[bytearray] = dump_bytes
+
+ def dump_array(self, value, write):
+ i = id(value)
+ if i in self.memo:
+ raise TypeError("cannot marshal recursive sequences")
+ self.memo[i] = None
+ dump = self.__dump
+ write("\n")
+ for v in value:
+ dump(v, write)
+ write("\n")
+ del self.memo[i]
+ dispatch[tuple] = dump_array
+ dispatch[list] = dump_array
+
+ def dump_struct(self, value, write, escape=escape):
+ i = id(value)
+ if i in self.memo:
+ raise TypeError("cannot marshal recursive dictionaries")
+ self.memo[i] = None
+ dump = self.__dump
+ write("\n")
+ for k, v in value.items():
+ write("\n")
+ if not isinstance(k, str):
+ raise TypeError("dictionary key must be string")
+ write("%s\n" % escape(k))
+ dump(v, write)
+ write("\n")
+ write("\n")
+ del self.memo[i]
+ dispatch[dict] = dump_struct
+
+ def dump_datetime(self, value, write):
+ write("")
+ write(_strftime(value))
+ write("\n")
+ dispatch[datetime] = dump_datetime
+
+ def dump_instance(self, value, write):
+ # check for special wrappers
+ if value.__class__ in WRAPPERS:
+ self.write = write
+ value.encode(self)
+ del self.write
+ else:
+ # store instance attributes as a struct (really?)
+ self.dump_struct(value.__dict__, write)
+ dispatch[DateTime] = dump_instance
+ dispatch[Binary] = dump_instance
+ # XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
+ # for the p3yk merge, this should probably be fixed more neatly.
+ dispatch["_arbitrary_instance"] = dump_instance
+
+##
+# XML-RPC unmarshaller.
+#
+# @see loads
+
+class Unmarshaller(object):
+ """Unmarshal an XML-RPC response, based on incoming XML event
+ messages (start, data, end). Call close() to get the resulting
+ data structure.
+
+ Note that this reader is fairly tolerant, and gladly accepts bogus
+ XML-RPC data without complaining (but not bogus XML).
+ """
+
+ # and again, if you don't understand what's going on in here,
+ # that's perfectly ok.
+
+ def __init__(self, use_datetime=False, use_builtin_types=False):
+ self._type = None
+ self._stack = []
+ self._marks = []
+ self._data = []
+ self._methodname = None
+ self._encoding = "utf-8"
+ self.append = self._stack.append
+ self._use_datetime = use_builtin_types or use_datetime
+ self._use_bytes = use_builtin_types
+
+ def close(self):
+ # return response tuple and target method
+ if self._type is None or self._marks:
+ raise ResponseError()
+ if self._type == "fault":
+ raise Fault(**self._stack[0])
+ return tuple(self._stack)
+
+ def getmethodname(self):
+ return self._methodname
+
+ #
+ # event handlers
+
+ def xml(self, encoding, standalone):
+ self._encoding = encoding
+ # FIXME: assert standalone == 1 ???
+
+ def start(self, tag, attrs):
+ # prepare to handle this element
+ if tag == "array" or tag == "struct":
+ self._marks.append(len(self._stack))
+ self._data = []
+ self._value = (tag == "value")
+
+ def data(self, text):
+ self._data.append(text)
+
+ def end(self, tag):
+ # call the appropriate end tag handler
+ try:
+ f = self.dispatch[tag]
+ except KeyError:
+ pass # unknown tag ?
+ else:
+ return f(self, "".join(self._data))
+
+ #
+ # accelerator support
+
+ def end_dispatch(self, tag, data):
+ # dispatch data
+ try:
+ f = self.dispatch[tag]
+ except KeyError:
+ pass # unknown tag ?
+ else:
+ return f(self, data)
+
+ #
+ # element decoders
+
+ dispatch = {}
+
+ def end_nil (self, data):
+ self.append(None)
+ self._value = 0
+ dispatch["nil"] = end_nil
+
+ def end_boolean(self, data):
+ if data == "0":
+ self.append(False)
+ elif data == "1":
+ self.append(True)
+ else:
+ raise TypeError("bad boolean value")
+ self._value = 0
+ dispatch["boolean"] = end_boolean
+
+ def end_int(self, data):
+ self.append(int(data))
+ self._value = 0
+ dispatch["i4"] = end_int
+ dispatch["i8"] = end_int
+ dispatch["int"] = end_int
+
+ def end_double(self, data):
+ self.append(float(data))
+ self._value = 0
+ dispatch["double"] = end_double
+
+ def end_string(self, data):
+ if self._encoding:
+ data = data.decode(self._encoding)
+ self.append(data)
+ self._value = 0
+ dispatch["string"] = end_string
+ dispatch["name"] = end_string # struct keys are always strings
+
+ def end_array(self, data):
+ mark = self._marks.pop()
+ # map arrays to Python lists
+ self._stack[mark:] = [self._stack[mark:]]
+ self._value = 0
+ dispatch["array"] = end_array
+
+ def end_struct(self, data):
+ mark = self._marks.pop()
+ # map structs to Python dictionaries
+ dict = {}
+ items = self._stack[mark:]
+ for i in range(0, len(items), 2):
+ dict[items[i]] = items[i+1]
+ self._stack[mark:] = [dict]
+ self._value = 0
+ dispatch["struct"] = end_struct
+
+ def end_base64(self, data):
+ value = Binary()
+ value.decode(data.encode("ascii"))
+ if self._use_bytes:
+ value = value.data
+ self.append(value)
+ self._value = 0
+ dispatch["base64"] = end_base64
+
+ def end_dateTime(self, data):
+ value = DateTime()
+ value.decode(data)
+ if self._use_datetime:
+ value = _datetime_type(data)
+ self.append(value)
+ dispatch["dateTime.iso8601"] = end_dateTime
+
+ def end_value(self, data):
+ # if we stumble upon a value element with no internal
+ # elements, treat it as a string element
+ if self._value:
+ self.end_string(data)
+ dispatch["value"] = end_value
+
+ def end_params(self, data):
+ self._type = "params"
+ dispatch["params"] = end_params
+
+ def end_fault(self, data):
+ self._type = "fault"
+ dispatch["fault"] = end_fault
+
+ def end_methodName(self, data):
+ if self._encoding:
+ data = data.decode(self._encoding)
+ self._methodname = data
+ self._type = "methodName" # no params
+ dispatch["methodName"] = end_methodName
+
+## Multicall support
+#
+
+class _MultiCallMethod(object):
+ # some lesser magic to store calls made to a MultiCall object
+ # for batch execution
+ def __init__(self, call_list, name):
+ self.__call_list = call_list
+ self.__name = name
+ def __getattr__(self, name):
+ return _MultiCallMethod(self.__call_list, "%s.%s" % (self.__name, name))
+ def __call__(self, *args):
+ self.__call_list.append((self.__name, args))
+
+class MultiCallIterator(object):
+ """Iterates over the results of a multicall. Exceptions are
+ raised in response to xmlrpc faults."""
+
+ def __init__(self, results):
+ self.results = results
+
+ def __getitem__(self, i):
+ item = self.results[i]
+ if isinstance(type(item), dict):
+ raise Fault(item['faultCode'], item['faultString'])
+ elif type(item) == type([]):
+ return item[0]
+ else:
+ raise ValueError("unexpected type in multicall result")
+
+class MultiCall(object):
+ """server -> a object used to boxcar method calls
+
+ server should be a ServerProxy object.
+
+ Methods can be added to the MultiCall using normal
+ method call syntax e.g.:
+
+ multicall = MultiCall(server_proxy)
+ multicall.add(2,3)
+ multicall.get_address("Guido")
+
+ To execute the multicall, call the MultiCall object e.g.:
+
+ add_result, address = multicall()
+ """
+
+ def __init__(self, server):
+ self.__server = server
+ self.__call_list = []
+
+ def __repr__(self):
+ return "" % id(self)
+
+ __str__ = __repr__
+
+ def __getattr__(self, name):
+ return _MultiCallMethod(self.__call_list, name)
+
+ def __call__(self):
+ marshalled_list = []
+ for name, args in self.__call_list:
+ marshalled_list.append({'methodName' : name, 'params' : args})
+
+ return MultiCallIterator(self.__server.system.multicall(marshalled_list))
+
+# --------------------------------------------------------------------
+# convenience functions
+
+FastMarshaller = FastParser = FastUnmarshaller = None
+
+##
+# Create a parser object, and connect it to an unmarshalling instance.
+# This function picks the fastest available XML parser.
+#
+# return A (parser, unmarshaller) tuple.
+
+def getparser(use_datetime=False, use_builtin_types=False):
+ """getparser() -> parser, unmarshaller
+
+ Create an instance of the fastest available parser, and attach it
+ to an unmarshalling object. Return both objects.
+ """
+ if FastParser and FastUnmarshaller:
+ if use_builtin_types:
+ mkdatetime = _datetime_type
+ mkbytes = base64.decodebytes
+ elif use_datetime:
+ mkdatetime = _datetime_type
+ mkbytes = _binary
+ else:
+ mkdatetime = _datetime
+ mkbytes = _binary
+ target = FastUnmarshaller(True, False, mkbytes, mkdatetime, Fault)
+ parser = FastParser(target)
+ else:
+ target = Unmarshaller(use_datetime=use_datetime, use_builtin_types=use_builtin_types)
+ if FastParser:
+ parser = FastParser(target)
+ else:
+ parser = ExpatParser(target)
+ return parser, target
+
+##
+# Convert a Python tuple or a Fault instance to an XML-RPC packet.
+#
+# @def dumps(params, **options)
+# @param params A tuple or Fault instance.
+# @keyparam methodname If given, create a methodCall request for
+# this method name.
+# @keyparam methodresponse If given, create a methodResponse packet.
+# If used with a tuple, the tuple must be a singleton (that is,
+# it must contain exactly one element).
+# @keyparam encoding The packet encoding.
+# @return A string containing marshalled data.
+
+def dumps(params, methodname=None, methodresponse=None, encoding=None,
+ allow_none=False):
+ """data [,options] -> marshalled data
+
+ Convert an argument tuple or a Fault instance to an XML-RPC
+ request (or response, if the methodresponse option is used).
+
+ In addition to the data object, the following options can be given
+ as keyword arguments:
+
+ methodname: the method name for a methodCall packet
+
+ methodresponse: true to create a methodResponse packet.
+ If this option is used with a tuple, the tuple must be
+ a singleton (i.e. it can contain only one element).
+
+ encoding: the packet encoding (default is UTF-8)
+
+ All byte strings in the data structure are assumed to use the
+ packet encoding. Unicode strings are automatically converted,
+ where necessary.
+ """
+
+ assert isinstance(params, (tuple, Fault)), "argument must be tuple or Fault instance"
+ if isinstance(params, Fault):
+ methodresponse = 1
+ elif methodresponse and isinstance(params, tuple):
+ assert len(params) == 1, "response tuple must be a singleton"
+
+ if not encoding:
+ encoding = "utf-8"
+
+ if FastMarshaller:
+ m = FastMarshaller(encoding)
+ else:
+ m = Marshaller(encoding, allow_none)
+
+ data = m.dumps(params)
+
+ if encoding != "utf-8":
+ xmlheader = "\n" % str(encoding)
+ else:
+ xmlheader = "\n" # utf-8 is default
+
+ # standard XML-RPC wrappings
+ if methodname:
+ # a method call
+ if not isinstance(methodname, str):
+ methodname = methodname.encode(encoding)
+ data = (
+ xmlheader,
+ "\n"
+ "", methodname, "\n",
+ data,
+ "\n"
+ )
+ elif methodresponse:
+ # a method response, or a fault structure
+ data = (
+ xmlheader,
+ "\n",
+ data,
+ "\n"
+ )
+ else:
+ return data # return as is
+ return str("").join(data)
+
+##
+# Convert an XML-RPC packet to a Python object. If the XML-RPC packet
+# represents a fault condition, this function raises a Fault exception.
+#
+# @param data An XML-RPC packet, given as an 8-bit string.
+# @return A tuple containing the unpacked data, and the method name
+# (None if not present).
+# @see Fault
+
+def loads(data, use_datetime=False, use_builtin_types=False):
+ """data -> unmarshalled data, method name
+
+ Convert an XML-RPC packet to unmarshalled data plus a method
+ name (None if not present).
+
+ If the XML-RPC packet represents a fault condition, this function
+ raises a Fault exception.
+ """
+ p, u = getparser(use_datetime=use_datetime, use_builtin_types=use_builtin_types)
+ p.feed(data)
+ p.close()
+ return u.close(), u.getmethodname()
+
+##
+# Encode a string using the gzip content encoding such as specified by the
+# Content-Encoding: gzip
+# in the HTTP header, as described in RFC 1952
+#
+# @param data the unencoded data
+# @return the encoded data
+
+def gzip_encode(data):
+ """data -> gzip encoded data
+
+ Encode data using the gzip content encoding as described in RFC 1952
+ """
+ if not gzip:
+ raise NotImplementedError
+ f = BytesIO()
+ gzf = gzip.GzipFile(mode="wb", fileobj=f, compresslevel=1)
+ gzf.write(data)
+ gzf.close()
+ encoded = f.getvalue()
+ f.close()
+ return encoded
+
+##
+# Decode a string using the gzip content encoding such as specified by the
+# Content-Encoding: gzip
+# in the HTTP header, as described in RFC 1952
+#
+# @param data The encoded data
+# @return the unencoded data
+# @raises ValueError if data is not correctly coded.
+
+def gzip_decode(data):
+ """gzip encoded data -> unencoded data
+
+ Decode data using the gzip content encoding as described in RFC 1952
+ """
+ if not gzip:
+ raise NotImplementedError
+ f = BytesIO(data)
+ gzf = gzip.GzipFile(mode="rb", fileobj=f)
+ try:
+ decoded = gzf.read()
+ except IOError:
+ raise ValueError("invalid data")
+ f.close()
+ gzf.close()
+ return decoded
+
+##
+# Return a decoded file-like object for the gzip encoding
+# as described in RFC 1952.
+#
+# @param response A stream supporting a read() method
+# @return a file-like object that the decoded data can be read() from
+
+class GzipDecodedResponse(gzip.GzipFile if gzip else object):
+ """a file-like object to decode a response encoded with the gzip
+ method, as described in RFC 1952.
+ """
+ def __init__(self, response):
+ #response doesn't support tell() and read(), required by
+ #GzipFile
+ if not gzip:
+ raise NotImplementedError
+ self.io = BytesIO(response.read())
+ gzip.GzipFile.__init__(self, mode="rb", fileobj=self.io)
+
+ def close(self):
+ gzip.GzipFile.close(self)
+ self.io.close()
+
+
+# --------------------------------------------------------------------
+# request dispatcher
+
+class _Method(object):
+ # some magic to bind an XML-RPC method to an RPC server.
+ # supports "nested" methods (e.g. examples.getStateName)
+ def __init__(self, send, name):
+ self.__send = send
+ self.__name = name
+ def __getattr__(self, name):
+ return _Method(self.__send, "%s.%s" % (self.__name, name))
+ def __call__(self, *args):
+ return self.__send(self.__name, args)
+
+##
+# Standard transport class for XML-RPC over HTTP.
+#
+# You can create custom transports by subclassing this method, and
+# overriding selected methods.
+
+class Transport(object):
+ """Handles an HTTP transaction to an XML-RPC server."""
+
+ # client identifier (may be overridden)
+ user_agent = "Python-xmlrpc/%s" % __version__
+
+ #if true, we'll request gzip encoding
+ accept_gzip_encoding = True
+
+ # if positive, encode request using gzip if it exceeds this threshold
+ # note that many server will get confused, so only use it if you know
+ # that they can decode such a request
+ encode_threshold = None #None = don't encode
+
+ def __init__(self, use_datetime=False, use_builtin_types=False):
+ self._use_datetime = use_datetime
+ self._use_builtin_types = use_builtin_types
+ self._connection = (None, None)
+ self._extra_headers = []
+
+ ##
+ # Send a complete request, and parse the response.
+ # Retry request if a cached connection has disconnected.
+ #
+ # @param host Target host.
+ # @param handler Target PRC handler.
+ # @param request_body XML-RPC request body.
+ # @param verbose Debugging flag.
+ # @return Parsed response.
+
+ def request(self, host, handler, request_body, verbose=False):
+ #retry request once if cached connection has gone cold
+ for i in (0, 1):
+ try:
+ return self.single_request(host, handler, request_body, verbose)
+ except socket.error as e:
+ if i or e.errno not in (errno.ECONNRESET, errno.ECONNABORTED, errno.EPIPE):
+ raise
+ except http_client.BadStatusLine: #close after we sent request
+ if i:
+ raise
+
+ def single_request(self, host, handler, request_body, verbose=False):
+ # issue XML-RPC request
+ try:
+ http_conn = self.send_request(host, handler, request_body, verbose)
+ resp = http_conn.getresponse()
+ if resp.status == 200:
+ self.verbose = verbose
+ return self.parse_response(resp)
+
+ except Fault:
+ raise
+ except Exception:
+ #All unexpected errors leave connection in
+ # a strange state, so we clear it.
+ self.close()
+ raise
+
+ #We got an error response.
+ #Discard any response data and raise exception
+ if resp.getheader("content-length", ""):
+ resp.read()
+ raise ProtocolError(
+ host + handler,
+ resp.status, resp.reason,
+ dict(resp.getheaders())
+ )
+
+
+ ##
+ # Create parser.
+ #
+ # @return A 2-tuple containing a parser and a unmarshaller.
+
+ def getparser(self):
+ # get parser and unmarshaller
+ return getparser(use_datetime=self._use_datetime,
+ use_builtin_types=self._use_builtin_types)
+
+ ##
+ # Get authorization info from host parameter
+ # Host may be a string, or a (host, x509-dict) tuple; if a string,
+ # it is checked for a "user:pw@host" format, and a "Basic
+ # Authentication" header is added if appropriate.
+ #
+ # @param host Host descriptor (URL or (URL, x509 info) tuple).
+ # @return A 3-tuple containing (actual host, extra headers,
+ # x509 info). The header and x509 fields may be None.
+
+ def get_host_info(self, host):
+
+ x509 = {}
+ if isinstance(host, tuple):
+ host, x509 = host
+
+ auth, host = urllib_parse.splituser(host)
+
+ if auth:
+ auth = urllib_parse.unquote_to_bytes(auth)
+ auth = base64.encodebytes(auth).decode("utf-8")
+ auth = "".join(auth.split()) # get rid of whitespace
+ extra_headers = [
+ ("Authorization", "Basic " + auth)
+ ]
+ else:
+ extra_headers = []
+
+ return host, extra_headers, x509
+
+ ##
+ # Connect to server.
+ #
+ # @param host Target host.
+ # @return An HTTPConnection object
+
+ def make_connection(self, host):
+ #return an existing connection if possible. This allows
+ #HTTP/1.1 keep-alive.
+ if self._connection and host == self._connection[0]:
+ return self._connection[1]
+ # create a HTTP connection object from a host descriptor
+ chost, self._extra_headers, x509 = self.get_host_info(host)
+ self._connection = host, http_client.HTTPConnection(chost)
+ return self._connection[1]
+
+ ##
+ # Clear any cached connection object.
+ # Used in the event of socket errors.
+ #
+ def close(self):
+ if self._connection[1]:
+ self._connection[1].close()
+ self._connection = (None, None)
+
+ ##
+ # Send HTTP request.
+ #
+ # @param host Host descriptor (URL or (URL, x509 info) tuple).
+ # @param handler Targer RPC handler (a path relative to host)
+ # @param request_body The XML-RPC request body
+ # @param debug Enable debugging if debug is true.
+ # @return An HTTPConnection.
+
+ def send_request(self, host, handler, request_body, debug):
+ connection = self.make_connection(host)
+ headers = self._extra_headers[:]
+ if debug:
+ connection.set_debuglevel(1)
+ if self.accept_gzip_encoding and gzip:
+ connection.putrequest("POST", handler, skip_accept_encoding=True)
+ headers.append(("Accept-Encoding", "gzip"))
+ else:
+ connection.putrequest("POST", handler)
+ headers.append(("Content-Type", "text/xml"))
+ headers.append(("User-Agent", self.user_agent))
+ self.send_headers(connection, headers)
+ self.send_content(connection, request_body)
+ return connection
+
+ ##
+ # Send request headers.
+ # This function provides a useful hook for subclassing
+ #
+ # @param connection httpConnection.
+ # @param headers list of key,value pairs for HTTP headers
+
+ def send_headers(self, connection, headers):
+ for key, val in headers:
+ connection.putheader(key, val)
+
+ ##
+ # Send request body.
+ # This function provides a useful hook for subclassing
+ #
+ # @param connection httpConnection.
+ # @param request_body XML-RPC request body.
+
+ def send_content(self, connection, request_body):
+ #optionally encode the request
+ if (self.encode_threshold is not None and
+ self.encode_threshold < len(request_body) and
+ gzip):
+ connection.putheader("Content-Encoding", "gzip")
+ request_body = gzip_encode(request_body)
+
+ connection.putheader("Content-Length", str(len(request_body)))
+ connection.endheaders(request_body)
+
+ ##
+ # Parse response.
+ #
+ # @param file Stream.
+ # @return Response tuple and target method.
+
+ def parse_response(self, response):
+ # read response data from httpresponse, and parse it
+ # Check for new http response object, otherwise it is a file object.
+ if hasattr(response, 'getheader'):
+ if response.getheader("Content-Encoding", "") == "gzip":
+ stream = GzipDecodedResponse(response)
+ else:
+ stream = response
+ else:
+ stream = response
+
+ p, u = self.getparser()
+
+ while 1:
+ data = stream.read(1024)
+ if not data:
+ break
+ if self.verbose:
+ print("body:", repr(data))
+ p.feed(data)
+
+ if stream is not response:
+ stream.close()
+ p.close()
+
+ return u.close()
+
+##
+# Standard transport class for XML-RPC over HTTPS.
+
+class SafeTransport(Transport):
+ """Handles an HTTPS transaction to an XML-RPC server."""
+
+ # FIXME: mostly untested
+
+ def make_connection(self, host):
+ if self._connection and host == self._connection[0]:
+ return self._connection[1]
+
+ if not hasattr(http_client, "HTTPSConnection"):
+ raise NotImplementedError(
+ "your version of http.client doesn't support HTTPS")
+ # create a HTTPS connection object from a host descriptor
+ # host may be a string, or a (host, x509-dict) tuple
+ chost, self._extra_headers, x509 = self.get_host_info(host)
+ self._connection = host, http_client.HTTPSConnection(chost,
+ None, **(x509 or {}))
+ return self._connection[1]
+
+##
+# Standard server proxy. This class establishes a virtual connection
+# to an XML-RPC server.
+#
+# This class is available as ServerProxy and Server. New code should
+# use ServerProxy, to avoid confusion.
+#
+# @def ServerProxy(uri, **options)
+# @param uri The connection point on the server.
+# @keyparam transport A transport factory, compatible with the
+# standard transport class.
+# @keyparam encoding The default encoding used for 8-bit strings
+# (default is UTF-8).
+# @keyparam verbose Use a true value to enable debugging output.
+# (printed to standard output).
+# @see Transport
+
+class ServerProxy(object):
+ """uri [,options] -> a logical connection to an XML-RPC server
+
+ uri is the connection point on the server, given as
+ scheme://host/target.
+
+ The standard implementation always supports the "http" scheme. If
+ SSL socket support is available (Python 2.0), it also supports
+ "https".
+
+ If the target part and the slash preceding it are both omitted,
+ "/RPC2" is assumed.
+
+ The following options can be given as keyword arguments:
+
+ transport: a transport factory
+ encoding: the request encoding (default is UTF-8)
+
+ All 8-bit strings passed to the server proxy are assumed to use
+ the given encoding.
+ """
+
+ def __init__(self, uri, transport=None, encoding=None, verbose=False,
+ allow_none=False, use_datetime=False, use_builtin_types=False):
+ # establish a "logical" server connection
+
+ # get the url
+ type, uri = urllib_parse.splittype(uri)
+ if type not in ("http", "https"):
+ raise IOError("unsupported XML-RPC protocol")
+ self.__host, self.__handler = urllib_parse.splithost(uri)
+ if not self.__handler:
+ self.__handler = "/RPC2"
+
+ if transport is None:
+ if type == "https":
+ handler = SafeTransport
+ else:
+ handler = Transport
+ transport = handler(use_datetime=use_datetime,
+ use_builtin_types=use_builtin_types)
+ self.__transport = transport
+
+ self.__encoding = encoding or 'utf-8'
+ self.__verbose = verbose
+ self.__allow_none = allow_none
+
+ def __close(self):
+ self.__transport.close()
+
+ def __request(self, methodname, params):
+ # call a method on the remote server
+
+ request = dumps(params, methodname, encoding=self.__encoding,
+ allow_none=self.__allow_none).encode(self.__encoding)
+
+ response = self.__transport.request(
+ self.__host,
+ self.__handler,
+ request,
+ verbose=self.__verbose
+ )
+
+ if len(response) == 1:
+ response = response[0]
+
+ return response
+
+ def __repr__(self):
+ return (
+ "" %
+ (self.__host, self.__handler)
+ )
+
+ __str__ = __repr__
+
+ def __getattr__(self, name):
+ # magic method dispatcher
+ return _Method(self.__request, name)
+
+ # note: to call a remote object with an non-standard name, use
+ # result getattr(server, "strange-python-name")(args)
+
+ def __call__(self, attr):
+ """A workaround to get special attributes on the ServerProxy
+ without interfering with the magic __getattr__
+ """
+ if attr == "close":
+ return self.__close
+ elif attr == "transport":
+ return self.__transport
+ raise AttributeError("Attribute %r not found" % (attr,))
+
+# compatibility
+
+Server = ServerProxy
+
+# --------------------------------------------------------------------
+# test code
+
+if __name__ == "__main__":
+
+ # simple test program (from the XML-RPC specification)
+
+ # local server, available from Lib/xmlrpc/server.py
+ server = ServerProxy("http://localhost:8000")
+
+ try:
+ print(server.currentTime.getCurrentTime())
+ except Error as v:
+ print("ERROR", v)
+
+ multi = MultiCall(server)
+ multi.getData()
+ multi.pow(2,9)
+ multi.add(1,2)
+ try:
+ for response in multi():
+ print(response)
+ except Error as v:
+ print("ERROR", v)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/xmlrpc/server.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/xmlrpc/server.py
new file mode 100644
index 0000000..28072bf
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/backports/xmlrpc/server.py
@@ -0,0 +1,999 @@
+r"""
+Ported using Python-Future from the Python 3.3 standard library.
+
+XML-RPC Servers.
+
+This module can be used to create simple XML-RPC servers
+by creating a server and either installing functions, a
+class instance, or by extending the SimpleXMLRPCServer
+class.
+
+It can also be used to handle XML-RPC requests in a CGI
+environment using CGIXMLRPCRequestHandler.
+
+The Doc* classes can be used to create XML-RPC servers that
+serve pydoc-style documentation in response to HTTP
+GET requests. This documentation is dynamically generated
+based on the functions and methods registered with the
+server.
+
+A list of possible usage patterns follows:
+
+1. Install functions:
+
+server = SimpleXMLRPCServer(("localhost", 8000))
+server.register_function(pow)
+server.register_function(lambda x,y: x+y, 'add')
+server.serve_forever()
+
+2. Install an instance:
+
+class MyFuncs:
+ def __init__(self):
+ # make all of the sys functions available through sys.func_name
+ import sys
+ self.sys = sys
+ def _listMethods(self):
+ # implement this method so that system.listMethods
+ # knows to advertise the sys methods
+ return list_public_methods(self) + \
+ ['sys.' + method for method in list_public_methods(self.sys)]
+ def pow(self, x, y): return pow(x, y)
+ def add(self, x, y) : return x + y
+
+server = SimpleXMLRPCServer(("localhost", 8000))
+server.register_introspection_functions()
+server.register_instance(MyFuncs())
+server.serve_forever()
+
+3. Install an instance with custom dispatch method:
+
+class Math:
+ def _listMethods(self):
+ # this method must be present for system.listMethods
+ # to work
+ return ['add', 'pow']
+ def _methodHelp(self, method):
+ # this method must be present for system.methodHelp
+ # to work
+ if method == 'add':
+ return "add(2,3) => 5"
+ elif method == 'pow':
+ return "pow(x, y[, z]) => number"
+ else:
+ # By convention, return empty
+ # string if no help is available
+ return ""
+ def _dispatch(self, method, params):
+ if method == 'pow':
+ return pow(*params)
+ elif method == 'add':
+ return params[0] + params[1]
+ else:
+ raise ValueError('bad method')
+
+server = SimpleXMLRPCServer(("localhost", 8000))
+server.register_introspection_functions()
+server.register_instance(Math())
+server.serve_forever()
+
+4. Subclass SimpleXMLRPCServer:
+
+class MathServer(SimpleXMLRPCServer):
+ def _dispatch(self, method, params):
+ try:
+ # We are forcing the 'export_' prefix on methods that are
+ # callable through XML-RPC to prevent potential security
+ # problems
+ func = getattr(self, 'export_' + method)
+ except AttributeError:
+ raise Exception('method "%s" is not supported' % method)
+ else:
+ return func(*params)
+
+ def export_add(self, x, y):
+ return x + y
+
+server = MathServer(("localhost", 8000))
+server.serve_forever()
+
+5. CGI script:
+
+server = CGIXMLRPCRequestHandler()
+server.register_function(pow)
+server.handle_request()
+"""
+
+from __future__ import absolute_import, division, print_function, unicode_literals
+from future.builtins import int, str
+
+# Written by Brian Quinlan (brian@sweetapp.com).
+# Based on code written by Fredrik Lundh.
+
+from future.backports.xmlrpc.client import Fault, dumps, loads, gzip_encode, gzip_decode
+from future.backports.http.server import BaseHTTPRequestHandler
+import future.backports.http.server as http_server
+from future.backports import socketserver
+import sys
+import os
+import re
+import pydoc
+import inspect
+import traceback
+try:
+ import fcntl
+except ImportError:
+ fcntl = None
+
+def resolve_dotted_attribute(obj, attr, allow_dotted_names=True):
+ """resolve_dotted_attribute(a, 'b.c.d') => a.b.c.d
+
+ Resolves a dotted attribute name to an object. Raises
+ an AttributeError if any attribute in the chain starts with a '_'.
+
+ If the optional allow_dotted_names argument is false, dots are not
+ supported and this function operates similar to getattr(obj, attr).
+ """
+
+ if allow_dotted_names:
+ attrs = attr.split('.')
+ else:
+ attrs = [attr]
+
+ for i in attrs:
+ if i.startswith('_'):
+ raise AttributeError(
+ 'attempt to access private attribute "%s"' % i
+ )
+ else:
+ obj = getattr(obj,i)
+ return obj
+
+def list_public_methods(obj):
+ """Returns a list of attribute strings, found in the specified
+ object, which represent callable attributes"""
+
+ return [member for member in dir(obj)
+ if not member.startswith('_') and
+ callable(getattr(obj, member))]
+
+class SimpleXMLRPCDispatcher(object):
+ """Mix-in class that dispatches XML-RPC requests.
+
+ This class is used to register XML-RPC method handlers
+ and then to dispatch them. This class doesn't need to be
+ instanced directly when used by SimpleXMLRPCServer but it
+ can be instanced when used by the MultiPathXMLRPCServer
+ """
+
+ def __init__(self, allow_none=False, encoding=None,
+ use_builtin_types=False):
+ self.funcs = {}
+ self.instance = None
+ self.allow_none = allow_none
+ self.encoding = encoding or 'utf-8'
+ self.use_builtin_types = use_builtin_types
+
+ def register_instance(self, instance, allow_dotted_names=False):
+ """Registers an instance to respond to XML-RPC requests.
+
+ Only one instance can be installed at a time.
+
+ If the registered instance has a _dispatch method then that
+ method will be called with the name of the XML-RPC method and
+ its parameters as a tuple
+ e.g. instance._dispatch('add',(2,3))
+
+ If the registered instance does not have a _dispatch method
+ then the instance will be searched to find a matching method
+ and, if found, will be called. Methods beginning with an '_'
+ are considered private and will not be called by
+ SimpleXMLRPCServer.
+
+ If a registered function matches a XML-RPC request, then it
+ will be called instead of the registered instance.
+
+ If the optional allow_dotted_names argument is true and the
+ instance does not have a _dispatch method, method names
+ containing dots are supported and resolved, as long as none of
+ the name segments start with an '_'.
+
+ *** SECURITY WARNING: ***
+
+ Enabling the allow_dotted_names options allows intruders
+ to access your module's global variables and may allow
+ intruders to execute arbitrary code on your machine. Only
+ use this option on a secure, closed network.
+
+ """
+
+ self.instance = instance
+ self.allow_dotted_names = allow_dotted_names
+
+ def register_function(self, function, name=None):
+ """Registers a function to respond to XML-RPC requests.
+
+ The optional name argument can be used to set a Unicode name
+ for the function.
+ """
+
+ if name is None:
+ name = function.__name__
+ self.funcs[name] = function
+
+ def register_introspection_functions(self):
+ """Registers the XML-RPC introspection methods in the system
+ namespace.
+
+ see http://xmlrpc.usefulinc.com/doc/reserved.html
+ """
+
+ self.funcs.update({'system.listMethods' : self.system_listMethods,
+ 'system.methodSignature' : self.system_methodSignature,
+ 'system.methodHelp' : self.system_methodHelp})
+
+ def register_multicall_functions(self):
+ """Registers the XML-RPC multicall method in the system
+ namespace.
+
+ see http://www.xmlrpc.com/discuss/msgReader$1208"""
+
+ self.funcs.update({'system.multicall' : self.system_multicall})
+
+ def _marshaled_dispatch(self, data, dispatch_method = None, path = None):
+ """Dispatches an XML-RPC method from marshalled (XML) data.
+
+ XML-RPC methods are dispatched from the marshalled (XML) data
+ using the _dispatch method and the result is returned as
+ marshalled data. For backwards compatibility, a dispatch
+ function can be provided as an argument (see comment in
+ SimpleXMLRPCRequestHandler.do_POST) but overriding the
+ existing method through subclassing is the preferred means
+ of changing method dispatch behavior.
+ """
+
+ try:
+ params, method = loads(data, use_builtin_types=self.use_builtin_types)
+
+ # generate response
+ if dispatch_method is not None:
+ response = dispatch_method(method, params)
+ else:
+ response = self._dispatch(method, params)
+ # wrap response in a singleton tuple
+ response = (response,)
+ response = dumps(response, methodresponse=1,
+ allow_none=self.allow_none, encoding=self.encoding)
+ except Fault as fault:
+ response = dumps(fault, allow_none=self.allow_none,
+ encoding=self.encoding)
+ except:
+ # report exception back to server
+ exc_type, exc_value, exc_tb = sys.exc_info()
+ response = dumps(
+ Fault(1, "%s:%s" % (exc_type, exc_value)),
+ encoding=self.encoding, allow_none=self.allow_none,
+ )
+
+ return response.encode(self.encoding)
+
+ def system_listMethods(self):
+ """system.listMethods() => ['add', 'subtract', 'multiple']
+
+ Returns a list of the methods supported by the server."""
+
+ methods = set(self.funcs.keys())
+ if self.instance is not None:
+ # Instance can implement _listMethod to return a list of
+ # methods
+ if hasattr(self.instance, '_listMethods'):
+ methods |= set(self.instance._listMethods())
+ # if the instance has a _dispatch method then we
+ # don't have enough information to provide a list
+ # of methods
+ elif not hasattr(self.instance, '_dispatch'):
+ methods |= set(list_public_methods(self.instance))
+ return sorted(methods)
+
+ def system_methodSignature(self, method_name):
+ """system.methodSignature('add') => [double, int, int]
+
+ Returns a list describing the signature of the method. In the
+ above example, the add method takes two integers as arguments
+ and returns a double result.
+
+ This server does NOT support system.methodSignature."""
+
+ # See http://xmlrpc.usefulinc.com/doc/sysmethodsig.html
+
+ return 'signatures not supported'
+
+ def system_methodHelp(self, method_name):
+ """system.methodHelp('add') => "Adds two integers together"
+
+ Returns a string containing documentation for the specified method."""
+
+ method = None
+ if method_name in self.funcs:
+ method = self.funcs[method_name]
+ elif self.instance is not None:
+ # Instance can implement _methodHelp to return help for a method
+ if hasattr(self.instance, '_methodHelp'):
+ return self.instance._methodHelp(method_name)
+ # if the instance has a _dispatch method then we
+ # don't have enough information to provide help
+ elif not hasattr(self.instance, '_dispatch'):
+ try:
+ method = resolve_dotted_attribute(
+ self.instance,
+ method_name,
+ self.allow_dotted_names
+ )
+ except AttributeError:
+ pass
+
+ # Note that we aren't checking that the method actually
+ # be a callable object of some kind
+ if method is None:
+ return ""
+ else:
+ return pydoc.getdoc(method)
+
+ def system_multicall(self, call_list):
+ """system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => \
+[[4], ...]
+
+ Allows the caller to package multiple XML-RPC calls into a single
+ request.
+
+ See http://www.xmlrpc.com/discuss/msgReader$1208
+ """
+
+ results = []
+ for call in call_list:
+ method_name = call['methodName']
+ params = call['params']
+
+ try:
+ # XXX A marshalling error in any response will fail the entire
+ # multicall. If someone cares they should fix this.
+ results.append([self._dispatch(method_name, params)])
+ except Fault as fault:
+ results.append(
+ {'faultCode' : fault.faultCode,
+ 'faultString' : fault.faultString}
+ )
+ except:
+ exc_type, exc_value, exc_tb = sys.exc_info()
+ results.append(
+ {'faultCode' : 1,
+ 'faultString' : "%s:%s" % (exc_type, exc_value)}
+ )
+ return results
+
+ def _dispatch(self, method, params):
+ """Dispatches the XML-RPC method.
+
+ XML-RPC calls are forwarded to a registered function that
+ matches the called XML-RPC method name. If no such function
+ exists then the call is forwarded to the registered instance,
+ if available.
+
+ If the registered instance has a _dispatch method then that
+ method will be called with the name of the XML-RPC method and
+ its parameters as a tuple
+ e.g. instance._dispatch('add',(2,3))
+
+ If the registered instance does not have a _dispatch method
+ then the instance will be searched to find a matching method
+ and, if found, will be called.
+
+ Methods beginning with an '_' are considered private and will
+ not be called.
+ """
+
+ func = None
+ try:
+ # check to see if a matching function has been registered
+ func = self.funcs[method]
+ except KeyError:
+ if self.instance is not None:
+ # check for a _dispatch method
+ if hasattr(self.instance, '_dispatch'):
+ return self.instance._dispatch(method, params)
+ else:
+ # call instance method directly
+ try:
+ func = resolve_dotted_attribute(
+ self.instance,
+ method,
+ self.allow_dotted_names
+ )
+ except AttributeError:
+ pass
+
+ if func is not None:
+ return func(*params)
+ else:
+ raise Exception('method "%s" is not supported' % method)
+
+class SimpleXMLRPCRequestHandler(BaseHTTPRequestHandler):
+ """Simple XML-RPC request handler class.
+
+ Handles all HTTP POST requests and attempts to decode them as
+ XML-RPC requests.
+ """
+
+ # Class attribute listing the accessible path components;
+ # paths not on this list will result in a 404 error.
+ rpc_paths = ('/', '/RPC2')
+
+ #if not None, encode responses larger than this, if possible
+ encode_threshold = 1400 #a common MTU
+
+ #Override form StreamRequestHandler: full buffering of output
+ #and no Nagle.
+ wbufsize = -1
+ disable_nagle_algorithm = True
+
+ # a re to match a gzip Accept-Encoding
+ aepattern = re.compile(r"""
+ \s* ([^\s;]+) \s* #content-coding
+ (;\s* q \s*=\s* ([0-9\.]+))? #q
+ """, re.VERBOSE | re.IGNORECASE)
+
+ def accept_encodings(self):
+ r = {}
+ ae = self.headers.get("Accept-Encoding", "")
+ for e in ae.split(","):
+ match = self.aepattern.match(e)
+ if match:
+ v = match.group(3)
+ v = float(v) if v else 1.0
+ r[match.group(1)] = v
+ return r
+
+ def is_rpc_path_valid(self):
+ if self.rpc_paths:
+ return self.path in self.rpc_paths
+ else:
+ # If .rpc_paths is empty, just assume all paths are legal
+ return True
+
+ def do_POST(self):
+ """Handles the HTTP POST request.
+
+ Attempts to interpret all HTTP POST requests as XML-RPC calls,
+ which are forwarded to the server's _dispatch method for handling.
+ """
+
+ # Check that the path is legal
+ if not self.is_rpc_path_valid():
+ self.report_404()
+ return
+
+ try:
+ # Get arguments by reading body of request.
+ # We read this in chunks to avoid straining
+ # socket.read(); around the 10 or 15Mb mark, some platforms
+ # begin to have problems (bug #792570).
+ max_chunk_size = 10*1024*1024
+ size_remaining = int(self.headers["content-length"])
+ L = []
+ while size_remaining:
+ chunk_size = min(size_remaining, max_chunk_size)
+ chunk = self.rfile.read(chunk_size)
+ if not chunk:
+ break
+ L.append(chunk)
+ size_remaining -= len(L[-1])
+ data = b''.join(L)
+
+ data = self.decode_request_content(data)
+ if data is None:
+ return #response has been sent
+
+ # In previous versions of SimpleXMLRPCServer, _dispatch
+ # could be overridden in this class, instead of in
+ # SimpleXMLRPCDispatcher. To maintain backwards compatibility,
+ # check to see if a subclass implements _dispatch and dispatch
+ # using that method if present.
+ response = self.server._marshaled_dispatch(
+ data, getattr(self, '_dispatch', None), self.path
+ )
+ except Exception as e: # This should only happen if the module is buggy
+ # internal error, report as HTTP server error
+ self.send_response(500)
+
+ # Send information about the exception if requested
+ if hasattr(self.server, '_send_traceback_header') and \
+ self.server._send_traceback_header:
+ self.send_header("X-exception", str(e))
+ trace = traceback.format_exc()
+ trace = str(trace.encode('ASCII', 'backslashreplace'), 'ASCII')
+ self.send_header("X-traceback", trace)
+
+ self.send_header("Content-length", "0")
+ self.end_headers()
+ else:
+ self.send_response(200)
+ self.send_header("Content-type", "text/xml")
+ if self.encode_threshold is not None:
+ if len(response) > self.encode_threshold:
+ q = self.accept_encodings().get("gzip", 0)
+ if q:
+ try:
+ response = gzip_encode(response)
+ self.send_header("Content-Encoding", "gzip")
+ except NotImplementedError:
+ pass
+ self.send_header("Content-length", str(len(response)))
+ self.end_headers()
+ self.wfile.write(response)
+
+ def decode_request_content(self, data):
+ #support gzip encoding of request
+ encoding = self.headers.get("content-encoding", "identity").lower()
+ if encoding == "identity":
+ return data
+ if encoding == "gzip":
+ try:
+ return gzip_decode(data)
+ except NotImplementedError:
+ self.send_response(501, "encoding %r not supported" % encoding)
+ except ValueError:
+ self.send_response(400, "error decoding gzip content")
+ else:
+ self.send_response(501, "encoding %r not supported" % encoding)
+ self.send_header("Content-length", "0")
+ self.end_headers()
+
+ def report_404 (self):
+ # Report a 404 error
+ self.send_response(404)
+ response = b'No such page'
+ self.send_header("Content-type", "text/plain")
+ self.send_header("Content-length", str(len(response)))
+ self.end_headers()
+ self.wfile.write(response)
+
+ def log_request(self, code='-', size='-'):
+ """Selectively log an accepted request."""
+
+ if self.server.logRequests:
+ BaseHTTPRequestHandler.log_request(self, code, size)
+
+class SimpleXMLRPCServer(socketserver.TCPServer,
+ SimpleXMLRPCDispatcher):
+ """Simple XML-RPC server.
+
+ Simple XML-RPC server that allows functions and a single instance
+ to be installed to handle requests. The default implementation
+ attempts to dispatch XML-RPC calls to the functions or instance
+ installed in the server. Override the _dispatch method inherited
+ from SimpleXMLRPCDispatcher to change this behavior.
+ """
+
+ allow_reuse_address = True
+
+ # Warning: this is for debugging purposes only! Never set this to True in
+ # production code, as will be sending out sensitive information (exception
+ # and stack trace details) when exceptions are raised inside
+ # SimpleXMLRPCRequestHandler.do_POST
+ _send_traceback_header = False
+
+ def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler,
+ logRequests=True, allow_none=False, encoding=None,
+ bind_and_activate=True, use_builtin_types=False):
+ self.logRequests = logRequests
+
+ SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding, use_builtin_types)
+ socketserver.TCPServer.__init__(self, addr, requestHandler, bind_and_activate)
+
+ # [Bug #1222790] If possible, set close-on-exec flag; if a
+ # method spawns a subprocess, the subprocess shouldn't have
+ # the listening socket open.
+ if fcntl is not None and hasattr(fcntl, 'FD_CLOEXEC'):
+ flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD)
+ flags |= fcntl.FD_CLOEXEC
+ fcntl.fcntl(self.fileno(), fcntl.F_SETFD, flags)
+
+class MultiPathXMLRPCServer(SimpleXMLRPCServer):
+ """Multipath XML-RPC Server
+ This specialization of SimpleXMLRPCServer allows the user to create
+ multiple Dispatcher instances and assign them to different
+ HTTP request paths. This makes it possible to run two or more
+ 'virtual XML-RPC servers' at the same port.
+ Make sure that the requestHandler accepts the paths in question.
+ """
+ def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler,
+ logRequests=True, allow_none=False, encoding=None,
+ bind_and_activate=True, use_builtin_types=False):
+
+ SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests, allow_none,
+ encoding, bind_and_activate, use_builtin_types)
+ self.dispatchers = {}
+ self.allow_none = allow_none
+ self.encoding = encoding or 'utf-8'
+
+ def add_dispatcher(self, path, dispatcher):
+ self.dispatchers[path] = dispatcher
+ return dispatcher
+
+ def get_dispatcher(self, path):
+ return self.dispatchers[path]
+
+ def _marshaled_dispatch(self, data, dispatch_method = None, path = None):
+ try:
+ response = self.dispatchers[path]._marshaled_dispatch(
+ data, dispatch_method, path)
+ except:
+ # report low level exception back to server
+ # (each dispatcher should have handled their own
+ # exceptions)
+ exc_type, exc_value = sys.exc_info()[:2]
+ response = dumps(
+ Fault(1, "%s:%s" % (exc_type, exc_value)),
+ encoding=self.encoding, allow_none=self.allow_none)
+ response = response.encode(self.encoding)
+ return response
+
+class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher):
+ """Simple handler for XML-RPC data passed through CGI."""
+
+ def __init__(self, allow_none=False, encoding=None, use_builtin_types=False):
+ SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding, use_builtin_types)
+
+ def handle_xmlrpc(self, request_text):
+ """Handle a single XML-RPC request"""
+
+ response = self._marshaled_dispatch(request_text)
+
+ print('Content-Type: text/xml')
+ print('Content-Length: %d' % len(response))
+ print()
+ sys.stdout.flush()
+ sys.stdout.buffer.write(response)
+ sys.stdout.buffer.flush()
+
+ def handle_get(self):
+ """Handle a single HTTP GET request.
+
+ Default implementation indicates an error because
+ XML-RPC uses the POST method.
+ """
+
+ code = 400
+ message, explain = BaseHTTPRequestHandler.responses[code]
+
+ response = http_server.DEFAULT_ERROR_MESSAGE % \
+ {
+ 'code' : code,
+ 'message' : message,
+ 'explain' : explain
+ }
+ response = response.encode('utf-8')
+ print('Status: %d %s' % (code, message))
+ print('Content-Type: %s' % http_server.DEFAULT_ERROR_CONTENT_TYPE)
+ print('Content-Length: %d' % len(response))
+ print()
+ sys.stdout.flush()
+ sys.stdout.buffer.write(response)
+ sys.stdout.buffer.flush()
+
+ def handle_request(self, request_text=None):
+ """Handle a single XML-RPC request passed through a CGI post method.
+
+ If no XML data is given then it is read from stdin. The resulting
+ XML-RPC response is printed to stdout along with the correct HTTP
+ headers.
+ """
+
+ if request_text is None and \
+ os.environ.get('REQUEST_METHOD', None) == 'GET':
+ self.handle_get()
+ else:
+ # POST data is normally available through stdin
+ try:
+ length = int(os.environ.get('CONTENT_LENGTH', None))
+ except (ValueError, TypeError):
+ length = -1
+ if request_text is None:
+ request_text = sys.stdin.read(length)
+
+ self.handle_xmlrpc(request_text)
+
+
+# -----------------------------------------------------------------------------
+# Self documenting XML-RPC Server.
+
+class ServerHTMLDoc(pydoc.HTMLDoc):
+ """Class used to generate pydoc HTML document for a server"""
+
+ def markup(self, text, escape=None, funcs={}, classes={}, methods={}):
+ """Mark up some plain text, given a context of symbols to look for.
+ Each context dictionary maps object names to anchor names."""
+ escape = escape or self.escape
+ results = []
+ here = 0
+
+ # XXX Note that this regular expression does not allow for the
+ # hyperlinking of arbitrary strings being used as method
+ # names. Only methods with names consisting of word characters
+ # and '.'s are hyperlinked.
+ pattern = re.compile(r'\b((http|ftp)://\S+[\w/]|'
+ r'RFC[- ]?(\d+)|'
+ r'PEP[- ]?(\d+)|'
+ r'(self\.)?((?:\w|\.)+))\b')
+ while 1:
+ match = pattern.search(text, here)
+ if not match: break
+ start, end = match.span()
+ results.append(escape(text[here:start]))
+
+ all, scheme, rfc, pep, selfdot, name = match.groups()
+ if scheme:
+ url = escape(all).replace('"', '"')
+ results.append('%s' % (url, url))
+ elif rfc:
+ url = 'http://www.rfc-editor.org/rfc/rfc%d.txt' % int(rfc)
+ results.append('%s' % (url, escape(all)))
+ elif pep:
+ url = 'http://www.python.org/dev/peps/pep-%04d/' % int(pep)
+ results.append('%s' % (url, escape(all)))
+ elif text[end:end+1] == '(':
+ results.append(self.namelink(name, methods, funcs, classes))
+ elif selfdot:
+ results.append('self.%s' % name)
+ else:
+ results.append(self.namelink(name, classes))
+ here = end
+ results.append(escape(text[here:]))
+ return ''.join(results)
+
+ def docroutine(self, object, name, mod=None,
+ funcs={}, classes={}, methods={}, cl=None):
+ """Produce HTML documentation for a function or method object."""
+
+ anchor = (cl and cl.__name__ or '') + '-' + name
+ note = ''
+
+ title = '%s' % (
+ self.escape(anchor), self.escape(name))
+
+ if inspect.ismethod(object):
+ args = inspect.getfullargspec(object)
+ # exclude the argument bound to the instance, it will be
+ # confusing to the non-Python user
+ argspec = inspect.formatargspec (
+ args.args[1:],
+ args.varargs,
+ args.varkw,
+ args.defaults,
+ annotations=args.annotations,
+ formatvalue=self.formatvalue
+ )
+ elif inspect.isfunction(object):
+ args = inspect.getfullargspec(object)
+ argspec = inspect.formatargspec(
+ args.args, args.varargs, args.varkw, args.defaults,
+ annotations=args.annotations,
+ formatvalue=self.formatvalue)
+ else:
+ argspec = '(...)'
+
+ if isinstance(object, tuple):
+ argspec = object[0] or argspec
+ docstring = object[1] or ""
+ else:
+ docstring = pydoc.getdoc(object)
+
+ decl = title + argspec + (note and self.grey(
+ '%s' % note))
+
+ doc = self.markup(
+ docstring, self.preformat, funcs, classes, methods)
+ doc = doc and '
%s
' % doc
+ return '
%s
%s
\n' % (decl, doc)
+
+ def docserver(self, server_name, package_documentation, methods):
+ """Produce HTML documentation for an XML-RPC server."""
+
+ fdict = {}
+ for key, value in methods.items():
+ fdict[key] = '#-' + key
+ fdict[value] = fdict[key]
+
+ server_name = self.escape(server_name)
+ head = '%s' % server_name
+ result = self.heading(head, '#ffffff', '#7799ee')
+
+ doc = self.markup(package_documentation, self.preformat, fdict)
+ doc = doc and '%s' % doc
+ result = result + '
%s
\n' % doc
+
+ contents = []
+ method_items = sorted(methods.items())
+ for key, value in method_items:
+ contents.append(self.docroutine(value, key, funcs=fdict))
+ result = result + self.bigsection(
+ 'Methods', '#ffffff', '#eeaa77', ''.join(contents))
+
+ return result
+
+class XMLRPCDocGenerator(object):
+ """Generates documentation for an XML-RPC server.
+
+ This class is designed as mix-in and should not
+ be constructed directly.
+ """
+
+ def __init__(self):
+ # setup variables used for HTML documentation
+ self.server_name = 'XML-RPC Server Documentation'
+ self.server_documentation = \
+ "This server exports the following methods through the XML-RPC "\
+ "protocol."
+ self.server_title = 'XML-RPC Server Documentation'
+
+ def set_server_title(self, server_title):
+ """Set the HTML title of the generated server documentation"""
+
+ self.server_title = server_title
+
+ def set_server_name(self, server_name):
+ """Set the name of the generated HTML server documentation"""
+
+ self.server_name = server_name
+
+ def set_server_documentation(self, server_documentation):
+ """Set the documentation string for the entire server."""
+
+ self.server_documentation = server_documentation
+
+ def generate_html_documentation(self):
+ """generate_html_documentation() => html documentation for the server
+
+ Generates HTML documentation for the server using introspection for
+ installed functions and instances that do not implement the
+ _dispatch method. Alternatively, instances can choose to implement
+ the _get_method_argstring(method_name) method to provide the
+ argument string used in the documentation and the
+ _methodHelp(method_name) method to provide the help text used
+ in the documentation."""
+
+ methods = {}
+
+ for method_name in self.system_listMethods():
+ if method_name in self.funcs:
+ method = self.funcs[method_name]
+ elif self.instance is not None:
+ method_info = [None, None] # argspec, documentation
+ if hasattr(self.instance, '_get_method_argstring'):
+ method_info[0] = self.instance._get_method_argstring(method_name)
+ if hasattr(self.instance, '_methodHelp'):
+ method_info[1] = self.instance._methodHelp(method_name)
+
+ method_info = tuple(method_info)
+ if method_info != (None, None):
+ method = method_info
+ elif not hasattr(self.instance, '_dispatch'):
+ try:
+ method = resolve_dotted_attribute(
+ self.instance,
+ method_name
+ )
+ except AttributeError:
+ method = method_info
+ else:
+ method = method_info
+ else:
+ assert 0, "Could not find method in self.functions and no "\
+ "instance installed"
+
+ methods[method_name] = method
+
+ documenter = ServerHTMLDoc()
+ documentation = documenter.docserver(
+ self.server_name,
+ self.server_documentation,
+ methods
+ )
+
+ return documenter.page(self.server_title, documentation)
+
+class DocXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
+ """XML-RPC and documentation request handler class.
+
+ Handles all HTTP POST requests and attempts to decode them as
+ XML-RPC requests.
+
+ Handles all HTTP GET requests and interprets them as requests
+ for documentation.
+ """
+
+ def do_GET(self):
+ """Handles the HTTP GET request.
+
+ Interpret all HTTP GET requests as requests for server
+ documentation.
+ """
+ # Check that the path is legal
+ if not self.is_rpc_path_valid():
+ self.report_404()
+ return
+
+ response = self.server.generate_html_documentation().encode('utf-8')
+ self.send_response(200)
+ self.send_header("Content-type", "text/html")
+ self.send_header("Content-length", str(len(response)))
+ self.end_headers()
+ self.wfile.write(response)
+
+class DocXMLRPCServer( SimpleXMLRPCServer,
+ XMLRPCDocGenerator):
+ """XML-RPC and HTML documentation server.
+
+ Adds the ability to serve server documentation to the capabilities
+ of SimpleXMLRPCServer.
+ """
+
+ def __init__(self, addr, requestHandler=DocXMLRPCRequestHandler,
+ logRequests=True, allow_none=False, encoding=None,
+ bind_and_activate=True, use_builtin_types=False):
+ SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests,
+ allow_none, encoding, bind_and_activate,
+ use_builtin_types)
+ XMLRPCDocGenerator.__init__(self)
+
+class DocCGIXMLRPCRequestHandler( CGIXMLRPCRequestHandler,
+ XMLRPCDocGenerator):
+ """Handler for XML-RPC data and documentation requests passed through
+ CGI"""
+
+ def handle_get(self):
+ """Handles the HTTP GET request.
+
+ Interpret all HTTP GET requests as requests for server
+ documentation.
+ """
+
+ response = self.generate_html_documentation().encode('utf-8')
+
+ print('Content-Type: text/html')
+ print('Content-Length: %d' % len(response))
+ print()
+ sys.stdout.flush()
+ sys.stdout.buffer.write(response)
+ sys.stdout.buffer.flush()
+
+ def __init__(self):
+ CGIXMLRPCRequestHandler.__init__(self)
+ XMLRPCDocGenerator.__init__(self)
+
+
+if __name__ == '__main__':
+ import datetime
+
+ class ExampleService:
+ def getData(self):
+ return '42'
+
+ class currentTime:
+ @staticmethod
+ def getCurrentTime():
+ return datetime.datetime.now()
+
+ server = SimpleXMLRPCServer(("localhost", 8000))
+ server.register_function(pow)
+ server.register_function(lambda x,y: x+y, 'add')
+ server.register_instance(ExampleService(), allow_dotted_names=True)
+ server.register_multicall_functions()
+ print('Serving XML-RPC on localhost port 8000')
+ print('It is advisable to run this example server within a secure, closed network.')
+ try:
+ server.serve_forever()
+ except KeyboardInterrupt:
+ print("\nKeyboard interrupt received, exiting.")
+ server.server_close()
+ sys.exit(0)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/__init__.py
new file mode 100644
index 0000000..94011f9
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/__init__.py
@@ -0,0 +1,51 @@
+"""
+A module that brings in equivalents of the new and modified Python 3
+builtins into Py2. Has no effect on Py3.
+
+See the docs `here `_
+(``docs/what-else.rst``) for more information.
+
+"""
+
+from future.builtins.iterators import (filter, map, zip)
+# The isinstance import is no longer needed. We provide it only for
+# backward-compatibility with future v0.8.2. It will be removed in future v1.0.
+from future.builtins.misc import (ascii, chr, hex, input, isinstance, next,
+ oct, open, pow, round, super)
+from future.utils import PY3
+
+if PY3:
+ import builtins
+ bytes = builtins.bytes
+ dict = builtins.dict
+ int = builtins.int
+ list = builtins.list
+ object = builtins.object
+ range = builtins.range
+ str = builtins.str
+ __all__ = []
+else:
+ from future.types import (newbytes as bytes,
+ newdict as dict,
+ newint as int,
+ newlist as list,
+ newobject as object,
+ newrange as range,
+ newstr as str)
+from future import utils
+
+
+if not utils.PY3:
+ # We only import names that shadow the builtins on Py2. No other namespace
+ # pollution on Py2.
+
+ # Only shadow builtins on Py2; no new names
+ __all__ = ['filter', 'map', 'zip',
+ 'ascii', 'chr', 'hex', 'input', 'next', 'oct', 'open', 'pow',
+ 'round', 'super',
+ 'bytes', 'dict', 'int', 'list', 'object', 'range', 'str',
+ ]
+
+else:
+ # No namespace pollution on Py3
+ __all__ = []
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/disabled.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/disabled.py
new file mode 100644
index 0000000..f6d6ea9
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/disabled.py
@@ -0,0 +1,66 @@
+"""
+This disables builtin functions (and one exception class) which are
+removed from Python 3.3.
+
+This module is designed to be used like this::
+
+ from future.builtins.disabled import *
+
+This disables the following obsolete Py2 builtin functions::
+
+ apply, cmp, coerce, execfile, file, input, long,
+ raw_input, reduce, reload, unicode, xrange
+
+We don't hack __builtin__, which is very fragile because it contaminates
+imported modules too. Instead, we just create new functions with
+the same names as the obsolete builtins from Python 2 which raise
+NameError exceptions when called.
+
+Note that both ``input()`` and ``raw_input()`` are among the disabled
+functions (in this module). Although ``input()`` exists as a builtin in
+Python 3, the Python 2 ``input()`` builtin is unsafe to use because it
+can lead to shell injection. Therefore we shadow it by default upon ``from
+future.builtins.disabled import *``, in case someone forgets to import our
+replacement ``input()`` somehow and expects Python 3 semantics.
+
+See the ``future.builtins.misc`` module for a working version of
+``input`` with Python 3 semantics.
+
+(Note that callable() is not among the functions disabled; this was
+reintroduced into Python 3.2.)
+
+This exception class is also disabled:
+
+ StandardError
+
+"""
+
+from __future__ import division, absolute_import, print_function
+
+from future import utils
+
+
+OBSOLETE_BUILTINS = ['apply', 'chr', 'cmp', 'coerce', 'execfile', 'file',
+ 'input', 'long', 'raw_input', 'reduce', 'reload',
+ 'unicode', 'xrange', 'StandardError']
+
+
+def disabled_function(name):
+ '''
+ Returns a function that cannot be called
+ '''
+ def disabled(*args, **kwargs):
+ '''
+ A function disabled by the ``future`` module. This function is
+ no longer a builtin in Python 3.
+ '''
+ raise NameError('obsolete Python 2 builtin {0} is disabled'.format(name))
+ return disabled
+
+
+if not utils.PY3:
+ for fname in OBSOLETE_BUILTINS:
+ locals()[fname] = disabled_function(fname)
+ __all__ = OBSOLETE_BUILTINS
+else:
+ __all__ = []
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/iterators.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/iterators.py
new file mode 100644
index 0000000..b82f29f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/iterators.py
@@ -0,0 +1,53 @@
+"""
+This module is designed to be used as follows::
+
+ from future.builtins.iterators import *
+
+And then, for example::
+
+ for i in range(10**15):
+ pass
+
+ for (a, b) in zip(range(10**15), range(-10**15, 0)):
+ pass
+
+Note that this is standard Python 3 code, plus some imports that do
+nothing on Python 3.
+
+The iterators this brings in are::
+
+- ``range``
+- ``filter``
+- ``map``
+- ``zip``
+
+On Python 2, ``range`` is a pure-Python backport of Python 3's ``range``
+iterator with slicing support. The other iterators (``filter``, ``map``,
+``zip``) are from the ``itertools`` module on Python 2. On Python 3 these
+are available in the module namespace but not exported for * imports via
+__all__ (zero no namespace pollution).
+
+Note that these are also available in the standard library
+``future_builtins`` module on Python 2 -- but not Python 3, so using
+the standard library version is not portable, nor anywhere near complete.
+"""
+
+from __future__ import division, absolute_import, print_function
+
+import itertools
+from future import utils
+
+if not utils.PY3:
+ filter = itertools.ifilter
+ map = itertools.imap
+ from future.types import newrange as range
+ zip = itertools.izip
+ __all__ = ['filter', 'map', 'range', 'zip']
+else:
+ import builtins
+ filter = builtins.filter
+ map = builtins.map
+ range = builtins.range
+ zip = builtins.zip
+ __all__ = []
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/misc.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/misc.py
new file mode 100644
index 0000000..90dc384
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/misc.py
@@ -0,0 +1,124 @@
+"""
+A module that brings in equivalents of various modified Python 3 builtins
+into Py2. Has no effect on Py3.
+
+The builtin functions are:
+
+- ``ascii`` (from Py2's future_builtins module)
+- ``hex`` (from Py2's future_builtins module)
+- ``oct`` (from Py2's future_builtins module)
+- ``chr`` (equivalent to ``unichr`` on Py2)
+- ``input`` (equivalent to ``raw_input`` on Py2)
+- ``next`` (calls ``__next__`` if it exists, else ``next`` method)
+- ``open`` (equivalent to io.open on Py2)
+- ``super`` (backport of Py3's magic zero-argument super() function
+- ``round`` (new "Banker's Rounding" behaviour from Py3)
+
+``isinstance`` is also currently exported for backwards compatibility
+with v0.8.2, although this has been deprecated since v0.9.
+
+
+input()
+-------
+Like the new ``input()`` function from Python 3 (without eval()), except
+that it returns bytes. Equivalent to Python 2's ``raw_input()``.
+
+Warning: By default, importing this module *removes* the old Python 2
+input() function entirely from ``__builtin__`` for safety. This is
+because forgetting to import the new ``input`` from ``future`` might
+otherwise lead to a security vulnerability (shell injection) on Python 2.
+
+To restore it, you can retrieve it yourself from
+``__builtin__._old_input``.
+
+Fortunately, ``input()`` seems to be seldom used in the wild in Python
+2...
+
+"""
+
+from future import utils
+
+
+if utils.PY2:
+ from io import open
+ from future_builtins import ascii, oct, hex
+ from __builtin__ import unichr as chr, pow as _builtin_pow
+ import __builtin__
+
+ # Only for backward compatibility with future v0.8.2:
+ isinstance = __builtin__.isinstance
+
+ # Warning: Python 2's input() is unsafe and MUST not be able to be used
+ # accidentally by someone who expects Python 3 semantics but forgets
+ # to import it on Python 2. Versions of ``future`` prior to 0.11
+ # deleted it from __builtin__. Now we keep in __builtin__ but shadow
+ # the name like all others. Just be sure to import ``input``.
+
+ input = raw_input
+
+ from future.builtins.newnext import newnext as next
+ from future.builtins.newround import newround as round
+ from future.builtins.newsuper import newsuper as super
+ from future.types.newint import newint
+
+ _SENTINEL = object()
+
+ def pow(x, y, z=_SENTINEL):
+ """
+ pow(x, y[, z]) -> number
+
+ With two arguments, equivalent to x**y. With three arguments,
+ equivalent to (x**y) % z, but may be more efficient (e.g. for ints).
+ """
+ # Handle newints
+ if isinstance(x, newint):
+ x = long(x)
+ if isinstance(y, newint):
+ y = long(y)
+ if isinstance(z, newint):
+ z = long(z)
+
+ try:
+ if z == _SENTINEL:
+ return _builtin_pow(x, y)
+ else:
+ return _builtin_pow(x, y, z)
+ except ValueError:
+ if z == _SENTINEL:
+ return _builtin_pow(x+0j, y)
+ else:
+ return _builtin_pow(x+0j, y, z)
+
+ # ``future`` doesn't support Py3.0/3.1. If we ever did, we'd add this:
+ # callable = __builtin__.callable
+
+ __all__ = ['ascii', 'chr', 'hex', 'input', 'isinstance', 'next', 'oct',
+ 'open', 'pow', 'round', 'super']
+
+else:
+ import builtins
+ ascii = builtins.ascii
+ chr = builtins.chr
+ hex = builtins.hex
+ input = builtins.input
+ next = builtins.next
+ # Only for backward compatibility with future v0.8.2:
+ isinstance = builtins.isinstance
+ oct = builtins.oct
+ open = builtins.open
+ pow = builtins.pow
+ round = builtins.round
+ super = builtins.super
+
+ __all__ = []
+
+ # The callable() function was removed from Py3.0 and 3.1 and
+ # reintroduced into Py3.2+. ``future`` doesn't support Py3.0/3.1. If we ever
+ # did, we'd add this:
+ # try:
+ # callable = builtins.callable
+ # except AttributeError:
+ # # Definition from Pandas
+ # def callable(obj):
+ # return any("__call__" in klass.__dict__ for klass in type(obj).__mro__)
+ # __all__.append('callable')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/newnext.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/newnext.py
new file mode 100644
index 0000000..9364023
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/newnext.py
@@ -0,0 +1,71 @@
+'''
+This module provides a newnext() function in Python 2 that mimics the
+behaviour of ``next()`` in Python 3, falling back to Python 2's behaviour for
+compatibility if this fails.
+
+``newnext(iterator)`` calls the iterator's ``__next__()`` method if it exists. If this
+doesn't exist, it falls back to calling a ``next()`` method.
+
+For example:
+
+ >>> class Odds(object):
+ ... def __init__(self, start=1):
+ ... self.value = start - 2
+ ... def __next__(self): # note the Py3 interface
+ ... self.value += 2
+ ... return self.value
+ ... def __iter__(self):
+ ... return self
+ ...
+ >>> iterator = Odds()
+ >>> next(iterator)
+ 1
+ >>> next(iterator)
+ 3
+
+If you are defining your own custom iterator class as above, it is preferable
+to explicitly decorate the class with the @implements_iterator decorator from
+``future.utils`` as follows:
+
+ >>> @implements_iterator
+ ... class Odds(object):
+ ... # etc
+ ... pass
+
+This next() function is primarily for consuming iterators defined in Python 3
+code elsewhere that we would like to run on Python 2 or 3.
+'''
+
+_builtin_next = next
+
+_SENTINEL = object()
+
+def newnext(iterator, default=_SENTINEL):
+ """
+ next(iterator[, default])
+
+ Return the next item from the iterator. If default is given and the iterator
+ is exhausted, it is returned instead of raising StopIteration.
+ """
+
+ # args = []
+ # if default is not _SENTINEL:
+ # args.append(default)
+ try:
+ try:
+ return iterator.__next__()
+ except AttributeError:
+ try:
+ return iterator.next()
+ except AttributeError:
+ raise TypeError("'{0}' object is not an iterator".format(
+ iterator.__class__.__name__))
+ except StopIteration as e:
+ if default is _SENTINEL:
+ raise e
+ else:
+ return default
+
+
+__all__ = ['newnext']
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/newround.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/newround.py
new file mode 100644
index 0000000..f59b35b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/newround.py
@@ -0,0 +1,99 @@
+"""
+``python-future``: pure Python implementation of Python 3 round().
+"""
+
+from future.utils import PYPY, PY26, bind_method
+
+# Use the decimal module for simplicity of implementation (and
+# hopefully correctness).
+from decimal import Decimal, ROUND_HALF_EVEN
+
+
+def newround(number, ndigits=None):
+ """
+ See Python 3 documentation: uses Banker's Rounding.
+
+ Delegates to the __round__ method if for some reason this exists.
+
+ If not, rounds a number to a given precision in decimal digits (default
+ 0 digits). This returns an int when called with one argument,
+ otherwise the same type as the number. ndigits may be negative.
+
+ See the test_round method in future/tests/test_builtins.py for
+ examples.
+ """
+ return_int = False
+ if ndigits is None:
+ return_int = True
+ ndigits = 0
+ if hasattr(number, '__round__'):
+ return number.__round__(ndigits)
+
+ if ndigits < 0:
+ raise NotImplementedError('negative ndigits not supported yet')
+ exponent = Decimal('10') ** (-ndigits)
+
+ if PYPY:
+ # Work around issue #24: round() breaks on PyPy with NumPy's types
+ if 'numpy' in repr(type(number)):
+ number = float(number)
+
+ if not PY26:
+ d = Decimal.from_float(number).quantize(exponent,
+ rounding=ROUND_HALF_EVEN)
+ else:
+ d = from_float_26(number).quantize(exponent, rounding=ROUND_HALF_EVEN)
+
+ if return_int:
+ return int(d)
+ else:
+ return float(d)
+
+
+### From Python 2.7's decimal.py. Only needed to support Py2.6:
+
+def from_float_26(f):
+ """Converts a float to a decimal number, exactly.
+
+ Note that Decimal.from_float(0.1) is not the same as Decimal('0.1').
+ Since 0.1 is not exactly representable in binary floating point, the
+ value is stored as the nearest representable value which is
+ 0x1.999999999999ap-4. The exact equivalent of the value in decimal
+ is 0.1000000000000000055511151231257827021181583404541015625.
+
+ >>> Decimal.from_float(0.1)
+ Decimal('0.1000000000000000055511151231257827021181583404541015625')
+ >>> Decimal.from_float(float('nan'))
+ Decimal('NaN')
+ >>> Decimal.from_float(float('inf'))
+ Decimal('Infinity')
+ >>> Decimal.from_float(-float('inf'))
+ Decimal('-Infinity')
+ >>> Decimal.from_float(-0.0)
+ Decimal('-0')
+
+ """
+ import math as _math
+ from decimal import _dec_from_triple # only available on Py2.6 and Py2.7 (not 3.3)
+
+ if isinstance(f, (int, long)): # handle integer inputs
+ return Decimal(f)
+ if _math.isinf(f) or _math.isnan(f): # raises TypeError if not a float
+ return Decimal(repr(f))
+ if _math.copysign(1.0, f) == 1.0:
+ sign = 0
+ else:
+ sign = 1
+ n, d = abs(f).as_integer_ratio()
+ # int.bit_length() method doesn't exist on Py2.6:
+ def bit_length(d):
+ if d != 0:
+ return len(bin(abs(d))) - 2
+ else:
+ return 0
+ k = bit_length(d) - 1
+ result = _dec_from_triple(sign, str(n*5**k), -k)
+ return result
+
+
+__all__ = ['newround']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/newsuper.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/newsuper.py
new file mode 100644
index 0000000..5190a2a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/builtins/newsuper.py
@@ -0,0 +1,115 @@
+'''
+This module provides a newsuper() function in Python 2 that mimics the
+behaviour of super() in Python 3. It is designed to be used as follows:
+
+ from __future__ import division, absolute_import, print_function
+ from future.builtins import super
+
+And then, for example:
+
+ class VerboseList(list):
+ def append(self, item):
+ print('Adding an item')
+ super().append(item) # new simpler super() function
+
+Importing this module on Python 3 has no effect.
+
+This is based on (i.e. almost identical to) Ryan Kelly's magicsuper
+module here:
+
+ https://github.com/rfk/magicsuper.git
+
+Excerpts from Ryan's docstring:
+
+ "Of course, you can still explicitly pass in the arguments if you want
+ to do something strange. Sometimes you really do want that, e.g. to
+ skip over some classes in the method resolution order.
+
+ "How does it work? By inspecting the calling frame to determine the
+ function object being executed and the object on which it's being
+ called, and then walking the object's __mro__ chain to find out where
+ that function was defined. Yuck, but it seems to work..."
+'''
+
+from __future__ import absolute_import
+import sys
+from types import FunctionType
+
+from future.utils import PY3, PY26
+
+
+_builtin_super = super
+
+_SENTINEL = object()
+
+def newsuper(typ=_SENTINEL, type_or_obj=_SENTINEL, framedepth=1):
+ '''Like builtin super(), but capable of magic.
+
+ This acts just like the builtin super() function, but if called
+ without any arguments it attempts to infer them at runtime.
+ '''
+ # Infer the correct call if used without arguments.
+ if typ is _SENTINEL:
+ # We'll need to do some frame hacking.
+ f = sys._getframe(framedepth)
+
+ try:
+ # Get the function's first positional argument.
+ type_or_obj = f.f_locals[f.f_code.co_varnames[0]]
+ except (IndexError, KeyError,):
+ raise RuntimeError('super() used in a function with no args')
+
+ try:
+ # Get the MRO so we can crawl it.
+ mro = type_or_obj.__mro__
+ except AttributeError:
+ try:
+ mro = type_or_obj.__class__.__mro__
+ except AttributeError:
+ raise RuntimeError('super() used with a non-newstyle class')
+
+ # A ``for...else`` block? Yes! It's odd, but useful.
+ # If unfamiliar with for...else, see:
+ #
+ # http://psung.blogspot.com/2007/12/for-else-in-python.html
+ for typ in mro:
+ # Find the class that owns the currently-executing method.
+ for meth in typ.__dict__.values():
+ # Drill down through any wrappers to the underlying func.
+ # This handles e.g. classmethod() and staticmethod().
+ try:
+ while not isinstance(meth,FunctionType):
+ if isinstance(meth, property):
+ # Calling __get__ on the property will invoke
+ # user code which might throw exceptions or have
+ # side effects
+ meth = meth.fget
+ else:
+ try:
+ meth = meth.__func__
+ except AttributeError:
+ meth = meth.__get__(type_or_obj)
+ except (AttributeError, TypeError):
+ continue
+ if meth.func_code is f.f_code:
+ break # Aha! Found you.
+ else:
+ continue # Not found! Move onto the next class in MRO.
+ break # Found! Break out of the search loop.
+ else:
+ raise RuntimeError('super() called outside a method')
+
+ # Dispatch to builtin super().
+ if type_or_obj is not _SENTINEL:
+ return _builtin_super(typ, type_or_obj)
+ return _builtin_super(typ)
+
+
+def superm(*args, **kwds):
+ f = sys._getframe(1)
+ nm = f.f_code.co_name
+ return getattr(newsuper(framedepth=2),nm)(*args, **kwds)
+
+
+__all__ = ['newsuper']
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/__init__.py
new file mode 100644
index 0000000..040fdcf
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/__init__.py
@@ -0,0 +1,8 @@
+# future.moves package
+from __future__ import absolute_import
+import sys
+__future_module__ = True
+from future.standard_library import import_top_level_modules
+
+if sys.version_info[0] == 3:
+ import_top_level_modules()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/_dummy_thread.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/_dummy_thread.py
new file mode 100644
index 0000000..688d249
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/_dummy_thread.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from _dummy_thread import *
+else:
+ __future_module__ = True
+ from dummy_thread import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/_markupbase.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/_markupbase.py
new file mode 100644
index 0000000..f9fb4bb
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/_markupbase.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from _markupbase import *
+else:
+ __future_module__ = True
+ from markupbase import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/_thread.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/_thread.py
new file mode 100644
index 0000000..c68018b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/_thread.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from _thread import *
+else:
+ __future_module__ = True
+ from thread import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/builtins.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/builtins.py
new file mode 100644
index 0000000..e4b6221
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/builtins.py
@@ -0,0 +1,10 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from builtins import *
+else:
+ __future_module__ = True
+ from __builtin__ import *
+ # Overwrite any old definitions with the equivalent future.builtins ones:
+ from future.builtins import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/collections.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/collections.py
new file mode 100644
index 0000000..f4dfb5a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/collections.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+from future.utils import PY2, PY26
+__future_module__ = True
+
+from collections import *
+
+if PY2:
+ from UserDict import UserDict
+ from UserList import UserList
+ from UserString import UserString
+
+if PY26:
+ from future.backports.misc import OrderedDict, Counter
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/configparser.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/configparser.py
new file mode 100644
index 0000000..33d9cf9
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/configparser.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+
+from future.utils import PY2
+
+if PY2:
+ from ConfigParser import *
+else:
+ from configparser import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/copyreg.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/copyreg.py
new file mode 100644
index 0000000..21c7a42
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/copyreg.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from copyreg import *
+else:
+ __future_module__ = True
+ from copy_reg import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/dbm/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/dbm/__init__.py
new file mode 100644
index 0000000..626b406
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/dbm/__init__.py
@@ -0,0 +1,20 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from dbm import *
+else:
+ __future_module__ = True
+ from whichdb import *
+ from anydbm import *
+
+# Py3.3's dbm/__init__.py imports ndbm but doesn't expose it via __all__.
+# In case some (badly written) code depends on dbm.ndbm after import dbm,
+# we simulate this:
+if PY3:
+ from dbm import ndbm
+else:
+ try:
+ from future.moves.dbm import ndbm
+ except ImportError:
+ ndbm = None
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/dbm/dumb.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/dbm/dumb.py
new file mode 100644
index 0000000..528383f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/dbm/dumb.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from dbm.dumb import *
+else:
+ __future_module__ = True
+ from dumbdbm import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/dbm/gnu.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/dbm/gnu.py
new file mode 100644
index 0000000..68ccf67
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/dbm/gnu.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from dbm.gnu import *
+else:
+ __future_module__ = True
+ from gdbm import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/dbm/ndbm.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/dbm/ndbm.py
new file mode 100644
index 0000000..8c6fff8
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/dbm/ndbm.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from dbm.ndbm import *
+else:
+ __future_module__ = True
+ from dbm import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/html/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/html/__init__.py
new file mode 100644
index 0000000..22ed6e7
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/html/__init__.py
@@ -0,0 +1,31 @@
+from __future__ import absolute_import
+from future.utils import PY3
+__future_module__ = True
+
+if PY3:
+ from html import *
+else:
+ # cgi.escape isn't good enough for the single Py3.3 html test to pass.
+ # Define it inline here instead. From the Py3.4 stdlib. Note that the
+ # html.escape() function from the Py3.3 stdlib is not suitable for use on
+ # Py2.x.
+ """
+ General functions for HTML manipulation.
+ """
+
+ def escape(s, quote=True):
+ """
+ Replace special characters "&", "<" and ">" to HTML-safe sequences.
+ If the optional flag quote is true (the default), the quotation mark
+ characters, both double quote (") and single quote (') characters are also
+ translated.
+ """
+ s = s.replace("&", "&") # Must be done first!
+ s = s.replace("<", "<")
+ s = s.replace(">", ">")
+ if quote:
+ s = s.replace('"', """)
+ s = s.replace('\'', "'")
+ return s
+
+ __all__ = ['escape']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/html/entities.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/html/entities.py
new file mode 100644
index 0000000..56a8860
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/html/entities.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from html.entities import *
+else:
+ __future_module__ = True
+ from htmlentitydefs import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/html/parser.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/html/parser.py
new file mode 100644
index 0000000..a6115b5
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/html/parser.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+__future_module__ = True
+
+if PY3:
+ from html.parser import *
+else:
+ from HTMLParser import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/http/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/http/__init__.py
new file mode 100644
index 0000000..917b3d7
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/http/__init__.py
@@ -0,0 +1,4 @@
+from future.utils import PY3
+
+if not PY3:
+ __future_module__ = True
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/http/client.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/http/client.py
new file mode 100644
index 0000000..1ca0e9b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/http/client.py
@@ -0,0 +1,7 @@
+from future.utils import PY3
+
+if PY3:
+ from http.client import *
+else:
+ from httplib import *
+ __future_module__ = True
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/http/cookiejar.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/http/cookiejar.py
new file mode 100644
index 0000000..ea00df7
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/http/cookiejar.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from http.cookiejar import *
+else:
+ __future_module__ = True
+ from cookielib import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/http/cookies.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/http/cookies.py
new file mode 100644
index 0000000..1b74fe2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/http/cookies.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from http.cookies import *
+else:
+ __future_module__ = True
+ from Cookie import *
+ from Cookie import Morsel # left out of __all__ on Py2.7!
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/http/server.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/http/server.py
new file mode 100644
index 0000000..4e75cc1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/http/server.py
@@ -0,0 +1,20 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from http.server import *
+else:
+ __future_module__ = True
+ from BaseHTTPServer import *
+ from CGIHTTPServer import *
+ from SimpleHTTPServer import *
+ try:
+ from CGIHTTPServer import _url_collapse_path # needed for a test
+ except ImportError:
+ try:
+ # Python 2.7.0 to 2.7.3
+ from CGIHTTPServer import (
+ _url_collapse_path_split as _url_collapse_path)
+ except ImportError:
+ # Doesn't exist on Python 2.6.x. Ignore it.
+ pass
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/itertools.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/itertools.py
new file mode 100644
index 0000000..e5eb20d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/itertools.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+
+from itertools import *
+try:
+ zip_longest = izip_longest
+ filterfalse = ifilterfalse
+except NameError:
+ pass
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/pickle.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/pickle.py
new file mode 100644
index 0000000..c53d693
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/pickle.py
@@ -0,0 +1,11 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from pickle import *
+else:
+ __future_module__ = True
+ try:
+ from cPickle import *
+ except ImportError:
+ from pickle import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/queue.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/queue.py
new file mode 100644
index 0000000..1cb1437
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/queue.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from queue import *
+else:
+ __future_module__ = True
+ from Queue import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/reprlib.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/reprlib.py
new file mode 100644
index 0000000..a313a13
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/reprlib.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from reprlib import *
+else:
+ __future_module__ = True
+ from repr import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/socketserver.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/socketserver.py
new file mode 100644
index 0000000..062e084
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/socketserver.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from socketserver import *
+else:
+ __future_module__ = True
+ from SocketServer import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/subprocess.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/subprocess.py
new file mode 100644
index 0000000..43ffd2a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/subprocess.py
@@ -0,0 +1,11 @@
+from __future__ import absolute_import
+from future.utils import PY2, PY26
+
+from subprocess import *
+
+if PY2:
+ __future_module__ = True
+ from commands import getoutput, getstatusoutput
+
+if PY26:
+ from future.backports.misc import check_output
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/sys.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/sys.py
new file mode 100644
index 0000000..1293bcb
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/sys.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+
+from future.utils import PY2
+
+from sys import *
+
+if PY2:
+ from __builtin__ import intern
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/test/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/test/__init__.py
new file mode 100644
index 0000000..5cf428b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/test/__init__.py
@@ -0,0 +1,5 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if not PY3:
+ __future_module__ = True
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/test/support.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/test/support.py
new file mode 100644
index 0000000..ab189f4
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/test/support.py
@@ -0,0 +1,11 @@
+from __future__ import absolute_import
+from future.standard_library import suspend_hooks
+from future.utils import PY3
+
+if PY3:
+ from test.support import *
+else:
+ __future_module__ = True
+ with suspend_hooks():
+ from test.test_support import *
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/__init__.py
new file mode 100644
index 0000000..09442e4
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/__init__.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+__future_module__ = True
+
+if not PY3:
+ from Tkinter import *
+else:
+ from tkinter import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/colorchooser.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/colorchooser.py
new file mode 100644
index 0000000..5e7c97f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/colorchooser.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.colorchooser import *
+else:
+ try:
+ from tkColorChooser import *
+ except ImportError:
+ raise ImportError('The tkColorChooser module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/commondialog.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/commondialog.py
new file mode 100644
index 0000000..7747a0b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/commondialog.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.commondialog import *
+else:
+ try:
+ from tkCommonDialog import *
+ except ImportError:
+ raise ImportError('The tkCommonDialog module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/constants.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/constants.py
new file mode 100644
index 0000000..99216f3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/constants.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.constants import *
+else:
+ try:
+ from Tkconstants import *
+ except ImportError:
+ raise ImportError('The Tkconstants module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/dialog.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/dialog.py
new file mode 100644
index 0000000..a5b7778
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/dialog.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.dialog import *
+else:
+ try:
+ from Dialog import *
+ except ImportError:
+ raise ImportError('The Dialog module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/dnd.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/dnd.py
new file mode 100644
index 0000000..748b111
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/dnd.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.dnd import *
+else:
+ try:
+ from Tkdnd import *
+ except ImportError:
+ raise ImportError('The Tkdnd module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/filedialog.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/filedialog.py
new file mode 100644
index 0000000..35e21ac
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/filedialog.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.filedialog import *
+else:
+ try:
+ from FileDialog import *
+ except ImportError:
+ raise ImportError('The FileDialog module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/font.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/font.py
new file mode 100644
index 0000000..63d86dc
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/font.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.font import *
+else:
+ try:
+ from tkFont import *
+ except ImportError:
+ raise ImportError('The tkFont module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/messagebox.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/messagebox.py
new file mode 100644
index 0000000..3ed52e1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/messagebox.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.messagebox import *
+else:
+ try:
+ from tkMessageBox import *
+ except ImportError:
+ raise ImportError('The tkMessageBox module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/scrolledtext.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/scrolledtext.py
new file mode 100644
index 0000000..13bd660
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/scrolledtext.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.scrolledtext import *
+else:
+ try:
+ from ScrolledText import *
+ except ImportError:
+ raise ImportError('The ScrolledText module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/simpledialog.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/simpledialog.py
new file mode 100644
index 0000000..e952fa9
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/simpledialog.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.simpledialog import *
+else:
+ try:
+ from SimpleDialog import *
+ except ImportError:
+ raise ImportError('The SimpleDialog module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/tix.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/tix.py
new file mode 100644
index 0000000..019df6f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/tkinter/tix.py
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+
+from future.utils import PY3
+
+if PY3:
+ from tkinter.tix import *
+else:
+ try:
+ from Tix import *
+ except ImportError:
+ raise ImportError('The Tix module is missing. Does your Py2 '
+ 'installation include tkinter?')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/urllib/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/urllib/__init__.py
new file mode 100644
index 0000000..8d1298c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/urllib/__init__.py
@@ -0,0 +1,6 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if not PY3:
+ __future_module__ = True
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/urllib/error.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/urllib/error.py
new file mode 100644
index 0000000..ae49255
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/urllib/error.py
@@ -0,0 +1,16 @@
+from __future__ import absolute_import
+from future.standard_library import suspend_hooks
+
+from future.utils import PY3
+
+if PY3:
+ from urllib.error import *
+else:
+ __future_module__ = True
+
+ # We use this method to get at the original Py2 urllib before any renaming magic
+ # ContentTooShortError = sys.py2_modules['urllib'].ContentTooShortError
+
+ with suspend_hooks():
+ from urllib import ContentTooShortError
+ from urllib2 import URLError, HTTPError
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/urllib/parse.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/urllib/parse.py
new file mode 100644
index 0000000..832dfb5
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/urllib/parse.py
@@ -0,0 +1,28 @@
+from __future__ import absolute_import
+from future.standard_library import suspend_hooks
+
+from future.utils import PY3
+
+if PY3:
+ from urllib.parse import *
+else:
+ __future_module__ = True
+ from urlparse import (ParseResult, SplitResult, parse_qs, parse_qsl,
+ urldefrag, urljoin, urlparse, urlsplit,
+ urlunparse, urlunsplit)
+
+ # we use this method to get at the original py2 urllib before any renaming
+ # quote = sys.py2_modules['urllib'].quote
+ # quote_plus = sys.py2_modules['urllib'].quote_plus
+ # unquote = sys.py2_modules['urllib'].unquote
+ # unquote_plus = sys.py2_modules['urllib'].unquote_plus
+ # urlencode = sys.py2_modules['urllib'].urlencode
+ # splitquery = sys.py2_modules['urllib'].splitquery
+
+ with suspend_hooks():
+ from urllib import (quote,
+ quote_plus,
+ unquote,
+ unquote_plus,
+ urlencode,
+ splitquery)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/urllib/request.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/urllib/request.py
new file mode 100644
index 0000000..375dc29
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/urllib/request.py
@@ -0,0 +1,93 @@
+from __future__ import absolute_import
+
+from future.standard_library import suspend_hooks
+from future.utils import PY3
+
+if PY3:
+ from urllib.request import *
+ # This aren't in __all__:
+ from urllib.request import (getproxies,
+ pathname2url,
+ proxy_bypass,
+ quote,
+ request_host,
+ splitattr,
+ splithost,
+ splitpasswd,
+ splitport,
+ splitquery,
+ splittag,
+ splittype,
+ splituser,
+ splitvalue,
+ thishost,
+ to_bytes,
+ unquote,
+ unwrap,
+ url2pathname,
+ urlcleanup,
+ urljoin,
+ urlopen,
+ urlparse,
+ urlretrieve,
+ urlsplit,
+ urlunparse)
+else:
+ __future_module__ = True
+ with suspend_hooks():
+ from urllib import *
+ from urllib2 import *
+ from urlparse import *
+
+ # Rename:
+ from urllib import toBytes # missing from __all__ on Py2.6
+ to_bytes = toBytes
+
+ # from urllib import (pathname2url,
+ # url2pathname,
+ # getproxies,
+ # urlretrieve,
+ # urlcleanup,
+ # URLopener,
+ # FancyURLopener,
+ # proxy_bypass)
+
+ # from urllib2 import (
+ # AbstractBasicAuthHandler,
+ # AbstractDigestAuthHandler,
+ # BaseHandler,
+ # CacheFTPHandler,
+ # FileHandler,
+ # FTPHandler,
+ # HTTPBasicAuthHandler,
+ # HTTPCookieProcessor,
+ # HTTPDefaultErrorHandler,
+ # HTTPDigestAuthHandler,
+ # HTTPErrorProcessor,
+ # HTTPHandler,
+ # HTTPPasswordMgr,
+ # HTTPPasswordMgrWithDefaultRealm,
+ # HTTPRedirectHandler,
+ # HTTPSHandler,
+ # URLError,
+ # build_opener,
+ # install_opener,
+ # OpenerDirector,
+ # ProxyBasicAuthHandler,
+ # ProxyDigestAuthHandler,
+ # ProxyHandler,
+ # Request,
+ # UnknownHandler,
+ # urlopen,
+ # )
+
+ # from urlparse import (
+ # urldefrag
+ # urljoin,
+ # urlparse,
+ # urlunparse,
+ # urlsplit,
+ # urlunsplit,
+ # parse_qs,
+ # parse_q"
+ # )
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/urllib/response.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/urllib/response.py
new file mode 100644
index 0000000..120ea13
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/urllib/response.py
@@ -0,0 +1,13 @@
+from future import standard_library
+from future.utils import PY3
+
+if PY3:
+ from urllib.response import *
+else:
+ __future_module__ = True
+ with standard_library.suspend_hooks():
+ from urllib import (addbase,
+ addclosehook,
+ addinfo,
+ addinfourl)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/urllib/robotparser.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/urllib/robotparser.py
new file mode 100644
index 0000000..0dc8f57
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/urllib/robotparser.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from urllib.robotparser import *
+else:
+ __future_module__ = True
+ from robotparser import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/winreg.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/winreg.py
new file mode 100644
index 0000000..c8b1475
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/winreg.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from winreg import *
+else:
+ __future_module__ = True
+ from _winreg import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/xmlrpc/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/xmlrpc/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/xmlrpc/client.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/xmlrpc/client.py
new file mode 100644
index 0000000..4708cf8
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/xmlrpc/client.py
@@ -0,0 +1,7 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from xmlrpc.client import *
+else:
+ from xmlrpclib import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/xmlrpc/server.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/xmlrpc/server.py
new file mode 100644
index 0000000..1a8af34
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/moves/xmlrpc/server.py
@@ -0,0 +1,7 @@
+from __future__ import absolute_import
+from future.utils import PY3
+
+if PY3:
+ from xmlrpc.server import *
+else:
+ from xmlrpclib import *
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/standard_library/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/standard_library/__init__.py
new file mode 100644
index 0000000..2923e2d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/standard_library/__init__.py
@@ -0,0 +1,810 @@
+"""
+Python 3 reorganized the standard library (PEP 3108). This module exposes
+several standard library modules to Python 2 under their new Python 3
+names.
+
+It is designed to be used as follows::
+
+ from future import standard_library
+ standard_library.install_aliases()
+
+And then these normal Py3 imports work on both Py3 and Py2::
+
+ import builtins
+ import configparser
+ import copyreg
+ import queue
+ import reprlib
+ import socketserver
+ import winreg # on Windows only
+ import test.support
+ import html, html.parser, html.entites
+ import http, http.client, http.server
+ import http.cookies, http.cookiejar
+ import urllib.parse, urllib.request, urllib.response, urllib.error, urllib.robotparser
+ import xmlrpc.client, xmlrpc.server
+
+ import _thread
+ import _dummy_thread
+ import _markupbase
+
+ from itertools import filterfalse, zip_longest
+ from sys import intern
+ from collections import UserDict, UserList, UserString
+ from collections import OrderedDict, Counter # even on Py2.6
+ from subprocess import getoutput, getstatusoutput
+ from subprocess import check_output # even on Py2.6
+
+(The renamed modules and functions are still available under their old
+names on Python 2.)
+
+This is a cleaner alternative to this idiom (see
+http://docs.pythonsprints.com/python3_porting/py-porting.html)::
+
+ try:
+ import queue
+ except ImportError:
+ import Queue as queue
+
+
+Limitations
+-----------
+We don't currently support these modules, but would like to::
+
+ import dbm
+ import dbm.dumb
+ import dbm.gnu
+ import collections.abc # on Py33
+ import tkinter
+ import pickle # should (optionally) bring in cPickle on Python 2
+
+"""
+
+from __future__ import absolute_import, division, print_function
+
+import sys
+import logging
+import imp
+import contextlib
+import types
+import copy
+import os
+
+# Make a dedicated logger; leave the root logger to be configured
+# by the application.
+flog = logging.getLogger('future_stdlib')
+_formatter = logging.Formatter(logging.BASIC_FORMAT)
+_handler = logging.StreamHandler()
+_handler.setFormatter(_formatter)
+flog.addHandler(_handler)
+flog.setLevel(logging.WARN)
+
+from future.utils import PY2, PY3
+
+# The modules that are defined under the same names on Py3 but with
+# different contents in a significant way (e.g. submodules) are:
+# pickle (fast one)
+# dbm
+# urllib
+# test
+# email
+
+REPLACED_MODULES = set(['test', 'urllib', 'pickle', 'dbm']) # add email and dbm when we support it
+
+# The following module names are not present in Python 2.x, so they cause no
+# potential clashes between the old and new names:
+# http
+# html
+# tkinter
+# xmlrpc
+# Keys: Py2 / real module names
+# Values: Py3 / simulated module names
+RENAMES = {
+ # 'cStringIO': 'io', # there's a new io module in Python 2.6
+ # that provides StringIO and BytesIO
+ # 'StringIO': 'io', # ditto
+ # 'cPickle': 'pickle',
+ '__builtin__': 'builtins',
+ 'copy_reg': 'copyreg',
+ 'Queue': 'queue',
+ 'future.moves.socketserver': 'socketserver',
+ 'ConfigParser': 'configparser',
+ 'repr': 'reprlib',
+ # 'FileDialog': 'tkinter.filedialog',
+ # 'tkFileDialog': 'tkinter.filedialog',
+ # 'SimpleDialog': 'tkinter.simpledialog',
+ # 'tkSimpleDialog': 'tkinter.simpledialog',
+ # 'tkColorChooser': 'tkinter.colorchooser',
+ # 'tkCommonDialog': 'tkinter.commondialog',
+ # 'Dialog': 'tkinter.dialog',
+ # 'Tkdnd': 'tkinter.dnd',
+ # 'tkFont': 'tkinter.font',
+ # 'tkMessageBox': 'tkinter.messagebox',
+ # 'ScrolledText': 'tkinter.scrolledtext',
+ # 'Tkconstants': 'tkinter.constants',
+ # 'Tix': 'tkinter.tix',
+ # 'ttk': 'tkinter.ttk',
+ # 'Tkinter': 'tkinter',
+ '_winreg': 'winreg',
+ 'thread': '_thread',
+ 'dummy_thread': '_dummy_thread',
+ # 'anydbm': 'dbm', # causes infinite import loop
+ # 'whichdb': 'dbm', # causes infinite import loop
+ # anydbm and whichdb are handled by fix_imports2
+ # 'dbhash': 'dbm.bsd',
+ # 'dumbdbm': 'dbm.dumb',
+ # 'dbm': 'dbm.ndbm',
+ # 'gdbm': 'dbm.gnu',
+ 'future.moves.xmlrpc': 'xmlrpc',
+ # 'future.backports.email': 'email', # for use by urllib
+ # 'DocXMLRPCServer': 'xmlrpc.server',
+ # 'SimpleXMLRPCServer': 'xmlrpc.server',
+ # 'httplib': 'http.client',
+ # 'htmlentitydefs' : 'html.entities',
+ # 'HTMLParser' : 'html.parser',
+ # 'Cookie': 'http.cookies',
+ # 'cookielib': 'http.cookiejar',
+ # 'BaseHTTPServer': 'http.server',
+ # 'SimpleHTTPServer': 'http.server',
+ # 'CGIHTTPServer': 'http.server',
+ # 'future.backports.test': 'test', # primarily for renaming test_support to support
+ # 'commands': 'subprocess',
+ # 'urlparse' : 'urllib.parse',
+ # 'robotparser' : 'urllib.robotparser',
+ # 'abc': 'collections.abc', # for Py33
+ # 'future.utils.six.moves.html': 'html',
+ # 'future.utils.six.moves.http': 'http',
+ 'future.moves.html': 'html',
+ 'future.moves.http': 'http',
+ # 'future.backports.urllib': 'urllib',
+ # 'future.utils.six.moves.urllib': 'urllib',
+ 'future.moves._markupbase': '_markupbase',
+ }
+
+
+# It is complicated and apparently brittle to mess around with the
+# ``sys.modules`` cache in order to support "import urllib" meaning two
+# different things (Py2.7 urllib and backported Py3.3-like urllib) in different
+# contexts. So we require explicit imports for these modules.
+assert len(set(RENAMES.values()) & set(REPLACED_MODULES)) == 0
+
+
+# Harmless renames that we can insert.
+# These modules need names from elsewhere being added to them:
+# subprocess: should provide getoutput and other fns from commands
+# module but these fns are missing: getstatus, mk2arg,
+# mkarg
+# re: needs an ASCII constant that works compatibly with Py3
+
+# etc: see lib2to3/fixes/fix_imports.py
+
+# (New module name, new object name, old module name, old object name)
+MOVES = [('collections', 'UserList', 'UserList', 'UserList'),
+ ('collections', 'UserDict', 'UserDict', 'UserDict'),
+ ('collections', 'UserString','UserString', 'UserString'),
+ ('itertools', 'filterfalse','itertools', 'ifilterfalse'),
+ ('itertools', 'zip_longest','itertools', 'izip_longest'),
+ ('sys', 'intern','__builtin__', 'intern'),
+ # The re module has no ASCII flag in Py2, but this is the default.
+ # Set re.ASCII to a zero constant. stat.ST_MODE just happens to be one
+ # (and it exists on Py2.6+).
+ ('re', 'ASCII','stat', 'ST_MODE'),
+ ('base64', 'encodebytes','base64', 'encodestring'),
+ ('base64', 'decodebytes','base64', 'decodestring'),
+ ('subprocess', 'getoutput', 'commands', 'getoutput'),
+ ('subprocess', 'getstatusoutput', 'commands', 'getstatusoutput'),
+ ('subprocess', 'check_output', 'future.backports.misc', 'check_output'),
+ ('math', 'ceil', 'future.backports.misc', 'ceil'),
+ ('collections', 'OrderedDict', 'future.backports.misc', 'OrderedDict'),
+ ('collections', 'Counter', 'future.backports.misc', 'Counter'),
+
+# This is no use, since "import urllib.request" etc. still fails:
+# ('urllib', 'error', 'future.moves.urllib', 'error'),
+# ('urllib', 'parse', 'future.moves.urllib', 'parse'),
+# ('urllib', 'request', 'future.moves.urllib', 'request'),
+# ('urllib', 'response', 'future.moves.urllib', 'response'),
+# ('urllib', 'robotparser', 'future.moves.urllib', 'robotparser'),
+ ]
+
+
+# A minimal example of an import hook:
+# class WarnOnImport(object):
+# def __init__(self, *args):
+# self.module_names = args
+#
+# def find_module(self, fullname, path=None):
+# if fullname in self.module_names:
+# self.path = path
+# return self
+# return None
+#
+# def load_module(self, name):
+# if name in sys.modules:
+# return sys.modules[name]
+# module_info = imp.find_module(name, self.path)
+# module = imp.load_module(name, *module_info)
+# sys.modules[name] = module
+# flog.warning("Imported deprecated module %s", name)
+# return module
+
+
+class RenameImport(object):
+ """
+ A class for import hooks mapping Py3 module names etc. to the Py2 equivalents.
+ """
+ # Different RenameImport classes are created when importing this module from
+ # different source files. This causes isinstance(hook, RenameImport) checks
+ # to produce inconsistent results. We add this RENAMER attribute here so
+ # remove_hooks() and install_hooks() can find instances of these classes
+ # easily:
+ RENAMER = True
+
+ def __init__(self, old_to_new):
+ '''
+ Pass in a dictionary-like object mapping from old names to new
+ names. E.g. {'ConfigParser': 'configparser', 'cPickle': 'pickle'}
+ '''
+ self.old_to_new = old_to_new
+ both = set(old_to_new.keys()) & set(old_to_new.values())
+ assert (len(both) == 0 and
+ len(set(old_to_new.values())) == len(old_to_new.values())), \
+ 'Ambiguity in renaming (handler not implemented)'
+ self.new_to_old = dict((new, old) for (old, new) in old_to_new.items())
+
+ def find_module(self, fullname, path=None):
+ # Handles hierarchical importing: package.module.module2
+ new_base_names = set([s.split('.')[0] for s in self.new_to_old])
+ # Before v0.12: Was: if fullname in set(self.old_to_new) | new_base_names:
+ if fullname in new_base_names:
+ return self
+ return None
+
+ def load_module(self, name):
+ path = None
+ if name in sys.modules:
+ return sys.modules[name]
+ elif name in self.new_to_old:
+ # New name. Look up the corresponding old (Py2) name:
+ oldname = self.new_to_old[name]
+ module = self._find_and_load_module(oldname)
+ # module.__future_module__ = True
+ else:
+ module = self._find_and_load_module(name)
+ # In any case, make it available under the requested (Py3) name
+ sys.modules[name] = module
+ return module
+
+ def _find_and_load_module(self, name, path=None):
+ """
+ Finds and loads it. But if there's a . in the name, handles it
+ properly.
+ """
+ bits = name.split('.')
+ while len(bits) > 1:
+ # Treat the first bit as a package
+ packagename = bits.pop(0)
+ package = self._find_and_load_module(packagename, path)
+ try:
+ path = package.__path__
+ except AttributeError:
+ # This could be e.g. moves.
+ flog.debug('Package {0} has no __path__.'.format(package))
+ if name in sys.modules:
+ return sys.modules[name]
+ flog.debug('What to do here?')
+
+ name = bits[0]
+ module_info = imp.find_module(name, path)
+ return imp.load_module(name, *module_info)
+
+
+class hooks(object):
+ """
+ Acts as a context manager. Saves the state of sys.modules and restores it
+ after the 'with' block.
+
+ Use like this:
+
+ >>> from future import standard_library
+ >>> with standard_library.hooks():
+ ... import http.client
+ >>> import requests
+
+ For this to work, http.client will be scrubbed from sys.modules after the
+ 'with' block. That way the modules imported in the 'with' block will
+ continue to be accessible in the current namespace but not from any
+ imported modules (like requests).
+ """
+ def __enter__(self):
+ # flog.debug('Entering hooks context manager')
+ self.old_sys_modules = copy.copy(sys.modules)
+ self.hooks_were_installed = detect_hooks()
+ # self.scrubbed = scrub_py2_sys_modules()
+ install_hooks()
+ return self
+
+ def __exit__(self, *args):
+ # flog.debug('Exiting hooks context manager')
+ # restore_sys_modules(self.scrubbed)
+ if not self.hooks_were_installed:
+ remove_hooks()
+ # scrub_future_sys_modules()
+
+# Sanity check for is_py2_stdlib_module(): We aren't replacing any
+# builtin modules names:
+if PY2:
+ assert len(set(RENAMES.values()) & set(sys.builtin_module_names)) == 0
+
+
+def is_py2_stdlib_module(m):
+ """
+ Tries to infer whether the module m is from the Python 2 standard library.
+ This may not be reliable on all systems.
+ """
+ if PY3:
+ return False
+ if not 'stdlib_path' in is_py2_stdlib_module.__dict__:
+ stdlib_files = [contextlib.__file__, os.__file__, copy.__file__]
+ stdlib_paths = [os.path.split(f)[0] for f in stdlib_files]
+ if not len(set(stdlib_paths)) == 1:
+ # This seems to happen on travis-ci.org. Very strange. We'll try to
+ # ignore it.
+ flog.warn('Multiple locations found for the Python standard '
+ 'library: %s' % stdlib_paths)
+ # Choose the first one arbitrarily
+ is_py2_stdlib_module.stdlib_path = stdlib_paths[0]
+
+ if m.__name__ in sys.builtin_module_names:
+ return True
+
+ if hasattr(m, '__file__'):
+ modpath = os.path.split(m.__file__)
+ if (modpath[0].startswith(is_py2_stdlib_module.stdlib_path) and
+ 'site-packages' not in modpath[0]):
+ return True
+
+ return False
+
+
+def scrub_py2_sys_modules():
+ """
+ Removes any Python 2 standard library modules from ``sys.modules`` that
+ would interfere with Py3-style imports using import hooks. Examples are
+ modules with the same names (like urllib or email).
+
+ (Note that currently import hooks are disabled for modules like these
+ with ambiguous names anyway ...)
+ """
+ if PY3:
+ return {}
+ scrubbed = {}
+ for modulename in REPLACED_MODULES & set(RENAMES.keys()):
+ if not modulename in sys.modules:
+ continue
+
+ module = sys.modules[modulename]
+
+ if is_py2_stdlib_module(module):
+ flog.debug('Deleting (Py2) {} from sys.modules'.format(modulename))
+ scrubbed[modulename] = sys.modules[modulename]
+ del sys.modules[modulename]
+ return scrubbed
+
+
+def scrub_future_sys_modules():
+ """
+ Deprecated.
+ """
+ return {}
+
+class suspend_hooks(object):
+ """
+ Acts as a context manager. Use like this:
+
+ >>> from future import standard_library
+ >>> standard_library.install_hooks()
+ >>> import http.client
+ >>> # ...
+ >>> with standard_library.suspend_hooks():
+ >>> import requests # incompatible with ``future``'s standard library hooks
+
+ If the hooks were disabled before the context, they are not installed when
+ the context is left.
+ """
+ def __enter__(self):
+ self.hooks_were_installed = detect_hooks()
+ remove_hooks()
+ # self.scrubbed = scrub_future_sys_modules()
+ return self
+
+ def __exit__(self, *args):
+ if self.hooks_were_installed:
+ install_hooks()
+ # restore_sys_modules(self.scrubbed)
+
+
+def restore_sys_modules(scrubbed):
+ """
+ Add any previously scrubbed modules back to the sys.modules cache,
+ but only if it's safe to do so.
+ """
+ clash = set(sys.modules) & set(scrubbed)
+ if len(clash) != 0:
+ # If several, choose one arbitrarily to raise an exception about
+ first = list(clash)[0]
+ raise ImportError('future module {} clashes with Py2 module'
+ .format(first))
+ sys.modules.update(scrubbed)
+
+
+def install_aliases():
+ """
+ Monkey-patches the standard library in Py2.6/7 to provide
+ aliases for better Py3 compatibility.
+ """
+ if PY3:
+ return
+ # if hasattr(install_aliases, 'run_already'):
+ # return
+ for (newmodname, newobjname, oldmodname, oldobjname) in MOVES:
+ __import__(newmodname)
+ # We look up the module in sys.modules because __import__ just returns the
+ # top-level package:
+ newmod = sys.modules[newmodname]
+ # newmod.__future_module__ = True
+
+ __import__(oldmodname)
+ oldmod = sys.modules[oldmodname]
+
+ obj = getattr(oldmod, oldobjname)
+ setattr(newmod, newobjname, obj)
+
+ # Hack for urllib so it appears to have the same structure on Py2 as on Py3
+ import urllib
+ from future.moves.urllib import request
+ from future.moves.urllib import response
+ from future.moves.urllib import parse
+ from future.moves.urllib import error
+ from future.moves.urllib import robotparser
+ urllib.request = request
+ urllib.response = response
+ urllib.parse = parse
+ urllib.error = error
+ urllib.robotparser = robotparser
+ sys.modules['urllib.request'] = request
+ sys.modules['urllib.response'] = response
+ sys.modules['urllib.parse'] = parse
+ sys.modules['urllib.error'] = error
+ sys.modules['urllib.robotparser'] = robotparser
+
+ # Patch the test module so it appears to have the same structure on Py2 as on Py3
+ try:
+ import test
+ except ImportError:
+ pass
+ try:
+ from future.moves.test import support
+ except ImportError:
+ pass
+ else:
+ test.support = support
+ sys.modules['test.support'] = support
+
+ # Patch the dbm module so it appears to have the same structure on Py2 as on Py3
+ try:
+ import dbm
+ except ImportError:
+ pass
+ else:
+ from future.moves.dbm import dumb
+ dbm.dumb = dumb
+ sys.modules['dbm.dumb'] = dumb
+ try:
+ from future.moves.dbm import gnu
+ except ImportError:
+ pass
+ else:
+ dbm.gnu = gnu
+ sys.modules['dbm.gnu'] = gnu
+ try:
+ from future.moves.dbm import ndbm
+ except ImportError:
+ pass
+ else:
+ dbm.ndbm = ndbm
+ sys.modules['dbm.ndbm'] = ndbm
+
+ # install_aliases.run_already = True
+
+
+def install_hooks():
+ """
+ This function installs the future.standard_library import hook into
+ sys.meta_path.
+ """
+ if PY3:
+ return
+
+ install_aliases()
+
+ flog.debug('sys.meta_path was: {0}'.format(sys.meta_path))
+ flog.debug('Installing hooks ...')
+
+ # Add it unless it's there already
+ newhook = RenameImport(RENAMES)
+ if not detect_hooks():
+ sys.meta_path.append(newhook)
+ flog.debug('sys.meta_path is now: {0}'.format(sys.meta_path))
+
+
+def enable_hooks():
+ """
+ Deprecated. Use install_hooks() instead. This will be removed by
+ ``future`` v1.0.
+ """
+ install_hooks()
+
+
+def remove_hooks(scrub_sys_modules=False):
+ """
+ This function removes the import hook from sys.meta_path.
+ """
+ if PY3:
+ return
+ flog.debug('Uninstalling hooks ...')
+ # Loop backwards, so deleting items keeps the ordering:
+ for i, hook in list(enumerate(sys.meta_path))[::-1]:
+ if hasattr(hook, 'RENAMER'):
+ del sys.meta_path[i]
+
+ # Explicit is better than implicit. In the future the interface should
+ # probably change so that scrubbing the import hooks requires a separate
+ # function call. Left as is for now for backward compatibility with
+ # v0.11.x.
+ if scrub_sys_modules:
+ scrub_future_sys_modules()
+
+
+def disable_hooks():
+ """
+ Deprecated. Use remove_hooks() instead. This will be removed by
+ ``future`` v1.0.
+ """
+ remove_hooks()
+
+
+def detect_hooks():
+ """
+ Returns True if the import hooks are installed, False if not.
+ """
+ flog.debug('Detecting hooks ...')
+ present = any([hasattr(hook, 'RENAMER') for hook in sys.meta_path])
+ if present:
+ flog.debug('Detected.')
+ else:
+ flog.debug('Not detected.')
+ return present
+
+
+# As of v0.12, this no longer happens implicitly:
+# if not PY3:
+# install_hooks()
+
+
+if not hasattr(sys, 'py2_modules'):
+ sys.py2_modules = {}
+
+def cache_py2_modules():
+ """
+ Currently this function is unneeded, as we are not attempting to provide import hooks
+ for modules with ambiguous names: email, urllib, pickle.
+ """
+ if len(sys.py2_modules) != 0:
+ return
+ assert not detect_hooks()
+ import urllib
+ sys.py2_modules['urllib'] = urllib
+
+ import email
+ sys.py2_modules['email'] = email
+
+ import pickle
+ sys.py2_modules['pickle'] = pickle
+
+ # Not all Python installations have test module. (Anaconda doesn't, for example.)
+ # try:
+ # import test
+ # except ImportError:
+ # sys.py2_modules['test'] = None
+ # sys.py2_modules['test'] = test
+
+ # import dbm
+ # sys.py2_modules['dbm'] = dbm
+
+
+def import_(module_name, backport=False):
+ """
+ Pass a (potentially dotted) module name of a Python 3 standard library
+ module. This function imports the module compatibly on Py2 and Py3 and
+ returns the top-level module.
+
+ Example use:
+ >>> http = import_('http.client')
+ >>> http = import_('http.server')
+ >>> urllib = import_('urllib.request')
+
+ Then:
+ >>> conn = http.client.HTTPConnection(...)
+ >>> response = urllib.request.urlopen('http://mywebsite.com')
+ >>> # etc.
+
+ Use as follows:
+ >>> package_name = import_(module_name)
+
+ On Py3, equivalent to this:
+
+ >>> import module_name
+
+ On Py2, equivalent to this if backport=False:
+
+ >>> from future.moves import module_name
+
+ or to this if backport=True:
+
+ >>> from future.backports import module_name
+
+ except that it also handles dotted module names such as ``http.client``
+ The effect then is like this:
+
+ >>> from future.backports import module
+ >>> from future.backports.module import submodule
+ >>> module.submodule = submodule
+
+ Note that this would be a SyntaxError in Python:
+
+ >>> from future.backports import http.client
+
+ """
+ # Python 2.6 doesn't have importlib in the stdlib, so it requires
+ # the backported ``importlib`` package from PyPI as a dependency to use
+ # this function:
+ import importlib
+
+ if PY3:
+ return __import__(module_name)
+ else:
+ # client.blah = blah
+ # Then http.client = client
+ # etc.
+ if backport:
+ prefix = 'future.backports'
+ else:
+ prefix = 'future.moves'
+ parts = prefix.split('.') + module_name.split('.')
+
+ modules = []
+ for i, part in enumerate(parts):
+ sofar = '.'.join(parts[:i+1])
+ modules.append(importlib.import_module(sofar))
+ for i, part in reversed(list(enumerate(parts))):
+ if i == 0:
+ break
+ setattr(modules[i-1], part, modules[i])
+
+ # Return the next-most top-level module after future.backports / future.moves:
+ return modules[2]
+
+
+def from_import(module_name, *symbol_names, **kwargs):
+ """
+ Example use:
+ >>> HTTPConnection = from_import('http.client', 'HTTPConnection')
+ >>> HTTPServer = from_import('http.server', 'HTTPServer')
+ >>> urlopen, urlparse = from_import('urllib.request', 'urlopen', 'urlparse')
+
+ Equivalent to this on Py3:
+
+ >>> from module_name import symbol_names[0], symbol_names[1], ...
+
+ and this on Py2:
+
+ >>> from future.moves.module_name import symbol_names[0], ...
+
+ or:
+
+ >>> from future.backports.module_name import symbol_names[0], ...
+
+ except that it also handles dotted module names such as ``http.client``.
+ """
+
+ if PY3:
+ return __import__(module_name)
+ else:
+ if 'backport' in kwargs and bool(kwargs['backport']):
+ prefix = 'future.backports'
+ else:
+ prefix = 'future.moves'
+ parts = prefix.split('.') + module_name.split('.')
+ module = importlib.import_module(prefix + '.' + module_name)
+ output = [getattr(module, name) for name in symbol_names]
+ if len(output) == 1:
+ return output[0]
+ else:
+ return output
+
+
+class exclude_local_folder_imports(object):
+ """
+ A context-manager that prevents standard library modules like configparser
+ from being imported from the local python-future source folder on Py3.
+
+ (The presence of a configparser folder would otherwise prevent setuptools
+ from running on Py3.)
+ """
+ def __init__(self, *args):
+ assert len(args) > 0
+ self.module_names = args
+ # Disallow dotted module names like http.client:
+ if any(['.' in m for m in self.module_names]):
+ raise NotImplementedError('Dotted module names are not supported')
+
+ def __enter__(self):
+ self.old_sys_path = copy.copy(sys.path)
+ self.old_sys_modules = copy.copy(sys.modules)
+ if sys.version_info[0] < 3:
+ return
+ FUTURE_SOURCE_SUBFOLDERS = ['future', 'past', 'libfuturize', 'configparser']
+
+ # Look for the future source folder:
+ for folder in self.old_sys_path:
+ if all([os.path.exists(os.path.join(folder, subfolder))
+ for subfolder in FUTURE_SOURCE_SUBFOLDERS]):
+ # Found it. Remove it.
+ sys.path.remove(folder)
+
+ # Ensure we import the system module:
+ for m in self.module_names:
+ # Delete the module and any submodules from sys.modules:
+ # for key in list(sys.modules):
+ # if key == m or key.startswith(m + '.'):
+ # try:
+ # del sys.modules[key]
+ # except KeyError:
+ # pass
+ try:
+ module = __import__(m, level=0)
+ except ImportError:
+ # There's a problem importing the system module. E.g. the
+ # winreg module is not available except on Windows.
+ pass
+
+ def __exit__(self, *args):
+ # Restore sys.path and sys.modules:
+ sys.path = self.old_sys_path
+ for m in set(self.old_sys_modules.keys()) - set(sys.modules.keys()):
+ sys.modules[m] = self.old_sys_modules[m]
+
+TOP_LEVEL_MODULES = ['builtins',
+ 'configparser',
+ 'copyreg',
+ 'html',
+ 'http',
+ 'queue',
+ 'reprlib',
+ 'socketserver',
+ 'test',
+ 'tkinter',
+ 'winreg',
+ 'xmlrpc',
+ '_dummy_thread',
+ '_markupbase',
+ '_thread',
+ ]
+
+def import_top_level_modules():
+ with exclude_local_folder_imports(*TOP_LEVEL_MODULES):
+ for m in TOP_LEVEL_MODULES:
+ try:
+ __import__(m)
+ except ImportError: # e.g. winreg
+ pass
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/tests/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/tests/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/tests/base.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/tests/base.py
new file mode 100644
index 0000000..f81c66d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/tests/base.py
@@ -0,0 +1,524 @@
+from __future__ import print_function
+import os
+import tempfile
+import unittest
+import sys
+import re
+import warnings
+import io
+import functools
+from textwrap import dedent
+
+from future.utils import bind_method, PY26, PY3, PY2
+from future.moves.subprocess import check_output, STDOUT, CalledProcessError
+
+if PY26:
+ import unittest2 as unittest
+
+
+def reformat_code(code):
+ """
+ Removes any leading \n and dedents.
+ """
+ if code.startswith('\n'):
+ code = code[1:]
+ return dedent(code)
+
+
+def order_future_lines(code):
+ """
+ Returns the code block with any ``__future__`` import lines sorted, and
+ then any ``future`` import lines sorted, then any ``builtins`` import lines
+ sorted.
+
+ This only sorts the lines within the expected blocks.
+
+ See test_order_future_lines() for an example.
+ """
+
+ # We need .splitlines(keepends=True), which doesn't exist on Py2,
+ # so we use this instead:
+ lines = code.split('\n')
+
+ uufuture_line_numbers = [i for i, line in enumerate(lines)
+ if line.startswith('from __future__ import ')]
+
+ future_line_numbers = [i for i, line in enumerate(lines)
+ if line.startswith('from future')
+ or line.startswith('from past')]
+
+ builtins_line_numbers = [i for i, line in enumerate(lines)
+ if line.startswith('from builtins')]
+
+ assert code.lstrip() == code, ('internal usage error: '
+ 'dedent the code before calling order_future_lines()')
+
+ def mymax(numbers):
+ return max(numbers) if len(numbers) > 0 else 0
+
+ def mymin(numbers):
+ return min(numbers) if len(numbers) > 0 else float('inf')
+
+ assert mymax(uufuture_line_numbers) <= mymin(future_line_numbers), \
+ 'the __future__ and future imports are out of order'
+
+ # assert mymax(future_line_numbers) <= mymin(builtins_line_numbers), \
+ # 'the future and builtins imports are out of order'
+
+ uul = sorted([lines[i] for i in uufuture_line_numbers])
+ sorted_uufuture_lines = dict(zip(uufuture_line_numbers, uul))
+
+ fl = sorted([lines[i] for i in future_line_numbers])
+ sorted_future_lines = dict(zip(future_line_numbers, fl))
+
+ bl = sorted([lines[i] for i in builtins_line_numbers])
+ sorted_builtins_lines = dict(zip(builtins_line_numbers, bl))
+
+ # Replace the old unsorted "from __future__ import ..." lines with the
+ # new sorted ones:
+ new_lines = []
+ for i in range(len(lines)):
+ if i in uufuture_line_numbers:
+ new_lines.append(sorted_uufuture_lines[i])
+ elif i in future_line_numbers:
+ new_lines.append(sorted_future_lines[i])
+ elif i in builtins_line_numbers:
+ new_lines.append(sorted_builtins_lines[i])
+ else:
+ new_lines.append(lines[i])
+ return '\n'.join(new_lines)
+
+
+class VerboseCalledProcessError(CalledProcessError):
+ """
+ Like CalledProcessError, but it displays more information (message and
+ script output) for diagnosing test failures etc.
+ """
+ def __init__(self, msg, returncode, cmd, output=None):
+ self.msg = msg
+ self.returncode = returncode
+ self.cmd = cmd
+ self.output = output
+
+ def __str__(self):
+ return ("Command '%s' failed with exit status %d\nMessage: %s\nOutput: %s"
+ % (self.cmd, self.returncode, self.msg, self.output))
+
+class FuturizeError(VerboseCalledProcessError):
+ pass
+
+class PasteurizeError(VerboseCalledProcessError):
+ pass
+
+
+class CodeHandler(unittest.TestCase):
+ """
+ Handy mixin for test classes for writing / reading / futurizing /
+ running .py files in the test suite.
+ """
+ def setUp(self):
+ """
+ The outputs from the various futurize stages should have the
+ following headers:
+ """
+ # After stage1:
+ # TODO: use this form after implementing a fixer to consolidate
+ # __future__ imports into a single line:
+ # self.headers1 = """
+ # from __future__ import absolute_import, division, print_function
+ # """
+ self.headers1 = reformat_code("""
+ from __future__ import absolute_import
+ from __future__ import division
+ from __future__ import print_function
+ """)
+
+ # After stage2 --all-imports:
+ # TODO: use this form after implementing a fixer to consolidate
+ # __future__ imports into a single line:
+ # self.headers2 = """
+ # from __future__ import (absolute_import, division,
+ # print_function, unicode_literals)
+ # from future import standard_library
+ # from future.builtins import *
+ # """
+ self.headers2 = reformat_code("""
+ from __future__ import absolute_import
+ from __future__ import division
+ from __future__ import print_function
+ from __future__ import unicode_literals
+ from future import standard_library
+ standard_library.install_aliases()
+ from builtins import *
+ """)
+ self.interpreters = [sys.executable]
+ self.tempdir = tempfile.mkdtemp() + os.path.sep
+ pypath = os.getenv('PYTHONPATH')
+ if pypath:
+ self.env = {'PYTHONPATH': os.getcwd() + os.pathsep + pypath}
+ else:
+ self.env = {'PYTHONPATH': os.getcwd()}
+
+ def convert(self, code, stages=(1, 2), all_imports=False, from3=False,
+ reformat=True, run=True, conservative=False):
+ """
+ Converts the code block using ``futurize`` and returns the
+ resulting code.
+
+ Passing stages=[1] or stages=[2] passes the flag ``--stage1`` or
+ ``stage2`` to ``futurize``. Passing both stages runs ``futurize``
+ with both stages by default.
+
+ If from3 is False, runs ``futurize``, converting from Python 2 to
+ both 2 and 3. If from3 is True, runs ``pasteurize`` to convert
+ from Python 3 to both 2 and 3.
+
+ Optionally reformats the code block first using the reformat() function.
+
+ If run is True, runs the resulting code under all Python
+ interpreters in self.interpreters.
+ """
+ if reformat:
+ code = reformat_code(code)
+ self._write_test_script(code)
+ self._futurize_test_script(stages=stages, all_imports=all_imports,
+ from3=from3, conservative=conservative)
+ output = self._read_test_script()
+ if run:
+ for interpreter in self.interpreters:
+ _ = self._run_test_script(interpreter=interpreter)
+ return output
+
+ def compare(self, output, expected, ignore_imports=True):
+ """
+ Compares whether the code blocks are equal. If not, raises an
+ exception so the test fails. Ignores any trailing whitespace like
+ blank lines.
+
+ If ignore_imports is True, passes the code blocks into the
+ strip_future_imports method.
+
+ If one code block is a unicode string and the other a
+ byte-string, it assumes the byte-string is encoded as utf-8.
+ """
+ if ignore_imports:
+ output = self.strip_future_imports(output)
+ expected = self.strip_future_imports(expected)
+ if isinstance(output, bytes) and not isinstance(expected, bytes):
+ output = output.decode('utf-8')
+ if isinstance(expected, bytes) and not isinstance(output, bytes):
+ expected = expected.decode('utf-8')
+ self.assertEqual(order_future_lines(output.rstrip()),
+ expected.rstrip())
+
+ def strip_future_imports(self, code):
+ """
+ Strips any of these import lines:
+
+ from __future__ import
+ from future
+ from future.
+ from builtins
+
+ or any line containing:
+ install_hooks()
+ or:
+ install_aliases()
+
+ Limitation: doesn't handle imports split across multiple lines like
+ this:
+
+ from __future__ import (absolute_import, division, print_function,
+ unicode_literals)
+ """
+ output = []
+ # We need .splitlines(keepends=True), which doesn't exist on Py2,
+ # so we use this instead:
+ for line in code.split('\n'):
+ if not (line.startswith('from __future__ import ')
+ or line.startswith('from future ')
+ or line.startswith('from builtins ')
+ or 'install_hooks()' in line
+ or 'install_aliases()' in line
+ # but don't match "from future_builtins" :)
+ or line.startswith('from future.')):
+ output.append(line)
+ return '\n'.join(output)
+
+ def convert_check(self, before, expected, stages=(1, 2), all_imports=False,
+ ignore_imports=True, from3=False, run=True,
+ conservative=False):
+ """
+ Convenience method that calls convert() and compare().
+
+ Reformats the code blocks automatically using the reformat_code()
+ function.
+
+ If all_imports is passed, we add the appropriate import headers
+ for the stage(s) selected to the ``expected`` code-block, so they
+ needn't appear repeatedly in the test code.
+
+ If ignore_imports is True, ignores the presence of any lines
+ beginning:
+
+ from __future__ import ...
+ from future import ...
+
+ for the purpose of the comparison.
+ """
+ output = self.convert(before, stages=stages, all_imports=all_imports,
+ from3=from3, run=run, conservative=conservative)
+ if all_imports:
+ headers = self.headers2 if 2 in stages else self.headers1
+ else:
+ headers = ''
+
+ self.compare(output, headers + reformat_code(expected),
+ ignore_imports=ignore_imports)
+
+ def unchanged(self, code, **kwargs):
+ """
+ Convenience method to ensure the code is unchanged by the
+ futurize process.
+ """
+ self.convert_check(code, code, **kwargs)
+
+ def _write_test_script(self, code, filename='mytestscript.py'):
+ """
+ Dedents the given code (a multiline string) and writes it out to
+ a file in a temporary folder like /tmp/tmpUDCn7x/mytestscript.py.
+ """
+ if isinstance(code, bytes):
+ code = code.decode('utf-8')
+ # Be explicit about encoding the temp file as UTF-8 (issue #63):
+ with io.open(self.tempdir + filename, 'wt', encoding='utf-8') as f:
+ f.write(dedent(code))
+
+ def _read_test_script(self, filename='mytestscript.py'):
+ with io.open(self.tempdir + filename, 'rt', encoding='utf-8') as f:
+ newsource = f.read()
+ return newsource
+
+ def _futurize_test_script(self, filename='mytestscript.py', stages=(1, 2),
+ all_imports=False, from3=False,
+ conservative=False):
+ params = []
+ stages = list(stages)
+ if all_imports:
+ params.append('--all-imports')
+ if from3:
+ script = 'pasteurize.py'
+ else:
+ script = 'futurize.py'
+ if stages == [1]:
+ params.append('--stage1')
+ elif stages == [2]:
+ params.append('--stage2')
+ else:
+ assert stages == [1, 2]
+ if conservative:
+ params.append('--conservative')
+ # No extra params needed
+
+ # Absolute file path:
+ fn = self.tempdir + filename
+ call_args = [sys.executable, script] + params + ['-w', fn]
+ try:
+ output = check_output(call_args, stderr=STDOUT, env=self.env)
+ except CalledProcessError as e:
+ with open(fn) as f:
+ msg = (
+ 'Error running the command %s\n'
+ '%s\n'
+ 'Contents of file %s:\n'
+ '\n'
+ '%s') % (
+ ' '.join(call_args),
+ 'env=%s' % self.env,
+ fn,
+ '----\n%s\n----' % f.read(),
+ )
+ ErrorClass = (FuturizeError if 'futurize' in script else PasteurizeError)
+ raise ErrorClass(msg, e.returncode, e.cmd, output=e.output)
+ return output
+
+ def _run_test_script(self, filename='mytestscript.py',
+ interpreter=sys.executable):
+ # Absolute file path:
+ fn = self.tempdir + filename
+ try:
+ output = check_output([interpreter, fn],
+ env=self.env, stderr=STDOUT)
+ except CalledProcessError as e:
+ with open(fn) as f:
+ msg = (
+ 'Error running the command %s\n'
+ '%s\n'
+ 'Contents of file %s:\n'
+ '\n'
+ '%s') % (
+ ' '.join([interpreter, fn]),
+ 'env=%s' % self.env,
+ fn,
+ '----\n%s\n----' % f.read(),
+ )
+ raise VerboseCalledProcessError(msg, e.returncode, e.cmd, output=e.output)
+ return output
+
+
+# Decorator to skip some tests on Python 2.6 ...
+skip26 = unittest.skipIf(PY26, "this test is known to fail on Py2.6")
+
+
+def expectedFailurePY3(func):
+ if not PY3:
+ return func
+ return unittest.expectedFailure(func)
+
+
+def expectedFailurePY26(func):
+ if not PY26:
+ return func
+ return unittest.expectedFailure(func)
+
+
+def expectedFailurePY2(func):
+ if not PY2:
+ return func
+ return unittest.expectedFailure(func)
+
+
+# Renamed in Py3.3:
+if not hasattr(unittest.TestCase, 'assertRaisesRegex'):
+ unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
+
+# From Py3.3:
+def assertRegex(self, text, expected_regex, msg=None):
+ """Fail the test unless the text matches the regular expression."""
+ if isinstance(expected_regex, (str, unicode)):
+ assert expected_regex, "expected_regex must not be empty."
+ expected_regex = re.compile(expected_regex)
+ if not expected_regex.search(text):
+ msg = msg or "Regex didn't match"
+ msg = '%s: %r not found in %r' % (msg, expected_regex.pattern, text)
+ raise self.failureException(msg)
+
+if not hasattr(unittest.TestCase, 'assertRegex'):
+ bind_method(unittest.TestCase, 'assertRegex', assertRegex)
+
+class _AssertRaisesBaseContext(object):
+
+ def __init__(self, expected, test_case, callable_obj=None,
+ expected_regex=None):
+ self.expected = expected
+ self.test_case = test_case
+ if callable_obj is not None:
+ try:
+ self.obj_name = callable_obj.__name__
+ except AttributeError:
+ self.obj_name = str(callable_obj)
+ else:
+ self.obj_name = None
+ if isinstance(expected_regex, (bytes, str)):
+ expected_regex = re.compile(expected_regex)
+ self.expected_regex = expected_regex
+ self.msg = None
+
+ def _raiseFailure(self, standardMsg):
+ msg = self.test_case._formatMessage(self.msg, standardMsg)
+ raise self.test_case.failureException(msg)
+
+ def handle(self, name, callable_obj, args, kwargs):
+ """
+ If callable_obj is None, assertRaises/Warns is being used as a
+ context manager, so check for a 'msg' kwarg and return self.
+ If callable_obj is not None, call it passing args and kwargs.
+ """
+ if callable_obj is None:
+ self.msg = kwargs.pop('msg', None)
+ return self
+ with self:
+ callable_obj(*args, **kwargs)
+
+class _AssertWarnsContext(_AssertRaisesBaseContext):
+ """A context manager used to implement TestCase.assertWarns* methods."""
+
+ def __enter__(self):
+ # The __warningregistry__'s need to be in a pristine state for tests
+ # to work properly.
+ for v in sys.modules.values():
+ if getattr(v, '__warningregistry__', None):
+ v.__warningregistry__ = {}
+ self.warnings_manager = warnings.catch_warnings(record=True)
+ self.warnings = self.warnings_manager.__enter__()
+ warnings.simplefilter("always", self.expected)
+ return self
+
+ def __exit__(self, exc_type, exc_value, tb):
+ self.warnings_manager.__exit__(exc_type, exc_value, tb)
+ if exc_type is not None:
+ # let unexpected exceptions pass through
+ return
+ try:
+ exc_name = self.expected.__name__
+ except AttributeError:
+ exc_name = str(self.expected)
+ first_matching = None
+ for m in self.warnings:
+ w = m.message
+ if not isinstance(w, self.expected):
+ continue
+ if first_matching is None:
+ first_matching = w
+ if (self.expected_regex is not None and
+ not self.expected_regex.search(str(w))):
+ continue
+ # store warning for later retrieval
+ self.warning = w
+ self.filename = m.filename
+ self.lineno = m.lineno
+ return
+ # Now we simply try to choose a helpful failure message
+ if first_matching is not None:
+ self._raiseFailure('"{}" does not match "{}"'.format(
+ self.expected_regex.pattern, str(first_matching)))
+ if self.obj_name:
+ self._raiseFailure("{} not triggered by {}".format(exc_name,
+ self.obj_name))
+ else:
+ self._raiseFailure("{} not triggered".format(exc_name))
+
+
+def assertWarns(self, expected_warning, callable_obj=None, *args, **kwargs):
+ """Fail unless a warning of class warnClass is triggered
+ by callable_obj when invoked with arguments args and keyword
+ arguments kwargs. If a different type of warning is
+ triggered, it will not be handled: depending on the other
+ warning filtering rules in effect, it might be silenced, printed
+ out, or raised as an exception.
+
+ If called with callable_obj omitted or None, will return a
+ context object used like this::
+
+ with self.assertWarns(SomeWarning):
+ do_something()
+
+ An optional keyword argument 'msg' can be provided when assertWarns
+ is used as a context object.
+
+ The context manager keeps a reference to the first matching
+ warning as the 'warning' attribute; similarly, the 'filename'
+ and 'lineno' attributes give you information about the line
+ of Python code from which the warning was triggered.
+ This allows you to inspect the warning after the assertion::
+
+ with self.assertWarns(SomeWarning) as cm:
+ do_something()
+ the_warning = cm.warning
+ self.assertEqual(the_warning.some_attribute, 147)
+ """
+ context = _AssertWarnsContext(expected_warning, self, callable_obj)
+ return context.handle('assertWarns', callable_obj, args, kwargs)
+
+if not hasattr(unittest.TestCase, 'assertWarns'):
+ bind_method(unittest.TestCase, 'assertWarns', assertWarns)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/__init__.py
new file mode 100644
index 0000000..71279bb
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/__init__.py
@@ -0,0 +1,258 @@
+"""
+This module contains backports the data types that were significantly changed
+in the transition from Python 2 to Python 3.
+
+- an implementation of Python 3's bytes object (pure Python subclass of
+ Python 2's builtin 8-bit str type)
+- an implementation of Python 3's str object (pure Python subclass of
+ Python 2's builtin unicode type)
+- a backport of the range iterator from Py3 with slicing support
+
+It is used as follows::
+
+ from __future__ import division, absolute_import, print_function
+ from builtins import bytes, dict, int, range, str
+
+to bring in the new semantics for these functions from Python 3. And
+then, for example::
+
+ b = bytes(b'ABCD')
+ assert list(b) == [65, 66, 67, 68]
+ assert repr(b) == "b'ABCD'"
+ assert [65, 66] in b
+
+ # These raise TypeErrors:
+ # b + u'EFGH'
+ # b.split(u'B')
+ # bytes(b',').join([u'Fred', u'Bill'])
+
+
+ s = str(u'ABCD')
+
+ # These raise TypeErrors:
+ # s.join([b'Fred', b'Bill'])
+ # s.startswith(b'A')
+ # b'B' in s
+ # s.find(b'A')
+ # s.replace(u'A', b'a')
+
+ # This raises an AttributeError:
+ # s.decode('utf-8')
+
+ assert repr(s) == 'ABCD' # consistent repr with Py3 (no u prefix)
+
+
+ for i in range(10**11)[:10]:
+ pass
+
+and::
+
+ class VerboseList(list):
+ def append(self, item):
+ print('Adding an item')
+ super().append(item) # new simpler super() function
+
+For more information:
+---------------------
+
+- future.types.newbytes
+- future.types.newdict
+- future.types.newint
+- future.types.newobject
+- future.types.newrange
+- future.types.newstr
+
+
+Notes
+=====
+
+range()
+-------
+``range`` is a custom class that backports the slicing behaviour from
+Python 3 (based on the ``xrange`` module by Dan Crosta). See the
+``newrange`` module docstring for more details.
+
+
+super()
+-------
+``super()`` is based on Ryan Kelly's ``magicsuper`` module. See the
+``newsuper`` module docstring for more details.
+
+
+round()
+-------
+Python 3 modifies the behaviour of ``round()`` to use "Banker's Rounding".
+See http://stackoverflow.com/a/10825998. See the ``newround`` module
+docstring for more details.
+
+"""
+
+from __future__ import absolute_import, division, print_function
+
+import functools
+from numbers import Integral
+
+from future import utils
+
+
+# Some utility functions to enforce strict type-separation of unicode str and
+# bytes:
+def disallow_types(argnums, disallowed_types):
+ """
+ A decorator that raises a TypeError if any of the given numbered
+ arguments is of the corresponding given type (e.g. bytes or unicode
+ string).
+
+ For example:
+
+ @disallow_types([0, 1], [unicode, bytes])
+ def f(a, b):
+ pass
+
+ raises a TypeError when f is called if a unicode object is passed as
+ `a` or a bytes object is passed as `b`.
+
+ This also skips over keyword arguments, so
+
+ @disallow_types([0, 1], [unicode, bytes])
+ def g(a, b=None):
+ pass
+
+ doesn't raise an exception if g is called with only one argument a,
+ e.g.:
+
+ g(b'Byte string')
+
+ Example use:
+
+ >>> class newbytes(object):
+ ... @disallow_types([1], [unicode])
+ ... def __add__(self, other):
+ ... pass
+
+ >>> newbytes('1234') + u'1234' #doctest: +IGNORE_EXCEPTION_DETAIL
+ Traceback (most recent call last):
+ ...
+ TypeError: can't concat 'bytes' to (unicode) str
+ """
+
+ def decorator(function):
+
+ @functools.wraps(function)
+ def wrapper(*args, **kwargs):
+ # These imports are just for this decorator, and are defined here
+ # to prevent circular imports:
+ from .newbytes import newbytes
+ from .newint import newint
+ from .newstr import newstr
+
+ errmsg = "argument can't be {0}"
+ for (argnum, mytype) in zip(argnums, disallowed_types):
+ # Handle the case where the type is passed as a string like 'newbytes'.
+ if isinstance(mytype, str) or isinstance(mytype, bytes):
+ mytype = locals()[mytype]
+
+ # Only restrict kw args only if they are passed:
+ if len(args) <= argnum:
+ break
+
+ # Here we use type() rather than isinstance() because
+ # __instancecheck__ is being overridden. E.g.
+ # isinstance(b'abc', newbytes) is True on Py2.
+ if type(args[argnum]) == mytype:
+ raise TypeError(errmsg.format(mytype))
+
+ return function(*args, **kwargs)
+ return wrapper
+ return decorator
+
+
+def no(mytype, argnums=(1,)):
+ """
+ A shortcut for the disallow_types decorator that disallows only one type
+ (in any position in argnums).
+
+ Example use:
+
+ >>> class newstr(object):
+ ... @no('bytes')
+ ... def __add__(self, other):
+ ... pass
+
+ >>> newstr(u'1234') + b'1234' #doctest: +IGNORE_EXCEPTION_DETAIL
+ Traceback (most recent call last):
+ ...
+ TypeError: argument can't be bytes
+
+ The object can also be passed directly, but passing the string helps
+ to prevent circular import problems.
+ """
+ if isinstance(argnums, Integral):
+ argnums = (argnums,)
+ disallowed_types = [mytype] * len(argnums)
+ return disallow_types(argnums, disallowed_types)
+
+
+def issubset(list1, list2):
+ """
+ Examples:
+
+ >>> issubset([], [65, 66, 67])
+ True
+ >>> issubset([65], [65, 66, 67])
+ True
+ >>> issubset([65, 66], [65, 66, 67])
+ True
+ >>> issubset([65, 67], [65, 66, 67])
+ False
+ """
+ n = len(list1)
+ for startpos in range(len(list2) - n + 1):
+ if list2[startpos:startpos+n] == list1:
+ return True
+ return False
+
+
+if utils.PY3:
+ import builtins
+ bytes = builtins.bytes
+ dict = builtins.dict
+ int = builtins.int
+ list = builtins.list
+ object = builtins.object
+ range = builtins.range
+ str = builtins.str
+
+ # The identity mapping
+ newtypes = {bytes: bytes,
+ dict: dict,
+ int: int,
+ list: list,
+ object: object,
+ range: range,
+ str: str}
+
+ __all__ = ['newtypes']
+
+else:
+
+ from .newbytes import newbytes
+ from .newdict import newdict
+ from .newint import newint
+ from .newlist import newlist
+ from .newrange import newrange
+ from .newobject import newobject
+ from .newstr import newstr
+
+ newtypes = {bytes: newbytes,
+ dict: newdict,
+ int: newint,
+ long: newint,
+ list: newlist,
+ object: newobject,
+ range: newrange,
+ str: newbytes,
+ unicode: newstr}
+
+ __all__ = ['newbytes', 'newdict', 'newint', 'newlist', 'newrange', 'newstr', 'newtypes']
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newbytes.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newbytes.py
new file mode 100644
index 0000000..2f96be6
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newbytes.py
@@ -0,0 +1,411 @@
+"""
+Pure-Python implementation of a Python 3-like bytes object for Python 2.
+
+Why do this? Without it, the Python 2 bytes object is a very, very
+different beast to the Python 3 bytes object.
+"""
+
+from collections import Iterable
+from numbers import Integral
+import string
+
+from future.utils import istext, isbytes, PY3, with_metaclass
+from future.types import no, issubset
+from future.types.newobject import newobject
+
+
+_builtin_bytes = bytes
+
+if PY3:
+ # We'll probably never use newstr on Py3 anyway...
+ unicode = str
+
+
+class BaseNewBytes(type):
+ def __instancecheck__(cls, instance):
+ if cls == newbytes:
+ return isinstance(instance, _builtin_bytes)
+ else:
+ return issubclass(instance.__class__, cls)
+
+
+class newbytes(with_metaclass(BaseNewBytes, _builtin_bytes)):
+ """
+ A backport of the Python 3 bytes object to Py2
+ """
+ def __new__(cls, *args, **kwargs):
+ """
+ From the Py3 bytes docstring:
+
+ bytes(iterable_of_ints) -> bytes
+ bytes(string, encoding[, errors]) -> bytes
+ bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer
+ bytes(int) -> bytes object of size given by the parameter initialized with null bytes
+ bytes() -> empty bytes object
+
+ Construct an immutable array of bytes from:
+ - an iterable yielding integers in range(256)
+ - a text string encoded using the specified encoding
+ - any object implementing the buffer API.
+ - an integer
+ """
+
+ encoding = None
+ errors = None
+
+ if len(args) == 0:
+ return super(newbytes, cls).__new__(cls)
+ elif len(args) >= 2:
+ args = list(args)
+ if len(args) == 3:
+ errors = args.pop()
+ encoding=args.pop()
+ # Was: elif isinstance(args[0], newbytes):
+ # We use type() instead of the above because we're redefining
+ # this to be True for all unicode string subclasses. Warning:
+ # This may render newstr un-subclassable.
+ if type(args[0]) == newbytes:
+ # Special-case: for consistency with Py3.3, we return the same object
+ # (with the same id) if a newbytes object is passed into the
+ # newbytes constructor.
+ return args[0]
+ elif isinstance(args[0], _builtin_bytes):
+ value = args[0]
+ elif isinstance(args[0], unicode):
+ try:
+ if 'encoding' in kwargs:
+ assert encoding is None
+ encoding = kwargs['encoding']
+ if 'errors' in kwargs:
+ assert errors is None
+ errors = kwargs['errors']
+ except AssertionError:
+ raise TypeError('Argument given by name and position')
+ if encoding is None:
+ raise TypeError('unicode string argument without an encoding')
+ ###
+ # Was: value = args[0].encode(**kwargs)
+ # Python 2.6 string encode() method doesn't take kwargs:
+ # Use this instead:
+ newargs = [encoding]
+ if errors is not None:
+ newargs.append(errors)
+ value = args[0].encode(*newargs)
+ ###
+ elif isinstance(args[0], Iterable):
+ if len(args[0]) == 0:
+ # This could be an empty list or tuple. Return b'' as on Py3.
+ value = b''
+ else:
+ # Was: elif len(args[0])>0 and isinstance(args[0][0], Integral):
+ # # It's a list of integers
+ # But then we can't index into e.g. frozensets. Try to proceed
+ # anyway.
+ try:
+ values = [chr(x) for x in args[0]]
+ value = b''.join(values)
+ except:
+ raise ValueError('bytes must be in range(0, 256)')
+ elif isinstance(args[0], Integral):
+ if args[0] < 0:
+ raise ValueError('negative count')
+ value = b'\x00' * args[0]
+ else:
+ value = args[0]
+ return super(newbytes, cls).__new__(cls, value)
+
+ def __repr__(self):
+ return 'b' + super(newbytes, self).__repr__()
+
+ def __str__(self):
+ return 'b' + "'{0}'".format(super(newbytes, self).__str__())
+
+ def __getitem__(self, y):
+ value = super(newbytes, self).__getitem__(y)
+ if isinstance(y, Integral):
+ return ord(value)
+ else:
+ return newbytes(value)
+
+ def __getslice__(self, *args):
+ return self.__getitem__(slice(*args))
+
+ def __contains__(self, key):
+ if isinstance(key, int):
+ newbyteskey = newbytes([key])
+ # Don't use isinstance() here because we only want to catch
+ # newbytes, not Python 2 str:
+ elif type(key) == newbytes:
+ newbyteskey = key
+ else:
+ newbyteskey = newbytes(key)
+ return issubset(list(newbyteskey), list(self))
+
+ @no(unicode)
+ def __add__(self, other):
+ return newbytes(super(newbytes, self).__add__(other))
+
+ @no(unicode)
+ def __radd__(self, left):
+ return newbytes(left) + self
+
+ @no(unicode)
+ def __mul__(self, other):
+ return newbytes(super(newbytes, self).__mul__(other))
+
+ @no(unicode)
+ def __rmul__(self, other):
+ return newbytes(super(newbytes, self).__rmul__(other))
+
+ def join(self, iterable_of_bytes):
+ errmsg = 'sequence item {0}: expected bytes, {1} found'
+ if isbytes(iterable_of_bytes) or istext(iterable_of_bytes):
+ raise TypeError(errmsg.format(0, type(iterable_of_bytes)))
+ for i, item in enumerate(iterable_of_bytes):
+ if istext(item):
+ raise TypeError(errmsg.format(i, type(item)))
+ return newbytes(super(newbytes, self).join(iterable_of_bytes))
+
+ @classmethod
+ def fromhex(cls, string):
+ # Only on Py2:
+ return cls(string.replace(' ', '').decode('hex'))
+
+ @no(unicode)
+ def find(self, sub, *args):
+ return super(newbytes, self).find(sub, *args)
+
+ @no(unicode)
+ def rfind(self, sub, *args):
+ return super(newbytes, self).rfind(sub, *args)
+
+ @no(unicode, (1, 2))
+ def replace(self, old, new, *args):
+ return newbytes(super(newbytes, self).replace(old, new, *args))
+
+ def encode(self, *args):
+ raise AttributeError("encode method has been disabled in newbytes")
+
+ def decode(self, encoding='utf-8', errors='strict'):
+ """
+ Returns a newstr (i.e. unicode subclass)
+
+ Decode B using the codec registered for encoding. Default encoding
+ is 'utf-8'. errors may be given to set a different error
+ handling scheme. Default is 'strict' meaning that encoding errors raise
+ a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'
+ as well as any other name registered with codecs.register_error that is
+ able to handle UnicodeDecodeErrors.
+ """
+ # Py2 str.encode() takes encoding and errors as optional parameter,
+ # not keyword arguments as in Python 3 str.
+
+ from future.types.newstr import newstr
+ return newstr(super(newbytes, self).decode(encoding, errors))
+
+ # This is currently broken:
+ # # We implement surrogateescape error handling here in addition rather
+ # # than relying on the custom error handler from
+ # # future.utils.surrogateescape to be registered globally, even though
+ # # that is fine in the case of decoding. (But not encoding: see the
+ # # comments in newstr.encode()``.)
+ #
+ # if errors == 'surrogateescape':
+ # # Decode char by char
+ # mybytes = []
+ # for code in self:
+ # # Code is an int
+ # if 0x80 <= code <= 0xFF:
+ # b = 0xDC00 + code
+ # elif code <= 0x7F:
+ # b = _unichr(c).decode(encoding=encoding)
+ # else:
+ # # # It may be a bad byte
+ # # FIXME: What to do in this case? See the Py3 docs / tests.
+ # # # Try swallowing it.
+ # # continue
+ # # print("RAISE!")
+ # raise NotASurrogateError
+ # mybytes.append(b)
+ # return newbytes(mybytes)
+ # return newbytes(super(newstr, self).decode(encoding, errors))
+
+ @no(unicode)
+ def startswith(self, prefix, *args):
+ return super(newbytes, self).startswith(prefix, *args)
+
+ @no(unicode)
+ def endswith(self, prefix, *args):
+ return super(newbytes, self).endswith(prefix, *args)
+
+ @no(unicode)
+ def split(self, sep=None, maxsplit=-1):
+ # Py2 str.split() takes maxsplit as an optional parameter, not as a
+ # keyword argument as in Python 3 bytes.
+ parts = super(newbytes, self).split(sep, maxsplit)
+ return [newbytes(part) for part in parts]
+
+ def splitlines(self, keepends=False):
+ """
+ B.splitlines([keepends]) -> list of lines
+
+ Return a list of the lines in B, breaking at line boundaries.
+ Line breaks are not included in the resulting list unless keepends
+ is given and true.
+ """
+ # Py2 str.splitlines() takes keepends as an optional parameter,
+ # not as a keyword argument as in Python 3 bytes.
+ parts = super(newbytes, self).splitlines(keepends)
+ return [newbytes(part) for part in parts]
+
+ @no(unicode)
+ def rsplit(self, sep=None, maxsplit=-1):
+ # Py2 str.rsplit() takes maxsplit as an optional parameter, not as a
+ # keyword argument as in Python 3 bytes.
+ parts = super(newbytes, self).rsplit(sep, maxsplit)
+ return [newbytes(part) for part in parts]
+
+ @no(unicode)
+ def partition(self, sep):
+ parts = super(newbytes, self).partition(sep)
+ return tuple(newbytes(part) for part in parts)
+
+ @no(unicode)
+ def rpartition(self, sep):
+ parts = super(newbytes, self).rpartition(sep)
+ return tuple(newbytes(part) for part in parts)
+
+ @no(unicode, (1,))
+ def rindex(self, sub, *args):
+ '''
+ S.rindex(sub [,start [,end]]) -> int
+
+ Like S.rfind() but raise ValueError when the substring is not found.
+ '''
+ pos = self.rfind(sub, *args)
+ if pos == -1:
+ raise ValueError('substring not found')
+
+ @no(unicode)
+ def index(self, sub, *args):
+ '''
+ Returns index of sub in bytes.
+ Raises ValueError if byte is not in bytes and TypeError if can't
+ be converted bytes or its length is not 1.
+ '''
+ if isinstance(sub, int):
+ if len(args) == 0:
+ start, end = 0, len(self)
+ elif len(args) == 1:
+ start = args[0]
+ elif len(args) == 2:
+ start, end = args
+ else:
+ raise TypeError('takes at most 3 arguments')
+ return list(self)[start:end].index(sub)
+ if not isinstance(sub, bytes):
+ try:
+ sub = self.__class__(sub)
+ except (TypeError, ValueError):
+ raise TypeError("can't convert sub to bytes")
+ try:
+ return super(newbytes, self).index(sub, *args)
+ except ValueError:
+ raise ValueError('substring not found')
+
+ def __eq__(self, other):
+ if isinstance(other, (_builtin_bytes, bytearray)):
+ return super(newbytes, self).__eq__(other)
+ else:
+ return False
+
+ def __ne__(self, other):
+ if isinstance(other, _builtin_bytes):
+ return super(newbytes, self).__ne__(other)
+ else:
+ return True
+
+ unorderable_err = 'unorderable types: bytes() and {0}'
+
+ def __lt__(self, other):
+ if not isbytes(other):
+ raise TypeError(self.unorderable_err.format(type(other)))
+ return super(newbytes, self).__lt__(other)
+
+ def __le__(self, other):
+ if not isbytes(other):
+ raise TypeError(self.unorderable_err.format(type(other)))
+ return super(newbytes, self).__le__(other)
+
+ def __gt__(self, other):
+ if not isbytes(other):
+ raise TypeError(self.unorderable_err.format(type(other)))
+ return super(newbytes, self).__gt__(other)
+
+ def __ge__(self, other):
+ if not isbytes(other):
+ raise TypeError(self.unorderable_err.format(type(other)))
+ return super(newbytes, self).__ge__(other)
+
+ def __native__(self):
+ # We can't just feed a newbytes object into str(), because
+ # newbytes.__str__() returns e.g. "b'blah'", consistent with Py3 bytes.
+ return super(newbytes, self).__str__()
+
+ def __getattribute__(self, name):
+ """
+ A trick to cause the ``hasattr`` builtin-fn to return False for
+ the 'encode' method on Py2.
+ """
+ if name in ['encode', u'encode']:
+ raise AttributeError("encode method has been disabled in newbytes")
+ return super(newbytes, self).__getattribute__(name)
+
+ @no(unicode)
+ def rstrip(self, bytes_to_strip=None):
+ """
+ Strip trailing bytes contained in the argument.
+ If the argument is omitted, strip trailing ASCII whitespace.
+ """
+ return newbytes(super(newbytes, self).rstrip(bytes_to_strip))
+
+ @no(unicode)
+ def strip(self, bytes_to_strip=None):
+ """
+ Strip leading and trailing bytes contained in the argument.
+ If the argument is omitted, strip trailing ASCII whitespace.
+ """
+ return newbytes(super(newbytes, self).strip(bytes_to_strip))
+
+ def lower(self):
+ """
+ b.lower() -> copy of b
+
+ Return a copy of b with all ASCII characters converted to lowercase.
+ """
+ return newbytes(super(newbytes, self).lower())
+
+ @no(unicode)
+ def upper(self):
+ """
+ b.upper() -> copy of b
+
+ Return a copy of b with all ASCII characters converted to uppercase.
+ """
+ return newbytes(super(newbytes, self).upper())
+
+ @classmethod
+ @no(unicode)
+ def maketrans(cls, frm, to):
+ """
+ B.maketrans(frm, to) -> translation table
+
+ Return a translation table (a bytes object of length 256) suitable
+ for use in the bytes or bytearray translate method where each byte
+ in frm is mapped to the byte at the same position in to.
+ The bytes objects frm and to must be of the same length.
+ """
+ return newbytes(string.maketrans(frm, to))
+
+
+__all__ = ['newbytes']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newdict.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newdict.py
new file mode 100644
index 0000000..5dbcc4b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newdict.py
@@ -0,0 +1,111 @@
+"""
+A dict subclass for Python 2 that behaves like Python 3's dict
+
+Example use:
+
+>>> from builtins import dict
+>>> d1 = dict() # instead of {} for an empty dict
+>>> d2 = dict(key1='value1', key2='value2')
+
+The keys, values and items methods now return iterators on Python 2.x
+(with set-like behaviour on Python 2.7).
+
+>>> for d in (d1, d2):
+... assert not isinstance(d.keys(), list)
+... assert not isinstance(d.values(), list)
+... assert not isinstance(d.items(), list)
+"""
+
+import sys
+
+from future.utils import with_metaclass
+from future.types.newobject import newobject
+
+
+_builtin_dict = dict
+ver = sys.version_info[:2]
+
+
+class BaseNewDict(type):
+ def __instancecheck__(cls, instance):
+ if cls == newdict:
+ return isinstance(instance, _builtin_dict)
+ else:
+ return issubclass(instance.__class__, cls)
+
+
+class newdict(with_metaclass(BaseNewDict, _builtin_dict)):
+ """
+ A backport of the Python 3 dict object to Py2
+ """
+ def items(self):
+ """
+ On Python 2.7+:
+ D.items() -> a set-like object providing a view on D's items
+ On Python 2.6:
+ D.items() -> an iterator over D's items
+ """
+ if ver == (2, 7):
+ return self.viewitems()
+ elif ver == (2, 6):
+ return self.iteritems()
+ elif ver >= (3, 0):
+ return self.items()
+
+ def keys(self):
+ """
+ On Python 2.7+:
+ D.keys() -> a set-like object providing a view on D's keys
+ On Python 2.6:
+ D.keys() -> an iterator over D's keys
+ """
+ if ver == (2, 7):
+ return self.viewkeys()
+ elif ver == (2, 6):
+ return self.iterkeys()
+ elif ver >= (3, 0):
+ return self.keys()
+
+ def values(self):
+ """
+ On Python 2.7+:
+ D.values() -> a set-like object providing a view on D's values
+ On Python 2.6:
+ D.values() -> an iterator over D's values
+ """
+ if ver == (2, 7):
+ return self.viewvalues()
+ elif ver == (2, 6):
+ return self.itervalues()
+ elif ver >= (3, 0):
+ return self.values()
+
+ def __new__(cls, *args, **kwargs):
+ """
+ dict() -> new empty dictionary
+ dict(mapping) -> new dictionary initialized from a mapping object's
+ (key, value) pairs
+ dict(iterable) -> new dictionary initialized as if via:
+ d = {}
+ for k, v in iterable:
+ d[k] = v
+ dict(**kwargs) -> new dictionary initialized with the name=value pairs
+ in the keyword argument list. For example: dict(one=1, two=2)
+ """
+
+ if len(args) == 0:
+ return super(newdict, cls).__new__(cls)
+ elif type(args[0]) == newdict:
+ value = args[0]
+ else:
+ value = args[0]
+ return super(newdict, cls).__new__(cls, value)
+
+ def __native__(self):
+ """
+ Hook for the future.utils.native() function
+ """
+ return dict(self)
+
+
+__all__ = ['newdict']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newint.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newint.py
new file mode 100644
index 0000000..1917b87
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newint.py
@@ -0,0 +1,373 @@
+"""
+Backport of Python 3's int, based on Py2's long.
+
+They are very similar. The most notable difference is:
+
+- representation: trailing L in Python 2 removed in Python 3
+"""
+from __future__ import division
+
+import struct
+import collections
+
+from future.types.newbytes import newbytes
+from future.types.newobject import newobject
+from future.utils import PY3, isint, istext, isbytes, with_metaclass, native
+
+
+if PY3:
+ long = int
+
+
+class BaseNewInt(type):
+ def __instancecheck__(cls, instance):
+ if cls == newint:
+ # Special case for Py2 short or long int
+ return isinstance(instance, (int, long))
+ else:
+ return issubclass(instance.__class__, cls)
+
+
+class newint(with_metaclass(BaseNewInt, long)):
+ """
+ A backport of the Python 3 int object to Py2
+ """
+ def __new__(cls, x=0, base=10):
+ """
+ From the Py3 int docstring:
+
+ | int(x=0) -> integer
+ | int(x, base=10) -> integer
+ |
+ | Convert a number or string to an integer, or return 0 if no
+ | arguments are given. If x is a number, return x.__int__(). For
+ | floating point numbers, this truncates towards zero.
+ |
+ | If x is not a number or if base is given, then x must be a string,
+ | bytes, or bytearray instance representing an integer literal in the
+ | given base. The literal can be preceded by '+' or '-' and be
+ | surrounded by whitespace. The base defaults to 10. Valid bases are
+ | 0 and 2-36. Base 0 means to interpret the base from the string as an
+ | integer literal.
+ | >>> int('0b100', base=0)
+ | 4
+
+ """
+ try:
+ val = x.__int__()
+ except AttributeError:
+ val = x
+ else:
+ if not isint(val):
+ raise TypeError('__int__ returned non-int ({0})'.format(
+ type(val)))
+
+ if base != 10:
+ # Explicit base
+ if not (istext(val) or isbytes(val) or isinstance(val, bytearray)):
+ raise TypeError(
+ "int() can't convert non-string with explicit base")
+ try:
+ return super(newint, cls).__new__(cls, val, base)
+ except TypeError:
+ return super(newint, cls).__new__(cls, newbytes(val), base)
+ # After here, base is 10
+ try:
+ return super(newint, cls).__new__(cls, val)
+ except TypeError:
+ # Py2 long doesn't handle bytearray input with an explicit base, so
+ # handle this here.
+ # Py3: int(bytearray(b'10'), 2) == 2
+ # Py2: int(bytearray(b'10'), 2) == 2 raises TypeError
+ # Py2: long(bytearray(b'10'), 2) == 2 raises TypeError
+ try:
+ return super(newint, cls).__new__(cls, newbytes(val))
+ except:
+ raise TypeError("newint argument must be a string or a number,"
+ "not '{0}'".format(type(val)))
+
+ def __repr__(self):
+ """
+ Without the L suffix
+ """
+ value = super(newint, self).__repr__()
+ assert value[-1] == 'L'
+ return value[:-1]
+
+ def __add__(self, other):
+ value = super(newint, self).__add__(other)
+ if value is NotImplemented:
+ return long(self) + other
+ return newint(value)
+
+ def __radd__(self, other):
+ value = super(newint, self).__radd__(other)
+ if value is NotImplemented:
+ return other + long(self)
+ return newint(value)
+
+ def __sub__(self, other):
+ value = super(newint, self).__sub__(other)
+ if value is NotImplemented:
+ return long(self) - other
+ return newint(value)
+
+ def __rsub__(self, other):
+ value = super(newint, self).__rsub__(other)
+ if value is NotImplemented:
+ return other - long(self)
+ return newint(value)
+
+ def __mul__(self, other):
+ value = super(newint, self).__mul__(other)
+ if isint(value):
+ return newint(value)
+ elif value is NotImplemented:
+ return long(self) * other
+ return value
+
+ def __rmul__(self, other):
+ value = super(newint, self).__rmul__(other)
+ if isint(value):
+ return newint(value)
+ elif value is NotImplemented:
+ return other * long(self)
+ return value
+
+ def __div__(self, other):
+ # We override this rather than e.g. relying on object.__div__ or
+ # long.__div__ because we want to wrap the value in a newint()
+ # call if other is another int
+ value = long(self) / other
+ if isinstance(other, (int, long)):
+ return newint(value)
+ else:
+ return value
+
+ def __rdiv__(self, other):
+ value = other / long(self)
+ if isinstance(other, (int, long)):
+ return newint(value)
+ else:
+ return value
+
+ def __idiv__(self, other):
+ # long has no __idiv__ method. Use __itruediv__ and cast back to
+ # newint:
+ value = self.__itruediv__(other)
+ if isinstance(other, (int, long)):
+ return newint(value)
+ else:
+ return value
+
+ def __truediv__(self, other):
+ value = super(newint, self).__truediv__(other)
+ if value is NotImplemented:
+ value = long(self) / other
+ return value
+
+ def __rtruediv__(self, other):
+ return super(newint, self).__rtruediv__(other)
+
+ def __itruediv__(self, other):
+ # long has no __itruediv__ method
+ mylong = long(self)
+ mylong /= other
+ return mylong
+
+ def __floordiv__(self, other):
+ return newint(super(newint, self).__floordiv__(other))
+
+ def __rfloordiv__(self, other):
+ return newint(super(newint, self).__rfloordiv__(other))
+
+ def __ifloordiv__(self, other):
+ # long has no __ifloordiv__ method
+ mylong = long(self)
+ mylong //= other
+ return newint(mylong)
+
+ def __mod__(self, other):
+ value = super(newint, self).__mod__(other)
+ if value is NotImplemented:
+ return long(self) % other
+ return newint(value)
+
+ def __rmod__(self, other):
+ value = super(newint, self).__rmod__(other)
+ if value is NotImplemented:
+ return other % long(self)
+ return newint(value)
+
+ def __divmod__(self, other):
+ value = super(newint, self).__divmod__(other)
+ return (newint(value[0]), newint(value[1]))
+
+ def __rdivmod__(self, other):
+ value = super(newint, self).__rdivmod__(other)
+ return (newint(value[0]), newint(value[1]))
+
+ def __pow__(self, other):
+ value = super(newint, self).__pow__(other)
+ if value is NotImplemented:
+ return long(self) ** other
+ return newint(value)
+
+ def __rpow__(self, other):
+ value = super(newint, self).__rpow__(other)
+ if value is NotImplemented:
+ return other ** long(self)
+ return newint(value)
+
+ def __lshift__(self, other):
+ if not isint(other):
+ raise TypeError(
+ "unsupported operand type(s) for <<: '%s' and '%s'" %
+ (type(self).__name__, type(other).__name__))
+ return newint(super(newint, self).__lshift__(other))
+
+ def __rshift__(self, other):
+ if not isint(other):
+ raise TypeError(
+ "unsupported operand type(s) for >>: '%s' and '%s'" %
+ (type(self).__name__, type(other).__name__))
+ return newint(super(newint, self).__rshift__(other))
+
+ def __and__(self, other):
+ if not isint(other):
+ raise TypeError(
+ "unsupported operand type(s) for &: '%s' and '%s'" %
+ (type(self).__name__, type(other).__name__))
+ return newint(super(newint, self).__and__(other))
+
+ def __or__(self, other):
+ if not isint(other):
+ raise TypeError(
+ "unsupported operand type(s) for |: '%s' and '%s'" %
+ (type(self).__name__, type(other).__name__))
+ return newint(super(newint, self).__or__(other))
+
+ def __xor__(self, other):
+ if not isint(other):
+ raise TypeError(
+ "unsupported operand type(s) for ^: '%s' and '%s'" %
+ (type(self).__name__, type(other).__name__))
+ return newint(super(newint, self).__xor__(other))
+
+ def __neg__(self):
+ return newint(super(newint, self).__neg__())
+
+ def __pos__(self):
+ return newint(super(newint, self).__pos__())
+
+ def __abs__(self):
+ return newint(super(newint, self).__abs__())
+
+ def __invert__(self):
+ return newint(super(newint, self).__invert__())
+
+ def __int__(self):
+ return self
+
+ def __nonzero__(self):
+ return self.__bool__()
+
+ def __bool__(self):
+ """
+ So subclasses can override this, Py3-style
+ """
+ return super(newint, self).__nonzero__()
+
+ def __native__(self):
+ return long(self)
+
+ def to_bytes(self, length, byteorder='big', signed=False):
+ """
+ Return an array of bytes representing an integer.
+
+ The integer is represented using length bytes. An OverflowError is
+ raised if the integer is not representable with the given number of
+ bytes.
+
+ The byteorder argument determines the byte order used to represent the
+ integer. If byteorder is 'big', the most significant byte is at the
+ beginning of the byte array. If byteorder is 'little', the most
+ significant byte is at the end of the byte array. To request the native
+ byte order of the host system, use `sys.byteorder' as the byte order value.
+
+ The signed keyword-only argument determines whether two's complement is
+ used to represent the integer. If signed is False and a negative integer
+ is given, an OverflowError is raised.
+ """
+ if length < 0:
+ raise ValueError("length argument must be non-negative")
+ if length == 0 and self == 0:
+ return newbytes()
+ if signed and self < 0:
+ bits = length * 8
+ num = (2**bits) + self
+ if num <= 0:
+ raise OverflowError("int too smal to convert")
+ else:
+ if self < 0:
+ raise OverflowError("can't convert negative int to unsigned")
+ num = self
+ if byteorder not in ('little', 'big'):
+ raise ValueError("byteorder must be either 'little' or 'big'")
+ h = b'%x' % num
+ s = newbytes((b'0'*(len(h) % 2) + h).zfill(length*2).decode('hex'))
+ if signed:
+ high_set = s[0] & 0x80
+ if self > 0 and high_set:
+ raise OverflowError("int too big to convert")
+ if self < 0 and not high_set:
+ raise OverflowError("int too small to convert")
+ if len(s) > length:
+ raise OverflowError("int too big to convert")
+ return s if byteorder == 'big' else s[::-1]
+
+ @classmethod
+ def from_bytes(cls, mybytes, byteorder='big', signed=False):
+ """
+ Return the integer represented by the given array of bytes.
+
+ The mybytes argument must either support the buffer protocol or be an
+ iterable object producing bytes. Bytes and bytearray are examples of
+ built-in objects that support the buffer protocol.
+
+ The byteorder argument determines the byte order used to represent the
+ integer. If byteorder is 'big', the most significant byte is at the
+ beginning of the byte array. If byteorder is 'little', the most
+ significant byte is at the end of the byte array. To request the native
+ byte order of the host system, use `sys.byteorder' as the byte order value.
+
+ The signed keyword-only argument indicates whether two's complement is
+ used to represent the integer.
+ """
+ if byteorder not in ('little', 'big'):
+ raise ValueError("byteorder must be either 'little' or 'big'")
+ if isinstance(mybytes, unicode):
+ raise TypeError("cannot convert unicode objects to bytes")
+ # mybytes can also be passed as a sequence of integers on Py3.
+ # Test for this:
+ elif isinstance(mybytes, collections.Iterable):
+ mybytes = newbytes(mybytes)
+ b = mybytes if byteorder == 'big' else mybytes[::-1]
+ if len(b) == 0:
+ b = b'\x00'
+ # The encode() method has been disabled by newbytes, but Py2's
+ # str has it:
+ num = int(native(b).encode('hex'), 16)
+ if signed and (b[0] & 0x80):
+ num = num - (2 ** (len(b)*8))
+ return cls(num)
+
+
+# def _twos_comp(val, bits):
+# """compute the 2's compliment of int value val"""
+# if( (val&(1<<(bits-1))) != 0 ):
+# val = val - (1<>> from builtins import list
+>>> l1 = list() # instead of {} for an empty list
+>>> l1.append('hello')
+>>> l2 = l1.copy()
+
+"""
+
+import sys
+import copy
+
+from future.utils import with_metaclass
+from future.types.newobject import newobject
+
+
+_builtin_list = list
+ver = sys.version_info[:2]
+
+
+class BaseNewList(type):
+ def __instancecheck__(cls, instance):
+ if cls == newlist:
+ return isinstance(instance, _builtin_list)
+ else:
+ return issubclass(instance.__class__, cls)
+
+
+class newlist(with_metaclass(BaseNewList, _builtin_list)):
+ """
+ A backport of the Python 3 list object to Py2
+ """
+ def copy(self):
+ """
+ L.copy() -> list -- a shallow copy of L
+ """
+ return copy.copy(self)
+
+ def clear(self):
+ """L.clear() -> None -- remove all items from L"""
+ for i in range(len(self)):
+ self.pop()
+
+ def __new__(cls, *args, **kwargs):
+ """
+ list() -> new empty list
+ list(iterable) -> new list initialized from iterable's items
+ """
+
+ if len(args) == 0:
+ return super(newlist, cls).__new__(cls)
+ elif type(args[0]) == newlist:
+ value = args[0]
+ else:
+ value = args[0]
+ return super(newlist, cls).__new__(cls, value)
+
+ def __add__(self, value):
+ return newlist(super(newlist, self).__add__(value))
+
+ def __radd__(self, left):
+ " left + self "
+ try:
+ return newlist(left) + self
+ except:
+ return NotImplemented
+
+ def __getitem__(self, y):
+ """
+ x.__getitem__(y) <==> x[y]
+
+ Warning: a bug in Python 2.x prevents indexing via a slice from
+ returning a newlist object.
+ """
+ if isinstance(y, slice):
+ return newlist(super(newlist, self).__getitem__(y))
+ else:
+ return super(newlist, self).__getitem__(y)
+
+ def __native__(self):
+ """
+ Hook for the future.utils.native() function
+ """
+ return list(self)
+
+ def __nonzero__(self):
+ return len(self) > 0
+
+
+__all__ = ['newlist']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newmemoryview.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newmemoryview.py
new file mode 100644
index 0000000..72c6990
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newmemoryview.py
@@ -0,0 +1,27 @@
+"""
+A pretty lame implementation of a memoryview object for Python 2.6.
+"""
+
+from collections import Iterable
+from numbers import Integral
+import string
+
+from future.utils import istext, isbytes, PY3, with_metaclass
+from future.types import no, issubset
+
+
+# class BaseNewBytes(type):
+# def __instancecheck__(cls, instance):
+# return isinstance(instance, _builtin_bytes)
+
+
+class newmemoryview(object): # with_metaclass(BaseNewBytes, _builtin_bytes)):
+ """
+ A pretty lame backport of the Python 2.7 and Python 3.x
+ memoryviewview object to Py2.6.
+ """
+ def __init__(self, obj):
+ return obj
+
+
+__all__ = ['newmemoryview']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newobject.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newobject.py
new file mode 100644
index 0000000..59c19ea
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newobject.py
@@ -0,0 +1,132 @@
+"""
+An object subclass for Python 2 that gives new-style classes written in the
+style of Python 3 (with ``__next__`` and unicode-returning ``__str__`` methods)
+the appropriate Python 2-style ``next`` and ``__unicode__`` methods for compatible.
+
+Example use::
+
+ from builtins import object
+
+ my_unicode_str = u'Unicode string: \u5b54\u5b50'
+
+ class A(object):
+ def __str__(self):
+ return my_unicode_str
+
+ a = A()
+ print(str(a))
+
+ # On Python 2, these relations hold:
+ assert unicode(a) == my_unicode_string
+ assert str(a) == my_unicode_string.encode('utf-8')
+
+
+Another example::
+
+ from builtins import object
+
+ class Upper(object):
+ def __init__(self, iterable):
+ self._iter = iter(iterable)
+ def __next__(self): # note the Py3 interface
+ return next(self._iter).upper()
+ def __iter__(self):
+ return self
+
+ assert list(Upper('hello')) == list('HELLO')
+
+"""
+
+import sys
+
+from future.utils import with_metaclass
+
+
+_builtin_object = object
+ver = sys.version_info[:2]
+
+
+# We no longer define a metaclass for newobject because this breaks multiple
+# inheritance and custom metaclass use with this exception:
+
+# TypeError: Error when calling the metaclass bases
+# metaclass conflict: the metaclass of a derived class must be a
+# (non-strict) subclass of the metaclasses of all its bases
+
+# See issues #91 and #96.
+
+
+class newobject(object):
+ """
+ A magical object class that provides Python 2 compatibility methods::
+ next
+ __unicode__
+ __nonzero__
+
+ Subclasses of this class can merely define the Python 3 methods (__next__,
+ __str__, and __bool__).
+ """
+ def next(self):
+ if hasattr(self, '__next__'):
+ return type(self).__next__(self)
+ raise TypeError('newobject is not an iterator')
+
+ def __unicode__(self):
+ # All subclasses of the builtin object should have __str__ defined.
+ # Note that old-style classes do not have __str__ defined.
+ if hasattr(self, '__str__'):
+ s = type(self).__str__(self)
+ else:
+ s = str(self)
+ if isinstance(s, unicode):
+ return s
+ else:
+ return s.decode('utf-8')
+
+ def __nonzero__(self):
+ if hasattr(self, '__bool__'):
+ return type(self).__bool__(self)
+ # object has no __nonzero__ method
+ return True
+
+ # Are these ever needed?
+ # def __div__(self):
+ # return self.__truediv__()
+
+ # def __idiv__(self, other):
+ # return self.__itruediv__(other)
+
+ def __long__(self):
+ if not hasattr(self, '__int__'):
+ return NotImplemented
+ return self.__int__() # not type(self).__int__(self)
+
+ # def __new__(cls, *args, **kwargs):
+ # """
+ # dict() -> new empty dictionary
+ # dict(mapping) -> new dictionary initialized from a mapping object's
+ # (key, value) pairs
+ # dict(iterable) -> new dictionary initialized as if via:
+ # d = {}
+ # for k, v in iterable:
+ # d[k] = v
+ # dict(**kwargs) -> new dictionary initialized with the name=value pairs
+ # in the keyword argument list. For example: dict(one=1, two=2)
+ # """
+
+ # if len(args) == 0:
+ # return super(newdict, cls).__new__(cls)
+ # elif type(args[0]) == newdict:
+ # return args[0]
+ # else:
+ # value = args[0]
+ # return super(newdict, cls).__new__(cls, value)
+
+ def __native__(self):
+ """
+ Hook for the future.utils.native() function
+ """
+ return object(self)
+
+
+__all__ = ['newobject']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newopen.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newopen.py
new file mode 100644
index 0000000..8da0642
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newopen.py
@@ -0,0 +1,33 @@
+"""
+A substitute for the Python 3 open() function.
+
+Note that io.open() is more complete but maybe slower. Even so, the
+completeness may be a better default. TODO: compare these
+"""
+
+_builtin_open = open
+
+class newopen(object):
+ """Wrapper providing key part of Python 3 open() interface.
+
+ From IPython's py3compat.py module. License: BSD.
+ """
+ def __init__(self, fname, mode="r", encoding="utf-8"):
+ self.f = _builtin_open(fname, mode)
+ self.enc = encoding
+
+ def write(self, s):
+ return self.f.write(s.encode(self.enc))
+
+ def read(self, size=-1):
+ return self.f.read(size).decode(self.enc)
+
+ def close(self):
+ return self.f.close()
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, etype, value, traceback):
+ self.f.close()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newrange.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newrange.py
new file mode 100644
index 0000000..432f11a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newrange.py
@@ -0,0 +1,160 @@
+"""
+Nearly identical to xrange.py, by Dan Crosta, from
+
+ https://github.com/dcrosta/xrange.git
+
+This is included here in the ``future`` package rather than pointed to as
+a dependency because there is no package for ``xrange`` on PyPI. It is
+also tweaked to appear like a regular Python 3 ``range`` object rather
+than a Python 2 xrange.
+
+From Dan Crosta's README:
+
+ "A pure-Python implementation of Python 2.7's xrange built-in, with
+ some features backported from the Python 3.x range built-in (which
+ replaced xrange) in that version."
+
+ Read more at
+ https://late.am/post/2012/06/18/what-the-heck-is-an-xrange
+"""
+
+from collections import Sequence, Iterator
+from itertools import islice
+
+
+class newrange(Sequence):
+ """
+ Pure-Python backport of Python 3's range object. See `the CPython
+ documentation for details:
+ `_
+ """
+
+ def __init__(self, *args):
+ if len(args) == 1:
+ start, stop, step = 0, args[0], 1
+ elif len(args) == 2:
+ start, stop, step = args[0], args[1], 1
+ elif len(args) == 3:
+ start, stop, step = args
+ else:
+ raise TypeError('range() requires 1-3 int arguments')
+
+ try:
+ start, stop, step = int(start), int(stop), int(step)
+ except ValueError:
+ raise TypeError('an integer is required')
+
+ if step == 0:
+ raise ValueError('range() arg 3 must not be zero')
+ elif step < 0:
+ stop = min(stop, start)
+ else:
+ stop = max(stop, start)
+
+ self._start = start
+ self._stop = stop
+ self._step = step
+ self._len = (stop - start) // step + bool((stop - start) % step)
+
+ @property
+ def start(self):
+ return self._start
+
+ @property
+ def stop(self):
+ return self._stop
+
+ @property
+ def step(self):
+ return self._step
+
+ def __repr__(self):
+ if self._step == 1:
+ return 'range(%d, %d)' % (self._start, self._stop)
+ return 'range(%d, %d, %d)' % (self._start, self._stop, self._step)
+
+ def __eq__(self, other):
+ return (isinstance(other, newrange) and
+ (self._len == 0 == other._len or
+ (self._start, self._step, self._len) ==
+ (other._start, other._step, self._len)))
+
+ def __len__(self):
+ return self._len
+
+ def index(self, value):
+ """Return the 0-based position of integer `value` in
+ the sequence this range represents."""
+ diff = value - self._start
+ quotient, remainder = divmod(diff, self._step)
+ if remainder == 0 and 0 <= quotient < self._len:
+ return abs(quotient)
+ raise ValueError('%r is not in range' % value)
+
+ def count(self, value):
+ """Return the number of ocurrences of integer `value`
+ in the sequence this range represents."""
+ # a value can occur exactly zero or one times
+ return int(value in self)
+
+ def __contains__(self, value):
+ """Return ``True`` if the integer `value` occurs in
+ the sequence this range represents."""
+ try:
+ self.index(value)
+ return True
+ except ValueError:
+ return False
+
+ def __reversed__(self):
+ return iter(self[::-1])
+
+ def __getitem__(self, index):
+ """Return the element at position ``index`` in the sequence
+ this range represents, or raise :class:`IndexError` if the
+ position is out of range."""
+ if isinstance(index, slice):
+ return self.__getitem_slice(index)
+ if index < 0:
+ # negative indexes access from the end
+ index = self._len + index
+ if index < 0 or index >= self._len:
+ raise IndexError('range object index out of range')
+ return self._start + index * self._step
+
+ def __getitem_slice(self, slce):
+ """Return a range which represents the requested slce
+ of the sequence represented by this range.
+ """
+ start, stop, step = slce.indices(self._len)
+ return newrange(self._start + self._step*start,
+ self._start + stop,
+ self._step * step)
+
+ def __iter__(self):
+ """Return an iterator which enumerates the elements of the
+ sequence this range represents."""
+ return range_iterator(self)
+
+
+class range_iterator(Iterator):
+ """An iterator for a :class:`range`.
+ """
+ def __init__(self, range_):
+ self._stepper = islice(_count(range_.start, range_.step), len(range_))
+
+ def __iter__(self):
+ return self
+
+ def next(self):
+ return next(self._stepper)
+
+
+# itertools.count in Py 2.6 doesn't accept a step parameter
+def _count(start=0, step=1):
+ while True:
+ yield start
+ start += step
+
+
+__all__ = ['newrange']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newstr.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newstr.py
new file mode 100644
index 0000000..fd8615a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/types/newstr.py
@@ -0,0 +1,412 @@
+"""
+This module redefines ``str`` on Python 2.x to be a subclass of the Py2
+``unicode`` type that behaves like the Python 3.x ``str``.
+
+The main differences between ``newstr`` and Python 2.x's ``unicode`` type are
+the stricter type-checking and absence of a `u''` prefix in the representation.
+
+It is designed to be used together with the ``unicode_literals`` import
+as follows:
+
+ >>> from __future__ import unicode_literals
+ >>> from builtins import str, isinstance
+
+On Python 3.x and normally on Python 2.x, these expressions hold
+
+ >>> str('blah') is 'blah'
+ True
+ >>> isinstance('blah', str)
+ True
+
+However, on Python 2.x, with this import:
+
+ >>> from __future__ import unicode_literals
+
+the same expressions are False:
+
+ >>> str('blah') is 'blah'
+ False
+ >>> isinstance('blah', str)
+ False
+
+This module is designed to be imported together with ``unicode_literals`` on
+Python 2 to bring the meaning of ``str`` back into alignment with unprefixed
+string literals (i.e. ``unicode`` subclasses).
+
+Note that ``str()`` (and ``print()``) would then normally call the
+``__unicode__`` method on objects in Python 2. To define string
+representations of your objects portably across Py3 and Py2, use the
+:func:`python_2_unicode_compatible` decorator in :mod:`future.utils`.
+
+"""
+
+from collections import Iterable
+from numbers import Number
+
+from future.utils import PY3, istext, with_metaclass, isnewbytes
+from future.types import no, issubset
+from future.types.newobject import newobject
+
+
+if PY3:
+ # We'll probably never use newstr on Py3 anyway...
+ unicode = str
+
+
+class BaseNewStr(type):
+ def __instancecheck__(cls, instance):
+ if cls == newstr:
+ return isinstance(instance, unicode)
+ else:
+ return issubclass(instance.__class__, cls)
+
+
+class newstr(with_metaclass(BaseNewStr, unicode)):
+ """
+ A backport of the Python 3 str object to Py2
+ """
+ no_convert_msg = "Can't convert '{0}' object to str implicitly"
+
+ def __new__(cls, *args, **kwargs):
+ """
+ From the Py3 str docstring:
+
+ str(object='') -> str
+ str(bytes_or_buffer[, encoding[, errors]]) -> str
+
+ Create a new string object from the given object. If encoding or
+ errors is specified, then the object must expose a data buffer
+ that will be decoded using the given encoding and error handler.
+ Otherwise, returns the result of object.__str__() (if defined)
+ or repr(object).
+ encoding defaults to sys.getdefaultencoding().
+ errors defaults to 'strict'.
+
+ """
+ if len(args) == 0:
+ return super(newstr, cls).__new__(cls)
+ # Special case: If someone requests str(str(u'abc')), return the same
+ # object (same id) for consistency with Py3.3. This is not true for
+ # other objects like list or dict.
+ elif type(args[0]) == newstr and cls == newstr:
+ return args[0]
+ elif isinstance(args[0], unicode):
+ value = args[0]
+ elif isinstance(args[0], bytes): # i.e. Py2 bytes or newbytes
+ if 'encoding' in kwargs or len(args) > 1:
+ value = args[0].decode(*args[1:], **kwargs)
+ else:
+ value = args[0].__str__()
+ else:
+ value = args[0]
+ return super(newstr, cls).__new__(cls, value)
+
+ def __repr__(self):
+ """
+ Without the u prefix
+ """
+ value = super(newstr, self).__repr__()
+ # assert value[0] == u'u'
+ return value[1:]
+
+ def __getitem__(self, y):
+ """
+ Warning: Python <= 2.7.6 has a bug that causes this method never to be called
+ when y is a slice object. Therefore the type of newstr()[:2] is wrong
+ (unicode instead of newstr).
+ """
+ return newstr(super(newstr, self).__getitem__(y))
+
+ def __contains__(self, key):
+ errmsg = "'in ' requires string as left operand, not {0}"
+ # Don't use isinstance() here because we only want to catch
+ # newstr, not Python 2 unicode:
+ if type(key) == newstr:
+ newkey = key
+ elif isinstance(key, unicode) or isinstance(key, bytes) and not isnewbytes(key):
+ newkey = newstr(key)
+ else:
+ raise TypeError(errmsg.format(type(key)))
+ return issubset(list(newkey), list(self))
+
+ @no('newbytes')
+ def __add__(self, other):
+ return newstr(super(newstr, self).__add__(other))
+
+ @no('newbytes')
+ def __radd__(self, left):
+ " left + self "
+ try:
+ return newstr(left) + self
+ except:
+ return NotImplemented
+
+ def __mul__(self, other):
+ return newstr(super(newstr, self).__mul__(other))
+
+ def __rmul__(self, other):
+ return newstr(super(newstr, self).__rmul__(other))
+
+ def join(self, iterable):
+ errmsg = 'sequence item {0}: expected unicode string, found bytes'
+ for i, item in enumerate(iterable):
+ # Here we use type() rather than isinstance() because
+ # __instancecheck__ is being overridden. E.g.
+ # isinstance(b'abc', newbytes) is True on Py2.
+ if isnewbytes(item):
+ raise TypeError(errmsg.format(i))
+ # Support use as a staticmethod: str.join('-', ['a', 'b'])
+ if type(self) == newstr:
+ return newstr(super(newstr, self).join(iterable))
+ else:
+ return newstr(super(newstr, newstr(self)).join(iterable))
+
+ @no('newbytes')
+ def find(self, sub, *args):
+ return super(newstr, self).find(sub, *args)
+
+ @no('newbytes')
+ def rfind(self, sub, *args):
+ return super(newstr, self).rfind(sub, *args)
+
+ @no('newbytes', (1, 2))
+ def replace(self, old, new, *args):
+ return newstr(super(newstr, self).replace(old, new, *args))
+
+ def decode(self, *args):
+ raise AttributeError("decode method has been disabled in newstr")
+
+ def encode(self, encoding='utf-8', errors='strict'):
+ """
+ Returns bytes
+
+ Encode S using the codec registered for encoding. Default encoding
+ is 'utf-8'. errors may be given to set a different error
+ handling scheme. Default is 'strict' meaning that encoding errors raise
+ a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and
+ 'xmlcharrefreplace' as well as any other name registered with
+ codecs.register_error that can handle UnicodeEncodeErrors.
+ """
+ from future.types.newbytes import newbytes
+ # Py2 unicode.encode() takes encoding and errors as optional parameter,
+ # not keyword arguments as in Python 3 str.
+
+ # For the surrogateescape error handling mechanism, the
+ # codecs.register_error() function seems to be inadequate for an
+ # implementation of it when encoding. (Decoding seems fine, however.)
+ # For example, in the case of
+ # u'\udcc3'.encode('ascii', 'surrogateescape_handler')
+ # after registering the ``surrogateescape_handler`` function in
+ # future.utils.surrogateescape, both Python 2.x and 3.x raise an
+ # exception anyway after the function is called because the unicode
+ # string it has to return isn't encodable strictly as ASCII.
+
+ if errors == 'surrogateescape':
+ if encoding == 'utf-16':
+ # Known to fail here. See test_encoding_works_normally()
+ raise NotImplementedError('FIXME: surrogateescape handling is '
+ 'not yet implemented properly')
+ # Encode char by char, building up list of byte-strings
+ mybytes = []
+ for c in self:
+ code = ord(c)
+ if 0xD800 <= code <= 0xDCFF:
+ mybytes.append(newbytes([code - 0xDC00]))
+ else:
+ mybytes.append(c.encode(encoding=encoding))
+ return newbytes(b'').join(mybytes)
+ return newbytes(super(newstr, self).encode(encoding, errors))
+
+ @no('newbytes', 1)
+ def startswith(self, prefix, *args):
+ if isinstance(prefix, Iterable):
+ for thing in prefix:
+ if isnewbytes(thing):
+ raise TypeError(self.no_convert_msg.format(type(thing)))
+ return super(newstr, self).startswith(prefix, *args)
+
+ @no('newbytes', 1)
+ def endswith(self, prefix, *args):
+ # Note we need the decorator above as well as the isnewbytes()
+ # check because prefix can be either a bytes object or e.g. a
+ # tuple of possible prefixes. (If it's a bytes object, each item
+ # in it is an int.)
+ if isinstance(prefix, Iterable):
+ for thing in prefix:
+ if isnewbytes(thing):
+ raise TypeError(self.no_convert_msg.format(type(thing)))
+ return super(newstr, self).endswith(prefix, *args)
+
+ @no('newbytes', 1)
+ def split(self, sep=None, maxsplit=-1):
+ # Py2 unicode.split() takes maxsplit as an optional parameter,
+ # not as a keyword argument as in Python 3 str.
+ parts = super(newstr, self).split(sep, maxsplit)
+ return [newstr(part) for part in parts]
+
+ @no('newbytes', 1)
+ def rsplit(self, sep=None, maxsplit=-1):
+ # Py2 unicode.rsplit() takes maxsplit as an optional parameter,
+ # not as a keyword argument as in Python 3 str.
+ parts = super(newstr, self).rsplit(sep, maxsplit)
+ return [newstr(part) for part in parts]
+
+ @no('newbytes', 1)
+ def partition(self, sep):
+ parts = super(newstr, self).partition(sep)
+ return tuple(newstr(part) for part in parts)
+
+ @no('newbytes', 1)
+ def rpartition(self, sep):
+ parts = super(newstr, self).rpartition(sep)
+ return tuple(newstr(part) for part in parts)
+
+ @no('newbytes', 1)
+ def index(self, sub, *args):
+ """
+ Like newstr.find() but raise ValueError when the substring is not
+ found.
+ """
+ pos = self.find(sub, *args)
+ if pos == -1:
+ raise ValueError('substring not found')
+ return pos
+
+ def splitlines(self, keepends=False):
+ """
+ S.splitlines(keepends=False) -> list of strings
+
+ Return a list of the lines in S, breaking at line boundaries.
+ Line breaks are not included in the resulting list unless keepends
+ is given and true.
+ """
+ # Py2 unicode.splitlines() takes keepends as an optional parameter,
+ # not as a keyword argument as in Python 3 str.
+ parts = super(newstr, self).splitlines(keepends)
+ return [newstr(part) for part in parts]
+
+ def __eq__(self, other):
+ if (isinstance(other, unicode) or
+ isinstance(other, bytes) and not isnewbytes(other)):
+ return super(newstr, self).__eq__(other)
+ else:
+ return False
+
+ def __ne__(self, other):
+ if (isinstance(other, unicode) or
+ isinstance(other, bytes) and not isnewbytes(other)):
+ return super(newstr, self).__ne__(other)
+ else:
+ return True
+
+ unorderable_err = 'unorderable types: str() and {0}'
+
+ def __lt__(self, other):
+ if not istext(other):
+ raise TypeError(self.unorderable_err.format(type(other)))
+ return super(newstr, self).__lt__(other)
+
+ def __le__(self, other):
+ if not istext(other):
+ raise TypeError(self.unorderable_err.format(type(other)))
+ return super(newstr, self).__le__(other)
+
+ def __gt__(self, other):
+ if not istext(other):
+ raise TypeError(self.unorderable_err.format(type(other)))
+ return super(newstr, self).__gt__(other)
+
+ def __ge__(self, other):
+ if not istext(other):
+ raise TypeError(self.unorderable_err.format(type(other)))
+ return super(newstr, self).__ge__(other)
+
+ def __getattribute__(self, name):
+ """
+ A trick to cause the ``hasattr`` builtin-fn to return False for
+ the 'decode' method on Py2.
+ """
+ if name in ['decode', u'decode']:
+ raise AttributeError("decode method has been disabled in newstr")
+ return super(newstr, self).__getattribute__(name)
+
+ def __native__(self):
+ """
+ A hook for the future.utils.native() function.
+ """
+ return unicode(self)
+
+ @staticmethod
+ def maketrans(x, y=None, z=None):
+ """
+ Return a translation table usable for str.translate().
+
+ If there is only one argument, it must be a dictionary mapping Unicode
+ ordinals (integers) or characters to Unicode ordinals, strings or None.
+ Character keys will be then converted to ordinals.
+ If there are two arguments, they must be strings of equal length, and
+ in the resulting dictionary, each character in x will be mapped to the
+ character at the same position in y. If there is a third argument, it
+ must be a string, whose characters will be mapped to None in the result.
+ """
+
+ if y is None:
+ assert z is None
+ if not isinstance(x, dict):
+ raise TypeError('if you give only one argument to maketrans it must be a dict')
+ result = {}
+ for (key, value) in x.items():
+ if len(key) > 1:
+ raise ValueError('keys in translate table must be strings or integers')
+ result[ord(key)] = value
+ else:
+ if not isinstance(x, unicode) and isinstance(y, unicode):
+ raise TypeError('x and y must be unicode strings')
+ if not len(x) == len(y):
+ raise ValueError('the first two maketrans arguments must have equal length')
+ result = {}
+ for (xi, yi) in zip(x, y):
+ if len(xi) > 1:
+ raise ValueError('keys in translate table must be strings or integers')
+ result[ord(xi)] = ord(yi)
+
+ if z is not None:
+ for char in z:
+ result[ord(char)] = None
+ return result
+
+ def translate(self, table):
+ """
+ S.translate(table) -> str
+
+ Return a copy of the string S, where all characters have been mapped
+ through the given translation table, which must be a mapping of
+ Unicode ordinals to Unicode ordinals, strings, or None.
+ Unmapped characters are left untouched. Characters mapped to None
+ are deleted.
+ """
+ l = []
+ for c in self:
+ if ord(c) in table:
+ val = table[ord(c)]
+ if val is None:
+ continue
+ elif isinstance(val, unicode):
+ l.append(val)
+ else:
+ l.append(chr(val))
+ else:
+ l.append(c)
+ return ''.join(l)
+
+ def isprintable(self):
+ raise NotImplementedError('fixme')
+
+ def isidentifier(self):
+ raise NotImplementedError('fixme')
+
+ def format_map(self):
+ raise NotImplementedError('fixme')
+
+
+__all__ = ['newstr']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/utils/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/utils/__init__.py
new file mode 100644
index 0000000..6466fa2
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/utils/__init__.py
@@ -0,0 +1,724 @@
+"""
+A selection of cross-compatible functions for Python 2 and 3.
+
+This exports useful functions for 2/3 compatible code that are not
+builtins on Python 3:
+
+ * bind_method: binds functions to classes
+ * ``native_str_to_bytes`` and ``bytes_to_native_str``
+ * ``native_str``: always equal to the native platform string object (because
+ this may be shadowed by imports from future.builtins)
+ * lists: lrange(), lmap(), lzip(), lfilter()
+ * iterable method compatibility: iteritems, iterkeys, itervalues
+
+ * Uses the original method if available, otherwise uses items, keys, values.
+
+ * types:
+
+ * text_type: unicode in Python 2, str in Python 3
+ * binary_type: str in Python 2, bythes in Python 3
+ * string_types: basestring in Python 2, str in Python 3
+
+ * bchr(c):
+ Take an integer and make a 1-character byte string
+ * bord(c)
+ Take the result of indexing on a byte string and make an integer
+ * tobytes(s)
+ Take a text string, a byte string, or a sequence of characters taken
+ from a byte string, and make a byte string.
+
+This module also defines a simple decorator called
+``python_2_unicode_compatible`` (from django.utils.encoding) which
+defines ``__unicode__`` and ``__str__`` methods consistently under Python
+3 and 2. To support Python 3 and 2 with a single code base, simply define
+a ``__str__`` method returning unicode text and apply the
+python_2_unicode_compatible decorator to the class like this::
+
+ >>> from future.utils import python_2_unicode_compatible
+
+ >>> @python_2_unicode_compatible
+ ... class MyClass(object):
+ ... def __str__(self):
+ ... return u'Unicode string: \u5b54\u5b50'
+
+ >>> a = MyClass()
+
+Then, after this import:
+
+ >>> from future.builtins import str
+
+the following is ``True`` on both Python 3 and 2::
+
+ >>> str(a) == a.encode('utf-8').decode('utf-8')
+ True
+
+and, on a Unicode-enabled terminal with the right fonts, these both print the
+Chinese characters for Confucius::
+
+ print(a)
+ print(str(a))
+
+On Python 3, this decorator is a no-op.
+
+Some of the functions in this module come from the following sources:
+
+ * Jinja2 (BSD licensed: see
+ https://github.com/mitsuhiko/jinja2/blob/master/LICENSE)
+ * Pandas compatibility module pandas.compat
+ * six.py by Benjamin Peterson
+ * Django
+"""
+
+import types
+import sys
+import numbers
+import functools
+import copy
+import inspect
+
+
+PY3 = sys.version_info[0] == 3
+PY2 = sys.version_info[0] == 2
+PY26 = sys.version_info[0:2] == (2, 6)
+PYPY = hasattr(sys, 'pypy_translation_info')
+
+
+def python_2_unicode_compatible(cls):
+ """
+ A decorator that defines __unicode__ and __str__ methods under Python
+ 2. Under Python 3 it does nothing.
+
+ To support Python 2 and 3 with a single code base, define a __str__
+ method returning unicode text and apply this decorator to the class.
+
+ The implementation comes from django.utils.encoding.
+ """
+ if not PY3:
+ cls.__unicode__ = cls.__str__
+ cls.__str__ = lambda self: self.__unicode__().encode('utf-8')
+ return cls
+
+
+def with_metaclass(meta, *bases):
+ """
+ Function from jinja2/_compat.py. License: BSD.
+
+ Use it like this::
+
+ class BaseForm(object):
+ pass
+
+ class FormType(type):
+ pass
+
+ class Form(with_metaclass(FormType, BaseForm)):
+ pass
+
+ This requires a bit of explanation: the basic idea is to make a
+ dummy metaclass for one level of class instantiation that replaces
+ itself with the actual metaclass. Because of internal type checks
+ we also need to make sure that we downgrade the custom metaclass
+ for one level to something closer to type (that's why __call__ and
+ __init__ comes back from type etc.).
+
+ This has the advantage over six.with_metaclass of not introducing
+ dummy classes into the final MRO.
+ """
+ class metaclass(meta):
+ __call__ = type.__call__
+ __init__ = type.__init__
+ def __new__(cls, name, this_bases, d):
+ if this_bases is None:
+ return type.__new__(cls, name, (), d)
+ return meta(name, bases, d)
+ return metaclass('temporary_class', None, {})
+
+
+# Definitions from pandas.compat follow:
+if PY3:
+ def bchr(s):
+ return bytes([s])
+ def bstr(s):
+ if isinstance(s, str):
+ return bytes(s, 'latin-1')
+ else:
+ return bytes(s)
+ def bord(s):
+ return s
+else:
+ # Python 2
+ def bchr(s):
+ return chr(s)
+ def bstr(s):
+ return str(s)
+ def bord(s):
+ return ord(s)
+
+###
+
+if PY3:
+ def tobytes(s):
+ if isinstance(s, bytes):
+ return s
+ else:
+ if isinstance(s, str):
+ return s.encode('latin-1')
+ else:
+ return bytes(s)
+else:
+ # Python 2
+ def tobytes(s):
+ if isinstance(s, unicode):
+ return s.encode('latin-1')
+ else:
+ return ''.join(s)
+
+tobytes.__doc__ = """
+ Encodes to latin-1 (where the first 256 chars are the same as
+ ASCII.)
+ """
+
+if PY3:
+ def native_str_to_bytes(s, encoding='utf-8'):
+ return s.encode(encoding)
+
+ def bytes_to_native_str(b, encoding='utf-8'):
+ return b.decode(encoding)
+
+ def text_to_native_str(t, encoding=None):
+ return t
+else:
+ # Python 2
+ def native_str_to_bytes(s, encoding=None):
+ from future.types import newbytes # to avoid a circular import
+ return newbytes(s)
+
+ def bytes_to_native_str(b, encoding=None):
+ return native(b)
+
+ def text_to_native_str(t, encoding='ascii'):
+ """
+ Use this to create a Py2 native string when "from __future__ import
+ unicode_literals" is in effect.
+ """
+ return unicode(t).encode(encoding)
+
+native_str_to_bytes.__doc__ = """
+ On Py3, returns an encoded string.
+ On Py2, returns a newbytes type, ignoring the ``encoding`` argument.
+ """
+
+if PY3:
+ # list-producing versions of the major Python iterating functions
+ def lrange(*args, **kwargs):
+ return list(range(*args, **kwargs))
+
+ def lzip(*args, **kwargs):
+ return list(zip(*args, **kwargs))
+
+ def lmap(*args, **kwargs):
+ return list(map(*args, **kwargs))
+
+ def lfilter(*args, **kwargs):
+ return list(filter(*args, **kwargs))
+else:
+ import __builtin__
+ # Python 2-builtin ranges produce lists
+ lrange = __builtin__.range
+ lzip = __builtin__.zip
+ lmap = __builtin__.map
+ lfilter = __builtin__.filter
+
+
+def isidentifier(s, dotted=False):
+ '''
+ A function equivalent to the str.isidentifier method on Py3
+ '''
+ if dotted:
+ return all(isidentifier(a) for a in s.split('.'))
+ if PY3:
+ return s.isidentifier()
+ else:
+ import re
+ _name_re = re.compile(r"[a-zA-Z_][a-zA-Z0-9_]*$")
+ return bool(_name_re.match(s))
+
+
+def viewitems(obj, **kwargs):
+ """
+ Function for iterating over dictionary items with the same set-like
+ behaviour on Py2.7 as on Py3.
+
+ Passes kwargs to method."""
+ func = getattr(obj, "viewitems", None)
+ if not func:
+ func = obj.items
+ return func(**kwargs)
+
+
+def viewkeys(obj, **kwargs):
+ """
+ Function for iterating over dictionary keys with the same set-like
+ behaviour on Py2.7 as on Py3.
+
+ Passes kwargs to method."""
+ func = getattr(obj, "viewkeys", None)
+ if not func:
+ func = obj.keys
+ return func(**kwargs)
+
+
+def viewvalues(obj, **kwargs):
+ """
+ Function for iterating over dictionary values with the same set-like
+ behaviour on Py2.7 as on Py3.
+
+ Passes kwargs to method."""
+ func = getattr(obj, "viewvalues", None)
+ if not func:
+ func = obj.values
+ return func(**kwargs)
+
+
+def iteritems(obj, **kwargs):
+ """Use this only if compatibility with Python versions before 2.7 is
+ required. Otherwise, prefer viewitems().
+ """
+ func = getattr(obj, "iteritems", None)
+ if not func:
+ func = obj.items
+ return func(**kwargs)
+
+
+def iterkeys(obj, **kwargs):
+ """Use this only if compatibility with Python versions before 2.7 is
+ required. Otherwise, prefer viewkeys().
+ """
+ func = getattr(obj, "iterkeys", None)
+ if not func:
+ func = obj.keys
+ return func(**kwargs)
+
+
+def itervalues(obj, **kwargs):
+ """Use this only if compatibility with Python versions before 2.7 is
+ required. Otherwise, prefer viewvalues().
+ """
+ func = getattr(obj, "itervalues", None)
+ if not func:
+ func = obj.values
+ return func(**kwargs)
+
+
+def bind_method(cls, name, func):
+ """Bind a method to class, python 2 and python 3 compatible.
+
+ Parameters
+ ----------
+
+ cls : type
+ class to receive bound method
+ name : basestring
+ name of method on class instance
+ func : function
+ function to be bound as method
+
+ Returns
+ -------
+ None
+ """
+ # only python 2 has an issue with bound/unbound methods
+ if not PY3:
+ setattr(cls, name, types.MethodType(func, None, cls))
+ else:
+ setattr(cls, name, func)
+
+
+def getexception():
+ return sys.exc_info()[1]
+
+
+def _get_caller_globals_and_locals():
+ """
+ Returns the globals and locals of the calling frame.
+
+ Is there an alternative to frame hacking here?
+ """
+ caller_frame = inspect.stack()[2]
+ myglobals = caller_frame[0].f_globals
+ mylocals = caller_frame[0].f_locals
+ return myglobals, mylocals
+
+
+def _repr_strip(mystring):
+ """
+ Returns the string without any initial or final quotes.
+ """
+ r = repr(mystring)
+ if r.startswith("'") and r.endswith("'"):
+ return r[1:-1]
+ else:
+ return r
+
+
+if PY3:
+ def raise_from(exc, cause):
+ """
+ Equivalent to:
+
+ raise EXCEPTION from CAUSE
+
+ on Python 3. (See PEP 3134).
+ """
+ # Is either arg an exception class (e.g. IndexError) rather than
+ # instance (e.g. IndexError('my message here')? If so, pass the
+ # name of the class undisturbed through to "raise ... from ...".
+ if isinstance(exc, type) and issubclass(exc, Exception):
+ exc = exc.__name__
+ if isinstance(cause, type) and issubclass(cause, Exception):
+ cause = cause.__name__
+ execstr = "raise " + _repr_strip(exc) + " from " + _repr_strip(cause)
+ myglobals, mylocals = _get_caller_globals_and_locals()
+ exec(execstr, myglobals, mylocals)
+
+ def raise_(tp, value=None, tb=None):
+ """
+ A function that matches the Python 2.x ``raise`` statement. This
+ allows re-raising exceptions with the cls value and traceback on
+ Python 2 and 3.
+ """
+ if value is not None and isinstance(tp, Exception):
+ raise TypeError("instance exception may not have a separate value")
+ if value is not None:
+ exc = tp(value)
+ else:
+ exc = tp
+ if exc.__traceback__ is not tb:
+ raise exc.with_traceback(tb)
+ raise exc
+
+ def raise_with_traceback(exc, traceback=Ellipsis):
+ if traceback == Ellipsis:
+ _, _, traceback = sys.exc_info()
+ raise exc.with_traceback(traceback)
+
+else:
+ def raise_from(exc, cause):
+ """
+ Equivalent to:
+
+ raise EXCEPTION from CAUSE
+
+ on Python 3. (See PEP 3134).
+ """
+ # Is either arg an exception class (e.g. IndexError) rather than
+ # instance (e.g. IndexError('my message here')? If so, pass the
+ # name of the class undisturbed through to "raise ... from ...".
+ if isinstance(exc, type) and issubclass(exc, Exception):
+ e = exc()
+ # exc = exc.__name__
+ # execstr = "e = " + _repr_strip(exc) + "()"
+ # myglobals, mylocals = _get_caller_globals_and_locals()
+ # exec(execstr, myglobals, mylocals)
+ else:
+ e = exc
+ e.__suppress_context__ = False
+ if isinstance(cause, type) and issubclass(cause, Exception):
+ e.__cause__ = cause()
+ e.__suppress_context__ = True
+ elif cause is None:
+ e.__cause__ = None
+ e.__suppress_context__ = True
+ elif isinstance(cause, BaseException):
+ e.__cause__ = cause
+ e.__suppress_context__ = True
+ else:
+ raise TypeError("exception causes must derive from BaseException")
+ e.__context__ = sys.exc_info()[1]
+ raise e
+
+ exec('''
+def raise_(tp, value=None, tb=None):
+ raise tp, value, tb
+
+def raise_with_traceback(exc, traceback=Ellipsis):
+ if traceback == Ellipsis:
+ _, _, traceback = sys.exc_info()
+ raise exc, None, traceback
+'''.strip())
+
+
+raise_with_traceback.__doc__ = (
+"""Raise exception with existing traceback.
+If traceback is not passed, uses sys.exc_info() to get traceback."""
+)
+
+
+# Deprecated alias for backward compatibility with ``future`` versions < 0.11:
+reraise = raise_
+
+
+def implements_iterator(cls):
+ '''
+ From jinja2/_compat.py. License: BSD.
+
+ Use as a decorator like this::
+
+ @implements_iterator
+ class UppercasingIterator(object):
+ def __init__(self, iterable):
+ self._iter = iter(iterable)
+ def __iter__(self):
+ return self
+ def __next__(self):
+ return next(self._iter).upper()
+
+ '''
+ if PY3:
+ return cls
+ else:
+ cls.next = cls.__next__
+ del cls.__next__
+ return cls
+
+if PY3:
+ get_next = lambda x: x.next
+else:
+ get_next = lambda x: x.__next__
+
+
+def encode_filename(filename):
+ if PY3:
+ return filename
+ else:
+ if isinstance(filename, unicode):
+ return filename.encode('utf-8')
+ return filename
+
+
+def is_new_style(cls):
+ """
+ Python 2.7 has both new-style and old-style classes. Old-style classes can
+ be pesky in some circumstances, such as when using inheritance. Use this
+ function to test for whether a class is new-style. (Python 3 only has
+ new-style classes.)
+ """
+ return hasattr(cls, '__class__') and ('__dict__' in dir(cls)
+ or hasattr(cls, '__slots__'))
+
+# The native platform string and bytes types. Useful because ``str`` and
+# ``bytes`` are redefined on Py2 by ``from future.builtins import *``.
+native_str = str
+native_bytes = bytes
+
+
+def istext(obj):
+ """
+ Deprecated. Use::
+ >>> isinstance(obj, str)
+ after this import:
+ >>> from future.builtins import str
+ """
+ return isinstance(obj, type(u''))
+
+
+def isbytes(obj):
+ """
+ Deprecated. Use::
+ >>> isinstance(obj, bytes)
+ after this import:
+ >>> from future.builtins import bytes
+ """
+ return isinstance(obj, type(b''))
+
+
+def isnewbytes(obj):
+ """
+ Equivalent to the result of ``isinstance(obj, newbytes)`` were
+ ``__instancecheck__`` not overridden on the newbytes subclass. In
+ other words, it is REALLY a newbytes instance, not a Py2 native str
+ object?
+ """
+ # TODO: generalize this so that it works with subclasses of newbytes
+ # Import is here to avoid circular imports:
+ from future.types.newbytes import newbytes
+ return type(obj) == newbytes
+
+
+def isint(obj):
+ """
+ Deprecated. Tests whether an object is a Py3 ``int`` or either a Py2 ``int`` or
+ ``long``.
+
+ Instead of using this function, you can use:
+
+ >>> from future.builtins import int
+ >>> isinstance(obj, int)
+
+ The following idiom is equivalent:
+
+ >>> from numbers import Integral
+ >>> isinstance(obj, Integral)
+ """
+
+ return isinstance(obj, numbers.Integral)
+
+
+def native(obj):
+ """
+ On Py3, this is a no-op: native(obj) -> obj
+
+ On Py2, returns the corresponding native Py2 types that are
+ superclasses for backported objects from Py3:
+
+ >>> from builtins import str, bytes, int
+
+ >>> native(str(u'ABC'))
+ u'ABC'
+ >>> type(native(str(u'ABC')))
+ unicode
+
+ >>> native(bytes(b'ABC'))
+ b'ABC'
+ >>> type(native(bytes(b'ABC')))
+ bytes
+
+ >>> native(int(10**20))
+ 100000000000000000000L
+ >>> type(native(int(10**20)))
+ long
+
+ Existing native types on Py2 will be returned unchanged:
+
+ >>> type(native(u'ABC'))
+ unicode
+ """
+ if hasattr(obj, '__native__'):
+ return obj.__native__()
+ else:
+ return obj
+
+
+# Implementation of exec_ is from ``six``:
+if PY3:
+ import builtins
+ exec_ = getattr(builtins, "exec")
+else:
+ def exec_(code, globs=None, locs=None):
+ """Execute code in a namespace."""
+ if globs is None:
+ frame = sys._getframe(1)
+ globs = frame.f_globals
+ if locs is None:
+ locs = frame.f_locals
+ del frame
+ elif locs is None:
+ locs = globs
+ exec("""exec code in globs, locs""")
+
+
+# Defined here for backward compatibility:
+def old_div(a, b):
+ """
+ DEPRECATED: import ``old_div`` from ``past.utils`` instead.
+
+ Equivalent to ``a / b`` on Python 2 without ``from __future__ import
+ division``.
+
+ TODO: generalize this to other objects (like arrays etc.)
+ """
+ if isinstance(a, numbers.Integral) and isinstance(b, numbers.Integral):
+ return a // b
+ else:
+ return a / b
+
+
+def as_native_str(encoding='utf-8'):
+ '''
+ A decorator to turn a function or method call that returns text, i.e.
+ unicode, into one that returns a native platform str.
+
+ Use it as a decorator like this::
+
+ from __future__ import unicode_literals
+
+ class MyClass(object):
+ @as_native_str(encoding='ascii')
+ def __repr__(self):
+ return next(self._iter).upper()
+ '''
+ if PY3:
+ return lambda f: f
+ else:
+ def encoder(f):
+ @functools.wraps(f)
+ def wrapper(*args, **kwargs):
+ return f(*args, **kwargs).encode(encoding=encoding)
+ return wrapper
+ return encoder
+
+# listvalues and listitems definitions from Nick Coghlan's (withdrawn)
+# PEP 496:
+try:
+ dict.iteritems
+except AttributeError:
+ # Python 3
+ def listvalues(d):
+ return list(d.values())
+ def listitems(d):
+ return list(d.items())
+else:
+ # Python 2
+ def listvalues(d):
+ return d.values()
+ def listitems(d):
+ return d.items()
+
+if PY3:
+ def ensure_new_type(obj):
+ return obj
+else:
+ def ensure_new_type(obj):
+ from future.types.newbytes import newbytes
+ from future.types.newstr import newstr
+ from future.types.newint import newint
+ from future.types.newdict import newdict
+
+ native_type = type(native(obj))
+
+ # Upcast only if the type is already a native (non-future) type
+ if issubclass(native_type, type(obj)):
+ # Upcast
+ if native_type == str: # i.e. Py2 8-bit str
+ return newbytes(obj)
+ elif native_type == unicode:
+ return newstr(obj)
+ elif native_type == int:
+ return newint(obj)
+ elif native_type == long:
+ return newint(obj)
+ elif native_type == dict:
+ return newdict(obj)
+ else:
+ return NotImplementedError('type %s not supported' % type(obj))
+ else:
+ # Already a new type
+ assert type(obj) in [newbytes, newstr]
+ return obj
+
+
+__all__ = ['PY2', 'PY26', 'PY3', 'PYPY',
+ 'as_native_str', 'bind_method', 'bord', 'bstr',
+ 'bytes_to_native_str', 'encode_filename', 'ensure_new_type',
+ 'exec_', 'get_next', 'getexception', 'implements_iterator',
+ 'is_new_style', 'isbytes', 'isidentifier', 'isint',
+ 'isnewbytes', 'istext', 'iteritems', 'iterkeys', 'itervalues',
+ 'lfilter', 'listitems', 'listvalues', 'lmap', 'lrange',
+ 'lzip', 'native', 'native_bytes', 'native_str',
+ 'native_str_to_bytes', 'old_div',
+ 'python_2_unicode_compatible', 'raise_',
+ 'raise_with_traceback', 'reraise', 'text_to_native_str',
+ 'tobytes', 'viewitems', 'viewkeys', 'viewvalues',
+ 'with_metaclass'
+ ]
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/utils/surrogateescape.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/utils/surrogateescape.py
new file mode 100644
index 0000000..a0d8d44
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/future/utils/surrogateescape.py
@@ -0,0 +1,199 @@
+"""
+This is Victor Stinner's pure-Python implementation of PEP 383: the "surrogateescape" error
+handler of Python 3.
+
+Source: misc/python/surrogateescape.py in https://bitbucket.org/haypo/misc
+"""
+
+# This code is released under the Python license and the BSD 2-clause license
+
+import codecs
+import sys
+
+from future import utils
+
+
+FS_ERRORS = 'surrogateescape'
+
+# # -- Python 2/3 compatibility -------------------------------------
+# FS_ERRORS = 'my_surrogateescape'
+
+def u(text):
+ if utils.PY3:
+ return text
+ else:
+ return text.decode('unicode_escape')
+
+def b(data):
+ if utils.PY3:
+ return data.encode('latin1')
+ else:
+ return data
+
+if utils.PY3:
+ _unichr = chr
+ bytes_chr = lambda code: bytes((code,))
+else:
+ _unichr = unichr
+ bytes_chr = chr
+
+def surrogateescape_handler(exc):
+ """
+ Pure Python implementation of the PEP 383: the "surrogateescape" error
+ handler of Python 3. Undecodable bytes will be replaced by a Unicode
+ character U+DCxx on decoding, and these are translated into the
+ original bytes on encoding.
+ """
+ mystring = exc.object[exc.start:exc.end]
+
+ try:
+ if isinstance(exc, UnicodeDecodeError):
+ # mystring is a byte-string in this case
+ decoded = replace_surrogate_decode(mystring)
+ elif isinstance(exc, UnicodeEncodeError):
+ # In the case of u'\udcc3'.encode('ascii',
+ # 'this_surrogateescape_handler'), both Python 2.x and 3.x raise an
+ # exception anyway after this function is called, even though I think
+ # it's doing what it should. It seems that the strict encoder is called
+ # to encode the unicode string that this function returns ...
+ decoded = replace_surrogate_encode(mystring)
+ else:
+ raise exc
+ except NotASurrogateError:
+ raise exc
+ return (decoded, exc.end)
+
+
+class NotASurrogateError(Exception):
+ pass
+
+
+def replace_surrogate_encode(mystring):
+ """
+ Returns a (unicode) string, not the more logical bytes, because the codecs
+ register_error functionality expects this.
+ """
+ decoded = []
+ for ch in mystring:
+ # if utils.PY3:
+ # code = ch
+ # else:
+ code = ord(ch)
+
+ # The following magic comes from Py3.3's Python/codecs.c file:
+ if not 0xD800 <= code <= 0xDCFF:
+ # Not a surrogate. Fail with the original exception.
+ raise exc
+ # mybytes = [0xe0 | (code >> 12),
+ # 0x80 | ((code >> 6) & 0x3f),
+ # 0x80 | (code & 0x3f)]
+ # Is this a good idea?
+ if 0xDC00 <= code <= 0xDC7F:
+ decoded.append(_unichr(code - 0xDC00))
+ elif code <= 0xDCFF:
+ decoded.append(_unichr(code - 0xDC00))
+ else:
+ raise NotASurrogateError
+ return str().join(decoded)
+
+
+def replace_surrogate_decode(mybytes):
+ """
+ Returns a (unicode) string
+ """
+ decoded = []
+ for ch in mybytes:
+ # We may be parsing newbytes (in which case ch is an int) or a native
+ # str on Py2
+ if isinstance(ch, int):
+ code = ch
+ else:
+ code = ord(ch)
+ if 0x80 <= code <= 0xFF:
+ decoded.append(_unichr(0xDC00 + code))
+ elif code <= 0x7F:
+ decoded.append(_unichr(code))
+ else:
+ # # It may be a bad byte
+ # # Try swallowing it.
+ # continue
+ # print("RAISE!")
+ raise NotASurrogateError
+ return str().join(decoded)
+
+
+def encodefilename(fn):
+ if FS_ENCODING == 'ascii':
+ # ASCII encoder of Python 2 expects that the error handler returns a
+ # Unicode string encodable to ASCII, whereas our surrogateescape error
+ # handler has to return bytes in 0x80-0xFF range.
+ encoded = []
+ for index, ch in enumerate(fn):
+ code = ord(ch)
+ if code < 128:
+ ch = bytes_chr(code)
+ elif 0xDC80 <= code <= 0xDCFF:
+ ch = bytes_chr(code - 0xDC00)
+ else:
+ raise UnicodeEncodeError(FS_ENCODING,
+ fn, index, index+1,
+ 'ordinal not in range(128)')
+ encoded.append(ch)
+ return bytes().join(encoded)
+ elif FS_ENCODING == 'utf-8':
+ # UTF-8 encoder of Python 2 encodes surrogates, so U+DC80-U+DCFF
+ # doesn't go through our error handler
+ encoded = []
+ for index, ch in enumerate(fn):
+ code = ord(ch)
+ if 0xD800 <= code <= 0xDFFF:
+ if 0xDC80 <= code <= 0xDCFF:
+ ch = bytes_chr(code - 0xDC00)
+ encoded.append(ch)
+ else:
+ raise UnicodeEncodeError(
+ FS_ENCODING,
+ fn, index, index+1, 'surrogates not allowed')
+ else:
+ ch_utf8 = ch.encode('utf-8')
+ encoded.append(ch_utf8)
+ return bytes().join(encoded)
+ else:
+ return fn.encode(FS_ENCODING, FS_ERRORS)
+
+def decodefilename(fn):
+ return fn.decode(FS_ENCODING, FS_ERRORS)
+
+FS_ENCODING = 'ascii'; fn = b('[abc\xff]'); encoded = u('[abc\udcff]')
+# FS_ENCODING = 'cp932'; fn = b('[abc\x81\x00]'); encoded = u('[abc\udc81\x00]')
+# FS_ENCODING = 'UTF-8'; fn = b('[abc\xff]'); encoded = u('[abc\udcff]')
+
+
+# normalize the filesystem encoding name.
+# For example, we expect "utf-8", not "UTF8".
+FS_ENCODING = codecs.lookup(FS_ENCODING).name
+
+
+def register_surrogateescape():
+ """
+ Registers the surrogateescape error handler on Python 2 (only)
+ """
+ if utils.PY3:
+ return
+ try:
+ codecs.lookup_error(FS_ERRORS)
+ except LookupError:
+ codecs.register_error(FS_ERRORS, surrogateescape_handler)
+
+
+if True:
+ # Tests:
+ register_surrogateescape()
+
+ b = decodefilename(fn)
+ assert b == encoded, "%r != %r" % (b, encoded)
+ c = encodefilename(b)
+ assert c == fn, '%r != %r' % (c, fn)
+ # print("ok")
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/__init__.py
new file mode 100644
index 0000000..4cb1cbc
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/__init__.py
@@ -0,0 +1 @@
+# empty to make this a package
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixer_util.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixer_util.py
new file mode 100644
index 0000000..0013437
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixer_util.py
@@ -0,0 +1,476 @@
+"""
+Utility functions from 2to3, 3to2 and python-modernize (and some home-grown
+ones).
+
+Licences:
+2to3: PSF License v2
+3to2: Apache Software License (from 3to2/setup.py)
+python-modernize licence: BSD (from python-modernize/LICENSE)
+"""
+
+from lib2to3.fixer_util import (FromImport, Newline, is_import,
+ find_root, does_tree_import, Comma)
+from lib2to3.pytree import Leaf, Node
+from lib2to3.pygram import python_symbols as syms, python_grammar
+from lib2to3.pygram import token
+from lib2to3.fixer_util import (Node, Call, Name, syms, Comma, Number)
+import re
+
+
+## These functions are from 3to2 by Joe Amenta:
+
+def Star(prefix=None):
+ return Leaf(token.STAR, u'*', prefix=prefix)
+
+def DoubleStar(prefix=None):
+ return Leaf(token.DOUBLESTAR, u'**', prefix=prefix)
+
+def Minus(prefix=None):
+ return Leaf(token.MINUS, u'-', prefix=prefix)
+
+def commatize(leafs):
+ u"""
+ Accepts/turns: (Name, Name, ..., Name, Name)
+ Returns/into: (Name, Comma, Name, Comma, ..., Name, Comma, Name)
+ """
+ new_leafs = []
+ for leaf in leafs:
+ new_leafs.append(leaf)
+ new_leafs.append(Comma())
+ del new_leafs[-1]
+ return new_leafs
+
+def indentation(node):
+ u"""
+ Returns the indentation for this node
+ Iff a node is in a suite, then it has indentation.
+ """
+ while node.parent is not None and node.parent.type != syms.suite:
+ node = node.parent
+ if node.parent is None:
+ return u""
+ # The first three children of a suite are NEWLINE, INDENT, (some other node)
+ # INDENT.value contains the indentation for this suite
+ # anything after (some other node) has the indentation as its prefix.
+ if node.type == token.INDENT:
+ return node.value
+ elif node.prev_sibling is not None and node.prev_sibling.type == token.INDENT:
+ return node.prev_sibling.value
+ elif node.prev_sibling is None:
+ return u""
+ else:
+ return node.prefix
+
+def indentation_step(node):
+ u"""
+ Dirty little trick to get the difference between each indentation level
+ Implemented by finding the shortest indentation string
+ (technically, the "least" of all of the indentation strings, but
+ tabs and spaces mixed won't get this far, so those are synonymous.)
+ """
+ r = find_root(node)
+ # Collect all indentations into one set.
+ all_indents = set(i.value for i in r.pre_order() if i.type == token.INDENT)
+ if not all_indents:
+ # nothing is indented anywhere, so we get to pick what we want
+ return u" " # four spaces is a popular convention
+ else:
+ return min(all_indents)
+
+def suitify(parent):
+ u"""
+ Turn the stuff after the first colon in parent's children
+ into a suite, if it wasn't already
+ """
+ for node in parent.children:
+ if node.type == syms.suite:
+ # already in the prefered format, do nothing
+ return
+
+ # One-liners have no suite node, we have to fake one up
+ for i, node in enumerate(parent.children):
+ if node.type == token.COLON:
+ break
+ else:
+ raise ValueError(u"No class suite and no ':'!")
+ # Move everything into a suite node
+ suite = Node(syms.suite, [Newline(), Leaf(token.INDENT, indentation(node) + indentation_step(node))])
+ one_node = parent.children[i+1]
+ one_node.remove()
+ one_node.prefix = u''
+ suite.append_child(one_node)
+ parent.append_child(suite)
+
+def NameImport(package, as_name=None, prefix=None):
+ u"""
+ Accepts a package (Name node), name to import it as (string), and
+ optional prefix and returns a node:
+ import [as ]
+ """
+ if prefix is None:
+ prefix = u""
+ children = [Name(u"import", prefix=prefix), package]
+ if as_name is not None:
+ children.extend([Name(u"as", prefix=u" "),
+ Name(as_name, prefix=u" ")])
+ return Node(syms.import_name, children)
+
+_compound_stmts = (syms.if_stmt, syms.while_stmt, syms.for_stmt, syms.try_stmt, syms.with_stmt)
+_import_stmts = (syms.import_name, syms.import_from)
+
+def import_binding_scope(node):
+ u"""
+ Generator yields all nodes for which a node (an import_stmt) has scope
+ The purpose of this is for a call to _find() on each of them
+ """
+ # import_name / import_from are small_stmts
+ assert node.type in _import_stmts
+ test = node.next_sibling
+ # A small_stmt can only be followed by a SEMI or a NEWLINE.
+ while test.type == token.SEMI:
+ nxt = test.next_sibling
+ # A SEMI can only be followed by a small_stmt or a NEWLINE
+ if nxt.type == token.NEWLINE:
+ break
+ else:
+ yield nxt
+ # A small_stmt can only be followed by either a SEMI or a NEWLINE
+ test = nxt.next_sibling
+ # Covered all subsequent small_stmts after the import_stmt
+ # Now to cover all subsequent stmts after the parent simple_stmt
+ parent = node.parent
+ assert parent.type == syms.simple_stmt
+ test = parent.next_sibling
+ while test is not None:
+ # Yes, this will yield NEWLINE and DEDENT. Deal with it.
+ yield test
+ test = test.next_sibling
+
+ context = parent.parent
+ # Recursively yield nodes following imports inside of a if/while/for/try/with statement
+ if context.type in _compound_stmts:
+ # import is in a one-liner
+ c = context
+ while c.next_sibling is not None:
+ yield c.next_sibling
+ c = c.next_sibling
+ context = context.parent
+
+ # Can't chain one-liners on one line, so that takes care of that.
+
+ p = context.parent
+ if p is None:
+ return
+
+ # in a multi-line suite
+
+ while p.type in _compound_stmts:
+
+ if context.type == syms.suite:
+ yield context
+
+ context = context.next_sibling
+
+ if context is None:
+ context = p.parent
+ p = context.parent
+ if p is None:
+ break
+
+def ImportAsName(name, as_name, prefix=None):
+ new_name = Name(name)
+ new_as = Name(u"as", prefix=u" ")
+ new_as_name = Name(as_name, prefix=u" ")
+ new_node = Node(syms.import_as_name, [new_name, new_as, new_as_name])
+ if prefix is not None:
+ new_node.prefix = prefix
+ return new_node
+
+
+def future_import(feature, node):
+ """
+ This seems to work
+ """
+ root = find_root(node)
+
+ if does_tree_import(u"__future__", feature, node):
+ return
+
+ # Look for a shebang or encoding line
+ shebang_encoding_idx = None
+
+ for idx, node in enumerate(root.children):
+ # Is it a shebang or encoding line?
+ if is_shebang_comment(node) or is_encoding_comment(node):
+ shebang_encoding_idx = idx
+ if node.type == syms.simple_stmt and \
+ len(node.children) > 0 and node.children[0].type == token.STRING:
+ # skip over docstring
+ continue
+ names = check_future_import(node)
+ if not names:
+ # not a future statement; need to insert before this
+ break
+ if feature in names:
+ # already imported
+ return
+
+ import_ = FromImport(u'__future__', [Leaf(token.NAME, feature, prefix=" ")])
+ if shebang_encoding_idx == 0 and idx == 0:
+ # If this __future__ import would go on the first line,
+ # detach the shebang / encoding prefix from the current first line.
+ # and attach it to our new __future__ import node.
+ import_.prefix = root.children[0].prefix
+ root.children[0].prefix = u''
+ # End the __future__ import line with a newline and add a blank line
+ # afterwards:
+ children = [import_ , Newline()]
+ root.insert_child(idx, Node(syms.simple_stmt, children))
+
+
+def future_import2(feature, node):
+ """
+ An alternative to future_import() which might not work ...
+ """
+ root = find_root(node)
+
+ if does_tree_import(u"__future__", feature, node):
+ return
+
+ insert_pos = 0
+ for idx, node in enumerate(root.children):
+ if node.type == syms.simple_stmt and node.children and \
+ node.children[0].type == token.STRING:
+ insert_pos = idx + 1
+ break
+
+ for thing_after in root.children[insert_pos:]:
+ if thing_after.type == token.NEWLINE:
+ insert_pos += 1
+ continue
+
+ prefix = thing_after.prefix
+ thing_after.prefix = u""
+ break
+ else:
+ prefix = u""
+
+ import_ = FromImport(u"__future__", [Leaf(token.NAME, feature, prefix=u" ")])
+
+ children = [import_, Newline()]
+ root.insert_child(insert_pos, Node(syms.simple_stmt, children, prefix=prefix))
+
+def parse_args(arglist, scheme):
+ u"""
+ Parse a list of arguments into a dict
+ """
+ arglist = [i for i in arglist if i.type != token.COMMA]
+
+ ret_mapping = dict([(k, None) for k in scheme])
+
+ for i, arg in enumerate(arglist):
+ if arg.type == syms.argument and arg.children[1].type == token.EQUAL:
+ # argument < NAME '=' any >
+ slot = arg.children[0].value
+ ret_mapping[slot] = arg.children[2]
+ else:
+ slot = scheme[i]
+ ret_mapping[slot] = arg
+
+ return ret_mapping
+
+
+# def is_import_from(node):
+# """Returns true if the node is a statement "from ... import ..."
+# """
+# return node.type == syms.import_from
+
+
+def is_import_stmt(node):
+ return (node.type == syms.simple_stmt and node.children and
+ is_import(node.children[0]))
+
+
+def touch_import_top(package, name_to_import, node):
+ """Works like `does_tree_import` but adds an import statement at the
+ top if it was not imported (but below any __future__ imports).
+
+ Based on lib2to3.fixer_util.touch_import()
+
+ Calling this multiple times adds the imports in reverse order.
+
+ Also adds "standard_library.install_aliases()" after "from future import
+ standard_library". This should probably be factored into another function.
+ """
+
+ root = find_root(node)
+
+ if does_tree_import(package, name_to_import, root):
+ return
+
+ # Ideally, we would look for whether futurize --all-imports has been run,
+ # as indicated by the presence of ``from builtins import (ascii, ...,
+ # zip)`` -- and, if it has, we wouldn't import the name again.
+
+ # Look for __future__ imports and insert below them
+ found = False
+ for name in ['absolute_import', 'division', 'print_function',
+ 'unicode_literals']:
+ if does_tree_import('__future__', name, root):
+ found = True
+ break
+ if found:
+ # At least one __future__ import. We want to loop until we've seen them
+ # all.
+ start, end = None, None
+ for idx, node in enumerate(root.children):
+ if check_future_import(node):
+ start = idx
+ # Start looping
+ idx2 = start
+ while node:
+ node = node.next_sibling
+ idx2 += 1
+ if not check_future_import(node):
+ end = idx2
+ break
+ break
+ assert start is not None
+ assert end is not None
+ insert_pos = end
+ else:
+ # No __future__ imports.
+ # We look for a docstring and insert the new node below that. If no docstring
+ # exists, just insert the node at the top.
+ for idx, node in enumerate(root.children):
+ if node.type != syms.simple_stmt:
+ break
+ if not (node.children and node.children[0].type == token.STRING):
+ # This is the usual case.
+ break
+ insert_pos = idx
+
+ if package is None:
+ import_ = Node(syms.import_name, [
+ Leaf(token.NAME, u"import"),
+ Leaf(token.NAME, name_to_import, prefix=u" ")
+ ])
+ else:
+ import_ = FromImport(package, [Leaf(token.NAME, name_to_import, prefix=u" ")])
+ if name_to_import == u'standard_library':
+ # Add:
+ # standard_library.install_aliases()
+ # after:
+ # from future import standard_library
+ install_hooks = Node(syms.simple_stmt,
+ [Node(syms.power,
+ [Leaf(token.NAME, u'standard_library'),
+ Node(syms.trailer, [Leaf(token.DOT, u'.'),
+ Leaf(token.NAME, u'install_aliases')]),
+ Node(syms.trailer, [Leaf(token.LPAR, u'('),
+ Leaf(token.RPAR, u')')])
+ ])
+ ]
+ )
+ children_hooks = [install_hooks, Newline()]
+ else:
+ children_hooks = []
+
+ FromImport(package, [Leaf(token.NAME, name_to_import, prefix=u" ")])
+
+ children_import = [import_, Newline()]
+ root.insert_child(insert_pos, Node(syms.simple_stmt, children_import))
+ if len(children_hooks) > 0:
+ root.insert_child(insert_pos + 1, Node(syms.simple_stmt, children_hooks))
+
+
+## The following functions are from python-modernize by Armin Ronacher:
+# (a little edited).
+
+def check_future_import(node):
+ """If this is a future import, return set of symbols that are imported,
+ else return None."""
+ # node should be the import statement here
+ savenode = node
+ if not (node.type == syms.simple_stmt and node.children):
+ return set()
+ node = node.children[0]
+ # now node is the import_from node
+ if not (node.type == syms.import_from and
+ # node.type == token.NAME and # seems to break it
+ hasattr(node.children[1], 'value') and
+ node.children[1].value == u'__future__'):
+ return set()
+ node = node.children[3]
+ # now node is the import_as_name[s]
+ # print(python_grammar.number2symbol[node.type]) # breaks sometimes
+ if node.type == syms.import_as_names:
+ result = set()
+ for n in node.children:
+ if n.type == token.NAME:
+ result.add(n.value)
+ elif n.type == syms.import_as_name:
+ n = n.children[0]
+ assert n.type == token.NAME
+ result.add(n.value)
+ return result
+ elif node.type == syms.import_as_name:
+ node = node.children[0]
+ assert node.type == token.NAME
+ return set([node.value])
+ elif node.type == token.NAME:
+ return set([node.value])
+ else:
+ # TODO: handle brackets like this:
+ # from __future__ import (absolute_import, division)
+ assert False, "strange import: %s" % savenode
+
+
+SHEBANG_REGEX = r'^#!.*python'
+ENCODING_REGEX = r"^#.*coding[:=]\s*([-\w.]+)"
+
+
+def is_shebang_comment(node):
+ """
+ Comments are prefixes for Leaf nodes. Returns whether the given node has a
+ prefix that looks like a shebang line or an encoding line:
+
+ #!/usr/bin/env python
+ #!/usr/bin/python3
+ """
+ return bool(re.match(SHEBANG_REGEX, node.prefix))
+
+
+def is_encoding_comment(node):
+ """
+ Comments are prefixes for Leaf nodes. Returns whether the given node has a
+ prefix that looks like an encoding line:
+
+ # coding: utf-8
+ # encoding: utf-8
+ # -*- coding: -*-
+ # vim: set fileencoding= :
+ """
+ return bool(re.match(ENCODING_REGEX, node.prefix))
+
+
+def wrap_in_fn_call(fn_name, args, prefix=None):
+ """
+ Example:
+ >>> wrap_in_fn_call("oldstr", (arg,))
+ oldstr(arg)
+
+ >>> wrap_in_fn_call("olddiv", (arg1, arg2))
+ olddiv(arg1, arg2)
+ """
+ assert len(args) > 0
+ if len(args) == 1:
+ newargs = args
+ elif len(args) == 2:
+ expr1, expr2 = args
+ newargs = [expr1, Comma(), expr2]
+ else:
+ assert NotImplementedError('write me')
+ return Call(Name(fn_name), newargs, prefix=prefix)
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/__init__.py
new file mode 100644
index 0000000..556abe8
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/__init__.py
@@ -0,0 +1,97 @@
+import sys
+from lib2to3 import refactor
+
+# The following fixers are "safe": they convert Python 2 code to more
+# modern Python 2 code. They should be uncontroversial to apply to most
+# projects that are happy to drop support for Py2.5 and below. Applying
+# them first will reduce the size of the patch set for the real porting.
+lib2to3_fix_names_stage1 = set([
+ 'lib2to3.fixes.fix_apply',
+ 'lib2to3.fixes.fix_except',
+ 'lib2to3.fixes.fix_exitfunc',
+ 'lib2to3.fixes.fix_funcattrs',
+ 'lib2to3.fixes.fix_has_key',
+ 'lib2to3.fixes.fix_idioms',
+ # 'lib2to3.fixes.fix_import', # makes any implicit relative imports explicit. (Use with ``from __future__ import absolute_import)
+ 'lib2to3.fixes.fix_intern',
+ 'lib2to3.fixes.fix_isinstance',
+ 'lib2to3.fixes.fix_methodattrs',
+ 'lib2to3.fixes.fix_ne',
+ # 'lib2to3.fixes.fix_next', # would replace ``next`` method names
+ # with ``__next__``.
+ 'lib2to3.fixes.fix_numliterals', # turns 1L into 1, 0755 into 0o755
+ 'lib2to3.fixes.fix_paren',
+ # 'lib2to3.fixes.fix_print', # see the libfuturize fixer that also
+ # adds ``from __future__ import print_function``
+ # 'lib2to3.fixes.fix_raise', # uses incompatible with_traceback() method on exceptions
+ 'lib2to3.fixes.fix_reduce', # reduce is available in functools on Py2.6/Py2.7
+ 'lib2to3.fixes.fix_renames', # sys.maxint -> sys.maxsize
+ # 'lib2to3.fixes.fix_set_literal', # this is unnecessary and breaks Py2.6 support
+ 'lib2to3.fixes.fix_repr',
+ 'lib2to3.fixes.fix_standarderror',
+ 'lib2to3.fixes.fix_sys_exc',
+ 'lib2to3.fixes.fix_throw',
+ 'lib2to3.fixes.fix_tuple_params',
+ 'lib2to3.fixes.fix_types',
+ 'lib2to3.fixes.fix_ws_comma', # can perhaps decrease readability: see issue #58
+ 'lib2to3.fixes.fix_xreadlines',
+])
+
+# The following fixers add a dependency on the ``future`` package on order to
+# support Python 2:
+lib2to3_fix_names_stage2 = set([
+ 'lib2to3.fixes.fix_basestring',
+ # 'lib2to3.fixes.fix_buffer', # perhaps not safe. Test this.
+ # 'lib2to3.fixes.fix_callable', # not needed in Py3.2+
+ 'lib2to3.fixes.fix_dict', # TODO: add support for utils.viewitems() etc. and move to stage2
+ 'lib2to3.fixes.fix_exec',
+ # 'lib2to3.fixes.fix_execfile', # some problems: see issue #37.
+ # We use a custom fixer instead (see below)
+ # 'lib2to3.fixes.fix_future', # we don't want to remove __future__ imports
+ 'lib2to3.fixes.fix_getcwdu',
+ # 'lib2to3.fixes.fix_imports', # called by libfuturize.fixes.fix_future_standard_library
+ # 'lib2to3.fixes.fix_imports2', # we don't handle this yet (dbm)
+ 'lib2to3.fixes.fix_input',
+ 'lib2to3.fixes.fix_itertools',
+ 'lib2to3.fixes.fix_itertools_imports',
+ 'lib2to3.fixes.fix_filter',
+ 'lib2to3.fixes.fix_long',
+ 'lib2to3.fixes.fix_map',
+ # 'lib2to3.fixes.fix_metaclass', # causes SyntaxError in Py2! Use the one from ``six`` instead
+ 'lib2to3.fixes.fix_next',
+ 'lib2to3.fixes.fix_nonzero', # TODO: cause this to import ``object`` and/or add a decorator for mapping __bool__ to __nonzero__
+ 'lib2to3.fixes.fix_operator', # we will need support for this by e.g. extending the Py2 operator module to provide those functions in Py3
+ 'lib2to3.fixes.fix_raw_input',
+ # 'lib2to3.fixes.fix_unicode', # strips off the u'' prefix, which removes a potentially helpful source of information for disambiguating unicode/byte strings
+ # 'lib2to3.fixes.fix_urllib', # included in libfuturize.fix_future_standard_library_urllib
+ # 'lib2to3.fixes.fix_xrange', # custom one because of a bug with Py3.3's lib2to3
+ 'lib2to3.fixes.fix_zip',
+])
+
+libfuturize_fix_names_stage1 = set([
+ 'libfuturize.fixes.fix_absolute_import',
+ 'libfuturize.fixes.fix_next_call', # obj.next() -> next(obj). Unlike
+ # lib2to3.fixes.fix_next, doesn't change
+ # the ``next`` method to ``__next__``.
+ 'libfuturize.fixes.fix_print_with_import',
+ 'libfuturize.fixes.fix_raise',
+ # 'libfuturize.fixes.fix_order___future__imports', # TODO: consolidate to a single line to simplify testing
+])
+
+libfuturize_fix_names_stage2 = set([
+ # 'libfuturize.fixes.fix_add__future__imports_except_unicode_literals', # just in case
+ 'libfuturize.fixes.fix_cmp',
+ 'libfuturize.fixes.fix_division_safe',
+ 'libfuturize.fixes.fix_execfile',
+ 'libfuturize.fixes.fix_future_builtins',
+ 'libfuturize.fixes.fix_future_standard_library',
+ 'libfuturize.fixes.fix_future_standard_library_urllib',
+ 'libfuturize.fixes.fix_metaclass',
+ 'libpasteurize.fixes.fix_newstyle',
+ 'libfuturize.fixes.fix_object',
+ # 'libfuturize.fixes.fix_order___future__imports', # TODO: consolidate to a single line to simplify testing
+ 'libfuturize.fixes.fix_unicode_keep_u',
+ # 'libfuturize.fixes.fix_unicode_literals_import',
+ 'libfuturize.fixes.fix_xrange_with_import', # custom one because of a bug with Py3.3's lib2to3
+])
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_UserDict.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_UserDict.py
new file mode 100644
index 0000000..d028b31
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_UserDict.py
@@ -0,0 +1,104 @@
+"""Fix UserDict.
+
+Incomplete!
+
+TODO: base this on fix_urllib perhaps?
+"""
+
+
+# Local imports
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Name, attr_chain
+from lib2to3.fixes.fix_imports import alternates, build_pattern, FixImports
+
+MAPPING = {'UserDict': 'collections',
+}
+
+# def alternates(members):
+# return "(" + "|".join(map(repr, members)) + ")"
+#
+#
+# def build_pattern(mapping=MAPPING):
+# mod_list = ' | '.join(["module_name='%s'" % key for key in mapping])
+# bare_names = alternates(mapping.keys())
+#
+# yield """name_import=import_name< 'import' ((%s) |
+# multiple_imports=dotted_as_names< any* (%s) any* >) >
+# """ % (mod_list, mod_list)
+# yield """import_from< 'from' (%s) 'import' ['(']
+# ( any | import_as_name< any 'as' any > |
+# import_as_names< any* >) [')'] >
+# """ % mod_list
+# yield """import_name< 'import' (dotted_as_name< (%s) 'as' any > |
+# multiple_imports=dotted_as_names<
+# any* dotted_as_name< (%s) 'as' any > any* >) >
+# """ % (mod_list, mod_list)
+#
+# # Find usages of module members in code e.g. thread.foo(bar)
+# yield "power< bare_with_attr=(%s) trailer<'.' any > any* >" % bare_names
+
+
+# class FixUserDict(fixer_base.BaseFix):
+class FixUserdict(FixImports):
+
+ BM_compatible = True
+ keep_line_order = True
+ # This is overridden in fix_imports2.
+ mapping = MAPPING
+
+ # We want to run this fixer late, so fix_import doesn't try to make stdlib
+ # renames into relative imports.
+ run_order = 6
+
+ def build_pattern(self):
+ return "|".join(build_pattern(self.mapping))
+
+ def compile_pattern(self):
+ # We override this, so MAPPING can be pragmatically altered and the
+ # changes will be reflected in PATTERN.
+ self.PATTERN = self.build_pattern()
+ super(FixImports, self).compile_pattern()
+
+ # Don't match the node if it's within another match.
+ def match(self, node):
+ match = super(FixImports, self).match
+ results = match(node)
+ if results:
+ # Module usage could be in the trailer of an attribute lookup, so we
+ # might have nested matches when "bare_with_attr" is present.
+ if "bare_with_attr" not in results and \
+ any(match(obj) for obj in attr_chain(node, "parent")):
+ return False
+ return results
+ return False
+
+ def start_tree(self, tree, filename):
+ super(FixImports, self).start_tree(tree, filename)
+ self.replace = {}
+
+ def transform(self, node, results):
+ import_mod = results.get("module_name")
+ if import_mod:
+ mod_name = import_mod.value
+ new_name = unicode(self.mapping[mod_name])
+ import_mod.replace(Name(new_name, prefix=import_mod.prefix))
+ if "name_import" in results:
+ # If it's not a "from x import x, y" or "import x as y" import,
+ # marked its usage to be replaced.
+ self.replace[mod_name] = new_name
+ if "multiple_imports" in results:
+ # This is a nasty hack to fix multiple imports on a line (e.g.,
+ # "import StringIO, urlparse"). The problem is that I can't
+ # figure out an easy way to make a pattern recognize the keys of
+ # MAPPING randomly sprinkled in an import statement.
+ results = self.match(node)
+ if results:
+ self.transform(node, results)
+ else:
+ # Replace usage of the module.
+ import pdb; pdb.set_trace()
+ bare_name = results["bare_with_attr"][0]
+ new_name = self.replace.get(bare_name.value)
+ if new_name:
+ bare_name.replace(Name(new_name, prefix=bare_name.prefix))
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_absolute_import.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_absolute_import.py
new file mode 100644
index 0000000..ab6a764
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_absolute_import.py
@@ -0,0 +1,92 @@
+"""
+Fixer for import statements, with a __future__ import line.
+
+Based on lib2to3/fixes/fix_import.py, but extended slightly so it also
+supports Cython modules.
+
+If spam is being imported from the local directory, this import:
+ from spam import eggs
+becomes:
+ from __future__ import absolute_import
+ from .spam import eggs
+
+and this import:
+ import spam
+becomes:
+ from __future__ import absolute_import
+ from . import spam
+"""
+
+from os.path import dirname, join, exists, sep
+from lib2to3.fixes.fix_import import FixImport
+from lib2to3.fixer_util import FromImport, syms
+from lib2to3.fixes.fix_import import traverse_imports
+
+from libfuturize.fixer_util import future_import
+
+
+class FixAbsoluteImport(FixImport):
+ run_order = 9
+
+ def transform(self, node, results):
+ """
+ Copied from FixImport.transform(), but with this line added in
+ any modules that had implicit relative imports changed:
+
+ from __future__ import absolute_import"
+ """
+ if self.skip:
+ return
+ imp = results['imp']
+
+ if node.type == syms.import_from:
+ # Some imps are top-level (eg: 'import ham')
+ # some are first level (eg: 'import ham.eggs')
+ # some are third level (eg: 'import ham.eggs as spam')
+ # Hence, the loop
+ while not hasattr(imp, 'value'):
+ imp = imp.children[0]
+ if self.probably_a_local_import(imp.value):
+ imp.value = u"." + imp.value
+ imp.changed()
+ future_import(u"absolute_import", node)
+ else:
+ have_local = False
+ have_absolute = False
+ for mod_name in traverse_imports(imp):
+ if self.probably_a_local_import(mod_name):
+ have_local = True
+ else:
+ have_absolute = True
+ if have_absolute:
+ if have_local:
+ # We won't handle both sibling and absolute imports in the
+ # same statement at the moment.
+ self.warning(node, "absolute and local imports together")
+ return
+
+ new = FromImport(u".", [imp])
+ new.prefix = node.prefix
+ future_import(u"absolute_import", node)
+ return new
+
+ def probably_a_local_import(self, imp_name):
+ """
+ Like the corresponding method in the base class, but this also
+ supports Cython modules.
+ """
+ if imp_name.startswith(u"."):
+ # Relative imports are certainly not local imports.
+ return False
+ imp_name = imp_name.split(u".", 1)[0]
+ base_path = dirname(self.filename)
+ base_path = join(base_path, imp_name)
+ # If there is no __init__.py next to the file its not in a package
+ # so can't be a relative import.
+ if not exists(join(dirname(base_path), "__init__.py")):
+ return False
+ for ext in [".py", sep, ".pyc", ".so", ".sl", ".pyd", ".pyx"]:
+ if exists(base_path + ext):
+ return True
+ return False
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_add__future__imports_except_unicode_literals.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_add__future__imports_except_unicode_literals.py
new file mode 100644
index 0000000..1904d37
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_add__future__imports_except_unicode_literals.py
@@ -0,0 +1,27 @@
+"""
+Fixer for adding:
+
+ from __future__ import absolute_import
+ from __future__ import division
+ from __future__ import print_function
+
+This is "stage 1": hopefully uncontroversial changes.
+
+Stage 2 adds ``unicode_literals``.
+"""
+
+from lib2to3 import fixer_base
+from libfuturize.fixer_util import future_import
+
+class FixAddFutureImportsExceptUnicodeLiterals(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "file_input"
+
+ run_order = 9
+
+ def transform(self, node, results):
+ # Reverse order:
+ future_import(u"print_function", node)
+ future_import(u"division", node)
+ future_import(u"absolute_import", node)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_bytes.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_bytes.py
new file mode 100644
index 0000000..4202122
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_bytes.py
@@ -0,0 +1,24 @@
+"""Optional fixer that changes all unprefixed string literals "..." to b"...".
+
+br'abcd' is a SyntaxError on Python 2 but valid on Python 3.
+ur'abcd' is a SyntaxError on Python 3 but valid on Python 2.
+
+"""
+from __future__ import unicode_literals
+
+import re
+from lib2to3.pgen2 import token
+from lib2to3 import fixer_base
+
+_literal_re = re.compile(r"[^bBuUrR]?[\'\"]")
+
+class FixBytes(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "STRING"
+
+ def transform(self, node, results):
+ if node.type == token.STRING:
+ if _literal_re.match(node.value):
+ new = node.clone()
+ new.value = u'b' + new.value
+ return new
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_cmp.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_cmp.py
new file mode 100644
index 0000000..be56507
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_cmp.py
@@ -0,0 +1,34 @@
+# coding: utf-8
+"""
+Fixer for the cmp() function on Py2, which was removed in Py3.
+
+Adds this import line::
+
+ from past.builtins import cmp
+
+if cmp() is called in the code.
+"""
+
+from __future__ import unicode_literals
+from lib2to3 import fixer_base
+
+from libfuturize.fixer_util import touch_import_top
+
+
+expression = "name='cmp'"
+
+
+class FixCmp(fixer_base.BaseFix):
+ BM_compatible = True
+ run_order = 9
+
+ PATTERN = """
+ power<
+ ({0}) trailer< '(' args=[any] ')' >
+ rest=any* >
+ """.format(expression)
+
+ def transform(self, node, results):
+ name = results["name"]
+ touch_import_top(u'past.builtins', name.value, node)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_division.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_division.py
new file mode 100644
index 0000000..4874550
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_division.py
@@ -0,0 +1,13 @@
+"""
+UNFINISHED
+For the ``future`` package.
+
+Adds this import line:
+
+ from __future__ import division
+
+at the top so the code runs identically on Py3 and Py2.6/2.7
+"""
+
+from libpasteurize.fixes.fix_division import FixDivision
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_division_safe.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_division_safe.py
new file mode 100644
index 0000000..5e16b0a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_division_safe.py
@@ -0,0 +1,72 @@
+"""
+For the ``future`` package.
+
+Adds this import line:
+
+ from __future__ import division
+
+at the top and changes any old-style divisions to be calls to
+past.utils.old_div so the code runs as before on Py2.6/2.7 and has the same
+behaviour on Py3.
+
+If "from __future__ import division" is already in effect, this fixer does
+nothing.
+"""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import syms, does_tree_import
+from libfuturize.fixer_util import (token, future_import, touch_import_top,
+ wrap_in_fn_call)
+
+
+def match_division(node):
+ u"""
+ __future__.division redefines the meaning of a single slash for division,
+ so we match that and only that.
+ """
+ slash = token.SLASH
+ return node.type == slash and not node.next_sibling.type == slash and \
+ not node.prev_sibling.type == slash
+
+
+class FixDivisionSafe(fixer_base.BaseFix):
+ # BM_compatible = True
+ run_order = 4 # this seems to be ignored?
+
+ _accept_type = token.SLASH
+
+ PATTERN = """
+ term<(not('/') any)+ '/' ((not('/') any))>
+ """
+
+ def start_tree(self, tree, name):
+ """
+ Skip this fixer if "__future__.division" is already imported.
+ """
+ super(FixDivisionSafe, self).start_tree(tree, name)
+ self.skip = "division" in tree.future_features
+
+ def match(self, node):
+ u"""
+ Since the tree needs to be fixed once and only once if and only if it
+ matches, we can start discarding matches after the first.
+ """
+ if (node.type == self.syms.term and
+ len(node.children) == 3 and
+ match_division(node.children[1])):
+ expr1, expr2 = node.children[0], node.children[2]
+ return expr1, expr2
+ else:
+ return False
+
+ def transform(self, node, results):
+ if self.skip:
+ return
+ future_import(u"division", node)
+
+ touch_import_top(u'past.utils', u'old_div', node)
+ expr1, expr2 = results[0].clone(), results[1].clone()
+ # Strip any leading space for the first number:
+ expr1.prefix = u''
+ return wrap_in_fn_call("old_div", (expr1, expr2), prefix=node.prefix)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_execfile.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_execfile.py
new file mode 100644
index 0000000..2b794c8
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_execfile.py
@@ -0,0 +1,38 @@
+# coding: utf-8
+"""
+Fixer for the execfile() function on Py2, which was removed in Py3.
+
+The Lib/lib2to3/fixes/fix_execfile.py module has some problems: see
+python-future issue #37. This fixer merely imports execfile() from
+past.builtins and leaves the code alone.
+
+Adds this import line::
+
+ from past.builtins import execfile
+
+for the function execfile() that was removed from Py3.
+"""
+
+from __future__ import unicode_literals
+from lib2to3 import fixer_base
+
+from libfuturize.fixer_util import touch_import_top
+
+
+expression = "name='execfile'"
+
+
+class FixExecfile(fixer_base.BaseFix):
+ BM_compatible = True
+ run_order = 9
+
+ PATTERN = """
+ power<
+ ({0}) trailer< '(' args=[any] ')' >
+ rest=any* >
+ """.format(expression)
+
+ def transform(self, node, results):
+ name = results["name"]
+ touch_import_top(u'past.builtins', name.value, node)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_future_builtins.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_future_builtins.py
new file mode 100644
index 0000000..bf3aba4
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_future_builtins.py
@@ -0,0 +1,60 @@
+"""
+For the ``future`` package.
+
+Adds this import line::
+
+ from builtins import XYZ
+
+for each of the functions XYZ that is used in the module.
+
+Adds these imports after any other imports (in an initial block of them).
+"""
+
+from __future__ import unicode_literals
+
+from lib2to3 import fixer_base
+from lib2to3.pygram import python_symbols as syms
+from lib2to3.fixer_util import Name, Call, in_special_context
+
+from libfuturize.fixer_util import touch_import_top
+
+# All builtins are:
+# from future.builtins.iterators import (filter, map, zip)
+# from future.builtins.misc import (ascii, chr, hex, input, isinstance, oct, open, round, super)
+# from future.types import (bytes, dict, int, range, str)
+# We don't need isinstance any more.
+
+replaced_builtin_fns = '''filter map zip
+ ascii chr hex input next oct
+ bytes range str raw_input'''.split()
+ # This includes raw_input as a workaround for the
+ # lib2to3 fixer for raw_input on Py3 (only), allowing
+ # the correct import to be included. (Py3 seems to run
+ # the fixers the wrong way around, perhaps ignoring the
+ # run_order class attribute below ...)
+
+expression = '|'.join(["name='{0}'".format(name) for name in replaced_builtin_fns])
+
+
+class FixFutureBuiltins(fixer_base.BaseFix):
+ BM_compatible = True
+ run_order = 7
+
+ # Currently we only match uses as a function. This doesn't match e.g.:
+ # if isinstance(s, str):
+ # ...
+ PATTERN = """
+ power<
+ ({0}) trailer< '(' [arglist=any] ')' >
+ rest=any* >
+ |
+ power<
+ 'map' trailer< '(' [arglist=any] ')' >
+ >
+ """.format(expression)
+
+ def transform(self, node, results):
+ name = results["name"]
+ touch_import_top(u'builtins', name.value, node)
+ # name.replace(Name(u"input", prefix=name.prefix))
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_future_standard_library.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_future_standard_library.py
new file mode 100644
index 0000000..501c2a9
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_future_standard_library.py
@@ -0,0 +1,26 @@
+"""
+For the ``future`` package.
+
+Changes any imports needed to reflect the standard library reorganization. Also
+Also adds these import lines:
+
+ from future import standard_library
+ standard_library.install_aliases()
+
+after any __future__ imports but before any other imports.
+"""
+
+from lib2to3.fixes.fix_imports import FixImports
+from libfuturize.fixer_util import touch_import_top
+
+
+class FixFutureStandardLibrary(FixImports):
+ run_order = 8
+
+ def transform(self, node, results):
+ result = super(FixFutureStandardLibrary, self).transform(node, results)
+ # TODO: add a blank line between any __future__ imports and this?
+ touch_import_top(u'future', u'standard_library', node)
+ return result
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_future_standard_library_urllib.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_future_standard_library_urllib.py
new file mode 100644
index 0000000..3d62959
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_future_standard_library_urllib.py
@@ -0,0 +1,30 @@
+"""
+For the ``future`` package.
+
+A special fixer that ensures that these lines have been added::
+
+ from future import standard_library
+ standard_library.install_hooks()
+
+even if the only module imported was ``urllib``, in which case the regular fixer
+wouldn't have added these lines.
+
+"""
+
+from lib2to3.fixes.fix_urllib import FixUrllib
+from libfuturize.fixer_util import touch_import_top, find_root
+
+
+class FixFutureStandardLibraryUrllib(FixUrllib): # not a subclass of FixImports
+ run_order = 8
+
+ def transform(self, node, results):
+ # transform_member() in lib2to3/fixes/fix_urllib.py breaks node so find_root(node)
+ # no longer works after the super() call below. So we find the root first:
+ root = find_root(node)
+ result = super(FixFutureStandardLibraryUrllib, self).transform(node, results)
+ # TODO: add a blank line between any __future__ imports and this?
+ touch_import_top(u'future', u'standard_library', root)
+ return result
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_metaclass.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_metaclass.py
new file mode 100644
index 0000000..a917341
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_metaclass.py
@@ -0,0 +1,257 @@
+# coding: utf-8
+"""Fixer for __metaclass__ = X -> (future.utils.with_metaclass(X)) methods.
+
+ The various forms of classef (inherits nothing, inherits once, inherints
+ many) don't parse the same in the CST so we look at ALL classes for
+ a __metaclass__ and if we find one normalize the inherits to all be
+ an arglist.
+
+ For one-liner classes ('class X: pass') there is no indent/dedent so
+ we normalize those into having a suite.
+
+ Moving the __metaclass__ into the classdef can also cause the class
+ body to be empty so there is some special casing for that as well.
+
+ This fixer also tries very hard to keep original indenting and spacing
+ in all those corner cases.
+"""
+# This is a derived work of Lib/lib2to3/fixes/fix_metaclass.py under the
+# copyright of the Python Software Foundation, licensed under the Python
+# Software Foundation License 2.
+#
+# Copyright notice:
+#
+# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+# 2011, 2012, 2013 Python Software Foundation. All rights reserved.
+#
+# Full license text: http://docs.python.org/3.4/license.html
+
+# Author: Jack Diederich, Daniel Neuhäuser
+
+# Local imports
+from lib2to3 import fixer_base
+from lib2to3.pygram import token
+from lib2to3.fixer_util import Name, syms, Node, Leaf, touch_import, Call, \
+ String, Comma, parenthesize
+
+
+def has_metaclass(parent):
+ """ we have to check the cls_node without changing it.
+ There are two possiblities:
+ 1) clsdef => suite => simple_stmt => expr_stmt => Leaf('__meta')
+ 2) clsdef => simple_stmt => expr_stmt => Leaf('__meta')
+ """
+ for node in parent.children:
+ if node.type == syms.suite:
+ return has_metaclass(node)
+ elif node.type == syms.simple_stmt and node.children:
+ expr_node = node.children[0]
+ if expr_node.type == syms.expr_stmt and expr_node.children:
+ left_side = expr_node.children[0]
+ if isinstance(left_side, Leaf) and \
+ left_side.value == '__metaclass__':
+ return True
+ return False
+
+
+def fixup_parse_tree(cls_node):
+ """ one-line classes don't get a suite in the parse tree so we add
+ one to normalize the tree
+ """
+ for node in cls_node.children:
+ if node.type == syms.suite:
+ # already in the preferred format, do nothing
+ return
+
+ # !%@#! oneliners have no suite node, we have to fake one up
+ for i, node in enumerate(cls_node.children):
+ if node.type == token.COLON:
+ break
+ else:
+ raise ValueError("No class suite and no ':'!")
+
+ # move everything into a suite node
+ suite = Node(syms.suite, [])
+ while cls_node.children[i+1:]:
+ move_node = cls_node.children[i+1]
+ suite.append_child(move_node.clone())
+ move_node.remove()
+ cls_node.append_child(suite)
+ node = suite
+
+
+def fixup_simple_stmt(parent, i, stmt_node):
+ """ if there is a semi-colon all the parts count as part of the same
+ simple_stmt. We just want the __metaclass__ part so we move
+ everything efter the semi-colon into its own simple_stmt node
+ """
+ for semi_ind, node in enumerate(stmt_node.children):
+ if node.type == token.SEMI: # *sigh*
+ break
+ else:
+ return
+
+ node.remove() # kill the semicolon
+ new_expr = Node(syms.expr_stmt, [])
+ new_stmt = Node(syms.simple_stmt, [new_expr])
+ while stmt_node.children[semi_ind:]:
+ move_node = stmt_node.children[semi_ind]
+ new_expr.append_child(move_node.clone())
+ move_node.remove()
+ parent.insert_child(i, new_stmt)
+ new_leaf1 = new_stmt.children[0].children[0]
+ old_leaf1 = stmt_node.children[0].children[0]
+ new_leaf1.prefix = old_leaf1.prefix
+
+
+def remove_trailing_newline(node):
+ if node.children and node.children[-1].type == token.NEWLINE:
+ node.children[-1].remove()
+
+
+def find_metas(cls_node):
+ # find the suite node (Mmm, sweet nodes)
+ for node in cls_node.children:
+ if node.type == syms.suite:
+ break
+ else:
+ raise ValueError("No class suite!")
+
+ # look for simple_stmt[ expr_stmt[ Leaf('__metaclass__') ] ]
+ for i, simple_node in list(enumerate(node.children)):
+ if simple_node.type == syms.simple_stmt and simple_node.children:
+ expr_node = simple_node.children[0]
+ if expr_node.type == syms.expr_stmt and expr_node.children:
+ # Check if the expr_node is a simple assignment.
+ left_node = expr_node.children[0]
+ if isinstance(left_node, Leaf) and \
+ left_node.value == u'__metaclass__':
+ # We found a assignment to __metaclass__.
+ fixup_simple_stmt(node, i, simple_node)
+ remove_trailing_newline(simple_node)
+ yield (node, i, simple_node)
+
+
+def fixup_indent(suite):
+ """ If an INDENT is followed by a thing with a prefix then nuke the prefix
+ Otherwise we get in trouble when removing __metaclass__ at suite start
+ """
+ kids = suite.children[::-1]
+ # find the first indent
+ while kids:
+ node = kids.pop()
+ if node.type == token.INDENT:
+ break
+
+ # find the first Leaf
+ while kids:
+ node = kids.pop()
+ if isinstance(node, Leaf) and node.type != token.DEDENT:
+ if node.prefix:
+ node.prefix = u''
+ return
+ else:
+ kids.extend(node.children[::-1])
+
+
+class FixMetaclass(fixer_base.BaseFix):
+ BM_compatible = True
+
+ PATTERN = """
+ classdef
+ """
+
+ def transform(self, node, results):
+ if not has_metaclass(node):
+ return
+
+ fixup_parse_tree(node)
+
+ # find metaclasses, keep the last one
+ last_metaclass = None
+ for suite, i, stmt in find_metas(node):
+ last_metaclass = stmt
+ stmt.remove()
+
+ text_type = node.children[0].type # always Leaf(nnn, 'class')
+
+ # figure out what kind of classdef we have
+ if len(node.children) == 7:
+ # Node(classdef, ['class', 'name', '(', arglist, ')', ':', suite])
+ # 0 1 2 3 4 5 6
+ if node.children[3].type == syms.arglist:
+ arglist = node.children[3]
+ # Node(classdef, ['class', 'name', '(', 'Parent', ')', ':', suite])
+ else:
+ parent = node.children[3].clone()
+ arglist = Node(syms.arglist, [parent])
+ node.set_child(3, arglist)
+ elif len(node.children) == 6:
+ # Node(classdef, ['class', 'name', '(', ')', ':', suite])
+ # 0 1 2 3 4 5
+ arglist = Node(syms.arglist, [])
+ node.insert_child(3, arglist)
+ elif len(node.children) == 4:
+ # Node(classdef, ['class', 'name', ':', suite])
+ # 0 1 2 3
+ arglist = Node(syms.arglist, [])
+ node.insert_child(2, Leaf(token.RPAR, u')'))
+ node.insert_child(2, arglist)
+ node.insert_child(2, Leaf(token.LPAR, u'('))
+ else:
+ raise ValueError("Unexpected class definition")
+
+ # Was: touch_import(None, u'future.utils', node)
+ touch_import(u'future.utils', u'with_metaclass', node)
+
+ metaclass = last_metaclass.children[0].children[2].clone()
+ metaclass.prefix = u''
+
+ arguments = [metaclass]
+
+ if arglist.children:
+ if len(arglist.children) == 1:
+ base = arglist.children[0].clone()
+ base.prefix = u' '
+ else:
+ # Unfortunately six.with_metaclass() only allows one base
+ # class, so we have to dynamically generate a base class if
+ # there is more than one.
+ bases = parenthesize(arglist.clone())
+ bases.prefix = u' '
+ base = Call(Name('type'), [
+ String("'NewBase'"),
+ Comma(),
+ bases,
+ Comma(),
+ Node(
+ syms.atom,
+ [Leaf(token.LBRACE, u'{'), Leaf(token.RBRACE, u'}')],
+ prefix=u' '
+ )
+ ], prefix=u' ')
+ arguments.extend([Comma(), base])
+
+ arglist.replace(Call(
+ Name(u'with_metaclass', prefix=arglist.prefix),
+ arguments
+ ))
+
+ fixup_indent(suite)
+
+ # check for empty suite
+ if not suite.children:
+ # one-liner that was just __metaclass_
+ suite.remove()
+ pass_leaf = Leaf(text_type, u'pass')
+ pass_leaf.prefix = orig_meta_prefix
+ node.append_child(pass_leaf)
+ node.append_child(Leaf(token.NEWLINE, u'\n'))
+
+ elif len(suite.children) > 1 and \
+ (suite.children[-2].type == token.INDENT and
+ suite.children[-1].type == token.DEDENT):
+ # there was only one line in the class body and it was __metaclass__
+ pass_leaf = Leaf(text_type, u'pass')
+ suite.insert_child(-1, pass_leaf)
+ suite.insert_child(-1, Leaf(token.NEWLINE, u'\n'))
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_next_call.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_next_call.py
new file mode 100644
index 0000000..282f185
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_next_call.py
@@ -0,0 +1,104 @@
+"""
+Based on fix_next.py by Collin Winter.
+
+Replaces it.next() -> next(it), per PEP 3114.
+
+Unlike fix_next.py, this fixer doesn't replace the name of a next method with __next__,
+which would break Python 2 compatibility without further help from fixers in
+stage 2.
+"""
+
+# Local imports
+from lib2to3.pgen2 import token
+from lib2to3.pygram import python_symbols as syms
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Name, Call, find_binding
+
+bind_warning = "Calls to builtin next() possibly shadowed by global binding"
+
+
+class FixNextCall(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = """
+ power< base=any+ trailer< '.' attr='next' > trailer< '(' ')' > >
+ |
+ power< head=any+ trailer< '.' attr='next' > not trailer< '(' ')' > >
+ |
+ global=global_stmt< 'global' any* 'next' any* >
+ """
+
+ order = "pre" # Pre-order tree traversal
+
+ def start_tree(self, tree, filename):
+ super(FixNextCall, self).start_tree(tree, filename)
+
+ n = find_binding('next', tree)
+ if n:
+ self.warning(n, bind_warning)
+ self.shadowed_next = True
+ else:
+ self.shadowed_next = False
+
+ def transform(self, node, results):
+ assert results
+
+ base = results.get("base")
+ attr = results.get("attr")
+ name = results.get("name")
+
+ if base:
+ if self.shadowed_next:
+ # Omit this:
+ # attr.replace(Name("__next__", prefix=attr.prefix))
+ pass
+ else:
+ base = [n.clone() for n in base]
+ base[0].prefix = ""
+ node.replace(Call(Name("next", prefix=node.prefix), base))
+ elif name:
+ # Omit this:
+ # n = Name("__next__", prefix=name.prefix)
+ # name.replace(n)
+ pass
+ elif attr:
+ # We don't do this transformation if we're assigning to "x.next".
+ # Unfortunately, it doesn't seem possible to do this in PATTERN,
+ # so it's being done here.
+ if is_assign_target(node):
+ head = results["head"]
+ if "".join([str(n) for n in head]).strip() == '__builtin__':
+ self.warning(node, bind_warning)
+ return
+ # Omit this:
+ # attr.replace(Name("__next__"))
+ elif "global" in results:
+ self.warning(node, bind_warning)
+ self.shadowed_next = True
+
+
+### The following functions help test if node is part of an assignment
+### target.
+
+def is_assign_target(node):
+ assign = find_assign(node)
+ if assign is None:
+ return False
+
+ for child in assign.children:
+ if child.type == token.EQUAL:
+ return False
+ elif is_subtree(child, node):
+ return True
+ return False
+
+def find_assign(node):
+ if node.type == syms.expr_stmt:
+ return node
+ if node.type == syms.simple_stmt or node.parent is None:
+ return None
+ return find_assign(node.parent)
+
+def is_subtree(root, node):
+ if root == node:
+ return True
+ return any(is_subtree(c, node) for c in root.children)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_object.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_object.py
new file mode 100644
index 0000000..accf2c5
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_object.py
@@ -0,0 +1,17 @@
+"""
+Fixer that adds ``from builtins import object`` if there is a line
+like this:
+ class Foo(object):
+"""
+
+from lib2to3 import fixer_base
+
+from libfuturize.fixer_util import touch_import_top
+
+
+class FixObject(fixer_base.BaseFix):
+
+ PATTERN = u"classdef< 'class' NAME '(' name='object' ')' colon=':' any >"
+
+ def transform(self, node, results):
+ touch_import_top(u'builtins', 'object', node)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_oldstr_wrap.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_oldstr_wrap.py
new file mode 100644
index 0000000..4258f6a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_oldstr_wrap.py
@@ -0,0 +1,80 @@
+"""
+For the ``future`` package.
+
+Adds this import line:
+
+ from past.builtins import str as oldstr
+
+at the top and wraps any unadorned string literals 'abc' or explicit byte-string
+literals b'abc' in oldstr() calls so the code has the same behaviour on Py3 as
+on Py2.6/2.7.
+"""
+
+from __future__ import unicode_literals
+import re
+from lib2to3 import fixer_base
+from lib2to3.pgen2 import token
+from lib2to3.fixer_util import syms
+from libfuturize.fixer_util import (future_import, touch_import_top,
+ wrap_in_fn_call)
+
+
+_literal_re = re.compile(r"[^uUrR]?[\'\"]")
+
+
+class FixOldstrWrap(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "STRING"
+
+ def transform(self, node, results):
+ import pdb
+ pdb.set_trace()
+ if node.type == token.STRING:
+ touch_import_top(u'past.types', u'oldstr', node)
+ if _literal_re.match(node.value):
+ new = node.clone()
+ # Strip any leading space or comments:
+ # TODO: check: do we really want to do this?
+ new.prefix = u''
+ new.value = u'b' + new.value
+ wrapped = wrap_in_fn_call("oldstr", [new], prefix=node.prefix)
+ return wrapped
+
+ def transform(self, node, results):
+ expr1, expr2 = results[0].clone(), results[1].clone()
+ # Strip any leading space for the first number:
+ expr1.prefix = u''
+ return wrap_in_fn_call("old_div", expr1, expr2, prefix=node.prefix)
+
+
+class FixDivisionSafe(fixer_base.BaseFix):
+ # BM_compatible = True
+ run_order = 4 # this seems to be ignored?
+
+ _accept_type = token.SLASH
+
+ PATTERN = """
+ term<(not('/') any)+ '/' ((not('/') any))>
+ """
+
+ def match(self, node):
+ u"""
+ Since the tree needs to be fixed once and only once if and only if it
+ matches, then we can start discarding matches after we make the first.
+ """
+ if (node.type == self.syms.term and
+ len(node.children) == 3 and
+ match_division(node.children[1])):
+ expr1, expr2 = node.children[0], node.children[2]
+ return expr1, expr2
+ else:
+ return False
+
+ def transform(self, node, results):
+ future_import(u"division", node)
+ touch_import_top(u'past.utils', u'old_div', node)
+ expr1, expr2 = results[0].clone(), results[1].clone()
+ # Strip any leading space for the first number:
+ expr1.prefix = u''
+ return wrap_in_fn_call("old_div", expr1, expr2, prefix=node.prefix)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_order___future__imports.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_order___future__imports.py
new file mode 100644
index 0000000..120665a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_order___future__imports.py
@@ -0,0 +1,39 @@
+"""
+UNFINISHED
+
+Fixer for turning multiple lines like these:
+
+ from __future__ import division
+ from __future__ import absolute_import
+ from __future__ import print_function
+
+into a single line like this:
+
+ from __future__ import (absolute_import, division, print_function)
+
+This helps with testing of ``futurize``.
+"""
+
+from lib2to3 import fixer_base
+from libfuturize.fixer_util import future_import
+
+class FixOrderFutureImports(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "file_input"
+
+ run_order = 10
+
+ # def match(self, node):
+ # """
+ # Match only once per file
+ # """
+ # if hasattr(node, 'type') and node.type == syms.file_input:
+ # import pdb
+ # pdb.set_trace()
+ # return True
+ # return False
+
+ def transform(self, node, results):
+ # TODO # write me
+ pass
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_print.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_print.py
new file mode 100644
index 0000000..247b91b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_print.py
@@ -0,0 +1,94 @@
+# Copyright 2006 Google, Inc. All Rights Reserved.
+# Licensed to PSF under a Contributor Agreement.
+
+"""Fixer for print.
+
+Change:
+ "print" into "print()"
+ "print ..." into "print(...)"
+ "print(...)" not changed
+ "print ... ," into "print(..., end=' ')"
+ "print >>x, ..." into "print(..., file=x)"
+
+No changes are applied if print_function is imported from __future__
+
+"""
+
+# Local imports
+from lib2to3 import patcomp, pytree, fixer_base
+from lib2to3.pgen2 import token
+from lib2to3.fixer_util import Name, Call, Comma, String
+# from libmodernize import add_future
+
+parend_expr = patcomp.compile_pattern(
+ """atom< '(' [arith_expr|atom|power|term|STRING|NAME] ')' >"""
+ )
+
+
+class FixPrint(fixer_base.BaseFix):
+
+ BM_compatible = True
+
+ PATTERN = """
+ simple_stmt< any* bare='print' any* > | print_stmt
+ """
+
+ def transform(self, node, results):
+ assert results
+
+ bare_print = results.get("bare")
+
+ if bare_print:
+ # Special-case print all by itself.
+ bare_print.replace(Call(Name(u"print"), [],
+ prefix=bare_print.prefix))
+ # The "from __future__ import print_function"" declaration is added
+ # by the fix_print_with_import fixer, so we skip it here.
+ # add_future(node, u'print_function')
+ return
+ assert node.children[0] == Name(u"print")
+ args = node.children[1:]
+ if len(args) == 1 and parend_expr.match(args[0]):
+ # We don't want to keep sticking parens around an
+ # already-parenthesised expression.
+ return
+
+ sep = end = file = None
+ if args and args[-1] == Comma():
+ args = args[:-1]
+ end = " "
+ if args and args[0] == pytree.Leaf(token.RIGHTSHIFT, u">>"):
+ assert len(args) >= 2
+ file = args[1].clone()
+ args = args[3:] # Strip a possible comma after the file expression
+ # Now synthesize a print(args, sep=..., end=..., file=...) node.
+ l_args = [arg.clone() for arg in args]
+ if l_args:
+ l_args[0].prefix = u""
+ if sep is not None or end is not None or file is not None:
+ if sep is not None:
+ self.add_kwarg(l_args, u"sep", String(repr(sep)))
+ if end is not None:
+ self.add_kwarg(l_args, u"end", String(repr(end)))
+ if file is not None:
+ self.add_kwarg(l_args, u"file", file)
+ n_stmt = Call(Name(u"print"), l_args)
+ n_stmt.prefix = node.prefix
+
+ # Note that there are corner cases where adding this future-import is
+ # incorrect, for example when the file also has a 'print ()' statement
+ # that was intended to print "()".
+ # add_future(node, u'print_function')
+ return n_stmt
+
+ def add_kwarg(self, l_nodes, s_kwd, n_expr):
+ # XXX All this prefix-setting may lose comments (though rarely)
+ n_expr.prefix = u""
+ n_argument = pytree.Node(self.syms.argument,
+ (Name(s_kwd),
+ pytree.Leaf(token.EQUAL, u"="),
+ n_expr))
+ if l_nodes:
+ l_nodes.append(Comma())
+ n_argument.prefix = u" "
+ l_nodes.append(n_argument)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_print_with_import.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_print_with_import.py
new file mode 100644
index 0000000..5308d92
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_print_with_import.py
@@ -0,0 +1,23 @@
+"""
+For the ``future`` package.
+
+Turns any print statements into functions and adds this import line:
+
+ from __future__ import print_function
+
+at the top to retain compatibility with Python 2.6+.
+"""
+
+from libfuturize.fixes.fix_print import FixPrint
+from libfuturize.fixer_util import future_import
+
+class FixPrintWithImport(FixPrint):
+ run_order = 7
+ def transform(self, node, results):
+ # Add the __future__ import first. (Otherwise any shebang or encoding
+ # comment line attached as a prefix to the print statement will be
+ # copied twice and appear twice.)
+ future_import(u'print_function', node)
+ n_stmt = super(FixPrintWithImport, self).transform(node, results)
+ return n_stmt
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_raise.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_raise.py
new file mode 100644
index 0000000..3e8323d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_raise.py
@@ -0,0 +1,73 @@
+"""Fixer for 'raise E, V'
+
+From Armin Ronacher's ``python-modernize``.
+
+raise -> raise
+raise E -> raise E
+raise E, V -> raise E(V)
+
+raise (((E, E'), E''), E'''), V -> raise E(V)
+
+
+CAVEATS:
+1) "raise E, V" will be incorrectly translated if V is an exception
+ instance. The correct Python 3 idiom is
+
+ raise E from V
+
+ but since we can't detect instance-hood by syntax alone and since
+ any client code would have to be changed as well, we don't automate
+ this.
+"""
+# Author: Collin Winter, Armin Ronacher
+
+# Local imports
+from lib2to3 import pytree, fixer_base
+from lib2to3.pgen2 import token
+from lib2to3.fixer_util import Name, Call, is_tuple
+
+class FixRaise(fixer_base.BaseFix):
+
+ BM_compatible = True
+ PATTERN = """
+ raise_stmt< 'raise' exc=any [',' val=any] >
+ """
+
+ def transform(self, node, results):
+ syms = self.syms
+
+ exc = results["exc"].clone()
+ if exc.type == token.STRING:
+ msg = "Python 3 does not support string exceptions"
+ self.cannot_convert(node, msg)
+ return
+
+ # Python 2 supports
+ # raise ((((E1, E2), E3), E4), E5), V
+ # as a synonym for
+ # raise E1, V
+ # Since Python 3 will not support this, we recurse down any tuple
+ # literals, always taking the first element.
+ if is_tuple(exc):
+ while is_tuple(exc):
+ # exc.children[1:-1] is the unparenthesized tuple
+ # exc.children[1].children[0] is the first element of the tuple
+ exc = exc.children[1].children[0].clone()
+ exc.prefix = u" "
+
+ if "val" not in results:
+ # One-argument raise
+ new = pytree.Node(syms.raise_stmt, [Name(u"raise"), exc])
+ new.prefix = node.prefix
+ return new
+
+ val = results["val"].clone()
+ if is_tuple(val):
+ args = [c.clone() for c in val.children[1:-1]]
+ else:
+ val.prefix = u""
+ args = [val]
+
+ return pytree.Node(syms.raise_stmt,
+ [Name(u"raise"), Call(exc, args)],
+ prefix=node.prefix)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_remove_old__future__imports.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_remove_old__future__imports.py
new file mode 100644
index 0000000..060eb00
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_remove_old__future__imports.py
@@ -0,0 +1,27 @@
+"""
+Fixer for removing any of these lines:
+
+ from __future__ import with_statement
+ from __future__ import nested_scopes
+ from __future__ import generators
+
+The reason is that __future__ imports like these are required to be the first
+line of code (after docstrings) on Python 2.6+, which can get in the way.
+
+These imports are always enabled in Python 2.6+, which is the minimum sane
+version to target for Py2/3 compatibility.
+"""
+
+from lib2to3 import fixer_base
+from libfuturize.fixer_util import remove_future_import
+
+class FixRemoveOldFutureImports(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "file_input"
+ run_order = 1
+
+ def transform(self, node, results):
+ remove_future_import(u"with_statement", node)
+ remove_future_import(u"nested_scopes", node)
+ remove_future_import(u"generators", node)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_unicode_keep_u.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_unicode_keep_u.py
new file mode 100644
index 0000000..a6f70f0
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_unicode_keep_u.py
@@ -0,0 +1,25 @@
+"""Fixer that changes unicode to str and unichr to chr, but -- unlike the
+lib2to3 fix_unicode.py fixer, does not change u"..." into "...".
+
+The reason is that Py3.3+ supports the u"..." string prefix, and, if
+present, the prefix may provide useful information for disambiguating
+between byte strings and unicode strings, which is often the hardest part
+of the porting task.
+
+"""
+
+from lib2to3.pgen2 import token
+from lib2to3 import fixer_base
+
+_mapping = {u"unichr" : u"chr", u"unicode" : u"str"}
+
+class FixUnicodeKeepU(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "'unicode' | 'unichr'"
+
+ def transform(self, node, results):
+ if node.type == token.NAME:
+ new = node.clone()
+ new.value = _mapping[node.value]
+ return new
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_unicode_literals_import.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_unicode_literals_import.py
new file mode 100644
index 0000000..9f21d7c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_unicode_literals_import.py
@@ -0,0 +1,19 @@
+"""
+Adds this import:
+
+ from __future__ import unicode_literals
+
+"""
+
+from lib2to3 import fixer_base
+from libfuturize.fixer_util import future_import
+
+class FixUnicodeLiteralsImport(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "file_input"
+
+ run_order = 9
+
+ def transform(self, node, results):
+ future_import(u"unicode_literals", node)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_xrange_with_import.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_xrange_with_import.py
new file mode 100644
index 0000000..c910f81
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/fixes/fix_xrange_with_import.py
@@ -0,0 +1,20 @@
+"""
+For the ``future`` package.
+
+Turns any xrange calls into range calls and adds this import line:
+
+ from builtins import range
+
+at the top.
+"""
+
+from lib2to3.fixes.fix_xrange import FixXrange
+
+from libfuturize.fixer_util import touch_import_top
+
+
+class FixXrangeWithImport(FixXrange):
+ def transform(self, node, results):
+ result = super(FixXrangeWithImport, self).transform(node, results)
+ touch_import_top('builtins', 'range', node)
+ return result
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/main.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/main.py
new file mode 100644
index 0000000..18f33ec
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libfuturize/main.py
@@ -0,0 +1,302 @@
+"""
+futurize: automatic conversion to clean 2/3 code using ``python-future``
+======================================================================
+
+Like Armin Ronacher's modernize.py, ``futurize`` attempts to produce clean
+standard Python 3 code that runs on both Py2 and Py3.
+
+One pass
+--------
+
+Use it like this on Python 2 code:
+
+ $ futurize --verbose mypython2script.py
+
+This will attempt to port the code to standard Py3 code that also
+provides Py2 compatibility with the help of the right imports from
+``future``.
+
+To write changes to the files, use the -w flag.
+
+Two stages
+----------
+
+The ``futurize`` script can also be called in two separate stages. First:
+
+ $ futurize --stage1 mypython2script.py
+
+This produces more modern Python 2 code that is not yet compatible with Python
+3. The tests should still run and the diff should be uncontroversial to apply to
+most Python projects that are willing to drop support for Python 2.5 and lower.
+
+After this, the recommended approach is to explicitly mark all strings that must
+be byte-strings with a b'' prefix and all text (unicode) strings with a u''
+prefix, and then invoke the second stage of Python 2 to 2/3 conversion with::
+
+ $ futurize --stage2 mypython2script.py
+
+Stage 2 adds a dependency on ``future``. It converts most remaining Python
+2-specific code to Python 3 code and adds appropriate imports from ``future``
+to restore Py2 support.
+
+The command above leaves all unadorned string literals as native strings
+(byte-strings on Py2, unicode strings on Py3). If instead you would like all
+unadorned string literals to be promoted to unicode, you can also pass this
+flag:
+
+ $ futurize --stage2 --unicode-literals mypython2script.py
+
+This adds the declaration ``from __future__ import unicode_literals`` to the
+top of each file, which implicitly declares all unadorned string literals to be
+unicode strings (``unicode`` on Py2).
+
+All imports
+-----------
+
+The --all-imports option forces adding all ``__future__`` imports,
+``builtins`` imports, and standard library aliases, even if they don't
+seem necessary for the current state of each module. (This can simplify
+testing, and can reduce the need to think about Py2 compatibility when editing
+the code further.)
+
+"""
+
+from __future__ import (absolute_import, print_function, unicode_literals)
+import future.utils
+from future import __version__
+
+import sys
+import logging
+import optparse
+import os
+
+from lib2to3.main import main, warn, StdoutRefactoringTool
+from lib2to3 import refactor
+
+from libfuturize.fixes import (lib2to3_fix_names_stage1,
+ lib2to3_fix_names_stage2,
+ libfuturize_fix_names_stage1,
+ libfuturize_fix_names_stage2)
+
+fixer_pkg = 'libfuturize.fixes'
+
+
+def main(args=None):
+ """Main program.
+
+ Args:
+ fixer_pkg: the name of a package where the fixers are located.
+ args: optional; a list of command line arguments. If omitted,
+ sys.argv[1:] is used.
+
+ Returns a suggested exit status (0, 1, 2).
+ """
+
+ # Set up option parser
+ parser = optparse.OptionParser(usage="futurize [options] file|dir ...")
+ parser.add_option("-V", "--version", action="store_true",
+ help="Report the version number of futurize")
+ parser.add_option("-a", "--all-imports", action="store_true",
+ help="Add all __future__ and future imports to each module")
+ parser.add_option("-1", "--stage1", action="store_true",
+ help="Modernize Python 2 code only; no compatibility with Python 3 (or dependency on ``future``)")
+ parser.add_option("-2", "--stage2", action="store_true",
+ help="Take modernized (stage1) code and add a dependency on ``future`` to provide Py3 compatibility.")
+ parser.add_option("-0", "--both-stages", action="store_true",
+ help="Apply both stages 1 and 2")
+ parser.add_option("-u", "--unicode-literals", action="store_true",
+ help="Add ``from __future__ import unicode_literals`` to implicitly convert all unadorned string literals '' into unicode strings")
+ parser.add_option("-f", "--fix", action="append", default=[],
+ help="Each FIX specifies a transformation; default: all.\nEither use '-f division -f metaclass' etc. or use the fully-qualified module name: '-f lib2to3.fixes.fix_types -f libfuturize.fixes.fix_unicode_keep_u'")
+ parser.add_option("-j", "--processes", action="store", default=1,
+ type="int", help="Run 2to3 concurrently")
+ parser.add_option("-x", "--nofix", action="append", default=[],
+ help="Prevent a fixer from being run.")
+ parser.add_option("-l", "--list-fixes", action="store_true",
+ help="List available transformations")
+ parser.add_option("-p", "--print-function", action="store_true",
+ help="Modify the grammar so that print() is a function")
+ parser.add_option("-v", "--verbose", action="store_true",
+ help="More verbose logging")
+ parser.add_option("--no-diffs", action="store_true",
+ help="Don't show diffs of the refactoring")
+ parser.add_option("-w", "--write", action="store_true",
+ help="Write back modified files")
+ parser.add_option("-n", "--nobackups", action="store_true", default=False,
+ help="Don't write backups for modified files.")
+ parser.add_option("-o", "--output-dir", action="store", type="str",
+ default="", help="Put output files in this directory "
+ "instead of overwriting the input files. Requires -n. "
+ "For Python >= 2.7 only.")
+ parser.add_option("-W", "--write-unchanged-files", action="store_true",
+ help="Also write files even if no changes were required"
+ " (useful with --output-dir); implies -w.")
+ parser.add_option("--add-suffix", action="store", type="str", default="",
+ help="Append this string to all output filenames."
+ " Requires -n if non-empty. For Python >= 2.7 only."
+ "ex: --add-suffix='3' will generate .py3 files.")
+
+ # Parse command line arguments
+ flags = {}
+ refactor_stdin = False
+ options, args = parser.parse_args(args)
+
+ if options.write_unchanged_files:
+ flags["write_unchanged_files"] = True
+ if not options.write:
+ warn("--write-unchanged-files/-W implies -w.")
+ options.write = True
+ # If we allowed these, the original files would be renamed to backup names
+ # but not replaced.
+ if options.output_dir and not options.nobackups:
+ parser.error("Can't use --output-dir/-o without -n.")
+ if options.add_suffix and not options.nobackups:
+ parser.error("Can't use --add-suffix without -n.")
+
+ if not options.write and options.no_diffs:
+ warn("not writing files and not printing diffs; that's not very useful")
+ if not options.write and options.nobackups:
+ parser.error("Can't use -n without -w")
+ if "-" in args:
+ refactor_stdin = True
+ if options.write:
+ print("Can't write to stdin.", file=sys.stderr)
+ return 2
+ # Is this ever necessary?
+ if options.print_function:
+ flags["print_function"] = True
+
+ # Set up logging handler
+ level = logging.DEBUG if options.verbose else logging.INFO
+ logging.basicConfig(format='%(name)s: %(message)s', level=level)
+ logger = logging.getLogger('libfuturize.main')
+
+ if options.stage1 or options.stage2:
+ assert options.both_stages is None
+ options.both_stages = False
+ else:
+ options.both_stages = True
+
+ avail_fixes = set()
+
+ if options.stage1 or options.both_stages:
+ avail_fixes.update(lib2to3_fix_names_stage1)
+ avail_fixes.update(libfuturize_fix_names_stage1)
+ if options.stage2 or options.both_stages:
+ avail_fixes.update(lib2to3_fix_names_stage2)
+ avail_fixes.update(libfuturize_fix_names_stage2)
+
+ if options.unicode_literals:
+ avail_fixes.add('libfuturize.fixes.fix_unicode_literals_import')
+
+ if options.version:
+ print(__version__)
+ return 0
+ if options.list_fixes:
+ print("Available transformations for the -f/--fix option:")
+ # for fixname in sorted(refactor.get_all_fix_names(fixer_pkg)):
+ for fixname in sorted(avail_fixes):
+ print(fixname)
+ if not args:
+ return 0
+ if not args:
+ print("At least one file or directory argument required.",
+ file=sys.stderr)
+ print("Use --help to show usage.", file=sys.stderr)
+ return 2
+
+ unwanted_fixes = set(fixer_pkg + ".fix_" + fix for fix in options.nofix)
+
+ extra_fixes = set()
+ if options.all_imports:
+ if options.stage1:
+ prefix = 'libfuturize.fixes.'
+ extra_fixes.add(prefix +
+ 'fix_add__future__imports_except_unicode_literals')
+ else:
+ # In case the user hasn't run stage1 for some reason:
+ prefix = 'libpasteurize.fixes.'
+ extra_fixes.add(prefix + 'fix_add_all__future__imports')
+ extra_fixes.add(prefix + 'fix_add_future_standard_library_import')
+ extra_fixes.add(prefix + 'fix_add_all_future_builtins')
+ explicit = set()
+ if options.fix:
+ all_present = False
+ for fix in options.fix:
+ if fix == 'all':
+ all_present = True
+ else:
+ if ".fix_" in fix:
+ explicit.add(fix)
+ else:
+ # Infer the full module name for the fixer.
+ # First ensure that no names clash (e.g.
+ # lib2to3.fixes.fix_blah and libfuturize.fixes.fix_blah):
+ found = [f for f in avail_fixes
+ if f.endswith('fix_{0}'.format(fix))]
+ if len(found) > 1:
+ print("Ambiguous fixer name. Choose a fully qualified "
+ "module name instead from these:\n" +
+ "\n".join(" " + myf for myf in found),
+ file=sys.stderr)
+ return 2
+ elif len(found) == 0:
+ print("Unknown fixer. Use --list-fixes or -l for a list.",
+ file=sys.stderr)
+ return 2
+ explicit.add(found[0])
+ if len(explicit & unwanted_fixes) > 0:
+ print("Conflicting usage: the following fixers have been "
+ "simultaneously requested and disallowed:\n" +
+ "\n".join(" " + myf for myf in (explicit & unwanted_fixes)),
+ file=sys.stderr)
+ return 2
+ requested = avail_fixes.union(explicit) if all_present else explicit
+ else:
+ requested = avail_fixes.union(explicit)
+ fixer_names = (requested | extra_fixes) - unwanted_fixes
+
+ input_base_dir = os.path.commonprefix(args)
+ if (input_base_dir and not input_base_dir.endswith(os.sep)
+ and not os.path.isdir(input_base_dir)):
+ # One or more similar names were passed, their directory is the base.
+ # os.path.commonprefix() is ignorant of path elements, this corrects
+ # for that weird API.
+ input_base_dir = os.path.dirname(input_base_dir)
+ if options.output_dir:
+ input_base_dir = input_base_dir.rstrip(os.sep)
+ logger.info('Output in %r will mirror the input directory %r layout.',
+ options.output_dir, input_base_dir)
+
+ # Initialize the refactoring tool
+ if future.utils.PY26:
+ extra_kwargs = {}
+ else:
+ extra_kwargs = {
+ 'append_suffix': options.add_suffix,
+ 'output_dir': options.output_dir,
+ 'input_base_dir': input_base_dir,
+ }
+
+ rt = StdoutRefactoringTool(
+ sorted(fixer_names), flags, sorted(explicit),
+ options.nobackups, not options.no_diffs,
+ **extra_kwargs)
+
+ # Refactor all files and directories passed as arguments
+ if not rt.errors:
+ if refactor_stdin:
+ rt.refactor_stdin()
+ else:
+ try:
+ rt.refactor(args, options.write, None,
+ options.processes)
+ except refactor.MultiprocessingUnsupported:
+ assert options.processes > 1
+ print("Sorry, -j isn't " \
+ "supported on this platform.", file=sys.stderr)
+ return 1
+ rt.summarize()
+
+ # Return error status (0 if rt.errors is zero)
+ return int(bool(rt.errors))
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/__init__.py
new file mode 100644
index 0000000..4cb1cbc
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/__init__.py
@@ -0,0 +1 @@
+# empty to make this a package
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/__init__.py
new file mode 100644
index 0000000..c362ada
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/__init__.py
@@ -0,0 +1,55 @@
+import sys
+from lib2to3 import refactor
+
+# The original set of these fixes comes from lib3to2 (https://bitbucket.org/amentajo/lib3to2):
+fix_names = set([
+ 'libpasteurize.fixes.fix_add_all__future__imports', # from __future__ import absolute_import etc. on separate lines
+ 'libpasteurize.fixes.fix_add_future_standard_library_import', # we force adding this import for now, even if it doesn't seem necessary to the fix_future_standard_library fixer, for ease of testing
+ # 'libfuturize.fixes.fix_order___future__imports', # consolidates to a single line to simplify testing -- UNFINISHED
+ 'libpasteurize.fixes.fix_future_builtins', # adds "from future.builtins import *"
+ 'libfuturize.fixes.fix_future_standard_library', # adds "from future import standard_library"
+
+ 'libpasteurize.fixes.fix_annotations',
+ # 'libpasteurize.fixes.fix_bitlength', # ints have this in Py2.7
+ # 'libpasteurize.fixes.fix_bool', # need a decorator or Mixin
+ # 'libpasteurize.fixes.fix_bytes', # leave bytes as bytes
+ # 'libpasteurize.fixes.fix_classdecorator', # available in
+ # Py2.6+
+ # 'libpasteurize.fixes.fix_collections', hmmm ...
+ # 'libpasteurize.fixes.fix_dctsetcomp', # avail in Py27
+ 'libpasteurize.fixes.fix_division', # yes
+ # 'libpasteurize.fixes.fix_except', # avail in Py2.6+
+ # 'libpasteurize.fixes.fix_features', # ?
+ 'libpasteurize.fixes.fix_fullargspec',
+ # 'libpasteurize.fixes.fix_funcattrs',
+ 'libpasteurize.fixes.fix_getcwd',
+ 'libpasteurize.fixes.fix_imports', # adds "from future import standard_library"
+ 'libpasteurize.fixes.fix_imports2',
+ # 'libpasteurize.fixes.fix_input',
+ # 'libpasteurize.fixes.fix_int',
+ # 'libpasteurize.fixes.fix_intern',
+ # 'libpasteurize.fixes.fix_itertools',
+ 'libpasteurize.fixes.fix_kwargs', # yes, we want this
+ # 'libpasteurize.fixes.fix_memoryview',
+ # 'libpasteurize.fixes.fix_metaclass', # write a custom handler for
+ # this
+ # 'libpasteurize.fixes.fix_methodattrs', # __func__ and __self__ seem to be defined on Py2.7 already
+ 'libpasteurize.fixes.fix_newstyle', # yes, we want this: explicit inheritance from object. Without new-style classes in Py2, super() will break etc.
+ # 'libpasteurize.fixes.fix_next', # use a decorator for this
+ # 'libpasteurize.fixes.fix_numliterals', # prob not
+ # 'libpasteurize.fixes.fix_open', # huh?
+ # 'libpasteurize.fixes.fix_print', # no way
+ 'libpasteurize.fixes.fix_printfunction', # adds __future__ import print_function
+ # 'libpasteurize.fixes.fix_raise_', # TODO: get this working!
+
+ # 'libpasteurize.fixes.fix_range', # nope
+ # 'libpasteurize.fixes.fix_reduce',
+ # 'libpasteurize.fixes.fix_setliteral',
+ # 'libpasteurize.fixes.fix_str',
+ # 'libpasteurize.fixes.fix_super', # maybe, if our magic super() isn't robust enough
+ 'libpasteurize.fixes.fix_throw', # yes, if Py3 supports it
+ # 'libpasteurize.fixes.fix_unittest',
+ 'libpasteurize.fixes.fix_unpacking', # yes, this is useful
+ # 'libpasteurize.fixes.fix_with' # way out of date
+ ])
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/feature_base.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/feature_base.py
new file mode 100644
index 0000000..8a26496
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/feature_base.py
@@ -0,0 +1,57 @@
+u"""
+Base classes for features that are backwards-incompatible.
+
+Usage:
+features = Features()
+features.add(Feature("py3k_feature", "power< 'py3k' any* >", "2.7"))
+PATTERN = features.PATTERN
+"""
+
+pattern_unformatted = u"%s=%s" # name=pattern, for dict lookups
+message_unformatted = u"""
+%s is only supported in Python %s and above."""
+
+class Feature(object):
+ u"""
+ A feature has a name, a pattern, and a minimum version of Python 2.x
+ required to use the feature (or 3.x if there is no backwards-compatible
+ version of 2.x)
+ """
+ def __init__(self, name, PATTERN, version):
+ self.name = name
+ self._pattern = PATTERN
+ self.version = version
+
+ def message_text(self):
+ u"""
+ Format the above text with the name and minimum version required.
+ """
+ return message_unformatted % (self.name, self.version)
+
+class Features(set):
+ u"""
+ A set of features that generates a pattern for the features it contains.
+ This set will act like a mapping in that we map names to patterns.
+ """
+ mapping = {}
+
+ def update_mapping(self):
+ u"""
+ Called every time we care about the mapping of names to features.
+ """
+ self.mapping = dict([(f.name, f) for f in iter(self)])
+
+ @property
+ def PATTERN(self):
+ u"""
+ Uses the mapping of names to features to return a PATTERN suitable
+ for using the lib2to3 patcomp.
+ """
+ self.update_mapping()
+ return u" |\n".join([pattern_unformatted % (f.name, f._pattern) for f in iter(self)])
+
+ def __getitem__(self, key):
+ u"""
+ Implement a simple mapping to get patterns from names.
+ """
+ return self.mapping[key]
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_add_all__future__imports.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_add_all__future__imports.py
new file mode 100644
index 0000000..32f89ec
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_add_all__future__imports.py
@@ -0,0 +1,25 @@
+"""
+Fixer for adding:
+
+ from __future__ import absolute_import
+ from __future__ import division
+ from __future__ import print_function
+ from __future__ import unicode_literals
+
+This is done when converting from Py3 to both Py3/Py2.
+"""
+
+from lib2to3 import fixer_base
+from libfuturize.fixer_util import future_import
+
+class FixAddAllFutureImports(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "file_input"
+ run_order = 1
+
+ def transform(self, node, results):
+ future_import(u"unicode_literals", node)
+ future_import(u"print_function", node)
+ future_import(u"division", node)
+ future_import(u"absolute_import", node)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_add_all_future_builtins.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_add_all_future_builtins.py
new file mode 100644
index 0000000..97204b5
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_add_all_future_builtins.py
@@ -0,0 +1,38 @@
+"""
+For the ``future`` package.
+
+Adds this import line::
+
+ from builtins import (ascii, bytes, chr, dict, filter, hex, input,
+ int, list, map, next, object, oct, open, pow,
+ range, round, str, super, zip)
+
+to a module, irrespective of whether each definition is used.
+
+Adds these imports after any other imports (in an initial block of them).
+"""
+
+from __future__ import unicode_literals
+
+from lib2to3 import fixer_base
+
+from libfuturize.fixer_util import touch_import_top
+
+
+class FixAddAllFutureBuiltins(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "file_input"
+ run_order = 1
+
+ def transform(self, node, results):
+ # import_str = """(ascii, bytes, chr, dict, filter, hex, input,
+ # int, list, map, next, object, oct, open, pow,
+ # range, round, str, super, zip)"""
+ touch_import_top(u'builtins', '*', node)
+
+ # builtins = """ascii bytes chr dict filter hex input
+ # int list map next object oct open pow
+ # range round str super zip"""
+ # for builtin in sorted(builtins.split(), reverse=True):
+ # touch_import_top(u'builtins', builtin, node)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_add_future_standard_library_import.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_add_future_standard_library_import.py
new file mode 100644
index 0000000..0778406
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_add_future_standard_library_import.py
@@ -0,0 +1,23 @@
+"""
+For the ``future`` package.
+
+Adds this import line:
+
+ from future import standard_library
+
+after any __future__ imports but before any other imports. Doesn't actually
+change the imports to Py3 style.
+"""
+
+from lib2to3 import fixer_base
+from libfuturize.fixer_util import touch_import_top
+
+class FixAddFutureStandardLibraryImport(fixer_base.BaseFix):
+ BM_compatible = True
+ PATTERN = "file_input"
+ run_order = 8
+
+ def transform(self, node, results):
+ # TODO: add a blank line between any __future__ imports and this?
+ touch_import_top(u'future', u'standard_library', node)
+ # TODO: also add standard_library.install_hooks()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_annotations.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_annotations.py
new file mode 100644
index 0000000..1926288
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_annotations.py
@@ -0,0 +1,48 @@
+u"""
+Fixer to remove function annotations
+"""
+
+from lib2to3 import fixer_base
+from lib2to3.pgen2 import token
+from lib2to3.fixer_util import syms
+
+warning_text = u"Removing function annotations completely."
+
+def param_without_annotations(node):
+ return node.children[0]
+
+class FixAnnotations(fixer_base.BaseFix):
+
+ warned = False
+
+ def warn_once(self, node, reason):
+ if not self.warned:
+ self.warned = True
+ self.warning(node, reason=reason)
+
+ PATTERN = u"""
+ funcdef< 'def' any parameters< '(' [params=any] ')' > ['->' ret=any] ':' any* >
+ """
+
+ def transform(self, node, results):
+ u"""
+ This just strips annotations from the funcdef completely.
+ """
+ params = results.get(u"params")
+ ret = results.get(u"ret")
+ if ret is not None:
+ assert ret.prev_sibling.type == token.RARROW, u"Invalid return annotation"
+ self.warn_once(node, reason=warning_text)
+ ret.prev_sibling.remove()
+ ret.remove()
+ if params is None: return
+ if params.type == syms.typedargslist:
+ # more than one param in a typedargslist
+ for param in params.children:
+ if param.type == syms.tname:
+ self.warn_once(node, reason=warning_text)
+ param.replace(param_without_annotations(param))
+ elif params.type == syms.tname:
+ # one param
+ self.warn_once(node, reason=warning_text)
+ params.replace(param_without_annotations(params))
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_division.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_division.py
new file mode 100644
index 0000000..6a04871
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_division.py
@@ -0,0 +1,28 @@
+u"""
+Fixer for division: from __future__ import division if needed
+"""
+
+from lib2to3 import fixer_base
+from libfuturize.fixer_util import token, future_import
+
+def match_division(node):
+ u"""
+ __future__.division redefines the meaning of a single slash for division,
+ so we match that and only that.
+ """
+ slash = token.SLASH
+ return node.type == slash and not node.next_sibling.type == slash and \
+ not node.prev_sibling.type == slash
+
+class FixDivision(fixer_base.BaseFix):
+ run_order = 4 # this seems to be ignored?
+
+ def match(self, node):
+ u"""
+ Since the tree needs to be fixed once and only once if and only if it
+ matches, then we can start discarding matches after we make the first.
+ """
+ return match_division(node)
+
+ def transform(self, node, results):
+ future_import(u"division", node)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_features.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_features.py
new file mode 100644
index 0000000..7e5f545
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_features.py
@@ -0,0 +1,86 @@
+u"""
+Warn about features that are not present in Python 2.5, giving a message that
+points to the earliest version of Python 2.x (or 3.x, if none) that supports it
+"""
+
+from .feature_base import Feature, Features
+from lib2to3 import fixer_base
+
+FEATURES = [
+ #(FeatureName,
+ # FeaturePattern,
+ # FeatureMinVersion,
+ #),
+ (u"memoryview",
+ u"power < 'memoryview' trailer < '(' any* ')' > any* >",
+ u"2.7",
+ ),
+ (u"numbers",
+ u"""import_from< 'from' 'numbers' 'import' any* > |
+ import_name< 'import' ('numbers' dotted_as_names< any* 'numbers' any* >) >""",
+ u"2.6",
+ ),
+ (u"abc",
+ u"""import_name< 'import' ('abc' dotted_as_names< any* 'abc' any* >) > |
+ import_from< 'from' 'abc' 'import' any* >""",
+ u"2.6",
+ ),
+ (u"io",
+ u"""import_name< 'import' ('io' dotted_as_names< any* 'io' any* >) > |
+ import_from< 'from' 'io' 'import' any* >""",
+ u"2.6",
+ ),
+ (u"bin",
+ u"power< 'bin' trailer< '(' any* ')' > any* >",
+ u"2.6",
+ ),
+ (u"formatting",
+ u"power< any trailer< '.' 'format' > trailer< '(' any* ')' > >",
+ u"2.6",
+ ),
+ (u"nonlocal",
+ u"global_stmt< 'nonlocal' any* >",
+ u"3.0",
+ ),
+ (u"with_traceback",
+ u"trailer< '.' 'with_traceback' >",
+ u"3.0",
+ ),
+]
+
+class FixFeatures(fixer_base.BaseFix):
+
+ run_order = 9 # Wait until all other fixers have run to check for these
+
+ # To avoid spamming, we only want to warn for each feature once.
+ features_warned = set()
+
+ # Build features from the list above
+ features = Features([Feature(name, pattern, version) for \
+ name, pattern, version in FEATURES])
+
+ PATTERN = features.PATTERN
+
+ def match(self, node):
+ to_ret = super(FixFeatures, self).match(node)
+ # We want the mapping only to tell us the node's specific information.
+ try:
+ del to_ret[u'node']
+ except Exception:
+ # We want it to delete the 'node' from the results
+ # if it's there, so we don't care if it fails for normal reasons.
+ pass
+ return to_ret
+
+ def transform(self, node, results):
+ for feature_name in results:
+ if feature_name in self.features_warned:
+ continue
+ else:
+ curr_feature = self.features[feature_name]
+ if curr_feature.version >= u"3":
+ fail = self.cannot_convert
+ else:
+ fail = self.warning
+ fail(node, reason=curr_feature.message_text())
+ self.features_warned.add(feature_name)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_fullargspec.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_fullargspec.py
new file mode 100644
index 0000000..489295f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_fullargspec.py
@@ -0,0 +1,16 @@
+u"""
+Fixer for getfullargspec -> getargspec
+"""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Name
+
+warn_msg = u"some of the values returned by getfullargspec are not valid in Python 2 and have no equivalent."
+
+class FixFullargspec(fixer_base.BaseFix):
+
+ PATTERN = u"'getfullargspec'"
+
+ def transform(self, node, results):
+ self.warning(node, warn_msg)
+ return Name(u"getargspec", prefix=node.prefix)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_future_builtins.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_future_builtins.py
new file mode 100644
index 0000000..27339ab
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_future_builtins.py
@@ -0,0 +1,47 @@
+"""
+Adds this import line:
+
+ from builtins import XYZ
+
+for each of the functions XYZ that is used in the module.
+"""
+
+from __future__ import unicode_literals
+
+from lib2to3 import fixer_base
+from lib2to3.pygram import python_symbols as syms
+from lib2to3.fixer_util import Name, Call, in_special_context
+
+from libfuturize.fixer_util import touch_import_top
+
+# All builtins are:
+# from future.builtins.iterators import (filter, map, zip)
+# from future.builtins.misc import (ascii, chr, hex, input, isinstance, oct, open, round, super)
+# from future.types import (bytes, dict, int, range, str)
+# We don't need isinstance any more.
+
+replaced_builtins = '''filter map zip
+ ascii chr hex input next oct open round super
+ bytes dict int range str'''.split()
+
+expression = '|'.join(["name='{0}'".format(name) for name in replaced_builtins])
+
+
+class FixFutureBuiltins(fixer_base.BaseFix):
+ BM_compatible = True
+ run_order = 9
+
+ # Currently we only match uses as a function. This doesn't match e.g.:
+ # if isinstance(s, str):
+ # ...
+ PATTERN = """
+ power<
+ ({0}) trailer< '(' args=[any] ')' >
+ rest=any* >
+ """.format(expression)
+
+ def transform(self, node, results):
+ name = results["name"]
+ touch_import_top(u'builtins', name.value, node)
+ # name.replace(Name(u"input", prefix=name.prefix))
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_getcwd.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_getcwd.py
new file mode 100644
index 0000000..9b7f002
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_getcwd.py
@@ -0,0 +1,26 @@
+u"""
+Fixer for os.getcwd() -> os.getcwdu().
+Also warns about "from os import getcwd", suggesting the above form.
+"""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Name
+
+class FixGetcwd(fixer_base.BaseFix):
+
+ PATTERN = u"""
+ power< 'os' trailer< dot='.' name='getcwd' > any* >
+ |
+ import_from< 'from' 'os' 'import' bad='getcwd' >
+ """
+
+ def transform(self, node, results):
+ if u"name" in results:
+ name = results[u"name"]
+ name.replace(Name(u"getcwdu", prefix=name.prefix))
+ elif u"bad" in results:
+ # Can't convert to getcwdu and then expect to catch every use.
+ self.cannot_convert(node, u"import os, use os.getcwd() instead.")
+ return
+ else:
+ raise ValueError(u"For some reason, the pattern matcher failed.")
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_imports.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_imports.py
new file mode 100644
index 0000000..d79558c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_imports.py
@@ -0,0 +1,112 @@
+u"""
+Fixer for standard library imports renamed in Python 3
+"""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Name, is_probably_builtin, Newline, does_tree_import
+from lib2to3.pygram import python_symbols as syms
+from lib2to3.pgen2 import token
+from lib2to3.pytree import Node, Leaf
+
+from libfuturize.fixer_util import touch_import_top
+# from ..fixer_util import NameImport
+
+# used in simple_mapping_to_pattern()
+MAPPING = {u"reprlib": u"repr",
+ u"winreg": u"_winreg",
+ u"configparser": u"ConfigParser",
+ u"copyreg": u"copy_reg",
+ u"queue": u"Queue",
+ u"socketserver": u"SocketServer",
+ u"_markupbase": u"markupbase",
+ u"test.support": u"test.test_support",
+ u"dbm.bsd": u"dbhash",
+ u"dbm.ndbm": u"dbm",
+ u"dbm.dumb": u"dumbdbm",
+ u"dbm.gnu": u"gdbm",
+ u"html.parser": u"HTMLParser",
+ u"html.entities": u"htmlentitydefs",
+ u"http.client": u"httplib",
+ u"http.cookies": u"Cookie",
+ u"http.cookiejar": u"cookielib",
+# "tkinter": "Tkinter",
+ u"tkinter.dialog": u"Dialog",
+ u"tkinter._fix": u"FixTk",
+ u"tkinter.scrolledtext": u"ScrolledText",
+ u"tkinter.tix": u"Tix",
+ u"tkinter.constants": u"Tkconstants",
+ u"tkinter.dnd": u"Tkdnd",
+ u"tkinter.__init__": u"Tkinter",
+ u"tkinter.colorchooser": u"tkColorChooser",
+ u"tkinter.commondialog": u"tkCommonDialog",
+ u"tkinter.font": u"tkFont",
+ u"tkinter.messagebox": u"tkMessageBox",
+ u"tkinter.turtle": u"turtle",
+ u"urllib.robotparser": u"robotparser",
+ u"xmlrpc.client": u"xmlrpclib",
+ u"builtins": u"__builtin__",
+}
+
+# generic strings to help build patterns
+# these variables mean (with http.client.HTTPConnection as an example):
+# name = http
+# attr = client
+# used = HTTPConnection
+# fmt_name is a formatted subpattern (simple_name_match or dotted_name_match)
+
+# helps match 'queue', as in 'from queue import ...'
+simple_name_match = u"name='%s'"
+# helps match 'client', to be used if client has been imported from http
+subname_match = u"attr='%s'"
+# helps match 'http.client', as in 'import urllib.request'
+dotted_name_match = u"dotted_name=dotted_name< %s '.' %s >"
+# helps match 'queue', as in 'queue.Queue(...)'
+power_onename_match = u"%s"
+# helps match 'http.client', as in 'http.client.HTTPConnection(...)'
+power_twoname_match = u"power< %s trailer< '.' %s > any* >"
+# helps match 'client.HTTPConnection', if 'client' has been imported from http
+power_subname_match = u"power< %s any* >"
+# helps match 'from http.client import HTTPConnection'
+from_import_match = u"from_import=import_from< 'from' %s 'import' imported=any >"
+# helps match 'from http import client'
+from_import_submod_match = u"from_import_submod=import_from< 'from' %s 'import' (%s | import_as_name< %s 'as' renamed=any > | import_as_names< any* (%s | import_as_name< %s 'as' renamed=any >) any* > ) >"
+# helps match 'import urllib.request'
+name_import_match = u"name_import=import_name< 'import' %s > | name_import=import_name< 'import' dotted_as_name< %s 'as' renamed=any > >"
+# helps match 'import http.client, winreg'
+multiple_name_import_match = u"name_import=import_name< 'import' dotted_as_names< names=any* > >"
+
+def all_patterns(name):
+ u"""
+ Accepts a string and returns a pattern of possible patterns involving that name
+ Called by simple_mapping_to_pattern for each name in the mapping it receives.
+ """
+
+ # i_ denotes an import-like node
+ # u_ denotes a node that appears to be a usage of the name
+ if u'.' in name:
+ name, attr = name.split(u'.', 1)
+ simple_name = simple_name_match % (name)
+ simple_attr = subname_match % (attr)
+ dotted_name = dotted_name_match % (simple_name, simple_attr)
+ i_from = from_import_match % (dotted_name)
+ i_from_submod = from_import_submod_match % (simple_name, simple_attr, simple_attr, simple_attr, simple_attr)
+ i_name = name_import_match % (dotted_name, dotted_name)
+ u_name = power_twoname_match % (simple_name, simple_attr)
+ u_subname = power_subname_match % (simple_attr)
+ return u' | \n'.join((i_name, i_from, i_from_submod, u_name, u_subname))
+ else:
+ simple_name = simple_name_match % (name)
+ i_name = name_import_match % (simple_name, simple_name)
+ i_from = from_import_match % (simple_name)
+ u_name = power_onename_match % (simple_name)
+ return u' | \n'.join((i_name, i_from, u_name))
+
+
+class FixImports(fixer_base.BaseFix):
+
+ PATTERN = u' | \n'.join([all_patterns(name) for name in MAPPING])
+ PATTERN = u' | \n'.join((PATTERN, multiple_name_import_match))
+
+ def transform(self, node, results):
+ touch_import_top(u'future', u'standard_library', node)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_imports2.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_imports2.py
new file mode 100644
index 0000000..5b30b5f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_imports2.py
@@ -0,0 +1,175 @@
+u"""
+Fixer for complicated imports
+"""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Name, String, FromImport, Newline, Comma
+from libfuturize.fixer_util import touch_import_top
+
+
+TK_BASE_NAMES = (u'ACTIVE', u'ALL', u'ANCHOR', u'ARC',u'BASELINE', u'BEVEL', u'BOTH',
+ u'BOTTOM', u'BROWSE', u'BUTT', u'CASCADE', u'CENTER', u'CHAR',
+ u'CHECKBUTTON', u'CHORD', u'COMMAND', u'CURRENT', u'DISABLED',
+ u'DOTBOX', u'E', u'END', u'EW', u'EXCEPTION', u'EXTENDED', u'FALSE',
+ u'FIRST', u'FLAT', u'GROOVE', u'HIDDEN', u'HORIZONTAL', u'INSERT',
+ u'INSIDE', u'LAST', u'LEFT', u'MITER', u'MOVETO', u'MULTIPLE', u'N',
+ u'NE', u'NO', u'NONE', u'NORMAL', u'NS', u'NSEW', u'NUMERIC', u'NW',
+ u'OFF', u'ON', u'OUTSIDE', u'PAGES', u'PIESLICE', u'PROJECTING',
+ u'RADIOBUTTON', u'RAISED', u'READABLE', u'RIDGE', u'RIGHT',
+ u'ROUND', u'S', u'SCROLL', u'SE', u'SEL', u'SEL_FIRST', u'SEL_LAST',
+ u'SEPARATOR', u'SINGLE', u'SOLID', u'SUNKEN', u'SW', u'StringTypes',
+ u'TOP', u'TRUE', u'TclVersion', u'TkVersion', u'UNDERLINE',
+ u'UNITS', u'VERTICAL', u'W', u'WORD', u'WRITABLE', u'X', u'Y', u'YES',
+ u'wantobjects')
+
+PY2MODULES = {
+ u'urllib2' : (
+ u'AbstractBasicAuthHandler', u'AbstractDigestAuthHandler',
+ u'AbstractHTTPHandler', u'BaseHandler', u'CacheFTPHandler',
+ u'FTPHandler', u'FileHandler', u'HTTPBasicAuthHandler',
+ u'HTTPCookieProcessor', u'HTTPDefaultErrorHandler',
+ u'HTTPDigestAuthHandler', u'HTTPError', u'HTTPErrorProcessor',
+ u'HTTPHandler', u'HTTPPasswordMgr',
+ u'HTTPPasswordMgrWithDefaultRealm', u'HTTPRedirectHandler',
+ u'HTTPSHandler', u'OpenerDirector', u'ProxyBasicAuthHandler',
+ u'ProxyDigestAuthHandler', u'ProxyHandler', u'Request',
+ u'StringIO', u'URLError', u'UnknownHandler', u'addinfourl',
+ u'build_opener', u'install_opener', u'parse_http_list',
+ u'parse_keqv_list', u'randombytes', u'request_host', u'urlopen'),
+ u'urllib' : (
+ u'ContentTooShortError', u'FancyURLopener',u'URLopener',
+ u'basejoin', u'ftperrors', u'getproxies',
+ u'getproxies_environment', u'localhost', u'pathname2url',
+ u'quote', u'quote_plus', u'splitattr', u'splithost',
+ u'splitnport', u'splitpasswd', u'splitport', u'splitquery',
+ u'splittag', u'splittype', u'splituser', u'splitvalue',
+ u'thishost', u'unquote', u'unquote_plus', u'unwrap',
+ u'url2pathname', u'urlcleanup', u'urlencode', u'urlopen',
+ u'urlretrieve',),
+ u'urlparse' : (
+ u'parse_qs', u'parse_qsl', u'urldefrag', u'urljoin',
+ u'urlparse', u'urlsplit', u'urlunparse', u'urlunsplit'),
+ u'dbm' : (
+ u'ndbm', u'gnu', u'dumb'),
+ u'anydbm' : (
+ u'error', u'open'),
+ u'whichdb' : (
+ u'whichdb',),
+ u'BaseHTTPServer' : (
+ u'BaseHTTPRequestHandler', u'HTTPServer'),
+ u'CGIHTTPServer' : (
+ u'CGIHTTPRequestHandler',),
+ u'SimpleHTTPServer' : (
+ u'SimpleHTTPRequestHandler',),
+ u'FileDialog' : TK_BASE_NAMES + (
+ u'FileDialog', u'LoadFileDialog', u'SaveFileDialog',
+ u'dialogstates', u'test'),
+ u'tkFileDialog' : (
+ u'Directory', u'Open', u'SaveAs', u'_Dialog', u'askdirectory',
+ u'askopenfile', u'askopenfilename', u'askopenfilenames',
+ u'askopenfiles', u'asksaveasfile', u'asksaveasfilename'),
+ u'SimpleDialog' : TK_BASE_NAMES + (
+ u'SimpleDialog',),
+ u'tkSimpleDialog' : TK_BASE_NAMES + (
+ u'askfloat', u'askinteger', u'askstring', u'Dialog'),
+ u'SimpleXMLRPCServer' : (
+ u'CGIXMLRPCRequestHandler', u'SimpleXMLRPCDispatcher',
+ u'SimpleXMLRPCRequestHandler', u'SimpleXMLRPCServer',
+ u'list_public_methods', u'remove_duplicates',
+ u'resolve_dotted_attribute'),
+ u'DocXMLRPCServer' : (
+ u'DocCGIXMLRPCRequestHandler', u'DocXMLRPCRequestHandler',
+ u'DocXMLRPCServer', u'ServerHTMLDoc',u'XMLRPCDocGenerator'),
+ }
+
+MAPPING = { u'urllib.request' :
+ (u'urllib2', u'urllib'),
+ u'urllib.error' :
+ (u'urllib2', u'urllib'),
+ u'urllib.parse' :
+ (u'urllib2', u'urllib', u'urlparse'),
+ u'dbm.__init__' :
+ (u'anydbm', u'whichdb'),
+ u'http.server' :
+ (u'CGIHTTPServer', u'SimpleHTTPServer', u'BaseHTTPServer'),
+ u'tkinter.filedialog' :
+ (u'tkFileDialog', u'FileDialog'),
+ u'tkinter.simpledialog' :
+ (u'tkSimpleDialog', u'SimpleDialog'),
+ u'xmlrpc.server' :
+ (u'DocXMLRPCServer', u'SimpleXMLRPCServer'),
+ }
+
+# helps match 'http', as in 'from http.server import ...'
+simple_name = u"name='%s'"
+# helps match 'server', as in 'from http.server import ...'
+simple_attr = u"attr='%s'"
+# helps match 'HTTPServer', as in 'from http.server import HTTPServer'
+simple_using = u"using='%s'"
+# helps match 'urllib.request', as in 'import urllib.request'
+dotted_name = u"dotted_name=dotted_name< %s '.' %s >"
+# helps match 'http.server', as in 'http.server.HTTPServer(...)'
+power_twoname = u"pow=power< %s trailer< '.' %s > trailer< '.' using=any > any* >"
+# helps match 'dbm.whichdb', as in 'dbm.whichdb(...)'
+power_onename = u"pow=power< %s trailer< '.' using=any > any* >"
+# helps match 'from http.server import HTTPServer'
+# also helps match 'from http.server import HTTPServer, SimpleHTTPRequestHandler'
+# also helps match 'from http.server import *'
+from_import = u"from_import=import_from< 'from' %s 'import' (import_as_name< using=any 'as' renamed=any> | in_list=import_as_names< using=any* > | using='*' | using=NAME) >"
+# helps match 'import urllib.request'
+name_import = u"name_import=import_name< 'import' (%s | in_list=dotted_as_names< imp_list=any* >) >"
+
+#############
+# WON'T FIX #
+#############
+
+# helps match 'import urllib.request as name'
+name_import_rename = u"name_import_rename=dotted_as_name< %s 'as' renamed=any >"
+# helps match 'from http import server'
+from_import_rename = u"from_import_rename=import_from< 'from' %s 'import' (%s | import_as_name< %s 'as' renamed=any > | in_list=import_as_names< any* (%s | import_as_name< %s 'as' renamed=any >) any* >) >"
+
+
+def all_modules_subpattern():
+ u"""
+ Builds a pattern for all toplevel names
+ (urllib, http, etc)
+ """
+ names_dot_attrs = [mod.split(u".") for mod in MAPPING]
+ ret = u"( " + u" | ".join([dotted_name % (simple_name % (mod[0]),
+ simple_attr % (mod[1])) for mod in names_dot_attrs])
+ ret += u" | "
+ ret += u" | ".join([simple_name % (mod[0]) for mod in names_dot_attrs if mod[1] == u"__init__"]) + u" )"
+ return ret
+
+
+def build_import_pattern(mapping1, mapping2):
+ u"""
+ mapping1: A dict mapping py3k modules to all possible py2k replacements
+ mapping2: A dict mapping py2k modules to the things they do
+ This builds a HUGE pattern to match all ways that things can be imported
+ """
+ # py3k: urllib.request, py2k: ('urllib2', 'urllib')
+ yield from_import % (all_modules_subpattern())
+ for py3k, py2k in mapping1.items():
+ name, attr = py3k.split(u'.')
+ s_name = simple_name % (name)
+ s_attr = simple_attr % (attr)
+ d_name = dotted_name % (s_name, s_attr)
+ yield name_import % (d_name)
+ yield power_twoname % (s_name, s_attr)
+ if attr == u'__init__':
+ yield name_import % (s_name)
+ yield power_onename % (s_name)
+ yield name_import_rename % (d_name)
+ yield from_import_rename % (s_name, s_attr, s_attr, s_attr, s_attr)
+
+
+class FixImports2(fixer_base.BaseFix):
+
+ run_order = 4
+
+ PATTERN = u" | \n".join(build_import_pattern(MAPPING, PY2MODULES))
+
+ def transform(self, node, results):
+ touch_import_top(u'future', u'standard_library', node)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_kwargs.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_kwargs.py
new file mode 100644
index 0000000..59a3043
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_kwargs.py
@@ -0,0 +1,148 @@
+u"""
+Fixer for Python 3 function parameter syntax
+This fixer is rather sensitive to incorrect py3k syntax.
+"""
+
+# Note: "relevant" parameters are parameters following the first STAR in the list.
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import token, String, Newline, Comma, Name
+from libfuturize.fixer_util import indentation, suitify, DoubleStar
+
+_assign_template = u"%(name)s = %(kwargs)s['%(name)s']; del %(kwargs)s['%(name)s']"
+_if_template = u"if '%(name)s' in %(kwargs)s: %(assign)s"
+_else_template = u"else: %(name)s = %(default)s"
+_kwargs_default_name = u"_3to2kwargs"
+
+def gen_params(raw_params):
+ u"""
+ Generator that yields tuples of (name, default_value) for each parameter in the list
+ If no default is given, then it is default_value is None (not Leaf(token.NAME, 'None'))
+ """
+ assert raw_params[0].type == token.STAR and len(raw_params) > 2
+ curr_idx = 2 # the first place a keyword-only parameter name can be is index 2
+ max_idx = len(raw_params)
+ while curr_idx < max_idx:
+ curr_item = raw_params[curr_idx]
+ prev_item = curr_item.prev_sibling
+ if curr_item.type != token.NAME:
+ curr_idx += 1
+ continue
+ if prev_item is not None and prev_item.type == token.DOUBLESTAR:
+ break
+ name = curr_item.value
+ nxt = curr_item.next_sibling
+ if nxt is not None and nxt.type == token.EQUAL:
+ default_value = nxt.next_sibling
+ curr_idx += 2
+ else:
+ default_value = None
+ yield (name, default_value)
+ curr_idx += 1
+
+def remove_params(raw_params, kwargs_default=_kwargs_default_name):
+ u"""
+ Removes all keyword-only args from the params list and a bare star, if any.
+ Does not add the kwargs dict if needed.
+ Returns True if more action is needed, False if not
+ (more action is needed if no kwargs dict exists)
+ """
+ assert raw_params[0].type == token.STAR
+ if raw_params[1].type == token.COMMA:
+ raw_params[0].remove()
+ raw_params[1].remove()
+ kw_params = raw_params[2:]
+ else:
+ kw_params = raw_params[3:]
+ for param in kw_params:
+ if param.type != token.DOUBLESTAR:
+ param.remove()
+ else:
+ return False
+ else:
+ return True
+
+def needs_fixing(raw_params, kwargs_default=_kwargs_default_name):
+ u"""
+ Returns string with the name of the kwargs dict if the params after the first star need fixing
+ Otherwise returns empty string
+ """
+ found_kwargs = False
+ needs_fix = False
+
+ for t in raw_params[2:]:
+ if t.type == token.COMMA:
+ # Commas are irrelevant at this stage.
+ continue
+ elif t.type == token.NAME and not found_kwargs:
+ # Keyword-only argument: definitely need to fix.
+ needs_fix = True
+ elif t.type == token.NAME and found_kwargs:
+ # Return 'foobar' of **foobar, if needed.
+ return t.value if needs_fix else u''
+ elif t.type == token.DOUBLESTAR:
+ # Found either '*' from **foobar.
+ found_kwargs = True
+ else:
+ # Never found **foobar. Return a synthetic name, if needed.
+ return kwargs_default if needs_fix else u''
+
+class FixKwargs(fixer_base.BaseFix):
+
+ run_order = 7 # Run after function annotations are removed
+
+ PATTERN = u"funcdef< 'def' NAME parameters< '(' arglist=typedargslist< params=any* > ')' > ':' suite=any >"
+
+ def transform(self, node, results):
+ params_rawlist = results[u"params"]
+ for i, item in enumerate(params_rawlist):
+ if item.type == token.STAR:
+ params_rawlist = params_rawlist[i:]
+ break
+ else:
+ return
+ # params is guaranteed to be a list starting with *.
+ # if fixing is needed, there will be at least 3 items in this list:
+ # [STAR, COMMA, NAME] is the minimum that we need to worry about.
+ new_kwargs = needs_fixing(params_rawlist)
+ # new_kwargs is the name of the kwargs dictionary.
+ if not new_kwargs:
+ return
+ suitify(node)
+
+ # At this point, params_rawlist is guaranteed to be a list
+ # beginning with a star that includes at least one keyword-only param
+ # e.g., [STAR, NAME, COMMA, NAME, COMMA, DOUBLESTAR, NAME] or
+ # [STAR, COMMA, NAME], or [STAR, COMMA, NAME, COMMA, DOUBLESTAR, NAME]
+
+ # Anatomy of a funcdef: ['def', 'name', parameters, ':', suite]
+ # Anatomy of that suite: [NEWLINE, INDENT, first_stmt, all_other_stmts]
+ # We need to insert our new stuff before the first_stmt and change the
+ # first_stmt's prefix.
+
+ suite = node.children[4]
+ first_stmt = suite.children[2]
+ ident = indentation(first_stmt)
+
+ for name, default_value in gen_params(params_rawlist):
+ if default_value is None:
+ suite.insert_child(2, Newline())
+ suite.insert_child(2, String(_assign_template %{u'name':name, u'kwargs':new_kwargs}, prefix=ident))
+ else:
+ suite.insert_child(2, Newline())
+ suite.insert_child(2, String(_else_template %{u'name':name, u'default':default_value}, prefix=ident))
+ suite.insert_child(2, Newline())
+ suite.insert_child(2, String(_if_template %{u'assign':_assign_template %{u'name':name, u'kwargs':new_kwargs}, u'name':name, u'kwargs':new_kwargs}, prefix=ident))
+ first_stmt.prefix = ident
+ suite.children[2].prefix = u""
+
+ # Now, we need to fix up the list of params.
+
+ must_add_kwargs = remove_params(params_rawlist)
+ if must_add_kwargs:
+ arglist = results[u'arglist']
+ if len(arglist.children) > 0 and arglist.children[-1].type != token.COMMA:
+ arglist.append_child(Comma())
+ arglist.append_child(DoubleStar(prefix=u" "))
+ arglist.append_child(Name(new_kwargs))
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_memoryview.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_memoryview.py
new file mode 100644
index 0000000..a20f6f3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_memoryview.py
@@ -0,0 +1,21 @@
+u"""
+Fixer for memoryview(s) -> buffer(s).
+Explicit because some memoryview methods are invalid on buffer objects.
+"""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Name
+
+
+class FixMemoryview(fixer_base.BaseFix):
+
+ explicit = True # User must specify that they want this.
+
+ PATTERN = u"""
+ power< name='memoryview' trailer< '(' [any] ')' >
+ rest=any* >
+ """
+
+ def transform(self, node, results):
+ name = results[u"name"]
+ name.replace(Name(u"buffer", prefix=name.prefix))
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_metaclass.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_metaclass.py
new file mode 100644
index 0000000..5e6e64d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_metaclass.py
@@ -0,0 +1,78 @@
+u"""
+Fixer for (metaclass=X) -> __metaclass__ = X
+Some semantics (see PEP 3115) may be altered in the translation."""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Name, syms, Node, Leaf, Newline, find_root
+from lib2to3.pygram import token
+from libfuturize.fixer_util import indentation, suitify
+# from ..fixer_util import Name, syms, Node, Leaf, Newline, find_root, indentation, suitify
+
+def has_metaclass(parent):
+ results = None
+ for node in parent.children:
+ kids = node.children
+ if node.type == syms.argument:
+ if kids[0] == Leaf(token.NAME, u"metaclass") and \
+ kids[1] == Leaf(token.EQUAL, u"=") and \
+ kids[2]:
+ #Hack to avoid "class X(=):" with this case.
+ results = [node] + kids
+ break
+ elif node.type == syms.arglist:
+ # Argument list... loop through it looking for:
+ # Node(*, [*, Leaf(token.NAME, u"metaclass"), Leaf(token.EQUAL, u"="), Leaf(*, *)]
+ for child in node.children:
+ if results: break
+ if child.type == token.COMMA:
+ #Store the last comma, which precedes the metaclass
+ comma = child
+ elif type(child) == Node:
+ meta = equal = name = None
+ for arg in child.children:
+ if arg == Leaf(token.NAME, u"metaclass"):
+ #We have the (metaclass) part
+ meta = arg
+ elif meta and arg == Leaf(token.EQUAL, u"="):
+ #We have the (metaclass=) part
+ equal = arg
+ elif meta and equal:
+ #Here we go, we have (metaclass=X)
+ name = arg
+ results = (comma, meta, equal, name)
+ break
+ return results
+
+
+class FixMetaclass(fixer_base.BaseFix):
+
+ PATTERN = u"""
+ classdef
+ """
+
+ def transform(self, node, results):
+ meta_results = has_metaclass(node)
+ if not meta_results: return
+ for meta in meta_results:
+ meta.remove()
+ target = Leaf(token.NAME, u"__metaclass__")
+ equal = Leaf(token.EQUAL, u"=", prefix=u" ")
+ # meta is the last item in what was returned by has_metaclass(): name
+ name = meta
+ name.prefix = u" "
+ stmt_node = Node(syms.atom, [target, equal, name])
+
+ suitify(node)
+ for item in node.children:
+ if item.type == syms.suite:
+ for stmt in item.children:
+ if stmt.type == token.INDENT:
+ # Insert, in reverse order, the statement, a newline,
+ # and an indent right after the first indented line
+ loc = item.children.index(stmt) + 1
+ # Keep consistent indentation form
+ ident = Leaf(token.INDENT, stmt.value)
+ item.insert_child(loc, ident)
+ item.insert_child(loc, Newline())
+ item.insert_child(loc, stmt_node)
+ break
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_newstyle.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_newstyle.py
new file mode 100644
index 0000000..cc6b3ad
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_newstyle.py
@@ -0,0 +1,33 @@
+u"""
+Fixer for "class Foo: ..." -> "class Foo(object): ..."
+"""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import LParen, RParen, Name
+
+from libfuturize.fixer_util import touch_import_top
+
+
+def insert_object(node, idx):
+ node.insert_child(idx, RParen())
+ node.insert_child(idx, Name(u"object"))
+ node.insert_child(idx, LParen())
+
+class FixNewstyle(fixer_base.BaseFix):
+
+ # Match:
+ # class Blah:
+ # and:
+ # class Blah():
+
+ PATTERN = u"classdef< 'class' NAME ['(' ')'] colon=':' any >"
+
+ def transform(self, node, results):
+ colon = results[u"colon"]
+ idx = node.children.index(colon)
+ if (node.children[idx-2].value == '(' and
+ node.children[idx-1].value == ')'):
+ del node.children[idx-2:idx]
+ idx -= 2
+ insert_object(node, idx)
+ touch_import_top(u'builtins', 'object', node)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_next.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_next.py
new file mode 100644
index 0000000..9ecb6c0
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_next.py
@@ -0,0 +1,43 @@
+u"""
+Fixer for:
+it.__next__() -> it.next().
+next(it) -> it.next().
+"""
+
+from lib2to3.pgen2 import token
+from lib2to3.pygram import python_symbols as syms
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Name, Call, find_binding, Attr
+
+bind_warning = u"Calls to builtin next() possibly shadowed by global binding"
+
+
+class FixNext(fixer_base.BaseFix):
+
+ PATTERN = u"""
+ power< base=any+ trailer< '.' attr='__next__' > any* >
+ |
+ power< head='next' trailer< '(' arg=any ')' > any* >
+ |
+ classdef< 'class' base=any+ ':'
+ suite< any*
+ funcdef< 'def'
+ attr='__next__'
+ parameters< '(' NAME ')' > any+ >
+ any* > >
+ """
+
+ def transform(self, node, results):
+ assert results
+
+ base = results.get(u"base")
+ attr = results.get(u"attr")
+ head = results.get(u"head")
+ arg_ = results.get(u"arg")
+ if arg_:
+ arg = arg_.clone()
+ head.replace(Attr(Name(unicode(arg),prefix=head.prefix),
+ Name(u"next")))
+ arg_.remove()
+ elif base:
+ attr.replace(Name(u"next", prefix=attr.prefix))
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_printfunction.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_printfunction.py
new file mode 100644
index 0000000..a2a6e08
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_printfunction.py
@@ -0,0 +1,17 @@
+u"""
+Fixer for print: from __future__ import print_function.
+"""
+
+from lib2to3 import fixer_base
+from libfuturize.fixer_util import future_import
+
+class FixPrintfunction(fixer_base.BaseFix):
+
+ # explicit = True
+
+ PATTERN = u"""
+ power< 'print' trailer < '(' any* ')' > any* >
+ """
+
+ def transform(self, node, results):
+ future_import(u"print_function", node)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_raise.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_raise.py
new file mode 100644
index 0000000..9c9c192
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_raise.py
@@ -0,0 +1,25 @@
+u"""Fixer for 'raise E(V).with_traceback(T)' -> 'raise E, V, T'"""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Comma, Node, Leaf, token, syms
+
+class FixRaise(fixer_base.BaseFix):
+
+ PATTERN = u"""
+ raise_stmt< 'raise' (power< name=any [trailer< '(' val=any* ')' >]
+ [trailer< '.' 'with_traceback' > trailer< '(' trc=any ')' >] > | any) ['from' chain=any] >"""
+
+ def transform(self, node, results):
+ name, val, trc = (results.get(u"name"), results.get(u"val"), results.get(u"trc"))
+ chain = results.get(u"chain")
+ if chain is not None:
+ self.warning(node, u"explicit exception chaining is not supported in Python 2")
+ chain.prev_sibling.remove()
+ chain.remove()
+ if trc is not None:
+ val = val[0] if val else Leaf(token.NAME, u"None")
+ val.prefix = trc.prefix = u" "
+ kids = [Leaf(token.NAME, u"raise"), name.clone(), Comma(),
+ val.clone(), Comma(), trc.clone()]
+ raise_stmt = Node(syms.raise_stmt, kids)
+ node.replace(raise_stmt)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_raise_.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_raise_.py
new file mode 100644
index 0000000..0f020c4
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_raise_.py
@@ -0,0 +1,35 @@
+u"""Fixer for
+ raise E(V).with_traceback(T)
+ to:
+ from future.utils import raise_
+ ...
+ raise_(E, V, T)
+
+TODO: FIXME!!
+
+"""
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import Comma, Node, Leaf, token, syms
+
+class FixRaise(fixer_base.BaseFix):
+
+ PATTERN = u"""
+ raise_stmt< 'raise' (power< name=any [trailer< '(' val=any* ')' >]
+ [trailer< '.' 'with_traceback' > trailer< '(' trc=any ')' >] > | any) ['from' chain=any] >"""
+
+ def transform(self, node, results):
+ FIXME
+ name, val, trc = (results.get(u"name"), results.get(u"val"), results.get(u"trc"))
+ chain = results.get(u"chain")
+ if chain is not None:
+ self.warning(node, u"explicit exception chaining is not supported in Python 2")
+ chain.prev_sibling.remove()
+ chain.remove()
+ if trc is not None:
+ val = val[0] if val else Leaf(token.NAME, u"None")
+ val.prefix = trc.prefix = u" "
+ kids = [Leaf(token.NAME, u"raise"), name.clone(), Comma(),
+ val.clone(), Comma(), trc.clone()]
+ raise_stmt = Node(syms.raise_stmt, kids)
+ node.replace(raise_stmt)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_throw.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_throw.py
new file mode 100644
index 0000000..c0feed1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_throw.py
@@ -0,0 +1,23 @@
+u"""Fixer for 'g.throw(E(V).with_traceback(T))' -> 'g.throw(E, V, T)'"""
+
+from lib2to3 import fixer_base
+from lib2to3.pytree import Node, Leaf
+from lib2to3.pgen2 import token
+from lib2to3.fixer_util import Comma
+
+class FixThrow(fixer_base.BaseFix):
+
+ PATTERN = u"""
+ power< any trailer< '.' 'throw' >
+ trailer< '(' args=power< exc=any trailer< '(' val=any* ')' >
+ trailer< '.' 'with_traceback' > trailer< '(' trc=any ')' > > ')' > >
+ """
+
+ def transform(self, node, results):
+ syms = self.syms
+ exc, val, trc = (results[u"exc"], results[u"val"], results[u"trc"])
+ val = val[0] if val else Leaf(token.NAME, u"None")
+ val.prefix = trc.prefix = u" "
+ kids = [exc.clone(), Comma(), val.clone(), Comma(), trc.clone()]
+ args = results[u"args"]
+ args.children = kids
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_unpacking.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_unpacking.py
new file mode 100644
index 0000000..1e53a9b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/fixes/fix_unpacking.py
@@ -0,0 +1,120 @@
+u"""
+Fixer for:
+(a,)* *b (,c)* [,] = s
+for (a,)* *b (,c)* [,] in d: ...
+"""
+
+from lib2to3 import fixer_base
+from itertools import count
+from lib2to3.fixer_util import (Assign, Comma, Call, Newline, Name,
+ Number, token, syms, Node, Leaf)
+from libfuturize.fixer_util import indentation, suitify, commatize
+# from libfuturize.fixer_util import Assign, Comma, Call, Newline, Name, Number, indentation, suitify, commatize, token, syms, Node, Leaf
+
+def assignment_source(num_pre, num_post, LISTNAME, ITERNAME):
+ u"""
+ Accepts num_pre and num_post, which are counts of values
+ before and after the starg (not including the starg)
+ Returns a source fit for Assign() from fixer_util
+ """
+ children = []
+ pre = unicode(num_pre)
+ post = unicode(num_post)
+ # This code builds the assignment source from lib2to3 tree primitives.
+ # It's not very readable, but it seems like the most correct way to do it.
+ if num_pre > 0:
+ pre_part = Node(syms.power, [Name(LISTNAME), Node(syms.trailer, [Leaf(token.LSQB, u"["), Node(syms.subscript, [Leaf(token.COLON, u":"), Number(pre)]), Leaf(token.RSQB, u"]")])])
+ children.append(pre_part)
+ children.append(Leaf(token.PLUS, u"+", prefix=u" "))
+ main_part = Node(syms.power, [Leaf(token.LSQB, u"[", prefix=u" "), Name(LISTNAME), Node(syms.trailer, [Leaf(token.LSQB, u"["), Node(syms.subscript, [Number(pre) if num_pre > 0 else Leaf(1, u""), Leaf(token.COLON, u":"), Node(syms.factor, [Leaf(token.MINUS, u"-"), Number(post)]) if num_post > 0 else Leaf(1, u"")]), Leaf(token.RSQB, u"]"), Leaf(token.RSQB, u"]")])])
+ children.append(main_part)
+ if num_post > 0:
+ children.append(Leaf(token.PLUS, u"+", prefix=u" "))
+ post_part = Node(syms.power, [Name(LISTNAME, prefix=u" "), Node(syms.trailer, [Leaf(token.LSQB, u"["), Node(syms.subscript, [Node(syms.factor, [Leaf(token.MINUS, u"-"), Number(post)]), Leaf(token.COLON, u":")]), Leaf(token.RSQB, u"]")])])
+ children.append(post_part)
+ source = Node(syms.arith_expr, children)
+ return source
+
+class FixUnpacking(fixer_base.BaseFix):
+
+ PATTERN = u"""
+ expl=expr_stmt< testlist_star_expr<
+ pre=(any ',')*
+ star_expr< '*' name=NAME >
+ post=(',' any)* [','] > '=' source=any > |
+ impl=for_stmt< 'for' lst=exprlist<
+ pre=(any ',')*
+ star_expr< '*' name=NAME >
+ post=(',' any)* [','] > 'in' it=any ':' suite=any>"""
+
+ def fix_explicit_context(self, node, results):
+ pre, name, post, source = (results.get(n) for n in (u"pre", u"name", u"post", u"source"))
+ pre = [n.clone() for n in pre if n.type == token.NAME]
+ name.prefix = u" "
+ post = [n.clone() for n in post if n.type == token.NAME]
+ target = [n.clone() for n in commatize(pre + [name.clone()] + post)]
+ # to make the special-case fix for "*z, = ..." correct with the least
+ # amount of modification, make the left-side into a guaranteed tuple
+ target.append(Comma())
+ source.prefix = u""
+ setup_line = Assign(Name(self.LISTNAME), Call(Name(u"list"), [source.clone()]))
+ power_line = Assign(target, assignment_source(len(pre), len(post), self.LISTNAME, self.ITERNAME))
+ return setup_line, power_line
+
+ def fix_implicit_context(self, node, results):
+ u"""
+ Only example of the implicit context is
+ a for loop, so only fix that.
+ """
+ pre, name, post, it = (results.get(n) for n in (u"pre", u"name", u"post", u"it"))
+ pre = [n.clone() for n in pre if n.type == token.NAME]
+ name.prefix = u" "
+ post = [n.clone() for n in post if n.type == token.NAME]
+ target = [n.clone() for n in commatize(pre + [name.clone()] + post)]
+ # to make the special-case fix for "*z, = ..." correct with the least
+ # amount of modification, make the left-side into a guaranteed tuple
+ target.append(Comma())
+ source = it.clone()
+ source.prefix = u""
+ setup_line = Assign(Name(self.LISTNAME), Call(Name(u"list"), [Name(self.ITERNAME)]))
+ power_line = Assign(target, assignment_source(len(pre), len(post), self.LISTNAME, self.ITERNAME))
+ return setup_line, power_line
+
+ def transform(self, node, results):
+ u"""
+ a,b,c,d,e,f,*g,h,i = range(100) changes to
+ _3to2list = list(range(100))
+ a,b,c,d,e,f,g,h,i, = _3to2list[:6] + [_3to2list[6:-2]] + _3to2list[-2:]
+
+ and
+
+ for a,b,*c,d,e in iter_of_iters: do_stuff changes to
+ for _3to2iter in iter_of_iters:
+ _3to2list = list(_3to2iter)
+ a,b,c,d,e, = _3to2list[:2] + [_3to2list[2:-2]] + _3to2list[-2:]
+ do_stuff
+ """
+ self.LISTNAME = self.new_name(u"_3to2list")
+ self.ITERNAME = self.new_name(u"_3to2iter")
+ expl, impl = results.get(u"expl"), results.get(u"impl")
+ if expl is not None:
+ setup_line, power_line = self.fix_explicit_context(node, results)
+ setup_line.prefix = expl.prefix
+ power_line.prefix = indentation(expl.parent)
+ setup_line.append_child(Newline())
+ parent = node.parent
+ i = node.remove()
+ parent.insert_child(i, power_line)
+ parent.insert_child(i, setup_line)
+ elif impl is not None:
+ setup_line, power_line = self.fix_implicit_context(node, results)
+ suitify(node)
+ suite = [k for k in node.children if k.type == syms.suite][0]
+ setup_line.prefix = u""
+ power_line.prefix = suite.children[1].value
+ suite.children[2].prefix = indentation(suite.children[2])
+ suite.insert_child(2, Newline())
+ suite.insert_child(2, power_line)
+ suite.insert_child(2, Newline())
+ suite.insert_child(2, setup_line)
+ results.get(u"lst").replace(Name(self.ITERNAME, prefix=u" "))
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/main.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/main.py
new file mode 100644
index 0000000..cc0e6ec
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/libpasteurize/main.py
@@ -0,0 +1,149 @@
+"""
+pasteurize: automatic conversion of Python 3 code to clean 2/3 code
+===================================================================
+
+``pasteurize`` attempts to convert existing Python 3 code into source-compatible
+Python 2 and 3 code.
+
+Use it like this on Python 3 code:
+
+ $ pasteurize --verbose mypython3script.py
+
+This removes any Py3-only syntax (e.g. new metaclasses) and adds these
+import lines:
+
+ from __future__ import absolute_import
+ from __future__ import division
+ from __future__ import print_function
+ from __future__ import unicode_literals
+ from future import standard_library
+ standard_library.install_hooks()
+ from builtins import *
+
+To write changes to the files, use the -w flag.
+
+It also adds any other wrappers needed for Py2/3 compatibility.
+
+Note that separate stages are not available (or needed) when converting from
+Python 3 with ``pasteurize`` as they are when converting from Python 2 with
+``futurize``.
+
+The --all-imports option forces adding all ``__future__`` imports,
+``builtins`` imports, and standard library aliases, even if they don't
+seem necessary for the current state of each module. (This can simplify
+testing, and can reduce the need to think about Py2 compatibility when editing
+the code further.)
+
+"""
+
+from __future__ import (absolute_import, print_function, unicode_literals)
+
+import sys
+import logging
+import optparse
+from lib2to3.main import main, warn, StdoutRefactoringTool
+from lib2to3 import refactor
+
+from future import __version__
+from libpasteurize.fixes import fix_names
+
+
+def main(args=None):
+ """Main program.
+
+ Returns a suggested exit status (0, 1, 2).
+ """
+ # Set up option parser
+ parser = optparse.OptionParser(usage="pasteurize [options] file|dir ...")
+ parser.add_option("-V", "--version", action="store_true",
+ help="Report the version number of pasteurize")
+ parser.add_option("-a", "--all-imports", action="store_true",
+ help="Adds all __future__ and future imports to each module")
+ parser.add_option("-f", "--fix", action="append", default=[],
+ help="Each FIX specifies a transformation; default: all")
+ parser.add_option("-j", "--processes", action="store", default=1,
+ type="int", help="Run 2to3 concurrently")
+ parser.add_option("-x", "--nofix", action="append", default=[],
+ help="Prevent a fixer from being run.")
+ parser.add_option("-l", "--list-fixes", action="store_true",
+ help="List available transformations")
+ # parser.add_option("-p", "--print-function", action="store_true",
+ # help="Modify the grammar so that print() is a function")
+ parser.add_option("-v", "--verbose", action="store_true",
+ help="More verbose logging")
+ parser.add_option("--no-diffs", action="store_true",
+ help="Don't show diffs of the refactoring")
+ parser.add_option("-w", "--write", action="store_true",
+ help="Write back modified files")
+ parser.add_option("-n", "--nobackups", action="store_true", default=False,
+ help="Don't write backups for modified files.")
+
+ # Parse command line arguments
+ refactor_stdin = False
+ flags = {}
+ options, args = parser.parse_args(args)
+ fixer_pkg = 'libpasteurize.fixes'
+ avail_fixes = fix_names
+ flags["print_function"] = True
+
+ if not options.write and options.no_diffs:
+ warn("not writing files and not printing diffs; that's not very useful")
+ if not options.write and options.nobackups:
+ parser.error("Can't use -n without -w")
+ if options.version:
+ print(__version__)
+ return 0
+ if options.list_fixes:
+ print("Available transformations for the -f/--fix option:")
+ for fixname in sorted(avail_fixes):
+ print(fixname)
+ if not args:
+ return 0
+ if not args:
+ print("At least one file or directory argument required.",
+ file=sys.stderr)
+ print("Use --help to show usage.", file=sys.stderr)
+ return 2
+ if "-" in args:
+ refactor_stdin = True
+ if options.write:
+ print("Can't write to stdin.", file=sys.stderr)
+ return 2
+
+ # Set up logging handler
+ level = logging.DEBUG if options.verbose else logging.INFO
+ logging.basicConfig(format='%(name)s: %(message)s', level=level)
+
+ # Initialize the refactoring tool
+ unwanted_fixes = set(fixer_pkg + ".fix_" + fix for fix in options.nofix)
+
+ extra_fixes = set()
+ if options.all_imports:
+ prefix = 'libpasteurize.fixes.'
+ extra_fixes.add(prefix + 'fix_add_all__future__imports')
+ extra_fixes.add(prefix + 'fix_add_future_standard_library_import')
+ extra_fixes.add(prefix + 'fix_add_all_future_builtins')
+
+ fixer_names = avail_fixes | extra_fixes - unwanted_fixes
+
+ rt = StdoutRefactoringTool(sorted(fixer_names), flags, set(),
+ options.nobackups, not options.no_diffs)
+
+ # Refactor all files and directories passed as arguments
+ if not rt.errors:
+ if refactor_stdin:
+ rt.refactor_stdin()
+ else:
+ try:
+ rt.refactor(args, options.write, None,
+ options.processes)
+ except refactor.MultiprocessingUnsupported:
+ assert options.processes > 1
+ print("Sorry, -j isn't " \
+ "supported on this platform.", file=sys.stderr)
+ return 1
+ rt.summarize()
+
+ # Return error status (0 if rt.errors is zero)
+ return int(bool(rt.errors))
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/__init__.py
new file mode 100644
index 0000000..e31678b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/__init__.py
@@ -0,0 +1,93 @@
+# coding=utf-8
+"""
+past: compatibility with Python 2 from Python 3
+===============================================
+
+``past`` is a package to aid with Python 2/3 compatibility. Whereas ``future``
+contains backports of Python 3 constructs to Python 2, ``past`` provides
+implementations of some Python 2 constructs in Python 3 and tools to import and
+run Python 2 code in Python 3. It is intended to be used sparingly, as a way of
+running old Python 2 code from Python 3 until the code is ported properly.
+
+Potential uses for libraries:
+
+- as a step in porting a Python 2 codebase to Python 3 (e.g. with the ``futurize`` script)
+- to provide Python 3 support for previously Python 2-only libraries with the
+ same APIs as on Python 2 -- particularly with regard to 8-bit strings (the
+ ``past.builtins.str`` type).
+- to aid in providing minimal-effort Python 3 support for applications using
+ libraries that do not yet wish to upgrade their code properly to Python 3, or
+ wish to upgrade it gradually to Python 3 style.
+
+
+Here are some code examples that run identically on Python 3 and 2::
+
+ >>> from past.builtins import str as oldstr
+
+ >>> philosopher = oldstr(u'\u5b54\u5b50'.encode('utf-8'))
+ >>> # This now behaves like a Py2 byte-string on both Py2 and Py3.
+ >>> # For example, indexing returns a Python 2-like string object, not
+ >>> # an integer:
+ >>> philosopher[0]
+ '\xe5'
+ >>> type(philosopher[0])
+
+
+ >>> # List-producing versions of range, reduce, map, filter
+ >>> from past.builtins import range, reduce
+ >>> range(10)
+ [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+ >>> reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])
+ 15
+
+ >>> # Other functions removed in Python 3 are resurrected ...
+ >>> from past.builtins import execfile
+ >>> execfile('myfile.py')
+
+ >>> from past.builtins import raw_input
+ >>> name = raw_input('What is your name? ')
+ What is your name? [cursor]
+
+ >>> from past.builtins import reload
+ >>> reload(mymodule) # equivalent to imp.reload(mymodule) in Python 3
+
+ >>> from past.builtins import xrange
+ >>> for i in xrange(10):
+ ... pass
+
+
+It also provides import hooks so you can import and use Python 2 modules like
+this::
+
+ $ python3
+
+ >>> from past import autotranslate
+ >>> authotranslate('mypy2module')
+ >>> import mypy2module
+
+until the authors of the Python 2 modules have upgraded their code. Then, for
+example::
+
+ >>> mypy2module.func_taking_py2_string(oldstr(b'abcd'))
+
+
+Credits
+-------
+
+:Author: Ed Schofield
+:Sponsor: Python Charmers Pty Ltd, Australia: http://pythoncharmers.com
+
+
+Licensing
+---------
+Copyright 2013-2015 Python Charmers Pty Ltd, Australia.
+The software is distributed under an MIT licence. See LICENSE.txt.
+"""
+
+
+from past.translation import install_hooks as autotranslate
+from future import __version__, __copyright__, __license__
+
+__title__ = 'past'
+__author__ = 'Ed Schofield'
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/builtins/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/builtins/__init__.py
new file mode 100644
index 0000000..a967736
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/builtins/__init__.py
@@ -0,0 +1,72 @@
+"""
+A resurrection of some old functions from Python 2 for use in Python 3. These
+should be used sparingly, to help with porting efforts, since code using them
+is no longer standard Python 3 code.
+
+This module provides the following:
+
+1. Implementations of these builtin functions which have no equivalent on Py3:
+
+- apply
+- chr
+- cmp
+- execfile
+
+2. Aliases:
+
+- intern <- sys.intern
+- raw_input <- input
+- reduce <- functools.reduce
+- reload <- imp.reload
+- unichr <- chr
+- unicode <- str
+- xrange <- range
+
+3. List-producing versions of the corresponding Python 3 iterator-producing functions:
+
+- filter
+- map
+- range
+- zip
+
+4. Forward-ported Py2 types:
+
+- basestring
+- dict
+- str
+- long
+- unicode
+
+"""
+
+from future.utils import PY3
+from past.builtins.noniterators import (filter, map, range, reduce, zip)
+# from past.builtins.misc import (ascii, hex, input, oct, open)
+if PY3:
+ from past.types import (basestring,
+ olddict as dict,
+ oldstr as str,
+ long,
+ unicode)
+else:
+ from __builtin__ import (basestring, dict, str, long, unicode)
+
+from past.builtins.misc import (apply, chr, cmp, execfile, intern, oct,
+ raw_input, reload, unichr, unicode, xrange)
+from past import utils
+
+
+if utils.PY3:
+ # We only import names that shadow the builtins on Py3. No other namespace
+ # pollution on Py3.
+
+ # Only shadow builtins on Py3; no new names
+ __all__ = ['filter', 'map', 'range', 'reduce', 'zip',
+ 'basestring', 'dict', 'str', 'long', 'unicode',
+ 'apply', 'chr', 'cmp', 'execfile', 'intern', 'raw_input',
+ 'reload', 'unichr', 'xrange'
+ ]
+
+else:
+ # No namespace pollution on Py2
+ __all__ = []
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/builtins/misc.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/builtins/misc.py
new file mode 100644
index 0000000..55dc63c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/builtins/misc.py
@@ -0,0 +1,90 @@
+from __future__ import unicode_literals
+import sys
+import inspect
+from collections import Mapping
+
+from future.utils import PY3, exec_
+
+
+if PY3:
+ import builtins
+
+ def apply(f, *args, **kw):
+ return f(*args, **kw)
+
+ from past.builtins import str as oldstr
+
+ def chr(i):
+ """
+ Return a byte-string of one character with ordinal i; 0 <= i <= 256
+ """
+ return oldstr(bytes((i,)))
+
+ def cmp(x, y):
+ """
+ cmp(x, y) -> integer
+
+ Return negative if xy.
+ """
+ return (x > y) - (x < y)
+
+ from sys import intern
+
+ def oct(number):
+ """oct(number) -> string
+
+ Return the octal representation of an integer
+ """
+ return '0' + builtins.oct(number)[2:]
+
+ raw_input = input
+ from imp import reload
+ unicode = str
+ unichr = chr
+ xrange = range
+else:
+ import __builtin__
+ apply = __builtin__.apply
+ chr = __builtin__.chr
+ cmp = __builtin__.cmp
+ execfile = __builtin__.execfile
+ intern = __builtin__.intern
+ oct = __builtin__.oct
+ raw_input = __builtin__.raw_input
+ reload = __builtin__.reload
+ unicode = __builtin__.unicode
+ unichr = __builtin__.unichr
+ xrange = __builtin__.xrange
+
+
+if PY3:
+ def execfile(filename, myglobals=None, mylocals=None):
+ """
+ Read and execute a Python script from a file in the given namespaces.
+ The globals and locals are dictionaries, defaulting to the current
+ globals and locals. If only globals is given, locals defaults to it.
+ """
+ if myglobals is None:
+ # There seems to be no alternative to frame hacking here.
+ caller_frame = inspect.stack()[1]
+ myglobals = caller_frame[0].f_globals
+ mylocals = caller_frame[0].f_locals
+ elif mylocals is None:
+ # Only if myglobals is given do we set mylocals to it.
+ mylocals = myglobals
+ if not isinstance(myglobals, Mapping):
+ raise TypeError('globals must be a mapping')
+ if not isinstance(mylocals, Mapping):
+ raise TypeError('locals must be a mapping')
+ with open(filename, "rbU") as fin:
+ source = fin.read()
+ code = compile(source, filename, "exec")
+ exec_(code, myglobals, mylocals)
+
+
+if PY3:
+ __all__ = ['apply', 'chr', 'cmp', 'execfile', 'intern', 'raw_input',
+ 'reload', 'unichr', 'unicode', 'xrange']
+else:
+ __all__ = []
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/builtins/noniterators.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/builtins/noniterators.py
new file mode 100644
index 0000000..66a4a8a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/builtins/noniterators.py
@@ -0,0 +1,273 @@
+"""
+This module is designed to be used as follows::
+
+ from past.builtins.noniterators import filter, map, range, reduce, zip
+
+And then, for example::
+
+ assert isinstance(range(5), list)
+
+The list-producing functions this brings in are::
+
+- ``filter``
+- ``map``
+- ``range``
+- ``reduce``
+- ``zip``
+
+"""
+
+from __future__ import division, absolute_import, print_function
+
+from itertools import chain, starmap
+import itertools # since zip_longest doesn't exist on Py2
+from past.types import basestring
+from past.utils import PY3
+
+
+def flatmap(f, items):
+ return chain.from_iterable(map(f, items))
+
+
+if PY3:
+ import builtins
+
+ # list-producing versions of the major Python iterating functions
+ def oldfilter(*args):
+ """
+ filter(function or None, sequence) -> list, tuple, or string
+
+ Return those items of sequence for which function(item) is true.
+ If function is None, return the items that are true. If sequence
+ is a tuple or string, return the same type, else return a list.
+ """
+ mytype = type(args[1])
+ if isinstance(args[1], basestring):
+ return mytype().join(builtins.filter(*args))
+ elif isinstance(args[1], (tuple, list)):
+ return mytype(builtins.filter(*args))
+ else:
+ # Fall back to list. Is this the right thing to do?
+ return list(builtins.filter(*args))
+
+ # This is surprisingly difficult to get right. For example, the
+ # solutions here fail with the test cases in the docstring below:
+ # http://stackoverflow.com/questions/8072755/
+ def oldmap(func, *iterables):
+ """
+ map(function, sequence[, sequence, ...]) -> list
+
+ Return a list of the results of applying the function to the
+ items of the argument sequence(s). If more than one sequence is
+ given, the function is called with an argument list consisting of
+ the corresponding item of each sequence, substituting None for
+ missing values when not all sequences have the same length. If
+ the function is None, return a list of the items of the sequence
+ (or a list of tuples if more than one sequence).
+
+ Test cases:
+ >>> oldmap(None, 'hello world')
+ ['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']
+
+ >>> oldmap(None, range(4))
+ [0, 1, 2, 3]
+
+ More test cases are in past.tests.test_builtins.
+ """
+ zipped = itertools.zip_longest(*iterables)
+ l = list(zipped)
+ if len(l) == 0:
+ return []
+ if func is None:
+ result = l
+ else:
+ result = list(starmap(func, l))
+
+ # Inspect to see whether it's a simple sequence of tuples
+ try:
+ if max([len(item) for item in result]) == 1:
+ return list(chain.from_iterable(result))
+ # return list(flatmap(func, result))
+ except TypeError as e:
+ # Simple objects like ints have no len()
+ pass
+ return result
+
+ ############################
+ ### For reference, the source code for Py2.7 map function:
+ # static PyObject *
+ # builtin_map(PyObject *self, PyObject *args)
+ # {
+ # typedef struct {
+ # PyObject *it; /* the iterator object */
+ # int saw_StopIteration; /* bool: did the iterator end? */
+ # } sequence;
+ #
+ # PyObject *func, *result;
+ # sequence *seqs = NULL, *sqp;
+ # Py_ssize_t n, len;
+ # register int i, j;
+ #
+ # n = PyTuple_Size(args);
+ # if (n < 2) {
+ # PyErr_SetString(PyExc_TypeError,
+ # "map() requires at least two args");
+ # return NULL;
+ # }
+ #
+ # func = PyTuple_GetItem(args, 0);
+ # n--;
+ #
+ # if (func == Py_None) {
+ # if (PyErr_WarnPy3k("map(None, ...) not supported in 3.x; "
+ # "use list(...)", 1) < 0)
+ # return NULL;
+ # if (n == 1) {
+ # /* map(None, S) is the same as list(S). */
+ # return PySequence_List(PyTuple_GetItem(args, 1));
+ # }
+ # }
+ #
+ # /* Get space for sequence descriptors. Must NULL out the iterator
+ # * pointers so that jumping to Fail_2 later doesn't see trash.
+ # */
+ # if ((seqs = PyMem_NEW(sequence, n)) == NULL) {
+ # PyErr_NoMemory();
+ # return NULL;
+ # }
+ # for (i = 0; i < n; ++i) {
+ # seqs[i].it = (PyObject*)NULL;
+ # seqs[i].saw_StopIteration = 0;
+ # }
+ #
+ # /* Do a first pass to obtain iterators for the arguments, and set len
+ # * to the largest of their lengths.
+ # */
+ # len = 0;
+ # for (i = 0, sqp = seqs; i < n; ++i, ++sqp) {
+ # PyObject *curseq;
+ # Py_ssize_t curlen;
+ #
+ # /* Get iterator. */
+ # curseq = PyTuple_GetItem(args, i+1);
+ # sqp->it = PyObject_GetIter(curseq);
+ # if (sqp->it == NULL) {
+ # static char errmsg[] =
+ # "argument %d to map() must support iteration";
+ # char errbuf[sizeof(errmsg) + 25];
+ # PyOS_snprintf(errbuf, sizeof(errbuf), errmsg, i+2);
+ # PyErr_SetString(PyExc_TypeError, errbuf);
+ # goto Fail_2;
+ # }
+ #
+ # /* Update len. */
+ # curlen = _PyObject_LengthHint(curseq, 8);
+ # if (curlen > len)
+ # len = curlen;
+ # }
+ #
+ # /* Get space for the result list. */
+ # if ((result = (PyObject *) PyList_New(len)) == NULL)
+ # goto Fail_2;
+ #
+ # /* Iterate over the sequences until all have stopped. */
+ # for (i = 0; ; ++i) {
+ # PyObject *alist, *item=NULL, *value;
+ # int numactive = 0;
+ #
+ # if (func == Py_None && n == 1)
+ # alist = NULL;
+ # else if ((alist = PyTuple_New(n)) == NULL)
+ # goto Fail_1;
+ #
+ # for (j = 0, sqp = seqs; j < n; ++j, ++sqp) {
+ # if (sqp->saw_StopIteration) {
+ # Py_INCREF(Py_None);
+ # item = Py_None;
+ # }
+ # else {
+ # item = PyIter_Next(sqp->it);
+ # if (item)
+ # ++numactive;
+ # else {
+ # if (PyErr_Occurred()) {
+ # Py_XDECREF(alist);
+ # goto Fail_1;
+ # }
+ # Py_INCREF(Py_None);
+ # item = Py_None;
+ # sqp->saw_StopIteration = 1;
+ # }
+ # }
+ # if (alist)
+ # PyTuple_SET_ITEM(alist, j, item);
+ # else
+ # break;
+ # }
+ #
+ # if (!alist)
+ # alist = item;
+ #
+ # if (numactive == 0) {
+ # Py_DECREF(alist);
+ # break;
+ # }
+ #
+ # if (func == Py_None)
+ # value = alist;
+ # else {
+ # value = PyEval_CallObject(func, alist);
+ # Py_DECREF(alist);
+ # if (value == NULL)
+ # goto Fail_1;
+ # }
+ # if (i >= len) {
+ # int status = PyList_Append(result, value);
+ # Py_DECREF(value);
+ # if (status < 0)
+ # goto Fail_1;
+ # }
+ # else if (PyList_SetItem(result, i, value) < 0)
+ # goto Fail_1;
+ # }
+ #
+ # if (i < len && PyList_SetSlice(result, i, len, NULL) < 0)
+ # goto Fail_1;
+ #
+ # goto Succeed;
+ #
+ # Fail_1:
+ # Py_DECREF(result);
+ # Fail_2:
+ # result = NULL;
+ # Succeed:
+ # assert(seqs);
+ # for (i = 0; i < n; ++i)
+ # Py_XDECREF(seqs[i].it);
+ # PyMem_DEL(seqs);
+ # return result;
+ # }
+
+ def oldrange(*args, **kwargs):
+ return list(builtins.range(*args, **kwargs))
+
+ def oldzip(*args, **kwargs):
+ return list(builtins.zip(*args, **kwargs))
+
+ filter = oldfilter
+ map = oldmap
+ range = oldrange
+ from functools import reduce
+ zip = oldzip
+ __all__ = ['filter', 'map', 'range', 'reduce', 'zip']
+
+else:
+ import __builtin__
+ # Python 2-builtin ranges produce lists
+ filter = __builtin__.filter
+ map = __builtin__.map
+ range = __builtin__.range
+ reduce = __builtin__.reduce
+ zip = __builtin__.zip
+ __all__ = []
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/tests/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/tests/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/translation/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/translation/__init__.py
new file mode 100644
index 0000000..7b21d9f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/translation/__init__.py
@@ -0,0 +1,498 @@
+# -*- coding: utf-8 -*-
+"""
+past.translation
+==================
+
+The ``past.translation`` package provides an import hook for Python 3 which
+transparently runs ``futurize`` fixers over Python 2 code on import to convert
+print statements into functions, etc.
+
+It is intended to assist users in migrating to Python 3.x even if some
+dependencies still only support Python 2.x.
+
+Usage
+-----
+
+Once your Py2 package is installed in the usual module search path, the import
+hook is invoked as follows:
+
+ >>> from past import autotranslate
+ >>> autotranslate('mypackagename')
+
+Or:
+
+ >>> autotranslate(['mypackage1', 'mypackage2'])
+
+You can unregister the hook using::
+
+ >>> from past.translation import remove_hooks
+ >>> remove_hooks()
+
+Author: Ed Schofield.
+Inspired by and based on ``uprefix`` by Vinay M. Sajip.
+"""
+
+import imp
+import logging
+import marshal
+import os
+import sys
+import copy
+from lib2to3.pgen2.parse import ParseError
+from lib2to3.refactor import RefactoringTool
+
+from libfuturize import fixes
+
+
+logger = logging.getLogger(__name__)
+logger.setLevel(logging.DEBUG)
+
+myfixes = (list(fixes.libfuturize_fix_names_stage1) +
+ list(fixes.lib2to3_fix_names_stage1) +
+ list(fixes.libfuturize_fix_names_stage2) +
+ list(fixes.lib2to3_fix_names_stage2))
+
+
+# We detect whether the code is Py2 or Py3 by applying certain lib2to3 fixers
+# to it. If the diff is empty, it's Python 3 code.
+
+py2_detect_fixers = [
+# From stage 1:
+ 'lib2to3.fixes.fix_apply',
+ # 'lib2to3.fixes.fix_dict', # TODO: add support for utils.viewitems() etc. and move to stage2
+ 'lib2to3.fixes.fix_except',
+ 'lib2to3.fixes.fix_execfile',
+ 'lib2to3.fixes.fix_exitfunc',
+ 'lib2to3.fixes.fix_funcattrs',
+ 'lib2to3.fixes.fix_filter',
+ 'lib2to3.fixes.fix_has_key',
+ 'lib2to3.fixes.fix_idioms',
+ 'lib2to3.fixes.fix_import', # makes any implicit relative imports explicit. (Use with ``from __future__ import absolute_import)
+ 'lib2to3.fixes.fix_intern',
+ 'lib2to3.fixes.fix_isinstance',
+ 'lib2to3.fixes.fix_methodattrs',
+ 'lib2to3.fixes.fix_ne',
+ 'lib2to3.fixes.fix_numliterals', # turns 1L into 1, 0755 into 0o755
+ 'lib2to3.fixes.fix_paren',
+ 'lib2to3.fixes.fix_print',
+ 'lib2to3.fixes.fix_raise', # uses incompatible with_traceback() method on exceptions
+ 'lib2to3.fixes.fix_renames',
+ 'lib2to3.fixes.fix_reduce',
+ # 'lib2to3.fixes.fix_set_literal', # this is unnecessary and breaks Py2.6 support
+ 'lib2to3.fixes.fix_repr',
+ 'lib2to3.fixes.fix_standarderror',
+ 'lib2to3.fixes.fix_sys_exc',
+ 'lib2to3.fixes.fix_throw',
+ 'lib2to3.fixes.fix_tuple_params',
+ 'lib2to3.fixes.fix_types',
+ 'lib2to3.fixes.fix_ws_comma',
+ 'lib2to3.fixes.fix_xreadlines',
+
+# From stage 2:
+ 'lib2to3.fixes.fix_basestring',
+ # 'lib2to3.fixes.fix_buffer', # perhaps not safe. Test this.
+ # 'lib2to3.fixes.fix_callable', # not needed in Py3.2+
+ # 'lib2to3.fixes.fix_dict', # TODO: add support for utils.viewitems() etc.
+ 'lib2to3.fixes.fix_exec',
+ # 'lib2to3.fixes.fix_future', # we don't want to remove __future__ imports
+ 'lib2to3.fixes.fix_getcwdu',
+ # 'lib2to3.fixes.fix_imports', # called by libfuturize.fixes.fix_future_standard_library
+ # 'lib2to3.fixes.fix_imports2', # we don't handle this yet (dbm)
+ # 'lib2to3.fixes.fix_input',
+ # 'lib2to3.fixes.fix_itertools',
+ # 'lib2to3.fixes.fix_itertools_imports',
+ 'lib2to3.fixes.fix_long',
+ # 'lib2to3.fixes.fix_map',
+ # 'lib2to3.fixes.fix_metaclass', # causes SyntaxError in Py2! Use the one from ``six`` instead
+ 'lib2to3.fixes.fix_next',
+ 'lib2to3.fixes.fix_nonzero', # TODO: add a decorator for mapping __bool__ to __nonzero__
+ # 'lib2to3.fixes.fix_operator', # we will need support for this by e.g. extending the Py2 operator module to provide those functions in Py3
+ 'lib2to3.fixes.fix_raw_input',
+ # 'lib2to3.fixes.fix_unicode', # strips off the u'' prefix, which removes a potentially helpful source of information for disambiguating unicode/byte strings
+ # 'lib2to3.fixes.fix_urllib',
+ 'lib2to3.fixes.fix_xrange',
+ # 'lib2to3.fixes.fix_zip',
+]
+
+
+class RTs:
+ """
+ A namespace for the refactoring tools. This avoids creating these at
+ the module level, which slows down the module import. (See issue #117).
+
+ There are two possible grammars: with or without the print statement.
+ Hence we have two possible refactoring tool implementations.
+ """
+ _rt = None
+ _rtp = None
+ _rt_py2_detect = None
+ _rtp_py2_detect = None
+
+ @staticmethod
+ def setup():
+ """
+ Call this before using the refactoring tools to create them on demand
+ if needed.
+ """
+ if None in [RTs._rt, RTs._rtp]:
+ RTs._rt = RefactoringTool(myfixes)
+ RTs._rtp = RefactoringTool(myfixes, {'print_function': True})
+
+
+ @staticmethod
+ def setup_detect_python2():
+ """
+ Call this before using the refactoring tools to create them on demand
+ if needed.
+ """
+ if None in [RTs._rt_py2_detect, RTs._rtp_py2_detect]:
+ RTs._rt_py2_detect = RefactoringTool(py2_detect_fixers)
+ RTs._rtp_py2_detect = RefactoringTool(py2_detect_fixers,
+ {'print_function': True})
+
+
+# We need to find a prefix for the standard library, as we don't want to
+# process any files there (they will already be Python 3).
+#
+# The following method is used by Sanjay Vinip in uprefix. This fails for
+# ``conda`` environments:
+# # In a non-pythonv virtualenv, sys.real_prefix points to the installed Python.
+# # In a pythonv venv, sys.base_prefix points to the installed Python.
+# # Outside a virtual environment, sys.prefix points to the installed Python.
+
+# if hasattr(sys, 'real_prefix'):
+# _syslibprefix = sys.real_prefix
+# else:
+# _syslibprefix = getattr(sys, 'base_prefix', sys.prefix)
+
+# Instead, we use the portion of the path common to both the stdlib modules
+# ``math`` and ``urllib``.
+
+def splitall(path):
+ """
+ Split a path into all components. From Python Cookbook.
+ """
+ allparts = []
+ while True:
+ parts = os.path.split(path)
+ if parts[0] == path: # sentinel for absolute paths
+ allparts.insert(0, parts[0])
+ break
+ elif parts[1] == path: # sentinel for relative paths
+ allparts.insert(0, parts[1])
+ break
+ else:
+ path = parts[0]
+ allparts.insert(0, parts[1])
+ return allparts
+
+
+def common_substring(s1, s2):
+ """
+ Returns the longest common substring to the two strings, starting from the
+ left.
+ """
+ chunks = []
+ path1 = splitall(s1)
+ path2 = splitall(s2)
+ for (dir1, dir2) in zip(path1, path2):
+ if dir1 != dir2:
+ break
+ chunks.append(dir1)
+ return os.path.join(*chunks)
+
+# _stdlibprefix = common_substring(math.__file__, urllib.__file__)
+
+
+def detect_python2(source, pathname):
+ """
+ Returns a bool indicating whether we think the code is Py2
+ """
+ RTs.setup_detect_python2()
+ try:
+ tree = RTs._rt_py2_detect.refactor_string(source, pathname)
+ except ParseError as e:
+ if e.msg != 'bad input' or e.value != '=':
+ raise
+ tree = RTs._rtp.refactor_string(source, pathname)
+
+ if source != str(tree)[:-1]: # remove added newline
+ # The above fixers made changes, so we conclude it's Python 2 code
+ logger.debug('Detected Python 2 code: {0}'.format(pathname))
+ with open('/tmp/original_code.py', 'w') as f:
+ f.write('### Original code (detected as py2): %s\n%s' %
+ (pathname, source))
+ with open('/tmp/py2_detection_code.py', 'w') as f:
+ f.write('### Code after running py3 detection (from %s)\n%s' %
+ (pathname, str(tree)[:-1]))
+ return True
+ else:
+ logger.debug('Detected Python 3 code: {0}'.format(pathname))
+ with open('/tmp/original_code.py', 'w') as f:
+ f.write('### Original code (detected as py3): %s\n%s' %
+ (pathname, source))
+ try:
+ os.remove('/tmp/futurize_code.py')
+ except OSError:
+ pass
+ return False
+
+
+class Py2Fixer(object):
+ """
+ An import hook class that uses lib2to3 for source-to-source translation of
+ Py2 code to Py3.
+ """
+
+ # See the comments on :class:future.standard_library.RenameImport.
+ # We add this attribute here so remove_hooks() and install_hooks() can
+ # unambiguously detect whether the import hook is installed:
+ PY2FIXER = True
+
+ def __init__(self):
+ self.found = None
+ self.base_exclude_paths = ['future', 'past']
+ self.exclude_paths = copy.copy(self.base_exclude_paths)
+ self.include_paths = []
+
+ def include(self, paths):
+ """
+ Pass in a sequence of module names such as 'plotrique.plotting' that,
+ if present at the leftmost side of the full package name, would
+ specify the module to be transformed from Py2 to Py3.
+ """
+ self.include_paths += paths
+
+ def exclude(self, paths):
+ """
+ Pass in a sequence of strings such as 'mymodule' that, if
+ present at the leftmost side of the full package name, would cause
+ the module not to undergo any source transformation.
+ """
+ self.exclude_paths += paths
+
+ def find_module(self, fullname, path=None):
+ logger.debug('Running find_module: {0}...'.format(fullname))
+ if '.' in fullname:
+ parent, child = fullname.rsplit('.', 1)
+ if path is None:
+ loader = self.find_module(parent, path)
+ mod = loader.load_module(parent)
+ path = mod.__path__
+ fullname = child
+
+ # Perhaps we should try using the new importlib functionality in Python
+ # 3.3: something like this?
+ # thing = importlib.machinery.PathFinder.find_module(fullname, path)
+ try:
+ self.found = imp.find_module(fullname, path)
+ except Exception as e:
+ logger.debug('Py2Fixer could not find {0}')
+ logger.debug('Exception was: {0})'.format(fullname, e))
+ return None
+ self.kind = self.found[-1][-1]
+ if self.kind == imp.PKG_DIRECTORY:
+ self.pathname = os.path.join(self.found[1], '__init__.py')
+ elif self.kind == imp.PY_SOURCE:
+ self.pathname = self.found[1]
+ return self
+
+ def transform(self, source):
+ # This implementation uses lib2to3,
+ # you can override and use something else
+ # if that's better for you
+
+ # lib2to3 likes a newline at the end
+ RTs.setup()
+ source += '\n'
+ try:
+ tree = RTs._rt.refactor_string(source, self.pathname)
+ except ParseError as e:
+ if e.msg != 'bad input' or e.value != '=':
+ raise
+ tree = RTs._rtp.refactor_string(source, self.pathname)
+ # could optimise a bit for only doing str(tree) if
+ # getattr(tree, 'was_changed', False) returns True
+ return str(tree)[:-1] # remove added newline
+
+ def load_module(self, fullname):
+ logger.debug('Running load_module for {0}...'.format(fullname))
+ if fullname in sys.modules:
+ mod = sys.modules[fullname]
+ else:
+ if self.kind in (imp.PY_COMPILED, imp.C_EXTENSION, imp.C_BUILTIN,
+ imp.PY_FROZEN):
+ convert = False
+ # elif (self.pathname.startswith(_stdlibprefix)
+ # and 'site-packages' not in self.pathname):
+ # # We assume it's a stdlib package in this case. Is this too brittle?
+ # # Please file a bug report at https://github.com/PythonCharmers/python-future
+ # # if so.
+ # convert = False
+ # in theory, other paths could be configured to be excluded here too
+ elif any([fullname.startswith(path) for path in self.exclude_paths]):
+ convert = False
+ elif any([fullname.startswith(path) for path in self.include_paths]):
+ convert = True
+ else:
+ convert = False
+ if not convert:
+ logger.debug('Excluded {0} from translation'.format(fullname))
+ mod = imp.load_module(fullname, *self.found)
+ else:
+ logger.debug('Autoconverting {0} ...'.format(fullname))
+ mod = imp.new_module(fullname)
+ sys.modules[fullname] = mod
+
+ # required by PEP 302
+ mod.__file__ = self.pathname
+ mod.__name__ = fullname
+ mod.__loader__ = self
+
+ # This:
+ # mod.__package__ = '.'.join(fullname.split('.')[:-1])
+ # seems to result in "SystemError: Parent module '' not loaded,
+ # cannot perform relative import" for a package's __init__.py
+ # file. We use the approach below. Another option to try is the
+ # minimal load_module pattern from the PEP 302 text instead.
+
+ # Is the test in the next line more or less robust than the
+ # following one? Presumably less ...
+ # ispkg = self.pathname.endswith('__init__.py')
+
+ if self.kind == imp.PKG_DIRECTORY:
+ mod.__path__ = [ os.path.dirname(self.pathname) ]
+ mod.__package__ = fullname
+ else:
+ #else, regular module
+ mod.__path__ = []
+ mod.__package__ = fullname.rpartition('.')[0]
+
+ try:
+ cachename = imp.cache_from_source(self.pathname)
+ if not os.path.exists(cachename):
+ update_cache = True
+ else:
+ sourcetime = os.stat(self.pathname).st_mtime
+ cachetime = os.stat(cachename).st_mtime
+ update_cache = cachetime < sourcetime
+ # # Force update_cache to work around a problem with it being treated as Py3 code???
+ # update_cache = True
+ if not update_cache:
+ with open(cachename, 'rb') as f:
+ data = f.read()
+ try:
+ code = marshal.loads(data)
+ except Exception:
+ # pyc could be corrupt. Regenerate it
+ update_cache = True
+ if update_cache:
+ if self.found[0]:
+ source = self.found[0].read()
+ elif self.kind == imp.PKG_DIRECTORY:
+ with open(self.pathname) as f:
+ source = f.read()
+
+ if detect_python2(source, self.pathname):
+ source = self.transform(source)
+ with open('/tmp/futurized_code.py', 'w') as f:
+ f.write('### Futurized code (from %s)\n%s' %
+ (self.pathname, source))
+
+ code = compile(source, self.pathname, 'exec')
+
+ dirname = os.path.dirname(cachename)
+ if not os.path.exists(dirname):
+ os.makedirs(dirname)
+ try:
+ with open(cachename, 'wb') as f:
+ data = marshal.dumps(code)
+ f.write(data)
+ except Exception: # could be write-protected
+ pass
+ exec(code, mod.__dict__)
+ except Exception as e:
+ # must remove module from sys.modules
+ del sys.modules[fullname]
+ raise # keep it simple
+
+ if self.found[0]:
+ self.found[0].close()
+ return mod
+
+_hook = Py2Fixer()
+
+
+def install_hooks(include_paths=(), exclude_paths=()):
+ if isinstance(include_paths, str):
+ include_paths = (include_paths,)
+ if isinstance(exclude_paths, str):
+ exclude_paths = (exclude_paths,)
+ assert len(include_paths) + len(exclude_paths) > 0, 'Pass at least one argument'
+ _hook.include(include_paths)
+ _hook.exclude(exclude_paths)
+ # _hook.debug = debug
+ enable = sys.version_info[0] >= 3 # enabled for all 3.x
+ if enable and _hook not in sys.meta_path:
+ sys.meta_path.insert(0, _hook) # insert at beginning. This could be made a parameter
+
+ # We could return the hook when there are ways of configuring it
+ #return _hook
+
+
+def remove_hooks():
+ if _hook in sys.meta_path:
+ sys.meta_path.remove(_hook)
+
+
+def detect_hooks():
+ """
+ Returns True if the import hooks are installed, False if not.
+ """
+ return _hook in sys.meta_path
+ # present = any([hasattr(hook, 'PY2FIXER') for hook in sys.meta_path])
+ # return present
+
+
+class hooks(object):
+ """
+ Acts as a context manager. Use like this:
+
+ >>> from past import translation
+ >>> with translation.hooks():
+ ... import mypy2module
+ >>> import requests # py2/3 compatible anyway
+ >>> # etc.
+ """
+ def __enter__(self):
+ self.hooks_were_installed = detect_hooks()
+ install_hooks()
+ return self
+
+ def __exit__(self, *args):
+ if not self.hooks_were_installed:
+ remove_hooks()
+
+
+class suspend_hooks(object):
+ """
+ Acts as a context manager. Use like this:
+
+ >>> from past import translation
+ >>> translation.install_hooks()
+ >>> import http.client
+ >>> # ...
+ >>> with translation.suspend_hooks():
+ >>> import requests # or others that support Py2/3
+
+ If the hooks were disabled before the context, they are not installed when
+ the context is left.
+ """
+ def __enter__(self):
+ self.hooks_were_installed = detect_hooks()
+ remove_hooks()
+ return self
+ def __exit__(self, *args):
+ if self.hooks_were_installed:
+ install_hooks()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/types/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/types/__init__.py
new file mode 100644
index 0000000..a31b264
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/types/__init__.py
@@ -0,0 +1,30 @@
+"""
+Forward-ports of types from Python 2 for use with Python 3:
+
+- ``basestring``: equivalent to ``(str, bytes)`` in ``isinstance`` checks
+- ``dict``: with list-producing .keys() etc. methods
+- ``str``: bytes-like, but iterating over them doesn't product integers
+- ``long``: alias of Py3 int with ``L`` suffix in the ``repr``
+- ``unicode``: alias of Py3 str with ``u`` prefix in the ``repr``
+
+"""
+
+from past import utils
+
+if utils.PY2:
+ import __builtin__
+ basestring = __builtin__.basestring
+ dict = __builtin__.dict
+ str = __builtin__.str
+ long = __builtin__.long
+ unicode = __builtin__.unicode
+ __all__ = []
+else:
+ from .basestring import basestring
+ from .olddict import olddict
+ from .oldstr import oldstr
+ long = int
+ unicode = str
+ # from .unicode import unicode
+ __all__ = ['basestring', 'olddict', 'oldstr', 'long', 'unicode']
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/types/basestring.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/types/basestring.py
new file mode 100644
index 0000000..15437bf
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/types/basestring.py
@@ -0,0 +1,40 @@
+"""
+An implementation of the basestring type for Python 3
+
+Example use:
+
+>>> s = b'abc'
+>>> assert isinstance(s, basestring)
+>>> from past.types import str as oldstr
+>>> s2 = oldstr(b'abc')
+>>> assert isinstance(s2, basestring)
+
+"""
+
+import sys
+
+from past.utils import with_metaclass, PY2
+
+if PY2:
+ str = unicode
+
+ver = sys.version_info[:2]
+
+
+class BaseBaseString(type):
+ def __instancecheck__(cls, instance):
+ return isinstance(instance, (bytes, str))
+
+ def __subclasshook__(cls, thing):
+ # TODO: What should go here?
+ raise NotImplemented
+
+
+class basestring(with_metaclass(BaseBaseString)):
+ """
+ A minimal backport of the Python 2 basestring type to Py3
+ """
+
+
+__all__ = ['basestring']
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/types/olddict.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/types/olddict.py
new file mode 100644
index 0000000..b213e28
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/types/olddict.py
@@ -0,0 +1,97 @@
+"""
+A dict subclass for Python 3 that behaves like Python 2's dict
+
+Example use:
+
+>>> from past.builtins import dict
+>>> d1 = dict() # instead of {} for an empty dict
+>>> d2 = dict(key1='value1', key2='value2')
+
+The keys, values and items methods now return lists on Python 3.x and there are
+methods for iterkeys, itervalues, iteritems, and viewkeys etc.
+
+>>> for d in (d1, d2):
+... assert isinstance(d.keys(), list)
+... assert isinstance(d.values(), list)
+... assert isinstance(d.items(), list)
+"""
+
+import sys
+
+from past.utils import with_metaclass
+
+
+_builtin_dict = dict
+ver = sys.version_info[:2]
+
+
+class BaseOldDict(type):
+ def __instancecheck__(cls, instance):
+ return isinstance(instance, _builtin_dict)
+
+
+class olddict(with_metaclass(BaseOldDict, _builtin_dict)):
+ """
+ A backport of the Python 3 dict object to Py2
+ """
+ iterkeys = _builtin_dict.keys
+ viewkeys = _builtin_dict.keys
+
+ def keys(self):
+ return list(super(olddict, self).keys())
+
+ itervalues = _builtin_dict.values
+ viewvalues = _builtin_dict.values
+
+ def values(self):
+ return list(super(olddict, self).values())
+
+ iteritems = _builtin_dict.items
+ viewitems = _builtin_dict.items
+
+ def items(self):
+ return list(super(olddict, self).items())
+
+ def has_key(self, k):
+ """
+ D.has_key(k) -> True if D has a key k, else False
+ """
+ return k in self
+
+ # def __new__(cls, *args, **kwargs):
+ # """
+ # dict() -> new empty dictionary
+ # dict(mapping) -> new dictionary initialized from a mapping object's
+ # (key, value) pairs
+ # dict(iterable) -> new dictionary initialized as if via:
+ # d = {}
+ # for k, v in iterable:
+ # d[k] = v
+ # dict(**kwargs) -> new dictionary initialized with the name=value pairs
+ # in the keyword argument list. For example: dict(one=1, two=2)
+
+ # """
+ #
+ # if len(args) == 0:
+ # return super(olddict, cls).__new__(cls)
+ # # Was: elif isinstance(args[0], newbytes):
+ # # We use type() instead of the above because we're redefining
+ # # this to be True for all unicode string subclasses. Warning:
+ # # This may render newstr un-subclassable.
+ # elif type(args[0]) == olddict:
+ # return args[0]
+ # # elif isinstance(args[0], _builtin_dict):
+ # # value = args[0]
+ # else:
+ # value = args[0]
+ # return super(olddict, cls).__new__(cls, value)
+
+ def __native__(self):
+ """
+ Hook for the past.utils.native() function
+ """
+ return super(oldbytes, self)
+
+
+__all__ = ['olddict']
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/types/oldstr.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/types/oldstr.py
new file mode 100644
index 0000000..1b90e3e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/types/oldstr.py
@@ -0,0 +1,132 @@
+"""
+Pure-Python implementation of a Python 2-like str object for Python 3.
+"""
+
+from collections import Iterable
+from numbers import Integral
+
+from past.utils import PY2, with_metaclass
+
+
+_builtin_bytes = bytes
+
+
+class BaseOldStr(type):
+ def __instancecheck__(cls, instance):
+ return isinstance(instance, _builtin_bytes)
+
+
+def unescape(s):
+ """
+ Interprets strings with escape sequences
+
+ Example:
+ >>> s = unescape(r'abc\\def') # i.e. 'abc\\\\def'
+ >>> print(s)
+ 'abc\def'
+ >>> s2 = unescape('abc\\ndef')
+ >>> len(s2)
+ 8
+ >>> print(s2)
+ abc
+ def
+ """
+ return s.encode().decode('unicode_escape')
+
+
+class oldstr(with_metaclass(BaseOldStr, _builtin_bytes)):
+ """
+ A forward port of the Python 2 8-bit string object to Py3
+ """
+ # Python 2 strings have no __iter__ method:
+ @property
+ def __iter__(self):
+ raise AttributeError
+
+ def __dir__(self):
+ return [thing for thing in dir(_builtin_bytes) if thing != '__iter__']
+
+ # def __new__(cls, *args, **kwargs):
+ # """
+ # From the Py3 bytes docstring:
+
+ # bytes(iterable_of_ints) -> bytes
+ # bytes(string, encoding[, errors]) -> bytes
+ # bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer
+ # bytes(int) -> bytes object of size given by the parameter initialized with null bytes
+ # bytes() -> empty bytes object
+ #
+ # Construct an immutable array of bytes from:
+ # - an iterable yielding integers in range(256)
+ # - a text string encoded using the specified encoding
+ # - any object implementing the buffer API.
+ # - an integer
+ # """
+ #
+ # if len(args) == 0:
+ # return super(newbytes, cls).__new__(cls)
+ # # Was: elif isinstance(args[0], newbytes):
+ # # We use type() instead of the above because we're redefining
+ # # this to be True for all unicode string subclasses. Warning:
+ # # This may render newstr un-subclassable.
+ # elif type(args[0]) == newbytes:
+ # return args[0]
+ # elif isinstance(args[0], _builtin_bytes):
+ # value = args[0]
+ # elif isinstance(args[0], unicode):
+ # if 'encoding' not in kwargs:
+ # raise TypeError('unicode string argument without an encoding')
+ # ###
+ # # Was: value = args[0].encode(**kwargs)
+ # # Python 2.6 string encode() method doesn't take kwargs:
+ # # Use this instead:
+ # newargs = [kwargs['encoding']]
+ # if 'errors' in kwargs:
+ # newargs.append(kwargs['errors'])
+ # value = args[0].encode(*newargs)
+ # ###
+ # elif isinstance(args[0], Iterable):
+ # if len(args[0]) == 0:
+ # # What is this?
+ # raise ValueError('unknown argument type')
+ # elif len(args[0]) > 0 and isinstance(args[0][0], Integral):
+ # # It's a list of integers
+ # value = b''.join([chr(x) for x in args[0]])
+ # else:
+ # raise ValueError('item cannot be interpreted as an integer')
+ # elif isinstance(args[0], Integral):
+ # if args[0] < 0:
+ # raise ValueError('negative count')
+ # value = b'\x00' * args[0]
+ # else:
+ # value = args[0]
+ # return super(newbytes, cls).__new__(cls, value)
+
+ def __repr__(self):
+ s = super(oldstr, self).__repr__() # e.g. b'abc' on Py3, b'abc' on Py3
+ return s[1:]
+
+ def __str__(self):
+ s = super(oldstr, self).__str__() # e.g. "b'abc'" or "b'abc\\ndef'
+ # TODO: fix this:
+ assert s[:2] == "b'" and s[-1] == "'"
+ return unescape(s[2:-1]) # e.g. 'abc' or 'abc\ndef'
+
+ def __getitem__(self, y):
+ if isinstance(y, Integral):
+ return super(oldstr, self).__getitem__(slice(y, y+1))
+ else:
+ return super(oldstr, self).__getitem__(y)
+
+ def __getslice__(self, *args):
+ return self.__getitem__(slice(*args))
+
+ def __contains__(self, key):
+ if isinstance(key, int):
+ return False
+
+ def __native__(self):
+ return bytes(self)
+
+
+__all__ = ['oldstr']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/utils/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/utils/__init__.py
new file mode 100644
index 0000000..02f06d5
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/future/py2_3/past/utils/__init__.py
@@ -0,0 +1,97 @@
+"""
+Various non-built-in utility functions and definitions for Py2
+compatibility in Py3.
+
+For example:
+
+ >>> # The old_div() function behaves like Python 2's / operator
+ >>> # without "from __future__ import division"
+ >>> from past.utils import old_div
+ >>> old_div(3, 2) # like 3/2 in Py2
+ 0
+ >>> old_div(3, 2.0) # like 3/2.0 in Py2
+ 1.5
+"""
+
+import sys
+import numbers
+
+PY3 = sys.version_info[0] == 3
+PY2 = sys.version_info[0] == 2
+PYPY = hasattr(sys, 'pypy_translation_info')
+
+
+def with_metaclass(meta, *bases):
+ """
+ Function from jinja2/_compat.py. License: BSD.
+
+ Use it like this::
+
+ class BaseForm(object):
+ pass
+
+ class FormType(type):
+ pass
+
+ class Form(with_metaclass(FormType, BaseForm)):
+ pass
+
+ This requires a bit of explanation: the basic idea is to make a
+ dummy metaclass for one level of class instantiation that replaces
+ itself with the actual metaclass. Because of internal type checks
+ we also need to make sure that we downgrade the custom metaclass
+ for one level to something closer to type (that's why __call__ and
+ __init__ comes back from type etc.).
+
+ This has the advantage over six.with_metaclass of not introducing
+ dummy classes into the final MRO.
+ """
+ class metaclass(meta):
+ __call__ = type.__call__
+ __init__ = type.__init__
+ def __new__(cls, name, this_bases, d):
+ if this_bases is None:
+ return type.__new__(cls, name, (), d)
+ return meta(name, bases, d)
+ return metaclass('temporary_class', None, {})
+
+
+def native(obj):
+ """
+ On Py2, this is a no-op: native(obj) -> obj
+
+ On Py3, returns the corresponding native Py3 types that are
+ superclasses for forward-ported objects from Py2:
+
+ >>> from past.builtins import str, dict
+
+ >>> native(str(b'ABC')) # Output on Py3 follows. On Py2, output is 'ABC'
+ b'ABC'
+ >>> type(native(str(b'ABC')))
+ bytes
+
+ Existing native types on Py3 will be returned unchanged:
+
+ >>> type(native(b'ABC'))
+ bytes
+ """
+ if hasattr(obj, '__native__'):
+ return obj.__native__()
+ else:
+ return obj
+
+
+# An alias for future.utils.old_div():
+def old_div(a, b):
+ """
+ Equivalent to ``a / b`` on Python 2 without ``from __future__ import
+ division``.
+
+ TODO: generalize this to other objects (like arrays etc.)
+ """
+ if isinstance(a, numbers.Integral) and isinstance(b, numbers.Integral):
+ return a // b
+ else:
+ return a / b
+
+__all__ = ['PY3', 'PY2', 'PYPY', 'with_metaclass', 'native', 'old_div']
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/mock.py b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/mock.py
new file mode 100644
index 0000000..c8fc5d1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/extlibs/mock.py
@@ -0,0 +1,2367 @@
+# mock.py
+# Test tools for mocking and patching.
+# Copyright (C) 2007-2012 Michael Foord & the mock team
+# E-mail: fuzzyman AT voidspace DOT org DOT uk
+
+# mock 1.0
+# http://www.voidspace.org.uk/python/mock/
+
+# Released subject to the BSD License
+# Please see http://www.voidspace.org.uk/python/license.shtml
+
+# Scripts maintained at http://www.voidspace.org.uk/python/index.shtml
+# Comments, suggestions and bug reports welcome.
+
+
+__all__ = (
+ 'Mock',
+ 'MagicMock',
+ 'patch',
+ 'sentinel',
+ 'DEFAULT',
+ 'ANY',
+ 'call',
+ 'create_autospec',
+ 'FILTER_DIR',
+ 'NonCallableMock',
+ 'NonCallableMagicMock',
+ 'mock_open',
+ 'PropertyMock',
+)
+
+
+__version__ = '1.0.1'
+
+
+import pprint
+import sys
+
+try:
+ import inspect
+except ImportError:
+ # for alternative platforms that
+ # may not have inspect
+ inspect = None
+
+try:
+ from functools import wraps as original_wraps
+except ImportError:
+ # Python 2.4 compatibility
+ def wraps(original):
+ def inner(f):
+ f.__name__ = original.__name__
+ f.__doc__ = original.__doc__
+ f.__module__ = original.__module__
+ f.__wrapped__ = original
+ return f
+ return inner
+else:
+ if sys.version_info[:2] >= (3, 3):
+ wraps = original_wraps
+ else:
+ def wraps(func):
+ def inner(f):
+ f = original_wraps(func)(f)
+ f.__wrapped__ = func
+ return f
+ return inner
+
+try:
+ unicode
+except NameError:
+ # Python 3
+ basestring = unicode = str
+
+try:
+ long
+except NameError:
+ # Python 3
+ long = int
+
+try:
+ BaseException
+except NameError:
+ # Python 2.4 compatibility
+ BaseException = Exception
+
+try:
+ next
+except NameError:
+ def next(obj):
+ return obj.next()
+
+
+BaseExceptions = (BaseException,)
+if 'java' in sys.platform:
+ # jython
+ import java
+ BaseExceptions = (BaseException, java.lang.Throwable)
+
+try:
+ _isidentifier = str.isidentifier
+except AttributeError:
+ # Python 2.X
+ import keyword
+ import re
+ regex = re.compile(r'^[a-z_][a-z0-9_]*$', re.I)
+ def _isidentifier(string):
+ if string in keyword.kwlist:
+ return False
+ return regex.match(string)
+
+
+inPy3k = sys.version_info[0] == 3
+
+# Needed to work around Python 3 bug where use of "super" interferes with
+# defining __class__ as a descriptor
+_super = super
+
+self = 'im_self'
+builtin = '__builtin__'
+if inPy3k:
+ self = '__self__'
+ builtin = 'builtins'
+
+FILTER_DIR = True
+
+
+def _is_instance_mock(obj):
+ # can't use isinstance on Mock objects because they override __class__
+ # The base class for all mocks is NonCallableMock
+ return issubclass(type(obj), NonCallableMock)
+
+
+def _is_exception(obj):
+ return (
+ isinstance(obj, BaseExceptions) or
+ isinstance(obj, ClassTypes) and issubclass(obj, BaseExceptions)
+ )
+
+
+class _slotted(object):
+ __slots__ = ['a']
+
+
+DescriptorTypes = (
+ type(_slotted.a),
+ property,
+)
+
+
+def _getsignature(func, skipfirst, instance=False):
+ if inspect is None:
+ raise ImportError('inspect module not available')
+
+ if isinstance(func, ClassTypes) and not instance:
+ try:
+ func = func.__init__
+ except AttributeError:
+ return
+ skipfirst = True
+ elif not isinstance(func, FunctionTypes):
+ # for classes where instance is True we end up here too
+ try:
+ func = func.__call__
+ except AttributeError:
+ return
+
+ if inPy3k:
+ try:
+ argspec = inspect.getfullargspec(func)
+ except TypeError:
+ # C function / method, possibly inherited object().__init__
+ return
+ regargs, varargs, varkw, defaults, kwonly, kwonlydef, ann = argspec
+ else:
+ try:
+ regargs, varargs, varkwargs, defaults = inspect.getargspec(func)
+ except TypeError:
+ # C function / method, possibly inherited object().__init__
+ return
+
+ # instance methods and classmethods need to lose the self argument
+ if getattr(func, self, None) is not None:
+ regargs = regargs[1:]
+ if skipfirst:
+ # this condition and the above one are never both True - why?
+ regargs = regargs[1:]
+
+ if inPy3k:
+ signature = inspect.formatargspec(
+ regargs, varargs, varkw, defaults,
+ kwonly, kwonlydef, ann, formatvalue=lambda value: "")
+ else:
+ signature = inspect.formatargspec(
+ regargs, varargs, varkwargs, defaults,
+ formatvalue=lambda value: "")
+ return signature[1:-1], func
+
+
+def _check_signature(func, mock, skipfirst, instance=False):
+ if not _callable(func):
+ return
+
+ result = _getsignature(func, skipfirst, instance)
+ if result is None:
+ return
+ signature, func = result
+
+ # can't use self because "self" is common as an argument name
+ # unfortunately even not in the first place
+ src = "lambda _mock_self, %s: None" % signature
+ checksig = eval(src, {})
+ _copy_func_details(func, checksig)
+ type(mock)._mock_check_sig = checksig
+
+
+def _copy_func_details(func, funcopy):
+ funcopy.__name__ = func.__name__
+ funcopy.__doc__ = func.__doc__
+ #funcopy.__dict__.update(func.__dict__)
+ funcopy.__module__ = func.__module__
+ if not inPy3k:
+ funcopy.func_defaults = func.func_defaults
+ return
+ funcopy.__defaults__ = func.__defaults__
+ funcopy.__kwdefaults__ = func.__kwdefaults__
+
+
+def _callable(obj):
+ if isinstance(obj, ClassTypes):
+ return True
+ if getattr(obj, '__call__', None) is not None:
+ return True
+ return False
+
+
+def _is_list(obj):
+ # checks for list or tuples
+ # XXXX badly named!
+ return type(obj) in (list, tuple)
+
+
+def _instance_callable(obj):
+ """Given an object, return True if the object is callable.
+ For classes, return True if instances would be callable."""
+ if not isinstance(obj, ClassTypes):
+ # already an instance
+ return getattr(obj, '__call__', None) is not None
+
+ klass = obj
+ # uses __bases__ instead of __mro__ so that we work with old style classes
+ if klass.__dict__.get('__call__') is not None:
+ return True
+
+ for base in klass.__bases__:
+ if _instance_callable(base):
+ return True
+ return False
+
+
+def _set_signature(mock, original, instance=False):
+ # creates a function with signature (*args, **kwargs) that delegates to a
+ # mock. It still does signature checking by calling a lambda with the same
+ # signature as the original.
+ if not _callable(original):
+ return
+
+ skipfirst = isinstance(original, ClassTypes)
+ result = _getsignature(original, skipfirst, instance)
+ if result is None:
+ # was a C function (e.g. object().__init__ ) that can't be mocked
+ return
+
+ signature, func = result
+
+ src = "lambda %s: None" % signature
+ checksig = eval(src, {})
+ _copy_func_details(func, checksig)
+
+ name = original.__name__
+ if not _isidentifier(name):
+ name = 'funcopy'
+ context = {'_checksig_': checksig, 'mock': mock}
+ src = """def %s(*args, **kwargs):
+ _checksig_(*args, **kwargs)
+ return mock(*args, **kwargs)""" % name
+ exec (src, context)
+ funcopy = context[name]
+ _setup_func(funcopy, mock)
+ return funcopy
+
+
+def _setup_func(funcopy, mock):
+ funcopy.mock = mock
+
+ # can't use isinstance with mocks
+ if not _is_instance_mock(mock):
+ return
+
+ def assert_called_with(*args, **kwargs):
+ return mock.assert_called_with(*args, **kwargs)
+ def assert_called_once_with(*args, **kwargs):
+ return mock.assert_called_once_with(*args, **kwargs)
+ def assert_has_calls(*args, **kwargs):
+ return mock.assert_has_calls(*args, **kwargs)
+ def assert_any_call(*args, **kwargs):
+ return mock.assert_any_call(*args, **kwargs)
+ def reset_mock():
+ funcopy.method_calls = _CallList()
+ funcopy.mock_calls = _CallList()
+ mock.reset_mock()
+ ret = funcopy.return_value
+ if _is_instance_mock(ret) and not ret is mock:
+ ret.reset_mock()
+
+ funcopy.called = False
+ funcopy.call_count = 0
+ funcopy.call_args = None
+ funcopy.call_args_list = _CallList()
+ funcopy.method_calls = _CallList()
+ funcopy.mock_calls = _CallList()
+
+ funcopy.return_value = mock.return_value
+ funcopy.side_effect = mock.side_effect
+ funcopy._mock_children = mock._mock_children
+
+ funcopy.assert_called_with = assert_called_with
+ funcopy.assert_called_once_with = assert_called_once_with
+ funcopy.assert_has_calls = assert_has_calls
+ funcopy.assert_any_call = assert_any_call
+ funcopy.reset_mock = reset_mock
+
+ mock._mock_delegate = funcopy
+
+
+def _is_magic(name):
+ return '__%s__' % name[2:-2] == name
+
+
+class _SentinelObject(object):
+ "A unique, named, sentinel object."
+ def __init__(self, name):
+ self.name = name
+
+ def __repr__(self):
+ return 'sentinel.%s' % self.name
+
+
+class _Sentinel(object):
+ """Access attributes to return a named object, usable as a sentinel."""
+ def __init__(self):
+ self._sentinels = {}
+
+ def __getattr__(self, name):
+ if name == '__bases__':
+ # Without this help(mock) raises an exception
+ raise AttributeError
+ return self._sentinels.setdefault(name, _SentinelObject(name))
+
+
+sentinel = _Sentinel()
+
+DEFAULT = sentinel.DEFAULT
+_missing = sentinel.MISSING
+_deleted = sentinel.DELETED
+
+
+class OldStyleClass:
+ pass
+ClassType = type(OldStyleClass)
+
+
+def _copy(value):
+ if type(value) in (dict, list, tuple, set):
+ return type(value)(value)
+ return value
+
+
+ClassTypes = (type,)
+if not inPy3k:
+ ClassTypes = (type, ClassType)
+
+_allowed_names = set(
+ [
+ 'return_value', '_mock_return_value', 'side_effect',
+ '_mock_side_effect', '_mock_parent', '_mock_new_parent',
+ '_mock_name', '_mock_new_name'
+ ]
+)
+
+
+def _delegating_property(name):
+ _allowed_names.add(name)
+ _the_name = '_mock_' + name
+ def _get(self, name=name, _the_name=_the_name):
+ sig = self._mock_delegate
+ if sig is None:
+ return getattr(self, _the_name)
+ return getattr(sig, name)
+ def _set(self, value, name=name, _the_name=_the_name):
+ sig = self._mock_delegate
+ if sig is None:
+ self.__dict__[_the_name] = value
+ else:
+ setattr(sig, name, value)
+
+ return property(_get, _set)
+
+
+
+class _CallList(list):
+
+ def __contains__(self, value):
+ if not isinstance(value, list):
+ return list.__contains__(self, value)
+ len_value = len(value)
+ len_self = len(self)
+ if len_value > len_self:
+ return False
+
+ for i in range(0, len_self - len_value + 1):
+ sub_list = self[i:i+len_value]
+ if sub_list == value:
+ return True
+ return False
+
+ def __repr__(self):
+ return pprint.pformat(list(self))
+
+
+def _check_and_set_parent(parent, value, name, new_name):
+ if not _is_instance_mock(value):
+ return False
+ if ((value._mock_name or value._mock_new_name) or
+ (value._mock_parent is not None) or
+ (value._mock_new_parent is not None)):
+ return False
+
+ _parent = parent
+ while _parent is not None:
+ # setting a mock (value) as a child or return value of itself
+ # should not modify the mock
+ if _parent is value:
+ return False
+ _parent = _parent._mock_new_parent
+
+ if new_name:
+ value._mock_new_parent = parent
+ value._mock_new_name = new_name
+ if name:
+ value._mock_parent = parent
+ value._mock_name = name
+ return True
+
+
+
+class Base(object):
+ _mock_return_value = DEFAULT
+ _mock_side_effect = None
+ def __init__(self, *args, **kwargs):
+ pass
+
+
+
+class NonCallableMock(Base):
+ """A non-callable version of `Mock`"""
+
+ def __new__(cls, *args, **kw):
+ # every instance has its own class
+ # so we can create magic methods on the
+ # class without stomping on other mocks
+ new = type(cls.__name__, (cls,), {'__doc__': cls.__doc__})
+ instance = object.__new__(new)
+ return instance
+
+
+ def __init__(
+ self, spec=None, wraps=None, name=None, spec_set=None,
+ parent=None, _spec_state=None, _new_name='', _new_parent=None,
+ **kwargs
+ ):
+ if _new_parent is None:
+ _new_parent = parent
+
+ __dict__ = self.__dict__
+ __dict__['_mock_parent'] = parent
+ __dict__['_mock_name'] = name
+ __dict__['_mock_new_name'] = _new_name
+ __dict__['_mock_new_parent'] = _new_parent
+
+ if spec_set is not None:
+ spec = spec_set
+ spec_set = True
+
+ self._mock_add_spec(spec, spec_set)
+
+ __dict__['_mock_children'] = {}
+ __dict__['_mock_wraps'] = wraps
+ __dict__['_mock_delegate'] = None
+
+ __dict__['_mock_called'] = False
+ __dict__['_mock_call_args'] = None
+ __dict__['_mock_call_count'] = 0
+ __dict__['_mock_call_args_list'] = _CallList()
+ __dict__['_mock_mock_calls'] = _CallList()
+
+ __dict__['method_calls'] = _CallList()
+
+ if kwargs:
+ self.configure_mock(**kwargs)
+
+ _super(NonCallableMock, self).__init__(
+ spec, wraps, name, spec_set, parent,
+ _spec_state
+ )
+
+
+ def attach_mock(self, mock, attribute):
+ """
+ Attach a mock as an attribute of this one, replacing its name and
+ parent. Calls to the attached mock will be recorded in the
+ `method_calls` and `mock_calls` attributes of this one."""
+ mock._mock_parent = None
+ mock._mock_new_parent = None
+ mock._mock_name = ''
+ mock._mock_new_name = None
+
+ setattr(self, attribute, mock)
+
+
+ def mock_add_spec(self, spec, spec_set=False):
+ """Add a spec to a mock. `spec` can either be an object or a
+ list of strings. Only attributes on the `spec` can be fetched as
+ attributes from the mock.
+
+ If `spec_set` is True then only attributes on the spec can be set."""
+ self._mock_add_spec(spec, spec_set)
+
+
+ def _mock_add_spec(self, spec, spec_set):
+ _spec_class = None
+
+ if spec is not None and not _is_list(spec):
+ if isinstance(spec, ClassTypes):
+ _spec_class = spec
+ else:
+ _spec_class = _get_class(spec)
+
+ spec = dir(spec)
+
+ __dict__ = self.__dict__
+ __dict__['_spec_class'] = _spec_class
+ __dict__['_spec_set'] = spec_set
+ __dict__['_mock_methods'] = spec
+
+
+ def __get_return_value(self):
+ ret = self._mock_return_value
+ if self._mock_delegate is not None:
+ ret = self._mock_delegate.return_value
+
+ if ret is DEFAULT:
+ ret = self._get_child_mock(
+ _new_parent=self, _new_name='()'
+ )
+ self.return_value = ret
+ return ret
+
+
+ def __set_return_value(self, value):
+ if self._mock_delegate is not None:
+ self._mock_delegate.return_value = value
+ else:
+ self._mock_return_value = value
+ _check_and_set_parent(self, value, None, '()')
+
+ __return_value_doc = "The value to be returned when the mock is called."
+ return_value = property(__get_return_value, __set_return_value,
+ __return_value_doc)
+
+
+ @property
+ def __class__(self):
+ if self._spec_class is None:
+ return type(self)
+ return self._spec_class
+
+ called = _delegating_property('called')
+ call_count = _delegating_property('call_count')
+ call_args = _delegating_property('call_args')
+ call_args_list = _delegating_property('call_args_list')
+ mock_calls = _delegating_property('mock_calls')
+
+
+ def __get_side_effect(self):
+ sig = self._mock_delegate
+ if sig is None:
+ return self._mock_side_effect
+ return sig.side_effect
+
+ def __set_side_effect(self, value):
+ value = _try_iter(value)
+ sig = self._mock_delegate
+ if sig is None:
+ self._mock_side_effect = value
+ else:
+ sig.side_effect = value
+
+ side_effect = property(__get_side_effect, __set_side_effect)
+
+
+ def reset_mock(self):
+ "Restore the mock object to its initial state."
+ self.called = False
+ self.call_args = None
+ self.call_count = 0
+ self.mock_calls = _CallList()
+ self.call_args_list = _CallList()
+ self.method_calls = _CallList()
+
+ for child in self._mock_children.values():
+ if isinstance(child, _SpecState):
+ continue
+ child.reset_mock()
+
+ ret = self._mock_return_value
+ if _is_instance_mock(ret) and ret is not self:
+ ret.reset_mock()
+
+
+ def configure_mock(self, **kwargs):
+ """Set attributes on the mock through keyword arguments.
+
+ Attributes plus return values and side effects can be set on child
+ mocks using standard dot notation and unpacking a dictionary in the
+ method call:
+
+ >>> attrs = {'method.return_value': 3, 'other.side_effect': KeyError}
+ >>> mock.configure_mock(**attrs)"""
+ for arg, val in sorted(kwargs.items(),
+ # we sort on the number of dots so that
+ # attributes are set before we set attributes on
+ # attributes
+ key=lambda entry: entry[0].count('.')):
+ args = arg.split('.')
+ final = args.pop()
+ obj = self
+ for entry in args:
+ obj = getattr(obj, entry)
+ setattr(obj, final, val)
+
+
+ def __getattr__(self, name):
+ if name == '_mock_methods':
+ raise AttributeError(name)
+ elif self._mock_methods is not None:
+ if name not in self._mock_methods or name in _all_magics:
+ raise AttributeError("Mock object has no attribute %r" % name)
+ elif _is_magic(name):
+ raise AttributeError(name)
+
+ result = self._mock_children.get(name)
+ if result is _deleted:
+ raise AttributeError(name)
+ elif result is None:
+ wraps = None
+ if self._mock_wraps is not None:
+ # XXXX should we get the attribute without triggering code
+ # execution?
+ wraps = getattr(self._mock_wraps, name)
+
+ result = self._get_child_mock(
+ parent=self, name=name, wraps=wraps, _new_name=name,
+ _new_parent=self
+ )
+ self._mock_children[name] = result
+
+ elif isinstance(result, _SpecState):
+ result = create_autospec(
+ result.spec, result.spec_set, result.instance,
+ result.parent, result.name
+ )
+ self._mock_children[name] = result
+
+ return result
+
+
+ def __repr__(self):
+ _name_list = [self._mock_new_name]
+ _parent = self._mock_new_parent
+ last = self
+
+ dot = '.'
+ if _name_list == ['()']:
+ dot = ''
+ seen = set()
+ while _parent is not None:
+ last = _parent
+
+ _name_list.append(_parent._mock_new_name + dot)
+ dot = '.'
+ if _parent._mock_new_name == '()':
+ dot = ''
+
+ _parent = _parent._mock_new_parent
+
+ # use ids here so as not to call __hash__ on the mocks
+ if id(_parent) in seen:
+ break
+ seen.add(id(_parent))
+
+ _name_list = list(reversed(_name_list))
+ _first = last._mock_name or 'mock'
+ if len(_name_list) > 1:
+ if _name_list[1] not in ('()', '().'):
+ _first += '.'
+ _name_list[0] = _first
+ name = ''.join(_name_list)
+
+ name_string = ''
+ if name not in ('mock', 'mock.'):
+ name_string = ' name=%r' % name
+
+ spec_string = ''
+ if self._spec_class is not None:
+ spec_string = ' spec=%r'
+ if self._spec_set:
+ spec_string = ' spec_set=%r'
+ spec_string = spec_string % self._spec_class.__name__
+ return "<%s%s%s id='%s'>" % (
+ type(self).__name__,
+ name_string,
+ spec_string,
+ id(self)
+ )
+
+
+ def __dir__(self):
+ """Filter the output of `dir(mock)` to only useful members.
+ XXXX
+ """
+ extras = self._mock_methods or []
+ from_type = dir(type(self))
+ from_dict = list(self.__dict__)
+
+ if FILTER_DIR:
+ from_type = [e for e in from_type if not e.startswith('_')]
+ from_dict = [e for e in from_dict if not e.startswith('_') or
+ _is_magic(e)]
+ return sorted(set(extras + from_type + from_dict +
+ list(self._mock_children)))
+
+
+ def __setattr__(self, name, value):
+ if name in _allowed_names:
+ # property setters go through here
+ return object.__setattr__(self, name, value)
+ elif (self._spec_set and self._mock_methods is not None and
+ name not in self._mock_methods and
+ name not in self.__dict__):
+ raise AttributeError("Mock object has no attribute '%s'" % name)
+ elif name in _unsupported_magics:
+ msg = 'Attempting to set unsupported magic method %r.' % name
+ raise AttributeError(msg)
+ elif name in _all_magics:
+ if self._mock_methods is not None and name not in self._mock_methods:
+ raise AttributeError("Mock object has no attribute '%s'" % name)
+
+ if not _is_instance_mock(value):
+ setattr(type(self), name, _get_method(name, value))
+ original = value
+ value = lambda *args, **kw: original(self, *args, **kw)
+ else:
+ # only set _new_name and not name so that mock_calls is tracked
+ # but not method calls
+ _check_and_set_parent(self, value, None, name)
+ setattr(type(self), name, value)
+ self._mock_children[name] = value
+ elif name == '__class__':
+ self._spec_class = value
+ return
+ else:
+ if _check_and_set_parent(self, value, name, name):
+ self._mock_children[name] = value
+ return object.__setattr__(self, name, value)
+
+
+ def __delattr__(self, name):
+ if name in _all_magics and name in type(self).__dict__:
+ delattr(type(self), name)
+ if name not in self.__dict__:
+ # for magic methods that are still MagicProxy objects and
+ # not set on the instance itself
+ return
+
+ if name in self.__dict__:
+ object.__delattr__(self, name)
+
+ obj = self._mock_children.get(name, _missing)
+ if obj is _deleted:
+ raise AttributeError(name)
+ if obj is not _missing:
+ del self._mock_children[name]
+ self._mock_children[name] = _deleted
+
+
+
+ def _format_mock_call_signature(self, args, kwargs):
+ name = self._mock_name or 'mock'
+ return _format_call_signature(name, args, kwargs)
+
+
+ def _format_mock_failure_message(self, args, kwargs):
+ message = 'Expected call: %s\nActual call: %s'
+ expected_string = self._format_mock_call_signature(args, kwargs)
+ call_args = self.call_args
+ if len(call_args) == 3:
+ call_args = call_args[1:]
+ actual_string = self._format_mock_call_signature(*call_args)
+ return message % (expected_string, actual_string)
+
+
+ def assert_called_with(_mock_self, *args, **kwargs):
+ """assert that the mock was called with the specified arguments.
+
+ Raises an AssertionError if the args and keyword args passed in are
+ different to the last call to the mock."""
+ self = _mock_self
+ if self.call_args is None:
+ expected = self._format_mock_call_signature(args, kwargs)
+ raise AssertionError('Expected call: %s\nNot called' % (expected,))
+
+ if self.call_args != (args, kwargs):
+ msg = self._format_mock_failure_message(args, kwargs)
+ raise AssertionError(msg)
+
+
+ def assert_called_once_with(_mock_self, *args, **kwargs):
+ """assert that the mock was called exactly once and with the specified
+ arguments."""
+ self = _mock_self
+ if not self.call_count == 1:
+ msg = ("Expected to be called once. Called %s times." %
+ self.call_count)
+ raise AssertionError(msg)
+ return self.assert_called_with(*args, **kwargs)
+
+
+ def assert_has_calls(self, calls, any_order=False):
+ """assert the mock has been called with the specified calls.
+ The `mock_calls` list is checked for the calls.
+
+ If `any_order` is False (the default) then the calls must be
+ sequential. There can be extra calls before or after the
+ specified calls.
+
+ If `any_order` is True then the calls can be in any order, but
+ they must all appear in `mock_calls`."""
+ if not any_order:
+ if calls not in self.mock_calls:
+ raise AssertionError(
+ 'Calls not found.\nExpected: %r\n'
+ 'Actual: %r' % (calls, self.mock_calls)
+ )
+ return
+
+ all_calls = list(self.mock_calls)
+
+ not_found = []
+ for kall in calls:
+ try:
+ all_calls.remove(kall)
+ except ValueError:
+ not_found.append(kall)
+ if not_found:
+ raise AssertionError(
+ '%r not all found in call list' % (tuple(not_found),)
+ )
+
+
+ def assert_any_call(self, *args, **kwargs):
+ """assert the mock has been called with the specified arguments.
+
+ The assert passes if the mock has *ever* been called, unlike
+ `assert_called_with` and `assert_called_once_with` that only pass if
+ the call is the most recent one."""
+ kall = call(*args, **kwargs)
+ if kall not in self.call_args_list:
+ expected_string = self._format_mock_call_signature(args, kwargs)
+ raise AssertionError(
+ '%s call not found' % expected_string
+ )
+
+
+ def _get_child_mock(self, **kw):
+ """Create the child mocks for attributes and return value.
+ By default child mocks will be the same type as the parent.
+ Subclasses of Mock may want to override this to customize the way
+ child mocks are made.
+
+ For non-callable mocks the callable variant will be used (rather than
+ any custom subclass)."""
+ _type = type(self)
+ if not issubclass(_type, CallableMixin):
+ if issubclass(_type, NonCallableMagicMock):
+ klass = MagicMock
+ elif issubclass(_type, NonCallableMock) :
+ klass = Mock
+ else:
+ klass = _type.__mro__[1]
+ return klass(**kw)
+
+
+
+def _try_iter(obj):
+ if obj is None:
+ return obj
+ if _is_exception(obj):
+ return obj
+ if _callable(obj):
+ return obj
+ try:
+ return iter(obj)
+ except TypeError:
+ # XXXX backwards compatibility
+ # but this will blow up on first call - so maybe we should fail early?
+ return obj
+
+
+
+class CallableMixin(Base):
+
+ def __init__(self, spec=None, side_effect=None, return_value=DEFAULT,
+ wraps=None, name=None, spec_set=None, parent=None,
+ _spec_state=None, _new_name='', _new_parent=None, **kwargs):
+ self.__dict__['_mock_return_value'] = return_value
+
+ _super(CallableMixin, self).__init__(
+ spec, wraps, name, spec_set, parent,
+ _spec_state, _new_name, _new_parent, **kwargs
+ )
+
+ self.side_effect = side_effect
+
+
+ def _mock_check_sig(self, *args, **kwargs):
+ # stub method that can be replaced with one with a specific signature
+ pass
+
+
+ def __call__(_mock_self, *args, **kwargs):
+ # can't use self in-case a function / method we are mocking uses self
+ # in the signature
+ _mock_self._mock_check_sig(*args, **kwargs)
+ return _mock_self._mock_call(*args, **kwargs)
+
+
+ def _mock_call(_mock_self, *args, **kwargs):
+ self = _mock_self
+ self.called = True
+ self.call_count += 1
+ self.call_args = _Call((args, kwargs), two=True)
+ self.call_args_list.append(_Call((args, kwargs), two=True))
+
+ _new_name = self._mock_new_name
+ _new_parent = self._mock_new_parent
+ self.mock_calls.append(_Call(('', args, kwargs)))
+
+ seen = set()
+ skip_next_dot = _new_name == '()'
+ do_method_calls = self._mock_parent is not None
+ name = self._mock_name
+ while _new_parent is not None:
+ this_mock_call = _Call((_new_name, args, kwargs))
+ if _new_parent._mock_new_name:
+ dot = '.'
+ if skip_next_dot:
+ dot = ''
+
+ skip_next_dot = False
+ if _new_parent._mock_new_name == '()':
+ skip_next_dot = True
+
+ _new_name = _new_parent._mock_new_name + dot + _new_name
+
+ if do_method_calls:
+ if _new_name == name:
+ this_method_call = this_mock_call
+ else:
+ this_method_call = _Call((name, args, kwargs))
+ _new_parent.method_calls.append(this_method_call)
+
+ do_method_calls = _new_parent._mock_parent is not None
+ if do_method_calls:
+ name = _new_parent._mock_name + '.' + name
+
+ _new_parent.mock_calls.append(this_mock_call)
+ _new_parent = _new_parent._mock_new_parent
+
+ # use ids here so as not to call __hash__ on the mocks
+ _new_parent_id = id(_new_parent)
+ if _new_parent_id in seen:
+ break
+ seen.add(_new_parent_id)
+
+ ret_val = DEFAULT
+ effect = self.side_effect
+ if effect is not None:
+ if _is_exception(effect):
+ raise effect
+
+ if not _callable(effect):
+ result = next(effect)
+ if _is_exception(result):
+ raise result
+ return result
+
+ ret_val = effect(*args, **kwargs)
+ if ret_val is DEFAULT:
+ ret_val = self.return_value
+
+ if (self._mock_wraps is not None and
+ self._mock_return_value is DEFAULT):
+ return self._mock_wraps(*args, **kwargs)
+ if ret_val is DEFAULT:
+ ret_val = self.return_value
+ return ret_val
+
+
+
+class Mock(CallableMixin, NonCallableMock):
+ """
+ Create a new `Mock` object. `Mock` takes several optional arguments
+ that specify the behaviour of the Mock object:
+
+ * `spec`: This can be either a list of strings or an existing object (a
+ class or instance) that acts as the specification for the mock object. If
+ you pass in an object then a list of strings is formed by calling dir on
+ the object (excluding unsupported magic attributes and methods). Accessing
+ any attribute not in this list will raise an `AttributeError`.
+
+ If `spec` is an object (rather than a list of strings) then
+ `mock.__class__` returns the class of the spec object. This allows mocks
+ to pass `isinstance` tests.
+
+ * `spec_set`: A stricter variant of `spec`. If used, attempting to *set*
+ or get an attribute on the mock that isn't on the object passed as
+ `spec_set` will raise an `AttributeError`.
+
+ * `side_effect`: A function to be called whenever the Mock is called. See
+ the `side_effect` attribute. Useful for raising exceptions or
+ dynamically changing return values. The function is called with the same
+ arguments as the mock, and unless it returns `DEFAULT`, the return
+ value of this function is used as the return value.
+
+ Alternatively `side_effect` can be an exception class or instance. In
+ this case the exception will be raised when the mock is called.
+
+ If `side_effect` is an iterable then each call to the mock will return
+ the next value from the iterable. If any of the members of the iterable
+ are exceptions they will be raised instead of returned.
+
+ * `return_value`: The value returned when the mock is called. By default
+ this is a new Mock (created on first access). See the
+ `return_value` attribute.
+
+ * `wraps`: Item for the mock object to wrap. If `wraps` is not None then
+ calling the Mock will pass the call through to the wrapped object
+ (returning the real result). Attribute access on the mock will return a
+ Mock object that wraps the corresponding attribute of the wrapped object
+ (so attempting to access an attribute that doesn't exist will raise an
+ `AttributeError`).
+
+ If the mock has an explicit `return_value` set then calls are not passed
+ to the wrapped object and the `return_value` is returned instead.
+
+ * `name`: If the mock has a name then it will be used in the repr of the
+ mock. This can be useful for debugging. The name is propagated to child
+ mocks.
+
+ Mocks can also be called with arbitrary keyword arguments. These will be
+ used to set attributes on the mock after it is created.
+ """
+
+
+
+def _dot_lookup(thing, comp, import_path):
+ try:
+ return getattr(thing, comp)
+ except AttributeError:
+ __import__(import_path)
+ return getattr(thing, comp)
+
+
+def _importer(target):
+ components = target.split('.')
+ import_path = components.pop(0)
+ thing = __import__(import_path)
+
+ for comp in components:
+ import_path += ".%s" % comp
+ thing = _dot_lookup(thing, comp, import_path)
+ return thing
+
+
+def _is_started(patcher):
+ # XXXX horrible
+ return hasattr(patcher, 'is_local')
+
+
+class _patch(object):
+
+ attribute_name = None
+ _active_patches = set()
+
+ def __init__(
+ self, getter, attribute, new, spec, create,
+ spec_set, autospec, new_callable, kwargs
+ ):
+ if new_callable is not None:
+ if new is not DEFAULT:
+ raise ValueError(
+ "Cannot use 'new' and 'new_callable' together"
+ )
+ if autospec is not None:
+ raise ValueError(
+ "Cannot use 'autospec' and 'new_callable' together"
+ )
+
+ self.getter = getter
+ self.attribute = attribute
+ self.new = new
+ self.new_callable = new_callable
+ self.spec = spec
+ self.create = create
+ self.has_local = False
+ self.spec_set = spec_set
+ self.autospec = autospec
+ self.kwargs = kwargs
+ self.additional_patchers = []
+
+
+ def copy(self):
+ patcher = _patch(
+ self.getter, self.attribute, self.new, self.spec,
+ self.create, self.spec_set,
+ self.autospec, self.new_callable, self.kwargs
+ )
+ patcher.attribute_name = self.attribute_name
+ patcher.additional_patchers = [
+ p.copy() for p in self.additional_patchers
+ ]
+ return patcher
+
+
+ def __call__(self, func):
+ if isinstance(func, ClassTypes):
+ return self.decorate_class(func)
+ return self.decorate_callable(func)
+
+
+ def decorate_class(self, klass):
+ for attr in dir(klass):
+ if not attr.startswith(patch.TEST_PREFIX):
+ continue
+
+ attr_value = getattr(klass, attr)
+ if not hasattr(attr_value, "__call__"):
+ continue
+
+ patcher = self.copy()
+ setattr(klass, attr, patcher(attr_value))
+ return klass
+
+
+ def decorate_callable(self, func):
+ if hasattr(func, 'patchings'):
+ func.patchings.append(self)
+ return func
+
+ @wraps(func)
+ def patched(*args, **keywargs):
+ # don't use a with here (backwards compatability with Python 2.4)
+ extra_args = []
+ entered_patchers = []
+
+ # can't use try...except...finally because of Python 2.4
+ # compatibility
+ exc_info = tuple()
+ try:
+ try:
+ for patching in patched.patchings:
+ arg = patching.__enter__()
+ entered_patchers.append(patching)
+ if patching.attribute_name is not None:
+ keywargs.update(arg)
+ elif patching.new is DEFAULT:
+ extra_args.append(arg)
+
+ args += tuple(extra_args)
+ return func(*args, **keywargs)
+ except:
+ if (patching not in entered_patchers and
+ _is_started(patching)):
+ # the patcher may have been started, but an exception
+ # raised whilst entering one of its additional_patchers
+ entered_patchers.append(patching)
+ # Pass the exception to __exit__
+ exc_info = sys.exc_info()
+ # re-raise the exception
+ raise
+ finally:
+ for patching in reversed(entered_patchers):
+ patching.__exit__(*exc_info)
+
+ patched.patchings = [self]
+ if hasattr(func, 'func_code'):
+ # not in Python 3
+ patched.compat_co_firstlineno = getattr(
+ func, "compat_co_firstlineno",
+ func.func_code.co_firstlineno
+ )
+ return patched
+
+
+ def get_original(self):
+ target = self.getter()
+ name = self.attribute
+
+ original = DEFAULT
+ local = False
+
+ try:
+ original = target.__dict__[name]
+ except (AttributeError, KeyError):
+ original = getattr(target, name, DEFAULT)
+ else:
+ local = True
+
+ if not self.create and original is DEFAULT:
+ raise AttributeError(
+ "%s does not have the attribute %r" % (target, name)
+ )
+ return original, local
+
+
+ def __enter__(self):
+ """Perform the patch."""
+ new, spec, spec_set = self.new, self.spec, self.spec_set
+ autospec, kwargs = self.autospec, self.kwargs
+ new_callable = self.new_callable
+ self.target = self.getter()
+
+ # normalise False to None
+ if spec is False:
+ spec = None
+ if spec_set is False:
+ spec_set = None
+ if autospec is False:
+ autospec = None
+
+ if spec is not None and autospec is not None:
+ raise TypeError("Can't specify spec and autospec")
+ if ((spec is not None or autospec is not None) and
+ spec_set not in (True, None)):
+ raise TypeError("Can't provide explicit spec_set *and* spec or autospec")
+
+ original, local = self.get_original()
+
+ if new is DEFAULT and autospec is None:
+ inherit = False
+ if spec is True:
+ # set spec to the object we are replacing
+ spec = original
+ if spec_set is True:
+ spec_set = original
+ spec = None
+ elif spec is not None:
+ if spec_set is True:
+ spec_set = spec
+ spec = None
+ elif spec_set is True:
+ spec_set = original
+
+ if spec is not None or spec_set is not None:
+ if original is DEFAULT:
+ raise TypeError("Can't use 'spec' with create=True")
+ if isinstance(original, ClassTypes):
+ # If we're patching out a class and there is a spec
+ inherit = True
+
+ Klass = MagicMock
+ _kwargs = {}
+ if new_callable is not None:
+ Klass = new_callable
+ elif spec is not None or spec_set is not None:
+ this_spec = spec
+ if spec_set is not None:
+ this_spec = spec_set
+ if _is_list(this_spec):
+ not_callable = '__call__' not in this_spec
+ else:
+ not_callable = not _callable(this_spec)
+ if not_callable:
+ Klass = NonCallableMagicMock
+
+ if spec is not None:
+ _kwargs['spec'] = spec
+ if spec_set is not None:
+ _kwargs['spec_set'] = spec_set
+
+ # add a name to mocks
+ if (isinstance(Klass, type) and
+ issubclass(Klass, NonCallableMock) and self.attribute):
+ _kwargs['name'] = self.attribute
+
+ _kwargs.update(kwargs)
+ new = Klass(**_kwargs)
+
+ if inherit and _is_instance_mock(new):
+ # we can only tell if the instance should be callable if the
+ # spec is not a list
+ this_spec = spec
+ if spec_set is not None:
+ this_spec = spec_set
+ if (not _is_list(this_spec) and not
+ _instance_callable(this_spec)):
+ Klass = NonCallableMagicMock
+
+ _kwargs.pop('name')
+ new.return_value = Klass(_new_parent=new, _new_name='()',
+ **_kwargs)
+ elif autospec is not None:
+ # spec is ignored, new *must* be default, spec_set is treated
+ # as a boolean. Should we check spec is not None and that spec_set
+ # is a bool?
+ if new is not DEFAULT:
+ raise TypeError(
+ "autospec creates the mock for you. Can't specify "
+ "autospec and new."
+ )
+ if original is DEFAULT:
+ raise TypeError("Can't use 'autospec' with create=True")
+ spec_set = bool(spec_set)
+ if autospec is True:
+ autospec = original
+
+ new = create_autospec(autospec, spec_set=spec_set,
+ _name=self.attribute, **kwargs)
+ elif kwargs:
+ # can't set keyword args when we aren't creating the mock
+ # XXXX If new is a Mock we could call new.configure_mock(**kwargs)
+ raise TypeError("Can't pass kwargs to a mock we aren't creating")
+
+ new_attr = new
+
+ self.temp_original = original
+ self.is_local = local
+ setattr(self.target, self.attribute, new_attr)
+ if self.attribute_name is not None:
+ extra_args = {}
+ if self.new is DEFAULT:
+ extra_args[self.attribute_name] = new
+ for patching in self.additional_patchers:
+ arg = patching.__enter__()
+ if patching.new is DEFAULT:
+ extra_args.update(arg)
+ return extra_args
+
+ return new
+
+
+ def __exit__(self, *exc_info):
+ """Undo the patch."""
+ if not _is_started(self):
+ raise RuntimeError('stop called on unstarted patcher')
+
+ if self.is_local and self.temp_original is not DEFAULT:
+ setattr(self.target, self.attribute, self.temp_original)
+ else:
+ delattr(self.target, self.attribute)
+ if not self.create and not hasattr(self.target, self.attribute):
+ # needed for proxy objects like django settings
+ setattr(self.target, self.attribute, self.temp_original)
+
+ del self.temp_original
+ del self.is_local
+ del self.target
+ for patcher in reversed(self.additional_patchers):
+ if _is_started(patcher):
+ patcher.__exit__(*exc_info)
+
+
+ def start(self):
+ """Activate a patch, returning any created mock."""
+ result = self.__enter__()
+ self._active_patches.add(self)
+ return result
+
+
+ def stop(self):
+ """Stop an active patch."""
+ self._active_patches.discard(self)
+ return self.__exit__()
+
+
+
+def _get_target(target):
+ try:
+ target, attribute = target.rsplit('.', 1)
+ except (TypeError, ValueError):
+ raise TypeError("Need a valid target to patch. You supplied: %r" %
+ (target,))
+ getter = lambda: _importer(target)
+ return getter, attribute
+
+
+def _patch_object(
+ target, attribute, new=DEFAULT, spec=None,
+ create=False, spec_set=None, autospec=None,
+ new_callable=None, **kwargs
+ ):
+ """
+ patch.object(target, attribute, new=DEFAULT, spec=None, create=False,
+ spec_set=None, autospec=None, new_callable=None, **kwargs)
+
+ patch the named member (`attribute`) on an object (`target`) with a mock
+ object.
+
+ `patch.object` can be used as a decorator, class decorator or a context
+ manager. Arguments `new`, `spec`, `create`, `spec_set`,
+ `autospec` and `new_callable` have the same meaning as for `patch`. Like
+ `patch`, `patch.object` takes arbitrary keyword arguments for configuring
+ the mock object it creates.
+
+ When used as a class decorator `patch.object` honours `patch.TEST_PREFIX`
+ for choosing which methods to wrap.
+ """
+ getter = lambda: target
+ return _patch(
+ getter, attribute, new, spec, create,
+ spec_set, autospec, new_callable, kwargs
+ )
+
+
+def _patch_multiple(target, spec=None, create=False, spec_set=None,
+ autospec=None, new_callable=None, **kwargs):
+ """Perform multiple patches in a single call. It takes the object to be
+ patched (either as an object or a string to fetch the object by importing)
+ and keyword arguments for the patches::
+
+ with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'):
+ ...
+
+ Use `DEFAULT` as the value if you want `patch.multiple` to create
+ mocks for you. In this case the created mocks are passed into a decorated
+ function by keyword, and a dictionary is returned when `patch.multiple` is
+ used as a context manager.
+
+ `patch.multiple` can be used as a decorator, class decorator or a context
+ manager. The arguments `spec`, `spec_set`, `create`,
+ `autospec` and `new_callable` have the same meaning as for `patch`. These
+ arguments will be applied to *all* patches done by `patch.multiple`.
+
+ When used as a class decorator `patch.multiple` honours `patch.TEST_PREFIX`
+ for choosing which methods to wrap.
+ """
+ if type(target) in (unicode, str):
+ getter = lambda: _importer(target)
+ else:
+ getter = lambda: target
+
+ if not kwargs:
+ raise ValueError(
+ 'Must supply at least one keyword argument with patch.multiple'
+ )
+ # need to wrap in a list for python 3, where items is a view
+ items = list(kwargs.items())
+ attribute, new = items[0]
+ patcher = _patch(
+ getter, attribute, new, spec, create, spec_set,
+ autospec, new_callable, {}
+ )
+ patcher.attribute_name = attribute
+ for attribute, new in items[1:]:
+ this_patcher = _patch(
+ getter, attribute, new, spec, create, spec_set,
+ autospec, new_callable, {}
+ )
+ this_patcher.attribute_name = attribute
+ patcher.additional_patchers.append(this_patcher)
+ return patcher
+
+
+def patch(
+ target, new=DEFAULT, spec=None, create=False,
+ spec_set=None, autospec=None, new_callable=None, **kwargs
+ ):
+ """
+ `patch` acts as a function decorator, class decorator or a context
+ manager. Inside the body of the function or with statement, the `target`
+ is patched with a `new` object. When the function/with statement exits
+ the patch is undone.
+
+ If `new` is omitted, then the target is replaced with a
+ `MagicMock`. If `patch` is used as a decorator and `new` is
+ omitted, the created mock is passed in as an extra argument to the
+ decorated function. If `patch` is used as a context manager the created
+ mock is returned by the context manager.
+
+ `target` should be a string in the form `'package.module.ClassName'`. The
+ `target` is imported and the specified object replaced with the `new`
+ object, so the `target` must be importable from the environment you are
+ calling `patch` from. The target is imported when the decorated function
+ is executed, not at decoration time.
+
+ The `spec` and `spec_set` keyword arguments are passed to the `MagicMock`
+ if patch is creating one for you.
+
+ In addition you can pass `spec=True` or `spec_set=True`, which causes
+ patch to pass in the object being mocked as the spec/spec_set object.
+
+ `new_callable` allows you to specify a different class, or callable object,
+ that will be called to create the `new` object. By default `MagicMock` is
+ used.
+
+ A more powerful form of `spec` is `autospec`. If you set `autospec=True`
+ then the mock with be created with a spec from the object being replaced.
+ All attributes of the mock will also have the spec of the corresponding
+ attribute of the object being replaced. Methods and functions being
+ mocked will have their arguments checked and will raise a `TypeError` if
+ they are called with the wrong signature. For mocks replacing a class,
+ their return value (the 'instance') will have the same spec as the class.
+
+ Instead of `autospec=True` you can pass `autospec=some_object` to use an
+ arbitrary object as the spec instead of the one being replaced.
+
+ By default `patch` will fail to replace attributes that don't exist. If
+ you pass in `create=True`, and the attribute doesn't exist, patch will
+ create the attribute for you when the patched function is called, and
+ delete it again afterwards. This is useful for writing tests against
+ attributes that your production code creates at runtime. It is off by by
+ default because it can be dangerous. With it switched on you can write
+ passing tests against APIs that don't actually exist!
+
+ Patch can be used as a `TestCase` class decorator. It works by
+ decorating each test method in the class. This reduces the boilerplate
+ code when your test methods share a common patchings set. `patch` finds
+ tests by looking for method names that start with `patch.TEST_PREFIX`.
+ By default this is `test`, which matches the way `unittest` finds tests.
+ You can specify an alternative prefix by setting `patch.TEST_PREFIX`.
+
+ Patch can be used as a context manager, with the with statement. Here the
+ patching applies to the indented block after the with statement. If you
+ use "as" then the patched object will be bound to the name after the
+ "as"; very useful if `patch` is creating a mock object for you.
+
+ `patch` takes arbitrary keyword arguments. These will be passed to
+ the `Mock` (or `new_callable`) on construction.
+
+ `patch.dict(...)`, `patch.multiple(...)` and `patch.object(...)` are
+ available for alternate use-cases.
+ """
+ getter, attribute = _get_target(target)
+ return _patch(
+ getter, attribute, new, spec, create,
+ spec_set, autospec, new_callable, kwargs
+ )
+
+
+class _patch_dict(object):
+ """
+ Patch a dictionary, or dictionary like object, and restore the dictionary
+ to its original state after the test.
+
+ `in_dict` can be a dictionary or a mapping like container. If it is a
+ mapping then it must at least support getting, setting and deleting items
+ plus iterating over keys.
+
+ `in_dict` can also be a string specifying the name of the dictionary, which
+ will then be fetched by importing it.
+
+ `values` can be a dictionary of values to set in the dictionary. `values`
+ can also be an iterable of `(key, value)` pairs.
+
+ If `clear` is True then the dictionary will be cleared before the new
+ values are set.
+
+ `patch.dict` can also be called with arbitrary keyword arguments to set
+ values in the dictionary::
+
+ with patch.dict('sys.modules', mymodule=Mock(), other_module=Mock()):
+ ...
+
+ `patch.dict` can be used as a context manager, decorator or class
+ decorator. When used as a class decorator `patch.dict` honours
+ `patch.TEST_PREFIX` for choosing which methods to wrap.
+ """
+
+ def __init__(self, in_dict, values=(), clear=False, **kwargs):
+ if isinstance(in_dict, basestring):
+ in_dict = _importer(in_dict)
+ self.in_dict = in_dict
+ # support any argument supported by dict(...) constructor
+ self.values = dict(values)
+ self.values.update(kwargs)
+ self.clear = clear
+ self._original = None
+
+
+ def __call__(self, f):
+ if isinstance(f, ClassTypes):
+ return self.decorate_class(f)
+ @wraps(f)
+ def _inner(*args, **kw):
+ self._patch_dict()
+ try:
+ return f(*args, **kw)
+ finally:
+ self._unpatch_dict()
+
+ return _inner
+
+
+ def decorate_class(self, klass):
+ for attr in dir(klass):
+ attr_value = getattr(klass, attr)
+ if (attr.startswith(patch.TEST_PREFIX) and
+ hasattr(attr_value, "__call__")):
+ decorator = _patch_dict(self.in_dict, self.values, self.clear)
+ decorated = decorator(attr_value)
+ setattr(klass, attr, decorated)
+ return klass
+
+
+ def __enter__(self):
+ """Patch the dict."""
+ self._patch_dict()
+
+
+ def _patch_dict(self):
+ values = self.values
+ in_dict = self.in_dict
+ clear = self.clear
+
+ try:
+ original = in_dict.copy()
+ except AttributeError:
+ # dict like object with no copy method
+ # must support iteration over keys
+ original = {}
+ for key in in_dict:
+ original[key] = in_dict[key]
+ self._original = original
+
+ if clear:
+ _clear_dict(in_dict)
+
+ try:
+ in_dict.update(values)
+ except AttributeError:
+ # dict like object with no update method
+ for key in values:
+ in_dict[key] = values[key]
+
+
+ def _unpatch_dict(self):
+ in_dict = self.in_dict
+ original = self._original
+
+ _clear_dict(in_dict)
+
+ try:
+ in_dict.update(original)
+ except AttributeError:
+ for key in original:
+ in_dict[key] = original[key]
+
+
+ def __exit__(self, *args):
+ """Unpatch the dict."""
+ self._unpatch_dict()
+ return False
+
+ start = __enter__
+ stop = __exit__
+
+
+def _clear_dict(in_dict):
+ try:
+ in_dict.clear()
+ except AttributeError:
+ keys = list(in_dict)
+ for key in keys:
+ del in_dict[key]
+
+
+def _patch_stopall():
+ """Stop all active patches."""
+ for patch in list(_patch._active_patches):
+ patch.stop()
+
+
+patch.object = _patch_object
+patch.dict = _patch_dict
+patch.multiple = _patch_multiple
+patch.stopall = _patch_stopall
+patch.TEST_PREFIX = 'test'
+
+magic_methods = (
+ "lt le gt ge eq ne "
+ "getitem setitem delitem "
+ "len contains iter "
+ "hash str sizeof "
+ "enter exit "
+ "divmod neg pos abs invert "
+ "complex int float index "
+ "trunc floor ceil "
+)
+
+numerics = "add sub mul div floordiv mod lshift rshift and xor or pow "
+inplace = ' '.join('i%s' % n for n in numerics.split())
+right = ' '.join('r%s' % n for n in numerics.split())
+extra = ''
+if inPy3k:
+ extra = 'bool next '
+else:
+ extra = 'unicode long nonzero oct hex truediv rtruediv '
+
+# not including __prepare__, __instancecheck__, __subclasscheck__
+# (as they are metaclass methods)
+# __del__ is not supported at all as it causes problems if it exists
+
+_non_defaults = set('__%s__' % method for method in [
+ 'cmp', 'getslice', 'setslice', 'coerce', 'subclasses',
+ 'format', 'get', 'set', 'delete', 'reversed',
+ 'missing', 'reduce', 'reduce_ex', 'getinitargs',
+ 'getnewargs', 'getstate', 'setstate', 'getformat',
+ 'setformat', 'repr', 'dir'
+])
+
+
+def _get_method(name, func):
+ "Turns a callable object (like a mock) into a real function"
+ def method(self, *args, **kw):
+ return func(self, *args, **kw)
+ method.__name__ = name
+ return method
+
+
+_magics = set(
+ '__%s__' % method for method in
+ ' '.join([magic_methods, numerics, inplace, right, extra]).split()
+)
+
+_all_magics = _magics | _non_defaults
+
+_unsupported_magics = set([
+ '__getattr__', '__setattr__',
+ '__init__', '__new__', '__prepare__'
+ '__instancecheck__', '__subclasscheck__',
+ '__del__'
+])
+
+_calculate_return_value = {
+ '__hash__': lambda self: object.__hash__(self),
+ '__str__': lambda self: object.__str__(self),
+ '__sizeof__': lambda self: object.__sizeof__(self),
+ '__unicode__': lambda self: unicode(object.__str__(self)),
+}
+
+_return_values = {
+ '__lt__': NotImplemented,
+ '__gt__': NotImplemented,
+ '__le__': NotImplemented,
+ '__ge__': NotImplemented,
+ '__int__': 1,
+ '__contains__': False,
+ '__len__': 0,
+ '__exit__': False,
+ '__complex__': 1j,
+ '__float__': 1.0,
+ '__bool__': True,
+ '__nonzero__': True,
+ '__oct__': '1',
+ '__hex__': '0x1',
+ '__long__': long(1),
+ '__index__': 1,
+}
+
+
+def _get_eq(self):
+ def __eq__(other):
+ ret_val = self.__eq__._mock_return_value
+ if ret_val is not DEFAULT:
+ return ret_val
+ return self is other
+ return __eq__
+
+def _get_ne(self):
+ def __ne__(other):
+ if self.__ne__._mock_return_value is not DEFAULT:
+ return DEFAULT
+ return self is not other
+ return __ne__
+
+def _get_iter(self):
+ def __iter__():
+ ret_val = self.__iter__._mock_return_value
+ if ret_val is DEFAULT:
+ return iter([])
+ # if ret_val was already an iterator, then calling iter on it should
+ # return the iterator unchanged
+ return iter(ret_val)
+ return __iter__
+
+_side_effect_methods = {
+ '__eq__': _get_eq,
+ '__ne__': _get_ne,
+ '__iter__': _get_iter,
+}
+
+
+
+def _set_return_value(mock, method, name):
+ fixed = _return_values.get(name, DEFAULT)
+ if fixed is not DEFAULT:
+ method.return_value = fixed
+ return
+
+ return_calulator = _calculate_return_value.get(name)
+ if return_calulator is not None:
+ try:
+ return_value = return_calulator(mock)
+ except AttributeError:
+ # XXXX why do we return AttributeError here?
+ # set it as a side_effect instead?
+ return_value = AttributeError(name)
+ method.return_value = return_value
+ return
+
+ side_effector = _side_effect_methods.get(name)
+ if side_effector is not None:
+ method.side_effect = side_effector(mock)
+
+
+
+class MagicMixin(object):
+ def __init__(self, *args, **kw):
+ _super(MagicMixin, self).__init__(*args, **kw)
+ self._mock_set_magics()
+
+
+ def _mock_set_magics(self):
+ these_magics = _magics
+
+ if self._mock_methods is not None:
+ these_magics = _magics.intersection(self._mock_methods)
+
+ remove_magics = set()
+ remove_magics = _magics - these_magics
+
+ for entry in remove_magics:
+ if entry in type(self).__dict__:
+ # remove unneeded magic methods
+ delattr(self, entry)
+
+ # don't overwrite existing attributes if called a second time
+ these_magics = these_magics - set(type(self).__dict__)
+
+ _type = type(self)
+ for entry in these_magics:
+ setattr(_type, entry, MagicProxy(entry, self))
+
+
+
+class NonCallableMagicMock(MagicMixin, NonCallableMock):
+ """A version of `MagicMock` that isn't callable."""
+ def mock_add_spec(self, spec, spec_set=False):
+ """Add a spec to a mock. `spec` can either be an object or a
+ list of strings. Only attributes on the `spec` can be fetched as
+ attributes from the mock.
+
+ If `spec_set` is True then only attributes on the spec can be set."""
+ self._mock_add_spec(spec, spec_set)
+ self._mock_set_magics()
+
+
+
+class MagicMock(MagicMixin, Mock):
+ """
+ MagicMock is a subclass of Mock with default implementations
+ of most of the magic methods. You can use MagicMock without having to
+ configure the magic methods yourself.
+
+ If you use the `spec` or `spec_set` arguments then *only* magic
+ methods that exist in the spec will be created.
+
+ Attributes and the return value of a `MagicMock` will also be `MagicMocks`.
+ """
+ def mock_add_spec(self, spec, spec_set=False):
+ """Add a spec to a mock. `spec` can either be an object or a
+ list of strings. Only attributes on the `spec` can be fetched as
+ attributes from the mock.
+
+ If `spec_set` is True then only attributes on the spec can be set."""
+ self._mock_add_spec(spec, spec_set)
+ self._mock_set_magics()
+
+
+
+class MagicProxy(object):
+ def __init__(self, name, parent):
+ self.name = name
+ self.parent = parent
+
+ def __call__(self, *args, **kwargs):
+ m = self.create_mock()
+ return m(*args, **kwargs)
+
+ def create_mock(self):
+ entry = self.name
+ parent = self.parent
+ m = parent._get_child_mock(name=entry, _new_name=entry,
+ _new_parent=parent)
+ setattr(parent, entry, m)
+ _set_return_value(parent, m, entry)
+ return m
+
+ def __get__(self, obj, _type=None):
+ return self.create_mock()
+
+
+
+class _ANY(object):
+ "A helper object that compares equal to everything."
+
+ def __eq__(self, other):
+ return True
+
+ def __ne__(self, other):
+ return False
+
+ def __repr__(self):
+ return ''
+
+ANY = _ANY()
+
+
+
+def _format_call_signature(name, args, kwargs):
+ message = '%s(%%s)' % name
+ formatted_args = ''
+ args_string = ', '.join([repr(arg) for arg in args])
+ kwargs_string = ', '.join([
+ '%s=%r' % (key, value) for key, value in kwargs.items()
+ ])
+ if args_string:
+ formatted_args = args_string
+ if kwargs_string:
+ if formatted_args:
+ formatted_args += ', '
+ formatted_args += kwargs_string
+
+ return message % formatted_args
+
+
+
+class _Call(tuple):
+ """
+ A tuple for holding the results of a call to a mock, either in the form
+ `(args, kwargs)` or `(name, args, kwargs)`.
+
+ If args or kwargs are empty then a call tuple will compare equal to
+ a tuple without those values. This makes comparisons less verbose::
+
+ _Call(('name', (), {})) == ('name',)
+ _Call(('name', (1,), {})) == ('name', (1,))
+ _Call(((), {'a': 'b'})) == ({'a': 'b'},)
+
+ The `_Call` object provides a useful shortcut for comparing with call::
+
+ _Call(((1, 2), {'a': 3})) == call(1, 2, a=3)
+ _Call(('foo', (1, 2), {'a': 3})) == call.foo(1, 2, a=3)
+
+ If the _Call has no name then it will match any name.
+ """
+ def __new__(cls, value=(), name=None, parent=None, two=False,
+ from_kall=True):
+ name = ''
+ args = ()
+ kwargs = {}
+ _len = len(value)
+ if _len == 3:
+ name, args, kwargs = value
+ elif _len == 2:
+ first, second = value
+ if isinstance(first, basestring):
+ name = first
+ if isinstance(second, tuple):
+ args = second
+ else:
+ kwargs = second
+ else:
+ args, kwargs = first, second
+ elif _len == 1:
+ value, = value
+ if isinstance(value, basestring):
+ name = value
+ elif isinstance(value, tuple):
+ args = value
+ else:
+ kwargs = value
+
+ if two:
+ return tuple.__new__(cls, (args, kwargs))
+
+ return tuple.__new__(cls, (name, args, kwargs))
+
+
+ def __init__(self, value=(), name=None, parent=None, two=False,
+ from_kall=True):
+ self.name = name
+ self.parent = parent
+ self.from_kall = from_kall
+
+
+ def __eq__(self, other):
+ if other is ANY:
+ return True
+ try:
+ len_other = len(other)
+ except TypeError:
+ return False
+
+ self_name = ''
+ if len(self) == 2:
+ self_args, self_kwargs = self
+ else:
+ self_name, self_args, self_kwargs = self
+
+ other_name = ''
+ if len_other == 0:
+ other_args, other_kwargs = (), {}
+ elif len_other == 3:
+ other_name, other_args, other_kwargs = other
+ elif len_other == 1:
+ value, = other
+ if isinstance(value, tuple):
+ other_args = value
+ other_kwargs = {}
+ elif isinstance(value, basestring):
+ other_name = value
+ other_args, other_kwargs = (), {}
+ else:
+ other_args = ()
+ other_kwargs = value
+ else:
+ # len 2
+ # could be (name, args) or (name, kwargs) or (args, kwargs)
+ first, second = other
+ if isinstance(first, basestring):
+ other_name = first
+ if isinstance(second, tuple):
+ other_args, other_kwargs = second, {}
+ else:
+ other_args, other_kwargs = (), second
+ else:
+ other_args, other_kwargs = first, second
+
+ if self_name and other_name != self_name:
+ return False
+
+ # this order is important for ANY to work!
+ return (other_args, other_kwargs) == (self_args, self_kwargs)
+
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
+
+ def __call__(self, *args, **kwargs):
+ if self.name is None:
+ return _Call(('', args, kwargs), name='()')
+
+ name = self.name + '()'
+ return _Call((self.name, args, kwargs), name=name, parent=self)
+
+
+ def __getattr__(self, attr):
+ if self.name is None:
+ return _Call(name=attr, from_kall=False)
+ name = '%s.%s' % (self.name, attr)
+ return _Call(name=name, parent=self, from_kall=False)
+
+
+ def __repr__(self):
+ if not self.from_kall:
+ name = self.name or 'call'
+ if name.startswith('()'):
+ name = 'call%s' % name
+ return name
+
+ if len(self) == 2:
+ name = 'call'
+ args, kwargs = self
+ else:
+ name, args, kwargs = self
+ if not name:
+ name = 'call'
+ elif not name.startswith('()'):
+ name = 'call.%s' % name
+ else:
+ name = 'call%s' % name
+ return _format_call_signature(name, args, kwargs)
+
+
+ def call_list(self):
+ """For a call object that represents multiple calls, `call_list`
+ returns a list of all the intermediate calls as well as the
+ final call."""
+ vals = []
+ thing = self
+ while thing is not None:
+ if thing.from_kall:
+ vals.append(thing)
+ thing = thing.parent
+ return _CallList(reversed(vals))
+
+
+call = _Call(from_kall=False)
+
+
+
+def create_autospec(spec, spec_set=False, instance=False, _parent=None,
+ _name=None, **kwargs):
+ """Create a mock object using another object as a spec. Attributes on the
+ mock will use the corresponding attribute on the `spec` object as their
+ spec.
+
+ Functions or methods being mocked will have their arguments checked
+ to check that they are called with the correct signature.
+
+ If `spec_set` is True then attempting to set attributes that don't exist
+ on the spec object will raise an `AttributeError`.
+
+ If a class is used as a spec then the return value of the mock (the
+ instance of the class) will have the same spec. You can use a class as the
+ spec for an instance object by passing `instance=True`. The returned mock
+ will only be callable if instances of the mock are callable.
+
+ `create_autospec` also takes arbitrary keyword arguments that are passed to
+ the constructor of the created mock."""
+ if _is_list(spec):
+ # can't pass a list instance to the mock constructor as it will be
+ # interpreted as a list of strings
+ spec = type(spec)
+
+ is_type = isinstance(spec, ClassTypes)
+
+ _kwargs = {'spec': spec}
+ if spec_set:
+ _kwargs = {'spec_set': spec}
+ elif spec is None:
+ # None we mock with a normal mock without a spec
+ _kwargs = {}
+
+ _kwargs.update(kwargs)
+
+ Klass = MagicMock
+ if type(spec) in DescriptorTypes:
+ # descriptors don't have a spec
+ # because we don't know what type they return
+ _kwargs = {}
+ elif not _callable(spec):
+ Klass = NonCallableMagicMock
+ elif is_type and instance and not _instance_callable(spec):
+ Klass = NonCallableMagicMock
+
+ _new_name = _name
+ if _parent is None:
+ # for a top level object no _new_name should be set
+ _new_name = ''
+
+ mock = Klass(parent=_parent, _new_parent=_parent, _new_name=_new_name,
+ name=_name, **_kwargs)
+
+ if isinstance(spec, FunctionTypes):
+ # should only happen at the top level because we don't
+ # recurse for functions
+ mock = _set_signature(mock, spec)
+ else:
+ _check_signature(spec, mock, is_type, instance)
+
+ if _parent is not None and not instance:
+ _parent._mock_children[_name] = mock
+
+ if is_type and not instance and 'return_value' not in kwargs:
+ mock.return_value = create_autospec(spec, spec_set, instance=True,
+ _name='()', _parent=mock)
+
+ for entry in dir(spec):
+ if _is_magic(entry):
+ # MagicMock already does the useful magic methods for us
+ continue
+
+ if isinstance(spec, FunctionTypes) and entry in FunctionAttributes:
+ # allow a mock to actually be a function
+ continue
+
+ # XXXX do we need a better way of getting attributes without
+ # triggering code execution (?) Probably not - we need the actual
+ # object to mock it so we would rather trigger a property than mock
+ # the property descriptor. Likewise we want to mock out dynamically
+ # provided attributes.
+ # XXXX what about attributes that raise exceptions other than
+ # AttributeError on being fetched?
+ # we could be resilient against it, or catch and propagate the
+ # exception when the attribute is fetched from the mock
+ try:
+ original = getattr(spec, entry)
+ except AttributeError:
+ continue
+
+ kwargs = {'spec': original}
+ if spec_set:
+ kwargs = {'spec_set': original}
+
+ if not isinstance(original, FunctionTypes):
+ new = _SpecState(original, spec_set, mock, entry, instance)
+ mock._mock_children[entry] = new
+ else:
+ parent = mock
+ if isinstance(spec, FunctionTypes):
+ parent = mock.mock
+
+ new = MagicMock(parent=parent, name=entry, _new_name=entry,
+ _new_parent=parent, **kwargs)
+ mock._mock_children[entry] = new
+ skipfirst = _must_skip(spec, entry, is_type)
+ _check_signature(original, new, skipfirst=skipfirst)
+
+ # so functions created with _set_signature become instance attributes,
+ # *plus* their underlying mock exists in _mock_children of the parent
+ # mock. Adding to _mock_children may be unnecessary where we are also
+ # setting as an instance attribute?
+ if isinstance(new, FunctionTypes):
+ setattr(mock, entry, new)
+
+ return mock
+
+
+def _must_skip(spec, entry, is_type):
+ if not isinstance(spec, ClassTypes):
+ if entry in getattr(spec, '__dict__', {}):
+ # instance attribute - shouldn't skip
+ return False
+ spec = spec.__class__
+ if not hasattr(spec, '__mro__'):
+ # old style class: can't have descriptors anyway
+ return is_type
+
+ for klass in spec.__mro__:
+ result = klass.__dict__.get(entry, DEFAULT)
+ if result is DEFAULT:
+ continue
+ if isinstance(result, (staticmethod, classmethod)):
+ return False
+ return is_type
+
+ # shouldn't get here unless function is a dynamically provided attribute
+ # XXXX untested behaviour
+ return is_type
+
+
+def _get_class(obj):
+ try:
+ return obj.__class__
+ except AttributeError:
+ # in Python 2, _sre.SRE_Pattern objects have no __class__
+ return type(obj)
+
+
+class _SpecState(object):
+
+ def __init__(self, spec, spec_set=False, parent=None,
+ name=None, ids=None, instance=False):
+ self.spec = spec
+ self.ids = ids
+ self.spec_set = spec_set
+ self.parent = parent
+ self.instance = instance
+ self.name = name
+
+
+FunctionTypes = (
+ # python function
+ type(create_autospec),
+ # instance method
+ type(ANY.__eq__),
+ # unbound method
+ type(_ANY.__eq__),
+)
+
+FunctionAttributes = set([
+ 'func_closure',
+ 'func_code',
+ 'func_defaults',
+ 'func_dict',
+ 'func_doc',
+ 'func_globals',
+ 'func_name',
+])
+
+
+file_spec = None
+
+
+def mock_open(mock=None, read_data=''):
+ """
+ A helper function to create a mock to replace the use of `open`. It works
+ for `open` called directly or used as a context manager.
+
+ The `mock` argument is the mock object to configure. If `None` (the
+ default) then a `MagicMock` will be created for you, with the API limited
+ to methods or attributes available on standard file handles.
+
+ `read_data` is a string for the `read` method of the file handle to return.
+ This is an empty string by default.
+ """
+ global file_spec
+ if file_spec is None:
+ # set on first use
+ if inPy3k:
+ import _io
+ file_spec = list(set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))))
+ else:
+ file_spec = file
+
+ if mock is None:
+ mock = MagicMock(name='open', spec=open)
+
+ handle = MagicMock(spec=file_spec)
+ handle.write.return_value = None
+ handle.__enter__.return_value = handle
+ handle.read.return_value = read_data
+
+ mock.return_value = handle
+ return mock
+
+
+class PropertyMock(Mock):
+ """
+ A mock intended to be used as a property, or other descriptor, on a class.
+ `PropertyMock` provides `__get__` and `__set__` methods so you can specify
+ a return value when it is fetched.
+
+ Fetching a `PropertyMock` instance from an object calls the mock, with
+ no args. Setting it calls the mock with the value being set.
+ """
+ def _get_child_mock(self, **kwargs):
+ return MagicMock(**kwargs)
+
+ def __get__(self, obj, obj_type):
+ return self()
+ def __set__(self, obj, val):
+ self(val)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/app/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/app/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/app/test_eventloop.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/app/test_eventloop.py
new file mode 100644
index 0000000..992e43b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/app/test_eventloop.py
@@ -0,0 +1,61 @@
+"""
+Tests for the default application event loop.
+"""
+from threading import Event, Thread
+
+from pyglet.app import event_loop
+from tests import mock
+
+
+def check_running():
+ assert event_loop.is_running
+
+
+def test_start_stop(performance):
+ event_loop.clock.schedule_once(lambda dt: check_running(), .1)
+ event_loop.clock.schedule_once(lambda dt: event_loop.exit(), .2)
+ with performance.timer(1.):
+ event_loop.run()
+ assert not event_loop.is_running
+
+
+def test_multiple_start_stop(performance):
+ with performance.timer(30.):
+ for _ in range(100):
+ test_start_stop(performance)
+
+
+def test_events():
+ enter_mock = mock.MagicMock()
+ exit_mock = mock.MagicMock()
+ event_loop.push_handlers(on_enter=enter_mock,
+ on_exit=exit_mock)
+ try:
+ event_loop.clock.schedule_once(lambda dt: event_loop.exit(), .1)
+ event_loop.run()
+ enter_mock.assert_called_once_with()
+ exit_mock.assert_called_once_with()
+ finally:
+ event_loop.pop_handlers()
+
+
+def test_on_window_close():
+ event_loop.clock.schedule_once(lambda dt: event_loop.on_window_close(None), .1)
+ event_loop.run()
+ assert not event_loop.is_running
+
+
+def test_sleep(performance):
+ def _sleep():
+ event_loop.sleep(100.)
+ _sleep.returned.set()
+ _sleep.returned = Event()
+ thread = Thread(target=_sleep)
+
+ event_loop.clock.schedule_once(lambda dt: thread.start(), .1)
+ event_loop.clock.schedule_once(lambda dt: event_loop.exit(), .2)
+ with performance.timer(1.):
+ event_loop.run()
+ assert not event_loop.is_running
+ assert _sleep.returned.wait(1.)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/font/test_fontconfig.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/font/test_fontconfig.py
new file mode 100644
index 0000000..1f25ef6
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/font/test_fontconfig.py
@@ -0,0 +1,13 @@
+"""
+Tests for font integration in all platforms.
+"""
+
+from pyglet import font
+
+def test_have_font():
+ """
+ Test functionality to check for availability of fonts.
+ """
+ assert font.have_font('Arial')
+ assert not font.have_font('missing-font-name')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/font/test_freetype_face.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/font/test_freetype_face.py
new file mode 100644
index 0000000..eb6f58c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/font/test_freetype_face.py
@@ -0,0 +1,122 @@
+"""Tests for loading and accessing FreeType font faces."""
+import pytest
+
+from tests.annotations import Platform, require_platform
+
+try:
+ from pyglet.font.freetype import FreeTypeFace, FreeTypeMemoryFace
+ from pyglet.font.fontconfig import get_fontconfig
+except ImportError:
+ FreeTypeFace = None
+ FreeTypeMemoryFace = None
+ get_fontconfig = None
+
+
+@require_platform(Platform.LINUX)
+@pytest.mark.parametrize('font_file_name,font_name,bold,italic', [
+ ('action_man.ttf', 'Action Man', False, False),
+ ('action_man_bold.ttf', 'Action Man', True, False),
+ ('action_man_bold_italic.ttf', 'Action Man', True, True),
+ ('action_man_italic.ttf', 'Action Man', False, True),
+ ])
+def test_face_from_file(test_data, font_file_name, font_name, bold, italic):
+ """Test loading a font face directly from file."""
+ face = FreeTypeFace.from_file(test_data.get_file('fonts', font_file_name))
+
+ assert face.name == font_name
+ assert face.family_name == font_name
+ assert face.bold == bold
+ assert face.italic == italic
+
+ del face
+
+
+@require_platform(Platform.LINUX)
+@pytest.mark.parametrize('font_name,bold,italic', [
+ ('Arial', False, False),
+ ('Arial', True, False),
+ ('Arial', False, True),
+ ('Arial', True, True),
+ ])
+def test_face_from_fontconfig(font_name, bold, italic):
+ """Test loading a font face from the system using font config."""
+ match = get_fontconfig().find_font(font_name, 16, bold, italic)
+ assert match is not None
+
+ face = FreeTypeFace.from_fontconfig(match)
+
+ assert face.name == font_name
+ assert face.family_name == font_name
+ assert face.bold == bold
+ assert face.italic == italic
+
+ del face
+
+
+@require_platform(Platform.LINUX)
+@pytest.mark.parametrize('font_file_name,font_name,bold,italic', [
+ ('action_man.ttf', 'Action Man', False, False),
+ ('action_man_bold.ttf', 'Action Man', True, False),
+ ('action_man_bold_italic.ttf', 'Action Man', True, True),
+ ('action_man_italic.ttf', 'Action Man', False, True),
+ ])
+def test_memory_face(test_data, font_file_name, font_name, bold, italic):
+ """Test loading a font into memory using FreeTypeMemoryFont."""
+ with open(test_data.get_file('fonts', font_file_name), 'rb') as font_file:
+ font_data = font_file.read()
+ font = FreeTypeMemoryFace(font_data)
+
+ assert font.name == font_name
+ assert font.bold == bold
+ assert font.italic == italic
+ assert font.ft_face is not None
+
+ del font
+
+
+@require_platform(Platform.LINUX)
+@pytest.mark.parametrize('font_file_name,size,dpi,ascent,descent', [
+ ('action_man.ttf', 16, 96, 15, -4),
+ ('action_man.ttf', 10, 96, 9, -3),
+ ('action_man.ttf', 16, 72, 11, -3),
+ ('courR12-ISO8859-1.pcf', 16, 96, 15, -4),
+ ])
+def test_face_metrics(test_data, font_file_name, size, dpi, ascent, descent):
+ """Test a face from file and check the metrics."""
+ face = FreeTypeFace.from_file(test_data.get_file('fonts', font_file_name))
+ metrics = face.get_font_metrics(size, dpi)
+
+ assert metrics.ascent == ascent
+ assert metrics.descent == descent
+
+
+@require_platform(Platform.LINUX)
+@pytest.mark.parametrize('font_file_name,character,index', [
+ ('action_man.ttf', 'a', 65),
+ ('action_man.ttf', 'A', 33),
+ ('action_man.ttf', '1', 17),
+ ('action_man.ttf', '#', 3),
+ ('action_man.ttf', 'b', 66),
+ ])
+def test_character_index(test_data, font_file_name, character, index):
+ """Test getting the glyph index for a character."""
+ face = FreeTypeFace.from_file(test_data.get_file('fonts', font_file_name))
+ assert face.get_character_index(character) == index
+
+
+@require_platform(Platform.LINUX)
+@pytest.mark.parametrize('font_file_name,glyph_index', [
+ ('action_man.ttf', 65),
+ ('action_man.ttf', 33),
+ ('action_man.ttf', 17),
+ ('action_man.ttf', 3),
+ ('action_man.ttf', 66),
+ ])
+def test_get_glyph_slot(test_data, font_file_name, glyph_index):
+ """Test getting a glyph slot from the face."""
+ face = FreeTypeFace.from_file(test_data.get_file('fonts', font_file_name))
+ face.set_char_size(size=16, dpi=92)
+ glyph = face.get_glyph_slot(glyph_index)
+
+ assert glyph is not None
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/graphics_common.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/graphics_common.py
new file mode 100644
index 0000000..1d6b24b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/graphics_common.py
@@ -0,0 +1,221 @@
+#!/usr/bin/env python
+
+from __future__ import division
+from builtins import zip
+from builtins import range
+from builtins import object
+from abc import abstractmethod
+import random
+from collections import deque
+
+from pyglet.gl import *
+
+
+# http://stackoverflow.com/a/312464/931303
+def chunks(l, n):
+ """ Yield successive n-sized chunks from l.
+ """
+ for i in range(0, len(l), n):
+ yield l[i:i+n]
+
+
+def get_feedback(func):
+ feedback_buffer = (GLfloat * 8096)()
+ # Project in clip coords
+ glMatrixMode(GL_PROJECTION)
+ glLoadIdentity()
+ glOrtho(0, 1, 0, 1, -1, 1)
+ glMatrixMode(GL_MODELVIEW)
+ glLoadIdentity()
+
+ glFeedbackBuffer(len(feedback_buffer), GL_4D_COLOR_TEXTURE, feedback_buffer)
+ glRenderMode(GL_FEEDBACK)
+ func()
+ size = glRenderMode(GL_RENDER)
+ buffer = feedback_buffer[:size]
+ vertices = []
+ colors = []
+ tex_coords = []
+ while buffer:
+ token = int(buffer.pop(0))
+ assert token == GL_POLYGON_TOKEN
+ n = int(buffer.pop(0))
+ for i in range(n):
+ vertices.extend(buffer[:4])
+ colors.extend(buffer[4:8])
+ tex_coords.extend(buffer[8:12])
+ del buffer[:12]
+
+ return vertices, colors, tex_coords
+
+
+class GraphicsGenericTestCase(object):
+ """
+ A generic test for asserting vertices positions
+ using openGL Feedback Buffer.
+ This is not really a testcase because it cannot be
+ tested alone. Use it by subclassing it
+ with unittest.TestCase.
+
+ It has one abstract method that the subclass must
+ overwrite.
+ """
+
+ def setUp(self):
+ # has to be a multiple of 3 because of the Feedback buffer.
+ # has to be a multiple of 2 because of indexed data subclass.
+ self.n_vertices = 36
+ self.v3f_data = [v/float(self.n_vertices*3) for v in range(self.n_vertices * 3)]
+ self.v2f_data = [v/float(self.n_vertices*2) for v in range(self.n_vertices * 2)]
+ self.c4f_data = [v/float(self.n_vertices*4) for v in range(self.n_vertices * 4)]
+ self.c3f_data = [v/float(self.n_vertices*3) for v in range(self.n_vertices * 3)]
+ self.t4f_data = [v/float(self.n_vertices*4) for v in range(self.n_vertices * 4)]
+ self.t3f_data = [v/float(self.n_vertices*3) for v in range(self.n_vertices * 3)]
+ self.t2f_data = [v/float(self.n_vertices*2) for v in range(self.n_vertices * 2)]
+
+ @staticmethod
+ def _are_equal(expected, result):
+ """
+ Compares that two lists are equal within an error.
+ Returns True if they are equal and False otherwise.
+ """
+ for e, r in zip(expected, result):
+ if abs(e - r) > 0.01:
+ return False
+ return True
+
+ def _are_equal_within_rotation(self, expected, result_chunk):
+ """
+ Checks that two lists of expected and result are equal
+ within a rotation and a small error.
+ Returns true if they are equal and False otherwise.
+ """
+ rotation_deque = deque(result_chunk)
+ for rotation in range(3): # triangles require at most 3 rotations
+ rotation_deque.rotate(4) # because it has 4 components.
+ result = list(rotation_deque)[:2] # we only test x and y
+
+ if self._are_equal(expected, result):
+ return True
+
+ return False
+
+ def check(self, expected, result, dimensions):
+ """
+ Asserts that the result is equivalent to the expected result.
+ """
+ if len(expected) != len(result) * dimensions / 4:
+ self.fail('Incorrect number of vertices in feedback array: '
+ 'expected: %d, obtained: %d' % (len(expected), len(result) * dimensions / 4))
+
+ # there are two factors here:
+ # 1. there are several triangles and their out-order can be different from in-order.
+ # 2. in each triangle, the out-order of the vertices can be a rotation from its in-order.
+
+ # to tackle 1:
+ # we divide the result and the expected in chunks, each representing one triangle,
+ # and we compare each triangle individually.
+
+ # to tackle 2:
+ # within each triangle, we cycle the vertices list and check if any rotation matches the expected.
+
+ # for each triangle in the expected
+ for e_chunk in chunks(expected, dimensions):
+ expected_chunk = e_chunk[0:2] # we only test x and y
+
+ # for each triangle in the result (tackling 1.)
+ # notice that result always has 4 dimensions: (x, y, z, z-buffer).
+ was_found = False
+ for result_chunk in chunks(result, 3*4):
+ # here we tackle 2.
+ if self._are_equal_within_rotation(expected_chunk, result_chunk):
+ was_found = True
+ break
+ # we assert that every triangle must be matched.
+ self.assertTrue(was_found)
+
+ @abstractmethod
+ def get_feedback(self, data):
+ pass
+
+ def get_data(self, data, _):
+ """
+ Used for pos-processing of the expected result.
+ See subclass.
+ """
+ return data
+
+ def generic_test(self, v_fmt, v_data,
+ c_fmt=None, c_data=None,
+ t_fmt=None, t_data=None):
+ data = [(v_fmt, v_data)]
+ n_v = int(v_fmt[1])
+ if c_fmt:
+ data.append((c_fmt, c_data))
+ n_c = int(c_fmt[1])
+ if t_fmt:
+ data.append((t_fmt, t_data))
+ n_t = int(t_fmt[1])
+ vertices, colors, tex_coords = self.get_feedback(data)
+
+ self.check(self.get_data(v_data, n_v), vertices, n_v)
+ if c_fmt:
+ self.check(self.get_data(c_data, n_c), colors, n_c)
+ if t_fmt:
+ self.check(self.get_data(t_data, n_t), tex_coords, n_t)
+
+ def test_v2f(self):
+ self.generic_test('v2f', self.v2f_data)
+
+ def test_v3f(self):
+ self.generic_test('v3f', self.v3f_data)
+
+ def test_v2f_c3f(self):
+ self.generic_test('v2f', self.v2f_data, 'c3f', self.c3f_data)
+
+ def test_v2f_c4f(self):
+ self.generic_test('v2f', self.v2f_data, 'c4f', self.c4f_data)
+
+ def test_v3f_c3f(self):
+ self.generic_test('v3f', self.v3f_data, 'c3f', self.c3f_data)
+
+ def test_v3f_c4f(self):
+ self.generic_test('v3f', self.v3f_data, 'c4f', self.c4f_data)
+
+ def test_v2f_t2f(self):
+ self.generic_test('v2f', self.v2f_data, None, None, 't2f', self.t2f_data)
+
+ def test_v3f_c3f_t2f(self):
+ self.generic_test('v3f', self.v3f_data, 'c3f', self.c3f_data, 't2f', self.t2f_data)
+
+ def test_v3f_c3f_t3f(self):
+ self.generic_test('v3f', self.v3f_data, 'c3f', self.c3f_data, 't3f', self.t3f_data)
+
+ def test_v3f_c4f_t4f(self):
+ self.generic_test('v3f', self.v3f_data, 'c4f', self.c4f_data, 't4f', self.t4f_data)
+
+
+class GraphicsIndexedGenericTestCase(GraphicsGenericTestCase):
+ """
+ A generic test for asserting vertices positions
+ using openGL Feedback Buffer and indexed data.
+
+ It has one abstract method that the subclass must
+ overwrite.
+ """
+ def setUp(self):
+ GraphicsGenericTestCase.setUp(self)
+
+ # we use half of the data so we repeat vertices.
+ self.index_data = list(range(self.n_vertices//2)) * 2
+ random.seed(1)
+ random.shuffle(self.index_data)
+
+ def get_data(self, data, dimensions):
+ """
+ Reorders data according to the indexing.
+ """
+ ordered = []
+ for i in self.index_data:
+ ordered.extend(data[i * dimensions:(i+1)*dimensions])
+ return ordered
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/test_allocation.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/test_allocation.py
new file mode 100644
index 0000000..e0f1644
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/test_allocation.py
@@ -0,0 +1,427 @@
+from builtins import zip
+from builtins import next
+from builtins import range
+from builtins import object
+#!/usr/bin/python
+
+import random
+import unittest
+
+from pyglet.graphics import allocation
+
+class Region(object):
+ def __init__(self, start, size):
+ self.start = start
+ self.size = size
+
+ def __repr__(self):
+ return 'Region(%r, %r)' % (self.start, self.size)
+
+class RegionAllocator(object):
+ def __init__(self, capacity):
+ self.allocator = allocation.Allocator(capacity)
+ self.regions = []
+
+ def check_region(self, region):
+ region_end = region.start + region.size
+ for other in self.regions:
+ if region is other:
+ continue
+
+ other_end = other.start + other.size
+ if (other.start < region.start and other_end > region.start) or \
+ (other.start < region_end and other_end > region_end):
+ fixture.fail('%r overlaps with %r' % (
+ region, other))
+
+ def check_coverage(self):
+ starts, sizes = self.allocator.get_allocated_regions()
+
+ if len(starts) != len(sizes):
+ fixture.fail('Length of starts (%d) does not match sizes (%d)' % \
+ (len(starts), len(sizes)))
+
+ if not starts and not self.regions:
+ return
+
+ self.regions.sort(key=lambda r: r.start)
+ regions = iter(self.regions)
+
+ blocks = iter(zip(starts, sizes))
+ block_start, block_size = next(blocks)
+ block_used = False
+ try:
+ while True:
+ region = next(regions)
+ block_used = True
+ if region.start < block_start:
+ fixture.fail('Start of %r was not covered at %d' % (
+ region, block_start))
+ elif region.start > block_start:
+ fixture.fail('Uncovered block from %d to %r' % (
+ block_start, region))
+ block_start += region.size
+ block_size -= region.size
+ if block_size < 0:
+ fixture.fail('%r extended past end of block by %d' % \
+ (region, -block_size))
+ elif block_size == 0:
+ block_start, block_size = next(blocks)
+ block_used = False
+ except StopIteration:
+ pass
+
+ if not block_used:
+ fixture.fail('Uncovered block(s) from %d' % block_start)
+
+ try:
+ block_start, block_size = next(blocks)
+ fixture.fail('Uncovered block(s) from %d' % block_start)
+ except StopIteration:
+ pass
+
+ try:
+ region = next(regions)
+ fixture.fail('%r was not covered')
+ except StopIteration:
+ pass
+
+ def check_redundancy(self):
+ # Ensure there are no adjacent blocks (they should have been merged)
+ starts, sizes = self.allocator.get_allocated_regions()
+
+ last = -1
+ for start, size in zip(starts, sizes):
+ if start < last:
+ fixture.fail('Block at %d is out of order' % start)
+ if start == last:
+ fixture.fail('Block at %d is redundant' % start)
+ last = start + size
+
+ def alloc(self, size):
+ start = self.allocator.alloc(size)
+ region = Region(start, size)
+ self.check_region(region)
+ self.regions.append(region)
+ self.check_coverage()
+ self.check_redundancy()
+ return region
+
+ def dealloc(self, region):
+ assert region in self.regions
+ self.allocator.dealloc(region.start, region.size)
+ self.regions.remove(region)
+ self.check_coverage()
+ self.check_redundancy()
+
+ def realloc(self, region, size):
+ assert region in self.regions
+ region.start = self.allocator.realloc(region.start, region.size, size)
+ region.size = size
+ self.check_region(region)
+ self.check_coverage()
+ self.check_redundancy()
+
+ def force_alloc(self, size):
+ try:
+ return self.alloc(size)
+ except allocation.AllocatorMemoryException as e:
+ self.allocator.set_capacity(e.requested_capacity)
+ return self.alloc(size)
+
+ def force_realloc(self, region, size):
+ try:
+ self.realloc(region, size)
+ except allocation.AllocatorMemoryException as e:
+ self.allocator.set_capacity(e.requested_capacity)
+ self.realloc(region, size)
+
+ def get_free_size(self):
+ return self.allocator.get_free_size()
+
+ capacity = property(lambda self: self.allocator.capacity)
+
+class AllocationTestCase(unittest.TestCase):
+ def setUp(self):
+ global fixture
+ fixture = self
+
+ def test_alloc1(self):
+ capacity = 10
+ allocator = RegionAllocator(capacity)
+ for i in range(capacity):
+ allocator.alloc(1)
+
+ def test_alloc2(self):
+ capacity = 10
+ allocator = RegionAllocator(capacity)
+ for i in range(capacity//2):
+ allocator.alloc(2)
+
+ def test_alloc3(self):
+ capacity = 10
+ allocator = RegionAllocator(capacity)
+ for i in range(capacity//3):
+ allocator.alloc(3)
+
+ def test_alloc_mix1_2(self):
+ allocs = [1, 2] * 5
+ capacity = sum(allocs)
+ allocator = RegionAllocator(capacity)
+ for alloc in allocs:
+ allocator.alloc(alloc)
+
+ def test_alloc_mix5_3_7(self):
+ allocs = [5, 3, 7] * 5
+ capacity = sum(allocs)
+ allocator = RegionAllocator(capacity)
+ for alloc in allocs:
+ allocator.alloc(alloc)
+
+ def test_dealloc_1_order_all(self):
+ capacity = 10
+ allocator = RegionAllocator(capacity)
+ regions = []
+ for i in range(capacity):
+ regions.append(allocator.alloc(1))
+ for region in regions:
+ allocator.dealloc(region)
+ self.assertTrue(allocator.get_free_size() == allocator.capacity)
+
+ def test_dealloc_1_order(self):
+ capacity = 15
+ allocator = RegionAllocator(capacity)
+ regions = []
+ for i in range(10):
+ regions.append(allocator.alloc(1))
+ for region in regions:
+ allocator.dealloc(region)
+
+ def test_dealloc_1_reverse_all(self):
+ capacity = 10
+ allocator = RegionAllocator(capacity)
+ regions = []
+ for i in range(capacity):
+ regions.append(allocator.alloc(1))
+ for region in regions[::-1]:
+ allocator.dealloc(region)
+ self.assertTrue(allocator.get_free_size() == allocator.capacity)
+
+ def test_dealloc_1_reverse(self):
+ capacity = 15
+ allocator = RegionAllocator(capacity)
+ regions = []
+ for i in range(10):
+ regions.append(allocator.alloc(1))
+ for region in regions[::-1]:
+ allocator.dealloc(region)
+
+ def test_dealloc_mix1_2_order(self):
+ allocs = [1, 2] * 5
+ capacity = sum(allocs)
+ allocator = RegionAllocator(capacity)
+ regions = []
+ for alloc in allocs:
+ regions.append(allocator.alloc(alloc))
+ for region in regions:
+ allocator.dealloc(region)
+ self.assertTrue(allocator.get_free_size() == allocator.capacity)
+
+ def test_dealloc_mix5_3_7_order(self):
+ allocs = [5, 3, 7] * 5
+ capacity = sum(allocs)
+ allocator = RegionAllocator(capacity)
+ regions = []
+ for alloc in allocs:
+ regions.append(allocator.alloc(alloc))
+ for region in regions:
+ allocator.dealloc(region)
+ self.assertTrue(allocator.get_free_size() == allocator.capacity)
+
+ def test_dealloc_1_outoforder(self):
+ random.seed(1)
+ capacity = 15
+ allocator = RegionAllocator(capacity)
+ regions = []
+ for i in range(capacity):
+ regions.append(allocator.alloc(1))
+ random.shuffle(regions)
+ for region in regions:
+ allocator.dealloc(region)
+ self.assertTrue(allocator.get_free_size() == allocator.capacity)
+
+ def test_dealloc_mix1_2_outoforder(self):
+ random.seed(1)
+ allocs = [1, 2] * 5
+ capacity = sum(allocs)
+ allocator = RegionAllocator(capacity)
+ regions = []
+ for alloc in allocs:
+ regions.append(allocator.alloc(alloc))
+ random.shuffle(regions)
+ for region in regions:
+ allocator.dealloc(region)
+ self.assertTrue(allocator.get_free_size() == allocator.capacity)
+
+ def test_dealloc_mix5_3_7_outoforder(self):
+ random.seed(1)
+ allocs = [5, 3, 7] * 5
+ capacity = sum(allocs)
+ allocator = RegionAllocator(capacity)
+ regions = []
+ for alloc in allocs:
+ regions.append(allocator.alloc(alloc))
+ random.shuffle(regions)
+ for region in regions:
+ allocator.dealloc(region)
+ self.assertTrue(allocator.get_free_size() == allocator.capacity)
+
+ def mixed_alloc_dealloc_list(self, choices, count=10, seed=1):
+ random.seed(seed)
+ allocs = []
+ live = []
+ j = 0
+ for i in range(count):
+ if live:
+ if random.random() < .5:
+ allocs.append(random.choice(choices))
+ live.append(j)
+ j += 1
+ else:
+ k = random.choice(live)
+ live.remove(k)
+ allocs.append(-k)
+ else:
+ allocs.append(random.choice(choices))
+ live.append(j)
+ j += 1
+ for j in live:
+ allocs.append(-j)
+ return allocs
+
+ def test_mix_alloc_dealloc1(self):
+ allocs = self.mixed_alloc_dealloc_list([1])
+
+ capacity = sum([a for a in allocs if a > 0])
+ allocator= RegionAllocator(capacity)
+ regions = []
+ for alloc in allocs:
+ if alloc > 0:
+ regions.append(allocator.alloc(alloc))
+ else:
+ region = regions[abs(alloc)]
+ allocator.dealloc(region)
+ self.assertTrue(allocator.get_free_size() == allocator.capacity)
+
+ def test_mix_alloc_dealloc5_3_7(self):
+ allocs = self.mixed_alloc_dealloc_list([5, 3, 7], count=50)
+
+ capacity = sum([a for a in allocs if a > 0])
+ allocator= RegionAllocator(capacity)
+ regions = []
+ for alloc in allocs:
+ if alloc > 0:
+ regions.append(allocator.alloc(alloc))
+ else:
+ region = regions[abs(alloc)]
+ allocator.dealloc(region)
+ self.assertTrue(allocator.get_free_size() == allocator.capacity)
+
+ def test_realloc1_2(self):
+ allocator = RegionAllocator(30)
+ regions = []
+ for i in range(10):
+ regions.append(allocator.alloc(1))
+ for region in regions:
+ allocator.realloc(region, 2)
+ for region in regions:
+ allocator.dealloc(region)
+
+ def test_realloc2_1(self):
+ allocator = RegionAllocator(20)
+ regions = []
+ for i in range(10):
+ regions.append(allocator.alloc(2))
+ for region in regions:
+ allocator.realloc(region, 1)
+ for region in regions:
+ allocator.dealloc(region)
+ self.assertTrue(allocator.get_free_size() == allocator.capacity)
+
+ def test_realloc_2_1_2(self):
+ allocator = RegionAllocator(30)
+ regions = []
+ for i in range(10):
+ regions.append(allocator.alloc(2))
+ for region in regions:
+ allocator.realloc(region, 1)
+ for region in regions:
+ allocator.realloc(region, 2)
+ for region in regions:
+ allocator.dealloc(region)
+ self.assertTrue(allocator.get_free_size() == allocator.capacity)
+
+ def test_realloc_3_1_5_4_6(self):
+ allocator = RegionAllocator(1000)
+ regions = []
+ for i in range(10):
+ regions.append(allocator.alloc(3))
+ for region in regions:
+ allocator.realloc(region, 1)
+ for region in regions:
+ allocator.realloc(region, 5)
+ for region in regions:
+ allocator.realloc(region, 4)
+ for region in regions:
+ allocator.realloc(region, 6)
+ for region in regions:
+ allocator.dealloc(region)
+ self.assertTrue(allocator.get_free_size() == allocator.capacity)
+
+ def test_realloc_3_1_5_4_6_sequential(self):
+ allocator = RegionAllocator(1000)
+ regions = []
+ for i in range(10):
+ regions.append(allocator.alloc(3))
+ for region in regions:
+ allocator.realloc(region, 1)
+ allocator.realloc(region, 5)
+ allocator.realloc(region, 4)
+ allocator.realloc(region, 6)
+ for region in regions:
+ allocator.dealloc(region)
+ self.assertTrue(allocator.get_free_size() == allocator.capacity)
+
+ def test_resize1(self):
+ allocator = RegionAllocator(1)
+ regions = []
+ for i in range(10):
+ regions.append(allocator.force_alloc(3))
+ for region in regions:
+ allocator.dealloc(region)
+ self.assertTrue(allocator.get_free_size() == allocator.capacity)
+
+ def test_mix_resize(self):
+ # Try a bunch of stuff. There is not much method to this madness.
+ allocator = RegionAllocator(1)
+ regions = []
+ for i in range(10):
+ regions.append(allocator.force_alloc(3))
+ for region in regions[:5]:
+ #import pdb; pdb.set_trace()
+ allocator.force_realloc(region, 8)
+ for i in range(10):
+ regions.append(allocator.force_alloc(i + 1))
+ for region in regions[5:15]:
+ allocator.force_realloc(region, 5)
+ for region in regions[3:18:2]:
+ allocator.dealloc(region)
+ regions.remove(region)
+ for i in range(5):
+ regions.append(allocator.force_alloc(3))
+ for region in regions[-10:]:
+ allocator.force_realloc(region, 6)
+ for region in regions:
+ allocator.dealloc(region)
+ self.assertTrue(allocator.get_free_size() == allocator.capacity)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/test_immediate_drawing.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/test_immediate_drawing.py
new file mode 100644
index 0000000..ce23809
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/test_immediate_drawing.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+"""Tests immediate drawing.
+"""
+from __future__ import absolute_import
+import unittest
+
+import pyglet
+
+from tests.annotations import Platform, skip_platform
+from .graphics_common import GraphicsGenericTestCase, get_feedback, GL_TRIANGLES
+
+
+@skip_platform(Platform.OSX) # TODO: Check whether OpenGL < 3.0 or compatibility profile is enabled
+class ImmediateDrawingTestCase(GraphicsGenericTestCase, unittest.TestCase):
+ def get_feedback(self, data):
+ return get_feedback(lambda: pyglet.graphics.draw(self.n_vertices, GL_TRIANGLES, *data))
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/test_immediate_drawing_indexed_data.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/test_immediate_drawing_indexed_data.py
new file mode 100644
index 0000000..13e25ce
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/test_immediate_drawing_indexed_data.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+"""Tests immediate drawing using indexed data.
+"""
+from __future__ import absolute_import
+import unittest
+
+import pyglet
+
+from tests.annotations import Platform, skip_platform
+from .graphics_common import GraphicsIndexedGenericTestCase, get_feedback, GL_TRIANGLES
+
+
+@skip_platform(Platform.OSX) # TODO: Check whether OpenGL < 3.0 or compatibility profile is enabled
+class ImmediateDrawingIndexedDataTestCase(GraphicsIndexedGenericTestCase, unittest.TestCase):
+ def get_feedback(self, data):
+ return get_feedback(lambda: pyglet.graphics.draw_indexed(self.n_vertices,
+ GL_TRIANGLES,
+ self.index_data,
+ *data))
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/test_multitexture.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/test_multitexture.py
new file mode 100644
index 0000000..0dbd199
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/test_multitexture.py
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+
+'''Draws a full-window quad with two texture units enabled and multi
+texcoords. Texture unit 0 is a checker pattern of yellow and cyan with
+env mode replace. Texture unit 1 is a checker pattern of cyan and yellow,
+with env mode modulate. The result should be flat green (with some variation
+in the center cross).
+
+The test will correctly detect the asbence of multitexturing, or if texture
+coords are not supplied for a unit, but will still pass if the texture
+coordinates for each unit are swapped (the tex coords are identical).
+'''
+from builtins import map
+
+import unittest
+
+import pyglet
+from pyglet.gl import *
+
+class MultiTextureTestCase(unittest.TestCase):
+ def test_multitexture(self):
+ window = pyglet.window.Window(width=64, height=64)
+ window.dispatch_events()
+ w = window.width
+ h = window.height
+
+ pattern0 = pyglet.image.CheckerImagePattern(
+ (255, 255, 0, 255), (0, 255, 255, 255))
+ texture0 = pattern0.create_image(64, 64).get_texture()
+
+ pattern1 = pyglet.image.CheckerImagePattern(
+ (0, 255, 255, 255), (255, 255, 0, 255))
+ texture1 = pattern1.create_image(64, 64).get_texture()
+
+ batch = pyglet.graphics.Batch()
+ batch.add(4, GL_QUADS, None,
+ ('v2i', [0, 0, w, 0, w, h, 0, h]),
+ ('0t3f', texture1.tex_coords),
+ ('1t3f', texture0.tex_coords)
+ )
+
+ glActiveTexture(GL_TEXTURE0)
+ glEnable(texture0.target)
+ glBindTexture(texture0.target, texture0.id)
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE)
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
+
+ glActiveTexture(GL_TEXTURE1)
+ glEnable(texture1.target)
+ glBindTexture(texture1.target, texture1.id)
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
+
+ batch.draw()
+ self.assertEqual(self.sample(2, 2), (0, 255, 0))
+ self.assertEqual(self.sample(62, 2), (0, 255, 0))
+ self.assertEqual(self.sample(62, 62), (0, 255, 0))
+ self.assertEqual(self.sample(2, 62), (0, 255, 0))
+
+ window.close()
+
+ def sample(self, x, y):
+ color_buffer = pyglet.image.get_buffer_manager().get_color_buffer()
+ buffer = color_buffer.get_image_data()
+ data = buffer.get_data('RGB', buffer.pitch)
+ i = y * buffer.pitch + x * 3
+ r, g, b = data[i:i+3]
+ if type(r) is str:
+ r, g, b = list(map(ord, (r, g, b)))
+ return r, g, b
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/test_retained_drawing.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/test_retained_drawing.py
new file mode 100644
index 0000000..1a41bce
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/test_retained_drawing.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+"""Tests vertex list drawing.
+"""
+from __future__ import absolute_import
+import unittest
+
+import pyglet
+
+from tests.annotations import Platform, skip_platform
+from .graphics_common import GraphicsGenericTestCase, get_feedback, GL_TRIANGLES
+
+
+@skip_platform(Platform.OSX) # TODO: Check whether OpenGL < 3.0 or compatibility profile is enabled
+class RetainedDrawingTestCase(GraphicsGenericTestCase, unittest.TestCase):
+ def get_feedback(self, data):
+ vertex_list = pyglet.graphics.vertex_list(self.n_vertices, *data)
+ return get_feedback(lambda: vertex_list.draw(GL_TRIANGLES))
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/test_retained_drawing_indexed_data.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/test_retained_drawing_indexed_data.py
new file mode 100644
index 0000000..69abf59
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/graphics/test_retained_drawing_indexed_data.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+"""Tests vertex list drawing using indexed data.
+"""
+from __future__ import absolute_import
+import unittest
+
+import pyglet
+
+from tests.annotations import Platform, skip_platform
+from .graphics_common import GraphicsIndexedGenericTestCase, get_feedback, GL_TRIANGLES
+
+
+@skip_platform(Platform.OSX) # TODO: Check whether OpenGL < 3.0 or compatibility profile is enabled
+class RetainedDrawingIndexedDataTestCase(GraphicsIndexedGenericTestCase, unittest.TestCase):
+ def get_feedback(self, data):
+ vertex_list = pyglet.graphics.vertex_list_indexed(self.n_vertices, self.index_data, *data)
+ return get_feedback(lambda: vertex_list.draw(GL_TRIANGLES))
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/image/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/image/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/image/test_gdkpixbuf2.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/image/test_gdkpixbuf2.py
new file mode 100644
index 0000000..ea8bcac
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/image/test_gdkpixbuf2.py
@@ -0,0 +1,68 @@
+from __future__ import absolute_import
+
+import unittest
+
+from ...base.data import PygletTestCase
+
+try:
+ from pyglet.image.codecs import gdkpixbuf2
+except ImportError:
+ gdkpixbuf2 = None
+
+
+@unittest.skipIf(gdkpixbuf2 is None, 'GdkPixBuf not available')
+class GdkPixBufTest(PygletTestCase):
+ def test_load_image(self):
+ filename = self.get_test_data_file('images', '8bpp.gif')
+ with open(filename, 'rb') as f:
+ loader = gdkpixbuf2.GdkPixBufLoader(f, filename)
+ pixbuf = loader.get_pixbuf()
+ assert pixbuf is not None
+ assert pixbuf.height == 257
+ assert pixbuf.width == 235
+ assert pixbuf.channels == 4
+ assert pixbuf.has_alpha
+ image = pixbuf.to_image()
+ assert image is not None
+ assert image.height == 257
+ assert image.width == 235
+
+ def test_load_image_requires_loader_close(self):
+ """Some image files require the loader to be closed to force it
+ to read and parse all data."""
+ filename = self.get_test_data_file('images', 'gdk_close.png')
+ with open(filename, 'rb') as f:
+ loader = gdkpixbuf2.GdkPixBufLoader(f, filename)
+ pixbuf = loader.get_pixbuf()
+ assert pixbuf is not None
+ assert pixbuf.height == 200
+ assert pixbuf.width == 200
+ assert pixbuf.channels == 4
+ assert pixbuf.has_alpha
+ image = pixbuf.to_image()
+ assert image is not None
+ assert image.height == 200
+ assert image.width == 200
+
+ def test_load_animation(self):
+ filename = self.get_test_data_file('images', 'dinosaur.gif')
+ with open(filename, 'rb') as f:
+ loader = gdkpixbuf2.GdkPixBufLoader(f, filename)
+ gdk_anim = loader.get_animation()
+ assert gdk_anim is not None
+ anim = gdk_anim.to_animation()
+ assert anim is not None
+ assert len(anim.frames) == 12
+ for frame in anim.frames:
+ assert frame.image is not None
+ assert frame.duration is not None
+ assert frame.duration == 0.1
+ assert frame.image.width == 129
+ assert frame.image.height == 79
+
+ def test_incomplete_load(self):
+ """Start loading a file and stop. Should clean up correctly."""
+ filename = self.get_test_data_file('images', 'gdk_close.png')
+ with open(filename, 'rb') as f:
+ loader = gdkpixbuf2.GdkPixBufLoader(f, filename)
+ del loader
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/image/test_imagegrid.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/image/test_imagegrid.py
new file mode 100644
index 0000000..ae28a71
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/image/test_imagegrid.py
@@ -0,0 +1,93 @@
+from __future__ import absolute_import
+from builtins import range
+import unittest
+
+from pyglet.gl import *
+from pyglet.image import *
+from pyglet.window import *
+
+from .texture_compat import colorbyte
+
+class ImageGridTestCase(unittest.TestCase):
+ """Test the ImageGrid for textures."""
+ def set_grid_image(self, itemwidth, itemheight, rows, cols, rowpad, colpad):
+ data = b''
+ color = 1
+ width = itemwidth * cols + colpad * (cols - 1)
+ height = itemheight * rows + rowpad * (rows - 1)
+ for row in range(rows):
+ rowdata = b''
+ for col in range(cols):
+ rowdata += colorbyte(color) * itemwidth
+ if col < cols - 1:
+ rowdata += b'\0' * colpad
+ color += 1
+
+ data += rowdata * itemheight
+ if row < rows - 1:
+ data += (width * b'\0') * rowpad
+ assert len(data) == width * height
+ self.image = ImageData(width, height, 'L', data)
+ self.grid = ImageGrid(self.image, rows, cols,
+ itemwidth, itemheight, rowpad, colpad).texture_sequence
+
+ def check_cell(self, cellimage, cellindex):
+ self.assertTrue(cellimage.width == self.grid.item_width)
+ self.assertTrue(cellimage.height == self.grid.item_height)
+
+ color = colorbyte(cellindex + 1)
+ cellimage = cellimage.image_data
+ data = cellimage.get_data('L', cellimage.width)
+ self.assertTrue(data == color * len(data))
+
+ def setUp(self):
+ self.w = Window(visible=False)
+
+ def testSquare(self):
+ # Test a 3x3 grid with no padding and 4x4 images
+ rows = cols = 3
+ self.set_grid_image(4, 4, rows, cols, 0, 0)
+ for i in range(rows * cols):
+ self.check_cell(self.grid[i], i)
+
+ def testRect(self):
+ # Test a 2x5 grid with no padding and 3x8 images
+ rows, cols = 2, 5
+ self.set_grid_image(3, 8, rows, cols, 0, 0)
+ for i in range(rows * cols):
+ self.check_cell(self.grid[i], i)
+
+ def testPad(self):
+ # Test a 5x3 grid with rowpad=3 and colpad=7 and 10x9 images
+ rows, cols = 5, 3
+ self.set_grid_image(10, 9, rows, cols, 3, 7)
+ for i in range(rows * cols):
+ self.check_cell(self.grid[i], i)
+
+ def testTuple(self):
+ # Test tuple access
+ rows, cols = 3, 4
+ self.set_grid_image(5, 5, rows, cols, 0, 0)
+ for row in range(rows):
+ for col in range(cols):
+ self.check_cell(self.grid[(row, col)], row * cols + col)
+
+ def testRange(self):
+ # Test range access
+ rows, cols = 4, 3
+ self.set_grid_image(10, 1, rows, cols, 0, 0)
+ images = self.grid[4:8]
+ for i, image in enumerate(images):
+ self.check_cell(image, i + 4)
+
+ def testTupleRange(self):
+ # Test range over tuples
+ rows, cols = 10, 10
+ self.set_grid_image(4, 4, rows, cols, 0, 0)
+ images = self.grid[(3,2):(6,5)]
+ i = 0
+ for row in range(3,6):
+ for col in range(2,5):
+ self.check_cell(images[i], row * cols + col)
+ i += 1
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/image/test_texture3d.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/image/test_texture3d.py
new file mode 100644
index 0000000..221b9c5
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/image/test_texture3d.py
@@ -0,0 +1,105 @@
+from __future__ import absolute_import
+from builtins import range
+import unittest
+
+from pyglet.gl import *
+from pyglet.image import *
+from pyglet.window import *
+
+from .texture_compat import colorbyte
+
+class TestTexture3D(unittest.TestCase):
+ """Test the Texture3D for image grids."""
+ def create_image(self, width, height, color):
+ data = colorbyte(color) * (width * height)
+ return ImageData(width, height, 'L', data)
+
+ def check_image(self, image, width, height, color):
+ self.assertTrue(image.width == width)
+ self.assertTrue(image.height == height)
+ image = image.image_data
+ data = image.get_data('L', image.width)
+ self.assertTrue(data == colorbyte(color) * len(data))
+
+ def set_grid_image(self, itemwidth, itemheight, rows, cols, rowpad, colpad):
+ data = b''
+ color = 1
+ width = itemwidth * cols + colpad * (cols - 1)
+ height = itemheight * rows + rowpad * (rows - 1)
+ for row in range(rows):
+ rowdata = b''
+ for col in range(cols):
+ rowdata += colorbyte(color) * itemwidth
+ if col < cols - 1:
+ rowdata += b'\0' * colpad
+ color += 1
+
+ data += rowdata * itemheight
+ if row < rows - 1:
+ data += (width * b'\0') * rowpad
+ assert len(data) == width * height
+ self.image = ImageData(width, height, 'L', data)
+ grid = ImageGrid(self.image, rows, cols,
+ itemwidth, itemheight, rowpad, colpad)
+ self.grid = Texture3D.create_for_image_grid(grid)
+
+ def check_cell(self, cellimage, cellindex):
+ self.assertTrue(cellimage.width == self.grid.item_width)
+ self.assertTrue(cellimage.height == self.grid.item_height)
+
+ cellimage = cellimage.image_data
+ data = cellimage.get_data('L', cellimage.width)
+ self.assertTrue(data == colorbyte(cellindex + 1) * len(data))
+
+ def setUp(self):
+ self.w = Window(visible=False)
+
+ def test2(self):
+ # Test 2 images of 32x32
+ images = [self.create_image(32, 32, i+1) for i in range(2)]
+ texture = Texture3D.create_for_images(images)
+ self.assertTrue(len(texture) == 2)
+ for i in range(2):
+ self.check_image(texture[i], 32, 32, i+1)
+
+ def test5(self):
+ # test 5 images of 31x94 (power2 issues)
+ images = [self.create_image(31, 94, i+1) for i in range(5)]
+ texture = Texture3D.create_for_images(images)
+ self.assertTrue(len(texture) == 5)
+ for i in range(5):
+ self.check_image(texture[i], 31, 94, i+1)
+
+ def testSet(self):
+ # test replacing an image
+ images = [self.create_image(32, 32, i+1) for i in range(3)]
+ texture = Texture3D.create_for_images(images)
+ self.assertTrue(len(texture) == 3)
+ for i in range(3):
+ self.check_image(texture[i], 32, 32, i+1)
+ texture[1] = self.create_image(32, 32, 87)
+ self.check_image(texture[0], 32, 32, 1)
+ self.check_image(texture[1], 32, 32, 87)
+ self.check_image(texture[2], 32, 32, 3)
+
+ def testSquare(self):
+ # Test a 3x3 grid with no padding and 4x4 images
+ rows = cols = 3
+ self.set_grid_image(4, 4, rows, cols, 0, 0)
+ for i in range(rows * cols):
+ self.check_cell(self.grid[i], i)
+
+ def testRect(self):
+ # Test a 2x5 grid with no padding and 3x8 images
+ rows, cols = 2, 5
+ self.set_grid_image(3, 8, rows, cols, 0, 0)
+ for i in range(rows * cols):
+ self.check_cell(self.grid[i], i)
+
+ def testPad(self):
+ # Test a 5x3 grid with rowpad=3 and colpad=7 and 10x9 images
+ rows, cols = 5, 3
+ self.set_grid_image(10, 9, rows, cols, 3, 7)
+ for i in range(rows * cols):
+ self.check_cell(self.grid[i], i)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/image/texture_compat.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/image/texture_compat.py
new file mode 100644
index 0000000..d58edcb
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/image/texture_compat.py
@@ -0,0 +1,11 @@
+"""Python 2/3 compatibility functions for texture tests."""
+from builtins import bytes
+import sys
+
+
+def colorbyte(color):
+ if sys.version.startswith('2'):
+ return '%c' % color
+ else:
+ return bytes((color,))
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/test_directsound.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/test_directsound.py
new file mode 100644
index 0000000..27c0d7c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/test_directsound.py
@@ -0,0 +1,266 @@
+"""
+Test internals of the DirectSound media driver.
+"""
+
+import ctypes
+import math
+import pytest
+import random
+import time
+
+from pyglet.media.sources import AudioFormat
+
+try:
+ from pyglet.media.drivers import directsound
+ from pyglet.media.drivers.directsound.interface import DirectSoundDriver, DirectSoundBuffer
+ from pyglet.media.drivers.directsound.adaptation import _gain2db, _db2gain
+except ImportError:
+ directsound = None
+
+import pytest
+pytestmark = pytest.mark.skipif(directsound is None, reason='No DirectSound available.')
+
+def almost_equal(a, b, e=0.0001):
+ assert abs(a-b) <= e
+ return True
+
+
+def iter_almost_equal(a, b, e=0.0001):
+ for x, y in zip(a, b):
+ assert abs(x-y) <= e
+ return True
+
+def random_normalized_vector():
+ vector = [random.uniform(-1.0, 1.0) for _ in range(3)]
+
+ length = math.sqrt(sum(x**2 for x in vector))
+ return [x/length for x in vector]
+
+def test_gain2db_gain_convert():
+ assert _gain2db(0.0) == -10000
+ assert almost_equal(_db2gain(-10000), 0.0)
+
+ assert _gain2db(1.0) == 0
+ assert almost_equal(_db2gain(0), 1.0)
+
+ assert _gain2db(-0.1) == -10000
+ assert _gain2db(1.1) == 0
+
+ x = 0.0
+ while (x <= 1.0):
+ assert almost_equal(_db2gain(_gain2db(x)), x, 0.01)
+ x += 0.01
+
+ y = -10000
+ while (y <= 0):
+ assert almost_equal(_gain2db(_db2gain(y)), y, 1)
+ y += 10
+
+
+@pytest.fixture
+def driver():
+ return DirectSoundDriver()
+
+
+@pytest.fixture(params=[(1, 8, 22050),
+ (2, 8, 22050),
+ (1, 16, 22050),
+ (2, 16, 22050),
+ (1, 16, 44100),
+ (2, 16, 44100)])
+def audio_format(request):
+ return AudioFormat(*request.param)
+
+
+@pytest.fixture(params=[(1, 8, 22050),
+ (1, 16, 22050),
+ (1, 16, 44100)])
+def audio_format_3d(request):
+ return AudioFormat(*request.param)
+
+
+@pytest.fixture
+def buffer_(driver, audio_format):
+ return driver.create_buffer(audio_format)
+
+
+@pytest.fixture
+def buffer_3d(driver, audio_format_3d):
+ buf = driver.create_buffer(audio_format_3d)
+ assert buf.is3d
+ return buf
+
+
+@pytest.fixture
+def filled_buffer(audio_format, buffer_):
+ pointer = buffer_.lock(0, 1024)
+ if audio_format.sample_size == 8:
+ c = 0x80
+ else:
+ c = 0x00
+ ctypes.memset(pointer.audio_ptr_1, c, pointer.audio_length_1.value)
+ if pointer.audio_length_2.value > 0:
+ ctypes.memset(pointer.audio_ptr_2, c, pointer.audio_length_2.value)
+
+ return buffer_
+
+
+@pytest.fixture
+def listener(driver):
+ return driver.create_listener()
+
+
+def test_driver_create():
+ driver = DirectSoundDriver()
+ del driver
+
+
+def test_create_buffer(driver, audio_format):
+ buf = driver.create_buffer(audio_format)
+ del buf
+
+
+def test_buffer_volume(buffer_):
+ vol = 0.0
+ while vol <= 1.0:
+ listener.volume = _gain2db(vol)
+ assert almost_equal(listener.volume, _gain2db(vol), 0.05)
+ vol += 0.05
+
+
+def test_buffer_current_position_empty_buffer(buffer_):
+ buffer_.current_position = 0
+ assert buffer_.current_position == (0, 0)
+
+
+def test_buffer_current_position_filled_buffer(filled_buffer):
+ filled_buffer.current_position = 512
+ assert filled_buffer.current_position == (512, 512)
+
+
+def test_buffer_is3d(audio_format, buffer_):
+ assert buffer_.is3d == (audio_format.channels == 1)
+
+
+def test_buffer_position(buffer_):
+ for _ in range(10):
+ position = [random.uniform(-10.0, 10.0) for _ in range(3)]
+ buffer_.position = position
+ if buffer_.is3d:
+ assert iter_almost_equal(buffer_.position, position)
+ else:
+ assert buffer_.position == (0, 0, 0)
+
+
+def test_buffer_min_distance(buffer_):
+ for _ in range(10):
+ distance = random.uniform(0.0, 100.0)
+ buffer_.min_distance = distance
+ if buffer_.is3d:
+ assert almost_equal(buffer_.min_distance, distance)
+ else:
+ assert buffer_.min_distance == 0
+
+
+def test_buffer_max_distance(buffer_):
+ for _ in range(10):
+ distance = random.uniform(0.0, 100.0)
+ buffer_.max_distance = distance
+ if buffer_.is3d:
+ assert almost_equal(buffer_.max_distance, distance)
+ else:
+ assert buffer_.max_distance == 0
+
+
+def test_buffer_cone_orienation(buffer_):
+ for _ in range(10):
+ orientation = random_normalized_vector()
+ buffer_.cone_orientation = orientation
+ if buffer_.is3d:
+ assert iter_almost_equal(buffer_.cone_orientation, orientation)
+ else:
+ assert buffer_.cone_orientation == (0, 0, 0)
+
+
+def test_buffer_cone_angles(buffer_):
+ for _ in range(10):
+ angle1 = random.randint(0, 360)
+ angle2 = random.randint(0, 360)
+ inside = min(angle1, angle2)
+ outside = max(angle1, angle2)
+ buffer_.set_cone_angles(inside, outside)
+ result = buffer_.cone_angles
+ if buffer_.is3d:
+ assert result.inside == inside
+ assert result.outside == outside
+ else:
+ assert result.inside == 0
+ assert result.outside == 0
+
+
+def test_buffer_cone_outside_volume(buffer_):
+ for _ in range(10):
+ volume = _gain2db(random.uniform(0.0, 1.0))
+ buffer_.cone_outside_volume = volume
+ if buffer_.is3d:
+ assert almost_equal(buffer_.cone_outside_volume, volume)
+ else:
+ assert buffer_.cone_outside_volume == 0
+
+
+def test_buffer_frequency(buffer_):
+ for _ in range(10):
+ freq = random.randint(100, 100000)
+ buffer_.frequency = freq
+ assert buffer_.frequency == freq
+
+
+def test_buffer_lock_unlock(buffer_):
+ size = 1024
+ pointer = buffer_.lock(0, size)
+ assert pointer.audio_length_1.value + pointer.audio_length_2.value == size
+ buffer_.unlock(pointer)
+
+
+def test_buffer_play_stop(filled_buffer):
+ assert filled_buffer.current_position[0] == 0
+ filled_buffer.play()
+ for _ in range(100):
+ assert filled_buffer.is_playing
+ if filled_buffer.current_position[0] > 0:
+ break
+ else:
+ time.sleep(0.001)
+ else:
+ pytest.fail("Did not advance position in buffer while playing.")
+
+ filled_buffer.stop()
+ assert not filled_buffer.is_playing
+ pos = filled_buffer.current_position
+ for _ in range(10):
+ assert filled_buffer.current_position == pos
+ time.sleep(0.001)
+
+
+def test_create_listener(driver):
+ listener = driver.create_listener()
+ del listener
+
+
+def test_listener_position(listener):
+ for _ in range(10):
+ position = [random.uniform(-10.0, 10.0) for _ in range(3)]
+ listener.position = position
+ assert iter_almost_equal(listener.position, position)
+
+
+def test_listener_orientation(listener):
+ for _ in range(10):
+ front = random_normalized_vector()
+ top = random_normalized_vector()
+ orientation = front + top
+
+ listener.orientation = orientation
+ # Only testing first 3, as random values might be adjusted by DS to be correct angles
+ assert iter_almost_equal(listener.orientation[:3], orientation[:3])
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/test_driver.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/test_driver.py
new file mode 100644
index 0000000..470b451
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/test_driver.py
@@ -0,0 +1,275 @@
+"""Test a specific audio driver (either for platform or silent). Only checks the use of the
+interface. Any playback is silent."""
+from __future__ import absolute_import, print_function
+
+from tests import mock
+import queue
+import pytest
+import time
+
+import pyglet
+_debug = False
+pyglet.options['debug_media'] = _debug
+pyglet.options['debug_media_buffers'] = _debug
+
+import pyglet.app
+from pyglet.media.drivers import silent
+from pyglet.media.drivers.silent import SilentAudioDriver
+from pyglet.media.sources import SourceGroup
+from pyglet.media.sources.procedural import Silence
+
+
+def _delete_driver():
+ if hasattr(pyglet.media.drivers._audio_driver, 'delete'):
+ pyglet.media.drivers._audio_driver.delete()
+ pyglet.media.drivers._audio_driver = None
+
+def test_get_platform_driver():
+ driver = pyglet.media.drivers.get_audio_driver()
+ assert driver is not None
+ assert not isinstance(driver, SilentAudioDriver), 'Cannot load audio driver for your platform'
+ _delete_driver()
+
+
+def test_get_silent_driver():
+ driver = pyglet.media.drivers.get_silent_audio_driver()
+ assert driver is not None
+ assert isinstance(driver, SilentAudioDriver)
+ _delete_driver()
+
+
+class MockPlayer(object):
+ def __init__(self, event_loop):
+ self.queue = queue.Queue()
+ self.event_loop = event_loop
+
+ def dispatch_event(self, event_type, *args):
+ if _debug:
+ print('MockPlayer: event {} received @ {}'.format(event_type, time.time()))
+ self.queue.put((event_type, args))
+ self.event_loop.interrupt_event_loop()
+
+ def wait_for_event(self, timeout, *event_types):
+ end_time = time.time() + timeout
+ try:
+ while time.time() < end_time:
+ if _debug:
+ print('MockPlayer: run for {} sec @ {}'.format(end_time-time.time(),
+ time.time()))
+ self.event_loop.run_event_loop(duration=end_time-time.time())
+ event_type, args = self.queue.get_nowait()
+ if event_type in event_types:
+ return event_type, args
+ except queue.Empty:
+ return None, None
+
+ def wait_for_all_events(self, timeout, *expected_events):
+ if _debug:
+ print('Wait for events @ {}'.format(time.time()))
+ end_time = time.time() + timeout
+ expected_events = list(expected_events)
+ received_events = []
+ while expected_events:
+ event_type, args = self.wait_for_event(timeout, *expected_events)
+ if _debug:
+ print('MockPlayer: got event {} @ {}'.format(event_type, time.time()))
+ if event_type is None and time.time() >= end_time:
+ pytest.fail('Timeout before all events have been received. Still waiting for: '
+ + ','.join(expected_events))
+ elif event_type is not None:
+ if event_type in expected_events:
+ expected_events.remove(event_type)
+ received_events.append((event_type, args))
+ return received_events
+
+ def wait(self, timeout):
+ end_time = time.time() + timeout
+ while time.time() < end_time:
+ duration = max(.01, end_time-time.time())
+ self.event_loop.run_event_loop(duration=duration)
+ #assert time.time() - end_time < .1
+
+
+@pytest.fixture
+def player(event_loop):
+ return MockPlayer(event_loop)
+
+
+class SilentTestSource(Silence):
+ def __init__(self, duration, sample_rate=44800, sample_size=16):
+ super(Silence, self).__init__(duration, sample_rate, sample_size)
+ self.bytes_read = 0
+
+ def get_audio_data(self, nbytes):
+ data = super(Silence, self).get_audio_data(nbytes)
+ if data is not None:
+ self.bytes_read += data.length
+ return data
+
+ def has_fully_played(self):
+ return self.bytes_read == self._max_offset
+
+
+def get_drivers():
+ drivers = [silent]
+ ids = ['Silent']
+
+ try:
+ from pyglet.media.drivers import pulse
+ drivers.append(pulse)
+ ids.append('PulseAudio')
+ except:
+ pass
+
+ try:
+ from pyglet.media.drivers import openal
+ drivers.append(openal)
+ ids.append('OpenAL')
+ except:
+ pass
+
+ try:
+ from pyglet.media.drivers import directsound
+ drivers.append(directsound)
+ ids.append('DirectSound')
+ except:
+ pass
+
+ return {'params': drivers, 'ids': ids}
+
+
+@pytest.fixture(**get_drivers())
+def driver(request):
+ if _debug:
+ print('Create driver @ {}'.format(time.time()))
+ driver = request.param.create_audio_driver()
+ assert driver is not None
+ def fin():
+ driver.delete()
+ request.addfinalizer(fin)
+ return driver
+
+
+def _create_source_group(*sources):
+ source_group = SourceGroup(sources[0].audio_format, None)
+ for source in sources:
+ source_group.queue(source)
+ return source_group
+
+
+def test_create_destroy(driver):
+ driver.delete()
+
+
+def test_create_audio_player(driver, player):
+ source_group = _create_source_group(Silence(1.))
+ audio_player = driver.create_audio_player(source_group, player)
+ audio_player.delete()
+
+
+def test_audio_player_play(driver, player):
+ source = SilentTestSource(.1)
+ source_group = _create_source_group(source)
+
+ audio_player = driver.create_audio_player(source_group, player)
+ try:
+ audio_player.play()
+ player.wait_for_all_events(1., 'on_eos', 'on_source_group_eos')
+ assert source.has_fully_played(), 'Source not fully played'
+
+ finally:
+ audio_player.delete()
+
+
+def test_audio_player_play_multiple(driver, player):
+ sources = (SilentTestSource(.1), SilentTestSource(.1))
+ source_group = _create_source_group(*sources)
+
+ audio_player = driver.create_audio_player(source_group, player)
+ try:
+ audio_player.play()
+ player.wait_for_all_events(1., 'on_eos', 'on_eos', 'on_source_group_eos')
+ for source in sources:
+ assert source.has_fully_played(), 'Source not fully played'
+
+ finally:
+ audio_player.delete()
+
+
+def test_audio_player_add_to_paused_group(driver, player):
+ """This is current behaviour when adding a sound of the same format as the previous to a
+ player paused due to end of stream for previous sound."""
+ source = SilentTestSource(.1)
+ source_group = _create_source_group(source)
+
+ if _debug:
+ print('Create player @ {}'.format(time.time()))
+ audio_player = driver.create_audio_player(source_group, player)
+ try:
+ audio_player.play()
+ player.wait_for_all_events(1., 'on_eos', 'on_source_group_eos')
+
+ source2 = SilentTestSource(.1)
+ source_group.queue(source2)
+ audio_player.play()
+ player.wait_for_all_events(1., 'on_eos', 'on_source_group_eos')
+ assert source2.has_fully_played(), 'Source not fully played'
+
+ finally:
+ audio_player.delete()
+
+
+def test_audio_player_delete_driver_with_players(driver, player):
+ """Delete a driver with active players. Should not cause problems."""
+ source = SilentTestSource(10.)
+ source_group = _create_source_group(source)
+
+ audio_player = driver.create_audio_player(source_group, player)
+ audio_player.play()
+
+
+def test_audio_player_clear(driver, player):
+ """Test clearing all buffered data."""
+ source = SilentTestSource(10.)
+ source_group = _create_source_group(source)
+
+ audio_player = driver.create_audio_player(source_group, player)
+ try:
+ audio_player.play()
+ player.wait(.5)
+ assert 0. < audio_player.get_time() < 5.
+
+ audio_player.stop()
+ source.seek(5.)
+ audio_player.clear()
+ audio_player.play()
+ player.wait(.3)
+ assert 5. <= audio_player.get_time() < 10.
+
+ finally:
+ audio_player.delete()
+
+def test_audio_player_time(driver, player):
+ """Test retrieving current timestamp from player."""
+ source = SilentTestSource(10.)
+ source_group = _create_source_group(source)
+
+ audio_player = driver.create_audio_player(source_group, player)
+ try:
+ audio_player.play()
+ last_time = audio_player.get_time()
+ # Needs to run until at least the initial buffer is processed. Ideal time is 1 sec, so run
+ # more than 1 sec.
+ for _ in range(15):
+ player.wait(.1)
+ assert last_time < audio_player.get_time()
+ last_time = audio_player.get_time()
+ if _debug:
+ print('='*80)
+ print('Time:', last_time)
+ print('Bytes read:', source.bytes_read)
+ print('='*80)
+
+ finally:
+ audio_player.delete()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/test_openal.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/test_openal.py
new file mode 100644
index 0000000..68fd8dd
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/test_openal.py
@@ -0,0 +1,432 @@
+from builtins import str, isinstance
+import pytest
+from tests import mock
+import time
+
+from pyglet.media.sources.procedural import Silence
+
+try:
+ from pyglet.media.drivers import openal
+ import pyglet.media.drivers.openal.adaptation
+except ImportError:
+ openal = None
+
+
+pytestmark = pytest.mark.skipif(openal is None, reason='No OpenAL available.')
+
+
+def almost_equal(f1, f2, eps=0.0001):
+ return abs(f1 - f2) < eps
+
+
+def almost_equal_coords(c1, c2, eps=0.0001):
+ return all(almost_equal(f1, f2, eps) for f1, f2 in zip(c1, c2))
+
+
+@pytest.fixture
+def device():
+ device = openal.interface.OpenALDevice()
+ yield device
+ device.delete()
+
+
+def test_device_create_delete(device):
+ assert device.is_ready
+ device.delete()
+ assert not device.is_ready
+
+
+def test_device_version(device):
+ major, minor = device.get_version()
+ assert major > 0
+ assert minor > 0
+
+
+def test_device_extensions(device):
+ extensions = device.get_extensions()
+ assert len(extensions) > 0
+ for ext in extensions:
+ assert isinstance(ext, str)
+
+
+def test_context_create_delete(device):
+ context = device.create_context()
+ assert context is not None
+ context.delete()
+
+
+@pytest.fixture
+def context(device):
+ context = device.create_context()
+ yield context
+ context.delete()
+
+
+def test_context_make_current(context):
+ context.make_current()
+
+
+@pytest.fixture
+def buffer_pool(context):
+ pool = openal.interface.OpenALBufferPool(context)
+ yield pool
+ pool.clear()
+
+
+@pytest.fixture
+def buf(buffer_pool):
+ buf = buffer_pool.get_buffer()
+ yield buf
+ buf.delete()
+
+
+def test_buffer_create_delete(buf):
+ assert buf.is_valid
+ assert buf.al_buffer is not None
+ assert buf.name > 0
+ buf.delete()
+ assert not buf.is_valid
+
+
+def test_buffer_data(buf):
+ assert buf.is_valid
+ audio_source = Silence(1.)
+ buf.data(audio_source.get_audio_data(audio_source.audio_format.bytes_per_second),
+ audio_source.audio_format)
+ assert buf.is_valid
+ buf.delete()
+ assert not buf.is_valid
+
+
+def test_bufferpool_get_single_buffer(buffer_pool):
+ assert len(buffer_pool) == 0
+
+ buf = buffer_pool.get_buffer()
+ assert buf is not None
+ assert buf.is_valid
+ assert len(buffer_pool) == 0
+
+
+def test_bufferpool_return_valid_buffer(buffer_pool):
+ buf = buffer_pool.get_buffer()
+ assert buf is not None
+ assert buf.is_valid
+ assert len(buffer_pool) == 0
+
+ buffer_pool.unqueue_buffer(buf)
+ assert len(buffer_pool) == 1
+
+ buf = buffer_pool.get_buffer()
+ assert buf is not None
+ assert buf.is_valid
+ assert len(buffer_pool) == 0
+
+
+def test_bufferpool_get_multiple_buffers(buffer_pool):
+ bufs = buffer_pool.get_buffers(3)
+ assert bufs is not None
+ assert len(bufs) == 3
+ for buf in bufs:
+ assert buf.is_valid
+ assert len(buffer_pool) == 0
+
+
+def test_bufferpool_return_multiple_valid_buffers(buffer_pool):
+ bufs = buffer_pool.get_buffers(3)
+ assert bufs is not None
+ assert len(bufs) == 3
+ for buf in bufs:
+ assert buf.is_valid
+ assert len(buffer_pool) == 0
+
+ return_count = 0
+ for buf in bufs:
+ buffer_pool.unqueue_buffer(buf)
+ return_count += 1
+ assert len(buffer_pool) == return_count
+
+ buf = buffer_pool.get_buffer()
+ assert buf is not None
+ assert buf.is_valid
+ assert len(buffer_pool) == 2
+
+
+def test_bufferpool_return_invalid_buffer(buffer_pool):
+ buf = buffer_pool.get_buffer()
+ assert buf is not None
+ assert buf.is_valid
+ assert len(buffer_pool) == 0
+
+ buf.delete()
+ assert not buf.is_valid
+ buffer_pool.unqueue_buffer(buf)
+ assert len(buffer_pool) == 0
+
+ buf = buffer_pool.get_buffer()
+ assert buf is not None
+ assert buf.is_valid
+ assert len(buffer_pool) == 0
+
+
+def test_bufferpool_invalidate_buffer_in_pool(buffer_pool):
+ buf = buffer_pool.get_buffer()
+ assert buf is not None
+ assert buf.is_valid
+ assert len(buffer_pool) == 0
+
+ buffer_pool.unqueue_buffer(buf)
+ assert len(buffer_pool) == 1
+
+ buf.delete()
+ assert not buf.is_valid
+
+ buf = buffer_pool.get_buffer()
+ assert buf is not None
+ assert buf.is_valid
+ assert len(buffer_pool) == 0
+
+
+def test_source_create_delete(context):
+ source = context.create_source()
+ assert source.is_initial
+ assert not source.is_playing
+ assert not source.is_paused
+ assert not source.is_stopped
+ assert source.buffers_processed == 0
+ assert source.byte_offset == 0
+ source.delete()
+
+
+@pytest.fixture
+def source(context):
+ source = context.create_source()
+ yield source
+ source.delete()
+
+
+@pytest.fixture
+def filled_buffer(source):
+ buf = source.get_buffer()
+ assert buf.is_valid
+ audio_source = Silence(1.)
+ buf.data(audio_source.get_audio_data(audio_source.audio_format.bytes_per_second),
+ audio_source.audio_format)
+ yield buf
+ source.buffer_pool.unqueue_buffer(buf)
+
+
+def test_source_queue_play_unqueue(context, filled_buffer):
+ source = context.create_source()
+
+ source.queue_buffer(filled_buffer)
+ assert source.is_initial
+ assert not source.is_playing
+ assert not source.is_paused
+ assert not source.is_stopped
+ assert source.buffers_processed == 0
+ assert source.buffers_queued == 1
+ assert source.byte_offset == 0
+
+ source.play()
+ assert not source.is_initial
+ assert source.is_playing
+ assert not source.is_paused
+ assert not source.is_stopped
+ assert source.byte_offset == 0
+
+ end_time = time.time() + 1.5
+ while time.time() < end_time:
+ if source.byte_offset > 0:
+ break
+ time.sleep(.1)
+ assert source.byte_offset > 0
+
+ end_time = time.time() + 1.5
+ while time.time() < end_time:
+ if source.buffers_processed > 0:
+ break
+ time.sleep(.1)
+ assert source.buffers_processed == 1
+
+ processed = source.unqueue_buffers()
+ assert processed == 1
+ assert source.buffers_processed == 0
+ assert source.buffers_queued == 0
+
+ assert not source.is_initial
+ assert not source.is_playing
+ assert not source.is_paused
+ assert source.is_stopped
+
+
+@pytest.fixture
+def filled_source(source, filled_buffer):
+ source.queue_buffer(filled_buffer)
+ return source
+
+
+def test_source_pause_stop(filled_source):
+ assert filled_source.is_initial
+ assert not filled_source.is_playing
+ assert not filled_source.is_paused
+ assert not filled_source.is_stopped
+
+ filled_source.play()
+ assert not filled_source.is_initial
+ assert filled_source.is_playing
+ assert not filled_source.is_paused
+ assert not filled_source.is_stopped
+
+ filled_source.pause()
+ assert not filled_source.is_initial
+ assert not filled_source.is_playing
+ assert filled_source.is_paused
+ assert not filled_source.is_stopped
+
+ filled_source.play()
+ assert not filled_source.is_initial
+ assert filled_source.is_playing
+ assert not filled_source.is_paused
+ assert not filled_source.is_stopped
+
+ filled_source.stop()
+ assert not filled_source.is_initial
+ assert not filled_source.is_playing
+ assert not filled_source.is_paused
+ assert filled_source.is_stopped
+
+
+def test_source_prop_position(filled_source):
+ assert almost_equal_coords(filled_source.position, (0., 0., 0.))
+ filled_source.position = 1., 2., 3.
+ assert almost_equal_coords(filled_source.position, (1., 2., 3.))
+
+
+def test_source_prop_velocity(filled_source):
+ assert almost_equal_coords(filled_source.velocity, (0., 0., 0.))
+ filled_source.velocity = 1., 2., 3.
+ assert almost_equal_coords(filled_source.velocity, (1., 2., 3.))
+
+
+def test_source_prop_gain(filled_source):
+ assert almost_equal(filled_source.gain, 1.)
+ filled_source.gain = 8.5
+ assert almost_equal(filled_source.gain, 8.5)
+
+
+def test_source_prop_min_gain(filled_source):
+ assert almost_equal(filled_source.min_gain, 0.)
+ filled_source.min_gain = .5
+ assert almost_equal(filled_source.min_gain, .5)
+
+
+def test_source_prop_max_gain(filled_source):
+ assert almost_equal(filled_source.max_gain, 1.)
+ filled_source.max_gain = .8
+ assert almost_equal(filled_source.max_gain, .8)
+
+
+def test_source_prop_reference_distance(filled_source):
+ assert almost_equal(filled_source.reference_distance, 1.)
+ filled_source.reference_distance = 10.3
+ assert almost_equal(filled_source.reference_distance, 10.3)
+
+
+def test_source_prop_rolloff_factor(filled_source):
+ assert almost_equal(filled_source.rolloff_factor, 1.)
+ filled_source.rolloff_factor = 4.5
+ assert almost_equal(filled_source.rolloff_factor, 4.5)
+
+
+def test_source_prop_max_distance(filled_source):
+ assert filled_source.max_distance > 500.0 # No definition of MAX_FLOAT available, 1000.0 on OSX
+ filled_source.max_distance = 500.
+ assert almost_equal(filled_source.max_distance, 500.)
+
+
+def test_source_prop_pitch(filled_source):
+ assert almost_equal(filled_source.pitch, 1.)
+ filled_source.pitch = 3.14
+ assert almost_equal(filled_source.pitch, 3.14)
+
+
+def test_source_prop_direction(filled_source):
+ assert almost_equal_coords(filled_source.direction, (0., 0., 0.))
+ filled_source.direction = 1., 2., 3.
+ assert almost_equal_coords(filled_source.direction, (1., 2., 3.))
+
+
+def test_source_prop_cone_inner_angle(filled_source):
+ assert almost_equal(filled_source.cone_inner_angle, 360.)
+ filled_source.cone_inner_angle = 180.
+ assert almost_equal(filled_source.cone_inner_angle, 180.)
+
+
+def test_source_prop_cone_outer_angle(filled_source):
+ assert almost_equal(filled_source.cone_outer_angle, 360.)
+ filled_source.cone_outer_angle = 90.
+ assert almost_equal(filled_source.cone_outer_angle, 90.)
+
+
+def test_source_prop_cone_outer_gain(filled_source):
+ assert almost_equal(filled_source.cone_outer_gain, 0.)
+ filled_source.cone_outer_gain = .6
+ assert almost_equal(filled_source.cone_outer_gain, .6)
+
+
+def test_source_prop_sec_offset(filled_source):
+ assert almost_equal(filled_source.sec_offset, 0.)
+ filled_source.play()
+ filled_source.pause()
+ filled_source.sec_offset = .1
+ # Not stable: assert almost_equal(filled_source.sec_offset, .1)
+
+
+def test_source_prop_sample_offset(filled_source):
+ assert almost_equal(filled_source.sample_offset, 0.)
+ filled_source.play()
+ filled_source.pause()
+ filled_source.sample_offset = 5.
+ # Not stable: assert almost_equal(filled_source.sample_offset, 5.)
+
+
+def test_source_prop_byte_offset(filled_source):
+ assert almost_equal(filled_source.byte_offset, 0.)
+ filled_source.play()
+ filled_source.pause()
+ filled_source.byte_offset = 8.
+ # Not stable: assert almost_equal(filled_source.byte_offset, 8.)
+
+
+def test_listener_prop_position(context):
+ listener = openal.interface.OpenALListener()
+ assert almost_equal_coords(listener.position, (0., 0., 0.))
+ filled_source.position = 1., 2., 3.
+ #TODO assert almost_equal_coords(listener.position, (1., 2., 3.))
+
+
+def test_listener_prop_velocity(context):
+ listener = openal.interface.OpenALListener()
+ assert almost_equal_coords(listener.velocity, (0., 0., 0.))
+ filled_source.velocity = 1., 2., 3.
+ #TODO assert almost_equal_coords(listener.velocity, (1., 2., 3.))
+
+
+def test_listener_prop_gain(context):
+ listener = openal.interface.OpenALListener()
+ assert almost_equal(listener.gain, 1.)
+ filled_source.gain = 8.5
+ #TODO assert almost_equal(listener.gain, 8.5)
+
+
+def test_listener_prop_orientation(context):
+ listener = openal.interface.OpenALListener()
+ orientation = listener.orientation
+ assert almost_equal_coords(orientation.at, (0., 0., -1.))
+ assert almost_equal_coords(orientation.up, (0., 1., 0.))
+ listener.orientation = ((1., 2., 3.), (4., 5., 6.))
+ orientation = listener.orientation
+ assert almost_equal_coords(orientation.at, (1., 2., 3.))
+ assert almost_equal_coords(orientation.up, (4., 5., 6.))
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/test_player.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/test_player.py
new file mode 100644
index 0000000..58638d1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/test_player.py
@@ -0,0 +1,89 @@
+from __future__ import print_function
+from future import standard_library
+standard_library.install_aliases()
+
+import gc
+import inspect
+import pytest
+import queue
+from tests import mock
+import threading
+import time
+import unittest
+
+import pyglet
+#pyglet.options['debug_media'] = True
+
+import pyglet.app # Will be patched
+from pyglet.media import Player
+from pyglet.media.sources.procedural import Silence
+
+
+# TODO: Move to utility module
+class EventForwarder(threading.Thread):
+ def __init__(self):
+ super(EventForwarder, self).__init__()
+ self.queue = queue.Queue()
+
+ def run(self):
+ while True:
+ destination, event_type, args = self.queue.get()
+ if not destination:
+ break
+ else:
+ destination.dispatch_event(event_type, *args)
+
+ def post_event(self, destination, event_type, *args):
+ self.queue.put((destination, event_type, args))
+
+ def notify(self):
+ pass
+
+ def stop(self):
+ self.queue.put((None, None, None))
+ self.join()
+
+
+class PlayerTestCase(unittest.TestCase):
+ """Integration tests for the high-level media player.
+
+ Uses the automatically selected driver for the current platform only."""
+ def setUp(self):
+ self.forwarder = EventForwarder()
+ self.forwarder.start()
+
+ self.event_loop_patch = mock.patch('pyglet.app.platform_event_loop',
+ self.forwarder)
+ self.event_loop_patch.start()
+
+ def tearDown(self):
+ self.event_loop_patch.stop()
+ self.forwarder.stop()
+
+ @pytest.mark.xfail
+ def test_unreferenced_cleanup(self):
+ """Test that the player gets cleaned up if there are no references left to it
+ and playback of contained sources has finished."""
+ silence = Silence(.1)
+ player = Player()
+ player_id = id(player)
+
+ @player.event
+ def on_player_eos():
+ on_player_eos.called = True
+ on_player_eos.called = False
+
+ player.queue(silence)
+ player.play()
+ player = None
+
+ while not on_player_eos.called:
+ time.sleep(.1)
+
+ gc.collect()
+
+ for obj in gc.get_objects():
+ if isinstance(obj, Player) and id(obj) == player_id:
+ self.fail('Player should be cleaned up')
+ self.assertListEqual([], gc.garbage, msg='Should not find garbage')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/test_pulse.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/test_pulse.py
new file mode 100644
index 0000000..d1acb47
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/test_pulse.py
@@ -0,0 +1,355 @@
+from __future__ import unicode_literals
+
+from builtins import str
+import numbers
+import pytest
+from threading import Timer
+
+import pyglet
+#pyglet.options['debug_media'] = True
+
+from pyglet.media.sources import AudioFormat
+from pyglet.media.sources.procedural import Silence
+
+try:
+ from pyglet.media.drivers.pulse import interface
+except ImportError:
+ interface = None
+
+
+pytestmark = pytest.mark.skipif(interface is None, reason='requires PulseAudio')
+
+
+@pytest.fixture
+def mainloop():
+ return interface.PulseAudioMainLoop()
+
+
+def test_mainloop_run(mainloop):
+ mainloop.start()
+ mainloop.delete()
+
+
+def test_mainloop_lock(mainloop):
+ mainloop.start()
+ mainloop.lock()
+ mainloop.unlock()
+ mainloop.delete()
+
+
+def test_mainloop_signal(mainloop):
+ mainloop.start()
+ with mainloop:
+ mainloop.signal()
+ mainloop.delete()
+
+
+def test_mainloop_wait_signal(mainloop):
+ mainloop.start()
+
+ def signal():
+ with mainloop:
+ mainloop.signal()
+ t = Timer(.1, signal)
+ t.start()
+
+ with mainloop:
+ mainloop.wait()
+ mainloop.delete()
+
+
+@pytest.fixture
+def context(mainloop):
+ mainloop.start()
+ with mainloop:
+ return mainloop.create_context()
+
+
+def test_context_not_connected(context):
+ assert context.is_ready == False
+ assert context.is_failed == False
+ assert context.is_terminated == False
+ assert context.server == None
+ assert isinstance(context.protocol_version, numbers.Integral)
+ assert context.server_protocol_version == None
+ assert context.is_local == None
+
+ with context:
+ context.delete()
+
+ assert context.is_ready == False
+ assert context.is_failed == False
+ assert context.is_terminated == False # Never connected, so state is not set yet
+ assert context.server == None
+ assert context.protocol_version == None
+ assert context.server_protocol_version == None
+ assert context.is_local == None
+
+ context.mainloop.delete()
+
+
+def test_context_connect(context):
+ assert context.is_ready == False
+ assert context.is_failed == False
+ assert context.is_terminated == False
+ assert context.server == None
+ assert isinstance(context.protocol_version, numbers.Integral)
+ assert context.server_protocol_version == None
+ assert context.is_local == None
+
+ with context:
+ context.connect()
+
+ assert context.is_ready == True
+ assert context.is_failed == False
+ assert context.is_terminated == False
+ assert isinstance(context.server, str)
+ assert isinstance(context.protocol_version, numbers.Integral)
+ assert isinstance(context.server_protocol_version, numbers.Integral)
+ assert context.is_local == True
+
+ with context:
+ context.delete()
+
+ assert context.is_ready == False
+ assert context.is_failed == False
+ assert context.is_terminated == True
+ assert context.server == None
+ assert context.protocol_version == None
+ assert context.server_protocol_version == None
+ assert context.is_local == None
+
+ context.mainloop.delete()
+
+
+@pytest.fixture
+def stream(context):
+ with context:
+ context.connect()
+ audio_format = AudioFormat(1, 16, 44100)
+ stream = context.create_stream(audio_format)
+ return stream
+
+
+@pytest.fixture
+def audio_source():
+ return Silence(10.0, 44100, 16)
+
+
+@pytest.fixture
+def filled_stream(stream, audio_source):
+ with stream:
+ stream.connect_playback()
+
+ assert stream.is_ready
+ assert stream.writable_size > 0
+
+ nbytes = min(1024, stream.writable_size)
+ audio_data = audio_source.get_audio_data(nbytes)
+ with stream:
+ stream.write(audio_data)
+
+ assert stream.is_ready
+
+ return stream
+
+
+def test_stream_create(stream):
+ assert stream.is_unconnected == True
+ assert stream.is_creating == False
+ assert stream.is_ready == False
+ assert stream.is_failed == False
+ assert stream.is_terminated == False
+
+ with stream:
+ stream.delete()
+
+ assert stream.is_unconnected == True
+ assert stream.is_creating == False
+ assert stream.is_ready == False
+ assert stream.is_failed == False
+ assert stream.is_terminated == False
+
+ with stream:
+ stream.context.delete()
+ stream.mainloop.delete()
+
+
+def test_stream_connect(stream):
+ assert stream.is_unconnected == True
+ assert stream.is_creating == False
+ assert stream.is_ready == False
+ assert stream.is_failed == False
+ assert stream.is_terminated == False
+ assert isinstance(stream.index, numbers.Integral)
+
+ with stream:
+ stream.connect_playback()
+
+ assert stream.is_unconnected == False
+ assert stream.is_creating == False
+ assert stream.is_ready == True
+ assert stream.is_failed == False
+ assert stream.is_terminated == False
+ assert isinstance(stream.index, numbers.Integral)
+
+ with stream:
+ stream.delete()
+
+ assert stream.is_unconnected == False
+ assert stream.is_creating == False
+ assert stream.is_ready == False
+ assert stream.is_failed == False
+ assert stream.is_terminated == True
+
+ with stream:
+ stream.context.delete()
+ stream.mainloop.delete()
+
+
+def test_stream_write(stream, audio_source):
+ with stream:
+ stream.connect_playback()
+
+ assert stream.is_ready
+ assert stream.writable_size > 0
+
+ nbytes = min(1024, stream.writable_size)
+ audio_data = audio_source.get_audio_data(nbytes)
+ with stream:
+ written = stream.write(audio_data)
+ assert written == nbytes
+
+ assert stream.is_ready
+
+ with stream:
+ stream.delete()
+
+ assert stream.is_terminated
+
+ with stream:
+ stream.context.delete()
+ stream.mainloop.delete()
+
+
+def test_stream_timing_info(filled_stream):
+ with filled_stream:
+ op = filled_stream.update_timing_info()
+ op.wait()
+ assert op.is_done
+ info = filled_stream.get_timing_info()
+ assert info is not None
+
+ with filled_stream:
+ op.delete()
+ filled_stream.delete()
+ filled_stream.context.delete()
+ filled_stream.mainloop.delete()
+
+
+def test_stream_trigger(filled_stream):
+ with filled_stream:
+ op = filled_stream.trigger()
+ op.wait()
+ assert op.is_done
+
+ with filled_stream:
+ op.delete()
+ filled_stream.delete()
+ filled_stream.context.delete()
+ filled_stream.mainloop.delete()
+
+
+def test_stream_prebuf(filled_stream):
+ with filled_stream:
+ op = filled_stream.prebuf()
+ op.wait()
+ assert op.is_done
+
+ with filled_stream:
+ op.delete()
+ filled_stream.delete()
+ filled_stream.context.delete()
+ filled_stream.mainloop.delete()
+
+
+def test_stream_cork(filled_stream):
+ assert filled_stream.is_corked
+
+ with filled_stream:
+ op = filled_stream.resume()
+ op.wait()
+ assert op.is_done
+ assert not filled_stream.is_corked
+
+ with filled_stream:
+ op.delete()
+ op = filled_stream.pause()
+ op.wait()
+ assert op.is_done
+ assert filled_stream.is_corked
+
+ with filled_stream:
+ op.delete()
+ filled_stream.delete()
+ filled_stream.context.delete()
+ filled_stream.mainloop.delete()
+
+
+def test_stream_update_sample_rate(filled_stream):
+ with filled_stream:
+ op = filled_stream.update_sample_rate(44100)
+ op.wait()
+ assert op.is_done
+
+ with filled_stream:
+ op.delete()
+ filled_stream.delete()
+ filled_stream.context.delete()
+ filled_stream.mainloop.delete()
+
+
+def test_stream_write_needed(stream, audio_source):
+ with stream:
+ stream.connect_playback()
+
+ assert stream.is_ready
+ assert stream.writable_size > 0
+
+ @stream.event
+ def on_write_needed(nbytes, underflow):
+ on_write_needed.nbytes = nbytes
+ on_write_needed.underflow = underflow
+ return pyglet.event.EVENT_HANDLED
+ on_write_needed.nbytes = None
+ on_write_needed.underflow = None
+
+ audio_data = audio_source.get_audio_data(stream.writable_size)
+ with stream:
+ stream.write(audio_data)
+ assert stream.is_ready
+ assert not stream.underflow
+
+ with stream:
+ stream.resume().wait().delete()
+
+ while on_write_needed.nbytes is None:
+ with stream:
+ stream.wait()
+ assert on_write_needed.nbytes > 0
+ assert on_write_needed.underflow == False
+ assert not stream.underflow
+
+ on_write_needed.nbytes = None
+ on_write_needed.underflow = None
+ while on_write_needed.underflow != True:
+ with stream:
+ stream.wait()
+ assert on_write_needed.nbytes > 0
+ assert on_write_needed.underflow == True
+ assert stream.underflow
+
+ with stream:
+ stream.delete()
+ stream.context.delete()
+ stream.mainloop.delete()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/test_threads.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/test_threads.py
new file mode 100644
index 0000000..7666eee
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/media/test_threads.py
@@ -0,0 +1,96 @@
+from tests import mock
+import time
+
+from pyglet.media.threads import PlayerWorker
+
+
+def test_worker_add_remove_players():
+ worker = PlayerWorker()
+ player1 = mock.MagicMock()
+ player1.get_write_size.return_value = 0
+ type(player1).min_buffer_size = mock.PropertyMock(return_value=512)
+ player2 = mock.MagicMock()
+ player2.get_write_size.return_value = 0
+ type(player2).min_buffer_size = mock.PropertyMock(return_value=512)
+
+ worker.start()
+ try:
+ worker.add(player1)
+ worker.add(player2)
+ worker.remove(player1)
+ worker.remove(player2)
+ worker.remove(player2)
+ finally:
+ worker.stop()
+
+
+def test_worker_refill_player():
+ worker = PlayerWorker()
+ worker.start()
+
+ try:
+ player = mock.MagicMock()
+ player.get_write_size.return_value = 1024
+ type(player).min_buffer_size = mock.PropertyMock(return_value=512)
+ worker.add(player)
+
+ for _ in range(10):
+ if player.get_write_size.called:
+ break
+ time.sleep(.1)
+
+ worker.remove(player)
+ player.refill.assert_called_with(1024)
+
+ finally:
+ worker.stop()
+
+
+def test_worker_do_not_refill_player():
+ worker = PlayerWorker()
+ worker.start()
+
+ try:
+ player = mock.MagicMock()
+ player.get_write_size.return_value = 104
+ type(player).min_buffer_size = mock.PropertyMock(return_value=512)
+ worker.add(player)
+
+ for _ in range(10):
+ if player.get_write_size.called:
+ break
+ time.sleep(.1)
+
+ worker.remove(player)
+ assert not player.refill.called
+
+ finally:
+ worker.stop()
+
+
+def test_worker_refill_multiple_players_refill_multiple():
+ worker = PlayerWorker()
+ worker.start()
+
+ try:
+ player1 = mock.MagicMock()
+ player1.get_write_size.return_value = 1024
+ type(player1).min_buffer_size = mock.PropertyMock(return_value=512)
+ worker.add(player1)
+
+ player2 = mock.MagicMock()
+ player2.get_write_size.return_value = 768
+ type(player2).min_buffer_size = mock.PropertyMock(return_value=512)
+ worker.add(player2)
+
+ for _ in range(10):
+ if player1.get_write_size.called and player2.get_write_size.called:
+ break
+ time.sleep(.1)
+
+ player1.refill.assert_called_with(1024)
+ player2.refill.assert_called_with(768)
+
+ finally:
+ worker.stop()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/platform/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/platform/__init__.py
new file mode 100644
index 0000000..07dd895
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/platform/__init__.py
@@ -0,0 +1,3 @@
+"""
+Platform integration tests. These tests are specific to certain platforms.
+"""
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/platform/test_linux_fontconfig.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/platform/test_linux_fontconfig.py
new file mode 100644
index 0000000..06f7292
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/platform/test_linux_fontconfig.py
@@ -0,0 +1,76 @@
+"""
+Tests for fontconfig implementation.
+"""
+
+import unittest
+
+from pyglet.font.fontconfig import get_fontconfig
+from tests.annotations import require_platform, Platform
+
+
+@require_platform(Platform.LINUX)
+class FontConfigTestCase(unittest.TestCase):
+ def test_find_font_existing(self):
+ font_match = get_fontconfig().find_font('arial')
+
+ self.assertIsNotNone(font_match)
+ self.assertIsNotNone(font_match.name)
+ self.assertIsNotNone(font_match.file)
+
+ # Face does not seem to work
+ #self.assertIsNotNone(font_match.face)
+
+ def test_find_font_match_name(self):
+ font_match = get_fontconfig().find_font('arial')
+
+ self.assertIsNotNone(font_match)
+ self.assertEqual(font_match.name.lower(), 'arial')
+ self.assertIn('arial', font_match.file.lower())
+
+ def test_find_font_default(self):
+ font_match = get_fontconfig().find_font(None)
+
+ self.assertIsNotNone(font_match)
+ self.assertIsNotNone(font_match.name)
+ self.assertIsNotNone(font_match.file)
+
+ def test_find_font_no_match(self):
+ """Even if the font does not exist we get a default result."""
+ font_match = get_fontconfig().find_font('unknown')
+
+ self.assertIsNotNone(font_match)
+ self.assertIsNotNone(font_match.name)
+ self.assertIsNotNone(font_match.file)
+ self.assertNotEqual(font_match.name.lower(), 'unknown')
+ self.assertNotIn('unknown', font_match.file.lower())
+
+ def test_find_font_match_size(self):
+ font_match = get_fontconfig().find_font('arial', size=16.0)
+
+ self.assertIsNotNone(font_match)
+ self.assertEqual(font_match.name.lower(), 'arial')
+ self.assertIn('arial', font_match.file.lower())
+ self.assertEqual(font_match.size, 16.0)
+ self.assertFalse(font_match.bold)
+ self.assertFalse(font_match.italic)
+
+ def test_find_font_match_bold(self):
+ font_match = get_fontconfig().find_font('arial', size=12.0, bold=True)
+
+ self.assertIsNotNone(font_match)
+ self.assertEqual(font_match.name.lower(), 'arial')
+ self.assertIn('arial', font_match.file.lower())
+ self.assertEqual(font_match.size, 12.0)
+ self.assertTrue(font_match.bold)
+ self.assertFalse(font_match.italic)
+
+ def test_find_font_match_italic(self):
+ font_match = get_fontconfig().find_font('arial', size=12.0, italic=True)
+
+ self.assertIsNotNone(font_match)
+ self.assertEqual(font_match.name.lower(), 'arial')
+ self.assertIn('arial', font_match.file.lower())
+ self.assertEqual(font_match.size, 12.0)
+ self.assertFalse(font_match.bold)
+ self.assertTrue(font_match.italic)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/platform/test_win_multicore_clock.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/platform/test_win_multicore_clock.py
new file mode 100644
index 0000000..44ef413
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/platform/test_win_multicore_clock.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+
+# Contributed by Claudio Canepa
+# Integrated by Ben Smith
+
+""" There is the possibility that time.clock be non monotonic in multicore hardware,
+due to the underlaying use of win32 QueryPerformanceCounter.
+If your update is seeing a negative dt, then time.clock is probably the culprit.
+AMD or Intel Patches for multicore may fix this problem (if you see it at all)"""
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+
+import time
+from tests.annotations import require_platform, Platform
+import unittest
+
+
+@require_platform(Platform.WINDOWS)
+class WindowsMulticoreClockTestCase(unittest.TestCase):
+ def test_multicore(self):
+ failures = 0
+ old_time = time.clock()
+ end_time = time.time() + 3
+ while time.time() < end_time:
+ t = time.clock()
+ if t < old_time:
+ failures += 1
+ old_time = t
+ time.sleep(0.001)
+ self.assertTrue(failures == 0)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/dir1/dir1/file.txt b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/dir1/dir1/file.txt
new file mode 100644
index 0000000..cdbdc5d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/dir1/dir1/file.txt
@@ -0,0 +1 @@
+F3
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/dir1/file.txt b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/dir1/file.txt
new file mode 100644
index 0000000..4a4fd00
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/dir1/file.txt
@@ -0,0 +1 @@
+F2
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/dir1/res.zip b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/dir1/res.zip
new file mode 100644
index 0000000..6084796
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/dir1/res.zip differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/dir2/file.txt b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/dir2/file.txt
new file mode 100644
index 0000000..a9edebb
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/dir2/file.txt
@@ -0,0 +1 @@
+F6
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/file.txt b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/file.txt
new file mode 100644
index 0000000..66d43ba
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/file.txt
@@ -0,0 +1 @@
+F1
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/rgbm.png b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/rgbm.png
new file mode 100644
index 0000000..c19408a
Binary files /dev/null and b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/rgbm.png differ
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/test_resource_image_loading.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/test_resource_image_loading.py
new file mode 100644
index 0000000..56f642e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/test_resource_image_loading.py
@@ -0,0 +1,71 @@
+import pytest
+
+from pyglet.gl import *
+from pyglet import image
+from pyglet import resource
+
+# Test image is laid out
+# M R
+# B G
+# In this test the image is sampled at four points from top-right clockwise:
+# R G B M (red, green, blue, magenta)
+
+@pytest.mark.parametrize('transforms,result', [
+ (dict(), 'rgbm'),
+ (dict(flip_x=True), 'mbgr'),
+ (dict(flip_y=True), 'grmb'),
+ (dict(flip_x=True, flip_y=True), 'bmrg'),
+ (dict(rotate=90), 'mrgb'),
+ (dict(rotate=-270), 'mrgb'),
+ (dict(rotate=180), 'bmrg'),
+ (dict(rotate=-180), 'bmrg'),
+ (dict(rotate=270), 'gbmr'),
+ (dict(rotate=-90), 'gbmr'),
+ ])
+def test_resource_image_loading(event_loop, transforms, result):
+ """Test loading an image resource with possible transformations."""
+ resource.path.append('@' + __name__)
+ resource.reindex()
+
+ img = resource.image('rgbm.png', **transforms)
+
+ w = event_loop.create_window(width=10, height=10)
+ @w.event
+ def on_draw():
+ # XXX For some reason original on_draw is not called
+ w.clear()
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
+ img.blit(img.anchor_x, img.anchor_y)
+
+ event_loop.interrupt_event_loop()
+
+ # Need to force multiple draws for platforms that do not support immediate drawing
+ event_loop.run_event_loop()
+ w._legacy_invalid = True
+ event_loop.run_event_loop()
+ w._legacy_invalid = True
+ event_loop.run_event_loop()
+
+ image_data = image.get_buffer_manager().get_color_buffer().get_image_data()
+ pixels = image_data.get_data('RGBA', image_data.width * 4)
+ def sample(x, y):
+ i = y * image_data.pitch + x * len(image_data.format)
+ r, g, b, _ = pixels[i:i+len(image_data.format)]
+ if type(r) is str:
+ r, g, b = list(map(ord, (r, g, b)))
+ return {
+ (255, 0, 0): 'r',
+ (0, 255, 0): 'g',
+ (0, 0, 255): 'b',
+ (255, 0, 255): 'm'}.get((r, g, b), 'x')
+
+ samples = ''.join([
+ sample(3, 3), sample(3, 0), sample(0, 0), sample(0, 3)])
+ if samples == samples[2]*4:
+ # On retina displays the image buffer is twice the size of the coordinate system
+ samples = ''.join([
+ sample(6, 6), sample(6, 0), sample(0, 0), sample(0, 6)])
+
+ assert samples == result
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/test_resource_loading.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/test_resource_loading.py
new file mode 100644
index 0000000..01a5607
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/resource/test_resource_loading.py
@@ -0,0 +1,151 @@
+#!/usr/bin/env python
+
+'''
+Layout:
+
+. (script home)
+ file.txt F1
+ dir1/
+ file.txt F2
+ dir1/
+ file.txt F3
+ res.zip/
+ file.txt F7
+ dir1/
+ file.txt F8
+ dir1/
+ file.txt F9
+ dir2/
+ file.txt F6
+
+'''
+
+import os
+import sys
+import unittest
+
+from pyglet import resource
+from pyglet.compat import asbytes
+
+class ResourceLoadingTestCase(unittest.TestCase):
+ def setUp(self):
+ self.script_home = os.path.dirname(__file__)
+
+ def check(self, path, result):
+ self.check_file(path, 'file.txt', result)
+
+ def check_file(self, path, file, result):
+ loader = resource.Loader(path, script_home=self.script_home)
+ self.assertTrue(loader.file(file).read() == asbytes('%s\n' % result))
+
+ def checkFail(self, path):
+ loader = resource.Loader(path, script_home=self.script_home)
+ self.assertRaises(resource.ResourceNotFoundException,
+ loader.file, 'file.txt')
+
+ def test1(self):
+ self.check(None, 'F1')
+
+ def test2(self):
+ self.check('', 'F1')
+
+ def test2a(self):
+ self.check('.', 'F1')
+
+ def test2b(self):
+ self.checkFail(())
+
+ def test2c(self):
+ self.checkFail('foo')
+
+ def test2d(self):
+ self.checkFail(['foo'])
+
+ def test2e(self):
+ self.check(['foo', '.'], 'F1')
+
+ def test3(self):
+ self.check(['.', 'dir1'], 'F1')
+
+ def test4(self):
+ self.check(['dir1'], 'F2')
+
+ def test5(self):
+ self.check(['dir1', '.'], 'F2')
+
+ def test6(self):
+ self.check(['dir1/dir1'], 'F3')
+
+ def test7(self):
+ self.check(['dir1', 'dir1/dir1'], 'F2')
+
+ def test8(self):
+ self.check(['dir1/dir1', 'dir1'], 'F3')
+
+ def test9(self):
+ self.check('dir1/res.zip', 'F7')
+
+ def test9a(self):
+ self.check('dir1/res.zip/', 'F7')
+
+ def test10(self):
+ self.check('dir1/res.zip/dir1', 'F8')
+
+ def test10a(self):
+ self.check('dir1/res.zip/dir1/', 'F8')
+
+ def test11(self):
+ self.check(['dir1/res.zip/dir1', 'dir1/res.zip'], 'F8')
+
+ def test12(self):
+ self.check(['dir1/res.zip', 'dir1/res.zip/dir1'], 'F7')
+
+ def test12a(self):
+ self.check(['dir1/res.zip', 'dir1/res.zip/dir1/dir1'], 'F7')
+
+ def test12b(self):
+ self.check(['dir1/res.zip/dir1/dir1/', 'dir1/res.zip/dir1'], 'F9')
+
+ def test12c(self):
+ self.check(['dir1/res.zip/dir1/dir1', 'dir1/res.zip/dir1'], 'F9')
+
+ def test13(self):
+ self.check(['dir1', 'dir2'], 'F2')
+
+ def test14(self):
+ self.check(['dir2', 'dir1'], 'F6')
+
+ # path tests
+
+ def test15(self):
+ self.check_file([''], 'dir1/file.txt', 'F2')
+
+ def test15a(self):
+ self.check_file([''], 'dir1/dir1/file.txt', 'F3')
+
+ def test15b(self):
+ self.check_file(['dir1'], 'dir1/file.txt', 'F3')
+
+ def test15c(self):
+ self.check_file([''], 'dir2/file.txt', 'F6')
+
+ def test15d(self):
+ self.check_file(['.'], 'dir2/file.txt', 'F6')
+
+ # zip path tests
+
+ def test16(self):
+ self.check_file(['dir1/res.zip'], 'dir1/file.txt', 'F8')
+
+ def test16a(self):
+ self.check_file(['dir1/res.zip/'], 'dir1/file.txt', 'F8')
+
+ def test16a(self):
+ self.check_file(['dir1/res.zip/'], 'dir1/dir1/file.txt', 'F9')
+
+ def test16b(self):
+ self.check_file(['dir1/res.zip/dir1'], 'dir1/file.txt', 'F9')
+
+ def test16c(self):
+ self.check_file(['dir1/res.zip/dir1/'], 'dir1/file.txt', 'F9')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/test_toplevel_imports.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/test_toplevel_imports.py
new file mode 100644
index 0000000..da8def1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/test_toplevel_imports.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+
+'''Test that all public modules are accessible after importing just 'pyglet'.
+
+This _must_ be the first test run.
+'''
+
+import imp
+import unittest
+
+import pyglet
+
+modules = [
+ 'app',
+ 'clock',
+ 'event',
+ 'font',
+ 'font.base',
+ 'gl',
+ 'gl.gl_info',
+ 'gl.glu_info',
+ 'graphics',
+ 'graphics.allocation',
+ 'graphics.vertexattribute',
+ 'graphics.vertexbuffer',
+ 'graphics.vertexdomain',
+ 'image',
+ 'image.atlas',
+ 'input',
+ 'media',
+ 'resource',
+ 'sprite',
+ 'text',
+ 'text.caret',
+ 'text.document',
+ 'text.layout',
+ 'text.runlist',
+ 'window',
+ 'window.event',
+ 'window.key',
+ 'window.mouse',
+]
+
+def add_module_tests(name, bases, dict):
+ for module in modules:
+ components = module.split('.')
+ def create_test(components):
+ def test_module(self):
+ top = pyglet
+ imp.reload(top)
+ for component in components:
+ self.assertTrue(hasattr(top, component),
+ 'Cannot access "%s" in "%s"' % (component, top.__name__))
+ top = getattr(top, component)
+ return test_module
+ test_module = create_test(components)
+ test_name = 'test_%s' % module.replace('.', '_')
+ test_module.__name__ = test_name
+ dict[test_name] = test_module
+ return type.__new__(type, name, bases, dict)
+
+class TEST_CASE(unittest.TestCase):
+ __metaclass__ = add_module_tests
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/text/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/text/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/text/test_empty_document.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/text/test_empty_document.py
new file mode 100644
index 0000000..a20ebbd
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/text/test_empty_document.py
@@ -0,0 +1,45 @@
+import pytest
+
+from pyglet import gl
+from pyglet import graphics
+from pyglet.text import document
+from pyglet.text import layout
+from pyglet import window
+
+
+
+@pytest.fixture(params=[document.UnformattedDocument,
+ document.FormattedDocument])
+def text_window(request):
+ class _TestWindow(window.Window):
+ def __init__(self, doctype, *args, **kwargs):
+ super(_TestWindow, self).__init__(*args, **kwargs)
+
+ self.batch = graphics.Batch()
+ self.document = doctype()
+ self.layout = layout.IncrementalTextLayout(self.document,
+ self.width, self.height, batch=self.batch)
+
+ def on_draw(self):
+ gl.glClearColor(1, 1, 1, 1)
+ self.clear()
+ self.batch.draw()
+
+ def set_bold(self):
+ self.document.set_style(0, len(self.document.text), {"bold": True})
+
+ return _TestWindow(request.param)
+
+
+def test_empty_document(text_window):
+ """Empty text document can be rendered."""
+ text_window.dispatch_events()
+ text_window.close()
+
+
+def test_empty_document_bold(text_window):
+ """Empty text document can be rendered and attributes can be set."""
+ text_window.set_bold()
+ text_window.dispatch_events()
+ text_window.close()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/window/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/window/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/window/test_context_share.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/window/test_context_share.py
new file mode 100644
index 0000000..b6c05a5
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/window/test_context_share.py
@@ -0,0 +1,98 @@
+"""Test that multiple windows share objects by default.
+"""
+
+import unittest
+from ctypes import *
+
+from tests.annotations import Platform, skip_platform
+
+from pyglet import window
+from pyglet.gl import *
+
+@skip_platform(Platform.WINDOWS) # Causes crashes on Windows (issue #48)
+class ContextShareTest(unittest.TestCase):
+ def create_context(self, share):
+ display = window.get_platform().get_default_display()
+ screen = display.get_default_screen()
+ config = screen.get_best_config()
+ return config.create_context(share)
+
+ def test_context_share_list(self):
+ w1 = window.Window(200, 200)
+ try:
+ w1.switch_to()
+ glist = glGenLists(1)
+ glNewList(glist, GL_COMPILE)
+ glLoadIdentity()
+ glEndList()
+ self.assertTrue(glIsList(glist))
+ except:
+ glDeleteLists(glist, 1)
+ w1.close()
+ raise
+
+ w2 = window.Window(200, 200)
+ try:
+ w2.switch_to()
+ self.assertTrue(glIsList(glist))
+ finally:
+ glDeleteLists(glist, 1)
+ w1.close()
+ w2.close()
+
+ def test_context_noshare_list(self):
+ w1 = window.Window(200, 200)
+ try:
+ w1.switch_to()
+ glist = glGenLists(1)
+ glNewList(glist, GL_COMPILE)
+ glLoadIdentity()
+ glEndList()
+ self.assertTrue(glIsList(glist))
+ except:
+ glDeleteLists(glist, 1)
+ w1.close()
+ raise
+
+ w2 = window.Window(200, 200, context=self.create_context(None))
+ try:
+ w2.set_visible(True)
+ w2.switch_to()
+ self.assertTrue(not glIsList(glist))
+ finally:
+ glDeleteLists(glist, 1)
+ w1.close()
+ w2.close()
+
+ def test_context_share_texture(self):
+ w1 = window.Window(200, 200)
+ try:
+ w1.switch_to()
+ textures = c_uint()
+ glGenTextures(1, byref(textures))
+ texture = textures.value
+
+ glBindTexture(GL_TEXTURE_2D, texture)
+ data = (c_ubyte * 4)()
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA,
+ GL_UNSIGNED_BYTE, data)
+ self.assertTrue(glIsTexture(texture))
+ except:
+ w1.close()
+ raise
+
+ w2 = window.Window(200, 200)
+ try:
+ w2.switch_to()
+ self.assertTrue(glIsTexture(texture))
+
+ glDeleteTextures(1, byref(textures))
+ self.assertTrue(not glIsTexture(texture))
+
+ w1.switch_to()
+ self.assertTrue(not glIsTexture(texture))
+
+ finally:
+ w1.close()
+ w2.close()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/window/test_event_sequence.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/window/test_event_sequence.py
new file mode 100644
index 0000000..fdab511
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/window/test_event_sequence.py
@@ -0,0 +1,201 @@
+from future.standard_library import install_aliases
+install_aliases()
+
+from builtins import object
+import queue
+import unittest
+import time
+
+from pyglet import window
+
+
+class EventSequenceFixture(object):
+ def __init__(self, event_loop):
+ self.event_loop = event_loop
+ self.listen_events = []
+ self.received_events = queue.Queue()
+
+ def create_window(self, **kwargs):
+ w = event_loop.create_window(**kwargs)
+ w.push_handlers(self)
+ return w
+
+ def wait_for_events(self, expected_events, incorrect_events):
+ if isinstance(expected_events, (tuple, list)):
+ self.listen_events = expected_events
+ else:
+ self.listen_events = [expected_events]
+
+ while True:
+ # check events
+ self.event_loop.run_event_loop()
+
+ def __getattr__(self, name):
+ if name.startswith('on_'):
+ return self._handle_event
+ else:
+ raise AttributeError()
+
+ def _handle_event(self, name, *args, **kwargs):
+ if name in self.listen_events:
+ q.put((name, args, kwargs))
+ self.event_loop.interrupt_event_loop()
+
+
+class EventSequenceTest(object):
+ """Base for testing event sequences on a window."""
+ next_sequence = 0
+ last_sequence = 0
+ finished = False
+ timeout = 2
+ start_time = time.time()
+
+ def check_sequence(self, sequence, name):
+ if self.next_sequence == 0 and sequence != 0:
+ print('received event before test start:', name)
+ return
+ if sequence == 0:
+ self.start_time = time.time()
+ if not self.finished:
+ if self.next_sequence != sequence:
+ self.failed = 'ERROR: %s out of order' % name
+ else:
+ self.next_sequence += 1
+ if self.next_sequence > self.last_sequence:
+ self.finished = True
+
+ def check(self):
+ self.assertTrue(time.time() - self.start_time < self.timeout,
+ 'Did not receive next expected event: %d' % self.next_sequence)
+ failed = getattr(self, 'failed', None)
+ if failed:
+ self.fail(failed)
+
+
+class WindowShowEventSequenceTest(EventSequenceTest, unittest.TestCase):
+ """Event sequence when hidden window is set to visible."""
+ last_sequence = 3
+
+ def on_resize(self, width, height):
+ self.check_sequence(1, 'on_resize')
+
+ def on_show(self):
+ self.check_sequence(2, 'on_show')
+
+ def on_expose(self):
+ self.check_sequence(3, 'on_expose')
+
+ def test_method(self):
+ window.Window._enable_event_queue = True
+ win = window.Window(visible=False)
+ try:
+ win.dispatch_events()
+ win.push_handlers(self)
+
+ win.set_visible(True)
+ self.check_sequence(0, 'begin')
+ while not win.has_exit and not self.finished:
+ win.dispatch_events()
+ self.check()
+ finally:
+ win.close()
+
+
+class WindowCreateEventSequenceTest(EventSequenceTest, unittest.TestCase):
+ last_sequence = 3
+
+ def on_resize(self, width, height):
+ self.check_sequence(1, 'on_resize')
+
+ def on_show(self):
+ self.check_sequence(2, 'on_show')
+
+ def on_expose(self):
+ self.check_sequence(3, 'on_expose')
+
+ def test_method(self):
+ window.Window._enable_event_queue = True
+ win = window.Window()
+ try:
+ win.push_handlers(self)
+ self.check_sequence(0, 'begin')
+ while not win.has_exit and not self.finished:
+ win.dispatch_events()
+ self.check()
+ finally:
+ win.close()
+
+
+class WindowCreateFullScreenEventSequenceTest(EventSequenceTest, unittest.TestCase):
+ last_sequence = 3
+
+ def on_resize(self, width, height):
+ self.check_sequence(1, 'on_resize')
+
+ def on_show(self):
+ self.check_sequence(2, 'on_show')
+
+ def on_expose(self):
+ self.check_sequence(3, 'on_expose')
+
+ def test_method(self):
+ window.Window._enable_event_queue = True
+ win = window.Window(fullscreen=True)
+ try:
+ win.push_handlers(self)
+ self.check_sequence(0, 'begin')
+ while not win.has_exit and not self.finished:
+ win.dispatch_events()
+ self.check()
+ finally:
+ win.close()
+
+
+class WindowSetFullScreenEventSequenceTest(EventSequenceTest, unittest.TestCase):
+ last_sequence = 2
+
+ def on_resize(self, width, height):
+ self.check_sequence(1, 'on_resize')
+
+ def on_expose(self):
+ self.check_sequence(2, 'on_expose')
+
+ def test_method(self):
+ window.Window._enable_event_queue = True
+ win = window.Window()
+ try:
+ win.dispatch_events()
+
+ win.push_handlers(self)
+ win.set_fullscreen()
+ self.check_sequence(0, 'begin')
+ while not win.has_exit and not self.finished:
+ win.dispatch_events()
+ self.check()
+ finally:
+ win.close()
+
+
+class WindowUnsetFullScreenEventSequenceTest(EventSequenceTest, unittest.TestCase):
+ last_sequence = 2
+
+ def on_resize(self, width, height):
+ self.check_sequence(1, 'on_resize')
+
+ def on_expose(self):
+ self.check_sequence(2, 'on_expose')
+
+ def test_method(self):
+ window.Window._enable_event_queue = True
+ win = window.Window(fullscreen=True)
+ try:
+ win.dispatch_events()
+ win.push_handlers(self)
+
+ win.set_fullscreen(False)
+ self.check_sequence(0, 'begin')
+ while not win.has_exit and not self.finished:
+ win.dispatch_events()
+ self.check()
+ finally:
+ win.close()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/integration/window/test_window_caption.py b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/window/test_window_caption.py
new file mode 100644
index 0000000..8027d16
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/integration/window/test_window_caption.py
@@ -0,0 +1,28 @@
+# encoding: utf-8
+
+import sys
+import pyglet
+
+
+window_captions = [u'テスト.py', u'\u00bfHabla espa\u00f1ol?', 'test']
+
+
+def test_window_caption():
+ """Test that the Window caption is correctly set on instantiation. """
+ for test_caption in window_captions:
+ window = pyglet.window.Window(caption=test_caption)
+ assert window.caption == test_caption
+ window.close()
+
+
+def test_window_caption_from_argv():
+ """Test that the window caption is set from sys.argv[0], if none is explicity set. """
+ for test_caption in window_captions:
+
+ # Override sys.argv[0] so that the file name appears to be the caption:
+ sys.argv[0] = test_caption.encode('utf-8')
+
+ # The window caption should be set to the file name:
+ window = pyglet.window.Window()
+ assert window.caption == test_caption
+ window.close()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/conftest.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/conftest.py
new file mode 100644
index 0000000..67df270
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/conftest.py
@@ -0,0 +1,86 @@
+"""
+py.test hooks for interactive test cases.
+"""
+from __future__ import absolute_import
+import inspect
+import pytest
+
+
+def pytest_collection_modifyitems(items, config):
+ """Determine whether test should be skipped based on command-line options."""
+ sanity = config.getoption('--sanity', False)
+ non_interactive = config.getoption('--non-interactive', False)
+
+ remaining = []
+ deselected = []
+ for item in items:
+ if _skip_item(item, sanity, non_interactive):
+ deselected.append(item)
+ else:
+ remaining.append(item)
+ if deselected:
+ items[:] = remaining
+ config.hook.pytest_deselected(items=deselected)
+
+
+def _skip_item(item, sanity, non_interactive):
+ requires_user_action = item.get_marker('requires_user_action')
+ requires_user_validation = item.get_marker('requires_user_validation')
+ only_interactive = item.get_marker('only_interactive')
+
+ if ((requires_user_action is not None or only_interactive is not None)
+ and (sanity or non_interactive)):
+ return True
+
+ if ((requires_user_validation is not None)
+ and (non_interactive)):
+ return True
+
+ return False
+
+def pytest_runtest_setup(item):
+ # TODO: Remove after migrating tests
+ sanity = item.config.getoption('--sanity', False)
+ non_interactive = item.config.getoption('--non-interactive', False)
+ interactive = not sanity and not non_interactive
+
+ if interactive:
+ _show_test_header(item)
+ _try_set_class_attribute(item, 'interactive', interactive)
+ _try_set_class_attribute(item, 'allow_missing_screenshots', sanity)
+
+def _show_test_header(item):
+ print()
+ print('='*80)
+ print(item.name)
+ print(_get_doc(item))
+ print('-'*80)
+
+def _try_set_class_attribute(item, name, value):
+ if hasattr(item.obj, 'im_class'):
+ if hasattr(item.obj.im_class, name):
+ setattr(item.obj.im_class, name, value)
+
+def _get_doc(item):
+ i = item
+ while i is not None:
+ if hasattr(i, 'obj') and hasattr(i.obj, '__doc__') and i.obj.__doc__ is not None:
+ return inspect.cleandoc(i.obj.__doc__)
+ i = i.parent
+
+def pytest_runtest_makereport(item, call):
+ if call.when == 'call' and call.excinfo is None:
+ _legacy_check_screenshots(item)
+ _commit_screenshots(item)
+
+def _legacy_check_screenshots(item):
+ # TODO: Remove after migrating all tests
+ if hasattr(item, 'obj') and hasattr(item.obj, '__self__'):
+ if hasattr(item.obj.__self__, 'check_screenshots'):
+ item.obj.__self__.check_screenshots()
+
+def _commit_screenshots(item):
+ if hasattr(item.session, 'pending_screenshots'):
+ for fixture in item.session.pending_screenshots:
+ fixture.commit_screenshots()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/font/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/font/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/font/font_test_base.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/font/font_test_base.py
new file mode 100644
index 0000000..5a8850a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/font/font_test_base.py
@@ -0,0 +1,101 @@
+"""
+Interactive tests for pyglet.font
+"""
+import pytest
+
+from pyglet import gl
+from pyglet import font
+
+from tests.base.event_loop import EventLoopFixture
+
+
+class FontFixture(EventLoopFixture):
+ def __init__(self, request):
+ super(FontFixture, self).__init__(request)
+
+ self.draw_baseline = False
+ self.draw_metrics = False
+ self.draw_custom_metrics = None
+
+ self.font = None
+ self.label = None
+
+ def load_font(self,
+ name='',
+ size=24,
+ **options):
+ self.font = font.load(name, size, **options)
+ assert self.font is not None, 'Failed to load font'
+ return self.font
+
+ def create_label(self,
+ text='Quickly brown fox',
+ color=(0, 0, 0, 1),
+ fill_width=False,
+ margin=5,
+ **options):
+
+ assert self.label is None, 'Label already created'
+ if self.font is None:
+ self.load_font()
+
+ if fill_width:
+ options['width'] = self.window.width - 2*margin
+
+ self.label = font.Text(self.font, text, margin, 200, color=color, **options)
+ return self.label
+
+ def on_draw(self):
+ super(FontFixture, self).on_draw()
+ self._draw_baseline()
+ self.label.draw()
+ self._draw_metrics()
+ self._draw_custom_metrics()
+
+ def _draw_baseline(self):
+ if self.draw_baseline:
+ gl.glColor3f(0, 0, 0)
+ gl.glBegin(gl.GL_LINES)
+ gl.glVertex2f(0, 200)
+ gl.glVertex2f(self.window.width, 200)
+ gl.glEnd()
+
+ def _draw_metrics(self):
+ if self.draw_metrics:
+ self._draw_box(self.label.x,
+ self.label.y+self.font.descent,
+ self.label.width,
+ self.font.ascent-self.font.descent)
+
+ def _draw_custom_metrics(self):
+ if self.draw_custom_metrics is not None:
+ assert len(self.draw_custom_metrics) == 2
+ self._draw_box(self.label.x,
+ self.label.y+self.font.descent,
+ *self.draw_custom_metrics)
+
+ def _draw_box(self, x, y, w, h):
+ gl.glBegin(gl.GL_LINES)
+ gl.glColor3f(0, 1, 0)
+ gl.glVertex2f(x, y)
+ gl.glVertex2f(x, y+h)
+ gl.glColor3f(1, 0, 0)
+ gl.glVertex2f(x, y+h)
+ gl.glVertex2f(x+w, y+h)
+ gl.glColor3f(0, 0, 1)
+ gl.glVertex2f(x+w, y+h)
+ gl.glVertex2f(x+w, y)
+ gl.glColor3f(1, 0, 1)
+ gl.glVertex2f(x+w, y)
+ gl.glVertex2f(x, y)
+ gl.glEnd()
+
+ def test_font(self, question, **kwargs):
+ self.create_window(**kwargs)
+ self.ask_question(question)
+
+
+@pytest.fixture
+def font_fixture(request):
+ return FontFixture(request)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/font/test_font.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/font/test_font.py
new file mode 100644
index 0000000..0737d94
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/font/test_font.py
@@ -0,0 +1,203 @@
+"""
+Test font loading and rendering.
+"""
+import pytest
+
+import pyglet
+from pyglet import font
+from tests.annotations import Platform
+from .font_test_base import font_fixture
+
+
+@pytest.mark.parametrize('question,color', [
+ ('Default font should appear at 0.3 opacity (faint grey)', (0, 0, 0, 0.3)),
+ ('Text should not be visible due to opacity 0.0', (0, 0, 0, 0)),
+ ('Default font should appear at full opacity (black)', (0, 0, 0, 1)),
+ ('Default font should appear blue', (0, 0, 1, 1)),
+ ('Default font should appear red', (1, 0, 0, 1)),
+ ])
+def test_color(font_fixture, question, color):
+ """Test that font colour is applied correctly."""
+ font_fixture.create_window()
+ font_fixture.create_label(
+ color=color
+ )
+ font_fixture.ask_question(question)
+
+
+def test_default_font(font_fixture):
+ """Test that a font with no name given still renders using some sort
+ of default system font.
+ """
+ font_fixture.create_window()
+ font_fixture.load_font(
+ name=''
+ )
+ font_fixture.create_label()
+ font_fixture.ask_question(
+ 'Font should be rendered using a default system font'
+ )
+
+
+def test_system_font(font_fixture):
+ """Test that a font likely to be installed on the computer can be
+ loaded and displayed correctly.
+
+ One window will open, it should show "Quickly brown fox" at 24pt using:
+
+ * "Helvetica" on Mac OS X
+ * "Arial" on Windows
+ * "Arial" on Linux
+ """
+
+ if pyglet.compat_platform in Platform.OSX:
+ font_name = 'Helvetica'
+ elif pyglet.compat_platform in Platform.WINDOWS:
+ font_name = 'Arial'
+ else:
+ font_name = 'Arial'
+
+ font_fixture.create_window()
+ font_fixture.load_font(
+ name=font_name
+ )
+ font_fixture.create_label()
+ font_fixture.ask_question(
+ '"Quickly brown fox" should be shown at 24pt using font ' + font_name
+ )
+
+
+def test_bullet_glyphs(font_fixture):
+ """Test that rendering of unicode glyphs works."""
+
+ font_fixture.create_window()
+ font_fixture.load_font(
+ size=60
+ )
+ font_fixture.create_label(
+ text=u'\u2022'*5,
+ )
+ font_fixture.ask_question(
+ 'You should see 5 bullet glyphs.'
+ )
+
+
+def test_large_font(font_fixture):
+ "Render a font using a very large size. Tests issue 684."
+
+ font_fixture.create_window(
+ width=1000,
+ height=400,
+ )
+ font_fixture.load_font(
+ name='Arial',
+ size=292,
+ )
+ font_fixture.create_label(
+ text='trawant',
+ )
+ font_fixture.ask_question(
+ 'Is the word "trawant" rendered in a large font?'
+ )
+
+
+@pytest.mark.parametrize('font_desc,font_file, font_options', [
+ ('regular', 'action_man.ttf', {}),
+ ('bold', 'action_man_bold.ttf', {'bold':True}),
+ ('italic', 'action_man_italic.ttf', {'italic':True}),
+ ('bold italic', 'action_man_bold_italic.ttf', {'bold':True, 'italic':True})
+ ])
+def test_add_font(font_fixture, test_data, font_desc, font_file, font_options):
+ """Test that a font distributed with the application can be displayed.
+
+ Four lines of text should be displayed, each in a different variant
+ (bold/italic/regular) of Action Man at 24pt. The Action Man fonts are
+ included in the test data directory (tests/data/fonts) as action_man*.ttf.
+ """
+ font.add_file(test_data.get_file('fonts', font_file))
+ font_fixture.create_window()
+ font_fixture.load_font(
+ name='Action Man',
+ **font_options
+ )
+ font_fixture.create_label()
+ font_fixture.ask_question(
+ """You should see {} style Action Man at 24pt.""".format(font_desc)
+ )
+
+@pytest.mark.parametrize('font_name,text', [
+ ('Action man', 'Action Man'),
+ ('Action man', 'Action Man longer test with more words'),
+ ('Arial', 'Arial'),
+ ('Arial', 'Arial longer test with more words'),
+ ('Times New Roman', 'Times New Roman'),
+ ('Times New Roman', 'Times New Roman longer test with more words'),
+ ])
+def test_horizontal_metrics(font_fixture, test_data, font_name, text):
+ """Test that the horizontal font metrics are calculated correctly.
+
+ Some text in various fonts will be displayed. Green vertical lines mark
+ the left edge of the text. Blue vertical lines mark the right edge of the
+ text.
+ """
+ font.add_file(test_data.get_file('fonts', 'action_man.ttf'))
+ question=("The green vertical lines should match the left edge of the text"
+ + "and the blue vertical lines should match the right edge of the text.")
+ font_fixture.create_window(
+ width=600,
+ )
+ font_fixture.draw_metrics = True
+ font_fixture.load_font(
+ name=font_name,
+ size=16,
+ )
+ font_fixture.create_label(
+ text=text,
+ )
+ font_fixture.ask_question(
+ question,
+ )
+
+def test_metrics_workaround(font_fixture, test_data):
+ """Test workaround for font missing metrics.
+
+ Font should fit between top and bottom lines.
+ """
+ font.add_file(test_data.get_file('fonts', 'courR12-ISO8859-1.pcf'))
+ font_fixture.create_window(
+ width=600,
+ )
+ font_fixture.draw_metrics = True
+ font_fixture.load_font(
+ name='Courier',
+ size=16,
+ )
+ font_fixture.create_label(
+ text='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',
+ )
+ font_fixture.ask_question(
+ 'The text should fit between the top and bottom lines',
+ )
+
+@pytest.mark.parametrize('dpi,width,height', [
+ (120, 169, 23),
+ (100, 138, 19),
+ (160, 226, 30),
+ ])
+def test_dpi(font_fixture, test_data, dpi, width, height):
+ font.add_file(test_data.get_file('fonts', 'action_man.ttf'))
+ question=("The green vertical lines should match the left edge of the text"
+ + "and the blue vertical lines should match the right edge of the text.")
+ font_fixture.create_window()
+ font_fixture.draw_custom_metrics = width, height
+ font_fixture.load_font(
+ name='Action Man',
+ size=16,
+ dpi=dpi,
+ )
+ font_fixture.create_label(
+ text='The DPI is {}'.format(dpi),
+ )
+ font_fixture.ask_question(
+ question,
+ )
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/font/test_text_label.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/font/test_text_label.py
new file mode 100644
index 0000000..011ad98
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/font/test_text_label.py
@@ -0,0 +1,86 @@
+"""
+Tests for the basic font.Text label.
+"""
+import pytest
+
+from .font_test_base import font_fixture
+
+
+@pytest.mark.parametrize('halign', [
+ 'left',
+ 'center',
+ 'right',
+ ])
+def test_text_halign(font_fixture, halign):
+ """Test that font.Text horizontal alignment works.
+
+ Three labels will be rendered aligned left, center and right.
+ """
+ font_fixture.create_window()
+ font_fixture.draw_metrics=True,
+ font_fixture.create_label(
+ text=halign.upper(),
+ halign=halign,
+ fill_width=True,
+ margin=1,
+ )
+ font_fixture.ask_question(
+ 'Is the text horizontally {} aligned?'.format(halign),
+ )
+
+@pytest.mark.parametrize('valign,desc', [
+ ('top', 'The line should be above the capitals.'),
+ ('center', 'The line should be in the middle of the capitals.'),
+ ('baseline', 'The line should be at the bottom of the capitals.'),
+ ('bottom', 'The line should be at the bottom of the lower case y.')
+ ])
+def test_text_valign(font_fixture, valign, desc):
+ """Test that font.Text vertical alignment works."""
+ font_fixture.create_window()
+ font_fixture.draw_baseline = True
+ font_fixture.create_label(
+ text=valign.upper() + ' y',
+ valign=valign,
+ )
+ font_fixture.ask_question(
+ 'Is the text vertically {} aligned?\n{}'.format(valign, desc),
+ )
+
+
+@pytest.mark.parametrize('valign,halign', [
+ ('top', 'left'),
+ ('center', 'center'),
+ ('bottom', 'right')
+ ])
+def test_multiline_alignment(font_fixture, valign, halign):
+ """Test horizontal and vertical alignment with multi line text."""
+ font_fixture.create_window(
+ height=500,
+ )
+ font_fixture.create_label(
+ text='This text with multiple lines is aligned {}-{}'.format(valign, halign),
+ halign=halign,
+ valign=valign,
+ fill_width=True,
+ margin=0,
+ )
+ font_fixture.draw_baseline = True
+ font_fixture.ask_question(
+ 'Is the text aligned {}-{}?'.format(valign, halign)
+ )
+
+
+@pytest.mark.parametrize('text,question', [
+ ('TEST TEST', 'TEST TEST should bo on a single line.'),
+ ('SPAM SPAM\nSPAM', 'SPAM should we twice on the first line, once on the second.')
+ ])
+def test_wrap_invariant(font_fixture, text, question):
+ """Test that text will not wrap when its width is set to its calculated width."""
+ font_fixture.create_window()
+ l = font_fixture.create_label(
+ text=text
+ )
+ l.width = l.width + 1
+ font_fixture.ask_question(
+ question
+ )
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/graphics/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/graphics/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/graphics/test_multitexture.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/graphics/test_multitexture.py
new file mode 100644
index 0000000..5f27695
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/graphics/test_multitexture.py
@@ -0,0 +1,100 @@
+"""Tests for multi texturing."""
+
+import pyglet
+from pyglet import gl
+
+import pytest
+
+from tests.base.event_loop import EventLoopFixture
+
+EMPTY = 0
+BLUE_RECTANGLE = 1
+GREEN_DOT = 2
+RED_CIRCLE = 3
+
+
+class MultiTextureFixture(EventLoopFixture):
+ def __init__(self, request, test_data):
+ super(MultiTextureFixture, self).__init__(request)
+ self.test_data = test_data
+
+ def create_window(self, **kwargs):
+ w = super(MultiTextureFixture, self).create_window(**kwargs)
+ self.render()
+ return w
+
+ def render(self):
+ # Enable blending
+ gl.glEnable(gl.GL_BLEND)
+ gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
+
+ # Enable transparency
+ gl.glEnable(gl.GL_ALPHA_TEST)
+ gl.glAlphaFunc(gl.GL_GREATER, .1)
+
+ # Load textures
+ self.texture = pyglet.image.TextureGrid(
+ pyglet.image.ImageGrid(
+ pyglet.image.load(
+ self.test_data.get_file('images', 'multitexture.png')), 1, 4))
+ self.background = pyglet.image.load(
+ self.test_data.get_file('images', 'grey_background.png')).get_texture()
+
+ # Create vertex list showing the multi texture
+ self.vertex_list = pyglet.graphics.vertex_list(4,
+ ('v2f', (32, 332, 64, 332, 64, 364, 32, 364)),
+ ('0t3f', self.texture[1].tex_coords),
+ ('1t3f', self.texture[2].tex_coords),
+ ('2t3f', self.texture[3].tex_coords))
+
+ def on_draw(self):
+ super(MultiTextureFixture, self).on_draw()
+
+ self._bind_texture(0)
+ self._bind_texture(1)
+ self._bind_texture(2)
+ self.vertex_list.draw(gl.GL_QUADS)
+ self._unbind_texture(2)
+ self._unbind_texture(1)
+ self._unbind_texture(0)
+
+ def set_textures(self, texture0=EMPTY, texture1=EMPTY, texture2=EMPTY):
+ self.vertex_list.multi_tex_coords = [self.texture[texture0].tex_coords,
+ self.texture[texture1].tex_coords,
+ self.texture[texture2].tex_coords]
+
+ def _bind_texture(self, i):
+ gl.glActiveTexture((gl.GL_TEXTURE0, gl.GL_TEXTURE1, gl.GL_TEXTURE2)[i])
+ gl.glEnable(gl.GL_TEXTURE_2D)
+ gl.glBindTexture(gl.GL_TEXTURE_2D, self.texture[i].id)
+ gl.glTexEnvf(gl.GL_TEXTURE_ENV, gl.GL_TEXTURE_ENV_MODE, gl.GL_COMBINE)
+ gl.glTexEnvf(gl.GL_TEXTURE_ENV, gl.GL_COMBINE_ALPHA, gl.GL_REPLACE if i == 0 else gl.GL_ADD)
+ gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MIN_FILTER, gl.GL_NEAREST)
+ gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MAG_FILTER, gl.GL_NEAREST)
+
+ def _unbind_texture(self, i):
+ gl.glActiveTexture((gl.GL_TEXTURE0, gl.GL_TEXTURE1, gl.GL_TEXTURE2)[i])
+ gl.glDisable(gl.GL_TEXTURE_2D)
+
+
+@pytest.fixture
+def multi_texture_fixture(request, test_data):
+ return MultiTextureFixture(request, test_data)
+
+
+def test_multitexture(multi_texture_fixture, test_data):
+ 'Verify that multiple textures can be applied to the same object.'
+ w = multi_texture_fixture.create_window(height=400)
+ multi_texture_fixture.set_textures(GREEN_DOT, RED_CIRCLE, EMPTY)
+ multi_texture_fixture.ask_question(
+ 'Do you see a green dot inside a red circle on a white background?',
+ )
+ multi_texture_fixture.set_textures(GREEN_DOT, RED_CIRCLE, BLUE_RECTANGLE)
+ multi_texture_fixture.ask_question(
+ 'Do you see a green dot inside a red circle inside a blue rectangle on a white background?',
+ )
+ multi_texture_fixture.set_textures(RED_CIRCLE, RED_CIRCLE, RED_CIRCLE)
+ multi_texture_fixture.ask_question(
+ 'Do you see a red circle on a white background?',
+ )
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/image/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/image/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/image/test_image.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/image/test_image.py
new file mode 100644
index 0000000..831e289
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/image/test_image.py
@@ -0,0 +1,335 @@
+from __future__ import division
+from io import BytesIO
+import pytest
+
+from pyglet import gl, image
+
+from ...annotations import Platform, require_platform, require_gl_extension
+from ...base.event_loop import EventLoopFixture
+
+
+class ImageTestFixture(EventLoopFixture):
+ def __init__(self, request, test_data):
+ super(ImageTestFixture, self).__init__(request)
+ self.test_data = test_data
+
+ self.show_checkerboard = True
+ self.show_triangle_left = False
+ self.show_text = True
+ self.left_texture = None
+ self.right_texture = None
+
+ self.checkerboard = image.create(32, 32, image.CheckerImagePattern())
+
+ def on_draw(self):
+ # Do not call super class draw, we need to split the clearing and the drawing
+ # the text box.
+ self.clear()
+ self.draw_checkerboard()
+ self.draw_left()
+ self.draw_triangle_left()
+ self.draw_right()
+ if self.show_text:
+ self.draw_text()
+
+ def draw_checkerboard(self):
+ if self.show_checkerboard:
+ gl.glPushMatrix()
+ gl.glScalef(self.window.width/float(self.checkerboard.width),
+ self.window.height/float(self.checkerboard.height),
+ 1.)
+ gl.glMatrixMode(gl.GL_TEXTURE)
+ gl.glPushMatrix()
+ gl.glScalef(self.window.width/float(self.checkerboard.width),
+ self.window.height/float(self.checkerboard.height),
+ 1.)
+ gl.glMatrixMode(gl.GL_MODELVIEW)
+ self.checkerboard.blit(0, 0, 0)
+ gl.glMatrixMode(gl.GL_TEXTURE)
+ gl.glPopMatrix()
+ gl.glMatrixMode(gl.GL_MODELVIEW)
+ gl.glPopMatrix()
+
+ def draw_left(self):
+ if self.left_texture:
+ self.left_texture.blit(
+ self.window.width // 4 - self.left_texture.width // 2,
+ (self.window.height - self.left_texture.height) // 2,
+ 0)
+
+ def draw_right(self):
+ if self.right_texture:
+ x = self.window.width * 3 // 4 - self.right_texture.width // 2
+ x = max((x, self.window.width // 2))
+ self.right_texture.blit(
+ x,
+ (self.window.height - self.right_texture.height) // 2,
+ 0)
+
+ def load_left(self, image_file, decoder=None):
+ self.left_texture = image.load(image_file, decoder=decoder).texture
+
+ def copy_left_to_right(self, encoder=None):
+ buf = BytesIO()
+ self.left_texture.save("file.png",
+ buf,
+ encoder=encoder)
+ buf.seek(0)
+ self.right_texture = image.load("file.png", buf).texture
+
+ def enable_alpha(self):
+ gl.glEnable(gl.GL_BLEND)
+ gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
+
+ def load_right_arb(self, image_file, pixel_format):
+ img = image.load(image_file)
+ img.format = pixel_format
+ img.data # forces conversion
+ self.right_texture = img.texture
+
+ def draw_triangle_left(self):
+ if self.show_triangle_left:
+ w = 200
+ h = 200
+ x = self.window.width // 4 - w // 2
+ y = (self.window.height - h) // 2
+
+ gl.glEnable(gl.GL_DEPTH_TEST)
+ gl.glBegin(gl.GL_TRIANGLES)
+ gl.glColor4f(1, 0, 0, 1)
+ gl.glVertex3f(x, y, -1)
+ gl.glColor4f(0, 1, 0, 1)
+ gl.glVertex3f(x+w, y, 0)
+ gl.glColor4f(0, 0, 1, 1)
+ gl.glVertex3f(x, y+h, 1)
+ gl.glEnd()
+ gl.glDisable(gl.GL_DEPTH_TEST)
+ gl.glColor4f(1, 1, 1, 1)
+
+ def copy_color_buffer(self):
+ self.right_texture = \
+ image.get_buffer_manager().get_color_buffer().texture
+
+ def save_and_load_color_buffer(self):
+ stream = BytesIO()
+ image.get_buffer_manager().get_color_buffer().save('buffer.png', stream)
+ stream.seek(0)
+ self.right_texture = image.load('buffer.png', stream)
+
+ def save_and_load_depth_buffer(self):
+ stream = BytesIO()
+ image.get_buffer_manager().get_depth_buffer().save('buffer.png', stream)
+ stream.seek(0)
+ self.right_texture = image.load('buffer.png', stream)
+
+
+ def test_image_loading(self, decoder, image_name):
+ """Test loading images."""
+ self.create_window(width=800, height=600)
+ self.load_left(self.test_data.get_file("images", image_name), decoder)
+ self.enable_alpha()
+ self.ask_question(
+ "Do you see the {} image on a checkerboard background?".format(image_name)
+ )
+
+ def test_image_saving(self, encoder, image_name):
+ """Test saving images."""
+ self.create_window(width=800, height=600)
+ self.load_left(self.test_data.get_file("images", image_name))
+ self.copy_left_to_right(encoder)
+ self.enable_alpha()
+ self.ask_question(
+ "Do you see the {} image twice on a checkerboard background?".format(image_name)
+ )
+
+@pytest.fixture
+def image_test(request, test_data):
+ return ImageTestFixture(request, test_data)
+
+
+bmp_images = ['rgb_16bpp.bmp', 'rgb_1bpp.bmp', 'rgb_24bpp.bmp', 'rgb_32bpp.bmp', 'rgb_4bpp.bmp',
+ 'rgb_8bpp.bmp', 'rgba_32bpp.bmp']
+dds_images = ['rgba_dxt1.dds', 'rgba_dxt3.dds', 'rgba_dxt5.dds', 'rgb_dxt1.dds']
+png_images = ['la.png', 'l.png', 'rgba.png', 'rgb.png']
+pypng_images = png_images + ['rgb_8bpp.png', 'rgb_8bpp_trans.png']
+gif_images = ['8bpp.gif']
+
+
+def test_checkerboard(image_test):
+ """Test that the checkerboard pattern looks correct."""
+ image_test.create_window()
+ image_test.ask_question(
+ "Do you see a checkboard pattern in two levels of grey?"
+ )
+
+@pytest.mark.parametrize('image_name', bmp_images)
+def test_bmp_loading(image_test, image_name):
+ """Test loading BMP images."""
+ from pyglet.image.codecs.bmp import BMPImageDecoder
+ image_test.test_image_loading(BMPImageDecoder(), image_name)
+
+
+@pytest.mark.parametrize('image_name', dds_images)
+def test_dds_loading(image_test, image_name):
+ """Test loading DDS images."""
+ from pyglet.image.codecs.dds import DDSImageDecoder
+ image_test.test_image_loading(DDSImageDecoder(), image_name)
+
+
+@pytest.mark.parametrize('image_name', png_images)
+def test_pil_loading(image_test, image_name):
+ """Test loading PNG images using PIL"""
+ try:
+ from PIL import Image
+ except ImportError:
+ pytest.skip('PIL not available')
+ from pyglet.image.codecs.pil import PILImageDecoder
+ image_test.test_image_loading(PILImageDecoder(), image_name)
+
+
+@pytest.mark.parametrize('image_name', png_images + gif_images)
+@require_platform(Platform.LINUX)
+def test_gdkpixbuf2_loading(image_test, image_name):
+ """Test loading PNG images using Linux specific GdkPixbuf2."""
+ from pyglet.image.codecs.gdkpixbuf2 import GdkPixbuf2ImageDecoder
+ image_test.test_image_loading(GdkPixbuf2ImageDecoder(), image_name)
+
+
+@pytest.mark.parametrize('image_name', png_images)
+@require_platform(Platform.WINDOWS)
+def test_gdiplus_loading(image_test, image_name):
+ """Test loading PNG images using Windows specific GDI+."""
+ from pyglet.image.codecs.gdiplus import GDIPlusDecoder
+ image_test.test_image_loading(GDIPlusDecoder(), image_name)
+
+
+@pytest.mark.parametrize('image_name', png_images)
+@require_platform(Platform.OSX)
+def test_quartz_loading(image_test, image_name):
+ """Test loading PNG images using OSX specific Quartz."""
+ from pyglet.image.codecs.quartz import QuartzImageDecoder
+ image_test.test_image_loading(QuartzImageDecoder(), image_name)
+
+
+@pytest.mark.parametrize('image_name', png_images)
+@require_platform(Platform.OSX)
+def test_quicktime_loading(image_test, image_name):
+ """Test loading PNG images using OSX specific QuickTime."""
+ from pyglet.image.codecs.quicktime import QuickTimeDecoder
+ image_test.test_image_loading(QuickTimeDecoder(), image_name)
+
+
+@pytest.mark.parametrize('image_name', pypng_images)
+def test_pypng_loading(image_test, image_name):
+ """Test loading PNG images using PyPNG."""
+ from pyglet.image.codecs.png import PNGImageDecoder
+ image_test.test_image_loading(PNGImageDecoder(), image_name)
+
+
+@pytest.mark.parametrize('image_name', png_images)
+def test_pil_saving(image_test, image_name):
+ """Test saving images using PIL."""
+ try:
+ from PIL import Image
+ except ImportError:
+ pytest.skip('PIL not available')
+ from pyglet.image.codecs.pil import PILImageEncoder
+ image_test.test_image_saving(PILImageEncoder(), image_name)
+
+
+@pytest.mark.parametrize('image_name', png_images)
+def test_pypng_saving(image_test, image_name):
+ """Test saving images using PyPNG."""
+ from pyglet.image.codecs.png import PNGImageEncoder
+ image_test.test_image_saving(PNGImageEncoder(), image_name)
+
+
+@pytest.mark.parametrize('image_name', ['rgb.png', 'rgba.png'])
+@require_gl_extension('GL_ARB_imaging')
+def test_arb(image_test, image_name):
+ """Test swapping color channels using the ARB imaging extension."""
+ image_test.create_window()
+ image_test.load_left(image_test.test_data.get_file('images', image_name))
+ image_test.load_right_arb(image_test.test_data.get_file('images', image_name), 'GRB')
+ image_test.ask_question(
+ "In the right image red and green should be swapped."
+ )
+
+
+def test_buffer_copy(image_test):
+ """Test colour buffer copy to texture.
+
+ A scene consisting of a single coloured triangle will be rendered. The
+ colour buffer will then be saved to a stream and loaded as a texture.
+
+ You might see the original scene first shortly before the
+ buffer image appears (because retrieving and saving the image is a slow
+ operation).
+ """
+ image_test.create_window(width=800, height=600)
+ image_test.show_triangle_left = True
+ image_test.show_text = False
+ image_test.show_checkerboard = False
+
+ def step(dt):
+ image_test.copy_color_buffer()
+ image_test.show_text = True
+ return True
+ image_test.schedule_once(step)
+
+ image_test.ask_question(
+ 'You should see the same coloured triangle left and right.'
+ )
+
+def test_buffer_saving(image_test):
+ """Test colour buffer save.
+
+ A scene consisting of a single coloured triangle will be rendered. The
+ colour buffer will then be saved to a stream and loaded as a texture.
+
+ You might see the original scene first shortly before the
+ buffer image appears (because retrieving and saving the image is a slow
+ operation).
+ """
+ image_test.create_window(width=800, height=600)
+ image_test.show_triangle_left = True
+ image_test.show_text = False
+ image_test.show_checkerboard = False
+
+ def step(dt):
+ image_test.save_and_load_color_buffer()
+ image_test.show_text = True
+ return True
+ image_test.schedule_once(step)
+
+ image_test.ask_question(
+ 'You should see the same coloured triangle left and right.'
+ )
+
+def test_depth_buffer_saving(image_test):
+ """Test depth buffer save.
+
+ A scene consisting of a single coloured triangle will be rendered. The
+ depth buffer will then be saved to a stream and loaded as a texture.
+
+ You might see the original scene first for up to several seconds before the
+ depth buffer image appears (because retrieving and saving the image is
+ a slow operation).
+ """
+ image_test.create_window(width=800, height=600)
+ image_test.show_triangle_left = True
+ image_test.show_text = False
+ image_test.show_checkerboard = False
+
+ def step(dt):
+ image_test.save_and_load_depth_buffer()
+ image_test.show_text = True
+ return True
+ image_test.schedule_once(step)
+
+ image_test.ask_question(
+ 'You should see a coloured triangle left and its depth buffer right. '
+ 'The bottom-left corner is lightest, the bottom-right is darker and '
+ 'the top corner is darkest (corresponding the depth of the triangle.'
+ )
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/media/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/media/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/media/test_player.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/media/test_player.py
new file mode 100644
index 0000000..8f43671
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/media/test_player.py
@@ -0,0 +1,131 @@
+"""
+Interactively test the Player in pyglet.media for playing back sounds.
+"""
+import pytest
+from time import sleep
+
+import pyglet
+#pyglet.options['debug_media'] = True
+from pyglet.media.player import Player
+from pyglet.media.sources import procedural
+from pyglet.media.sources.base import StaticSource
+
+
+@pytest.mark.requires_user_validation
+def test_playback(event_loop, test_data):
+ """Test playing back sound files."""
+ player = Player()
+ player.on_player_eos = event_loop.interrupt_event_loop
+ player.play()
+
+ sound = test_data.get_file('media', 'alert.wav')
+ source = pyglet.media.load(sound, streaming=False)
+ player.queue(source)
+ event_loop.run_event_loop()
+
+ event_loop.ask_question('Did you hear the alert sound playing?', screenshot=False)
+
+ sound2 = test_data.get_file('media', 'receive.wav')
+ source2 = pyglet.media.load(sound2, streaming=False)
+ player.queue(source2)
+ player.play()
+ event_loop.run_event_loop()
+
+ event_loop.ask_question('Did you hear the receive sound playing?', screenshot=False)
+
+
+@pytest.mark.requires_user_validation
+def test_playback_fire_and_forget(event_loop, test_data):
+ """Test playing back sound files using fire and forget."""
+ sound = test_data.get_file('media', 'alert.wav')
+ source = pyglet.media.load(sound, streaming=False)
+ source.play()
+
+ event_loop.ask_question('Did you hear the alert sound playing?', screenshot=False)
+
+
+@pytest.mark.requires_user_validation
+def test_play_queue(event_loop):
+ """Test playing a single sound on the queue."""
+ source = procedural.WhiteNoise(1.0)
+ player = Player()
+ player.on_player_eos = event_loop.interrupt_event_loop
+ player.play()
+ player.queue(source)
+ event_loop.run_event_loop()
+
+ event_loop.ask_question('Did you hear white noise for 1 second?', screenshot=False)
+
+@pytest.mark.requires_user_validation
+def test_queue_play(event_loop):
+ """Test putting a single sound on the queue and then starting the player."""
+ source = procedural.WhiteNoise(1.0)
+ player = Player()
+ player.on_player_eos = event_loop.interrupt_event_loop
+ player.queue(source)
+ player.play()
+ event_loop.run_event_loop()
+
+ event_loop.ask_question('Did you hear white noise for 1 second?', screenshot=False)
+
+@pytest.mark.requires_user_validation
+def test_pause_queue(event_loop):
+ """Test the queue is not played when player is paused."""
+ source = procedural.WhiteNoise(1.0)
+ player = Player()
+ player.pause()
+ player.queue(source)
+
+ # Run for the duration of the sound
+ event_loop.run_event_loop(1.0)
+
+ event_loop.ask_question('Did you not hear any sound?', screenshot=False)
+
+@pytest.mark.requires_user_validation
+def test_pause_sound(event_loop):
+ """Test that a playing sound can be paused."""
+ source = procedural.WhiteNoise(60.0)
+ player = Player()
+ player.queue(source)
+ player.play()
+
+ event_loop.run_event_loop(1.0)
+ player.pause()
+ event_loop.ask_question('Did you hear white noise for 1 second and is it now silent?',
+ screenshot=False)
+
+ player.play()
+ event_loop.ask_question('Do you hear white noise again?', screenshot=False)
+
+ player.delete()
+ event_loop.ask_question('Is it silent again?', screenshot=False)
+
+@pytest.mark.requires_user_validation
+def test_next_on_end_of_stream(event_loop):
+ """Test that multiple items on the queue are played after each other."""
+ source1 = procedural.WhiteNoise(1.0)
+ source2 = procedural.Sine(1.0)
+ player = Player()
+ player.on_player_eos = event_loop.interrupt_event_loop
+ player.queue(source1)
+ player.queue(source2)
+ player.play()
+
+ event_loop.run_event_loop()
+ event_loop.ask_question('Did you hear white noise for 1 second and then a tone at 440 Hz'
+ '(A above middle C)?', screenshot=False)
+
+@pytest.mark.requires_user_validation
+def test_static_source_wrapping(event_loop):
+ """Test that a sound can be recursively wrappend inside a static source."""
+ source = procedural.WhiteNoise(1.0)
+ source = StaticSource(source)
+ source = StaticSource(source)
+ player = Player()
+ player.on_player_eos = event_loop.interrupt_event_loop
+ player.queue(source)
+ player.play()
+
+ event_loop.run_event_loop()
+ event_loop.ask_question('Did you hear white noise for 1 seconds?', screenshot=False)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/screenshots/committed/README b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/screenshots/committed/README
new file mode 100644
index 0000000..20d0f2f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/screenshots/committed/README
@@ -0,0 +1 @@
+This directory will contain committed screenshots for testing regressions.
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/screenshots/session/README b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/screenshots/session/README
new file mode 100644
index 0000000..d77ca95
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/screenshots/session/README
@@ -0,0 +1 @@
+This directory will contain screenshots from the latest (current) test session.
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_content_valign.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_content_valign.py
new file mode 100644
index 0000000..f2ed186
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_content_valign.py
@@ -0,0 +1,97 @@
+import pytest
+from tests.base.interactive import InteractiveTestCase
+
+from pyglet import app
+from pyglet import gl
+from pyglet import graphics
+from pyglet import text
+from pyglet.text import caret
+from pyglet.text import layout
+from pyglet import window
+from pyglet.window import key, mouse
+
+doctext = """test_content_valign.py test document.
+
+Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas aliquet quam sit amet enim. Donec iaculis, magna vitae imperdiet convallis, lectus sem ultricies nulla, non fringilla quam felis tempus velit. Etiam et velit. Integer euismod. Aliquam a diam. Donec sed ante. Mauris enim pede, dapibus sed, dapibus vitae, consectetuer in, est. Donec aliquam risus eu ipsum. Integer et tortor. Ut accumsan risus sed ante.
+
+Aliquam dignissim, massa a imperdiet fermentum, orci dolor facilisis ante, ut vulputate nisi nunc sed massa. Morbi sodales hendrerit tortor. Nunc id tortor ut lacus mollis malesuada. Sed nibh tellus, rhoncus et, egestas eu, laoreet eu, urna. Vestibulum massa leo, convallis et, pharetra vitae, iaculis at, ante. Pellentesque volutpat porta enim. Morbi ac nunc eget mi pretium viverra. Pellentesque felis risus, lobortis vitae, malesuada vitae, bibendum eu, tortor. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Phasellus dapibus tortor ac neque. Curabitur pulvinar bibendum lectus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam tellus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla turpis leo, rhoncus vel, euismod non, consequat sed, massa. Quisque ultricies. Aliquam fringilla faucibus est. Proin nec felis eget felis suscipit vehicula.
+
+Etiam quam. Aliquam at ligula. Aenean quis dolor. Suspendisse potenti. Sed lacinia leo eu est. Nam pede ligula, molestie nec, tincidunt vel, posuere in, tellus. Donec fringilla dictum dolor. Aenean tellus orci, viverra id, vehicula eget, tempor a, dui. Morbi eu dolor nec lacus fringilla dapibus. Nulla facilisi. Nulla posuere. Nunc interdum. Donec convallis libero vitae odio.
+
+Aenean metus lectus, faucibus in, malesuada at, fringilla nec, risus. Integer enim. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin bibendum felis vel neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec ipsum dui, euismod at, dictum eu, congue tincidunt, urna. Sed quis odio. Integer aliquam pretium augue. Vivamus nonummy, dolor vel viverra rutrum, lacus dui congue pede, vel sodales dui diam nec libero. Morbi et leo sit amet quam sollicitudin laoreet. Vivamus suscipit.
+
+Duis arcu eros, iaculis ut, vehicula in, elementum a, sapien. Phasellus ut tellus. Integer feugiat nunc eget odio. Morbi accumsan nonummy ipsum. Donec condimentum, tortor non faucibus luctus, neque mi mollis magna, nec gravida risus elit nec ipsum. Donec nec sem. Maecenas varius libero quis diam. Curabitur pulvinar. Morbi at sem eget mauris tempor vulputate. Aenean eget turpis.
+"""
+
+class TestWindow(window.Window):
+ def __init__(self, content_valign, *args, **kwargs):
+ super(TestWindow, self).__init__(*args, **kwargs)
+
+ self.batch = graphics.Batch()
+ self.document = text.decode_text(doctext)
+ self.margin = 2
+ self.layout = layout.IncrementalTextLayout(self.document,
+ self.width - self.margin * 2, self.height - self.margin * 2,
+ multiline=True,
+ batch=self.batch)
+ self.layout.content_valign = content_valign
+ self.caret = caret.Caret(self.layout)
+ self.push_handlers(self.caret)
+
+ self.set_mouse_cursor(self.get_system_mouse_cursor('text'))
+
+ def on_resize(self, width, height):
+ super(TestWindow, self).on_resize(width, height)
+ self.layout.begin_update()
+ self.layout.x = self.margin
+ self.layout.y = self.margin
+ self.layout.width = width - self.margin * 2
+ self.layout.height = height - self.margin * 2
+ self.layout.end_update()
+
+ def on_mouse_scroll(self, x, y, scroll_x, scroll_y):
+ self.layout.view_x -= scroll_x
+ self.layout.view_y += scroll_y * 16
+
+ def on_draw(self):
+ gl.glClearColor(1, 1, 1, 1)
+ self.clear()
+ self.batch.draw()
+
+ def on_key_press(self, symbol, modifiers):
+ super(TestWindow, self).on_key_press(symbol, modifiers)
+ if symbol == key.TAB:
+ self.caret.on_text('\t')
+
+@pytest.mark.requires_user_action
+class ContentValignTestCase(InteractiveTestCase):
+ def test_content_valign_bottom(self):
+ """Test content_valign = 'bottom' property of IncrementalTextLayout.
+
+ Examine and type over the text in the window that appears. The window
+ contents can be scrolled with the mouse wheel. When the content height
+ is less than the window height, the content should be aligned to the bottom
+ of the window.
+
+ Press ESC to exit the test.
+ """
+ self.window = TestWindow(resizable=True, visible=False, content_valign='bottom')
+ self.window.set_visible()
+ app.run()
+ self.user_verify('Test passed?', take_screenshot=False)
+
+ def test_content_valign_center(self):
+ """Test content_valign = 'center' property of IncrementalTextLayout.
+
+ Examine and type over the text in the window that appears. The window
+ contents can be scrolled with the mouse wheel. When the content height
+ is less than the window height, the content should be aligned to the center
+ of the window.
+
+ Press ESC to exit the test.
+ """
+ self.window = TestWindow(resizable=True, visible=False, content_valign='center')
+ self.window.set_visible()
+ app.run()
+ self.user_verify('Test passed?', take_screenshot=False)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_html.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_html.py
new file mode 100644
index 0000000..e4e30b3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_html.py
@@ -0,0 +1,243 @@
+import pytest
+from tests.base.interactive import InteractiveTestCase
+
+import pyglet
+from pyglet.text import caret, document, layout
+
+doctext = """
+
+
+ (metadata including title is not displayed.)
+ Test document
+
+
+
+
This paragraph uses relative sizes: size 5size 3
+
+
Font color changes to red, green and pastel blue using a
+ hexidecimal number.
+
+
This text is underlined. This text is
+ underlined and green.
+
+
Heading 1
+
Heading 2
+
Heading 3
+
Heading 4
+
Heading 5
+
Heading 6
+
+
Centered paragraph.
+
+
Right-aligned paragraph.
+
+
<div> element instead of paragraph.
+
This sentence should start a new paragraph, as the div is nested.
+
+ This sentence should start a new paragraph, as the nested div was
+ closed.
+
+
+
This text is preformatted.
+Hard line breaks
+ Indentation. Inline formatting is still ok.
+
+
This paragraph
+ has a
+ line break
+ after every
+ two words.
+
+
This paragraph is blockquote. Lorem ipsum dolor sit amet,
+ consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
+ et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
+ ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
+ dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
+ nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
+ culpa qui officia deserunt mollit anim id est laborum.
+
+
Nested blockquote. Lorem ipsum dolor sit amet,
+ consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
+ et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
+ ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
+ dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
+ nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
+ culpa qui officia deserunt mollit anim id est laborum.
+
+
+
+ Here is a quotation. The previous paragraph mentioned, Lorem ipsum
+ dolor sit amet, ....
+
+
+
+ Unordered list, level 1. Lorem ipsum dolor sit amet, consectetur
+ adipisicing elit, sed do eiusmod tempor incididunt ut labore et
+ dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
+ exercitation ullamco laboris nisi ut aliquip ex ea commodo
+ consequat.
+
+ Item 2. Lorem ipsum dolor sit amet, consectetur
+ adipisicing elit, sed do eiusmod tempor incididunt ut labore et
+ dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
+ exercitation ullamco laboris nisi ut aliquip ex ea commodo
+ consequat.
+
+ Item 3. Lorem ipsum dolor sit amet, consectetur
+ adipisicing elit, sed do eiusmod tempor incididunt ut labore et
+ dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
+ exercitation ullamco laboris nisi ut aliquip ex ea commodo
+ consequat.
+
+
+
+ A nested list. Lorem ipsum dolor sit amet, consectetur
+ adipisicing elit, sed do eiusmod tempor incididunt ut
+ labore et dolore magna aliqua. Ut enim ad minim veniam,
+ quis nostrud exercitation ullamco laboris nisi ut aliquip
+ ex ea commodo consequat.
+
+ Item 3.2. Lorem ipsum dolor sit amet, consectetur
+ adipisicing elit, sed do eiusmod tempor incididunt ut
+ labore et dolore magna aliqua.
+
+
+
+
+
+
Unordered list with circle bullets.
+
Item 2.
+
+
+
+
Unordered list with square bullets.
+
Item 2.
+
+
+
+
Numbered list.
+
Item 2.
+
Item 3.
+
Item 10
+
Item 11
+
+
+
+
Numbered list starting at 12.
+
Item 13.
+
+
+
+
Numbered list with "a" type
+
Item 2
+
Item 3
+
+
+
+
Numbered list with "A" type
+
Item 2
+
Item 3
+
+
+
+
Numbered list with "i" type
+
Item 2
+
Item 3
+
+
+
+
Numbered list with "I" type
+
Item 2
+
Item 3
+
+
+ Here's a definition list:
+
+
+
Term
+
Definition.
+
Term
+
Definition.
+
Term
+
Definition.
+
+
+
+
+"""
+
+class TestWindow(pyglet.window.Window):
+ def __init__(self, *args, **kwargs):
+ super(TestWindow, self).__init__(*args, **kwargs)
+
+ self.batch = pyglet.graphics.Batch()
+ self.document = pyglet.text.decode_html(doctext)
+ self.margin = 2
+ self.layout = layout.IncrementalTextLayout(self.document,
+ self.width - self.margin * 2, self.height - self.margin * 2,
+ multiline=True,
+ batch=self.batch)
+ self.caret = caret.Caret(self.layout)
+ self.push_handlers(self.caret)
+
+ self.set_mouse_cursor(self.get_system_mouse_cursor('text'))
+
+ def on_resize(self, width, height):
+ super(TestWindow, self).on_resize(width, height)
+ self.layout.begin_update()
+ self.layout.x = self.margin
+ self.layout.y = self.margin
+ self.layout.width = width - self.margin * 2
+ self.layout.height = height - self.margin * 2
+ self.layout.end_update()
+
+ def on_mouse_scroll(self, x, y, scroll_x, scroll_y):
+ self.layout.view_x -= scroll_x
+ self.layout.view_y += scroll_y * 16
+
+ def on_draw(self):
+ pyglet.gl.glClearColor(1, 1, 1, 1)
+ self.clear()
+ self.batch.draw()
+
+ def on_key_press(self, symbol, modifiers):
+ super(TestWindow, self).on_key_press(symbol, modifiers)
+ if symbol == pyglet.window.key.TAB:
+ self.caret.on_text('\t')
+
+
+@pytest.mark.requires_user_action
+class HtmlTestCase(InteractiveTestCase):
+ """Test that HTML data is decoded into a formatted document.
+
+ Press ESC to exit the test.
+ """
+ def test_html(self):
+ self.window = TestWindow(resizable=True, visible=False)
+ self.window.set_visible()
+ pyglet.app.run()
+ self.user_verify('Pass test?', take_screenshot=False)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_inline_elements.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_inline_elements.py
new file mode 100644
index 0000000..b57944c
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_inline_elements.py
@@ -0,0 +1,153 @@
+from builtins import range
+import pytest
+from tests.base.interactive import InteractiveTestCase
+
+import pyglet
+from pyglet.text import caret, document, layout
+
+doctext = """ELEMENT.py test document.
+
+Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce venenatis
+pharetra libero. Phasellus lacinia nisi feugiat felis. Sed id magna in nisl
+cursus consectetuer. Aliquam aliquam lectus eu magna. Praesent sit amet ipsum
+vitae nisl mattis commodo. Aenean pulvinar facilisis lectus. Phasellus sodales
+risus sit amet lectus. Suspendisse in turpis. Vestibulum ac mi accumsan eros
+commodo tincidunt. Nullam velit. In pulvinar, dui sit amet ullamcorper dictum,
+dui risus ultricies nisl, a dignissim sapien enim sit amet tortor.
+Pellentesque fringilla, massa sit amet bibendum blandit, pede leo commodo mi,
+eleifend feugiat neque tortor dapibus mauris. Morbi nunc arcu, tincidunt vel,
+blandit non, iaculis vel, libero. Vestibulum sed metus vel velit scelerisque
+varius. Vivamus a tellus. Proin nec orci vel elit molestie venenatis. Aenean
+fringilla, lorem vel fringilla bibendum, nibh mi varius mi, eget semper ipsum
+ligula ut urna. Nullam tempor convallis augue. Sed at dui.
+
+Nunc faucibus pretium ipsum. Sed ultricies ligula a arcu. Pellentesque vel
+urna in augue euismod hendrerit. Donec consequat. Morbi convallis nulla at
+ante bibendum auctor. In augue mi, tincidunt a, porta ac, tempor sit amet,
+sapien. In sollicitudin risus. Vivamus leo turpis, elementum sed, accumsan eu,
+scelerisque at, augue. Ut eu tortor non sem vulputate bibendum. Fusce
+ultricies ultrices lorem. In hac habitasse platea dictumst. Morbi ac ipsum.
+Nam tellus sem, congue in, fermentum a, ullamcorper vel, mauris. Etiam erat
+tortor, facilisis ut, blandit id, placerat sed, orci. Donec quam eros,
+bibendum eu, ultricies id, mattis eu, tellus. Ut hendrerit erat vel ligula.
+Sed tellus. Quisque imperdiet ornare diam.
+
+Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac
+turpis egestas. Sed neque quam, pretium et, malesuada sed, porttitor eu, leo.
+Sed varius ornare augue. Maecenas pede dui, nonummy eu, ullamcorper sed,
+lobortis id, sem. In sed leo. Nulla ornare. Curabitur dui. Cras ipsum. Cras
+massa augue, sodales nec, ultricies at, fermentum in, turpis. Aenean lorem
+lectus, fermentum et, lacinia quis, ullamcorper ac, purus. Pellentesque
+pharetra diam at elit. Donec dolor. Aenean turpis orci, aliquam vitae,
+fermentum et, consectetuer sed, lacus. Maecenas pulvinar, nisi sit amet
+lobortis rhoncus, est ipsum ullamcorper mauris, nec cursus felis neque et
+dolor. Nulla venenatis sapien vitae lectus. Praesent in risus. In imperdiet
+adipiscing nisi. Quisque volutpat, ante sed vehicula sodales, nisi quam
+bibendum turpis, id bibendum pede enim porttitor tellus. Aliquam velit.
+Pellentesque at mauris quis libero fermentum cursus.
+
+Integer bibendum scelerisque elit. Curabitur justo tellus, vehicula luctus,
+consequat vitae, convallis quis, nunc. Fusce libero nulla, convallis eu,
+dignissim sit amet, sagittis ac, odio. Morbi dictum tincidunt nisi. Curabitur
+hendrerit. Aliquam eleifend sodales leo. Donec interdum. Nam vulputate, purus
+in euismod bibendum, pede mi pellentesque dolor, at viverra quam tellus eget
+pede. Suspendisse varius mi id felis. Aenean in velit eu nisi suscipit mollis.
+Suspendisse vitae augue et diam volutpat luctus.
+
+Mauris et lorem. In mauris. Morbi commodo rutrum nibh. Pellentesque lobortis.
+Sed eget urna ut massa venenatis luctus. Morbi egestas purus eget ante
+pulvinar vulputate. Suspendisse sollicitudin. Cras tortor erat, semper
+vehicula, suscipit non, facilisis ut, est. Aenean quis libero varius nisl
+fringilla mollis. Donec viverra. Phasellus mi tortor, pulvinar id, pulvinar
+in, lacinia nec, massa. Curabitur lectus erat, volutpat at, volutpat at,
+pharetra nec, turpis. Donec ornare nonummy leo. Donec consectetuer posuere
+metus. Quisque tincidunt risus facilisis dui. Ut suscipit turpis in massa.
+Aliquam erat volutpat.
+"""
+
+
+class TestElement(document.InlineElement):
+ vertex_list = None
+
+ def place(self, layout, x, y):
+ self.vertex_list = layout.batch.add(4, pyglet.gl.GL_QUADS,
+ layout.top_group,
+ 'v2i',
+ ('c4B', [200, 200, 200, 255] * 4))
+
+ y += self.descent
+ w = self.advance
+ h = self.ascent - self.descent
+ self.vertex_list.vertices[:] = (x, y,
+ x + w, y,
+ x + w, y + h,
+ x, y + h)
+ def remove(self, layout):
+ self.vertex_list.delete()
+ del self.vertex_list
+
+
+class TestWindow(pyglet.window.Window):
+ def __init__(self, *args, **kwargs):
+ super(TestWindow, self).__init__(*args, **kwargs)
+
+ self.batch = pyglet.graphics.Batch()
+ self.document = pyglet.text.decode_attributed(doctext)
+ for i in range(0, len(doctext), 300):
+ self.document.insert_element(i, TestElement(60, -10, 70))
+ self.margin = 2
+ self.layout = layout.IncrementalTextLayout(self.document,
+ self.width - self.margin * 2, self.height - self.margin * 2,
+ multiline=True,
+ batch=self.batch)
+ self.caret = caret.Caret(self.layout)
+ self.push_handlers(self.caret)
+
+ self.set_mouse_cursor(self.get_system_mouse_cursor('text'))
+
+ def on_resize(self, width, height):
+ super(TestWindow, self).on_resize(width, height)
+ self.layout.begin_update()
+ self.layout.x = self.margin
+ self.layout.y = self.margin
+ self.layout.width = width - self.margin * 2
+ self.layout.height = height - self.margin * 2
+ self.layout.end_update()
+
+ def on_mouse_scroll(self, x, y, scroll_x, scroll_y):
+ self.layout.view_x -= scroll_x
+ self.layout.view_y += scroll_y * 16
+
+ def on_draw(self):
+ pyglet.gl.glClearColor(1, 1, 1, 1)
+ self.clear()
+ self.batch.draw()
+
+ def on_key_press(self, symbol, modifiers):
+ super(TestWindow, self).on_key_press(symbol, modifiers)
+ if symbol == pyglet.window.key.TAB:
+ self.caret.on_text('\t')
+
+
+@pytest.mark.requires_user_action
+class InlineElementTestCase(InteractiveTestCase):
+ """Test that inline elements are positioned correctly and are repositioned
+ within an incremental layout.
+
+ Examine and type over the text in the window that appears. There are several
+ elements drawn with grey boxes. These should maintain their sizes and
+ relative document positions as the text is scrolled and edited.
+
+ Press ESC to exit the test.
+ """
+ def test_inline_elements(self):
+ self.window = None
+ try:
+ self.window = TestWindow(resizable=True, visible=False)
+ self.window.set_visible()
+ pyglet.app.run()
+ self.user_verify('Pass test?', take_screenshot=False)
+ finally:
+ if self.window:
+ self.window.close()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_inline_elements_style_change.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_inline_elements_style_change.py
new file mode 100644
index 0000000..aebc742
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_inline_elements_style_change.py
@@ -0,0 +1,109 @@
+import pytest
+from tests.base.interactive import InteractiveTestCase
+
+import pyglet
+from pyglet.text import caret, document, layout
+
+doctext = """ELEMENT.py test document.
+
+PLACE CURSOR AT THE END OF THE ABOVE LINE, AND DELETE ALL ITS TEXT,
+BY PRESSING THE DELETE KEY REPEATEDLY.
+
+IF THIS WORKS OK, AND THE ELEMENT (GRAY RECTANGLE) WITHIN THIS LINE
+[element here]
+REMAINS VISIBLE BETWEEN THE SAME CHARACTERS, WITH NO ASSERTIONS PRINTED TO
+THE CONSOLE, THE TEST PASSES.
+
+(In code with bug 538, the element sometimes moves within the text, and
+eventually there is an assertion failure. Note that there is another bug,
+unrelated to this one, which sometimes causes the first press of the delete
+key to be ignored.)
+
+Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce venenatis
+pharetra libero. Phasellus lacinia nisi feugiat felis. Sed id magna in nisl
+cursus consectetuer. Aliquam aliquam lectus eu magna. Praesent sit amet ipsum
+vitae nisl mattis commodo. Aenean pulvinar facilisis lectus. Phasellus sodales
+risus sit amet lectus. Suspendisse in turpis. Vestibulum ac mi accumsan eros
+commodo tincidunt. Nullam velit. In pulvinar, dui sit amet ullamcorper dictum,
+dui risus ultricies nisl, a dignissim sapien enim sit amet tortor.
+Pellentesque fringilla, massa sit amet bibendum blandit, pede leo commodo mi,
+eleifend feugiat neque tortor dapibus mauris. Morbi nunc arcu, tincidunt vel,
+blandit non, iaculis vel, libero. Vestibulum sed metus vel velit scelerisque
+varius. Vivamus a tellus. Proin nec orci vel elit molestie venenatis. Aenean
+fringilla, lorem vel fringilla bibendum, nibh mi varius mi, eget semper ipsum
+ligula ut urna. Nullam tempor convallis augue. Sed at dui.
+"""
+
+element_index = doctext.index('[element here]')
+doctext = doctext.replace('[element here]', '')
+
+class TestElement(document.InlineElement):
+ vertex_list = None
+
+ def place(self, layout, x, y):
+ ## assert layout.document.text[self._position] == '\x00'
+ ### in bug 538, this fails after two characters are deleted.
+ self.vertex_list = layout.batch.add(4, pyglet.gl.GL_QUADS,
+ layout.top_group,
+ 'v2i',
+ ('c4B', [200, 200, 200, 255] * 4))
+
+ y += self.descent
+ w = self.advance
+ h = self.ascent - self.descent
+ self.vertex_list.vertices[:] = (x, y,
+ x + w, y,
+ x + w, y + h,
+ x, y + h)
+ def remove(self, layout):
+ self.vertex_list.delete()
+ del self.vertex_list
+
+class TestWindow(pyglet.window.Window):
+ def __init__(self, *args, **kwargs):
+ super(TestWindow, self).__init__(*args, **kwargs)
+
+ self.batch = pyglet.graphics.Batch()
+ self.document = pyglet.text.decode_attributed(doctext)
+ for i in [element_index]:
+ self.document.insert_element(i, TestElement(60, -10, 70))
+ self.margin = 2
+ self.layout = layout.IncrementalTextLayout(self.document,
+ self.width - self.margin * 2, self.height - self.margin * 2,
+ multiline=True,
+ batch=self.batch)
+ self.caret = caret.Caret(self.layout)
+ self.push_handlers(self.caret)
+
+ self.set_mouse_cursor(self.get_system_mouse_cursor('text'))
+
+ def on_draw(self):
+ pyglet.gl.glClearColor(1, 1, 1, 1)
+ self.clear()
+ self.batch.draw()
+
+ def on_key_press(self, symbol, modifiers):
+ super(TestWindow, self).on_key_press(symbol, modifiers)
+ if symbol == pyglet.window.key.TAB:
+ self.caret.on_text('\t')
+
+ self.document.set_style(0, len(self.document.text), dict(bold = None)) ### trigger bug 538
+
+@pytest.mark.requires_user_action
+class InlineElementStyleChangeTestCase(InteractiveTestCase):
+ """Test that inline elements can have their style changed, even after text
+ has been deleted before them. [This triggers bug 538 if it has not yet been fixed.]
+
+ To run the test, delete the first line, one character at a time,
+ verifying that the element remains visible and no tracebacks are
+ printed to the console.
+
+ Press ESC to end the test.
+ """
+
+ def test_inline_elements_style_change(self):
+ self.window = TestWindow(visible=False)
+ self.window.set_visible()
+ pyglet.app.run()
+ self.user_verify('Pass test?', take_screenshot=False)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_multiline_wrap.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_multiline_wrap.py
new file mode 100644
index 0000000..7c0518f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_multiline_wrap.py
@@ -0,0 +1,116 @@
+import pytest
+from tests.base.interactive import InteractiveTestCase
+
+from pyglet import app
+from pyglet import gl
+from pyglet import graphics
+from pyglet import text
+from pyglet.text import caret
+from pyglet.text import layout
+from pyglet import window
+from pyglet.window import key, mouse
+
+nonewline_nowrap = """{font_size 24}Multiline=False\n
+{font_size 12}This paragraph contains a lots of newlines however,\n
+the parameter multiline=False makes pyglet {font_size 16}ignore{font_size 12} it.\n
+For example this line should be not in a new line.\n
+And because the parameter multiline=False (ignoring wrap_lines) the {font_size 16}long lines are not broken{font_size 12}, as you can see in this line."""
+
+newline_nowrap = """{font_size 24}Multiline=True -- Wrap_line=False\n
+{font_size 12}This paragraph contains a lots of newlines however,\n
+the parameter multiline=True makes pyglet {font_size 16}accept{font_size 12} it.\n
+For example this line should be in a new line.\n
+And because the parameter wrap_lines=False the {font_size 16}long lines are not broken{font_size 12}, as you can see in this line."""
+
+newline_wrap = """{font_size 24}Multiline=True -- Wrap_line=True\n
+{font_size 12}This paragraph contains a lots of newlines however,\n
+the parameter multiline=True makes pyglet {font_size 16}accept{font_size 12} it.\n
+For example this line should be in a new line.\n
+And because the parameter wrap_lines=True the {font_size 16}long lines are broken{font_size 12}, as you can see in this line."""
+
+
+class TestWindow(window.Window):
+ def __init__(self, multiline, wrap_lines, msg, *args, **kwargs):
+ super(TestWindow, self).__init__(*args, **kwargs)
+
+ self.batch = graphics.Batch()
+ self.document = text.decode_attributed(msg)
+ self.margin = 2
+ self.layout = layout.IncrementalTextLayout(self.document,
+ (self.width - self.margin * 2),
+ self.height - self.margin * 2,
+ multiline=multiline,
+ wrap_lines=wrap_lines,
+ batch=self.batch)
+ self.caret = caret.Caret(self.layout)
+ self.push_handlers(self.caret)
+
+ self.wrap_lines = wrap_lines
+
+ self.set_mouse_cursor(self.get_system_mouse_cursor('text'))
+
+ def on_resize(self, width, height):
+ super(TestWindow, self).on_resize(width, height)
+ self.layout.begin_update()
+ self.layout.x = self.margin
+ self.layout.y = self.margin
+ if self.wrap_lines:
+ self.layout.width = width - self.margin * 2
+ self.layout.height = height - self.margin * 2
+ self.layout.end_update()
+
+ def on_mouse_scroll(self, x, y, scroll_x, scroll_y):
+ self.layout.view_x -= scroll_x
+ self.layout.view_y += scroll_y * 16
+
+ def on_draw(self):
+ gl.glClearColor(1, 1, 1, 1)
+ self.clear()
+ self.batch.draw()
+
+ def on_key_press(self, symbol, modifiers):
+ super(TestWindow, self).on_key_press(symbol, modifiers)
+ if symbol == key.TAB:
+ self.caret.on_text('\t')
+
+
+@pytest.mark.requires_user_action
+class MultilineWrapTestCase(InteractiveTestCase):
+ """Test that a paragraph is broken or not according the settings in an
+ incremental layout.
+
+ Three windows will be open (one per test) showing:
+ - A paragraph in a single line, skipping newlines and no wrapping the line.
+ - A paragraph in multiple lines, but the long lines will no be wrapped.
+ - Last, a paragraph in multiple lines with wrapped lines.
+
+ You can edit the text in each window and you must press ESC to close the window
+ and continue with the next window until finish the test.
+
+ Press ESC to exit the test.
+ """
+
+ def testMultilineFalse(self):
+ self.window = TestWindow(
+ multiline=False, wrap_lines=False,
+ msg=nonewline_nowrap, resizable=True, visible=False)
+ self.window.set_visible()
+ app.run()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+ def testMultilineTrueNoLimited(self):
+ self.window = TestWindow(
+ multiline=True, wrap_lines=False,
+ msg=newline_nowrap, resizable=True, visible=False)
+ self.window.set_visible()
+ app.run()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+ def testMultilineTrueLimited(self):
+ self.window = TestWindow(
+ multiline=True, wrap_lines=True,
+ msg=newline_wrap, resizable=True, visible=False)
+ self.window.set_visible()
+ app.run()
+ self.user_verify('Pass test?', take_screenshot=False)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_plain.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_plain.py
new file mode 100644
index 0000000..cad036a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_plain.py
@@ -0,0 +1,81 @@
+import pytest
+from tests.base.interactive import InteractiveTestCase
+
+from pyglet import app
+from pyglet import gl
+from pyglet import graphics
+from pyglet import text
+from pyglet.text import caret
+from pyglet.text import layout
+from pyglet import window
+from pyglet.window import key, mouse
+
+doctext = """PLAIN.py test document.
+
+Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas aliquet quam sit amet enim. Donec iaculis, magna vitae imperdiet convallis, lectus sem ultricies nulla, non fringilla quam felis tempus velit. Etiam et velit. Integer euismod. Aliquam a diam. Donec sed ante. Mauris enim pede, dapibus sed, dapibus vitae, consectetuer in, est. Donec aliquam risus eu ipsum. Integer et tortor. Ut accumsan risus sed ante.
+
+Aliquam dignissim, massa a imperdiet fermentum, orci dolor facilisis ante, ut vulputate nisi nunc sed massa. Morbi sodales hendrerit tortor. Nunc id tortor ut lacus mollis malesuada. Sed nibh tellus, rhoncus et, egestas eu, laoreet eu, urna. Vestibulum massa leo, convallis et, pharetra vitae, iaculis at, ante. Pellentesque volutpat porta enim. Morbi ac nunc eget mi pretium viverra. Pellentesque felis risus, lobortis vitae, malesuada vitae, bibendum eu, tortor. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Phasellus dapibus tortor ac neque. Curabitur pulvinar bibendum lectus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam tellus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla turpis leo, rhoncus vel, euismod non, consequat sed, massa. Quisque ultricies. Aliquam fringilla faucibus est. Proin nec felis eget felis suscipit vehicula.
+
+Etiam quam. Aliquam at ligula. Aenean quis dolor. Suspendisse potenti. Sed lacinia leo eu est. Nam pede ligula, molestie nec, tincidunt vel, posuere in, tellus. Donec fringilla dictum dolor. Aenean tellus orci, viverra id, vehicula eget, tempor a, dui. Morbi eu dolor nec lacus fringilla dapibus. Nulla facilisi. Nulla posuere. Nunc interdum. Donec convallis libero vitae odio.
+
+Aenean metus lectus, faucibus in, malesuada at, fringilla nec, risus. Integer enim. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin bibendum felis vel neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec ipsum dui, euismod at, dictum eu, congue tincidunt, urna. Sed quis odio. Integer aliquam pretium augue. Vivamus nonummy, dolor vel viverra rutrum, lacus dui congue pede, vel sodales dui diam nec libero. Morbi et leo sit amet quam sollicitudin laoreet. Vivamus suscipit.
+
+Duis arcu eros, iaculis ut, vehicula in, elementum a, sapien. Phasellus ut tellus. Integer feugiat nunc eget odio. Morbi accumsan nonummy ipsum. Donec condimentum, tortor non faucibus luctus, neque mi mollis magna, nec gravida risus elit nec ipsum. Donec nec sem. Maecenas varius libero quis diam. Curabitur pulvinar. Morbi at sem eget mauris tempor vulputate. Aenean eget turpis.
+"""
+
+
+class TestWindow(window.Window):
+ def __init__(self, *args, **kwargs):
+ super(TestWindow, self).__init__(*args, **kwargs)
+
+ self.batch = graphics.Batch()
+ self.document = text.decode_text(doctext)
+ self.margin = 2
+ self.layout = layout.IncrementalTextLayout(self.document,
+ self.width - self.margin * 2, self.height - self.margin * 2,
+ multiline=True,
+ batch=self.batch)
+ self.caret = caret.Caret(self.layout)
+ self.push_handlers(self.caret)
+
+ self.set_mouse_cursor(self.get_system_mouse_cursor('text'))
+
+ def on_resize(self, width, height):
+ super(TestWindow, self).on_resize(width, height)
+ self.layout.begin_update()
+ self.layout.x = self.margin
+ self.layout.y = self.margin
+ self.layout.width = width - self.margin * 2
+ self.layout.height = height - self.margin * 2
+ self.layout.end_update()
+
+ def on_mouse_scroll(self, x, y, scroll_x, scroll_y):
+ self.layout.view_x -= scroll_x
+ self.layout.view_y += scroll_y * 16
+
+ def on_draw(self):
+ gl.glClearColor(1, 1, 1, 1)
+ self.clear()
+ self.batch.draw()
+
+ def on_key_press(self, symbol, modifiers):
+ super(TestWindow, self).on_key_press(symbol, modifiers)
+ if symbol == key.TAB:
+ self.caret.on_text('\t')
+
+
+@pytest.mark.requires_user_action
+class PlainTextTestCase(InteractiveTestCase):
+ """Test an unformatted document is editable.
+
+ Examine and type over the text in the window that appears. The window
+ contents can be scrolled with the mouse wheel.
+
+ Press ESC to exit the test.
+ """
+ def test_plain(self):
+ self.window = TestWindow(resizable=True, visible=False)
+ self.window.set_visible()
+ app.run()
+ self.user_verify('Pass test?', take_screenshot=False)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_style.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_style.py
new file mode 100644
index 0000000..d38ba43
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/text/test_style.py
@@ -0,0 +1,225 @@
+import pytest
+from tests.base.interactive import InteractiveTestCase
+
+from pyglet import app
+from pyglet import gl
+from pyglet import graphics
+from pyglet import text
+from pyglet.text import caret
+from pyglet.text import layout
+from pyglet import window
+from pyglet.window import key, mouse
+
+doctext = """STYLE.py test document.
+
+{font_size 24}This is 24pt text.{font_size 12}
+
+This is 12pt text (as is everything that follows).
+
+This text has some {bold True}bold character style{bold False}, some
+{italic True}italic character style{italic False}, some {underline [0, 0, 0,
+255]}underlined text{underline None}, {underline [255, 0, 0, 255]}underline
+in red{underline None}, a {color [255, 0, 0, 255]}change {color [0, 255, 0,
+255]}in {color [0, 0, 255, 255]}color{color None}, and in
+{background_color [255, 255, 0, 255]}background
+{background_color [0, 255, 255, 255]}color{background_color None}.
+{kerning '2pt'}This sentence has 2pt kerning.{kerning 0}
+{kerning '-1pt'}This sentence has negative 1pt kerning.{kerning 0}
+
+Superscript is emulated by setting a positive baseline offset and reducing the
+font size, as in
+a{font_size 9}{baseline '4pt'}2{font_size None}{baseline 0} +
+b{font_size 9}{baseline '4pt'}2{font_size None}{baseline 0} =
+c{font_size 9}{baseline '4pt'}2{font_size None}{baseline 0}.
+Subscript is similarly emulated with a negative baseline offset, as in
+H{font_size 9}{baseline '-3pt'}2{font_size None}{baseline 0}O.
+
+This paragraph uses {font_name 'Courier New'}Courier New{font_name None} and
+{font_name 'Times New Roman'}Times New Roman{font_name None} fonts.
+
+{.leading '5pt'}This paragraph has 5pts leading. Lorem ipsum dolor sit amet,
+consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
+dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
+ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
+in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
+pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
+officia deserunt mollit anim id est laborum.
+
+{.leading None}{.line_spacing '12pt'}This paragraph has constant line spacing of
+12pt. When an {font_size 18}18pt font is used{font_size None}, the text
+overlaps and the baselines stay equally spaced. Lorem ipsum dolor sit amet,
+consectetur adipisicing elit, {font_size 18}sed do eiusmod tempor incididunt
+ut labore et dolore{font_size None} magna aliqua.
+
+{.line_spacing None}{.indent '20pt'}This paragraph has a 20pt indent. Lorem
+ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
+incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
+nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
+eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
+in culpa qui officia deserunt mollit anim id est laborum.
+
+{.indent None}{.tab_stops [300, 500]}Tablated data:{#x09}Player{#x09}Score{}
+{#x09}Alice{#x09}30,000{}
+{#x09}Bob{#x09}20,000{}
+{#x09}Candice{#x09}10,000{}
+{#x09}David{#x09}500
+
+{.indent None}{.align 'right'}This paragraph is right aligned. Lorem ipsum
+dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt
+ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
+exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis
+aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
+fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
+culpa qui officia deserunt mollit anim id est laborum.
+
+{.align 'center'}This paragraph is centered. Lorem ipsum dolor sit amet,
+consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
+dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
+ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
+in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
+pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
+officia deserunt mollit anim id est laborum.
+
+{.align 'left'}{.margin_left 50}This paragraph has a 50 pixel left margin.
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
+tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
+quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
+consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
+cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
+proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+
+{.margin_left 0}{.margin_right '50px'}This paragraph has a 50 pixel right
+margin. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
+eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
+veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
+commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
+esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
+non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+
+{.margin_left 200}{.margin_right 200}This paragraph has 200 pixel left and
+right margins. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed
+do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
+minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
+ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
+velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
+cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
+est laborum.
+
+{.align 'right'}{.margin_left 100}{.margin_right 100}This paragraph is
+right-aligned, and has 100 pixel left and right margins. Lorem ipsum dolor sit
+amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
+et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
+ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
+in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
+pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
+officia deserunt mollit anim id est laborum.
+
+{.align 'center'}{.margin_left 100}{.margin_right 100}This paragraph is
+centered, and has 100 pixel left and right margins. Lorem ipsum dolor sit
+amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
+et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
+ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
+in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
+pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
+officia deserunt mollit anim id est laborum.
+
+{.align 'left'}{.margin_left 0}{.margin_right 0}{.wrap False}This paragraph
+does not word-wrap. Lorem ipsum dolor sit amet, consectetur adipisicing elit,
+sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
+minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
+commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
+esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
+non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+
+{.align 'left'}{.margin_left 0}{.margin_right 0}{.wrap 'char'}This paragraph
+has character-level wrapping. Lorem ipsum dolor sit amet, consectetur
+adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
+aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
+nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
+reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
+deserunt mollit anim id est laborum.
+
+{.wrap True}{.margin_bottom 15}This and the following two paragraphs have a 15
+pixel vertical margin separating them. Lorem ipsum dolor sit amet, consectetur
+adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
+aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
+nisi ut aliquip ex ea commodo consequat.{}
+Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
+eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
+in culpa qui officia deserunt mollit anim id est laborum.{}
+Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
+eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
+in culpa qui officia deserunt mollit anim id est laborum.{}
+{.margin_bottom 0}{.margin_top 30}This and the following two paragraphs have
+a 30 pixel vertical margin (this time, the top margin is used instead of the
+bottom margin). There is a 45 pixel margin between this paragraph and the
+previous one.{}
+Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
+eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
+in culpa qui officia deserunt mollit anim id est laborum.{}
+Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
+eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
+in culpa qui officia deserunt mollit anim id est laborum.{}
+"""
+
+
+class TestWindow(window.Window):
+ def __init__(self, *args, **kwargs):
+ super(TestWindow, self).__init__(*args, **kwargs)
+
+ self.batch = graphics.Batch()
+ self.document = text.decode_attributed(doctext)
+ self.margin = 2
+ self.layout = layout.IncrementalTextLayout(self.document,
+ self.width - self.margin * 2, self.height - self.margin * 2,
+ multiline=True,
+ batch=self.batch)
+ self.caret = caret.Caret(self.layout)
+ self.push_handlers(self.caret)
+
+ self.set_mouse_cursor(self.get_system_mouse_cursor('text'))
+
+ def on_resize(self, width, height):
+ super(TestWindow, self).on_resize(width, height)
+ self.layout.begin_update()
+ self.layout.x = self.margin
+ self.layout.y = self.margin
+ self.layout.width = width - self.margin * 2
+ self.layout.height = height - self.margin * 2
+ self.layout.end_update()
+
+ def on_mouse_scroll(self, x, y, scroll_x, scroll_y):
+ self.layout.view_x -= scroll_x
+ self.layout.view_y += scroll_y * 16
+
+ def on_draw(self):
+ gl.glClearColor(1, 1, 1, 1)
+ self.clear()
+ self.batch.draw()
+
+ def on_key_press(self, symbol, modifiers):
+ super(TestWindow, self).on_key_press(symbol, modifiers)
+ if symbol == key.TAB:
+ self.caret.on_text('\t')
+
+
+@pytest.mark.requires_user_action
+class TextStyleTestCase(InteractiveTestCase):
+ """Test that character and paragraph-level style is adhered to correctly in
+ incremental layout.
+
+ Examine and type over the text in the window that appears. The window
+ contents can be scrolled with the mouse wheel. There are no formatting
+ commands, however formatting should be preserved as expected when entering or
+ replacing text and resizing the window.
+
+ Press ESC to exit the test.
+ """
+ def test(self):
+ self.window = TestWindow(resizable=True, visible=False)
+ self.window.set_visible()
+ app.run()
+ self.user_verify('Pass test?', take_screenshot=False)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_events.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_events.py
new file mode 100644
index 0000000..8c7989f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_events.py
@@ -0,0 +1,651 @@
+"""
+Tests for events on windows.
+"""
+from __future__ import print_function
+
+import pytest
+import random
+
+from pyglet import font
+from pyglet import gl
+from pyglet.window import key, Window
+from pyglet.window.event import WindowEventLogger
+
+from tests.base.interactive import InteractiveTestCase
+from tests.interactive.window import window_util
+
+
+class WindowEventsTestCase(InteractiveTestCase):
+ """
+ Base class that shows a window displaying instructions for the test. Then it waits for events
+ to continue. Optionally the user can fail the test by pressing Escape.
+ """
+
+ # Defaults
+ window_size = 400, 200
+ window = None
+ question = None
+
+ def setUp(self):
+ self.finished = False
+ self.failure = None
+ self.label = None
+
+ def fail_test(self, failure):
+ self.failure = failure
+ self.finished = True
+
+ def pass_test(self):
+ self.finished = True
+
+ def _render_question(self):
+ fnt = font.load('Courier')
+ self.label = font.Text(fnt, text=self.question, x=10, y=self.window_size[1]-20)
+
+ def _draw(self):
+ gl.glClearColor(0.5, 0, 0, 1)
+ gl.glClear(gl.GL_COLOR_BUFFER_BIT)
+ gl.glLoadIdentity()
+ self.label.draw()
+ self.window.flip()
+
+ def _test_main(self):
+ assert self.question
+
+ width, height = self.window_size
+ self.window = w = Window(width, height, visible=False, resizable=False)
+ try:
+ w.push_handlers(self)
+ self._render_question()
+ w.set_visible()
+
+ while not self.finished and not w.has_exit:
+ self._draw()
+ w.dispatch_events()
+
+ finally:
+ w.close()
+
+ # TODO: Allow entering reason of failure if user aborts
+ self.assertTrue(self.finished, msg="Test aborted")
+ self.assertIsNone(self.failure, msg=self.failure)
+
+
+@pytest.mark.requires_user_action
+class KeyPressWindowEventTestCase(WindowEventsTestCase):
+ number_of_checks = 10
+ keys = (key.A, key.B, key.C, key.D, key.E, key.F, key.G, key.H, key.I, key.J, key.K, key.L,
+ key.M, key.N, key.O, key.P, key.Q, key.R, key.S, key.T, key.U, key.V, key.W, key.X,
+ key.Y, key.Z)
+ mod_shift_keys = (key.LSHIFT, key.RSHIFT)
+ mod_ctrl_keys = (key.LCTRL, key.RCTRL)
+ mod_alt_keys = (key.LALT, key.RALT)
+ mod_meta_keys = (key.LMETA, key.RMETA)
+ mod_meta = key.MOD_SHIFT | key.MOD_ALT
+
+ def setUp(self):
+ super(KeyPressWindowEventTestCase, self).setUp()
+ self.chosen_symbol = None
+ self.chosen_modifiers = None
+ self.completely_pressed = False
+ self.active_keys = []
+ self.checks_passed = 0
+
+ def on_key_press(self, symbol, modifiers):
+ print('Press: ', key.symbol_string(symbol))
+ self.active_keys.append(symbol)
+
+ if self.completely_pressed:
+ self.fail_test('Key already pressed, no release received.')
+
+ elif self._is_correct_modifier_key(symbol):
+ # Does not seem to be correct for modifier keys
+ #self._check_modifiers_against_pressed_keys(modifiers)
+ pass
+
+ elif self._is_correct_key(symbol):
+ self._check_modifiers_against_pressed_keys(modifiers)
+ self.completely_pressed = True
+
+ def on_key_release(self, symbol, modifiers):
+ print('Release: ', key.symbol_string(symbol))
+ symbol = self._handle_meta_release(symbol)
+ if symbol not in self.active_keys:
+ self.fail_test('Released key "{}" was not pressed before.'.format(key.symbol_string(symbol)))
+ else:
+ self.active_keys.remove(symbol)
+
+ if len(self.active_keys) == 0 and self.completely_pressed:
+ self.completely_pressed = False
+ self.checks_passed += 1
+ if self.checks_passed == self.number_of_checks:
+ self.pass_test()
+ else:
+ self._select_next_key()
+
+ def _select_next_key(self):
+ self.chosen_symbol = random.choice(self.keys)
+
+ # Little trick, Ctrl, Alt and Shift are lowest modifier values, so everything between 0 and
+ # the full combination is a permutation of these three.
+ max_modifiers = key.MOD_SHIFT | key.MOD_ALT | key.MOD_CTRL
+ # Give a little more weight to key without modifiers
+ self.chosen_modifiers = max(0, random.randint(-2, max_modifiers))
+
+ self._update_question()
+
+ def _update_question(self):
+ modifiers = []
+ if self.chosen_modifiers & key.MOD_SHIFT:
+ modifiers.append('')
+ if self.chosen_modifiers & key.MOD_ALT:
+ modifiers.append('')
+ if self.chosen_modifiers & key.MOD_CTRL:
+ modifiers.append('')
+
+ self.question = """Please press and release:
+
+{} {}
+
+
+Press Esc if test does not pass.""".format(' '.join(modifiers), key.symbol_string(self.chosen_symbol))
+ self._render_question()
+
+ def _is_correct_modifier_key(self, symbol):
+ modifier = self._get_modifier_for_key(symbol)
+ if modifier == 0:
+ return False
+
+ if not self.chosen_modifiers & modifier:
+ self.fail_test('Unexpected modifier key "{}"'.format(key.symbol_string(symbol)))
+
+ return True
+
+ def _get_modifier_for_key(self, symbol):
+ if symbol in self.mod_shift_keys:
+ return key.MOD_SHIFT
+ elif symbol in self.mod_alt_keys:
+ return key.MOD_ALT
+ elif symbol in self.mod_ctrl_keys:
+ return key.MOD_CTRL
+ elif symbol in self.mod_meta_keys:
+ return self.mod_meta
+ else:
+ return 0
+
+ def _get_modifiers_from_pressed_keys(self):
+ modifiers = 0
+ for symbol in self.active_keys:
+ modifiers |= self._get_modifier_for_key(symbol)
+ return modifiers
+
+ def _check_modifiers_against_pressed_keys(self, modifiers):
+ modifiers_from_keys = self._get_modifiers_from_pressed_keys()
+ if modifiers != modifiers_from_keys:
+ self.fail_test('Received modifiers "{}" do not match pressed keys "{}"'.format(
+ key.modifiers_string(modifiers),
+ key.modifiers_string(modifiers_from_keys)))
+
+ def _is_correct_key(self, symbol):
+ if not self.chosen_symbol:
+ self.fail_test('No more key presses/releases expected.')
+ return False
+
+ if self.chosen_symbol != symbol:
+ self.fail_test('Received key "{}", but expected "{}"'.format(key.symbol_string(symbol),
+ key.symbol_string(self.chosen_symbol)))
+ return False
+
+ return True
+
+ def _handle_meta_release(self, symbol):
+ """The meta key can be either released as meta or as alt shift or vv"""
+ if symbol in (key.LMETA, key.LALT, key.RMETA, key.RALT):
+ if symbol not in self.active_keys:
+ if symbol == key.LMETA and key.LALT in self.active_keys:
+ return key.LALT
+ if symbol == key.RMETA and key.RALT in self.active_keys:
+ return key.RALT
+ if symbol == key.LALT and key.LMETA in self.active_keys:
+ return key.LMETA
+ if symbol == key.RALT and key.RMETA in self.active_keys:
+ return key.RMETA
+ return symbol
+
+ def test_key_press_release(self):
+ """Show several keys to press. Check that the event is triggered for the correct key."""
+ self._select_next_key()
+ self._test_main()
+
+
+@pytest.mark.requires_user_action
+class TextWindowEventsTest(WindowEventsTestCase):
+ number_of_checks = 10
+ text = '`1234567890-=~!@#$%^&*()_+qwertyuiop[]\\QWERTYUIOP{}|asdfghjkl;\'ASDFGHJKL:"zxcvbnm,./ZXCVBNM<>?'
+
+ def setUp(self):
+ super(TextWindowEventsTest, self).setUp()
+ self.chosen_text = None
+ self.checks_passed = 0
+
+ def on_text(self, text):
+ if text != self.chosen_text:
+ self.fail_test('Expected "{}", received "{}"'.format(self.chosen_text, text))
+ else:
+ self.checks_passed += 1
+ if self.checks_passed >= self.number_of_checks:
+ self.pass_test()
+ else:
+ self._select_next_text()
+
+ def _select_next_text(self):
+ self.chosen_text = random.choice(self.text)
+ self._update_question()
+
+ def _update_question(self):
+ self.question = """Please type:
+
+{}
+
+
+Press Esc if test does not pass.""".format(self.chosen_text)
+ self._render_question()
+
+ def test_key_text(self):
+ """Show several keys to press. Check that the text events are triggered correctly."""
+ self._select_next_text()
+ self._test_main()
+
+
+@pytest.mark.requires_user_action
+class TextMotionWindowEventsTest(WindowEventsTestCase):
+ number_of_checks = 10
+ motion_keys = (key.MOTION_UP, key.MOTION_RIGHT, key.MOTION_DOWN, key.MOTION_LEFT,
+ key.MOTION_NEXT_PAGE, key.MOTION_PREVIOUS_PAGE, key.MOTION_BACKSPACE,
+ key.MOTION_DELETE)
+
+ def setUp(self):
+ super(TextMotionWindowEventsTest, self).setUp()
+ self.chosen_key = None
+ self.checks_passed = 0
+
+ def on_text_motion(self, motion):
+ if motion != self.chosen_key:
+ self.fail_test('Expected "{}", received "{}"'.format(
+ key.motion_string(self.chosen_key), key.motion_string(motion)))
+ else:
+ self.checks_passed += 1
+ if self.checks_passed >= self.number_of_checks:
+ self.pass_test()
+ else:
+ self._select_next_key()
+
+ def _select_next_key(self):
+ self.chosen_key = random.choice(self.motion_keys)
+ self._update_question()
+
+ def _update_question(self):
+ self.question = """Please press:
+
+{} ({})
+
+
+Press Esc if test does not pass.""".format(key.motion_string(self.chosen_key),
+ key.symbol_string(self.chosen_key))
+ self._render_question()
+
+ def test_key_text_motion(self):
+ """Show several motion keys to press. Check that the on_text_motion events are triggered
+ correctly."""
+ self._select_next_key()
+ self._test_main()
+
+@pytest.mark.requires_user_action
+class TextMotionSelectWindowEventsTest(WindowEventsTestCase):
+ number_of_checks = 10
+ motion_keys = (key.MOTION_UP, key.MOTION_RIGHT, key.MOTION_DOWN, key.MOTION_LEFT,
+ key.MOTION_NEXT_PAGE, key.MOTION_PREVIOUS_PAGE, key.MOTION_BACKSPACE,
+ key.MOTION_DELETE)
+
+ def setUp(self):
+ super(TextMotionSelectWindowEventsTest, self).setUp()
+ self.chosen_key = None
+ self.checks_passed = 0
+
+ def on_text_motion_select(self, motion):
+ if motion != self.chosen_key:
+ self.fail_test('Expected "{}", received "{}"'.format(
+ key.motion_string(self.chosen_key), key.motion_string(motion)))
+ else:
+ self.checks_passed += 1
+ if self.checks_passed >= self.number_of_checks:
+ self.pass_test()
+ else:
+ self._select_next_key()
+
+ def _select_next_key(self):
+ self.chosen_key = random.choice(self.motion_keys)
+ self._update_question()
+
+ def _update_question(self):
+ self.question = """Please hold and press:
+
+{} ({})
+
+
+Press Esc if test does not pass.""".format(key.motion_string(self.chosen_key),
+ key.symbol_string(self.chosen_key))
+ self._render_question()
+
+ def test_key_text_motion_select(self):
+ """Show several motion keys to press. Check that the on_text_motion_select events are
+ triggered correctly combined with shift."""
+ self._select_next_key()
+ self._test_main()
+
+
+@pytest.mark.requires_user_action
+class CloseWindowEventsTest(WindowEventsTestCase):
+ def on_close(self):
+ self.pass_test()
+
+ def test_on_close_event(self):
+ """Test the on_close event triggerred when closing the window."""
+ self.question = "Please close this window by\nclicking the close button."
+ self._test_main()
+
+
+@pytest.mark.requires_user_action
+class ActivateDeactivateWindowEventsTest(WindowEventsTestCase):
+ number_of_checks = 3
+
+ def setUp(self):
+ super(ActivateDeactivateWindowEventsTest, self).setUp()
+ self.window_active = None
+ self.checks_passed = 0
+
+ def on_expose(self):
+ self.window_active = True
+ self._update_question()
+
+ def on_activate(self):
+ if self.window_active:
+ self.fail_test('Got double on_activate')
+ else:
+ self.window_active = True
+ self.checks_passed += 1
+ if self.checks_passed >= self.number_of_checks:
+ self.pass_test()
+ else:
+ self._update_question()
+
+ def on_deactivate(self):
+ if not self.window_active:
+ self.fail_test('Got double on_deactivate')
+ else:
+ self.window_active = False
+ self._update_question()
+
+ def _update_question(self):
+ if self.window_active:
+ self.question = "Please activate another window."
+ else:
+ self.question = "Please activate this window."
+ self._render_question()
+
+ def test_activate_deactivate(self):
+ """Test the on_activate and on_deactivate events triggered when the window gets activated
+ or deactivated."""
+ self._update_question()
+ self._test_main()
+
+
+@pytest.mark.requires_user_action
+class ExposeWindowEventsTest(WindowEventsTestCase):
+ number_of_checks = 5
+
+ def setUp(self):
+ super(ExposeWindowEventsTest, self).setUp()
+ self.checks_passed = 0
+
+ def on_expose(self):
+ self.checks_passed += 1
+ if self.checks_passed >= self.number_of_checks:
+ self.pass_test()
+
+ def test_expose(self):
+ """Test the on_expose event triggered when a redraw of the window is required."""
+ self.question = ("Please trigger a redraw of this window.\n\n"
+ "Depending on your OS and window manager you might need to:\n"
+ "- Cover the window with another window and uncover again\n"
+ "- Minimize and restore the window\n\n"
+ "Repeat up to 5 times (less might be accepted due to initial drawing)")
+ self.window_size = 700, 200
+ self._test_main()
+
+
+@pytest.mark.requires_user_action
+class ShowHideWindowEventsTest(WindowEventsTestCase):
+ number_of_checks = 5
+
+ def setUp(self):
+ super(ShowHideWindowEventsTest, self).setUp()
+ self.checks_passed = 0
+ self.visible = False
+
+ def on_show(self):
+ if self.visible:
+ self.fail_test('Received on_show twice without on_hide')
+ else:
+ self.checks_passed += 1
+ self.visible = True
+ if self.checks_passed >= self.number_of_checks:
+ self.pass_test()
+
+ def on_hide(self):
+ if not self.visible:
+ self.fail_test('Received on_hide twice without on_show')
+ else:
+ self.visible = False
+
+ def test_show_hide(self):
+ """Test the on_show and on_hide events."""
+ self.question = ('Please trigger hide and show this window again.\n'
+ 'You can do this by:\n'
+ '- Minimize and restore the window\n'
+ '- On OS X show and hide using Command+H or the dock context menu\n'
+ '\n'
+ 'Test passes after doing this 4 times.')
+ self.window_size = 700, 200
+ self._test_main()
+
+
+@pytest.mark.requires_user_action
+class EVENT_BUTTON(InteractiveTestCase):
+ """Test that mouse button events work correctly.
+
+ Expected behaviour:
+ One window will be opened. Click within this window and check the console
+ output for mouse events.
+ - Buttons 1, 2, 4 correspond to left, middle, right, respectively.
+ - No events for scroll wheel
+ - Modifiers are correct
+
+ Close the window or press ESC to end the test.
+ """
+ def on_mouse_press(self, x, y, button, modifiers):
+ print('Mouse button %d pressed at %f,%f with %s' % \
+ (button, x, y, key.modifiers_string(modifiers)))
+
+ def on_mouse_release(self, x, y, button, modifiers):
+ print('Mouse button %d released at %f,%f with %s' % \
+ (button, x, y, key.modifiers_string(modifiers)))
+
+ def test_button(self):
+ w = Window(200, 200)
+ try:
+ w.push_handlers(self)
+ while not w.has_exit:
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_action
+class EVENT_MOVE(InteractiveTestCase):
+ """Test that window move event works correctly.
+
+ Expected behaviour:
+ One window will be opened. Move the window and ensure that the
+ location printed to the terminal is correct.
+
+ Close the window or press ESC to end the test.
+ """
+ def on_move(self, x, y):
+ print('Window moved to %dx%d.' % (x, y))
+
+ def test_move(self):
+ w = Window(200, 200)
+ try:
+ w.push_handlers(self)
+ while not w.has_exit:
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_action
+class EVENT_RESIZE(InteractiveTestCase):
+ """Test that resize event works correctly.
+
+ Expected behaviour:
+ One window will be opened. Resize the window and ensure that the
+ dimensions printed to the terminal are correct. You should see
+ a green border inside the window but no red.
+
+ Close the window or press ESC to end the test.
+ """
+ def on_resize(self, width, height):
+ print('Window resized to %dx%d.' % (width, height))
+
+ def test_resize(self):
+ w = Window(200, 200, resizable=True)
+ try:
+ w.push_handlers(self)
+ while not w.has_exit:
+ window_util.draw_client_border(w)
+ w.flip()
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_action
+class EVENT_MOUSE_DRAG(InteractiveTestCase):
+ """Test that mouse drag event works correctly.
+
+ Expected behaviour:
+ One window will be opened. Click and drag with the mouse and ensure
+ that buttons, coordinates and modifiers are reported correctly. Events
+ should be generated even when the drag leaves the window.
+
+ Close the window or press ESC to end the test.
+ """
+ def test_mouse_drag(self):
+ w = Window(200, 200)
+ try:
+ w.push_handlers(WindowEventLogger())
+ while not w.has_exit:
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_action
+class EVENT_MOUSEMOTION(InteractiveTestCase):
+ """Test that mouse motion event works correctly.
+
+ Expected behaviour:
+ One window will be opened. Move the mouse in and out of this window
+ and ensure the absolute and relative coordinates are correct.
+ - Absolute coordinates should have (0,0) at bottom-left of client area
+ of window with positive y-axis pointing up and positive x-axis right.
+ - Relative coordinates should be positive when moving up and right.
+
+ Close the window or press ESC to end the test.
+ """
+ def on_mouse_motion(self, x, y, dx, dy):
+ print('Mouse at (%f, %f); relative (%f, %f).' % \
+ (x, y, dx, dy))
+
+ def test_motion(self):
+ w = Window(200, 200)
+ try:
+ w.push_handlers(self)
+ while not w.has_exit:
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_action
+class EVENT_MOUSE_SCROLL(InteractiveTestCase):
+ """Test that mouse scroll event works correctly.
+
+ Expected behaviour:
+ One window will be opened. Move the scroll wheel and check that events
+ are printed to console. Positive values are associated with scrolling
+ up.
+
+ Scrolling can also be side-to-side, for example with an Apple Mighty
+ Mouse.
+
+ The actual scroll value is dependent on your operating system
+ user preferences.
+
+ Close the window or press ESC to end the test.
+ """
+ def on_mouse_scroll(self, x, y, dx, dy):
+ print('Mouse scrolled (%f, %f) (x=%f, y=%f)' % (dx, dy, x, y))
+
+ def test_mouse_scroll(self):
+ w = Window(200, 200)
+ try:
+ w.push_handlers(self)
+ while not w.has_exit:
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_action
+class EVENT_MOUSE_ENTER_LEAVE(InteractiveTestCase):
+ """Test that mouse enter and leave events work correctly.
+
+ Expected behaviour:
+ One window will be opened. Move the mouse in and out of this window
+ and ensure the events displayed are correct.
+
+ Close the window or press ESC to end the test.
+ """
+ def on_mouse_enter(self, x, y):
+ print('Entered at %f, %f' % (x, y))
+
+ def on_mouse_leave(self, x, y):
+ print('Left at %f, %f' % (x, y))
+
+ def test_motion(self):
+ w = Window(200, 200)
+ try:
+ w.push_handlers(self)
+ while not w.has_exit:
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_fullscreen.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_fullscreen.py
new file mode 100644
index 0000000..d91b237
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_fullscreen.py
@@ -0,0 +1,169 @@
+from __future__ import print_function
+from __future__ import absolute_import
+from builtins import range
+import pytest
+from tests.base.interactive import InteractiveTestCase
+
+from pyglet import window
+from pyglet.window.event import WindowEventLogger
+from pyglet.window import key
+from pyglet.gl import *
+
+from . import window_util
+
+
+@pytest.mark.requires_user_action
+class WINDOW_SET_FULLSCREEN(InteractiveTestCase):
+ """Test that window can be set to and from various fullscreen sizes.
+
+ Expected behaviour:
+ One window will be opened. Press a number to switch to the corresponding
+ fullscreen size; hold control and press a number to switch back
+ to the corresponding window size:
+
+ 0 - Default size
+ 1 - 320x200
+ 2 - 640x480
+ 3 - 800x600
+ 4 - 1024x768
+ 5 - 1280x800 (widescreen)
+ 6 - 1280x1024
+
+ In all cases the window bounds will be indicated by a green rectangle
+ which should be completely visible.
+
+ All events will be printed to the terminal.
+
+ Press ESC to end the test.
+ """
+ def on_key_press(self, symbol, modifiers):
+ fullscreen = not modifiers & key.MOD_CTRL
+ doing = fullscreen and 'Setting' or 'Restoring from'
+ if symbol == key._0:
+ print('%s default size' % doing)
+ self.w.set_fullscreen(fullscreen)
+ return
+ elif symbol == key._1:
+ width, height = 320, 200
+ elif symbol == key._2:
+ width, height = 640, 480
+ elif symbol == key._3:
+ width, height = 800, 600
+ elif symbol == key._4:
+ width, height = 1024, 768
+ elif symbol == key._5:
+ width, height = 1280, 800 # 16:10
+ elif symbol == key._6:
+ width, height = 1280, 1024
+ else:
+ return
+ print('%s width=%d, height=%d' % (doing, width, height))
+ self.w.set_fullscreen(fullscreen, width=width, height=height)
+
+ def on_expose(self):
+ glClearColor(1, 0, 0, 1)
+ glClear(GL_COLOR_BUFFER_BIT)
+ window_util.draw_client_border(self.w)
+ self.w.flip()
+
+ def test_set_fullscreen(self):
+ self.w = w = window.Window(200, 200)
+ try:
+ w.push_handlers(self)
+ w.push_handlers(WindowEventLogger())
+ self.on_expose()
+ while not w.has_exit:
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_action
+class WINDOW_INITIAL_FULLSCREEN(InteractiveTestCase):
+ """Test that a window can be opened fullscreen.
+
+ Expected behaviour:
+ A fullscreen window will be created, with a flat purple colour.
+
+ - Press 'g' to leave fullscreen mode and create a window.
+ - Press 'f' to re-enter fullscreen mode.
+ - All events will be printed to the console. Ensure that mouse,
+ keyboard and activation/deactivation events are all correct.
+
+ Close either window or press ESC to end the test.
+ """
+ def on_key_press(self, symbol, modifiers):
+ if symbol == key.F:
+ print('Setting fullscreen.')
+ self.w.set_fullscreen(True)
+ elif symbol == key.G:
+ print('Leaving fullscreen.')
+ self.w.set_fullscreen(False)
+
+ def on_expose(self):
+ glClearColor(1, 0, 1, 1)
+ glClear(GL_COLOR_BUFFER_BIT)
+ self.w.flip()
+
+ def test_initial_fullscreen(self):
+ self.w = window.Window(fullscreen=True)
+ try:
+ self.w.push_handlers(self)
+ self.w.push_handlers(WindowEventLogger())
+ self.on_expose()
+ while not self.w.has_exit:
+ self.w.dispatch_events()
+ finally:
+ self.w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_validation
+class MULTIPLE_SCREEN(InteractiveTestCase):
+ """Test that screens can be selected for fullscreen.
+
+ Expected behaviour:
+ One window will be created fullscreen on the primary screen. When you
+ close this window, another will open on the next screen, and so
+ on until all screens have been tested.
+
+ Each screen will be filled with a different color:
+ - Screen 0: Red
+ - Screen 1: Green
+ - Screen 2: Blue
+ - Screen 3: Purple
+
+ The test will end when all screens have been tested.
+ """
+ colours = [
+ (1, 0, 0, 1),
+ (0, 1, 0, 1),
+ (0, 0, 1, 1),
+ (1, 0, 1, 1)]
+ colour_names = ('red', 'green', 'blue', 'purple')
+
+ def open_next_window(self):
+ screen = self.screens[self.index]
+ self.w = window.Window(screen=screen, fullscreen=True)
+
+ def on_expose(self):
+ self.w.switch_to()
+ glClearColor(*self.colours[self.index])
+ glClear(GL_COLOR_BUFFER_BIT)
+ self.w.flip()
+
+ def test_multiple_screen(self):
+ display = window.get_platform().get_default_display()
+ self.screens = display.get_screens()
+ for i in range(len(self.screens)):
+ self.index = i
+ self.open_next_window()
+ try:
+ self.on_expose()
+ self.w.dispatch_events()
+ self.user_verify('Do you see a {} full screen window on screen {}?'.format(
+ self.colour_names[i], i+1))
+ finally:
+ self.w.close()
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_modes.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_modes.py
new file mode 100644
index 0000000..ba1eb48
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_modes.py
@@ -0,0 +1,129 @@
+from __future__ import print_function
+from builtins import chr
+import pytest
+import time
+
+from tests.annotations import Platform, require_platform
+from tests.base.interactive import InteractiveTestCase
+from tests.interactive.window import window_util
+
+from pyglet import window
+from pyglet.gl import *
+from pyglet.window.event import WindowEventLogger
+
+@pytest.mark.requires_user_validation
+class WINDOW_MINIMIZE_MAXIMIZE(InteractiveTestCase):
+ """Test that window can be minimized and maximized.
+
+ Expected behaviour:
+ One window will be opened. It will be maximized and minimized.
+ """
+ def test_minimize_maximize(self):
+ self.width, self.height = 200, 200
+ self.w = w = window.Window(self.width, self.height, resizable=True)
+ try:
+ w.dispatch_events()
+ self.user_verify('Is the window visible and not maximized?',
+ take_screenshot=False)
+
+ w.maximize()
+ w.dispatch_events()
+ self.user_verify('Is the window maximized?',
+ take_screenshot=False)
+
+ w.minimize()
+ w.dispatch_events()
+ self.user_verify('Is the window minimized?',
+ take_screenshot=False)
+
+ finally:
+ w.close()
+
+
+@pytest.mark.requires_user_action
+class WINDOW_ACTIVATE(InteractiveTestCase):
+ """Test that the window can be activated (focus set).
+
+ Expected behaviour:
+ One window will be opened. Every 5 seconds it will be activated;
+ it should be come to the front and accept keyboard input (this will
+ be shown on the terminal).
+
+ On some OSes, the taskbar icon may flash (indicating the application
+ requires attention) rather than moving the window to the foreground. This
+ is the correct behaviour.
+
+ Press escape or close the window to finished the test.
+ """
+ def test_activate(self):
+ w = window.Window(200, 200)
+ try:
+ w.push_handlers(WindowEventLogger())
+ last_time = time.time()
+ while not w.has_exit:
+ if time.time() - last_time > 5:
+ w.activate()
+ last_time = time.time()
+ print('Activated window.')
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_action
+class WINDOW_RESIZABLE(InteractiveTestCase):
+ """Test that window can be resized.
+
+ Expected behaviour:
+ One window will be opened. It should be resizable by the user.
+
+ Close the window or press ESC to end the test.
+ """
+ def test_resizable(self):
+ self.width, self.height = 200, 200
+ self.w = w = window.Window(self.width, self.height, resizable=True)
+ try:
+ glClearColor(1, 1, 1, 1)
+ while not w.has_exit:
+ window_util.draw_client_border(w)
+ w.flip()
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_action
+@require_platform(Platform.WINDOWS + Platform.OSX)
+class WINDOW_MODE_SWITCH(InteractiveTestCase):
+ """Test switching to available screen modes."""
+ def on_text(self, text):
+ text = text[:1]
+ i = ord(text) - ord('a')
+ if 0 <= i < len(self.modes):
+ print('Switching to %s' % self.modes[i])
+ self.w.screen.set_mode(self.modes[i])
+
+ def on_expose(self):
+ glClearColor(1, 0, 0, 1)
+ glClear(GL_COLOR_BUFFER_BIT)
+ window_util.draw_client_border(self.w)
+ self.w.flip()
+
+ def test_set_fullscreen(self):
+ self.w = w = window.Window(200, 200)
+ try:
+ self.modes = w.screen.get_modes()
+ self.assertTrue(len(self.modes) > 0, msg='No modes available')
+ print('Press a letter to switch to the corresponding mode:')
+ for i, mode in enumerate(self.modes):
+ print('%s: %s' % (chr(i + ord('a')), mode))
+
+ w.push_handlers(self)
+ self.on_expose()
+ while not w.has_exit:
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_multisample.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_multisample.py
new file mode 100644
index 0000000..a6abb8e
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_multisample.py
@@ -0,0 +1,148 @@
+from __future__ import print_function
+from __future__ import division
+import pytest
+from tests.base.interactive import InteractiveTestCase
+
+from pyglet.gl import *
+from pyglet import window
+from pyglet import clock
+from pyglet.window import key
+
+
+@pytest.mark.requires_user_action
+class WINDOW_MULTISAMPLE(InteractiveTestCase):
+ """Test that a window can have multisample.
+
+ A window will be opened containing two rotating squares. Initially,
+ there will be no multisampling (the edges will look "jaggy"). Press:
+
+ * M to toggle multisampling on/off
+ * S to increase samples (2, 4, 6, 8, 10, ...)
+ * Shift+S to decrease samples
+
+ Each time sample_buffers or samples is modified, the window will be recreated.
+ Watch the console for success and failure messages. If the multisample
+ options are not supported, a "Failure" message will be printed and the window
+ will be left as-is.
+
+ Press ESC to end the test.
+ """
+ win = None
+ width = 640
+ height = 480
+
+ soft_multisample = True
+ multisample = False
+ samples = 2
+
+ # This test does not work on all hardware, unless rendered to texture.
+ texture = pyglet.image.Texture.create(width, height, rectangle=True)
+
+ def set_window(self):
+ oldwindow = self.win
+ try:
+ if self.multisample:
+ print('Attempting samples=%d...' % self.samples, end=' ')
+ config = Config(sample_buffers=1,
+ samples=self.samples,
+ double_buffer=True)
+ else:
+ print('Disabling multisample...', end=' ')
+ config = Config(double_buffer=True)
+ self.win = window.Window(self.width, self.height,
+ vsync=True,
+ config=config)
+ self.win.switch_to()
+ self.win.push_handlers(self.on_key_press)
+
+ if self.multisample:
+ if self.soft_multisample:
+ glEnable(GL_MULTISAMPLE_ARB)
+ else:
+ glDisable(GL_MULTISAMPLE_ARB)
+
+ if oldwindow:
+ oldwindow.close()
+
+ print('Success.')
+ except window.NoSuchConfigException:
+ print('Failed.')
+
+ def on_key_press(self, symbol, modifiers):
+ mod = 1
+ if modifiers & key.MOD_SHIFT:
+ mod = -1
+
+ if symbol == key.M:
+ self.multisample = not self.multisample
+ self.set_window()
+ if symbol == key.S:
+ self.samples += 2 * mod
+ self.samples = max(2, self.samples)
+ self.set_window()
+
+ # Another test: try enabling/disabling GL_MULTISAMPLE_ARB...
+ # seems to have no effect if samples > 4.
+ if symbol == key.N:
+ self.soft_multisample = not self.soft_multisample
+ if self.soft_multisample:
+ print('Enabling GL_MULTISAMPLE_ARB')
+ glEnable(GL_MULTISAMPLE_ARB)
+ else:
+ print('Disabling GL_MULTISAMPLE_ARB')
+ glDisable(GL_MULTISAMPLE_ARB)
+
+ def render(self):
+ self.win.switch_to()
+ size = self.height / 4
+ glClear(GL_COLOR_BUFFER_BIT)
+ glEnable(GL_BLEND)
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+
+ glLoadIdentity()
+ glTranslatef(self.width/2, self.height/2, 0)
+ glRotatef(self.angle, 0, 0, 1)
+
+ glColor3f(1, 0, 0)
+ glBegin(GL_QUADS)
+ glVertex2f(-size, -size)
+ glVertex2f(size, -size)
+ glVertex2f(size, size)
+ glVertex2f(-size, size)
+ glEnd()
+
+ glRotatef(-self.angle * 2, 0, 0, 1)
+ glColor4f(0, 1, 0, 0.5)
+ glBegin(GL_QUADS)
+ glVertex2f(-size, -size)
+ glVertex2f(size, -size)
+ glVertex2f(size, size)
+ glVertex2f(-size, size)
+ glEnd()
+
+ # Render to texture, then blit to screen:
+ buffer = pyglet.image.get_buffer_manager().get_color_buffer()
+ self.texture.blit_into(buffer, 0, 0, 0)
+ glViewport(0, 0, self.width, self.height)
+ glClearColor(0, 0, 0, 1)
+ glClear(GL_COLOR_BUFFER_BIT)
+ glLoadIdentity()
+ glColor3f(1, 1, 1)
+ self.texture.blit(0, 0, width=self.width, height=self.height)
+
+ def test_multisample(self):
+ self.set_window()
+ try:
+ self.angle = 0
+ clock.set_fps_limit(30)
+ while not self.win.has_exit:
+ dt = clock.tick()
+ self.angle += dt
+
+ self.render()
+ self.win.flip()
+ self.win.dispatch_events()
+ finally:
+ self.win.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_open.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_open.py
new file mode 100644
index 0000000..543d913
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_open.py
@@ -0,0 +1,49 @@
+import pytest
+
+from tests.base.interactive import InteractiveTestCase
+
+from pyglet import window
+from pyglet.gl import *
+
+@pytest.mark.requires_user_validation
+class WINDOW_OPEN(InteractiveTestCase):
+ def open_window(self):
+ return window.Window(200, 200)
+
+ def draw_window(self, window, colour):
+ window.switch_to()
+ glClearColor(*colour)
+ glClear(GL_COLOR_BUFFER_BIT)
+ window.flip()
+
+ def test_open_window(self):
+ """Test that a window can be opened.
+
+ Expected behaviour:
+ One small window will be opened coloured purple.
+ """
+ w1 = self.open_window()
+ self.draw_window(w1, (1, 0, 1, 1))
+ w1.dispatch_events()
+ self.user_verify('Do you see one small purple coloured window?')
+ w1.close()
+
+ def test_open_multiple_windows(self):
+ """Test that multiple windows can be opened.
+
+ Expected behaviour:
+ Two small windows will be opened, one coloured yellow and the other
+ purple.
+
+ Close either window or press ESC to end the test.
+ """
+ w1 = self.open_window()
+ w2 = self.open_window()
+ self.draw_window(w1, (1, 0, 1, 1))
+ self.draw_window(w2, (1, 1, 0, 1))
+ w1.dispatch_events()
+ w2.dispatch_events()
+ self.user_verify('Do you see one small purple coloured window '
+ 'and one small yellow coloured window?')
+ w1.close()
+ w2.close()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_settings.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_settings.py
new file mode 100644
index 0000000..42d8e4a
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_settings.py
@@ -0,0 +1,598 @@
+"""Tests for window settings."""
+from __future__ import print_function
+
+import pytest
+import time
+
+from tests.base.interactive import InteractiveTestCase
+from tests.interactive.window import window_util
+
+from pyglet.gl import *
+from pyglet import image
+from pyglet.window import key, Window, ImageMouseCursor
+from pyglet.window.event import WindowEventLogger
+
+
+@pytest.mark.requires_user_action
+class WINDOW_SET_EXCLUSIVE_KEYBOARD(InteractiveTestCase):
+ """Test that exclusive keyboard mode can be set.
+
+ Expected behaviour:
+ One window will be opened. Press 'e' to enable exclusive mode and 'E'
+ to disable exclusive mode.
+
+ In exclusive mode:
+ - Pressing system keys, the Expose keys, etc., should have no effect
+ besides displaying as keyboard events.
+ - On OS X, the Power switch is not disabled (though this is possible
+ if desired, see source).
+ - On OS X, the menu bar and dock will disappear during keyboard
+ exclusive mode.
+ - On Windows, only Alt+Tab is disabled. A user can still switch away
+ using Ctrl+Escape, Alt+Escape, the Windows key or Ctrl+Alt+Del.
+ - Switching to another application (i.e., with the mouse) should make
+ these keys work normally again until this application regains focus.
+
+ Close the window or press ESC to end the test.
+ """
+ def on_key_press(self, symbol, modifiers):
+ print('Pressed %s with modifiers %s' % \
+ (key.symbol_string(symbol), key.modifiers_string(modifiers)))
+
+ if symbol == key.E:
+ exclusive = not (modifiers & key.MOD_SHIFT)
+ self.w.set_exclusive_keyboard(exclusive)
+ print('Exclusive keyboard is now %r' % exclusive)
+
+ def on_key_release(self, symbol, modifiers):
+ print('Released %s with modifiers %s' % \
+ (key.symbol_string(symbol), key.modifiers_string(modifiers)))
+
+ def test_set_exclusive_keyboard(self):
+ self.width, self.height = 200, 200
+ self.w = w = Window(self.width, self.height)
+ try:
+ w.push_handlers(self)
+ while not w.has_exit:
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_action
+class WINDOW_SET_EXCLUSIVE_MOUSE(InteractiveTestCase):
+ """Test that exclusive mouse mode can be set.
+
+ Expected behaviour:
+ One window will be opened. Press 'e' to enable exclusive mode and 'E'
+ to disable exclusive mode.
+
+ In exclusive mode:
+ - the mouse cursor should be invisible
+ - moving the mouse should generate events with bogus x,y but correct
+ dx and dy.
+ - it should not be possible to switch applications with the mouse
+ - if application loses focus (i.e., with keyboard), the mouse should
+ operate normally again until focus is returned to the app, in which
+ case it should hide again.
+
+ Close the window or press ESC to end the test.
+ """
+ def on_key_press(self, symbol, modifiers):
+ if symbol == key.E:
+ exclusive = not (modifiers & key.MOD_SHIFT)
+ self.w.set_exclusive_mouse(exclusive)
+ print('Exclusive mouse is now %r' % exclusive)
+
+ def on_mouse_motion(self, x, y, dx, dy):
+ print('on_mousemotion(x=%f, y=%f, dx=%f, dy=%f)' % (x, y, dx, dy))
+
+ def test_set_exclusive_mouse(self):
+ self.width, self.height = 200, 200
+ self.w = w = Window(self.width, self.height)
+ try:
+ w.push_handlers(self)
+ while not w.has_exit:
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_action
+class WINDOW_SET_FULLSCREEN(InteractiveTestCase):
+ """Test that window can be set fullscreen and back again.
+
+ Expected behaviour:
+ One window will be opened.
+
+ - press "f" to enter fullscreen mode.
+ - press "g" to leave fullscreen mode.
+
+ All events will be printed to the terminal.
+
+ Close the window or press ESC to end the test.
+ """
+ def on_key_press(self, symbol, modifiers):
+ if symbol == key.F:
+ print('Setting fullscreen.')
+ self.w.set_fullscreen(True)
+ elif symbol == key.G:
+ print('Leaving fullscreen.')
+ self.w.set_fullscreen(False)
+
+ def on_expose(self):
+ glClearColor(1, 0, 0, 1)
+ glClear(GL_COLOR_BUFFER_BIT)
+ self.w.flip()
+
+ def test_set_fullscreen(self):
+ self.w = w = Window(200, 200)
+ try:
+ w.push_handlers(self)
+ w.push_handlers(WindowEventLogger())
+ self.on_expose()
+ while not w.has_exit:
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_validation
+class WINDOW_SET_ICON(InteractiveTestCase):
+ """Test that window icon can be set.
+
+ Expected behaviour:
+ One window will be opened. It will have an icon depicting a yellow
+ "A".
+ """
+ def test_set_icon(self):
+ self.width, self.height = 200, 200
+ self.w = w = Window(self.width, self.height)
+ try:
+ w.set_icon(image.load(self.get_test_data_file('images', 'icon1.png')))
+ w.dispatch_events()
+ self.user_verify('Does the window have a yellow A icon?', take_screenshot=False)
+ finally:
+ w.close()
+
+
+@pytest.mark.requires_user_validation
+class WINDOW_SET_ICON_SIZES(InteractiveTestCase):
+ """Test that window icon can be set for multiple sizes.
+
+ Expected behaviour:
+ One window will be opened. The window's icon depends on the icon
+ size:
+
+ 16x16 icon is a yellow "1"
+ 32x32 icon is a purple "2"
+ 48x48 icon is a cyan "3"
+ 72x72 icon is a red "4"
+ 128x128 icon is a blue "5"
+
+ For other sizes, the operating system may select the closest match and
+ scale it (Linux, Windows), or interpolate between two or more images
+ (Mac OS X).
+ """
+ def test_set_icon_sizes(self):
+ self.width, self.height = 200, 200
+ self.w = w = Window(self.width, self.height)
+ try:
+ w.set_icon(image.load(self.get_test_data_file('images', 'icon_size1.png')),
+ image.load(self.get_test_data_file('images', 'icon_size2.png')),
+ image.load(self.get_test_data_file('images', 'icon_size3.png')),
+ image.load(self.get_test_data_file('images', 'icon_size4.png')),
+ image.load(self.get_test_data_file('images', 'icon_size5.png')))
+ w.dispatch_events()
+ self.user_verify('Does the window have the icon corresponding to the correct size?', take_screenshot=False)
+ finally:
+ w.close()
+
+
+@pytest.mark.requires_user_action
+class WINDOW_SET_LOCATION(InteractiveTestCase):
+ """Test that window location can be set.
+
+ Expected behaviour:
+ One window will be opened. The window's location will be printed
+ to the terminal.
+
+ - Use the arrow keys to move the window.
+
+ Close the window or press ESC to end the test.
+ """
+ def on_key_press(self, symbol, modifiers):
+ x, y = self.w.get_location()
+ if symbol == key.LEFT:
+ x -= 10
+ if symbol == key.RIGHT:
+ x += 10
+ if symbol == key.UP:
+ y -= 10
+ if symbol == key.DOWN:
+ y += 10
+ self.w.set_location(x, y)
+ print('Window location set to %dx%d.' % (x, y))
+ print('Window location now: %dx%d.' % self.w.get_location())
+ self.assertSequenceEqual((x, y), self.w.get_location())
+
+ def test_set_location(self):
+ self.w = w = Window(200, 200)
+ try:
+ w.push_handlers(self)
+ while not w.has_exit:
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_action
+class WINDOW_SET_MIN_MAX_SIZE(InteractiveTestCase):
+ """Test that minimum and maximum window size can be set.
+
+ Expected behaviour:
+ One window will be opened. The window's dimensions will be printed
+ to the terminal. Initially the window has no minimum or maximum
+ size (besides any OS-enforced limit).
+
+ - press "n" to set the minimum size to be the current size.
+ - press "x" to set the maximum size to be the current size.
+
+ You should see a green border inside the window but no red.
+
+ Close the window or press ESC to end the test.
+ """
+ def on_resize(self, width, height):
+ print('Window size is %dx%d.' % (width, height))
+ self.width, self.height = width, height
+
+ def on_key_press(self, symbol, modifiers):
+ if symbol == key.N:
+ self.w.set_minimum_size(self.width, self.height)
+ print('Minimum size set to %dx%d.' % (self.width, self.height))
+ elif symbol == key.X:
+ self.w.set_maximum_size(self.width, self.height)
+ print('Maximum size set to %dx%d.' % (self.width, self.height))
+
+ def test_min_max_size(self):
+ self.width, self.height = 200, 200
+ self.w = w = Window(self.width, self.height, resizable=True)
+ try:
+ w.push_handlers(self)
+ while not w.has_exit:
+ window_util.draw_client_border(w)
+ w.flip()
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_action
+class WINDOW_SET_MOUSE_CURSOR(InteractiveTestCase):
+ """Test that image mouse cursor can be set.
+
+ Expected behaviour:
+ One window will be opened. The mouse cursor in the window will be
+ a custom cursor.
+
+ Close the window or press ESC to end the test.
+ """
+ def on_mouse_motion(self, x, y, dx, dy):
+ print('on_mousemotion(x=%f, y=%f, dx=%f, dy=%f)' % (x, y, dx, dy))
+
+ def test_set_mouse_cursor(self):
+ self.width, self.height = 200, 200
+ self.w = w = Window(self.width, self.height)
+ try:
+ img = image.load(self.get_test_data_file('images', 'cursor.png'))
+ w.set_mouse_cursor(ImageMouseCursor(img, 4, 28))
+ w.push_handlers(self)
+ glClearColor(1, 1, 1, 1)
+ while not w.has_exit:
+ glClear(GL_COLOR_BUFFER_BIT)
+ w.flip()
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_action
+class WINDOW_SET_MOUSE_PLATFORM_CURSOR(InteractiveTestCase):
+ """Test that mouse cursor can be set to a platform-dependent image.
+
+ Expected behaviour:
+ One window will be opened. Press the left and right arrow keys to cycle
+ through the system mouse cursors. The current cursor selected will
+ be printed to the terminal.
+
+ Note that not all cursors are unique on each platform; for example,
+ if a platform doesn't define a cursor for a given name, a suitable
+ replacement (e.g., a plain arrow) will be used instead.
+
+ Close the window or press ESC to end the test.
+ """
+ i = 0
+ def on_key_press(self, symbol, modifiers):
+ names = [
+ self.w.CURSOR_DEFAULT,
+ self.w.CURSOR_CROSSHAIR,
+ self.w.CURSOR_HAND,
+ self.w.CURSOR_HELP,
+ self.w.CURSOR_NO,
+ self.w.CURSOR_SIZE,
+ self.w.CURSOR_SIZE_UP,
+ self.w.CURSOR_SIZE_UP_RIGHT,
+ self.w.CURSOR_SIZE_RIGHT,
+ self.w.CURSOR_SIZE_DOWN_RIGHT,
+ self.w.CURSOR_SIZE_DOWN,
+ self.w.CURSOR_SIZE_DOWN_LEFT,
+ self.w.CURSOR_SIZE_LEFT,
+ self.w.CURSOR_SIZE_UP_LEFT,
+ self.w.CURSOR_SIZE_UP_DOWN,
+ self.w.CURSOR_SIZE_LEFT_RIGHT,
+ self.w.CURSOR_TEXT,
+ self.w.CURSOR_WAIT,
+ self.w.CURSOR_WAIT_ARROW,
+ ]
+ if symbol == key.ESCAPE:
+ self.w.on_close()
+ if symbol == key.RIGHT:
+ self.i = (self.i + 1) % len(names)
+ elif symbol == key.LEFT:
+ self.i = (self.i - 1) % len(names)
+ cursor = self.w.get_system_mouse_cursor(names[self.i])
+ self.w.set_mouse_cursor(cursor)
+ print('Set cursor to "%s"' % names[self.i])
+
+ return True
+
+ def test_set_visible(self):
+ self.width, self.height = 200, 200
+ self.w = w = Window(self.width, self.height)
+ try:
+ w.push_handlers(self)
+ while not w.has_exit:
+ glClear(GL_COLOR_BUFFER_BIT)
+ w.flip()
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_action
+class WINDOW_SET_MOUSE_VISIBLE(InteractiveTestCase):
+ """Test that mouse cursor can be made visible and hidden.
+
+ Expected behaviour:
+ One window will be opened. Press 'v' to hide mouse cursor and 'V' to
+ show mouse cursor. It should only affect the mouse when within the
+ client area of the window.
+
+ Close the window or press ESC to end the test.
+ """
+ def on_key_press(self, symbol, modifiers):
+ if symbol == key.V:
+ visible = (modifiers & key.MOD_SHIFT)
+ self.w.set_mouse_visible(visible)
+ print('Mouse is now %s' % (visible and 'visible' or 'hidden'))
+
+ def on_mouse_motion(self, x, y, dx, dy):
+ print('on_mousemotion(x=%f, y=%f, dx=%f, dy=%f)' % (x, y, dx, dy))
+
+ def test_set_visible(self):
+ self.width, self.height = 200, 200
+ self.w = w = Window(self.width, self.height)
+ try:
+ w.push_handlers(self)
+ while not w.has_exit:
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_action
+class WINDOW_SET_SIZE(InteractiveTestCase):
+ """Test that window size can be set.
+
+ Expected behaviour:
+ One window will be opened. The window's dimensions will be printed
+ to the terminal.
+
+ - press "x" to increase the width
+ - press "X" to decrease the width
+ - press "y" to increase the height
+ - press "Y" to decrease the height
+
+ You should see a green border inside the window but no red.
+
+ Close the window or press ESC to end the test.
+ """
+ def on_key_press(self, symbol, modifiers):
+ delta = 20
+ if modifiers & key.MOD_SHIFT:
+ delta = -delta
+ if symbol == key.X:
+ self.width += delta
+ elif symbol == key.Y:
+ self.height += delta
+ self.w.set_size(self.width, self.height)
+ print('Window size set to %dx%d.' % (self.width, self.height))
+
+ def test_set_size(self):
+ self.width, self.height = 200, 200
+ self.w = w = Window(self.width, self.height, resizable=True)
+ try:
+ w.push_handlers(self)
+ while not w.has_exit:
+ window_util.draw_client_border(w)
+ w.flip()
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_validation
+class WINDOW_SET_VISIBLE(InteractiveTestCase):
+ """Test that the window can be hidden and shown.
+
+ Expected behaviour:
+ One window will be opened. It will toggle between
+ hidden and shown.
+ """
+ def test_set_visible(self):
+ w = Window(200, 200)
+ try:
+ w.push_handlers(WindowEventLogger())
+ w.dispatch_events()
+ self.user_verify('Is the window visible?', take_screenshot=False)
+
+ w.set_visible(False)
+ w.dispatch_events()
+ self.user_verify('Is the window no longer visible?', take_screenshot=False)
+
+ w.set_visible(True)
+ w.dispatch_events()
+ self.user_verify('Is the window visible again?', take_screenshot=False)
+
+ finally:
+ w.close()
+
+
+@pytest.mark.requires_user_action
+class WINDOW_SET_VSYNC(InteractiveTestCase):
+ """Test that vsync can be set.
+
+ Expected behaviour:
+ A window will alternate between red and green fill.
+
+ - Press "v" to toggle vsync on/off. "Tearing" should only be visible
+ when vsync is off (as indicated at the terminal).
+
+ Not all video drivers support vsync. On Linux, check the output of
+ `tools/info.py`:
+
+ - If GLX_SGI_video_sync extension is present, should work as expected.
+ - If GLX_MESA_swap_control extension is present, should work as expected.
+ - If GLX_SGI_swap_control extension is present, vsync can be enabled,
+ but once enabled, it cannot be switched off (there will be no error
+ message).
+ - If none of these extensions are present, vsync is not supported by
+ your driver, but no error message or warning will be printed.
+
+ Close the window or press ESC to end the test.
+ """
+ colors = [(1, 0, 0, 1), (0, 1, 0, 1)]
+ color_index = 0
+
+ def open_window(self):
+ return Window(200, 200, vsync=False)
+
+ def on_key_press(self, symbol, modifiers):
+ if symbol == key.V:
+ vsync = not self.w1.vsync
+ self.w1.set_vsync(vsync)
+ print('vsync is %r' % self.w1.vsync)
+
+ def draw_window(self, window, colour):
+ window.switch_to()
+ glClearColor(*colour)
+ glClear(GL_COLOR_BUFFER_BIT)
+ window.flip()
+
+ def test_open_window(self):
+ self.w1 = self.open_window()
+ try:
+ self.w1.push_handlers(self)
+ print('vsync is %r' % self.w1.vsync)
+ while not self.w1.has_exit:
+ self.color_index = 1 - self.color_index
+ self.draw_window(self.w1, self.colors[self.color_index])
+ self.w1.dispatch_events()
+ finally:
+ self.w1.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_action
+class WINDOW_SET_CAPTION(InteractiveTestCase):
+ """Test that the window caption can be set.
+
+ Expected behaviour:
+ Two windows will be opened, one with the caption "Window caption 1"
+ counting up every second; the other with a Unicode string including
+ some non-ASCII characters.
+
+ Press escape or close either window to finished the test.
+ """
+ def test_caption(self):
+ try:
+ w1 = Window(400, 200, resizable=True)
+ w2 = Window(400, 200, resizable=True)
+ count = 1
+ w1.set_caption('Window caption %d' % count)
+ w2.set_caption(u'\u00bfHabla espa\u00f1ol?')
+ last_time = time.time()
+ while not (w1.has_exit or w2.has_exit):
+ if time.time() - last_time > 1:
+ count += 1
+ w1.set_caption('Window caption %d' % count)
+ last_time = time.time()
+ w1.dispatch_events()
+ w2.dispatch_events()
+ finally:
+ w1.close()
+ w2.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
+@pytest.mark.requires_user_action
+class WINDOW_FIXED_SET_SIZE(InteractiveTestCase):
+ """Test that a non-resizable window's size can be set.
+
+ Expected behaviour:
+ One window will be opened. The window's dimensions will be printed
+ to the terminal.
+
+ - press "x" to increase the width
+ - press "X" to decrease the width
+ - press "y" to increase the height
+ - press "Y" to decrease the height
+
+ You should see a green border inside the window but no red.
+
+ Close the window or press ESC to end the test.
+ """
+ def on_key_press(self, symbol, modifiers):
+ delta = 20
+ if modifiers & key.MOD_SHIFT:
+ delta = -delta
+ if symbol == key.X:
+ self.width += delta
+ elif symbol == key.Y:
+ self.height += delta
+ self.w.set_size(self.width, self.height)
+ print('Window size set to %dx%d.' % (self.width, self.height))
+
+ def test_set_size(self):
+ self.width, self.height = 200, 200
+ self.w = w = Window(self.width, self.height)
+ try:
+ w.push_handlers(self)
+ while not w.has_exit:
+ window_util.draw_client_border(w)
+ w.flip()
+ w.dispatch_events()
+ finally:
+ w.close()
+ self.user_verify('Pass test?', take_screenshot=False)
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_styles.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_styles.py
new file mode 100644
index 0000000..23feedd
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/test_window_styles.py
@@ -0,0 +1,35 @@
+import pytest
+
+from pyglet import window
+from tests.interactive.windowed_test_base import WindowedTestCase
+
+
+@pytest.mark.requires_user_validation
+class WindowStylesTest(WindowedTestCase):
+ """Test available window styles."""
+ pass
+
+WindowStylesTest.create_test_case(
+ name='test_style_borderless',
+ description='Test that window style can be borderless.',
+ question='Do you see one borderless window?',
+ window_options={'style': window.Window.WINDOW_STYLE_BORDERLESS},
+ take_screenshot=False
+ )
+
+WindowStylesTest.create_test_case(
+ name='test_style_tool',
+ description='Test that window style can be tool.',
+ question='Do you see one tool-styled window?',
+ window_options={'style': window.Window.WINDOW_STYLE_TOOL},
+ take_screenshot=False
+ )
+
+WindowStylesTest.create_test_case(
+ name='test_style_dialog',
+ description='Test that window style can be dialog.',
+ question='Do you see one dialog-styled window?',
+ window_options={'style': window.Window.WINDOW_STYLE_DIALOG},
+ take_screenshot=False
+ )
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/window_util.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/window_util.py
new file mode 100644
index 0000000..b82eaea
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/window/window_util.py
@@ -0,0 +1,28 @@
+#!/usr/bin/python
+# $Id:$
+
+from pyglet.gl import *
+
+def draw_client_border(window):
+ glClearColor(0, 0, 0, 1)
+ glClear(GL_COLOR_BUFFER_BIT)
+
+ glMatrixMode(GL_PROJECTION)
+ glLoadIdentity()
+ glOrtho(0, window.width, 0, window.height, -1, 1)
+
+ glMatrixMode(GL_MODELVIEW)
+ glLoadIdentity()
+ def rect(x1, y1, x2, y2):
+ glBegin(GL_LINE_LOOP)
+ glVertex2f(x1, y1)
+ glVertex2f(x2, y1)
+ glVertex2f(x2, y2)
+ glVertex2f(x1, y2)
+ glEnd()
+
+ glColor3f(1, 0, 0)
+ rect(-2, -2, window.width + 2, window.height + 2)
+
+ glColor3f(0, 1, 0)
+ rect(1, 1, window.width - 2, window.height - 2)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/windowed_test_base.py b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/windowed_test_base.py
new file mode 100644
index 0000000..4edc2d3
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/interactive/windowed_test_base.py
@@ -0,0 +1,82 @@
+"""Base class for interactive tests spawning a basic window."""
+
+from inspect import cleandoc
+
+from pyglet import gl
+from pyglet.window import Window
+
+from tests.base.interactive import InteractiveTestCase
+
+
+class WindowedTestCase(InteractiveTestCase):
+ """
+ Base class for tests that show a window, render something in that window and then ask a
+ question to the user whether the contents are correct. Also takes a screenshot when the
+ test is passed, so it can run without interaction afterwards.
+ """
+
+ # Defaults
+ window_size = 200, 200
+ window_options = None
+ window = None
+ question = None
+ take_screenshot = True
+
+ # Methods to override in implementations
+ def on_expose(self):
+ pass
+
+ def render(self):
+ pass
+
+ def draw(self):
+ pass
+
+ # Implementation of the base test class
+ @classmethod
+ def create_test_case(cls, name, description=None, decorators=None, **kwargs):
+ def run_test(self):
+ for name, value in kwargs.items():
+ setattr(self, name, value)
+ self._test_main()
+ run_test.__name__ = name
+ if description:
+ run_test.__doc__ = cleandoc(description)
+ if decorators:
+ for decorator in decorators:
+ run_test = decorator(run_test)
+ setattr(cls, name, run_test)
+
+ def _test_main(self):
+ assert self.question
+
+ self.window = w = Window(**self._get_window_options())
+ try:
+ w.push_handlers(self)
+ self.render()
+ w.set_visible()
+ w.dispatch_events()
+
+ self.user_verify(cleandoc(self.question), self.take_screenshot)
+
+ finally:
+ w.close()
+
+ def _get_window_options(self):
+ if self.window_options:
+ options = self.window_options
+ else:
+ options = {}
+
+ if not 'width' in options:
+ options['width'] = self.window_size[0]
+ if not 'height' in options:
+ options['height'] = self.window_size[1]
+ if not 'visible' in options:
+ options['visible'] = False
+ if not 'resizable' in options:
+ options['resizable'] = True
+
+ return options
+
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/run.py b/pyglet-1.3.0/pyglet-1.3.0/tests/run.py
new file mode 100644
index 0000000..8d7b299
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/run.py
@@ -0,0 +1,154 @@
+"""
+For documentation please see doc/internal/testing.txt
+"""
+from __future__ import print_function
+import argparse
+import imp
+import os
+import pyglet
+import sys
+from tests.annotations import Platform
+import unittest
+
+try:
+ from coverage import coverage
+ _cov = None
+except:
+ coverage = None
+
+def _parse_args():
+ parser = argparse.ArgumentParser(description='Pyglet test runner',
+ formatter_class=argparse.RawTextHelpFormatter)
+
+ suite_choices = ['unit', 'integration', 'interactive', 'sanity', 'automatic']
+ suite_help = """Test suite(s) to run. Has the following options:
+- unit: Run the unit tests.
+- integration: Run the integration tests.
+- interactive: Run the interactive tests.
+- sanity: Run all tests. For the interactive tests do not use interactive prompts and try to
+ run as many tests as possible. (Same as: unit integration interactve --sanity).
+- automatic: Run all tests. For the interactive tests skip the tests that cannot validate without
+ user interaction. (Same as: unit integration interactive --non-interactive)."""
+ coverage_help = 'Determine test coverage and create an HTML report for it.'
+ if coverage is None:
+ coverage_help += '\nTo use, install coverage (pip install coverage)'
+ parser.add_argument('suites',
+ metavar='SUITE',
+ nargs='*',
+ choices=suite_choices,
+ help=suite_help
+ )
+ parser.add_argument('--non-interactive', '-n',
+ action='store_true',
+ help='[Interactive tests only] Do not use interactive prompts. Skip tests that cannot validate or run without.'
+ )
+ parser.add_argument('--sanity', '-s',
+ action='store_true',
+ help='[Interactive tests only] Do not use interactive prompts. Only skips tests that cannot finish without user intervention.'
+ )
+ parser.add_argument('--coverage', '-c',
+ action='store_true',
+ help=coverage_help
+ )
+ parser.add_argument('--verbose', '-v',
+ action='store_const',
+ const=2,
+ default=1,
+ help='Enable unittest verbose output.'
+ )
+
+ options = parser.parse_args()
+
+ if 'sanity' in options.suites:
+ if len(options.suites) > 1:
+ print('sanity suite cannot be combined with other suites')
+ sys.exit(-1)
+ options.suites = ['unit', 'integration', 'interactive']
+ options.non_interactive = False
+ options.sanity = True
+ elif 'automatic' in options.suites:
+ if len(options.suites) > 1:
+ print('automatic suite cannot be combined with other suites')
+ sys.exit(-1)
+ options.suites = ['unit', 'integration', 'interactive']
+ options.non_interactive = True
+ options.sanity = False
+
+ return options
+
+def _load_suites(suites):
+ loader = unittest.loader.defaultTestLoader
+ tests_dir = os.path.dirname(__file__)
+ top_dir = os.path.abspath(os.path.join(tests_dir, '..'))
+
+ combined_suite = unittest.TestSuite()
+ for suite in suites:
+ start_dir = os.path.join(tests_dir, suite)
+ loaded_suite = loader.discover(start_dir, top_level_dir=top_dir)
+ if loaded_suite:
+ combined_suite.addTests(loaded_suite)
+
+ return combined_suite
+
+def _run_suites(test_suite, options):
+ if options.non_interactive or options.sanity:
+ import tests.interactive.interactive_test_base
+ if options.non_interactive:
+ tests.interactive.interactive_test_base.set_noninteractive_only_automatic()
+ else:
+ tests.interactive.interactive_test_base.set_noninteractive_sanity()
+
+ runner = unittest.TextTestRunner(verbosity=options.verbose)
+ runner.run(test_suite)
+
+def _start_coverage(options):
+ if coverage is not None and options.coverage:
+ global _cov
+ _cov = coverage(branch=True,
+ source=['pyglet'],
+ omit=_get_platform_omit())
+ _cov.exclude('if _debug:')
+ _cov.exclude('@abstractmethod')
+ _cov.exclude('pass')
+ _cov.start()
+
+ # Need to reload pyglet to get full coverage, because it was imported before coverage was
+ # started
+ imp.reload(pyglet)
+
+def _stop_coverage(options):
+ if coverage is not None and options.coverage:
+ global _cov
+ _cov.stop()
+ _cov.html_report(directory='coverage_report')
+ html_report = os.path.abspath(os.path.join('coverage_report', 'index.html'))
+ print('Coverage report: file://' + html_report)
+
+def _get_platform_omit():
+ omit = ['pyglet/extlibs/*']
+
+ windows_specific = ['*win32*', '*wgl*', '*gdiplus*', '*wintab*', '*directsound*']
+ linux_specific = ['*xlib*', '*freetype*', '*glx*', '*gdkpixbuf2*', '*x11*', '*pulse*']
+ osx_specific = ['*agl*', '*darwin*']
+ osx_carbon_specific = ['*carbon*', '*quicktime*']
+ osx_cocoa_specific = ['*cocoa*', '*quartz*']
+
+ if pyglet.compat_platform not in Platform.LINUX:
+ omit.extend(linux_specific)
+ if pyglet.compat_platform not in Platform.WINDOWS:
+ omit.extend(windows_specific)
+ if pyglet.compat_platform not in Platform.OSX:
+ omit.extend(osx_specific)
+ omit.extend(osx_carbon_specific)
+ omit.extend(osx_cocoa_specific)
+ if pyglet.compat_platform in Platform.OSX:
+ if pyglet.options['darwin_cocoa']:
+ omit.extend(osx_carbon_specific)
+ else:
+ omit.extend(osx_cocoa_specific)
+
+ return omit
+
+if __name__ == '__main__':
+ import pytest
+ sys.exit(pytest.main())
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/unit/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/unit/media/__init__.py b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/media/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/unit/media/test_player.py b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/media/test_player.py
new file mode 100644
index 0000000..4a6f46b
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/media/test_player.py
@@ -0,0 +1,900 @@
+from __future__ import division
+from builtins import range
+import ctypes
+from tests import mock
+import os
+import random
+from tests.base.future_test import FutureTestCase
+
+import pyglet
+from pyglet.media.player import Player, PlayerGroup
+from pyglet.media.sources.base import *
+
+#pyglet.options['debug_media'] = True
+
+
+class PlayerTestCase(FutureTestCase):
+ # Default values to use
+ audio_format_1 = AudioFormat(1, 8, 11025)
+ audio_format_2 = AudioFormat(2, 8, 11025)
+ audio_format_3 = AudioFormat(2, 16, 44100)
+ video_format_1 = VideoFormat(800, 600)
+ video_format_2 = VideoFormat(1920, 1280)
+ video_format_2.frame_rate = 25
+
+ def setUp(self):
+ self.player = Player()
+
+ self._get_audio_driver_patcher = mock.patch('pyglet.media.player.get_audio_driver')
+ self.mock_get_audio_driver = self._get_audio_driver_patcher.start()
+ self.mock_audio_driver = self.mock_get_audio_driver.return_value
+ self.mock_audio_driver_player = self.mock_audio_driver.create_audio_player.return_value
+
+ self._get_silent_audio_driver_patcher = mock.patch('pyglet.media.player.get_silent_audio_driver')
+ self.mock_get_silent_audio_driver = self._get_silent_audio_driver_patcher.start()
+ self.mock_silent_audio_driver = self.mock_get_silent_audio_driver.return_value
+ self.mock_silent_audio_driver_player = self.mock_silent_audio_driver.create_audio_player.return_value
+
+ self._clock_patcher = mock.patch('pyglet.clock')
+ self.mock_clock = self._clock_patcher.start()
+
+ self._texture_patcher = mock.patch('pyglet.image.Texture.create')
+ self.mock_texture_create = self._texture_patcher.start()
+ self.mock_texture = self.mock_texture_create.return_value
+ # Need to do this as side_effect instead of return_value, or reset_mock will recurse
+ self.mock_texture.get_transform.side_effect = lambda flip_y: self.mock_texture
+
+ self.current_playing_source_group = None
+
+ def tearDown(self):
+ self._get_audio_driver_patcher.stop()
+ self._get_silent_audio_driver_patcher.stop()
+ self._clock_patcher.stop()
+ self._texture_patcher.stop()
+
+ def reset_mocks(self):
+ # These mocks will recursively reset their children
+ self.mock_get_audio_driver.reset_mock()
+ self.mock_get_silent_audio_driver.reset_mock()
+ self.mock_clock.reset_mock()
+ self.mock_texture_create.reset_mock()
+
+ def create_mock_source(self, audio_format, video_format):
+ mock_source = mock.MagicMock()
+ type(mock_source).audio_format = mock.PropertyMock(return_value=audio_format)
+ type(mock_source).video_format = mock.PropertyMock(return_value=video_format)
+ type(mock_source._get_queue_source.return_value).audio_format = mock.PropertyMock(return_value=audio_format)
+ type(mock_source._get_queue_source.return_value).video_format = mock.PropertyMock(return_value=video_format)
+ return mock_source
+
+ def set_video_data_for_mock_source(self, mock_source, timestamp_data_pairs):
+ """Make the given mock source return video data. Video data is given in pairs of timestamp
+ and data to return."""
+ def _get_frame():
+ if timestamp_data_pairs:
+ current_frame = timestamp_data_pairs.pop(0)
+ return current_frame[1]
+ def _get_timestamp():
+ if timestamp_data_pairs:
+ return timestamp_data_pairs[0][0]
+ queue_source = mock_source._get_queue_source.return_value
+ queue_source.get_next_video_timestamp.side_effect = _get_timestamp
+ queue_source.get_next_video_frame.side_effect = _get_frame
+
+ def assert_not_playing_yet(self, current_source=None):
+ """Assert the the player did not start playing yet."""
+ self.assertFalse(self.mock_get_audio_driver.called, msg='No audio driver required yet')
+ self.assertAlmostEqual(self.player.time, 0.)
+ self.assert_not_playing(current_source)
+
+ def assert_not_playing(self, current_source=None):
+ self._assert_playing(False, current_source)
+
+ def assert_now_playing(self, current_source):
+ self._assert_playing(True, current_source)
+
+ def _assert_playing(self, playing, current_source=None):
+ self.assertEqual(self.player.playing, playing)
+ queued_source = (current_source._get_queue_source.return_value
+ if current_source is not None
+ else None)
+ self.assertIs(self.player.source, queued_source)
+
+ def assert_driver_player_created_for(self, *sources):
+ """Assert that a driver specific audio player is created to play back given sources"""
+ self._assert_player_created_for(self.mock_get_audio_driver, self.mock_audio_driver, *sources)
+
+ def assert_silent_driver_player_created_for(self, *sources):
+ """Assert that a silent audio player is created for given sources."""
+ self._assert_player_created_for(self.mock_get_silent_audio_driver, self.mock_silent_audio_driver, *sources)
+
+ def _assert_player_created_for(self, mock_get_audio_driver, mock_audio_driver, *sources):
+ mock_get_audio_driver.assert_called_once_with()
+ self.assertEqual(mock_audio_driver.create_audio_player.call_count, 1)
+ call_args = mock_audio_driver.create_audio_player.call_args
+ self.assertIsInstance(call_args[0][0], SourceGroup)
+ self.assertIs(call_args[0][1], self.player)
+
+ self.current_playing_source_group = call_args[0][0]
+ self.assert_in_current_playing_source_group(*sources)
+
+ def assert_no_new_driver_player_created(self):
+ """Assert that no new driver specific audio player is created."""
+ self.assertFalse(self.mock_get_audio_driver.called, msg='No new audio driver should be created')
+
+ def assert_in_current_playing_source_group(self, *sources):
+ self.assertIsNotNone(self.current_playing_source_group, msg='No previous call to create driver player')
+
+ queue_sources = [source._get_queue_source.return_value for source in sources]
+ self.assertListEqual(self.current_playing_source_group._sources, queue_sources)
+
+ def assert_driver_player_destroyed(self):
+ self.mock_audio_driver_player.delete.assert_called_once_with()
+
+ def assert_driver_player_not_destroyed(self):
+ self.assertFalse(self.mock_audio_driver_player.delete.called)
+
+ def assert_silent_driver_player_destroyed(self):
+ self.mock_silent_audio_driver_player.delete.assert_called_once_with()
+
+ def assert_driver_player_started(self):
+ self.mock_audio_driver_player.play.assert_called_once_with()
+
+ def assert_driver_player_stopped(self):
+ self.mock_audio_driver_player.stop.assert_called_once_with()
+
+ def assert_driver_player_cleared(self):
+ self.mock_audio_driver_player.clear.assert_called_once_with()
+
+ def assert_source_seek(self, source, time):
+ source._get_queue_source.return_value.seek.assert_called_once_with(time)
+
+ def assert_new_texture_created(self, video_format):
+ self.mock_texture_create.assert_called_once_with(video_format.width, video_format.height, rectangle=True)
+
+ def assert_no_new_texture_created(self):
+ self.assertFalse(self.mock_texture_create.called)
+
+ def assert_texture_updated(self, frame_data):
+ self.mock_texture.blit_into.assert_called_once_with(frame_data, 0, 0, 0)
+
+ def assert_texture_not_updated(self):
+ self.assertFalse(self.mock_texture.blit_into.called)
+
+ def assert_update_texture_scheduled(self, period):
+ self.mock_clock.schedule_interval.assert_called_once_with(self.player.update_texture, period)
+
+ def assert_update_texture_unscheduled(self):
+ self.mock_clock.unschedule.assert_called_once_with(self.player.update_texture)
+
+ def pretend_driver_player_at_time(self, t):
+ self.mock_audio_driver_player.get_time.return_value = t
+
+ def pretend_silent_driver_player_at_time(self, t):
+ self.mock_silent_audio_driver_player.get_time.return_value = t
+
+ def test_queue_single_audio_source_and_play(self):
+ """Queue a single audio source and start playing it."""
+
+ mock_source = self.create_mock_source(self.audio_format_1, None)
+ self.player.queue(mock_source)
+ self.assert_not_playing_yet(mock_source)
+
+ self.player.play()
+ self.assert_driver_player_created_for(mock_source)
+ self.assert_driver_player_started()
+ self.assert_now_playing(mock_source)
+
+ def test_queue_multiple_audio_sources_same_format_and_play(self):
+ """Queue multiple audio sources using the same audio format and start playing."""
+ mock_source1 = self.create_mock_source(self.audio_format_1, None)
+ mock_source2 = self.create_mock_source(self.audio_format_1, None)
+ mock_source3 = self.create_mock_source(self.audio_format_1, None)
+
+ self.player.queue(mock_source1)
+ self.assert_not_playing_yet(mock_source1)
+
+ self.player.queue(mock_source2)
+ self.assert_not_playing_yet(mock_source1)
+
+ self.player.queue(mock_source3)
+ self.assert_not_playing_yet(mock_source1)
+
+ self.player.play()
+ self.assert_driver_player_created_for(mock_source1, mock_source2, mock_source3)
+ self.assert_driver_player_started()
+ self.assert_now_playing(mock_source1)
+
+ def test_queue_multiple_audio_sources_different_format_and_play_and_skip(self):
+ """Queue multiple audio sources having different formats and start playing. Different
+ formats should be played by seperate driver players."""
+ mock_source1 = self.create_mock_source(self.audio_format_1, None)
+ mock_source2 = self.create_mock_source(self.audio_format_2, None)
+ mock_source3 = self.create_mock_source(self.audio_format_3, None)
+
+ self.player.queue(mock_source1)
+ self.assert_not_playing_yet(mock_source1)
+
+ self.player.queue(mock_source2)
+ self.assert_not_playing_yet(mock_source1)
+
+ self.player.queue(mock_source3)
+ self.assert_not_playing_yet(mock_source1)
+
+ self.player.play()
+ self.assert_driver_player_created_for(mock_source1)
+ self.assert_driver_player_started()
+ self.assert_now_playing(mock_source1)
+
+ self.reset_mocks()
+ self.player.next_source()
+ self.assert_driver_player_destroyed()
+ self.assert_driver_player_created_for(mock_source2)
+ self.assert_driver_player_started()
+ self.assert_now_playing(mock_source2)
+
+ self.reset_mocks()
+ self.player.next_source()
+ self.assert_driver_player_destroyed()
+ self.assert_driver_player_created_for(mock_source3)
+ self.assert_driver_player_started()
+ self.assert_now_playing(mock_source3)
+
+ def test_queue_multiple_audio_sources_same_format_and_play_and_skip(self):
+ """When multiple audio sources with the same format are queued, they are played using the
+ same driver player. Skipping to the next source is just advancing the source group.
+ """
+ mock_source1 = self.create_mock_source(self.audio_format_1, None)
+ mock_source2 = self.create_mock_source(self.audio_format_1, None)
+ mock_source3 = self.create_mock_source(self.audio_format_1, None)
+
+ self.player.queue(mock_source1)
+ self.player.queue(mock_source2)
+ self.player.queue(mock_source3)
+
+ self.player.play()
+ self.assert_driver_player_created_for(mock_source1, mock_source2, mock_source3)
+ self.assert_driver_player_started()
+ self.assert_now_playing(mock_source1)
+
+ self.reset_mocks()
+ self.player.next_source()
+ self.assert_in_current_playing_source_group(mock_source2, mock_source3)
+ self.assert_driver_player_not_destroyed()
+ self.assert_no_new_driver_player_created()
+ self.assert_now_playing(mock_source2)
+
+ self.reset_mocks()
+ self.player.next_source()
+ self.assert_in_current_playing_source_group(mock_source3)
+ self.assert_driver_player_not_destroyed()
+ self.assert_no_new_driver_player_created()
+ self.assert_now_playing(mock_source3)
+
+ def test_on_eos_ignored(self):
+ """The player receives on_eos for every source, but does not need to do anything."""
+ mock_source1 = self.create_mock_source(self.audio_format_1, None)
+ mock_source2 = self.create_mock_source(self.audio_format_1, None)
+ mock_source3 = self.create_mock_source(self.audio_format_1, None)
+
+ self.player.queue(mock_source1)
+ self.player.queue(mock_source2)
+ self.player.queue(mock_source3)
+
+ self.player.play()
+ self.assert_driver_player_created_for(mock_source1, mock_source2, mock_source3)
+ self.assert_driver_player_started()
+
+ self.reset_mocks()
+ self.player.dispatch_event('on_eos')
+ self.assert_driver_player_not_destroyed()
+ # The following is not completely realistic, in normal cases the source group would have
+ # advanced to the next source, but in this case we want to see it is also not manually
+ # advanced by the player
+ self.assert_in_current_playing_source_group(mock_source1, mock_source2, mock_source3)
+
+ def test_on_source_group_eos_advance_to_next_group(self):
+ """If a source group is depleted and a next group is available, start a new player for
+ the next group."""
+ mock_source1 = self.create_mock_source(self.audio_format_1, None)
+ mock_source2 = self.create_mock_source(self.audio_format_2, None)
+ mock_source3 = self.create_mock_source(self.audio_format_3, None)
+
+ self.player.queue(mock_source1)
+ self.player.queue(mock_source2)
+ self.player.queue(mock_source3)
+ self.assert_not_playing_yet(mock_source1)
+
+ self.player.play()
+ self.assert_driver_player_created_for(mock_source1)
+ self.assert_driver_player_started()
+
+ self.reset_mocks()
+ self.player.dispatch_event('on_source_group_eos')
+ self.assert_driver_player_destroyed()
+ self.assert_driver_player_created_for(mock_source2)
+ self.assert_now_playing(mock_source2)
+
+ def test_player_stops_after_last_group_eos(self):
+ """If the last or only source group is eos, the player stops."""
+ mock_source = self.create_mock_source(self.audio_format_1, None)
+ self.player.queue(mock_source)
+ self.assert_not_playing_yet(mock_source)
+
+ self.player.play()
+ self.assert_driver_player_created_for(mock_source)
+ self.assert_driver_player_started()
+ self.assert_now_playing(mock_source)
+
+ self.reset_mocks()
+ self.player.dispatch_event('on_source_group_eos')
+ self.assert_driver_player_destroyed()
+ self.assert_not_playing(None)
+
+ def test_eos_events(self):
+ """Test receiving various eos events: on source eos, on source group eos and on player eos.
+ """
+ on_eos_mock = mock.MagicMock(return_value=None)
+ self.player.event('on_eos')(on_eos_mock)
+ on_source_group_eos_mock = mock.MagicMock(return_value=None)
+ self.player.event('on_source_group_eos')(on_source_group_eos_mock)
+ on_player_eos_mock = mock.MagicMock(return_value=None)
+ self.player.event('on_player_eos')(on_player_eos_mock)
+
+ def reset_eos_mocks():
+ on_eos_mock.reset_mock()
+ on_source_group_eos_mock.reset_mock()
+ on_player_eos_mock.reset_mock()
+
+ def assert_eos_events_received(on_eos=False, on_source_group_eos=False, on_player_eos=False):
+ self.assertEqual(on_eos_mock.called, on_eos)
+ self.assertEqual(on_source_group_eos_mock.called, on_source_group_eos)
+ self.assertEqual(on_player_eos_mock.called, on_player_eos)
+
+ mock_source1 = self.create_mock_source(self.audio_format_1, None)
+ mock_source2 = self.create_mock_source(self.audio_format_1, None)
+ mock_source3 = self.create_mock_source(self.audio_format_2, None)
+
+ self.player.queue(mock_source1)
+ self.player.queue(mock_source2)
+ self.player.queue(mock_source3)
+ self.assert_not_playing_yet(mock_source1)
+
+ self.player.play()
+ self.assert_driver_player_created_for(mock_source1, mock_source2)
+
+ self.reset_mocks()
+ reset_eos_mocks()
+ # Pretend the current source in the group was eos and next source started
+ self.current_playing_source_group.next_source()
+ self.player.dispatch_event('on_eos')
+ self.assert_driver_player_not_destroyed()
+ assert_eos_events_received(on_eos=True)
+
+ self.reset_mocks()
+ reset_eos_mocks()
+ # Pretend current source group is eos, triggers player to play next source group on a new
+ # player
+ self.player.dispatch_event('on_source_group_eos')
+ self.assert_driver_player_destroyed()
+ self.assert_driver_player_created_for(mock_source3)
+ assert_eos_events_received(on_source_group_eos=True)
+
+ self.reset_mocks()
+ reset_eos_mocks()
+ # Pretend current source group is eos. Should be no more source groups to play.
+ self.player.dispatch_event('on_source_group_eos')
+ self.assert_driver_player_destroyed()
+ self.assert_not_playing(None)
+ assert_eos_events_received(on_source_group_eos=True, on_player_eos=True)
+
+ def test_pause_resume(self):
+ """A stream can be paused. After that play will resume where paused."""
+ mock_source = self.create_mock_source(self.audio_format_1, None)
+ self.player.queue(mock_source)
+ self.player.play()
+ self.assert_driver_player_created_for(mock_source)
+ self.assert_driver_player_started()
+ self.assert_now_playing(mock_source)
+
+ self.reset_mocks()
+ self.pretend_driver_player_at_time(0.5)
+ self.player.pause()
+ self.assert_driver_player_stopped()
+ self.assert_driver_player_not_destroyed()
+
+ self.reset_mocks()
+ self.pretend_driver_player_at_time(0.6)
+ self.assertEqual(self.player.time, 0.5, msg='While paused, player should returned paused time')
+
+ self.reset_mocks()
+ self.player.play()
+ self.assert_driver_player_started()
+ self.assert_no_new_driver_player_created()
+ self.assert_now_playing(mock_source)
+ self.assertEqual(self.player.time, 0.6, msg='While playing, player should return time from driver player')
+
+ def test_delete(self):
+ """Test clean up of the player when delete() is called."""
+ mock_source1 = self.create_mock_source(self.audio_format_1, None)
+ mock_source2 = self.create_mock_source(self.audio_format_2, None)
+ mock_source3 = self.create_mock_source(self.audio_format_3, None)
+
+ self.player.queue(mock_source1)
+ self.player.queue(mock_source2)
+ self.player.queue(mock_source3)
+ self.assert_not_playing_yet(mock_source1)
+
+ self.player.play()
+ self.assert_driver_player_created_for(mock_source1)
+ self.assert_driver_player_started()
+
+ self.reset_mocks()
+ self.pretend_driver_player_at_time(1.)
+ self.player.delete()
+ self.assert_driver_player_stopped()
+ self.assert_driver_player_destroyed()
+
+ def test_empty_player(self):
+ """A player without queued sources should not start a driver player and should not raise
+ exceptions"""
+ self.assert_not_playing_yet(None)
+
+ self.reset_mocks()
+ self.player.play()
+ self.assert_no_new_driver_player_created()
+
+ self.reset_mocks()
+ self.player.pause()
+ self.assert_no_new_driver_player_created()
+ self.assert_driver_player_not_destroyed()
+
+ self.reset_mocks()
+ self.player.next_source()
+ self.assert_no_new_driver_player_created()
+ self.assert_driver_player_not_destroyed()
+
+ self.reset_mocks()
+ self.player.seek(0.8)
+ self.assert_no_new_driver_player_created()
+ self.assert_driver_player_not_destroyed()
+
+ self.player.delete()
+
+ def test_set_player_properties_before_playing(self):
+ """When setting player properties before a driver specific player is created, these settings
+ should be propagated after creating the player."""
+ mock_source1 = self.create_mock_source(self.audio_format_1, None)
+ mock_source2 = self.create_mock_source(self.audio_format_2, None)
+ self.player.queue(mock_source1)
+ self.player.queue(mock_source2)
+ self.assert_not_playing_yet(mock_source1)
+
+ self.reset_mocks()
+ self.player.volume = 10.
+ self.player.min_distance = 2.
+ self.player.max_distance = 3.
+ self.player.position = (4, 4, 4)
+ self.player.pitch = 5.0
+ self.player.cone_orientation = (6, 6, 6)
+ self.player.cone_inner_angle = 7.
+ self.player.cone_outer_angle = 8.
+ self.player.cone_outer_gain = 9.
+
+ def assert_properties_set():
+ self.mock_audio_driver_player.set_volume.assert_called_once_with(10.)
+ self.mock_audio_driver_player.set_min_distance.assert_called_once_with(2.)
+ self.mock_audio_driver_player.set_max_distance.assert_called_once_with(3.)
+ self.mock_audio_driver_player.set_position.assert_called_once_with((4, 4, 4))
+ self.mock_audio_driver_player.set_pitch.assert_called_once_with(5.)
+ self.mock_audio_driver_player.set_cone_orientation.assert_called_once_with((6, 6, 6))
+ self.mock_audio_driver_player.set_cone_inner_angle.assert_called_once_with(7.)
+ self.mock_audio_driver_player.set_cone_outer_angle.assert_called_once_with(8.)
+ self.mock_audio_driver_player.set_cone_outer_gain.assert_called_once_with(9.)
+
+ self.reset_mocks()
+ self.player.play()
+ self.assert_driver_player_created_for(mock_source1)
+ self.assert_now_playing(mock_source1)
+ assert_properties_set()
+
+ self.reset_mocks()
+ self.player.next_source()
+ self.assert_driver_player_destroyed()
+ self.assert_driver_player_created_for(mock_source2)
+ assert_properties_set()
+
+ def test_set_player_properties_while_playing(self):
+ """When setting player properties while playing, the properties should be propagated to the
+ driver specific player right away."""
+ mock_source1 = self.create_mock_source(self.audio_format_1, None)
+ mock_source2 = self.create_mock_source(self.audio_format_2, None)
+ self.player.queue(mock_source1)
+ self.player.queue(mock_source2)
+ self.assert_not_playing_yet(mock_source1)
+
+ self.reset_mocks()
+ self.player.play()
+ self.assert_driver_player_created_for(mock_source1)
+ self.assert_now_playing(mock_source1)
+
+ self.reset_mocks()
+ self.player.volume = 10.
+ self.mock_audio_driver_player.set_volume.assert_called_once_with(10.)
+
+ self.reset_mocks()
+ self.player.min_distance = 2.
+ self.mock_audio_driver_player.set_min_distance.assert_called_once_with(2.)
+
+ self.reset_mocks()
+ self.player.max_distance = 3.
+ self.mock_audio_driver_player.set_max_distance.assert_called_once_with(3.)
+
+ self.reset_mocks()
+ self.player.position = (4, 4, 4)
+ self.mock_audio_driver_player.set_position.assert_called_once_with((4, 4, 4))
+
+ self.reset_mocks()
+ self.player.pitch = 5.0
+ self.mock_audio_driver_player.set_pitch.assert_called_once_with(5.)
+
+ self.reset_mocks()
+ self.player.cone_orientation = (6, 6, 6)
+ self.mock_audio_driver_player.set_cone_orientation.assert_called_once_with((6, 6, 6))
+
+ self.reset_mocks()
+ self.player.cone_inner_angle = 7.
+ self.mock_audio_driver_player.set_cone_inner_angle.assert_called_once_with(7.)
+
+ self.reset_mocks()
+ self.player.cone_outer_angle = 8.
+ self.mock_audio_driver_player.set_cone_outer_angle.assert_called_once_with(8.)
+
+ self.reset_mocks()
+ self.player.cone_outer_gain = 9.
+ self.mock_audio_driver_player.set_cone_outer_gain.assert_called_once_with(9.)
+
+ self.reset_mocks()
+ self.player.next_source()
+ self.assert_driver_player_destroyed()
+ self.assert_driver_player_created_for(mock_source2)
+ self.mock_audio_driver_player.set_volume.assert_called_once_with(10.)
+ self.mock_audio_driver_player.set_min_distance.assert_called_once_with(2.)
+ self.mock_audio_driver_player.set_max_distance.assert_called_once_with(3.)
+ self.mock_audio_driver_player.set_position.assert_called_once_with((4, 4, 4))
+ self.mock_audio_driver_player.set_pitch.assert_called_once_with(5.)
+ self.mock_audio_driver_player.set_cone_orientation.assert_called_once_with((6, 6, 6))
+ self.mock_audio_driver_player.set_cone_inner_angle.assert_called_once_with(7.)
+ self.mock_audio_driver_player.set_cone_outer_angle.assert_called_once_with(8.)
+ self.mock_audio_driver_player.set_cone_outer_gain.assert_called_once_with(9.)
+
+ def test_seek(self):
+ """Test seeking to a specific time in the current source."""
+ mock_source = self.create_mock_source(self.audio_format_1, None)
+ self.player.queue(mock_source)
+ self.assert_not_playing_yet(mock_source)
+
+ self.reset_mocks()
+ mock_source.reset_mock()
+ self.player.seek(0.7)
+ self.assert_source_seek(mock_source, 0.7)
+
+ self.reset_mocks()
+ mock_source.reset_mock()
+ self.player.play()
+ self.assert_driver_player_created_for(mock_source)
+ self.assert_now_playing(mock_source)
+
+ self.reset_mocks()
+ mock_source.reset_mock()
+ self.player.seek(0.2)
+ self.assert_source_seek(mock_source, 0.2)
+ # Clear buffers for immediate result
+ self.assert_driver_player_cleared()
+
+ def test_queue_source_group(self):
+ """Source groups can also be queued. They are added as is without checking compatibility
+ with the current source group."""
+ mock_source1 = self.create_mock_source(self.audio_format_1, None)
+ mock_source2 = self.create_mock_source(self.audio_format_1, None)
+ mock_source3 = self.create_mock_source(self.audio_format_1, None)
+ group = SourceGroup(self.audio_format_1, None)
+ group.queue(mock_source2)
+ group.queue(mock_source3)
+
+ self.player.queue(mock_source1)
+ self.player.queue(group)
+ self.assert_not_playing_yet(mock_source1)
+
+ self.reset_mocks()
+ self.player.play()
+ self.assert_driver_player_created_for(mock_source1)
+ self.assert_driver_player_started()
+ self.assert_now_playing(mock_source1)
+
+ self.reset_mocks()
+ self.player.next_source()
+ self.assert_driver_player_destroyed()
+ self.assert_driver_player_created_for(mock_source2, mock_source3)
+ self.assert_driver_player_started()
+ self.assert_now_playing(mock_source2)
+
+ def test_video_queue_and_play(self):
+ """Sources can also include video. Instead of using a player to continuously play the video
+ a texture is updated on a fixed interval."""
+ mock_source = self.create_mock_source(self.audio_format_1, self.video_format_1)
+ self.set_video_data_for_mock_source(mock_source, [(0.2, 'a')])
+ self.player.queue(mock_source)
+ self.assert_not_playing_yet(mock_source)
+
+ self.reset_mocks()
+ self.player.play()
+ self.assert_driver_player_created_for(mock_source)
+ self.assert_driver_player_started()
+ self.assert_now_playing(mock_source)
+ self.assert_new_texture_created(self.video_format_1)
+ self.assert_update_texture_scheduled(1 / 30)
+
+ self.reset_mocks()
+ self.pretend_driver_player_at_time(0.2)
+ self.player.update_texture()
+ self.assert_texture_updated('a')
+ self.assertIs(self.player.get_texture(), self.mock_texture)
+
+ def test_video_peek_before_play(self):
+ """Before starting to play a video source, we can peek and see a frame. It will then
+ wait for the next frame when play has started."""
+ mock_source = self.create_mock_source(self.audio_format_1, self.video_format_1)
+ self.set_video_data_for_mock_source(mock_source, [(0.1, 'a'), (0.2, 'b')])
+ self.player.queue(mock_source)
+ self.assert_not_playing_yet(mock_source)
+
+ self.reset_mocks()
+ self.player.update_texture(time=0.1)
+ self.assert_new_texture_created(self.video_format_1)
+ self.assert_not_playing_yet(mock_source)
+ self.assert_texture_updated('a')
+
+ self.reset_mocks()
+ self.player.play()
+ self.assert_now_playing(mock_source)
+ self.assert_update_texture_scheduled(1 / 30)
+ self.assert_no_new_texture_created()
+ self.assert_texture_not_updated()
+
+ self.reset_mocks()
+ self.pretend_driver_player_at_time(0.0)
+ self.player.update_texture()
+ self.assert_no_new_texture_created()
+ self.assert_texture_not_updated()
+
+ self.reset_mocks()
+ self.pretend_driver_player_at_time(0.1)
+ self.player.update_texture()
+ self.assert_no_new_texture_created()
+ self.assert_texture_not_updated()
+
+ self.reset_mocks()
+ self.pretend_driver_player_at_time(0.2)
+ self.player.update_texture()
+ self.assert_no_new_texture_created()
+ self.assert_texture_updated('b')
+
+ def test_video_seek(self):
+ """Sources with video can also be seeked. This will cause the audio source to seek and
+ video will follow the timestamps."""
+ mock_source = self.create_mock_source(self.audio_format_1, self.video_format_1)
+ self.set_video_data_for_mock_source(mock_source, [(0.0, 'a'), (0.1, 'b'), (0.2, 'c'),
+ (0.3, 'd'), (0.4, 'e'), (0.5, 'f')])
+ self.player.queue(mock_source)
+ self.player.play()
+ self.assert_new_texture_created(self.video_format_1)
+ self.assert_update_texture_scheduled(1 / 30)
+
+ self.reset_mocks()
+ self.pretend_driver_player_at_time(0.0)
+ self.player.update_texture()
+ self.assert_texture_updated('a')
+
+ self.reset_mocks()
+ self.player.seek(0.3)
+ self.assert_source_seek(mock_source, 0.3)
+ self.assert_no_new_texture_created()
+ self.assert_texture_updated('d')
+
+ self.reset_mocks()
+ self.pretend_driver_player_at_time(0.3)
+ self.player.update_texture()
+ self.assert_texture_not_updated()
+
+ self.reset_mocks()
+ self.pretend_driver_player_at_time(0.4)
+ self.player.update_texture()
+ self.assert_texture_updated('e')
+
+ def test_video_frame_rate(self):
+ """Videos with different framerates need to be rescheduled at the clock."""
+ mock_source1 = self.create_mock_source(self.audio_format_1, self.video_format_1)
+ mock_source2 = self.create_mock_source(self.audio_format_1, self.video_format_2)
+ self.player.queue(mock_source1)
+ self.player.queue(mock_source2)
+
+ self.player.play()
+ self.assert_new_texture_created(self.video_format_1)
+ self.assert_update_texture_scheduled(1 / 30)
+
+ self.reset_mocks()
+ self.player.next_source()
+ self.assert_new_texture_created(self.video_format_2)
+ self.assert_update_texture_unscheduled()
+ self.assert_update_texture_scheduled(1 / 25)
+
+ def test_video_seek_next_frame(self):
+ """It is possible to jump directly to the next frame of video and adjust the audio player
+ accordingly."""
+ mock_source = self.create_mock_source(self.audio_format_1, self.video_format_1)
+ self.set_video_data_for_mock_source(mock_source, [(0.0, 'a'), (0.2, 'b')])
+ self.player.queue(mock_source)
+ self.player.play()
+ self.assert_new_texture_created(self.video_format_1)
+ self.assert_update_texture_scheduled(1 / 30)
+
+ self.reset_mocks()
+ self.pretend_driver_player_at_time(0.0)
+ self.player.update_texture()
+ self.assert_texture_updated('a')
+
+ self.reset_mocks()
+ self.player.seek_next_frame()
+ self.assert_source_seek(mock_source, 0.2)
+ self.assert_texture_updated('b')
+
+ def test_video_runs_out_of_frames(self):
+ """When the video runs out of frames, it stops updating the texture. The audio player is
+ responsible for triggering eos."""
+ mock_source = self.create_mock_source(self.audio_format_1, self.video_format_1)
+ self.set_video_data_for_mock_source(mock_source, [(0.0, 'a'), (0.1, 'b')])
+ self.player.queue(mock_source)
+ self.player.play()
+ self.assert_new_texture_created(self.video_format_1)
+ self.assert_update_texture_scheduled(1 / 30)
+
+ self.reset_mocks()
+ self.pretend_driver_player_at_time(0.0)
+ self.player.update_texture()
+ self.assert_texture_updated('a')
+
+ self.reset_mocks()
+ self.pretend_driver_player_at_time(0.1)
+ self.player.update_texture()
+ self.assert_texture_updated('b')
+
+ self.reset_mocks()
+ self.pretend_driver_player_at_time(0.2)
+ self.player.update_texture()
+ self.assert_texture_not_updated()
+
+ self.reset_mocks()
+ self.player.seek_next_frame()
+ self.assert_texture_not_updated()
+
+ def test_video_without_audio(self):
+ """It is possible to have videos without audio streams. A special audio driver will take
+ care of providing the timing."""
+ mock_source = self.create_mock_source(None, self.video_format_1)
+ self.player.queue(mock_source)
+ self.player.play()
+ self.assert_new_texture_created(self.video_format_1)
+ self.assert_update_texture_scheduled(1 / 30)
+ self.assert_no_new_driver_player_created()
+ self.assert_silent_driver_player_created_for(mock_source)
+
+ self.reset_mocks()
+ self.pretend_silent_driver_player_at_time(1.)
+ self.player.delete()
+ self.assert_silent_driver_player_destroyed()
+
+
+class PlayerGroupTestCase(FutureTestCase):
+ def create_mock_player(self, has_audio=True):
+ player = mock.MagicMock()
+ if has_audio:
+ audio_player = mock.PropertyMock(return_value=mock.MagicMock())
+ else:
+ audio_player = mock.PropertyMock(return_value=None)
+ type(player)._audio_player = audio_player
+ return player
+
+ def assert_players_started(self, *players):
+ for player in players:
+ player.play.assert_called_once_with()
+
+ def assert_audio_players_started(self, *players):
+ # Find the one player that was used to start the group, the rest should not be used
+ call_args = None
+ audio_players = []
+ for player in players:
+ audio_player = player._audio_player
+ audio_players.append(audio_player)
+ if call_args is not None:
+ self.assertFalse(audio_player._play_group.called, msg='Only one player should be used to start the group')
+ elif audio_player._play_group.called:
+ call_args = audio_player._play_group.call_args
+
+ self.assertIsNotNone(call_args, msg='No player was used to start all audio players.')
+ started_players = call_args[0][0]
+ self.assertCountEqual(started_players, audio_players, msg='Not all players with audio players were started')
+
+ def assert_players_stopped(self, *players):
+ for player in players:
+ player.pause.assert_called_once_with()
+
+ def assert_audio_players_stopped(self, *players):
+ # Find the one player that was used to start the group, the rest should not be used
+ call_args = None
+ audio_players = []
+ for player in players:
+ audio_player = player._audio_player
+ audio_players.append(audio_player)
+ if call_args is not None:
+ self.assertFalse(audio_player._stop_group.called, msg='Only one player should be used to stop the group')
+ elif audio_player._stop_group.called:
+ call_args = audio_player._stop_group.call_args
+
+ self.assertIsNotNone(call_args, msg='No player was used to stop all audio players.')
+ stopped_players = call_args[0][0]
+ self.assertCountEqual(stopped_players, audio_players, msg='Not all players with audio players were stopped')
+
+ def reset_mocks(self, *mocks):
+ for m in mocks:
+ m.reset_mock()
+
+ def test_empty_group(self):
+ """Just check nothing explodes on an empty group."""
+ group = PlayerGroup([])
+ group.play()
+ group.pause()
+
+ def test_only_with_audio(self):
+ """Test a group containing only players with audio."""
+ players = [self.create_mock_player(has_audio=True) for _ in range(10)]
+ group = PlayerGroup(players)
+
+ group.play()
+ self.assert_audio_players_started(*players)
+ self.assert_players_started(*players)
+ self.reset_mocks(*players)
+
+ group.pause()
+ self.assert_audio_players_stopped(*players)
+ self.assert_players_stopped(*players)
+
+ def test_only_without_audio(self):
+ """Test a group containing only players without audio."""
+ players = [self.create_mock_player(has_audio=False) for _ in range(10)]
+ group = PlayerGroup(players)
+
+ group.play()
+ self.assert_players_started(*players)
+ self.reset_mocks(*players)
+
+ group.pause()
+ self.assert_players_stopped(*players)
+
+ def test_mixed_players(self):
+ """Test a group containing both players with audio and players without audio."""
+ players_with_audio = [self.create_mock_player(has_audio=True) for _ in range(10)]
+ players_without_audio = [self.create_mock_player(has_audio=False) for _ in range(10)]
+ players = players_with_audio + players_without_audio
+ random.shuffle(players)
+ group = PlayerGroup(players)
+
+ group.play()
+ self.assert_audio_players_started(*players_with_audio)
+ self.assert_players_started(*players)
+ self.reset_mocks(*players)
+
+ group.pause()
+ self.assert_audio_players_stopped(*players_with_audio)
+ self.assert_players_stopped(*players)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/unit/media/test_procedural.py b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/media/test_procedural.py
new file mode 100644
index 0000000..dd9c16f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/media/test_procedural.py
@@ -0,0 +1,124 @@
+from __future__ import absolute_import
+from builtins import bytes, object
+from ctypes import sizeof
+from io import BytesIO
+import unittest
+
+from pyglet.media.sources.procedural import *
+
+
+local_dir = os.path.dirname(__file__)
+test_data_path = os.path.abspath(os.path.join(local_dir, '..', '..', 'data'))
+del local_dir
+
+
+def get_test_data_file(*file_parts):
+ """Get a file from the test data directory in an OS independent way.
+
+ Supply relative file name as you would in os.path.join().
+ """
+ return os.path.join(test_data_path, *file_parts)
+
+
+class ProceduralSourceTest(object):
+ """Simple test to check procedural sources provide data."""
+ source_class = None
+
+ def test_default(self):
+ source = self.source_class(1.)
+ self._test_total_duration(source)
+ if self.source_class is not WhiteNoise:
+ self._test_generated_bytes(source)
+
+ def test_sample_size_8(self):
+ source = self.source_class(1., sample_size=8)
+ self._test_total_duration(source)
+ if self.source_class is not WhiteNoise:
+ self._test_generated_bytes(source, sample_size=8)
+
+ def test_sample_rate_11025(self):
+ source = self.source_class(1., sample_rate=11025)
+ self._test_total_duration(source)
+ if self.source_class is not WhiteNoise:
+ self._test_generated_bytes(source, sample_rate=11025)
+
+ def _test_total_duration(self, source):
+ total_bytes = source.audio_format.bytes_per_second
+ self._check_audio_data(source, total_bytes, 1.)
+
+ def _check_audio_data(self, source, expected_bytes, expected_duration):
+ data = source.get_audio_data(expected_bytes + 100)
+ self.assertIsNotNone(data)
+ self.assertAlmostEqual(expected_bytes, data.length, delta=20)
+ self.assertAlmostEqual(expected_duration, data.duration)
+
+ self.assertIsNotNone(data.data)
+ if isinstance(data.data, (bytes, str)):
+ self.assertAlmostEqual(expected_bytes, len(data.data), delta=20)
+ else:
+ self.assertAlmostEqual(expected_bytes, sizeof(data.data), delta=20)
+
+ # Should now be out of data
+ last_data = source.get_audio_data(100)
+ self.assertIsNone(last_data)
+
+ def test_seek_default(self):
+ source = self.source_class(1.)
+ self._test_seek(source)
+
+ def test_seek_sample_size_8(self):
+ source = self.source_class(1., sample_size=8)
+ self._test_seek(source)
+
+ def _test_seek(self, source):
+ seek_time = .5
+ bytes_left = source.audio_format.bytes_per_second * .5
+ source.seek(seek_time)
+ self._check_audio_data(source, bytes_left, .5)
+
+ def _test_generated_bytes(self, source, sample_rate=44800, sample_size=16):
+ source_name = self.source_class.__name__.lower()
+ filename = "procedural_{0}_{1}_{2}_1ch.wav".format(
+ source_name, sample_size, sample_rate)
+
+ with open(get_test_data_file('media', filename), 'rb') as f:
+ # discard the wave header:
+ loaded_bytes = f.read()[44:]
+ source.seek(0)
+ generated_data = source.get_audio_data(source._max_offset)
+ bytes_buffer = BytesIO(generated_data.data).getvalue()
+ # Compare a small chunk, to avoid hanging on mismatch:
+ assert bytes_buffer[:1000] == loaded_bytes[:1000],\
+ "Generated bytes do not match sample wave file."
+
+
+class SilenceTest(ProceduralSourceTest, unittest.TestCase):
+ source_class = Silence
+
+
+class WhiteNoiseTest(ProceduralSourceTest, unittest.TestCase):
+ source_class = WhiteNoise
+
+
+class SineTest(ProceduralSourceTest, unittest.TestCase):
+ source_class = Sine
+
+
+class TriangleTest(ProceduralSourceTest, unittest.TestCase):
+ source_class = Triangle
+
+
+class SawtoothTest(ProceduralSourceTest, unittest.TestCase):
+ source_class = Sawtooth
+
+
+class SquareTest(ProceduralSourceTest, unittest.TestCase):
+ source_class = Square
+
+
+class FMTest(ProceduralSourceTest, unittest.TestCase):
+ source_class = FM
+
+
+class DigitarTest(ProceduralSourceTest, unittest.TestCase):
+ source_class = Digitar
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/unit/media/test_riff.py b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/media/test_riff.py
new file mode 100644
index 0000000..9fb757f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/media/test_riff.py
@@ -0,0 +1,66 @@
+"""
+Test the internal RIFF reader.
+"""
+
+import os
+import unittest
+
+from pyglet.media.sources.riff import WaveSource
+
+test_data_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'data', 'media'))
+
+
+class RiffTest(unittest.TestCase):
+ def test_pcm_16_11025_1ch(self):
+ file_name = os.path.join(test_data_dir, 'alert_pcm_16_11025_1ch.wav')
+ source = WaveSource(file_name)
+
+ self._check_audio_format(source, 1, 16, 11025)
+ self._check_data(source, 11584, 0.525)
+
+ def test_pcm_16_22050_1ch(self):
+ file_name = os.path.join(test_data_dir, 'alert_pcm_16_22050_1ch.wav')
+ source = WaveSource(file_name)
+
+ self._check_audio_format(source, 1, 16, 22050)
+ self._check_data(source, 23166, 0.525)
+
+ def test_pcm_8_22050_1ch(self):
+ file_name = os.path.join(test_data_dir, 'alert_pcm_8_22050_1ch.wav')
+ source = WaveSource(file_name)
+
+ self._check_audio_format(source, 1, 8, 22050)
+ self._check_data(source, 11583, 0.525)
+
+ def test_seek(self):
+ file_name = os.path.join(test_data_dir, 'alert_pcm_16_22050_1ch.wav')
+ source = WaveSource(file_name)
+
+ seek_time = 0.3
+ seek_bytes = seek_time * source.audio_format.bytes_per_second
+ source.seek(seek_time)
+ self._check_data(source, 23166-seek_bytes, 0.225)
+
+ def _check_audio_format(self, source, channels, sample_size, sample_rate):
+ self.assertEqual(channels, source.audio_format.channels)
+ self.assertEqual(sample_size, source.audio_format.sample_size)
+ self.assertEqual(sample_rate, source.audio_format.sample_rate)
+
+ def _check_data(self, source, expected_bytes, expected_duration):
+ received_bytes = 0
+ received_seconds = 0.
+ bytes_to_read = 1024
+
+ while True:
+ data = source.get_audio_data(bytes_to_read)
+ if data is None:
+ break
+
+ received_bytes += data.length
+ received_seconds += data.duration
+
+ self.assertEqual(data.length, len(data.data))
+
+ self.assertAlmostEqual(expected_duration, received_seconds, places=3)
+ self.assertAlmostEqual(expected_bytes, received_bytes, delta=5)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/unit/media/test_silent_player.py b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/media/test_silent_player.py
new file mode 100644
index 0000000..99262ca
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/media/test_silent_player.py
@@ -0,0 +1,386 @@
+"""
+Tests for the silent audio driver.
+"""
+from __future__ import division
+from builtins import object
+
+from tests import mock
+import unittest
+
+from pyglet.media.drivers.silent import (EventBuffer, SilentAudioBuffer, SilentAudioPacket,
+ SilentAudioPlayerPacketConsumer)
+from pyglet.media.events import MediaEvent
+from pyglet.media.sources import AudioData, AudioFormat
+
+class SilentAudioPacketTest(unittest.TestCase):
+ def test_partial_consume(self):
+ packet = SilentAudioPacket(0., 1.)
+
+ dt = .4
+ consumed = packet.consume(dt)
+
+ self.assertAlmostEqual(.4, consumed)
+ self.assertAlmostEqual(.4, packet.timestamp)
+ self.assertAlmostEqual(.6, packet.duration)
+ self.assertFalse(packet.is_empty())
+
+ def test_exact_consume(self):
+ packet = SilentAudioPacket(0., 1.)
+
+ dt = 1.
+ consumed = packet.consume(dt)
+
+ self.assertAlmostEqual(1., consumed)
+ self.assertAlmostEqual(1., packet.timestamp)
+ self.assertAlmostEqual(0., packet.duration)
+ self.assertTrue(packet.is_empty())
+
+ def test_over_consume(self):
+ packet = SilentAudioPacket(0., 1.)
+
+ dt = 2.
+ consumed = packet.consume(dt)
+
+ self.assertAlmostEqual(1., consumed)
+ self.assertAlmostEqual(1., packet.timestamp)
+ self.assertAlmostEqual(0., packet.duration)
+ self.assertTrue(packet.is_empty())
+
+
+class SilentAudioBufferTest(unittest.TestCase):
+ def test_add_audio_data(self):
+ buf = SilentAudioBuffer()
+ self.assertTrue(buf.is_empty())
+ self.assertAlmostEqual(0., buf.duration)
+
+ data1 = AudioData('', 0, 0., 1., [])
+ buf.add_audio_data(data1)
+ self.assertFalse(buf.is_empty())
+ self.assertAlmostEqual(1., buf.duration)
+
+ data2 = AudioData('', 0, 1., 2., [])
+ buf.add_audio_data(data2)
+ self.assertFalse(buf.is_empty())
+ self.assertAlmostEqual(3., buf.duration)
+
+ def test_consume_audio_data(self):
+ buf = SilentAudioBuffer()
+ buf.add_audio_data(AudioData('', 0, 0., 1., []))
+ buf.add_audio_data(AudioData('', 0, 1., 2., []))
+ self.assertFalse(buf.is_empty())
+ self.assertAlmostEqual(3., buf.duration)
+ self.assertAlmostEqual(0., buf.get_current_timestamp())
+
+ buf.consume_audio_data(0.8)
+ self.assertFalse(buf.is_empty())
+ self.assertAlmostEqual(2.2, buf.duration)
+ self.assertAlmostEqual(0.8, buf.get_current_timestamp())
+
+ buf.consume_audio_data(0.8)
+ self.assertFalse(buf.is_empty())
+ self.assertAlmostEqual(1.4, buf.duration)
+ self.assertAlmostEqual(1.6, buf.get_current_timestamp())
+
+ buf.consume_audio_data(1.4)
+ self.assertTrue(buf.is_empty())
+ self.assertAlmostEqual(0., buf.duration)
+ self.assertAlmostEqual(3., buf.get_current_timestamp())
+
+ def test_consume_too_much(self):
+ buf = SilentAudioBuffer()
+ buf.add_audio_data(AudioData('', 0, 0., 1., []))
+ buf.add_audio_data(AudioData('', 0, 1., 2., []))
+
+ buf.consume_audio_data(4.)
+ self.assertTrue(buf.is_empty())
+ self.assertAlmostEqual(0., buf.duration)
+ self.assertAlmostEqual(3., buf.get_current_timestamp())
+
+ def test_time_to_next_update(self):
+ buf = SilentAudioBuffer()
+ self.assertIsNone(buf.get_time_to_next_update())
+
+ buf.add_audio_data(AudioData('', 0, 0., 1., []))
+ buf.add_audio_data(AudioData('', 0, 1., 2., []))
+ self.assertAlmostEqual(1., buf.get_time_to_next_update())
+
+ buf.consume_audio_data(0.5)
+ self.assertAlmostEqual(0.5, buf.get_time_to_next_update())
+
+ buf.consume_audio_data(1.0)
+ self.assertAlmostEqual(1.5, buf.get_time_to_next_update())
+
+ buf.consume_audio_data(1.5)
+ self.assertIsNone(buf.get_time_to_next_update())
+
+ def test_current_timestamp(self):
+ buf = SilentAudioBuffer()
+ self.assertAlmostEqual(0., buf.get_current_timestamp())
+
+ buf.add_audio_data(AudioData('', 0, 2., 1., []))
+ buf.add_audio_data(AudioData('', 0, 1., 2., []))
+ self.assertAlmostEqual(2., buf.get_current_timestamp())
+
+ buf.consume_audio_data(0.2)
+ self.assertAlmostEqual(2.2, buf.get_current_timestamp())
+
+ buf.consume_audio_data(1.)
+ self.assertAlmostEqual(1.2, buf.get_current_timestamp())
+
+ buf.consume_audio_data(2.)
+ self.assertAlmostEqual(3., buf.get_current_timestamp())
+
+
+class EventBufferTest(unittest.TestCase):
+ def test_add_events(self):
+ buf = EventBuffer()
+ self.assertIsNone(buf.get_next_event_timestamp())
+
+ event1 = MediaEvent(.1, 'Event1')
+ event2 = MediaEvent(.5, 'Event2')
+ data = AudioData('', 0, 0., 1., [event1, event2])
+ buf.add_events(data)
+
+ self.assertAlmostEqual(.1, buf.get_next_event_timestamp())
+
+ def test_get_expired_events(self):
+ buf = EventBuffer()
+ self.assertIsNone(buf.get_next_event_timestamp())
+
+ event1 = MediaEvent(.1, 'Event1')
+ event2 = MediaEvent(.5, 'Event2')
+ data = AudioData('', 0, 0., 1., [event1, event2])
+ buf.add_events(data)
+
+ expired_events = buf.get_expired_events(0.)
+ self.assertListEqual([], expired_events)
+
+ expired_events = buf.get_expired_events(.1)
+ self.assertListEqual([event1], expired_events)
+
+ expired_events = buf.get_expired_events(.1)
+ self.assertListEqual([], expired_events)
+
+ expired_events = buf.get_expired_events(.6)
+ self.assertListEqual([event2], expired_events)
+
+ expired_events = buf.get_expired_events(.6)
+ self.assertListEqual([], expired_events)
+
+ def test_get_multiple_events(self):
+ buf = EventBuffer()
+ self.assertIsNone(buf.get_next_event_timestamp())
+
+ event1 = MediaEvent(.2, 'Event1')
+ event2 = MediaEvent(.2, 'Event2')
+ data1 = AudioData('', 0, 0., 1., [event1, event2])
+ buf.add_events(data1)
+
+ event3 = MediaEvent(.3, 'Event3')
+ event4 = MediaEvent(.4, 'Event4')
+ data2 = AudioData('', 0, 1., 1., [event3, event4])
+ buf.add_events(data2)
+
+ expired_events = buf.get_expired_events(0.)
+ self.assertListEqual([], expired_events)
+
+ expired_events = buf.get_expired_events(.2)
+ self.assertListEqual([event1, event2], expired_events)
+
+ expired_events = buf.get_expired_events(1.6)
+ self.assertListEqual([event3, event4], expired_events)
+
+ def test_get_next_event_timestamp(self):
+ buf = EventBuffer()
+ self.assertIsNone(buf.get_next_event_timestamp())
+
+ event1 = MediaEvent(.2, 'Event1')
+ event2 = MediaEvent(.2, 'Event2')
+ data1 = AudioData('', 0, 0., 1., [event1, event2])
+ buf.add_events(data1)
+
+ event3 = MediaEvent(.3, 'Event3')
+ event4 = MediaEvent(.4, 'Event4')
+ data2 = AudioData('', 0, 1., 1., [event3, event4])
+ buf.add_events(data2)
+
+ self.assertAlmostEqual(.2, buf.get_next_event_timestamp())
+
+ buf.get_expired_events(.2)
+ self.assertAlmostEqual(1.3, buf.get_next_event_timestamp())
+
+ buf.get_expired_events(1.3)
+ self.assertAlmostEqual(1.4, buf.get_next_event_timestamp())
+
+ buf.get_expired_events(1.4)
+ self.assertIsNone(buf.get_next_event_timestamp())
+
+ def test_get_time_to_next_event(self):
+ buf = EventBuffer()
+ self.assertIsNone(buf.get_next_event_timestamp())
+
+ event1 = MediaEvent(.2, 'Event1')
+ event2 = MediaEvent(.2, 'Event2')
+ data1 = AudioData('', 0, 0., 1., [event1, event2])
+ buf.add_events(data1)
+
+ event3 = MediaEvent(.3, 'Event3')
+ event4 = MediaEvent(.4, 'Event4')
+ data2 = AudioData('', 0, 1., 1., [event3, event4])
+ buf.add_events(data2)
+
+ self.assertAlmostEqual(.2, buf.get_time_to_next_event(0.))
+ self.assertAlmostEqual(.1, buf.get_time_to_next_event(.1))
+
+ buf.get_expired_events(.2)
+ self.assertAlmostEqual(1.1, buf.get_time_to_next_event(.2))
+ self.assertAlmostEqual(.1, buf.get_time_to_next_event(1.2))
+
+
+class MockSourceGroup(object):
+ audio_format = AudioFormat(1, 8, 44100)
+
+ def __init__(self, duration, timestamp=0.):
+ self.mock = mock.MagicMock()
+ type(self.mock).audio_format = mock.PropertyMock(return_value=self.audio_format)
+ self.mock.get_audio_data.side_effect = self._get_audio_data
+
+ self.timestamp = timestamp
+ self.duration = duration
+
+ self.seconds_buffered = 0.
+ self.bytes_buffered = 0
+
+ def _get_audio_data(self, length):
+ secs = length / self.audio_format.bytes_per_second
+ if secs > self.duration:
+ secs = self.duration
+ length = int(secs * self.audio_format.bytes_per_second)
+
+ if length == 0:
+ return None
+
+ data = AudioData('a'*length, length, self.timestamp, secs, ())
+ self.timestamp += secs
+ self.duration -= secs
+ self.seconds_buffered += secs
+ self.bytes_buffered += length
+ return data
+
+
+class SilentAudioPlayerPacketConsumerTest(unittest.TestCase):
+ def setUp(self):
+ self.time_patcher = mock.patch('time.time')
+ self.thread_patcher = mock.patch('pyglet.media.drivers.silent.MediaThread')
+ self.mock_time = self.time_patcher.start()
+ self.mock_thread = self.thread_patcher.start()
+
+ def tearDown(self):
+ self.time_patcher.stop()
+ self.thread_patcher.stop()
+
+ def set_time(self, t):
+ self.mock_time.return_value = t
+
+ def test_buffer_data_initial(self):
+ mock_player = mock.MagicMock()
+ mock_source_group = MockSourceGroup(1.)
+
+ silent_player = SilentAudioPlayerPacketConsumer(mock_source_group.mock, mock_player)
+ self.set_time(1000.)
+ silent_player._buffer_data()
+ self.assertAlmostEqual(.4, mock_source_group.seconds_buffered, delta=.01)
+
+ self.assertAlmostEqual(0., silent_player.get_time(), delta=.01)
+
+ def test_playing(self):
+ mock_player = mock.MagicMock()
+ mock_source_group = MockSourceGroup(1.)
+
+ silent_player = SilentAudioPlayerPacketConsumer(mock_source_group.mock, mock_player)
+
+ # Buffer initial data
+ self.set_time(1000.)
+ silent_player._buffer_data()
+ self.assertAlmostEqual(.4, mock_source_group.seconds_buffered, delta=.01)
+
+ # Start playing
+ silent_player.play()
+ self.assertAlmostEqual(0., silent_player.get_time(), delta=.01)
+
+ # Check timestamp increases even when not consuming new data
+ self.set_time(1000.2)
+ self.assertAlmostEqual(.2, silent_player.get_time(), delta=.01)
+
+ # Timestamp sill correct after consuming data
+ silent_player._consume_data()
+ self.assertAlmostEqual(.2, silent_player.get_time(), delta=.01)
+
+ # Consuming data means we need to buffer more
+ silent_player._buffer_data()
+ self.assertAlmostEqual(.6, mock_source_group.seconds_buffered, delta=.01)
+ self.assertAlmostEqual(.2, silent_player.get_time(), delta=.01)
+
+ def test_not_started_yet(self):
+ mock_player = mock.MagicMock()
+ mock_source_group = MockSourceGroup(1.)
+ silent_player = SilentAudioPlayerPacketConsumer(mock_source_group.mock, mock_player)
+
+ # Do initial buffering even when not playing yet
+ self.set_time(1000.)
+ silent_player._buffer_data()
+ self.assertAlmostEqual(.4, mock_source_group.seconds_buffered, delta=.01)
+ self.assertAlmostEqual(0., silent_player.get_time(), delta=.01)
+
+ # Increase of timestamp does not change anything
+ self.set_time(1001.)
+ self.assertAlmostEqual(0., silent_player.get_time(), delta=.01)
+
+ # No data is consumed
+ silent_player._consume_data()
+ self.assertAlmostEqual(0., silent_player.get_time(), delta=.01)
+
+ # No new data is buffered
+ silent_player._buffer_data()
+ self.assertAlmostEqual(.4, mock_source_group.seconds_buffered, delta=.01)
+ self.assertAlmostEqual(0., silent_player.get_time(), delta=.01)
+
+ def test_play_and_stop(self):
+ mock_player = mock.MagicMock()
+ mock_source_group = MockSourceGroup(1.)
+ silent_player = SilentAudioPlayerPacketConsumer(mock_source_group.mock, mock_player)
+
+ # Do initial buffering even when not playing yet
+ self.set_time(1000.)
+ silent_player._buffer_data()
+ self.assertAlmostEqual(.4, mock_source_group.seconds_buffered, delta=.01)
+ self.assertAlmostEqual(0., silent_player.get_time(), delta=.01)
+
+ # Play a little bit
+ silent_player.play()
+ self.set_time(1000.2)
+ silent_player._consume_data()
+ silent_player._buffer_data()
+ self.assertAlmostEqual(.6, mock_source_group.seconds_buffered, delta=.01)
+ self.assertAlmostEqual(.2, silent_player.get_time(), delta=.01)
+
+ # Now stop, this should consume data upto stopping moment
+ self.set_time(1000.4)
+ silent_player.stop()
+ self.assertAlmostEqual(.4, silent_player.get_time(), delta=.01)
+
+ # Buffering still happens
+ silent_player._buffer_data()
+ self.assertAlmostEqual(.8, mock_source_group.seconds_buffered, delta=.01)
+ self.assertAlmostEqual(.4, silent_player.get_time(), delta=.01)
+
+ # But now playback is really paused
+ self.set_time(1001.)
+ self.assertAlmostEqual(.4, silent_player.get_time(), delta=.01)
+
+ # And no more buffering and consuming
+ silent_player._consume_data()
+ silent_player._buffer_data()
+ self.assertAlmostEqual(.8, mock_source_group.seconds_buffered, delta=.01)
+ self.assertAlmostEqual(.4, silent_player.get_time(), delta=.01)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/unit/media/test_sources.py b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/media/test_sources.py
new file mode 100644
index 0000000..3039062
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/media/test_sources.py
@@ -0,0 +1,652 @@
+from __future__ import division
+from builtins import map
+import ctypes
+from tests import mock
+import os
+import unittest
+from tests.base.future_test import FutureTestCase
+
+import pyglet
+from pyglet.media.events import MediaEvent
+from pyglet.media.exceptions import MediaException
+from pyglet.media.sources.base import *
+
+#pyglet.options['debug_media'] = True
+
+
+class AudioFormatTestCase(FutureTestCase):
+ def test_equality_true(self):
+ af1 = AudioFormat(2, 8, 44100)
+ af2 = AudioFormat(2, 8, 44100)
+ self.assertEqual(af1, af2)
+
+ def test_equality_false(self):
+ channels = [1, 2]
+ sample_sizes = [8, 16]
+ sample_rates = [11025, 22050, 44100]
+
+ formats = [AudioFormat(c, s, r) for c in channels for s in sample_sizes for r in sample_rates]
+ while formats:
+ a = formats.pop()
+ for b in formats:
+ self.assertNotEqual(a, b)
+
+ def test_bytes_per(self):
+ af1 = AudioFormat(1, 8, 22050)
+ af2 = AudioFormat(2, 16, 44100)
+
+ self.assertEqual(af1.bytes_per_sample, 1)
+ self.assertEqual(af1.bytes_per_second, 22050)
+
+ self.assertEqual(af2.bytes_per_sample, 4)
+ self.assertEqual(af2.bytes_per_second, 176400)
+
+ def test_repr(self):
+ af1 = AudioFormat(1, 8, 22050)
+ self.assertEqual(repr(af1), 'AudioFormat(channels=1, sample_size=8, sample_rate=22050)')
+
+ af2 = AudioFormat(2, 16, 44100)
+ self.assertEqual(repr(af2), 'AudioFormat(channels=2, sample_size=16, sample_rate=44100)')
+
+
+class AudioDataTestCase(FutureTestCase):
+ def generate_random_string_data(self, length):
+ return os.urandom(length)
+
+ def create_string_buffer(self, data):
+ return ctypes.create_string_buffer(data)
+
+ def test_consume_part_of_data(self):
+ audio_format = AudioFormat(1, 8, 11025)
+ duration = 1.0
+ length = int(duration * audio_format.bytes_per_second)
+ data = self.generate_random_string_data(length)
+
+ audio_data = AudioData(data, length, 0.0, duration, (MediaEvent(0.0, 'event'),))
+
+ chunk_duration = 0.1
+ chunk_size = int(chunk_duration * audio_format.bytes_per_second)
+ self.assertLessEqual(chunk_size, length)
+
+ audio_data.consume(chunk_size, audio_format)
+
+ self.assertEqual(audio_data.length, length - chunk_size)
+ self.assertAlmostEqual(audio_data.duration, duration - chunk_duration, places=2)
+ self.assertAlmostEqual(audio_data.timestamp, chunk_duration, places=2)
+
+ self.assertEqual(audio_data.get_string_data(), data[chunk_size:])
+
+ self.assertTupleEqual(audio_data.events, ())
+
+ def test_consume_too_much_data(self):
+ audio_format = AudioFormat(1, 8, 11025)
+ duration = 1.0
+ length = int(duration * audio_format.bytes_per_second)
+ data = self.generate_random_string_data(length)
+
+ audio_data = AudioData(data, length, 0.0, duration, (MediaEvent(0.0, 'event'),))
+
+ chunk_duration = 1.1
+ chunk_size = int(chunk_duration * audio_format.bytes_per_second)
+ self.assertGreater(chunk_size, length)
+
+ audio_data.consume(chunk_size, audio_format)
+
+ self.assertEqual(audio_data.length, 0)
+ self.assertAlmostEqual(audio_data.duration, 0.0, places=2)
+ self.assertAlmostEqual(audio_data.timestamp, duration, places=2)
+
+ self.assertBytesEqual(audio_data.get_string_data(), '')
+
+ self.assertTupleEqual(audio_data.events, ())
+
+ def test_consume_non_str_data(self):
+ audio_format = AudioFormat(1, 8, 11025)
+ duration = 1.0
+ length = int(duration * audio_format.bytes_per_second)
+ data = self.generate_random_string_data(length)
+ non_str_data = self.create_string_buffer(data)
+
+ audio_data = AudioData(non_str_data, length, 0.0, duration, (MediaEvent(0.0, 'event'),))
+
+ chunk_duration = 0.1
+ chunk_size = int(chunk_duration * audio_format.bytes_per_second)
+ self.assertLessEqual(chunk_size, length)
+
+ audio_data.consume(chunk_size, audio_format)
+
+ self.assertEqual(audio_data.length, length - chunk_size)
+ self.assertAlmostEqual(audio_data.duration, duration - chunk_duration, places=2)
+ self.assertAlmostEqual(audio_data.timestamp, chunk_duration, places=2)
+
+ self.assertEqual(audio_data.get_string_data(), data[chunk_size:])
+
+ self.assertTupleEqual(audio_data.events, ())
+
+ def test_consume_only_events(self):
+ audio_format = AudioFormat(1, 8, 11025)
+ duration = 1.0
+ length = int(duration * audio_format.bytes_per_second)
+ data = self.generate_random_string_data(length)
+
+ audio_data = AudioData(data, length, 0.0, duration, (MediaEvent(0.0, 'event'),))
+
+ chunk_size = 0
+
+ audio_data.consume(chunk_size, audio_format)
+
+ self.assertEqual(audio_data.length, length)
+ self.assertAlmostEqual(audio_data.duration, duration, places=2)
+ self.assertAlmostEqual(audio_data.timestamp, 0., places=2)
+
+ self.assertEqual(audio_data.get_string_data(), data)
+
+ self.assertTupleEqual(audio_data.events, ())
+
+
+class SourceTestCase(FutureTestCase):
+ @mock.patch('pyglet.media.player.Player')
+ def test_play(self, player_mock):
+ source = Source()
+ returned_player = source.play()
+
+ self.assertIsNotNone(returned_player)
+ returned_player.play.assert_called_once_with()
+ returned_player.queue.assert_called_once_with(source)
+
+ @mock.patch('pyglet.media.sources.base.Source.get_next_video_timestamp')
+ @mock.patch('pyglet.media.sources.base.Source.get_next_video_frame')
+ def test_get_animation(self, mock_get_next_video_frame, mock_get_next_video_timestamp):
+ def _next_timestamp():
+ if _next_timestamp.timestamp < 100:
+ _next_timestamp.timestamp += 1
+ return float(_next_timestamp.timestamp / 10)
+ def _next_frame():
+ return _next_timestamp.timestamp
+ _next_timestamp.timestamp = 0
+ mock_get_next_video_frame.side_effect = _next_frame
+ mock_get_next_video_timestamp.side_effect = _next_timestamp
+
+ source = Source()
+ source.video_format = VideoFormat(800, 600)
+
+ animation = source.get_animation()
+ self.assertIsNotNone(animation)
+ self.assertIsInstance(animation, pyglet.image.Animation)
+ self.assertEqual(len(animation.frames), 100)
+ for frame in animation.frames:
+ self.assertAlmostEqual(frame.duration, 0.1)
+
+ @unittest.skip('pyglet.image.Animation does not like getting an empty list of frames.')
+ def test_get_animation_no_video(self):
+ source = Source()
+ animation = source.get_animation()
+
+ self.assertIsNotNone(animation)
+ self.assertIsInstance(animation, pyglet.image.Animation)
+ self.assertEqual(len(animation.frames), 0)
+
+
+class StreamingSourceTestCase(FutureTestCase):
+ def test_can_queue_only_once(self):
+ source = StreamingSource()
+ self.assertFalse(source.is_queued)
+
+ ret = source._get_queue_source()
+ self.assertIs(ret, source)
+ self.assertTrue(source.is_queued)
+
+ with self.assertRaises(MediaException):
+ source._get_queue_source()
+
+class StaticSourceTestCase(FutureTestCase):
+ def create_valid_mock_source(self, bitrate=8, channels=1):
+ self.mock_source = mock.MagicMock()
+ self.mock_queue_source = self.mock_source._get_queue_source.return_value
+
+ byte_rate = bitrate >> 3
+ self.mock_data = [b'a'*22050*byte_rate*channels,
+ b'b'*22050*byte_rate*channels,
+ b'c'*11025*byte_rate*channels]
+ self.mock_data_length = sum(map(len, self.mock_data))
+ self.mock_audio_data = b''.join(self.mock_data)
+ def _get_audio_data(_):
+ if not self.mock_data:
+ return None
+ data = self.mock_data.pop(0)
+ return AudioData(data, len(data), 0.0, 1.0, ())
+ self.mock_queue_source.get_audio_data.side_effect = _get_audio_data
+
+ type(self.mock_queue_source).audio_format = mock.PropertyMock(return_value=AudioFormat(channels, bitrate, 11025))
+ type(self.mock_queue_source).video_format = mock.PropertyMock(return_value=None)
+
+
+ def test_reads_all_data_on_init(self):
+ self.create_valid_mock_source()
+ static_source = StaticSource(self.mock_source)
+
+ self.assertEqual(len(self.mock_data), 0, 'All audio data should be read')
+ self.assertEqual(self.mock_queue_source.get_audio_data.call_count, 4, 'Data should be retrieved until empty')
+
+ # Try to read all data plus more, more should be ignored
+ returned_audio_data = static_source._get_queue_source().get_audio_data(len(self.mock_audio_data)+1024)
+ self.assertBytesEqual(returned_audio_data.get_string_data(), self.mock_audio_data, 'All data from the mock should be returned')
+ self.assertAlmostEqual(returned_audio_data.duration, 5.0)
+
+ def test_video_not_supported(self):
+ self.create_valid_mock_source()
+ type(self.mock_queue_source).video_format = mock.PropertyMock(return_value=VideoFormat(800, 600))
+
+ with self.assertRaises(NotImplementedError):
+ static_source = StaticSource(self.mock_source)
+
+ def test_seek(self):
+ self.create_valid_mock_source()
+ static_source = StaticSource(self.mock_source)
+
+ queue_source = static_source._get_queue_source()
+ queue_source.seek(1.0)
+ returned_audio_data = queue_source.get_audio_data(len(self.mock_audio_data))
+ self.assertAlmostEqual(returned_audio_data.duration, 4.0)
+ self.assertEqual(returned_audio_data.length, len(self.mock_audio_data)-11025)
+ self.assertBytesEqual(returned_audio_data.get_string_data(), self.mock_audio_data[11025:], 'Should have seeked past 1 second')
+
+ def test_multiple_queued(self):
+ self.create_valid_mock_source()
+ static_source = StaticSource(self.mock_source)
+
+ # Check that seeking and consuming on queued instances does not affect others
+ queue_source1 = static_source._get_queue_source()
+ queue_source1.seek(1.0)
+
+ queue_source2 = static_source._get_queue_source()
+
+ returned_audio_data = queue_source2.get_audio_data(len(self.mock_audio_data))
+ self.assertAlmostEqual(returned_audio_data.duration, 5.0)
+ self.assertEqual(returned_audio_data.length, len(self.mock_audio_data), 'Should contain all data')
+
+
+ returned_audio_data = queue_source1.get_audio_data(len(self.mock_audio_data))
+ self.assertAlmostEqual(returned_audio_data.duration, 4.0)
+ self.assertEqual(returned_audio_data.length, len(self.mock_audio_data)-11025)
+ self.assertBytesEqual(returned_audio_data.get_string_data(), self.mock_audio_data[11025:], 'Should have seeked past 1 second')
+
+ def test_seek_aligned_to_sample_size_2_bytes(self):
+ self.create_valid_mock_source(bitrate=16, channels=1)
+ static_source = StaticSource(self.mock_source)
+
+ queue_source = static_source._get_queue_source()
+ queue_source.seek(0.01)
+ returned_audio_data = queue_source.get_audio_data(len(self.mock_audio_data))
+ self.assertEqual(returned_audio_data.length % 2, 0, 'Must seek and return aligned to 2 byte chunks')
+
+ def test_consume_aligned_to_sample_size_2_bytes(self):
+ self.create_valid_mock_source(bitrate=16, channels=1)
+ static_source = StaticSource(self.mock_source)
+
+ queue_source = static_source._get_queue_source()
+ returned_audio_data = queue_source.get_audio_data(1000*2+1)
+ self.assertEqual(returned_audio_data.length % 2, 0, 'Must return aligned to 2 byte chunks')
+
+ def test_seek_aligned_to_sample_size_4_bytes(self):
+ self.create_valid_mock_source(bitrate=16, channels=2)
+ static_source = StaticSource(self.mock_source)
+
+ queue_source = static_source._get_queue_source()
+ queue_source.seek(0.01)
+ returned_audio_data = queue_source.get_audio_data(len(self.mock_audio_data))
+ self.assertEqual(returned_audio_data.length % 4, 0, 'Must seek and return aligned to 4 byte chunks')
+
+ def test_consume_aligned_to_sample_size_4_bytes(self):
+ self.create_valid_mock_source(bitrate=16, channels=2)
+ static_source = StaticSource(self.mock_source)
+
+ queue_source = static_source._get_queue_source()
+ returned_audio_data = queue_source.get_audio_data(1000*4+3)
+ self.assertEqual(returned_audio_data.length % 4, 0, 'Must return aligned to 4 byte chunks')
+
+ def test_empty_source(self):
+ """Test that wrapping an empty source does not cause trouble."""
+ self.mock_source = mock.MagicMock()
+ self.mock_queue_source = self.mock_source._get_queue_source.return_value
+
+ type(self.mock_queue_source).audio_format = mock.PropertyMock(return_value=None)
+ type(self.mock_queue_source).video_format = mock.PropertyMock(return_value=None)
+
+ static_source = StaticSource(self.mock_source)
+
+ self.assertEqual(static_source.duration, 0.)
+ self.assertIsNone(static_source._get_queue_source())
+
+ def test_not_directly_queueable(self):
+ """A StaticSource cannot be played directly. Its queue source returns a playable object."""
+ self.create_valid_mock_source(bitrate=16, channels=2)
+ static_source = StaticSource(self.mock_source)
+
+ with self.assertRaises(RuntimeError):
+ static_source.get_audio_data(1024)
+
+ def test_run_empty(self):
+ """When running out of data, return None"""
+ self.create_valid_mock_source()
+ static_source = StaticSource(self.mock_source)
+ queue_source = static_source._get_queue_source()
+ returned_audio_data = queue_source.get_audio_data(self.mock_data_length)
+ self.assertIsNotNone(returned_audio_data)
+
+ no_more_audio_data = queue_source.get_audio_data(1024)
+ self.assertIsNone(no_more_audio_data)
+
+
+class SourceGroupTestCase(FutureTestCase):
+ audio_format = AudioFormat(1, 8, 11025)
+ video_format = VideoFormat(800, 600)
+
+ def create_mock_source(self, duration, audio_data=None, video_frame=None):
+ mock_source = mock.MagicMock()
+ m = mock_source._get_queue_source.return_value
+ type(m).audio_format = mock.PropertyMock(return_value=self.audio_format)
+ type(m).video_format = mock.PropertyMock(return_value=self.video_format)
+ type(m).duration = mock.PropertyMock(return_value=duration)
+ m.get_audio_data.return_value = self.create_audio_data(duration, audio_data)
+ m.get_next_video_timestamp.return_value=0.1
+ m.get_next_video_frame.return_value=video_frame
+ return mock_source
+
+ def create_audio_data(self, duration=1., data=None):
+ if data is None:
+ return None
+
+ audio_data = AudioData(data, len(data), 0., duration, [])
+ return audio_data
+
+ def test_queueing(self):
+ source_group = SourceGroup(self.audio_format, None)
+ self.assertFalse(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 0.)
+
+ source1 = self.create_mock_source(1.)
+ source_group.queue(source1)
+ self.assertFalse(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 1.)
+
+ source2 = self.create_mock_source(2.0)
+ source_group.queue(source2)
+ self.assertTrue(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 3.)
+
+ def test_seek(self):
+ source_group = SourceGroup(self.audio_format, None)
+ source1 = self.create_mock_source(1.)
+ source_group.queue(source1)
+ source2 = self.create_mock_source(2.)
+ source_group.queue(source2)
+
+ source_group.seek(0.5)
+
+ source1._get_queue_source.return_value.seek.assert_called_once_with(0.5)
+ self.assertFalse(source2._get_queue_source.return_value.seek.called)
+
+ def test_advance_eos_no_loop(self):
+ """Test that the source group advances to the next source if eos is encountered and looping
+ is not enabled"""
+ source_group = SourceGroup(self.audio_format, None)
+ source1 = self.create_mock_source(1., '1')
+ source2 = self.create_mock_source(2., '2')
+ source_group.queue(source1)
+ source_group.queue(source2)
+
+ self.assertTrue(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 3.)
+
+ audio_data = source_group.get_audio_data(1024)
+ self.assertEqual(audio_data.data, '1')
+ self.assertAlmostEqual(audio_data.timestamp, 0.)
+ self.assertTrue(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 3.)
+
+ # Source 1 is eos, source 2 returns 1.0 seconds (of 2.0)
+ source1._get_queue_source.return_value.get_audio_data.return_value = None
+ source2._get_queue_source.return_value.get_audio_data.return_value = self.create_audio_data(duration=1., data='2')
+ audio_data = source_group.get_audio_data(1024)
+ self.assertEqual(audio_data.data, '2')
+ self.assertAlmostEqual(audio_data.timestamp, 1.)
+ self.assertFalse(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 2.)
+ self.assertEqual(len(audio_data.events), 1)
+ self.assertEqual(audio_data.events[0].event, 'on_eos')
+
+ # Source 2 not eos yet
+ source2._get_queue_source.return_value.get_audio_data.return_value = self.create_audio_data(duration=1., data='2')
+ audio_data = source_group.get_audio_data(1024)
+ self.assertEqual(audio_data.data, '2')
+ self.assertAlmostEqual(audio_data.timestamp, 1.)
+ self.assertFalse(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 2.)
+ self.assertEqual(len(audio_data.events), 0)
+
+ # Now source 2 is eos
+ source2._get_queue_source.return_value.get_audio_data.return_value = None
+ audio_data = source_group.get_audio_data(1024)
+ self.assertIsNone(audio_data)
+ self.assertFalse(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 2., msg='Last source is not removed')
+
+ def test_loop(self):
+ """Test that the source group seeks to the start of the current source if eos is reached
+ and looping is enabled."""
+ source_group = SourceGroup(self.audio_format, None)
+ source_group.loop = True
+ source1 = self.create_mock_source(1., '1')
+ source2 = self.create_mock_source(2., '2')
+ source_group.queue(source1)
+ source_group.queue(source2)
+
+ self.assertTrue(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 3.)
+ self.assertTrue(source_group.loop)
+
+ audio_data = source_group.get_audio_data(1024)
+ self.assertEqual(audio_data.data, '1')
+ self.assertAlmostEqual(audio_data.timestamp, 0.)
+ self.assertTrue(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 3.)
+ self.assertTrue(source_group.loop)
+
+ # Source 1 is eos, seek resets it to start
+ def seek(_):
+ source1._get_queue_source.return_value.get_audio_data.return_value = self.create_audio_data(duration=1., data='1')
+ source1._get_queue_source.return_value.seek.side_effect = seek
+ source1._get_queue_source.return_value.get_audio_data.return_value = None
+ audio_data = source_group.get_audio_data(1024)
+ self.assertEqual(audio_data.data, '1')
+ self.assertAlmostEqual(audio_data.timestamp, 1.)
+ self.assertTrue(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 3.)
+ self.assertEqual(len(audio_data.events), 1)
+ self.assertEqual(audio_data.events[0].event, 'on_eos')
+ self.assertTrue(source_group.loop)
+
+ def test_loop_advance_on_eos(self):
+ """Test advancing to the next source on eos when looping is enabled."""
+ source_group = SourceGroup(self.audio_format, None)
+ source_group.loop = True
+ source1 = self.create_mock_source(1., '1')
+ source2 = self.create_mock_source(2., '2')
+ source_group.queue(source1)
+ source_group.queue(source2)
+
+ self.assertTrue(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 3.)
+ self.assertTrue(source_group.loop)
+
+ audio_data = source_group.get_audio_data(1024)
+ self.assertEqual(audio_data.data, '1')
+ self.assertAlmostEqual(audio_data.timestamp, 0.)
+ self.assertTrue(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 3.)
+ self.assertTrue(source_group.loop)
+
+ # Request advance on eos
+ source_group.next_source(immediate=False)
+ source1._get_queue_source.return_value.get_audio_data.return_value = None
+ source2._get_queue_source.return_value.get_audio_data.return_value = self.create_audio_data(duration=1., data='2')
+ audio_data = source_group.get_audio_data(1024)
+ self.assertEqual(audio_data.data, '2')
+ self.assertAlmostEqual(audio_data.timestamp, 1.)
+ self.assertFalse(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 2.)
+ self.assertEqual(len(audio_data.events), 1)
+ self.assertEqual(audio_data.events[0].event, 'on_eos')
+ self.assertTrue(source_group.loop)
+
+ # Source 2 still loops
+ def seek(_):
+ source2._get_queue_source.return_value.get_audio_data.return_value = self.create_audio_data(duration=1., data='2')
+ source2._get_queue_source.return_value.seek.side_effect = seek
+ source2._get_queue_source.return_value.get_audio_data.return_value = None
+ audio_data = source_group.get_audio_data(1024)
+ self.assertEqual(audio_data.data, '2')
+ self.assertAlmostEqual(audio_data.timestamp, 3.)
+ self.assertFalse(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 2.)
+ self.assertEqual(len(audio_data.events), 1)
+ self.assertEqual(audio_data.events[0].event, 'on_eos')
+ self.assertTrue(source_group.loop)
+
+ def test_loop_advance_immediate(self):
+ """Test advancing immediately to the next source when looping is enabled."""
+ source_group = SourceGroup(self.audio_format, None)
+ source_group.loop = True
+ source1 = self.create_mock_source(1., '1')
+ source2 = self.create_mock_source(2., '2')
+ source_group.queue(source1)
+ source_group.queue(source2)
+
+ self.assertTrue(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 3.)
+ self.assertTrue(source_group.loop)
+
+ audio_data = source_group.get_audio_data(1024)
+ self.assertEqual(audio_data.data, '1')
+ self.assertAlmostEqual(audio_data.timestamp, 0.)
+ self.assertTrue(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 3.)
+ self.assertTrue(source_group.loop)
+
+ # Request advance immediately
+ source_group.next_source(immediate=True)
+ source1._get_queue_source.return_value.get_audio_data.return_value = self.create_audio_data(duration=1., data='1')
+ source2._get_queue_source.return_value.get_audio_data.return_value = self.create_audio_data(duration=1., data='2')
+ audio_data = source_group.get_audio_data(1024)
+ self.assertEqual(audio_data.data, '2')
+ self.assertAlmostEqual(audio_data.timestamp, 1.)
+ self.assertFalse(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 2.)
+ self.assertEqual(len(audio_data.events), 0)
+ self.assertTrue(source_group.loop)
+
+ # Source 2 still loops
+ def seek(_):
+ source2._get_queue_source.return_value.get_audio_data.return_value = self.create_audio_data(duration=1., data='2')
+ source2._get_queue_source.return_value.seek.side_effect = seek
+ source2._get_queue_source.return_value.get_audio_data.return_value = None
+ audio_data = source_group.get_audio_data(1024)
+ self.assertEqual(audio_data.data, '2')
+ self.assertAlmostEqual(audio_data.timestamp, 3.)
+ self.assertFalse(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 2.)
+ self.assertEqual(len(audio_data.events), 1)
+ self.assertEqual(audio_data.events[0].event, 'on_eos')
+ self.assertTrue(source_group.loop)
+
+ def test_empty_source_group(self):
+ """Test an empty source group"""
+ source_group = SourceGroup(self.audio_format, None)
+ self.assertFalse(source_group.has_next())
+ self.assertAlmostEqual(source_group.duration, 0.)
+ self.assertIsNone(source_group.get_current_source())
+ source_group.seek(1.)
+ source_group.next_source()
+ self.assertIsNone(source_group.get_audio_data(1024))
+ self.assertAlmostEqual(source_group.translate_timestamp(1.), 1.)
+ self.assertIsNone(source_group.get_next_video_timestamp())
+ self.assertIsNone(source_group.get_next_video_frame())
+ self.assertFalse(source_group.loop)
+
+ def test_translate_timestamp(self):
+ """Test that translate_timestamp works correctly with advancing and looping."""
+ source_group = SourceGroup(self.audio_format, None)
+ source_group.loop = True
+ source1 = self.create_mock_source(1., '1')
+ source2 = self.create_mock_source(2., '2')
+ source_group.queue(source1)
+ source_group.queue(source2)
+ self.assertAlmostEqual(source_group.translate_timestamp(.5), .5)
+ self.assertAlmostEqual(source_group.translate_timestamp(1.), 1.)
+
+ # Loop source 1
+ def seek(_):
+ source1._get_queue_source.return_value.get_audio_data.return_value = self.create_audio_data(duration=1., data='1')
+ source1._get_queue_source.return_value.seek.side_effect = seek
+ source1._get_queue_source.return_value.get_audio_data.return_value = None
+ source_group.get_audio_data(1024)
+ self.assertAlmostEqual(source_group.translate_timestamp(1.5), .5)
+ self.assertAlmostEqual(source_group.translate_timestamp(2.), 1.)
+
+ # Loop source 1 again
+ def seek(_):
+ source1._get_queue_source.return_value.get_audio_data.return_value = self.create_audio_data(duration=1., data='1')
+ source1._get_queue_source.return_value.seek.side_effect = seek
+ source1._get_queue_source.return_value.get_audio_data.return_value = None
+ source_group.get_audio_data(1024)
+ self.assertAlmostEqual(source_group.translate_timestamp(2.5), .5)
+ self.assertAlmostEqual(source_group.translate_timestamp(3.), 1.)
+
+ # Advance to source 2
+ source_group.next_source()
+ self.assertAlmostEqual(source_group.translate_timestamp(3.5), .5)
+ self.assertAlmostEqual(source_group.translate_timestamp(4.), 1.)
+
+ # Loop source 2
+ def seek(_):
+ source2._get_queue_source.return_value.get_audio_data.return_value = self.create_audio_data(duration=1., data='2')
+ source2._get_queue_source.return_value.seek.side_effect = seek
+ source2._get_queue_source.return_value.get_audio_data.return_value = None
+ source_group.get_audio_data(1024)
+ self.assertAlmostEqual(source_group.translate_timestamp(5.5), .5)
+ self.assertAlmostEqual(source_group.translate_timestamp(6.), 1.)
+
+ # Also try going back to previous source
+ self.assertAlmostEqual(source_group.translate_timestamp(.5), .5)
+ self.assertAlmostEqual(source_group.translate_timestamp(1.5), .5)
+
+ # And finally do not fail on None
+ self.assertIsNone(source_group.translate_timestamp(None))
+
+ def test_get_next_video_timestamp(self):
+ source1 = self.create_mock_source(1., audio_data=None, video_frame='a')
+ source2 = self.create_mock_source(2., audio_data=None, video_frame='b')
+ source_group = SourceGroup(self.audio_format, self.video_format)
+ source_group.queue(source1)
+ source_group.queue(source2)
+
+ timestamp = source_group.get_next_video_timestamp()
+ self.assertAlmostEqual(timestamp, 0.1)
+
+ source_group.next_source()
+ timestamp = source_group.get_next_video_timestamp()
+ self.assertAlmostEqual(timestamp, 1.1)
+
+ def test_get_next_video_frame(self):
+ source1 = self.create_mock_source(1., audio_data=None, video_frame='a')
+ source2 = self.create_mock_source(2., audio_data=None, video_frame='b')
+ source_group = SourceGroup(self.audio_format, self.video_format)
+ source_group.queue(source1)
+ source_group.queue(source2)
+
+ self.assertEqual(source_group.get_next_video_frame(), 'a')
+
+ source_group.next_source()
+ self.assertEqual(source_group.get_next_video_frame(), 'b')
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_atlas.py b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_atlas.py
new file mode 100644
index 0000000..4fc72d1
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_atlas.py
@@ -0,0 +1,92 @@
+#!/usr/bin/python
+# $Id:$
+
+import unittest
+
+from pyglet.image import atlas
+
+__noninteractive = True
+
+class Rect(object):
+ def __init__(self, x1, y1, x2, y2):
+ self.x1 = x1
+ self.y1 = y1
+ self.x2 = x2
+ self.y2 = y2
+
+ def __repr__(self):
+ return 'Rect(%d, %d to %d, %d)' % (
+ self.x1, self.y1, self.x2, self.y2)
+
+ def intersects(self, other):
+ return self.x2 > other.x1 and self.x1 < other.x2 and \
+ self.y2 > other.y1 and self.y1 < other.y2
+
+class AllocatorEnvironment(object):
+ def __init__(self, test_case, width, height):
+ self.test_case = test_case
+ self.rectes = []
+ self.allocator = atlas.Allocator(width, height)
+
+ def check(self, test_case):
+ for i, rect in enumerate(self.rectes):
+ test_case.assertTrue(0 <= rect.x1 < self.allocator.width)
+ test_case.assertTrue(0 <= rect.x2 <= self.allocator.width)
+ test_case.assertTrue(0 <= rect.y1 < self.allocator.height)
+ test_case.assertTrue(0 <= rect.y2 <= self.allocator.height)
+ for other in self.rectes[i + 1:]:
+ test_case.assertFalse(rect.intersects(other))
+
+ def add(self, width, height):
+ x, y = self.allocator.alloc(width, height)
+ self.rectes.append(Rect(x, y, x + width, y + height))
+ self.check(self.test_case)
+
+ def add_fail(self, width, height):
+ self.test_case.assertRaises(atlas.AllocatorException,
+ self.allocator.alloc, width, height)
+
+class TestPack(unittest.TestCase):
+ def test_over_x(self):
+ env = AllocatorEnvironment(self, 3, 3)
+ env.add_fail(3, 4)
+
+ def test_over_y(self):
+ env = AllocatorEnvironment(self, 3, 3)
+ env.add_fail(4, 3)
+
+ def test_1(self):
+ env = AllocatorEnvironment(self, 4, 4)
+ for i in range(16):
+ env.add(1, 1)
+ env.add_fail(1, 1)
+
+ def test_2(self):
+ env = AllocatorEnvironment(self, 3, 3)
+ env.add(2, 2)
+ for i in range(4):
+ env.add(1, 1)
+
+ def test_3(self):
+ env = AllocatorEnvironment(self, 3, 3)
+ env.add(3, 3)
+ env.add_fail(1, 1)
+
+ def test_4(self):
+ env = AllocatorEnvironment(self, 5, 4)
+ for i in range(4):
+ env.add(2, 2)
+ env.add_fail(2, 1)
+ env.add(1, 2)
+ env.add(1, 2)
+ env.add_fail(1, 1)
+
+ def test_5(self):
+ env = AllocatorEnvironment(self, 4, 4)
+ env.add(3, 2)
+ env.add(4, 2)
+ env.add(1, 2)
+ env.add_fail(1, 1)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_clock.py b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_clock.py
new file mode 100644
index 0000000..3745878
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_clock.py
@@ -0,0 +1,348 @@
+import unittest
+from tests import mock
+import pyglet.clock
+
+
+class ClockTestCase(unittest.TestCase):
+ """Test clock using dummy time keeper
+
+ not tested:
+ positional and named arguments
+ """
+
+ def setUp(self):
+ self.interval = .001
+ self.time = 0
+ self.callback_a = mock.Mock()
+ self.callback_b = mock.Mock()
+ self.callback_c = mock.Mock()
+ self.callback_d = mock.Mock()
+ self.clock = pyglet.clock.Clock(time_function=lambda: self.time)
+
+ def advance_clock(self, dt=1):
+ """simulate the passage of time like a real clock would"""
+ frames = 0
+ end = self.time + dt
+ while self.time < end:
+ frames += 1
+ self.time += self.interval
+ self.clock.tick()
+ self.time = round(self.time, 0)
+ return frames
+
+ def test_schedule(self):
+ self.clock.schedule(self.callback_a)
+ frames = self.advance_clock()
+ self.assertEqual(self.callback_a.call_count, frames)
+
+ def test_schedule_once(self):
+ self.clock.schedule_once(self.callback_a, 1)
+ self.advance_clock(2)
+ self.assertEqual(self.callback_a.call_count, 1)
+
+ def test_schedule_once_multiple(self):
+ self.clock.schedule_once(self.callback_a, 1)
+ self.clock.schedule_once(self.callback_b, 2)
+ self.advance_clock(2)
+ self.assertEqual(self.callback_a.call_count, 1)
+ self.assertEqual(self.callback_b.call_count, 1)
+
+ def test_schedule_interval(self):
+ self.clock.schedule_interval(self.callback_a, 1)
+ self.advance_clock(2)
+ self.assertEqual(self.callback_a.call_count, 2)
+
+ def test_schedule_interval_multiple(self):
+ self.clock.schedule_interval(self.callback_a, 1)
+ self.clock.schedule_interval(self.callback_b, 1)
+ self.advance_clock(2)
+ self.assertEqual(self.callback_a.call_count, 2)
+ self.assertEqual(self.callback_b.call_count, 2)
+
+ def test_schedule_interval_soft(self):
+ self.clock.schedule_interval_soft(self.callback_a, 1)
+ self.advance_clock(2)
+ self.assertEqual(self.callback_a.call_count, 2)
+
+ @unittest.skip('Requires changes to the clock')
+ def test_schedule_interval_soft_multiple(self):
+ self.clock.schedule_interval(self.callback_a, 1)
+ self.clock.schedule_interval_soft(self.callback_b, 1)
+ self.clock.schedule_interval_soft(self.callback_b, 1)
+ next_ts = set(i.next_ts for i in self.clock._scheduled_items)
+ self.assertEqual(len(next_ts), 3)
+ self.advance_clock()
+ self.assertEqual(self.callback_a.call_count, 1)
+ self.assertEqual(self.callback_b.call_count, 2)
+
+ def test_schedule_unschedule(self):
+ self.clock.schedule(self.callback_a)
+ self.clock.unschedule(self.callback_a)
+ self.advance_clock()
+ self.assertEqual(self.callback_a.call_count, 0)
+
+ def test_schedule_once_unschedule(self):
+ self.clock.schedule_once(self.callback_a, 1)
+ self.clock.unschedule(self.callback_a)
+ self.advance_clock()
+ self.assertEqual(self.callback_a.call_count, 0)
+
+ def test_schedule_interval_unschedule(self):
+ self.clock.schedule_interval(self.callback_a, 1)
+ self.clock.unschedule(self.callback_a)
+ self.advance_clock()
+ self.assertEqual(self.callback_a.call_count, 0)
+
+ def test_schedule_interval_soft_unschedule(self):
+ self.clock.schedule_interval_soft(self.callback_a, 1)
+ self.clock.unschedule(self.callback_a)
+ self.advance_clock()
+ self.assertEqual(self.callback_a.call_count, 0)
+
+ def test_unschedule_removes_all(self):
+ self.clock.schedule(self.callback_a)
+ self.clock.schedule_once(self.callback_a, 1)
+ self.clock.schedule_interval(self.callback_a, 1)
+ self.clock.schedule_interval_soft(self.callback_a, 1)
+ self.clock.schedule(self.callback_a)
+ self.clock.schedule(self.callback_b)
+ self.clock.unschedule(self.callback_a)
+ frames = self.advance_clock(10)
+ self.assertEqual(self.callback_a.call_count, 0)
+ # callback_b is used to verify that the entire event queue was not cleared
+ self.assertEqual(self.callback_b.call_count, frames)
+
+ def test_schedule_will_not_call_function(self):
+ self.clock.schedule(self.callback_a)
+ self.assertEqual(self.callback_a.call_count, 0)
+ self.clock.schedule_once(self.callback_a, 0)
+ self.assertEqual(self.callback_a.call_count, 0)
+ self.clock.schedule_interval(self.callback_a, 1)
+ self.assertEqual(self.callback_a.call_count, 0)
+ self.clock.schedule_interval_soft(self.callback_a, 1)
+ self.assertEqual(self.callback_a.call_count, 0)
+
+ def test_unschedule_will_not_call_function(self):
+ self.clock.schedule(self.callback_a)
+ self.clock.unschedule(self.callback_a)
+ self.assertEqual(self.callback_a.call_count, 0)
+ self.clock.schedule_once(self.callback_a, 0)
+ self.clock.unschedule(self.callback_a)
+ self.assertEqual(self.callback_a.call_count, 0)
+ self.clock.schedule_interval(self.callback_a, 1)
+ self.clock.unschedule(self.callback_a)
+ self.assertEqual(self.callback_a.call_count, 0)
+ self.clock.schedule_interval_soft(self.callback_a, 1)
+ self.clock.unschedule(self.callback_a)
+ self.assertEqual(self.callback_a.call_count, 0)
+
+ def test_unschedule_will_not_fail_if_already_unscheduled(self):
+ self.clock.schedule(self.callback_a)
+ self.clock.unschedule(self.callback_a)
+ self.clock.unschedule(self.callback_a)
+ self.clock.schedule_once(self.callback_a, 0)
+ self.clock.unschedule(self.callback_a)
+ self.clock.unschedule(self.callback_a)
+ self.clock.schedule_interval(self.callback_a, 1)
+ self.clock.unschedule(self.callback_a)
+ self.clock.unschedule(self.callback_a)
+ self.clock.schedule_interval_soft(self.callback_a, 1)
+ self.clock.unschedule(self.callback_a)
+ self.clock.unschedule(self.callback_a)
+
+ def test_call_sched_return_True_if_called_functions(self):
+ self.clock.schedule(self.callback_a)
+ self.assertTrue(self.clock.call_scheduled_functions(0))
+
+ @unittest.skip('Requires changes to the clock')
+ def test_call_sched_return_True_if_called_functions_interval(self):
+ self.clock.schedule_once(self.callback_a, 1)
+ self.assertFalse(self.clock.call_scheduled_functions(0))
+ self.clock.set_time(1)
+ self.assertTrue(self.clock.call_scheduled_functions(0))
+
+ def test_call_sched_return_False_if_no_called_functions(self):
+ self.assertFalse(self.clock.call_scheduled_functions(0))
+
+ def test_tick_return_last_delta(self):
+ self.assertEqual(self.clock.tick(), 0)
+ self.time = 1
+ self.assertEqual(self.clock.tick(), 1)
+ self.time = 3
+ self.assertEqual(self.clock.tick(), 2)
+
+ @unittest.skip('Requires changes to the clock')
+ def test_get_sleep_time_None_if_no_items(self):
+ self.assertIsNone(self.clock.get_sleep_time())
+
+ @unittest.skip('Requires changes to the clock')
+ def test_get_sleep_time_can_sleep(self):
+ self.clock.schedule_once(self.callback_a, 3)
+ self.clock.schedule_once(self.callback_b, 1)
+ self.clock.schedule_once(self.callback_c, 6)
+ self.clock.schedule_once(self.callback_d, 7)
+ self.assertEqual(self.clock.get_sleep_time(), 1)
+ self.advance_clock()
+ self.assertEqual(self.clock.get_sleep_time(), 2)
+ self.advance_clock(2)
+ self.assertEqual(self.clock.get_sleep_time(), 3)
+ self.advance_clock(3)
+ self.assertEqual(self.clock.get_sleep_time(), 1)
+
+ @unittest.skip('Requires changes to the clock')
+ def test_get_sleep_time_cannot_sleep(self):
+ self.clock.schedule(self.callback_a)
+ self.clock.schedule_once(self.callback_b, 1)
+ self.assertEqual(self.clock.get_sleep_time(), 0)
+
+ @unittest.skip
+ def test_schedule_item_during_tick(self):
+ def replicating_event(dt):
+ self.clock.schedule(replicating_event)
+ counter()
+
+ counter = mock.Mock()
+ self.clock.schedule(replicating_event)
+
+ # one tick for the original event
+ self.clock.tick()
+ self.assertEqual(counter.call_count, 1)
+
+ # requires access to private member
+ self.assertEqual(len(self.clock._schedule_items), 2)
+
+ # one tick from original, then two for new
+ # now event queue should have two items as well
+ self.clock.tick()
+ self.assertEqual(counter.call_count, 3)
+
+ # requires access to private member
+ self.assertEqual(len(self.clock._schedule_items), 4)
+
+ def test_unschedule_interval_item_during_tick(self):
+ def suicidal_event(dt):
+ counter()
+ self.clock.unschedule(suicidal_event)
+
+ counter = mock.Mock()
+ self.clock.schedule_interval(suicidal_event, 1)
+ self.advance_clock()
+ self.assertEqual(counter.call_count, 1)
+
+ @unittest.skip
+ def test_schedule_interval_item_during_tick(self):
+ def replicating_event(dt):
+ self.clock.schedule_interval(replicating_event, 1)
+ counter()
+
+ counter = mock.Mock()
+ self.clock.schedule_interval(replicating_event, 1)
+
+ # advance time for the original event
+ self.advance_clock()
+ self.assertEqual(counter.call_count, 1)
+
+ # requires access to private member
+ self.assertEqual(len(self.clock._schedule_interval_items), 2)
+
+ # one tick from original, then two for new
+ # now event queue should have two items as well
+ self.advance_clock()
+ self.assertEqual(counter.call_count, 3)
+
+ # requires access to private member
+ self.assertEqual(len(self.clock._schedule_interval_items), 4)
+
+ def test_scheduler_integrity(self):
+ """most tests in this suite do not care about which order
+ scheduled items are executed. this test will verify that
+ the order things are executed is correct.
+ """
+ expected_order = [self.callback_a, self.callback_b,
+ self.callback_c, self.callback_d]
+
+ # schedule backwards to verify that they are scheduled correctly,
+ # even if scheduled out-of-order.
+ for delay, func in reversed(list(enumerate(expected_order, start=1))):
+ self.clock.schedule_once(func, delay)
+
+ for index, func in enumerate(expected_order, start=1):
+ self.advance_clock()
+ self.assertTrue(func.called)
+ self.assertFalse(any(i.called for i in expected_order[index:]))
+
+ def test_slow_clock(self):
+ """pyglet's clock will not make up for lost time. in this case, the
+ interval scheduled for callback_[bcd] is 1, and 2 seconds have passed.
+ since pyglet won't make up for lost time, they are only called once.
+ """
+ self.clock.schedule(self.callback_a)
+ self.clock.schedule_once(self.callback_b, 1)
+ self.clock.schedule_interval(self.callback_c, 1)
+ self.clock.schedule_interval_soft(self.callback_d, 1)
+
+ # simulate a slow clock
+ self.time = 2
+ self.clock.tick()
+
+ self.assertEqual(self.callback_a.call_count, 1)
+ self.assertEqual(self.callback_b.call_count, 1)
+ self.assertEqual(self.callback_c.call_count, 1)
+ self.assertEqual(self.callback_d.call_count, 1)
+
+ def test_slow_clock_reschedules(self):
+ """pyglet's clock will not make up for lost time. in this case, the
+ interval scheduled for callback_[bcd] is 1, and 2 seconds have passed.
+ since pyglet won't make up for lost time (call events that missed their
+ execution time), they are only called once. this test verifies that
+ missed events are rescheduled and executed later
+ """
+ self.clock.schedule(self.callback_a)
+ self.clock.schedule_once(self.callback_b, 1)
+ self.clock.schedule_interval(self.callback_c, 1)
+ self.clock.schedule_interval_soft(self.callback_d, 1)
+
+ # simulate slow clock
+ self.time = 2
+ self.clock.tick()
+
+ # simulate a proper clock (advance clock time by one)
+ frames = self.advance_clock()
+
+ # make sure our clock is at 3 seconds
+ self.assertEqual(self.time, 3)
+
+ # the +1 is the call during the slow clock period
+ self.assertEqual(self.callback_a.call_count, frames + 1)
+
+ # only scheduled to happen once
+ self.assertEqual(self.callback_b.call_count, 1)
+
+ # 2 because they 'missed' a call when the clock lagged
+ # with a good clock, this would be 3
+ self.assertEqual(self.callback_c.call_count, 2)
+ self.assertEqual(self.callback_d.call_count, 2)
+
+ @unittest.skip('Requires changes to the clock')
+ def test_get_interval(self):
+ self.assertEqual(self.clock.get_interval(), 0)
+ self.advance_clock(100)
+ self.assertEqual(round(self.clock.get_interval(), 10), self.interval)
+
+ def test_soft_scheduling_stress_test(self):
+ """test that the soft scheduler is able to correctly soft-schedule
+ several overlapping events.
+ this test delves into implementation of the clock, and may break
+ """
+ # this value represents evenly scheduled items between 0 & 1
+ # and what is produced by the correct soft-scheduler
+ expected = [0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5,
+ 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 1]
+
+ for i in range(16):
+ self.clock.schedule_interval_soft(None, 1)
+
+ # sort the clock items
+ items = sorted(i.next_ts for i in self.clock._schedule_interval_items)
+
+ self.assertEqual(items, expected)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_clock_fps.py b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_clock_fps.py
new file mode 100644
index 0000000..70010ce
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_clock_fps.py
@@ -0,0 +1,113 @@
+
+"""Tests clock timing between frames and estimations
+of frames per second.
+"""
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import time
+import unittest
+
+from pyglet import clock
+
+def sleep(seconds):
+ "Busy sleep on the CPU which is very precise"
+ pyclock = clock.get_default()
+ start = pyclock.time()
+ while pyclock.time() - start < seconds:
+ pass
+
+class ClockTimingTestCase(unittest.TestCase):
+
+ def setUp(self):
+ # since clock is global,
+ # we initialize a new clock on every test
+ clock.set_default(clock.Clock())
+
+ def test_first_tick_is_delta_zero(self):
+ """
+ Tests that the first tick is dt = 0.
+ """
+ dt = clock.tick()
+ self.assertTrue(dt == 0)
+
+ def test_start_at_zero_fps(self):
+ """
+ Tests that the default clock starts
+ with zero fps.
+ """
+ self.assertTrue(clock.get_fps() == 0)
+
+ def test_elapsed_time_between_tick(self):
+ """
+ Test that the tick function returns the correct elapsed
+ time between frames, in seconds.
+
+ Because we are measuring time differences, we
+ expect a small error (1%) from the expected value.
+ """
+ sleep_time = 0.2
+
+ # initialize internal counter
+ clock.tick()
+
+ # test between initialization and first tick
+ sleep(sleep_time)
+ delta_time_1 = clock.tick()
+
+ # test between non-initialization tick and next tick
+ sleep(sleep_time)
+ delta_time_2 = clock.tick()
+
+ self.assertAlmostEqual(delta_time_1, sleep_time, delta=0.01*sleep_time)
+ self.assertAlmostEqual(delta_time_2, sleep_time, delta=0.01*sleep_time)
+
+ def test_compute_fps(self):
+ """
+ Test that the clock computes a reasonable value of
+ frames per second when simulated for 10 ticks at 5 frames per second.
+
+ Because sleep is not very precise and fps are unbounded, we
+ expect a moderate error (10%) from the expected value.
+ """
+ ticks = 10 # for averaging
+ expected_fps = 5
+ seconds_per_tick = 1./expected_fps
+
+ for i in range(ticks):
+ time.sleep(seconds_per_tick)
+ clock.tick()
+ computed_fps = clock.get_fps()
+
+ self.assertAlmostEqual(computed_fps, expected_fps, delta=0.1*expected_fps)
+
+ def test_limit_fps(self):
+ """
+ Test that the clock effectively limits the
+ frames per second to 60 Hz when set to.
+
+ Because the fps are bounded, we expect a small error (1%)
+ from the expected value.
+ """
+ ticks = 20
+ fps_limit = 60
+ expected_delta_time = ticks*1./fps_limit
+
+ clock.set_fps_limit(fps_limit)
+
+ pyclock = clock.get_default()
+ t1 = pyclock.time()
+ # Initializes the timer state.
+ clock.tick()
+ for i in range(ticks):
+ clock.tick()
+
+ t2 = pyclock.time()
+
+ computed_time_delta = t2 - t1
+
+ self.assertAlmostEqual(computed_time_delta,
+ expected_delta_time,
+ delta=0.01*expected_delta_time)
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_events.py b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_events.py
new file mode 100644
index 0000000..15a292d
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_events.py
@@ -0,0 +1,112 @@
+"""Testing the events"""
+
+
+import unittest
+import pyglet
+from tests import mock
+from contextlib import contextmanager
+from pyglet.event import EVENT_HANDLED, EVENT_UNHANDLED
+
+
+class EventTestCase(unittest.TestCase):
+ def setUp(self):
+ self.d = pyglet.event.EventDispatcher()
+ self.d._event_stack = ()
+ try:
+ del pyglet.event.EventDispatcher.event_types
+ except AttributeError:
+ pass
+
+ @contextmanager
+ def mock_context(self, called=True):
+ self.mock = mock.Mock(mock_event=mock.Mock())
+ self.mock.__name__ = 'mock_event'
+ self.d.register_event_type('mock_event')
+ yield
+ result = self.d.dispatch_event('mock_event')
+ if called:
+ self.assertEqual(result, EVENT_HANDLED)
+ self.assertTrue(self.mock.called)
+ else:
+ # self.assertEqual(result, EVENT_UNHANDLED)
+ self.assertFalse(self.mock.called)
+
+ def test_register_event_type(self):
+ self.d.register_event_type('mock_event')
+
+ @unittest.skip('Requires changes to events from fork by Leif')
+ def test_push_handlers_args(self):
+ with self.mock_context():
+ self.d.push_handlers(self.mock)
+
+ def test_push_handlers_kwargs(self):
+ with self.mock_context():
+ self.d.push_handlers(mock_event=self.mock)
+
+ def test_push_handlers_not_setup(self):
+ self.d.push_handlers()
+
+ @unittest.skip('Requires changes to events from fork by Leif')
+ def test_set_handlers_args(self):
+ with self.mock_context():
+ self.d.set_handlers(self.mock)
+
+ def test_set_handlers_kwargs(self):
+ with self.mock_context():
+ self.d.set_handlers(mock_event=self.mock)
+
+ def test_set_handlers_not_setup(self):
+ self.d.set_handlers()
+
+ def test_set_handler_dispatch(self):
+ with self.mock_context():
+ self.d.set_handler('mock_event', self.mock)
+
+ def test_set_handler_not_setup(self):
+ self.d.set_handler('mock_event', None)
+
+ @unittest.skip('Requires changes to events from fork by Leif')
+ def test_pop_handlers(self):
+ self.d.set_handler('mock_event', None)
+ self.d.pop_handlers()
+ with self.assertRaises(NoHandlerException):
+ self.d.pop_handlers()
+
+ @unittest.skip('Requires changes to events from fork by Leif')
+ def test_pop_handlers_not_setup(self):
+ with self.assertRaises(NoHandlerException):
+ self.d.pop_handlers()
+
+ @unittest.skip('Requires changes to events from fork by Leif')
+ def test_remove_handlers_args(self):
+ with self.mock_context(False):
+ self.d.set_handler('mock_event', self.mock)
+ self.d.remove_handlers('mock_event')
+
+ def test_remove_handlers_kwargs(self):
+ with self.mock_context(False):
+ self.d.set_handler('mock_event', self.mock)
+ self.d.remove_handlers(mock_event=self.mock)
+
+ def test_remove_handlers_not_setup(self):
+ self.d.remove_handlers()
+
+ def test_remove_handler(self):
+ with self.mock_context(False):
+ self.d.set_handler('mock_event', self.mock)
+ self.d.remove_handler('mock_event', self.mock)
+
+ def test_dispatch_event_handled(self):
+ self.d.register_event_type('mock_event')
+ self.d.dispatch_event('mock_event')
+
+ @unittest.skip('Requires changes to events from fork by Leif')
+ def test_dispatch_unhandled(self):
+ self.d.register_event_type('mock_event')
+ with self.assertRaises(NoHandlerException):
+ self.d.dispatch_event('not_handled')
+
+ @unittest.skip('Requires changes to events from fork by Leif')
+ def test_dispatch_event_not_setup(self):
+ with self.assertRaises(NoHandlerException):
+ self.d.dispatch_event('mock_event')
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_font.py b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_font.py
new file mode 100644
index 0000000..4100175
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_font.py
@@ -0,0 +1,22 @@
+"""
+Test pyglet font package
+"""
+
+import pytest
+import pyglet
+from tests.annotations import require_platform, Platform
+
+@require_platform(Platform.WINDOWS)
+def test_load_privatefont(test_data):
+
+ pyglet.font.add_file(test_data.get_file('fonts', 'action_man.ttf'))
+ action_man_font = pyglet.font.load("Action Man", size=12, dpi=96)
+ assert action_man_font.logfont.lfFaceName.decode("utf-8") == "Action Man"
+
+@require_platform(Platform.WINDOWS)
+def test_load_privatefont_from_list(test_data):
+ """Test for Issue #100"""
+
+ pyglet.font.add_file(test_data.get_file('fonts', 'action_man.ttf'))
+ action_man_font = pyglet.font.load(["Action Man"], size=12, dpi=96)
+ assert action_man_font.logfont.lfFaceName.decode("utf-8") == "Action Man"
\ No newline at end of file
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_osx.py b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_osx.py
new file mode 100644
index 0000000..6c0e929
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_osx.py
@@ -0,0 +1,58 @@
+import unittest
+from tests import mock
+import imp
+import pyglet
+import warnings
+
+
+class OSXImportTestCase(unittest.TestCase):
+
+ @mock.patch('sys.platform', 'darwin')
+ @mock.patch('platform.mac_ver', lambda: ['10.5.0'])
+ @mock.patch('struct.calcsize', lambda i: 4)
+ def test_old_32bit_osx_uses_carbon(self):
+ imp.reload(pyglet)
+ self.assertEqual(pyglet.options['darwin_cocoa'], False)
+
+ @mock.patch("sys.platform", "darwin")
+ @mock.patch("platform.mac_ver", lambda: ['10.5.0'])
+ @mock.patch('struct.calcsize', lambda i: 8)
+ def test_old_64bit_osx_not_supported(self):
+ with self.assertRaises(Exception) as e:
+ imp.reload(pyglet)
+
+ @mock.patch("sys.platform", "darwin")
+ @mock.patch('struct.calcsize', lambda i: 4)
+ @mock.patch("platform.mac_ver", lambda: ['10.10.0'])
+ def test_32bit_osx_uses_carbon(self):
+ imp.reload(pyglet)
+ self.assertEqual(pyglet.options['darwin_cocoa'], False)
+
+ @mock.patch("sys.platform", "darwin")
+ @mock.patch("platform.mac_ver", lambda: ['10.6.0'])
+ @mock.patch('struct.calcsize', lambda i: 8)
+ def test_64bit_osx_uses_cocoa(self):
+ imp.reload(pyglet)
+ self.assertEqual(pyglet.options['darwin_cocoa'], True)
+
+ @mock.patch('sys.platform', 'darwin')
+ @mock.patch('platform.mac_ver', lambda: ['10.5.0'])
+ @mock.patch('struct.calcsize', lambda i: 4)
+ def test_carbon_deprecation_warning(self):
+ with warnings.catch_warnings(record=True) as warning_catcher:
+ warnings.simplefilter('always')
+
+ # Reset the warning registry
+ # By default deprecation warnings are ignored. If the warning has already been
+ # raised earlier, the registry prevents it from showing again, even if the filter
+ # is set to allow it.
+ if hasattr(pyglet, '__warningregistry__'):
+ del pyglet.__warningregistry__
+
+ imp.reload(pyglet)
+
+ self.assertEqual(pyglet.options['darwin_cocoa'], False)
+ self.assertEqual(len(warning_catcher), 1)
+ self.assertIs(warning_catcher[-1].category, PendingDeprecationWarning)
+ self.assertIn('deprecated', str(warning_catcher[-1].message))
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_resource_path.py b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_resource_path.py
new file mode 100644
index 0000000..5b3175f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_resource_path.py
@@ -0,0 +1,114 @@
+import os
+import re
+import sys
+from tests import mock
+import unittest
+
+import pyglet
+from pyglet.resource import get_script_home, get_settings_path
+
+
+_executable = os.path.abspath(os.path.join('path', 'exec'))
+_script_home = os.path.abspath('path')
+
+
+def _mock_expand_user(p):
+ parts = re.split(r"[\\/]+", p)
+ parts[0] = 'pyglet'
+ return os.path.join(*parts)
+
+
+class ResourcePathTest(unittest.TestCase):
+ """
+ Test default paths returned for different platforms.
+ """
+
+ @mock.patch.object(sys, 'frozen', 'console_exe', create=True)
+ @mock.patch.object(sys, 'executable', _executable)
+ def test_script_home_frozen_console_exe(self):
+ """Py2exe console executable"""
+ self.assertEqual(get_script_home(), _script_home)
+
+ @mock.patch.object(sys, 'frozen', 'windows_exe', create=True)
+ @mock.patch.object(sys, 'executable', _executable)
+ def test_script_home_frozen_windows_exe(self):
+ """Py2exe windows executable"""
+ self.assertEqual(get_script_home(), _script_home)
+
+ @mock.patch.object(sys, 'frozen', 'macosx_app', create=True)
+ @mock.patch.dict(os.environ, {'RESOURCEPATH': _script_home})
+ def test_script_home_frozen_macosx(self):
+ """Py2App OSX bundle"""
+ self.assertEqual(get_script_home(), _script_home)
+
+ @mock.patch.object(sys.modules['__main__'], '__file__', _executable)
+ def test_script_home_normal_python(self):
+ """Normal execution of a script in python."""
+ self.assertEqual(get_script_home(), _script_home)
+
+ @mock.patch.dict('sys.modules', {'__main__': None})
+ @mock.patch.object(sys, 'executable', _executable)
+ def test_script_home_cx_freeze(self):
+ """Frozen binary created with cx_freeze"""
+ self.assertEqual(get_script_home(), _script_home)
+
+ @mock.patch('os.getcwd', return_value=_script_home)
+ @mock.patch.dict('sys.modules', {'__main__': None})
+ @mock.patch.object(sys, 'executable', 'python')
+ def test_script_home_interactive(self, *_):
+ """Interactive prompt, eg idle or cpython"""
+ self.assertEqual(get_script_home(), _script_home)
+
+
+ @mock.patch.object(pyglet, 'compat_platform', 'cygwin')
+ @mock.patch.dict('os.environ', {'APPDATA': 'pyglet'})
+ def test_settings_path_cygwin_appdata(self):
+ """Settings path on cygwin with APPDATA set."""
+ self.assertEqual(get_settings_path('myapp'),
+ os.path.join('pyglet', 'myapp'))
+
+ @mock.patch.object(pyglet, 'compat_platform', 'win32')
+ @mock.patch.dict('os.environ', {'APPDATA': 'pyglet'})
+ def test_settings_path_windows_appdata(self):
+ """Settings path on cygwin with APPDATA set."""
+ self.assertEqual(get_settings_path('myapp'),
+ os.path.join('pyglet', 'myapp'))
+
+ @mock.patch.object(pyglet, 'compat_platform', 'cygwin')
+ @mock.patch.object(os, 'environ', {})
+ @mock.patch.object(os.path, 'expanduser', _mock_expand_user)
+ def test_settings_path_cygwin_no_appdata(self):
+ """Settings path on cygwin without APPDATA set."""
+ self.assertEqual(get_settings_path('myapp'),
+ os.path.join('pyglet', 'myapp'))
+
+ @mock.patch.object(pyglet, 'compat_platform', 'win32')
+ @mock.patch.object(os, 'environ', {})
+ @mock.patch.object(os.path, 'expanduser', _mock_expand_user)
+ def test_settings_path_windows_no_appdata(self):
+ """Settings path on cygwin without APPDATA set."""
+ self.assertEqual(get_settings_path('myapp'),
+ os.path.join('pyglet', 'myapp'))
+
+ @mock.patch.object(pyglet, 'compat_platform', 'darwin')
+ @mock.patch.object(os.path, 'expanduser', _mock_expand_user)
+ def test_settings_path_darwin(self):
+ """Settings path on OSX."""
+ self.assertEqual(get_settings_path('myapp'),
+ os.path.join('pyglet', 'Library', 'Application Support', 'myapp'))
+
+ @mock.patch.object(pyglet, 'compat_platform', 'linux')
+ @mock.patch.dict('os.environ', {'XDG_CONFIG_HOME': 'pyglet'})
+ def test_settings_path_linux_xdg_config_home(self):
+ """Settings path on Linux with XDG_CONFIG_HOME available."""
+ self.assertEqual(get_settings_path('myapp'),
+ os.path.join('pyglet', 'myapp'))
+
+ @mock.patch.object(pyglet, 'compat_platform', 'linux')
+ @mock.patch.object(os, 'environ', {})
+ @mock.patch.object(os.path, 'expanduser', _mock_expand_user)
+ def test_settings_path_linux_xdg_config_home(self):
+ """Settings path on Linux without XDG_CONFIG_HOME."""
+ self.assertEqual(get_settings_path('myapp'),
+ os.path.join('pyglet', '.config', 'myapp'))
+
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_text.py b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_text.py
new file mode 100644
index 0000000..5567a48
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tests/unit/test_text.py
@@ -0,0 +1,357 @@
+import unittest
+
+import pyglet
+from pyglet.text import runlist
+from pyglet.text.formats.attributed import AttributedTextDecoder
+
+
+class TestStyleRuns(unittest.TestCase):
+
+ def check_value(self, runs, value):
+ for i, style in enumerate(value):
+ self.assertTrue(runs[i] == style, repr(runs.runs))
+ self.check_optimal(runs)
+ self.check_continuous(runs)
+ self.check_iter(runs, value)
+ self.check_iter_range(runs, value)
+
+ def check_optimal(self, runs):
+ last_style = None
+ for _, _, style in runs:
+ self.assertTrue(style != last_style)
+ last_style = style
+
+ def check_continuous(self, runs):
+ next_start = 0
+ for start, end, _ in runs:
+ self.assertTrue(start == next_start)
+ next_start = end
+
+ def check_iter(self, runs, value):
+ for start, end, style in runs:
+ for v in value[start:end]:
+ self.assertTrue(v == style)
+
+ def check_iter_range(self, runs, value):
+ for interval in range(1, len(value)):
+ it = runs.get_run_iterator()
+ for start in range(0, len(value), interval):
+ end = min(start + interval, len(value))
+ for s, e, style in it.ranges(start, end):
+ for v in value[s:e]:
+ self.assertTrue(v == style, (start, end, s, e, style))
+
+ def check_empty(self, runs, value):
+ start, end, style = next(iter(runs))
+ self.assertTrue(start == 0)
+ self.assertTrue(end == 0)
+ self.assertTrue(style == value)
+
+ def test_zero(self):
+ runs = runlist.RunList(0, 'x')
+ it = iter(runs)
+
+ start, end, s = next(it)
+ self.assertTrue(start == 0)
+ self.assertTrue(end == 0)
+ self.assertTrue(s == 'x')
+
+ with self.assertRaises(StopIteration):
+ next(it)
+ self.check_optimal(runs)
+
+ def test_initial(self):
+ runs = runlist.RunList(10, 'x')
+ it = iter(runs)
+
+ start, end, s = next(it)
+ self.assertTrue(start == 0)
+ self.assertTrue(end == 10)
+ self.assertTrue(s == 'x')
+
+ with self.assertRaises(StopIteration):
+ next(it)
+
+ self.check_value(runs, 'x' * 10)
+
+ def test_set1(self):
+ runs = runlist.RunList(10, 'a')
+ runs.set_run(2, 8, 'b')
+ self.check_value(runs, 'aabbbbbbaa')
+
+ def test_set1_start(self):
+ runs = runlist.RunList(10, 'a')
+ runs.set_run(0, 5, 'b')
+ self.check_value(runs, 'bbbbbaaaaa')
+
+ def test_set1_end(self):
+ runs = runlist.RunList(10, 'a')
+ runs.set_run(5, 10, 'b')
+ self.check_value(runs, 'aaaaabbbbb')
+
+ def test_set1_all(self):
+ runs = runlist.RunList(10, 'a')
+ runs.set_run(0, 10, 'b')
+ self.check_value(runs, 'bbbbbbbbbb')
+
+ def test_set1_1(self):
+ runs = runlist.RunList(10, 'a')
+ runs.set_run(1, 2, 'b')
+ self.check_value(runs, 'abaaaaaaaa')
+
+ def test_set_overlapped(self):
+ runs = runlist.RunList(10, 'a')
+ runs.set_run(0, 5, 'b')
+ self.check_value(runs, 'bbbbbaaaaa')
+ runs.set_run(5, 10, 'c')
+ self.check_value(runs, 'bbbbbccccc')
+ runs.set_run(3, 7, 'd')
+ self.check_value(runs, 'bbbddddccc')
+ runs.set_run(4, 6, 'e')
+ self.check_value(runs, 'bbbdeedccc')
+ runs.set_run(5, 9, 'f')
+ self.check_value(runs, 'bbbdeffffc')
+ runs.set_run(2, 3, 'g')
+ self.check_value(runs, 'bbgdeffffc')
+ runs.set_run(1, 3, 'h')
+ self.check_value(runs, 'bhhdeffffc')
+ runs.set_run(1, 9, 'i')
+ self.check_value(runs, 'biiiiiiiic')
+ runs.set_run(0, 10, 'j')
+ self.check_value(runs, 'jjjjjjjjjj')
+
+ def test_insert_empty(self):
+ runs = runlist.RunList(0, 'a')
+ runs.insert(0, 10)
+ self.check_value(runs, 'aaaaaaaaaa')
+
+ def test_insert_beginning(self):
+ runs = runlist.RunList(5, 'a')
+ runs.set_run(1, 4, 'b')
+ self.check_value(runs, 'abbba')
+ runs.insert(0, 3)
+ self.check_value(runs, 'aaaabbba')
+
+ def test_insert_beginning_1(self):
+ runs = runlist.RunList(5, 'a')
+ self.check_value(runs, 'aaaaa')
+ runs.insert(0, 1)
+ runs.set_run(0, 1, 'a')
+ self.check_value(runs, 'aaaaaa')
+ runs.insert(0, 1)
+ runs.set_run(0, 1, 'a')
+ self.check_value(runs, 'aaaaaaa')
+ runs.insert(0, 1)
+ runs.set_run(0, 1, 'a')
+ self.check_value(runs, 'aaaaaaaa')
+
+ def test_insert_beginning_2(self):
+ runs = runlist.RunList(5, 'a')
+ self.check_value(runs, 'aaaaa')
+ runs.insert(0, 1)
+ runs.set_run(0, 1, 'b')
+ self.check_value(runs, 'baaaaa')
+ runs.insert(0, 1)
+ runs.set_run(0, 1, 'c')
+ self.check_value(runs, 'cbaaaaa')
+ runs.insert(0, 1)
+ runs.set_run(0, 1, 'c')
+ self.check_value(runs, 'ccbaaaaa')
+
+ def test_insert_1(self):
+ runs = runlist.RunList(5, 'a')
+ runs.set_run(1, 4, 'b')
+ self.check_value(runs, 'abbba')
+ runs.insert(1, 3)
+ self.check_value(runs, 'aaaabbba')
+
+ def test_insert_2(self):
+ runs = runlist.RunList(5, 'a')
+ runs.set_run(1, 2, 'b')
+ self.check_value(runs, 'abaaa')
+ runs.insert(2, 3)
+ self.check_value(runs, 'abbbbaaa')
+
+ def test_insert_end(self):
+ runs = runlist.RunList(5, 'a')
+ runs.set_run(4, 5, 'b')
+ self.check_value(runs, 'aaaab')
+ runs.insert(5, 3)
+ self.check_value(runs, 'aaaabbbb')
+
+ def test_insert_almost_end(self):
+ runs = runlist.RunList(5, 'a')
+ runs.set_run(0, 3, 'b')
+ runs.set_run(4, 5, 'c')
+ self.check_value(runs, 'bbbac')
+ runs.insert(4, 3)
+ self.check_value(runs, 'bbbaaaac')
+
+ def test_delete_1_beginning(self):
+ runs = runlist.RunList(5, 'a')
+ self.check_value(runs, 'aaaaa')
+ runs.delete(0, 3)
+ self.check_value(runs, 'aa')
+
+ def test_delete_1_middle(self):
+ runs = runlist.RunList(5, 'a')
+ self.check_value(runs, 'aaaaa')
+ runs.delete(1, 4)
+ self.check_value(runs, 'aa')
+
+ def test_delete_1_end(self):
+ runs = runlist.RunList(5, 'a')
+ self.check_value(runs, 'aaaaa')
+ runs.delete(2, 5)
+ self.check_value(runs, 'aa')
+
+ def test_delete_1_all(self):
+ runs = runlist.RunList(5, 'a')
+ self.check_value(runs, 'aaaaa')
+ runs.delete(0, 5)
+ self.check_value(runs, '')
+ self.check_empty(runs, 'a')
+
+ def create_runs1(self):
+ runs = runlist.RunList(10, 'a')
+ runs.set_run(1, 10, 'b')
+ runs.set_run(2, 10, 'c')
+ runs.set_run(3, 10, 'd')
+ runs.set_run(4, 10, 'e')
+ runs.set_run(5, 10, 'f')
+ runs.set_run(6, 10, 'g')
+ runs.set_run(7, 10, 'h')
+ runs.set_run(8, 10, 'i')
+ runs.set_run(9, 10, 'j')
+ self.check_value(runs, 'abcdefghij')
+ return runs
+
+ def create_runs2(self):
+ runs = runlist.RunList(10, 'a')
+ runs.set_run(4, 7, 'b')
+ runs.set_run(7, 10, 'c')
+ self.check_value(runs, 'aaaabbbccc')
+ return runs
+
+ def test_delete2(self):
+ runs = self.create_runs1()
+ runs.delete(0, 5)
+ self.check_value(runs, 'fghij')
+
+ def test_delete3(self):
+ runs = self.create_runs1()
+ runs.delete(2, 8)
+ self.check_value(runs, 'abij')
+
+ def test_delete4(self):
+ runs = self.create_runs2()
+ runs.delete(0, 5)
+ self.check_value(runs, 'bbccc')
+
+ def test_delete5(self):
+ runs = self.create_runs2()
+ runs.delete(5, 10)
+ self.check_value(runs, 'aaaab')
+
+ def test_delete6(self):
+ runs = self.create_runs2()
+ runs.delete(0, 8)
+ self.check_value(runs, 'cc')
+
+ def test_delete7(self):
+ runs = self.create_runs2()
+ runs.delete(2, 10)
+ self.check_value(runs, 'aa')
+
+ def test_delete8(self):
+ runs = self.create_runs2()
+ runs.delete(3, 8)
+ self.check_value(runs, 'aaacc')
+
+ def test_delete9(self):
+ runs = self.create_runs2()
+ runs.delete(7, 8)
+ self.check_value(runs, 'aaaabbbcc')
+
+ def test_delete10(self):
+ runs = self.create_runs2()
+ runs.delete(8, 9)
+ self.check_value(runs, 'aaaabbbcc')
+
+ def test_delete11(self):
+ runs = self.create_runs2()
+ runs.delete(9, 10)
+ self.check_value(runs, 'aaaabbbcc')
+
+ def test_delete12(self):
+ runs = self.create_runs2()
+ runs.delete(4, 5)
+ self.check_value(runs, 'aaaabbccc')
+
+ def test_delete13(self):
+ runs = self.create_runs2()
+ runs.delete(5, 6)
+ self.check_value(runs, 'aaaabbccc')
+
+ def test_delete14(self):
+ runs = self.create_runs2()
+ runs.delete(6, 7)
+ self.check_value(runs, 'aaaabbccc')
+
+
+class TestIssues(unittest.TestCase):
+
+ def test_issue471(self):
+ doc = pyglet.text.document.FormattedDocument()
+ layout = pyglet.text.layout.IncrementalTextLayout(doc, 100, 100)
+ doc.insert_text(0, "hello", {'bold': True})
+ doc.text = ""
+
+ def test_issue471_comment2(self):
+ doc2 = pyglet.text.decode_attributed('{bold True}a')
+ layout = pyglet.text.layout.IncrementalTextLayout(doc2, 100, 10)
+ layout.document.delete_text(0, len(layout.document.text))
+
+ def test_issue241_comment4a(self):
+ document = pyglet.text.document.FormattedDocument("")
+ layout = pyglet.text.layout.IncrementalTextLayout(document, 50, 50)
+ document.set_style(0, len(document.text), {"font_name": "Arial"})
+
+ def test_issue241_comment4b(self):
+ document = pyglet.text.document.FormattedDocument("test")
+ layout = pyglet.text.layout.IncrementalTextLayout(document, 50, 50)
+ document.set_style(0, len(document.text), {"font_name": "Arial"})
+ document.delete_text(0, len(document.text))
+
+ def test_issue241_comment5(self):
+ document = pyglet.text.document.FormattedDocument('A')
+ document.set_style(0, 1, dict(bold=True))
+ layout = pyglet.text.layout.IncrementalTextLayout(document, 100, 100)
+ document.delete_text(0, 1)
+
+ def test_issue429_comment4a(self):
+ doc = pyglet.text.decode_attributed(
+ '{bold True}Hello{bold False}\n\n\n\n')
+ doc2 = pyglet.text.decode_attributed(
+ '{bold True}Goodbye{bold False}\n\n\n\n')
+ layout = pyglet.text.layout.IncrementalTextLayout(doc, 100, 10)
+ layout.document = doc2
+ layout.document.delete_text(0, len(layout.document.text))
+
+ def test_issue429_comment4b(self):
+ doc2 = pyglet.text.decode_attributed('{bold True}a{bold False}b')
+ layout = pyglet.text.layout.IncrementalTextLayout(doc2, 100, 10)
+ layout.document.delete_text(0, len(layout.document.text))
+
+
+class AttributedTextDecoderTests(unittest.TestCase):
+
+ def testOneNewlineBecomesSpace(self):
+ doc = AttributedTextDecoder().decode('one\ntwo')
+ self.assertEqual('one two', doc.text)
+
+ def testTwoNewlinesBecomesParagraph(self):
+ from pyglet.text.formats.attributed import AttributedTextDecoder
+
+ doc = AttributedTextDecoder().decode('one\n\ntwo')
+ self.assertEqual('one\ntwo', doc.text)
diff --git a/pyglet-1.3.0/pyglet-1.3.0/tools/inspect_font.py b/pyglet-1.3.0/pyglet-1.3.0/tools/inspect_font.py
new file mode 100644
index 0000000..980437f
--- /dev/null
+++ b/pyglet-1.3.0/pyglet-1.3.0/tools/inspect_font.py
@@ -0,0 +1,30 @@
+#!/usr/bin/python
+# $Id:$
+
+'''Display font information.
+
+Usage::
+
+ inspect_font.py [ ...]
+'''
+
+import sys
+from pyglet.font import ttf
+
+def inspect_font(filename):
+ try:
+ info = ttf.TruetypeInfo(filename)
+ print '%s:' % filename,
+ print info.get_name('family'),
+ print 'bold=%r' % info.is_bold(),
+ print 'italic=%r' % info.is_italic(),
+ except:
+ print '''%s could not be identified. It is probably not a TrueType or
+OpenType font. However, pyglet may still be able to load it
+on some platforms.''' % filename
+
+if __name__ == '__main__':
+ if len(sys.argv) < 2:
+ print __doc__
+ for filename in sys.argv[1:]:
+ inspect_font(filename)
diff --git a/scenes/ConfigScreen.py b/scenes/ConfigScreen.py
new file mode 100644
index 0000000..fac58dd
--- /dev/null
+++ b/scenes/ConfigScreen.py
@@ -0,0 +1,111 @@
+#####
+# Config scene
+#####
+
+import logging
+from Remake_1869 import Utils
+from pyglet.window import key
+from pyglet.window import mouse
+
+class ConfigScene:
+ def __init__(self):
+ self.sceneName = "CONFIG"
+ print('Current Scene: {}'.format(self.sceneName))
+ self.isAlive = True
+ self.isInTransfer = False
+ self.targetScene = None
+
+ self.mouse_x = 0
+ self.mouse_y = 0
+
+ self.current_ScenePhase = 1
+
+ def initializeSceneLogic(self,game):
+ game.register_animation(game.d_active_sprites['configSprite'],'FadeIn')
+ game.setStopwatch(game.d_active_sprites['configSprite'],5*60)
+
+ def close(self,game):
+ #ensure everything must be closed or Fade-out is fadeout
+ game.clearStopwatchTask(game.d_active_sprites['blackscreen'])
+ game.register_animation(game.d_active_sprites['blackscreen'],'FadeInSlow')
+ game.setStopwatch(game.d_active_sprites['blackscreen'],5*60)
+
+ def on_mouse_motion(self, game, x, y, dx, dy):
+ self.mouse_x = x
+ self.mouse_y = y
+
+ def on_mouse_press(self,game, x, y, button, modifiers):
+ if button == 1: # Left click
+ pass
+
+ def on_key_press(self, game, symbol, modifiers):
+ pass
+
+ def prepareSprites(self, game, d_sprites):
+ d_sprites['configSprite'].opacity = 0
+ d_sprites['blackscreen'].opacity = 0
+ self.initializeSceneLogic(game)
+
+ def killSprites(self,game, d_sprites):
+ pass
+
+ def prepareLabels(self, game, d_labels):
+ pass
+
+ def killLabels(self, game, d_labels):
+ pass
+
+ def prepareWidgets(self, game, d_widgets):
+ d_widgets['mainInput'].set_opacity(0)
+
+ def killWidgets(self, game ,d_widgets):
+ pass
+
+ def maintain_SpriteAnimations(self, l_deactivateAnims, sprite, animationType):
+ if animationType is 'FadeIn':
+ if Utils.fadeIn_sprite(sprite,sprite.opacity,5) is False:
+ l_deactivateAnims.append(sprite)
+ if animationType is 'FadeInSlow':
+ if Utils.fadeIn_sprite(sprite,sprite.opacity,2) is False:
+ l_deactivateAnims.append(sprite)
+ if animationType is 'FadeOut':
+ if Utils.fadeOut_sprite(sprite,sprite.opacity,5) is False:
+ l_deactivateAnims.append(sprite)
+
+ def maintain_LabelAnimations(self, l_deactivateAnims, label, animationType):
+ if animationType is 'ToggleAlpha':
+ Utils.toggle_label(label, label.color)
+ l_deactivateAnims.append(label)
+ if animationType is 'FadeIn':
+ if Utils.fadeIn_label(label,label.color,5) is False:
+ l_deactivateAnims.append(label)
+
+ def maintain_WidgetAnimations(self, l_deactivateAnims, widget, animationType):
+ if animationType is 'FadeIn':
+ if Utils.fadeIn_widget(widget,widget.get_opacity(),5) is False:
+ l_deactivateAnims.append(widget)
+ if animationType is 'FadeOut':
+ if Utils.fadeOut_widget(widget,widget.get_opacity(),5) is False:
+ l_deactivateAnims.append(widget)
+
+ def doSceneLogic(self, game):
+ if self.current_ScenePhase == 1:
+ if game.checkStopwatch(game.d_active_sprites['configSprite'],0):
+
+ self.current_ScenePhase = 2
+ if self.current_ScenePhase == 2:
+ if game.checkStopwatch(game.d_active_widgets['mainInput'],0):
+ game.register_animation(game.d_active_widgets['mainInput'],'FadeIn')
+ game.setStopwatch(game.d_active_widgets['mainInput'],1*15)
+ self.current_ScenePhase = 3
+ if self.current_ScenePhase == 3:
+ pass
+
+ def run(self, game):
+ game.stopwatch_tick()
+ self.doSceneLogic(game)
+ if self.isInTransfer is True:
+ if game.checkStopwatch(game.d_active_sprites['blackscreen'],0):
+ self.isAlive = False
+ self.targetScene = 'NextScene'
+ return self.targetScene
diff --git a/scenes/IntroScreen.py b/scenes/IntroScreen.py
new file mode 100644
index 0000000..87e5989
--- /dev/null
+++ b/scenes/IntroScreen.py
@@ -0,0 +1,190 @@
+#####
+# Intro scene
+#####
+
+import logging
+from Remake_1869 import Utils
+from pyglet.window import key
+from pyglet.window import mouse
+
+class IntroScene:
+ def __init__(self):
+ self.sceneName = "INTRO"
+ print('Current Scene: {}'.format(self.sceneName))
+ self.isAlive = True
+ self.isInTransfer = False
+ self.introSkipped = False
+ self.targetScene = None
+
+ self.mouse_x = 0
+ self.mouse_y = 0
+
+ self.current_ScenePhase = 1
+
+ self.remaining_fading_toggle_alpha = 255
+
+ def close(self,game):
+ #ensure everything must be closed or Fade-out is fadeout
+ game.clearStopwatchTask(game.d_active_sprites['blackscreen'])
+ game.register_animation(game.d_active_sprites['blackscreen'],'FadeInSlow')
+ game.setStopwatch(game.d_active_sprites['blackscreen'],5*60)
+ game.register_animation(game.d_active_labels['press_enter'],'FadingToggleAlpha')
+ game.setStopwatch(game.d_active_labels['press_enter'],10)
+ self.current_ScenePhase = 10
+
+ def on_mouse_motion(self, game, x, y, dx, dy):
+ self.mouse_x = x
+ self.mouse_y = y
+
+ def on_mouse_press(self, game, x, y, button, modifiers):
+ if button == 1: # Left click
+ pass
+
+ def on_key_press(self, game, symbol, modifiers):
+ if self.current_ScenePhase < 8:
+ for sprite in game.d_active_sprites:
+ game.d_active_sprites[sprite].opacity = 0
+ game.clear_animationLists()
+ self.current_ScenePhase = 8
+ self.introSkipped = True
+ else:
+ if symbol == key.ENTER:
+ self.isInTransfer = True
+ self.targetScene = 'CONFIG'
+ self.close(game)
+
+ def initializeSceneLogic(self,game):
+ game.register_animation(game.d_active_sprites['max_design_intro_sprite'],'FadeIn')
+ game.setStopwatch(game.d_active_sprites['max_design_intro_sprite'],5*60)
+
+ def prepareSprites(self, game, d_sprites):
+ d_sprites['max_design_intro_sprite'].opacity = 0
+ d_sprites['artwork_intro_sprite'].opacity = 0
+ d_sprites['programmers_intro_sprite'].opacity = 0
+ d_sprites['music_intro_sprite'].opacity = 0
+ d_sprites['title_intro_sprite'].opacity = 0
+ d_sprites['blackscreen'].opacity = 0
+ self.initializeSceneLogic(game)
+
+ def killSprites(self,game, d_sprites):
+ d_sprites['max_design_intro_sprite'].batch = None
+ d_sprites['artwork_intro_sprite'].batch = None
+ d_sprites['programmers_intro_sprite'].batch = None
+ d_sprites['music_intro_sprite'].batch = None
+ d_sprites['title_intro_sprite'].batch = None
+ d_sprites['blackscreen'].batch = None
+
+ def prepareLabels(self, game, d_labels):
+ d_labels['press_enter'].color = (255,255,255,0)
+
+ def killLabels(self, game ,d_labels):
+ d_labels['press_enter'].batch = None
+
+ def prepareWidgets(self, game, d_widgets):
+ pass
+
+ def killWidgets(self, game ,d_widgets):
+ pass
+
+ def maintain_SpriteAnimations(self, l_deactivateAnims, sprite, animationType):
+ if animationType is 'FadeIn':
+ if Utils.fadeIn_sprite(sprite,sprite.opacity,5) is False:
+ l_deactivateAnims.append(sprite)
+ if animationType is 'FadeInSlow':
+ if Utils.fadeIn_sprite(sprite,sprite.opacity,2) is False:
+ l_deactivateAnims.append(sprite)
+ if animationType is 'FadeOut':
+ if Utils.fadeOut_sprite(sprite,sprite.opacity,5) is False:
+ l_deactivateAnims.append(sprite)
+
+ def maintain_LabelAnimations(self, l_deactivateAnims, label, animationType):
+ if animationType is 'ToggleAlpha':
+ Utils.toggle_label(label, label.color)
+ l_deactivateAnims.append(label)
+ if animationType is 'FadingToggleAlpha':
+ if self.remaining_fading_toggle_alpha > 0:
+ self.remaining_fading_toggle_alpha -= 16
+ else:
+ self.remaining_fading_toggle_alpha = 0
+ Utils.fading_toggle_label(label, label.color, self.remaining_fading_toggle_alpha)
+ l_deactivateAnims.append(label)
+ if animationType is 'FadeIn':
+ if Utils.fadeIn_label(label,label.color,5) is False:
+ l_deactivateAnims.append(label)
+
+ def maintain_WidgetAnimation(self, l_deactivateAnims, widget, animationType):
+ pass
+
+ def doSceneLogic(self,game):
+ if self.current_ScenePhase == 1:
+ if game.checkStopwatch(game.d_active_sprites['max_design_intro_sprite'],0):
+ game.clearStopwatchTask(game.d_active_sprites['max_design_intro_sprite'])
+ game.register_animation(game.d_active_sprites['max_design_intro_sprite'],'FadeOut')
+ game.setStopwatch(game.d_active_sprites['max_design_intro_sprite'],3*60)
+ self.current_ScenePhase = 2
+ if self.current_ScenePhase == 2:
+ if game.checkStopwatch(game.d_active_sprites['max_design_intro_sprite'],0):
+ game.clearStopwatchTask(game.d_active_sprites['max_design_intro_sprite'])
+ game.register_animation(game.d_active_sprites['artwork_intro_sprite'],'FadeIn')
+ game.setStopwatch(game.d_active_sprites['artwork_intro_sprite'],10*60)
+ self.current_ScenePhase = 3
+ if self.current_ScenePhase == 3:
+ if game.checkStopwatch(game.d_active_sprites['artwork_intro_sprite'],0):
+ game.clearStopwatchTask(game.d_active_sprites['artwork_intro_sprite'])
+ game.register_animation(game.d_active_sprites['artwork_intro_sprite'],'FadeOut')
+ game.setStopwatch(game.d_active_sprites['artwork_intro_sprite'],3*60)
+ self.current_ScenePhase = 4
+ if self.current_ScenePhase == 4:
+ if game.checkStopwatch(game.d_active_sprites['artwork_intro_sprite'],0):
+ game.clearStopwatchTask(game.d_active_sprites['artwork_intro_sprite'])
+ game.register_animation(game.d_active_sprites['programmers_intro_sprite'],'FadeIn')
+ game.setStopwatch(game.d_active_sprites['programmers_intro_sprite'],10*60)
+ self.current_ScenePhase = 5
+ if self.current_ScenePhase == 5:
+ if game.checkStopwatch(game.d_active_sprites['programmers_intro_sprite'],0):
+ game.clearStopwatchTask(game.d_active_sprites['programmers_intro_sprite'])
+ game.register_animation(game.d_active_sprites['programmers_intro_sprite'],'FadeOut')
+ game.setStopwatch(game.d_active_sprites['programmers_intro_sprite'],3*60)
+ self.current_ScenePhase = 6
+ if self.current_ScenePhase == 6:
+ if game.checkStopwatch(game.d_active_sprites['programmers_intro_sprite'],0):
+ game.clearStopwatchTask(game.d_active_sprites['programmers_intro_sprite'])
+ game.register_animation(game.d_active_sprites['music_intro_sprite'],'FadeIn')
+ game.setStopwatch(game.d_active_sprites['music_intro_sprite'],10*60)
+ self.current_ScenePhase = 7
+ if self.current_ScenePhase == 7:
+ if game.checkStopwatch(game.d_active_sprites['music_intro_sprite'],0):
+ game.clearStopwatchTask(game.d_active_sprites['music_intro_sprite'])
+ game.register_animation(game.d_active_sprites['music_intro_sprite'],'FadeOut')
+ game.setStopwatch(game.d_active_sprites['music_intro_sprite'],3*60)
+ self.current_ScenePhase = 8
+ if self.current_ScenePhase == 8:
+ if game.checkStopwatch(game.d_active_sprites['music_intro_sprite'],0) or self.introSkipped:
+ game.clearStopwatchTask(game.d_active_sprites['music_intro_sprite'])
+ game.register_animation(game.d_active_sprites['title_intro_sprite'],'FadeIn')
+ game.setStopwatch(game.d_active_sprites['title_intro_sprite'],5*60)
+ self.current_ScenePhase = 9
+ if self.current_ScenePhase == 9:
+ if game.checkStopwatch(game.d_active_sprites['title_intro_sprite'],0):
+ game.clearStopwatchTask(game.d_active_sprites['title_intro_sprite'])
+ game.register_animation(game.d_active_labels['press_enter'],'FadeIn')
+ game.setStopwatch(game.d_active_labels['press_enter'],3*60)
+ self.current_ScenePhase = 10
+ if self.current_ScenePhase == 10:
+ if game.checkStopwatch(game.d_active_labels['press_enter'],0):
+ game.clearStopwatchTask(game.d_active_labels['press_enter'])
+ if self.isInTransfer is True:
+ game.register_animation(game.d_active_labels['press_enter'],'FadingToggleAlpha')
+ game.setStopwatch(game.d_active_labels['press_enter'],10)
+ else:
+ game.register_animation(game.d_active_labels['press_enter'],'ToggleAlpha')
+ game.setStopwatch(game.d_active_labels['press_enter'],30)
+
+ def run(self, game):
+ game.stopwatch_tick()
+ self.doSceneLogic(game)
+ if self.isInTransfer is True:
+ if game.checkStopwatch(game.d_active_sprites['blackscreen'],0):
+ self.isAlive = False
+ self.targetScene = 'CONFIG'
+ return self.targetScene
diff --git a/scenes/TemplateScene.py b/scenes/TemplateScene.py
new file mode 100644
index 0000000..a7d69ac
--- /dev/null
+++ b/scenes/TemplateScene.py
@@ -0,0 +1,83 @@
+#####
+# Template scene
+#####
+
+import logging
+from Remake_1869 import Utils
+from pyglet.window import key
+from pyglet.window import mouse
+
+class TemplateScene:
+ def __init__(self):
+ print('Current Scene: Template\n')
+ self.isAlive = True
+ self.isInTransfer = False
+ self.targetScene = None
+
+ self.mouse_x = 0
+ self.mouse_y = 0
+
+ self.current_ScenePhase = 1
+
+ def close(self,game):
+ #ensure everything must be closed or Fade-out is fadeout
+ self.isInTransfer = True
+ game.register_animation(game.d_active_sprites['blackscreen'],'FadeInSlow')
+ self.setStopwatch(game.d_active_sprites['blackscreen'],5*60)
+
+ def initializeSceneLogic(self,game):
+ pass
+
+ def on_mouse_motion(self, game, x, y, dx, dy):
+ self.mouse_x = x
+ self.mouse_y = y
+
+ def on_mouse_press(self,game, x, y, button, modifiers):
+ if button == 1: # Left click
+ pass
+
+ def on_key_press(self, game, symbol, modifiers):
+ pass
+
+ def prepareSprites(self, game, d_prites):
+ pass
+
+ def prepareLabels(self, game, d_labels):
+ pass
+
+ def prepareWidgets(self, game, d_widgets):
+ pass
+
+ def killWidgets(self, game ,d_widgets):
+ pass
+
+ def maintain_SpriteAnimations(self, l_deactivateAnims, sprite, animationType):
+ if animationType is 'FadeIn':
+ if Utils.fadeIn_sprite(sprite,sprite.opacity,5) is False:
+ l_deactivateAnims.append(sprite)
+ if animationType is 'FadeInSlow':
+ if Utils.fadeIn_sprite(sprite,sprite.opacity,2) is False:
+ l_deactivateAnims.append(sprite)
+ if animationType is 'FadeOut':
+ if Utils.fadeOut_sprite(sprite,sprite.opacity,5) is False:
+ l_deactivateAnims.append(sprite)
+
+ def maintain_LabelAnimations(self, l_deactivateAnims, label, animationType):
+ if animationType is 'ToggleAlpha':
+ Utils.toggle_label(label, label.color)
+ l_deactivateAnims.append(label)
+ if animationType is 'FadeIn':
+ if Utils.fadeIn_label(label,label.color,5) is False:
+ l_deactivateAnims.append(label)
+
+ def doSceneLogic(self, game):
+ pass
+
+ def run(self, game):
+ game.stopwatch_tick()
+ self.doSceneLogic(game)
+ if self.isInTransfer is True:
+ if game.checkStopwatch(game.d_active_sprites['blackscreen'],0):
+ self.isAlive = False
+ self.targetScene = 'NEXTSCENE'
+ return self.targetScene
diff --git a/scenes/__pycache__/ConfigScreen.cpython-35.pyc b/scenes/__pycache__/ConfigScreen.cpython-35.pyc
new file mode 100644
index 0000000..d872662
Binary files /dev/null and b/scenes/__pycache__/ConfigScreen.cpython-35.pyc differ
diff --git a/scenes/__pycache__/Intro.cpython-35.pyc b/scenes/__pycache__/Intro.cpython-35.pyc
new file mode 100644
index 0000000..4728664
Binary files /dev/null and b/scenes/__pycache__/Intro.cpython-35.pyc differ
diff --git a/scenes/__pycache__/IntroScreen.cpython-35.pyc b/scenes/__pycache__/IntroScreen.cpython-35.pyc
new file mode 100644
index 0000000..db487df
Binary files /dev/null and b/scenes/__pycache__/IntroScreen.cpython-35.pyc differ