From: hackbard Date: Thu, 30 Nov 2006 10:49:05 +0000 (+0000) Subject: modifications i forgot to commit X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8780881d6185bf57b37dcfb51c8d387527b3f96c;p=my-code%2Fapi.git modifications i forgot to commit --- diff --git a/display/display.c b/display/display.c index 4f1fbb2..fd53247 100644 --- a/display/display.c +++ b/display/display.c @@ -134,6 +134,13 @@ int display_line(t_display *display,int X,int Y,int X_,int Y_,char sym) { return D_SUCCESS; } +int display_hor_line(t_display *display,int Y,char sym) { + + display_line(display,0,Y,display->max_x,Y,sym); + + return D_SUCCESS; +} + int display_string(t_display *display,int x,int y,char *string,int len) { if(len>display->max_x-x) return D_INV_STRING_LEN; diff --git a/display/display.h b/display/display.h index d8bd546..336e8b0 100644 --- a/display/display.h +++ b/display/display.h @@ -35,6 +35,7 @@ int display_set_cursor(t_display *display,int x,int y); int display_clear_screen(t_display *display); int display_shutdown(t_display *display); int display_line(t_display *display,int X,int Y,int X_,int Y_,char sym); +int display_hor_line(t_display *display,int Y,char sym); int display_string(t_display *display,int x,int y,char *string,int len); int display_string_vert(t_display *display,int x,int y,char *string,int len); diff --git a/event/event.c b/event/event.c index 2685168..fb3c82e 100644 --- a/event/event.c +++ b/event/event.c @@ -30,6 +30,14 @@ int event_set_timeout(t_event *event,int sec,int usec) { return E_SUCCESS; } +int event_set_immediately(t_event *event,unsigned char value) { + + if(value==IMM_TRUE) + event->immediately=value; + + return E_SUCCESS; +} + int event_math(int fd,t_event *event,char rw,char ar) { if(ar==ADD) { @@ -65,7 +73,7 @@ int event_start(t_event *event,void *ptr, event->wfds=event->wfds_o; tv=event->timeout; - if((tv.tv_sec==0)&&(tv.tv_usec==0)) tv_ptr=NULL; + if((tv.tv_sec==0)&&(tv.tv_usec==0)&&(!(event->immediately))) tv_ptr=NULL; else tv_ptr=&tv; if((s_ret=select(event->maxfd+1,&(event->rfds),&(event->wfds),NULL, diff --git a/event/event.h b/event/event.h index 1ea0759..310c866 100644 --- a/event/event.h +++ b/event/event.h @@ -29,6 +29,10 @@ #define ADD 'a' #define REMOVE 'r' +/* immediatley values */ +#define IMM_FALSE 0 +#define IMM_TRUE 1 + /* event specific variables */ typedef struct s_event { int outfd; @@ -36,12 +40,14 @@ typedef struct s_event { fd_set rfds,rfds_o; fd_set wfds,wfds_o; struct timeval timeout; + unsigned char immediately; unsigned char status; } t_event; /* function prototypes */ int event_init(t_event *event,int outfd); int event_set_timeout(t_event *event,int sec,int usec); +int event_set_immediately(t_event *event,unsigned char value); int event_math(int fd,t_event *event,char rw,char ar); int event_start(t_event *event,void *ptr, int (*callback0)(t_event *event,void *ptr),