2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
6 #include <libraries/commodities.h>
7 #include <proto/commodities.h>
8 #include <proto/exec.h>
9 #include <proto/alib.h>
10 #include <exec/memory.h>
11 #include <devices/keymap.h>
12 #include <devices/inputevent.h>
14 extern struct Library
*CxBase
;
16 /*****************************************************************************
20 struct InputEvent
*InvertString(
28 Return a linked list of input events which would produce the string
29 'str' in the reverse order, with the keymap 'km'. To get a list of
30 events in the right order, just use InvertStringForwd(). InverString()
31 is only there to provide compatibility with the original function,
32 which indeed reversed the order of the supplied string.
35 str -- pointer to a (NULL-terminated) string that may contain
36 * ANSI character codes
37 * backslash-escaped characters:
42 * a description of an input event a la ParseIX() surrounded
45 km -- keymap to use for the conversion or NULL to use the default
49 A linked list of input events or NULL if something went wrong.
54 An example string: "\n<shift alt a> olleH"
59 commodities.library/ParseIX(), InvertStringForwd(), FreeIEvents()
62 Ought to have an extra \< for < not starting an IX expression.
66 ******************************************************************************/
68 struct InputEvent
*first
, *second
, *third
, *fourth
;
69 if ((first
= InvertStringForwd(str
, km
)))
72 third
= first
->ie_NextEvent
;
77 third
= first
->ie_NextEvent
;
78 first
->ie_NextEvent
= second
;
80 fourth
->ie_NextEvent
= NULL
;