This is an old revision of the document!
# Decker hacking
This page documents the modifications I've been making to Decker and to lil/lilt, the programming/scripting language it has.
## Patches
Patch to change the prompt to '%>
' and make it return a newline on exit
## C implementation notes
It seems like the norm is for interfaces to be defined in dom.h within the constants block. In order to avoid dom.h containing all the functionality implementations, it uses forward refs.
lv *interface_x(lv *self, lv *i, lv *x);
And then in the constants block, it's set as
dset(env, lmistr(“x”), lmi(interface_x, lmistr(“x”),NULL));
Later on, we can define the interface:
lv *interface_x(lv *self, lv *i, lv *x) {
return x?x:NONE;
}
Methods within the interface can be defined by first defining the actual function:
lv *n_x_method(lv *self, lv *a) {
if(a || !a) (void)self; return NONE;
}
followed by adding it in the interface definition with
ikey(“method”) return lmnat(n_x_method, self);
I think that if the last argument to lnmat isn't self then it would be a global method rather than part of the 'x' interface.
## Notes on the types
to turn a char* into a lil string: lv *r = lmutf8(chrstr) (don't forget to free() the chrstr)
to get the first arg of the lv *a inside a method, use l_first(a)
## methods i don't understand the function of yet:
lis(lv*) lil(lv*) lmistr(lv*) lmnat(lv*,lv*) - i think this is signalling that the method in question is a native function?