summaryrefslogtreecommitdiffstats
path: root/tmux.h
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2011-01-01 16:51:21 +0000
committerNicholas Marriott <nicm@openbsd.org>2011-01-01 16:51:21 +0000
commit3e8124009f6737c656e260b2f5b459b4ebe1a10c (patch)
treeb726a5db7cbcc8ff5d4b139be15911e46f3217c8 /tmux.h
parenta4515ce138a7c5f275a7134018cfa28c76612321 (diff)
Move the user-visible parts of all options (names, types, limit, default
values) together into one set of tables in options-table.c. Also clean up and simplify cmd-set-options.c and move a common print function into option-table.c.
Diffstat (limited to 'tmux.h')
-rw-r--r--tmux.h54
1 files changed, 32 insertions, 22 deletions
diff --git a/tmux.h b/tmux.h
index 116f8d78..45bb1a1b 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1270,23 +1270,31 @@ struct key_binding {
};
SPLAY_HEAD(key_bindings, key_binding);
-/* Set/display option data. */
-struct set_option_entry {
- const char *name;
- enum {
- SET_OPTION_STRING,
- SET_OPTION_NUMBER,
- SET_OPTION_KEYS,
- SET_OPTION_COLOUR,
- SET_OPTION_ATTRIBUTES,
- SET_OPTION_FLAG,
- SET_OPTION_CHOICE
- } type;
+/*
+ * Option table entries. The option table is the user-visible part of the
+ * option, as opposed to the internal options (struct option) which are just
+ * number or string.
+ */
+enum options_table_type {
+ OPTIONS_TABLE_STRING,
+ OPTIONS_TABLE_NUMBER,
+ OPTIONS_TABLE_KEYS,
+ OPTIONS_TABLE_COLOUR,
+ OPTIONS_TABLE_ATTRIBUTES,
+ OPTIONS_TABLE_FLAG,
+ OPTIONS_TABLE_CHOICE
+};
+
+struct options_table_entry {
+ const char *name;
+ enum options_table_type type;
- u_int minimum;
- u_int maximum;
+ u_int minimum;
+ u_int maximum;
+ const char **choices;
- const char **choices;
+ const char *default_str;
+ long long default_num;
};
/* List of configuration causes. */
@@ -1356,6 +1364,15 @@ struct options_entry *options_set_data(
struct options *, const char *, void *, void (*)(void *));
void *options_get_data(struct options *, const char *);
+/* options-table.c */
+extern const struct options_table_entry server_options_table[];
+extern const struct options_table_entry session_options_table[];
+extern const struct options_table_entry window_options_table[];
+void options_table_populate_tree(
+ const struct options_table_entry *, struct options *);
+const char *options_table_print_entry(
+ const struct options_table_entry *, struct options_entry *);
+
/* job.c */
extern struct joblist all_jobs;
int job_cmp(struct job *, struct job *);
@@ -1461,13 +1478,6 @@ char *paste_print(struct paste_buffer *, size_t);
extern const char clock_table[14][5][5];
void clock_draw(struct screen_write_ctx *, int, int);
-/* cmd-set-option.c */
-extern const struct set_option_entry set_option_table[];
-extern const struct set_option_entry set_session_option_table[];
-extern const struct set_option_entry set_window_option_table[];
-const char *cmd_set_option_print(
- const struct set_option_entry *, struct options_entry *);
-
/* cmd.c */
int cmd_pack_argv(int, char **, char *, size_t);
int cmd_unpack_argv(char *, size_t, int, char ***);