Subject: Re: Adding Built-ins

From: [email-masked] (Mike 'Hiccup' Wilson)
Date: Wed, 1 Dec 1993 12:27:53 -0800

yes, getting the args is now clear.  However,  I will need to pass back
a list (since a function can't return 3 values) ... this would be something
like this?
Var R;
R.type = TYPE_LIST;
r.v.list[0] = 1;
r.v.list[1].type = TYPE_LIST;
r.v.list[1].v.list[0] = 3;
r.v.list[1].v.list[1..3].type = TYPE_NUM;
r.v.list[1].v.list[1..3].num = (my 3 ints);
return make_var_pack(r);

(does that look basically right?)

also ... while I'm writing, to save me the time of digging more in the code,
how and do I need to malloc (or call your malloc) to allocate the list that
I intend to return?
-Mike

---

From: Pavel Curtis <[email-masked]>
Date: Wed, 1 Dec 1993 14:42:39 -0800

> Date:	Wed, 1 Dec 1993 12:27:53 -0800
> From:	[email-masked] (Mike 'Hiccup' Wilson)
> 
> R.type = TYPE_LIST;					/**/
> r.v.list[0] = 1;					/**/
> r.v.list[1].type = TYPE_LIST;				/**/
> r.v.list[1].v.list[0] = 3;				/**/

Replace the lines marked with `/**/' above with

		r = new_list(3);

That does the allocation and the boilerplate part of the initialization for
you.  Then, in the remaining two lines, remove the `.v.list[1]' part near the
beginning; what you've got there manipulates nested lists, which you don't
have.  You want this:

		r.v.list[1..3].type = TYPE_NUM;
		r.v.list[1..3].v.num = (your 3 ints);

OK?

	Pavel