annotate Mac/Python/pyGUSISIOUX.cp @ 25838:8540887bcec6 2.2

Backport of 2.183: Fix memory leak in add_subclass() found by NealN with valgrind.
author Guido van Rossum <guido@python.org>
date Fri, 18 Oct 2002 13:42:21 +0000
parents 7fbefe3e3dee
children 74d1ad61f843
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16557
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1 /*
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
2 ** Modified version of GUSISIOUX.cp especially for Python.
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
3 ** Changes (by Jack):
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
4 ** - Optionally delay the console window until something is written to it.
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
5 ** - Tell the upper layers whether the last command was a read or a write.
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
6 ** - Tell SIOUX not to use WaitNextEvent (both Python and SIOUX trying to be
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
7 ** nice to background apps means we're yielding almost 100% of the time).
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
8 ** - Make sure signals are processed when returning from read/write.
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
9 */
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
10 #define GUSI_SOURCE
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
11 #include "GUSIInternal.h"
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
12 #include "GUSISIOUX.h"
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
13 #include "GUSIDevice.h"
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
14 #include "GUSIDescriptor.h"
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
15 #include "GUSIBasics.h"
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
16 #include "GUSIDiag.h"
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
17 //#ifndef WITHOUT_JACK_MODS
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
18 //#include "GUSIConfig.h"
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
19 //#endif
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
20
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
21 #include <LowMem.h>
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
22
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
23 #include <fcntl.h>
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
24 #include <sys/stat.h>
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
25 #include <sys/ioctl.h>
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
26 #include <errno.h>
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
27 #include <console.h>
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
28
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
29 #include "Python.h"
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
30 #include "macglue.h"
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
31 extern Boolean SIOUXUseWaitNextEvent;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
32
20317
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
33 static PyReadHandler sInConsole = 0L;
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
34 static PyWriteHandler sOutConsole = 0L;
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
35 static PyWriteHandler sErrConsole = 0L;
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
36
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
37 inline bool hasCustomConsole(void) { return sInConsole != 0L; }
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
38
16557
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
39 class GUSISIOUXSocket : public GUSISocket {
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
40 public:
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
41 ~GUSISIOUXSocket();
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
42
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
43
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
44 ssize_t read(const GUSIScatterer & buffer);
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
45 ssize_t write(const GUSIGatherer & buffer);
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
46 virtual int ioctl(unsigned int request, va_list arg);
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
47 virtual int fstat(struct stat * buf);
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
48 virtual int isatty();
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
49 bool select(bool * canRead, bool * canWrite, bool *);
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
50
20317
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
51 static GUSISIOUXSocket * Instance(int fd);
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
52 private:
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
53 GUSISIOUXSocket(int fd);
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
54 static bool initialized;
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
55 static void Initialize();
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
56 int fFd;
16557
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
57 };
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
58 class GUSISIOUXDevice : public GUSIDevice {
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
59 public:
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
60 static GUSISIOUXDevice * Instance();
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
61
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
62
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
63 virtual bool Want(GUSIFileToken & file);
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
64 virtual GUSISocket * open(GUSIFileToken &, int flags);
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
65 private:
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
66 GUSISIOUXDevice() {}
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
67
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
68 static GUSISIOUXDevice * sInstance;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
69 };
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
70
20317
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
71 GUSISIOUXSocket * GUSISIOUXSocket::Instance(int fd)
16557
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
72 {
20317
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
73 return new GUSISIOUXSocket(fd);
16557
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
74 }
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
75 // This declaration lies about the return type
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
76 extern "C" void SIOUXHandleOneEvent(EventRecord *userevent);
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
77
20317
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
78 bool GUSISIOUXSocket::initialized = false;
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
79
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
80 GUSISIOUXSocket::GUSISIOUXSocket(int fd) : fFd(fd)
16557
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
81 {
22027
7fbefe3e3dee backport of 1.4:
Jack Jansen <jack.jansen@cwi.nl>
parents: 20317
diff changeset
82 if (!hasCustomConsole()) {
7fbefe3e3dee backport of 1.4:
Jack Jansen <jack.jansen@cwi.nl>
parents: 20317
diff changeset
83 if (!PyMac_GetDelayConsoleFlag() && !initialized)
7fbefe3e3dee backport of 1.4:
Jack Jansen <jack.jansen@cwi.nl>
parents: 20317
diff changeset
84 Initialize();
7fbefe3e3dee backport of 1.4:
Jack Jansen <jack.jansen@cwi.nl>
parents: 20317
diff changeset
85 /* Tell the upper layers there's no unseen output */
7fbefe3e3dee backport of 1.4:
Jack Jansen <jack.jansen@cwi.nl>
parents: 20317
diff changeset
86 PyMac_OutputSeen();
7fbefe3e3dee backport of 1.4:
Jack Jansen <jack.jansen@cwi.nl>
parents: 20317
diff changeset
87 }
16557
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
88 }
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
89
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
90 void
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
91 GUSISIOUXSocket::Initialize()
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
92 {
20317
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
93 if(!initialized && !hasCustomConsole())
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
94 {
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
95 initialized = true;
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
96 InstallConsole(0);
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
97 GUSISetHook(GUSI_EventHook+nullEvent, (GUSIHook)SIOUXHandleOneEvent);
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
98 GUSISetHook(GUSI_EventHook+mouseDown, (GUSIHook)SIOUXHandleOneEvent);
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
99 GUSISetHook(GUSI_EventHook+mouseUp, (GUSIHook)SIOUXHandleOneEvent);
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
100 GUSISetHook(GUSI_EventHook+updateEvt, (GUSIHook)SIOUXHandleOneEvent);
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
101 GUSISetHook(GUSI_EventHook+diskEvt, (GUSIHook)SIOUXHandleOneEvent);
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
102 GUSISetHook(GUSI_EventHook+activateEvt, (GUSIHook)SIOUXHandleOneEvent);
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
103 GUSISetHook(GUSI_EventHook+osEvt, (GUSIHook)SIOUXHandleOneEvent);
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
104 PyMac_InitMenuBar();
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
105 }
16557
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
106 }
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
107 GUSISIOUXSocket::~GUSISIOUXSocket()
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
108 {
20317
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
109 if ( !initialized || hasCustomConsole() )
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
110 return;
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
111
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
112 initialized = false;
16557
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
113 RemoveConsole();
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
114 }
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
115 ssize_t GUSISIOUXSocket::read(const GUSIScatterer & buffer)
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
116 {
20317
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
117 if(hasCustomConsole())
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
118 {
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
119 if(fFd == 0)
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
120 return buffer.SetLength(
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
121 sInConsole((char *) buffer.Buffer(), (int)buffer.Length()));
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
122
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
123 return 0;
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
124 }
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
125
16557
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
126 if ( !initialized ) Initialize();
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
127 GUSIStdioFlush();
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
128 PyMac_OutputSeen();
17629
a9485d404f05 - Raise console window on input. Fixes Carbon hang.
Jack Jansen <jack.jansen@cwi.nl>
parents: 16557
diff changeset
129 PyMac_RaiseConsoleWindow();
16557
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
130 return buffer.SetLength(
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
131 ReadCharsFromConsole((char *) buffer.Buffer(), (int)buffer.Length()));
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
132 GUSIContext::Yield(kGUSIPoll);
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
133 }
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
134 ssize_t GUSISIOUXSocket::write(const GUSIGatherer & buffer)
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
135 {
20317
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
136 if(hasCustomConsole())
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
137 {
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
138 if(fFd == 1)
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
139 return sOutConsole((char *) buffer.Buffer(), (int)buffer.Length());
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
140 else if(fFd == 2)
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
141 return sErrConsole((char *) buffer.Buffer(), (int)buffer.Length());
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
142
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
143 return 0;
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
144 }
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
145
16557
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
146 ssize_t rv;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
147
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
148 if ( !initialized ) Initialize();
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
149 PyMac_OutputNotSeen();
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
150 SIOUXUseWaitNextEvent = false;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
151 rv = WriteCharsToConsole((char *) buffer.Buffer(), (int)buffer.Length());
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
152 GUSIContext::Yield(kGUSIPoll);
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
153 return rv;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
154 }
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
155 int GUSISIOUXSocket::ioctl(unsigned int request, va_list)
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
156 {
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
157 switch (request) {
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
158 case FIOINTERACTIVE:
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
159 return 0;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
160 default:
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
161 return GUSISetPosixError(EOPNOTSUPP);
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
162 }
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
163 }
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
164 int GUSISIOUXSocket::fstat(struct stat * buf)
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
165 {
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
166 GUSISocket::fstat(buf);
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
167 buf->st_mode = S_IFCHR | 0666;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
168
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
169 return 0;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
170 }
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
171 int GUSISIOUXSocket::isatty()
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
172 {
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
173 return 1;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
174 }
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
175 static bool input_pending()
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
176 {
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
177 #if !TARGET_API_MAC_CARBON
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
178 // Jack thinks that completely removing this code is a bit
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
179 // too much...
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
180 QHdrPtr eventQueue = LMGetEventQueue();
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
181 EvQElPtr element = (EvQElPtr)eventQueue->qHead;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
182
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
183 // now, count the number of pending keyDown events.
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
184 while (element != nil) {
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
185 if (element->evtQWhat == keyDown || element->evtQWhat == autoKey)
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
186 return true;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
187 element = (EvQElPtr)element->qLink;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
188 }
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
189 #endif
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
190 return false;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
191 }
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
192
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
193 bool GUSISIOUXSocket::select(bool * canRead, bool * canWrite, bool *)
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
194 {
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
195 if ( !initialized ) Initialize();
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
196 bool cond = false;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
197 if (canRead)
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
198 if (*canRead = input_pending())
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
199 cond = true;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
200 if (canWrite)
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
201 cond = *canWrite = true;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
202
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
203 return cond;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
204 }
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
205 GUSISIOUXDevice * GUSISIOUXDevice::sInstance;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
206 GUSISIOUXDevice * GUSISIOUXDevice::Instance()
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
207 {
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
208 if (!sInstance)
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
209 sInstance = new GUSISIOUXDevice();
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
210 return sInstance;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
211 }
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
212 bool GUSISIOUXDevice::Want(GUSIFileToken & file)
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
213 {
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
214 switch (file.WhichRequest()) {
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
215 case GUSIFileToken::kWillOpen:
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
216 return file.IsDevice() && (file.StrStdStream(file.Path()) > -1);
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
217 default:
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
218 return false;
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
219 }
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
220 }
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
221 GUSISocket * GUSISIOUXDevice::open(GUSIFileToken &, int)
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
222 {
20317
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
223 return GUSISIOUXSocket::Instance(1);
16557
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
224 }
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
225 void GUSISetupConsoleDescriptors()
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
226 {
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
227 GUSIDescriptorTable * table = GUSIDescriptorTable::Instance();
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
228
20317
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
229 table->InstallSocket(GUSISIOUXSocket::Instance(0));
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
230 table->InstallSocket(GUSISIOUXSocket::Instance(1));
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
231 table->InstallSocket(GUSISIOUXSocket::Instance(2));
16557
9ce9e0342cc1 Bit the bullet and added a private GUSISIOUX for Python. This makes the delayconsole and keepopen code neater. Also tells Sioux to behave better with events, and handles cmd-. during print better. The pythonpreferences have also changed due to this.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
232 }
20317
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
233
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
234 void PyMac_SetConsoleHandler(PyReadHandler stdinH, PyWriteHandler stdoutH, PyWriteHandler stderrH)
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
235 {
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
236 if(stdinH && stdoutH && stderrH)
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
237 {
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
238 sInConsole = stdinH;
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
239 sOutConsole = stdoutH;
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
240 sErrConsole = stderrH;
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
241 }
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
242 }
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
243
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
244 long PyMac_DummyReadHandler(char *buffer, long n)
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
245 {
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
246 return 0;
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
247 }
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
248
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
249 long PyMac_DummyWriteHandler(char *buffer, long n)
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
250 {
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
251 return 0;
4ef7eb90b69a Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.
Jack Jansen <jack.jansen@cwi.nl>
parents: 17629
diff changeset
252 }