Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ea9cb5a

Browse files
committed
ANSI-fication and Py_PROTO extermination.
1 parent 5eb6d4e commit ea9cb5a

14 files changed

Lines changed: 340 additions & 338 deletions

Include/abstract.h

Lines changed: 61 additions & 59 deletions
Large diffs are not rendered by default.

Include/bufferobject.h

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
#ifndef Py_BUFFEROBJECT_H
2-
#define Py_BUFFEROBJECT_H
3-
#ifdef __cplusplus
4-
extern "C" {
5-
#endif
6-
71
/***********************************************************
82
Copyright (c) 2000, BeOpen.com.
93
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
@@ -18,23 +12,31 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1812

1913
/* Note: the object's structure is private */
2014

15+
#ifndef Py_BUFFEROBJECT_H
16+
#define Py_BUFFEROBJECT_H
17+
#ifdef __cplusplus
18+
extern "C" {
19+
#endif
20+
2121

2222
extern DL_IMPORT(PyTypeObject) PyBuffer_Type;
2323

2424
#define PyBuffer_Check(op) ((op)->ob_type == &PyBuffer_Type)
2525

2626
#define Py_END_OF_BUFFER (-1)
2727

28-
extern DL_IMPORT(PyObject *) PyBuffer_FromObject Py_PROTO((PyObject *base, int offset, int size));
29-
extern DL_IMPORT(PyObject *) PyBuffer_FromReadWriteObject Py_PROTO((PyObject *base, int offset, int size));
28+
extern DL_IMPORT(PyObject *) PyBuffer_FromObject(PyObject *base,
29+
int offset, int size);
30+
extern DL_IMPORT(PyObject *) PyBuffer_FromReadWriteObject(PyObject *base,
31+
int offset,
32+
int size);
3033

31-
extern DL_IMPORT(PyObject *) PyBuffer_FromMemory Py_PROTO((void *ptr, int size));
32-
extern DL_IMPORT(PyObject *) PyBuffer_FromReadWriteMemory Py_PROTO((void *ptr, int size));
34+
extern DL_IMPORT(PyObject *) PyBuffer_FromMemory(void *ptr, int size);
35+
extern DL_IMPORT(PyObject *) PyBuffer_FromReadWriteMemory(void *ptr, int size);
3336

34-
extern DL_IMPORT(PyObject *) PyBuffer_New Py_PROTO((int size));
37+
extern DL_IMPORT(PyObject *) PyBuffer_New(int size);
3538

3639
#ifdef __cplusplus
3740
}
3841
#endif
3942
#endif /* !Py_BUFFEROBJECT_H */
40-

Include/classobject.h

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
#ifndef Py_CLASSOBJECT_H
2-
#define Py_CLASSOBJECT_H
3-
#ifdef __cplusplus
4-
extern "C" {
5-
#endif
6-
71
/***********************************************************
82
Copyright (c) 2000, BeOpen.com.
93
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
@@ -18,28 +12,34 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1812

1913
/* Revealing some structures (not for general use) */
2014

15+
#ifndef Py_CLASSOBJECT_H
16+
#define Py_CLASSOBJECT_H
17+
#ifdef __cplusplus
18+
extern "C" {
19+
#endif
20+
2121
typedef struct {
22-
PyObject_HEAD
23-
PyObject *cl_bases; /* A tuple of class objects */
24-
PyObject *cl_dict; /* A dictionary */
25-
PyObject *cl_name; /* A string */
26-
/* The following three are functions or NULL */
27-
PyObject *cl_getattr;
28-
PyObject *cl_setattr;
29-
PyObject *cl_delattr;
22+
PyObject_HEAD
23+
PyObject *cl_bases; /* A tuple of class objects */
24+
PyObject *cl_dict; /* A dictionary */
25+
PyObject *cl_name; /* A string */
26+
/* The following three are functions or NULL */
27+
PyObject *cl_getattr;
28+
PyObject *cl_setattr;
29+
PyObject *cl_delattr;
3030
} PyClassObject;
3131

3232
typedef struct {
33-
PyObject_HEAD
34-
PyClassObject *in_class; /* The class object */
35-
PyObject *in_dict; /* A dictionary */
33+
PyObject_HEAD
34+
PyClassObject *in_class; /* The class object */
35+
PyObject *in_dict; /* A dictionary */
3636
} PyInstanceObject;
3737

3838
typedef struct {
39-
PyObject_HEAD
40-
PyObject *im_func; /* The callable object implementing the method */
41-
PyObject *im_self; /* The instance it is bound to, or NULL */
42-
PyObject *im_class; /* The class that defined the method */
39+
PyObject_HEAD
40+
PyObject *im_func; /* The callable object implementing the method */
41+
PyObject *im_self; /* The instance it is bound to, or NULL */
42+
PyObject *im_class; /* The class that defined the method */
4343
} PyMethodObject;
4444

4545
extern DL_IMPORT(PyTypeObject) PyClass_Type, PyInstance_Type, PyMethod_Type;
@@ -48,13 +48,14 @@ extern DL_IMPORT(PyTypeObject) PyClass_Type, PyInstance_Type, PyMethod_Type;
4848
#define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type)
4949
#define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type)
5050

51-
extern DL_IMPORT(PyObject *) PyClass_New Py_PROTO((PyObject *, PyObject *, PyObject *));
52-
extern DL_IMPORT(PyObject *) PyInstance_New Py_PROTO((PyObject *, PyObject *, PyObject *));
53-
extern DL_IMPORT(PyObject *) PyMethod_New Py_PROTO((PyObject *, PyObject *, PyObject *));
51+
extern DL_IMPORT(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *);
52+
extern DL_IMPORT(PyObject *) PyInstance_New(PyObject *, PyObject *,
53+
PyObject *);
54+
extern DL_IMPORT(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *);
5455

55-
extern DL_IMPORT(PyObject *) PyMethod_Function Py_PROTO((PyObject *));
56-
extern DL_IMPORT(PyObject *) PyMethod_Self Py_PROTO((PyObject *));
57-
extern DL_IMPORT(PyObject *) PyMethod_Class Py_PROTO((PyObject *));
56+
extern DL_IMPORT(PyObject *) PyMethod_Function(PyObject *);
57+
extern DL_IMPORT(PyObject *) PyMethod_Self(PyObject *);
58+
extern DL_IMPORT(PyObject *) PyMethod_Class(PyObject *);
5859

5960
/* Macros for direct access to these values. Type checks are *not*
6061
done, so use with care. */
@@ -65,12 +66,12 @@ extern DL_IMPORT(PyObject *) PyMethod_Class Py_PROTO((PyObject *));
6566
#define PyMethod_GET_CLASS(meth) \
6667
(((PyMethodObject *)meth) -> im_class)
6768

68-
extern DL_IMPORT(int) PyClass_IsSubclass Py_PROTO((PyObject *, PyObject *));
69+
extern DL_IMPORT(int) PyClass_IsSubclass(PyObject *, PyObject *);
6970

70-
extern DL_IMPORT(PyObject *) PyInstance_DoBinOp
71-
Py_PROTO((PyObject *, PyObject *,
72-
char *, char *,
73-
PyObject * (*) Py_PROTO((PyObject *, PyObject *)) ));
71+
extern DL_IMPORT(PyObject *) PyInstance_DoBinOp(PyObject *, PyObject *,
72+
char *, char *,
73+
PyObject * (*)(PyObject *,
74+
PyObject *));
7475

7576
#ifdef __cplusplus
7677
}

Include/cobject.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
#ifndef Py_COBJECT_H
2-
#define Py_COBJECT_H
3-
#ifdef __cplusplus
4-
extern "C" {
5-
#endif
6-
71
/***********************************************************
82
Copyright (c) 2000, BeOpen.com.
93
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
@@ -23,6 +17,12 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
2317
2418
*/
2519

20+
#ifndef Py_COBJECT_H
21+
#define Py_COBJECT_H
22+
#ifdef __cplusplus
23+
extern "C" {
24+
#endif
25+
2626
extern DL_IMPORT(PyTypeObject) PyCObject_Type;
2727

2828
#define PyCObject_Check(op) ((op)->ob_type == &PyCObject_Type)
@@ -34,7 +34,7 @@ extern DL_IMPORT(PyTypeObject) PyCObject_Type;
3434
3535
*/
3636
extern DL_IMPORT(PyObject *)
37-
PyCObject_FromVoidPtr Py_PROTO((void *cobj, void (*destruct)(void*)));
37+
PyCObject_FromVoidPtr(void *cobj, void (*destruct)(void*));
3838

3939

4040
/* Create a PyCObject from a pointer to a C object, a description object,
@@ -43,20 +43,20 @@ PyCObject_FromVoidPtr Py_PROTO((void *cobj, void (*destruct)(void*)));
4343
the PyCObject is destroyed.
4444
*/
4545
extern DL_IMPORT(PyObject *)
46-
PyCObject_FromVoidPtrAndDesc Py_PROTO((void *cobj, void *desc,
47-
void (*destruct)(void*,void*)));
46+
PyCObject_FromVoidPtrAndDesc(void *cobj, void *desc,
47+
void (*destruct)(void*,void*));
4848

4949
/* Retrieve a pointer to a C object from a PyCObject. */
5050
extern DL_IMPORT(void *)
51-
PyCObject_AsVoidPtr Py_PROTO((PyObject *));
51+
PyCObject_AsVoidPtr(PyObject *);
5252

5353
/* Retrieve a pointer to a description object from a PyCObject. */
5454
extern DL_IMPORT(void *)
55-
PyCObject_GetDesc Py_PROTO((PyObject *));
55+
PyCObject_GetDesc(PyObject *);
5656

5757
/* Import a pointer to a C object from a module using a PyCObject. */
5858
extern DL_IMPORT(void *)
59-
PyCObject_Import Py_PROTO((char *module_name, char *cobject_name));
59+
PyCObject_Import(char *module_name, char *cobject_name);
6060

6161
#ifdef __cplusplus
6262
}

Include/compile.h

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
#ifndef Py_COMPILE_H
2-
#define Py_COMPILE_H
3-
#ifdef __cplusplus
4-
extern "C" {
5-
#endif
6-
71
/***********************************************************
82
Copyright (c) 2000, BeOpen.com.
93
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
@@ -16,22 +10,28 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1610

1711
/* Definitions for bytecode */
1812

13+
#ifndef Py_COMPILE_H
14+
#define Py_COMPILE_H
15+
#ifdef __cplusplus
16+
extern "C" {
17+
#endif
18+
1919
/* Bytecode object */
2020
typedef struct {
21-
PyObject_HEAD
22-
int co_argcount; /* #arguments, except *args */
23-
int co_nlocals; /* #local variables */
24-
int co_stacksize; /* #entries needed for evaluation stack */
25-
int co_flags; /* CO_..., see below */
26-
PyObject *co_code; /* instruction opcodes */
27-
PyObject *co_consts; /* list (constants used) */
28-
PyObject *co_names; /* list of strings (names used) */
29-
PyObject *co_varnames; /* tuple of strings (local variable names) */
30-
/* The rest doesn't count for hash/cmp */
31-
PyObject *co_filename; /* string (where it was loaded from) */
32-
PyObject *co_name; /* string (name, for reference) */
33-
int co_firstlineno; /* first source line number */
34-
PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) */
21+
PyObject_HEAD
22+
int co_argcount; /* #arguments, except *args */
23+
int co_nlocals; /* #local variables */
24+
int co_stacksize; /* #entries needed for evaluation stack */
25+
int co_flags; /* CO_..., see below */
26+
PyObject *co_code; /* instruction opcodes */
27+
PyObject *co_consts; /* list (constants used) */
28+
PyObject *co_names; /* list of strings (names used) */
29+
PyObject *co_varnames; /* tuple of strings (local variable names) */
30+
/* The rest doesn't count for hash/cmp */
31+
PyObject *co_filename; /* string (where it was loaded from) */
32+
PyObject *co_name; /* string (name, for reference) */
33+
int co_firstlineno; /* first source line number */
34+
PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) */
3535
} PyCodeObject;
3636

3737
/* Masks for co_flags above */
@@ -48,11 +48,11 @@ extern DL_IMPORT(PyTypeObject) PyCode_Type;
4848

4949
/* Public interface */
5050
struct _node; /* Declare the existence of this type */
51-
DL_IMPORT(PyCodeObject *) PyNode_Compile Py_PROTO((struct _node *, char *));
52-
DL_IMPORT(PyCodeObject *) PyCode_New Py_PROTO((
51+
DL_IMPORT(PyCodeObject *) PyNode_Compile(struct _node *, char *);
52+
DL_IMPORT(PyCodeObject *) PyCode_New(
5353
int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *,
54-
PyObject *, PyObject *, int, PyObject *)); /* same as struct above */
55-
DL_IMPORT(int) PyCode_Addr2Line Py_PROTO((PyCodeObject *, int));
54+
PyObject *, PyObject *, int, PyObject *); /* same as struct above */
55+
DL_IMPORT(int) PyCode_Addr2Line(PyCodeObject *, int);
5656

5757
/* for internal use only */
5858
#define _PyCode_GETCODEPTR(co, pp) \

Include/complexobject.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
/* Complex number structure */
2+
13
#ifndef COMPLEXOBJECT_H
24
#define COMPLEXOBJECT_H
35
#ifdef __cplusplus
46
extern "C" {
57
#endif
68

7-
/* Complex number structure */
8-
99
typedef struct {
10-
double real;
11-
double imag;
10+
double real;
11+
double imag;
1212
} Py_complex;
1313

1414
/* Operations on complex numbers from complexmodule.c */
@@ -20,12 +20,12 @@ typedef struct {
2020
#define c_quot _Py_c_quot
2121
#define c_pow _Py_c_pow
2222

23-
extern DL_IMPORT(Py_complex) c_sum Py_PROTO((Py_complex, Py_complex));
24-
extern DL_IMPORT(Py_complex) c_diff Py_PROTO((Py_complex, Py_complex));
25-
extern DL_IMPORT(Py_complex) c_neg Py_PROTO((Py_complex));
26-
extern DL_IMPORT(Py_complex) c_prod Py_PROTO((Py_complex, Py_complex));
27-
extern DL_IMPORT(Py_complex) c_quot Py_PROTO((Py_complex, Py_complex));
28-
extern DL_IMPORT(Py_complex) c_pow Py_PROTO((Py_complex, Py_complex));
23+
extern DL_IMPORT(Py_complex) c_sum(Py_complex, Py_complex);
24+
extern DL_IMPORT(Py_complex) c_diff(Py_complex, Py_complex);
25+
extern DL_IMPORT(Py_complex) c_neg(Py_complex);
26+
extern DL_IMPORT(Py_complex) c_prod(Py_complex, Py_complex);
27+
extern DL_IMPORT(Py_complex) c_quot(Py_complex, Py_complex);
28+
extern DL_IMPORT(Py_complex) c_pow(Py_complex, Py_complex);
2929

3030

3131
/* Complex object interface */
@@ -36,20 +36,20 @@ real and imaginary parts.
3636
*/
3737

3838
typedef struct {
39-
PyObject_HEAD
40-
Py_complex cval;
39+
PyObject_HEAD
40+
Py_complex cval;
4141
} PyComplexObject;
4242

4343
extern DL_IMPORT(PyTypeObject) PyComplex_Type;
4444

4545
#define PyComplex_Check(op) ((op)->ob_type == &PyComplex_Type)
4646

47-
extern DL_IMPORT(PyObject *) PyComplex_FromCComplex Py_PROTO((Py_complex));
48-
extern DL_IMPORT(PyObject *) PyComplex_FromDoubles Py_PROTO((double real, double imag));
47+
extern DL_IMPORT(PyObject *) PyComplex_FromCComplex(Py_complex);
48+
extern DL_IMPORT(PyObject *) PyComplex_FromDoubles(double real, double imag);
4949

50-
extern DL_IMPORT(double) PyComplex_RealAsDouble Py_PROTO((PyObject *op));
51-
extern DL_IMPORT(double) PyComplex_ImagAsDouble Py_PROTO((PyObject *op));
52-
extern DL_IMPORT(Py_complex) PyComplex_AsCComplex Py_PROTO((PyObject *op));
50+
extern DL_IMPORT(double) PyComplex_RealAsDouble(PyObject *op);
51+
extern DL_IMPORT(double) PyComplex_ImagAsDouble(PyObject *op);
52+
extern DL_IMPORT(Py_complex) PyComplex_AsCComplex(PyObject *op);
5353

5454
#ifdef __cplusplus
5555
}

Include/fileobject.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
#ifndef Py_FILEOBJECT_H
2-
#define Py_FILEOBJECT_H
3-
#ifdef __cplusplus
4-
extern "C" {
5-
#endif
6-
71
/***********************************************************
82
Copyright (c) 2000, BeOpen.com.
93
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
@@ -16,20 +10,26 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1610

1711
/* File object interface */
1812

13+
#ifndef Py_FILEOBJECT_H
14+
#define Py_FILEOBJECT_H
15+
#ifdef __cplusplus
16+
extern "C" {
17+
#endif
18+
1919
extern DL_IMPORT(PyTypeObject) PyFile_Type;
2020

2121
#define PyFile_Check(op) ((op)->ob_type == &PyFile_Type)
2222

23-
extern DL_IMPORT(PyObject *) PyFile_FromString Py_PROTO((char *, char *));
24-
extern DL_IMPORT(void) PyFile_SetBufSize Py_PROTO((PyObject *, int));
25-
extern DL_IMPORT(PyObject *) PyFile_FromFile
26-
Py_PROTO((FILE *, char *, char *, int (*)Py_FPROTO((FILE *))));
27-
extern DL_IMPORT(FILE *) PyFile_AsFile Py_PROTO((PyObject *));
28-
extern DL_IMPORT(PyObject *) PyFile_Name Py_PROTO((PyObject *));
29-
extern DL_IMPORT(PyObject *) PyFile_GetLine Py_PROTO((PyObject *, int));
30-
extern DL_IMPORT(int) PyFile_WriteObject Py_PROTO((PyObject *, PyObject *, int));
31-
extern DL_IMPORT(int) PyFile_SoftSpace Py_PROTO((PyObject *, int));
32-
extern DL_IMPORT(int) PyFile_WriteString Py_PROTO((char *, PyObject *));
23+
extern DL_IMPORT(PyObject *) PyFile_FromString(char *, char *);
24+
extern DL_IMPORT(void) PyFile_SetBufSize(PyObject *, int);
25+
extern DL_IMPORT(PyObject *) PyFile_FromFile(FILE *, char *, char *,
26+
int (*)(FILE *));
27+
extern DL_IMPORT(FILE *) PyFile_AsFile(PyObject *);
28+
extern DL_IMPORT(PyObject *) PyFile_Name(PyObject *);
29+
extern DL_IMPORT(PyObject *) PyFile_GetLine(PyObject *, int);
30+
extern DL_IMPORT(int) PyFile_WriteObject(PyObject *, PyObject *, int);
31+
extern DL_IMPORT(int) PyFile_SoftSpace(PyObject *, int);
32+
extern DL_IMPORT(int) PyFile_WriteString(char *, PyObject *);
3333

3434
#ifdef __cplusplus
3535
}

0 commit comments

Comments
 (0)