PyCursesWindowObject *self;
char *name;
{
- return findmethod(PyCursesWindow_Methods, (PyObject *)self, name);
+ return Py_FindMethod(PyCursesWindow_Methods, (PyObject *)self, name);
}
/* --------------- PAD routines ---------------- */
/** File Handler **/
-void
+static void
FileHandler (clientData, mask)
ClientData clientData; /* Is: (func, file) */
int mask;
PyObject *file; /* Either an int >= 0 or an object with a
.fileno() method that returns an int >= 0 */
{
- object *meth, *args, *res;
+ PyObject *meth, *args, *res;
int id;
if (PyInt_Check(file)) {
id = PyInt_AsLong(file);
static PyTypeObject Tktt_Type =
{
- OB_HEAD_INIT (&PyType_Type)
+ PyObject_HEAD_INIT (&PyType_Type)
0, /*ob_size */
"tktimertoken", /*tp_name */
sizeof (TkttObject), /*tp_basicsize */
static PyTypeObject Tkapp_Type =
{
- OB_HEAD_INIT (&PyType_Type)
+ PyObject_HEAD_INIT (&PyType_Type)
0, /*ob_size */
"tkapp", /*tp_name */
sizeof (TkappObject), /*tp_basicsize */
/* MPZ objects */
#include "allobjects.h"
-#include "modsupport.h" /* For getargs() etc. */
-#include "rename1.h"
+
#include <assert.h>
#include <sys/types.h> /* For size_t */
#include "Python.h"
-#include <stdio.h>
#include <math.h>
+
#define TRUE 1
#define FALSE 0
goto fail;
return xp;
fail:
- DECREF(xp);
+ Py_DECREF(xp);
return (PyRotorObject *)PyErr_NoMemory();
}
return Py_None;
}
-static struct methodlist PyRotor_Methods[] = {
+static struct PyMethodDef PyRotor_Methods[] = {
{"encrypt", (PyCFunction)PyRotor_Encrypt},
{"encryptmore", (PyCFunction)PyRotor_EncryptMore},
{"decrypt", (PyCFunction)PyRotor_Decrypt},
}
static PyTypeObject PyRotor_Type = {
- PyObject_HEAD_INIT(&Typetype)
+ PyObject_HEAD_INIT(&PyType_Type)
0, /*ob_size*/
"rotor", /*tp_name*/
sizeof(PyRotorObject), /*tp_size*/
return (PyObject * )r;
}
-static struct methodlist PyRotor_Rotor_Methods[] = {
+static struct PyMethodDef PyRotor_Rotor_Methods[] = {
{"newrotor", (PyCFunction)PyRotor_Rotor},
{NULL, NULL} /* Sentinel */
};
#include "intrcheck.h"
#include <signal.h>
-#include <errno.h>
#ifndef SIG_ERR
#define SIG_ERR ((RETSIGTYPE (*)())-1)
return PyInt_FromLong(alarm(t));
}
-static object *
+static PyObject *
PySignal_Pause(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_NoArgs(args))
return NULL;
- BGN_SAVE
+ Py_BEGIN_ALLOW_THREADS
pause();
- END_SAVE
+ Py_END_ALLOW_THREADS
Py_INCREF(Py_None);
return Py_None;
}
if (get_thread_ident() != main_thread)
return 0;
#endif
- f = getframe();
+ f = PyEval_GetFrame();
if (f == (PyObject *)NULL)
f = Py_None;
for (i = 1; i < NSIG; i++) {
/* Replacement for intrcheck.c functionality */
void
-initintr()
+PyOS_InitInterrupts ()
{
initsignal();
}
int
-intrcheck()
+PyOS_InterruptOccurred ()
{
if (PySignal_SignalHandlerArray[SIGINT].tripped) {
#ifdef WITH_THREAD
if (buf == NULL)
return NULL;
res = getsockopt(s->sock_fd, level, optname,
- (ANY *)getstringvalue(buf), &buflen);
+ (ANY *)PyString_AsString(buf), &buflen);
if (res < 0) {
Py_DECREF(buf);
return PySocket_Err();
static PyObject *
BUILD_FUNC_DEF_2(PySocketSock_makefile,PySocketSockObject *,s, PyObject *,args)
{
- extern int fclose PROTO((FILE *));
+ extern int fclose Py_PROTO((FILE *));
char *mode;
int fd;
FILE *fp;
if (buf == NULL)
return NULL;
Py_BEGIN_ALLOW_THREADS
- n = recv(s->sock_fd, getstringvalue(buf), len, flags);
+ n = recv(s->sock_fd, PyString_AsString(buf), len, flags);
Py_END_ALLOW_THREADS
if (n < 0)
return PySocket_Err();
PyObject *addro;
struct sockaddr *addr;
char buf[512];
- object *t, *comma, *v;
+ PyObject *t, *comma, *v;
int i, len;
sprintf(buf,
"<socket object, fd=%d, family=%d, type=%d, protocol=%d>",
s->sock_fd, s->sock_family, s->sock_type, s->sock_proto);
- t = newstringobject(buf);
+ t = PyString_FromString(buf);
return t;
}
/* syslog module */
-#include "allobjects.h"
-#include "modsupport.h"
+#include "Python.h"
#include <syslog.h>
-#include "rename1.h"
-
static PyObject *
syslog_openlog(self, args)
PyObject * self;
/* Interface to Sjoerd's portable C thread library */
#include "allobjects.h"
-#include "modsupport.h"
-#include "ceval.h"
#ifndef WITH_THREAD
Error! The rest of Python is not compiled with thread support.