diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2024-12-13 16:10:52 -0500 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2024-12-13 16:10:52 -0500 |
commit | 5c207b7038d3a634e8a752ceb4ea3dcd1553ebfa (patch) | |
tree | 366ecee7b657152abb9f6ae9ae3c05ad16863616 | |
parent | 0b0659ec65c8167548c3f32707b5bde249d6a458 (diff) |
-rw-r--r-- | compiler.c | 22 |
1 files changed, 10 insertions, 12 deletions
@@ -30,11 +30,7 @@ Vector vect_init(size_t item_size) { } void _vect_grow(Vector *v) { - if (v->size / 2 > VECT_MAX_GROW) { - v->size += VECT_MAX_GROW; - } else { - v->size += v->size / 2; - } + v->size += VECT_MAX_GROW; v->data = realloc(v->data, v->size * v->_el_sz); } @@ -738,6 +734,7 @@ char *_op_get_register(int reg, int size) { default: printf("ERROR: invalid register size %d (this is a compiler issue)\n", size); vect_push(&out, &add); + vect_push_string(&out, "; Invalid register size"); break; } @@ -5322,6 +5319,7 @@ void eval_strict_arr(Module *mod, Vector *out, Vector *tokens, Variable *v, size int end = tnsl_find_closing(tokens, start); int count = 0; bool first = true; + start++; for (size_t i = start; i < end; i++) { cur = vect_get(tokens, i); @@ -5344,7 +5342,7 @@ void eval_strict_arr(Module *mod, Vector *out, Vector *tokens, Variable *v, size vect_push_string(&store, "\n"); first = true; - for (start++; start < end; start++) { + for (; start < end; start++) { cur = vect_get(tokens, start); if(tok_str_eq(cur, ",")) { first = true; @@ -5352,13 +5350,13 @@ void eval_strict_arr(Module *mod, Vector *out, Vector *tokens, Variable *v, size if (first) { first = false; if (_var_ptr_type(&strip) > 1) { - eval_strict_arr(mod, &store, tokens, &strip, start + 2, datalab, ntharr); - } else if (_var_ptr_type(v) > PTYPE_NONE) { - eval_strict_ptr(mod, &store, tokens, &strip, start + 2, datalab, ntharr); - } else if (!is_inbuilt(v->type->name)) { - eval_strict_composite(mod, &store, tokens, &strip, start + 2, datalab, ntharr); + eval_strict_arr(mod, &store, tokens, &strip, start, datalab, ntharr); + } else if (_var_ptr_type(&strip) > PTYPE_NONE) { + eval_strict_ptr(mod, &store, tokens, &strip, start, datalab, ntharr); + } else if (!is_inbuilt(strip.type->name)) { + eval_strict_composite(mod, &store, tokens, &strip, start, datalab, ntharr); } else { - eval_strict_literal(&store, tokens, &strip, start + 2); + eval_strict_literal(&store, tokens, &strip, start); } } |