[pypy-svn] r24930 - in pypy/dist/pypy/translator/c: . winproj/extension
tismer at codespeak.net
tismer at codespeak.net
Fri Mar 24 05:03:18 CET 2006
Author: tismer
Date: Fri Mar 24 05:03:14 2006
New Revision: 24930
Modified:
pypy/dist/pypy/translator/c/genc.py
pypy/dist/pypy/translator/c/winproj/extension/extension.vcproj
Log:
supporting class export
Modified: pypy/dist/pypy/translator/c/genc.py
==============================================================================
--- pypy/dist/pypy/translator/c/genc.py (original)
+++ pypy/dist/pypy/translator/c/genc.py Fri Mar 24 05:03:14 2006
@@ -31,8 +31,9 @@
if libraries is None:
libraries = []
self.libraries = libraries
+ self.exports = {}
- def build_database(self):
+ def build_database(self, exports=[]):
translator = self.translator
db = LowLevelDatabase(translator, standalone=self.standalone,
gcpolicy=self.gcpolicy, thread_enabled=self.thread_enabled)
@@ -53,7 +54,16 @@
# some needed things. Find out why.
pf = self.getentrypointptr()
pfname = db.get(pf)
- # XXX
+ self.exports[self.entrypoint.func_name] = pf
+ for obj in exports:
+ po = self.getentrypointptr(obj)
+ poname = objname = db.get(po)
+ if hasattr(obj, '__name__'):
+ objname = obj.__name__
+ if objname in self.exports:
+ raise NameError, 'duplicate name in export: %s is %s and %s' % (
+ objname, db.get(self.exports[objname]), poname)
+ self.exports[objname] = po
db.complete()
return db
@@ -80,7 +90,7 @@
self.symboltable = SymbolTable()
cfile, extra = gen_source(db, modulename, targetdir,
defines = defines,
- exports = {self.entrypoint.func_name: pf},
+ exports = self.exports,
symboltable = self.symboltable)
else:
if CBuilder.have___thread:
@@ -105,8 +115,10 @@
standalone = False
c_ext_module = None
- def getentrypointptr(self):
- return lltype.pyobjectptr(self.entrypoint)
+ def getentrypointptr(self, obj=None):
+ if obj is None:
+ obj = self.entrypoint
+ return lltype.pyobjectptr(obj)
def compile(self):
assert self.c_source_filename
Modified: pypy/dist/pypy/translator/c/winproj/extension/extension.vcproj
==============================================================================
--- pypy/dist/pypy/translator/c/winproj/extension/extension.vcproj (original)
+++ pypy/dist/pypy/translator/c/winproj/extension/extension.vcproj Fri Mar 24 05:03:14 2006
@@ -208,10 +208,7 @@
</File>
</Filter>
<File
- RelativePath="..\..\..\..\..\..\..\Documents and Settings\ctismer\Local Settings\Temp\usession-829\testing_1\common_header.h">
- </File>
- <File
- RelativePath="..\..\..\..\..\..\..\Documents and Settings\ctismer\Local Settings\Temp\usession-829\testing_1\testing_1.c">
+ RelativePath="..\..\..\..\..\..\..\Documents and Settings\ctismer\Local Settings\Temp\usession-964\testing_1\testing_1.c">
</File>
</Files>
<Globals>
More information about the Pypy-commit
mailing list