potion
0.2
|
The potion API. More...
Go to the source code of this file.
Data Structures | |
struct | PNObject |
standard objects act like C structs the fields are defined by the type and it's a fixed size, not volatile. More... | |
struct | PNFwd |
forwarding pointer (in case of reallocation) More... | |
struct | PNData |
struct to wrap arbitrary data that we may want to allocate from Potion. More... | |
struct | PNString |
strings are immutable UTF-8, the ID is incremental and they may be garbage collected. More... | |
struct | PNBytes |
byte strings are raw character data, volatile, may be appended/changed. More... | |
struct | PNDouble |
doubles are floating point numbers stored as binary data. More... | |
struct | PNFile |
a file is wrapper around a file descriptor, non-volatile but mutable. More... | |
struct | PNClosure |
a closure is an anonymous function, without closed values, More... | |
struct | PNSource |
struct | PNProto |
a prototype is compiled source code, a closure block (lambda) non-volatile. More... | |
class | PNTuple |
a tuple is an array of PNs. More... | |
struct | PNWeakRef |
a weak ref is used for upvals, it acts as a memory slot, non-volatile but mutable. More... | |
struct | PNError |
an error, including a description, file location, a brief excerpt. More... | |
struct | PNLick |
a lick is a unit of generic tree data. More... | |
struct | PNCont |
a continuation saves the stack and all stack pointers. More... | |
struct | PNAsm |
struct | PNTarget |
definition of the jit targets: x86, ppc, arm More... | |
struct | Potion_State |
the global interpreter state P. currently singleton (not threads yet) More... | |
struct | PNMemory |
the garbage collector More... | |
Macros | |
#define | POTION_SIG "p\07\10n" |
#define | POTION_VMID 0x79 |
#define | POTION_X86 0 |
#define | POTION_PPC 1 |
#define | POTION_ARM 2 |
#define | DLLEXPORT |
#define | _XSTR(s) _STR(s) |
#define | _STR(s) #s |
#define | ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS __attribute__((no_address_safety_analysis)) |
#define | YY_DEBUG |
#define | __WORDSIZE 64 |
#define | PN_TNIL 0x250000 |
#define | PN_TNUMBER (1+PN_TNIL) |
#define | PN_TBOOLEAN (2+PN_TNIL) |
#define | PN_TDOUBLE (3+PN_TNIL) |
#define | PN_TINTEGER (4+PN_TNIL) |
#define | PN_TSTRING (5+PN_TNIL) |
#define | PN_TWEAK (6+PN_TNIL) |
#define | PN_TCLOSURE (7+PN_TNIL) |
#define | PN_TTUPLE (8+PN_TNIL) |
#define | PN_TSTATE (9+PN_TNIL) |
#define | PN_TFILE (10+PN_TNIL) |
#define | PN_TOBJECT (11+PN_TNIL) |
#define | PN_TVTABLE (12+PN_TNIL) |
#define | PN_TSOURCE (13+PN_TNIL) |
#define | PN_TBYTES (14+PN_TNIL) |
#define | PN_TPROTO (15+PN_TNIL) |
#define | PN_TLOBBY (16+PN_TNIL) |
#define | PN_TTABLE (17+PN_TNIL) |
#define | PN_TLICK (18+PN_TNIL) |
#define | PN_TFLEX (19+PN_TNIL) |
#define | PN_TSTRINGS (20+PN_TNIL) |
#define | PN_TERROR (21+PN_TNIL) |
#define | PN_TCONT (22+PN_TNIL) |
#define | PN_TUSER (23+PN_TNIL) |
#define | vPN(t) struct PN##t * volatile |
#define | PN_TYPE(x) potion_type((PN)(x)) |
#define | PN_VTYPE(x) (((struct PNObject *)(x))->vt) |
#define | PN_TYPE_ID(t) ((t)-PN_TNIL) |
#define | PN_VTABLE(t) (PN_FLEX_AT(P->vts, PN_TYPE_ID(t))) |
#define | PN_TYPECHECK(t) (PN_TYPE_ID(t) >= 0 && PN_TYPE_ID(t) < PN_FLEX_SIZE(P->vts)) |
#define | PN_NIL ((PN)0) |
#define | PN_ZERO ((PN)1) |
#define | PN_FALSE ((PN)2) |
#define | PN_TRUE ((PN)6) |
#define | PN_PRIMITIVE 7 |
#define | PN_REF_MASK ~7 |
#define | PN_NONE ((PN_SIZE)-1) |
#define | POTION_FWD 0xFFFFFFFE |
#define | POTION_COPIED 0xFFFFFFFF |
#define | NIL_NAME "nil" |
#define | NILKIND_NAME "NilKind" |
#define | PN_FINTEGER 1 |
#define | PN_FBOOLEAN 2 |
#define | PN_TEST(v) ((PN)(v) != PN_FALSE && (PN)(v) != PN_NIL) |
#define | PN_BOOL(v) ((v) ? PN_TRUE : PN_FALSE) |
#define | PN_IS_PTR(v) (!PN_IS_INT(v) && ((PN)(v) & PN_REF_MASK)) |
#define | PN_IS_NIL(v) ((PN)(v) == PN_NIL) |
#define | PN_IS_BOOL(v) ((PN)(v) & PN_FBOOLEAN) |
#define | PN_IS_INT(v) ((PN)(v) & PN_FINTEGER) |
#define | PN_IS_DBL(v) (PN_IS_PTR(v) && ({PNType _t = potion_qptr_type((PN)v); _t == PN_TNUMBER || _t == PN_TDOUBLE;})) |
#define | PN_IS_NUM(v) (PN_IS_INT(v) || PN_IS_DBL(v)) |
#define | PN_IS_TUPLE(v) (PN_IS_PTR(v) && (potion_ptr_type((PN)v) == PN_TTUPLE)) |
#define | PN_IS_STR(v) (PN_IS_PTR(v) && (potion_ptr_type((PN)v) == PN_TSTRING)) |
#define | PN_IS_TABLE(v) (PN_IS_PTR(v) && (potion_ptr_type((PN)v) == PN_TTABLE)) |
#define | PN_IS_CLOSURE(v) (PN_IS_PTR(v) && (potion_ptr_type((PN)v) == PN_TCLOSURE)) |
#define | PN_IS_PROTO(v) (PN_IS_PTR(v) && (potion_ptr_type((PN)v) == PN_TPROTO)) |
#define | PN_IS_REF(v) (PN_IS_PTR(v) && (potion_ptr_type((PN)v) == PN_TWEAK)) |
#define | PN_IS_METACLASS(v) (((struct PNVtable *)v)->meta == PN_NIL) |
#define | PN_IS_FFIPTR(p) |
#define | PN_CHECK_STR(obj) if (!PN_IS_STR(obj)) return potion_type_error_want(P, ""#obj, (PN)obj, "String") |
#define | PN_CHECK_STRB(obj) if (!PN_IS_STR(obj) || (PN_TYPE(obj) != PN_TBYTES)) return potion_type_error_want(P, ""#obj, (PN)obj, "String or Bytes") |
#define | PN_CHECK_NUM(obj) if (!PN_IS_NUM(obj)) return potion_type_error_want(P, ""#obj, (PN)obj, "Number") |
#define | PN_CHECK_INT(obj) if (!PN_IS_INT(obj)) return potion_type_error_want(P, ""#obj, (PN)obj, "Integer") |
#define | PN_CHECK_DBL(obj) if (!PN_IS_DBL(obj)) return potion_type_error_want(P, ""#obj, (PN)obj, "Double") |
#define | PN_CHECK_BOOL(obj) if (!PN_IS_BOOL(obj)) return potion_type_error_want(P, ""#obj, (PN)obj, "Bool") |
#define | PN_CHECK_TUPLE(obj) if (!PN_IS_TUPLE(obj)) return potion_type_error_want(P, ""#obj, (PN)obj, "Tuple") |
#define | PN_CHECK_CLOSURE(obj) if (!PN_IS_CLOSURE(obj)) return potion_type_error_want(P, ""#obj, (PN)obj, "Closure") |
#define | PN_CHECK_TYPE(obj, type) if (type != PN_TYPE(obj)) return potion_type_error(P, (PN)obj) |
#define | DBG_CHECK_TYPE(obj, type) PN_CHECK_TYPE(obj,type) |
#define | DBG_CHECK_NUM(obj) PN_CHECK_NUM(obj) |
#define | DBG_CHECK_INT(obj) PN_CHECK_INT(obj) |
#define | DBG_CHECK_DBL(obj) PN_CHECK_DBL(obj) |
#define | DBG_CHECK_TUPLE(obj) PN_CHECK_TUPLE(obj) |
#define | PN_NUM(i) ((PN)((((long)(i))<<1) + PN_FINTEGER)) |
#define | PN_INT(x) ((long)((long)(x))>>1) |
#define | PN_DBL(num) (PN_IS_INT(num) ? (double)PN_INT(num) : ((struct PNDouble *)num)->value) |
#define | PN_PREC 16 |
#define | PN_RAND() PN_NUM(potion_rand_int()) |
#define | PN_STR(x) potion_str(P, x) |
#define | PN_STRN(x, l) potion_str2(P, x, l) |
#define | PN_STRCAT(a, b) potion_strcat(P, (a), (b)) |
#define | PN_TOUCH(x) potion_gc_update(P, (PN)(x)) |
#define | PN_ALIGN(o, x) (((((o) - 1) / (x)) + 1) * (x)) |
#define | PN_OBJECT_HEADER |
#define | PN_FLEX(N, T) typedef struct { PN_OBJECT_HEADER; PN_SIZE len; PN_SIZE siz; T ptr[]; } N |
#define | PN_FLEX_AT(N, I) ((PNFlex *)(N))->ptr[I] |
#define | PN_FLEX_SIZE(N) ((PNFlex *)(N))->len |
#define | PN_NUMHASH(x) (PNUniq)((x)>>33^(x)^(x)<<11) |
#define | PN_UNIQ(x) (PN_IS_PTR(x) ? ((struct PNObject *)(x))->uniq : PN_NUMHASH(x)) |
#define | AS_STR(x) PN_STR_PTR(potion_send(x, PN_string)) |
#define | DBG_t(...) if (P->flags & DEBUG_TRACE) fprintf(stderr, __VA_ARGS__) |
#define | DBG_v(...) if (P->flags & DEBUG_VERBOSE) fprintf(stderr, __VA_ARGS__) |
#define | DBG_vt(...) if (P->flags & DEBUG_VERBOSE && P->flags & DEBUG_TRACE) fprintf(stderr, __VA_ARGS__) |
#define | DBG_vi(...) if (P->flags & DEBUG_VERBOSE && P->flags & DEBUG_INSPECT) fprintf(stderr, __VA_ARGS__) |
#define | DBG_c(...) if (P->flags & DEBUG_COMPILE) fprintf(stderr, __VA_ARGS__) |
#define | PN_MANTISSA(d, n) d->real[1 + n] |
PN_MANTISSA the last part of ->real. More... | |
#define | PN_QUICK_FWD(t, obj) |
PN_QUICK_FWD - doing a single fwd check after a possible realloc. More... | |
#define | OP_MAX 50 |
the jit More... | |
#define | EXEC_BITS 4 |
0-4 More... | |
#define | POTION_INIT_STACK(x) PN __##x = 0x571FF; void *x = (void *)&__##x |
#define | POTION_OK 0 |
internal errors More... | |
#define | POTION_NO_MEM 8910 |
#define | potion_send(RCV, MSG, ARGS...) |
method caches (more great stuff from ian piumarta) More... | |
#define | potion_method(RCV, MSG, FN, SIG) potion_send(RCV, PN_def, potion_str(P, MSG), PN_FUNC(FN, SIG)) |
#define | potion_class_method(RCV, MSG, FN, SIG) potion_send(((struct PNVtable *)(RCV))->meta, PN_def, potion_str(P, MSG), PN_FUNC(FN, SIG)) |
Typedefs | |
typedef unsigned long | _PN |
typedef unsigned int | PN_SIZE |
typedef unsigned int | PNType |
typedef unsigned int | PNUniq |
typedef struct Potion_State | Potion |
typedef volatile _PN | PN |
typedef _PN(* | PN_F )(Potion *, PN, PN,...) |
typedef void(* | OP_F )(Potion *P, struct PNProto *, PNAsm *volatile *,...) |
Enumerations | |
enum | PN_AST { AST_CODE, AST_VALUE, AST_ASSIGN, AST_NOT, AST_OR, AST_AND, AST_CMP, AST_EQ, AST_NEQ, AST_GT, AST_GTE, AST_LT, AST_LTE, AST_PIPE, AST_CARET, AST_AMP, AST_WAVY, AST_BITL, AST_BITR, AST_PLUS, AST_MINUS, AST_INC, AST_TIMES, AST_DIV, AST_REM, AST_POW, AST_MSG, AST_PATH, AST_QUERY, AST_PATHQ, AST_EXPR, AST_LIST, AST_BLOCK, AST_LICK, AST_PROTO, AST_DEBUG } |
An AST fragment, non-volatile. More... | |
enum | exec_mode_t { EXEC_VM = 0, EXEC_JIT = 1, EXEC_DEBUG = 2, EXEC_CHECK = 3, EXEC_COMPILE = 4, MAX_EXEC = 5 } |
the interpreter (one per thread, houses its own garbage collector) More... | |
enum | syntax_mode_t { MODE_STD = 1<<EXEC_BITS, MAX_SYNTAX = (1<<(EXEC_BITS+2))-1 } |
enum | Potion_Flags { DEBUG_INSPECT = 1<<(EXEC_BITS+2), DEBUG_VERBOSE = 1<<(EXEC_BITS+3), DEBUG_TRACE = 1<<(EXEC_BITS+4), DEBUG_PARSE = 1<<(EXEC_BITS+5), DEBUG_PARSE_VERBOSE = 1<<(EXEC_BITS+6), DEBUG_COMPILE = 1<<(EXEC_BITS+7), DEBUG_GC = 1<<(EXEC_BITS+8), DEBUG_JIT = 1<<(EXEC_BITS+9) } |
Variables | |
PN | PN_allocate |
common method names in GC protected area More... | |
PN | PN_break |
PN | PN_call |
PN | PN_class |
PN | PN_compile |
PN | PN_continue |
PN | PN_def |
PN | PN_delegated |
PN | PN_else |
PN | PN_elsif |
PN | PN_if |
PN | PN_lookup |
PN | PN_loop |
PN | PN_print |
PN | PN_return |
PN | PN_self |
PN | PN_string |
PN | PN_while |
PN | PN_add |
PN | PN_sub |
PN | PN_mult |
PN | PN_div |
PN | PN_rem |
PN | PN_bitn |
PN | PN_bitl |
PN | PN_bitr |
PN | PN_cmp |
PN | PN_number |
PN | PN_name |
PN | PN_length |
PN | PN_size |
PN | PN_STR0 |
PN | PN_extern |
PN | PN_integer |
PN | pn_filenames |
The potion API.
(c) 2008 why the lucky stiff, the freelance professor (c) 2013-2014 perl11.org
Definition in file potion.h.
#define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS __attribute__((no_address_safety_analysis)) |
#define PN_TYPE | ( | x | ) | potion_type((PN)(x)) |
#define PN_VTABLE | ( | t | ) | (PN_FLEX_AT(P->vts, PN_TYPE_ID(t))) |
#define PN_TYPECHECK | ( | t | ) | (PN_TYPE_ID(t) >= 0 && PN_TYPE_ID(t) < PN_FLEX_SIZE(P->vts)) |
#define PN_IS_PTR | ( | v | ) | (!PN_IS_INT(v) && ((PN)(v) & PN_REF_MASK)) |
#define PN_IS_BOOL | ( | v | ) | ((PN)(v) & PN_FBOOLEAN) |
#define PN_IS_INT | ( | v | ) | ((PN)(v) & PN_FINTEGER) |
#define PN_IS_DBL | ( | v | ) | (PN_IS_PTR(v) && ({PNType _t = potion_qptr_type((PN)v); _t == PN_TNUMBER || _t == PN_TDOUBLE;})) |
#define PN_IS_TUPLE | ( | v | ) | (PN_IS_PTR(v) && (potion_ptr_type((PN)v) == PN_TTUPLE)) |
#define PN_IS_STR | ( | v | ) | (PN_IS_PTR(v) && (potion_ptr_type((PN)v) == PN_TSTRING)) |
#define PN_IS_TABLE | ( | v | ) | (PN_IS_PTR(v) && (potion_ptr_type((PN)v) == PN_TTABLE)) |
#define PN_IS_CLOSURE | ( | v | ) | (PN_IS_PTR(v) && (potion_ptr_type((PN)v) == PN_TCLOSURE)) |
#define PN_IS_PROTO | ( | v | ) | (PN_IS_PTR(v) && (potion_ptr_type((PN)v) == PN_TPROTO)) |
#define PN_IS_REF | ( | v | ) | (PN_IS_PTR(v) && (potion_ptr_type((PN)v) == PN_TWEAK)) |
#define PN_IS_FFIPTR | ( | p | ) |
#define PN_CHECK_STR | ( | obj | ) | if (!PN_IS_STR(obj)) return potion_type_error_want(P, ""#obj, (PN)obj, "String") |
#define PN_CHECK_STRB | ( | obj | ) | if (!PN_IS_STR(obj) || (PN_TYPE(obj) != PN_TBYTES)) return potion_type_error_want(P, ""#obj, (PN)obj, "String or Bytes") |
#define PN_CHECK_NUM | ( | obj | ) | if (!PN_IS_NUM(obj)) return potion_type_error_want(P, ""#obj, (PN)obj, "Number") |
#define PN_CHECK_INT | ( | obj | ) | if (!PN_IS_INT(obj)) return potion_type_error_want(P, ""#obj, (PN)obj, "Integer") |
#define PN_CHECK_DBL | ( | obj | ) | if (!PN_IS_DBL(obj)) return potion_type_error_want(P, ""#obj, (PN)obj, "Double") |
#define PN_CHECK_BOOL | ( | obj | ) | if (!PN_IS_BOOL(obj)) return potion_type_error_want(P, ""#obj, (PN)obj, "Bool") |
#define PN_CHECK_TUPLE | ( | obj | ) | if (!PN_IS_TUPLE(obj)) return potion_type_error_want(P, ""#obj, (PN)obj, "Tuple") |
#define PN_CHECK_CLOSURE | ( | obj | ) | if (!PN_IS_CLOSURE(obj)) return potion_type_error_want(P, ""#obj, (PN)obj, "Closure") |
#define PN_CHECK_TYPE | ( | obj, | |
type | |||
) | if (type != PN_TYPE(obj)) return potion_type_error(P, (PN)obj) |
#define DBG_CHECK_TYPE | ( | obj, | |
type | |||
) | PN_CHECK_TYPE(obj,type) |
#define DBG_CHECK_NUM | ( | obj | ) | PN_CHECK_NUM(obj) |
#define DBG_CHECK_INT | ( | obj | ) | PN_CHECK_INT(obj) |
#define DBG_CHECK_DBL | ( | obj | ) | PN_CHECK_DBL(obj) |
#define DBG_CHECK_TUPLE | ( | obj | ) | PN_CHECK_TUPLE(obj) |
#define PN_NUM | ( | i | ) | ((PN)((((long)(i))<<1) + PN_FINTEGER)) |
#define PN_RAND | ( | ) | PN_NUM(potion_rand_int()) |
#define PN_STR | ( | x | ) | potion_str(P, x) |
#define PN_STRN | ( | x, | |
l | |||
) | potion_str2(P, x, l) |
#define PN_STRCAT | ( | a, | |
b | |||
) | potion_strcat(P, (a), (b)) |
#define PN_TOUCH | ( | x | ) | potion_gc_update(P, (PN)(x)) |
#define PN_OBJECT_HEADER |
#define PN_FLEX | ( | N, | |
T | |||
) | typedef struct { PN_OBJECT_HEADER; PN_SIZE len; PN_SIZE siz; T ptr[]; } N |
#define PN_UNIQ | ( | x | ) | (PN_IS_PTR(x) ? ((struct PNObject *)(x))->uniq : PN_NUMHASH(x)) |
#define AS_STR | ( | x | ) | PN_STR_PTR(potion_send(x, PN_string)) |
#define DBG_t | ( | ... | ) | if (P->flags & DEBUG_TRACE) fprintf(stderr, __VA_ARGS__) |
#define DBG_v | ( | ... | ) | if (P->flags & DEBUG_VERBOSE) fprintf(stderr, __VA_ARGS__) |
#define DBG_vt | ( | ... | ) | if (P->flags & DEBUG_VERBOSE && P->flags & DEBUG_TRACE) fprintf(stderr, __VA_ARGS__) |
#define DBG_vi | ( | ... | ) | if (P->flags & DEBUG_VERBOSE && P->flags & DEBUG_INSPECT) fprintf(stderr, __VA_ARGS__) |
#define DBG_c | ( | ... | ) | if (P->flags & DEBUG_COMPILE) fprintf(stderr, __VA_ARGS__) |
#define PN_MANTISSA | ( | d, | |
n | |||
) | d->real[1 + n] |
#define PN_QUICK_FWD | ( | t, | |
obj | |||
) |
PN_QUICK_FWD - doing a single fwd check after a possible realloc.
#define POTION_INIT_STACK | ( | x | ) | PN __##x = 0x571FF; void *x = (void *)&__##x |
#define potion_send | ( | RCV, | |
MSG, | |||
ARGS... | |||
) |
method caches (more great stuff from ian piumarta)
#define potion_method | ( | RCV, | |
MSG, | |||
FN, | |||
SIG | |||
) | potion_send(RCV, PN_def, potion_str(P, MSG), PN_FUNC(FN, SIG)) |
#define potion_class_method | ( | RCV, | |
MSG, | |||
FN, | |||
SIG | |||
) | potion_send(((struct PNVtable *)(RCV))->meta, PN_def, potion_str(P, MSG), PN_FUNC(FN, SIG)) |
typedef struct Potion_State Potion |
enum PN_AST |
An AST fragment, non-volatile.
enum exec_mode_t |
the interpreter (one per thread, houses its own garbage collector)
enum syntax_mode_t |
enum Potion_Flags |
|
inlinestatic |
PN_FLEX | ( | PNFlex | , |
PN | |||
) |
unsigned long potion_rand_int | ( | ) |
generates a random number on [0,0xffffffff]-interval
Definition at line 138 of file mt19937ar.c.
double potion_rand_double | ( | ) |
generates a random number on [0,1) with 53-bit resolution
Definition at line 154 of file mt19937ar.c.
|
inlinestatic |
Potion* potion_create | ( | void * | ) |
the potion API
Definition at line 120 of file internal.c.
void potion_destroy | ( | Potion * | ) |
Definition at line 133 of file internal.c.
void potion_fatal | ( | char * | ) |
Definition at line 282 of file internal.c.
void potion_allocation_error | ( | void | ) |
Definition at line 301 of file internal.c.
Definition at line 255 of file internal.c.
Definition at line 269 of file internal.c.
Definition at line 273 of file internal.c.
Definition at line 195 of file internal.c.
Definition at line 306 of file internal.c.
define a method for a class
Definition at line 346 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.
set default writer
Definition at line 235 of file objmodel.c.
set default constructor
Definition at line 245 of file objmodel.c.
char potion_type_char | ( | PNType | type | ) |
valid signature types syntax.y: arg-type = ('s' | 'S' | 'n' | 'N' | 'b' | 'B' | 'k' | 't' | 'o' | 'O' | '-' | '&') valid signature modifiers: '|' optional, '.
' end, ':' default
Definition at line 202 of file internal.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.
get the default accessor (usually "at")
Definition at line 229 of file objmodel.c.
get default writer
Definition at line 239 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.
Definition at line 143 of file internal.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 131 of file objmodel.c.
Definition at line 165 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 622 of file objmodel.c.
Definition at line 450 of file objmodel.c.
Potion* potion_gc_boot | ( | void * | sp | ) |
Potion actually begins by allocating an old area. This is for two reasons. First, the script may be too short to require an old area, so we want to avoid allocating two areas to start with. And second, since Potion loads its core classes into GC first, we save ourselves a severe promotion step by beginning with an automatic promotion to second generation. (Oh and this allows the core Potion struct pointer to be non-volatile.)
In short, this first page is never released, since the GC struct itself is on that page.
While this may pay a slight penalty in memory size for long-running scripts, perhaps I could add some occassional compaction to solve that as well.
void potion_lobby_init | ( | Potion * | ) |
Definition at line 682 of file objmodel.c.
void potion_object_init | ( | Potion * | ) |
Definition at line 663 of file objmodel.c.
void potion_error_init | ( | Potion * | ) |
Definition at line 250 of file internal.c.
void potion_primitive_init | ( | Potion * | ) |
Definition at line 77 of file primitive.c.
void potion_dump_stack | ( | Potion * | ) |
Definition at line 326 of file internal.c.
entrypoint for all bytecode methods from the C api.
cl | PNClosure to be called |
self | PN - sets self (ignored for most user defined functions). if self is a int < 10 it defines the number of args provided |
... | - arguments to the cl |
add = potion_eval(P, potion_str(P, "(x=N|y=N): x + y.")); addfn = PN_CLOSURE_F(add); // i.e. potion_vm_proto num = addfn(P, add, 2, PN_NUM(3), PN_NUM(5)); num = addfn(P, add, 1, PN_NUM(3)); // 1 arg provided, 2nd arg=0
Note that methods with optional arguments ... are not very safe to call. potion_vm_proto() does not know the number of arguments on the stack. So it checks for all optional args the matching type. You can help by providing numargs as self argument if numargs < 10.
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.
PN PN_allocate |
common method names in GC protected area
Definition at line 14 of file internal.c.
PN PN_break |
Definition at line 14 of file internal.c.
PN PN_call |
Definition at line 14 of file internal.c.
PN PN_class |
Definition at line 14 of file internal.c.
PN PN_compile |
Definition at line 14 of file internal.c.
PN PN_continue |
Definition at line 14 of file internal.c.
PN PN_def |
Definition at line 14 of file internal.c.
PN PN_delegated |
Definition at line 14 of file internal.c.
PN PN_else |
Definition at line 14 of file internal.c.
PN PN_elsif |
Definition at line 14 of file internal.c.
PN PN_if |
Definition at line 14 of file internal.c.
PN PN_lookup |
Definition at line 14 of file internal.c.
PN PN_loop |
Definition at line 14 of file internal.c.
PN PN_print |
Definition at line 14 of file internal.c.
PN PN_return |
Definition at line 14 of file internal.c.
PN PN_self |
Definition at line 14 of file internal.c.
PN PN_string |
Definition at line 14 of file internal.c.
PN PN_while |
Definition at line 14 of file internal.c.
PN PN_add |
Definition at line 17 of file internal.c.
PN PN_sub |
Definition at line 17 of file internal.c.
PN PN_mult |
Definition at line 17 of file internal.c.
PN PN_div |
Definition at line 17 of file internal.c.
PN PN_rem |
Definition at line 17 of file internal.c.
PN PN_bitn |
Definition at line 17 of file internal.c.
PN PN_bitl |
Definition at line 17 of file internal.c.
PN PN_bitr |
Definition at line 17 of file internal.c.
PN PN_cmp |
Definition at line 18 of file internal.c.
PN PN_number |
Definition at line 18 of file internal.c.
PN PN_name |
Definition at line 18 of file internal.c.
PN PN_length |
Definition at line 18 of file internal.c.
PN PN_size |
Definition at line 18 of file internal.c.
PN PN_STR0 |
Definition at line 18 of file internal.c.
PN PN_extern |
Definition at line 19 of file internal.c.
PN PN_integer |
Definition at line 19 of file internal.c.
PN pn_filenames |
Definition at line 23 of file internal.c.