summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-08-02 03:02:27 (GMT)
committerGuido van Rossum <guido@python.org>1997-08-02 03:02:27 (GMT)
commitaee094cc60b4b05e28cfd9e1a2add1b97ededbb6 (patch)
treeee321e85dc8012f5d8ee150ea003e484f2236422
parent08c166152e9f882d475b02e2d76a198389b13d0b (diff)
downloadcpython-aee094cc60b4b05e28cfd9e1a2add1b97ededbb6.zip
cpython-aee094cc60b4b05e28cfd9e1a2add1b97ededbb6.tar.gz
cpython-aee094cc60b4b05e28cfd9e1a2add1b97ededbb6.tar.bz2
Added finalization routines.
-rw-r--r--Parser/acceler.c20
-rw-r--r--Parser/intrcheck.c25
2 files changed, 44 insertions, 1 deletions
diff --git a/Parser/acceler.c b/Parser/acceler.c
index 9417b76..9b72023 100644
--- a/Parser/acceler.c
+++ b/Parser/acceler.c
@@ -68,6 +68,26 @@ PyGrammar_AddAccelerators(g)
#endif
}
+void
+PyGrammar_RemoveAccelerators(g)
+ grammar *g;
+{
+ dfa *d;
+ int i;
+ g->g_accel = 0;
+ d = g->g_dfa;
+ for (i = g->g_ndfas; --i >= 0; d++) {
+ state *s;
+ int j;
+ s = d->d_state;
+ for (j = 0; j < d->d_nstates; j++, s++) {
+ if (s->s_accel)
+ PyMem_DEL(s->s_accel);
+ s->s_accel = NULL;
+ }
+ }
+}
+
static void
fixdfa(g, d)
grammar *g;
diff --git a/Parser/intrcheck.c b/Parser/intrcheck.c
index 685e066..a2a3145 100644
--- a/Parser/intrcheck.c
+++ b/Parser/intrcheck.c
@@ -49,6 +49,11 @@ PyOS_InitInterrupts()
{
}
+void
+PyOS_FiniInterrupts()
+{
+}
+
int
PyOS_InterruptOccurred()
{
@@ -81,6 +86,11 @@ PyOS_InitInterrupts()
_go32_want_ctrl_break(1 /* TRUE */);
}
+void
+PyOS_FiniInterrupts()
+{
+}
+
int
PyOS_InterruptOccurred()
{
@@ -96,6 +106,11 @@ PyOS_InitInterrupts()
{
}
+void
+PyOS_FiniInterrupts()
+{
+}
+
int
PyOS_InterruptOccurred()
{
@@ -170,10 +185,12 @@ intcatcher(sig)
Py_AddPendingCall(PyErr_CheckSignals, NULL);
}
+static RETSIGTYPE (*old_siginthandler)() = SIG_DFL;
+
void
PyOS_InitInterrupts()
{
- if (signal(SIGINT, SIG_IGN) != SIG_IGN)
+ if ((old_siginthandler = signal(SIGINT, SIG_IGN)) != SIG_IGN)
signal(SIGINT, intcatcher);
#ifdef HAVE_SIGINTERRUPT
/* This is for SunOS and other modern BSD derivatives.
@@ -186,6 +203,12 @@ PyOS_InitInterrupts()
#endif /* HAVE_SIGINTERRUPT */
}
+void
+PyOS_FiniInterrupts()
+{
+ signal(SIGINT, old_siginthandler);
+}
+
int
PyOS_InterruptOccurred()
{