[RFC] Encoding of modes in module exports
Jose E. Marchesi
jemarch@gnu.org
Mon Nov 3 22:32:17 GMT 2025
Yet another version with ga68_export. The .ga68_exports section would
contain an array (with total size sh_size) of them. To traverse the
table shall be fast, therefore the 'size' field in ga68_export.
Ok now I stop for some discussion on this approach :)
---
load elf;
type ga68_str = offset<Elf_Word,B>;
type ga68_text_reloc = Elf64_Addr;
type ga68_data_reloc = Elf64_Addr;
var GA68_EXPORT_MODE = 1;
var GA68_MODE_VOID = 0,
GA68_MODE_INT = 1,
GA68_MODE_REAL = 2,
GA68_MODE_CHAR = 3,
GA68_MODE_CMPL = 4,
GA68_MODE_ROW = 5,
GA68_MODE_STRUCT = 6,
GA68_MODE_UNION = 7,
GA68_MODE_NAME = 8,
GA68_MOID = 9;
type ga68_mode =
struct
{
Elf_Word kind;
Elf_Word mode_kind;
union
{
struct
{
ga68_text_reloc name;
ga68_data_reloc mode;
} moid : kind == GA68_MODE_MOID;
struct
{
Elf_Word flex;
ga68_data_reloc mode;
} name : kind == GA68_MODE_NAME;
struct
{
Elf_Word dim;
struct { ga68_text_reloc lb; ga68_text_reloc ub; Elf64_Off stride; }[dim] triplets;
ga68_data_reloc row_of;
} row : kind == GA68_MODE_ROW;
struct
{
Elf_Word nfields;
struct { ga68_str name; ga68_data_reloc mode }[nfields] fields;
} sct : kind == GA68_MODE_STRUCT;
struct
{
Elf_Word nmodes;
ga68_data_reloc[nmodes] modes;
} uni : kind == GA68_MODE_UNION;
struct {};
} data;
};
/* The contents of the .ga68_exports section can be mapped as a
ga68_export[sec.sh_size] */
type ga68_export =
struct
{
Elf64_Off size;
union
{
ga68_mode mode;
} export : export'size == size;
};
More information about the Algol68
mailing list