Просмотр исходного кода

- removed slk references

- corrected minor algo errors in primitives
- added doxygen @file header
tags/v0.9.3
Dan Lynch 18 лет назад
Родитель
Сommit
14f5d3203d
2 измененных файлов: 16 добавлений и 24 удалений
  1. 10
    6
      src/hci/mucurses/core.c
  2. 6
    18
      src/hci/mucurses/core.h

+ 10
- 6
src/hci/mucurses/core.c Просмотреть файл

@@ -1,6 +1,12 @@
1 1
 #include <curses.h>
2 2
 #include "core.h"
3 3
 
4
+/** @file
5
+ *
6
+ * MuCurses core functions
7
+ *
8
+ */
9
+
4 10
 WINDOW _stdscr = {
5 11
 	.attrs = A_DEFAULT,
6 12
 	.ori_y = 0,
@@ -10,8 +16,6 @@ WINDOW _stdscr = {
10 16
 	.scr = curscr,
11 17
 };
12 18
 
13
-struct _softlabelkeys *slks;
14
-
15 19
 /*
16 20
  *  Primitives
17 21
  */
@@ -29,14 +33,14 @@ void _wputch ( WINDOW *win, chtype ch, int wrap ) {
29 33
 	win->scr->movetoyx( win->scr, win->ori_y + win->curs_y,
30 34
 				      win->ori_x + win->curs_x );
31 35
 	win->scr->putc(win->scr, ch);
32
-	if ( ++(win->curs_x) == win->width ) {
36
+	if ( ++(win->curs_x) - win->width == 0 ) {
33 37
 		if ( wrap == WRAP ) {
34 38
 			win->curs_x = 0;
35 39
 			/* specification says we should really scroll,
36 40
 			   but we have no buffer to scroll with, so we
37 41
 			   can only overwrite back at the beginning of
38 42
 			   the window */
39
-			if ( ++(win->curs_y) == win->height )
43
+			if ( ++(win->curs_y) - win->height == 0 )
40 44
 				win->curs_y = 0;
41 45
 		} else {
42 46
 			(win->curs_x)--;
@@ -82,8 +86,8 @@ void _wputstr ( WINDOW *win, const char *str, int wrap, int n ) {
82 86
  */
83 87
 int wmove ( WINDOW *win, int y, int x ) {
84 88
 	/* chech for out-of-bounds errors */
85
-	if ( ( ( (unsigned)x - win->ori_x ) > win->width ) ||
86
-	     ( ( (unsigned)y - win->ori_y ) > win->height ) ) {
89
+	if ( ( (unsigned)y >= win->height ) ||
90
+	     ( (unsigned)x >= win->width ) ) {
87 91
 		return ERR;
88 92
 	}
89 93
 

+ 6
- 18
src/hci/mucurses/core.h Просмотреть файл

@@ -1,6 +1,12 @@
1 1
 #ifndef CORE_H
2 2
 #define CORE_H
3 3
 
4
+/** @file
5
+ *
6
+ * MuCurses core implementation specific header file
7
+ *
8
+ */
9
+
4 10
 #define WRAP 0
5 11
 #define NOWRAP 1
6 12
 
@@ -13,24 +19,6 @@ unsigned int *_COLOUR_PAIRS; /* basically this is an array, but as its
13 19
 			       pointer and malloc the array into being
14 20
 			       ... */
15 21
 
16
-struct _softlabel {
17
-	// label string
18
-	char *label;
19
-	/* Format of soft label 
20
-	   0: left justify
21
-	   1: centre justify
22
-	   2: right justify
23
-	 */
24
-	unsigned short fmt;
25
-};
26
-
27
-struct _softlabelkeys {
28
-	struct _softlabel fkeys[12];
29
-	attr_t attrs;
30
-	unsigned short fmt;
31
-	unsigned short maxlablen;
32
-};
33
-
34 22
 void _wputch ( WINDOW *win, chtype ch, int wrap );
35 23
 void _wputchstr ( WINDOW *win, const chtype *chstr, int wrap, int n );
36 24
 void _wputstr ( WINDOW *win, const char *str, int wrap, int n );

Загрузка…
Отмена
Сохранить