OBJ += threads.o mutex.o semaphore.o workqueue.o events.o rwlock.o
OBJ += drv/zero-one.o drv/proc.o drv/fifo.o drv/dgram_pipe.o drv/iocache.o drv/pci.o drv/vpci.o
OBJ += drv/vterm.o drv/vterm_font.o drv/vterm_vt100.o drv/vterm_output.o drv/vterm_input.o drv/vterm_termbuf.o
+OBJ += drv/vterm_2d.o
OBJ += drv/pty.o
OBJ += binary.o bin/elf.o bin/pe.o
OBJ += vfs/main.o vfs/open.o vfs/acls.o vfs/dir.o vfs/io.o vfs/mount.o
* drv/pty.c
* - Pseudo Terminals
*/
-#define DEBUG 1
+#define DEBUG 0
#include <acess.h>
#include <vfs.h>
#include <fs_devfs.h>
.Name = "pts",
.RootNode = {
.Flags = VFS_FFLAG_DIRECTORY,
- .Type = &gPTY_NodeType_Root
+ .Type = &gPTY_NodeType_Root,
+ .Size = -1
}
};
int giPTY_NumCount;
int PTY_ReadDir(tVFS_Node *Node, int Pos, char Name[FILENAME_MAX])
{
tPTY *pty = NULL;
- if( Pos < giPTY_NumCount * 2 )
+ int idx = Pos;
+ if( idx < giPTY_NumCount * 2 )
{
RWLock_AcquireRead(&glPTY_NumPTYs);
for( pty = gpPTY_FirstNumPTY; pty; pty = pty->Next )
{
- if( Pos < 2 )
+ if( idx < 2 )
break;
- Pos -= 2;
+ idx -= 2;
}
RWLock_Release(&glPTY_NumPTYs);
}
- else if( Pos < (giPTY_NumCount + giPTY_NamedCount) * 2 )
+ else if( idx < (giPTY_NumCount + giPTY_NamedCount) * 2 )
{
+ idx -= giPTY_NumCount*2;
RWLock_AcquireRead(&glPTY_NamedPTYs);
for( pty = gpPTY_FirstNamedPTY; pty; pty = pty->Next )
{
- if( Pos < 2 )
+ if( idx < 2 )
break;
- Pos -= 2;
+ idx -= 2;
}
RWLock_Release(&glPTY_NamedPTYs);
}
- if( !pty )
+ if( !pty ) {
+ LOG("%i out of range", Pos);
return -1;
+ }
if( pty->Name[0] )
- snprintf(Name, FILENAME_MAX, "%s%c", pty->Name, (Pos == 0 ? 'c' : 's'));
+ snprintf(Name, FILENAME_MAX, "%s%c", pty->Name, (idx == 0 ? 'c' : 's'));
else
- snprintf(Name, FILENAME_MAX, "%i%c", pty->NumericName, (Pos == 0 ? 'c' : 's'));
+ snprintf(Name, FILENAME_MAX, "%i%c", pty->NumericName, (idx == 0 ? 'c' : 's'));
+ LOG("Return '%s'", Name);
return 0;
}
break;
case PTYBUFFMT_2DCMD:
// TODO: Impliment 2D commands
+ VT_int_Handle2DCmd(term, Length, Data);
break;
case PTYBUFFMT_3DCMD:
// TODO: Impliment 3D commands
tVTerm *term = Handle;
term->Mode = (Mode->OutputMode & PTYOMODE_BUFFMT);
+ memset(&term->Cmd2D, 0, sizeof(term->Cmd2D));
+
if( term == gpVT_CurTerm ) {
switch(term->Mode)
{
// Call set again, it's freed, and if NULL it doesn't get reallocated.
tVideo_IOCtl_Bitmap *VideoCursor;
+ struct {
+ int Current;
+ size_t CurrentSize;
+ size_t Offset;
+ int CachePos;
+ char Cache[32];
+ size_t PreEat;
+ } Cmd2D;
+
tPTY *PTY;
};
// === FUNCTIONS ===
extern void VT_SetResolution(int Width, int Height);
extern void VT_SetTerminal(int ID);
+extern void VT_int_Handle2DCmd(void *Handle, size_t Length, const void *Data);
// --- Output ---
extern void VT_InitOutput(void);
extern void VT_SetMode(int Mode);