summaryrefslogtreecommitdiffstats
path: root/src/constants.awk
blob: 3aa5034ce5ae9fcace783f4d097f5a833e4250b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
BEGIN {
    print "#include \"pymodule.h\"";
    print "#include \"pyirssi_irc.h\"";
    print
    print "void pyconstants_init(void)"
    print "{"
}

{
    if (NF >= 2)
        constant = $2;
    else
        constant = $1;

    printf("    PyModule_AddIntConstant(py_module, \"%s\", %s);\n", $1, constant);
}

END {
    print "}"
}