[pypy-svn] r70019 - in pypy/branch/sepcomp/pypy/translator: c c/src llsupport
xoraxax at codespeak.net
xoraxax at codespeak.net
Wed Dec 9 13:11:57 CET 2009
Author: xoraxax
Date: Wed Dec 9 13:11:56 2009
New Revision: 70019
Modified:
pypy/branch/sepcomp/pypy/translator/c/extfunc.py
pypy/branch/sepcomp/pypy/translator/c/src/exception.h
pypy/branch/sepcomp/pypy/translator/c/src/g_include.h
pypy/branch/sepcomp/pypy/translator/c/src/support.h
pypy/branch/sepcomp/pypy/translator/llsupport/wrapper.py
Log:
Add support for PYPY_EXTMODULE and config.translation.generatemodule.
Modified: pypy/branch/sepcomp/pypy/translator/c/extfunc.py
==============================================================================
--- pypy/branch/sepcomp/pypy/translator/c/extfunc.py (original)
+++ pypy/branch/sepcomp/pypy/translator/c/extfunc.py Wed Dec 9 13:11:56 2009
@@ -106,7 +106,7 @@
yield ('RPYTHON_EXCEPTION_MATCH', exceptiondata.fn_exception_match)
yield ('RPYTHON_TYPE_OF_EXC_INST', exceptiondata.fn_type_of_exc_inst)
yield ('RPYTHON_RAISE_OSERROR', exceptiondata.fn_raise_OSError)
- if not db.standalone:
+ if not db.standalone and not db.translator.config.translation.generatemodule:
yield ('RPYTHON_PYEXCCLASS2EXC', exceptiondata.fn_pyexcclass2exc)
yield ('RPyExceptionOccurred1', exctransformer.rpyexc_occured_ptr.value)
Modified: pypy/branch/sepcomp/pypy/translator/c/src/exception.h
==============================================================================
--- pypy/branch/sepcomp/pypy/translator/c/src/exception.h (original)
+++ pypy/branch/sepcomp/pypy/translator/c/src/exception.h Wed Dec 9 13:11:56 2009
@@ -2,7 +2,7 @@
/************************************************************/
/*** C header subsection: exceptions ***/
-#if !defined(PYPY_STANDALONE) && !defined(PYPY_NOT_MAIN_FILE)
+#if !defined(PYPY_STANDALONE) && !defined(PYPY_NOT_MAIN_FILE) && !defined(PYPY_EXTMODULE)
PyObject *RPythonError;
#endif
@@ -59,7 +59,7 @@
#define RPyRaiseSimpleException(exc, msg) _RPyRaiseSimpleException(R##exc)
void _RPyRaiseSimpleException(RPYTHON_EXCEPTION rexc);
-#ifndef PYPY_STANDALONE
+#if !defined(PYPY_STANDALONE) && !defined(PYPY_EXTMODULE)
void RPyConvertExceptionFromCPython(void);
void RPyConvertExceptionToCPython(void);
#endif
@@ -74,7 +74,7 @@
RPyRaiseException(RPYTHON_TYPE_OF_EXC_INST(rexc), rexc);
}
-#ifndef PYPY_STANDALONE
+#if !defined(PYPY_STANDALONE) && !defined(PYPY_EXTMODULE)
void RPyConvertExceptionFromCPython(void)
{
/* convert the CPython exception to an RPython one */
@@ -115,7 +115,7 @@
PyErr_NormalizeException(&pycls, &v, &tb);
PyErr_Restore(pycls, v, tb);
}
-#endif /* !PYPY_STANDALONE */
+#endif /* !PYPY_STANDALONE && !PYPY_EXTMODULE */
#endif /* PYPY_NOT_MAIN_FILE */
Modified: pypy/branch/sepcomp/pypy/translator/c/src/g_include.h
==============================================================================
--- pypy/branch/sepcomp/pypy/translator/c/src/g_include.h (original)
+++ pypy/branch/sepcomp/pypy/translator/c/src/g_include.h Wed Dec 9 13:11:56 2009
@@ -2,7 +2,7 @@
/************************************************************/
/*** C header file for code produced by genc.py ***/
-#ifndef PYPY_STANDALONE
+#if !defined(PYPY_STANDALONE) && !defined(PYPY_EXTMODULE)
# include "Python.h"
# include "compile.h"
# include "frameobject.h"
@@ -23,7 +23,7 @@
#define PY_LONG_LONG long long
#endif
-#ifndef PYPY_STANDALONE
+#if !defined(PYPY_STANDALONE) && !defined(PYPY_EXTMODULE)
# include "src/pyobj.h"
#endif
Modified: pypy/branch/sepcomp/pypy/translator/c/src/support.h
==============================================================================
--- pypy/branch/sepcomp/pypy/translator/c/src/support.h (original)
+++ pypy/branch/sepcomp/pypy/translator/c/src/support.h Wed Dec 9 13:11:56 2009
@@ -99,7 +99,7 @@
# define RPyBareItem(array, index) ((array)[index])
#endif
-#ifndef PYPY_STANDALONE
+#if !defined(PYPY_STANDALONE) && !defined(PYPY_EXTMODULE)
/* prototypes */
Modified: pypy/branch/sepcomp/pypy/translator/llsupport/wrapper.py
==============================================================================
--- pypy/branch/sepcomp/pypy/translator/llsupport/wrapper.py (original)
+++ pypy/branch/sepcomp/pypy/translator/llsupport/wrapper.py Wed Dec 9 13:11:56 2009
@@ -19,6 +19,9 @@
graph = bk.getdesc(func).getuniquegraph()
f = getfunctionptr(graph)
+ if translator.config.translation.generatemodule:
+ return f
+
FUNCTYPE = typeOf(f).TO
newops = LowLevelOpList(translator.rtyper)
@@ -74,5 +77,6 @@
PyObjPtr),
wgraph.name,
graph = wgraph,
- exception_policy = "CPython")
+ exception_policy = "CPython",
+ _exported=True)
More information about the Pypy-commit
mailing list