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

Skip to content

Commit 0b0db8e

Browse files
committed
Added separate main program for the Mac: macmain.c
stdwinmodule.c: wsetfont can now return an error Makefile: add CL_USE and CL_LIB*S; config.c: move CL part around New things in imgfile; also in Makefile. longobject.c: fix comparison of negative long ints... [REAL BUG!] marshal.c: add dumps() and loads() to read/write strings timemodule.c: make sure there's always a floatsleep() posixmodule.c: rationalize struct returned by times() Makefile: add test target, disable imgfile by default thread.c: Improved coexistance with dl module (sjoerd) stdwinmodule.c: Change include stdwin.h if macintosh rotormodule.c: added missing last argument to RTR_?_region calls confic.c: merged with configmac.c, added 1993 to copyright message fileobject.c: int compared to NULL in writestring(); change fopenRF ifdef timemodule.c: simplify times() using mkvalue; include myselect.h earlier (for sequent). posixmodule: for sequent, include unistd.h instead of explicit extern definitions and don't define rename() Makefile: change misleading/wrong MD5 comments
1 parent 80530ce commit 0b0db8e

8 files changed

Lines changed: 365 additions & 158 deletions

File tree

Modules/config.c.in

Lines changed: 56 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,30 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2525
/* Configurable Python configuration file */
2626

2727
/* These modules are normally always included, but *may* be taken out */
28-
#define USE_GRP 1 /* Use together with pwd */
2928
#define USE_MARSHAL 1 /* This is linked anyway */
3029
#define USE_MATH 1
31-
#define USE_PWD 1 /* Use together with grp */
30+
#define USE_STRUCT 1
31+
#define USE_STROP 1
32+
#define USE_TIME 1
33+
34+
#ifdef macintosh
35+
#define USE_AUDIOOP 1
36+
#define USE_IMAGEOP 1
37+
#define USE_MAC 1
38+
#define USE_REGEX 1
39+
#define USE_ROTOR 1
40+
#define USE_STDWIN 1 /* You may turn this off */
41+
#endif
42+
43+
#ifdef unix
44+
#define USE_GRP 1 /* Use together with pwd */
3245
#define USE_POSIX 1
46+
#define USE_PWD 1 /* Use together with grp */
3347
#define USE_SELECT 1
3448
#define USE_SOCKET 1
35-
#define USE_STRUCT 1
36-
#define USE_TIME 1
49+
#endif
50+
51+
#include <stdio.h>
3752

3853
#include "PROTO.h"
3954
#include "mymalloc.h"
@@ -45,18 +60,20 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
4560
#ifdef __DATE__
4661
#define DATE __DATE__
4762
#else
48-
#define DATE ">= 8 Jan 1993"
63+
#define DATE ">= 11 Jan 1993"
4964
#endif
5065

51-
#include <stdio.h>
52-
5366
#ifdef USE_STDWIN
54-
#include <stdwin.h>
55-
#endif
67+
#ifdef macintosh
68+
#include ":::src:stdwin:H:stdwin.h"
69+
#else /* !macintosh */
70+
#include "stdwin.h"
71+
#endif /* !macintosh */
72+
#endif /* USE_STDWIN */
5673

5774
char version[80];
5875

59-
char *argv0;
76+
char *argv0; /* For dynamic loading in import.c */
6077

6178
/*ARGSUSED*/
6279
void
@@ -69,13 +86,16 @@ initargs(p_argc, p_argv)
6986
argv0 = **p_argv;
7087

7188
#ifdef USE_STDWIN
72-
wargs(p_argc, p_argv);
89+
#ifdef THINK_C_3_0
90+
wsetstdio(1);
7391
#endif
92+
wargs(p_argc, p_argv);
93+
#endif /* USE_STDWIN */
7494
if (*p_argc < 2 && isatty(0) && isatty(1))
7595
{
7696
printf("Python %s.\n", version);
7797
printf(
78-
"Copyright 1990, 1991, 1992 Stichting Mathematisch Centrum, Amsterdam\n");
98+
"Copyright 1990, 1991, 1992, 1993 Stichting Mathematisch Centrum, Amsterdam\n");
7999
}
80100
}
81101

@@ -96,14 +116,22 @@ donecalls()
96116
}
97117

98118
#ifndef PYTHONPATH
119+
#ifdef macintosh
120+
/* On the Mac, the search path is a space-separated list of directories */
121+
#define PYTHONPATH ": :lib :demo"
122+
#else /* !macintosh */
99123
#define PYTHONPATH ".:/usr/local/lib/python"
100-
#endif
124+
#endif /* !macintosh */
125+
#endif /* !PYTHONPATH */
101126

102127
extern char *getenv();
103128

104129
char *
105130
getpythonpath()
106131
{
132+
#ifdef macintosh
133+
return PYTHONPATH;
134+
#else /* !macintosh */
107135
char *path = getenv("PYTHONPATH");
108136
char *defpath = PYTHONPATH;
109137
char *buf;
@@ -119,6 +147,7 @@ getpythonpath()
119147
strcat(buf, ":");
120148
strcat(buf, defpath);
121149
return buf;
150+
#endif /* !macintosh */
122151
}
123152

124153

@@ -142,6 +171,9 @@ extern void initaudioop();
142171
#ifdef USE_CD
143172
extern void initcd();
144173
#endif
174+
#ifdef USE_CL
175+
extern void initcl();
176+
#endif
145177
#ifdef USE_DBM
146178
extern void initdbm();
147179
#endif
@@ -166,6 +198,9 @@ extern void initimgfile();
166198
#ifdef USE_JPEG
167199
extern void initjpeg();
168200
#endif
201+
#ifdef USE_MAC
202+
extern void initmac();
203+
#endif
169204
#ifdef USE_MARSHAL
170205
extern void initmarshal();
171206
#endif
@@ -217,9 +252,6 @@ extern void initthread();
217252
#ifdef USE_SV
218253
extern void initsv();
219254
#endif
220-
#ifdef USE_CL
221-
extern void initcl();
222-
#endif
223255
#ifdef USE_TIME
224256
extern void inittime();
225257
#endif
@@ -259,6 +291,10 @@ struct {
259291
{"cd", initcd},
260292
#endif
261293

294+
#ifdef USE_CL
295+
{"cl", initcl},
296+
#endif
297+
262298
#ifdef USE_DBM
263299
{"dbm", initdbm},
264300
#endif
@@ -291,6 +327,10 @@ struct {
291327
{"jpeg", initjpeg},
292328
#endif
293329

330+
#ifdef USE_MAC
331+
{"mac", initmac},
332+
#endif
333+
294334
#ifdef USE_MARSHAL
295335
{"marshal", initmarshal},
296336
#endif
@@ -355,10 +395,6 @@ struct {
355395
{"sv", initsv},
356396
#endif
357397

358-
#ifdef USE_CL
359-
{"cl", initcl},
360-
#endif
361-
362398
#ifdef USE_THREAD
363399
{"thread", initthread},
364400
#endif

Modules/posixmodule.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
7575
#include "modsupport.h"
7676
#include "ceval.h"
7777

78+
#ifdef _SEQUENT_
79+
#include <unistd.h>
80+
#else /* _SEQUENT_ */
7881
/* XXX Aren't these always declared in unistd.h? */
7982
extern char *strerror PROTO((int));
8083
extern int chmod PROTO((const char *, mode_t));
@@ -87,6 +90,7 @@ extern int rmdir PROTO((const char *));
8790
extern int stat PROTO((const char *, struct stat *));
8891
extern int unlink PROTO((const char *));
8992
extern int pclose PROTO((FILE *));
93+
#endif /* _SEQUENT_ */
9094
#ifdef NO_LSTAT
9195
#define lstat stat
9296
#else
@@ -375,7 +379,7 @@ posix_nice(self, args)
375379
}
376380
#endif
377381

378-
#ifdef i386
382+
#if i386 && ! _SEQUENT_
379383
int
380384
rename(from, to)
381385
char *from;
@@ -388,7 +392,7 @@ rename(from, to)
388392
return status;
389393
return unlink(from);
390394
}
391-
#endif /* i386 */
395+
#endif /* i386 && ! _SEQUENT_ */
392396

393397
static object *
394398
posix_rename(self, args)
@@ -833,7 +837,6 @@ posix_times(self, args)
833837
{
834838
struct tms t;
835839
clock_t c;
836-
object *tuple;
837840
if (!getnoarg(args))
838841
return NULL;
839842
errno = 0;
@@ -842,18 +845,11 @@ posix_times(self, args)
842845
err_errno(PosixError);
843846
return NULL;
844847
}
845-
tuple = newtupleobject(4);
846-
if (tuple == NULL)
847-
return NULL;
848-
settupleitem(tuple, 0, newfloatobject((double)t.tms_utime / HZ));
849-
settupleitem(tuple, 1, newfloatobject((double)t.tms_stime / HZ));
850-
settupleitem(tuple, 2, newfloatobject((double)t.tms_cutime / HZ));
851-
settupleitem(tuple, 3, newfloatobject((double)t.tms_cstime / HZ));
852-
if (err_occurred()) {
853-
DECREF(tuple);
854-
return NULL;
855-
}
856-
return tuple;
848+
return mkvalue("dddd",
849+
(double)t.tms_utime / HZ,
850+
(double)t.tms_stime / HZ,
851+
(double)t.tms_cutime / HZ,
852+
(double)t.tms_cstime / HZ);
857853
}
858854

859855
#endif /* DO_TIMES */

Modules/rotormodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ static void encrypt_region(r, region, len)
590590
unsigned char *region;
591591
int len;
592592
{
593-
RTR_e_region(r,region,len);
593+
RTR_e_region(r,region,len,TRUE);
594594
}
595595

596596
/*(defun decrypt-region (beg end key)
@@ -602,7 +602,7 @@ static void decrypt_region(r, region, len)
602602
unsigned char *region;
603603
int len;
604604
{
605-
RTR_d_region(r,region,len);
605+
RTR_d_region(r,region,len,TRUE);
606606
}
607607

608608
/* Rotor methods */

Modules/stdwinmodule.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/***********************************************************
2-
Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
3-
Netherlands.
2+
Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
3+
Amsterdam, The Netherlands.
44
55
All Rights Reserved
66
@@ -66,7 +66,11 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
6666
#include "modsupport.h"
6767
#include "ceval.h"
6868

69+
#ifdef macintosh
70+
#include ":::src:stdwin:H:stdwin.h"
71+
#else /* !macintosh */
6972
#include "stdwin.h"
73+
#endif /* !macintosh */
7074

7175
#ifdef USE_THREAD
7276

@@ -585,8 +589,12 @@ drawing_setfont(self, args)
585589
return NULL;
586590
}
587591
}
588-
if (font != NULL)
589-
wsetfont(font);
592+
if (font != NULL) {
593+
if (!wsetfont(font)) {
594+
err_setstr(StdwinError, "font not found");
595+
return NULL;
596+
}
597+
}
590598
if (size != 0)
591599
wsetsize(size);
592600
switch (style) {

0 commit comments

Comments
 (0)