~rcr/rirc

ref: 7ca2a99a605b7e0b88fa85bc43a8fadc13695ba8 rirc/src/handlers/irc_recv.gperf -rw-r--r-- 1.1 KiB
7ca2a99a — Richard Robbins refactor order of includes 1 year, 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
%{
#include <string.h>

#define RECV_HANDLERS \
	X(error) \
	X(invite) \
	X(join) \
	X(kick) \
	X(mode) \
	X(nick) \
	X(notice) \
	X(part) \
	X(ping) \
	X(pong) \
	X(privmsg) \
	X(quit) \
	X(topic) \
	X(ircv3_cap) \
	X(ircv3_account) \
	X(ircv3_away) \
	X(ircv3_chghost)

#define X(cmd) static int recv_##cmd(struct server*, struct irc_message*);
RECV_HANDLERS
#undef X

typedef int (*irc_recv_f)(struct server*, struct irc_message*);

struct recv_handler
{
	char *key;
	irc_recv_f f;
};
%}

%enum
%null-strings
%readonly-tables
%struct-type
%define slot-name key
%define word-array-name      recv_handlers
%define hash-function-name   recv_handler_hash
%define lookup-function-name recv_handler_lookup
%define initializer-suffix ,(irc_recv_f)0
struct recv_handler;
%%
ERROR,   recv_error
INVITE,  recv_invite
JOIN,    recv_join
KICK,    recv_kick
MODE,    recv_mode
NICK,    recv_nick
NOTICE,  recv_notice
PART,    recv_part
PING,    recv_ping
PONG,    recv_pong
PRIVMSG, recv_privmsg
QUIT,    recv_quit
TOPIC,   recv_topic
CAP,     recv_ircv3_cap
ACCOUNT, recv_ircv3_account
AWAY,    recv_ircv3_away
CHGHOST, recv_ircv3_chghost
%%