shithub: orca

Download patch

ref: bbb1bbd91df2c1884c9866c17d757183141ba48f
parent: 7cd10dd0bf0b80569cb186ca2c32480f89dc14d9
author: cancel <cancel@cancel.fm>
date: Wed Jan 1 19:10:39 EST 2020

Remove mark.h and mark.c

Contents were folded into field.h and field.c.

--- a/cli_main.c
+++ b/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>
 
--- a/field.c
+++ b/field.c
@@ -115,3 +115,18 @@
   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); }
--- a/field.h
+++ b/field.h
@@ -30,3 +30,20 @@
 } 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);
--- a/mark.c
+++ /dev/null
@@ -1,16 +1,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); }
--- a/mark.h
+++ /dev/null
@@ -1,11 +1,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);
--- a/sim.h
+++ b/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)
--- a/tool
+++ b/tool
@@ -286,7 +286,7 @@
       ;;
   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
--- a/tui_main.c
+++ b/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"