]> git.corax.cc Git - toolbox/commit
toolbox.sh: Implement naive interfaces and inheritance
authorMatthias Kruk <m@m10k.eu>
Sat, 3 Dec 2022 07:51:59 +0000 (16:51 +0900)
committerMatthias Kruk <m@m10k.eu>
Mon, 9 Jan 2023 04:20:16 +0000 (13:20 +0900)
commitef5f167515aed68166215e1ab02c2434d93de0f1
treecc312acc2f4780ce1fe9e16ea2926d5f7c6a1090
parent2ef46794e210dbccabc297444c8a60c561027b56
toolbox.sh: Implement naive interfaces and inheritance

The ipc and uipc modules provide the same API to the module user,
but the user cannot easily switch between the two implementations
because toolbox modules do not have a notion of interfaces.

This commit adds a very primitive means for modules to declare and
implement interfaces: when a module declares an interface, a vtable
is allocated in the form of an associative array, and call stubs
are generated which call the functions referenced in the vtable.
A module that implements an interface can then override entries in
the interface's vtable.
toolbox.sh