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

Skip to content

Commit 37ba0bc

Browse files
committed
split config.c in 1000 parts; new main; new unfinished objective-C module
1 parent e3e61c1 commit 37ba0bc

3 files changed

Lines changed: 21 additions & 234 deletions

File tree

Modules/Makefile.pre.in

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ LIBS= @LIBS@
2929
LIBM= @LIBM@
3030
LIBC= @LIBC@
3131

32-
# Machine-dependent subdirectories
33-
MACHDEP= @MACHDEP@
34-
3532
# Install prefix for architecture-independent files
3633
prefix= @prefix@
3734

@@ -61,6 +58,8 @@ MAKESETUP= $(srcdir)/makesetup
6158

6259
OBJS= $(MODOBJS)
6360

61+
ADDOBJS= main.o config.o getpath.o
62+
6463
LIB= libModules.a
6564

6665
MYLIBS= $(LIB) \
@@ -80,22 +79,22 @@ $(LIB): $& $(OBJS) Makefile
8079
$(AR) cr $(LIB) $(OBJS)
8180
$(RANLIB) $(LIB)
8281

83-
../python: config.o $(MYLIBS) Makefile
84-
$(LINKCC) $(OPT) config.o $(LINKFORSHARED) \
82+
../python: $(MYLIBS) $(ADDOBJS) Makefile
83+
$(LINKCC) $(OPT) $(LINKFORSHARED) $(ADDOBJS) \
8584
$(MYLIBS) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python
8685
mv python ../python
8786

88-
config.o: config.c Makefile $(MYLIBS)
89-
$(LINKCC) $(CFLAGS) -DPYTHONPATH=\"$(PYTHONPATH)\" \
90-
-DPLATFORM=\"$(MACHDEP)\" -c config.c
91-
9287
clean:
9388
-rm -f *.o python core *~ [@,#]* *.old *.orig *.rej
9489

9590
clobber: clean
9691
-rm -f *.a tags TAGS config.c glmodule.c Makefile.pre
9792
-rm -f *.so so_locations
9893

94+
getpath.o: getpath.c Makefile
95+
$(CC) -c $(CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
96+
$(srcdir)/getpath.c
97+
9998
config.c Makefile: Makefile.pre config.c.in $(MAKESETUP) Setup
10099
$(SHELL) $(MAKESETUP) Setup
101100

@@ -127,6 +126,7 @@ fmmodule.o: fmmodule.c
127126
glmodule.o: glmodule.c
128127
imageop.o: imageop.c
129128
imgfile.o: imgfile.c
129+
main.o: main.c
130130
mathmodule.o: mathmodule.c
131131
md5c.o: md5c.c
132132
md5module.o: md5module.c

Modules/Setup.in

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ rotor rotormodule.c # enigma-inspired encryption
245245

246246
# Lance's curses module. This requires the System V version of
247247
# curses, sometimes known as ncurses (e.g. on Linux, link with
248-
# -lncurses).
248+
# -lncurses instead of -lcurses; on SunOS 4.1.3, insert -I/usr/5include
249+
# -L/usr/5lib before -lcurses).
249250

250251
#curses cursesmodule.c -lcurses -ltermcap
251252

@@ -296,6 +297,9 @@ rotor rotormodule.c # enigma-inspired encryption
296297
# David Wayne Williams' soundex module
297298
#soundex soundex.c
298299

300+
# Objective-C (incomplete!!!)
301+
#objc.c
302+
299303

300304
# Example -- included for reference only:
301305
# xx xxmodule.c

Modules/config.c.in

Lines changed: 7 additions & 224 deletions
Original file line numberDiff line numberDiff line change
@@ -22,222 +22,19 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2222
2323
******************************************************************/
2424

25-
/* Universal Python configuration file */
25+
/* Module configuration */
2626

27-
#ifdef HAVE_CONFIG_H
28-
#include "config.h"
29-
#endif
27+
/* !!! !!! !!! This file is edited by the makesetup script !!! !!! !!! */
3028

31-
#ifdef macintosh
32-
/* The Macintosh main program is in macmain.c */
33-
#define NO_MAIN
34-
#endif
29+
/* This file contains the table of built-in modules.
30+
See init_builtin() in import.c. */
3531

36-
#include <stdio.h>
37-
#include <string.h>
32+
#include "Python.h"
3833

39-
#include "myproto.h"
40-
#include "mymalloc.h"
41-
#include "osdefs.h"
42-
#include "intrcheck.h"
43-
44-
#if defined(__cplusplus)
45-
extern "C" {
46-
#endif
47-
48-
#ifndef NO_MAIN
49-
50-
/* Normally, the main program is called from here (so everything else
51-
can be in libPython.a). We save a pointer to argv[0] because it
52-
may be needed for dynamic loading of modules in import.c. If you
53-
have your own main program and want to use non-SunOS dynamic
54-
loading, you will have to provide your own version of
55-
getprogramname(). */
56-
57-
static char *argv0;
58-
59-
/* These are made available for other modules that might need them.
60-
This is rare, but it is needed by the secureware module. */
61-
62-
static char **orig_argv;
63-
static int orig_argc;
64-
65-
extern int realmain PROTO((int, char**));
66-
67-
#if defined(__cplusplus)
68-
main(int argc, char **argv)
69-
#else
70-
main(argc, argv)
71-
int argc;
72-
char **argv;
73-
#endif
74-
{
75-
orig_argc = argc;
76-
orig_argv = argv;
77-
argv0 = argv[0];
78-
realmain(argc, argv);
79-
}
80-
81-
char *
82-
getprogramname()
83-
{
84-
return argv0;
85-
}
86-
87-
void
88-
#if defined(__cplusplus)
89-
getargcargv(int *argc, char ***argv)
90-
#else
91-
getargcargv(argc,argv)
92-
int *argc;
93-
char ***argv;
94-
#endif
95-
{
96-
*argc = orig_argc;
97-
*argv = orig_argv;
98-
}
99-
100-
#endif
101-
102-
103-
/* Python version information */
104-
105-
#include "patchlevel.h"
106-
107-
/* Return the version string. This is constructed from the official
108-
version number (from patchlevel.h), and the current date (if known
109-
to the compiler, else a manually inserted date). */
110-
111-
#define VERSION "%s (%s)%s"
112-
113-
#ifdef __DATE__
114-
#define DATE __DATE__
115-
#else
116-
#define DATE "July 7 1995"
117-
#endif
118-
119-
#ifdef THINK_C
120-
#define COMPILER " [THINK C]"
121-
#endif
122-
123-
#ifdef __MWERKS__
124-
#ifdef __powerc
125-
#define COMPILER " [CW PPC]"
126-
#else
127-
#define COMPILER " [CW 68K]"
128-
#endif
129-
#endif
130-
131-
#ifdef MPW
132-
#ifdef __SC__
133-
#define COMPILER " [Symantec MPW]"
134-
#else
135-
#define COMPILER " [Apple MPW]"
136-
#endif
137-
#endif
138-
139-
#ifdef __GNUC__
140-
#define COMPILER " [GCC " __VERSION__ "]"
141-
#endif
142-
143-
#ifndef COMPILER
144-
#define COMPILER ""
145-
#endif
146-
147-
char *
148-
getversion()
149-
{
150-
static char version[80];
151-
sprintf(version, VERSION, PATCHLEVEL, DATE, COMPILER);
152-
return version;
153-
}
154-
155-
156-
/* Return the copyright string. This is updated manually. */
157-
158-
char *
159-
getcopyright()
160-
{
161-
return "Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam";
162-
}
163-
164-
165-
/* Return the initial python search path. This is called once from
166-
initsys() to initialize sys.path.
167-
The environment variable PYTHONPATH is fetched and the default path
168-
appended. (The Mac has no environment variables, so there the
169-
default path is always returned.) The default path may be passed
170-
to the preprocessor; if not, a system-dependent default is used. */
171-
172-
#ifndef PYTHONPATH
173-
#ifdef macintosh
174-
#define PYTHONPATH ": :Lib :Lib:stdwin :Lib:test :Lib:mac"
175-
#endif /* macintosh */
176-
#endif /* !PYTHONPATH */
177-
178-
#ifndef PYTHONPATH
179-
#if defined(MSDOS) || defined(NT)
180-
#define PYTHONPATH ".;..\\lib;\\python\\lib"
181-
#endif /* MSDOS || NT */
182-
#endif /* !PYTHONPATH */
183-
184-
#ifndef PYTHONPATH
185-
#define PYTHONPATH ".:/usr/local/lib/python"
186-
#endif /* !PYTHONPATH */
187-
188-
#ifndef __cplusplus
189-
extern char *getenv();
190-
#endif
191-
192-
#ifndef PLATFORM
193-
#define PLATFORM "unknown"
194-
#endif
195-
196-
char *
197-
getplatform()
198-
{
199-
return PLATFORM;
200-
}
201-
202-
char *
203-
getpythonpath()
204-
{
205-
#ifdef __cplusplus
206-
void fatal(char *);
207-
#endif
208-
char *path = getenv("PYTHONPATH");
209-
char *defpath = PYTHONPATH;
210-
static char *buf = NULL;
211-
char *p;
212-
int n;
213-
214-
if (path == NULL)
215-
path = "";
216-
n = strlen(path) + strlen(defpath) + 2;
217-
if (buf != NULL) {
218-
free(buf);
219-
buf = NULL;
220-
}
221-
buf = malloc(n);
222-
if (buf == NULL)
223-
fatal("not enough memory to copy module search path");
224-
strcpy(buf, path);
225-
p = buf + strlen(buf);
226-
if (p != buf)
227-
*p++ = DELIM;
228-
strcpy(p, defpath);
229-
return buf;
230-
}
231-
232-
233-
/* Table of built-in modules.
234-
These are initialized when first imported.
235-
Note: selection of optional extensions is now generally done by the
236-
makesetup script. */
23734

23835
/* -- ADDMODULE MARKER 1 -- */
23936

240-
extern void initmarshal();
37+
extern void PyMarshal_Init();
24138
extern void initimp();
24239

24340
struct {
@@ -248,7 +45,7 @@ struct {
24845
/* -- ADDMODULE MARKER 2 -- */
24946

25047
/* This module "lives in" with marshal.c */
251-
{"marshal", initmarshal},
48+
{"marshal", PyMarshal_Init},
25249

25350
/* This lives it with import.c */
25451
{"imp", initimp},
@@ -261,17 +58,3 @@ struct {
26158
/* Sentinel */
26259
{0, 0}
26360
};
264-
265-
#ifndef USE_FROZEN
266-
struct frozen {
267-
char *name;
268-
char *code;
269-
int size;
270-
} frozen_modules[] = {
271-
{0, 0, 0}
272-
};
273-
#endif
274-
275-
#if defined(__cplusplus)
276-
}
277-
#endif

0 commit comments

Comments
 (0)