32 PN vtable, obj_vt, num_vt;
100 #ifndef DISABLE_CALLCC
147 return c->method(P, cl, cl);
149 return c->method(P, cl, argv[0]);
151 return c->method(P, cl, argv[0], argv[1]);
153 return c->method(P, cl, argv[0], argv[1], argv[2]);
155 return c->method(P, cl, argv[0], argv[1], argv[2], argv[3]);
157 return c->method(P, cl, argv[0], argv[1], argv[2], argv[3], argv[4]);
159 return c->method(P, cl, argv[0], argv[1], argv[2], argv[3], argv[4],
162 return c->method(P, cl, argv[0], argv[1], argv[2], argv[3], argv[4],
165 return c->method(P, cl, argv[0], argv[1], argv[2], argv[3], argv[4],
166 argv[5], argv[6], argv[7]);
168 return c->method(P, cl, argv[0], argv[1], argv[2], argv[3], argv[4],
169 argv[5], argv[6], argv[7], argv[8]);
171 return c->method(P, cl, argv[0], argv[1], argv[2], argv[3], argv[4],
172 argv[5], argv[6], argv[7], argv[8], argv[9]);
174 return c->method(P, cl, argv[0], argv[1], argv[2], argv[3], argv[4],
175 argv[5], argv[6], argv[7], argv[8], argv[9], argv[10]);
177 return c->method(P, cl, argv[0], argv[1], argv[2], argv[3], argv[4],
178 argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11]);
180 return c->method(P, cl, argv[0], argv[1], argv[2], argv[3], argv[4],
181 argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11],
184 return c->method(P, cl, argv[0], argv[1], argv[2], argv[3], argv[4],
185 argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11],
188 return c->method(P, cl, argv[0], argv[1], argv[2], argv[3], argv[4],
189 argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11],
190 argv[12], argv[13], argv[14]);
246 "** Where: (line %ld, character %ld) %s\n",
PN_STR_PTR(e->message),
279 #define PN_EXIT_ERROR 1
280 #define PN_EXIT_FATAL 2
283 fprintf(stderr,
"** %s\n", message);
292 ((
struct PNBytes *
volatile)out)->len = 0;
296 fprintf(stderr,
"** Syntax error: %s at \"%s\", line %d\n",
PN_STR_PTR(out),
322 printf(
"%s (%s)\n", d, t);
324 #define pdump(data) potion_dump(P, data)
332 #if POTION_STACK_DIR > 0
340 printf(
"-- dumping %ld stack from %p to %p --\n", n, start, end);
341 printf(
" ebp = %p, *ebp = 0x%lx\n", ebp, *ebp);
344 printf(
" stack(%ld) = %p: 0x%lx", n, start, *start);
346 printf(
" vt=%x prot",
PN_TYPE(o));
348 printf(
" vt=%x birth",
PN_TYPE(o));
350 printf(
" vt=%x OLD",
PN_TYPE(o));
355 printf(
" %ld INT\n",
PN_INT(*start));
357 printf(
" %s BOOL\n", *start == 2 ?
"false" :
"true");
void potion_dump_stack(Potion *P)
void potion_dump(Potion *P, PN data)
PN potion_delegated(Potion *P, PN closure, PN self)
static void potion_init(Potion *P)
#define PN_FLEX_NEW(N, V, T, S)
PN potion_bytes(Potion *, size_t)
PN potion_def_method(Potion *P, PN closure, PN self, PN key, PN method)
define a method for a class
void potion_destroy(Potion *P)
PN line
PNString of src line.
#define PN_FLEX_NEEDS(X, N, V, T, S)
byte strings are raw character data, volatile, may be appended/changed.
void potion_table_init(Potion *)
unsigned long potion_rand_int(void)
generates a random number on [0,0xffffffff]-interval
#define PN_ALLOC_N(V, T, C)
PN PN_allocate
common method names in GC protected area
PN potion_error_string(Potion *P, PN cl, PN self)
struct to wrap arbitrary data that we may want to allocate from Potion.
void potion_lobby_init(Potion *P)
#define potion_method(RCV, MSG, FN, SIG)
void potion_cont_init(Potion *P)
#define IN_BIRTH_REGION(p)
void potion_num_init(Potion *P)
static PN potion_fwd(PN)
the potion type is the 't' in the vtable tuple (m,t)
struct PNMemory * mem
allocator/gc
char potion_type_char(PNType type)
valid signature types syntax.y: arg-type = ('s' | 'S' | 'n' | 'N' | 'b' | 'B' | 'k' | 't' | 'o' | 'O'...
PN_SIZE fileno
currently parsed file
void potion_file_init(Potion *P)
set Env global
static char * potion_type_name(Potion *P, PN obj)
void * cstack
machine stack start
void potion_primitive_init(Potion *)
standard objects act like C structs the fields are defined by the type and it's a fixed size...
Potion * potion_gc_boot(void *sp)
void potion_lick_init(Potion *P)
PN potion_io_error(Potion *P, const char *msg)
PN potion_type_error(Potion *P, PN obj)
void potion_syntax_error(Potion *P, struct PNSource *t, const char *fmt,...)
#define IN_OLDER_REGION(p)
void potion_object_init(Potion *P)
PN potion_error(Potion *P, PN msg, long lineno, long charno, PN excerpt)
PNFlex *volatile vts
built in types
an error, including a description, file location, a brief excerpt.
PN potion_str_format(Potion *, const char *,...) __attribute__((format(printf
void potion_esp(void **esp)
PN potion_type_new(Potion *P, PNType t, PN self)
create a non-user type, derived from self
Potion * potion_create(void *sp)
the potion API
PN potion_call(Potion *P, PN cl, PN_SIZE argc, PN *volatile argv)
PN potion_allocate(Potion *P, PN cl, PN self, PN len)
the global interpreter state P. currently singleton (not threads yet)
PN_SIZE pn_printf(Potion *, PN, const char *,...) __attribute__((format(printf
PNType potion_kind_of(PN obj)
void potion_loader_init(Potion *P)
void potion_error_init(Potion *P)
void potion_str_init(Potion *)
#define IS_GC_PROTECTED(p)
void potion_str_hash_init(Potion *)
static PNType potion_type(PN obj)
either immediate (NUM,BOOL,NIL) or a fwd
the central table type, based on core/khash.h
void potion_compiler_init(Potion *P)
PN potion_lookup(Potion *P, PN closure, PN self, PN key)
used in bind and def_method
#define potion_send(RCV, MSG, ARGS...)
method caches (more great stuff from ian piumarta)
PN potion_type_error_want(Potion *P, const char *param, PN obj, const char *type)
void potion_source_init(Potion *P)
void potion_p(Potion *P, PN x)
void potion_allocation_error(void)
struct PNSource::@1 loc
bitfield of fileno and lineno
void potion_vm_init(Potion *)
void potion_fatal(char *message)
void potion_gc_release(Potion *P)