2 * Copyright (C) 2024 Mikulas Patocka
4 * This file is part of Ajla.
6 * Ajla is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, either version 3 of the License, or (at your option) any later
11 * Ajla is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along with
16 * Ajla. If not, see <https://www.gnu.org/licenses/>.
24 #define start_fn name(start_fn)
25 #define module_designator_alloc name(module_designator_alloc)
26 #define module_designator_free name(module_designator_free)
27 #define module_designator_length name(module_designator_length)
28 #define module_designator_compare name(module_designator_compare)
29 #define function_designator_alloc name(function_designator_alloc)
30 #define function_designator_alloc_single name(function_designator_alloc_single)
31 #define function_designator_free name(function_designator_free)
32 #define function_designator_length name(function_designator_length)
33 #define function_designator_compare name(function_designator_compare)
34 #define module_load_function name(module_load_function)
36 extern pointer_t
*start_fn
;
38 struct module_designator
{
42 uint8_t path
[FLEXIBLE_ARRAY
];
45 struct module_designator
*module_designator_alloc(unsigned path_idx
, const uint8_t *path
, size_t path_len
, bool program
, ajla_error_t
*mayfail
);
46 void module_designator_free(struct module_designator
*md
);
47 size_t module_designator_length(const struct module_designator
*md
);
48 int module_designator_compare(const struct module_designator
*md1
, const struct module_designator
*md2
);
50 struct function_designator
{
52 pcode_t entries
[FLEXIBLE_ARRAY
];
55 struct function_designator
*function_designator_alloc(const pcode_t
*p
, ajla_error_t
*mayfail
);
56 struct function_designator
*function_designator_alloc_single(pcode_t idx
, ajla_error_t
*mayfail
);
57 void function_designator_free(struct function_designator
*fd
);
58 size_t function_designator_length(const struct function_designator
*fd
);
59 int function_designator_compare(const struct function_designator
*fd1
, const struct function_designator
*fd2
);
61 /* returns a pointer to pointer_t */
62 pointer_t
*module_load_function(const struct module_designator
*md
, const struct function_designator
*fd
, bool get_fn
, bool optimizer
, ajla_error_t
*mayfail
);