Allows one to register a JanetAbstractType with Janet.
One can add static string to the class by the name of "janetPackage", which will be prepended to its class name in Janet before a '/'.
For example: register class "Bar" with janetPackage "Foo" will result in "Foo/Bar".
This process may be made easier in a later version.
A registered class looks for the following functions:
- Janet __janetGet(void* data,Janet key)
- void __janetPut(void* data,Janet key,Janet value)
- void __janetMarshal (void* p, JanetMarshalContext* ctx)
- void __janetUnmarshal (void* p, JanetMarshalContext* ctx)
- void __janetTostring (void* p, JanetBuffer* buffer)
- int __janetGC (void* data, size_t len)
- int __janetGCMark (void* data, size_t len)
- Janet __janetNext (void* data, Janet key)
- int __janetHash (void* p, size_t len)
All of these are optional; get, put and hash will have defaults applied (see the source code for info) if either is not defined. Compare and call are automatically generated for types with opCmp and opCall respectively.
See Implementation
Allows one to register a JanetAbstractType with Janet.
One can add static string to the class by the name of "janetPackage", which will be prepended to its class name in Janet before a '/'.
For example: register class "Bar" with janetPackage "Foo" will result in "Foo/Bar".
This process may be made easier in a later version.
A registered class looks for the following functions:
- Janet __janetGet(void* data,Janet key)
- void __janetPut(void* data,Janet key,Janet value)
- void __janetMarshal (void* p, JanetMarshalContext* ctx)
- void __janetUnmarshal (void* p, JanetMarshalContext* ctx)
- void __janetTostring (void* p, JanetBuffer* buffer)
- int __janetGC (void* data, size_t len)
- int __janetGCMark (void* data, size_t len)
- Janet __janetNext (void* data, Janet key)
- int __janetHash (void* p, size_t len)
All of these are optional; get, put and hash will have defaults applied (see the source code for info) if either is not defined. Compare and call are automatically generated for types with opCmp and opCall respectively.