On 21/08/2013, at 12:36 PM, travisbrady wrote:
Please note you have to run
make bootstrap
after building Felix with Python. That rebuilds Felix using Felix.
That build is complete. The Python build is not.
Also my current usage is that I do not install Felix. I just use it where
it got built eg
build/release/host/bin/flx --test=build/release .......
> build/release/cache/text/Users/travisbrady/code/hub/felix/src/tools/flx.cpp:2388:13:
> fatal error: incomplete type 'void' is not assignable last = last; //
> original lists tail ~~~~~ ^ 1 error generated.
Commit [master 475c990] Fix bug #45.
Should fix this bug. Sorry about that!
The problem is a bit nasty. In the library we had floating body insertion which
used to read:
{ // in place reversal returns tail as well
struct node_t { ?1 elt; void *tail; };
void *nutail = (void*)0; // new temp tail
void *cur = *$1; // list to reverse
void *last = cur; // save head
while(cur)
{
void *oldtail = ((node_t*)FLX_VNP(cur))->tail; // set old
tail to current's tail
((node_t*)FLX_VNP(cur))->tail = nutail; // set
current's tail to nutail
nutail = cur; // set nutail
to current
cur = oldtail; // set current
to old tail
}
*$1 = nutail; // reversed
list
*$2 = last; // original
lists tail
}
The problem is that if argument $2 is set to expression "last" it is confused
with the local variable "last". To fix this I have changed the library to read:
proc rev_last[T,PLT=&list[T]] : &list[T] * &list[T] =
"_rev_last($1,$2,(?1*)0);" requires _rev_last_[T,PLT];
body _rev_last_[T,PLT]=
"""
static void _rev_last(?2 p1, ?2 p2, ?1*)
{ // in place reversal returns tail as well
struct node_t { ?1 elt; void *tail; };
void *nutail = (void*)0; // new temp tail
void *cur = *p1; // list to reverse
void *last = cur; // save head
while(cur)
{
void *oldtail = ((node_t*)FLX_VNP(cur))->tail; // set old
tail to current's tail
((node_t*)FLX_VNP(cur))->tail = nutail; // set
current's tail to nutail
nutail = cur; // set nutail
to current
cur = oldtail; // set current
to old tail
}
*p1 = nutail; // reversed
list
*p2 = last; // original
lists tail
}
"""
;
Now the arguments are p1 and p2 instead of $1 and $2 and the binding
is done in the proc rev_last call:
_rev_last($1,$2,(?1*)0)
Note the dummy argument, to ensure the overload takes account
of the first type argument ?1.
In fact even this may fail if Felix uses two distinct names for the
same type (which it does sometimes ..)
[I am still testing this patch, if I got the rewrite of rev_last wrong
all hell will break loose on list operations]
--
john skaller
[email protected]
http://felix-lang.org
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language