aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Hillegeer <nicolas@hillegeer.com>2014-07-18 10:51:44 +0200
committerJustin M. Keyes <justinkz@gmail.com>2014-07-20 16:59:57 -0400
commitab1eec10a1906cadeed7f480b0d12505a0fba0ad (patch)
treed4452ccd50ba368d02e953dd0f40bd6378fd56e1
parentd19712f23345af2545af609721f1dbccd002a0df (diff)
downloadrneovim-ab1eec10a1906cadeed7f480b0d12505a0fba0ad.tar.gz
rneovim-ab1eec10a1906cadeed7f480b0d12505a0fba0ad.tar.bz2
rneovim-ab1eec10a1906cadeed7f480b0d12505a0fba0ad.zip
globals.h: decouple vim.h and globals.h
Allow globals.h to be included without including vim.h. Another small piece of the puzzle of dismantling vim.h. Moving some extra `#define`'s to globals.h is no better than having them in vim.h. We should, in a later PR, move them to the file where they belong or to a separate `constants.h` or something.
-rw-r--r--src/nvim/globals.h21
-rw-r--r--src/nvim/types.h9
-rw-r--r--src/nvim/vim.h51
3 files changed, 32 insertions, 49 deletions
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 1f402f3ef9..b3ed2f7239 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -10,15 +10,36 @@
#include <stdbool.h>
+// EXTERN is only defined in main.c. That's where global variables are
+// actually defined and initialized.
+#ifndef EXTERN
+# define EXTERN extern
+# define INIT(x)
+#else
+# ifndef INIT
+# define INIT(x) x
+# define DO_INIT
+# endif
+#endif
+
#include "nvim/ex_eval.h"
#include "nvim/mbyte.h"
#include "nvim/menu.h"
#include "nvim/syntax_defs.h"
+#include "nvim/types.h"
/*
* definition of global variables
*/
+#define IOSIZE (1024+1) // file I/O and sprintf buffer size
+
+#define MAX_MCO 6 // maximum value for 'maxcombine'
+
+# define MSG_BUF_LEN 480 // length of buffer for small messages
+# define MSG_BUF_CLEN (MSG_BUF_LEN / 6) // cell length (worst case: utf-8
+ // takes 6 bytes for one cell)
+
/* Values for "starting" */
#define NO_SCREEN 2 /* no screen updating yet */
#define NO_BUFFERS 1 /* not all buffers loaded yet */
diff --git a/src/nvim/types.h b/src/nvim/types.h
index 9d53722014..c18c6abb4b 100644
--- a/src/nvim/types.h
+++ b/src/nvim/types.h
@@ -24,4 +24,13 @@ typedef uintptr_t long_u;
*/
typedef unsigned char char_u;
+// The u8char_T can hold one decoded UTF-8 character. We normally use 32
+// bits now, since some Asian characters don't fit in 16 bits. u8char_T is
+// only used for displaying, it could be 16 bits to save memory.
+#ifdef UNICODE16
+typedef uint16_t u8char_T;
+#else
+typedef uint32_t u8char_T;
+#endif
+
#endif /* NVIM_TYPES_H */
diff --git a/src/nvim/vim.h b/src/nvim/vim.h
index e324a8bedc..5d903633e4 100644
--- a/src/nvim/vim.h
+++ b/src/nvim/vim.h
@@ -61,18 +61,6 @@ Error: configure did not run properly.Check auto/config.log.
# define MAX_TYPENR 65535
-/*
- * The u8char_T can hold one decoded UTF-8 character.
- * We normally use 32 bits now, since some Asian characters don't fit in 16
- * bits. u8char_T is only used for displaying, it could be 16 bits to save
- * memory.
- */
-# ifdef UNICODE16
-typedef uint16_t u8char_T;
-# else
-typedef uint32_t u8char_T;
-# endif
-
#include "nvim/keymap.h"
#include "nvim/term_defs.h"
#include "nvim/macros.h"
@@ -258,15 +246,8 @@ enum {
#define LSIZE 512 /* max. size of a line in the tags file */
-#define IOSIZE (1024+1) /* file i/o and sprintf buffer size */
-
#define DIALOG_MSG_SIZE 1000 /* buffer size for dialog_msg() */
-# define MSG_BUF_LEN 480 /* length of buffer for small messages */
-# define MSG_BUF_CLEN (MSG_BUF_LEN / 6) /* cell length (worst case: utf-8
- takes 6 bytes for one cell) */
-
-
/*
* Maximum length of key sequence to be mapped.
* Must be able to hold an Amiga resize report.
@@ -392,37 +373,11 @@ enum {
*/
#define vim_iswhite(x) ((x) == ' ' || (x) == '\t')
-/*
- * EXTERN is only defined in main.c. That's where global variables are
- * actually defined and initialized.
- */
-#ifndef EXTERN
-# define EXTERN extern
-# define INIT(x)
-#else
-# ifndef INIT
-# define INIT(x) x
-# define DO_INIT
-# endif
-#endif
-
-# define MAX_MCO 6 /* maximum value for 'maxcombine' */
-
/* Maximum number of bytes in a multi-byte character. It can be one 32-bit
* character of up to 6 bytes, or one 16-bit character of up to three bytes
* plus six following composing characters of three bytes each. */
# define MB_MAXBYTES 21
-
-
-
-
-
-
-
-#include "nvim/buffer_defs.h" /* buffer and windows */
-#include "nvim/ex_cmds_defs.h" /* Ex command defines */
-
/* This has to go after the include of proto.h, as proto/gui.pro declares
* functions of these names. The declarations would break if the defines had
* been seen at that stage. But it must be before globals.h, where error_ga
@@ -436,11 +391,9 @@ enum {
# define USE_MCH_ERRMSG
#endif
-
-
-
#include "nvim/globals.h" /* global variables and messages */
-
+#include "nvim/buffer_defs.h" /* buffer and windows */
+#include "nvim/ex_cmds_defs.h" /* Ex command defines */
# ifdef USE_ICONV
# ifndef EILSEQ