comparison src/c/urweb.c @ 285:e89076c41c39

toString for float and bool
author Adam Chlipala <adamc@hcoop.net>
date Sun, 07 Sep 2008 10:20:42 -0400
parents 77a28e7430bf
children ffe5b01908ae
comparison
equal deleted inserted replaced
284:77a28e7430bf 285:e89076c41c39
679 r = ctx->heap_front; 679 r = ctx->heap_front;
680 sprintf(r, "%lld%n", n, &len); 680 sprintf(r, "%lld%n", n, &len);
681 ctx->heap_front += len+1; 681 ctx->heap_front += len+1;
682 return r; 682 return r;
683 } 683 }
684
685 lw_Basis_string lw_Basis_floatToString(lw_context ctx, lw_Basis_float n) {
686 int len;
687 char *r;
688
689 lw_check_heap(ctx, FLOATS_MAX);
690 r = ctx->heap_front;
691 sprintf(r, "%g%n", n, &len);
692 ctx->heap_front += len+1;
693 return r;
694 }
695
696 lw_Basis_string lw_Basis_boolToString(lw_context ctx, lw_Basis_bool b) {
697 if (b == lw_Basis_False)
698 return "False";
699 else
700 return "True";
701 }