summaryrefslogtreecommitdiff
path: root/zwgc/xrevstack.c
diff options
context:
space:
mode:
authorGravatar Marc Horowitz <marc@mit.edu>1992-05-07 18:37:55 +0000
committerGravatar Marc Horowitz <marc@mit.edu>1992-05-07 18:37:55 +0000
commit179851e1e1d30d7decb76a78025b5ac7d47640b6 (patch)
tree7a5dc7c51ec56a749980b9cd1a665492971a04dd /zwgc/xrevstack.c
parent1ccde9351c3c5d680ab2a09b55175fa5e55ba395 (diff)
WM_DELETE_WINDOW support and unlink_gram support
Diffstat (limited to 'zwgc/xrevstack.c')
-rw-r--r--zwgc/xrevstack.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/zwgc/xrevstack.c b/zwgc/xrevstack.c
index e21d6a1..ae22da7 100644
--- a/zwgc/xrevstack.c
+++ b/zwgc/xrevstack.c
@@ -23,6 +23,7 @@ static char rcsid_xrevstack_c[] = "$Id$";
#include <stdio.h>
x_gram *bottom_gram = NULL;
+x_gram *unlinked = NULL;
int reverse_stack = 0;
void add_to_bottom(gram)
@@ -60,11 +61,40 @@ void delete_gram(gram)
} else {
bottom_gram = NULL;
}
+ } else if (gram == unlinked) {
+ if (gram->above) {
+ unlinked = gram->above;
+ unlinked->below = NULL;
+ } else {
+ unlinked = NULL;
+ }
} else {
if (gram->above)
gram->above->below = gram->below;
gram->below->above = gram->above;
}
+
+ /* fix up above & below pointers so that calling delete_gram
+ again is safe */
+ gram->below = gram;
+ gram->above = gram;
+}
+
+void unlink_gram(gram)
+ x_gram *gram;
+{
+ delete_gram(gram);
+
+ if (unlinked) {
+ unlinked->below = gram;
+ gram->below = NULL;
+ gram->above = unlinked;
+ unlinked = gram;
+ } else {
+ gram->above = NULL;
+ gram->below = NULL;
+ unlinked = gram;
+ }
}
#endif