-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sheet var/struct rename: ztv=>zsvsheet, zsv_sheet=>zsvsheet etc (#218)
* sheet var/struct rename: ztv=>zsvsheet, zsv_sheet=>zsvsheet etc
- Loading branch information
Showing
12 changed files
with
280 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
#ifndef ZSV_SHEET_BUFFER_H | ||
#define ZSV_SHEET_BUFFER_H | ||
#ifndef ZSVSHEET_BUFFER_H | ||
#define ZSVSHEET_BUFFER_H | ||
|
||
#define ZSV_SHEET_BUFFER_DEFAULT_CELL_BUFF_LEN 16 | ||
#define ZSV_SHEET_BUFFER_DEFAULT_MAX_CELL_LEN 32768 - 1 | ||
#define ZSV_SHEET_BUFFER_DEFAULT_ROW_COUNT 1000 | ||
#define ZSVSHEET_BUFFER_DEFAULT_CELL_BUFF_LEN 16 | ||
#define ZSVSHEET_BUFFER_DEFAULT_MAX_CELL_LEN 32768 - 1 | ||
#define ZSVSHEET_BUFFER_DEFAULT_ROW_COUNT 1000 | ||
|
||
typedef struct zsv_sheet_buffer *zsv_sheet_buffer_t; | ||
typedef struct zsvsheet_buffer *zsvsheet_buffer_t; | ||
|
||
enum zsv_sheet_buffer_status { | ||
zsv_sheet_buffer_status_ok = 0, | ||
zsv_sheet_buffer_status_memory, | ||
zsv_sheet_buffer_status_error, // generic error | ||
zsv_sheet_buffer_status_utf8 | ||
enum zsvsheet_buffer_status { | ||
zsvsheet_buffer_status_ok = 0, | ||
zsvsheet_buffer_status_memory, | ||
zsvsheet_buffer_status_error, // generic error | ||
zsvsheet_buffer_status_utf8 | ||
}; | ||
|
||
struct zsv_sheet_buffer_opts { | ||
struct zsvsheet_buffer_opts { | ||
size_t cell_buff_len; // default = 16. must be >= 2 * sizeof(void *) | ||
size_t max_cell_len; // length in bytes; defaults to 32767 | ||
size_t rows; // rows to buffer. cannot be < 256 | ||
char no_rownum_column; // reserved. TO DO: if set, omit row num column | ||
}; | ||
|
||
zsv_sheet_buffer_t zsv_sheet_buffer_new(size_t cols, struct zsv_sheet_buffer_opts *opts, | ||
enum zsv_sheet_buffer_status *stat); | ||
zsvsheet_buffer_t zsvsheet_buffer_new(size_t cols, struct zsvsheet_buffer_opts *opts, | ||
enum zsvsheet_buffer_status *stat); | ||
|
||
enum zsv_sheet_buffer_status zsv_sheet_buffer_write_cell(zsv_sheet_buffer_t buff, size_t row, size_t col, | ||
const unsigned char *value); | ||
enum zsvsheet_buffer_status zsvsheet_buffer_write_cell(zsvsheet_buffer_t buff, size_t row, size_t col, | ||
const unsigned char *value); | ||
|
||
enum zsv_sheet_buffer_status zsv_sheet_buffer_write_cell_w_len(zsv_sheet_buffer_t buff, size_t row, size_t col, | ||
const unsigned char *value, size_t len); | ||
enum zsvsheet_buffer_status zsvsheet_buffer_write_cell_w_len(zsvsheet_buffer_t buff, size_t row, size_t col, | ||
const unsigned char *value, size_t len); | ||
|
||
const unsigned char *zsv_sheet_buffer_cell_display(zsv_sheet_buffer_t buff, size_t row, size_t col); | ||
const unsigned char *zsvsheet_buffer_cell_display(zsvsheet_buffer_t buff, size_t row, size_t col); | ||
|
||
void zsv_sheet_buffer_delete(zsv_sheet_buffer_t); | ||
void zsvsheet_buffer_delete(zsvsheet_buffer_t); | ||
|
||
size_t zsv_sheet_buffer_cols(zsv_sheet_buffer_t); | ||
size_t zsv_sheet_buffer_rows(zsv_sheet_buffer_t buff); | ||
size_t zsvsheet_buffer_cols(zsvsheet_buffer_t); | ||
size_t zsvsheet_buffer_rows(zsvsheet_buffer_t buff); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
#include "key-bindings.h" | ||
|
||
#ifndef ZTV_CTRL | ||
#define ZTV_CTRL(c) ((c)&037) | ||
#ifndef ZSVSHEET_CTRL | ||
#define ZSVSHEET_CTRL(c) ((c)&037) | ||
#endif | ||
|
||
// to do: support customizable bindings | ||
static enum ztv_key ztv_key_binding(int ch) { | ||
static enum zsvsheet_key zsvsheet_key_binding(int ch) { | ||
if (ch == 27) // escape | ||
return ztv_key_escape; | ||
return zsvsheet_key_escape; | ||
if (ch == KEY_SF) // shift + down | ||
return ztv_key_move_bottom; | ||
return zsvsheet_key_move_bottom; | ||
if (ch == KEY_SR) // shift + up | ||
return ztv_key_move_top; | ||
return zsvsheet_key_move_top; | ||
if (ch == 'n') | ||
return ztv_key_find_next; | ||
return zsvsheet_key_find_next; | ||
if (ch == KEY_SLEFT) | ||
return ztv_key_move_first_col; | ||
return zsvsheet_key_move_first_col; | ||
if (ch == KEY_SRIGHT) | ||
return ztv_key_move_last_col; | ||
return zsvsheet_key_move_last_col; | ||
if (ch == KEY_UP) | ||
return ztv_key_move_up; | ||
return zsvsheet_key_move_up; | ||
if (ch == KEY_DOWN) | ||
return ztv_key_move_down; | ||
return zsvsheet_key_move_down; | ||
if (ch == KEY_LEFT) | ||
return ztv_key_move_left; | ||
return zsvsheet_key_move_left; | ||
if (ch == KEY_RIGHT) | ||
return ztv_key_move_right; | ||
if (ch == ZTV_CTRL('f')) | ||
return ztv_key_pg_down; | ||
if (ch == ZTV_CTRL('b')) | ||
return ztv_key_pg_up; | ||
return zsvsheet_key_move_right; | ||
if (ch == ZSVSHEET_CTRL('f')) | ||
return zsvsheet_key_pg_down; | ||
if (ch == ZSVSHEET_CTRL('b')) | ||
return zsvsheet_key_pg_up; | ||
if (ch == 'f') | ||
return ztv_key_filter; | ||
return zsvsheet_key_filter; | ||
if (ch == '/') | ||
return ztv_key_find; | ||
return zsvsheet_key_find; | ||
if (ch == 'q') | ||
return ztv_key_quit; | ||
return ztv_key_unknown; | ||
return zsvsheet_key_quit; | ||
return zsvsheet_key_unknown; | ||
} |
Oops, something went wrong.