[pypy-svn] r18285 - in pypy/dist/pypy/translator/c: . src
tismer at codespeak.net
tismer at codespeak.net
Sat Oct 8 16:09:59 CEST 2005
Author: tismer
Date: Sat Oct 8 16:09:53 2005
New Revision: 18285
Modified:
pypy/dist/pypy/translator/c/genc.py
pypy/dist/pypy/translator/c/src/debuginfo.h
pypy/dist/pypy/translator/c/src/exception.h
pypy/dist/pypy/translator/c/src/int.h
pypy/dist/pypy/translator/c/src/ll_math.h
pypy/dist/pypy/translator/c/src/ll_os.h
pypy/dist/pypy/translator/c/src/ll_strtod.h
pypy/dist/pypy/translator/c/src/ll_thread.h
pypy/dist/pypy/translator/c/src/ll_time.h
pypy/dist/pypy/translator/c/src/main.h
pypy/dist/pypy/translator/c/src/module.h
pypy/dist/pypy/translator/c/src/rtyper.h
pypy/dist/pypy/translator/c/src/support.h
pypy/dist/pypy/translator/c/src/thread_nt.h
pypy/dist/pypy/translator/c/src/thread_pthread.h
pypy/dist/pypy/translator/c/src/trace.h
Log:
modified all include files to support inclusion into
a non-main module.
Modified: pypy/dist/pypy/translator/c/genc.py
==============================================================================
--- pypy/dist/pypy/translator/c/genc.py (original)
+++ pypy/dist/pypy/translator/c/genc.py Sat Oct 8 16:09:53 2005
@@ -204,7 +204,10 @@
print >> fc, '/***********************************************************/'
print >> fc, '/*** Structure Implementations ***/'
print >> fc
+ print >> fc, '#define PYPY_NOT_MAIN_FILE'
print >> fc, '#include "common_header.h"'
+ print >> fc, '#include "structdef.h"'
+ print >> fc, '#include "forwarddecl.h"'
print >> fc
for node in structdeflist:
for line in node.definition(phase=2):
@@ -218,6 +221,7 @@
print >> fc, '/***********************************************************/'
print >> fc, '/*** Implementations ***/'
print >> fc
+ print >> fc, '#define PYPY_NOT_MAIN_FILE'
print >> fc, '#include "common_header.h"'
print >> fc, '#include "structdef.h"'
print >> fc, '#include "forwarddecl.h"'
@@ -225,7 +229,6 @@
for line in self.preimpl:
print >> fc, line
print >> fc
- print >> fc, '#define PYPY_NOT_MAIN_FILE'
print >> fc, '#include "src/g_include.h"'
print >> fc
for node in nodes:
Modified: pypy/dist/pypy/translator/c/src/debuginfo.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/debuginfo.h (original)
+++ pypy/dist/pypy/translator/c/src/debuginfo.h Sat Oct 8 16:09:53 2005
@@ -11,6 +11,16 @@
{ "debuginfo_global", debuginfo_global, METH_VARARGS }, \
{ "debuginfo_peek", debuginfo_peek, METH_VARARGS },
+/* prototypes */
+
+static PyObject *debuginfo_offset(PyObject *self, PyObject *args);
+static PyObject *debuginfo_global(PyObject *self, PyObject *args);
+static PyObject *debuginfo_peek(PyObject *self, PyObject *args);
+
+
+/* implementations */
+
+#ifndef PYPY_NOT_MAIN_FILE
static PyObject *debuginfo_offset(PyObject *self, PyObject *args)
{
@@ -40,3 +50,5 @@
return NULL;
return PyString_FromStringAndSize((char *)start, size);
}
+
+#endif /* PYPY_NOT_MAIN_FILE */
Modified: pypy/dist/pypy/translator/c/src/exception.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/exception.h (original)
+++ pypy/dist/pypy/translator/c/src/exception.h Sat Oct 8 16:09:53 2005
@@ -30,7 +30,19 @@
(RPYTHON_EXCEPTION_VTABLE) etype)
#ifndef PYPY_STANDALONE
-static void RPyConvertExceptionFromCPython(void)
+
+
+/* prototypes */
+
+void RPyConvertExceptionFromCPython(void);
+void _RPyConvertExceptionToCPython(void);
+
+
+/* implementations */
+
+#ifndef PYPY_NOT_MAIN_FILE
+
+void RPyConvertExceptionFromCPython(void)
{
/* convert the CPython exception to an RPython one */
PyObject *exc_type, *exc_value, *exc_tb;
@@ -42,7 +54,7 @@
rpython_exc_type = RPYTHON_TYPE_OF_EXC_INST(rpython_exc_value);
}
-static void _RPyConvertExceptionToCPython(void)
+void _RPyConvertExceptionToCPython(void)
{
/* XXX 1. uses officially bad fishing */
/* XXX 2. looks for exception classes by name, fragile */
@@ -61,6 +73,8 @@
}
}
+#endif /* PYPY_NOT_MAIN_FILE */
+
#define RPyConvertExceptionToCPython(vanishing) \
_RPyConvertExceptionToCPython(); \
vanishing = rpython_exc_value; \
Modified: pypy/dist/pypy/translator/c/src/int.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/int.h (original)
+++ pypy/dist/pypy/translator/c/src/int.h Sat Oct 8 16:09:53 2005
@@ -171,6 +171,15 @@
#ifndef HAVE_LONG_LONG
/* adjusted from intobject.c, Python 2.3.3 */
+
+/* prototypes */
+
+op_int_mul_ovf(long a, long b, long *longprod);
+
+/* implementations */
+
+#ifndef PYPY_NOT_MAIN_FILE
+
int
op_int_mul_ovf(long a, long b, long *longprod)
{
@@ -203,10 +212,21 @@
return 0;
}
}
+
+#endif /* PYPY_NOT_MAIN_FILE */
+
#endif /* HAVE_LONG_LONG */
/* XXX we might probe the compiler whether it does what we want */
+/* prototypes */
+
+long op_divmod_adj(long x, long y, long *p_rem);
+
+/* implementations */
+
+#ifndef PYPY_NOT_MAIN_FILE
+
long op_divmod_adj(long x, long y, long *p_rem)
{
long xdivy = x / y;
@@ -225,6 +245,9 @@
*p_rem = xmody;
return xdivy;
}
+
+#endif /* PYPY_NOT_MAIN_FILE */
+
/* no editing below this point */
/* following lines are generated by mkuint.py */
Modified: pypy/dist/pypy/translator/c/src/ll_math.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/ll_math.h (original)
+++ pypy/dist/pypy/translator/c/src/ll_math.h Sat Oct 8 16:09:53 2005
@@ -11,6 +11,47 @@
/* xxx this 2.3 name is later deprecated */
#define LL_MATH_SET_ERANGE_IF_MATH_ERROR Py_SET_ERANGE_IF_OVERFLOW
+#define LL_MATH_ERROR_RESET errno = 0
+
+#define LL_MATH_CHECK_ERROR(x, errret) do { \
+ LL_MATH_SET_ERANGE_IF_MATH_ERROR(x); \
+ if (errno && ll_math_is_error(x)) \
+ return errret; \
+} while(0)
+
+
+/* prototypes */
+
+int ll_math_is_error(double x);
+double LL_math_pow(double x, double y);
+RPyFREXP_RESULT* LL_math_frexp(double x);
+double LL_math_atan2(double x, double y);
+double LL_math_fmod(double x, double y);
+double LL_math_ldexp(double x, long y);
+double LL_math_hypot(double x, double y);
+RPyMODF_RESULT* LL_math_modf(double x);
+double LL_math_acos(double x);
+double LL_math_asin(double x);
+double LL_math_atan(double x);
+double LL_math_ceil(double x);
+double LL_math_cos(double x);
+double LL_math_cosh(double x);
+double LL_math_exp(double x);
+double LL_math_fabs(double x);
+double LL_math_floor(double x);
+double LL_math_log(double x);
+double LL_math_log10(double x);
+double LL_math_sin(double x);
+double LL_math_sinh(double x);
+double LL_math_sqrt(double x);
+double LL_math_tan(double x);
+double LL_math_tanh(double x);
+
+
+/* implementations */
+
+#ifndef PYPY_NOT_MAIN_FILE
+
int ll_math_is_error(double x) {
if (errno == ERANGE) {
if (!x)
@@ -22,17 +63,6 @@
return 1;
}
-#define LL_MATH_ERROR_RESET errno = 0
-
-#define LL_MATH_CHECK_ERROR(x, errret) do { \
- LL_MATH_SET_ERANGE_IF_MATH_ERROR(x); \
- if (errno && ll_math_is_error(x)) \
- return errret; \
-} while(0)
-
-
-
-
double LL_math_pow(double x, double y) {
double r;
LL_MATH_ERROR_RESET;
@@ -220,3 +250,5 @@
LL_MATH_CHECK_ERROR(r, -1.0);
return r;
}
+
+#endif /* PYPY_NOT_MAIN_FILE */
Modified: pypy/dist/pypy/translator/c/src/ll_os.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/ll_os.h (original)
+++ pypy/dist/pypy/translator/c/src/ll_os.h Sat Oct 8 16:09:53 2005
@@ -36,6 +36,28 @@
#endif
+/* prototypes */
+
+RPySTAT_RESULT* _stat_construct_result_helper(STRUCT_STAT st);
+RPySTAT_RESULT* LL_os_stat(RPyString * fname);
+RPySTAT_RESULT* LL_os_fstat(long fd);
+long LL_os_lseek(long fd, long pos, long how);
+long LL_os_isatty(long fd);
+RPyString *LL_os_strerror(int errnum);
+long LL_os_system(RPyString * fname);
+void LL_os_unlink(RPyString * fname);
+RPyString *LL_os_getcwd(void);
+void LL_os_chdir(RPyString * path);
+void LL_os_mkdir(RPyString * path, int mode);
+void LL_os_rmdir(RPyString * path);
+void LL_os_putenv(RPyString * name_eq_value);
+void LL_os_unsetenv(RPyString * name);
+RPyString* LL_os_environ(int idx);
+
+/* implementations */
+
+#ifndef PYPY_NOT_MAIN_FILE
+
int LL_os_open(RPyString *filename, int flag, int mode)
{
/* XXX unicode_file_names */
@@ -169,8 +191,7 @@
}
}
-RPyString *LL_os_getcwd(void)
-{
+RPyString *LL_os_getcwd(void) {
char buf[PATH_MAX];
char *res;
res = getcwd(buf, sizeof buf);
@@ -246,3 +267,4 @@
}
return rs;
}
+#endif /* PYPY_NOT_MAIN_FILE */
Modified: pypy/dist/pypy/translator/c/src/ll_strtod.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/ll_strtod.h (original)
+++ pypy/dist/pypy/translator/c/src/ll_strtod.h Sat Oct 8 16:09:53 2005
@@ -1,6 +1,18 @@
#include <locale.h>
#include <ctype.h>
+
+/* prototypes */
+
+double LL_strtod_parts_to_float(RPyString *sign, RPyString *beforept,
+ RPyString *afterpt, RPyString *exponent);
+RPyString *LL_strtod_formatd(RPyString *fmt, double x);
+
+
+/* implementations */
+
+#ifndef PYPY_NOT_MAIN_FILE
+
double LL_strtod_parts_to_float(
RPyString *sign,
RPyString *beforept,
@@ -107,3 +119,5 @@
return RPyString_FromString(buffer);
}
+
+#endif /* PYPY_NOT_MAIN_FILE */
Modified: pypy/dist/pypy/translator/c/src/ll_thread.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/ll_thread.h (original)
+++ pypy/dist/pypy/translator/c/src/ll_thread.h Sat Oct 8 16:09:53 2005
@@ -10,6 +10,27 @@
* - the macro redefining LL_thread_newlock (produced by genc) is not defined
* yet
*/
+
+#define RPyOpaque_SETUP_ThreadLock(lock, initially_locked) \
+ if (!RPyThreadLockInit(lock)) \
+ error = "Thread lock init error"; \
+ else if ((initially_locked) && !RPyThreadAcquireLock(lock, 1)) \
+ error = "Cannot acquire thread lock at init";
+
+
+/* prototypes */
+
+void LL_thread_newlock(struct RPyOpaque_ThreadLock *lock);
+int LL_thread_acquirelock(struct RPyOpaque_ThreadLock *lock, int waitflag);
+void LL_thread_releaselock(struct RPyOpaque_ThreadLock *lock);
+long LL_thread_start(void *func, void *arg);
+long LL_thread_get_ident(void);
+
+
+/* implementations */
+
+#ifndef PYPY_NOT_MAIN_FILE
+
void LL_thread_newlock(struct RPyOpaque_ThreadLock *lock)
{
if (!RPyThreadLockInit(lock))
@@ -51,8 +72,4 @@
return RPyThreadGetIdent();
}
-#define RPyOpaque_SETUP_ThreadLock(lock, initially_locked) \
- if (!RPyThreadLockInit(lock)) \
- error = "Thread lock init error"; \
- else if ((initially_locked) && !RPyThreadAcquireLock(lock, 1)) \
- error = "Cannot acquire thread lock at init";
+#endif /* PYPY_NOT_MAIN_FILE */
Modified: pypy/dist/pypy/translator/c/src/ll_time.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/ll_time.h (original)
+++ pypy/dist/pypy/translator/c/src/ll_time.h Sat Oct 8 16:09:53 2005
@@ -7,6 +7,17 @@
#endif
+/* prototypes */
+
+double LL_time_clock(void);
+void LL_time_sleep(double secs);
+double LL_time_time(void);
+
+
+/* implementations */
+
+#ifndef PYPY_NOT_MAIN_FILE
+
/****** clock() ******/
#if defined(MS_WINDOWS) && !defined(MS_WIN64) && !defined(__BORLANDC__)
@@ -14,6 +25,7 @@
XXX Win64 does not yet, but might when the platform matures. */
#include <windows.h>
+
double LL_time_clock(void)
{
static LARGE_INTEGER ctrStart;
@@ -149,3 +161,5 @@
{
return ll_floattime();
}
+
+#endif /* PYPY_NOT_MAIN_FILE */
Modified: pypy/dist/pypy/translator/c/src/main.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/main.h (original)
+++ pypy/dist/pypy/translator/c/src/main.h Sat Oct 8 16:09:53 2005
@@ -4,6 +4,15 @@
char *RPython_StartupCode(void); /* forward */
+/* prototypes */
+
+int main(int argc, char *argv[]);
+
+
+/* implementations */
+
+#ifndef PYPY_NOT_MAIN_FILE
+
int main(int argc, char *argv[])
{
char *errmsg;
@@ -35,3 +44,5 @@
fprintf(stderr, "Fatal error during initialization: %s\n", errmsg);
return 1;
}
+
+#endif /* PYPY_NOT_MAIN_FILE */
Modified: pypy/dist/pypy/translator/c/src/module.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/module.h (original)
+++ pypy/dist/pypy/translator/c/src/module.h Sat Oct 8 16:09:53 2005
@@ -57,6 +57,11 @@
PyMethodDef ml;
} globalfunctiondef_t;
+
+/* implementations */
+
+#ifndef PYPY_NOT_MAIN_FILE
+
static int setup_globalobjects(globalobjectdef_t* def)
{
PyObject* obj;
@@ -134,3 +139,5 @@
Py_DECREF(res);
return 0;
}
+
+#endif /* PYPY_NOT_MAIN_FILE */
Modified: pypy/dist/pypy/translator/c/src/rtyper.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/rtyper.h (original)
+++ pypy/dist/pypy/translator/c/src/rtyper.h Sat Oct 8 16:09:53 2005
@@ -7,6 +7,16 @@
#define RPyString_Size(rps) ((rps)->rs_chars.length)
#define RPyString_AsString(rps) ((rps)->rs_chars.items)
+
+/* prototypes */
+
+RPyString *RPyString_FromString(char *buf);
+
+
+/* implementations */
+
+#ifndef PYPY_NOT_MAIN_FILE
+
RPyString *RPyString_FromString(char *buf)
{
int length = strlen(buf);
@@ -14,3 +24,5 @@
memcpy(RPyString_AsString(rps), buf, length);
return rps;
}
+
+#endif /* PYPY_NOT_MAIN_FILE */
Modified: pypy/dist/pypy/translator/c/src/support.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/support.h (original)
+++ pypy/dist/pypy/translator/c/src/support.h Sat Oct 8 16:09:53 2005
@@ -19,12 +19,38 @@
#define FAIL_ZER(err, msg) FAIL_EXCEPTION(err, PyExc_ZeroDivisionError, msg)
#define CFAIL(err) { RPyConvertExceptionFromCPython(); FAIL(err); }
+#define PyString_FromLLCharArrayAndSize(itemsarray, size) \
+ PyString_FromStringAndSize(itemsarray->items, size)
+
+#define PyString_ToLLCharArray(s, itemsarray) \
+ memcpy(itemsarray->items, PyString_AS_STRING(s), \
+ itemsarray->length)
#ifndef PYPY_STANDALONE
+/* prototypes */
+
+PyObject * gencfunc_descr_get(PyObject *func, PyObject *obj, PyObject *type);
+PyObject* PyList_Pack(int n, ...);
+PyObject* PyDict_Pack(int n, ...);
+PyObject* PyTuple_Pack(int n, ...);
+PyObject* PyObject_GetItem1(PyObject* obj, PyObject* index);
+PyObject* PyObject_SetItem1(PyObject* obj, PyObject* index, PyObject* v);
+PyObject* CallWithShape(PyObject* callable, PyObject* shape, ...);
+PyObject* decode_arg(PyObject* fname, int position, PyObject* name,
+ PyObject* vargs, PyObject* vkwds, PyObject* def);
+int check_no_more_arg(PyObject* fname, int n, PyObject* vargs);
+PyObject *PyTuple_GetItem_WithIncref(PyObject *tuple, int index);
+int PyTuple_SetItem_WithIncref(PyObject *tuple, int index, PyObject *o);
+
+
+/* implementations */
+
+#ifndef PYPY_NOT_MAIN_FILE
+
/* we need a subclass of 'builtin_function_or_method' which can be used
as methods: builtin function objects that can be bound on instances */
-static PyObject *
+PyObject *
gencfunc_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
if (obj == Py_None)
@@ -72,7 +98,7 @@
/*** misc support functions ***/
-static PyObject* PyList_Pack(int n, ...)
+PyObject* PyList_Pack(int n, ...)
{
int i;
PyObject *o;
@@ -93,7 +119,7 @@
return result;
}
-static PyObject* PyDict_Pack(int n, ...)
+PyObject* PyDict_Pack(int n, ...)
{
int i;
PyObject *key, *val;
@@ -118,7 +144,7 @@
}
#if PY_VERSION_HEX < 0x02040000 /* 2.4 */
-static PyObject* PyTuple_Pack(int n, ...)
+PyObject* PyTuple_Pack(int n, ...)
{
int i;
PyObject *o;
@@ -147,7 +173,7 @@
# define PyObject_SetItem1 PyObject_SetItem
#else
/* for Python 2.2 only */
-static PyObject* PyObject_GetItem1(PyObject* obj, PyObject* index)
+PyObject* PyObject_GetItem1(PyObject* obj, PyObject* index)
{
int start, stop, step;
if (!PySlice_Check(index)) {
@@ -182,7 +208,8 @@
}
return PySequence_GetSlice(obj, start, stop);
}
-static PyObject* PyObject_SetItem1(PyObject* obj, PyObject* index, PyObject* v)
+
+PyObject* PyObject_SetItem1(PyObject* obj, PyObject* index, PyObject* v)
{
int start, stop, step;
if (!PySlice_Check(index)) {
@@ -219,7 +246,7 @@
}
#endif
-static PyObject* CallWithShape(PyObject* callable, PyObject* shape, ...)
+PyObject* CallWithShape(PyObject* callable, PyObject* shape, ...)
{
/* XXX the 'shape' argument is a tuple as specified by
XXX pypy.interpreter.argument.fromshape(). This code should
@@ -304,7 +331,7 @@
return result;
}
-static PyObject* decode_arg(PyObject* fname, int position, PyObject* name,
+PyObject* decode_arg(PyObject* fname, int position, PyObject* name,
PyObject* vargs, PyObject* vkwds, PyObject* def)
{
PyObject* result;
@@ -342,7 +369,7 @@
return NULL;
}
-static int check_no_more_arg(PyObject* fname, int n, PyObject* vargs)
+int check_no_more_arg(PyObject* fname, int n, PyObject* vargs)
{
int size = PyTuple_Size(vargs);
if (size < 0)
@@ -359,23 +386,19 @@
/************************************************************/
-static PyObject *PyTuple_GetItem_WithIncref(PyObject *tuple, int index)
+PyObject *PyTuple_GetItem_WithIncref(PyObject *tuple, int index)
{
PyObject *result = PyTuple_GetItem(tuple, index);
Py_XINCREF(result);
return result;
}
-static int PyTuple_SetItem_WithIncref(PyObject *tuple, int index, PyObject *o)
+int PyTuple_SetItem_WithIncref(PyObject *tuple, int index, PyObject *o)
{
Py_INCREF(o);
return PyTuple_SetItem(tuple, index, o);
}
-#define PyString_FromLLCharArrayAndSize(itemsarray, size) \
- PyString_FromStringAndSize(itemsarray->items, size)
-
-#define PyString_ToLLCharArray(s, itemsarray) \
- memcpy(itemsarray->items, PyString_AS_STRING(s), \
- itemsarray->length)
#endif /* PYPY_STANDALONE */
+
+#endif /* PYPY_NOT_MAIN_FILE */
Modified: pypy/dist/pypy/translator/c/src/thread_nt.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/thread_nt.h (original)
+++ pypy/dist/pypy/translator/c/src/thread_nt.h Sat Oct 8 16:09:53 2005
@@ -26,6 +26,27 @@
HANDLE done;
} callobj;
+typedef struct RPyOpaque_ThreadLock {
+ LONG owned ;
+ DWORD thread_id ;
+ HANDLE hevent ;
+} NRMUTEX, *PNRMUTEX ;
+
+/* prototypes */
+long RPyThreadStart(void (*func)(void *), void *arg);
+BOOL InitializeNonRecursiveMutex(PNRMUTEX mutex);
+VOID DeleteNonRecursiveMutex(PNRMUTEX mutex);
+DWORD EnterNonRecursiveMutex(PNRMUTEX mutex, BOOL wait);
+BOOL LeaveNonRecursiveMutex(PNRMUTEX mutex);
+void RPyOpaqueDealloc_ThreadLock(struct RPyOpaque_ThreadLock *lock);
+int RPyThreadAcquireLock(struct RPyOpaque_ThreadLock *lock, int waitflag);
+void RPyThreadReleaseLock(struct RPyOpaque_ThreadLock *lock);
+
+
+/* implementations */
+
+#ifndef PYPY_NOT_MAIN_FILE
+
static int
bootstrap(void *call)
{
@@ -70,12 +91,6 @@
/************************************************************/
-typedef struct RPyOpaque_ThreadLock {
- LONG owned ;
- DWORD thread_id ;
- HANDLE hevent ;
-} NRMUTEX, *PNRMUTEX ;
-
#define RPyOpaque_INITEXPR_ThreadLock { 0, 0, NULL }
@@ -205,3 +220,5 @@
if (!LeaveNonRecursiveMutex(lock))
/* XXX complain? */;
}
+
+#endif /* PYPY_NOT_MAIN_FILE */
Modified: pypy/dist/pypy/translator/c/src/thread_pthread.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/thread_pthread.h (original)
+++ pypy/dist/pypy/translator/c/src/thread_pthread.h Sat Oct 8 16:09:53 2005
@@ -39,6 +39,23 @@
#define CHECK_STATUS(name) if (status != 0) { perror(name); error = 1; }
+/* prototypes */
+
+long RPyThreadGetIdent(void);
+long RPyThreadStart(void (*func)(void *), void *arg);
+int RPyThreadLockInit(struct RPyOpaque_ThreadLock *lock);
+void RPyOpaqueDealloc_ThreadLock(struct RPyOpaque_ThreadLock *lock);
+int RPyThreadAcquireLock(struct RPyOpaque_ThreadLock *lock, int waitflag);
+void RPyThreadReleaseLock(struct RPyOpaque_ThreadLock *lock);
+int RPyThreadLockInit(struct RPyOpaque_ThreadLock *lock);
+void RPyOpaqueDealloc_ThreadLock(struct RPyOpaque_ThreadLock *lock);
+int RPyThreadAcquireLock(struct RPyOpaque_ThreadLock *lock, int waitflag);
+void RPyThreadReleaseLock(struct RPyOpaque_ThreadLock *lock);
+
+
+/* implementations */
+
+#ifndef PYPY_NOT_MAIN_FILE
/* XXX This implementation is considered (to quote Tim Peters) "inherently
hosed" because:
@@ -288,3 +305,5 @@
/************************************************************/
#endif /* no semaphores */
/************************************************************/
+
+#endif /* PYPY_NOT_MAIN_FILE */
Modified: pypy/dist/pypy/translator/c/src/trace.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/trace.h (original)
+++ pypy/dist/pypy/translator/c/src/trace.h Sat Oct 8 16:09:53 2005
@@ -39,6 +39,8 @@
/*** Implementation ***/
+#ifndef PYPY_NOT_MAIN_FILE
+
#if defined(USE_CALL_TRACE)
static int callstack_depth = -1;
@@ -307,3 +309,5 @@
}
#endif /* defined(USE_CALL_TRACE) */
+
+#endif /* PYPY_NOT_MAIN_FILE */
More information about the Pypy-commit
mailing list