Introduce command PRINTI to print integers

PRINTV prints integers in hexadecimal, PRINTI prints them in signed
decimal. For example:

    PRINTT "Error at line "
    PRINTI __LINE__
    PRINTT "\n"

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
Antonio Niño Díaz
2018-02-23 00:16:30 +00:00
parent 3623638be7
commit d243bd04ef
4 changed files with 28 additions and 10 deletions

View File

@@ -504,7 +504,7 @@ static void updateUnion(void)
%token <tzSym> T_POP_SET
%token <tzSym> T_POP_EQUS
%token T_POP_INCLUDE T_POP_PRINTF T_POP_PRINTT T_POP_PRINTV
%token T_POP_INCLUDE T_POP_PRINTF T_POP_PRINTT T_POP_PRINTV T_POP_PRINTI
%token T_POP_IF T_POP_ELIF T_POP_ELSE T_POP_ENDC
%token T_POP_IMPORT T_POP_EXPORT T_POP_GLOBAL
%token T_POP_DB T_POP_DS T_POP_DW T_POP_DL
@@ -648,6 +648,7 @@ simple_pseudoop : include
| printf
| printt
| printv
| printi
| if
| elif
| else
@@ -933,6 +934,13 @@ printv : T_POP_PRINTV const
}
;
printi : T_POP_PRINTI const
{
if (nPass == 1)
printf("%d", $2);
}
;
printf : T_POP_PRINTF const
{
if (nPass == 1)