potion
0.2
|
objects, classes, types, methods, weakrefs and mop. More...
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include "potion.h"
#include "internal.h"
#include "khash.h"
#include "table.h"
#include "asm.h"
Go to the source code of this file.
Functions | |
PN | potion_closure_new (Potion *P, PN_F meth, PN sig, PN_SIZE extra) |
int | potion_sig_arity (Potion *P, PN sig) |
number of args of sig tuple, implements the potion_closure_arity method. More... | |
int | potion_sig_minargs (Potion *P, PN sig) |
number of mandatory args, without any optional arguments More... | |
PN | potion_sig_at (Potion *P, PN sig, int index) |
PN | potion_sig_name_at (Potion *P, PN sig, int index) |
PN | potion_no_call (Potion *P, PN cl, PN self) |
void | potion_add_metaclass (Potion *P, vPN(Vtable) vt) |
PN | potion_type_new (Potion *P, PNType t, PN self) |
create a non-user type, derived from self More... | |
PN | potion_type_new2 (Potion *P, PNType t, PN self, PN name) |
create a named type More... | |
void | potion_type_call_is (PN vt, PN cl) |
sets the default call method of the PNVtable More... | |
PN | potion_obj_get_call (Potion *P, PN obj) |
get the default accessor (usually "at") More... | |
void | potion_type_callset_is (PN vt, PN cl) |
set default writer More... | |
PN | potion_obj_get_callset (Potion *P, PN obj) |
get default writer More... | |
void | potion_type_constructor_is (PN vt, PN cl) |
set default constructor More... | |
PN | potion_class (Potion *P, PN cl, PN self, PN ivars) |
create a user-class (ie type) More... | |
PN | potion_class_find (Potion *P, PN name) |
find class by name. At first only system metaclasses (types), no user classes yet. More... | |
PNType | potion_class_type (Potion *P, PN class) |
PN | potion_ivars (Potion *P, PN cl, PN self, PN ivars) |
static long | potion_obj_find_ivar (Potion *P, PN self, PN ivar) |
PN | potion_obj_get (Potion *P, PN cl, PN self, PN ivar) |
implements OP_GETPATH More... | |
PN | potion_obj_set (Potion *P, PN cl, PN self, PN ivar, PN value) |
implements OP_SETPATH More... | |
PN | potion_proto_method (Potion *P, PN cl, PN self, PN args) |
only used in def_method More... | |
PN | potion_getter_method (Potion *P, PN cl, PN self) |
only used in def_method More... | |
PN | potion_def_method (Potion *P, PN closure, PN self, PN key, PN method) |
define a method for a class More... | |
PN | potion_lookup (Potion *P, PN closure, PN self, PN key) |
used in bind and def_method More... | |
PN | potion_bind (Potion *P, PN rcv, PN msg) |
find method for given receiver and message (method lookup) More... | |
PN | potion_message (Potion *P, PN rcv, PN msg) |
PN | potion_obj_add (Potion *P, PN a, PN b) |
PN | potion_obj_sub (Potion *P, PN a, PN b) |
PN | potion_obj_mult (Potion *P, PN a, PN b) |
PN | potion_obj_div (Potion *P, PN a, PN b) |
PN | potion_obj_rem (Potion *P, PN a, PN b) |
PN | potion_obj_bitn (Potion *P, PN a) |
PN | potion_obj_bitl (Potion *P, PN a, PN b) |
PN | potion_obj_bitr (Potion *P, PN a, PN b) |
static void | potion_init_class_reference (Potion *P, PN name, PN vt) |
void | potion_define_global (Potion *P, PN name, PN val) |
void | potion_object_init (Potion *P) |
void | potion_lobby_init (Potion *P) |
objects, classes, types, methods, weakrefs and mop.
much of this is based on the work of ian piumarta http://www.piumarta.com/pepsi/objmodel.pdf
Definition in file objmodel.c.
Definition at line 17 of file objmodel.c.
number of args of sig tuple, implements the potion_closure_arity method.
sigs are encoded as tuples of len 2-3, (name type|modifier [default-value]) names String, modifiers Num. types also Num, but want to switch to special SIG VTable. default-value can be a value of any type and is prefixed with ':'
Definition at line 82 of file objmodel.c.
number of mandatory args, without any optional arguments
Definition at line 107 of file objmodel.c.
Definition at line 131 of file objmodel.c.
Definition at line 165 of file objmodel.c.
Definition at line 193 of file objmodel.c.
create a non-user type, derived from self
Definition at line 207 of file objmodel.c.
create a named type
Definition at line 219 of file objmodel.c.
sets the default call method of the PNVtable
Definition at line 225 of file objmodel.c.
get the default accessor (usually "at")
Definition at line 229 of file objmodel.c.
set default writer
Definition at line 235 of file objmodel.c.
get default writer
Definition at line 239 of file objmodel.c.
set default constructor
Definition at line 245 of file objmodel.c.
create a user-class (ie type)
cl | PNClosure or nil, set the ctor, uses the parent ctor if nil |
self | PNVtable the parent class, lobby or another type |
ivars | PNTuple of object members |
Definition at line 252 of file objmodel.c.
find class by name. At first only system metaclasses (types), no user classes yet.
Definition at line 275 of file objmodel.c.
Definition at line 285 of file objmodel.c.
Definition at line 305 of file objmodel.c.
implements OP_GETPATH
Definition at line 322 of file objmodel.c.
implements OP_SETPATH
Definition at line 329 of file objmodel.c.
only used in def_method
Definition at line 338 of file objmodel.c.
only used in def_method
Definition at line 342 of file objmodel.c.
define a method for a class
Definition at line 346 of file objmodel.c.
used in bind and def_method
Definition at line 391 of file objmodel.c.
find method for given receiver and message (method lookup)
Definition at line 403 of file objmodel.c.
Definition at line 450 of file objmodel.c.
Definition at line 614 of file objmodel.c.
Definition at line 622 of file objmodel.c.
void potion_object_init | ( | Potion * | P | ) |
Definition at line 663 of file objmodel.c.
void potion_lobby_init | ( | Potion * | P | ) |
Definition at line 682 of file objmodel.c.