6 /* If memory allocation fails, bail out */
7 void *safe_malloc(size_t size)
9 void *ptr = malloc(size);
10 if(!ptr) fatal_error("Out of memory in safe_malloc", 0);
14 vm_char *safe_strdup(const vm_char *str)
16 vm_char *ptr = STRDUP(str);
17 if(!ptr) fatal_error("Out of memory in safe_strdup", 0);
21 /* We don't use printf directly, because format directives are not portable.
22 Instead we define the common cases here. */
28 void print_string(const char *str)
33 void print_cell(cell x)
35 printf(cell_FORMAT,x);
38 void print_cell_hex(cell x)
40 printf(cell_HEX_FORMAT,x);
43 void print_cell_hex_pad(cell x)
45 printf(cell_HEX_PAD_FORMAT,x);
48 void print_fixnum(fixnum x)
50 printf(FIXNUM_FORMAT,x);
56 if(scanf(cell_HEX_FORMAT,&cell) < 0) exit(1);