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

Skip to content

Commit 8413b47

Browse files
committed
Added PyMac_OutputSeen(), which acknowledges all current output in the stdio window, i.e. it acts like input has been read insofar as the keep-console-open option is interested.
1 parent f1a0a4b commit 8413b47

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

Mac/Include/macglue.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ int PyMac_setfiletype(char *, long, long); /* Set file creator and type */
129129
/* from macmain.c: */
130130
void PyMac_Exit(int);
131131
void PyMac_InitApplication(void);
132+
void PyMac_OutputSeen(void);
132133
#ifdef USE_MAC_APPLET_SUPPORT
133134
void PyMac_InitApplet(void);
134135
#endif

Mac/Modules/macosmodule.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,18 @@ MacOS_KeepConsole(PyObject *self, PyObject *args)
691691
return Py_None;
692692
}
693693

694+
static char OutputSeen_doc[] = "Call to reset the 'unseen output' flag for the keep-console-open option";
695+
696+
static PyObject *
697+
MacOS_OutputSeen(PyObject *self, PyObject *args)
698+
{
699+
if (!PyArg_ParseTuple(args, ""))
700+
return NULL;
701+
PyMac_OutputSeen();
702+
Py_INCREF(Py_None);
703+
return Py_None;
704+
}
705+
694706
static PyMethodDef MacOS_Methods[] = {
695707
#if !TARGET_API_MAC_CARBON
696708
{"AcceptHighLevelEvent", MacOS_AcceptHighLevelEvent, 1, accepthle_doc},
@@ -711,6 +723,7 @@ static PyMethodDef MacOS_Methods[] = {
711723
{"MaxBlock", MacOS_MaxBlock, 1, MaxBlock_doc},
712724
{"CompactMem", MacOS_CompactMem, 1, CompactMem_doc},
713725
{"KeepConsole", MacOS_KeepConsole, 1, KeepConsole_doc},
726+
{"OutputSeen", MacOS_OutputSeen, 1, OutputSeen_doc},
714727
{NULL, NULL} /* Sentinel */
715728
};
716729

Mac/Python/macmain.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,15 @@ Py_Main(argc, argv)
538538
/*NOTREACHED*/
539539
}
540540

541+
/*
542+
** Reset the "unseen output" flag
543+
*/
544+
void
545+
PyMac_OutputSeen()
546+
{
547+
gusisioux_state = GUSISIOUX_STATE_LASTREAD;
548+
}
549+
541550
/*
542551
** Terminate application
543552
*/

0 commit comments

Comments
 (0)