/* Synched up with: Not in FSF. */
-#ifndef _XEMACS_EVENTS_H_
-#define _XEMACS_EVENTS_H_
+#ifndef INCLUDED_events_h_
+#define INCLUDED_events_h_
#include "systime.h"
multiple heterogeneous machines, X11 and SunView, or X11 and NeXT, for
example, then it will be necessary to construct an event_stream structure
that can cope with the given types. Currently, the only implemented
- event_streams are for dumb-ttys, and for X11 plus dumb-ttys.
+ event_streams are for dumb-ttys, and for X11 plus dumb-ttys,
+ and for mswindows.
To implement this for one window system is relatively simple.
To implement this for multiple window systems is trickier and may
have a separate input fd per device).
create_stream_pair_cb These callbacks are called by process code to
- delete_stream_pair_cb create and delete a pait of input and output lstreams
+ delete_stream_pair_cb create and delete a pair of input and output lstreams
which are used for subprocess I/O.
quitp_cb A handler function called from the `QUIT' macro which
------------------------
Since there are many possible processes/event loop combinations, the event code
- is responsible for creating an appropriare lstream type. The process
+ is responsible for creating an appropriate lstream type. The process
implementation does not care about that implementation.
The Create stream pair function is passed two void* values, which identify
- process-dependant 'handles'. The process implementation uses these handles
+ process-dependent 'handles'. The process implementation uses these handles
to communicate with child processes. The function must be prepared to receive
- handle types of any process implementation. Since there only one process
+ handle types of any process implementation. Since only one process
implementation exists in a particular XEmacs configuration, preprocessing
- is a mean of compiling in the support for the code which deals with particular
+ is a means of compiling in the support for the code which deals with particular
handle types.
For example, a unixoid type loop, which relies on file descriptors, may be
corresponding lstream should not be created.
The return value of the function is a unique stream identifier. It is used
- by processes implementation, in its platform-independant part. There is
+ by processes implementation, in its platform-independent part. There is
the get_process_from_usid function, which returns process object given its
USID. The event stream is responsible for converting its internal handle
type into USID.
Example is the TTY event stream. When a file descriptor signals input, the
event loop must determine process to which the input is destined. Thus,
- the imlementation uses process input stream file descriptor as USID, by
+ the implementation uses process input stream file descriptor as USID, by
simply casting the fd value to USID type.
There are two special USID values. One, USID_ERROR, indicates that the stream
pair cannot be created. The second, USID_DONTHASH, indicates that streams are
created, but the event stream does not wish to be able to find the process
- by its USID. Specifically, if an event stream implementation never calss
+ by its USID. Specifically, if an event stream implementation never calls
get_process_from_usid, this value should always be returned, to prevent
accumulating useless information on USID to process relationship.
*/
#define USID_DONTHASH ((USID)0)
\f
-struct Lisp_Event;
-struct Lisp_Process;
-
struct event_stream
{
int (*event_pending_p) (int);
- void (*next_event_cb) (struct Lisp_Event *);
- void (*handle_magic_event_cb) (struct Lisp_Event *);
+ void (*next_event_cb) (Lisp_Event *);
+ void (*handle_magic_event_cb) (Lisp_Event *);
int (*add_timeout_cb) (EMACS_TIME);
void (*remove_timeout_cb) (int);
void (*select_console_cb) (struct console *);
void (*unselect_console_cb) (struct console *);
- void (*select_process_cb) (struct Lisp_Process *);
- void (*unselect_process_cb) (struct Lisp_Process *);
+ void (*select_process_cb) (Lisp_Process *);
+ void (*unselect_process_cb) (Lisp_Process *);
void (*quit_p_cb) (void);
USID (*create_stream_pair_cb) (void* /* inhandle*/, void* /*outhandle*/ ,
Lisp_Object* /* instream */,
{
int interval_id;
int id_number;
- Lisp_Object function, object;
+ Lisp_Object function;
+ Lisp_Object object;
};
struct eval_data
#endif
};
+struct Lisp_Timeout
+{
+ struct lcrecord_header header;
+ int id; /* Id we use to identify the timeout over its lifetime */
+ int interval_id; /* Id for this particular interval; this may
+ be different each time the timeout is
+ signalled.*/
+ Lisp_Object function, object; /* Function and object associated
+ with timeout. */
+ EMACS_TIME next_signal_time; /* Absolute time when the timeout
+ is next going to be signalled. */
+ unsigned int resignal_msecs; /* How far after the next timeout
+ should the one after that
+ occur? */
+};
+typedef struct Lisp_Timeout Lisp_Timeout;
+
+DECLARE_LRECORD (timeout, Lisp_Timeout);
+#define XTIMEOUT(x) XRECORD (x, timeout, Lisp_Timeout)
+#define XSETTIMEOUT(x, p) XSETRECORD (x, p, timeout)
+#define TIMEOUTP(x) RECORDP (x, timeout)
+#define CHECK_TIMEOUT(x) CHECK_RECORD (x, timeout)
+#define CONCHECK_TIMEOUT(x) CONCHECK_RECORD (x, timeout)
+
struct Lisp_Event
{
/* header->next (aka XEVENT_NEXT ()) is used as follows:
struct motion_data motion;
struct process_data process;
struct timeout_data timeout;
- struct eval_data eval; /* misc_user_event no loger uses this */
+ struct eval_data eval; /* misc_user_event no longer uses this */
struct misc_user_data misc; /* because it needs position information */
union magic_data magic;
struct magic_eval_data magic_eval;
} event;
};
-DECLARE_LRECORD (event, struct Lisp_Event);
-#define XEVENT(x) XRECORD (x, event, struct Lisp_Event)
+DECLARE_LRECORD (event, Lisp_Event);
+#define XEVENT(x) XRECORD (x, event, Lisp_Event)
#define XSETEVENT(x, p) XSETRECORD (x, p, event)
#define EVENTP(x) RECORDP (x, event)
-#define GC_EVENTP(x) GC_RECORDP (x, event)
#define CHECK_EVENT(x) CHECK_RECORD (x, event)
#define CONCHECK_EVENT(x) CONCHECK_RECORD (x, event)
/* Maybe this should be trickier */
#define KEYSYM(x) (intern (x))
-Lisp_Object allocate_command_builder (Lisp_Object console);
-
-void format_event_object (char *buf, struct Lisp_Event *e, int brief);
-void character_to_event (Emchar c, struct Lisp_Event *event,
+/* from events.c */
+void format_event_object (char *buf, Lisp_Event *e, int brief);
+void character_to_event (Emchar c, Lisp_Event *event,
struct console *con,
int use_console_meta_flag,
int do_backspace_mapping);
-void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object);
-void zero_event (struct Lisp_Event *e);
-
+void zero_event (Lisp_Event *e);
void deallocate_event_chain (Lisp_Object event);
Lisp_Object event_chain_tail (Lisp_Object event);
void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail);
Lisp_Object event);
Lisp_Object event_chain_nth (Lisp_Object event_chain, int n);
Lisp_Object copy_event_chain (Lisp_Object event_chain);
-
/* True if this is a non-internal event
(keyboard press, menu, scrollbar, mouse button) */
int command_event_p (Lisp_Object event);
-
+void define_self_inserting_symbol (Lisp_Object, Lisp_Object);
+Emchar event_to_character (Lisp_Event *, int, int, int);
struct console *event_console_or_selected (Lisp_Object event);
-void event_stream_next_event (struct Lisp_Event *event);
-void event_stream_handle_magic_event (struct Lisp_Event *event);
-void event_stream_select_console (struct console *c);
-void event_stream_unselect_console (struct console *c);
-void event_stream_select_process (struct Lisp_Process *proc);
-void event_stream_unselect_process (struct Lisp_Process *proc);
+/* from event-stream.c */
+Lisp_Object allocate_command_builder (Lisp_Object console);
+void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object);
+void event_stream_next_event (Lisp_Event *event);
+void event_stream_handle_magic_event (Lisp_Event *event);
+void event_stream_select_console (struct console *con);
+void event_stream_unselect_console (struct console *con);
+void event_stream_select_process (Lisp_Process *proc);
+void event_stream_unselect_process (Lisp_Process *proc);
USID event_stream_create_stream_pair (void* inhandle, void* outhandle,
Lisp_Object* instream, Lisp_Object* outstream, int flags);
USID event_stream_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream);
void event_stream_disable_wakeup (int id, int async_p);
void event_stream_deal_with_async_timeout (int interval_id);
-/* from signal.c */
int event_stream_add_async_timeout (EMACS_TIME thyme);
void event_stream_remove_async_timeout (int id);
void any_console_state (void);
int in_single_console_state (void);
+extern int emacs_is_blocking;
+
+extern volatile int sigint_happened;
+
#ifdef HAVE_UNIXOID_EVENT_LOOP
+/* from event-unixoid.c */
+
/* Ceci n'est pas un pipe. */
extern int signal_event_pipe[];
int event_stream_unixoid_select_console (struct console *con);
int event_stream_unixoid_unselect_console (struct console *con);
-int event_stream_unixoid_select_process (struct Lisp_Process *proc);
-int event_stream_unixoid_unselect_process (struct Lisp_Process *proc);
-int read_event_from_tty_or_stream_desc (struct Lisp_Event *event,
- struct console *c, int fd);
+int event_stream_unixoid_select_process (Lisp_Process *proc);
+int event_stream_unixoid_unselect_process (Lisp_Process *proc);
+int read_event_from_tty_or_stream_desc (Lisp_Event *event,
+ struct console *con, int fd);
USID event_stream_unixoid_create_stream_pair (void* inhandle, void* outhandle,
Lisp_Object* instream,
Lisp_Object* outstream,
#endif /* HAVE_UNIXOID_EVENT_LOOP */
-extern int emacs_is_blocking;
-
-extern volatile int sigint_happened;
-
/* Define this if you want the tty event stream to be used when the
first console is tty, even if HAVE_X_WINDOWS is defined */
/* #define DEBUG_TTY_EVENT_STREAM */
#endif /* emacs */
-#endif /* _XEMACS_EVENTS_H_ */
+#endif /* INCLUDED_events_h_ */