Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4220 → Rev 4223

/trunk/kernel/generic/include/sysinfo/sysinfo.h
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup generic
/** @addtogroup generic
* @{
*/
/** @file
36,6 → 36,7
#define KERN_SYSINFO_H_
 
#include <arch/types.h>
#include <string.h>
 
typedef union sysinfo_item_val {
unative_t val;
59,13 → 60,13
int subinfo_type;
} sysinfo_item_t;
 
#define SYSINFO_VAL_VAL 0
#define SYSINFO_VAL_FUNCTION 1
#define SYSINFO_VAL_UNDEFINED '?'
#define SYSINFO_VAL_VAL 0
#define SYSINFO_VAL_FUNCTION 1
#define SYSINFO_VAL_UNDEFINED U_SPECIAL
 
#define SYSINFO_SUBINFO_NONE 0
#define SYSINFO_SUBINFO_TABLE 1
#define SYSINFO_SUBINFO_FUNCTION 2
#define SYSINFO_SUBINFO_NONE 0
#define SYSINFO_SUBINFO_TABLE 1
#define SYSINFO_SUBINFO_FUNCTION 2
 
typedef unative_t (*sysinfo_val_fn_t)(sysinfo_item_t *root);
typedef unative_t (*sysinfo_subinfo_fn_t)(const char *subname);
/trunk/kernel/generic/include/string.h
37,13 → 37,32
 
#include <typedefs.h>
 
/**< Common Unicode characters */
#define U_SPECIAL '?'
 
#define U_LEFT_ARROW 0x2190
#define U_UP_ARROW 0x2191
#define U_RIGHT_ARROW 0x2192
#define U_DOWN_ARROW 0x2193
 
#define U_PAGE_UP 0x21de
#define U_PAGE_DOWN 0x21df
 
#define U_HOME_ARROW 0x21f1
#define U_END_ARROW 0x21f2
 
#define U_NULL 0x2400
#define U_ESCAPE 0x241b
#define U_DELETE 0x2421
 
#define U_CURSOR 0x2588
 
/**< No size limit constant */
#define STR_NO_LIMIT ((size_t) -1)
 
/**< Maximum size of a string containing cnt characters */
#define STR_BOUNDS(cnt) (cnt << 2)
 
extern char invalch;
 
extern wchar_t str_decode(const char *str, size_t *offset, size_t sz);
extern int chr_encode(const wchar_t ch, char *str, size_t *offset, size_t sz);
 
/trunk/kernel/generic/src/printf/printf_core.c
81,6 → 81,7
static char nullstr[] = "(NULL)";
static char digits_small[] = "0123456789abcdef";
static char digits_big[] = "0123456789ABCDEF";
static char invalch = U_SPECIAL;
 
/** Print one or more characters without adding newline.
*
/trunk/kernel/generic/src/console/kconsole.c
259,10 → 259,10
continue;
if (wstr_remove(current, position - 1)) {
position--;
putchar('\b');
printf("%ls", current + position);
position--;
print_cc('\b', wstr_length(current) - position);
printf("%ls ", current + position);
print_cc('\b', wstr_length(current) - position + 1);
continue;
}
}
333,65 → 333,69
continue;
}
if (ch == 0x1b) {
/* Special command */
wchar_t mod = _getc(indev);
wchar_t ch = _getc(indev);
if (ch == U_LEFT_ARROW) {
/* Left */
if (position > 0) {
putchar('\b');
position--;
}
continue;
}
if (ch == U_RIGHT_ARROW) {
/* Right */
if (position < wstr_length(current)) {
putchar(current[position]);
position++;
}
continue;
}
if ((ch == U_UP_ARROW) || (ch == U_DOWN_ARROW)) {
/* Up, down */
print_cc('\b', position);
print_cc(' ', wstr_length(current));
print_cc('\b', wstr_length(current));
if ((mod != 0x5b) && (mod != 0x4f))
if (ch == U_UP_ARROW) {
/* Up */
if (history_pos == 0)
history_pos = KCONSOLE_HISTORY - 1;
else
history_pos--;
} else {
/* Down */
history_pos++;
history_pos = history_pos % KCONSOLE_HISTORY;
}
current = history[history_pos];
printf("%ls", current);
position = wstr_length(current);
continue;
}
if (ch == U_HOME_ARROW) {
/* Home */
print_cc('\b', position);
position = 0;
continue;
}
if (ch == U_END_ARROW) {
/* End */
printf("%ls", current + position);
position = wstr_length(current);
continue;
}
if (ch == U_DELETE) {
/* Delete */
if (position == wstr_length(current))
continue;
if ((ch == 0x33) && (_getc(indev) == 0x7e)) {
/* Delete */
if (position == wstr_length(current))
continue;
if (wstr_remove(current, position)) {
putchar('\b');
printf("%ls", current + position);
position--;
print_cc('\b', wstr_length(current) - position);
}
} else if (ch == 0x48) {
/* Home */
print_cc('\b', position);
position = 0;
} else if (ch == 0x46) {
/* End */
printf("%ls", current + position);
position = wstr_length(current);
} else if (ch == 0x44) {
/* Left */
if (position > 0) {
putchar('\b');
position--;
}
} else if (ch == 0x43) {
/* Right */
if (position < wstr_length(current)) {
putchar(current[position]);
position++;
}
} else if ((ch == 0x41) || (ch == 0x42)) {
/* Up, down */
print_cc('\b', position);
print_cc(' ', wstr_length(current));
print_cc('\b', wstr_length(current));
if (ch == 0x41) {
/* Up */
if (history_pos == 0)
history_pos = KCONSOLE_HISTORY - 1;
else
history_pos--;
} else {
/* Down */
history_pos++;
history_pos = history_pos % KCONSOLE_HISTORY;
}
current = history[history_pos];
printf("%ls", current);
position = wstr_length(current);
if (wstr_remove(current, position)) {
printf("%ls ", current + position);
print_cc('\b', wstr_length(current) - position + 1);
}
continue;
}
/trunk/kernel/generic/src/lib/string.c
109,8 → 109,6
#include <errno.h>
#include <align.h>
 
char invalch = '?';
 
/** Byte mask consisting of lowest @n bits (out of 8) */
#define LO_MASK_8(n) ((uint8_t) ((1 << (n)) - 1))
 
134,7 → 132,7
* @param offset Byte offset in string where to start decoding.
* @param size Size of the string (in bytes).
*
* @return Value of decoded character, invalch on decoding error or
* @return Value of decoded character, U_SPECIAL on decoding error or
* NULL if attempt to decode beyond @a size.
*
*/
169,11 → 167,11
cbytes = 3;
} else {
/* 10xxxxxx -- unexpected continuation byte */
return invalch;
return U_SPECIAL;
}
if (*offset + cbytes > size)
return invalch;
return U_SPECIAL;
wchar_t ch = b0 & LO_MASK_8(b0_bits);
183,7 → 181,7
/* Must be 10xxxxxx */
if ((b & 0xc0) != 0x80)
return invalch;
return U_SPECIAL;
/* Shift data bits to ch */
ch = (ch << CONT_BITS) | (wchar_t) (b & LO_MASK_8(CONT_BITS));