- fixed GC protection.

This commit is contained in:
frese 2002-02-04 13:40:22 +00:00
parent 8fcb56c399
commit 2f1b033618
1 changed files with 21 additions and 13 deletions

View File

@ -3,15 +3,15 @@
#define ECAST(name, type) type* name = (type*)e
#define sidx 4
#define SET(i, v) S48_VECTOR_SET(r, i, v)
#define SET(i, v) temp2 = v; S48_VECTOR_SET(r, i, temp2)
#define SETSIZE(i) r = s48_make_vector(sidx+i, S48_FALSE)
s48_value scx_enter_event(XEvent* e) {
s48_value r = S48_FALSE;
s48_value temp = S48_FALSE;
s48_value temp, temp2 = S48_FALSE;
int i;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(r, temp);
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(r, temp, temp2);
switch (e->type) {
@ -281,7 +281,7 @@ s48_value scx_enter_event(XEvent* e) {
}
SET(sidx+1, temp);
}
} break;
case MappingNotify : {
ECAST(q, XMappingEvent);
@ -291,6 +291,10 @@ s48_value scx_enter_event(XEvent* e) {
SET(sidx+2, s48_enter_integer(q->count));
} break;
default: {
SETSIZE(0);
} break;
} // switch end
// XAnyEvent entries
@ -304,7 +308,8 @@ s48_value scx_enter_event(XEvent* e) {
// more??
// And the Event-Name
r = s48_cons( Bit_To_Symbol(e->type, Event_Syms), r );
temp2 = Bit_To_Symbol(e->type, Event_Syms);
r = s48_cons(temp2, r);
S48_GC_UNPROTECT();
return r;
@ -335,17 +340,20 @@ s48_value scx_Get_Motion_Events(s48_value Xdisplay, s48_value Xwindow,
SCX_EXTRACT_TIME(to),
&n);
s48_value v = s48_make_vector(n, S48_FALSE);
s48_value l = S48_NULL;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(v,l);
s48_value l = S48_NULL; s48_value t = S48_FALSE;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(v, l, t);
for (i = 0; i < n; i++) {
l = s48_cons(SCX_ENTER_TIME(p[i].time),
s48_cons(s48_enter_integer(p[i].x),
s48_cons(s48_enter_integer(p[i].y), S48_NULL)));
t = s48_enter_integer(p[i].y); l = s48_cons(t, S48_NULL);
t = s48_enter_integer(p[i].x); l = s48_cons(t, l);
t = SCX_ENTER_TIME(p[i].time); l = s48_cons(t, l);
S48_VECTOR_SET(v, i, l);
}
S48_GC_UNPROTECT();
XFree((char*)p);
S48_GC_UNPROTECT();
return v;
}