In the snippet below, none of the attributes have types or qualifiers such as static. I did notice the one file I have that seemed to work only had types with std::string.
Maybe because I have not provided the ones that provided by typedef? But even in this case there are standard types that dont have a type.
Reply To: RE: -
Greetings,
In the snippet below, none of the attributes have types or qualifiers such as static. I did notice the one file I have that seemed to work only had types with std::string.
Maybe because I have not provided the ones that provided by typedef? But even in this case there are standard types that dont have a type.
Thanks
/* Includes */
/*****************************************************************************/
#include "command.hpp"
#include "os_kernel.hpp"
#include "command_container.hpp"
#include "history.hpp"
/*****************************************************************************/
/* Prevent Multiple Includes */
/*****************************************************************************/
#pragma once
/*****************************************************************************/
/* Macros */
/*****************************************************************************/
#define ENDL_CR
#define WRITE_BUF_SIZE 256
#ifndef MAX_ARGV
#define MAX_ARGV 32
#endif
/*****************************************************************************/
/* Type Definitions */
/*****************************************************************************/
/*****************************************************************************/
/* Global Variables Declarations */
/*****************************************************************************/
/*****************************************************************************/
/* Public Function Declarations */
/*****************************************************************************/
/*****************************************************************************/
/* Forward Class Declarations */
/*****************************************************************************/
class StreamDriver;
/*****************************************************************************/
/* Class Definitions */
/*****************************************************************************/
class Console
{
public:
static bool AddCommand( Command* command );
void Write( const char* message... );
void WaitAnykey( void );
int32_t ReadByte( uint8_t* byte, uint32_t timeout = Kernel::Forever() );
int32_t WriteByte( uint8_t byte, uint32_t timeout = Kernel::Forever() );
void DisableTerm( bool disabled );
protected:
explicit Console( StreamDriver& driver,
const char* name,
const char* cli_prompt,
char* cmdBuffer,
uint32_t maxCmdBufferLen,
char* histBuffer,
uint32_t histBufferLen
);
~Console( void ) = default;
void StartConsole( void );
bool ExecuteConsole( void );
private:
void Prompt( void );
bool Process( const char input );
void SearchHistory( History::Search dir );
bool Escape( const char input );
bool NewLine( void );
int InsertText( char* text, int len );
void Backspace( void );
void TermNewLine( void );
void TermResetCursor( void );
void TermBackspace( void );
void TermMoveCursor ( int offset );
void TermPrintLine( int pos, int cursor );
void TermClearScreen( void );
enum class KeyCodes:char
{
K_NUL, /**< ^@ Null character */
K_SOH, /**< ^A Start of heading, = console interrupt */
K_STX, /**< ^B Start of text, maintenance mode on HP console */
K_ETX, /**< ^C End of text */
K_EOT, /**< ^D End of transmission, not the same as ETB */
K_ENQ, /**< ^E Enquiry, goes with ACK; old HP flow control */
K_ACK, /**< ^F Acknowledge, clears ENQ logon hand */
K_BEL, /**< ^G Bell, rings the bell... */
K_BS, /**< ^H Backspace, works on HP terminals/computers */
K_HT, /**< ^I Horizontal tab, move to next tab stop */
K_LF, /**< ^J Line Feed */
K_VT, /**< ^K Vertical tab */
K_FF, /**< ^L Form Feed, page eject */
K_CR, /**< ^M Carriage Return*/
K_SO, /**< ^N Shift Out, alternate character set */
K_SI, /**< ^O Shift In, resume defaultn character set */
K_DLE, /**< ^P Data link escape */
K_DC1, /**< ^Q XON, with XOFF to pause listings; "okay to send". */
K_DC2, /**< ^R Device control 2, block-mode flow control */
K_DC3, /**< ^S XOFF, with XON is TERM=18 flow control */
K_DC4, /**< ^T Device control 4 */
K_NAK, /**< ^U Negative acknowledge */
K_SYN, /**< ^V Synchronous idle */
K_ETB, /**< ^W End transmission block, not the same as EOT */
K_CAN, /**< ^X Cancel line, MPE echoes !!! */
K_EM, /**< ^Y End of medium, Control-Y interrupt */
K_SUB, /**< ^Z Substitute */
K_ESC, /**< ^[ Escape, next character is not echoed */
K_FS, /**< ^\ File separator */
K_GS, /**< ^] Group separator */
K_RS, /**< ^^ Record separator, block-mode terminator */
K_US, /**< ^_ Unit separator */
K_DEL = 127 /**< Delete (not a real control character...) */
};
enum class EscSeq
{
NONE,
BRKT,
HOME,
END
};
static CommandContainer m_rootCommand;
StreamDriver& m_driver;
const char* m_name;
const char* m_prompt;
bool m_escape;
EscSeq m_escapeSequence;
int m_cursor;
int m_cmdLength;
int m_maxCmdLength;
char* m_cmdline;
History m_history;
char m_writeBuffer;
char* m_argv[MAX_ARGV];
bool m_disableTerm;
#if ( defined( ENDL_CRLF ) || defined( ENDL_LFCR) )
char m_tempChar;
#endif
};
John Wood 5 March 2025 22:55:46