-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #315 from kosarev/issue304_support_custom_emitters
[#304] Support custom code emitters.
- Loading branch information
Showing
7 changed files
with
90 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
from .binary import BinaryEmitter | ||
from .codeemitter import CodeEmitter | ||
from .tzx import TZX | ||
from .tap import TAP | ||
|
||
|
||
__all__ = [ | ||
'BinaryEmitter', | ||
'CodeEmitter', | ||
'TZX', | ||
'TAP', | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
# -------------------------------------------- | ||
# KopyLeft (K) 2008 | ||
# by Jose M. Rodriguez de la Rosa | ||
# | ||
# This program is licensed under the | ||
# GNU Public License v.3.0 | ||
# | ||
# The code emission interface. | ||
# -------------------------------------------- | ||
|
||
from .codeemitter import CodeEmitter | ||
|
||
|
||
class BinaryEmitter(CodeEmitter): | ||
""" Writes compiled code as raw binary data. | ||
""" | ||
def emit(self, output_filename, program_name, loader_bytes, entry_point, | ||
program_bytes, aux_bin_blocks, aux_headless_bin_blocks): | ||
""" Emits resulting binary file. | ||
""" | ||
with open(output_filename, 'wb') as f: | ||
f.write(bytearray(program_bytes)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
# -------------------------------------------- | ||
# KopyLeft (K) 2008 | ||
# by Jose M. Rodriguez de la Rosa | ||
# | ||
# This program is licensed under the | ||
# GNU Public License v.3.0 | ||
# | ||
# The code emission interface. | ||
# -------------------------------------------- | ||
|
||
|
||
class CodeEmitter(object): | ||
""" The base code emission interface. | ||
""" | ||
|
||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters