Browse Source

Remove mark.h and mark.c

Contents were folded into field.h and field.c.
master
cancel 5 years ago
parent
commit
bbb1bbd91d
  1. 1
      cli_main.c
  2. 15
      field.c
  3. 17
      field.h
  4. 16
      mark.c
  5. 11
      mark.h
  6. 1
      sim.h
  7. 2
      tool
  8. 1
      tui_main.c

1
cli_main.c

@ -1,7 +1,6 @@
#include "bank.h"
#include "base.h"
#include "field.h"
#include "mark.h"
#include "sim.h"
#include <getopt.h>

15
field.c

@ -115,3 +115,18 @@ Field_load_error field_load_file(char const* filepath, Field* field) {
fclose(file);
return Field_load_error_ok;
}
void mbuf_reusable_init(Mbuf_reusable* mbr) {
mbr->buffer = NULL;
mbr->capacity = 0;
}
void mbuf_reusable_ensure_size(Mbuf_reusable* mbr, Usz height, Usz width) {
Usz capacity = height * width;
if (mbr->capacity < capacity) {
mbr->buffer = realloc(mbr->buffer, capacity);
mbr->capacity = capacity;
}
}
void mbuf_reusable_deinit(Mbuf_reusable* mbr) { free(mbr->buffer); }

17
field.h

@ -30,3 +30,20 @@ typedef enum {
} Field_load_error;
Field_load_error field_load_file(char const* filepath, Field* field);
// A reusable buffer for the per-grid-cell flags. Similar to how Field is a
// reusable buffer for Glyph, Mbuf_reusable is for Mark. The naming isn't so
// great. Also like Field, the VM doesn't have to care about the buffer being
// reusable -- it only cares about a 'Mark*' type. (With the same dimensions of
// the 'Field*' buffer, since it uses them together.) There are no procedures
// for saving/loading Mark* buffers to/from disk, since we currently don't need
// that functionality.
typedef struct Mbuf_reusable {
Mark* buffer;
Usz capacity;
} Mbuf_reusable;
void mbuf_reusable_init(Mbuf_reusable* mbr);
void mbuf_reusable_ensure_size(Mbuf_reusable* mbr, Usz height, Usz width);
void mbuf_reusable_deinit(Mbuf_reusable* mbr);

16
mark.c

@ -1,16 +0,0 @@
#include "mark.h"
void mbuf_reusable_init(Mbuf_reusable* mbr) {
mbr->buffer = NULL;
mbr->capacity = 0;
}
void mbuf_reusable_ensure_size(Mbuf_reusable* mbr, Usz height, Usz width) {
Usz capacity = height * width;
if (mbr->capacity < capacity) {
mbr->buffer = realloc(mbr->buffer, capacity);
mbr->capacity = capacity;
}
}
void mbuf_reusable_deinit(Mbuf_reusable* mbr) { free(mbr->buffer); }

11
mark.h

@ -1,11 +0,0 @@
#pragma once
#include "base.h"
typedef struct Mbuf_reusable {
Mark* buffer;
Usz capacity;
} Mbuf_reusable;
void mbuf_reusable_init(Mbuf_reusable* mbr);
void mbuf_reusable_ensure_size(Mbuf_reusable* mbr, Usz height, Usz width);
void mbuf_reusable_deinit(Mbuf_reusable* mbr);

1
sim.h

@ -1,7 +1,6 @@
#pragma once
#include "bank.h"
#include "base.h"
#include "mark.h"
#define ORCA_PIANO_KEYS_COUNT ((size_t)(('9' - '0') + 1 + ('z' - 'a') + 1))
#define ORCA_PIANO_BITS_NONE UINT64_C(0)

2
tool

@ -286,7 +286,7 @@ build_target() {
;;
esac
add source_files gbuffer.c field.c mark.c bank.c sim.c
add source_files gbuffer.c field.c bank.c sim.c
case "$2" in
cli)
add source_files cli_main.c

1
tui_main.c

@ -2,7 +2,6 @@
#include "base.h"
#include "field.h"
#include "gbuffer.h"
#include "mark.h"
#include "osc_out.h"
#include "sim.h"
#include "term_util.h"

Loading…
Cancel
Save