6 static int dump_map(
struct BM *map);
9 int main(
int argc,
char *argv[])
12 struct BM *map, *map2;
30 for (i = 0; i < SIZE; i++) {
32 BM_set(map, (SIZE - 1) - i, i, 1);
44 fprintf(stdout,
"\n\n");
46 for (y = 0; y < SIZE; y++)
47 for (x = 0; x < SIZE; x++) {
64 fp = fopen(
"dumpfile",
"w");
66 fprintf(stderr,
"File_write failed\n");
71 fp = fopen(
"dumpfile",
"r");
86 static int dump_map(
struct BM *map)
90 for (y = 0; y < map->
rows; y++) {
91 for (x = 0; x < map->
cols; x++) {
92 fprintf(stdout,
"%c",
BM_get(map, x, y) ?
'#' :
'.');
95 fprintf(stdout,
"\n");
int BM_dump_map_row_sparse(struct BM *, int)
Debugging code to dump out structure of links for single row.
size_t BM_get_map_size(struct BM *)
Returns size in bytes that bitmap is taking up.
int BM_set(struct BM *, int, int, int)
Sets bitmap value to 'val' at location 'x' 'y'.
struct BM * BM_file_read(FILE *)
Create map structure and load it from file.
int BM_destroy(struct BM *)
Destroy bitmap and free all associated memory.
int main(int argc, char *argv[])
int BM_file_write(FILE *, struct BM *)
Write bitmap out to file.
int BM_get(struct BM *, int, int)
Gets 'val' from the bitmap.
struct BM * BM_create_sparse(int, int)
Create a sparse bitmap of dimension 'x'/'y'.