New keyword ^^ABSCOUNT counts bytes defined in current .abs section.
authorggn <ggn.dbug@gmail.com>
Tue, 10 Nov 2015 20:46:53 +0000 (22:46 +0200)
committerShamus Hammons <jlhamm@acm.org>
Wed, 11 Nov 2015 02:41:02 +0000 (20:41 -0600)
expr.c
kwtab
token.c
token.h

diff --git a/expr.c b/expr.c
index d1b9ac2e08e50114af26a0272cc93f5e0123348b..0ecaa45316e2e69baa173512a79ab643ecf94b4f 100644 (file)
--- a/expr.c
+++ b/expr.c
@@ -34,7 +34,8 @@ char itokcl[] = {
        ')', ']', '}', 0,                               // CPAR 
        CR_DEFINED, CR_REFERENCED,              // SUNARY (special unary)
        CR_STREQ, CR_MACDEF,
-       CR_DATE, CR_TIME, 0,
+       CR_DATE, CR_TIME, 
+       CR_ABSCOUNT, 0,
        '!', '~', UNMINUS, 0,                   // UNARY
        '*', '/', '%', 0,                               // MULT 
        '+', '-', 0,                                    // ADD 
@@ -149,6 +150,10 @@ int expr1(void)
        {
                switch ((int)*tok++)
                {
+               case CR_ABSCOUNT:
+                       *evalTokenBuffer++ = CONST;
+                       *evalTokenBuffer++ = (LONG)sect[ABS].sloc;
+                       break;
                case CR_TIME:
                        *evalTokenBuffer++ = CONST;
                        *evalTokenBuffer++ = dos_time();
diff --git a/kwtab b/kwtab
index 750c603a535735a580b177762b6838a60d4d762c..70c33d23fff66416982b23bda34ea1ed6e611e32 100644 (file)
--- a/kwtab
+++ b/kwtab
@@ -71,6 +71,6 @@ streq 118
 macdef   119
 time  120
 date  121
-
+abscount  122
 
 
diff --git a/token.c b/token.c
index c78d97ac6f0054d8ca02bf68b0a3a1c0c10406e4..84faa8f157bc5a9157f60e25e88dbda49e4df0f3 100644 (file)
--- a/token.c
+++ b/token.c
@@ -554,6 +554,9 @@ DEBUG printf("ExM: SYMBOL=\"%s\"", d);
                                                        case DOTL:
                                                                d = ".l";
                                                                break;
+                                                       case CR_ABSCOUNT:
+                                                               d = "^^abscount";
+                                                               break;
                                                        case CR_DATE:
                                                                d = "^^date";
                                                                break;
@@ -1641,6 +1644,8 @@ void DumpTokenBuffer(void)
                        printf("[DOTI]");
                else if (*t == ENDEXPR)
                        printf("[ENDEXPR]");
+               else if (*t == CR_ABSCOUNT)
+                       printf("[CR_ABSCOUNT]");
                else if (*t == CR_DEFINED)
                        printf("[CR_DEFINED]");
                else if (*t == CR_REFERENCED)
diff --git a/token.h b/token.h
index 3d3ea22c017b4f1a5c7fc144c1e83818a6d5ed52..c44989c09f7ca99651f9287432c23828b8e909e7 100644 (file)
--- a/token.h
+++ b/token.h
@@ -62,6 +62,7 @@
 #define CR_MACDEF       'w'                                    // ^^macdef - is macro defined?
 #define CR_TIME         'x'                                    // ^^time - DOS format time
 #define CR_DATE         'y'                                    // ^^date - DOS format date
+#define CR_ABSCOUNT     'z'                                    // ^^abscount - count the number of bytes defined in curent .abs section
 
 // Character Attributes
 #define ILLEG           0                                      // Illegal character (unused)