/* move keyboard management by macfly august 2001 */ fun SearchSortedInList (list, func, key) = if list == nil then nil else let exec func with [hd list key] -> result in if result > 0 then nil else if result == 0 then hd list else SearchSortedInList tl list func key ;; struct MoveKeyboard = [ MOVEKBDname : S, MOVEKBDfilename : S, MOVEKBDkeys : [[I S] r1] /* key scancode & key code list */ ]mkMoveKeyboard;; fun MOVEKBD_GetKbdListRec (list) = if list == nil then nil else let list -> [cur next] in cur.MOVEKBDname::(MOVEKBD_GetKbdListRec next) ;; proto MOVE_GetKeyboards = fun [] [MoveKeyboard r1];; fun MOVEKBD_GetKbdList () = MOVEKBD_GetKbdListRec MOVE_GetKeyboards;; fun MOVEKBD_CompareKey (elt, key) = let elt -> [key1 _] in key1 - key ;; fun MOVEKBD_EltCompareKey (elt1, elt2) = let elt1 -> [key1 _] in let elt2 -> [key2 _] in key1 - key2 ;; fun MOVEKBD_CompareName (elt, name) = !strcmp elt.MOVEKBDname name;; fun MOVEKBD_SearchByName (list, name) = search_in_list list @MOVEKBD_CompareName name;; fun MOVEKBD_AddSubList (listKbd) = if listKbd == nil then nil else let listKbd -> [[code [key _]] next] in [atoi key code]::MOVEKBD_AddSubList next ;; fun MOVEKBD_AddList (listFile) = if listFile == nil then nil else let listFile -> [cur next] in (mkMoveKeyboard [ FILE_GetFilename (substr cur 0 (strlen cur)-4) cur quicksort (MOVEKBD_AddSubList (strextr _getpack _checkpack cur)) @MOVEKBD_EltCompareKey ]):: MOVEKBD_AddList next ;; fun MOVEKBD_SearchByKey (kbd, key) = let SearchSortedInList kbd.MOVEKBDkeys @MOVEKBD_CompareKey key -> found in if found == nil then _loc this "PAINTBALL_KEY_UNKNOWN" nil else let found -> [_ text] in text ;; fun MOVEKBD_Init () = /* MAC ICI : pas bien de mettre en dur !! */ MOVEKBD_AddList (strcat (PLUGpath thisplug) "move/keyboard/azerty.def")::(strcat (PLUGpath thisplug) "move/keyboard/qwerty.def")::nil ;; /* MODIF MOVE */