aboutsummaryrefslogtreecommitdiff
path: root/src/eval_defs.h
diff options
context:
space:
mode:
authorFelipe Oliveira Carvalho <felipekde@gmail.com>2014-03-13 02:40:51 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-03-18 20:19:19 -0300
commit59f2430a8d543fc57a31d489a649ec87a6ca9715 (patch)
tree69d4e89c8f37efc3b5e20ab05e70a9eb4e4c1c05 /src/eval_defs.h
parent1fcd332e8e3d2c6c22fa548cc96b1d9dde2f5651 (diff)
downloadrneovim-59f2430a8d543fc57a31d489a649ec87a6ca9715.tar.gz
rneovim-59f2430a8d543fc57a31d489a649ec87a6ca9715.tar.bz2
rneovim-59f2430a8d543fc57a31d489a649ec87a6ca9715.zip
Delete structs.h by spliting it and moving code to other headers
Here's the list of squashed commits (for more info, see PR #378). - Define guicolor_T as a typedef in syntax.h - Move a big chunk of code from structs.h to buffer_defs.h - Move aco_save_T from structs.h to fileio.h - Move option_table_T from structs.h to hardcopy.h Aditionally: - Move the printer_opts global to hardcopy.c - Delete structs.h. Include buffer_defs.h where structs.h was included before. - Add header guards to option_defs.h - Put mark types and constants in new mark_defs.h - Move undo structs to undo_defs.h - Move memfile structs to new memfile_defs.h - Move expand_T and cmdmod_T to ex_cmds_defs.h - Move memline_T to memline_defs.h - Move many defs and types to ex_eval.h - Move syntax related types to syntax_defs.h - Move struct memfile to memfile_defs.h - struct buffblock and struct buffheader moved back to buffer_defs.h - Move some datatypes to hashtab.h and eval_defs.h - Move the buffer_defs.h include and TODOs for remaining unrelated types in buffer_defs.h
Diffstat (limited to 'src/eval_defs.h')
-rw-r--r--src/eval_defs.h120
1 files changed, 120 insertions, 0 deletions
diff --git a/src/eval_defs.h b/src/eval_defs.h
new file mode 100644
index 0000000000..c925514597
--- /dev/null
+++ b/src/eval_defs.h
@@ -0,0 +1,120 @@
+#ifndef NEOVIM_EVAL_DEFS_H
+#define NEOVIM_EVAL_DEFS_H
+
+#include "hashtab.h"
+
+#if SIZEOF_INT <= 3 /* use long if int is smaller than 32 bits */
+typedef long varnumber_T;
+#else
+typedef int varnumber_T;
+#endif
+typedef double float_T;
+
+typedef struct listvar_S list_T;
+typedef struct dictvar_S dict_T;
+
+/*
+ * Structure to hold an internal variable without a name.
+ */
+typedef struct {
+ char v_type; /* see below: VAR_NUMBER, VAR_STRING, etc. */
+ char v_lock; /* see below: VAR_LOCKED, VAR_FIXED */
+ union {
+ varnumber_T v_number; /* number value */
+ float_T v_float; /* floating number value */
+ char_u *v_string; /* string value (can be NULL!) */
+ list_T *v_list; /* list value (can be NULL!) */
+ dict_T *v_dict; /* dict value (can be NULL!) */
+ } vval;
+} typval_T;
+
+/* Values for "v_type". */
+#define VAR_UNKNOWN 0
+#define VAR_NUMBER 1 /* "v_number" is used */
+#define VAR_STRING 2 /* "v_string" is used */
+#define VAR_FUNC 3 /* "v_string" is function name */
+#define VAR_LIST 4 /* "v_list" is used */
+#define VAR_DICT 5 /* "v_dict" is used */
+#define VAR_FLOAT 6 /* "v_float" is used */
+
+/* Values for "dv_scope". */
+#define VAR_SCOPE 1 /* a:, v:, s:, etc. scope dictionaries */
+#define VAR_DEF_SCOPE 2 /* l:, g: scope dictionaries: here funcrefs are not
+ allowed to mask existing functions */
+
+/* Values for "v_lock". */
+#define VAR_LOCKED 1 /* locked with lock(), can use unlock() */
+#define VAR_FIXED 2 /* locked forever */
+
+/*
+ * Structure to hold an item of a list: an internal variable without a name.
+ */
+typedef struct listitem_S listitem_T;
+
+struct listitem_S {
+ listitem_T *li_next; /* next item in list */
+ listitem_T *li_prev; /* previous item in list */
+ typval_T li_tv; /* type and value of the variable */
+};
+
+/*
+ * Struct used by those that are using an item in a list.
+ */
+typedef struct listwatch_S listwatch_T;
+
+struct listwatch_S {
+ listitem_T *lw_item; /* item being watched */
+ listwatch_T *lw_next; /* next watcher */
+};
+
+/*
+ * Structure to hold info about a list.
+ */
+struct listvar_S {
+ listitem_T *lv_first; /* first item, NULL if none */
+ listitem_T *lv_last; /* last item, NULL if none */
+ int lv_refcount; /* reference count */
+ int lv_len; /* number of items */
+ listwatch_T *lv_watch; /* first watcher, NULL if none */
+ int lv_idx; /* cached index of an item */
+ listitem_T *lv_idx_item; /* when not NULL item at index "lv_idx" */
+ int lv_copyID; /* ID used by deepcopy() */
+ list_T *lv_copylist; /* copied list used by deepcopy() */
+ char lv_lock; /* zero, VAR_LOCKED, VAR_FIXED */
+ list_T *lv_used_next; /* next list in used lists list */
+ list_T *lv_used_prev; /* previous list in used lists list */
+};
+
+/*
+ * Structure to hold an item of a Dictionary.
+ * Also used for a variable.
+ * The key is copied into "di_key" to avoid an extra alloc/free for it.
+ */
+struct dictitem_S {
+ typval_T di_tv; /* type and value of the variable */
+ char_u di_flags; /* flags (only used for variable) */
+ char_u di_key[1]; /* key (actually longer!) */
+};
+
+typedef struct dictitem_S dictitem_T;
+
+#define DI_FLAGS_RO 1 /* "di_flags" value: read-only variable */
+#define DI_FLAGS_RO_SBX 2 /* "di_flags" value: read-only in the sandbox */
+#define DI_FLAGS_FIX 4 /* "di_flags" value: fixed variable, not allocated */
+#define DI_FLAGS_LOCK 8 /* "di_flags" value: locked variable */
+
+/*
+ * Structure to hold info about a Dictionary.
+ */
+struct dictvar_S {
+ char dv_lock; /* zero, VAR_LOCKED, VAR_FIXED */
+ char dv_scope; /* zero, VAR_SCOPE, VAR_DEF_SCOPE */
+ int dv_refcount; /* reference count */
+ int dv_copyID; /* ID used by deepcopy() */
+ hashtab_T dv_hashtab; /* hashtab that refers to the items */
+ dict_T *dv_copydict; /* copied dict used by deepcopy() */
+ dict_T *dv_used_next; /* next dict in used dicts list */
+ dict_T *dv_used_prev; /* previous dict in used dicts list */
+};
+
+#endif // NEOVIM_EVAL_DEFS_H