summaryrefslogtreecommitdiff
path: root/output
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2009-10-29 23:09:18 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2009-10-31 20:02:43 +0300
commit917117ff69271fe911e87a6f0e8dfc1f81c3f9b4 (patch)
tree7fa504459cecef908ceed5197bf8bab629dc11e9 /output
parentbafd877d48b25e576a4c905a14f1301502cca69c (diff)
downloadnasm-917117ff69271fe911e87a6f0e8dfc1f81c3f9b4.tar.gz
stdscan: switch to stdscan_get/set routines
Instead of manipulating stdscan buffer pointer directly we switch to a routine interface. This allow us to unify stdscan access: ie caller should "talk" to stdscan via stdscan_get/set routines. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'output')
-rw-r--r--output/outaout.c8
-rw-r--r--output/outbin.c6
-rw-r--r--output/outelf32.c8
-rw-r--r--output/outelf64.c8
-rw-r--r--output/outobj.c4
5 files changed, 16 insertions, 18 deletions
diff --git a/output/outaout.c b/output/outaout.c
index f0a86ec9..113eafe0 100644
--- a/output/outaout.c
+++ b/output/outaout.c
@@ -299,7 +299,7 @@ static void aout_deflabel(char *name, int32_t segment, int64_t offset,
while (*p && nasm_isspace(*p))
p++;
stdscan_reset();
- stdscan_bufptr = p;
+ stdscan_set(p);
tokval.t_type = TOKEN_INVALID;
e = evaluate(stdscan, NULL, &tokval, NULL, 1, nasm_error, NULL);
if (e) {
@@ -379,7 +379,7 @@ static void aout_deflabel(char *name, int32_t segment, int64_t offset,
struct tokenval tokval;
expr *e;
int fwd = false;
- char *saveme = stdscan_bufptr; /* bugfix? fbk 8/10/00 */
+ char *saveme = stdscan_get(); /* bugfix? fbk 8/10/00 */
if (!bsd) {
nasm_error(ERR_NONFATAL, "Linux a.out does not support"
@@ -393,7 +393,7 @@ static void aout_deflabel(char *name, int32_t segment, int64_t offset,
*/
sym->type |= SYM_WITH_SIZE;
stdscan_reset();
- stdscan_bufptr = special + n;
+ stdscan_set(special + n);
tokval.t_type = TOKEN_INVALID;
e = evaluate(stdscan, NULL, &tokval, &fwd, 0, nasm_error,
NULL);
@@ -409,7 +409,7 @@ static void aout_deflabel(char *name, int32_t segment, int64_t offset,
sym->size = reloc_value(e);
}
}
- stdscan_bufptr = saveme; /* bugfix? fbk 8/10/00 */
+ stdscan_set(saveme); /* bugfix? fbk 8/10/00 */
}
special_used = true;
}
diff --git a/output/outbin.c b/output/outbin.c
index ba9947d9..41c28f30 100644
--- a/output/outbin.c
+++ b/output/outbin.c
@@ -152,8 +152,6 @@ static struct Reloc {
struct Section *target;
} *relocs, **reloctail;
-extern char *stdscan_bufptr;
-
static uint8_t format_mode; /* 0 = original bin, 1 = extended bin */
static int32_t current_section; /* only really needed if format_mode = 0 */
static uint64_t origin;
@@ -985,7 +983,7 @@ static int bin_read_attribute(char **line, int *attribute,
/* Read and evaluate the expression. */
stdscan_reset();
- stdscan_bufptr = exp;
+ stdscan_set(exp);
tokval.t_type = TOKEN_INVALID;
e = evaluate(stdscan, NULL, &tokval, NULL, 1, nasm_error, NULL);
if (e) {
@@ -1292,7 +1290,7 @@ static int bin_directive(enum directives directive, char *args, int pass)
expr *e;
stdscan_reset();
- stdscan_bufptr = args;
+ stdscan_set(args);
tokval.t_type = TOKEN_INVALID;
e = evaluate(stdscan, NULL, &tokval, NULL, 1, nasm_error, NULL);
if (e) {
diff --git a/output/outelf32.c b/output/outelf32.c
index 47c9d103..8cb01dec 100644
--- a/output/outelf32.c
+++ b/output/outelf32.c
@@ -495,7 +495,7 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
while (*p && nasm_isspace(*p))
p++;
stdscan_reset();
- stdscan_bufptr = p;
+ stdscan_set(p);
tokval.t_type = TOKEN_INVALID;
e = evaluate(stdscan, NULL, &tokval, NULL, 1, nasm_error, NULL);
if (e) {
@@ -630,7 +630,7 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
struct tokenval tokval;
expr *e;
int fwd = 0;
- char *saveme = stdscan_bufptr; /* bugfix? fbk 8/10/00 */
+ char *saveme = stdscan_get(); /* bugfix? fbk 8/10/00 */
while (special[n] && nasm_isspace(special[n]))
n++;
@@ -639,7 +639,7 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
* evaluate it.
*/
stdscan_reset();
- stdscan_bufptr = special + n;
+ stdscan_set(special + n);
tokval.t_type = TOKEN_INVALID;
e = evaluate(stdscan, NULL, &tokval, &fwd, 0, nasm_error,
NULL);
@@ -654,7 +654,7 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
else
sym->size = reloc_value(e);
}
- stdscan_bufptr = saveme; /* bugfix? fbk 8/10/00 */
+ stdscan_set(saveme); /* bugfix? fbk 8/10/00 */
}
special_used = true;
}
diff --git a/output/outelf64.c b/output/outelf64.c
index b005693c..3b9fae1d 100644
--- a/output/outelf64.c
+++ b/output/outelf64.c
@@ -499,7 +499,7 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
while (*p && nasm_isspace(*p))
p++;
stdscan_reset();
- stdscan_bufptr = p;
+ stdscan_set(p);
tokval.t_type = TOKEN_INVALID;
e = evaluate(stdscan, NULL, &tokval, NULL, 1, nasm_error, NULL);
if (e) {
@@ -635,7 +635,7 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
struct tokenval tokval;
expr *e;
int fwd = 0;
- char *saveme = stdscan_bufptr; /* bugfix? fbk 8/10/00 */
+ char *saveme = stdscan_get(); /* bugfix? fbk 8/10/00 */
while (special[n] && nasm_isspace(special[n]))
n++;
@@ -644,7 +644,7 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
* evaluate it.
*/
stdscan_reset();
- stdscan_bufptr = special + n;
+ stdscan_set(special + n);
tokval.t_type = TOKEN_INVALID;
e = evaluate(stdscan, NULL, &tokval, &fwd, 0, nasm_error,
NULL);
@@ -659,7 +659,7 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
else
sym->size = reloc_value(e);
}
- stdscan_bufptr = saveme; /* bugfix? fbk 8/10/00 */
+ stdscan_set(saveme); /* bugfix? fbk 8/10/00 */
}
special_used = true;
}
diff --git a/output/outobj.c b/output/outobj.c
index 87846fbd..804ff52e 100644
--- a/output/outobj.c
+++ b/output/outobj.c
@@ -966,7 +966,7 @@ static void obj_deflabel(char *name, int32_t segment,
struct tokenval tokval;
stdscan_reset();
- stdscan_bufptr = special;
+ stdscan_set(special);
tokval.t_type = TOKEN_INVALID;
e = evaluate(stdscan, NULL, &tokval, NULL, 1, nasm_error, NULL);
if (e) {
@@ -976,7 +976,7 @@ static void obj_deflabel(char *name, int32_t segment,
else
ext->commonelem = reloc_value(e);
}
- special = stdscan_bufptr;
+ special = stdscan_get();
} else {
nasm_error(ERR_NONFATAL,
"`%s': element-size specifications only"