read morphism body definitions from morphism-base file and generate instantiations based on type-variable substitutions

This commit is contained in:
Michael Sippel 2025-02-16 17:08:55 +01:00
parent 3f4a99ad79
commit cea1f36e63
Signed by: senvas
GPG key ID: F96CF119C34B64A6
8 changed files with 244 additions and 255 deletions
morphisms/morphism-base

View file

@ -1,9 +1,24 @@
morph_string_as_nullterm_to_length_prefix ()
<Seq~<ValueDelim '\0'> x86.UInt8>
morph_array_as_valterm_to_lenpfx (Terminator:x86.UInt8)
<Seq~<ValueTerminated Terminator> x86.UInt8>
--> <Seq~<LengthPrefix x86.UInt64> x86.UInt8>
@lib/libmorph_length-prefix.so:src/length_prefix.c
```
length_prefix_uint8_array_clear(dst);
while( *src != Terminator ) {
length_prefix_uint8_array_push(dst, *src);
src++;
}
morph_string_as_length_prefix_to_nullterm ()
return 0;
```
morph_array_as_lenpfx_to_valterm (Terminator:x86.UInt8)
<Seq~<LengthPrefix x86.UInt64> x86.UInt8>
--> <Seq~<ValueDelim '\0'> x86.UInt8>
@lib/libmorph_length-prefix.so:src/length_prefix.c
--> <Seq~<ValueTerminated Terminator> x86.UInt8>
```
for( uint64_t i = 0; i < src->len; ++i ) {
*dst ++ = src->items[i];
}
*dst = Terminator;
return 0;
```