mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-07 16:10:46 -08:00
Meaningful types on event functions.
Removing some cut-and-paste code. Removing unnecessary and incorrect short-circuit macros when events are disabled. Copied from Perforce Change: 179126 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
84eedf29b0
commit
faffc587eb
2 changed files with 38 additions and 39 deletions
|
|
@ -38,7 +38,7 @@ static Count eventUserCount;
|
|||
static Serial EventInternSerial;
|
||||
|
||||
char *EventNext, *EventLimit; /* Used by macros in <code/event.h> */
|
||||
Word EventKindControl; /* Bit set used to control output. */
|
||||
EventControlSet EventKindControl; /* Bit set used to control output. */
|
||||
|
||||
|
||||
/* EventFlush -- flush event buffer to the event stream */
|
||||
|
|
@ -162,11 +162,14 @@ void EventFinish(void)
|
|||
* Reset(M) EventControl(M,0)
|
||||
* Flip(M) EventControl(0,M)
|
||||
* Read() EventControl(0,0)
|
||||
*
|
||||
* FIXME: Candy-machine interface is a transgression.
|
||||
*/
|
||||
|
||||
Word EventControl(Word resetMask, Word flipMask)
|
||||
EventControlSet EventControl(EventControlSet resetMask,
|
||||
EventControlSet flipMask)
|
||||
{
|
||||
Word oldValue = EventKindControl;
|
||||
EventControlSet oldValue = EventKindControl;
|
||||
|
||||
/* EventKindControl = (EventKindControl & ~resetMask) ^ flipMask */
|
||||
EventKindControl =
|
||||
|
|
@ -178,37 +181,33 @@ Word EventControl(Word resetMask, Word flipMask)
|
|||
|
||||
/* EventInternString -- emit an Intern event on the (null-term) string given */
|
||||
|
||||
Word EventInternString(const char *label)
|
||||
EventStringId EventInternString(const char *label)
|
||||
{
|
||||
Word id;
|
||||
|
||||
AVER(label != NULL);
|
||||
|
||||
id = (Word)EventInternSerial;
|
||||
++EventInternSerial;
|
||||
EVENT2S(Intern, id, StringLength(label), label);
|
||||
return id;
|
||||
return EventInternGenString(StringLength(label), label);
|
||||
}
|
||||
|
||||
|
||||
/* EventInternGenString -- emit an Intern event on the string given */
|
||||
|
||||
Word EventInternGenString(size_t len, const char *label)
|
||||
EventStringId EventInternGenString(size_t len, const char *label)
|
||||
{
|
||||
Word id;
|
||||
EventStringId id;
|
||||
|
||||
AVER(label != NULL);
|
||||
|
||||
id = (Word)EventInternSerial;
|
||||
id = EventInternSerial;
|
||||
++EventInternSerial;
|
||||
|
||||
EVENT2S(Intern, id, len, label);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
/* EventLabelAddr -- emit event to label address with the given id */
|
||||
|
||||
void EventLabelAddr(Addr addr, Word id)
|
||||
void EventLabelAddr(Addr addr, EventStringId id)
|
||||
{
|
||||
AVER((Serial)id < EventInternSerial);
|
||||
|
||||
|
|
@ -221,13 +220,13 @@ void EventLabelAddr(Addr addr, Word id)
|
|||
|
||||
Res (EventSync)(void)
|
||||
{
|
||||
return(ResOK);
|
||||
return ResOK;
|
||||
}
|
||||
|
||||
|
||||
Res (EventInit)(void)
|
||||
{
|
||||
return(ResOK);
|
||||
return ResOK;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -237,28 +236,28 @@ void (EventFinish)(void)
|
|||
}
|
||||
|
||||
|
||||
Word (EventControl)(Word resetMask, Word flipMask)
|
||||
EventControlSet (EventControl)(EventControlSet resetMask,
|
||||
EventControlSet flipMask)
|
||||
{
|
||||
UNUSED(resetMask);
|
||||
UNUSED(flipMask);
|
||||
|
||||
return (Word)0;
|
||||
return BS_EMPTY(EventControlSet);
|
||||
}
|
||||
|
||||
|
||||
Word (EventInternString)(const char *label)
|
||||
EventStringId (EventInternString)(const char *label)
|
||||
{
|
||||
UNUSED(label);
|
||||
|
||||
return (Word)0;
|
||||
NOTREACHED;
|
||||
return (EventInternString)0x9024EACH;
|
||||
}
|
||||
|
||||
|
||||
Word (EventInternGenString)(size_t len, const char *label)
|
||||
{
|
||||
UNUSED(len); UNUSED(label);
|
||||
|
||||
return (Word)0;
|
||||
NOTREACHED;
|
||||
return (EventInternString)0x9024EACH;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -266,6 +265,7 @@ void (EventLabelAddr)(Addr addr, Word id)
|
|||
{
|
||||
UNUSED(addr);
|
||||
UNUSED(id);
|
||||
NOTREACHED;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,13 +20,17 @@
|
|||
#include "eventdef.h"
|
||||
|
||||
|
||||
typedef Word EventStringId;
|
||||
typedef Word EventControlSet;
|
||||
|
||||
extern Res EventSync(void);
|
||||
extern Res EventInit(void);
|
||||
extern void EventFinish(void);
|
||||
extern Word EventControl(Word, Word);
|
||||
extern Word EventInternString(const char *);
|
||||
extern Word EventInternGenString(size_t, const char *);
|
||||
extern void EventLabelAddr(Addr, Word);
|
||||
extern EventControlSet EventControl(EventControlSet resetMask,
|
||||
EventControlSet flipMask);
|
||||
extern EventStringId EventInternString(const char *label);
|
||||
extern EventStringId EventInternGenString(size_t, const char *label);
|
||||
extern void EventLabelAddr(Addr addr, Word id);
|
||||
extern Res EventFlush(void);
|
||||
|
||||
|
||||
|
|
@ -38,10 +42,13 @@ extern char *EventNext, *EventLimit;
|
|||
extern Word EventKindControl;
|
||||
|
||||
|
||||
/* TODO: Append a size at EventNext - sizeof(EventSize) so that a backtrace
|
||||
can step backwards through the event buffer. */
|
||||
|
||||
#define EVENT_BEGIN(name, structSize) \
|
||||
BEGIN \
|
||||
if(Event##name##Always && \
|
||||
BS_IS_MEMBER(EventKindControl, ((Index)Event##name##Kind))) { \
|
||||
if(/* Event##name##Always && FIXME: depend on variety */ \
|
||||
BS_IS_MEMBER(EventKindControl, (Index)Event##name##Kind)) { \
|
||||
Event##name##Struct *_event; \
|
||||
size_t _size = size_tAlignUp(structSize, MPS_PF_ALIGN); \
|
||||
if (_size > (size_t)(EventLimit - EventNext)) \
|
||||
|
|
@ -103,14 +110,6 @@ extern Word EventKindControl;
|
|||
#else /* EVENT not */
|
||||
|
||||
|
||||
#define EventInit() NOOP
|
||||
#define EventFinish() NOOP
|
||||
#define EventControl(r, f) (UNUSED(r), UNUSED(f), (Word)0)
|
||||
#define EventInternString(s) (UNUSED(s), (Word)0)
|
||||
#define EventInternGenString(l, s) (UNUSED(l), UNUSED(s), (Word)0)
|
||||
#define EventLabelAddr(a, i) BEGIN UNUSED(a); UNUSED(i); END
|
||||
|
||||
|
||||
#define EVENT0(name) NOOP
|
||||
/* The following lines were generated with
|
||||
python -c 'for i in range(1,15): print "#define EVENT%d(name, %s) NOOP" % (i, ", ".join(["p%d" % j for j in range(0, i)]))'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue