1
0
mirror of https://github.com/cc65/cc65.git synced 2024-09-30 08:57:49 +00:00

Added the .TIME pseudo function

git-svn-id: svn://svn.cc65.org/cc65/trunk@1651 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2002-11-26 13:44:35 +00:00
parent 0edf53fd2f
commit 8fc78c2c8d
5 changed files with 34 additions and 7 deletions

View File

@ -1,3 +1,4 @@
<!doctype linuxdoc system>
<article>
@ -406,6 +407,7 @@ Available operators sorted by precedence:
.DEFINED Builtin function 1
.MATCH Builtin function 1
.TCOUNT Builtin function 1
.TIME Builtin function 1
.XMATCH Builtin function 1
.PARAMCOUNT Builtin pseudo variable (r/o) 1
.REFERENCED Builtin function 1
@ -2150,6 +2152,22 @@ Here's a list of all control commands and a description, what they do:
</verb></tscreen>
<sect1><tt>.TIME</tt><label id=".TIME"><p>
Reading this pseudo variable will give a constant integer value that
represents the current time in POSIX standard (as seconds since the
Epoch).
It may be used to encode the time of translation somewhere in the created
code.
Example:
<tscreen><verb>
.dword .time ; Place time here
</verb></tscreen>
<sect1><tt>.WARNING</tt><label id=".WARNING"><p>
Force an assembly warning. The assembler will output a warning message

View File

@ -34,6 +34,7 @@
#include <string.h>
#include <time.h>
/* common */
#include "check.h"
@ -660,6 +661,11 @@ static ExprNode* Factor (void)
N = Function (FuncTCount);
break;
case TOK_TIME:
N = LiteralExpr (time (0));
NextTok ();
break;
case TOK_XMATCH:
N = Function (FuncXMatch);
break;

View File

@ -1430,6 +1430,7 @@ static CtrlDesc CtrlCmdTab [] = {
{ ccNone, DoUnexpected }, /* .STRLEN */
{ ccNone, DoSunPlus },
{ ccNone, DoUnexpected }, /* .TCOUNT */
{ ccNone, DoUnexpected }, /* .TIME */
{ ccNone, DoWarning },
{ ccNone, DoWord },
{ ccNone, DoUnexpected }, /* .XMATCH */

View File

@ -228,6 +228,7 @@ struct DotKeyword {
{ ".STRLEN", TOK_STRLEN },
{ ".SUNPLUS", TOK_SUNPLUS },
{ ".TCOUNT", TOK_TCOUNT },
{ ".TIME", TOK_TIME },
{ ".WARNING", TOK_WARNING },
{ ".WORD", TOK_WORD },
{ ".XMATCH", TOK_XMATCH },

View File

@ -201,6 +201,7 @@ enum Token {
TOK_STRLEN,
TOK_SUNPLUS,
TOK_TCOUNT,
TOK_TIME,
TOK_WARNING,
TOK_WORD,
TOK_XMATCH,