summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Davis <loafier@gmail.com>2006-06-26 04:20:50 +0000
committerChristopher Davis <loafier@gmail.com>2006-06-26 04:20:50 +0000
commit96280edc8fda9cc591bc0833398e576bf680931d (patch)
tree53dad5721b3fa530a7a69b0169fe4d5d0b614a3e
parent3b04cf6a1210f97d8144ee1ba646186aca4912ef (diff)
downloadirssi-python-96280edc8fda9cc591bc0833398e576bf680931d.tar.gz
irssi-python-96280edc8fda9cc591bc0833398e576bf680931d.tar.xz
irssi-python-96280edc8fda9cc591bc0833398e576bf680931d.zip
working on new provision for constants and changed sig2code script
git-svn-id: http://svn.irssi.org/repos/irssi-python@4292 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--Makefile5
-rw-r--r--constants.awk13
-rw-r--r--constants.txt42
-rw-r--r--pyconstants.h45
-rw-r--r--pysigmap.h362
-rw-r--r--pysignals.c1
-rw-r--r--sig2code.awk61
-rw-r--r--sig2code.py129
-rw-r--r--sig2code.txt44
9 files changed, 393 insertions, 309 deletions
diff --git a/Makefile b/Makefile
index 9cb3d0f..1d004eb 100644
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,10 @@ pyobjects.a:
$(CC) -c $< $(CFLAGS)
signalmap:
- python sig2code.py < ~/irssi-0.8.10/docs/signals.txt > pysigmap.h
+ awk -f sig2code.awk ~/irssi-0.8.10/docs/signals.txt > pysigmap.h
+
+constants:
+ awk -f constants.awk constants.txt > pyconstants.h
clean:
rm -f *.o *.so
diff --git a/constants.awk b/constants.awk
new file mode 100644
index 0000000..c9395c1
--- /dev/null
+++ b/constants.awk
@@ -0,0 +1,13 @@
+BEGIN {
+ print "static PY_CONSTANT_REC py_constants[] = {";
+}
+
+{
+ printf(" {\"%s\", %25s},\n", $1,$1);
+}
+
+END {
+ print " {NULL}";
+ print "};"
+}
+
diff --git a/constants.txt b/constants.txt
new file mode 100644
index 0000000..39fca36
--- /dev/null
+++ b/constants.txt
@@ -0,0 +1,42 @@
+INPUT_READ
+INPUT_WRITE
+IRSSI_GUI_GNOME
+IRSSI_GUI_GTK
+IRSSI_GUI_KDE
+IRSSI_GUI_NONE
+IRSSI_GUI_QT
+IRSSI_GUI_TEXT
+MASK_DOMAIN
+MASK_HOST
+MASK_NICK
+MASK_USER
+MSGLEVEL_ACTIONS
+MSGLEVEL_ALL
+MSGLEVEL_CLIENTCRAP
+MSGLEVEL_CLIENTERROR
+MSGLEVEL_CLIENTNOTICE
+MSGLEVEL_CRAP
+MSGLEVEL_CTCPS
+MSGLEVEL_DCC
+MSGLEVEL_DCCMSGS
+MSGLEVEL_HILIGHT
+MSGLEVEL_INVITES
+MSGLEVEL_JOINS
+MSGLEVEL_KICKS
+MSGLEVEL_LASTLOG
+MSGLEVEL_MODES
+MSGLEVEL_MSGS
+MSGLEVEL_NEVER
+MSGLEVEL_NICKS
+MSGLEVEL_NO_ACT
+MSGLEVEL_NOHILIGHT
+MSGLEVEL_NOTICES
+MSGLEVEL_PARTS
+MSGLEVEL_PUBLIC
+MSGLEVEL_QUITS
+MSGLEVEL_SNOTES
+MSGLEVEL_TOPICS
+MSGLEVEL_WALLOPS
+SIGNAL_PRIORITY_DEFAULT
+SIGNAL_PRIORITY_HIGH
+SIGNAL_PRIORITY_LOW
diff --git a/pyconstants.h b/pyconstants.h
new file mode 100644
index 0000000..4cf6407
--- /dev/null
+++ b/pyconstants.h
@@ -0,0 +1,45 @@
+static PY_CONSTANT_REC py_constants[] = {
+ {"INPUT_READ", INPUT_READ},
+ {"INPUT_WRITE", INPUT_WRITE},
+ {"IRSSI_GUI_GNOME", IRSSI_GUI_GNOME},
+ {"IRSSI_GUI_GTK", IRSSI_GUI_GTK},
+ {"IRSSI_GUI_KDE", IRSSI_GUI_KDE},
+ {"IRSSI_GUI_NONE", IRSSI_GUI_NONE},
+ {"IRSSI_GUI_QT", IRSSI_GUI_QT},
+ {"IRSSI_GUI_TEXT", IRSSI_GUI_TEXT},
+ {"MASK_DOMAIN", MASK_DOMAIN},
+ {"MASK_HOST", MASK_HOST},
+ {"MASK_NICK", MASK_NICK},
+ {"MASK_USER", MASK_USER},
+ {"MSGLEVEL_ACTIONS", MSGLEVEL_ACTIONS},
+ {"MSGLEVEL_ALL", MSGLEVEL_ALL},
+ {"MSGLEVEL_CLIENTCRAP", MSGLEVEL_CLIENTCRAP},
+ {"MSGLEVEL_CLIENTERROR", MSGLEVEL_CLIENTERROR},
+ {"MSGLEVEL_CLIENTNOTICE", MSGLEVEL_CLIENTNOTICE},
+ {"MSGLEVEL_CRAP", MSGLEVEL_CRAP},
+ {"MSGLEVEL_CTCPS", MSGLEVEL_CTCPS},
+ {"MSGLEVEL_DCC", MSGLEVEL_DCC},
+ {"MSGLEVEL_DCCMSGS", MSGLEVEL_DCCMSGS},
+ {"MSGLEVEL_HILIGHT", MSGLEVEL_HILIGHT},
+ {"MSGLEVEL_INVITES", MSGLEVEL_INVITES},
+ {"MSGLEVEL_JOINS", MSGLEVEL_JOINS},
+ {"MSGLEVEL_KICKS", MSGLEVEL_KICKS},
+ {"MSGLEVEL_LASTLOG", MSGLEVEL_LASTLOG},
+ {"MSGLEVEL_MODES", MSGLEVEL_MODES},
+ {"MSGLEVEL_MSGS", MSGLEVEL_MSGS},
+ {"MSGLEVEL_NEVER", MSGLEVEL_NEVER},
+ {"MSGLEVEL_NICKS", MSGLEVEL_NICKS},
+ {"MSGLEVEL_NO_ACT", MSGLEVEL_NO_ACT},
+ {"MSGLEVEL_NOHILIGHT", MSGLEVEL_NOHILIGHT},
+ {"MSGLEVEL_NOTICES", MSGLEVEL_NOTICES},
+ {"MSGLEVEL_PARTS", MSGLEVEL_PARTS},
+ {"MSGLEVEL_PUBLIC", MSGLEVEL_PUBLIC},
+ {"MSGLEVEL_QUITS", MSGLEVEL_QUITS},
+ {"MSGLEVEL_SNOTES", MSGLEVEL_SNOTES},
+ {"MSGLEVEL_TOPICS", MSGLEVEL_TOPICS},
+ {"MSGLEVEL_WALLOPS", MSGLEVEL_WALLOPS},
+ {"SIGNAL_PRIORITY_DEFAULT", SIGNAL_PRIORITY_DEFAULT},
+ {"SIGNAL_PRIORITY_HIGH", SIGNAL_PRIORITY_HIGH},
+ {"SIGNAL_PRIORITY_LOW", SIGNAL_PRIORITY_LOW},
+ {NULL}
+};
diff --git a/pysigmap.h b/pysigmap.h
index fcf8ce8..c34fbf7 100644
--- a/pysigmap.h
+++ b/pysigmap.h
@@ -1,184 +1,188 @@
/* Include in your C module */
static PY_SIGNAL_SPEC_REC py_sigmap[] = {
- {"gui dialog", "ss", 0, 0, 0},
- {"send command", "sSW", 0, 0, 0},
- {"chat protocol created", "?", 0, 0, 0},
- {"chat protocol updated", "?", 0, 0, 0},
- {"chat protocol destroyed", "?", 0, 0, 0},
- {"channel created", "Ci", 0, 0, 0},
- {"channel destroyed", "C", 0, 0, 0},
- {"chatnet created", "c", 0, 0, 0},
- {"chatnet destroyed", "c", 0, 0, 0},
- {"commandlist new", "o", 0, 0, 0},
- {"commandlist remove", "o", 0, 0, 0},
- {"error command", "is", 0, 0, 0},
- {"send command", "sSW", 0, 0, 0},
- {"send text", "sSW", 0, 0, 0},
- {"command ", "sSW", 0, 0, 1},
- {"default command", "sSW", 0, 0, 0},
- {"ignore created", "g", 0, 0, 0},
- {"ignore destroyed", "g", 0, 0, 0},
- {"ignore changed", "g", 0, 0, 0},
- {"log new", "l", 0, 0, 0},
- {"log remove", "l", 0, 0, 0},
- {"log create failed", "l", 0, 0, 0},
- {"log locked", "l", 0, 0, 0},
- {"log started", "l", 0, 0, 0},
- {"log stopped", "l", 0, 0, 0},
- {"log rotated", "l", 0, 0, 0},
- {"log written", "ls", 0, 0, 0},
- {"module loaded", "??", 0, 0, 0},
- {"module unloaded", "??", 0, 0, 0},
- {"module error", "isss", 0, 0, 0},
- {"nicklist new", "Cn", 0, 0, 0},
- {"nicklist remove", "Cn", 0, 0, 0},
- {"nicklist changed", "Cns", 0, 0, 0},
- {"nicklist host changed", "Cn", 0, 0, 0},
- {"nicklist gone changed", "Cn", 0, 0, 0},
- {"nicklist serverop changed", "Cn", 0, 0, 0},
- {"pidwait", "ii", 0, 0, 0},
- {"query created", "qi", 0, 0, 0},
- {"query destroyed", "q", 0, 0, 0},
- {"query nick changed", "qs", 0, 0, 0},
- {"window item name changed", "W", 0, 0, 0},
- {"query address changed", "q", 0, 0, 0},
- {"query server changed", "qS", 0, 0, 0},
- {"rawlog", "as", 0, 0, 0},
- {"server looking", "S", 0, 0, 0},
- {"server connected", "S", 0, 0, 0},
- {"server connecting", "Su", 0, 0, 0},
- {"server connect failed", "S", 0, 0, 0},
- {"server disconnected", "S", 0, 0, 0},
- {"server quit", "Ss", 0, 0, 0},
- {"server sendmsg", "Sssi", 0, 0, 0},
- {"setup reread", "s", 0, 0, 0},
- {"setup saved", "si", 0, 0, 0},
- {"ban type changed", "s", 0, 0, 0},
- {"channel joined", "C", 0, 0, 0},
- {"channel wholist", "C", 0, 0, 0},
- {"channel sync", "C", 0, 0, 0},
- {"channel topic changed", "C", 0, 0, 0},
- {"ctcp msg", "Sssss", 0, 0, 0},
- {"ctcp msg ", "Sssss", 0, 0, 1},
- {"default ctcp msg", "Sssss", 0, 0, 0},
- {"ctcp reply", "Sssss", 0, 0, 0},
- {"ctcp reply ", "Sssss", 0, 0, 1},
- {"default ctcp reply", "Sssss", 0, 0, 0},
- {"ctcp action", "Sssss", 0, 0, 0},
- {"awaylog show", "lii", 0, 0, 0},
- {"server nick changed", "S", 0, 0, 0},
- {"event connected", "S", 0, 0, 0},
- {"server event", "Ssss", 0, 0, 0},
- {"event ", "Ssss", 0, 0, 1},
- {"default event", "Ssss", 0, 0, 0},
- {"whois default event", "Ssss", 0, 0, 0},
- {"server incoming", "Ss", 0, 0, 0},
- {"redir ", "Ssss", 0, 0, 1},
- {"server lag", "S", 0, 0, 0},
- {"server lag disconnect", "S", 0, 0, 0},
- {"massjoin", "CL", 0, 0, 0},
- {"ban new", "Cb", 0, 0, 0},
- {"ban remove", "Cbs", 0, 0, 0},
- {"channel mode changed", "Cs", 0, 0, 0},
- {"nick mode changed", "Cnsss", 0, 0, 0},
- {"user mode changed", "Ss", 0, 0, 0},
- {"away mode changed", "S", 0, 0, 0},
- {"netsplit server new", "Se", 0, 0, 0},
- {"netsplit server remove", "Se", 0, 0, 0},
- {"netsplit new", "N", 0, 0, 0},
- {"netsplit remove", "N", 0, 0, 0},
- {"dcc ctcp ", "sd", 0, 0, 1},
- {"default dcc ctcp", "sd", 0, 0, 0},
- {"dcc unknown ctcp", "sss", 0, 0, 0},
- {"dcc reply ", "sd", 0, 0, 1},
- {"default dcc reply", "sd", 0, 0, 0},
- {"dcc unknown reply", "sss", 0, 0, 0},
- {"dcc chat message", "ds", 0, 0, 0},
- {"dcc created", "d", 0, 0, 0},
- {"dcc destroyed", "d", 0, 0, 0},
- {"dcc connected", "d", 0, 0, 0},
- {"dcc rejecting", "d", 0, 0, 0},
- {"dcc closed", "d", 0, 0, 0},
- {"dcc request", "ds", 0, 0, 0},
- {"dcc request send", "d", 0, 0, 0},
- {"dcc chat message", "ds", 0, 0, 0},
- {"dcc transfer update", "d", 0, 0, 0},
- {"dcc get receive", "d", 0, 0, 0},
- {"dcc error connect", "d", 0, 0, 0},
- {"dcc error file create", "ds", 0, 0, 0},
- {"dcc error file open", "ssi", 0, 0, 0},
- {"dcc error get not found", "s", 0, 0, 0},
- {"dcc error send exists", "ss", 0, 0, 0},
- {"dcc error unknown type", "s", 0, 0, 0},
- {"dcc error close not found", "sss", 0, 0, 0},
- {"autoignore new", "S?", 0, 0, 0},
- {"autoignore remove", "S?", 0, 0, 0},
- {"flood", "Sssis", 0, 0, 0},
- {"notifylist new", "O", 0, 0, 0},
- {"notifylist remove", "O", 0, 0, 0},
- {"notifylist joined", "Ssssss", 0, 0, 0},
- {"notifylist away changed", "Ssssss", 0, 0, 0},
- {"notifylist unidle", "Ssssss", 0, 0, 0},
- {"notifylist left", "Ssssss", 0, 0, 0},
- {"proxy client connected", "?", 0, 0, 0},
- {"proxy client disconnected", "?", 0, 0, 0},
- {"gui print text", "wiiist", 0, 0, 0},
- {"gui print text finished", "w", 0, 0, 0},
- {"complete word", "GwssI", 0, 0, 0},
- {"exec new", "p", 0, 0, 0},
- {"exec remove", "pi", 0, 0, 0},
- {"exec input", "ps", 0, 0, 0},
- {"message public", "Sssss", 0, 0, 0},
- {"message private", "Ssss", 0, 0, 0},
- {"message own_public", "Sss", 0, 0, 0},
- {"message own_private", "Ssss", 0, 0, 0},
- {"message join", "Ssss", 0, 0, 0},
- {"message part", "Sssss", 0, 0, 0},
- {"message quit", "Ssss", 0, 0, 0},
- {"message kick", "Ssssss", 0, 0, 0},
- {"message nick", "Ssss", 0, 0, 0},
- {"message own_nick", "Ssss", 0, 0, 0},
- {"message invite", "Ssss", 0, 0, 0},
- {"message topic", "Sssss", 0, 0, 0},
- {"keyinfo created", "?", 0, 0, 0},
- {"keyinfo destroyed", "?", 0, 0, 0},
- {"print text", "tss", 0, 0, 0},
- {"theme created", "?", 0, 0, 0},
- {"theme destroyed", "?", 0, 0, 0},
- {"window hilight", "w", 0, 0, 0},
- {"window activity", "wi", 0, 0, 0},
- {"window item hilight", "W", 0, 0, 0},
- {"window item activity", "Wi", 0, 0, 0},
- {"window item new", "wW", 0, 0, 0},
- {"window item remove", "wW", 0, 0, 0},
- {"window item changed", "wW", 0, 0, 0},
- {"window item server changed", "wW", 0, 0, 0},
- {"window created", "w", 0, 0, 0},
- {"window destroyed", "w", 0, 0, 0},
- {"window changed", "ww", 0, 0, 0},
- {"window changed automatic", "w", 0, 0, 0},
- {"window server changed", "wS", 0, 0, 0},
- {"window refnum changed", "wi", 0, 0, 0},
- {"window name changed", "w", 0, 0, 0},
- {"window history changed", "ws", 0, 0, 0},
- {"window level changed", "w", 0, 0, 0},
- {"message irc op_public", "Sssss", 0, 0, 0},
- {"message irc own_wall", "Sss", 0, 0, 0},
- {"message irc own_action", "Sss", 0, 0, 0},
- {"message irc action", "Sssss", 0, 0, 0},
- {"message irc own_notice", "Sss", 0, 0, 0},
- {"message irc notice", "Sssss", 0, 0, 0},
- {"message irc own_ctcp", "Ssss", 0, 0, 0},
- {"message irc ctcp", "Ssssss", 0, 0, 0},
- {"message irc mode", "Sssss", 0, 0, 0},
- {"message dcc own", "ds", 0, 0, 0},
- {"message dcc own_action", "ds", 0, 0, 0},
- {"message dcc own_ctcp", "dss", 0, 0, 0},
- {"message dcc", "ds", 0, 0, 0},
- {"message dcc action", "ds", 0, 0, 0},
- {"message dcc ctcp", "dss", 0, 0, 0},
- {"gui key pressed", "i", 0, 0, 0},
- {NULL}
+ {"gui exit", "", 0, 0, 0},
+ {"gui dialog", "ss", 0, 0, 0},
+ {"send command", "sSW", 0, 0, 0},
+ {"chat protocol created", "?", 0, 0, 0},
+ {"chat protocol updated", "?", 0, 0, 0},
+ {"chat protocol destroyed", "?", 0, 0, 0},
+ {"channel created", "Ci", 0, 0, 0},
+ {"channel destroyed", "C", 0, 0, 0},
+ {"chatnet created", "c", 0, 0, 0},
+ {"chatnet destroyed", "c", 0, 0, 0},
+ {"commandlist new", "o", 0, 0, 0},
+ {"commandlist remove", "o", 0, 0, 0},
+ {"error command", "is", 0, 0, 0},
+ {"send command", "sSW", 0, 0, 0},
+ {"send text", "sSW", 0, 0, 0},
+ {"command ", "sSW", 0, 0, 1},
+ {"default command", "sSW", 0, 0, 0},
+ {"ignore created", "g", 0, 0, 0},
+ {"ignore destroyed", "g", 0, 0, 0},
+ {"ignore changed", "g", 0, 0, 0},
+ {"log new", "l", 0, 0, 0},
+ {"log remove", "l", 0, 0, 0},
+ {"log create failed", "l", 0, 0, 0},
+ {"log locked", "l", 0, 0, 0},
+ {"log started", "l", 0, 0, 0},
+ {"log stopped", "l", 0, 0, 0},
+ {"log rotated", "l", 0, 0, 0},
+ {"log written", "ls", 0, 0, 0},
+ {"module loaded", "??", 0, 0, 0},
+ {"module unloaded", "??", 0, 0, 0},
+ {"module error", "isss", 0, 0, 0},
+ {"nicklist new", "Cn", 0, 0, 0},
+ {"nicklist remove", "Cn", 0, 0, 0},
+ {"nicklist changed", "Cns", 0, 0, 0},
+ {"nicklist host changed", "Cn", 0, 0, 0},
+ {"nicklist gone changed", "Cn", 0, 0, 0},
+ {"nicklist serverop changed", "Cn", 0, 0, 0},
+ {"pidwait", "ii", 0, 0, 0},
+ {"query created", "qi", 0, 0, 0},
+ {"query destroyed", "q", 0, 0, 0},
+ {"query nick changed", "qs", 0, 0, 0},
+ {"window item name changed", "W", 0, 0, 0},
+ {"query address changed", "q", 0, 0, 0},
+ {"query server changed", "qS", 0, 0, 0},
+ {"rawlog", "ls", 0, 0, 0},
+ {"server looking", "S", 0, 0, 0},
+ {"server connected", "S", 0, 0, 0},
+ {"server connecting", "Su", 0, 0, 0},
+ {"server connect failed", "S", 0, 0, 0},
+ {"server disconnected", "S", 0, 0, 0},
+ {"server quit", "Ss", 0, 0, 0},
+ {"server sendmsg", "Sssi", 0, 0, 0},
+ {"setup changed", "", 0, 0, 0},
+ {"setup reread", "s", 0, 0, 0},
+ {"setup saved", "si", 0, 0, 0},
+ {"ban type changed", "s", 0, 0, 0},
+ {"channel joined", "C", 0, 0, 0},
+ {"channel wholist", "C", 0, 0, 0},
+ {"channel sync", "C", 0, 0, 0},
+ {"channel topic changed", "C", 0, 0, 0},
+ {"ctcp msg", "Sssss", 0, 0, 0},
+ {"ctcp msg ", "Sssss", 0, 0, 1},
+ {"default ctcp msg", "Sssss", 0, 0, 0},
+ {"ctcp reply", "Sssss", 0, 0, 0},
+ {"ctcp reply ", "Sssss", 0, 0, 1},
+ {"default ctcp reply", "Sssss", 0, 0, 0},
+ {"ctcp action", "Sssss", 0, 0, 0},
+ {"awaylog show", "lii", 0, 0, 0},
+ {"server nick changed", "S", 0, 0, 0},
+ {"event connected", "S", 0, 0, 0},
+ {"server event", "Ssss", 0, 0, 0},
+ {"event ", "Ssss", 0, 0, 1},
+ {"default event", "Ssss", 0, 0, 0},
+ {"whois default event", "Ssss", 0, 0, 0},
+ {"server incoming", "Ss", 0, 0, 0},
+ {"redir ", "Ssss", 0, 0, 1},
+ {"server lag", "S", 0, 0, 0},
+ {"server lag disconnect", "S", 0, 0, 0},
+ {"massjoin", "CL", 0, 0, 0},
+ {"ban new", "Cb", 0, 0, 0},
+ {"ban remove", "Cbs", 0, 0, 0},
+ {"channel mode changed", "Cs", 0, 0, 0},
+ {"nick mode changed", "Cnsss", 0, 0, 0},
+ {"user mode changed", "Ss", 0, 0, 0},
+ {"away mode changed", "S", 0, 0, 0},
+ {"netsplit server new", "SS", 0, 0, 0},
+ {"netsplit server remove", "SS", 0, 0, 0},
+ {"netsplit new", "N", 0, 0, 0},
+ {"netsplit remove", "N", 0, 0, 0},
+ {"dcc ctcp ", "sd", 0, 0, 1},
+ {"default dcc ctcp", "sd", 0, 0, 0},
+ {"dcc unknown ctcp", "sss", 0, 0, 0},
+ {"dcc reply ", "sd", 0, 0, 1},
+ {"default dcc reply", "sd", 0, 0, 0},
+ {"dcc unknown reply", "sss", 0, 0, 0},
+ {"dcc chat message", "ds", 0, 0, 0},
+ {"dcc created", "d", 0, 0, 0},
+ {"dcc destroyed", "d", 0, 0, 0},
+ {"dcc connected", "d", 0, 0, 0},
+ {"dcc rejecting", "d", 0, 0, 0},
+ {"dcc closed", "d", 0, 0, 0},
+ {"dcc request", "ds", 0, 0, 0},
+ {"dcc request send", "d", 0, 0, 0},
+ {"dcc chat message", "ds", 0, 0, 0},
+ {"dcc transfer update", "d", 0, 0, 0},
+ {"dcc get receive", "d", 0, 0, 0},
+ {"dcc error connect", "d", 0, 0, 0},
+ {"dcc error file create", "ds", 0, 0, 0},
+ {"dcc error file open", "ssi", 0, 0, 0},
+ {"dcc error get not found", "s", 0, 0, 0},
+ {"dcc error send exists", "ss", 0, 0, 0},
+ {"dcc error unknown type", "s", 0, 0, 0},
+ {"dcc error close not found", "sss", 0, 0, 0},
+ {"autoignore new", "S?", 0, 0, 0},
+ {"autoignore remove", "S?", 0, 0, 0},
+ {"flood", "Sssis", 0, 0, 0},
+ {"notifylist new", "O", 0, 0, 0},
+ {"notifylist remove", "O", 0, 0, 0},
+ {"notifylist joined", "Ssssss", 0, 0, 0},
+ {"notifylist away changed", "Ssssss", 0, 0, 0},
+ {"notifylist unidle", "Ssssss", 0, 0, 0},
+ {"notifylist left", "Ssssss", 0, 0, 0},
+ {"proxy client connected", "?", 0, 0, 0},
+ {"proxy client disconnected", "?", 0, 0, 0},
+ {"gui print text", "wiiist", 0, 0, 0},
+ {"gui print text finished", "w", 0, 0, 0},
+ {"complete word", "?wssi", 0, 0, 0},
+ {"irssi init read settings", "", 0, 0, 0},
+ {"exec new", "p", 0, 0, 0},
+ {"exec remove", "pi", 0, 0, 0},
+ {"exec input", "ps", 0, 0, 0},
+ {"message public", "Sssss", 0, 0, 0},
+ {"message private", "Ssss", 0, 0, 0},
+ {"message own_public", "Sss", 0, 0, 0},
+ {"message own_private", "Ssss", 0, 0, 0},
+ {"message join", "Ssss", 0, 0, 0},
+ {"message part", "Sssss", 0, 0, 0},
+ {"message quit", "Ssss", 0, 0, 0},
+ {"message kick", "Ssssss", 0, 0, 0},
+ {"message nick", "Ssss", 0, 0, 0},
+ {"message own_nick", "Ssss", 0, 0, 0},
+ {"message invite", "Ssss", 0, 0, 0},
+ {"message topic", "Sssss", 0, 0, 0},
+ {"keyinfo created", "?", 0, 0, 0},
+ {"keyinfo destroyed", "?", 0, 0, 0},
+ {"print text", "tss", 0, 0, 0},
+ {"theme created", "?", 0, 0, 0},
+ {"theme destroyed", "?", 0, 0, 0},
+ {"window hilight", "w", 0, 0, 0},
+ {"window activity", "wi", 0, 0, 0},
+ {"window item hilight", "W", 0, 0, 0},
+ {"window item activity", "Wi", 0, 0, 0},
+ {"window item new", "wW", 0, 0, 0},
+ {"window item remove", "wW", 0, 0, 0},
+ {"window item changed", "wW", 0, 0, 0},
+ {"window item server changed", "wW", 0, 0, 0},
+ {"window created", "w", 0, 0, 0},
+ {"window destroyed", "w", 0, 0, 0},
+ {"window changed", "ww", 0, 0, 0},
+ {"window changed automatic", "w", 0, 0, 0},
+ {"window server changed", "wS", 0, 0, 0},
+ {"window refnum changed", "wi", 0, 0, 0},
+ {"window name changed", "w", 0, 0, 0},
+ {"window history changed", "ws", 0, 0, 0},
+ {"window level changed", "w", 0, 0, 0},
+ {"message irc op_public", "Sssss", 0, 0, 0},
+ {"message irc own_wall", "Sss", 0, 0, 0},
+ {"message irc own_action", "Sss", 0, 0, 0},
+ {"message irc action", "Sssss", 0, 0, 0},
+ {"message irc own_notice", "Sss", 0, 0, 0},
+ {"message irc notice", "Sssss", 0, 0, 0},
+ {"message irc own_ctcp", "Ssss", 0, 0, 0},
+ {"message irc ctcp", "Ssssss", 0, 0, 0},
+ {"message irc mode", "Sssss", 0, 0, 0},
+ {"message dcc own", "ds", 0, 0, 0},
+ {"message dcc own_action", "ds", 0, 0, 0},
+ {"message dcc own_ctcp", "dss", 0, 0, 0},
+ {"message dcc", "ds", 0, 0, 0},
+ {"message dcc action", "ds", 0, 0, 0},
+ {"message dcc ctcp", "dss", 0, 0, 0},
+ {"gui key pressed", "i", 0, 0, 0},
+ {"beep", "", 0, 0, 0},
+ {NULL}
};
#define py_sigmap_len() (sizeof(py_sigmap) / sizeof(py_sigmap[0]) - 1)
diff --git a/pysignals.c b/pysignals.c
index 518b3e0..daecea8 100644
--- a/pysignals.c
+++ b/pysignals.c
@@ -266,6 +266,7 @@ static void *py_py2i(char code, PyObject *pobj, int arg)
switch (code)
{
+ /* XXX: string doesn't (necssarily) persist */
case 's':
type = "str";
if (PyString_Check(pobj)) return PyString_AsString(pobj);
diff --git a/sig2code.awk b/sig2code.awk
new file mode 100644
index 0000000..d6bdb0d
--- /dev/null
+++ b/sig2code.awk
@@ -0,0 +1,61 @@
+BEGIN {
+ FS = "[ \t]*->[ \t]*";
+
+ #read in codes
+ while (getline < "sig2code.txt")
+ {
+ sub(/^[ \t]*/, "");
+ if (NF < 2)
+ continue;
+
+ #print $1, $2
+ sigmap[$2] = $1
+ }
+
+ close("sig2code.txt");
+
+ FS = "[ \t]*,[ \t]*";
+
+ print "/* Include in your C module */";
+ print "static PY_SIGNAL_SPEC_REC py_sigmap[] = {";
+}
+
+function match_type(t)
+{
+ for (type in sigmap)
+ {
+ if (index(t, type) != 0)
+ return sigmap[type];
+ }
+
+ return "?";
+}
+
+$1 ~ /^[ \t]*"/ && $1 !~ /"script error"/ {
+ sub(/^[ \t]*/, "");
+
+ signal = $1
+ if (signal ~ /.*<cmd>$/)
+ {
+ varsig = 1;
+ sub(/<cmd>/, "", signal);
+ }
+ else
+ varsig = 0;
+
+ args = "";
+ for (i = 2; i <= NF; i++)
+ {
+ args = args""match_type($i);
+ }
+
+ printf(" {%s, \"%s\", 0, 0, %d},\n", signal, args, varsig);
+}
+
+END {
+ print " {NULL}" ;
+ print "};";
+ print "";
+ print "#define py_sigmap_len() (sizeof(py_sigmap) / sizeof(py_sigmap[0]) - 1)";
+}
+
diff --git a/sig2code.py b/sig2code.py
deleted file mode 100644
index c0f2353..0000000
--- a/sig2code.py
+++ /dev/null
@@ -1,129 +0,0 @@
-import re
-import sys
-
-code_text = """
- Conversion codes notes
- I = int *arg IN/OUT
- G = string GList **arg IN/OUT (list must be reconstructed)
- L = list of nicks
-
- Scalars
- s -> char *
- u -> ulong *
- I -> int *
- i -> int
-
- Lists of things (completion.c and massjoin.c)
- G -> GList * of char*
- L -> GSList of NICK_RECs
-
- Chat objects
- c -> CHATNET_REC
- S -> SERVER_REC
- C -> CHANNEL_REC
- q -> QUERY_REC
- n -> NICK_REC
- W -> WI_ITEM_REC
-
- Irssi objects
- d -> DCC_REC
-
- Other objects
- r -> RECONNECT_REC
- o -> COMMAND_REC
- l -> LOG_REC
- a -> RAWLOG_REC
- g -> IGNORE_REC
- ? -> MODULE_REC
- b -> BAN_REC
- N -> NETSPLIT_REC
- e -> NETSPLIT_SERVER_REC
- ? -> AUTOIGNORE_REC
- O -> NOTIFYLIST_REC
- ? -> THEME_REC
- ? -> KEYINFO_REC
- p -> PROCESS_REC
- t -> TEXT_DEST_REC
- w -> WINDOW_REC
-"""
-
-#generate body of transcode function from the list of codes above
-def prepair():
- lines = code_text.split('\n')
- codes = []
- for ln in lines:
- m = re.match('^.*([a-zA-Z\?]) -> (.*)$', ln)
- if not m: continue
- code, match = m.groups()
- code = code.strip()
- match = match.strip()
-
- assert code == '?' or code not in codes, "dupe code, " + code
- codes.append(code)
-
- print "if arg.startswith('%s'): return '%s'" % (match, code)
-
-def transcode(arg):
- if arg.startswith('char *'): return 's'
- if arg.startswith('ulong *'): return 'u'
- if arg.startswith('int *'): return 'I'
- if arg.startswith('int'): return 'i'
- if arg.startswith('GList * of char*'): return 'G'
- if arg.startswith('GSList of NICK_RECs'): return 'L'
- if arg.startswith('CHATNET_REC'): return 'c'
- if arg.startswith('SERVER_REC'): return 'S'
- if arg.startswith('RECONNECT_REC'): return 'r'
- if arg.startswith('CHANNEL_REC'): return 'C'
- if arg.startswith('QUERY_REC'): return 'q'
- if arg.startswith('COMMAND_REC'): return 'o'
- if arg.startswith('NICK_REC'): return 'n'
- if arg.startswith('LOG_REC'): return 'l'
- if arg.startswith('RAWLOG_REC'): return 'a'
- if arg.startswith('IGNORE_REC'): return 'g'
- if arg.startswith('MODULE_REC'): return '?'
- if arg.startswith('BAN_REC'): return 'b'
- if arg.startswith('NETSPLIT_REC'): return 'N'
- if arg.startswith('NETSPLIT_SERVER_REC'): return 'e'
- if arg.startswith('DCC_REC'): return 'd'
- if arg.startswith('AUTOIGNORE_REC'): return '?'
- if arg.startswith('NOTIFYLIST_REC'): return 'O'
- if arg.startswith('THEME_REC'): return '?'
- if arg.startswith('KEYINFO_REC'): return '?'
- if arg.startswith('PROCESS_REC'): return 'p'
- if arg.startswith('TEXT_DEST_REC'): return 't'
- if arg.startswith('WINDOW_REC'): return 'w'
- if arg.startswith('WI_ITEM_REC'): return 'W'
- return '?'
-
-def main():
-
- print "/* Include in your C module */"
- print "static PY_SIGNAL_SPEC_REC py_sigmap[] = {"
-
- for ln in sys.stdin:
- ln = ln.strip()
- m = re.match('^\"([^\"]+)\"[^,]*,(.*)$', ln)
- if not m: continue
-
- signal, args = m.groups()
-
- if signal.startswith('script '): continue
- #if signal == 'command ': continue
-
- argv = [transcode(a.strip()) for a in args.split(',')]
- argv = ''.join(argv)
-
- is_var = 0
- if signal[-1] == ' ':
- is_var = 1
-
- print ' {"%s", "%s", 0, 0, %d},' % (signal, argv, is_var)
-
- print " {NULL}"
- print "};"
- print
- print "#define py_sigmap_len() (sizeof(py_sigmap) / sizeof(py_sigmap[0]) - 1)"
-
-if __name__ == '__main__':
- main()
-
diff --git a/sig2code.txt b/sig2code.txt
new file mode 100644
index 0000000..379e88e
--- /dev/null
+++ b/sig2code.txt
@@ -0,0 +1,44 @@
+ Conversion codes notes
+ I = int *arg IN/OUT
+ G = string GList **arg IN/OUT (list must be reconstructed)
+ L = list of nicks
+
+ Scalars
+ s -> char *
+ u -> ulong *
+ I -> int *
+ i -> int
+
+ Lists of things (completion.c and massjoin.c)
+ G -> GList * of char*
+ L -> GSList of NICK_RECs
+
+ Chat objects
+ c -> CHATNET_REC
+ S -> SERVER_REC
+ C -> CHANNEL_REC
+ q -> QUERY_REC
+ n -> NICK_REC
+ W -> WI_ITEM_REC
+
+ Irssi objects
+ d -> DCC_REC
+
+ Other objects
+ r -> RECONNECT_REC
+ o -> COMMAND_REC
+ l -> LOG_REC
+ a -> RAWLOG_REC
+ g -> IGNORE_REC
+ ? -> MODULE_REC
+ b -> BAN_REC
+ N -> NETSPLIT_REC
+ e -> NETSPLIT_SERVER_REC
+ ? -> AUTOIGNORE_REC
+ O -> NOTIFYLIST_REC
+ ? -> THEME_REC
+ ? -> KEYINFO_REC
+ p -> PROCESS_REC
+ t -> TEXT_DEST_REC
+ w -> WINDOW_REC
+