fix: compilation on Linux, using eax for return code

This commit is contained in:
2025-01-16 09:39:55 +01:00
parent 8771e68391
commit c4f5222672
4 changed files with 8 additions and 3 deletions

View File

@@ -381,5 +381,5 @@ void _xor() {
} }
void end() { void end() {
state->should_exit = 0; //could use EAX for return code but i don't think i care state->should_exit = 0;
} }

View File

@@ -87,6 +87,10 @@ int get_exit_state() {
return state->should_exit; return state->should_exit;
} }
int get_exit_code() {
return state->registers->eax;
}
LABEL_ERR add_label(char *label, int line) { LABEL_ERR add_label(char *label, int line) {
if (label == NULL) if (label == NULL)
return LABEL_INVALID; return LABEL_INVALID;
@@ -191,7 +195,7 @@ ARRAY_ERR add_array(char* line) {
} }
arr_char[i++] = (long long)* ptr++; arr_char[i++] = (long long)* ptr++;
} }
state->ARRAYS_VALUES[state->num_arrays++] = arr_char; state->ARRAYS_VALUES[state->num_arrays++] = (long long *)arr_char;
return ARRAY_OK; return ARRAY_OK;
} }
ptr = strtok_(ptr, ","); ptr = strtok_(ptr, ",");

View File

@@ -76,6 +76,7 @@ int init_state();
void free__state(); void free__state();
void set_exit_state(int exit_state); void set_exit_state(int exit_state);
int get_exit_state(); int get_exit_state();
int get_exit_code();
LABEL_ERR add_label(char *label, int line); LABEL_ERR add_label(char *label, int line);
ARRAY_ERR add_array(char *line); ARRAY_ERR add_array(char *line);
void sanitize_arguments(); void sanitize_arguments();

View File

@@ -202,7 +202,7 @@ int pasm_run_script(const char *filename, char **file, size_t lines, int _fstrea
free_(line); free_(line);
} }
int ret_code = get_exit_state(); int ret_code = get_exit_code();
free__script(file); free__script(file);
return ret_code; return ret_code;
} }