|
From: Philip H. <red...@gc...> - 2013-07-04 22:05:41
|
Hey all,
Spent last few days making the intial proof of concept work to make
imports work.
So far you can compile:
foo1.py:
import foo2
print foo2.test (1)
foo2.py:
def test (x):
return x + 1
print test (5)
Philips-MacBook:gccpy-build redbrain$ cat Maketest
all:
gccpy -O0 -fdump-tree-gimple -fpy-dump-dot -c foo2.py -o foo2.o
gccpy -O0 -fdump-tree-gimple -fpy-dump-dot -fpy-gen-main -c
foo1.py -o foo1.o
gccpy -O0 -o test foo1.o foo2.o
Philips-MacBook:gccpy-build redbrain$ make -f Maketest
gccpy -O0 -fdump-tree-gimple -fpy-dump-dot -c foo2.py -o foo2.o
DEBUG: <../../gccpy/gcc/python/gpy-data-export.cc:36> Trying to write
export data to foo2.export.gpyx
gccpy -O0 -fdump-tree-gimple -fpy-dump-dot -fpy-gen-main -c foo1.py -o foo1.o
DEBUG: <../../gccpy/gcc/python/gpy-data-export.cc:73> Trying to lookup
module data on foo2
DEBUG: <../../gccpy/gcc/python/gpy-data-export.cc:81> Trying to open
<./foo2.export.gpyx>
DEBUG: <../../gccpy/gcc/python/gpy-data-export.cc:36> Trying to write
export data to foo1.export.gpyx
gccpy -O0 -o test foo1.o foo2.o
Philips-MacBook:gccpy-build redbrain$ python foo1.py
6
2
Philips-MacBook:gccpy-build redbrain$ ./test
6
2
So its the initial proof of concept working now export information for
the module intitilizer hooks are dumped out at compile time to
modulename.export.gpyx
hilips-MacBook:gccpy-build redbrain$ cat foo*.export.gpyx
MODULE "foo1" {
HAS_MAIN True
ENTRY "foo1.__main_start__"
}
MODULE "foo2" {
HAS_MAIN False
ENTRY "foo2.__main_start__"
}
This will eventually contain more info over time probably the
gccpy-types.dot info in there would be useful at some point but its ok
for now.
--Phil
|