=================================================================== RCS file: /home/cvs/OpenXM/src/ox_toolkit/cmo.c,v retrieving revision 1.5 retrieving revision 1.10 diff -u -p -r1.5 -r1.10 --- OpenXM/src/ox_toolkit/cmo.c 2003/01/13 12:03:12 1.5 +++ OpenXM/src/ox_toolkit/cmo.c 2003/03/30 08:05:22 1.10 @@ -1,5 +1,5 @@ /* -*- mode: C; coding: euc-japan -*- */ -/* $OpenXM: OpenXM/src/ox_toolkit/cmo.c,v 1.4 2003/01/11 11:42:31 ohara Exp $ */ +/* $OpenXM: OpenXM/src/ox_toolkit/cmo.c,v 1.9 2003/03/23 20:17:34 ohara Exp $ */ /* This module includes functions for sending/receiveng CMO's. @@ -19,6 +19,7 @@ static char* new_string_set_cmo_null(); static char* new_string_set_cmo_int32(int integer); static char* new_string_set_cmo_list(cmo_list *c); static char* new_string_set_cmo_zz(cmo_zz *c); +static char* new_string_set_cmo_double(cmo_double *m); /* functions for a cmo_list */ static cell* new_cell(cmo *ob) @@ -223,6 +224,14 @@ cmo_zero* new_cmo_zero() return m; } +cmo_double *new_cmo_double(double d) +{ + cmo_double* m = malloc(sizeof(cmo_double)); + m->tag = CMO_64BIT_MACHINE_DOUBLE; + m->d = d; + return m; +} + cmo_dms_generic* new_cmo_dms_generic() { cmo_dms_generic* m = malloc(sizeof(cmo_dms_generic)); @@ -316,9 +325,20 @@ static char *new_string_set_cmo_list(cmo_list *m) return s; } +static char *new_string_set_cmo_double(cmo_double *m) +{ + char buff[1024]; + char *s; + + sprintf(buff, "%lf", m->d); + s = malloc(strlen(buff)+1); + strcpy(s, buff); + + return s; +} + char *new_string_set_cmo(cmo *m) { - symbol_t symp; switch(m->tag) { case CMO_ZZ: return new_string_set_cmo_zz((cmo_zz *)m); @@ -330,13 +350,11 @@ char *new_string_set_cmo(cmo *m) return new_string_set_cmo_null(); case CMO_LIST: return new_string_set_cmo_list((cmo_list *)m); + case CMO_64BIT_MACHINE_DOUBLE: + return new_string_set_cmo_int32(m); default: -#ifdef DEBUG - symp = lookup_by_tag(m->tag); - ox_printf("I do not know how to convert %s to a string.\n", symp->key); -#endif + ox_printf("unconvertible <%s>\n", get_symbol_by_tag(m->tag)); /* yet not implemented. */ return NULL; } } -