diff options
| author | FreeArtMan <dos21h@gmail.com> | 2015-02-17 15:15:26 +0900 | 
|---|---|---|
| committer | FreeArtMan <dos21h@gmail.com> | 2015-02-17 15:15:26 +0900 | 
| commit | c1e6c1341ace1f61569e6d1d0dbfb36cb192113c (patch) | |
| tree | 9fc23f173342a680333825bc8300cad422ba99a5 /libterm | |
| parent | 3090282601248d3ce5f91cbddeb450d744b27472 (diff) | |
| download | microbbs-c1e6c1341ace1f61569e6d1d0dbfb36cb192113c.tar.gz microbbs-c1e6c1341ace1f61569e6d1d0dbfb36cb192113c.zip | |
Updated libterm. Updated config headers
Diffstat (limited to 'libterm')
| -rw-r--r-- | libterm/term.c | 23 | ||||
| -rw-r--r-- | libterm/term.h | 2 | ||||
| -rw-r--r-- | libterm/term_gui.c | 31 | ||||
| -rw-r--r-- | libterm/term_gui.h | 24 | 
4 files changed, 73 insertions, 7 deletions
| diff --git a/libterm/term.c b/libterm/term.c index 412253b..532dc92 100644 --- a/libterm/term.c +++ b/libterm/term.c @@ -37,6 +37,23 @@ exit_error:  	return -1;  } +//set terminal speed return 0 if OK and 1 if not +//im trust to input arguments that they are ok +int term_set_speed( term_screen *ts, speed_t speed) +{ +	int ret = cfsetospeed( &ts->raw_i, speed ); +	if ( ret != 0 ) +		return 1; + +	//if baudrate set to there then input speed same as  +	//output speed +	cfsetispeed( &ts->raw_i, B0); +	ret = tcsetattr(1, TCSANOW, &ts->raw_i ); +	if ( ret != 0 ) +		return 1; +	return 0; +} +  //get maximal number of columns setting up cursor to 999 column  //and getting on with place terminal have placed cursor and getting  //column on with terminal putted cursor @@ -233,12 +250,6 @@ exit_error:  } -int term_set_speed( term_screen *ts ) -{ -	int ret = -1; -	return ret; -} -  //clean terminal with escape command   int term_clr_scr( term_screen *ts ) diff --git a/libterm/term.h b/libterm/term.h index b399cd6..51af31d 100644 --- a/libterm/term.h +++ b/libterm/term.h @@ -52,6 +52,7 @@ typedef struct term_screen  } term_screen;  int term_init( term_screen *ts ); +int term_set_speed( term_screen *ts, speed_t speed);  int term_get_maxcol( term_screen *ts );  int term_get_maxrow( term_screen *ts );  int term_cur_get_c( term_screen *ts ); @@ -59,7 +60,6 @@ int term_cur_get_r( term_screen *ts );  int term_cur_set_c( term_screen *ts, unsigned int pc );  int term_cur_set_r( term_screen *ts, unsigned int pr );  int term_cur_set_cr( term_screen *ts, unsigned int pc , unsigned int pr ); -int term_set_speed( term_screen *ts );  int term_clr_scr( term_screen *ts );  int term_set_raw_mode( term_screen *ts );  int term_mode_rows( term_screen *ts ); diff --git a/libterm/term_gui.c b/libterm/term_gui.c new file mode 100644 index 0000000..dcdc840 --- /dev/null +++ b/libterm/term_gui.c @@ -0,0 +1,31 @@ +#include "term_gui.h" + +int term_gui_init( term_gui *tg, term_screen *ts ) +{ +	return 0; +} + + +int term_set_wh( term_screen *tg, int width, int height ) +{ +	return 0; +} + + +int term_gui_input_box( term_gui *ts, int x, int y, int w, int h, char *prompt,  +		char *str, size_t sz ) +{ +	return 0; +} + + +int term_gui_draw( term_gui *tg ) +{ +	return 0; +} + + +int term_gui_destroy( term_gui *tg ) +{ +	return 0; +}
\ No newline at end of file diff --git a/libterm/term_gui.h b/libterm/term_gui.h new file mode 100644 index 0000000..408382e --- /dev/null +++ b/libterm/term_gui.h @@ -0,0 +1,24 @@ +#ifndef __LIBTERM_TERM_GUI_H +#define __LIBTERM_TERM_GUI_H + +#include "term.h" +#include "term_io.h" + +typedef struct term_gui +{ +	term_screen *ts; +	int w; +	int h; +	int abs_x; +	int abs_y; +} term_gui; + +int term_gui_init( term_gui *tg, term_screen *ts ); +int term_set_wh( term_screen *tg, int width, int height ); +int term_gui_input_box( term_gui *ts, int x, int y, int w, int h, char *prompt,  +		char *str, size_t sz ); +int term_gui_draw( term_gui *tg ); +int term_gui_destroy( term_gui *tg ); + + +#endif
\ No newline at end of file | 
