struct operand_ *new_operand;
char *y;
- DEBUG_PRINTF("considering operand '%s'\n", x);
-
/* trim whitespaces */
x += strspn(x, whitespace);
- DEBUG_PRINTF("considering ftrim operand '%s'\n", x);
-
if (*x) {
for (y = x + strlen(x) - 1; *y; y--) {
if (strchr(whitespace, *y)) {
}
/* nothing left? */
if (*x == '\0') {
- fprintf(stderr, "ignoring null operand in line %zu\n", instr->src_line);
- continue;
+ fprintf(stderr, "null operand encountered\n");
+ return -1;
}
- DEBUG_PRINTF("found operand '%s'\n", x);
+ DEBUG_PRINTF("tokenized operand '%s'\n", x);
new_operand = malloc(sizeof *new_operand);
if (new_operand == NULL) {
}
}
- DEBUG_PRINTF("allocating instruction with room for %zu bytes\n", instr_words_needed);
+ DEBUG_PRINTF("allocating new instruction with room for %zu bytes\n", instr_words_needed);
instr = calloc(1, (instr_words_needed * sizeof *instr->instr_words) + sizeof *instr);
if (instr == NULL) {
VERBOSE_PRINTF("assembling '%s'...\n", filename);
c = parse_stream_(f, filename, instructionps_, labels_, allow_short_labels);
+ fclose(f);
if (c)
break;
- fclose(f);
}
} else {
VERBOSE_PRINTF("assembling '%s'...\n", "stdin");