annotate python/ppci/__init__.py @ 383:173e20a47fda

Added linker description loader
author Windel Bouwman
date Sun, 27 Apr 2014 17:40:39 +0200
parents d1ecc493384e
children
rev   line source
1
92df07bc2081 Initial import of compiler
windel
parents:
diff changeset
1 # File to make this directory a package.
92df07bc2081 Initial import of compiler
windel
parents:
diff changeset
2
106
f2d980eef509 improved code generation
Windel Bouwman
parents: 105
diff changeset
3 import sys
336
d1ecc493384e Added spiffy armtoken class for bit fiddeling. Added cool test that checks for build repeatability
Windel Bouwman
parents: 331
diff changeset
4 import os
106
f2d980eef509 improved code generation
Windel Bouwman
parents: 105
diff changeset
5
99
windel
parents: 96
diff changeset
6 version = '0.0.1'
windel
parents: 96
diff changeset
7
106
f2d980eef509 improved code generation
Windel Bouwman
parents: 105
diff changeset
8 # Assert python version:
f2d980eef509 improved code generation
Windel Bouwman
parents: 105
diff changeset
9 if sys.version_info.major != 3:
f2d980eef509 improved code generation
Windel Bouwman
parents: 105
diff changeset
10 print("Needs to be run in python version 3.x")
f2d980eef509 improved code generation
Windel Bouwman
parents: 105
diff changeset
11 sys.exit(1)
f2d980eef509 improved code generation
Windel Bouwman
parents: 105
diff changeset
12
191
6b2bec5653f1 Added assembler testset
Windel Bouwman
parents: 152
diff changeset
13 from .common import SourceLocation, SourceRange, Token
312
2c9768114877 Added cool logging formatter
Windel Bouwman
parents: 293
diff changeset
14 from .common import CompilerError, DiagnosticsManager
331
a78b41ff6ad2 Added better recipe files
Windel Bouwman
parents: 312
diff changeset
15
a78b41ff6ad2 Added better recipe files
Windel Bouwman
parents: 312
diff changeset
16 logformat='%(asctime)s|%(levelname)s|%(name)s|%(message)s'
a78b41ff6ad2 Added better recipe files
Windel Bouwman
parents: 312
diff changeset
17
336
d1ecc493384e Added spiffy armtoken class for bit fiddeling. Added cool test that checks for build repeatability
Windel Bouwman
parents: 331
diff changeset
18 def same_dir(full_path, filename):
d1ecc493384e Added spiffy armtoken class for bit fiddeling. Added cool test that checks for build repeatability
Windel Bouwman
parents: 331
diff changeset
19 return os.path.join(os.path.dirname(os.path.abspath(full_path)), filename)
383
173e20a47fda Added linker description loader
Windel Bouwman
parents: 336
diff changeset
20
173e20a47fda Added linker description loader
Windel Bouwman
parents: 336
diff changeset
21
173e20a47fda Added linker description loader
Windel Bouwman
parents: 336
diff changeset
22 def make_num(txt):
173e20a47fda Added linker description loader
Windel Bouwman
parents: 336
diff changeset
23 if txt.startswith('0x'):
173e20a47fda Added linker description loader
Windel Bouwman
parents: 336
diff changeset
24 return int(txt[2:], 16)
173e20a47fda Added linker description loader
Windel Bouwman
parents: 336
diff changeset
25 else:
173e20a47fda Added linker description loader
Windel Bouwman
parents: 336
diff changeset
26 return int(txt)
173e20a47fda Added linker description loader
Windel Bouwman
parents: 336
diff changeset
27