mirror of
https://github.com/python/cpython.git
synced 2025-11-02 19:12:55 +00:00
Miscelaneous ANSIfications. I'm assuming here 'main' should take (int,
char**) and return an int even on PC platforms. If not, please fix PC/utils/makesrc.c ;-P
This commit is contained in:
parent
23c9e0024a
commit
7889010731
14 changed files with 109 additions and 145 deletions
|
|
@ -2,11 +2,9 @@
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
|
||||||
void initxyzzy(); /* Forward */
|
void initxyzzy(void); /* Forward */
|
||||||
|
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
/* Pass argv[0] to the Python interpreter */
|
/* Pass argv[0] to the Python interpreter */
|
||||||
Py_SetProgramName(argv[0]);
|
Py_SetProgramName(argv[0]);
|
||||||
|
|
@ -46,10 +44,9 @@ main(argc, argv)
|
||||||
|
|
||||||
/* A static module */
|
/* A static module */
|
||||||
|
|
||||||
|
/* 'self' is not used */
|
||||||
static PyObject *
|
static PyObject *
|
||||||
xyzzy_foo(self, args)
|
xyzzy_foo(PyObject *self, PyObjecT *args)
|
||||||
PyObject *self; /* Not used */
|
|
||||||
PyObject *args;
|
|
||||||
{
|
{
|
||||||
if (!PyArg_ParseTuple(args, ""))
|
if (!PyArg_ParseTuple(args, ""))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -62,7 +59,7 @@ static PyMethodDef xyzzy_methods[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
initxyzzy()
|
initxyzzy(void)
|
||||||
{
|
{
|
||||||
PyImport_AddModule("xyzzy");
|
PyImport_AddModule("xyzzy");
|
||||||
Py_InitModule("xyzzy", xyzzy_methods);
|
Py_InitModule("xyzzy", xyzzy_methods);
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ extern int Py_VerboseFlag;
|
||||||
|
|
||||||
extern int optind;
|
extern int optind;
|
||||||
extern char *optarg;
|
extern char *optarg;
|
||||||
extern int getopt();
|
extern int getopt(int, char **, char *);
|
||||||
|
|
||||||
struct workorder {
|
struct workorder {
|
||||||
int conn;
|
int conn;
|
||||||
|
|
@ -97,7 +97,7 @@ main(int argc, char **argv)
|
||||||
static char usage_line[] = "usage: %s [port]\n";
|
static char usage_line[] = "usage: %s [port]\n";
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, usage_line, progname);
|
fprintf(stderr, usage_line, progname);
|
||||||
exit(2);
|
exit(2);
|
||||||
|
|
@ -220,7 +220,7 @@ static PyInterpreterState *the_interp;
|
||||||
static PyObject *the_builtins;
|
static PyObject *the_builtins;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_python()
|
init_python(void)
|
||||||
{
|
{
|
||||||
if (gtstate)
|
if (gtstate)
|
||||||
return;
|
return;
|
||||||
|
|
@ -268,7 +268,7 @@ service_thread(struct workorder *work)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
oprogname()
|
oprogname(void)
|
||||||
{
|
{
|
||||||
int save = errno;
|
int save = errno;
|
||||||
fprintf(stderr, "%s: ", progname);
|
fprintf(stderr, "%s: ", progname);
|
||||||
|
|
@ -364,7 +364,7 @@ run_command(char *buffer, PyObject *globals)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ps()
|
ps(void)
|
||||||
{
|
{
|
||||||
char buffer[100];
|
char buffer[100];
|
||||||
sprintf(buffer, "ps -l -p %d </dev/null | tail +2l\n", getpid());
|
sprintf(buffer, "ps -l -p %d </dev/null | tail +2l\n", getpid());
|
||||||
|
|
|
||||||
|
|
@ -107,9 +107,7 @@ static struct PycStringIO_CAPI {
|
||||||
((O)->ob_type==PycStringIO->OutputType)
|
((O)->ob_type==PycStringIO->OutputType)
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
xxxPyCObject_Import(module_name, name)
|
xxxPyCObject_Import(char *module_name, char *name)
|
||||||
char *module_name;
|
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
PyObject *m, *c;
|
PyObject *m, *c;
|
||||||
void *r=NULL;
|
void *r=NULL;
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ typedef struct {
|
||||||
} dictobject;
|
} dictobject;
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyDict_New()
|
PyDict_New(void)
|
||||||
{
|
{
|
||||||
register dictobject *mp;
|
register dictobject *mp;
|
||||||
if (dummy == NULL) { /* Auto-initialize dummy */
|
if (dummy == NULL) { /* Auto-initialize dummy */
|
||||||
|
|
|
||||||
|
|
@ -554,7 +554,7 @@ int PyUnicode_GetSize(PyObject *unicode)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *PyUnicode_GetDefaultEncoding()
|
const char *PyUnicode_GetDefaultEncoding(void)
|
||||||
{
|
{
|
||||||
return unicode_default_encoding;
|
return unicode_default_encoding;
|
||||||
}
|
}
|
||||||
|
|
@ -4530,10 +4530,7 @@ unicode_buffer_getcharbuf(PyUnicodeObject *self,
|
||||||
/* Helpers for PyUnicode_Format() */
|
/* Helpers for PyUnicode_Format() */
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
getnextarg(args, arglen, p_argidx)
|
getnextarg(PyObject *args, int arglen, int *p_argidx)
|
||||||
PyObject *args;
|
|
||||||
int arglen;
|
|
||||||
int *p_argidx;
|
|
||||||
{
|
{
|
||||||
int argidx = *p_argidx;
|
int argidx = *p_argidx;
|
||||||
if (argidx < arglen) {
|
if (argidx < arglen) {
|
||||||
|
|
@ -4555,26 +4552,13 @@ int *p_argidx;
|
||||||
#define F_ZERO (1<<4)
|
#define F_ZERO (1<<4)
|
||||||
|
|
||||||
static
|
static
|
||||||
#ifdef HAVE_STDARG_PROTOTYPES
|
|
||||||
int usprintf(register Py_UNICODE *buffer, char *format, ...)
|
int usprintf(register Py_UNICODE *buffer, char *format, ...)
|
||||||
#else
|
|
||||||
int usprintf(va_alist) va_dcl
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
int len;
|
int len;
|
||||||
va_list va;
|
va_list va;
|
||||||
char *charbuffer;
|
char *charbuffer;
|
||||||
#ifdef HAVE_STDARG_PROTOTYPES
|
|
||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
#else
|
|
||||||
Py_UNICODE *args;
|
|
||||||
char *format;
|
|
||||||
|
|
||||||
va_start(va);
|
|
||||||
buffer = va_arg(va, Py_UNICODE *);
|
|
||||||
format = va_arg(va, char *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* First, format the string as char array, then expand to Py_UNICODE
|
/* First, format the string as char array, then expand to Py_UNICODE
|
||||||
array. */
|
array. */
|
||||||
|
|
@ -5121,7 +5105,7 @@ PyTypeObject PyUnicode_Type = {
|
||||||
|
|
||||||
/* Initialize the Unicode implementation */
|
/* Initialize the Unicode implementation */
|
||||||
|
|
||||||
void _PyUnicode_Init()
|
void _PyUnicode_Init(void)
|
||||||
{
|
{
|
||||||
/* Doublecheck the configuration... */
|
/* Doublecheck the configuration... */
|
||||||
if (sizeof(Py_UNICODE) != 2)
|
if (sizeof(Py_UNICODE) != 2)
|
||||||
|
|
@ -5138,7 +5122,7 @@ void _PyUnicode_Init()
|
||||||
/* Finalize the Unicode implementation */
|
/* Finalize the Unicode implementation */
|
||||||
|
|
||||||
void
|
void
|
||||||
_PyUnicode_Fini()
|
_PyUnicode_Fini(void)
|
||||||
{
|
{
|
||||||
PyUnicodeObject *u = unicode_freelist;
|
PyUnicodeObject *u = unicode_freelist;
|
||||||
|
|
||||||
|
|
|
||||||
58
PC/config.c
58
PC/config.c
|
|
@ -15,48 +15,48 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
|
||||||
extern void initarray();
|
extern void initarray(void);
|
||||||
#ifndef MS_WIN64
|
#ifndef MS_WIN64
|
||||||
extern void initaudioop();
|
extern void initaudioop(void);
|
||||||
extern void initbinascii();
|
extern void initbinascii(void);
|
||||||
#endif
|
#endif
|
||||||
extern void initcmath();
|
extern void initcmath(void);
|
||||||
extern void initerrno();
|
extern void initerrno(void);
|
||||||
#ifdef WITH_CYCLE_GC
|
#ifdef WITH_CYCLE_GC
|
||||||
extern void initgc();
|
extern void initgc(void);
|
||||||
#endif
|
#endif
|
||||||
#ifndef MS_WIN64
|
#ifndef MS_WIN64
|
||||||
extern void initimageop();
|
extern void initimageop(void);
|
||||||
#endif
|
#endif
|
||||||
extern void initmath();
|
extern void initmath(void);
|
||||||
extern void initmd5();
|
extern void initmd5(void);
|
||||||
extern void initnew();
|
extern void initnew(void);
|
||||||
extern void initnt();
|
extern void initnt(void);
|
||||||
extern void initoperator();
|
extern void initoperator(void);
|
||||||
extern void initregex();
|
extern void initregex(void);
|
||||||
#ifndef MS_WIN64
|
#ifndef MS_WIN64
|
||||||
extern void initrgbimg();
|
extern void initrgbimg(void);
|
||||||
#endif
|
#endif
|
||||||
extern void initrotor();
|
extern void initrotor(void);
|
||||||
extern void initsignal();
|
extern void initsignal(void);
|
||||||
extern void initsha();
|
extern void initsha(void);
|
||||||
extern void initstrop();
|
extern void initstrop(void);
|
||||||
extern void initstruct();
|
extern void initstruct(void);
|
||||||
extern void inittime();
|
extern void inittime(void);
|
||||||
extern void initthread();
|
extern void initthread(void);
|
||||||
extern void initcStringIO();
|
extern void initcStringIO(void);
|
||||||
extern void initcPickle();
|
extern void initcPickle(void);
|
||||||
extern void initpcre();
|
extern void initpcre(void);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
extern void initmsvcrt();
|
extern void initmsvcrt(void);
|
||||||
extern void init_locale();
|
extern void init_locale(void);
|
||||||
#endif
|
#endif
|
||||||
extern void init_codecs();
|
extern void init_codecs(void);
|
||||||
|
|
||||||
/* -- ADDMODULE MARKER 1 -- */
|
/* -- ADDMODULE MARKER 1 -- */
|
||||||
|
|
||||||
extern void PyMarshal_Init();
|
extern void PyMarshal_Init(void);
|
||||||
extern void initimp();
|
extern void initimp(void);
|
||||||
|
|
||||||
struct _inittab _PyImport_Inittab[] = {
|
struct _inittab _PyImport_Inittab[] = {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
ex_foo(self, args)
|
ex_foo(PyObject *self, PyObject *args)
|
||||||
PyObject *self, *args;
|
|
||||||
{
|
{
|
||||||
printf("Hello, world\n");
|
printf("Hello, world\n");
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
|
|
@ -15,7 +14,7 @@ static PyMethodDef example_methods[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
initexample()
|
initexample(void)
|
||||||
{
|
{
|
||||||
Py_InitModule("example", example_methods);
|
Py_InitModule("example", example_methods);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ BOOL CallModuleDllMain(char *modName, DWORD dwReason);
|
||||||
Called by a frozen .EXE only, so that built-in extension
|
Called by a frozen .EXE only, so that built-in extension
|
||||||
modules are initialized correctly
|
modules are initialized correctly
|
||||||
*/
|
*/
|
||||||
void PyWinFreeze_ExeInit()
|
void PyWinFreeze_ExeInit(void)
|
||||||
{
|
{
|
||||||
char **modName;
|
char **modName;
|
||||||
for (modName = possibleModules;*modName;*modName++) {
|
for (modName = possibleModules;*modName;*modName++) {
|
||||||
|
|
@ -73,7 +73,7 @@ void PyWinFreeze_ExeInit()
|
||||||
Called by a frozen .EXE only, so that built-in extension
|
Called by a frozen .EXE only, so that built-in extension
|
||||||
modules are cleaned up
|
modules are cleaned up
|
||||||
*/
|
*/
|
||||||
void PyWinFreeze_ExeTerm()
|
void PyWinFreeze_ExeTerm(void)
|
||||||
{
|
{
|
||||||
// Must go backwards
|
// Must go backwards
|
||||||
char **modName;
|
char **modName;
|
||||||
|
|
|
||||||
|
|
@ -98,8 +98,7 @@ static char *module_search_path = NULL;
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
is_sep(ch) /* determine if "ch" is a separator character */
|
is_sep(char ch) /* determine if "ch" is a separator character */
|
||||||
char ch;
|
|
||||||
{
|
{
|
||||||
#ifdef ALTSEP
|
#ifdef ALTSEP
|
||||||
return ch == SEP || ch == ALTSEP;
|
return ch == SEP || ch == ALTSEP;
|
||||||
|
|
@ -110,8 +109,7 @@ is_sep(ch) /* determine if "ch" is a separator character */
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
reduce(dir)
|
reduce(char *dir)
|
||||||
char *dir;
|
|
||||||
{
|
{
|
||||||
size_t i = strlen(dir);
|
size_t i = strlen(dir);
|
||||||
while (i > 0 && !is_sep(dir[i]))
|
while (i > 0 && !is_sep(dir[i]))
|
||||||
|
|
@ -121,8 +119,7 @@ reduce(dir)
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
exists(filename)
|
exists(char *filename)
|
||||||
char *filename;
|
|
||||||
{
|
{
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
return stat(filename, &buf) == 0;
|
return stat(filename, &buf) == 0;
|
||||||
|
|
@ -130,8 +127,7 @@ exists(filename)
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ismodule(filename) /* Is module -- check for .pyc/.pyo too */
|
ismodule(char *filename) /* Is module -- check for .pyc/.pyo too */
|
||||||
char *filename;
|
|
||||||
{
|
{
|
||||||
if (exists(filename))
|
if (exists(filename))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -147,9 +143,7 @@ ismodule(filename) /* Is module -- check for .pyc/.pyo too */
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
join(buffer, stuff)
|
join(char *buffer, char *stuff)
|
||||||
char *buffer;
|
|
||||||
char *stuff;
|
|
||||||
{
|
{
|
||||||
size_t n, k;
|
size_t n, k;
|
||||||
if (is_sep(stuff[0]))
|
if (is_sep(stuff[0]))
|
||||||
|
|
@ -168,8 +162,7 @@ join(buffer, stuff)
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
gotlandmark(landmark)
|
gotlandmark(char *landmark)
|
||||||
char *landmark;
|
|
||||||
{
|
{
|
||||||
int n, ok;
|
int n, ok;
|
||||||
|
|
||||||
|
|
@ -182,9 +175,7 @@ gotlandmark(landmark)
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
search_for_prefix(argv0_path, landmark)
|
search_for_prefix(char *argv0_path, char *landmark)
|
||||||
char *argv0_path;
|
|
||||||
char *landmark;
|
|
||||||
{
|
{
|
||||||
/* Search from argv0_path, until landmark is found */
|
/* Search from argv0_path, until landmark is found */
|
||||||
strcpy(prefix, argv0_path);
|
strcpy(prefix, argv0_path);
|
||||||
|
|
@ -343,7 +334,7 @@ done:
|
||||||
#endif /* MS_WIN32 */
|
#endif /* MS_WIN32 */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_progpath()
|
get_progpath(void)
|
||||||
{
|
{
|
||||||
extern char *Py_GetProgramName();
|
extern char *Py_GetProgramName();
|
||||||
char *path = getenv("PATH");
|
char *path = getenv("PATH");
|
||||||
|
|
@ -403,7 +394,7 @@ get_progpath()
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
calculate_path()
|
calculate_path(void)
|
||||||
{
|
{
|
||||||
char argv0_path[MAXPATHLEN+1];
|
char argv0_path[MAXPATHLEN+1];
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
@ -565,7 +556,7 @@ calculate_path()
|
||||||
/* External interface */
|
/* External interface */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
Py_GetPath()
|
Py_GetPath(void)
|
||||||
{
|
{
|
||||||
if (!module_search_path)
|
if (!module_search_path)
|
||||||
calculate_path();
|
calculate_path();
|
||||||
|
|
@ -573,7 +564,7 @@ Py_GetPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
Py_GetPrefix()
|
Py_GetPrefix(void)
|
||||||
{
|
{
|
||||||
if (!module_search_path)
|
if (!module_search_path)
|
||||||
calculate_path();
|
calculate_path();
|
||||||
|
|
@ -581,13 +572,13 @@ Py_GetPrefix()
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
Py_GetExecPrefix()
|
Py_GetExecPrefix(void)
|
||||||
{
|
{
|
||||||
return Py_GetPrefix();
|
return Py_GetPrefix();
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
Py_GetProgramFullPath()
|
Py_GetProgramFullPath(void)
|
||||||
{
|
{
|
||||||
if (!module_search_path)
|
if (!module_search_path)
|
||||||
calculate_path();
|
calculate_path();
|
||||||
|
|
|
||||||
|
|
@ -15,41 +15,41 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
|
||||||
extern void initarray();
|
extern void initarray(void);
|
||||||
extern void initaudioop();
|
extern void initaudioop(void);
|
||||||
extern void initbinascii();
|
extern void initbinascii(void);
|
||||||
extern void initcmath();
|
extern void initcmath(void);
|
||||||
extern void initerrno();
|
extern void initerrno(void);
|
||||||
extern void initimageop();
|
extern void initimageop(void);
|
||||||
extern void initmath();
|
extern void initmath(void);
|
||||||
extern void initmd5();
|
extern void initmd5(void);
|
||||||
extern void initnew();
|
extern void initnew(void);
|
||||||
extern void initnt();
|
extern void initnt(void);
|
||||||
extern void initos2();
|
extern void initos2(void);
|
||||||
extern void initoperator();
|
extern void initoperator(void);
|
||||||
extern void initposix();
|
extern void initposix(void);
|
||||||
extern void initregex();
|
extern void initregex(void);
|
||||||
extern void initrgbimg();
|
extern void initrgbimg(void);
|
||||||
extern void initrotor();
|
extern void initrotor(void);
|
||||||
extern void initsignal();
|
extern void initsignal(void);
|
||||||
extern void initselect();
|
extern void initselect(void);
|
||||||
extern void init_socket();
|
extern void init_socket(void);
|
||||||
extern void initsoundex();
|
extern void initsoundex(void);
|
||||||
extern void initstrop();
|
extern void initstrop(void);
|
||||||
extern void initstruct();
|
extern void initstruct(void);
|
||||||
extern void inittime();
|
extern void inittime(void);
|
||||||
extern void initthread();
|
extern void initthread(void);
|
||||||
extern void initcStringIO();
|
extern void initcStringIO(void);
|
||||||
extern void initcPickle();
|
extern void initcPickle(void);
|
||||||
extern void initpcre();
|
extern void initpcre(void);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
extern void initmsvcrt();
|
extern void initmsvcrt(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* -- ADDMODULE MARKER 1 -- */
|
/* -- ADDMODULE MARKER 1 -- */
|
||||||
|
|
||||||
extern void PyMarshal_Init();
|
extern void PyMarshal_Init(void);
|
||||||
extern void initimp();
|
extern void initimp(void);
|
||||||
|
|
||||||
struct _inittab _PyImport_Inittab[] = {
|
struct _inittab _PyImport_Inittab[] = {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,7 @@ static char *module_search_path = NULL;
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
is_sep(ch) /* determine if "ch" is a separator character */
|
is_sep(char ch) /* determine if "ch" is a separator character */
|
||||||
char ch;
|
|
||||||
{
|
{
|
||||||
#ifdef ALTSEP
|
#ifdef ALTSEP
|
||||||
return ch == SEP || ch == ALTSEP;
|
return ch == SEP || ch == ALTSEP;
|
||||||
|
|
@ -76,8 +75,7 @@ is_sep(ch) /* determine if "ch" is a separator character */
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
reduce(dir)
|
reduce(char *dir)
|
||||||
char *dir;
|
|
||||||
{
|
{
|
||||||
int i = strlen(dir);
|
int i = strlen(dir);
|
||||||
while (i > 0 && !is_sep(dir[i]))
|
while (i > 0 && !is_sep(dir[i]))
|
||||||
|
|
@ -87,8 +85,7 @@ reduce(dir)
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
exists(filename)
|
exists(char *filename)
|
||||||
char *filename;
|
|
||||||
{
|
{
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
return stat(filename, &buf) == 0;
|
return stat(filename, &buf) == 0;
|
||||||
|
|
@ -96,9 +93,7 @@ exists(filename)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
join(buffer, stuff)
|
join(char *buffer, char *stuff)
|
||||||
char *buffer;
|
|
||||||
char *stuff;
|
|
||||||
{
|
{
|
||||||
int n, k;
|
int n, k;
|
||||||
if (is_sep(stuff[0]))
|
if (is_sep(stuff[0]))
|
||||||
|
|
@ -117,9 +112,7 @@ join(buffer, stuff)
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
search_for_prefix(argv0_path, landmark)
|
search_for_prefix(char *argv0_path, char *landmark)
|
||||||
char *argv0_path;
|
|
||||||
char *landmark;
|
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
|
|
@ -247,7 +240,7 @@ getpythonregpath(HKEY keyBase, BOOL bWin32s)
|
||||||
#endif /* MS_WIN32 */
|
#endif /* MS_WIN32 */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_progpath()
|
get_progpath(void)
|
||||||
{
|
{
|
||||||
extern char *Py_GetProgramName();
|
extern char *Py_GetProgramName();
|
||||||
char *path = getenv("PATH");
|
char *path = getenv("PATH");
|
||||||
|
|
@ -299,7 +292,7 @@ get_progpath()
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
calculate_path()
|
calculate_path(void)
|
||||||
{
|
{
|
||||||
char argv0_path[MAXPATHLEN+1];
|
char argv0_path[MAXPATHLEN+1];
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
@ -451,7 +444,7 @@ calculate_path()
|
||||||
/* External interface */
|
/* External interface */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
Py_GetPath()
|
Py_GetPath(void)
|
||||||
{
|
{
|
||||||
if (!module_search_path)
|
if (!module_search_path)
|
||||||
calculate_path();
|
calculate_path();
|
||||||
|
|
@ -460,7 +453,7 @@ Py_GetPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
Py_GetPrefix()
|
Py_GetPrefix(void)
|
||||||
{
|
{
|
||||||
if (!module_search_path)
|
if (!module_search_path)
|
||||||
calculate_path();
|
calculate_path();
|
||||||
|
|
@ -469,7 +462,7 @@ Py_GetPrefix()
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
Py_GetExecPrefix()
|
Py_GetExecPrefix(void)
|
||||||
{
|
{
|
||||||
if (!module_search_path)
|
if (!module_search_path)
|
||||||
calculate_path();
|
calculate_path();
|
||||||
|
|
@ -478,7 +471,7 @@ Py_GetExecPrefix()
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
Py_GetProgramFullPath()
|
Py_GetProgramFullPath(void)
|
||||||
{
|
{
|
||||||
if (!module_search_path)
|
if (!module_search_path)
|
||||||
calculate_path();
|
calculate_path();
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,9 @@ file names and #include names to 8x3 lower case */
|
||||||
|
|
||||||
char *usage = "You must be in the \"pc\" directory.\n";
|
char *usage = "You must be in the \"pc\" directory.\n";
|
||||||
char *list[] = {"..\\Include", "..\\Modules", "..\\Objects", "..\\Parser", "..\\Python", ".", 0};
|
char *list[] = {"..\\Include", "..\\Modules", "..\\Objects", "..\\Parser", "..\\Python", ".", 0};
|
||||||
main()
|
|
||||||
|
int
|
||||||
|
main(int argc, char ** argv)
|
||||||
{
|
{
|
||||||
DIR *dpath;
|
DIR *dpath;
|
||||||
struct dirent *dir;
|
struct dirent *dir;
|
||||||
|
|
@ -64,4 +66,4 @@ main()
|
||||||
closedir(dpath);
|
closedir(dpath);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ static void add_define(PyObject *dict, const char *key, long value)
|
||||||
#define ADD_DEFINE(tok) add_define(dict,#tok,tok)
|
#define ADD_DEFINE(tok) add_define(dict,#tok,tok)
|
||||||
|
|
||||||
DL_EXPORT(void)
|
DL_EXPORT(void)
|
||||||
initwinsound()
|
initwinsound(void)
|
||||||
{
|
{
|
||||||
PyObject *module=Py_InitModule3("winsound", sound_methods, sound_module_doc);
|
PyObject *module=Py_InitModule3("winsound", sound_methods, sound_module_doc);
|
||||||
PyObject *dict=PyModule_GetDict(module);
|
PyObject *dict=PyModule_GetDict(module);
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ static struct PyMethodDef hashMethods[] = {
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
_declspec(dllexport)
|
_declspec(dllexport)
|
||||||
#endif
|
#endif
|
||||||
void initperfhash()
|
void initperfhash(void)
|
||||||
{
|
{
|
||||||
PyObject *m;
|
PyObject *m;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue