mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-12-23 16:30:23 +00:00
Bug #466 Update HELP SYM to double-quote symbols
This commit is contained in:
parent
0fef6516f4
commit
1728b7b668
@ -210,8 +210,9 @@ void Help_Categories()
|
|||||||
void Help_Examples()
|
void Help_Examples()
|
||||||
{
|
{
|
||||||
char sText[ CONSOLE_WIDTH ];
|
char sText[ CONSOLE_WIDTH ];
|
||||||
ConsolePrintFormat( sText, " %sExamples%s:"
|
ConsolePrintFormat( sText, " %sExamples%s:%s"
|
||||||
, CHC_USAGE
|
, CHC_USAGE
|
||||||
|
, CHC_ARG_SEP
|
||||||
, CHC_DEFAULT
|
, CHC_DEFAULT
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -322,6 +323,17 @@ void _ColorizeHeader(
|
|||||||
pDst += nLen;
|
pDst += nLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void _ColorizeString(
|
||||||
|
char * & pDst,
|
||||||
|
const char *pSrc, const size_t nLen )
|
||||||
|
{
|
||||||
|
strcpy( pDst, pSrc );
|
||||||
|
pDst += nLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// pOperator is one of CHC_*
|
||||||
void _ColorizeOperator(
|
void _ColorizeOperator(
|
||||||
char * & pDst, const char * & pSrc,
|
char * & pDst, const char * & pSrc,
|
||||||
char * pOperator )
|
char * pOperator )
|
||||||
@ -343,6 +355,18 @@ void _ColorizeOperator(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool isHexDigit( char c )
|
||||||
|
{
|
||||||
|
if ((c >= '0') && (c <= '9')) return true;
|
||||||
|
if ((c >= 'A') && (c <= 'F')) return true;
|
||||||
|
if ((c >= 'a') && (c <= 'f')) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Colorize( char * pDst, const char * pSrc )
|
bool Colorize( char * pDst, const char * pSrc )
|
||||||
{
|
{
|
||||||
if (! pSrc)
|
if (! pSrc)
|
||||||
@ -363,6 +387,9 @@ bool Colorize( char * pDst, const char * pSrc )
|
|||||||
const char sTotal[] = "Total:";
|
const char sTotal[] = "Total:";
|
||||||
const int nTotal = sizeof( sTotal ) - 1;
|
const int nTotal = sizeof( sTotal ) - 1;
|
||||||
|
|
||||||
|
const char sExamples[] = "Examples:";
|
||||||
|
const int nExamples = sizeof( sExamples ) - 1;
|
||||||
|
|
||||||
int nLen = 0;
|
int nLen = 0;
|
||||||
while (*pSrc)
|
while (*pSrc)
|
||||||
{
|
{
|
||||||
@ -386,6 +413,11 @@ bool Colorize( char * pDst, const char * pSrc )
|
|||||||
_ColorizeHeader( pDst, pSrc, sTotal, nTotal );
|
_ColorizeHeader( pDst, pSrc, sTotal, nTotal );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
if (strncmp( sExamples, pSrc, nExamples) == 0)
|
||||||
|
{
|
||||||
|
_ColorizeHeader( pDst, pSrc, sExamples, nExamples );
|
||||||
|
}
|
||||||
|
else
|
||||||
if (*pSrc == '[')
|
if (*pSrc == '[')
|
||||||
{
|
{
|
||||||
_ColorizeOperator( pDst, pSrc, CHC_ARG_OPT );
|
_ColorizeOperator( pDst, pSrc, CHC_ARG_OPT );
|
||||||
@ -416,6 +448,25 @@ bool Colorize( char * pDst, const char * pSrc )
|
|||||||
_ColorizeOperator( pDst, pSrc, CHC_ARG_SEP );
|
_ColorizeOperator( pDst, pSrc, CHC_ARG_SEP );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
if ((*pSrc == '$') && isHexDigit(pSrc[1])) // Hex Number
|
||||||
|
{
|
||||||
|
_ColorizeOperator( pDst, pSrc, CHC_ARG_SEP );
|
||||||
|
|
||||||
|
const char *start = pSrc;
|
||||||
|
const char *end = pSrc;
|
||||||
|
|
||||||
|
while( isHexDigit( *end ) )
|
||||||
|
end++;
|
||||||
|
|
||||||
|
size_t nDigits = end - start;
|
||||||
|
|
||||||
|
_ColorizeString( pDst, CHC_NUM_HEX, strlen( CHC_NUM_HEX ) );
|
||||||
|
_ColorizeString( pDst, start , nDigits );
|
||||||
|
_ColorizeString( pDst, CHC_DEFAULT, strlen( CHC_DEFAULT ) );
|
||||||
|
|
||||||
|
pSrc += nDigits;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
*pDst = *pSrc;
|
*pDst = *pSrc;
|
||||||
pDst++;
|
pDst++;
|
||||||
@ -426,6 +477,7 @@ bool Colorize( char * pDst, const char * pSrc )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: This appends a new line
|
||||||
inline bool ConsoleColorizePrint( char* colorizeBuf, size_t /*colorizeBufSz*/,
|
inline bool ConsoleColorizePrint( char* colorizeBuf, size_t /*colorizeBufSz*/,
|
||||||
const char* pText )
|
const char* pText )
|
||||||
{
|
{
|
||||||
@ -1281,10 +1333,23 @@ Update_t CmdHelpSpecific (int nArgs)
|
|||||||
// Symbols
|
// Symbols
|
||||||
case CMD_SYMBOLS_LOOKUP:
|
case CMD_SYMBOLS_LOOKUP:
|
||||||
ConsoleColorizePrint( sText, " Usage: symbol [= <address>]" );
|
ConsoleColorizePrint( sText, " Usage: symbol [= <address>]" );
|
||||||
|
ConsolePrintFormat( sText, " %s\"%ssymbol%s\" = %saddress"
|
||||||
|
, CHC_ARG_MAND
|
||||||
|
, CHC_SYMBOL
|
||||||
|
, CHC_ARG_MAND
|
||||||
|
, CHC_ADDRESS
|
||||||
|
);
|
||||||
|
ConsoleColorizePrint( sText, " Note: Valid characters are any characters above ASCII space ($20)." );
|
||||||
|
ConsolePrintFormat( sText, " You %sMUST%s double-quote names containing special characters to be recognized."
|
||||||
|
, CHC_WARNING
|
||||||
|
, CHC_DEFAULT
|
||||||
|
);
|
||||||
Help_Examples();
|
Help_Examples();
|
||||||
ConsolePrintFormat( sText, "%s %s HOME" , CHC_EXAMPLE, pCommand->m_sName );
|
ConsolePrintFormat( sText, "%s %s HOME" , CHC_EXAMPLE, pCommand->m_sName );
|
||||||
ConsolePrintFormat( sText, "%s %s LIFE = 2000", CHC_EXAMPLE, pCommand->m_sName );
|
ConsolePrintFormat( sText, "%s %s LIFE = 2000" , CHC_EXAMPLE, pCommand->m_sName );
|
||||||
ConsolePrintFormat( sText, "%s %s LIFE" , CHC_EXAMPLE, pCommand->m_sName );
|
ConsolePrintFormat( sText, "%s %s LIFE" , CHC_EXAMPLE, pCommand->m_sName );
|
||||||
|
ConsolePrintFormat( sText, "%s %s \"PR#\" = FE95", CHC_EXAMPLE, pCommand->m_sName );
|
||||||
|
ConsolePrintFormat( sText, "%s %s \"PR#\"" , CHC_EXAMPLE, pCommand->m_sName );
|
||||||
break;
|
break;
|
||||||
case CMD_SYMBOLS_ROM:
|
case CMD_SYMBOLS_ROM:
|
||||||
case CMD_SYMBOLS_APPLESOFT:
|
case CMD_SYMBOLS_APPLESOFT:
|
||||||
|
Loading…
Reference in New Issue
Block a user