Skip to content

Commit 75f759f

Browse files
authored
Merge pull request #1 from boriel/feature/standardize-grammar
Move api/ to src/api
2 parents bec023f + 12bcc54 commit 75f759f

94 files changed

Lines changed: 363 additions & 368 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,11 @@
66
.idea/
77
.python-version
88
.tox/
9-
/parsetab/parser.out
10-
/parsetab/zxbasmlextab.py
11-
/parsetab/zxbasmtab.py
12-
/parsetab/zxblextab.py
13-
/parsetab/zxbpptab.py
14-
/parsetab/zxbtab.py
159
MANIFEST
1610
dist/
1711
examples/*.bin
1812
examples/*.tzx
1913
scratch/
20-
.coverage
14+
.coverage/
2115
htmlcov/
2216
build/

arch/zx48k/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from . import beep
66
from .translator import * # noqa
77

8-
import api.global_
9-
from api.constants import TYPE
8+
import src.api.global_
9+
from src.api.constants import TYPE
1010

1111

1212
__all__ = [
@@ -17,10 +17,10 @@
1717
# -----------------------------------------
1818
# Arch initialization setup
1919
# -----------------------------------------
20-
api.global_.PARAM_ALIGN = 2 # Z80 param align
21-
api.global_.BOUND_TYPE = TYPE.uinteger
22-
api.global_.SIZE_TYPE = TYPE.ubyte
23-
api.global_.PTR_TYPE = TYPE.uinteger
24-
api.global_.STR_INDEX_TYPE = TYPE.uinteger
25-
api.global_.MIN_STRSLICE_IDX = 0 # Min. string slicing position
26-
api.global_.MAX_STRSLICE_IDX = 65534 # Max. string slicing position
20+
src.api.global_.PARAM_ALIGN = 2 # Z80 param align
21+
src.api.global_.BOUND_TYPE = TYPE.uinteger
22+
src.api.global_.SIZE_TYPE = TYPE.ubyte
23+
src.api.global_.PTR_TYPE = TYPE.uinteger
24+
src.api.global_.STR_INDEX_TYPE = TYPE.uinteger
25+
src.api.global_.MIN_STRSLICE_IDX = 0 # Min. string slicing position
26+
src.api.global_.MAX_STRSLICE_IDX = 65534 # Max. string slicing position

arch/zx48k/backend/__float.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# -----------------------------------------------------
1616
# Floating Point operators
1717
# -----------------------------------------------------
18-
from api import fp
18+
from src.api import fp
1919

2020

2121
def _float(op):

arch/zx48k/backend/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@
8686
# External functions
8787
from ..optimizer.helpers import HI16, LO16
8888
from arch.zx48k.optimizer.asm import Asm
89-
from api.config import OPTIONS
90-
import api.fp
89+
from src.api.config import OPTIONS
90+
import src.api.fp
9191

9292
from arch.zx48k.peephole import engine
9393

@@ -488,7 +488,7 @@ def _data(ins):
488488
size = "B"
489489
q = ['"%s"' % x.replace('"', '""') for x in q]
490490
elif t == 'f':
491-
dat_ = [api.fp.immediate_float(float(x)) for x in q]
491+
dat_ = [src.api.fp.immediate_float(float(x)) for x in q]
492492
for x in dat_:
493493
output.extend(['DEFB %s' % x[0], 'DEFW %s, %s' % (x[1], x[2])])
494494
return output

arch/zx48k/backend/__parray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# This module contains local array (both parameters and
1010
# comparation intermediate-code traductions
1111
# --------------------------------------------------------------
12-
from api import fp
12+
from src.api import fp
1313
from .__common import REQUIRES
1414
from .__float import _fpush
1515
from .__f16 import f16

arch/zx48k/backend/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33
# vim:ts=4:et:sw=4:
44

5-
from api.errors import Error
5+
from src.api.errors import Error
66

77
__all__ = ['GenericError',
88
'InvalidICError',

arch/zx48k/optimizer/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
from api.utils import flatten_list
3+
from src.api.utils import flatten_list
44
from arch.zx48k.peephole import engine
55

66
from .patterns import RE_PRAGMA, RE_LABEL
@@ -9,8 +9,8 @@
99
from .basicblock import DummyBasicBlock
1010
from . import basicblock
1111
from .labelinfo import LabelInfo
12-
from api.config import OPTIONS
13-
from api.debug import __DEBUG__
12+
from src.api.config import OPTIONS
13+
from src.api.debug import __DEBUG__
1414

1515

1616
def init():

arch/zx48k/optimizer/basicblock.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# -*- coding: utf-8 -*-
22

33
import arch
4-
import api.utils
5-
import api.config
4+
import src.api.utils
5+
import src.api.config
66

7-
from api.debug import __DEBUG__
8-
from api.identityset import IdentitySet
7+
from src.api.debug import __DEBUG__
8+
from src.api.identityset import IdentitySet
99
from .memcell import MemCell
1010
from .labelinfo import LabelInfo
1111
from .helpers import ALL_REGS, END_PROGRAM_LABEL
@@ -389,7 +389,7 @@ def is_used(self, regs, i, top=None):
389389

390390
return True
391391

392-
regs = api.utils.flatten_list([helpers.single_registers(x) for x in regs]) # make a copy
392+
regs = src.api.utils.flatten_list([helpers.single_registers(x) for x in regs]) # make a copy
393393
for ii in range(i, top):
394394
if any(r in regs for r in self.mem[ii].requires):
395395
return True
@@ -565,7 +565,7 @@ def optimize(self, patterns_list):
565565
'z': str(self.cpu.Z) if self.cpu.Z is not None else helpers.new_tmp_val()
566566
}.get(x.lower(), helpers.new_tmp_val())
567567

568-
if api.config.OPTIONS.optimization > 3:
568+
if src.api.config.OPTIONS.optimization > 3:
569569
regs, mems = self.guesses_initial_state_from_origin_blocks()
570570
else:
571571
regs, mems = {}, {}
@@ -591,8 +591,8 @@ def optimize(self, patterns_list):
591591
new_code = list(code)
592592
matched = new_code[i: i + len(p.patt)]
593593
new_code[i: i + len(p.patt)] = p.template.filter(match)
594-
api.errmsg.info('pattern applied [{}:{}]'.format("%03i" % p.flag, p.fname))
595-
api.debug.__DEBUG__('matched: \n {}'.format('\n '.join(matched)), level=1)
594+
src.api.errmsg.info('pattern applied [{}:{}]'.format("%03i" % p.flag, p.fname))
595+
src.api.debug.__DEBUG__('matched: \n {}'.format('\n '.join(matched)), level=1)
596596
changed = new_code != code
597597
if changed:
598598
code = new_code

arch/zx48k/optimizer/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
from api.errors import Error
3+
from src.api.errors import Error
44

55

66
class DuplicatedLabelError(Error):

arch/zx48k/optimizer/labelinfo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
from api.identityset import IdentitySet
3+
from src.api.identityset import IdentitySet
44
from . import common
55
from . import errors
66

0 commit comments

Comments
 (0)