diff --git a/include/libg1m/mcs.h b/include/libg1m/mcs.h index 8601f6f..05558d9 100644 --- a/include/libg1m/mcs.h +++ b/include/libg1m/mcs.h @@ -71,11 +71,13 @@ typedef g1m_mcsfile_type_t g1m_mcstype_t; /* ************************************************************************** */ /* Helpers */ /* ************************************************************************** */ +/* MCS cell flags */ +# define g1m_mcscellflag_used 0x0001 + /* List, Matrix, Vector and Spreadsheet cell. */ typedef struct g1m_mcs_cell_s { - g1m_bcd_t real; - g1m_bcd_t imgn; - int used; + g1m_bcd_t real, imgn; + unsigned int flags; } g1m_mcscell_t; /* ************************************************************************** */ /* Main structures */ diff --git a/src/decode/casemul.c b/src/decode/casemul.c index 7f601a7..c7dac20 100644 --- a/src/decode/casemul.c +++ b/src/decode/casemul.c @@ -221,7 +221,7 @@ static int read_matrix(g1m_mcsfile_t **pfile, g1m_buffer_t *buffer, cells[y][x] = (g1m_mcscell_t){ .real = bcd, .imgn = {}, - .used = 1 + .flags = g1m_mcscellflag_used }; } @@ -285,7 +285,7 @@ static int read_list(g1m_mcsfile_t **pfile, g1m_buffer_t *buffer, cells[x][0] = (g1m_mcscell_t){ .real = bcd, .imgn = {}, - .used = 1 + .flags = g1m_mcscellflag_used }; } diff --git a/src/decode/mcs/list.c b/src/decode/mcs/list.c index b5a6490..85ad53c 100644 --- a/src/decode/mcs/list.c +++ b/src/decode/mcs/list.c @@ -52,7 +52,7 @@ int g1m_decode_mcs_list(g1m_mcsfile_t **handle, g1m_buffer_t *buffer, tab[y][0] = (g1m_mcscell_t){ .real = bcd, .imgn = {}, - .used = 1 + .flags = g1m_mcscellflag_used }; } diff --git a/src/decode/mcs/matrix.c b/src/decode/mcs/matrix.c index 583be30..a95b6c1 100644 --- a/src/decode/mcs/matrix.c +++ b/src/decode/mcs/matrix.c @@ -60,7 +60,7 @@ int g1m_decode_mcs_matrix(g1m_mcsfile_t **handle, g1m_buffer_t *buffer, tab[y][x] = (g1m_mcscell_t){ .real = bcd, .imgn = {}, - .used = 1 + .flags = g1m_mcscellflag_used }; } @@ -131,7 +131,7 @@ int g1m_decode_caspart_matrix(g1m_mcsfile_t *handle, g1m_buffer_t *buffer) handle->cells[cell.y][cell.x] = (g1m_mcscell_t){ .real = bcd, .imgn = {}, - .used = 1 + .flags = g1m_mcscellflag_used }; /* check if its the last cell */ diff --git a/src/decode/mcs/spreadsheet.c b/src/decode/mcs/spreadsheet.c index af2c6b7..358b4cf 100644 --- a/src/decode/mcs/spreadsheet.c +++ b/src/decode/mcs/spreadsheet.c @@ -82,9 +82,9 @@ int g1m_decode_mcs_spreadsheet(g1m_mcsfile_t **handle, g1m_buffer_t *buffer, /* store it */ cells[c * 1000 + i] = (g1m_mcscell_t){ - .used = 1, .real = cell, - .imgn = (g1m_bcd_t){} + .imgn = (g1m_bcd_t){}, + .flags = g1m_mcscellflag_used }; /* check things (max row, max col, cells count) */ diff --git a/src/decode/mcs/var.c b/src/decode/mcs/var.c index 94a74cf..6cf5edb 100644 --- a/src/decode/mcs/var.c +++ b/src/decode/mcs/var.c @@ -47,7 +47,7 @@ int g1m_decode_mcs_var(g1m_mcsfile_t **handle, g1m_buffer_t *buffer, for (int i = 0; i < head->count; i++) { g1m_bcd_frommcs(b++, &h->vars[i].real); g1m_bcd_frommcs(b++, &h->vars[i].imgn); - h->vars[i].used = 1; + h->vars[i].flags = g1m_mcscellflag_used; } /* no problem, woop woop */