Browse Source

Move field_load_error_string to field.h/.c

master
cancel 5 years ago
parent
commit
da19d991a0
  1. 25
      field.c
  2. 2
      field.h
  3. 25
      tui_main.c

25
field.c

@ -116,6 +116,31 @@ Field_load_error field_load_file(char const* filepath, Field* field) {
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;

2
field.h

@ -31,6 +31,8 @@ typedef enum {
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

25
tui_main.c

@ -2344,31 +2344,6 @@ void try_send_to_gui_clipboard(Ged const* a, bool* io_use_gui_clipboard) {
}
}
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;

Loading…
Cancel
Save