mirror of https://github.com/Nonannet/copapy.git
compilation added
This commit is contained in:
parent
306f86d977
commit
4d5777304f
|
|
@ -19,6 +19,9 @@ jobs:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup cross compilers
|
||||||
|
run: sudo apt-get update && sudo apt-get install -y mingw-w64
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
|
|
@ -32,6 +35,12 @@ jobs:
|
||||||
- name: Build ops obj file
|
- name: Build ops obj file
|
||||||
run: bash build_ops_obj.sh
|
run: bash build_ops_obj.sh
|
||||||
|
|
||||||
|
- name: Build runner
|
||||||
|
run: |
|
||||||
|
mkdir runner/bin
|
||||||
|
gcc runner/runmem2.c -Wall -O2 -o runner/bin/runmem2
|
||||||
|
x86_64-w64-mingw32-gcc runner/runmem2.c -Wall -O2 -o runner/bin/runmem2.exe
|
||||||
|
|
||||||
#- name: Lint code with flake8
|
#- name: Lint code with flake8
|
||||||
# run: flake8
|
# run: flake8
|
||||||
|
|
||||||
|
|
@ -47,3 +56,9 @@ jobs:
|
||||||
with:
|
with:
|
||||||
name: object files
|
name: object files
|
||||||
path: src/copapy/obj/*.o
|
path: src/copapy/obj/*.o
|
||||||
|
|
||||||
|
- name: Upload compiled runner
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: runner
|
||||||
|
path: runner/bin/*
|
||||||
|
|
@ -10,3 +10,4 @@ __pycache__
|
||||||
tests/autogenerated_*.py
|
tests/autogenerated_*.py
|
||||||
*test*.o
|
*test*.o
|
||||||
/src/copapy/obj/ops*.o
|
/src/copapy/obj/ops*.o
|
||||||
|
test.copapy
|
||||||
|
|
@ -369,6 +369,11 @@ def compile_to_instruction_list(end_nodes: Iterable[Node] | Node) -> binw.data_w
|
||||||
dw.write_int(patch_type)
|
dw.write_int(patch_type)
|
||||||
dw.write_int(object_addr)
|
dw.write_int(object_addr)
|
||||||
|
|
||||||
print('-----')
|
# set entry point
|
||||||
|
dw.write_com(binw.Command.SET_ENTR_POINT)
|
||||||
|
dw.write_int(0)
|
||||||
|
|
||||||
|
# run program command
|
||||||
|
dw.write_com(binw.Command.END_PROG)
|
||||||
|
|
||||||
return dw
|
return dw
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
from copapy import Write, const
|
from copapy import Write, const
|
||||||
import copapy as rc
|
import copapy as rc
|
||||||
|
|
||||||
|
|
||||||
def test_compile():
|
def test_compile():
|
||||||
c1 = const(1.11)
|
c1 = const(1.11)
|
||||||
c2 = const(2.22)
|
c2 = const(2.22)
|
||||||
|
|
@ -17,6 +18,8 @@ def test_compile():
|
||||||
|
|
||||||
print('#', il.print())
|
print('#', il.print())
|
||||||
|
|
||||||
|
il.to_file('test.copapy')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_compile()
|
test_compile()
|
||||||
Loading…
Reference in New Issue