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) (unidiff)
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 @@
1#!/usr/bin/env python
2
3#
4# regenerate ioctl_table.h
5#
6
7import sys
8import os
9result = os.popen( 'find /usr/include -name "*.h" |xargs grep -h SIOC|grep 0x' ).readlines()
10
11try:
12 tablehfile = file( sys.argv[1]+".h", "w" )
13except:
14 tablehfile = sys.stdout
15
16try:
17 tablecfile = file( sys.argv[1]+".cpp", "w" )
18except:
19 tablecfile = sys.stdout
20
21print >>tablehfile,"""
22/*
23 * ioctl table - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de>
24 */
25
26#ifndef IOCTLMAP_H
27#define IOCTLMAP_H
28
29#include <qstring.h>
30#include <qintdict.h>
31
32typedef QIntDict<QString> IntStringMap;
33
34IntStringMap* constructIoctlMap();
35
36#endif
37"""
38
39print >>tablecfile,"""
40/*
41 * ioctl table - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de>
42 */
43
44#include "%s"
45
46IntStringMap* constructIoctlMap()
47{
48\tIntStringMap* map = new IntStringMap();
49
50""" % (tablehfile.name)
51
52for line in result:
53 l = line.split()
54 if not l[0].startswith( "#define" ) or not l[2].startswith( "0x" ):
55 print >>sys.stderr, "can't parse line: %s" % l
56 continue
57 #print >>tablecfile, "\tqDebug( \"adding %s = %s\" );" % ( l[2], l[1] )
58 print >>tablecfile, "\tmap->insert( %s, new QString(\"%s\") );" % ( l[2], l[1] )
59
60
61print >>tablecfile,"""
62\treturn map;
63};
64""" \ No newline at end of file