comparison src/events.c @ 3063:d30cd499e445

[xemacs-hg @ 2005-11-13 10:48:01 by ben] further error-checking, etc. alloc.c, lrecord.h: Move around the handling of setting of lheader->uid so it's in set_lheader_implementation() -- that way, even non-MC-ALLOC builds get useful uid's in their bare lrecords. Redo related code for strings so the non-ascii count that is stored in the uid isn't hosed. events.c: Save and restore the uid around event zeroing/deadbeefing. lisp.h: Set the correct value of MAX_STRING_ASCII_BEGIN under MC_ALLOC. lisp.h: rearrange the basic code handling ints and chars. basic int stuff goes first, followed by basic char stuff, followed in turn by stuff that mixes ints and chars. this is required since some basic defn's have become inline functions. XCHAR and CHARP have additional error-checking in that they check to make sure that the value in question is not just a character but a valid character (i.e. its numeric value is valid). print.c: debug_p4 now has a useful UID in all cases and uses it; but it also prints the raw header address (previously, you just got one of them). text.h: some basic char defn's that belonged in lisp.h have been moved there. valid_ichar_p() is moved too since the inline functions need it.
author ben
date Sun, 13 Nov 2005 10:48:04 +0000
parents facf3239ba30
children 141c2920ea48 3742ea8250b5
comparison
equal deleted inserted replaced
3062:21d92abaac3a 3063:d30cd499e445
1 /* Events: printing them, converting them to and from characters. 1 /* Events: printing them, converting them to and from characters.
2 Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc. 2 Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
3 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. 3 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
4 Copyright (C) 2001, 2002 Ben Wing. 4 Copyright (C) 2001, 2002, 2005 Ben Wing.
5 5
6 This file is part of XEmacs. 6 This file is part of XEmacs.
7 7
8 XEmacs is free software; you can redistribute it and/or modify it 8 XEmacs is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the 9 under the terms of the GNU General Public License as published by the
84 /* Make sure we lose quickly if we try to use this event */ 84 /* Make sure we lose quickly if we try to use this event */
85 static void 85 static void
86 deinitialize_event (Lisp_Object ev) 86 deinitialize_event (Lisp_Object ev)
87 { 87 {
88 Lisp_Event *event = XEVENT (ev); 88 Lisp_Event *event = XEVENT (ev);
89
90 int i; 89 int i;
90 /* Preserve the old UID for this event, for tracking it */
91 unsigned int old_uid = event->lheader.uid;
92
91 for (i = 0; i < (int) (sizeof (Lisp_Event) / sizeof (int)); i++) 93 for (i = 0; i < (int) (sizeof (Lisp_Event) / sizeof (int)); i++)
92 ((int *) event) [i] = 0xdeadbeef; /* -559038737 base 10 */ 94 ((int *) event) [i] = 0xdeadbeef; /* -559038737 base 10 */
93 set_lheader_implementation (&event->lheader, &lrecord_event); 95 set_lheader_implementation (&event->lheader, &lrecord_event);
96 event->lheader.uid = old_uid;
94 set_event_type (event, dead_event); 97 set_event_type (event, dead_event);
95 SET_EVENT_CHANNEL (event, Qnil); 98 SET_EVENT_CHANNEL (event, Qnil);
96 XSET_EVENT_NEXT (ev, Qnil); 99 XSET_EVENT_NEXT (ev, Qnil);
97 } 100 }
98 101
99 /* Set everything to zero or nil so that it's predictable. */ 102 /* Set everything to zero or nil so that it's predictable. */
100 void 103 void
101 zero_event (Lisp_Event *e) 104 zero_event (Lisp_Event *e)
102 { 105 {
106 /* Preserve the old UID for this event, for tracking it */
107 unsigned int old_uid = e->lheader.uid;
108
103 xzero (*e); 109 xzero (*e);
104 set_lheader_implementation (&e->lheader, &lrecord_event); 110 set_lheader_implementation (&e->lheader, &lrecord_event);
111 e->lheader.uid = old_uid;
105 set_event_type (e, empty_event); 112 set_event_type (e, empty_event);
106 SET_EVENT_CHANNEL (e, Qnil); 113 SET_EVENT_CHANNEL (e, Qnil);
107 SET_EVENT_NEXT (e, Qnil); 114 SET_EVENT_NEXT (e, Qnil);
108 } 115 }
109 116