Shell: CapsLock and Shift keys

git-svn-id: svn://kolibrios.org@2174 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Albom 2011-09-12 16:54:25 +00:00
parent 9f2f10d775
commit de6e26f7d9
7 changed files with 55 additions and 3 deletions

View File

@ -10,6 +10,7 @@
#include "system/kolibri.h" #include "system/kolibri.h"
#include "system/stdlib.h" #include "system/stdlib.h"
#include "system/string.h" #include "system/string.h"
#include "system/ctype.h"
#include "globals.h" #include "globals.h"
#include "prototypes.h" #include "prototypes.h"

View File

@ -6,7 +6,8 @@ gcc -c shell.c
gcc -c system/kolibri.c gcc -c system/kolibri.c
gcc -c system/stdlib.c gcc -c system/stdlib.c
gcc -c system/string.c gcc -c system/string.c
ld -nostdlib -T kolibri.ld -o shell start.o kolibri.o stdlib.o string.o shell.o gcc -c system/ctype.c
ld -nostdlib -T kolibri.ld -o shell start.o kolibri.o stdlib.o string.o ctype.o shell.o
objcopy shell -O binary objcopy shell -O binary
erase lang.h start.o shell.o kolibri.o stdlib.o string.o erase lang.h start.o shell.o kolibri.o stdlib.o string.o
kpack shell kpack shell

View File

@ -6,7 +6,8 @@ gcc -c shell.c
gcc -c system/kolibri.c gcc -c system/kolibri.c
gcc -c system/stdlib.c gcc -c system/stdlib.c
gcc -c system/string.c gcc -c system/string.c
ld -nostdlib -T kolibri.ld -o shell start.o kolibri.o stdlib.o string.o shell.o gcc -c system/ctype.c
ld -nostdlib -T kolibri.ld -o shell start.o kolibri.o stdlib.o string.o ctype.o shell.o
objcopy shell -O binary objcopy shell -O binary
erase lang.h start.o shell.o kolibri.o stdlib.o string.o erase lang.h start.o shell.o kolibri.o stdlib.o string.o
kpack shell kpack shell

View File

@ -1,5 +1,5 @@
#define SHELL_VERSION "0.4.8" #define SHELL_VERSION "0.4.9"
extern char PATH[256]; extern char PATH[256];
extern char PARAM[256]; extern char PARAM[256];

View File

@ -74,6 +74,13 @@ for (;;)
default: default:
if (CMD_POS < 255) if (CMD_POS < 255)
{ {
if ( kol_key_control() & 0x40 ) // åñëè âêëþ÷¸í CapsLock
if ( (kol_key_control() & 1) || (kol_key_control() & 2)) // åñëè íàæàòû øèôòû
key = tolower(key);
else
key = toupper(key);
CMD[CMD_POS] = key; CMD[CMD_POS] = key;
CMD_POS++; CMD_POS++;
printf("%c", key); printf("%c", key);

View File

@ -0,0 +1,39 @@
#include "ctype.h"
int toupper(int c)
{
if ( (c >= 97) && (c <= 122) )
return c-32 ;
if ( (c >= 160) && (c <= 175) )
return c-32 ;
if ( (c >= 224) && (c <= 239) )
return c-80 ;
if ( (c == 241) || (c == 243) || (c == 245) || (c == 247) )
return c-1;
return c;
}
int tolower(int c)
{
if ( (c >= 65) && (c <= 90) )
return c+32 ;
if ( (c >= 128) && (c <= 143) )
return c+32 ;
if ( (c >= 144) && (c <= 159) )
return c+80 ;
if ( (c == 240) || (c == 242) || (c == 244) || (c == 246) )
return c+1;
return c;
}

View File

@ -0,0 +1,3 @@
int toupper(int c);
int tolower(int c);