[MLton-commit] r6212

Vesa Karvonen vesak at mlton.org
Tue Nov 27 04:18:31 PST 2007


Minimal support for keyboard events.  (Other events are just ignore for now.)
----------------------------------------------------------------------

A   mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl-key.sml
U   mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl.sml
U   mltonlib/trunk/org/mlton/vesak/sdl/unstable/lib.mlb
U   mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/export.sml
A   mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl-key.sig
U   mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl.sig

----------------------------------------------------------------------

Added: mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl-key.sml
===================================================================
--- mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl-key.sml	2007-11-26 21:52:45 UTC (rev 6211)
+++ mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl-key.sml	2007-11-27 12:18:30 UTC (rev 6212)
@@ -0,0 +1,244 @@
+(* Copyright (C) 2007 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+structure SDLKey = struct
+   type t = E_'SDLKey.mlrep
+   local
+      open E_'SDLKey
+   in
+      val BACKSPACE = e_SDLK_BACKSPACE
+      val TAB = e_SDLK_TAB
+      val CLEAR = e_SDLK_CLEAR
+      val RETURN = e_SDLK_RETURN
+      val PAUSE = e_SDLK_PAUSE
+      val ESCAPE = e_SDLK_ESCAPE
+      val SPACE = e_SDLK_SPACE
+      val EXCLAIM = e_SDLK_EXCLAIM
+      val QUOTEDBL = e_SDLK_QUOTEDBL
+      val HASH = e_SDLK_HASH
+      val DOLLAR = e_SDLK_DOLLAR
+      val AMPERSAND = e_SDLK_AMPERSAND
+      val QUOTE = e_SDLK_QUOTE
+      val LEFTPAREN = e_SDLK_LEFTPAREN
+      val RIGHTPAREN = e_SDLK_RIGHTPAREN
+      val ASTERISK = e_SDLK_ASTERISK
+      val PLUS = e_SDLK_PLUS
+      val COMMA = e_SDLK_COMMA
+      val MINUS = e_SDLK_MINUS
+      val PERIOD = e_SDLK_PERIOD
+      val SLASH = e_SDLK_SLASH
+      val NUM0 = e_SDLK_0
+      val NUM1 = e_SDLK_1
+      val NUM2 = e_SDLK_2
+      val NUM3 = e_SDLK_3
+      val NUM4 = e_SDLK_4
+      val NUM5 = e_SDLK_5
+      val NUM6 = e_SDLK_6
+      val NUM7 = e_SDLK_7
+      val NUM8 = e_SDLK_8
+      val NUM9 = e_SDLK_9
+      val COLON = e_SDLK_COLON
+      val SEMICOLON = e_SDLK_SEMICOLON
+      val LESSKEY = e_SDLK_LESS
+      val EQUALS = e_SDLK_EQUALS
+      val GREATERKEY = e_SDLK_GREATER
+      val QUESTION = e_SDLK_QUESTION
+      val AT = e_SDLK_AT
+      val LEFTBRACKET = e_SDLK_LEFTBRACKET
+      val BACKSLASH = e_SDLK_BACKSLASH
+      val RIGHTBRACKET = e_SDLK_RIGHTBRACKET
+      val CARET = e_SDLK_CARET
+      val UNDERSCORE = e_SDLK_UNDERSCORE
+      val BACKQUOTE = e_SDLK_BACKQUOTE
+      val A = e_SDLK_a
+      val B = e_SDLK_b
+      val C = e_SDLK_c
+      val D = e_SDLK_d
+      val E = e_SDLK_e
+      val F = e_SDLK_f
+      val G = e_SDLK_g
+      val H = e_SDLK_h
+      val I = e_SDLK_i
+      val J = e_SDLK_j
+      val K = e_SDLK_k
+      val L = e_SDLK_l
+      val M = e_SDLK_m
+      val N = e_SDLK_n
+      val O = e_SDLK_o
+      val P = e_SDLK_p
+      val Q = e_SDLK_q
+      val R = e_SDLK_r
+      val S = e_SDLK_s
+      val T = e_SDLK_t
+      val U = e_SDLK_u
+      val V = e_SDLK_v
+      val W = e_SDLK_w
+      val X = e_SDLK_x
+      val Y = e_SDLK_y
+      val Z = e_SDLK_z
+      val DELETE = e_SDLK_DELETE
+      val WORLD_0 = e_SDLK_WORLD_0
+      val WORLD_1 = e_SDLK_WORLD_1
+      val WORLD_2 = e_SDLK_WORLD_2
+      val WORLD_3 = e_SDLK_WORLD_3
+      val WORLD_4 = e_SDLK_WORLD_4
+      val WORLD_5 = e_SDLK_WORLD_5
+      val WORLD_6 = e_SDLK_WORLD_6
+      val WORLD_7 = e_SDLK_WORLD_7
+      val WORLD_8 = e_SDLK_WORLD_8
+      val WORLD_9 = e_SDLK_WORLD_9
+      val WORLD_10 = e_SDLK_WORLD_10
+      val WORLD_11 = e_SDLK_WORLD_11
+      val WORLD_12 = e_SDLK_WORLD_12
+      val WORLD_13 = e_SDLK_WORLD_13
+      val WORLD_14 = e_SDLK_WORLD_14
+      val WORLD_15 = e_SDLK_WORLD_15
+      val WORLD_16 = e_SDLK_WORLD_16
+      val WORLD_17 = e_SDLK_WORLD_17
+      val WORLD_18 = e_SDLK_WORLD_18
+      val WORLD_19 = e_SDLK_WORLD_19
+      val WORLD_20 = e_SDLK_WORLD_20
+      val WORLD_21 = e_SDLK_WORLD_21
+      val WORLD_22 = e_SDLK_WORLD_22
+      val WORLD_23 = e_SDLK_WORLD_23
+      val WORLD_24 = e_SDLK_WORLD_24
+      val WORLD_25 = e_SDLK_WORLD_25
+      val WORLD_26 = e_SDLK_WORLD_26
+      val WORLD_27 = e_SDLK_WORLD_27
+      val WORLD_28 = e_SDLK_WORLD_28
+      val WORLD_29 = e_SDLK_WORLD_29
+      val WORLD_30 = e_SDLK_WORLD_30
+      val WORLD_31 = e_SDLK_WORLD_31
+      val WORLD_32 = e_SDLK_WORLD_32
+      val WORLD_33 = e_SDLK_WORLD_33
+      val WORLD_34 = e_SDLK_WORLD_34
+      val WORLD_35 = e_SDLK_WORLD_35
+      val WORLD_36 = e_SDLK_WORLD_36
+      val WORLD_37 = e_SDLK_WORLD_37
+      val WORLD_38 = e_SDLK_WORLD_38
+      val WORLD_39 = e_SDLK_WORLD_39
+      val WORLD_40 = e_SDLK_WORLD_40
+      val WORLD_41 = e_SDLK_WORLD_41
+      val WORLD_42 = e_SDLK_WORLD_42
+      val WORLD_43 = e_SDLK_WORLD_43
+      val WORLD_44 = e_SDLK_WORLD_44
+      val WORLD_45 = e_SDLK_WORLD_45
+      val WORLD_46 = e_SDLK_WORLD_46
+      val WORLD_47 = e_SDLK_WORLD_47
+      val WORLD_48 = e_SDLK_WORLD_48
+      val WORLD_49 = e_SDLK_WORLD_49
+      val WORLD_50 = e_SDLK_WORLD_50
+      val WORLD_51 = e_SDLK_WORLD_51
+      val WORLD_52 = e_SDLK_WORLD_52
+      val WORLD_53 = e_SDLK_WORLD_53
+      val WORLD_54 = e_SDLK_WORLD_54
+      val WORLD_55 = e_SDLK_WORLD_55
+      val WORLD_56 = e_SDLK_WORLD_56
+      val WORLD_57 = e_SDLK_WORLD_57
+      val WORLD_58 = e_SDLK_WORLD_58
+      val WORLD_59 = e_SDLK_WORLD_59
+      val WORLD_60 = e_SDLK_WORLD_60
+      val WORLD_61 = e_SDLK_WORLD_61
+      val WORLD_62 = e_SDLK_WORLD_62
+      val WORLD_63 = e_SDLK_WORLD_63
+      val WORLD_64 = e_SDLK_WORLD_64
+      val WORLD_65 = e_SDLK_WORLD_65
+      val WORLD_66 = e_SDLK_WORLD_66
+      val WORLD_67 = e_SDLK_WORLD_67
+      val WORLD_68 = e_SDLK_WORLD_68
+      val WORLD_69 = e_SDLK_WORLD_69
+      val WORLD_70 = e_SDLK_WORLD_70
+      val WORLD_71 = e_SDLK_WORLD_71
+      val WORLD_72 = e_SDLK_WORLD_72
+      val WORLD_73 = e_SDLK_WORLD_73
+      val WORLD_74 = e_SDLK_WORLD_74
+      val WORLD_75 = e_SDLK_WORLD_75
+      val WORLD_76 = e_SDLK_WORLD_76
+      val WORLD_77 = e_SDLK_WORLD_77
+      val WORLD_78 = e_SDLK_WORLD_78
+      val WORLD_79 = e_SDLK_WORLD_79
+      val WORLD_80 = e_SDLK_WORLD_80
+      val WORLD_81 = e_SDLK_WORLD_81
+      val WORLD_82 = e_SDLK_WORLD_82
+      val WORLD_83 = e_SDLK_WORLD_83
+      val WORLD_84 = e_SDLK_WORLD_84
+      val WORLD_85 = e_SDLK_WORLD_85
+      val WORLD_86 = e_SDLK_WORLD_86
+      val WORLD_87 = e_SDLK_WORLD_87
+      val WORLD_88 = e_SDLK_WORLD_88
+      val WORLD_89 = e_SDLK_WORLD_89
+      val WORLD_90 = e_SDLK_WORLD_90
+      val WORLD_91 = e_SDLK_WORLD_91
+      val WORLD_92 = e_SDLK_WORLD_92
+      val WORLD_93 = e_SDLK_WORLD_93
+      val WORLD_94 = e_SDLK_WORLD_94
+      val WORLD_95 = e_SDLK_WORLD_95
+      val KP0 = e_SDLK_KP0
+      val KP1 = e_SDLK_KP1
+      val KP2 = e_SDLK_KP2
+      val KP3 = e_SDLK_KP3
+      val KP4 = e_SDLK_KP4
+      val KP5 = e_SDLK_KP5
+      val KP6 = e_SDLK_KP6
+      val KP7 = e_SDLK_KP7
+      val KP8 = e_SDLK_KP8
+      val KP9 = e_SDLK_KP9
+      val KP_PERIOD = e_SDLK_KP_PERIOD
+      val KP_DIVIDE = e_SDLK_KP_DIVIDE
+      val KP_MULTIPLY = e_SDLK_KP_MULTIPLY
+      val KP_MINUS = e_SDLK_KP_MINUS
+      val KP_PLUS = e_SDLK_KP_PLUS
+      val KP_ENTER = e_SDLK_KP_ENTER
+      val KP_EQUALS = e_SDLK_KP_EQUALS
+      val UP = e_SDLK_UP
+      val DOWN = e_SDLK_DOWN
+      val RIGHT = e_SDLK_RIGHT
+      val LEFT = e_SDLK_LEFT
+      val INSERT = e_SDLK_INSERT
+      val HOME = e_SDLK_HOME
+      val END = e_SDLK_END
+      val PAGEUP = e_SDLK_PAGEUP
+      val PAGEDOWN = e_SDLK_PAGEDOWN
+      val F1 = e_SDLK_F1
+      val F2 = e_SDLK_F2
+      val F3 = e_SDLK_F3
+      val F4 = e_SDLK_F4
+      val F5 = e_SDLK_F5
+      val F6 = e_SDLK_F6
+      val F7 = e_SDLK_F7
+      val F8 = e_SDLK_F8
+      val F9 = e_SDLK_F9
+      val F10 = e_SDLK_F10
+      val F11 = e_SDLK_F11
+      val F12 = e_SDLK_F12
+      val F13 = e_SDLK_F13
+      val F14 = e_SDLK_F14
+      val F15 = e_SDLK_F15
+      val NUMLOCK = e_SDLK_NUMLOCK
+      val CAPSLOCK = e_SDLK_CAPSLOCK
+      val SCROLLOCK = e_SDLK_SCROLLOCK
+      val RSHIFT = e_SDLK_RSHIFT
+      val LSHIFT = e_SDLK_LSHIFT
+      val RCTRL = e_SDLK_RCTRL
+      val LCTRL = e_SDLK_LCTRL
+      val RALT = e_SDLK_RALT
+      val LALT = e_SDLK_LALT
+      val RMETA = e_SDLK_RMETA
+      val LMETA = e_SDLK_LMETA
+      val LSUPER = e_SDLK_LSUPER
+      val RSUPER = e_SDLK_RSUPER
+      val MODE = e_SDLK_MODE
+      val COMPOSE = e_SDLK_COMPOSE
+      val HELP = e_SDLK_HELP
+      val PRINT = e_SDLK_PRINT
+      val SYSREQ = e_SDLK_SYSREQ
+      val BREAK = e_SDLK_BREAK
+      val MENU = e_SDLK_MENU
+      val POWER = e_SDLK_POWER
+      val EURO = e_SDLK_EURO
+      val UNDO = e_SDLK_UNDO
+   end
+end


Property changes on: mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl-key.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl.sml
===================================================================
--- mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl.sml	2007-11-26 21:52:45 UTC (rev 6211)
+++ mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl.sml	2007-11-27 12:18:30 UTC (rev 6212)
@@ -4,9 +4,12 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-structure Word32Flags = MkWordFlags (Word32)
+structure SDL :> SDL = struct
+   structure Word32Flags = MkWordFlags (Word32)
 
-structure SDL :> SDL = struct
+   fun withNew size = With.around (fn () => C.new' size) C.discard'
+   val one = With.one
+
    fun raiseError () = raise Fail (ZString.toML' (F_SDL_GetError.f' ()))
    fun checkInt code = if 0 = code then () else raiseError ()
    fun checkPtr ptr = if C.Ptr.isNull' ptr then raiseError () else ptr
@@ -45,9 +48,11 @@
       val NOFRAME    = `SDL_NOFRAME
    end
 
-   structure Rect = struct
-      type t = {x : Int.t, y : Int.t, w : Int.t, h : Int.t}
-   end
+   type xy = {x : Int.t, y : Int.t}
+   type wh = {w : Int.t, h : Int.t}
+   type xywh = {x : Int.t, y : Int.t, w : Int.t, h : Int.t}
+   type rgb = {r : Word8.t, g : Word8.t, b : Word8.t}
+   type rgba = {r : Word8.t, g : Word8.t, b : Word8.t, a : Word8.t}
 
    structure Surface = struct
       type 'a t = (T_SDL_Surface.t, C.rw) C.obj C.ptr'
@@ -62,8 +67,6 @@
    end
 
    structure Color = struct
-      type rgb = {r : Word8.t, g : Word8.t, b : Word8.t}
-      type rgba = {r : Word8.t, g : Word8.t, b : Word8.t, a : Word8.t}
       type t = Word32.t
       fun fromRGB surface {r, g, b} =
           F_SDL_MapRGB.f' (Surface.getPixelFormat surface, r, g, b)
@@ -72,7 +75,7 @@
    end
 
    structure Video = struct
-      fun setMode {w, h, bpp, props} =
+      fun setMode props {bpp} {w, h} =
           checkPtr (F_SDL_SetVideoMode.f' (w, h, bpp, props))
       val getSurface = checkPtr o F_SDL_GetVideoSurface.f'
    end
@@ -82,4 +85,75 @@
      | SOME {x, y, w, h} =>
        checkInt (F_SML_SDL_FillRect.f'
                     (surface, x, y, Word.fromInt w, Word.fromInt h, color))
+
+   structure ScanCode = Word8
+
+   structure Key = SDLKey
+
+   structure Alt = struct
+      open Word32Flags
+      local
+         open E_'SDLMod
+      in
+         val toML = Word32.fromInt o E_'SDLMod.m2i
+
+         val LSHIFT = toML e_KMOD_LSHIFT
+         val RSHIFT = toML e_KMOD_RSHIFT
+         val LCTRL  = toML e_KMOD_LCTRL
+         val RCTRL  = toML e_KMOD_RCTRL
+         val LALT   = toML e_KMOD_LALT
+         val RALT   = toML e_KMOD_RALT
+         val LMETA  = toML e_KMOD_LMETA
+         val RMETA  = toML e_KMOD_RMETA
+         val NUM    = toML e_KMOD_NUM
+         val CAPS   = toML e_KMOD_CAPS
+         val MODE   = toML e_KMOD_MODE
+      end
+   end
+
+   structure Event = struct
+      datatype t =
+         KEY of {down : Bool.t,
+                 pressed : Bool.t,
+                 code : ScanCode.t,
+                 key : Key.t,
+                 alt : Alt.flags}
+
+      fun toML event = let
+         val t = C.Get.uchar' (U_SDL_Event.f_type' event)
+         open E_SDL_Events
+         fun is e = m2i e = MLRep.Char.Unsigned.toInt t
+      in
+         if is e_SDL_KEYDOWN orelse is e_SDL_KEYUP
+         then let
+               val ke = U_SDL_Event.f_key' event
+               val ks = S_SDL_KeyboardEvent.f_keysym' ke
+            in
+               SOME (KEY {down = is e_SDL_KEYDOWN,
+                          pressed = Word8.fromLargeInt SDL_PRESSED =
+                                    C.Get.uchar' (S_SDL_KeyboardEvent.f_state' ke),
+                          code = C.Get.uchar' (S_SDL_keysym.f_scancode' ks),
+                          key = C.Get.enum' (S_SDL_keysym.f_sym' ks),
+                          alt = Alt.toML (C.Get.enum' (S_SDL_keysym.f_mod' ks))})
+            end
+         else NONE (* We just ignore other events for now *)
+      end
+
+      fun poll () =
+          one (withNew U_SDL_Event.size)
+              (fn event =>
+                  case F_SDL_PollEvent.f' (C.Ptr.|&! event)
+                   of 0 => NONE
+                    | 1 => toML event
+                    | _ => raiseError ())
+
+      fun wait () =
+          one (withNew U_SDL_Event.size)
+              (fn event =>
+                  case F_SDL_WaitEvent.f' (C.Ptr.|&! event)
+                   of 1 => (case toML event
+                             of NONE => wait ()
+                              | SOME e => e)
+                    | _ => raiseError ())
+   end
 end

Modified: mltonlib/trunk/org/mlton/vesak/sdl/unstable/lib.mlb
===================================================================
--- mltonlib/trunk/org/mlton/vesak/sdl/unstable/lib.mlb	2007-11-26 21:52:45 UTC (rev 6211)
+++ mltonlib/trunk/org/mlton/vesak/sdl/unstable/lib.mlb	2007-11-27 12:18:30 UTC (rev 6212)
@@ -16,7 +16,10 @@
       "warnUnused true"
    in
       local
+         public/sdl-key.sig
          public/sdl.sig
+
+         detail/sdl-key.sml
          detail/sdl.sml
       in
          public/export.sml

Modified: mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/export.sml
===================================================================
--- mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/export.sml	2007-11-26 21:52:45 UTC (rev 6211)
+++ mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/export.sml	2007-11-27 12:18:30 UTC (rev 6212)
@@ -7,6 +7,7 @@
 (** == Exported Signatures == *)
 
 signature SDL = SDL
+signature SDL_KEY = SDL_KEY
 
 (** == Exported Structures == *)
 

Added: mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl-key.sig
===================================================================
--- mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl-key.sig	2007-11-26 21:52:45 UTC (rev 6211)
+++ mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl-key.sig	2007-11-27 12:18:30 UTC (rev 6212)
@@ -0,0 +1,240 @@
+(* Copyright (C) 2007 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+signature SDL_KEY = sig
+   eqtype t
+   val BACKSPACE : t
+   val TAB : t
+   val CLEAR : t
+   val RETURN : t
+   val PAUSE : t
+   val ESCAPE : t
+   val SPACE : t
+   val EXCLAIM : t
+   val QUOTEDBL : t
+   val HASH : t
+   val DOLLAR : t
+   val AMPERSAND : t
+   val QUOTE : t
+   val LEFTPAREN : t
+   val RIGHTPAREN : t
+   val ASTERISK : t
+   val PLUS : t
+   val COMMA : t
+   val MINUS : t
+   val PERIOD : t
+   val SLASH : t
+   val NUM0 : t
+   val NUM1 : t
+   val NUM2 : t
+   val NUM3 : t
+   val NUM4 : t
+   val NUM5 : t
+   val NUM6 : t
+   val NUM7 : t
+   val NUM8 : t
+   val NUM9 : t
+   val COLON : t
+   val SEMICOLON : t
+   val LESSKEY : t
+   val EQUALS : t
+   val GREATERKEY : t
+   val QUESTION : t
+   val AT : t
+   val LEFTBRACKET : t
+   val BACKSLASH : t
+   val RIGHTBRACKET : t
+   val CARET : t
+   val UNDERSCORE : t
+   val BACKQUOTE : t
+   val A : t
+   val B : t
+   val C : t
+   val D : t
+   val E : t
+   val F : t
+   val G : t
+   val H : t
+   val I : t
+   val J : t
+   val K : t
+   val L : t
+   val M : t
+   val N : t
+   val O : t
+   val P : t
+   val Q : t
+   val R : t
+   val S : t
+   val T : t
+   val U : t
+   val V : t
+   val W : t
+   val X : t
+   val Y : t
+   val Z : t
+   val DELETE : t
+   val WORLD_0 : t
+   val WORLD_1 : t
+   val WORLD_2 : t
+   val WORLD_3 : t
+   val WORLD_4 : t
+   val WORLD_5 : t
+   val WORLD_6 : t
+   val WORLD_7 : t
+   val WORLD_8 : t
+   val WORLD_9 : t
+   val WORLD_10 : t
+   val WORLD_11 : t
+   val WORLD_12 : t
+   val WORLD_13 : t
+   val WORLD_14 : t
+   val WORLD_15 : t
+   val WORLD_16 : t
+   val WORLD_17 : t
+   val WORLD_18 : t
+   val WORLD_19 : t
+   val WORLD_20 : t
+   val WORLD_21 : t
+   val WORLD_22 : t
+   val WORLD_23 : t
+   val WORLD_24 : t
+   val WORLD_25 : t
+   val WORLD_26 : t
+   val WORLD_27 : t
+   val WORLD_28 : t
+   val WORLD_29 : t
+   val WORLD_30 : t
+   val WORLD_31 : t
+   val WORLD_32 : t
+   val WORLD_33 : t
+   val WORLD_34 : t
+   val WORLD_35 : t
+   val WORLD_36 : t
+   val WORLD_37 : t
+   val WORLD_38 : t
+   val WORLD_39 : t
+   val WORLD_40 : t
+   val WORLD_41 : t
+   val WORLD_42 : t
+   val WORLD_43 : t
+   val WORLD_44 : t
+   val WORLD_45 : t
+   val WORLD_46 : t
+   val WORLD_47 : t
+   val WORLD_48 : t
+   val WORLD_49 : t
+   val WORLD_50 : t
+   val WORLD_51 : t
+   val WORLD_52 : t
+   val WORLD_53 : t
+   val WORLD_54 : t
+   val WORLD_55 : t
+   val WORLD_56 : t
+   val WORLD_57 : t
+   val WORLD_58 : t
+   val WORLD_59 : t
+   val WORLD_60 : t
+   val WORLD_61 : t
+   val WORLD_62 : t
+   val WORLD_63 : t
+   val WORLD_64 : t
+   val WORLD_65 : t
+   val WORLD_66 : t
+   val WORLD_67 : t
+   val WORLD_68 : t
+   val WORLD_69 : t
+   val WORLD_70 : t
+   val WORLD_71 : t
+   val WORLD_72 : t
+   val WORLD_73 : t
+   val WORLD_74 : t
+   val WORLD_75 : t
+   val WORLD_76 : t
+   val WORLD_77 : t
+   val WORLD_78 : t
+   val WORLD_79 : t
+   val WORLD_80 : t
+   val WORLD_81 : t
+   val WORLD_82 : t
+   val WORLD_83 : t
+   val WORLD_84 : t
+   val WORLD_85 : t
+   val WORLD_86 : t
+   val WORLD_87 : t
+   val WORLD_88 : t
+   val WORLD_89 : t
+   val WORLD_90 : t
+   val WORLD_91 : t
+   val WORLD_92 : t
+   val WORLD_93 : t
+   val WORLD_94 : t
+   val WORLD_95 : t
+   val KP0 : t
+   val KP1 : t
+   val KP2 : t
+   val KP3 : t
+   val KP4 : t
+   val KP5 : t
+   val KP6 : t
+   val KP7 : t
+   val KP8 : t
+   val KP9 : t
+   val KP_PERIOD : t
+   val KP_DIVIDE : t
+   val KP_MULTIPLY : t
+   val KP_MINUS : t
+   val KP_PLUS : t
+   val KP_ENTER : t
+   val KP_EQUALS : t
+   val UP : t
+   val DOWN : t
+   val RIGHT : t
+   val LEFT : t
+   val INSERT : t
+   val HOME : t
+   val END : t
+   val PAGEUP : t
+   val PAGEDOWN : t
+   val F1 : t
+   val F2 : t
+   val F3 : t
+   val F4 : t
+   val F5 : t
+   val F6 : t
+   val F7 : t
+   val F8 : t
+   val F9 : t
+   val F10 : t
+   val F11 : t
+   val F12 : t
+   val F13 : t
+   val F14 : t
+   val F15 : t
+   val NUMLOCK : t
+   val CAPSLOCK : t
+   val SCROLLOCK : t
+   val RSHIFT : t
+   val LSHIFT : t
+   val RCTRL : t
+   val LCTRL : t
+   val RALT : t
+   val LALT : t
+   val RMETA : t
+   val LMETA : t
+   val LSUPER : t
+   val RSUPER : t
+   val MODE : t
+   val COMPOSE : t
+   val HELP : t
+   val PRINT : t
+   val SYSREQ : t
+   val BREAK : t
+   val MENU : t
+   val POWER : t
+   val EURO : t
+   val UNDO : t
+end


Property changes on: mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl-key.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl.sig
===================================================================
--- mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl.sig	2007-11-26 21:52:45 UTC (rev 6211)
+++ mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl.sig	2007-11-27 12:18:30 UTC (rev 6212)
@@ -27,7 +27,7 @@
    val init : Init.flags Effect.t
    val initSubSystem : Init.flags Effect.t
    val quitSubSystem : Init.flags Effect.t
-   val wasInit : Init.flags -> Init.flags
+   val wasInit : Init.flags UnOp.t
    val quit : Unit.t Effect.t
 
    structure Prop : sig
@@ -45,30 +45,61 @@
       val NOFRAME : flags
    end
 
-   structure Rect : sig
-      type t = {x : Int.t, y : Int.t, w : Int.t, h : Int.t}
-   end
+   type xy = {x : Int.t, y : Int.t}
+   type wh = {w : Int.t, h : Int.t}
+   type xywh = {x : Int.t, y : Int.t, w : Int.t, h : Int.t}
+   type rgb = {r : Word8.t, g : Word8.t, b : Word8.t}
+   type rgba = {r : Word8.t, g : Word8.t, b : Word8.t, a : Word8.t}
 
    structure Surface : sig
       type 'a t
       val free : {video : no} t Effect.t
-      val updateRect : 'any t -> Rect.t Option.t Effect.t
+      val updateRect : 'any t -> xywh Option.t Effect.t
       val flip : 'any t Effect.t
    end
 
    structure Color : sig
-      type rgb = {r : Word8.t, g : Word8.t, b : Word8.t}
-      type rgba = {r : Word8.t, g : Word8.t, b : Word8.t, a : Word8.t}
       type t
       val fromRGB : 'any Surface.t -> rgb -> t
       val fromRGBA : 'any Surface.t -> rgba -> t
    end
 
    structure Video : sig
-      val setMode : {w : Int.t, h : Int.t, bpp : Int.t, props : Prop.flags}
-                    -> {video : yes} Surface.t
+      val setMode : Prop.flags -> {bpp : Int.t} -> wh -> {video : yes} Surface.t
       val getSurface : {video : yes} Surface.t Thunk.t
    end
 
-   val fillRect : 'any Surface.t -> Color.t -> Rect.t Option.t Effect.t
+   val fillRect : 'any Surface.t -> Color.t -> xywh Option.t Effect.t
+
+   structure ScanCode : sig
+      eqtype t
+   end
+
+   structure Key : SDL_KEY
+
+   structure Alt : sig
+      include FLAGS where type flags_word = Word32.t
+      val LSHIFT : flags
+      val RSHIFT : flags
+      val LCTRL : flags
+      val RCTRL : flags
+      val LALT : flags
+      val RALT : flags
+      val LMETA : flags
+      val RMETA : flags
+      val NUM : flags
+      val CAPS : flags
+      val MODE : flags
+   end
+
+   structure Event : sig
+      datatype t =
+         KEY of {down : Bool.t,
+                 pressed : Bool.t,
+                 code : ScanCode.t,
+                 key : Key.t,
+                 alt : Alt.flags}
+      val poll : t Option.t Thunk.t
+      val wait : t Thunk.t
+   end
 end




More information about the MLton-commit mailing list