Removed the unused and deprecated old <libmaxsi/sortix-keyboard.h> API.

This has been entirely replaced by stdin and <sys/termmode.h>.
This commit is contained in:
Jonas 'Sortie' Termansen 2012-02-10 01:13:30 +01:00
parent c4264d9c2a
commit 028867ab9d
11 changed files with 0 additions and 466 deletions

View File

@ -63,7 +63,6 @@ c/h/stdint.h \
COMMONOBJS=c++.o memory.o heap.o string.o error.o format.o
SORTIXOBJS:=$(addprefix sortix/,$(COMMONOBJS))
LIBMAXSIOBJS:=$(COMMONOBJS) \
sortix-keyboard.o \
sortix-sound.o \
process.o \
thread.o \
@ -88,12 +87,10 @@ thread.h \
process.h \
types.h \
format.h \
keyboard.h \
sortedlist.h \
signal.h \
signalnum.h \
sortix-vga.h \
sortix-keyboard.h \
sortix-sound.h \
OBJS:=$(LIBMAXSIOBJS)

View File

@ -1,70 +0,0 @@
/******************************************************************************
COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011.
This file is part of LibMaxsi.
LibMaxsi is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with LibMaxsi. If not, see <http://www.gnu.org/licenses/>.
keyboard.h
Provides constants for various useful keys related to keyboard input.
******************************************************************************/
#ifndef LIBMAXSI_KEYBOARD_H
#define LIBMAXSI_KEYBOARD_H
namespace Maxsi
{
namespace Keyboard
{
const uint32_t UNKNOWN = 0x40000000;
const uint32_t ESC = 0x40000000 + 1;
const uint32_t CTRL = 0x40000000 + 2;
const uint32_t LSHFT = 0x40000000 + 3;
const uint32_t RSHFT = 0x40000000 + 4;
const uint32_t ALT = 0x40000000 + 5;
const uint32_t F1 = 0x40000000 + 6;
const uint32_t F2 = 0x40000000 + 7;
const uint32_t F3 = 0x40000000 + 8;
const uint32_t F4 = 0x40000000 + 9;
const uint32_t F5 = 0x40000000 + 10;
const uint32_t F6 = 0x40000000 + 11;
const uint32_t F7 = 0x40000000 + 12;
const uint32_t F8 = 0x40000000 + 13;
const uint32_t F9 = 0x40000000 + 14;
const uint32_t F10 = 0x40000000 + 15;
const uint32_t F11 = 0x40000000 + 16;
const uint32_t F12 = 0x40000000 + 17;
const uint32_t SCRLCK = 0x40000000 + 18;
const uint32_t HOME = 0x40000000 + 19;
const uint32_t UP = 0x40000000 + 20;
const uint32_t LEFT = 0x40000000 + 21;
const uint32_t RIGHT = 0x40000000 + 22;
const uint32_t DOWN = 0x40000000 + 23;
const uint32_t PGUP = 0x40000000 + 24;
const uint32_t PGDOWN = 0x40000000 + 25;
const uint32_t END = 0x40000000 + 26;
const uint32_t INS = 0x40000000 + 27;
const uint32_t DEL = 0x40000000 + 28;
const uint32_t CAPS = 0x40000000 + 29;
const uint32_t NONE = 0x40000000 + 30;
const uint32_t ALTGR = 0x40000000 + 31;
const uint32_t NUMLCK = 0x40000000 + 32;
const uint32_t SIGINT = 0x40000000 + 33;
const uint32_t DEPRESSED = (1<<31);
}
}
#endif

View File

@ -1,47 +0,0 @@
/******************************************************************************
COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011.
This file is part of LibMaxsi.
LibMaxsi is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with LibMaxsi. If not, see <http://www.gnu.org/licenses/>.
sortix-keyboard.h
Provides access to the keyboard input meant for this process. This is highly
unportable and is very likely to be removed or changed radically.
******************************************************************************/
#ifndef LIBMAXSI_SORTIX_KEYBOARD_H
#define LIBMAXSI_SORTIX_KEYBOARD_H
#include <libmaxsi/platform.h>
#include <libmaxsi/keyboard.h>
namespace System
{
namespace Keyboard
{
// Receives the next pending 32-bit unicode character from the user's
// input device (truncated to 30-bits). Bit (1<<31) is set if the key
// was depressed. Bit (1<<30) is used for the various constants found
// in <libmaxsi/keyboard.h>. This is just a temporary API. Returns 0 if
// no character point was available at this time.
const unsigned WAIT = 0;
const unsigned POLL = 1;
uint32_t ReceiveKeystroke(unsigned method);
}
}
#endif

View File

@ -1,41 +0,0 @@
/******************************************************************************
COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011.
This file is part of LibMaxsi.
LibMaxsi is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with LibMaxsi. If not, see <http://www.gnu.org/licenses/>.
sortix-keyboard.cpp
Provides access to the keyboard input meant for this process. This is highly
unportable and is very likely to be removed or changed radically.
******************************************************************************/
#include "platform.h"
#include "syscall.h"
namespace System
{
namespace Keyboard
{
DEFN_SYSCALL1(uint32_t, SysReceiveKeystroke, SYSCALL_RECEIVE_KEYSTROKE, unsigned);
uint32_t ReceiveKeystroke(unsigned method)
{
return SysReceiveKeystroke(method);
}
}
}

View File

@ -69,7 +69,6 @@ log.o \
utf8.o \
panic.o \
keyboard.o \
kbapiadapter.o \
kb/ps2.o \
kb/layout/us.o \
scheduler.o \

View File

@ -150,95 +150,6 @@ namespace Sortix
atalist[ataid]->Refer();
}
// TODO: Remove this deprecated class!
class DevLogTTY : public DevTerminal
{
public:
typedef DevTerminal BaseClass;
public:
DevLogTTY();
virtual ~DevLogTTY();
public:
virtual ssize_t Read(byte* dest, size_t count);
virtual ssize_t Write(const byte* src, size_t count);
virtual bool IsReadable();
virtual bool IsWritable();
virtual bool SetMode(unsigned mode);
virtual bool SetWidth(unsigned width);
virtual bool SetHeight(unsigned height);
virtual unsigned GetMode() const;
virtual unsigned GetWidth() const;
virtual unsigned GetHeight() const;
};
DevLogTTY::DevLogTTY()
{
}
DevLogTTY::~DevLogTTY()
{
// TODO: Make an array of waiting threads on the keyboard..
}
ssize_t DevLogTTY::Read(byte* /*dest*/, size_t /*count*/)
{
// TODO: Read from keyboard.
return 0;
}
ssize_t DevLogTTY::Write(const byte* src, size_t count)
{
if ( SSIZE_MAX < count ) { count = SSIZE_MAX; }
return Log::deviceCallback(Log::devicePointer, (char*) src, count);
}
bool DevLogTTY::IsReadable()
{
return true;
}
bool DevLogTTY::IsWritable()
{
return true;
}
bool DevLogTTY::SetMode(unsigned mode)
{
if ( mode ) { Error::Set(ENOSYS); return false; }
return true;
}
bool DevLogTTY::SetWidth(unsigned width)
{
if ( width != GetWidth() ) { Error::Set(ENOTSUP); return false; }
return true;
}
bool DevLogTTY::SetHeight(unsigned height)
{
if ( height != GetHeight() ) { Error::Set(ENOTSUP); return false; }
return true;
}
unsigned DevLogTTY::GetMode() const
{
return 0;
}
unsigned DevLogTTY::GetWidth() const
{
return 25;
}
unsigned DevLogTTY::GetHeight() const
{
return 80;
}
class DevNull : public DevStream
{
public:

View File

@ -1,142 +0,0 @@
/******************************************************************************
COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2012.
This file is part of Sortix.
Sortix is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
Sortix is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along
with Sortix. If not, see <http://www.gnu.org/licenses/>.
kbapidapter.cpp
This class is a hack connecting the Keyboard and Keyboard layout classes
with the older and really bad Keyboard API. This class is intended to be
replaced by a real terminal driver working over /dev/tty descriptors.
******************************************************************************/
#include "platform.h"
#include <libmaxsi/keyboard.h>
#include "scheduler.h" // SIGINT
#include "keyboard.h"
#include "keycodes.h"
#include "kbapiadapter.h"
namespace Sortix
{
KBAPIAdapter::KBAPIAdapter(Keyboard* keyboard, KeyboardLayout* kblayout)
{
this->keyboard = keyboard;
this->kblayout = kblayout;
this->control = false;
this->queuelength = QUEUELENGTH;
this->queueused = 0;
this->queueoffset = 0;
keyboard->SetOwner(this, NULL);
}
KBAPIAdapter::~KBAPIAdapter()
{
delete keyboard;
delete kblayout;
}
void KBAPIAdapter::OnKeystroke(Keyboard* kb, void* /*user*/)
{
while ( kb->HasPending() )
{
ProcessKeystroke(kb->Read());
}
}
void KBAPIAdapter::ProcessKeystroke(int kbkey)
{
if ( !kbkey ) { return; }
int abskbkey = (kbkey < 0) ? -kbkey : kbkey;
uint32_t unicode = kblayout->Translate(kbkey);
// Now translate the keystroke into the older API's charset..
uint32_t maxsicode = (unicode) ? unicode : ToMaxsiCode(abskbkey);
if ( kbkey < 0 ) { maxsicode |= Maxsi::Keyboard::DEPRESSED; }
if ( kbkey == KBKEY_LCTRL ) { control = true; }
if ( kbkey == -KBKEY_LCTRL ) { control = false; }
if ( control && kbkey == KBKEY_C )
{
Scheduler::SigIntHack();
return;
}
if ( !QueueKeystroke(maxsicode) )
{
Log::PrintF("Warning: KBAPIAdapter driver dropping keystroke due "
"to insufficient buffer space\n");
}
}
uint32_t KBAPIAdapter::ToMaxsiCode(int abskbkey)
{
switch ( abskbkey )
{
case KBKEY_ESC: return Maxsi::Keyboard::ESC;
case KBKEY_LCTRL: return Maxsi::Keyboard::CTRL;
case KBKEY_LSHIFT: return Maxsi::Keyboard::LSHFT;
case KBKEY_RSHIFT: return Maxsi::Keyboard::RSHFT;
case KBKEY_LALT: return Maxsi::Keyboard::ALT;
case KBKEY_F1: return Maxsi::Keyboard::F1;
case KBKEY_F2: return Maxsi::Keyboard::F2;
case KBKEY_F3: return Maxsi::Keyboard::F3;
case KBKEY_F4: return Maxsi::Keyboard::F4;
case KBKEY_F5: return Maxsi::Keyboard::F5;
case KBKEY_F6: return Maxsi::Keyboard::F6;
case KBKEY_F7: return Maxsi::Keyboard::F7;
case KBKEY_F8: return Maxsi::Keyboard::F8;
case KBKEY_F9: return Maxsi::Keyboard::F9;
case KBKEY_F10: return Maxsi::Keyboard::F10;
case KBKEY_F11: return Maxsi::Keyboard::F11;
case KBKEY_F12: return Maxsi::Keyboard::F12;
case KBKEY_SCROLLLOCK: return Maxsi::Keyboard::SCRLCK;
case KBKEY_HOME: return Maxsi::Keyboard::HOME;
case KBKEY_UP: return Maxsi::Keyboard::UP;
case KBKEY_LEFT: return Maxsi::Keyboard::LEFT;
case KBKEY_RIGHT: return Maxsi::Keyboard::RIGHT;
case KBKEY_DOWN: return Maxsi::Keyboard::DOWN;
case KBKEY_PGUP: return Maxsi::Keyboard::PGUP;
case KBKEY_PGDOWN: return Maxsi::Keyboard::PGDOWN;
case KBKEY_END: return Maxsi::Keyboard::END;
case KBKEY_INSERT: return Maxsi::Keyboard::INS;
case KBKEY_DELETE: return Maxsi::Keyboard::DEL;
case KBKEY_CAPSLOCK: return Maxsi::Keyboard::CAPS;
case KBKEY_RALT: return Maxsi::Keyboard::ALTGR;
case KBKEY_NUMLOCK: return Maxsi::Keyboard::NUMLCK;
default: return Maxsi::Keyboard::UNKNOWN;
}
}
bool KBAPIAdapter::QueueKeystroke(uint32_t keystroke)
{
if ( queuelength <= queueused ) { return false; }
queue[(queueoffset + queueused++) % queuelength] = keystroke;
return true;
}
uint32_t KBAPIAdapter::DequeueKeystroke()
{
if ( !queueused ) { return 0; }
uint32_t codepoint = queue[queueoffset++];
queueoffset %= queuelength;
queueused--;
return codepoint;
}
}

View File

@ -1,63 +0,0 @@
/******************************************************************************
COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2012.
This file is part of Sortix.
Sortix is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
Sortix is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along
with Sortix. If not, see <http://www.gnu.org/licenses/>.
kbapidapter.h
This class is a hack connecting the Keyboard and Keyboard layout classes
with the older and really bad Keyboard API. This class is intended to be
replaced by a real terminal driver working over /dev/tty descriptors.
******************************************************************************/
#ifndef SORTIX_KBAPIADAPTER_H
#define SORTIX_KBAPIADAPTER_H
#include "keyboard.h"
namespace Sortix
{
class KBAPIAdapter : public KeyboardOwner
{
public:
KBAPIAdapter(Keyboard* keyboard, KeyboardLayout* kblayout);
virtual ~KBAPIAdapter();
virtual void OnKeystroke(Keyboard* keyboard, void* user);
public:
uint32_t DequeueKeystroke();
private:
void ProcessKeystroke(int kbkey);
bool QueueKeystroke(uint32_t keystroke);
static uint32_t ToMaxsiCode(int abskbkey);
private:
Keyboard* keyboard;
KeyboardLayout* kblayout;
bool control;
static const size_t QUEUELENGTH = 1024UL;
size_t queuelength;
size_t queueused;
size_t queueoffset;
uint32_t queue[QUEUELENGTH];
};
}
#endif

View File

@ -34,12 +34,6 @@ namespace Sortix
{
DevTerminal* tty;
uint32_t SysReceiveKeystroke()
{
// TODO: Deprecated, please remove this.
return 0;
}
void Keyboard::Init()
{
Keyboard* keyboard = new PS2Keyboard(0x60, Interrupt::IRQ1);
@ -50,8 +44,6 @@ namespace Sortix
tty = new LogTerminal(keyboard, kblayout);
if ( !tty ) { Panic("Could not allocate a simple terminal"); }
Syscall::Register(SYSCALL_RECEIVE_KEYSTROKE, (void*) SysReceiveKeystroke);
}
}

View File

@ -24,7 +24,6 @@
#include "platform.h"
#include <libmaxsi/string.h>
#include <libmaxsi/keyboard.h>
#include "log.h"
#include "vga.h"
#include "keyboard.h"

View File

@ -33,7 +33,6 @@
#define SYSCALL_CREATE_FRAME 5
#define SYSCALL_CHANGE_FRAME 6
#define SYSCALL_DELETE_FRAME 7
#define SYSCALL_RECEIVE_KEYSTROKE 8
#define SYSCALL_SET_FREQUENCY 9
#define SYSCALL_EXEC 10
#define SYSCALL_PRINT_PATH_FILES 11