summaryrefslogtreecommitdiff
path: root/libopie2/tools
authormickeyl <mickeyl>2003-10-21 13:23:37 (UTC)
committer mickeyl <mickeyl>2003-10-21 13:23:37 (UTC)
commit76ca3158518a851085b5a5ebe3724d0c0c3be857 (patch) (side-by-side diff)
treec1e3cd417968e08a4f01497a431720f3088f0fa6 /libopie2/tools
parentfccc5d110dea3bc32176694c8e5fc7f014706be6 (diff)
downloadopie-76ca3158518a851085b5a5ebe3724d0c0c3be857.zip
opie-76ca3158518a851085b5a5ebe3724d0c0c3be857.tar.gz
opie-76ca3158518a851085b5a5ebe3724d0c0c3be857.tar.bz2
add clear text debug output for ioctls
Diffstat (limited to 'libopie2/tools') (more/less context) (ignore whitespace changes)
-rwxr-xr-xlibopie2/tools/regen.py64
1 files changed, 64 insertions, 0 deletions
diff --git a/libopie2/tools/regen.py b/libopie2/tools/regen.py
new file mode 100755
index 0000000..2f7f418
--- a/dev/null
+++ b/libopie2/tools/regen.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+
+#
+# regenerate ioctl_table.h
+#
+
+import sys
+import os
+result = os.popen( 'find /usr/include -name "*.h" |xargs grep -h SIOC|grep 0x' ).readlines()
+
+try:
+ tablehfile = file( sys.argv[1]+".h", "w" )
+except:
+ tablehfile = sys.stdout
+
+try:
+ tablecfile = file( sys.argv[1]+".cpp", "w" )
+except:
+ tablecfile = sys.stdout
+
+print >>tablehfile,"""
+/*
+ * ioctl table - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de>
+ */
+
+#ifndef IOCTLMAP_H
+#define IOCTLMAP_H
+
+#include <qstring.h>
+#include <qintdict.h>
+
+typedef QIntDict<QString> IntStringMap;
+
+IntStringMap* constructIoctlMap();
+
+#endif
+"""
+
+print >>tablecfile,"""
+/*
+ * ioctl table - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de>
+ */
+
+#include "%s"
+
+IntStringMap* constructIoctlMap()
+{
+\tIntStringMap* map = new IntStringMap();
+
+""" % (tablehfile.name)
+
+for line in result:
+ l = line.split()
+ if not l[0].startswith( "#define" ) or not l[2].startswith( "0x" ):
+ print >>sys.stderr, "can't parse line: %s" % l
+ continue
+ #print >>tablecfile, "\tqDebug( \"adding %s = %s\" );" % ( l[2], l[1] )
+ print >>tablecfile, "\tmap->insert( %s, new QString(\"%s\") );" % ( l[2], l[1] )
+
+
+print >>tablecfile,"""
+\treturn map;
+};
+""" \ No newline at end of file