Esempio n. 1
0
static inline char *potion_type_name(Potion *P, PN obj) {
  obj = potion_fwd(obj);
  return PN_IS_PTR(obj)
    ? AS_STR(potion_send(PN_VTABLE(PN_TYPE(obj)), PN_string))
    : PN_IS_NIL(obj) ? "nil"
      : PN_IS_NUM(obj) ? "Number"
        : "Boolean";
}
Esempio n. 2
0
PN potion_proto_string(Potion *P, PN cl, PN self) {
  vPN(Proto) t = (struct PNProto *)self;
  int x = 0;
  PN_SIZE num = 1;
  PN_SIZE numcols;
  PN out = potion_byte_str(P, "; function definition");
  pn_printf(P, out, ": %p ; %u bytes\n", t, PN_FLEX_SIZE(t->asmb));
  pn_printf(P, out, "; (");
  PN_TUPLE_EACH(t->sig, i, v, {
    if (PN_IS_NUM(v)) {
      if (v == '.')
        pn_printf(P, out, ". ");
      else if (v == '|')
        pn_printf(P, out, "| ");
      else
        pn_printf(P, out, "=%c, ", (int)PN_INT(v));
    } else
      potion_bytes_obj_string(P, out, v);
  });