distrib: run libtoolize
[nvi.git] / ipc / ipc_cmd.c
blob85dc4eb84ade9661fa57ea40478d2b53474e0648
1 #include "config.h"
3 #include <sys/types.h>
4 #include <sys/queue.h>
6 #include <bitstring.h>
7 #include <limits.h>
8 #include <stdio.h>
10 #include "../common/common.h"
12 #include "ip.h"
14 static int ipc_unmarshall_a __P((IPVIWIN *, IP_BUF*, IPFunc));
15 static int ipc_unmarshall_12 __P((IPVIWIN *, IP_BUF*, IPFunc));
16 static int ipc_unmarshall __P((IPVIWIN *, IP_BUF*, IPFunc));
17 static int ipc_unmarshall_ab1 __P((IPVIWIN *, IP_BUF*, IPFunc));
18 static int ipc_unmarshall_1a __P((IPVIWIN *, IP_BUF*, IPFunc));
19 static int ipc_unmarshall_1 __P((IPVIWIN *, IP_BUF*, IPFunc));
20 static int ipc_unmarshall_123 __P((IPVIWIN *, IP_BUF*, IPFunc));
22 #define OFFSET(t,m) ((size_t)&((t *)0)->m)
24 IPFUNLIST const ipfuns[] = {
25 /* SI_ADDSTR */
26 {"a", ipc_unmarshall_a, OFFSET(IPSIOPS, addstr)},
27 /* SI_ATTRIBUTE */
28 {"12", ipc_unmarshall_12, OFFSET(IPSIOPS, attribute)},
29 /* SI_BELL */
30 {"", ipc_unmarshall, OFFSET(IPSIOPS, bell)},
31 /* SI_BUSY_OFF */
32 {"", ipc_unmarshall, OFFSET(IPSIOPS, busy_off)},
33 /* SI_BUSY_ON */
34 {"a", ipc_unmarshall_a, OFFSET(IPSIOPS, busy_on)},
35 /* SI_CLRTOEOL */
36 {"", ipc_unmarshall, OFFSET(IPSIOPS, clrtoeol)},
37 /* SI_DELETELN */
38 {"", ipc_unmarshall, OFFSET(IPSIOPS, deleteln)},
39 /* SI_DISCARD */
40 {"", ipc_unmarshall, OFFSET(IPSIOPS, discard)},
41 /* SI_EDITOPT */
42 {"ab1", ipc_unmarshall_ab1, OFFSET(IPSIOPS, editopt)},
43 /* SI_INSERTLN */
44 {"", ipc_unmarshall, OFFSET(IPSIOPS, insertln)},
45 /* SI_MOVE */
46 {"12", ipc_unmarshall_12, OFFSET(IPSIOPS, move)},
47 /* SI_QUIT */
48 {"", ipc_unmarshall, OFFSET(IPSIOPS, quit)},
49 /* SI_REDRAW */
50 {"", ipc_unmarshall, OFFSET(IPSIOPS, redraw)},
51 /* SI_REFRESH */
52 {"", ipc_unmarshall, OFFSET(IPSIOPS, refresh)},
53 /* SI_RENAME */
54 {"a", ipc_unmarshall_a, OFFSET(IPSIOPS, rename)},
55 /* SI_REPLY */
56 {"1a", NULL, 0},
57 /* SI_REWRITE */
58 {"1", ipc_unmarshall_1, OFFSET(IPSIOPS, rewrite)},
59 /* SI_SCROLLBAR */
60 {"123", ipc_unmarshall_123, OFFSET(IPSIOPS, scrollbar)},
61 /* SI_SELECT */
62 {"a", ipc_unmarshall_a, OFFSET(IPSIOPS, select)},
63 /* SI_SPLIT */
64 {"", ipc_unmarshall, OFFSET(IPSIOPS, split)},
65 /* SI_WADDSTR */
66 {"a", ipc_unmarshall_a, OFFSET(IPSIOPS, waddstr)},
67 /* SI_EVENT_SUP */
70 static int
71 ipc_unmarshall_a(IPVIWIN *ipvi, IP_BUF *ipb, IPFunc func)
73 return ((IPFunc_a)func)(ipvi, ipb->str1, ipb->len1);
76 static int
77 ipc_unmarshall_12(IPVIWIN *ipvi, IP_BUF *ipb, IPFunc func)
79 return ((IPFunc_12)func)(ipvi, ipb->val1, ipb->val2);
82 static int
83 ipc_unmarshall(IPVIWIN *ipvi, IP_BUF *ipb, IPFunc func)
85 return func(ipvi);
88 static int
89 ipc_unmarshall_ab1(IPVIWIN *ipvi, IP_BUF *ipb, IPFunc func)
91 return ((IPFunc_ab1)func)(ipvi, ipb->str1, ipb->len1, ipb->str2, ipb->len2, ipb->val1);
94 static int
95 ipc_unmarshall_1a(IPVIWIN *ipvi, IP_BUF *ipb, IPFunc func)
97 return ((IPFunc_1a)func)(ipvi, ipb->val1, ipb->str1, ipb->len1);
100 static int
101 ipc_unmarshall_1(IPVIWIN *ipvi, IP_BUF *ipb, IPFunc func)
103 return ((IPFunc_1)func)(ipvi, ipb->val1);
106 static int
107 ipc_unmarshall_123(IPVIWIN *ipvi, IP_BUF *ipb, IPFunc func)
109 return ((IPFunc_123)func)(ipvi, ipb->val1, ipb->val2, ipb->val3);