Mercurial > spc_convert
diff demo/demo_util.h @ 0:e38dacceb958
initial import
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 21 Oct 2011 05:53:11 -0700 |
parents | |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/demo/demo_util.h Fri Oct 21 05:53:11 2011 -0700 1.3 @@ -0,0 +1,31 @@ 1.4 +/* General-purpose utilities used by demos */ 1.5 + 1.6 +/* snes_spc 0.9.0 */ 1.7 +#ifndef DEMO_UTIL_H 1.8 +#define DEMO_UTIL_H 1.9 + 1.10 +/* commonly used headers */ 1.11 +#include <assert.h> 1.12 +#include <stdlib.h> 1.13 +#include <string.h> 1.14 +#include <stdio.h> 1.15 + 1.16 +#ifdef __cplusplus 1.17 + extern "C" { 1.18 +#endif 1.19 + 1.20 +/* If str is not NULL, prints it and exits program, otherwise returns */ 1.21 +void error( const char* str ); 1.22 + 1.23 +/* Loads file and returns pointer to data in memory, allocated with malloc(). 1.24 +If size_out != NULL, sets *size_out to size of data. */ 1.25 +unsigned char* load_file( const char* path, long* size_out ); 1.26 + 1.27 +/* Writes data to file */ 1.28 +void write_file( const char* path, void const* in, long size ); 1.29 + 1.30 +#ifdef __cplusplus 1.31 + } 1.32 +#endif 1.33 + 1.34 +#endif