| oop.h | | oop.h | |
| | | | |
| skipping to change at line 34 | | skipping to change at line 34 | |
| OOP_NUM_EVENTS | | OOP_NUM_EVENTS | |
| } oop_event; | | } oop_event; | |
| | | | |
| /* Pass this to on_time to schedule an event immediately */ | | /* Pass this to on_time to schedule an event immediately */ | |
| static const struct timeval OOP_TIME_NOW = { 0, 0 }; | | static const struct timeval OOP_TIME_NOW = { 0, 0 }; | |
| | | | |
| /* Maximum signal number. (The OS may have a stricter limit!) */ | | /* Maximum signal number. (The OS may have a stricter limit!) */ | |
| #define OOP_NUM_SIGNALS 256 | | #define OOP_NUM_SIGNALS 256 | |
| | | | |
| /* Callbacks may return one of these */ | | /* Callbacks may return one of these */ | |
|
| extern int _oop_continue; /* internal only */ | | extern int _oop_continue,_oop_error; /* internal only */ | |
| #define OOP_CONTINUE ((void *) &_oop_continue) | | #define OOP_CONTINUE ((void *) &_oop_continue) | |
|
| #define OOP_HALT ((void *) NULL) /* (or any other value except OOP_CONTINUE | | #define OOP_ERROR ((void *) &_oop_error) | |
| ) */ | | #define OOP_HALT ((void *) NULL) /* (or any other value besides OOP_CONTINU | |
| | | E) */ | |
| | | | |
| /* Callback function prototypes */ | | /* Callback function prototypes */ | |
| typedef void *oop_call_fd(oop_source *,int fd,oop_event,void *); | | typedef void *oop_call_fd(oop_source *,int fd,oop_event,void *); | |
| typedef void *oop_call_time(oop_source *,struct timeval,void *); | | typedef void *oop_call_time(oop_source *,struct timeval,void *); | |
| typedef void *oop_call_signal(oop_source *,int sig,void *); | | typedef void *oop_call_signal(oop_source *,int sig,void *); | |
| | | | |
| struct oop_source { | | struct oop_source { | |
| void (*on_fd)(oop_source *,int fd,oop_event,oop_call_fd *,void *); | | void (*on_fd)(oop_source *,int fd,oop_event,oop_call_fd *,void *); | |
| void (*cancel_fd)(oop_source *,int fd,oop_event); | | void (*cancel_fd)(oop_source *,int fd,oop_event); | |
| | | | |
| | | | |
| skipping to change at line 71 | | skipping to change at line 72 | |
| | | | |
| /* ------------------------------------------------------------------------
- */ | | /* ------------------------------------------------------------------------
- */ | |
| | | | |
| /* System event source. */ | | /* System event source. */ | |
| typedef struct oop_source_sys oop_source_sys; | | typedef struct oop_source_sys oop_source_sys; | |
| | | | |
| /* Create a system event source. Returns NULL on failure. */ | | /* Create a system event source. Returns NULL on failure. */ | |
| oop_source_sys *oop_sys_new(void); | | oop_source_sys *oop_sys_new(void); | |
| | | | |
| /* Process events until either of the following two conditions: | | /* Process events until either of the following two conditions: | |
|
| 1 -- some callback returns non-NULL; will return the value in question. | | 1 -- some callback returns anything but OOP_CONTINUE; | |
| 2 -- no callbacks are registered; will return NULL. */ | | will return the value in question. | |
| | | 2 -- no callbacks are registered; will return OOP_CONTINUE. | |
| | | 3 -- an error occurs; will return OOP_ERROR (check errno). */ | |
| void *oop_sys_run(oop_source_sys *); | | void *oop_sys_run(oop_source_sys *); | |
| | | | |
| /* Delete a system event source. No callbacks may be registered. */ | | /* Delete a system event source. No callbacks may be registered. */ | |
| void oop_sys_delete(oop_source_sys *); | | void oop_sys_delete(oop_source_sys *); | |
| | | | |
| /* Get the event registration interface for a system event source. */ | | /* Get the event registration interface for a system event source. */ | |
| oop_source *oop_sys_source(oop_source_sys *); | | oop_source *oop_sys_source(oop_source_sys *); | |
| | | | |
| /* ------------------------------------------------------------------------
- */ | | /* ------------------------------------------------------------------------
- */ | |
| | | | |
| | | | |
End of changes. 3 change blocks. |
| 5 lines changed or deleted | | 8 lines changed or added | |
|