Skip to content

Commit 3cf4d2b

Browse files
committed
ANSI-fication and Py_PROTO extermination.
1 parent ea9cb5a commit 3cf4d2b

File tree

10 files changed

+166
-173
lines changed

10 files changed

+166
-173
lines changed

Include/moduleobject.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
#ifndef Py_MODULEOBJECT_H
2-
#define Py_MODULEOBJECT_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,15 +10,21 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1610

1711
/* Module object interface */
1812

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

2121
#define PyModule_Check(op) ((op)->ob_type == &PyModule_Type)
2222

23-
extern DL_IMPORT(PyObject *) PyModule_New Py_PROTO((char *));
24-
extern DL_IMPORT(PyObject *) PyModule_GetDict Py_PROTO((PyObject *));
25-
extern DL_IMPORT(char *) PyModule_GetName Py_PROTO((PyObject *));
26-
extern DL_IMPORT(char *) PyModule_GetFilename Py_PROTO((PyObject *));
27-
extern DL_IMPORT(void) _PyModule_Clear Py_PROTO((PyObject *));
23+
extern DL_IMPORT(PyObject *) PyModule_New(char *);
24+
extern DL_IMPORT(PyObject *) PyModule_GetDict(PyObject *);
25+
extern DL_IMPORT(char *) PyModule_GetName(PyObject *);
26+
extern DL_IMPORT(char *) PyModule_GetFilename(PyObject *);
27+
extern DL_IMPORT(void) _PyModule_Clear(PyObject *);
2828

2929
#ifdef __cplusplus
3030
}

Include/objimpl.h

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
#ifndef Py_OBJIMPL_H
2-
#define Py_OBJIMPL_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.
@@ -14,6 +8,12 @@ See the file "Misc/COPYRIGHT" for information on usage and
148
redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
159
******************************************************************/
1610

11+
#ifndef Py_OBJIMPL_H
12+
#define Py_OBJIMPL_H
13+
#ifdef __cplusplus
14+
extern "C" {
15+
#endif
16+
1717
#include "mymalloc.h"
1818

1919
/*
@@ -137,9 +137,9 @@ extern void PyCore_OBJECT_FREE_FUNC PyCore_OBJECT_FREE_PROTO;
137137
as Python. These wrappers *do not* make sure that allocating 0
138138
bytes returns a non-NULL pointer. Returned pointers must be checked
139139
for NULL explicitly; no action is performed on failure. */
140-
extern DL_IMPORT(ANY *) PyObject_Malloc Py_PROTO((size_t));
141-
extern DL_IMPORT(ANY *) PyObject_Realloc Py_PROTO((ANY *, size_t));
142-
extern DL_IMPORT(void) PyObject_Free Py_PROTO((ANY *));
140+
extern DL_IMPORT(ANY *) PyObject_Malloc(size_t);
141+
extern DL_IMPORT(ANY *) PyObject_Realloc(ANY *, size_t);
142+
extern DL_IMPORT(void) PyObject_Free(ANY *);
143143

144144
/* Macros */
145145
#define PyObject_MALLOC(n) PyCore_OBJECT_MALLOC(n)
@@ -152,11 +152,12 @@ extern DL_IMPORT(void) PyObject_Free Py_PROTO((ANY *));
152152
*/
153153

154154
/* Functions */
155-
extern DL_IMPORT(PyObject *) PyObject_Init Py_PROTO((PyObject *, PyTypeObject *));
156-
extern DL_IMPORT(PyVarObject *) PyObject_InitVar Py_PROTO((PyVarObject *, PyTypeObject *, int));
157-
extern DL_IMPORT(PyObject *) _PyObject_New Py_PROTO((PyTypeObject *));
158-
extern DL_IMPORT(PyVarObject *) _PyObject_NewVar Py_PROTO((PyTypeObject *, int));
159-
extern DL_IMPORT(void) _PyObject_Del Py_PROTO((PyObject *));
155+
extern DL_IMPORT(PyObject *) PyObject_Init(PyObject *, PyTypeObject *);
156+
extern DL_IMPORT(PyVarObject *) PyObject_InitVar(PyVarObject *,
157+
PyTypeObject *, int);
158+
extern DL_IMPORT(PyObject *) _PyObject_New(PyTypeObject *);
159+
extern DL_IMPORT(PyVarObject *) _PyObject_NewVar(PyTypeObject *, int);
160+
extern DL_IMPORT(void) _PyObject_Del(PyObject *);
160161

161162
#define PyObject_New(type, typeobj) \
162163
( (type *) _PyObject_New(typeobj) )
@@ -240,10 +241,10 @@ extern DL_IMPORT(void) _PyObject_Del Py_PROTO((PyObject *));
240241
#else
241242

242243
/* Add the object into the container set */
243-
extern DL_IMPORT(void) _PyGC_Insert Py_PROTO((PyObject *));
244+
extern DL_IMPORT(void) _PyGC_Insert(PyObject *);
244245

245246
/* Remove the object from the container set */
246-
extern DL_IMPORT(void) _PyGC_Remove Py_PROTO((PyObject *));
247+
extern DL_IMPORT(void) _PyGC_Remove(PyObject *);
247248

248249
#define PyObject_GC_Init(op) _PyGC_Insert((PyObject *)op)
249250
#define PyObject_GC_Fini(op) _PyGC_Remove((PyObject *)op)

Include/pythonrun.h

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
#ifndef Py_PYTHONRUN_H
2-
#define Py_PYTHONRUN_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,77 +10,83 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1610

1711
/* Interfaces to parse and execute pieces of python code */
1812

19-
DL_IMPORT(void) Py_SetProgramName Py_PROTO((char *));
20-
DL_IMPORT(char *) Py_GetProgramName Py_PROTO((void));
13+
#ifndef Py_PYTHONRUN_H
14+
#define Py_PYTHONRUN_H
15+
#ifdef __cplusplus
16+
extern "C" {
17+
#endif
18+
19+
DL_IMPORT(void) Py_SetProgramName(char *);
20+
DL_IMPORT(char *) Py_GetProgramName(void);
2121

22-
DL_IMPORT(void) Py_SetPythonHome Py_PROTO((char *));
23-
DL_IMPORT(char *) Py_GetPythonHome Py_PROTO((void));
22+
DL_IMPORT(void) Py_SetPythonHome(char *);
23+
DL_IMPORT(char *) Py_GetPythonHome(void);
2424

25-
DL_IMPORT(void) Py_Initialize Py_PROTO((void));
26-
DL_IMPORT(void) Py_Finalize Py_PROTO((void));
27-
DL_IMPORT(int) Py_IsInitialized Py_PROTO((void));
28-
DL_IMPORT(PyThreadState *) Py_NewInterpreter Py_PROTO((void));
29-
DL_IMPORT(void) Py_EndInterpreter Py_PROTO((PyThreadState *));
25+
DL_IMPORT(void) Py_Initialize(void);
26+
DL_IMPORT(void) Py_Finalize(void);
27+
DL_IMPORT(int) Py_IsInitialized(void);
28+
DL_IMPORT(PyThreadState *) Py_NewInterpreter(void);
29+
DL_IMPORT(void) Py_EndInterpreter(PyThreadState *);
3030

31-
DL_IMPORT(int) PyRun_AnyFile Py_PROTO((FILE *, char *));
31+
DL_IMPORT(int) PyRun_AnyFile(FILE *, char *);
3232

33-
DL_IMPORT(int) PyRun_SimpleString Py_PROTO((char *));
34-
DL_IMPORT(int) PyRun_SimpleFile Py_PROTO((FILE *, char *));
35-
DL_IMPORT(int) PyRun_InteractiveOne Py_PROTO((FILE *, char *));
36-
DL_IMPORT(int) PyRun_InteractiveLoop Py_PROTO((FILE *, char *));
33+
DL_IMPORT(int) PyRun_SimpleString(char *);
34+
DL_IMPORT(int) PyRun_SimpleFile(FILE *, char *);
35+
DL_IMPORT(int) PyRun_InteractiveOne(FILE *, char *);
36+
DL_IMPORT(int) PyRun_InteractiveLoop(FILE *, char *);
3737

38-
DL_IMPORT(struct _node *) PyParser_SimpleParseString Py_PROTO((char *, int));
39-
DL_IMPORT(struct _node *) PyParser_SimpleParseFile Py_PROTO((FILE *, char *, int));
38+
DL_IMPORT(struct _node *) PyParser_SimpleParseString(char *, int);
39+
DL_IMPORT(struct _node *) PyParser_SimpleParseFile(FILE *, char *, int);
4040

41-
DL_IMPORT(PyObject *) PyRun_String Py_PROTO((char *, int, PyObject *, PyObject *));
42-
DL_IMPORT(PyObject *) PyRun_File Py_PROTO((FILE *, char *, int, PyObject *, PyObject *));
41+
DL_IMPORT(PyObject *) PyRun_String(char *, int, PyObject *, PyObject *);
42+
DL_IMPORT(PyObject *) PyRun_File(FILE *, char *, int, PyObject *, PyObject *);
4343

44-
DL_IMPORT(PyObject *) Py_CompileString Py_PROTO((char *, char *, int));
44+
DL_IMPORT(PyObject *) Py_CompileString(char *, char *, int);
4545

46-
DL_IMPORT(void) PyErr_Print Py_PROTO((void));
47-
DL_IMPORT(void) PyErr_PrintEx Py_PROTO((int));
46+
DL_IMPORT(void) PyErr_Print(void);
47+
DL_IMPORT(void) PyErr_PrintEx(int);
4848

49-
DL_IMPORT(int) Py_AtExit Py_PROTO((void (*func) Py_PROTO((void))));
49+
DL_IMPORT(int) Py_AtExit(void (*func)(void));
5050

51-
DL_IMPORT(void) Py_Exit Py_PROTO((int));
51+
DL_IMPORT(void) Py_Exit(int);
5252

53-
DL_IMPORT(int) Py_FdIsInteractive Py_PROTO((FILE *, char *));
53+
DL_IMPORT(int) Py_FdIsInteractive(FILE *, char *);
5454

5555
/* In getpath.c */
56-
DL_IMPORT(char *) Py_GetProgramFullPath Py_PROTO((void));
57-
DL_IMPORT(char *) Py_GetPrefix Py_PROTO((void));
58-
DL_IMPORT(char *) Py_GetExecPrefix Py_PROTO((void));
59-
DL_IMPORT(char *) Py_GetPath Py_PROTO((void));
56+
DL_IMPORT(char *) Py_GetProgramFullPath(void);
57+
DL_IMPORT(char *) Py_GetPrefix(void);
58+
DL_IMPORT(char *) Py_GetExecPrefix(void);
59+
DL_IMPORT(char *) Py_GetPath(void);
6060

6161
/* In their own files */
62-
DL_IMPORT(const char *) Py_GetVersion Py_PROTO((void));
63-
DL_IMPORT(const char *) Py_GetPlatform Py_PROTO((void));
64-
DL_IMPORT(const char *) Py_GetCopyright Py_PROTO((void));
65-
DL_IMPORT(const char *) Py_GetCompiler Py_PROTO((void));
66-
DL_IMPORT(const char *) Py_GetBuildInfo Py_PROTO((void));
62+
DL_IMPORT(const char *) Py_GetVersion(void);
63+
DL_IMPORT(const char *) Py_GetPlatform(void);
64+
DL_IMPORT(const char *) Py_GetCopyright(void);
65+
DL_IMPORT(const char *) Py_GetCompiler(void);
66+
DL_IMPORT(const char *) Py_GetBuildInfo(void);
6767

6868
/* Internal -- various one-time initializations */
69-
DL_IMPORT(PyObject *) _PyBuiltin_Init Py_PROTO((void));
70-
DL_IMPORT(PyObject *) _PySys_Init Py_PROTO((void));
71-
DL_IMPORT(void) _PyImport_Init Py_PROTO((void));
72-
DL_IMPORT(void) init_exceptions Py_PROTO((void));
69+
DL_IMPORT(PyObject *) _PyBuiltin_Init(void);
70+
DL_IMPORT(PyObject *) _PySys_Init(void);
71+
DL_IMPORT(void) _PyImport_Init(void);
72+
DL_IMPORT(void) init_exceptions(void);
7373

7474
/* Various internal finalizers */
75-
DL_IMPORT(void) fini_exceptions Py_PROTO((void));
76-
DL_IMPORT(void) _PyImport_Fini Py_PROTO((void));
77-
DL_IMPORT(void) PyMethod_Fini Py_PROTO((void));
78-
DL_IMPORT(void) PyFrame_Fini Py_PROTO((void));
79-
DL_IMPORT(void) PyCFunction_Fini Py_PROTO((void));
80-
DL_IMPORT(void) PyTuple_Fini Py_PROTO((void));
81-
DL_IMPORT(void) PyString_Fini Py_PROTO((void));
82-
DL_IMPORT(void) PyInt_Fini Py_PROTO((void));
83-
DL_IMPORT(void) PyFloat_Fini Py_PROTO((void));
84-
DL_IMPORT(void) PyOS_FiniInterrupts Py_PROTO((void));
75+
DL_IMPORT(void) fini_exceptions(void);
76+
DL_IMPORT(void) _PyImport_Fini(void);
77+
DL_IMPORT(void) PyMethod_Fini(void);
78+
DL_IMPORT(void) PyFrame_Fini(void);
79+
DL_IMPORT(void) PyCFunction_Fini(void);
80+
DL_IMPORT(void) PyTuple_Fini(void);
81+
DL_IMPORT(void) PyString_Fini(void);
82+
DL_IMPORT(void) PyInt_Fini(void);
83+
DL_IMPORT(void) PyFloat_Fini(void);
84+
DL_IMPORT(void) PyOS_FiniInterrupts(void);
8585

8686
/* Stuff with no proper home (yet) */
87-
DL_IMPORT(char *) PyOS_Readline Py_PROTO((char *));
88-
extern DL_IMPORT(int) (*PyOS_InputHook) Py_PROTO((void));
89-
extern DL_IMPORT(char) *(*PyOS_ReadlineFunctionPointer) Py_PROTO((char *));
87+
DL_IMPORT(char *) PyOS_Readline(char *);
88+
extern DL_IMPORT(int) (*PyOS_InputHook)(void);
89+
extern DL_IMPORT(char) *(*PyOS_ReadlineFunctionPointer)(char *);
9090

9191
#ifdef __cplusplus
9292
}

Include/pythread.h

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#ifndef Py_PYTHREAD_H
2-
#define Py_PYTHREAD_H
3-
41
/***********************************************************
52
Copyright (c) 2000, BeOpen.com.
63
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
@@ -11,53 +8,48 @@ See the file "Misc/COPYRIGHT" for information on usage and
118
redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
129
******************************************************************/
1310

11+
#ifndef Py_PYTHREAD_H
12+
#define Py_PYTHREAD_H
13+
1414
#define NO_EXIT_PROG /* don't define PyThread_exit_prog() */
1515
/* (the result is no use of signals on SGI) */
1616

17-
#ifndef Py_PROTO
18-
#if defined(__STDC__) || defined(__cplusplus)
19-
#define Py_PROTO(args) args
20-
#else
21-
#define Py_PROTO(args) ()
22-
#endif
23-
#endif
24-
2517
typedef void *PyThread_type_lock;
2618
typedef void *PyThread_type_sema;
2719

2820
#ifdef __cplusplus
2921
extern "C" {
3022
#endif
3123

32-
DL_IMPORT(void) PyThread_init_thread Py_PROTO((void));
33-
DL_IMPORT(int) PyThread_start_new_thread Py_PROTO((void (*)(void *), void *));
34-
DL_IMPORT(void) PyThread_exit_thread Py_PROTO((void));
35-
DL_IMPORT(void) PyThread__PyThread_exit_thread Py_PROTO((void));
36-
DL_IMPORT(long) PyThread_get_thread_ident Py_PROTO((void));
24+
DL_IMPORT(void) PyThread_init_thread(void);
25+
DL_IMPORT(int) PyThread_start_new_thread(void (*)(void *), void *);
26+
DL_IMPORT(void) PyThread_exit_thread(void);
27+
DL_IMPORT(void) PyThread__PyThread_exit_thread(void);
28+
DL_IMPORT(long) PyThread_get_thread_ident(void);
3729

38-
DL_IMPORT(PyThread_type_lock) PyThread_allocate_lock Py_PROTO((void));
39-
DL_IMPORT(void) PyThread_free_lock Py_PROTO((PyThread_type_lock));
40-
DL_IMPORT(int) PyThread_acquire_lock Py_PROTO((PyThread_type_lock, int));
30+
DL_IMPORT(PyThread_type_lock) PyThread_allocate_lock(void);
31+
DL_IMPORT(void) PyThread_free_lock(PyThread_type_lock);
32+
DL_IMPORT(int) PyThread_acquire_lock(PyThread_type_lock, int);
4133
#define WAIT_LOCK 1
4234
#define NOWAIT_LOCK 0
43-
DL_IMPORT(void) PyThread_release_lock Py_PROTO((PyThread_type_lock));
35+
DL_IMPORT(void) PyThread_release_lock(PyThread_type_lock);
4436

45-
DL_IMPORT(PyThread_type_sema) PyThread_allocate_sema Py_PROTO((int));
46-
DL_IMPORT(void) PyThread_free_sema Py_PROTO((PyThread_type_sema));
47-
DL_IMPORT(int) PyThread_down_sema Py_PROTO((PyThread_type_sema, int));
37+
DL_IMPORT(PyThread_type_sema) PyThread_allocate_sema(int);
38+
DL_IMPORT(void) PyThread_free_sema(PyThread_type_sema);
39+
DL_IMPORT(int) PyThread_down_sema(PyThread_type_sema, int);
4840
#define WAIT_SEMA 1
4941
#define NOWAIT_SEMA 0
50-
DL_IMPORT(void) PyThread_up_sema Py_PROTO((PyThread_type_sema));
42+
DL_IMPORT(void) PyThread_up_sema(PyThread_type_sema);
5143

5244
#ifndef NO_EXIT_PROG
53-
DL_IMPORT(void) PyThread_exit_prog Py_PROTO((int));
54-
DL_IMPORT(void) PyThread__PyThread_exit_prog Py_PROTO((int));
45+
DL_IMPORT(void) PyThread_exit_prog(int);
46+
DL_IMPORT(void) PyThread__PyThread_exit_prog(int);
5547
#endif
5648

57-
DL_IMPORT(int) PyThread_create_key Py_PROTO((void));
58-
DL_IMPORT(void) PyThread_delete_key Py_PROTO((int));
59-
DL_IMPORT(int) PyThread_set_key_value Py_PROTO((int, void *));
60-
DL_IMPORT(void *) PyThread_get_key_value Py_PROTO((int));
49+
DL_IMPORT(int) PyThread_create_key(void);
50+
DL_IMPORT(void) PyThread_delete_key(int);
51+
DL_IMPORT(int) PyThread_set_key_value(int, void *);
52+
DL_IMPORT(void *) PyThread_get_key_value(int);
6153

6254
#ifdef __cplusplus
6355
}

Include/rangeobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ extern DL_IMPORT(PyTypeObject) PyRange_Type;
2222

2323
#define PyRange_Check(op) ((op)->ob_type == &PyRange_Type)
2424

25-
extern DL_IMPORT(PyObject *) PyRange_New Py_PROTO((long, long, long, int));
25+
extern DL_IMPORT(PyObject *) PyRange_New(long, long, long, int);

Include/sliceobject.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ let these be any arbitrary python type.
2020
*/
2121

2222
typedef struct {
23-
PyObject_HEAD
24-
PyObject *start, *stop, *step;
23+
PyObject_HEAD
24+
PyObject *start, *stop, *step;
2525
} PySliceObject;
2626

2727
extern DL_IMPORT(PyTypeObject) PySlice_Type;
2828

2929
#define PySlice_Check(op) ((op)->ob_type == &PySlice_Type)
3030

31-
DL_IMPORT(PyObject *) PySlice_New Py_PROTO((
32-
PyObject* start, PyObject* stop, PyObject* step));
33-
DL_IMPORT(int) PySlice_GetIndices Py_PROTO((
34-
PySliceObject *r, int length, int *start, int *stop, int *step));
31+
DL_IMPORT(PyObject *) PySlice_New(PyObject* start, PyObject* stop,
32+
PyObject* step);
33+
DL_IMPORT(int) PySlice_GetIndices(PySliceObject *r, int length,
34+
int *start, int *stop, int *step);
3535

3636
#ifdef __cplusplus
3737
}

0 commit comments

Comments
 (0)