[pypy-svn] r54858 - pypy/dist/pypy/rlib/rsdl

arigo at codespeak.net arigo at codespeak.net
Sat May 17 18:14:11 CEST 2008


Author: arigo
Date: Sat May 17 18:14:10 2008
New Revision: 54858

Added:
   pypy/dist/pypy/rlib/rsdl/constants.py   (contents, props changed)
Modified:
   pypy/dist/pypy/rlib/rsdl/RSDL.py
Log:
Export all the constants from SDL (at least, this list contains all the
ones that Pygame exports to applications).


Modified: pypy/dist/pypy/rlib/rsdl/RSDL.py
==============================================================================
--- pypy/dist/pypy/rlib/rsdl/RSDL.py	(original)
+++ pypy/dist/pypy/rlib/rsdl/RSDL.py	Sat May 17 18:14:10 2008
@@ -1,6 +1,7 @@
 from pypy.rpython.lltypesystem import lltype, rffi
 from pypy.rpython.tool import rffi_platform as platform
 from pypy.translator.tool.cbuild import ExternalCompilationInfo
+from pypy.rlib.rsdl.constants import _constants
 import sys
 
 if sys.platform == 'darwin':
@@ -33,10 +34,6 @@
     Uint16 = platform.SimpleType('Uint16', rffi.INT)
     Uint32 = platform.SimpleType('Uint32', rffi.INT)
 
-    BYTEORDER = platform.ConstantInteger('SDL_BYTEORDER')
-    BIG_ENDIAN = platform.ConstantInteger('SDL_BIG_ENDIAN')
-    INIT_VIDEO = platform.ConstantInteger('SDL_INIT_VIDEO')
-
     Rect = platform.Struct('SDL_Rect', [('x', rffi.INT),
                                         ('y', rffi.INT),
                                         ('w', rffi.INT),
@@ -49,6 +46,10 @@
     PixelFormat = platform.Struct('SDL_PixelFormat',
                                   [('BytesPerPixel', rffi.INT)])
 
+for _prefix, _list in _constants.items():
+    for _name in _list:
+        setattr(CConfig, _name, platform.ConstantInteger(_prefix+_name))
+
 globals().update(platform.configure(CConfig))
 
 RectPtr.TO.become(Rect)

Added: pypy/dist/pypy/rlib/rsdl/constants.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/rlib/rsdl/constants.py	Sat May 17 18:14:10 2008
@@ -0,0 +1,253 @@
+
+_constants = {
+    'SDL_': [      # constants with the 'SDL_' prefix in C
+        "YV12_OVERLAY",
+        "IYUV_OVERLAY",
+        "YUY2_OVERLAY",
+        "UYVY_OVERLAY",
+        "YVYU_OVERLAY",
+
+        "SWSURFACE",
+        "HWSURFACE",
+        "RESIZABLE",
+        "ASYNCBLIT",
+        "OPENGL",
+        "OPENGLBLIT",
+        "ANYFORMAT",
+        "HWPALETTE",
+        "DOUBLEBUF",
+        "FULLSCREEN",
+        "HWACCEL",
+        "SRCCOLORKEY",
+        "RLEACCELOK",
+        "RLEACCEL",
+        "SRCALPHA",
+        "PREALLOC",
+        "NOFRAME",
+
+        "GL_RED_SIZE",
+        "GL_GREEN_SIZE",
+        "GL_BLUE_SIZE",
+        "GL_ALPHA_SIZE",
+        "GL_BUFFER_SIZE",
+        "GL_DOUBLEBUFFER",
+        "GL_DEPTH_SIZE",
+        "GL_STENCIL_SIZE",
+        "GL_ACCUM_RED_SIZE",
+        "GL_ACCUM_GREEN_SIZE",
+        "GL_ACCUM_BLUE_SIZE",
+        "GL_ACCUM_ALPHA_SIZE",
+        "GL_STEREO",              #if SDL_VERSION_ATLEAST(1, 2, 5)
+        "GL_MULTISAMPLEBUFFERS",  #if SDL_VERSION_ATLEAST(1, 2, 6)
+        "GL_MULTISAMPLESAMPLES",  #if SDL_VERSION_ATLEAST(1, 2, 6)
+
+        "NOEVENT",
+        "ACTIVEEVENT",
+        "KEYDOWN",
+        "KEYUP",
+        "MOUSEMOTION",
+        "MOUSEBUTTONDOWN",
+        "MOUSEBUTTONUP",
+        "JOYAXISMOTION",
+        "JOYBALLMOTION",
+        "JOYHATMOTION",
+        "JOYBUTTONDOWN",
+        "JOYBUTTONUP",
+        "VIDEORESIZE",
+        "VIDEOEXPOSE",
+        "QUIT",
+        "SYSWMEVENT",
+        "USEREVENT",
+        "NUMEVENTS",
+
+        "HAT_CENTERED",
+        "HAT_UP",
+        "HAT_RIGHTUP",
+        "HAT_RIGHT",
+        "HAT_RIGHTDOWN",
+        "HAT_DOWN",
+        "HAT_LEFTDOWN",
+        "HAT_LEFT",
+        "HAT_LEFTUP",
+
+        # the following ones are not exposed in Pygame
+        "INIT_VIDEO",
+        "BYTEORDER",
+        "BIG_ENDIAN",
+        "LIL_ENDIAN",
+        ],
+
+    '': [      # constants with no prefix in C
+        "TIMER_RESOLUTION",
+	"AUDIO_U8",
+	"AUDIO_S8",
+	"AUDIO_U16LSB",
+	"AUDIO_S16LSB",
+	"AUDIO_U16MSB",
+	"AUDIO_S16MSB",
+	"AUDIO_U16",
+	"AUDIO_S16",
+	"AUDIO_U16SYS",
+	"AUDIO_S16SYS",
+
+	"KMOD_NONE",
+	"KMOD_LSHIFT",
+	"KMOD_RSHIFT",
+	"KMOD_LCTRL",
+	"KMOD_RCTRL",
+	"KMOD_LALT",
+	"KMOD_RALT",
+	"KMOD_LMETA",
+	"KMOD_RMETA",
+	"KMOD_NUM",
+	"KMOD_CAPS",
+	"KMOD_MODE",
+
+	"KMOD_CTRL",
+	"KMOD_SHIFT",
+	"KMOD_ALT",
+	"KMOD_META",
+        ],
+
+    'SDL': [      # constants with the 'SDL' prefix in C
+        "K_UNKNOWN",
+	"K_FIRST",
+	"K_BACKSPACE",
+	"K_TAB",
+	"K_CLEAR",
+	"K_RETURN",
+	"K_PAUSE",
+	"K_ESCAPE",
+	"K_SPACE",
+	"K_EXCLAIM",
+	"K_QUOTEDBL",
+	"K_HASH",
+	"K_DOLLAR",
+	"K_AMPERSAND",
+	"K_QUOTE",
+	"K_LEFTPAREN",
+	"K_RIGHTPAREN",
+	"K_ASTERISK",
+	"K_PLUS",
+	"K_COMMA",
+	"K_MINUS",
+	"K_PERIOD",
+	"K_SLASH",
+	"K_0",
+	"K_1",
+	"K_2",
+	"K_3",
+	"K_4",
+	"K_5",
+	"K_6",
+	"K_7",
+	"K_8",
+	"K_9",
+	"K_COLON",
+	"K_SEMICOLON",
+	"K_LESS",
+	"K_EQUALS",
+	"K_GREATER",
+	"K_QUESTION",
+	"K_AT",
+	"K_LEFTBRACKET",
+	"K_BACKSLASH",
+	"K_RIGHTBRACKET",
+	"K_CARET",
+	"K_UNDERSCORE",
+	"K_BACKQUOTE",
+	"K_a",
+	"K_b",
+	"K_c",
+	"K_d",
+	"K_e",
+	"K_f",
+	"K_g",
+	"K_h",
+	"K_i",
+	"K_j",
+	"K_k",
+	"K_l",
+	"K_m",
+	"K_n",
+	"K_o",
+	"K_p",
+	"K_q",
+	"K_r",
+	"K_s",
+	"K_t",
+	"K_u",
+	"K_v",
+	"K_w",
+	"K_x",
+	"K_y",
+	"K_z",
+	"K_DELETE",
+
+	"K_KP0",
+	"K_KP1",
+	"K_KP2",
+	"K_KP3",
+	"K_KP4",
+	"K_KP5",
+	"K_KP6",
+	"K_KP7",
+	"K_KP8",
+	"K_KP9",
+	"K_KP_PERIOD",
+	"K_KP_DIVIDE",
+	"K_KP_MULTIPLY",
+	"K_KP_MINUS",
+	"K_KP_PLUS",
+	"K_KP_ENTER",
+	"K_KP_EQUALS",
+	"K_UP",
+	"K_DOWN",
+	"K_RIGHT",
+	"K_LEFT",
+	"K_INSERT",
+	"K_HOME",
+	"K_END",
+	"K_PAGEUP",
+	"K_PAGEDOWN",
+	"K_F1",
+	"K_F2",
+	"K_F3",
+	"K_F4",
+	"K_F5",
+	"K_F6",
+	"K_F7",
+	"K_F8",
+	"K_F9",
+	"K_F10",
+	"K_F11",
+	"K_F12",
+	"K_F13",
+	"K_F14",
+	"K_F15",
+
+	"K_NUMLOCK",
+	"K_CAPSLOCK",
+	"K_SCROLLOCK",
+	"K_RSHIFT",
+	"K_LSHIFT",
+	"K_RCTRL",
+	"K_LCTRL",
+	"K_RALT",
+	"K_LALT",
+	"K_RMETA",
+	"K_LMETA",
+	"K_LSUPER",
+	"K_RSUPER",
+	"K_MODE",
+
+	"K_HELP",
+	"K_PRINT",
+	"K_SYSREQ",
+	"K_BREAK",
+	"K_MENU",
+	"K_POWER",
+	"K_EURO",
+	"K_LAST",
+        ],
+    }



More information about the Pypy-commit mailing list