Comment out alien.remote-control tests for now
[factor/jcg.git] / vm / utilities.c
blobd97b540884b8a7e3bab9a38598d4d548151e14d5
1 #include "master.h"
3 /* If memory allocation fails, bail out */
4 void *safe_malloc(size_t size)
6 void *ptr = malloc(size);
7 if(!ptr) fatal_error("Out of memory in safe_malloc", 0);
8 return ptr;
11 F_CHAR *safe_strdup(const F_CHAR *str)
13 F_CHAR *ptr = STRDUP(str);
14 if(!ptr) fatal_error("Out of memory in safe_strdup", 0);
15 return ptr;
18 /* We don't use printf directly, because format directives are not portable.
19 Instead we define the common cases here. */
20 void nl(void)
22 fputs("\n",stdout);
25 void print_string(const char *str)
27 fputs(str,stdout);
30 void print_cell(CELL x)
32 printf(CELL_FORMAT,x);
35 void print_cell_hex(CELL x)
37 printf(CELL_HEX_FORMAT,x);
40 void print_cell_hex_pad(CELL x)
42 printf(CELL_HEX_PAD_FORMAT,x);
45 void print_fixnum(F_FIXNUM x)
47 printf(FIXNUM_FORMAT,x);
50 CELL read_cell_hex(void)
52 CELL cell;
53 scanf(CELL_HEX_FORMAT,&cell);
54 return cell;