aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-10-21 04:09:11 +0200
committerJustin M. Keyes <justinkz@gmail.com>2017-10-21 04:09:11 +0200
commita3a9ef9ad4ecf6ee1db98148d165755043d3ff04 (patch)
treeea161efef8bcf1c856bb6e39749584e1f0d78084 /src
parent3ce97879d09c5cbeba6fdc5ebd7525b127df18e0 (diff)
parentdde3ece10ed4ee62744009fa1fd347be740fc845 (diff)
downloadrneovim-a3a9ef9ad4ecf6ee1db98148d165755043d3ff04.tar.gz
rneovim-a3a9ef9ad4ecf6ee1db98148d165755043d3ff04.tar.bz2
rneovim-a3a9ef9ad4ecf6ee1db98148d165755043d3ff04.zip
Merge #7030 'refactor/single-include'
ref #5321
Diffstat (limited to 'src')
-rw-r--r--src/nvim/CMakeLists.txt5
-rw-r--r--src/nvim/regexp_defs.h46
-rw-r--r--src/nvim/syntax_defs.h8
-rw-r--r--src/nvim/terminal.c2
-rw-r--r--src/nvim/terminal.h2
-rw-r--r--src/nvim/undo.h1
-rw-r--r--src/nvim/undo_defs.h6
7 files changed, 38 insertions, 32 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index bcbbc76cbc..a166ee6c02 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -541,11 +541,6 @@ endfunction()
set(NO_SINGLE_CHECK_HEADERS
os/win_defs.h
os/pty_process_win.h
- regexp_defs.h
- syntax_defs.h
- terminal.h
- undo.h
- undo_defs.h
)
foreach(hfile ${NVIM_HEADERS})
get_test_target(test-includes "${hfile}" relative_path texe)
diff --git a/src/nvim/regexp_defs.h b/src/nvim/regexp_defs.h
index 6426ee441b..b5d56e07fc 100644
--- a/src/nvim/regexp_defs.h
+++ b/src/nvim/regexp_defs.h
@@ -15,6 +15,8 @@
#include <stdbool.h>
#include "nvim/pos.h"
+#include "nvim/types.h"
+#include "nvim/profile.h"
/*
* The number of sub-matches is limited to 10.
@@ -41,18 +43,36 @@
#define NFA_ENGINE 2
typedef struct regengine regengine_T;
+typedef struct regprog regprog_T;
+typedef struct reg_extmatch reg_extmatch_T;
+
+/// Structure to be used for multi-line matching.
+/// Sub-match "no" starts in line "startpos[no].lnum" column "startpos[no].col"
+/// and ends in line "endpos[no].lnum" just before column "endpos[no].col".
+/// The line numbers are relative to the first line, thus startpos[0].lnum is
+/// always 0.
+/// When there is no match, the line number is -1.
+typedef struct {
+ regprog_T *regprog;
+ lpos_T startpos[NSUBEXP];
+ lpos_T endpos[NSUBEXP];
+ int rmm_ic;
+ colnr_T rmm_maxcol; /// when not zero: maximum column
+} regmmatch_T;
+
+#include "nvim/buffer_defs.h"
/*
* Structure returned by vim_regcomp() to pass on to vim_regexec().
* This is the general structure. For the actual matcher, two specific
* structures are used. See code below.
*/
-typedef struct regprog {
+struct regprog {
regengine_T *engine;
unsigned regflags;
unsigned re_engine; ///< Automatic, backtracking or NFA engine.
unsigned re_flags; ///< Second argument for vim_regcomp().
-} regprog_T;
+};
/*
* Structure used by the back track matcher.
@@ -126,30 +146,14 @@ typedef struct {
} regmatch_T;
/*
- * Structure to be used for multi-line matching.
- * Sub-match "no" starts in line "startpos[no].lnum" column "startpos[no].col"
- * and ends in line "endpos[no].lnum" just before column "endpos[no].col".
- * The line numbers are relative to the first line, thus startpos[0].lnum is
- * always 0.
- * When there is no match, the line number is -1.
- */
-typedef struct {
- regprog_T *regprog;
- lpos_T startpos[NSUBEXP];
- lpos_T endpos[NSUBEXP];
- int rmm_ic;
- colnr_T rmm_maxcol; /* when not zero: maximum column */
-} regmmatch_T;
-
-/*
* Structure used to store external references: "\z\(\)" to "\z\1".
* Use a reference count to avoid the need to copy this around. When it goes
* from 1 to zero the matches need to be freed.
*/
-typedef struct {
- short refcnt;
+struct reg_extmatch {
+ int16_t refcnt;
char_u *matches[NSUBEXP];
-} reg_extmatch_T;
+};
struct regengine {
regprog_T *(*regcomp)(char_u*, int);
diff --git a/src/nvim/syntax_defs.h b/src/nvim/syntax_defs.h
index 56fadbe7f6..7260853703 100644
--- a/src/nvim/syntax_defs.h
+++ b/src/nvim/syntax_defs.h
@@ -2,7 +2,6 @@
#define NVIM_SYNTAX_DEFS_H
#include "nvim/highlight_defs.h"
-#include "nvim/regexp_defs.h"
# define SST_MIN_ENTRIES 150 /* minimal size for state stack array */
# define SST_MAX_ENTRIES 1000 /* maximal size for state stack array */
@@ -10,6 +9,11 @@
# define SST_DIST 16 /* normal distance between entries */
# define SST_INVALID (synstate_T *)-1 /* invalid syn_state pointer */
+typedef struct syn_state synstate_T;
+
+#include "nvim/buffer_defs.h"
+#include "nvim/regexp_defs.h"
+
typedef unsigned short disptick_T; /* display tick type */
/* struct passed to in_id_list() */
@@ -48,8 +52,6 @@ typedef struct buf_state {
* syn_state contains the syntax state stack for the start of one line.
* Used by b_sst_array[].
*/
-typedef struct syn_state synstate_T;
-
struct syn_state {
synstate_T *sst_next; /* next entry in used or free list */
linenr_T sst_lnum; /* line number for this state */
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index 4a9acf2559..1dac9c69bd 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -552,7 +552,7 @@ void terminal_receive(Terminal *term, char *data, size_t len)
}
void terminal_get_line_attributes(Terminal *term, win_T *wp, int linenr,
- int *term_attrs)
+ int *term_attrs)
{
int height, width;
vterm_get_size(term->vt, &height, &width);
diff --git a/src/nvim/terminal.h b/src/nvim/terminal.h
index 25e609fb68..f2b0e232c3 100644
--- a/src/nvim/terminal.h
+++ b/src/nvim/terminal.h
@@ -10,6 +10,8 @@ typedef void (*terminal_write_cb)(char *buffer, size_t size, void *data);
typedef void (*terminal_resize_cb)(uint16_t width, uint16_t height, void *data);
typedef void (*terminal_close_cb)(void *data);
+#include "nvim/buffer_defs.h"
+
typedef struct {
void *data;
uint16_t width, height;
diff --git a/src/nvim/undo.h b/src/nvim/undo.h
index ab8584fbb2..802cdc5583 100644
--- a/src/nvim/undo.h
+++ b/src/nvim/undo.h
@@ -2,6 +2,7 @@
#define NVIM_UNDO_H
#include "nvim/undo_defs.h"
+#include "nvim/ex_cmds_defs.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "undo.h.generated.h"
diff --git a/src/nvim/undo_defs.h b/src/nvim/undo_defs.h
index d841210815..6c7e2bba41 100644
--- a/src/nvim/undo_defs.h
+++ b/src/nvim/undo_defs.h
@@ -4,9 +4,10 @@
#include <time.h> // for time_t
#include "nvim/pos.h"
-#include "nvim/buffer_defs.h"
#include "nvim/mark_defs.h"
+typedef struct u_header u_header_T;
+
/* Structure to store info about the Visual area. */
typedef struct {
pos_T vi_start; /* start pos of last VIsual */
@@ -15,8 +16,9 @@ typedef struct {
colnr_T vi_curswant; /* MAXCOL from w_curswant */
} visualinfo_T;
+#include "nvim/buffer_defs.h"
+
typedef struct u_entry u_entry_T;
-typedef struct u_header u_header_T;
struct u_entry {
u_entry_T *ue_next; /* pointer to next entry in list */
linenr_T ue_top; /* number of line above undo block */