I took the liberty of already adding the API to compose Yacas expression trees, executing them, and pulling them apart. This is just a preliminary stab at it, we can change it of course (removing void* for something else say). It was relatively little work.
You can get it from our cvs tree at sourceforge. libcyacas.a is the library, src/cyacas.h defines the interface. I rolled a little example embed/example4.c. If you run it you see the spectacular calculation "1+1" being performed :-) Input> (+ 1 1 ) Output> 2 The source code for this can be found below, to give you an indication of how this API would work. What do you think? Would that work for you? Ayal #include <stdio.h> #include "cyacas.h" int verbose_debug = 0; // avoid linkage error void print_expr(void* object) { if (object == NULL) return; if (yacas_object_is_sublist(object)) { printf("("); print_expr(yacas_get_sublist(object)); printf(")"); } else { printf("%s ",yacas_get_atom(object)); print_expr(yacas_get_next(object)); } } void runexpr(void* object) { printf("Input> "); print_expr(object); printf("\n"); void* result = yacas_execute(object); printf("Output> "); print_expr(result); printf("\n"); yacas_delete_object(result); } int main(int argc, char** argv) { int i; yacas_init(); void *input = yacas_create_sublist( yacas_link_objects( yacas_create_atom("+"), yacas_link_objects( yacas_create_atom("1"), yacas_create_atom("1") ) ) ); runexpr(input); yacas_delete_object(input); yacas_exit(); return 0; } [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel