1 /*
2   Copyright (c) 2005-2013 uim Project https://github.com/uim/uim
3 
4   All rights reserved.
5 
6   Redistribution and use in source and binary forms, with or
7   without modification, are permitted provided that the
8   following conditions are met:
9 
10   1. Redistributions of source code must retain the above
11      copyright notice, this list of conditions and the
12      following disclaimer.
13   2. Redistributions in binary form must reproduce the above
14      copyright notice, this list of conditions and the
15      following disclaimer in the documentation and/or other
16      materials provided with the distribution.
17   3. Neither the name of authors nor the names of its
18      contributors may be used to endorse or promote products
19      derived from this software without specific prior written
20      permission.
21 
22   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
23   CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
24   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26   DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
27   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29   NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
33   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 */
36 
37 #ifndef UIM_EMACS_UIM_EL_AGENT_H
38 #define UIM_EMACS_UIM_EL_AGENT_H
39 
40 #include <config.h>
41 
42 #include "debug.h"
43 #include "output.h"
44 #include "uim-el-types.h"
45 #include "candidate.h"
46 #include "preedit.h"
47 #include "context.h"
48 #include "encoding.h"
49 #include "im.h"
50 #include "key.h"
51 #include "helper.h"
52 #include "callback.h"
53 #include "prop.h"
54 
55 static int cmd_release(int context_id);
56 static int cmd_helper(int context_id, char *message);
57 static int cmd_unfocused(int context_id);
58 static int cmd_focused(int context_id);
59 static int cmd_hide(int context_id);
60 static int cmd_show(int context_id);
61 static int cmd_new(int context_id, const char *encoding);
62 static int cmd_reset(int context_id);
63 static int cmd_change(int context_id, const char *im);
64 static int cmd_list(void);
65 static int cmd_setenc(char *opt);
66 static int cmd_prop(int context_id, const char *prop);
67 static int cmd_nop(int context_id);
68 static int cmd_error(void);
69 
70 static void check_default_engine(void);
71 
72 static void check_prop_list_update(uim_agent_context *ua);
73 
74 static int process_command(int serial, int cid, char *cmd);
75 static int process_keyvector(int serial, int cid,
76 							 uim_key ukey, const char *keyname);
77 static int analyze_keyvector(char *vector, uim_key *ukey, char *keyname, size_t keyname_len);
78 
79 void cleanup(void);
80 
81 #endif
82