Esempio n. 1
0
void *mk_box2(unsigned ctor, void *x0, void *x1) {
  struct rml_struct *p = alloc_words(3);
  p->header = RML_STRUCTHDR(2, ctor);
  p->data[0] = x0;
  p->data[1] = x1;
  return RML_TAGPTR(p);
}
Esempio n. 2
0
RML_END_LABEL


/* list-arr.c */
RML_BEGIN_LABEL(RML__list_5farray)
{
    rml_uint_t nelts = 0;

    /* first compute the length of the list */
    {
	void *lst = rmlA0;
	for(; RML_GETHDR(lst) == RML_CONSHDR; ++nelts, lst = RML_CDR(lst))
	    ;
    }
    /* then allocate and initialize the vector */
    {
	struct rml_struct *vec = (struct rml_struct*)rml_prim_alloc(1+nelts, 1);
	void *lst = rmlA0;
	void **vecp = vec->data;
	vec->header = RML_STRUCTHDR(nelts, 0);
	rmlA0 = RML_TAGPTR(vec);
	for(; nelts > 0; --nelts, lst = RML_CDR(lst))
	    *vecp++ = RML_CAR(lst);
    }
    RML_TAILCALLK(rmlSC);
}
Esempio n. 3
0
void *mk_box1(unsigned ctor, void *x0)
{
    struct rml_struct *p = alloc_words(2);
    p->header = RML_STRUCTHDR(1, ctor);
    p->data[0] = x0;
    return RML_TAGPTR(p);
}
Esempio n. 4
0
void *mk_box3(unsigned ctor, void *x0, void *x1, void *x2) {
  struct rml_struct *p = alloc_words(4);
  p->header = RML_STRUCTHDR(3, ctor);
  p->data[0] = x0;
  p->data[1] = x1;
  p->data[2] = x2;
  return RML_TAGPTR(p);
}
Esempio n. 5
0
void *mk_box4(unsigned ctor, void *x0, void *x1, void *x2, void *x3) {
  struct rml_struct *p = alloc_words(5);
  p->header = RML_STRUCTHDR(4, ctor);
  p->data[0] = x0;
  p->data[1] = x1;
  p->data[2] = x2;
  p->data[3] = x3;
  return RML_TAGPTR(p);
}
Esempio n. 6
0
void *mk_box6(unsigned ctor, void *x0, void *x1, void *x2, void *x3, void *x4,
    void *x5) {
  struct rml_struct *p = alloc_words(7);
  p->header = RML_STRUCTHDR(6, ctor);
  p->data[0] = x0;
  p->data[1] = x1;
  p->data[2] = x2;
  p->data[3] = x3;
  p->data[4] = x4;
  p->data[5] = x5;
  return RML_TAGPTR(p);
}
Esempio n. 7
0
void *mk_box8(unsigned ctor, void *x0, void *x1, void *x2, void *x3, void *x4,
    void *x5, void *x6, void *x7) {
  struct rml_struct *p = alloc_words(9);
  p->header = RML_STRUCTHDR(8, ctor);
  p->data[0] = x0;
  p->data[1] = x1;
  p->data[2] = x2;
  p->data[3] = x3;
  p->data[4] = x4;
  p->data[5] = x5;
  p->data[6] = x6;
  p->data[7] = x7;
  return RML_TAGPTR(p);
}
Esempio n. 8
0
void *mk_box0(unsigned ctor) {
  struct rml_struct *p = alloc_words(1);
  p->header = RML_STRUCTHDR(0, ctor);
  return RML_TAGPTR(p);
}
Esempio n. 9
0
void *mk_none(void) {
  static struct rml_header none = { RML_STRUCTHDR(0, 0) };
  return RML_TAGPTR(&none);
}