mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
ANSI-fication
This commit is contained in:
parent
e89b15691e
commit
416d413527
3 changed files with 25 additions and 75 deletions
|
|
@ -32,9 +32,7 @@ int getpagesize();
|
||||||
static PyObject *ResourceError;
|
static PyObject *ResourceError;
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
resource_getrusage(self, args)
|
resource_getrusage(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
int who;
|
int who;
|
||||||
struct rusage ru;
|
struct rusage ru;
|
||||||
|
|
@ -79,9 +77,7 @@ resource_getrusage(self, args)
|
||||||
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
resource_getrlimit(self, args)
|
resource_getrlimit(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
struct rlimit rl;
|
struct rlimit rl;
|
||||||
int resource;
|
int resource;
|
||||||
|
|
@ -111,9 +107,7 @@ resource_getrlimit(self, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
resource_setrlimit(self, args)
|
resource_setrlimit(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
struct rlimit rl;
|
struct rlimit rl;
|
||||||
int resource;
|
int resource;
|
||||||
|
|
@ -157,9 +151,7 @@ resource_setrlimit(self, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
resource_getpagesize(self, args)
|
resource_getpagesize(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
if (!PyArg_ParseTuple(args, ":getpagesize"))
|
if (!PyArg_ParseTuple(args, ":getpagesize"))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,7 @@ indexing in the cc array must be done using the symbolic constants defined\n\
|
||||||
in the TERMIOS module.";
|
in the TERMIOS module.";
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
termios_tcgetattr(self, args)
|
termios_tcgetattr(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
struct termios mode;
|
struct termios mode;
|
||||||
|
|
@ -126,9 +124,7 @@ queued output, or TERMIOS.TCSAFLUSH to change after transmitting all\n\
|
||||||
queued output and discarding all queued input. ";
|
queued output and discarding all queued input. ";
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
termios_tcsetattr(self, args)
|
termios_tcsetattr(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
int fd, when;
|
int fd, when;
|
||||||
struct termios mode;
|
struct termios mode;
|
||||||
|
|
@ -195,9 +191,7 @@ A zero duration sends a break for 0.25-0.5 seconds; a nonzero duration \n\
|
||||||
has a system dependent meaning. ";
|
has a system dependent meaning. ";
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
termios_tcsendbreak(self, args)
|
termios_tcsendbreak(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
int fd, duration;
|
int fd, duration;
|
||||||
|
|
||||||
|
|
@ -219,9 +213,7 @@ tcdrain(fd) -> None\n\
|
||||||
Wait until all output written to file descriptor fd has been transmitted. ";
|
Wait until all output written to file descriptor fd has been transmitted. ";
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
termios_tcdrain(self, args)
|
termios_tcdrain(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
|
|
@ -246,9 +238,7 @@ queue, TERMIOS.TCOFLUSH for the output queue, or TERMIOS.TCIOFLUSH for\n\
|
||||||
both queues. ";
|
both queues. ";
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
termios_tcflush(self, args)
|
termios_tcflush(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
int fd, queue;
|
int fd, queue;
|
||||||
|
|
||||||
|
|
@ -273,9 +263,7 @@ TERMIOS.TCOON to restart output, TERMIOS.TCIOFF to suspend input,\n\
|
||||||
or TERMIOS.TCION to restart input. ";
|
or TERMIOS.TCION to restart input. ";
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
termios_tcflow(self, args)
|
termios_tcflow(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
int fd, action;
|
int fd, action;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,9 +128,7 @@ initmactimezone()
|
||||||
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
time_time(self, args)
|
time_time(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
double secs;
|
double secs;
|
||||||
if (!PyArg_NoArgs(args))
|
if (!PyArg_NoArgs(args))
|
||||||
|
|
@ -160,9 +158,7 @@ Fractions of a second may be present if the system clock provides them.";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
time_clock(self, args)
|
time_clock(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
if (!PyArg_NoArgs(args))
|
if (!PyArg_NoArgs(args))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -173,9 +169,7 @@ time_clock(self, args)
|
||||||
#if defined(MS_WIN32) && !defined(MS_WIN64)
|
#if defined(MS_WIN32) && !defined(MS_WIN64)
|
||||||
/* Due to Mark Hammond */
|
/* Due to Mark Hammond */
|
||||||
static PyObject *
|
static PyObject *
|
||||||
time_clock(self, args)
|
time_clock(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
static LARGE_INTEGER ctrStart;
|
static LARGE_INTEGER ctrStart;
|
||||||
static LARGE_INTEGER divisor = {0,0};
|
static LARGE_INTEGER divisor = {0,0};
|
||||||
|
|
@ -217,9 +211,7 @@ the first call to clock(). This has as much precision as the system records.";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
time_sleep(self, args)
|
time_sleep(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
double secs;
|
double secs;
|
||||||
if (!PyArg_Parse(args, "d", &secs))
|
if (!PyArg_Parse(args, "d", &secs))
|
||||||
|
|
@ -237,8 +229,7 @@ Delay execution for a given number of seconds. The argument may be\n\
|
||||||
a floating point number for subsecond precision.";
|
a floating point number for subsecond precision.";
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
tmtotuple(p)
|
tmtotuple(struct tm *p)
|
||||||
struct tm *p;
|
|
||||||
{
|
{
|
||||||
return Py_BuildValue("(iiiiiiiii)",
|
return Py_BuildValue("(iiiiiiiii)",
|
||||||
p->tm_year + 1900,
|
p->tm_year + 1900,
|
||||||
|
|
@ -253,9 +244,7 @@ tmtotuple(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
time_convert(when, function)
|
time_convert(time_t when, struct tm * (*function)(const time_t *))
|
||||||
time_t when;
|
|
||||||
struct tm * (*function)(const time_t *);
|
|
||||||
{
|
{
|
||||||
struct tm *p;
|
struct tm *p;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
@ -274,9 +263,7 @@ time_convert(when, function)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
time_gmtime(self, args)
|
time_gmtime(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
double when;
|
double when;
|
||||||
if (!PyArg_Parse(args, "d", &when))
|
if (!PyArg_Parse(args, "d", &when))
|
||||||
|
|
@ -290,9 +277,7 @@ static char gmtime_doc[] =
|
||||||
Convert seconds since the Epoch to a time tuple expressing UTC (a.k.a. GMT).";
|
Convert seconds since the Epoch to a time tuple expressing UTC (a.k.a. GMT).";
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
time_localtime(self, args)
|
time_localtime(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
double when;
|
double when;
|
||||||
if (!PyArg_Parse(args, "d", &when))
|
if (!PyArg_Parse(args, "d", &when))
|
||||||
|
|
@ -305,9 +290,7 @@ static char localtime_doc[] =
|
||||||
Convert seconds since the Epoch to a time tuple expressing local time.";
|
Convert seconds since the Epoch to a time tuple expressing local time.";
|
||||||
|
|
||||||
static int
|
static int
|
||||||
gettmarg(args, p)
|
gettmarg(PyObject *args, struct tm *p)
|
||||||
PyObject *args;
|
|
||||||
struct tm *p;
|
|
||||||
{
|
{
|
||||||
int y;
|
int y;
|
||||||
memset((ANY *) p, '\0', sizeof(struct tm));
|
memset((ANY *) p, '\0', sizeof(struct tm));
|
||||||
|
|
@ -351,9 +334,7 @@ gettmarg(args, p)
|
||||||
|
|
||||||
#ifdef HAVE_STRFTIME
|
#ifdef HAVE_STRFTIME
|
||||||
static PyObject *
|
static PyObject *
|
||||||
time_strftime(self, args)
|
time_strftime(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
PyObject *tup;
|
PyObject *tup;
|
||||||
struct tm buf;
|
struct tm buf;
|
||||||
|
|
@ -407,9 +388,7 @@ extern char *strptime(); /* Enable this if it's not declared in <time.h> */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
time_strptime(self, args)
|
time_strptime(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
char *fmt = "%a %b %d %H:%M:%S %Y";
|
char *fmt = "%a %b %d %H:%M:%S %Y";
|
||||||
|
|
@ -441,9 +420,7 @@ See the library reference manual for formatting codes (same as strftime()).";
|
||||||
#endif /* HAVE_STRPTIME */
|
#endif /* HAVE_STRPTIME */
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
time_asctime(self, args)
|
time_asctime(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
PyObject *tup;
|
PyObject *tup;
|
||||||
struct tm buf;
|
struct tm buf;
|
||||||
|
|
@ -464,9 +441,7 @@ static char asctime_doc[] =
|
||||||
Convert a time tuple to a string, e.g. 'Sat Jun 06 16:26:11 1998'.";
|
Convert a time tuple to a string, e.g. 'Sat Jun 06 16:26:11 1998'.";
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
time_ctime(self, args)
|
time_ctime(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
double dt;
|
double dt;
|
||||||
time_t tt;
|
time_t tt;
|
||||||
|
|
@ -495,9 +470,7 @@ This is equivalent to asctime(localtime(seconds)).";
|
||||||
|
|
||||||
#ifdef HAVE_MKTIME
|
#ifdef HAVE_MKTIME
|
||||||
static PyObject *
|
static PyObject *
|
||||||
time_mktime(self, args)
|
time_mktime(PyObject *self, PyObject *args)
|
||||||
PyObject *self;
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
PyObject *tup;
|
PyObject *tup;
|
||||||
struct tm buf;
|
struct tm buf;
|
||||||
|
|
@ -549,10 +522,7 @@ static PyMethodDef time_methods[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ins(d, name, v)
|
ins(PyObject *d, char *name, PyObject *v)
|
||||||
PyObject *d;
|
|
||||||
char *name;
|
|
||||||
PyObject *v;
|
|
||||||
{
|
{
|
||||||
if (v == NULL)
|
if (v == NULL)
|
||||||
Py_FatalError("Can't initialize time module -- NULL value");
|
Py_FatalError("Can't initialize time module -- NULL value");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue