The Pedigree Project 0.1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
TextIO Class Reference

#include <TextIO.h>

+ Inheritance diagram for TextIO:
+ Collaboration diagram for TextIO:

Classes

struct  VgaCell
 

Public Types

enum  InputMode { Standard , Raw }
 
- Public Types inherited from File
enum  AttributeMask : uint32_t {
  AccessTime = 1U << 0 , ModifyTime = 1U << 1 , ChangeTime = 1U << 2 , Owner = 1U << 3 ,
  Group = 1U << 4 , Permissions = 1U << 5
}
 

Public Member Functions

 TextIO (String str, size_t inode, Filesystem *pParentFS, File *pParent)
 
bool initialise (bool bClear=true)
 
void writeStr (const char *s, size_t len)
 
virtual uint64_t readBytewise (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
 
virtual uint64_t writeBytewise (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
 
virtual int select (bool bWriting=false, int timeout=0)
 
virtual bool isSeekable () const
 
virtual void flipThread ()
 
void handleInput (InputManager::InputNotification &in)
 
void markPrimary ()
 
void unmarkPrimary ()
 
bool isPrimary () const
 
void setMode (InputMode mode)
 
InputMode getMode () const
 
- Public Member Functions inherited from File
 File ()
 
 File (const String &name, Time::Timestamp accessedTime, Time::Timestamp modifiedTime, Time::Timestamp creationTime, uintptr_t inode, class Filesystem *pFs, size_t size, File *pParent)
 
virtual ~File ()
 
virtual uint64_t read (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) final
 
size_t readCached (uint64_t location, size_t size, uintptr_t buffer, bool(*prepare)(uintptr_t, size_t)=nullptr)
 
virtual uint64_t write (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) final
 
uint64_t append (uint64_t size, uintptr_t buffer, uint64_t &location, bool bCanBlock=true)
 
WriteGuard lockWrites ()
 
virtual physical_uintptr_t getPhysicalPage (size_t offset)
 
virtual bool isDirectPhysicalMapping () const
 
size_t physicalMappingFlags () const
 
virtual void returnPhysicalPage (size_t offset)
 
virtual bool tryBeginMappingRelease ()
 
void endMappingRelease ()
 
bool syncAndReturnPhysicalPage (size_t offset, bool async)
 
virtual bool sync ()
 
bool syncRange (size_t offset, size_t length)
 
virtual bool sync (size_t offset, bool async)
 
virtual bool syncPages (const uint64_t *offsets, size_t count)
 
Time::Timestamp getCreationTime ()
 
void setCreationTime (Time::Timestamp t)
 
Time::Timestamp getAccessedTime ()
 
void setAccessedTime (Time::Timestamp t)
 
Time::Timestamp getModifiedTime ()
 
void setModifiedTime (Time::Timestamp t)
 
void setTimes (Time::Timestamp accessed, Time::Timestamp modified, bool changeAccessed, bool changeModified)
 
virtual Attributes getAttributes () const
 
virtual XattrStatus getExtendedAttribute (const StringView &name, void *buffer, size_t capacity, size_t &required)
 
virtual XattrStatus listExtendedAttributes (void *buffer, size_t capacity, size_t &required)
 
virtual XattrStatus setExtendedAttribute (const StringView &name, const void *value, size_t length, unsigned flags)
 
virtual XattrStatus removeExtendedAttribute (const StringView &name)
 
virtual bool prepareSharedMapping (size_t offset, size_t length)
 
String getName () const
 
void getName (String &s) const
 
virtual void getFullPath (String &result, bool bWithMount=true)
 
virtual String getFullPath (bool bWithMount=true)
 
virtual void truncate ()
 
bool resize (size_t size)
 
virtual size_t getSize ()
 
void setSize (size_t sz)
 
virtual bool isSymlink ()
 
virtual bool isDirectory ()
 
virtual bool isBlockDevice () const
 
virtual uint64_t deviceNumber () const
 
virtual bool isPipe () const
 
virtual bool isFifo () const
 
virtual bool isSocket () const
 
bool supportsRegularFileOperations ()
 
virtual bool isCharacterDevice () const
 
virtual bool isConsole () const
 
virtual uint64_t maximumFileSize () const
 
virtual bool allowMapping (bool shared, bool writeRequested, bool &mayWrite)
 
bool acquireMappingUse (bool executable, bool sharedWrite)
 
void releaseMappingUse (bool executable, bool sharedWrite)
 
uintptr_t getInode () const
 
virtual void setInode (uintptr_t inode)
 
virtual uintptr_t futexIdentity ()
 
Filesystem * getFilesystem () const
 
void setFilesystem (Filesystem *pFs)
 
virtual void fileAttributeChanged ()
 
void publishEvent (FileEventMask mask, const StringView &name=StringView(), bool targetIsDirectory=false)
 
virtual FileHandleStatus subscribeInodeEvents (FileEventMask mask, const SharedPointer< FileEventObserver > &observer, FileEventSubscription &subscription)
 
virtual void finishInodeRetirement ()
 
virtual void increaseRefCount (bool bIsWriter)
 
virtual void decreaseRefCount (bool bIsWriter)
 
virtual bool retainVfsReference ()
 
virtual void releaseVfsReference ()
 
virtual bool isStableVfsRoot () const
 
void setPermissions (uint32_t perms)
 
uint32_t getPermissions () const
 
bool setOwnership (size_t uid, size_t gid, bool changeUid, bool changeGid)
 
void setUid (size_t uid)
 
size_t getUid () const
 
void setGid (size_t gid)
 
size_t getGid () const
 
File * getParent () const
 
void getNamespace (ParentLease &parent, String &name) const
 
virtual ReadyMask queryReady (bool reading, bool writing)
 
virtual bool supportsReadinessNotifications () const
 
void monitor (Thread *pThread, Event *pEvent)
 
void cullMonitorTargets (Thread *pThread)
 
void cullMonitorTargets (Event *pEvent)
 
virtual bool supports (const size_t command) const
 
virtual int command (const size_t command, void *buffer)
 
virtual size_t getBlockSize () const
 
void markPageExternallyWritable (size_t offset)
 
size_t populateRange (size_t offset, size_t length)
 
void enableDirect ()
 
void disableDirect ()
 
virtual void preallocate (size_t expectedSize, bool zero=true)
 
bool allocateRange (size_t offset, size_t length, bool keepSize=false)
 
virtual File * open ()
 
virtual File * openForDescriptor (RetainedFile &owner)
 
- Public Member Functions inherited from ReadinessSource
MUST_USE_RESULT bool subscribeReadiness (ReadyMask interest, const SharedPointer< ReadinessObserver > &observer, ReadinessSubscription &subscription)
 
virtual ReadinessGenerations readinessGenerations ()
 
- Public Member Functions inherited from FileEventSource
MUST_USE_RESULT bool subscribeFileEvents (FileEventMask interest, const SharedPointer< FileEventObserver > &observer, FileEventSubscription &subscription)
 

Static Public Member Functions

static void inputCallback (InputManager::InputNotification &in)
 

Private Types

enum  VgaColour {
  Black = 0 , Blue = 1 , Green = 2 , Cyan = 3 ,
  Red = 4 , Magenta = 5 , Orange = 6 , LightGrey = 7 ,
  DarkGrey = 8 , LightBlue = 9 , LightGreen = 10 , LightCyan = 11 ,
  LightRed = 12 , LightMagenta = 13 , Yellow = 14 , White = 15
}
 
enum  TerminalModes {
  LineFeedNewLine = 0x1 , CursorKey = 0x2 , AnsiVt52 = 0x4 , Column = 0x8 ,
  Scrolling = 0x10 , Screen = 0x20 , Origin = 0x40 , AutoWrap = 0x80 ,
  AutoRepeat = 0x100 , Interlace = 0x200 , Inverse = 0x100000 , Bright = 0x200000 ,
  Blink = 0x400000 , CharacterSetG0 = 0x1000000 , CharacterSetG1 = 0x2000000
}
 

Private Member Functions

VgaColour adjustColour (int colour, bool up)
 
virtual bool isBytewise () const
 
void setColour (VgaColour *which, size_t param, bool bBright=false)
 
void doBackspace ()
 
void doLinefeed ()
 
void doCarriageReturn ()
 
void doHorizontalTab ()
 
void checkScroll ()
 
void checkWrap ()
 
void eraseSOS ()
 
void eraseEOS ()
 
void eraseEOL ()
 
void eraseSOL ()
 
void eraseLine ()
 
void eraseScreen (uint8_t character)
 
void goHome (ssize_t xmove=0, ssize_t ymove=0)
 
void clearBackbuffer ()
 
void flip (bool timer=false, bool hideState=false)
 
void initialiseVterm ()
 
void destroyVterm ()
 
void syncVtermRect (VTermRect rect)
 
void syncVtermCell (VTermPos pos)
 
void markVtermRect (VTermRect rect)
 
void markVtermCell (VTermPos pos)
 
void storeVtermScrollback (const VTermScreenCell *cells, int cols)
 
int popVtermScrollback (VTermScreenCell *cells, int cols)
 
VgaColour vtermColour (VTermColor colour, bool foreground) const
 
uint8_t translate (uint32_t codepoint)
 
void copyVtermCell (const VTermScreenCell &source, VgaCell &destination)
 

Static Private Member Functions

static void vtermOutput (const char *bytes, size_t length, void *user)
 
static int vtermDamage (VTermRect rect, void *user)
 
static int vtermMoveRect (VTermRect dest, VTermRect src, void *user)
 
static int vtermMoveCursor (VTermPos pos, VTermPos oldPos, int visible, void *user)
 
static int vtermSetTermProp (VTermProp prop, VTermValue *value, void *user)
 
static int vtermBell (void *user)
 
static int vtermResize (int rows, int cols, void *user)
 
static int vtermScrollbackPush (int cols, const VTermScreenCell *cells, void *user)
 
static int vtermScrollbackPop (int cols, VTermScreenCell *cells, void *user)
 
static int vtermScrollbackClear (void *user)
 

Private Attributes

Atomic< bool > m_bInitialised
 
bool m_bControlSeq
 
bool m_bBracket
 
bool m_bParenthesis
 
bool m_bParams
 
bool m_bQuestionMark
 
ssize_t m_CursorX
 
ssize_t m_CursorY
 
ssize_t m_SavedCursorX
 
ssize_t m_SavedCursorY
 
ssize_t m_ScrollStart
 
ssize_t m_ScrollEnd
 
ssize_t m_LeftMargin
 
ssize_t m_RightMargin
 
size_t m_CurrentParam
 
size_t m_Params [MAX_TEXTIO_PARAMS]
 
int m_CurrentModes
 
VgaColour m_Fore
 
VgaColour m_Back
 
MemoryRegion m_Backbuffer
 
uint16_t * m_pFramebuffer
 
VgaCell * m_pBackbuffer
 
Vga * m_pVga
 
VTerm * m_pVterm
 
VTermScreen * m_pVtermScreen
 
VTermState * m_pVtermState
 
uint8_t m_VtermDirty [BACKBUFFER_STRIDE *BACKBUFFER_ROWS]
 
VgaCell m_VtermScrollback [VTERM_SCROLLBACK_LINES][BACKBUFFER_STRIDE]
 
size_t m_VtermScrollbackLines
 
char m_TabStops [BACKBUFFER_STRIDE]
 
Buffer< char > m_OutBuffer
 
uint8_t m_G0
 
uint8_t m_G1
 
uint64_t m_NextInterval
 
bool m_bUtf8
 
uint32_t m_nCharacter
 
size_t m_nUtf8Handled
 
bool m_bActive
 
Mutex m_Lock
 
Semaphore m_FlipWake
 
OwnedThread m_FlipThread
 
bool m_bOwnsConsole
 
InputMode m_InputMode
 

Static Private Attributes

static const int COLOUR_BRIGHT_ADDEND = 8
 
static const ssize_t BACKBUFFER_COLS_WIDE = 132
 
static const ssize_t BACKBUFFER_COLS_NORMAL = 80
 
static const ssize_t BACKBUFFER_ROWS = 25
 
static const ssize_t BACKBUFFER_STRIDE = BACKBUFFER_COLS_WIDE
 
static const size_t VTERM_SCROLLBACK_LINES = 64
 

Additional Inherited Members

- Static Public Attributes inherited from File
static constexpr size_t MaxReadPages = 32
 
- Protected Member Functions inherited from File
bool tryAcquireFilesystemOperation (OperationBarrier::Lease &operation) const
 
virtual void updateAttributes (const Attributes &attributes, uint32_t mask)
 
virtual bool changeOwnership (size_t uid, size_t gid, bool changeUid, bool changeGid)
 
virtual bool allowPhysicalPage () const
 
virtual bool prepareWrite (uint64_t location, uint64_t size)
 
virtual bool allowResize (size_t oldSize, size_t newSize)
 
virtual bool prepareShrink (const ShrinkContext &context, UniquePointer< PreparedShrink > &prepared)
 
virtual bool resizeFile (size_t size)
 
virtual bool allocateFileRange (size_t offset, size_t length)
 
virtual Mutex & writeSerializationLock ()
 
virtual Mutex & dataMutationLock ()
 
virtual size_t & physicalPageLoans ()
 
bool clearDataCache ()
 
virtual uintptr_t readBlock (uint64_t location)
 
virtual bool readPage (uint64_t location, uintptr_t destination)
 
virtual bool readPages (ReadPage *pages, size_t count)
 
virtual void writeBlock (uint64_t location, uintptr_t addr)
 
virtual void writeBlocks (uint64_t location, uintptr_t addr, size_t length)
 
virtual void extend (size_t newSize)
 
virtual void extend (size_t newSize, uint64_t location, uint64_t size)
 
virtual void publishInodeEvent (const FileEvent &event)
 
void dataChanged ()
 
void getFilesystemLabel (HugeStaticString &s)
 
void enableFillCacheWriteback ()
 
void shutdownFillCacheWriteback ()
 
bool syncFillCache (size_t offset, bool async, bool &present)
 
virtual bool useFillCache () const
 
virtual MUST_USE_RESULT bool pinBlock (uint64_t location)
 
virtual MUST_USE_RESULT uintptr_t acquireCachedBlock (uint64_t location, bool retryChanged)
 
virtual void unpinBlock (uint64_t location)
 
void evict (uint64_t location)
 
void setPermissionsOnly (uint32_t perms)
 
void setUidOnly (size_t uid)
 
void setGidOnly (size_t gid)
 
void retainDetachedParent ()
 
void moveNamespace (const String &name, File *parent)
 
bool snapshotNamespace (ParentLease &parent, String &name, FileEventMask interest) const
 
virtual CacheState & cacheState ()
 
void setPhysicalMappingFlags (size_t flags)
 
- Protected Member Functions inherited from ReadinessSource
void notifyReadiness (ReadyMask mask)
 
void closeReadiness (ReadyMask mask=ReadyInvalid|ReadyHangup)
 
- Protected Member Functions inherited from FileEventSource
bool hasFileEventObservers (FileEventMask mask) const
 
void notifyFileEvent (const FileEvent &event)
 
void notifyFinalFileEvent (const FileEvent &event)
 
void beginFinalFileEvent (const FileEvent &event)
 
void drainFileEvents ()
 
void closeFileEvents ()
 
- Static Protected Member Functions inherited from File
static bool writeCallback (CacheConstants::CallbackCause cause, uintptr_t loc, uintptr_t page, void *meta)
 
static bool fillCacheCallback (CacheConstants::CallbackCause cause, uintptr_t loc, uintptr_t page, void *meta)
 
- Static Protected Member Functions inherited from FileEventSource
static bool anyFileEventObservers ()
 
- Protected Attributes inherited from File
String m_Name
 
Time::Timestamp m_AccessedTime
 
Time::Timestamp m_ModifiedTime
 
Time::Timestamp m_CreationTime
 
uintptr_t m_Inode
 
uintptr_t m_FutexIdentity = 0
 
class Filesystem * m_pFilesystem
 
size_t m_Size
 
File * m_pParent
 
Mutex m_MetadataLock
 
File * m_pDetachedParent
 
bool m_bDetachedParentHandled
 
size_t m_nWriters
 
size_t m_nReaders
 
size_t m_Uid
 
size_t m_Gid
 
uint32_t m_Permissions
 
CacheState m_CacheState
 
bool m_bDirect
 
Mutex m_WriteLock
 
Mutex m_DataMutationLock
 
size_t m_PhysicalPageLoans = 0
 
size_t m_PhysicalMappingFlags = 0
 
Mutex m_Lock
 
List< MonitorTarget * > m_MonitorTargets
 

Detailed Description

Provides terminal emulation to the Vga class, if one exists. The parser is shared with the userspace terminal widget through libvterm.

Definition at line 53 of file TextIO.h.

Member Enumeration Documentation

◆ InputMode

enum TextIO::InputMode

Definition at line 110 of file TextIO.h.

◆ TerminalModes

enum TextIO::TerminalModes
private
Enumerator
Inverse 

AKA: 'Negative'.

Bright 

AKA: 'Bold'.

Definition at line 84 of file TextIO.h.

◆ VgaColour

enum TextIO::VgaColour
private

Definition at line 57 of file TextIO.h.

Constructor & Destructor Documentation

◆ TextIO()

TextIO::TextIO ( String  str,
size_t  inode,
Filesystem *  pParentFS,
File *  pParent 
)

Definition at line 55 of file TextIO.cc.

◆ ~TextIO()

TextIO::~TextIO ( )
virtual

Definition at line 121 of file TextIO.cc.

Member Function Documentation

◆ adjustColour()

VgaColour TextIO::adjustColour ( int  colour,
bool  up 
)
inlineprivate

Definition at line 76 of file TextIO.h.

◆ checkScroll()

void TextIO::checkScroll ( )
private

Definition at line 1554 of file TextIO.cc.

◆ checkWrap()

void TextIO::checkWrap ( )
private

Definition at line 1620 of file TextIO.cc.

◆ clearBackbuffer()

void TextIO::clearBackbuffer ( )
private

Clear backbuffer.

Definition at line 1733 of file TextIO.cc.

Referenced by initialise().

+ Here is the caller graph for this function:

◆ copyVtermCell()

void TextIO::copyVtermCell ( const VTermScreenCell &  source,
VgaCell &  destination 
)
private

Definition at line 341 of file TextIO.cc.

◆ destroyVterm()

void TextIO::destroyVterm ( )
private

Definition at line 254 of file TextIO.cc.

◆ doBackspace()

void TextIO::doBackspace ( )
private

Definition at line 1515 of file TextIO.cc.

◆ doCarriageReturn()

void TextIO::doCarriageReturn ( )
private

Definition at line 1531 of file TextIO.cc.

◆ doHorizontalTab()

void TextIO::doHorizontalTab ( )
private

Definition at line 1535 of file TextIO.cc.

◆ doLinefeed()

void TextIO::doLinefeed ( )
private

Definition at line 1526 of file TextIO.cc.

◆ eraseEOL()

void TextIO::eraseEOL ( )
private

Definition at line 1671 of file TextIO.cc.

◆ eraseEOS()

void TextIO::eraseEOS ( )
private

Definition at line 1653 of file TextIO.cc.

◆ eraseLine()

void TextIO::eraseLine ( )
private

Definition at line 1696 of file TextIO.cc.

◆ eraseScreen()

void TextIO::eraseScreen ( uint8_t  character)
private

Definition at line 1708 of file TextIO.cc.

◆ eraseSOL()

void TextIO::eraseSOL ( )
private

Definition at line 1684 of file TextIO.cc.

◆ eraseSOS()

void TextIO::eraseSOS ( )
private

Definition at line 1635 of file TextIO.cc.

◆ flip()

void TextIO::flip ( bool  timer = false,
bool  hideState = false 
)
private

Present backbuffer to the VGA instance.

Definition at line 1737 of file TextIO.cc.

References Bright, Vga::getNumCols(), Vga::getNumRows(), TextIO::VgaCell::hidden, Inverse, isPrimary(), m_bActive, and m_Lock.

Referenced by markPrimary(), and writeStr().

+ Here is the caller graph for this function:

◆ flipThread()

void TextIO::flipThread ( )
virtual

Definition at line 1836 of file TextIO.cc.

◆ getMode()

TextIO::InputMode TextIO::getMode ( ) const

Get the current input mode of the terminal.

Definition at line 2267 of file TextIO.cc.

◆ goHome()

void TextIO::goHome ( ssize_t  xmove = 0,
ssize_t  ymove = 0 
)
private

Definition at line 1722 of file TextIO.cc.

◆ handleInput()

void TextIO::handleInput ( InputManager::InputNotification &  in)

Definition at line 2137 of file TextIO.cc.

◆ initialise()

bool TextIO::initialise ( bool  bClear = true)

Initialise and prepare for rendering. Clears the screen as a side-effect, unless false is passed in for bClear.

Returns
True if we can now write, false otherwise.

Definition at line 139 of file TextIO.cc.

References clearBackbuffer(), Vga::getNumCols(), Vga::getNumRows(), Machine::getVga(), Scheduler::instance(), isPrimary(), OwnedThread::join(), m_bActive, m_FlipWake, m_G0, m_Lock, m_NextInterval, Semaphore::release(), Vga::setLargestTextMode(), and Semaphore::tryAcquire().

Referenced by VirtualTerminalManager::openInactive(), and writeStr().

+ Here is the caller graph for this function:

◆ initialiseVterm()

void TextIO::initialiseVterm ( )
private

Definition at line 217 of file TextIO.cc.

◆ inputCallback()

void TextIO::inputCallback ( InputManager::InputNotification &  in)
static

Definition at line 2128 of file TextIO.cc.

◆ isBytewise()

virtual bool TextIO::isBytewise ( ) const
inlineprivatevirtual

File subclasses can define this and return true if they require read() calls to perform actual data reads, and false if readBlock() is otherwise sufficient.

Reimplemented from File.

Definition at line 185 of file TextIO.h.

◆ isPrimary()

bool TextIO::isPrimary ( ) const

Determine whether this console is primary or not.

Definition at line 2259 of file TextIO.cc.

References m_bOwnsConsole.

Referenced by flip(), initialise(), and writeStr().

+ Here is the caller graph for this function:

◆ isSeekable()

virtual bool TextIO::isSeekable ( ) const
inlinevirtual

Whether ordinary reads and writes consume a persistent byte offset.

Reimplemented from File.

Definition at line 142 of file TextIO.h.

◆ markPrimary()

void TextIO::markPrimary ( )

Mark this console as the "primary", which means it will receive keyboard input and actively flip to the screen.

Definition at line 2240 of file TextIO.cc.

References flip(), m_bOwnsConsole, m_Lock, and Vga::moveCursor().

◆ markVtermCell()

void TextIO::markVtermCell ( VTermPos  pos)
private

Definition at line 307 of file TextIO.cc.

◆ markVtermRect()

void TextIO::markVtermRect ( VTermRect  rect)
private

Definition at line 292 of file TextIO.cc.

◆ popVtermScrollback()

int TextIO::popVtermScrollback ( VTermScreenCell *  cells,
int  cols 
)
private

Definition at line 374 of file TextIO.cc.

◆ readBytewise()

uint64_t TextIO::readBytewise ( uint64_t  location,
uint64_t  size,
uintptr_t  buffer,
bool  bCanBlock = true 
)
virtual

VFS File interface.

Reimplemented from File.

Definition at line 1819 of file TextIO.cc.

References m_OutBuffer, and Buffer< T, allowShortOperation >::read().

◆ select()

int TextIO::select ( bool  bWriting = false,
int  timeout = 0 
)
virtual

Similar to POSIX's select() function

Returns
1 if ready for reading/writing, 0 otherwise
Note
Default implementation says always ready to read/write so be sure to override if that's not right

Reimplemented from File.

Definition at line 1828 of file TextIO.cc.

References Buffer< T, allowShortOperation >::canRead(), Buffer< T, allowShortOperation >::canWrite(), and m_OutBuffer.

◆ setColour()

void TextIO::setColour ( TextIO::VgaColour *  which,
size_t  param,
bool  bBright = false 
)
private

Definition at line 1484 of file TextIO.cc.

◆ setMode()

void TextIO::setMode ( InputMode  mode)

Set the input mode of the terminal.

Definition at line 2263 of file TextIO.cc.

◆ storeVtermScrollback()

void TextIO::storeVtermScrollback ( const VTermScreenCell *  cells,
int  cols 
)
private

Definition at line 355 of file TextIO.cc.

◆ syncVtermCell()

void TextIO::syncVtermCell ( VTermPos  pos)
private

Definition at line 288 of file TextIO.cc.

◆ syncVtermRect()

void TextIO::syncVtermRect ( VTermRect  rect)
private

Definition at line 263 of file TextIO.cc.

◆ translate()

uint8_t TextIO::translate ( uint32_t  codepoint)
private

Translate given UTF32 codepoint to an ASCII character for display.

Definition at line 1855 of file TextIO.cc.

Referenced by writeStr().

+ Here is the caller graph for this function:

◆ unmarkPrimary()

void TextIO::unmarkPrimary ( )

Unmark this console as the primary, ceasing its screen updates and ceasing its reception of keyboard input.

Definition at line 2254 of file TextIO.cc.

References m_bOwnsConsole, and m_Lock.

◆ vtermBell()

int TextIO::vtermBell ( void *  user)
staticprivate

Definition at line 466 of file TextIO.cc.

◆ vtermColour()

TextIO::VgaColour TextIO::vtermColour ( VTermColor  colour,
bool  foreground 
) const
private

Definition at line 312 of file TextIO.cc.

◆ vtermDamage()

int TextIO::vtermDamage ( VTermRect  rect,
void *  user 
)
staticprivate

Definition at line 407 of file TextIO.cc.

◆ vtermMoveCursor()

int TextIO::vtermMoveCursor ( VTermPos  pos,
VTermPos  oldPos,
int  visible,
void *  user 
)
staticprivate

Definition at line 446 of file TextIO.cc.

◆ vtermMoveRect()

int TextIO::vtermMoveRect ( VTermRect  dest,
VTermRect  src,
void *  user 
)
staticprivate

Definition at line 413 of file TextIO.cc.

◆ vtermOutput()

void TextIO::vtermOutput ( const char *  bytes,
size_t  length,
void *  user 
)
staticprivate

Definition at line 401 of file TextIO.cc.

◆ vtermResize()

int TextIO::vtermResize ( int  rows,
int  cols,
void *  user 
)
staticprivate

Definition at line 470 of file TextIO.cc.

◆ vtermScrollbackClear()

int TextIO::vtermScrollbackClear ( void *  user)
staticprivate

Definition at line 487 of file TextIO.cc.

◆ vtermScrollbackPop()

int TextIO::vtermScrollbackPop ( int  cols,
VTermScreenCell *  cells,
void *  user 
)
staticprivate

Definition at line 483 of file TextIO.cc.

◆ vtermScrollbackPush()

int TextIO::vtermScrollbackPush ( int  cols,
const VTermScreenCell *  cells,
void *  user 
)
staticprivate

Definition at line 478 of file TextIO.cc.

◆ vtermSetTermProp()

int TextIO::vtermSetTermProp ( VTermProp  prop,
VTermValue *  value,
void *  user 
)
staticprivate

Definition at line 457 of file TextIO.cc.

◆ writeBytewise()

uint64_t TextIO::writeBytewise ( uint64_t  location,
uint64_t  size,
uintptr_t  buffer,
bool  bCanBlock = true 
)
virtual

Writes bytes to the file, if isBytewise() == true.

Reimplemented from File.

Definition at line 1823 of file TextIO.cc.

References writeStr().

◆ writeStr()

void TextIO::writeStr ( const char *  s,
size_t  len 
)

Write bytes to the screen, handling terminal control sequences embedded in the string along the way.

Parameters
strThe string to write.
Todo:
Should we handle this?
Todo:
hook in to Keyboard::setLedState!
Todo:
Sanity check.
Todo:
Error out if is Utf8
Todo:
implement me!
Todo:
implement me!

Definition at line 492 of file TextIO.cc.

References Bright, Buffer< T, allowShortOperation >::canRead(), File::dataChanged(), Dec, flip(), Hex, initialise(), Inverse, isPrimary(), m_bActive, m_bUtf8, m_G0, m_Lock, m_nCharacter, m_nUtf8Handled, m_OutBuffer, Vga::moveCursor(), translate(), and Buffer< T, allowShortOperation >::write().

Referenced by VirtualTerminalManager::openInactive(), and writeBytewise().

+ Here is the caller graph for this function:

Member Data Documentation

◆ BACKBUFFER_COLS_NORMAL

const ssize_t TextIO::BACKBUFFER_COLS_NORMAL = 80
staticprivate

Definition at line 180 of file TextIO.h.

◆ BACKBUFFER_COLS_WIDE

const ssize_t TextIO::BACKBUFFER_COLS_WIDE = 132
staticprivate

Definition at line 179 of file TextIO.h.

◆ BACKBUFFER_ROWS

const ssize_t TextIO::BACKBUFFER_ROWS = 25
staticprivate

Definition at line 181 of file TextIO.h.

◆ BACKBUFFER_STRIDE

const ssize_t TextIO::BACKBUFFER_STRIDE = BACKBUFFER_COLS_WIDE
staticprivate

Definition at line 183 of file TextIO.h.

◆ COLOUR_BRIGHT_ADDEND

const int TextIO::COLOUR_BRIGHT_ADDEND = 8
staticprivate

Definition at line 55 of file TextIO.h.

◆ m_Back

VgaColour TextIO::m_Back
private

Definition at line 269 of file TextIO.h.

◆ m_Backbuffer

MemoryRegion TextIO::m_Backbuffer
private

Definition at line 271 of file TextIO.h.

◆ m_bActive

bool TextIO::m_bActive
private

Are we currently active? We only become active once data is first written.

Definition at line 314 of file TextIO.h.

Referenced by flip(), initialise(), and writeStr().

◆ m_bBracket

bool TextIO::m_bBracket
private

Definition at line 257 of file TextIO.h.

◆ m_bControlSeq

bool TextIO::m_bControlSeq
private

Definition at line 256 of file TextIO.h.

◆ m_bInitialised

Atomic<bool> TextIO::m_bInitialised
private

Definition at line 255 of file TextIO.h.

◆ m_bOwnsConsole

bool TextIO::m_bOwnsConsole
private

Does this terminal own the output to the Vga instance?

Definition at line 332 of file TextIO.h.

Referenced by isPrimary(), markPrimary(), and unmarkPrimary().

◆ m_bParams

bool TextIO::m_bParams
private

Definition at line 259 of file TextIO.h.

◆ m_bParenthesis

bool TextIO::m_bParenthesis
private

Definition at line 258 of file TextIO.h.

◆ m_bQuestionMark

bool TextIO::m_bQuestionMark
private

Definition at line 260 of file TextIO.h.

◆ m_bUtf8

bool TextIO::m_bUtf8
private

Are we dealing with a UTF-8 codepoint currently?

Definition at line 302 of file TextIO.h.

Referenced by writeStr().

◆ m_CurrentModes

int TextIO::m_CurrentModes
private

Definition at line 267 of file TextIO.h.

◆ m_CurrentParam

size_t TextIO::m_CurrentParam
private

Definition at line 265 of file TextIO.h.

◆ m_CursorX

ssize_t TextIO::m_CursorX
private

Definition at line 261 of file TextIO.h.

◆ m_CursorY

ssize_t TextIO::m_CursorY
private

Definition at line 261 of file TextIO.h.

◆ m_FlipThread

OwnedThread TextIO::m_FlipThread
private

Definition at line 327 of file TextIO.h.

◆ m_FlipWake

Semaphore TextIO::m_FlipWake
private

Running flip thread for things like the cursor blinking.

Definition at line 326 of file TextIO.h.

Referenced by initialise().

◆ m_Fore

VgaColour TextIO::m_Fore
private

Definition at line 269 of file TextIO.h.

◆ m_G0

uint8_t TextIO::m_G0
private

Designated character sets - simply store the character which is used to designate a character set (eg, '1', 'A').

Definition at line 296 of file TextIO.h.

Referenced by initialise(), and writeStr().

◆ m_G1

uint8_t TextIO::m_G1
private

Definition at line 296 of file TextIO.h.

◆ m_InputMode

InputMode TextIO::m_InputMode
private

Definition at line 334 of file TextIO.h.

◆ m_LeftMargin

ssize_t TextIO::m_LeftMargin
private

Definition at line 264 of file TextIO.h.

◆ m_Lock

Mutex TextIO::m_Lock
private

Locks writing (used for timers in particular). Avoids the case where a timer flips an in-progress operation, causing incorrect rendering.

Definition at line 321 of file TextIO.h.

Referenced by flip(), initialise(), markPrimary(), unmarkPrimary(), and writeStr().

◆ m_nCharacter

uint32_t TextIO::m_nCharacter
private

Current codepoint for handling.

Definition at line 305 of file TextIO.h.

Referenced by writeStr().

◆ m_NextInterval

uint64_t TextIO::m_NextInterval
private

Next interval to wait for (milliseconds).

Definition at line 299 of file TextIO.h.

Referenced by initialise().

◆ m_nUtf8Handled

size_t TextIO::m_nUtf8Handled
private

Number of Utf8 bits handled so far in this sequence.

Definition at line 308 of file TextIO.h.

Referenced by writeStr().

◆ m_OutBuffer

Buffer<char> TextIO::m_OutBuffer
private

Output buffer - data that we as the emulator want to write back to the application (eg, cursor position reports)

Definition at line 290 of file TextIO.h.

Referenced by readBytewise(), select(), and writeStr().

◆ m_Params

size_t TextIO::m_Params[MAX_TEXTIO_PARAMS]
private

Definition at line 266 of file TextIO.h.

◆ m_pBackbuffer

VgaCell* TextIO::m_pBackbuffer
private

Definition at line 274 of file TextIO.h.

◆ m_pFramebuffer

uint16_t* TextIO::m_pFramebuffer
private

Definition at line 273 of file TextIO.h.

◆ m_pVga

Vga* TextIO::m_pVga
private

Definition at line 275 of file TextIO.h.

◆ m_pVterm

VTerm* TextIO::m_pVterm
private

Definition at line 277 of file TextIO.h.

◆ m_pVtermScreen

VTermScreen* TextIO::m_pVtermScreen
private

Definition at line 278 of file TextIO.h.

◆ m_pVtermState

VTermState* TextIO::m_pVtermState
private

Definition at line 279 of file TextIO.h.

◆ m_RightMargin

ssize_t TextIO::m_RightMargin
private

Definition at line 264 of file TextIO.h.

◆ m_SavedCursorX

ssize_t TextIO::m_SavedCursorX
private

Definition at line 262 of file TextIO.h.

◆ m_SavedCursorY

ssize_t TextIO::m_SavedCursorY
private

Definition at line 262 of file TextIO.h.

◆ m_ScrollEnd

ssize_t TextIO::m_ScrollEnd
private

Definition at line 263 of file TextIO.h.

◆ m_ScrollStart

ssize_t TextIO::m_ScrollStart
private

Definition at line 263 of file TextIO.h.

◆ m_TabStops

char TextIO::m_TabStops[BACKBUFFER_STRIDE]
private

Definition at line 284 of file TextIO.h.

◆ m_VtermDirty

uint8_t TextIO::m_VtermDirty[BACKBUFFER_STRIDE *BACKBUFFER_ROWS]
private

Definition at line 280 of file TextIO.h.

◆ m_VtermScrollback

VgaCell TextIO::m_VtermScrollback[VTERM_SCROLLBACK_LINES][BACKBUFFER_STRIDE]
private

Definition at line 281 of file TextIO.h.

◆ m_VtermScrollbackLines

size_t TextIO::m_VtermScrollbackLines
private

Definition at line 282 of file TextIO.h.

◆ VTERM_SCROLLBACK_LINES

const size_t TextIO::VTERM_SCROLLBACK_LINES = 64
staticprivate

Definition at line 253 of file TextIO.h.


The documentation for this class was generated from the following files: