shithub: orca

Download patch

ref: da19d991a0e3f2c75689f1e27f3661e28f652ca0
parent: d9ed4b401e282991ce0c102d2b968e07ebb0f58d
author: cancel <cancel@cancel.fm>
date: Sun Jan 12 03:55:00 EST 2020

Move field_load_error_string to field.h/.c

--- a/field.c
+++ b/field.c
@@ -116,6 +116,31 @@
   return Field_load_error_ok;
 }
 
+char const* field_load_error_string(Field_load_error fle) {
+  char const* errstr = "Unknown";
+  switch (fle) {
+  case Field_load_error_ok:
+    errstr = "OK";
+    break;
+  case Field_load_error_cant_open_file:
+    errstr = "Unable to open file";
+    break;
+  case Field_load_error_too_many_columns:
+    errstr = "Grid file has too many columns";
+    break;
+  case Field_load_error_too_many_rows:
+    errstr = "Grid file has too many rows";
+    break;
+  case Field_load_error_no_rows_read:
+    errstr = "Grid file has no rows";
+    break;
+  case Field_load_error_not_a_rectangle:
+    errstr = "Grid file is not a rectangle";
+    break;
+  }
+  return errstr;
+}
+
 void mbuf_reusable_init(Mbuf_reusable* mbr) {
   mbr->buffer = NULL;
   mbr->capacity = 0;
--- a/field.h
+++ b/field.h
@@ -31,6 +31,8 @@
 
 Field_load_error field_load_file(char const* filepath, Field* field);
 
+char const* field_load_error_string(Field_load_error fle);
+
 // 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
--- a/tui_main.c
+++ b/tui_main.c
@@ -2344,31 +2344,6 @@
   }
 }
 
-char const* field_load_error_string(Field_load_error fle) {
-  char const* errstr = "Unknown";
-  switch (fle) {
-  case Field_load_error_ok:
-    errstr = "OK";
-    break;
-  case Field_load_error_cant_open_file:
-    errstr = "Unable to open file";
-    break;
-  case Field_load_error_too_many_columns:
-    errstr = "Grid file has too many columns";
-    break;
-  case Field_load_error_too_many_rows:
-    errstr = "Grid file has too many rows";
-    break;
-  case Field_load_error_no_rows_read:
-    errstr = "Grid file has no rows";
-    break;
-  case Field_load_error_not_a_rectangle:
-    errstr = "Grid file is not a rectangle";
-    break;
-  }
-  return errstr;
-}
-
 typedef struct {
   oso* portmidi_output_device;
 } Prefs;