This trivial code
process = ffunction(float func(float), "","");
compiled with "-fx" results in
output0[i0] = FAUSTFLOAT(nil(fixpoint_t(input0[i0])));
because ffname() always returns "nil" with -fx.
Why is that?
const char* ffname(Tree t)
{
Tree namelist = nth(ffsignature(t), 1);
return tree2str(nth(namelist, gGlobal->gFloatSize - 1));
}
assumes that "signature" in compiler/parser/faustparser.y creates the "name"
for every gFloatSize, but the gFloatSize == 4 case is not covered.
The patch below seems to fix the problem, but needs more documentation. With
this patch you can do
ffunction(float fun_single|fun_double|fun_quad|fun_fixpoint (...), ...);
IOW, you can also specify the name of "fixpoint" variant of foreign function.
Oleg.
diff --git a/compiler/parser/faustparser.y b/compiler/parser/faustparser.y
index ce1b60858..cc88db4a4 100644
--- a/compiler/parser/faustparser.y
+++ b/compiler/parser/faustparser.y
@@ -719,13 +719,15 @@ soundfile : SOUNDFILE LPAR uqstring PAR argument
RPAR
/* Description of foreign functions */
/* float sinhf|sinh|sinhl(float) */
-signature : type fun LPAR typelist RPAR { $$ =
cons($1, cons(cons($2,cons($2,cons($2,gGlobal->nil))), $4)); }
- | type fun OR fun LPAR typelist RPAR { $$ = cons($1,
cons(cons($2,cons($4,cons($4,gGlobal->nil))), $6)); }
- | type fun OR fun OR fun LPAR typelist RPAR { $$ = cons($1,
cons(cons($2,cons($4,cons($6,gGlobal->nil))), $8)); }
-
- | type fun LPAR RPAR { $$ = cons($1,
cons(cons($2,cons($2,cons($2,gGlobal->nil))), gGlobal->nil)); }
- | type fun OR fun LPAR RPAR { $$ = cons($1,
cons(cons($2,cons($4,cons($4,gGlobal->nil))), gGlobal->nil)); }
- | type fun OR fun OR fun LPAR RPAR { $$ =
cons($1, cons(cons($2,cons($4,cons($6,gGlobal->nil))), gGlobal->nil)); }
+signature : type fun LPAR typelist RPAR { $$
= cons($1, cons(cons($2,cons($2,cons($2,cons($2,gGlobal->nil)))), $4)); }
+ | type fun OR fun LPAR typelist RPAR { $$ =
cons($1, cons(cons($2,cons($4,cons($4,cons($4,gGlobal->nil)))), $6)); }
+ | type fun OR fun OR fun LPAR typelist RPAR { $$ =
cons($1, cons(cons($2,cons($4,cons($6,cons($6,gGlobal->nil)))), $8)); }
+ | type fun OR fun OR fun OR fun LPAR typelist RPAR { $$ =
cons($1, cons(cons($2,cons($4,cons($6,cons($8,gGlobal->nil)))), $10)); }
+
+ | type fun LPAR RPAR { $$ =
cons($1, cons(cons($2,cons($2,cons($2,cons($2,gGlobal->nil)))), gGlobal->nil));
}
+ | type fun OR fun LPAR RPAR { $$ =
cons($1, cons(cons($2,cons($4,cons($4,cons($4,gGlobal->nil)))), gGlobal->nil));
}
+ | type fun OR fun OR fun LPAR RPAR { $$ =
cons($1, cons(cons($2,cons($4,cons($6,cons($6,gGlobal->nil)))), gGlobal->nil));
}
+ | type fun OR fun OR fun OR fun LPAR RPAR { $$ =
cons($1, cons(cons($2,cons($4,cons($6,cons($8,gGlobal->nil)))), gGlobal->nil));
}
;
fun : IDENT
{ $$ = tree(FAUSTtext); }
_______________________________________________
Faudiostream-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-devel