1 /* $NetBSD: ipc_cmd.c,v 1.2 2013/11/22 15:52:05 christos Exp $ */
11 #include "../common/common.h"
15 static int ipc_unmarshall_a
__P((IPVIWIN
*, IP_BUF
*, IPFunc
));
16 static int ipc_unmarshall_12
__P((IPVIWIN
*, IP_BUF
*, IPFunc
));
17 static int ipc_unmarshall
__P((IPVIWIN
*, IP_BUF
*, IPFunc
));
18 static int ipc_unmarshall_ab1
__P((IPVIWIN
*, IP_BUF
*, IPFunc
));
20 static int ipc_unmarshall_1a
__P((IPVIWIN
*, IP_BUF
*, IPFunc
));
22 static int ipc_unmarshall_1
__P((IPVIWIN
*, IP_BUF
*, IPFunc
));
23 static int ipc_unmarshall_123
__P((IPVIWIN
*, IP_BUF
*, IPFunc
));
25 #define OFFSET(t,m) ((size_t)&((t *)0)->m)
27 IPFUNLIST
const ipfuns
[] = {
29 {"a", ipc_unmarshall_a
, OFFSET(IPSIOPS
, addstr
)},
31 {"12", ipc_unmarshall_12
, OFFSET(IPSIOPS
, attribute
)},
33 {"", ipc_unmarshall
, OFFSET(IPSIOPS
, bell
)},
35 {"", ipc_unmarshall
, OFFSET(IPSIOPS
, busy_off
)},
37 {"a", ipc_unmarshall_a
, OFFSET(IPSIOPS
, busy_on
)},
39 {"", ipc_unmarshall
, OFFSET(IPSIOPS
, clrtoeol
)},
41 {"", ipc_unmarshall
, OFFSET(IPSIOPS
, deleteln
)},
43 {"", ipc_unmarshall
, OFFSET(IPSIOPS
, discard
)},
45 {"ab1", ipc_unmarshall_ab1
, OFFSET(IPSIOPS
, editopt
)},
47 {"", ipc_unmarshall
, OFFSET(IPSIOPS
, insertln
)},
49 {"12", ipc_unmarshall_12
, OFFSET(IPSIOPS
, move
)},
51 {"", ipc_unmarshall
, OFFSET(IPSIOPS
, quit
)},
53 {"", ipc_unmarshall
, OFFSET(IPSIOPS
, redraw
)},
55 {"", ipc_unmarshall
, OFFSET(IPSIOPS
, refresh
)},
57 {"a", ipc_unmarshall_a
, OFFSET(IPSIOPS
, rename
)},
61 {"1", ipc_unmarshall_1
, OFFSET(IPSIOPS
, rewrite
)},
63 {"123", ipc_unmarshall_123
, OFFSET(IPSIOPS
, scrollbar
)},
65 {"a", ipc_unmarshall_a
, OFFSET(IPSIOPS
, select
)},
67 {"", ipc_unmarshall
, OFFSET(IPSIOPS
, split
)},
69 {"a", ipc_unmarshall_a
, OFFSET(IPSIOPS
, waddstr
)},
74 ipc_unmarshall_a(IPVIWIN
*ipvi
, IP_BUF
*ipb
, IPFunc func
)
76 return ((IPFunc_a
)func
)(ipvi
, ipb
->str1
, ipb
->len1
);
80 ipc_unmarshall_12(IPVIWIN
*ipvi
, IP_BUF
*ipb
, IPFunc func
)
82 return ((IPFunc_12
)func
)(ipvi
, ipb
->val1
, ipb
->val2
);
86 ipc_unmarshall(IPVIWIN
*ipvi
, IP_BUF
*ipb
, IPFunc func
)
92 ipc_unmarshall_ab1(IPVIWIN
*ipvi
, IP_BUF
*ipb
, IPFunc func
)
94 return ((IPFunc_ab1
)func
)(ipvi
, ipb
->str1
, ipb
->len1
, ipb
->str2
, ipb
->len2
, ipb
->val1
);
99 ipc_unmarshall_1a(IPVIWIN
*ipvi
, IP_BUF
*ipb
, IPFunc func
)
101 return ((IPFunc_1a
)func
)(ipvi
, ipb
->val1
, ipb
->str1
, ipb
->len1
);
106 ipc_unmarshall_1(IPVIWIN
*ipvi
, IP_BUF
*ipb
, IPFunc func
)
108 return ((IPFunc_1
)func
)(ipvi
, ipb
->val1
);
112 ipc_unmarshall_123(IPVIWIN
*ipvi
, IP_BUF
*ipb
, IPFunc func
)
114 return ((IPFunc_123
)func
)(ipvi
, ipb
->val1
, ipb
->val2
, ipb
->val3
);