]> granicus.if.org Git - python/commitdiff
Removed THINK_C support.
authorJack Jansen <jack.jansen@cwi.nl>
Sun, 4 Jun 2000 21:56:05 +0000 (21:56 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Sun, 4 Jun 2000 21:56:05 +0000 (21:56 +0000)
Mac/Compat/getwd.c
Mac/Include/config.h
Mac/Include/macbuildno.h
Mac/Include/macdefs.h
Mac/Modules/ctl/Ctlmodule.c
Mac/Modules/ctl/ctlsupport.py
Mac/Python/macglue.c
Mac/Python/macmain.c
Mac/think/fopenRF.c [deleted file]
Mac/think/macconsole/macconsole.c [deleted file]

index a58fb6a4ac15b9df3c2315524a977322edb65ac0..27f68a24faaa98a71f1b97309802901846e96791 100644 (file)
@@ -37,15 +37,9 @@ getwd(cwd)
 {
        /* Universal parameter block. */
        union {
-#ifdef THINK_C
-               HFileInfo f;
-               DirInfo d;
-               WDPBRec w;
-#else /* MPW */
                struct HFileInfo f;
                struct DirInfo d;
                struct WDPBRec w;
-#endif
        } pb;
        char buf[MAXPATH]; /* Buffer to store the name components */
        char *ecwd, *ebuf; /* Pointers to end of used part of cwd and buf */
index 0c78ee53a50a1ff8a07fc88f1069e54e5b927b2f..5214168dd705d0035885191195b9c2132afcfd17 100644 (file)
@@ -31,16 +31,11 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 #define USE_STACKCHECK
 
-/* Define if on Macintosh (THINK_C, MPW or __MWERKS__ should also be defined) */
+/* Define if on Macintosh (MPW or __MWERKS__ should also be defined) */
 #ifndef macintosh
 #define macintosh
 #endif
 
-/* Define if you have the fopenRF function. */
-#ifdef THINK_C
-#define HAVE_FOPENRF
-#endif
-
 /* Define to case-check imported modules (why is this here?) */
 #define CHECK_IMPORT_CASE
 
index e97aa4b7babed0d66f6e17f77b2806cc3f554f23..f84c3c635c125281585e67e6264e3a27f5dd90f5 100644 (file)
@@ -1 +1 @@
-#define BUILD 43
+#define BUILD 54
index 0a4a6f750a4c8ec1d36487e4676ec4ff430f40af..9cc3ae19403a9ca6bbc361e946178db54583fe57 100644 (file)
@@ -7,10 +7,6 @@
 #include <Files.h>
 #include <OSUtils.h>
 
-#ifdef THINK_C
-#include <pascal.h>
-#endif
-
 #include <errno.h>
 #include <string.h>
 #ifdef __MWERKS__
index 37f8c5a08c8d63b285f2327100215ab356646720..20e09cc2445e0b01b68624d5c95b1cb255effbe9 100644 (file)
@@ -57,10 +57,6 @@ extern PyObject *CtlObj_WhichControl(ControlHandle); /* Forward */
 extern PyObject *QdRGB_New(RGBColorPtr);
 extern QdRGB_Convert(PyObject *, RGBColorPtr);
 
-#ifdef THINK_C
-#define  ControlActionUPP ProcPtr
-#endif
-
 /*
 ** Parse/generate ControlFontStyleRec records
 */
index a8c2d64ad85e3e57f817f7fec371300dabb4b1de..912514aa4cc88f54e217129fd62310f16157e275 100644 (file)
@@ -57,10 +57,6 @@ extern PyObject *CtlObj_WhichControl(ControlHandle); /* Forward */
 extern PyObject *QdRGB_New(RGBColorPtr);
 extern QdRGB_Convert(PyObject *, RGBColorPtr);
 
-#ifdef THINK_C
-#define  ControlActionUPP ProcPtr
-#endif
-
 /*
 ** Parse/generate ControlFontStyleRec records
 */
index e79a64aa29eecf3bb9afeac48e5b6e1f25bf363f..1f5ce0e84fd54a895ab131d6fc8bcc35b18250e9 100644 (file)
@@ -61,9 +61,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <Fonts.h>
 #include <Menus.h>
 #include <TextUtils.h>
-#ifdef THINK_C
-#include <OSEvents.h> /* For EvQElPtr */
-#endif
 #ifdef __MWERKS__
 #include <SIOUX.h>
 #endif
index 90d009379f187cb7c740b8bbf5e08fb22b7023e6..e773fd70087f2b4b897176fec510ca9ba3b82247 100644 (file)
@@ -50,10 +50,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #endif
 #include <unistd.h>
 
-#ifdef THINK_C
-#include <console.h>
-#endif
-
 #define STARTUP "PythonStartup"
 
 extern int Py_DebugFlag; /* For parser.c, declared in pythonrun.c */
@@ -89,9 +85,6 @@ no_appearance:
 static void
 init_mac_world()
 {
-#ifdef THINK_C
-       printf("\n");
-#else
 #ifndef TARGET_API_MAC_CARBON
        /* These aren't needed for carbon */
        MaxApplZone();
@@ -104,7 +97,6 @@ init_mac_world()
 #endif
        InitCursor();
        init_appearance();
-#endif
 }
 
 /*
@@ -541,9 +533,6 @@ PyMac_Exit(status)
        else
                SIOUXSettings.autocloseonquit = 1;
 #endif /* USE_SIOUX */
-#ifdef THINK_C
-       console_options.pause_atexit = keep;
-#endif
 
        exit(status);
 }
diff --git a/Mac/think/fopenRF.c b/Mac/think/fopenRF.c
deleted file mode 100644 (file)
index 04f192e..0000000
+++ /dev/null
@@ -1,336 +0,0 @@
-
-/*
- *  fopen.c
- *
- *  Copyright (c) 1991 Symantec Corporation.  All rights reserved.
- *
- */
-
-#include <MacHeaders>
-
-#include "stdio.h"
-#include "errno.h"
-#include "string.h"
-#include "ansi_private.h"
-
-extern long _ftype, _fcreator;
-
-#define fcbVPtr(fcb)           (* (VCB **) (fcb + 20))
-#define fcbDirID(fcb)          (* (long *) (fcb + 58))
-#define fcbCName(fcb)          (fcb + 62)
-
-static void setfiletype(StringPtr, int);
-static void stdio_exit(void);
-static int fileio(FILE *, int);
-static int close(FILE *);
-static void replace(unsigned char *, size_t, int, int);
-
-FILE *freopenRF();
-FILE *__openRF();
-
-FILE *
-fopenRF(const char *filename, const char *mode)
-{
-       return(freopenRF(filename, mode, __getfile()));
-}
-
-
-FILE *
-freopenRF(const char *filename, const char *mode, FILE *fp)
-{
-       int omode, oflag;
-       
-               /*  interpret "rwa"  */
-       
-       if (mode[0] == 'r') {
-               omode = fsRdPerm;
-               oflag = 0;
-       }
-       else if (mode[0] == 'w') {
-               omode = fsWrPerm;
-               oflag = F_CREAT+F_TRUNC;
-       }
-       else if (mode[0] == 'a') {
-               omode = fsWrPerm;
-               oflag = F_CREAT+F_APPEND;
-       }
-       else {
-               errno = EINVAL;
-               return(NULL);
-       }
-               
-               /*  interpret "b+"  */
-               
-       if (mode[1] == 'b') {
-               oflag |= F_BINARY;
-               if (mode[2] == '+')
-                       omode = fsRdWrPerm;
-       }
-       else if (mode[1] == '+') {
-               omode = fsRdWrPerm;
-               if (mode[2] == 'b')
-                       oflag |= F_BINARY;
-       }
-       
-               /*  open the file  */
-               
-       return(__openRF(filename, omode, oflag, fp));
-}
-
-
-FILE *
-__openRF(const char *filename, int omode, int oflag, FILE *fp)
-{
-       IOParam pb;
-       char pname[FILENAME_MAX];
-
-       if (fp == NULL)
-               return(NULL);
-       fclose(fp);
-       
-               /*  set up pb  */
-       
-       pb.ioNamePtr = __c2p(filename, pname);
-       pb.ioVRefNum = 0;
-       pb.ioVersNum = 0;
-       pb.ioPermssn = omode;
-       pb.ioMisc = 0;
-
-               /*  create file  */
-
-       if (oflag & F_CREAT) {
-               PBCreateSync((ParmBlkPtr)&pb);
-               if (pb.ioResult == noErr)
-                       oflag &= ~F_TRUNC;
-               else if (pb.ioResult == dupFNErr && !(oflag & F_EXCL))
-                       oflag &= ~F_CREAT;
-               else {
-                       errno = pb.ioResult;
-                       return(NULL);
-               }
-       }
-       
-               /*  open file  */
-               
-       PBOpenRFSync((ParmBlkPtr)&pb);
-       if (pb.ioResult) {
-               errno = pb.ioResult;
-               if (oflag & F_CREAT)
-                       PBDeleteSync((ParmBlkPtr)&pb);
-               return(NULL);
-       }
-       fp->refnum = pb.ioRefNum;
-       
-               /*  get/set file length  */
-               
-       if (oflag & F_TRUNC)
-               PBSetEOFSync((ParmBlkPtr)&pb);
-       else if (!(oflag & F_CREAT))
-               PBGetEOFSync((ParmBlkPtr)&pb);
-       fp->len = (fpos_t) pb.ioMisc;
-               
-               /*  initialize rest of FILE structure  */
-               
-       if (oflag & F_APPEND) {
-               fp->append = 1;
-               fp->pos = fp->len;
-       }
-       if (oflag & F_BINARY)
-               fp->binary = 1;
-       setvbuf(fp, NULL, _IOFBF, BUFSIZ);
-       fp->proc = fileio;
-
-               /*  set file type  */
-
-       if (oflag & (F_CREAT|F_TRUNC))
-               setfiletype(pb.ioNamePtr, oflag);
-               
-               /*  done  */
-               
-       __atexit_stdio(stdio_exit);
-       return(fp);
-}
-
-
-/*
- *  setfiletype - set type/creator of new file
- *
- */
-
-static void
-setfiletype(StringPtr name, int oflag)
-{
-       FileParam pb;
-       
-       pb.ioNamePtr = name;
-       pb.ioVRefNum = 0;
-       pb.ioFVersNum = 0;
-       pb.ioFDirIndex = 0;
-       if (PBGetFInfoSync((ParmBlkPtr)&pb) == noErr) {
-               if (oflag & F_BINARY)
-                       pb.ioFlFndrInfo.fdType = _ftype;
-               else
-                       pb.ioFlFndrInfo.fdType = 'TEXT';
-               pb.ioFlFndrInfo.fdCreator = _fcreator;
-               PBSetFInfoSync((ParmBlkPtr)&pb);
-       }
-}
-
-
-/*
- *  stdio_exit - stdio shutdown routine
- *
- */
-
-static void
-stdio_exit(void)
-{
-       register FILE *fp;
-       int n;
-       
-       for (fp = &__file[0], n = FOPEN_MAX; n--; fp++)
-               fclose(fp);
-}
-
-
-/*
- *  fileio - I/O handler proc for files and devices
- *
- */
-
-static int
-fileio(FILE *fp, int i)
-{
-       IOParam pb;
-       
-       pb.ioRefNum = fp->refnum;
-       switch (i) {
-       
-                               /*  read  */
-                       
-               case 0:
-                       pb.ioBuffer = (Ptr) fp->ptr;
-                       pb.ioReqCount = fp->cnt;
-                       pb.ioPosMode = fp->refnum > 0 ? fsFromStart : fsAtMark;
-                       pb.ioPosOffset = fp->pos - fp->cnt;
-                       PBReadSync((ParmBlkPtr)&pb);
-                       if (pb.ioResult == eofErr) {
-                               fp->pos = pb.ioPosOffset;
-                               if (fp->cnt = pb.ioActCount)
-                                       pb.ioResult = 0;
-                               else {
-                                       fp->eof = 1;
-                                       return(EOF);
-                               }
-                       }
-                       if (!pb.ioResult && !fp->binary)
-                               replace(fp->ptr, fp->cnt, '\r', '\n');
-                       break;
-                       
-                               /*  write  */
-
-               case 1:
-                       pb.ioBuffer = (Ptr) fp->ptr;
-                       pb.ioReqCount = fp->cnt;
-                       pb.ioPosMode = fp->refnum > 0 ? fsFromStart : fsAtMark;
-                       if ((pb.ioPosOffset = fp->pos - fp->cnt) > fp->len) {
-                               pb.ioMisc = (Ptr) pb.ioPosOffset;
-                               if (PBSetEOFSync((ParmBlkPtr)&pb) != noErr)
-                                       break;
-                       }
-                       if (!fp->binary)
-                               replace(fp->ptr, fp->cnt, '\n', '\r');
-                       PBWriteSync((ParmBlkPtr)&pb);
-                       if (!pb.ioResult && pb.ioPosOffset > fp->len)
-                               fp->len = pb.ioPosOffset;
-                       break;
-                       
-                               /*  close  */
-
-               case 2:
-                       pb.ioResult = close(fp);
-                       break;
-       }
-       
-               /*  done  */
-               
-       if (pb.ioResult) {
-               if (i < 2) {
-                       fp->pos -= fp->cnt;
-                       fp->cnt = 0;
-               }
-               fp->err = 1;
-               errno = pb.ioResult;
-               return(EOF);
-       }
-       return(0);
-}
-
-
-static int
-close(FILE *fp)
-{
-       HFileParam pb;
-       Str255 buf;
-       register char *fcb = FCBSPtr + fp->refnum;
-       VCB *vcb = fcbVPtr(fcb);
-       register char *s;
-       enum { none, MFS, HFS } del = none;
-       
-       pb.ioVRefNum = vcb->vcbVRefNum;
-       if (fp->remove) {
-               pb.ioNamePtr = buf;
-               pb.ioFVersNum = 0;
-       
-                       /*  close temporary file - HFS  */
-                       
-               if (vcb->vcbSigWord == 0x4244) {
-                       pb.ioDirID = fcbDirID(fcb);
-                       s = fcbCName(fcb);
-                       memcpy(buf, s, Length(s) + 1);
-                       del = HFS;
-               }
-               
-                       /*  close temporary file - MFS  */
-                       
-               else if (vcb->vcbSigWord == 0xD2D7) {
-                       for (pb.ioFDirIndex = 1; PBGetFInfoSync((ParmBlkPtr)&pb) == noErr; pb.ioFDirIndex++) {
-                               if (pb.ioFRefNum == fp->refnum) {
-                                       del = MFS;
-                                       break;
-                               }
-                       }
-               }
-       }
-       
-               /*  close file and flush volume buffer  */
-       
-       pb.ioFRefNum = fp->refnum;
-       if (PBCloseSync((ParmBlkPtr)&pb) == noErr) {
-               if (del == MFS)
-                       PBDeleteSync((ParmBlkPtr)&pb);
-               else if (del == HFS)
-                       PBHDeleteSync((HParmBlkPtr)&pb);
-               pb.ioNamePtr = 0;
-               PBFlushVolSync((ParmBlkPtr)&pb);
-       }
-       return(pb.ioResult);
-}
-
-
-/*
- *  replace - routine for doing CR/LF conversion
- *
- */
-
-static void
-replace(register unsigned char *s, register size_t n, register int c1, register int c2)
-{
-#pragma options(honor_register)
-       register unsigned char *t;
-       
-       for (; n && (t = memchr(s, c1, n)); s = t) {
-               *t++ = c2;
-               n -= t - s;
-       }
-}
diff --git a/Mac/think/macconsole/macconsole.c b/Mac/think/macconsole/macconsole.c
deleted file mode 100644 (file)
index 44530b5..0000000
+++ /dev/null
@@ -1,437 +0,0 @@
-/***********************************************************
-Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
-Amsterdam, The Netherlands.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the names of Stichting Mathematisch
-Centrum or CWI not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior permission.
-
-STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
-THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
-FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
-OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-******************************************************************/
-
-/* 
-** Written by Jack Jansen, October 1994, initially only to allow him to
-** test the ctb module:-)
-*/
-
-#include "allobjects.h"
-#include "modsupport.h"                /* For getargs() etc. */
-#include "structmember.h"
-
-#include <console.h>
-
-static object *ErrorObject;
-
-#define OFF(x) offsetof(struct __copt, x)
-
-static struct memberlist copt_memberlist[] = {
-       {"top", T_SHORT, OFF(top)},
-       {"left", T_SHORT, OFF(left)},
-       {"title", T_PSTRING, OFF(title)},
-       {"procID", T_SHORT, OFF(procID), RO},
-       {"txFont", T_SHORT, OFF(txFont)},
-       {"txSize", T_SHORT, OFF(txSize)},
-       {"txFace", T_SHORT, OFF(txFace)},
-       {"nrows", T_SHORT, OFF(nrows)},
-       {"ncols", T_SHORT, OFF(ncols)},
-       {"pause_atexit", T_SHORT, OFF(pause_atexit)},
-       {NULL}
-};
-
-static unsigned char mytitle[256];
-typedef struct {
-       OB_HEAD
-} coptobject;
-
-staticforward typeobject Xxotype;
-
-#define is_coptobject(v)               ((v)->ob_type == &Xxotype)
-
-static coptobject *
-newcoptobject()
-{
-       coptobject *self;
-       self = NEWOBJ(coptobject, &Xxotype);
-       return self;
-}
-
-/* Xxo methods */
-
-static void
-copt_dealloc(self)
-       coptobject *self;
-{
-       DEL(self);
-}
-
-static object *
-copt_getattr(self, name)
-       coptobject *self;
-       char *name;
-{
-       return getmember((char *)&console_options, copt_memberlist, name);
-}
-
-static int
-copt_setattr(self, name, v)
-       coptobject *self;
-       char *name;
-       object *v;
-{
-       char *str;
-       int len;
-       
-       if ( strcmp(name, "title") == 0 ) {
-               if ( !v || !is_stringobject(v)) {
-                       err_setstr(ErrorObject, "title must be a string");
-                       return -1;
-               }
-               str = getstringvalue(v);
-               len = strlen(str);
-               mytitle[0] = (unsigned char)len;
-               strncpy((char *)mytitle+1, str, mytitle[0]);
-               console_options.title = mytitle;
-               return 0;
-       }
-       return setmember((char *)&console_options, copt_memberlist, name, v);
-}
-
-static typeobject Xxotype = {
-       OB_HEAD_INIT(&Typetype)
-       0,                      /*ob_size*/
-       "console options",                      /*tp_name*/
-       sizeof(coptobject),     /*tp_basicsize*/
-       0,                      /*tp_itemsize*/
-       /* methods */
-       (destructor)copt_dealloc, /*tp_dealloc*/
-       0,                      /*tp_print*/
-       (getattrfunc)copt_getattr, /*tp_getattr*/
-       (setattrfunc)copt_setattr, /*tp_setattr*/
-       0,                      /*tp_compare*/
-       0,                      /*tp_repr*/
-       0,                      /*tp_as_number*/
-       0,                      /*tp_as_sequence*/
-       0,                      /*tp_as_mapping*/
-       0,                      /*tp_hash*/
-};
-
-/* ------------------------------------------- */
-
-typedef struct {
-       OB_HEAD
-       FILE *fp;
-       object *file;
-} cons_object;
-
-staticforward typeobject constype;
-
-#define is_cons_object(v)              ((v)->ob_type == &constype)
-
-static cons_object *
-newcons_object(fp, file)
-       FILE *fp;
-       object *file;
-{
-       cons_object *self;
-       self = NEWOBJ(cons_object, &constype);
-       if (self == NULL)
-               return NULL;
-       self->fp = fp;
-       self->file = file;
-       return self;
-}
-
-/* cons methods */
-
-static void
-cons_dealloc(self)
-       cons_object *self;
-{
-       DECREF(self->file);
-       DEL(self);
-}
-
-static object *
-cons_setmode(self, args)
-       cons_object *self;
-       object *args;
-{
-       int mode;
-       
-       if (!getargs(args, "i", &mode))
-               return NULL;
-       csetmode(mode, self->fp);
-       INCREF(None);
-       return None;
-}
-
-static object *
-cons_cleos(self, args)
-       cons_object *self;
-       object *args;
-{
-       if (!getnoarg(args))
-               return NULL;
-       ccleos(self->fp);
-       INCREF(None);
-       return None;
-}
-
-static object *
-cons_cleol(self, args)
-       cons_object *self;
-       object *args;
-{
-       if (!getnoarg(args))
-               return NULL;
-       ccleol(self->fp);
-       INCREF(None);
-       return None;
-}
-
-static object *
-cons_show(self, args)
-       cons_object *self;
-       object *args;
-{
-       if (!getnoarg(args))
-               return NULL;
-       cshow(self->fp);
-       INCREF(None);
-       return None;
-}
-
-static object *
-cons_hide(self, args)
-       cons_object *self;
-       object *args;
-{
-       if (!getnoarg(args))
-               return NULL;
-       chide(self->fp);
-       INCREF(None);
-       return None;
-}
-
-static object *
-cons_echo2printer(self, args)
-       cons_object *self;
-       object *args;
-{
-       if (!getnoarg(args))
-               return NULL;
-       cecho2printer(self->fp);
-       INCREF(None);
-       return None;
-}
-
-static object *
-cons_gotoxy(self, args)
-       cons_object *self;
-       object *args;
-{
-       int x, y;
-       
-       if (!getargs(args, "(ii)", &x, &y))
-               return NULL;
-       cgotoxy(x, y, self->fp);
-       INCREF(None);
-       return None;
-}
-
-static object *
-cons_getxy(self, args)
-       cons_object *self;
-       object *args;
-{
-       int x, y;
-       
-       if (!getnoarg(args))
-               return NULL;
-       cgetxy(&x, &y, self->fp);
-       return mkvalue("(ii)", x, y);
-}
-
-static object *
-cons_settabs(self, args)
-       cons_object *self;
-       object *args;
-{
-       int arg;
-       
-       if (!getargs(args, "i", &arg))
-               return NULL;
-       csettabs(arg, self->fp);
-       INCREF(None);
-       return None;
-}
-
-static object *
-cons_inverse(self, args)
-       cons_object *self;
-       object *args;
-{
-       int arg;
-       
-       if (!getargs(args, "i", &arg))
-               return NULL;
-       cinverse(arg, self->fp);
-       INCREF(None);
-       return None;
-}
-
-static struct methodlist cons_methods[] = {
-       {"setmode",     (method)cons_setmode},
-       {"gotoxy",      (method)cons_gotoxy},
-       {"getxy",       (method)cons_getxy},
-       {"cleos",       (method)cons_cleos},
-       {"cleol",       (method)cons_cleol},
-       {"settabs",     (method)cons_settabs},
-       {"inverse",     (method)cons_inverse},
-       {"show",        (method)cons_show},
-       {"hide",        (method)cons_hide},
-       {"echo2printer",        (method)cons_echo2printer},
-       {NULL,          NULL}           /* sentinel */
-};
-
-static object *
-cons_getattr(self, name)
-       cons_object *self;
-       char *name;
-{
-       if ( strcmp(name, "file") == 0 ) {
-               INCREF(self->file);
-               return self->file;
-       }
-       return findmethod(cons_methods, (object *)self, name);
-}
-
-static typeobject constype = {
-       OB_HEAD_INIT(&Typetype)
-       0,                      /*ob_size*/
-       "cons",                 /*tp_name*/
-       sizeof(cons_object),    /*tp_basicsize*/
-       0,                      /*tp_itemsize*/
-       /* methods */
-       (destructor)cons_dealloc, /*tp_dealloc*/
-       0,                      /*tp_print*/
-       (getattrfunc)cons_getattr,                      /*tp_getattr*/
-       0,                      /*tp_setattr*/
-       0,                      /*tp_compare*/
-       0,                      /*tp_repr*/
-       0,                      /*tp_as_number*/
-       0,                      /*tp_as_sequence*/
-       0,                      /*tp_as_mapping*/
-       0,                      /*tp_hash*/
-};
-/* --------------------------------------------------------------------- */
-
-/* Return a new console */
-
-static object *
-maccons_copen(self, args)
-       object *self; /* Not used */
-       object *args;
-{
-       FILE *fp;
-       object *file;
-       cons_object *rv;
-       char *name;
-       unsigned char nbuf[256];
-       int len;
-       
-       name = NULL;
-       if (!getnoarg(args))
-               return NULL;
-       if ( (fp=fopenc()) == NULL ) {
-               err_errno(ErrorObject);
-               return NULL;
-       }
-       if ( (file=newopenfileobject(fp, "<a console>", "r+", fclose)) == NULL)
-               return NULL;
-       rv = newcons_object(fp, file);
-       if ( rv == NULL ) {
-               fclose(fp);
-           return NULL;
-       }
-       return (object *)rv;
-}
-
-/* Return an open file as a console */
-
-static object *
-maccons_fopen(self, args)
-       object *self; /* Not used */
-       object *args;
-{
-       cons_object *rv;
-       object *file;
-       FILE *fp;
-       
-       if (!newgetargs(args, "O", &file))
-               return NULL;
-       if ( !is_fileobject(file) ) {
-               err_badarg();
-               return NULL;
-       }
-       fp = getfilefile(file);
-       if ( !isatty(fileno(fp)) ) {
-               err_setstr(ErrorObject, "File is not a console");
-               return NULL;
-       }
-       rv = newcons_object(fp, file);
-       if ( rv == NULL ) {
-           return NULL;
-       }
-       INCREF(file);
-       return (object *)rv;
-}
-
-/* List of functions defined in the module */
-
-static struct methodlist maccons_methods[] = {
-       {"fopen",               (method)maccons_fopen, 1},
-       {"copen",               (method)maccons_copen, 0},
-       {NULL,          NULL}           /* sentinel */
-};
-
-
-/* Initialization function for the module (*must* be called initmacconsole) */
-
-void
-initmacconsole()
-{
-       object *m, *d, *o;
-
-       /* Create the module and add the functions */
-       m = initmodule("macconsole", maccons_methods);
-
-       /* Add some symbolic constants to the module */
-#define INTATTR(name, value) o = newintobject(value); dictinsert(d, name, o);
-       d = getmoduledict(m);
-       ErrorObject = newstringobject("macconsole.error");
-       dictinsert(d, "error", ErrorObject);
-       o = (object *)newcoptobject();
-       dictinsert(d, "options", o);
-       INTATTR("C_RAW", C_RAW);
-       INTATTR("C_CBREAK", C_CBREAK);
-       INTATTR("C_ECHO", C_ECHO);
-       INTATTR("C_NOECHO", C_NOECHO);
-
-       /* Check for errors */
-       if (err_occurred())
-               fatal("can't initialize module macconsole");
-}