summaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
Diffstat (limited to 'project')
-rw-r--r--project/pyexts.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/project/pyexts.c b/project/pyexts.c
index cec86e9..44af123 100644
--- a/project/pyexts.c
+++ b/project/pyexts.c
@@ -156,7 +156,7 @@ static void pyext_uppercase(char * buf, const char * name)
*dst = 0;
}
-int main(void)
+int main(int argc, char ** argv)
{
const struct pyext_meta * p;
size_t nlen;
@@ -171,6 +171,39 @@ int main(void)
const char * name;
char uname[64];
+ if ((argc == 2) && !strcmp(argv[1],"--py-init-func")) {
+ for (p=pyexts; p->name; p++)
+ printf("PY_INIT_FUNC(init%s);\n",p->name);
+
+ return 0;
+ }
+
+ if ((argc == 2) && !strcmp(argv[1],"--init-func-ptr")) {
+ for (p=pyexts; p->name; p++) {
+ nlen = strlen(p->name);
+
+ if (nlen <= 3)
+ dtab = "\t\t\t";
+
+ else if (nlen <= 11)
+ dtab = "\t\t";
+
+ else
+ dtab = "\t";
+
+ if (nlen <= 9)
+ rtab = "\t\t";
+
+ else
+ rtab = "\t";
+
+ printf("\t{\"%s\",%sinit%s},%s\\\n",
+ p->name,dtab,p->name,rtab);
+ }
+
+ return 0;
+ }
+
for (p=pyexts; p->name; p++) {
/* init */
name = (p->name[0] == '_') ? &p->name[1] : p->name;