turn access into a function to be ran at runtime

This commit is contained in:
2025-08-10 01:45:46 +01:00
parent ad3e31b0a2
commit 49b1c1858a
14 changed files with 196 additions and 636502 deletions

View File

@@ -0,0 +1,32 @@
/*
* SPDX-FileCopyrightText: 2025 William Bell
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include "access.h"
size_t translate_access(Translated *translated, ParsedAccess *access,
ArErr *err) {
set_registers(translated, 1);
uint64_t first = push_instruction_byte(translated, OP_LOAD_ACCESS_FUNCTION);
push_instruction_byte(translated, OP_INIT_CALL);
push_instruction_code(translated, 3);
translate_parsed(translated, &access->to_access, err);
push_instruction_byte(translated, OP_INSERT_ARG);
push_instruction_code(translated, 0);
translate_parsed(translated, darray_get(&access->access, 0), err);
push_instruction_byte(translated, OP_INSERT_ARG);
push_instruction_code(translated, 1);
push_instruction_byte(translated, OP_LOAD_BOOL);
push_instruction_byte(translated, access->access_fields);
push_instruction_byte(translated, OP_INSERT_ARG);
push_instruction_code(translated, 2);
push_instruction_byte(translated, OP_SOURCE_LOCATION);
push_instruction_code(translated, access->line);
push_instruction_code(translated, access->column);
push_instruction_code(translated, access->length);
push_instruction_byte(translated, OP_CALL);
return first;
}