diff options
author | Guido van Rossum <guido@python.org> | 1993-01-21 16:07:51 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1993-01-21 16:07:51 (GMT) |
commit | 0b0db8e3a07c92786fde60bf53bd1d5aa32e0aae (patch) | |
tree | 8750daf2aeb5be8cdb034755f883c1c3557ea809 /Modules | |
parent | 80530ce8754956c8d5349d4644dc83113a63cfc1 (diff) | |
download | cpython-0b0db8e3a07c92786fde60bf53bd1d5aa32e0aae.zip cpython-0b0db8e3a07c92786fde60bf53bd1d5aa32e0aae.tar.gz cpython-0b0db8e3a07c92786fde60bf53bd1d5aa32e0aae.tar.bz2 |
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
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/config.c.in | 76 | ||||
-rw-r--r-- | Modules/posixmodule.c | 26 | ||||
-rw-r--r-- | Modules/rotormodule.c | 4 | ||||
-rw-r--r-- | Modules/stdwinmodule.c | 16 | ||||
-rw-r--r-- | Modules/timemodule.c | 41 |
5 files changed, 103 insertions, 60 deletions
diff --git a/Modules/config.c.in b/Modules/config.c.in index 1d84020..11e2cdd 100644 --- a/Modules/config.c.in +++ b/Modules/config.c.in @@ -25,15 +25,30 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* Configurable Python configuration file */ /* These modules are normally always included, but *may* be taken out */ -#define USE_GRP 1 /* Use together with pwd */ #define USE_MARSHAL 1 /* This is linked anyway */ #define USE_MATH 1 -#define USE_PWD 1 /* Use together with grp */ +#define USE_STRUCT 1 +#define USE_STROP 1 +#define USE_TIME 1 + +#ifdef macintosh +#define USE_AUDIOOP 1 +#define USE_IMAGEOP 1 +#define USE_MAC 1 +#define USE_REGEX 1 +#define USE_ROTOR 1 +#define USE_STDWIN 1 /* You may turn this off */ +#endif + +#ifdef unix +#define USE_GRP 1 /* Use together with pwd */ #define USE_POSIX 1 +#define USE_PWD 1 /* Use together with grp */ #define USE_SELECT 1 #define USE_SOCKET 1 -#define USE_STRUCT 1 -#define USE_TIME 1 +#endif + +#include <stdio.h> #include "PROTO.h" #include "mymalloc.h" @@ -45,18 +60,20 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifdef __DATE__ #define DATE __DATE__ #else -#define DATE ">= 8 Jan 1993" +#define DATE ">= 11 Jan 1993" #endif -#include <stdio.h> - #ifdef USE_STDWIN -#include <stdwin.h> -#endif +#ifdef macintosh +#include ":::src:stdwin:H:stdwin.h" +#else /* !macintosh */ +#include "stdwin.h" +#endif /* !macintosh */ +#endif /* USE_STDWIN */ char version[80]; -char *argv0; +char *argv0; /* For dynamic loading in import.c */ /*ARGSUSED*/ void @@ -69,13 +86,16 @@ initargs(p_argc, p_argv) argv0 = **p_argv; #ifdef USE_STDWIN - wargs(p_argc, p_argv); +#ifdef THINK_C_3_0 + wsetstdio(1); #endif + wargs(p_argc, p_argv); +#endif /* USE_STDWIN */ if (*p_argc < 2 && isatty(0) && isatty(1)) { printf("Python %s.\n", version); printf( -"Copyright 1990, 1991, 1992 Stichting Mathematisch Centrum, Amsterdam\n"); +"Copyright 1990, 1991, 1992, 1993 Stichting Mathematisch Centrum, Amsterdam\n"); } } @@ -96,14 +116,22 @@ donecalls() } #ifndef PYTHONPATH +#ifdef macintosh +/* On the Mac, the search path is a space-separated list of directories */ +#define PYTHONPATH ": :lib :demo" +#else /* !macintosh */ #define PYTHONPATH ".:/usr/local/lib/python" -#endif +#endif /* !macintosh */ +#endif /* !PYTHONPATH */ extern char *getenv(); char * getpythonpath() { +#ifdef macintosh + return PYTHONPATH; +#else /* !macintosh */ char *path = getenv("PYTHONPATH"); char *defpath = PYTHONPATH; char *buf; @@ -119,6 +147,7 @@ getpythonpath() strcat(buf, ":"); strcat(buf, defpath); return buf; +#endif /* !macintosh */ } @@ -142,6 +171,9 @@ extern void initaudioop(); #ifdef USE_CD extern void initcd(); #endif +#ifdef USE_CL +extern void initcl(); +#endif #ifdef USE_DBM extern void initdbm(); #endif @@ -166,6 +198,9 @@ extern void initimgfile(); #ifdef USE_JPEG extern void initjpeg(); #endif +#ifdef USE_MAC +extern void initmac(); +#endif #ifdef USE_MARSHAL extern void initmarshal(); #endif @@ -217,9 +252,6 @@ extern void initthread(); #ifdef USE_SV extern void initsv(); #endif -#ifdef USE_CL -extern void initcl(); -#endif #ifdef USE_TIME extern void inittime(); #endif @@ -259,6 +291,10 @@ struct { {"cd", initcd}, #endif +#ifdef USE_CL + {"cl", initcl}, +#endif + #ifdef USE_DBM {"dbm", initdbm}, #endif @@ -291,6 +327,10 @@ struct { {"jpeg", initjpeg}, #endif +#ifdef USE_MAC + {"mac", initmac}, +#endif + #ifdef USE_MARSHAL {"marshal", initmarshal}, #endif @@ -355,10 +395,6 @@ struct { {"sv", initsv}, #endif -#ifdef USE_CL - {"cl", initcl}, -#endif - #ifdef USE_THREAD {"thread", initthread}, #endif diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index bab0c59..a600115 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -75,6 +75,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "modsupport.h" #include "ceval.h" +#ifdef _SEQUENT_ +#include <unistd.h> +#else /* _SEQUENT_ */ /* XXX Aren't these always declared in unistd.h? */ extern char *strerror PROTO((int)); extern int chmod PROTO((const char *, mode_t)); @@ -87,6 +90,7 @@ extern int rmdir PROTO((const char *)); extern int stat PROTO((const char *, struct stat *)); extern int unlink PROTO((const char *)); extern int pclose PROTO((FILE *)); +#endif /* _SEQUENT_ */ #ifdef NO_LSTAT #define lstat stat #else @@ -375,7 +379,7 @@ posix_nice(self, args) } #endif -#ifdef i386 +#if i386 && ! _SEQUENT_ int rename(from, to) char *from; @@ -388,7 +392,7 @@ rename(from, to) return status; return unlink(from); } -#endif /* i386 */ +#endif /* i386 && ! _SEQUENT_ */ static object * posix_rename(self, args) @@ -833,7 +837,6 @@ posix_times(self, args) { struct tms t; clock_t c; - object *tuple; if (!getnoarg(args)) return NULL; errno = 0; @@ -842,18 +845,11 @@ posix_times(self, args) err_errno(PosixError); return NULL; } - tuple = newtupleobject(4); - if (tuple == NULL) - return NULL; - settupleitem(tuple, 0, newfloatobject((double)t.tms_utime / HZ)); - settupleitem(tuple, 1, newfloatobject((double)t.tms_stime / HZ)); - settupleitem(tuple, 2, newfloatobject((double)t.tms_cutime / HZ)); - settupleitem(tuple, 3, newfloatobject((double)t.tms_cstime / HZ)); - if (err_occurred()) { - DECREF(tuple); - return NULL; - } - return tuple; + return mkvalue("dddd", + (double)t.tms_utime / HZ, + (double)t.tms_stime / HZ, + (double)t.tms_cutime / HZ, + (double)t.tms_cstime / HZ); } #endif /* DO_TIMES */ diff --git a/Modules/rotormodule.c b/Modules/rotormodule.c index e8fec07..f16acd0 100644 --- a/Modules/rotormodule.c +++ b/Modules/rotormodule.c @@ -590,7 +590,7 @@ static void encrypt_region(r, region, len) unsigned char *region; int len; { - RTR_e_region(r,region,len); + RTR_e_region(r,region,len,TRUE); } /*(defun decrypt-region (beg end key) @@ -602,7 +602,7 @@ static void decrypt_region(r, region, len) unsigned char *region; int len; { - RTR_d_region(r,region,len); + RTR_d_region(r,region,len,TRUE); } /* Rotor methods */ diff --git a/Modules/stdwinmodule.c b/Modules/stdwinmodule.c index a33366d..62e9b47 100644 --- a/Modules/stdwinmodule.c +++ b/Modules/stdwinmodule.c @@ -1,6 +1,6 @@ /*********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved @@ -66,7 +66,11 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "modsupport.h" #include "ceval.h" +#ifdef macintosh +#include ":::src:stdwin:H:stdwin.h" +#else /* !macintosh */ #include "stdwin.h" +#endif /* !macintosh */ #ifdef USE_THREAD @@ -585,8 +589,12 @@ drawing_setfont(self, args) return NULL; } } - if (font != NULL) - wsetfont(font); + if (font != NULL) { + if (!wsetfont(font)) { + err_setstr(StdwinError, "font not found"); + return NULL; + } + } if (size != 0) wsetsize(size); switch (style) { diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 89d889c..b8b22e3 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -35,6 +35,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifdef BSD_TIME #define HAVE_GETTIMEOFDAY +#include "myselect.h" /* Implies <sys/types.h>, <sys/time.h>, <sys/param.h> */ #endif #ifdef macintosh @@ -70,6 +71,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <time.h> #endif /* !unix */ +/* XXX This is bogus -- times() is defined in posixmodule.c */ #ifdef DO_TIMES #include <sys/times.h> #include <sys/param.h> @@ -215,7 +217,6 @@ time_times(self, args) { struct tms t; clock_t c; - object *tuple; if (!getnoarg(args)) return NULL; errno = 0; @@ -224,18 +225,11 @@ time_times(self, args) err_errno(IOError); return NULL; } - tuple = newtupleobject(4); - if (tuple == NULL) - return NULL; - settupleitem(tuple, 0, newfloatobject((double)t.tms_utime / HZ)); - settupleitem(tuple, 1, newfloatobject((double)t.tms_stime / HZ)); - settupleitem(tuple, 2, newfloatobject((double)t.tms_cutime / HZ)); - settupleitem(tuple, 3, newfloatobject((double)t.tms_cstime / HZ)); - if (err_occurred()) { - DECREF(tuple); - return NULL; - } - return tuple; + return mkvalue("dddd", + (double)t.tms_utime / HZ, + (double)t.tms_stime / HZ, + (double)t.tms_cutime / HZ, + (double)t.tms_cstime / HZ); } #endif @@ -285,7 +279,7 @@ floatsleep(secs) { register long deadline; - deadline = MacTicks + long(secs * 60.0); + deadline = MacTicks + (long)(secs * 60.0); while (MacTicks < deadline) { if (intrcheck()) sleep_catcher(SIGINT); @@ -301,9 +295,9 @@ millitimer() #endif /* macintosh */ -#ifdef BSD_TIME +#ifdef unix -#include "myselect.h" /* Implies <sys/types.h>, <sys/time.h>, <sys/param.h> */ +#ifdef BSD_TIME long millitimer() @@ -329,7 +323,17 @@ floatsleep(secs) (void) select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &t); } -#endif /* BSD_TIME */ +#else /* !BSD_TIME */ + +floatsleep(secs) + double secs; +{ + sleep((int)secs); +} + +#endif /* !BSD_TIME */ + +#endif /* unix */ #ifdef TURBO_C /* Maybe also for MS-DOS? */ @@ -338,14 +342,13 @@ floatsleep(secs) #define CLOCKS_PER_SEC 55 /* 54.945 msec per tick (18.2 HZ clock) */ #endif -static floatsleep(secs) double secs; { delay(long(secs/1000.0)); } -static long +long millitimer() { clock_t ticks; |