Browse Source

[Contribs] Fix multi-line POSIX errno definitions.

tags/v0.9.4
Stefan Hajnoczi 16 years ago
parent
commit
f3aef4d98d
1 changed files with 7 additions and 8 deletions
  1. 7
    8
      contrib/errcode/build_errcodedb.py

+ 7
- 8
contrib/errcode/build_errcodedb.py View File

22
             '../../src/arch/i386/include/bits/errfile.h')
22
             '../../src/arch/i386/include/bits/errfile.h')
23
 posix_errno_files = ('../../src/include/errno.h', )
23
 posix_errno_files = ('../../src/include/errno.h', )
24
 
24
 
25
-PXENV_STATUS_RE = re.compile(r'^#define\s+(PXENV_STATUS_[^\s]+)\s+(.+)$')
26
-ERRFILE_RE = re.compile(r'^#define\s+(ERRFILE_[^\s]+)\s+(.+)$')
27
-POSIX_ERRNO_RE = re.compile(r'^#define\s+(E[A-Z]+)\s+.*(0x[0-9a-f]+).*$')
25
+PXENV_STATUS_RE = re.compile(r'^#define\s+(PXENV_STATUS_[^\s]+)\s+(.+)$', re.M)
26
+ERRFILE_RE = re.compile(r'^#define\s+(ERRFILE_[^\s]+)\s+(.+)$', re.M)
27
+POSIX_ERRNO_RE = re.compile(r'^#define\s+(E[A-Z0-9]+)\s+(?:\\\n)?.*(0x[0-9a-f]+).*$', re.M)
28
 
28
 
29
 def err(msg):
29
 def err(msg):
30
     sys.stderr.write('%s: %s\n' % (sys.argv[0], msg))
30
     sys.stderr.write('%s: %s\n' % (sys.argv[0], msg))
41
 
41
 
42
 def load_header_file(filename, regexp):
42
 def load_header_file(filename, regexp):
43
     defines = {}
43
     defines = {}
44
-    for line in open(filename, 'r'):
45
-        m = regexp.match(line)
46
-        if m:
47
-            key, val = m.groups()
48
-            defines[key] = val
44
+    data = open(filename, 'r').read()
45
+    for m in regexp.finditer(data):
46
+        key, val = m.groups()
47
+        defines[key] = val
49
     return defines
48
     return defines
50
 
49
 
51
 def evaluate(defines, expr):
50
 def evaluate(defines, expr):

Loading…
Cancel
Save