mirror of
https://github.com/python/cpython.git
synced 2025-12-04 08:34:25 +00:00
changes for C++ (Tim MacKenzie)
This commit is contained in:
parent
062cfb0c4e
commit
6c1874fc2b
3 changed files with 33 additions and 7 deletions
|
|
@ -1,9 +1,5 @@
|
||||||
#ifndef Py_MYMALLOC_H
|
#ifndef Py_MYMALLOC_H
|
||||||
#define Py_MYMALLOC_H
|
#define Py_MYMALLOC_H
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
The Netherlands.
|
The Netherlands.
|
||||||
|
|
@ -52,7 +48,15 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
#ifdef HAVE_STDLIB_H
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#else /* !HAVE_STDLIB */
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
// Move this down here since some C++ #include's don't like to be included
|
||||||
|
// inside an extern "C"
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_STDLIB_H
|
||||||
extern ANY *malloc PROTO((size_t));
|
extern ANY *malloc PROTO((size_t));
|
||||||
extern ANY *calloc PROTO((size_t, size_t));
|
extern ANY *calloc PROTO((size_t, size_t));
|
||||||
extern ANY *realloc PROTO((ANY *, size_t));
|
extern ANY *realloc PROTO((ANY *, size_t));
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
# brought up to date by running "make Makefile". (The makesetup also
|
# brought up to date by running "make Makefile". (The makesetup also
|
||||||
# creates config.c from config.c.in in the source directory.)
|
# creates config.c from config.c.in in the source directory.)
|
||||||
|
|
||||||
|
LINKCC = $(CC)
|
||||||
# === Variables set by makesetup ===
|
# === Variables set by makesetup ===
|
||||||
|
|
||||||
MODOBJS= _MODOBJS_
|
MODOBJS= _MODOBJS_
|
||||||
|
|
@ -79,12 +80,12 @@ $(LIB): $(OBJS) Makefile
|
||||||
$(RANLIB) $(LIB)
|
$(RANLIB) $(LIB)
|
||||||
|
|
||||||
../python: config.o $(MYLIBS) Makefile
|
../python: config.o $(MYLIBS) Makefile
|
||||||
$(CC) $(OPT) config.o $(LINKFORSHARED) \
|
$(LINKCC) $(OPT) config.o $(LINKFORSHARED) \
|
||||||
$(MYLIBS) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python
|
$(MYLIBS) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python
|
||||||
mv python ../python
|
mv python ../python
|
||||||
|
|
||||||
config.o: config.c Makefile $(MYLIBS)
|
config.o: config.c Makefile $(MYLIBS)
|
||||||
$(CC) $(CFLAGS) -DPYTHONPATH=\"$(PYTHONPATH)\" -c config.c
|
$(LINKCC) $(CFLAGS) -DPYTHONPATH=\"$(PYTHONPATH)\" -c config.c
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm -f *.o python core *~ [@,#]* *.old *.orig *.rej
|
-rm -f *.o python core *~ [@,#]* *.old *.orig *.rej
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include "osdefs.h"
|
#include "osdefs.h"
|
||||||
#include "intrcheck.h"
|
#include "intrcheck.h"
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef NO_MAIN
|
#ifndef NO_MAIN
|
||||||
|
|
||||||
|
|
@ -59,9 +62,14 @@ static char *argv0;
|
||||||
static char **orig_argv;
|
static char **orig_argv;
|
||||||
static int orig_argc;
|
static int orig_argc;
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
int realmain(int, char**);
|
||||||
|
main(int argc, char **argv)
|
||||||
|
#else
|
||||||
main(argc, argv)
|
main(argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
orig_argc = argc;
|
orig_argc = argc;
|
||||||
orig_argv = argv;
|
orig_argv = argv;
|
||||||
|
|
@ -76,9 +84,13 @@ getprogramname()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
getargcargv(int *argc, char ***argv)
|
||||||
|
#else
|
||||||
getargcargv(argc,argv)
|
getargcargv(argc,argv)
|
||||||
int *argc;
|
int *argc;
|
||||||
char ***argv;
|
char ***argv;
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
*argc = orig_argc;
|
*argc = orig_argc;
|
||||||
*argv = orig_argv;
|
*argv = orig_argv;
|
||||||
|
|
@ -144,11 +156,16 @@ getcopyright()
|
||||||
#define PYTHONPATH ".:/usr/local/lib/python"
|
#define PYTHONPATH ".:/usr/local/lib/python"
|
||||||
#endif /* !PYTHONPATH */
|
#endif /* !PYTHONPATH */
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
extern char *getenv();
|
extern char *getenv();
|
||||||
|
#endif
|
||||||
|
|
||||||
char *
|
char *
|
||||||
getpythonpath()
|
getpythonpath()
|
||||||
{
|
{
|
||||||
|
#ifdef __cplusplus
|
||||||
|
void fatal(char *);
|
||||||
|
#endif
|
||||||
char *path = getenv("PYTHONPATH");
|
char *path = getenv("PYTHONPATH");
|
||||||
char *defpath = PYTHONPATH;
|
char *defpath = PYTHONPATH;
|
||||||
static char *buf = NULL;
|
static char *buf = NULL;
|
||||||
|
|
@ -215,3 +232,7 @@ struct frozen {
|
||||||
{0, 0, 0}
|
{0, 0, 0}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue