Mercurial > spc_convert
annotate 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 |
rev | line source |
---|---|
rlm@0 | 1 /* General-purpose utilities used by demos */ |
rlm@0 | 2 |
rlm@0 | 3 /* snes_spc 0.9.0 */ |
rlm@0 | 4 #ifndef DEMO_UTIL_H |
rlm@0 | 5 #define DEMO_UTIL_H |
rlm@0 | 6 |
rlm@0 | 7 /* commonly used headers */ |
rlm@0 | 8 #include <assert.h> |
rlm@0 | 9 #include <stdlib.h> |
rlm@0 | 10 #include <string.h> |
rlm@0 | 11 #include <stdio.h> |
rlm@0 | 12 |
rlm@0 | 13 #ifdef __cplusplus |
rlm@0 | 14 extern "C" { |
rlm@0 | 15 #endif |
rlm@0 | 16 |
rlm@0 | 17 /* If str is not NULL, prints it and exits program, otherwise returns */ |
rlm@0 | 18 void error( const char* str ); |
rlm@0 | 19 |
rlm@0 | 20 /* Loads file and returns pointer to data in memory, allocated with malloc(). |
rlm@0 | 21 If size_out != NULL, sets *size_out to size of data. */ |
rlm@0 | 22 unsigned char* load_file( const char* path, long* size_out ); |
rlm@0 | 23 |
rlm@0 | 24 /* Writes data to file */ |
rlm@0 | 25 void write_file( const char* path, void const* in, long size ); |
rlm@0 | 26 |
rlm@0 | 27 #ifdef __cplusplus |
rlm@0 | 28 } |
rlm@0 | 29 #endif |
rlm@0 | 30 |
rlm@0 | 31 #endif |