Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: tools/nacl_elf_constants.py

Issue 4181005: Fixes some bugs with memory setup and halt-sled allocation and... (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/elf_patcher.py ('k') | tools/set_abi_version.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 #!/usr/bin/python
2
3 # Copyright 2010 The Native Client Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can
5 # be found in the LICENSE file.
6
7 import re
8
9 def GetNaClElfConstants(header_file):
10
11 symbols = [ 'ELFOSABI_NACL',
12 'EF_NACL_ALIGN_MASK',
13 'EF_NACL_ALIGN_16',
14 'EF_NACL_ALIGN_32',
15 'EF_NACL_ALIGN_LIB',
16 'EF_NACL_ABIVERSION',
17 ]
18
19 extractors = [ r'#\s*define\s+%s\s+([x\d]+)' % s
20 for s in symbols ]
21
22 nfas = [ re.compile(extractor) for extractor in extractors ]
23 results = len(extractors) * [ -1 ]
24 for line in open(header_file):
25 for ix, nfa in enumerate(nfas):
26 m = nfa.search(line)
27 if m is not None:
28 results[ix] = int(m.group(1), 0)
29 continue
30 if -1 in results:
31 raise RuntimeError, 'Could not parse header file %s' % header_file
32 return dict(zip(symbols, results))
OLDNEW
« no previous file with comments | « tools/elf_patcher.py ('k') | tools/set_abi_version.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698