Hi again, here is a patch that adds all SDLK_xxxx values. The values are added to "sdl_keysyms", which is just an alias at the moment. The constants hash is know also stored as a global and is created only once.
jens
diff -u -w -r1.1 sdl_constants.imc --- library/sdl_constants.imc 10 Feb 2004 04:58:19 -0000 1.1 +++ library/sdl_constants.imc 12 Feb 2004 13:53:42 -0000 @@ -37,7 +37,14 @@ .param string name .local pmc constants + .local int type + + errorsoff 1 + constants = global "SDL::_constants" + typeof type, constants + if type == .PerlHash goto END new constants, .PerlHash + global "SDL::_constants" = constants # event types -- should be in sdl_contants_events set constants['SDL_KEYDOWN'], 2 @@ -45,13 +52,243 @@ set constants['SDL_QUIT'], 12 # key symbols -- should be in sdl_constants_keys (or keysyms?) - set constants['SDLK_ESCAPE'], 27 - set constants['SDLK_LEFT'], 32 - set constants['SDLK_UP'], 273 - set constants['SDLK_DOWN'], 274 - set constants['SDLK_RIGHT'] , 275 - set constants['SDLK_LEFT'], 276 - + .local pmc sdl_keysyms + sdl_keysyms = constants + set sdl_keysyms["SDLK_UNKNOWN"], 0 + set sdl_keysyms["SDLK_FIRST"], 0 + set sdl_keysyms["SDLK_BACKSPACE"], 8 + set sdl_keysyms["SDLK_TAB"], 9 + set sdl_keysyms["SDLK_CLEAR"], 12 + set sdl_keysyms["SDLK_RETURN"], 13 + set sdl_keysyms["SDLK_PAUSE"], 19 + set sdl_keysyms["SDLK_ESCAPE"], 27 + set sdl_keysyms["SDLK_SPACE"], 32 + set sdl_keysyms["SDLK_EXCLAIM"], 33 + set sdl_keysyms["SDLK_QUOTEDBL"], 34 + set sdl_keysyms["SDLK_HASH"], 35 + set sdl_keysyms["SDLK_DOLLAR"], 36 + set sdl_keysyms["SDLK_AMPERSAND"], 38 + set sdl_keysyms["SDLK_QUOTE"], 39 + set sdl_keysyms["SDLK_LEFTPAREN"], 40 + set sdl_keysyms["SDLK_RIGHTPAREN"], 41 + set sdl_keysyms["SDLK_ASTERISK"], 42 + set sdl_keysyms["SDLK_PLUS"], 43 + set sdl_keysyms["SDLK_COMMA"], 44 + set sdl_keysyms["SDLK_MINUS"], 45 + set sdl_keysyms["SDLK_PERIOD"], 46 + set sdl_keysyms["SDLK_SLASH"], 47 + set sdl_keysyms["SDLK_0"], 48 + set sdl_keysyms["SDLK_1"], 49 + set sdl_keysyms["SDLK_2"], 50 + set sdl_keysyms["SDLK_3"], 51 + set sdl_keysyms["SDLK_4"], 52 + set sdl_keysyms["SDLK_5"], 53 + set sdl_keysyms["SDLK_6"], 54 + set sdl_keysyms["SDLK_7"], 55 + set sdl_keysyms["SDLK_8"], 56 + set sdl_keysyms["SDLK_9"], 57 + set sdl_keysyms["SDLK_COLON"], 58 + set sdl_keysyms["SDLK_SEMICOLON"], 59 + set sdl_keysyms["SDLK_LESS"], 60 + set sdl_keysyms["SDLK_EQUALS"], 61 + set sdl_keysyms["SDLK_GREATER"], 62 + set sdl_keysyms["SDLK_QUESTION"], 63 + set sdl_keysyms["SDLK_AT"], 64 + set sdl_keysyms["SDLK_LEFTBRACKET"], 91 + set sdl_keysyms["SDLK_BACKSLASH"], 92 + set sdl_keysyms["SDLK_RIGHTBRACKET"], 93 + set sdl_keysyms["SDLK_CARET"], 94 + set sdl_keysyms["SDLK_UNDERSCORE"], 95 + set sdl_keysyms["SDLK_BACKQUOTE"], 96 + set sdl_keysyms["SDLK_a"], 97 + set sdl_keysyms["SDLK_b"], 98 + set sdl_keysyms["SDLK_c"], 99 + set sdl_keysyms["SDLK_d"], 100 + set sdl_keysyms["SDLK_e"], 101 + set sdl_keysyms["SDLK_f"], 102 + set sdl_keysyms["SDLK_g"], 103 + set sdl_keysyms["SDLK_h"], 104 + set sdl_keysyms["SDLK_i"], 105 + set sdl_keysyms["SDLK_j"], 106 + set sdl_keysyms["SDLK_k"], 107 + set sdl_keysyms["SDLK_l"], 108 + set sdl_keysyms["SDLK_m"], 109 + set sdl_keysyms["SDLK_n"], 110 + set sdl_keysyms["SDLK_o"], 111 + set sdl_keysyms["SDLK_p"], 112 + set sdl_keysyms["SDLK_q"], 113 + set sdl_keysyms["SDLK_r"], 114 + set sdl_keysyms["SDLK_s"], 115 + set sdl_keysyms["SDLK_t"], 116 + set sdl_keysyms["SDLK_u"], 117 + set sdl_keysyms["SDLK_v"], 118 + set sdl_keysyms["SDLK_w"], 119 + set sdl_keysyms["SDLK_x"], 120 + set sdl_keysyms["SDLK_y"], 121 + set sdl_keysyms["SDLK_z"], 122 + set sdl_keysyms["SDLK_DELETE"], 127 + set sdl_keysyms["SDLK_WORLD_0"], 160 + set sdl_keysyms["SDLK_WORLD_1"], 161 + set sdl_keysyms["SDLK_WORLD_2"], 162 + set sdl_keysyms["SDLK_WORLD_3"], 163 + set sdl_keysyms["SDLK_WORLD_4"], 164 + set sdl_keysyms["SDLK_WORLD_5"], 165 + set sdl_keysyms["SDLK_WORLD_6"], 166 + set sdl_keysyms["SDLK_WORLD_7"], 167 + set sdl_keysyms["SDLK_WORLD_8"], 168 + set sdl_keysyms["SDLK_WORLD_9"], 169 + set sdl_keysyms["SDLK_WORLD_10"], 170 + set sdl_keysyms["SDLK_WORLD_11"], 171 + set sdl_keysyms["SDLK_WORLD_12"], 172 + set sdl_keysyms["SDLK_WORLD_13"], 173 + set sdl_keysyms["SDLK_WORLD_14"], 174 + set sdl_keysyms["SDLK_WORLD_15"], 175 + set sdl_keysyms["SDLK_WORLD_16"], 176 + set sdl_keysyms["SDLK_WORLD_17"], 177 + set sdl_keysyms["SDLK_WORLD_18"], 178 + set sdl_keysyms["SDLK_WORLD_19"], 179 + set sdl_keysyms["SDLK_WORLD_20"], 180 + set sdl_keysyms["SDLK_WORLD_21"], 181 + set sdl_keysyms["SDLK_WORLD_22"], 182 + set sdl_keysyms["SDLK_WORLD_23"], 183 + set sdl_keysyms["SDLK_WORLD_24"], 184 + set sdl_keysyms["SDLK_WORLD_25"], 185 + set sdl_keysyms["SDLK_WORLD_26"], 186 + set sdl_keysyms["SDLK_WORLD_27"], 187 + set sdl_keysyms["SDLK_WORLD_28"], 188 + set sdl_keysyms["SDLK_WORLD_29"], 189 + set sdl_keysyms["SDLK_WORLD_30"], 190 + set sdl_keysyms["SDLK_WORLD_31"], 191 + set sdl_keysyms["SDLK_WORLD_32"], 192 + set sdl_keysyms["SDLK_WORLD_33"], 193 + set sdl_keysyms["SDLK_WORLD_34"], 194 + set sdl_keysyms["SDLK_WORLD_35"], 195 + set sdl_keysyms["SDLK_WORLD_36"], 196 + set sdl_keysyms["SDLK_WORLD_37"], 197 + set sdl_keysyms["SDLK_WORLD_38"], 198 + set sdl_keysyms["SDLK_WORLD_39"], 199 + set sdl_keysyms["SDLK_WORLD_40"], 200 + set sdl_keysyms["SDLK_WORLD_41"], 201 + set sdl_keysyms["SDLK_WORLD_42"], 202 + set sdl_keysyms["SDLK_WORLD_43"], 203 + set sdl_keysyms["SDLK_WORLD_44"], 204 + set sdl_keysyms["SDLK_WORLD_45"], 205 + set sdl_keysyms["SDLK_WORLD_46"], 206 + set sdl_keysyms["SDLK_WORLD_47"], 207 + set sdl_keysyms["SDLK_WORLD_48"], 208 + set sdl_keysyms["SDLK_WORLD_49"], 209 + set sdl_keysyms["SDLK_WORLD_50"], 210 + set sdl_keysyms["SDLK_WORLD_51"], 211 + set sdl_keysyms["SDLK_WORLD_52"], 212 + set sdl_keysyms["SDLK_WORLD_53"], 213 + set sdl_keysyms["SDLK_WORLD_54"], 214 + set sdl_keysyms["SDLK_WORLD_55"], 215 + set sdl_keysyms["SDLK_WORLD_56"], 216 + set sdl_keysyms["SDLK_WORLD_57"], 217 + set sdl_keysyms["SDLK_WORLD_58"], 218 + set sdl_keysyms["SDLK_WORLD_59"], 219 + set sdl_keysyms["SDLK_WORLD_60"], 220 + set sdl_keysyms["SDLK_WORLD_61"], 221 + set sdl_keysyms["SDLK_WORLD_62"], 222 + set sdl_keysyms["SDLK_WORLD_63"], 223 + set sdl_keysyms["SDLK_WORLD_64"], 224 + set sdl_keysyms["SDLK_WORLD_65"], 225 + set sdl_keysyms["SDLK_WORLD_66"], 226 + set sdl_keysyms["SDLK_WORLD_67"], 227 + set sdl_keysyms["SDLK_WORLD_68"], 228 + set sdl_keysyms["SDLK_WORLD_69"], 229 + set sdl_keysyms["SDLK_WORLD_70"], 230 + set sdl_keysyms["SDLK_WORLD_71"], 231 + set sdl_keysyms["SDLK_WORLD_72"], 232 + set sdl_keysyms["SDLK_WORLD_73"], 233 + set sdl_keysyms["SDLK_WORLD_74"], 234 + set sdl_keysyms["SDLK_WORLD_75"], 235 + set sdl_keysyms["SDLK_WORLD_76"], 236 + set sdl_keysyms["SDLK_WORLD_77"], 237 + set sdl_keysyms["SDLK_WORLD_78"], 238 + set sdl_keysyms["SDLK_WORLD_79"], 239 + set sdl_keysyms["SDLK_WORLD_80"], 240 + set sdl_keysyms["SDLK_WORLD_81"], 241 + set sdl_keysyms["SDLK_WORLD_82"], 242 + set sdl_keysyms["SDLK_WORLD_83"], 243 + set sdl_keysyms["SDLK_WORLD_84"], 244 + set sdl_keysyms["SDLK_WORLD_85"], 245 + set sdl_keysyms["SDLK_WORLD_86"], 246 + set sdl_keysyms["SDLK_WORLD_87"], 247 + set sdl_keysyms["SDLK_WORLD_88"], 248 + set sdl_keysyms["SDLK_WORLD_89"], 249 + set sdl_keysyms["SDLK_WORLD_90"], 250 + set sdl_keysyms["SDLK_WORLD_91"], 251 + set sdl_keysyms["SDLK_WORLD_92"], 252 + set sdl_keysyms["SDLK_WORLD_93"], 253 + set sdl_keysyms["SDLK_WORLD_94"], 254 + set sdl_keysyms["SDLK_WORLD_95"], 255 + set sdl_keysyms["SDLK_KP0"], 256 + set sdl_keysyms["SDLK_KP1"], 257 + set sdl_keysyms["SDLK_KP2"], 258 + set sdl_keysyms["SDLK_KP3"], 259 + set sdl_keysyms["SDLK_KP4"], 260 + set sdl_keysyms["SDLK_KP5"], 261 + set sdl_keysyms["SDLK_KP6"], 262 + set sdl_keysyms["SDLK_KP7"], 263 + set sdl_keysyms["SDLK_KP8"], 264 + set sdl_keysyms["SDLK_KP9"], 265 + set sdl_keysyms["SDLK_KP_PERIOD"], 266 + set sdl_keysyms["SDLK_KP_DIVIDE"], 267 + set sdl_keysyms["SDLK_KP_MULTIPLY"], 268 + set sdl_keysyms["SDLK_KP_MINUS"], 269 + set sdl_keysyms["SDLK_KP_PLUS"], 270 + set sdl_keysyms["SDLK_KP_ENTER"], 271 + set sdl_keysyms["SDLK_KP_EQUALS"], 272 + set sdl_keysyms["SDLK_UP"], 273 + set sdl_keysyms["SDLK_DOWN"], 274 + set sdl_keysyms["SDLK_RIGHT"], 275 + set sdl_keysyms["SDLK_LEFT"], 276 + set sdl_keysyms["SDLK_INSERT"], 277 + set sdl_keysyms["SDLK_HOME"], 278 + set sdl_keysyms["SDLK_END"], 279 + set sdl_keysyms["SDLK_PAGEUP"], 280 + set sdl_keysyms["SDLK_PAGEDOWN"], 281 + set sdl_keysyms["SDLK_F1"], 282 + set sdl_keysyms["SDLK_F2"], 283 + set sdl_keysyms["SDLK_F3"], 284 + set sdl_keysyms["SDLK_F4"], 285 + set sdl_keysyms["SDLK_F5"], 286 + set sdl_keysyms["SDLK_F6"], 287 + set sdl_keysyms["SDLK_F7"], 288 + set sdl_keysyms["SDLK_F8"], 289 + set sdl_keysyms["SDLK_F9"], 290 + set sdl_keysyms["SDLK_F10"], 291 + set sdl_keysyms["SDLK_F11"], 292 + set sdl_keysyms["SDLK_F12"], 293 + set sdl_keysyms["SDLK_F13"], 294 + set sdl_keysyms["SDLK_F14"], 295 + set sdl_keysyms["SDLK_F15"], 296 + set sdl_keysyms["SDLK_NUMLOCK"], 300 + set sdl_keysyms["SDLK_CAPSLOCK"], 301 + set sdl_keysyms["SDLK_SCROLLOCK"], 302 + set sdl_keysyms["SDLK_RSHIFT"], 303 + set sdl_keysyms["SDLK_LSHIFT"], 304 + set sdl_keysyms["SDLK_RCTRL"], 305 + set sdl_keysyms["SDLK_LCTRL"], 306 + set sdl_keysyms["SDLK_RALT"], 307 + set sdl_keysyms["SDLK_LALT"], 308 + set sdl_keysyms["SDLK_RMETA"], 309 + set sdl_keysyms["SDLK_LMETA"], 310 + set sdl_keysyms["SDLK_LSUPER"], 311 + set sdl_keysyms["SDLK_RSUPER"], 312 + set sdl_keysyms["SDLK_MODE"], 313 + set sdl_keysyms["SDLK_COMPOSE"], 314 + set sdl_keysyms["SDLK_HELP"], 315 + set sdl_keysyms["SDLK_PRINT"], 316 + set sdl_keysyms["SDLK_SYSREQ"], 317 + set sdl_keysyms["SDLK_BREAK"], 318 + set sdl_keysyms["SDLK_MENU"], 319 + set sdl_keysyms["SDLK_POWER"], 320 + set sdl_keysyms["SDLK_EURO"], 321 + set sdl_keysyms["SDLK_UNDO"], 322 + set sdl_keysyms["SDLK_LAST"], 323 +END: .local int value set value, constants[name]