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);
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);
18 /* We don't use printf directly, because format directives are not portable.
19 Instead we define the common cases here. */
25 void print_string(const char *str
)
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)
53 scanf(CELL_HEX_FORMAT
,&cell
);