mc: Implemented .LITERAL

This commit is contained in:
Marco Aurelio da Costa
2021-04-18 17:24:29 -03:00
committed by Oliver Schmidt
parent f901adba22
commit fd3d5d35fb
4 changed files with 57 additions and 8 deletions

View File

@@ -566,8 +566,8 @@ static void DoBss (void)
static void DoByte (void)
/* Define bytes */
static void DoByteBase (int EnableTranslation)
/* Define bytes or literals */
{
/* Element type for the generated array */
static const char EType[1] = { GT_BYTE };
@@ -579,8 +579,12 @@ static void DoByte (void)
/* Parse arguments */
while (1) {
if (CurTok.Tok == TOK_STRCON) {
/* A string, translate into target charset and emit */
TgtTranslateStrBuf (&CurTok.SVal);
/* A string, translate into target charset
if appropriate */
if (EnableTranslation) {
TgtTranslateStrBuf (&CurTok.SVal);
}
/* Emit */
EmitStrBuf (&CurTok.SVal);
NextTok ();
} else {
@@ -613,6 +617,14 @@ static void DoByte (void)
static void DoByte (void)
/* Define bytes with translation */
{
DoByteBase (1);
}
static void DoCase (void)
/* Switch the IgnoreCase option */
{
@@ -1415,6 +1427,14 @@ static void DoList (void)
static void DoLiteral (void)
/* Define bytes without translation */
{
DoByteBase (0);
}
static void DoLoBytes (void)
/* Define bytes, extracting the lo byte from each expression in the list */
{
@@ -2103,6 +2123,7 @@ static CtrlDesc CtrlCmdTab [] = {
{ ccNone, DoLineCont },
{ ccNone, DoList },
{ ccNone, DoListBytes },
{ ccNone, DoLiteral },
{ ccNone, DoUnexpected }, /* .LOBYTE */
{ ccNone, DoLoBytes },
{ ccNone, DoUnexpected }, /* .LOCAL */

View File

@@ -234,6 +234,7 @@ struct DotKeyword {
{ ".LINECONT", TOK_LINECONT },
{ ".LIST", TOK_LIST },
{ ".LISTBYTES", TOK_LISTBYTES },
{ ".LITERAL", TOK_LITERAL },
{ ".LOBYTE", TOK_LOBYTE },
{ ".LOBYTES", TOK_LOBYTES },
{ ".LOCAL", TOK_LOCAL },

View File

@@ -210,6 +210,7 @@ typedef enum token_t {
TOK_LINECONT,
TOK_LIST,
TOK_LISTBYTES,
TOK_LITERAL,
TOK_LOBYTE,
TOK_LOBYTES,
TOK_LOCAL,