[Ecls-list] with-local-gmp
Erik Winkels
aerique at xs4all.nl
Sat Feb 7 09:59:03 UTC 2004
Hi,
It's been a while since I've done any real coding so please bear with
my simple question: How do I use cl_write_object?
I've grepped through the documentation for "write_object" and checked
the ECL sources but it has yet to dawn on me how to use the function.
(I haven't tried the mailinglist archives: SourceForge won't let me
search them.)
See the simple code example at the end of this e-mail. Is it possible
to use the function in more-or-less this manner?
I like to use the power of _write_object from c/print.d in the ECL
sources so that I don't have to write something similar in my own code
as I do now in the if-clause of the code below.
Thanks,
Erik.
---------------------------- code snippet start ---------------------
#include "ecl.h"
#define MAX_STRING_LENGTH 80
int main (int argc, char *argv[])
{
cl_object form, result;
char string[MAX_STRING_LENGTH + 1] = {'\0'};
cl_boot(argc, argv);
while (1)
{
printf("? ");
fgets(string, MAX_STRING_LENGTH, stdin);
form = c_string_to_object(string);
result = si_safe_eval(1, form);
if (type_of(result) == t_string) {
printf("\"%s\"\n", result->string.self);
} else {
printf("Output format not implemented. "
"Trying cl_write_object: ");
cl_write_object(result);
printf("\n");
}
}
return 0;
}
-------------------------- code snippet end --------------------------
More information about the ecl-devel
mailing list